Skip to contentSkip to conversation

libata-core when not ata_id_use_dmadir despite yes SiliconI mage

PATCH In review Pat LaVarre 3 participants 6 messages May 15, 2004

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

PATCH 1/1 libata-core when not ata_id_use_dmadir despite yes SiliconI mage

Quoted 10 lines
Quoted 8 lines
Quoted 8 lines

Subject: Re: SATA ATAPI work in progress
...
I doubt I can use this patch as is. I believe, because I assembled my drive from components myself, its op xA1 Identify data has not changed,
so I will see a misleading 0 False at:

#define ata_id_use_dmadir(dev) ((dev)->id[62] & (1 << 15))

Theory confirmed!

Consequently now:

In t13.org since the dawn of time, I see the requirement that compliant ATAPI devices tolerate hosts creatively choosing to copy (cmd->sc_data_direction != SCSI_DATA_WRITE) into (ata_taskfile.feature & x04 ATAPI_DMADIR).

I see devices constructed with Silicon Image 3611CT80 1.4 require such a courtesy from the host.

Therefore I propose that Linux, as host, offer that courtesy always.

Pat LaVarre

P.S. Of course I still agree the firmware of devices manufactured with this perhaps excessively transparent SATA/ PATA bridge should set "word" 62 mask x8000 ata_id_use_dmadir, after that proposal in fact becomes a t13.org standard, presuming that standards development process doesn't move or flip that bit.

Indeed, after the proposal is standard, I'll argue all PATA devices should set this bit, on the chance that their actual connection with the host is such an extremely transparent SATA/ PATA bridge.

But that argument I expect to lose to the fear that some hosts will choose to refuse to speak DMA with devices that set ata_id_use_dmadir, rather than choosing to disclose (cmd->sc_data_direction != SCSI_DATA_WRITE).

P.P.S. In passing in include/linux/, I vote we teach Linux to enum together all the bits of the ata_taskfile.feature parameter of ATA op xA0 ATA_CMD_PACKET.

drivers/scsi/libata-core.c +4 -2
@@ -1168,8 +1168,10 @@ retry:
 		if (ata_id_is_ata(dev))		/* sanity check */
 			goto err_out_nosup;
 
-		if (ata_id_use_dmadir(dev))
-			dev->flags |= ATA_DFLAG_DMADIR;
+		/* share cmd->sc_data_direction with device
+		 * even when (!ata_id_use_dmadir(dev)) claims not needed
+		 */
+		dev->flags |= ATA_DFLAG_DMADIR;
 
 		/* see if 16-byte commands supported */
 		tmp = dev->id[0] & 0x3;
