All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] libata DMADIR support
@ 2004-05-16 14:19 Pat LaVarre
  2004-05-16 23:16 ` Jeff Garzik
  0 siblings, 1 reply; 56+ messages in thread
From: Pat LaVarre @ 2004-05-16 14:19 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide

Jeff G:

I've now slowly and awkwardly synced as the following tty log of patch
and a #define patch of my own show.  Therefore I ask:

Have you considered an include/linux/libata.h approach like:

+ #undef ATA_FORCE_DMADIR /* give Si DMADIR to all SATA ATAPI DMA */

+ #include <linux/ata.h>
+ #ifdef ATA_FORCE_DMADIR
+ #undef ata_id_use_dmadir
+ #define ata_id_use_dmadir(dev) 1
+ #endif

I'll save time in the end if I volunteer to write such a patch, after
you reply to say you would consider such a patch, if in fact you would.

Pat LaVarre

$ cd linux-2.6.6-bk3/
$
$ patch --dry-run -p1 <~/patch.2.1
patching file drivers/scsi/libata-core.c
patching file drivers/scsi/libata-scsi.c
$ patch --dry-run -p1 <~/patch.dmadir
patching file drivers/scsi/libata-core.c
patching file drivers/scsi/libata-scsi.c
patching file include/linux/ata.h
patching file include/linux/libata.h
$
$ patch -p1 <~/patch.2.1
patching file drivers/scsi/libata-core.c
patching file drivers/scsi/libata-scsi.c
$ patch -p1 <~/patch.dmadir
patching file drivers/scsi/libata-core.c
patching file drivers/scsi/libata-scsi.c
Hunk #1 succeeded at 927 (offset 7 lines).
patching file include/linux/ata.h
patching file include/linux/libata.h
$

diff -Nurp o/include/linux/ata.h linux-2.6.6-bk3-pel/include/linux/ata.h
--- o/include/linux/ata.h	2004-05-16 08:06:04.000000000 -0600
+++ linux-2.6.6-bk3-pel/include/linux/ata.h	2004-05-16
08:09:04.473768304 -0600
@@ -205,7 +205,7 @@ struct ata_taskfile {
 #define ata_id_has_wcache(dev)	((dev)->id[82] & (1 << 5))
 #define ata_id_has_lba(dev)	((dev)->id[49] & (1 << 8))
 #define ata_id_has_dma(dev)	((dev)->id[49] & (1 << 9))
-#define ata_id_use_dmadir(dev)	((dev)->id[62] & (1 << 15))
+#define ata_id_use_dmadir(dev)	1 /* ((dev)->id[62] & (1 << 15)) */
 #define ata_id_u32(dev,n)	\
 	(((u32) (dev)->id[(n) + 1] << 16) | ((u32) (dev)->id[(n)]))
 #define ata_id_u64(dev,n)	\
diff -Nurp o/include/linux/libata.h
linux-2.6.6-bk3-pel/include/linux/libata.h
--- o/include/linux/libata.h	2004-05-16 08:06:23.000000000 -0600
+++ linux-2.6.6-bk3-pel/include/linux/libata.h	2004-05-16
08:09:22.811980472 -0600
@@ -33,11 +33,11 @@
  * compile-time options
  */
 #undef ATA_FORCE_PIO		/* do not configure or use DMA */
-#undef ATA_DEBUG		/* debugging output */
-#undef ATA_VERBOSE_DEBUG	/* yet more debugging output */
+#define ATA_DEBUG		/* debugging output */
+#define ATA_VERBOSE_DEBUG	/* yet more debugging output */
 #undef ATA_IRQ_TRAP		/* define to ack screaming irqs */
 #undef ATA_NDEBUG		/* define to disable quick runtime checks */
-#undef ATA_ENABLE_ATAPI		/* define to enable ATAPI support */
+#define ATA_ENABLE_ATAPI		/* define to enable ATAPI support */
 #undef ATA_ENABLE_PATA		/* define to enable PATA support in some
 				 * low-level drivers */
 
diff -Nurp o/drivers/scsi/libata-core.c
linux-2.6.6-bk3-pel/drivers/scsi/libata-core.c
diff -Nurp o/drivers/scsi/libata-scsi.c
linux-2.6.6-bk3-pel/drivers/scsi/libata-scsi.c



^ permalink raw reply	[flat|nested] 56+ messages in thread
* [PATCH] libata DMADIR support
@ 2004-05-15 21:46 Jeff Garzik
  0 siblings, 0 replies; 56+ messages in thread
From: Jeff Garzik @ 2004-05-15 21:46 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]


This patch goes by the specification -- which means it apparently 
doesn't work with at least one bridge.  So modify this patch as necessary.

Until a definitive solution is found, DMADIR will remain a "branch" off 
the main work.



[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2130 bytes --]

diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c	Sat May 15 17:44:43 2004
+++ b/drivers/scsi/libata-core.c	Sat May 15 17:44:43 2004
@@ -1167,6 +1167,9 @@
 		if (ata_id_is_ata(dev))		/* sanity check */
 			goto err_out_nosup;
 
+		if (ata_id_use_dmadir(dev))
+			dev->flags |= ATA_DFLAG_DMADIR;
+
 		/* see if 16-byte commands supported */
 		tmp = dev->id[0] & 0x3;
 		if (tmp == 1)
diff -Nru a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
--- a/drivers/scsi/libata-scsi.c	Sat May 15 17:44:43 2004
+++ b/drivers/scsi/libata-scsi.c	Sat May 15 17:44:43 2004
@@ -920,6 +920,9 @@
 		qc->flags |= ATA_QCFLAG_SG; /* data is present; dma-map it */
 		qc->tf.protocol = ATA_PROT_ATAPI_DMA;
 		qc->tf.feature |= ATAPI_PKT_DMA;
+		if ((qc->dev->flags & ATA_DFLAG_DMADIR) &&
+		    (cmd->sc_data_direction != SCSI_DATA_WRITE))
+			qc->tf.feature |= ATAPI_DMADIR;
 	}
 
 	return 0;
diff -Nru a/include/linux/ata.h b/include/linux/ata.h
--- a/include/linux/ata.h	Sat May 15 17:44:43 2004
+++ b/include/linux/ata.h	Sat May 15 17:44:43 2004
@@ -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,
@@ -203,6 +205,7 @@
 #define ata_id_has_wcache(dev)	((dev)->id[82] & (1 << 5))
 #define ata_id_has_lba(dev)	((dev)->id[49] & (1 << 8))
 #define ata_id_has_dma(dev)	((dev)->id[49] & (1 << 9))
+#define ata_id_use_dmadir(dev)	((dev)->id[62] & (1 << 15))
 #define ata_id_u32(dev,n)	\
 	(((u32) (dev)->id[(n) + 1] << 16) | ((u32) (dev)->id[(n)]))
 #define ata_id_u64(dev,n)	\
diff -Nru a/include/linux/libata.h b/include/linux/libata.h
--- a/include/linux/libata.h	Sat May 15 17:44:43 2004
+++ b/include/linux/libata.h	Sat May 15 17:44:43 2004
@@ -90,6 +90,7 @@
 	ATA_DFLAG_MASTER	= (1 << 2), /* is device 0? */
 	ATA_DFLAG_WCACHE	= (1 << 3), /* has write cache we can
 					     * (hopefully) flush? */
+	ATA_DFLAG_DMADIR	= (1 << 4), /* use DMADIR bit in ATAPI */
 
 	ATA_DEV_UNKNOWN		= 0,	/* unknown device */
 	ATA_DEV_ATA		= 1,	/* ATA device */

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

end of thread, other threads:[~2004-05-28  1:28 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-16 14:19 [PATCH] libata DMADIR support Pat LaVarre
2004-05-16 23:16 ` Jeff Garzik
2004-05-17 18:48   ` Pat LaVarre
2004-05-17 19:08     ` Jeff Garzik
2004-05-17 21:06       ` Pat LaVarre
2004-05-17 21:40         ` Jeff Garzik
2004-05-17 21:20       ` Pat LaVarre
2004-05-17 21:32         ` Jeff Garzik
2004-05-17 21:34           ` Jeff Garzik
2004-05-17 22:05           ` Pat LaVarre
2004-05-17 22:36             ` Jeff Garzik
2004-05-17 23:04               ` Pat LaVarre
2004-05-18 22:40               ` Pat LaVarre
2004-05-18 23:07                 ` Pat LaVarre
2004-05-18 23:50                   ` Jeff Garzik
2004-05-19 22:47                     ` Pat LaVarre
2004-05-18 23:48                 ` [PATCH] atapi request sense work Jeff Garzik
2004-05-19 20:35                   ` Pat LaVarre
2004-05-19 22:19                     ` Jeff Garzik
2004-05-19 22:24                   ` Pat LaVarre
2004-05-19 22:27                     ` Pat LaVarre
2004-05-19 22:54                   ` Pat LaVarre
2004-05-21  1:58                     ` Pat LaVarre
     [not found]                       ` <6 E36A 11B-AACB-11D8-8B8A-003065635034@ieee.org>
