From: Jeff Garzik <jgarzik@pobox.com>
To: linux-ide@vger.kernel.org
Subject: [PATCH] libata DMADIR support
Date: Sat, 15 May 2004 17:46:01 -0400 [thread overview]
Message-ID: <40A68F99.1000006@pobox.com> (raw)
[-- 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 */
next reply other threads:[~2004-05-15 21:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-15 21:46 Jeff Garzik [this message]
-- strict thread matches above, loose matches on Subject: below --
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40A68F99.1000006@pobox.com \
--to=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.