1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 1995-1998 Linus Torvalds & author (see below)
7 * Principal Author: mlord@pobox.com (Mark Lord)
9 * See linux/MAINTAINERS for address of current maintainer.
11 * This file provides support for disabling the buggy read-ahead
12 * mode of the RZ1000 IDE chipset, commonly used on Intel motherboards.
14 * Dunno if this fixes both ports, or only the primary port (?).
17 #include <linux/types.h>
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/pci.h>
21 #include <linux/ide.h>
22 #include <linux/init.h>
24 #define DRV_NAME "rz1000"
26 static int rz1000_disable_readahead(struct pci_dev
*dev
)
30 if (!pci_read_config_word (dev
, 0x40, ®
) &&
31 !pci_write_config_word(dev
, 0x40, reg
& 0xdfff)) {
32 printk(KERN_INFO
"%s: disabled chipset read-ahead "
33 "(buggy RZ1000/RZ1001)\n", pci_name(dev
));
36 printk(KERN_INFO
"%s: serialized, disabled unmasking "
37 "(buggy RZ1000/RZ1001)\n", pci_name(dev
));
42 static const struct ide_port_info rz1000_chipset
= {
44 .host_flags
= IDE_HFLAG_NO_DMA
,
47 static int rz1000_init_one(struct pci_dev
*dev
, const struct pci_device_id
*id
)
49 struct ide_port_info d
= rz1000_chipset
;
52 rc
= pci_enable_device(dev
);
56 if (rz1000_disable_readahead(dev
)) {
57 d
.host_flags
|= IDE_HFLAG_SERIALIZE
;
58 d
.host_flags
|= IDE_HFLAG_NO_UNMASK_IRQS
;
61 return ide_pci_init_one(dev
, &d
, NULL
);
64 static void rz1000_remove(struct pci_dev
*dev
)
67 pci_disable_device(dev
);
70 static const struct pci_device_id rz1000_pci_tbl
[] = {
71 { PCI_VDEVICE(PCTECH
, PCI_DEVICE_ID_PCTECH_RZ1000
), 0 },
72 { PCI_VDEVICE(PCTECH
, PCI_DEVICE_ID_PCTECH_RZ1001
), 0 },
75 MODULE_DEVICE_TABLE(pci
, rz1000_pci_tbl
);
77 static struct pci_driver rz1000_pci_driver
= {
79 .id_table
= rz1000_pci_tbl
,
80 .probe
= rz1000_init_one
,
81 .remove
= rz1000_remove
,
84 static int __init
rz1000_ide_init(void)
86 return ide_pci_register_driver(&rz1000_pci_driver
);
89 static void __exit
rz1000_ide_exit(void)
91 pci_unregister_driver(&rz1000_pci_driver
);
94 module_init(rz1000_ide_init
);
95 module_exit(rz1000_ide_exit
);
97 MODULE_AUTHOR("Andre Hedrick");
98 MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
99 MODULE_LICENSE("GPL");