[PATCH] [URGENT] Adding IDE DMA blacklist: easy :-)

Andrew Derrick Balsa (andrebalsa@altern.org)
Thu, 30 Jul 1998 04:07:00 +0200


--Boundary-=_XrJmOWFrxsjyBldbEFSArCBynEcd
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Hi,

This is a very small patch that adds the needed code to support a blacklist for
IDE-DMA. In fact the attached patch is against the Jumbo patch code, revision
8. (available from
http://www.altern.org/andrebalsa/linux/Jumbo-2.0.35-8.patch.gz)

The patch is short and trivial because the original code by Mark Lord is one of
the finest pieces of code in the kernel to work on (clean, neat code). Mark had
already provided a "whitelist", so adding a "blacklist" took very exactly 3
minutes.

Linus, could you check that the attached patch does what you want? It should be
quite easy to port to kernel 2.1.113.

[BTW: I would appreciate your comments on the rest of the Jumbo patch]

Of course, the data gathered by Alan will be added as soon as it is released on
the lkml.

Regards,

--
Andrew D. Balsa
andrebalsa@altern.org

--Boundary-=_XrJmOWFrxsjyBldbEFSArCBynEcd Content-Type: text/x-c; name="blacklist-idedma.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="blacklist-idedma.patch"

--- linux/drivers/block/triton.c.good.new Sat Jul 25 02:11:21 1998 +++ linux/drivers/block/triton.c Thu Jul 30 03:28:27 1998 @@ -1,6 +1,7 @@ /* * linux/drivers/block/triton.c Version 1.13 Aug 12, 1996 - * Version 1.13a June 1998 + * Version 1.13a June 1998 - new chipsets + * Version 1.13b July 1998 - DMA blacklist * * Copyright (c) 1995-1996 Mark Lord * May be copied or modified under the terms of the GNU General Public License @@ -49,6 +50,14 @@ NULL}; /* + * bad_dma_drives() lists the model names (from "hdparm -i") + * of drives which supposedly support (U)DMA but which are + * known to corrupt data with this interface under Linux. + */ +const char *bad_dma_drives[] = {"WDC AC22100H", + NULL}; + +/* * Our Physical Region Descriptor (PRD) table should be large enough * to handle the biggest I/O request we are likely to see. Since requests * can have no more than 256 sectors, and since the typical blocksize is @@ -168,6 +177,16 @@ struct hd_driveid *id = drive->id; if (id && (id->capability & 1)) { + /* Consult the list of known "bad" drives */ + list = bad_dma_drives; + while (*list) { + if (!strcmp(*list++,id->model)) { + drive->using_dma = 0; /* no DMA */ + drive->using_udma = 0; /* no UDMA */ + printk("triton.c: sorry, known bad drive.\n"); + return 1; /* DMA disabled */ + } + } /* Enable DMA on any drive that has UltraDMA (mode 0/1/2) enabled */ if (id->field_valid & 4) /* UltraDMA */ if ((id->dma_ultra & (id->dma_ultra >> 8) & 7)) {

--Boundary-=_XrJmOWFrxsjyBldbEFSArCBynEcd--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html