2 * generic/default IDE host driver
4 * Copyright (C) 2004, 2008-2009 Bartlomiej Zolnierkiewicz
5 * This code was split off from ide.c. See it for original copyrights.
7 * May be copied or modified under the terms of the GNU General Public License.
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/module.h>
13 #include <linux/ide.h>
14 #include <linux/pci_ids.h>
16 /* FIXME: convert arm and m32r to use ide_platform host driver */
24 #define DRV_NAME "ide_generic"
26 static int probe_mask;
27 module_param(probe_mask, int, 0);
28 MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports");
30 static const struct ide_port_info ide_generic_port_info = {
31 .host_flags = IDE_HFLAG_NO_DMA,
32 .chipset = ide_generic,
36 static const u16 legacy_bases[] = { 0x1f0 };
37 static const int legacy_irqs[] = { IRQ_HARDDISK };
38 #elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) || \
39 defined(CONFIG_PLAT_OPSPUT)
40 static const u16 legacy_bases[] = { 0x1f0 };
41 static const int legacy_irqs[] = { PLD_IRQ_CFIREQ };
42 #elif defined(CONFIG_PLAT_MAPPI3)
43 static const u16 legacy_bases[] = { 0x1f0, 0x170 };
44 static const int legacy_irqs[] = { PLD_IRQ_CFIREQ, PLD_IRQ_IDEIREQ };
45 #elif defined(CONFIG_ALPHA)
46 static const u16 legacy_bases[] = { 0x1f0, 0x170, 0x1e8, 0x168 };
47 static const int legacy_irqs[] = { 14, 15, 11, 10 };
49 static const u16 legacy_bases[] = { 0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160 };
50 static const int legacy_irqs[] = { 14, 15, 11, 10, 8, 12 };
53 static void ide_generic_check_pci_legacy_iobases(int *primary, int *secondary)
56 struct pci_dev *p = NULL;
60 if (pci_resource_start(p, 0) == 0x1f0)
62 if (pci_resource_start(p, 2) == 0x170)
65 /* Cyrix CS55{1,2}0 pre SFF MWDMA ATA on the bridge */
66 if (p->vendor == PCI_VENDOR_ID_CYRIX &&
67 (p->device == PCI_DEVICE_ID_CYRIX_5510 ||
68 p->device == PCI_DEVICE_ID_CYRIX_5520))
69 *primary = *secondary = 1;
71 /* Intel MPIIX - PIO ATA on non PCI side of bridge */
72 if (p->vendor == PCI_VENDOR_ID_INTEL &&
73 p->device == PCI_DEVICE_ID_INTEL_82371MX) {
74 pci_read_config_word(p, 0x6C, &val);
76 /* ATA port enabled */
87 static int __init ide_generic_init(void)
89 struct ide_hw hw, *hws[] = { &hw };
90 unsigned long io_addr;
91 int i, rc = 0, primary = 0, secondary = 0;
93 ide_generic_check_pci_legacy_iobases(&primary, &secondary);
96 printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" "
97 "module parameter for probing all legacy ISA IDE ports\n");
105 printk(KERN_INFO DRV_NAME ": enforcing probing of I/O ports "
106 "upon user request\n");
108 for (i = 0; i < ARRAY_SIZE(legacy_bases); i++) {
109 io_addr = legacy_bases[i];
111 if ((probe_mask & (1 << i)) && io_addr) {
112 if (!request_region(io_addr, 8, DRV_NAME)) {
113 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX "
115 DRV_NAME, io_addr, io_addr + 7);
120 if (!request_region(io_addr + 0x206, 1, DRV_NAME)) {
121 printk(KERN_ERR "%s: I/O resource 0x%lX "
123 DRV_NAME, io_addr + 0x206);
124 release_region(io_addr, 8);
129 memset(&hw, 0, sizeof(hw));
130 ide_std_init_ports(&hw, io_addr, io_addr + 0x206);
132 hw.irq = isa_irq_to_vector(legacy_irqs[i]);
134 hw.irq = legacy_irqs[i];
136 rc = ide_host_add(&ide_generic_port_info, hws, 1, NULL);
138 release_region(io_addr + 0x206, 1);
139 release_region(io_addr, 8);
147 module_init(ide_generic_init);
149 MODULE_LICENSE("GPL");