--- include/asm-mips/ide.h.orig 2004-09-16 15:41:00.000000000 -0700 +++ include/asm-mips/ide.h 2004-09-20 09:45:14.000000000 -0700 @@ -20,6 +20,91 @@ #define __ide_mm_outsw ide_outsw #define __ide_mm_outsl ide_outsl +#ifndef CONFIG_CPU_LITTLE_ENDIAN +/* + * Only for the Big Endian systems, do not do the swapping. + * We cannot turn off the CONFIG_SWAP_IO_SPACE since the + * other subsystems need it. Hence we need this approach for + * IDE only - Manish Lachwani (mlachwani@mvista.com) + */ +extern const unsigned long mips_io_port_base; + +#ifdef insb +#undef insb +#endif +#ifdef outsb +#undef outsb +#endif +#ifdef insw +#undef insw +#endif +#ifdef outsw +#undef outsw +#endif +#ifdef insl +#undef insl +#endif +#ifdef outsl +#undef outsl +#endif + +#define insb(port, addr, count) ___ide_insb(port, addr, count) +#define insw(port, addr, count) ___ide_insw(port, addr, count) +#define insl(port, addr, count) ___ide_insl(port, addr, count) +#define outsb(port, addr, count) ___ide_outsb(port, addr, count) +#define outsw(port, addr, count) ___ide_outsw(port, addr, count) +#define outsl(port, addr, count) ___ide_outsl(port, addr, count) + +static inline void ___ide_insb(unsigned long port, void *addr, unsigned int count) +{ + while (count--) { + *(u16 *)addr = *(volatile u8 *)(mips_io_port_base + port); + addr++; + } +} + +static inline void ___ide_outsb(unsigned long port, void *addr, unsigned int count) +{ + while (count--) { + *(volatile u8 *)(mips_io_port_base + port) = *(u8 *)addr; + addr++; + } +} + +static inline void ___ide_insw(unsigned long port, void *addr, unsigned int count) +{ + while (count--) { + *(u16 *)addr = *(volatile u16 *)(mips_io_port_base + port); + addr += 2; + } +} + +static inline void ___ide_outsw(unsigned long port, void *addr, unsigned int count) +{ + while (count--) { + *(volatile u16 *)(mips_io_port_base + port) = *(u16 *)addr; + addr += 2; + } +} + +static inline void ___ide_insl(unsigned long port, void *addr, unsigned int count) +{ + while (count--) { + *(u32 *)addr = *(volatile u32 *)(mips_io_port_base + port); + addr += 4; + } +} + +static inline void ___ide_outsl(unsigned long port, void *addr, unsigned int count) +{ + while (count--) { + *(volatile u32 *)(mips_io_port_base + port) = *(u32 *)addr; + addr += 4; + } +} + +#endif /* CONFIG_LITTLE_ENDIAN */ + #endif /* __KERNEL__ */ #endif /* __ASM_IDE_H */