* [PATCH] add DMA blacklist to libata
@ 2005-01-07 1:36 Jeff Garzik
2005-01-07 1:55 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2005-01-07 1:36 UTC (permalink / raw)
To: linux-ide@vger.kernel.org; +Cc: Bartlomiej Zolnierkiewicz, Alan Cox
[-- Attachment #1: Type: text/plain, Size: 218 bytes --]
For review. I checked this into libata-dev just now.
Design decisions:
* no whitelist. Worst case is a few more devices will use PIO.
* no firmware rev checking. Worst case is a few more models (2) will
use PIO.
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2876 bytes --]
===== drivers/scsi/libata-core.c 1.112 vs edited =====
--- 1.112/drivers/scsi/libata-core.c 2004-12-27 15:41:22 -05:00
+++ edited/drivers/scsi/libata-core.c 2005-01-06 20:34:28 -05:00
@@ -1700,6 +1700,70 @@
DPRINTK("EXIT\n");
}
+static void ata_pr_blacklisted(struct ata_port *ap, struct ata_device *dev)
+{
+ printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n",
+ ap->id, dev->devno);
+}
+
+static const char * ata_dma_blacklist [] = {
+ "WDC AC11000H",
+ "WDC AC22100H",
+ "WDC AC32500H",
+ "WDC AC33100H",
+ "WDC AC31600H",
+ "WDC AC32100H",
+ "WDC AC23200L",
+ "Compaq CRD-8241B",
+ "CRD-8400B",
+ "CRD-8480B",
+ "CRD-8480C",
+ "CRD-8482B",
+ "CRD-84",
+ "SanDisk SDP3B",
+ "SanDisk SDP3B-64",
+ "SANYO CD-ROM CRD",
+ "HITACHI CDR-8",
+ "HITACHI CDR-8335",
+ "HITACHI CDR-8435",
+ "Toshiba CD-ROM XM-6202B",
+ "CD-532E-A",
+ "E-IDE CD-ROM CR-840",
+ "CD-ROM Drive/F5A",
+ "WPI CDD-820",
+ "SAMSUNG CD-ROM SC-148C",
+ "SAMSUNG CD-ROM SC",
+ "SanDisk SDP3B-64",
+ "SAMSUNG CD-ROM SN-124",
+ "ATAPI CD-ROM DRIVE 40X MAXIMUM",
+ "_NEC DV5800A",
+};
+
+static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev)
+{
+ unsigned char model_num[40];
+ char *s;
+ unsigned int len;
+ int i;
+
+ ata_dev_id_string(dev->id, model_num, ATA_ID_PROD_OFS,
+ sizeof(model_num));
+ s = &model_num[0];
+ len = strnlen(s, sizeof(model_num));
+
+ /* ATAPI specifies that empty space is blank-filled; remove blanks */
+ while ((len > 0) && (s[len - 1] == ' ')) {
+ len--;
+ s[len] = 0;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i++)
+ if (!strncmp(ata_dma_blacklist[i], s, len))
+ return 1;
+
+ return 0;
+}
+
static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
{
struct ata_device *master, *slave;
@@ -1712,17 +1776,37 @@
if (shift == ATA_SHIFT_UDMA) {
mask = ap->udma_mask;
- if (ata_dev_present(master))
+ if (ata_dev_present(master)) {
mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff);
- if (ata_dev_present(slave))
+ if (ata_dma_blacklisted(ap, master)) {
+ mask = 0;
+ ata_pr_blacklisted(ap, master);
+ }
+ }
+ if (ata_dev_present(slave)) {
mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff);
+ if (ata_dma_blacklisted(ap, slave)) {
+ mask = 0;
+ ata_pr_blacklisted(ap, slave);
+ }
+ }
}
else if (shift == ATA_SHIFT_MWDMA) {
mask = ap->mwdma_mask;
- if (ata_dev_present(master))
+ if (ata_dev_present(master)) {
mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07);
- if (ata_dev_present(slave))
+ if (ata_dma_blacklisted(ap, master)) {
+ mask = 0;
+ ata_pr_blacklisted(ap, master);
+ }
+ }
+ if (ata_dev_present(slave)) {
mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07);
+ if (ata_dma_blacklisted(ap, slave)) {
+ mask = 0;
+ ata_pr_blacklisted(ap, slave);
+ }
+ }
}
else if (shift == ATA_SHIFT_PIO) {
mask = ap->pio_mask;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] add DMA blacklist to libata
2005-01-07 1:36 [PATCH] add DMA blacklist to libata Jeff Garzik
@ 2005-01-07 1:55 ` Alan Cox
2005-01-07 3:03 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2005-01-07 1:55 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide@vger.kernel.org, Bartlomiej Zolnierkiewicz
On Gwe, 2005-01-07 at 01:36, Jeff Garzik wrote:
> For review. I checked this into libata-dev just now.
>
> Design decisions:
> * no whitelist. Worst case is a few more devices will use PIO.
> * no firmware rev checking. Worst case is a few more models (2) will
> use PIO.
Seems reasonable for now although its so trivial to do. Expect the DMA
list for CD devices to shrink over time as well (Bart already zapped a
few).
Alan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] add DMA blacklist to libata
2005-01-07 1:55 ` Alan Cox
@ 2005-01-07 3:03 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-01-07 3:03 UTC (permalink / raw)
To: Alan Cox; +Cc: Jeff Garzik, linux-ide@vger.kernel.org
On Fri, 07 Jan 2005 01:55:06 +0000, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> On Gwe, 2005-01-07 at 01:36, Jeff Garzik wrote:
> > For review. I checked this into libata-dev just now.
> >
> > Design decisions:
> > * no whitelist. Worst case is a few more devices will use PIO.
> > * no firmware rev checking. Worst case is a few more models (2) will
> > use PIO.
Looks OK.
> Seems reasonable for now although its so trivial to do. Expect the DMA
> list for CD devices to shrink over time as well (Bart already zapped a
> few).
Just removed another one - "CRD-8480C".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-01-07 3:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-07 1:36 [PATCH] add DMA blacklist to libata Jeff Garzik
2005-01-07 1:55 ` Alan Cox
2005-01-07 3:03 ` Bartlomiej Zolnierkiewicz
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).