Import 2.3.51
[davej-history.git] / drivers / block / rz1000.c
blob455641c1da29e522081e36c8a381aeda1f1e5e92
1 /*
2 * linux/drivers/block/rz1000.c Version 0.05 December 8, 1997
4 * Copyright (C) 1995-1998 Linus Torvalds & author (see below)
5 */
7 /*
8 * Principal Author: mlord@pobox.com (Mark Lord)
10 * See linux/MAINTAINERS for address of current maintainer.
12 * This file provides support for disabling the buggy read-ahead
13 * mode of the RZ1000 IDE chipset, commonly used on Intel motherboards.
15 * Dunno if this fixes both ports, or only the primary port (?).
18 #undef REALLY_SLOW_IO /* most systems can safely undef this */
20 #include <linux/config.h> /* for CONFIG_BLK_DEV_IDEPCI */
21 #include <linux/types.h>
22 #include <linux/kernel.h>
23 #include <linux/delay.h>
24 #include <linux/timer.h>
25 #include <linux/mm.h>
26 #include <linux/ioport.h>
27 #include <linux/blkdev.h>
28 #include <linux/hdreg.h>
29 #include <linux/pci.h>
30 #include <linux/ide.h>
32 #include <asm/io.h>
34 #ifdef CONFIG_BLK_DEV_IDEPCI
36 void __init ide_init_rz1000 (ide_hwif_t *hwif) /* called from ide-pci.c */
38 unsigned short reg;
39 struct pci_dev *dev = hwif->pci_dev;
41 hwif->chipset = ide_rz1000;
42 if (!pci_read_config_word (dev, 0x40, &reg)
43 && !pci_write_config_word(dev, 0x40, reg & 0xdfff))
45 printk("%s: disabled chipset read-ahead (buggy RZ1000/RZ1001)\n", hwif->name);
46 } else {
47 hwif->serialized = 1;
48 hwif->drives[0].no_unmask = 1;
49 hwif->drives[1].no_unmask = 1;
50 printk("%s: serialized, disabled unmasking (buggy RZ1000/RZ1001)\n", hwif->name);
54 #else
56 static void __init init_rz1000 (struct pci_dev *dev, const char *name)
58 unsigned short reg, h;
60 if (!pci_read_config_word (dev, PCI_COMMAND, &reg) && !(reg & PCI_COMMAND_IO)) {
61 printk("%s: buggy IDE controller disabled (BIOS)\n", name);
62 return;
64 if (!pci_read_config_word (dev, 0x40, &reg)
65 && !pci_write_config_word(dev, 0x40, reg & 0xdfff))
67 printk("IDE: disabled chipset read-ahead (buggy %s)\n", name);
68 } else {
69 for (h = 0; h < MAX_HWIFS; ++h) {
70 ide_hwif_t *hwif = &ide_hwifs[h];
71 if ((hwif->io_ports[IDE_DATA_OFFSET] == 0x1f0 || hwif->io_ports[IDE_DATA_OFFSET] == 0x170)
72 && (hwif->chipset == ide_unknown || hwif->chipset == ide_generic))
74 hwif->chipset = ide_rz1000;
75 hwif->serialized = 1;
76 hwif->drives[0].no_unmask = 1;
77 hwif->drives[1].no_unmask = 1;
78 if (hwif->io_ports[IDE_DATA_OFFSET] == 0x170)
79 hwif->channel = 1;
80 printk("%s: serialized, disabled unmasking (buggy %s)\n", hwif->name, name);
86 void __init ide_probe_for_rz100x (void) /* called from ide.c */
88 struct pci_dev *dev = NULL;
90 while ((dev = pci_find_device(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000, dev))!=NULL)
91 init_rz1000 (dev, "RZ1000");
92 while ((dev = pci_find_device(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001, dev))!=NULL)
93 init_rz1000 (dev, "RZ1001");
96 #endif CONFIG_BLK_DEV_IDEPCI