aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/mach-generic/ide.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/mach-generic/ide.h')
-rw-r--r--include/asm-mips/mach-generic/ide.h83
1 files changed, 44 insertions, 39 deletions
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
index 6eba2e576aaa..a77128362a7d 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -33,13 +33,24 @@ static __inline__ int ide_probe_legacy(void)
33{ 33{
34#ifdef CONFIG_PCI 34#ifdef CONFIG_PCI
35 struct pci_dev *dev; 35 struct pci_dev *dev;
36 if ((dev = pci_get_class(PCI_CLASS_BRIDGE_EISA << 8, NULL)) != NULL || 36 /*
37 (dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL)) != NULL) { 37 * This can be called on the ide_setup() path, super-early in
38 pci_dev_put(dev); 38 * boot. But the down_read() will enable local interrupts,
39 39 * which can cause some machines to crash. So here we detect
40 return 1; 40 * and flag that situation and bail out early.
41 } 41 */
42 if (no_pci_devices())
43 return 0;
44 dev = pci_get_class(PCI_CLASS_BRIDGE_EISA << 8, NULL);
45 if (dev)
46 goto found;
47 dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
48 if (dev)
49 goto found;
42 return 0; 50 return 0;
51found:
52 pci_dev_put(dev);
53 return 1;
43#elif defined(CONFIG_EISA) || defined(CONFIG_ISA) 54#elif defined(CONFIG_EISA) || defined(CONFIG_ISA)
44 return 1; 55 return 1;
45#else 56#else
@@ -49,48 +60,42 @@ static __inline__ int ide_probe_legacy(void)
49 60
50static __inline__ int ide_default_irq(unsigned long base) 61static __inline__ int ide_default_irq(unsigned long base)
51{ 62{
52 if (ide_probe_legacy()) 63 switch (base) {
53 switch (base) { 64 case 0x1f0: return 14;
54 case 0x1f0: 65 case 0x170: return 15;
55 return 14; 66 case 0x1e8: return 11;
56 case 0x170: 67 case 0x168: return 10;
57 return 15; 68 case 0x1e0: return 8;
58 case 0x1e8: 69 case 0x160: return 12;
59 return 11;
60 case 0x168:
61 return 10;
62 case 0x1e0:
63 return 8;
64 case 0x160:
65 return 12;
66 default: 70 default:
67 return 0; 71 return 0;
68 } 72 }
69 else
70 return 0;
71} 73}
72 74
73static __inline__ unsigned long ide_default_io_base(int index) 75static __inline__ unsigned long ide_default_io_base(int index)
74{ 76{
75 if (ide_probe_legacy()) 77 if (!ide_probe_legacy())
78 return 0;
79 /*
80 * If PCI is present then it is not safe to poke around
81 * the other legacy IDE ports. Only 0x1f0 and 0x170 are
82 * defined compatibility mode ports for PCI. A user can
83 * override this using ide= but we must default safe.
84 */
85 if (no_pci_devices()) {
76 switch (index) { 86 switch (index) {
77 case 0: 87 case 2: return 0x1e8;
78 return 0x1f0; 88 case 3: return 0x168;
79 case 1: 89 case 4: return 0x1e0;
80 return 0x170; 90 case 5: return 0x160;
81 case 2:
82 return 0x1e8;
83 case 3:
84 return 0x168;
85 case 4:
86 return 0x1e0;
87 case 5:
88 return 0x160;
89 default:
90 return 0;
91 } 91 }
92 else 92 }
93 switch (index) {
94 case 0: return 0x1f0;
95 case 1: return 0x170;
96 default:
93 return 0; 97 return 0;
98 }
94} 99}
95 100
96#define IDE_ARCH_OBSOLETE_INIT 101#define IDE_ARCH_OBSOLETE_INIT