Commit 4912ba72 authored by Maciej W. Rozycki's avatar Maciej W. Rozycki Committed by Ralf Baechle

Define mem_*() I/O accessory functions that preserve byte addresses.

Add missing ____raw_*q() functions.
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent b727a602
......@@ -34,7 +34,7 @@
#undef CONF_SLOWDOWN_IO
/*
* Raw operations are never swapped in software. Otoh values that raw
* Raw operations are never swapped in software. OTOH values that raw
* operations are working on may or may not have been swapped by the bus
* hardware. An example use would be for flash memory that's used for
* execute in place.
......@@ -43,45 +43,53 @@
# define __raw_ioswabw(x) (x)
# define __raw_ioswabl(x) (x)
# define __raw_ioswabq(x) (x)
# define ____raw_ioswabq(x) (x)
/*
* Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
* less sane hardware forces software to fiddle with this...
*
* Regardless, if the host bus endianness mismatches that of PCI/ISA, then
* you can't have the numerical value of data and byte addresses within
* multibyte quantities both preserved at the same time. Hence two
* variations of functions: non-prefixed ones that preserve the value
* and prefixed ones that preserve byte addresses. The latters are
* typically used for moving raw data between a peripheral and memory (cf.
* string I/O functions), hence the "mem_" prefix.
*/
#if defined(CONFIG_SWAP_IO_SPACE)
# define ioswabb(x) (x)
# define mem_ioswabb(x) (x)
# ifdef CONFIG_SGI_IP22
/*
* IP22 seems braindead enough to swap 16bits values in hardware, but
* not 32bits. Go figure... Can't tell without documentation.
*/
# define ioswabw(x) (x)
# define mem_ioswabw(x) le16_to_cpu(x)
# else
# define ioswabw(x) le16_to_cpu(x)
# define mem_ioswabw(x) (x)
# endif
# define ioswabl(x) le32_to_cpu(x)
# define mem_ioswabl(x) (x)
# define ioswabq(x) le64_to_cpu(x)
# define mem_ioswabq(x) (x)
#else
# define ioswabb(x) (x)
# define mem_ioswabb(x) (x)
# define ioswabw(x) (x)
# define mem_ioswabw(x) cpu_to_le16(x)
# define ioswabl(x) (x)
# define mem_ioswabl(x) cpu_to_le32(x)
# define ioswabq(x) (x)
# define mem_ioswabq(x) cpu_to_le32(x)
#endif
/*
* Native bus accesses never swapped.
*/
#define bus_ioswabb(x) (x)
#define bus_ioswabw(x) (x)
#define bus_ioswabl(x) (x)
#define bus_ioswabq(x) (x)
#define __bus_ioswabq bus_ioswabq
#define IO_SPACE_LIMIT 0xffff
/*
......@@ -388,15 +396,15 @@ __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
#define BUILDIO(bwlq, type) \
\
__BUILD_MEMORY_PFX(, bwlq, type) \
__BUILD_MEMORY_PFX(__raw_, bwlq, type) \
__BUILD_MEMORY_PFX(bus_, bwlq, type) \
__BUILD_MEMORY_PFX(, bwlq, type) \
__BUILD_MEMORY_PFX(mem_, bwlq, type) \
__BUILD_IOPORT_PFX(, bwlq, type) \
__BUILD_IOPORT_PFX(__raw_, bwlq, type)
__BUILD_IOPORT_PFX(mem_, bwlq, type)
#define __BUILDIO(bwlq, type) \
\
__BUILD_MEMORY_SINGLE(__bus_, bwlq, type, 0)
__BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0)
BUILDIO(b, u8)
BUILDIO(w, u16)
......@@ -424,7 +432,7 @@ static inline void writes##bwlq(volatile void __iomem *mem, void *addr, \
volatile type *__addr = addr; \
\
while (count--) { \
__raw_write##bwlq(*__addr, mem); \
mem_write##bwlq(*__addr, mem); \
__addr++; \
} \
} \
......@@ -435,7 +443,7 @@ static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
volatile type *__addr = addr; \
\
while (count--) { \
*__addr = __raw_read##bwlq(mem); \
*__addr = mem_read##bwlq(mem); \
__addr++; \
} \
}
......@@ -448,7 +456,7 @@ static inline void outs##bwlq(unsigned long port, void *addr, \
volatile type *__addr = addr; \
\
while (count--) { \
__raw_out##bwlq(*__addr, port); \
mem_out##bwlq(*__addr, port); \
__addr++; \
} \
} \
......@@ -459,7 +467,7 @@ static inline void ins##bwlq(unsigned long port, void *addr, \
volatile type *__addr = addr; \
\
while (count--) { \
*__addr = __raw_in##bwlq(port); \
*__addr = mem_in##bwlq(port); \
__addr++; \
} \
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment