Skip to contentSkip to conversation

ata: SATL compliance for Inquiry Product Revision

PATCH Superseded Keith Busch 2 participants 3 messages Apr 29, 2014 – May 1, 2014 libata

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ata: SATL compliance for Inquiry Product Revision

The SCSI/ATA Translation standard says to use data words 25 and 26 unless they are spaces. These words are generally more useful anway for devices that are not padding the firmware field with spaces.

---
 drivers/ata/libata-scsi.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/ata/libata-scsi.c +4 -1
index ef8567d..8034a38 100644
@@ -1993,7 +1993,10 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 	memcpy(rbuf, hdr, sizeof(hdr));
 	memcpy(&rbuf[8], "ATA     ", 8);
 	ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
-	ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
+	if (args->id[25] == 0x2020 && args->id[26] == 0x2020)
+		ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
+	else
+		ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV + 2, 4);
 
 	if (rbuf[32] == 0 || rbuf[32] == ' ')
 		memcpy(&rbuf[32], "n/a ", 4);
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 15 lines · Keith Busch

The SCSI/ATA Translation standard says to use data words 25 and 26 unless they are spaces. These words are generally more useful anway for devices that are not padding the firmware field with spaces.

---
 drivers/ata/libata-scsi.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/ata/libata-scsi.c +0 -0
index ef8567d..8034a38 100644

drivers/ata/libata-scsi.c static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) · line 1996

Quoted 5 lines
drivers/ata/libata-scsi.c +1 -1
@@ -1993,7 +1993,10 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 	memcpy(rbuf, hdr, sizeof(hdr));
 	memcpy(&rbuf[8], "ATA     ", 8);
 	ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
-	ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
+	if (args->id[25] == 0x2020 && args->id[26] == 0x2020)

Maybe strncmp(" ") is more readable? And can you please add some comment explaining what's going on?

drivers/ata/libata-scsi.c static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) · line 1999

Quoted 3 lines
drivers/ata/libata-scsi.c +3 -0
+		ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
+	else
+		ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV + 2, 4);

So, this would change the behavior for devices which were reporting stuff in ATA_ID_FW_REV. Prolly no biggiee.

Thanks.

Signature · 1 line
tejun
#2 lore raw
Quoted 10 lines · Tejun Heo

drivers/ata/libata-scsi.c static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) · line 1996

Quoted 6 lines · Keith Busch
drivers/ata/libata-scsi.c +1 -1
@@ -1993,7 +1993,10 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 	memcpy(rbuf, hdr, sizeof(hdr));
 	memcpy(&rbuf[8], "ATA     ", 8);
 	ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
-	ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
+	if (args->id[25] == 0x2020 && args->id[26] == 0x2020)

Maybe strncmp(" ") is more readable? And can you please add some comment explaining what's going on?

Sounds good. Will do a v2 with that.

Quoted 6 lines

drivers/ata/libata-scsi.c static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) · line 1999

Quoted 3 lines
drivers/ata/libata-scsi.c +3 -0
+		ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
+	else
+		ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV + 2, 4);

So, this would change the behavior for devices which were reporting stuff in ATA_ID_FW_REV. Prolly no biggiee.

Yep, though many devices do pad with spaces so it won't change for those. I did do a sanity check on both kinds to make sure it looked right.