All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libata SATL: WWN for device id VPD page
@ 2011-05-14  3:16 Douglas Gilbert
  2011-05-14  3:28 ` Douglas Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Douglas Gilbert @ 2011-05-14  3:16 UTC (permalink / raw)
  To: SCSI development list, IDE/ATA development list
  Cc: James.Bottomley, jgarzik, Tejun Heo

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

libata implements a SCSI to ATA Translation Layer and
should comply with the SAT (ANSI INCITS 431-2007) and
SAT-2 (ANSI INCITS 465-2010).

Both standards require that if an ATA device supplies
a World Wide Name (WWN) then it should appear in the
corresponding SCSI device identification VPD page.

Changelog:
   - add NAA descriptor to the device identification VPD
     page for the addressed logical unit. ATA's WWN is
     in NAA(5) format.

The attached patch is against lk 2.6.38 .


Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>

[-- Attachment #2: libata-scsi_vpd83.patch --]
[-- Type: text/x-patch, Size: 1112 bytes --]

--- linux/drivers/ata/libata-scsi.c	2011-03-16 06:47:24.647997871 -0400
+++ linux/drivers/ata/libata-scsi.c_vpd83a	2011-05-13 19:35:40.601635269 -0400
@@ -2028,12 +2028,29 @@ static unsigned int ata_scsiop_inq_80(st
 static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf)
 {
 	const int sat_model_serial_desc_len = 68;
-	int num;
+	int num, k;
+	unsigned char wwn_arr[8];
 
 	rbuf[1] = 0x83;			/* this page code */
 	num = 4;
 
-	/* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
+	/* WWN starts at word 108 in IDENTIFY response */
+	ata_id_string(args->id, wwn_arr, 108, 8);
+	/* SPL(SAS-2.1) checks for zeros rather than checking supported bit */
+	for (k = 0; (k < 8) && (0 == wwn_arr[k]); ++k)
+		;
+	if (k < 8) {	/* found non-zero WWN */
+		/* piv=0, assoc=lu, code_set=binary, designator=naa */
+		rbuf[num + 0] = 1;
+		rbuf[num + 1] = 3;
+		rbuf[num + 2] = 0;
+		rbuf[num + 3] = 8;
+		num += 4;
+		memcpy(rbuf + num, wwn_arr, 8);
+		num += 8;
+	}
+
+	/* piv=0, assoc=lu, code_set=ASCII, designator=vendor */
 	rbuf[num + 0] = 2;
 	rbuf[num + 3] = ATA_ID_SERNO_LEN;
 	num += 4;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libata SATL: WWN for device id VPD page
  2011-05-14  3:16 [PATCH] libata SATL: WWN for device id VPD page Douglas Gilbert
@ 2011-05-14  3:28 ` Douglas Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Douglas Gilbert @ 2011-05-14  3:28 UTC (permalink / raw)
  To: SCSI development list, IDE/ATA development list
  Cc: James.Bottomley, jgarzik, Tejun Heo

On 11-05-13 11:16 PM, Douglas Gilbert wrote:
> libata implements a SCSI to ATA Translation Layer and
> should comply with the SAT (ANSI INCITS 431-2007) and
> SAT-2 (ANSI INCITS 465-2010).
>
> Both standards require that if an ATA device supplies
> a World Wide Name (WWN) then it should appear in the
> corresponding SCSI device identification VPD page.
>
> Changelog:
> - add NAA descriptor to the device identification VPD
> page for the addressed logical unit. ATA's WWN is
> in NAA(5) format.
>
> The attached patch is against lk 2.6.38 .
>
>
> Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>

I should have checked 2.6.39-rc9 prior to posting. Almost
the same patch as I proposed is already there.

Doug Gilbert

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-14  3:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-14  3:16 [PATCH] libata SATL: WWN for device id VPD page Douglas Gilbert
2011-05-14  3:28 ` Douglas Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.