2004-05-21  2:06                       ` Pat LaVarre
2004-05-21  3:05                         ` Pat LaVarre
2004-05-21  4:04                           ` Jeff Garzik
     [not found]                             ` <1 085153750.6103.33.camel@patibmrh9>
2004-05-21 15:35                             ` Pat LaVarre
2004-05-21 15:46                               ` Bartlomiej Zolnierkiewicz
2004-05-21 17:59                                 ` Pat LaVarre
2004-05-21 20:07                                   ` Pat LaVarre
2004-05-21 21:51                                     ` Jeff Garzik
2004-05-21 23:12                                       ` Pat LaVarre
2004-05-21 23:24                                       ` Pat LaVarre
2004-05-21 23:55                                         ` Jeff Garzik
2004-05-21 23:57                                           ` Pat LaVarre
2004-05-21 23:39                                       ` Pat LaVarre
2004-05-21 23:45                                         ` Jeff Garzik
2004-05-22  0:06                                           ` Pat LaVarre
2004-05-22  0:12                                             ` Pat LaVarre
2004-05-22  0:33                                           ` Pat LaVarre
2004-05-22  1:11                                             ` Pat LaVarre
2004-05-26 21:49                                               ` Pat LaVarre
2004-05-27 23:12                                                 ` Pat LaVarre
2004-05-27 23:32                                                   ` Jeff Garzik
2004-05-27 23:38                                                     ` Pat LaVarre
2004-05-27 23:41                                                       ` Jeff Garzik
2004-05-28  0:13                                                     ` Pat LaVarre
2004-05-28  1:28                                                   ` Pat LaVarre
2004-05-24 15:27                                             ` Pat LaVarre
2004-05-21 21:59                                   ` Pat LaVarre
2004-05-21 18:23                                 ` Danny Cox
2004-05-21 18:39                                   ` Bartlomiej Zolnierkiewicz
2004-05-21 18:55                                     ` [PATCH] kmalloc old_hwif Danny Cox
2004-05-21 19:00                                     ` [PATCH] atapi request sense work Danny Cox
2004-05-21 19:08                                       ` Bartlomiej Zolnierkiewicz
  -- strict thread matches above, loose matches on Subject: below --
2004-05-15 21:46 [PATCH] libata DMADIR support Jeff Garzik

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.