linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata: slightly improved req-sense, send-diag no-ops
@ 2007-09-21 10:24 Jeff Garzik
  2007-09-21 11:17 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2007-09-21 10:24 UTC (permalink / raw)
  To: linux-scsi, linux-ide


commit 8a7a20fb60d9746ec68a876aade1f14c4f2b7b46
Author: Jeff Garzik <jeff@garzik.org>
Date:   Fri Sep 21 06:23:42 2007 -0400

    [libata] Slightly improved no-op REQUEST SENSE, SEND DIAGNOSTIC
    
    A few pedantic apps care about missing or lame "mandatory" SCSI
    commands, so
    
    REQUEST SENSE -- as we autosense, R.S. just returns zeroes
    
    SEND DIAGNOSTIC -- our default (no-op) self-test succeeds, all
    		   other requests for testing fail.
    
    Signed-off-by: Jeff Garzik <jeff@garzik.org>

 drivers/ata/libata-scsi.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

8a7a20fb60d9746ec68a876aade1f14c4f2b7b46
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bb5a5c1..dbe8ac3 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2922,6 +2922,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
 {
 	struct ata_scsi_args args;
 	const u8 *scsicmd = cmd->cmnd;
+	u8 tmp8;
 
 	args.dev = dev;
 	args.id = dev->id;
@@ -2936,7 +2937,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
 		case SEEK_10:
 		case TEST_UNIT_READY:
 		case FORMAT_UNIT:		/* FIXME: correct? */
-		case SEND_DIAGNOSTIC:		/* FIXME: correct? */
 			ata_scsi_rbuf_fill(&args, ata_scsiop_noop);
 			break;
 
@@ -2989,8 +2989,19 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
 			ata_scsi_rbuf_fill(&args, ata_scsiop_report_luns);
 			break;
 
-		/* mandatory commands we haven't implemented yet */
 		case REQUEST_SENSE:
+			ata_scsi_set_sense(cmd, 0, 0, 0);
+			cmd->result = (DRIVER_SENSE << 24);
+			done(cmd);
+			break;
+
+		case SEND_DIAGNOSTIC:
+			tmp8 = scsicmd[1] & ~(1 << 3);
+			if ((tmp8 == 0x4) && (!scsicmd[3]) && (!scsicmd[4]))
+				ata_scsi_rbuf_fill(&args, ata_scsiop_noop);
+			else
+				ata_scsi_invalid_field(cmd, done);
+			break;
 
 		/* all other commands */
 		default:

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

* Re: [PATCH] libata: slightly improved req-sense, send-diag no-ops
  2007-09-21 11:17 ` Alan Cox
@ 2007-09-21 11:12   ` Jeff Garzik
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2007-09-21 11:12 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-scsi, linux-ide

Alan Cox wrote:
>>     REQUEST SENSE -- as we autosense, R.S. just returns zeroes
>>     
>>     SEND DIAGNOSTIC -- our default (no-op) self-test succeeds, all
>>     		   other requests for testing fail.
>>     
>>     Signed-off-by: Jeff Garzik <jeff@garzik.org>
> 
> Acked-by: Alan Cox <alan@redhat.com>
> 
> Possibly our default SEND_DIAGNOSTIC should turn into smart or just
> return whether the drive failed the power up diagnostic ?

Either/or.  In general the SAT (SCSI/ATA translation) spec posted 
publicly on http://www.t10.org/ gives the suggested transformation into 
ATA commands.  And yep, you guessed it -- send diag morphs into SMART.

I doubt I'm motivated enough to enhance send diag, but others are 
encouraged to do so.

	Jeff




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

* Re: [PATCH] libata: slightly improved req-sense, send-diag no-ops
  2007-09-21 10:24 [PATCH] libata: slightly improved req-sense, send-diag no-ops Jeff Garzik
@ 2007-09-21 11:17 ` Alan Cox
  2007-09-21 11:12   ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2007-09-21 11:17 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-scsi, linux-ide

>     REQUEST SENSE -- as we autosense, R.S. just returns zeroes
>     
>     SEND DIAGNOSTIC -- our default (no-op) self-test succeeds, all
>     		   other requests for testing fail.
>     
>     Signed-off-by: Jeff Garzik <jeff@garzik.org>

Acked-by: Alan Cox <alan@redhat.com>

Possibly our default SEND_DIAGNOSTIC should turn into smart or just
return whether the drive failed the power up diagnostic ?

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

end of thread, other threads:[~2007-09-21 11:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-21 10:24 [PATCH] libata: slightly improved req-sense, send-diag no-ops Jeff Garzik
2007-09-21 11:17 ` Alan Cox
2007-09-21 11:12   ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).