aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-08-07 12:18:28 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-08-26 21:16:55 -0400
commitb5438582090406e2ccb4169d9b2df7c9939ae42b (patch)
tree46fb2e427e4159ff3e831137fc55acda6c4a7af0 /include/asm-mips
parentde4b21474053513d9ad41994c95dade3e6b3362f (diff)
[MIPS] SMTC: Fix crash on bootup with idebus= command line argument.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/mach-generic/ide.h76
1 files changed, 25 insertions, 51 deletions
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
index 6eba2e576aaa..2b928577be5d 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -29,68 +29,42 @@
29 29
30#define IDE_ARCH_OBSOLETE_DEFAULTS 30#define IDE_ARCH_OBSOLETE_DEFAULTS
31 31
32static __inline__ int ide_probe_legacy(void)
33{
34#ifdef CONFIG_PCI
35 struct pci_dev *dev;
36 if ((dev = pci_get_class(PCI_CLASS_BRIDGE_EISA << 8, NULL)) != NULL ||
37 (dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL)) != NULL) {
38 pci_dev_put(dev);
39
40 return 1;
41 }
42 return 0;
43#elif defined(CONFIG_EISA) || defined(CONFIG_ISA)
44 return 1;
45#else
46 return 0;
47#endif
48}
49
50static __inline__ int ide_default_irq(unsigned long base) 32static __inline__ int ide_default_irq(unsigned long base)
51{ 33{
52 if (ide_probe_legacy()) 34 switch (base) {
53 switch (base) { 35 case 0x1f0: return 14;
54 case 0x1f0: 36 case 0x170: return 15;
55 return 14; 37 case 0x1e8: return 11;
56 case 0x170: 38 case 0x168: return 10;
57 return 15; 39 case 0x1e0: return 8;
58 case 0x1e8: 40 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: 41 default:
67 return 0; 42 return 0;
68 } 43 }
69 else
70 return 0;
71} 44}
72 45
73static __inline__ unsigned long ide_default_io_base(int index) 46static __inline__ unsigned long ide_default_io_base(int index)
74{ 47{
75 if (ide_probe_legacy()) 48 /*
49 * If PCI is present then it is not safe to poke around
50 * the other legacy IDE ports. Only 0x1f0 and 0x170 are
51 * defined compatibility mode ports for PCI. A user can
52 * override this using ide= but we must default safe.
53 */
54 if (no_pci_devices()) {
76 switch (index) { 55 switch (index) {
77 case 0: 56 case 2: return 0x1e8;
78 return 0x1f0; 57 case 3: return 0x168;
79 case 1: 58 case 4: return 0x1e0;
80 return 0x170; 59 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 } 60 }
92 else 61 }
62 switch (index) {
63 case 0: return 0x1f0;
64 case 1: return 0x170;
65 default:
93 return 0; 66 return 0;
67 }
94} 68}
95 69
96#define IDE_ARCH_OBSOLETE_INIT 70#define IDE_ARCH_OBSOLETE_INIT