1
2
3
4
5
6
7
8#ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
9#define __ASM_MACH_GENERIC_MANGLE_PORT_H
10
11#include <asm/byteorder.h>
12
13#ifdef __BIG_ENDIAN
14
15# define __swizzle_addr_b(port) (port)
16# define __swizzle_addr_w(port) (port)
17# define __swizzle_addr_l(port) (port)
18# define __swizzle_addr_q(port) (port)
19
20#else
21
22static inline bool __should_swizzle_addr(unsigned long p)
23{
24
25 return ((p >> 40) & 0xff) == 0;
26}
27
28# define __swizzle_addr_b(port) \
29 (__should_swizzle_addr(port) ? (port) ^ 7 : (port))
30# define __swizzle_addr_w(port) \
31 (__should_swizzle_addr(port) ? (port) ^ 6 : (port))
32# define __swizzle_addr_l(port) \
33 (__should_swizzle_addr(port) ? (port) ^ 4 : (port))
34# define __swizzle_addr_q(port) (port)
35
36#endif
37
38
39
40
41
42
43
44
45
46
47
48
49
50#if defined(CONFIG_SWAP_IO_SPACE)
51
52# define ioswabb(a, x) (x)
53# define __mem_ioswabb(a, x) (x)
54# define ioswabw(a, x) le16_to_cpu(x)
55# define __mem_ioswabw(a, x) (x)
56# define ioswabl(a, x) le32_to_cpu(x)
57# define __mem_ioswabl(a, x) (x)
58# define ioswabq(a, x) le64_to_cpu(x)
59# define __mem_ioswabq(a, x) (x)
60
61#else
62
63# define ioswabb(a, x) (x)
64# define __mem_ioswabb(a, x) (x)
65# define ioswabw(a, x) (x)
66# define __mem_ioswabw(a, x) cpu_to_le16(x)
67# define ioswabl(a, x) (x)
68# define __mem_ioswabl(a, x) cpu_to_le32(x)
69# define ioswabq(a, x) (x)
70# define __mem_ioswabq(a, x) cpu_to_le32(x)
71
72#endif
73
74#endif
75