knfsd: Replace lock_kernel with a mutex for nfsd thread startup/shutdown locking.
[linux-2.6/mini2440.git] / include / asm-m68k / ide.h
blob909c6dfd3851169dae42ac87613a70fc912ece34
1 /*
2 * linux/include/asm-m68k/ide.h
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
7 /* Copyright(c) 1996 Kars de Jong */
8 /* Based on the ide driver from 1.2.13pl8 */
11 * Credits (alphabetical):
13 * - Bjoern Brauel
14 * - Kars de Jong
15 * - Torsten Ebeling
16 * - Dwight Engen
17 * - Thorsten Floeck
18 * - Roman Hodek
19 * - Guenther Kelleter
20 * - Chris Lawrence
21 * - Michael Rausch
22 * - Christian Sauer
23 * - Michael Schmitz
24 * - Jes Soerensen
25 * - Michael Thurm
26 * - Geert Uytterhoeven
29 #ifndef _M68K_IDE_H
30 #define _M68K_IDE_H
32 #ifdef __KERNEL__
35 #include <asm/setup.h>
36 #include <asm/io.h>
37 #include <asm/irq.h>
39 #ifdef CONFIG_ATARI
40 #include <linux/interrupt.h>
41 #include <asm/atari_stdma.h>
42 #endif
44 #ifdef CONFIG_MAC
45 #include <asm/macints.h>
46 #endif
48 #ifndef MAX_HWIFS
49 #define MAX_HWIFS 4 /* same as the other archs */
50 #endif
53 * Get rid of defs from io.h - ide has its private and conflicting versions
54 * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
55 * always use the `raw' MMIO versions
57 #undef inb
58 #undef inw
59 #undef insw
60 #undef inl
61 #undef insl
62 #undef outb
63 #undef outw
64 #undef outsw
65 #undef outl
66 #undef outsl
67 #undef readb
68 #undef readw
69 #undef readl
70 #undef writeb
71 #undef writew
72 #undef writel
74 #define inb in_8
75 #define inw in_be16
76 #define insw(port, addr, n) raw_insw((u16 *)port, addr, n)
77 #define inl in_be32
78 #define insl(port, addr, n) raw_insl((u32 *)port, addr, n)
79 #define outb(val, port) out_8(port, val)
80 #define outw(val, port) out_be16(port, val)
81 #define outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
82 #define outl(val, port) out_be32(port, val)
83 #define outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
84 #define readb in_8
85 #define readw in_be16
86 #define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n)
87 #define readl in_be32
88 #define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n)
89 #define writeb(val, port) out_8(port, val)
90 #define writew(val, port) out_be16(port, val)
91 #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
92 #define writel(val, port) out_be32(port, val)
93 #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
94 #if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
95 #define insw_swapw(port, addr, n) raw_insw_swapw((u16 *)port, addr, n)
96 #define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n)
97 #endif
100 /* Q40 and Atari have byteswapped IDE busses and since many interesting
101 * values in the identification string are text, chars and words they
102 * happened to be almost correct without swapping.. However *_capacity
103 * is needed for drives over 8 GB. RZ */
104 #if defined(CONFIG_Q40) || defined(CONFIG_ATARI)
105 #define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI)
106 #endif
108 #ifdef CONFIG_BLK_DEV_FALCON_IDE
109 #define IDE_ARCH_LOCK
111 extern int falconide_intr_lock;
113 static __inline__ void ide_release_lock (void)
115 if (MACH_IS_ATARI) {
116 if (falconide_intr_lock == 0) {
117 printk("ide_release_lock: bug\n");
118 return;
120 falconide_intr_lock = 0;
121 stdma_release();
125 static __inline__ void
126 ide_get_lock(irq_handler_t handler, void *data)
128 if (MACH_IS_ATARI) {
129 if (falconide_intr_lock == 0) {
130 if (in_interrupt() > 0)
131 panic( "Falcon IDE hasn't ST-DMA lock in interrupt" );
132 stdma_lock(handler, data);
133 falconide_intr_lock = 1;
137 #endif /* CONFIG_BLK_DEV_FALCON_IDE */
139 #define IDE_ARCH_ACK_INTR
140 #define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
142 #endif /* __KERNEL__ */
143 #endif /* _M68K_IDE_H */