Skip to contentSkip to conversation

libata atapi work #2.2

PATCH New Jeff Garzik 1 participant 1 message May 16, 2004

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

PATCH 1/1 libata atapi work #2.2

attached.

# ChangeSet
# 2004/05/16 18:35:15-04:00 [email protected]
# [libata] DMADIR support
#

#   DMADIR bit is necessary for some PATA->SATA bridges.  These
#   bridges require the OS driver to specify the data xfer direction,
#   for PACKET (a.k.a. scsi) commands.
#   
#   A reliable DMADIR detection method hasn't yet been developed,
#   and ATAPI is still a WIP, so DMADIR is enabled with an ifdef for
#   now.

#

drivers/scsi/libata-scsi.c +6 -0
diff -Nru a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
@@ -927,6 +927,12 @@
 		qc->flags |= ATA_QCFLAG_SG; /* data is present; dma-map it */
 		qc->tf.protocol = ATA_PROT_ATAPI_DMA;
 		qc->tf.feature |= ATAPI_PKT_DMA;
+
+#ifdef ATAPI_ENABLE_DMADIR
+		/* some SATA bridges need us to indicate data xfer direction */
+		if (cmd->sc_data_direction != SCSI_DATA_WRITE)
+			qc->tf.feature |= ATAPI_DMADIR;
+#endif
 	}
 
 	return 0;
include/linux/ata.h +2 -0
diff -Nru a/include/linux/ata.h b/include/linux/ata.h
@@ -134,6 +134,8 @@
 
 	/* 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,
include/linux/libata.h +1 -0
diff -Nru a/include/linux/libata.h b/include/linux/libata.h
@@ -40,6 +40,7 @@
 #undef ATA_ENABLE_ATAPI		/* define to enable ATAPI support */
 #undef ATA_ENABLE_PATA		/* define to enable PATA support in some
 				 * low-level drivers */
+#undef ATAPI_ENABLE_DMADIR	/* enables ATAPI DMADIR bridge support */
 
 
 /* note: prints function name for you */