2 * linux/include/asm-m68k/ide.h
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
7 /* Copyright(c) 1996 Kars de Jong */
8 /* Based on the ide driver from 1.2.13pl8 */
11 * Credits (alphabetical):
26 * - Geert Uytterhoeven
34 #include <linux/config.h>
36 #include <asm/setup.h>
41 #include <linux/interrupt.h>
42 #include <asm/atari_stdma.h>
46 #include <asm/macints.h>
50 #define MAX_HWIFS 4 /* same as the other archs */
54 * FIXME: IOPS struct calls needed for taskfile.
57 static __inline__ int ide_default_irq(ide_ioreg_t base)
62 static __inline__ ide_ioreg_t ide_default_io_base(int index)
69 * Set up a hw structure for a specified data port, control port and IRQ.
70 * This should follow whatever the default interface uses.
72 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
74 if (data_port || ctrl_port)
75 printk("ide_init_hwif_ports: must not be called\n");
79 * This registers the standard ports for this architecture with the IDE
82 static __inline__ void ide_init_default_hwifs(void)
86 static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
87 unsigned long flags, const char *device, void *dev_id)
91 return request_irq(irq, handler, 0, device, dev_id);
92 #endif /* CONFIG_AMIGA */
95 return request_irq(irq, handler, 0, device, dev_id);
96 #endif /* CONFIG_Q40*/
99 return request_irq(irq, handler, 0, device, dev_id);
100 #endif /* CONFIG_MAC */
104 static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
108 free_irq(irq, dev_id);
109 #endif /* CONFIG_AMIGA */
112 free_irq(irq, dev_id);
113 #endif /* CONFIG_Q40*/
116 free_irq(irq, dev_id);
117 #endif /* CONFIG_MAC */
121 * We should really implement those some day.
123 static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
128 static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name)
132 request_region((q40ide_ioreg_t)from,extent,name);
136 static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent)
140 release_region((q40ide_ioreg_t)from,extent);
144 #undef SUPPORT_SLOW_DATA_PORTS
145 #define SUPPORT_SLOW_DATA_PORTS 0
147 #undef SUPPORT_VLB_SYNC
148 #define SUPPORT_VLB_SYNC 0
150 /* this definition is used only on startup .. */
156 * get rid of defs from io.h
157 * ide still has some private and conflicting versions
166 * define IO method and translation,
167 * so far only Q40 has ide-if on ISA
171 #define ADDR_TRANS_B(_addr_) (_addr_)
172 #define ADDR_TRANS_W(_addr_) (_addr_)
173 #define ADDR_TRANS_L(_addr_) (_addr_)
177 #define ADDR_TRANS_B(_addr_) (MACH_IS_Q40 ? ((unsigned char *)Q40_ISA_IO_B(_addr_)) : (_addr_))
178 #define ADDR_TRANS_W(_addr_) (MACH_IS_Q40 ? ((unsigned char *)Q40_ISA_IO_W(_addr_)) : (_addr_))
179 #define ADDR_TRANS_L(_addr_) (MACH_IS_Q40 ? ((unsigned char *)Q40_ISA_IO_L(_addr_)) : (_addr_))
182 #define HAVE_ARCH_OUT_BYTE 1
184 #define OUT_BYTE(v,p) out_8(ADDR_TRANS_B((p)), (v))
185 #define OUT_WORD(v,p) out_be16(ADDR_TRANS_W((p)), (v))
186 #define OUT_LONG(v,p) out_be32(ADDR_TRANS_L((p)), (v))
188 #define HAVE_ARCH_IN_BYTE 1
190 #define IN_BYTE(p) in_8(ADDR_TRANS_B((p)))
191 #define IN_WORD(p) in_be16(ADDR_TRANS_W((p)))
192 #define IN_LONG(p) in_be32(ADDR_TRANS_L((p)))
194 #define insw(port, buf, nr) raw_insw(ADDR_TRANS_W(port), buf, nr)
195 #define outsw(port, buf, nr) raw_outsw(ADDR_TRANS_W(port), buf, nr)
197 #define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1)
198 #define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1)
201 #if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
203 #define insl_swapw(data_reg, buffer, wcount) \
204 insw_swapw(data_reg, buffer, (wcount)<<1)
205 #define outsl_swapw(data_reg, buffer, wcount) \
206 outsw_swapw(data_reg, buffer, (wcount)<<1)
208 #define insw_swapw(port, buf, nr) raw_insw_swapw(ADDR_TRANS_W(port), buf, nr)
209 #define outsw_swapw(port, buf, nr) raw_outsw_swapw(ADDR_TRANS_W(port),buf,nr)
211 #endif /* CONFIG_ATARI || CONFIG_Q40 */
214 /* Q40 and Atari have byteswapped IDE bus and since many interesting
215 * values in the identification string are text, chars and words they
216 * happened to be almost correct without swapping.. However *_capacity
217 * is needed for drives over 8 GB. RZ */
218 #if defined(CONFIG_Q40) || defined(CONFIG_ATARI)
219 #define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI)
223 #define IDE_ARCH_LOCK 1
225 static __inline__ void ide_release_lock (int *ide_lock)
228 if (*ide_lock == 0) {
229 printk("ide_release_lock: bug\n");
237 static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, struct pt_regs *), void *data)
240 if (*ide_lock == 0) {
241 if (in_interrupt() > 0)
242 panic( "Falcon IDE hasn't ST-DMA lock in interrupt" );
243 stdma_lock(handler, data);
248 #endif /* CONFIG_ATARI */
250 #endif /* __KERNEL__ */
252 #endif /* _M68K_IDE_H */