diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-01 12:51:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-01 12:51:51 -0400 |
commit | 0242909a6135e10a28822c64f9ad50fdad52757c (patch) | |
tree | c5f9c8abe95a65433e6ac356871f2379c02488fe /arch/cris/include/asm | |
parent | 0a6d2fac615972142715d736289abeeb7382e81d (diff) | |
parent | 556dcee7b829e5c350c3ffdbdb87a8b15aa3c5d3 (diff) |
Merge branch 'cris_move' of git://www.jni.nu/cris
* 'cris_move' of git://www.jni.nu/cris:
[CRIS] Move header files from include to arch/cris/include.
[CRISv32] Remove warning in io.h
Diffstat (limited to 'arch/cris/include/asm')
92 files changed, 4731 insertions, 0 deletions
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild new file mode 100644 index 000000000000..d5b631935ec8 --- /dev/null +++ b/arch/cris/include/asm/Kbuild | |||
@@ -0,0 +1,11 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | |||
3 | header-y += arch-v10/ | ||
4 | header-y += arch-v32/ | ||
5 | |||
6 | header-y += ethernet.h | ||
7 | header-y += rtc.h | ||
8 | header-y += sync_serial.h | ||
9 | |||
10 | unifdef-y += etraxgpio.h | ||
11 | unifdef-y += rs485.h | ||
diff --git a/arch/cris/include/asm/atomic.h b/arch/cris/include/asm/atomic.h new file mode 100644 index 000000000000..f71ea686a2ea --- /dev/null +++ b/arch/cris/include/asm/atomic.h | |||
@@ -0,0 +1,164 @@ | |||
1 | /* $Id: atomic.h,v 1.3 2001/07/25 16:15:19 bjornw Exp $ */ | ||
2 | |||
3 | #ifndef __ASM_CRIS_ATOMIC__ | ||
4 | #define __ASM_CRIS_ATOMIC__ | ||
5 | |||
6 | #include <linux/compiler.h> | ||
7 | |||
8 | #include <asm/system.h> | ||
9 | #include <arch/atomic.h> | ||
10 | |||
11 | /* | ||
12 | * Atomic operations that C can't guarantee us. Useful for | ||
13 | * resource counting etc.. | ||
14 | */ | ||
15 | |||
16 | typedef struct { volatile int counter; } atomic_t; | ||
17 | |||
18 | #define ATOMIC_INIT(i) { (i) } | ||
19 | |||
20 | #define atomic_read(v) ((v)->counter) | ||
21 | #define atomic_set(v,i) (((v)->counter) = (i)) | ||
22 | |||
23 | /* These should be written in asm but we do it in C for now. */ | ||
24 | |||
25 | static inline void atomic_add(int i, volatile atomic_t *v) | ||
26 | { | ||
27 | unsigned long flags; | ||
28 | cris_atomic_save(v, flags); | ||
29 | v->counter += i; | ||
30 | cris_atomic_restore(v, flags); | ||
31 | } | ||
32 | |||
33 | static inline void atomic_sub(int i, volatile atomic_t *v) | ||
34 | { | ||
35 | unsigned long flags; | ||
36 | cris_atomic_save(v, flags); | ||
37 | v->counter -= i; | ||
38 | cris_atomic_restore(v, flags); | ||
39 | } | ||
40 | |||
41 | static inline int atomic_add_return(int i, volatile atomic_t *v) | ||
42 | { | ||
43 | unsigned long flags; | ||
44 | int retval; | ||
45 | cris_atomic_save(v, flags); | ||
46 | retval = (v->counter += i); | ||
47 | cris_atomic_restore(v, flags); | ||
48 | return retval; | ||
49 | } | ||
50 | |||
51 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | ||
52 | |||
53 | static inline int atomic_sub_return(int i, volatile atomic_t *v) | ||
54 | { | ||
55 | unsigned long flags; | ||
56 | int retval; | ||
57 | cris_atomic_save(v, flags); | ||
58 | retval = (v->counter -= i); | ||
59 | cris_atomic_restore(v, flags); | ||
60 | return retval; | ||
61 | } | ||
62 | |||
63 | static inline int atomic_sub_and_test(int i, volatile atomic_t *v) | ||
64 | { | ||
65 | int retval; | ||
66 | unsigned long flags; | ||
67 | cris_atomic_save(v, flags); | ||
68 | retval = (v->counter -= i) == 0; | ||
69 | cris_atomic_restore(v, flags); | ||
70 | return retval; | ||
71 | } | ||
72 | |||
73 | static inline void atomic_inc(volatile atomic_t *v) | ||
74 | { | ||
75 | unsigned long flags; | ||
76 | cris_atomic_save(v, flags); | ||
77 | (v->counter)++; | ||
78 | cris_atomic_restore(v, flags); | ||
79 | } | ||
80 | |||
81 | static inline void atomic_dec(volatile atomic_t *v) | ||
82 | { | ||
83 | unsigned long flags; | ||
84 | cris_atomic_save(v, flags); | ||
85 | (v->counter)--; | ||
86 | cris_atomic_restore(v, flags); | ||
87 | } | ||
88 | |||
89 | static inline int atomic_inc_return(volatile atomic_t *v) | ||
90 | { | ||
91 | unsigned long flags; | ||
92 | int retval; | ||
93 | cris_atomic_save(v, flags); | ||
94 | retval = ++(v->counter); | ||
95 | cris_atomic_restore(v, flags); | ||
96 | return retval; | ||
97 | } | ||
98 | |||
99 | static inline int atomic_dec_return(volatile atomic_t *v) | ||
100 | { | ||
101 | unsigned long flags; | ||
102 | int retval; | ||
103 | cris_atomic_save(v, flags); | ||
104 | retval = --(v->counter); | ||
105 | cris_atomic_restore(v, flags); | ||
106 | return retval; | ||
107 | } | ||
108 | static inline int atomic_dec_and_test(volatile atomic_t *v) | ||
109 | { | ||
110 | int retval; | ||
111 | unsigned long flags; | ||
112 | cris_atomic_save(v, flags); | ||
113 | retval = --(v->counter) == 0; | ||
114 | cris_atomic_restore(v, flags); | ||
115 | return retval; | ||
116 | } | ||
117 | |||
118 | static inline int atomic_inc_and_test(volatile atomic_t *v) | ||
119 | { | ||
120 | int retval; | ||
121 | unsigned long flags; | ||
122 | cris_atomic_save(v, flags); | ||
123 | retval = ++(v->counter) == 0; | ||
124 | cris_atomic_restore(v, flags); | ||
125 | return retval; | ||
126 | } | ||
127 | |||
128 | static inline int atomic_cmpxchg(atomic_t *v, int old, int new) | ||
129 | { | ||
130 | int ret; | ||
131 | unsigned long flags; | ||
132 | |||
133 | cris_atomic_save(v, flags); | ||
134 | ret = v->counter; | ||
135 | if (likely(ret == old)) | ||
136 | v->counter = new; | ||
137 | cris_atomic_restore(v, flags); | ||
138 | return ret; | ||
139 | } | ||
140 | |||
141 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | ||
142 | |||
143 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | ||
144 | { | ||
145 | int ret; | ||
146 | unsigned long flags; | ||
147 | |||
148 | cris_atomic_save(v, flags); | ||
149 | ret = v->counter; | ||
150 | if (ret != u) | ||
151 | v->counter += a; | ||
152 | cris_atomic_restore(v, flags); | ||
153 | return ret != u; | ||
154 | } | ||
155 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | ||
156 | |||
157 | /* Atomic operations are already serializing */ | ||
158 | #define smp_mb__before_atomic_dec() barrier() | ||
159 | #define smp_mb__after_atomic_dec() barrier() | ||
160 | #define smp_mb__before_atomic_inc() barrier() | ||
161 | #define smp_mb__after_atomic_inc() barrier() | ||
162 | |||
163 | #include <asm-generic/atomic.h> | ||
164 | #endif | ||
diff --git a/arch/cris/include/asm/auxvec.h b/arch/cris/include/asm/auxvec.h new file mode 100644 index 000000000000..cb30b01bf19f --- /dev/null +++ b/arch/cris/include/asm/auxvec.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __ASMCRIS_AUXVEC_H | ||
2 | #define __ASMCRIS_AUXVEC_H | ||
3 | |||
4 | #endif | ||
diff --git a/arch/cris/include/asm/axisflashmap.h b/arch/cris/include/asm/axisflashmap.h new file mode 100644 index 000000000000..015ca5445ddd --- /dev/null +++ b/arch/cris/include/asm/axisflashmap.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef __ASM_AXISFLASHMAP_H | ||
2 | #define __ASM_AXISFLASHMAP_H | ||
3 | |||
4 | /* Bootblock parameters are stored at 0xc000 and has the FLASH_BOOT_MAGIC | ||
5 | * as start, it ends with 0xFFFFFFFF */ | ||
6 | #define FLASH_BOOT_MAGIC 0xbeefcace | ||
7 | #define BOOTPARAM_OFFSET 0xc000 | ||
8 | /* apps/bootblocktool is used to read and write the parameters, | ||
9 | * and it has nothing to do with the partition table. | ||
10 | */ | ||
11 | |||
12 | #define PARTITION_TABLE_OFFSET 10 | ||
13 | #define PARTITION_TABLE_MAGIC 0xbeef /* Not a good magic */ | ||
14 | |||
15 | /* The partitiontable_head is located at offset +10: */ | ||
16 | struct partitiontable_head { | ||
17 | __u16 magic; /* PARTITION_TABLE_MAGIC */ | ||
18 | __u16 size; /* Length of ptable block (entries + end marker) */ | ||
19 | __u32 checksum; /* simple longword sum, over entries + end marker */ | ||
20 | }; | ||
21 | |||
22 | /* And followed by partition table entries */ | ||
23 | struct partitiontable_entry { | ||
24 | __u32 offset; /* relative to the sector the ptable is in */ | ||
25 | __u32 size; /* in bytes */ | ||
26 | __u32 checksum; /* simple longword sum */ | ||
27 | __u16 type; /* see type codes below */ | ||
28 | __u16 flags; /* bit 0: ro/rw = 1/0 */ | ||
29 | __u32 future0; /* 16 bytes reserved for future use */ | ||
30 | __u32 future1; | ||
31 | __u32 future2; | ||
32 | __u32 future3; | ||
33 | }; | ||
34 | /* ended by an end marker: */ | ||
35 | #define PARTITIONTABLE_END_MARKER 0xFFFFFFFF | ||
36 | #define PARTITIONTABLE_END_MARKER_SIZE 4 | ||
37 | |||
38 | #define PARTITIONTABLE_END_PAD 10 | ||
39 | |||
40 | /* Complete structure for whole partition table */ | ||
41 | /* note that table may end before CONFIG_ETRAX_PTABLE_ENTRIES by setting | ||
42 | * offset of the last entry + 1 to PARTITIONTABLE_END_MARKER. | ||
43 | */ | ||
44 | struct partitiontable { | ||
45 | __u8 skip[PARTITION_TABLE_OFFSET]; | ||
46 | struct partitiontable_head head; | ||
47 | struct partitiontable_entry entries[]; | ||
48 | }; | ||
49 | |||
50 | #define PARTITION_TYPE_PARAM 0x0001 | ||
51 | #define PARTITION_TYPE_KERNEL 0x0002 | ||
52 | #define PARTITION_TYPE_JFFS 0x0003 | ||
53 | #define PARTITION_TYPE_JFFS2 0x0000 | ||
54 | |||
55 | #define PARTITION_FLAGS_READONLY_MASK 0x0001 | ||
56 | #define PARTITION_FLAGS_READONLY 0x0001 | ||
57 | |||
58 | /* The master mtd for the entire flash. */ | ||
59 | extern struct mtd_info *axisflash_mtd; | ||
60 | |||
61 | #endif | ||
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h new file mode 100644 index 000000000000..c0e62f811e09 --- /dev/null +++ b/arch/cris/include/asm/bitops.h | |||
@@ -0,0 +1,166 @@ | |||
1 | /* asm/bitops.h for Linux/CRIS | ||
2 | * | ||
3 | * TODO: asm versions if speed is needed | ||
4 | * | ||
5 | * All bit operations return 0 if the bit was cleared before the | ||
6 | * operation and != 0 if it was not. | ||
7 | * | ||
8 | * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). | ||
9 | */ | ||
10 | |||
11 | #ifndef _CRIS_BITOPS_H | ||
12 | #define _CRIS_BITOPS_H | ||
13 | |||
14 | /* Currently this is unsuitable for consumption outside the kernel. */ | ||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #ifndef _LINUX_BITOPS_H | ||
18 | #error only <linux/bitops.h> can be included directly | ||
19 | #endif | ||
20 | |||
21 | #include <arch/bitops.h> | ||
22 | #include <asm/system.h> | ||
23 | #include <asm/atomic.h> | ||
24 | #include <linux/compiler.h> | ||
25 | |||
26 | /* | ||
27 | * set_bit - Atomically set a bit in memory | ||
28 | * @nr: the bit to set | ||
29 | * @addr: the address to start counting from | ||
30 | * | ||
31 | * This function is atomic and may not be reordered. See __set_bit() | ||
32 | * if you do not require the atomic guarantees. | ||
33 | * Note that @nr may be almost arbitrarily large; this function is not | ||
34 | * restricted to acting on a single-word quantity. | ||
35 | */ | ||
36 | |||
37 | #define set_bit(nr, addr) (void)test_and_set_bit(nr, addr) | ||
38 | |||
39 | /* | ||
40 | * clear_bit - Clears a bit in memory | ||
41 | * @nr: Bit to clear | ||
42 | * @addr: Address to start counting from | ||
43 | * | ||
44 | * clear_bit() is atomic and may not be reordered. However, it does | ||
45 | * not contain a memory barrier, so if it is used for locking purposes, | ||
46 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | ||
47 | * in order to ensure changes are visible on other processors. | ||
48 | */ | ||
49 | |||
50 | #define clear_bit(nr, addr) (void)test_and_clear_bit(nr, addr) | ||
51 | |||
52 | /* | ||
53 | * change_bit - Toggle a bit in memory | ||
54 | * @nr: Bit to change | ||
55 | * @addr: Address to start counting from | ||
56 | * | ||
57 | * change_bit() is atomic and may not be reordered. | ||
58 | * Note that @nr may be almost arbitrarily large; this function is not | ||
59 | * restricted to acting on a single-word quantity. | ||
60 | */ | ||
61 | |||
62 | #define change_bit(nr, addr) (void)test_and_change_bit(nr, addr) | ||
63 | |||
64 | /** | ||
65 | * test_and_set_bit - Set a bit and return its old value | ||
66 | * @nr: Bit to set | ||
67 | * @addr: Address to count from | ||
68 | * | ||
69 | * This operation is atomic and cannot be reordered. | ||
70 | * It also implies a memory barrier. | ||
71 | */ | ||
72 | |||
73 | static inline int test_and_set_bit(int nr, volatile unsigned long *addr) | ||
74 | { | ||
75 | unsigned int mask, retval; | ||
76 | unsigned long flags; | ||
77 | unsigned int *adr = (unsigned int *)addr; | ||
78 | |||
79 | adr += nr >> 5; | ||
80 | mask = 1 << (nr & 0x1f); | ||
81 | cris_atomic_save(addr, flags); | ||
82 | retval = (mask & *adr) != 0; | ||
83 | *adr |= mask; | ||
84 | cris_atomic_restore(addr, flags); | ||
85 | return retval; | ||
86 | } | ||
87 | |||
88 | /* | ||
89 | * clear_bit() doesn't provide any barrier for the compiler. | ||
90 | */ | ||
91 | #define smp_mb__before_clear_bit() barrier() | ||
92 | #define smp_mb__after_clear_bit() barrier() | ||
93 | |||
94 | /** | ||
95 | * test_and_clear_bit - Clear a bit and return its old value | ||
96 | * @nr: Bit to clear | ||
97 | * @addr: Address to count from | ||
98 | * | ||
99 | * This operation is atomic and cannot be reordered. | ||
100 | * It also implies a memory barrier. | ||
101 | */ | ||
102 | |||
103 | static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) | ||
104 | { | ||
105 | unsigned int mask, retval; | ||
106 | unsigned long flags; | ||
107 | unsigned int *adr = (unsigned int *)addr; | ||
108 | |||
109 | adr += nr >> 5; | ||
110 | mask = 1 << (nr & 0x1f); | ||
111 | cris_atomic_save(addr, flags); | ||
112 | retval = (mask & *adr) != 0; | ||
113 | *adr &= ~mask; | ||
114 | cris_atomic_restore(addr, flags); | ||
115 | return retval; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * test_and_change_bit - Change a bit and return its old value | ||
120 | * @nr: Bit to change | ||
121 | * @addr: Address to count from | ||
122 | * | ||
123 | * This operation is atomic and cannot be reordered. | ||
124 | * It also implies a memory barrier. | ||
125 | */ | ||
126 | |||
127 | static inline int test_and_change_bit(int nr, volatile unsigned long *addr) | ||
128 | { | ||
129 | unsigned int mask, retval; | ||
130 | unsigned long flags; | ||
131 | unsigned int *adr = (unsigned int *)addr; | ||
132 | adr += nr >> 5; | ||
133 | mask = 1 << (nr & 0x1f); | ||
134 | cris_atomic_save(addr, flags); | ||
135 | retval = (mask & *adr) != 0; | ||
136 | *adr ^= mask; | ||
137 | cris_atomic_restore(addr, flags); | ||
138 | return retval; | ||
139 | } | ||
140 | |||
141 | #include <asm-generic/bitops/non-atomic.h> | ||
142 | |||
143 | /* | ||
144 | * Since we define it "external", it collides with the built-in | ||
145 | * definition, which doesn't have the same semantics. We don't want to | ||
146 | * use -fno-builtin, so just hide the name ffs. | ||
147 | */ | ||
148 | #define ffs kernel_ffs | ||
149 | |||
150 | #include <asm-generic/bitops/fls.h> | ||
151 | #include <asm-generic/bitops/fls64.h> | ||
152 | #include <asm-generic/bitops/hweight.h> | ||
153 | #include <asm-generic/bitops/find.h> | ||
154 | #include <asm-generic/bitops/lock.h> | ||
155 | |||
156 | #include <asm-generic/bitops/ext2-non-atomic.h> | ||
157 | |||
158 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) | ||
159 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) | ||
160 | |||
161 | #include <asm-generic/bitops/minix.h> | ||
162 | #include <asm-generic/bitops/sched.h> | ||
163 | |||
164 | #endif /* __KERNEL__ */ | ||
165 | |||
166 | #endif /* _CRIS_BITOPS_H */ | ||
diff --git a/arch/cris/include/asm/bug.h b/arch/cris/include/asm/bug.h new file mode 100644 index 000000000000..3b3958963801 --- /dev/null +++ b/arch/cris/include/asm/bug.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _CRIS_BUG_H | ||
2 | #define _CRIS_BUG_H | ||
3 | #include <arch/bug.h> | ||
4 | #endif | ||
diff --git a/arch/cris/include/asm/bugs.h b/arch/cris/include/asm/bugs.h new file mode 100644 index 000000000000..c5907aac1007 --- /dev/null +++ b/arch/cris/include/asm/bugs.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* $Id: bugs.h,v 1.2 2001/01/17 17:03:18 bjornw Exp $ | ||
2 | * | ||
3 | * include/asm-cris/bugs.h | ||
4 | * | ||
5 | * Copyright (C) 2001 Axis Communications AB | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * This is included by init/main.c to check for architecture-dependent bugs. | ||
10 | * | ||
11 | * Needs: | ||
12 | * void check_bugs(void); | ||
13 | */ | ||
14 | |||
15 | static void check_bugs(void) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | |||
20 | |||
21 | |||
diff --git a/arch/cris/include/asm/byteorder.h b/arch/cris/include/asm/byteorder.h new file mode 100644 index 000000000000..cc8e418cfd14 --- /dev/null +++ b/arch/cris/include/asm/byteorder.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _CRIS_BYTEORDER_H | ||
2 | #define _CRIS_BYTEORDER_H | ||
3 | |||
4 | #ifdef __GNUC__ | ||
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | #include <arch/byteorder.h> | ||
8 | |||
9 | /* defines are necessary because the other files detect the presence | ||
10 | * of a defined __arch_swab32, not an inline | ||
11 | */ | ||
12 | #define __arch__swab32(x) ___arch__swab32(x) | ||
13 | #define __arch__swab16(x) ___arch__swab16(x) | ||
14 | #endif /* __KERNEL__ */ | ||
15 | |||
16 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
17 | # define __BYTEORDER_HAS_U64__ | ||
18 | # define __SWAB_64_THRU_32__ | ||
19 | #endif | ||
20 | |||
21 | #endif /* __GNUC__ */ | ||
22 | |||
23 | #include <linux/byteorder/little_endian.h> | ||
24 | |||
25 | #endif | ||
26 | |||
27 | |||
diff --git a/arch/cris/include/asm/cache.h b/arch/cris/include/asm/cache.h new file mode 100644 index 000000000000..a692b9fba8b9 --- /dev/null +++ b/arch/cris/include/asm/cache.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_CACHE_H | ||
2 | #define _ASM_CACHE_H | ||
3 | |||
4 | #include <arch/cache.h> | ||
5 | |||
6 | #endif /* _ASM_CACHE_H */ | ||
diff --git a/arch/cris/include/asm/cacheflush.h b/arch/cris/include/asm/cacheflush.h new file mode 100644 index 000000000000..cf60e3f69f8d --- /dev/null +++ b/arch/cris/include/asm/cacheflush.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _CRIS_CACHEFLUSH_H | ||
2 | #define _CRIS_CACHEFLUSH_H | ||
3 | |||
4 | /* Keep includes the same across arches. */ | ||
5 | #include <linux/mm.h> | ||
6 | |||
7 | /* The cache doesn't need to be flushed when TLB entries change because | ||
8 | * the cache is mapped to physical memory, not virtual memory | ||
9 | */ | ||
10 | #define flush_cache_all() do { } while (0) | ||
11 | #define flush_cache_mm(mm) do { } while (0) | ||
12 | #define flush_cache_dup_mm(mm) do { } while (0) | ||
13 | #define flush_cache_range(vma, start, end) do { } while (0) | ||
14 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | ||
15 | #define flush_dcache_page(page) do { } while (0) | ||
16 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
17 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
18 | #define flush_icache_range(start, end) do { } while (0) | ||
19 | #define flush_icache_page(vma,pg) do { } while (0) | ||
20 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) | ||
21 | #define flush_cache_vmap(start, end) do { } while (0) | ||
22 | #define flush_cache_vunmap(start, end) do { } while (0) | ||
23 | |||
24 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
25 | memcpy(dst, src, len) | ||
26 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
27 | memcpy(dst, src, len) | ||
28 | |||
29 | int change_page_attr(struct page *page, int numpages, pgprot_t prot); | ||
30 | |||
31 | #endif /* _CRIS_CACHEFLUSH_H */ | ||
diff --git a/arch/cris/include/asm/checksum.h b/arch/cris/include/asm/checksum.h new file mode 100644 index 000000000000..75dcb77d6cb0 --- /dev/null +++ b/arch/cris/include/asm/checksum.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* TODO: csum_tcpudp_magic could be speeded up, and csum_fold as well */ | ||
2 | |||
3 | #ifndef _CRIS_CHECKSUM_H | ||
4 | #define _CRIS_CHECKSUM_H | ||
5 | |||
6 | #include <arch/checksum.h> | ||
7 | |||
8 | /* | ||
9 | * computes the checksum of a memory block at buff, length len, | ||
10 | * and adds in "sum" (32-bit) | ||
11 | * | ||
12 | * returns a 32-bit number suitable for feeding into itself | ||
13 | * or csum_tcpudp_magic | ||
14 | * | ||
15 | * this function must be called with even lengths, except | ||
16 | * for the last fragment, which may be odd | ||
17 | * | ||
18 | * it's best to have buff aligned on a 32-bit boundary | ||
19 | */ | ||
20 | __wsum csum_partial(const void *buff, int len, __wsum sum); | ||
21 | |||
22 | /* | ||
23 | * the same as csum_partial, but copies from src while it | ||
24 | * checksums | ||
25 | * | ||
26 | * here even more important to align src and dst on a 32-bit (or even | ||
27 | * better 64-bit) boundary | ||
28 | */ | ||
29 | |||
30 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, | ||
31 | int len, __wsum sum); | ||
32 | |||
33 | /* | ||
34 | * Fold a partial checksum into a word | ||
35 | */ | ||
36 | |||
37 | static inline __sum16 csum_fold(__wsum csum) | ||
38 | { | ||
39 | u32 sum = (__force u32)csum; | ||
40 | sum = (sum & 0xffff) + (sum >> 16); /* add in end-around carry */ | ||
41 | sum = (sum & 0xffff) + (sum >> 16); /* add in end-around carry */ | ||
42 | return (__force __sum16)~sum; | ||
43 | } | ||
44 | |||
45 | extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | ||
46 | int len, __wsum sum, | ||
47 | int *errptr); | ||
48 | |||
49 | /* | ||
50 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
51 | * which always checksum on 4 octet boundaries. | ||
52 | * | ||
53 | */ | ||
54 | |||
55 | static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | ||
56 | { | ||
57 | return csum_fold(csum_partial(iph, ihl * 4, 0)); | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * computes the checksum of the TCP/UDP pseudo-header | ||
62 | * returns a 16-bit checksum, already complemented | ||
63 | */ | ||
64 | |||
65 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, | ||
66 | unsigned short len, | ||
67 | unsigned short proto, | ||
68 | __wsum sum) | ||
69 | { | ||
70 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
75 | * in icmp.c | ||
76 | */ | ||
77 | |||
78 | static inline __sum16 ip_compute_csum(const void *buff, int len) | ||
79 | { | ||
80 | return csum_fold (csum_partial(buff, len, 0)); | ||
81 | } | ||
82 | |||
83 | #endif | ||
diff --git a/arch/cris/include/asm/cputime.h b/arch/cris/include/asm/cputime.h new file mode 100644 index 000000000000..4446a65656fa --- /dev/null +++ b/arch/cris/include/asm/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __CRIS_CPUTIME_H | ||
2 | #define __CRIS_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __CRIS_CPUTIME_H */ | ||
diff --git a/arch/cris/include/asm/current.h b/arch/cris/include/asm/current.h new file mode 100644 index 000000000000..5f5c0efd00be --- /dev/null +++ b/arch/cris/include/asm/current.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _CRIS_CURRENT_H | ||
2 | #define _CRIS_CURRENT_H | ||
3 | |||
4 | #include <linux/thread_info.h> | ||
5 | |||
6 | struct task_struct; | ||
7 | |||
8 | static inline struct task_struct * get_current(void) | ||
9 | { | ||
10 | return current_thread_info()->task; | ||
11 | } | ||
12 | |||
13 | #define current get_current() | ||
14 | |||
15 | #endif /* !(_CRIS_CURRENT_H) */ | ||
diff --git a/arch/cris/include/asm/delay.h b/arch/cris/include/asm/delay.h new file mode 100644 index 000000000000..75ec581bfead --- /dev/null +++ b/arch/cris/include/asm/delay.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _CRIS_DELAY_H | ||
2 | #define _CRIS_DELAY_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 1998-2002 Axis Communications AB | ||
6 | * | ||
7 | * Delay routines, using a pre-computed "loops_per_second" value. | ||
8 | */ | ||
9 | |||
10 | #include <arch/delay.h> | ||
11 | |||
12 | /* Use only for very small delays ( < 1 msec). */ | ||
13 | |||
14 | extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */ | ||
15 | |||
16 | /* May be defined by arch/delay.h. */ | ||
17 | #ifndef udelay | ||
18 | static inline void udelay(unsigned long usecs) | ||
19 | { | ||
20 | __delay(usecs * loops_per_usec); | ||
21 | } | ||
22 | #endif | ||
23 | |||
24 | #endif /* defined(_CRIS_DELAY_H) */ | ||
25 | |||
26 | |||
27 | |||
diff --git a/arch/cris/include/asm/device.h b/arch/cris/include/asm/device.h new file mode 100644 index 000000000000..d8f9872b0e2d --- /dev/null +++ b/arch/cris/include/asm/device.h | |||
@@ -0,0 +1,7 @@ | |||
1 | /* | ||
2 | * Arch specific extensions to struct device | ||
3 | * | ||
4 | * This file is released under the GPLv2 | ||
5 | */ | ||
6 | #include <asm-generic/device.h> | ||
7 | |||
diff --git a/arch/cris/include/asm/div64.h b/arch/cris/include/asm/div64.h new file mode 100644 index 000000000000..6cd978cefb28 --- /dev/null +++ b/arch/cris/include/asm/div64.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/div64.h> | |||
diff --git a/arch/cris/include/asm/dma-mapping.h b/arch/cris/include/asm/dma-mapping.h new file mode 100644 index 000000000000..da8ef8e8f842 --- /dev/null +++ b/arch/cris/include/asm/dma-mapping.h | |||
@@ -0,0 +1,170 @@ | |||
1 | /* DMA mapping. Nothing tricky here, just virt_to_phys */ | ||
2 | |||
3 | #ifndef _ASM_CRIS_DMA_MAPPING_H | ||
4 | #define _ASM_CRIS_DMA_MAPPING_H | ||
5 | |||
6 | #include <linux/mm.h> | ||
7 | #include <linux/kernel.h> | ||
8 | |||
9 | #include <asm/cache.h> | ||
10 | #include <asm/io.h> | ||
11 | #include <asm/scatterlist.h> | ||
12 | |||
13 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
14 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
15 | |||
16 | #ifdef CONFIG_PCI | ||
17 | #include <asm-generic/dma-coherent.h> | ||
18 | |||
19 | void *dma_alloc_coherent(struct device *dev, size_t size, | ||
20 | dma_addr_t *dma_handle, gfp_t flag); | ||
21 | |||
22 | void dma_free_coherent(struct device *dev, size_t size, | ||
23 | void *vaddr, dma_addr_t dma_handle); | ||
24 | #else | ||
25 | static inline void * | ||
26 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | ||
27 | gfp_t flag) | ||
28 | { | ||
29 | BUG(); | ||
30 | return NULL; | ||
31 | } | ||
32 | |||
33 | static inline void | ||
34 | dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | ||
35 | dma_addr_t dma_handle) | ||
36 | { | ||
37 | BUG(); | ||
38 | } | ||
39 | #endif | ||
40 | static inline dma_addr_t | ||
41 | dma_map_single(struct device *dev, void *ptr, size_t size, | ||
42 | enum dma_data_direction direction) | ||
43 | { | ||
44 | BUG_ON(direction == DMA_NONE); | ||
45 | return virt_to_phys(ptr); | ||
46 | } | ||
47 | |||
48 | static inline void | ||
49 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
50 | enum dma_data_direction direction) | ||
51 | { | ||
52 | BUG_ON(direction == DMA_NONE); | ||
53 | } | ||
54 | |||
55 | static inline int | ||
56 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
57 | enum dma_data_direction direction) | ||
58 | { | ||
59 | printk("Map sg\n"); | ||
60 | return nents; | ||
61 | } | ||
62 | |||
63 | static inline dma_addr_t | ||
64 | dma_map_page(struct device *dev, struct page *page, unsigned long offset, | ||
65 | size_t size, enum dma_data_direction direction) | ||
66 | { | ||
67 | BUG_ON(direction == DMA_NONE); | ||
68 | return page_to_phys(page) + offset; | ||
69 | } | ||
70 | |||
71 | static inline void | ||
72 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
73 | enum dma_data_direction direction) | ||
74 | { | ||
75 | BUG_ON(direction == DMA_NONE); | ||
76 | } | ||
77 | |||
78 | |||
79 | static inline void | ||
80 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
81 | enum dma_data_direction direction) | ||
82 | { | ||
83 | BUG_ON(direction == DMA_NONE); | ||
84 | } | ||
85 | |||
86 | static inline void | ||
87 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
88 | enum dma_data_direction direction) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | static inline void | ||
93 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
94 | enum dma_data_direction direction) | ||
95 | { | ||
96 | } | ||
97 | |||
98 | static inline void | ||
99 | dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, | ||
100 | unsigned long offset, size_t size, | ||
101 | enum dma_data_direction direction) | ||
102 | { | ||
103 | } | ||
104 | |||
105 | static inline void | ||
106 | dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, | ||
107 | unsigned long offset, size_t size, | ||
108 | enum dma_data_direction direction) | ||
109 | { | ||
110 | } | ||
111 | |||
112 | static inline void | ||
113 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
114 | enum dma_data_direction direction) | ||
115 | { | ||
116 | } | ||
117 | |||
118 | static inline void | ||
119 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, | ||
120 | enum dma_data_direction direction) | ||
121 | { | ||
122 | } | ||
123 | |||
124 | static inline int | ||
125 | dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | ||
126 | { | ||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | static inline int | ||
131 | dma_supported(struct device *dev, u64 mask) | ||
132 | { | ||
133 | /* | ||
134 | * we fall back to GFP_DMA when the mask isn't all 1s, | ||
135 | * so we can't guarantee allocations that must be | ||
136 | * within a tighter range than GFP_DMA.. | ||
137 | */ | ||
138 | if(mask < 0x00ffffff) | ||
139 | return 0; | ||
140 | |||
141 | return 1; | ||
142 | } | ||
143 | |||
144 | static inline int | ||
145 | dma_set_mask(struct device *dev, u64 mask) | ||
146 | { | ||
147 | if(!dev->dma_mask || !dma_supported(dev, mask)) | ||
148 | return -EIO; | ||
149 | |||
150 | *dev->dma_mask = mask; | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | static inline int | ||
156 | dma_get_cache_alignment(void) | ||
157 | { | ||
158 | return (1 << INTERNODE_CACHE_SHIFT); | ||
159 | } | ||
160 | |||
161 | #define dma_is_consistent(d, h) (1) | ||
162 | |||
163 | static inline void | ||
164 | dma_cache_sync(struct device *dev, void *vaddr, size_t size, | ||
165 | enum dma_data_direction direction) | ||
166 | { | ||
167 | } | ||
168 | |||
169 | |||
170 | #endif | ||
diff --git a/arch/cris/include/asm/dma.h b/arch/cris/include/asm/dma.h new file mode 100644 index 000000000000..30fd715fa589 --- /dev/null +++ b/arch/cris/include/asm/dma.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* $Id: dma.h,v 1.2 2001/05/09 12:17:42 johana Exp $ */ | ||
2 | |||
3 | #ifndef _ASM_DMA_H | ||
4 | #define _ASM_DMA_H | ||
5 | |||
6 | #include <arch/dma.h> | ||
7 | |||
8 | /* it's useless on the Etrax, but unfortunately needed by the new | ||
9 | bootmem allocator (but this should do it for this) */ | ||
10 | |||
11 | #define MAX_DMA_ADDRESS PAGE_OFFSET | ||
12 | |||
13 | /* From PCI */ | ||
14 | |||
15 | #ifdef CONFIG_PCI | ||
16 | extern int isa_dma_bridge_buggy; | ||
17 | #else | ||
18 | #define isa_dma_bridge_buggy (0) | ||
19 | #endif | ||
20 | |||
21 | #endif /* _ASM_DMA_H */ | ||
diff --git a/arch/cris/include/asm/elf.h b/arch/cris/include/asm/elf.h new file mode 100644 index 000000000000..0f51b10b9f4f --- /dev/null +++ b/arch/cris/include/asm/elf.h | |||
@@ -0,0 +1,93 @@ | |||
1 | #ifndef __ASMCRIS_ELF_H | ||
2 | #define __ASMCRIS_ELF_H | ||
3 | |||
4 | /* | ||
5 | * ELF register definitions.. | ||
6 | */ | ||
7 | |||
8 | #include <asm/user.h> | ||
9 | |||
10 | #define R_CRIS_NONE 0 | ||
11 | #define R_CRIS_8 1 | ||
12 | #define R_CRIS_16 2 | ||
13 | #define R_CRIS_32 3 | ||
14 | #define R_CRIS_8_PCREL 4 | ||
15 | #define R_CRIS_16_PCREL 5 | ||
16 | #define R_CRIS_32_PCREL 6 | ||
17 | #define R_CRIS_GNU_VTINHERIT 7 | ||
18 | #define R_CRIS_GNU_VTENTRY 8 | ||
19 | #define R_CRIS_COPY 9 | ||
20 | #define R_CRIS_GLOB_DAT 10 | ||
21 | #define R_CRIS_JUMP_SLOT 11 | ||
22 | #define R_CRIS_RELATIVE 12 | ||
23 | #define R_CRIS_16_GOT 13 | ||
24 | #define R_CRIS_32_GOT 14 | ||
25 | #define R_CRIS_16_GOTPLT 15 | ||
26 | #define R_CRIS_32_GOTPLT 16 | ||
27 | #define R_CRIS_32_GOTREL 17 | ||
28 | #define R_CRIS_32_PLT_GOTREL 18 | ||
29 | #define R_CRIS_32_PLT_PCREL 19 | ||
30 | |||
31 | typedef unsigned long elf_greg_t; | ||
32 | |||
33 | /* Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is | ||
34 | thus exposed to user-space. */ | ||
35 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) | ||
36 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
37 | |||
38 | /* A placeholder; CRIS does not have any fp regs. */ | ||
39 | typedef unsigned long elf_fpregset_t; | ||
40 | |||
41 | /* | ||
42 | * These are used to set parameters in the core dumps. | ||
43 | */ | ||
44 | #define ELF_CLASS ELFCLASS32 | ||
45 | #define ELF_DATA ELFDATA2LSB | ||
46 | #define ELF_ARCH EM_CRIS | ||
47 | |||
48 | #include <arch/elf.h> | ||
49 | |||
50 | /* The master for these definitions is {binutils}/include/elf/cris.h: */ | ||
51 | /* User symbols in this file have a leading underscore. */ | ||
52 | #define EF_CRIS_UNDERSCORE 0x00000001 | ||
53 | |||
54 | /* This is a mask for different incompatible machine variants. */ | ||
55 | #define EF_CRIS_VARIANT_MASK 0x0000000e | ||
56 | |||
57 | /* Variant 0; may contain v0..10 object. */ | ||
58 | #define EF_CRIS_VARIANT_ANY_V0_V10 0x00000000 | ||
59 | |||
60 | /* Variant 1; contains v32 object. */ | ||
61 | #define EF_CRIS_VARIANT_V32 0x00000002 | ||
62 | |||
63 | /* Variant 2; contains object compatible with v32 and v10. */ | ||
64 | #define EF_CRIS_VARIANT_COMMON_V10_V32 0x00000004 | ||
65 | /* End of excerpt from {binutils}/include/elf/cris.h. */ | ||
66 | |||
67 | #define USE_ELF_CORE_DUMP | ||
68 | |||
69 | #define ELF_EXEC_PAGESIZE 8192 | ||
70 | |||
71 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
72 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
73 | the loader. We need to make sure that it is out of the way of the program | ||
74 | that it will "exec", and that there is sufficient room for the brk. */ | ||
75 | |||
76 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
77 | |||
78 | /* This yields a mask that user programs can use to figure out what | ||
79 | instruction set this CPU supports. This could be done in user space, | ||
80 | but it's not easy, and we've already done it here. */ | ||
81 | |||
82 | #define ELF_HWCAP (0) | ||
83 | |||
84 | /* This yields a string that ld.so will use to load implementation | ||
85 | specific libraries for optimization. This is more specific in | ||
86 | intent than poking at uname or /proc/cpuinfo. | ||
87 | */ | ||
88 | |||
89 | #define ELF_PLATFORM (NULL) | ||
90 | |||
91 | #define SET_PERSONALITY(ex) set_personality(PER_LINUX) | ||
92 | |||
93 | #endif | ||
diff --git a/arch/cris/include/asm/emergency-restart.h b/arch/cris/include/asm/emergency-restart.h new file mode 100644 index 000000000000..108d8c48e42e --- /dev/null +++ b/arch/cris/include/asm/emergency-restart.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_EMERGENCY_RESTART_H | ||
2 | #define _ASM_EMERGENCY_RESTART_H | ||
3 | |||
4 | #include <asm-generic/emergency-restart.h> | ||
5 | |||
6 | #endif /* _ASM_EMERGENCY_RESTART_H */ | ||
diff --git a/arch/cris/include/asm/errno.h b/arch/cris/include/asm/errno.h new file mode 100644 index 000000000000..2bf5eb5fa773 --- /dev/null +++ b/arch/cris/include/asm/errno.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _CRIS_ERRNO_H | ||
2 | #define _CRIS_ERRNO_H | ||
3 | |||
4 | #include <asm-generic/errno.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/cris/include/asm/eshlibld.h b/arch/cris/include/asm/eshlibld.h new file mode 100644 index 000000000000..10ce36cf79a9 --- /dev/null +++ b/arch/cris/include/asm/eshlibld.h | |||
@@ -0,0 +1,113 @@ | |||
1 | /*!************************************************************************** | ||
2 | *! | ||
3 | *! FILE NAME : eshlibld.h | ||
4 | *! | ||
5 | *! DESCRIPTION: Prototypes for exported shared library functions | ||
6 | *! | ||
7 | *! FUNCTIONS : perform_cris_aout_relocations, shlibmod_fork, shlibmod_exit | ||
8 | *! (EXPORTED) | ||
9 | *! | ||
10 | *!--------------------------------------------------------------------------- | ||
11 | *! | ||
12 | *! (C) Copyright 1998, 1999 Axis Communications AB, LUND, SWEDEN | ||
13 | *! | ||
14 | *!**************************************************************************/ | ||
15 | /* $Id: eshlibld.h,v 1.2 2001/02/23 13:47:33 bjornw Exp $ */ | ||
16 | |||
17 | #ifndef _cris_relocate_h | ||
18 | #define _cris_relocate_h | ||
19 | |||
20 | /* Please note that this file is also compiled into the xsim simulator. | ||
21 | Try to avoid breaking its double use (only works on a little-endian | ||
22 | 32-bit machine such as the i386 anyway). | ||
23 | |||
24 | Use __KERNEL__ when you're about to use kernel functions, | ||
25 | (which you should not do here anyway, since this file is | ||
26 | used by glibc). | ||
27 | Use defined(__KERNEL__) || defined(__elinux__) when doing | ||
28 | things that only makes sense on an elinux system. | ||
29 | Use __CRIS__ when you're about to do (really) CRIS-specific code. | ||
30 | */ | ||
31 | |||
32 | /* We have dependencies all over the place for the host system | ||
33 | for xsim being a linux system, so let's not pretend anything | ||
34 | else with #ifdef:s here until fixed. */ | ||
35 | #include <linux/limits.h> | ||
36 | |||
37 | /* Maybe do sanity checking if file input. */ | ||
38 | #undef SANITYCHECK_RELOC | ||
39 | |||
40 | /* Maybe output debug messages. */ | ||
41 | #undef RELOC_DEBUG | ||
42 | |||
43 | /* Maybe we want to share core as well as disk space. | ||
44 | Mainly depends on the config macro CONFIG_SHARE_SHLIB_CORE, but it is | ||
45 | assumed that we want to share code when debugging (exposes more | ||
46 | trouble). */ | ||
47 | #ifndef SHARE_LIB_CORE | ||
48 | # if (defined(__KERNEL__) || !defined(RELOC_DEBUG)) \ | ||
49 | && !defined(CONFIG_SHARE_SHLIB_CORE) | ||
50 | # define SHARE_LIB_CORE 0 | ||
51 | # else | ||
52 | # define SHARE_LIB_CORE 1 | ||
53 | # endif /* __KERNEL__ etc */ | ||
54 | #endif /* SHARE_LIB_CORE */ | ||
55 | |||
56 | |||
57 | /* Main exported function; supposed to be called when the program a.out | ||
58 | has been read in. */ | ||
59 | extern int | ||
60 | perform_cris_aout_relocations(unsigned long text, unsigned long tlength, | ||
61 | unsigned long data, unsigned long dlength, | ||
62 | unsigned long baddr, unsigned long blength, | ||
63 | |||
64 | /* These may be zero when there's "perfect" | ||
65 | position-independent code. */ | ||
66 | unsigned char *trel, unsigned long tsrel, | ||
67 | unsigned long dsrel, | ||
68 | |||
69 | /* These will be zero at a first try, to see | ||
70 | if code is statically linked. Else a | ||
71 | second try, with the symbol table and | ||
72 | string table nonzero should be done. */ | ||
73 | unsigned char *symbols, unsigned long symlength, | ||
74 | unsigned char *strings, unsigned long stringlength, | ||
75 | |||
76 | /* These will only be used when symbol table | ||
77 | information is present. */ | ||
78 | char **env, int envc, | ||
79 | int euid, int is_suid); | ||
80 | |||
81 | |||
82 | #ifdef RELOC_DEBUG | ||
83 | /* Task-specific debug stuff. */ | ||
84 | struct task_reloc_debug { | ||
85 | struct memdebug *alloclast; | ||
86 | unsigned long alloc_total; | ||
87 | unsigned long export_total; | ||
88 | }; | ||
89 | #endif /* RELOC_DEBUG */ | ||
90 | |||
91 | #if SHARE_LIB_CORE | ||
92 | |||
93 | /* When code (and some very specific data) is shared and not just | ||
94 | dynamically linked, we need to export hooks for exec beginning and | ||
95 | end. */ | ||
96 | |||
97 | struct shlibdep; | ||
98 | |||
99 | extern void | ||
100 | shlibmod_exit(struct shlibdep **deps); | ||
101 | |||
102 | /* Returns 0 if failure, nonzero for ok. */ | ||
103 | extern int | ||
104 | shlibmod_fork(struct shlibdep **deps); | ||
105 | |||
106 | #else /* ! SHARE_LIB_CORE */ | ||
107 | # define shlibmod_exit(x) | ||
108 | # define shlibmod_fork(x) 1 | ||
109 | #endif /* ! SHARE_LIB_CORE */ | ||
110 | |||
111 | #endif _cris_relocate_h | ||
112 | /********************** END OF FILE eshlibld.h *****************************/ | ||
113 | |||
diff --git a/arch/cris/include/asm/ethernet.h b/arch/cris/include/asm/ethernet.h new file mode 100644 index 000000000000..4d58652c3a49 --- /dev/null +++ b/arch/cris/include/asm/ethernet.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * ioctl defines for ethernet driver | ||
3 | * | ||
4 | * Copyright (c) 2001 Axis Communications AB | ||
5 | * | ||
6 | * Author: Mikael Starvik | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef _CRIS_ETHERNET_H | ||
11 | #define _CRIS_ETHERNET_H | ||
12 | #define SET_ETH_SPEED_AUTO SIOCDEVPRIVATE /* Auto neg speed */ | ||
13 | #define SET_ETH_SPEED_10 SIOCDEVPRIVATE+1 /* 10 Mbps */ | ||
14 | #define SET_ETH_SPEED_100 SIOCDEVPRIVATE+2 /* 100 Mbps. */ | ||
15 | #define SET_ETH_DUPLEX_AUTO SIOCDEVPRIVATE+3 /* Auto neg duplex */ | ||
16 | #define SET_ETH_DUPLEX_HALF SIOCDEVPRIVATE+4 /* Full duplex */ | ||
17 | #define SET_ETH_DUPLEX_FULL SIOCDEVPRIVATE+5 /* Half duplex */ | ||
18 | #define SET_ETH_ENABLE_LEDS SIOCDEVPRIVATE+6 /* Enable net LEDs */ | ||
19 | #define SET_ETH_DISABLE_LEDS SIOCDEVPRIVATE+7 /* Disable net LEDs */ | ||
20 | #define SET_ETH_AUTONEG SIOCDEVPRIVATE+8 | ||
21 | #endif /* _CRIS_ETHERNET_H */ | ||
diff --git a/arch/cris/include/asm/etraxgpio.h b/arch/cris/include/asm/etraxgpio.h new file mode 100644 index 000000000000..38f1c8e1770c --- /dev/null +++ b/arch/cris/include/asm/etraxgpio.h | |||
@@ -0,0 +1,179 @@ | |||
1 | /* | ||
2 | * The following devices are accessable using this driver using | ||
3 | * GPIO_MAJOR (120) and a couple of minor numbers. | ||
4 | * | ||
5 | * For ETRAX 100LX (CONFIG_ETRAX_ARCH_V10): | ||
6 | * /dev/gpioa minor 0, 8 bit GPIO, each bit can change direction | ||
7 | * /dev/gpiob minor 1, 8 bit GPIO, each bit can change direction | ||
8 | * /dev/leds minor 2, Access to leds depending on kernelconfig | ||
9 | * /dev/gpiog minor 3 | ||
10 | * g0dir, g8_15dir, g16_23dir, g24 dir configurable in R_GEN_CONFIG | ||
11 | * g1-g7 and g25-g31 is both input and outputs but on different pins | ||
12 | * Also note that some bits change pins depending on what interfaces | ||
13 | * are enabled. | ||
14 | * | ||
15 | * For ETRAX FS (CONFIG_ETRAXFS): | ||
16 | * /dev/gpioa minor 0, 8 bit GPIO, each bit can change direction | ||
17 | * /dev/gpiob minor 1, 18 bit GPIO, each bit can change direction | ||
18 | * /dev/gpioc minor 3, 18 bit GPIO, each bit can change direction | ||
19 | * /dev/gpiod minor 4, 18 bit GPIO, each bit can change direction | ||
20 | * /dev/gpioe minor 5, 18 bit GPIO, each bit can change direction | ||
21 | * /dev/leds minor 2, Access to leds depending on kernelconfig | ||
22 | * | ||
23 | * For ARTPEC-3 (CONFIG_CRIS_MACH_ARTPEC3): | ||
24 | * /dev/gpioa minor 0, 8 bit GPIO, each bit can change direction | ||
25 | * /dev/gpiob minor 1, 18 bit GPIO, each bit can change direction | ||
26 | * /dev/gpioc minor 3, 18 bit GPIO, each bit can change direction | ||
27 | * /dev/gpiod minor 4, 18 bit GPIO, each bit can change direction | ||
28 | * /dev/leds minor 2, Access to leds depending on kernelconfig | ||
29 | * /dev/pwm0 minor 16, PWM channel 0 on PA30 | ||
30 | * /dev/pwm1 minor 17, PWM channel 1 on PA31 | ||
31 | * /dev/pwm2 minor 18, PWM channel 2 on PB26 | ||
32 | * | ||
33 | */ | ||
34 | #ifndef _ASM_ETRAXGPIO_H | ||
35 | #define _ASM_ETRAXGPIO_H | ||
36 | |||
37 | /* etraxgpio _IOC_TYPE, bits 8 to 15 in ioctl cmd */ | ||
38 | #ifdef CONFIG_ETRAX_ARCH_V10 | ||
39 | #define ETRAXGPIO_IOCTYPE 43 | ||
40 | #define GPIO_MINOR_A 0 | ||
41 | #define GPIO_MINOR_B 1 | ||
42 | #define GPIO_MINOR_LEDS 2 | ||
43 | #define GPIO_MINOR_G 3 | ||
44 | #define GPIO_MINOR_LAST 3 | ||
45 | #endif | ||
46 | |||
47 | #ifdef CONFIG_ETRAXFS | ||
48 | #define ETRAXGPIO_IOCTYPE 43 | ||
49 | #define GPIO_MINOR_A 0 | ||
50 | #define GPIO_MINOR_B 1 | ||
51 | #define GPIO_MINOR_LEDS 2 | ||
52 | #define GPIO_MINOR_C 3 | ||
53 | #define GPIO_MINOR_D 4 | ||
54 | #define GPIO_MINOR_E 5 | ||
55 | #ifdef CONFIG_ETRAX_VIRTUAL_GPIO | ||
56 | #define GPIO_MINOR_V 6 | ||
57 | #define GPIO_MINOR_LAST 6 | ||
58 | #else | ||
59 | #define GPIO_MINOR_LAST 5 | ||
60 | #endif | ||
61 | #endif | ||
62 | |||
63 | #ifdef CONFIG_CRIS_MACH_ARTPEC3 | ||
64 | #define ETRAXGPIO_IOCTYPE 43 | ||
65 | #define GPIO_MINOR_A 0 | ||
66 | #define GPIO_MINOR_B 1 | ||
67 | #define GPIO_MINOR_LEDS 2 | ||
68 | #define GPIO_MINOR_C 3 | ||
69 | #define GPIO_MINOR_D 4 | ||
70 | #ifdef CONFIG_ETRAX_VIRTUAL_GPIO | ||
71 | #define GPIO_MINOR_V 6 | ||
72 | #define GPIO_MINOR_LAST 6 | ||
73 | #else | ||
74 | #define GPIO_MINOR_LAST 4 | ||
75 | #endif | ||
76 | #define GPIO_MINOR_PWM0 16 | ||
77 | #define GPIO_MINOR_PWM1 17 | ||
78 | #define GPIO_MINOR_PWM2 18 | ||
79 | #define GPIO_MINOR_LAST_PWM GPIO_MINOR_PWM2 | ||
80 | #endif | ||
81 | |||
82 | /* supported ioctl _IOC_NR's */ | ||
83 | |||
84 | #define IO_READBITS 0x1 /* read and return current port bits (obsolete) */ | ||
85 | #define IO_SETBITS 0x2 /* set the bits marked by 1 in the argument */ | ||
86 | #define IO_CLRBITS 0x3 /* clear the bits marked by 1 in the argument */ | ||
87 | |||
88 | /* the alarm is waited for by select() */ | ||
89 | |||
90 | #define IO_HIGHALARM 0x4 /* set alarm on high for bits marked by 1 */ | ||
91 | #define IO_LOWALARM 0x5 /* set alarm on low for bits marked by 1 */ | ||
92 | #define IO_CLRALARM 0x6 /* clear alarm for bits marked by 1 */ | ||
93 | |||
94 | /* LED ioctl */ | ||
95 | #define IO_LEDACTIVE_SET 0x7 /* set active led | ||
96 | * 0=off, 1=green, 2=red, 3=yellow */ | ||
97 | |||
98 | /* GPIO direction ioctl's */ | ||
99 | #define IO_READDIR 0x8 /* Read direction 0=input 1=output (obsolete) */ | ||
100 | #define IO_SETINPUT 0x9 /* Set direction for bits set, 0=unchanged 1=input, | ||
101 | returns mask with current inputs (obsolete) */ | ||
102 | #define IO_SETOUTPUT 0xA /* Set direction for bits set, 0=unchanged 1=output, | ||
103 | returns mask with current outputs (obsolete)*/ | ||
104 | |||
105 | /* LED ioctl extended */ | ||
106 | #define IO_LED_SETBIT 0xB | ||
107 | #define IO_LED_CLRBIT 0xC | ||
108 | |||
109 | /* SHUTDOWN ioctl */ | ||
110 | #define IO_SHUTDOWN 0xD | ||
111 | #define IO_GET_PWR_BT 0xE | ||
112 | |||
113 | /* Bit toggling in driver settings */ | ||
114 | /* bit set in low byte0 is CLK mask (0x00FF), | ||
115 | bit set in byte1 is DATA mask (0xFF00) | ||
116 | msb, data_mask[7:0] , clk_mask[7:0] | ||
117 | */ | ||
118 | #define IO_CFG_WRITE_MODE 0xF | ||
119 | #define IO_CFG_WRITE_MODE_VALUE(msb, data_mask, clk_mask) \ | ||
120 | ( (((msb)&1) << 16) | (((data_mask) &0xFF) << 8) | ((clk_mask) & 0xFF) ) | ||
121 | |||
122 | /* The following 4 ioctl's take a pointer as argument and handles | ||
123 | * 32 bit ports (port G) properly. | ||
124 | * These replaces IO_READBITS,IO_SETINPUT AND IO_SETOUTPUT | ||
125 | */ | ||
126 | #define IO_READ_INBITS 0x10 /* *arg is result of reading the input pins */ | ||
127 | #define IO_READ_OUTBITS 0x11 /* *arg is result of reading the output shadow */ | ||
128 | #define IO_SETGET_INPUT 0x12 /* bits set in *arg is set to input, | ||
129 | * *arg updated with current input pins. | ||
130 | */ | ||
131 | #define IO_SETGET_OUTPUT 0x13 /* bits set in *arg is set to output, | ||
132 | * *arg updated with current output pins. | ||
133 | */ | ||
134 | |||
135 | /* The following ioctl's are applicable to the PWM channels only */ | ||
136 | |||
137 | #define IO_PWM_SET_MODE 0x20 | ||
138 | |||
139 | enum io_pwm_mode { | ||
140 | PWM_OFF = 0, /* disabled, deallocated */ | ||
141 | PWM_STANDARD = 1, /* 390 kHz, duty cycle 0..255/256 */ | ||
142 | PWM_FAST = 2, /* variable freq, w/ 10ns active pulse len */ | ||
143 | PWM_VARFREQ = 3 /* individually configurable high/low periods */ | ||
144 | }; | ||
145 | |||
146 | struct io_pwm_set_mode { | ||
147 | enum io_pwm_mode mode; | ||
148 | }; | ||
149 | |||
150 | /* Only for mode PWM_VARFREQ. Period lo/high set in increments of 10ns | ||
151 | * from 10ns (value = 0) to 81920ns (value = 8191) | ||
152 | * (Resulting frequencies range from 50 MHz (10ns + 10ns) down to | ||
153 | * 6.1 kHz (81920ns + 81920ns) at 50% duty cycle, to 12.2 kHz at min/max duty | ||
154 | * cycle (81920 + 10ns or 10ns + 81920ns, respectively).) | ||
155 | */ | ||
156 | #define IO_PWM_SET_PERIOD 0x21 | ||
157 | |||
158 | struct io_pwm_set_period { | ||
159 | unsigned int lo; /* 0..8191 */ | ||
160 | unsigned int hi; /* 0..8191 */ | ||
161 | }; | ||
162 | |||
163 | /* Only for modes PWM_STANDARD and PWM_FAST. | ||
164 | * For PWM_STANDARD, set duty cycle of 390 kHz PWM output signal, from | ||
165 | * 0 (value = 0) to 255/256 (value = 255). | ||
166 | * For PWM_FAST, set duty cycle of PWM output signal from | ||
167 | * 0% (value = 0) to 100% (value = 255). Output signal in this mode | ||
168 | * is a 10ns pulse surrounded by a high or low level depending on duty | ||
169 | * cycle (except for 0% and 100% which result in a constant output). | ||
170 | * Resulting output frequency varies from 50 MHz at 50% duty cycle, | ||
171 | * down to 390 kHz at min/max duty cycle. | ||
172 | */ | ||
173 | #define IO_PWM_SET_DUTY 0x22 | ||
174 | |||
175 | struct io_pwm_set_duty { | ||
176 | int duty; /* 0..255 */ | ||
177 | }; | ||
178 | |||
179 | #endif | ||
diff --git a/arch/cris/include/asm/etraxi2c.h b/arch/cris/include/asm/etraxi2c.h new file mode 100644 index 000000000000..e369a7620893 --- /dev/null +++ b/arch/cris/include/asm/etraxi2c.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* $Id: etraxi2c.h,v 1.1 2001/01/18 15:49:57 bjornw Exp $ */ | ||
2 | |||
3 | #ifndef _LINUX_ETRAXI2C_H | ||
4 | #define _LINUX_ETRAXI2C_H | ||
5 | |||
6 | /* etraxi2c _IOC_TYPE, bits 8 to 15 in ioctl cmd */ | ||
7 | |||
8 | #define ETRAXI2C_IOCTYPE 44 | ||
9 | |||
10 | /* supported ioctl _IOC_NR's */ | ||
11 | |||
12 | /* in write operations, the argument contains both i2c | ||
13 | * slave, register and value. | ||
14 | */ | ||
15 | |||
16 | #define I2C_WRITEARG(slave, reg, value) (((slave) << 16) | ((reg) << 8) | (value)) | ||
17 | #define I2C_READARG(slave, reg) (((slave) << 16) | ((reg) << 8)) | ||
18 | |||
19 | #define I2C_ARGSLAVE(arg) ((arg) >> 16) | ||
20 | #define I2C_ARGREG(arg) (((arg) >> 8) & 0xff) | ||
21 | #define I2C_ARGVALUE(arg) ((arg) & 0xff) | ||
22 | |||
23 | #define I2C_WRITEREG 0x1 /* write to an i2c register */ | ||
24 | #define I2C_READREG 0x2 /* read from an i2c register */ | ||
25 | |||
26 | /* | ||
27 | EXAMPLE usage: | ||
28 | |||
29 | i2c_arg = I2C_WRITEARG(STA013_WRITE_ADDR, reg, val); | ||
30 | ioctl(fd, _IO(ETRAXI2C_IOCTYPE, I2C_WRITEREG), i2c_arg); | ||
31 | |||
32 | i2c_arg = I2C_READARG(STA013_READ_ADDR, reg); | ||
33 | val = ioctl(fd, _IO(ETRAXI2C_IOCTYPE, I2C_READREG), i2c_arg); | ||
34 | |||
35 | */ | ||
36 | #endif | ||
diff --git a/arch/cris/include/asm/fasttimer.h b/arch/cris/include/asm/fasttimer.h new file mode 100644 index 000000000000..8f8a8d6c9653 --- /dev/null +++ b/arch/cris/include/asm/fasttimer.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * linux/include/asm-cris/fasttimer.h | ||
3 | * | ||
4 | * Fast timers for ETRAX100LX | ||
5 | * Copyright (C) 2000-2007 Axis Communications AB | ||
6 | */ | ||
7 | #include <linux/time.h> /* struct timeval */ | ||
8 | #include <linux/timex.h> | ||
9 | |||
10 | #ifdef CONFIG_ETRAX_FAST_TIMER | ||
11 | |||
12 | typedef void fast_timer_function_type(unsigned long); | ||
13 | |||
14 | struct fasttime_t { | ||
15 | unsigned long tv_jiff; /* jiffies */ | ||
16 | unsigned long tv_usec; /* microseconds */ | ||
17 | }; | ||
18 | |||
19 | struct fast_timer{ /* Close to timer_list */ | ||
20 | struct fast_timer *next; | ||
21 | struct fast_timer *prev; | ||
22 | struct fasttime_t tv_set; | ||
23 | struct fasttime_t tv_expires; | ||
24 | unsigned long delay_us; | ||
25 | fast_timer_function_type *function; | ||
26 | unsigned long data; | ||
27 | const char *name; | ||
28 | }; | ||
29 | |||
30 | extern struct fast_timer *fast_timer_list; | ||
31 | |||
32 | void start_one_shot_timer(struct fast_timer *t, | ||
33 | fast_timer_function_type *function, | ||
34 | unsigned long data, | ||
35 | unsigned long delay_us, | ||
36 | const char *name); | ||
37 | |||
38 | int del_fast_timer(struct fast_timer * t); | ||
39 | /* return 1 if deleted */ | ||
40 | |||
41 | |||
42 | void schedule_usleep(unsigned long us); | ||
43 | |||
44 | |||
45 | int fast_timer_init(void); | ||
46 | |||
47 | #endif | ||
diff --git a/arch/cris/include/asm/fb.h b/arch/cris/include/asm/fb.h new file mode 100644 index 000000000000..c7df38030992 --- /dev/null +++ b/arch/cris/include/asm/fb.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _ASM_FB_H_ | ||
2 | #define _ASM_FB_H_ | ||
3 | #include <linux/fb.h> | ||
4 | |||
5 | #define fb_pgprotect(...) do {} while (0) | ||
6 | |||
7 | static inline int fb_is_primary_device(struct fb_info *info) | ||
8 | { | ||
9 | return 0; | ||
10 | } | ||
11 | |||
12 | #endif /* _ASM_FB_H_ */ | ||
diff --git a/arch/cris/include/asm/fcntl.h b/arch/cris/include/asm/fcntl.h new file mode 100644 index 000000000000..46ab12db5739 --- /dev/null +++ b/arch/cris/include/asm/fcntl.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/fcntl.h> | |||
diff --git a/arch/cris/include/asm/futex.h b/arch/cris/include/asm/futex.h new file mode 100644 index 000000000000..6a332a9f099c --- /dev/null +++ b/arch/cris/include/asm/futex.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_FUTEX_H | ||
2 | #define _ASM_FUTEX_H | ||
3 | |||
4 | #include <asm-generic/futex.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/cris/include/asm/hardirq.h b/arch/cris/include/asm/hardirq.h new file mode 100644 index 000000000000..74178adeb1cd --- /dev/null +++ b/arch/cris/include/asm/hardirq.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __ASM_HARDIRQ_H | ||
2 | #define __ASM_HARDIRQ_H | ||
3 | |||
4 | #include <asm/irq.h> | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cache.h> | ||
7 | |||
8 | typedef struct { | ||
9 | unsigned int __softirq_pending; | ||
10 | } ____cacheline_aligned irq_cpustat_t; | ||
11 | |||
12 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
13 | |||
14 | void ack_bad_irq(unsigned int irq); | ||
15 | |||
16 | #define HARDIRQ_BITS 8 | ||
17 | |||
18 | /* | ||
19 | * The hardirq mask has to be large enough to have | ||
20 | * space for potentially all IRQ sources in the system | ||
21 | * nesting on a single CPU: | ||
22 | */ | ||
23 | #if (1 << HARDIRQ_BITS) < NR_IRQS | ||
24 | # error HARDIRQ_BITS is too low! | ||
25 | #endif | ||
26 | |||
27 | #endif /* __ASM_HARDIRQ_H */ | ||
diff --git a/arch/cris/include/asm/hw_irq.h b/arch/cris/include/asm/hw_irq.h new file mode 100644 index 000000000000..298066020af2 --- /dev/null +++ b/arch/cris/include/asm/hw_irq.h | |||
@@ -0,0 +1,5 @@ | |||
1 | #ifndef _ASM_HW_IRQ_H | ||
2 | #define _ASM_HW_IRQ_H | ||
3 | |||
4 | #endif | ||
5 | |||
diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h new file mode 100644 index 000000000000..32567bc2a421 --- /dev/null +++ b/arch/cris/include/asm/io.h | |||
@@ -0,0 +1,154 @@ | |||
1 | #ifndef _ASM_CRIS_IO_H | ||
2 | #define _ASM_CRIS_IO_H | ||
3 | |||
4 | #include <asm/page.h> /* for __va, __pa */ | ||
5 | #include <arch/io.h> | ||
6 | #include <linux/kernel.h> | ||
7 | |||
8 | struct cris_io_operations | ||
9 | { | ||
10 | u32 (*read_mem)(void *addr, int size); | ||
11 | void (*write_mem)(u32 val, int size, void *addr); | ||
12 | u32 (*read_io)(u32 port, void *addr, int size, int count); | ||
13 | void (*write_io)(u32 port, void *addr, int size, int count); | ||
14 | }; | ||
15 | |||
16 | #ifdef CONFIG_PCI | ||
17 | extern struct cris_io_operations *cris_iops; | ||
18 | #else | ||
19 | #define cris_iops ((struct cris_io_operations*)NULL) | ||
20 | #endif | ||
21 | |||
22 | /* | ||
23 | * Change virtual addresses to physical addresses and vv. | ||
24 | */ | ||
25 | |||
26 | static inline unsigned long virt_to_phys(volatile void * address) | ||
27 | { | ||
28 | return __pa(address); | ||
29 | } | ||
30 | |||
31 | static inline void * phys_to_virt(unsigned long address) | ||
32 | { | ||
33 | return __va(address); | ||
34 | } | ||
35 | |||
36 | extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); | ||
37 | extern void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgprot_t prot); | ||
38 | |||
39 | static inline void __iomem * ioremap (unsigned long offset, unsigned long size) | ||
40 | { | ||
41 | return __ioremap(offset, size, 0); | ||
42 | } | ||
43 | |||
44 | extern void iounmap(volatile void * __iomem addr); | ||
45 | |||
46 | extern void __iomem * ioremap_nocache(unsigned long offset, unsigned long size); | ||
47 | |||
48 | /* | ||
49 | * IO bus memory addresses are also 1:1 with the physical address | ||
50 | */ | ||
51 | #define virt_to_bus virt_to_phys | ||
52 | #define bus_to_virt phys_to_virt | ||
53 | |||
54 | /* | ||
55 | * readX/writeX() are used to access memory mapped devices. On some | ||
56 | * architectures the memory mapped IO stuff needs to be accessed | ||
57 | * differently. On the CRIS architecture, we just read/write the | ||
58 | * memory location directly. | ||
59 | */ | ||
60 | #ifdef CONFIG_PCI | ||
61 | #define PCI_SPACE(x) ((((unsigned)(x)) & 0x10000000) == 0x10000000) | ||
62 | #else | ||
63 | #define PCI_SPACE(x) 0 | ||
64 | #endif | ||
65 | static inline unsigned char readb(const volatile void __iomem *addr) | ||
66 | { | ||
67 | if (PCI_SPACE(addr) && cris_iops) | ||
68 | return cris_iops->read_mem((void*)addr, 1); | ||
69 | else | ||
70 | return *(volatile unsigned char __force *) addr; | ||
71 | } | ||
72 | static inline unsigned short readw(const volatile void __iomem *addr) | ||
73 | { | ||
74 | if (PCI_SPACE(addr) && cris_iops) | ||
75 | return cris_iops->read_mem((void*)addr, 2); | ||
76 | else | ||
77 | return *(volatile unsigned short __force *) addr; | ||
78 | } | ||
79 | static inline unsigned int readl(const volatile void __iomem *addr) | ||
80 | { | ||
81 | if (PCI_SPACE(addr) && cris_iops) | ||
82 | return cris_iops->read_mem((void*)addr, 4); | ||
83 | else | ||
84 | return *(volatile unsigned int __force *) addr; | ||
85 | } | ||
86 | #define readb_relaxed(addr) readb(addr) | ||
87 | #define readw_relaxed(addr) readw(addr) | ||
88 | #define readl_relaxed(addr) readl(addr) | ||
89 | #define __raw_readb readb | ||
90 | #define __raw_readw readw | ||
91 | #define __raw_readl readl | ||
92 | |||
93 | static inline void writeb(unsigned char b, volatile void __iomem *addr) | ||
94 | { | ||
95 | if (PCI_SPACE(addr) && cris_iops) | ||
96 | cris_iops->write_mem(b, 1, (void*)addr); | ||
97 | else | ||
98 | *(volatile unsigned char __force *) addr = b; | ||
99 | } | ||
100 | static inline void writew(unsigned short b, volatile void __iomem *addr) | ||
101 | { | ||
102 | if (PCI_SPACE(addr) && cris_iops) | ||
103 | cris_iops->write_mem(b, 2, (void*)addr); | ||
104 | else | ||
105 | *(volatile unsigned short __force *) addr = b; | ||
106 | } | ||
107 | static inline void writel(unsigned int b, volatile void __iomem *addr) | ||
108 | { | ||
109 | if (PCI_SPACE(addr) && cris_iops) | ||
110 | cris_iops->write_mem(b, 4, (void*)addr); | ||
111 | else | ||
112 | *(volatile unsigned int __force *) addr = b; | ||
113 | } | ||
114 | #define __raw_writeb writeb | ||
115 | #define __raw_writew writew | ||
116 | #define __raw_writel writel | ||
117 | |||
118 | #define mmiowb() | ||
119 | |||
120 | #define memset_io(a,b,c) memset((void *)(a),(b),(c)) | ||
121 | #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) | ||
122 | #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) | ||
123 | |||
124 | |||
125 | /* I/O port access. Normally there is no I/O space on CRIS but when | ||
126 | * Cardbus/PCI is enabled the request is passed through the bridge. | ||
127 | */ | ||
128 | |||
129 | #define IO_SPACE_LIMIT 0xffff | ||
130 | #define inb(port) (cris_iops ? cris_iops->read_io(port,NULL,1,1) : 0) | ||
131 | #define inw(port) (cris_iops ? cris_iops->read_io(port,NULL,2,1) : 0) | ||
132 | #define inl(port) (cris_iops ? cris_iops->read_io(port,NULL,4,1) : 0) | ||
133 | #define insb(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,1,count) : 0) | ||
134 | #define insw(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,2,count) : 0) | ||
135 | #define insl(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,4,count) : 0) | ||
136 | #define outb(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,1,1) | ||
137 | #define outw(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,2,1) | ||
138 | #define outl(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,4,1) | ||
139 | #define outsb(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,1,count) | ||
140 | #define outsw(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,2,count) | ||
141 | #define outsl(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,3,count) | ||
142 | |||
143 | /* | ||
144 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
145 | * access | ||
146 | */ | ||
147 | #define xlate_dev_mem_ptr(p) __va(p) | ||
148 | |||
149 | /* | ||
150 | * Convert a virtual cached pointer to an uncached pointer | ||
151 | */ | ||
152 | #define xlate_dev_kmem_ptr(p) p | ||
153 | |||
154 | #endif | ||
diff --git a/arch/cris/include/asm/ioctl.h b/arch/cris/include/asm/ioctl.h new file mode 100644 index 000000000000..b279fe06dfe5 --- /dev/null +++ b/arch/cris/include/asm/ioctl.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/ioctl.h> | |||
diff --git a/arch/cris/include/asm/ioctls.h b/arch/cris/include/asm/ioctls.h new file mode 100644 index 000000000000..4f4e52531fa0 --- /dev/null +++ b/arch/cris/include/asm/ioctls.h | |||
@@ -0,0 +1,91 @@ | |||
1 | #ifndef __ARCH_CRIS_IOCTLS_H__ | ||
2 | #define __ARCH_CRIS_IOCTLS_H__ | ||
3 | |||
4 | /* verbatim copy of asm-i386/ioctls.h */ | ||
5 | |||
6 | #include <asm/ioctl.h> | ||
7 | |||
8 | /* 0x54 is just a magic number to make these relatively unique ('T') */ | ||
9 | |||
10 | #define TCGETS 0x5401 | ||
11 | #define TCSETS 0x5402 | ||
12 | #define TCSETSW 0x5403 | ||
13 | #define TCSETSF 0x5404 | ||
14 | #define TCGETA 0x5405 | ||
15 | #define TCSETA 0x5406 | ||
16 | #define TCSETAW 0x5407 | ||
17 | #define TCSETAF 0x5408 | ||
18 | #define TCSBRK 0x5409 | ||
19 | #define TCXONC 0x540A | ||
20 | #define TCFLSH 0x540B | ||
21 | #define TIOCEXCL 0x540C | ||
22 | #define TIOCNXCL 0x540D | ||
23 | #define TIOCSCTTY 0x540E | ||
24 | #define TIOCGPGRP 0x540F | ||
25 | #define TIOCSPGRP 0x5410 | ||
26 | #define TIOCOUTQ 0x5411 | ||
27 | #define TIOCSTI 0x5412 | ||
28 | #define TIOCGWINSZ 0x5413 | ||
29 | #define TIOCSWINSZ 0x5414 | ||
30 | #define TIOCMGET 0x5415 | ||
31 | #define TIOCMBIS 0x5416 | ||
32 | #define TIOCMBIC 0x5417 | ||
33 | #define TIOCMSET 0x5418 | ||
34 | #define TIOCGSOFTCAR 0x5419 | ||
35 | #define TIOCSSOFTCAR 0x541A | ||
36 | #define FIONREAD 0x541B | ||
37 | #define TIOCINQ FIONREAD | ||
38 | #define TIOCLINUX 0x541C | ||
39 | #define TIOCCONS 0x541D | ||
40 | #define TIOCGSERIAL 0x541E | ||
41 | #define TIOCSSERIAL 0x541F | ||
42 | #define TIOCPKT 0x5420 | ||
43 | #define FIONBIO 0x5421 | ||
44 | #define TIOCNOTTY 0x5422 | ||
45 | #define TIOCSETD 0x5423 | ||
46 | #define TIOCGETD 0x5424 | ||
47 | #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ | ||
48 | #define TIOCSBRK 0x5427 /* BSD compatibility */ | ||
49 | #define TIOCCBRK 0x5428 /* BSD compatibility */ | ||
50 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ | ||
51 | #define TCGETS2 _IOR('T',0x2A, struct termios2) | ||
52 | #define TCSETS2 _IOW('T',0x2B, struct termios2) | ||
53 | #define TCSETSW2 _IOW('T',0x2C, struct termios2) | ||
54 | #define TCSETSF2 _IOW('T',0x2D, struct termios2) | ||
55 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | ||
56 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | ||
57 | |||
58 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ | ||
59 | #define FIOCLEX 0x5451 | ||
60 | #define FIOASYNC 0x5452 | ||
61 | #define TIOCSERCONFIG 0x5453 | ||
62 | #define TIOCSERGWILD 0x5454 | ||
63 | #define TIOCSERSWILD 0x5455 | ||
64 | #define TIOCGLCKTRMIOS 0x5456 | ||
65 | #define TIOCSLCKTRMIOS 0x5457 | ||
66 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
67 | #define TIOCSERGETLSR 0x5459 /* Get line status register */ | ||
68 | #define TIOCSERGETMULTI 0x545A /* Get multiport config */ | ||
69 | #define TIOCSERSETMULTI 0x545B /* Set multiport config */ | ||
70 | |||
71 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ | ||
72 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | ||
73 | #define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ | ||
74 | #define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ | ||
75 | #define FIOQSIZE 0x5460 | ||
76 | |||
77 | #define TIOCSERSETRS485 0x5461 /* enable rs-485 */ | ||
78 | #define TIOCSERWRRS485 0x5462 /* write rs-485 */ | ||
79 | |||
80 | /* Used for packet mode */ | ||
81 | #define TIOCPKT_DATA 0 | ||
82 | #define TIOCPKT_FLUSHREAD 1 | ||
83 | #define TIOCPKT_FLUSHWRITE 2 | ||
84 | #define TIOCPKT_STOP 4 | ||
85 | #define TIOCPKT_START 8 | ||
86 | #define TIOCPKT_NOSTOP 16 | ||
87 | #define TIOCPKT_DOSTOP 32 | ||
88 | |||
89 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
90 | |||
91 | #endif | ||
diff --git a/arch/cris/include/asm/ipcbuf.h b/arch/cris/include/asm/ipcbuf.h new file mode 100644 index 000000000000..8b0c18b02844 --- /dev/null +++ b/arch/cris/include/asm/ipcbuf.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __CRIS_IPCBUF_H__ | ||
2 | #define __CRIS_IPCBUF_H__ | ||
3 | |||
4 | /* | ||
5 | * The user_ipc_perm structure for CRIS architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 32-bit mode_t and seq | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct ipc64_perm | ||
15 | { | ||
16 | __kernel_key_t key; | ||
17 | __kernel_uid32_t uid; | ||
18 | __kernel_gid32_t gid; | ||
19 | __kernel_uid32_t cuid; | ||
20 | __kernel_gid32_t cgid; | ||
21 | __kernel_mode_t mode; | ||
22 | unsigned short __pad1; | ||
23 | unsigned short seq; | ||
24 | unsigned short __pad2; | ||
25 | unsigned long __unused1; | ||
26 | unsigned long __unused2; | ||
27 | }; | ||
28 | |||
29 | #endif /* __CRIS_IPCBUF_H__ */ | ||
diff --git a/arch/cris/include/asm/irq.h b/arch/cris/include/asm/irq.h new file mode 100644 index 000000000000..ce0fcf540d62 --- /dev/null +++ b/arch/cris/include/asm/irq.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _ASM_IRQ_H | ||
2 | #define _ASM_IRQ_H | ||
3 | |||
4 | #include <arch/irq.h> | ||
5 | |||
6 | static inline int irq_canonicalize(int irq) | ||
7 | { | ||
8 | return irq; | ||
9 | } | ||
10 | |||
11 | #endif /* _ASM_IRQ_H */ | ||
12 | |||
13 | |||
diff --git a/arch/cris/include/asm/irq_regs.h b/arch/cris/include/asm/irq_regs.h new file mode 100644 index 000000000000..3dd9c0b70270 --- /dev/null +++ b/arch/cris/include/asm/irq_regs.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/irq_regs.h> | |||
diff --git a/arch/cris/include/asm/kdebug.h b/arch/cris/include/asm/kdebug.h new file mode 100644 index 000000000000..6ece1b037665 --- /dev/null +++ b/arch/cris/include/asm/kdebug.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/kdebug.h> | |||
diff --git a/arch/cris/include/asm/kmap_types.h b/arch/cris/include/asm/kmap_types.h new file mode 100644 index 000000000000..492988cb9077 --- /dev/null +++ b/arch/cris/include/asm/kmap_types.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _ASM_KMAP_TYPES_H | ||
2 | #define _ASM_KMAP_TYPES_H | ||
3 | |||
4 | /* Dummy header just to define km_type. None of this | ||
5 | * is actually used on cris. | ||
6 | */ | ||
7 | |||
8 | enum km_type { | ||
9 | KM_BOUNCE_READ, | ||
10 | KM_SKB_SUNRPC_DATA, | ||
11 | KM_SKB_DATA_SOFTIRQ, | ||
12 | KM_USER0, | ||
13 | KM_USER1, | ||
14 | KM_BIO_SRC_IRQ, | ||
15 | KM_BIO_DST_IRQ, | ||
16 | KM_PTE0, | ||
17 | KM_PTE1, | ||
18 | KM_IRQ0, | ||
19 | KM_IRQ1, | ||
20 | KM_SOFTIRQ0, | ||
21 | KM_SOFTIRQ1, | ||
22 | KM_TYPE_NR | ||
23 | }; | ||
24 | |||
25 | #endif | ||
diff --git a/arch/cris/include/asm/linkage.h b/arch/cris/include/asm/linkage.h new file mode 100644 index 000000000000..291c2d01c44f --- /dev/null +++ b/arch/cris/include/asm/linkage.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | ||
2 | #define __ASM_LINKAGE_H | ||
3 | |||
4 | /* Nothing to see here... */ | ||
5 | |||
6 | #endif | ||
diff --git a/arch/cris/include/asm/local.h b/arch/cris/include/asm/local.h new file mode 100644 index 000000000000..c11c530f74d0 --- /dev/null +++ b/arch/cris/include/asm/local.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/local.h> | |||
diff --git a/arch/cris/include/asm/mman.h b/arch/cris/include/asm/mman.h new file mode 100644 index 000000000000..1c35e1b66b46 --- /dev/null +++ b/arch/cris/include/asm/mman.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __CRIS_MMAN_H__ | ||
2 | #define __CRIS_MMAN_H__ | ||
3 | |||
4 | /* verbatim copy of asm-i386/ version */ | ||
5 | |||
6 | #include <asm-generic/mman.h> | ||
7 | |||
8 | #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ | ||
9 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
10 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
11 | #define MAP_LOCKED 0x2000 /* pages are locked */ | ||
12 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | ||
13 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | ||
14 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
15 | |||
16 | #define MCL_CURRENT 1 /* lock all current mappings */ | ||
17 | #define MCL_FUTURE 2 /* lock all future mappings */ | ||
18 | |||
19 | #endif /* __CRIS_MMAN_H__ */ | ||
diff --git a/arch/cris/include/asm/mmu.h b/arch/cris/include/asm/mmu.h new file mode 100644 index 000000000000..e06ea94ecffd --- /dev/null +++ b/arch/cris/include/asm/mmu.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * CRIS MMU constants and PTE layout | ||
3 | */ | ||
4 | |||
5 | #ifndef _CRIS_MMU_H | ||
6 | #define _CRIS_MMU_H | ||
7 | |||
8 | #include <arch/mmu.h> | ||
9 | |||
10 | #endif | ||
diff --git a/arch/cris/include/asm/mmu_context.h b/arch/cris/include/asm/mmu_context.h new file mode 100644 index 000000000000..72ba08dcfd18 --- /dev/null +++ b/arch/cris/include/asm/mmu_context.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef __CRIS_MMU_CONTEXT_H | ||
2 | #define __CRIS_MMU_CONTEXT_H | ||
3 | |||
4 | #include <asm-generic/mm_hooks.h> | ||
5 | |||
6 | extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | ||
7 | extern void get_mmu_context(struct mm_struct *mm); | ||
8 | extern void destroy_context(struct mm_struct *mm); | ||
9 | extern void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
10 | struct task_struct *tsk); | ||
11 | |||
12 | #define deactivate_mm(tsk,mm) do { } while (0) | ||
13 | |||
14 | #define activate_mm(prev,next) switch_mm((prev),(next),NULL) | ||
15 | |||
16 | /* current active pgd - this is similar to other processors pgd | ||
17 | * registers like cr3 on the i386 | ||
18 | */ | ||
19 | |||
20 | extern volatile DEFINE_PER_CPU(pgd_t *,current_pgd); /* defined in arch/cris/mm/fault.c */ | ||
21 | |||
22 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
23 | { | ||
24 | } | ||
25 | |||
26 | #endif | ||
diff --git a/arch/cris/include/asm/module.h b/arch/cris/include/asm/module.h new file mode 100644 index 000000000000..7ee72311bd78 --- /dev/null +++ b/arch/cris/include/asm/module.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _ASM_CRIS_MODULE_H | ||
2 | #define _ASM_CRIS_MODULE_H | ||
3 | /* cris is simple */ | ||
4 | struct mod_arch_specific { }; | ||
5 | |||
6 | #define Elf_Shdr Elf32_Shdr | ||
7 | #define Elf_Sym Elf32_Sym | ||
8 | #define Elf_Ehdr Elf32_Ehdr | ||
9 | #endif /* _ASM_CRIS_MODULE_H */ | ||
diff --git a/arch/cris/include/asm/msgbuf.h b/arch/cris/include/asm/msgbuf.h new file mode 100644 index 000000000000..ada63df1d574 --- /dev/null +++ b/arch/cris/include/asm/msgbuf.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _CRIS_MSGBUF_H | ||
2 | #define _CRIS_MSGBUF_H | ||
3 | |||
4 | /* verbatim copy of asm-i386 version */ | ||
5 | |||
6 | /* | ||
7 | * The msqid64_ds structure for CRIS architecture. | ||
8 | * Note extra padding because this structure is passed back and forth | ||
9 | * between kernel and user space. | ||
10 | * | ||
11 | * Pad space is left for: | ||
12 | * - 64-bit time_t to solve y2038 problem | ||
13 | * - 2 miscellaneous 32-bit values | ||
14 | */ | ||
15 | |||
16 | struct msqid64_ds { | ||
17 | struct ipc64_perm msg_perm; | ||
18 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
19 | unsigned long __unused1; | ||
20 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
21 | unsigned long __unused2; | ||
22 | __kernel_time_t msg_ctime; /* last change time */ | ||
23 | unsigned long __unused3; | ||
24 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
25 | unsigned long msg_qnum; /* number of messages in queue */ | ||
26 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
27 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
28 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
29 | unsigned long __unused4; | ||
30 | unsigned long __unused5; | ||
31 | }; | ||
32 | |||
33 | #endif /* _CRIS_MSGBUF_H */ | ||
diff --git a/arch/cris/include/asm/mutex.h b/arch/cris/include/asm/mutex.h new file mode 100644 index 000000000000..458c1f7fbc18 --- /dev/null +++ b/arch/cris/include/asm/mutex.h | |||
@@ -0,0 +1,9 @@ | |||
1 | /* | ||
2 | * Pull in the generic implementation for the mutex fastpath. | ||
3 | * | ||
4 | * TODO: implement optimized primitives instead, or leave the generic | ||
5 | * implementation in place, or pick the atomic_xchg() based generic | ||
6 | * implementation. (see asm-generic/mutex-xchg.h for details) | ||
7 | */ | ||
8 | |||
9 | #include <asm-generic/mutex-dec.h> | ||
diff --git a/arch/cris/include/asm/page.h b/arch/cris/include/asm/page.h new file mode 100644 index 000000000000..f3fdbd09c34c --- /dev/null +++ b/arch/cris/include/asm/page.h | |||
@@ -0,0 +1,74 @@ | |||
1 | #ifndef _CRIS_PAGE_H | ||
2 | #define _CRIS_PAGE_H | ||
3 | |||
4 | #include <arch/page.h> | ||
5 | #include <linux/const.h> | ||
6 | |||
7 | /* PAGE_SHIFT determines the page size */ | ||
8 | #define PAGE_SHIFT 13 | ||
9 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) | ||
10 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
11 | |||
12 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | ||
13 | #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) | ||
14 | |||
15 | #define clear_user_page(page, vaddr, pg) clear_page(page) | ||
16 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
17 | |||
18 | #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \ | ||
19 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) | ||
20 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | ||
21 | |||
22 | /* | ||
23 | * These are used to make use of C type-checking.. | ||
24 | */ | ||
25 | #ifndef __ASSEMBLY__ | ||
26 | typedef struct { unsigned long pte; } pte_t; | ||
27 | typedef struct { unsigned long pgd; } pgd_t; | ||
28 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
29 | typedef struct page *pgtable_t; | ||
30 | #endif | ||
31 | |||
32 | #define pte_val(x) ((x).pte) | ||
33 | #define pgd_val(x) ((x).pgd) | ||
34 | #define pgprot_val(x) ((x).pgprot) | ||
35 | |||
36 | #define __pte(x) ((pte_t) { (x) } ) | ||
37 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
38 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
39 | |||
40 | /* On CRIS the PFN numbers doesn't start at 0 so we have to compensate */ | ||
41 | /* for that before indexing into the page table starting at mem_map */ | ||
42 | #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) | ||
43 | #define pfn_valid(pfn) (((pfn) - (PAGE_OFFSET >> PAGE_SHIFT)) < max_mapnr) | ||
44 | |||
45 | /* to index into the page map. our pages all start at physical addr PAGE_OFFSET so | ||
46 | * we can let the map start there. notice that we subtract PAGE_OFFSET because | ||
47 | * we start our mem_map there - in other ports they map mem_map physically and | ||
48 | * use __pa instead. in our system both the physical and virtual address of DRAM | ||
49 | * is too high to let mem_map start at 0, so we do it this way instead (similar | ||
50 | * to arm and m68k I think) | ||
51 | */ | ||
52 | |||
53 | #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT)) | ||
54 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) | ||
55 | #define virt_addr_valid(kaddr) pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT) | ||
56 | |||
57 | /* convert a page (based on mem_map and forward) to a physical address | ||
58 | * do this by figuring out the virtual address and then use __pa | ||
59 | */ | ||
60 | |||
61 | #define page_to_phys(page) __pa((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) | ||
62 | |||
63 | #ifndef __ASSEMBLY__ | ||
64 | |||
65 | #endif /* __ASSEMBLY__ */ | ||
66 | |||
67 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
68 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
69 | |||
70 | #include <asm-generic/memory_model.h> | ||
71 | #include <asm-generic/page.h> | ||
72 | |||
73 | #endif /* _CRIS_PAGE_H */ | ||
74 | |||
diff --git a/arch/cris/include/asm/param.h b/arch/cris/include/asm/param.h new file mode 100644 index 000000000000..0e47994e40be --- /dev/null +++ b/arch/cris/include/asm/param.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _ASMCRIS_PARAM_H | ||
2 | #define _ASMCRIS_PARAM_H | ||
3 | |||
4 | /* Currently we assume that HZ=100 is good for CRIS. */ | ||
5 | #ifdef __KERNEL__ | ||
6 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ | ||
7 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
8 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | ||
9 | #endif | ||
10 | |||
11 | #ifndef HZ | ||
12 | #define HZ 100 | ||
13 | #endif | ||
14 | |||
15 | #define EXEC_PAGESIZE 8192 | ||
16 | |||
17 | #ifndef NOGROUP | ||
18 | #define NOGROUP (-1) | ||
19 | #endif | ||
20 | |||
21 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
22 | |||
23 | #endif | ||
diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h new file mode 100644 index 000000000000..730ce40fdd0f --- /dev/null +++ b/arch/cris/include/asm/pci.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef __ASM_CRIS_PCI_H | ||
2 | #define __ASM_CRIS_PCI_H | ||
3 | |||
4 | |||
5 | #ifdef __KERNEL__ | ||
6 | #include <linux/mm.h> /* for struct page */ | ||
7 | |||
8 | /* Can be used to override the logic in pci_scan_bus for skipping | ||
9 | already-configured bus numbers - to be used for buggy BIOSes | ||
10 | or architectures with incomplete PCI setup by the loader */ | ||
11 | |||
12 | #define pcibios_assign_all_busses(void) 1 | ||
13 | |||
14 | extern unsigned long pci_mem_start; | ||
15 | #define PCIBIOS_MIN_IO 0x1000 | ||
16 | #define PCIBIOS_MIN_MEM 0x10000000 | ||
17 | |||
18 | #define PCIBIOS_MIN_CARDBUS_IO 0x4000 | ||
19 | |||
20 | void pcibios_config_init(void); | ||
21 | struct pci_bus * pcibios_scan_root(int bus); | ||
22 | int pcibios_assign_resources(void); | ||
23 | |||
24 | void pcibios_set_master(struct pci_dev *dev); | ||
25 | void pcibios_penalize_isa_irq(int irq); | ||
26 | struct irq_routing_table *pcibios_get_irq_routing_table(void); | ||
27 | int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); | ||
28 | |||
29 | /* Dynamic DMA mapping stuff. | ||
30 | * i386 has everything mapped statically. | ||
31 | */ | ||
32 | |||
33 | #include <linux/types.h> | ||
34 | #include <linux/slab.h> | ||
35 | #include <asm/scatterlist.h> | ||
36 | #include <linux/string.h> | ||
37 | #include <asm/io.h> | ||
38 | |||
39 | struct pci_dev; | ||
40 | |||
41 | /* The PCI address space does equal the physical memory | ||
42 | * address space. The networking and block device layers use | ||
43 | * this boolean for bounce buffer decisions. | ||
44 | */ | ||
45 | #define PCI_DMA_BUS_IS_PHYS (1) | ||
46 | |||
47 | /* pci_unmap_{page,single} is a nop so... */ | ||
48 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | ||
49 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | ||
50 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) | ||
51 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
52 | #define pci_unmap_len(PTR, LEN_NAME) (0) | ||
53 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
54 | |||
55 | #define HAVE_PCI_MMAP | ||
56 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | ||
57 | enum pci_mmap_state mmap_state, int write_combine); | ||
58 | |||
59 | |||
60 | #endif /* __KERNEL__ */ | ||
61 | |||
62 | /* implement the pci_ DMA API in terms of the generic device dma_ one */ | ||
63 | #include <asm-generic/pci-dma-compat.h> | ||
64 | |||
65 | /* generic pci stuff */ | ||
66 | #include <asm-generic/pci.h> | ||
67 | |||
68 | #endif /* __ASM_CRIS_PCI_H */ | ||
diff --git a/arch/cris/include/asm/percpu.h b/arch/cris/include/asm/percpu.h new file mode 100644 index 000000000000..6db9b43cf80a --- /dev/null +++ b/arch/cris/include/asm/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _CRIS_PERCPU_H | ||
2 | #define _CRIS_PERCPU_H | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* _CRIS_PERCPU_H */ | ||
diff --git a/arch/cris/include/asm/pgalloc.h b/arch/cris/include/asm/pgalloc.h new file mode 100644 index 000000000000..a1ba761d0573 --- /dev/null +++ b/arch/cris/include/asm/pgalloc.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef _CRIS_PGALLOC_H | ||
2 | #define _CRIS_PGALLOC_H | ||
3 | |||
4 | #include <linux/threads.h> | ||
5 | #include <linux/mm.h> | ||
6 | |||
7 | #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) | ||
8 | #define pmd_populate(mm, pmd, pte) pmd_set(pmd, page_address(pte)) | ||
9 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
10 | |||
11 | /* | ||
12 | * Allocate and free page tables. | ||
13 | */ | ||
14 | |||
15 | static inline pgd_t *pgd_alloc (struct mm_struct *mm) | ||
16 | { | ||
17 | return (pgd_t *)get_zeroed_page(GFP_KERNEL); | ||
18 | } | ||
19 | |||
20 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | ||
21 | { | ||
22 | free_page((unsigned long)pgd); | ||
23 | } | ||
24 | |||
25 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | ||
26 | { | ||
27 | pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); | ||
28 | return pte; | ||
29 | } | ||
30 | |||
31 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) | ||
32 | { | ||
33 | struct page *pte; | ||
34 | pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); | ||
35 | pgtable_page_ctor(pte); | ||
36 | return pte; | ||
37 | } | ||
38 | |||
39 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
40 | { | ||
41 | free_page((unsigned long)pte); | ||
42 | } | ||
43 | |||
44 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) | ||
45 | { | ||
46 | pgtable_page_dtor(pte); | ||
47 | __free_page(pte); | ||
48 | } | ||
49 | |||
50 | #define __pte_free_tlb(tlb,pte) \ | ||
51 | do { \ | ||
52 | pgtable_page_dtor(pte); \ | ||
53 | tlb_remove_page((tlb), pte); \ | ||
54 | } while (0) | ||
55 | |||
56 | #define check_pgt_cache() do { } while (0) | ||
57 | |||
58 | #endif | ||
diff --git a/arch/cris/include/asm/pgtable.h b/arch/cris/include/asm/pgtable.h new file mode 100644 index 000000000000..50aa974aa834 --- /dev/null +++ b/arch/cris/include/asm/pgtable.h | |||
@@ -0,0 +1,299 @@ | |||
1 | /* | ||
2 | * CRIS pgtable.h - macros and functions to manipulate page tables. | ||
3 | */ | ||
4 | |||
5 | #ifndef _CRIS_PGTABLE_H | ||
6 | #define _CRIS_PGTABLE_H | ||
7 | |||
8 | #include <asm/page.h> | ||
9 | #include <asm-generic/pgtable-nopmd.h> | ||
10 | |||
11 | #ifndef __ASSEMBLY__ | ||
12 | #include <linux/sched.h> | ||
13 | #include <asm/mmu.h> | ||
14 | #endif | ||
15 | #include <arch/pgtable.h> | ||
16 | |||
17 | /* | ||
18 | * The Linux memory management assumes a three-level page table setup. On | ||
19 | * CRIS, we use that, but "fold" the mid level into the top-level page | ||
20 | * table. Since the MMU TLB is software loaded through an interrupt, it | ||
21 | * supports any page table structure, so we could have used a three-level | ||
22 | * setup, but for the amounts of memory we normally use, a two-level is | ||
23 | * probably more efficient. | ||
24 | * | ||
25 | * This file contains the functions and defines necessary to modify and use | ||
26 | * the CRIS page table tree. | ||
27 | */ | ||
28 | #ifndef __ASSEMBLY__ | ||
29 | extern void paging_init(void); | ||
30 | #endif | ||
31 | |||
32 | /* Certain architectures need to do special things when pte's | ||
33 | * within a page table are directly modified. Thus, the following | ||
34 | * hook is made available. | ||
35 | */ | ||
36 | #define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval)) | ||
37 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | ||
38 | |||
39 | /* | ||
40 | * (pmds are folded into pgds so this doesn't get actually called, | ||
41 | * but the define is needed for a generic inline function.) | ||
42 | */ | ||
43 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | ||
44 | #define set_pgu(pudptr, pudval) (*(pudptr) = pudval) | ||
45 | |||
46 | /* PGDIR_SHIFT determines the size of the area a second-level page table can | ||
47 | * map. It is equal to the page size times the number of PTE's that fit in | ||
48 | * a PMD page. A PTE is 4-bytes in CRIS. Hence the following number. | ||
49 | */ | ||
50 | |||
51 | #define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-2)) | ||
52 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
53 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
54 | |||
55 | /* | ||
56 | * entries per page directory level: we use a two-level, so | ||
57 | * we don't really have any PMD directory physically. | ||
58 | * pointers are 4 bytes so we can use the page size and | ||
59 | * divide it by 4 (shift by 2). | ||
60 | */ | ||
61 | #define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2)) | ||
62 | #define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2)) | ||
63 | |||
64 | /* calculate how many PGD entries a user-level program can use | ||
65 | * the first mappable virtual address is 0 | ||
66 | * (TASK_SIZE is the maximum virtual address space) | ||
67 | */ | ||
68 | |||
69 | #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) | ||
70 | #define FIRST_USER_ADDRESS 0 | ||
71 | |||
72 | /* zero page used for uninitialized stuff */ | ||
73 | #ifndef __ASSEMBLY__ | ||
74 | extern unsigned long empty_zero_page; | ||
75 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | ||
76 | #endif | ||
77 | |||
78 | /* number of bits that fit into a memory pointer */ | ||
79 | #define BITS_PER_PTR (8*sizeof(unsigned long)) | ||
80 | |||
81 | /* to align the pointer to a pointer address */ | ||
82 | #define PTR_MASK (~(sizeof(void*)-1)) | ||
83 | |||
84 | /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */ | ||
85 | /* 64-bit machines, beware! SRB. */ | ||
86 | #define SIZEOF_PTR_LOG2 2 | ||
87 | |||
88 | /* to find an entry in a page-table */ | ||
89 | #define PAGE_PTR(address) \ | ||
90 | ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) | ||
91 | |||
92 | /* to set the page-dir */ | ||
93 | #define SET_PAGE_DIR(tsk,pgdir) | ||
94 | |||
95 | #define pte_none(x) (!pte_val(x)) | ||
96 | #define pte_present(x) (pte_val(x) & _PAGE_PRESENT) | ||
97 | #define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0) | ||
98 | |||
99 | #define pmd_none(x) (!pmd_val(x)) | ||
100 | /* by removing the _PAGE_KERNEL bit from the comparision, the same pmd_bad | ||
101 | * works for both _PAGE_TABLE and _KERNPG_TABLE pmd entries. | ||
102 | */ | ||
103 | #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_KERNEL)) != _PAGE_TABLE) | ||
104 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) | ||
105 | #define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) | ||
106 | |||
107 | #ifndef __ASSEMBLY__ | ||
108 | |||
109 | /* | ||
110 | * The following only work if pte_present() is true. | ||
111 | * Undefined behaviour if not.. | ||
112 | */ | ||
113 | |||
114 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } | ||
115 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } | ||
116 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | ||
117 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | ||
118 | static inline int pte_special(pte_t pte) { return 0; } | ||
119 | |||
120 | static inline pte_t pte_wrprotect(pte_t pte) | ||
121 | { | ||
122 | pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); | ||
123 | return pte; | ||
124 | } | ||
125 | |||
126 | static inline pte_t pte_mkclean(pte_t pte) | ||
127 | { | ||
128 | pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); | ||
129 | return pte; | ||
130 | } | ||
131 | |||
132 | static inline pte_t pte_mkold(pte_t pte) | ||
133 | { | ||
134 | pte_val(pte) &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ); | ||
135 | return pte; | ||
136 | } | ||
137 | |||
138 | static inline pte_t pte_mkwrite(pte_t pte) | ||
139 | { | ||
140 | pte_val(pte) |= _PAGE_WRITE; | ||
141 | if (pte_val(pte) & _PAGE_MODIFIED) | ||
142 | pte_val(pte) |= _PAGE_SILENT_WRITE; | ||
143 | return pte; | ||
144 | } | ||
145 | |||
146 | static inline pte_t pte_mkdirty(pte_t pte) | ||
147 | { | ||
148 | pte_val(pte) |= _PAGE_MODIFIED; | ||
149 | if (pte_val(pte) & _PAGE_WRITE) | ||
150 | pte_val(pte) |= _PAGE_SILENT_WRITE; | ||
151 | return pte; | ||
152 | } | ||
153 | |||
154 | static inline pte_t pte_mkyoung(pte_t pte) | ||
155 | { | ||
156 | pte_val(pte) |= _PAGE_ACCESSED; | ||
157 | if (pte_val(pte) & _PAGE_READ) | ||
158 | { | ||
159 | pte_val(pte) |= _PAGE_SILENT_READ; | ||
160 | if ((pte_val(pte) & (_PAGE_WRITE | _PAGE_MODIFIED)) == | ||
161 | (_PAGE_WRITE | _PAGE_MODIFIED)) | ||
162 | pte_val(pte) |= _PAGE_SILENT_WRITE; | ||
163 | } | ||
164 | return pte; | ||
165 | } | ||
166 | static inline pte_t pte_mkspecial(pte_t pte) { return pte; } | ||
167 | |||
168 | /* | ||
169 | * Conversion functions: convert a page and protection to a page entry, | ||
170 | * and a page entry and page directory to the page they refer to. | ||
171 | */ | ||
172 | |||
173 | /* What actually goes as arguments to the various functions is less than | ||
174 | * obvious, but a rule of thumb is that struct page's goes as struct page *, | ||
175 | * really physical DRAM addresses are unsigned long's, and DRAM "virtual" | ||
176 | * addresses (the 0xc0xxxxxx's) goes as void *'s. | ||
177 | */ | ||
178 | |||
179 | static inline pte_t __mk_pte(void * page, pgprot_t pgprot) | ||
180 | { | ||
181 | pte_t pte; | ||
182 | /* the PTE needs a physical address */ | ||
183 | pte_val(pte) = __pa(page) | pgprot_val(pgprot); | ||
184 | return pte; | ||
185 | } | ||
186 | |||
187 | #define mk_pte(page, pgprot) __mk_pte(page_address(page), (pgprot)) | ||
188 | |||
189 | #define mk_pte_phys(physpage, pgprot) \ | ||
190 | ({ \ | ||
191 | pte_t __pte; \ | ||
192 | \ | ||
193 | pte_val(__pte) = (physpage) + pgprot_val(pgprot); \ | ||
194 | __pte; \ | ||
195 | }) | ||
196 | |||
197 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
198 | { pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } | ||
199 | |||
200 | |||
201 | /* pte_val refers to a page in the 0x4xxxxxxx physical DRAM interval | ||
202 | * __pte_page(pte_val) refers to the "virtual" DRAM interval | ||
203 | * pte_pagenr refers to the page-number counted starting from the virtual DRAM start | ||
204 | */ | ||
205 | |||
206 | static inline unsigned long __pte_page(pte_t pte) | ||
207 | { | ||
208 | /* the PTE contains a physical address */ | ||
209 | return (unsigned long)__va(pte_val(pte) & PAGE_MASK); | ||
210 | } | ||
211 | |||
212 | #define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT) | ||
213 | |||
214 | /* permanent address of a page */ | ||
215 | |||
216 | #define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) | ||
217 | #define pte_page(pte) (mem_map+pte_pagenr(pte)) | ||
218 | |||
219 | /* only the pte's themselves need to point to physical DRAM (see above) | ||
220 | * the pagetable links are purely handled within the kernel SW and thus | ||
221 | * don't need the __pa and __va transformations. | ||
222 | */ | ||
223 | |||
224 | static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | ||
225 | { pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } | ||
226 | |||
227 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | ||
228 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ||
229 | |||
230 | /* to find an entry in a page-table-directory. */ | ||
231 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | ||
232 | |||
233 | /* to find an entry in a page-table-directory */ | ||
234 | static inline pgd_t * pgd_offset(const struct mm_struct *mm, unsigned long address) | ||
235 | { | ||
236 | return mm->pgd + pgd_index(address); | ||
237 | } | ||
238 | |||
239 | /* to find an entry in a kernel page-table-directory */ | ||
240 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
241 | |||
242 | /* Find an entry in the third-level page table.. */ | ||
243 | #define __pte_offset(address) \ | ||
244 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
245 | #define pte_offset_kernel(dir, address) \ | ||
246 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) | ||
247 | #define pte_offset_map(dir, address) \ | ||
248 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | ||
249 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | ||
250 | |||
251 | #define pte_unmap(pte) do { } while (0) | ||
252 | #define pte_unmap_nested(pte) do { } while (0) | ||
253 | #define pte_pfn(x) ((unsigned long)(__va((x).pte)) >> PAGE_SHIFT) | ||
254 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
255 | |||
256 | #define pte_ERROR(e) \ | ||
257 | printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) | ||
258 | #define pgd_ERROR(e) \ | ||
259 | printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) | ||
260 | |||
261 | |||
262 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* defined in head.S */ | ||
263 | |||
264 | /* | ||
265 | * CRIS doesn't have any external MMU info: the kernel page | ||
266 | * tables contain all the necessary information. | ||
267 | * | ||
268 | * Actually I am not sure on what this could be used for. | ||
269 | */ | ||
270 | static inline void update_mmu_cache(struct vm_area_struct * vma, | ||
271 | unsigned long address, pte_t pte) | ||
272 | { | ||
273 | } | ||
274 | |||
275 | /* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */ | ||
276 | /* Since the PAGE_PRESENT bit is bit 4, we can use the bits above */ | ||
277 | |||
278 | #define __swp_type(x) (((x).val >> 5) & 0x7f) | ||
279 | #define __swp_offset(x) ((x).val >> 12) | ||
280 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 5) | ((offset) << 12) }) | ||
281 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
282 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
283 | |||
284 | #define kern_addr_valid(addr) (1) | ||
285 | |||
286 | #include <asm-generic/pgtable.h> | ||
287 | |||
288 | /* | ||
289 | * No page table caches to initialise | ||
290 | */ | ||
291 | #define pgtable_cache_init() do { } while (0) | ||
292 | |||
293 | #define pte_to_pgoff(x) (pte_val(x) >> 6) | ||
294 | #define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE) | ||
295 | |||
296 | typedef pte_t *pte_addr_t; | ||
297 | |||
298 | #endif /* __ASSEMBLY__ */ | ||
299 | #endif /* _CRIS_PGTABLE_H */ | ||
diff --git a/arch/cris/include/asm/poll.h b/arch/cris/include/asm/poll.h new file mode 100644 index 000000000000..c98509d3149e --- /dev/null +++ b/arch/cris/include/asm/poll.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/poll.h> | |||
diff --git a/arch/cris/include/asm/posix_types.h b/arch/cris/include/asm/posix_types.h new file mode 100644 index 000000000000..ce3fb25a460b --- /dev/null +++ b/arch/cris/include/asm/posix_types.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* $Id: posix_types.h,v 1.1 2000/07/10 16:32:31 bjornw Exp $ */ | ||
2 | |||
3 | /* We cheat a bit and use our C-coded bitops functions from asm/bitops.h */ | ||
4 | /* I guess we should write these in assembler because they are used often. */ | ||
5 | |||
6 | #ifndef __ARCH_CRIS_POSIX_TYPES_H | ||
7 | #define __ARCH_CRIS_POSIX_TYPES_H | ||
8 | |||
9 | /* | ||
10 | * This file is generally used by user-level software, so you need to | ||
11 | * be a little careful about namespace pollution etc. Also, we cannot | ||
12 | * assume GCC is being used. | ||
13 | */ | ||
14 | |||
15 | typedef unsigned long __kernel_ino_t; | ||
16 | typedef unsigned short __kernel_mode_t; | ||
17 | typedef unsigned short __kernel_nlink_t; | ||
18 | typedef long __kernel_off_t; | ||
19 | typedef int __kernel_pid_t; | ||
20 | typedef unsigned short __kernel_ipc_pid_t; | ||
21 | typedef unsigned short __kernel_uid_t; | ||
22 | typedef unsigned short __kernel_gid_t; | ||
23 | typedef __SIZE_TYPE__ __kernel_size_t; | ||
24 | typedef long __kernel_ssize_t; | ||
25 | typedef int __kernel_ptrdiff_t; | ||
26 | typedef long __kernel_time_t; | ||
27 | typedef long __kernel_suseconds_t; | ||
28 | typedef long __kernel_clock_t; | ||
29 | typedef int __kernel_timer_t; | ||
30 | typedef int __kernel_clockid_t; | ||
31 | typedef int __kernel_daddr_t; | ||
32 | typedef char * __kernel_caddr_t; | ||
33 | typedef unsigned short __kernel_uid16_t; | ||
34 | typedef unsigned short __kernel_gid16_t; | ||
35 | typedef unsigned int __kernel_uid32_t; | ||
36 | typedef unsigned int __kernel_gid32_t; | ||
37 | |||
38 | typedef unsigned short __kernel_old_uid_t; | ||
39 | typedef unsigned short __kernel_old_gid_t; | ||
40 | typedef unsigned short __kernel_old_dev_t; | ||
41 | |||
42 | #ifdef __GNUC__ | ||
43 | typedef long long __kernel_loff_t; | ||
44 | #endif | ||
45 | |||
46 | typedef struct { | ||
47 | int val[2]; | ||
48 | } __kernel_fsid_t; | ||
49 | |||
50 | #ifdef __KERNEL__ | ||
51 | |||
52 | #undef __FD_SET | ||
53 | #define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp)) | ||
54 | |||
55 | #undef __FD_CLR | ||
56 | #define __FD_CLR(fd,fdsetp) clear_bit(fd, (void *)(fdsetp)) | ||
57 | |||
58 | #undef __FD_ISSET | ||
59 | #define __FD_ISSET(fd,fdsetp) test_bit(fd, (void *)(fdsetp)) | ||
60 | |||
61 | #undef __FD_ZERO | ||
62 | #define __FD_ZERO(fdsetp) memset((void *)(fdsetp), 0, __FDSET_LONGS << 2) | ||
63 | |||
64 | #endif /* __KERNEL__ */ | ||
65 | |||
66 | #endif /* __ARCH_CRIS_POSIX_TYPES_H */ | ||
diff --git a/arch/cris/include/asm/processor.h b/arch/cris/include/asm/processor.h new file mode 100644 index 000000000000..3f7248f7a1c9 --- /dev/null +++ b/arch/cris/include/asm/processor.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * include/asm-cris/processor.h | ||
3 | * | ||
4 | * Copyright (C) 2000, 2001 Axis Communications AB | ||
5 | * | ||
6 | * Authors: Bjorn Wesen Initial version | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef __ASM_CRIS_PROCESSOR_H | ||
11 | #define __ASM_CRIS_PROCESSOR_H | ||
12 | |||
13 | #include <asm/system.h> | ||
14 | #include <asm/page.h> | ||
15 | #include <asm/ptrace.h> | ||
16 | #include <arch/processor.h> | ||
17 | |||
18 | struct task_struct; | ||
19 | |||
20 | #define STACK_TOP TASK_SIZE | ||
21 | #define STACK_TOP_MAX STACK_TOP | ||
22 | |||
23 | /* This decides where the kernel will search for a free chunk of vm | ||
24 | * space during mmap's. | ||
25 | */ | ||
26 | #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) | ||
27 | |||
28 | /* THREAD_SIZE is the size of the task_struct/kernel_stack combo. | ||
29 | * normally, the stack is found by doing something like p + THREAD_SIZE | ||
30 | * in CRIS, a page is 8192 bytes, which seems like a sane size | ||
31 | */ | ||
32 | |||
33 | #define THREAD_SIZE PAGE_SIZE | ||
34 | #define KERNEL_STACK_SIZE PAGE_SIZE | ||
35 | |||
36 | /* | ||
37 | * At user->kernel entry, the pt_regs struct is stacked on the top of the kernel-stack. | ||
38 | * This macro allows us to find those regs for a task. | ||
39 | * Notice that subsequent pt_regs stackings, like recursive interrupts occurring while | ||
40 | * we're in the kernel, won't affect this - only the first user->kernel transition | ||
41 | * registers are reached by this. | ||
42 | */ | ||
43 | |||
44 | #define user_regs(thread_info) (((struct pt_regs *)((unsigned long)(thread_info) + THREAD_SIZE)) - 1) | ||
45 | |||
46 | /* | ||
47 | * Dito but for the currently running task | ||
48 | */ | ||
49 | |||
50 | #define task_pt_regs(task) user_regs(task_thread_info(task)) | ||
51 | #define current_regs() task_pt_regs(current) | ||
52 | |||
53 | static inline void prepare_to_copy(struct task_struct *tsk) | ||
54 | { | ||
55 | } | ||
56 | |||
57 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
58 | |||
59 | unsigned long get_wchan(struct task_struct *p); | ||
60 | |||
61 | #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) | ||
62 | |||
63 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | ||
64 | |||
65 | /* Free all resources held by a thread. */ | ||
66 | static inline void release_thread(struct task_struct *dead_task) | ||
67 | { | ||
68 | /* Nothing needs to be done. */ | ||
69 | } | ||
70 | |||
71 | #define init_stack (init_thread_union.stack) | ||
72 | |||
73 | #define cpu_relax() barrier() | ||
74 | |||
75 | #endif /* __ASM_CRIS_PROCESSOR_H */ | ||
diff --git a/arch/cris/include/asm/ptrace.h b/arch/cris/include/asm/ptrace.h new file mode 100644 index 000000000000..6618893bfe8e --- /dev/null +++ b/arch/cris/include/asm/ptrace.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _CRIS_PTRACE_H | ||
2 | #define _CRIS_PTRACE_H | ||
3 | |||
4 | #include <arch/ptrace.h> | ||
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | |||
8 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
9 | #define PTRACE_GETREGS 12 | ||
10 | #define PTRACE_SETREGS 13 | ||
11 | |||
12 | #define profile_pc(regs) instruction_pointer(regs) | ||
13 | |||
14 | #endif /* __KERNEL__ */ | ||
15 | |||
16 | #endif /* _CRIS_PTRACE_H */ | ||
diff --git a/arch/cris/include/asm/resource.h b/arch/cris/include/asm/resource.h new file mode 100644 index 000000000000..b5d29448de4e --- /dev/null +++ b/arch/cris/include/asm/resource.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _CRIS_RESOURCE_H | ||
2 | #define _CRIS_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/cris/include/asm/rs485.h b/arch/cris/include/asm/rs485.h new file mode 100644 index 000000000000..c331c51b0c2b --- /dev/null +++ b/arch/cris/include/asm/rs485.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* RS-485 structures */ | ||
2 | |||
3 | /* RS-485 support */ | ||
4 | /* Used with ioctl() TIOCSERSETRS485 */ | ||
5 | struct rs485_control { | ||
6 | unsigned short rts_on_send; | ||
7 | unsigned short rts_after_sent; | ||
8 | unsigned long delay_rts_before_send; | ||
9 | unsigned short enabled; | ||
10 | #ifdef __KERNEL__ | ||
11 | int disable_serial_loopback; | ||
12 | #endif | ||
13 | }; | ||
14 | |||
15 | /* Used with ioctl() TIOCSERWRRS485 */ | ||
16 | struct rs485_write { | ||
17 | unsigned short outc_size; | ||
18 | unsigned char *outc; | ||
19 | }; | ||
20 | |||
diff --git a/arch/cris/include/asm/rtc.h b/arch/cris/include/asm/rtc.h new file mode 100644 index 000000000000..17d3019529e1 --- /dev/null +++ b/arch/cris/include/asm/rtc.h | |||
@@ -0,0 +1,107 @@ | |||
1 | |||
2 | #ifndef __RTC_H__ | ||
3 | #define __RTC_H__ | ||
4 | |||
5 | #ifdef CONFIG_ETRAX_DS1302 | ||
6 | /* Dallas DS1302 clock/calendar register numbers. */ | ||
7 | # define RTC_SECONDS 0 | ||
8 | # define RTC_MINUTES 1 | ||
9 | # define RTC_HOURS 2 | ||
10 | # define RTC_DAY_OF_MONTH 3 | ||
11 | # define RTC_MONTH 4 | ||
12 | # define RTC_WEEKDAY 5 | ||
13 | # define RTC_YEAR 6 | ||
14 | # define RTC_CONTROL 7 | ||
15 | |||
16 | /* Bits in CONTROL register. */ | ||
17 | # define RTC_CONTROL_WRITEPROTECT 0x80 | ||
18 | # define RTC_TRICKLECHARGER 8 | ||
19 | |||
20 | /* Bits in TRICKLECHARGER register TCS TCS TCS TCS DS DS RS RS. */ | ||
21 | # define RTC_TCR_PATTERN 0xA0 /* 1010xxxx */ | ||
22 | # define RTC_TCR_1DIOD 0x04 /* xxxx01xx */ | ||
23 | # define RTC_TCR_2DIOD 0x08 /* xxxx10xx */ | ||
24 | # define RTC_TCR_DISABLED 0x00 /* xxxxxx00 Disabled */ | ||
25 | # define RTC_TCR_2KOHM 0x01 /* xxxxxx01 2KOhm */ | ||
26 | # define RTC_TCR_4KOHM 0x02 /* xxxxxx10 4kOhm */ | ||
27 | # define RTC_TCR_8KOHM 0x03 /* xxxxxx11 8kOhm */ | ||
28 | |||
29 | #elif defined(CONFIG_ETRAX_PCF8563) | ||
30 | /* I2C bus slave registers. */ | ||
31 | # define RTC_I2C_READ 0xa3 | ||
32 | # define RTC_I2C_WRITE 0xa2 | ||
33 | |||
34 | /* Phillips PCF8563 registers. */ | ||
35 | # define RTC_CONTROL1 0x00 /* Control/Status register 1. */ | ||
36 | # define RTC_CONTROL2 0x01 /* Control/Status register 2. */ | ||
37 | # define RTC_CLOCKOUT_FREQ 0x0d /* CLKOUT frequency. */ | ||
38 | # define RTC_TIMER_CONTROL 0x0e /* Timer control. */ | ||
39 | # define RTC_TIMER_CNTDOWN 0x0f /* Timer countdown. */ | ||
40 | |||
41 | /* BCD encoded clock registers. */ | ||
42 | # define RTC_SECONDS 0x02 | ||
43 | # define RTC_MINUTES 0x03 | ||
44 | # define RTC_HOURS 0x04 | ||
45 | # define RTC_DAY_OF_MONTH 0x05 | ||
46 | # define RTC_WEEKDAY 0x06 /* Not coded in BCD! */ | ||
47 | # define RTC_MONTH 0x07 | ||
48 | # define RTC_YEAR 0x08 | ||
49 | # define RTC_MINUTE_ALARM 0x09 | ||
50 | # define RTC_HOUR_ALARM 0x0a | ||
51 | # define RTC_DAY_ALARM 0x0b | ||
52 | # define RTC_WEEKDAY_ALARM 0x0c | ||
53 | |||
54 | #endif | ||
55 | |||
56 | #ifdef CONFIG_ETRAX_DS1302 | ||
57 | extern unsigned char ds1302_readreg(int reg); | ||
58 | extern void ds1302_writereg(int reg, unsigned char val); | ||
59 | extern int ds1302_init(void); | ||
60 | # define CMOS_READ(x) ds1302_readreg(x) | ||
61 | # define CMOS_WRITE(val,reg) ds1302_writereg(reg,val) | ||
62 | # define RTC_INIT() ds1302_init() | ||
63 | #elif defined(CONFIG_ETRAX_PCF8563) | ||
64 | extern unsigned char pcf8563_readreg(int reg); | ||
65 | extern void pcf8563_writereg(int reg, unsigned char val); | ||
66 | extern int pcf8563_init(void); | ||
67 | # define CMOS_READ(x) pcf8563_readreg(x) | ||
68 | # define CMOS_WRITE(val,reg) pcf8563_writereg(reg,val) | ||
69 | # define RTC_INIT() pcf8563_init() | ||
70 | #else | ||
71 | /* No RTC configured so we shouldn't try to access any. */ | ||
72 | # define CMOS_READ(x) 42 | ||
73 | # define CMOS_WRITE(x,y) | ||
74 | # define RTC_INIT() (-1) | ||
75 | #endif | ||
76 | |||
77 | /* | ||
78 | * The struct used to pass data via the following ioctl. Similar to the | ||
79 | * struct tm in <time.h>, but it needs to be here so that the kernel | ||
80 | * source is self contained, allowing cross-compiles, etc. etc. | ||
81 | */ | ||
82 | struct rtc_time { | ||
83 | int tm_sec; | ||
84 | int tm_min; | ||
85 | int tm_hour; | ||
86 | int tm_mday; | ||
87 | int tm_mon; | ||
88 | int tm_year; | ||
89 | int tm_wday; | ||
90 | int tm_yday; | ||
91 | int tm_isdst; | ||
92 | }; | ||
93 | |||
94 | /* ioctl() calls that are permitted to the /dev/rtc interface. */ | ||
95 | #define RTC_MAGIC 'p' | ||
96 | /* Read RTC time. */ | ||
97 | #define RTC_RD_TIME _IOR(RTC_MAGIC, 0x09, struct rtc_time) | ||
98 | /* Set RTC time. */ | ||
99 | #define RTC_SET_TIME _IOW(RTC_MAGIC, 0x0a, struct rtc_time) | ||
100 | #define RTC_SET_CHARGE _IOW(RTC_MAGIC, 0x0b, int) | ||
101 | /* Voltage low detector */ | ||
102 | #define RTC_VL_READ _IOR(RTC_MAGIC, 0x13, int) | ||
103 | /* Clear voltage low information */ | ||
104 | #define RTC_VL_CLR _IO(RTC_MAGIC, 0x14) | ||
105 | #define RTC_MAX_IOCTL 0x14 | ||
106 | |||
107 | #endif /* __RTC_H__ */ | ||
diff --git a/arch/cris/include/asm/scatterlist.h b/arch/cris/include/asm/scatterlist.h new file mode 100644 index 000000000000..faff53ad1f96 --- /dev/null +++ b/arch/cris/include/asm/scatterlist.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __ASM_CRIS_SCATTERLIST_H | ||
2 | #define __ASM_CRIS_SCATTERLIST_H | ||
3 | |||
4 | struct scatterlist { | ||
5 | #ifdef CONFIG_DEBUG_SG | ||
6 | unsigned long sg_magic; | ||
7 | #endif | ||
8 | char * address; /* Location data is to be transferred to */ | ||
9 | unsigned int length; | ||
10 | |||
11 | /* The following is i386 highmem junk - not used by us */ | ||
12 | unsigned long page_link; | ||
13 | unsigned int offset;/* for highmem, page offset */ | ||
14 | |||
15 | }; | ||
16 | |||
17 | #define sg_dma_address(sg) ((sg)->address) | ||
18 | #define sg_dma_len(sg) ((sg)->length) | ||
19 | /* i386 junk */ | ||
20 | |||
21 | #define ISA_DMA_THRESHOLD (0x1fffffff) | ||
22 | |||
23 | #endif /* !(__ASM_CRIS_SCATTERLIST_H) */ | ||
diff --git a/arch/cris/include/asm/sections.h b/arch/cris/include/asm/sections.h new file mode 100644 index 000000000000..2c998ce8967b --- /dev/null +++ b/arch/cris/include/asm/sections.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _CRIS_SECTIONS_H | ||
2 | #define _CRIS_SECTIONS_H | ||
3 | |||
4 | /* nothing to see, move along */ | ||
5 | #include <asm-generic/sections.h> | ||
6 | |||
7 | #endif | ||
diff --git a/arch/cris/include/asm/segment.h b/arch/cris/include/asm/segment.h new file mode 100644 index 000000000000..c067513beaaf --- /dev/null +++ b/arch/cris/include/asm/segment.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_SEGMENT_H | ||
2 | #define _ASM_SEGMENT_H | ||
3 | |||
4 | typedef struct { | ||
5 | unsigned long seg; | ||
6 | } mm_segment_t; | ||
7 | |||
8 | #endif | ||
diff --git a/arch/cris/include/asm/sembuf.h b/arch/cris/include/asm/sembuf.h new file mode 100644 index 000000000000..7fed9843796d --- /dev/null +++ b/arch/cris/include/asm/sembuf.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _CRIS_SEMBUF_H | ||
2 | #define _CRIS_SEMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The semid64_ds structure for CRIS architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct semid64_ds { | ||
15 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | ||
16 | __kernel_time_t sem_otime; /* last semop time */ | ||
17 | unsigned long __unused1; | ||
18 | __kernel_time_t sem_ctime; /* last change time */ | ||
19 | unsigned long __unused2; | ||
20 | unsigned long sem_nsems; /* no. of semaphores in array */ | ||
21 | unsigned long __unused3; | ||
22 | unsigned long __unused4; | ||
23 | }; | ||
24 | |||
25 | #endif /* _CRIS_SEMBUF_H */ | ||
diff --git a/arch/cris/include/asm/setup.h b/arch/cris/include/asm/setup.h new file mode 100644 index 000000000000..b90728652d1a --- /dev/null +++ b/arch/cris/include/asm/setup.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _CRIS_SETUP_H | ||
2 | #define _CRIS_SETUP_H | ||
3 | |||
4 | #define COMMAND_LINE_SIZE 256 | ||
5 | |||
6 | #endif | ||
diff --git a/arch/cris/include/asm/shmbuf.h b/arch/cris/include/asm/shmbuf.h new file mode 100644 index 000000000000..3239e3f000e8 --- /dev/null +++ b/arch/cris/include/asm/shmbuf.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _CRIS_SHMBUF_H | ||
2 | #define _CRIS_SHMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The shmid64_ds structure for CRIS architecture (same as for i386) | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct shmid64_ds { | ||
15 | struct ipc64_perm shm_perm; /* operation perms */ | ||
16 | size_t shm_segsz; /* size of segment (bytes) */ | ||
17 | __kernel_time_t shm_atime; /* last attach time */ | ||
18 | unsigned long __unused1; | ||
19 | __kernel_time_t shm_dtime; /* last detach time */ | ||
20 | unsigned long __unused2; | ||
21 | __kernel_time_t shm_ctime; /* last change time */ | ||
22 | unsigned long __unused3; | ||
23 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
24 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
25 | unsigned long shm_nattch; /* no. of current attaches */ | ||
26 | unsigned long __unused4; | ||
27 | unsigned long __unused5; | ||
28 | }; | ||
29 | |||
30 | struct shminfo64 { | ||
31 | unsigned long shmmax; | ||
32 | unsigned long shmmin; | ||
33 | unsigned long shmmni; | ||
34 | unsigned long shmseg; | ||
35 | unsigned long shmall; | ||
36 | unsigned long __unused1; | ||
37 | unsigned long __unused2; | ||
38 | unsigned long __unused3; | ||
39 | unsigned long __unused4; | ||
40 | }; | ||
41 | |||
42 | #endif /* _CRIS_SHMBUF_H */ | ||
diff --git a/arch/cris/include/asm/shmparam.h b/arch/cris/include/asm/shmparam.h new file mode 100644 index 000000000000..d29d12270687 --- /dev/null +++ b/arch/cris/include/asm/shmparam.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_CRIS_SHMPARAM_H | ||
2 | #define _ASM_CRIS_SHMPARAM_H | ||
3 | |||
4 | /* same as asm-i386/ version.. */ | ||
5 | |||
6 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | ||
7 | |||
8 | #endif /* _ASM_CRIS_SHMPARAM_H */ | ||
diff --git a/arch/cris/include/asm/sigcontext.h b/arch/cris/include/asm/sigcontext.h new file mode 100644 index 000000000000..a1d634e120df --- /dev/null +++ b/arch/cris/include/asm/sigcontext.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* $Id: sigcontext.h,v 1.1 2000/07/10 16:32:31 bjornw Exp $ */ | ||
2 | |||
3 | #ifndef _ASM_CRIS_SIGCONTEXT_H | ||
4 | #define _ASM_CRIS_SIGCONTEXT_H | ||
5 | |||
6 | #include <asm/ptrace.h> | ||
7 | |||
8 | /* This struct is saved by setup_frame in signal.c, to keep the current context while | ||
9 | a signal handler is executed. It's restored by sys_sigreturn. | ||
10 | |||
11 | To keep things simple, we use pt_regs here even though normally you just specify | ||
12 | the list of regs to save. Then we can use copy_from_user on the entire regs instead | ||
13 | of a bunch of get_user's as well... | ||
14 | |||
15 | */ | ||
16 | |||
17 | struct sigcontext { | ||
18 | struct pt_regs regs; /* needs to be first */ | ||
19 | unsigned long oldmask; | ||
20 | unsigned long usp; /* usp before stacking this gunk on it */ | ||
21 | }; | ||
22 | |||
23 | #endif | ||
24 | |||
diff --git a/arch/cris/include/asm/siginfo.h b/arch/cris/include/asm/siginfo.h new file mode 100644 index 000000000000..c1cd6d16928b --- /dev/null +++ b/arch/cris/include/asm/siginfo.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _CRIS_SIGINFO_H | ||
2 | #define _CRIS_SIGINFO_H | ||
3 | |||
4 | #include <asm-generic/siginfo.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/cris/include/asm/signal.h b/arch/cris/include/asm/signal.h new file mode 100644 index 000000000000..349ae682b568 --- /dev/null +++ b/arch/cris/include/asm/signal.h | |||
@@ -0,0 +1,163 @@ | |||
1 | #ifndef _ASM_CRIS_SIGNAL_H | ||
2 | #define _ASM_CRIS_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Avoid too many header ordering problems. */ | ||
7 | struct siginfo; | ||
8 | |||
9 | #ifdef __KERNEL__ | ||
10 | /* Most things should be clean enough to redefine this at will, if care | ||
11 | is taken to make libc match. */ | ||
12 | |||
13 | #define _NSIG 64 | ||
14 | #define _NSIG_BPW 32 | ||
15 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
16 | |||
17 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
18 | |||
19 | typedef struct { | ||
20 | unsigned long sig[_NSIG_WORDS]; | ||
21 | } sigset_t; | ||
22 | |||
23 | #else | ||
24 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
25 | |||
26 | #define NSIG 32 | ||
27 | typedef unsigned long sigset_t; | ||
28 | |||
29 | #endif /* __KERNEL__ */ | ||
30 | |||
31 | #define SIGHUP 1 | ||
32 | #define SIGINT 2 | ||
33 | #define SIGQUIT 3 | ||
34 | #define SIGILL 4 | ||
35 | #define SIGTRAP 5 | ||
36 | #define SIGABRT 6 | ||
37 | #define SIGIOT 6 | ||
38 | #define SIGBUS 7 | ||
39 | #define SIGFPE 8 | ||
40 | #define SIGKILL 9 | ||
41 | #define SIGUSR1 10 | ||
42 | #define SIGSEGV 11 | ||
43 | #define SIGUSR2 12 | ||
44 | #define SIGPIPE 13 | ||
45 | #define SIGALRM 14 | ||
46 | #define SIGTERM 15 | ||
47 | #define SIGSTKFLT 16 | ||
48 | #define SIGCHLD 17 | ||
49 | #define SIGCONT 18 | ||
50 | #define SIGSTOP 19 | ||
51 | #define SIGTSTP 20 | ||
52 | #define SIGTTIN 21 | ||
53 | #define SIGTTOU 22 | ||
54 | #define SIGURG 23 | ||
55 | #define SIGXCPU 24 | ||
56 | #define SIGXFSZ 25 | ||
57 | #define SIGVTALRM 26 | ||
58 | #define SIGPROF 27 | ||
59 | #define SIGWINCH 28 | ||
60 | #define SIGIO 29 | ||
61 | #define SIGPOLL SIGIO | ||
62 | /* | ||
63 | #define SIGLOST 29 | ||
64 | */ | ||
65 | #define SIGPWR 30 | ||
66 | #define SIGSYS 31 | ||
67 | #define SIGUNUSED 31 | ||
68 | |||
69 | /* These should not be considered constants from userland. */ | ||
70 | #define SIGRTMIN 32 | ||
71 | #define SIGRTMAX _NSIG | ||
72 | |||
73 | /* | ||
74 | * SA_FLAGS values: | ||
75 | * | ||
76 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
77 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
78 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
79 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
80 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
81 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
82 | * | ||
83 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
84 | * Unix names RESETHAND and NODEFER respectively. | ||
85 | */ | ||
86 | |||
87 | #define SA_NOCLDSTOP 0x00000001u | ||
88 | #define SA_NOCLDWAIT 0x00000002u | ||
89 | #define SA_SIGINFO 0x00000004u | ||
90 | #define SA_ONSTACK 0x08000000u | ||
91 | #define SA_RESTART 0x10000000u | ||
92 | #define SA_NODEFER 0x40000000u | ||
93 | #define SA_RESETHAND 0x80000000u | ||
94 | |||
95 | #define SA_NOMASK SA_NODEFER | ||
96 | #define SA_ONESHOT SA_RESETHAND | ||
97 | |||
98 | #define SA_RESTORER 0x04000000 | ||
99 | |||
100 | /* | ||
101 | * sigaltstack controls | ||
102 | */ | ||
103 | #define SS_ONSTACK 1 | ||
104 | #define SS_DISABLE 2 | ||
105 | |||
106 | #define MINSIGSTKSZ 2048 | ||
107 | #define SIGSTKSZ 8192 | ||
108 | |||
109 | #include <asm-generic/signal.h> | ||
110 | |||
111 | #ifdef __KERNEL__ | ||
112 | struct old_sigaction { | ||
113 | __sighandler_t sa_handler; | ||
114 | old_sigset_t sa_mask; | ||
115 | unsigned long sa_flags; | ||
116 | void (*sa_restorer)(void); | ||
117 | }; | ||
118 | |||
119 | struct sigaction { | ||
120 | __sighandler_t sa_handler; | ||
121 | unsigned long sa_flags; | ||
122 | void (*sa_restorer)(void); | ||
123 | sigset_t sa_mask; /* mask last for extensibility */ | ||
124 | }; | ||
125 | |||
126 | struct k_sigaction { | ||
127 | struct sigaction sa; | ||
128 | }; | ||
129 | #else | ||
130 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
131 | |||
132 | struct sigaction { | ||
133 | union { | ||
134 | __sighandler_t _sa_handler; | ||
135 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
136 | } _u; | ||
137 | sigset_t sa_mask; | ||
138 | unsigned long sa_flags; | ||
139 | void (*sa_restorer)(void); | ||
140 | }; | ||
141 | |||
142 | #define sa_handler _u._sa_handler | ||
143 | #define sa_sigaction _u._sa_sigaction | ||
144 | |||
145 | #endif /* __KERNEL__ */ | ||
146 | |||
147 | typedef struct sigaltstack { | ||
148 | void *ss_sp; | ||
149 | int ss_flags; | ||
150 | size_t ss_size; | ||
151 | } stack_t; | ||
152 | |||
153 | #ifdef __KERNEL__ | ||
154 | #include <asm/sigcontext.h> | ||
155 | |||
156 | /* here we could define asm-optimized sigaddset, sigdelset etc. operations. | ||
157 | * if we don't, generic ones are used from linux/signal.h | ||
158 | */ | ||
159 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
160 | |||
161 | #endif /* __KERNEL__ */ | ||
162 | |||
163 | #endif | ||
diff --git a/arch/cris/include/asm/smp.h b/arch/cris/include/asm/smp.h new file mode 100644 index 000000000000..dba33aba3e95 --- /dev/null +++ b/arch/cris/include/asm/smp.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __ASM_SMP_H | ||
2 | #define __ASM_SMP_H | ||
3 | |||
4 | #include <linux/cpumask.h> | ||
5 | |||
6 | extern cpumask_t phys_cpu_present_map; | ||
7 | extern cpumask_t cpu_possible_map; | ||
8 | |||
9 | #define raw_smp_processor_id() (current_thread_info()->cpu) | ||
10 | |||
11 | #endif | ||
diff --git a/arch/cris/include/asm/socket.h b/arch/cris/include/asm/socket.h new file mode 100644 index 000000000000..9df0ca82f5de --- /dev/null +++ b/arch/cris/include/asm/socket.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _ASM_SOCKET_H | ||
2 | #define _ASM_SOCKET_H | ||
3 | |||
4 | /* almost the same as asm-i386/socket.h */ | ||
5 | |||
6 | #include <asm/sockios.h> | ||
7 | |||
8 | /* For setsockoptions(2) */ | ||
9 | #define SOL_SOCKET 1 | ||
10 | |||
11 | #define SO_DEBUG 1 | ||
12 | #define SO_REUSEADDR 2 | ||
13 | #define SO_TYPE 3 | ||
14 | #define SO_ERROR 4 | ||
15 | #define SO_DONTROUTE 5 | ||
16 | #define SO_BROADCAST 6 | ||
17 | #define SO_SNDBUF 7 | ||
18 | #define SO_RCVBUF 8 | ||
19 | #define SO_SNDBUFFORCE 32 | ||
20 | #define SO_RCVBUFFORCE 33 | ||
21 | #define SO_KEEPALIVE 9 | ||
22 | #define SO_OOBINLINE 10 | ||
23 | #define SO_NO_CHECK 11 | ||
24 | #define SO_PRIORITY 12 | ||
25 | #define SO_LINGER 13 | ||
26 | #define SO_BSDCOMPAT 14 | ||
27 | /* To add :#define SO_REUSEPORT 15 */ | ||
28 | #define SO_PASSCRED 16 | ||
29 | #define SO_PEERCRED 17 | ||
30 | #define SO_RCVLOWAT 18 | ||
31 | #define SO_SNDLOWAT 19 | ||
32 | #define SO_RCVTIMEO 20 | ||
33 | #define SO_SNDTIMEO 21 | ||
34 | |||
35 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
36 | #define SO_SECURITY_AUTHENTICATION 22 | ||
37 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 | ||
38 | #define SO_SECURITY_ENCRYPTION_NETWORK 24 | ||
39 | |||
40 | #define SO_BINDTODEVICE 25 | ||
41 | |||
42 | /* Socket filtering */ | ||
43 | #define SO_ATTACH_FILTER 26 | ||
44 | #define SO_DETACH_FILTER 27 | ||
45 | |||
46 | #define SO_PEERNAME 28 | ||
47 | #define SO_TIMESTAMP 29 | ||
48 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
49 | |||
50 | #define SO_ACCEPTCONN 30 | ||
51 | |||
52 | #define SO_PEERSEC 31 | ||
53 | #define SO_PASSSEC 34 | ||
54 | #define SO_TIMESTAMPNS 35 | ||
55 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
56 | |||
57 | #define SO_MARK 36 | ||
58 | |||
59 | #endif /* _ASM_SOCKET_H */ | ||
60 | |||
61 | |||
diff --git a/arch/cris/include/asm/sockios.h b/arch/cris/include/asm/sockios.h new file mode 100644 index 000000000000..cfe7bfecf599 --- /dev/null +++ b/arch/cris/include/asm/sockios.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __ARCH_CRIS_SOCKIOS__ | ||
2 | #define __ARCH_CRIS_SOCKIOS__ | ||
3 | |||
4 | /* Socket-level I/O control calls. */ | ||
5 | #define FIOSETOWN 0x8901 | ||
6 | #define SIOCSPGRP 0x8902 | ||
7 | #define FIOGETOWN 0x8903 | ||
8 | #define SIOCGPGRP 0x8904 | ||
9 | #define SIOCATMARK 0x8905 | ||
10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ | ||
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
12 | |||
13 | #endif | ||
diff --git a/arch/cris/include/asm/spinlock.h b/arch/cris/include/asm/spinlock.h new file mode 100644 index 000000000000..ed816b57face --- /dev/null +++ b/arch/cris/include/asm/spinlock.h | |||
@@ -0,0 +1 @@ | |||
#include <arch/spinlock.h> | |||
diff --git a/arch/cris/include/asm/stat.h b/arch/cris/include/asm/stat.h new file mode 100644 index 000000000000..9e558cc3c43b --- /dev/null +++ b/arch/cris/include/asm/stat.h | |||
@@ -0,0 +1,81 @@ | |||
1 | #ifndef _CRIS_STAT_H | ||
2 | #define _CRIS_STAT_H | ||
3 | |||
4 | /* Keep this a verbatim copy of i386 version; tweak CRIS-specific bits in | ||
5 | the kernel if necessary. */ | ||
6 | |||
7 | struct __old_kernel_stat { | ||
8 | unsigned short st_dev; | ||
9 | unsigned short st_ino; | ||
10 | unsigned short st_mode; | ||
11 | unsigned short st_nlink; | ||
12 | unsigned short st_uid; | ||
13 | unsigned short st_gid; | ||
14 | unsigned short st_rdev; | ||
15 | unsigned long st_size; | ||
16 | unsigned long st_atime; | ||
17 | unsigned long st_mtime; | ||
18 | unsigned long st_ctime; | ||
19 | }; | ||
20 | |||
21 | #define STAT_HAVE_NSEC 1 | ||
22 | |||
23 | struct stat { | ||
24 | unsigned long st_dev; | ||
25 | unsigned long st_ino; | ||
26 | unsigned short st_mode; | ||
27 | unsigned short st_nlink; | ||
28 | unsigned short st_uid; | ||
29 | unsigned short st_gid; | ||
30 | unsigned long st_rdev; | ||
31 | unsigned long st_size; | ||
32 | unsigned long st_blksize; | ||
33 | unsigned long st_blocks; | ||
34 | unsigned long st_atime; | ||
35 | unsigned long st_atime_nsec; | ||
36 | unsigned long st_mtime; | ||
37 | unsigned long st_mtime_nsec; | ||
38 | unsigned long st_ctime; | ||
39 | unsigned long st_ctime_nsec; | ||
40 | unsigned long __unused4; | ||
41 | unsigned long __unused5; | ||
42 | }; | ||
43 | |||
44 | /* This matches struct stat64 in glibc2.1, hence the absolutely | ||
45 | * insane amounts of padding around dev_t's. | ||
46 | */ | ||
47 | struct stat64 { | ||
48 | unsigned long long st_dev; | ||
49 | unsigned char __pad0[4]; | ||
50 | |||
51 | #define STAT64_HAS_BROKEN_ST_INO 1 | ||
52 | unsigned long __st_ino; | ||
53 | |||
54 | unsigned int st_mode; | ||
55 | unsigned int st_nlink; | ||
56 | |||
57 | unsigned long st_uid; | ||
58 | unsigned long st_gid; | ||
59 | |||
60 | unsigned long long st_rdev; | ||
61 | unsigned char __pad3[4]; | ||
62 | |||
63 | long long st_size; | ||
64 | unsigned long st_blksize; | ||
65 | |||
66 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | ||
67 | unsigned long __pad4; /* future possible st_blocks high bits */ | ||
68 | |||
69 | unsigned long st_atime; | ||
70 | unsigned long st_atime_nsec; | ||
71 | |||
72 | unsigned long st_mtime; | ||
73 | unsigned long st_mtime_nsec; | ||
74 | |||
75 | unsigned long st_ctime; | ||
76 | unsigned long st_ctime_nsec; /* will be high 32 bits of ctime someday */ | ||
77 | |||
78 | unsigned long long st_ino; | ||
79 | }; | ||
80 | |||
81 | #endif | ||
diff --git a/arch/cris/include/asm/statfs.h b/arch/cris/include/asm/statfs.h new file mode 100644 index 000000000000..fdaf921844bc --- /dev/null +++ b/arch/cris/include/asm/statfs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _CRIS_STATFS_H | ||
2 | #define _CRIS_STATFS_H | ||
3 | |||
4 | #include <asm-generic/statfs.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/cris/include/asm/string.h b/arch/cris/include/asm/string.h new file mode 100644 index 000000000000..691190e99a27 --- /dev/null +++ b/arch/cris/include/asm/string.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _ASM_CRIS_STRING_H | ||
2 | #define _ASM_CRIS_STRING_H | ||
3 | |||
4 | /* the optimized memcpy is in arch/cris/lib/string.c */ | ||
5 | |||
6 | #define __HAVE_ARCH_MEMCPY | ||
7 | extern void *memcpy(void *, const void *, size_t); | ||
8 | |||
9 | /* New and improved. In arch/cris/lib/memset.c */ | ||
10 | |||
11 | #define __HAVE_ARCH_MEMSET | ||
12 | extern void *memset(void *, int, size_t); | ||
13 | |||
14 | #endif | ||
diff --git a/arch/cris/include/asm/sync_serial.h b/arch/cris/include/asm/sync_serial.h new file mode 100644 index 000000000000..d87c24df2b38 --- /dev/null +++ b/arch/cris/include/asm/sync_serial.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | * ioctl defines for synchronous serial port driver | ||
3 | * | ||
4 | * Copyright (c) 2001-2003 Axis Communications AB | ||
5 | * | ||
6 | * Author: Mikael Starvik | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef SYNC_SERIAL_H | ||
11 | #define SYNC_SERIAL_H | ||
12 | |||
13 | #include <linux/ioctl.h> | ||
14 | |||
15 | #define SSP_SPEED _IOR('S', 0, unsigned int) | ||
16 | #define SSP_MODE _IOR('S', 1, unsigned int) | ||
17 | #define SSP_FRAME_SYNC _IOR('S', 2, unsigned int) | ||
18 | #define SSP_IPOLARITY _IOR('S', 3, unsigned int) | ||
19 | #define SSP_OPOLARITY _IOR('S', 4, unsigned int) | ||
20 | #define SSP_SPI _IOR('S', 5, unsigned int) | ||
21 | #define SSP_INBUFCHUNK _IOR('S', 6, unsigned int) | ||
22 | |||
23 | /* Values for SSP_SPEED */ | ||
24 | #define SSP150 0 | ||
25 | #define SSP300 1 | ||
26 | #define SSP600 2 | ||
27 | #define SSP1200 3 | ||
28 | #define SSP2400 4 | ||
29 | #define SSP4800 5 | ||
30 | #define SSP9600 6 | ||
31 | #define SSP19200 7 | ||
32 | #define SSP28800 8 | ||
33 | #define SSP57600 9 | ||
34 | #define SSP115200 10 | ||
35 | #define SSP230400 11 | ||
36 | #define SSP460800 12 | ||
37 | #define SSP921600 13 | ||
38 | #define SSP3125000 14 | ||
39 | #define CODEC 15 | ||
40 | |||
41 | #define FREQ_4MHz 0 | ||
42 | #define FREQ_2MHz 1 | ||
43 | #define FREQ_1MHz 2 | ||
44 | #define FREQ_512kHz 3 | ||
45 | #define FREQ_256kHz 4 | ||
46 | #define FREQ_128kHz 5 | ||
47 | #define FREQ_64kHz 6 | ||
48 | #define FREQ_32kHz 7 | ||
49 | |||
50 | /* Used by application to set CODEC divider, word rate and frame rate */ | ||
51 | #define CODEC_VAL(freq, clk_per_sync, sync_per_frame) (CODEC | (freq << 8) | (clk_per_sync << 16) | (sync_per_frame << 28)) | ||
52 | |||
53 | /* Used by driver to extract speed */ | ||
54 | #define GET_SPEED(x) (x & 0xff) | ||
55 | #define GET_FREQ(x) ((x & 0xff00) >> 8) | ||
56 | #define GET_WORD_RATE(x) (((x & 0x0fff0000) >> 16) - 1) | ||
57 | #define GET_FRAME_RATE(x) (((x & 0xf0000000) >> 28) - 1) | ||
58 | |||
59 | /* Values for SSP_MODE */ | ||
60 | #define MASTER_OUTPUT 0 | ||
61 | #define SLAVE_OUTPUT 1 | ||
62 | #define MASTER_INPUT 2 | ||
63 | #define SLAVE_INPUT 3 | ||
64 | #define MASTER_BIDIR 4 | ||
65 | #define SLAVE_BIDIR 5 | ||
66 | |||
67 | /* Values for SSP_FRAME_SYNC */ | ||
68 | #define NORMAL_SYNC 1 | ||
69 | #define EARLY_SYNC 2 | ||
70 | #define SECOND_WORD_SYNC 0x40000 | ||
71 | |||
72 | #define BIT_SYNC 4 | ||
73 | #define WORD_SYNC 8 | ||
74 | #define EXTENDED_SYNC 0x10 | ||
75 | |||
76 | #define SYNC_OFF 0x20 | ||
77 | #define SYNC_ON 0x40 | ||
78 | #define WORD_SIZE_8 0x80 | ||
79 | #define WORD_SIZE_12 0x100 | ||
80 | #define WORD_SIZE_16 0x200 | ||
81 | #define WORD_SIZE_24 0x400 | ||
82 | #define WORD_SIZE_32 0x800 | ||
83 | #define BIT_ORDER_LSB 0x1000 | ||
84 | #define BIT_ORDER_MSB 0x2000 | ||
85 | #define FLOW_CONTROL_ENABLE 0x4000 | ||
86 | #define FLOW_CONTROL_DISABLE 0x8000 | ||
87 | #define CLOCK_GATED 0x10000 | ||
88 | #define CLOCK_NOT_GATED 0x20000 | ||
89 | |||
90 | /* Values for SSP_IPOLARITY and SSP_OPOLARITY */ | ||
91 | #define CLOCK_NORMAL 1 | ||
92 | #define CLOCK_INVERT 2 | ||
93 | #define CLOCK_INEGEDGE CLOCK_NORMAL | ||
94 | #define CLOCK_IPOSEDGE CLOCK_INVERT | ||
95 | #define FRAME_NORMAL 4 | ||
96 | #define FRAME_INVERT 8 | ||
97 | #define STATUS_NORMAL 0x10 | ||
98 | #define STATUS_INVERT 0x20 | ||
99 | |||
100 | /* Values for SSP_SPI */ | ||
101 | #define SPI_MASTER 0 | ||
102 | #define SPI_SLAVE 1 | ||
103 | |||
104 | /* Values for SSP_INBUFCHUNK */ | ||
105 | /* plain integer with the size of DMA chunks */ | ||
106 | |||
107 | #endif | ||
diff --git a/arch/cris/include/asm/system.h b/arch/cris/include/asm/system.h new file mode 100644 index 000000000000..8657b084a922 --- /dev/null +++ b/arch/cris/include/asm/system.h | |||
@@ -0,0 +1,88 @@ | |||
1 | #ifndef __ASM_CRIS_SYSTEM_H | ||
2 | #define __ASM_CRIS_SYSTEM_H | ||
3 | |||
4 | #include <arch/system.h> | ||
5 | |||
6 | /* the switch_to macro calls resume, an asm function in entry.S which does the actual | ||
7 | * task switching. | ||
8 | */ | ||
9 | |||
10 | extern struct task_struct *resume(struct task_struct *prev, struct task_struct *next, int); | ||
11 | #define switch_to(prev,next,last) last = resume(prev,next, \ | ||
12 | (int)&((struct task_struct *)0)->thread) | ||
13 | |||
14 | #define barrier() __asm__ __volatile__("": : :"memory") | ||
15 | #define mb() barrier() | ||
16 | #define rmb() mb() | ||
17 | #define wmb() mb() | ||
18 | #define read_barrier_depends() do { } while(0) | ||
19 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
20 | |||
21 | #ifdef CONFIG_SMP | ||
22 | #define smp_mb() mb() | ||
23 | #define smp_rmb() rmb() | ||
24 | #define smp_wmb() wmb() | ||
25 | #define smp_read_barrier_depends() read_barrier_depends() | ||
26 | #else | ||
27 | #define smp_mb() barrier() | ||
28 | #define smp_rmb() barrier() | ||
29 | #define smp_wmb() barrier() | ||
30 | #define smp_read_barrier_depends() do { } while(0) | ||
31 | #endif | ||
32 | |||
33 | #define iret() | ||
34 | |||
35 | /* | ||
36 | * disable hlt during certain critical i/o operations | ||
37 | */ | ||
38 | #define HAVE_DISABLE_HLT | ||
39 | void disable_hlt(void); | ||
40 | void enable_hlt(void); | ||
41 | |||
42 | static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | ||
43 | { | ||
44 | /* since Etrax doesn't have any atomic xchg instructions, we need to disable | ||
45 | irq's (if enabled) and do it with move.d's */ | ||
46 | unsigned long flags,temp; | ||
47 | local_irq_save(flags); /* save flags, including irq enable bit and shut off irqs */ | ||
48 | switch (size) { | ||
49 | case 1: | ||
50 | *((unsigned char *)&temp) = x; | ||
51 | x = *(unsigned char *)ptr; | ||
52 | *(unsigned char *)ptr = *((unsigned char *)&temp); | ||
53 | break; | ||
54 | case 2: | ||
55 | *((unsigned short *)&temp) = x; | ||
56 | x = *(unsigned short *)ptr; | ||
57 | *(unsigned short *)ptr = *((unsigned short *)&temp); | ||
58 | break; | ||
59 | case 4: | ||
60 | temp = x; | ||
61 | x = *(unsigned long *)ptr; | ||
62 | *(unsigned long *)ptr = temp; | ||
63 | break; | ||
64 | } | ||
65 | local_irq_restore(flags); /* restore irq enable bit */ | ||
66 | return x; | ||
67 | } | ||
68 | |||
69 | #include <asm-generic/cmpxchg-local.h> | ||
70 | |||
71 | /* | ||
72 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
73 | * them available. | ||
74 | */ | ||
75 | #define cmpxchg_local(ptr, o, n) \ | ||
76 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | ||
77 | (unsigned long)(n), sizeof(*(ptr)))) | ||
78 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
79 | |||
80 | #ifndef CONFIG_SMP | ||
81 | #include <asm-generic/cmpxchg.h> | ||
82 | #endif | ||
83 | |||
84 | #define arch_align_stack(x) (x) | ||
85 | |||
86 | void default_idle(void); | ||
87 | |||
88 | #endif | ||
diff --git a/arch/cris/include/asm/termbits.h b/arch/cris/include/asm/termbits.h new file mode 100644 index 000000000000..66e1a7492a0c --- /dev/null +++ b/arch/cris/include/asm/termbits.h | |||
@@ -0,0 +1,234 @@ | |||
1 | /* $Id: termbits.h,v 1.1 2000/07/10 16:32:31 bjornw Exp $ */ | ||
2 | |||
3 | #ifndef __ARCH_ETRAX100_TERMBITS_H__ | ||
4 | #define __ARCH_ETRAX100_TERMBITS_H__ | ||
5 | |||
6 | #include <linux/posix_types.h> | ||
7 | |||
8 | typedef unsigned char cc_t; | ||
9 | typedef unsigned int speed_t; | ||
10 | typedef unsigned int tcflag_t; | ||
11 | |||
12 | #define NCCS 19 | ||
13 | struct termios { | ||
14 | tcflag_t c_iflag; /* input mode flags */ | ||
15 | tcflag_t c_oflag; /* output mode flags */ | ||
16 | tcflag_t c_cflag; /* control mode flags */ | ||
17 | tcflag_t c_lflag; /* local mode flags */ | ||
18 | cc_t c_line; /* line discipline */ | ||
19 | cc_t c_cc[NCCS]; /* control characters */ | ||
20 | }; | ||
21 | |||
22 | struct termios2 { | ||
23 | tcflag_t c_iflag; /* input mode flags */ | ||
24 | tcflag_t c_oflag; /* output mode flags */ | ||
25 | tcflag_t c_cflag; /* control mode flags */ | ||
26 | tcflag_t c_lflag; /* local mode flags */ | ||
27 | cc_t c_line; /* line discipline */ | ||
28 | cc_t c_cc[NCCS]; /* control characters */ | ||
29 | speed_t c_ispeed; /* input speed */ | ||
30 | speed_t c_ospeed; /* output speed */ | ||
31 | }; | ||
32 | |||
33 | struct ktermios { | ||
34 | tcflag_t c_iflag; /* input mode flags */ | ||
35 | tcflag_t c_oflag; /* output mode flags */ | ||
36 | tcflag_t c_cflag; /* control mode flags */ | ||
37 | tcflag_t c_lflag; /* local mode flags */ | ||
38 | cc_t c_line; /* line discipline */ | ||
39 | cc_t c_cc[NCCS]; /* control characters */ | ||
40 | speed_t c_ispeed; /* input speed */ | ||
41 | speed_t c_ospeed; /* output speed */ | ||
42 | }; | ||
43 | |||
44 | /* c_cc characters */ | ||
45 | #define VINTR 0 | ||
46 | #define VQUIT 1 | ||
47 | #define VERASE 2 | ||
48 | #define VKILL 3 | ||
49 | #define VEOF 4 | ||
50 | #define VTIME 5 | ||
51 | #define VMIN 6 | ||
52 | #define VSWTC 7 | ||
53 | #define VSTART 8 | ||
54 | #define VSTOP 9 | ||
55 | #define VSUSP 10 | ||
56 | #define VEOL 11 | ||
57 | #define VREPRINT 12 | ||
58 | #define VDISCARD 13 | ||
59 | #define VWERASE 14 | ||
60 | #define VLNEXT 15 | ||
61 | #define VEOL2 16 | ||
62 | |||
63 | /* c_iflag bits */ | ||
64 | #define IGNBRK 0000001 | ||
65 | #define BRKINT 0000002 | ||
66 | #define IGNPAR 0000004 | ||
67 | #define PARMRK 0000010 | ||
68 | #define INPCK 0000020 | ||
69 | #define ISTRIP 0000040 | ||
70 | #define INLCR 0000100 | ||
71 | #define IGNCR 0000200 | ||
72 | #define ICRNL 0000400 | ||
73 | #define IUCLC 0001000 | ||
74 | #define IXON 0002000 | ||
75 | #define IXANY 0004000 | ||
76 | #define IXOFF 0010000 | ||
77 | #define IMAXBEL 0020000 | ||
78 | #define IUTF8 0040000 | ||
79 | |||
80 | /* c_oflag bits */ | ||
81 | #define OPOST 0000001 | ||
82 | #define OLCUC 0000002 | ||
83 | #define ONLCR 0000004 | ||
84 | #define OCRNL 0000010 | ||
85 | #define ONOCR 0000020 | ||
86 | #define ONLRET 0000040 | ||
87 | #define OFILL 0000100 | ||
88 | #define OFDEL 0000200 | ||
89 | #define NLDLY 0000400 | ||
90 | #define NL0 0000000 | ||
91 | #define NL1 0000400 | ||
92 | #define CRDLY 0003000 | ||
93 | #define CR0 0000000 | ||
94 | #define CR1 0001000 | ||
95 | #define CR2 0002000 | ||
96 | #define CR3 0003000 | ||
97 | #define TABDLY 0014000 | ||
98 | #define TAB0 0000000 | ||
99 | #define TAB1 0004000 | ||
100 | #define TAB2 0010000 | ||
101 | #define TAB3 0014000 | ||
102 | #define XTABS 0014000 | ||
103 | #define BSDLY 0020000 | ||
104 | #define BS0 0000000 | ||
105 | #define BS1 0020000 | ||
106 | #define VTDLY 0040000 | ||
107 | #define VT0 0000000 | ||
108 | #define VT1 0040000 | ||
109 | #define FFDLY 0100000 | ||
110 | #define FF0 0000000 | ||
111 | #define FF1 0100000 | ||
112 | |||
113 | /* c_cflag bit meaning */ | ||
114 | /* | ||
115 | * 3 2 1 | ||
116 | * 10 987 654 321 098 765 432 109 876 543 210 | ||
117 | * | | ||| CBAUD | ||
118 | * obaud | ||
119 | * | ||
120 | * ||CSIZE | ||
121 | * | ||
122 | * |CSTOP | ||
123 | * |CREAD | ||
124 | * |CPARENB | ||
125 | * | ||
126 | * |CPARODD | ||
127 | * |HUPCL | ||
128 | * |CLOCAL | ||
129 | * |CBAUDEX | ||
130 | * 10 987 654 321 098 765 432 109 876 543 210 | ||
131 | * | || || CIBAUD, IBSHIFT=16 | ||
132 | * ibaud | ||
133 | * |CMSPAR | ||
134 | * | CRTSCTS | ||
135 | * x x xxx xxx x x xx Free bits | ||
136 | */ | ||
137 | |||
138 | #define CBAUD 0010017 | ||
139 | #define B0 0000000 /* hang up */ | ||
140 | #define B50 0000001 | ||
141 | #define B75 0000002 | ||
142 | #define B110 0000003 | ||
143 | #define B134 0000004 | ||
144 | #define B150 0000005 | ||
145 | #define B200 0000006 | ||
146 | #define B300 0000007 | ||
147 | #define B600 0000010 | ||
148 | #define B1200 0000011 | ||
149 | #define B1800 0000012 | ||
150 | #define B2400 0000013 | ||
151 | #define B4800 0000014 | ||
152 | #define B9600 0000015 | ||
153 | #define B19200 0000016 | ||
154 | #define B38400 0000017 | ||
155 | #define EXTA B19200 | ||
156 | #define EXTB B38400 | ||
157 | #define CSIZE 0000060 | ||
158 | #define CS5 0000000 | ||
159 | #define CS6 0000020 | ||
160 | #define CS7 0000040 | ||
161 | #define CS8 0000060 | ||
162 | #define CSTOPB 0000100 | ||
163 | #define CREAD 0000200 | ||
164 | #define PARENB 0000400 | ||
165 | #define PARODD 0001000 | ||
166 | #define HUPCL 0002000 | ||
167 | #define CLOCAL 0004000 | ||
168 | #define CBAUDEX 0010000 | ||
169 | #define BOTHER 0010000 | ||
170 | #define B57600 0010001 | ||
171 | #define B115200 0010002 | ||
172 | #define B230400 0010003 | ||
173 | #define B460800 0010004 | ||
174 | |||
175 | /* Unsupported rates, but needed to avoid compile error. */ | ||
176 | #define B500000 0010005 | ||
177 | #define B576000 0010006 | ||
178 | #define B1000000 0010010 | ||
179 | #define B1152000 0010011 | ||
180 | #define B1500000 0010012 | ||
181 | #define B2000000 0010013 | ||
182 | #define B2500000 0010014 | ||
183 | #define B3000000 0010015 | ||
184 | #define B3500000 0010016 | ||
185 | #define B4000000 0010017 | ||
186 | |||
187 | /* etrax supports these additional three baud rates */ | ||
188 | #define B921600 0010005 | ||
189 | #define B1843200 0010006 | ||
190 | #define B6250000 0010007 | ||
191 | /* ETRAX FS supports this as well */ | ||
192 | #define B12500000 0010010 | ||
193 | #define CIBAUD 002003600000 /* input baud rate (used in v32) */ | ||
194 | /* The values for CIBAUD bits are the same as the values for CBAUD and CBAUDEX | ||
195 | * shifted left IBSHIFT bits. | ||
196 | */ | ||
197 | #define IBSHIFT 16 | ||
198 | #define CMSPAR 010000000000 /* mark or space (stick) parity - PARODD=space*/ | ||
199 | #define CRTSCTS 020000000000 /* flow control */ | ||
200 | |||
201 | /* c_lflag bits */ | ||
202 | #define ISIG 0000001 | ||
203 | #define ICANON 0000002 | ||
204 | #define XCASE 0000004 | ||
205 | #define ECHO 0000010 | ||
206 | #define ECHOE 0000020 | ||
207 | #define ECHOK 0000040 | ||
208 | #define ECHONL 0000100 | ||
209 | #define NOFLSH 0000200 | ||
210 | #define TOSTOP 0000400 | ||
211 | #define ECHOCTL 0001000 | ||
212 | #define ECHOPRT 0002000 | ||
213 | #define ECHOKE 0004000 | ||
214 | #define FLUSHO 0010000 | ||
215 | #define PENDIN 0040000 | ||
216 | #define IEXTEN 0100000 | ||
217 | |||
218 | /* tcflow() and TCXONC use these */ | ||
219 | #define TCOOFF 0 | ||
220 | #define TCOON 1 | ||
221 | #define TCIOFF 2 | ||
222 | #define TCION 3 | ||
223 | |||
224 | /* tcflush() and TCFLSH use these */ | ||
225 | #define TCIFLUSH 0 | ||
226 | #define TCOFLUSH 1 | ||
227 | #define TCIOFLUSH 2 | ||
228 | |||
229 | /* tcsetattr uses these */ | ||
230 | #define TCSANOW 0 | ||
231 | #define TCSADRAIN 1 | ||
232 | #define TCSAFLUSH 2 | ||
233 | |||
234 | #endif | ||
diff --git a/arch/cris/include/asm/termios.h b/arch/cris/include/asm/termios.h new file mode 100644 index 000000000000..b0124e6c2e41 --- /dev/null +++ b/arch/cris/include/asm/termios.h | |||
@@ -0,0 +1,91 @@ | |||
1 | #ifndef _CRIS_TERMIOS_H | ||
2 | #define _CRIS_TERMIOS_H | ||
3 | |||
4 | #include <asm/termbits.h> | ||
5 | #include <asm/ioctls.h> | ||
6 | #include <asm/rs485.h> | ||
7 | |||
8 | struct winsize { | ||
9 | unsigned short ws_row; | ||
10 | unsigned short ws_col; | ||
11 | unsigned short ws_xpixel; | ||
12 | unsigned short ws_ypixel; | ||
13 | }; | ||
14 | |||
15 | #define NCC 8 | ||
16 | struct termio { | ||
17 | unsigned short c_iflag; /* input mode flags */ | ||
18 | unsigned short c_oflag; /* output mode flags */ | ||
19 | unsigned short c_cflag; /* control mode flags */ | ||
20 | unsigned short c_lflag; /* local mode flags */ | ||
21 | unsigned char c_line; /* line discipline */ | ||
22 | unsigned char c_cc[NCC]; /* control characters */ | ||
23 | }; | ||
24 | |||
25 | /* modem lines */ | ||
26 | #define TIOCM_LE 0x001 | ||
27 | #define TIOCM_DTR 0x002 | ||
28 | #define TIOCM_RTS 0x004 | ||
29 | #define TIOCM_ST 0x008 | ||
30 | #define TIOCM_SR 0x010 | ||
31 | #define TIOCM_CTS 0x020 | ||
32 | #define TIOCM_CAR 0x040 | ||
33 | #define TIOCM_RNG 0x080 | ||
34 | #define TIOCM_DSR 0x100 | ||
35 | #define TIOCM_CD TIOCM_CAR | ||
36 | #define TIOCM_RI TIOCM_RNG | ||
37 | #define TIOCM_OUT1 0x2000 | ||
38 | #define TIOCM_OUT2 0x4000 | ||
39 | #define TIOCM_LOOP 0x8000 | ||
40 | |||
41 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
42 | |||
43 | #ifdef __KERNEL__ | ||
44 | |||
45 | /* intr=^C quit=^\ erase=del kill=^U | ||
46 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | ||
47 | start=^Q stop=^S susp=^Z eol=\0 | ||
48 | reprint=^R discard=^U werase=^W lnext=^V | ||
49 | eol2=\0 | ||
50 | */ | ||
51 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | ||
52 | |||
53 | /* | ||
54 | * Translate a "termio" structure into a "termios". Ugh. | ||
55 | */ | ||
56 | #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ | ||
57 | unsigned short __tmp; \ | ||
58 | get_user(__tmp,&(termio)->x); \ | ||
59 | *(unsigned short *) &(termios)->x = __tmp; \ | ||
60 | } | ||
61 | |||
62 | #define user_termio_to_kernel_termios(termios, termio) \ | ||
63 | ({ \ | ||
64 | SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ | ||
65 | SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ | ||
66 | SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ | ||
67 | SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ | ||
68 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | ||
69 | }) | ||
70 | |||
71 | /* | ||
72 | * Translate a "termios" structure into a "termio". Ugh. | ||
73 | */ | ||
74 | #define kernel_termios_to_user_termio(termio, termios) \ | ||
75 | ({ \ | ||
76 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | ||
77 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | ||
78 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | ||
79 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | ||
80 | put_user((termios)->c_line, &(termio)->c_line); \ | ||
81 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
82 | }) | ||
83 | |||
84 | #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2)) | ||
85 | #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2)) | ||
86 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) | ||
87 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) | ||
88 | |||
89 | #endif /* __KERNEL__ */ | ||
90 | |||
91 | #endif /* _CRIS_TERMIOS_H */ | ||
diff --git a/arch/cris/include/asm/thread_info.h b/arch/cris/include/asm/thread_info.h new file mode 100644 index 000000000000..bc5b2935ca53 --- /dev/null +++ b/arch/cris/include/asm/thread_info.h | |||
@@ -0,0 +1,106 @@ | |||
1 | /* thread_info.h: CRIS low-level thread information | ||
2 | * | ||
3 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) | ||
4 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller | ||
5 | * | ||
6 | * CRIS port by Axis Communications | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_THREAD_INFO_H | ||
10 | #define _ASM_THREAD_INFO_H | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | #include <asm/types.h> | ||
18 | #include <asm/processor.h> | ||
19 | #include <arch/thread_info.h> | ||
20 | #include <asm/segment.h> | ||
21 | #endif | ||
22 | |||
23 | |||
24 | /* | ||
25 | * low level task data that entry.S needs immediate access to | ||
26 | * - this struct should fit entirely inside of one cache line | ||
27 | * - this struct shares the supervisor stack pages | ||
28 | * - if the contents of this structure are changed, the assembly constants must also be changed | ||
29 | */ | ||
30 | #ifndef __ASSEMBLY__ | ||
31 | struct thread_info { | ||
32 | struct task_struct *task; /* main task structure */ | ||
33 | struct exec_domain *exec_domain; /* execution domain */ | ||
34 | unsigned long flags; /* low level flags */ | ||
35 | __u32 cpu; /* current CPU */ | ||
36 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | ||
37 | __u32 tls; /* TLS for this thread */ | ||
38 | |||
39 | mm_segment_t addr_limit; /* thread address space: | ||
40 | 0-0xBFFFFFFF for user-thead | ||
41 | 0-0xFFFFFFFF for kernel-thread | ||
42 | */ | ||
43 | struct restart_block restart_block; | ||
44 | __u8 supervisor_stack[0]; | ||
45 | }; | ||
46 | |||
47 | #endif | ||
48 | |||
49 | #define PREEMPT_ACTIVE 0x10000000 | ||
50 | |||
51 | /* | ||
52 | * macros/functions for gaining access to the thread information structure | ||
53 | * | ||
54 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
55 | */ | ||
56 | #ifndef __ASSEMBLY__ | ||
57 | #define INIT_THREAD_INFO(tsk) \ | ||
58 | { \ | ||
59 | .task = &tsk, \ | ||
60 | .exec_domain = &default_exec_domain, \ | ||
61 | .flags = 0, \ | ||
62 | .cpu = 0, \ | ||
63 | .preempt_count = 1, \ | ||
64 | .addr_limit = KERNEL_DS, \ | ||
65 | .restart_block = { \ | ||
66 | .fn = do_no_restart_syscall, \ | ||
67 | }, \ | ||
68 | } | ||
69 | |||
70 | #define init_thread_info (init_thread_union.thread_info) | ||
71 | |||
72 | /* thread information allocation */ | ||
73 | #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) | ||
74 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | ||
75 | |||
76 | #endif /* !__ASSEMBLY__ */ | ||
77 | |||
78 | /* | ||
79 | * thread information flags | ||
80 | * - these are process state flags that various assembly files may need to access | ||
81 | * - pending work-to-be-done flags are in LSW | ||
82 | * - other flags in MSW | ||
83 | */ | ||
84 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
85 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
86 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
87 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
88 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | ||
89 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
90 | #define TIF_MEMDIE 17 | ||
91 | #define TIF_FREEZE 18 /* is freezing for suspend */ | ||
92 | |||
93 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
94 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
95 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
96 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
97 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
98 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
99 | #define _TIF_FREEZE (1<<TIF_FREEZE) | ||
100 | |||
101 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | ||
102 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | ||
103 | |||
104 | #endif /* __KERNEL__ */ | ||
105 | |||
106 | #endif /* _ASM_THREAD_INFO_H */ | ||
diff --git a/arch/cris/include/asm/timex.h b/arch/cris/include/asm/timex.h new file mode 100644 index 000000000000..980924ae7518 --- /dev/null +++ b/arch/cris/include/asm/timex.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * linux/include/asm-cris/timex.h | ||
3 | * | ||
4 | * CRIS architecture timex specifications | ||
5 | */ | ||
6 | |||
7 | #ifndef _ASM_CRIS_TIMEX_H | ||
8 | #define _ASM_CRIS_TIMEX_H | ||
9 | |||
10 | #include <arch/timex.h> | ||
11 | |||
12 | /* | ||
13 | * We don't have a cycle-counter.. but we do not support SMP anyway where this is | ||
14 | * used so it does not matter. | ||
15 | */ | ||
16 | |||
17 | typedef unsigned long long cycles_t; | ||
18 | |||
19 | static inline cycles_t get_cycles(void) | ||
20 | { | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | #endif | ||
diff --git a/arch/cris/include/asm/tlb.h b/arch/cris/include/asm/tlb.h new file mode 100644 index 000000000000..77384ea2f29d --- /dev/null +++ b/arch/cris/include/asm/tlb.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _CRIS_TLB_H | ||
2 | #define _CRIS_TLB_H | ||
3 | |||
4 | #include <linux/pagemap.h> | ||
5 | |||
6 | #include <arch/tlb.h> | ||
7 | |||
8 | /* | ||
9 | * cris doesn't need any special per-pte or | ||
10 | * per-vma handling.. | ||
11 | */ | ||
12 | #define tlb_start_vma(tlb, vma) do { } while (0) | ||
13 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
14 | #define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) | ||
15 | |||
16 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
17 | #include <asm-generic/tlb.h> | ||
18 | |||
19 | #endif | ||
diff --git a/arch/cris/include/asm/tlbflush.h b/arch/cris/include/asm/tlbflush.h new file mode 100644 index 000000000000..20697e7ef4f2 --- /dev/null +++ b/arch/cris/include/asm/tlbflush.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef _CRIS_TLBFLUSH_H | ||
2 | #define _CRIS_TLBFLUSH_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | #include <asm/processor.h> | ||
6 | #include <asm/pgtable.h> | ||
7 | #include <asm/pgalloc.h> | ||
8 | |||
9 | /* | ||
10 | * TLB flushing (implemented in arch/cris/mm/tlb.c): | ||
11 | * | ||
12 | * - flush_tlb() flushes the current mm struct TLBs | ||
13 | * - flush_tlb_all() flushes all processes TLBs | ||
14 | * - flush_tlb_mm(mm) flushes the specified mm context TLB's | ||
15 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
16 | * - flush_tlb_range(mm, start, end) flushes a range of pages | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | extern void __flush_tlb_all(void); | ||
21 | extern void __flush_tlb_mm(struct mm_struct *mm); | ||
22 | extern void __flush_tlb_page(struct vm_area_struct *vma, | ||
23 | unsigned long addr); | ||
24 | |||
25 | #ifdef CONFIG_SMP | ||
26 | extern void flush_tlb_all(void); | ||
27 | extern void flush_tlb_mm(struct mm_struct *mm); | ||
28 | extern void flush_tlb_page(struct vm_area_struct *vma, | ||
29 | unsigned long addr); | ||
30 | #else | ||
31 | #define flush_tlb_all __flush_tlb_all | ||
32 | #define flush_tlb_mm __flush_tlb_mm | ||
33 | #define flush_tlb_page __flush_tlb_page | ||
34 | #endif | ||
35 | |||
36 | static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long start, unsigned long end) | ||
37 | { | ||
38 | flush_tlb_mm(vma->vm_mm); | ||
39 | } | ||
40 | |||
41 | static inline void flush_tlb(void) | ||
42 | { | ||
43 | flush_tlb_mm(current->mm); | ||
44 | } | ||
45 | |||
46 | #define flush_tlb_kernel_range(start, end) flush_tlb_all() | ||
47 | |||
48 | #endif /* _CRIS_TLBFLUSH_H */ | ||
diff --git a/arch/cris/include/asm/topology.h b/arch/cris/include/asm/topology.h new file mode 100644 index 000000000000..2ac613d32a89 --- /dev/null +++ b/arch/cris/include/asm/topology.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_CRIS_TOPOLOGY_H | ||
2 | #define _ASM_CRIS_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif /* _ASM_CRIS_TOPOLOGY_H */ | ||
diff --git a/arch/cris/include/asm/types.h b/arch/cris/include/asm/types.h new file mode 100644 index 000000000000..5790262cbe8a --- /dev/null +++ b/arch/cris/include/asm/types.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef _ETRAX_TYPES_H | ||
2 | #define _ETRAX_TYPES_H | ||
3 | |||
4 | #include <asm-generic/int-ll64.h> | ||
5 | |||
6 | #ifndef __ASSEMBLY__ | ||
7 | |||
8 | typedef unsigned short umode_t; | ||
9 | |||
10 | #endif /* __ASSEMBLY__ */ | ||
11 | |||
12 | /* | ||
13 | * These aren't exported outside the kernel to avoid name space clashes | ||
14 | */ | ||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #define BITS_PER_LONG 32 | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | ||
20 | |||
21 | /* Dma addresses are 32-bits wide, just like our other addresses. */ | ||
22 | |||
23 | typedef u32 dma_addr_t; | ||
24 | typedef u32 dma64_addr_t; | ||
25 | |||
26 | #endif /* __ASSEMBLY__ */ | ||
27 | |||
28 | #endif /* __KERNEL__ */ | ||
29 | |||
30 | #endif | ||
diff --git a/arch/cris/include/asm/uaccess.h b/arch/cris/include/asm/uaccess.h new file mode 100644 index 000000000000..914540801c5e --- /dev/null +++ b/arch/cris/include/asm/uaccess.h | |||
@@ -0,0 +1,404 @@ | |||
1 | /* | ||
2 | * Authors: Bjorn Wesen (bjornw@axis.com) | ||
3 | * Hans-Peter Nilsson (hp@axis.com) | ||
4 | */ | ||
5 | |||
6 | /* Asm:s have been tweaked (within the domain of correctness) to give | ||
7 | satisfactory results for "gcc version 2.96 20000427 (experimental)". | ||
8 | |||
9 | Check regularly... | ||
10 | |||
11 | Register $r9 is chosen for temporaries, being a call-clobbered register | ||
12 | first in line to be used (notably for local blocks), not colliding with | ||
13 | parameter registers. */ | ||
14 | |||
15 | #ifndef _CRIS_UACCESS_H | ||
16 | #define _CRIS_UACCESS_H | ||
17 | |||
18 | #ifndef __ASSEMBLY__ | ||
19 | #include <linux/sched.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <asm/processor.h> | ||
22 | #include <asm/page.h> | ||
23 | |||
24 | #define VERIFY_READ 0 | ||
25 | #define VERIFY_WRITE 1 | ||
26 | |||
27 | /* | ||
28 | * The fs value determines whether argument validity checking should be | ||
29 | * performed or not. If get_fs() == USER_DS, checking is performed, with | ||
30 | * get_fs() == KERNEL_DS, checking is bypassed. | ||
31 | * | ||
32 | * For historical reasons, these macros are grossly misnamed. | ||
33 | */ | ||
34 | |||
35 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | ||
36 | |||
37 | /* addr_limit is the maximum accessible address for the task. we misuse | ||
38 | * the KERNEL_DS and USER_DS values to both assign and compare the | ||
39 | * addr_limit values through the equally misnamed get/set_fs macros. | ||
40 | * (see above) | ||
41 | */ | ||
42 | |||
43 | #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) | ||
44 | #define USER_DS MAKE_MM_SEG(TASK_SIZE) | ||
45 | |||
46 | #define get_ds() (KERNEL_DS) | ||
47 | #define get_fs() (current_thread_info()->addr_limit) | ||
48 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) | ||
49 | |||
50 | #define segment_eq(a,b) ((a).seg == (b).seg) | ||
51 | |||
52 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) | ||
53 | #define __user_ok(addr,size) (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size))) | ||
54 | #define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) | ||
55 | #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) | ||
56 | |||
57 | #include <arch/uaccess.h> | ||
58 | |||
59 | /* | ||
60 | * The exception table consists of pairs of addresses: the first is the | ||
61 | * address of an instruction that is allowed to fault, and the second is | ||
62 | * the address at which the program should continue. No registers are | ||
63 | * modified, so it is entirely up to the continuation code to figure out | ||
64 | * what to do. | ||
65 | * | ||
66 | * All the routines below use bits of fixup code that are out of line | ||
67 | * with the main instruction path. This means when everything is well, | ||
68 | * we don't even have to jump over them. Further, they do not intrude | ||
69 | * on our cache or tlb entries. | ||
70 | */ | ||
71 | |||
72 | struct exception_table_entry | ||
73 | { | ||
74 | unsigned long insn, fixup; | ||
75 | }; | ||
76 | |||
77 | /* | ||
78 | * These are the main single-value transfer routines. They automatically | ||
79 | * use the right size if we just have the right pointer type. | ||
80 | * | ||
81 | * This gets kind of ugly. We want to return _two_ values in "get_user()" | ||
82 | * and yet we don't want to do any pointers, because that is too much | ||
83 | * of a performance impact. Thus we have a few rather ugly macros here, | ||
84 | * and hide all the ugliness from the user. | ||
85 | * | ||
86 | * The "__xxx" versions of the user access functions are versions that | ||
87 | * do not verify the address space, that must have been done previously | ||
88 | * with a separate "access_ok()" call (this is used when we do multiple | ||
89 | * accesses to the same area of user memory). | ||
90 | * | ||
91 | * As we use the same address space for kernel and user data on | ||
92 | * CRIS, we can just do these as direct assignments. (Of course, the | ||
93 | * exception handling means that it's no longer "just"...) | ||
94 | */ | ||
95 | #define get_user(x,ptr) \ | ||
96 | __get_user_check((x),(ptr),sizeof(*(ptr))) | ||
97 | #define put_user(x,ptr) \ | ||
98 | __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) | ||
99 | |||
100 | #define __get_user(x,ptr) \ | ||
101 | __get_user_nocheck((x),(ptr),sizeof(*(ptr))) | ||
102 | #define __put_user(x,ptr) \ | ||
103 | __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) | ||
104 | |||
105 | extern long __put_user_bad(void); | ||
106 | |||
107 | #define __put_user_size(x,ptr,size,retval) \ | ||
108 | do { \ | ||
109 | retval = 0; \ | ||
110 | switch (size) { \ | ||
111 | case 1: __put_user_asm(x,ptr,retval,"move.b"); break; \ | ||
112 | case 2: __put_user_asm(x,ptr,retval,"move.w"); break; \ | ||
113 | case 4: __put_user_asm(x,ptr,retval,"move.d"); break; \ | ||
114 | case 8: __put_user_asm_64(x,ptr,retval); break; \ | ||
115 | default: __put_user_bad(); \ | ||
116 | } \ | ||
117 | } while (0) | ||
118 | |||
119 | #define __get_user_size(x,ptr,size,retval) \ | ||
120 | do { \ | ||
121 | retval = 0; \ | ||
122 | switch (size) { \ | ||
123 | case 1: __get_user_asm(x,ptr,retval,"move.b"); break; \ | ||
124 | case 2: __get_user_asm(x,ptr,retval,"move.w"); break; \ | ||
125 | case 4: __get_user_asm(x,ptr,retval,"move.d"); break; \ | ||
126 | case 8: __get_user_asm_64(x,ptr,retval); break; \ | ||
127 | default: (x) = __get_user_bad(); \ | ||
128 | } \ | ||
129 | } while (0) | ||
130 | |||
131 | #define __put_user_nocheck(x,ptr,size) \ | ||
132 | ({ \ | ||
133 | long __pu_err; \ | ||
134 | __put_user_size((x),(ptr),(size),__pu_err); \ | ||
135 | __pu_err; \ | ||
136 | }) | ||
137 | |||
138 | #define __put_user_check(x,ptr,size) \ | ||
139 | ({ \ | ||
140 | long __pu_err = -EFAULT; \ | ||
141 | __typeof__(*(ptr)) *__pu_addr = (ptr); \ | ||
142 | if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ | ||
143 | __put_user_size((x),__pu_addr,(size),__pu_err); \ | ||
144 | __pu_err; \ | ||
145 | }) | ||
146 | |||
147 | struct __large_struct { unsigned long buf[100]; }; | ||
148 | #define __m(x) (*(struct __large_struct *)(x)) | ||
149 | |||
150 | |||
151 | |||
152 | #define __get_user_nocheck(x,ptr,size) \ | ||
153 | ({ \ | ||
154 | long __gu_err, __gu_val; \ | ||
155 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ | ||
156 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
157 | __gu_err; \ | ||
158 | }) | ||
159 | |||
160 | #define __get_user_check(x,ptr,size) \ | ||
161 | ({ \ | ||
162 | long __gu_err = -EFAULT, __gu_val = 0; \ | ||
163 | const __typeof__(*(ptr)) *__gu_addr = (ptr); \ | ||
164 | if (access_ok(VERIFY_READ,__gu_addr,size)) \ | ||
165 | __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \ | ||
166 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
167 | __gu_err; \ | ||
168 | }) | ||
169 | |||
170 | extern long __get_user_bad(void); | ||
171 | |||
172 | /* More complex functions. Most are inline, but some call functions that | ||
173 | live in lib/usercopy.c */ | ||
174 | |||
175 | extern unsigned long __copy_user(void __user *to, const void *from, unsigned long n); | ||
176 | extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); | ||
177 | extern unsigned long __do_clear_user(void __user *to, unsigned long n); | ||
178 | |||
179 | static inline unsigned long | ||
180 | __generic_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
181 | { | ||
182 | if (access_ok(VERIFY_WRITE, to, n)) | ||
183 | return __copy_user(to,from,n); | ||
184 | return n; | ||
185 | } | ||
186 | |||
187 | static inline unsigned long | ||
188 | __generic_copy_from_user(void *to, const void __user *from, unsigned long n) | ||
189 | { | ||
190 | if (access_ok(VERIFY_READ, from, n)) | ||
191 | return __copy_user_zeroing(to,from,n); | ||
192 | return n; | ||
193 | } | ||
194 | |||
195 | static inline unsigned long | ||
196 | __generic_clear_user(void __user *to, unsigned long n) | ||
197 | { | ||
198 | if (access_ok(VERIFY_WRITE, to, n)) | ||
199 | return __do_clear_user(to,n); | ||
200 | return n; | ||
201 | } | ||
202 | |||
203 | static inline long | ||
204 | __strncpy_from_user(char *dst, const char __user *src, long count) | ||
205 | { | ||
206 | return __do_strncpy_from_user(dst, src, count); | ||
207 | } | ||
208 | |||
209 | static inline long | ||
210 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
211 | { | ||
212 | long res = -EFAULT; | ||
213 | if (access_ok(VERIFY_READ, src, 1)) | ||
214 | res = __do_strncpy_from_user(dst, src, count); | ||
215 | return res; | ||
216 | } | ||
217 | |||
218 | |||
219 | /* Note that these expand awfully if made into switch constructs, so | ||
220 | don't do that. */ | ||
221 | |||
222 | static inline unsigned long | ||
223 | __constant_copy_from_user(void *to, const void __user *from, unsigned long n) | ||
224 | { | ||
225 | unsigned long ret = 0; | ||
226 | if (n == 0) | ||
227 | ; | ||
228 | else if (n == 1) | ||
229 | __asm_copy_from_user_1(to, from, ret); | ||
230 | else if (n == 2) | ||
231 | __asm_copy_from_user_2(to, from, ret); | ||
232 | else if (n == 3) | ||
233 | __asm_copy_from_user_3(to, from, ret); | ||
234 | else if (n == 4) | ||
235 | __asm_copy_from_user_4(to, from, ret); | ||
236 | else if (n == 5) | ||
237 | __asm_copy_from_user_5(to, from, ret); | ||
238 | else if (n == 6) | ||
239 | __asm_copy_from_user_6(to, from, ret); | ||
240 | else if (n == 7) | ||
241 | __asm_copy_from_user_7(to, from, ret); | ||
242 | else if (n == 8) | ||
243 | __asm_copy_from_user_8(to, from, ret); | ||
244 | else if (n == 9) | ||
245 | __asm_copy_from_user_9(to, from, ret); | ||
246 | else if (n == 10) | ||
247 | __asm_copy_from_user_10(to, from, ret); | ||
248 | else if (n == 11) | ||
249 | __asm_copy_from_user_11(to, from, ret); | ||
250 | else if (n == 12) | ||
251 | __asm_copy_from_user_12(to, from, ret); | ||
252 | else if (n == 13) | ||
253 | __asm_copy_from_user_13(to, from, ret); | ||
254 | else if (n == 14) | ||
255 | __asm_copy_from_user_14(to, from, ret); | ||
256 | else if (n == 15) | ||
257 | __asm_copy_from_user_15(to, from, ret); | ||
258 | else if (n == 16) | ||
259 | __asm_copy_from_user_16(to, from, ret); | ||
260 | else if (n == 20) | ||
261 | __asm_copy_from_user_20(to, from, ret); | ||
262 | else if (n == 24) | ||
263 | __asm_copy_from_user_24(to, from, ret); | ||
264 | else | ||
265 | ret = __generic_copy_from_user(to, from, n); | ||
266 | |||
267 | return ret; | ||
268 | } | ||
269 | |||
270 | /* Ditto, don't make a switch out of this. */ | ||
271 | |||
272 | static inline unsigned long | ||
273 | __constant_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
274 | { | ||
275 | unsigned long ret = 0; | ||
276 | if (n == 0) | ||
277 | ; | ||
278 | else if (n == 1) | ||
279 | __asm_copy_to_user_1(to, from, ret); | ||
280 | else if (n == 2) | ||
281 | __asm_copy_to_user_2(to, from, ret); | ||
282 | else if (n == 3) | ||
283 | __asm_copy_to_user_3(to, from, ret); | ||
284 | else if (n == 4) | ||
285 | __asm_copy_to_user_4(to, from, ret); | ||
286 | else if (n == 5) | ||
287 | __asm_copy_to_user_5(to, from, ret); | ||
288 | else if (n == 6) | ||
289 | __asm_copy_to_user_6(to, from, ret); | ||
290 | else if (n == 7) | ||
291 | __asm_copy_to_user_7(to, from, ret); | ||
292 | else if (n == 8) | ||
293 | __asm_copy_to_user_8(to, from, ret); | ||
294 | else if (n == 9) | ||
295 | __asm_copy_to_user_9(to, from, ret); | ||
296 | else if (n == 10) | ||
297 | __asm_copy_to_user_10(to, from, ret); | ||
298 | else if (n == 11) | ||
299 | __asm_copy_to_user_11(to, from, ret); | ||
300 | else if (n == 12) | ||
301 | __asm_copy_to_user_12(to, from, ret); | ||
302 | else if (n == 13) | ||
303 | __asm_copy_to_user_13(to, from, ret); | ||
304 | else if (n == 14) | ||
305 | __asm_copy_to_user_14(to, from, ret); | ||
306 | else if (n == 15) | ||
307 | __asm_copy_to_user_15(to, from, ret); | ||
308 | else if (n == 16) | ||
309 | __asm_copy_to_user_16(to, from, ret); | ||
310 | else if (n == 20) | ||
311 | __asm_copy_to_user_20(to, from, ret); | ||
312 | else if (n == 24) | ||
313 | __asm_copy_to_user_24(to, from, ret); | ||
314 | else | ||
315 | ret = __generic_copy_to_user(to, from, n); | ||
316 | |||
317 | return ret; | ||
318 | } | ||
319 | |||
320 | /* No switch, please. */ | ||
321 | |||
322 | static inline unsigned long | ||
323 | __constant_clear_user(void __user *to, unsigned long n) | ||
324 | { | ||
325 | unsigned long ret = 0; | ||
326 | if (n == 0) | ||
327 | ; | ||
328 | else if (n == 1) | ||
329 | __asm_clear_1(to, ret); | ||
330 | else if (n == 2) | ||
331 | __asm_clear_2(to, ret); | ||
332 | else if (n == 3) | ||
333 | __asm_clear_3(to, ret); | ||
334 | else if (n == 4) | ||
335 | __asm_clear_4(to, ret); | ||
336 | else if (n == 8) | ||
337 | __asm_clear_8(to, ret); | ||
338 | else if (n == 12) | ||
339 | __asm_clear_12(to, ret); | ||
340 | else if (n == 16) | ||
341 | __asm_clear_16(to, ret); | ||
342 | else if (n == 20) | ||
343 | __asm_clear_20(to, ret); | ||
344 | else if (n == 24) | ||
345 | __asm_clear_24(to, ret); | ||
346 | else | ||
347 | ret = __generic_clear_user(to, n); | ||
348 | |||
349 | return ret; | ||
350 | } | ||
351 | |||
352 | |||
353 | #define clear_user(to, n) \ | ||
354 | (__builtin_constant_p(n) ? \ | ||
355 | __constant_clear_user(to, n) : \ | ||
356 | __generic_clear_user(to, n)) | ||
357 | |||
358 | #define copy_from_user(to, from, n) \ | ||
359 | (__builtin_constant_p(n) ? \ | ||
360 | __constant_copy_from_user(to, from, n) : \ | ||
361 | __generic_copy_from_user(to, from, n)) | ||
362 | |||
363 | #define copy_to_user(to, from, n) \ | ||
364 | (__builtin_constant_p(n) ? \ | ||
365 | __constant_copy_to_user(to, from, n) : \ | ||
366 | __generic_copy_to_user(to, from, n)) | ||
367 | |||
368 | /* We let the __ versions of copy_from/to_user inline, because they're often | ||
369 | * used in fast paths and have only a small space overhead. | ||
370 | */ | ||
371 | |||
372 | static inline unsigned long | ||
373 | __generic_copy_from_user_nocheck(void *to, const void __user *from, | ||
374 | unsigned long n) | ||
375 | { | ||
376 | return __copy_user_zeroing(to,from,n); | ||
377 | } | ||
378 | |||
379 | static inline unsigned long | ||
380 | __generic_copy_to_user_nocheck(void __user *to, const void *from, | ||
381 | unsigned long n) | ||
382 | { | ||
383 | return __copy_user(to,from,n); | ||
384 | } | ||
385 | |||
386 | static inline unsigned long | ||
387 | __generic_clear_user_nocheck(void __user *to, unsigned long n) | ||
388 | { | ||
389 | return __do_clear_user(to,n); | ||
390 | } | ||
391 | |||
392 | /* without checking */ | ||
393 | |||
394 | #define __copy_to_user(to,from,n) __generic_copy_to_user_nocheck((to),(from),(n)) | ||
395 | #define __copy_from_user(to,from,n) __generic_copy_from_user_nocheck((to),(from),(n)) | ||
396 | #define __copy_to_user_inatomic __copy_to_user | ||
397 | #define __copy_from_user_inatomic __copy_from_user | ||
398 | #define __clear_user(to,n) __generic_clear_user_nocheck((to),(n)) | ||
399 | |||
400 | #define strlen_user(str) strnlen_user((str), 0x7ffffffe) | ||
401 | |||
402 | #endif /* __ASSEMBLY__ */ | ||
403 | |||
404 | #endif /* _CRIS_UACCESS_H */ | ||
diff --git a/arch/cris/include/asm/ucontext.h b/arch/cris/include/asm/ucontext.h new file mode 100644 index 000000000000..eed6ad5eb3f2 --- /dev/null +++ b/arch/cris/include/asm/ucontext.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _ASM_CRIS_UCONTEXT_H | ||
2 | #define _ASM_CRIS_UCONTEXT_H | ||
3 | |||
4 | struct ucontext { | ||
5 | unsigned long uc_flags; | ||
6 | struct ucontext *uc_link; | ||
7 | stack_t uc_stack; | ||
8 | struct sigcontext uc_mcontext; | ||
9 | sigset_t uc_sigmask; /* mask last for extensibility */ | ||
10 | }; | ||
11 | |||
12 | #endif /* !_ASM_CRIS_UCONTEXT_H */ | ||
diff --git a/arch/cris/include/asm/unaligned.h b/arch/cris/include/asm/unaligned.h new file mode 100644 index 000000000000..7b3f3fec567c --- /dev/null +++ b/arch/cris/include/asm/unaligned.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _ASM_CRIS_UNALIGNED_H | ||
2 | #define _ASM_CRIS_UNALIGNED_H | ||
3 | |||
4 | /* | ||
5 | * CRIS can do unaligned accesses itself. | ||
6 | */ | ||
7 | #include <linux/unaligned/access_ok.h> | ||
8 | #include <linux/unaligned/generic.h> | ||
9 | |||
10 | #define get_unaligned __get_unaligned_le | ||
11 | #define put_unaligned __put_unaligned_le | ||
12 | |||
13 | #endif /* _ASM_CRIS_UNALIGNED_H */ | ||
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h new file mode 100644 index 000000000000..235d076379d5 --- /dev/null +++ b/arch/cris/include/asm/unistd.h | |||
@@ -0,0 +1,374 @@ | |||
1 | #ifndef _ASM_CRIS_UNISTD_H_ | ||
2 | #define _ASM_CRIS_UNISTD_H_ | ||
3 | |||
4 | /* | ||
5 | * This file contains the system call numbers, and stub macros for libc. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | #define __NR_lchown 16 | ||
25 | #define __NR_break 17 | ||
26 | #define __NR_oldstat 18 | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | #define __NR_setuid 23 | ||
32 | #define __NR_getuid 24 | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | #define __NR_oldfstat 28 | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | #define __NR_stty 31 | ||
40 | #define __NR_gtty 32 | ||
41 | #define __NR_access 33 | ||
42 | #define __NR_nice 34 | ||
43 | #define __NR_ftime 35 | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | #define __NR_prof 44 | ||
53 | #define __NR_brk 45 | ||
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | ||
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | #define __NR_lock 53 | ||
62 | #define __NR_ioctl 54 | ||
63 | #define __NR_fcntl 55 | ||
64 | #define __NR_mpx 56 | ||
65 | #define __NR_setpgid 57 | ||
66 | #define __NR_ulimit 58 | ||
67 | #define __NR_oldolduname 59 | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | #define __NR_sigaction 67 | ||
76 | #define __NR_sgetmask 68 | ||
77 | #define __NR_ssetmask 69 | ||
78 | #define __NR_setreuid 70 | ||
79 | #define __NR_setregid 71 | ||
80 | #define __NR_sigsuspend 72 | ||
81 | #define __NR_sigpending 73 | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | #define __NR_getrlimit 76 | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | #define __NR_getgroups 80 | ||
89 | #define __NR_setgroups 81 | ||
90 | #define __NR_select 82 | ||
91 | #define __NR_symlink 83 | ||
92 | #define __NR_oldlstat 84 | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | #define __NR_readdir 89 | ||
98 | #define __NR_mmap 90 | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | #define __NR_fchown 95 | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | #define __NR_profil 98 | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | #define __NR_ioperm 101 | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | #define __NR_olduname 109 | ||
118 | #define __NR_iopl 110 | ||
119 | #define __NR_vhangup 111 | ||
120 | #define __NR_idle 112 | ||
121 | #define __NR_vm86 113 | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | #define __NR_sigreturn 119 | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | #define __NR_modify_ldt 123 | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | #define __NR_sigprocmask 126 | ||
135 | #define __NR_create_module 127 | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | #define __NR_get_kernel_syms 130 | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
146 | #define __NR_setfsuid 138 | ||
147 | #define __NR_setfsgid 139 | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | #define __NR_setresuid 164 | ||
173 | #define __NR_getresuid 165 | ||
174 | |||
175 | #define __NR_query_module 167 | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | #define __NR_setresgid 170 | ||
179 | #define __NR_getresgid 171 | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | #define __NR_chown 182 | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | #define __NR_getpmsg 188 /* some people actually want streams */ | ||
197 | #define __NR_putpmsg 189 /* some people actually want streams */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_lchown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_chown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | #define __NR_mincore 218 | ||
227 | #define __NR_madvise 219 | ||
228 | #define __NR_getdents64 220 | ||
229 | #define __NR_fcntl64 221 | ||
230 | /* 223 is unused */ | ||
231 | #define __NR_gettid 224 | ||
232 | #define __NR_readahead 225 | ||
233 | #define __NR_setxattr 226 | ||
234 | #define __NR_lsetxattr 227 | ||
235 | #define __NR_fsetxattr 228 | ||
236 | #define __NR_getxattr 229 | ||
237 | #define __NR_lgetxattr 230 | ||
238 | #define __NR_fgetxattr 231 | ||
239 | #define __NR_listxattr 232 | ||
240 | #define __NR_llistxattr 233 | ||
241 | #define __NR_flistxattr 234 | ||
242 | #define __NR_removexattr 235 | ||
243 | #define __NR_lremovexattr 236 | ||
244 | #define __NR_fremovexattr 237 | ||
245 | #define __NR_tkill 238 | ||
246 | #define __NR_sendfile64 239 | ||
247 | #define __NR_futex 240 | ||
248 | #define __NR_sched_setaffinity 241 | ||
249 | #define __NR_sched_getaffinity 242 | ||
250 | #define __NR_set_thread_area 243 | ||
251 | #define __NR_get_thread_area 244 | ||
252 | #define __NR_io_setup 245 | ||
253 | #define __NR_io_destroy 246 | ||
254 | #define __NR_io_getevents 247 | ||
255 | #define __NR_io_submit 248 | ||
256 | #define __NR_io_cancel 249 | ||
257 | #define __NR_fadvise64 250 | ||
258 | /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ | ||
259 | #define __NR_exit_group 252 | ||
260 | #define __NR_lookup_dcookie 253 | ||
261 | #define __NR_epoll_create 254 | ||
262 | #define __NR_epoll_ctl 255 | ||
263 | #define __NR_epoll_wait 256 | ||
264 | #define __NR_remap_file_pages 257 | ||
265 | #define __NR_set_tid_address 258 | ||
266 | #define __NR_timer_create 259 | ||
267 | #define __NR_timer_settime (__NR_timer_create+1) | ||
268 | #define __NR_timer_gettime (__NR_timer_create+2) | ||
269 | #define __NR_timer_getoverrun (__NR_timer_create+3) | ||
270 | #define __NR_timer_delete (__NR_timer_create+4) | ||
271 | #define __NR_clock_settime (__NR_timer_create+5) | ||
272 | #define __NR_clock_gettime (__NR_timer_create+6) | ||
273 | #define __NR_clock_getres (__NR_timer_create+7) | ||
274 | #define __NR_clock_nanosleep (__NR_timer_create+8) | ||
275 | #define __NR_statfs64 268 | ||
276 | #define __NR_fstatfs64 269 | ||
277 | #define __NR_tgkill 270 | ||
278 | #define __NR_utimes 271 | ||
279 | #define __NR_fadvise64_64 272 | ||
280 | #define __NR_vserver 273 | ||
281 | #define __NR_mbind 274 | ||
282 | #define __NR_get_mempolicy 275 | ||
283 | #define __NR_set_mempolicy 276 | ||
284 | #define __NR_mq_open 277 | ||
285 | #define __NR_mq_unlink (__NR_mq_open+1) | ||
286 | #define __NR_mq_timedsend (__NR_mq_open+2) | ||
287 | #define __NR_mq_timedreceive (__NR_mq_open+3) | ||
288 | #define __NR_mq_notify (__NR_mq_open+4) | ||
289 | #define __NR_mq_getsetattr (__NR_mq_open+5) | ||
290 | #define __NR_kexec_load 283 | ||
291 | #define __NR_waitid 284 | ||
292 | /* #define __NR_sys_setaltroot 285 */ | ||
293 | #define __NR_add_key 286 | ||
294 | #define __NR_request_key 287 | ||
295 | #define __NR_keyctl 288 | ||
296 | #define __NR_ioprio_set 289 | ||
297 | #define __NR_ioprio_get 290 | ||
298 | #define __NR_inotify_init 291 | ||
299 | #define __NR_inotify_add_watch 292 | ||
300 | #define __NR_inotify_rm_watch 293 | ||
301 | #define __NR_migrate_pages 294 | ||
302 | #define __NR_openat 295 | ||
303 | #define __NR_mkdirat 296 | ||
304 | #define __NR_mknodat 297 | ||
305 | #define __NR_fchownat 298 | ||
306 | #define __NR_futimesat 299 | ||
307 | #define __NR_fstatat64 300 | ||
308 | #define __NR_unlinkat 301 | ||
309 | #define __NR_renameat 302 | ||
310 | #define __NR_linkat 303 | ||
311 | #define __NR_symlinkat 304 | ||
312 | #define __NR_readlinkat 305 | ||
313 | #define __NR_fchmodat 306 | ||
314 | #define __NR_faccessat 307 | ||
315 | #define __NR_pselect6 308 | ||
316 | #define __NR_ppoll 309 | ||
317 | #define __NR_unshare 310 | ||
318 | #define __NR_set_robust_list 311 | ||
319 | #define __NR_get_robust_list 312 | ||
320 | #define __NR_splice 313 | ||
321 | #define __NR_sync_file_range 314 | ||
322 | #define __NR_tee 315 | ||
323 | #define __NR_vmsplice 316 | ||
324 | #define __NR_move_pages 317 | ||
325 | #define __NR_getcpu 318 | ||
326 | #define __NR_epoll_pwait 319 | ||
327 | #define __NR_utimensat 320 | ||
328 | #define __NR_signalfd 321 | ||
329 | #define __NR_timerfd_create 322 | ||
330 | #define __NR_eventfd 323 | ||
331 | #define __NR_fallocate 324 | ||
332 | #define __NR_timerfd_settime 325 | ||
333 | #define __NR_timerfd_gettime 326 | ||
334 | |||
335 | #ifdef __KERNEL__ | ||
336 | |||
337 | #define NR_syscalls 327 | ||
338 | |||
339 | #include <arch/unistd.h> | ||
340 | |||
341 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
342 | #define __ARCH_WANT_OLD_READDIR | ||
343 | #define __ARCH_WANT_OLD_STAT | ||
344 | #define __ARCH_WANT_STAT64 | ||
345 | #define __ARCH_WANT_SYS_ALARM | ||
346 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
347 | #define __ARCH_WANT_SYS_PAUSE | ||
348 | #define __ARCH_WANT_SYS_SGETMASK | ||
349 | #define __ARCH_WANT_SYS_SIGNAL | ||
350 | #define __ARCH_WANT_SYS_TIME | ||
351 | #define __ARCH_WANT_SYS_UTIME | ||
352 | #define __ARCH_WANT_SYS_WAITPID | ||
353 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
354 | #define __ARCH_WANT_SYS_FADVISE64 | ||
355 | #define __ARCH_WANT_SYS_GETPGRP | ||
356 | #define __ARCH_WANT_SYS_LLSEEK | ||
357 | #define __ARCH_WANT_SYS_NICE | ||
358 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
359 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
360 | #define __ARCH_WANT_SYS_SIGPENDING | ||
361 | #define __ARCH_WANT_SYS_SIGPROCMASK | ||
362 | #define __ARCH_WANT_SYS_RT_SIGACTION | ||
363 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
364 | |||
365 | /* | ||
366 | * "Conditional" syscalls | ||
367 | * | ||
368 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
369 | * but it doesn't work on all toolchains, so we just do it by hand | ||
370 | */ | ||
371 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | ||
372 | |||
373 | #endif /* __KERNEL__ */ | ||
374 | #endif /* _ASM_CRIS_UNISTD_H_ */ | ||
diff --git a/arch/cris/include/asm/user.h b/arch/cris/include/asm/user.h new file mode 100644 index 000000000000..59147cf43cf6 --- /dev/null +++ b/arch/cris/include/asm/user.h | |||
@@ -0,0 +1,52 @@ | |||
1 | #ifndef __ASM_CRIS_USER_H | ||
2 | #define __ASM_CRIS_USER_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/ptrace.h> | ||
6 | #include <asm/page.h> | ||
7 | #include <arch/user.h> | ||
8 | |||
9 | /* | ||
10 | * Core file format: The core file is written in such a way that gdb | ||
11 | * can understand it and provide useful information to the user (under | ||
12 | * linux we use the `trad-core' bfd). The file contents are as follows: | ||
13 | * | ||
14 | * upage: 1 page consisting of a user struct that tells gdb | ||
15 | * what is present in the file. Directly after this is a | ||
16 | * copy of the task_struct, which is currently not used by gdb, | ||
17 | * but it may come in handy at some point. All of the registers | ||
18 | * are stored as part of the upage. The upage should always be | ||
19 | * only one page long. | ||
20 | * data: The data segment follows next. We use current->end_text to | ||
21 | * current->brk to pick up all of the user variables, plus any memory | ||
22 | * that may have been sbrk'ed. No attempt is made to determine if a | ||
23 | * page is demand-zero or if a page is totally unused, we just cover | ||
24 | * the entire range. All of the addresses are rounded in such a way | ||
25 | * that an integral number of pages is written. | ||
26 | * stack: We need the stack information in order to get a meaningful | ||
27 | * backtrace. We need to write the data from usp to | ||
28 | * current->start_stack, so we round each of these in order to be able | ||
29 | * to write an integer number of pages. | ||
30 | */ | ||
31 | |||
32 | struct user { | ||
33 | struct user_regs_struct regs; /* entire machine state */ | ||
34 | size_t u_tsize; /* text size (pages) */ | ||
35 | size_t u_dsize; /* data size (pages) */ | ||
36 | size_t u_ssize; /* stack size (pages) */ | ||
37 | unsigned long start_code; /* text starting address */ | ||
38 | unsigned long start_data; /* data starting address */ | ||
39 | unsigned long start_stack; /* stack starting address */ | ||
40 | long int signal; /* signal causing core dump */ | ||
41 | unsigned long u_ar0; /* help gdb find registers */ | ||
42 | unsigned long magic; /* identifies a core file */ | ||
43 | char u_comm[32]; /* user command name */ | ||
44 | }; | ||
45 | |||
46 | #define NBPG PAGE_SIZE | ||
47 | #define UPAGES 1 | ||
48 | #define HOST_TEXT_START_ADDR (u.start_code) | ||
49 | #define HOST_DATA_START_ADDR (u.start_data) | ||
50 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | ||
51 | |||
52 | #endif /* __ASM_CRIS_USER_H */ | ||