From 0745ae02074998ac6cbaac67454e220b5fb8c3c7 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 21 Feb 2001 20:02:35 +0000 Subject: Handle IDE ports correctly for CONFIG_SWAP_IO_SPACE on big endian. From Carsten with mods by me. --- include/asm-mips/ide.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'include/asm-mips') diff --git a/include/asm-mips/ide.h b/include/asm-mips/ide.h index ed20997b1..c6e39ec26 100644 --- a/include/asm-mips/ide.h +++ b/include/asm-mips/ide.h @@ -8,10 +8,6 @@ * Copyright (C) 1994-1996 Linus Torvalds & authors */ -/* - * This file contains the MIPS architecture specific IDE code. - */ - #ifndef __ASM_IDE_H #define __ASM_IDE_H @@ -129,6 +125,52 @@ static __inline__ void ide_release_region(ide_ioreg_t from, ide_ops->ide_release_region(from, extent); } + +#if defined(CONFIG_SWAP_IO_SPACE) && defined(__MIPSEB__) + +#ifdef insl +#undef insl +#endif +#ifdef outsl +#undef outsl +#endif +#ifdef insw +#undef insw +#endif +#ifdef outsw +#undef outsw +#endif + +#define insw(p,a,c) \ +do { \ + unsigned short *ptr = (unsigned short *)(a); \ + unsigned int i = (c); \ + while (i--) \ + *ptr++ = inw(p); \ +} while (0) +#define insl(p,a,c) \ +do { \ + unsigned long *ptr = (unsigned long *)(a); \ + unsigned int i = (c); \ + while (i--) \ + *ptr++ = inl(p); \ +} while (0) +#define outsw(p,a,c) \ +do { \ + unsigned short *ptr = (unsigned short *)(a); \ + unsigned int i = (c); \ + while (i--) \ + outw(*ptr++, (p)); \ +} while (0) +#define outsl(p,a,c) { \ + unsigned long *ptr = (unsigned long *)(a); \ + unsigned int i = (c); \ + while (i--) \ + outl(*ptr++, (p)); \ +} while (0) + +#endif /* defined(CONFIG_SWAP_IO_SPACE) && defined(__MIPSEB__) */ + /* * The following are not needed for the non-m68k ports */ -- cgit v1.2.3