Skip to contentSkip to conversation

libata: sync SMART ioctls with ATA pass thru spec (T10/04-262r7)

PATCH In review John W. Linville 2 participants 3 messages Feb 2, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata: sync SMART ioctls with ATA pass thru spec (T10/04-262r7)

Update libata's SMART-related ioctl handlers to match the current ATA command pass-through specification (T10/04-262r7). Also change related SCSI op-code definition to match current spec.

---
Contact w/ spec author (Curtis Stevens @ Western Digital) indicates that while a revision 8 of the spec is expected, that it is really only a re-formatting of the text to match T10 requirements. According to Stevens, revision 8 is expected to be the last version of the spec.

 drivers/scsi/libata-scsi.c |    6 ++++--
 include/scsi/scsi.h        |    6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/libata-scsi.c renamed from drivers/scsi/libata-scsi.c.orig +4 -2
@@ -109,14 +109,16 @@ int ata_cmd_ioctl(struct scsi_device *sc
 			return -ENOMEM;
 
 		scsi_cmd[1]  = (4 << 1); /* PIO Data-in */
+		scsi_cmd[2]  = 0x0e;     /* no off.line or cc, read from dev,
+		                            block count in sector count field */
 		sreq->sr_data_direction = DMA_FROM_DEVICE;
 	} else {
 		scsi_cmd[1]  = (3 << 1); /* Non-data */
+		/* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
 		sreq->sr_data_direction = DMA_NONE;
 	}
 
 	scsi_cmd[0] = ATA_16;
-	scsi_cmd[2] = 0x1f;     /* no off.line or cc, yes all registers */
 
 	scsi_cmd[4] = args[2];
 	if (args[0] == WIN_SMART) { /* hack -- ide driver does this too... */
@@ -179,7 +181,7 @@ int ata_task_ioctl(struct scsi_device *s
 	memset(scsi_cmd, 0, sizeof(scsi_cmd));
 	scsi_cmd[0]  = ATA_16;
 	scsi_cmd[1]  = (3 << 1); /* Non-data */
-	scsi_cmd[2]  = 0x1f;     /* no off.line or cc, yes all registers */
+	/* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
 	scsi_cmd[4]  = args[1];
 	scsi_cmd[6]  = args[2];
 	scsi_cmd[8]  = args[3];
include/scsi/scsi.h renamed from include/scsi/scsi.h.orig +3 -3
@@ -113,9 +113,9 @@ extern const char *const scsi_device_typ
 /* values for service action in */
 #define	SAI_READ_CAPACITY_16  0x10
 
-/* Temporary values for T10/04-262 until official values are allocated */
-#define	ATA_16		      0x85	/* 16-byte pass-thru [0x85 == unused]*/
-#define	ATA_12		      0xb3	/* 12-byte pass-thru [0xb3 == obsolete set limits command] */
+/* Values for T10/04-262r7 */
+#define	ATA_16		      0x85	/* 16-byte pass-thru */
+#define	ATA_12		      0xa1	/* 12-byte pass-thru */
 
 /*
  *  SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft
Signature · 2 lines
John W. Linville
[email protected]
#1 lore raw
Quoted 47 lines · John W. Linville

Update libata's SMART-related ioctl handlers to match the current ATA command pass-through specification (T10/04-262r7). Also change related SCSI op-code definition to match current spec.

---
Contact w/ spec author (Curtis Stevens @ Western Digital) indicates that while a revision 8 of the spec is expected, that it is really only a re-formatting of the text to match T10 requirements. According to Stevens, revision 8 is expected to be the last version of the spec.

 drivers/scsi/libata-scsi.c |    6 ++++--
 include/scsi/scsi.h        |    6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/libata-scsi.c renamed from drivers/scsi/libata-scsi.c.orig +4 -2
@@ -109,14 +109,16 @@ int ata_cmd_ioctl(struct scsi_device *sc
 			return -ENOMEM;
 
 		scsi_cmd[1]  = (4 << 1); /* PIO Data-in */
+		scsi_cmd[2]  = 0x0e;     /* no off.line or cc, read from dev,
+		                            block count in sector count field */
 		sreq->sr_data_direction = DMA_FROM_DEVICE;
 	} else {
 		scsi_cmd[1]  = (3 << 1); /* Non-data */
+		/* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
 		sreq->sr_data_direction = DMA_NONE;
 	}
 
 	scsi_cmd[0] = ATA_16;
-	scsi_cmd[2] = 0x1f;     /* no off.line or cc, yes all registers */
 
 	scsi_cmd[4] = args[2];
 	if (args[0] == WIN_SMART) { /* hack -- ide driver does this too... */
@@ -179,7 +181,7 @@ int ata_task_ioctl(struct scsi_device *s
 	memset(scsi_cmd, 0, sizeof(scsi_cmd));
 	scsi_cmd[0]  = ATA_16;
 	scsi_cmd[1]  = (3 << 1); /* Non-data */
-	scsi_cmd[2]  = 0x1f;     /* no off.line or cc, yes all registers */
+	/* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
 	scsi_cmd[4]  = args[1];
 	scsi_cmd[6]  = args[2];
 	scsi_cmd[8]  = args[3];

include/scsi/scsi.h extern const char *const scsi_device_typ · line 118

Quoted 9 lines
include/scsi/scsi.h renamed from include/scsi/scsi.h.orig +3 -3
@@ -113,9 +113,9 @@ extern const char *const scsi_device_typ
 /* values for service action in */
 #define	SAI_READ_CAPACITY_16  0x10
 
-/* Temporary values for T10/04-262 until official values are allocated */
-#define	ATA_16		      0x85	/* 16-byte pass-thru [0x85 == unused]*/
-#define	ATA_12		      0xb3	/* 12-byte pass-thru [0xb3 == obsolete set limits command] */
+/* Values for T10/04-262r7 */
+#define	ATA_16		      0x85	/* 16-byte pass-thru */
+#define	ATA_12		      0xa1	/* 12-byte pass-thru */

Ehh are you sure that is correct? 0xa1 is the BLANK command, I would hate to think there would be a collision like that.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 11 lines · Jens Axboe

include/scsi/scsi.h extern const char *const scsi_device_typ · line 118

Quoted 6 lines · John W. Linville
include/scsi/scsi.h renamed from include/scsi/scsi.h.orig +3 -3
-/* Temporary values for T10/04-262 until official values are allocated */
-#define	ATA_16		      0x85	/* 16-byte pass-thru [0x85 == unused]*/
-#define	ATA_12		      0xb3	/* 12-byte pass-thru [0xb3 == obsolete set limits command] */
+/* Values for T10/04-262r7 */
+#define	ATA_16		      0x85	/* 16-byte pass-thru */
+#define	ATA_12		      0xa1	/* 12-byte pass-thru */

Ehh are you sure that is correct? 0xa1 is the BLANK command, I would hate to think there would be a collision like that.

Well, I'm sure that is what is in T10/04-262r7 in Table 1 on Page 1. The spec is available here:

	http://www.t10.org/ftp/t10/document.04/04-262r7.pdf

Previous versions of the spec did not specify a value. As to whether or not the current spec is in error, hopefully Curtis can elablorate?

John

Signature · 2 lines
John W. Linville
[email protected]