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
6 * This file contains the MIPS architecture specific IDE code.
8 * Copyright (C) 1994-1996 Linus Torvalds & authors
16 #include <linux/config.h>
20 # ifdef CONFIG_BLK_DEV_IDEPCI
28 int (*ide_default_irq)(ide_ioreg_t base);
29 ide_ioreg_t (*ide_default_io_base)(int index);
30 void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
31 ide_ioreg_t ctrl_port, int *irq);
34 extern struct ide_ops *ide_ops;
36 static __inline__ int ide_default_irq(ide_ioreg_t base)
38 return ide_ops->ide_default_irq(base);
41 static __inline__ ide_ioreg_t ide_default_io_base(int index)
43 return ide_ops->ide_default_io_base(index);
46 static inline void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
47 ide_ioreg_t ctrl_port, int *irq)
49 ide_ops->ide_init_hwif_ports(hw, data_port, ctrl_port, irq);
52 static __inline__ void ide_init_default_hwifs(void)
54 #ifndef CONFIG_BLK_DEV_IDEPCI
58 for(index = 0; index < MAX_HWIFS; index++) {
59 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
60 hw.irq = ide_default_irq(ide_default_io_base(index));
61 ide_register_hw(&hw, NULL);
63 #endif /* CONFIG_BLK_DEV_IDEPCI */
66 #undef SUPPORT_VLB_SYNC
67 #define SUPPORT_VLB_SYNC 0
69 #if defined(__MIPSEB__)
71 /* get rid of defs from io.h - ide has its private and conflicting versions */
85 #define insw(port, addr, count) ide_insw(port, addr, count)
86 #define insl(port, addr, count) ide_insl(port, addr, count)
87 #define outsw(port, addr, count) ide_outsw(port, addr, count)
88 #define outsl(port, addr, count) ide_outsl(port, addr, count)
90 static inline void ide_insw(unsigned long port, void *addr, unsigned int count)
93 *(u16 *)addr = *(volatile u16 *)(mips_io_port_base + port);
98 static inline void ide_outsw(unsigned long port, void *addr, unsigned int count)
101 *(volatile u16 *)(mips_io_port_base + (port)) = *(u16 *)addr;
106 static inline void ide_insl(unsigned long port, void *addr, unsigned int count)
109 *(u32 *)addr = *(volatile u32 *)(mips_io_port_base + port);
114 static inline void ide_outsl(unsigned long port, void *addr, unsigned int count)
117 *(volatile u32 *)(mips_io_port_base + (port)) = *(u32 *)addr;
124 #endif /* __KERNEL__ */
126 #endif /* __ASM_IDE_H */