diff options
Diffstat (limited to 'arch')
152 files changed, 6399 insertions, 321 deletions
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index 1607c941d95f..10ef464d6be7 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c | |||
@@ -317,7 +317,6 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, | |||
317 | printk(error, 6, status); | 317 | printk(error, 6, status); |
318 | return -ENODEV; | 318 | return -ENODEV; |
319 | } | 319 | } |
320 | data->multipoint = 1; | ||
321 | tusb_device.dev.platform_data = data; | 320 | tusb_device.dev.platform_data = data; |
322 | 321 | ||
323 | /* REVISIT let the driver know what DMA channels work */ | 322 | /* REVISIT let the driver know what DMA channels work */ |
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild new file mode 100644 index 000000000000..c68e1680da01 --- /dev/null +++ b/arch/h8300/include/asm/Kbuild | |||
@@ -0,0 +1 @@ | |||
include include/asm-generic/Kbuild.asm | |||
diff --git a/arch/h8300/include/asm/a.out.h b/arch/h8300/include/asm/a.out.h new file mode 100644 index 000000000000..ded780f0a492 --- /dev/null +++ b/arch/h8300/include/asm/a.out.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __H8300_A_OUT_H__ | ||
2 | #define __H8300_A_OUT_H__ | ||
3 | |||
4 | struct exec | ||
5 | { | ||
6 | unsigned long a_info; /* Use macros N_MAGIC, etc for access */ | ||
7 | unsigned a_text; /* length of text, in bytes */ | ||
8 | unsigned a_data; /* length of data, in bytes */ | ||
9 | unsigned a_bss; /* length of uninitialized data area for file, in bytes */ | ||
10 | unsigned a_syms; /* length of symbol table data in file, in bytes */ | ||
11 | unsigned a_entry; /* start address */ | ||
12 | unsigned a_trsize; /* length of relocation info for text, in bytes */ | ||
13 | unsigned a_drsize; /* length of relocation info for data, in bytes */ | ||
14 | }; | ||
15 | |||
16 | #define N_TRSIZE(a) ((a).a_trsize) | ||
17 | #define N_DRSIZE(a) ((a).a_drsize) | ||
18 | #define N_SYMSIZE(a) ((a).a_syms) | ||
19 | |||
20 | #endif /* __H8300_A_OUT_H__ */ | ||
diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h new file mode 100644 index 000000000000..b4cf0ea97ede --- /dev/null +++ b/arch/h8300/include/asm/atomic.h | |||
@@ -0,0 +1,144 @@ | |||
1 | #ifndef __ARCH_H8300_ATOMIC__ | ||
2 | #define __ARCH_H8300_ATOMIC__ | ||
3 | |||
4 | /* | ||
5 | * Atomic operations that C can't guarantee us. Useful for | ||
6 | * resource counting etc.. | ||
7 | */ | ||
8 | |||
9 | typedef struct { int counter; } atomic_t; | ||
10 | #define ATOMIC_INIT(i) { (i) } | ||
11 | |||
12 | #define atomic_read(v) ((v)->counter) | ||
13 | #define atomic_set(v, i) (((v)->counter) = i) | ||
14 | |||
15 | #include <asm/system.h> | ||
16 | #include <linux/kernel.h> | ||
17 | |||
18 | static __inline__ int atomic_add_return(int i, atomic_t *v) | ||
19 | { | ||
20 | int ret,flags; | ||
21 | local_irq_save(flags); | ||
22 | ret = v->counter += i; | ||
23 | local_irq_restore(flags); | ||
24 | return ret; | ||
25 | } | ||
26 | |||
27 | #define atomic_add(i, v) atomic_add_return(i, v) | ||
28 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | ||
29 | |||
30 | static __inline__ int atomic_sub_return(int i, atomic_t *v) | ||
31 | { | ||
32 | int ret,flags; | ||
33 | local_irq_save(flags); | ||
34 | ret = v->counter -= i; | ||
35 | local_irq_restore(flags); | ||
36 | return ret; | ||
37 | } | ||
38 | |||
39 | #define atomic_sub(i, v) atomic_sub_return(i, v) | ||
40 | #define atomic_sub_and_test(i,v) (atomic_sub_return(i, v) == 0) | ||
41 | |||
42 | static __inline__ int atomic_inc_return(atomic_t *v) | ||
43 | { | ||
44 | int ret,flags; | ||
45 | local_irq_save(flags); | ||
46 | v->counter++; | ||
47 | ret = v->counter; | ||
48 | local_irq_restore(flags); | ||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | #define atomic_inc(v) atomic_inc_return(v) | ||
53 | |||
54 | /* | ||
55 | * atomic_inc_and_test - increment and test | ||
56 | * @v: pointer of type atomic_t | ||
57 | * | ||
58 | * Atomically increments @v by 1 | ||
59 | * and returns true if the result is zero, or false for all | ||
60 | * other cases. | ||
61 | */ | ||
62 | #define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) | ||
63 | |||
64 | static __inline__ int atomic_dec_return(atomic_t *v) | ||
65 | { | ||
66 | int ret,flags; | ||
67 | local_irq_save(flags); | ||
68 | --v->counter; | ||
69 | ret = v->counter; | ||
70 | local_irq_restore(flags); | ||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | #define atomic_dec(v) atomic_dec_return(v) | ||
75 | |||
76 | static __inline__ int atomic_dec_and_test(atomic_t *v) | ||
77 | { | ||
78 | int ret,flags; | ||
79 | local_irq_save(flags); | ||
80 | --v->counter; | ||
81 | ret = v->counter; | ||
82 | local_irq_restore(flags); | ||
83 | return ret == 0; | ||
84 | } | ||
85 | |||
86 | static inline int atomic_cmpxchg(atomic_t *v, int old, int new) | ||
87 | { | ||
88 | int ret; | ||
89 | unsigned long flags; | ||
90 | |||
91 | local_irq_save(flags); | ||
92 | ret = v->counter; | ||
93 | if (likely(ret == old)) | ||
94 | v->counter = new; | ||
95 | local_irq_restore(flags); | ||
96 | return ret; | ||
97 | } | ||
98 | |||
99 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | ||
100 | |||
101 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | ||
102 | { | ||
103 | int ret; | ||
104 | unsigned long flags; | ||
105 | |||
106 | local_irq_save(flags); | ||
107 | ret = v->counter; | ||
108 | if (ret != u) | ||
109 | v->counter += a; | ||
110 | local_irq_restore(flags); | ||
111 | return ret != u; | ||
112 | } | ||
113 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | ||
114 | |||
115 | static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *v) | ||
116 | { | ||
117 | __asm__ __volatile__("stc ccr,r1l\n\t" | ||
118 | "orc #0x80,ccr\n\t" | ||
119 | "mov.l %0,er0\n\t" | ||
120 | "and.l %1,er0\n\t" | ||
121 | "mov.l er0,%0\n\t" | ||
122 | "ldc r1l,ccr" | ||
123 | : "=m" (*v) : "g" (~(mask)) :"er0","er1"); | ||
124 | } | ||
125 | |||
126 | static __inline__ void atomic_set_mask(unsigned long mask, unsigned long *v) | ||
127 | { | ||
128 | __asm__ __volatile__("stc ccr,r1l\n\t" | ||
129 | "orc #0x80,ccr\n\t" | ||
130 | "mov.l %0,er0\n\t" | ||
131 | "or.l %1,er0\n\t" | ||
132 | "mov.l er0,%0\n\t" | ||
133 | "ldc r1l,ccr" | ||
134 | : "=m" (*v) : "g" (mask) :"er0","er1"); | ||
135 | } | ||
136 | |||
137 | /* Atomic operations are already serializing */ | ||
138 | #define smp_mb__before_atomic_dec() barrier() | ||
139 | #define smp_mb__after_atomic_dec() barrier() | ||
140 | #define smp_mb__before_atomic_inc() barrier() | ||
141 | #define smp_mb__after_atomic_inc() barrier() | ||
142 | |||
143 | #include <asm-generic/atomic.h> | ||
144 | #endif /* __ARCH_H8300_ATOMIC __ */ | ||
diff --git a/arch/h8300/include/asm/auxvec.h b/arch/h8300/include/asm/auxvec.h new file mode 100644 index 000000000000..1d36fe38b088 --- /dev/null +++ b/arch/h8300/include/asm/auxvec.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __ASMH8300_AUXVEC_H | ||
2 | #define __ASMH8300_AUXVEC_H | ||
3 | |||
4 | #endif | ||
diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h new file mode 100644 index 000000000000..cb18e3b0aa94 --- /dev/null +++ b/arch/h8300/include/asm/bitops.h | |||
@@ -0,0 +1,212 @@ | |||
1 | #ifndef _H8300_BITOPS_H | ||
2 | #define _H8300_BITOPS_H | ||
3 | |||
4 | /* | ||
5 | * Copyright 1992, Linus Torvalds. | ||
6 | * Copyright 2002, Yoshinori Sato | ||
7 | */ | ||
8 | |||
9 | #include <linux/compiler.h> | ||
10 | #include <asm/system.h> | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #ifndef _LINUX_BITOPS_H | ||
15 | #error only <linux/bitops.h> can be included directly | ||
16 | #endif | ||
17 | |||
18 | /* | ||
19 | * Function prototypes to keep gcc -Wall happy | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * ffz = Find First Zero in word. Undefined if no zero exists, | ||
24 | * so code should check against ~0UL first.. | ||
25 | */ | ||
26 | static __inline__ unsigned long ffz(unsigned long word) | ||
27 | { | ||
28 | unsigned long result; | ||
29 | |||
30 | result = -1; | ||
31 | __asm__("1:\n\t" | ||
32 | "shlr.l %2\n\t" | ||
33 | "adds #1,%0\n\t" | ||
34 | "bcs 1b" | ||
35 | : "=r" (result) | ||
36 | : "0" (result),"r" (word)); | ||
37 | return result; | ||
38 | } | ||
39 | |||
40 | #define H8300_GEN_BITOP_CONST(OP,BIT) \ | ||
41 | case BIT: \ | ||
42 | __asm__(OP " #" #BIT ",@%0"::"r"(b_addr):"memory"); \ | ||
43 | break; | ||
44 | |||
45 | #define H8300_GEN_BITOP(FNAME,OP) \ | ||
46 | static __inline__ void FNAME(int nr, volatile unsigned long* addr) \ | ||
47 | { \ | ||
48 | volatile unsigned char *b_addr; \ | ||
49 | b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \ | ||
50 | if (__builtin_constant_p(nr)) { \ | ||
51 | switch(nr & 7) { \ | ||
52 | H8300_GEN_BITOP_CONST(OP,0) \ | ||
53 | H8300_GEN_BITOP_CONST(OP,1) \ | ||
54 | H8300_GEN_BITOP_CONST(OP,2) \ | ||
55 | H8300_GEN_BITOP_CONST(OP,3) \ | ||
56 | H8300_GEN_BITOP_CONST(OP,4) \ | ||
57 | H8300_GEN_BITOP_CONST(OP,5) \ | ||
58 | H8300_GEN_BITOP_CONST(OP,6) \ | ||
59 | H8300_GEN_BITOP_CONST(OP,7) \ | ||
60 | } \ | ||
61 | } else { \ | ||
62 | __asm__(OP " %w0,@%1"::"r"(nr),"r"(b_addr):"memory"); \ | ||
63 | } \ | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * clear_bit() doesn't provide any barrier for the compiler. | ||
68 | */ | ||
69 | #define smp_mb__before_clear_bit() barrier() | ||
70 | #define smp_mb__after_clear_bit() barrier() | ||
71 | |||
72 | H8300_GEN_BITOP(set_bit ,"bset") | ||
73 | H8300_GEN_BITOP(clear_bit ,"bclr") | ||
74 | H8300_GEN_BITOP(change_bit,"bnot") | ||
75 | #define __set_bit(nr,addr) set_bit((nr),(addr)) | ||
76 | #define __clear_bit(nr,addr) clear_bit((nr),(addr)) | ||
77 | #define __change_bit(nr,addr) change_bit((nr),(addr)) | ||
78 | |||
79 | #undef H8300_GEN_BITOP | ||
80 | #undef H8300_GEN_BITOP_CONST | ||
81 | |||
82 | static __inline__ int test_bit(int nr, const unsigned long* addr) | ||
83 | { | ||
84 | return (*((volatile unsigned char *)addr + | ||
85 | ((nr >> 3) ^ 3)) & (1UL << (nr & 7))) != 0; | ||
86 | } | ||
87 | |||
88 | #define __test_bit(nr, addr) test_bit(nr, addr) | ||
89 | |||
90 | #define H8300_GEN_TEST_BITOP_CONST_INT(OP,BIT) \ | ||
91 | case BIT: \ | ||
92 | __asm__("stc ccr,%w1\n\t" \ | ||
93 | "orc #0x80,ccr\n\t" \ | ||
94 | "bld #" #BIT ",@%4\n\t" \ | ||
95 | OP " #" #BIT ",@%4\n\t" \ | ||
96 | "rotxl.l %0\n\t" \ | ||
97 | "ldc %w1,ccr" \ | ||
98 | : "=r"(retval),"=&r"(ccrsave),"=m"(*b_addr) \ | ||
99 | : "0" (retval),"r" (b_addr) \ | ||
100 | : "memory"); \ | ||
101 | break; | ||
102 | |||
103 | #define H8300_GEN_TEST_BITOP_CONST(OP,BIT) \ | ||
104 | case BIT: \ | ||
105 | __asm__("bld #" #BIT ",@%3\n\t" \ | ||
106 | OP " #" #BIT ",@%3\n\t" \ | ||
107 | "rotxl.l %0\n\t" \ | ||
108 | : "=r"(retval),"=m"(*b_addr) \ | ||
109 | : "0" (retval),"r" (b_addr) \ | ||
110 | : "memory"); \ | ||
111 | break; | ||
112 | |||
113 | #define H8300_GEN_TEST_BITOP(FNNAME,OP) \ | ||
114 | static __inline__ int FNNAME(int nr, volatile void * addr) \ | ||
115 | { \ | ||
116 | int retval = 0; \ | ||
117 | char ccrsave; \ | ||
118 | volatile unsigned char *b_addr; \ | ||
119 | b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \ | ||
120 | if (__builtin_constant_p(nr)) { \ | ||
121 | switch(nr & 7) { \ | ||
122 | H8300_GEN_TEST_BITOP_CONST_INT(OP,0) \ | ||
123 | H8300_GEN_TEST_BITOP_CONST_INT(OP,1) \ | ||
124 | H8300_GEN_TEST_BITOP_CONST_INT(OP,2) \ | ||
125 | H8300_GEN_TEST_BITOP_CONST_INT(OP,3) \ | ||
126 | H8300_GEN_TEST_BITOP_CONST_INT(OP,4) \ | ||
127 | H8300_GEN_TEST_BITOP_CONST_INT(OP,5) \ | ||
128 | H8300_GEN_TEST_BITOP_CONST_INT(OP,6) \ | ||
129 | H8300_GEN_TEST_BITOP_CONST_INT(OP,7) \ | ||
130 | } \ | ||
131 | } else { \ | ||
132 | __asm__("stc ccr,%w1\n\t" \ | ||
133 | "orc #0x80,ccr\n\t" \ | ||
134 | "btst %w5,@%4\n\t" \ | ||
135 | OP " %w5,@%4\n\t" \ | ||
136 | "beq 1f\n\t" \ | ||
137 | "inc.l #1,%0\n" \ | ||
138 | "1:\n\t" \ | ||
139 | "ldc %w1,ccr" \ | ||
140 | : "=r"(retval),"=&r"(ccrsave),"=m"(*b_addr) \ | ||
141 | : "0" (retval),"r" (b_addr),"r"(nr) \ | ||
142 | : "memory"); \ | ||
143 | } \ | ||
144 | return retval; \ | ||
145 | } \ | ||
146 | \ | ||
147 | static __inline__ int __ ## FNNAME(int nr, volatile void * addr) \ | ||
148 | { \ | ||
149 | int retval = 0; \ | ||
150 | volatile unsigned char *b_addr; \ | ||
151 | b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \ | ||
152 | if (__builtin_constant_p(nr)) { \ | ||
153 | switch(nr & 7) { \ | ||
154 | H8300_GEN_TEST_BITOP_CONST(OP,0) \ | ||
155 | H8300_GEN_TEST_BITOP_CONST(OP,1) \ | ||
156 | H8300_GEN_TEST_BITOP_CONST(OP,2) \ | ||
157 | H8300_GEN_TEST_BITOP_CONST(OP,3) \ | ||
158 | H8300_GEN_TEST_BITOP_CONST(OP,4) \ | ||
159 | H8300_GEN_TEST_BITOP_CONST(OP,5) \ | ||
160 | H8300_GEN_TEST_BITOP_CONST(OP,6) \ | ||
161 | H8300_GEN_TEST_BITOP_CONST(OP,7) \ | ||
162 | } \ | ||
163 | } else { \ | ||
164 | __asm__("btst %w4,@%3\n\t" \ | ||
165 | OP " %w4,@%3\n\t" \ | ||
166 | "beq 1f\n\t" \ | ||
167 | "inc.l #1,%0\n" \ | ||
168 | "1:" \ | ||
169 | : "=r"(retval),"=m"(*b_addr) \ | ||
170 | : "0" (retval),"r" (b_addr),"r"(nr) \ | ||
171 | : "memory"); \ | ||
172 | } \ | ||
173 | return retval; \ | ||
174 | } | ||
175 | |||
176 | H8300_GEN_TEST_BITOP(test_and_set_bit, "bset") | ||
177 | H8300_GEN_TEST_BITOP(test_and_clear_bit, "bclr") | ||
178 | H8300_GEN_TEST_BITOP(test_and_change_bit,"bnot") | ||
179 | #undef H8300_GEN_TEST_BITOP_CONST | ||
180 | #undef H8300_GEN_TEST_BITOP_CONST_INT | ||
181 | #undef H8300_GEN_TEST_BITOP | ||
182 | |||
183 | #include <asm-generic/bitops/ffs.h> | ||
184 | |||
185 | static __inline__ unsigned long __ffs(unsigned long word) | ||
186 | { | ||
187 | unsigned long result; | ||
188 | |||
189 | result = -1; | ||
190 | __asm__("1:\n\t" | ||
191 | "shlr.l %2\n\t" | ||
192 | "adds #1,%0\n\t" | ||
193 | "bcc 1b" | ||
194 | : "=r" (result) | ||
195 | : "0"(result),"r"(word)); | ||
196 | return result; | ||
197 | } | ||
198 | |||
199 | #include <asm-generic/bitops/find.h> | ||
200 | #include <asm-generic/bitops/sched.h> | ||
201 | #include <asm-generic/bitops/hweight.h> | ||
202 | #include <asm-generic/bitops/lock.h> | ||
203 | #include <asm-generic/bitops/ext2-non-atomic.h> | ||
204 | #include <asm-generic/bitops/ext2-atomic.h> | ||
205 | #include <asm-generic/bitops/minix.h> | ||
206 | |||
207 | #endif /* __KERNEL__ */ | ||
208 | |||
209 | #include <asm-generic/bitops/fls.h> | ||
210 | #include <asm-generic/bitops/fls64.h> | ||
211 | |||
212 | #endif /* _H8300_BITOPS_H */ | ||
diff --git a/arch/h8300/include/asm/bootinfo.h b/arch/h8300/include/asm/bootinfo.h new file mode 100644 index 000000000000..5bed7e7aac0a --- /dev/null +++ b/arch/h8300/include/asm/bootinfo.h | |||
@@ -0,0 +1,2 @@ | |||
1 | |||
2 | /* Nothing for h8300 */ | ||
diff --git a/arch/h8300/include/asm/bug.h b/arch/h8300/include/asm/bug.h new file mode 100644 index 000000000000..edddf5b086e5 --- /dev/null +++ b/arch/h8300/include/asm/bug.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _H8300_BUG_H | ||
2 | #define _H8300_BUG_H | ||
3 | #include <asm-generic/bug.h> | ||
4 | #endif | ||
diff --git a/arch/h8300/include/asm/bugs.h b/arch/h8300/include/asm/bugs.h new file mode 100644 index 000000000000..1cb4afba6eb1 --- /dev/null +++ b/arch/h8300/include/asm/bugs.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-h8300/bugs.h | ||
3 | * | ||
4 | * Copyright (C) 1994 Linus Torvalds | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * This is included by init/main.c to check for architecture-dependent bugs. | ||
9 | * | ||
10 | * Needs: | ||
11 | * void check_bugs(void); | ||
12 | */ | ||
13 | |||
14 | static void check_bugs(void) | ||
15 | { | ||
16 | } | ||
diff --git a/arch/h8300/include/asm/byteorder.h b/arch/h8300/include/asm/byteorder.h new file mode 100644 index 000000000000..36e597d61619 --- /dev/null +++ b/arch/h8300/include/asm/byteorder.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _H8300_BYTEORDER_H | ||
2 | #define _H8300_BYTEORDER_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | |||
6 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
7 | # define __BYTEORDER_HAS_U64__ | ||
8 | # define __SWAB_64_THRU_32__ | ||
9 | #endif | ||
10 | |||
11 | #include <linux/byteorder/big_endian.h> | ||
12 | |||
13 | #endif /* _H8300_BYTEORDER_H */ | ||
diff --git a/arch/h8300/include/asm/cache.h b/arch/h8300/include/asm/cache.h new file mode 100644 index 000000000000..c6350283649d --- /dev/null +++ b/arch/h8300/include/asm/cache.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __ARCH_H8300_CACHE_H | ||
2 | #define __ARCH_H8300_CACHE_H | ||
3 | |||
4 | /* bytes per L1 cache line */ | ||
5 | #define L1_CACHE_BYTES 4 | ||
6 | |||
7 | /* m68k-elf-gcc 2.95.2 doesn't like these */ | ||
8 | |||
9 | #define __cacheline_aligned | ||
10 | #define ____cacheline_aligned | ||
11 | |||
12 | #endif | ||
diff --git a/arch/h8300/include/asm/cachectl.h b/arch/h8300/include/asm/cachectl.h new file mode 100644 index 000000000000..c464022d8e26 --- /dev/null +++ b/arch/h8300/include/asm/cachectl.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _H8300_CACHECTL_H | ||
2 | #define _H8300_CACHECTL_H | ||
3 | |||
4 | /* Definitions for the cacheflush system call. */ | ||
5 | |||
6 | #define FLUSH_SCOPE_LINE 0 /* Flush a cache line */ | ||
7 | #define FLUSH_SCOPE_PAGE 0 /* Flush a page */ | ||
8 | #define FLUSH_SCOPE_ALL 0 /* Flush the whole cache -- superuser only */ | ||
9 | |||
10 | #define FLUSH_CACHE_DATA 0 /* Writeback and flush data cache */ | ||
11 | #define FLUSH_CACHE_INSN 0 /* Flush instruction cache */ | ||
12 | #define FLUSH_CACHE_BOTH 0 /* Flush both caches */ | ||
13 | |||
14 | #endif /* _H8300_CACHECTL_H */ | ||
diff --git a/arch/h8300/include/asm/cacheflush.h b/arch/h8300/include/asm/cacheflush.h new file mode 100644 index 000000000000..5ffdca217b95 --- /dev/null +++ b/arch/h8300/include/asm/cacheflush.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * (C) Copyright 2002, Yoshinori Sato <ysato@users.sourceforge.jp> | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASM_H8300_CACHEFLUSH_H | ||
6 | #define _ASM_H8300_CACHEFLUSH_H | ||
7 | |||
8 | /* | ||
9 | * Cache handling functions | ||
10 | * No Cache memory all dummy functions | ||
11 | */ | ||
12 | |||
13 | #define flush_cache_all() | ||
14 | #define flush_cache_mm(mm) | ||
15 | #define flush_cache_dup_mm(mm) do { } while (0) | ||
16 | #define flush_cache_range(vma,a,b) | ||
17 | #define flush_cache_page(vma,p,pfn) | ||
18 | #define flush_dcache_page(page) | ||
19 | #define flush_dcache_mmap_lock(mapping) | ||
20 | #define flush_dcache_mmap_unlock(mapping) | ||
21 | #define flush_icache() | ||
22 | #define flush_icache_page(vma,page) | ||
23 | #define flush_icache_range(start,len) | ||
24 | #define flush_cache_vmap(start, end) | ||
25 | #define flush_cache_vunmap(start, end) | ||
26 | #define cache_push_v(vaddr,len) | ||
27 | #define cache_push(paddr,len) | ||
28 | #define cache_clear(paddr,len) | ||
29 | |||
30 | #define flush_dcache_range(a,b) | ||
31 | |||
32 | #define flush_icache_user_range(vma,page,addr,len) | ||
33 | |||
34 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
35 | memcpy(dst, src, len) | ||
36 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
37 | memcpy(dst, src, len) | ||
38 | |||
39 | #endif /* _ASM_H8300_CACHEFLUSH_H */ | ||
diff --git a/arch/h8300/include/asm/checksum.h b/arch/h8300/include/asm/checksum.h new file mode 100644 index 000000000000..98724e12508c --- /dev/null +++ b/arch/h8300/include/asm/checksum.h | |||
@@ -0,0 +1,102 @@ | |||
1 | #ifndef _H8300_CHECKSUM_H | ||
2 | #define _H8300_CHECKSUM_H | ||
3 | |||
4 | /* | ||
5 | * computes the checksum of a memory block at buff, length len, | ||
6 | * and adds in "sum" (32-bit) | ||
7 | * | ||
8 | * returns a 32-bit number suitable for feeding into itself | ||
9 | * or csum_tcpudp_magic | ||
10 | * | ||
11 | * this function must be called with even lengths, except | ||
12 | * for the last fragment, which may be odd | ||
13 | * | ||
14 | * it's best to have buff aligned on a 32-bit boundary | ||
15 | */ | ||
16 | __wsum csum_partial(const void *buff, int len, __wsum sum); | ||
17 | |||
18 | /* | ||
19 | * the same as csum_partial, but copies from src while it | ||
20 | * checksums | ||
21 | * | ||
22 | * here even more important to align src and dst on a 32-bit (or even | ||
23 | * better 64-bit) boundary | ||
24 | */ | ||
25 | |||
26 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum); | ||
27 | |||
28 | |||
29 | /* | ||
30 | * the same as csum_partial_copy, but copies from user space. | ||
31 | * | ||
32 | * here even more important to align src and dst on a 32-bit (or even | ||
33 | * better 64-bit) boundary | ||
34 | */ | ||
35 | |||
36 | extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | ||
37 | int len, __wsum sum, int *csum_err); | ||
38 | |||
39 | __sum16 ip_fast_csum(const void *iph, unsigned int ihl); | ||
40 | |||
41 | |||
42 | /* | ||
43 | * Fold a partial checksum | ||
44 | */ | ||
45 | |||
46 | static inline __sum16 csum_fold(__wsum sum) | ||
47 | { | ||
48 | __asm__("mov.l %0,er0\n\t" | ||
49 | "add.w e0,r0\n\t" | ||
50 | "xor.w e0,e0\n\t" | ||
51 | "rotxl.w e0\n\t" | ||
52 | "add.w e0,r0\n\t" | ||
53 | "sub.w e0,e0\n\t" | ||
54 | "mov.l er0,%0" | ||
55 | : "=r"(sum) | ||
56 | : "0"(sum) | ||
57 | : "er0"); | ||
58 | return (__force __sum16)~sum; | ||
59 | } | ||
60 | |||
61 | |||
62 | /* | ||
63 | * computes the checksum of the TCP/UDP pseudo-header | ||
64 | * returns a 16-bit checksum, already complemented | ||
65 | */ | ||
66 | |||
67 | static inline __wsum | ||
68 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | ||
69 | unsigned short proto, __wsum sum) | ||
70 | { | ||
71 | __asm__ ("sub.l er0,er0\n\t" | ||
72 | "add.l %2,%0\n\t" | ||
73 | "addx #0,r0l\n\t" | ||
74 | "add.l %3,%0\n\t" | ||
75 | "addx #0,r0l\n\t" | ||
76 | "add.l %4,%0\n\t" | ||
77 | "addx #0,r0l\n\t" | ||
78 | "add.l er0,%0\n\t" | ||
79 | "bcc 1f\n\t" | ||
80 | "inc.l #1,%0\n" | ||
81 | "1:" | ||
82 | : "=&r" (sum) | ||
83 | : "0" (sum), "r" (daddr), "r" (saddr), "r" (len + proto) | ||
84 | :"er0"); | ||
85 | return sum; | ||
86 | } | ||
87 | |||
88 | static inline __sum16 | ||
89 | csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, | ||
90 | unsigned short proto, __wsum sum) | ||
91 | { | ||
92 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
97 | * in icmp.c | ||
98 | */ | ||
99 | |||
100 | extern __sum16 ip_compute_csum(const void *buff, int len); | ||
101 | |||
102 | #endif /* _H8300_CHECKSUM_H */ | ||
diff --git a/arch/h8300/include/asm/cputime.h b/arch/h8300/include/asm/cputime.h new file mode 100644 index 000000000000..092e187c7b08 --- /dev/null +++ b/arch/h8300/include/asm/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __H8300_CPUTIME_H | ||
2 | #define __H8300_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __H8300_CPUTIME_H */ | ||
diff --git a/arch/h8300/include/asm/current.h b/arch/h8300/include/asm/current.h new file mode 100644 index 000000000000..57d74ee55a14 --- /dev/null +++ b/arch/h8300/include/asm/current.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _H8300_CURRENT_H | ||
2 | #define _H8300_CURRENT_H | ||
3 | /* | ||
4 | * current.h | ||
5 | * (C) Copyright 2000, Lineo, David McCullough <davidm@lineo.com> | ||
6 | * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) | ||
7 | * | ||
8 | * rather than dedicate a register (as the m68k source does), we | ||
9 | * just keep a global, we should probably just change it all to be | ||
10 | * current and lose _current_task. | ||
11 | */ | ||
12 | |||
13 | #include <linux/thread_info.h> | ||
14 | #include <asm/thread_info.h> | ||
15 | |||
16 | struct task_struct; | ||
17 | |||
18 | static inline struct task_struct *get_current(void) | ||
19 | { | ||
20 | return(current_thread_info()->task); | ||
21 | } | ||
22 | |||
23 | #define current get_current() | ||
24 | |||
25 | #endif /* _H8300_CURRENT_H */ | ||
diff --git a/arch/h8300/include/asm/dbg.h b/arch/h8300/include/asm/dbg.h new file mode 100644 index 000000000000..2c6d1cbcf736 --- /dev/null +++ b/arch/h8300/include/asm/dbg.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #define DEBUG 1 | ||
2 | #define BREAK asm volatile ("trap #3") | ||
diff --git a/arch/h8300/include/asm/delay.h b/arch/h8300/include/asm/delay.h new file mode 100644 index 000000000000..743beba70f82 --- /dev/null +++ b/arch/h8300/include/asm/delay.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef _H8300_DELAY_H | ||
2 | #define _H8300_DELAY_H | ||
3 | |||
4 | #include <asm/param.h> | ||
5 | |||
6 | /* | ||
7 | * Copyright (C) 2002 Yoshinori Sato <ysato@sourceforge.jp> | ||
8 | * | ||
9 | * Delay routines, using a pre-computed "loops_per_second" value. | ||
10 | */ | ||
11 | |||
12 | static inline void __delay(unsigned long loops) | ||
13 | { | ||
14 | __asm__ __volatile__ ("1:\n\t" | ||
15 | "dec.l #1,%0\n\t" | ||
16 | "bne 1b" | ||
17 | :"=r" (loops):"0"(loops)); | ||
18 | } | ||
19 | |||
20 | /* | ||
21 | * Use only for very small delays ( < 1 msec). Should probably use a | ||
22 | * lookup table, really, as the multiplications take much too long with | ||
23 | * short delays. This is a "reasonable" implementation, though (and the | ||
24 | * first constant multiplications gets optimized away if the delay is | ||
25 | * a constant) | ||
26 | */ | ||
27 | |||
28 | extern unsigned long loops_per_jiffy; | ||
29 | |||
30 | static inline void udelay(unsigned long usecs) | ||
31 | { | ||
32 | usecs *= 4295; /* 2**32 / 1000000 */ | ||
33 | usecs /= (loops_per_jiffy*HZ); | ||
34 | if (usecs) | ||
35 | __delay(usecs); | ||
36 | } | ||
37 | |||
38 | #endif /* _H8300_DELAY_H */ | ||
diff --git a/arch/h8300/include/asm/device.h b/arch/h8300/include/asm/device.h new file mode 100644 index 000000000000..d8f9872b0e2d --- /dev/null +++ b/arch/h8300/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/h8300/include/asm/div64.h b/arch/h8300/include/asm/div64.h new file mode 100644 index 000000000000..6cd978cefb28 --- /dev/null +++ b/arch/h8300/include/asm/div64.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/div64.h> | |||
diff --git a/arch/h8300/include/asm/dma.h b/arch/h8300/include/asm/dma.h new file mode 100644 index 000000000000..3edbaaaedf5b --- /dev/null +++ b/arch/h8300/include/asm/dma.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _H8300_DMA_H | ||
2 | #define _H8300_DMA_H | ||
3 | |||
4 | |||
5 | /* | ||
6 | * Set number of channels of DMA on ColdFire for different implementations. | ||
7 | */ | ||
8 | #define MAX_DMA_CHANNELS 0 | ||
9 | #define MAX_DMA_ADDRESS PAGE_OFFSET | ||
10 | |||
11 | /* These are in kernel/dma.c: */ | ||
12 | extern int request_dma(unsigned int dmanr, const char *device_id); /* reserve a DMA channel */ | ||
13 | extern void free_dma(unsigned int dmanr); /* release it again */ | ||
14 | |||
15 | #endif /* _H8300_DMA_H */ | ||
diff --git a/arch/h8300/include/asm/elf.h b/arch/h8300/include/asm/elf.h new file mode 100644 index 000000000000..a8b57d1f4128 --- /dev/null +++ b/arch/h8300/include/asm/elf.h | |||
@@ -0,0 +1,104 @@ | |||
1 | #ifndef __ASMH8300_ELF_H | ||
2 | #define __ASMH8300_ELF_H | ||
3 | |||
4 | /* | ||
5 | * ELF register definitions.. | ||
6 | */ | ||
7 | |||
8 | #include <asm/ptrace.h> | ||
9 | #include <asm/user.h> | ||
10 | |||
11 | typedef unsigned long elf_greg_t; | ||
12 | |||
13 | #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t)) | ||
14 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
15 | typedef unsigned long elf_fpregset_t; | ||
16 | |||
17 | /* | ||
18 | * This is used to ensure we don't load something for the wrong architecture. | ||
19 | */ | ||
20 | #define elf_check_arch(x) ((x)->e_machine == EM_H8_300) | ||
21 | |||
22 | /* | ||
23 | * These are used to set parameters in the core dumps. | ||
24 | */ | ||
25 | #define ELF_CLASS ELFCLASS32 | ||
26 | #define ELF_DATA ELFDATA2MSB | ||
27 | #define ELF_ARCH EM_H8_300 | ||
28 | #if defined(__H8300H__) | ||
29 | #define ELF_CORE_EFLAGS 0x810000 | ||
30 | #endif | ||
31 | #if defined(__H8300S__) | ||
32 | #define ELF_CORE_EFLAGS 0x820000 | ||
33 | #endif | ||
34 | |||
35 | #define ELF_PLAT_INIT(_r) _r->er1 = 0 | ||
36 | |||
37 | #define USE_ELF_CORE_DUMP | ||
38 | #define ELF_EXEC_PAGESIZE 4096 | ||
39 | |||
40 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
41 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
42 | the loader. We need to make sure that it is out of the way of the program | ||
43 | that it will "exec", and that there is sufficient room for the brk. */ | ||
44 | |||
45 | #define ELF_ET_DYN_BASE 0xD0000000UL | ||
46 | |||
47 | /* This yields a mask that user programs can use to figure out what | ||
48 | instruction set this cpu supports. */ | ||
49 | |||
50 | #define ELF_HWCAP (0) | ||
51 | |||
52 | /* This yields a string that ld.so will use to load implementation | ||
53 | specific libraries for optimization. This is more specific in | ||
54 | intent than poking at uname or /proc/cpuinfo. */ | ||
55 | |||
56 | #define ELF_PLATFORM (NULL) | ||
57 | |||
58 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) | ||
59 | |||
60 | #define R_H8_NONE 0 | ||
61 | #define R_H8_DIR32 1 | ||
62 | #define R_H8_DIR32_28 2 | ||
63 | #define R_H8_DIR32_24 3 | ||
64 | #define R_H8_DIR32_16 4 | ||
65 | #define R_H8_DIR32U 6 | ||
66 | #define R_H8_DIR32U_28 7 | ||
67 | #define R_H8_DIR32U_24 8 | ||
68 | #define R_H8_DIR32U_20 9 | ||
69 | #define R_H8_DIR32U_16 10 | ||
70 | #define R_H8_DIR24 11 | ||
71 | #define R_H8_DIR24_20 12 | ||
72 | #define R_H8_DIR24_16 13 | ||
73 | #define R_H8_DIR24U 14 | ||
74 | #define R_H8_DIR24U_20 15 | ||
75 | #define R_H8_DIR24U_16 16 | ||
76 | #define R_H8_DIR16 17 | ||
77 | #define R_H8_DIR16U 18 | ||
78 | #define R_H8_DIR16S_32 19 | ||
79 | #define R_H8_DIR16S_28 20 | ||
80 | #define R_H8_DIR16S_24 21 | ||
81 | #define R_H8_DIR16S_20 22 | ||
82 | #define R_H8_DIR16S 23 | ||
83 | #define R_H8_DIR8 24 | ||
84 | #define R_H8_DIR8U 25 | ||
85 | #define R_H8_DIR8Z_32 26 | ||
86 | #define R_H8_DIR8Z_28 27 | ||
87 | #define R_H8_DIR8Z_24 28 | ||
88 | #define R_H8_DIR8Z_20 29 | ||
89 | #define R_H8_DIR8Z_16 30 | ||
90 | #define R_H8_PCREL16 31 | ||
91 | #define R_H8_PCREL8 32 | ||
92 | #define R_H8_BPOS 33 | ||
93 | #define R_H8_PCREL32 34 | ||
94 | #define R_H8_GOT32O 35 | ||
95 | #define R_H8_GOT16O 36 | ||
96 | #define R_H8_DIR16A8 59 | ||
97 | #define R_H8_DIR16R8 60 | ||
98 | #define R_H8_DIR24A8 61 | ||
99 | #define R_H8_DIR24R8 62 | ||
100 | #define R_H8_DIR32A16 63 | ||
101 | #define R_H8_ABS32 65 | ||
102 | #define R_H8_ABS32A16 127 | ||
103 | |||
104 | #endif | ||
diff --git a/arch/h8300/include/asm/emergency-restart.h b/arch/h8300/include/asm/emergency-restart.h new file mode 100644 index 000000000000..108d8c48e42e --- /dev/null +++ b/arch/h8300/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/h8300/include/asm/errno.h b/arch/h8300/include/asm/errno.h new file mode 100644 index 000000000000..0c2f5641fdcc --- /dev/null +++ b/arch/h8300/include/asm/errno.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _H8300_ERRNO_H | ||
2 | #define _H8300_ERRNO_H | ||
3 | |||
4 | #include <asm-generic/errno.h> | ||
5 | |||
6 | #endif /* _H8300_ERRNO_H */ | ||
diff --git a/arch/h8300/include/asm/fb.h b/arch/h8300/include/asm/fb.h new file mode 100644 index 000000000000..c7df38030992 --- /dev/null +++ b/arch/h8300/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/h8300/include/asm/fcntl.h b/arch/h8300/include/asm/fcntl.h new file mode 100644 index 000000000000..1952cb2e3b06 --- /dev/null +++ b/arch/h8300/include/asm/fcntl.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _H8300_FCNTL_H | ||
2 | #define _H8300_FCNTL_H | ||
3 | |||
4 | #define O_DIRECTORY 040000 /* must be a directory */ | ||
5 | #define O_NOFOLLOW 0100000 /* don't follow links */ | ||
6 | #define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ | ||
7 | #define O_LARGEFILE 0400000 | ||
8 | |||
9 | #include <asm-generic/fcntl.h> | ||
10 | |||
11 | #endif /* _H8300_FCNTL_H */ | ||
diff --git a/arch/h8300/include/asm/flat.h b/arch/h8300/include/asm/flat.h new file mode 100644 index 000000000000..2a873508a9a1 --- /dev/null +++ b/arch/h8300/include/asm/flat.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * include/asm-h8300/flat.h -- uClinux flat-format executables | ||
3 | */ | ||
4 | |||
5 | #ifndef __H8300_FLAT_H__ | ||
6 | #define __H8300_FLAT_H__ | ||
7 | |||
8 | #define flat_stack_align(sp) /* nothing needed */ | ||
9 | #define flat_argvp_envp_on_stack() 1 | ||
10 | #define flat_old_ram_flag(flags) 1 | ||
11 | #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) | ||
12 | #define flat_set_persistent(relval, p) 0 | ||
13 | |||
14 | /* | ||
15 | * on the H8 a couple of the relocations have an instruction in the | ||
16 | * top byte. As there can only be 24bits of address space, we just | ||
17 | * always preserve that 8bits at the top, when it isn't an instruction | ||
18 | * is is 0 (davidm@snapgear.com) | ||
19 | */ | ||
20 | |||
21 | #define flat_get_relocate_addr(rel) (rel) | ||
22 | #define flat_get_addr_from_rp(rp, relval, flags, persistent) \ | ||
23 | (get_unaligned(rp) & ((flags & FLAT_FLAG_GOTPIC) ? 0xffffffff: 0x00ffffff)) | ||
24 | #define flat_put_addr_at_rp(rp, addr, rel) \ | ||
25 | put_unaligned (((*(char *)(rp)) << 24) | ((addr) & 0x00ffffff), rp) | ||
26 | |||
27 | #endif /* __H8300_FLAT_H__ */ | ||
diff --git a/arch/h8300/include/asm/fpu.h b/arch/h8300/include/asm/fpu.h new file mode 100644 index 000000000000..4fc416e80bef --- /dev/null +++ b/arch/h8300/include/asm/fpu.h | |||
@@ -0,0 +1 @@ | |||
/* Nothing do */ | |||
diff --git a/arch/h8300/include/asm/futex.h b/arch/h8300/include/asm/futex.h new file mode 100644 index 000000000000..6a332a9f099c --- /dev/null +++ b/arch/h8300/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/h8300/include/asm/gpio.h b/arch/h8300/include/asm/gpio.h new file mode 100644 index 000000000000..a714f0c0efbc --- /dev/null +++ b/arch/h8300/include/asm/gpio.h | |||
@@ -0,0 +1,52 @@ | |||
1 | #ifndef _H8300_GPIO_H | ||
2 | #define _H8300_GPIO_H | ||
3 | |||
4 | #define H8300_GPIO_P1 0 | ||
5 | #define H8300_GPIO_P2 1 | ||
6 | #define H8300_GPIO_P3 2 | ||
7 | #define H8300_GPIO_P4 3 | ||
8 | #define H8300_GPIO_P5 4 | ||
9 | #define H8300_GPIO_P6 5 | ||
10 | #define H8300_GPIO_P7 6 | ||
11 | #define H8300_GPIO_P8 7 | ||
12 | #define H8300_GPIO_P9 8 | ||
13 | #define H8300_GPIO_PA 9 | ||
14 | #define H8300_GPIO_PB 10 | ||
15 | #define H8300_GPIO_PC 11 | ||
16 | #define H8300_GPIO_PD 12 | ||
17 | #define H8300_GPIO_PE 13 | ||
18 | #define H8300_GPIO_PF 14 | ||
19 | #define H8300_GPIO_PG 15 | ||
20 | #define H8300_GPIO_PH 16 | ||
21 | |||
22 | #define H8300_GPIO_B7 0x80 | ||
23 | #define H8300_GPIO_B6 0x40 | ||
24 | #define H8300_GPIO_B5 0x20 | ||
25 | #define H8300_GPIO_B4 0x10 | ||
26 | #define H8300_GPIO_B3 0x08 | ||
27 | #define H8300_GPIO_B2 0x04 | ||
28 | #define H8300_GPIO_B1 0x02 | ||
29 | #define H8300_GPIO_B0 0x01 | ||
30 | |||
31 | #define H8300_GPIO_INPUT 0 | ||
32 | #define H8300_GPIO_OUTPUT 1 | ||
33 | |||
34 | #define H8300_GPIO_RESERVE(port, bits) \ | ||
35 | h8300_reserved_gpio(port, bits) | ||
36 | |||
37 | #define H8300_GPIO_FREE(port, bits) \ | ||
38 | h8300_free_gpio(port, bits) | ||
39 | |||
40 | #define H8300_GPIO_DDR(port, bit, dir) \ | ||
41 | h8300_set_gpio_dir(((port) << 8) | (bit), dir) | ||
42 | |||
43 | #define H8300_GPIO_GETDIR(port, bit) \ | ||
44 | h8300_get_gpio_dir(((port) << 8) | (bit)) | ||
45 | |||
46 | extern int h8300_reserved_gpio(int port, int bits); | ||
47 | extern int h8300_free_gpio(int port, int bits); | ||
48 | extern int h8300_set_gpio_dir(int port_bit, int dir); | ||
49 | extern int h8300_get_gpio_dir(int port_bit); | ||
50 | extern int h8300_init_gpio(void); | ||
51 | |||
52 | #endif | ||
diff --git a/arch/h8300/include/asm/hardirq.h b/arch/h8300/include/asm/hardirq.h new file mode 100644 index 000000000000..9d7f7a7462b2 --- /dev/null +++ b/arch/h8300/include/asm/hardirq.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef __H8300_HARDIRQ_H | ||
2 | #define __H8300_HARDIRQ_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/interrupt.h> | ||
7 | #include <linux/irq.h> | ||
8 | |||
9 | typedef struct { | ||
10 | unsigned int __softirq_pending; | ||
11 | } ____cacheline_aligned irq_cpustat_t; | ||
12 | |||
13 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
14 | |||
15 | extern void ack_bad_irq(unsigned int irq); | ||
16 | |||
17 | #define HARDIRQ_BITS 8 | ||
18 | |||
19 | /* | ||
20 | * The hardirq mask has to be large enough to have | ||
21 | * space for potentially all IRQ sources in the system | ||
22 | * nesting on a single CPU: | ||
23 | */ | ||
24 | #if (1 << HARDIRQ_BITS) < NR_IRQS | ||
25 | # error HARDIRQ_BITS is too low! | ||
26 | #endif | ||
27 | |||
28 | #endif | ||
diff --git a/arch/h8300/include/asm/hw_irq.h b/arch/h8300/include/asm/hw_irq.h new file mode 100644 index 000000000000..d75a5a1119e8 --- /dev/null +++ b/arch/h8300/include/asm/hw_irq.h | |||
@@ -0,0 +1 @@ | |||
/* Do Nothing */ | |||
diff --git a/arch/h8300/include/asm/io.h b/arch/h8300/include/asm/io.h new file mode 100644 index 000000000000..26dc6ccd9441 --- /dev/null +++ b/arch/h8300/include/asm/io.h | |||
@@ -0,0 +1,324 @@ | |||
1 | #ifndef _H8300_IO_H | ||
2 | #define _H8300_IO_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <asm/virtconvert.h> | ||
7 | |||
8 | #if defined(CONFIG_H83007) || defined(CONFIG_H83068) | ||
9 | #include <asm/regs306x.h> | ||
10 | #elif defined(CONFIG_H8S2678) | ||
11 | #include <asm/regs267x.h> | ||
12 | #else | ||
13 | #error UNKNOWN CPU TYPE | ||
14 | #endif | ||
15 | |||
16 | |||
17 | /* | ||
18 | * These are for ISA/PCI shared memory _only_ and should never be used | ||
19 | * on any other type of memory, including Zorro memory. They are meant to | ||
20 | * access the bus in the bus byte order which is little-endian!. | ||
21 | * | ||
22 | * readX/writeX() are used to access memory mapped devices. On some | ||
23 | * architectures the memory mapped IO stuff needs to be accessed | ||
24 | * differently. On the m68k architecture, we just read/write the | ||
25 | * memory location directly. | ||
26 | */ | ||
27 | /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates | ||
28 | * two accesses to memory, which may be undesireable for some devices. | ||
29 | */ | ||
30 | |||
31 | /* | ||
32 | * swap functions are sometimes needed to interface little-endian hardware | ||
33 | */ | ||
34 | |||
35 | static inline unsigned short _swapw(volatile unsigned short v) | ||
36 | { | ||
37 | #ifndef H8300_IO_NOSWAP | ||
38 | unsigned short r; | ||
39 | __asm__("xor.b %w0,%x0\n\t" | ||
40 | "xor.b %x0,%w0\n\t" | ||
41 | "xor.b %w0,%x0" | ||
42 | :"=r"(r) | ||
43 | :"0"(v)); | ||
44 | return r; | ||
45 | #else | ||
46 | return v; | ||
47 | #endif | ||
48 | } | ||
49 | |||
50 | static inline unsigned long _swapl(volatile unsigned long v) | ||
51 | { | ||
52 | #ifndef H8300_IO_NOSWAP | ||
53 | unsigned long r; | ||
54 | __asm__("xor.b %w0,%x0\n\t" | ||
55 | "xor.b %x0,%w0\n\t" | ||
56 | "xor.b %w0,%x0\n\t" | ||
57 | "xor.w %e0,%f0\n\t" | ||
58 | "xor.w %f0,%e0\n\t" | ||
59 | "xor.w %e0,%f0\n\t" | ||
60 | "xor.b %w0,%x0\n\t" | ||
61 | "xor.b %x0,%w0\n\t" | ||
62 | "xor.b %w0,%x0" | ||
63 | :"=r"(r) | ||
64 | :"0"(v)); | ||
65 | return r; | ||
66 | #else | ||
67 | return v; | ||
68 | #endif | ||
69 | } | ||
70 | |||
71 | #define readb(addr) \ | ||
72 | ({ unsigned char __v = \ | ||
73 | *(volatile unsigned char *)((unsigned long)(addr) & 0x00ffffff); \ | ||
74 | __v; }) | ||
75 | #define readw(addr) \ | ||
76 | ({ unsigned short __v = \ | ||
77 | *(volatile unsigned short *)((unsigned long)(addr) & 0x00ffffff); \ | ||
78 | __v; }) | ||
79 | #define readl(addr) \ | ||
80 | ({ unsigned long __v = \ | ||
81 | *(volatile unsigned long *)((unsigned long)(addr) & 0x00ffffff); \ | ||
82 | __v; }) | ||
83 | |||
84 | #define writeb(b,addr) (void)((*(volatile unsigned char *) \ | ||
85 | ((unsigned long)(addr) & 0x00ffffff)) = (b)) | ||
86 | #define writew(b,addr) (void)((*(volatile unsigned short *) \ | ||
87 | ((unsigned long)(addr) & 0x00ffffff)) = (b)) | ||
88 | #define writel(b,addr) (void)((*(volatile unsigned long *) \ | ||
89 | ((unsigned long)(addr) & 0x00ffffff)) = (b)) | ||
90 | #define readb_relaxed(addr) readb(addr) | ||
91 | #define readw_relaxed(addr) readw(addr) | ||
92 | #define readl_relaxed(addr) readl(addr) | ||
93 | |||
94 | #define __raw_readb readb | ||
95 | #define __raw_readw readw | ||
96 | #define __raw_readl readl | ||
97 | #define __raw_writeb writeb | ||
98 | #define __raw_writew writew | ||
99 | #define __raw_writel writel | ||
100 | |||
101 | static inline int h8300_buswidth(unsigned int addr) | ||
102 | { | ||
103 | return (*(volatile unsigned char *)ABWCR & (1 << ((addr >> 21) & 7))) == 0; | ||
104 | } | ||
105 | |||
106 | static inline void io_outsb(unsigned int addr, const void *buf, int len) | ||
107 | { | ||
108 | volatile unsigned char *ap_b = (volatile unsigned char *) addr; | ||
109 | volatile unsigned short *ap_w = (volatile unsigned short *) addr; | ||
110 | unsigned char *bp = (unsigned char *) buf; | ||
111 | |||
112 | if(h8300_buswidth(addr) && (addr & 1)) { | ||
113 | while (len--) | ||
114 | *ap_w = *bp++; | ||
115 | } else { | ||
116 | while (len--) | ||
117 | *ap_b = *bp++; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | static inline void io_outsw(unsigned int addr, const void *buf, int len) | ||
122 | { | ||
123 | volatile unsigned short *ap = (volatile unsigned short *) addr; | ||
124 | unsigned short *bp = (unsigned short *) buf; | ||
125 | while (len--) | ||
126 | *ap = _swapw(*bp++); | ||
127 | } | ||
128 | |||
129 | static inline void io_outsl(unsigned int addr, const void *buf, int len) | ||
130 | { | ||
131 | volatile unsigned long *ap = (volatile unsigned long *) addr; | ||
132 | unsigned long *bp = (unsigned long *) buf; | ||
133 | while (len--) | ||
134 | *ap = _swapl(*bp++); | ||
135 | } | ||
136 | |||
137 | static inline void io_outsw_noswap(unsigned int addr, const void *buf, int len) | ||
138 | { | ||
139 | volatile unsigned short *ap = (volatile unsigned short *) addr; | ||
140 | unsigned short *bp = (unsigned short *) buf; | ||
141 | while (len--) | ||
142 | *ap = *bp++; | ||
143 | } | ||
144 | |||
145 | static inline void io_outsl_noswap(unsigned int addr, const void *buf, int len) | ||
146 | { | ||
147 | volatile unsigned long *ap = (volatile unsigned long *) addr; | ||
148 | unsigned long *bp = (unsigned long *) buf; | ||
149 | while (len--) | ||
150 | *ap = *bp++; | ||
151 | } | ||
152 | |||
153 | static inline void io_insb(unsigned int addr, void *buf, int len) | ||
154 | { | ||
155 | volatile unsigned char *ap_b; | ||
156 | volatile unsigned short *ap_w; | ||
157 | unsigned char *bp = (unsigned char *) buf; | ||
158 | |||
159 | if(h8300_buswidth(addr)) { | ||
160 | ap_w = (volatile unsigned short *)(addr & ~1); | ||
161 | while (len--) | ||
162 | *bp++ = *ap_w & 0xff; | ||
163 | } else { | ||
164 | ap_b = (volatile unsigned char *)addr; | ||
165 | while (len--) | ||
166 | *bp++ = *ap_b; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | static inline void io_insw(unsigned int addr, void *buf, int len) | ||
171 | { | ||
172 | volatile unsigned short *ap = (volatile unsigned short *) addr; | ||
173 | unsigned short *bp = (unsigned short *) buf; | ||
174 | while (len--) | ||
175 | *bp++ = _swapw(*ap); | ||
176 | } | ||
177 | |||
178 | static inline void io_insl(unsigned int addr, void *buf, int len) | ||
179 | { | ||
180 | volatile unsigned long *ap = (volatile unsigned long *) addr; | ||
181 | unsigned long *bp = (unsigned long *) buf; | ||
182 | while (len--) | ||
183 | *bp++ = _swapl(*ap); | ||
184 | } | ||
185 | |||
186 | static inline void io_insw_noswap(unsigned int addr, void *buf, int len) | ||
187 | { | ||
188 | volatile unsigned short *ap = (volatile unsigned short *) addr; | ||
189 | unsigned short *bp = (unsigned short *) buf; | ||
190 | while (len--) | ||
191 | *bp++ = *ap; | ||
192 | } | ||
193 | |||
194 | static inline void io_insl_noswap(unsigned int addr, void *buf, int len) | ||
195 | { | ||
196 | volatile unsigned long *ap = (volatile unsigned long *) addr; | ||
197 | unsigned long *bp = (unsigned long *) buf; | ||
198 | while (len--) | ||
199 | *bp++ = *ap; | ||
200 | } | ||
201 | |||
202 | /* | ||
203 | * make the short names macros so specific devices | ||
204 | * can override them as required | ||
205 | */ | ||
206 | |||
207 | #define memset_io(a,b,c) memset((void *)(a),(b),(c)) | ||
208 | #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) | ||
209 | #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) | ||
210 | |||
211 | #define mmiowb() | ||
212 | |||
213 | #define inb(addr) ((h8300_buswidth(addr))?readw((addr) & ~1) & 0xff:readb(addr)) | ||
214 | #define inw(addr) _swapw(readw(addr)) | ||
215 | #define inl(addr) _swapl(readl(addr)) | ||
216 | #define outb(x,addr) ((void)((h8300_buswidth(addr) && \ | ||
217 | ((addr) & 1))?writew(x,(addr) & ~1):writeb(x,addr))) | ||
218 | #define outw(x,addr) ((void) writew(_swapw(x),addr)) | ||
219 | #define outl(x,addr) ((void) writel(_swapl(x),addr)) | ||
220 | |||
221 | #define inb_p(addr) inb(addr) | ||
222 | #define inw_p(addr) inw(addr) | ||
223 | #define inl_p(addr) inl(addr) | ||
224 | #define outb_p(x,addr) outb(x,addr) | ||
225 | #define outw_p(x,addr) outw(x,addr) | ||
226 | #define outl_p(x,addr) outl(x,addr) | ||
227 | |||
228 | #define outsb(a,b,l) io_outsb(a,b,l) | ||
229 | #define outsw(a,b,l) io_outsw(a,b,l) | ||
230 | #define outsl(a,b,l) io_outsl(a,b,l) | ||
231 | |||
232 | #define insb(a,b,l) io_insb(a,b,l) | ||
233 | #define insw(a,b,l) io_insw(a,b,l) | ||
234 | #define insl(a,b,l) io_insl(a,b,l) | ||
235 | |||
236 | #define IO_SPACE_LIMIT 0xffffff | ||
237 | |||
238 | |||
239 | /* Values for nocacheflag and cmode */ | ||
240 | #define IOMAP_FULL_CACHING 0 | ||
241 | #define IOMAP_NOCACHE_SER 1 | ||
242 | #define IOMAP_NOCACHE_NONSER 2 | ||
243 | #define IOMAP_WRITETHROUGH 3 | ||
244 | |||
245 | extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag); | ||
246 | extern void __iounmap(void *addr, unsigned long size); | ||
247 | |||
248 | static inline void *ioremap(unsigned long physaddr, unsigned long size) | ||
249 | { | ||
250 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
251 | } | ||
252 | static inline void *ioremap_nocache(unsigned long physaddr, unsigned long size) | ||
253 | { | ||
254 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
255 | } | ||
256 | static inline void *ioremap_writethrough(unsigned long physaddr, unsigned long size) | ||
257 | { | ||
258 | return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); | ||
259 | } | ||
260 | static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size) | ||
261 | { | ||
262 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); | ||
263 | } | ||
264 | |||
265 | extern void iounmap(void *addr); | ||
266 | |||
267 | /* H8/300 internal I/O functions */ | ||
268 | static __inline__ unsigned char ctrl_inb(unsigned long addr) | ||
269 | { | ||
270 | return *(volatile unsigned char*)addr; | ||
271 | } | ||
272 | |||
273 | static __inline__ unsigned short ctrl_inw(unsigned long addr) | ||
274 | { | ||
275 | return *(volatile unsigned short*)addr; | ||
276 | } | ||
277 | |||
278 | static __inline__ unsigned long ctrl_inl(unsigned long addr) | ||
279 | { | ||
280 | return *(volatile unsigned long*)addr; | ||
281 | } | ||
282 | |||
283 | static __inline__ void ctrl_outb(unsigned char b, unsigned long addr) | ||
284 | { | ||
285 | *(volatile unsigned char*)addr = b; | ||
286 | } | ||
287 | |||
288 | static __inline__ void ctrl_outw(unsigned short b, unsigned long addr) | ||
289 | { | ||
290 | *(volatile unsigned short*)addr = b; | ||
291 | } | ||
292 | |||
293 | static __inline__ void ctrl_outl(unsigned long b, unsigned long addr) | ||
294 | { | ||
295 | *(volatile unsigned long*)addr = b; | ||
296 | } | ||
297 | |||
298 | /* Pages to physical address... */ | ||
299 | #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) | ||
300 | #define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT) | ||
301 | |||
302 | /* | ||
303 | * Macros used for converting between virtual and physical mappings. | ||
304 | */ | ||
305 | #define phys_to_virt(vaddr) ((void *) (vaddr)) | ||
306 | #define virt_to_phys(vaddr) ((unsigned long) (vaddr)) | ||
307 | |||
308 | #define virt_to_bus virt_to_phys | ||
309 | #define bus_to_virt phys_to_virt | ||
310 | |||
311 | /* | ||
312 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
313 | * access | ||
314 | */ | ||
315 | #define xlate_dev_mem_ptr(p) __va(p) | ||
316 | |||
317 | /* | ||
318 | * Convert a virtual cached pointer to an uncached pointer | ||
319 | */ | ||
320 | #define xlate_dev_kmem_ptr(p) p | ||
321 | |||
322 | #endif /* __KERNEL__ */ | ||
323 | |||
324 | #endif /* _H8300_IO_H */ | ||
diff --git a/arch/h8300/include/asm/ioctl.h b/arch/h8300/include/asm/ioctl.h new file mode 100644 index 000000000000..b279fe06dfe5 --- /dev/null +++ b/arch/h8300/include/asm/ioctl.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/ioctl.h> | |||
diff --git a/arch/h8300/include/asm/ioctls.h b/arch/h8300/include/asm/ioctls.h new file mode 100644 index 000000000000..98a53d067269 --- /dev/null +++ b/arch/h8300/include/asm/ioctls.h | |||
@@ -0,0 +1,85 @@ | |||
1 | #ifndef __ARCH_H8300_IOCTLS_H__ | ||
2 | #define __ARCH_H8300_IOCTLS_H__ | ||
3 | |||
4 | #include <asm/ioctl.h> | ||
5 | |||
6 | /* 0x54 is just a magic number to make these relatively unique ('T') */ | ||
7 | |||
8 | #define TCGETS 0x5401 | ||
9 | #define TCSETS 0x5402 | ||
10 | #define TCSETSW 0x5403 | ||
11 | #define TCSETSF 0x5404 | ||
12 | #define TCGETA 0x5405 | ||
13 | #define TCSETA 0x5406 | ||
14 | #define TCSETAW 0x5407 | ||
15 | #define TCSETAF 0x5408 | ||
16 | #define TCSBRK 0x5409 | ||
17 | #define TCXONC 0x540A | ||
18 | #define TCFLSH 0x540B | ||
19 | #define TIOCEXCL 0x540C | ||
20 | #define TIOCNXCL 0x540D | ||
21 | #define TIOCSCTTY 0x540E | ||
22 | #define TIOCGPGRP 0x540F | ||
23 | #define TIOCSPGRP 0x5410 | ||
24 | #define TIOCOUTQ 0x5411 | ||
25 | #define TIOCSTI 0x5412 | ||
26 | #define TIOCGWINSZ 0x5413 | ||
27 | #define TIOCSWINSZ 0x5414 | ||
28 | #define TIOCMGET 0x5415 | ||
29 | #define TIOCMBIS 0x5416 | ||
30 | #define TIOCMBIC 0x5417 | ||
31 | #define TIOCMSET 0x5418 | ||
32 | #define TIOCGSOFTCAR 0x5419 | ||
33 | #define TIOCSSOFTCAR 0x541A | ||
34 | #define FIONREAD 0x541B | ||
35 | #define TIOCINQ FIONREAD | ||
36 | #define TIOCLINUX 0x541C | ||
37 | #define TIOCCONS 0x541D | ||
38 | #define TIOCGSERIAL 0x541E | ||
39 | #define TIOCSSERIAL 0x541F | ||
40 | #define TIOCPKT 0x5420 | ||
41 | #define FIONBIO 0x5421 | ||
42 | #define TIOCNOTTY 0x5422 | ||
43 | #define TIOCSETD 0x5423 | ||
44 | #define TIOCGETD 0x5424 | ||
45 | #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ | ||
46 | #define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ | ||
47 | #define TIOCSBRK 0x5427 /* BSD compatibility */ | ||
48 | #define TIOCCBRK 0x5428 /* BSD compatibility */ | ||
49 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ | ||
50 | #define TCGETS2 _IOR('T',0x2A, struct termios2) | ||
51 | #define TCSETS2 _IOW('T',0x2B, struct termios2) | ||
52 | #define TCSETSW2 _IOW('T',0x2C, struct termios2) | ||
53 | #define TCSETSF2 _IOW('T',0x2D, struct termios2) | ||
54 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | ||
55 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | ||
56 | |||
57 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ | ||
58 | #define FIOCLEX 0x5451 | ||
59 | #define FIOASYNC 0x5452 | ||
60 | #define TIOCSERCONFIG 0x5453 | ||
61 | #define TIOCSERGWILD 0x5454 | ||
62 | #define TIOCSERSWILD 0x5455 | ||
63 | #define TIOCGLCKTRMIOS 0x5456 | ||
64 | #define TIOCSLCKTRMIOS 0x5457 | ||
65 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
66 | #define TIOCSERGETLSR 0x5459 /* Get line status register */ | ||
67 | #define TIOCSERGETMULTI 0x545A /* Get multiport config */ | ||
68 | #define TIOCSERSETMULTI 0x545B /* Set multiport config */ | ||
69 | |||
70 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ | ||
71 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | ||
72 | #define FIOQSIZE 0x545E | ||
73 | |||
74 | /* Used for packet mode */ | ||
75 | #define TIOCPKT_DATA 0 | ||
76 | #define TIOCPKT_FLUSHREAD 1 | ||
77 | #define TIOCPKT_FLUSHWRITE 2 | ||
78 | #define TIOCPKT_STOP 4 | ||
79 | #define TIOCPKT_START 8 | ||
80 | #define TIOCPKT_NOSTOP 16 | ||
81 | #define TIOCPKT_DOSTOP 32 | ||
82 | |||
83 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
84 | |||
85 | #endif /* __ARCH_H8300_IOCTLS_H__ */ | ||
diff --git a/arch/h8300/include/asm/ipcbuf.h b/arch/h8300/include/asm/ipcbuf.h new file mode 100644 index 000000000000..2cd1ebcc109d --- /dev/null +++ b/arch/h8300/include/asm/ipcbuf.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __H8300_IPCBUF_H__ | ||
2 | #define __H8300_IPCBUF_H__ | ||
3 | |||
4 | /* | ||
5 | * The user_ipc_perm structure for H8/300 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 /* __H8300_IPCBUF_H__ */ | ||
diff --git a/arch/h8300/include/asm/irq.h b/arch/h8300/include/asm/irq.h new file mode 100644 index 000000000000..13d7c601cd0a --- /dev/null +++ b/arch/h8300/include/asm/irq.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _H8300_IRQ_H_ | ||
2 | #define _H8300_IRQ_H_ | ||
3 | |||
4 | #include <asm/ptrace.h> | ||
5 | |||
6 | #if defined(CONFIG_CPU_H8300H) | ||
7 | #define NR_IRQS 64 | ||
8 | #define EXT_IRQ0 12 | ||
9 | #define EXT_IRQ1 13 | ||
10 | #define EXT_IRQ2 14 | ||
11 | #define EXT_IRQ3 15 | ||
12 | #define EXT_IRQ4 16 | ||
13 | #define EXT_IRQ5 17 | ||
14 | #define EXT_IRQ6 18 | ||
15 | #define EXT_IRQ7 19 | ||
16 | #define EXT_IRQS 5 | ||
17 | #define IER_REGS *(volatile unsigned char *)IER | ||
18 | #endif | ||
19 | #if defined(CONFIG_CPU_H8S) | ||
20 | #define NR_IRQS 128 | ||
21 | #define EXT_IRQ0 16 | ||
22 | #define EXT_IRQ1 17 | ||
23 | #define EXT_IRQ2 18 | ||
24 | #define EXT_IRQ3 19 | ||
25 | #define EXT_IRQ4 20 | ||
26 | #define EXT_IRQ5 21 | ||
27 | #define EXT_IRQ6 22 | ||
28 | #define EXT_IRQ7 23 | ||
29 | #define EXT_IRQ8 24 | ||
30 | #define EXT_IRQ9 25 | ||
31 | #define EXT_IRQ10 26 | ||
32 | #define EXT_IRQ11 27 | ||
33 | #define EXT_IRQ12 28 | ||
34 | #define EXT_IRQ13 29 | ||
35 | #define EXT_IRQ14 30 | ||
36 | #define EXT_IRQ15 31 | ||
37 | #define EXT_IRQS 15 | ||
38 | |||
39 | #define IER_REGS *(volatile unsigned short *)IER | ||
40 | #endif | ||
41 | |||
42 | static __inline__ int irq_canonicalize(int irq) | ||
43 | { | ||
44 | return irq; | ||
45 | } | ||
46 | |||
47 | typedef void (*h8300_vector)(void); | ||
48 | |||
49 | #endif /* _H8300_IRQ_H_ */ | ||
diff --git a/arch/h8300/include/asm/irq_regs.h b/arch/h8300/include/asm/irq_regs.h new file mode 100644 index 000000000000..3dd9c0b70270 --- /dev/null +++ b/arch/h8300/include/asm/irq_regs.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/irq_regs.h> | |||
diff --git a/arch/h8300/include/asm/kdebug.h b/arch/h8300/include/asm/kdebug.h new file mode 100644 index 000000000000..6ece1b037665 --- /dev/null +++ b/arch/h8300/include/asm/kdebug.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/kdebug.h> | |||
diff --git a/arch/h8300/include/asm/kmap_types.h b/arch/h8300/include/asm/kmap_types.h new file mode 100644 index 000000000000..1ec8a3427120 --- /dev/null +++ b/arch/h8300/include/asm/kmap_types.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _ASM_H8300_KMAP_TYPES_H | ||
2 | #define _ASM_H8300_KMAP_TYPES_H | ||
3 | |||
4 | enum km_type { | ||
5 | KM_BOUNCE_READ, | ||
6 | KM_SKB_SUNRPC_DATA, | ||
7 | KM_SKB_DATA_SOFTIRQ, | ||
8 | KM_USER0, | ||
9 | KM_USER1, | ||
10 | KM_BIO_SRC_IRQ, | ||
11 | KM_BIO_DST_IRQ, | ||
12 | KM_PTE0, | ||
13 | KM_PTE1, | ||
14 | KM_IRQ0, | ||
15 | KM_IRQ1, | ||
16 | KM_SOFTIRQ0, | ||
17 | KM_SOFTIRQ1, | ||
18 | KM_TYPE_NR | ||
19 | }; | ||
20 | |||
21 | #endif | ||
diff --git a/arch/h8300/include/asm/linkage.h b/arch/h8300/include/asm/linkage.h new file mode 100644 index 000000000000..6f4df7d46180 --- /dev/null +++ b/arch/h8300/include/asm/linkage.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _H8300_LINKAGE_H | ||
2 | #define _H8300_LINKAGE_H | ||
3 | |||
4 | #undef SYMBOL_NAME_LABEL | ||
5 | #undef SYMBOL_NAME | ||
6 | #define SYMBOL_NAME_LABEL(_name_) _##_name_##: | ||
7 | #define SYMBOL_NAME(_name_) _##_name_ | ||
8 | #endif | ||
diff --git a/arch/h8300/include/asm/local.h b/arch/h8300/include/asm/local.h new file mode 100644 index 000000000000..fdd4efe437cd --- /dev/null +++ b/arch/h8300/include/asm/local.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _H8300_LOCAL_H_ | ||
2 | #define _H8300_LOCAL_H_ | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/h8300/include/asm/mc146818rtc.h b/arch/h8300/include/asm/mc146818rtc.h new file mode 100644 index 000000000000..ab9d9646d241 --- /dev/null +++ b/arch/h8300/include/asm/mc146818rtc.h | |||
@@ -0,0 +1,9 @@ | |||
1 | /* | ||
2 | * Machine dependent access functions for RTC registers. | ||
3 | */ | ||
4 | #ifndef _H8300_MC146818RTC_H | ||
5 | #define _H8300_MC146818RTC_H | ||
6 | |||
7 | /* empty include file to satisfy the include in genrtc.c/ide-geometry.c */ | ||
8 | |||
9 | #endif /* _H8300_MC146818RTC_H */ | ||
diff --git a/arch/h8300/include/asm/md.h b/arch/h8300/include/asm/md.h new file mode 100644 index 000000000000..1a47dc6691fb --- /dev/null +++ b/arch/h8300/include/asm/md.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* $Id: md.h,v 1.1 2002/11/19 02:09:26 gerg Exp $ | ||
2 | * md.h: High speed xor_block operation for RAID4/5 | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #ifndef __ASM_MD_H | ||
7 | #define __ASM_MD_H | ||
8 | |||
9 | /* #define HAVE_ARCH_XORBLOCK */ | ||
10 | |||
11 | #define MD_XORBLOCK_ALIGNMENT sizeof(long) | ||
12 | |||
13 | #endif /* __ASM_MD_H */ | ||
diff --git a/arch/h8300/include/asm/mman.h b/arch/h8300/include/asm/mman.h new file mode 100644 index 000000000000..b9f104f22a36 --- /dev/null +++ b/arch/h8300/include/asm/mman.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef __H8300_MMAN_H__ | ||
2 | #define __H8300_MMAN_H__ | ||
3 | |||
4 | #include <asm-generic/mman.h> | ||
5 | |||
6 | #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ | ||
7 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
8 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
9 | #define MAP_LOCKED 0x2000 /* pages are locked */ | ||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | ||
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | ||
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
13 | |||
14 | #define MCL_CURRENT 1 /* lock all current mappings */ | ||
15 | #define MCL_FUTURE 2 /* lock all future mappings */ | ||
16 | |||
17 | #endif /* __H8300_MMAN_H__ */ | ||
diff --git a/arch/h8300/include/asm/mmu.h b/arch/h8300/include/asm/mmu.h new file mode 100644 index 000000000000..2ce06ea46104 --- /dev/null +++ b/arch/h8300/include/asm/mmu.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __MMU_H | ||
2 | #define __MMU_H | ||
3 | |||
4 | /* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */ | ||
5 | |||
6 | typedef struct { | ||
7 | struct vm_list_struct *vmlist; | ||
8 | unsigned long end_brk; | ||
9 | } mm_context_t; | ||
10 | |||
11 | #endif | ||
diff --git a/arch/h8300/include/asm/mmu_context.h b/arch/h8300/include/asm/mmu_context.h new file mode 100644 index 000000000000..f44b730da54d --- /dev/null +++ b/arch/h8300/include/asm/mmu_context.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef __H8300_MMU_CONTEXT_H | ||
2 | #define __H8300_MMU_CONTEXT_H | ||
3 | |||
4 | #include <asm/setup.h> | ||
5 | #include <asm/page.h> | ||
6 | #include <asm/pgalloc.h> | ||
7 | #include <asm-generic/mm_hooks.h> | ||
8 | |||
9 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
10 | { | ||
11 | } | ||
12 | |||
13 | static inline int | ||
14 | init_new_context(struct task_struct *tsk, struct mm_struct *mm) | ||
15 | { | ||
16 | // mm->context = virt_to_phys(mm->pgd); | ||
17 | return(0); | ||
18 | } | ||
19 | |||
20 | #define destroy_context(mm) do { } while(0) | ||
21 | #define deactivate_mm(tsk,mm) do { } while(0) | ||
22 | |||
23 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) | ||
24 | { | ||
25 | } | ||
26 | |||
27 | static inline void activate_mm(struct mm_struct *prev_mm, | ||
28 | struct mm_struct *next_mm) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | #endif | ||
diff --git a/arch/h8300/include/asm/module.h b/arch/h8300/include/asm/module.h new file mode 100644 index 000000000000..de23231f3196 --- /dev/null +++ b/arch/h8300/include/asm/module.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _ASM_H8300_MODULE_H | ||
2 | #define _ASM_H8300_MODULE_H | ||
3 | /* | ||
4 | * This file contains the H8/300 architecture specific module code. | ||
5 | */ | ||
6 | struct mod_arch_specific { }; | ||
7 | #define Elf_Shdr Elf32_Shdr | ||
8 | #define Elf_Sym Elf32_Sym | ||
9 | #define Elf_Ehdr Elf32_Ehdr | ||
10 | |||
11 | #define MODULE_SYMBOL_PREFIX "_" | ||
12 | |||
13 | #endif /* _ASM_H8/300_MODULE_H */ | ||
diff --git a/arch/h8300/include/asm/msgbuf.h b/arch/h8300/include/asm/msgbuf.h new file mode 100644 index 000000000000..6b148cd09aa5 --- /dev/null +++ b/arch/h8300/include/asm/msgbuf.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _H8300_MSGBUF_H | ||
2 | #define _H8300_MSGBUF_H | ||
3 | |||
4 | /* | ||
5 | * The msqid64_ds structure for H8/300 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 msqid64_ds { | ||
15 | struct ipc64_perm msg_perm; | ||
16 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
17 | unsigned long __unused1; | ||
18 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
19 | unsigned long __unused2; | ||
20 | __kernel_time_t msg_ctime; /* last change time */ | ||
21 | unsigned long __unused3; | ||
22 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
23 | unsigned long msg_qnum; /* number of messages in queue */ | ||
24 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
25 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
26 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
27 | unsigned long __unused4; | ||
28 | unsigned long __unused5; | ||
29 | }; | ||
30 | |||
31 | #endif /* _H8300_MSGBUF_H */ | ||
diff --git a/arch/h8300/include/asm/mutex.h b/arch/h8300/include/asm/mutex.h new file mode 100644 index 000000000000..458c1f7fbc18 --- /dev/null +++ b/arch/h8300/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/h8300/include/asm/page.h b/arch/h8300/include/asm/page.h new file mode 100644 index 000000000000..0b6acf0b03aa --- /dev/null +++ b/arch/h8300/include/asm/page.h | |||
@@ -0,0 +1,78 @@ | |||
1 | #ifndef _H8300_PAGE_H | ||
2 | #define _H8300_PAGE_H | ||
3 | |||
4 | /* PAGE_SHIFT determines the page size */ | ||
5 | |||
6 | #define PAGE_SHIFT (12) | ||
7 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
8 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
9 | |||
10 | #include <asm/setup.h> | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | |||
14 | #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) | ||
15 | #define free_user_page(page, addr) free_page(addr) | ||
16 | |||
17 | #define clear_page(page) memset((page), 0, PAGE_SIZE) | ||
18 | #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) | ||
19 | |||
20 | #define clear_user_page(page, vaddr, pg) clear_page(page) | ||
21 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
22 | |||
23 | #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \ | ||
24 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) | ||
25 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | ||
26 | |||
27 | /* | ||
28 | * These are used to make use of C type-checking.. | ||
29 | */ | ||
30 | typedef struct { unsigned long pte; } pte_t; | ||
31 | typedef struct { unsigned long pmd[16]; } pmd_t; | ||
32 | typedef struct { unsigned long pgd; } pgd_t; | ||
33 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
34 | typedef struct page *pgtable_t; | ||
35 | |||
36 | #define pte_val(x) ((x).pte) | ||
37 | #define pmd_val(x) ((&x)->pmd[0]) | ||
38 | #define pgd_val(x) ((x).pgd) | ||
39 | #define pgprot_val(x) ((x).pgprot) | ||
40 | |||
41 | #define __pte(x) ((pte_t) { (x) } ) | ||
42 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
43 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
44 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
45 | |||
46 | extern unsigned long memory_start; | ||
47 | extern unsigned long memory_end; | ||
48 | |||
49 | #endif /* !__ASSEMBLY__ */ | ||
50 | |||
51 | #include <asm/page_offset.h> | ||
52 | |||
53 | #define PAGE_OFFSET (PAGE_OFFSET_RAW) | ||
54 | |||
55 | #ifndef __ASSEMBLY__ | ||
56 | |||
57 | #define __pa(vaddr) virt_to_phys(vaddr) | ||
58 | #define __va(paddr) phys_to_virt((unsigned long)paddr) | ||
59 | |||
60 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) | ||
61 | #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) | ||
62 | |||
63 | #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) | ||
64 | #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) | ||
65 | #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) | ||
66 | #define pfn_valid(page) (page < max_mapnr) | ||
67 | |||
68 | #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) | ||
69 | |||
70 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ | ||
71 | ((void *)(kaddr) < (void *)memory_end)) | ||
72 | |||
73 | #endif /* __ASSEMBLY__ */ | ||
74 | |||
75 | #include <asm-generic/memory_model.h> | ||
76 | #include <asm-generic/page.h> | ||
77 | |||
78 | #endif /* _H8300_PAGE_H */ | ||
diff --git a/arch/h8300/include/asm/page_offset.h b/arch/h8300/include/asm/page_offset.h new file mode 100644 index 000000000000..f8706463008c --- /dev/null +++ b/arch/h8300/include/asm/page_offset.h | |||
@@ -0,0 +1,3 @@ | |||
1 | |||
2 | #define PAGE_OFFSET_RAW 0x00000000 | ||
3 | |||
diff --git a/arch/h8300/include/asm/param.h b/arch/h8300/include/asm/param.h new file mode 100644 index 000000000000..1c72fb8080ff --- /dev/null +++ b/arch/h8300/include/asm/param.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _H8300_PARAM_H | ||
2 | #define _H8300_PARAM_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | #define HZ CONFIG_HZ | ||
6 | #define USER_HZ HZ | ||
7 | #define CLOCKS_PER_SEC (USER_HZ) | ||
8 | #else | ||
9 | #define HZ 100 | ||
10 | #endif | ||
11 | |||
12 | #define EXEC_PAGESIZE 4096 | ||
13 | |||
14 | #ifndef NOGROUP | ||
15 | #define NOGROUP (-1) | ||
16 | #endif | ||
17 | |||
18 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
19 | |||
20 | #endif /* _H8300_PARAM_H */ | ||
diff --git a/arch/h8300/include/asm/pci.h b/arch/h8300/include/asm/pci.h new file mode 100644 index 000000000000..97389b35aa35 --- /dev/null +++ b/arch/h8300/include/asm/pci.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _ASM_H8300_PCI_H | ||
2 | #define _ASM_H8300_PCI_H | ||
3 | |||
4 | /* | ||
5 | * asm-h8300/pci.h - H8/300 specific PCI declarations. | ||
6 | * | ||
7 | * Yoshinori Sato <ysato@users.sourceforge.jp> | ||
8 | */ | ||
9 | |||
10 | #define pcibios_assign_all_busses() 0 | ||
11 | #define pcibios_scan_all_fns(a, b) 0 | ||
12 | |||
13 | static inline void pcibios_set_master(struct pci_dev *dev) | ||
14 | { | ||
15 | /* No special bus mastering setup handling */ | ||
16 | } | ||
17 | |||
18 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
19 | { | ||
20 | /* We don't do dynamic PCI IRQ allocation */ | ||
21 | } | ||
22 | |||
23 | #define PCI_DMA_BUS_IS_PHYS (1) | ||
24 | |||
25 | #endif /* _ASM_H8300_PCI_H */ | ||
diff --git a/arch/h8300/include/asm/percpu.h b/arch/h8300/include/asm/percpu.h new file mode 100644 index 000000000000..72c03e3666d8 --- /dev/null +++ b/arch/h8300/include/asm/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ARCH_H8300_PERCPU__ | ||
2 | #define __ARCH_H8300_PERCPU__ | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* __ARCH_H8300_PERCPU__ */ | ||
diff --git a/arch/h8300/include/asm/pgalloc.h b/arch/h8300/include/asm/pgalloc.h new file mode 100644 index 000000000000..c2e89a286d23 --- /dev/null +++ b/arch/h8300/include/asm/pgalloc.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _H8300_PGALLOC_H | ||
2 | #define _H8300_PGALLOC_H | ||
3 | |||
4 | #include <asm/setup.h> | ||
5 | |||
6 | #define check_pgt_cache() do { } while (0) | ||
7 | |||
8 | #endif /* _H8300_PGALLOC_H */ | ||
diff --git a/arch/h8300/include/asm/pgtable.h b/arch/h8300/include/asm/pgtable.h new file mode 100644 index 000000000000..a09230a08e02 --- /dev/null +++ b/arch/h8300/include/asm/pgtable.h | |||
@@ -0,0 +1,73 @@ | |||
1 | #ifndef _H8300_PGTABLE_H | ||
2 | #define _H8300_PGTABLE_H | ||
3 | |||
4 | #include <asm-generic/4level-fixup.h> | ||
5 | |||
6 | #include <linux/slab.h> | ||
7 | #include <asm/processor.h> | ||
8 | #include <asm/page.h> | ||
9 | #include <asm/io.h> | ||
10 | |||
11 | #define pgd_present(pgd) (1) /* pages are always present on NO_MM */ | ||
12 | #define pgd_none(pgd) (0) | ||
13 | #define pgd_bad(pgd) (0) | ||
14 | #define pgd_clear(pgdp) | ||
15 | #define kern_addr_valid(addr) (1) | ||
16 | #define pmd_offset(a, b) ((void *)0) | ||
17 | #define pmd_none(pmd) (1) | ||
18 | #define pgd_offset_k(adrdress) ((pgd_t *)0) | ||
19 | #define pte_offset_kernel(dir, address) ((pte_t *)0) | ||
20 | |||
21 | #define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */ | ||
22 | #define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */ | ||
23 | #define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */ | ||
24 | #define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */ | ||
25 | #define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */ | ||
26 | |||
27 | extern void paging_init(void); | ||
28 | #define swapper_pg_dir ((pgd_t *) 0) | ||
29 | |||
30 | #define __swp_type(x) (0) | ||
31 | #define __swp_offset(x) (0) | ||
32 | #define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) }) | ||
33 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
34 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
35 | |||
36 | static inline int pte_file(pte_t pte) { return 0; } | ||
37 | |||
38 | /* | ||
39 | * ZERO_PAGE is a global shared page that is always zero: used | ||
40 | * for zero-mapped memory areas etc.. | ||
41 | */ | ||
42 | #define ZERO_PAGE(vaddr) (virt_to_page(0)) | ||
43 | |||
44 | /* | ||
45 | * These would be in other places but having them here reduces the diffs. | ||
46 | */ | ||
47 | extern unsigned int kobjsize(const void *objp); | ||
48 | extern int is_in_rom(unsigned long); | ||
49 | |||
50 | /* | ||
51 | * No page table caches to initialise | ||
52 | */ | ||
53 | #define pgtable_cache_init() do { } while (0) | ||
54 | |||
55 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | ||
56 | remap_pfn_range(vma, vaddr, pfn, size, prot) | ||
57 | |||
58 | /* | ||
59 | * All 32bit addresses are effectively valid for vmalloc... | ||
60 | * Sort of meaningless for non-VM targets. | ||
61 | */ | ||
62 | #define VMALLOC_START 0 | ||
63 | #define VMALLOC_END 0xffffffff | ||
64 | |||
65 | /* | ||
66 | * All 32bit addresses are effectively valid for vmalloc... | ||
67 | * Sort of meaningless for non-VM targets. | ||
68 | */ | ||
69 | #define VMALLOC_START 0 | ||
70 | #define VMALLOC_END 0xffffffff | ||
71 | |||
72 | #define arch_enter_lazy_cpu_mode() do {} while (0) | ||
73 | #endif /* _H8300_PGTABLE_H */ | ||
diff --git a/arch/h8300/include/asm/poll.h b/arch/h8300/include/asm/poll.h new file mode 100644 index 000000000000..f61540c22d94 --- /dev/null +++ b/arch/h8300/include/asm/poll.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __H8300_POLL_H | ||
2 | #define __H8300_POLL_H | ||
3 | |||
4 | #define POLLWRNORM POLLOUT | ||
5 | #define POLLWRBAND 256 | ||
6 | |||
7 | #include <asm-generic/poll.h> | ||
8 | |||
9 | #undef POLLREMOVE | ||
10 | |||
11 | #endif | ||
diff --git a/arch/h8300/include/asm/posix_types.h b/arch/h8300/include/asm/posix_types.h new file mode 100644 index 000000000000..5c553927fc53 --- /dev/null +++ b/arch/h8300/include/asm/posix_types.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef __ARCH_H8300_POSIX_TYPES_H | ||
2 | #define __ARCH_H8300_POSIX_TYPES_H | ||
3 | |||
4 | /* | ||
5 | * This file is generally used by user-level software, so you need to | ||
6 | * be a little careful about namespace pollution etc. Also, we cannot | ||
7 | * assume GCC is being used. | ||
8 | */ | ||
9 | |||
10 | typedef unsigned long __kernel_ino_t; | ||
11 | typedef unsigned short __kernel_mode_t; | ||
12 | typedef unsigned short __kernel_nlink_t; | ||
13 | typedef long __kernel_off_t; | ||
14 | typedef int __kernel_pid_t; | ||
15 | typedef unsigned short __kernel_ipc_pid_t; | ||
16 | typedef unsigned short __kernel_uid_t; | ||
17 | typedef unsigned short __kernel_gid_t; | ||
18 | typedef unsigned int __kernel_size_t; | ||
19 | typedef int __kernel_ssize_t; | ||
20 | typedef int __kernel_ptrdiff_t; | ||
21 | typedef long __kernel_time_t; | ||
22 | typedef long __kernel_suseconds_t; | ||
23 | typedef long __kernel_clock_t; | ||
24 | typedef int __kernel_timer_t; | ||
25 | typedef int __kernel_clockid_t; | ||
26 | typedef int __kernel_daddr_t; | ||
27 | typedef char * __kernel_caddr_t; | ||
28 | typedef unsigned short __kernel_uid16_t; | ||
29 | typedef unsigned short __kernel_gid16_t; | ||
30 | typedef unsigned int __kernel_uid32_t; | ||
31 | typedef unsigned int __kernel_gid32_t; | ||
32 | |||
33 | typedef unsigned short __kernel_old_uid_t; | ||
34 | typedef unsigned short __kernel_old_gid_t; | ||
35 | |||
36 | #ifdef __GNUC__ | ||
37 | typedef long long __kernel_loff_t; | ||
38 | #endif | ||
39 | |||
40 | typedef struct { | ||
41 | int val[2]; | ||
42 | } __kernel_fsid_t; | ||
43 | |||
44 | #if defined(__KERNEL__) | ||
45 | |||
46 | #undef __FD_SET | ||
47 | #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) | ||
48 | |||
49 | #undef __FD_CLR | ||
50 | #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) | ||
51 | |||
52 | #undef __FD_ISSET | ||
53 | #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) | ||
54 | |||
55 | #undef __FD_ZERO | ||
56 | #define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp))) | ||
57 | |||
58 | #endif /* defined(__KERNEL__) */ | ||
59 | |||
60 | #endif | ||
diff --git a/arch/h8300/include/asm/processor.h b/arch/h8300/include/asm/processor.h new file mode 100644 index 000000000000..69e8a34eb6d5 --- /dev/null +++ b/arch/h8300/include/asm/processor.h | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | * include/asm-h8300/processor.h | ||
3 | * | ||
4 | * Copyright (C) 2002 Yoshinori Sato | ||
5 | * | ||
6 | * Based on: linux/asm-m68nommu/processor.h | ||
7 | * | ||
8 | * Copyright (C) 1995 Hamish Macdonald | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_H8300_PROCESSOR_H | ||
12 | #define __ASM_H8300_PROCESSOR_H | ||
13 | |||
14 | /* | ||
15 | * Default implementation of macro that returns current | ||
16 | * instruction pointer ("program counter"). | ||
17 | */ | ||
18 | #define current_text_addr() ({ __label__ _l; _l: &&_l;}) | ||
19 | |||
20 | #include <linux/compiler.h> | ||
21 | #include <asm/segment.h> | ||
22 | #include <asm/fpu.h> | ||
23 | #include <asm/ptrace.h> | ||
24 | #include <asm/current.h> | ||
25 | |||
26 | static inline unsigned long rdusp(void) { | ||
27 | extern unsigned int sw_usp; | ||
28 | return(sw_usp); | ||
29 | } | ||
30 | |||
31 | static inline void wrusp(unsigned long usp) { | ||
32 | extern unsigned int sw_usp; | ||
33 | sw_usp = usp; | ||
34 | } | ||
35 | |||
36 | /* | ||
37 | * User space process size: 3.75GB. This is hardcoded into a few places, | ||
38 | * so don't change it unless you know what you are doing. | ||
39 | */ | ||
40 | #define TASK_SIZE (0xFFFFFFFFUL) | ||
41 | |||
42 | #ifdef __KERNEL__ | ||
43 | #define STACK_TOP TASK_SIZE | ||
44 | #define STACK_TOP_MAX STACK_TOP | ||
45 | #endif | ||
46 | |||
47 | /* | ||
48 | * This decides where the kernel will search for a free chunk of vm | ||
49 | * space during mmap's. We won't be using it | ||
50 | */ | ||
51 | #define TASK_UNMAPPED_BASE 0 | ||
52 | |||
53 | struct thread_struct { | ||
54 | unsigned long ksp; /* kernel stack pointer */ | ||
55 | unsigned long usp; /* user stack pointer */ | ||
56 | unsigned long ccr; /* saved status register */ | ||
57 | unsigned long esp0; /* points to SR of stack frame */ | ||
58 | struct { | ||
59 | unsigned short *addr; | ||
60 | unsigned short inst; | ||
61 | } breakinfo; | ||
62 | }; | ||
63 | |||
64 | #define INIT_THREAD { \ | ||
65 | .ksp = sizeof(init_stack) + (unsigned long)init_stack, \ | ||
66 | .usp = 0, \ | ||
67 | .ccr = PS_S, \ | ||
68 | .esp0 = 0, \ | ||
69 | .breakinfo = { \ | ||
70 | .addr = (unsigned short *)-1, \ | ||
71 | .inst = 0 \ | ||
72 | } \ | ||
73 | } | ||
74 | |||
75 | /* | ||
76 | * Do necessary setup to start up a newly executed thread. | ||
77 | * | ||
78 | * pass the data segment into user programs if it exists, | ||
79 | * it can't hurt anything as far as I can tell | ||
80 | */ | ||
81 | #if defined(__H8300H__) | ||
82 | #define start_thread(_regs, _pc, _usp) \ | ||
83 | do { \ | ||
84 | set_fs(USER_DS); /* reads from user space */ \ | ||
85 | (_regs)->pc = (_pc); \ | ||
86 | (_regs)->ccr = 0x00; /* clear all flags */ \ | ||
87 | (_regs)->er5 = current->mm->start_data; /* GOT base */ \ | ||
88 | wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \ | ||
89 | } while(0) | ||
90 | #endif | ||
91 | #if defined(__H8300S__) | ||
92 | #define start_thread(_regs, _pc, _usp) \ | ||
93 | do { \ | ||
94 | set_fs(USER_DS); /* reads from user space */ \ | ||
95 | (_regs)->pc = (_pc); \ | ||
96 | (_regs)->ccr = 0x00; /* clear kernel flag */ \ | ||
97 | (_regs)->exr = 0x78; /* enable all interrupts */ \ | ||
98 | (_regs)->er5 = current->mm->start_data; /* GOT base */ \ | ||
99 | /* 14 = space for retaddr(4), vector(4), er0(4) and ext(2) on stack */ \ | ||
100 | wrusp(((unsigned long)(_usp)) - 14); \ | ||
101 | } while(0) | ||
102 | #endif | ||
103 | |||
104 | /* Forward declaration, a strange C thing */ | ||
105 | struct task_struct; | ||
106 | |||
107 | /* Free all resources held by a thread. */ | ||
108 | static inline void release_thread(struct task_struct *dead_task) | ||
109 | { | ||
110 | } | ||
111 | |||
112 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
113 | |||
114 | #define prepare_to_copy(tsk) do { } while (0) | ||
115 | |||
116 | /* | ||
117 | * Free current thread data structures etc.. | ||
118 | */ | ||
119 | static inline void exit_thread(void) | ||
120 | { | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | * Return saved PC of a blocked thread. | ||
125 | */ | ||
126 | unsigned long thread_saved_pc(struct task_struct *tsk); | ||
127 | unsigned long get_wchan(struct task_struct *p); | ||
128 | |||
129 | #define KSTK_EIP(tsk) \ | ||
130 | ({ \ | ||
131 | unsigned long eip = 0; \ | ||
132 | if ((tsk)->thread.esp0 > PAGE_SIZE && \ | ||
133 | MAP_NR((tsk)->thread.esp0) < max_mapnr) \ | ||
134 | eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \ | ||
135 | eip; }) | ||
136 | #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) | ||
137 | |||
138 | #define cpu_relax() barrier() | ||
139 | |||
140 | #endif | ||
diff --git a/arch/h8300/include/asm/ptrace.h b/arch/h8300/include/asm/ptrace.h new file mode 100644 index 000000000000..c2e05e4b512e --- /dev/null +++ b/arch/h8300/include/asm/ptrace.h | |||
@@ -0,0 +1,64 @@ | |||
1 | #ifndef _H8300_PTRACE_H | ||
2 | #define _H8300_PTRACE_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | #define PT_ER1 0 | ||
7 | #define PT_ER2 1 | ||
8 | #define PT_ER3 2 | ||
9 | #define PT_ER4 3 | ||
10 | #define PT_ER5 4 | ||
11 | #define PT_ER6 5 | ||
12 | #define PT_ER0 6 | ||
13 | #define PT_ORIG_ER0 7 | ||
14 | #define PT_CCR 8 | ||
15 | #define PT_PC 9 | ||
16 | #define PT_USP 10 | ||
17 | #define PT_EXR 12 | ||
18 | |||
19 | /* this struct defines the way the registers are stored on the | ||
20 | stack during a system call. */ | ||
21 | |||
22 | struct pt_regs { | ||
23 | long retpc; | ||
24 | long er4; | ||
25 | long er5; | ||
26 | long er6; | ||
27 | long er3; | ||
28 | long er2; | ||
29 | long er1; | ||
30 | long orig_er0; | ||
31 | unsigned short ccr; | ||
32 | long er0; | ||
33 | long vector; | ||
34 | #if defined(CONFIG_CPU_H8S) | ||
35 | unsigned short exr; | ||
36 | #endif | ||
37 | unsigned long pc; | ||
38 | } __attribute__((aligned(2),packed)); | ||
39 | |||
40 | #define PTRACE_GETREGS 12 | ||
41 | #define PTRACE_SETREGS 13 | ||
42 | |||
43 | #ifdef __KERNEL__ | ||
44 | #ifndef PS_S | ||
45 | #define PS_S (0x10) | ||
46 | #endif | ||
47 | |||
48 | #if defined(__H8300H__) | ||
49 | #define H8300_REGS_NO 11 | ||
50 | #endif | ||
51 | #if defined(__H8300S__) | ||
52 | #define H8300_REGS_NO 12 | ||
53 | #endif | ||
54 | |||
55 | /* Find the stack offset for a register, relative to thread.esp0. */ | ||
56 | #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) | ||
57 | |||
58 | #define user_mode(regs) (!((regs)->ccr & PS_S)) | ||
59 | #define instruction_pointer(regs) ((regs)->pc) | ||
60 | #define profile_pc(regs) instruction_pointer(regs) | ||
61 | extern void show_regs(struct pt_regs *); | ||
62 | #endif /* __KERNEL__ */ | ||
63 | #endif /* __ASSEMBLY__ */ | ||
64 | #endif /* _H8300_PTRACE_H */ | ||
diff --git a/arch/h8300/include/asm/regs267x.h b/arch/h8300/include/asm/regs267x.h new file mode 100644 index 000000000000..1bff731a9f77 --- /dev/null +++ b/arch/h8300/include/asm/regs267x.h | |||
@@ -0,0 +1,336 @@ | |||
1 | /* internal Peripherals Register address define */ | ||
2 | /* CPU: H8/306x */ | ||
3 | |||
4 | #if !defined(__REGS_H8S267x__) | ||
5 | #define __REGS_H8S267x__ | ||
6 | |||
7 | #if defined(__KERNEL__) | ||
8 | |||
9 | #define DASTCR 0xFEE01A | ||
10 | #define DADR0 0xFFFFA4 | ||
11 | #define DADR1 0xFFFFA5 | ||
12 | #define DACR01 0xFFFFA6 | ||
13 | #define DADR2 0xFFFFA8 | ||
14 | #define DADR3 0xFFFFA9 | ||
15 | #define DACR23 0xFFFFAA | ||
16 | |||
17 | #define ADDRA 0xFFFF90 | ||
18 | #define ADDRAH 0xFFFF90 | ||
19 | #define ADDRAL 0xFFFF91 | ||
20 | #define ADDRB 0xFFFF92 | ||
21 | #define ADDRBH 0xFFFF92 | ||
22 | #define ADDRBL 0xFFFF93 | ||
23 | #define ADDRC 0xFFFF94 | ||
24 | #define ADDRCH 0xFFFF94 | ||
25 | #define ADDRCL 0xFFFF95 | ||
26 | #define ADDRD 0xFFFF96 | ||
27 | #define ADDRDH 0xFFFF96 | ||
28 | #define ADDRDL 0xFFFF97 | ||
29 | #define ADDRE 0xFFFF98 | ||
30 | #define ADDREH 0xFFFF98 | ||
31 | #define ADDREL 0xFFFF99 | ||
32 | #define ADDRF 0xFFFF9A | ||
33 | #define ADDRFH 0xFFFF9A | ||
34 | #define ADDRFL 0xFFFF9B | ||
35 | #define ADDRG 0xFFFF9C | ||
36 | #define ADDRGH 0xFFFF9C | ||
37 | #define ADDRGL 0xFFFF9D | ||
38 | #define ADDRH 0xFFFF9E | ||
39 | #define ADDRHH 0xFFFF9E | ||
40 | #define ADDRHL 0xFFFF9F | ||
41 | |||
42 | #define ADCSR 0xFFFFA0 | ||
43 | #define ADCR 0xFFFFA1 | ||
44 | |||
45 | #define ABWCR 0xFFFEC0 | ||
46 | #define ASTCR 0xFFFEC1 | ||
47 | #define WTCRAH 0xFFFEC2 | ||
48 | #define WTCRAL 0xFFFEC3 | ||
49 | #define WTCRBH 0xFFFEC4 | ||
50 | #define WTCRBL 0xFFFEC5 | ||
51 | #define RDNCR 0xFFFEC6 | ||
52 | #define CSACRH 0xFFFEC8 | ||
53 | #define CSACRL 0xFFFEC9 | ||
54 | #define BROMCRH 0xFFFECA | ||
55 | #define BROMCRL 0xFFFECB | ||
56 | #define BCR 0xFFFECC | ||
57 | #define DRAMCR 0xFFFED0 | ||
58 | #define DRACCR 0xFFFED2 | ||
59 | #define REFCR 0xFFFED4 | ||
60 | #define RTCNT 0xFFFED6 | ||
61 | #define RTCOR 0xFFFED7 | ||
62 | |||
63 | #define MAR0AH 0xFFFEE0 | ||
64 | #define MAR0AL 0xFFFEE2 | ||
65 | #define IOAR0A 0xFFFEE4 | ||
66 | #define ETCR0A 0xFFFEE6 | ||
67 | #define MAR0BH 0xFFFEE8 | ||
68 | #define MAR0BL 0xFFFEEA | ||
69 | #define IOAR0B 0xFFFEEC | ||
70 | #define ETCR0B 0xFFFEEE | ||
71 | #define MAR1AH 0xFFFEF0 | ||
72 | #define MAR1AL 0xFFFEF2 | ||
73 | #define IOAR1A 0xFFFEF4 | ||
74 | #define ETCR1A 0xFFFEF6 | ||
75 | #define MAR1BH 0xFFFEF8 | ||
76 | #define MAR1BL 0xFFFEFA | ||
77 | #define IOAR1B 0xFFFEFC | ||
78 | #define ETCR1B 0xFFFEFE | ||
79 | #define DMAWER 0xFFFF20 | ||
80 | #define DMATCR 0xFFFF21 | ||
81 | #define DMACR0A 0xFFFF22 | ||
82 | #define DMACR0B 0xFFFF23 | ||
83 | #define DMACR1A 0xFFFF24 | ||
84 | #define DMACR1B 0xFFFF25 | ||
85 | #define DMABCRH 0xFFFF26 | ||
86 | #define DMABCRL 0xFFFF27 | ||
87 | |||
88 | #define EDSAR0 0xFFFDC0 | ||
89 | #define EDDAR0 0xFFFDC4 | ||
90 | #define EDTCR0 0xFFFDC8 | ||
91 | #define EDMDR0 0xFFFDCC | ||
92 | #define EDMDR0H 0xFFFDCC | ||
93 | #define EDMDR0L 0xFFFDCD | ||
94 | #define EDACR0 0xFFFDCE | ||
95 | #define EDSAR1 0xFFFDD0 | ||
96 | #define EDDAR1 0xFFFDD4 | ||
97 | #define EDTCR1 0xFFFDD8 | ||
98 | #define EDMDR1 0xFFFDDC | ||
99 | #define EDMDR1H 0xFFFDDC | ||
100 | #define EDMDR1L 0xFFFDDD | ||
101 | #define EDACR1 0xFFFDDE | ||
102 | #define EDSAR2 0xFFFDE0 | ||
103 | #define EDDAR2 0xFFFDE4 | ||
104 | #define EDTCR2 0xFFFDE8 | ||
105 | #define EDMDR2 0xFFFDEC | ||
106 | #define EDMDR2H 0xFFFDEC | ||
107 | #define EDMDR2L 0xFFFDED | ||
108 | #define EDACR2 0xFFFDEE | ||
109 | #define EDSAR3 0xFFFDF0 | ||
110 | #define EDDAR3 0xFFFDF4 | ||
111 | #define EDTCR3 0xFFFDF8 | ||
112 | #define EDMDR3 0xFFFDFC | ||
113 | #define EDMDR3H 0xFFFDFC | ||
114 | #define EDMDR3L 0xFFFDFD | ||
115 | #define EDACR3 0xFFFDFE | ||
116 | |||
117 | #define IPRA 0xFFFE00 | ||
118 | #define IPRB 0xFFFE02 | ||
119 | #define IPRC 0xFFFE04 | ||
120 | #define IPRD 0xFFFE06 | ||
121 | #define IPRE 0xFFFE08 | ||
122 | #define IPRF 0xFFFE0A | ||
123 | #define IPRG 0xFFFE0C | ||
124 | #define IPRH 0xFFFE0E | ||
125 | #define IPRI 0xFFFE10 | ||
126 | #define IPRJ 0xFFFE12 | ||
127 | #define IPRK 0xFFFE14 | ||
128 | #define ITSR 0xFFFE16 | ||
129 | #define SSIER 0xFFFE18 | ||
130 | #define ISCRH 0xFFFE1A | ||
131 | #define ISCRL 0xFFFE1C | ||
132 | |||
133 | #define INTCR 0xFFFF31 | ||
134 | #define IER 0xFFFF32 | ||
135 | #define IERH 0xFFFF32 | ||
136 | #define IERL 0xFFFF33 | ||
137 | #define ISR 0xFFFF34 | ||
138 | #define ISRH 0xFFFF34 | ||
139 | #define ISRL 0xFFFF35 | ||
140 | |||
141 | #define P1DDR 0xFFFE20 | ||
142 | #define P2DDR 0xFFFE21 | ||
143 | #define P3DDR 0xFFFE22 | ||
144 | #define P4DDR 0xFFFE23 | ||
145 | #define P5DDR 0xFFFE24 | ||
146 | #define P6DDR 0xFFFE25 | ||
147 | #define P7DDR 0xFFFE26 | ||
148 | #define P8DDR 0xFFFE27 | ||
149 | #define P9DDR 0xFFFE28 | ||
150 | #define PADDR 0xFFFE29 | ||
151 | #define PBDDR 0xFFFE2A | ||
152 | #define PCDDR 0xFFFE2B | ||
153 | #define PDDDR 0xFFFE2C | ||
154 | #define PEDDR 0xFFFE2D | ||
155 | #define PFDDR 0xFFFE2E | ||
156 | #define PGDDR 0xFFFE2F | ||
157 | #define PHDDR 0xFFFF74 | ||
158 | |||
159 | #define PFCR0 0xFFFE32 | ||
160 | #define PFCR1 0xFFFE33 | ||
161 | #define PFCR2 0xFFFE34 | ||
162 | |||
163 | #define PAPCR 0xFFFE36 | ||
164 | #define PBPCR 0xFFFE37 | ||
165 | #define PCPCR 0xFFFE38 | ||
166 | #define PDPCR 0xFFFE39 | ||
167 | #define PEPCR 0xFFFE3A | ||
168 | |||
169 | #define P3ODR 0xFFFE3C | ||
170 | #define PAODR 0xFFFE3D | ||
171 | |||
172 | #define P1DR 0xFFFF60 | ||
173 | #define P2DR 0xFFFF61 | ||
174 | #define P3DR 0xFFFF62 | ||
175 | #define P4DR 0xFFFF63 | ||
176 | #define P5DR 0xFFFF64 | ||
177 | #define P6DR 0xFFFF65 | ||
178 | #define P7DR 0xFFFF66 | ||
179 | #define P8DR 0xFFFF67 | ||
180 | #define P9DR 0xFFFF68 | ||
181 | #define PADR 0xFFFF69 | ||
182 | #define PBDR 0xFFFF6A | ||
183 | #define PCDR 0xFFFF6B | ||
184 | #define PDDR 0xFFFF6C | ||
185 | #define PEDR 0xFFFF6D | ||
186 | #define PFDR 0xFFFF6E | ||
187 | #define PGDR 0xFFFF6F | ||
188 | #define PHDR 0xFFFF72 | ||
189 | |||
190 | #define PORT1 0xFFFF50 | ||
191 | #define PORT2 0xFFFF51 | ||
192 | #define PORT3 0xFFFF52 | ||
193 | #define PORT4 0xFFFF53 | ||
194 | #define PORT5 0xFFFF54 | ||
195 | #define PORT6 0xFFFF55 | ||
196 | #define PORT7 0xFFFF56 | ||
197 | #define PORT8 0xFFFF57 | ||
198 | #define PORT9 0xFFFF58 | ||
199 | #define PORTA 0xFFFF59 | ||
200 | #define PORTB 0xFFFF5A | ||
201 | #define PORTC 0xFFFF5B | ||
202 | #define PORTD 0xFFFF5C | ||
203 | #define PORTE 0xFFFF5D | ||
204 | #define PORTF 0xFFFF5E | ||
205 | #define PORTG 0xFFFF5F | ||
206 | #define PORTH 0xFFFF70 | ||
207 | |||
208 | #define PCR 0xFFFF46 | ||
209 | #define PMR 0xFFFF47 | ||
210 | #define NDERH 0xFFFF48 | ||
211 | #define NDERL 0xFFFF49 | ||
212 | #define PODRH 0xFFFF4A | ||
213 | #define PODRL 0xFFFF4B | ||
214 | #define NDRH1 0xFFFF4C | ||
215 | #define NDRL1 0xFFFF4D | ||
216 | #define NDRH2 0xFFFF4E | ||
217 | #define NDRL2 0xFFFF4F | ||
218 | |||
219 | #define SMR0 0xFFFF78 | ||
220 | #define BRR0 0xFFFF79 | ||
221 | #define SCR0 0xFFFF7A | ||
222 | #define TDR0 0xFFFF7B | ||
223 | #define SSR0 0xFFFF7C | ||
224 | #define RDR0 0xFFFF7D | ||
225 | #define SCMR0 0xFFFF7E | ||
226 | #define SMR1 0xFFFF80 | ||
227 | #define BRR1 0xFFFF81 | ||
228 | #define SCR1 0xFFFF82 | ||
229 | #define TDR1 0xFFFF83 | ||
230 | #define SSR1 0xFFFF84 | ||
231 | #define RDR1 0xFFFF85 | ||
232 | #define SCMR1 0xFFFF86 | ||
233 | #define SMR2 0xFFFF88 | ||
234 | #define BRR2 0xFFFF89 | ||
235 | #define SCR2 0xFFFF8A | ||
236 | #define TDR2 0xFFFF8B | ||
237 | #define SSR2 0xFFFF8C | ||
238 | #define RDR2 0xFFFF8D | ||
239 | #define SCMR2 0xFFFF8E | ||
240 | |||
241 | #define IRCR0 0xFFFE1E | ||
242 | #define SEMR 0xFFFDA8 | ||
243 | |||
244 | #define MDCR 0xFFFF3E | ||
245 | #define SYSCR 0xFFFF3D | ||
246 | #define MSTPCRH 0xFFFF40 | ||
247 | #define MSTPCRL 0xFFFF41 | ||
248 | #define FLMCR1 0xFFFFC8 | ||
249 | #define FLMCR2 0xFFFFC9 | ||
250 | #define EBR1 0xFFFFCA | ||
251 | #define EBR2 0xFFFFCB | ||
252 | #define CTGARC_RAMCR 0xFFFECE | ||
253 | #define SBYCR 0xFFFF3A | ||
254 | #define SCKCR 0xFFFF3B | ||
255 | #define PLLCR 0xFFFF45 | ||
256 | |||
257 | #define TSTR 0xFFFFC0 | ||
258 | #define TSNC 0XFFFFC1 | ||
259 | |||
260 | #define TCR0 0xFFFFD0 | ||
261 | #define TMDR0 0xFFFFD1 | ||
262 | #define TIORH0 0xFFFFD2 | ||
263 | #define TIORL0 0xFFFFD3 | ||
264 | #define TIER0 0xFFFFD4 | ||
265 | #define TSR0 0xFFFFD5 | ||
266 | #define TCNT0 0xFFFFD6 | ||
267 | #define GRA0 0xFFFFD8 | ||
268 | #define GRB0 0xFFFFDA | ||
269 | #define GRC0 0xFFFFDC | ||
270 | #define GRD0 0xFFFFDE | ||
271 | #define TCR1 0xFFFFE0 | ||
272 | #define TMDR1 0xFFFFE1 | ||
273 | #define TIORH1 0xFFFFE2 | ||
274 | #define TIORL1 0xFFFFE3 | ||
275 | #define TIER1 0xFFFFE4 | ||
276 | #define TSR1 0xFFFFE5 | ||
277 | #define TCNT1 0xFFFFE6 | ||
278 | #define GRA1 0xFFFFE8 | ||
279 | #define GRB1 0xFFFFEA | ||
280 | #define TCR2 0xFFFFF0 | ||
281 | #define TMDR2 0xFFFFF1 | ||
282 | #define TIORH2 0xFFFFF2 | ||
283 | #define TIORL2 0xFFFFF3 | ||
284 | #define TIER2 0xFFFFF4 | ||
285 | #define TSR2 0xFFFFF5 | ||
286 | #define TCNT2 0xFFFFF6 | ||
287 | #define GRA2 0xFFFFF8 | ||
288 | #define GRB2 0xFFFFFA | ||
289 | #define TCR3 0xFFFE80 | ||
290 | #define TMDR3 0xFFFE81 | ||
291 | #define TIORH3 0xFFFE82 | ||
292 | #define TIORL3 0xFFFE83 | ||
293 | #define TIER3 0xFFFE84 | ||
294 | #define TSR3 0xFFFE85 | ||
295 | #define TCNT3 0xFFFE86 | ||
296 | #define GRA3 0xFFFE88 | ||
297 | #define GRB3 0xFFFE8A | ||
298 | #define GRC3 0xFFFE8C | ||
299 | #define GRD3 0xFFFE8E | ||
300 | #define TCR4 0xFFFE90 | ||
301 | #define TMDR4 0xFFFE91 | ||
302 | #define TIORH4 0xFFFE92 | ||
303 | #define TIORL4 0xFFFE93 | ||
304 | #define TIER4 0xFFFE94 | ||
305 | #define TSR4 0xFFFE95 | ||
306 | #define TCNT4 0xFFFE96 | ||
307 | #define GRA4 0xFFFE98 | ||
308 | #define GRB4 0xFFFE9A | ||
309 | #define TCR5 0xFFFEA0 | ||
310 | #define TMDR5 0xFFFEA1 | ||
311 | #define TIORH5 0xFFFEA2 | ||
312 | #define TIORL5 0xFFFEA3 | ||
313 | #define TIER5 0xFFFEA4 | ||
314 | #define TSR5 0xFFFEA5 | ||
315 | #define TCNT5 0xFFFEA6 | ||
316 | #define GRA5 0xFFFEA8 | ||
317 | #define GRB5 0xFFFEAA | ||
318 | |||
319 | #define _8TCR0 0xFFFFB0 | ||
320 | #define _8TCR1 0xFFFFB1 | ||
321 | #define _8TCSR0 0xFFFFB2 | ||
322 | #define _8TCSR1 0xFFFFB3 | ||
323 | #define _8TCORA0 0xFFFFB4 | ||
324 | #define _8TCORA1 0xFFFFB5 | ||
325 | #define _8TCORB0 0xFFFFB6 | ||
326 | #define _8TCORB1 0xFFFFB7 | ||
327 | #define _8TCNT0 0xFFFFB8 | ||
328 | #define _8TCNT1 0xFFFFB9 | ||
329 | |||
330 | #define TCSR 0xFFFFBC | ||
331 | #define TCNT 0xFFFFBD | ||
332 | #define RSTCSRW 0xFFFFBE | ||
333 | #define RSTCSRR 0xFFFFBF | ||
334 | |||
335 | #endif /* __KERNEL__ */ | ||
336 | #endif /* __REGS_H8S267x__ */ | ||
diff --git a/arch/h8300/include/asm/regs306x.h b/arch/h8300/include/asm/regs306x.h new file mode 100644 index 000000000000..027dd633fa25 --- /dev/null +++ b/arch/h8300/include/asm/regs306x.h | |||
@@ -0,0 +1,212 @@ | |||
1 | /* internal Peripherals Register address define */ | ||
2 | /* CPU: H8/306x */ | ||
3 | |||
4 | #if !defined(__REGS_H8306x__) | ||
5 | #define __REGS_H8306x__ | ||
6 | |||
7 | #if defined(__KERNEL__) | ||
8 | |||
9 | #define DASTCR 0xFEE01A | ||
10 | #define DADR0 0xFEE09C | ||
11 | #define DADR1 0xFEE09D | ||
12 | #define DACR 0xFEE09E | ||
13 | |||
14 | #define ADDRAH 0xFFFFE0 | ||
15 | #define ADDRAL 0xFFFFE1 | ||
16 | #define ADDRBH 0xFFFFE2 | ||
17 | #define ADDRBL 0xFFFFE3 | ||
18 | #define ADDRCH 0xFFFFE4 | ||
19 | #define ADDRCL 0xFFFFE5 | ||
20 | #define ADDRDH 0xFFFFE6 | ||
21 | #define ADDRDL 0xFFFFE7 | ||
22 | #define ADCSR 0xFFFFE8 | ||
23 | #define ADCR 0xFFFFE9 | ||
24 | |||
25 | #define BRCR 0xFEE013 | ||
26 | #define ADRCR 0xFEE01E | ||
27 | #define CSCR 0xFEE01F | ||
28 | #define ABWCR 0xFEE020 | ||
29 | #define ASTCR 0xFEE021 | ||
30 | #define WCRH 0xFEE022 | ||
31 | #define WCRL 0xFEE023 | ||
32 | #define BCR 0xFEE024 | ||
33 | #define DRCRA 0xFEE026 | ||
34 | #define DRCRB 0xFEE027 | ||
35 | #define RTMCSR 0xFEE028 | ||
36 | #define RTCNT 0xFEE029 | ||
37 | #define RTCOR 0xFEE02A | ||
38 | |||
39 | #define MAR0AR 0xFFFF20 | ||
40 | #define MAR0AE 0xFFFF21 | ||
41 | #define MAR0AH 0xFFFF22 | ||
42 | #define MAR0AL 0xFFFF23 | ||
43 | #define ETCR0AL 0xFFFF24 | ||
44 | #define ETCR0AH 0xFFFF25 | ||
45 | #define IOAR0A 0xFFFF26 | ||
46 | #define DTCR0A 0xFFFF27 | ||
47 | #define MAR0BR 0xFFFF28 | ||
48 | #define MAR0BE 0xFFFF29 | ||
49 | #define MAR0BH 0xFFFF2A | ||
50 | #define MAR0BL 0xFFFF2B | ||
51 | #define ETCR0BL 0xFFFF2C | ||
52 | #define ETCR0BH 0xFFFF2D | ||
53 | #define IOAR0B 0xFFFF2E | ||
54 | #define DTCR0B 0xFFFF2F | ||
55 | #define MAR1AR 0xFFFF30 | ||
56 | #define MAR1AE 0xFFFF31 | ||
57 | #define MAR1AH 0xFFFF32 | ||
58 | #define MAR1AL 0xFFFF33 | ||
59 | #define ETCR1AL 0xFFFF34 | ||
60 | #define ETCR1AH 0xFFFF35 | ||
61 | #define IOAR1A 0xFFFF36 | ||
62 | #define DTCR1A 0xFFFF37 | ||
63 | #define MAR1BR 0xFFFF38 | ||
64 | #define MAR1BE 0xFFFF39 | ||
65 | #define MAR1BH 0xFFFF3A | ||
66 | #define MAR1BL 0xFFFF3B | ||
67 | #define ETCR1BL 0xFFFF3C | ||
68 | #define ETCR1BH 0xFFFF3D | ||
69 | #define IOAR1B 0xFFFF3E | ||
70 | #define DTCR1B 0xFFFF3F | ||
71 | |||
72 | #define ISCR 0xFEE014 | ||
73 | #define IER 0xFEE015 | ||
74 | #define ISR 0xFEE016 | ||
75 | #define IPRA 0xFEE018 | ||
76 | #define IPRB 0xFEE019 | ||
77 | |||
78 | #define P1DDR 0xFEE000 | ||
79 | #define P2DDR 0xFEE001 | ||
80 | #define P3DDR 0xFEE002 | ||
81 | #define P4DDR 0xFEE003 | ||
82 | #define P5DDR 0xFEE004 | ||
83 | #define P6DDR 0xFEE005 | ||
84 | /*#define P7DDR 0xFEE006*/ | ||
85 | #define P8DDR 0xFEE007 | ||
86 | #define P9DDR 0xFEE008 | ||
87 | #define PADDR 0xFEE009 | ||
88 | #define PBDDR 0xFEE00A | ||
89 | |||
90 | #define P1DR 0xFFFFD0 | ||
91 | #define P2DR 0xFFFFD1 | ||
92 | #define P3DR 0xFFFFD2 | ||
93 | #define P4DR 0xFFFFD3 | ||
94 | #define P5DR 0xFFFFD4 | ||
95 | #define P6DR 0xFFFFD5 | ||
96 | /*#define P7DR 0xFFFFD6*/ | ||
97 | #define P8DR 0xFFFFD7 | ||
98 | #define P9DR 0xFFFFD8 | ||
99 | #define PADR 0xFFFFD9 | ||
100 | #define PBDR 0xFFFFDA | ||
101 | |||
102 | #define P2CR 0xFEE03C | ||
103 | #define P4CR 0xFEE03E | ||
104 | #define P5CR 0xFEE03F | ||
105 | |||
106 | #define SMR0 0xFFFFB0 | ||
107 | #define BRR0 0xFFFFB1 | ||
108 | #define SCR0 0xFFFFB2 | ||
109 | #define TDR0 0xFFFFB3 | ||
110 | #define SSR0 0xFFFFB4 | ||
111 | #define RDR0 0xFFFFB5 | ||
112 | #define SCMR0 0xFFFFB6 | ||
113 | #define SMR1 0xFFFFB8 | ||
114 | #define BRR1 0xFFFFB9 | ||
115 | #define SCR1 0xFFFFBA | ||
116 | #define TDR1 0xFFFFBB | ||
117 | #define SSR1 0xFFFFBC | ||
118 | #define RDR1 0xFFFFBD | ||
119 | #define SCMR1 0xFFFFBE | ||
120 | #define SMR2 0xFFFFC0 | ||
121 | #define BRR2 0xFFFFC1 | ||
122 | #define SCR2 0xFFFFC2 | ||
123 | #define TDR2 0xFFFFC3 | ||
124 | #define SSR2 0xFFFFC4 | ||
125 | #define RDR2 0xFFFFC5 | ||
126 | #define SCMR2 0xFFFFC6 | ||
127 | |||
128 | #define MDCR 0xFEE011 | ||
129 | #define SYSCR 0xFEE012 | ||
130 | #define DIVCR 0xFEE01B | ||
131 | #define MSTCRH 0xFEE01C | ||
132 | #define MSTCRL 0xFEE01D | ||
133 | #define FLMCR1 0xFEE030 | ||
134 | #define FLMCR2 0xFEE031 | ||
135 | #define EBR1 0xFEE032 | ||
136 | #define EBR2 0xFEE033 | ||
137 | #define RAMCR 0xFEE077 | ||
138 | |||
139 | #define TSTR 0xFFFF60 | ||
140 | #define TSNC 0XFFFF61 | ||
141 | #define TMDR 0xFFFF62 | ||
142 | #define TOLR 0xFFFF63 | ||
143 | #define TISRA 0xFFFF64 | ||
144 | #define TISRB 0xFFFF65 | ||
145 | #define TISRC 0xFFFF66 | ||
146 | #define TCR0 0xFFFF68 | ||
147 | #define TIOR0 0xFFFF69 | ||
148 | #define TCNT0H 0xFFFF6A | ||
149 | #define TCNT0L 0xFFFF6B | ||
150 | #define GRA0H 0xFFFF6C | ||
151 | #define GRA0L 0xFFFF6D | ||
152 | #define GRB0H 0xFFFF6E | ||
153 | #define GRB0L 0xFFFF6F | ||
154 | #define TCR1 0xFFFF70 | ||
155 | #define TIOR1 0xFFFF71 | ||
156 | #define TCNT1H 0xFFFF72 | ||
157 | #define TCNT1L 0xFFFF73 | ||
158 | #define GRA1H 0xFFFF74 | ||
159 | #define GRA1L 0xFFFF75 | ||
160 | #define GRB1H 0xFFFF76 | ||
161 | #define GRB1L 0xFFFF77 | ||
162 | #define TCR3 0xFFFF78 | ||
163 | #define TIOR3 0xFFFF79 | ||
164 | #define TCNT3H 0xFFFF7A | ||
165 | #define TCNT3L 0xFFFF7B | ||
166 | #define GRA3H 0xFFFF7C | ||
167 | #define GRA3L 0xFFFF7D | ||
168 | #define GRB3H 0xFFFF7E | ||
169 | #define GRB3L 0xFFFF7F | ||
170 | |||
171 | #define _8TCR0 0xFFFF80 | ||
172 | #define _8TCR1 0xFFFF81 | ||
173 | #define _8TCSR0 0xFFFF82 | ||
174 | #define _8TCSR1 0xFFFF83 | ||
175 | #define TCORA0 0xFFFF84 | ||
176 | #define TCORA1 0xFFFF85 | ||
177 | #define TCORB0 0xFFFF86 | ||
178 | #define TCORB1 0xFFFF87 | ||
179 | #define _8TCNT0 0xFFFF88 | ||
180 | #define _8TCNT1 0xFFFF89 | ||
181 | |||
182 | #define _8TCR2 0xFFFF90 | ||
183 | #define _8TCR3 0xFFFF91 | ||
184 | #define _8TCSR2 0xFFFF92 | ||
185 | #define _8TCSR3 0xFFFF93 | ||
186 | #define TCORA2 0xFFFF94 | ||
187 | #define TCORA3 0xFFFF95 | ||
188 | #define TCORB2 0xFFFF96 | ||
189 | #define TCORB3 0xFFFF97 | ||
190 | #define _8TCNT2 0xFFFF98 | ||
191 | #define _8TCNT3 0xFFFF99 | ||
192 | |||
193 | #define TCSR 0xFFFF8C | ||
194 | #define TCNT 0xFFFF8D | ||
195 | #define RSTCSR 0xFFFF8F | ||
196 | |||
197 | #define TPMR 0xFFFFA0 | ||
198 | #define TPCR 0xFFFFA1 | ||
199 | #define NDERB 0xFFFFA2 | ||
200 | #define NDERA 0xFFFFA3 | ||
201 | #define NDRB1 0xFFFFA4 | ||
202 | #define NDRA1 0xFFFFA5 | ||
203 | #define NDRB2 0xFFFFA6 | ||
204 | #define NDRA2 0xFFFFA7 | ||
205 | |||
206 | #define TCSR 0xFFFF8C | ||
207 | #define TCNT 0xFFFF8D | ||
208 | #define RSTCSRW 0xFFFF8E | ||
209 | #define RSTCSRR 0xFFFF8F | ||
210 | |||
211 | #endif /* __KERNEL__ */ | ||
212 | #endif /* __REGS_H8306x__ */ | ||
diff --git a/arch/h8300/include/asm/resource.h b/arch/h8300/include/asm/resource.h new file mode 100644 index 000000000000..46c5f4391607 --- /dev/null +++ b/arch/h8300/include/asm/resource.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _H8300_RESOURCE_H | ||
2 | #define _H8300_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif /* _H8300_RESOURCE_H */ | ||
diff --git a/arch/h8300/include/asm/scatterlist.h b/arch/h8300/include/asm/scatterlist.h new file mode 100644 index 000000000000..d3ecdd87ac90 --- /dev/null +++ b/arch/h8300/include/asm/scatterlist.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _H8300_SCATTERLIST_H | ||
2 | #define _H8300_SCATTERLIST_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | |||
6 | struct scatterlist { | ||
7 | #ifdef CONFIG_DEBUG_SG | ||
8 | unsigned long sg_magic; | ||
9 | #endif | ||
10 | unsigned long page_link; | ||
11 | unsigned int offset; | ||
12 | dma_addr_t dma_address; | ||
13 | unsigned int length; | ||
14 | }; | ||
15 | |||
16 | #define ISA_DMA_THRESHOLD (0xffffffff) | ||
17 | |||
18 | #endif /* !(_H8300_SCATTERLIST_H) */ | ||
diff --git a/arch/h8300/include/asm/sections.h b/arch/h8300/include/asm/sections.h new file mode 100644 index 000000000000..a81743e8b743 --- /dev/null +++ b/arch/h8300/include/asm/sections.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _H8300_SECTIONS_H_ | ||
2 | #define _H8300_SECTIONS_H_ | ||
3 | |||
4 | #include <asm-generic/sections.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/h8300/include/asm/segment.h b/arch/h8300/include/asm/segment.h new file mode 100644 index 000000000000..b79a82d0f99d --- /dev/null +++ b/arch/h8300/include/asm/segment.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _H8300_SEGMENT_H | ||
2 | #define _H8300_SEGMENT_H | ||
3 | |||
4 | /* define constants */ | ||
5 | #define USER_DATA (1) | ||
6 | #ifndef __USER_DS | ||
7 | #define __USER_DS (USER_DATA) | ||
8 | #endif | ||
9 | #define USER_PROGRAM (2) | ||
10 | #define SUPER_DATA (3) | ||
11 | #ifndef __KERNEL_DS | ||
12 | #define __KERNEL_DS (SUPER_DATA) | ||
13 | #endif | ||
14 | #define SUPER_PROGRAM (4) | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | |||
18 | typedef struct { | ||
19 | unsigned long seg; | ||
20 | } mm_segment_t; | ||
21 | |||
22 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | ||
23 | #define USER_DS MAKE_MM_SEG(__USER_DS) | ||
24 | #define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS) | ||
25 | |||
26 | /* | ||
27 | * Get/set the SFC/DFC registers for MOVES instructions | ||
28 | */ | ||
29 | |||
30 | static inline mm_segment_t get_fs(void) | ||
31 | { | ||
32 | return USER_DS; | ||
33 | } | ||
34 | |||
35 | static inline mm_segment_t get_ds(void) | ||
36 | { | ||
37 | /* return the supervisor data space code */ | ||
38 | return KERNEL_DS; | ||
39 | } | ||
40 | |||
41 | static inline void set_fs(mm_segment_t val) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | #define segment_eq(a,b) ((a).seg == (b).seg) | ||
46 | |||
47 | #endif /* __ASSEMBLY__ */ | ||
48 | |||
49 | #endif /* _H8300_SEGMENT_H */ | ||
diff --git a/arch/h8300/include/asm/sembuf.h b/arch/h8300/include/asm/sembuf.h new file mode 100644 index 000000000000..e04a3ec0cb92 --- /dev/null +++ b/arch/h8300/include/asm/sembuf.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _H8300_SEMBUF_H | ||
2 | #define _H8300_SEMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The semid64_ds structure for m68k 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 /* _H8300_SEMBUF_H */ | ||
diff --git a/arch/h8300/include/asm/setup.h b/arch/h8300/include/asm/setup.h new file mode 100644 index 000000000000..e2c600e96733 --- /dev/null +++ b/arch/h8300/include/asm/setup.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __H8300_SETUP_H | ||
2 | #define __H8300_SETUP_H | ||
3 | |||
4 | #define COMMAND_LINE_SIZE 512 | ||
5 | |||
6 | #endif | ||
diff --git a/arch/h8300/include/asm/sh_bios.h b/arch/h8300/include/asm/sh_bios.h new file mode 100644 index 000000000000..b6bb6e58295c --- /dev/null +++ b/arch/h8300/include/asm/sh_bios.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* eCos HAL interface header */ | ||
2 | |||
3 | #ifndef SH_BIOS_H | ||
4 | #define SH_BIOS_H | ||
5 | |||
6 | #define HAL_IF_VECTOR_TABLE 0xfffe20 | ||
7 | #define CALL_IF_SET_CONSOLE_COMM 13 | ||
8 | #define QUERY_CURRENT -1 | ||
9 | #define MANGLER -3 | ||
10 | |||
11 | /* Checking for GDB stub active */ | ||
12 | /* suggestion Jonathan Larmour */ | ||
13 | static int sh_bios_in_gdb_mode(void) | ||
14 | { | ||
15 | static int gdb_active = -1; | ||
16 | if (gdb_active == -1) { | ||
17 | int (*set_console_comm)(int); | ||
18 | set_console_comm = ((void **)HAL_IF_VECTOR_TABLE)[CALL_IF_SET_CONSOLE_COMM]; | ||
19 | gdb_active = (set_console_comm(QUERY_CURRENT) == MANGLER); | ||
20 | } | ||
21 | return gdb_active; | ||
22 | } | ||
23 | |||
24 | static void sh_bios_gdb_detach(void) | ||
25 | { | ||
26 | |||
27 | } | ||
28 | |||
29 | #endif | ||
diff --git a/arch/h8300/include/asm/shm.h b/arch/h8300/include/asm/shm.h new file mode 100644 index 000000000000..ed6623c0545d --- /dev/null +++ b/arch/h8300/include/asm/shm.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _H8300_SHM_H | ||
2 | #define _H8300_SHM_H | ||
3 | |||
4 | |||
5 | /* format of page table entries that correspond to shared memory pages | ||
6 | currently out in swap space (see also mm/swap.c): | ||
7 | bits 0-1 (PAGE_PRESENT) is = 0 | ||
8 | bits 8..2 (SWP_TYPE) are = SHM_SWP_TYPE | ||
9 | bits 31..9 are used like this: | ||
10 | bits 15..9 (SHM_ID) the id of the shared memory segment | ||
11 | bits 30..16 (SHM_IDX) the index of the page within the shared memory segment | ||
12 | (actually only bits 25..16 get used since SHMMAX is so low) | ||
13 | bit 31 (SHM_READ_ONLY) flag whether the page belongs to a read-only attach | ||
14 | */ | ||
15 | /* on the m68k both bits 0 and 1 must be zero */ | ||
16 | /* format on the sun3 is similar, but bits 30, 31 are set to zero and all | ||
17 | others are reduced by 2. --m */ | ||
18 | |||
19 | #ifndef CONFIG_SUN3 | ||
20 | #define SHM_ID_SHIFT 9 | ||
21 | #else | ||
22 | #define SHM_ID_SHIFT 7 | ||
23 | #endif | ||
24 | #define _SHM_ID_BITS 7 | ||
25 | #define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) | ||
26 | |||
27 | #define SHM_IDX_SHIFT (SHM_ID_SHIFT+_SHM_ID_BITS) | ||
28 | #define _SHM_IDX_BITS 15 | ||
29 | #define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) | ||
30 | |||
31 | #endif /* _H8300_SHM_H */ | ||
diff --git a/arch/h8300/include/asm/shmbuf.h b/arch/h8300/include/asm/shmbuf.h new file mode 100644 index 000000000000..64e77993a7a9 --- /dev/null +++ b/arch/h8300/include/asm/shmbuf.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _H8300_SHMBUF_H | ||
2 | #define _H8300_SHMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The shmid64_ds structure for m68k 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 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 /* _H8300_SHMBUF_H */ | ||
diff --git a/arch/h8300/include/asm/shmparam.h b/arch/h8300/include/asm/shmparam.h new file mode 100644 index 000000000000..d1863953ec64 --- /dev/null +++ b/arch/h8300/include/asm/shmparam.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _H8300_SHMPARAM_H | ||
2 | #define _H8300_SHMPARAM_H | ||
3 | |||
4 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | ||
5 | |||
6 | #endif /* _H8300_SHMPARAM_H */ | ||
diff --git a/arch/h8300/include/asm/sigcontext.h b/arch/h8300/include/asm/sigcontext.h new file mode 100644 index 000000000000..e4b81505f8f8 --- /dev/null +++ b/arch/h8300/include/asm/sigcontext.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _ASM_H8300_SIGCONTEXT_H | ||
2 | #define _ASM_H8300_SIGCONTEXT_H | ||
3 | |||
4 | struct sigcontext { | ||
5 | unsigned long sc_mask; /* old sigmask */ | ||
6 | unsigned long sc_usp; /* old user stack pointer */ | ||
7 | unsigned long sc_er0; | ||
8 | unsigned long sc_er1; | ||
9 | unsigned long sc_er2; | ||
10 | unsigned long sc_er3; | ||
11 | unsigned long sc_er4; | ||
12 | unsigned long sc_er5; | ||
13 | unsigned long sc_er6; | ||
14 | unsigned short sc_ccr; | ||
15 | unsigned long sc_pc; | ||
16 | }; | ||
17 | |||
18 | #endif | ||
diff --git a/arch/h8300/include/asm/siginfo.h b/arch/h8300/include/asm/siginfo.h new file mode 100644 index 000000000000..bc8fbea931a5 --- /dev/null +++ b/arch/h8300/include/asm/siginfo.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _H8300_SIGINFO_H | ||
2 | #define _H8300_SIGINFO_H | ||
3 | |||
4 | #include <asm-generic/siginfo.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h new file mode 100644 index 000000000000..7bc15048a64f --- /dev/null +++ b/arch/h8300/include/asm/signal.h | |||
@@ -0,0 +1,161 @@ | |||
1 | #ifndef _H8300_SIGNAL_H | ||
2 | #define _H8300_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 | #define SA_NOCLDSTOP 0x00000001 | ||
87 | #define SA_NOCLDWAIT 0x00000002 /* not supported yet */ | ||
88 | #define SA_SIGINFO 0x00000004 | ||
89 | #define SA_ONSTACK 0x08000000 | ||
90 | #define SA_RESTART 0x10000000 | ||
91 | #define SA_NODEFER 0x40000000 | ||
92 | #define SA_RESETHAND 0x80000000 | ||
93 | |||
94 | #define SA_NOMASK SA_NODEFER | ||
95 | #define SA_ONESHOT SA_RESETHAND | ||
96 | |||
97 | #define SA_RESTORER 0x04000000 | ||
98 | |||
99 | /* | ||
100 | * sigaltstack controls | ||
101 | */ | ||
102 | #define SS_ONSTACK 1 | ||
103 | #define SS_DISABLE 2 | ||
104 | |||
105 | #define MINSIGSTKSZ 2048 | ||
106 | #define SIGSTKSZ 8192 | ||
107 | |||
108 | #include <asm-generic/signal.h> | ||
109 | |||
110 | #ifdef __KERNEL__ | ||
111 | struct old_sigaction { | ||
112 | __sighandler_t sa_handler; | ||
113 | old_sigset_t sa_mask; | ||
114 | unsigned long sa_flags; | ||
115 | void (*sa_restorer)(void); | ||
116 | }; | ||
117 | |||
118 | struct sigaction { | ||
119 | __sighandler_t sa_handler; | ||
120 | unsigned long sa_flags; | ||
121 | void (*sa_restorer)(void); | ||
122 | sigset_t sa_mask; /* mask last for extensibility */ | ||
123 | }; | ||
124 | |||
125 | struct k_sigaction { | ||
126 | struct sigaction sa; | ||
127 | }; | ||
128 | #else | ||
129 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
130 | |||
131 | struct sigaction { | ||
132 | union { | ||
133 | __sighandler_t _sa_handler; | ||
134 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
135 | } _u; | ||
136 | sigset_t sa_mask; | ||
137 | unsigned long sa_flags; | ||
138 | void (*sa_restorer)(void); | ||
139 | }; | ||
140 | |||
141 | #define sa_handler _u._sa_handler | ||
142 | #define sa_sigaction _u._sa_sigaction | ||
143 | |||
144 | #endif /* __KERNEL__ */ | ||
145 | |||
146 | typedef struct sigaltstack { | ||
147 | void *ss_sp; | ||
148 | int ss_flags; | ||
149 | size_t ss_size; | ||
150 | } stack_t; | ||
151 | |||
152 | #ifdef __KERNEL__ | ||
153 | |||
154 | #include <asm/sigcontext.h> | ||
155 | #undef __HAVE_ARCH_SIG_BITOPS | ||
156 | |||
157 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
158 | |||
159 | #endif /* __KERNEL__ */ | ||
160 | |||
161 | #endif /* _H8300_SIGNAL_H */ | ||
diff --git a/arch/h8300/include/asm/smp.h b/arch/h8300/include/asm/smp.h new file mode 100644 index 000000000000..9e9bd7e58922 --- /dev/null +++ b/arch/h8300/include/asm/smp.h | |||
@@ -0,0 +1 @@ | |||
/* nothing required here yet */ | |||
diff --git a/arch/h8300/include/asm/socket.h b/arch/h8300/include/asm/socket.h new file mode 100644 index 000000000000..da2520dbf254 --- /dev/null +++ b/arch/h8300/include/asm/socket.h | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef _ASM_SOCKET_H | ||
2 | #define _ASM_SOCKET_H | ||
3 | |||
4 | #include <asm/sockios.h> | ||
5 | |||
6 | /* For setsockoptions(2) */ | ||
7 | #define SOL_SOCKET 1 | ||
8 | |||
9 | #define SO_DEBUG 1 | ||
10 | #define SO_REUSEADDR 2 | ||
11 | #define SO_TYPE 3 | ||
12 | #define SO_ERROR 4 | ||
13 | #define SO_DONTROUTE 5 | ||
14 | #define SO_BROADCAST 6 | ||
15 | #define SO_SNDBUF 7 | ||
16 | #define SO_RCVBUF 8 | ||
17 | #define SO_SNDBUFFORCE 32 | ||
18 | #define SO_RCVBUFFORCE 33 | ||
19 | #define SO_KEEPALIVE 9 | ||
20 | #define SO_OOBINLINE 10 | ||
21 | #define SO_NO_CHECK 11 | ||
22 | #define SO_PRIORITY 12 | ||
23 | #define SO_LINGER 13 | ||
24 | #define SO_BSDCOMPAT 14 | ||
25 | /* To add :#define SO_REUSEPORT 15 */ | ||
26 | #define SO_PASSCRED 16 | ||
27 | #define SO_PEERCRED 17 | ||
28 | #define SO_RCVLOWAT 18 | ||
29 | #define SO_SNDLOWAT 19 | ||
30 | #define SO_RCVTIMEO 20 | ||
31 | #define SO_SNDTIMEO 21 | ||
32 | |||
33 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
34 | #define SO_SECURITY_AUTHENTICATION 22 | ||
35 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 | ||
36 | #define SO_SECURITY_ENCRYPTION_NETWORK 24 | ||
37 | |||
38 | #define SO_BINDTODEVICE 25 | ||
39 | |||
40 | /* Socket filtering */ | ||
41 | #define SO_ATTACH_FILTER 26 | ||
42 | #define SO_DETACH_FILTER 27 | ||
43 | |||
44 | #define SO_PEERNAME 28 | ||
45 | #define SO_TIMESTAMP 29 | ||
46 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
47 | |||
48 | #define SO_ACCEPTCONN 30 | ||
49 | |||
50 | #define SO_PEERSEC 31 | ||
51 | #define SO_PASSSEC 34 | ||
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
54 | |||
55 | #define SO_MARK 36 | ||
56 | |||
57 | #endif /* _ASM_SOCKET_H */ | ||
diff --git a/arch/h8300/include/asm/sockios.h b/arch/h8300/include/asm/sockios.h new file mode 100644 index 000000000000..e9c7ec810c23 --- /dev/null +++ b/arch/h8300/include/asm/sockios.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __ARCH_H8300_SOCKIOS__ | ||
2 | #define __ARCH_H8300_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 /* __ARCH_H8300_SOCKIOS__ */ | ||
diff --git a/arch/h8300/include/asm/spinlock.h b/arch/h8300/include/asm/spinlock.h new file mode 100644 index 000000000000..d5407fa173e4 --- /dev/null +++ b/arch/h8300/include/asm/spinlock.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __H8300_SPINLOCK_H | ||
2 | #define __H8300_SPINLOCK_H | ||
3 | |||
4 | #error "H8/300 doesn't do SMP yet" | ||
5 | |||
6 | #endif | ||
diff --git a/arch/h8300/include/asm/stat.h b/arch/h8300/include/asm/stat.h new file mode 100644 index 000000000000..62c3cc24dfe6 --- /dev/null +++ b/arch/h8300/include/asm/stat.h | |||
@@ -0,0 +1,78 @@ | |||
1 | #ifndef _H8300_STAT_H | ||
2 | #define _H8300_STAT_H | ||
3 | |||
4 | struct __old_kernel_stat { | ||
5 | unsigned short st_dev; | ||
6 | unsigned short st_ino; | ||
7 | unsigned short st_mode; | ||
8 | unsigned short st_nlink; | ||
9 | unsigned short st_uid; | ||
10 | unsigned short st_gid; | ||
11 | unsigned short st_rdev; | ||
12 | unsigned long st_size; | ||
13 | unsigned long st_atime; | ||
14 | unsigned long st_mtime; | ||
15 | unsigned long st_ctime; | ||
16 | }; | ||
17 | |||
18 | struct stat { | ||
19 | unsigned short st_dev; | ||
20 | unsigned short __pad1; | ||
21 | unsigned long st_ino; | ||
22 | unsigned short st_mode; | ||
23 | unsigned short st_nlink; | ||
24 | unsigned short st_uid; | ||
25 | unsigned short st_gid; | ||
26 | unsigned short st_rdev; | ||
27 | unsigned short __pad2; | ||
28 | unsigned long st_size; | ||
29 | unsigned long st_blksize; | ||
30 | unsigned long st_blocks; | ||
31 | unsigned long st_atime; | ||
32 | unsigned long __unused1; | ||
33 | unsigned long st_mtime; | ||
34 | unsigned long __unused2; | ||
35 | unsigned long st_ctime; | ||
36 | unsigned long __unused3; | ||
37 | unsigned long __unused4; | ||
38 | unsigned long __unused5; | ||
39 | }; | ||
40 | |||
41 | /* This matches struct stat64 in glibc2.1, hence the absolutely | ||
42 | * insane amounts of padding around dev_t's. | ||
43 | */ | ||
44 | struct stat64 { | ||
45 | unsigned long long st_dev; | ||
46 | unsigned char __pad1[2]; | ||
47 | |||
48 | #define STAT64_HAS_BROKEN_ST_INO 1 | ||
49 | unsigned long __st_ino; | ||
50 | |||
51 | unsigned int st_mode; | ||
52 | unsigned int st_nlink; | ||
53 | |||
54 | unsigned long st_uid; | ||
55 | unsigned long st_gid; | ||
56 | |||
57 | unsigned long long st_rdev; | ||
58 | unsigned char __pad3[2]; | ||
59 | |||
60 | long long st_size; | ||
61 | unsigned long st_blksize; | ||
62 | |||
63 | unsigned long __pad4; /* future possible st_blocks high bits */ | ||
64 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | ||
65 | |||
66 | unsigned long st_atime; | ||
67 | unsigned long st_atime_nsec; | ||
68 | |||
69 | unsigned long st_mtime; | ||
70 | unsigned long st_mtime_nsec; | ||
71 | |||
72 | unsigned long st_ctime; | ||
73 | unsigned long st_ctime_nsec; | ||
74 | |||
75 | unsigned long long st_ino; | ||
76 | }; | ||
77 | |||
78 | #endif /* _H8300_STAT_H */ | ||
diff --git a/arch/h8300/include/asm/statfs.h b/arch/h8300/include/asm/statfs.h new file mode 100644 index 000000000000..b96efa712aac --- /dev/null +++ b/arch/h8300/include/asm/statfs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _H8300_STATFS_H | ||
2 | #define _H8300_STATFS_H | ||
3 | |||
4 | #include <asm-generic/statfs.h> | ||
5 | |||
6 | #endif /* _H8300_STATFS_H */ | ||
diff --git a/arch/h8300/include/asm/string.h b/arch/h8300/include/asm/string.h new file mode 100644 index 000000000000..ca5034897d87 --- /dev/null +++ b/arch/h8300/include/asm/string.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _H8300_STRING_H_ | ||
2 | #define _H8300_STRING_H_ | ||
3 | |||
4 | #ifdef __KERNEL__ /* only set these up for kernel code */ | ||
5 | |||
6 | #include <asm/setup.h> | ||
7 | #include <asm/page.h> | ||
8 | |||
9 | #define __HAVE_ARCH_MEMSET | ||
10 | extern void * memset(void * s, int c, size_t count); | ||
11 | |||
12 | #define __HAVE_ARCH_MEMCPY | ||
13 | extern void * memcpy(void *d, const void *s, size_t count); | ||
14 | |||
15 | #else /* KERNEL */ | ||
16 | |||
17 | /* | ||
18 | * let user libraries deal with these, | ||
19 | * IMHO the kernel has no place defining these functions for user apps | ||
20 | */ | ||
21 | |||
22 | #define __HAVE_ARCH_STRCPY 1 | ||
23 | #define __HAVE_ARCH_STRNCPY 1 | ||
24 | #define __HAVE_ARCH_STRCAT 1 | ||
25 | #define __HAVE_ARCH_STRNCAT 1 | ||
26 | #define __HAVE_ARCH_STRCMP 1 | ||
27 | #define __HAVE_ARCH_STRNCMP 1 | ||
28 | #define __HAVE_ARCH_STRNICMP 1 | ||
29 | #define __HAVE_ARCH_STRCHR 1 | ||
30 | #define __HAVE_ARCH_STRRCHR 1 | ||
31 | #define __HAVE_ARCH_STRSTR 1 | ||
32 | #define __HAVE_ARCH_STRLEN 1 | ||
33 | #define __HAVE_ARCH_STRNLEN 1 | ||
34 | #define __HAVE_ARCH_MEMSET 1 | ||
35 | #define __HAVE_ARCH_MEMCPY 1 | ||
36 | #define __HAVE_ARCH_MEMMOVE 1 | ||
37 | #define __HAVE_ARCH_MEMSCAN 1 | ||
38 | #define __HAVE_ARCH_MEMCMP 1 | ||
39 | #define __HAVE_ARCH_MEMCHR 1 | ||
40 | #define __HAVE_ARCH_STRTOK 1 | ||
41 | |||
42 | #endif /* KERNEL */ | ||
43 | |||
44 | #endif /* _M68K_STRING_H_ */ | ||
diff --git a/arch/h8300/include/asm/system.h b/arch/h8300/include/asm/system.h new file mode 100644 index 000000000000..4b8e475908ae --- /dev/null +++ b/arch/h8300/include/asm/system.h | |||
@@ -0,0 +1,158 @@ | |||
1 | #ifndef _H8300_SYSTEM_H | ||
2 | #define _H8300_SYSTEM_H | ||
3 | |||
4 | #include <linux/linkage.h> | ||
5 | |||
6 | /* | ||
7 | * switch_to(n) should switch tasks to task ptr, first checking that | ||
8 | * ptr isn't the current task, in which case it does nothing. This | ||
9 | * also clears the TS-flag if the task we switched to has used the | ||
10 | * math co-processor latest. | ||
11 | */ | ||
12 | /* | ||
13 | * switch_to() saves the extra registers, that are not saved | ||
14 | * automatically by SAVE_SWITCH_STACK in resume(), ie. d0-d5 and | ||
15 | * a0-a1. Some of these are used by schedule() and its predecessors | ||
16 | * and so we might get see unexpected behaviors when a task returns | ||
17 | * with unexpected register values. | ||
18 | * | ||
19 | * syscall stores these registers itself and none of them are used | ||
20 | * by syscall after the function in the syscall has been called. | ||
21 | * | ||
22 | * Beware that resume now expects *next to be in d1 and the offset of | ||
23 | * tss to be in a1. This saves a few instructions as we no longer have | ||
24 | * to push them onto the stack and read them back right after. | ||
25 | * | ||
26 | * 02/17/96 - Jes Sorensen (jds@kom.auc.dk) | ||
27 | * | ||
28 | * Changed 96/09/19 by Andreas Schwab | ||
29 | * pass prev in a0, next in a1, offset of tss in d1, and whether | ||
30 | * the mm structures are shared in d2 (to avoid atc flushing). | ||
31 | * | ||
32 | * H8/300 Porting 2002/09/04 Yoshinori Sato | ||
33 | */ | ||
34 | |||
35 | asmlinkage void resume(void); | ||
36 | #define switch_to(prev,next,last) { \ | ||
37 | void *_last; \ | ||
38 | __asm__ __volatile__( \ | ||
39 | "mov.l %1, er0\n\t" \ | ||
40 | "mov.l %2, er1\n\t" \ | ||
41 | "mov.l %3, er2\n\t" \ | ||
42 | "jsr @_resume\n\t" \ | ||
43 | "mov.l er2,%0\n\t" \ | ||
44 | : "=r" (_last) \ | ||
45 | : "r" (&(prev->thread)), \ | ||
46 | "r" (&(next->thread)), \ | ||
47 | "g" (prev) \ | ||
48 | : "cc", "er0", "er1", "er2", "er3"); \ | ||
49 | (last) = _last; \ | ||
50 | } | ||
51 | |||
52 | #define __sti() asm volatile ("andc #0x7f,ccr") | ||
53 | #define __cli() asm volatile ("orc #0x80,ccr") | ||
54 | |||
55 | #define __save_flags(x) \ | ||
56 | asm volatile ("stc ccr,%w0":"=r" (x)) | ||
57 | |||
58 | #define __restore_flags(x) \ | ||
59 | asm volatile ("ldc %w0,ccr": :"r" (x)) | ||
60 | |||
61 | #define irqs_disabled() \ | ||
62 | ({ \ | ||
63 | unsigned char flags; \ | ||
64 | __save_flags(flags); \ | ||
65 | ((flags & 0x80) == 0x80); \ | ||
66 | }) | ||
67 | |||
68 | #define iret() __asm__ __volatile__ ("rte": : :"memory", "sp", "cc") | ||
69 | |||
70 | /* For spinlocks etc */ | ||
71 | #define local_irq_disable() __cli() | ||
72 | #define local_irq_enable() __sti() | ||
73 | #define local_irq_save(x) ({ __save_flags(x); local_irq_disable(); }) | ||
74 | #define local_irq_restore(x) __restore_flags(x) | ||
75 | #define local_save_flags(x) __save_flags(x) | ||
76 | |||
77 | /* | ||
78 | * Force strict CPU ordering. | ||
79 | * Not really required on H8... | ||
80 | */ | ||
81 | #define nop() asm volatile ("nop"::) | ||
82 | #define mb() asm volatile ("" : : :"memory") | ||
83 | #define rmb() asm volatile ("" : : :"memory") | ||
84 | #define wmb() asm volatile ("" : : :"memory") | ||
85 | #define set_mb(var, value) do { xchg(&var, value); } while (0) | ||
86 | |||
87 | #ifdef CONFIG_SMP | ||
88 | #define smp_mb() mb() | ||
89 | #define smp_rmb() rmb() | ||
90 | #define smp_wmb() wmb() | ||
91 | #define smp_read_barrier_depends() read_barrier_depends() | ||
92 | #else | ||
93 | #define smp_mb() barrier() | ||
94 | #define smp_rmb() barrier() | ||
95 | #define smp_wmb() barrier() | ||
96 | #define smp_read_barrier_depends() do { } while(0) | ||
97 | #endif | ||
98 | |||
99 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
100 | |||
101 | struct __xchg_dummy { unsigned long a[100]; }; | ||
102 | #define __xg(x) ((volatile struct __xchg_dummy *)(x)) | ||
103 | |||
104 | static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | ||
105 | { | ||
106 | unsigned long tmp, flags; | ||
107 | |||
108 | local_irq_save(flags); | ||
109 | |||
110 | switch (size) { | ||
111 | case 1: | ||
112 | __asm__ __volatile__ | ||
113 | ("mov.b %2,%0\n\t" | ||
114 | "mov.b %1,%2" | ||
115 | : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory"); | ||
116 | break; | ||
117 | case 2: | ||
118 | __asm__ __volatile__ | ||
119 | ("mov.w %2,%0\n\t" | ||
120 | "mov.w %1,%2" | ||
121 | : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory"); | ||
122 | break; | ||
123 | case 4: | ||
124 | __asm__ __volatile__ | ||
125 | ("mov.l %2,%0\n\t" | ||
126 | "mov.l %1,%2" | ||
127 | : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory"); | ||
128 | break; | ||
129 | default: | ||
130 | tmp = 0; | ||
131 | } | ||
132 | local_irq_restore(flags); | ||
133 | return tmp; | ||
134 | } | ||
135 | |||
136 | #define HARD_RESET_NOW() ({ \ | ||
137 | local_irq_disable(); \ | ||
138 | asm("jmp @@0"); \ | ||
139 | }) | ||
140 | |||
141 | #include <asm-generic/cmpxchg-local.h> | ||
142 | |||
143 | /* | ||
144 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
145 | * them available. | ||
146 | */ | ||
147 | #define cmpxchg_local(ptr, o, n) \ | ||
148 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | ||
149 | (unsigned long)(n), sizeof(*(ptr)))) | ||
150 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
151 | |||
152 | #ifndef CONFIG_SMP | ||
153 | #include <asm-generic/cmpxchg.h> | ||
154 | #endif | ||
155 | |||
156 | #define arch_align_stack(x) (x) | ||
157 | |||
158 | #endif /* _H8300_SYSTEM_H */ | ||
diff --git a/arch/h8300/include/asm/target_time.h b/arch/h8300/include/asm/target_time.h new file mode 100644 index 000000000000..9f2a9aa1fe6f --- /dev/null +++ b/arch/h8300/include/asm/target_time.h | |||
@@ -0,0 +1,4 @@ | |||
1 | extern int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *)); | ||
2 | extern void platform_timer_eoi(void); | ||
3 | extern void platform_gettod(unsigned int *year, unsigned int *mon, unsigned int *day, | ||
4 | unsigned int *hour, unsigned int *min, unsigned int *sec); | ||
diff --git a/arch/h8300/include/asm/termbits.h b/arch/h8300/include/asm/termbits.h new file mode 100644 index 000000000000..31eca81db3f7 --- /dev/null +++ b/arch/h8300/include/asm/termbits.h | |||
@@ -0,0 +1,200 @@ | |||
1 | #ifndef __ARCH_H8300_TERMBITS_H__ | ||
2 | #define __ARCH_H8300_TERMBITS_H__ | ||
3 | |||
4 | #include <linux/posix_types.h> | ||
5 | |||
6 | typedef unsigned char cc_t; | ||
7 | typedef unsigned int speed_t; | ||
8 | typedef unsigned int tcflag_t; | ||
9 | |||
10 | #define NCCS 19 | ||
11 | struct termios { | ||
12 | tcflag_t c_iflag; /* input mode flags */ | ||
13 | tcflag_t c_oflag; /* output mode flags */ | ||
14 | tcflag_t c_cflag; /* control mode flags */ | ||
15 | tcflag_t c_lflag; /* local mode flags */ | ||
16 | cc_t c_line; /* line discipline */ | ||
17 | cc_t c_cc[NCCS]; /* control characters */ | ||
18 | }; | ||
19 | |||
20 | struct termios2 { | ||
21 | tcflag_t c_iflag; /* input mode flags */ | ||
22 | tcflag_t c_oflag; /* output mode flags */ | ||
23 | tcflag_t c_cflag; /* control mode flags */ | ||
24 | tcflag_t c_lflag; /* local mode flags */ | ||
25 | cc_t c_line; /* line discipline */ | ||
26 | cc_t c_cc[NCCS]; /* control characters */ | ||
27 | speed_t c_ispeed; /* input speed */ | ||
28 | speed_t c_ospeed; /* output speed */ | ||
29 | }; | ||
30 | |||
31 | struct ktermios { | ||
32 | tcflag_t c_iflag; /* input mode flags */ | ||
33 | tcflag_t c_oflag; /* output mode flags */ | ||
34 | tcflag_t c_cflag; /* control mode flags */ | ||
35 | tcflag_t c_lflag; /* local mode flags */ | ||
36 | cc_t c_line; /* line discipline */ | ||
37 | cc_t c_cc[NCCS]; /* control characters */ | ||
38 | speed_t c_ispeed; /* input speed */ | ||
39 | speed_t c_ospeed; /* output speed */ | ||
40 | }; | ||
41 | |||
42 | /* c_cc characters */ | ||
43 | #define VINTR 0 | ||
44 | #define VQUIT 1 | ||
45 | #define VERASE 2 | ||
46 | #define VKILL 3 | ||
47 | #define VEOF 4 | ||
48 | #define VTIME 5 | ||
49 | #define VMIN 6 | ||
50 | #define VSWTC 7 | ||
51 | #define VSTART 8 | ||
52 | #define VSTOP 9 | ||
53 | #define VSUSP 10 | ||
54 | #define VEOL 11 | ||
55 | #define VREPRINT 12 | ||
56 | #define VDISCARD 13 | ||
57 | #define VWERASE 14 | ||
58 | #define VLNEXT 15 | ||
59 | #define VEOL2 16 | ||
60 | |||
61 | |||
62 | /* c_iflag bits */ | ||
63 | #define IGNBRK 0000001 | ||
64 | #define BRKINT 0000002 | ||
65 | #define IGNPAR 0000004 | ||
66 | #define PARMRK 0000010 | ||
67 | #define INPCK 0000020 | ||
68 | #define ISTRIP 0000040 | ||
69 | #define INLCR 0000100 | ||
70 | #define IGNCR 0000200 | ||
71 | #define ICRNL 0000400 | ||
72 | #define IUCLC 0001000 | ||
73 | #define IXON 0002000 | ||
74 | #define IXANY 0004000 | ||
75 | #define IXOFF 0010000 | ||
76 | #define IMAXBEL 0020000 | ||
77 | #define IUTF8 0040000 | ||
78 | |||
79 | /* c_oflag bits */ | ||
80 | #define OPOST 0000001 | ||
81 | #define OLCUC 0000002 | ||
82 | #define ONLCR 0000004 | ||
83 | #define OCRNL 0000010 | ||
84 | #define ONOCR 0000020 | ||
85 | #define ONLRET 0000040 | ||
86 | #define OFILL 0000100 | ||
87 | #define OFDEL 0000200 | ||
88 | #define NLDLY 0000400 | ||
89 | #define NL0 0000000 | ||
90 | #define NL1 0000400 | ||
91 | #define CRDLY 0003000 | ||
92 | #define CR0 0000000 | ||
93 | #define CR1 0001000 | ||
94 | #define CR2 0002000 | ||
95 | #define CR3 0003000 | ||
96 | #define TABDLY 0014000 | ||
97 | #define TAB0 0000000 | ||
98 | #define TAB1 0004000 | ||
99 | #define TAB2 0010000 | ||
100 | #define TAB3 0014000 | ||
101 | #define XTABS 0014000 | ||
102 | #define BSDLY 0020000 | ||
103 | #define BS0 0000000 | ||
104 | #define BS1 0020000 | ||
105 | #define VTDLY 0040000 | ||
106 | #define VT0 0000000 | ||
107 | #define VT1 0040000 | ||
108 | #define FFDLY 0100000 | ||
109 | #define FF0 0000000 | ||
110 | #define FF1 0100000 | ||
111 | |||
112 | /* c_cflag bit meaning */ | ||
113 | #define CBAUD 0010017 | ||
114 | #define B0 0000000 /* hang up */ | ||
115 | #define B50 0000001 | ||
116 | #define B75 0000002 | ||
117 | #define B110 0000003 | ||
118 | #define B134 0000004 | ||
119 | #define B150 0000005 | ||
120 | #define B200 0000006 | ||
121 | #define B300 0000007 | ||
122 | #define B600 0000010 | ||
123 | #define B1200 0000011 | ||
124 | #define B1800 0000012 | ||
125 | #define B2400 0000013 | ||
126 | #define B4800 0000014 | ||
127 | #define B9600 0000015 | ||
128 | #define B19200 0000016 | ||
129 | #define B38400 0000017 | ||
130 | #define EXTA B19200 | ||
131 | #define EXTB B38400 | ||
132 | #define CSIZE 0000060 | ||
133 | #define CS5 0000000 | ||
134 | #define CS6 0000020 | ||
135 | #define CS7 0000040 | ||
136 | #define CS8 0000060 | ||
137 | #define CSTOPB 0000100 | ||
138 | #define CREAD 0000200 | ||
139 | #define PARENB 0000400 | ||
140 | #define PARODD 0001000 | ||
141 | #define HUPCL 0002000 | ||
142 | #define CLOCAL 0004000 | ||
143 | #define CBAUDEX 0010000 | ||
144 | #define BOTHER 0010000 | ||
145 | #define B57600 0010001 | ||
146 | #define B115200 0010002 | ||
147 | #define B230400 0010003 | ||
148 | #define B460800 0010004 | ||
149 | #define B500000 0010005 | ||
150 | #define B576000 0010006 | ||
151 | #define B921600 0010007 | ||
152 | #define B1000000 0010010 | ||
153 | #define B1152000 0010011 | ||
154 | #define B1500000 0010012 | ||
155 | #define B2000000 0010013 | ||
156 | #define B2500000 0010014 | ||
157 | #define B3000000 0010015 | ||
158 | #define B3500000 0010016 | ||
159 | #define B4000000 0010017 | ||
160 | #define CIBAUD 002003600000 /* input baud rate */ | ||
161 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
162 | #define CRTSCTS 020000000000 /* flow control */ | ||
163 | |||
164 | #define IBSHIFT 16 /* shift from CBAUD to CIBAUD */ | ||
165 | |||
166 | /* c_lflag bits */ | ||
167 | #define ISIG 0000001 | ||
168 | #define ICANON 0000002 | ||
169 | #define XCASE 0000004 | ||
170 | #define ECHO 0000010 | ||
171 | #define ECHOE 0000020 | ||
172 | #define ECHOK 0000040 | ||
173 | #define ECHONL 0000100 | ||
174 | #define NOFLSH 0000200 | ||
175 | #define TOSTOP 0000400 | ||
176 | #define ECHOCTL 0001000 | ||
177 | #define ECHOPRT 0002000 | ||
178 | #define ECHOKE 0004000 | ||
179 | #define FLUSHO 0010000 | ||
180 | #define PENDIN 0040000 | ||
181 | #define IEXTEN 0100000 | ||
182 | |||
183 | |||
184 | /* tcflow() and TCXONC use these */ | ||
185 | #define TCOOFF 0 | ||
186 | #define TCOON 1 | ||
187 | #define TCIOFF 2 | ||
188 | #define TCION 3 | ||
189 | |||
190 | /* tcflush() and TCFLSH use these */ | ||
191 | #define TCIFLUSH 0 | ||
192 | #define TCOFLUSH 1 | ||
193 | #define TCIOFLUSH 2 | ||
194 | |||
195 | /* tcsetattr uses these */ | ||
196 | #define TCSANOW 0 | ||
197 | #define TCSADRAIN 1 | ||
198 | #define TCSAFLUSH 2 | ||
199 | |||
200 | #endif /* __ARCH_H8300_TERMBITS_H__ */ | ||
diff --git a/arch/h8300/include/asm/termios.h b/arch/h8300/include/asm/termios.h new file mode 100644 index 000000000000..70eea64b4213 --- /dev/null +++ b/arch/h8300/include/asm/termios.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifndef _H8300_TERMIOS_H | ||
2 | #define _H8300_TERMIOS_H | ||
3 | |||
4 | #include <asm/termbits.h> | ||
5 | #include <asm/ioctls.h> | ||
6 | |||
7 | struct winsize { | ||
8 | unsigned short ws_row; | ||
9 | unsigned short ws_col; | ||
10 | unsigned short ws_xpixel; | ||
11 | unsigned short ws_ypixel; | ||
12 | }; | ||
13 | |||
14 | #define NCC 8 | ||
15 | struct termio { | ||
16 | unsigned short c_iflag; /* input mode flags */ | ||
17 | unsigned short c_oflag; /* output mode flags */ | ||
18 | unsigned short c_cflag; /* control mode flags */ | ||
19 | unsigned short c_lflag; /* local mode flags */ | ||
20 | unsigned char c_line; /* line discipline */ | ||
21 | unsigned char c_cc[NCC]; /* control characters */ | ||
22 | }; | ||
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | /* intr=^C quit=^| erase=del kill=^U | ||
26 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | ||
27 | start=^Q stop=^S susp=^Z eol=\0 | ||
28 | reprint=^R discard=^U werase=^W lnext=^V | ||
29 | eol2=\0 | ||
30 | */ | ||
31 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | ||
32 | #endif | ||
33 | |||
34 | /* modem lines */ | ||
35 | #define TIOCM_LE 0x001 | ||
36 | #define TIOCM_DTR 0x002 | ||
37 | #define TIOCM_RTS 0x004 | ||
38 | #define TIOCM_ST 0x008 | ||
39 | #define TIOCM_SR 0x010 | ||
40 | #define TIOCM_CTS 0x020 | ||
41 | #define TIOCM_CAR 0x040 | ||
42 | #define TIOCM_RNG 0x080 | ||
43 | #define TIOCM_DSR 0x100 | ||
44 | #define TIOCM_CD TIOCM_CAR | ||
45 | #define TIOCM_RI TIOCM_RNG | ||
46 | #define TIOCM_OUT1 0x2000 | ||
47 | #define TIOCM_OUT2 0x4000 | ||
48 | #define TIOCM_LOOP 0x8000 | ||
49 | |||
50 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
51 | |||
52 | #ifdef __KERNEL__ | ||
53 | |||
54 | /* | ||
55 | * Translate a "termio" structure into a "termios". Ugh. | ||
56 | */ | ||
57 | #define user_termio_to_kernel_termios(termios, termio) \ | ||
58 | ({ \ | ||
59 | unsigned short tmp; \ | ||
60 | get_user(tmp, &(termio)->c_iflag); \ | ||
61 | (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ | ||
62 | get_user(tmp, &(termio)->c_oflag); \ | ||
63 | (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ | ||
64 | get_user(tmp, &(termio)->c_cflag); \ | ||
65 | (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ | ||
66 | get_user(tmp, &(termio)->c_lflag); \ | ||
67 | (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ | ||
68 | get_user((termios)->c_line, &(termio)->c_line); \ | ||
69 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | ||
70 | }) | ||
71 | |||
72 | /* | ||
73 | * Translate a "termios" structure into a "termio". Ugh. | ||
74 | */ | ||
75 | #define kernel_termios_to_user_termio(termio, termios) \ | ||
76 | ({ \ | ||
77 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | ||
78 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | ||
79 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | ||
80 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | ||
81 | put_user((termios)->c_line, &(termio)->c_line); \ | ||
82 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
83 | }) | ||
84 | |||
85 | #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2)) | ||
86 | #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2)) | ||
87 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) | ||
88 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) | ||
89 | |||
90 | #endif /* __KERNEL__ */ | ||
91 | |||
92 | #endif /* _H8300_TERMIOS_H */ | ||
diff --git a/arch/h8300/include/asm/thread_info.h b/arch/h8300/include/asm/thread_info.h new file mode 100644 index 000000000000..aafd4d322ec3 --- /dev/null +++ b/arch/h8300/include/asm/thread_info.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* thread_info.h: h8300 low-level thread information | ||
2 | * adapted from the i386 and PPC versions by Yoshinori Sato <ysato@users.sourceforge.jp> | ||
3 | * | ||
4 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) | ||
5 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller | ||
6 | */ | ||
7 | |||
8 | #ifndef _ASM_THREAD_INFO_H | ||
9 | #define _ASM_THREAD_INFO_H | ||
10 | |||
11 | #include <asm/page.h> | ||
12 | |||
13 | #ifdef __KERNEL__ | ||
14 | |||
15 | #ifndef __ASSEMBLY__ | ||
16 | |||
17 | /* | ||
18 | * low level task data. | ||
19 | * If you change this, change the TI_* offsets below to match. | ||
20 | */ | ||
21 | struct thread_info { | ||
22 | struct task_struct *task; /* main task structure */ | ||
23 | struct exec_domain *exec_domain; /* execution domain */ | ||
24 | unsigned long flags; /* low level flags */ | ||
25 | int cpu; /* cpu we're on */ | ||
26 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | ||
27 | struct restart_block restart_block; | ||
28 | }; | ||
29 | |||
30 | /* | ||
31 | * macros/functions for gaining access to the thread information structure | ||
32 | */ | ||
33 | #define INIT_THREAD_INFO(tsk) \ | ||
34 | { \ | ||
35 | .task = &tsk, \ | ||
36 | .exec_domain = &default_exec_domain, \ | ||
37 | .flags = 0, \ | ||
38 | .cpu = 0, \ | ||
39 | .preempt_count = 1, \ | ||
40 | .restart_block = { \ | ||
41 | .fn = do_no_restart_syscall, \ | ||
42 | }, \ | ||
43 | } | ||
44 | |||
45 | #define init_thread_info (init_thread_union.thread_info) | ||
46 | #define init_stack (init_thread_union.stack) | ||
47 | |||
48 | |||
49 | /* | ||
50 | * Size of kernel stack for each process. This must be a power of 2... | ||
51 | */ | ||
52 | #define THREAD_SIZE_ORDER 1 | ||
53 | #define THREAD_SIZE 8192 /* 2 pages */ | ||
54 | |||
55 | |||
56 | /* how to get the thread information struct from C */ | ||
57 | static inline struct thread_info *current_thread_info(void) | ||
58 | { | ||
59 | struct thread_info *ti; | ||
60 | __asm__( | ||
61 | "mov.l sp, %0 \n\t" | ||
62 | "and.l %1, %0" | ||
63 | : "=&r"(ti) | ||
64 | : "i" (~(THREAD_SIZE-1)) | ||
65 | ); | ||
66 | return ti; | ||
67 | } | ||
68 | |||
69 | #endif /* __ASSEMBLY__ */ | ||
70 | |||
71 | /* | ||
72 | * Offsets in thread_info structure, used in assembly code | ||
73 | */ | ||
74 | #define TI_TASK 0 | ||
75 | #define TI_EXECDOMAIN 4 | ||
76 | #define TI_FLAGS 8 | ||
77 | #define TI_CPU 12 | ||
78 | #define TI_PRE_COUNT 16 | ||
79 | |||
80 | #define PREEMPT_ACTIVE 0x4000000 | ||
81 | |||
82 | /* | ||
83 | * thread information flag bit numbers | ||
84 | */ | ||
85 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
86 | #define TIF_SIGPENDING 1 /* signal pending */ | ||
87 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | ||
88 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
89 | TIF_NEED_RESCHED */ | ||
90 | #define TIF_MEMDIE 4 | ||
91 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ | ||
92 | |||
93 | /* as above, but as bit values */ | ||
94 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
95 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
96 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
97 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
98 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
99 | |||
100 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | ||
101 | |||
102 | #endif /* __KERNEL__ */ | ||
103 | |||
104 | #endif /* _ASM_THREAD_INFO_H */ | ||
diff --git a/arch/h8300/include/asm/timex.h b/arch/h8300/include/asm/timex.h new file mode 100644 index 000000000000..23e67013439f --- /dev/null +++ b/arch/h8300/include/asm/timex.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * linux/include/asm-h8300/timex.h | ||
3 | * | ||
4 | * H8/300 architecture timex specifications | ||
5 | */ | ||
6 | #ifndef _ASM_H8300_TIMEX_H | ||
7 | #define _ASM_H8300_TIMEX_H | ||
8 | |||
9 | #define CLOCK_TICK_RATE (CONFIG_CPU_CLOCK*1000/8192) /* Timer input freq. */ | ||
10 | |||
11 | typedef unsigned long cycles_t; | ||
12 | extern short h8300_timer_count; | ||
13 | |||
14 | static inline cycles_t get_cycles(void) | ||
15 | { | ||
16 | return 0; | ||
17 | } | ||
18 | |||
19 | #endif | ||
diff --git a/arch/h8300/include/asm/tlb.h b/arch/h8300/include/asm/tlb.h new file mode 100644 index 000000000000..3dea80ad9e6f --- /dev/null +++ b/arch/h8300/include/asm/tlb.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | include/asm-h8300/tlb.h | ||
3 | */ | ||
4 | |||
5 | #ifndef __H8300_TLB_H__ | ||
6 | #define __H8300_TLB_H__ | ||
7 | |||
8 | #define tlb_flush(tlb) do { } while(0) | ||
9 | |||
10 | /* | ||
11 | include/asm-h8300/tlb.h | ||
12 | */ | ||
13 | |||
14 | #ifndef __H8300_TLB_H__ | ||
15 | #define __H8300_TLB_H__ | ||
16 | |||
17 | #define tlb_flush(tlb) do { } while(0) | ||
18 | |||
19 | #include <asm-generic/tlb.h> | ||
20 | |||
21 | #endif | ||
22 | |||
23 | #endif | ||
diff --git a/arch/h8300/include/asm/tlbflush.h b/arch/h8300/include/asm/tlbflush.h new file mode 100644 index 000000000000..41c148a9208e --- /dev/null +++ b/arch/h8300/include/asm/tlbflush.h | |||
@@ -0,0 +1,55 @@ | |||
1 | #ifndef _H8300_TLBFLUSH_H | ||
2 | #define _H8300_TLBFLUSH_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2000 Lineo, David McCullough <davidm@uclinux.org> | ||
6 | * Copyright (C) 2000-2002, Greg Ungerer <gerg@snapgear.com> | ||
7 | */ | ||
8 | |||
9 | #include <asm/setup.h> | ||
10 | |||
11 | /* | ||
12 | * flush all user-space atc entries. | ||
13 | */ | ||
14 | static inline void __flush_tlb(void) | ||
15 | { | ||
16 | BUG(); | ||
17 | } | ||
18 | |||
19 | static inline void __flush_tlb_one(unsigned long addr) | ||
20 | { | ||
21 | BUG(); | ||
22 | } | ||
23 | |||
24 | #define flush_tlb() __flush_tlb() | ||
25 | |||
26 | /* | ||
27 | * flush all atc entries (both kernel and user-space entries). | ||
28 | */ | ||
29 | static inline void flush_tlb_all(void) | ||
30 | { | ||
31 | BUG(); | ||
32 | } | ||
33 | |||
34 | static inline void flush_tlb_mm(struct mm_struct *mm) | ||
35 | { | ||
36 | BUG(); | ||
37 | } | ||
38 | |||
39 | static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) | ||
40 | { | ||
41 | BUG(); | ||
42 | } | ||
43 | |||
44 | static inline void flush_tlb_range(struct mm_struct *mm, | ||
45 | unsigned long start, unsigned long end) | ||
46 | { | ||
47 | BUG(); | ||
48 | } | ||
49 | |||
50 | static inline void flush_tlb_kernel_page(unsigned long addr) | ||
51 | { | ||
52 | BUG(); | ||
53 | } | ||
54 | |||
55 | #endif /* _H8300_TLBFLUSH_H */ | ||
diff --git a/arch/h8300/include/asm/topology.h b/arch/h8300/include/asm/topology.h new file mode 100644 index 000000000000..fdc121924d4c --- /dev/null +++ b/arch/h8300/include/asm/topology.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_H8300_TOPOLOGY_H | ||
2 | #define _ASM_H8300_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif /* _ASM_H8300_TOPOLOGY_H */ | ||
diff --git a/arch/h8300/include/asm/traps.h b/arch/h8300/include/asm/traps.h new file mode 100644 index 000000000000..41cf6be02f68 --- /dev/null +++ b/arch/h8300/include/asm/traps.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * linux/include/asm-h8300/traps.h | ||
3 | * | ||
4 | * Copyright (C) 2003 Yoshinori Sato <ysato@users.sourceforge.jp> | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef _H8300_TRAPS_H | ||
12 | #define _H8300_TRAPS_H | ||
13 | |||
14 | extern void system_call(void); | ||
15 | extern void interrupt_entry(void); | ||
16 | extern void trace_break(void); | ||
17 | |||
18 | #define JMP_OP 0x5a000000 | ||
19 | #define JSR_OP 0x5e000000 | ||
20 | #define VECTOR(address) ((JMP_OP)|((unsigned long)address)) | ||
21 | #define REDIRECT(address) ((JSR_OP)|((unsigned long)address)) | ||
22 | |||
23 | #define TRACE_VEC 5 | ||
24 | |||
25 | #define TRAP0_VEC 8 | ||
26 | #define TRAP1_VEC 9 | ||
27 | #define TRAP2_VEC 10 | ||
28 | #define TRAP3_VEC 11 | ||
29 | |||
30 | #if defined(__H8300H__) | ||
31 | #define NR_TRAPS 12 | ||
32 | #endif | ||
33 | #if defined(__H8300S__) | ||
34 | #define NR_TRAPS 16 | ||
35 | #endif | ||
36 | |||
37 | #endif /* _H8300_TRAPS_H */ | ||
diff --git a/arch/h8300/include/asm/types.h b/arch/h8300/include/asm/types.h new file mode 100644 index 000000000000..12875190b156 --- /dev/null +++ b/arch/h8300/include/asm/types.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _H8300_TYPES_H | ||
2 | #define _H8300_TYPES_H | ||
3 | |||
4 | #include <asm-generic/int-ll64.h> | ||
5 | |||
6 | #if !defined(__ASSEMBLY__) | ||
7 | |||
8 | /* | ||
9 | * This file is never included by application software unless | ||
10 | * explicitly requested (e.g., via linux/types.h) in which case the | ||
11 | * application is Linux specific so (user-) name space pollution is | ||
12 | * not a major issue. However, for interoperability, libraries still | ||
13 | * need to be careful to avoid a name clashes. | ||
14 | */ | ||
15 | |||
16 | typedef unsigned short umode_t; | ||
17 | |||
18 | /* | ||
19 | * These aren't exported outside the kernel to avoid name space clashes | ||
20 | */ | ||
21 | #ifdef __KERNEL__ | ||
22 | |||
23 | #define BITS_PER_LONG 32 | ||
24 | |||
25 | /* Dma addresses are 32-bits wide. */ | ||
26 | |||
27 | typedef u32 dma_addr_t; | ||
28 | |||
29 | #endif /* __KERNEL__ */ | ||
30 | |||
31 | #endif /* __ASSEMBLY__ */ | ||
32 | |||
33 | #endif /* _H8300_TYPES_H */ | ||
diff --git a/arch/h8300/include/asm/uaccess.h b/arch/h8300/include/asm/uaccess.h new file mode 100644 index 000000000000..356068cd0879 --- /dev/null +++ b/arch/h8300/include/asm/uaccess.h | |||
@@ -0,0 +1,162 @@ | |||
1 | #ifndef __H8300_UACCESS_H | ||
2 | #define __H8300_UACCESS_H | ||
3 | |||
4 | /* | ||
5 | * User space memory access functions | ||
6 | */ | ||
7 | #include <linux/sched.h> | ||
8 | #include <linux/mm.h> | ||
9 | #include <linux/string.h> | ||
10 | |||
11 | #include <asm/segment.h> | ||
12 | |||
13 | #define VERIFY_READ 0 | ||
14 | #define VERIFY_WRITE 1 | ||
15 | |||
16 | /* We let the MMU do all checking */ | ||
17 | #define access_ok(type, addr, size) __access_ok((unsigned long)addr,size) | ||
18 | static inline int __access_ok(unsigned long addr, unsigned long size) | ||
19 | { | ||
20 | #define RANGE_CHECK_OK(addr, size, lower, upper) \ | ||
21 | (((addr) >= (lower)) && (((addr) + (size)) < (upper))) | ||
22 | |||
23 | extern unsigned long _ramend; | ||
24 | return(RANGE_CHECK_OK(addr, size, 0L, (unsigned long)&_ramend)); | ||
25 | } | ||
26 | |||
27 | /* | ||
28 | * The exception table consists of pairs of addresses: the first is the | ||
29 | * address of an instruction that is allowed to fault, and the second is | ||
30 | * the address at which the program should continue. No registers are | ||
31 | * modified, so it is entirely up to the continuation code to figure out | ||
32 | * what to do. | ||
33 | * | ||
34 | * All the routines below use bits of fixup code that are out of line | ||
35 | * with the main instruction path. This means when everything is well, | ||
36 | * we don't even have to jump over them. Further, they do not intrude | ||
37 | * on our cache or tlb entries. | ||
38 | */ | ||
39 | |||
40 | struct exception_table_entry | ||
41 | { | ||
42 | unsigned long insn, fixup; | ||
43 | }; | ||
44 | |||
45 | /* Returns 0 if exception not found and fixup otherwise. */ | ||
46 | extern unsigned long search_exception_table(unsigned long); | ||
47 | |||
48 | |||
49 | /* | ||
50 | * These are the main single-value transfer routines. They automatically | ||
51 | * use the right size if we just have the right pointer type. | ||
52 | */ | ||
53 | |||
54 | #define put_user(x, ptr) \ | ||
55 | ({ \ | ||
56 | int __pu_err = 0; \ | ||
57 | typeof(*(ptr)) __pu_val = (x); \ | ||
58 | switch (sizeof (*(ptr))) { \ | ||
59 | case 1: \ | ||
60 | case 2: \ | ||
61 | case 4: \ | ||
62 | *(ptr) = (__pu_val); \ | ||
63 | break; \ | ||
64 | case 8: \ | ||
65 | memcpy(ptr, &__pu_val, sizeof (*(ptr))); \ | ||
66 | break; \ | ||
67 | default: \ | ||
68 | __pu_err = __put_user_bad(); \ | ||
69 | break; \ | ||
70 | } \ | ||
71 | __pu_err; \ | ||
72 | }) | ||
73 | #define __put_user(x, ptr) put_user(x, ptr) | ||
74 | |||
75 | extern int __put_user_bad(void); | ||
76 | |||
77 | /* | ||
78 | * Tell gcc we read from memory instead of writing: this is because | ||
79 | * we do not write to any memory gcc knows about, so there are no | ||
80 | * aliasing issues. | ||
81 | */ | ||
82 | |||
83 | #define __ptr(x) ((unsigned long *)(x)) | ||
84 | |||
85 | /* | ||
86 | * Tell gcc we read from memory instead of writing: this is because | ||
87 | * we do not write to any memory gcc knows about, so there are no | ||
88 | * aliasing issues. | ||
89 | */ | ||
90 | |||
91 | #define get_user(x, ptr) \ | ||
92 | ({ \ | ||
93 | int __gu_err = 0; \ | ||
94 | typeof(*(ptr)) __gu_val = *ptr; \ | ||
95 | switch (sizeof(*(ptr))) { \ | ||
96 | case 1: \ | ||
97 | case 2: \ | ||
98 | case 4: \ | ||
99 | case 8: \ | ||
100 | break; \ | ||
101 | default: \ | ||
102 | __gu_err = __get_user_bad(); \ | ||
103 | __gu_val = 0; \ | ||
104 | break; \ | ||
105 | } \ | ||
106 | (x) = __gu_val; \ | ||
107 | __gu_err; \ | ||
108 | }) | ||
109 | #define __get_user(x, ptr) get_user(x, ptr) | ||
110 | |||
111 | extern int __get_user_bad(void); | ||
112 | |||
113 | #define copy_from_user(to, from, n) (memcpy(to, from, n), 0) | ||
114 | #define copy_to_user(to, from, n) (memcpy(to, from, n), 0) | ||
115 | |||
116 | #define __copy_from_user(to, from, n) copy_from_user(to, from, n) | ||
117 | #define __copy_to_user(to, from, n) copy_to_user(to, from, n) | ||
118 | #define __copy_to_user_inatomic __copy_to_user | ||
119 | #define __copy_from_user_inatomic __copy_from_user | ||
120 | |||
121 | #define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) | ||
122 | |||
123 | #define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; }) | ||
124 | |||
125 | /* | ||
126 | * Copy a null terminated string from userspace. | ||
127 | */ | ||
128 | |||
129 | static inline long | ||
130 | strncpy_from_user(char *dst, const char *src, long count) | ||
131 | { | ||
132 | char *tmp; | ||
133 | strncpy(dst, src, count); | ||
134 | for (tmp = dst; *tmp && count > 0; tmp++, count--) | ||
135 | ; | ||
136 | return(tmp - dst); /* DAVIDM should we count a NUL ? check getname */ | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * Return the size of a string (including the ending 0) | ||
141 | * | ||
142 | * Return 0 on exception, a value greater than N if too long | ||
143 | */ | ||
144 | static inline long strnlen_user(const char *src, long n) | ||
145 | { | ||
146 | return(strlen(src) + 1); /* DAVIDM make safer */ | ||
147 | } | ||
148 | |||
149 | #define strlen_user(str) strnlen_user(str, 32767) | ||
150 | |||
151 | /* | ||
152 | * Zero Userspace | ||
153 | */ | ||
154 | |||
155 | static inline unsigned long | ||
156 | clear_user(void *to, unsigned long n) | ||
157 | { | ||
158 | memset(to, 0, n); | ||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | #endif /* _H8300_UACCESS_H */ | ||
diff --git a/arch/h8300/include/asm/ucontext.h b/arch/h8300/include/asm/ucontext.h new file mode 100644 index 000000000000..0bcf8f85fab9 --- /dev/null +++ b/arch/h8300/include/asm/ucontext.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _H8300_UCONTEXT_H | ||
2 | #define _H8300_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 | ||
diff --git a/arch/h8300/include/asm/unaligned.h b/arch/h8300/include/asm/unaligned.h new file mode 100644 index 000000000000..b8d06c70c2da --- /dev/null +++ b/arch/h8300/include/asm/unaligned.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _ASM_H8300_UNALIGNED_H | ||
2 | #define _ASM_H8300_UNALIGNED_H | ||
3 | |||
4 | #include <linux/unaligned/be_memmove.h> | ||
5 | #include <linux/unaligned/le_byteshift.h> | ||
6 | #include <linux/unaligned/generic.h> | ||
7 | |||
8 | #define get_unaligned __get_unaligned_be | ||
9 | #define put_unaligned __put_unaligned_be | ||
10 | |||
11 | #endif /* _ASM_H8300_UNALIGNED_H */ | ||
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h new file mode 100644 index 000000000000..99f3c3561ecb --- /dev/null +++ b/arch/h8300/include/asm/unistd.h | |||
@@ -0,0 +1,364 @@ | |||
1 | #ifndef _ASM_H8300_UNISTD_H_ | ||
2 | #define _ASM_H8300_UNISTD_H_ | ||
3 | |||
4 | /* | ||
5 | * This file contains the system call numbers. | ||
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_vm86old 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 | #define __NR_vm86 166 | ||
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 | ||
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_madvise1 219 | ||
229 | #define __NR_getdents64 220 | ||
230 | #define __NR_fcntl64 221 | ||
231 | /* 223 is unused */ | ||
232 | #define __NR_gettid 224 | ||
233 | #define __NR_readahead 225 | ||
234 | #define __NR_setxattr 226 | ||
235 | #define __NR_lsetxattr 227 | ||
236 | #define __NR_fsetxattr 228 | ||
237 | #define __NR_getxattr 229 | ||
238 | #define __NR_lgetxattr 230 | ||
239 | #define __NR_fgetxattr 231 | ||
240 | #define __NR_listxattr 232 | ||
241 | #define __NR_llistxattr 233 | ||
242 | #define __NR_flistxattr 234 | ||
243 | #define __NR_removexattr 235 | ||
244 | #define __NR_lremovexattr 236 | ||
245 | #define __NR_fremovexattr 237 | ||
246 | #define __NR_tkill 238 | ||
247 | #define __NR_sendfile64 239 | ||
248 | #define __NR_futex 240 | ||
249 | #define __NR_sched_setaffinity 241 | ||
250 | #define __NR_sched_getaffinity 242 | ||
251 | #define __NR_set_thread_area 243 | ||
252 | #define __NR_get_thread_area 244 | ||
253 | #define __NR_io_setup 245 | ||
254 | #define __NR_io_destroy 246 | ||
255 | #define __NR_io_getevents 247 | ||
256 | #define __NR_io_submit 248 | ||
257 | #define __NR_io_cancel 249 | ||
258 | #define __NR_fadvise64 250 | ||
259 | /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ | ||
260 | #define __NR_exit_group 252 | ||
261 | #define __NR_lookup_dcookie 253 | ||
262 | #define __NR_epoll_create 254 | ||
263 | #define __NR_epoll_ctl 255 | ||
264 | #define __NR_epoll_wait 256 | ||
265 | #define __NR_remap_file_pages 257 | ||
266 | #define __NR_set_tid_address 258 | ||
267 | #define __NR_timer_create 259 | ||
268 | #define __NR_timer_settime (__NR_timer_create+1) | ||
269 | #define __NR_timer_gettime (__NR_timer_create+2) | ||
270 | #define __NR_timer_getoverrun (__NR_timer_create+3) | ||
271 | #define __NR_timer_delete (__NR_timer_create+4) | ||
272 | #define __NR_clock_settime (__NR_timer_create+5) | ||
273 | #define __NR_clock_gettime (__NR_timer_create+6) | ||
274 | #define __NR_clock_getres (__NR_timer_create+7) | ||
275 | #define __NR_clock_nanosleep (__NR_timer_create+8) | ||
276 | #define __NR_statfs64 268 | ||
277 | #define __NR_fstatfs64 269 | ||
278 | #define __NR_tgkill 270 | ||
279 | #define __NR_utimes 271 | ||
280 | #define __NR_fadvise64_64 272 | ||
281 | #define __NR_vserver 273 | ||
282 | #define __NR_mbind 274 | ||
283 | #define __NR_get_mempolicy 275 | ||
284 | #define __NR_set_mempolicy 276 | ||
285 | #define __NR_mq_open 277 | ||
286 | #define __NR_mq_unlink (__NR_mq_open+1) | ||
287 | #define __NR_mq_timedsend (__NR_mq_open+2) | ||
288 | #define __NR_mq_timedreceive (__NR_mq_open+3) | ||
289 | #define __NR_mq_notify (__NR_mq_open+4) | ||
290 | #define __NR_mq_getsetattr (__NR_mq_open+5) | ||
291 | #define __NR_kexec_load 283 | ||
292 | #define __NR_waitid 284 | ||
293 | /* #define __NR_sys_setaltroot 285 */ | ||
294 | #define __NR_add_key 286 | ||
295 | #define __NR_request_key 287 | ||
296 | #define __NR_keyctl 288 | ||
297 | #define __NR_ioprio_set 289 | ||
298 | #define __NR_ioprio_get 290 | ||
299 | #define __NR_inotify_init 291 | ||
300 | #define __NR_inotify_add_watch 292 | ||
301 | #define __NR_inotify_rm_watch 293 | ||
302 | #define __NR_migrate_pages 294 | ||
303 | #define __NR_openat 295 | ||
304 | #define __NR_mkdirat 296 | ||
305 | #define __NR_mknodat 297 | ||
306 | #define __NR_fchownat 298 | ||
307 | #define __NR_futimesat 299 | ||
308 | #define __NR_fstatat64 300 | ||
309 | #define __NR_unlinkat 301 | ||
310 | #define __NR_renameat 302 | ||
311 | #define __NR_linkat 303 | ||
312 | #define __NR_symlinkat 304 | ||
313 | #define __NR_readlinkat 305 | ||
314 | #define __NR_fchmodat 306 | ||
315 | #define __NR_faccessat 307 | ||
316 | #define __NR_pselect6 308 | ||
317 | #define __NR_ppoll 309 | ||
318 | #define __NR_unshare 310 | ||
319 | #define __NR_set_robust_list 311 | ||
320 | #define __NR_get_robust_list 312 | ||
321 | #define __NR_splice 313 | ||
322 | #define __NR_sync_file_range 314 | ||
323 | #define __NR_tee 315 | ||
324 | #define __NR_vmsplice 316 | ||
325 | #define __NR_move_pages 317 | ||
326 | #define __NR_getcpu 318 | ||
327 | #define __NR_epoll_pwait 319 | ||
328 | |||
329 | #ifdef __KERNEL__ | ||
330 | |||
331 | #define NR_syscalls 320 | ||
332 | |||
333 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
334 | #define __ARCH_WANT_OLD_READDIR | ||
335 | #define __ARCH_WANT_OLD_STAT | ||
336 | #define __ARCH_WANT_STAT64 | ||
337 | #define __ARCH_WANT_SYS_ALARM | ||
338 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
339 | #define __ARCH_WANT_SYS_PAUSE | ||
340 | #define __ARCH_WANT_SYS_SGETMASK | ||
341 | #define __ARCH_WANT_SYS_SIGNAL | ||
342 | #define __ARCH_WANT_SYS_TIME | ||
343 | #define __ARCH_WANT_SYS_UTIME | ||
344 | #define __ARCH_WANT_SYS_WAITPID | ||
345 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
346 | #define __ARCH_WANT_SYS_FADVISE64 | ||
347 | #define __ARCH_WANT_SYS_GETPGRP | ||
348 | #define __ARCH_WANT_SYS_LLSEEK | ||
349 | #define __ARCH_WANT_SYS_NICE | ||
350 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
351 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
352 | #define __ARCH_WANT_SYS_SIGPENDING | ||
353 | #define __ARCH_WANT_SYS_SIGPROCMASK | ||
354 | #define __ARCH_WANT_SYS_RT_SIGACTION | ||
355 | |||
356 | /* | ||
357 | * "Conditional" syscalls | ||
358 | */ | ||
359 | #define cond_syscall(name) \ | ||
360 | asm (".weak\t_" #name "\n" \ | ||
361 | ".set\t_" #name ",_sys_ni_syscall"); | ||
362 | |||
363 | #endif /* __KERNEL__ */ | ||
364 | #endif /* _ASM_H8300_UNISTD_H_ */ | ||
diff --git a/arch/h8300/include/asm/user.h b/arch/h8300/include/asm/user.h new file mode 100644 index 000000000000..14a9e18950f1 --- /dev/null +++ b/arch/h8300/include/asm/user.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef _H8300_USER_H | ||
2 | #define _H8300_USER_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | /* Core file format: The core file is written in such a way that gdb | ||
7 | can understand it and provide useful information to the user (under | ||
8 | linux we use the 'trad-core' bfd). There are quite a number of | ||
9 | obstacles to being able to view the contents of the floating point | ||
10 | registers, and until these are solved you will not be able to view the | ||
11 | contents of them. Actually, you can read in the core file and look at | ||
12 | the contents of the user struct to find out what the floating point | ||
13 | registers contain. | ||
14 | The actual file contents are as follows: | ||
15 | UPAGE: 1 page consisting of a user struct that tells gdb what is present | ||
16 | in the file. Directly after this is a copy of the task_struct, which | ||
17 | is currently not used by gdb, but it may come in useful at some point. | ||
18 | All of the registers are stored as part of the upage. The upage should | ||
19 | always be only one page. | ||
20 | DATA: The data area is stored. 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 malloced. No attempt is made to determine if a page | ||
23 | is demand-zero or if a page is totally unused, we just cover the entire | ||
24 | range. All of the addresses are rounded in such a way that an integral | ||
25 | 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 (esp) to | ||
28 | current->start_stack, so we round each of these off in order to be able | ||
29 | to write an integer number of pages. | ||
30 | The minimum core file size is 3 pages, or 12288 bytes. | ||
31 | */ | ||
32 | |||
33 | /* This is the old layout of "struct pt_regs" as of Linux 1.x, and | ||
34 | is still the layout used by user (the new pt_regs doesn't have | ||
35 | all registers). */ | ||
36 | struct user_regs_struct { | ||
37 | long er1,er2,er3,er4,er5,er6; | ||
38 | long er0; | ||
39 | long usp; | ||
40 | long orig_er0; | ||
41 | short ccr; | ||
42 | long pc; | ||
43 | }; | ||
44 | |||
45 | |||
46 | /* When the kernel dumps core, it starts by dumping the user struct - | ||
47 | this will be used by gdb to figure out where the data and stack segments | ||
48 | are within the file, and what virtual addresses to use. */ | ||
49 | struct user{ | ||
50 | /* We start with the registers, to mimic the way that "memory" is returned | ||
51 | from the ptrace(3,...) function. */ | ||
52 | struct user_regs_struct regs; /* Where the registers are actually stored */ | ||
53 | /* ptrace does not yet supply these. Someday.... */ | ||
54 | /* The rest of this junk is to help gdb figure out what goes where */ | ||
55 | unsigned long int u_tsize; /* Text segment size (pages). */ | ||
56 | unsigned long int u_dsize; /* Data segment size (pages). */ | ||
57 | unsigned long int u_ssize; /* Stack segment size (pages). */ | ||
58 | unsigned long start_code; /* Starting virtual address of text. */ | ||
59 | unsigned long start_stack; /* Starting virtual address of stack area. | ||
60 | This is actually the bottom of the stack, | ||
61 | the top of the stack is always found in the | ||
62 | esp register. */ | ||
63 | long int signal; /* Signal that caused the core dump. */ | ||
64 | int reserved; /* No longer used */ | ||
65 | unsigned long u_ar0; /* Used by gdb to help find the values for */ | ||
66 | /* the registers. */ | ||
67 | unsigned long magic; /* To uniquely identify a core file */ | ||
68 | char u_comm[32]; /* User command that was responsible */ | ||
69 | }; | ||
70 | #define NBPG PAGE_SIZE | ||
71 | #define UPAGES 1 | ||
72 | #define HOST_TEXT_START_ADDR (u.start_code) | ||
73 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | ||
74 | |||
75 | #endif | ||
diff --git a/arch/h8300/include/asm/virtconvert.h b/arch/h8300/include/asm/virtconvert.h new file mode 100644 index 000000000000..19cfd62b11c3 --- /dev/null +++ b/arch/h8300/include/asm/virtconvert.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __H8300_VIRT_CONVERT__ | ||
2 | #define __H8300_VIRT_CONVERT__ | ||
3 | |||
4 | /* | ||
5 | * Macros used for converting between virtual and physical mappings. | ||
6 | */ | ||
7 | |||
8 | #ifdef __KERNEL__ | ||
9 | |||
10 | #include <asm/setup.h> | ||
11 | #include <asm/page.h> | ||
12 | |||
13 | #define phys_to_virt(vaddr) ((void *) (vaddr)) | ||
14 | #define virt_to_phys(vaddr) ((unsigned long) (vaddr)) | ||
15 | |||
16 | #define virt_to_bus virt_to_phys | ||
17 | #define bus_to_virt phys_to_virt | ||
18 | |||
19 | #endif | ||
20 | #endif | ||
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index 3473e25231d9..e3dd9303643d 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h | |||
@@ -93,4 +93,8 @@ static inline unsigned long get_softint(void) | |||
93 | void __trigger_all_cpu_backtrace(void); | 93 | void __trigger_all_cpu_backtrace(void); |
94 | #define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace() | 94 | #define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace() |
95 | 95 | ||
96 | extern void *hardirq_stack[NR_CPUS]; | ||
97 | extern void *softirq_stack[NR_CPUS]; | ||
98 | #define __ARCH_HAS_DO_SOFTIRQ | ||
99 | |||
96 | #endif | 100 | #endif |
diff --git a/arch/sparc/include/asm/of_device.h b/arch/sparc/include/asm/of_device.h index e5f5aedc2293..bba777a416d3 100644 --- a/arch/sparc/include/asm/of_device.h +++ b/arch/sparc/include/asm/of_device.h | |||
@@ -30,8 +30,7 @@ struct of_device | |||
30 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); | 30 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); |
31 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); | 31 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); |
32 | 32 | ||
33 | /* These are just here during the transition */ | 33 | /* This is just here during the transition */ |
34 | #include <linux/of_device.h> | ||
35 | #include <linux/of_platform.h> | 34 | #include <linux/of_platform.h> |
36 | 35 | ||
37 | #endif /* __KERNEL__ */ | 36 | #endif /* __KERNEL__ */ |
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index ba43d85e8dde..9b6689d9d570 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c | |||
@@ -682,10 +682,32 @@ void ack_bad_irq(unsigned int virt_irq) | |||
682 | ino, virt_irq); | 682 | ino, virt_irq); |
683 | } | 683 | } |
684 | 684 | ||
685 | void *hardirq_stack[NR_CPUS]; | ||
686 | void *softirq_stack[NR_CPUS]; | ||
687 | |||
688 | static __attribute__((always_inline)) void *set_hardirq_stack(void) | ||
689 | { | ||
690 | void *orig_sp, *sp = hardirq_stack[smp_processor_id()]; | ||
691 | |||
692 | __asm__ __volatile__("mov %%sp, %0" : "=r" (orig_sp)); | ||
693 | if (orig_sp < sp || | ||
694 | orig_sp > (sp + THREAD_SIZE)) { | ||
695 | sp += THREAD_SIZE - 192 - STACK_BIAS; | ||
696 | __asm__ __volatile__("mov %0, %%sp" : : "r" (sp)); | ||
697 | } | ||
698 | |||
699 | return orig_sp; | ||
700 | } | ||
701 | static __attribute__((always_inline)) void restore_hardirq_stack(void *orig_sp) | ||
702 | { | ||
703 | __asm__ __volatile__("mov %0, %%sp" : : "r" (orig_sp)); | ||
704 | } | ||
705 | |||
685 | void handler_irq(int irq, struct pt_regs *regs) | 706 | void handler_irq(int irq, struct pt_regs *regs) |
686 | { | 707 | { |
687 | unsigned long pstate, bucket_pa; | 708 | unsigned long pstate, bucket_pa; |
688 | struct pt_regs *old_regs; | 709 | struct pt_regs *old_regs; |
710 | void *orig_sp; | ||
689 | 711 | ||
690 | clear_softint(1 << irq); | 712 | clear_softint(1 << irq); |
691 | 713 | ||
@@ -703,6 +725,8 @@ void handler_irq(int irq, struct pt_regs *regs) | |||
703 | "i" (PSTATE_IE) | 725 | "i" (PSTATE_IE) |
704 | : "memory"); | 726 | : "memory"); |
705 | 727 | ||
728 | orig_sp = set_hardirq_stack(); | ||
729 | |||
706 | while (bucket_pa) { | 730 | while (bucket_pa) { |
707 | struct irq_desc *desc; | 731 | struct irq_desc *desc; |
708 | unsigned long next_pa; | 732 | unsigned long next_pa; |
@@ -719,10 +743,38 @@ void handler_irq(int irq, struct pt_regs *regs) | |||
719 | bucket_pa = next_pa; | 743 | bucket_pa = next_pa; |
720 | } | 744 | } |
721 | 745 | ||
746 | restore_hardirq_stack(orig_sp); | ||
747 | |||
722 | irq_exit(); | 748 | irq_exit(); |
723 | set_irq_regs(old_regs); | 749 | set_irq_regs(old_regs); |
724 | } | 750 | } |
725 | 751 | ||
752 | void do_softirq(void) | ||
753 | { | ||
754 | unsigned long flags; | ||
755 | |||
756 | if (in_interrupt()) | ||
757 | return; | ||
758 | |||
759 | local_irq_save(flags); | ||
760 | |||
761 | if (local_softirq_pending()) { | ||
762 | void *orig_sp, *sp = softirq_stack[smp_processor_id()]; | ||
763 | |||
764 | sp += THREAD_SIZE - 192 - STACK_BIAS; | ||
765 | |||
766 | __asm__ __volatile__("mov %%sp, %0\n\t" | ||
767 | "mov %1, %%sp" | ||
768 | : "=&r" (orig_sp) | ||
769 | : "r" (sp)); | ||
770 | __do_softirq(); | ||
771 | __asm__ __volatile__("mov %0, %%sp" | ||
772 | : : "r" (orig_sp)); | ||
773 | } | ||
774 | |||
775 | local_irq_restore(flags); | ||
776 | } | ||
777 | |||
726 | #ifdef CONFIG_HOTPLUG_CPU | 778 | #ifdef CONFIG_HOTPLUG_CPU |
727 | void fixup_irqs(void) | 779 | void fixup_irqs(void) |
728 | { | 780 | { |
diff --git a/arch/sparc64/kernel/kstack.h b/arch/sparc64/kernel/kstack.h new file mode 100644 index 000000000000..4248d969272f --- /dev/null +++ b/arch/sparc64/kernel/kstack.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef _KSTACK_H | ||
2 | #define _KSTACK_H | ||
3 | |||
4 | #include <linux/thread_info.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <asm/ptrace.h> | ||
7 | #include <asm/irq.h> | ||
8 | |||
9 | /* SP must be STACK_BIAS adjusted already. */ | ||
10 | static inline bool kstack_valid(struct thread_info *tp, unsigned long sp) | ||
11 | { | ||
12 | unsigned long base = (unsigned long) tp; | ||
13 | |||
14 | if (sp >= (base + sizeof(struct thread_info)) && | ||
15 | sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) | ||
16 | return true; | ||
17 | |||
18 | if (hardirq_stack[tp->cpu]) { | ||
19 | base = (unsigned long) hardirq_stack[tp->cpu]; | ||
20 | if (sp >= base && | ||
21 | sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) | ||
22 | return true; | ||
23 | base = (unsigned long) softirq_stack[tp->cpu]; | ||
24 | if (sp >= base && | ||
25 | sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) | ||
26 | return true; | ||
27 | } | ||
28 | return false; | ||
29 | } | ||
30 | |||
31 | /* Does "regs" point to a valid pt_regs trap frame? */ | ||
32 | static inline bool kstack_is_trap_frame(struct thread_info *tp, struct pt_regs *regs) | ||
33 | { | ||
34 | unsigned long base = (unsigned long) tp; | ||
35 | unsigned long addr = (unsigned long) regs; | ||
36 | |||
37 | if (addr >= base && | ||
38 | addr <= (base + THREAD_SIZE - sizeof(*regs))) | ||
39 | goto check_magic; | ||
40 | |||
41 | if (hardirq_stack[tp->cpu]) { | ||
42 | base = (unsigned long) hardirq_stack[tp->cpu]; | ||
43 | if (addr >= base && | ||
44 | addr <= (base + THREAD_SIZE - sizeof(*regs))) | ||
45 | goto check_magic; | ||
46 | base = (unsigned long) softirq_stack[tp->cpu]; | ||
47 | if (addr >= base && | ||
48 | addr <= (base + THREAD_SIZE - sizeof(*regs))) | ||
49 | goto check_magic; | ||
50 | } | ||
51 | return false; | ||
52 | |||
53 | check_magic: | ||
54 | if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) | ||
55 | return true; | ||
56 | return false; | ||
57 | |||
58 | } | ||
59 | |||
60 | #endif /* _KSTACK_H */ | ||
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 7f5debdc5fed..15f4178592e7 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c | |||
@@ -52,6 +52,8 @@ | |||
52 | #include <asm/irq_regs.h> | 52 | #include <asm/irq_regs.h> |
53 | #include <asm/smp.h> | 53 | #include <asm/smp.h> |
54 | 54 | ||
55 | #include "kstack.h" | ||
56 | |||
55 | static void sparc64_yield(int cpu) | 57 | static void sparc64_yield(int cpu) |
56 | { | 58 | { |
57 | if (tlb_type != hypervisor) | 59 | if (tlb_type != hypervisor) |
@@ -235,19 +237,6 @@ void show_regs(struct pt_regs *regs) | |||
235 | struct global_reg_snapshot global_reg_snapshot[NR_CPUS]; | 237 | struct global_reg_snapshot global_reg_snapshot[NR_CPUS]; |
236 | static DEFINE_SPINLOCK(global_reg_snapshot_lock); | 238 | static DEFINE_SPINLOCK(global_reg_snapshot_lock); |
237 | 239 | ||
238 | static bool kstack_valid(struct thread_info *tp, struct reg_window *rw) | ||
239 | { | ||
240 | unsigned long thread_base, fp; | ||
241 | |||
242 | thread_base = (unsigned long) tp; | ||
243 | fp = (unsigned long) rw; | ||
244 | |||
245 | if (fp < (thread_base + sizeof(struct thread_info)) || | ||
246 | fp >= (thread_base + THREAD_SIZE)) | ||
247 | return false; | ||
248 | return true; | ||
249 | } | ||
250 | |||
251 | static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs, | 240 | static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs, |
252 | int this_cpu) | 241 | int this_cpu) |
253 | { | 242 | { |
@@ -264,11 +253,11 @@ static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs, | |||
264 | 253 | ||
265 | rw = (struct reg_window *) | 254 | rw = (struct reg_window *) |
266 | (regs->u_regs[UREG_FP] + STACK_BIAS); | 255 | (regs->u_regs[UREG_FP] + STACK_BIAS); |
267 | if (kstack_valid(tp, rw)) { | 256 | if (kstack_valid(tp, (unsigned long) rw)) { |
268 | global_reg_snapshot[this_cpu].i7 = rw->ins[7]; | 257 | global_reg_snapshot[this_cpu].i7 = rw->ins[7]; |
269 | rw = (struct reg_window *) | 258 | rw = (struct reg_window *) |
270 | (rw->ins[6] + STACK_BIAS); | 259 | (rw->ins[6] + STACK_BIAS); |
271 | if (kstack_valid(tp, rw)) | 260 | if (kstack_valid(tp, (unsigned long) rw)) |
272 | global_reg_snapshot[this_cpu].rpc = rw->ins[7]; | 261 | global_reg_snapshot[this_cpu].rpc = rw->ins[7]; |
273 | } | 262 | } |
274 | } else { | 263 | } else { |
@@ -828,7 +817,7 @@ out: | |||
828 | unsigned long get_wchan(struct task_struct *task) | 817 | unsigned long get_wchan(struct task_struct *task) |
829 | { | 818 | { |
830 | unsigned long pc, fp, bias = 0; | 819 | unsigned long pc, fp, bias = 0; |
831 | unsigned long thread_info_base; | 820 | struct thread_info *tp; |
832 | struct reg_window *rw; | 821 | struct reg_window *rw; |
833 | unsigned long ret = 0; | 822 | unsigned long ret = 0; |
834 | int count = 0; | 823 | int count = 0; |
@@ -837,14 +826,12 @@ unsigned long get_wchan(struct task_struct *task) | |||
837 | task->state == TASK_RUNNING) | 826 | task->state == TASK_RUNNING) |
838 | goto out; | 827 | goto out; |
839 | 828 | ||
840 | thread_info_base = (unsigned long) task_stack_page(task); | 829 | tp = task_thread_info(task); |
841 | bias = STACK_BIAS; | 830 | bias = STACK_BIAS; |
842 | fp = task_thread_info(task)->ksp + bias; | 831 | fp = task_thread_info(task)->ksp + bias; |
843 | 832 | ||
844 | do { | 833 | do { |
845 | /* Bogus frame pointer? */ | 834 | if (!kstack_valid(tp, fp)) |
846 | if (fp < (thread_info_base + sizeof(struct thread_info)) || | ||
847 | fp >= (thread_info_base + THREAD_SIZE)) | ||
848 | break; | 835 | break; |
849 | rw = (struct reg_window *) fp; | 836 | rw = (struct reg_window *) fp; |
850 | pc = rw->ins[7]; | 837 | pc = rw->ins[7]; |
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 27b81775a4de..743ccad61c60 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -858,9 +858,7 @@ void smp_tsb_sync(struct mm_struct *mm) | |||
858 | extern unsigned long xcall_flush_tlb_mm; | 858 | extern unsigned long xcall_flush_tlb_mm; |
859 | extern unsigned long xcall_flush_tlb_pending; | 859 | extern unsigned long xcall_flush_tlb_pending; |
860 | extern unsigned long xcall_flush_tlb_kernel_range; | 860 | extern unsigned long xcall_flush_tlb_kernel_range; |
861 | #ifdef CONFIG_MAGIC_SYSRQ | ||
862 | extern unsigned long xcall_fetch_glob_regs; | 861 | extern unsigned long xcall_fetch_glob_regs; |
863 | #endif | ||
864 | extern unsigned long xcall_receive_signal; | 862 | extern unsigned long xcall_receive_signal; |
865 | extern unsigned long xcall_new_mmu_context_version; | 863 | extern unsigned long xcall_new_mmu_context_version; |
866 | #ifdef CONFIG_KGDB | 864 | #ifdef CONFIG_KGDB |
@@ -1005,12 +1003,10 @@ void kgdb_roundup_cpus(unsigned long flags) | |||
1005 | } | 1003 | } |
1006 | #endif | 1004 | #endif |
1007 | 1005 | ||
1008 | #ifdef CONFIG_MAGIC_SYSRQ | ||
1009 | void smp_fetch_global_regs(void) | 1006 | void smp_fetch_global_regs(void) |
1010 | { | 1007 | { |
1011 | smp_cross_call(&xcall_fetch_glob_regs, 0, 0, 0); | 1008 | smp_cross_call(&xcall_fetch_glob_regs, 0, 0, 0); |
1012 | } | 1009 | } |
1013 | #endif | ||
1014 | 1010 | ||
1015 | /* We know that the window frames of the user have been flushed | 1011 | /* We know that the window frames of the user have been flushed |
1016 | * to the stack before we get here because all callers of us | 1012 | * to the stack before we get here because all callers of us |
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c index e9d7f0660f2e..4e21d4a57d3b 100644 --- a/arch/sparc64/kernel/stacktrace.c +++ b/arch/sparc64/kernel/stacktrace.c | |||
@@ -5,10 +5,12 @@ | |||
5 | #include <asm/ptrace.h> | 5 | #include <asm/ptrace.h> |
6 | #include <asm/stacktrace.h> | 6 | #include <asm/stacktrace.h> |
7 | 7 | ||
8 | #include "kstack.h" | ||
9 | |||
8 | void save_stack_trace(struct stack_trace *trace) | 10 | void save_stack_trace(struct stack_trace *trace) |
9 | { | 11 | { |
10 | unsigned long ksp, fp, thread_base; | ||
11 | struct thread_info *tp = task_thread_info(current); | 12 | struct thread_info *tp = task_thread_info(current); |
13 | unsigned long ksp, fp; | ||
12 | 14 | ||
13 | stack_trace_flush(); | 15 | stack_trace_flush(); |
14 | 16 | ||
@@ -18,23 +20,18 @@ void save_stack_trace(struct stack_trace *trace) | |||
18 | ); | 20 | ); |
19 | 21 | ||
20 | fp = ksp + STACK_BIAS; | 22 | fp = ksp + STACK_BIAS; |
21 | thread_base = (unsigned long) tp; | ||
22 | do { | 23 | do { |
23 | struct sparc_stackf *sf; | 24 | struct sparc_stackf *sf; |
24 | struct pt_regs *regs; | 25 | struct pt_regs *regs; |
25 | unsigned long pc; | 26 | unsigned long pc; |
26 | 27 | ||
27 | /* Bogus frame pointer? */ | 28 | if (!kstack_valid(tp, fp)) |
28 | if (fp < (thread_base + sizeof(struct thread_info)) || | ||
29 | fp > (thread_base + THREAD_SIZE - sizeof(struct sparc_stackf))) | ||
30 | break; | 29 | break; |
31 | 30 | ||
32 | sf = (struct sparc_stackf *) fp; | 31 | sf = (struct sparc_stackf *) fp; |
33 | regs = (struct pt_regs *) (sf + 1); | 32 | regs = (struct pt_regs *) (sf + 1); |
34 | 33 | ||
35 | if (((unsigned long)regs <= | 34 | if (kstack_is_trap_frame(tp, regs)) { |
36 | (thread_base + THREAD_SIZE - sizeof(*regs))) && | ||
37 | (regs->magic & ~0x1ff) == PT_REGS_MAGIC) { | ||
38 | if (!(regs->tstate & TSTATE_PRIV)) | 35 | if (!(regs->tstate & TSTATE_PRIV)) |
39 | break; | 36 | break; |
40 | pc = regs->tpc; | 37 | pc = regs->tpc; |
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 404e8561e2d0..3d924121c796 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
40 | 40 | ||
41 | #include "entry.h" | 41 | #include "entry.h" |
42 | #include "kstack.h" | ||
42 | 43 | ||
43 | /* When an irrecoverable trap occurs at tl > 0, the trap entry | 44 | /* When an irrecoverable trap occurs at tl > 0, the trap entry |
44 | * code logs the trap state registers at every level in the trap | 45 | * code logs the trap state registers at every level in the trap |
@@ -2115,14 +2116,12 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp) | |||
2115 | struct pt_regs *regs; | 2116 | struct pt_regs *regs; |
2116 | unsigned long pc; | 2117 | unsigned long pc; |
2117 | 2118 | ||
2118 | /* Bogus frame pointer? */ | 2119 | if (!kstack_valid(tp, fp)) |
2119 | if (fp < (thread_base + sizeof(struct thread_info)) || | ||
2120 | fp >= (thread_base + THREAD_SIZE)) | ||
2121 | break; | 2120 | break; |
2122 | sf = (struct sparc_stackf *) fp; | 2121 | sf = (struct sparc_stackf *) fp; |
2123 | regs = (struct pt_regs *) (sf + 1); | 2122 | regs = (struct pt_regs *) (sf + 1); |
2124 | 2123 | ||
2125 | if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) { | 2124 | if (kstack_is_trap_frame(tp, regs)) { |
2126 | if (!(regs->tstate & TSTATE_PRIV)) | 2125 | if (!(regs->tstate & TSTATE_PRIV)) |
2127 | break; | 2126 | break; |
2128 | pc = regs->tpc; | 2127 | pc = regs->tpc; |
diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc64/lib/mcount.S index 7735a7a60533..fad90ddb3a28 100644 --- a/arch/sparc64/lib/mcount.S +++ b/arch/sparc64/lib/mcount.S | |||
@@ -48,12 +48,45 @@ mcount: | |||
48 | sub %g3, STACK_BIAS, %g3 | 48 | sub %g3, STACK_BIAS, %g3 |
49 | cmp %sp, %g3 | 49 | cmp %sp, %g3 |
50 | bg,pt %xcc, 1f | 50 | bg,pt %xcc, 1f |
51 | sethi %hi(panicstring), %g3 | 51 | nop |
52 | lduh [%g6 + TI_CPU], %g1 | ||
53 | sethi %hi(hardirq_stack), %g3 | ||
54 | or %g3, %lo(hardirq_stack), %g3 | ||
55 | sllx %g1, 3, %g1 | ||
56 | ldx [%g3 + %g1], %g7 | ||
57 | sub %g7, STACK_BIAS, %g7 | ||
58 | cmp %sp, %g7 | ||
59 | bleu,pt %xcc, 2f | ||
60 | sethi %hi(THREAD_SIZE), %g3 | ||
61 | add %g7, %g3, %g7 | ||
62 | cmp %sp, %g7 | ||
63 | blu,pn %xcc, 1f | ||
64 | 2: sethi %hi(softirq_stack), %g3 | ||
65 | or %g3, %lo(softirq_stack), %g3 | ||
66 | ldx [%g3 + %g1], %g7 | ||
67 | cmp %sp, %g7 | ||
68 | bleu,pt %xcc, 2f | ||
69 | sethi %hi(THREAD_SIZE), %g3 | ||
70 | add %g7, %g3, %g7 | ||
71 | cmp %sp, %g7 | ||
72 | blu,pn %xcc, 1f | ||
73 | nop | ||
74 | /* If we are already on ovstack, don't hop onto it | ||
75 | * again, we are already trying to output the stack overflow | ||
76 | * message. | ||
77 | */ | ||
52 | sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough | 78 | sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough |
53 | or %g7, %lo(ovstack), %g7 | 79 | or %g7, %lo(ovstack), %g7 |
54 | add %g7, OVSTACKSIZE, %g7 | 80 | add %g7, OVSTACKSIZE, %g3 |
81 | sub %g3, STACK_BIAS + 192, %g3 | ||
55 | sub %g7, STACK_BIAS, %g7 | 82 | sub %g7, STACK_BIAS, %g7 |
56 | mov %g7, %sp | 83 | cmp %sp, %g7 |
84 | blu,pn %xcc, 2f | ||
85 | cmp %sp, %g3 | ||
86 | bleu,pn %xcc, 1f | ||
87 | nop | ||
88 | 2: mov %g3, %sp | ||
89 | sethi %hi(panicstring), %g3 | ||
57 | call prom_printf | 90 | call prom_printf |
58 | or %g3, %lo(panicstring), %o0 | 91 | or %g3, %lo(panicstring), %o0 |
59 | call prom_halt | 92 | call prom_halt |
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 4e821b3ecb03..217de3ea29e8 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <asm/sstate.h> | 49 | #include <asm/sstate.h> |
50 | #include <asm/mdesc.h> | 50 | #include <asm/mdesc.h> |
51 | #include <asm/cpudata.h> | 51 | #include <asm/cpudata.h> |
52 | #include <asm/irq.h> | ||
52 | 53 | ||
53 | #define MAX_PHYS_ADDRESS (1UL << 42UL) | 54 | #define MAX_PHYS_ADDRESS (1UL << 42UL) |
54 | #define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) | 55 | #define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) |
@@ -1771,6 +1772,16 @@ void __init paging_init(void) | |||
1771 | if (tlb_type == hypervisor) | 1772 | if (tlb_type == hypervisor) |
1772 | sun4v_mdesc_init(); | 1773 | sun4v_mdesc_init(); |
1773 | 1774 | ||
1775 | /* Once the OF device tree and MDESC have been setup, we know | ||
1776 | * the list of possible cpus. Therefore we can allocate the | ||
1777 | * IRQ stacks. | ||
1778 | */ | ||
1779 | for_each_possible_cpu(i) { | ||
1780 | /* XXX Use node local allocations... XXX */ | ||
1781 | softirq_stack[i] = __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); | ||
1782 | hardirq_stack[i] = __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); | ||
1783 | } | ||
1784 | |||
1774 | /* Setup bootmem... */ | 1785 | /* Setup bootmem... */ |
1775 | last_valid_pfn = end_pfn = bootmem_init(phys_base); | 1786 | last_valid_pfn = end_pfn = bootmem_init(phys_base); |
1776 | 1787 | ||
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S index ff1dc44d363e..86773e89dc1b 100644 --- a/arch/sparc64/mm/ultra.S +++ b/arch/sparc64/mm/ultra.S | |||
@@ -480,7 +480,6 @@ xcall_sync_tick: | |||
480 | b rtrap_xcall | 480 | b rtrap_xcall |
481 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 | 481 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 |
482 | 482 | ||
483 | #ifdef CONFIG_MAGIC_SYSRQ | ||
484 | .globl xcall_fetch_glob_regs | 483 | .globl xcall_fetch_glob_regs |
485 | xcall_fetch_glob_regs: | 484 | xcall_fetch_glob_regs: |
486 | sethi %hi(global_reg_snapshot), %g1 | 485 | sethi %hi(global_reg_snapshot), %g1 |
@@ -511,7 +510,6 @@ xcall_fetch_glob_regs: | |||
511 | membar #StoreStore | 510 | membar #StoreStore |
512 | stx %g3, [%g1 + GR_SNAP_THREAD] | 511 | stx %g3, [%g1 + GR_SNAP_THREAD] |
513 | retry | 512 | retry |
514 | #endif /* CONFIG_MAGIC_SYSRQ */ | ||
515 | 513 | ||
516 | #ifdef DCACHE_ALIASING_POSSIBLE | 514 | #ifdef DCACHE_ALIASING_POSSIBLE |
517 | .align 32 | 515 | .align 32 |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index ac2fb0641a04..53ab36878736 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -1657,6 +1657,14 @@ config DMAR_FLOPPY_WA | |||
1657 | workaround will setup a 1:1 mapping for the first | 1657 | workaround will setup a 1:1 mapping for the first |
1658 | 16M to make floppy (an ISA device) work. | 1658 | 16M to make floppy (an ISA device) work. |
1659 | 1659 | ||
1660 | config INTR_REMAP | ||
1661 | bool "Support for Interrupt Remapping (EXPERIMENTAL)" | ||
1662 | depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL | ||
1663 | help | ||
1664 | Supports Interrupt remapping for IO-APIC and MSI devices. | ||
1665 | To use x2apic mode in the CPU's which support x2APIC enhancements or | ||
1666 | to support platforms with CPU's having > 8 bit APIC ID, say Y. | ||
1667 | |||
1660 | source "drivers/pci/pcie/Kconfig" | 1668 | source "drivers/pci/pcie/Kconfig" |
1661 | 1669 | ||
1662 | source "drivers/pci/Kconfig" | 1670 | source "drivers/pci/Kconfig" |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 9fea73706479..aaf5a2131efc 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -16,7 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | #undef CONFIG_PARAVIRT | 17 | #undef CONFIG_PARAVIRT |
18 | #ifdef CONFIG_X86_32 | 18 | #ifdef CONFIG_X86_32 |
19 | #define _ASM_DESC_H_ 1 | 19 | #define ASM_X86__DESC_H 1 |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifdef CONFIG_X86_64 | 22 | #ifdef CONFIG_X86_64 |
diff --git a/arch/x86/mach-es7000/Makefile b/arch/x86/es7000/Makefile index 3ef8b43b62fc..3ef8b43b62fc 100644 --- a/arch/x86/mach-es7000/Makefile +++ b/arch/x86/es7000/Makefile | |||
diff --git a/arch/x86/mach-es7000/es7000.h b/arch/x86/es7000/es7000.h index c8d5aa132fa0..4e62f6fa95b8 100644 --- a/arch/x86/mach-es7000/es7000.h +++ b/arch/x86/es7000/es7000.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Written by: Garry Forsgren, Unisys Corporation | 2 | * Written by: Garry Forsgren, Unisys Corporation |
3 | * Natalie Protasevich, Unisys Corporation | 3 | * Natalie Protasevich, Unisys Corporation |
4 | * This file contains the code to configure and interface | 4 | * This file contains the code to configure and interface |
5 | * with Unisys ES7000 series hardware system manager. | 5 | * with Unisys ES7000 series hardware system manager. |
6 | * | 6 | * |
7 | * Copyright (c) 2003 Unisys Corporation. All Rights Reserved. | 7 | * Copyright (c) 2003 Unisys Corporation. All Rights Reserved. |
@@ -18,7 +18,7 @@ | |||
18 | * with this program; if not, write the Free Software Foundation, Inc., 59 | 18 | * with this program; if not, write the Free Software Foundation, Inc., 59 |
19 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | 19 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. |
20 | * | 20 | * |
21 | * Contact information: Unisys Corporation, Township Line & Union Meeting | 21 | * Contact information: Unisys Corporation, Township Line & Union Meeting |
22 | * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or: | 22 | * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or: |
23 | * | 23 | * |
24 | * http://www.unisys.com | 24 | * http://www.unisys.com |
@@ -41,7 +41,7 @@ | |||
41 | #define MIP_VALID 0x0100000000000000ULL | 41 | #define MIP_VALID 0x0100000000000000ULL |
42 | #define MIP_PORT(VALUE) ((VALUE >> 32) & 0xffff) | 42 | #define MIP_PORT(VALUE) ((VALUE >> 32) & 0xffff) |
43 | 43 | ||
44 | #define MIP_RD_LO(VALUE) (VALUE & 0xffffffff) | 44 | #define MIP_RD_LO(VALUE) (VALUE & 0xffffffff) |
45 | 45 | ||
46 | struct mip_reg_info { | 46 | struct mip_reg_info { |
47 | unsigned long long mip_info; | 47 | unsigned long long mip_info; |
@@ -51,11 +51,11 @@ struct mip_reg_info { | |||
51 | }; | 51 | }; |
52 | 52 | ||
53 | struct part_info { | 53 | struct part_info { |
54 | unsigned char type; | 54 | unsigned char type; |
55 | unsigned char length; | 55 | unsigned char length; |
56 | unsigned char part_id; | 56 | unsigned char part_id; |
57 | unsigned char apic_mode; | 57 | unsigned char apic_mode; |
58 | unsigned long snum; | 58 | unsigned long snum; |
59 | char ptype[16]; | 59 | char ptype[16]; |
60 | char sname[64]; | 60 | char sname[64]; |
61 | char pname[64]; | 61 | char pname[64]; |
@@ -68,11 +68,11 @@ struct psai { | |||
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct es7000_mem_info { | 70 | struct es7000_mem_info { |
71 | unsigned char type; | 71 | unsigned char type; |
72 | unsigned char length; | 72 | unsigned char length; |
73 | unsigned char resv[6]; | 73 | unsigned char resv[6]; |
74 | unsigned long long start; | 74 | unsigned long long start; |
75 | unsigned long long size; | 75 | unsigned long long size; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | struct es7000_oem_table { | 78 | struct es7000_oem_table { |
@@ -106,7 +106,7 @@ struct mip_reg { | |||
106 | }; | 106 | }; |
107 | 107 | ||
108 | #define MIP_SW_APIC 0x1020b | 108 | #define MIP_SW_APIC 0x1020b |
109 | #define MIP_FUNC(VALUE) (VALUE & 0xff) | 109 | #define MIP_FUNC(VALUE) (VALUE & 0xff) |
110 | 110 | ||
111 | extern int parse_unisys_oem (char *oemptr); | 111 | extern int parse_unisys_oem (char *oemptr); |
112 | extern void setup_unisys(void); | 112 | extern void setup_unisys(void); |
diff --git a/arch/x86/mach-es7000/es7000plat.c b/arch/x86/es7000/es7000plat.c index 50189af14b85..7789fde13c3f 100644 --- a/arch/x86/mach-es7000/es7000plat.c +++ b/arch/x86/es7000/es7000plat.c | |||
@@ -72,7 +72,7 @@ es7000_rename_gsi(int ioapic, int gsi) | |||
72 | base += nr_ioapic_registers[i]; | 72 | base += nr_ioapic_registers[i]; |
73 | } | 73 | } |
74 | 74 | ||
75 | if (!ioapic && (gsi < 16)) | 75 | if (!ioapic && (gsi < 16)) |
76 | gsi += base; | 76 | gsi += base; |
77 | return gsi; | 77 | return gsi; |
78 | } | 78 | } |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 3db651fc8ec5..a07ec14f3312 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -104,6 +104,8 @@ obj-$(CONFIG_OLPC) += olpc.o | |||
104 | ifeq ($(CONFIG_X86_64),y) | 104 | ifeq ($(CONFIG_X86_64),y) |
105 | obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o | 105 | obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o |
106 | obj-y += bios_uv.o | 106 | obj-y += bios_uv.o |
107 | obj-y += genx2apic_cluster.o | ||
108 | obj-y += genx2apic_phys.o | ||
107 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o | 109 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o |
108 | obj-$(CONFIG_AUDIT) += audit_64.o | 110 | obj-$(CONFIG_AUDIT) += audit_64.o |
109 | 111 | ||
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index fa88a1d71290..12e260e8fb2a 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -761,7 +761,7 @@ static void __init acpi_register_lapic_address(unsigned long address) | |||
761 | 761 | ||
762 | set_fixmap_nocache(FIX_APIC_BASE, address); | 762 | set_fixmap_nocache(FIX_APIC_BASE, address); |
763 | if (boot_cpu_physical_apicid == -1U) { | 763 | if (boot_cpu_physical_apicid == -1U) { |
764 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 764 | boot_cpu_physical_apicid = read_apic_id(); |
765 | #ifdef CONFIG_X86_32 | 765 | #ifdef CONFIG_X86_32 |
766 | apic_version[boot_cpu_physical_apicid] = | 766 | apic_version[boot_cpu_physical_apicid] = |
767 | GET_APIC_VERSION(apic_read(APIC_LVR)); | 767 | GET_APIC_VERSION(apic_read(APIC_LVR)); |
@@ -1337,7 +1337,9 @@ static void __init acpi_process_madt(void) | |||
1337 | acpi_ioapic = 1; | 1337 | acpi_ioapic = 1; |
1338 | 1338 | ||
1339 | smp_found_config = 1; | 1339 | smp_found_config = 1; |
1340 | #ifdef CONFIG_X86_32 | ||
1340 | setup_apic_routing(); | 1341 | setup_apic_routing(); |
1342 | #endif | ||
1341 | } | 1343 | } |
1342 | } | 1344 | } |
1343 | if (error == -EINVAL) { | 1345 | if (error == -EINVAL) { |
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c index 039a8d4aaf62..84318edad8fb 100644 --- a/arch/x86/kernel/apic_32.c +++ b/arch/x86/kernel/apic_32.c | |||
@@ -145,13 +145,18 @@ static int modern_apic(void) | |||
145 | return lapic_get_version() >= 0x14; | 145 | return lapic_get_version() >= 0x14; |
146 | } | 146 | } |
147 | 147 | ||
148 | void apic_wait_icr_idle(void) | 148 | /* |
149 | * Paravirt kernels also might be using these below ops. So we still | ||
150 | * use generic apic_read()/apic_write(), which might be pointing to different | ||
151 | * ops in PARAVIRT case. | ||
152 | */ | ||
153 | void xapic_wait_icr_idle(void) | ||
149 | { | 154 | { |
150 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) | 155 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) |
151 | cpu_relax(); | 156 | cpu_relax(); |
152 | } | 157 | } |
153 | 158 | ||
154 | u32 safe_apic_wait_icr_idle(void) | 159 | u32 safe_xapic_wait_icr_idle(void) |
155 | { | 160 | { |
156 | u32 send_status; | 161 | u32 send_status; |
157 | int timeout; | 162 | int timeout; |
@@ -167,6 +172,34 @@ u32 safe_apic_wait_icr_idle(void) | |||
167 | return send_status; | 172 | return send_status; |
168 | } | 173 | } |
169 | 174 | ||
175 | void xapic_icr_write(u32 low, u32 id) | ||
176 | { | ||
177 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id)); | ||
178 | apic_write(APIC_ICR, low); | ||
179 | } | ||
180 | |||
181 | u64 xapic_icr_read(void) | ||
182 | { | ||
183 | u32 icr1, icr2; | ||
184 | |||
185 | icr2 = apic_read(APIC_ICR2); | ||
186 | icr1 = apic_read(APIC_ICR); | ||
187 | |||
188 | return icr1 | ((u64)icr2 << 32); | ||
189 | } | ||
190 | |||
191 | static struct apic_ops xapic_ops = { | ||
192 | .read = native_apic_mem_read, | ||
193 | .write = native_apic_mem_write, | ||
194 | .icr_read = xapic_icr_read, | ||
195 | .icr_write = xapic_icr_write, | ||
196 | .wait_icr_idle = xapic_wait_icr_idle, | ||
197 | .safe_wait_icr_idle = safe_xapic_wait_icr_idle, | ||
198 | }; | ||
199 | |||
200 | struct apic_ops __read_mostly *apic_ops = &xapic_ops; | ||
201 | EXPORT_SYMBOL_GPL(apic_ops); | ||
202 | |||
170 | /** | 203 | /** |
171 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 | 204 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 |
172 | */ | 205 | */ |
@@ -1205,7 +1238,7 @@ void __init init_apic_mappings(void) | |||
1205 | * default configuration (or the MP table is broken). | 1238 | * default configuration (or the MP table is broken). |
1206 | */ | 1239 | */ |
1207 | if (boot_cpu_physical_apicid == -1U) | 1240 | if (boot_cpu_physical_apicid == -1U) |
1208 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1241 | boot_cpu_physical_apicid = read_apic_id(); |
1209 | 1242 | ||
1210 | } | 1243 | } |
1211 | 1244 | ||
@@ -1242,7 +1275,7 @@ int __init APIC_init_uniprocessor(void) | |||
1242 | * might be zero if read from MP tables. Get it from LAPIC. | 1275 | * might be zero if read from MP tables. Get it from LAPIC. |
1243 | */ | 1276 | */ |
1244 | #ifdef CONFIG_CRASH_DUMP | 1277 | #ifdef CONFIG_CRASH_DUMP |
1245 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1278 | boot_cpu_physical_apicid = read_apic_id(); |
1246 | #endif | 1279 | #endif |
1247 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | 1280 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); |
1248 | 1281 | ||
@@ -1321,54 +1354,6 @@ void smp_error_interrupt(struct pt_regs *regs) | |||
1321 | irq_exit(); | 1354 | irq_exit(); |
1322 | } | 1355 | } |
1323 | 1356 | ||
1324 | #ifdef CONFIG_SMP | ||
1325 | void __init smp_intr_init(void) | ||
1326 | { | ||
1327 | /* | ||
1328 | * IRQ0 must be given a fixed assignment and initialized, | ||
1329 | * because it's used before the IO-APIC is set up. | ||
1330 | */ | ||
1331 | set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]); | ||
1332 | |||
1333 | /* | ||
1334 | * The reschedule interrupt is a CPU-to-CPU reschedule-helper | ||
1335 | * IPI, driven by wakeup. | ||
1336 | */ | ||
1337 | alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); | ||
1338 | |||
1339 | /* IPI for invalidation */ | ||
1340 | alloc_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt); | ||
1341 | |||
1342 | /* IPI for generic function call */ | ||
1343 | alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); | ||
1344 | |||
1345 | /* IPI for single call function */ | ||
1346 | set_intr_gate(CALL_FUNCTION_SINGLE_VECTOR, | ||
1347 | call_function_single_interrupt); | ||
1348 | } | ||
1349 | #endif | ||
1350 | |||
1351 | /* | ||
1352 | * Initialize APIC interrupts | ||
1353 | */ | ||
1354 | void __init apic_intr_init(void) | ||
1355 | { | ||
1356 | #ifdef CONFIG_SMP | ||
1357 | smp_intr_init(); | ||
1358 | #endif | ||
1359 | /* self generated IPI for local APIC timer */ | ||
1360 | alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt); | ||
1361 | |||
1362 | /* IPI vectors for APIC spurious and error interrupts */ | ||
1363 | alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); | ||
1364 | alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt); | ||
1365 | |||
1366 | /* thermal monitor LVT interrupt */ | ||
1367 | #ifdef CONFIG_X86_MCE_P4THERMAL | ||
1368 | alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); | ||
1369 | #endif | ||
1370 | } | ||
1371 | |||
1372 | /** | 1357 | /** |
1373 | * connect_bsp_APIC - attach the APIC to the interrupt system | 1358 | * connect_bsp_APIC - attach the APIC to the interrupt system |
1374 | */ | 1359 | */ |
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c index 7f1f030da7ee..cd63c0bc6180 100644 --- a/arch/x86/kernel/apic_64.c +++ b/arch/x86/kernel/apic_64.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/clockchips.h> | 27 | #include <linux/clockchips.h> |
28 | #include <linux/acpi_pmtmr.h> | 28 | #include <linux/acpi_pmtmr.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/dmar.h> | ||
30 | 31 | ||
31 | #include <asm/atomic.h> | 32 | #include <asm/atomic.h> |
32 | #include <asm/smp.h> | 33 | #include <asm/smp.h> |
@@ -39,6 +40,7 @@ | |||
39 | #include <asm/proto.h> | 40 | #include <asm/proto.h> |
40 | #include <asm/timex.h> | 41 | #include <asm/timex.h> |
41 | #include <asm/apic.h> | 42 | #include <asm/apic.h> |
43 | #include <asm/i8259.h> | ||
42 | 44 | ||
43 | #include <mach_ipi.h> | 45 | #include <mach_ipi.h> |
44 | #include <mach_apic.h> | 46 | #include <mach_apic.h> |
@@ -46,6 +48,11 @@ | |||
46 | static int disable_apic_timer __cpuinitdata; | 48 | static int disable_apic_timer __cpuinitdata; |
47 | static int apic_calibrate_pmtmr __initdata; | 49 | static int apic_calibrate_pmtmr __initdata; |
48 | int disable_apic; | 50 | int disable_apic; |
51 | int disable_x2apic; | ||
52 | int x2apic; | ||
53 | |||
54 | /* x2apic enabled before OS handover */ | ||
55 | int x2apic_preenabled; | ||
49 | 56 | ||
50 | /* Local APIC timer works in C2 */ | 57 | /* Local APIC timer works in C2 */ |
51 | int local_apic_timer_c2_ok; | 58 | int local_apic_timer_c2_ok; |
@@ -119,13 +126,13 @@ static int modern_apic(void) | |||
119 | return lapic_get_version() >= 0x14; | 126 | return lapic_get_version() >= 0x14; |
120 | } | 127 | } |
121 | 128 | ||
122 | void apic_wait_icr_idle(void) | 129 | void xapic_wait_icr_idle(void) |
123 | { | 130 | { |
124 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) | 131 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) |
125 | cpu_relax(); | 132 | cpu_relax(); |
126 | } | 133 | } |
127 | 134 | ||
128 | u32 safe_apic_wait_icr_idle(void) | 135 | u32 safe_xapic_wait_icr_idle(void) |
129 | { | 136 | { |
130 | u32 send_status; | 137 | u32 send_status; |
131 | int timeout; | 138 | int timeout; |
@@ -141,6 +148,69 @@ u32 safe_apic_wait_icr_idle(void) | |||
141 | return send_status; | 148 | return send_status; |
142 | } | 149 | } |
143 | 150 | ||
151 | void xapic_icr_write(u32 low, u32 id) | ||
152 | { | ||
153 | apic_write(APIC_ICR2, id << 24); | ||
154 | apic_write(APIC_ICR, low); | ||
155 | } | ||
156 | |||
157 | u64 xapic_icr_read(void) | ||
158 | { | ||
159 | u32 icr1, icr2; | ||
160 | |||
161 | icr2 = apic_read(APIC_ICR2); | ||
162 | icr1 = apic_read(APIC_ICR); | ||
163 | |||
164 | return (icr1 | ((u64)icr2 << 32)); | ||
165 | } | ||
166 | |||
167 | static struct apic_ops xapic_ops = { | ||
168 | .read = native_apic_mem_read, | ||
169 | .write = native_apic_mem_write, | ||
170 | .icr_read = xapic_icr_read, | ||
171 | .icr_write = xapic_icr_write, | ||
172 | .wait_icr_idle = xapic_wait_icr_idle, | ||
173 | .safe_wait_icr_idle = safe_xapic_wait_icr_idle, | ||
174 | }; | ||
175 | |||
176 | struct apic_ops __read_mostly *apic_ops = &xapic_ops; | ||
177 | |||
178 | EXPORT_SYMBOL_GPL(apic_ops); | ||
179 | |||
180 | static void x2apic_wait_icr_idle(void) | ||
181 | { | ||
182 | /* no need to wait for icr idle in x2apic */ | ||
183 | return; | ||
184 | } | ||
185 | |||
186 | static u32 safe_x2apic_wait_icr_idle(void) | ||
187 | { | ||
188 | /* no need to wait for icr idle in x2apic */ | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | void x2apic_icr_write(u32 low, u32 id) | ||
193 | { | ||
194 | wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low); | ||
195 | } | ||
196 | |||
197 | u64 x2apic_icr_read(void) | ||
198 | { | ||
199 | unsigned long val; | ||
200 | |||
201 | rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val); | ||
202 | return val; | ||
203 | } | ||
204 | |||
205 | static struct apic_ops x2apic_ops = { | ||
206 | .read = native_apic_msr_read, | ||
207 | .write = native_apic_msr_write, | ||
208 | .icr_read = x2apic_icr_read, | ||
209 | .icr_write = x2apic_icr_write, | ||
210 | .wait_icr_idle = x2apic_wait_icr_idle, | ||
211 | .safe_wait_icr_idle = safe_x2apic_wait_icr_idle, | ||
212 | }; | ||
213 | |||
144 | /** | 214 | /** |
145 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 | 215 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 |
146 | */ | 216 | */ |
@@ -630,10 +700,10 @@ int __init verify_local_APIC(void) | |||
630 | /* | 700 | /* |
631 | * The ID register is read/write in a real APIC. | 701 | * The ID register is read/write in a real APIC. |
632 | */ | 702 | */ |
633 | reg0 = read_apic_id(); | 703 | reg0 = apic_read(APIC_ID); |
634 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); | 704 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); |
635 | apic_write(APIC_ID, reg0 ^ APIC_ID_MASK); | 705 | apic_write(APIC_ID, reg0 ^ APIC_ID_MASK); |
636 | reg1 = read_apic_id(); | 706 | reg1 = apic_read(APIC_ID); |
637 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); | 707 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); |
638 | apic_write(APIC_ID, reg0); | 708 | apic_write(APIC_ID, reg0); |
639 | if (reg1 != (reg0 ^ APIC_ID_MASK)) | 709 | if (reg1 != (reg0 ^ APIC_ID_MASK)) |
@@ -834,6 +904,125 @@ void __cpuinit end_local_APIC_setup(void) | |||
834 | apic_pm_activate(); | 904 | apic_pm_activate(); |
835 | } | 905 | } |
836 | 906 | ||
907 | void check_x2apic(void) | ||
908 | { | ||
909 | int msr, msr2; | ||
910 | |||
911 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | ||
912 | |||
913 | if (msr & X2APIC_ENABLE) { | ||
914 | printk("x2apic enabled by BIOS, switching to x2apic ops\n"); | ||
915 | x2apic_preenabled = x2apic = 1; | ||
916 | apic_ops = &x2apic_ops; | ||
917 | } | ||
918 | } | ||
919 | |||
920 | void enable_x2apic(void) | ||
921 | { | ||
922 | int msr, msr2; | ||
923 | |||
924 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | ||
925 | if (!(msr & X2APIC_ENABLE)) { | ||
926 | printk("Enabling x2apic\n"); | ||
927 | wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, 0); | ||
928 | } | ||
929 | } | ||
930 | |||
931 | void enable_IR_x2apic(void) | ||
932 | { | ||
933 | #ifdef CONFIG_INTR_REMAP | ||
934 | int ret; | ||
935 | unsigned long flags; | ||
936 | |||
937 | if (!cpu_has_x2apic) | ||
938 | return; | ||
939 | |||
940 | if (!x2apic_preenabled && disable_x2apic) { | ||
941 | printk(KERN_INFO | ||
942 | "Skipped enabling x2apic and Interrupt-remapping " | ||
943 | "because of nox2apic\n"); | ||
944 | return; | ||
945 | } | ||
946 | |||
947 | if (x2apic_preenabled && disable_x2apic) | ||
948 | panic("Bios already enabled x2apic, can't enforce nox2apic"); | ||
949 | |||
950 | if (!x2apic_preenabled && skip_ioapic_setup) { | ||
951 | printk(KERN_INFO | ||
952 | "Skipped enabling x2apic and Interrupt-remapping " | ||
953 | "because of skipping io-apic setup\n"); | ||
954 | return; | ||
955 | } | ||
956 | |||
957 | ret = dmar_table_init(); | ||
958 | if (ret) { | ||
959 | printk(KERN_INFO | ||
960 | "dmar_table_init() failed with %d:\n", ret); | ||
961 | |||
962 | if (x2apic_preenabled) | ||
963 | panic("x2apic enabled by bios. But IR enabling failed"); | ||
964 | else | ||
965 | printk(KERN_INFO | ||
966 | "Not enabling x2apic,Intr-remapping\n"); | ||
967 | return; | ||
968 | } | ||
969 | |||
970 | local_irq_save(flags); | ||
971 | mask_8259A(); | ||
972 | save_mask_IO_APIC_setup(); | ||
973 | |||
974 | ret = enable_intr_remapping(1); | ||
975 | |||
976 | if (ret && x2apic_preenabled) { | ||
977 | local_irq_restore(flags); | ||
978 | panic("x2apic enabled by bios. But IR enabling failed"); | ||
979 | } | ||
980 | |||
981 | if (ret) | ||
982 | goto end; | ||
983 | |||
984 | if (!x2apic) { | ||
985 | x2apic = 1; | ||
986 | apic_ops = &x2apic_ops; | ||
987 | enable_x2apic(); | ||
988 | } | ||
989 | end: | ||
990 | if (ret) | ||
991 | /* | ||
992 | * IR enabling failed | ||
993 | */ | ||
994 | restore_IO_APIC_setup(); | ||
995 | else | ||
996 | reinit_intr_remapped_IO_APIC(x2apic_preenabled); | ||
997 | |||
998 | unmask_8259A(); | ||
999 | local_irq_restore(flags); | ||
1000 | |||
1001 | if (!ret) { | ||
1002 | if (!x2apic_preenabled) | ||
1003 | printk(KERN_INFO | ||
1004 | "Enabled x2apic and interrupt-remapping\n"); | ||
1005 | else | ||
1006 | printk(KERN_INFO | ||
1007 | "Enabled Interrupt-remapping\n"); | ||
1008 | } else | ||
1009 | printk(KERN_ERR | ||
1010 | "Failed to enable Interrupt-remapping and x2apic\n"); | ||
1011 | #else | ||
1012 | if (!cpu_has_x2apic) | ||
1013 | return; | ||
1014 | |||
1015 | if (x2apic_preenabled) | ||
1016 | panic("x2apic enabled prior OS handover," | ||
1017 | " enable CONFIG_INTR_REMAP"); | ||
1018 | |||
1019 | printk(KERN_INFO "Enable CONFIG_INTR_REMAP for enabling intr-remapping " | ||
1020 | " and x2apic\n"); | ||
1021 | #endif | ||
1022 | |||
1023 | return; | ||
1024 | } | ||
1025 | |||
837 | /* | 1026 | /* |
838 | * Detect and enable local APICs on non-SMP boards. | 1027 | * Detect and enable local APICs on non-SMP boards. |
839 | * Original code written by Keir Fraser. | 1028 | * Original code written by Keir Fraser. |
@@ -873,7 +1062,7 @@ void __init early_init_lapic_mapping(void) | |||
873 | * Fetch the APIC ID of the BSP in case we have a | 1062 | * Fetch the APIC ID of the BSP in case we have a |
874 | * default configuration (or the MP table is broken). | 1063 | * default configuration (or the MP table is broken). |
875 | */ | 1064 | */ |
876 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1065 | boot_cpu_physical_apicid = read_apic_id(); |
877 | } | 1066 | } |
878 | 1067 | ||
879 | /** | 1068 | /** |
@@ -881,6 +1070,11 @@ void __init early_init_lapic_mapping(void) | |||
881 | */ | 1070 | */ |
882 | void __init init_apic_mappings(void) | 1071 | void __init init_apic_mappings(void) |
883 | { | 1072 | { |
1073 | if (x2apic) { | ||
1074 | boot_cpu_physical_apicid = read_apic_id(); | ||
1075 | return; | ||
1076 | } | ||
1077 | |||
884 | /* | 1078 | /* |
885 | * If no local APIC can be found then set up a fake all | 1079 | * If no local APIC can be found then set up a fake all |
886 | * zeroes page to simulate the local APIC and another | 1080 | * zeroes page to simulate the local APIC and another |
@@ -900,7 +1094,7 @@ void __init init_apic_mappings(void) | |||
900 | * Fetch the APIC ID of the BSP in case we have a | 1094 | * Fetch the APIC ID of the BSP in case we have a |
901 | * default configuration (or the MP table is broken). | 1095 | * default configuration (or the MP table is broken). |
902 | */ | 1096 | */ |
903 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1097 | boot_cpu_physical_apicid = read_apic_id(); |
904 | } | 1098 | } |
905 | 1099 | ||
906 | /* | 1100 | /* |
@@ -919,6 +1113,9 @@ int __init APIC_init_uniprocessor(void) | |||
919 | return -1; | 1113 | return -1; |
920 | } | 1114 | } |
921 | 1115 | ||
1116 | enable_IR_x2apic(); | ||
1117 | setup_apic_routing(); | ||
1118 | |||
922 | verify_local_APIC(); | 1119 | verify_local_APIC(); |
923 | 1120 | ||
924 | connect_bsp_APIC(); | 1121 | connect_bsp_APIC(); |
@@ -1100,6 +1297,11 @@ void __cpuinit generic_processor_info(int apicid, int version) | |||
1100 | cpu_set(cpu, cpu_present_map); | 1297 | cpu_set(cpu, cpu_present_map); |
1101 | } | 1298 | } |
1102 | 1299 | ||
1300 | int hard_smp_processor_id(void) | ||
1301 | { | ||
1302 | return read_apic_id(); | ||
1303 | } | ||
1304 | |||
1103 | /* | 1305 | /* |
1104 | * Power management | 1306 | * Power management |
1105 | */ | 1307 | */ |
@@ -1136,7 +1338,7 @@ static int lapic_suspend(struct sys_device *dev, pm_message_t state) | |||
1136 | 1338 | ||
1137 | maxlvt = lapic_get_maxlvt(); | 1339 | maxlvt = lapic_get_maxlvt(); |
1138 | 1340 | ||
1139 | apic_pm_state.apic_id = read_apic_id(); | 1341 | apic_pm_state.apic_id = apic_read(APIC_ID); |
1140 | apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI); | 1342 | apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI); |
1141 | apic_pm_state.apic_ldr = apic_read(APIC_LDR); | 1343 | apic_pm_state.apic_ldr = apic_read(APIC_LDR); |
1142 | apic_pm_state.apic_dfr = apic_read(APIC_DFR); | 1344 | apic_pm_state.apic_dfr = apic_read(APIC_DFR); |
@@ -1171,10 +1373,14 @@ static int lapic_resume(struct sys_device *dev) | |||
1171 | maxlvt = lapic_get_maxlvt(); | 1373 | maxlvt = lapic_get_maxlvt(); |
1172 | 1374 | ||
1173 | local_irq_save(flags); | 1375 | local_irq_save(flags); |
1174 | rdmsr(MSR_IA32_APICBASE, l, h); | 1376 | if (!x2apic) { |
1175 | l &= ~MSR_IA32_APICBASE_BASE; | 1377 | rdmsr(MSR_IA32_APICBASE, l, h); |
1176 | l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; | 1378 | l &= ~MSR_IA32_APICBASE_BASE; |
1177 | wrmsr(MSR_IA32_APICBASE, l, h); | 1379 | l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; |
1380 | wrmsr(MSR_IA32_APICBASE, l, h); | ||
1381 | } else | ||
1382 | enable_x2apic(); | ||
1383 | |||
1178 | apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); | 1384 | apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); |
1179 | apic_write(APIC_ID, apic_pm_state.apic_id); | 1385 | apic_write(APIC_ID, apic_pm_state.apic_id); |
1180 | apic_write(APIC_DFR, apic_pm_state.apic_dfr); | 1386 | apic_write(APIC_DFR, apic_pm_state.apic_dfr); |
@@ -1314,6 +1520,15 @@ __cpuinit int apic_is_clustered_box(void) | |||
1314 | return (clusters > 2); | 1520 | return (clusters > 2); |
1315 | } | 1521 | } |
1316 | 1522 | ||
1523 | static __init int setup_nox2apic(char *str) | ||
1524 | { | ||
1525 | disable_x2apic = 1; | ||
1526 | clear_cpu_cap(&boot_cpu_data, X86_FEATURE_X2APIC); | ||
1527 | return 0; | ||
1528 | } | ||
1529 | early_param("nox2apic", setup_nox2apic); | ||
1530 | |||
1531 | |||
1317 | /* | 1532 | /* |
1318 | * APIC command line parameters | 1533 | * APIC command line parameters |
1319 | */ | 1534 | */ |
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c index aa89387006fe..505543a75a56 100644 --- a/arch/x86/kernel/asm-offsets_64.c +++ b/arch/x86/kernel/asm-offsets_64.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #define __NO_STUBS 1 | 23 | #define __NO_STUBS 1 |
24 | #undef __SYSCALL | 24 | #undef __SYSCALL |
25 | #undef _ASM_X86_64_UNISTD_H_ | 25 | #undef ASM_X86__UNISTD_64_H |
26 | #define __SYSCALL(nr, sym) [nr] = 1, | 26 | #define __SYSCALL(nr, sym) [nr] = 1, |
27 | static char syscalls[] = { | 27 | static char syscalls[] = { |
28 | #include <asm/unistd.h> | 28 | #include <asm/unistd.h> |
diff --git a/arch/x86/kernel/cpu/common_64.c b/arch/x86/kernel/cpu/common_64.c index dd6e3f15017e..cc6efe86249d 100644 --- a/arch/x86/kernel/cpu/common_64.c +++ b/arch/x86/kernel/cpu/common_64.c | |||
@@ -493,17 +493,20 @@ void pda_init(int cpu) | |||
493 | /* others are initialized in smpboot.c */ | 493 | /* others are initialized in smpboot.c */ |
494 | pda->pcurrent = &init_task; | 494 | pda->pcurrent = &init_task; |
495 | pda->irqstackptr = boot_cpu_stack; | 495 | pda->irqstackptr = boot_cpu_stack; |
496 | pda->irqstackptr += IRQSTACKSIZE - 64; | ||
496 | } else { | 497 | } else { |
497 | pda->irqstackptr = (char *) | 498 | if (!pda->irqstackptr) { |
498 | __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER); | 499 | pda->irqstackptr = (char *) |
499 | if (!pda->irqstackptr) | 500 | __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER); |
500 | panic("cannot allocate irqstack for cpu %d", cpu); | 501 | if (!pda->irqstackptr) |
502 | panic("cannot allocate irqstack for cpu %d", | ||
503 | cpu); | ||
504 | pda->irqstackptr += IRQSTACKSIZE - 64; | ||
505 | } | ||
501 | 506 | ||
502 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) | 507 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) |
503 | pda->nodenumber = cpu_to_node(cpu); | 508 | pda->nodenumber = cpu_to_node(cpu); |
504 | } | 509 | } |
505 | |||
506 | pda->irqstackptr += IRQSTACKSIZE-64; | ||
507 | } | 510 | } |
508 | 511 | ||
509 | char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + | 512 | char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + |
@@ -597,23 +600,28 @@ void __cpuinit cpu_init(void) | |||
597 | barrier(); | 600 | barrier(); |
598 | 601 | ||
599 | check_efer(); | 602 | check_efer(); |
603 | if (cpu != 0 && x2apic) | ||
604 | enable_x2apic(); | ||
600 | 605 | ||
601 | /* | 606 | /* |
602 | * set up and load the per-CPU TSS | 607 | * set up and load the per-CPU TSS |
603 | */ | 608 | */ |
604 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { | 609 | if (!orig_ist->ist[0]) { |
605 | static const unsigned int order[N_EXCEPTION_STACKS] = { | 610 | static const unsigned int order[N_EXCEPTION_STACKS] = { |
606 | [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, | 611 | [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, |
607 | [DEBUG_STACK - 1] = DEBUG_STACK_ORDER | 612 | [DEBUG_STACK - 1] = DEBUG_STACK_ORDER |
608 | }; | 613 | }; |
609 | if (cpu) { | 614 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { |
610 | estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); | 615 | if (cpu) { |
611 | if (!estacks) | 616 | estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); |
612 | panic("Cannot allocate exception stack %ld %d\n", | 617 | if (!estacks) |
613 | v, cpu); | 618 | panic("Cannot allocate exception " |
619 | "stack %ld %d\n", v, cpu); | ||
620 | } | ||
621 | estacks += PAGE_SIZE << order[v]; | ||
622 | orig_ist->ist[v] = t->x86_tss.ist[v] = | ||
623 | (unsigned long)estacks; | ||
614 | } | 624 | } |
615 | estacks += PAGE_SIZE << order[v]; | ||
616 | orig_ist->ist[v] = t->x86_tss.ist[v] = (unsigned long)estacks; | ||
617 | } | 625 | } |
618 | 626 | ||
619 | t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap); | 627 | t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap); |
diff --git a/arch/x86/kernel/cpu/feature_names.c b/arch/x86/kernel/cpu/feature_names.c index e43ad4ad4cba..0bf4d37a0483 100644 --- a/arch/x86/kernel/cpu/feature_names.c +++ b/arch/x86/kernel/cpu/feature_names.c | |||
@@ -45,7 +45,7 @@ const char * const x86_cap_flags[NCAPINTS*32] = { | |||
45 | /* Intel-defined (#2) */ | 45 | /* Intel-defined (#2) */ |
46 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | 46 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", |
47 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | 47 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, |
48 | NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | 48 | NULL, NULL, "dca", "sse4_1", "sse4_2", "x2apic", NULL, "popcnt", |
49 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 49 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
50 | 50 | ||
51 | /* VIA/Cyrix/Centaur-defined */ | 51 | /* VIA/Cyrix/Centaur-defined */ |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 89434d439605..cf3a0b2d0059 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -275,9 +275,9 @@ ENTRY(native_usergs_sysret64) | |||
275 | ENTRY(ret_from_fork) | 275 | ENTRY(ret_from_fork) |
276 | CFI_DEFAULT_STACK | 276 | CFI_DEFAULT_STACK |
277 | push kernel_eflags(%rip) | 277 | push kernel_eflags(%rip) |
278 | CFI_ADJUST_CFA_OFFSET 4 | 278 | CFI_ADJUST_CFA_OFFSET 8 |
279 | popf # reset kernel eflags | 279 | popf # reset kernel eflags |
280 | CFI_ADJUST_CFA_OFFSET -4 | 280 | CFI_ADJUST_CFA_OFFSET -8 |
281 | call schedule_tail | 281 | call schedule_tail |
282 | GET_THREAD_INFO(%rcx) | 282 | GET_THREAD_INFO(%rcx) |
283 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx) | 283 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx) |
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c index eaff0bbb1444..6c9bfc9e1e95 100644 --- a/arch/x86/kernel/genapic_64.c +++ b/arch/x86/kernel/genapic_64.c | |||
@@ -16,87 +16,63 @@ | |||
16 | #include <linux/ctype.h> | 16 | #include <linux/ctype.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/hardirq.h> | 18 | #include <linux/hardirq.h> |
19 | #include <linux/dmar.h> | ||
19 | 20 | ||
20 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
21 | #include <asm/ipi.h> | 22 | #include <asm/ipi.h> |
22 | #include <asm/genapic.h> | 23 | #include <asm/genapic.h> |
23 | 24 | ||
24 | #ifdef CONFIG_ACPI | 25 | extern struct genapic apic_flat; |
25 | #include <acpi/acpi_bus.h> | 26 | extern struct genapic apic_physflat; |
26 | #endif | 27 | extern struct genapic apic_x2xpic_uv_x; |
27 | 28 | extern struct genapic apic_x2apic_phys; | |
28 | DEFINE_PER_CPU(int, x2apic_extra_bits); | 29 | extern struct genapic apic_x2apic_cluster; |
29 | 30 | ||
30 | struct genapic __read_mostly *genapic = &apic_flat; | 31 | struct genapic __read_mostly *genapic = &apic_flat; |
31 | 32 | ||
32 | static enum uv_system_type uv_system_type; | 33 | static struct genapic *apic_probe[] __initdata = { |
34 | &apic_x2apic_uv_x, | ||
35 | &apic_x2apic_phys, | ||
36 | &apic_x2apic_cluster, | ||
37 | &apic_physflat, | ||
38 | NULL, | ||
39 | }; | ||
33 | 40 | ||
34 | /* | 41 | /* |
35 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. | 42 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. |
36 | */ | 43 | */ |
37 | void __init setup_apic_routing(void) | 44 | void __init setup_apic_routing(void) |
38 | { | 45 | { |
39 | if (uv_system_type == UV_NON_UNIQUE_APIC) | 46 | if (genapic == &apic_x2apic_phys || genapic == &apic_x2apic_cluster) { |
40 | genapic = &apic_x2apic_uv_x; | 47 | if (!intr_remapping_enabled) |
41 | else | 48 | genapic = &apic_flat; |
42 | #ifdef CONFIG_ACPI | 49 | } |
43 | /* | ||
44 | * Quirk: some x86_64 machines can only use physical APIC mode | ||
45 | * regardless of how many processors are present (x86_64 ES7000 | ||
46 | * is an example). | ||
47 | */ | ||
48 | if (acpi_gbl_FADT.header.revision > FADT2_REVISION_ID && | ||
49 | (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL)) | ||
50 | genapic = &apic_physflat; | ||
51 | else | ||
52 | #endif | ||
53 | |||
54 | if (max_physical_apicid < 8) | ||
55 | genapic = &apic_flat; | ||
56 | else | ||
57 | genapic = &apic_physflat; | ||
58 | 50 | ||
59 | printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name); | 51 | if (genapic == &apic_flat) { |
52 | if (max_physical_apicid >= 8) | ||
53 | genapic = &apic_physflat; | ||
54 | printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name); | ||
55 | } | ||
60 | } | 56 | } |
61 | 57 | ||
62 | /* Same for both flat and physical. */ | 58 | /* Same for both flat and physical. */ |
63 | 59 | ||
64 | void send_IPI_self(int vector) | 60 | void apic_send_IPI_self(int vector) |
65 | { | 61 | { |
66 | __send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); | 62 | __send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); |
67 | } | 63 | } |
68 | 64 | ||
69 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 65 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
70 | { | 66 | { |
71 | if (!strcmp(oem_id, "SGI")) { | 67 | int i; |
72 | if (!strcmp(oem_table_id, "UVL")) | 68 | |
73 | uv_system_type = UV_LEGACY_APIC; | 69 | for (i = 0; apic_probe[i]; ++i) { |
74 | else if (!strcmp(oem_table_id, "UVX")) | 70 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { |
75 | uv_system_type = UV_X2APIC; | 71 | genapic = apic_probe[i]; |
76 | else if (!strcmp(oem_table_id, "UVH")) | 72 | printk(KERN_INFO "Setting APIC routing to %s.\n", |
77 | uv_system_type = UV_NON_UNIQUE_APIC; | 73 | genapic->name); |
74 | return 1; | ||
75 | } | ||
78 | } | 76 | } |
79 | return 0; | 77 | return 0; |
80 | } | 78 | } |
81 | |||
82 | unsigned int read_apic_id(void) | ||
83 | { | ||
84 | unsigned int id; | ||
85 | |||
86 | WARN_ON(preemptible() && num_online_cpus() > 1); | ||
87 | id = apic_read(APIC_ID); | ||
88 | if (uv_system_type >= UV_X2APIC) | ||
89 | id |= __get_cpu_var(x2apic_extra_bits); | ||
90 | return id; | ||
91 | } | ||
92 | |||
93 | enum uv_system_type get_uv_system_type(void) | ||
94 | { | ||
95 | return uv_system_type; | ||
96 | } | ||
97 | |||
98 | int is_uv_system(void) | ||
99 | { | ||
100 | return uv_system_type != UV_NONE; | ||
101 | } | ||
102 | EXPORT_SYMBOL_GPL(is_uv_system); | ||
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c index 786548a62d38..9eca5ba7a6b1 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/genapic_flat_64.c | |||
@@ -15,9 +15,20 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/ctype.h> | 16 | #include <linux/ctype.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/hardirq.h> | ||
18 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
19 | #include <asm/ipi.h> | 20 | #include <asm/ipi.h> |
20 | #include <asm/genapic.h> | 21 | #include <asm/genapic.h> |
22 | #include <mach_apicdef.h> | ||
23 | |||
24 | #ifdef CONFIG_ACPI | ||
25 | #include <acpi/acpi_bus.h> | ||
26 | #endif | ||
27 | |||
28 | static int __init flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
29 | { | ||
30 | return 1; | ||
31 | } | ||
21 | 32 | ||
22 | static cpumask_t flat_target_cpus(void) | 33 | static cpumask_t flat_target_cpus(void) |
23 | { | 34 | { |
@@ -95,9 +106,33 @@ static void flat_send_IPI_all(int vector) | |||
95 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); | 106 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); |
96 | } | 107 | } |
97 | 108 | ||
109 | static unsigned int get_apic_id(unsigned long x) | ||
110 | { | ||
111 | unsigned int id; | ||
112 | |||
113 | id = (((x)>>24) & 0xFFu); | ||
114 | return id; | ||
115 | } | ||
116 | |||
117 | static unsigned long set_apic_id(unsigned int id) | ||
118 | { | ||
119 | unsigned long x; | ||
120 | |||
121 | x = ((id & 0xFFu)<<24); | ||
122 | return x; | ||
123 | } | ||
124 | |||
125 | static unsigned int read_xapic_id(void) | ||
126 | { | ||
127 | unsigned int id; | ||
128 | |||
129 | id = get_apic_id(apic_read(APIC_ID)); | ||
130 | return id; | ||
131 | } | ||
132 | |||
98 | static int flat_apic_id_registered(void) | 133 | static int flat_apic_id_registered(void) |
99 | { | 134 | { |
100 | return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map); | 135 | return physid_isset(read_xapic_id(), phys_cpu_present_map); |
101 | } | 136 | } |
102 | 137 | ||
103 | static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask) | 138 | static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask) |
@@ -112,6 +147,7 @@ static unsigned int phys_pkg_id(int index_msb) | |||
112 | 147 | ||
113 | struct genapic apic_flat = { | 148 | struct genapic apic_flat = { |
114 | .name = "flat", | 149 | .name = "flat", |
150 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, | ||
115 | .int_delivery_mode = dest_LowestPrio, | 151 | .int_delivery_mode = dest_LowestPrio, |
116 | .int_dest_mode = (APIC_DEST_LOGICAL != 0), | 152 | .int_dest_mode = (APIC_DEST_LOGICAL != 0), |
117 | .target_cpus = flat_target_cpus, | 153 | .target_cpus = flat_target_cpus, |
@@ -121,8 +157,12 @@ struct genapic apic_flat = { | |||
121 | .send_IPI_all = flat_send_IPI_all, | 157 | .send_IPI_all = flat_send_IPI_all, |
122 | .send_IPI_allbutself = flat_send_IPI_allbutself, | 158 | .send_IPI_allbutself = flat_send_IPI_allbutself, |
123 | .send_IPI_mask = flat_send_IPI_mask, | 159 | .send_IPI_mask = flat_send_IPI_mask, |
160 | .send_IPI_self = apic_send_IPI_self, | ||
124 | .cpu_mask_to_apicid = flat_cpu_mask_to_apicid, | 161 | .cpu_mask_to_apicid = flat_cpu_mask_to_apicid, |
125 | .phys_pkg_id = phys_pkg_id, | 162 | .phys_pkg_id = phys_pkg_id, |
163 | .get_apic_id = get_apic_id, | ||
164 | .set_apic_id = set_apic_id, | ||
165 | .apic_id_mask = (0xFFu<<24), | ||
126 | }; | 166 | }; |
127 | 167 | ||
128 | /* | 168 | /* |
@@ -130,6 +170,21 @@ struct genapic apic_flat = { | |||
130 | * We cannot use logical delivery in this case because the mask | 170 | * We cannot use logical delivery in this case because the mask |
131 | * overflows, so use physical mode. | 171 | * overflows, so use physical mode. |
132 | */ | 172 | */ |
173 | static int __init physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
174 | { | ||
175 | #ifdef CONFIG_ACPI | ||
176 | /* | ||
177 | * Quirk: some x86_64 machines can only use physical APIC mode | ||
178 | * regardless of how many processors are present (x86_64 ES7000 | ||
179 | * is an example). | ||
180 | */ | ||
181 | if (acpi_gbl_FADT.header.revision > FADT2_REVISION_ID && | ||
182 | (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL)) | ||
183 | return 1; | ||
184 | #endif | ||
185 | |||
186 | return 0; | ||
187 | } | ||
133 | 188 | ||
134 | static cpumask_t physflat_target_cpus(void) | 189 | static cpumask_t physflat_target_cpus(void) |
135 | { | 190 | { |
@@ -176,6 +231,7 @@ static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask) | |||
176 | 231 | ||
177 | struct genapic apic_physflat = { | 232 | struct genapic apic_physflat = { |
178 | .name = "physical flat", | 233 | .name = "physical flat", |
234 | .acpi_madt_oem_check = physflat_acpi_madt_oem_check, | ||
179 | .int_delivery_mode = dest_Fixed, | 235 | .int_delivery_mode = dest_Fixed, |
180 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 236 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), |
181 | .target_cpus = physflat_target_cpus, | 237 | .target_cpus = physflat_target_cpus, |
@@ -185,6 +241,10 @@ struct genapic apic_physflat = { | |||
185 | .send_IPI_all = physflat_send_IPI_all, | 241 | .send_IPI_all = physflat_send_IPI_all, |
186 | .send_IPI_allbutself = physflat_send_IPI_allbutself, | 242 | .send_IPI_allbutself = physflat_send_IPI_allbutself, |
187 | .send_IPI_mask = physflat_send_IPI_mask, | 243 | .send_IPI_mask = physflat_send_IPI_mask, |
244 | .send_IPI_self = apic_send_IPI_self, | ||
188 | .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, | 245 | .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, |
189 | .phys_pkg_id = phys_pkg_id, | 246 | .phys_pkg_id = phys_pkg_id, |
247 | .get_apic_id = get_apic_id, | ||
248 | .set_apic_id = set_apic_id, | ||
249 | .apic_id_mask = (0xFFu<<24), | ||
190 | }; | 250 | }; |
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c new file mode 100644 index 000000000000..fed9f68efd66 --- /dev/null +++ b/arch/x86/kernel/genx2apic_cluster.c | |||
@@ -0,0 +1,164 @@ | |||
1 | #include <linux/threads.h> | ||
2 | #include <linux/cpumask.h> | ||
3 | #include <linux/string.h> | ||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/ctype.h> | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/dmar.h> | ||
8 | |||
9 | #include <asm/smp.h> | ||
10 | #include <asm/ipi.h> | ||
11 | #include <asm/genapic.h> | ||
12 | |||
13 | DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid); | ||
14 | |||
15 | static int __init x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
16 | { | ||
17 | if (cpu_has_x2apic) | ||
18 | return 1; | ||
19 | |||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ | ||
24 | |||
25 | static cpumask_t x2apic_target_cpus(void) | ||
26 | { | ||
27 | return cpumask_of_cpu(0); | ||
28 | } | ||
29 | |||
30 | /* | ||
31 | * for now each logical cpu is in its own vector allocation domain. | ||
32 | */ | ||
33 | static cpumask_t x2apic_vector_allocation_domain(int cpu) | ||
34 | { | ||
35 | cpumask_t domain = CPU_MASK_NONE; | ||
36 | cpu_set(cpu, domain); | ||
37 | return domain; | ||
38 | } | ||
39 | |||
40 | static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | ||
41 | unsigned int dest) | ||
42 | { | ||
43 | unsigned long cfg; | ||
44 | |||
45 | cfg = __prepare_ICR(0, vector, dest); | ||
46 | |||
47 | /* | ||
48 | * send the IPI. | ||
49 | */ | ||
50 | x2apic_icr_write(cfg, apicid); | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * for now, we send the IPI's one by one in the cpumask. | ||
55 | * TBD: Based on the cpu mask, we can send the IPI's to the cluster group | ||
56 | * at once. We have 16 cpu's in a cluster. This will minimize IPI register | ||
57 | * writes. | ||
58 | */ | ||
59 | static void x2apic_send_IPI_mask(cpumask_t mask, int vector) | ||
60 | { | ||
61 | unsigned long flags; | ||
62 | unsigned long query_cpu; | ||
63 | |||
64 | local_irq_save(flags); | ||
65 | for_each_cpu_mask(query_cpu, mask) { | ||
66 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_logical_apicid, query_cpu), | ||
67 | vector, APIC_DEST_LOGICAL); | ||
68 | } | ||
69 | local_irq_restore(flags); | ||
70 | } | ||
71 | |||
72 | static void x2apic_send_IPI_allbutself(int vector) | ||
73 | { | ||
74 | cpumask_t mask = cpu_online_map; | ||
75 | |||
76 | cpu_clear(smp_processor_id(), mask); | ||
77 | |||
78 | if (!cpus_empty(mask)) | ||
79 | x2apic_send_IPI_mask(mask, vector); | ||
80 | } | ||
81 | |||
82 | static void x2apic_send_IPI_all(int vector) | ||
83 | { | ||
84 | x2apic_send_IPI_mask(cpu_online_map, vector); | ||
85 | } | ||
86 | |||
87 | static int x2apic_apic_id_registered(void) | ||
88 | { | ||
89 | return 1; | ||
90 | } | ||
91 | |||
92 | static unsigned int x2apic_cpu_mask_to_apicid(cpumask_t cpumask) | ||
93 | { | ||
94 | int cpu; | ||
95 | |||
96 | /* | ||
97 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
98 | * May as well be the first. | ||
99 | */ | ||
100 | cpu = first_cpu(cpumask); | ||
101 | if ((unsigned)cpu < NR_CPUS) | ||
102 | return per_cpu(x86_cpu_to_logical_apicid, cpu); | ||
103 | else | ||
104 | return BAD_APICID; | ||
105 | } | ||
106 | |||
107 | static unsigned int get_apic_id(unsigned long x) | ||
108 | { | ||
109 | unsigned int id; | ||
110 | |||
111 | id = x; | ||
112 | return id; | ||
113 | } | ||
114 | |||
115 | static unsigned long set_apic_id(unsigned int id) | ||
116 | { | ||
117 | unsigned long x; | ||
118 | |||
119 | x = id; | ||
120 | return x; | ||
121 | } | ||
122 | |||
123 | static unsigned int x2apic_read_id(void) | ||
124 | { | ||
125 | return apic_read(APIC_ID); | ||
126 | } | ||
127 | |||
128 | static unsigned int phys_pkg_id(int index_msb) | ||
129 | { | ||
130 | return x2apic_read_id() >> index_msb; | ||
131 | } | ||
132 | |||
133 | static void x2apic_send_IPI_self(int vector) | ||
134 | { | ||
135 | apic_write(APIC_SELF_IPI, vector); | ||
136 | } | ||
137 | |||
138 | static void init_x2apic_ldr(void) | ||
139 | { | ||
140 | int cpu = smp_processor_id(); | ||
141 | |||
142 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); | ||
143 | return; | ||
144 | } | ||
145 | |||
146 | struct genapic apic_x2apic_cluster = { | ||
147 | .name = "cluster x2apic", | ||
148 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | ||
149 | .int_delivery_mode = dest_LowestPrio, | ||
150 | .int_dest_mode = (APIC_DEST_LOGICAL != 0), | ||
151 | .target_cpus = x2apic_target_cpus, | ||
152 | .vector_allocation_domain = x2apic_vector_allocation_domain, | ||
153 | .apic_id_registered = x2apic_apic_id_registered, | ||
154 | .init_apic_ldr = init_x2apic_ldr, | ||
155 | .send_IPI_all = x2apic_send_IPI_all, | ||
156 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | ||
157 | .send_IPI_mask = x2apic_send_IPI_mask, | ||
158 | .send_IPI_self = x2apic_send_IPI_self, | ||
159 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | ||
160 | .phys_pkg_id = phys_pkg_id, | ||
161 | .get_apic_id = get_apic_id, | ||
162 | .set_apic_id = set_apic_id, | ||
163 | .apic_id_mask = (0xFFFFFFFFu), | ||
164 | }; | ||
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c new file mode 100644 index 000000000000..958d537b4cc9 --- /dev/null +++ b/arch/x86/kernel/genx2apic_phys.c | |||
@@ -0,0 +1,159 @@ | |||
1 | #include <linux/threads.h> | ||
2 | #include <linux/cpumask.h> | ||
3 | #include <linux/string.h> | ||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/ctype.h> | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/dmar.h> | ||
8 | |||
9 | #include <asm/smp.h> | ||
10 | #include <asm/ipi.h> | ||
11 | #include <asm/genapic.h> | ||
12 | |||
13 | static int x2apic_phys; | ||
14 | |||
15 | static int set_x2apic_phys_mode(char *arg) | ||
16 | { | ||
17 | x2apic_phys = 1; | ||
18 | return 0; | ||
19 | } | ||
20 | early_param("x2apic_phys", set_x2apic_phys_mode); | ||
21 | |||
22 | static int __init x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
23 | { | ||
24 | if (cpu_has_x2apic && x2apic_phys) | ||
25 | return 1; | ||
26 | |||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ | ||
31 | |||
32 | static cpumask_t x2apic_target_cpus(void) | ||
33 | { | ||
34 | return cpumask_of_cpu(0); | ||
35 | } | ||
36 | |||
37 | static cpumask_t x2apic_vector_allocation_domain(int cpu) | ||
38 | { | ||
39 | cpumask_t domain = CPU_MASK_NONE; | ||
40 | cpu_set(cpu, domain); | ||
41 | return domain; | ||
42 | } | ||
43 | |||
44 | static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | ||
45 | unsigned int dest) | ||
46 | { | ||
47 | unsigned long cfg; | ||
48 | |||
49 | cfg = __prepare_ICR(0, vector, dest); | ||
50 | |||
51 | /* | ||
52 | * send the IPI. | ||
53 | */ | ||
54 | x2apic_icr_write(cfg, apicid); | ||
55 | } | ||
56 | |||
57 | static void x2apic_send_IPI_mask(cpumask_t mask, int vector) | ||
58 | { | ||
59 | unsigned long flags; | ||
60 | unsigned long query_cpu; | ||
61 | |||
62 | local_irq_save(flags); | ||
63 | for_each_cpu_mask(query_cpu, mask) { | ||
64 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), | ||
65 | vector, APIC_DEST_PHYSICAL); | ||
66 | } | ||
67 | local_irq_restore(flags); | ||
68 | } | ||
69 | |||
70 | static void x2apic_send_IPI_allbutself(int vector) | ||
71 | { | ||
72 | cpumask_t mask = cpu_online_map; | ||
73 | |||
74 | cpu_clear(smp_processor_id(), mask); | ||
75 | |||
76 | if (!cpus_empty(mask)) | ||
77 | x2apic_send_IPI_mask(mask, vector); | ||
78 | } | ||
79 | |||
80 | static void x2apic_send_IPI_all(int vector) | ||
81 | { | ||
82 | x2apic_send_IPI_mask(cpu_online_map, vector); | ||
83 | } | ||
84 | |||
85 | static int x2apic_apic_id_registered(void) | ||
86 | { | ||
87 | return 1; | ||
88 | } | ||
89 | |||
90 | static unsigned int x2apic_cpu_mask_to_apicid(cpumask_t cpumask) | ||
91 | { | ||
92 | int cpu; | ||
93 | |||
94 | /* | ||
95 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
96 | * May as well be the first. | ||
97 | */ | ||
98 | cpu = first_cpu(cpumask); | ||
99 | if ((unsigned)cpu < NR_CPUS) | ||
100 | return per_cpu(x86_cpu_to_apicid, cpu); | ||
101 | else | ||
102 | return BAD_APICID; | ||
103 | } | ||
104 | |||
105 | static unsigned int get_apic_id(unsigned long x) | ||
106 | { | ||
107 | unsigned int id; | ||
108 | |||
109 | id = x; | ||
110 | return id; | ||
111 | } | ||
112 | |||
113 | static unsigned long set_apic_id(unsigned int id) | ||
114 | { | ||
115 | unsigned long x; | ||
116 | |||
117 | x = id; | ||
118 | return x; | ||
119 | } | ||
120 | |||
121 | static unsigned int x2apic_read_id(void) | ||
122 | { | ||
123 | return apic_read(APIC_ID); | ||
124 | } | ||
125 | |||
126 | static unsigned int phys_pkg_id(int index_msb) | ||
127 | { | ||
128 | return x2apic_read_id() >> index_msb; | ||
129 | } | ||
130 | |||
131 | void x2apic_send_IPI_self(int vector) | ||
132 | { | ||
133 | apic_write(APIC_SELF_IPI, vector); | ||
134 | } | ||
135 | |||
136 | void init_x2apic_ldr(void) | ||
137 | { | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | struct genapic apic_x2apic_phys = { | ||
142 | .name = "physical x2apic", | ||
143 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | ||
144 | .int_delivery_mode = dest_Fixed, | ||
145 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | ||
146 | .target_cpus = x2apic_target_cpus, | ||
147 | .vector_allocation_domain = x2apic_vector_allocation_domain, | ||
148 | .apic_id_registered = x2apic_apic_id_registered, | ||
149 | .init_apic_ldr = init_x2apic_ldr, | ||
150 | .send_IPI_all = x2apic_send_IPI_all, | ||
151 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | ||
152 | .send_IPI_mask = x2apic_send_IPI_mask, | ||
153 | .send_IPI_self = x2apic_send_IPI_self, | ||
154 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | ||
155 | .phys_pkg_id = phys_pkg_id, | ||
156 | .get_apic_id = get_apic_id, | ||
157 | .set_apic_id = set_apic_id, | ||
158 | .apic_id_mask = (0xFFFFFFFFu), | ||
159 | }; | ||
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c index 2cfcbded888a..16a93ed7baf1 100644 --- a/arch/x86/kernel/genx2apic_uv_x.c +++ b/arch/x86/kernel/genx2apic_uv_x.c | |||
@@ -12,12 +12,12 @@ | |||
12 | #include <linux/threads.h> | 12 | #include <linux/threads.h> |
13 | #include <linux/cpumask.h> | 13 | #include <linux/cpumask.h> |
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/kernel.h> | ||
16 | #include <linux/ctype.h> | 15 | #include <linux/ctype.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
18 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
19 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/hardirq.h> | ||
21 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
22 | #include <asm/ipi.h> | 22 | #include <asm/ipi.h> |
23 | #include <asm/genapic.h> | 23 | #include <asm/genapic.h> |
@@ -26,6 +26,36 @@ | |||
26 | #include <asm/uv/uv_hub.h> | 26 | #include <asm/uv/uv_hub.h> |
27 | #include <asm/uv/bios.h> | 27 | #include <asm/uv/bios.h> |
28 | 28 | ||
29 | DEFINE_PER_CPU(int, x2apic_extra_bits); | ||
30 | |||
31 | static enum uv_system_type uv_system_type; | ||
32 | |||
33 | static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
34 | { | ||
35 | if (!strcmp(oem_id, "SGI")) { | ||
36 | if (!strcmp(oem_table_id, "UVL")) | ||
37 | uv_system_type = UV_LEGACY_APIC; | ||
38 | else if (!strcmp(oem_table_id, "UVX")) | ||
39 | uv_system_type = UV_X2APIC; | ||
40 | else if (!strcmp(oem_table_id, "UVH")) { | ||
41 | uv_system_type = UV_NON_UNIQUE_APIC; | ||
42 | return 1; | ||
43 | } | ||
44 | } | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | enum uv_system_type get_uv_system_type(void) | ||
49 | { | ||
50 | return uv_system_type; | ||
51 | } | ||
52 | |||
53 | int is_uv_system(void) | ||
54 | { | ||
55 | return uv_system_type != UV_NONE; | ||
56 | } | ||
57 | EXPORT_SYMBOL_GPL(is_uv_system); | ||
58 | |||
29 | DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); | 59 | DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); |
30 | EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info); | 60 | EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info); |
31 | 61 | ||
@@ -123,6 +153,10 @@ static int uv_apic_id_registered(void) | |||
123 | return 1; | 153 | return 1; |
124 | } | 154 | } |
125 | 155 | ||
156 | static void uv_init_apic_ldr(void) | ||
157 | { | ||
158 | } | ||
159 | |||
126 | static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask) | 160 | static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask) |
127 | { | 161 | { |
128 | int cpu; | 162 | int cpu; |
@@ -138,9 +172,34 @@ static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask) | |||
138 | return BAD_APICID; | 172 | return BAD_APICID; |
139 | } | 173 | } |
140 | 174 | ||
175 | static unsigned int get_apic_id(unsigned long x) | ||
176 | { | ||
177 | unsigned int id; | ||
178 | |||
179 | WARN_ON(preemptible() && num_online_cpus() > 1); | ||
180 | id = x | __get_cpu_var(x2apic_extra_bits); | ||
181 | |||
182 | return id; | ||
183 | } | ||
184 | |||
185 | static unsigned long set_apic_id(unsigned int id) | ||
186 | { | ||
187 | unsigned long x; | ||
188 | |||
189 | /* maskout x2apic_extra_bits ? */ | ||
190 | x = id; | ||
191 | return x; | ||
192 | } | ||
193 | |||
194 | static unsigned int uv_read_apic_id(void) | ||
195 | { | ||
196 | |||
197 | return get_apic_id(apic_read(APIC_ID)); | ||
198 | } | ||
199 | |||
141 | static unsigned int phys_pkg_id(int index_msb) | 200 | static unsigned int phys_pkg_id(int index_msb) |
142 | { | 201 | { |
143 | return GET_APIC_ID(read_apic_id()) >> index_msb; | 202 | return uv_read_apic_id() >> index_msb; |
144 | } | 203 | } |
145 | 204 | ||
146 | #ifdef ZZZ /* Needs x2apic patch */ | 205 | #ifdef ZZZ /* Needs x2apic patch */ |
@@ -152,17 +211,22 @@ static void uv_send_IPI_self(int vector) | |||
152 | 211 | ||
153 | struct genapic apic_x2apic_uv_x = { | 212 | struct genapic apic_x2apic_uv_x = { |
154 | .name = "UV large system", | 213 | .name = "UV large system", |
214 | .acpi_madt_oem_check = uv_acpi_madt_oem_check, | ||
155 | .int_delivery_mode = dest_Fixed, | 215 | .int_delivery_mode = dest_Fixed, |
156 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 216 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), |
157 | .target_cpus = uv_target_cpus, | 217 | .target_cpus = uv_target_cpus, |
158 | .vector_allocation_domain = uv_vector_allocation_domain,/* Fixme ZZZ */ | 218 | .vector_allocation_domain = uv_vector_allocation_domain,/* Fixme ZZZ */ |
159 | .apic_id_registered = uv_apic_id_registered, | 219 | .apic_id_registered = uv_apic_id_registered, |
220 | .init_apic_ldr = uv_init_apic_ldr, | ||
160 | .send_IPI_all = uv_send_IPI_all, | 221 | .send_IPI_all = uv_send_IPI_all, |
161 | .send_IPI_allbutself = uv_send_IPI_allbutself, | 222 | .send_IPI_allbutself = uv_send_IPI_allbutself, |
162 | .send_IPI_mask = uv_send_IPI_mask, | 223 | .send_IPI_mask = uv_send_IPI_mask, |
163 | /* ZZZ.send_IPI_self = uv_send_IPI_self, */ | 224 | /* ZZZ.send_IPI_self = uv_send_IPI_self, */ |
164 | .cpu_mask_to_apicid = uv_cpu_mask_to_apicid, | 225 | .cpu_mask_to_apicid = uv_cpu_mask_to_apicid, |
165 | .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */ | 226 | .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */ |
227 | .get_apic_id = get_apic_id, | ||
228 | .set_apic_id = set_apic_id, | ||
229 | .apic_id_mask = (0xFFFFFFFFu), | ||
166 | }; | 230 | }; |
167 | 231 | ||
168 | static __cpuinit void set_x2apic_extra_bits(int pnode) | 232 | static __cpuinit void set_x2apic_extra_bits(int pnode) |
@@ -399,3 +463,5 @@ void __cpuinit uv_cpu_init(void) | |||
399 | if (get_uv_system_type() == UV_NON_UNIQUE_APIC) | 463 | if (get_uv_system_type() == UV_NON_UNIQUE_APIC) |
400 | set_x2apic_extra_bits(uv_hub_info->pnode); | 464 | set_x2apic_extra_bits(uv_hub_info->pnode); |
401 | } | 465 | } |
466 | |||
467 | |||
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index dc92b49d9204..4b8a53d841f7 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c | |||
@@ -282,6 +282,30 @@ static int __init i8259A_init_sysfs(void) | |||
282 | 282 | ||
283 | device_initcall(i8259A_init_sysfs); | 283 | device_initcall(i8259A_init_sysfs); |
284 | 284 | ||
285 | void mask_8259A(void) | ||
286 | { | ||
287 | unsigned long flags; | ||
288 | |||
289 | spin_lock_irqsave(&i8259A_lock, flags); | ||
290 | |||
291 | outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */ | ||
292 | outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */ | ||
293 | |||
294 | spin_unlock_irqrestore(&i8259A_lock, flags); | ||
295 | } | ||
296 | |||
297 | void unmask_8259A(void) | ||
298 | { | ||
299 | unsigned long flags; | ||
300 | |||
301 | spin_lock_irqsave(&i8259A_lock, flags); | ||
302 | |||
303 | outb(cached_master_mask, PIC_MASTER_IMR); /* restore master IRQ mask */ | ||
304 | outb(cached_slave_mask, PIC_SLAVE_IMR); /* restore slave IRQ mask */ | ||
305 | |||
306 | spin_unlock_irqrestore(&i8259A_lock, flags); | ||
307 | } | ||
308 | |||
285 | void init_8259A(int auto_eoi) | 309 | void init_8259A(int auto_eoi) |
286 | { | 310 | { |
287 | unsigned long flags; | 311 | unsigned long flags; |
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c index 09cddb57bec4..a0f4c27c822d 100644 --- a/arch/x86/kernel/io_apic_32.c +++ b/arch/x86/kernel/io_apic_32.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/nmi.h> | 46 | #include <asm/nmi.h> |
47 | #include <asm/msidef.h> | 47 | #include <asm/msidef.h> |
48 | #include <asm/hypertransport.h> | 48 | #include <asm/hypertransport.h> |
49 | #include <asm/setup.h> | ||
49 | 50 | ||
50 | #include <mach_apic.h> | 51 | #include <mach_apic.h> |
51 | #include <mach_apicdef.h> | 52 | #include <mach_apicdef.h> |
@@ -1482,6 +1483,7 @@ static void print_APIC_bitfield(int base) | |||
1482 | void /*__init*/ print_local_APIC(void *dummy) | 1483 | void /*__init*/ print_local_APIC(void *dummy) |
1483 | { | 1484 | { |
1484 | unsigned int v, ver, maxlvt; | 1485 | unsigned int v, ver, maxlvt; |
1486 | u64 icr; | ||
1485 | 1487 | ||
1486 | if (apic_verbosity == APIC_QUIET) | 1488 | if (apic_verbosity == APIC_QUIET) |
1487 | return; | 1489 | return; |
@@ -1490,7 +1492,7 @@ void /*__init*/ print_local_APIC(void *dummy) | |||
1490 | smp_processor_id(), hard_smp_processor_id()); | 1492 | smp_processor_id(), hard_smp_processor_id()); |
1491 | v = apic_read(APIC_ID); | 1493 | v = apic_read(APIC_ID); |
1492 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, | 1494 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, |
1493 | GET_APIC_ID(read_apic_id())); | 1495 | GET_APIC_ID(v)); |
1494 | v = apic_read(APIC_LVR); | 1496 | v = apic_read(APIC_LVR); |
1495 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); | 1497 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); |
1496 | ver = GET_APIC_VERSION(v); | 1498 | ver = GET_APIC_VERSION(v); |
@@ -1532,10 +1534,9 @@ void /*__init*/ print_local_APIC(void *dummy) | |||
1532 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); | 1534 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); |
1533 | } | 1535 | } |
1534 | 1536 | ||
1535 | v = apic_read(APIC_ICR); | 1537 | icr = apic_icr_read(); |
1536 | printk(KERN_DEBUG "... APIC ICR: %08x\n", v); | 1538 | printk(KERN_DEBUG "... APIC ICR: %08x\n", icr); |
1537 | v = apic_read(APIC_ICR2); | 1539 | printk(KERN_DEBUG "... APIC ICR2: %08x\n", icr >> 32); |
1538 | printk(KERN_DEBUG "... APIC ICR2: %08x\n", v); | ||
1539 | 1540 | ||
1540 | v = apic_read(APIC_LVTT); | 1541 | v = apic_read(APIC_LVTT); |
1541 | printk(KERN_DEBUG "... APIC LVTT: %08x\n", v); | 1542 | printk(KERN_DEBUG "... APIC LVTT: %08x\n", v); |
@@ -1698,8 +1699,7 @@ void disable_IO_APIC(void) | |||
1698 | entry.dest_mode = 0; /* Physical */ | 1699 | entry.dest_mode = 0; /* Physical */ |
1699 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ | 1700 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ |
1700 | entry.vector = 0; | 1701 | entry.vector = 0; |
1701 | entry.dest.physical.physical_dest = | 1702 | entry.dest.physical.physical_dest = read_apic_id(); |
1702 | GET_APIC_ID(read_apic_id()); | ||
1703 | 1703 | ||
1704 | /* | 1704 | /* |
1705 | * Add it to the IO-APIC irq-routing table: | 1705 | * Add it to the IO-APIC irq-routing table: |
@@ -1725,10 +1725,8 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
1725 | unsigned char old_id; | 1725 | unsigned char old_id; |
1726 | unsigned long flags; | 1726 | unsigned long flags; |
1727 | 1727 | ||
1728 | #ifdef CONFIG_X86_NUMAQ | 1728 | if (x86_quirks->setup_ioapic_ids && x86_quirks->setup_ioapic_ids()) |
1729 | if (found_numaq) | ||
1730 | return; | 1729 | return; |
1731 | #endif | ||
1732 | 1730 | ||
1733 | /* | 1731 | /* |
1734 | * Don't check I/O APIC IDs for xAPIC systems. They have | 1732 | * Don't check I/O APIC IDs for xAPIC systems. They have |
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c index 61a83b70c18f..e63282e78864 100644 --- a/arch/x86/kernel/io_apic_64.c +++ b/arch/x86/kernel/io_apic_64.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <acpi/acpi_bus.h> | 37 | #include <acpi/acpi_bus.h> |
38 | #endif | 38 | #endif |
39 | #include <linux/bootmem.h> | 39 | #include <linux/bootmem.h> |
40 | #include <linux/dmar.h> | ||
40 | 41 | ||
41 | #include <asm/idle.h> | 42 | #include <asm/idle.h> |
42 | #include <asm/io.h> | 43 | #include <asm/io.h> |
@@ -49,6 +50,7 @@ | |||
49 | #include <asm/nmi.h> | 50 | #include <asm/nmi.h> |
50 | #include <asm/msidef.h> | 51 | #include <asm/msidef.h> |
51 | #include <asm/hypertransport.h> | 52 | #include <asm/hypertransport.h> |
53 | #include <asm/irq_remapping.h> | ||
52 | 54 | ||
53 | #include <mach_ipi.h> | 55 | #include <mach_ipi.h> |
54 | #include <mach_apic.h> | 56 | #include <mach_apic.h> |
@@ -108,6 +110,9 @@ static DEFINE_SPINLOCK(vector_lock); | |||
108 | */ | 110 | */ |
109 | int nr_ioapic_registers[MAX_IO_APICS]; | 111 | int nr_ioapic_registers[MAX_IO_APICS]; |
110 | 112 | ||
113 | /* I/O APIC RTE contents at the OS boot up */ | ||
114 | struct IO_APIC_route_entry *early_ioapic_entries[MAX_IO_APICS]; | ||
115 | |||
111 | /* I/O APIC entries */ | 116 | /* I/O APIC entries */ |
112 | struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; | 117 | struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; |
113 | int nr_ioapics; | 118 | int nr_ioapics; |
@@ -303,7 +308,12 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector) | |||
303 | pin = entry->pin; | 308 | pin = entry->pin; |
304 | if (pin == -1) | 309 | if (pin == -1) |
305 | break; | 310 | break; |
306 | io_apic_write(apic, 0x11 + pin*2, dest); | 311 | /* |
312 | * With interrupt-remapping, destination information comes | ||
313 | * from interrupt-remapping table entry. | ||
314 | */ | ||
315 | if (!irq_remapped(irq)) | ||
316 | io_apic_write(apic, 0x11 + pin*2, dest); | ||
307 | reg = io_apic_read(apic, 0x10 + pin*2); | 317 | reg = io_apic_read(apic, 0x10 + pin*2); |
308 | reg &= ~IO_APIC_REDIR_VECTOR_MASK; | 318 | reg &= ~IO_APIC_REDIR_VECTOR_MASK; |
309 | reg |= vector; | 319 | reg |= vector; |
@@ -440,6 +450,69 @@ static void clear_IO_APIC (void) | |||
440 | clear_IO_APIC_pin(apic, pin); | 450 | clear_IO_APIC_pin(apic, pin); |
441 | } | 451 | } |
442 | 452 | ||
453 | /* | ||
454 | * Saves and masks all the unmasked IO-APIC RTE's | ||
455 | */ | ||
456 | int save_mask_IO_APIC_setup(void) | ||
457 | { | ||
458 | union IO_APIC_reg_01 reg_01; | ||
459 | unsigned long flags; | ||
460 | int apic, pin; | ||
461 | |||
462 | /* | ||
463 | * The number of IO-APIC IRQ registers (== #pins): | ||
464 | */ | ||
465 | for (apic = 0; apic < nr_ioapics; apic++) { | ||
466 | spin_lock_irqsave(&ioapic_lock, flags); | ||
467 | reg_01.raw = io_apic_read(apic, 1); | ||
468 | spin_unlock_irqrestore(&ioapic_lock, flags); | ||
469 | nr_ioapic_registers[apic] = reg_01.bits.entries+1; | ||
470 | } | ||
471 | |||
472 | for (apic = 0; apic < nr_ioapics; apic++) { | ||
473 | early_ioapic_entries[apic] = | ||
474 | kzalloc(sizeof(struct IO_APIC_route_entry) * | ||
475 | nr_ioapic_registers[apic], GFP_KERNEL); | ||
476 | if (!early_ioapic_entries[apic]) | ||
477 | return -ENOMEM; | ||
478 | } | ||
479 | |||
480 | for (apic = 0; apic < nr_ioapics; apic++) | ||
481 | for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { | ||
482 | struct IO_APIC_route_entry entry; | ||
483 | |||
484 | entry = early_ioapic_entries[apic][pin] = | ||
485 | ioapic_read_entry(apic, pin); | ||
486 | if (!entry.mask) { | ||
487 | entry.mask = 1; | ||
488 | ioapic_write_entry(apic, pin, entry); | ||
489 | } | ||
490 | } | ||
491 | return 0; | ||
492 | } | ||
493 | |||
494 | void restore_IO_APIC_setup(void) | ||
495 | { | ||
496 | int apic, pin; | ||
497 | |||
498 | for (apic = 0; apic < nr_ioapics; apic++) | ||
499 | for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) | ||
500 | ioapic_write_entry(apic, pin, | ||
501 | early_ioapic_entries[apic][pin]); | ||
502 | } | ||
503 | |||
504 | void reinit_intr_remapped_IO_APIC(int intr_remapping) | ||
505 | { | ||
506 | /* | ||
507 | * for now plain restore of previous settings. | ||
508 | * TBD: In the case of OS enabling interrupt-remapping, | ||
509 | * IO-APIC RTE's need to be setup to point to interrupt-remapping | ||
510 | * table entries. for now, do a plain restore, and wait for | ||
511 | * the setup_IO_APIC_irqs() to do proper initialization. | ||
512 | */ | ||
513 | restore_IO_APIC_setup(); | ||
514 | } | ||
515 | |||
443 | int skip_ioapic_setup; | 516 | int skip_ioapic_setup; |
444 | int ioapic_force; | 517 | int ioapic_force; |
445 | 518 | ||
@@ -839,18 +912,98 @@ void __setup_vector_irq(int cpu) | |||
839 | } | 912 | } |
840 | 913 | ||
841 | static struct irq_chip ioapic_chip; | 914 | static struct irq_chip ioapic_chip; |
915 | #ifdef CONFIG_INTR_REMAP | ||
916 | static struct irq_chip ir_ioapic_chip; | ||
917 | #endif | ||
842 | 918 | ||
843 | static void ioapic_register_intr(int irq, unsigned long trigger) | 919 | static void ioapic_register_intr(int irq, unsigned long trigger) |
844 | { | 920 | { |
845 | if (trigger) { | 921 | if (trigger) |
846 | irq_desc[irq].status |= IRQ_LEVEL; | 922 | irq_desc[irq].status |= IRQ_LEVEL; |
847 | set_irq_chip_and_handler_name(irq, &ioapic_chip, | 923 | else |
848 | handle_fasteoi_irq, "fasteoi"); | ||
849 | } else { | ||
850 | irq_desc[irq].status &= ~IRQ_LEVEL; | 924 | irq_desc[irq].status &= ~IRQ_LEVEL; |
925 | |||
926 | #ifdef CONFIG_INTR_REMAP | ||
927 | if (irq_remapped(irq)) { | ||
928 | irq_desc[irq].status |= IRQ_MOVE_PCNTXT; | ||
929 | if (trigger) | ||
930 | set_irq_chip_and_handler_name(irq, &ir_ioapic_chip, | ||
931 | handle_fasteoi_irq, | ||
932 | "fasteoi"); | ||
933 | else | ||
934 | set_irq_chip_and_handler_name(irq, &ir_ioapic_chip, | ||
935 | handle_edge_irq, "edge"); | ||
936 | return; | ||
937 | } | ||
938 | #endif | ||
939 | if (trigger) | ||
940 | set_irq_chip_and_handler_name(irq, &ioapic_chip, | ||
941 | handle_fasteoi_irq, | ||
942 | "fasteoi"); | ||
943 | else | ||
851 | set_irq_chip_and_handler_name(irq, &ioapic_chip, | 944 | set_irq_chip_and_handler_name(irq, &ioapic_chip, |
852 | handle_edge_irq, "edge"); | 945 | handle_edge_irq, "edge"); |
946 | } | ||
947 | |||
948 | static int setup_ioapic_entry(int apic, int irq, | ||
949 | struct IO_APIC_route_entry *entry, | ||
950 | unsigned int destination, int trigger, | ||
951 | int polarity, int vector) | ||
952 | { | ||
953 | /* | ||
954 | * add it to the IO-APIC irq-routing table: | ||
955 | */ | ||
956 | memset(entry,0,sizeof(*entry)); | ||
957 | |||
958 | #ifdef CONFIG_INTR_REMAP | ||
959 | if (intr_remapping_enabled) { | ||
960 | struct intel_iommu *iommu = map_ioapic_to_ir(apic); | ||
961 | struct irte irte; | ||
962 | struct IR_IO_APIC_route_entry *ir_entry = | ||
963 | (struct IR_IO_APIC_route_entry *) entry; | ||
964 | int index; | ||
965 | |||
966 | if (!iommu) | ||
967 | panic("No mapping iommu for ioapic %d\n", apic); | ||
968 | |||
969 | index = alloc_irte(iommu, irq, 1); | ||
970 | if (index < 0) | ||
971 | panic("Failed to allocate IRTE for ioapic %d\n", apic); | ||
972 | |||
973 | memset(&irte, 0, sizeof(irte)); | ||
974 | |||
975 | irte.present = 1; | ||
976 | irte.dst_mode = INT_DEST_MODE; | ||
977 | irte.trigger_mode = trigger; | ||
978 | irte.dlvry_mode = INT_DELIVERY_MODE; | ||
979 | irte.vector = vector; | ||
980 | irte.dest_id = IRTE_DEST(destination); | ||
981 | |||
982 | modify_irte(irq, &irte); | ||
983 | |||
984 | ir_entry->index2 = (index >> 15) & 0x1; | ||
985 | ir_entry->zero = 0; | ||
986 | ir_entry->format = 1; | ||
987 | ir_entry->index = (index & 0x7fff); | ||
988 | } else | ||
989 | #endif | ||
990 | { | ||
991 | entry->delivery_mode = INT_DELIVERY_MODE; | ||
992 | entry->dest_mode = INT_DEST_MODE; | ||
993 | entry->dest = destination; | ||
853 | } | 994 | } |
995 | |||
996 | entry->mask = 0; /* enable IRQ */ | ||
997 | entry->trigger = trigger; | ||
998 | entry->polarity = polarity; | ||
999 | entry->vector = vector; | ||
1000 | |||
1001 | /* Mask level triggered irqs. | ||
1002 | * Use IRQ_DELAYED_DISABLE for edge triggered irqs. | ||
1003 | */ | ||
1004 | if (trigger) | ||
1005 | entry->mask = 1; | ||
1006 | return 0; | ||
854 | } | 1007 | } |
855 | 1008 | ||
856 | static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, | 1009 | static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, |
@@ -875,24 +1028,15 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, | |||
875 | apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector, | 1028 | apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector, |
876 | irq, trigger, polarity); | 1029 | irq, trigger, polarity); |
877 | 1030 | ||
878 | /* | ||
879 | * add it to the IO-APIC irq-routing table: | ||
880 | */ | ||
881 | memset(&entry,0,sizeof(entry)); | ||
882 | 1031 | ||
883 | entry.delivery_mode = INT_DELIVERY_MODE; | 1032 | if (setup_ioapic_entry(mp_ioapics[apic].mp_apicid, irq, &entry, |
884 | entry.dest_mode = INT_DEST_MODE; | 1033 | cpu_mask_to_apicid(mask), trigger, polarity, |
885 | entry.dest = cpu_mask_to_apicid(mask); | 1034 | cfg->vector)) { |
886 | entry.mask = 0; /* enable IRQ */ | 1035 | printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", |
887 | entry.trigger = trigger; | 1036 | mp_ioapics[apic].mp_apicid, pin); |
888 | entry.polarity = polarity; | 1037 | __clear_irq_vector(irq); |
889 | entry.vector = cfg->vector; | 1038 | return; |
890 | 1039 | } | |
891 | /* Mask level triggered irqs. | ||
892 | * Use IRQ_DELAYED_DISABLE for edge triggered irqs. | ||
893 | */ | ||
894 | if (trigger) | ||
895 | entry.mask = 1; | ||
896 | 1040 | ||
897 | ioapic_register_intr(irq, trigger); | 1041 | ioapic_register_intr(irq, trigger); |
898 | if (irq < 16) | 1042 | if (irq < 16) |
@@ -944,6 +1088,9 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin, | |||
944 | { | 1088 | { |
945 | struct IO_APIC_route_entry entry; | 1089 | struct IO_APIC_route_entry entry; |
946 | 1090 | ||
1091 | if (intr_remapping_enabled) | ||
1092 | return; | ||
1093 | |||
947 | memset(&entry, 0, sizeof(entry)); | 1094 | memset(&entry, 0, sizeof(entry)); |
948 | 1095 | ||
949 | /* | 1096 | /* |
@@ -1090,6 +1237,7 @@ static __apicdebuginit void print_APIC_bitfield (int base) | |||
1090 | void __apicdebuginit print_local_APIC(void * dummy) | 1237 | void __apicdebuginit print_local_APIC(void * dummy) |
1091 | { | 1238 | { |
1092 | unsigned int v, ver, maxlvt; | 1239 | unsigned int v, ver, maxlvt; |
1240 | unsigned long icr; | ||
1093 | 1241 | ||
1094 | if (apic_verbosity == APIC_QUIET) | 1242 | if (apic_verbosity == APIC_QUIET) |
1095 | return; | 1243 | return; |
@@ -1097,7 +1245,7 @@ void __apicdebuginit print_local_APIC(void * dummy) | |||
1097 | printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", | 1245 | printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", |
1098 | smp_processor_id(), hard_smp_processor_id()); | 1246 | smp_processor_id(), hard_smp_processor_id()); |
1099 | v = apic_read(APIC_ID); | 1247 | v = apic_read(APIC_ID); |
1100 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(read_apic_id())); | 1248 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, read_apic_id()); |
1101 | v = apic_read(APIC_LVR); | 1249 | v = apic_read(APIC_LVR); |
1102 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); | 1250 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); |
1103 | ver = GET_APIC_VERSION(v); | 1251 | ver = GET_APIC_VERSION(v); |
@@ -1133,10 +1281,9 @@ void __apicdebuginit print_local_APIC(void * dummy) | |||
1133 | v = apic_read(APIC_ESR); | 1281 | v = apic_read(APIC_ESR); |
1134 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); | 1282 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); |
1135 | 1283 | ||
1136 | v = apic_read(APIC_ICR); | 1284 | icr = apic_icr_read(); |
1137 | printk(KERN_DEBUG "... APIC ICR: %08x\n", v); | 1285 | printk(KERN_DEBUG "... APIC ICR: %08x\n", icr); |
1138 | v = apic_read(APIC_ICR2); | 1286 | printk(KERN_DEBUG "... APIC ICR2: %08x\n", icr >> 32); |
1139 | printk(KERN_DEBUG "... APIC ICR2: %08x\n", v); | ||
1140 | 1287 | ||
1141 | v = apic_read(APIC_LVTT); | 1288 | v = apic_read(APIC_LVTT); |
1142 | printk(KERN_DEBUG "... APIC LVTT: %08x\n", v); | 1289 | printk(KERN_DEBUG "... APIC LVTT: %08x\n", v); |
@@ -1291,7 +1438,7 @@ void disable_IO_APIC(void) | |||
1291 | entry.dest_mode = 0; /* Physical */ | 1438 | entry.dest_mode = 0; /* Physical */ |
1292 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ | 1439 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ |
1293 | entry.vector = 0; | 1440 | entry.vector = 0; |
1294 | entry.dest = GET_APIC_ID(read_apic_id()); | 1441 | entry.dest = read_apic_id(); |
1295 | 1442 | ||
1296 | /* | 1443 | /* |
1297 | * Add it to the IO-APIC irq-routing table: | 1444 | * Add it to the IO-APIC irq-routing table: |
@@ -1397,6 +1544,147 @@ static int ioapic_retrigger_irq(unsigned int irq) | |||
1397 | */ | 1544 | */ |
1398 | 1545 | ||
1399 | #ifdef CONFIG_SMP | 1546 | #ifdef CONFIG_SMP |
1547 | |||
1548 | #ifdef CONFIG_INTR_REMAP | ||
1549 | static void ir_irq_migration(struct work_struct *work); | ||
1550 | |||
1551 | static DECLARE_DELAYED_WORK(ir_migration_work, ir_irq_migration); | ||
1552 | |||
1553 | /* | ||
1554 | * Migrate the IO-APIC irq in the presence of intr-remapping. | ||
1555 | * | ||
1556 | * For edge triggered, irq migration is a simple atomic update(of vector | ||
1557 | * and cpu destination) of IRTE and flush the hardware cache. | ||
1558 | * | ||
1559 | * For level triggered, we need to modify the io-apic RTE aswell with the update | ||
1560 | * vector information, along with modifying IRTE with vector and destination. | ||
1561 | * So irq migration for level triggered is little bit more complex compared to | ||
1562 | * edge triggered migration. But the good news is, we use the same algorithm | ||
1563 | * for level triggered migration as we have today, only difference being, | ||
1564 | * we now initiate the irq migration from process context instead of the | ||
1565 | * interrupt context. | ||
1566 | * | ||
1567 | * In future, when we do a directed EOI (combined with cpu EOI broadcast | ||
1568 | * suppression) to the IO-APIC, level triggered irq migration will also be | ||
1569 | * as simple as edge triggered migration and we can do the irq migration | ||
1570 | * with a simple atomic update to IO-APIC RTE. | ||
1571 | */ | ||
1572 | static void migrate_ioapic_irq(int irq, cpumask_t mask) | ||
1573 | { | ||
1574 | struct irq_cfg *cfg = irq_cfg + irq; | ||
1575 | struct irq_desc *desc = irq_desc + irq; | ||
1576 | cpumask_t tmp, cleanup_mask; | ||
1577 | struct irte irte; | ||
1578 | int modify_ioapic_rte = desc->status & IRQ_LEVEL; | ||
1579 | unsigned int dest; | ||
1580 | unsigned long flags; | ||
1581 | |||
1582 | cpus_and(tmp, mask, cpu_online_map); | ||
1583 | if (cpus_empty(tmp)) | ||
1584 | return; | ||
1585 | |||
1586 | if (get_irte(irq, &irte)) | ||
1587 | return; | ||
1588 | |||
1589 | if (assign_irq_vector(irq, mask)) | ||
1590 | return; | ||
1591 | |||
1592 | cpus_and(tmp, cfg->domain, mask); | ||
1593 | dest = cpu_mask_to_apicid(tmp); | ||
1594 | |||
1595 | if (modify_ioapic_rte) { | ||
1596 | spin_lock_irqsave(&ioapic_lock, flags); | ||
1597 | __target_IO_APIC_irq(irq, dest, cfg->vector); | ||
1598 | spin_unlock_irqrestore(&ioapic_lock, flags); | ||
1599 | } | ||
1600 | |||
1601 | irte.vector = cfg->vector; | ||
1602 | irte.dest_id = IRTE_DEST(dest); | ||
1603 | |||
1604 | /* | ||
1605 | * Modified the IRTE and flushes the Interrupt entry cache. | ||
1606 | */ | ||
1607 | modify_irte(irq, &irte); | ||
1608 | |||
1609 | if (cfg->move_in_progress) { | ||
1610 | cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); | ||
1611 | cfg->move_cleanup_count = cpus_weight(cleanup_mask); | ||
1612 | send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR); | ||
1613 | cfg->move_in_progress = 0; | ||
1614 | } | ||
1615 | |||
1616 | irq_desc[irq].affinity = mask; | ||
1617 | } | ||
1618 | |||
1619 | static int migrate_irq_remapped_level(int irq) | ||
1620 | { | ||
1621 | int ret = -1; | ||
1622 | |||
1623 | mask_IO_APIC_irq(irq); | ||
1624 | |||
1625 | if (io_apic_level_ack_pending(irq)) { | ||
1626 | /* | ||
1627 | * Interrupt in progress. Migrating irq now will change the | ||
1628 | * vector information in the IO-APIC RTE and that will confuse | ||
1629 | * the EOI broadcast performed by cpu. | ||
1630 | * So, delay the irq migration to the next instance. | ||
1631 | */ | ||
1632 | schedule_delayed_work(&ir_migration_work, 1); | ||
1633 | goto unmask; | ||
1634 | } | ||
1635 | |||
1636 | /* everthing is clear. we have right of way */ | ||
1637 | migrate_ioapic_irq(irq, irq_desc[irq].pending_mask); | ||
1638 | |||
1639 | ret = 0; | ||
1640 | irq_desc[irq].status &= ~IRQ_MOVE_PENDING; | ||
1641 | cpus_clear(irq_desc[irq].pending_mask); | ||
1642 | |||
1643 | unmask: | ||
1644 | unmask_IO_APIC_irq(irq); | ||
1645 | return ret; | ||
1646 | } | ||
1647 | |||
1648 | static void ir_irq_migration(struct work_struct *work) | ||
1649 | { | ||
1650 | int irq; | ||
1651 | |||
1652 | for (irq = 0; irq < NR_IRQS; irq++) { | ||
1653 | struct irq_desc *desc = irq_desc + irq; | ||
1654 | if (desc->status & IRQ_MOVE_PENDING) { | ||
1655 | unsigned long flags; | ||
1656 | |||
1657 | spin_lock_irqsave(&desc->lock, flags); | ||
1658 | if (!desc->chip->set_affinity || | ||
1659 | !(desc->status & IRQ_MOVE_PENDING)) { | ||
1660 | desc->status &= ~IRQ_MOVE_PENDING; | ||
1661 | spin_unlock_irqrestore(&desc->lock, flags); | ||
1662 | continue; | ||
1663 | } | ||
1664 | |||
1665 | desc->chip->set_affinity(irq, | ||
1666 | irq_desc[irq].pending_mask); | ||
1667 | spin_unlock_irqrestore(&desc->lock, flags); | ||
1668 | } | ||
1669 | } | ||
1670 | } | ||
1671 | |||
1672 | /* | ||
1673 | * Migrates the IRQ destination in the process context. | ||
1674 | */ | ||
1675 | static void set_ir_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) | ||
1676 | { | ||
1677 | if (irq_desc[irq].status & IRQ_LEVEL) { | ||
1678 | irq_desc[irq].status |= IRQ_MOVE_PENDING; | ||
1679 | irq_desc[irq].pending_mask = mask; | ||
1680 | migrate_irq_remapped_level(irq); | ||
1681 | return; | ||
1682 | } | ||
1683 | |||
1684 | migrate_ioapic_irq(irq, mask); | ||
1685 | } | ||
1686 | #endif | ||
1687 | |||
1400 | asmlinkage void smp_irq_move_cleanup_interrupt(void) | 1688 | asmlinkage void smp_irq_move_cleanup_interrupt(void) |
1401 | { | 1689 | { |
1402 | unsigned vector, me; | 1690 | unsigned vector, me; |
@@ -1453,6 +1741,17 @@ static void irq_complete_move(unsigned int irq) | |||
1453 | #else | 1741 | #else |
1454 | static inline void irq_complete_move(unsigned int irq) {} | 1742 | static inline void irq_complete_move(unsigned int irq) {} |
1455 | #endif | 1743 | #endif |
1744 | #ifdef CONFIG_INTR_REMAP | ||
1745 | static void ack_x2apic_level(unsigned int irq) | ||
1746 | { | ||
1747 | ack_x2APIC_irq(); | ||
1748 | } | ||
1749 | |||
1750 | static void ack_x2apic_edge(unsigned int irq) | ||
1751 | { | ||
1752 | ack_x2APIC_irq(); | ||
1753 | } | ||
1754 | #endif | ||
1456 | 1755 | ||
1457 | static void ack_apic_edge(unsigned int irq) | 1756 | static void ack_apic_edge(unsigned int irq) |
1458 | { | 1757 | { |
@@ -1527,6 +1826,21 @@ static struct irq_chip ioapic_chip __read_mostly = { | |||
1527 | .retrigger = ioapic_retrigger_irq, | 1826 | .retrigger = ioapic_retrigger_irq, |
1528 | }; | 1827 | }; |
1529 | 1828 | ||
1829 | #ifdef CONFIG_INTR_REMAP | ||
1830 | static struct irq_chip ir_ioapic_chip __read_mostly = { | ||
1831 | .name = "IR-IO-APIC", | ||
1832 | .startup = startup_ioapic_irq, | ||
1833 | .mask = mask_IO_APIC_irq, | ||
1834 | .unmask = unmask_IO_APIC_irq, | ||
1835 | .ack = ack_x2apic_edge, | ||
1836 | .eoi = ack_x2apic_level, | ||
1837 | #ifdef CONFIG_SMP | ||
1838 | .set_affinity = set_ir_ioapic_affinity_irq, | ||
1839 | #endif | ||
1840 | .retrigger = ioapic_retrigger_irq, | ||
1841 | }; | ||
1842 | #endif | ||
1843 | |||
1530 | static inline void init_IO_APIC_traps(void) | 1844 | static inline void init_IO_APIC_traps(void) |
1531 | { | 1845 | { |
1532 | int irq; | 1846 | int irq; |
@@ -1712,6 +2026,8 @@ static inline void __init check_timer(void) | |||
1712 | * 8259A. | 2026 | * 8259A. |
1713 | */ | 2027 | */ |
1714 | if (pin1 == -1) { | 2028 | if (pin1 == -1) { |
2029 | if (intr_remapping_enabled) | ||
2030 | panic("BIOS bug: timer not connected to IO-APIC"); | ||
1715 | pin1 = pin2; | 2031 | pin1 = pin2; |
1716 | apic1 = apic2; | 2032 | apic1 = apic2; |
1717 | no_pin1 = 1; | 2033 | no_pin1 = 1; |
@@ -1738,6 +2054,8 @@ static inline void __init check_timer(void) | |||
1738 | clear_IO_APIC_pin(0, pin1); | 2054 | clear_IO_APIC_pin(0, pin1); |
1739 | goto out; | 2055 | goto out; |
1740 | } | 2056 | } |
2057 | if (intr_remapping_enabled) | ||
2058 | panic("timer doesn't work through Interrupt-remapped IO-APIC"); | ||
1741 | clear_IO_APIC_pin(apic1, pin1); | 2059 | clear_IO_APIC_pin(apic1, pin1); |
1742 | if (!no_pin1) | 2060 | if (!no_pin1) |
1743 | apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: " | 2061 | apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: " |
@@ -1977,6 +2295,9 @@ void destroy_irq(unsigned int irq) | |||
1977 | 2295 | ||
1978 | dynamic_irq_cleanup(irq); | 2296 | dynamic_irq_cleanup(irq); |
1979 | 2297 | ||
2298 | #ifdef CONFIG_INTR_REMAP | ||
2299 | free_irte(irq); | ||
2300 | #endif | ||
1980 | spin_lock_irqsave(&vector_lock, flags); | 2301 | spin_lock_irqsave(&vector_lock, flags); |
1981 | __clear_irq_vector(irq); | 2302 | __clear_irq_vector(irq); |
1982 | spin_unlock_irqrestore(&vector_lock, flags); | 2303 | spin_unlock_irqrestore(&vector_lock, flags); |
@@ -1995,11 +2316,42 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms | |||
1995 | 2316 | ||
1996 | tmp = TARGET_CPUS; | 2317 | tmp = TARGET_CPUS; |
1997 | err = assign_irq_vector(irq, tmp); | 2318 | err = assign_irq_vector(irq, tmp); |
1998 | if (!err) { | 2319 | if (err) |
1999 | cpus_and(tmp, cfg->domain, tmp); | 2320 | return err; |
2000 | dest = cpu_mask_to_apicid(tmp); | 2321 | |
2322 | cpus_and(tmp, cfg->domain, tmp); | ||
2323 | dest = cpu_mask_to_apicid(tmp); | ||
2324 | |||
2325 | #ifdef CONFIG_INTR_REMAP | ||
2326 | if (irq_remapped(irq)) { | ||
2327 | struct irte irte; | ||
2328 | int ir_index; | ||
2329 | u16 sub_handle; | ||
2330 | |||
2331 | ir_index = map_irq_to_irte_handle(irq, &sub_handle); | ||
2332 | BUG_ON(ir_index == -1); | ||
2333 | |||
2334 | memset (&irte, 0, sizeof(irte)); | ||
2335 | |||
2336 | irte.present = 1; | ||
2337 | irte.dst_mode = INT_DEST_MODE; | ||
2338 | irte.trigger_mode = 0; /* edge */ | ||
2339 | irte.dlvry_mode = INT_DELIVERY_MODE; | ||
2340 | irte.vector = cfg->vector; | ||
2341 | irte.dest_id = IRTE_DEST(dest); | ||
2342 | |||
2343 | modify_irte(irq, &irte); | ||
2001 | 2344 | ||
2002 | msg->address_hi = MSI_ADDR_BASE_HI; | 2345 | msg->address_hi = MSI_ADDR_BASE_HI; |
2346 | msg->data = sub_handle; | ||
2347 | msg->address_lo = MSI_ADDR_BASE_LO | MSI_ADDR_IR_EXT_INT | | ||
2348 | MSI_ADDR_IR_SHV | | ||
2349 | MSI_ADDR_IR_INDEX1(ir_index) | | ||
2350 | MSI_ADDR_IR_INDEX2(ir_index); | ||
2351 | } else | ||
2352 | #endif | ||
2353 | { | ||
2354 | msg->address_hi = MSI_ADDR_BASE_HI; | ||
2003 | msg->address_lo = | 2355 | msg->address_lo = |
2004 | MSI_ADDR_BASE_LO | | 2356 | MSI_ADDR_BASE_LO | |
2005 | ((INT_DEST_MODE == 0) ? | 2357 | ((INT_DEST_MODE == 0) ? |
@@ -2049,6 +2401,55 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | |||
2049 | write_msi_msg(irq, &msg); | 2401 | write_msi_msg(irq, &msg); |
2050 | irq_desc[irq].affinity = mask; | 2402 | irq_desc[irq].affinity = mask; |
2051 | } | 2403 | } |
2404 | |||
2405 | #ifdef CONFIG_INTR_REMAP | ||
2406 | /* | ||
2407 | * Migrate the MSI irq to another cpumask. This migration is | ||
2408 | * done in the process context using interrupt-remapping hardware. | ||
2409 | */ | ||
2410 | static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | ||
2411 | { | ||
2412 | struct irq_cfg *cfg = irq_cfg + irq; | ||
2413 | unsigned int dest; | ||
2414 | cpumask_t tmp, cleanup_mask; | ||
2415 | struct irte irte; | ||
2416 | |||
2417 | cpus_and(tmp, mask, cpu_online_map); | ||
2418 | if (cpus_empty(tmp)) | ||
2419 | return; | ||
2420 | |||
2421 | if (get_irte(irq, &irte)) | ||
2422 | return; | ||
2423 | |||
2424 | if (assign_irq_vector(irq, mask)) | ||
2425 | return; | ||
2426 | |||
2427 | cpus_and(tmp, cfg->domain, mask); | ||
2428 | dest = cpu_mask_to_apicid(tmp); | ||
2429 | |||
2430 | irte.vector = cfg->vector; | ||
2431 | irte.dest_id = IRTE_DEST(dest); | ||
2432 | |||
2433 | /* | ||
2434 | * atomically update the IRTE with the new destination and vector. | ||
2435 | */ | ||
2436 | modify_irte(irq, &irte); | ||
2437 | |||
2438 | /* | ||
2439 | * After this point, all the interrupts will start arriving | ||
2440 | * at the new destination. So, time to cleanup the previous | ||
2441 | * vector allocation. | ||
2442 | */ | ||
2443 | if (cfg->move_in_progress) { | ||
2444 | cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); | ||
2445 | cfg->move_cleanup_count = cpus_weight(cleanup_mask); | ||
2446 | send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR); | ||
2447 | cfg->move_in_progress = 0; | ||
2448 | } | ||
2449 | |||
2450 | irq_desc[irq].affinity = mask; | ||
2451 | } | ||
2452 | #endif | ||
2052 | #endif /* CONFIG_SMP */ | 2453 | #endif /* CONFIG_SMP */ |
2053 | 2454 | ||
2054 | /* | 2455 | /* |
@@ -2066,26 +2467,157 @@ static struct irq_chip msi_chip = { | |||
2066 | .retrigger = ioapic_retrigger_irq, | 2467 | .retrigger = ioapic_retrigger_irq, |
2067 | }; | 2468 | }; |
2068 | 2469 | ||
2069 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) | 2470 | #ifdef CONFIG_INTR_REMAP |
2471 | static struct irq_chip msi_ir_chip = { | ||
2472 | .name = "IR-PCI-MSI", | ||
2473 | .unmask = unmask_msi_irq, | ||
2474 | .mask = mask_msi_irq, | ||
2475 | .ack = ack_x2apic_edge, | ||
2476 | #ifdef CONFIG_SMP | ||
2477 | .set_affinity = ir_set_msi_irq_affinity, | ||
2478 | #endif | ||
2479 | .retrigger = ioapic_retrigger_irq, | ||
2480 | }; | ||
2481 | |||
2482 | /* | ||
2483 | * Map the PCI dev to the corresponding remapping hardware unit | ||
2484 | * and allocate 'nvec' consecutive interrupt-remapping table entries | ||
2485 | * in it. | ||
2486 | */ | ||
2487 | static int msi_alloc_irte(struct pci_dev *dev, int irq, int nvec) | ||
2488 | { | ||
2489 | struct intel_iommu *iommu; | ||
2490 | int index; | ||
2491 | |||
2492 | iommu = map_dev_to_ir(dev); | ||
2493 | if (!iommu) { | ||
2494 | printk(KERN_ERR | ||
2495 | "Unable to map PCI %s to iommu\n", pci_name(dev)); | ||
2496 | return -ENOENT; | ||
2497 | } | ||
2498 | |||
2499 | index = alloc_irte(iommu, irq, nvec); | ||
2500 | if (index < 0) { | ||
2501 | printk(KERN_ERR | ||
2502 | "Unable to allocate %d IRTE for PCI %s\n", nvec, | ||
2503 | pci_name(dev)); | ||
2504 | return -ENOSPC; | ||
2505 | } | ||
2506 | return index; | ||
2507 | } | ||
2508 | #endif | ||
2509 | |||
2510 | static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq) | ||
2070 | { | 2511 | { |
2512 | int ret; | ||
2071 | struct msi_msg msg; | 2513 | struct msi_msg msg; |
2514 | |||
2515 | ret = msi_compose_msg(dev, irq, &msg); | ||
2516 | if (ret < 0) | ||
2517 | return ret; | ||
2518 | |||
2519 | set_irq_msi(irq, desc); | ||
2520 | write_msi_msg(irq, &msg); | ||
2521 | |||
2522 | #ifdef CONFIG_INTR_REMAP | ||
2523 | if (irq_remapped(irq)) { | ||
2524 | struct irq_desc *desc = irq_desc + irq; | ||
2525 | /* | ||
2526 | * irq migration in process context | ||
2527 | */ | ||
2528 | desc->status |= IRQ_MOVE_PCNTXT; | ||
2529 | set_irq_chip_and_handler_name(irq, &msi_ir_chip, handle_edge_irq, "edge"); | ||
2530 | } else | ||
2531 | #endif | ||
2532 | set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); | ||
2533 | |||
2534 | return 0; | ||
2535 | } | ||
2536 | |||
2537 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) | ||
2538 | { | ||
2072 | int irq, ret; | 2539 | int irq, ret; |
2540 | |||
2073 | irq = create_irq(); | 2541 | irq = create_irq(); |
2074 | if (irq < 0) | 2542 | if (irq < 0) |
2075 | return irq; | 2543 | return irq; |
2076 | 2544 | ||
2077 | ret = msi_compose_msg(dev, irq, &msg); | 2545 | #ifdef CONFIG_INTR_REMAP |
2546 | if (!intr_remapping_enabled) | ||
2547 | goto no_ir; | ||
2548 | |||
2549 | ret = msi_alloc_irte(dev, irq, 1); | ||
2550 | if (ret < 0) | ||
2551 | goto error; | ||
2552 | no_ir: | ||
2553 | #endif | ||
2554 | ret = setup_msi_irq(dev, desc, irq); | ||
2078 | if (ret < 0) { | 2555 | if (ret < 0) { |
2079 | destroy_irq(irq); | 2556 | destroy_irq(irq); |
2080 | return ret; | 2557 | return ret; |
2081 | } | 2558 | } |
2559 | return 0; | ||
2082 | 2560 | ||
2083 | set_irq_msi(irq, desc); | 2561 | #ifdef CONFIG_INTR_REMAP |
2084 | write_msi_msg(irq, &msg); | 2562 | error: |
2563 | destroy_irq(irq); | ||
2564 | return ret; | ||
2565 | #endif | ||
2566 | } | ||
2085 | 2567 | ||
2086 | set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); | 2568 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) |
2569 | { | ||
2570 | int irq, ret, sub_handle; | ||
2571 | struct msi_desc *desc; | ||
2572 | #ifdef CONFIG_INTR_REMAP | ||
2573 | struct intel_iommu *iommu = 0; | ||
2574 | int index = 0; | ||
2575 | #endif | ||
2087 | 2576 | ||
2577 | sub_handle = 0; | ||
2578 | list_for_each_entry(desc, &dev->msi_list, list) { | ||
2579 | irq = create_irq(); | ||
2580 | if (irq < 0) | ||
2581 | return irq; | ||
2582 | #ifdef CONFIG_INTR_REMAP | ||
2583 | if (!intr_remapping_enabled) | ||
2584 | goto no_ir; | ||
2585 | |||
2586 | if (!sub_handle) { | ||
2587 | /* | ||
2588 | * allocate the consecutive block of IRTE's | ||
2589 | * for 'nvec' | ||
2590 | */ | ||
2591 | index = msi_alloc_irte(dev, irq, nvec); | ||
2592 | if (index < 0) { | ||
2593 | ret = index; | ||
2594 | goto error; | ||
2595 | } | ||
2596 | } else { | ||
2597 | iommu = map_dev_to_ir(dev); | ||
2598 | if (!iommu) { | ||
2599 | ret = -ENOENT; | ||
2600 | goto error; | ||
2601 | } | ||
2602 | /* | ||
2603 | * setup the mapping between the irq and the IRTE | ||
2604 | * base index, the sub_handle pointing to the | ||
2605 | * appropriate interrupt remap table entry. | ||
2606 | */ | ||
2607 | set_irte_irq(irq, iommu, index, sub_handle); | ||
2608 | } | ||
2609 | no_ir: | ||
2610 | #endif | ||
2611 | ret = setup_msi_irq(dev, desc, irq); | ||
2612 | if (ret < 0) | ||
2613 | goto error; | ||
2614 | sub_handle++; | ||
2615 | } | ||
2088 | return 0; | 2616 | return 0; |
2617 | |||
2618 | error: | ||
2619 | destroy_irq(irq); | ||
2620 | return ret; | ||
2089 | } | 2621 | } |
2090 | 2622 | ||
2091 | void arch_teardown_msi_irq(unsigned int irq) | 2623 | void arch_teardown_msi_irq(unsigned int irq) |
@@ -2333,6 +2865,10 @@ void __init setup_ioapic_dest(void) | |||
2333 | setup_IO_APIC_irq(ioapic, pin, irq, | 2865 | setup_IO_APIC_irq(ioapic, pin, irq, |
2334 | irq_trigger(irq_entry), | 2866 | irq_trigger(irq_entry), |
2335 | irq_polarity(irq_entry)); | 2867 | irq_polarity(irq_entry)); |
2868 | #ifdef CONFIG_INTR_REMAP | ||
2869 | else if (intr_remapping_enabled) | ||
2870 | set_ir_ioapic_affinity_irq(irq, TARGET_CPUS); | ||
2871 | #endif | ||
2336 | else | 2872 | else |
2337 | set_ioapic_affinity_irq(irq, TARGET_CPUS); | 2873 | set_ioapic_affinity_irq(irq, TARGET_CPUS); |
2338 | } | 2874 | } |
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c index d66914287ee1..9200a1e2752d 100644 --- a/arch/x86/kernel/irqinit_32.c +++ b/arch/x86/kernel/irqinit_32.c | |||
@@ -74,6 +74,15 @@ void __init init_ISA_irqs (void) | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | /* | ||
78 | * IRQ2 is cascade interrupt to second interrupt controller | ||
79 | */ | ||
80 | static struct irqaction irq2 = { | ||
81 | .handler = no_action, | ||
82 | .mask = CPU_MASK_NONE, | ||
83 | .name = "cascade", | ||
84 | }; | ||
85 | |||
77 | /* Overridden in paravirt.c */ | 86 | /* Overridden in paravirt.c */ |
78 | void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ"))); | 87 | void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ"))); |
79 | 88 | ||
@@ -98,6 +107,46 @@ void __init native_init_IRQ(void) | |||
98 | set_intr_gate(vector, interrupt[i]); | 107 | set_intr_gate(vector, interrupt[i]); |
99 | } | 108 | } |
100 | 109 | ||
110 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_SMP) | ||
111 | /* | ||
112 | * IRQ0 must be given a fixed assignment and initialized, | ||
113 | * because it's used before the IO-APIC is set up. | ||
114 | */ | ||
115 | set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]); | ||
116 | |||
117 | /* | ||
118 | * The reschedule interrupt is a CPU-to-CPU reschedule-helper | ||
119 | * IPI, driven by wakeup. | ||
120 | */ | ||
121 | alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); | ||
122 | |||
123 | /* IPI for invalidation */ | ||
124 | alloc_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt); | ||
125 | |||
126 | /* IPI for generic function call */ | ||
127 | alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); | ||
128 | |||
129 | /* IPI for single call function */ | ||
130 | set_intr_gate(CALL_FUNCTION_SINGLE_VECTOR, call_function_single_interrupt); | ||
131 | #endif | ||
132 | |||
133 | #ifdef CONFIG_X86_LOCAL_APIC | ||
134 | /* self generated IPI for local APIC timer */ | ||
135 | alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt); | ||
136 | |||
137 | /* IPI vectors for APIC spurious and error interrupts */ | ||
138 | alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); | ||
139 | alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt); | ||
140 | #endif | ||
141 | |||
142 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_MCE_P4THERMAL) | ||
143 | /* thermal monitor LVT interrupt */ | ||
144 | alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); | ||
145 | #endif | ||
146 | |||
147 | if (!acpi_ioapic) | ||
148 | setup_irq(2, &irq2); | ||
149 | |||
101 | /* setup after call gates are initialised (usually add in | 150 | /* setup after call gates are initialised (usually add in |
102 | * the architecture specific gates) | 151 | * the architecture specific gates) |
103 | */ | 152 | */ |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 678090508a62..e5d23675bb7c 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -397,7 +397,9 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early) | |||
397 | generic_bigsmp_probe(); | 397 | generic_bigsmp_probe(); |
398 | #endif | 398 | #endif |
399 | 399 | ||
400 | #ifdef CONFIG_X86_32 | ||
400 | setup_apic_routing(); | 401 | setup_apic_routing(); |
402 | #endif | ||
401 | if (!num_processors) | 403 | if (!num_processors) |
402 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); | 404 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); |
403 | return num_processors; | 405 | return num_processors; |
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c index b8c45610b20a..2434467ddf72 100644 --- a/arch/x86/kernel/numaq_32.c +++ b/arch/x86/kernel/numaq_32.c | |||
@@ -229,6 +229,12 @@ static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable, | |||
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | static int __init numaq_setup_ioapic_ids(void) | ||
233 | { | ||
234 | /* so can skip it */ | ||
235 | return 1; | ||
236 | } | ||
237 | |||
232 | static struct x86_quirks numaq_x86_quirks __initdata = { | 238 | static struct x86_quirks numaq_x86_quirks __initdata = { |
233 | .arch_pre_time_init = numaq_pre_time_init, | 239 | .arch_pre_time_init = numaq_pre_time_init, |
234 | .arch_time_init = NULL, | 240 | .arch_time_init = NULL, |
@@ -243,6 +249,7 @@ static struct x86_quirks numaq_x86_quirks __initdata = { | |||
243 | .mpc_oem_bus_info = mpc_oem_bus_info, | 249 | .mpc_oem_bus_info = mpc_oem_bus_info, |
244 | .mpc_oem_pci_bus = mpc_oem_pci_bus, | 250 | .mpc_oem_pci_bus = mpc_oem_pci_bus, |
245 | .smp_read_mpc_oem = smp_read_mpc_oem, | 251 | .smp_read_mpc_oem = smp_read_mpc_oem, |
252 | .setup_ioapic_ids = numaq_setup_ioapic_ids, | ||
246 | }; | 253 | }; |
247 | 254 | ||
248 | void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, | 255 | void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 94da4d52d798..5744789a78f4 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -373,8 +373,6 @@ struct pv_cpu_ops pv_cpu_ops = { | |||
373 | 373 | ||
374 | struct pv_apic_ops pv_apic_ops = { | 374 | struct pv_apic_ops pv_apic_ops = { |
375 | #ifdef CONFIG_X86_LOCAL_APIC | 375 | #ifdef CONFIG_X86_LOCAL_APIC |
376 | .apic_write = native_apic_write, | ||
377 | .apic_read = native_apic_read, | ||
378 | .setup_boot_clock = setup_boot_APIC_clock, | 376 | .setup_boot_clock = setup_boot_APIC_clock, |
379 | .setup_secondary_clock = setup_secondary_APIC_clock, | 377 | .setup_secondary_clock = setup_secondary_APIC_clock, |
380 | .startup_ipi_hook = paravirt_nop, | 378 | .startup_ipi_hook = paravirt_nop, |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 68b48e3fbcbd..59f07e14d083 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -739,6 +739,8 @@ void __init setup_arch(char **cmdline_p) | |||
739 | num_physpages = max_pfn; | 739 | num_physpages = max_pfn; |
740 | 740 | ||
741 | check_efer(); | 741 | check_efer(); |
742 | if (cpu_has_x2apic) | ||
743 | check_x2apic(); | ||
742 | 744 | ||
743 | /* How many end-of-memory variables you have, grandma! */ | 745 | /* How many end-of-memory variables you have, grandma! */ |
744 | /* need this before calling reserve_initrd */ | 746 | /* need this before calling reserve_initrd */ |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index 76e305e064f9..0e67f72d9316 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -162,9 +162,16 @@ void __init setup_per_cpu_areas(void) | |||
162 | printk(KERN_INFO | 162 | printk(KERN_INFO |
163 | "cpu %d has no node %d or node-local memory\n", | 163 | "cpu %d has no node %d or node-local memory\n", |
164 | cpu, node); | 164 | cpu, node); |
165 | if (ptr) | ||
166 | printk(KERN_DEBUG "per cpu data for cpu%d at %016lx\n", | ||
167 | cpu, __pa(ptr)); | ||
165 | } | 168 | } |
166 | else | 169 | else { |
167 | ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); | 170 | ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); |
171 | if (ptr) | ||
172 | printk(KERN_DEBUG "per cpu data for cpu%d on node%d at %016lx\n", | ||
173 | cpu, node, __pa(ptr)); | ||
174 | } | ||
168 | #endif | 175 | #endif |
169 | per_cpu_offset(cpu) = ptr - __per_cpu_start; | 176 | per_cpu_offset(cpu) = ptr - __per_cpu_start; |
170 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); | 177 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); |
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c index 02b02583f5b5..2f1464050059 100644 --- a/arch/x86/kernel/signal_64.c +++ b/arch/x86/kernel/signal_64.c | |||
@@ -105,7 +105,16 @@ static inline int restore_i387(struct _fpstate __user *buf) | |||
105 | clts(); | 105 | clts(); |
106 | task_thread_info(current)->status |= TS_USEDFPU; | 106 | task_thread_info(current)->status |= TS_USEDFPU; |
107 | } | 107 | } |
108 | return restore_fpu_checking((__force struct i387_fxsave_struct *)buf); | 108 | err = restore_fpu_checking((__force struct i387_fxsave_struct *)buf); |
109 | if (unlikely(err)) { | ||
110 | /* | ||
111 | * Encountered an error while doing the restore from the | ||
112 | * user buffer, clear the fpu state. | ||
113 | */ | ||
114 | clear_fpu(tsk); | ||
115 | clear_used_math(); | ||
116 | } | ||
117 | return err; | ||
109 | } | 118 | } |
110 | 119 | ||
111 | /* | 120 | /* |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 6112c3632345..0133a952d11f 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -123,7 +123,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info); | |||
123 | 123 | ||
124 | static atomic_t init_deasserted; | 124 | static atomic_t init_deasserted; |
125 | 125 | ||
126 | static int boot_cpu_logical_apicid; | ||
127 | 126 | ||
128 | /* representing cpus for which sibling maps can be computed */ | 127 | /* representing cpus for which sibling maps can be computed */ |
129 | static cpumask_t cpu_sibling_setup_map; | 128 | static cpumask_t cpu_sibling_setup_map; |
@@ -165,6 +164,8 @@ static void unmap_cpu_to_node(int cpu) | |||
165 | #endif | 164 | #endif |
166 | 165 | ||
167 | #ifdef CONFIG_X86_32 | 166 | #ifdef CONFIG_X86_32 |
167 | static int boot_cpu_logical_apicid; | ||
168 | |||
168 | u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = | 169 | u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = |
169 | { [0 ... NR_CPUS-1] = BAD_APICID }; | 170 | { [0 ... NR_CPUS-1] = BAD_APICID }; |
170 | 171 | ||
@@ -210,7 +211,7 @@ static void __cpuinit smp_callin(void) | |||
210 | /* | 211 | /* |
211 | * (This works even if the APIC is not enabled.) | 212 | * (This works even if the APIC is not enabled.) |
212 | */ | 213 | */ |
213 | phys_id = GET_APIC_ID(read_apic_id()); | 214 | phys_id = read_apic_id(); |
214 | cpuid = smp_processor_id(); | 215 | cpuid = smp_processor_id(); |
215 | if (cpu_isset(cpuid, cpu_callin_map)) { | 216 | if (cpu_isset(cpuid, cpu_callin_map)) { |
216 | panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, | 217 | panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, |
@@ -550,8 +551,7 @@ static inline void __inquire_remote_apic(int apicid) | |||
550 | printk(KERN_CONT | 551 | printk(KERN_CONT |
551 | "a previous APIC delivery may have failed\n"); | 552 | "a previous APIC delivery may have failed\n"); |
552 | 553 | ||
553 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(apicid)); | 554 | apic_icr_write(APIC_DM_REMRD | regs[i], apicid); |
554 | apic_write(APIC_ICR, APIC_DM_REMRD | regs[i]); | ||
555 | 555 | ||
556 | timeout = 0; | 556 | timeout = 0; |
557 | do { | 557 | do { |
@@ -583,11 +583,9 @@ wakeup_secondary_cpu(int logical_apicid, unsigned long start_eip) | |||
583 | int maxlvt; | 583 | int maxlvt; |
584 | 584 | ||
585 | /* Target chip */ | 585 | /* Target chip */ |
586 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(logical_apicid)); | ||
587 | |||
588 | /* Boot on the stack */ | 586 | /* Boot on the stack */ |
589 | /* Kick the second */ | 587 | /* Kick the second */ |
590 | apic_write(APIC_ICR, APIC_DM_NMI | APIC_DEST_LOGICAL); | 588 | apic_icr_write(APIC_DM_NMI | APIC_DEST_LOGICAL, logical_apicid); |
591 | 589 | ||
592 | pr_debug("Waiting for send to finish...\n"); | 590 | pr_debug("Waiting for send to finish...\n"); |
593 | send_status = safe_apic_wait_icr_idle(); | 591 | send_status = safe_apic_wait_icr_idle(); |
@@ -640,13 +638,11 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip) | |||
640 | /* | 638 | /* |
641 | * Turn INIT on target chip | 639 | * Turn INIT on target chip |
642 | */ | 640 | */ |
643 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | ||
644 | |||
645 | /* | 641 | /* |
646 | * Send IPI | 642 | * Send IPI |
647 | */ | 643 | */ |
648 | apic_write(APIC_ICR, | 644 | apic_icr_write(APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT, |
649 | APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT); | 645 | phys_apicid); |
650 | 646 | ||
651 | pr_debug("Waiting for send to finish...\n"); | 647 | pr_debug("Waiting for send to finish...\n"); |
652 | send_status = safe_apic_wait_icr_idle(); | 648 | send_status = safe_apic_wait_icr_idle(); |
@@ -656,10 +652,8 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip) | |||
656 | pr_debug("Deasserting INIT.\n"); | 652 | pr_debug("Deasserting INIT.\n"); |
657 | 653 | ||
658 | /* Target chip */ | 654 | /* Target chip */ |
659 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | ||
660 | |||
661 | /* Send IPI */ | 655 | /* Send IPI */ |
662 | apic_write(APIC_ICR, APIC_INT_LEVELTRIG | APIC_DM_INIT); | 656 | apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid); |
663 | 657 | ||
664 | pr_debug("Waiting for send to finish...\n"); | 658 | pr_debug("Waiting for send to finish...\n"); |
665 | send_status = safe_apic_wait_icr_idle(); | 659 | send_status = safe_apic_wait_icr_idle(); |
@@ -702,11 +696,10 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip) | |||
702 | */ | 696 | */ |
703 | 697 | ||
704 | /* Target chip */ | 698 | /* Target chip */ |
705 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | ||
706 | |||
707 | /* Boot on the stack */ | 699 | /* Boot on the stack */ |
708 | /* Kick the second */ | 700 | /* Kick the second */ |
709 | apic_write(APIC_ICR, APIC_DM_STARTUP | (start_eip >> 12)); | 701 | apic_icr_write(APIC_DM_STARTUP | (start_eip >> 12), |
702 | phys_apicid); | ||
710 | 703 | ||
711 | /* | 704 | /* |
712 | * Give the other CPU some time to accept the IPI. | 705 | * Give the other CPU some time to accept the IPI. |
@@ -1150,10 +1143,17 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1150 | * Setup boot CPU information | 1143 | * Setup boot CPU information |
1151 | */ | 1144 | */ |
1152 | smp_store_cpu_info(0); /* Final full version of the data */ | 1145 | smp_store_cpu_info(0); /* Final full version of the data */ |
1146 | #ifdef CONFIG_X86_32 | ||
1153 | boot_cpu_logical_apicid = logical_smp_processor_id(); | 1147 | boot_cpu_logical_apicid = logical_smp_processor_id(); |
1148 | #endif | ||
1154 | current_thread_info()->cpu = 0; /* needed? */ | 1149 | current_thread_info()->cpu = 0; /* needed? */ |
1155 | set_cpu_sibling_map(0); | 1150 | set_cpu_sibling_map(0); |
1156 | 1151 | ||
1152 | #ifdef CONFIG_X86_64 | ||
1153 | enable_IR_x2apic(); | ||
1154 | setup_apic_routing(); | ||
1155 | #endif | ||
1156 | |||
1157 | if (smp_sanity_check(max_cpus) < 0) { | 1157 | if (smp_sanity_check(max_cpus) < 0) { |
1158 | printk(KERN_INFO "SMP disabled\n"); | 1158 | printk(KERN_INFO "SMP disabled\n"); |
1159 | disable_smp(); | 1159 | disable_smp(); |
@@ -1161,9 +1161,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | preempt_disable(); | 1163 | preempt_disable(); |
1164 | if (GET_APIC_ID(read_apic_id()) != boot_cpu_physical_apicid) { | 1164 | if (read_apic_id() != boot_cpu_physical_apicid) { |
1165 | panic("Boot APIC ID in local APIC unexpected (%d vs %d)", | 1165 | panic("Boot APIC ID in local APIC unexpected (%d vs %d)", |
1166 | GET_APIC_ID(read_apic_id()), boot_cpu_physical_apicid); | 1166 | read_apic_id(), boot_cpu_physical_apicid); |
1167 | /* Or can we switch back to PIC here? */ | 1167 | /* Or can we switch back to PIC here? */ |
1168 | } | 1168 | } |
1169 | preempt_enable(); | 1169 | preempt_enable(); |
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c index d67ce5f044ba..7b987852e876 100644 --- a/arch/x86/kernel/summit_32.c +++ b/arch/x86/kernel/summit_32.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | #include <asm/bios_ebda.h> | 32 | #include <asm/bios_ebda.h> |
33 | #include <asm/mach-summit/mach_mpparse.h> | 33 | #include <asm/summit/mpparse.h> |
34 | 34 | ||
35 | static struct rio_table_hdr *rio_table_hdr __initdata; | 35 | static struct rio_table_hdr *rio_table_hdr __initdata; |
36 | static struct scal_detail *scal_devs[MAX_NUMNODES] __initdata; | 36 | static struct scal_detail *scal_devs[MAX_NUMNODES] __initdata; |
diff --git a/arch/x86/kernel/syscall_64.c b/arch/x86/kernel/syscall_64.c index 170d43c17487..3d1be4f0fac5 100644 --- a/arch/x86/kernel/syscall_64.c +++ b/arch/x86/kernel/syscall_64.c | |||
@@ -8,12 +8,12 @@ | |||
8 | #define __NO_STUBS | 8 | #define __NO_STUBS |
9 | 9 | ||
10 | #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; | 10 | #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; |
11 | #undef _ASM_X86_64_UNISTD_H_ | 11 | #undef ASM_X86__UNISTD_64_H |
12 | #include <asm/unistd_64.h> | 12 | #include <asm/unistd_64.h> |
13 | 13 | ||
14 | #undef __SYSCALL | 14 | #undef __SYSCALL |
15 | #define __SYSCALL(nr, sym) [nr] = sym, | 15 | #define __SYSCALL(nr, sym) [nr] = sym, |
16 | #undef _ASM_X86_64_UNISTD_H_ | 16 | #undef ASM_X86__UNISTD_64_H |
17 | 17 | ||
18 | typedef void (*sys_call_ptr_t)(void); | 18 | typedef void (*sys_call_ptr_t)(void); |
19 | 19 | ||
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c index 3f18d73f420c..513caaca7115 100644 --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c | |||
@@ -1131,7 +1131,14 @@ asmlinkage void math_state_restore(void) | |||
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | clts(); /* Allow maths ops (or we recurse) */ | 1133 | clts(); /* Allow maths ops (or we recurse) */ |
1134 | restore_fpu_checking(&me->thread.xstate->fxsave); | 1134 | /* |
1135 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | ||
1136 | */ | ||
1137 | if (unlikely(restore_fpu_checking(&me->thread.xstate->fxsave))) { | ||
1138 | stts(); | ||
1139 | force_sig(SIGSEGV, me); | ||
1140 | return; | ||
1141 | } | ||
1135 | task_thread_info(me)->status |= TS_USEDFPU; | 1142 | task_thread_info(me)->status |= TS_USEDFPU; |
1136 | me->fpu_counter++; | 1143 | me->fpu_counter++; |
1137 | } | 1144 | } |
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index 6ca515d6db54..61531d5c9507 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -905,8 +905,8 @@ static inline int __init activate_vmi(void) | |||
905 | #endif | 905 | #endif |
906 | 906 | ||
907 | #ifdef CONFIG_X86_LOCAL_APIC | 907 | #ifdef CONFIG_X86_LOCAL_APIC |
908 | para_fill(pv_apic_ops.apic_read, APICRead); | 908 | para_fill(apic_ops->read, APICRead); |
909 | para_fill(pv_apic_ops.apic_write, APICWrite); | 909 | para_fill(apic_ops->write, APICWrite); |
910 | #endif | 910 | #endif |
911 | 911 | ||
912 | /* | 912 | /* |
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index d9249a882aa5..65f0b8a47bed 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/lguest_launcher.h> | 55 | #include <linux/lguest_launcher.h> |
56 | #include <linux/virtio_console.h> | 56 | #include <linux/virtio_console.h> |
57 | #include <linux/pm.h> | 57 | #include <linux/pm.h> |
58 | #include <asm/apic.h> | ||
58 | #include <asm/lguest.h> | 59 | #include <asm/lguest.h> |
59 | #include <asm/paravirt.h> | 60 | #include <asm/paravirt.h> |
60 | #include <asm/param.h> | 61 | #include <asm/param.h> |
@@ -783,14 +784,44 @@ static void lguest_wbinvd(void) | |||
783 | * code qualifies for Advanced. It will also never interrupt anything. It | 784 | * code qualifies for Advanced. It will also never interrupt anything. It |
784 | * does, however, allow us to get through the Linux boot code. */ | 785 | * does, however, allow us to get through the Linux boot code. */ |
785 | #ifdef CONFIG_X86_LOCAL_APIC | 786 | #ifdef CONFIG_X86_LOCAL_APIC |
786 | static void lguest_apic_write(unsigned long reg, u32 v) | 787 | static void lguest_apic_write(u32 reg, u32 v) |
787 | { | 788 | { |
788 | } | 789 | } |
789 | 790 | ||
790 | static u32 lguest_apic_read(unsigned long reg) | 791 | static u32 lguest_apic_read(u32 reg) |
791 | { | 792 | { |
792 | return 0; | 793 | return 0; |
793 | } | 794 | } |
795 | |||
796 | static u64 lguest_apic_icr_read(void) | ||
797 | { | ||
798 | return 0; | ||
799 | } | ||
800 | |||
801 | static void lguest_apic_icr_write(u32 low, u32 id) | ||
802 | { | ||
803 | /* Warn to see if there's any stray references */ | ||
804 | WARN_ON(1); | ||
805 | } | ||
806 | |||
807 | static void lguest_apic_wait_icr_idle(void) | ||
808 | { | ||
809 | return; | ||
810 | } | ||
811 | |||
812 | static u32 lguest_apic_safe_wait_icr_idle(void) | ||
813 | { | ||
814 | return 0; | ||
815 | } | ||
816 | |||
817 | static struct apic_ops lguest_basic_apic_ops = { | ||
818 | .read = lguest_apic_read, | ||
819 | .write = lguest_apic_write, | ||
820 | .icr_read = lguest_apic_icr_read, | ||
821 | .icr_write = lguest_apic_icr_write, | ||
822 | .wait_icr_idle = lguest_apic_wait_icr_idle, | ||
823 | .safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle, | ||
824 | }; | ||
794 | #endif | 825 | #endif |
795 | 826 | ||
796 | /* STOP! Until an interrupt comes in. */ | 827 | /* STOP! Until an interrupt comes in. */ |
@@ -990,8 +1021,7 @@ __init void lguest_init(void) | |||
990 | 1021 | ||
991 | #ifdef CONFIG_X86_LOCAL_APIC | 1022 | #ifdef CONFIG_X86_LOCAL_APIC |
992 | /* apic read/write intercepts */ | 1023 | /* apic read/write intercepts */ |
993 | pv_apic_ops.apic_write = lguest_apic_write; | 1024 | apic_ops = &lguest_basic_apic_ops; |
994 | pv_apic_ops.apic_read = lguest_apic_read; | ||
995 | #endif | 1025 | #endif |
996 | 1026 | ||
997 | /* time operations */ | 1027 | /* time operations */ |
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c index 3f2cf11f201a..37b9ae4d44c5 100644 --- a/arch/x86/mach-default/setup.c +++ b/arch/x86/mach-default/setup.c | |||
@@ -38,15 +38,6 @@ void __init pre_intr_init_hook(void) | |||
38 | init_ISA_irqs(); | 38 | init_ISA_irqs(); |
39 | } | 39 | } |
40 | 40 | ||
41 | /* | ||
42 | * IRQ2 is cascade interrupt to second interrupt controller | ||
43 | */ | ||
44 | static struct irqaction irq2 = { | ||
45 | .handler = no_action, | ||
46 | .mask = CPU_MASK_NONE, | ||
47 | .name = "cascade", | ||
48 | }; | ||
49 | |||
50 | /** | 41 | /** |
51 | * intr_init_hook - post gate setup interrupt initialisation | 42 | * intr_init_hook - post gate setup interrupt initialisation |
52 | * | 43 | * |
@@ -62,12 +53,6 @@ void __init intr_init_hook(void) | |||
62 | if (x86_quirks->arch_intr_init()) | 53 | if (x86_quirks->arch_intr_init()) |
63 | return; | 54 | return; |
64 | } | 55 | } |
65 | #ifdef CONFIG_X86_LOCAL_APIC | ||
66 | apic_intr_init(); | ||
67 | #endif | ||
68 | |||
69 | if (!acpi_ioapic) | ||
70 | setup_irq(2, &irq2); | ||
71 | } | 56 | } |
72 | 57 | ||
73 | /** | 58 | /** |
diff --git a/arch/x86/mach-generic/Makefile b/arch/x86/mach-generic/Makefile index 0dbd7803a1d5..4706de7676b1 100644 --- a/arch/x86/mach-generic/Makefile +++ b/arch/x86/mach-generic/Makefile | |||
@@ -9,4 +9,4 @@ obj-$(CONFIG_X86_NUMAQ) += numaq.o | |||
9 | obj-$(CONFIG_X86_SUMMIT) += summit.o | 9 | obj-$(CONFIG_X86_SUMMIT) += summit.o |
10 | obj-$(CONFIG_X86_BIGSMP) += bigsmp.o | 10 | obj-$(CONFIG_X86_BIGSMP) += bigsmp.o |
11 | obj-$(CONFIG_X86_ES7000) += es7000.o | 11 | obj-$(CONFIG_X86_ES7000) += es7000.o |
12 | obj-$(CONFIG_X86_ES7000) += ../../x86/mach-es7000/ | 12 | obj-$(CONFIG_X86_ES7000) += ../../x86/es7000/ |
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c index 59d771714559..df37fc9d6a26 100644 --- a/arch/x86/mach-generic/bigsmp.c +++ b/arch/x86/mach-generic/bigsmp.c | |||
@@ -5,18 +5,17 @@ | |||
5 | #define APIC_DEFINITION 1 | 5 | #define APIC_DEFINITION 1 |
6 | #include <linux/threads.h> | 6 | #include <linux/threads.h> |
7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
8 | #include <asm/smp.h> | ||
9 | #include <asm/mpspec.h> | 8 | #include <asm/mpspec.h> |
10 | #include <asm/genapic.h> | 9 | #include <asm/genapic.h> |
11 | #include <asm/fixmap.h> | 10 | #include <asm/fixmap.h> |
12 | #include <asm/apicdef.h> | 11 | #include <asm/apicdef.h> |
13 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | 13 | #include <linux/init.h> |
16 | #include <linux/dmi.h> | 14 | #include <linux/dmi.h> |
17 | #include <asm/mach-bigsmp/mach_apic.h> | 15 | #include <asm/bigsmp/apicdef.h> |
18 | #include <asm/mach-bigsmp/mach_apicdef.h> | 16 | #include <linux/smp.h> |
19 | #include <asm/mach-bigsmp/mach_ipi.h> | 17 | #include <asm/bigsmp/apic.h> |
18 | #include <asm/bigsmp/ipi.h> | ||
20 | #include <asm/mach-default/mach_mpparse.h> | 19 | #include <asm/mach-default/mach_mpparse.h> |
21 | 20 | ||
22 | static int dmi_bigsmp; /* can be set by dmi scanners */ | 21 | static int dmi_bigsmp; /* can be set by dmi scanners */ |
diff --git a/arch/x86/mach-generic/es7000.c b/arch/x86/mach-generic/es7000.c index 4742626f08c4..520cca0ee04e 100644 --- a/arch/x86/mach-generic/es7000.c +++ b/arch/x86/mach-generic/es7000.c | |||
@@ -4,20 +4,19 @@ | |||
4 | #define APIC_DEFINITION 1 | 4 | #define APIC_DEFINITION 1 |
5 | #include <linux/threads.h> | 5 | #include <linux/threads.h> |
6 | #include <linux/cpumask.h> | 6 | #include <linux/cpumask.h> |
7 | #include <asm/smp.h> | ||
8 | #include <asm/mpspec.h> | 7 | #include <asm/mpspec.h> |
9 | #include <asm/genapic.h> | 8 | #include <asm/genapic.h> |
10 | #include <asm/fixmap.h> | 9 | #include <asm/fixmap.h> |
11 | #include <asm/apicdef.h> | 10 | #include <asm/apicdef.h> |
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
13 | #include <linux/string.h> | 12 | #include <linux/string.h> |
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | 13 | #include <linux/init.h> |
16 | #include <asm/mach-es7000/mach_apicdef.h> | 14 | #include <asm/es7000/apicdef.h> |
17 | #include <asm/mach-es7000/mach_apic.h> | 15 | #include <linux/smp.h> |
18 | #include <asm/mach-es7000/mach_ipi.h> | 16 | #include <asm/es7000/apic.h> |
19 | #include <asm/mach-es7000/mach_mpparse.h> | 17 | #include <asm/es7000/ipi.h> |
20 | #include <asm/mach-es7000/mach_wakecpu.h> | 18 | #include <asm/es7000/mpparse.h> |
19 | #include <asm/es7000/wakecpu.h> | ||
21 | 20 | ||
22 | static int probe_es7000(void) | 21 | static int probe_es7000(void) |
23 | { | 22 | { |
diff --git a/arch/x86/mach-generic/numaq.c b/arch/x86/mach-generic/numaq.c index 8091e68764c4..8cf58394975e 100644 --- a/arch/x86/mach-generic/numaq.c +++ b/arch/x86/mach-generic/numaq.c | |||
@@ -4,7 +4,6 @@ | |||
4 | #define APIC_DEFINITION 1 | 4 | #define APIC_DEFINITION 1 |
5 | #include <linux/threads.h> | 5 | #include <linux/threads.h> |
6 | #include <linux/cpumask.h> | 6 | #include <linux/cpumask.h> |
7 | #include <linux/smp.h> | ||
8 | #include <asm/mpspec.h> | 7 | #include <asm/mpspec.h> |
9 | #include <asm/genapic.h> | 8 | #include <asm/genapic.h> |
10 | #include <asm/fixmap.h> | 9 | #include <asm/fixmap.h> |
@@ -12,11 +11,12 @@ | |||
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
13 | #include <linux/string.h> | 12 | #include <linux/string.h> |
14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
15 | #include <asm/mach-numaq/mach_apic.h> | 14 | #include <asm/numaq/apicdef.h> |
16 | #include <asm/mach-numaq/mach_apicdef.h> | 15 | #include <linux/smp.h> |
17 | #include <asm/mach-numaq/mach_ipi.h> | 16 | #include <asm/numaq/apic.h> |
18 | #include <asm/mach-numaq/mach_mpparse.h> | 17 | #include <asm/numaq/ipi.h> |
19 | #include <asm/mach-numaq/mach_wakecpu.h> | 18 | #include <asm/numaq/mpparse.h> |
19 | #include <asm/numaq/wakecpu.h> | ||
20 | #include <asm/numaq.h> | 20 | #include <asm/numaq.h> |
21 | 21 | ||
22 | static int mps_oem_check(struct mp_config_table *mpc, char *oem, | 22 | static int mps_oem_check(struct mp_config_table *mpc, char *oem, |
diff --git a/arch/x86/mach-generic/summit.c b/arch/x86/mach-generic/summit.c index a97ea0f35b1e..6ad6b67a723d 100644 --- a/arch/x86/mach-generic/summit.c +++ b/arch/x86/mach-generic/summit.c | |||
@@ -4,19 +4,18 @@ | |||
4 | #define APIC_DEFINITION 1 | 4 | #define APIC_DEFINITION 1 |
5 | #include <linux/threads.h> | 5 | #include <linux/threads.h> |
6 | #include <linux/cpumask.h> | 6 | #include <linux/cpumask.h> |
7 | #include <asm/smp.h> | ||
8 | #include <asm/mpspec.h> | 7 | #include <asm/mpspec.h> |
9 | #include <asm/genapic.h> | 8 | #include <asm/genapic.h> |
10 | #include <asm/fixmap.h> | 9 | #include <asm/fixmap.h> |
11 | #include <asm/apicdef.h> | 10 | #include <asm/apicdef.h> |
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
13 | #include <linux/string.h> | 12 | #include <linux/string.h> |
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | 13 | #include <linux/init.h> |
16 | #include <asm/mach-summit/mach_apic.h> | 14 | #include <asm/summit/apicdef.h> |
17 | #include <asm/mach-summit/mach_apicdef.h> | 15 | #include <linux/smp.h> |
18 | #include <asm/mach-summit/mach_ipi.h> | 16 | #include <asm/summit/apic.h> |
19 | #include <asm/mach-summit/mach_mpparse.h> | 17 | #include <asm/summit/ipi.h> |
18 | #include <asm/summit/mpparse.h> | ||
20 | 19 | ||
21 | static int probe_summit(void) | 20 | static int probe_summit(void) |
22 | { | 21 | { |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 9ff6e3cbf08f..8d28925ebed9 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <xen/hvc-console.h> | 36 | #include <xen/hvc-console.h> |
37 | 37 | ||
38 | #include <asm/paravirt.h> | 38 | #include <asm/paravirt.h> |
39 | #include <asm/apic.h> | ||
39 | #include <asm/page.h> | 40 | #include <asm/page.h> |
40 | #include <asm/xen/hypercall.h> | 41 | #include <asm/xen/hypercall.h> |
41 | #include <asm/xen/hypervisor.h> | 42 | #include <asm/xen/hypervisor.h> |
@@ -580,16 +581,47 @@ static void xen_io_delay(void) | |||
580 | } | 581 | } |
581 | 582 | ||
582 | #ifdef CONFIG_X86_LOCAL_APIC | 583 | #ifdef CONFIG_X86_LOCAL_APIC |
583 | static u32 xen_apic_read(unsigned long reg) | 584 | static u32 xen_apic_read(u32 reg) |
584 | { | 585 | { |
585 | return 0; | 586 | return 0; |
586 | } | 587 | } |
587 | 588 | ||
588 | static void xen_apic_write(unsigned long reg, u32 val) | 589 | static void xen_apic_write(u32 reg, u32 val) |
589 | { | 590 | { |
590 | /* Warn to see if there's any stray references */ | 591 | /* Warn to see if there's any stray references */ |
591 | WARN_ON(1); | 592 | WARN_ON(1); |
592 | } | 593 | } |
594 | |||
595 | static u64 xen_apic_icr_read(void) | ||
596 | { | ||
597 | return 0; | ||
598 | } | ||
599 | |||
600 | static void xen_apic_icr_write(u32 low, u32 id) | ||
601 | { | ||
602 | /* Warn to see if there's any stray references */ | ||
603 | WARN_ON(1); | ||
604 | } | ||
605 | |||
606 | static void xen_apic_wait_icr_idle(void) | ||
607 | { | ||
608 | return; | ||
609 | } | ||
610 | |||
611 | static u32 xen_safe_apic_wait_icr_idle(void) | ||
612 | { | ||
613 | return 0; | ||
614 | } | ||
615 | |||
616 | static struct apic_ops xen_basic_apic_ops = { | ||
617 | .read = xen_apic_read, | ||
618 | .write = xen_apic_write, | ||
619 | .icr_read = xen_apic_icr_read, | ||
620 | .icr_write = xen_apic_icr_write, | ||
621 | .wait_icr_idle = xen_apic_wait_icr_idle, | ||
622 | .safe_wait_icr_idle = xen_safe_apic_wait_icr_idle, | ||
623 | }; | ||
624 | |||
593 | #endif | 625 | #endif |
594 | 626 | ||
595 | static void xen_flush_tlb(void) | 627 | static void xen_flush_tlb(void) |
@@ -1273,8 +1305,6 @@ static const struct pv_irq_ops xen_irq_ops __initdata = { | |||
1273 | 1305 | ||
1274 | static const struct pv_apic_ops xen_apic_ops __initdata = { | 1306 | static const struct pv_apic_ops xen_apic_ops __initdata = { |
1275 | #ifdef CONFIG_X86_LOCAL_APIC | 1307 | #ifdef CONFIG_X86_LOCAL_APIC |
1276 | .apic_write = xen_apic_write, | ||
1277 | .apic_read = xen_apic_read, | ||
1278 | .setup_boot_clock = paravirt_nop, | 1308 | .setup_boot_clock = paravirt_nop, |
1279 | .setup_secondary_clock = paravirt_nop, | 1309 | .setup_secondary_clock = paravirt_nop, |
1280 | .startup_ipi_hook = paravirt_nop, | 1310 | .startup_ipi_hook = paravirt_nop, |
@@ -1677,6 +1707,13 @@ asmlinkage void __init xen_start_kernel(void) | |||
1677 | pv_apic_ops = xen_apic_ops; | 1707 | pv_apic_ops = xen_apic_ops; |
1678 | pv_mmu_ops = xen_mmu_ops; | 1708 | pv_mmu_ops = xen_mmu_ops; |
1679 | 1709 | ||
1710 | #ifdef CONFIG_X86_LOCAL_APIC | ||
1711 | /* | ||
1712 | * set up the basic apic ops. | ||
1713 | */ | ||
1714 | apic_ops = &xen_basic_apic_ops; | ||
1715 | #endif | ||
1716 | |||
1680 | if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { | 1717 | if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { |
1681 | pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; | 1718 | pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; |
1682 | pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; | 1719 | pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; |