The Patch to re-enable IDE-DMA

Mark Lord (mlord@pobox.com)
Wed, 29 Jul 1998 20:46:59 -0400


This is a multi-part message in MIME format.
--------------31822F683EA0E044CA4A4BB6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Attached is a patch which undo's the absurdness of 2.1.112
by adding a new configuration option for "IDEDMA AUTO-enabling",
the default for which is "OFF".

Now, just like that stupid issue with one system that couldn't
do PIO with interrupts on (the only reason we still hog the
interrupt line by default during IDE transfers), we will be
stuck with this one long after the original problem is eventually
found or rusted away.

Enjoy (or not).

-- 
mlord@pobox.com
The (ex-)Linux IDE guy
--------------31822F683EA0E044CA4A4BB6
Content-Type: text/plain; charset=us-ascii; name="ide-2.1.112+.pat1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="ide-2.1.112+.pat1"

diff -u --recursive --new-file --exclude=.* linux-2.1.112/Documentation/Configure.help linux/Documentation/Configure.help --- linux-2.1.112/Documentation/Configure.help Tue Jul 28 18:34:44 1998 +++ linux/Documentation/Configure.help Wed Jul 29 20:37:02 1998 @@ -417,10 +417,8 @@ CONFIG_BLK_DEV_IDEDMA If your PCI system uses IDE drive(s) (as opposed to SCSI, say) and is capable of bus-master DMA operation (most Pentium PCI systems), - you will want to say Y here to reduce CPU overhead. With this - option, Linux will automatically enable DMA transfers in most cases, - noting this with "DMA" appended to the drive identification info. - You can also use the "hdparm" utility to enable DMA for drives which + you will want to say Y here to reduce CPU overhead. + You can use the "hdparm" utility to enable DMA for drives which were not enabled automatically. You can get the latest version of the hdparm utility via anonymous FTP from ftp://sunsite.unc.edu/pub/Linux/system/hardware/. @@ -429,6 +427,18 @@ file Documentation/ide.txt for more information. It is safe to say Y to this question. + +Use DMA by default when available +CONFIG_IDEDMA_AUTO + Prior to kernel version 2.1.112, Linux used to automatically use + DMA for IDE drives and chipsets which support it. Due to concerns + about a couple of cases where buggy hardware may have caused damage, + the default is now to NOT use DMA automatically. To revert to the + previous behaviour, say Y to this question. + If you suspect your hardware is at all flakey, say N here. + Do NOT email the IDE kernel people regarding this issue! + + It is nearly always safe to say Y to this question. Other IDE chipset support CONFIG_IDE_CHIPSETS diff -u --recursive --new-file --exclude=.* linux-2.1.112/MAINTAINERS linux/MAINTAINERS --- linux-2.1.112/MAINTAINERS Tue Jul 28 18:34:44 1998 +++ linux/MAINTAINERS Wed Jul 29 20:32:40 1998 @@ -290,7 +290,7 @@ P: Mark Lord M: mlord@pobox.com L: linux-kernel@vger.rutgers.edu -S: Maintained +S: Odd Fixes IDE/ATAPI CDROM DRIVER P: Erik Andersen diff -u --recursive --new-file --exclude=.* linux-2.1.112/drivers/block/Config.in linux/drivers/block/Config.in --- linux-2.1.112/drivers/block/Config.in Tue Jul 28 18:34:30 1998 +++ linux/drivers/block/Config.in Wed Jul 29 19:24:18 1998 @@ -26,7 +26,10 @@ bool ' Generic PCI IDE chipset support' CONFIG_BLK_DEV_IDEPCI if [ "$CONFIG_BLK_DEV_IDEPCI" = "y" ]; then # Either the DMA code is buggy or the DMA hardware is unreliable. FIXME. - #bool ' Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA + bool ' Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA + if [ "$CONFIG_BLK_DEV_IDEDMA" = "y" ]; then + bool ' Use DMA by default when available' CONFIG_IDEDMA_AUTO + fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then bool ' OPTi 82C621 chipset enhanced support (EXPERIMENTAL)' CONFIG_BLK_DEV_OPTI621 if [ "$CONFIG_BLK_DEV_IDEDMA" = "y" ]; then diff -u --recursive --new-file --exclude=.* linux-2.1.112/drivers/block/ide-dma.c linux/drivers/block/ide-dma.c --- linux-2.1.112/drivers/block/ide-dma.c Fri May 8 08:55:16 1998 +++ linux/drivers/block/ide-dma.c Wed Jul 29 19:22:44 1998 @@ -210,7 +210,7 @@ struct hd_driveid *id = drive->id; ide_hwif_t *hwif = HWIF(drive); - if (id && (id->capability & 1) && !hwif->no_autodma) { + if (id && (id->capability & 1) && hwif->autodma) { /* 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)) diff -u --recursive --new-file --exclude=.* linux-2.1.112/drivers/block/ide-pci.c linux/drivers/block/ide-pci.c --- linux-2.1.112/drivers/block/ide-pci.c Tue Jul 28 18:33:46 1998 +++ linux/drivers/block/ide-pci.c Wed Jul 29 19:22:33 1998 @@ -225,11 +225,14 @@ */ __initfunc(static void ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_t *d)) { - unsigned int port, at_least_one_hwif_enabled = 0, no_autodma = 0, pciirq = 0; + unsigned int port, at_least_one_hwif_enabled = 0, autodma = 0, pciirq = 0; unsigned short pcicmd = 0, tried_config = 0; byte tmp = 0; ide_hwif_t *hwif, *mate = NULL; +#ifdef CONFIG_IDEDMA_AUTO + autodma = 1; +#endif check_if_enabled: if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) { printk("%s: error accessing PCI regs\n", d->name); @@ -249,7 +252,7 @@ printk("%s: device disabled (BIOS)\n", d->name); return; } - no_autodma = 1; /* default DMA off if we had to configure it here */ + autodma = 0; /* default DMA off if we had to configure it here */ goto check_if_enabled; } if (tried_config) @@ -311,11 +314,11 @@ hwif->mate = mate; mate->mate = hwif; } - if (no_autodma) - hwif->no_autodma = 1; #ifdef CONFIG_BLK_DEV_IDEDMA if (IDE_PCI_DEVID_EQ(d->devid, DEVID_SIS5513)) - hwif->no_autodma = 1; /* too many SIS-5513 systems have troubles */ + autodma = 0; + if (autodma) + hwif->autodma = 1; if (IDE_PCI_DEVID_EQ(d->devid, DEVID_PDC20246) || ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 0x80))) { unsigned int extra = (!mate && IDE_PCI_DEVID_EQ(d->devid, DEVID_PDC20246)) ? 16 : 0; @@ -324,8 +327,7 @@ /* * Set up BM-DMA capability (PnP BIOS should have done this) */ -printk("%s: %s enabling Bus-Master DMA\n", hwif->name, d->name); - hwif->no_autodma = 1; /* default DMA off if we had to configure it here */ + hwif->autodma = 0; /* default DMA off if we had to configure it here */ (void) pci_write_config_word(dev, PCI_COMMAND, pcicmd | PCI_COMMAND_MASTER); if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || !(pcicmd & PCI_COMMAND_MASTER)) { printk("%s: %s error updating PCICMD\n", hwif->name, d->name); diff -u --recursive --new-file --exclude=.* linux-2.1.112/drivers/block/ide.c linux/drivers/block/ide.c --- linux-2.1.112/drivers/block/ide.c Tue Jul 28 18:34:44 1998 +++ linux/drivers/block/ide.c Wed Jul 29 19:29:04 1998 @@ -2289,7 +2289,7 @@ * "idex=serialize" : do not overlap operations on idex and ide(x^1) * "idex=four" : four drives on idex and ide(x^1) share same ports * "idex=reset" : reset interface before first use - * "idex=nodma" : do not enable DMA by default on either drive + * "idex=dma" : enable DMA by default on both drives if possible * * The following are valid ONLY on ide0, * and the defaults for the base,ctl ports must not be altered. @@ -2391,7 +2391,7 @@ /* * Be VERY CAREFUL changing this: note hardcoded indexes below */ - const char *ide_words[] = {"noprobe", "serialize", "autotune", "noautotune", "reset", "nodma", "four", + const char *ide_words[] = {"noprobe", "serialize", "autotune", "noautotune", "reset", "dma", "four", "qd6580", "ht6560b", "cmd640_vlb", "dtc2278", "umc8672", "ali14xx", "dc4030", NULL}; hw = s[3] - '0'; hwif = &ide_hwifs[hw]; @@ -2479,8 +2479,8 @@ goto do_serialize; } #endif /* CONFIG_BLK_DEV_4DRIVES */ - case -6: /* nodma */ - hwif->no_autodma = 1; + case -6: /* dma */ + hwif->autodma = 1; goto done; case -5: /* "reset" */ hwif->reset = 1; diff -u --recursive --new-file --exclude=.* linux-2.1.112/drivers/block/ide.h linux/drivers/block/ide.h --- linux-2.1.112/drivers/block/ide.h Tue Jun 16 17:15:06 1998 +++ linux/drivers/block/ide.h Wed Jul 29 19:27:38 1998 @@ -341,7 +341,7 @@ unsigned serialized : 1; /* serialized operation with mate hwif */ unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ unsigned reset : 1; /* reset after probe */ - unsigned no_autodma : 1; /* don't automatically enable DMA at boot */ + unsigned autodma : 1; /* automatically try to enable DMA at boot */ byte channel; /* for dual-port chips: 0=primary, 1=secondary */ struct pci_dev *pci_dev; /* for pci chipsets */ ide_pci_devid_t pci_devid; /* for pci chipsets: {VID,DID} */

--------------31822F683EA0E044CA4A4BB6--

- 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