diff options
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/ftrace.h | 16 | ||||
-rw-r--r-- | include/asm-generic/io.h | 33 | ||||
-rw-r--r-- | include/asm-generic/sizes.h | 47 | ||||
-rw-r--r-- | include/asm-generic/uaccess.h | 8 |
4 files changed, 87 insertions, 17 deletions
diff --git a/include/asm-generic/ftrace.h b/include/asm-generic/ftrace.h new file mode 100644 index 000000000000..51abba9ea7ad --- /dev/null +++ b/include/asm-generic/ftrace.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * linux/include/asm-generic/ftrace.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_GENERIC_FTRACE_H__ | ||
9 | #define __ASM_GENERIC_FTRACE_H__ | ||
10 | |||
11 | /* | ||
12 | * Not all architectures need their own ftrace.h, the most | ||
13 | * common definitions are already in linux/ftrace.h. | ||
14 | */ | ||
15 | |||
16 | #endif /* __ASM_GENERIC_FTRACE_H__ */ | ||
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 4644c9a7f724..e0ffa3ddb02a 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h | |||
@@ -94,6 +94,10 @@ static inline void __raw_writeq(u64 b, volatile void __iomem *addr) | |||
94 | #define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr) | 94 | #define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr) |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | #ifndef PCI_IOBASE | ||
98 | #define PCI_IOBASE ((void __iomem *) 0) | ||
99 | #endif | ||
100 | |||
97 | /*****************************************************************************/ | 101 | /*****************************************************************************/ |
98 | /* | 102 | /* |
99 | * traditional input/output functions | 103 | * traditional input/output functions |
@@ -101,32 +105,32 @@ static inline void __raw_writeq(u64 b, volatile void __iomem *addr) | |||
101 | 105 | ||
102 | static inline u8 inb(unsigned long addr) | 106 | static inline u8 inb(unsigned long addr) |
103 | { | 107 | { |
104 | return readb((volatile void __iomem *) addr); | 108 | return readb(addr + PCI_IOBASE); |
105 | } | 109 | } |
106 | 110 | ||
107 | static inline u16 inw(unsigned long addr) | 111 | static inline u16 inw(unsigned long addr) |
108 | { | 112 | { |
109 | return readw((volatile void __iomem *) addr); | 113 | return readw(addr + PCI_IOBASE); |
110 | } | 114 | } |
111 | 115 | ||
112 | static inline u32 inl(unsigned long addr) | 116 | static inline u32 inl(unsigned long addr) |
113 | { | 117 | { |
114 | return readl((volatile void __iomem *) addr); | 118 | return readl(addr + PCI_IOBASE); |
115 | } | 119 | } |
116 | 120 | ||
117 | static inline void outb(u8 b, unsigned long addr) | 121 | static inline void outb(u8 b, unsigned long addr) |
118 | { | 122 | { |
119 | writeb(b, (volatile void __iomem *) addr); | 123 | writeb(b, addr + PCI_IOBASE); |
120 | } | 124 | } |
121 | 125 | ||
122 | static inline void outw(u16 b, unsigned long addr) | 126 | static inline void outw(u16 b, unsigned long addr) |
123 | { | 127 | { |
124 | writew(b, (volatile void __iomem *) addr); | 128 | writew(b, addr + PCI_IOBASE); |
125 | } | 129 | } |
126 | 130 | ||
127 | static inline void outl(u32 b, unsigned long addr) | 131 | static inline void outl(u32 b, unsigned long addr) |
128 | { | 132 | { |
129 | writel(b, (volatile void __iomem *) addr); | 133 | writel(b, addr + PCI_IOBASE); |
130 | } | 134 | } |
131 | 135 | ||
132 | #define inb_p(addr) inb(addr) | 136 | #define inb_p(addr) inb(addr) |
@@ -213,32 +217,32 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) | |||
213 | 217 | ||
214 | static inline void readsl(const void __iomem *addr, void *buf, int len) | 218 | static inline void readsl(const void __iomem *addr, void *buf, int len) |
215 | { | 219 | { |
216 | insl((unsigned long)addr, buf, len); | 220 | insl(addr - PCI_IOBASE, buf, len); |
217 | } | 221 | } |
218 | 222 | ||
219 | static inline void readsw(const void __iomem *addr, void *buf, int len) | 223 | static inline void readsw(const void __iomem *addr, void *buf, int len) |
220 | { | 224 | { |
221 | insw((unsigned long)addr, buf, len); | 225 | insw(addr - PCI_IOBASE, buf, len); |
222 | } | 226 | } |
223 | 227 | ||
224 | static inline void readsb(const void __iomem *addr, void *buf, int len) | 228 | static inline void readsb(const void __iomem *addr, void *buf, int len) |
225 | { | 229 | { |
226 | insb((unsigned long)addr, buf, len); | 230 | insb(addr - PCI_IOBASE, buf, len); |
227 | } | 231 | } |
228 | 232 | ||
229 | static inline void writesl(const void __iomem *addr, const void *buf, int len) | 233 | static inline void writesl(const void __iomem *addr, const void *buf, int len) |
230 | { | 234 | { |
231 | outsl((unsigned long)addr, buf, len); | 235 | outsl(addr - PCI_IOBASE, buf, len); |
232 | } | 236 | } |
233 | 237 | ||
234 | static inline void writesw(const void __iomem *addr, const void *buf, int len) | 238 | static inline void writesw(const void __iomem *addr, const void *buf, int len) |
235 | { | 239 | { |
236 | outsw((unsigned long)addr, buf, len); | 240 | outsw(addr - PCI_IOBASE, buf, len); |
237 | } | 241 | } |
238 | 242 | ||
239 | static inline void writesb(const void __iomem *addr, const void *buf, int len) | 243 | static inline void writesb(const void __iomem *addr, const void *buf, int len) |
240 | { | 244 | { |
241 | outsb((unsigned long)addr, buf, len); | 245 | outsb(addr - PCI_IOBASE, buf, len); |
242 | } | 246 | } |
243 | 247 | ||
244 | #ifndef CONFIG_GENERIC_IOMAP | 248 | #ifndef CONFIG_GENERIC_IOMAP |
@@ -269,8 +273,9 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len) | |||
269 | outsl((unsigned long) (p), (src), (count)) | 273 | outsl((unsigned long) (p), (src), (count)) |
270 | #endif /* CONFIG_GENERIC_IOMAP */ | 274 | #endif /* CONFIG_GENERIC_IOMAP */ |
271 | 275 | ||
272 | 276 | #ifndef IO_SPACE_LIMIT | |
273 | #define IO_SPACE_LIMIT 0xffffffff | 277 | #define IO_SPACE_LIMIT 0xffff |
278 | #endif | ||
274 | 279 | ||
275 | #ifdef __KERNEL__ | 280 | #ifdef __KERNEL__ |
276 | 281 | ||
diff --git a/include/asm-generic/sizes.h b/include/asm-generic/sizes.h new file mode 100644 index 000000000000..ea5d4ef81061 --- /dev/null +++ b/include/asm-generic/sizes.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * linux/include/asm-generic/sizes.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_GENERIC_SIZES_H__ | ||
9 | #define __ASM_GENERIC_SIZES_H__ | ||
10 | |||
11 | #define SZ_1 0x00000001 | ||
12 | #define SZ_2 0x00000002 | ||
13 | #define SZ_4 0x00000004 | ||
14 | #define SZ_8 0x00000008 | ||
15 | #define SZ_16 0x00000010 | ||
16 | #define SZ_32 0x00000020 | ||
17 | #define SZ_64 0x00000040 | ||
18 | #define SZ_128 0x00000080 | ||
19 | #define SZ_256 0x00000100 | ||
20 | #define SZ_512 0x00000200 | ||
21 | |||
22 | #define SZ_1K 0x00000400 | ||
23 | #define SZ_2K 0x00000800 | ||
24 | #define SZ_4K 0x00001000 | ||
25 | #define SZ_8K 0x00002000 | ||
26 | #define SZ_16K 0x00004000 | ||
27 | #define SZ_32K 0x00008000 | ||
28 | #define SZ_64K 0x00010000 | ||
29 | #define SZ_128K 0x00020000 | ||
30 | #define SZ_256K 0x00040000 | ||
31 | #define SZ_512K 0x00080000 | ||
32 | |||
33 | #define SZ_1M 0x00100000 | ||
34 | #define SZ_2M 0x00200000 | ||
35 | #define SZ_4M 0x00400000 | ||
36 | #define SZ_8M 0x00800000 | ||
37 | #define SZ_16M 0x01000000 | ||
38 | #define SZ_32M 0x02000000 | ||
39 | #define SZ_64M 0x04000000 | ||
40 | #define SZ_128M 0x08000000 | ||
41 | #define SZ_256M 0x10000000 | ||
42 | #define SZ_512M 0x20000000 | ||
43 | |||
44 | #define SZ_1G 0x40000000 | ||
45 | #define SZ_2G 0x80000000 | ||
46 | |||
47 | #endif /* __ASM_GENERIC_SIZES_H__ */ | ||
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index b218b8513d04..ac68c999b6c2 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h | |||
@@ -288,14 +288,16 @@ strncpy_from_user(char *dst, const char __user *src, long count) | |||
288 | * | 288 | * |
289 | * Return 0 on exception, a value greater than N if too long | 289 | * Return 0 on exception, a value greater than N if too long |
290 | */ | 290 | */ |
291 | #ifndef strnlen_user | 291 | #ifndef __strnlen_user |
292 | #define __strnlen_user strnlen | ||
293 | #endif | ||
294 | |||
292 | static inline long strnlen_user(const char __user *src, long n) | 295 | static inline long strnlen_user(const char __user *src, long n) |
293 | { | 296 | { |
294 | if (!access_ok(VERIFY_READ, src, 1)) | 297 | if (!access_ok(VERIFY_READ, src, 1)) |
295 | return 0; | 298 | return 0; |
296 | return strlen((void * __force)src) + 1; | 299 | return __strnlen_user(src, n); |
297 | } | 300 | } |
298 | #endif | ||
299 | 301 | ||
300 | static inline long strlen_user(const char __user *src) | 302 | static inline long strlen_user(const char __user *src) |
301 | { | 303 | { |