include/linux/ata.h +2 -2
@@ -84,8 +84,6 @@ enum {
 	ATA_ERR			= (1 << 0),	/* have an error */
 	ATA_SRST		= (1 << 2),	/* software reset */
 	ATA_ABORTED		= (1 << 2),	/* command aborted */
-	ATAPI_DMADIR		= (1 << 2),	/* ATAPI data dir:
-						   0=to device, 1=to host */
 
 	/* ATA command block registers */
 	ATA_REG_DATA		= 0x00,
@@ -136,6 +134,8 @@ enum {
 
 	/* ATAPI stuff */
 	ATAPI_PKT_DMA		= (1 << 0),
+	ATAPI_DMADIR		= (1 << 2),	/* ATAPI data dir:
+						   0=to device, 1=to host */
 
 	/* cable types */
 	ATA_CBL_NONE		= 0,
drivers/scsi/libata-core.c +4 -2
@@ -1168,8 +1168,10 @@ retry:
 		if (ata_id_is_ata(dev))		/* sanity check */
 			goto err_out_nosup;
 
-		if (ata_id_use_dmadir(dev))
-			dev->flags |= ATA_DFLAG_DMADIR;
+		/* share cmd->sc_data_direction with device
+		 * even when (!ata_id_use_dmadir(dev)) claims not needed
+		 */
+		dev->flags |= ATA_DFLAG_DMADIR;
 
 		/* see if 16-byte commands supported */
 		tmp = dev->id[0] & 0x3;
include/linux/ata.h +2 -2
@@ -84,8 +84,6 @@ enum {
 	ATA_ERR			= (1 << 0),	/* have an error */
 	ATA_SRST		= (1 << 2),	/* software reset */
 	ATA_ABORTED		= (1 << 2),	/* command aborted */
-	ATAPI_DMADIR		= (1 << 2),	/* ATAPI data dir:
-						   0=to device, 1=to host */
 
 	/* ATA command block registers */
 	ATA_REG_DATA		= 0x00,
@@ -136,6 +134,8 @@ enum {
 
 	/* ATAPI stuff */
 	ATAPI_PKT_DMA		= (1 << 0),
+	ATAPI_DMADIR		= (1 << 2),	/* ATAPI data dir:
+						   0=to device, 1=to host */
 
 	/* cable types */
 	ATA_CBL_NONE		= 0,
#1 lore raw
Quoted 18 lines · Pat LaVarre
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines

Subject: Re: SATA ATAPI work in progress
...
I doubt I can use this patch as is. I believe, because I assembled my drive from components myself, its op xA1 Identify data has not changed,
so I will see a misleading 0 False at:

#define ata_id_use_dmadir(dev) ((dev)->id[62] & (1 << 15))

Theory confirmed!

Consequently now:

In t13.org since the dawn of time, I see the requirement that compliant ATAPI devices tolerate hosts creatively choosing to copy (cmd->sc_data_direction != SCSI_DATA_WRITE) into (ata_taskfile.feature & x04 ATAPI_DMADIR).

Quoted 4 lines

I see devices constructed with Silicon Image 3611CT80 1.4 require such a courtesy from the host.

Therefore I propose that Linux, as host, offer that courtesy always.

Makes sense.

Jeff, if you decide to do this remember to kill ata_id_use_dmadir() and ATA_DFLAG_DMADIR completely. [ I'm sure you will. :-) ]

Quoted 56 lines

Pat LaVarre

P.S. Of course I still agree the firmware of devices manufactured with this perhaps excessively transparent SATA/ PATA bridge should set "word" 62 mask x8000 ata_id_use_dmadir, after that proposal in fact becomes a t13.org standard, presuming that standards development process doesn't move or flip that bit.

Indeed, after the proposal is standard, I'll argue all PATA devices should set this bit, on the chance that their actual connection with the host is such an extremely transparent SATA/ PATA bridge.

But that argument I expect to lose to the fear that some hosts will choose to refuse to speak DMA with devices that set ata_id_use_dmadir, rather than choosing to disclose (cmd->sc_data_direction != SCSI_DATA_WRITE).

P.P.S. In passing in include/linux/, I vote we teach Linux to enum together all the bits of the ata_taskfile.feature parameter of ATA op xA0 ATA_CMD_PACKET.

drivers/scsi/libata-core.c +0 -0

07:53:40.520947904 -0600 @@ -1168,8 +1168,10 @@ retry:

drivers/scsi/libata-core.c +4 -2
 		if (ata_id_is_ata(dev))		/* sanity check */
 			goto err_out_nosup;
 
-		if (ata_id_use_dmadir(dev))
-			dev->flags |= ATA_DFLAG_DMADIR;
+		/* share cmd->sc_data_direction with device
+		 * even when (!ata_id_use_dmadir(dev)) claims not needed
+		 */
+		dev->flags |= ATA_DFLAG_DMADIR;
 
 		/* see if 16-byte commands supported */
 		tmp = dev->id[0] & 0x3;
include/linux/ata.h +2 -2
@@ -84,8 +84,6 @@ enum {
 	ATA_ERR			= (1 << 0),	/* have an error */
 	ATA_SRST		= (1 << 2),	/* software reset */
 	ATA_ABORTED		= (1 << 2),	/* command aborted */
-	ATAPI_DMADIR		= (1 << 2),	/* ATAPI data dir:
-						   0=to device, 1=to host */
 
 	/* ATA command block registers */
 	ATA_REG_DATA		= 0x00,
@@ -136,6 +134,8 @@ enum {
 
 	/* ATAPI stuff */
 	ATAPI_PKT_DMA		= (1 << 0),
+	ATAPI_DMADIR		= (1 << 2),	/* ATAPI data dir:
+						   0=to device, 1=to host */
 
 	/* cable types */
 	ATA_CBL_NONE		= 0,
#2 lore raw
Quoted 23 lines · Bartlomiej Zolnierkiewicz
Quoted 21 lines · Pat LaVarre
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines

Subject: Re: SATA ATAPI work in progress
...
I doubt I can use this patch as is. I believe, because I assembled my drive from components myself, its op xA1 Identify data has not changed,
so I will see a misleading 0 False at:

#define ata_id_use_dmadir(dev) ((dev)->id[62] & (1 << 15))

Theory confirmed!

Consequently now:

In t13.org since the dawn of time, I see the requirement that compliant ATAPI devices tolerate hosts creatively choosing to copy (cmd->sc_data_direction != SCSI_DATA_WRITE) into (ata_taskfile.feature & x04 ATAPI_DMADIR).

I see devices constructed with Silicon Image 3611CT80 1.4 require such a courtesy from the host.

Quoted 7 lines
Quoted 1 line

Therefore I propose that Linux, as host, offer that courtesy always.

Makes sense.

Jeff, if you decide to do this remember to kill ata_id_use_dmadir() and ATA_DFLAG_DMADIR completely. [ I'm sure you will. :-) ]

According to ATA/ATAPI7,

A device that does not support the DMADIR feature may abort a command if the DMADIR bit is set to 1.

And this language makes sense, since it is unknown what all those cheap old ATAPI devices will do. It's too risky to simply set this bit for all ATAPI devices, without lots of testing.

We can do so for our development here, but a better solution based on released parts will need to be found...

Jeff

#3 lore raw
Quoted 30 lines · Jeff Garzik
Quoted 22 lines · Bartlomiej Zolnierkiewicz
Quoted 21 lines · Pat LaVarre
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines

Subject: Re: SATA ATAPI work in progress
...
I doubt I can use this patch as is. I believe, because I assembled my drive from components myself, its op xA1 Identify data has not changed,
so I will see a misleading 0 False at:

#define ata_id_use_dmadir(dev) ((dev)->id[62] & (1 << 15))

Theory confirmed!

Consequently now:

In t13.org since the dawn of time, I see the requirement that compliant ATAPI devices tolerate hosts creatively choosing to copy (cmd->sc_data_direction != SCSI_DATA_WRITE) into (ata_taskfile.feature & x04 ATAPI_DMADIR).

I see devices constructed with Silicon Image 3611CT80 1.4 require such a courtesy from the host.

Quoted 6 lines
Quoted 1 line

Therefore I propose that Linux, as host, offer that courtesy always.

Makes sense.

Jeff, if you decide to do this remember to kill ata_id_use_dmadir() and ATA_DFLAG_DMADIR completely. [ I'm sure you will. :-) ]

Quoted 8 lines

According to ATA/ATAPI7,

A device that does not support the DMADIR feature may abort a command if the DMADIR bit is set to 1.

And this language makes sense, since it is unknown what all those cheap old ATAPI devices will do. It's too risky to simply set this bit for all ATAPI devices, without lots of testing.

OK

Quoted 2 lines

We can do so for our development here, but a better solution based on released parts will need to be found...

Do you know of some way to detect SI 3611CT80 1.4?

#4 lore raw
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines · Jeff Garzik

We can do so for our development here, but a better solution based on released parts will need to be found...

Do you know of some way to detect SI 3611CT80 1.4?

Not right now.

I need to see the full IDENTIFY PACKET DEVICE data to discover a way...
(and I need to write some code before libata dumps the full
identify-device page)

Other bridges add an identifying string to the -end- of the ATA device's model name, maybe SiI does too.

Jeff

#5 lore raw

Re: [PATCH] libata-core when not ata_id_use_dmadir despite yesSili conI mage

In reply to Bartlomiej Zolnierkiewicz
Quoted 4 lines
Quoted 2 lines

We can do so for our development here, but a better solution based on released parts will need to be found...

Do you know of some way to detect SI 3611CT80 1.4?

I don't.

Jeff G, do you?

Quoted 5 lines
Quoted 3 lines

And this language makes sense, since it is unknown what all those cheap old ATAPI devices will do. It's too risky to simply set this bit for all ATAPI devices, without lots of testing.

OK

Yes.

Quoted 4 lines
Quoted 4 lines

According to ATA/ATAPI7,

A device that does not support the DMADIR feature may abort a command if the DMADIR bit is set to 1.

I believe this is a t13.org change that is NOT backwards-compatible, analogous to the theft I remember of op xEC Identify "word" 128.

I will double-check ATA/ATAPI 4/ 5/ 6 and report the relevant language here.

Pat LaVarre