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.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
new file mode 100644
index 000000000000..cb2edd018ad6
--- /dev/null
+++ b/include/asm-mips/mach-generic/ide.h
@@ -0,0 +1,119 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994-1996 Linus Torvalds & authors
7 *
8 * Copied from i386; many of the especially older MIPS or ISA-based platforms
9 * are basically identical. Using this file probably implies i8259 PIC
10 * support in a system but the very least interrupt numbers 0 - 15 need to
11 * be put aside for legacy devices.
12 */
13#ifndef __ASM_MACH_GENERIC_IDE_H
14#define __ASM_MACH_GENERIC_IDE_H
15
16#ifdef __KERNEL__
17
18#include <linux/config.h>
19#include <linux/pci.h>
20#include <linux/stddef.h>
21
22#ifndef MAX_HWIFS
23# ifdef CONFIG_BLK_DEV_IDEPCI
24#define MAX_HWIFS 10
25# else
26#define MAX_HWIFS 6
27# endif
28#endif
29
30#define IDE_ARCH_OBSOLETE_DEFAULTS
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)
51{
52 if (ide_probe_legacy())
53 switch (base) {
54 case 0x1f0:
55 return 14;
56 case 0x170:
57 return 15;
58 case 0x1e8:
59 return 11;
60 case 0x168:
61 return 10;
62 case 0x1e0:
63 return 8;
64 case 0x160:
65 return 12;
66 default:
67 return 0;
68 }
69 else
70 return 0;
71}
72
73static __inline__ unsigned long ide_default_io_base(int index)
74{
75 if (ide_probe_legacy())
76 switch (index) {
77 case 0:
78 return 0x1f0;
79 case 1:
80 return 0x170;
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 }
92 else
93 return 0;
94}
95
96#define IDE_ARCH_OBSOLETE_INIT
97#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
98
99#ifdef CONFIG_BLK_DEV_IDEPCI
100#define ide_init_default_irq(base) (0)
101#else
102#define ide_init_default_irq(base) ide_default_irq(base)
103#endif
104
105/* MIPS port and memory-mapped I/O string operations. */
106
107#define __ide_insw insw
108#define __ide_insl insl
109#define __ide_outsw outsw
110#define __ide_outsl outsl
111
112#define __ide_mm_insw readsw
113#define __ide_mm_insl readsl
114#define __ide_mm_outsw writesw
115#define __ide_mm_outsl writesl
116
117#endif /* __KERNEL__ */
118
119#endif /* __ASM_MACH_GENERIC_IDE_H */