All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libata: add support for ATA_16 commands to ATAPI devices
@ 2007-01-03  0:39 Mark Lord
  2007-01-03  0:44 ` Mark Lord
  2007-01-03  0:50 ` [PATCH] " Jeff Garzik
  0 siblings, 2 replies; 14+ messages in thread
From: Mark Lord @ 2007-01-03  0:39 UTC (permalink / raw)
  To: Linux IDE, Tejun Heo, Jeff Garzik

This patch adds support for passing ATA_16 commands
through to ATAPI devices in libata.  In practice, the upper layers will
still currently prevent ATA_16 commands, as no (?) ATAPI drives support
them yet.  But it will work if such a drive is ever encountered.

Support for ATA_16 is necessary for using SG_IO from userspace,
and an upcoming hdparm release will be updated to use this interface.

This version is very similar to the earlier first submission,
except that ATA_12 is no longer passed through to ATAPI
because of the conflict it has with the SCSI BLANK opcode.

Signed-off-by:  Mark Lord <mlord@pobox.com>

--- old/drivers/ata/libata-scsi.c	2007-01-02 19:20:23.000000000 -0500
+++ new/drivers/ata/libata-scsi.c	2007-01-02 19:20:49.000000000 -0500
@@ -2650,6 +2650,12 @@
 
 static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
 {
+	if (cmd == ATA_16)
+		return ata_scsi_pass_thru;
+
+	if (dev->class == ATA_DEV_ATAPI)
+		return atapi_xlat;
+
 	switch (cmd) {
 	case READ_6:
 	case READ_10:
@@ -2670,7 +2676,6 @@
 		return ata_scsi_verify_xlat;
 
 	case ATA_12:
-	case ATA_16:
 		return ata_scsi_pass_thru;
 
 	case START_STOP:
@@ -2708,6 +2713,7 @@
 				      void (*done)(struct scsi_cmnd *),
 				      struct ata_device *dev)
 {
+	ata_xlat_func_t xlat_func;
 	int rc = 0;
 
 	if (unlikely(!scmd->cmd_len)) {
@@ -2717,17 +2723,11 @@
 		return 0;
 	}
 
-	if (dev->class == ATA_DEV_ATA) {
-		ata_xlat_func_t xlat_func = ata_get_xlat_func(dev,
-							      scmd->cmnd[0]);
-
-		if (xlat_func)
-			rc = ata_scsi_translate(dev, scmd, done, xlat_func);
-		else
-			ata_scsi_simulate(dev, scmd, done);
-	} else
-		rc = ata_scsi_translate(dev, scmd, done, atapi_xlat);
-
+	xlat_func = ata_get_xlat_func(dev, scmd->cmnd[0]);
+	if (xlat_func)
+		rc = ata_scsi_translate(dev, scmd, done, xlat_func);
+	else
+		ata_scsi_simulate(dev, scmd, done);
 	return rc;
 }
 

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

end of thread, other threads:[~2007-01-26  2:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-03  0:39 [PATCH] libata: add support for ATA_16 commands to ATAPI devices Mark Lord
2007-01-03  0:44 ` Mark Lord
2007-01-03  0:50 ` [PATCH] " Jeff Garzik
2007-01-03  1:07   ` Alan
2007-01-03  1:06     ` Jeff Garzik
2007-01-03  5:44     ` Mark Lord
2007-01-03 11:34       ` Alan
2007-01-03 14:18         ` Mark Lord
2007-01-03  5:47   ` Mark Lord
2007-01-03  6:01     ` [PATCH] libata: add atapi_passthru=1 parameter Mark Lord
2007-01-03  6:24       ` [PATCH] RESPIN: " Mark Lord
2007-01-03 18:17         ` Mark Lord
2007-01-20  0:08         ` Jeff Garzik
2007-01-26  2:39           ` Mark Lord

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.