diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ppc64 |
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-ppc64')
166 files changed, 16954 insertions, 0 deletions
diff --git a/include/asm-ppc64/8253pit.h b/include/asm-ppc64/8253pit.h new file mode 100644 index 000000000000..285f78488ccb --- /dev/null +++ b/include/asm-ppc64/8253pit.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * 8253/8254 Programmable Interval Timer | ||
3 | */ | ||
4 | |||
5 | #ifndef _8253PIT_H | ||
6 | #define _8253PIT_H | ||
7 | |||
8 | #define PIT_TICK_RATE 1193182UL | ||
9 | |||
10 | #endif | ||
diff --git a/include/asm-ppc64/a.out.h b/include/asm-ppc64/a.out.h new file mode 100644 index 000000000000..802338efcb19 --- /dev/null +++ b/include/asm-ppc64/a.out.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef __PPC64_A_OUT_H__ | ||
2 | #define __PPC64_A_OUT_H__ | ||
3 | |||
4 | #include <asm/ppcdebug.h> | ||
5 | |||
6 | /* | ||
7 | * c 2001 PPC 64 Team, IBM Corp | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | struct exec | ||
16 | { | ||
17 | unsigned long a_info; /* Use macros N_MAGIC, etc for access */ | ||
18 | unsigned a_text; /* length of text, in bytes */ | ||
19 | unsigned a_data; /* length of data, in bytes */ | ||
20 | unsigned a_bss; /* length of uninitialized data area for file, in bytes */ | ||
21 | unsigned a_syms; /* length of symbol table data in file, in bytes */ | ||
22 | unsigned a_entry; /* start address */ | ||
23 | unsigned a_trsize; /* length of relocation info for text, in bytes */ | ||
24 | unsigned a_drsize; /* length of relocation info for data, in bytes */ | ||
25 | }; | ||
26 | |||
27 | #define N_TRSIZE(a) ((a).a_trsize) | ||
28 | #define N_DRSIZE(a) ((a).a_drsize) | ||
29 | #define N_SYMSIZE(a) ((a).a_syms) | ||
30 | |||
31 | #ifdef __KERNEL__ | ||
32 | |||
33 | #define STACK_TOP_USER64 TASK_SIZE_USER64 | ||
34 | #define STACK_TOP_USER32 TASK_SIZE_USER32 | ||
35 | |||
36 | #define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ | ||
37 | STACK_TOP_USER32 : STACK_TOP_USER64) | ||
38 | |||
39 | #endif /* __KERNEL__ */ | ||
40 | |||
41 | #endif /* __PPC64_A_OUT_H__ */ | ||
diff --git a/include/asm-ppc64/abs_addr.h b/include/asm-ppc64/abs_addr.h new file mode 100644 index 000000000000..6d4e8e787058 --- /dev/null +++ b/include/asm-ppc64/abs_addr.h | |||
@@ -0,0 +1,108 @@ | |||
1 | #ifndef _ABS_ADDR_H | ||
2 | #define _ABS_ADDR_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | /* | ||
7 | * c 2001 PPC 64 Team, IBM Corp | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <asm/types.h> | ||
16 | #include <asm/page.h> | ||
17 | #include <asm/prom.h> | ||
18 | #include <asm/lmb.h> | ||
19 | |||
20 | typedef u32 msChunks_entry; | ||
21 | struct msChunks { | ||
22 | unsigned long num_chunks; | ||
23 | unsigned long chunk_size; | ||
24 | unsigned long chunk_shift; | ||
25 | unsigned long chunk_mask; | ||
26 | msChunks_entry *abs; | ||
27 | }; | ||
28 | |||
29 | extern struct msChunks msChunks; | ||
30 | |||
31 | extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); | ||
32 | extern unsigned long reloc_offset(void); | ||
33 | |||
34 | #ifdef CONFIG_MSCHUNKS | ||
35 | |||
36 | static inline unsigned long | ||
37 | chunk_to_addr(unsigned long chunk) | ||
38 | { | ||
39 | unsigned long offset = reloc_offset(); | ||
40 | struct msChunks *_msChunks = PTRRELOC(&msChunks); | ||
41 | |||
42 | return chunk << _msChunks->chunk_shift; | ||
43 | } | ||
44 | |||
45 | static inline unsigned long | ||
46 | addr_to_chunk(unsigned long addr) | ||
47 | { | ||
48 | unsigned long offset = reloc_offset(); | ||
49 | struct msChunks *_msChunks = PTRRELOC(&msChunks); | ||
50 | |||
51 | return addr >> _msChunks->chunk_shift; | ||
52 | } | ||
53 | |||
54 | static inline unsigned long | ||
55 | chunk_offset(unsigned long addr) | ||
56 | { | ||
57 | unsigned long offset = reloc_offset(); | ||
58 | struct msChunks *_msChunks = PTRRELOC(&msChunks); | ||
59 | |||
60 | return addr & _msChunks->chunk_mask; | ||
61 | } | ||
62 | |||
63 | static inline unsigned long | ||
64 | abs_chunk(unsigned long pchunk) | ||
65 | { | ||
66 | unsigned long offset = reloc_offset(); | ||
67 | struct msChunks *_msChunks = PTRRELOC(&msChunks); | ||
68 | if ( pchunk >= _msChunks->num_chunks ) { | ||
69 | return pchunk; | ||
70 | } | ||
71 | return PTRRELOC(_msChunks->abs)[pchunk]; | ||
72 | } | ||
73 | |||
74 | /* A macro so it can take pointers or unsigned long. */ | ||
75 | #define phys_to_abs(pa) \ | ||
76 | ({ unsigned long _pa = (unsigned long)(pa); \ | ||
77 | chunk_to_addr(abs_chunk(addr_to_chunk(_pa))) + chunk_offset(_pa); \ | ||
78 | }) | ||
79 | |||
80 | static inline unsigned long | ||
81 | physRpn_to_absRpn(unsigned long rpn) | ||
82 | { | ||
83 | unsigned long pa = rpn << PAGE_SHIFT; | ||
84 | unsigned long aa = phys_to_abs(pa); | ||
85 | return (aa >> PAGE_SHIFT); | ||
86 | } | ||
87 | |||
88 | /* A macro so it can take pointers or unsigned long. */ | ||
89 | #define abs_to_phys(aa) lmb_abs_to_phys((unsigned long)(aa)) | ||
90 | |||
91 | #else /* !CONFIG_MSCHUNKS */ | ||
92 | |||
93 | #define chunk_to_addr(chunk) ((unsigned long)(chunk)) | ||
94 | #define addr_to_chunk(addr) (addr) | ||
95 | #define chunk_offset(addr) (0) | ||
96 | #define abs_chunk(pchunk) (pchunk) | ||
97 | |||
98 | #define phys_to_abs(pa) (pa) | ||
99 | #define physRpn_to_absRpn(rpn) (rpn) | ||
100 | #define abs_to_phys(aa) (aa) | ||
101 | |||
102 | #endif /* !CONFIG_MSCHUNKS */ | ||
103 | |||
104 | /* Convenience macros */ | ||
105 | #define virt_to_abs(va) phys_to_abs(__pa(va)) | ||
106 | #define abs_to_virt(aa) __va(abs_to_phys(aa)) | ||
107 | |||
108 | #endif /* _ABS_ADDR_H */ | ||
diff --git a/include/asm-ppc64/agp.h b/include/asm-ppc64/agp.h new file mode 100644 index 000000000000..be27cfa8c5b0 --- /dev/null +++ b/include/asm-ppc64/agp.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef AGP_H | ||
2 | #define AGP_H 1 | ||
3 | |||
4 | #include <asm/io.h> | ||
5 | |||
6 | /* nothing much needed here */ | ||
7 | |||
8 | #define map_page_into_agp(page) | ||
9 | #define unmap_page_from_agp(page) | ||
10 | #define flush_agp_mappings() | ||
11 | #define flush_agp_cache() mb() | ||
12 | |||
13 | #endif | ||
diff --git a/include/asm-ppc64/atomic.h b/include/asm-ppc64/atomic.h new file mode 100644 index 000000000000..0e5f25e83bc0 --- /dev/null +++ b/include/asm-ppc64/atomic.h | |||
@@ -0,0 +1,197 @@ | |||
1 | /* | ||
2 | * PowerPC64 atomic operations | ||
3 | * | ||
4 | * Copyright (C) 2001 Paul Mackerras <paulus@au.ibm.com>, IBM | ||
5 | * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASM_PPC64_ATOMIC_H_ | ||
14 | #define _ASM_PPC64_ATOMIC_H_ | ||
15 | |||
16 | #include <asm/memory.h> | ||
17 | |||
18 | typedef struct { volatile int counter; } atomic_t; | ||
19 | |||
20 | #define ATOMIC_INIT(i) { (i) } | ||
21 | |||
22 | #define atomic_read(v) ((v)->counter) | ||
23 | #define atomic_set(v,i) (((v)->counter) = (i)) | ||
24 | |||
25 | static __inline__ void atomic_add(int a, atomic_t *v) | ||
26 | { | ||
27 | int t; | ||
28 | |||
29 | __asm__ __volatile__( | ||
30 | "1: lwarx %0,0,%3 # atomic_add\n\ | ||
31 | add %0,%2,%0\n\ | ||
32 | stwcx. %0,0,%3\n\ | ||
33 | bne- 1b" | ||
34 | : "=&r" (t), "=m" (v->counter) | ||
35 | : "r" (a), "r" (&v->counter), "m" (v->counter) | ||
36 | : "cc"); | ||
37 | } | ||
38 | |||
39 | static __inline__ int atomic_add_return(int a, atomic_t *v) | ||
40 | { | ||
41 | int t; | ||
42 | |||
43 | __asm__ __volatile__( | ||
44 | EIEIO_ON_SMP | ||
45 | "1: lwarx %0,0,%2 # atomic_add_return\n\ | ||
46 | add %0,%1,%0\n\ | ||
47 | stwcx. %0,0,%2\n\ | ||
48 | bne- 1b" | ||
49 | ISYNC_ON_SMP | ||
50 | : "=&r" (t) | ||
51 | : "r" (a), "r" (&v->counter) | ||
52 | : "cc", "memory"); | ||
53 | |||
54 | return t; | ||
55 | } | ||
56 | |||
57 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | ||
58 | |||
59 | static __inline__ void atomic_sub(int a, atomic_t *v) | ||
60 | { | ||
61 | int t; | ||
62 | |||
63 | __asm__ __volatile__( | ||
64 | "1: lwarx %0,0,%3 # atomic_sub\n\ | ||
65 | subf %0,%2,%0\n\ | ||
66 | stwcx. %0,0,%3\n\ | ||
67 | bne- 1b" | ||
68 | : "=&r" (t), "=m" (v->counter) | ||
69 | : "r" (a), "r" (&v->counter), "m" (v->counter) | ||
70 | : "cc"); | ||
71 | } | ||
72 | |||
73 | static __inline__ int atomic_sub_return(int a, atomic_t *v) | ||
74 | { | ||
75 | int t; | ||
76 | |||
77 | __asm__ __volatile__( | ||
78 | EIEIO_ON_SMP | ||
79 | "1: lwarx %0,0,%2 # atomic_sub_return\n\ | ||
80 | subf %0,%1,%0\n\ | ||
81 | stwcx. %0,0,%2\n\ | ||
82 | bne- 1b" | ||
83 | ISYNC_ON_SMP | ||
84 | : "=&r" (t) | ||
85 | : "r" (a), "r" (&v->counter) | ||
86 | : "cc", "memory"); | ||
87 | |||
88 | return t; | ||
89 | } | ||
90 | |||
91 | static __inline__ void atomic_inc(atomic_t *v) | ||
92 | { | ||
93 | int t; | ||
94 | |||
95 | __asm__ __volatile__( | ||
96 | "1: lwarx %0,0,%2 # atomic_inc\n\ | ||
97 | addic %0,%0,1\n\ | ||
98 | stwcx. %0,0,%2\n\ | ||
99 | bne- 1b" | ||
100 | : "=&r" (t), "=m" (v->counter) | ||
101 | : "r" (&v->counter), "m" (v->counter) | ||
102 | : "cc"); | ||
103 | } | ||
104 | |||
105 | static __inline__ int atomic_inc_return(atomic_t *v) | ||
106 | { | ||
107 | int t; | ||
108 | |||
109 | __asm__ __volatile__( | ||
110 | EIEIO_ON_SMP | ||
111 | "1: lwarx %0,0,%1 # atomic_inc_return\n\ | ||
112 | addic %0,%0,1\n\ | ||
113 | stwcx. %0,0,%1\n\ | ||
114 | bne- 1b" | ||
115 | ISYNC_ON_SMP | ||
116 | : "=&r" (t) | ||
117 | : "r" (&v->counter) | ||
118 | : "cc", "memory"); | ||
119 | |||
120 | return t; | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | * atomic_inc_and_test - increment and test | ||
125 | * @v: pointer of type atomic_t | ||
126 | * | ||
127 | * Atomically increments @v by 1 | ||
128 | * and returns true if the result is zero, or false for all | ||
129 | * other cases. | ||
130 | */ | ||
131 | #define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) | ||
132 | |||
133 | static __inline__ void atomic_dec(atomic_t *v) | ||
134 | { | ||
135 | int t; | ||
136 | |||
137 | __asm__ __volatile__( | ||
138 | "1: lwarx %0,0,%2 # atomic_dec\n\ | ||
139 | addic %0,%0,-1\n\ | ||
140 | stwcx. %0,0,%2\n\ | ||
141 | bne- 1b" | ||
142 | : "=&r" (t), "=m" (v->counter) | ||
143 | : "r" (&v->counter), "m" (v->counter) | ||
144 | : "cc"); | ||
145 | } | ||
146 | |||
147 | static __inline__ int atomic_dec_return(atomic_t *v) | ||
148 | { | ||
149 | int t; | ||
150 | |||
151 | __asm__ __volatile__( | ||
152 | EIEIO_ON_SMP | ||
153 | "1: lwarx %0,0,%1 # atomic_dec_return\n\ | ||
154 | addic %0,%0,-1\n\ | ||
155 | stwcx. %0,0,%1\n\ | ||
156 | bne- 1b" | ||
157 | ISYNC_ON_SMP | ||
158 | : "=&r" (t) | ||
159 | : "r" (&v->counter) | ||
160 | : "cc", "memory"); | ||
161 | |||
162 | return t; | ||
163 | } | ||
164 | |||
165 | #define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0) | ||
166 | #define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0) | ||
167 | |||
168 | /* | ||
169 | * Atomically test *v and decrement if it is greater than 0. | ||
170 | * The function returns the old value of *v minus 1. | ||
171 | */ | ||
172 | static __inline__ int atomic_dec_if_positive(atomic_t *v) | ||
173 | { | ||
174 | int t; | ||
175 | |||
176 | __asm__ __volatile__( | ||
177 | EIEIO_ON_SMP | ||
178 | "1: lwarx %0,0,%1 # atomic_dec_if_positive\n\ | ||
179 | addic. %0,%0,-1\n\ | ||
180 | blt- 2f\n\ | ||
181 | stwcx. %0,0,%1\n\ | ||
182 | bne- 1b" | ||
183 | ISYNC_ON_SMP | ||
184 | "\n\ | ||
185 | 2:" : "=&r" (t) | ||
186 | : "r" (&v->counter) | ||
187 | : "cc", "memory"); | ||
188 | |||
189 | return t; | ||
190 | } | ||
191 | |||
192 | #define smp_mb__before_atomic_dec() smp_mb() | ||
193 | #define smp_mb__after_atomic_dec() smp_mb() | ||
194 | #define smp_mb__before_atomic_inc() smp_mb() | ||
195 | #define smp_mb__after_atomic_inc() smp_mb() | ||
196 | |||
197 | #endif /* _ASM_PPC64_ATOMIC_H_ */ | ||
diff --git a/include/asm-ppc64/bitops.h b/include/asm-ppc64/bitops.h new file mode 100644 index 000000000000..a0f831224f96 --- /dev/null +++ b/include/asm-ppc64/bitops.h | |||
@@ -0,0 +1,360 @@ | |||
1 | /* | ||
2 | * PowerPC64 atomic bit operations. | ||
3 | * Dave Engebretsen, Todd Inglett, Don Reed, Pat McCarthy, Peter Bergner, | ||
4 | * Anton Blanchard | ||
5 | * | ||
6 | * Originally taken from the 32b PPC code. Modified to use 64b values for | ||
7 | * the various counters & memory references. | ||
8 | * | ||
9 | * Bitops are odd when viewed on big-endian systems. They were designed | ||
10 | * on little endian so the size of the bitset doesn't matter (low order bytes | ||
11 | * come first) as long as the bit in question is valid. | ||
12 | * | ||
13 | * Bits are "tested" often using the C expression (val & (1<<nr)) so we do | ||
14 | * our best to stay compatible with that. The assumption is that val will | ||
15 | * be unsigned long for such tests. As such, we assume the bits are stored | ||
16 | * as an array of unsigned long (the usual case is a single unsigned long, | ||
17 | * of course). Here's an example bitset with bit numbering: | ||
18 | * | ||
19 | * |63..........0|127........64|195.......128|255.......196| | ||
20 | * | ||
21 | * This leads to a problem. If an int, short or char is passed as a bitset | ||
22 | * it will be a bad memory reference since we want to store in chunks | ||
23 | * of unsigned long (64 bits here) size. | ||
24 | * | ||
25 | * There are a few little-endian macros used mostly for filesystem bitmaps, | ||
26 | * these work on similar bit arrays layouts, but byte-oriented: | ||
27 | * | ||
28 | * |7...0|15...8|23...16|31...24|39...32|47...40|55...48|63...56| | ||
29 | * | ||
30 | * The main difference is that bit 3-5 in the bit number field needs to be | ||
31 | * reversed compared to the big-endian bit fields. This can be achieved | ||
32 | * by XOR with 0b111000 (0x38). | ||
33 | * | ||
34 | * This program is free software; you can redistribute it and/or | ||
35 | * modify it under the terms of the GNU General Public License | ||
36 | * as published by the Free Software Foundation; either version | ||
37 | * 2 of the License, or (at your option) any later version. | ||
38 | */ | ||
39 | |||
40 | #ifndef _PPC64_BITOPS_H | ||
41 | #define _PPC64_BITOPS_H | ||
42 | |||
43 | #ifdef __KERNEL__ | ||
44 | |||
45 | #include <asm/memory.h> | ||
46 | |||
47 | /* | ||
48 | * clear_bit doesn't imply a memory barrier | ||
49 | */ | ||
50 | #define smp_mb__before_clear_bit() smp_mb() | ||
51 | #define smp_mb__after_clear_bit() smp_mb() | ||
52 | |||
53 | static __inline__ int test_bit(unsigned long nr, __const__ volatile unsigned long *addr) | ||
54 | { | ||
55 | return (1UL & (addr[nr >> 6] >> (nr & 63))); | ||
56 | } | ||
57 | |||
58 | static __inline__ void set_bit(unsigned long nr, volatile unsigned long *addr) | ||
59 | { | ||
60 | unsigned long old; | ||
61 | unsigned long mask = 1UL << (nr & 0x3f); | ||
62 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
63 | |||
64 | __asm__ __volatile__( | ||
65 | "1: ldarx %0,0,%3 # set_bit\n\ | ||
66 | or %0,%0,%2\n\ | ||
67 | stdcx. %0,0,%3\n\ | ||
68 | bne- 1b" | ||
69 | : "=&r" (old), "=m" (*p) | ||
70 | : "r" (mask), "r" (p), "m" (*p) | ||
71 | : "cc"); | ||
72 | } | ||
73 | |||
74 | static __inline__ void clear_bit(unsigned long nr, volatile unsigned long *addr) | ||
75 | { | ||
76 | unsigned long old; | ||
77 | unsigned long mask = 1UL << (nr & 0x3f); | ||
78 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
79 | |||
80 | __asm__ __volatile__( | ||
81 | "1: ldarx %0,0,%3 # clear_bit\n\ | ||
82 | andc %0,%0,%2\n\ | ||
83 | stdcx. %0,0,%3\n\ | ||
84 | bne- 1b" | ||
85 | : "=&r" (old), "=m" (*p) | ||
86 | : "r" (mask), "r" (p), "m" (*p) | ||
87 | : "cc"); | ||
88 | } | ||
89 | |||
90 | static __inline__ void change_bit(unsigned long nr, volatile unsigned long *addr) | ||
91 | { | ||
92 | unsigned long old; | ||
93 | unsigned long mask = 1UL << (nr & 0x3f); | ||
94 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
95 | |||
96 | __asm__ __volatile__( | ||
97 | "1: ldarx %0,0,%3 # change_bit\n\ | ||
98 | xor %0,%0,%2\n\ | ||
99 | stdcx. %0,0,%3\n\ | ||
100 | bne- 1b" | ||
101 | : "=&r" (old), "=m" (*p) | ||
102 | : "r" (mask), "r" (p), "m" (*p) | ||
103 | : "cc"); | ||
104 | } | ||
105 | |||
106 | static __inline__ int test_and_set_bit(unsigned long nr, volatile unsigned long *addr) | ||
107 | { | ||
108 | unsigned long old, t; | ||
109 | unsigned long mask = 1UL << (nr & 0x3f); | ||
110 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
111 | |||
112 | __asm__ __volatile__( | ||
113 | EIEIO_ON_SMP | ||
114 | "1: ldarx %0,0,%3 # test_and_set_bit\n\ | ||
115 | or %1,%0,%2 \n\ | ||
116 | stdcx. %1,0,%3 \n\ | ||
117 | bne- 1b" | ||
118 | ISYNC_ON_SMP | ||
119 | : "=&r" (old), "=&r" (t) | ||
120 | : "r" (mask), "r" (p) | ||
121 | : "cc", "memory"); | ||
122 | |||
123 | return (old & mask) != 0; | ||
124 | } | ||
125 | |||
126 | static __inline__ int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr) | ||
127 | { | ||
128 | unsigned long old, t; | ||
129 | unsigned long mask = 1UL << (nr & 0x3f); | ||
130 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
131 | |||
132 | __asm__ __volatile__( | ||
133 | EIEIO_ON_SMP | ||
134 | "1: ldarx %0,0,%3 # test_and_clear_bit\n\ | ||
135 | andc %1,%0,%2\n\ | ||
136 | stdcx. %1,0,%3\n\ | ||
137 | bne- 1b" | ||
138 | ISYNC_ON_SMP | ||
139 | : "=&r" (old), "=&r" (t) | ||
140 | : "r" (mask), "r" (p) | ||
141 | : "cc", "memory"); | ||
142 | |||
143 | return (old & mask) != 0; | ||
144 | } | ||
145 | |||
146 | static __inline__ int test_and_change_bit(unsigned long nr, volatile unsigned long *addr) | ||
147 | { | ||
148 | unsigned long old, t; | ||
149 | unsigned long mask = 1UL << (nr & 0x3f); | ||
150 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
151 | |||
152 | __asm__ __volatile__( | ||
153 | EIEIO_ON_SMP | ||
154 | "1: ldarx %0,0,%3 # test_and_change_bit\n\ | ||
155 | xor %1,%0,%2\n\ | ||
156 | stdcx. %1,0,%3\n\ | ||
157 | bne- 1b" | ||
158 | ISYNC_ON_SMP | ||
159 | : "=&r" (old), "=&r" (t) | ||
160 | : "r" (mask), "r" (p) | ||
161 | : "cc", "memory"); | ||
162 | |||
163 | return (old & mask) != 0; | ||
164 | } | ||
165 | |||
166 | static __inline__ void set_bits(unsigned long mask, unsigned long *addr) | ||
167 | { | ||
168 | unsigned long old; | ||
169 | |||
170 | __asm__ __volatile__( | ||
171 | "1: ldarx %0,0,%3 # set_bit\n\ | ||
172 | or %0,%0,%2\n\ | ||
173 | stdcx. %0,0,%3\n\ | ||
174 | bne- 1b" | ||
175 | : "=&r" (old), "=m" (*addr) | ||
176 | : "r" (mask), "r" (addr), "m" (*addr) | ||
177 | : "cc"); | ||
178 | } | ||
179 | |||
180 | /* | ||
181 | * non-atomic versions | ||
182 | */ | ||
183 | static __inline__ void __set_bit(unsigned long nr, volatile unsigned long *addr) | ||
184 | { | ||
185 | unsigned long mask = 1UL << (nr & 0x3f); | ||
186 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
187 | |||
188 | *p |= mask; | ||
189 | } | ||
190 | |||
191 | static __inline__ void __clear_bit(unsigned long nr, volatile unsigned long *addr) | ||
192 | { | ||
193 | unsigned long mask = 1UL << (nr & 0x3f); | ||
194 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
195 | |||
196 | *p &= ~mask; | ||
197 | } | ||
198 | |||
199 | static __inline__ void __change_bit(unsigned long nr, volatile unsigned long *addr) | ||
200 | { | ||
201 | unsigned long mask = 1UL << (nr & 0x3f); | ||
202 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
203 | |||
204 | *p ^= mask; | ||
205 | } | ||
206 | |||
207 | static __inline__ int __test_and_set_bit(unsigned long nr, volatile unsigned long *addr) | ||
208 | { | ||
209 | unsigned long mask = 1UL << (nr & 0x3f); | ||
210 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
211 | unsigned long old = *p; | ||
212 | |||
213 | *p = old | mask; | ||
214 | return (old & mask) != 0; | ||
215 | } | ||
216 | |||
217 | static __inline__ int __test_and_clear_bit(unsigned long nr, volatile unsigned long *addr) | ||
218 | { | ||
219 | unsigned long mask = 1UL << (nr & 0x3f); | ||
220 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
221 | unsigned long old = *p; | ||
222 | |||
223 | *p = old & ~mask; | ||
224 | return (old & mask) != 0; | ||
225 | } | ||
226 | |||
227 | static __inline__ int __test_and_change_bit(unsigned long nr, volatile unsigned long *addr) | ||
228 | { | ||
229 | unsigned long mask = 1UL << (nr & 0x3f); | ||
230 | unsigned long *p = ((unsigned long *)addr) + (nr >> 6); | ||
231 | unsigned long old = *p; | ||
232 | |||
233 | *p = old ^ mask; | ||
234 | return (old & mask) != 0; | ||
235 | } | ||
236 | |||
237 | /* | ||
238 | * Return the zero-based bit position (from RIGHT TO LEFT, 63 -> 0) of the | ||
239 | * most significant (left-most) 1-bit in a double word. | ||
240 | */ | ||
241 | static __inline__ int __ilog2(unsigned long x) | ||
242 | { | ||
243 | int lz; | ||
244 | |||
245 | asm ("cntlzd %0,%1" : "=r" (lz) : "r" (x)); | ||
246 | return 63 - lz; | ||
247 | } | ||
248 | |||
249 | /* | ||
250 | * Determines the bit position of the least significant (rightmost) 0 bit | ||
251 | * in the specified double word. The returned bit position will be zero-based, | ||
252 | * starting from the right side (63 - 0). | ||
253 | */ | ||
254 | static __inline__ unsigned long ffz(unsigned long x) | ||
255 | { | ||
256 | /* no zero exists anywhere in the 8 byte area. */ | ||
257 | if ((x = ~x) == 0) | ||
258 | return 64; | ||
259 | |||
260 | /* | ||
261 | * Calculate the bit position of the least signficant '1' bit in x | ||
262 | * (since x has been changed this will actually be the least signficant | ||
263 | * '0' bit in * the original x). Note: (x & -x) gives us a mask that | ||
264 | * is the least significant * (RIGHT-most) 1-bit of the value in x. | ||
265 | */ | ||
266 | return __ilog2(x & -x); | ||
267 | } | ||
268 | |||
269 | static __inline__ int __ffs(unsigned long x) | ||
270 | { | ||
271 | return __ilog2(x & -x); | ||
272 | } | ||
273 | |||
274 | /* | ||
275 | * ffs: find first bit set. This is defined the same way as | ||
276 | * the libc and compiler builtin ffs routines, therefore | ||
277 | * differs in spirit from the above ffz (man ffs). | ||
278 | */ | ||
279 | static __inline__ int ffs(int x) | ||
280 | { | ||
281 | unsigned long i = (unsigned long)x; | ||
282 | return __ilog2(i & -i) + 1; | ||
283 | } | ||
284 | |||
285 | /* | ||
286 | * fls: find last (most-significant) bit set. | ||
287 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. | ||
288 | */ | ||
289 | #define fls(x) generic_fls(x) | ||
290 | |||
291 | /* | ||
292 | * hweightN: returns the hamming weight (i.e. the number | ||
293 | * of bits set) of a N-bit word | ||
294 | */ | ||
295 | #define hweight64(x) generic_hweight64(x) | ||
296 | #define hweight32(x) generic_hweight32(x) | ||
297 | #define hweight16(x) generic_hweight16(x) | ||
298 | #define hweight8(x) generic_hweight8(x) | ||
299 | |||
300 | extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset); | ||
301 | #define find_first_zero_bit(addr, size) \ | ||
302 | find_next_zero_bit((addr), (size), 0) | ||
303 | |||
304 | extern unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset); | ||
305 | #define find_first_bit(addr, size) \ | ||
306 | find_next_bit((addr), (size), 0) | ||
307 | |||
308 | extern unsigned long find_next_zero_le_bit(const unsigned long *addr, unsigned long size, unsigned long offset); | ||
309 | #define find_first_zero_le_bit(addr, size) \ | ||
310 | find_next_zero_le_bit((addr), (size), 0) | ||
311 | |||
312 | static __inline__ int test_le_bit(unsigned long nr, __const__ unsigned long * addr) | ||
313 | { | ||
314 | __const__ unsigned char *ADDR = (__const__ unsigned char *) addr; | ||
315 | return (ADDR[nr >> 3] >> (nr & 7)) & 1; | ||
316 | } | ||
317 | |||
318 | #define test_and_clear_le_bit(nr, addr) \ | ||
319 | test_and_clear_bit((nr) ^ 0x38, (addr)) | ||
320 | #define test_and_set_le_bit(nr, addr) \ | ||
321 | test_and_set_bit((nr) ^ 0x38, (addr)) | ||
322 | |||
323 | /* | ||
324 | * non-atomic versions | ||
325 | */ | ||
326 | |||
327 | #define __set_le_bit(nr, addr) \ | ||
328 | __set_bit((nr) ^ 0x38, (addr)) | ||
329 | #define __clear_le_bit(nr, addr) \ | ||
330 | __clear_bit((nr) ^ 0x38, (addr)) | ||
331 | #define __test_and_clear_le_bit(nr, addr) \ | ||
332 | __test_and_clear_bit((nr) ^ 0x38, (addr)) | ||
333 | #define __test_and_set_le_bit(nr, addr) \ | ||
334 | __test_and_set_bit((nr) ^ 0x38, (addr)) | ||
335 | |||
336 | #define ext2_set_bit(nr,addr) \ | ||
337 | __test_and_set_le_bit((nr), (unsigned long*)addr) | ||
338 | #define ext2_clear_bit(nr, addr) \ | ||
339 | __test_and_clear_le_bit((nr), (unsigned long*)addr) | ||
340 | |||
341 | #define ext2_set_bit_atomic(lock, nr, addr) \ | ||
342 | test_and_set_le_bit((nr), (unsigned long*)addr) | ||
343 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | ||
344 | test_and_clear_le_bit((nr), (unsigned long*)addr) | ||
345 | |||
346 | |||
347 | #define ext2_test_bit(nr, addr) test_le_bit((nr),(unsigned long*)addr) | ||
348 | #define ext2_find_first_zero_bit(addr, size) \ | ||
349 | find_first_zero_le_bit((unsigned long*)addr, size) | ||
350 | #define ext2_find_next_zero_bit(addr, size, off) \ | ||
351 | find_next_zero_le_bit((unsigned long*)addr, size, off) | ||
352 | |||
353 | #define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) | ||
354 | #define minix_set_bit(nr,addr) set_bit(nr,addr) | ||
355 | #define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) | ||
356 | #define minix_test_bit(nr,addr) test_bit(nr,addr) | ||
357 | #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) | ||
358 | |||
359 | #endif /* __KERNEL__ */ | ||
360 | #endif /* _PPC64_BITOPS_H */ | ||
diff --git a/include/asm-ppc64/bootinfo.h b/include/asm-ppc64/bootinfo.h new file mode 100644 index 000000000000..f55e7cb48f46 --- /dev/null +++ b/include/asm-ppc64/bootinfo.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Non-machine dependent bootinfo structure. Basic idea | ||
3 | * borrowed from the m68k. | ||
4 | * | ||
5 | * Copyright (C) 1999 Cort Dougan <cort@ppc.kernel.org> | ||
6 | * Copyright (c) 2001 PPC64 Team, IBM Corp | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | |||
15 | #ifndef _PPC64_BOOTINFO_H | ||
16 | #define _PPC64_BOOTINFO_H | ||
17 | |||
18 | #include <asm/types.h> | ||
19 | |||
20 | /* We use a u32 for the type of the fields since they're written by | ||
21 | * the bootloader which is a 32-bit process and read by the kernel | ||
22 | * which is a 64-bit process. This way they can both agree on the | ||
23 | * size of the type. | ||
24 | */ | ||
25 | typedef u32 bi_rec_field; | ||
26 | |||
27 | struct bi_record { | ||
28 | bi_rec_field tag; /* tag ID */ | ||
29 | bi_rec_field size; /* size of record (in bytes) */ | ||
30 | bi_rec_field data[0]; /* data */ | ||
31 | }; | ||
32 | |||
33 | #define BI_FIRST 0x1010 /* first record - marker */ | ||
34 | #define BI_LAST 0x1011 /* last record - marker */ | ||
35 | #define BI_CMD_LINE 0x1012 | ||
36 | #define BI_BOOTLOADER_ID 0x1013 | ||
37 | #define BI_INITRD 0x1014 | ||
38 | #define BI_SYSMAP 0x1015 | ||
39 | #define BI_MACHTYPE 0x1016 | ||
40 | |||
41 | static __inline__ struct bi_record * bi_rec_init(unsigned long addr) | ||
42 | { | ||
43 | struct bi_record *bi_recs; | ||
44 | bi_recs = (struct bi_record *)_ALIGN(addr, PAGE_SIZE); | ||
45 | bi_recs->size = 0; | ||
46 | return bi_recs; | ||
47 | } | ||
48 | |||
49 | static __inline__ struct bi_record * bi_rec_alloc(struct bi_record *rec, | ||
50 | unsigned long args) | ||
51 | { | ||
52 | rec = (struct bi_record *)((unsigned long)rec + rec->size); | ||
53 | rec->size = sizeof(struct bi_record) + args*sizeof(bi_rec_field); | ||
54 | return rec; | ||
55 | } | ||
56 | |||
57 | static __inline__ struct bi_record * bi_rec_alloc_bytes(struct bi_record *rec, | ||
58 | unsigned long bytes) | ||
59 | { | ||
60 | rec = (struct bi_record *)((unsigned long)rec + rec->size); | ||
61 | rec->size = sizeof(struct bi_record) + bytes; | ||
62 | return rec; | ||
63 | } | ||
64 | |||
65 | static __inline__ struct bi_record * bi_rec_next(struct bi_record *rec) | ||
66 | { | ||
67 | return (struct bi_record *)((unsigned long)rec + rec->size); | ||
68 | } | ||
69 | |||
70 | #endif /* _PPC64_BOOTINFO_H */ | ||
diff --git a/include/asm-ppc64/btext.h b/include/asm-ppc64/btext.h new file mode 100644 index 000000000000..67aef0cc72c0 --- /dev/null +++ b/include/asm-ppc64/btext.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Definitions for using the procedures in btext.c. | ||
3 | * | ||
4 | * Benjamin Herrenschmidt <benh@kernel.crashing.org> | ||
5 | */ | ||
6 | #ifndef __PPC_BTEXT_H | ||
7 | #define __PPC_BTEXT_H | ||
8 | #ifdef __KERNEL__ | ||
9 | |||
10 | extern void btext_clearscreen(void); | ||
11 | extern void btext_flushscreen(void); | ||
12 | |||
13 | extern int boot_text_mapped; | ||
14 | |||
15 | extern int btext_initialize(struct device_node *np); | ||
16 | |||
17 | extern void map_boot_text(void); | ||
18 | extern void btext_update_display(unsigned long phys, int width, int height, | ||
19 | int depth, int pitch); | ||
20 | |||
21 | extern void btext_drawchar(char c); | ||
22 | extern void btext_drawstring(const char *str); | ||
23 | extern void btext_drawhex(unsigned long v); | ||
24 | |||
25 | #endif /* __KERNEL__ */ | ||
26 | #endif /* __PPC_BTEXT_H */ | ||
diff --git a/include/asm-ppc64/bug.h b/include/asm-ppc64/bug.h new file mode 100644 index 000000000000..db31dd22233c --- /dev/null +++ b/include/asm-ppc64/bug.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef _PPC64_BUG_H | ||
2 | #define _PPC64_BUG_H | ||
3 | |||
4 | /* | ||
5 | * Define an illegal instr to trap on the bug. | ||
6 | * We don't use 0 because that marks the end of a function | ||
7 | * in the ELF ABI. That's "Boo Boo" in case you wonder... | ||
8 | */ | ||
9 | #define BUG_OPCODE .long 0x00b00b00 /* For asm */ | ||
10 | #define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */ | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | |||
14 | struct bug_entry { | ||
15 | unsigned long bug_addr; | ||
16 | long line; | ||
17 | const char *file; | ||
18 | const char *function; | ||
19 | }; | ||
20 | |||
21 | struct bug_entry *find_bug(unsigned long bugaddr); | ||
22 | |||
23 | /* | ||
24 | * If this bit is set in the line number it means that the trap | ||
25 | * is for WARN_ON rather than BUG or BUG_ON. | ||
26 | */ | ||
27 | #define BUG_WARNING_TRAP 0x1000000 | ||
28 | |||
29 | #define BUG() do { \ | ||
30 | __asm__ __volatile__( \ | ||
31 | "1: twi 31,0,0\n" \ | ||
32 | ".section __bug_table,\"a\"\n\t" \ | ||
33 | " .llong 1b,%0,%1,%2\n" \ | ||
34 | ".previous" \ | ||
35 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
36 | } while (0) | ||
37 | |||
38 | #define BUG_ON(x) do { \ | ||
39 | __asm__ __volatile__( \ | ||
40 | "1: tdnei %0,0\n" \ | ||
41 | ".section __bug_table,\"a\"\n\t" \ | ||
42 | " .llong 1b,%1,%2,%3\n" \ | ||
43 | ".previous" \ | ||
44 | : : "r" (x), "i" (__LINE__), "i" (__FILE__), \ | ||
45 | "i" (__FUNCTION__)); \ | ||
46 | } while (0) | ||
47 | |||
48 | #define WARN_ON(x) do { \ | ||
49 | __asm__ __volatile__( \ | ||
50 | "1: tdnei %0,0\n" \ | ||
51 | ".section __bug_table,\"a\"\n\t" \ | ||
52 | " .llong 1b,%1,%2,%3\n" \ | ||
53 | ".previous" \ | ||
54 | : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ | ||
55 | "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
56 | } while (0) | ||
57 | |||
58 | #endif | ||
59 | |||
60 | #define HAVE_ARCH_BUG | ||
61 | #define HAVE_ARCH_BUG_ON | ||
62 | #define HAVE_ARCH_WARN_ON | ||
63 | #include <asm-generic/bug.h> | ||
64 | |||
65 | #endif | ||
diff --git a/include/asm-ppc64/bugs.h b/include/asm-ppc64/bugs.h new file mode 100644 index 000000000000..861074b3cf71 --- /dev/null +++ b/include/asm-ppc64/bugs.h | |||
@@ -0,0 +1,12 @@ | |||
1 | /* | ||
2 | * This file is included by 'init/main.c' to check for architecture-dependent | ||
3 | * bugs. | ||
4 | * | ||
5 | */ | ||
6 | #ifndef _ASM_PPC64_BUGS_H | ||
7 | #define _ASM_PPC64_BUGS_H | ||
8 | |||
9 | static void check_bugs(void) { | ||
10 | } | ||
11 | |||
12 | #endif /* _ASM_PPC64_BUGS_H */ | ||
diff --git a/include/asm-ppc64/byteorder.h b/include/asm-ppc64/byteorder.h new file mode 100644 index 000000000000..80327532de64 --- /dev/null +++ b/include/asm-ppc64/byteorder.h | |||
@@ -0,0 +1,96 @@ | |||
1 | #ifndef _PPC64_BYTEORDER_H | ||
2 | #define _PPC64_BYTEORDER_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <asm/types.h> | ||
12 | #include <linux/compiler.h> | ||
13 | |||
14 | #ifdef __GNUC__ | ||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | static __inline__ __u16 ld_le16(const volatile __u16 *addr) | ||
18 | { | ||
19 | __u16 val; | ||
20 | |||
21 | __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); | ||
22 | return val; | ||
23 | } | ||
24 | |||
25 | static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) | ||
26 | { | ||
27 | __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); | ||
28 | } | ||
29 | |||
30 | static __inline__ __u32 ld_le32(const volatile __u32 *addr) | ||
31 | { | ||
32 | __u32 val; | ||
33 | |||
34 | __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); | ||
35 | return val; | ||
36 | } | ||
37 | |||
38 | static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) | ||
39 | { | ||
40 | __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); | ||
41 | } | ||
42 | |||
43 | #if 0 | ||
44 | static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value) | ||
45 | { | ||
46 | __u16 result; | ||
47 | |||
48 | __asm__("rlwimi %0,%1,8,16,23" | ||
49 | : "=r" (result) | ||
50 | : "r" (value), "0" (value >> 8)); | ||
51 | return result; | ||
52 | } | ||
53 | |||
54 | static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value) | ||
55 | { | ||
56 | __u32 result; | ||
57 | |||
58 | __asm__("rlwimi %0,%1,24,16,23\n\t" | ||
59 | "rlwimi %0,%1,8,8,15\n\t" | ||
60 | "rlwimi %0,%1,24,0,7" | ||
61 | : "=r" (result) | ||
62 | : "r" (value), "0" (value >> 24)); | ||
63 | return result; | ||
64 | } | ||
65 | |||
66 | static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 value) | ||
67 | { | ||
68 | __u64 result; | ||
69 | #error implement me | ||
70 | } | ||
71 | |||
72 | #define __arch__swab16(x) ___arch__swab16(x) | ||
73 | #define __arch__swab32(x) ___arch__swab32(x) | ||
74 | #define __arch__swab64(x) ___arch__swab64(x) | ||
75 | |||
76 | #endif | ||
77 | |||
78 | /* The same, but returns converted value from the location pointer by addr. */ | ||
79 | #define __arch__swab16p(addr) ld_le16(addr) | ||
80 | #define __arch__swab32p(addr) ld_le32(addr) | ||
81 | |||
82 | /* The same, but do the conversion in situ, ie. put the value back to addr. */ | ||
83 | #define __arch__swab16s(addr) st_le16(addr,*addr) | ||
84 | #define __arch__swab32s(addr) st_le32(addr,*addr) | ||
85 | |||
86 | #endif /* __KERNEL__ */ | ||
87 | |||
88 | #ifndef __STRICT_ANSI__ | ||
89 | #define __BYTEORDER_HAS_U64__ | ||
90 | #endif | ||
91 | |||
92 | #endif /* __GNUC__ */ | ||
93 | |||
94 | #include <linux/byteorder/big_endian.h> | ||
95 | |||
96 | #endif /* _PPC64_BYTEORDER_H */ | ||
diff --git a/include/asm-ppc64/cache.h b/include/asm-ppc64/cache.h new file mode 100644 index 000000000000..92140a7efbd1 --- /dev/null +++ b/include/asm-ppc64/cache.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or | ||
3 | * modify it under the terms of the GNU General Public License | ||
4 | * as published by the Free Software Foundation; either version | ||
5 | * 2 of the License, or (at your option) any later version. | ||
6 | */ | ||
7 | #ifndef __ARCH_PPC64_CACHE_H | ||
8 | #define __ARCH_PPC64_CACHE_H | ||
9 | |||
10 | #include <asm/types.h> | ||
11 | |||
12 | /* bytes per L1 cache line */ | ||
13 | #define L1_CACHE_SHIFT 7 | ||
14 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
15 | |||
16 | #define SMP_CACHE_BYTES L1_CACHE_BYTES | ||
17 | #define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */ | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | ||
20 | |||
21 | struct ppc64_caches { | ||
22 | u32 dsize; /* L1 d-cache size */ | ||
23 | u32 dline_size; /* L1 d-cache line size */ | ||
24 | u32 log_dline_size; | ||
25 | u32 dlines_per_page; | ||
26 | u32 isize; /* L1 i-cache size */ | ||
27 | u32 iline_size; /* L1 i-cache line size */ | ||
28 | u32 log_iline_size; | ||
29 | u32 ilines_per_page; | ||
30 | }; | ||
31 | |||
32 | extern struct ppc64_caches ppc64_caches; | ||
33 | |||
34 | #endif | ||
35 | |||
36 | #endif | ||
diff --git a/include/asm-ppc64/cacheflush.h b/include/asm-ppc64/cacheflush.h new file mode 100644 index 000000000000..ffbc08be8e52 --- /dev/null +++ b/include/asm-ppc64/cacheflush.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef _PPC64_CACHEFLUSH_H | ||
2 | #define _PPC64_CACHEFLUSH_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | #include <asm/cputable.h> | ||
6 | |||
7 | /* | ||
8 | * No cache flushing is required when address mappings are | ||
9 | * changed, because the caches on PowerPCs are physically | ||
10 | * addressed. | ||
11 | */ | ||
12 | #define flush_cache_all() do { } while (0) | ||
13 | #define flush_cache_mm(mm) do { } while (0) | ||
14 | #define flush_cache_range(vma, start, end) do { } while (0) | ||
15 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | ||
16 | #define flush_icache_page(vma, page) do { } while (0) | ||
17 | #define flush_cache_vmap(start, end) do { } while (0) | ||
18 | #define flush_cache_vunmap(start, end) do { } while (0) | ||
19 | |||
20 | extern void flush_dcache_page(struct page *page); | ||
21 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
22 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
23 | |||
24 | extern void __flush_icache_range(unsigned long, unsigned long); | ||
25 | extern void flush_icache_user_range(struct vm_area_struct *vma, | ||
26 | struct page *page, unsigned long addr, | ||
27 | int len); | ||
28 | |||
29 | extern void flush_dcache_range(unsigned long start, unsigned long stop); | ||
30 | extern void flush_dcache_phys_range(unsigned long start, unsigned long stop); | ||
31 | extern void flush_inval_dcache_range(unsigned long start, unsigned long stop); | ||
32 | |||
33 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
34 | do { memcpy(dst, src, len); \ | ||
35 | flush_icache_user_range(vma, page, vaddr, len); \ | ||
36 | } while (0) | ||
37 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
38 | memcpy(dst, src, len) | ||
39 | |||
40 | extern void __flush_dcache_icache(void *page_va); | ||
41 | |||
42 | static inline void flush_icache_range(unsigned long start, unsigned long stop) | ||
43 | { | ||
44 | if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) | ||
45 | __flush_icache_range(start, stop); | ||
46 | } | ||
47 | |||
48 | #endif /* _PPC64_CACHEFLUSH_H */ | ||
diff --git a/include/asm-ppc64/checksum.h b/include/asm-ppc64/checksum.h new file mode 100644 index 000000000000..d22d4469de43 --- /dev/null +++ b/include/asm-ppc64/checksum.h | |||
@@ -0,0 +1,107 @@ | |||
1 | #ifndef _PPC64_CHECKSUM_H | ||
2 | #define _PPC64_CHECKSUM_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
13 | * which always checksum on 4 octet boundaries. ihl is the number | ||
14 | * of 32-bit words and is always >= 5. | ||
15 | */ | ||
16 | extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); | ||
17 | |||
18 | /* | ||
19 | * computes the checksum of the TCP/UDP pseudo-header | ||
20 | * returns a 16-bit checksum, already complemented | ||
21 | */ | ||
22 | extern unsigned short csum_tcpudp_magic(unsigned long saddr, | ||
23 | unsigned long daddr, | ||
24 | unsigned short len, | ||
25 | unsigned short proto, | ||
26 | unsigned int sum); | ||
27 | |||
28 | /* | ||
29 | * computes the checksum of a memory block at buff, length len, | ||
30 | * and adds in "sum" (32-bit) | ||
31 | * | ||
32 | * returns a 32-bit number suitable for feeding into itself | ||
33 | * or csum_tcpudp_magic | ||
34 | * | ||
35 | * this function must be called with even lengths, except | ||
36 | * for the last fragment, which may be odd | ||
37 | * | ||
38 | * it's best to have buff aligned on a 32-bit boundary | ||
39 | */ | ||
40 | extern unsigned int csum_partial(const unsigned char * buff, int len, | ||
41 | unsigned int sum); | ||
42 | |||
43 | /* | ||
44 | * the same as csum_partial, but copies from src to dst while it | ||
45 | * checksums | ||
46 | */ | ||
47 | extern unsigned int csum_partial_copy_generic(const char *src, char *dst, | ||
48 | int len, unsigned int sum, | ||
49 | int *src_err, int *dst_err); | ||
50 | /* | ||
51 | * the same as csum_partial, but copies from src to dst while it | ||
52 | * checksums. | ||
53 | */ | ||
54 | |||
55 | unsigned int csum_partial_copy_nocheck(const char *src, | ||
56 | char *dst, | ||
57 | int len, | ||
58 | unsigned int sum); | ||
59 | |||
60 | /* | ||
61 | * turns a 32-bit partial checksum (e.g. from csum_partial) into a | ||
62 | * 1's complement 16-bit checksum. | ||
63 | */ | ||
64 | static inline unsigned int csum_fold(unsigned int sum) | ||
65 | { | ||
66 | unsigned int tmp; | ||
67 | |||
68 | /* swap the two 16-bit halves of sum */ | ||
69 | __asm__("rlwinm %0,%1,16,0,31" : "=r" (tmp) : "r" (sum)); | ||
70 | /* if there is a carry from adding the two 16-bit halves, | ||
71 | it will carry from the lower half into the upper half, | ||
72 | giving us the correct sum in the upper half. */ | ||
73 | sum = ~(sum + tmp) >> 16; | ||
74 | return sum; | ||
75 | } | ||
76 | |||
77 | /* | ||
78 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
79 | * in icmp.c | ||
80 | */ | ||
81 | static inline unsigned short ip_compute_csum(unsigned char * buff, int len) | ||
82 | { | ||
83 | return csum_fold(csum_partial(buff, len, 0)); | ||
84 | } | ||
85 | |||
86 | #define csum_partial_copy_from_user(src, dst, len, sum, errp) \ | ||
87 | csum_partial_copy_generic((src), (dst), (len), (sum), (errp), NULL) | ||
88 | |||
89 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ | ||
90 | csum_partial_copy_generic((src), (dst), (len), (sum), NULL, NULL) | ||
91 | |||
92 | static inline u32 csum_tcpudp_nofold(u32 saddr, | ||
93 | u32 daddr, | ||
94 | unsigned short len, | ||
95 | unsigned short proto, | ||
96 | unsigned int sum) | ||
97 | { | ||
98 | unsigned long s = sum; | ||
99 | |||
100 | s += saddr; | ||
101 | s += daddr; | ||
102 | s += (proto << 16) + len; | ||
103 | s += (s >> 32); | ||
104 | return (u32) s; | ||
105 | } | ||
106 | |||
107 | #endif | ||
diff --git a/include/asm-ppc64/compat.h b/include/asm-ppc64/compat.h new file mode 100644 index 000000000000..09c28d28ce6c --- /dev/null +++ b/include/asm-ppc64/compat.h | |||
@@ -0,0 +1,202 @@ | |||
1 | #ifndef _ASM_PPC64_COMPAT_H | ||
2 | #define _ASM_PPC64_COMPAT_H | ||
3 | /* | ||
4 | * Architecture specific compatibility types | ||
5 | */ | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/sched.h> | ||
8 | |||
9 | #define COMPAT_USER_HZ 100 | ||
10 | |||
11 | typedef u32 compat_size_t; | ||
12 | typedef s32 compat_ssize_t; | ||
13 | typedef s32 compat_time_t; | ||
14 | typedef s32 compat_clock_t; | ||
15 | typedef s32 compat_pid_t; | ||
16 | typedef u32 compat_uid_t; | ||
17 | typedef u32 compat_gid_t; | ||
18 | typedef u32 compat_mode_t; | ||
19 | typedef u32 compat_ino_t; | ||
20 | typedef u32 compat_dev_t; | ||
21 | typedef s32 compat_off_t; | ||
22 | typedef s64 compat_loff_t; | ||
23 | typedef s16 compat_nlink_t; | ||
24 | typedef u16 compat_ipc_pid_t; | ||
25 | typedef s32 compat_daddr_t; | ||
26 | typedef u32 compat_caddr_t; | ||
27 | typedef __kernel_fsid_t compat_fsid_t; | ||
28 | typedef s32 compat_key_t; | ||
29 | |||
30 | typedef s32 compat_int_t; | ||
31 | typedef s32 compat_long_t; | ||
32 | typedef u32 compat_uint_t; | ||
33 | typedef u32 compat_ulong_t; | ||
34 | |||
35 | struct compat_timespec { | ||
36 | compat_time_t tv_sec; | ||
37 | s32 tv_nsec; | ||
38 | }; | ||
39 | |||
40 | struct compat_timeval { | ||
41 | compat_time_t tv_sec; | ||
42 | s32 tv_usec; | ||
43 | }; | ||
44 | |||
45 | struct compat_stat { | ||
46 | compat_dev_t st_dev; | ||
47 | compat_ino_t st_ino; | ||
48 | compat_mode_t st_mode; | ||
49 | compat_nlink_t st_nlink; | ||
50 | compat_uid_t st_uid; | ||
51 | compat_gid_t st_gid; | ||
52 | compat_dev_t st_rdev; | ||
53 | compat_off_t st_size; | ||
54 | compat_off_t st_blksize; | ||
55 | compat_off_t st_blocks; | ||
56 | compat_time_t st_atime; | ||
57 | u32 st_atime_nsec; | ||
58 | compat_time_t st_mtime; | ||
59 | u32 st_mtime_nsec; | ||
60 | compat_time_t st_ctime; | ||
61 | u32 st_ctime_nsec; | ||
62 | u32 __unused4[2]; | ||
63 | }; | ||
64 | |||
65 | struct compat_flock { | ||
66 | short l_type; | ||
67 | short l_whence; | ||
68 | compat_off_t l_start; | ||
69 | compat_off_t l_len; | ||
70 | compat_pid_t l_pid; | ||
71 | }; | ||
72 | |||
73 | #define F_GETLK64 12 /* using 'struct flock64' */ | ||
74 | #define F_SETLK64 13 | ||
75 | #define F_SETLKW64 14 | ||
76 | |||
77 | struct compat_flock64 { | ||
78 | short l_type; | ||
79 | short l_whence; | ||
80 | compat_loff_t l_start; | ||
81 | compat_loff_t l_len; | ||
82 | compat_pid_t l_pid; | ||
83 | }; | ||
84 | |||
85 | struct compat_statfs { | ||
86 | int f_type; | ||
87 | int f_bsize; | ||
88 | int f_blocks; | ||
89 | int f_bfree; | ||
90 | int f_bavail; | ||
91 | int f_files; | ||
92 | int f_ffree; | ||
93 | compat_fsid_t f_fsid; | ||
94 | int f_namelen; /* SunOS ignores this field. */ | ||
95 | int f_frsize; | ||
96 | int f_spare[5]; | ||
97 | }; | ||
98 | |||
99 | #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff | ||
100 | #define COMPAT_RLIM_INFINITY 0xffffffff | ||
101 | |||
102 | typedef u32 compat_old_sigset_t; | ||
103 | |||
104 | #define _COMPAT_NSIG 64 | ||
105 | #define _COMPAT_NSIG_BPW 32 | ||
106 | |||
107 | typedef u32 compat_sigset_word; | ||
108 | |||
109 | #define COMPAT_OFF_T_MAX 0x7fffffff | ||
110 | #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL | ||
111 | |||
112 | /* | ||
113 | * A pointer passed in from user mode. This should not | ||
114 | * be used for syscall parameters, just declare them | ||
115 | * as pointers because the syscall entry code will have | ||
116 | * appropriately comverted them already. | ||
117 | */ | ||
118 | typedef u32 compat_uptr_t; | ||
119 | |||
120 | static inline void __user *compat_ptr(compat_uptr_t uptr) | ||
121 | { | ||
122 | return (void __user *)(unsigned long)uptr; | ||
123 | } | ||
124 | |||
125 | static inline void __user *compat_alloc_user_space(long len) | ||
126 | { | ||
127 | struct pt_regs *regs = current->thread.regs; | ||
128 | unsigned long usp = regs->gpr[1]; | ||
129 | |||
130 | /* | ||
131 | * We cant access below the stack pointer in the 32bit ABI and | ||
132 | * can access 288 bytes in the 64bit ABI | ||
133 | */ | ||
134 | if (!(test_thread_flag(TIF_32BIT))) | ||
135 | usp -= 288; | ||
136 | |||
137 | return (void __user *) (usp - len); | ||
138 | } | ||
139 | |||
140 | /* | ||
141 | * ipc64_perm is actually 32/64bit clean but since the compat layer refers to | ||
142 | * it we may as well define it. | ||
143 | */ | ||
144 | struct compat_ipc64_perm { | ||
145 | compat_key_t key; | ||
146 | compat_uid_t uid; | ||
147 | compat_gid_t gid; | ||
148 | compat_uid_t cuid; | ||
149 | compat_gid_t cgid; | ||
150 | compat_mode_t mode; | ||
151 | unsigned int seq; | ||
152 | unsigned int __pad2; | ||
153 | unsigned long __unused1; /* yes they really are 64bit pads */ | ||
154 | unsigned long __unused2; | ||
155 | }; | ||
156 | |||
157 | struct compat_semid64_ds { | ||
158 | struct compat_ipc64_perm sem_perm; | ||
159 | unsigned int __unused1; | ||
160 | compat_time_t sem_otime; | ||
161 | unsigned int __unused2; | ||
162 | compat_time_t sem_ctime; | ||
163 | compat_ulong_t sem_nsems; | ||
164 | compat_ulong_t __unused3; | ||
165 | compat_ulong_t __unused4; | ||
166 | }; | ||
167 | |||
168 | struct compat_msqid64_ds { | ||
169 | struct compat_ipc64_perm msg_perm; | ||
170 | unsigned int __unused1; | ||
171 | compat_time_t msg_stime; | ||
172 | unsigned int __unused2; | ||
173 | compat_time_t msg_rtime; | ||
174 | unsigned int __unused3; | ||
175 | compat_time_t msg_ctime; | ||
176 | compat_ulong_t msg_cbytes; | ||
177 | compat_ulong_t msg_qnum; | ||
178 | compat_ulong_t msg_qbytes; | ||
179 | compat_pid_t msg_lspid; | ||
180 | compat_pid_t msg_lrpid; | ||
181 | compat_ulong_t __unused4; | ||
182 | compat_ulong_t __unused5; | ||
183 | }; | ||
184 | |||
185 | struct compat_shmid64_ds { | ||
186 | struct compat_ipc64_perm shm_perm; | ||
187 | unsigned int __unused1; | ||
188 | compat_time_t shm_atime; | ||
189 | unsigned int __unused2; | ||
190 | compat_time_t shm_dtime; | ||
191 | unsigned int __unused3; | ||
192 | compat_time_t shm_ctime; | ||
193 | unsigned int __unused4; | ||
194 | compat_size_t shm_segsz; | ||
195 | compat_pid_t shm_cpid; | ||
196 | compat_pid_t shm_lpid; | ||
197 | compat_ulong_t shm_nattch; | ||
198 | compat_ulong_t __unused5; | ||
199 | compat_ulong_t __unused6; | ||
200 | }; | ||
201 | |||
202 | #endif /* _ASM_PPC64_COMPAT_H */ | ||
diff --git a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h new file mode 100644 index 000000000000..cbbfbec78b6b --- /dev/null +++ b/include/asm-ppc64/cputable.h | |||
@@ -0,0 +1,197 @@ | |||
1 | /* | ||
2 | * include/asm-ppc64/cputable.h | ||
3 | * | ||
4 | * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org) | ||
5 | * | ||
6 | * Modifications for ppc64: | ||
7 | * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_PPC_CPUTABLE_H | ||
16 | #define __ASM_PPC_CPUTABLE_H | ||
17 | |||
18 | #include <linux/config.h> | ||
19 | #include <asm/page.h> /* for ASM_CONST */ | ||
20 | |||
21 | /* Exposed to userland CPU features - Must match ppc32 definitions */ | ||
22 | #define PPC_FEATURE_32 0x80000000 | ||
23 | #define PPC_FEATURE_64 0x40000000 | ||
24 | #define PPC_FEATURE_601_INSTR 0x20000000 | ||
25 | #define PPC_FEATURE_HAS_ALTIVEC 0x10000000 | ||
26 | #define PPC_FEATURE_HAS_FPU 0x08000000 | ||
27 | #define PPC_FEATURE_HAS_MMU 0x04000000 | ||
28 | #define PPC_FEATURE_HAS_4xxMAC 0x02000000 | ||
29 | #define PPC_FEATURE_UNIFIED_CACHE 0x01000000 | ||
30 | |||
31 | #ifdef __KERNEL__ | ||
32 | |||
33 | #ifndef __ASSEMBLY__ | ||
34 | |||
35 | /* This structure can grow, it's real size is used by head.S code | ||
36 | * via the mkdefs mechanism. | ||
37 | */ | ||
38 | struct cpu_spec; | ||
39 | |||
40 | typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); | ||
41 | |||
42 | struct cpu_spec { | ||
43 | /* CPU is matched via (PVR & pvr_mask) == pvr_value */ | ||
44 | unsigned int pvr_mask; | ||
45 | unsigned int pvr_value; | ||
46 | |||
47 | char *cpu_name; | ||
48 | unsigned long cpu_features; /* Kernel features */ | ||
49 | unsigned int cpu_user_features; /* Userland features */ | ||
50 | |||
51 | /* cache line sizes */ | ||
52 | unsigned int icache_bsize; | ||
53 | unsigned int dcache_bsize; | ||
54 | |||
55 | /* this is called to initialize various CPU bits like L1 cache, | ||
56 | * BHT, SPD, etc... from head.S before branching to identify_machine | ||
57 | */ | ||
58 | cpu_setup_t cpu_setup; | ||
59 | |||
60 | /* This is used to identify firmware features which are available | ||
61 | * to the kernel. | ||
62 | */ | ||
63 | unsigned long firmware_features; | ||
64 | }; | ||
65 | |||
66 | extern struct cpu_spec cpu_specs[]; | ||
67 | extern struct cpu_spec *cur_cpu_spec; | ||
68 | |||
69 | static inline unsigned long cpu_has_feature(unsigned long feature) | ||
70 | { | ||
71 | return cur_cpu_spec->cpu_features & feature; | ||
72 | } | ||
73 | |||
74 | |||
75 | /* firmware feature bitmask values */ | ||
76 | #define FIRMWARE_MAX_FEATURES 63 | ||
77 | |||
78 | #define FW_FEATURE_PFT (1UL<<0) | ||
79 | #define FW_FEATURE_TCE (1UL<<1) | ||
80 | #define FW_FEATURE_SPRG0 (1UL<<2) | ||
81 | #define FW_FEATURE_DABR (1UL<<3) | ||
82 | #define FW_FEATURE_COPY (1UL<<4) | ||
83 | #define FW_FEATURE_ASR (1UL<<5) | ||
84 | #define FW_FEATURE_DEBUG (1UL<<6) | ||
85 | #define FW_FEATURE_TERM (1UL<<7) | ||
86 | #define FW_FEATURE_PERF (1UL<<8) | ||
87 | #define FW_FEATURE_DUMP (1UL<<9) | ||
88 | #define FW_FEATURE_INTERRUPT (1UL<<10) | ||
89 | #define FW_FEATURE_MIGRATE (1UL<<11) | ||
90 | #define FW_FEATURE_PERFMON (1UL<<12) | ||
91 | #define FW_FEATURE_CRQ (1UL<<13) | ||
92 | #define FW_FEATURE_VIO (1UL<<14) | ||
93 | #define FW_FEATURE_RDMA (1UL<<15) | ||
94 | #define FW_FEATURE_LLAN (1UL<<16) | ||
95 | #define FW_FEATURE_BULK (1UL<<17) | ||
96 | #define FW_FEATURE_XDABR (1UL<<18) | ||
97 | #define FW_FEATURE_MULTITCE (1UL<<19) | ||
98 | #define FW_FEATURE_SPLPAR (1UL<<20) | ||
99 | |||
100 | typedef struct { | ||
101 | unsigned long val; | ||
102 | char * name; | ||
103 | } firmware_feature_t; | ||
104 | |||
105 | extern firmware_feature_t firmware_features_table[]; | ||
106 | |||
107 | #endif /* __ASSEMBLY__ */ | ||
108 | |||
109 | /* CPU kernel features */ | ||
110 | |||
111 | /* Retain the 32b definitions for the time being - use bottom half of word */ | ||
112 | #define CPU_FTR_SPLIT_ID_CACHE ASM_CONST(0x0000000000000001) | ||
113 | #define CPU_FTR_L2CR ASM_CONST(0x0000000000000002) | ||
114 | #define CPU_FTR_SPEC7450 ASM_CONST(0x0000000000000004) | ||
115 | #define CPU_FTR_ALTIVEC ASM_CONST(0x0000000000000008) | ||
116 | #define CPU_FTR_TAU ASM_CONST(0x0000000000000010) | ||
117 | #define CPU_FTR_CAN_DOZE ASM_CONST(0x0000000000000020) | ||
118 | #define CPU_FTR_USE_TB ASM_CONST(0x0000000000000040) | ||
119 | #define CPU_FTR_604_PERF_MON ASM_CONST(0x0000000000000080) | ||
120 | #define CPU_FTR_601 ASM_CONST(0x0000000000000100) | ||
121 | #define CPU_FTR_HPTE_TABLE ASM_CONST(0x0000000000000200) | ||
122 | #define CPU_FTR_CAN_NAP ASM_CONST(0x0000000000000400) | ||
123 | #define CPU_FTR_L3CR ASM_CONST(0x0000000000000800) | ||
124 | #define CPU_FTR_L3_DISABLE_NAP ASM_CONST(0x0000000000001000) | ||
125 | #define CPU_FTR_NAP_DISABLE_L2_PR ASM_CONST(0x0000000000002000) | ||
126 | #define CPU_FTR_DUAL_PLL_750FX ASM_CONST(0x0000000000004000) | ||
127 | |||
128 | /* Add the 64b processor unique features in the top half of the word */ | ||
129 | #define CPU_FTR_SLB ASM_CONST(0x0000000100000000) | ||
130 | #define CPU_FTR_16M_PAGE ASM_CONST(0x0000000200000000) | ||
131 | #define CPU_FTR_TLBIEL ASM_CONST(0x0000000400000000) | ||
132 | #define CPU_FTR_NOEXECUTE ASM_CONST(0x0000000800000000) | ||
133 | #define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000001000000000) | ||
134 | #define CPU_FTR_IABR ASM_CONST(0x0000002000000000) | ||
135 | #define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000) | ||
136 | #define CPU_FTR_PMC8 ASM_CONST(0x0000008000000000) | ||
137 | #define CPU_FTR_SMT ASM_CONST(0x0000010000000000) | ||
138 | #define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) | ||
139 | #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) | ||
140 | #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) | ||
141 | |||
142 | /* Platform firmware features */ | ||
143 | #define FW_FTR_ ASM_CONST(0x0000000000000001) | ||
144 | |||
145 | #ifndef __ASSEMBLY__ | ||
146 | #define COMMON_USER_PPC64 (PPC_FEATURE_32 | PPC_FEATURE_64 | \ | ||
147 | PPC_FEATURE_HAS_FPU | PPC_FEATURE_HAS_MMU) | ||
148 | |||
149 | #define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ | ||
150 | CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ | ||
151 | CPU_FTR_NODSISRALIGN) | ||
152 | |||
153 | /* iSeries doesn't support large pages */ | ||
154 | #ifdef CONFIG_PPC_ISERIES | ||
155 | #define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE) | ||
156 | #else | ||
157 | #define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE | CPU_FTR_16M_PAGE) | ||
158 | #endif | ||
159 | |||
160 | #define COMMON_PPC64_FW (0) | ||
161 | #endif | ||
162 | |||
163 | #ifdef __ASSEMBLY__ | ||
164 | |||
165 | #define BEGIN_FTR_SECTION 98: | ||
166 | |||
167 | #define END_FTR_SECTION(msk, val) \ | ||
168 | 99: \ | ||
169 | .section __ftr_fixup,"a"; \ | ||
170 | .align 3; \ | ||
171 | .llong msk; \ | ||
172 | .llong val; \ | ||
173 | .llong 98b; \ | ||
174 | .llong 99b; \ | ||
175 | .previous | ||
176 | |||
177 | #else | ||
178 | |||
179 | #define BEGIN_FTR_SECTION "98:\n" | ||
180 | #define END_FTR_SECTION(msk, val) \ | ||
181 | "99:\n" \ | ||
182 | " .section __ftr_fixup,\"a\";\n" \ | ||
183 | " .align 3;\n" \ | ||
184 | " .llong "#msk";\n" \ | ||
185 | " .llong "#val";\n" \ | ||
186 | " .llong 98b;\n" \ | ||
187 | " .llong 99b;\n" \ | ||
188 | " .previous\n" | ||
189 | |||
190 | #endif /* __ASSEMBLY__ */ | ||
191 | |||
192 | #define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk)) | ||
193 | #define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0) | ||
194 | |||
195 | #endif /* __ASM_PPC_CPUTABLE_H */ | ||
196 | #endif /* __KERNEL__ */ | ||
197 | |||
diff --git a/include/asm-ppc64/cputime.h b/include/asm-ppc64/cputime.h new file mode 100644 index 000000000000..8e9faf5ce720 --- /dev/null +++ b/include/asm-ppc64/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __PPC_CPUTIME_H | ||
2 | #define __PPC_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __PPC_CPUTIME_H */ | ||
diff --git a/include/asm-ppc64/current.h b/include/asm-ppc64/current.h new file mode 100644 index 000000000000..52ddc60c8b65 --- /dev/null +++ b/include/asm-ppc64/current.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _PPC64_CURRENT_H | ||
2 | #define _PPC64_CURRENT_H | ||
3 | |||
4 | #include <asm/paca.h> | ||
5 | |||
6 | /* | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #define get_current() (get_paca()->__current) | ||
14 | #define current get_current() | ||
15 | |||
16 | #endif /* !(_PPC64_CURRENT_H) */ | ||
diff --git a/include/asm-ppc64/dbdma.h b/include/asm-ppc64/dbdma.h new file mode 100644 index 000000000000..f2d5d5dc3377 --- /dev/null +++ b/include/asm-ppc64/dbdma.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <asm-ppc/dbdma.h> | ||
2 | |||
diff --git a/include/asm-ppc64/delay.h b/include/asm-ppc64/delay.h new file mode 100644 index 000000000000..05f198cf73d9 --- /dev/null +++ b/include/asm-ppc64/delay.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef _PPC64_DELAY_H | ||
2 | #define _PPC64_DELAY_H | ||
3 | |||
4 | /* | ||
5 | * Copyright 1996, Paul Mackerras. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * PPC64 Support added by Dave Engebretsen, Todd Inglett, Mike Corrigan, | ||
13 | * Anton Blanchard. | ||
14 | */ | ||
15 | |||
16 | extern unsigned long tb_ticks_per_usec; | ||
17 | |||
18 | /* define these here to prevent circular dependencies */ | ||
19 | #define __HMT_low() asm volatile("or 1,1,1") | ||
20 | #define __HMT_medium() asm volatile("or 2,2,2") | ||
21 | #define __barrier() asm volatile("":::"memory") | ||
22 | |||
23 | static inline unsigned long __get_tb(void) | ||
24 | { | ||
25 | unsigned long rval; | ||
26 | |||
27 | asm volatile("mftb %0" : "=r" (rval)); | ||
28 | return rval; | ||
29 | } | ||
30 | |||
31 | static inline void __delay(unsigned long loops) | ||
32 | { | ||
33 | unsigned long start = __get_tb(); | ||
34 | |||
35 | while((__get_tb()-start) < loops) | ||
36 | __HMT_low(); | ||
37 | __HMT_medium(); | ||
38 | __barrier(); | ||
39 | } | ||
40 | |||
41 | static inline void udelay(unsigned long usecs) | ||
42 | { | ||
43 | unsigned long loops = tb_ticks_per_usec * usecs; | ||
44 | |||
45 | __delay(loops); | ||
46 | } | ||
47 | |||
48 | #endif /* _PPC64_DELAY_H */ | ||
diff --git a/include/asm-ppc64/div64.h b/include/asm-ppc64/div64.h new file mode 100644 index 000000000000..6cd978cefb28 --- /dev/null +++ b/include/asm-ppc64/div64.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/div64.h> | |||
diff --git a/include/asm-ppc64/dma-mapping.h b/include/asm-ppc64/dma-mapping.h new file mode 100644 index 000000000000..9ad8adee0067 --- /dev/null +++ b/include/asm-ppc64/dma-mapping.h | |||
@@ -0,0 +1,136 @@ | |||
1 | /* Copyright (C) 2004 IBM | ||
2 | * | ||
3 | * Implements the generic device dma API for ppc64. Handles | ||
4 | * the pci and vio busses | ||
5 | */ | ||
6 | |||
7 | #ifndef _ASM_DMA_MAPPING_H | ||
8 | #define _ASM_DMA_MAPPING_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/cache.h> | ||
12 | /* need struct page definitions */ | ||
13 | #include <linux/mm.h> | ||
14 | #include <asm/scatterlist.h> | ||
15 | #include <asm/bug.h> | ||
16 | |||
17 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) | ||
18 | |||
19 | extern int dma_supported(struct device *dev, u64 mask); | ||
20 | extern int dma_set_mask(struct device *dev, u64 dma_mask); | ||
21 | extern void *dma_alloc_coherent(struct device *dev, size_t size, | ||
22 | dma_addr_t *dma_handle, unsigned int __nocast flag); | ||
23 | extern void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | ||
24 | dma_addr_t dma_handle); | ||
25 | extern dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, | ||
26 | size_t size, enum dma_data_direction direction); | ||
27 | extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, | ||
28 | size_t size, enum dma_data_direction direction); | ||
29 | extern dma_addr_t dma_map_page(struct device *dev, struct page *page, | ||
30 | unsigned long offset, size_t size, | ||
31 | enum dma_data_direction direction); | ||
32 | extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address, | ||
33 | size_t size, enum dma_data_direction direction); | ||
34 | extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
35 | enum dma_data_direction direction); | ||
36 | extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, | ||
37 | int nhwentries, enum dma_data_direction direction); | ||
38 | |||
39 | static inline void | ||
40 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
41 | enum dma_data_direction direction) | ||
42 | { | ||
43 | BUG_ON(direction == DMA_NONE); | ||
44 | /* nothing to do */ | ||
45 | } | ||
46 | |||
47 | static inline void | ||
48 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
49 | enum dma_data_direction direction) | ||
50 | { | ||
51 | BUG_ON(direction == DMA_NONE); | ||
52 | /* nothing to do */ | ||
53 | } | ||
54 | |||
55 | static inline void | ||
56 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
57 | enum dma_data_direction direction) | ||
58 | { | ||
59 | BUG_ON(direction == DMA_NONE); | ||
60 | /* nothing to do */ | ||
61 | } | ||
62 | |||
63 | static inline void | ||
64 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, | ||
65 | enum dma_data_direction direction) | ||
66 | { | ||
67 | BUG_ON(direction == DMA_NONE); | ||
68 | /* nothing to do */ | ||
69 | } | ||
70 | |||
71 | static inline int dma_mapping_error(dma_addr_t dma_addr) | ||
72 | { | ||
73 | return (dma_addr == DMA_ERROR_CODE); | ||
74 | } | ||
75 | |||
76 | /* Now for the API extensions over the pci_ one */ | ||
77 | |||
78 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
79 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
80 | #define dma_is_consistent(d) (1) | ||
81 | |||
82 | static inline int | ||
83 | dma_get_cache_alignment(void) | ||
84 | { | ||
85 | /* no easy way to get cache size on all processors, so return | ||
86 | * the maximum possible, to be safe */ | ||
87 | return (1 << L1_CACHE_SHIFT_MAX); | ||
88 | } | ||
89 | |||
90 | static inline void | ||
91 | dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, | ||
92 | unsigned long offset, size_t size, | ||
93 | enum dma_data_direction direction) | ||
94 | { | ||
95 | BUG_ON(direction == DMA_NONE); | ||
96 | /* nothing to do */ | ||
97 | } | ||
98 | |||
99 | static inline void | ||
100 | dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, | ||
101 | unsigned long offset, size_t size, | ||
102 | enum dma_data_direction direction) | ||
103 | { | ||
104 | BUG_ON(direction == DMA_NONE); | ||
105 | /* nothing to do */ | ||
106 | } | ||
107 | |||
108 | static inline void | ||
109 | dma_cache_sync(void *vaddr, size_t size, | ||
110 | enum dma_data_direction direction) | ||
111 | { | ||
112 | BUG_ON(direction == DMA_NONE); | ||
113 | /* nothing to do */ | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO | ||
118 | */ | ||
119 | struct dma_mapping_ops { | ||
120 | void * (*alloc_coherent)(struct device *dev, size_t size, | ||
121 | dma_addr_t *dma_handle, unsigned int __nocast flag); | ||
122 | void (*free_coherent)(struct device *dev, size_t size, | ||
123 | void *vaddr, dma_addr_t dma_handle); | ||
124 | dma_addr_t (*map_single)(struct device *dev, void *ptr, | ||
125 | size_t size, enum dma_data_direction direction); | ||
126 | void (*unmap_single)(struct device *dev, dma_addr_t dma_addr, | ||
127 | size_t size, enum dma_data_direction direction); | ||
128 | int (*map_sg)(struct device *dev, struct scatterlist *sg, | ||
129 | int nents, enum dma_data_direction direction); | ||
130 | void (*unmap_sg)(struct device *dev, struct scatterlist *sg, | ||
131 | int nents, enum dma_data_direction direction); | ||
132 | int (*dma_supported)(struct device *dev, u64 mask); | ||
133 | int (*dac_dma_supported)(struct device *dev, u64 mask); | ||
134 | }; | ||
135 | |||
136 | #endif /* _ASM_DMA_MAPPING_H */ | ||
diff --git a/include/asm-ppc64/dma.h b/include/asm-ppc64/dma.h new file mode 100644 index 000000000000..d693b8026bc3 --- /dev/null +++ b/include/asm-ppc64/dma.h | |||
@@ -0,0 +1,326 @@ | |||
1 | /* | ||
2 | * linux/include/asm/dma.h: Defines for using and allocating dma channels. | ||
3 | * Written by Hennus Bergman, 1992. | ||
4 | * High DMA channel support & info by Hannu Savolainen | ||
5 | * and John Boyd, Nov. 1992. | ||
6 | * Changes for ppc sound by Christoph Nadig | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #ifndef _ASM_DMA_H | ||
15 | #define _ASM_DMA_H | ||
16 | |||
17 | #include <linux/config.h> | ||
18 | #include <asm/io.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <asm/system.h> | ||
21 | |||
22 | #ifndef MAX_DMA_CHANNELS | ||
23 | #define MAX_DMA_CHANNELS 8 | ||
24 | #endif | ||
25 | |||
26 | /* The maximum address that we can perform a DMA transfer to on this platform */ | ||
27 | /* Doesn't really apply... */ | ||
28 | #define MAX_DMA_ADDRESS (~0UL) | ||
29 | |||
30 | #define dma_outb outb | ||
31 | #define dma_inb inb | ||
32 | |||
33 | /* | ||
34 | * NOTES about DMA transfers: | ||
35 | * | ||
36 | * controller 1: channels 0-3, byte operations, ports 00-1F | ||
37 | * controller 2: channels 4-7, word operations, ports C0-DF | ||
38 | * | ||
39 | * - ALL registers are 8 bits only, regardless of transfer size | ||
40 | * - channel 4 is not used - cascades 1 into 2. | ||
41 | * - channels 0-3 are byte - addresses/counts are for physical bytes | ||
42 | * - channels 5-7 are word - addresses/counts are for physical words | ||
43 | * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries | ||
44 | * - transfer count loaded to registers is 1 less than actual count | ||
45 | * - controller 2 offsets are all even (2x offsets for controller 1) | ||
46 | * - page registers for 5-7 don't use data bit 0, represent 128K pages | ||
47 | * - page registers for 0-3 use bit 0, represent 64K pages | ||
48 | * | ||
49 | * On PReP, DMA transfers are limited to the lower 16MB of _physical_ memory. | ||
50 | * On CHRP, the W83C553F (and VLSI Tollgate?) support full 32 bit addressing. | ||
51 | * Note that addresses loaded into registers must be _physical_ addresses, | ||
52 | * not logical addresses (which may differ if paging is active). | ||
53 | * | ||
54 | * Address mapping for channels 0-3: | ||
55 | * | ||
56 | * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses) | ||
57 | * | ... | | ... | | ... | | ||
58 | * | ... | | ... | | ... | | ||
59 | * | ... | | ... | | ... | | ||
60 | * P7 ... P0 A7 ... A0 A7 ... A0 | ||
61 | * | Page | Addr MSB | Addr LSB | (DMA registers) | ||
62 | * | ||
63 | * Address mapping for channels 5-7: | ||
64 | * | ||
65 | * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses) | ||
66 | * | ... | \ \ ... \ \ \ ... \ \ | ||
67 | * | ... | \ \ ... \ \ \ ... \ (not used) | ||
68 | * | ... | \ \ ... \ \ \ ... \ | ||
69 | * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0 | ||
70 | * | Page | Addr MSB | Addr LSB | (DMA registers) | ||
71 | * | ||
72 | * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses | ||
73 | * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at | ||
74 | * the hardware level, so odd-byte transfers aren't possible). | ||
75 | * | ||
76 | * Transfer count (_not # bytes_) is limited to 64K, represented as actual | ||
77 | * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more, | ||
78 | * and up to 128K bytes may be transferred on channels 5-7 in one operation. | ||
79 | * | ||
80 | */ | ||
81 | |||
82 | /* 8237 DMA controllers */ | ||
83 | #define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ | ||
84 | #define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */ | ||
85 | |||
86 | /* DMA controller registers */ | ||
87 | #define DMA1_CMD_REG 0x08 /* command register (w) */ | ||
88 | #define DMA1_STAT_REG 0x08 /* status register (r) */ | ||
89 | #define DMA1_REQ_REG 0x09 /* request register (w) */ | ||
90 | #define DMA1_MASK_REG 0x0A /* single-channel mask (w) */ | ||
91 | #define DMA1_MODE_REG 0x0B /* mode register (w) */ | ||
92 | #define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */ | ||
93 | #define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */ | ||
94 | #define DMA1_RESET_REG 0x0D /* Master Clear (w) */ | ||
95 | #define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */ | ||
96 | #define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */ | ||
97 | |||
98 | #define DMA2_CMD_REG 0xD0 /* command register (w) */ | ||
99 | #define DMA2_STAT_REG 0xD0 /* status register (r) */ | ||
100 | #define DMA2_REQ_REG 0xD2 /* request register (w) */ | ||
101 | #define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */ | ||
102 | #define DMA2_MODE_REG 0xD6 /* mode register (w) */ | ||
103 | #define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */ | ||
104 | #define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */ | ||
105 | #define DMA2_RESET_REG 0xDA /* Master Clear (w) */ | ||
106 | #define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */ | ||
107 | #define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */ | ||
108 | |||
109 | #define DMA_ADDR_0 0x00 /* DMA address registers */ | ||
110 | #define DMA_ADDR_1 0x02 | ||
111 | #define DMA_ADDR_2 0x04 | ||
112 | #define DMA_ADDR_3 0x06 | ||
113 | #define DMA_ADDR_4 0xC0 | ||
114 | #define DMA_ADDR_5 0xC4 | ||
115 | #define DMA_ADDR_6 0xC8 | ||
116 | #define DMA_ADDR_7 0xCC | ||
117 | |||
118 | #define DMA_CNT_0 0x01 /* DMA count registers */ | ||
119 | #define DMA_CNT_1 0x03 | ||
120 | #define DMA_CNT_2 0x05 | ||
121 | #define DMA_CNT_3 0x07 | ||
122 | #define DMA_CNT_4 0xC2 | ||
123 | #define DMA_CNT_5 0xC6 | ||
124 | #define DMA_CNT_6 0xCA | ||
125 | #define DMA_CNT_7 0xCE | ||
126 | |||
127 | #define DMA_LO_PAGE_0 0x87 /* DMA page registers */ | ||
128 | #define DMA_LO_PAGE_1 0x83 | ||
129 | #define DMA_LO_PAGE_2 0x81 | ||
130 | #define DMA_LO_PAGE_3 0x82 | ||
131 | #define DMA_LO_PAGE_5 0x8B | ||
132 | #define DMA_LO_PAGE_6 0x89 | ||
133 | #define DMA_LO_PAGE_7 0x8A | ||
134 | |||
135 | #define DMA_HI_PAGE_0 0x487 /* DMA page registers */ | ||
136 | #define DMA_HI_PAGE_1 0x483 | ||
137 | #define DMA_HI_PAGE_2 0x481 | ||
138 | #define DMA_HI_PAGE_3 0x482 | ||
139 | #define DMA_HI_PAGE_5 0x48B | ||
140 | #define DMA_HI_PAGE_6 0x489 | ||
141 | #define DMA_HI_PAGE_7 0x48A | ||
142 | |||
143 | #define DMA1_EXT_REG 0x40B | ||
144 | #define DMA2_EXT_REG 0x4D6 | ||
145 | |||
146 | #define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */ | ||
147 | #define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ | ||
148 | #define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ | ||
149 | |||
150 | #define DMA_AUTOINIT 0x10 | ||
151 | |||
152 | extern spinlock_t dma_spin_lock; | ||
153 | |||
154 | static __inline__ unsigned long claim_dma_lock(void) | ||
155 | { | ||
156 | unsigned long flags; | ||
157 | spin_lock_irqsave(&dma_spin_lock, flags); | ||
158 | return flags; | ||
159 | } | ||
160 | |||
161 | static __inline__ void release_dma_lock(unsigned long flags) | ||
162 | { | ||
163 | spin_unlock_irqrestore(&dma_spin_lock, flags); | ||
164 | } | ||
165 | |||
166 | /* enable/disable a specific DMA channel */ | ||
167 | static __inline__ void enable_dma(unsigned int dmanr) | ||
168 | { | ||
169 | unsigned char ucDmaCmd=0x00; | ||
170 | |||
171 | if (dmanr != 4) | ||
172 | { | ||
173 | dma_outb(0, DMA2_MASK_REG); /* This may not be enabled */ | ||
174 | dma_outb(ucDmaCmd, DMA2_CMD_REG); /* Enable group */ | ||
175 | } | ||
176 | if (dmanr<=3) | ||
177 | { | ||
178 | dma_outb(dmanr, DMA1_MASK_REG); | ||
179 | dma_outb(ucDmaCmd, DMA1_CMD_REG); /* Enable group */ | ||
180 | } else | ||
181 | { | ||
182 | dma_outb(dmanr & 3, DMA2_MASK_REG); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | static __inline__ void disable_dma(unsigned int dmanr) | ||
187 | { | ||
188 | if (dmanr<=3) | ||
189 | dma_outb(dmanr | 4, DMA1_MASK_REG); | ||
190 | else | ||
191 | dma_outb((dmanr & 3) | 4, DMA2_MASK_REG); | ||
192 | } | ||
193 | |||
194 | /* Clear the 'DMA Pointer Flip Flop'. | ||
195 | * Write 0 for LSB/MSB, 1 for MSB/LSB access. | ||
196 | * Use this once to initialize the FF to a known state. | ||
197 | * After that, keep track of it. :-) | ||
198 | * --- In order to do that, the DMA routines below should --- | ||
199 | * --- only be used while interrupts are disabled! --- | ||
200 | */ | ||
201 | static __inline__ void clear_dma_ff(unsigned int dmanr) | ||
202 | { | ||
203 | if (dmanr<=3) | ||
204 | dma_outb(0, DMA1_CLEAR_FF_REG); | ||
205 | else | ||
206 | dma_outb(0, DMA2_CLEAR_FF_REG); | ||
207 | } | ||
208 | |||
209 | /* set mode (above) for a specific DMA channel */ | ||
210 | static __inline__ void set_dma_mode(unsigned int dmanr, char mode) | ||
211 | { | ||
212 | if (dmanr<=3) | ||
213 | dma_outb(mode | dmanr, DMA1_MODE_REG); | ||
214 | else | ||
215 | dma_outb(mode | (dmanr&3), DMA2_MODE_REG); | ||
216 | } | ||
217 | |||
218 | /* Set only the page register bits of the transfer address. | ||
219 | * This is used for successive transfers when we know the contents of | ||
220 | * the lower 16 bits of the DMA current address register, but a 64k boundary | ||
221 | * may have been crossed. | ||
222 | */ | ||
223 | static __inline__ void set_dma_page(unsigned int dmanr, int pagenr) | ||
224 | { | ||
225 | switch(dmanr) { | ||
226 | case 0: | ||
227 | dma_outb(pagenr, DMA_LO_PAGE_0); | ||
228 | dma_outb(pagenr>>8, DMA_HI_PAGE_0); | ||
229 | break; | ||
230 | case 1: | ||
231 | dma_outb(pagenr, DMA_LO_PAGE_1); | ||
232 | dma_outb(pagenr>>8, DMA_HI_PAGE_1); | ||
233 | break; | ||
234 | case 2: | ||
235 | dma_outb(pagenr, DMA_LO_PAGE_2); | ||
236 | dma_outb(pagenr>>8, DMA_HI_PAGE_2); | ||
237 | break; | ||
238 | case 3: | ||
239 | dma_outb(pagenr, DMA_LO_PAGE_3); | ||
240 | dma_outb(pagenr>>8, DMA_HI_PAGE_3); | ||
241 | break; | ||
242 | case 5: | ||
243 | dma_outb(pagenr & 0xfe, DMA_LO_PAGE_5); | ||
244 | dma_outb(pagenr>>8, DMA_HI_PAGE_5); | ||
245 | break; | ||
246 | case 6: | ||
247 | dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6); | ||
248 | dma_outb(pagenr>>8, DMA_HI_PAGE_6); | ||
249 | break; | ||
250 | case 7: | ||
251 | dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7); | ||
252 | dma_outb(pagenr>>8, DMA_HI_PAGE_7); | ||
253 | break; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | |||
258 | /* Set transfer address & page bits for specific DMA channel. | ||
259 | * Assumes dma flipflop is clear. | ||
260 | */ | ||
261 | static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int phys) | ||
262 | { | ||
263 | if (dmanr <= 3) { | ||
264 | dma_outb( phys & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); | ||
265 | dma_outb( (phys>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); | ||
266 | } else { | ||
267 | dma_outb( (phys>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); | ||
268 | dma_outb( (phys>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); | ||
269 | } | ||
270 | set_dma_page(dmanr, phys>>16); | ||
271 | } | ||
272 | |||
273 | |||
274 | /* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for | ||
275 | * a specific DMA channel. | ||
276 | * You must ensure the parameters are valid. | ||
277 | * NOTE: from a manual: "the number of transfers is one more | ||
278 | * than the initial word count"! This is taken into account. | ||
279 | * Assumes dma flip-flop is clear. | ||
280 | * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7. | ||
281 | */ | ||
282 | static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) | ||
283 | { | ||
284 | count--; | ||
285 | if (dmanr <= 3) { | ||
286 | dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); | ||
287 | dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); | ||
288 | } else { | ||
289 | dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); | ||
290 | dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | |||
295 | /* Get DMA residue count. After a DMA transfer, this | ||
296 | * should return zero. Reading this while a DMA transfer is | ||
297 | * still in progress will return unpredictable results. | ||
298 | * If called before the channel has been used, it may return 1. | ||
299 | * Otherwise, it returns the number of _bytes_ left to transfer. | ||
300 | * | ||
301 | * Assumes DMA flip-flop is clear. | ||
302 | */ | ||
303 | static __inline__ int get_dma_residue(unsigned int dmanr) | ||
304 | { | ||
305 | unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE | ||
306 | : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE; | ||
307 | |||
308 | /* using short to get 16-bit wrap around */ | ||
309 | unsigned short count; | ||
310 | |||
311 | count = 1 + dma_inb(io_port); | ||
312 | count += dma_inb(io_port) << 8; | ||
313 | |||
314 | return (dmanr <= 3)? count : (count<<1); | ||
315 | } | ||
316 | |||
317 | /* These are in kernel/dma.c: */ | ||
318 | extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ | ||
319 | extern void free_dma(unsigned int dmanr); /* release it again */ | ||
320 | |||
321 | #ifdef CONFIG_PCI | ||
322 | extern int isa_dma_bridge_buggy; | ||
323 | #else | ||
324 | #define isa_dma_bridge_buggy (0) | ||
325 | #endif | ||
326 | #endif /* _ASM_DMA_H */ | ||
diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h new file mode 100644 index 000000000000..94298b106a4b --- /dev/null +++ b/include/asm-ppc64/eeh.h | |||
@@ -0,0 +1,383 @@ | |||
1 | /* | ||
2 | * eeh.h | ||
3 | * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef _PPC64_EEH_H | ||
21 | #define _PPC64_EEH_H | ||
22 | |||
23 | #include <linux/config.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/list.h> | ||
26 | #include <linux/string.h> | ||
27 | |||
28 | struct pci_dev; | ||
29 | struct device_node; | ||
30 | struct device_node; | ||
31 | struct notifier_block; | ||
32 | |||
33 | #ifdef CONFIG_EEH | ||
34 | |||
35 | /* Values for eeh_mode bits in device_node */ | ||
36 | #define EEH_MODE_SUPPORTED (1<<0) | ||
37 | #define EEH_MODE_NOCHECK (1<<1) | ||
38 | #define EEH_MODE_ISOLATED (1<<2) | ||
39 | |||
40 | void __init eeh_init(void); | ||
41 | unsigned long eeh_check_failure(const volatile void __iomem *token, | ||
42 | unsigned long val); | ||
43 | int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev); | ||
44 | void __init pci_addr_cache_build(void); | ||
45 | |||
46 | /** | ||
47 | * eeh_add_device_early | ||
48 | * eeh_add_device_late | ||
49 | * | ||
50 | * Perform eeh initialization for devices added after boot. | ||
51 | * Call eeh_add_device_early before doing any i/o to the | ||
52 | * device (including config space i/o). Call eeh_add_device_late | ||
53 | * to finish the eeh setup for this device. | ||
54 | */ | ||
55 | void eeh_add_device_early(struct device_node *); | ||
56 | void eeh_add_device_late(struct pci_dev *); | ||
57 | |||
58 | /** | ||
59 | * eeh_remove_device - undo EEH setup for the indicated pci device | ||
60 | * @dev: pci device to be removed | ||
61 | * | ||
62 | * This routine should be when a device is removed from a running | ||
63 | * system (e.g. by hotplug or dlpar). | ||
64 | */ | ||
65 | void eeh_remove_device(struct pci_dev *); | ||
66 | |||
67 | #define EEH_DISABLE 0 | ||
68 | #define EEH_ENABLE 1 | ||
69 | #define EEH_RELEASE_LOADSTORE 2 | ||
70 | #define EEH_RELEASE_DMA 3 | ||
71 | |||
72 | /** | ||
73 | * Notifier event flags. | ||
74 | */ | ||
75 | #define EEH_NOTIFY_FREEZE 1 | ||
76 | |||
77 | /** EEH event -- structure holding pci slot data that describes | ||
78 | * a change in the isolation status of a PCI slot. A pointer | ||
79 | * to this struct is passed as the data pointer in a notify callback. | ||
80 | */ | ||
81 | struct eeh_event { | ||
82 | struct list_head list; | ||
83 | struct pci_dev *dev; | ||
84 | struct device_node *dn; | ||
85 | int reset_state; | ||
86 | }; | ||
87 | |||
88 | /** Register to find out about EEH events. */ | ||
89 | int eeh_register_notifier(struct notifier_block *nb); | ||
90 | int eeh_unregister_notifier(struct notifier_block *nb); | ||
91 | |||
92 | /** | ||
93 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. | ||
94 | * | ||
95 | * If this macro yields TRUE, the caller relays to eeh_check_failure() | ||
96 | * which does further tests out of line. | ||
97 | */ | ||
98 | #define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0) | ||
99 | |||
100 | /* | ||
101 | * Reads from a device which has been isolated by EEH will return | ||
102 | * all 1s. This macro gives an all-1s value of the given size (in | ||
103 | * bytes: 1, 2, or 4) for comparing with the result of a read. | ||
104 | */ | ||
105 | #define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8)) | ||
106 | |||
107 | #else /* !CONFIG_EEH */ | ||
108 | static inline void eeh_init(void) { } | ||
109 | |||
110 | static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) | ||
111 | { | ||
112 | return val; | ||
113 | } | ||
114 | |||
115 | static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) | ||
116 | { | ||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static inline void pci_addr_cache_build(void) { } | ||
121 | |||
122 | static inline void eeh_add_device_early(struct device_node *dn) { } | ||
123 | |||
124 | static inline void eeh_add_device_late(struct pci_dev *dev) { } | ||
125 | |||
126 | static inline void eeh_remove_device(struct pci_dev *dev) { } | ||
127 | |||
128 | #define EEH_POSSIBLE_ERROR(val, type) (0) | ||
129 | #define EEH_IO_ERROR_VALUE(size) (-1UL) | ||
130 | #endif /* CONFIG_EEH */ | ||
131 | |||
132 | /* | ||
133 | * MMIO read/write operations with EEH support. | ||
134 | */ | ||
135 | static inline u8 eeh_readb(const volatile void __iomem *addr) | ||
136 | { | ||
137 | u8 val = in_8(addr); | ||
138 | if (EEH_POSSIBLE_ERROR(val, u8)) | ||
139 | return eeh_check_failure(addr, val); | ||
140 | return val; | ||
141 | } | ||
142 | static inline void eeh_writeb(u8 val, volatile void __iomem *addr) | ||
143 | { | ||
144 | out_8(addr, val); | ||
145 | } | ||
146 | |||
147 | static inline u16 eeh_readw(const volatile void __iomem *addr) | ||
148 | { | ||
149 | u16 val = in_le16(addr); | ||
150 | if (EEH_POSSIBLE_ERROR(val, u16)) | ||
151 | return eeh_check_failure(addr, val); | ||
152 | return val; | ||
153 | } | ||
154 | static inline void eeh_writew(u16 val, volatile void __iomem *addr) | ||
155 | { | ||
156 | out_le16(addr, val); | ||
157 | } | ||
158 | static inline u16 eeh_raw_readw(const volatile void __iomem *addr) | ||
159 | { | ||
160 | u16 val = in_be16(addr); | ||
161 | if (EEH_POSSIBLE_ERROR(val, u16)) | ||
162 | return eeh_check_failure(addr, val); | ||
163 | return val; | ||
164 | } | ||
165 | static inline void eeh_raw_writew(u16 val, volatile void __iomem *addr) { | ||
166 | volatile u16 __iomem *vaddr = (volatile u16 __iomem *) addr; | ||
167 | out_be16(vaddr, val); | ||
168 | } | ||
169 | |||
170 | static inline u32 eeh_readl(const volatile void __iomem *addr) | ||
171 | { | ||
172 | u32 val = in_le32(addr); | ||
173 | if (EEH_POSSIBLE_ERROR(val, u32)) | ||
174 | return eeh_check_failure(addr, val); | ||
175 | return val; | ||
176 | } | ||
177 | static inline void eeh_writel(u32 val, volatile void __iomem *addr) | ||
178 | { | ||
179 | out_le32(addr, val); | ||
180 | } | ||
181 | static inline u32 eeh_raw_readl(const volatile void __iomem *addr) | ||
182 | { | ||
183 | u32 val = in_be32(addr); | ||
184 | if (EEH_POSSIBLE_ERROR(val, u32)) | ||
185 | return eeh_check_failure(addr, val); | ||
186 | return val; | ||
187 | } | ||
188 | static inline void eeh_raw_writel(u32 val, volatile void __iomem *addr) | ||
189 | { | ||
190 | out_be32(addr, val); | ||
191 | } | ||
192 | |||
193 | static inline u64 eeh_readq(const volatile void __iomem *addr) | ||
194 | { | ||
195 | u64 val = in_le64(addr); | ||
196 | if (EEH_POSSIBLE_ERROR(val, u64)) | ||
197 | return eeh_check_failure(addr, val); | ||
198 | return val; | ||
199 | } | ||
200 | static inline void eeh_writeq(u64 val, volatile void __iomem *addr) | ||
201 | { | ||
202 | out_le64(addr, val); | ||
203 | } | ||
204 | static inline u64 eeh_raw_readq(const volatile void __iomem *addr) | ||
205 | { | ||
206 | u64 val = in_be64(addr); | ||
207 | if (EEH_POSSIBLE_ERROR(val, u64)) | ||
208 | return eeh_check_failure(addr, val); | ||
209 | return val; | ||
210 | } | ||
211 | static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr) | ||
212 | { | ||
213 | out_be64(addr, val); | ||
214 | } | ||
215 | |||
216 | #define EEH_CHECK_ALIGN(v,a) \ | ||
217 | ((((unsigned long)(v)) & ((a) - 1)) == 0) | ||
218 | |||
219 | static inline void eeh_memset_io(volatile void __iomem *addr, int c, | ||
220 | unsigned long n) | ||
221 | { | ||
222 | u32 lc = c; | ||
223 | lc |= lc << 8; | ||
224 | lc |= lc << 16; | ||
225 | |||
226 | while(n && !EEH_CHECK_ALIGN(addr, 4)) { | ||
227 | *((volatile u8 *)addr) = c; | ||
228 | addr = (void *)((unsigned long)addr + 1); | ||
229 | n--; | ||
230 | } | ||
231 | while(n >= 4) { | ||
232 | *((volatile u32 *)addr) = lc; | ||
233 | addr = (void *)((unsigned long)addr + 4); | ||
234 | n -= 4; | ||
235 | } | ||
236 | while(n) { | ||
237 | *((volatile u8 *)addr) = c; | ||
238 | addr = (void *)((unsigned long)addr + 1); | ||
239 | n--; | ||
240 | } | ||
241 | __asm__ __volatile__ ("sync" : : : "memory"); | ||
242 | } | ||
243 | static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *src, | ||
244 | unsigned long n) | ||
245 | { | ||
246 | void *vsrc = (void __force *) src; | ||
247 | void *destsave = dest; | ||
248 | unsigned long nsave = n; | ||
249 | |||
250 | while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { | ||
251 | *((u8 *)dest) = *((volatile u8 *)vsrc); | ||
252 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
253 | vsrc = (void *)((unsigned long)vsrc + 1); | ||
254 | dest = (void *)((unsigned long)dest + 1); | ||
255 | n--; | ||
256 | } | ||
257 | while(n > 4) { | ||
258 | *((u32 *)dest) = *((volatile u32 *)vsrc); | ||
259 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
260 | vsrc = (void *)((unsigned long)vsrc + 4); | ||
261 | dest = (void *)((unsigned long)dest + 4); | ||
262 | n -= 4; | ||
263 | } | ||
264 | while(n) { | ||
265 | *((u8 *)dest) = *((volatile u8 *)vsrc); | ||
266 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
267 | vsrc = (void *)((unsigned long)vsrc + 1); | ||
268 | dest = (void *)((unsigned long)dest + 1); | ||
269 | n--; | ||
270 | } | ||
271 | __asm__ __volatile__ ("sync" : : : "memory"); | ||
272 | |||
273 | /* Look for ffff's here at dest[n]. Assume that at least 4 bytes | ||
274 | * were copied. Check all four bytes. | ||
275 | */ | ||
276 | if ((nsave >= 4) && | ||
277 | (EEH_POSSIBLE_ERROR((*((u32 *) destsave+nsave-4)), u32))) { | ||
278 | eeh_check_failure(src, (*((u32 *) destsave+nsave-4))); | ||
279 | } | ||
280 | } | ||
281 | |||
282 | static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src, | ||
283 | unsigned long n) | ||
284 | { | ||
285 | void *vdest = (void __force *) dest; | ||
286 | |||
287 | while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { | ||
288 | *((volatile u8 *)vdest) = *((u8 *)src); | ||
289 | src = (void *)((unsigned long)src + 1); | ||
290 | vdest = (void *)((unsigned long)vdest + 1); | ||
291 | n--; | ||
292 | } | ||
293 | while(n > 4) { | ||
294 | *((volatile u32 *)vdest) = *((volatile u32 *)src); | ||
295 | src = (void *)((unsigned long)src + 4); | ||
296 | vdest = (void *)((unsigned long)vdest + 4); | ||
297 | n-=4; | ||
298 | } | ||
299 | while(n) { | ||
300 | *((volatile u8 *)vdest) = *((u8 *)src); | ||
301 | src = (void *)((unsigned long)src + 1); | ||
302 | vdest = (void *)((unsigned long)vdest + 1); | ||
303 | n--; | ||
304 | } | ||
305 | __asm__ __volatile__ ("sync" : : : "memory"); | ||
306 | } | ||
307 | |||
308 | #undef EEH_CHECK_ALIGN | ||
309 | |||
310 | static inline u8 eeh_inb(unsigned long port) | ||
311 | { | ||
312 | u8 val; | ||
313 | if (!_IO_IS_VALID(port)) | ||
314 | return ~0; | ||
315 | val = in_8((u8 __iomem *)(port+pci_io_base)); | ||
316 | if (EEH_POSSIBLE_ERROR(val, u8)) | ||
317 | return eeh_check_failure((void __iomem *)(port), val); | ||
318 | return val; | ||
319 | } | ||
320 | |||
321 | static inline void eeh_outb(u8 val, unsigned long port) | ||
322 | { | ||
323 | if (_IO_IS_VALID(port)) | ||
324 | out_8((u8 __iomem *)(port+pci_io_base), val); | ||
325 | } | ||
326 | |||
327 | static inline u16 eeh_inw(unsigned long port) | ||
328 | { | ||
329 | u16 val; | ||
330 | if (!_IO_IS_VALID(port)) | ||
331 | return ~0; | ||
332 | val = in_le16((u16 __iomem *)(port+pci_io_base)); | ||
333 | if (EEH_POSSIBLE_ERROR(val, u16)) | ||
334 | return eeh_check_failure((void __iomem *)(port), val); | ||
335 | return val; | ||
336 | } | ||
337 | |||
338 | static inline void eeh_outw(u16 val, unsigned long port) | ||
339 | { | ||
340 | if (_IO_IS_VALID(port)) | ||
341 | out_le16((u16 __iomem *)(port+pci_io_base), val); | ||
342 | } | ||
343 | |||
344 | static inline u32 eeh_inl(unsigned long port) | ||
345 | { | ||
346 | u32 val; | ||
347 | if (!_IO_IS_VALID(port)) | ||
348 | return ~0; | ||
349 | val = in_le32((u32 __iomem *)(port+pci_io_base)); | ||
350 | if (EEH_POSSIBLE_ERROR(val, u32)) | ||
351 | return eeh_check_failure((void __iomem *)(port), val); | ||
352 | return val; | ||
353 | } | ||
354 | |||
355 | static inline void eeh_outl(u32 val, unsigned long port) | ||
356 | { | ||
357 | if (_IO_IS_VALID(port)) | ||
358 | out_le32((u32 __iomem *)(port+pci_io_base), val); | ||
359 | } | ||
360 | |||
361 | /* in-string eeh macros */ | ||
362 | static inline void eeh_insb(unsigned long port, void * buf, int ns) | ||
363 | { | ||
364 | _insb((u8 __iomem *)(port+pci_io_base), buf, ns); | ||
365 | if (EEH_POSSIBLE_ERROR((*(((u8*)buf)+ns-1)), u8)) | ||
366 | eeh_check_failure((void __iomem *)(port), *(u8*)buf); | ||
367 | } | ||
368 | |||
369 | static inline void eeh_insw_ns(unsigned long port, void * buf, int ns) | ||
370 | { | ||
371 | _insw_ns((u16 __iomem *)(port+pci_io_base), buf, ns); | ||
372 | if (EEH_POSSIBLE_ERROR((*(((u16*)buf)+ns-1)), u16)) | ||
373 | eeh_check_failure((void __iomem *)(port), *(u16*)buf); | ||
374 | } | ||
375 | |||
376 | static inline void eeh_insl_ns(unsigned long port, void * buf, int nl) | ||
377 | { | ||
378 | _insl_ns((u32 __iomem *)(port+pci_io_base), buf, nl); | ||
379 | if (EEH_POSSIBLE_ERROR((*(((u32*)buf)+nl-1)), u32)) | ||
380 | eeh_check_failure((void __iomem *)(port), *(u32*)buf); | ||
381 | } | ||
382 | |||
383 | #endif /* _PPC64_EEH_H */ | ||
diff --git a/include/asm-ppc64/elf.h b/include/asm-ppc64/elf.h new file mode 100644 index 000000000000..8457d90244fb --- /dev/null +++ b/include/asm-ppc64/elf.h | |||
@@ -0,0 +1,399 @@ | |||
1 | #ifndef __PPC64_ELF_H | ||
2 | #define __PPC64_ELF_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | #include <asm/ptrace.h> | ||
6 | #include <asm/cputable.h> | ||
7 | |||
8 | /* PowerPC relocations defined by the ABIs */ | ||
9 | #define R_PPC_NONE 0 | ||
10 | #define R_PPC_ADDR32 1 /* 32bit absolute address */ | ||
11 | #define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ | ||
12 | #define R_PPC_ADDR16 3 /* 16bit absolute address */ | ||
13 | #define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ | ||
14 | #define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ | ||
15 | #define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ | ||
16 | #define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ | ||
17 | #define R_PPC_ADDR14_BRTAKEN 8 | ||
18 | #define R_PPC_ADDR14_BRNTAKEN 9 | ||
19 | #define R_PPC_REL24 10 /* PC relative 26 bit */ | ||
20 | #define R_PPC_REL14 11 /* PC relative 16 bit */ | ||
21 | #define R_PPC_REL14_BRTAKEN 12 | ||
22 | #define R_PPC_REL14_BRNTAKEN 13 | ||
23 | #define R_PPC_GOT16 14 | ||
24 | #define R_PPC_GOT16_LO 15 | ||
25 | #define R_PPC_GOT16_HI 16 | ||
26 | #define R_PPC_GOT16_HA 17 | ||
27 | #define R_PPC_PLTREL24 18 | ||
28 | #define R_PPC_COPY 19 | ||
29 | #define R_PPC_GLOB_DAT 20 | ||
30 | #define R_PPC_JMP_SLOT 21 | ||
31 | #define R_PPC_RELATIVE 22 | ||
32 | #define R_PPC_LOCAL24PC 23 | ||
33 | #define R_PPC_UADDR32 24 | ||
34 | #define R_PPC_UADDR16 25 | ||
35 | #define R_PPC_REL32 26 | ||
36 | #define R_PPC_PLT32 27 | ||
37 | #define R_PPC_PLTREL32 28 | ||
38 | #define R_PPC_PLT16_LO 29 | ||
39 | #define R_PPC_PLT16_HI 30 | ||
40 | #define R_PPC_PLT16_HA 31 | ||
41 | #define R_PPC_SDAREL16 32 | ||
42 | #define R_PPC_SECTOFF 33 | ||
43 | #define R_PPC_SECTOFF_LO 34 | ||
44 | #define R_PPC_SECTOFF_HI 35 | ||
45 | #define R_PPC_SECTOFF_HA 36 | ||
46 | |||
47 | /* PowerPC relocations defined for the TLS access ABI. */ | ||
48 | #define R_PPC_TLS 67 /* none (sym+add)@tls */ | ||
49 | #define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ | ||
50 | #define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ | ||
51 | #define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ | ||
52 | #define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ | ||
53 | #define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ | ||
54 | #define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ | ||
55 | #define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ | ||
56 | #define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ | ||
57 | #define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ | ||
58 | #define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ | ||
59 | #define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ | ||
60 | #define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ | ||
61 | #define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ | ||
62 | #define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ | ||
63 | #define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ | ||
64 | #define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ | ||
65 | #define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ | ||
66 | #define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ | ||
67 | #define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ | ||
68 | #define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ | ||
69 | #define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ | ||
70 | #define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ | ||
71 | #define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ | ||
72 | #define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ | ||
73 | #define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ | ||
74 | #define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ | ||
75 | #define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ | ||
76 | |||
77 | /* Keep this the last entry. */ | ||
78 | #define R_PPC_NUM 95 | ||
79 | |||
80 | /* | ||
81 | * ELF register definitions.. | ||
82 | * | ||
83 | * This program is free software; you can redistribute it and/or | ||
84 | * modify it under the terms of the GNU General Public License | ||
85 | * as published by the Free Software Foundation; either version | ||
86 | * 2 of the License, or (at your option) any later version. | ||
87 | */ | ||
88 | #include <asm/ptrace.h> | ||
89 | |||
90 | #define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ | ||
91 | #define ELF_NFPREG 33 /* includes fpscr */ | ||
92 | #define ELF_NVRREG32 33 /* includes vscr & vrsave stuffed together */ | ||
93 | #define ELF_NVRREG 34 /* includes vscr & vrsave in split vectors */ | ||
94 | |||
95 | typedef unsigned long elf_greg_t64; | ||
96 | typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG]; | ||
97 | |||
98 | typedef unsigned int elf_greg_t32; | ||
99 | typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG]; | ||
100 | |||
101 | /* | ||
102 | * These are used to set parameters in the core dumps. | ||
103 | */ | ||
104 | #ifndef ELF_ARCH | ||
105 | # define ELF_ARCH EM_PPC64 | ||
106 | # define ELF_CLASS ELFCLASS64 | ||
107 | # define ELF_DATA ELFDATA2MSB | ||
108 | typedef elf_greg_t64 elf_greg_t; | ||
109 | typedef elf_gregset_t64 elf_gregset_t; | ||
110 | # define elf_addr_t unsigned long | ||
111 | #else | ||
112 | /* Assumption: ELF_ARCH == EM_PPC and ELF_CLASS == ELFCLASS32 */ | ||
113 | typedef elf_greg_t32 elf_greg_t; | ||
114 | typedef elf_gregset_t32 elf_gregset_t; | ||
115 | # define elf_addr_t u32 | ||
116 | #endif | ||
117 | |||
118 | typedef double elf_fpreg_t; | ||
119 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | ||
120 | |||
121 | /* Altivec registers */ | ||
122 | /* | ||
123 | * The entries with indexes 0-31 contain the corresponding vector registers. | ||
124 | * The entry with index 32 contains the vscr as the last word (offset 12) | ||
125 | * within the quadword. This allows the vscr to be stored as either a | ||
126 | * quadword (since it must be copied via a vector register to/from storage) | ||
127 | * or as a word. The entry with index 33 contains the vrsave as the first | ||
128 | * word (offset 0) within the quadword. | ||
129 | * | ||
130 | * This definition of the VMX state is compatible with the current PPC32 | ||
131 | * ptrace interface. This allows signal handling and ptrace to use the same | ||
132 | * structures. This also simplifies the implementation of a bi-arch | ||
133 | * (combined (32- and 64-bit) gdb. | ||
134 | * | ||
135 | * Note that it's _not_ compatible with 32 bits ucontext which stuffs the | ||
136 | * vrsave along with vscr and so only uses 33 vectors for the register set | ||
137 | */ | ||
138 | typedef __vector128 elf_vrreg_t; | ||
139 | typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; | ||
140 | typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32]; | ||
141 | |||
142 | /* | ||
143 | * This is used to ensure we don't load something for the wrong architecture. | ||
144 | */ | ||
145 | #define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) | ||
146 | |||
147 | #define USE_ELF_CORE_DUMP | ||
148 | #define ELF_EXEC_PAGESIZE 4096 | ||
149 | |||
150 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
151 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
152 | the loader. We need to make sure that it is out of the way of the program | ||
153 | that it will "exec", and that there is sufficient room for the brk. */ | ||
154 | |||
155 | #define ELF_ET_DYN_BASE (0x08000000) | ||
156 | |||
157 | #ifdef __KERNEL__ | ||
158 | |||
159 | /* Common routine for both 32-bit and 64-bit processes */ | ||
160 | static inline void ppc64_elf_core_copy_regs(elf_gregset_t elf_regs, | ||
161 | struct pt_regs *regs) | ||
162 | { | ||
163 | int i; | ||
164 | int gprs = sizeof(struct pt_regs)/sizeof(elf_greg_t64); | ||
165 | |||
166 | if (gprs > ELF_NGREG) | ||
167 | gprs = ELF_NGREG; | ||
168 | |||
169 | for (i=0; i < gprs; i++) | ||
170 | elf_regs[i] = (elf_greg_t)((elf_greg_t64 *)regs)[i]; | ||
171 | } | ||
172 | #define ELF_CORE_COPY_REGS(gregs, regs) ppc64_elf_core_copy_regs(gregs, regs); | ||
173 | |||
174 | static inline int dump_task_regs(struct task_struct *tsk, | ||
175 | elf_gregset_t *elf_regs) | ||
176 | { | ||
177 | struct pt_regs *regs = tsk->thread.regs; | ||
178 | if (regs) | ||
179 | ppc64_elf_core_copy_regs(*elf_regs, regs); | ||
180 | |||
181 | return 1; | ||
182 | } | ||
183 | #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs) | ||
184 | |||
185 | extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); | ||
186 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) | ||
187 | |||
188 | /* XXX Should we define the XFPREGS using altivec ??? */ | ||
189 | |||
190 | #endif | ||
191 | |||
192 | /* This yields a mask that user programs can use to figure out what | ||
193 | instruction set this cpu supports. This could be done in userspace, | ||
194 | but it's not easy, and we've already done it here. */ | ||
195 | |||
196 | #define ELF_HWCAP (cur_cpu_spec->cpu_user_features) | ||
197 | |||
198 | /* This yields a string that ld.so will use to load implementation | ||
199 | specific libraries for optimization. This is more specific in | ||
200 | intent than poking at uname or /proc/cpuinfo. | ||
201 | |||
202 | For the moment, we have only optimizations for the Intel generations, | ||
203 | but that could change... */ | ||
204 | |||
205 | #define ELF_PLATFORM (NULL) | ||
206 | |||
207 | #define ELF_PLAT_INIT(_r, load_addr) do { \ | ||
208 | memset(_r->gpr, 0, sizeof(_r->gpr)); \ | ||
209 | _r->ctr = _r->link = _r->xer = _r->ccr = 0; \ | ||
210 | _r->gpr[2] = load_addr; \ | ||
211 | } while (0) | ||
212 | |||
213 | #ifdef __KERNEL__ | ||
214 | #define SET_PERSONALITY(ex, ibcs2) \ | ||
215 | do { \ | ||
216 | unsigned long new_flags = 0; \ | ||
217 | if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ | ||
218 | new_flags = _TIF_32BIT; \ | ||
219 | if ((current_thread_info()->flags & _TIF_32BIT) \ | ||
220 | != new_flags) \ | ||
221 | set_thread_flag(TIF_ABI_PENDING); \ | ||
222 | else \ | ||
223 | clear_thread_flag(TIF_ABI_PENDING); \ | ||
224 | if (ibcs2) \ | ||
225 | set_personality(PER_SVR4); \ | ||
226 | else if (current->personality != PER_LINUX32) \ | ||
227 | set_personality(PER_LINUX); \ | ||
228 | } while (0) | ||
229 | |||
230 | /* | ||
231 | * An executable for which elf_read_implies_exec() returns TRUE will | ||
232 | * have the READ_IMPLIES_EXEC personality flag set automatically. | ||
233 | */ | ||
234 | #define elf_read_implies_exec(ex, exec_stk) (exec_stk != EXSTACK_DISABLE_X) | ||
235 | |||
236 | #endif | ||
237 | |||
238 | /* | ||
239 | * We need to put in some extra aux table entries to tell glibc what | ||
240 | * the cache block size is, so it can use the dcbz instruction safely. | ||
241 | */ | ||
242 | #define AT_DCACHEBSIZE 19 | ||
243 | #define AT_ICACHEBSIZE 20 | ||
244 | #define AT_UCACHEBSIZE 21 | ||
245 | /* A special ignored type value for PPC, for glibc compatibility. */ | ||
246 | #define AT_IGNOREPPC 22 | ||
247 | |||
248 | /* The vDSO location. We have to use the same value as x86 for glibc's | ||
249 | * sake :-) | ||
250 | */ | ||
251 | #define AT_SYSINFO_EHDR 33 | ||
252 | |||
253 | extern int dcache_bsize; | ||
254 | extern int icache_bsize; | ||
255 | extern int ucache_bsize; | ||
256 | |||
257 | /* We do have an arch_setup_additional_pages for vDSO matters */ | ||
258 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES | ||
259 | struct linux_binprm; | ||
260 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack); | ||
261 | |||
262 | /* | ||
263 | * The requirements here are: | ||
264 | * - keep the final alignment of sp (sp & 0xf) | ||
265 | * - make sure the 32-bit value at the first 16 byte aligned position of | ||
266 | * AUXV is greater than 16 for glibc compatibility. | ||
267 | * AT_IGNOREPPC is used for that. | ||
268 | * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC, | ||
269 | * even if DLINFO_ARCH_ITEMS goes to zero or is undefined. | ||
270 | */ | ||
271 | #define ARCH_DLINFO \ | ||
272 | do { \ | ||
273 | /* Handle glibc compatibility. */ \ | ||
274 | NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ | ||
275 | NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ | ||
276 | /* Cache size items */ \ | ||
277 | NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \ | ||
278 | NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \ | ||
279 | NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \ | ||
280 | /* vDSO base */ \ | ||
281 | NEW_AUX_ENT(AT_SYSINFO_EHDR, current->thread.vdso_base); \ | ||
282 | } while (0) | ||
283 | |||
284 | /* PowerPC64 relocations defined by the ABIs */ | ||
285 | #define R_PPC64_NONE R_PPC_NONE | ||
286 | #define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */ | ||
287 | #define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */ | ||
288 | #define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */ | ||
289 | #define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */ | ||
290 | #define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */ | ||
291 | #define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ | ||
292 | #define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */ | ||
293 | #define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN | ||
294 | #define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN | ||
295 | #define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */ | ||
296 | #define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */ | ||
297 | #define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN | ||
298 | #define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN | ||
299 | #define R_PPC64_GOT16 R_PPC_GOT16 | ||
300 | #define R_PPC64_GOT16_LO R_PPC_GOT16_LO | ||
301 | #define R_PPC64_GOT16_HI R_PPC_GOT16_HI | ||
302 | #define R_PPC64_GOT16_HA R_PPC_GOT16_HA | ||
303 | |||
304 | #define R_PPC64_COPY R_PPC_COPY | ||
305 | #define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT | ||
306 | #define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT | ||
307 | #define R_PPC64_RELATIVE R_PPC_RELATIVE | ||
308 | |||
309 | #define R_PPC64_UADDR32 R_PPC_UADDR32 | ||
310 | #define R_PPC64_UADDR16 R_PPC_UADDR16 | ||
311 | #define R_PPC64_REL32 R_PPC_REL32 | ||
312 | #define R_PPC64_PLT32 R_PPC_PLT32 | ||
313 | #define R_PPC64_PLTREL32 R_PPC_PLTREL32 | ||
314 | #define R_PPC64_PLT16_LO R_PPC_PLT16_LO | ||
315 | #define R_PPC64_PLT16_HI R_PPC_PLT16_HI | ||
316 | #define R_PPC64_PLT16_HA R_PPC_PLT16_HA | ||
317 | |||
318 | #define R_PPC64_SECTOFF R_PPC_SECTOFF | ||
319 | #define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO | ||
320 | #define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI | ||
321 | #define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA | ||
322 | #define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */ | ||
323 | #define R_PPC64_ADDR64 38 /* doubleword64 S + A. */ | ||
324 | #define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */ | ||
325 | #define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */ | ||
326 | #define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */ | ||
327 | #define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */ | ||
328 | #define R_PPC64_UADDR64 43 /* doubleword64 S + A. */ | ||
329 | #define R_PPC64_REL64 44 /* doubleword64 S + A - P. */ | ||
330 | #define R_PPC64_PLT64 45 /* doubleword64 L + A. */ | ||
331 | #define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */ | ||
332 | #define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */ | ||
333 | #define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */ | ||
334 | #define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */ | ||
335 | #define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */ | ||
336 | #define R_PPC64_TOC 51 /* doubleword64 .TOC. */ | ||
337 | #define R_PPC64_PLTGOT16 52 /* half16* M + A. */ | ||
338 | #define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */ | ||
339 | #define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */ | ||
340 | #define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */ | ||
341 | |||
342 | #define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */ | ||
343 | #define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */ | ||
344 | #define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */ | ||
345 | #define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */ | ||
346 | #define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */ | ||
347 | #define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */ | ||
348 | #define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */ | ||
349 | #define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */ | ||
350 | #define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */ | ||
351 | #define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */ | ||
352 | #define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */ | ||
353 | |||
354 | /* PowerPC64 relocations defined for the TLS access ABI. */ | ||
355 | #define R_PPC64_TLS 67 /* none (sym+add)@tls */ | ||
356 | #define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ | ||
357 | #define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ | ||
358 | #define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ | ||
359 | #define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ | ||
360 | #define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ | ||
361 | #define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ | ||
362 | #define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ | ||
363 | #define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ | ||
364 | #define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ | ||
365 | #define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ | ||
366 | #define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ | ||
367 | #define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ | ||
368 | #define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ | ||
369 | #define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ | ||
370 | #define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ | ||
371 | #define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ | ||
372 | #define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ | ||
373 | #define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ | ||
374 | #define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ | ||
375 | #define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ | ||
376 | #define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ | ||
377 | #define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ | ||
378 | #define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ | ||
379 | #define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ | ||
380 | #define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ | ||
381 | #define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ | ||
382 | #define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ | ||
383 | #define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ | ||
384 | #define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ | ||
385 | #define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ | ||
386 | #define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ | ||
387 | #define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ | ||
388 | #define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ | ||
389 | #define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ | ||
390 | #define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ | ||
391 | #define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ | ||
392 | #define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ | ||
393 | #define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ | ||
394 | #define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ | ||
395 | |||
396 | /* Keep this the last entry. */ | ||
397 | #define R_PPC64_NUM 107 | ||
398 | |||
399 | #endif /* __PPC64_ELF_H */ | ||
diff --git a/include/asm-ppc64/errno.h b/include/asm-ppc64/errno.h new file mode 100644 index 000000000000..69bc3b0c6cbe --- /dev/null +++ b/include/asm-ppc64/errno.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _PPC64_ERRNO_H | ||
2 | #define _PPC64_ERRNO_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <asm-generic/errno.h> | ||
12 | |||
13 | #undef EDEADLOCK | ||
14 | #define EDEADLOCK 58 /* File locking deadlock error */ | ||
15 | |||
16 | #define _LAST_ERRNO 516 | ||
17 | |||
18 | #endif | ||
diff --git a/include/asm-ppc64/fcntl.h b/include/asm-ppc64/fcntl.h new file mode 100644 index 000000000000..842560d50656 --- /dev/null +++ b/include/asm-ppc64/fcntl.h | |||
@@ -0,0 +1,89 @@ | |||
1 | #ifndef _PPC64_FCNTL_H | ||
2 | #define _PPC64_FCNTL_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | ||
12 | located on an ext2 file system */ | ||
13 | #define O_ACCMODE 0003 | ||
14 | #define O_RDONLY 00 | ||
15 | #define O_WRONLY 01 | ||
16 | #define O_RDWR 02 | ||
17 | #define O_CREAT 0100 /* not fcntl */ | ||
18 | #define O_EXCL 0200 /* not fcntl */ | ||
19 | #define O_NOCTTY 0400 /* not fcntl */ | ||
20 | #define O_TRUNC 01000 /* not fcntl */ | ||
21 | #define O_APPEND 02000 | ||
22 | #define O_NONBLOCK 04000 | ||
23 | #define O_NDELAY O_NONBLOCK | ||
24 | #define O_SYNC 010000 | ||
25 | #define FASYNC 020000 /* fcntl, for BSD compatibility */ | ||
26 | #define O_DIRECTORY 040000 /* must be a directory */ | ||
27 | #define O_NOFOLLOW 0100000 /* don't follow links */ | ||
28 | #define O_LARGEFILE 0200000 | ||
29 | #define O_DIRECT 0400000 /* direct disk access hint */ | ||
30 | #define O_NOATIME 01000000 | ||
31 | |||
32 | #define F_DUPFD 0 /* dup */ | ||
33 | #define F_GETFD 1 /* get close_on_exec */ | ||
34 | #define F_SETFD 2 /* set/clear close_on_exec */ | ||
35 | #define F_GETFL 3 /* get file->f_flags */ | ||
36 | #define F_SETFL 4 /* set file->f_flags */ | ||
37 | #define F_GETLK 5 | ||
38 | #define F_SETLK 6 | ||
39 | #define F_SETLKW 7 | ||
40 | |||
41 | #define F_SETOWN 8 /* for sockets. */ | ||
42 | #define F_GETOWN 9 /* for sockets. */ | ||
43 | #define F_SETSIG 10 /* for sockets. */ | ||
44 | #define F_GETSIG 11 /* for sockets. */ | ||
45 | |||
46 | /* for F_[GET|SET]FL */ | ||
47 | #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ | ||
48 | |||
49 | /* for posix fcntl() and lockf() */ | ||
50 | #define F_RDLCK 0 | ||
51 | #define F_WRLCK 1 | ||
52 | #define F_UNLCK 2 | ||
53 | |||
54 | /* for old implementation of bsd flock () */ | ||
55 | #define F_EXLCK 4 /* or 3 */ | ||
56 | #define F_SHLCK 8 /* or 4 */ | ||
57 | |||
58 | /* for leases */ | ||
59 | #define F_INPROGRESS 16 | ||
60 | |||
61 | /* operations for bsd flock(), also used by the kernel implementation */ | ||
62 | #define LOCK_SH 1 /* shared lock */ | ||
63 | #define LOCK_EX 2 /* exclusive lock */ | ||
64 | #define LOCK_NB 4 /* or'd with one of the above to prevent | ||
65 | blocking */ | ||
66 | #define LOCK_UN 8 /* remove lock */ | ||
67 | |||
68 | #define LOCK_MAND 32 /* This is a mandatory flock */ | ||
69 | #define LOCK_READ 64 /* ... Which allows concurrent read operations */ | ||
70 | #define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ | ||
71 | #define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ | ||
72 | |||
73 | #ifdef __KERNEL__ | ||
74 | #define F_POSIX 1 | ||
75 | #define F_FLOCK 2 | ||
76 | #define F_BROKEN 4 /* broken flock() emulation */ | ||
77 | #endif /* __KERNEL__ */ | ||
78 | |||
79 | struct flock { | ||
80 | short l_type; | ||
81 | short l_whence; | ||
82 | off_t l_start; | ||
83 | off_t l_len; | ||
84 | pid_t l_pid; | ||
85 | }; | ||
86 | |||
87 | #define F_LINUX_SPECIFIC_BASE 1024 | ||
88 | |||
89 | #endif /* _PPC64_FCNTL_H */ | ||
diff --git a/include/asm-ppc64/floppy.h b/include/asm-ppc64/floppy.h new file mode 100644 index 000000000000..5c497b588e54 --- /dev/null +++ b/include/asm-ppc64/floppy.h | |||
@@ -0,0 +1,106 @@ | |||
1 | /* | ||
2 | * Architecture specific parts of the Floppy driver | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 1995 | ||
9 | */ | ||
10 | #ifndef __ASM_PPC64_FLOPPY_H | ||
11 | #define __ASM_PPC64_FLOPPY_H | ||
12 | |||
13 | #include <linux/config.h> | ||
14 | #include <asm/machdep.h> | ||
15 | |||
16 | #define fd_inb(port) inb_p(port) | ||
17 | #define fd_outb(value,port) outb_p(value,port) | ||
18 | |||
19 | #define fd_enable_dma() enable_dma(FLOPPY_DMA) | ||
20 | #define fd_disable_dma() disable_dma(FLOPPY_DMA) | ||
21 | #define fd_request_dma() request_dma(FLOPPY_DMA,"floppy") | ||
22 | #define fd_free_dma() free_dma(FLOPPY_DMA) | ||
23 | #define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA) | ||
24 | #define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA,mode) | ||
25 | #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count) | ||
26 | #define fd_enable_irq() enable_irq(FLOPPY_IRQ) | ||
27 | #define fd_disable_irq() disable_irq(FLOPPY_IRQ) | ||
28 | #define fd_cacheflush(addr,size) /* nothing */ | ||
29 | #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ | ||
30 | SA_INTERRUPT|SA_SAMPLE_RANDOM, \ | ||
31 | "floppy", NULL) | ||
32 | #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); | ||
33 | |||
34 | #ifdef CONFIG_PCI | ||
35 | |||
36 | #include <linux/pci.h> | ||
37 | |||
38 | #define fd_dma_setup(addr,size,mode,io) ppc64_fd_dma_setup(addr,size,mode,io) | ||
39 | |||
40 | static __inline__ int | ||
41 | ppc64_fd_dma_setup(char *addr, unsigned long size, int mode, int io) | ||
42 | { | ||
43 | static unsigned long prev_size; | ||
44 | static dma_addr_t bus_addr = 0; | ||
45 | static char *prev_addr; | ||
46 | static int prev_dir; | ||
47 | int dir; | ||
48 | |||
49 | dir = (mode == DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE; | ||
50 | |||
51 | if (bus_addr | ||
52 | && (addr != prev_addr || size != prev_size || dir != prev_dir)) { | ||
53 | /* different from last time -- unmap prev */ | ||
54 | pci_unmap_single(NULL, bus_addr, prev_size, prev_dir); | ||
55 | bus_addr = 0; | ||
56 | } | ||
57 | |||
58 | if (!bus_addr) /* need to map it */ { | ||
59 | bus_addr = pci_map_single(NULL, addr, size, dir); | ||
60 | } | ||
61 | |||
62 | /* remember this one as prev */ | ||
63 | prev_addr = addr; | ||
64 | prev_size = size; | ||
65 | prev_dir = dir; | ||
66 | |||
67 | fd_clear_dma_ff(); | ||
68 | fd_cacheflush(addr, size); | ||
69 | fd_set_dma_mode(mode); | ||
70 | set_dma_addr(FLOPPY_DMA, bus_addr); | ||
71 | fd_set_dma_count(size); | ||
72 | virtual_dma_port = io; | ||
73 | fd_enable_dma(); | ||
74 | |||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | #endif /* CONFIG_PCI */ | ||
79 | |||
80 | __inline__ void virtual_dma_init(void) | ||
81 | { | ||
82 | /* Nothing to do on PowerPC */ | ||
83 | } | ||
84 | |||
85 | static int FDC1 = 0x3f0; | ||
86 | static int FDC2 = -1; | ||
87 | |||
88 | /* | ||
89 | * Again, the CMOS information not available | ||
90 | */ | ||
91 | #define FLOPPY0_TYPE 6 | ||
92 | #define FLOPPY1_TYPE 0 | ||
93 | |||
94 | #define N_FDC 2 /* Don't change this! */ | ||
95 | #define N_DRIVE 8 | ||
96 | |||
97 | #define FLOPPY_MOTOR_MASK 0xf0 | ||
98 | |||
99 | /* | ||
100 | * The PowerPC has no problems with floppy DMA crossing 64k borders. | ||
101 | */ | ||
102 | #define CROSS_64KB(a,s) (0) | ||
103 | |||
104 | #define EXTRA_FLOPPY_PARAMS | ||
105 | |||
106 | #endif /* __ASM_PPC64_FLOPPY_H */ | ||
diff --git a/include/asm-ppc64/hardirq.h b/include/asm-ppc64/hardirq.h new file mode 100644 index 000000000000..4ee72bb1fd48 --- /dev/null +++ b/include/asm-ppc64/hardirq.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __ASM_HARDIRQ_H | ||
2 | #define __ASM_HARDIRQ_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/cache.h> | ||
13 | #include <linux/preempt.h> | ||
14 | |||
15 | typedef struct { | ||
16 | unsigned int __softirq_pending; | ||
17 | } ____cacheline_aligned irq_cpustat_t; | ||
18 | |||
19 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
20 | |||
21 | static inline void ack_bad_irq(int irq) | ||
22 | { | ||
23 | printk(KERN_CRIT "illegal vector %d received!\n", irq); | ||
24 | BUG(); | ||
25 | } | ||
26 | |||
27 | #endif /* __ASM_HARDIRQ_H */ | ||
diff --git a/include/asm-ppc64/hdreg.h b/include/asm-ppc64/hdreg.h new file mode 100644 index 000000000000..7f7fd1af0af3 --- /dev/null +++ b/include/asm-ppc64/hdreg.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/hdreg.h> | |||
diff --git a/include/asm-ppc64/hvcall.h b/include/asm-ppc64/hvcall.h new file mode 100644 index 000000000000..4f668a4baff0 --- /dev/null +++ b/include/asm-ppc64/hvcall.h | |||
@@ -0,0 +1,167 @@ | |||
1 | #ifndef _PPC64_HVCALL_H | ||
2 | #define _PPC64_HVCALL_H | ||
3 | |||
4 | #define HVSC .long 0x44000022 | ||
5 | |||
6 | #define H_Success 0 | ||
7 | #define H_Busy 1 /* Hardware busy -- retry later */ | ||
8 | #define H_Constrained 4 /* Resource request constrained to max allowed */ | ||
9 | #define H_LongBusyStartRange 9900 /* Start of long busy range */ | ||
10 | #define H_LongBusyOrder1msec 9900 /* Long busy, hint that 1msec is a good time to retry */ | ||
11 | #define H_LongBusyOrder10msec 9901 /* Long busy, hint that 10msec is a good time to retry */ | ||
12 | #define H_LongBusyOrder100msec 9902 /* Long busy, hint that 100msec is a good time to retry */ | ||
13 | #define H_LongBusyOrder1sec 9903 /* Long busy, hint that 1sec is a good time to retry */ | ||
14 | #define H_LongBusyOrder10sec 9904 /* Long busy, hint that 10sec is a good time to retry */ | ||
15 | #define H_LongBusyOrder100sec 9905 /* Long busy, hint that 100sec is a good time to retry */ | ||
16 | #define H_LongBusyEndRange 9905 /* End of long busy range */ | ||
17 | #define H_Hardware -1 /* Hardware error */ | ||
18 | #define H_Function -2 /* Function not supported */ | ||
19 | #define H_Privilege -3 /* Caller not privileged */ | ||
20 | #define H_Parameter -4 /* Parameter invalid, out-of-range or conflicting */ | ||
21 | #define H_Bad_Mode -5 /* Illegal msr value */ | ||
22 | #define H_PTEG_Full -6 /* PTEG is full */ | ||
23 | #define H_Not_Found -7 /* PTE was not found" */ | ||
24 | #define H_Reserved_DABR -8 /* DABR address is reserved by the hypervisor on this processor" */ | ||
25 | #define H_NoMem -9 | ||
26 | #define H_Authority -10 | ||
27 | #define H_Permission -11 | ||
28 | #define H_Dropped -12 | ||
29 | #define H_SourceParm -13 | ||
30 | #define H_DestParm -14 | ||
31 | #define H_RemoteParm -15 | ||
32 | #define H_Resource -16 | ||
33 | |||
34 | /* Long Busy is a condition that can be returned by the firmware | ||
35 | * when a call cannot be completed now, but the identical call | ||
36 | * should be retried later. This prevents calls blocking in the | ||
37 | * firmware for long periods of time. Annoyingly the firmware can return | ||
38 | * a range of return codes, hinting at how long we should wait before | ||
39 | * retrying. If you don't care for the hint, the macro below is a good | ||
40 | * way to check for the long_busy return codes | ||
41 | */ | ||
42 | #define H_isLongBusy(x) ((x >= H_LongBusyStartRange) && (x <= H_LongBusyEndRange)) | ||
43 | |||
44 | /* Flags */ | ||
45 | #define H_LARGE_PAGE (1UL<<(63-16)) | ||
46 | #define H_EXACT (1UL<<(63-24)) /* Use exact PTE or return H_PTEG_FULL */ | ||
47 | #define H_R_XLATE (1UL<<(63-25)) /* include a valid logical page num in the pte if the valid bit is set */ | ||
48 | #define H_READ_4 (1UL<<(63-26)) /* Return 4 PTEs */ | ||
49 | #define H_AVPN (1UL<<(63-32)) /* An avpn is provided as a sanity test */ | ||
50 | #define H_ANDCOND (1UL<<(63-33)) | ||
51 | #define H_ICACHE_INVALIDATE (1UL<<(63-40)) /* icbi, etc. (ignored for IO pages) */ | ||
52 | #define H_ICACHE_SYNCHRONIZE (1UL<<(63-41)) /* dcbst, icbi, etc (ignored for IO pages */ | ||
53 | #define H_ZERO_PAGE (1UL<<(63-48)) /* zero the page before mapping (ignored for IO pages) */ | ||
54 | #define H_COPY_PAGE (1UL<<(63-49)) | ||
55 | #define H_N (1UL<<(63-61)) | ||
56 | #define H_PP1 (1UL<<(63-62)) | ||
57 | #define H_PP2 (1UL<<(63-63)) | ||
58 | |||
59 | /* pSeries hypervisor opcodes */ | ||
60 | #define H_REMOVE 0x04 | ||
61 | #define H_ENTER 0x08 | ||
62 | #define H_READ 0x0c | ||
63 | #define H_CLEAR_MOD 0x10 | ||
64 | #define H_CLEAR_REF 0x14 | ||
65 | #define H_PROTECT 0x18 | ||
66 | #define H_GET_TCE 0x1c | ||
67 | #define H_PUT_TCE 0x20 | ||
68 | #define H_SET_SPRG0 0x24 | ||
69 | #define H_SET_DABR 0x28 | ||
70 | #define H_PAGE_INIT 0x2c | ||
71 | #define H_SET_ASR 0x30 | ||
72 | #define H_ASR_ON 0x34 | ||
73 | #define H_ASR_OFF 0x38 | ||
74 | #define H_LOGICAL_CI_LOAD 0x3c | ||
75 | #define H_LOGICAL_CI_STORE 0x40 | ||
76 | #define H_LOGICAL_CACHE_LOAD 0x44 | ||
77 | #define H_LOGICAL_CACHE_STORE 0x48 | ||
78 | #define H_LOGICAL_ICBI 0x4c | ||
79 | #define H_LOGICAL_DCBF 0x50 | ||
80 | #define H_GET_TERM_CHAR 0x54 | ||
81 | #define H_PUT_TERM_CHAR 0x58 | ||
82 | #define H_REAL_TO_LOGICAL 0x5c | ||
83 | #define H_HYPERVISOR_DATA 0x60 | ||
84 | #define H_EOI 0x64 | ||
85 | #define H_CPPR 0x68 | ||
86 | #define H_IPI 0x6c | ||
87 | #define H_IPOLL 0x70 | ||
88 | #define H_XIRR 0x74 | ||
89 | #define H_PERFMON 0x7c | ||
90 | #define H_MIGRATE_DMA 0x78 | ||
91 | #define H_REGISTER_VPA 0xDC | ||
92 | #define H_CEDE 0xE0 | ||
93 | #define H_CONFER 0xE4 | ||
94 | #define H_PROD 0xE8 | ||
95 | #define H_GET_PPP 0xEC | ||
96 | #define H_SET_PPP 0xF0 | ||
97 | #define H_PURR 0xF4 | ||
98 | #define H_PIC 0xF8 | ||
99 | #define H_REG_CRQ 0xFC | ||
100 | #define H_FREE_CRQ 0x100 | ||
101 | #define H_VIO_SIGNAL 0x104 | ||
102 | #define H_SEND_CRQ 0x108 | ||
103 | #define H_COPY_RDMA 0x110 | ||
104 | #define H_STUFF_TCE 0x138 | ||
105 | #define H_PUT_TCE_INDIRECT 0x13C | ||
106 | #define H_VTERM_PARTNER_INFO 0x150 | ||
107 | #define H_REGISTER_VTERM 0x154 | ||
108 | #define H_FREE_VTERM 0x158 | ||
109 | #define H_POLL_PENDING 0x1D8 | ||
110 | |||
111 | #ifndef __ASSEMBLY__ | ||
112 | |||
113 | /* plpar_hcall() -- Generic call interface using above opcodes | ||
114 | * | ||
115 | * The actual call interface is a hypervisor call instruction with | ||
116 | * the opcode in R3 and input args in R4-R7. | ||
117 | * Status is returned in R3 with variable output values in R4-R11. | ||
118 | * Only H_PTE_READ with H_READ_4 uses R6-R11 so we ignore it for now | ||
119 | * and return only two out args which MUST ALWAYS BE PROVIDED. | ||
120 | */ | ||
121 | long plpar_hcall(unsigned long opcode, | ||
122 | unsigned long arg1, | ||
123 | unsigned long arg2, | ||
124 | unsigned long arg3, | ||
125 | unsigned long arg4, | ||
126 | unsigned long *out1, | ||
127 | unsigned long *out2, | ||
128 | unsigned long *out3); | ||
129 | |||
130 | /* Same as plpar_hcall but for those opcodes that return no values | ||
131 | * other than status. Slightly more efficient. | ||
132 | */ | ||
133 | long plpar_hcall_norets(unsigned long opcode, ...); | ||
134 | |||
135 | /* | ||
136 | * Special hcall interface for ibmveth support. | ||
137 | * Takes 8 input parms. Returns a rc and stores the | ||
138 | * R4 return value in *out1. | ||
139 | */ | ||
140 | long plpar_hcall_8arg_2ret(unsigned long opcode, | ||
141 | unsigned long arg1, | ||
142 | unsigned long arg2, | ||
143 | unsigned long arg3, | ||
144 | unsigned long arg4, | ||
145 | unsigned long arg5, | ||
146 | unsigned long arg6, | ||
147 | unsigned long arg7, | ||
148 | unsigned long arg8, | ||
149 | unsigned long *out1); | ||
150 | |||
151 | /* plpar_hcall_4out() | ||
152 | * | ||
153 | * same as plpar_hcall except with 4 output arguments. | ||
154 | * | ||
155 | */ | ||
156 | long plpar_hcall_4out(unsigned long opcode, | ||
157 | unsigned long arg1, | ||
158 | unsigned long arg2, | ||
159 | unsigned long arg3, | ||
160 | unsigned long arg4, | ||
161 | unsigned long *out1, | ||
162 | unsigned long *out2, | ||
163 | unsigned long *out3, | ||
164 | unsigned long *out4); | ||
165 | |||
166 | #endif /* __ASSEMBLY__ */ | ||
167 | #endif /* _PPC64_HVCALL_H */ | ||
diff --git a/include/asm-ppc64/hvconsole.h b/include/asm-ppc64/hvconsole.h new file mode 100644 index 000000000000..d89d94c91815 --- /dev/null +++ b/include/asm-ppc64/hvconsole.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * hvconsole.h | ||
3 | * Copyright (C) 2004 Ryan S Arnold, IBM Corporation | ||
4 | * | ||
5 | * LPAR console support. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef _PPC64_HVCONSOLE_H | ||
23 | #define _PPC64_HVCONSOLE_H | ||
24 | |||
25 | /* | ||
26 | * This is the max number of console adapters that can/will be found as | ||
27 | * console devices on first stage console init. Any number beyond this range | ||
28 | * can't be used as a console device but is still a valid tty device. | ||
29 | */ | ||
30 | #define MAX_NR_HVC_CONSOLES 16 | ||
31 | |||
32 | extern int hvc_get_chars(uint32_t vtermno, char *buf, int count); | ||
33 | extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count); | ||
34 | |||
35 | /* Early discovery of console adapters. */ | ||
36 | extern int hvc_find_vtys(void); | ||
37 | |||
38 | /* Implemented by a console driver */ | ||
39 | extern int hvc_instantiate(uint32_t vtermno, int index); | ||
40 | #endif /* _PPC64_HVCONSOLE_H */ | ||
diff --git a/include/asm-ppc64/hvcserver.h b/include/asm-ppc64/hvcserver.h new file mode 100644 index 000000000000..aecba9665796 --- /dev/null +++ b/include/asm-ppc64/hvcserver.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * hvcserver.h | ||
3 | * Copyright (C) 2004 Ryan S Arnold, IBM Corporation | ||
4 | * | ||
5 | * PPC64 virtual I/O console server support. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef _PPC64_HVCSERVER_H | ||
23 | #define _PPC64_HVCSERVER_H | ||
24 | |||
25 | #include <linux/list.h> | ||
26 | |||
27 | /* Converged Location Code length */ | ||
28 | #define HVCS_CLC_LENGTH 79 | ||
29 | |||
30 | /** | ||
31 | * hvcs_partner_info - an element in a list of partner info | ||
32 | * @node: list_head denoting this partner_info struct's position in the list of | ||
33 | * partner info. | ||
34 | * @unit_address: The partner unit address of this entry. | ||
35 | * @partition_ID: The partner partition ID of this entry. | ||
36 | * @location_code: The converged location code of this entry + 1 char for the | ||
37 | * null-term. | ||
38 | * | ||
39 | * This structure outlines the format that partner info is presented to a caller | ||
40 | * of the hvcs partner info fetching functions. These are strung together into | ||
41 | * a list using linux kernel lists. | ||
42 | */ | ||
43 | struct hvcs_partner_info { | ||
44 | struct list_head node; | ||
45 | uint32_t unit_address; | ||
46 | uint32_t partition_ID; | ||
47 | char location_code[HVCS_CLC_LENGTH + 1]; /* CLC + 1 null-term char */ | ||
48 | }; | ||
49 | |||
50 | extern int hvcs_free_partner_info(struct list_head *head); | ||
51 | extern int hvcs_get_partner_info(uint32_t unit_address, | ||
52 | struct list_head *head, unsigned long *pi_buff); | ||
53 | extern int hvcs_register_connection(uint32_t unit_address, | ||
54 | uint32_t p_partition_ID, uint32_t p_unit_address); | ||
55 | extern int hvcs_free_connection(uint32_t unit_address); | ||
56 | |||
57 | #endif /* _PPC64_HVCSERVER_H */ | ||
diff --git a/include/asm-ppc64/hw_irq.h b/include/asm-ppc64/hw_irq.h new file mode 100644 index 000000000000..baea40e695ec --- /dev/null +++ b/include/asm-ppc64/hw_irq.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu> | ||
3 | * | ||
4 | * Use inline IRQs where possible - Anton Blanchard <anton@au.ibm.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | #ifdef __KERNEL__ | ||
12 | #ifndef _PPC64_HW_IRQ_H | ||
13 | #define _PPC64_HW_IRQ_H | ||
14 | |||
15 | #include <linux/config.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <asm/irq.h> | ||
18 | |||
19 | int timer_interrupt(struct pt_regs *); | ||
20 | extern void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq); | ||
21 | |||
22 | #ifdef CONFIG_PPC_ISERIES | ||
23 | |||
24 | extern unsigned long local_get_flags(void); | ||
25 | extern unsigned long local_irq_disable(void); | ||
26 | extern void local_irq_restore(unsigned long); | ||
27 | |||
28 | #define local_irq_enable() local_irq_restore(1) | ||
29 | #define local_save_flags(flags) ((flags) = local_get_flags()) | ||
30 | #define local_irq_save(flags) ((flags) = local_irq_disable()) | ||
31 | |||
32 | #define irqs_disabled() (local_get_flags() == 0) | ||
33 | |||
34 | #else | ||
35 | |||
36 | #define local_save_flags(flags) ((flags) = mfmsr()) | ||
37 | #define local_irq_restore(flags) do { \ | ||
38 | __asm__ __volatile__("": : :"memory"); \ | ||
39 | __mtmsrd((flags), 1); \ | ||
40 | } while(0) | ||
41 | |||
42 | static inline void local_irq_disable(void) | ||
43 | { | ||
44 | unsigned long msr; | ||
45 | msr = mfmsr(); | ||
46 | __mtmsrd(msr & ~MSR_EE, 1); | ||
47 | __asm__ __volatile__("": : :"memory"); | ||
48 | } | ||
49 | |||
50 | static inline void local_irq_enable(void) | ||
51 | { | ||
52 | unsigned long msr; | ||
53 | __asm__ __volatile__("": : :"memory"); | ||
54 | msr = mfmsr(); | ||
55 | __mtmsrd(msr | MSR_EE, 1); | ||
56 | } | ||
57 | |||
58 | static inline void __do_save_and_cli(unsigned long *flags) | ||
59 | { | ||
60 | unsigned long msr; | ||
61 | msr = mfmsr(); | ||
62 | *flags = msr; | ||
63 | __mtmsrd(msr & ~MSR_EE, 1); | ||
64 | __asm__ __volatile__("": : :"memory"); | ||
65 | } | ||
66 | |||
67 | #define local_irq_save(flags) __do_save_and_cli(&flags) | ||
68 | |||
69 | #define irqs_disabled() \ | ||
70 | ({ \ | ||
71 | unsigned long flags; \ | ||
72 | local_save_flags(flags); \ | ||
73 | !(flags & MSR_EE); \ | ||
74 | }) | ||
75 | |||
76 | #endif /* CONFIG_PPC_ISERIES */ | ||
77 | |||
78 | #define mask_irq(irq) \ | ||
79 | ({ \ | ||
80 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
81 | if (desc->handler && desc->handler->disable) \ | ||
82 | desc->handler->disable(irq); \ | ||
83 | }) | ||
84 | #define unmask_irq(irq) \ | ||
85 | ({ \ | ||
86 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
87 | if (desc->handler && desc->handler->enable) \ | ||
88 | desc->handler->enable(irq); \ | ||
89 | }) | ||
90 | #define ack_irq(irq) \ | ||
91 | ({ \ | ||
92 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
93 | if (desc->handler && desc->handler->ack) \ | ||
94 | desc->handler->ack(irq); \ | ||
95 | }) | ||
96 | |||
97 | /* Should we handle this via lost interrupts and IPIs or should we don't care like | ||
98 | * we do now ? --BenH. | ||
99 | */ | ||
100 | struct hw_interrupt_type; | ||
101 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {} | ||
102 | |||
103 | #endif /* _PPC64_HW_IRQ_H */ | ||
104 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCall.h b/include/asm-ppc64/iSeries/HvCall.h new file mode 100644 index 000000000000..d9a2e74e2399 --- /dev/null +++ b/include/asm-ppc64/iSeries/HvCall.h | |||
@@ -0,0 +1,205 @@ | |||
1 | /* | ||
2 | * HvCall.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | //=========================================================================== | ||
21 | // | ||
22 | // This file contains the "hypervisor call" interface which is used to | ||
23 | // drive the hypervisor from the OS. | ||
24 | // | ||
25 | //=========================================================================== | ||
26 | #ifndef _HVCALL_H | ||
27 | #define _HVCALL_H | ||
28 | |||
29 | //------------------------------------------------------------------- | ||
30 | // Standard Includes | ||
31 | //------------------------------------------------------------------- | ||
32 | #include <asm/iSeries/HvCallSc.h> | ||
33 | #include <asm/iSeries/HvTypes.h> | ||
34 | #include <asm/paca.h> | ||
35 | |||
36 | /* | ||
37 | enum HvCall_ReturnCode | ||
38 | { | ||
39 | HvCall_Good = 0, | ||
40 | HvCall_Partial = 1, | ||
41 | HvCall_NotOwned = 2, | ||
42 | HvCall_NotFreed = 3, | ||
43 | HvCall_UnspecifiedError = 4 | ||
44 | }; | ||
45 | |||
46 | enum HvCall_TypeOfSIT | ||
47 | { | ||
48 | HvCall_ReduceOnly = 0, | ||
49 | HvCall_Unconditional = 1 | ||
50 | }; | ||
51 | |||
52 | enum HvCall_TypeOfYield | ||
53 | { | ||
54 | HvCall_YieldTimed = 0, // Yield until specified time | ||
55 | HvCall_YieldToActive = 1, // Yield until all active procs have run | ||
56 | HvCall_YieldToProc = 2 // Yield until the specified processor has run | ||
57 | }; | ||
58 | |||
59 | enum HvCall_InterruptMasks | ||
60 | { | ||
61 | HvCall_MaskIPI = 0x00000001, | ||
62 | HvCall_MaskLpEvent = 0x00000002, | ||
63 | HvCall_MaskLpProd = 0x00000004, | ||
64 | HvCall_MaskTimeout = 0x00000008 | ||
65 | }; | ||
66 | |||
67 | enum HvCall_VaryOffChunkRc | ||
68 | { | ||
69 | HvCall_VaryOffSucceeded = 0, | ||
70 | HvCall_VaryOffWithdrawn = 1, | ||
71 | HvCall_ChunkInLoadArea = 2, | ||
72 | HvCall_ChunkInHPT = 3, | ||
73 | HvCall_ChunkNotAccessible = 4, | ||
74 | HvCall_ChunkInUse = 5 | ||
75 | }; | ||
76 | */ | ||
77 | |||
78 | /* Type of yield for HvCallBaseYieldProcessor */ | ||
79 | #define HvCall_YieldTimed 0 // Yield until specified time (tb) | ||
80 | #define HvCall_YieldToActive 1 // Yield until all active procs have run | ||
81 | #define HvCall_YieldToProc 2 // Yield until the specified processor has run | ||
82 | |||
83 | /* interrupt masks for setEnabledInterrupts */ | ||
84 | #define HvCall_MaskIPI 0x00000001 | ||
85 | #define HvCall_MaskLpEvent 0x00000002 | ||
86 | #define HvCall_MaskLpProd 0x00000004 | ||
87 | #define HvCall_MaskTimeout 0x00000008 | ||
88 | |||
89 | /* Log buffer formats */ | ||
90 | #define HvCall_LogBuffer_ASCII 0 | ||
91 | #define HvCall_LogBuffer_EBCDIC 1 | ||
92 | |||
93 | #define HvCallBaseAckDeferredInts HvCallBase + 0 | ||
94 | #define HvCallBaseCpmPowerOff HvCallBase + 1 | ||
95 | #define HvCallBaseGetHwPatch HvCallBase + 2 | ||
96 | #define HvCallBaseReIplSpAttn HvCallBase + 3 | ||
97 | #define HvCallBaseSetASR HvCallBase + 4 | ||
98 | #define HvCallBaseSetASRAndRfi HvCallBase + 5 | ||
99 | #define HvCallBaseSetIMR HvCallBase + 6 | ||
100 | #define HvCallBaseSendIPI HvCallBase + 7 | ||
101 | #define HvCallBaseTerminateMachine HvCallBase + 8 | ||
102 | #define HvCallBaseTerminateMachineSrc HvCallBase + 9 | ||
103 | #define HvCallBaseProcessPlicInterrupts HvCallBase + 10 | ||
104 | #define HvCallBaseIsPrimaryCpmOrMsdIpl HvCallBase + 11 | ||
105 | #define HvCallBaseSetVirtualSIT HvCallBase + 12 | ||
106 | #define HvCallBaseVaryOffThisProcessor HvCallBase + 13 | ||
107 | #define HvCallBaseVaryOffMemoryChunk HvCallBase + 14 | ||
108 | #define HvCallBaseVaryOffInteractivePercentage HvCallBase + 15 | ||
109 | #define HvCallBaseSendLpProd HvCallBase + 16 | ||
110 | #define HvCallBaseSetEnabledInterrupts HvCallBase + 17 | ||
111 | #define HvCallBaseYieldProcessor HvCallBase + 18 | ||
112 | #define HvCallBaseVaryOffSharedProcUnits HvCallBase + 19 | ||
113 | #define HvCallBaseSetVirtualDecr HvCallBase + 20 | ||
114 | #define HvCallBaseClearLogBuffer HvCallBase + 21 | ||
115 | #define HvCallBaseGetLogBufferCodePage HvCallBase + 22 | ||
116 | #define HvCallBaseGetLogBufferFormat HvCallBase + 23 | ||
117 | #define HvCallBaseGetLogBufferLength HvCallBase + 24 | ||
118 | #define HvCallBaseReadLogBuffer HvCallBase + 25 | ||
119 | #define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26 | ||
120 | #define HvCallBaseWriteLogBuffer HvCallBase + 27 | ||
121 | #define HvCallBaseRouter28 HvCallBase + 28 | ||
122 | #define HvCallBaseRouter29 HvCallBase + 29 | ||
123 | #define HvCallBaseRouter30 HvCallBase + 30 | ||
124 | #define HvCallBaseSetDebugBus HvCallBase + 31 | ||
125 | |||
126 | #define HvCallCcSetDABR HvCallCc + 7 | ||
127 | |||
128 | //===================================================================================== | ||
129 | static inline void HvCall_setVirtualDecr(void) | ||
130 | { | ||
131 | /* Ignore any error return codes - most likely means that the target value for the | ||
132 | * LP has been increased and this vary off would bring us below the new target. */ | ||
133 | HvCall0(HvCallBaseSetVirtualDecr); | ||
134 | } | ||
135 | //===================================================================== | ||
136 | static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm) | ||
137 | { | ||
138 | HvCall2( HvCallBaseYieldProcessor, typeOfYield, yieldParm ); | ||
139 | } | ||
140 | //===================================================================== | ||
141 | static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts) | ||
142 | { | ||
143 | HvCall1(HvCallBaseSetEnabledInterrupts,enabledInterrupts); | ||
144 | } | ||
145 | |||
146 | //===================================================================== | ||
147 | static inline void HvCall_clearLogBuffer(HvLpIndex lpindex) | ||
148 | { | ||
149 | HvCall1(HvCallBaseClearLogBuffer,lpindex); | ||
150 | } | ||
151 | |||
152 | //===================================================================== | ||
153 | static inline u32 HvCall_getLogBufferCodePage(HvLpIndex lpindex) | ||
154 | { | ||
155 | u32 retVal = HvCall1(HvCallBaseGetLogBufferCodePage,lpindex); | ||
156 | return retVal; | ||
157 | } | ||
158 | |||
159 | //===================================================================== | ||
160 | static inline int HvCall_getLogBufferFormat(HvLpIndex lpindex) | ||
161 | { | ||
162 | int retVal = HvCall1(HvCallBaseGetLogBufferFormat,lpindex); | ||
163 | return retVal; | ||
164 | } | ||
165 | |||
166 | //===================================================================== | ||
167 | static inline u32 HvCall_getLogBufferLength(HvLpIndex lpindex) | ||
168 | { | ||
169 | u32 retVal = HvCall1(HvCallBaseGetLogBufferLength,lpindex); | ||
170 | return retVal; | ||
171 | } | ||
172 | |||
173 | //===================================================================== | ||
174 | static inline void HvCall_setLogBufferFormatAndCodepage(int format, u32 codePage) | ||
175 | { | ||
176 | HvCall2(HvCallBaseSetLogBufferFormatAndCodePage,format, codePage); | ||
177 | } | ||
178 | |||
179 | //===================================================================== | ||
180 | int HvCall_readLogBuffer(HvLpIndex lpindex, void *buffer, u64 bufLen); | ||
181 | void HvCall_writeLogBuffer(const void *buffer, u64 bufLen); | ||
182 | |||
183 | //===================================================================== | ||
184 | static inline void HvCall_sendIPI(struct paca_struct * targetPaca) | ||
185 | { | ||
186 | HvCall1( HvCallBaseSendIPI, targetPaca->paca_index ); | ||
187 | } | ||
188 | |||
189 | //===================================================================== | ||
190 | static inline void HvCall_terminateMachineSrc(void) | ||
191 | { | ||
192 | HvCall0( HvCallBaseTerminateMachineSrc ); | ||
193 | } | ||
194 | |||
195 | static inline void HvCall_setDABR(unsigned long val) | ||
196 | { | ||
197 | HvCall1(HvCallCcSetDABR, val); | ||
198 | } | ||
199 | |||
200 | static inline void HvCall_setDebugBus(unsigned long val) | ||
201 | { | ||
202 | HvCall1(HvCallBaseSetDebugBus, val); | ||
203 | } | ||
204 | |||
205 | #endif /* _HVCALL_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCallCfg.h b/include/asm-ppc64/iSeries/HvCallCfg.h new file mode 100644 index 000000000000..9f40f16de533 --- /dev/null +++ b/include/asm-ppc64/iSeries/HvCallCfg.h | |||
@@ -0,0 +1,213 @@ | |||
1 | /* | ||
2 | * HvCallCfg.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | //===================================================================================== | ||
21 | // | ||
22 | // This file contains the "hypervisor call" interface which is used to | ||
23 | // drive the hypervisor from the OS. | ||
24 | // | ||
25 | //===================================================================================== | ||
26 | #ifndef _HVCALLCFG_H | ||
27 | #define _HVCALLCFG_H | ||
28 | |||
29 | //------------------------------------------------------------------- | ||
30 | // Standard Includes | ||
31 | //------------------------------------------------------------------- | ||
32 | #include <asm/iSeries/HvCallSc.h> | ||
33 | #include <asm/iSeries/HvTypes.h> | ||
34 | |||
35 | //------------------------------------------------------------------------------------- | ||
36 | // Constants | ||
37 | //------------------------------------------------------------------------------------- | ||
38 | |||
39 | enum HvCallCfg_ReqQual | ||
40 | { | ||
41 | HvCallCfg_Cur = 0, | ||
42 | HvCallCfg_Init = 1, | ||
43 | HvCallCfg_Max = 2, | ||
44 | HvCallCfg_Min = 3 | ||
45 | }; | ||
46 | |||
47 | #define HvCallCfgGetLps HvCallCfg + 0 | ||
48 | #define HvCallCfgGetActiveLpMap HvCallCfg + 1 | ||
49 | #define HvCallCfgGetLpVrmIndex HvCallCfg + 2 | ||
50 | #define HvCallCfgGetLpMinSupportedPlicVrmIndex HvCallCfg + 3 | ||
51 | #define HvCallCfgGetLpMinCompatablePlicVrmIndex HvCallCfg + 4 | ||
52 | #define HvCallCfgGetLpVrmName HvCallCfg + 5 | ||
53 | #define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6 | ||
54 | #define HvCallCfgGetPhysicalProcessors HvCallCfg + 7 | ||
55 | #define HvCallCfgGetSystemMsChunks HvCallCfg + 8 | ||
56 | #define HvCallCfgGetMsChunks HvCallCfg + 9 | ||
57 | #define HvCallCfgGetInteractivePercentage HvCallCfg + 10 | ||
58 | #define HvCallCfgIsBusDedicated HvCallCfg + 11 | ||
59 | #define HvCallCfgGetBusOwner HvCallCfg + 12 | ||
60 | #define HvCallCfgGetBusAllocation HvCallCfg + 13 | ||
61 | #define HvCallCfgGetBusUnitOwner HvCallCfg + 14 | ||
62 | #define HvCallCfgGetBusUnitAllocation HvCallCfg + 15 | ||
63 | #define HvCallCfgGetVirtualBusPool HvCallCfg + 16 | ||
64 | #define HvCallCfgGetBusUnitInterruptProc HvCallCfg + 17 | ||
65 | #define HvCallCfgGetConfiguredBusUnitsForIntProc HvCallCfg + 18 | ||
66 | #define HvCallCfgGetRioSanBusPool HvCallCfg + 19 | ||
67 | #define HvCallCfgGetSharedPoolIndex HvCallCfg + 20 | ||
68 | #define HvCallCfgGetSharedProcUnits HvCallCfg + 21 | ||
69 | #define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22 | ||
70 | #define HvCallCfgRouter23 HvCallCfg + 23 | ||
71 | #define HvCallCfgRouter24 HvCallCfg + 24 | ||
72 | #define HvCallCfgRouter25 HvCallCfg + 25 | ||
73 | #define HvCallCfgRouter26 HvCallCfg + 26 | ||
74 | #define HvCallCfgRouter27 HvCallCfg + 27 | ||
75 | #define HvCallCfgGetMinRuntimeMsChunks HvCallCfg + 28 | ||
76 | #define HvCallCfgSetMinRuntimeMsChunks HvCallCfg + 29 | ||
77 | #define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30 | ||
78 | #define HvCallCfgGetLpExecutionMode HvCallCfg + 31 | ||
79 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 | ||
80 | |||
81 | //==================================================================== | ||
82 | static inline HvLpIndex HvCallCfg_getLps(void) | ||
83 | { | ||
84 | HvLpIndex retVal = HvCall0(HvCallCfgGetLps); | ||
85 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
86 | return retVal; | ||
87 | } | ||
88 | //==================================================================== | ||
89 | static inline int HvCallCfg_isBusDedicated(u64 busIndex) | ||
90 | { | ||
91 | int retVal = HvCall1(HvCallCfgIsBusDedicated,busIndex); | ||
92 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
93 | return retVal; | ||
94 | } | ||
95 | //==================================================================== | ||
96 | static inline HvLpIndex HvCallCfg_getBusOwner(u64 busIndex) | ||
97 | { | ||
98 | HvLpIndex retVal = HvCall1(HvCallCfgGetBusOwner,busIndex); | ||
99 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
100 | return retVal; | ||
101 | } | ||
102 | //==================================================================== | ||
103 | static inline HvLpIndexMap HvCallCfg_getBusAllocation(u64 busIndex) | ||
104 | { | ||
105 | HvLpIndexMap retVal = HvCall1(HvCallCfgGetBusAllocation,busIndex); | ||
106 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
107 | return retVal; | ||
108 | } | ||
109 | //==================================================================== | ||
110 | static inline HvLpIndexMap HvCallCfg_getActiveLpMap(void) | ||
111 | { | ||
112 | HvLpIndexMap retVal = HvCall0(HvCallCfgGetActiveLpMap); | ||
113 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
114 | return retVal; | ||
115 | } | ||
116 | //==================================================================== | ||
117 | static inline HvLpVirtualLanIndexMap HvCallCfg_getVirtualLanIndexMap(HvLpIndex lp) | ||
118 | { | ||
119 | // This is a new function in V5R1 so calls to this on older | ||
120 | // hypervisors will return -1 | ||
121 | u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp); | ||
122 | if(retVal == -1) | ||
123 | retVal = 0; | ||
124 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
125 | return retVal; | ||
126 | } | ||
127 | //=================================================================== | ||
128 | static inline u64 HvCallCfg_getSystemMsChunks(void) | ||
129 | { | ||
130 | u64 retVal = HvCall0(HvCallCfgGetSystemMsChunks); | ||
131 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
132 | return retVal; | ||
133 | } | ||
134 | //=================================================================== | ||
135 | static inline u64 HvCallCfg_getMsChunks(HvLpIndex lp,enum HvCallCfg_ReqQual qual) | ||
136 | { | ||
137 | u64 retVal = HvCall2(HvCallCfgGetMsChunks,lp,qual); | ||
138 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
139 | return retVal; | ||
140 | } | ||
141 | //=================================================================== | ||
142 | static inline u64 HvCallCfg_getMinRuntimeMsChunks(HvLpIndex lp) | ||
143 | { | ||
144 | // NOTE: This function was added in v5r1 so older hypervisors will return a -1 value | ||
145 | u64 retVal = HvCall1(HvCallCfgGetMinRuntimeMsChunks,lp); | ||
146 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
147 | return retVal; | ||
148 | } | ||
149 | //=================================================================== | ||
150 | static inline u64 HvCallCfg_setMinRuntimeMsChunks(u64 chunks) | ||
151 | { | ||
152 | u64 retVal = HvCall1(HvCallCfgSetMinRuntimeMsChunks,chunks); | ||
153 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
154 | return retVal; | ||
155 | } | ||
156 | //=================================================================== | ||
157 | static inline u64 HvCallCfg_getSystemPhysicalProcessors(void) | ||
158 | { | ||
159 | u64 retVal = HvCall0(HvCallCfgGetSystemPhysicalProcessors); | ||
160 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
161 | return retVal; | ||
162 | } | ||
163 | //=================================================================== | ||
164 | static inline u64 HvCallCfg_getPhysicalProcessors(HvLpIndex lp,enum HvCallCfg_ReqQual qual) | ||
165 | { | ||
166 | u64 retVal = HvCall2(HvCallCfgGetPhysicalProcessors,lp,qual); | ||
167 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
168 | return retVal; | ||
169 | } | ||
170 | //=================================================================== | ||
171 | static inline u64 HvCallCfg_getConfiguredBusUnitsForInterruptProc(HvLpIndex lp, | ||
172 | u16 hvLogicalProcIndex) | ||
173 | { | ||
174 | u64 retVal = HvCall2(HvCallCfgGetConfiguredBusUnitsForIntProc,lp,hvLogicalProcIndex); | ||
175 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
176 | return retVal; | ||
177 | |||
178 | } | ||
179 | //================================================================== | ||
180 | static inline HvLpSharedPoolIndex HvCallCfg_getSharedPoolIndex(HvLpIndex lp) | ||
181 | { | ||
182 | HvLpSharedPoolIndex retVal = | ||
183 | HvCall1(HvCallCfgGetSharedPoolIndex,lp); | ||
184 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
185 | return retVal; | ||
186 | |||
187 | } | ||
188 | //================================================================== | ||
189 | static inline u64 HvCallCfg_getSharedProcUnits(HvLpIndex lp,enum HvCallCfg_ReqQual qual) | ||
190 | { | ||
191 | u64 retVal = HvCall2(HvCallCfgGetSharedProcUnits,lp,qual); | ||
192 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
193 | return retVal; | ||
194 | |||
195 | } | ||
196 | //================================================================== | ||
197 | static inline u64 HvCallCfg_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) | ||
198 | { | ||
199 | u16 retVal = HvCall1(HvCallCfgGetNumProcsInSharedPool,sPI); | ||
200 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
201 | return retVal; | ||
202 | |||
203 | } | ||
204 | //================================================================== | ||
205 | static inline HvLpIndex HvCallCfg_getHostingLpIndex(HvLpIndex lp) | ||
206 | { | ||
207 | u64 retVal = HvCall1(HvCallCfgGetHostingLpIndex,lp); | ||
208 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
209 | return retVal; | ||
210 | |||
211 | } | ||
212 | |||
213 | #endif /* _HVCALLCFG_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCallEvent.h b/include/asm-ppc64/iSeries/HvCallEvent.h new file mode 100644 index 000000000000..191ddce0c2c6 --- /dev/null +++ b/include/asm-ppc64/iSeries/HvCallEvent.h | |||
@@ -0,0 +1,297 @@ | |||
1 | /* | ||
2 | * HvCallEvent.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | /* | ||
21 | * This file contains the "hypervisor call" interface which is used to | ||
22 | * drive the hypervisor from the OS. | ||
23 | */ | ||
24 | #ifndef _HVCALLEVENT_H | ||
25 | #define _HVCALLEVENT_H | ||
26 | |||
27 | /* | ||
28 | * Standard Includes | ||
29 | */ | ||
30 | #include <asm/iSeries/HvCallSc.h> | ||
31 | #include <asm/iSeries/HvTypes.h> | ||
32 | #include <asm/abs_addr.h> | ||
33 | |||
34 | struct HvLpEvent; | ||
35 | |||
36 | typedef u8 HvLpEvent_Type; | ||
37 | typedef u8 HvLpEvent_AckInd; | ||
38 | typedef u8 HvLpEvent_AckType; | ||
39 | |||
40 | struct HvCallEvent_PackedParms { | ||
41 | u8 xAckType:1; | ||
42 | u8 xAckInd:1; | ||
43 | u8 xRsvd:1; | ||
44 | u8 xTargetLp:5; | ||
45 | u8 xType; | ||
46 | u16 xSubtype; | ||
47 | HvLpInstanceId xSourceInstId; | ||
48 | HvLpInstanceId xTargetInstId; | ||
49 | }; | ||
50 | |||
51 | typedef u8 HvLpDma_Direction; | ||
52 | typedef u8 HvLpDma_AddressType; | ||
53 | |||
54 | struct HvCallEvent_PackedDmaParms { | ||
55 | u8 xDirection:1; | ||
56 | u8 xLocalAddrType:1; | ||
57 | u8 xRemoteAddrType:1; | ||
58 | u8 xRsvd1:5; | ||
59 | HvLpIndex xRemoteLp; | ||
60 | u8 xType; | ||
61 | u8 xRsvd2; | ||
62 | HvLpInstanceId xLocalInstId; | ||
63 | HvLpInstanceId xRemoteInstId; | ||
64 | }; | ||
65 | |||
66 | typedef u64 HvLpEvent_Rc; | ||
67 | typedef u64 HvLpDma_Rc; | ||
68 | |||
69 | #define HvCallEventAckLpEvent HvCallEvent + 0 | ||
70 | #define HvCallEventCancelLpEvent HvCallEvent + 1 | ||
71 | #define HvCallEventCloseLpEventPath HvCallEvent + 2 | ||
72 | #define HvCallEventDmaBufList HvCallEvent + 3 | ||
73 | #define HvCallEventDmaSingle HvCallEvent + 4 | ||
74 | #define HvCallEventDmaToSp HvCallEvent + 5 | ||
75 | #define HvCallEventGetOverflowLpEvents HvCallEvent + 6 | ||
76 | #define HvCallEventGetSourceLpInstanceId HvCallEvent + 7 | ||
77 | #define HvCallEventGetTargetLpInstanceId HvCallEvent + 8 | ||
78 | #define HvCallEventOpenLpEventPath HvCallEvent + 9 | ||
79 | #define HvCallEventSetLpEventStack HvCallEvent + 10 | ||
80 | #define HvCallEventSignalLpEvent HvCallEvent + 11 | ||
81 | #define HvCallEventSignalLpEventParms HvCallEvent + 12 | ||
82 | #define HvCallEventSetInterLpQueueIndex HvCallEvent + 13 | ||
83 | #define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14 | ||
84 | #define HvCallEventRouter15 HvCallEvent + 15 | ||
85 | |||
86 | static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex) | ||
87 | { | ||
88 | HvCall1(HvCallEventGetOverflowLpEvents,queueIndex); | ||
89 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
90 | } | ||
91 | |||
92 | static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex) | ||
93 | { | ||
94 | HvCall1(HvCallEventSetInterLpQueueIndex,queueIndex); | ||
95 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
96 | } | ||
97 | |||
98 | static inline void HvCallEvent_setLpEventStack(u8 queueIndex, | ||
99 | char *eventStackAddr, u32 eventStackSize) | ||
100 | { | ||
101 | u64 abs_addr; | ||
102 | |||
103 | abs_addr = virt_to_abs(eventStackAddr); | ||
104 | HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr, | ||
105 | eventStackSize); | ||
106 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
107 | } | ||
108 | |||
109 | static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, | ||
110 | u16 lpLogicalProcIndex) | ||
111 | { | ||
112 | HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex, | ||
113 | lpLogicalProcIndex); | ||
114 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
115 | } | ||
116 | |||
117 | static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) | ||
118 | { | ||
119 | u64 abs_addr; | ||
120 | HvLpEvent_Rc retVal; | ||
121 | |||
122 | #ifdef DEBUG_SENDEVENT | ||
123 | printk("HvCallEvent_signalLpEvent: *event = %016lx\n ", | ||
124 | (unsigned long)event); | ||
125 | #endif | ||
126 | abs_addr = virt_to_abs(event); | ||
127 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventSignalLpEvent, abs_addr); | ||
128 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
129 | return retVal; | ||
130 | } | ||
131 | |||
132 | static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | ||
133 | HvLpEvent_Type type, u16 subtype, HvLpEvent_AckInd ackInd, | ||
134 | HvLpEvent_AckType ackType, HvLpInstanceId sourceInstanceId, | ||
135 | HvLpInstanceId targetInstanceId, u64 correlationToken, | ||
136 | u64 eventData1, u64 eventData2, u64 eventData3, | ||
137 | u64 eventData4, u64 eventData5) | ||
138 | { | ||
139 | HvLpEvent_Rc retVal; | ||
140 | |||
141 | // Pack the misc bits into a single Dword to pass to PLIC | ||
142 | union { | ||
143 | struct HvCallEvent_PackedParms parms; | ||
144 | u64 dword; | ||
145 | } packed; | ||
146 | packed.parms.xAckType = ackType; | ||
147 | packed.parms.xAckInd = ackInd; | ||
148 | packed.parms.xRsvd = 0; | ||
149 | packed.parms.xTargetLp = targetLp; | ||
150 | packed.parms.xType = type; | ||
151 | packed.parms.xSubtype = subtype; | ||
152 | packed.parms.xSourceInstId = sourceInstanceId; | ||
153 | packed.parms.xTargetInstId = targetInstanceId; | ||
154 | |||
155 | retVal = (HvLpEvent_Rc)HvCall7(HvCallEventSignalLpEventParms, | ||
156 | packed.dword, correlationToken, eventData1,eventData2, | ||
157 | eventData3,eventData4, eventData5); | ||
158 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
159 | return retVal; | ||
160 | } | ||
161 | |||
162 | static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) | ||
163 | { | ||
164 | u64 abs_addr; | ||
165 | HvLpEvent_Rc retVal; | ||
166 | |||
167 | abs_addr = virt_to_abs(event); | ||
168 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventAckLpEvent, abs_addr); | ||
169 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
170 | return retVal; | ||
171 | } | ||
172 | |||
173 | static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) | ||
174 | { | ||
175 | u64 abs_addr; | ||
176 | HvLpEvent_Rc retVal; | ||
177 | |||
178 | abs_addr = virt_to_abs(event); | ||
179 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventCancelLpEvent, abs_addr); | ||
180 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
181 | return retVal; | ||
182 | } | ||
183 | |||
184 | static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( | ||
185 | HvLpIndex targetLp, HvLpEvent_Type type) | ||
186 | { | ||
187 | HvLpInstanceId retVal; | ||
188 | |||
189 | retVal = HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type); | ||
190 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
191 | return retVal; | ||
192 | } | ||
193 | |||
194 | static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId( | ||
195 | HvLpIndex targetLp, HvLpEvent_Type type) | ||
196 | { | ||
197 | HvLpInstanceId retVal; | ||
198 | |||
199 | retVal = HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type); | ||
200 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
201 | return retVal; | ||
202 | } | ||
203 | |||
204 | static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp, | ||
205 | HvLpEvent_Type type) | ||
206 | { | ||
207 | HvCall2(HvCallEventOpenLpEventPath, targetLp, type); | ||
208 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
209 | } | ||
210 | |||
211 | static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp, | ||
212 | HvLpEvent_Type type) | ||
213 | { | ||
214 | HvCall2(HvCallEventCloseLpEventPath, targetLp, type); | ||
215 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
216 | } | ||
217 | |||
218 | static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, | ||
219 | HvLpIndex remoteLp, HvLpDma_Direction direction, | ||
220 | HvLpInstanceId localInstanceId, | ||
221 | HvLpInstanceId remoteInstanceId, | ||
222 | HvLpDma_AddressType localAddressType, | ||
223 | HvLpDma_AddressType remoteAddressType, | ||
224 | /* Do these need to be converted to absolute addresses? */ | ||
225 | u64 localBufList, u64 remoteBufList, u32 transferLength) | ||
226 | { | ||
227 | HvLpDma_Rc retVal; | ||
228 | // Pack the misc bits into a single Dword to pass to PLIC | ||
229 | union { | ||
230 | struct HvCallEvent_PackedDmaParms parms; | ||
231 | u64 dword; | ||
232 | } packed; | ||
233 | |||
234 | packed.parms.xDirection = direction; | ||
235 | packed.parms.xLocalAddrType = localAddressType; | ||
236 | packed.parms.xRemoteAddrType = remoteAddressType; | ||
237 | packed.parms.xRsvd1 = 0; | ||
238 | packed.parms.xRemoteLp = remoteLp; | ||
239 | packed.parms.xType = type; | ||
240 | packed.parms.xRsvd2 = 0; | ||
241 | packed.parms.xLocalInstId = localInstanceId; | ||
242 | packed.parms.xRemoteInstId = remoteInstanceId; | ||
243 | |||
244 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaBufList, | ||
245 | packed.dword, localBufList, remoteBufList, | ||
246 | transferLength); | ||
247 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
248 | return retVal; | ||
249 | } | ||
250 | |||
251 | static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type, | ||
252 | HvLpIndex remoteLp, HvLpDma_Direction direction, | ||
253 | HvLpInstanceId localInstanceId, | ||
254 | HvLpInstanceId remoteInstanceId, | ||
255 | HvLpDma_AddressType localAddressType, | ||
256 | HvLpDma_AddressType remoteAddressType, | ||
257 | u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength) | ||
258 | { | ||
259 | HvLpDma_Rc retVal; | ||
260 | // Pack the misc bits into a single Dword to pass to PLIC | ||
261 | union { | ||
262 | struct HvCallEvent_PackedDmaParms parms; | ||
263 | u64 dword; | ||
264 | } packed; | ||
265 | |||
266 | packed.parms.xDirection = direction; | ||
267 | packed.parms.xLocalAddrType = localAddressType; | ||
268 | packed.parms.xRemoteAddrType = remoteAddressType; | ||
269 | packed.parms.xRsvd1 = 0; | ||
270 | packed.parms.xRemoteLp = remoteLp; | ||
271 | packed.parms.xType = type; | ||
272 | packed.parms.xRsvd2 = 0; | ||
273 | packed.parms.xLocalInstId = localInstanceId; | ||
274 | packed.parms.xRemoteInstId = remoteInstanceId; | ||
275 | |||
276 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, | ||
277 | packed.dword, localAddrOrTce, remoteAddrOrTce, | ||
278 | transferLength); | ||
279 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
280 | return retVal; | ||
281 | } | ||
282 | |||
283 | static inline HvLpDma_Rc HvCallEvent_dmaToSp(void* local, u32 remote, | ||
284 | u32 length, HvLpDma_Direction dir) | ||
285 | { | ||
286 | u64 abs_addr; | ||
287 | HvLpDma_Rc retVal; | ||
288 | |||
289 | abs_addr = virt_to_abs(local); | ||
290 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaToSp, abs_addr, remote, | ||
291 | length, dir); | ||
292 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
293 | return retVal; | ||
294 | } | ||
295 | |||
296 | |||
297 | #endif /* _HVCALLEVENT_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCallHpt.h b/include/asm-ppc64/iSeries/HvCallHpt.h new file mode 100644 index 000000000000..da769873d18b --- /dev/null +++ b/include/asm-ppc64/iSeries/HvCallHpt.h | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * HvCallHpt.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _HVCALLHPT_H | ||
20 | #define _HVCALLHPT_H | ||
21 | |||
22 | //============================================================================ | ||
23 | // | ||
24 | // This file contains the "hypervisor call" interface which is used to | ||
25 | // drive the hypervisor from the OS. | ||
26 | // | ||
27 | //============================================================================ | ||
28 | |||
29 | #include <asm/iSeries/HvCallSc.h> | ||
30 | #include <asm/iSeries/HvTypes.h> | ||
31 | #include <asm/mmu.h> | ||
32 | |||
33 | //----------------------------------------------------------------------------- | ||
34 | // Constants | ||
35 | //----------------------------------------------------------------------------- | ||
36 | |||
37 | #define HvCallHptGetHptAddress HvCallHpt + 0 | ||
38 | #define HvCallHptGetHptPages HvCallHpt + 1 | ||
39 | #define HvCallHptSetPp HvCallHpt + 5 | ||
40 | #define HvCallHptSetSwBits HvCallHpt + 6 | ||
41 | #define HvCallHptUpdate HvCallHpt + 7 | ||
42 | #define HvCallHptInvalidateNoSyncICache HvCallHpt + 8 | ||
43 | #define HvCallHptGet HvCallHpt + 11 | ||
44 | #define HvCallHptFindNextValid HvCallHpt + 12 | ||
45 | #define HvCallHptFindValid HvCallHpt + 13 | ||
46 | #define HvCallHptAddValidate HvCallHpt + 16 | ||
47 | #define HvCallHptInvalidateSetSwBitsGet HvCallHpt + 18 | ||
48 | |||
49 | |||
50 | //============================================================================ | ||
51 | static inline u64 HvCallHpt_getHptAddress(void) | ||
52 | { | ||
53 | u64 retval = HvCall0(HvCallHptGetHptAddress); | ||
54 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
55 | return retval; | ||
56 | } | ||
57 | //============================================================================ | ||
58 | static inline u64 HvCallHpt_getHptPages(void) | ||
59 | { | ||
60 | u64 retval = HvCall0(HvCallHptGetHptPages); | ||
61 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
62 | return retval; | ||
63 | } | ||
64 | //============================================================================= | ||
65 | static inline void HvCallHpt_setPp(u32 hpteIndex, u8 value) | ||
66 | { | ||
67 | HvCall2( HvCallHptSetPp, hpteIndex, value ); | ||
68 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
69 | } | ||
70 | //============================================================================= | ||
71 | static inline void HvCallHpt_setSwBits(u32 hpteIndex, u8 bitson, u8 bitsoff ) | ||
72 | { | ||
73 | HvCall3( HvCallHptSetSwBits, hpteIndex, bitson, bitsoff ); | ||
74 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
75 | } | ||
76 | //============================================================================= | ||
77 | static inline void HvCallHpt_invalidateNoSyncICache(u32 hpteIndex) | ||
78 | |||
79 | { | ||
80 | HvCall1( HvCallHptInvalidateNoSyncICache, hpteIndex ); | ||
81 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
82 | } | ||
83 | //============================================================================= | ||
84 | static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson, u8 bitsoff ) | ||
85 | |||
86 | { | ||
87 | u64 compressedStatus; | ||
88 | compressedStatus = HvCall4( HvCallHptInvalidateSetSwBitsGet, hpteIndex, bitson, bitsoff, 1 ); | ||
89 | HvCall1( HvCallHptInvalidateNoSyncICache, hpteIndex ); | ||
90 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
91 | return compressedStatus; | ||
92 | } | ||
93 | //============================================================================= | ||
94 | static inline u64 HvCallHpt_findValid( HPTE *hpte, u64 vpn ) | ||
95 | { | ||
96 | u64 retIndex = HvCall3Ret16( HvCallHptFindValid, hpte, vpn, 0, 0 ); | ||
97 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
98 | return retIndex; | ||
99 | } | ||
100 | //============================================================================= | ||
101 | static inline u64 HvCallHpt_findNextValid( HPTE *hpte, u32 hpteIndex, u8 bitson, u8 bitsoff ) | ||
102 | { | ||
103 | u64 retIndex = HvCall3Ret16( HvCallHptFindNextValid, hpte, hpteIndex, bitson, bitsoff ); | ||
104 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
105 | return retIndex; | ||
106 | } | ||
107 | //============================================================================= | ||
108 | static inline void HvCallHpt_get( HPTE *hpte, u32 hpteIndex ) | ||
109 | { | ||
110 | HvCall2Ret16( HvCallHptGet, hpte, hpteIndex, 0 ); | ||
111 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
112 | } | ||
113 | //============================================================================ | ||
114 | static inline void HvCallHpt_addValidate( u32 hpteIndex, | ||
115 | u32 hBit, | ||
116 | HPTE *hpte ) | ||
117 | |||
118 | { | ||
119 | HvCall4( HvCallHptAddValidate, hpteIndex, | ||
120 | hBit, (*((u64 *)hpte)), (*(((u64 *)hpte)+1)) ); | ||
121 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
122 | } | ||
123 | |||
124 | |||
125 | //============================================================================= | ||
126 | |||
127 | #endif /* _HVCALLHPT_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCallPci.h b/include/asm-ppc64/iSeries/HvCallPci.h new file mode 100644 index 000000000000..6887b619288e --- /dev/null +++ b/include/asm-ppc64/iSeries/HvCallPci.h | |||
@@ -0,0 +1,673 @@ | |||
1 | /************************************************************************/ | ||
2 | /* Provides the Hypervisor PCI calls for iSeries Linux Parition. */ | ||
3 | /* Copyright (C) 2001 <Wayne G Holm> <IBM Corporation> */ | ||
4 | /* */ | ||
5 | /* This program is free software; you can redistribute it and/or modify */ | ||
6 | /* it under the terms of the GNU General Public License as published by */ | ||
7 | /* the Free Software Foundation; either version 2 of the License, or */ | ||
8 | /* (at your option) any later version. */ | ||
9 | /* */ | ||
10 | /* This program is distributed in the hope that it will be useful, */ | ||
11 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | ||
12 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | ||
13 | /* GNU General Public License for more details. */ | ||
14 | /* */ | ||
15 | /* You should have received a copy of the GNU General Public License */ | ||
16 | /* along with this program; if not, write to the: */ | ||
17 | /* Free Software Foundation, Inc., */ | ||
18 | /* 59 Temple Place, Suite 330, */ | ||
19 | /* Boston, MA 02111-1307 USA */ | ||
20 | /************************************************************************/ | ||
21 | /* Change Activity: */ | ||
22 | /* Created, Jan 9, 2001 */ | ||
23 | /************************************************************************/ | ||
24 | |||
25 | #ifndef _HVCALLPCI_H | ||
26 | #define _HVCALLPCI_H | ||
27 | |||
28 | #include <asm/iSeries/HvCallSc.h> | ||
29 | #include <asm/iSeries/HvTypes.h> | ||
30 | |||
31 | /* | ||
32 | * DSA == Direct Select Address | ||
33 | * this struct must be 64 bits in total | ||
34 | */ | ||
35 | struct HvCallPci_DsaAddr { | ||
36 | u16 busNumber; /* PHB index? */ | ||
37 | u8 subBusNumber; /* PCI bus number? */ | ||
38 | u8 deviceId; /* device and function? */ | ||
39 | u8 barNumber; | ||
40 | u8 reserved[3]; | ||
41 | }; | ||
42 | |||
43 | union HvDsaMap { | ||
44 | u64 DsaAddr; | ||
45 | struct HvCallPci_DsaAddr Dsa; | ||
46 | }; | ||
47 | |||
48 | struct HvCallPci_LoadReturn { | ||
49 | u64 rc; | ||
50 | u64 value; | ||
51 | }; | ||
52 | |||
53 | enum HvCallPci_DeviceType { | ||
54 | HvCallPci_NodeDevice = 1, | ||
55 | HvCallPci_SpDevice = 2, | ||
56 | HvCallPci_IopDevice = 3, | ||
57 | HvCallPci_BridgeDevice = 4, | ||
58 | HvCallPci_MultiFunctionDevice = 5, | ||
59 | HvCallPci_IoaDevice = 6 | ||
60 | }; | ||
61 | |||
62 | |||
63 | struct HvCallPci_DeviceInfo { | ||
64 | u32 deviceType; // See DeviceType enum for values | ||
65 | }; | ||
66 | |||
67 | struct HvCallPci_BusUnitInfo { | ||
68 | u32 sizeReturned; // length of data returned | ||
69 | u32 deviceType; // see DeviceType enum for values | ||
70 | }; | ||
71 | |||
72 | struct HvCallPci_BridgeInfo { | ||
73 | struct HvCallPci_BusUnitInfo busUnitInfo; // Generic bus unit info | ||
74 | u8 subBusNumber; // Bus number of secondary bus | ||
75 | u8 maxAgents; // Max idsels on secondary bus | ||
76 | u8 maxSubBusNumber; // Max Sub Bus | ||
77 | u8 logicalSlotNumber; // Logical Slot Number for IOA | ||
78 | }; | ||
79 | |||
80 | |||
81 | // Maximum BusUnitInfo buffer size. Provided for clients so they can allocate | ||
82 | // a buffer big enough for any type of bus unit. Increase as needed. | ||
83 | enum {HvCallPci_MaxBusUnitInfoSize = 128}; | ||
84 | |||
85 | struct HvCallPci_BarParms { | ||
86 | u64 vaddr; | ||
87 | u64 raddr; | ||
88 | u64 size; | ||
89 | u64 protectStart; | ||
90 | u64 protectEnd; | ||
91 | u64 relocationOffset; | ||
92 | u64 pciAddress; | ||
93 | u64 reserved[3]; | ||
94 | }; | ||
95 | |||
96 | enum HvCallPci_VpdType { | ||
97 | HvCallPci_BusVpd = 1, | ||
98 | HvCallPci_BusAdapterVpd = 2 | ||
99 | }; | ||
100 | |||
101 | #define HvCallPciConfigLoad8 HvCallPci + 0 | ||
102 | #define HvCallPciConfigLoad16 HvCallPci + 1 | ||
103 | #define HvCallPciConfigLoad32 HvCallPci + 2 | ||
104 | #define HvCallPciConfigStore8 HvCallPci + 3 | ||
105 | #define HvCallPciConfigStore16 HvCallPci + 4 | ||
106 | #define HvCallPciConfigStore32 HvCallPci + 5 | ||
107 | #define HvCallPciEoi HvCallPci + 16 | ||
108 | #define HvCallPciGetBarParms HvCallPci + 18 | ||
109 | #define HvCallPciMaskFisr HvCallPci + 20 | ||
110 | #define HvCallPciUnmaskFisr HvCallPci + 21 | ||
111 | #define HvCallPciSetSlotReset HvCallPci + 25 | ||
112 | #define HvCallPciGetDeviceInfo HvCallPci + 27 | ||
113 | #define HvCallPciGetCardVpd HvCallPci + 28 | ||
114 | #define HvCallPciBarLoad8 HvCallPci + 40 | ||
115 | #define HvCallPciBarLoad16 HvCallPci + 41 | ||
116 | #define HvCallPciBarLoad32 HvCallPci + 42 | ||
117 | #define HvCallPciBarLoad64 HvCallPci + 43 | ||
118 | #define HvCallPciBarStore8 HvCallPci + 44 | ||
119 | #define HvCallPciBarStore16 HvCallPci + 45 | ||
120 | #define HvCallPciBarStore32 HvCallPci + 46 | ||
121 | #define HvCallPciBarStore64 HvCallPci + 47 | ||
122 | #define HvCallPciMaskInterrupts HvCallPci + 48 | ||
123 | #define HvCallPciUnmaskInterrupts HvCallPci + 49 | ||
124 | #define HvCallPciGetBusUnitInfo HvCallPci + 50 | ||
125 | |||
126 | //============================================================================ | ||
127 | static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber, | ||
128 | u8 deviceId, u32 offset, | ||
129 | u8 *value) | ||
130 | { | ||
131 | struct HvCallPci_DsaAddr dsa; | ||
132 | struct HvCallPci_LoadReturn retVal; | ||
133 | |||
134 | *((u64*)&dsa) = 0; | ||
135 | |||
136 | dsa.busNumber = busNumber; | ||
137 | dsa.subBusNumber = subBusNumber; | ||
138 | dsa.deviceId = deviceId; | ||
139 | |||
140 | HvCall3Ret16(HvCallPciConfigLoad8, &retVal, *(u64 *)&dsa, offset, 0); | ||
141 | |||
142 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
143 | |||
144 | *value = retVal.value; | ||
145 | |||
146 | return retVal.rc; | ||
147 | } | ||
148 | //============================================================================ | ||
149 | static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber, | ||
150 | u8 deviceId, u32 offset, | ||
151 | u16 *value) | ||
152 | { | ||
153 | struct HvCallPci_DsaAddr dsa; | ||
154 | struct HvCallPci_LoadReturn retVal; | ||
155 | |||
156 | *((u64*)&dsa) = 0; | ||
157 | |||
158 | dsa.busNumber = busNumber; | ||
159 | dsa.subBusNumber = subBusNumber; | ||
160 | dsa.deviceId = deviceId; | ||
161 | |||
162 | HvCall3Ret16(HvCallPciConfigLoad16, &retVal, *(u64 *)&dsa, offset, 0); | ||
163 | |||
164 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
165 | |||
166 | *value = retVal.value; | ||
167 | |||
168 | return retVal.rc; | ||
169 | } | ||
170 | //============================================================================ | ||
171 | static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber, | ||
172 | u8 deviceId, u32 offset, | ||
173 | u32 *value) | ||
174 | { | ||
175 | struct HvCallPci_DsaAddr dsa; | ||
176 | struct HvCallPci_LoadReturn retVal; | ||
177 | |||
178 | *((u64*)&dsa) = 0; | ||
179 | |||
180 | dsa.busNumber = busNumber; | ||
181 | dsa.subBusNumber = subBusNumber; | ||
182 | dsa.deviceId = deviceId; | ||
183 | |||
184 | HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0); | ||
185 | |||
186 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
187 | |||
188 | *value = retVal.value; | ||
189 | |||
190 | return retVal.rc; | ||
191 | } | ||
192 | //============================================================================ | ||
193 | static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber, | ||
194 | u8 deviceId, u32 offset, | ||
195 | u8 value) | ||
196 | { | ||
197 | struct HvCallPci_DsaAddr dsa; | ||
198 | u64 retVal; | ||
199 | |||
200 | *((u64*)&dsa) = 0; | ||
201 | |||
202 | dsa.busNumber = busNumber; | ||
203 | dsa.subBusNumber = subBusNumber; | ||
204 | dsa.deviceId = deviceId; | ||
205 | |||
206 | retVal = HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0); | ||
207 | |||
208 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
209 | |||
210 | return retVal; | ||
211 | } | ||
212 | //============================================================================ | ||
213 | static inline u64 HvCallPci_configStore16(u16 busNumber, u8 subBusNumber, | ||
214 | u8 deviceId, u32 offset, | ||
215 | u16 value) | ||
216 | { | ||
217 | struct HvCallPci_DsaAddr dsa; | ||
218 | u64 retVal; | ||
219 | |||
220 | *((u64*)&dsa) = 0; | ||
221 | |||
222 | dsa.busNumber = busNumber; | ||
223 | dsa.subBusNumber = subBusNumber; | ||
224 | dsa.deviceId = deviceId; | ||
225 | |||
226 | retVal = HvCall4(HvCallPciConfigStore16, *(u64 *)&dsa, offset, value, 0); | ||
227 | |||
228 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
229 | |||
230 | return retVal; | ||
231 | } | ||
232 | //============================================================================ | ||
233 | static inline u64 HvCallPci_configStore32(u16 busNumber, u8 subBusNumber, | ||
234 | u8 deviceId, u32 offset, | ||
235 | u32 value) | ||
236 | { | ||
237 | struct HvCallPci_DsaAddr dsa; | ||
238 | u64 retVal; | ||
239 | |||
240 | *((u64*)&dsa) = 0; | ||
241 | |||
242 | dsa.busNumber = busNumber; | ||
243 | dsa.subBusNumber = subBusNumber; | ||
244 | dsa.deviceId = deviceId; | ||
245 | |||
246 | retVal = HvCall4(HvCallPciConfigStore32, *(u64 *)&dsa, offset, value, 0); | ||
247 | |||
248 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
249 | |||
250 | return retVal; | ||
251 | } | ||
252 | //============================================================================ | ||
253 | static inline u64 HvCallPci_barLoad8(u16 busNumberParm, | ||
254 | u8 subBusParm, | ||
255 | u8 deviceIdParm, | ||
256 | u8 barNumberParm, | ||
257 | u64 offsetParm, | ||
258 | u8* valueParm) | ||
259 | { | ||
260 | struct HvCallPci_DsaAddr dsa; | ||
261 | struct HvCallPci_LoadReturn retVal; | ||
262 | |||
263 | *((u64*)&dsa) = 0; | ||
264 | |||
265 | dsa.busNumber = busNumberParm; | ||
266 | dsa.subBusNumber = subBusParm; | ||
267 | dsa.deviceId = deviceIdParm; | ||
268 | dsa.barNumber = barNumberParm; | ||
269 | |||
270 | HvCall3Ret16(HvCallPciBarLoad8, &retVal, *(u64 *)&dsa, offsetParm, 0); | ||
271 | |||
272 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
273 | |||
274 | *valueParm = retVal.value; | ||
275 | |||
276 | return retVal.rc; | ||
277 | } | ||
278 | //============================================================================ | ||
279 | static inline u64 HvCallPci_barLoad16(u16 busNumberParm, | ||
280 | u8 subBusParm, | ||
281 | u8 deviceIdParm, | ||
282 | u8 barNumberParm, | ||
283 | u64 offsetParm, | ||
284 | u16* valueParm) | ||
285 | { | ||
286 | struct HvCallPci_DsaAddr dsa; | ||
287 | struct HvCallPci_LoadReturn retVal; | ||
288 | |||
289 | *((u64*)&dsa) = 0; | ||
290 | |||
291 | dsa.busNumber = busNumberParm; | ||
292 | dsa.subBusNumber = subBusParm; | ||
293 | dsa.deviceId = deviceIdParm; | ||
294 | dsa.barNumber = barNumberParm; | ||
295 | |||
296 | HvCall3Ret16(HvCallPciBarLoad16, &retVal, *(u64 *)&dsa, offsetParm, 0); | ||
297 | |||
298 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
299 | |||
300 | *valueParm = retVal.value; | ||
301 | |||
302 | return retVal.rc; | ||
303 | } | ||
304 | //============================================================================ | ||
305 | static inline u64 HvCallPci_barLoad32(u16 busNumberParm, | ||
306 | u8 subBusParm, | ||
307 | u8 deviceIdParm, | ||
308 | u8 barNumberParm, | ||
309 | u64 offsetParm, | ||
310 | u32* valueParm) | ||
311 | { | ||
312 | struct HvCallPci_DsaAddr dsa; | ||
313 | struct HvCallPci_LoadReturn retVal; | ||
314 | |||
315 | *((u64*)&dsa) = 0; | ||
316 | |||
317 | dsa.busNumber = busNumberParm; | ||
318 | dsa.subBusNumber = subBusParm; | ||
319 | dsa.deviceId = deviceIdParm; | ||
320 | dsa.barNumber = barNumberParm; | ||
321 | |||
322 | HvCall3Ret16(HvCallPciBarLoad32, &retVal, *(u64 *)&dsa, offsetParm, 0); | ||
323 | |||
324 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
325 | |||
326 | *valueParm = retVal.value; | ||
327 | |||
328 | return retVal.rc; | ||
329 | } | ||
330 | //============================================================================ | ||
331 | static inline u64 HvCallPci_barLoad64(u16 busNumberParm, | ||
332 | u8 subBusParm, | ||
333 | u8 deviceIdParm, | ||
334 | u8 barNumberParm, | ||
335 | u64 offsetParm, | ||
336 | u64* valueParm) | ||
337 | { | ||
338 | struct HvCallPci_DsaAddr dsa; | ||
339 | struct HvCallPci_LoadReturn retVal; | ||
340 | |||
341 | *((u64*)&dsa) = 0; | ||
342 | |||
343 | dsa.busNumber = busNumberParm; | ||
344 | dsa.subBusNumber = subBusParm; | ||
345 | dsa.deviceId = deviceIdParm; | ||
346 | dsa.barNumber = barNumberParm; | ||
347 | |||
348 | HvCall3Ret16(HvCallPciBarLoad64, &retVal, *(u64 *)&dsa, offsetParm, 0); | ||
349 | |||
350 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
351 | |||
352 | *valueParm = retVal.value; | ||
353 | |||
354 | return retVal.rc; | ||
355 | } | ||
356 | //============================================================================ | ||
357 | static inline u64 HvCallPci_barStore8(u16 busNumberParm, | ||
358 | u8 subBusParm, | ||
359 | u8 deviceIdParm, | ||
360 | u8 barNumberParm, | ||
361 | u64 offsetParm, | ||
362 | u8 valueParm) | ||
363 | { | ||
364 | struct HvCallPci_DsaAddr dsa; | ||
365 | u64 retVal; | ||
366 | |||
367 | *((u64*)&dsa) = 0; | ||
368 | |||
369 | dsa.busNumber = busNumberParm; | ||
370 | dsa.subBusNumber = subBusParm; | ||
371 | dsa.deviceId = deviceIdParm; | ||
372 | dsa.barNumber = barNumberParm; | ||
373 | |||
374 | retVal = HvCall4(HvCallPciBarStore8, *(u64 *)&dsa, offsetParm, valueParm, 0); | ||
375 | |||
376 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
377 | |||
378 | return retVal; | ||
379 | } | ||
380 | //============================================================================ | ||
381 | static inline u64 HvCallPci_barStore16(u16 busNumberParm, | ||
382 | u8 subBusParm, | ||
383 | u8 deviceIdParm, | ||
384 | u8 barNumberParm, | ||
385 | u64 offsetParm, | ||
386 | u16 valueParm) | ||
387 | { | ||
388 | struct HvCallPci_DsaAddr dsa; | ||
389 | u64 retVal; | ||
390 | |||
391 | *((u64*)&dsa) = 0; | ||
392 | |||
393 | dsa.busNumber = busNumberParm; | ||
394 | dsa.subBusNumber = subBusParm; | ||
395 | dsa.deviceId = deviceIdParm; | ||
396 | dsa.barNumber = barNumberParm; | ||
397 | |||
398 | retVal = HvCall4(HvCallPciBarStore16, *(u64 *)&dsa, offsetParm, valueParm, 0); | ||
399 | |||
400 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
401 | |||
402 | return retVal; | ||
403 | } | ||
404 | //============================================================================ | ||
405 | static inline u64 HvCallPci_barStore32(u16 busNumberParm, | ||
406 | u8 subBusParm, | ||
407 | u8 deviceIdParm, | ||
408 | u8 barNumberParm, | ||
409 | u64 offsetParm, | ||
410 | u32 valueParm) | ||
411 | { | ||
412 | struct HvCallPci_DsaAddr dsa; | ||
413 | u64 retVal; | ||
414 | |||
415 | *((u64*)&dsa) = 0; | ||
416 | |||
417 | dsa.busNumber = busNumberParm; | ||
418 | dsa.subBusNumber = subBusParm; | ||
419 | dsa.deviceId = deviceIdParm; | ||
420 | dsa.barNumber = barNumberParm; | ||
421 | |||
422 | retVal = HvCall4(HvCallPciBarStore32, *(u64 *)&dsa, offsetParm, valueParm, 0); | ||
423 | |||
424 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
425 | |||
426 | return retVal; | ||
427 | } | ||
428 | //============================================================================ | ||
429 | static inline u64 HvCallPci_barStore64(u16 busNumberParm, | ||
430 | u8 subBusParm, | ||
431 | u8 deviceIdParm, | ||
432 | u8 barNumberParm, | ||
433 | u64 offsetParm, | ||
434 | u64 valueParm) | ||
435 | { | ||
436 | struct HvCallPci_DsaAddr dsa; | ||
437 | u64 retVal; | ||
438 | |||
439 | *((u64*)&dsa) = 0; | ||
440 | |||
441 | dsa.busNumber = busNumberParm; | ||
442 | dsa.subBusNumber = subBusParm; | ||
443 | dsa.deviceId = deviceIdParm; | ||
444 | dsa.barNumber = barNumberParm; | ||
445 | |||
446 | retVal = HvCall4(HvCallPciBarStore64, *(u64 *)&dsa, offsetParm, valueParm, 0); | ||
447 | |||
448 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
449 | |||
450 | return retVal; | ||
451 | } | ||
452 | //============================================================================ | ||
453 | static inline u64 HvCallPci_eoi(u16 busNumberParm, | ||
454 | u8 subBusParm, | ||
455 | u8 deviceIdParm) | ||
456 | { | ||
457 | struct HvCallPci_DsaAddr dsa; | ||
458 | struct HvCallPci_LoadReturn retVal; | ||
459 | |||
460 | *((u64*)&dsa) = 0; | ||
461 | |||
462 | dsa.busNumber = busNumberParm; | ||
463 | dsa.subBusNumber = subBusParm; | ||
464 | dsa.deviceId = deviceIdParm; | ||
465 | |||
466 | HvCall1Ret16(HvCallPciEoi, &retVal, *(u64*)&dsa); | ||
467 | |||
468 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
469 | |||
470 | return retVal.rc; | ||
471 | } | ||
472 | //============================================================================ | ||
473 | static inline u64 HvCallPci_getBarParms(u16 busNumberParm, | ||
474 | u8 subBusParm, | ||
475 | u8 deviceIdParm, | ||
476 | u8 barNumberParm, | ||
477 | u64 parms, | ||
478 | u32 sizeofParms) | ||
479 | { | ||
480 | struct HvCallPci_DsaAddr dsa; | ||
481 | u64 retVal; | ||
482 | |||
483 | *((u64*)&dsa) = 0; | ||
484 | |||
485 | dsa.busNumber = busNumberParm; | ||
486 | dsa.subBusNumber = subBusParm; | ||
487 | dsa.deviceId = deviceIdParm; | ||
488 | dsa.barNumber = barNumberParm; | ||
489 | |||
490 | retVal = HvCall3(HvCallPciGetBarParms, *(u64*)&dsa, parms, sizeofParms); | ||
491 | |||
492 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
493 | |||
494 | return retVal; | ||
495 | } | ||
496 | //============================================================================ | ||
497 | static inline u64 HvCallPci_maskFisr(u16 busNumberParm, | ||
498 | u8 subBusParm, | ||
499 | u8 deviceIdParm, | ||
500 | u64 fisrMask) | ||
501 | { | ||
502 | struct HvCallPci_DsaAddr dsa; | ||
503 | u64 retVal; | ||
504 | |||
505 | *((u64*)&dsa) = 0; | ||
506 | |||
507 | dsa.busNumber = busNumberParm; | ||
508 | dsa.subBusNumber = subBusParm; | ||
509 | dsa.deviceId = deviceIdParm; | ||
510 | |||
511 | retVal = HvCall2(HvCallPciMaskFisr, *(u64*)&dsa, fisrMask); | ||
512 | |||
513 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
514 | |||
515 | return retVal; | ||
516 | } | ||
517 | //============================================================================ | ||
518 | static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, | ||
519 | u8 subBusParm, | ||
520 | u8 deviceIdParm, | ||
521 | u64 fisrMask) | ||
522 | { | ||
523 | struct HvCallPci_DsaAddr dsa; | ||
524 | u64 retVal; | ||
525 | |||
526 | *((u64*)&dsa) = 0; | ||
527 | |||
528 | dsa.busNumber = busNumberParm; | ||
529 | dsa.subBusNumber = subBusParm; | ||
530 | dsa.deviceId = deviceIdParm; | ||
531 | |||
532 | retVal = HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask); | ||
533 | |||
534 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
535 | |||
536 | return retVal; | ||
537 | } | ||
538 | //============================================================================ | ||
539 | static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, | ||
540 | u8 subBusParm, | ||
541 | u8 deviceIdParm, | ||
542 | u64 onNotOff) | ||
543 | { | ||
544 | struct HvCallPci_DsaAddr dsa; | ||
545 | u64 retVal; | ||
546 | |||
547 | *((u64*)&dsa) = 0; | ||
548 | |||
549 | dsa.busNumber = busNumberParm; | ||
550 | dsa.subBusNumber = subBusParm; | ||
551 | dsa.deviceId = deviceIdParm; | ||
552 | |||
553 | retVal = HvCall2(HvCallPciSetSlotReset, *(u64*)&dsa, onNotOff); | ||
554 | |||
555 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
556 | |||
557 | return retVal; | ||
558 | } | ||
559 | //============================================================================ | ||
560 | static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, | ||
561 | u8 subBusParm, | ||
562 | u8 deviceNumberParm, | ||
563 | u64 parms, | ||
564 | u32 sizeofParms) | ||
565 | { | ||
566 | struct HvCallPci_DsaAddr dsa; | ||
567 | u64 retVal; | ||
568 | |||
569 | *((u64*)&dsa) = 0; | ||
570 | |||
571 | dsa.busNumber = busNumberParm; | ||
572 | dsa.subBusNumber = subBusParm; | ||
573 | dsa.deviceId = deviceNumberParm << 4; | ||
574 | |||
575 | retVal = HvCall3(HvCallPciGetDeviceInfo, *(u64*)&dsa, parms, sizeofParms); | ||
576 | |||
577 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
578 | |||
579 | return retVal; | ||
580 | } | ||
581 | //============================================================================ | ||
582 | static inline u64 HvCallPci_maskInterrupts(u16 busNumberParm, | ||
583 | u8 subBusParm, | ||
584 | u8 deviceIdParm, | ||
585 | u64 interruptMask) | ||
586 | { | ||
587 | struct HvCallPci_DsaAddr dsa; | ||
588 | u64 retVal; | ||
589 | |||
590 | *((u64*)&dsa) = 0; | ||
591 | |||
592 | dsa.busNumber = busNumberParm; | ||
593 | dsa.subBusNumber = subBusParm; | ||
594 | dsa.deviceId = deviceIdParm; | ||
595 | |||
596 | retVal = HvCall2(HvCallPciMaskInterrupts, *(u64*)&dsa, interruptMask); | ||
597 | |||
598 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
599 | |||
600 | return retVal; | ||
601 | } | ||
602 | //============================================================================ | ||
603 | static inline u64 HvCallPci_unmaskInterrupts(u16 busNumberParm, | ||
604 | u8 subBusParm, | ||
605 | u8 deviceIdParm, | ||
606 | u64 interruptMask) | ||
607 | { | ||
608 | struct HvCallPci_DsaAddr dsa; | ||
609 | u64 retVal; | ||
610 | |||
611 | *((u64*)&dsa) = 0; | ||
612 | |||
613 | dsa.busNumber = busNumberParm; | ||
614 | dsa.subBusNumber = subBusParm; | ||
615 | dsa.deviceId = deviceIdParm; | ||
616 | |||
617 | retVal = HvCall2(HvCallPciUnmaskInterrupts, *(u64*)&dsa, interruptMask); | ||
618 | |||
619 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
620 | |||
621 | return retVal; | ||
622 | } | ||
623 | //============================================================================ | ||
624 | |||
625 | static inline u64 HvCallPci_getBusUnitInfo(u16 busNumberParm, | ||
626 | u8 subBusParm, | ||
627 | u8 deviceIdParm, | ||
628 | u64 parms, | ||
629 | u32 sizeofParms) | ||
630 | { | ||
631 | struct HvCallPci_DsaAddr dsa; | ||
632 | u64 retVal; | ||
633 | |||
634 | *((u64*)&dsa) = 0; | ||
635 | |||
636 | dsa.busNumber = busNumberParm; | ||
637 | dsa.subBusNumber = subBusParm; | ||
638 | dsa.deviceId = deviceIdParm; | ||
639 | |||
640 | retVal = HvCall3(HvCallPciGetBusUnitInfo, *(u64*)&dsa, parms, sizeofParms); | ||
641 | |||
642 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
643 | |||
644 | return retVal; | ||
645 | } | ||
646 | //============================================================================ | ||
647 | |||
648 | static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm, u16 sizeParm) | ||
649 | { | ||
650 | int xRetSize; | ||
651 | u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm, sizeParm, HvCallPci_BusVpd); | ||
652 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
653 | if (xRc == -1) | ||
654 | xRetSize = -1; | ||
655 | else | ||
656 | xRetSize = xRc & 0xFFFF; | ||
657 | return xRetSize; | ||
658 | } | ||
659 | //============================================================================ | ||
660 | |||
661 | static inline int HvCallPci_getBusAdapterVpd(u16 busNumParm, u64 destParm, u16 sizeParm) | ||
662 | { | ||
663 | int xRetSize; | ||
664 | u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm, sizeParm, HvCallPci_BusAdapterVpd); | ||
665 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
666 | if (xRc == -1) | ||
667 | xRetSize = -1; | ||
668 | else | ||
669 | xRetSize = xRc & 0xFFFF; | ||
670 | return xRetSize; | ||
671 | } | ||
672 | //============================================================================ | ||
673 | #endif /* _HVCALLPCI_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCallSc.h b/include/asm-ppc64/iSeries/HvCallSc.h new file mode 100644 index 000000000000..eea258447642 --- /dev/null +++ b/include/asm-ppc64/iSeries/HvCallSc.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * HvCallSc.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _HVCALLSC_H | ||
20 | #define _HVCALLSC_H | ||
21 | |||
22 | #include <asm/iSeries/HvTypes.h> | ||
23 | |||
24 | #define HvCallBase 0x8000000000000000ul | ||
25 | #define HvCallCc 0x8001000000000000ul | ||
26 | #define HvCallCfg 0x8002000000000000ul | ||
27 | #define HvCallEvent 0x8003000000000000ul | ||
28 | #define HvCallHpt 0x8004000000000000ul | ||
29 | #define HvCallPci 0x8005000000000000ul | ||
30 | #define HvCallSm 0x8007000000000000ul | ||
31 | #define HvCallXm 0x8009000000000000ul | ||
32 | |||
33 | u64 HvCall0( u64 ); | ||
34 | u64 HvCall1( u64, u64 ); | ||
35 | u64 HvCall2( u64, u64, u64 ); | ||
36 | u64 HvCall3( u64, u64, u64, u64 ); | ||
37 | u64 HvCall4( u64, u64, u64, u64, u64 ); | ||
38 | u64 HvCall5( u64, u64, u64, u64, u64, u64 ); | ||
39 | u64 HvCall6( u64, u64, u64, u64, u64, u64, u64 ); | ||
40 | u64 HvCall7( u64, u64, u64, u64, u64, u64, u64, u64 ); | ||
41 | |||
42 | u64 HvCall0Ret16( u64, void * ); | ||
43 | u64 HvCall1Ret16( u64, void *, u64 ); | ||
44 | u64 HvCall2Ret16( u64, void *, u64, u64 ); | ||
45 | u64 HvCall3Ret16( u64, void *, u64, u64, u64 ); | ||
46 | u64 HvCall4Ret16( u64, void *, u64, u64, u64, u64 ); | ||
47 | u64 HvCall5Ret16( u64, void *, u64, u64, u64, u64, u64 ); | ||
48 | u64 HvCall6Ret16( u64, void *, u64, u64, u64, u64, u64, u64 ); | ||
49 | u64 HvCall7Ret16( u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64 ); | ||
50 | |||
51 | #endif /* _HVCALLSC_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCallSm.h b/include/asm-ppc64/iSeries/HvCallSm.h new file mode 100644 index 000000000000..9050c94a529d --- /dev/null +++ b/include/asm-ppc64/iSeries/HvCallSm.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * HvCallSm.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _HVCALLSM_H | ||
20 | #define _HVCALLSM_H | ||
21 | |||
22 | //============================================================================ | ||
23 | // | ||
24 | // This file contains the "hypervisor call" interface which is used to | ||
25 | // drive the hypervisor from the OS. | ||
26 | // | ||
27 | //============================================================================ | ||
28 | |||
29 | //------------------------------------------------------------------- | ||
30 | // Standard Includes | ||
31 | //------------------------------------------------------------------- | ||
32 | #include <asm/iSeries/HvCallSc.h> | ||
33 | #include <asm/iSeries/HvTypes.h> | ||
34 | |||
35 | //----------------------------------------------------------------------------- | ||
36 | // Constants | ||
37 | //----------------------------------------------------------------------------- | ||
38 | |||
39 | #define HvCallSmGet64BitsOfAccessMap HvCallSm + 11 | ||
40 | |||
41 | |||
42 | //============================================================================ | ||
43 | static inline u64 HvCallSm_get64BitsOfAccessMap( | ||
44 | HvLpIndex lpIndex, u64 indexIntoBitMap ) | ||
45 | { | ||
46 | u64 retval = HvCall2(HvCallSmGet64BitsOfAccessMap, lpIndex, | ||
47 | indexIntoBitMap ); | ||
48 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
49 | return retval; | ||
50 | } | ||
51 | //============================================================================ | ||
52 | #endif /* _HVCALLSM_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCallXm.h b/include/asm-ppc64/iSeries/HvCallXm.h new file mode 100644 index 000000000000..bfb898f4db8d --- /dev/null +++ b/include/asm-ppc64/iSeries/HvCallXm.h | |||
@@ -0,0 +1,95 @@ | |||
1 | //============================================================================ | ||
2 | // Header File Id | ||
3 | // Name______________: HvCallXm.H | ||
4 | // | ||
5 | // Description_______: | ||
6 | // | ||
7 | // This file contains the "hypervisor call" interface which is used to | ||
8 | // drive the hypervisor from SLIC. | ||
9 | // | ||
10 | //============================================================================ | ||
11 | #ifndef _HVCALLXM_H | ||
12 | #define _HVCALLXM_H | ||
13 | |||
14 | //------------------------------------------------------------------- | ||
15 | // Forward declarations | ||
16 | //------------------------------------------------------------------- | ||
17 | |||
18 | //------------------------------------------------------------------- | ||
19 | // Standard Includes | ||
20 | //------------------------------------------------------------------- | ||
21 | #include <asm/iSeries/HvCallSc.h> | ||
22 | #include <asm/iSeries/HvTypes.h> | ||
23 | |||
24 | //----------------------------------------------------------------------------- | ||
25 | // Constants | ||
26 | //----------------------------------------------------------------------------- | ||
27 | |||
28 | #define HvCallXmGetTceTableParms HvCallXm + 0 | ||
29 | #define HvCallXmTestBus HvCallXm + 1 | ||
30 | #define HvCallXmConnectBusUnit HvCallXm + 2 | ||
31 | #define HvCallXmLoadTod HvCallXm + 8 | ||
32 | #define HvCallXmTestBusUnit HvCallXm + 9 | ||
33 | #define HvCallXmSetTce HvCallXm + 11 | ||
34 | #define HvCallXmSetTces HvCallXm + 13 | ||
35 | |||
36 | |||
37 | |||
38 | //============================================================================ | ||
39 | static inline void HvCallXm_getTceTableParms(u64 cb) | ||
40 | { | ||
41 | HvCall1(HvCallXmGetTceTableParms, cb); | ||
42 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
43 | } | ||
44 | //============================================================================ | ||
45 | static inline u64 HvCallXm_setTce(u64 tceTableToken, u64 tceOffset, u64 tce) | ||
46 | { | ||
47 | u64 retval = HvCall3(HvCallXmSetTce, tceTableToken, tceOffset, tce ); | ||
48 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
49 | return retval; | ||
50 | } | ||
51 | //============================================================================ | ||
52 | static inline u64 HvCallXm_setTces(u64 tceTableToken, u64 tceOffset, u64 numTces, u64 tce1, u64 tce2, u64 tce3, u64 tce4) | ||
53 | { | ||
54 | u64 retval = HvCall7(HvCallXmSetTces, tceTableToken, tceOffset, numTces, | ||
55 | tce1, tce2, tce3, tce4 ); | ||
56 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
57 | return retval; | ||
58 | } | ||
59 | //============================================================================= | ||
60 | static inline u64 HvCallXm_testBus(u16 busNumber) | ||
61 | { | ||
62 | u64 retVal = HvCall1(HvCallXmTestBus, busNumber); | ||
63 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
64 | return retVal; | ||
65 | } | ||
66 | //===================================================================================== | ||
67 | static inline u64 HvCallXm_testBusUnit(u16 busNumber, u8 subBusNumber, u8 deviceId) | ||
68 | { | ||
69 | u64 busUnitNumber = (subBusNumber << 8) | deviceId; | ||
70 | u64 retVal = HvCall2(HvCallXmTestBusUnit, busNumber, busUnitNumber); | ||
71 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
72 | return retVal; | ||
73 | } | ||
74 | //===================================================================================== | ||
75 | static inline u64 HvCallXm_connectBusUnit(u16 busNumber, u8 subBusNumber, u8 deviceId, | ||
76 | u64 interruptToken) | ||
77 | { | ||
78 | u64 busUnitNumber = (subBusNumber << 8) | deviceId; | ||
79 | u64 queueIndex = 0; // HvLpConfig::mapDsaToQueueIndex(HvLpDSA(busNumber, xBoard, xCard)); | ||
80 | |||
81 | u64 retVal = HvCall5(HvCallXmConnectBusUnit, busNumber, busUnitNumber, | ||
82 | interruptToken, 0, queueIndex); | ||
83 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
84 | return retVal; | ||
85 | } | ||
86 | //===================================================================================== | ||
87 | static inline u64 HvCallXm_loadTod(void) | ||
88 | { | ||
89 | u64 retVal = HvCall0(HvCallXmLoadTod); | ||
90 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
91 | return retVal; | ||
92 | } | ||
93 | //===================================================================================== | ||
94 | |||
95 | #endif /* _HVCALLXM_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvLpConfig.h b/include/asm-ppc64/iSeries/HvLpConfig.h new file mode 100644 index 000000000000..bdbd70f42c9d --- /dev/null +++ b/include/asm-ppc64/iSeries/HvLpConfig.h | |||
@@ -0,0 +1,280 @@ | |||
1 | /* | ||
2 | * HvLpConfig.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _HVLPCONFIG_H | ||
20 | #define _HVLPCONFIG_H | ||
21 | |||
22 | //=========================================================================== | ||
23 | // | ||
24 | // This file contains the interface to the LPAR configuration data | ||
25 | // to determine which resources should be allocated to each partition. | ||
26 | // | ||
27 | //=========================================================================== | ||
28 | |||
29 | #include <asm/iSeries/HvCallCfg.h> | ||
30 | #include <asm/iSeries/HvTypes.h> | ||
31 | #include <asm/iSeries/ItLpNaca.h> | ||
32 | #include <asm/iSeries/LparData.h> | ||
33 | |||
34 | //------------------------------------------------------------------- | ||
35 | // Constants | ||
36 | //------------------------------------------------------------------- | ||
37 | |||
38 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); | ||
39 | |||
40 | //=================================================================== | ||
41 | static inline HvLpIndex HvLpConfig_getLpIndex(void) | ||
42 | { | ||
43 | return itLpNaca.xLpIndex; | ||
44 | } | ||
45 | //=================================================================== | ||
46 | static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) | ||
47 | { | ||
48 | return itLpNaca.xPrimaryLpIndex; | ||
49 | } | ||
50 | //================================================================= | ||
51 | static inline HvLpIndex HvLpConfig_getLps(void) | ||
52 | { | ||
53 | return HvCallCfg_getLps(); | ||
54 | } | ||
55 | //================================================================= | ||
56 | static inline HvLpIndexMap HvLpConfig_getActiveLpMap(void) | ||
57 | { | ||
58 | return HvCallCfg_getActiveLpMap(); | ||
59 | } | ||
60 | //================================================================= | ||
61 | static inline u64 HvLpConfig_getSystemMsMegs(void) | ||
62 | { | ||
63 | return HvCallCfg_getSystemMsChunks() / HVCHUNKSPERMEG; | ||
64 | } | ||
65 | //================================================================= | ||
66 | static inline u64 HvLpConfig_getSystemMsChunks(void) | ||
67 | { | ||
68 | return HvCallCfg_getSystemMsChunks(); | ||
69 | } | ||
70 | //================================================================= | ||
71 | static inline u64 HvLpConfig_getSystemMsPages(void) | ||
72 | { | ||
73 | return HvCallCfg_getSystemMsChunks() * HVPAGESPERCHUNK; | ||
74 | } | ||
75 | //================================================================ | ||
76 | static inline u64 HvLpConfig_getMsMegs(void) | ||
77 | { | ||
78 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) / HVCHUNKSPERMEG; | ||
79 | } | ||
80 | //================================================================ | ||
81 | static inline u64 HvLpConfig_getMsChunks(void) | ||
82 | { | ||
83 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
84 | } | ||
85 | //================================================================ | ||
86 | static inline u64 HvLpConfig_getMsPages(void) | ||
87 | { | ||
88 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * HVPAGESPERCHUNK; | ||
89 | } | ||
90 | //================================================================ | ||
91 | static inline u64 HvLpConfig_getMinMsMegs(void) | ||
92 | { | ||
93 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) / HVCHUNKSPERMEG; | ||
94 | } | ||
95 | //================================================================ | ||
96 | static inline u64 HvLpConfig_getMinMsChunks(void) | ||
97 | { | ||
98 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
99 | } | ||
100 | //================================================================ | ||
101 | static inline u64 HvLpConfig_getMinMsPages(void) | ||
102 | { | ||
103 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) * HVPAGESPERCHUNK; | ||
104 | } | ||
105 | //================================================================ | ||
106 | static inline u64 HvLpConfig_getMinRuntimeMsMegs(void) | ||
107 | { | ||
108 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) / HVCHUNKSPERMEG; | ||
109 | } | ||
110 | //=============================================================== | ||
111 | static inline u64 HvLpConfig_getMinRuntimeMsChunks(void) | ||
112 | { | ||
113 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()); | ||
114 | } | ||
115 | //=============================================================== | ||
116 | static inline u64 HvLpConfig_getMinRuntimeMsPages(void) | ||
117 | { | ||
118 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) * HVPAGESPERCHUNK; | ||
119 | } | ||
120 | //=============================================================== | ||
121 | static inline u64 HvLpConfig_getMaxMsMegs(void) | ||
122 | { | ||
123 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) / HVCHUNKSPERMEG; | ||
124 | } | ||
125 | //=============================================================== | ||
126 | static inline u64 HvLpConfig_getMaxMsChunks(void) | ||
127 | { | ||
128 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
129 | } | ||
130 | //=============================================================== | ||
131 | static inline u64 HvLpConfig_getMaxMsPages(void) | ||
132 | { | ||
133 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) * HVPAGESPERCHUNK; | ||
134 | } | ||
135 | //=============================================================== | ||
136 | static inline u64 HvLpConfig_getInitMsMegs(void) | ||
137 | { | ||
138 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) / HVCHUNKSPERMEG; | ||
139 | } | ||
140 | //=============================================================== | ||
141 | static inline u64 HvLpConfig_getInitMsChunks(void) | ||
142 | { | ||
143 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init); | ||
144 | } | ||
145 | //=============================================================== | ||
146 | static inline u64 HvLpConfig_getInitMsPages(void) | ||
147 | { return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) * HVPAGESPERCHUNK; | ||
148 | } | ||
149 | //=============================================================== | ||
150 | static inline u64 HvLpConfig_getSystemPhysicalProcessors(void) | ||
151 | { | ||
152 | return HvCallCfg_getSystemPhysicalProcessors(); | ||
153 | } | ||
154 | //=============================================================== | ||
155 | static inline u64 HvLpConfig_getSystemLogicalProcessors(void) | ||
156 | { | ||
157 | return HvCallCfg_getSystemPhysicalProcessors() * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
158 | } | ||
159 | //=============================================================== | ||
160 | static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) | ||
161 | { | ||
162 | return HvCallCfg_getNumProcsInSharedPool(sPI); | ||
163 | } | ||
164 | //=============================================================== | ||
165 | static inline u64 HvLpConfig_getPhysicalProcessors(void) | ||
166 | { | ||
167 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
168 | } | ||
169 | //=============================================================== | ||
170 | static inline u64 HvLpConfig_getLogicalProcessors(void) | ||
171 | { | ||
172 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
173 | } | ||
174 | //=============================================================== | ||
175 | static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void) | ||
176 | { | ||
177 | return HvCallCfg_getSharedPoolIndex(HvLpConfig_getLpIndex()); | ||
178 | } | ||
179 | //=============================================================== | ||
180 | static inline u64 HvLpConfig_getSharedProcUnits(void) | ||
181 | { | ||
182 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
183 | } | ||
184 | //=============================================================== | ||
185 | static inline u64 HvLpConfig_getMinSharedProcUnits(void) | ||
186 | { | ||
187 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
188 | } | ||
189 | //=============================================================== | ||
190 | static inline u64 HvLpConfig_getMaxSharedProcUnits(void) | ||
191 | { | ||
192 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
193 | } | ||
194 | //=============================================================== | ||
195 | static inline u64 HvLpConfig_getMinPhysicalProcessors(void) | ||
196 | { | ||
197 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
198 | } | ||
199 | //=============================================================== | ||
200 | static inline u64 HvLpConfig_getMinLogicalProcessors(void) | ||
201 | { | ||
202 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
203 | } | ||
204 | //=============================================================== | ||
205 | static inline u64 HvLpConfig_getMaxPhysicalProcessors(void) | ||
206 | { | ||
207 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
208 | } | ||
209 | //=============================================================== | ||
210 | static inline u64 HvLpConfig_getMaxLogicalProcessors(void) | ||
211 | { | ||
212 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
213 | } | ||
214 | //=============================================================== | ||
215 | static inline u64 HvLpConfig_getInitPhysicalProcessors(void) | ||
216 | { | ||
217 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init); | ||
218 | } | ||
219 | //=============================================================== | ||
220 | static inline u64 HvLpConfig_getInitLogicalProcessors(void) | ||
221 | { | ||
222 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
223 | } | ||
224 | //================================================================ | ||
225 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) | ||
226 | { | ||
227 | return HvCallCfg_getVirtualLanIndexMap(HvLpConfig_getLpIndex_outline()); | ||
228 | } | ||
229 | //=============================================================== | ||
230 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(HvLpIndex lp) | ||
231 | { | ||
232 | return HvCallCfg_getVirtualLanIndexMap(lp); | ||
233 | } | ||
234 | //================================================================ | ||
235 | static inline HvLpIndex HvLpConfig_getBusOwner(HvBusNumber busNumber) | ||
236 | { | ||
237 | return HvCallCfg_getBusOwner(busNumber); | ||
238 | } | ||
239 | //=============================================================== | ||
240 | static inline int HvLpConfig_isBusDedicated(HvBusNumber busNumber) | ||
241 | { | ||
242 | return HvCallCfg_isBusDedicated(busNumber); | ||
243 | } | ||
244 | //================================================================ | ||
245 | static inline HvLpIndexMap HvLpConfig_getBusAllocation(HvBusNumber busNumber) | ||
246 | { | ||
247 | return HvCallCfg_getBusAllocation(busNumber); | ||
248 | } | ||
249 | //================================================================ | ||
250 | // returns the absolute real address of the load area | ||
251 | static inline u64 HvLpConfig_getLoadAddress(void) | ||
252 | { | ||
253 | return itLpNaca.xLoadAreaAddr & 0x7fffffffffffffff; | ||
254 | } | ||
255 | //================================================================ | ||
256 | static inline u64 HvLpConfig_getLoadPages(void) | ||
257 | { | ||
258 | return itLpNaca.xLoadAreaChunks * HVPAGESPERCHUNK; | ||
259 | } | ||
260 | //================================================================ | ||
261 | static inline int HvLpConfig_isBusOwnedByThisLp(HvBusNumber busNumber) | ||
262 | { | ||
263 | HvLpIndex busOwner = HvLpConfig_getBusOwner(busNumber); | ||
264 | return (busOwner == HvLpConfig_getLpIndex()); | ||
265 | } | ||
266 | //================================================================ | ||
267 | static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, HvLpIndex lp2) | ||
268 | { | ||
269 | HvLpVirtualLanIndexMap virtualLanIndexMap1 = HvCallCfg_getVirtualLanIndexMap( lp1 ); | ||
270 | HvLpVirtualLanIndexMap virtualLanIndexMap2 = HvCallCfg_getVirtualLanIndexMap( lp2 ); | ||
271 | return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); | ||
272 | } | ||
273 | //================================================================ | ||
274 | static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) | ||
275 | { | ||
276 | return HvCallCfg_getHostingLpIndex(lp); | ||
277 | } | ||
278 | //================================================================ | ||
279 | |||
280 | #endif /* _HVLPCONFIG_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvLpEvent.h b/include/asm-ppc64/iSeries/HvLpEvent.h new file mode 100644 index 000000000000..30936e433064 --- /dev/null +++ b/include/asm-ppc64/iSeries/HvLpEvent.h | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | * HvLpEvent.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | //====================================================================== | ||
21 | // | ||
22 | // This file contains the class for HV events in the system. | ||
23 | // | ||
24 | //===================================================================== | ||
25 | #ifndef _HVLPEVENT_H | ||
26 | #define _HVLPEVENT_H | ||
27 | |||
28 | #include <asm/types.h> | ||
29 | #include <asm/ptrace.h> | ||
30 | #include <asm/iSeries/HvTypes.h> | ||
31 | #include <asm/iSeries/HvCallEvent.h> | ||
32 | |||
33 | //===================================================================== | ||
34 | // | ||
35 | // HvLpEvent is the structure for Lp Event messages passed between | ||
36 | // partitions through PLIC. | ||
37 | // | ||
38 | //===================================================================== | ||
39 | |||
40 | struct HvEventFlags | ||
41 | { | ||
42 | u8 xValid:1; // Indicates a valid request x00-x00 | ||
43 | u8 xRsvd1:4; // Reserved ... | ||
44 | u8 xAckType:1; // Immediate or deferred ... | ||
45 | u8 xAckInd:1; // Indicates if ACK required ... | ||
46 | u8 xFunction:1; // Interrupt or Acknowledge ... | ||
47 | }; | ||
48 | |||
49 | |||
50 | struct HvLpEvent | ||
51 | { | ||
52 | struct HvEventFlags xFlags; // Event flags x00-x00 | ||
53 | u8 xType; // Type of message x01-x01 | ||
54 | u16 xSubtype; // Subtype for event x02-x03 | ||
55 | u8 xSourceLp; // Source LP x04-x04 | ||
56 | u8 xTargetLp; // Target LP x05-x05 | ||
57 | u8 xSizeMinus1; // Size of Derived class - 1 x06-x06 | ||
58 | u8 xRc; // RC for Ack flows x07-x07 | ||
59 | u16 xSourceInstanceId; // Source sides instance id x08-x09 | ||
60 | u16 xTargetInstanceId; // Target sides instance id x0A-x0B | ||
61 | union { | ||
62 | u32 xSubtypeData; // Data usable by the subtype x0C-x0F | ||
63 | u16 xSubtypeDataShort[2]; // Data as 2 shorts | ||
64 | u8 xSubtypeDataChar[4]; // Data as 4 chars | ||
65 | } x; | ||
66 | |||
67 | u64 xCorrelationToken; // Unique value for source/type x10-x17 | ||
68 | }; | ||
69 | |||
70 | // Lp Event handler function | ||
71 | typedef void (*LpEventHandler)(struct HvLpEvent *, struct pt_regs *); | ||
72 | |||
73 | // Register a handler for an event type | ||
74 | // returns 0 on success | ||
75 | extern int HvLpEvent_registerHandler( HvLpEvent_Type eventType, LpEventHandler hdlr); | ||
76 | |||
77 | // Unregister a handler for an event type | ||
78 | // This call will sleep until the handler being removed is guaranteed to | ||
79 | // be no longer executing on any CPU. Do not call with locks held. | ||
80 | // | ||
81 | // returns 0 on success | ||
82 | // Unregister will fail if there are any paths open for the type | ||
83 | extern int HvLpEvent_unregisterHandler( HvLpEvent_Type eventType ); | ||
84 | |||
85 | // Open an Lp Event Path for an event type | ||
86 | // returns 0 on success | ||
87 | // openPath will fail if there is no handler registered for the event type. | ||
88 | // The lpIndex specified is the partition index for the target partition | ||
89 | // (for VirtualIo, VirtualLan and SessionMgr) other types specify zero) | ||
90 | extern int HvLpEvent_openPath( HvLpEvent_Type eventType, HvLpIndex lpIndex ); | ||
91 | |||
92 | |||
93 | // Close an Lp Event Path for a type and partition | ||
94 | // returns 0 on sucess | ||
95 | extern int HvLpEvent_closePath( HvLpEvent_Type eventType, HvLpIndex lpIndex ); | ||
96 | |||
97 | #define HvLpEvent_Type_Hypervisor 0 | ||
98 | #define HvLpEvent_Type_MachineFac 1 | ||
99 | #define HvLpEvent_Type_SessionMgr 2 | ||
100 | #define HvLpEvent_Type_SpdIo 3 | ||
101 | #define HvLpEvent_Type_VirtualBus 4 | ||
102 | #define HvLpEvent_Type_PciIo 5 | ||
103 | #define HvLpEvent_Type_RioIo 6 | ||
104 | #define HvLpEvent_Type_VirtualLan 7 | ||
105 | #define HvLpEvent_Type_VirtualIo 8 | ||
106 | #define HvLpEvent_Type_NumTypes 9 | ||
107 | |||
108 | #define HvLpEvent_Rc_Good 0 | ||
109 | #define HvLpEvent_Rc_BufferNotAvailable 1 | ||
110 | #define HvLpEvent_Rc_Cancelled 2 | ||
111 | #define HvLpEvent_Rc_GenericError 3 | ||
112 | #define HvLpEvent_Rc_InvalidAddress 4 | ||
113 | #define HvLpEvent_Rc_InvalidPartition 5 | ||
114 | #define HvLpEvent_Rc_InvalidSize 6 | ||
115 | #define HvLpEvent_Rc_InvalidSubtype 7 | ||
116 | #define HvLpEvent_Rc_InvalidSubtypeData 8 | ||
117 | #define HvLpEvent_Rc_InvalidType 9 | ||
118 | #define HvLpEvent_Rc_PartitionDead 10 | ||
119 | #define HvLpEvent_Rc_PathClosed 11 | ||
120 | #define HvLpEvent_Rc_SubtypeError 12 | ||
121 | |||
122 | #define HvLpEvent_Function_Ack 0 | ||
123 | #define HvLpEvent_Function_Int 1 | ||
124 | |||
125 | #define HvLpEvent_AckInd_NoAck 0 | ||
126 | #define HvLpEvent_AckInd_DoAck 1 | ||
127 | |||
128 | #define HvLpEvent_AckType_ImmediateAck 0 | ||
129 | #define HvLpEvent_AckType_DeferredAck 1 | ||
130 | |||
131 | #define HvLpDma_Direction_LocalToRemote 0 | ||
132 | #define HvLpDma_Direction_RemoteToLocal 1 | ||
133 | |||
134 | #define HvLpDma_AddressType_TceIndex 0 | ||
135 | #define HvLpDma_AddressType_RealAddress 1 | ||
136 | |||
137 | #define HvLpDma_Rc_Good 0 | ||
138 | #define HvLpDma_Rc_Error 1 | ||
139 | #define HvLpDma_Rc_PartitionDead 2 | ||
140 | #define HvLpDma_Rc_PathClosed 3 | ||
141 | #define HvLpDma_Rc_InvalidAddress 4 | ||
142 | #define HvLpDma_Rc_InvalidLength 5 | ||
143 | |||
144 | #endif // _HVLPEVENT_H | ||
diff --git a/include/asm-ppc64/iSeries/HvReleaseData.h b/include/asm-ppc64/iSeries/HvReleaseData.h new file mode 100644 index 000000000000..183e5e738c26 --- /dev/null +++ b/include/asm-ppc64/iSeries/HvReleaseData.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * HvReleaseData.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _HVRELEASEDATA_H | ||
20 | #define _HVRELEASEDATA_H | ||
21 | |||
22 | //============================================================================= | ||
23 | // | ||
24 | // This control block contains the critical information about the | ||
25 | // release so that it can be changed in the future (ie, the virtual | ||
26 | // address of the OS's NACA). | ||
27 | // | ||
28 | #include <asm/types.h> | ||
29 | #include <asm/naca.h> | ||
30 | |||
31 | //============================================================================= | ||
32 | // | ||
33 | // When we IPL a secondary partition, we will check if if the | ||
34 | // secondary xMinPlicVrmIndex > the primary xVrmIndex. | ||
35 | // If it is then this tells PLIC that this secondary is not | ||
36 | // supported running on this "old" of a level of PLIC. | ||
37 | // | ||
38 | // Likewise, we will compare the primary xMinSlicVrmIndex to | ||
39 | // the secondary xVrmIndex. | ||
40 | // If the primary xMinSlicVrmDelta > secondary xVrmDelta then we | ||
41 | // know that this PLIC does not support running an OS "that old". | ||
42 | // | ||
43 | //============================================================================= | ||
44 | |||
45 | struct HvReleaseData | ||
46 | { | ||
47 | u32 xDesc; // Descriptor "HvRD" ebcdic x00-x03 | ||
48 | u16 xSize; // Size of this control block x04-x05 | ||
49 | u16 xVpdAreasPtrOffset; // Offset in NACA of ItVpdAreas x06-x07 | ||
50 | struct naca_struct * xSlicNacaAddr; // Virt addr of SLIC NACA x08-x0F | ||
51 | u32 xMsNucDataOffset; // Offset of Linux Mapping Data x10-x13 | ||
52 | u32 xRsvd1; // Reserved x14-x17 | ||
53 | u16 xTagsMode:1; // 0 == tags active, 1 == tags inactive | ||
54 | u16 xAddressSize:1; // 0 == 64-bit, 1 == 32-bit | ||
55 | u16 xNoSharedProcs:1; // 0 == shared procs, 1 == no shared | ||
56 | u16 xNoHMT:1; // 0 == allow HMT, 1 == no HMT | ||
57 | u16 xRsvd2:12; // Reserved x18-x19 | ||
58 | u16 xVrmIndex; // VRM Index of OS image x1A-x1B | ||
59 | u16 xMinSupportedPlicVrmIndex;// Min PLIC level (soft) x1C-x1D | ||
60 | u16 xMinCompatablePlicVrmIndex;// Min PLIC levelP (hard) x1E-x1F | ||
61 | char xVrmName[12]; // Displayable name x20-x2B | ||
62 | char xRsvd3[20]; // Reserved x2C-x3F | ||
63 | }; | ||
64 | |||
65 | #endif /* _HVRELEASEDATA_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvTypes.h b/include/asm-ppc64/iSeries/HvTypes.h new file mode 100644 index 000000000000..3ec49c1aec32 --- /dev/null +++ b/include/asm-ppc64/iSeries/HvTypes.h | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * HvTypes.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _HVTYPES_H | ||
20 | #define _HVTYPES_H | ||
21 | |||
22 | //=========================================================================== | ||
23 | // Header File Id | ||
24 | // Name______________: HvTypes.H | ||
25 | // | ||
26 | // Description_______: | ||
27 | // | ||
28 | // General typedefs for the hypervisor. | ||
29 | // | ||
30 | // Declared Class(es): | ||
31 | // | ||
32 | //=========================================================================== | ||
33 | |||
34 | #include <asm/types.h> | ||
35 | |||
36 | //------------------------------------------------------------------- | ||
37 | // Typedefs | ||
38 | //------------------------------------------------------------------- | ||
39 | typedef u8 HvLpIndex; | ||
40 | typedef u16 HvLpInstanceId; | ||
41 | typedef u64 HvLpTOD; | ||
42 | typedef u64 HvLpSystemSerialNum; | ||
43 | typedef u8 HvLpDeviceSerialNum[12]; | ||
44 | typedef u16 HvLpSanHwSet; | ||
45 | typedef u16 HvLpBus; | ||
46 | typedef u16 HvLpBoard; | ||
47 | typedef u16 HvLpCard; | ||
48 | typedef u8 HvLpDeviceType[4]; | ||
49 | typedef u8 HvLpDeviceModel[3]; | ||
50 | typedef u64 HvIoToken; | ||
51 | typedef u8 HvLpName[8]; | ||
52 | typedef u32 HvIoId; | ||
53 | typedef u64 HvRealMemoryIndex; | ||
54 | typedef u32 HvLpIndexMap; // Must hold HvMaxArchitectedLps bits!!! | ||
55 | typedef u16 HvLpVrmIndex; | ||
56 | typedef u32 HvXmGenerationId; | ||
57 | typedef u8 HvLpBusPool; | ||
58 | typedef u8 HvLpSharedPoolIndex; | ||
59 | typedef u16 HvLpSharedProcUnitsX100; | ||
60 | typedef u8 HvLpVirtualLanIndex; | ||
61 | typedef u16 HvLpVirtualLanIndexMap; // Must hold HvMaxArchitectedVirtualLans bits!!! | ||
62 | typedef u16 HvBusNumber; // Hypervisor Bus Number | ||
63 | typedef u8 HvSubBusNumber; // Hypervisor SubBus Number | ||
64 | typedef u8 HvAgentId; // Hypervisor DevFn | ||
65 | |||
66 | |||
67 | #define HVMAXARCHITECTEDLPS 32 | ||
68 | #define HVMAXARCHITECTEDVIRTUALLANS 16 | ||
69 | #define HVMAXARCHITECTEDVIRTUALDISKS 32 | ||
70 | #define HVMAXARCHITECTEDVIRTUALCDROMS 8 | ||
71 | #define HVMAXARCHITECTEDVIRTUALTAPES 8 | ||
72 | #define HVCHUNKSIZE 256 * 1024 | ||
73 | #define HVPAGESIZE 4 * 1024 | ||
74 | #define HVLPMINMEGSPRIMARY 256 | ||
75 | #define HVLPMINMEGSSECONDARY 64 | ||
76 | #define HVCHUNKSPERMEG 4 | ||
77 | #define HVPAGESPERMEG 256 | ||
78 | #define HVPAGESPERCHUNK 64 | ||
79 | |||
80 | #define HvMaxArchitectedLps ((HvLpIndex)HVMAXARCHITECTEDLPS) | ||
81 | #define HvMaxArchitectedVirtualLans ((HvLpVirtualLanIndex)16) | ||
82 | #define HvLpIndexInvalid ((HvLpIndex)0xff) | ||
83 | |||
84 | //-------------------------------------------------------------------- | ||
85 | // Enums for the sub-components under PLIC | ||
86 | // Used in HvCall and HvPrimaryCall | ||
87 | //-------------------------------------------------------------------- | ||
88 | enum HvCallCompIds | ||
89 | { | ||
90 | HvCallCompId = 0, | ||
91 | HvCallCpuCtlsCompId = 1, | ||
92 | HvCallCfgCompId = 2, | ||
93 | HvCallEventCompId = 3, | ||
94 | HvCallHptCompId = 4, | ||
95 | HvCallPciCompId = 5, | ||
96 | HvCallSlmCompId = 6, | ||
97 | HvCallSmCompId = 7, | ||
98 | HvCallSpdCompId = 8, | ||
99 | HvCallXmCompId = 9, | ||
100 | HvCallRioCompId = 10, | ||
101 | HvCallRsvd3CompId = 11, | ||
102 | HvCallRsvd2CompId = 12, | ||
103 | HvCallRsvd1CompId = 13, | ||
104 | HvCallMaxCompId = 14, | ||
105 | HvPrimaryCallCompId = 0, | ||
106 | HvPrimaryCallCfgCompId = 1, | ||
107 | HvPrimaryCallPciCompId = 2, | ||
108 | HvPrimaryCallSmCompId = 3, | ||
109 | HvPrimaryCallSpdCompId = 4, | ||
110 | HvPrimaryCallXmCompId = 5, | ||
111 | HvPrimaryCallRioCompId = 6, | ||
112 | HvPrimaryCallRsvd7CompId = 7, | ||
113 | HvPrimaryCallRsvd6CompId = 8, | ||
114 | HvPrimaryCallRsvd5CompId = 9, | ||
115 | HvPrimaryCallRsvd4CompId = 10, | ||
116 | HvPrimaryCallRsvd3CompId = 11, | ||
117 | HvPrimaryCallRsvd2CompId = 12, | ||
118 | HvPrimaryCallRsvd1CompId = 13, | ||
119 | HvPrimaryCallMaxCompId = HvCallMaxCompId | ||
120 | }; | ||
121 | |||
122 | struct HvLpBufferList { | ||
123 | u64 addr; | ||
124 | u64 len; | ||
125 | }; | ||
126 | |||
127 | #endif /* _HVTYPES_H */ | ||
diff --git a/include/asm-ppc64/iSeries/IoHriMainStore.h b/include/asm-ppc64/iSeries/IoHriMainStore.h new file mode 100644 index 000000000000..ff00e865f620 --- /dev/null +++ b/include/asm-ppc64/iSeries/IoHriMainStore.h | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * IoHriMainStore.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef _IOHRIMAINSTORE_H | ||
21 | #define _IOHRIMAINSTORE_H | ||
22 | |||
23 | /* Main Store Vpd for Condor,iStar,sStar */ | ||
24 | struct IoHriMainStoreSegment4 { | ||
25 | u8 msArea0Exists:1; | ||
26 | u8 msArea1Exists:1; | ||
27 | u8 msArea2Exists:1; | ||
28 | u8 msArea3Exists:1; | ||
29 | u8 reserved1:4; | ||
30 | u8 reserved2; | ||
31 | |||
32 | u8 msArea0Functional:1; | ||
33 | u8 msArea1Functional:1; | ||
34 | u8 msArea2Functional:1; | ||
35 | u8 msArea3Functional:1; | ||
36 | u8 reserved3:4; | ||
37 | u8 reserved4; | ||
38 | |||
39 | u32 totalMainStore; | ||
40 | |||
41 | u64 msArea0Ptr; | ||
42 | u64 msArea1Ptr; | ||
43 | u64 msArea2Ptr; | ||
44 | u64 msArea3Ptr; | ||
45 | |||
46 | u32 cardProductionLevel; | ||
47 | |||
48 | u32 msAdrHole; | ||
49 | |||
50 | u8 msArea0HasRiserVpd:1; | ||
51 | u8 msArea1HasRiserVpd:1; | ||
52 | u8 msArea2HasRiserVpd:1; | ||
53 | u8 msArea3HasRiserVpd:1; | ||
54 | u8 reserved5:4; | ||
55 | u8 reserved6; | ||
56 | u16 reserved7; | ||
57 | |||
58 | u8 reserved8[28]; | ||
59 | |||
60 | u64 nonInterleavedBlocksStartAdr; | ||
61 | u64 nonInterleavedBlocksEndAdr; | ||
62 | }; | ||
63 | |||
64 | /* Main Store VPD for Power4 */ | ||
65 | struct IoHriMainStoreChipInfo1 { | ||
66 | u32 chipMfgID __attribute((packed)); | ||
67 | char chipECLevel[4] __attribute((packed)); | ||
68 | }; | ||
69 | |||
70 | struct IoHriMainStoreVpdIdData { | ||
71 | char typeNumber[4]; | ||
72 | char modelNumber[4]; | ||
73 | char partNumber[12]; | ||
74 | char serialNumber[12]; | ||
75 | }; | ||
76 | |||
77 | struct IoHriMainStoreVpdFruData { | ||
78 | char fruLabel[8] __attribute((packed)); | ||
79 | u8 numberOfSlots __attribute((packed)); | ||
80 | u8 pluggingType __attribute((packed)); | ||
81 | u16 slotMapIndex __attribute((packed)); | ||
82 | }; | ||
83 | |||
84 | struct IoHriMainStoreAdrRangeBlock { | ||
85 | void * blockStart __attribute((packed)); | ||
86 | void * blockEnd __attribute((packed)); | ||
87 | u32 blockProcChipId __attribute((packed)); | ||
88 | }; | ||
89 | |||
90 | #define MaxAreaAdrRangeBlocks 4 | ||
91 | |||
92 | struct IoHriMainStoreArea4 { | ||
93 | u32 msVpdFormat __attribute((packed)); | ||
94 | u8 containedVpdType __attribute((packed)); | ||
95 | u8 reserved1 __attribute((packed)); | ||
96 | u16 reserved2 __attribute((packed)); | ||
97 | |||
98 | u64 msExists __attribute((packed)); | ||
99 | u64 msFunctional __attribute((packed)); | ||
100 | |||
101 | u32 memorySize __attribute((packed)); | ||
102 | u32 procNodeId __attribute((packed)); | ||
103 | |||
104 | u32 numAdrRangeBlocks __attribute((packed)); | ||
105 | struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks] __attribute((packed)); | ||
106 | |||
107 | struct IoHriMainStoreChipInfo1 chipInfo0 __attribute((packed)); | ||
108 | struct IoHriMainStoreChipInfo1 chipInfo1 __attribute((packed)); | ||
109 | struct IoHriMainStoreChipInfo1 chipInfo2 __attribute((packed)); | ||
110 | struct IoHriMainStoreChipInfo1 chipInfo3 __attribute((packed)); | ||
111 | struct IoHriMainStoreChipInfo1 chipInfo4 __attribute((packed)); | ||
112 | struct IoHriMainStoreChipInfo1 chipInfo5 __attribute((packed)); | ||
113 | struct IoHriMainStoreChipInfo1 chipInfo6 __attribute((packed)); | ||
114 | struct IoHriMainStoreChipInfo1 chipInfo7 __attribute((packed)); | ||
115 | |||
116 | void * msRamAreaArray __attribute((packed)); | ||
117 | u32 msRamAreaArrayNumEntries __attribute((packed)); | ||
118 | u32 msRamAreaArrayEntrySize __attribute((packed)); | ||
119 | |||
120 | u32 numaDimmExists __attribute((packed)); | ||
121 | u32 numaDimmFunctional __attribute((packed)); | ||
122 | void * numaDimmArray __attribute((packed)); | ||
123 | u32 numaDimmArrayNumEntries __attribute((packed)); | ||
124 | u32 numaDimmArrayEntrySize __attribute((packed)); | ||
125 | |||
126 | struct IoHriMainStoreVpdIdData idData __attribute((packed)); | ||
127 | |||
128 | u64 powerData __attribute((packed)); | ||
129 | u64 cardAssemblyPartNum __attribute((packed)); | ||
130 | u64 chipSerialNum __attribute((packed)); | ||
131 | |||
132 | u64 reserved3 __attribute((packed)); | ||
133 | char reserved4[16] __attribute((packed)); | ||
134 | |||
135 | struct IoHriMainStoreVpdFruData fruData __attribute((packed)); | ||
136 | |||
137 | u8 vpdPortNum __attribute((packed)); | ||
138 | u8 reserved5 __attribute((packed)); | ||
139 | u8 frameId __attribute((packed)); | ||
140 | u8 rackUnit __attribute((packed)); | ||
141 | char asciiKeywordVpd[256] __attribute((packed)); | ||
142 | u32 reserved6 __attribute((packed)); | ||
143 | }; | ||
144 | |||
145 | |||
146 | struct IoHriMainStoreSegment5 { | ||
147 | u16 reserved1; | ||
148 | u8 reserved2; | ||
149 | u8 msVpdFormat; | ||
150 | |||
151 | u32 totalMainStore; | ||
152 | u64 maxConfiguredMsAdr; | ||
153 | |||
154 | struct IoHriMainStoreArea4* msAreaArray; | ||
155 | u32 msAreaArrayNumEntries; | ||
156 | u32 msAreaArrayEntrySize; | ||
157 | |||
158 | u32 msAreaExists; | ||
159 | u32 msAreaFunctional; | ||
160 | |||
161 | u64 reserved3; | ||
162 | }; | ||
163 | |||
164 | |||
165 | |||
166 | #endif // _IOHRIMAINSTORE_H | ||
167 | |||
diff --git a/include/asm-ppc64/iSeries/IoHriProcessorVpd.h b/include/asm-ppc64/iSeries/IoHriProcessorVpd.h new file mode 100644 index 000000000000..965433888653 --- /dev/null +++ b/include/asm-ppc64/iSeries/IoHriProcessorVpd.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * IoHriProcessorVpd.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _IOHRIPROCESSORVPD_H | ||
20 | #define _IOHRIPROCESSORVPD_H | ||
21 | |||
22 | //=================================================================== | ||
23 | // | ||
24 | // This struct maps Processor Vpd that is DMAd to SLIC by CSP | ||
25 | // | ||
26 | |||
27 | #include <asm/types.h> | ||
28 | |||
29 | struct IoHriProcessorVpd | ||
30 | { | ||
31 | |||
32 | u8 xFormat; // VPD format indicator x00-x00 | ||
33 | u8 xProcStatus:8; // Processor State x01-x01 | ||
34 | u8 xSecondaryThreadCount; // Secondary thread cnt x02-x02 | ||
35 | u8 xSrcType:1; // Src Type x03-x03 | ||
36 | u8 xSrcSoft:1; // Src stay soft ... | ||
37 | u8 xSrcParable:1; // Src parable ... | ||
38 | u8 xRsvd1:5; // Reserved ... | ||
39 | u16 xHvPhysicalProcIndex; // Hypervisor physical proc index04-x05 | ||
40 | u16 xRsvd2; // Reserved x06-x07 | ||
41 | u32 xHwNodeId; // Hardware node id x08-x0B | ||
42 | u32 xHwProcId; // Hardware processor id x0C-x0F | ||
43 | |||
44 | u32 xTypeNum; // Card Type/CCIN number x10-x13 | ||
45 | u32 xModelNum; // Model/Feature number x14-x17 | ||
46 | u64 xSerialNum; // Serial number x18-x1F | ||
47 | char xPartNum[12]; // Book Part or FPU number x20-x2B | ||
48 | char xMfgID[4]; // Manufacturing ID x2C-x2F | ||
49 | |||
50 | u32 xProcFreq; // Processor Frequency x30-x33 | ||
51 | u32 xTimeBaseFreq; // Time Base Frequency x34-x37 | ||
52 | |||
53 | u32 xChipEcLevel; // Chip EC Levels x38-x3B | ||
54 | u32 xProcIdReg; // PIR SPR value x3C-x3F | ||
55 | u32 xPVR; // PVR value x40-x43 | ||
56 | u8 xRsvd3[12]; // Reserved x44-x4F | ||
57 | |||
58 | u32 xInstCacheSize; // Instruction cache size in KB x50-x53 | ||
59 | u32 xInstBlockSize; // Instruction cache block size x54-x57 | ||
60 | u32 xDataCacheOperandSize; // Data cache operand size x58-x5B | ||
61 | u32 xInstCacheOperandSize; // Inst cache operand size x5C-x5F | ||
62 | |||
63 | u32 xDataL1CacheSizeKB; // L1 data cache size in KB x60-x63 | ||
64 | u32 xDataL1CacheLineSize; // L1 data cache block size x64-x67 | ||
65 | u64 xRsvd4; // Reserved x68-x6F | ||
66 | |||
67 | u32 xDataL2CacheSizeKB; // L2 data cache size in KB x70-x73 | ||
68 | u32 xDataL2CacheLineSize; // L2 data cache block size x74-x77 | ||
69 | u64 xRsvd5; // Reserved x78-x7F | ||
70 | |||
71 | u32 xDataL3CacheSizeKB; // L3 data cache size in KB x80-x83 | ||
72 | u32 xDataL3CacheLineSize; // L3 data cache block size x84-x87 | ||
73 | u64 xRsvd6; // Reserved x88-x8F | ||
74 | |||
75 | u64 xFruLabel; // Card Location Label x90-x97 | ||
76 | u8 xSlotsOnCard; // Slots on card (0=no slots) x98-x98 | ||
77 | u8 xPartLocFlag; // Location flag (0-pluggable 1-imbedded) x99-x99 | ||
78 | u16 xSlotMapIndex; // Index in slot map table x9A-x9B | ||
79 | u8 xSmartCardPortNo; // Smart card port number x9C-x9C | ||
80 | u8 xRsvd7; // Reserved x9D-x9D | ||
81 | u16 xFrameIdAndRackUnit; // Frame ID and rack unit adr x9E-x9F | ||
82 | |||
83 | u8 xRsvd8[24]; // Reserved xA0-xB7 | ||
84 | |||
85 | char xProcSrc[72]; // CSP format SRC xB8-xFF | ||
86 | }; | ||
87 | |||
88 | #endif /* _IOHRIPROCESSORVPD_H */ | ||
diff --git a/include/asm-ppc64/iSeries/ItExtVpdPanel.h b/include/asm-ppc64/iSeries/ItExtVpdPanel.h new file mode 100644 index 000000000000..dee6b1273031 --- /dev/null +++ b/include/asm-ppc64/iSeries/ItExtVpdPanel.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * ItExtVpdPanel.h | ||
3 | * Copyright (C) 2002 Dave Boutcher IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ITEXTVPDPANEL_H | ||
20 | #define _ITEXTVPDPANEL_H | ||
21 | |||
22 | /* | ||
23 | * | ||
24 | * This struct maps the panel information | ||
25 | * | ||
26 | * Warning: | ||
27 | * This data must match the architecture for the panel information | ||
28 | * | ||
29 | */ | ||
30 | |||
31 | |||
32 | /*------------------------------------------------------------------- | ||
33 | * Standard Includes | ||
34 | *------------------------------------------------------------------- | ||
35 | */ | ||
36 | #include <asm/types.h> | ||
37 | |||
38 | struct ItExtVpdPanel | ||
39 | { | ||
40 | // Definition of the Extended Vpd On Panel Data Area | ||
41 | char systemSerial[8]; | ||
42 | char mfgID[4]; | ||
43 | char reserved1[24]; | ||
44 | char machineType[4]; | ||
45 | char systemID[6]; | ||
46 | char somUniqueCnt[4]; | ||
47 | char serialNumberCount; | ||
48 | char reserved2[7]; | ||
49 | u16 bbu3; | ||
50 | u16 bbu2; | ||
51 | u16 bbu1; | ||
52 | char xLocationLabel[8]; | ||
53 | u8 xRsvd1[6]; | ||
54 | u16 xFrameId; | ||
55 | u8 xRsvd2[48]; | ||
56 | }; | ||
57 | |||
58 | #endif /* _ITEXTVPDPANEL_H */ | ||
diff --git a/include/asm-ppc64/iSeries/ItIplParmsReal.h b/include/asm-ppc64/iSeries/ItIplParmsReal.h new file mode 100644 index 000000000000..4d8b430ab12d --- /dev/null +++ b/include/asm-ppc64/iSeries/ItIplParmsReal.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * ItIplParmsReal.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ITIPLPARMSREAL_H | ||
20 | #define _ITIPLPARMSREAL_H | ||
21 | |||
22 | //============================================================================== | ||
23 | // | ||
24 | // This struct maps the IPL Parameters DMA'd from the SP. | ||
25 | // | ||
26 | // Warning: | ||
27 | // This data must map in exactly 64 bytes and match the architecture for | ||
28 | // the IPL parms | ||
29 | // | ||
30 | //============================================================================= | ||
31 | |||
32 | |||
33 | //------------------------------------------------------------------- | ||
34 | // Standard Includes | ||
35 | //------------------------------------------------------------------- | ||
36 | #include <asm/types.h> | ||
37 | |||
38 | struct ItIplParmsReal | ||
39 | { | ||
40 | u8 xFormat; // Defines format of IplParms x00-x00 | ||
41 | u8 xRsvd01:6; // Reserved x01-x01 | ||
42 | u8 xAlternateSearch:1; // Alternate search indicator ... | ||
43 | u8 xUaSupplied:1; // UA Supplied on programmed IPL ... | ||
44 | u8 xLsUaFormat; // Format byte for UA x02-x02 | ||
45 | u8 xRsvd02; // Reserved x03-x03 | ||
46 | u32 xLsUa; // LS UA x04-x07 | ||
47 | u32 xUnusedLsLid; // First OS LID to load x08-x0B | ||
48 | u16 xLsBusNumber; // LS Bus Number x0C-x0D | ||
49 | u8 xLsCardAdr; // LS Card Address x0E-x0E | ||
50 | u8 xLsBoardAdr; // LS Board Address x0F-x0F | ||
51 | u32 xRsvd03; // Reserved x10-x13 | ||
52 | u8 xSpcnPresent:1; // SPCN present x14-x14 | ||
53 | u8 xCpmPresent:1; // CPM present ... | ||
54 | u8 xRsvd04:6; // Reserved ... | ||
55 | u8 xRsvd05:4; // Reserved x15-x15 | ||
56 | u8 xKeyLock:4; // Keylock setting ... | ||
57 | u8 xRsvd06:6; // Reserved x16-x16 | ||
58 | u8 xIplMode:2; // Ipl mode (A|B|C|D) ... | ||
59 | u8 xHwIplType; // Fast v slow v slow EC HW IPL x17-x17 | ||
60 | u16 xCpmEnabledIpl:1; // CPM in effect when IPL initiated x18-x19 | ||
61 | u16 xPowerOnResetIpl:1; // Indicate POR condition ... | ||
62 | u16 xMainStorePreserved:1; // Main Storage is preserved ... | ||
63 | u16 xRsvd07:13; // Reserved ... | ||
64 | u16 xIplSource:16; // Ipl source x1A-x1B | ||
65 | u8 xIplReason:8; // Reason for this IPL x1C-x1C | ||
66 | u8 xRsvd08; // Reserved x1D-x1D | ||
67 | u16 xRsvd09; // Reserved x1E-x1F | ||
68 | u16 xSysBoxType; // System Box Type x20-x21 | ||
69 | u16 xSysProcType; // System Processor Type x22-x23 | ||
70 | u32 xRsvd10; // Reserved x24-x27 | ||
71 | u64 xRsvd11; // Reserved x28-x2F | ||
72 | u64 xRsvd12; // Reserved x30-x37 | ||
73 | u64 xRsvd13; // Reserved x38-x3F | ||
74 | }; | ||
75 | |||
76 | #endif /* _ITIPLPARMSREAL_H */ | ||
diff --git a/include/asm-ppc64/iSeries/ItLpNaca.h b/include/asm-ppc64/iSeries/ItLpNaca.h new file mode 100644 index 000000000000..5baffddfae1b --- /dev/null +++ b/include/asm-ppc64/iSeries/ItLpNaca.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * ItLpNaca.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ITLPNACA_H | ||
20 | #define _ITLPNACA_H | ||
21 | |||
22 | //============================================================================= | ||
23 | // | ||
24 | // This control block contains the data that is shared between the | ||
25 | // hypervisor (PLIC) and the OS. | ||
26 | // | ||
27 | //============================================================================= | ||
28 | |||
29 | struct ItLpNaca | ||
30 | { | ||
31 | //============================================================================= | ||
32 | // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data | ||
33 | //============================================================================= | ||
34 | u32 xDesc; // Eye catcher x00-x03 | ||
35 | u16 xSize; // Size of this class x04-x05 | ||
36 | u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07 | ||
37 | u8 xMaxIntHdlrEntries; // Number of entries in array x08-x08 | ||
38 | u8 xPrimaryLpIndex; // LP Index of Primary x09-x09 | ||
39 | u8 xServiceLpIndex; // LP Ind of Service Focal Pointx0A-x0A | ||
40 | u8 xLpIndex; // LP Index x0B-x0B | ||
41 | u16 xMaxLpQueues; // Number of allocated queues x0C-x0D | ||
42 | u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F | ||
43 | u8 xPirEnvironMode:8; // Piranha or hardware x10-x10 | ||
44 | u8 xPirConsoleMode:8; // Piranha console indicator x11-x11 | ||
45 | u8 xPirDasdMode:8; // Piranha dasd indicator x12-x12 | ||
46 | u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17 | ||
47 | u8 xLparInstalled:1; // Is LPAR installed on system x18-x1F | ||
48 | u8 xSysPartitioned:1; // Is the system partitioned ... | ||
49 | u8 xHwSyncedTBs:1; // Hardware synced TBs ... | ||
50 | u8 xIntProcUtilHmt:1; // Utilize HMT for interrupts ... | ||
51 | u8 xRsvd1_1:4; // Reserved ... | ||
52 | u8 xSpVpdFormat:8; // VPD areas are in CSP format ... | ||
53 | u8 xIntProcRatio:8; // Ratio of int procs to procs ... | ||
54 | u8 xRsvd1_2[5]; // Reserved ... | ||
55 | u16 xRsvd1_3; // Reserved x20-x21 | ||
56 | u16 xPlicVrmIndex; // VRM index of PLIC x22-x23 | ||
57 | u16 xMinSupportedSlicVrmInd;// Min supported OS VRM index x24-x25 | ||
58 | u16 xMinCompatableSlicVrmInd;// Min compatible OS VRM index x26-x27 | ||
59 | u64 xLoadAreaAddr; // ER address of load area x28-x2F | ||
60 | u32 xLoadAreaChunks; // Chunks for the load area x30-x33 | ||
61 | u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37 | ||
62 | // doing an ASR switch on PASE | ||
63 | // system call. | ||
64 | u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f | ||
65 | u8 xRsvd1_4[64]; // x40-x7F | ||
66 | |||
67 | //============================================================================= | ||
68 | // CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data | ||
69 | //============================================================================= | ||
70 | u8 xRsvd2_0[128]; // Reserved x00-x7F | ||
71 | |||
72 | //============================================================================= | ||
73 | // CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators | ||
74 | // NB: Padding required to keep xInterrruptHdlr at x300 which is required | ||
75 | // for v4r4 PLIC. | ||
76 | //============================================================================= | ||
77 | u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F | ||
78 | u8 xRsvd3_0[384]; // Reserved 180-2FF | ||
79 | //============================================================================= | ||
80 | // CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt | ||
81 | // handlers | ||
82 | //============================================================================= | ||
83 | u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF | ||
84 | }; | ||
85 | |||
86 | //============================================================================= | ||
87 | |||
88 | #endif /* _ITLPNACA_H */ | ||
diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h new file mode 100644 index 000000000000..4f4dde2a638d --- /dev/null +++ b/include/asm-ppc64/iSeries/ItLpQueue.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * ItLpQueue.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ITLPQUEUE_H | ||
20 | #define _ITLPQUEUE_H | ||
21 | |||
22 | //============================================================================= | ||
23 | // | ||
24 | // This control block defines the simple LP queue structure that is | ||
25 | // shared between the hypervisor (PLIC) and the OS in order to send | ||
26 | // events to an LP. | ||
27 | // | ||
28 | |||
29 | #include <asm/types.h> | ||
30 | #include <asm/ptrace.h> | ||
31 | |||
32 | struct HvLpEvent; | ||
33 | |||
34 | #define ITMaxLpQueues 8 | ||
35 | |||
36 | #define NotUsed 0 // Queue will not be used by PLIC | ||
37 | #define DedicatedIo 1 // Queue dedicated to IO processor specified | ||
38 | #define DedicatedLp 2 // Queue dedicated to LP specified | ||
39 | #define Shared 3 // Queue shared for both IO and LP | ||
40 | |||
41 | #define LpEventStackSize 4096 | ||
42 | #define LpEventMaxSize 256 | ||
43 | #define LpEventAlign 64 | ||
44 | |||
45 | struct ItLpQueue | ||
46 | { | ||
47 | // | ||
48 | // The xSlicCurEventPtr is the pointer to the next event stack entry that will | ||
49 | // become valid. The OS must peek at this entry to determine if it is valid. | ||
50 | // PLIC will set the valid indicator as the very last store into that entry. | ||
51 | // | ||
52 | // When the OS has completed processing of the event then it will mark the event | ||
53 | // as invalid so that PLIC knows it can store into that event location again. | ||
54 | // | ||
55 | // If the event stack fills and there are overflow events, then PLIC will set | ||
56 | // the xPlicOverflowIntPending flag in which case the OS will have to fetch the | ||
57 | // additional LP events once they have drained the event stack. | ||
58 | // | ||
59 | // The first 16-bytes are known by both the OS and PLIC. The remainder of the | ||
60 | // cache line is for use by the OS. | ||
61 | // | ||
62 | //============================================================================= | ||
63 | u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending | ||
64 | u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed | ||
65 | u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation | ||
66 | u8 xPlicRsvd[12]; // 0x04 | ||
67 | char* xSlicCurEventPtr; // 0x10 | ||
68 | char* xSlicLastValidEventPtr; // 0x18 | ||
69 | char* xSlicEventStackPtr; // 0x20 | ||
70 | u8 xIndex; // 0x28 unique sequential index. | ||
71 | u8 xSlicRsvd[3]; // 0x29-2b | ||
72 | u32 xInUseWord; // 0x2C | ||
73 | u64 xLpIntCount; // 0x30 Total Lp Int msgs processed | ||
74 | u64 xLpIntCountByType[9]; // 0x38-0x7F Event counts by type | ||
75 | }; | ||
76 | |||
77 | extern struct ItLpQueue xItLpQueue; | ||
78 | |||
79 | extern struct HvLpEvent * ItLpQueue_getNextLpEvent( struct ItLpQueue * ); | ||
80 | extern int ItLpQueue_isLpIntPending( struct ItLpQueue * ); | ||
81 | extern unsigned ItLpQueue_process( struct ItLpQueue *, struct pt_regs * ); | ||
82 | extern void ItLpQueue_clearValid( struct HvLpEvent * ); | ||
83 | |||
84 | static __inline__ void process_iSeries_events( void ) | ||
85 | { | ||
86 | __asm__ __volatile__ ( | ||
87 | " li 0,0x5555 \n\ | ||
88 | sc" | ||
89 | : : : "r0", "r3" ); | ||
90 | } | ||
91 | |||
92 | #endif /* _ITLPQUEUE_H */ | ||
diff --git a/include/asm-ppc64/iSeries/ItLpRegSave.h b/include/asm-ppc64/iSeries/ItLpRegSave.h new file mode 100644 index 000000000000..dafc4c813788 --- /dev/null +++ b/include/asm-ppc64/iSeries/ItLpRegSave.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * ItLpRegSave.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ITLPREGSAVE_H | ||
20 | #define _ITLPREGSAVE_H | ||
21 | |||
22 | //===================================================================================== | ||
23 | // | ||
24 | // This control block contains the data that is shared between PLIC | ||
25 | // and the OS | ||
26 | // | ||
27 | // | ||
28 | |||
29 | struct ItLpRegSave | ||
30 | { | ||
31 | u32 xDesc; // Eye catcher "LpRS" ebcdic 000-003 | ||
32 | u16 xSize; // Size of this class 004-005 | ||
33 | u8 xInUse; // Area is live 006-007 | ||
34 | u8 xRsvd1[9]; // Reserved 007-00F | ||
35 | |||
36 | u8 xFixedRegSave[352]; // Fixed Register Save Area 010-16F | ||
37 | u32 xCTRL; // Control Register 170-173 | ||
38 | u32 xDEC; // Decrementer 174-177 | ||
39 | u32 xFPSCR; // FP Status and Control Reg 178-17B | ||
40 | u32 xPVR; // Processor Version Number 17C-17F | ||
41 | |||
42 | u64 xMMCR0; // Monitor Mode Control Reg 0 180-187 | ||
43 | u32 xPMC1; // Perf Monitor Counter 1 188-18B | ||
44 | u32 xPMC2; // Perf Monitor Counter 2 18C-18F | ||
45 | u32 xPMC3; // Perf Monitor Counter 3 190-193 | ||
46 | u32 xPMC4; // Perf Monitor Counter 4 194-197 | ||
47 | u32 xPIR; // Processor ID Reg 198-19B | ||
48 | |||
49 | u32 xMMCR1; // Monitor Mode Control Reg 1 19C-19F | ||
50 | u32 xMMCRA; // Monitor Mode Control Reg A 1A0-1A3 | ||
51 | u32 xPMC5; // Perf Monitor Counter 5 1A4-1A7 | ||
52 | u32 xPMC6; // Perf Monitor Counter 6 1A8-1AB | ||
53 | u32 xPMC7; // Perf Monitor Counter 7 1AC-1AF | ||
54 | u32 xPMC8; // Perf Monitor Counter 8 1B0-1B3 | ||
55 | u32 xTSC; // Thread Switch Control 1B4-1B7 | ||
56 | u32 xTST; // Thread Switch Timeout 1B8-1BB | ||
57 | u32 xRsvd; // Reserved 1BC-1BF | ||
58 | |||
59 | u64 xACCR; // Address Compare Control Reg 1C0-1C7 | ||
60 | u64 xIMR; // Instruction Match Register 1C8-1CF | ||
61 | u64 xSDR1; // Storage Description Reg 1 1D0-1D7 | ||
62 | u64 xSPRG0; // Special Purpose Reg General0 1D8-1DF | ||
63 | u64 xSPRG1; // Special Purpose Reg General1 1E0-1E7 | ||
64 | u64 xSPRG2; // Special Purpose Reg General2 1E8-1EF | ||
65 | u64 xSPRG3; // Special Purpose Reg General3 1F0-1F7 | ||
66 | u64 xTB; // Time Base Register 1F8-1FF | ||
67 | |||
68 | u64 xFPR[32]; // Floating Point Registers 200-2FF | ||
69 | |||
70 | u64 xMSR; // Machine State Register 300-307 | ||
71 | u64 xNIA; // Next Instruction Address 308-30F | ||
72 | |||
73 | u64 xDABR; // Data Address Breakpoint Reg 310-317 | ||
74 | u64 xIABR; // Inst Address Breakpoint Reg 318-31F | ||
75 | |||
76 | u64 xHID0; // HW Implementation Dependent0 320-327 | ||
77 | |||
78 | u64 xHID4; // HW Implementation Dependent4 328-32F | ||
79 | u64 xSCOMd; // SCON Data Reg (SPRG4) 330-337 | ||
80 | u64 xSCOMc; // SCON Command Reg (SPRG5) 338-33F | ||
81 | u64 xSDAR; // Sample Data Address Register 340-347 | ||
82 | u64 xSIAR; // Sample Inst Address Register 348-34F | ||
83 | |||
84 | u8 xRsvd3[176]; // Reserved 350-3FF | ||
85 | }; | ||
86 | |||
87 | #endif /* _ITLPREGSAVE_H */ | ||
diff --git a/include/asm-ppc64/iSeries/ItSpCommArea.h b/include/asm-ppc64/iSeries/ItSpCommArea.h new file mode 100644 index 000000000000..f1b56f9e11e2 --- /dev/null +++ b/include/asm-ppc64/iSeries/ItSpCommArea.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * ItSpCommArea.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | |||
21 | #ifndef _ITSPCOMMAREA_H | ||
22 | #define _ITSPCOMMAREA_H | ||
23 | |||
24 | |||
25 | struct SpCommArea | ||
26 | { | ||
27 | u32 xDesc; // Descriptor (only in new formats) 000-003 | ||
28 | u8 xFormat; // Format (only in new formats) 004-004 | ||
29 | u8 xRsvd1[11]; // Reserved 005-00F | ||
30 | u64 xRawTbAtIplStart; // Raw HW TB value when IPL is started 010-017 | ||
31 | u64 xRawTodAtIplStart; // Raw HW TOD value when IPL is started 018-01F | ||
32 | u64 xBcdTimeAtIplStart; // BCD time when IPL is started 020-027 | ||
33 | u64 xBcdTimeAtOsStart; // BCD time when OS passed control 028-02F | ||
34 | u8 xRsvd2[80]; // Reserved 030-07F | ||
35 | }; | ||
36 | |||
37 | extern struct SpCommArea xSpCommArea; | ||
38 | |||
39 | #endif /* _ITSPCOMMAREA_H */ | ||
diff --git a/include/asm-ppc64/iSeries/ItVpdAreas.h b/include/asm-ppc64/iSeries/ItVpdAreas.h new file mode 100644 index 000000000000..d120439f30a5 --- /dev/null +++ b/include/asm-ppc64/iSeries/ItVpdAreas.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * ItVpdAreas.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ITVPDAREAS_H | ||
20 | #define _ITVPDAREAS_H | ||
21 | |||
22 | //===================================================================================== | ||
23 | // | ||
24 | // This file defines the address and length of all of the VPD area passed to | ||
25 | // the OS from PLIC (most of which start from the SP). | ||
26 | // | ||
27 | |||
28 | #include <asm/types.h> | ||
29 | |||
30 | // VPD Entry index is carved in stone - cannot be changed (easily). | ||
31 | #define ItVpdCecVpd 0 | ||
32 | #define ItVpdDynamicSpace 1 | ||
33 | #define ItVpdExtVpd 2 | ||
34 | #define ItVpdExtVpdOnPanel 3 | ||
35 | #define ItVpdFirstPaca 4 | ||
36 | #define ItVpdIoVpd 5 | ||
37 | #define ItVpdIplParms 6 | ||
38 | #define ItVpdMsVpd 7 | ||
39 | #define ItVpdPanelVpd 8 | ||
40 | #define ItVpdLpNaca 9 | ||
41 | #define ItVpdBackplaneAndMaybeClockCardVpd 10 | ||
42 | #define ItVpdRecoveryLogBuffer 11 | ||
43 | #define ItVpdSpCommArea 12 | ||
44 | #define ItVpdSpLogBuffer 13 | ||
45 | #define ItVpdSpLogBufferSave 14 | ||
46 | #define ItVpdSpCardVpd 15 | ||
47 | #define ItVpdFirstProcVpd 16 | ||
48 | #define ItVpdApModelVpd 17 | ||
49 | #define ItVpdClockCardVpd 18 | ||
50 | #define ItVpdBusExtCardVpd 19 | ||
51 | #define ItVpdProcCapacityVpd 20 | ||
52 | #define ItVpdInteractiveCapacityVpd 21 | ||
53 | #define ItVpdFirstSlotLabel 22 | ||
54 | #define ItVpdFirstLpQueue 23 | ||
55 | #define ItVpdFirstL3CacheVpd 24 | ||
56 | #define ItVpdFirstProcFruVpd 25 | ||
57 | |||
58 | #define ItVpdMaxEntries 26 | ||
59 | |||
60 | |||
61 | #define ItDmaMaxEntries 10 | ||
62 | |||
63 | #define ItVpdAreasMaxSlotLabels 192 | ||
64 | |||
65 | |||
66 | struct SlicVpdAdrs { | ||
67 | u32 pad1; | ||
68 | void * vpdAddr; | ||
69 | }; | ||
70 | |||
71 | |||
72 | struct ItVpdAreas | ||
73 | { | ||
74 | u32 xSlicDesc; // Descriptor 000-003 | ||
75 | u16 xSlicSize; // Size of this control block 004-005 | ||
76 | u16 xPlicAdjustVpdLens:1; // Flag to indicate new interface 006-007 | ||
77 | u16 xRsvd1:15; // Reserved bits ... | ||
78 | u16 xSlicVpdEntries; // Number of VPD entries 008-009 | ||
79 | u16 xSlicDmaEntries; // Number of DMA entries 00A-00B | ||
80 | u16 xSlicMaxLogicalProcs; // Maximum logical processors 00C-00D | ||
81 | u16 xSlicMaxPhysicalProcs; // Maximum physical processors 00E-00F | ||
82 | u16 xSlicDmaToksOffset; // Offset into this of array 010-011 | ||
83 | u16 xSlicVpdAdrsOffset; // Offset into this of array 012-013 | ||
84 | u16 xSlicDmaLensOffset; // Offset into this of array 014-015 | ||
85 | u16 xSlicVpdLensOffset; // Offset into this of array 016-017 | ||
86 | u16 xSlicMaxSlotLabels; // Maximum number of slot labels 018-019 | ||
87 | u16 xSlicMaxLpQueues; // Maximum number of LP Queues 01A-01B | ||
88 | u8 xRsvd2[4]; // Reserved 01C-01F | ||
89 | u64 xRsvd3[12]; // Reserved 020-07F | ||
90 | u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7 | ||
91 | u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF | ||
92 | u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F | ||
93 | void * xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF | ||
94 | }; | ||
95 | |||
96 | #endif /* _ITVPDAREAS_H */ | ||
diff --git a/include/asm-ppc64/iSeries/LparData.h b/include/asm-ppc64/iSeries/LparData.h new file mode 100644 index 000000000000..e54f3b686e58 --- /dev/null +++ b/include/asm-ppc64/iSeries/LparData.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * LparData.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef _LPARDATA_H | ||
21 | #define _LPARDATA_H | ||
22 | |||
23 | #include <asm/types.h> | ||
24 | #include <asm/page.h> | ||
25 | #include <asm/abs_addr.h> | ||
26 | |||
27 | #include <asm/iSeries/ItLpNaca.h> | ||
28 | #include <asm/iSeries/ItLpRegSave.h> | ||
29 | #include <asm/iSeries/HvReleaseData.h> | ||
30 | #include <asm/iSeries/LparMap.h> | ||
31 | #include <asm/iSeries/ItVpdAreas.h> | ||
32 | #include <asm/iSeries/ItIplParmsReal.h> | ||
33 | #include <asm/iSeries/ItExtVpdPanel.h> | ||
34 | #include <asm/iSeries/ItLpQueue.h> | ||
35 | #include <asm/iSeries/IoHriProcessorVpd.h> | ||
36 | |||
37 | extern struct LparMap xLparMap; | ||
38 | extern struct HvReleaseData hvReleaseData; | ||
39 | extern struct ItLpNaca itLpNaca; | ||
40 | extern struct ItIplParmsReal xItIplParmsReal; | ||
41 | extern struct ItExtVpdPanel xItExtVpdPanel; | ||
42 | extern struct IoHriProcessorVpd xIoHriProcessorVpd[]; | ||
43 | extern struct ItLpQueue xItLpQueue; | ||
44 | extern struct ItVpdAreas itVpdAreas; | ||
45 | extern u64 xMsVpd[]; | ||
46 | extern struct msChunks msChunks; | ||
47 | |||
48 | |||
49 | #endif /* _LPARDATA_H */ | ||
diff --git a/include/asm-ppc64/iSeries/LparMap.h b/include/asm-ppc64/iSeries/LparMap.h new file mode 100644 index 000000000000..075205bb0f4a --- /dev/null +++ b/include/asm-ppc64/iSeries/LparMap.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * LparMap.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _LPARMAP_H | ||
20 | #define _LPARMAP_H | ||
21 | |||
22 | #include <asm/types.h> | ||
23 | |||
24 | /* The iSeries hypervisor will set up mapping for one or more | ||
25 | * ESID/VSID pairs (in SLB/segment registers) and will set up | ||
26 | * mappings of one or more ranges of pages to VAs. | ||
27 | * We will have the hypervisor set up the ESID->VSID mapping | ||
28 | * for the four kernel segments (C-F). With shared processors, | ||
29 | * the hypervisor will clear all segment registers and reload | ||
30 | * these four whenever the processor is switched from one | ||
31 | * partition to another. | ||
32 | */ | ||
33 | |||
34 | /* The Vsid and Esid identified below will be used by the hypervisor | ||
35 | * to set up a memory mapping for part of the load area before giving | ||
36 | * control to the Linux kernel. The load area is 64 MB, but this must | ||
37 | * not attempt to map the whole load area. The Hashed Page Table may | ||
38 | * need to be located within the load area (if the total partition size | ||
39 | * is 64 MB), but cannot be mapped. Typically, this should specify | ||
40 | * to map half (32 MB) of the load area. | ||
41 | * | ||
42 | * The hypervisor will set up page table entries for the number of | ||
43 | * pages specified. | ||
44 | * | ||
45 | * In 32-bit mode, the hypervisor will load all four of the | ||
46 | * segment registers (identified by the low-order four bits of the | ||
47 | * Esid field. In 64-bit mode, the hypervisor will load one SLB | ||
48 | * entry to map the Esid to the Vsid. | ||
49 | */ | ||
50 | |||
51 | // Hypervisor initially maps 32MB of the load area | ||
52 | #define HvPagesToMap 8192 | ||
53 | |||
54 | struct LparMap | ||
55 | { | ||
56 | u64 xNumberEsids; // Number of ESID/VSID pairs (1) | ||
57 | u64 xNumberRanges; // Number of VA ranges to map (1) | ||
58 | u64 xSegmentTableOffs; // Page number within load area of seg table (0) | ||
59 | u64 xRsvd[5]; // Reserved (0) | ||
60 | u64 xKernelEsid; // Esid used to map kernel load (0x0C00000000) | ||
61 | u64 xKernelVsid; // Vsid used to map kernel load (0x0C00000000) | ||
62 | u64 xPages; // Number of pages to be mapped (8192) | ||
63 | u64 xOffset; // Offset from start of load area (0) | ||
64 | u64 xVPN; // Virtual Page Number (0x000C000000000000) | ||
65 | }; | ||
66 | |||
67 | #endif /* _LPARMAP_H */ | ||
diff --git a/include/asm-ppc64/iSeries/XmPciLpEvent.h b/include/asm-ppc64/iSeries/XmPciLpEvent.h new file mode 100644 index 000000000000..a3d27f116e49 --- /dev/null +++ b/include/asm-ppc64/iSeries/XmPciLpEvent.h | |||
@@ -0,0 +1,18 @@ | |||
1 | |||
2 | #ifndef __XMPCILPEVENT_H__ | ||
3 | #define __XMPCILPEVENT_H__ | ||
4 | |||
5 | |||
6 | #ifdef __cplusplus | ||
7 | extern "C" { | ||
8 | #endif | ||
9 | |||
10 | int XmPciLpEvent_init(void); | ||
11 | void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq); | ||
12 | |||
13 | |||
14 | #ifdef __cplusplus | ||
15 | } | ||
16 | #endif | ||
17 | |||
18 | #endif /* __XMPCILPEVENT_H__ */ | ||
diff --git a/include/asm-ppc64/iSeries/iSeries_io.h b/include/asm-ppc64/iSeries/iSeries_io.h new file mode 100644 index 000000000000..f52b7599b372 --- /dev/null +++ b/include/asm-ppc64/iSeries/iSeries_io.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef _ISERIES_IO_H | ||
2 | #define _ISERIES_IO_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | #ifdef CONFIG_PPC_ISERIES | ||
7 | #include <linux/types.h> | ||
8 | /************************************************************************/ | ||
9 | /* File iSeries_io.h created by Allan Trautman on Thu Dec 28 2000. */ | ||
10 | /************************************************************************/ | ||
11 | /* Remaps the io.h for the iSeries Io */ | ||
12 | /* Copyright (C) 20yy Allan H Trautman, IBM Corporation */ | ||
13 | /* */ | ||
14 | /* This program is free software; you can redistribute it and/or modify */ | ||
15 | /* it under the terms of the GNU General Public License as published by */ | ||
16 | /* the Free Software Foundation; either version 2 of the License, or */ | ||
17 | /* (at your option) any later version. */ | ||
18 | /* */ | ||
19 | /* This program is distributed in the hope that it will be useful, */ | ||
20 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | ||
21 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | ||
22 | /* GNU General Public License for more details. */ | ||
23 | /* */ | ||
24 | /* You should have received a copy of the GNU General Public License */ | ||
25 | /* along with this program; if not, write to the: */ | ||
26 | /* Free Software Foundation, Inc., */ | ||
27 | /* 59 Temple Place, Suite 330, */ | ||
28 | /* Boston, MA 02111-1307 USA */ | ||
29 | /************************************************************************/ | ||
30 | /* Change Activity: */ | ||
31 | /* Created December 28, 2000 */ | ||
32 | /* End Change Activity */ | ||
33 | /************************************************************************/ | ||
34 | extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); | ||
35 | extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); | ||
36 | extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); | ||
37 | extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress); | ||
38 | extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress); | ||
39 | extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress); | ||
40 | |||
41 | extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n); | ||
42 | extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t n); | ||
43 | extern void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *source, size_t n); | ||
44 | |||
45 | #endif /* CONFIG_PPC_ISERIES */ | ||
46 | #endif /* _ISERIES_IO_H */ | ||
diff --git a/include/asm-ppc64/iSeries/iSeries_irq.h b/include/asm-ppc64/iSeries/iSeries_irq.h new file mode 100644 index 000000000000..ff8ddede038c --- /dev/null +++ b/include/asm-ppc64/iSeries/iSeries_irq.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __ISERIES_IRQ_H__ | ||
2 | #define __ISERIES_IRQ_H__ | ||
3 | |||
4 | #ifdef __cplusplus | ||
5 | extern "C" { | ||
6 | #endif | ||
7 | |||
8 | void iSeries_init_IRQ(void); | ||
9 | int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId); | ||
10 | int iSeries_assign_IRQ(int, HvBusNumber, HvSubBusNumber, HvAgentId); | ||
11 | void iSeries_activate_IRQs(void); | ||
12 | |||
13 | int XmPciLpEvent_init(void); | ||
14 | |||
15 | #ifdef __cplusplus | ||
16 | } | ||
17 | #endif | ||
18 | |||
19 | #endif /* __ISERIES_IRQ_H__ */ | ||
diff --git a/include/asm-ppc64/iSeries/iSeries_pci.h b/include/asm-ppc64/iSeries/iSeries_pci.h new file mode 100644 index 000000000000..5769cff4c00c --- /dev/null +++ b/include/asm-ppc64/iSeries/iSeries_pci.h | |||
@@ -0,0 +1,112 @@ | |||
1 | #ifndef _ISERIES_64_PCI_H | ||
2 | #define _ISERIES_64_PCI_H | ||
3 | |||
4 | /************************************************************************/ | ||
5 | /* File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001. */ | ||
6 | /************************************************************************/ | ||
7 | /* Define some useful macros for the iSeries pci routines. */ | ||
8 | /* Copyright (C) 2001 Allan H Trautman, IBM Corporation */ | ||
9 | /* */ | ||
10 | /* This program is free software; you can redistribute it and/or modify */ | ||
11 | /* it under the terms of the GNU General Public License as published by */ | ||
12 | /* the Free Software Foundation; either version 2 of the License, or */ | ||
13 | /* (at your option) any later version. */ | ||
14 | /* */ | ||
15 | /* This program is distributed in the hope that it will be useful, */ | ||
16 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | ||
17 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | ||
18 | /* GNU General Public License for more details. */ | ||
19 | /* */ | ||
20 | /* You should have received a copy of the GNU General Public License */ | ||
21 | /* along with this program; if not, write to the: */ | ||
22 | /* Free Software Foundation, Inc., */ | ||
23 | /* 59 Temple Place, Suite 330, */ | ||
24 | /* Boston, MA 02111-1307 USA */ | ||
25 | /************************************************************************/ | ||
26 | /* Change Activity: */ | ||
27 | /* Created Feb 20, 2001 */ | ||
28 | /* Added device reset, March 22, 2001 */ | ||
29 | /* Ported to ppc64, May 25, 2001 */ | ||
30 | /* End Change Activity */ | ||
31 | /************************************************************************/ | ||
32 | |||
33 | #include <asm/iSeries/HvCallPci.h> | ||
34 | #include <asm/abs_addr.h> | ||
35 | |||
36 | struct pci_dev; /* For Forward Reference */ | ||
37 | struct iSeries_Device_Node; | ||
38 | |||
39 | /************************************************************************/ | ||
40 | /* Gets iSeries Bus, SubBus, DevFn using iSeries_Device_Node structure */ | ||
41 | /************************************************************************/ | ||
42 | |||
43 | #define ISERIES_BUS(DevPtr) DevPtr->DsaAddr.Dsa.busNumber | ||
44 | #define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.Dsa.subBusNumber | ||
45 | #define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.Dsa.deviceId | ||
46 | #define ISERIES_DSA(DevPtr) DevPtr->DsaAddr.DsaAddr | ||
47 | #define ISERIES_DEVFUN(DevPtr) DevPtr->DevFn | ||
48 | #define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node*)PciDev->sysdata) | ||
49 | |||
50 | #define EADsMaxAgents 7 | ||
51 | |||
52 | /************************************************************************/ | ||
53 | /* Decodes Linux DevFn to iSeries DevFn, bridge device, or function. */ | ||
54 | /* For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h */ | ||
55 | /************************************************************************/ | ||
56 | |||
57 | #define ISERIES_PCI_AGENTID(idsel,func) ((idsel & 0x0F) << 4) | (func & 0x07) | ||
58 | #define ISERIES_ENCODE_DEVICE(agentid) ((0x10) | ((agentid&0x20)>>2) | (agentid&07)) | ||
59 | |||
60 | #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7) | ||
61 | #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7) | ||
62 | |||
63 | /* | ||
64 | * N.B. the ISERIES_DECODE_* macros are not used anywhere, and I think | ||
65 | * the 0x71 (at least) must be wrong - 0x78 maybe? -- paulus. | ||
66 | */ | ||
67 | #define ISERIES_DECODE_DEVFN(linuxdevfn) (((linuxdevfn & 0x71) << 1) | (linuxdevfn & 0x07)) | ||
68 | #define ISERIES_DECODE_DEVICE(linuxdevfn) (((linuxdevfn & 0x38) >> 3) |(((linuxdevfn & 0x40) >> 2) + 0x10)) | ||
69 | #define ISERIES_DECODE_FUNCTION(linuxdevfn) (linuxdevfn & 0x07) | ||
70 | |||
71 | /************************************************************************/ | ||
72 | /* Converts Virtual Address to Real Address for Hypervisor calls */ | ||
73 | /************************************************************************/ | ||
74 | |||
75 | #define ISERIES_HV_ADDR(virtaddr) (0x8000000000000000 | virt_to_abs(virtaddr)) | ||
76 | |||
77 | /************************************************************************/ | ||
78 | /* iSeries Device Information */ | ||
79 | /************************************************************************/ | ||
80 | |||
81 | struct iSeries_Device_Node { | ||
82 | struct list_head Device_List; | ||
83 | struct pci_dev* PciDev; /* Pointer to pci_dev structure*/ | ||
84 | union HvDsaMap DsaAddr; /* Direct Select Address */ | ||
85 | /* busNumber,subBusNumber, */ | ||
86 | /* deviceId, barNumber */ | ||
87 | HvAgentId AgentId; /* Hypervisor DevFn */ | ||
88 | int DevFn; /* Linux devfn */ | ||
89 | int BarOffset; | ||
90 | int Irq; /* Assigned IRQ */ | ||
91 | int ReturnCode; /* Return Code Holder */ | ||
92 | int IoRetry; /* Current Retry Count */ | ||
93 | int Flags; /* Possible flags(disable/bist)*/ | ||
94 | u16 Vendor; /* Vendor ID */ | ||
95 | u8 LogicalSlot; /* Hv Slot Index for Tces */ | ||
96 | struct iommu_table* iommu_table;/* Device TCE Table */ | ||
97 | u8 PhbId; /* Phb Card is on. */ | ||
98 | u16 Board; /* Board Number */ | ||
99 | u8 FrameId; /* iSeries spcn Frame Id */ | ||
100 | char CardLocation[4];/* Char format of planar vpd */ | ||
101 | char Location[20]; /* Frame 1, Card C10 */ | ||
102 | }; | ||
103 | |||
104 | /************************************************************************/ | ||
105 | /* Functions */ | ||
106 | /************************************************************************/ | ||
107 | |||
108 | extern int iSeries_Device_Information(struct pci_dev*,char*, int); | ||
109 | extern void iSeries_Get_Location_Code(struct iSeries_Device_Node*); | ||
110 | extern int iSeries_Device_ToggleReset(struct pci_dev* PciDev, int AssertTime, int DelayTime); | ||
111 | |||
112 | #endif /* _ISERIES_64_PCI_H */ | ||
diff --git a/include/asm-ppc64/iSeries/iSeries_proc.h b/include/asm-ppc64/iSeries/iSeries_proc.h new file mode 100644 index 000000000000..adb6dc14dd4d --- /dev/null +++ b/include/asm-ppc64/iSeries/iSeries_proc.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * iSeries_proc.h | ||
3 | * Copyright (C) 2001 Kyle A. Lucke IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ISERIES_PROC_H | ||
20 | #define _ISERIES_PROC_H | ||
21 | |||
22 | extern void iSeries_proc_early_init(void); | ||
23 | |||
24 | #endif /* _iSeries_PROC_H */ | ||
diff --git a/include/asm-ppc64/iSeries/mf.h b/include/asm-ppc64/iSeries/mf.h new file mode 100644 index 000000000000..2e59a8e15a0b --- /dev/null +++ b/include/asm-ppc64/iSeries/mf.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * mf.h | ||
3 | * Copyright (C) 2001 Troy D. Armstrong IBM Corporation | ||
4 | * Copyright (C) 2004 Stephen Rothwell IBM Corporation | ||
5 | * | ||
6 | * This modules exists as an interface between a Linux secondary partition | ||
7 | * running on an iSeries and the primary partition's Virtual Service | ||
8 | * Processor (VSP) object. The VSP has final authority over powering on/off | ||
9 | * all partitions in the iSeries. It also provides miscellaneous low-level | ||
10 | * machine facility type operations. | ||
11 | * | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
26 | */ | ||
27 | #ifndef _ASM_PPC64_ISERIES_MF_H | ||
28 | #define _ASM_PPC64_ISERIES_MF_H | ||
29 | |||
30 | #include <linux/types.h> | ||
31 | |||
32 | #include <asm/iSeries/HvTypes.h> | ||
33 | #include <asm/iSeries/HvCallEvent.h> | ||
34 | |||
35 | struct rtc_time; | ||
36 | |||
37 | typedef void (*MFCompleteHandler)(void *clientToken, int returnCode); | ||
38 | |||
39 | extern void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, | ||
40 | unsigned size, unsigned amount, MFCompleteHandler hdlr, | ||
41 | void *userToken); | ||
42 | extern void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, | ||
43 | unsigned count, MFCompleteHandler hdlr, void *userToken); | ||
44 | |||
45 | extern void mf_power_off(void); | ||
46 | extern void mf_reboot(void); | ||
47 | |||
48 | extern void mf_display_src(u32 word); | ||
49 | extern void mf_display_progress(u16 value); | ||
50 | extern void mf_clear_src(void); | ||
51 | |||
52 | extern void mf_init(void); | ||
53 | |||
54 | extern int mf_get_rtc(struct rtc_time *tm); | ||
55 | extern int mf_set_rtc(struct rtc_time *tm); | ||
56 | |||
57 | #endif /* _ASM_PPC64_ISERIES_MF_H */ | ||
diff --git a/include/asm-ppc64/iSeries/vio.h b/include/asm-ppc64/iSeries/vio.h new file mode 100644 index 000000000000..3e5766a849d6 --- /dev/null +++ b/include/asm-ppc64/iSeries/vio.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* -*- linux-c -*- | ||
2 | * drivers/char/vio.h | ||
3 | * | ||
4 | * iSeries Virtual I/O Message Path header | ||
5 | * | ||
6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | ||
7 | * Ryan Arnold <ryanarn@us.ibm.com> | ||
8 | * Colin Devilbiss <devilbis@us.ibm.com> | ||
9 | * | ||
10 | * (C) Copyright 2000 IBM Corporation | ||
11 | * | ||
12 | * This header file is used by the iSeries virtual I/O device | ||
13 | * drivers. It defines the interfaces to the common functions | ||
14 | * (implemented in drivers/char/viopath.h) as well as defining | ||
15 | * common functions and structures. Currently (at the time I | ||
16 | * wrote this comment) the iSeries virtual I/O device drivers | ||
17 | * that use this are | ||
18 | * drivers/block/viodasd.c | ||
19 | * drivers/char/viocons.c | ||
20 | * drivers/char/viotape.c | ||
21 | * drivers/cdrom/viocd.c | ||
22 | * | ||
23 | * The iSeries virtual ethernet support (veth.c) uses a whole | ||
24 | * different set of functions. | ||
25 | * | ||
26 | * This program is free software; you can redistribute it and/or | ||
27 | * modify it under the terms of the GNU General Public License as | ||
28 | * published by the Free Software Foundation; either version 2 of the | ||
29 | * License, or (at your option) anyu later version. | ||
30 | * | ||
31 | * This program is distributed in the hope that it will be useful, but | ||
32 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
34 | * General Public License for more details. | ||
35 | * | ||
36 | * You should have received a copy of the GNU General Public License | ||
37 | * along with this program; if not, write to the Free Software Foundation, | ||
38 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
39 | * | ||
40 | */ | ||
41 | #ifndef _ISERIES_VIO_H | ||
42 | #define _ISERIES_VIO_H | ||
43 | |||
44 | #include <asm/iSeries/HvTypes.h> | ||
45 | #include <asm/iSeries/HvLpEvent.h> | ||
46 | |||
47 | /* iSeries virtual I/O events use the subtype field in | ||
48 | * HvLpEvent to figure out what kind of vio event is coming | ||
49 | * in. We use a table to route these, and this defines | ||
50 | * the maximum number of distinct subtypes | ||
51 | */ | ||
52 | #define VIO_MAX_SUBTYPES 8 | ||
53 | |||
54 | /* Each subtype can register a handler to process their events. | ||
55 | * The handler must have this interface. | ||
56 | */ | ||
57 | typedef void (vio_event_handler_t) (struct HvLpEvent * event); | ||
58 | |||
59 | int viopath_open(HvLpIndex remoteLp, int subtype, int numReq); | ||
60 | int viopath_close(HvLpIndex remoteLp, int subtype, int numReq); | ||
61 | int vio_setHandler(int subtype, vio_event_handler_t * beh); | ||
62 | int vio_clearHandler(int subtype); | ||
63 | int viopath_isactive(HvLpIndex lp); | ||
64 | HvLpInstanceId viopath_sourceinst(HvLpIndex lp); | ||
65 | HvLpInstanceId viopath_targetinst(HvLpIndex lp); | ||
66 | void vio_set_hostlp(void); | ||
67 | void *vio_get_event_buffer(int subtype); | ||
68 | void vio_free_event_buffer(int subtype, void *buffer); | ||
69 | |||
70 | extern HvLpIndex viopath_hostLp; | ||
71 | extern HvLpIndex viopath_ourLp; | ||
72 | |||
73 | #define VIOCHAR_MAX_DATA 200 | ||
74 | |||
75 | #define VIOMAJOR_SUBTYPE_MASK 0xff00 | ||
76 | #define VIOMINOR_SUBTYPE_MASK 0x00ff | ||
77 | #define VIOMAJOR_SUBTYPE_SHIFT 8 | ||
78 | |||
79 | #define VIOVERSION 0x0101 | ||
80 | |||
81 | /* | ||
82 | * This is the general structure for VIO errors; each module should have | ||
83 | * a table of them, and each table should be terminated by an entry of | ||
84 | * { 0, 0, NULL }. Then, to find a specific error message, a module | ||
85 | * should pass its local table and the return code. | ||
86 | */ | ||
87 | struct vio_error_entry { | ||
88 | u16 rc; | ||
89 | int errno; | ||
90 | const char *msg; | ||
91 | }; | ||
92 | const struct vio_error_entry *vio_lookup_rc(const struct vio_error_entry | ||
93 | *local_table, u16 rc); | ||
94 | |||
95 | enum viosubtypes { | ||
96 | viomajorsubtype_monitor = 0x0100, | ||
97 | viomajorsubtype_blockio = 0x0200, | ||
98 | viomajorsubtype_chario = 0x0300, | ||
99 | viomajorsubtype_config = 0x0400, | ||
100 | viomajorsubtype_cdio = 0x0500, | ||
101 | viomajorsubtype_tape = 0x0600, | ||
102 | viomajorsubtype_scsi = 0x0700 | ||
103 | }; | ||
104 | |||
105 | |||
106 | enum vioconfigsubtype { | ||
107 | vioconfigget = 0x0001, | ||
108 | }; | ||
109 | |||
110 | enum viorc { | ||
111 | viorc_good = 0x0000, | ||
112 | viorc_noConnection = 0x0001, | ||
113 | viorc_noReceiver = 0x0002, | ||
114 | viorc_noBufferAvailable = 0x0003, | ||
115 | viorc_invalidMessageType = 0x0004, | ||
116 | viorc_invalidRange = 0x0201, | ||
117 | viorc_invalidToken = 0x0202, | ||
118 | viorc_DMAError = 0x0203, | ||
119 | viorc_useError = 0x0204, | ||
120 | viorc_releaseError = 0x0205, | ||
121 | viorc_invalidDisk = 0x0206, | ||
122 | viorc_openRejected = 0x0301 | ||
123 | }; | ||
124 | |||
125 | struct device; | ||
126 | |||
127 | extern struct device *iSeries_vio_dev; | ||
128 | |||
129 | #endif /* _ISERIES_VIO_H */ | ||
diff --git a/include/asm-ppc64/ide.h b/include/asm-ppc64/ide.h new file mode 100644 index 000000000000..0aae1c590c0e --- /dev/null +++ b/include/asm-ppc64/ide.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * linux/include/asm-ppc/ide.h | ||
3 | * | ||
4 | * Copyright (C) 1994-1996 Linus Torvalds & authors | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * This file contains the ppc64 architecture specific IDE code. | ||
14 | */ | ||
15 | |||
16 | #ifndef __ASMPPC64_IDE_H | ||
17 | #define __ASMPPC64_IDE_H | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | |||
21 | #ifndef MAX_HWIFS | ||
22 | # define MAX_HWIFS 10 | ||
23 | #endif | ||
24 | |||
25 | #define IDE_ARCH_OBSOLETE_INIT | ||
26 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
27 | |||
28 | #endif /* __KERNEL__ */ | ||
29 | |||
30 | #endif /* __ASMPPC64_IDE_H */ | ||
diff --git a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h new file mode 100644 index 000000000000..aba1dfa388ba --- /dev/null +++ b/include/asm-ppc64/io.h | |||
@@ -0,0 +1,458 @@ | |||
1 | #ifndef _PPC64_IO_H | ||
2 | #define _PPC64_IO_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/compiler.h> | ||
13 | #include <asm/page.h> | ||
14 | #include <asm/byteorder.h> | ||
15 | #ifdef CONFIG_PPC_ISERIES | ||
16 | #include <asm/iSeries/iSeries_io.h> | ||
17 | #endif | ||
18 | #include <asm/memory.h> | ||
19 | #include <asm/delay.h> | ||
20 | |||
21 | #include <asm-generic/iomap.h> | ||
22 | |||
23 | #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 *)(p), (a), (c)) | ||
24 | #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 *)(p), (a), (c)) | ||
25 | #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 *)(p), (a), (c)) | ||
26 | #define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 *)(p), (a), (c)) | ||
27 | |||
28 | |||
29 | #define SIO_CONFIG_RA 0x398 | ||
30 | #define SIO_CONFIG_RD 0x399 | ||
31 | |||
32 | #define SLOW_DOWN_IO | ||
33 | |||
34 | extern unsigned long isa_io_base; | ||
35 | extern unsigned long pci_io_base; | ||
36 | extern unsigned long io_page_mask; | ||
37 | |||
38 | #define MAX_ISA_PORT 0x10000 | ||
39 | |||
40 | #define _IO_IS_VALID(port) ((port) >= MAX_ISA_PORT || (1 << (port>>PAGE_SHIFT)) \ | ||
41 | & io_page_mask) | ||
42 | |||
43 | #ifdef CONFIG_PPC_ISERIES | ||
44 | /* __raw_* accessors aren't supported on iSeries */ | ||
45 | #define __raw_readb(addr) { BUG(); 0; } | ||
46 | #define __raw_readw(addr) { BUG(); 0; } | ||
47 | #define __raw_readl(addr) { BUG(); 0; } | ||
48 | #define __raw_readq(addr) { BUG(); 0; } | ||
49 | #define __raw_writeb(v, addr) { BUG(); 0; } | ||
50 | #define __raw_writew(v, addr) { BUG(); 0; } | ||
51 | #define __raw_writel(v, addr) { BUG(); 0; } | ||
52 | #define __raw_writeq(v, addr) { BUG(); 0; } | ||
53 | #define readb(addr) iSeries_Read_Byte(addr) | ||
54 | #define readw(addr) iSeries_Read_Word(addr) | ||
55 | #define readl(addr) iSeries_Read_Long(addr) | ||
56 | #define writeb(data, addr) iSeries_Write_Byte((data),(addr)) | ||
57 | #define writew(data, addr) iSeries_Write_Word((data),(addr)) | ||
58 | #define writel(data, addr) iSeries_Write_Long((data),(addr)) | ||
59 | #define memset_io(a,b,c) iSeries_memset_io((a),(b),(c)) | ||
60 | #define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c)) | ||
61 | #define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c)) | ||
62 | |||
63 | #define inb(addr) readb(((void __iomem *)(long)(addr))) | ||
64 | #define inw(addr) readw(((void __iomem *)(long)(addr))) | ||
65 | #define inl(addr) readl(((void __iomem *)(long)(addr))) | ||
66 | #define outb(data,addr) writeb(data,((void __iomem *)(long)(addr))) | ||
67 | #define outw(data,addr) writew(data,((void __iomem *)(long)(addr))) | ||
68 | #define outl(data,addr) writel(data,((void __iomem *)(long)(addr))) | ||
69 | /* | ||
70 | * The *_ns versions below don't do byte-swapping. | ||
71 | * Neither do the standard versions now, these are just here | ||
72 | * for older code. | ||
73 | */ | ||
74 | #define insw_ns(port, buf, ns) _insw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) | ||
75 | #define insl_ns(port, buf, nl) _insl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) | ||
76 | #else | ||
77 | |||
78 | static inline unsigned char __raw_readb(const volatile void __iomem *addr) | ||
79 | { | ||
80 | return *(volatile unsigned char __force *)addr; | ||
81 | } | ||
82 | static inline unsigned short __raw_readw(const volatile void __iomem *addr) | ||
83 | { | ||
84 | return *(volatile unsigned short __force *)addr; | ||
85 | } | ||
86 | static inline unsigned int __raw_readl(const volatile void __iomem *addr) | ||
87 | { | ||
88 | return *(volatile unsigned int __force *)addr; | ||
89 | } | ||
90 | static inline unsigned long __raw_readq(const volatile void __iomem *addr) | ||
91 | { | ||
92 | return *(volatile unsigned long __force *)addr; | ||
93 | } | ||
94 | static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr) | ||
95 | { | ||
96 | *(volatile unsigned char __force *)addr = v; | ||
97 | } | ||
98 | static inline void __raw_writew(unsigned short v, volatile void __iomem *addr) | ||
99 | { | ||
100 | *(volatile unsigned short __force *)addr = v; | ||
101 | } | ||
102 | static inline void __raw_writel(unsigned int v, volatile void __iomem *addr) | ||
103 | { | ||
104 | *(volatile unsigned int __force *)addr = v; | ||
105 | } | ||
106 | static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) | ||
107 | { | ||
108 | *(volatile unsigned long __force *)addr = v; | ||
109 | } | ||
110 | #define readb(addr) eeh_readb(addr) | ||
111 | #define readw(addr) eeh_readw(addr) | ||
112 | #define readl(addr) eeh_readl(addr) | ||
113 | #define readq(addr) eeh_readq(addr) | ||
114 | #define writeb(data, addr) eeh_writeb((data), (addr)) | ||
115 | #define writew(data, addr) eeh_writew((data), (addr)) | ||
116 | #define writel(data, addr) eeh_writel((data), (addr)) | ||
117 | #define writeq(data, addr) eeh_writeq((data), (addr)) | ||
118 | #define memset_io(a,b,c) eeh_memset_io((a),(b),(c)) | ||
119 | #define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c)) | ||
120 | #define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c)) | ||
121 | #define inb(port) eeh_inb((unsigned long)port) | ||
122 | #define outb(val, port) eeh_outb(val, (unsigned long)port) | ||
123 | #define inw(port) eeh_inw((unsigned long)port) | ||
124 | #define outw(val, port) eeh_outw(val, (unsigned long)port) | ||
125 | #define inl(port) eeh_inl((unsigned long)port) | ||
126 | #define outl(val, port) eeh_outl(val, (unsigned long)port) | ||
127 | |||
128 | /* | ||
129 | * The insw/outsw/insl/outsl macros don't do byte-swapping. | ||
130 | * They are only used in practice for transferring buffers which | ||
131 | * are arrays of bytes, and byte-swapping is not appropriate in | ||
132 | * that case. - paulus */ | ||
133 | #define insb(port, buf, ns) eeh_insb((port), (buf), (ns)) | ||
134 | #define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) | ||
135 | #define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) | ||
136 | #define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) | ||
137 | #define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) | ||
138 | |||
139 | #define outsb(port, buf, ns) _outsb((u8 *)((port)+pci_io_base), (buf), (ns)) | ||
140 | #define outsw(port, buf, ns) _outsw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) | ||
141 | #define outsl(port, buf, nl) _outsl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) | ||
142 | |||
143 | #endif | ||
144 | |||
145 | #define readb_relaxed(addr) readb(addr) | ||
146 | #define readw_relaxed(addr) readw(addr) | ||
147 | #define readl_relaxed(addr) readl(addr) | ||
148 | #define readq_relaxed(addr) readq(addr) | ||
149 | |||
150 | extern void _insb(volatile u8 *port, void *buf, int ns); | ||
151 | extern void _outsb(volatile u8 *port, const void *buf, int ns); | ||
152 | extern void _insw(volatile u16 *port, void *buf, int ns); | ||
153 | extern void _outsw(volatile u16 *port, const void *buf, int ns); | ||
154 | extern void _insl(volatile u32 *port, void *buf, int nl); | ||
155 | extern void _outsl(volatile u32 *port, const void *buf, int nl); | ||
156 | extern void _insw_ns(volatile u16 *port, void *buf, int ns); | ||
157 | extern void _outsw_ns(volatile u16 *port, const void *buf, int ns); | ||
158 | extern void _insl_ns(volatile u32 *port, void *buf, int nl); | ||
159 | extern void _outsl_ns(volatile u32 *port, const void *buf, int nl); | ||
160 | |||
161 | #define mmiowb() | ||
162 | |||
163 | /* | ||
164 | * output pause versions need a delay at least for the | ||
165 | * w83c105 ide controller in a p610. | ||
166 | */ | ||
167 | #define inb_p(port) inb(port) | ||
168 | #define outb_p(val, port) (udelay(1), outb((val), (port))) | ||
169 | #define inw_p(port) inw(port) | ||
170 | #define outw_p(val, port) (udelay(1), outw((val), (port))) | ||
171 | #define inl_p(port) inl(port) | ||
172 | #define outl_p(val, port) (udelay(1), outl((val), (port))) | ||
173 | |||
174 | /* | ||
175 | * The *_ns versions below don't do byte-swapping. | ||
176 | * Neither do the standard versions now, these are just here | ||
177 | * for older code. | ||
178 | */ | ||
179 | #define outsw_ns(port, buf, ns) _outsw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) | ||
180 | #define outsl_ns(port, buf, nl) _outsl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) | ||
181 | |||
182 | |||
183 | #define IO_SPACE_LIMIT ~(0UL) | ||
184 | |||
185 | |||
186 | #ifdef __KERNEL__ | ||
187 | extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr, | ||
188 | unsigned long size, unsigned long flags); | ||
189 | extern void __iomem *__ioremap(unsigned long address, unsigned long size, | ||
190 | unsigned long flags); | ||
191 | |||
192 | /** | ||
193 | * ioremap - map bus memory into CPU space | ||
194 | * @address: bus address of the memory | ||
195 | * @size: size of the resource to map | ||
196 | * | ||
197 | * ioremap performs a platform specific sequence of operations to | ||
198 | * make bus memory CPU accessible via the readb/readw/readl/writeb/ | ||
199 | * writew/writel functions and the other mmio helpers. The returned | ||
200 | * address is not guaranteed to be usable directly as a virtual | ||
201 | * address. | ||
202 | */ | ||
203 | extern void __iomem *ioremap(unsigned long address, unsigned long size); | ||
204 | |||
205 | #define ioremap_nocache(addr, size) ioremap((addr), (size)) | ||
206 | extern int iounmap_explicit(volatile void __iomem *addr, unsigned long size); | ||
207 | extern void iounmap(volatile void __iomem *addr); | ||
208 | extern void __iomem * reserve_phb_iospace(unsigned long size); | ||
209 | |||
210 | /** | ||
211 | * virt_to_phys - map virtual addresses to physical | ||
212 | * @address: address to remap | ||
213 | * | ||
214 | * The returned physical address is the physical (CPU) mapping for | ||
215 | * the memory address given. It is only valid to use this function on | ||
216 | * addresses directly mapped or allocated via kmalloc. | ||
217 | * | ||
218 | * This function does not give bus mappings for DMA transfers. In | ||
219 | * almost all conceivable cases a device driver should not be using | ||
220 | * this function | ||
221 | */ | ||
222 | static inline unsigned long virt_to_phys(volatile void * address) | ||
223 | { | ||
224 | return __pa((unsigned long)address); | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * phys_to_virt - map physical address to virtual | ||
229 | * @address: address to remap | ||
230 | * | ||
231 | * The returned virtual address is a current CPU mapping for | ||
232 | * the memory address given. It is only valid to use this function on | ||
233 | * addresses that have a kernel mapping | ||
234 | * | ||
235 | * This function does not handle bus mappings for DMA transfers. In | ||
236 | * almost all conceivable cases a device driver should not be using | ||
237 | * this function | ||
238 | */ | ||
239 | static inline void * phys_to_virt(unsigned long address) | ||
240 | { | ||
241 | return (void *)__va(address); | ||
242 | } | ||
243 | |||
244 | /* | ||
245 | * Change "struct page" to physical address. | ||
246 | */ | ||
247 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
248 | |||
249 | /* We do NOT want virtual merging, it would put too much pressure on | ||
250 | * our iommu allocator. Instead, we want drivers to be smart enough | ||
251 | * to coalesce sglists that happen to have been mapped in a contiguous | ||
252 | * way by the iommu | ||
253 | */ | ||
254 | #define BIO_VMERGE_BOUNDARY 0 | ||
255 | |||
256 | #endif /* __KERNEL__ */ | ||
257 | |||
258 | static inline void iosync(void) | ||
259 | { | ||
260 | __asm__ __volatile__ ("sync" : : : "memory"); | ||
261 | } | ||
262 | |||
263 | /* Enforce in-order execution of data I/O. | ||
264 | * No distinction between read/write on PPC; use eieio for all three. | ||
265 | */ | ||
266 | #define iobarrier_rw() eieio() | ||
267 | #define iobarrier_r() eieio() | ||
268 | #define iobarrier_w() eieio() | ||
269 | |||
270 | /* | ||
271 | * 8, 16 and 32 bit, big and little endian I/O operations, with barrier. | ||
272 | * These routines do not perform EEH-related I/O address translation, | ||
273 | * and should not be used directly by device drivers. Use inb/readb | ||
274 | * instead. | ||
275 | */ | ||
276 | static inline int in_8(const volatile unsigned char __iomem *addr) | ||
277 | { | ||
278 | int ret; | ||
279 | |||
280 | __asm__ __volatile__("lbz%U1%X1 %0,%1; twi 0,%0,0; isync" | ||
281 | : "=r" (ret) : "m" (*addr)); | ||
282 | return ret; | ||
283 | } | ||
284 | |||
285 | static inline void out_8(volatile unsigned char __iomem *addr, int val) | ||
286 | { | ||
287 | __asm__ __volatile__("stb%U0%X0 %1,%0; sync" | ||
288 | : "=m" (*addr) : "r" (val)); | ||
289 | } | ||
290 | |||
291 | static inline int in_le16(const volatile unsigned short __iomem *addr) | ||
292 | { | ||
293 | int ret; | ||
294 | |||
295 | __asm__ __volatile__("lhbrx %0,0,%1; twi 0,%0,0; isync" | ||
296 | : "=r" (ret) : "r" (addr), "m" (*addr)); | ||
297 | return ret; | ||
298 | } | ||
299 | |||
300 | static inline int in_be16(const volatile unsigned short __iomem *addr) | ||
301 | { | ||
302 | int ret; | ||
303 | |||
304 | __asm__ __volatile__("lhz%U1%X1 %0,%1; twi 0,%0,0; isync" | ||
305 | : "=r" (ret) : "m" (*addr)); | ||
306 | return ret; | ||
307 | } | ||
308 | |||
309 | static inline void out_le16(volatile unsigned short __iomem *addr, int val) | ||
310 | { | ||
311 | __asm__ __volatile__("sthbrx %1,0,%2; sync" | ||
312 | : "=m" (*addr) : "r" (val), "r" (addr)); | ||
313 | } | ||
314 | |||
315 | static inline void out_be16(volatile unsigned short __iomem *addr, int val) | ||
316 | { | ||
317 | __asm__ __volatile__("sth%U0%X0 %1,%0; sync" | ||
318 | : "=m" (*addr) : "r" (val)); | ||
319 | } | ||
320 | |||
321 | static inline unsigned in_le32(const volatile unsigned __iomem *addr) | ||
322 | { | ||
323 | unsigned ret; | ||
324 | |||
325 | __asm__ __volatile__("lwbrx %0,0,%1; twi 0,%0,0; isync" | ||
326 | : "=r" (ret) : "r" (addr), "m" (*addr)); | ||
327 | return ret; | ||
328 | } | ||
329 | |||
330 | static inline unsigned in_be32(const volatile unsigned __iomem *addr) | ||
331 | { | ||
332 | unsigned ret; | ||
333 | |||
334 | __asm__ __volatile__("lwz%U1%X1 %0,%1; twi 0,%0,0; isync" | ||
335 | : "=r" (ret) : "m" (*addr)); | ||
336 | return ret; | ||
337 | } | ||
338 | |||
339 | static inline void out_le32(volatile unsigned __iomem *addr, int val) | ||
340 | { | ||
341 | __asm__ __volatile__("stwbrx %1,0,%2; sync" : "=m" (*addr) | ||
342 | : "r" (val), "r" (addr)); | ||
343 | } | ||
344 | |||
345 | static inline void out_be32(volatile unsigned __iomem *addr, int val) | ||
346 | { | ||
347 | __asm__ __volatile__("stw%U0%X0 %1,%0; sync" | ||
348 | : "=m" (*addr) : "r" (val)); | ||
349 | } | ||
350 | |||
351 | static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) | ||
352 | { | ||
353 | unsigned long tmp, ret; | ||
354 | |||
355 | __asm__ __volatile__( | ||
356 | "ld %1,0(%2)\n" | ||
357 | "twi 0,%1,0\n" | ||
358 | "isync\n" | ||
359 | "rldimi %0,%1,5*8,1*8\n" | ||
360 | "rldimi %0,%1,3*8,2*8\n" | ||
361 | "rldimi %0,%1,1*8,3*8\n" | ||
362 | "rldimi %0,%1,7*8,4*8\n" | ||
363 | "rldicl %1,%1,32,0\n" | ||
364 | "rlwimi %0,%1,8,8,31\n" | ||
365 | "rlwimi %0,%1,24,16,23\n" | ||
366 | : "=r" (ret) , "=r" (tmp) : "b" (addr) , "m" (*addr)); | ||
367 | return ret; | ||
368 | } | ||
369 | |||
370 | static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) | ||
371 | { | ||
372 | unsigned long ret; | ||
373 | |||
374 | __asm__ __volatile__("ld%U1%X1 %0,%1; twi 0,%0,0; isync" | ||
375 | : "=r" (ret) : "m" (*addr)); | ||
376 | return ret; | ||
377 | } | ||
378 | |||
379 | static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val) | ||
380 | { | ||
381 | unsigned long tmp; | ||
382 | |||
383 | __asm__ __volatile__( | ||
384 | "rldimi %0,%1,5*8,1*8\n" | ||
385 | "rldimi %0,%1,3*8,2*8\n" | ||
386 | "rldimi %0,%1,1*8,3*8\n" | ||
387 | "rldimi %0,%1,7*8,4*8\n" | ||
388 | "rldicl %1,%1,32,0\n" | ||
389 | "rlwimi %0,%1,8,8,31\n" | ||
390 | "rlwimi %0,%1,24,16,23\n" | ||
391 | "std %0,0(%3)\n" | ||
392 | "sync" | ||
393 | : "=&r" (tmp) , "=&r" (val) : "1" (val) , "b" (addr) , "m" (*addr)); | ||
394 | } | ||
395 | |||
396 | static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val) | ||
397 | { | ||
398 | __asm__ __volatile__("std%U0%X0 %1,%0; sync" : "=m" (*addr) : "r" (val)); | ||
399 | } | ||
400 | |||
401 | #ifndef CONFIG_PPC_ISERIES | ||
402 | #include <asm/eeh.h> | ||
403 | #endif | ||
404 | |||
405 | #ifdef __KERNEL__ | ||
406 | |||
407 | /** | ||
408 | * check_signature - find BIOS signatures | ||
409 | * @io_addr: mmio address to check | ||
410 | * @signature: signature block | ||
411 | * @length: length of signature | ||
412 | * | ||
413 | * Perform a signature comparison with the mmio address io_addr. This | ||
414 | * address should have been obtained by ioremap. | ||
415 | * Returns 1 on a match. | ||
416 | */ | ||
417 | static inline int check_signature(const volatile void __iomem * io_addr, | ||
418 | const unsigned char *signature, int length) | ||
419 | { | ||
420 | int retval = 0; | ||
421 | #ifndef CONFIG_PPC_ISERIES | ||
422 | do { | ||
423 | if (readb(io_addr) != *signature) | ||
424 | goto out; | ||
425 | io_addr++; | ||
426 | signature++; | ||
427 | length--; | ||
428 | } while (length); | ||
429 | retval = 1; | ||
430 | out: | ||
431 | #endif | ||
432 | return retval; | ||
433 | } | ||
434 | |||
435 | /* Nothing to do */ | ||
436 | |||
437 | #define dma_cache_inv(_start,_size) do { } while (0) | ||
438 | #define dma_cache_wback(_start,_size) do { } while (0) | ||
439 | #define dma_cache_wback_inv(_start,_size) do { } while (0) | ||
440 | |||
441 | /* Check of existence of legacy devices */ | ||
442 | extern int check_legacy_ioport(unsigned long base_port); | ||
443 | |||
444 | |||
445 | /* | ||
446 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
447 | * access | ||
448 | */ | ||
449 | #define xlate_dev_mem_ptr(p) __va(p) | ||
450 | |||
451 | /* | ||
452 | * Convert a virtual cached pointer to an uncached pointer | ||
453 | */ | ||
454 | #define xlate_dev_kmem_ptr(p) p | ||
455 | |||
456 | #endif /* __KERNEL__ */ | ||
457 | |||
458 | #endif /* _PPC64_IO_H */ | ||
diff --git a/include/asm-ppc64/ioctl.h b/include/asm-ppc64/ioctl.h new file mode 100644 index 000000000000..42b8c5da7fbc --- /dev/null +++ b/include/asm-ppc64/ioctl.h | |||
@@ -0,0 +1,74 @@ | |||
1 | #ifndef _PPC64_IOCTL_H | ||
2 | #define _PPC64_IOCTL_H | ||
3 | |||
4 | |||
5 | /* | ||
6 | * This was copied from the alpha as it's a bit cleaner there. | ||
7 | * -- Cort | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #define _IOC_NRBITS 8 | ||
16 | #define _IOC_TYPEBITS 8 | ||
17 | #define _IOC_SIZEBITS 13 | ||
18 | #define _IOC_DIRBITS 3 | ||
19 | |||
20 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
21 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
22 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
23 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
24 | |||
25 | #define _IOC_NRSHIFT 0 | ||
26 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
27 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
28 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
29 | |||
30 | /* | ||
31 | * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. | ||
32 | * And this turns out useful to catch old ioctl numbers in header | ||
33 | * files for us. | ||
34 | */ | ||
35 | #define _IOC_NONE 1U | ||
36 | #define _IOC_READ 2U | ||
37 | #define _IOC_WRITE 4U | ||
38 | |||
39 | #define _IOC(dir,type,nr,size) \ | ||
40 | (((dir) << _IOC_DIRSHIFT) | \ | ||
41 | ((type) << _IOC_TYPESHIFT) | \ | ||
42 | ((nr) << _IOC_NRSHIFT) | \ | ||
43 | ((size) << _IOC_SIZESHIFT)) | ||
44 | |||
45 | /* provoke compile error for invalid uses of size argument */ | ||
46 | extern unsigned int __invalid_size_argument_for_IOC; | ||
47 | #define _IOC_TYPECHECK(t) \ | ||
48 | ((sizeof(t) == sizeof(t[1]) && \ | ||
49 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
50 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
51 | |||
52 | /* used to create numbers */ | ||
53 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
54 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
55 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
56 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
57 | #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
58 | #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
60 | |||
61 | /* used to decode them.. */ | ||
62 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
63 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
64 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
65 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
66 | |||
67 | /* various drivers, such as the pcmcia stuff, need these... */ | ||
68 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
69 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
70 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
71 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
72 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
73 | |||
74 | #endif /* _PPC64_IOCTL_H */ | ||
diff --git a/include/asm-ppc64/ioctls.h b/include/asm-ppc64/ioctls.h new file mode 100644 index 000000000000..48796bf3e4fc --- /dev/null +++ b/include/asm-ppc64/ioctls.h | |||
@@ -0,0 +1,114 @@ | |||
1 | #ifndef _ASM_PPC64_IOCTLS_H | ||
2 | #define _ASM_PPC64_IOCTLS_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <asm/ioctl.h> | ||
12 | |||
13 | #define FIOCLEX _IO('f', 1) | ||
14 | #define FIONCLEX _IO('f', 2) | ||
15 | #define FIOASYNC _IOW('f', 125, int) | ||
16 | #define FIONBIO _IOW('f', 126, int) | ||
17 | #define FIONREAD _IOR('f', 127, int) | ||
18 | #define TIOCINQ FIONREAD | ||
19 | #define FIOQSIZE _IOR('f', 128, loff_t) | ||
20 | |||
21 | #define TIOCGETP _IOR('t', 8, struct sgttyb) | ||
22 | #define TIOCSETP _IOW('t', 9, struct sgttyb) | ||
23 | #define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ | ||
24 | |||
25 | #define TIOCSETC _IOW('t', 17, struct tchars) | ||
26 | #define TIOCGETC _IOR('t', 18, struct tchars) | ||
27 | #define TCGETS _IOR('t', 19, struct termios) | ||
28 | #define TCSETS _IOW('t', 20, struct termios) | ||
29 | #define TCSETSW _IOW('t', 21, struct termios) | ||
30 | #define TCSETSF _IOW('t', 22, struct termios) | ||
31 | |||
32 | #define TCGETA _IOR('t', 23, struct termio) | ||
33 | #define TCSETA _IOW('t', 24, struct termio) | ||
34 | #define TCSETAW _IOW('t', 25, struct termio) | ||
35 | #define TCSETAF _IOW('t', 28, struct termio) | ||
36 | |||
37 | #define TCSBRK _IO('t', 29) | ||
38 | #define TCXONC _IO('t', 30) | ||
39 | #define TCFLSH _IO('t', 31) | ||
40 | |||
41 | #define TIOCSWINSZ _IOW('t', 103, struct winsize) | ||
42 | #define TIOCGWINSZ _IOR('t', 104, struct winsize) | ||
43 | #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ | ||
44 | #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ | ||
45 | #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ | ||
46 | |||
47 | #define TIOCGLTC _IOR('t', 116, struct ltchars) | ||
48 | #define TIOCSLTC _IOW('t', 117, struct ltchars) | ||
49 | #define TIOCSPGRP _IOW('t', 118, int) | ||
50 | #define TIOCGPGRP _IOR('t', 119, int) | ||
51 | |||
52 | #define TIOCEXCL 0x540C | ||
53 | #define TIOCNXCL 0x540D | ||
54 | #define TIOCSCTTY 0x540E | ||
55 | |||
56 | #define TIOCSTI 0x5412 | ||
57 | #define TIOCMGET 0x5415 | ||
58 | #define TIOCMBIS 0x5416 | ||
59 | #define TIOCMBIC 0x5417 | ||
60 | #define TIOCMSET 0x5418 | ||
61 | # define TIOCM_LE 0x001 | ||
62 | # define TIOCM_DTR 0x002 | ||
63 | # define TIOCM_RTS 0x004 | ||
64 | # define TIOCM_ST 0x008 | ||
65 | # define TIOCM_SR 0x010 | ||
66 | # define TIOCM_CTS 0x020 | ||
67 | # define TIOCM_CAR 0x040 | ||
68 | # define TIOCM_RNG 0x080 | ||
69 | # define TIOCM_DSR 0x100 | ||
70 | # define TIOCM_CD TIOCM_CAR | ||
71 | # define TIOCM_RI TIOCM_RNG | ||
72 | |||
73 | #define TIOCGSOFTCAR 0x5419 | ||
74 | #define TIOCSSOFTCAR 0x541A | ||
75 | #define TIOCLINUX 0x541C | ||
76 | #define TIOCCONS 0x541D | ||
77 | #define TIOCGSERIAL 0x541E | ||
78 | #define TIOCSSERIAL 0x541F | ||
79 | #define TIOCPKT 0x5420 | ||
80 | # define TIOCPKT_DATA 0 | ||
81 | # define TIOCPKT_FLUSHREAD 1 | ||
82 | # define TIOCPKT_FLUSHWRITE 2 | ||
83 | # define TIOCPKT_STOP 4 | ||
84 | # define TIOCPKT_START 8 | ||
85 | # define TIOCPKT_NOSTOP 16 | ||
86 | # define TIOCPKT_DOSTOP 32 | ||
87 | |||
88 | |||
89 | #define TIOCNOTTY 0x5422 | ||
90 | #define TIOCSETD 0x5423 | ||
91 | #define TIOCGETD 0x5424 | ||
92 | #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ | ||
93 | #define TIOCSBRK 0x5427 /* BSD compatibility */ | ||
94 | #define TIOCCBRK 0x5428 /* BSD compatibility */ | ||
95 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ | ||
96 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | ||
97 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | ||
98 | |||
99 | #define TIOCSERCONFIG 0x5453 | ||
100 | #define TIOCSERGWILD 0x5454 | ||
101 | #define TIOCSERSWILD 0x5455 | ||
102 | #define TIOCGLCKTRMIOS 0x5456 | ||
103 | #define TIOCSLCKTRMIOS 0x5457 | ||
104 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
105 | #define TIOCSERGETLSR 0x5459 /* Get line status register */ | ||
106 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
107 | # define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
108 | #define TIOCSERGETMULTI 0x545A /* Get multiport config */ | ||
109 | #define TIOCSERSETMULTI 0x545B /* Set multiport config */ | ||
110 | |||
111 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ | ||
112 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | ||
113 | |||
114 | #endif /* _ASM_PPC64_IOCTLS_H */ | ||
diff --git a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h new file mode 100644 index 000000000000..bd53ca4dcfa2 --- /dev/null +++ b/include/asm-ppc64/iommu.h | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * iommu.h | ||
3 | * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation | ||
4 | * Rewrite, cleanup: | ||
5 | * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef _ASM_IOMMU_H | ||
23 | #define _ASM_IOMMU_H | ||
24 | |||
25 | #include <asm/types.h> | ||
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/dma-mapping.h> | ||
29 | |||
30 | /* | ||
31 | * IOMAP_MAX_ORDER defines the largest contiguous block | ||
32 | * of dma (tce) space we can get. IOMAP_MAX_ORDER = 13 | ||
33 | * allows up to 2**12 pages (4096 * 4096) = 16 MB | ||
34 | */ | ||
35 | #define IOMAP_MAX_ORDER 13 | ||
36 | |||
37 | /* | ||
38 | * Tces come in two formats, one for the virtual bus and a different | ||
39 | * format for PCI | ||
40 | */ | ||
41 | #define TCE_VB 0 | ||
42 | #define TCE_PCI 1 | ||
43 | |||
44 | /* tce_entry | ||
45 | * Used by pSeries (SMP) and iSeries/pSeries LPAR, but there it's | ||
46 | * abstracted so layout is irrelevant. | ||
47 | */ | ||
48 | union tce_entry { | ||
49 | unsigned long te_word; | ||
50 | struct { | ||
51 | unsigned int tb_cacheBits :6; /* Cache hash bits - not used */ | ||
52 | unsigned int tb_rsvd :6; | ||
53 | unsigned long tb_rpn :40; /* Real page number */ | ||
54 | unsigned int tb_valid :1; /* Tce is valid (vb only) */ | ||
55 | unsigned int tb_allio :1; /* Tce is valid for all lps (vb only) */ | ||
56 | unsigned int tb_lpindex :8; /* LpIndex for user of TCE (vb only) */ | ||
57 | unsigned int tb_pciwr :1; /* Write allowed (pci only) */ | ||
58 | unsigned int tb_rdwr :1; /* Read allowed (pci), Write allowed (vb) */ | ||
59 | } te_bits; | ||
60 | #define te_cacheBits te_bits.tb_cacheBits | ||
61 | #define te_rpn te_bits.tb_rpn | ||
62 | #define te_valid te_bits.tb_valid | ||
63 | #define te_allio te_bits.tb_allio | ||
64 | #define te_lpindex te_bits.tb_lpindex | ||
65 | #define te_pciwr te_bits.tb_pciwr | ||
66 | #define te_rdwr te_bits.tb_rdwr | ||
67 | }; | ||
68 | |||
69 | |||
70 | struct iommu_table { | ||
71 | unsigned long it_busno; /* Bus number this table belongs to */ | ||
72 | unsigned long it_size; /* Size of iommu table in entries */ | ||
73 | unsigned long it_offset; /* Offset into global table */ | ||
74 | unsigned long it_base; /* mapped address of tce table */ | ||
75 | unsigned long it_index; /* which iommu table this is */ | ||
76 | unsigned long it_type; /* type: PCI or Virtual Bus */ | ||
77 | unsigned long it_blocksize; /* Entries in each block (cacheline) */ | ||
78 | unsigned long it_hint; /* Hint for next alloc */ | ||
79 | unsigned long it_largehint; /* Hint for large allocs */ | ||
80 | unsigned long it_halfpoint; /* Breaking point for small/large allocs */ | ||
81 | spinlock_t it_lock; /* Protects it_map */ | ||
82 | unsigned long *it_map; /* A simple allocation bitmap for now */ | ||
83 | }; | ||
84 | |||
85 | #ifdef CONFIG_PPC_ISERIES | ||
86 | struct iommu_table_cb { | ||
87 | unsigned long itc_busno; /* Bus number for this tce table */ | ||
88 | unsigned long itc_start; /* Will be NULL for secondary */ | ||
89 | unsigned long itc_totalsize; /* Size (in pages) of whole table */ | ||
90 | unsigned long itc_offset; /* Index into real tce table of the | ||
91 | start of our section */ | ||
92 | unsigned long itc_size; /* Size (in pages) of our section */ | ||
93 | unsigned long itc_index; /* Index of this tce table */ | ||
94 | unsigned short itc_maxtables; /* Max num of tables for partition */ | ||
95 | unsigned char itc_virtbus; /* Flag to indicate virtual bus */ | ||
96 | unsigned char itc_slotno; /* IOA Tce Slot Index */ | ||
97 | unsigned char itc_rsvd[4]; | ||
98 | }; | ||
99 | |||
100 | extern struct iommu_table vio_tce_table; /* Tce table for virtual bus */ | ||
101 | #endif /* CONFIG_PPC_ISERIES */ | ||
102 | |||
103 | struct scatterlist; | ||
104 | |||
105 | #ifdef CONFIG_PPC_MULTIPLATFORM | ||
106 | |||
107 | /* Walks all buses and creates iommu tables */ | ||
108 | extern void iommu_setup_pSeries(void); | ||
109 | extern void iommu_setup_u3(void); | ||
110 | |||
111 | /* Frees table for an individual device node */ | ||
112 | extern void iommu_free_table(struct device_node *dn); | ||
113 | |||
114 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | ||
115 | |||
116 | #ifdef CONFIG_PPC_PSERIES | ||
117 | |||
118 | /* Creates table for an individual device node */ | ||
119 | extern void iommu_devnode_init_pSeries(struct device_node *dn); | ||
120 | |||
121 | #endif /* CONFIG_PPC_PSERIES */ | ||
122 | |||
123 | #ifdef CONFIG_PPC_ISERIES | ||
124 | |||
125 | /* Walks all buses and creates iommu tables */ | ||
126 | extern void iommu_setup_iSeries(void); | ||
127 | |||
128 | /* Initializes tables for bio buses */ | ||
129 | extern void __init iommu_vio_init(void); | ||
130 | |||
131 | struct iSeries_Device_Node; | ||
132 | /* Creates table for an individual device node */ | ||
133 | extern void iommu_devnode_init_iSeries(struct iSeries_Device_Node *dn); | ||
134 | |||
135 | #endif /* CONFIG_PPC_ISERIES */ | ||
136 | |||
137 | /* Initializes an iommu_table based in values set in the passed-in | ||
138 | * structure | ||
139 | */ | ||
140 | extern struct iommu_table *iommu_init_table(struct iommu_table * tbl); | ||
141 | |||
142 | extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, | ||
143 | struct scatterlist *sglist, int nelems, | ||
144 | enum dma_data_direction direction); | ||
145 | extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, | ||
146 | int nelems, enum dma_data_direction direction); | ||
147 | |||
148 | extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, | ||
149 | dma_addr_t *dma_handle, unsigned int __nocast flag); | ||
150 | extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, | ||
151 | void *vaddr, dma_addr_t dma_handle); | ||
152 | extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, | ||
153 | size_t size, enum dma_data_direction direction); | ||
154 | extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, | ||
155 | size_t size, enum dma_data_direction direction); | ||
156 | |||
157 | extern void iommu_init_early_pSeries(void); | ||
158 | extern void iommu_init_early_iSeries(void); | ||
159 | extern void iommu_init_early_u3(void); | ||
160 | |||
161 | extern void pci_iommu_init(void); | ||
162 | extern void pci_direct_iommu_init(void); | ||
163 | |||
164 | extern void alloc_u3_dart_table(void); | ||
165 | |||
166 | #endif /* _ASM_IOMMU_H */ | ||
diff --git a/include/asm-ppc64/ipc.h b/include/asm-ppc64/ipc.h new file mode 100644 index 000000000000..a46e3d9c2a3f --- /dev/null +++ b/include/asm-ppc64/ipc.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/ipc.h> | |||
diff --git a/include/asm-ppc64/ipcbuf.h b/include/asm-ppc64/ipcbuf.h new file mode 100644 index 000000000000..fa393c8342af --- /dev/null +++ b/include/asm-ppc64/ipcbuf.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef __PPC64_IPCBUF_H__ | ||
2 | #define __PPC64_IPCBUF_H__ | ||
3 | |||
4 | /* | ||
5 | * The ipc64_perm structure for the PPC is identical to kern_ipc_perm | ||
6 | * as we have always had 32-bit UIDs and GIDs in the kernel. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | struct ipc64_perm | ||
15 | { | ||
16 | __kernel_key_t key; | ||
17 | __kernel_uid_t uid; | ||
18 | __kernel_gid_t gid; | ||
19 | __kernel_uid_t cuid; | ||
20 | __kernel_gid_t cgid; | ||
21 | __kernel_mode_t mode; | ||
22 | unsigned int seq; | ||
23 | unsigned int __pad1; | ||
24 | unsigned long __unused1; | ||
25 | unsigned long __unused2; | ||
26 | }; | ||
27 | |||
28 | #endif /* __PPC64_IPCBUF_H__ */ | ||
diff --git a/include/asm-ppc64/irq.h b/include/asm-ppc64/irq.h new file mode 100644 index 000000000000..570678b1da95 --- /dev/null +++ b/include/asm-ppc64/irq.h | |||
@@ -0,0 +1,115 @@ | |||
1 | #ifdef __KERNEL__ | ||
2 | #ifndef _ASM_IRQ_H | ||
3 | #define _ASM_IRQ_H | ||
4 | |||
5 | /* | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/threads.h> | ||
14 | |||
15 | /* | ||
16 | * Maximum number of interrupt sources that we can handle. | ||
17 | */ | ||
18 | #define NR_IRQS 512 | ||
19 | |||
20 | /* this number is used when no interrupt has been assigned */ | ||
21 | #define NO_IRQ (-1) | ||
22 | |||
23 | /* | ||
24 | * These constants are used for passing information about interrupt | ||
25 | * signal polarity and level/edge sensing to the low-level PIC chip | ||
26 | * drivers. | ||
27 | */ | ||
28 | #define IRQ_SENSE_MASK 0x1 | ||
29 | #define IRQ_SENSE_LEVEL 0x1 /* interrupt on active level */ | ||
30 | #define IRQ_SENSE_EDGE 0x0 /* interrupt triggered by edge */ | ||
31 | |||
32 | #define IRQ_POLARITY_MASK 0x2 | ||
33 | #define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */ | ||
34 | #define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */ | ||
35 | |||
36 | #define get_irq_desc(irq) (&irq_desc[(irq)]) | ||
37 | |||
38 | /* Define a way to iterate across irqs. */ | ||
39 | #define for_each_irq(i) \ | ||
40 | for ((i) = 0; (i) < NR_IRQS; ++(i)) | ||
41 | |||
42 | /* Interrupt numbers are virtual in case they are sparsely | ||
43 | * distributed by the hardware. | ||
44 | */ | ||
45 | extern unsigned int virt_irq_to_real_map[NR_IRQS]; | ||
46 | |||
47 | /* Create a mapping for a real_irq if it doesn't already exist. | ||
48 | * Return the virtual irq as a convenience. | ||
49 | */ | ||
50 | int virt_irq_create_mapping(unsigned int real_irq); | ||
51 | void virt_irq_init(void); | ||
52 | |||
53 | static inline unsigned int virt_irq_to_real(unsigned int virt_irq) | ||
54 | { | ||
55 | return virt_irq_to_real_map[virt_irq]; | ||
56 | } | ||
57 | |||
58 | extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq); | ||
59 | |||
60 | /* | ||
61 | * Because many systems have two overlapping names spaces for | ||
62 | * interrupts (ISA and XICS for example), and the ISA interrupts | ||
63 | * have historically not been easy to renumber, we allow ISA | ||
64 | * interrupts to take values 0 - 15, and shift up the remaining | ||
65 | * interrupts by 0x10. | ||
66 | */ | ||
67 | #define NUM_ISA_INTERRUPTS 0x10 | ||
68 | extern int __irq_offset_value; | ||
69 | |||
70 | static inline int irq_offset_up(int irq) | ||
71 | { | ||
72 | return(irq + __irq_offset_value); | ||
73 | } | ||
74 | |||
75 | static inline int irq_offset_down(int irq) | ||
76 | { | ||
77 | return(irq - __irq_offset_value); | ||
78 | } | ||
79 | |||
80 | static inline int irq_offset_value(void) | ||
81 | { | ||
82 | return __irq_offset_value; | ||
83 | } | ||
84 | |||
85 | static __inline__ int irq_canonicalize(int irq) | ||
86 | { | ||
87 | return irq; | ||
88 | } | ||
89 | |||
90 | extern int distribute_irqs; | ||
91 | |||
92 | struct irqaction; | ||
93 | struct pt_regs; | ||
94 | |||
95 | #ifdef CONFIG_IRQSTACKS | ||
96 | /* | ||
97 | * Per-cpu stacks for handling hard and soft interrupts. | ||
98 | */ | ||
99 | extern struct thread_info *hardirq_ctx[NR_CPUS]; | ||
100 | extern struct thread_info *softirq_ctx[NR_CPUS]; | ||
101 | |||
102 | extern void irq_ctx_init(void); | ||
103 | extern void call_do_softirq(struct thread_info *tp); | ||
104 | extern int call_handle_IRQ_event(int irq, struct pt_regs *regs, | ||
105 | struct irqaction *action, struct thread_info *tp); | ||
106 | |||
107 | #define __ARCH_HAS_DO_SOFTIRQ | ||
108 | |||
109 | #else | ||
110 | #define irq_ctx_init() | ||
111 | |||
112 | #endif /* CONFIG_IRQSTACKS */ | ||
113 | |||
114 | #endif /* _ASM_IRQ_H */ | ||
115 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc64/kdebug.h b/include/asm-ppc64/kdebug.h new file mode 100644 index 000000000000..488634258a72 --- /dev/null +++ b/include/asm-ppc64/kdebug.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef _PPC64_KDEBUG_H | ||
2 | #define _PPC64_KDEBUG_H 1 | ||
3 | |||
4 | /* nearly identical to x86_64/i386 code */ | ||
5 | |||
6 | #include <linux/notifier.h> | ||
7 | |||
8 | struct pt_regs; | ||
9 | |||
10 | struct die_args { | ||
11 | struct pt_regs *regs; | ||
12 | const char *str; | ||
13 | long err; | ||
14 | int trapnr; | ||
15 | int signr; | ||
16 | }; | ||
17 | |||
18 | /* | ||
19 | Note - you should never unregister because that can race with NMIs. | ||
20 | If you really want to do it first unregister - then synchronize_kernel - | ||
21 | then free. | ||
22 | */ | ||
23 | int register_die_notifier(struct notifier_block *nb); | ||
24 | extern struct notifier_block *ppc64_die_chain; | ||
25 | |||
26 | /* Grossly misnamed. */ | ||
27 | enum die_val { | ||
28 | DIE_OOPS = 1, | ||
29 | DIE_IABR_MATCH, | ||
30 | DIE_DABR_MATCH, | ||
31 | DIE_BPT, | ||
32 | DIE_SSTEP, | ||
33 | DIE_GPF, | ||
34 | DIE_PAGE_FAULT, | ||
35 | }; | ||
36 | |||
37 | static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig) | ||
38 | { | ||
39 | struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig }; | ||
40 | return notifier_call_chain(&ppc64_die_chain, val, &args); | ||
41 | } | ||
42 | |||
43 | #endif | ||
diff --git a/include/asm-ppc64/keylargo.h b/include/asm-ppc64/keylargo.h new file mode 100644 index 000000000000..4d78e3d0314c --- /dev/null +++ b/include/asm-ppc64/keylargo.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <asm-ppc/keylargo.h> | ||
2 | |||
diff --git a/include/asm-ppc64/kmap_types.h b/include/asm-ppc64/kmap_types.h new file mode 100644 index 000000000000..fd1574648223 --- /dev/null +++ b/include/asm-ppc64/kmap_types.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifdef __KERNEL__ | ||
2 | #ifndef _ASM_KMAP_TYPES_H | ||
3 | #define _ASM_KMAP_TYPES_H | ||
4 | |||
5 | enum km_type { | ||
6 | KM_BOUNCE_READ, | ||
7 | KM_SKB_SUNRPC_DATA, | ||
8 | KM_SKB_DATA_SOFTIRQ, | ||
9 | KM_USER0, | ||
10 | KM_USER1, | ||
11 | KM_BIO_SRC_IRQ, | ||
12 | KM_BIO_DST_IRQ, | ||
13 | KM_PTE0, | ||
14 | KM_PTE1, | ||
15 | KM_IRQ0, | ||
16 | KM_IRQ1, | ||
17 | KM_SOFTIRQ0, | ||
18 | KM_SOFTIRQ1, | ||
19 | KM_TYPE_NR | ||
20 | }; | ||
21 | |||
22 | #endif | ||
23 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc64/kprobes.h b/include/asm-ppc64/kprobes.h new file mode 100644 index 000000000000..19b468bed059 --- /dev/null +++ b/include/asm-ppc64/kprobes.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _ASM_KPROBES_H | ||
2 | #define _ASM_KPROBES_H | ||
3 | /* | ||
4 | * Kernel Probes (KProbes) | ||
5 | * include/asm-ppc64/kprobes.h | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
20 | * | ||
21 | * Copyright (C) IBM Corporation, 2002, 2004 | ||
22 | * | ||
23 | * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel | ||
24 | * Probes initial implementation ( includes suggestions from | ||
25 | * Rusty Russell). | ||
26 | * 2004-Nov Modified for PPC64 by Ananth N Mavinakayanahalli | ||
27 | * <ananth@in.ibm.com> | ||
28 | */ | ||
29 | #include <linux/types.h> | ||
30 | #include <linux/ptrace.h> | ||
31 | |||
32 | struct pt_regs; | ||
33 | |||
34 | typedef unsigned int kprobe_opcode_t; | ||
35 | #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ | ||
36 | #define MAX_INSN_SIZE 1 | ||
37 | |||
38 | #define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008) | ||
39 | #define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088) | ||
40 | #define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000) | ||
41 | #define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000) | ||
42 | |||
43 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry) | ||
44 | |||
45 | /* Architecture specific copy of original instruction */ | ||
46 | struct arch_specific_insn { | ||
47 | /* copy of original instruction */ | ||
48 | kprobe_opcode_t insn[MAX_INSN_SIZE]; | ||
49 | }; | ||
50 | |||
51 | #ifdef CONFIG_KPROBES | ||
52 | extern int kprobe_exceptions_notify(struct notifier_block *self, | ||
53 | unsigned long val, void *data); | ||
54 | #else /* !CONFIG_KPROBES */ | ||
55 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
56 | unsigned long val, void *data) | ||
57 | { | ||
58 | return 0; | ||
59 | } | ||
60 | #endif | ||
61 | #endif /* _ASM_KPROBES_H */ | ||
diff --git a/include/asm-ppc64/linkage.h b/include/asm-ppc64/linkage.h new file mode 100644 index 000000000000..291c2d01c44f --- /dev/null +++ b/include/asm-ppc64/linkage.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | ||
2 | #define __ASM_LINKAGE_H | ||
3 | |||
4 | /* Nothing to see here... */ | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-ppc64/lmb.h b/include/asm-ppc64/lmb.h new file mode 100644 index 000000000000..a6cbca21ac1d --- /dev/null +++ b/include/asm-ppc64/lmb.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef _PPC64_LMB_H | ||
2 | #define _PPC64_LMB_H | ||
3 | |||
4 | /* | ||
5 | * Definitions for talking to the Open Firmware PROM on | ||
6 | * Power Macintosh computers. | ||
7 | * | ||
8 | * Copyright (C) 2001 Peter Bergner, IBM Corp. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #include <linux/init.h> | ||
17 | #include <asm/prom.h> | ||
18 | |||
19 | #define MAX_LMB_REGIONS 128 | ||
20 | |||
21 | #define LMB_ALLOC_ANYWHERE 0 | ||
22 | |||
23 | struct lmb_property { | ||
24 | unsigned long base; | ||
25 | unsigned long physbase; | ||
26 | unsigned long size; | ||
27 | }; | ||
28 | |||
29 | struct lmb_region { | ||
30 | unsigned long cnt; | ||
31 | unsigned long size; | ||
32 | struct lmb_property region[MAX_LMB_REGIONS+1]; | ||
33 | }; | ||
34 | |||
35 | struct lmb { | ||
36 | unsigned long debug; | ||
37 | unsigned long rmo_size; | ||
38 | struct lmb_region memory; | ||
39 | struct lmb_region reserved; | ||
40 | }; | ||
41 | |||
42 | extern struct lmb lmb; | ||
43 | |||
44 | extern void __init lmb_init(void); | ||
45 | extern void __init lmb_analyze(void); | ||
46 | extern long __init lmb_add(unsigned long, unsigned long); | ||
47 | extern long __init lmb_reserve(unsigned long, unsigned long); | ||
48 | extern unsigned long __init lmb_alloc(unsigned long, unsigned long); | ||
49 | extern unsigned long __init lmb_alloc_base(unsigned long, unsigned long, | ||
50 | unsigned long); | ||
51 | extern unsigned long __init lmb_phys_mem_size(void); | ||
52 | extern unsigned long __init lmb_end_of_DRAM(void); | ||
53 | extern unsigned long __init lmb_abs_to_phys(unsigned long); | ||
54 | extern void __init lmb_enforce_memory_limit(void); | ||
55 | |||
56 | extern void lmb_dump_all(void); | ||
57 | |||
58 | extern unsigned long io_hole_start; | ||
59 | |||
60 | #endif /* _PPC64_LMB_H */ | ||
diff --git a/include/asm-ppc64/local.h b/include/asm-ppc64/local.h new file mode 100644 index 000000000000..c11c530f74d0 --- /dev/null +++ b/include/asm-ppc64/local.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/local.h> | |||
diff --git a/include/asm-ppc64/lppaca.h b/include/asm-ppc64/lppaca.h new file mode 100644 index 000000000000..70766b5f26c1 --- /dev/null +++ b/include/asm-ppc64/lppaca.h | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * lppaca.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ASM_LPPACA_H | ||
20 | #define _ASM_LPPACA_H | ||
21 | |||
22 | //============================================================================= | ||
23 | // | ||
24 | // This control block contains the data that is shared between the | ||
25 | // hypervisor (PLIC) and the OS. | ||
26 | // | ||
27 | // | ||
28 | //---------------------------------------------------------------------------- | ||
29 | #include <asm/types.h> | ||
30 | |||
31 | struct lppaca | ||
32 | { | ||
33 | //============================================================================= | ||
34 | // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data | ||
35 | // NOTE: The xDynXyz fields are fields that will be dynamically changed by | ||
36 | // PLIC when preparing to bring a processor online or when dispatching a | ||
37 | // virtual processor! | ||
38 | //============================================================================= | ||
39 | u32 desc; // Eye catcher 0xD397D781 x00-x03 | ||
40 | u16 size; // Size of this struct x04-x05 | ||
41 | u16 reserved1; // Reserved x06-x07 | ||
42 | u16 reserved2:14; // Reserved x08-x09 | ||
43 | u8 shared_proc:1; // Shared processor indicator ... | ||
44 | u8 secondary_thread:1; // Secondary thread indicator ... | ||
45 | volatile u8 dyn_proc_status:8; // Dynamic Status of this proc x0A-x0A | ||
46 | u8 secondary_thread_count; // Secondary thread count x0B-x0B | ||
47 | volatile u16 dyn_hv_phys_proc_index;// Dynamic HV Physical Proc Index0C-x0D | ||
48 | volatile u16 dyn_hv_log_proc_index;// Dynamic HV Logical Proc Indexx0E-x0F | ||
49 | u32 decr_val; // Value for Decr programming x10-x13 | ||
50 | u32 pmc_val; // Value for PMC regs x14-x17 | ||
51 | volatile u32 dyn_hw_node_id; // Dynamic Hardware Node id x18-x1B | ||
52 | volatile u32 dyn_hw_proc_id; // Dynamic Hardware Proc Id x1C-x1F | ||
53 | volatile u32 dyn_pir; // Dynamic ProcIdReg value x20-x23 | ||
54 | u32 dsei_data; // DSEI data x24-x27 | ||
55 | u64 sprg3; // SPRG3 value x28-x2F | ||
56 | u8 reserved3[80]; // Reserved x30-x7F | ||
57 | |||
58 | //============================================================================= | ||
59 | // CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data | ||
60 | //============================================================================= | ||
61 | // This Dword contains a byte for each type of interrupt that can occur. | ||
62 | // The IPI is a count while the others are just a binary 1 or 0. | ||
63 | union { | ||
64 | u64 any_int; | ||
65 | struct { | ||
66 | u16 reserved; // Reserved - cleared by #mpasmbl | ||
67 | u8 xirr_int; // Indicates xXirrValue is valid or Immed IO | ||
68 | u8 ipi_cnt; // IPI Count | ||
69 | u8 decr_int; // DECR interrupt occurred | ||
70 | u8 pdc_int; // PDC interrupt occurred | ||
71 | u8 quantum_int; // Interrupt quantum reached | ||
72 | u8 old_plic_deferred_ext_int; // Old PLIC has a deferred XIRR pending | ||
73 | } fields; | ||
74 | } int_dword; | ||
75 | |||
76 | // Whenever any fields in this Dword are set then PLIC will defer the | ||
77 | // processing of external interrupts. Note that PLIC will store the | ||
78 | // XIRR directly into the xXirrValue field so that another XIRR will | ||
79 | // not be presented until this one clears. The layout of the low | ||
80 | // 4-bytes of this Dword is upto SLIC - PLIC just checks whether the | ||
81 | // entire Dword is zero or not. A non-zero value in the low order | ||
82 | // 2-bytes will result in SLIC being granted the highest thread | ||
83 | // priority upon return. A 0 will return to SLIC as medium priority. | ||
84 | u64 plic_defer_ints_area; // Entire Dword | ||
85 | |||
86 | // Used to pass the real SRR0/1 from PLIC to SLIC as well as to | ||
87 | // pass the target SRR0/1 from SLIC to PLIC on a SetAsrAndRfid. | ||
88 | u64 saved_srr0; // Saved SRR0 x10-x17 | ||
89 | u64 saved_srr1; // Saved SRR1 x18-x1F | ||
90 | |||
91 | // Used to pass parms from the OS to PLIC for SetAsrAndRfid | ||
92 | u64 saved_gpr3; // Saved GPR3 x20-x27 | ||
93 | u64 saved_gpr4; // Saved GPR4 x28-x2F | ||
94 | u64 saved_gpr5; // Saved GPR5 x30-x37 | ||
95 | |||
96 | u8 reserved4; // Reserved x38-x38 | ||
97 | u8 cpuctls_task_attrs; // Task attributes for cpuctls x39-x39 | ||
98 | u8 fpregs_in_use; // FP regs in use x3A-x3A | ||
99 | u8 pmcregs_in_use; // PMC regs in use x3B-x3B | ||
100 | volatile u32 saved_decr; // Saved Decr Value x3C-x3F | ||
101 | volatile u64 emulated_time_base;// Emulated TB for this thread x40-x47 | ||
102 | volatile u64 cur_plic_latency; // Unaccounted PLIC latency x48-x4F | ||
103 | u64 tot_plic_latency; // Accumulated PLIC latency x50-x57 | ||
104 | u64 wait_state_cycles; // Wait cycles for this proc x58-x5F | ||
105 | u64 end_of_quantum; // TB at end of quantum x60-x67 | ||
106 | u64 pdc_saved_sprg1; // Saved SPRG1 for PMC int x68-x6F | ||
107 | u64 pdc_saved_srr0; // Saved SRR0 for PMC int x70-x77 | ||
108 | volatile u32 virtual_decr; // Virtual DECR for shared procsx78-x7B | ||
109 | u16 slb_count; // # of SLBs to maintain x7C-x7D | ||
110 | u8 idle; // Indicate OS is idle x7E | ||
111 | u8 reserved5; // Reserved x7F | ||
112 | |||
113 | |||
114 | //============================================================================= | ||
115 | // CACHE_LINE_3 0x0100 - 0x007F: This line is shared with other processors | ||
116 | //============================================================================= | ||
117 | // This is the yield_count. An "odd" value (low bit on) means that | ||
118 | // the processor is yielded (either because of an OS yield or a PLIC | ||
119 | // preempt). An even value implies that the processor is currently | ||
120 | // executing. | ||
121 | // NOTE: This value will ALWAYS be zero for dedicated processors and | ||
122 | // will NEVER be zero for shared processors (ie, initialized to a 1). | ||
123 | volatile u32 yield_count; // PLIC increments each dispatchx00-x03 | ||
124 | u8 reserved6[124]; // Reserved x04-x7F | ||
125 | |||
126 | //============================================================================= | ||
127 | // CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data | ||
128 | //============================================================================= | ||
129 | u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF | ||
130 | }; | ||
131 | |||
132 | #endif /* _ASM_LPPACA_H */ | ||
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h new file mode 100644 index 000000000000..5d3cd9d042e2 --- /dev/null +++ b/include/asm-ppc64/machdep.h | |||
@@ -0,0 +1,185 @@ | |||
1 | #ifdef __KERNEL__ | ||
2 | #ifndef _PPC64_MACHDEP_H | ||
3 | #define _PPC64_MACHDEP_H | ||
4 | |||
5 | /* | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/seq_file.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/dma-mapping.h> | ||
16 | |||
17 | #include <asm/setup.h> | ||
18 | |||
19 | struct pt_regs; | ||
20 | struct pci_bus; | ||
21 | struct device_node; | ||
22 | struct iommu_table; | ||
23 | struct rtc_time; | ||
24 | struct file; | ||
25 | |||
26 | #ifdef CONFIG_SMP | ||
27 | struct smp_ops_t { | ||
28 | void (*message_pass)(int target, int msg); | ||
29 | int (*probe)(void); | ||
30 | void (*kick_cpu)(int nr); | ||
31 | void (*setup_cpu)(int nr); | ||
32 | void (*take_timebase)(void); | ||
33 | void (*give_timebase)(void); | ||
34 | int (*cpu_enable)(unsigned int nr); | ||
35 | int (*cpu_disable)(void); | ||
36 | void (*cpu_die)(unsigned int nr); | ||
37 | int (*cpu_bootable)(unsigned int nr); | ||
38 | }; | ||
39 | #endif | ||
40 | |||
41 | struct machdep_calls { | ||
42 | void (*hpte_invalidate)(unsigned long slot, | ||
43 | unsigned long va, | ||
44 | int large, | ||
45 | int local); | ||
46 | long (*hpte_updatepp)(unsigned long slot, | ||
47 | unsigned long newpp, | ||
48 | unsigned long va, | ||
49 | int large, | ||
50 | int local); | ||
51 | void (*hpte_updateboltedpp)(unsigned long newpp, | ||
52 | unsigned long ea); | ||
53 | long (*hpte_insert)(unsigned long hpte_group, | ||
54 | unsigned long va, | ||
55 | unsigned long prpn, | ||
56 | int secondary, | ||
57 | unsigned long hpteflags, | ||
58 | int bolted, | ||
59 | int large); | ||
60 | long (*hpte_remove)(unsigned long hpte_group); | ||
61 | void (*flush_hash_range)(unsigned long context, | ||
62 | unsigned long number, | ||
63 | int local); | ||
64 | /* special for kexec, to be called in real mode, linar mapping is | ||
65 | * destroyed as well */ | ||
66 | void (*hpte_clear_all)(void); | ||
67 | |||
68 | void (*tce_build)(struct iommu_table * tbl, | ||
69 | long index, | ||
70 | long npages, | ||
71 | unsigned long uaddr, | ||
72 | enum dma_data_direction direction); | ||
73 | void (*tce_free)(struct iommu_table *tbl, | ||
74 | long index, | ||
75 | long npages); | ||
76 | void (*tce_flush)(struct iommu_table *tbl); | ||
77 | void (*iommu_dev_setup)(struct pci_dev *dev); | ||
78 | void (*iommu_bus_setup)(struct pci_bus *bus); | ||
79 | |||
80 | int (*probe)(int platform); | ||
81 | void (*setup_arch)(void); | ||
82 | void (*init_early)(void); | ||
83 | /* Optional, may be NULL. */ | ||
84 | void (*get_cpuinfo)(struct seq_file *m); | ||
85 | |||
86 | void (*init_IRQ)(void); | ||
87 | int (*get_irq)(struct pt_regs *); | ||
88 | |||
89 | /* PCI stuff */ | ||
90 | void (*pcibios_fixup)(void); | ||
91 | |||
92 | void (*restart)(char *cmd); | ||
93 | void (*power_off)(void); | ||
94 | void (*halt)(void); | ||
95 | void (*panic)(char *str); | ||
96 | void (*cpu_die)(void); | ||
97 | |||
98 | int (*set_rtc_time)(struct rtc_time *); | ||
99 | void (*get_rtc_time)(struct rtc_time *); | ||
100 | void (*get_boot_time)(struct rtc_time *); | ||
101 | |||
102 | void (*calibrate_decr)(void); | ||
103 | |||
104 | void (*progress)(char *, unsigned short); | ||
105 | |||
106 | /* Debug interface. Low level I/O to some terminal device */ | ||
107 | void (*udbg_putc)(unsigned char c); | ||
108 | unsigned char (*udbg_getc)(void); | ||
109 | int (*udbg_getc_poll)(void); | ||
110 | |||
111 | /* Interface for platform error logging */ | ||
112 | void (*log_error)(char *buf, unsigned int err_type, int fatal); | ||
113 | |||
114 | ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index); | ||
115 | ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index); | ||
116 | ssize_t (*nvram_size)(void); | ||
117 | int (*nvram_sync)(void); | ||
118 | |||
119 | /* Exception handlers */ | ||
120 | void (*system_reset_exception)(struct pt_regs *regs); | ||
121 | int (*machine_check_exception)(struct pt_regs *regs); | ||
122 | |||
123 | /* Motherboard/chipset features. This is a kind of general purpose | ||
124 | * hook used to control some machine specific features (like reset | ||
125 | * lines, chip power control, etc...). | ||
126 | */ | ||
127 | long (*feature_call)(unsigned int feature, ...); | ||
128 | |||
129 | /* Check availability of legacy devices like i8042 */ | ||
130 | int (*check_legacy_ioport)(unsigned int baseport); | ||
131 | |||
132 | /* Get legacy PCI/IDE interrupt mapping */ | ||
133 | int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel); | ||
134 | |||
135 | /* Get access protection for /dev/mem */ | ||
136 | pgprot_t (*phys_mem_access_prot)(struct file *file, | ||
137 | unsigned long offset, | ||
138 | unsigned long size, | ||
139 | pgprot_t vma_prot); | ||
140 | |||
141 | }; | ||
142 | |||
143 | extern struct machdep_calls ppc_md; | ||
144 | extern char cmd_line[COMMAND_LINE_SIZE]; | ||
145 | |||
146 | #ifdef CONFIG_PPC_PMAC | ||
147 | /* | ||
148 | * Power macintoshes have either a CUDA, PMU or SMU controlling | ||
149 | * system reset, power, NVRAM, RTC. | ||
150 | */ | ||
151 | typedef enum sys_ctrler_kind { | ||
152 | SYS_CTRLER_UNKNOWN = 0, | ||
153 | SYS_CTRLER_CUDA = 1, | ||
154 | SYS_CTRLER_PMU = 2, | ||
155 | SYS_CTRLER_SMU = 3, | ||
156 | } sys_ctrler_t; | ||
157 | extern sys_ctrler_t sys_ctrler; | ||
158 | |||
159 | #endif /* CONFIG_PPC_PMAC */ | ||
160 | |||
161 | |||
162 | |||
163 | /* Functions to produce codes on the leds. | ||
164 | * The SRC code should be unique for the message category and should | ||
165 | * be limited to the lower 24 bits (the upper 8 are set by these funcs), | ||
166 | * and (for boot & dump) should be sorted numerically in the order | ||
167 | * the events occur. | ||
168 | */ | ||
169 | /* Print a boot progress message. */ | ||
170 | void ppc64_boot_msg(unsigned int src, const char *msg); | ||
171 | /* Print a termination message (print only -- does not stop the kernel) */ | ||
172 | void ppc64_terminate_msg(unsigned int src, const char *msg); | ||
173 | /* Print something that needs attention (device error, etc) */ | ||
174 | void ppc64_attention_msg(unsigned int src, const char *msg); | ||
175 | /* Print a dump progress message. */ | ||
176 | void ppc64_dump_msg(unsigned int src, const char *msg); | ||
177 | |||
178 | static inline void log_error(char *buf, unsigned int err_type, int fatal) | ||
179 | { | ||
180 | if (ppc_md.log_error) | ||
181 | ppc_md.log_error(buf, err_type, fatal); | ||
182 | } | ||
183 | |||
184 | #endif /* _PPC64_MACHDEP_H */ | ||
185 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc64/macio.h b/include/asm-ppc64/macio.h new file mode 100644 index 000000000000..a3028b364f70 --- /dev/null +++ b/include/asm-ppc64/macio.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <asm-ppc/macio.h> | ||
2 | |||
diff --git a/include/asm-ppc64/mc146818rtc.h b/include/asm-ppc64/mc146818rtc.h new file mode 100644 index 000000000000..f713e1bbb533 --- /dev/null +++ b/include/asm-ppc64/mc146818rtc.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Machine dependent access functions for RTC registers. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | #ifndef __ASM_PPC64_MC146818RTC_H | ||
10 | #define __ASM_PPC64_MC146818RTC_H | ||
11 | |||
12 | #include <asm/io.h> | ||
13 | |||
14 | #ifndef RTC_PORT | ||
15 | #define RTC_PORT(x) (0x70 + (x)) | ||
16 | #define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ | ||
17 | #endif | ||
18 | |||
19 | /* | ||
20 | * The yet supported machines all access the RTC index register via | ||
21 | * an ISA port access but the way to access the date register differs ... | ||
22 | */ | ||
23 | #define CMOS_READ(addr) ({ \ | ||
24 | outb_p((addr),RTC_PORT(0)); \ | ||
25 | inb_p(RTC_PORT(1)); \ | ||
26 | }) | ||
27 | #define CMOS_WRITE(val, addr) ({ \ | ||
28 | outb_p((addr),RTC_PORT(0)); \ | ||
29 | outb_p((val),RTC_PORT(1)); \ | ||
30 | }) | ||
31 | |||
32 | #endif /* __ASM_PPC64_MC146818RTC_H */ | ||
diff --git a/include/asm-ppc64/memory.h b/include/asm-ppc64/memory.h new file mode 100644 index 000000000000..56e09face9a8 --- /dev/null +++ b/include/asm-ppc64/memory.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef _ASM_PPC64_MEMORY_H_ | ||
2 | #define _ASM_PPC64_MEMORY_H_ | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | |||
13 | /* | ||
14 | * Arguably the bitops and *xchg operations don't imply any memory barrier | ||
15 | * or SMP ordering, but in fact a lot of drivers expect them to imply | ||
16 | * both, since they do on x86 cpus. | ||
17 | */ | ||
18 | #ifdef CONFIG_SMP | ||
19 | #define EIEIO_ON_SMP "eieio\n" | ||
20 | #define ISYNC_ON_SMP "\n\tisync" | ||
21 | #else | ||
22 | #define EIEIO_ON_SMP | ||
23 | #define ISYNC_ON_SMP | ||
24 | #endif | ||
25 | |||
26 | static inline void eieio(void) | ||
27 | { | ||
28 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
29 | } | ||
30 | |||
31 | static inline void isync(void) | ||
32 | { | ||
33 | __asm__ __volatile__ ("isync" : : : "memory"); | ||
34 | } | ||
35 | |||
36 | #ifdef CONFIG_SMP | ||
37 | #define eieio_on_smp() eieio() | ||
38 | #define isync_on_smp() isync() | ||
39 | #else | ||
40 | #define eieio_on_smp() __asm__ __volatile__("": : :"memory") | ||
41 | #define isync_on_smp() __asm__ __volatile__("": : :"memory") | ||
42 | #endif | ||
43 | |||
44 | /* Macros for adjusting thread priority (hardware multi-threading) */ | ||
45 | #define HMT_very_low() asm volatile("or 31,31,31 # very low priority") | ||
46 | #define HMT_low() asm volatile("or 1,1,1 # low priority") | ||
47 | #define HMT_medium_low() asm volatile("or 6,6,6 # medium low priority") | ||
48 | #define HMT_medium() asm volatile("or 2,2,2 # medium priority") | ||
49 | #define HMT_medium_high() asm volatile("or 5,5,5 # medium high priority") | ||
50 | #define HMT_high() asm volatile("or 3,3,3 # high priority") | ||
51 | |||
52 | #define HMT_VERY_LOW "\tor 31,31,31 # very low priority\n" | ||
53 | #define HMT_LOW "\tor 1,1,1 # low priority\n" | ||
54 | #define HMT_MEDIUM_LOW "\tor 6,6,6 # medium low priority\n" | ||
55 | #define HMT_MEDIUM "\tor 2,2,2 # medium priority\n" | ||
56 | #define HMT_MEDIUM_HIGH "\tor 5,5,5 # medium high priority\n" | ||
57 | #define HMT_HIGH "\tor 3,3,3 # high priority\n" | ||
58 | |||
59 | #endif | ||
diff --git a/include/asm-ppc64/mman.h b/include/asm-ppc64/mman.h new file mode 100644 index 000000000000..d4f93446a52c --- /dev/null +++ b/include/asm-ppc64/mman.h | |||
@@ -0,0 +1,52 @@ | |||
1 | #ifndef __PPC64_MMAN_H__ | ||
2 | #define __PPC64_MMAN_H__ | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #define PROT_READ 0x1 /* page can be read */ | ||
12 | #define PROT_WRITE 0x2 /* page can be written */ | ||
13 | #define PROT_EXEC 0x4 /* page can be executed */ | ||
14 | #define PROT_SEM 0x8 /* page may be used for atomic ops */ | ||
15 | #define PROT_NONE 0x0 /* page can not be accessed */ | ||
16 | #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ | ||
17 | #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ | ||
18 | |||
19 | #define MAP_SHARED 0x01 /* Share changes */ | ||
20 | #define MAP_PRIVATE 0x02 /* Changes are private */ | ||
21 | #define MAP_TYPE 0x0f /* Mask for type of mapping */ | ||
22 | #define MAP_FIXED 0x10 /* Interpret addr exactly */ | ||
23 | #define MAP_ANONYMOUS 0x20 /* don't use a file */ | ||
24 | #define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ | ||
25 | #define MAP_NORESERVE 0x40 /* don't reserve swap pages */ | ||
26 | #define MAP_LOCKED 0x80 | ||
27 | |||
28 | #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ | ||
29 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
30 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
31 | |||
32 | #define MS_ASYNC 1 /* sync memory asynchronously */ | ||
33 | #define MS_INVALIDATE 2 /* invalidate the caches */ | ||
34 | #define MS_SYNC 4 /* synchronous memory sync */ | ||
35 | |||
36 | #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ | ||
37 | #define MCL_FUTURE 0x4000 /* lock all additions to address space */ | ||
38 | |||
39 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | ||
40 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
41 | |||
42 | #define MADV_NORMAL 0x0 /* default page-in behavior */ | ||
43 | #define MADV_RANDOM 0x1 /* page-in minimum required */ | ||
44 | #define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ | ||
45 | #define MADV_WILLNEED 0x3 /* pre-fault pages */ | ||
46 | #define MADV_DONTNEED 0x4 /* discard these pages */ | ||
47 | |||
48 | /* compatibility flags */ | ||
49 | #define MAP_ANON MAP_ANONYMOUS | ||
50 | #define MAP_FILE 0 | ||
51 | |||
52 | #endif /* __PPC64_MMAN_H__ */ | ||
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h new file mode 100644 index 000000000000..188987e9d9d4 --- /dev/null +++ b/include/asm-ppc64/mmu.h | |||
@@ -0,0 +1,242 @@ | |||
1 | /* | ||
2 | * PowerPC memory management structures | ||
3 | * | ||
4 | * Dave Engebretsen & Mike Corrigan <{engebret|mikejc}@us.ibm.com> | ||
5 | * PPC64 rework. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef _PPC64_MMU_H_ | ||
14 | #define _PPC64_MMU_H_ | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <asm/page.h> | ||
18 | #include <linux/stringify.h> | ||
19 | |||
20 | #ifndef __ASSEMBLY__ | ||
21 | |||
22 | /* Time to allow for more things here */ | ||
23 | typedef unsigned long mm_context_id_t; | ||
24 | typedef struct { | ||
25 | mm_context_id_t id; | ||
26 | #ifdef CONFIG_HUGETLB_PAGE | ||
27 | pgd_t *huge_pgdir; | ||
28 | u16 htlb_segs; /* bitmask */ | ||
29 | #endif | ||
30 | } mm_context_t; | ||
31 | |||
32 | #define STE_ESID_V 0x80 | ||
33 | #define STE_ESID_KS 0x20 | ||
34 | #define STE_ESID_KP 0x10 | ||
35 | #define STE_ESID_N 0x08 | ||
36 | |||
37 | #define STE_VSID_SHIFT 12 | ||
38 | |||
39 | struct stab_entry { | ||
40 | unsigned long esid_data; | ||
41 | unsigned long vsid_data; | ||
42 | }; | ||
43 | |||
44 | /* Hardware Page Table Entry */ | ||
45 | |||
46 | #define HPTES_PER_GROUP 8 | ||
47 | |||
48 | typedef struct { | ||
49 | unsigned long avpn:57; /* vsid | api == avpn */ | ||
50 | unsigned long : 2; /* Software use */ | ||
51 | unsigned long bolted: 1; /* HPTE is "bolted" */ | ||
52 | unsigned long lock: 1; /* lock on pSeries SMP */ | ||
53 | unsigned long l: 1; /* Virtual page is large (L=1) or 4 KB (L=0) */ | ||
54 | unsigned long h: 1; /* Hash function identifier */ | ||
55 | unsigned long v: 1; /* Valid (v=1) or invalid (v=0) */ | ||
56 | } Hpte_dword0; | ||
57 | |||
58 | typedef struct { | ||
59 | unsigned long pp0: 1; /* Page protection bit 0 */ | ||
60 | unsigned long ts: 1; /* Tag set bit */ | ||
61 | unsigned long rpn: 50; /* Real page number */ | ||
62 | unsigned long : 2; /* Reserved */ | ||
63 | unsigned long ac: 1; /* Address compare */ | ||
64 | unsigned long r: 1; /* Referenced */ | ||
65 | unsigned long c: 1; /* Changed */ | ||
66 | unsigned long w: 1; /* Write-thru cache mode */ | ||
67 | unsigned long i: 1; /* Cache inhibited */ | ||
68 | unsigned long m: 1; /* Memory coherence required */ | ||
69 | unsigned long g: 1; /* Guarded */ | ||
70 | unsigned long n: 1; /* No-execute */ | ||
71 | unsigned long pp: 2; /* Page protection bits 1:2 */ | ||
72 | } Hpte_dword1; | ||
73 | |||
74 | typedef struct { | ||
75 | char padding[6]; /* padding */ | ||
76 | unsigned long : 6; /* padding */ | ||
77 | unsigned long flags: 10; /* HPTE flags */ | ||
78 | } Hpte_dword1_flags; | ||
79 | |||
80 | typedef struct { | ||
81 | union { | ||
82 | unsigned long dword0; | ||
83 | Hpte_dword0 dw0; | ||
84 | } dw0; | ||
85 | |||
86 | union { | ||
87 | unsigned long dword1; | ||
88 | Hpte_dword1 dw1; | ||
89 | Hpte_dword1_flags flags; | ||
90 | } dw1; | ||
91 | } HPTE; | ||
92 | |||
93 | /* Values for PP (assumes Ks=0, Kp=1) */ | ||
94 | /* pp0 will always be 0 for linux */ | ||
95 | #define PP_RWXX 0 /* Supervisor read/write, User none */ | ||
96 | #define PP_RWRX 1 /* Supervisor read/write, User read */ | ||
97 | #define PP_RWRW 2 /* Supervisor read/write, User read/write */ | ||
98 | #define PP_RXRX 3 /* Supervisor read, User read */ | ||
99 | |||
100 | |||
101 | extern HPTE * htab_address; | ||
102 | extern unsigned long htab_hash_mask; | ||
103 | |||
104 | static inline unsigned long hpt_hash(unsigned long vpn, int large) | ||
105 | { | ||
106 | unsigned long vsid; | ||
107 | unsigned long page; | ||
108 | |||
109 | if (large) { | ||
110 | vsid = vpn >> 4; | ||
111 | page = vpn & 0xf; | ||
112 | } else { | ||
113 | vsid = vpn >> 16; | ||
114 | page = vpn & 0xffff; | ||
115 | } | ||
116 | |||
117 | return (vsid & 0x7fffffffffUL) ^ page; | ||
118 | } | ||
119 | |||
120 | static inline void __tlbie(unsigned long va, int large) | ||
121 | { | ||
122 | /* clear top 16 bits, non SLS segment */ | ||
123 | va &= ~(0xffffULL << 48); | ||
124 | |||
125 | if (large) { | ||
126 | va &= HPAGE_MASK; | ||
127 | asm volatile("tlbie %0,1" : : "r"(va) : "memory"); | ||
128 | } else { | ||
129 | va &= PAGE_MASK; | ||
130 | asm volatile("tlbie %0,0" : : "r"(va) : "memory"); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | static inline void tlbie(unsigned long va, int large) | ||
135 | { | ||
136 | asm volatile("ptesync": : :"memory"); | ||
137 | __tlbie(va, large); | ||
138 | asm volatile("eieio; tlbsync; ptesync": : :"memory"); | ||
139 | } | ||
140 | |||
141 | static inline void __tlbiel(unsigned long va) | ||
142 | { | ||
143 | /* clear top 16 bits, non SLS segment */ | ||
144 | va &= ~(0xffffULL << 48); | ||
145 | va &= PAGE_MASK; | ||
146 | |||
147 | /* | ||
148 | * Thanks to Alan Modra we are now able to use machine specific | ||
149 | * assembly instructions (like tlbiel) by using the gas -many flag. | ||
150 | * However we have to support older toolchains so for the moment | ||
151 | * we hardwire it. | ||
152 | */ | ||
153 | #if 0 | ||
154 | asm volatile("tlbiel %0" : : "r"(va) : "memory"); | ||
155 | #else | ||
156 | asm volatile(".long 0x7c000224 | (%0 << 11)" : : "r"(va) : "memory"); | ||
157 | #endif | ||
158 | } | ||
159 | |||
160 | static inline void tlbiel(unsigned long va) | ||
161 | { | ||
162 | asm volatile("ptesync": : :"memory"); | ||
163 | __tlbiel(va); | ||
164 | asm volatile("ptesync": : :"memory"); | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * Handle a fault by adding an HPTE. If the address can't be determined | ||
169 | * to be valid via Linux page tables, return 1. If handled return 0 | ||
170 | */ | ||
171 | extern int __hash_page(unsigned long ea, unsigned long access, | ||
172 | unsigned long vsid, pte_t *ptep, unsigned long trap, | ||
173 | int local); | ||
174 | |||
175 | extern void htab_finish_init(void); | ||
176 | |||
177 | #endif /* __ASSEMBLY__ */ | ||
178 | |||
179 | /* | ||
180 | * Location of cpu0's segment table | ||
181 | */ | ||
182 | #define STAB0_PAGE 0x9 | ||
183 | #define STAB0_PHYS_ADDR (STAB0_PAGE<<PAGE_SHIFT) | ||
184 | #define STAB0_VIRT_ADDR (KERNELBASE+STAB0_PHYS_ADDR) | ||
185 | |||
186 | #define SLB_NUM_BOLTED 3 | ||
187 | #define SLB_CACHE_ENTRIES 8 | ||
188 | |||
189 | /* Bits in the SLB ESID word */ | ||
190 | #define SLB_ESID_V 0x0000000008000000 /* entry is valid */ | ||
191 | |||
192 | /* Bits in the SLB VSID word */ | ||
193 | #define SLB_VSID_SHIFT 12 | ||
194 | #define SLB_VSID_KS 0x0000000000000800 | ||
195 | #define SLB_VSID_KP 0x0000000000000400 | ||
196 | #define SLB_VSID_N 0x0000000000000200 /* no-execute */ | ||
197 | #define SLB_VSID_L 0x0000000000000100 /* largepage (4M) */ | ||
198 | #define SLB_VSID_C 0x0000000000000080 /* class */ | ||
199 | |||
200 | #define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) | ||
201 | #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) | ||
202 | |||
203 | #define VSID_MULTIPLIER ASM_CONST(200730139) /* 28-bit prime */ | ||
204 | #define VSID_BITS 36 | ||
205 | #define VSID_MODULUS ((1UL<<VSID_BITS)-1) | ||
206 | |||
207 | #define CONTEXT_BITS 20 | ||
208 | #define USER_ESID_BITS 15 | ||
209 | |||
210 | /* | ||
211 | * This macro generates asm code to compute the VSID scramble | ||
212 | * function. Used in slb_allocate() and do_stab_bolted. The function | ||
213 | * computed is: (protovsid*VSID_MULTIPLIER) % VSID_MODULUS | ||
214 | * | ||
215 | * rt = register continaing the proto-VSID and into which the | ||
216 | * VSID will be stored | ||
217 | * rx = scratch register (clobbered) | ||
218 | * | ||
219 | * - rt and rx must be different registers | ||
220 | * - The answer will end up in the low 36 bits of rt. The higher | ||
221 | * bits may contain other garbage, so you may need to mask the | ||
222 | * result. | ||
223 | */ | ||
224 | #define ASM_VSID_SCRAMBLE(rt, rx) \ | ||
225 | lis rx,VSID_MULTIPLIER@h; \ | ||
226 | ori rx,rx,VSID_MULTIPLIER@l; \ | ||
227 | mulld rt,rt,rx; /* rt = rt * MULTIPLIER */ \ | ||
228 | \ | ||
229 | srdi rx,rt,VSID_BITS; \ | ||
230 | clrldi rt,rt,(64-VSID_BITS); \ | ||
231 | add rt,rt,rx; /* add high and low bits */ \ | ||
232 | /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \ | ||
233 | * 2^36-1+2^28-1. That in particular means that if r3 >= \ | ||
234 | * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \ | ||
235 | * the bit clear, r3 already has the answer we want, if it \ | ||
236 | * doesn't, the answer is the low 36 bits of r3+1. So in all \ | ||
237 | * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\ | ||
238 | addi rx,rt,1; \ | ||
239 | srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \ | ||
240 | add rt,rt,rx | ||
241 | |||
242 | #endif /* _PPC64_MMU_H_ */ | ||
diff --git a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h new file mode 100644 index 000000000000..c2e8e0466383 --- /dev/null +++ b/include/asm-ppc64/mmu_context.h | |||
@@ -0,0 +1,169 @@ | |||
1 | #ifndef __PPC64_MMU_CONTEXT_H | ||
2 | #define __PPC64_MMU_CONTEXT_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <linux/kernel.h> | ||
6 | #include <linux/mm.h> | ||
7 | #include <asm/mmu.h> | ||
8 | #include <asm/cputable.h> | ||
9 | |||
10 | /* | ||
11 | * Copyright (C) 2001 PPC 64 Team, IBM Corp | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * Every architecture must define this function. It's the fastest | ||
21 | * way of searching a 140-bit bitmap where the first 100 bits are | ||
22 | * unlikely to be set. It's guaranteed that at least one of the 140 | ||
23 | * bits is cleared. | ||
24 | */ | ||
25 | static inline int sched_find_first_bit(unsigned long *b) | ||
26 | { | ||
27 | if (unlikely(b[0])) | ||
28 | return __ffs(b[0]); | ||
29 | if (unlikely(b[1])) | ||
30 | return __ffs(b[1]) + 64; | ||
31 | return __ffs(b[2]) + 128; | ||
32 | } | ||
33 | |||
34 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
35 | { | ||
36 | } | ||
37 | |||
38 | #define NO_CONTEXT 0 | ||
39 | #define MAX_CONTEXT (0x100000-1) | ||
40 | |||
41 | extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | ||
42 | extern void destroy_context(struct mm_struct *mm); | ||
43 | |||
44 | extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm); | ||
45 | extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm); | ||
46 | |||
47 | /* | ||
48 | * switch_mm is the entry point called from the architecture independent | ||
49 | * code in kernel/sched.c | ||
50 | */ | ||
51 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
52 | struct task_struct *tsk) | ||
53 | { | ||
54 | if (!cpu_isset(smp_processor_id(), next->cpu_vm_mask)) | ||
55 | cpu_set(smp_processor_id(), next->cpu_vm_mask); | ||
56 | |||
57 | /* No need to flush userspace segments if the mm doesnt change */ | ||
58 | if (prev == next) | ||
59 | return; | ||
60 | |||
61 | #ifdef CONFIG_ALTIVEC | ||
62 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) | ||
63 | asm volatile ("dssall"); | ||
64 | #endif /* CONFIG_ALTIVEC */ | ||
65 | |||
66 | if (cpu_has_feature(CPU_FTR_SLB)) | ||
67 | switch_slb(tsk, next); | ||
68 | else | ||
69 | switch_stab(tsk, next); | ||
70 | } | ||
71 | |||
72 | #define deactivate_mm(tsk,mm) do { } while (0) | ||
73 | |||
74 | /* | ||
75 | * After we have set current->mm to a new value, this activates | ||
76 | * the context for the new mm so we see the new mappings. | ||
77 | */ | ||
78 | static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) | ||
79 | { | ||
80 | unsigned long flags; | ||
81 | |||
82 | local_irq_save(flags); | ||
83 | switch_mm(prev, next, current); | ||
84 | local_irq_restore(flags); | ||
85 | } | ||
86 | |||
87 | /* VSID allocation | ||
88 | * =============== | ||
89 | * | ||
90 | * We first generate a 36-bit "proto-VSID". For kernel addresses this | ||
91 | * is equal to the ESID, for user addresses it is: | ||
92 | * (context << 15) | (esid & 0x7fff) | ||
93 | * | ||
94 | * The two forms are distinguishable because the top bit is 0 for user | ||
95 | * addresses, whereas the top two bits are 1 for kernel addresses. | ||
96 | * Proto-VSIDs with the top two bits equal to 0b10 are reserved for | ||
97 | * now. | ||
98 | * | ||
99 | * The proto-VSIDs are then scrambled into real VSIDs with the | ||
100 | * multiplicative hash: | ||
101 | * | ||
102 | * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS | ||
103 | * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7 | ||
104 | * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF | ||
105 | * | ||
106 | * This scramble is only well defined for proto-VSIDs below | ||
107 | * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are | ||
108 | * reserved. VSID_MULTIPLIER is prime, so in particular it is | ||
109 | * co-prime to VSID_MODULUS, making this a 1:1 scrambling function. | ||
110 | * Because the modulus is 2^n-1 we can compute it efficiently without | ||
111 | * a divide or extra multiply (see below). | ||
112 | * | ||
113 | * This scheme has several advantages over older methods: | ||
114 | * | ||
115 | * - We have VSIDs allocated for every kernel address | ||
116 | * (i.e. everything above 0xC000000000000000), except the very top | ||
117 | * segment, which simplifies several things. | ||
118 | * | ||
119 | * - We allow for 15 significant bits of ESID and 20 bits of | ||
120 | * context for user addresses. i.e. 8T (43 bits) of address space for | ||
121 | * up to 1M contexts (although the page table structure and context | ||
122 | * allocation will need changes to take advantage of this). | ||
123 | * | ||
124 | * - The scramble function gives robust scattering in the hash | ||
125 | * table (at least based on some initial results). The previous | ||
126 | * method was more susceptible to pathological cases giving excessive | ||
127 | * hash collisions. | ||
128 | */ | ||
129 | |||
130 | /* | ||
131 | * WARNING - If you change these you must make sure the asm | ||
132 | * implementations in slb_allocate(), do_stab_bolted and mmu.h | ||
133 | * (ASM_VSID_SCRAMBLE macro) are changed accordingly. | ||
134 | * | ||
135 | * You'll also need to change the precomputed VSID values in head.S | ||
136 | * which are used by the iSeries firmware. | ||
137 | */ | ||
138 | |||
139 | static inline unsigned long vsid_scramble(unsigned long protovsid) | ||
140 | { | ||
141 | #if 0 | ||
142 | /* The code below is equivalent to this function for arguments | ||
143 | * < 2^VSID_BITS, which is all this should ever be called | ||
144 | * with. However gcc is not clever enough to compute the | ||
145 | * modulus (2^n-1) without a second multiply. */ | ||
146 | return ((protovsid * VSID_MULTIPLIER) % VSID_MODULUS); | ||
147 | #else /* 1 */ | ||
148 | unsigned long x; | ||
149 | |||
150 | x = protovsid * VSID_MULTIPLIER; | ||
151 | x = (x >> VSID_BITS) + (x & VSID_MODULUS); | ||
152 | return (x + ((x+1) >> VSID_BITS)) & VSID_MODULUS; | ||
153 | #endif /* 1 */ | ||
154 | } | ||
155 | |||
156 | /* This is only valid for addresses >= KERNELBASE */ | ||
157 | static inline unsigned long get_kernel_vsid(unsigned long ea) | ||
158 | { | ||
159 | return vsid_scramble(ea >> SID_SHIFT); | ||
160 | } | ||
161 | |||
162 | /* This is only valid for user addresses (which are below 2^41) */ | ||
163 | static inline unsigned long get_vsid(unsigned long context, unsigned long ea) | ||
164 | { | ||
165 | return vsid_scramble((context << USER_ESID_BITS) | ||
166 | | (ea >> SID_SHIFT)); | ||
167 | } | ||
168 | |||
169 | #endif /* __PPC64_MMU_CONTEXT_H */ | ||
diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h new file mode 100644 index 000000000000..0619a41a3c9d --- /dev/null +++ b/include/asm-ppc64/mmzone.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99 | ||
3 | * | ||
4 | * PowerPC64 port: | ||
5 | * Copyright (C) 2002 Anton Blanchard, IBM Corp. | ||
6 | */ | ||
7 | #ifndef _ASM_MMZONE_H_ | ||
8 | #define _ASM_MMZONE_H_ | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <asm/smp.h> | ||
12 | |||
13 | #ifdef CONFIG_DISCONTIGMEM | ||
14 | |||
15 | extern struct pglist_data *node_data[]; | ||
16 | |||
17 | /* | ||
18 | * Following are specific to this numa platform. | ||
19 | */ | ||
20 | |||
21 | extern int numa_cpu_lookup_table[]; | ||
22 | extern char *numa_memory_lookup_table; | ||
23 | extern cpumask_t numa_cpumask_lookup_table[]; | ||
24 | extern int nr_cpus_in_node[]; | ||
25 | |||
26 | /* 16MB regions */ | ||
27 | #define MEMORY_INCREMENT_SHIFT 24 | ||
28 | #define MEMORY_INCREMENT (1UL << MEMORY_INCREMENT_SHIFT) | ||
29 | |||
30 | /* NUMA debugging, will not work on a DLPAR machine */ | ||
31 | #undef DEBUG_NUMA | ||
32 | |||
33 | static inline int pa_to_nid(unsigned long pa) | ||
34 | { | ||
35 | int nid; | ||
36 | |||
37 | nid = numa_memory_lookup_table[pa >> MEMORY_INCREMENT_SHIFT]; | ||
38 | |||
39 | #ifdef DEBUG_NUMA | ||
40 | /* the physical address passed in is not in the map for the system */ | ||
41 | if (nid == -1) { | ||
42 | printk("bad address: %lx\n", pa); | ||
43 | BUG(); | ||
44 | } | ||
45 | #endif | ||
46 | |||
47 | return nid; | ||
48 | } | ||
49 | |||
50 | #define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) | ||
51 | |||
52 | /* | ||
53 | * Return a pointer to the node data for node n. | ||
54 | */ | ||
55 | #define NODE_DATA(nid) (node_data[nid]) | ||
56 | |||
57 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) | ||
58 | |||
59 | /* | ||
60 | * Following are macros that each numa implmentation must define. | ||
61 | */ | ||
62 | |||
63 | /* | ||
64 | * Given a kernel address, find the home node of the underlying memory. | ||
65 | */ | ||
66 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | ||
67 | |||
68 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
69 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
70 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) | ||
71 | |||
72 | #define local_mapnr(kvaddr) \ | ||
73 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) | ||
74 | |||
75 | /* Written this way to avoid evaluating arguments twice */ | ||
76 | #define discontigmem_pfn_to_page(pfn) \ | ||
77 | ({ \ | ||
78 | unsigned long __tmp = pfn; \ | ||
79 | (node_mem_map(pfn_to_nid(__tmp)) + \ | ||
80 | node_localnr(__tmp, pfn_to_nid(__tmp))); \ | ||
81 | }) | ||
82 | |||
83 | #define discontigmem_page_to_pfn(p) \ | ||
84 | ({ \ | ||
85 | struct page *__tmp = p; \ | ||
86 | (((__tmp) - page_zone(__tmp)->zone_mem_map) + \ | ||
87 | page_zone(__tmp)->zone_start_pfn); \ | ||
88 | }) | ||
89 | |||
90 | /* XXX fix for discontiguous physical memory */ | ||
91 | #define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages) | ||
92 | |||
93 | #endif /* CONFIG_DISCONTIGMEM */ | ||
94 | #endif /* _ASM_MMZONE_H_ */ | ||
diff --git a/include/asm-ppc64/module.h b/include/asm-ppc64/module.h new file mode 100644 index 000000000000..0581607826e8 --- /dev/null +++ b/include/asm-ppc64/module.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _ASM_PPC64_MODULE_H | ||
2 | #define _ASM_PPC64_MODULE_H | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | #include <asm/bug.h> | ||
6 | |||
7 | struct mod_arch_specific | ||
8 | { | ||
9 | /* Index of stubs section within module. */ | ||
10 | unsigned int stubs_section; | ||
11 | |||
12 | /* What section is the TOC? */ | ||
13 | unsigned int toc_section; | ||
14 | |||
15 | /* List of BUG addresses, source line numbers and filenames */ | ||
16 | struct list_head bug_list; | ||
17 | struct bug_entry *bug_table; | ||
18 | unsigned int num_bugs; | ||
19 | }; | ||
20 | |||
21 | extern struct bug_entry *module_find_bug(unsigned long bugaddr); | ||
22 | |||
23 | #define Elf_Shdr Elf64_Shdr | ||
24 | #define Elf_Sym Elf64_Sym | ||
25 | #define Elf_Ehdr Elf64_Ehdr | ||
26 | |||
27 | /* Make empty section for module_frob_arch_sections to expand. */ | ||
28 | #ifdef MODULE | ||
29 | asm(".section .stubs,\"ax\",@nobits; .align 3; .previous"); | ||
30 | #endif | ||
31 | |||
32 | struct exception_table_entry; | ||
33 | void sort_ex_table(struct exception_table_entry *start, | ||
34 | struct exception_table_entry *finish); | ||
35 | |||
36 | #endif /* _ASM_PPC64_MODULE_H */ | ||
diff --git a/include/asm-ppc64/msgbuf.h b/include/asm-ppc64/msgbuf.h new file mode 100644 index 000000000000..31c1cbf133cc --- /dev/null +++ b/include/asm-ppc64/msgbuf.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _PPC64_MSGBUF_H | ||
2 | #define _PPC64_MSGBUF_H | ||
3 | |||
4 | /* | ||
5 | * The msqid64_ds structure for the PPC architecture. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | struct msqid64_ds { | ||
14 | struct ipc64_perm msg_perm; | ||
15 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
16 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
17 | __kernel_time_t msg_ctime; /* last change time */ | ||
18 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
19 | unsigned long msg_qnum; /* number of messages in queue */ | ||
20 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
21 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
22 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
23 | unsigned long __unused1; | ||
24 | unsigned long __unused2; | ||
25 | }; | ||
26 | |||
27 | #endif /* _PPC64_MSGBUF_H */ | ||
diff --git a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h new file mode 100644 index 000000000000..bfb7caa32eaf --- /dev/null +++ b/include/asm-ppc64/naca.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _NACA_H | ||
2 | #define _NACA_H | ||
3 | |||
4 | /* | ||
5 | * c 2001 PPC 64 Team, IBM Corp | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <asm/types.h> | ||
14 | |||
15 | #ifndef __ASSEMBLY__ | ||
16 | |||
17 | struct naca_struct { | ||
18 | /* Kernel only data - undefined for user space */ | ||
19 | void *xItVpdAreas; /* VPD Data 0x00 */ | ||
20 | void *xRamDisk; /* iSeries ramdisk 0x08 */ | ||
21 | u64 xRamDiskSize; /* In pages 0x10 */ | ||
22 | }; | ||
23 | |||
24 | extern struct naca_struct naca; | ||
25 | |||
26 | #endif /* __ASSEMBLY__ */ | ||
27 | |||
28 | #define NACA_PAGE 0x4 | ||
29 | #define NACA_PHYS_ADDR (NACA_PAGE<<PAGE_SHIFT) | ||
30 | |||
31 | #endif /* _NACA_H */ | ||
diff --git a/include/asm-ppc64/namei.h b/include/asm-ppc64/namei.h new file mode 100644 index 000000000000..a1412a2d102a --- /dev/null +++ b/include/asm-ppc64/namei.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * linux/include/asm-ppc/namei.h | ||
3 | * Adapted from linux/include/asm-alpha/namei.h | ||
4 | * | ||
5 | * Included from linux/fs/namei.c | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __PPC64_NAMEI_H | ||
14 | #define __PPC64_NAMEI_H | ||
15 | |||
16 | /* This dummy routine maybe changed to something useful | ||
17 | * for /usr/gnemul/ emulation stuff. | ||
18 | * Look at asm-sparc/namei.h for details. | ||
19 | */ | ||
20 | |||
21 | #define __emul_prefix() NULL | ||
22 | |||
23 | #endif /* __PPC64_NAMEI_H */ | ||
diff --git a/include/asm-ppc64/numnodes.h b/include/asm-ppc64/numnodes.h new file mode 100644 index 000000000000..75ae0b906708 --- /dev/null +++ b/include/asm-ppc64/numnodes.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ASM_MAX_NUMNODES_H | ||
2 | #define _ASM_MAX_NUMNODES_H | ||
3 | |||
4 | /* Max 16 Nodes */ | ||
5 | #define NODES_SHIFT 4 | ||
6 | |||
7 | #endif /* _ASM_MAX_NUMNODES_H */ | ||
diff --git a/include/asm-ppc64/nvram.h b/include/asm-ppc64/nvram.h new file mode 100644 index 000000000000..4e6dd370d936 --- /dev/null +++ b/include/asm-ppc64/nvram.h | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | * PreP compliant NVRAM access | ||
3 | * This needs to be updated for PPC64 | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef _PPC64_NVRAM_H | ||
12 | #define _PPC64_NVRAM_H | ||
13 | |||
14 | #define NVRW_CNT 0x20 | ||
15 | #define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */ | ||
16 | #define NVRAM_BLOCK_LEN 16 | ||
17 | #define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN) | ||
18 | #define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN) | ||
19 | |||
20 | #define NVRAM_AS0 0x74 | ||
21 | #define NVRAM_AS1 0x75 | ||
22 | #define NVRAM_DATA 0x77 | ||
23 | |||
24 | |||
25 | /* RTC Offsets */ | ||
26 | |||
27 | #define MOTO_RTC_SECONDS 0x1FF9 | ||
28 | #define MOTO_RTC_MINUTES 0x1FFA | ||
29 | #define MOTO_RTC_HOURS 0x1FFB | ||
30 | #define MOTO_RTC_DAY_OF_WEEK 0x1FFC | ||
31 | #define MOTO_RTC_DAY_OF_MONTH 0x1FFD | ||
32 | #define MOTO_RTC_MONTH 0x1FFE | ||
33 | #define MOTO_RTC_YEAR 0x1FFF | ||
34 | #define MOTO_RTC_CONTROLA 0x1FF8 | ||
35 | #define MOTO_RTC_CONTROLB 0x1FF9 | ||
36 | |||
37 | #define NVRAM_SIG_SP 0x02 /* support processor */ | ||
38 | #define NVRAM_SIG_OF 0x50 /* open firmware config */ | ||
39 | #define NVRAM_SIG_FW 0x51 /* general firmware */ | ||
40 | #define NVRAM_SIG_HW 0x52 /* hardware (VPD) */ | ||
41 | #define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */ | ||
42 | #define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */ | ||
43 | #define NVRAM_SIG_SYS 0x70 /* system env vars */ | ||
44 | #define NVRAM_SIG_CFG 0x71 /* config data */ | ||
45 | #define NVRAM_SIG_ELOG 0x72 /* error log */ | ||
46 | #define NVRAM_SIG_VEND 0x7e /* vendor defined */ | ||
47 | #define NVRAM_SIG_FREE 0x7f /* Free space */ | ||
48 | #define NVRAM_SIG_OS 0xa0 /* OS defined */ | ||
49 | #define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */ | ||
50 | |||
51 | /* If change this size, then change the size of NVNAME_LEN */ | ||
52 | struct nvram_header { | ||
53 | unsigned char signature; | ||
54 | unsigned char checksum; | ||
55 | unsigned short length; | ||
56 | char name[12]; | ||
57 | }; | ||
58 | |||
59 | struct nvram_partition { | ||
60 | struct list_head partition; | ||
61 | struct nvram_header header; | ||
62 | unsigned int index; | ||
63 | }; | ||
64 | |||
65 | |||
66 | extern int nvram_write_error_log(char * buff, int length, unsigned int err_type); | ||
67 | extern int nvram_read_error_log(char * buff, int length, unsigned int * err_type); | ||
68 | extern int nvram_clear_error_log(void); | ||
69 | extern struct nvram_partition *nvram_find_partition(int sig, const char *name); | ||
70 | |||
71 | extern int pSeries_nvram_init(void); | ||
72 | extern int pmac_nvram_init(void); | ||
73 | |||
74 | /* PowerMac specific nvram stuffs */ | ||
75 | |||
76 | enum { | ||
77 | pmac_nvram_OF, /* Open Firmware partition */ | ||
78 | pmac_nvram_XPRAM, /* MacOS XPRAM partition */ | ||
79 | pmac_nvram_NR /* MacOS Name Registry partition */ | ||
80 | }; | ||
81 | |||
82 | /* Return partition offset in nvram */ | ||
83 | extern int pmac_get_partition(int partition); | ||
84 | |||
85 | /* Direct access to XPRAM on PowerMacs */ | ||
86 | extern u8 pmac_xpram_read(int xpaddr); | ||
87 | extern void pmac_xpram_write(int xpaddr, u8 data); | ||
88 | |||
89 | /* Synchronize NVRAM */ | ||
90 | extern int nvram_sync(void); | ||
91 | |||
92 | /* Some offsets in XPRAM */ | ||
93 | #define PMAC_XPRAM_MACHINE_LOC 0xe4 | ||
94 | #define PMAC_XPRAM_SOUND_VOLUME 0x08 | ||
95 | |||
96 | /* Machine location structure in PowerMac XPRAM */ | ||
97 | struct pmac_machine_location { | ||
98 | unsigned int latitude; /* 2+30 bit Fractional number */ | ||
99 | unsigned int longitude; /* 2+30 bit Fractional number */ | ||
100 | unsigned int delta; /* mix of GMT delta and DLS */ | ||
101 | }; | ||
102 | |||
103 | /* | ||
104 | * /dev/nvram ioctls | ||
105 | * | ||
106 | * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is | ||
107 | * definitely obsolete. Do not use it if you can avoid it | ||
108 | */ | ||
109 | |||
110 | #define OBSOLETE_PMAC_NVRAM_GET_OFFSET \ | ||
111 | _IOWR('p', 0x40, int) | ||
112 | |||
113 | #define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */ | ||
114 | |||
115 | #endif /* _PPC64_NVRAM_H */ | ||
diff --git a/include/asm-ppc64/of_device.h b/include/asm-ppc64/of_device.h new file mode 100644 index 000000000000..7bc136e22590 --- /dev/null +++ b/include/asm-ppc64/of_device.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <asm-ppc/of_device.h> | ||
2 | |||
diff --git a/include/asm-ppc64/pSeries_reconfig.h b/include/asm-ppc64/pSeries_reconfig.h new file mode 100644 index 000000000000..c0db1ea7f7d1 --- /dev/null +++ b/include/asm-ppc64/pSeries_reconfig.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _PPC64_PSERIES_RECONFIG_H | ||
2 | #define _PPC64_PSERIES_RECONFIG_H | ||
3 | |||
4 | #include <linux/notifier.h> | ||
5 | |||
6 | /* | ||
7 | * Use this API if your code needs to know about OF device nodes being | ||
8 | * added or removed on pSeries systems. | ||
9 | */ | ||
10 | |||
11 | #define PSERIES_RECONFIG_ADD 0x0001 | ||
12 | #define PSERIES_RECONFIG_REMOVE 0x0002 | ||
13 | |||
14 | #ifdef CONFIG_PPC_PSERIES | ||
15 | extern int pSeries_reconfig_notifier_register(struct notifier_block *); | ||
16 | extern void pSeries_reconfig_notifier_unregister(struct notifier_block *); | ||
17 | #else /* !CONFIG_PPC_PSERIES */ | ||
18 | static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb) | ||
19 | { | ||
20 | return 0; | ||
21 | } | ||
22 | static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { } | ||
23 | #endif /* CONFIG_PPC_PSERIES */ | ||
24 | |||
25 | #endif /* _PPC64_PSERIES_RECONFIG_H */ | ||
diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h new file mode 100644 index 000000000000..1a0223b5f3b8 --- /dev/null +++ b/include/asm-ppc64/paca.h | |||
@@ -0,0 +1,119 @@ | |||
1 | #ifndef _PPC64_PACA_H | ||
2 | #define _PPC64_PACA_H | ||
3 | |||
4 | /* | ||
5 | * include/asm-ppc64/paca.h | ||
6 | * | ||
7 | * This control block defines the PACA which defines the processor | ||
8 | * specific data for each logical processor on the system. | ||
9 | * There are some pointers defined that are utilized by PLIC. | ||
10 | * | ||
11 | * C 2001 PPC 64 Team, IBM Corp | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | */ | ||
18 | |||
19 | #include <linux/config.h> | ||
20 | #include <asm/types.h> | ||
21 | #include <asm/lppaca.h> | ||
22 | #include <asm/iSeries/ItLpRegSave.h> | ||
23 | #include <asm/mmu.h> | ||
24 | |||
25 | register struct paca_struct *local_paca asm("r13"); | ||
26 | #define get_paca() local_paca | ||
27 | |||
28 | struct task_struct; | ||
29 | struct ItLpQueue; | ||
30 | |||
31 | /* | ||
32 | * Defines the layout of the paca. | ||
33 | * | ||
34 | * This structure is not directly accessed by firmware or the service | ||
35 | * processor except for the first two pointers that point to the | ||
36 | * lppaca area and the ItLpRegSave area for this CPU. Both the | ||
37 | * lppaca and ItLpRegSave objects are currently contained within the | ||
38 | * PACA but they do not need to be. | ||
39 | */ | ||
40 | struct paca_struct { | ||
41 | /* | ||
42 | * Because hw_cpu_id, unlike other paca fields, is accessed | ||
43 | * routinely from other CPUs (from the IRQ code), we stick to | ||
44 | * read-only (after boot) fields in the first cacheline to | ||
45 | * avoid cacheline bouncing. | ||
46 | */ | ||
47 | |||
48 | /* | ||
49 | * MAGIC: These first two pointers can't be moved - they're | ||
50 | * accessed by the firmware | ||
51 | */ | ||
52 | struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ | ||
53 | struct ItLpRegSave *reg_save_ptr; /* Pointer to LpRegSave for PLIC */ | ||
54 | |||
55 | /* | ||
56 | * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c | ||
57 | * load lock_token and paca_index with a single lwz | ||
58 | * instruction. They must travel together and be properly | ||
59 | * aligned. | ||
60 | */ | ||
61 | u16 lock_token; /* Constant 0x8000, used in locks */ | ||
62 | u16 paca_index; /* Logical processor number */ | ||
63 | |||
64 | u32 default_decr; /* Default decrementer value */ | ||
65 | struct ItLpQueue *lpqueue_ptr; /* LpQueue handled by this CPU */ | ||
66 | u64 kernel_toc; /* Kernel TOC address */ | ||
67 | u64 stab_real; /* Absolute address of segment table */ | ||
68 | u64 stab_addr; /* Virtual address of segment table */ | ||
69 | void *emergency_sp; /* pointer to emergency stack */ | ||
70 | s16 hw_cpu_id; /* Physical processor number */ | ||
71 | u8 cpu_start; /* At startup, processor spins until */ | ||
72 | /* this becomes non-zero. */ | ||
73 | |||
74 | /* | ||
75 | * Now, starting in cacheline 2, the exception save areas | ||
76 | */ | ||
77 | u64 exgen[8] __attribute__((aligned(0x80))); /* used for most interrupts/exceptions */ | ||
78 | u64 exmc[8]; /* used for machine checks */ | ||
79 | u64 exslb[8]; /* used for SLB/segment table misses | ||
80 | * on the linear mapping */ | ||
81 | mm_context_t context; | ||
82 | u16 slb_cache[SLB_CACHE_ENTRIES]; | ||
83 | u16 slb_cache_ptr; | ||
84 | |||
85 | /* | ||
86 | * then miscellaneous read-write fields | ||
87 | */ | ||
88 | struct task_struct *__current; /* Pointer to current */ | ||
89 | u64 kstack; /* Saved Kernel stack addr */ | ||
90 | u64 stab_rr; /* stab/slb round-robin counter */ | ||
91 | u64 next_jiffy_update_tb; /* TB value for next jiffy update */ | ||
92 | u64 saved_r1; /* r1 save for RTAS calls */ | ||
93 | u64 saved_msr; /* MSR saved here by enter_rtas */ | ||
94 | u32 lpevent_count; /* lpevents processed */ | ||
95 | u8 proc_enabled; /* irq soft-enable flag */ | ||
96 | |||
97 | /* not yet used */ | ||
98 | u64 exdsi[8]; /* used for linear mapping hash table misses */ | ||
99 | |||
100 | /* | ||
101 | * iSeries structure which the hypervisor knows about - | ||
102 | * this structure should not cross a page boundary. | ||
103 | * The vpa_init/register_vpa call is now known to fail if the | ||
104 | * lppaca structure crosses a page boundary. | ||
105 | * The lppaca is also used on POWER5 pSeries boxes. | ||
106 | * The lppaca is 640 bytes long, and cannot readily change | ||
107 | * since the hypervisor knows its layout, so a 1kB | ||
108 | * alignment will suffice to ensure that it doesn't | ||
109 | * cross a page boundary. | ||
110 | */ | ||
111 | struct lppaca lppaca __attribute__((__aligned__(0x400))); | ||
112 | #ifdef CONFIG_PPC_ISERIES | ||
113 | struct ItLpRegSave reg_save; | ||
114 | #endif | ||
115 | }; | ||
116 | |||
117 | extern struct paca_struct paca[]; | ||
118 | |||
119 | #endif /* _PPC64_PACA_H */ | ||
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h new file mode 100644 index 000000000000..20e0f19324e8 --- /dev/null +++ b/include/asm-ppc64/page.h | |||
@@ -0,0 +1,261 @@ | |||
1 | #ifndef _PPC64_PAGE_H | ||
2 | #define _PPC64_PAGE_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2001 PPC64 Team, IBM Corp | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/config.h> | ||
14 | |||
15 | #ifdef __ASSEMBLY__ | ||
16 | #define ASM_CONST(x) x | ||
17 | #else | ||
18 | #define __ASM_CONST(x) x##UL | ||
19 | #define ASM_CONST(x) __ASM_CONST(x) | ||
20 | #endif | ||
21 | |||
22 | /* PAGE_SHIFT determines the page size */ | ||
23 | #define PAGE_SHIFT 12 | ||
24 | #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) | ||
25 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
26 | #define PAGE_OFFSET_MASK (PAGE_SIZE-1) | ||
27 | |||
28 | #define SID_SHIFT 28 | ||
29 | #define SID_MASK 0xfffffffffUL | ||
30 | #define ESID_MASK 0xfffffffff0000000UL | ||
31 | #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) | ||
32 | |||
33 | #define HPAGE_SHIFT 24 | ||
34 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | ||
35 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | ||
36 | |||
37 | #ifdef CONFIG_HUGETLB_PAGE | ||
38 | |||
39 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | ||
40 | |||
41 | /* For 64-bit processes the hugepage range is 1T-1.5T */ | ||
42 | #define TASK_HPAGE_BASE ASM_CONST(0x0000010000000000) | ||
43 | #define TASK_HPAGE_END ASM_CONST(0x0000018000000000) | ||
44 | |||
45 | #define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ | ||
46 | - (1U << GET_ESID(addr))) & 0xffff) | ||
47 | |||
48 | #define ARCH_HAS_HUGEPAGE_ONLY_RANGE | ||
49 | #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE | ||
50 | |||
51 | #define touches_hugepage_low_range(mm, addr, len) \ | ||
52 | (LOW_ESID_MASK((addr), (len)) & mm->context.htlb_segs) | ||
53 | #define touches_hugepage_high_range(addr, len) \ | ||
54 | (((addr) > (TASK_HPAGE_BASE-(len))) && ((addr) < TASK_HPAGE_END)) | ||
55 | |||
56 | #define __within_hugepage_low_range(addr, len, segmask) \ | ||
57 | ((LOW_ESID_MASK((addr), (len)) | (segmask)) == (segmask)) | ||
58 | #define within_hugepage_low_range(addr, len) \ | ||
59 | __within_hugepage_low_range((addr), (len), \ | ||
60 | current->mm->context.htlb_segs) | ||
61 | #define within_hugepage_high_range(addr, len) (((addr) >= TASK_HPAGE_BASE) \ | ||
62 | && ((addr)+(len) <= TASK_HPAGE_END) && ((addr)+(len) >= (addr))) | ||
63 | |||
64 | #define is_hugepage_only_range(mm, addr, len) \ | ||
65 | (touches_hugepage_high_range((addr), (len)) || \ | ||
66 | touches_hugepage_low_range((mm), (addr), (len))) | ||
67 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | ||
68 | |||
69 | #define in_hugepage_area(context, addr) \ | ||
70 | (cpu_has_feature(CPU_FTR_16M_PAGE) && \ | ||
71 | ( (((addr) >= TASK_HPAGE_BASE) && ((addr) < TASK_HPAGE_END)) || \ | ||
72 | ( ((addr) < 0x100000000L) && \ | ||
73 | ((1 << GET_ESID(addr)) & (context).htlb_segs) ) ) ) | ||
74 | |||
75 | #else /* !CONFIG_HUGETLB_PAGE */ | ||
76 | |||
77 | #define in_hugepage_area(mm, addr) 0 | ||
78 | |||
79 | #endif /* !CONFIG_HUGETLB_PAGE */ | ||
80 | |||
81 | /* align addr on a size boundary - adjust address up/down if needed */ | ||
82 | #define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) | ||
83 | #define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) | ||
84 | |||
85 | /* align addr on a size boundary - adjust address up if needed */ | ||
86 | #define _ALIGN(addr,size) _ALIGN_UP(addr,size) | ||
87 | |||
88 | /* to align the pointer to the (next) double word boundary */ | ||
89 | #define DOUBLEWORD_ALIGN(addr) _ALIGN(addr,sizeof(unsigned long)) | ||
90 | |||
91 | /* to align the pointer to the (next) page boundary */ | ||
92 | #define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) | ||
93 | |||
94 | #ifdef __KERNEL__ | ||
95 | #ifndef __ASSEMBLY__ | ||
96 | #include <asm/cache.h> | ||
97 | |||
98 | #undef STRICT_MM_TYPECHECKS | ||
99 | |||
100 | #define REGION_SIZE 4UL | ||
101 | #define REGION_SHIFT 60UL | ||
102 | #define REGION_MASK (((1UL<<REGION_SIZE)-1UL)<<REGION_SHIFT) | ||
103 | #define REGION_STRIDE (1UL << REGION_SHIFT) | ||
104 | |||
105 | static __inline__ void clear_page(void *addr) | ||
106 | { | ||
107 | unsigned long lines, line_size; | ||
108 | |||
109 | line_size = ppc64_caches.dline_size; | ||
110 | lines = ppc64_caches.dlines_per_page; | ||
111 | |||
112 | __asm__ __volatile__( | ||
113 | "mtctr %1 # clear_page\n\ | ||
114 | 1: dcbz 0,%0\n\ | ||
115 | add %0,%0,%3\n\ | ||
116 | bdnz+ 1b" | ||
117 | : "=r" (addr) | ||
118 | : "r" (lines), "0" (addr), "r" (line_size) | ||
119 | : "ctr", "memory"); | ||
120 | } | ||
121 | |||
122 | extern void copy_page(void *to, void *from); | ||
123 | struct page; | ||
124 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); | ||
125 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *p); | ||
126 | |||
127 | #ifdef STRICT_MM_TYPECHECKS | ||
128 | /* | ||
129 | * These are used to make use of C type-checking. | ||
130 | * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b. | ||
131 | */ | ||
132 | typedef struct { unsigned long pte; } pte_t; | ||
133 | typedef struct { unsigned int pmd; } pmd_t; | ||
134 | typedef struct { unsigned int pgd; } pgd_t; | ||
135 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
136 | |||
137 | #define pte_val(x) ((x).pte) | ||
138 | #define pmd_val(x) ((x).pmd) | ||
139 | #define pgd_val(x) ((x).pgd) | ||
140 | #define pgprot_val(x) ((x).pgprot) | ||
141 | |||
142 | #define __pte(x) ((pte_t) { (x) } ) | ||
143 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
144 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
145 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
146 | |||
147 | #else | ||
148 | /* | ||
149 | * .. while these make it easier on the compiler | ||
150 | */ | ||
151 | typedef unsigned long pte_t; | ||
152 | typedef unsigned int pmd_t; | ||
153 | typedef unsigned int pgd_t; | ||
154 | typedef unsigned long pgprot_t; | ||
155 | |||
156 | #define pte_val(x) (x) | ||
157 | #define pmd_val(x) (x) | ||
158 | #define pgd_val(x) (x) | ||
159 | #define pgprot_val(x) (x) | ||
160 | |||
161 | #define __pte(x) (x) | ||
162 | #define __pmd(x) (x) | ||
163 | #define __pgd(x) (x) | ||
164 | #define __pgprot(x) (x) | ||
165 | |||
166 | #endif | ||
167 | |||
168 | /* Pure 2^n version of get_order */ | ||
169 | static inline int get_order(unsigned long size) | ||
170 | { | ||
171 | int order; | ||
172 | |||
173 | size = (size-1) >> (PAGE_SHIFT-1); | ||
174 | order = -1; | ||
175 | do { | ||
176 | size >>= 1; | ||
177 | order++; | ||
178 | } while (size); | ||
179 | return order; | ||
180 | } | ||
181 | |||
182 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | ||
183 | |||
184 | extern int page_is_ram(unsigned long pfn); | ||
185 | |||
186 | extern u64 ppc64_pft_size; /* Log 2 of page table size */ | ||
187 | |||
188 | /* We do define AT_SYSINFO_EHDR but don't use the gate mecanism */ | ||
189 | #define __HAVE_ARCH_GATE_AREA 1 | ||
190 | |||
191 | #endif /* __ASSEMBLY__ */ | ||
192 | |||
193 | #ifdef MODULE | ||
194 | #define __page_aligned __attribute__((__aligned__(PAGE_SIZE))) | ||
195 | #else | ||
196 | #define __page_aligned \ | ||
197 | __attribute__((__aligned__(PAGE_SIZE), \ | ||
198 | __section__(".data.page_aligned"))) | ||
199 | #endif | ||
200 | |||
201 | |||
202 | /* This must match the -Ttext linker address */ | ||
203 | /* Note: tophys & tovirt make assumptions about how */ | ||
204 | /* KERNELBASE is defined for performance reasons. */ | ||
205 | /* When KERNELBASE moves, those macros may have */ | ||
206 | /* to change! */ | ||
207 | #define PAGE_OFFSET ASM_CONST(0xC000000000000000) | ||
208 | #define KERNELBASE PAGE_OFFSET | ||
209 | #define VMALLOCBASE ASM_CONST(0xD000000000000000) | ||
210 | #define IOREGIONBASE ASM_CONST(0xE000000000000000) | ||
211 | |||
212 | #define IO_REGION_ID (IOREGIONBASE>>REGION_SHIFT) | ||
213 | #define VMALLOC_REGION_ID (VMALLOCBASE>>REGION_SHIFT) | ||
214 | #define KERNEL_REGION_ID (KERNELBASE>>REGION_SHIFT) | ||
215 | #define USER_REGION_ID (0UL) | ||
216 | #define REGION_ID(X) (((unsigned long)(X))>>REGION_SHIFT) | ||
217 | |||
218 | #define __bpn_to_ba(x) ((((unsigned long)(x))<<PAGE_SHIFT) + KERNELBASE) | ||
219 | #define __ba_to_bpn(x) ((((unsigned long)(x)) & ~REGION_MASK) >> PAGE_SHIFT) | ||
220 | |||
221 | #define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) | ||
222 | |||
223 | #ifdef CONFIG_DISCONTIGMEM | ||
224 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) | ||
225 | #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) | ||
226 | #define pfn_valid(pfn) discontigmem_pfn_valid(pfn) | ||
227 | #else | ||
228 | #define pfn_to_page(pfn) (mem_map + (pfn)) | ||
229 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
230 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | ||
231 | #endif | ||
232 | |||
233 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
234 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | ||
235 | |||
236 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
237 | |||
238 | /* | ||
239 | * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI, | ||
240 | * and needs to be executable. This means the whole heap ends | ||
241 | * up being executable. | ||
242 | */ | ||
243 | #define VM_DATA_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \ | ||
244 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
245 | |||
246 | #define VM_DATA_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \ | ||
247 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
248 | |||
249 | #define VM_DATA_DEFAULT_FLAGS \ | ||
250 | (test_thread_flag(TIF_32BIT) ? \ | ||
251 | VM_DATA_DEFAULT_FLAGS32 : VM_DATA_DEFAULT_FLAGS64) | ||
252 | |||
253 | /* | ||
254 | * This is the default if a program doesn't have a PT_GNU_STACK | ||
255 | * program header entry. | ||
256 | */ | ||
257 | #define VM_STACK_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
258 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
259 | |||
260 | #endif /* __KERNEL__ */ | ||
261 | #endif /* _PPC64_PAGE_H */ | ||
diff --git a/include/asm-ppc64/param.h b/include/asm-ppc64/param.h new file mode 100644 index 000000000000..1fad38dcf707 --- /dev/null +++ b/include/asm-ppc64/param.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef _ASM_PPC64_PARAM_H | ||
2 | #define _ASM_PPC64_PARAM_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifdef __KERNEL__ | ||
12 | # define HZ 1000 /* Internal kernel timer frequency */ | ||
13 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
14 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | ||
15 | #endif | ||
16 | |||
17 | #ifndef HZ | ||
18 | #define HZ 100 | ||
19 | #endif | ||
20 | |||
21 | #define EXEC_PAGESIZE 4096 | ||
22 | |||
23 | #ifndef NOGROUP | ||
24 | #define NOGROUP (-1) | ||
25 | #endif | ||
26 | |||
27 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
28 | |||
29 | #endif /* _ASM_PPC64_PARAM_H */ | ||
diff --git a/include/asm-ppc64/parport.h b/include/asm-ppc64/parport.h new file mode 100644 index 000000000000..2f8874c581cc --- /dev/null +++ b/include/asm-ppc64/parport.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * parport.h: platform-specific PC-style parport initialisation | ||
3 | * | ||
4 | * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk> | ||
5 | * | ||
6 | * This file should only be included by drivers/parport/parport_pc.c. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_PPC64_PARPORT_H | ||
10 | #define _ASM_PPC64_PARPORT_H | ||
11 | |||
12 | static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); | ||
13 | static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) | ||
14 | { | ||
15 | return parport_pc_find_isa_ports (autoirq, autodma); | ||
16 | } | ||
17 | |||
18 | #endif /* !(_ASM_PPC_PARPORT_H) */ | ||
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h new file mode 100644 index 000000000000..c4f9023ea5ed --- /dev/null +++ b/include/asm-ppc64/pci-bridge.h | |||
@@ -0,0 +1,90 @@ | |||
1 | #ifdef __KERNEL__ | ||
2 | #ifndef _ASM_PCI_BRIDGE_H | ||
3 | #define _ASM_PCI_BRIDGE_H | ||
4 | |||
5 | #include <linux/pci.h> | ||
6 | |||
7 | /* | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * Structure of a PCI controller (host bridge) | ||
16 | */ | ||
17 | struct pci_controller { | ||
18 | struct pci_bus *bus; | ||
19 | char is_dynamic; | ||
20 | void *arch_data; | ||
21 | struct list_head list_node; | ||
22 | |||
23 | int first_busno; | ||
24 | int last_busno; | ||
25 | |||
26 | void __iomem *io_base_virt; | ||
27 | unsigned long io_base_phys; | ||
28 | |||
29 | /* Some machines have a non 1:1 mapping of | ||
30 | * the PCI memory space in the CPU bus space | ||
31 | */ | ||
32 | unsigned long pci_mem_offset; | ||
33 | unsigned long pci_io_size; | ||
34 | |||
35 | struct pci_ops *ops; | ||
36 | volatile unsigned int __iomem *cfg_addr; | ||
37 | volatile unsigned char __iomem *cfg_data; | ||
38 | |||
39 | /* Currently, we limit ourselves to 1 IO range and 3 mem | ||
40 | * ranges since the common pci_bus structure can't handle more | ||
41 | */ | ||
42 | struct resource io_resource; | ||
43 | struct resource mem_resources[3]; | ||
44 | int global_number; | ||
45 | int local_number; | ||
46 | unsigned long buid; | ||
47 | unsigned long dma_window_base_cur; | ||
48 | unsigned long dma_window_size; | ||
49 | }; | ||
50 | |||
51 | struct device_node *fetch_dev_dn(struct pci_dev *dev); | ||
52 | |||
53 | /* Get a device_node from a pci_dev. This code must be fast except in the case | ||
54 | * where the sysdata is incorrect and needs to be fixed up (hopefully just once) | ||
55 | */ | ||
56 | static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) | ||
57 | { | ||
58 | struct device_node *dn = dev->sysdata; | ||
59 | |||
60 | if (dn->devfn == dev->devfn && dn->busno == dev->bus->number) | ||
61 | return dn; /* fast path. sysdata is good */ | ||
62 | else | ||
63 | return fetch_dev_dn(dev); | ||
64 | } | ||
65 | |||
66 | static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) | ||
67 | { | ||
68 | if (bus->self) | ||
69 | return pci_device_to_OF_node(bus->self); | ||
70 | else | ||
71 | return bus->sysdata; /* Must be root bus (PHB) */ | ||
72 | } | ||
73 | |||
74 | extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, | ||
75 | struct device_node *dev); | ||
76 | |||
77 | extern int pcibios_remove_root_bus(struct pci_controller *phb); | ||
78 | |||
79 | extern void phbs_remap_io(void); | ||
80 | |||
81 | static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) | ||
82 | { | ||
83 | struct device_node *busdn = bus->sysdata; | ||
84 | |||
85 | BUG_ON(busdn == NULL); | ||
86 | return busdn->phb; | ||
87 | } | ||
88 | |||
89 | #endif | ||
90 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h new file mode 100644 index 000000000000..6cd593f660a0 --- /dev/null +++ b/include/asm-ppc64/pci.h | |||
@@ -0,0 +1,142 @@ | |||
1 | #ifndef __PPC64_PCI_H | ||
2 | #define __PPC64_PCI_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | /* | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/string.h> | ||
15 | #include <linux/dma-mapping.h> | ||
16 | |||
17 | #include <asm/machdep.h> | ||
18 | #include <asm/scatterlist.h> | ||
19 | #include <asm/io.h> | ||
20 | #include <asm/prom.h> | ||
21 | |||
22 | #include <asm-generic/pci-dma-compat.h> | ||
23 | |||
24 | #define PCIBIOS_MIN_IO 0x1000 | ||
25 | #define PCIBIOS_MIN_MEM 0x10000000 | ||
26 | |||
27 | struct pci_dev; | ||
28 | |||
29 | #ifdef CONFIG_PPC_ISERIES | ||
30 | #define pcibios_scan_all_fns(a, b) 0 | ||
31 | #else | ||
32 | extern int pcibios_scan_all_fns(struct pci_bus *bus, int devfn); | ||
33 | #endif | ||
34 | |||
35 | static inline void pcibios_set_master(struct pci_dev *dev) | ||
36 | { | ||
37 | /* No special bus mastering setup handling */ | ||
38 | } | ||
39 | |||
40 | static inline void pcibios_penalize_isa_irq(int irq) | ||
41 | { | ||
42 | /* We don't do dynamic PCI IRQ allocation */ | ||
43 | } | ||
44 | |||
45 | #define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ | ||
46 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | ||
47 | { | ||
48 | if (ppc_md.pci_get_legacy_ide_irq) | ||
49 | return ppc_md.pci_get_legacy_ide_irq(dev, channel); | ||
50 | return channel ? 15 : 14; | ||
51 | } | ||
52 | |||
53 | #define HAVE_ARCH_PCI_MWI 1 | ||
54 | static inline int pcibios_prep_mwi(struct pci_dev *dev) | ||
55 | { | ||
56 | /* | ||
57 | * We would like to avoid touching the cacheline size or MWI bit | ||
58 | * but we cant do that with the current pcibios_prep_mwi | ||
59 | * interface. pSeries firmware sets the cacheline size (which is not | ||
60 | * the cpu cacheline size in all cases) and hardware treats MWI | ||
61 | * the same as memory write. So we dont touch the cacheline size | ||
62 | * here and allow the generic code to set the MWI bit. | ||
63 | */ | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | extern unsigned int pcibios_assign_all_busses(void); | ||
68 | |||
69 | extern struct dma_mapping_ops pci_dma_ops; | ||
70 | |||
71 | /* For DAC DMA, we currently don't support it by default, but | ||
72 | * we let the platform override this | ||
73 | */ | ||
74 | static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) | ||
75 | { | ||
76 | if (pci_dma_ops.dac_dma_supported) | ||
77 | return pci_dma_ops.dac_dma_supported(&hwdev->dev, mask); | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | extern int pci_domain_nr(struct pci_bus *bus); | ||
82 | |||
83 | /* Decide whether to display the domain number in /proc */ | ||
84 | extern int pci_proc_domain(struct pci_bus *bus); | ||
85 | |||
86 | struct vm_area_struct; | ||
87 | /* Map a range of PCI memory or I/O space for a device into user space */ | ||
88 | int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, | ||
89 | enum pci_mmap_state mmap_state, int write_combine); | ||
90 | |||
91 | /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ | ||
92 | #define HAVE_PCI_MMAP 1 | ||
93 | |||
94 | /* pci_unmap_{single,page} is not a nop, thus... */ | ||
95 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ | ||
96 | dma_addr_t ADDR_NAME; | ||
97 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ | ||
98 | __u32 LEN_NAME; | ||
99 | #define pci_unmap_addr(PTR, ADDR_NAME) \ | ||
100 | ((PTR)->ADDR_NAME) | ||
101 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \ | ||
102 | (((PTR)->ADDR_NAME) = (VAL)) | ||
103 | #define pci_unmap_len(PTR, LEN_NAME) \ | ||
104 | ((PTR)->LEN_NAME) | ||
105 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ | ||
106 | (((PTR)->LEN_NAME) = (VAL)) | ||
107 | |||
108 | /* The PCI address space does equal the physical memory | ||
109 | * address space. The networking and block device layers use | ||
110 | * this boolean for bounce buffer decisions. | ||
111 | */ | ||
112 | #define PCI_DMA_BUS_IS_PHYS (0) | ||
113 | |||
114 | extern void | ||
115 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
116 | struct resource *res); | ||
117 | |||
118 | extern int | ||
119 | unmap_bus_range(struct pci_bus *bus); | ||
120 | |||
121 | extern int | ||
122 | remap_bus_range(struct pci_bus *bus); | ||
123 | |||
124 | extern void | ||
125 | pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus); | ||
126 | |||
127 | extern struct pci_controller *init_phb_dynamic(struct device_node *dn); | ||
128 | |||
129 | extern int pci_read_irq_line(struct pci_dev *dev); | ||
130 | |||
131 | extern void pcibios_add_platform_entries(struct pci_dev *dev); | ||
132 | |||
133 | struct file; | ||
134 | extern pgprot_t pci_phys_mem_access_prot(struct file *file, | ||
135 | unsigned long offset, | ||
136 | unsigned long size, | ||
137 | pgprot_t prot); | ||
138 | |||
139 | |||
140 | #endif /* __KERNEL__ */ | ||
141 | |||
142 | #endif /* __PPC64_PCI_H */ | ||
diff --git a/include/asm-ppc64/percpu.h b/include/asm-ppc64/percpu.h new file mode 100644 index 000000000000..60a659a4ce1f --- /dev/null +++ b/include/asm-ppc64/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ARCH_PPC64_PERCPU__ | ||
2 | #define __ARCH_PPC64_PERCPU__ | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* __ARCH_PPC64_PERCPU__ */ | ||
diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h new file mode 100644 index 000000000000..16232d740173 --- /dev/null +++ b/include/asm-ppc64/pgalloc.h | |||
@@ -0,0 +1,91 @@ | |||
1 | #ifndef _PPC64_PGALLOC_H | ||
2 | #define _PPC64_PGALLOC_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | #include <linux/slab.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <linux/percpu.h> | ||
8 | |||
9 | extern kmem_cache_t *zero_cache; | ||
10 | |||
11 | /* | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version | ||
15 | * 2 of the License, or (at your option) any later version. | ||
16 | */ | ||
17 | |||
18 | static inline pgd_t * | ||
19 | pgd_alloc(struct mm_struct *mm) | ||
20 | { | ||
21 | return kmem_cache_alloc(zero_cache, GFP_KERNEL); | ||
22 | } | ||
23 | |||
24 | static inline void | ||
25 | pgd_free(pgd_t *pgd) | ||
26 | { | ||
27 | kmem_cache_free(zero_cache, pgd); | ||
28 | } | ||
29 | |||
30 | #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD) | ||
31 | |||
32 | static inline pmd_t * | ||
33 | pmd_alloc_one(struct mm_struct *mm, unsigned long addr) | ||
34 | { | ||
35 | return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); | ||
36 | } | ||
37 | |||
38 | static inline void | ||
39 | pmd_free(pmd_t *pmd) | ||
40 | { | ||
41 | kmem_cache_free(zero_cache, pmd); | ||
42 | } | ||
43 | |||
44 | #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) | ||
45 | #define pmd_populate(mm, pmd, pte_page) \ | ||
46 | pmd_populate_kernel(mm, pmd, page_address(pte_page)) | ||
47 | |||
48 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | ||
49 | { | ||
50 | return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); | ||
51 | } | ||
52 | |||
53 | static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | ||
54 | { | ||
55 | pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); | ||
56 | if (pte) | ||
57 | return virt_to_page(pte); | ||
58 | return NULL; | ||
59 | } | ||
60 | |||
61 | static inline void pte_free_kernel(pte_t *pte) | ||
62 | { | ||
63 | kmem_cache_free(zero_cache, pte); | ||
64 | } | ||
65 | |||
66 | static inline void pte_free(struct page *ptepage) | ||
67 | { | ||
68 | kmem_cache_free(zero_cache, page_address(ptepage)); | ||
69 | } | ||
70 | |||
71 | struct pte_freelist_batch | ||
72 | { | ||
73 | struct rcu_head rcu; | ||
74 | unsigned int index; | ||
75 | struct page * pages[0]; | ||
76 | }; | ||
77 | |||
78 | #define PTE_FREELIST_SIZE ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) / \ | ||
79 | sizeof(struct page *)) | ||
80 | |||
81 | extern void pte_free_now(struct page *ptepage); | ||
82 | extern void pte_free_submit(struct pte_freelist_batch *batch); | ||
83 | |||
84 | DECLARE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); | ||
85 | |||
86 | void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage); | ||
87 | #define __pmd_free_tlb(tlb, pmd) __pte_free_tlb(tlb, virt_to_page(pmd)) | ||
88 | |||
89 | #define check_pgt_cache() do { } while (0) | ||
90 | |||
91 | #endif /* _PPC64_PGALLOC_H */ | ||
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h new file mode 100644 index 000000000000..4c4824653e80 --- /dev/null +++ b/include/asm-ppc64/pgtable.h | |||
@@ -0,0 +1,602 @@ | |||
1 | #ifndef _PPC64_PGTABLE_H | ||
2 | #define _PPC64_PGTABLE_H | ||
3 | |||
4 | #include <asm-generic/4level-fixup.h> | ||
5 | |||
6 | /* | ||
7 | * This file contains the functions and defines necessary to modify and use | ||
8 | * the ppc64 hashed page table. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASSEMBLY__ | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/stddef.h> | ||
14 | #include <asm/processor.h> /* For TASK_SIZE */ | ||
15 | #include <asm/mmu.h> | ||
16 | #include <asm/page.h> | ||
17 | #include <asm/tlbflush.h> | ||
18 | #endif /* __ASSEMBLY__ */ | ||
19 | |||
20 | /* PMD_SHIFT determines what a second-level page table entry can map */ | ||
21 | #define PMD_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) | ||
22 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
23 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
24 | |||
25 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
26 | #define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - 3) + (PAGE_SHIFT - 2)) | ||
27 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
28 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
29 | |||
30 | /* | ||
31 | * Entries per page directory level. The PTE level must use a 64b record | ||
32 | * for each page table entry. The PMD and PGD level use a 32b record for | ||
33 | * each entry by assuming that each entry is page aligned. | ||
34 | */ | ||
35 | #define PTE_INDEX_SIZE 9 | ||
36 | #define PMD_INDEX_SIZE 10 | ||
37 | #define PGD_INDEX_SIZE 10 | ||
38 | |||
39 | #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) | ||
40 | #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) | ||
41 | #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) | ||
42 | |||
43 | #define USER_PTRS_PER_PGD (1024) | ||
44 | #define FIRST_USER_PGD_NR 0 | ||
45 | |||
46 | #define EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ | ||
47 | PGD_INDEX_SIZE + PAGE_SHIFT) | ||
48 | |||
49 | /* | ||
50 | * Size of EA range mapped by our pagetables. | ||
51 | */ | ||
52 | #define PGTABLE_EA_BITS 41 | ||
53 | #define PGTABLE_EA_MASK ((1UL<<PGTABLE_EA_BITS)-1) | ||
54 | |||
55 | /* | ||
56 | * Define the address range of the vmalloc VM area. | ||
57 | */ | ||
58 | #define VMALLOC_START (0xD000000000000000ul) | ||
59 | #define VMALLOC_END (VMALLOC_START + PGTABLE_EA_MASK) | ||
60 | |||
61 | /* | ||
62 | * Define the address range of the imalloc VM area. | ||
63 | * (used for ioremap) | ||
64 | */ | ||
65 | #define IMALLOC_START (ioremap_bot) | ||
66 | #define IMALLOC_VMADDR(x) ((unsigned long)(x)) | ||
67 | #define PHBS_IO_BASE (0xE000000000000000ul) /* Reserve 2 gigs for PHBs */ | ||
68 | #define IMALLOC_BASE (0xE000000080000000ul) | ||
69 | #define IMALLOC_END (IMALLOC_BASE + PGTABLE_EA_MASK) | ||
70 | |||
71 | /* | ||
72 | * Define the user address range | ||
73 | */ | ||
74 | #define USER_START (0UL) | ||
75 | #define USER_END (USER_START + PGTABLE_EA_MASK) | ||
76 | |||
77 | |||
78 | /* | ||
79 | * Bits in a linux-style PTE. These match the bits in the | ||
80 | * (hardware-defined) PowerPC PTE as closely as possible. | ||
81 | */ | ||
82 | #define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ | ||
83 | #define _PAGE_USER 0x0002 /* matches one of the PP bits */ | ||
84 | #define _PAGE_FILE 0x0002 /* (!present only) software: pte holds file offset */ | ||
85 | #define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we invert) */ | ||
86 | #define _PAGE_GUARDED 0x0008 | ||
87 | #define _PAGE_COHERENT 0x0010 /* M: enforce memory coherence (SMP systems) */ | ||
88 | #define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */ | ||
89 | #define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */ | ||
90 | #define _PAGE_DIRTY 0x0080 /* C: page changed */ | ||
91 | #define _PAGE_ACCESSED 0x0100 /* R: page referenced */ | ||
92 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ | ||
93 | #define _PAGE_HASHPTE 0x0400 /* software: pte has an associated HPTE */ | ||
94 | #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ | ||
95 | #define _PAGE_SECONDARY 0x8000 /* software: HPTE is in secondary group */ | ||
96 | #define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */ | ||
97 | #define _PAGE_HUGE 0x10000 /* 16MB page */ | ||
98 | /* Bits 0x7000 identify the index within an HPT Group */ | ||
99 | #define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_SECONDARY | _PAGE_GROUP_IX) | ||
100 | /* PAGE_MASK gives the right answer below, but only by accident */ | ||
101 | /* It should be preserving the high 48 bits and then specifically */ | ||
102 | /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ | ||
103 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HPTEFLAGS) | ||
104 | |||
105 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) | ||
106 | |||
107 | #define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY) | ||
108 | |||
109 | /* __pgprot defined in asm-ppc64/page.h */ | ||
110 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) | ||
111 | |||
112 | #define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER) | ||
113 | #define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER | _PAGE_EXEC) | ||
114 | #define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER) | ||
115 | #define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) | ||
116 | #define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER) | ||
117 | #define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) | ||
118 | #define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_WRENABLE) | ||
119 | #define PAGE_KERNEL_CI __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ | ||
120 | _PAGE_WRENABLE | _PAGE_NO_CACHE | _PAGE_GUARDED) | ||
121 | #define PAGE_KERNEL_EXEC __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_EXEC) | ||
122 | |||
123 | #define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) | ||
124 | #define HAVE_PAGE_AGP | ||
125 | |||
126 | /* | ||
127 | * This bit in a hardware PTE indicates that the page is *not* executable. | ||
128 | */ | ||
129 | #define HW_NO_EXEC _PAGE_EXEC | ||
130 | |||
131 | /* | ||
132 | * POWER4 and newer have per page execute protection, older chips can only | ||
133 | * do this on a segment (256MB) basis. | ||
134 | * | ||
135 | * Also, write permissions imply read permissions. | ||
136 | * This is the closest we can get.. | ||
137 | * | ||
138 | * Note due to the way vm flags are laid out, the bits are XWR | ||
139 | */ | ||
140 | #define __P000 PAGE_NONE | ||
141 | #define __P001 PAGE_READONLY | ||
142 | #define __P010 PAGE_COPY | ||
143 | #define __P011 PAGE_COPY | ||
144 | #define __P100 PAGE_READONLY_X | ||
145 | #define __P101 PAGE_READONLY_X | ||
146 | #define __P110 PAGE_COPY_X | ||
147 | #define __P111 PAGE_COPY_X | ||
148 | |||
149 | #define __S000 PAGE_NONE | ||
150 | #define __S001 PAGE_READONLY | ||
151 | #define __S010 PAGE_SHARED | ||
152 | #define __S011 PAGE_SHARED | ||
153 | #define __S100 PAGE_READONLY_X | ||
154 | #define __S101 PAGE_READONLY_X | ||
155 | #define __S110 PAGE_SHARED_X | ||
156 | #define __S111 PAGE_SHARED_X | ||
157 | |||
158 | #ifndef __ASSEMBLY__ | ||
159 | |||
160 | /* | ||
161 | * ZERO_PAGE is a global shared page that is always zero: used | ||
162 | * for zero-mapped memory areas etc.. | ||
163 | */ | ||
164 | extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)]; | ||
165 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | ||
166 | #endif /* __ASSEMBLY__ */ | ||
167 | |||
168 | /* shift to put page number into pte */ | ||
169 | #define PTE_SHIFT (17) | ||
170 | |||
171 | /* We allow 2^41 bytes of real memory, so we need 29 bits in the PMD | ||
172 | * to give the PTE page number. The bottom two bits are for flags. */ | ||
173 | #define PMD_TO_PTEPAGE_SHIFT (2) | ||
174 | |||
175 | #ifdef CONFIG_HUGETLB_PAGE | ||
176 | |||
177 | #ifndef __ASSEMBLY__ | ||
178 | int hash_huge_page(struct mm_struct *mm, unsigned long access, | ||
179 | unsigned long ea, unsigned long vsid, int local); | ||
180 | |||
181 | void hugetlb_mm_free_pgd(struct mm_struct *mm); | ||
182 | #endif /* __ASSEMBLY__ */ | ||
183 | |||
184 | #define HAVE_ARCH_UNMAPPED_AREA | ||
185 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN | ||
186 | #else | ||
187 | |||
188 | #define hash_huge_page(mm,a,ea,vsid,local) -1 | ||
189 | #define hugetlb_mm_free_pgd(mm) do {} while (0) | ||
190 | |||
191 | #endif | ||
192 | |||
193 | #ifndef __ASSEMBLY__ | ||
194 | |||
195 | /* | ||
196 | * Conversion functions: convert a page and protection to a page entry, | ||
197 | * and a page entry and page directory to the page they refer to. | ||
198 | * | ||
199 | * mk_pte takes a (struct page *) as input | ||
200 | */ | ||
201 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) | ||
202 | |||
203 | #define pfn_pte(pfn,pgprot) \ | ||
204 | ({ \ | ||
205 | pte_t pte; \ | ||
206 | pte_val(pte) = ((unsigned long)(pfn) << PTE_SHIFT) | \ | ||
207 | pgprot_val(pgprot); \ | ||
208 | pte; \ | ||
209 | }) | ||
210 | |||
211 | #define pte_modify(_pte, newprot) \ | ||
212 | (__pte((pte_val(_pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))) | ||
213 | |||
214 | #define pte_none(pte) ((pte_val(pte) & ~_PAGE_HPTEFLAGS) == 0) | ||
215 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | ||
216 | |||
217 | /* pte_clear moved to later in this file */ | ||
218 | |||
219 | #define pte_pfn(x) ((unsigned long)((pte_val(x) >> PTE_SHIFT))) | ||
220 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
221 | |||
222 | #define pmd_set(pmdp, ptep) \ | ||
223 | (pmd_val(*(pmdp)) = (__ba_to_bpn(ptep) << PMD_TO_PTEPAGE_SHIFT)) | ||
224 | #define pmd_none(pmd) (!pmd_val(pmd)) | ||
225 | #define pmd_bad(pmd) (pmd_val(pmd) == 0) | ||
226 | #define pmd_present(pmd) (pmd_val(pmd) != 0) | ||
227 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) | ||
228 | #define pmd_page_kernel(pmd) \ | ||
229 | (__bpn_to_ba(pmd_val(pmd) >> PMD_TO_PTEPAGE_SHIFT)) | ||
230 | #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) | ||
231 | #define pgd_set(pgdp, pmdp) (pgd_val(*(pgdp)) = (__ba_to_bpn(pmdp))) | ||
232 | #define pgd_none(pgd) (!pgd_val(pgd)) | ||
233 | #define pgd_bad(pgd) ((pgd_val(pgd)) == 0) | ||
234 | #define pgd_present(pgd) (pgd_val(pgd) != 0UL) | ||
235 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) | ||
236 | #define pgd_page(pgd) (__bpn_to_ba(pgd_val(pgd))) | ||
237 | |||
238 | /* | ||
239 | * Find an entry in a page-table-directory. We combine the address region | ||
240 | * (the high order N bits) and the pgd portion of the address. | ||
241 | */ | ||
242 | /* to avoid overflow in free_pgtables we don't use PTRS_PER_PGD here */ | ||
243 | #define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x7ff) | ||
244 | |||
245 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | ||
246 | |||
247 | /* Find an entry in the second-level page table.. */ | ||
248 | #define pmd_offset(dir,addr) \ | ||
249 | ((pmd_t *) pgd_page(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) | ||
250 | |||
251 | /* Find an entry in the third-level page table.. */ | ||
252 | #define pte_offset_kernel(dir,addr) \ | ||
253 | ((pte_t *) pmd_page_kernel(*(dir)) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) | ||
254 | |||
255 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) | ||
256 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) | ||
257 | #define pte_unmap(pte) do { } while(0) | ||
258 | #define pte_unmap_nested(pte) do { } while(0) | ||
259 | |||
260 | /* to find an entry in a kernel page-table-directory */ | ||
261 | /* This now only contains the vmalloc pages */ | ||
262 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
263 | |||
264 | /* to find an entry in the ioremap page-table-directory */ | ||
265 | #define pgd_offset_i(address) (ioremap_pgd + pgd_index(address)) | ||
266 | |||
267 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) | ||
268 | |||
269 | /* | ||
270 | * The following only work if pte_present() is true. | ||
271 | * Undefined behaviour if not.. | ||
272 | */ | ||
273 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER;} | ||
274 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;} | ||
275 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC;} | ||
276 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} | ||
277 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} | ||
278 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} | ||
279 | static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_HUGE;} | ||
280 | |||
281 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } | ||
282 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } | ||
283 | |||
284 | static inline pte_t pte_rdprotect(pte_t pte) { | ||
285 | pte_val(pte) &= ~_PAGE_USER; return pte; } | ||
286 | static inline pte_t pte_exprotect(pte_t pte) { | ||
287 | pte_val(pte) &= ~_PAGE_EXEC; return pte; } | ||
288 | static inline pte_t pte_wrprotect(pte_t pte) { | ||
289 | pte_val(pte) &= ~(_PAGE_RW); return pte; } | ||
290 | static inline pte_t pte_mkclean(pte_t pte) { | ||
291 | pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } | ||
292 | static inline pte_t pte_mkold(pte_t pte) { | ||
293 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | ||
294 | |||
295 | static inline pte_t pte_mkread(pte_t pte) { | ||
296 | pte_val(pte) |= _PAGE_USER; return pte; } | ||
297 | static inline pte_t pte_mkexec(pte_t pte) { | ||
298 | pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; } | ||
299 | static inline pte_t pte_mkwrite(pte_t pte) { | ||
300 | pte_val(pte) |= _PAGE_RW; return pte; } | ||
301 | static inline pte_t pte_mkdirty(pte_t pte) { | ||
302 | pte_val(pte) |= _PAGE_DIRTY; return pte; } | ||
303 | static inline pte_t pte_mkyoung(pte_t pte) { | ||
304 | pte_val(pte) |= _PAGE_ACCESSED; return pte; } | ||
305 | static inline pte_t pte_mkhuge(pte_t pte) { | ||
306 | pte_val(pte) |= _PAGE_HUGE; return pte; } | ||
307 | |||
308 | /* Atomic PTE updates */ | ||
309 | static inline unsigned long pte_update(pte_t *p, unsigned long clr) | ||
310 | { | ||
311 | unsigned long old, tmp; | ||
312 | |||
313 | __asm__ __volatile__( | ||
314 | "1: ldarx %0,0,%3 # pte_update\n\ | ||
315 | andi. %1,%0,%6\n\ | ||
316 | bne- 1b \n\ | ||
317 | andc %1,%0,%4 \n\ | ||
318 | stdcx. %1,0,%3 \n\ | ||
319 | bne- 1b" | ||
320 | : "=&r" (old), "=&r" (tmp), "=m" (*p) | ||
321 | : "r" (p), "r" (clr), "m" (*p), "i" (_PAGE_BUSY) | ||
322 | : "cc" ); | ||
323 | return old; | ||
324 | } | ||
325 | |||
326 | /* PTE updating functions, this function puts the PTE in the | ||
327 | * batch, doesn't actually triggers the hash flush immediately, | ||
328 | * you need to call flush_tlb_pending() to do that. | ||
329 | */ | ||
330 | extern void hpte_update(struct mm_struct *mm, unsigned long addr, unsigned long pte, | ||
331 | int wrprot); | ||
332 | |||
333 | static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
334 | { | ||
335 | unsigned long old; | ||
336 | |||
337 | if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0) | ||
338 | return 0; | ||
339 | old = pte_update(ptep, _PAGE_ACCESSED); | ||
340 | if (old & _PAGE_HASHPTE) { | ||
341 | hpte_update(mm, addr, old, 0); | ||
342 | flush_tlb_pending(); | ||
343 | } | ||
344 | return (old & _PAGE_ACCESSED) != 0; | ||
345 | } | ||
346 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | ||
347 | #define ptep_test_and_clear_young(__vma, __addr, __ptep) \ | ||
348 | ({ \ | ||
349 | int __r; \ | ||
350 | __r = __ptep_test_and_clear_young((__vma)->vm_mm, __addr, __ptep); \ | ||
351 | __r; \ | ||
352 | }) | ||
353 | |||
354 | /* | ||
355 | * On RW/DIRTY bit transitions we can avoid flushing the hpte. For the | ||
356 | * moment we always flush but we need to fix hpte_update and test if the | ||
357 | * optimisation is worth it. | ||
358 | */ | ||
359 | static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
360 | { | ||
361 | unsigned long old; | ||
362 | |||
363 | if ((pte_val(*ptep) & _PAGE_DIRTY) == 0) | ||
364 | return 0; | ||
365 | old = pte_update(ptep, _PAGE_DIRTY); | ||
366 | if (old & _PAGE_HASHPTE) | ||
367 | hpte_update(mm, addr, old, 0); | ||
368 | return (old & _PAGE_DIRTY) != 0; | ||
369 | } | ||
370 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY | ||
371 | #define ptep_test_and_clear_dirty(__vma, __addr, __ptep) \ | ||
372 | ({ \ | ||
373 | int __r; \ | ||
374 | __r = __ptep_test_and_clear_dirty((__vma)->vm_mm, __addr, __ptep); \ | ||
375 | __r; \ | ||
376 | }) | ||
377 | |||
378 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | ||
379 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
380 | { | ||
381 | unsigned long old; | ||
382 | |||
383 | if ((pte_val(*ptep) & _PAGE_RW) == 0) | ||
384 | return; | ||
385 | old = pte_update(ptep, _PAGE_RW); | ||
386 | if (old & _PAGE_HASHPTE) | ||
387 | hpte_update(mm, addr, old, 0); | ||
388 | } | ||
389 | |||
390 | /* | ||
391 | * We currently remove entries from the hashtable regardless of whether | ||
392 | * the entry was young or dirty. The generic routines only flush if the | ||
393 | * entry was young or dirty which is not good enough. | ||
394 | * | ||
395 | * We should be more intelligent about this but for the moment we override | ||
396 | * these functions and force a tlb flush unconditionally | ||
397 | */ | ||
398 | #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH | ||
399 | #define ptep_clear_flush_young(__vma, __address, __ptep) \ | ||
400 | ({ \ | ||
401 | int __young = __ptep_test_and_clear_young((__vma)->vm_mm, __address, \ | ||
402 | __ptep); \ | ||
403 | __young; \ | ||
404 | }) | ||
405 | |||
406 | #define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH | ||
407 | #define ptep_clear_flush_dirty(__vma, __address, __ptep) \ | ||
408 | ({ \ | ||
409 | int __dirty = __ptep_test_and_clear_dirty((__vma)->vm_mm, __address, \ | ||
410 | __ptep); \ | ||
411 | flush_tlb_page(__vma, __address); \ | ||
412 | __dirty; \ | ||
413 | }) | ||
414 | |||
415 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | ||
416 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
417 | { | ||
418 | unsigned long old = pte_update(ptep, ~0UL); | ||
419 | |||
420 | if (old & _PAGE_HASHPTE) | ||
421 | hpte_update(mm, addr, old, 0); | ||
422 | return __pte(old); | ||
423 | } | ||
424 | |||
425 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t * ptep) | ||
426 | { | ||
427 | unsigned long old = pte_update(ptep, ~0UL); | ||
428 | |||
429 | if (old & _PAGE_HASHPTE) | ||
430 | hpte_update(mm, addr, old, 0); | ||
431 | } | ||
432 | |||
433 | /* | ||
434 | * set_pte stores a linux PTE into the linux page table. | ||
435 | */ | ||
436 | static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | ||
437 | pte_t *ptep, pte_t pte) | ||
438 | { | ||
439 | if (pte_present(*ptep)) { | ||
440 | pte_clear(mm, addr, ptep); | ||
441 | flush_tlb_pending(); | ||
442 | } | ||
443 | *ptep = __pte(pte_val(pte)) & ~_PAGE_HPTEFLAGS; | ||
444 | } | ||
445 | |||
446 | /* Set the dirty and/or accessed bits atomically in a linux PTE, this | ||
447 | * function doesn't need to flush the hash entry | ||
448 | */ | ||
449 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | ||
450 | static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty) | ||
451 | { | ||
452 | unsigned long bits = pte_val(entry) & | ||
453 | (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); | ||
454 | unsigned long old, tmp; | ||
455 | |||
456 | __asm__ __volatile__( | ||
457 | "1: ldarx %0,0,%4\n\ | ||
458 | andi. %1,%0,%6\n\ | ||
459 | bne- 1b \n\ | ||
460 | or %0,%3,%0\n\ | ||
461 | stdcx. %0,0,%4\n\ | ||
462 | bne- 1b" | ||
463 | :"=&r" (old), "=&r" (tmp), "=m" (*ptep) | ||
464 | :"r" (bits), "r" (ptep), "m" (*ptep), "i" (_PAGE_BUSY) | ||
465 | :"cc"); | ||
466 | } | ||
467 | #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ | ||
468 | do { \ | ||
469 | __ptep_set_access_flags(__ptep, __entry, __dirty); \ | ||
470 | flush_tlb_page_nohash(__vma, __address); \ | ||
471 | } while(0) | ||
472 | |||
473 | /* | ||
474 | * Macro to mark a page protection value as "uncacheable". | ||
475 | */ | ||
476 | #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED)) | ||
477 | |||
478 | struct file; | ||
479 | extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr, | ||
480 | unsigned long size, pgprot_t vma_prot); | ||
481 | #define __HAVE_PHYS_MEM_ACCESS_PROT | ||
482 | |||
483 | #define __HAVE_ARCH_PTE_SAME | ||
484 | #define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) | ||
485 | |||
486 | extern unsigned long ioremap_bot, ioremap_base; | ||
487 | |||
488 | #define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT) | ||
489 | #define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS) | ||
490 | |||
491 | #define pte_ERROR(e) \ | ||
492 | printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) | ||
493 | #define pmd_ERROR(e) \ | ||
494 | printk("%s:%d: bad pmd %08x.\n", __FILE__, __LINE__, pmd_val(e)) | ||
495 | #define pgd_ERROR(e) \ | ||
496 | printk("%s:%d: bad pgd %08x.\n", __FILE__, __LINE__, pgd_val(e)) | ||
497 | |||
498 | extern pgd_t swapper_pg_dir[1024]; | ||
499 | extern pgd_t ioremap_dir[1024]; | ||
500 | |||
501 | extern void paging_init(void); | ||
502 | |||
503 | struct mmu_gather; | ||
504 | void hugetlb_free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *prev, | ||
505 | unsigned long start, unsigned long end); | ||
506 | |||
507 | /* | ||
508 | * This gets called at the end of handling a page fault, when | ||
509 | * the kernel has put a new PTE into the page table for the process. | ||
510 | * We use it to put a corresponding HPTE into the hash table | ||
511 | * ahead of time, instead of waiting for the inevitable extra | ||
512 | * hash-table miss exception. | ||
513 | */ | ||
514 | struct vm_area_struct; | ||
515 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | ||
516 | |||
517 | /* Encode and de-code a swap entry */ | ||
518 | #define __swp_type(entry) (((entry).val >> 1) & 0x3f) | ||
519 | #define __swp_offset(entry) ((entry).val >> 8) | ||
520 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) | ||
521 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> PTE_SHIFT }) | ||
522 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << PTE_SHIFT }) | ||
523 | #define pte_to_pgoff(pte) (pte_val(pte) >> PTE_SHIFT) | ||
524 | #define pgoff_to_pte(off) ((pte_t) {((off) << PTE_SHIFT)|_PAGE_FILE}) | ||
525 | #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_SHIFT) | ||
526 | |||
527 | /* | ||
528 | * kern_addr_valid is intended to indicate whether an address is a valid | ||
529 | * kernel address. Most 32-bit archs define it as always true (like this) | ||
530 | * but most 64-bit archs actually perform a test. What should we do here? | ||
531 | * The only use is in fs/ncpfs/dir.c | ||
532 | */ | ||
533 | #define kern_addr_valid(addr) (1) | ||
534 | |||
535 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ | ||
536 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) | ||
537 | |||
538 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | ||
539 | remap_pfn_range(vma, vaddr, pfn, size, prot) | ||
540 | |||
541 | #define MK_IOSPACE_PFN(space, pfn) (pfn) | ||
542 | #define GET_IOSPACE(pfn) 0 | ||
543 | #define GET_PFN(pfn) (pfn) | ||
544 | |||
545 | void pgtable_cache_init(void); | ||
546 | |||
547 | extern void hpte_init_native(void); | ||
548 | extern void hpte_init_lpar(void); | ||
549 | extern void hpte_init_iSeries(void); | ||
550 | |||
551 | /* imalloc region types */ | ||
552 | #define IM_REGION_UNUSED 0x1 | ||
553 | #define IM_REGION_SUBSET 0x2 | ||
554 | #define IM_REGION_EXISTS 0x4 | ||
555 | #define IM_REGION_OVERLAP 0x8 | ||
556 | #define IM_REGION_SUPERSET 0x10 | ||
557 | |||
558 | extern struct vm_struct * im_get_free_area(unsigned long size); | ||
559 | extern struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size, | ||
560 | int region_type); | ||
561 | unsigned long im_free(void *addr); | ||
562 | |||
563 | extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, | ||
564 | unsigned long va, unsigned long prpn, | ||
565 | int secondary, unsigned long hpteflags, | ||
566 | int bolted, int large); | ||
567 | |||
568 | extern long native_hpte_insert(unsigned long hpte_group, unsigned long va, | ||
569 | unsigned long prpn, int secondary, | ||
570 | unsigned long hpteflags, int bolted, int large); | ||
571 | |||
572 | /* | ||
573 | * find_linux_pte returns the address of a linux pte for a given | ||
574 | * effective address and directory. If not found, it returns zero. | ||
575 | */ | ||
576 | static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea) | ||
577 | { | ||
578 | pgd_t *pg; | ||
579 | pmd_t *pm; | ||
580 | pte_t *pt = NULL; | ||
581 | pte_t pte; | ||
582 | |||
583 | pg = pgdir + pgd_index(ea); | ||
584 | if (!pgd_none(*pg)) { | ||
585 | |||
586 | pm = pmd_offset(pg, ea); | ||
587 | if (pmd_present(*pm)) { | ||
588 | pt = pte_offset_kernel(pm, ea); | ||
589 | pte = *pt; | ||
590 | if (!pte_present(pte)) | ||
591 | pt = NULL; | ||
592 | } | ||
593 | } | ||
594 | |||
595 | return pt; | ||
596 | } | ||
597 | |||
598 | #include <asm-generic/pgtable.h> | ||
599 | |||
600 | #endif /* __ASSEMBLY__ */ | ||
601 | |||
602 | #endif /* _PPC64_PGTABLE_H */ | ||
diff --git a/include/asm-ppc64/plpar_wrappers.h b/include/asm-ppc64/plpar_wrappers.h new file mode 100644 index 000000000000..f4a5fb7d67c7 --- /dev/null +++ b/include/asm-ppc64/plpar_wrappers.h | |||
@@ -0,0 +1,111 @@ | |||
1 | #ifndef _PPC64_PLPAR_WRAPPERS_H | ||
2 | #define _PPC64_PLPAR_WRAPPERS_H | ||
3 | |||
4 | #include <asm/hvcall.h> | ||
5 | |||
6 | static inline long poll_pending(void) | ||
7 | { | ||
8 | unsigned long dummy; | ||
9 | return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, | ||
10 | &dummy, &dummy, &dummy); | ||
11 | } | ||
12 | |||
13 | static inline long prod_processor(void) | ||
14 | { | ||
15 | plpar_hcall_norets(H_PROD); | ||
16 | return(0); | ||
17 | } | ||
18 | |||
19 | static inline long cede_processor(void) | ||
20 | { | ||
21 | plpar_hcall_norets(H_CEDE); | ||
22 | return(0); | ||
23 | } | ||
24 | |||
25 | static inline long register_vpa(unsigned long flags, unsigned long proc, | ||
26 | unsigned long vpa) | ||
27 | { | ||
28 | return plpar_hcall_norets(H_REGISTER_VPA, flags, proc, vpa); | ||
29 | } | ||
30 | |||
31 | void vpa_init(int cpu); | ||
32 | |||
33 | static inline long plpar_pte_remove(unsigned long flags, | ||
34 | unsigned long ptex, | ||
35 | unsigned long avpn, | ||
36 | unsigned long *old_pteh_ret, | ||
37 | unsigned long *old_ptel_ret) | ||
38 | { | ||
39 | unsigned long dummy; | ||
40 | return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, | ||
41 | old_pteh_ret, old_ptel_ret, &dummy); | ||
42 | } | ||
43 | |||
44 | static inline long plpar_pte_read(unsigned long flags, | ||
45 | unsigned long ptex, | ||
46 | unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) | ||
47 | { | ||
48 | unsigned long dummy; | ||
49 | return plpar_hcall(H_READ, flags, ptex, 0, 0, | ||
50 | old_pteh_ret, old_ptel_ret, &dummy); | ||
51 | } | ||
52 | |||
53 | static inline long plpar_pte_protect(unsigned long flags, | ||
54 | unsigned long ptex, | ||
55 | unsigned long avpn) | ||
56 | { | ||
57 | return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn); | ||
58 | } | ||
59 | |||
60 | static inline long plpar_tce_get(unsigned long liobn, | ||
61 | unsigned long ioba, | ||
62 | unsigned long *tce_ret) | ||
63 | { | ||
64 | unsigned long dummy; | ||
65 | return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, | ||
66 | tce_ret, &dummy, &dummy); | ||
67 | } | ||
68 | |||
69 | static inline long plpar_tce_put(unsigned long liobn, | ||
70 | unsigned long ioba, | ||
71 | unsigned long tceval) | ||
72 | { | ||
73 | return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval); | ||
74 | } | ||
75 | |||
76 | static inline long plpar_tce_put_indirect(unsigned long liobn, | ||
77 | unsigned long ioba, | ||
78 | unsigned long page, | ||
79 | unsigned long count) | ||
80 | { | ||
81 | return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count); | ||
82 | } | ||
83 | |||
84 | static inline long plpar_tce_stuff(unsigned long liobn, | ||
85 | unsigned long ioba, | ||
86 | unsigned long tceval, | ||
87 | unsigned long count) | ||
88 | { | ||
89 | return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count); | ||
90 | } | ||
91 | |||
92 | static inline long plpar_get_term_char(unsigned long termno, | ||
93 | unsigned long *len_ret, | ||
94 | char *buf_ret) | ||
95 | { | ||
96 | unsigned long *lbuf = (unsigned long *)buf_ret; /* ToDo: alignment? */ | ||
97 | return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, | ||
98 | len_ret, lbuf+0, lbuf+1); | ||
99 | } | ||
100 | |||
101 | static inline long plpar_put_term_char(unsigned long termno, | ||
102 | unsigned long len, | ||
103 | const char *buffer) | ||
104 | { | ||
105 | unsigned long *lbuf = (unsigned long *)buffer; /* ToDo: alignment? */ | ||
106 | return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0], | ||
107 | lbuf[1]); | ||
108 | } | ||
109 | |||
110 | |||
111 | #endif /* _PPC64_PLPAR_WRAPPERS_H */ | ||
diff --git a/include/asm-ppc64/pmac_feature.h b/include/asm-ppc64/pmac_feature.h new file mode 100644 index 000000000000..e07e36c4cbb2 --- /dev/null +++ b/include/asm-ppc64/pmac_feature.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <asm-ppc/pmac_feature.h> | ||
2 | |||
diff --git a/include/asm-ppc64/pmac_low_i2c.h b/include/asm-ppc64/pmac_low_i2c.h new file mode 100644 index 000000000000..7bcfc72c5c8a --- /dev/null +++ b/include/asm-ppc64/pmac_low_i2c.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <asm-ppc/pmac_low_i2c.h> | ||
2 | |||
diff --git a/include/asm-ppc64/pmc.h b/include/asm-ppc64/pmc.h new file mode 100644 index 000000000000..c924748c0bea --- /dev/null +++ b/include/asm-ppc64/pmc.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * pmc.h | ||
3 | * Copyright (C) 2004 David Gibson, IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _PPC64_PMC_H | ||
20 | #define _PPC64_PMC_H | ||
21 | |||
22 | #include <asm/ptrace.h> | ||
23 | |||
24 | typedef void (*perf_irq_t)(struct pt_regs *); | ||
25 | |||
26 | int reserve_pmc_hardware(perf_irq_t new_perf_irq); | ||
27 | void release_pmc_hardware(void); | ||
28 | |||
29 | #endif /* _PPC64_PMC_H */ | ||
diff --git a/include/asm-ppc64/poll.h b/include/asm-ppc64/poll.h new file mode 100644 index 000000000000..370fa3ba0db4 --- /dev/null +++ b/include/asm-ppc64/poll.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef __PPC64_POLL_H | ||
2 | #define __PPC64_POLL_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2001 PPC64 Team, IBM Corp | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #define POLLIN 0x0001 | ||
14 | #define POLLPRI 0x0002 | ||
15 | #define POLLOUT 0x0004 | ||
16 | #define POLLERR 0x0008 | ||
17 | #define POLLHUP 0x0010 | ||
18 | #define POLLNVAL 0x0020 | ||
19 | #define POLLRDNORM 0x0040 | ||
20 | #define POLLRDBAND 0x0080 | ||
21 | #define POLLWRNORM 0x0100 | ||
22 | #define POLLWRBAND 0x0200 | ||
23 | #define POLLMSG 0x0400 | ||
24 | #define POLLREMOVE 0x1000 | ||
25 | |||
26 | struct pollfd { | ||
27 | int fd; | ||
28 | short events; | ||
29 | short revents; | ||
30 | }; | ||
31 | |||
32 | #endif /* __PPC64_POLL_H */ | ||
diff --git a/include/asm-ppc64/posix_types.h b/include/asm-ppc64/posix_types.h new file mode 100644 index 000000000000..516de7201b5d --- /dev/null +++ b/include/asm-ppc64/posix_types.h | |||
@@ -0,0 +1,119 @@ | |||
1 | #ifndef _PPC64_POSIX_TYPES_H | ||
2 | #define _PPC64_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 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | typedef unsigned long __kernel_ino_t; | ||
16 | typedef unsigned long __kernel_nlink_t; | ||
17 | typedef unsigned int __kernel_mode_t; | ||
18 | typedef long __kernel_off_t; | ||
19 | typedef long long __kernel_loff_t; | ||
20 | typedef int __kernel_pid_t; | ||
21 | typedef int __kernel_ipc_pid_t; | ||
22 | typedef unsigned int __kernel_uid_t; | ||
23 | typedef unsigned int __kernel_gid_t; | ||
24 | typedef unsigned long __kernel_size_t; | ||
25 | typedef long __kernel_ssize_t; | ||
26 | typedef long __kernel_ptrdiff_t; | ||
27 | typedef long __kernel_time_t; | ||
28 | typedef int __kernel_timer_t; | ||
29 | typedef int __kernel_clockid_t; | ||
30 | typedef long __kernel_suseconds_t; | ||
31 | typedef long __kernel_clock_t; | ||
32 | typedef int __kernel_daddr_t; | ||
33 | typedef char * __kernel_caddr_t; | ||
34 | typedef unsigned short __kernel_uid16_t; | ||
35 | typedef unsigned short __kernel_gid16_t; | ||
36 | typedef unsigned int __kernel_uid32_t; | ||
37 | typedef unsigned int __kernel_gid32_t; | ||
38 | |||
39 | typedef unsigned int __kernel_old_uid_t; | ||
40 | typedef unsigned int __kernel_old_gid_t; | ||
41 | typedef unsigned long __kernel_old_dev_t; | ||
42 | |||
43 | typedef struct { | ||
44 | int val[2]; | ||
45 | } __kernel_fsid_t; | ||
46 | |||
47 | #ifndef __GNUC__ | ||
48 | |||
49 | #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) | ||
50 | #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) | ||
51 | #define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) | ||
52 | #define __FD_ZERO(set) \ | ||
53 | ((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set))) | ||
54 | |||
55 | #else /* __GNUC__ */ | ||
56 | |||
57 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \ | ||
58 | || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0) | ||
59 | /* With GNU C, use inline functions instead so args are evaluated only once: */ | ||
60 | |||
61 | #undef __FD_SET | ||
62 | static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) | ||
63 | { | ||
64 | unsigned long _tmp = fd / __NFDBITS; | ||
65 | unsigned long _rem = fd % __NFDBITS; | ||
66 | fdsetp->fds_bits[_tmp] |= (1UL<<_rem); | ||
67 | } | ||
68 | |||
69 | #undef __FD_CLR | ||
70 | static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) | ||
71 | { | ||
72 | unsigned long _tmp = fd / __NFDBITS; | ||
73 | unsigned long _rem = fd % __NFDBITS; | ||
74 | fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); | ||
75 | } | ||
76 | |||
77 | #undef __FD_ISSET | ||
78 | static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p) | ||
79 | { | ||
80 | unsigned long _tmp = fd / __NFDBITS; | ||
81 | unsigned long _rem = fd % __NFDBITS; | ||
82 | return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; | ||
83 | } | ||
84 | |||
85 | /* | ||
86 | * This will unroll the loop for the normal constant case (8 ints, | ||
87 | * for a 256-bit fd_set) | ||
88 | */ | ||
89 | #undef __FD_ZERO | ||
90 | static __inline__ void __FD_ZERO(__kernel_fd_set *p) | ||
91 | { | ||
92 | unsigned long *tmp = (unsigned long *)p->fds_bits; | ||
93 | int i; | ||
94 | |||
95 | if (__builtin_constant_p(__FDSET_LONGS)) { | ||
96 | switch (__FDSET_LONGS) { | ||
97 | case 16: | ||
98 | tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; | ||
99 | tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; | ||
100 | |||
101 | case 8: | ||
102 | tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; | ||
103 | |||
104 | case 4: | ||
105 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
106 | return; | ||
107 | } | ||
108 | } | ||
109 | i = __FDSET_LONGS; | ||
110 | while (i) { | ||
111 | i--; | ||
112 | *tmp = 0; | ||
113 | tmp++; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ | ||
118 | #endif /* __GNUC__ */ | ||
119 | #endif /* _PPC64_POSIX_TYPES_H */ | ||
diff --git a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h new file mode 100644 index 000000000000..1d0404897550 --- /dev/null +++ b/include/asm-ppc64/ppc32.h | |||
@@ -0,0 +1,122 @@ | |||
1 | #ifndef _PPC64_PPC32_H | ||
2 | #define _PPC64_PPC32_H | ||
3 | |||
4 | #include <linux/compat.h> | ||
5 | #include <asm/siginfo.h> | ||
6 | #include <asm/signal.h> | ||
7 | |||
8 | /* | ||
9 | * Data types and macros for providing 32b PowerPC support. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | /* These are here to support 32-bit syscalls on a 64-bit kernel. */ | ||
18 | |||
19 | typedef struct compat_siginfo { | ||
20 | int si_signo; | ||
21 | int si_errno; | ||
22 | int si_code; | ||
23 | |||
24 | union { | ||
25 | int _pad[SI_PAD_SIZE32]; | ||
26 | |||
27 | /* kill() */ | ||
28 | struct { | ||
29 | compat_pid_t _pid; /* sender's pid */ | ||
30 | compat_uid_t _uid; /* sender's uid */ | ||
31 | } _kill; | ||
32 | |||
33 | /* POSIX.1b timers */ | ||
34 | struct { | ||
35 | timer_t _tid; /* timer id */ | ||
36 | int _overrun; /* overrun count */ | ||
37 | compat_sigval_t _sigval; /* same as below */ | ||
38 | int _sys_private; /* not to be passed to user */ | ||
39 | } _timer; | ||
40 | |||
41 | /* POSIX.1b signals */ | ||
42 | struct { | ||
43 | compat_pid_t _pid; /* sender's pid */ | ||
44 | compat_uid_t _uid; /* sender's uid */ | ||
45 | compat_sigval_t _sigval; | ||
46 | } _rt; | ||
47 | |||
48 | /* SIGCHLD */ | ||
49 | struct { | ||
50 | compat_pid_t _pid; /* which child */ | ||
51 | compat_uid_t _uid; /* sender's uid */ | ||
52 | int _status; /* exit code */ | ||
53 | compat_clock_t _utime; | ||
54 | compat_clock_t _stime; | ||
55 | } _sigchld; | ||
56 | |||
57 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */ | ||
58 | struct { | ||
59 | unsigned int _addr; /* faulting insn/memory ref. */ | ||
60 | } _sigfault; | ||
61 | |||
62 | /* SIGPOLL */ | ||
63 | struct { | ||
64 | int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ | ||
65 | int _fd; | ||
66 | } _sigpoll; | ||
67 | } _sifields; | ||
68 | } compat_siginfo_t; | ||
69 | |||
70 | #define __old_sigaction32 old_sigaction32 | ||
71 | |||
72 | struct __old_sigaction32 { | ||
73 | unsigned sa_handler; | ||
74 | compat_old_sigset_t sa_mask; | ||
75 | unsigned int sa_flags; | ||
76 | unsigned sa_restorer; /* not used by Linux/SPARC yet */ | ||
77 | }; | ||
78 | |||
79 | |||
80 | |||
81 | struct sigaction32 { | ||
82 | unsigned int sa_handler; /* Really a pointer, but need to deal with 32 bits */ | ||
83 | unsigned int sa_flags; | ||
84 | unsigned int sa_restorer; /* Another 32 bit pointer */ | ||
85 | compat_sigset_t sa_mask; /* A 32 bit mask */ | ||
86 | }; | ||
87 | |||
88 | typedef struct sigaltstack_32 { | ||
89 | unsigned int ss_sp; | ||
90 | int ss_flags; | ||
91 | compat_size_t ss_size; | ||
92 | } stack_32_t; | ||
93 | |||
94 | struct sigcontext32 { | ||
95 | unsigned int _unused[4]; | ||
96 | int signal; | ||
97 | unsigned int handler; | ||
98 | unsigned int oldmask; | ||
99 | u32 regs; /* 4 byte pointer to the pt_regs32 structure. */ | ||
100 | }; | ||
101 | |||
102 | struct mcontext32 { | ||
103 | elf_gregset_t32 mc_gregs; | ||
104 | elf_fpregset_t mc_fregs; | ||
105 | unsigned int mc_pad[2]; | ||
106 | elf_vrregset_t32 mc_vregs __attribute__((__aligned__(16))); | ||
107 | }; | ||
108 | |||
109 | struct ucontext32 { | ||
110 | unsigned int uc_flags; | ||
111 | unsigned int uc_link; | ||
112 | stack_32_t uc_stack; | ||
113 | int uc_pad[7]; | ||
114 | u32 uc_regs; /* points to uc_mcontext field */ | ||
115 | compat_sigset_t uc_sigmask; /* mask last for extensibility */ | ||
116 | /* glibc has 1024-bit signal masks, ours are 64-bit */ | ||
117 | int uc_maskext[30]; | ||
118 | int uc_pad2[3]; | ||
119 | struct mcontext32 uc_mcontext; | ||
120 | }; | ||
121 | |||
122 | #endif /* _PPC64_PPC32_H */ | ||
diff --git a/include/asm-ppc64/ppc_asm.h b/include/asm-ppc64/ppc_asm.h new file mode 100644 index 000000000000..9031d8a29aca --- /dev/null +++ b/include/asm-ppc64/ppc_asm.h | |||
@@ -0,0 +1,242 @@ | |||
1 | /* | ||
2 | * arch/ppc64/kernel/ppc_asm.h | ||
3 | * | ||
4 | * Definitions used by various bits of low-level assembly code on PowerPC. | ||
5 | * | ||
6 | * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #ifndef _PPC64_PPC_ASM_H | ||
15 | #define _PPC64_PPC_ASM_H | ||
16 | /* | ||
17 | * Macros for storing registers into and loading registers from | ||
18 | * exception frames. | ||
19 | */ | ||
20 | #define SAVE_GPR(n, base) std n,GPR0+8*(n)(base) | ||
21 | #define SAVE_2GPRS(n, base) SAVE_GPR(n, base); SAVE_GPR(n+1, base) | ||
22 | #define SAVE_4GPRS(n, base) SAVE_2GPRS(n, base); SAVE_2GPRS(n+2, base) | ||
23 | #define SAVE_8GPRS(n, base) SAVE_4GPRS(n, base); SAVE_4GPRS(n+4, base) | ||
24 | #define SAVE_10GPRS(n, base) SAVE_8GPRS(n, base); SAVE_2GPRS(n+8, base) | ||
25 | #define REST_GPR(n, base) ld n,GPR0+8*(n)(base) | ||
26 | #define REST_2GPRS(n, base) REST_GPR(n, base); REST_GPR(n+1, base) | ||
27 | #define REST_4GPRS(n, base) REST_2GPRS(n, base); REST_2GPRS(n+2, base) | ||
28 | #define REST_8GPRS(n, base) REST_4GPRS(n, base); REST_4GPRS(n+4, base) | ||
29 | #define REST_10GPRS(n, base) REST_8GPRS(n, base); REST_2GPRS(n+8, base) | ||
30 | |||
31 | #define SAVE_NVGPRS(base) SAVE_8GPRS(14, base); SAVE_10GPRS(22, base) | ||
32 | #define REST_NVGPRS(base) REST_8GPRS(14, base); REST_10GPRS(22, base) | ||
33 | |||
34 | #define SAVE_FPR(n, base) stfd n,THREAD_FPR0+8*(n)(base) | ||
35 | #define SAVE_2FPRS(n, base) SAVE_FPR(n, base); SAVE_FPR(n+1, base) | ||
36 | #define SAVE_4FPRS(n, base) SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base) | ||
37 | #define SAVE_8FPRS(n, base) SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base) | ||
38 | #define SAVE_16FPRS(n, base) SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base) | ||
39 | #define SAVE_32FPRS(n, base) SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base) | ||
40 | #define REST_FPR(n, base) lfd n,THREAD_FPR0+8*(n)(base) | ||
41 | #define REST_2FPRS(n, base) REST_FPR(n, base); REST_FPR(n+1, base) | ||
42 | #define REST_4FPRS(n, base) REST_2FPRS(n, base); REST_2FPRS(n+2, base) | ||
43 | #define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base) | ||
44 | #define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base) | ||
45 | #define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base) | ||
46 | |||
47 | #define SAVE_VR(n,b,base) li b,THREAD_VR0+(16*(n)); stvx n,b,base | ||
48 | #define SAVE_2VRS(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base) | ||
49 | #define SAVE_4VRS(n,b,base) SAVE_2VRS(n,b,base); SAVE_2VRS(n+2,b,base) | ||
50 | #define SAVE_8VRS(n,b,base) SAVE_4VRS(n,b,base); SAVE_4VRS(n+4,b,base) | ||
51 | #define SAVE_16VRS(n,b,base) SAVE_8VRS(n,b,base); SAVE_8VRS(n+8,b,base) | ||
52 | #define SAVE_32VRS(n,b,base) SAVE_16VRS(n,b,base); SAVE_16VRS(n+16,b,base) | ||
53 | #define REST_VR(n,b,base) li b,THREAD_VR0+(16*(n)); lvx n,b,base | ||
54 | #define REST_2VRS(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base) | ||
55 | #define REST_4VRS(n,b,base) REST_2VRS(n,b,base); REST_2VRS(n+2,b,base) | ||
56 | #define REST_8VRS(n,b,base) REST_4VRS(n,b,base); REST_4VRS(n+4,b,base) | ||
57 | #define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base) | ||
58 | #define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base) | ||
59 | |||
60 | /* Macros to adjust thread priority for Iseries hardware multithreading */ | ||
61 | #define HMT_LOW or 1,1,1 | ||
62 | #define HMT_MEDIUM or 2,2,2 | ||
63 | #define HMT_HIGH or 3,3,3 | ||
64 | |||
65 | /* Insert the high 32 bits of the MSR into what will be the new | ||
66 | MSR (via SRR1 and rfid) This preserves the MSR.SF and MSR.ISF | ||
67 | bits. */ | ||
68 | |||
69 | #define FIX_SRR1(ra, rb) \ | ||
70 | mr rb,ra; \ | ||
71 | mfmsr ra; \ | ||
72 | rldimi ra,rb,0,32 | ||
73 | |||
74 | #define CLR_TOP32(r) rlwinm (r),(r),0,0,31 /* clear top 32 bits */ | ||
75 | |||
76 | /* | ||
77 | * LOADADDR( rn, name ) | ||
78 | * loads the address of 'name' into 'rn' | ||
79 | * | ||
80 | * LOADBASE( rn, name ) | ||
81 | * loads the address (less the low 16 bits) of 'name' into 'rn' | ||
82 | * suitable for base+disp addressing | ||
83 | */ | ||
84 | #define LOADADDR(rn,name) \ | ||
85 | lis rn,name##@highest; \ | ||
86 | ori rn,rn,name##@higher; \ | ||
87 | rldicr rn,rn,32,31; \ | ||
88 | oris rn,rn,name##@h; \ | ||
89 | ori rn,rn,name##@l | ||
90 | |||
91 | #define LOADBASE(rn,name) \ | ||
92 | lis rn,name@highest; \ | ||
93 | ori rn,rn,name@higher; \ | ||
94 | rldicr rn,rn,32,31; \ | ||
95 | oris rn,rn,name@ha | ||
96 | |||
97 | |||
98 | #define SET_REG_TO_CONST(reg, value) \ | ||
99 | lis reg,(((value)>>48)&0xFFFF); \ | ||
100 | ori reg,reg,(((value)>>32)&0xFFFF); \ | ||
101 | rldicr reg,reg,32,31; \ | ||
102 | oris reg,reg,(((value)>>16)&0xFFFF); \ | ||
103 | ori reg,reg,((value)&0xFFFF); | ||
104 | |||
105 | #define SET_REG_TO_LABEL(reg, label) \ | ||
106 | lis reg,(label)@highest; \ | ||
107 | ori reg,reg,(label)@higher; \ | ||
108 | rldicr reg,reg,32,31; \ | ||
109 | oris reg,reg,(label)@h; \ | ||
110 | ori reg,reg,(label)@l; | ||
111 | |||
112 | |||
113 | /* PPPBBB - DRENG If KERNELBASE is always 0xC0..., | ||
114 | * Then we can easily do this with one asm insn. -Peter | ||
115 | */ | ||
116 | #define tophys(rd,rs) \ | ||
117 | lis rd,((KERNELBASE>>48)&0xFFFF); \ | ||
118 | rldicr rd,rd,32,31; \ | ||
119 | sub rd,rs,rd | ||
120 | |||
121 | #define tovirt(rd,rs) \ | ||
122 | lis rd,((KERNELBASE>>48)&0xFFFF); \ | ||
123 | rldicr rd,rd,32,31; \ | ||
124 | add rd,rs,rd | ||
125 | |||
126 | /* Condition Register Bit Fields */ | ||
127 | |||
128 | #define cr0 0 | ||
129 | #define cr1 1 | ||
130 | #define cr2 2 | ||
131 | #define cr3 3 | ||
132 | #define cr4 4 | ||
133 | #define cr5 5 | ||
134 | #define cr6 6 | ||
135 | #define cr7 7 | ||
136 | |||
137 | |||
138 | /* General Purpose Registers (GPRs) */ | ||
139 | |||
140 | #define r0 0 | ||
141 | #define r1 1 | ||
142 | #define r2 2 | ||
143 | #define r3 3 | ||
144 | #define r4 4 | ||
145 | #define r5 5 | ||
146 | #define r6 6 | ||
147 | #define r7 7 | ||
148 | #define r8 8 | ||
149 | #define r9 9 | ||
150 | #define r10 10 | ||
151 | #define r11 11 | ||
152 | #define r12 12 | ||
153 | #define r13 13 | ||
154 | #define r14 14 | ||
155 | #define r15 15 | ||
156 | #define r16 16 | ||
157 | #define r17 17 | ||
158 | #define r18 18 | ||
159 | #define r19 19 | ||
160 | #define r20 20 | ||
161 | #define r21 21 | ||
162 | #define r22 22 | ||
163 | #define r23 23 | ||
164 | #define r24 24 | ||
165 | #define r25 25 | ||
166 | #define r26 26 | ||
167 | #define r27 27 | ||
168 | #define r28 28 | ||
169 | #define r29 29 | ||
170 | #define r30 30 | ||
171 | #define r31 31 | ||
172 | |||
173 | |||
174 | /* Floating Point Registers (FPRs) */ | ||
175 | |||
176 | #define fr0 0 | ||
177 | #define fr1 1 | ||
178 | #define fr2 2 | ||
179 | #define fr3 3 | ||
180 | #define fr4 4 | ||
181 | #define fr5 5 | ||
182 | #define fr6 6 | ||
183 | #define fr7 7 | ||
184 | #define fr8 8 | ||
185 | #define fr9 9 | ||
186 | #define fr10 10 | ||
187 | #define fr11 11 | ||
188 | #define fr12 12 | ||
189 | #define fr13 13 | ||
190 | #define fr14 14 | ||
191 | #define fr15 15 | ||
192 | #define fr16 16 | ||
193 | #define fr17 17 | ||
194 | #define fr18 18 | ||
195 | #define fr19 19 | ||
196 | #define fr20 20 | ||
197 | #define fr21 21 | ||
198 | #define fr22 22 | ||
199 | #define fr23 23 | ||
200 | #define fr24 24 | ||
201 | #define fr25 25 | ||
202 | #define fr26 26 | ||
203 | #define fr27 27 | ||
204 | #define fr28 28 | ||
205 | #define fr29 29 | ||
206 | #define fr30 30 | ||
207 | #define fr31 31 | ||
208 | |||
209 | #define vr0 0 | ||
210 | #define vr1 1 | ||
211 | #define vr2 2 | ||
212 | #define vr3 3 | ||
213 | #define vr4 4 | ||
214 | #define vr5 5 | ||
215 | #define vr6 6 | ||
216 | #define vr7 7 | ||
217 | #define vr8 8 | ||
218 | #define vr9 9 | ||
219 | #define vr10 10 | ||
220 | #define vr11 11 | ||
221 | #define vr12 12 | ||
222 | #define vr13 13 | ||
223 | #define vr14 14 | ||
224 | #define vr15 15 | ||
225 | #define vr16 16 | ||
226 | #define vr17 17 | ||
227 | #define vr18 18 | ||
228 | #define vr19 19 | ||
229 | #define vr20 20 | ||
230 | #define vr21 21 | ||
231 | #define vr22 22 | ||
232 | #define vr23 23 | ||
233 | #define vr24 24 | ||
234 | #define vr25 25 | ||
235 | #define vr26 26 | ||
236 | #define vr27 27 | ||
237 | #define vr28 28 | ||
238 | #define vr29 29 | ||
239 | #define vr30 30 | ||
240 | #define vr31 31 | ||
241 | |||
242 | #endif /* _PPC64_PPC_ASM_H */ | ||
diff --git a/include/asm-ppc64/ppcdebug.h b/include/asm-ppc64/ppcdebug.h new file mode 100644 index 000000000000..fd7f696065c4 --- /dev/null +++ b/include/asm-ppc64/ppcdebug.h | |||
@@ -0,0 +1,108 @@ | |||
1 | #ifndef __PPCDEBUG_H | ||
2 | #define __PPCDEBUG_H | ||
3 | /******************************************************************** | ||
4 | * Author: Adam Litke, IBM Corp | ||
5 | * (c) 2001 | ||
6 | * | ||
7 | * This file contains definitions and macros for a runtime debugging | ||
8 | * system for ppc64 (This should also work on 32 bit with a few | ||
9 | * adjustments. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | * | ||
16 | ********************************************************************/ | ||
17 | |||
18 | #include <linux/config.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <asm/udbg.h> | ||
21 | #include <stdarg.h> | ||
22 | |||
23 | #define PPCDBG_BITVAL(X) ((1UL)<<((unsigned long)(X))) | ||
24 | |||
25 | /* Defined below are the bit positions of various debug flags in the | ||
26 | * ppc64_debug_switch variable. | ||
27 | * -- When adding new values, please enter them into trace names below -- | ||
28 | * | ||
29 | * Values 62 & 63 can be used to stress the hardware page table management | ||
30 | * code. They must be set statically, any attempt to change them dynamically | ||
31 | * would be a very bad idea. | ||
32 | */ | ||
33 | #define PPCDBG_MMINIT PPCDBG_BITVAL(0) | ||
34 | #define PPCDBG_MM PPCDBG_BITVAL(1) | ||
35 | #define PPCDBG_SYS32 PPCDBG_BITVAL(2) | ||
36 | #define PPCDBG_SYS32NI PPCDBG_BITVAL(3) | ||
37 | #define PPCDBG_SYS32X PPCDBG_BITVAL(4) | ||
38 | #define PPCDBG_SYS32M PPCDBG_BITVAL(5) | ||
39 | #define PPCDBG_SYS64 PPCDBG_BITVAL(6) | ||
40 | #define PPCDBG_SYS64NI PPCDBG_BITVAL(7) | ||
41 | #define PPCDBG_SYS64X PPCDBG_BITVAL(8) | ||
42 | #define PPCDBG_SIGNAL PPCDBG_BITVAL(9) | ||
43 | #define PPCDBG_SIGNALXMON PPCDBG_BITVAL(10) | ||
44 | #define PPCDBG_BINFMT32 PPCDBG_BITVAL(11) | ||
45 | #define PPCDBG_BINFMT64 PPCDBG_BITVAL(12) | ||
46 | #define PPCDBG_BINFMTXMON PPCDBG_BITVAL(13) | ||
47 | #define PPCDBG_BINFMT_32ADDR PPCDBG_BITVAL(14) | ||
48 | #define PPCDBG_ALIGNFIXUP PPCDBG_BITVAL(15) | ||
49 | #define PPCDBG_TCEINIT PPCDBG_BITVAL(16) | ||
50 | #define PPCDBG_TCE PPCDBG_BITVAL(17) | ||
51 | #define PPCDBG_PHBINIT PPCDBG_BITVAL(18) | ||
52 | #define PPCDBG_SMP PPCDBG_BITVAL(19) | ||
53 | #define PPCDBG_BOOT PPCDBG_BITVAL(20) | ||
54 | #define PPCDBG_BUSWALK PPCDBG_BITVAL(21) | ||
55 | #define PPCDBG_PROM PPCDBG_BITVAL(22) | ||
56 | #define PPCDBG_RTAS PPCDBG_BITVAL(23) | ||
57 | #define PPCDBG_HTABSTRESS PPCDBG_BITVAL(62) | ||
58 | #define PPCDBG_HTABSIZE PPCDBG_BITVAL(63) | ||
59 | #define PPCDBG_NONE (0UL) | ||
60 | #define PPCDBG_ALL (0xffffffffUL) | ||
61 | |||
62 | /* The default initial value for the debug switch */ | ||
63 | #define PPC_DEBUG_DEFAULT 0 | ||
64 | /* #define PPC_DEBUG_DEFAULT PPCDBG_ALL */ | ||
65 | |||
66 | #define PPCDBG_NUM_FLAGS 64 | ||
67 | |||
68 | extern u64 ppc64_debug_switch; | ||
69 | |||
70 | #ifdef WANT_PPCDBG_TAB | ||
71 | /* A table of debug switch names to allow name lookup in xmon | ||
72 | * (and whoever else wants it. | ||
73 | */ | ||
74 | char *trace_names[PPCDBG_NUM_FLAGS] = { | ||
75 | /* Known debug names */ | ||
76 | "mminit", "mm", | ||
77 | "syscall32", "syscall32_ni", "syscall32x", "syscall32m", | ||
78 | "syscall64", "syscall64_ni", "syscall64x", | ||
79 | "signal", "signal_xmon", | ||
80 | "binfmt32", "binfmt64", "binfmt_xmon", "binfmt_32addr", | ||
81 | "alignfixup", "tceinit", "tce", "phb_init", | ||
82 | "smp", "boot", "buswalk", "prom", | ||
83 | "rtas" | ||
84 | }; | ||
85 | #else | ||
86 | extern char *trace_names[64]; | ||
87 | #endif /* WANT_PPCDBG_TAB */ | ||
88 | |||
89 | #ifdef CONFIG_PPCDBG | ||
90 | /* Macro to conditionally print debug based on debug_switch */ | ||
91 | #define PPCDBG(...) udbg_ppcdbg(__VA_ARGS__) | ||
92 | |||
93 | /* Macro to conditionally call a debug routine based on debug_switch */ | ||
94 | #define PPCDBGCALL(FLAGS,FUNCTION) ifppcdebug(FLAGS) FUNCTION | ||
95 | |||
96 | /* Macros to test for debug states */ | ||
97 | #define ifppcdebug(FLAGS) if (udbg_ifdebug(FLAGS)) | ||
98 | #define ppcdebugset(FLAGS) (udbg_ifdebug(FLAGS)) | ||
99 | #define PPCDBG_BINFMT (test_thread_flag(TIF_32BIT) ? PPCDBG_BINFMT32 : PPCDBG_BINFMT64) | ||
100 | |||
101 | #else | ||
102 | #define PPCDBG(...) do {;} while (0) | ||
103 | #define PPCDBGCALL(FLAGS,FUNCTION) do {;} while (0) | ||
104 | #define ifppcdebug(...) if (0) | ||
105 | #define ppcdebugset(FLAGS) (0) | ||
106 | #endif /* CONFIG_PPCDBG */ | ||
107 | |||
108 | #endif /*__PPCDEBUG_H */ | ||
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h new file mode 100644 index 000000000000..eb33d33cfd6d --- /dev/null +++ b/include/asm-ppc64/processor.h | |||
@@ -0,0 +1,667 @@ | |||
1 | #ifndef __ASM_PPC64_PROCESSOR_H | ||
2 | #define __ASM_PPC64_PROCESSOR_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2001 PPC 64 Team, IBM Corp | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/stringify.h> | ||
14 | #ifndef __ASSEMBLY__ | ||
15 | #include <linux/config.h> | ||
16 | #include <asm/atomic.h> | ||
17 | #include <asm/ppcdebug.h> | ||
18 | #include <asm/a.out.h> | ||
19 | #endif | ||
20 | #include <asm/ptrace.h> | ||
21 | #include <asm/types.h> | ||
22 | #include <asm/systemcfg.h> | ||
23 | |||
24 | /* Machine State Register (MSR) Fields */ | ||
25 | #define MSR_SF_LG 63 /* Enable 64 bit mode */ | ||
26 | #define MSR_ISF_LG 61 /* Interrupt 64b mode valid on 630 */ | ||
27 | #define MSR_HV_LG 60 /* Hypervisor state */ | ||
28 | #define MSR_VEC_LG 25 /* Enable AltiVec */ | ||
29 | #define MSR_POW_LG 18 /* Enable Power Management */ | ||
30 | #define MSR_WE_LG 18 /* Wait State Enable */ | ||
31 | #define MSR_TGPR_LG 17 /* TLB Update registers in use */ | ||
32 | #define MSR_CE_LG 17 /* Critical Interrupt Enable */ | ||
33 | #define MSR_ILE_LG 16 /* Interrupt Little Endian */ | ||
34 | #define MSR_EE_LG 15 /* External Interrupt Enable */ | ||
35 | #define MSR_PR_LG 14 /* Problem State / Privilege Level */ | ||
36 | #define MSR_FP_LG 13 /* Floating Point enable */ | ||
37 | #define MSR_ME_LG 12 /* Machine Check Enable */ | ||
38 | #define MSR_FE0_LG 11 /* Floating Exception mode 0 */ | ||
39 | #define MSR_SE_LG 10 /* Single Step */ | ||
40 | #define MSR_BE_LG 9 /* Branch Trace */ | ||
41 | #define MSR_DE_LG 9 /* Debug Exception Enable */ | ||
42 | #define MSR_FE1_LG 8 /* Floating Exception mode 1 */ | ||
43 | #define MSR_IP_LG 6 /* Exception prefix 0x000/0xFFF */ | ||
44 | #define MSR_IR_LG 5 /* Instruction Relocate */ | ||
45 | #define MSR_DR_LG 4 /* Data Relocate */ | ||
46 | #define MSR_PE_LG 3 /* Protection Enable */ | ||
47 | #define MSR_PX_LG 2 /* Protection Exclusive Mode */ | ||
48 | #define MSR_PMM_LG 2 /* Performance monitor */ | ||
49 | #define MSR_RI_LG 1 /* Recoverable Exception */ | ||
50 | #define MSR_LE_LG 0 /* Little Endian */ | ||
51 | |||
52 | #ifdef __ASSEMBLY__ | ||
53 | #define __MASK(X) (1<<(X)) | ||
54 | #else | ||
55 | #define __MASK(X) (1UL<<(X)) | ||
56 | #endif | ||
57 | |||
58 | #define MSR_SF __MASK(MSR_SF_LG) /* Enable 64 bit mode */ | ||
59 | #define MSR_ISF __MASK(MSR_ISF_LG) /* Interrupt 64b mode valid on 630 */ | ||
60 | #define MSR_HV __MASK(MSR_HV_LG) /* Hypervisor state */ | ||
61 | #define MSR_VEC __MASK(MSR_VEC_LG) /* Enable AltiVec */ | ||
62 | #define MSR_POW __MASK(MSR_POW_LG) /* Enable Power Management */ | ||
63 | #define MSR_WE __MASK(MSR_WE_LG) /* Wait State Enable */ | ||
64 | #define MSR_TGPR __MASK(MSR_TGPR_LG) /* TLB Update registers in use */ | ||
65 | #define MSR_CE __MASK(MSR_CE_LG) /* Critical Interrupt Enable */ | ||
66 | #define MSR_ILE __MASK(MSR_ILE_LG) /* Interrupt Little Endian */ | ||
67 | #define MSR_EE __MASK(MSR_EE_LG) /* External Interrupt Enable */ | ||
68 | #define MSR_PR __MASK(MSR_PR_LG) /* Problem State / Privilege Level */ | ||
69 | #define MSR_FP __MASK(MSR_FP_LG) /* Floating Point enable */ | ||
70 | #define MSR_ME __MASK(MSR_ME_LG) /* Machine Check Enable */ | ||
71 | #define MSR_FE0 __MASK(MSR_FE0_LG) /* Floating Exception mode 0 */ | ||
72 | #define MSR_SE __MASK(MSR_SE_LG) /* Single Step */ | ||
73 | #define MSR_BE __MASK(MSR_BE_LG) /* Branch Trace */ | ||
74 | #define MSR_DE __MASK(MSR_DE_LG) /* Debug Exception Enable */ | ||
75 | #define MSR_FE1 __MASK(MSR_FE1_LG) /* Floating Exception mode 1 */ | ||
76 | #define MSR_IP __MASK(MSR_IP_LG) /* Exception prefix 0x000/0xFFF */ | ||
77 | #define MSR_IR __MASK(MSR_IR_LG) /* Instruction Relocate */ | ||
78 | #define MSR_DR __MASK(MSR_DR_LG) /* Data Relocate */ | ||
79 | #define MSR_PE __MASK(MSR_PE_LG) /* Protection Enable */ | ||
80 | #define MSR_PX __MASK(MSR_PX_LG) /* Protection Exclusive Mode */ | ||
81 | #define MSR_PMM __MASK(MSR_PMM_LG) /* Performance monitor */ | ||
82 | #define MSR_RI __MASK(MSR_RI_LG) /* Recoverable Exception */ | ||
83 | #define MSR_LE __MASK(MSR_LE_LG) /* Little Endian */ | ||
84 | |||
85 | #define MSR_ MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF | ||
86 | #define MSR_KERNEL MSR_ | MSR_SF | MSR_HV | ||
87 | |||
88 | #define MSR_USER32 MSR_ | MSR_PR | MSR_EE | ||
89 | #define MSR_USER64 MSR_USER32 | MSR_SF | ||
90 | |||
91 | /* Floating Point Status and Control Register (FPSCR) Fields */ | ||
92 | |||
93 | #define FPSCR_FX 0x80000000 /* FPU exception summary */ | ||
94 | #define FPSCR_FEX 0x40000000 /* FPU enabled exception summary */ | ||
95 | #define FPSCR_VX 0x20000000 /* Invalid operation summary */ | ||
96 | #define FPSCR_OX 0x10000000 /* Overflow exception summary */ | ||
97 | #define FPSCR_UX 0x08000000 /* Underflow exception summary */ | ||
98 | #define FPSCR_ZX 0x04000000 /* Zero-divide exception summary */ | ||
99 | #define FPSCR_XX 0x02000000 /* Inexact exception summary */ | ||
100 | #define FPSCR_VXSNAN 0x01000000 /* Invalid op for SNaN */ | ||
101 | #define FPSCR_VXISI 0x00800000 /* Invalid op for Inv - Inv */ | ||
102 | #define FPSCR_VXIDI 0x00400000 /* Invalid op for Inv / Inv */ | ||
103 | #define FPSCR_VXZDZ 0x00200000 /* Invalid op for Zero / Zero */ | ||
104 | #define FPSCR_VXIMZ 0x00100000 /* Invalid op for Inv * Zero */ | ||
105 | #define FPSCR_VXVC 0x00080000 /* Invalid op for Compare */ | ||
106 | #define FPSCR_FR 0x00040000 /* Fraction rounded */ | ||
107 | #define FPSCR_FI 0x00020000 /* Fraction inexact */ | ||
108 | #define FPSCR_FPRF 0x0001f000 /* FPU Result Flags */ | ||
109 | #define FPSCR_FPCC 0x0000f000 /* FPU Condition Codes */ | ||
110 | #define FPSCR_VXSOFT 0x00000400 /* Invalid op for software request */ | ||
111 | #define FPSCR_VXSQRT 0x00000200 /* Invalid op for square root */ | ||
112 | #define FPSCR_VXCVI 0x00000100 /* Invalid op for integer convert */ | ||
113 | #define FPSCR_VE 0x00000080 /* Invalid op exception enable */ | ||
114 | #define FPSCR_OE 0x00000040 /* IEEE overflow exception enable */ | ||
115 | #define FPSCR_UE 0x00000020 /* IEEE underflow exception enable */ | ||
116 | #define FPSCR_ZE 0x00000010 /* IEEE zero divide exception enable */ | ||
117 | #define FPSCR_XE 0x00000008 /* FP inexact exception enable */ | ||
118 | #define FPSCR_NI 0x00000004 /* FPU non IEEE-Mode */ | ||
119 | #define FPSCR_RN 0x00000003 /* FPU rounding control */ | ||
120 | |||
121 | /* Special Purpose Registers (SPRNs)*/ | ||
122 | |||
123 | #define SPRN_CDBCR 0x3D7 /* Cache Debug Control Register */ | ||
124 | #define SPRN_CTR 0x009 /* Count Register */ | ||
125 | #define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ | ||
126 | #define SPRN_DAC1 0x3F6 /* Data Address Compare 1 */ | ||
127 | #define SPRN_DAC2 0x3F7 /* Data Address Compare 2 */ | ||
128 | #define SPRN_DAR 0x013 /* Data Address Register */ | ||
129 | #define SPRN_DBCR 0x3F2 /* Debug Control Regsiter */ | ||
130 | #define DBCR_EDM 0x80000000 | ||
131 | #define DBCR_IDM 0x40000000 | ||
132 | #define DBCR_RST(x) (((x) & 0x3) << 28) | ||
133 | #define DBCR_RST_NONE 0 | ||
134 | #define DBCR_RST_CORE 1 | ||
135 | #define DBCR_RST_CHIP 2 | ||
136 | #define DBCR_RST_SYSTEM 3 | ||
137 | #define DBCR_IC 0x08000000 /* Instruction Completion Debug Evnt */ | ||
138 | #define DBCR_BT 0x04000000 /* Branch Taken Debug Event */ | ||
139 | #define DBCR_EDE 0x02000000 /* Exception Debug Event */ | ||
140 | #define DBCR_TDE 0x01000000 /* TRAP Debug Event */ | ||
141 | #define DBCR_FER 0x00F80000 /* First Events Remaining Mask */ | ||
142 | #define DBCR_FT 0x00040000 /* Freeze Timers on Debug Event */ | ||
143 | #define DBCR_IA1 0x00020000 /* Instr. Addr. Compare 1 Enable */ | ||
144 | #define DBCR_IA2 0x00010000 /* Instr. Addr. Compare 2 Enable */ | ||
145 | #define DBCR_D1R 0x00008000 /* Data Addr. Compare 1 Read Enable */ | ||
146 | #define DBCR_D1W 0x00004000 /* Data Addr. Compare 1 Write Enable */ | ||
147 | #define DBCR_D1S(x) (((x) & 0x3) << 12) /* Data Adrr. Compare 1 Size */ | ||
148 | #define DAC_BYTE 0 | ||
149 | #define DAC_HALF 1 | ||
150 | #define DAC_WORD 2 | ||
151 | #define DAC_QUAD 3 | ||
152 | #define DBCR_D2R 0x00000800 /* Data Addr. Compare 2 Read Enable */ | ||
153 | #define DBCR_D2W 0x00000400 /* Data Addr. Compare 2 Write Enable */ | ||
154 | #define DBCR_D2S(x) (((x) & 0x3) << 8) /* Data Addr. Compare 2 Size */ | ||
155 | #define DBCR_SBT 0x00000040 /* Second Branch Taken Debug Event */ | ||
156 | #define DBCR_SED 0x00000020 /* Second Exception Debug Event */ | ||
157 | #define DBCR_STD 0x00000010 /* Second Trap Debug Event */ | ||
158 | #define DBCR_SIA 0x00000008 /* Second IAC Enable */ | ||
159 | #define DBCR_SDA 0x00000004 /* Second DAC Enable */ | ||
160 | #define DBCR_JOI 0x00000002 /* JTAG Serial Outbound Int. Enable */ | ||
161 | #define DBCR_JII 0x00000001 /* JTAG Serial Inbound Int. Enable */ | ||
162 | #define SPRN_DBCR0 0x3F2 /* Debug Control Register 0 */ | ||
163 | #define SPRN_DBCR1 0x3BD /* Debug Control Register 1 */ | ||
164 | #define SPRN_DBSR 0x3F0 /* Debug Status Register */ | ||
165 | #define SPRN_DCCR 0x3FA /* Data Cache Cacheability Register */ | ||
166 | #define DCCR_NOCACHE 0 /* Noncacheable */ | ||
167 | #define DCCR_CACHE 1 /* Cacheable */ | ||
168 | #define SPRN_DCMP 0x3D1 /* Data TLB Compare Register */ | ||
169 | #define SPRN_DCWR 0x3BA /* Data Cache Write-thru Register */ | ||
170 | #define DCWR_COPY 0 /* Copy-back */ | ||
171 | #define DCWR_WRITE 1 /* Write-through */ | ||
172 | #define SPRN_DEAR 0x3D5 /* Data Error Address Register */ | ||
173 | #define SPRN_DEC 0x016 /* Decrement Register */ | ||
174 | #define SPRN_DMISS 0x3D0 /* Data TLB Miss Register */ | ||
175 | #define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */ | ||
176 | #define DSISR_NOHPTE 0x40000000 /* no translation found */ | ||
177 | #define DSISR_PROTFAULT 0x08000000 /* protection fault */ | ||
178 | #define DSISR_ISSTORE 0x02000000 /* access was a store */ | ||
179 | #define DSISR_DABRMATCH 0x00400000 /* hit data breakpoint */ | ||
180 | #define DSISR_NOSEGMENT 0x00200000 /* STAB/SLB miss */ | ||
181 | #define SPRN_EAR 0x11A /* External Address Register */ | ||
182 | #define SPRN_ESR 0x3D4 /* Exception Syndrome Register */ | ||
183 | #define ESR_IMCP 0x80000000 /* Instr. Machine Check - Protection */ | ||
184 | #define ESR_IMCN 0x40000000 /* Instr. Machine Check - Non-config */ | ||
185 | #define ESR_IMCB 0x20000000 /* Instr. Machine Check - Bus error */ | ||
186 | #define ESR_IMCT 0x10000000 /* Instr. Machine Check - Timeout */ | ||
187 | #define ESR_PIL 0x08000000 /* Program Exception - Illegal */ | ||
188 | #define ESR_PPR 0x04000000 /* Program Exception - Priveleged */ | ||
189 | #define ESR_PTR 0x02000000 /* Program Exception - Trap */ | ||
190 | #define ESR_DST 0x00800000 /* Storage Exception - Data miss */ | ||
191 | #define ESR_DIZ 0x00400000 /* Storage Exception - Zone fault */ | ||
192 | #define SPRN_EVPR 0x3D6 /* Exception Vector Prefix Register */ | ||
193 | #define SPRN_HASH1 0x3D2 /* Primary Hash Address Register */ | ||
194 | #define SPRN_HASH2 0x3D3 /* Secondary Hash Address Resgister */ | ||
195 | #define SPRN_HID0 0x3F0 /* Hardware Implementation Register 0 */ | ||
196 | #define HID0_EMCP (1<<31) /* Enable Machine Check pin */ | ||
197 | #define HID0_EBA (1<<29) /* Enable Bus Address Parity */ | ||
198 | #define HID0_EBD (1<<28) /* Enable Bus Data Parity */ | ||
199 | #define HID0_SBCLK (1<<27) | ||
200 | #define HID0_EICE (1<<26) | ||
201 | #define HID0_ECLK (1<<25) | ||
202 | #define HID0_PAR (1<<24) | ||
203 | #define HID0_DOZE (1<<23) | ||
204 | #define HID0_NAP (1<<22) | ||
205 | #define HID0_SLEEP (1<<21) | ||
206 | #define HID0_DPM (1<<20) | ||
207 | #define HID0_ICE (1<<15) /* Instruction Cache Enable */ | ||
208 | #define HID0_DCE (1<<14) /* Data Cache Enable */ | ||
209 | #define HID0_ILOCK (1<<13) /* Instruction Cache Lock */ | ||
210 | #define HID0_DLOCK (1<<12) /* Data Cache Lock */ | ||
211 | #define HID0_ICFI (1<<11) /* Instr. Cache Flash Invalidate */ | ||
212 | #define HID0_DCI (1<<10) /* Data Cache Invalidate */ | ||
213 | #define HID0_SPD (1<<9) /* Speculative disable */ | ||
214 | #define HID0_SGE (1<<7) /* Store Gathering Enable */ | ||
215 | #define HID0_SIED (1<<7) /* Serial Instr. Execution [Disable] */ | ||
216 | #define HID0_BTIC (1<<5) /* Branch Target Instruction Cache Enable */ | ||
217 | #define HID0_ABE (1<<3) /* Address Broadcast Enable */ | ||
218 | #define HID0_BHTE (1<<2) /* Branch History Table Enable */ | ||
219 | #define HID0_BTCD (1<<1) /* Branch target cache disable */ | ||
220 | #define SPRN_MSRDORM 0x3F1 /* Hardware Implementation Register 1 */ | ||
221 | #define SPRN_HID1 0x3F1 /* Hardware Implementation Register 1 */ | ||
222 | #define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */ | ||
223 | #define SPRN_NIADORM 0x3F3 /* Hardware Implementation Register 2 */ | ||
224 | #define SPRN_HID4 0x3F4 /* 970 HID4 */ | ||
225 | #define SPRN_HID5 0x3F6 /* 970 HID5 */ | ||
226 | #define SPRN_TSC 0x3FD /* Thread switch control */ | ||
227 | #define SPRN_TST 0x3FC /* Thread switch timeout */ | ||
228 | #define SPRN_IAC1 0x3F4 /* Instruction Address Compare 1 */ | ||
229 | #define SPRN_IAC2 0x3F5 /* Instruction Address Compare 2 */ | ||
230 | #define SPRN_ICCR 0x3FB /* Instruction Cache Cacheability Register */ | ||
231 | #define ICCR_NOCACHE 0 /* Noncacheable */ | ||
232 | #define ICCR_CACHE 1 /* Cacheable */ | ||
233 | #define SPRN_ICDBDR 0x3D3 /* Instruction Cache Debug Data Register */ | ||
234 | #define SPRN_ICMP 0x3D5 /* Instruction TLB Compare Register */ | ||
235 | #define SPRN_ICTC 0x3FB /* Instruction Cache Throttling Control Reg */ | ||
236 | #define SPRN_IMISS 0x3D4 /* Instruction TLB Miss Register */ | ||
237 | #define SPRN_IMMR 0x27E /* Internal Memory Map Register */ | ||
238 | #define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */ | ||
239 | #define SPRN_LR 0x008 /* Link Register */ | ||
240 | #define SPRN_PBL1 0x3FC /* Protection Bound Lower 1 */ | ||
241 | #define SPRN_PBL2 0x3FE /* Protection Bound Lower 2 */ | ||
242 | #define SPRN_PBU1 0x3FD /* Protection Bound Upper 1 */ | ||
243 | #define SPRN_PBU2 0x3FF /* Protection Bound Upper 2 */ | ||
244 | #define SPRN_PID 0x3B1 /* Process ID */ | ||
245 | #define SPRN_PIR 0x3FF /* Processor Identification Register */ | ||
246 | #define SPRN_PIT 0x3DB /* Programmable Interval Timer */ | ||
247 | #define SPRN_PURR 0x135 /* Processor Utilization of Resources Register */ | ||
248 | #define SPRN_PVR 0x11F /* Processor Version Register */ | ||
249 | #define SPRN_RPA 0x3D6 /* Required Physical Address Register */ | ||
250 | #define SPRN_SDA 0x3BF /* Sampled Data Address Register */ | ||
251 | #define SPRN_SDR1 0x019 /* MMU Hash Base Register */ | ||
252 | #define SPRN_SGR 0x3B9 /* Storage Guarded Register */ | ||
253 | #define SGR_NORMAL 0 | ||
254 | #define SGR_GUARDED 1 | ||
255 | #define SPRN_SIA 0x3BB /* Sampled Instruction Address Register */ | ||
256 | #define SPRN_SPRG0 0x110 /* Special Purpose Register General 0 */ | ||
257 | #define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */ | ||
258 | #define SPRN_SPRG2 0x112 /* Special Purpose Register General 2 */ | ||
259 | #define SPRN_SPRG3 0x113 /* Special Purpose Register General 3 */ | ||
260 | #define SPRN_SRR0 0x01A /* Save/Restore Register 0 */ | ||
261 | #define SPRN_SRR1 0x01B /* Save/Restore Register 1 */ | ||
262 | #define SPRN_TBRL 0x10C /* Time Base Read Lower Register (user, R/O) */ | ||
263 | #define SPRN_TBRU 0x10D /* Time Base Read Upper Register (user, R/O) */ | ||
264 | #define SPRN_TBWL 0x11C /* Time Base Lower Register (super, W/O) */ | ||
265 | #define SPRN_TBWU 0x11D /* Time Base Write Upper Register (super, W/O) */ | ||
266 | #define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */ | ||
267 | #define SPRN_TCR 0x3DA /* Timer Control Register */ | ||
268 | #define TCR_WP(x) (((x)&0x3)<<30) /* WDT Period */ | ||
269 | #define WP_2_17 0 /* 2^17 clocks */ | ||
270 | #define WP_2_21 1 /* 2^21 clocks */ | ||
271 | #define WP_2_25 2 /* 2^25 clocks */ | ||
272 | #define WP_2_29 3 /* 2^29 clocks */ | ||
273 | #define TCR_WRC(x) (((x)&0x3)<<28) /* WDT Reset Control */ | ||
274 | #define WRC_NONE 0 /* No reset will occur */ | ||
275 | #define WRC_CORE 1 /* Core reset will occur */ | ||
276 | #define WRC_CHIP 2 /* Chip reset will occur */ | ||
277 | #define WRC_SYSTEM 3 /* System reset will occur */ | ||
278 | #define TCR_WIE 0x08000000 /* WDT Interrupt Enable */ | ||
279 | #define TCR_PIE 0x04000000 /* PIT Interrupt Enable */ | ||
280 | #define TCR_FP(x) (((x)&0x3)<<24) /* FIT Period */ | ||
281 | #define FP_2_9 0 /* 2^9 clocks */ | ||
282 | #define FP_2_13 1 /* 2^13 clocks */ | ||
283 | #define FP_2_17 2 /* 2^17 clocks */ | ||
284 | #define FP_2_21 3 /* 2^21 clocks */ | ||
285 | #define TCR_FIE 0x00800000 /* FIT Interrupt Enable */ | ||
286 | #define TCR_ARE 0x00400000 /* Auto Reload Enable */ | ||
287 | #define SPRN_THRM1 0x3FC /* Thermal Management Register 1 */ | ||
288 | #define THRM1_TIN (1<<0) | ||
289 | #define THRM1_TIV (1<<1) | ||
290 | #define THRM1_THRES (0x7f<<2) | ||
291 | #define THRM1_TID (1<<29) | ||
292 | #define THRM1_TIE (1<<30) | ||
293 | #define THRM1_V (1<<31) | ||
294 | #define SPRN_THRM2 0x3FD /* Thermal Management Register 2 */ | ||
295 | #define SPRN_THRM3 0x3FE /* Thermal Management Register 3 */ | ||
296 | #define THRM3_E (1<<31) | ||
297 | #define SPRN_TSR 0x3D8 /* Timer Status Register */ | ||
298 | #define TSR_ENW 0x80000000 /* Enable Next Watchdog */ | ||
299 | #define TSR_WIS 0x40000000 /* WDT Interrupt Status */ | ||
300 | #define TSR_WRS(x) (((x)&0x3)<<28) /* WDT Reset Status */ | ||
301 | #define WRS_NONE 0 /* No WDT reset occurred */ | ||
302 | #define WRS_CORE 1 /* WDT forced core reset */ | ||
303 | #define WRS_CHIP 2 /* WDT forced chip reset */ | ||
304 | #define WRS_SYSTEM 3 /* WDT forced system reset */ | ||
305 | #define TSR_PIS 0x08000000 /* PIT Interrupt Status */ | ||
306 | #define TSR_FIS 0x04000000 /* FIT Interrupt Status */ | ||
307 | #define SPRN_USIA 0x3AB /* User Sampled Instruction Address Register */ | ||
308 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ | ||
309 | #define SPRN_ZPR 0x3B0 /* Zone Protection Register */ | ||
310 | #define SPRN_VRSAVE 0x100 /* Vector save */ | ||
311 | |||
312 | /* Performance monitor SPRs */ | ||
313 | #define SPRN_SIAR 780 | ||
314 | #define SPRN_SDAR 781 | ||
315 | #define SPRN_MMCRA 786 | ||
316 | #define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */ | ||
317 | #define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */ | ||
318 | #define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */ | ||
319 | #define SPRN_PMC1 787 | ||
320 | #define SPRN_PMC2 788 | ||
321 | #define SPRN_PMC3 789 | ||
322 | #define SPRN_PMC4 790 | ||
323 | #define SPRN_PMC5 791 | ||
324 | #define SPRN_PMC6 792 | ||
325 | #define SPRN_PMC7 793 | ||
326 | #define SPRN_PMC8 794 | ||
327 | #define SPRN_MMCR0 795 | ||
328 | #define MMCR0_FC 0x80000000UL /* freeze counters. set to 1 on a perfmon exception */ | ||
329 | #define MMCR0_FCS 0x40000000UL /* freeze in supervisor state */ | ||
330 | #define MMCR0_KERNEL_DISABLE MMCR0_FCS | ||
331 | #define MMCR0_FCP 0x20000000UL /* freeze in problem state */ | ||
332 | #define MMCR0_PROBLEM_DISABLE MMCR0_FCP | ||
333 | #define MMCR0_FCM1 0x10000000UL /* freeze counters while MSR mark = 1 */ | ||
334 | #define MMCR0_FCM0 0x08000000UL /* freeze counters while MSR mark = 0 */ | ||
335 | #define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */ | ||
336 | #define MMCR0_FCECE 0x02000000UL /* freeze counters on enabled condition or event */ | ||
337 | /* time base exception enable */ | ||
338 | #define MMCR0_TBEE 0x00400000UL /* time base exception enable */ | ||
339 | #define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/ | ||
340 | #define MMCR0_PMCjCE 0x00004000UL /* PMCj count enable*/ | ||
341 | #define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */ | ||
342 | #define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */ | ||
343 | #define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */ | ||
344 | #define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */ | ||
345 | #define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */ | ||
346 | #define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */ | ||
347 | #define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */ | ||
348 | #define SPRN_MMCR1 798 | ||
349 | |||
350 | /* Short-hand versions for a number of the above SPRNs */ | ||
351 | |||
352 | #define CTR SPRN_CTR /* Counter Register */ | ||
353 | #define DAR SPRN_DAR /* Data Address Register */ | ||
354 | #define DABR SPRN_DABR /* Data Address Breakpoint Register */ | ||
355 | #define DCMP SPRN_DCMP /* Data TLB Compare Register */ | ||
356 | #define DEC SPRN_DEC /* Decrement Register */ | ||
357 | #define DMISS SPRN_DMISS /* Data TLB Miss Register */ | ||
358 | #define DSISR SPRN_DSISR /* Data Storage Interrupt Status Register */ | ||
359 | #define EAR SPRN_EAR /* External Address Register */ | ||
360 | #define HASH1 SPRN_HASH1 /* Primary Hash Address Register */ | ||
361 | #define HASH2 SPRN_HASH2 /* Secondary Hash Address Register */ | ||
362 | #define HID0 SPRN_HID0 /* Hardware Implementation Register 0 */ | ||
363 | #define MSRDORM SPRN_MSRDORM /* MSR Dormant Register */ | ||
364 | #define NIADORM SPRN_NIADORM /* NIA Dormant Register */ | ||
365 | #define TSC SPRN_TSC /* Thread switch control */ | ||
366 | #define TST SPRN_TST /* Thread switch timeout */ | ||
367 | #define IABR SPRN_IABR /* Instruction Address Breakpoint Register */ | ||
368 | #define ICMP SPRN_ICMP /* Instruction TLB Compare Register */ | ||
369 | #define IMISS SPRN_IMISS /* Instruction TLB Miss Register */ | ||
370 | #define IMMR SPRN_IMMR /* PPC 860/821 Internal Memory Map Register */ | ||
371 | #define L2CR SPRN_L2CR /* PPC 750 L2 control register */ | ||
372 | #define __LR SPRN_LR | ||
373 | #define PVR SPRN_PVR /* Processor Version */ | ||
374 | #define PIR SPRN_PIR /* Processor ID */ | ||
375 | #define PURR SPRN_PURR /* Processor Utilization of Resource Register */ | ||
376 | //#define RPA SPRN_RPA /* Required Physical Address Register */ | ||
377 | #define SDR1 SPRN_SDR1 /* MMU hash base register */ | ||
378 | #define SPR0 SPRN_SPRG0 /* Supervisor Private Registers */ | ||
379 | #define SPR1 SPRN_SPRG1 | ||
380 | #define SPR2 SPRN_SPRG2 | ||
381 | #define SPR3 SPRN_SPRG3 | ||
382 | #define SPRG0 SPRN_SPRG0 | ||
383 | #define SPRG1 SPRN_SPRG1 | ||
384 | #define SPRG2 SPRN_SPRG2 | ||
385 | #define SPRG3 SPRN_SPRG3 | ||
386 | #define SRR0 SPRN_SRR0 /* Save and Restore Register 0 */ | ||
387 | #define SRR1 SPRN_SRR1 /* Save and Restore Register 1 */ | ||
388 | #define TBRL SPRN_TBRL /* Time Base Read Lower Register */ | ||
389 | #define TBRU SPRN_TBRU /* Time Base Read Upper Register */ | ||
390 | #define TBWL SPRN_TBWL /* Time Base Write Lower Register */ | ||
391 | #define TBWU SPRN_TBWU /* Time Base Write Upper Register */ | ||
392 | #define ICTC 1019 | ||
393 | #define THRM1 SPRN_THRM1 /* Thermal Management Register 1 */ | ||
394 | #define THRM2 SPRN_THRM2 /* Thermal Management Register 2 */ | ||
395 | #define THRM3 SPRN_THRM3 /* Thermal Management Register 3 */ | ||
396 | #define XER SPRN_XER | ||
397 | |||
398 | /* Processor Version Register (PVR) field extraction */ | ||
399 | |||
400 | #define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ | ||
401 | #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ | ||
402 | |||
403 | /* Processor Version Numbers */ | ||
404 | #define PV_NORTHSTAR 0x0033 | ||
405 | #define PV_PULSAR 0x0034 | ||
406 | #define PV_POWER4 0x0035 | ||
407 | #define PV_ICESTAR 0x0036 | ||
408 | #define PV_SSTAR 0x0037 | ||
409 | #define PV_POWER4p 0x0038 | ||
410 | #define PV_970 0x0039 | ||
411 | #define PV_POWER5 0x003A | ||
412 | #define PV_POWER5p 0x003B | ||
413 | #define PV_970FX 0x003C | ||
414 | #define PV_630 0x0040 | ||
415 | #define PV_630p 0x0041 | ||
416 | |||
417 | /* Platforms supported by PPC64 */ | ||
418 | #define PLATFORM_PSERIES 0x0100 | ||
419 | #define PLATFORM_PSERIES_LPAR 0x0101 | ||
420 | #define PLATFORM_ISERIES_LPAR 0x0201 | ||
421 | #define PLATFORM_LPAR 0x0001 | ||
422 | #define PLATFORM_POWERMAC 0x0400 | ||
423 | #define PLATFORM_MAPLE 0x0500 | ||
424 | |||
425 | /* Compatibility with drivers coming from PPC32 world */ | ||
426 | #define _machine (systemcfg->platform) | ||
427 | #define _MACH_Pmac PLATFORM_POWERMAC | ||
428 | |||
429 | /* | ||
430 | * List of interrupt controllers. | ||
431 | */ | ||
432 | #define IC_INVALID 0 | ||
433 | #define IC_OPEN_PIC 1 | ||
434 | #define IC_PPC_XIC 2 | ||
435 | |||
436 | #define XGLUE(a,b) a##b | ||
437 | #define GLUE(a,b) XGLUE(a,b) | ||
438 | |||
439 | /* iSeries CTRL register (for runlatch) */ | ||
440 | |||
441 | #define CTRLT 0x098 | ||
442 | #define CTRLF 0x088 | ||
443 | #define RUNLATCH 0x0001 | ||
444 | |||
445 | #ifdef __ASSEMBLY__ | ||
446 | |||
447 | #define _GLOBAL(name) \ | ||
448 | .section ".text"; \ | ||
449 | .align 2 ; \ | ||
450 | .globl name; \ | ||
451 | .globl GLUE(.,name); \ | ||
452 | .section ".opd","aw"; \ | ||
453 | name: \ | ||
454 | .quad GLUE(.,name); \ | ||
455 | .quad .TOC.@tocbase; \ | ||
456 | .quad 0; \ | ||
457 | .previous; \ | ||
458 | .type GLUE(.,name),@function; \ | ||
459 | GLUE(.,name): | ||
460 | |||
461 | #define _STATIC(name) \ | ||
462 | .section ".text"; \ | ||
463 | .align 2 ; \ | ||
464 | .section ".opd","aw"; \ | ||
465 | name: \ | ||
466 | .quad GLUE(.,name); \ | ||
467 | .quad .TOC.@tocbase; \ | ||
468 | .quad 0; \ | ||
469 | .previous; \ | ||
470 | .type GLUE(.,name),@function; \ | ||
471 | GLUE(.,name): | ||
472 | |||
473 | #else /* __ASSEMBLY__ */ | ||
474 | |||
475 | /* | ||
476 | * Default implementation of macro that returns current | ||
477 | * instruction pointer ("program counter"). | ||
478 | */ | ||
479 | #define current_text_addr() ({ __label__ _l; _l: &&_l;}) | ||
480 | |||
481 | /* Macros for setting and retrieving special purpose registers */ | ||
482 | |||
483 | #define mfmsr() ({unsigned long rval; \ | ||
484 | asm volatile("mfmsr %0" : "=r" (rval)); rval;}) | ||
485 | |||
486 | #define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \ | ||
487 | : : "r" (v)) | ||
488 | #define mtmsrd(v) __mtmsrd((v), 0) | ||
489 | |||
490 | #define mfspr(rn) ({unsigned long rval; \ | ||
491 | asm volatile("mfspr %0," __stringify(rn) \ | ||
492 | : "=r" (rval)); rval;}) | ||
493 | #define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)) | ||
494 | |||
495 | #define mftb() ({unsigned long rval; \ | ||
496 | asm volatile("mftb %0" : "=r" (rval)); rval;}) | ||
497 | |||
498 | #define mttbl(v) asm volatile("mttbl %0":: "r"(v)) | ||
499 | #define mttbu(v) asm volatile("mttbu %0":: "r"(v)) | ||
500 | |||
501 | #define mfasr() ({unsigned long rval; \ | ||
502 | asm volatile("mfasr %0" : "=r" (rval)); rval;}) | ||
503 | |||
504 | static inline void set_tb(unsigned int upper, unsigned int lower) | ||
505 | { | ||
506 | mttbl(0); | ||
507 | mttbu(upper); | ||
508 | mttbl(lower); | ||
509 | } | ||
510 | |||
511 | #define __get_SP() ({unsigned long sp; \ | ||
512 | asm volatile("mr %0,1": "=r" (sp)); sp;}) | ||
513 | |||
514 | #ifdef __KERNEL__ | ||
515 | |||
516 | extern int have_of; | ||
517 | extern u64 ppc64_interrupt_controller; | ||
518 | |||
519 | struct task_struct; | ||
520 | void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp); | ||
521 | void release_thread(struct task_struct *); | ||
522 | |||
523 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
524 | extern void prepare_to_copy(struct task_struct *tsk); | ||
525 | |||
526 | /* Create a new kernel thread. */ | ||
527 | extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | ||
528 | |||
529 | /* Lazy FPU handling on uni-processor */ | ||
530 | extern struct task_struct *last_task_used_math; | ||
531 | extern struct task_struct *last_task_used_altivec; | ||
532 | |||
533 | /* 64-bit user address space is 41-bits (2TBs user VM) */ | ||
534 | #define TASK_SIZE_USER64 (0x0000020000000000UL) | ||
535 | |||
536 | /* | ||
537 | * 32-bit user address space is 4GB - 1 page | ||
538 | * (this 1 page is needed so referencing of 0xFFFFFFFF generates EFAULT | ||
539 | */ | ||
540 | #define TASK_SIZE_USER32 (0x0000000100000000UL - (1*PAGE_SIZE)) | ||
541 | |||
542 | #define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ | ||
543 | TASK_SIZE_USER32 : TASK_SIZE_USER64) | ||
544 | |||
545 | /* We can't actually tell the TASK_SIZE given just the mm, but default | ||
546 | * to the 64-bit case to make sure that enough gets cleaned up. */ | ||
547 | #define MM_VM_SIZE(mm) TASK_SIZE_USER64 | ||
548 | |||
549 | /* This decides where the kernel will search for a free chunk of vm | ||
550 | * space during mmap's. | ||
551 | */ | ||
552 | #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) | ||
553 | #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_USER64 / 4)) | ||
554 | |||
555 | #define TASK_UNMAPPED_BASE ((test_thread_flag(TIF_32BIT)||(ppcdebugset(PPCDBG_BINFMT_32ADDR))) ? \ | ||
556 | TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 ) | ||
557 | |||
558 | typedef struct { | ||
559 | unsigned long seg; | ||
560 | } mm_segment_t; | ||
561 | |||
562 | struct thread_struct { | ||
563 | unsigned long ksp; /* Kernel stack pointer */ | ||
564 | unsigned long ksp_vsid; | ||
565 | struct pt_regs *regs; /* Pointer to saved register state */ | ||
566 | mm_segment_t fs; /* for get_fs() validation */ | ||
567 | double fpr[32]; /* Complete floating point set */ | ||
568 | unsigned long fpscr; /* Floating point status (plus pad) */ | ||
569 | unsigned long fpexc_mode; /* Floating-point exception mode */ | ||
570 | unsigned long start_tb; /* Start purr when proc switched in */ | ||
571 | unsigned long accum_tb; /* Total accumilated purr for process */ | ||
572 | unsigned long vdso_base; /* base of the vDSO library */ | ||
573 | #ifdef CONFIG_ALTIVEC | ||
574 | /* Complete AltiVec register set */ | ||
575 | vector128 vr[32] __attribute((aligned(16))); | ||
576 | /* AltiVec status */ | ||
577 | vector128 vscr __attribute((aligned(16))); | ||
578 | unsigned long vrsave; | ||
579 | int used_vr; /* set if process has used altivec */ | ||
580 | #endif /* CONFIG_ALTIVEC */ | ||
581 | }; | ||
582 | |||
583 | #define ARCH_MIN_TASKALIGN 16 | ||
584 | |||
585 | #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) | ||
586 | |||
587 | #define INIT_THREAD { \ | ||
588 | .ksp = INIT_SP, \ | ||
589 | .regs = (struct pt_regs *)INIT_SP - 1, \ | ||
590 | .fs = KERNEL_DS, \ | ||
591 | .fpr = {0}, \ | ||
592 | .fpscr = 0, \ | ||
593 | .fpexc_mode = MSR_FE0|MSR_FE1, \ | ||
594 | } | ||
595 | |||
596 | /* | ||
597 | * Note: the vm_start and vm_end fields here should *not* | ||
598 | * be in kernel space. (Could vm_end == vm_start perhaps?) | ||
599 | */ | ||
600 | #define IOREMAP_MMAP { &ioremap_mm, 0, 0x1000, NULL, \ | ||
601 | PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, \ | ||
602 | 1, NULL, NULL } | ||
603 | |||
604 | extern struct mm_struct ioremap_mm; | ||
605 | |||
606 | /* | ||
607 | * Return saved PC of a blocked thread. For now, this is the "user" PC | ||
608 | */ | ||
609 | #define thread_saved_pc(tsk) \ | ||
610 | ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0) | ||
611 | |||
612 | unsigned long get_wchan(struct task_struct *p); | ||
613 | |||
614 | #define KSTK_EIP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0) | ||
615 | #define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0) | ||
616 | |||
617 | /* Get/set floating-point exception mode */ | ||
618 | #define GET_FPEXC_CTL(tsk, adr) get_fpexc_mode((tsk), (adr)) | ||
619 | #define SET_FPEXC_CTL(tsk, val) set_fpexc_mode((tsk), (val)) | ||
620 | |||
621 | extern int get_fpexc_mode(struct task_struct *tsk, unsigned long adr); | ||
622 | extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val); | ||
623 | |||
624 | static inline unsigned int __unpack_fe01(unsigned long msr_bits) | ||
625 | { | ||
626 | return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8); | ||
627 | } | ||
628 | |||
629 | static inline unsigned long __pack_fe01(unsigned int fpmode) | ||
630 | { | ||
631 | return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1); | ||
632 | } | ||
633 | |||
634 | #define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0) | ||
635 | |||
636 | /* | ||
637 | * Prefetch macros. | ||
638 | */ | ||
639 | #define ARCH_HAS_PREFETCH | ||
640 | #define ARCH_HAS_PREFETCHW | ||
641 | #define ARCH_HAS_SPINLOCK_PREFETCH | ||
642 | |||
643 | static inline void prefetch(const void *x) | ||
644 | { | ||
645 | __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x)); | ||
646 | } | ||
647 | |||
648 | static inline void prefetchw(const void *x) | ||
649 | { | ||
650 | __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (x)); | ||
651 | } | ||
652 | |||
653 | #define spin_lock_prefetch(x) prefetchw(x) | ||
654 | |||
655 | #define HAVE_ARCH_PICK_MMAP_LAYOUT | ||
656 | |||
657 | #endif /* __KERNEL__ */ | ||
658 | |||
659 | #endif /* __ASSEMBLY__ */ | ||
660 | |||
661 | /* | ||
662 | * Number of entries in the SLB. If this ever changes we should handle | ||
663 | * it with a use a cpu feature fixup. | ||
664 | */ | ||
665 | #define SLB_NUM_ENTRIES 64 | ||
666 | |||
667 | #endif /* __ASM_PPC64_PROCESSOR_H */ | ||
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h new file mode 100644 index 000000000000..2440a2c90ae9 --- /dev/null +++ b/include/asm-ppc64/prom.h | |||
@@ -0,0 +1,230 @@ | |||
1 | #ifndef _PPC64_PROM_H | ||
2 | #define _PPC64_PROM_H | ||
3 | |||
4 | /* | ||
5 | * Definitions for talking to the Open Firmware PROM on | ||
6 | * Power Macintosh computers. | ||
7 | * | ||
8 | * Copyright (C) 1996 Paul Mackerras. | ||
9 | * | ||
10 | * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version | ||
15 | * 2 of the License, or (at your option) any later version. | ||
16 | */ | ||
17 | #include <linux/proc_fs.h> | ||
18 | #include <asm/atomic.h> | ||
19 | |||
20 | #define PTRRELOC(x) ((typeof(x))((unsigned long)(x) - offset)) | ||
21 | #define PTRUNRELOC(x) ((typeof(x))((unsigned long)(x) + offset)) | ||
22 | #define RELOC(x) (*PTRRELOC(&(x))) | ||
23 | |||
24 | /* Definitions used by the flattened device tree */ | ||
25 | #define OF_DT_HEADER 0xd00dfeed /* 4: version, 4: total size */ | ||
26 | #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name */ | ||
27 | #define OF_DT_END_NODE 0x2 /* End node */ | ||
28 | #define OF_DT_PROP 0x3 /* Property: name off, size, content */ | ||
29 | #define OF_DT_END 0x9 | ||
30 | |||
31 | #define OF_DT_VERSION 1 | ||
32 | |||
33 | /* | ||
34 | * This is what gets passed to the kernel by prom_init or kexec | ||
35 | * | ||
36 | * The dt struct contains the device tree structure, full pathes and | ||
37 | * property contents. The dt strings contain a separate block with just | ||
38 | * the strings for the property names, and is fully page aligned and | ||
39 | * self contained in a page, so that it can be kept around by the kernel, | ||
40 | * each property name appears only once in this page (cheap compression) | ||
41 | * | ||
42 | * the mem_rsvmap contains a map of reserved ranges of physical memory, | ||
43 | * passing it here instead of in the device-tree itself greatly simplifies | ||
44 | * the job of everybody. It's just a list of u64 pairs (base/size) that | ||
45 | * ends when size is 0 | ||
46 | */ | ||
47 | struct boot_param_header | ||
48 | { | ||
49 | u32 magic; /* magic word OF_DT_HEADER */ | ||
50 | u32 totalsize; /* total size of DT block */ | ||
51 | u32 off_dt_struct; /* offset to structure */ | ||
52 | u32 off_dt_strings; /* offset to strings */ | ||
53 | u32 off_mem_rsvmap; /* offset to memory reserve map */ | ||
54 | u32 version; /* format version */ | ||
55 | u32 last_comp_version; /* last compatible version */ | ||
56 | /* version 2 fields below */ | ||
57 | u32 boot_cpuid_phys; /* Which physical CPU id we're booting on */ | ||
58 | }; | ||
59 | |||
60 | |||
61 | |||
62 | typedef u32 phandle; | ||
63 | typedef u32 ihandle; | ||
64 | |||
65 | struct address_range { | ||
66 | unsigned long space; | ||
67 | unsigned long address; | ||
68 | unsigned long size; | ||
69 | }; | ||
70 | |||
71 | struct interrupt_info { | ||
72 | int line; | ||
73 | int sense; /* +ve/-ve logic, edge or level, etc. */ | ||
74 | }; | ||
75 | |||
76 | struct pci_address { | ||
77 | u32 a_hi; | ||
78 | u32 a_mid; | ||
79 | u32 a_lo; | ||
80 | }; | ||
81 | |||
82 | struct isa_address { | ||
83 | u32 a_hi; | ||
84 | u32 a_lo; | ||
85 | }; | ||
86 | |||
87 | struct isa_range { | ||
88 | struct isa_address isa_addr; | ||
89 | struct pci_address pci_addr; | ||
90 | unsigned int size; | ||
91 | }; | ||
92 | |||
93 | struct reg_property { | ||
94 | unsigned long address; | ||
95 | unsigned long size; | ||
96 | }; | ||
97 | |||
98 | struct reg_property32 { | ||
99 | unsigned int address; | ||
100 | unsigned int size; | ||
101 | }; | ||
102 | |||
103 | struct reg_property64 { | ||
104 | unsigned long address; | ||
105 | unsigned long size; | ||
106 | }; | ||
107 | |||
108 | struct property { | ||
109 | char *name; | ||
110 | int length; | ||
111 | unsigned char *value; | ||
112 | struct property *next; | ||
113 | }; | ||
114 | |||
115 | /* NOTE: the device_node contains PCI specific info for pci devices. | ||
116 | * This perhaps could be hung off the device_node with another struct, | ||
117 | * but for now it is directly in the node. The phb ptr is a good | ||
118 | * indication of a real PCI node. Other nodes leave these fields zeroed. | ||
119 | */ | ||
120 | struct pci_controller; | ||
121 | struct iommu_table; | ||
122 | |||
123 | struct device_node { | ||
124 | char *name; | ||
125 | char *type; | ||
126 | phandle node; | ||
127 | phandle linux_phandle; | ||
128 | int n_addrs; | ||
129 | struct address_range *addrs; | ||
130 | int n_intrs; | ||
131 | struct interrupt_info *intrs; | ||
132 | char *full_name; | ||
133 | |||
134 | /* PCI stuff probably doesn't belong here */ | ||
135 | int busno; /* for pci devices */ | ||
136 | int bussubno; /* for pci devices */ | ||
137 | int devfn; /* for pci devices */ | ||
138 | int eeh_mode; /* See eeh.h for possible EEH_MODEs */ | ||
139 | int eeh_config_addr; | ||
140 | int pci_ext_config_space; /* for pci devices */ | ||
141 | struct pci_controller *phb; /* for pci devices */ | ||
142 | struct iommu_table *iommu_table; /* for phb's or bridges */ | ||
143 | |||
144 | struct property *properties; | ||
145 | struct device_node *parent; | ||
146 | struct device_node *child; | ||
147 | struct device_node *sibling; | ||
148 | struct device_node *next; /* next device of same type */ | ||
149 | struct device_node *allnext; /* next in list of all nodes */ | ||
150 | struct proc_dir_entry *pde; /* this node's proc directory */ | ||
151 | struct proc_dir_entry *name_link; /* name symlink */ | ||
152 | struct proc_dir_entry *addr_link; /* addr symlink */ | ||
153 | struct kref kref; | ||
154 | unsigned long _flags; | ||
155 | }; | ||
156 | |||
157 | extern struct device_node *of_chosen; | ||
158 | |||
159 | /* flag descriptions */ | ||
160 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | ||
161 | |||
162 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | ||
163 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | ||
164 | |||
165 | /* | ||
166 | * Until 32-bit ppc can add proc_dir_entries to its device_node | ||
167 | * definition, we cannot refer to pde, name_link, and addr_link | ||
168 | * in arch-independent code. | ||
169 | */ | ||
170 | #define HAVE_ARCH_DEVTREE_FIXUPS | ||
171 | |||
172 | static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) | ||
173 | { | ||
174 | dn->pde = de; | ||
175 | } | ||
176 | |||
177 | static void inline set_node_name_link(struct device_node *dn, struct proc_dir_entry *de) | ||
178 | { | ||
179 | dn->name_link = de; | ||
180 | } | ||
181 | |||
182 | static void inline set_node_addr_link(struct device_node *dn, struct proc_dir_entry *de) | ||
183 | { | ||
184 | dn->addr_link = de; | ||
185 | } | ||
186 | |||
187 | /* OBSOLETE: Old stlye node lookup */ | ||
188 | extern struct device_node *find_devices(const char *name); | ||
189 | extern struct device_node *find_type_devices(const char *type); | ||
190 | extern struct device_node *find_path_device(const char *path); | ||
191 | extern struct device_node *find_compatible_devices(const char *type, | ||
192 | const char *compat); | ||
193 | extern struct device_node *find_all_nodes(void); | ||
194 | |||
195 | /* New style node lookup */ | ||
196 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
197 | const char *name); | ||
198 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
199 | const char *type); | ||
200 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
201 | const char *type, const char *compat); | ||
202 | extern struct device_node *of_find_node_by_path(const char *path); | ||
203 | extern struct device_node *of_find_node_by_phandle(phandle handle); | ||
204 | extern struct device_node *of_find_all_nodes(struct device_node *prev); | ||
205 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
206 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
207 | struct device_node *prev); | ||
208 | extern struct device_node *of_node_get(struct device_node *node); | ||
209 | extern void of_node_put(struct device_node *node); | ||
210 | |||
211 | /* For updating the device tree at runtime */ | ||
212 | extern void of_attach_node(struct device_node *); | ||
213 | extern void of_detach_node(const struct device_node *); | ||
214 | |||
215 | /* Other Prototypes */ | ||
216 | extern unsigned long prom_init(unsigned long, unsigned long, unsigned long, | ||
217 | unsigned long, unsigned long); | ||
218 | extern void finish_device_tree(void); | ||
219 | extern int device_is_compatible(struct device_node *device, const char *); | ||
220 | extern int machine_is_compatible(const char *compat); | ||
221 | extern unsigned char *get_property(struct device_node *node, const char *name, | ||
222 | int *lenp); | ||
223 | extern void print_properties(struct device_node *node); | ||
224 | extern int prom_n_addr_cells(struct device_node* np); | ||
225 | extern int prom_n_size_cells(struct device_node* np); | ||
226 | extern int prom_n_intr_cells(struct device_node* np); | ||
227 | extern void prom_get_irq_senses(unsigned char *senses, int off, int max); | ||
228 | extern void prom_add_property(struct device_node* np, struct property* prop); | ||
229 | |||
230 | #endif /* _PPC64_PROM_H */ | ||
diff --git a/include/asm-ppc64/ptrace-common.h b/include/asm-ppc64/ptrace-common.h new file mode 100644 index 000000000000..af03547f9c7e --- /dev/null +++ b/include/asm-ppc64/ptrace-common.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * linux/arch/ppc64/kernel/ptrace-common.h | ||
3 | * | ||
4 | * Copyright (c) 2002 Stephen Rothwell, IBM Coproration | ||
5 | * Extracted from ptrace.c and ptrace32.c | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General | ||
8 | * Public License. See the file README.legal in the main directory of | ||
9 | * this archive for more details. | ||
10 | */ | ||
11 | |||
12 | #ifndef _PPC64_PTRACE_COMMON_H | ||
13 | #define _PPC64_PTRACE_COMMON_H | ||
14 | /* | ||
15 | * Set of msr bits that gdb can change on behalf of a process. | ||
16 | */ | ||
17 | #define MSR_DEBUGCHANGE (MSR_FE0 | MSR_SE | MSR_BE | MSR_FE1) | ||
18 | |||
19 | /* | ||
20 | * Get contents of register REGNO in task TASK. | ||
21 | */ | ||
22 | static inline unsigned long get_reg(struct task_struct *task, int regno) | ||
23 | { | ||
24 | unsigned long tmp = 0; | ||
25 | |||
26 | /* | ||
27 | * Put the correct FP bits in, they might be wrong as a result | ||
28 | * of our lazy FP restore. | ||
29 | */ | ||
30 | if (regno == PT_MSR) { | ||
31 | tmp = ((unsigned long *)task->thread.regs)[PT_MSR]; | ||
32 | tmp |= task->thread.fpexc_mode; | ||
33 | } else if (regno < (sizeof(struct pt_regs) / sizeof(unsigned long))) { | ||
34 | tmp = ((unsigned long *)task->thread.regs)[regno]; | ||
35 | } | ||
36 | |||
37 | return tmp; | ||
38 | } | ||
39 | |||
40 | /* | ||
41 | * Write contents of register REGNO in task TASK. | ||
42 | */ | ||
43 | static inline int put_reg(struct task_struct *task, int regno, | ||
44 | unsigned long data) | ||
45 | { | ||
46 | if (regno < PT_SOFTE) { | ||
47 | if (regno == PT_MSR) | ||
48 | data = (data & MSR_DEBUGCHANGE) | ||
49 | | (task->thread.regs->msr & ~MSR_DEBUGCHANGE); | ||
50 | ((unsigned long *)task->thread.regs)[regno] = data; | ||
51 | return 0; | ||
52 | } | ||
53 | return -EIO; | ||
54 | } | ||
55 | |||
56 | static inline void set_single_step(struct task_struct *task) | ||
57 | { | ||
58 | struct pt_regs *regs = task->thread.regs; | ||
59 | if (regs != NULL) | ||
60 | regs->msr |= MSR_SE; | ||
61 | set_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); | ||
62 | } | ||
63 | |||
64 | static inline void clear_single_step(struct task_struct *task) | ||
65 | { | ||
66 | struct pt_regs *regs = task->thread.regs; | ||
67 | if (regs != NULL) | ||
68 | regs->msr &= ~MSR_SE; | ||
69 | clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); | ||
70 | } | ||
71 | |||
72 | #endif /* _PPC64_PTRACE_COMMON_H */ | ||
diff --git a/include/asm-ppc64/ptrace.h b/include/asm-ppc64/ptrace.h new file mode 100644 index 000000000000..c96aad28fc08 --- /dev/null +++ b/include/asm-ppc64/ptrace.h | |||
@@ -0,0 +1,189 @@ | |||
1 | #ifndef _PPC64_PTRACE_H | ||
2 | #define _PPC64_PTRACE_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2001 PPC64 Team, IBM Corp | ||
6 | * | ||
7 | * This struct defines the way the registers are stored on the | ||
8 | * kernel stack during a system call or other kernel entry. | ||
9 | * | ||
10 | * this should only contain volatile regs | ||
11 | * since we can keep non-volatile in the thread_struct | ||
12 | * should set this up when only volatiles are saved | ||
13 | * by intr code. | ||
14 | * | ||
15 | * Since this is going on the stack, *CARE MUST BE TAKEN* to insure | ||
16 | * that the overall structure is a multiple of 16 bytes in length. | ||
17 | * | ||
18 | * Note that the offsets of the fields in this struct correspond with | ||
19 | * the PT_* values below. This simplifies arch/ppc64/kernel/ptrace.c. | ||
20 | * | ||
21 | * This program is free software; you can redistribute it and/or | ||
22 | * modify it under the terms of the GNU General Public License | ||
23 | * as published by the Free Software Foundation; either version | ||
24 | * 2 of the License, or (at your option) any later version. | ||
25 | */ | ||
26 | |||
27 | #ifndef __ASSEMBLY__ | ||
28 | #define PPC_REG unsigned long | ||
29 | struct pt_regs { | ||
30 | PPC_REG gpr[32]; | ||
31 | PPC_REG nip; | ||
32 | PPC_REG msr; | ||
33 | PPC_REG orig_gpr3; /* Used for restarting system calls */ | ||
34 | PPC_REG ctr; | ||
35 | PPC_REG link; | ||
36 | PPC_REG xer; | ||
37 | PPC_REG ccr; | ||
38 | PPC_REG softe; /* Soft enabled/disabled */ | ||
39 | PPC_REG trap; /* Reason for being here */ | ||
40 | PPC_REG dar; /* Fault registers */ | ||
41 | PPC_REG dsisr; | ||
42 | PPC_REG result; /* Result of a system call */ | ||
43 | }; | ||
44 | |||
45 | #define PPC_REG_32 unsigned int | ||
46 | struct pt_regs32 { | ||
47 | PPC_REG_32 gpr[32]; | ||
48 | PPC_REG_32 nip; | ||
49 | PPC_REG_32 msr; | ||
50 | PPC_REG_32 orig_gpr3; /* Used for restarting system calls */ | ||
51 | PPC_REG_32 ctr; | ||
52 | PPC_REG_32 link; | ||
53 | PPC_REG_32 xer; | ||
54 | PPC_REG_32 ccr; | ||
55 | PPC_REG_32 mq; /* 601 only (not used at present) */ | ||
56 | /* Used on APUS to hold IPL value. */ | ||
57 | PPC_REG_32 trap; /* Reason for being here */ | ||
58 | PPC_REG_32 dar; /* Fault registers */ | ||
59 | PPC_REG_32 dsisr; | ||
60 | PPC_REG_32 result; /* Result of a system call */ | ||
61 | }; | ||
62 | |||
63 | #define instruction_pointer(regs) ((regs)->nip) | ||
64 | #ifdef CONFIG_SMP | ||
65 | extern unsigned long profile_pc(struct pt_regs *regs); | ||
66 | #else | ||
67 | #define profile_pc(regs) instruction_pointer(regs) | ||
68 | #endif | ||
69 | |||
70 | #endif /* __ASSEMBLY__ */ | ||
71 | |||
72 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ | ||
73 | |||
74 | /* Size of dummy stack frame allocated when calling signal handler. */ | ||
75 | #define __SIGNAL_FRAMESIZE 128 | ||
76 | #define __SIGNAL_FRAMESIZE32 64 | ||
77 | |||
78 | #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) | ||
79 | |||
80 | #define force_successful_syscall_return() \ | ||
81 | (current_thread_info()->syscall_noerror = 1) | ||
82 | |||
83 | /* | ||
84 | * We use the least-significant bit of the trap field to indicate | ||
85 | * whether we have saved the full set of registers, or only a | ||
86 | * partial set. A 1 there means the partial set. | ||
87 | */ | ||
88 | #define FULL_REGS(regs) (((regs)->trap & 1) == 0) | ||
89 | #define TRAP(regs) ((regs)->trap & ~0xF) | ||
90 | #define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) | ||
91 | |||
92 | /* | ||
93 | * Offsets used by 'ptrace' system call interface. | ||
94 | */ | ||
95 | #define PT_R0 0 | ||
96 | #define PT_R1 1 | ||
97 | #define PT_R2 2 | ||
98 | #define PT_R3 3 | ||
99 | #define PT_R4 4 | ||
100 | #define PT_R5 5 | ||
101 | #define PT_R6 6 | ||
102 | #define PT_R7 7 | ||
103 | #define PT_R8 8 | ||
104 | #define PT_R9 9 | ||
105 | #define PT_R10 10 | ||
106 | #define PT_R11 11 | ||
107 | #define PT_R12 12 | ||
108 | #define PT_R13 13 | ||
109 | #define PT_R14 14 | ||
110 | #define PT_R15 15 | ||
111 | #define PT_R16 16 | ||
112 | #define PT_R17 17 | ||
113 | #define PT_R18 18 | ||
114 | #define PT_R19 19 | ||
115 | #define PT_R20 20 | ||
116 | #define PT_R21 21 | ||
117 | #define PT_R22 22 | ||
118 | #define PT_R23 23 | ||
119 | #define PT_R24 24 | ||
120 | #define PT_R25 25 | ||
121 | #define PT_R26 26 | ||
122 | #define PT_R27 27 | ||
123 | #define PT_R28 28 | ||
124 | #define PT_R29 29 | ||
125 | #define PT_R30 30 | ||
126 | #define PT_R31 31 | ||
127 | |||
128 | #define PT_NIP 32 | ||
129 | #define PT_MSR 33 | ||
130 | #ifdef __KERNEL__ | ||
131 | #define PT_ORIG_R3 34 | ||
132 | #endif | ||
133 | #define PT_CTR 35 | ||
134 | #define PT_LNK 36 | ||
135 | #define PT_XER 37 | ||
136 | #define PT_CCR 38 | ||
137 | #define PT_SOFTE 39 | ||
138 | #define PT_RESULT 43 | ||
139 | |||
140 | #define PT_FPR0 48 | ||
141 | |||
142 | /* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have | ||
143 | * visibility to the asm-ppc/ptrace.h header instead of this one. | ||
144 | */ | ||
145 | #define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ | ||
146 | |||
147 | #ifdef __KERNEL__ | ||
148 | #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ | ||
149 | #endif | ||
150 | |||
151 | #define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ | ||
152 | #define PT_VSCR (PT_VR0 + 32*2 + 1) | ||
153 | #define PT_VRSAVE (PT_VR0 + 33*2) | ||
154 | |||
155 | #ifdef __KERNEL__ | ||
156 | #define PT_VR0_32 164 /* each Vector reg occupies 4 slots in 32-bit */ | ||
157 | #define PT_VSCR_32 (PT_VR0 + 32*4 + 3) | ||
158 | #define PT_VRSAVE_32 (PT_VR0 + 33*4) | ||
159 | #endif | ||
160 | |||
161 | /* | ||
162 | * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go. | ||
163 | * The transfer totals 34 quadword. Quadwords 0-31 contain the | ||
164 | * corresponding vector registers. Quadword 32 contains the vscr as the | ||
165 | * last word (offset 12) within that quadword. Quadword 33 contains the | ||
166 | * vrsave as the first word (offset 0) within the quadword. | ||
167 | * | ||
168 | * This definition of the VMX state is compatible with the current PPC32 | ||
169 | * ptrace interface. This allows signal handling and ptrace to use the same | ||
170 | * structures. This also simplifies the implementation of a bi-arch | ||
171 | * (combined (32- and 64-bit) gdb. | ||
172 | */ | ||
173 | #define PTRACE_GETVRREGS 18 | ||
174 | #define PTRACE_SETVRREGS 19 | ||
175 | |||
176 | /* Additional PTRACE requests implemented on PowerPC. */ | ||
177 | #define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ | ||
178 | #define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ | ||
179 | #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ | ||
180 | #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ | ||
181 | #define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ | ||
182 | #define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ | ||
183 | #define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ | ||
184 | #define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ | ||
185 | #define PPC_PTRACE_PEEKUSR_3264 0x91 /* Read a register (specified by ADDR) out of the "user area" on a 64-bit process from a 32-bit process. */ | ||
186 | #define PPC_PTRACE_POKEUSR_3264 0x90 /* Write DATA into location ADDR within the "user area" on a 64-bit process from a 32-bit process. */ | ||
187 | |||
188 | |||
189 | #endif /* _PPC64_PTRACE_H */ | ||
diff --git a/include/asm-ppc64/resource.h b/include/asm-ppc64/resource.h new file mode 100644 index 000000000000..add031b9dfd4 --- /dev/null +++ b/include/asm-ppc64/resource.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _PPC64_RESOURCE_H | ||
2 | #define _PPC64_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif /* _PPC64_RESOURCE_H */ | ||
diff --git a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h new file mode 100644 index 000000000000..a8ab0e9db84a --- /dev/null +++ b/include/asm-ppc64/rtas.h | |||
@@ -0,0 +1,243 @@ | |||
1 | #ifndef _PPC64_RTAS_H | ||
2 | #define _PPC64_RTAS_H | ||
3 | |||
4 | #include <linux/spinlock.h> | ||
5 | #include <asm/page.h> | ||
6 | |||
7 | /* | ||
8 | * Definitions for talking to the RTAS on CHRP machines. | ||
9 | * | ||
10 | * Copyright (C) 2001 Peter Bergner | ||
11 | * Copyright (C) 2001 PPC 64 Team, IBM Corp | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | */ | ||
18 | |||
19 | #define RTAS_UNKNOWN_SERVICE (-1) | ||
20 | #define RTAS_INSTANTIATE_MAX (1UL<<30) /* Don't instantiate rtas at/above this value */ | ||
21 | |||
22 | /* Buffer size for ppc_rtas system call. */ | ||
23 | #define RTAS_RMOBUF_MAX (64 * 1024) | ||
24 | |||
25 | /* RTAS return status codes */ | ||
26 | #define RTAS_BUSY -2 /* RTAS Busy */ | ||
27 | #define RTAS_EXTENDED_DELAY_MIN 9900 | ||
28 | #define RTAS_EXTENDED_DELAY_MAX 9905 | ||
29 | |||
30 | /* | ||
31 | * In general to call RTAS use rtas_token("string") to lookup | ||
32 | * an RTAS token for the given string (e.g. "event-scan"). | ||
33 | * To actually perform the call use | ||
34 | * ret = rtas_call(token, n_in, n_out, ...) | ||
35 | * Where n_in is the number of input parameters and | ||
36 | * n_out is the number of output parameters | ||
37 | * | ||
38 | * If the "string" is invalid on this system, RTAS_UNKNOWN_SERVICE | ||
39 | * will be returned as a token. rtas_call() does look for this | ||
40 | * token and error out gracefully so rtas_call(rtas_token("str"), ...) | ||
41 | * may be safely used for one-shot calls to RTAS. | ||
42 | * | ||
43 | */ | ||
44 | |||
45 | typedef u32 rtas_arg_t; | ||
46 | |||
47 | struct rtas_args { | ||
48 | u32 token; | ||
49 | u32 nargs; | ||
50 | u32 nret; | ||
51 | rtas_arg_t args[16]; | ||
52 | rtas_arg_t *rets; /* Pointer to return values in args[]. */ | ||
53 | }; | ||
54 | |||
55 | extern struct rtas_args rtas_stop_self_args; | ||
56 | |||
57 | struct rtas_t { | ||
58 | unsigned long entry; /* physical address pointer */ | ||
59 | unsigned long base; /* physical address pointer */ | ||
60 | unsigned long size; | ||
61 | spinlock_t lock; | ||
62 | struct rtas_args args; | ||
63 | struct device_node *dev; /* virtual address pointer */ | ||
64 | }; | ||
65 | |||
66 | /* RTAS event classes */ | ||
67 | #define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */ | ||
68 | #define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */ | ||
69 | #define RTAS_POWERMGM_EVENTS 0x20000000 /* set bit 2 */ | ||
70 | #define RTAS_HOTPLUG_EVENTS 0x10000000 /* set bit 3 */ | ||
71 | #define RTAS_EVENT_SCAN_ALL_EVENTS 0xf0000000 | ||
72 | |||
73 | /* RTAS event severity */ | ||
74 | #define RTAS_SEVERITY_FATAL 0x5 | ||
75 | #define RTAS_SEVERITY_ERROR 0x4 | ||
76 | #define RTAS_SEVERITY_ERROR_SYNC 0x3 | ||
77 | #define RTAS_SEVERITY_WARNING 0x2 | ||
78 | #define RTAS_SEVERITY_EVENT 0x1 | ||
79 | #define RTAS_SEVERITY_NO_ERROR 0x0 | ||
80 | |||
81 | /* RTAS event disposition */ | ||
82 | #define RTAS_DISP_FULLY_RECOVERED 0x0 | ||
83 | #define RTAS_DISP_LIMITED_RECOVERY 0x1 | ||
84 | #define RTAS_DISP_NOT_RECOVERED 0x2 | ||
85 | |||
86 | /* RTAS event initiator */ | ||
87 | #define RTAS_INITIATOR_UNKNOWN 0x0 | ||
88 | #define RTAS_INITIATOR_CPU 0x1 | ||
89 | #define RTAS_INITIATOR_PCI 0x2 | ||
90 | #define RTAS_INITIATOR_ISA 0x3 | ||
91 | #define RTAS_INITIATOR_MEMORY 0x4 | ||
92 | #define RTAS_INITIATOR_POWERMGM 0x5 | ||
93 | |||
94 | /* RTAS event target */ | ||
95 | #define RTAS_TARGET_UNKNOWN 0x0 | ||
96 | #define RTAS_TARGET_CPU 0x1 | ||
97 | #define RTAS_TARGET_PCI 0x2 | ||
98 | #define RTAS_TARGET_ISA 0x3 | ||
99 | #define RTAS_TARGET_MEMORY 0x4 | ||
100 | #define RTAS_TARGET_POWERMGM 0x5 | ||
101 | |||
102 | /* RTAS event type */ | ||
103 | #define RTAS_TYPE_RETRY 0x01 | ||
104 | #define RTAS_TYPE_TCE_ERR 0x02 | ||
105 | #define RTAS_TYPE_INTERN_DEV_FAIL 0x03 | ||
106 | #define RTAS_TYPE_TIMEOUT 0x04 | ||
107 | #define RTAS_TYPE_DATA_PARITY 0x05 | ||
108 | #define RTAS_TYPE_ADDR_PARITY 0x06 | ||
109 | #define RTAS_TYPE_CACHE_PARITY 0x07 | ||
110 | #define RTAS_TYPE_ADDR_INVALID 0x08 | ||
111 | #define RTAS_TYPE_ECC_UNCORR 0x09 | ||
112 | #define RTAS_TYPE_ECC_CORR 0x0a | ||
113 | #define RTAS_TYPE_EPOW 0x40 | ||
114 | #define RTAS_TYPE_PLATFORM 0xE0 | ||
115 | #define RTAS_TYPE_IO 0xE1 | ||
116 | #define RTAS_TYPE_INFO 0xE2 | ||
117 | #define RTAS_TYPE_DEALLOC 0xE3 | ||
118 | #define RTAS_TYPE_DUMP 0xE4 | ||
119 | /* I don't add PowerMGM events right now, this is a different topic */ | ||
120 | #define RTAS_TYPE_PMGM_POWER_SW_ON 0x60 | ||
121 | #define RTAS_TYPE_PMGM_POWER_SW_OFF 0x61 | ||
122 | #define RTAS_TYPE_PMGM_LID_OPEN 0x62 | ||
123 | #define RTAS_TYPE_PMGM_LID_CLOSE 0x63 | ||
124 | #define RTAS_TYPE_PMGM_SLEEP_BTN 0x64 | ||
125 | #define RTAS_TYPE_PMGM_WAKE_BTN 0x65 | ||
126 | #define RTAS_TYPE_PMGM_BATTERY_WARN 0x66 | ||
127 | #define RTAS_TYPE_PMGM_BATTERY_CRIT 0x67 | ||
128 | #define RTAS_TYPE_PMGM_SWITCH_TO_BAT 0x68 | ||
129 | #define RTAS_TYPE_PMGM_SWITCH_TO_AC 0x69 | ||
130 | #define RTAS_TYPE_PMGM_KBD_OR_MOUSE 0x6a | ||
131 | #define RTAS_TYPE_PMGM_ENCLOS_OPEN 0x6b | ||
132 | #define RTAS_TYPE_PMGM_ENCLOS_CLOSED 0x6c | ||
133 | #define RTAS_TYPE_PMGM_RING_INDICATE 0x6d | ||
134 | #define RTAS_TYPE_PMGM_LAN_ATTENTION 0x6e | ||
135 | #define RTAS_TYPE_PMGM_TIME_ALARM 0x6f | ||
136 | #define RTAS_TYPE_PMGM_CONFIG_CHANGE 0x70 | ||
137 | #define RTAS_TYPE_PMGM_SERVICE_PROC 0x71 | ||
138 | |||
139 | struct rtas_error_log { | ||
140 | unsigned long version:8; /* Architectural version */ | ||
141 | unsigned long severity:3; /* Severity level of error */ | ||
142 | unsigned long disposition:2; /* Degree of recovery */ | ||
143 | unsigned long extended:1; /* extended log present? */ | ||
144 | unsigned long /* reserved */ :2; /* Reserved for future use */ | ||
145 | unsigned long initiator:4; /* Initiator of event */ | ||
146 | unsigned long target:4; /* Target of failed operation */ | ||
147 | unsigned long type:8; /* General event or error*/ | ||
148 | unsigned long extended_log_length:32; /* length in bytes */ | ||
149 | unsigned char buffer[1]; | ||
150 | }; | ||
151 | |||
152 | struct flash_block { | ||
153 | char *data; | ||
154 | unsigned long length; | ||
155 | }; | ||
156 | |||
157 | /* This struct is very similar but not identical to | ||
158 | * that needed by the rtas flash update. | ||
159 | * All we need to do for rtas is rewrite num_blocks | ||
160 | * into a version/length and translate the pointers | ||
161 | * to absolute. | ||
162 | */ | ||
163 | #define FLASH_BLOCKS_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct flash_block)) | ||
164 | struct flash_block_list { | ||
165 | unsigned long num_blocks; | ||
166 | struct flash_block_list *next; | ||
167 | struct flash_block blocks[FLASH_BLOCKS_PER_NODE]; | ||
168 | }; | ||
169 | struct flash_block_list_header { /* just the header of flash_block_list */ | ||
170 | unsigned long num_blocks; | ||
171 | struct flash_block_list *next; | ||
172 | }; | ||
173 | extern struct flash_block_list_header rtas_firmware_flash_list; | ||
174 | |||
175 | extern struct rtas_t rtas; | ||
176 | |||
177 | extern void enter_rtas(unsigned long); | ||
178 | extern int rtas_token(const char *service); | ||
179 | extern int rtas_call(int token, int, int, int *, ...); | ||
180 | extern void call_rtas_display_status(unsigned char); | ||
181 | extern void rtas_restart(char *cmd); | ||
182 | extern void rtas_power_off(void); | ||
183 | extern void rtas_halt(void); | ||
184 | extern void rtas_os_term(char *str); | ||
185 | extern int rtas_get_sensor(int sensor, int index, int *state); | ||
186 | extern int rtas_get_power_level(int powerdomain, int *level); | ||
187 | extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); | ||
188 | extern int rtas_set_indicator(int indicator, int index, int new_value); | ||
189 | extern void rtas_initialize(void); | ||
190 | |||
191 | /* Given an RTAS status code of 9900..9905 compute the hinted delay */ | ||
192 | unsigned int rtas_extended_busy_delay_time(int status); | ||
193 | static inline int rtas_is_extended_busy(int status) | ||
194 | { | ||
195 | return status >= 9900 && status <= 9909; | ||
196 | } | ||
197 | |||
198 | extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); | ||
199 | |||
200 | /* Error types logged. */ | ||
201 | #define ERR_FLAG_ALREADY_LOGGED 0x0 | ||
202 | #define ERR_FLAG_BOOT 0x1 /* log was pulled from NVRAM on boot */ | ||
203 | #define ERR_TYPE_RTAS_LOG 0x2 /* from rtas event-scan */ | ||
204 | #define ERR_TYPE_KERNEL_PANIC 0x4 /* from panic() */ | ||
205 | |||
206 | /* All the types and not flags */ | ||
207 | #define ERR_TYPE_MASK (ERR_TYPE_RTAS_LOG | ERR_TYPE_KERNEL_PANIC) | ||
208 | |||
209 | #define RTAS_DEBUG KERN_DEBUG "RTAS: " | ||
210 | |||
211 | #define RTAS_ERROR_LOG_MAX 2048 | ||
212 | |||
213 | /* | ||
214 | * Return the firmware-specified size of the error log buffer | ||
215 | * for all rtas calls that require an error buffer argument. | ||
216 | * This includes 'check-exception' and 'rtas-last-error'. | ||
217 | */ | ||
218 | extern int rtas_get_error_log_max(void); | ||
219 | |||
220 | /* Event Scan Parameters */ | ||
221 | #define EVENT_SCAN_ALL_EVENTS 0xf0000000 | ||
222 | #define SURVEILLANCE_TOKEN 9000 | ||
223 | #define LOG_NUMBER 64 /* must be a power of two */ | ||
224 | #define LOG_NUMBER_MASK (LOG_NUMBER-1) | ||
225 | |||
226 | /* Some RTAS ops require a data buffer and that buffer must be < 4G. | ||
227 | * Rather than having a memory allocator, just use this buffer | ||
228 | * (get the lock first), make the RTAS call. Copy the data instead | ||
229 | * of holding the buffer for long. | ||
230 | */ | ||
231 | |||
232 | #define RTAS_DATA_BUF_SIZE 4096 | ||
233 | extern spinlock_t rtas_data_buf_lock; | ||
234 | extern char rtas_data_buf[RTAS_DATA_BUF_SIZE]; | ||
235 | |||
236 | extern void rtas_stop_self(void); | ||
237 | |||
238 | /* RMO buffer reserved for user-space RTAS use */ | ||
239 | extern unsigned long rtas_rmo_buf; | ||
240 | |||
241 | #define GLOBAL_INTERRUPT_QUEUE 9005 | ||
242 | |||
243 | #endif /* _PPC64_RTAS_H */ | ||
diff --git a/include/asm-ppc64/rwsem.h b/include/asm-ppc64/rwsem.h new file mode 100644 index 000000000000..bd5c2f093575 --- /dev/null +++ b/include/asm-ppc64/rwsem.h | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * include/asm-ppc64/rwsem.h: R/W semaphores for PPC using the stuff | ||
3 | * in lib/rwsem.c. Adapted largely from include/asm-i386/rwsem.h | ||
4 | * by Paul Mackerras <paulus@samba.org>. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _PPC64_RWSEM_H | ||
13 | #define _PPC64_RWSEM_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | #include <asm/atomic.h> | ||
19 | #include <asm/system.h> | ||
20 | |||
21 | /* | ||
22 | * the semaphore definition | ||
23 | */ | ||
24 | struct rw_semaphore { | ||
25 | /* XXX this should be able to be an atomic_t -- paulus */ | ||
26 | signed int count; | ||
27 | #define RWSEM_UNLOCKED_VALUE 0x00000000 | ||
28 | #define RWSEM_ACTIVE_BIAS 0x00000001 | ||
29 | #define RWSEM_ACTIVE_MASK 0x0000ffff | ||
30 | #define RWSEM_WAITING_BIAS (-0x00010000) | ||
31 | #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS | ||
32 | #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) | ||
33 | spinlock_t wait_lock; | ||
34 | struct list_head wait_list; | ||
35 | #if RWSEM_DEBUG | ||
36 | int debug; | ||
37 | #endif | ||
38 | }; | ||
39 | |||
40 | /* | ||
41 | * initialisation | ||
42 | */ | ||
43 | #if RWSEM_DEBUG | ||
44 | #define __RWSEM_DEBUG_INIT , 0 | ||
45 | #else | ||
46 | #define __RWSEM_DEBUG_INIT /* */ | ||
47 | #endif | ||
48 | |||
49 | #define __RWSEM_INITIALIZER(name) \ | ||
50 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ | ||
51 | LIST_HEAD_INIT((name).wait_list) \ | ||
52 | __RWSEM_DEBUG_INIT } | ||
53 | |||
54 | #define DECLARE_RWSEM(name) \ | ||
55 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | ||
56 | |||
57 | extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); | ||
58 | extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); | ||
59 | extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); | ||
60 | extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); | ||
61 | |||
62 | static inline void init_rwsem(struct rw_semaphore *sem) | ||
63 | { | ||
64 | sem->count = RWSEM_UNLOCKED_VALUE; | ||
65 | spin_lock_init(&sem->wait_lock); | ||
66 | INIT_LIST_HEAD(&sem->wait_list); | ||
67 | #if RWSEM_DEBUG | ||
68 | sem->debug = 0; | ||
69 | #endif | ||
70 | } | ||
71 | |||
72 | /* | ||
73 | * lock for reading | ||
74 | */ | ||
75 | static inline void __down_read(struct rw_semaphore *sem) | ||
76 | { | ||
77 | if (unlikely(atomic_inc_return((atomic_t *)(&sem->count)) <= 0)) | ||
78 | rwsem_down_read_failed(sem); | ||
79 | } | ||
80 | |||
81 | static inline int __down_read_trylock(struct rw_semaphore *sem) | ||
82 | { | ||
83 | int tmp; | ||
84 | |||
85 | while ((tmp = sem->count) >= 0) { | ||
86 | if (tmp == cmpxchg(&sem->count, tmp, | ||
87 | tmp + RWSEM_ACTIVE_READ_BIAS)) { | ||
88 | return 1; | ||
89 | } | ||
90 | } | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * lock for writing | ||
96 | */ | ||
97 | static inline void __down_write(struct rw_semaphore *sem) | ||
98 | { | ||
99 | int tmp; | ||
100 | |||
101 | tmp = atomic_add_return(RWSEM_ACTIVE_WRITE_BIAS, | ||
102 | (atomic_t *)(&sem->count)); | ||
103 | if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS)) | ||
104 | rwsem_down_write_failed(sem); | ||
105 | } | ||
106 | |||
107 | static inline int __down_write_trylock(struct rw_semaphore *sem) | ||
108 | { | ||
109 | int tmp; | ||
110 | |||
111 | tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE, | ||
112 | RWSEM_ACTIVE_WRITE_BIAS); | ||
113 | return tmp == RWSEM_UNLOCKED_VALUE; | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * unlock after reading | ||
118 | */ | ||
119 | static inline void __up_read(struct rw_semaphore *sem) | ||
120 | { | ||
121 | int tmp; | ||
122 | |||
123 | tmp = atomic_dec_return((atomic_t *)(&sem->count)); | ||
124 | if (unlikely(tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0)) | ||
125 | rwsem_wake(sem); | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | * unlock after writing | ||
130 | */ | ||
131 | static inline void __up_write(struct rw_semaphore *sem) | ||
132 | { | ||
133 | if (unlikely(atomic_sub_return(RWSEM_ACTIVE_WRITE_BIAS, | ||
134 | (atomic_t *)(&sem->count)) < 0)) | ||
135 | rwsem_wake(sem); | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * implement atomic add functionality | ||
140 | */ | ||
141 | static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem) | ||
142 | { | ||
143 | atomic_add(delta, (atomic_t *)(&sem->count)); | ||
144 | } | ||
145 | |||
146 | /* | ||
147 | * downgrade write lock to read lock | ||
148 | */ | ||
149 | static inline void __downgrade_write(struct rw_semaphore *sem) | ||
150 | { | ||
151 | int tmp; | ||
152 | |||
153 | tmp = atomic_add_return(-RWSEM_WAITING_BIAS, (atomic_t *)(&sem->count)); | ||
154 | if (tmp < 0) | ||
155 | rwsem_downgrade_wake(sem); | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * implement exchange and add functionality | ||
160 | */ | ||
161 | static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) | ||
162 | { | ||
163 | return atomic_add_return(delta, (atomic_t *)(&sem->count)); | ||
164 | } | ||
165 | |||
166 | #endif /* __KERNEL__ */ | ||
167 | #endif /* _PPC_RWSEM_XADD_H */ | ||
diff --git a/include/asm-ppc64/scatterlist.h b/include/asm-ppc64/scatterlist.h new file mode 100644 index 000000000000..cecce6c6dfbb --- /dev/null +++ b/include/asm-ppc64/scatterlist.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _PPC64_SCATTERLIST_H | ||
2 | #define _PPC64_SCATTERLIST_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2001 PPC64 Team, IBM Corp | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <asm/dma.h> | ||
15 | |||
16 | struct scatterlist { | ||
17 | struct page *page; | ||
18 | unsigned int offset; | ||
19 | unsigned int length; | ||
20 | |||
21 | /* For TCE support */ | ||
22 | u32 dma_address; | ||
23 | u32 dma_length; | ||
24 | }; | ||
25 | |||
26 | #define sg_dma_address(sg) ((sg)->dma_address) | ||
27 | #define sg_dma_len(sg) ((sg)->dma_length) | ||
28 | |||
29 | #define ISA_DMA_THRESHOLD (~0UL) | ||
30 | |||
31 | #endif /* !(_PPC64_SCATTERLIST_H) */ | ||
diff --git a/include/asm-ppc64/seccomp.h b/include/asm-ppc64/seccomp.h new file mode 100644 index 000000000000..c130c334bda1 --- /dev/null +++ b/include/asm-ppc64/seccomp.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _ASM_SECCOMP_H | ||
2 | |||
3 | #include <linux/thread_info.h> /* already defines TIF_32BIT */ | ||
4 | |||
5 | #ifndef TIF_32BIT | ||
6 | #error "unexpected TIF_32BIT on ppc64" | ||
7 | #endif | ||
8 | |||
9 | #include <linux/unistd.h> | ||
10 | |||
11 | #define __NR_seccomp_read __NR_read | ||
12 | #define __NR_seccomp_write __NR_write | ||
13 | #define __NR_seccomp_exit __NR_exit | ||
14 | #define __NR_seccomp_sigreturn __NR_rt_sigreturn | ||
15 | |||
16 | #define __NR_seccomp_read_32 __NR_read | ||
17 | #define __NR_seccomp_write_32 __NR_write | ||
18 | #define __NR_seccomp_exit_32 __NR_exit | ||
19 | #define __NR_seccomp_sigreturn_32 __NR_sigreturn | ||
20 | |||
21 | #endif /* _ASM_SECCOMP_H */ | ||
diff --git a/include/asm-ppc64/sections.h b/include/asm-ppc64/sections.h new file mode 100644 index 000000000000..308ca6f5ced2 --- /dev/null +++ b/include/asm-ppc64/sections.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef _PPC64_SECTIONS_H | ||
2 | #define _PPC64_SECTIONS_H | ||
3 | |||
4 | extern char _end[]; | ||
5 | |||
6 | #include <asm-generic/sections.h> | ||
7 | |||
8 | #define __pmac | ||
9 | #define __pmacdata | ||
10 | |||
11 | #define __prep | ||
12 | #define __prepdata | ||
13 | |||
14 | #define __chrp | ||
15 | #define __chrpdata | ||
16 | |||
17 | #define __openfirmware | ||
18 | #define __openfirmwaredata | ||
19 | |||
20 | |||
21 | static inline int in_kernel_text(unsigned long addr) | ||
22 | { | ||
23 | if (addr >= (unsigned long)_stext && addr < (unsigned long)__init_end) | ||
24 | return 1; | ||
25 | |||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | #endif | ||
diff --git a/include/asm-ppc64/segment.h b/include/asm-ppc64/segment.h new file mode 100644 index 000000000000..d80fb68cc79e --- /dev/null +++ b/include/asm-ppc64/segment.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __PPC64_SEGMENT_H | ||
2 | #define __PPC64_SEGMENT_H | ||
3 | |||
4 | /* Only here because we have some old header files that expect it.. */ | ||
5 | |||
6 | #endif /* __PPC64_SEGMENT_H */ | ||
diff --git a/include/asm-ppc64/semaphore.h b/include/asm-ppc64/semaphore.h new file mode 100644 index 000000000000..aefe7753ea41 --- /dev/null +++ b/include/asm-ppc64/semaphore.h | |||
@@ -0,0 +1,98 @@ | |||
1 | #ifndef _PPC64_SEMAPHORE_H | ||
2 | #define _PPC64_SEMAPHORE_H | ||
3 | |||
4 | /* | ||
5 | * Remove spinlock-based RW semaphores; RW semaphore definitions are | ||
6 | * now in rwsem.h and we use the generic lib/rwsem.c implementation. | ||
7 | * Rework semaphores to use atomic_dec_if_positive. | ||
8 | * -- Paul Mackerras (paulus@samba.org) | ||
9 | */ | ||
10 | |||
11 | #ifdef __KERNEL__ | ||
12 | |||
13 | #include <asm/atomic.h> | ||
14 | #include <asm/system.h> | ||
15 | #include <linux/wait.h> | ||
16 | #include <linux/rwsem.h> | ||
17 | |||
18 | struct semaphore { | ||
19 | /* | ||
20 | * Note that any negative value of count is equivalent to 0, | ||
21 | * but additionally indicates that some process(es) might be | ||
22 | * sleeping on `wait'. | ||
23 | */ | ||
24 | atomic_t count; | ||
25 | wait_queue_head_t wait; | ||
26 | }; | ||
27 | |||
28 | #define __SEMAPHORE_INITIALIZER(name, n) \ | ||
29 | { \ | ||
30 | .count = ATOMIC_INIT(n), \ | ||
31 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ | ||
32 | } | ||
33 | |||
34 | #define __MUTEX_INITIALIZER(name) \ | ||
35 | __SEMAPHORE_INITIALIZER(name, 1) | ||
36 | |||
37 | #define __DECLARE_SEMAPHORE_GENERIC(name, count) \ | ||
38 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) | ||
39 | |||
40 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1) | ||
41 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name, 0) | ||
42 | |||
43 | static inline void sema_init (struct semaphore *sem, int val) | ||
44 | { | ||
45 | atomic_set(&sem->count, val); | ||
46 | init_waitqueue_head(&sem->wait); | ||
47 | } | ||
48 | |||
49 | static inline void init_MUTEX (struct semaphore *sem) | ||
50 | { | ||
51 | sema_init(sem, 1); | ||
52 | } | ||
53 | |||
54 | static inline void init_MUTEX_LOCKED (struct semaphore *sem) | ||
55 | { | ||
56 | sema_init(sem, 0); | ||
57 | } | ||
58 | |||
59 | extern void __down(struct semaphore * sem); | ||
60 | extern int __down_interruptible(struct semaphore * sem); | ||
61 | extern void __up(struct semaphore * sem); | ||
62 | |||
63 | static inline void down(struct semaphore * sem) | ||
64 | { | ||
65 | might_sleep(); | ||
66 | |||
67 | /* | ||
68 | * Try to get the semaphore, take the slow path if we fail. | ||
69 | */ | ||
70 | if (unlikely(atomic_dec_return(&sem->count) < 0)) | ||
71 | __down(sem); | ||
72 | } | ||
73 | |||
74 | static inline int down_interruptible(struct semaphore * sem) | ||
75 | { | ||
76 | int ret = 0; | ||
77 | |||
78 | might_sleep(); | ||
79 | |||
80 | if (unlikely(atomic_dec_return(&sem->count) < 0)) | ||
81 | ret = __down_interruptible(sem); | ||
82 | return ret; | ||
83 | } | ||
84 | |||
85 | static inline int down_trylock(struct semaphore * sem) | ||
86 | { | ||
87 | return atomic_dec_if_positive(&sem->count) < 0; | ||
88 | } | ||
89 | |||
90 | static inline void up(struct semaphore * sem) | ||
91 | { | ||
92 | if (unlikely(atomic_inc_return(&sem->count) <= 0)) | ||
93 | __up(sem); | ||
94 | } | ||
95 | |||
96 | #endif /* __KERNEL__ */ | ||
97 | |||
98 | #endif /* !(_PPC64_SEMAPHORE_H) */ | ||
diff --git a/include/asm-ppc64/sembuf.h b/include/asm-ppc64/sembuf.h new file mode 100644 index 000000000000..172e59000767 --- /dev/null +++ b/include/asm-ppc64/sembuf.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _PPC64_SEMBUF_H | ||
2 | #define _PPC64_SEMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The semid64_ds structure for PPC architecture. | ||
6 | * | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * Pad space is left for: | ||
14 | * - 2 miscellaneous 64-bit values | ||
15 | */ | ||
16 | |||
17 | struct semid64_ds { | ||
18 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | ||
19 | __kernel_time_t sem_otime; /* last semop time */ | ||
20 | __kernel_time_t sem_ctime; /* last change time */ | ||
21 | unsigned long sem_nsems; /* no. of semaphores in array */ | ||
22 | |||
23 | unsigned long __unused1; | ||
24 | unsigned long __unused2; | ||
25 | }; | ||
26 | |||
27 | #endif /* _PPC64_SEMBUF_H */ | ||
diff --git a/include/asm-ppc64/serial.h b/include/asm-ppc64/serial.h new file mode 100644 index 000000000000..d6bcb79b7d7b --- /dev/null +++ b/include/asm-ppc64/serial.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * include/asm-ppc64/serial.h | ||
3 | */ | ||
4 | #ifndef _PPC64_SERIAL_H | ||
5 | #define _PPC64_SERIAL_H | ||
6 | |||
7 | /* | ||
8 | * This assumes you have a 1.8432 MHz clock for your UART. | ||
9 | * | ||
10 | * It'd be nice if someone built a serial card with a 24.576 MHz | ||
11 | * clock, since the 16550A is capable of handling a top speed of 1.5 | ||
12 | * megabits/second; but this requires the faster clock. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version | ||
17 | * 2 of the License, or (at your option) any later version. | ||
18 | */ | ||
19 | |||
20 | /* Default baud base if not found in device-tree */ | ||
21 | #define BASE_BAUD ( 1843200 / 16 ) | ||
22 | |||
23 | #endif /* _PPC64_SERIAL_H */ | ||
diff --git a/include/asm-ppc64/setup.h b/include/asm-ppc64/setup.h new file mode 100644 index 000000000000..b257b8348c73 --- /dev/null +++ b/include/asm-ppc64/setup.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _PPC_SETUP_H | ||
2 | #define _PPC_SETUP_H | ||
3 | |||
4 | #define COMMAND_LINE_SIZE 512 | ||
5 | |||
6 | #endif /* _PPC_SETUP_H */ | ||
diff --git a/include/asm-ppc64/shmbuf.h b/include/asm-ppc64/shmbuf.h new file mode 100644 index 000000000000..02e99d6ec925 --- /dev/null +++ b/include/asm-ppc64/shmbuf.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef _PPC64_SHMBUF_H | ||
2 | #define _PPC64_SHMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The shmid64_ds structure for PPC64 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 | * - 2 miscellaneous 64-bit values | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version | ||
15 | * 2 of the License, or (at your option) any later version. | ||
16 | */ | ||
17 | |||
18 | struct shmid64_ds { | ||
19 | struct ipc64_perm shm_perm; /* operation perms */ | ||
20 | __kernel_time_t shm_atime; /* last attach time */ | ||
21 | __kernel_time_t shm_dtime; /* last detach time */ | ||
22 | __kernel_time_t shm_ctime; /* last change time */ | ||
23 | size_t shm_segsz; /* size of segment (bytes) */ | ||
24 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
25 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
26 | unsigned long shm_nattch; /* no. of current attaches */ | ||
27 | unsigned long __unused1; | ||
28 | unsigned long __unused2; | ||
29 | }; | ||
30 | |||
31 | struct shminfo64 { | ||
32 | unsigned long shmmax; | ||
33 | unsigned long shmmin; | ||
34 | unsigned long shmmni; | ||
35 | unsigned long shmseg; | ||
36 | unsigned long shmall; | ||
37 | unsigned long __unused1; | ||
38 | unsigned long __unused2; | ||
39 | unsigned long __unused3; | ||
40 | unsigned long __unused4; | ||
41 | }; | ||
42 | |||
43 | #endif /* _PPC64_SHMBUF_H */ | ||
diff --git a/include/asm-ppc64/shmparam.h b/include/asm-ppc64/shmparam.h new file mode 100644 index 000000000000..b2825ceff05e --- /dev/null +++ b/include/asm-ppc64/shmparam.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _PPC64_SHMPARAM_H | ||
2 | #define _PPC64_SHMPARAM_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | ||
12 | |||
13 | #endif /* _PPC64_SHMPARAM_H */ | ||
diff --git a/include/asm-ppc64/sigcontext.h b/include/asm-ppc64/sigcontext.h new file mode 100644 index 000000000000..6f8aee768c5e --- /dev/null +++ b/include/asm-ppc64/sigcontext.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef _ASM_PPC64_SIGCONTEXT_H | ||
2 | #define _ASM_PPC64_SIGCONTEXT_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | #include <linux/compiler.h> | ||
11 | #include <asm/ptrace.h> | ||
12 | #include <asm/elf.h> | ||
13 | |||
14 | |||
15 | struct sigcontext { | ||
16 | unsigned long _unused[4]; | ||
17 | int signal; | ||
18 | int _pad0; | ||
19 | unsigned long handler; | ||
20 | unsigned long oldmask; | ||
21 | struct pt_regs __user *regs; | ||
22 | elf_gregset_t gp_regs; | ||
23 | elf_fpregset_t fp_regs; | ||
24 | /* | ||
25 | * To maintain compatibility with current implementations the sigcontext is | ||
26 | * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t) | ||
27 | * followed by an unstructured (vmx_reserve) field of 69 doublewords. This | ||
28 | * allows the array of vector registers to be quadword aligned independent of | ||
29 | * the alignment of the containing sigcontext or ucontext. It is the | ||
30 | * responsibility of the code setting the sigcontext to set this pointer to | ||
31 | * either NULL (if this processor does not support the VMX feature) or the | ||
32 | * address of the first quadword within the allocated (vmx_reserve) area. | ||
33 | * | ||
34 | * The pointer (v_regs) of vector type (elf_vrreg_t) is type compatible with | ||
35 | * an array of 34 quadword entries (elf_vrregset_t). The entries with | ||
36 | * indexes 0-31 contain the corresponding vector registers. The entry with | ||
37 | * index 32 contains the vscr as the last word (offset 12) within the | ||
38 | * quadword. This allows the vscr to be stored as either a quadword (since | ||
39 | * it must be copied via a vector register to/from storage) or as a word. | ||
40 | * The entry with index 33 contains the vrsave as the first word (offset 0) | ||
41 | * within the quadword. | ||
42 | */ | ||
43 | elf_vrreg_t __user *v_regs; | ||
44 | long vmx_reserve[ELF_NVRREG+ELF_NVRREG+1]; | ||
45 | }; | ||
46 | |||
47 | #endif /* _ASM_PPC64_SIGCONTEXT_H */ | ||
diff --git a/include/asm-ppc64/siginfo.h b/include/asm-ppc64/siginfo.h new file mode 100644 index 000000000000..3a7c23dcb5aa --- /dev/null +++ b/include/asm-ppc64/siginfo.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _PPC64_SIGINFO_H | ||
2 | #define _PPC64_SIGINFO_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) | ||
12 | #define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3) | ||
13 | |||
14 | #include <asm-generic/siginfo.h> | ||
15 | |||
16 | #endif /* _PPC64_SIGINFO_H */ | ||
diff --git a/include/asm-ppc64/signal.h b/include/asm-ppc64/signal.h new file mode 100644 index 000000000000..fe5401adb41b --- /dev/null +++ b/include/asm-ppc64/signal.h | |||
@@ -0,0 +1,159 @@ | |||
1 | #ifndef _ASMPPC64_SIGNAL_H | ||
2 | #define _ASMPPC64_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/compiler.h> | ||
6 | #include <asm/siginfo.h> | ||
7 | |||
8 | /* Avoid too many header ordering problems. */ | ||
9 | struct siginfo; | ||
10 | |||
11 | #define _NSIG 64 | ||
12 | #define _NSIG_BPW 64 | ||
13 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
14 | |||
15 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
16 | |||
17 | typedef struct { | ||
18 | unsigned long sig[_NSIG_WORDS]; | ||
19 | } sigset_t; | ||
20 | |||
21 | #define SIGHUP 1 | ||
22 | #define SIGINT 2 | ||
23 | #define SIGQUIT 3 | ||
24 | #define SIGILL 4 | ||
25 | #define SIGTRAP 5 | ||
26 | #define SIGABRT 6 | ||
27 | #define SIGIOT 6 | ||
28 | #define SIGBUS 7 | ||
29 | #define SIGFPE 8 | ||
30 | #define SIGKILL 9 | ||
31 | #define SIGUSR1 10 | ||
32 | #define SIGSEGV 11 | ||
33 | #define SIGUSR2 12 | ||
34 | #define SIGPIPE 13 | ||
35 | #define SIGALRM 14 | ||
36 | #define SIGTERM 15 | ||
37 | #define SIGSTKFLT 16 | ||
38 | #define SIGCHLD 17 | ||
39 | #define SIGCONT 18 | ||
40 | #define SIGSTOP 19 | ||
41 | #define SIGTSTP 20 | ||
42 | #define SIGTTIN 21 | ||
43 | #define SIGTTOU 22 | ||
44 | #define SIGURG 23 | ||
45 | #define SIGXCPU 24 | ||
46 | #define SIGXFSZ 25 | ||
47 | #define SIGVTALRM 26 | ||
48 | #define SIGPROF 27 | ||
49 | #define SIGWINCH 28 | ||
50 | #define SIGIO 29 | ||
51 | #define SIGPOLL SIGIO | ||
52 | /* | ||
53 | #define SIGLOST 29 | ||
54 | */ | ||
55 | #define SIGPWR 30 | ||
56 | #define SIGSYS 31 | ||
57 | #define SIGUNUSED 31 | ||
58 | |||
59 | /* These should not be considered constants from userland. */ | ||
60 | #define SIGRTMIN 32 | ||
61 | #define SIGRTMAX _NSIG | ||
62 | |||
63 | /* | ||
64 | * SA_FLAGS values: | ||
65 | * | ||
66 | * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). | ||
67 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the | ||
68 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
69 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
70 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
71 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
72 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
73 | * | ||
74 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
75 | * Unix names RESETHAND and NODEFER respectively. | ||
76 | */ | ||
77 | #define SA_NOCLDSTOP 0x00000001u | ||
78 | #define SA_NOCLDWAIT 0x00000002u | ||
79 | #define SA_SIGINFO 0x00000004u | ||
80 | #define SA_ONSTACK 0x08000000u | ||
81 | #define SA_RESTART 0x10000000u | ||
82 | #define SA_NODEFER 0x40000000u | ||
83 | #define SA_RESETHAND 0x80000000u | ||
84 | |||
85 | #define SA_NOMASK SA_NODEFER | ||
86 | #define SA_ONESHOT SA_RESETHAND | ||
87 | #define SA_INTERRUPT 0x20000000u /* dummy -- ignored */ | ||
88 | |||
89 | #define SA_RESTORER 0x04000000u | ||
90 | |||
91 | /* | ||
92 | * sigaltstack controls | ||
93 | */ | ||
94 | #define SS_ONSTACK 1 | ||
95 | #define SS_DISABLE 2 | ||
96 | |||
97 | #define MINSIGSTKSZ 2048 | ||
98 | #define SIGSTKSZ 8192 | ||
99 | #ifdef __KERNEL__ | ||
100 | |||
101 | /* | ||
102 | * These values of sa_flags are used only by the kernel as part of the | ||
103 | * irq handling routines. | ||
104 | * | ||
105 | * SA_INTERRUPT is also used by the irq handling routines. | ||
106 | * SA_SHIRQ is for shared interrupt support on PCI and EISA. | ||
107 | */ | ||
108 | #define SA_PROBE SA_ONESHOT | ||
109 | #define SA_SAMPLE_RANDOM SA_RESTART | ||
110 | #define SA_SHIRQ 0x04000000 | ||
111 | #endif | ||
112 | |||
113 | #define SIG_BLOCK 0 /* for blocking signals */ | ||
114 | #define SIG_UNBLOCK 1 /* for unblocking signals */ | ||
115 | #define SIG_SETMASK 2 /* for setting the signal mask */ | ||
116 | |||
117 | /* Type of a signal handler. */ | ||
118 | typedef void __sigfunction(int); | ||
119 | typedef __sigfunction __user * __sighandler_t; | ||
120 | |||
121 | /* Type of the restorer function */ | ||
122 | typedef void __sigrestorer(void); | ||
123 | typedef __sigrestorer __user * __sigrestorer_t; | ||
124 | |||
125 | #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ | ||
126 | #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ | ||
127 | #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ | ||
128 | |||
129 | struct old_sigaction { | ||
130 | __sighandler_t sa_handler; | ||
131 | old_sigset_t sa_mask; | ||
132 | unsigned long sa_flags; | ||
133 | __sigrestorer_t sa_restorer; | ||
134 | }; | ||
135 | |||
136 | struct sigaction { | ||
137 | __sighandler_t sa_handler; | ||
138 | unsigned long sa_flags; | ||
139 | __sigrestorer_t sa_restorer; | ||
140 | sigset_t sa_mask; /* mask last for extensibility */ | ||
141 | }; | ||
142 | |||
143 | struct k_sigaction { | ||
144 | struct sigaction sa; | ||
145 | }; | ||
146 | |||
147 | typedef struct sigaltstack { | ||
148 | void __user *ss_sp; | ||
149 | int ss_flags; | ||
150 | size_t ss_size; | ||
151 | } stack_t; | ||
152 | |||
153 | struct pt_regs; | ||
154 | struct timespec; | ||
155 | extern int do_signal(sigset_t *oldset, struct pt_regs *regs); | ||
156 | extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); | ||
157 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
158 | |||
159 | #endif /* _ASMPPC64_SIGNAL_H */ | ||
diff --git a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h new file mode 100644 index 000000000000..c8646fa999c2 --- /dev/null +++ b/include/asm-ppc64/smp.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * smp.h: PPC64 specific SMP code. | ||
3 | * | ||
4 | * Original was a copy of sparc smp.h. Now heavily modified | ||
5 | * for PPC. | ||
6 | * | ||
7 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
8 | * Copyright (C) 1996-2001 Cort Dougan <cort@fsmlabs.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | #ifndef _PPC64_SMP_H | ||
18 | #define _PPC64_SMP_H | ||
19 | |||
20 | #include <linux/config.h> | ||
21 | #include <linux/threads.h> | ||
22 | #include <linux/cpumask.h> | ||
23 | #include <linux/kernel.h> | ||
24 | |||
25 | #ifndef __ASSEMBLY__ | ||
26 | |||
27 | #include <asm/paca.h> | ||
28 | |||
29 | extern int boot_cpuid; | ||
30 | extern int boot_cpuid_phys; | ||
31 | |||
32 | extern void cpu_die(void); | ||
33 | |||
34 | #ifdef CONFIG_SMP | ||
35 | |||
36 | extern void smp_send_debugger_break(int cpu); | ||
37 | struct pt_regs; | ||
38 | extern void smp_message_recv(int, struct pt_regs *); | ||
39 | |||
40 | #ifdef CONFIG_HOTPLUG_CPU | ||
41 | extern void fixup_irqs(cpumask_t map); | ||
42 | int generic_cpu_disable(void); | ||
43 | int generic_cpu_enable(unsigned int cpu); | ||
44 | void generic_cpu_die(unsigned int cpu); | ||
45 | void generic_mach_cpu_die(void); | ||
46 | #endif | ||
47 | |||
48 | #define __smp_processor_id() (get_paca()->paca_index) | ||
49 | #define hard_smp_processor_id() (get_paca()->hw_cpu_id) | ||
50 | |||
51 | extern cpumask_t cpu_sibling_map[NR_CPUS]; | ||
52 | |||
53 | /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. | ||
54 | * | ||
55 | * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up | ||
56 | * in /proc/interrupts will be wrong!!! --Troy */ | ||
57 | #define PPC_MSG_CALL_FUNCTION 0 | ||
58 | #define PPC_MSG_RESCHEDULE 1 | ||
59 | /* This is unused now */ | ||
60 | #if 0 | ||
61 | #define PPC_MSG_MIGRATE_TASK 2 | ||
62 | #endif | ||
63 | #define PPC_MSG_DEBUGGER_BREAK 3 | ||
64 | |||
65 | void smp_init_iSeries(void); | ||
66 | void smp_init_pSeries(void); | ||
67 | |||
68 | extern int __cpu_disable(void); | ||
69 | extern void __cpu_die(unsigned int cpu); | ||
70 | #endif /* CONFIG_SMP */ | ||
71 | |||
72 | #define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id) | ||
73 | #define set_hard_smp_processor_id(CPU, VAL) \ | ||
74 | do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0) | ||
75 | |||
76 | extern int smt_enabled_at_boot; | ||
77 | |||
78 | extern int smp_mpic_probe(void); | ||
79 | extern void smp_mpic_setup_cpu(int cpu); | ||
80 | extern void smp_mpic_message_pass(int target, int msg); | ||
81 | extern void smp_generic_kick_cpu(int nr); | ||
82 | |||
83 | extern void smp_generic_give_timebase(void); | ||
84 | extern void smp_generic_take_timebase(void); | ||
85 | |||
86 | extern struct smp_ops_t *smp_ops; | ||
87 | |||
88 | #endif /* __ASSEMBLY__ */ | ||
89 | |||
90 | #endif /* !(_PPC64_SMP_H) */ | ||
91 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc64/smu.h b/include/asm-ppc64/smu.h new file mode 100644 index 000000000000..10b4397af9aa --- /dev/null +++ b/include/asm-ppc64/smu.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Definitions for talking to the SMU chip in newer G5 PowerMacs | ||
3 | */ | ||
4 | |||
5 | #include <linux/config.h> | ||
6 | |||
7 | /* | ||
8 | * Basic routines for use by architecture. To be extended as | ||
9 | * we understand more of the chip | ||
10 | */ | ||
11 | extern int smu_init(void); | ||
12 | extern int smu_present(void); | ||
13 | extern void smu_shutdown(void); | ||
14 | extern void smu_restart(void); | ||
15 | extern int smu_get_rtc_time(struct rtc_time *time); | ||
16 | extern int smu_set_rtc_time(struct rtc_time *time); | ||
17 | |||
18 | /* | ||
19 | * SMU command buffer absolute address, exported by pmac_setup, | ||
20 | * this is allocated very early during boot. | ||
21 | */ | ||
22 | extern unsigned long smu_cmdbuf_abs; | ||
diff --git a/include/asm-ppc64/socket.h b/include/asm-ppc64/socket.h new file mode 100644 index 000000000000..59e00dfc8b8e --- /dev/null +++ b/include/asm-ppc64/socket.h | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef _ASM_SOCKET_H | ||
2 | #define _ASM_SOCKET_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <asm/sockios.h> | ||
12 | |||
13 | /* For setsockoptions(2) */ | ||
14 | #define SOL_SOCKET 1 | ||
15 | |||
16 | #define SO_DEBUG 1 | ||
17 | #define SO_REUSEADDR 2 | ||
18 | #define SO_TYPE 3 | ||
19 | #define SO_ERROR 4 | ||
20 | #define SO_DONTROUTE 5 | ||
21 | #define SO_BROADCAST 6 | ||
22 | #define SO_SNDBUF 7 | ||
23 | #define SO_RCVBUF 8 | ||
24 | #define SO_KEEPALIVE 9 | ||
25 | #define SO_OOBINLINE 10 | ||
26 | #define SO_NO_CHECK 11 | ||
27 | #define SO_PRIORITY 12 | ||
28 | #define SO_LINGER 13 | ||
29 | #define SO_BSDCOMPAT 14 | ||
30 | /* To add :#define SO_REUSEPORT 15 */ | ||
31 | #define SO_RCVLOWAT 16 | ||
32 | #define SO_SNDLOWAT 17 | ||
33 | #define SO_RCVTIMEO 18 | ||
34 | #define SO_SNDTIMEO 19 | ||
35 | #define SO_PASSCRED 20 | ||
36 | #define SO_PEERCRED 21 | ||
37 | |||
38 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
39 | #define SO_SECURITY_AUTHENTICATION 22 | ||
40 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 | ||
41 | #define SO_SECURITY_ENCRYPTION_NETWORK 24 | ||
42 | |||
43 | #define SO_BINDTODEVICE 25 | ||
44 | |||
45 | /* Socket filtering */ | ||
46 | #define SO_ATTACH_FILTER 26 | ||
47 | #define SO_DETACH_FILTER 27 | ||
48 | |||
49 | #define SO_PEERNAME 28 | ||
50 | #define SO_TIMESTAMP 29 | ||
51 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
52 | |||
53 | #define SO_ACCEPTCONN 30 | ||
54 | |||
55 | #define SO_PEERSEC 31 | ||
56 | |||
57 | #endif /* _ASM_SOCKET_H */ | ||
diff --git a/include/asm-ppc64/sockios.h b/include/asm-ppc64/sockios.h new file mode 100644 index 000000000000..6bd1a22af4f6 --- /dev/null +++ b/include/asm-ppc64/sockios.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _ASM_PPC64_SOCKIOS_H | ||
2 | #define _ASM_PPC64_SOCKIOS_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | /* Socket-level I/O control calls. */ | ||
12 | #define FIOSETOWN 0x8901 | ||
13 | #define SIOCSPGRP 0x8902 | ||
14 | #define FIOGETOWN 0x8903 | ||
15 | #define SIOCGPGRP 0x8904 | ||
16 | #define SIOCATMARK 0x8905 | ||
17 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | ||
18 | |||
19 | #endif /* _ASM_PPC64_SOCKIOS_H */ | ||
diff --git a/include/asm-ppc64/spinlock.h b/include/asm-ppc64/spinlock.h new file mode 100644 index 000000000000..a9b2a1162cf7 --- /dev/null +++ b/include/asm-ppc64/spinlock.h | |||
@@ -0,0 +1,260 @@ | |||
1 | #ifndef __ASM_SPINLOCK_H | ||
2 | #define __ASM_SPINLOCK_H | ||
3 | |||
4 | /* | ||
5 | * Simple spin lock operations. | ||
6 | * | ||
7 | * Copyright (C) 2001-2004 Paul Mackerras <paulus@au.ibm.com>, IBM | ||
8 | * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM | ||
9 | * Copyright (C) 2002 Dave Engebretsen <engebret@us.ibm.com>, IBM | ||
10 | * Rework to support virtual processors | ||
11 | * | ||
12 | * Type of int is used as a full 64b word is not necessary. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version | ||
17 | * 2 of the License, or (at your option) any later version. | ||
18 | */ | ||
19 | #include <linux/config.h> | ||
20 | #include <asm/paca.h> | ||
21 | #include <asm/hvcall.h> | ||
22 | #include <asm/iSeries/HvCall.h> | ||
23 | |||
24 | typedef struct { | ||
25 | volatile unsigned int lock; | ||
26 | #ifdef CONFIG_PREEMPT | ||
27 | unsigned int break_lock; | ||
28 | #endif | ||
29 | } spinlock_t; | ||
30 | |||
31 | typedef struct { | ||
32 | volatile signed int lock; | ||
33 | #ifdef CONFIG_PREEMPT | ||
34 | unsigned int break_lock; | ||
35 | #endif | ||
36 | } rwlock_t; | ||
37 | |||
38 | #ifdef __KERNEL__ | ||
39 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | ||
40 | |||
41 | #define spin_is_locked(x) ((x)->lock != 0) | ||
42 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | ||
43 | |||
44 | static __inline__ void _raw_spin_unlock(spinlock_t *lock) | ||
45 | { | ||
46 | __asm__ __volatile__("lwsync # spin_unlock": : :"memory"); | ||
47 | lock->lock = 0; | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * On a system with shared processors (that is, where a physical | ||
52 | * processor is multiplexed between several virtual processors), | ||
53 | * there is no point spinning on a lock if the holder of the lock | ||
54 | * isn't currently scheduled on a physical processor. Instead | ||
55 | * we detect this situation and ask the hypervisor to give the | ||
56 | * rest of our timeslice to the lock holder. | ||
57 | * | ||
58 | * So that we can tell which virtual processor is holding a lock, | ||
59 | * we put 0x80000000 | smp_processor_id() in the lock when it is | ||
60 | * held. Conveniently, we have a word in the paca that holds this | ||
61 | * value. | ||
62 | */ | ||
63 | |||
64 | #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) | ||
65 | /* We only yield to the hypervisor if we are in shared processor mode */ | ||
66 | #define SHARED_PROCESSOR (get_paca()->lppaca.shared_proc) | ||
67 | extern void __spin_yield(spinlock_t *lock); | ||
68 | extern void __rw_yield(rwlock_t *lock); | ||
69 | #else /* SPLPAR || ISERIES */ | ||
70 | #define __spin_yield(x) barrier() | ||
71 | #define __rw_yield(x) barrier() | ||
72 | #define SHARED_PROCESSOR 0 | ||
73 | #endif | ||
74 | extern void spin_unlock_wait(spinlock_t *lock); | ||
75 | |||
76 | /* | ||
77 | * This returns the old value in the lock, so we succeeded | ||
78 | * in getting the lock if the return value is 0. | ||
79 | */ | ||
80 | static __inline__ unsigned long __spin_trylock(spinlock_t *lock) | ||
81 | { | ||
82 | unsigned long tmp, tmp2; | ||
83 | |||
84 | __asm__ __volatile__( | ||
85 | " lwz %1,%3(13) # __spin_trylock\n\ | ||
86 | 1: lwarx %0,0,%2\n\ | ||
87 | cmpwi 0,%0,0\n\ | ||
88 | bne- 2f\n\ | ||
89 | stwcx. %1,0,%2\n\ | ||
90 | bne- 1b\n\ | ||
91 | isync\n\ | ||
92 | 2:" : "=&r" (tmp), "=&r" (tmp2) | ||
93 | : "r" (&lock->lock), "i" (offsetof(struct paca_struct, lock_token)) | ||
94 | : "cr0", "memory"); | ||
95 | |||
96 | return tmp; | ||
97 | } | ||
98 | |||
99 | static int __inline__ _raw_spin_trylock(spinlock_t *lock) | ||
100 | { | ||
101 | return __spin_trylock(lock) == 0; | ||
102 | } | ||
103 | |||
104 | static void __inline__ _raw_spin_lock(spinlock_t *lock) | ||
105 | { | ||
106 | while (1) { | ||
107 | if (likely(__spin_trylock(lock) == 0)) | ||
108 | break; | ||
109 | do { | ||
110 | HMT_low(); | ||
111 | if (SHARED_PROCESSOR) | ||
112 | __spin_yield(lock); | ||
113 | } while (likely(lock->lock != 0)); | ||
114 | HMT_medium(); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) | ||
119 | { | ||
120 | unsigned long flags_dis; | ||
121 | |||
122 | while (1) { | ||
123 | if (likely(__spin_trylock(lock) == 0)) | ||
124 | break; | ||
125 | local_save_flags(flags_dis); | ||
126 | local_irq_restore(flags); | ||
127 | do { | ||
128 | HMT_low(); | ||
129 | if (SHARED_PROCESSOR) | ||
130 | __spin_yield(lock); | ||
131 | } while (likely(lock->lock != 0)); | ||
132 | HMT_medium(); | ||
133 | local_irq_restore(flags_dis); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | /* | ||
138 | * Read-write spinlocks, allowing multiple readers | ||
139 | * but only one writer. | ||
140 | * | ||
141 | * NOTE! it is quite common to have readers in interrupts | ||
142 | * but no interrupt writers. For those circumstances we | ||
143 | * can "mix" irq-safe locks - any writer needs to get a | ||
144 | * irq-safe write-lock, but readers can get non-irqsafe | ||
145 | * read-locks. | ||
146 | */ | ||
147 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | ||
148 | |||
149 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | ||
150 | |||
151 | #define read_can_lock(rw) ((rw)->lock >= 0) | ||
152 | #define write_can_lock(rw) (!(rw)->lock) | ||
153 | |||
154 | static __inline__ void _raw_write_unlock(rwlock_t *rw) | ||
155 | { | ||
156 | __asm__ __volatile__("lwsync # write_unlock": : :"memory"); | ||
157 | rw->lock = 0; | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * This returns the old value in the lock + 1, | ||
162 | * so we got a read lock if the return value is > 0. | ||
163 | */ | ||
164 | static long __inline__ __read_trylock(rwlock_t *rw) | ||
165 | { | ||
166 | long tmp; | ||
167 | |||
168 | __asm__ __volatile__( | ||
169 | "1: lwarx %0,0,%1 # read_trylock\n\ | ||
170 | extsw %0,%0\n\ | ||
171 | addic. %0,%0,1\n\ | ||
172 | ble- 2f\n\ | ||
173 | stwcx. %0,0,%1\n\ | ||
174 | bne- 1b\n\ | ||
175 | isync\n\ | ||
176 | 2:" : "=&r" (tmp) | ||
177 | : "r" (&rw->lock) | ||
178 | : "cr0", "xer", "memory"); | ||
179 | |||
180 | return tmp; | ||
181 | } | ||
182 | |||
183 | static int __inline__ _raw_read_trylock(rwlock_t *rw) | ||
184 | { | ||
185 | return __read_trylock(rw) > 0; | ||
186 | } | ||
187 | |||
188 | static void __inline__ _raw_read_lock(rwlock_t *rw) | ||
189 | { | ||
190 | while (1) { | ||
191 | if (likely(__read_trylock(rw) > 0)) | ||
192 | break; | ||
193 | do { | ||
194 | HMT_low(); | ||
195 | if (SHARED_PROCESSOR) | ||
196 | __rw_yield(rw); | ||
197 | } while (likely(rw->lock < 0)); | ||
198 | HMT_medium(); | ||
199 | } | ||
200 | } | ||
201 | |||
202 | static void __inline__ _raw_read_unlock(rwlock_t *rw) | ||
203 | { | ||
204 | long tmp; | ||
205 | |||
206 | __asm__ __volatile__( | ||
207 | "eieio # read_unlock\n\ | ||
208 | 1: lwarx %0,0,%1\n\ | ||
209 | addic %0,%0,-1\n\ | ||
210 | stwcx. %0,0,%1\n\ | ||
211 | bne- 1b" | ||
212 | : "=&r"(tmp) | ||
213 | : "r"(&rw->lock) | ||
214 | : "cr0", "memory"); | ||
215 | } | ||
216 | |||
217 | /* | ||
218 | * This returns the old value in the lock, | ||
219 | * so we got the write lock if the return value is 0. | ||
220 | */ | ||
221 | static __inline__ long __write_trylock(rwlock_t *rw) | ||
222 | { | ||
223 | long tmp, tmp2; | ||
224 | |||
225 | __asm__ __volatile__( | ||
226 | " lwz %1,%3(13) # write_trylock\n\ | ||
227 | 1: lwarx %0,0,%2\n\ | ||
228 | cmpwi 0,%0,0\n\ | ||
229 | bne- 2f\n\ | ||
230 | stwcx. %1,0,%2\n\ | ||
231 | bne- 1b\n\ | ||
232 | isync\n\ | ||
233 | 2:" : "=&r" (tmp), "=&r" (tmp2) | ||
234 | : "r" (&rw->lock), "i" (offsetof(struct paca_struct, lock_token)) | ||
235 | : "cr0", "memory"); | ||
236 | |||
237 | return tmp; | ||
238 | } | ||
239 | |||
240 | static int __inline__ _raw_write_trylock(rwlock_t *rw) | ||
241 | { | ||
242 | return __write_trylock(rw) == 0; | ||
243 | } | ||
244 | |||
245 | static void __inline__ _raw_write_lock(rwlock_t *rw) | ||
246 | { | ||
247 | while (1) { | ||
248 | if (likely(__write_trylock(rw) == 0)) | ||
249 | break; | ||
250 | do { | ||
251 | HMT_low(); | ||
252 | if (SHARED_PROCESSOR) | ||
253 | __rw_yield(rw); | ||
254 | } while (likely(rw->lock != 0)); | ||
255 | HMT_medium(); | ||
256 | } | ||
257 | } | ||
258 | |||
259 | #endif /* __KERNEL__ */ | ||
260 | #endif /* __ASM_SPINLOCK_H */ | ||
diff --git a/include/asm-ppc64/sstep.h b/include/asm-ppc64/sstep.h new file mode 100644 index 000000000000..4a68db50ee6f --- /dev/null +++ b/include/asm-ppc64/sstep.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Paul Mackerras <paulus@au.ibm.com>, IBM | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | struct pt_regs; | ||
11 | |||
12 | /* | ||
13 | * We don't allow single-stepping an mtmsrd that would clear | ||
14 | * MSR_RI, since that would make the exception unrecoverable. | ||
15 | * Since we need to single-step to proceed from a breakpoint, | ||
16 | * we don't allow putting a breakpoint on an mtmsrd instruction. | ||
17 | * Similarly we don't allow breakpoints on rfid instructions. | ||
18 | * These macros tell us if an instruction is a mtmsrd or rfid. | ||
19 | */ | ||
20 | #define IS_MTMSRD(instr) (((instr) & 0xfc0007fe) == 0x7c000164) | ||
21 | #define IS_RFID(instr) (((instr) & 0xfc0007fe) == 0x4c000024) | ||
22 | |||
23 | /* Emulate instructions that cause a transfer of control. */ | ||
24 | extern int emulate_step(struct pt_regs *regs, unsigned int instr); | ||
diff --git a/include/asm-ppc64/stat.h b/include/asm-ppc64/stat.h new file mode 100644 index 000000000000..973a5f97951d --- /dev/null +++ b/include/asm-ppc64/stat.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef _PPC64_STAT_H | ||
2 | #define _PPC64_STAT_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | |||
13 | struct stat { | ||
14 | unsigned long st_dev; | ||
15 | ino_t st_ino; | ||
16 | nlink_t st_nlink; | ||
17 | mode_t st_mode; | ||
18 | uid_t st_uid; | ||
19 | gid_t st_gid; | ||
20 | unsigned long st_rdev; | ||
21 | off_t st_size; | ||
22 | unsigned long st_blksize; | ||
23 | unsigned long st_blocks; | ||
24 | unsigned long st_atime; | ||
25 | unsigned long st_atime_nsec; | ||
26 | unsigned long st_mtime; | ||
27 | unsigned long st_mtime_nsec; | ||
28 | unsigned long st_ctime; | ||
29 | unsigned long st_ctime_nsec; | ||
30 | unsigned long __unused4; | ||
31 | unsigned long __unused5; | ||
32 | unsigned long __unused6; | ||
33 | }; | ||
34 | |||
35 | #define STAT_HAVE_NSEC 1 | ||
36 | |||
37 | /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */ | ||
38 | struct stat64 { | ||
39 | unsigned long st_dev; /* Device. */ | ||
40 | unsigned long st_ino; /* File serial number. */ | ||
41 | unsigned int st_mode; /* File mode. */ | ||
42 | unsigned int st_nlink; /* Link count. */ | ||
43 | unsigned int st_uid; /* User ID of the file's owner. */ | ||
44 | unsigned int st_gid; /* Group ID of the file's group. */ | ||
45 | unsigned long st_rdev; /* Device number, if device. */ | ||
46 | unsigned short __pad2; | ||
47 | long st_size; /* Size of file, in bytes. */ | ||
48 | int st_blksize; /* Optimal block size for I/O. */ | ||
49 | |||
50 | long st_blocks; /* Number 512-byte blocks allocated. */ | ||
51 | int st_atime; /* Time of last access. */ | ||
52 | int st_atime_nsec; | ||
53 | int st_mtime; /* Time of last modification. */ | ||
54 | int st_mtime_nsec; | ||
55 | int st_ctime; /* Time of last status change. */ | ||
56 | int st_ctime_nsec; | ||
57 | unsigned int __unused4; | ||
58 | unsigned int __unused5; | ||
59 | }; | ||
60 | #endif | ||
diff --git a/include/asm-ppc64/statfs.h b/include/asm-ppc64/statfs.h new file mode 100644 index 000000000000..3c985e5246a7 --- /dev/null +++ b/include/asm-ppc64/statfs.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _PPC64_STATFS_H | ||
2 | #define _PPC64_STATFS_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __KERNEL_STRICT_NAMES | ||
12 | #include <linux/types.h> | ||
13 | typedef __kernel_fsid_t fsid_t; | ||
14 | #endif | ||
15 | |||
16 | /* | ||
17 | * We're already 64-bit, so duplicate the definition | ||
18 | */ | ||
19 | struct statfs { | ||
20 | long f_type; | ||
21 | long f_bsize; | ||
22 | long f_blocks; | ||
23 | long f_bfree; | ||
24 | long f_bavail; | ||
25 | long f_files; | ||
26 | long f_ffree; | ||
27 | __kernel_fsid_t f_fsid; | ||
28 | long f_namelen; | ||
29 | long f_frsize; | ||
30 | long f_spare[5]; | ||
31 | }; | ||
32 | |||
33 | struct statfs64 { | ||
34 | long f_type; | ||
35 | long f_bsize; | ||
36 | long f_blocks; | ||
37 | long f_bfree; | ||
38 | long f_bavail; | ||
39 | long f_files; | ||
40 | long f_ffree; | ||
41 | __kernel_fsid_t f_fsid; | ||
42 | long f_namelen; | ||
43 | long f_frsize; | ||
44 | long f_spare[5]; | ||
45 | }; | ||
46 | |||
47 | struct compat_statfs64 { | ||
48 | __u32 f_type; | ||
49 | __u32 f_bsize; | ||
50 | __u64 f_blocks; | ||
51 | __u64 f_bfree; | ||
52 | __u64 f_bavail; | ||
53 | __u64 f_files; | ||
54 | __u64 f_ffree; | ||
55 | __kernel_fsid_t f_fsid; | ||
56 | __u32 f_namelen; | ||
57 | __u32 f_frsize; | ||
58 | __u32 f_spare[5]; | ||
59 | }; | ||
60 | |||
61 | #endif /* _PPC64_STATFS_H */ | ||
diff --git a/include/asm-ppc64/string.h b/include/asm-ppc64/string.h new file mode 100644 index 000000000000..eeca68ef1e91 --- /dev/null +++ b/include/asm-ppc64/string.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef _PPC64_STRING_H_ | ||
2 | #define _PPC64_STRING_H_ | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #define __HAVE_ARCH_STRCPY | ||
12 | #define __HAVE_ARCH_STRNCPY | ||
13 | #define __HAVE_ARCH_STRLEN | ||
14 | #define __HAVE_ARCH_STRCMP | ||
15 | #define __HAVE_ARCH_STRCAT | ||
16 | #define __HAVE_ARCH_MEMSET | ||
17 | #define __HAVE_ARCH_MEMCPY | ||
18 | #define __HAVE_ARCH_MEMMOVE | ||
19 | #define __HAVE_ARCH_MEMCMP | ||
20 | #define __HAVE_ARCH_MEMCHR | ||
21 | |||
22 | extern int strcasecmp(const char *, const char *); | ||
23 | extern int strncasecmp(const char *, const char *, int); | ||
24 | extern char * strcpy(char *,const char *); | ||
25 | extern char * strncpy(char *,const char *, __kernel_size_t); | ||
26 | extern __kernel_size_t strlen(const char *); | ||
27 | extern int strcmp(const char *,const char *); | ||
28 | extern char * strcat(char *, const char *); | ||
29 | extern void * memset(void *,int,__kernel_size_t); | ||
30 | extern void * memcpy(void *,const void *,__kernel_size_t); | ||
31 | extern void * memmove(void *,const void *,__kernel_size_t); | ||
32 | extern int memcmp(const void *,const void *,__kernel_size_t); | ||
33 | extern void * memchr(const void *,int,__kernel_size_t); | ||
34 | |||
35 | #endif /* _PPC64_STRING_H_ */ | ||
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h new file mode 100644 index 000000000000..98d120ca8a91 --- /dev/null +++ b/include/asm-ppc64/system.h | |||
@@ -0,0 +1,306 @@ | |||
1 | #ifndef __PPC64_SYSTEM_H | ||
2 | #define __PPC64_SYSTEM_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/compiler.h> | ||
13 | #include <asm/page.h> | ||
14 | #include <asm/processor.h> | ||
15 | #include <asm/hw_irq.h> | ||
16 | #include <asm/memory.h> | ||
17 | |||
18 | /* | ||
19 | * Memory barrier. | ||
20 | * The sync instruction guarantees that all memory accesses initiated | ||
21 | * by this processor have been performed (with respect to all other | ||
22 | * mechanisms that access memory). The eieio instruction is a barrier | ||
23 | * providing an ordering (separately) for (a) cacheable stores and (b) | ||
24 | * loads and stores to non-cacheable memory (e.g. I/O devices). | ||
25 | * | ||
26 | * mb() prevents loads and stores being reordered across this point. | ||
27 | * rmb() prevents loads being reordered across this point. | ||
28 | * wmb() prevents stores being reordered across this point. | ||
29 | * read_barrier_depends() prevents data-dependent loads being reordered | ||
30 | * across this point (nop on PPC). | ||
31 | * | ||
32 | * We have to use the sync instructions for mb(), since lwsync doesn't | ||
33 | * order loads with respect to previous stores. Lwsync is fine for | ||
34 | * rmb(), though. | ||
35 | * For wmb(), we use sync since wmb is used in drivers to order | ||
36 | * stores to system memory with respect to writes to the device. | ||
37 | * However, smp_wmb() can be a lighter-weight eieio barrier on | ||
38 | * SMP since it is only used to order updates to system memory. | ||
39 | */ | ||
40 | #define mb() __asm__ __volatile__ ("sync" : : : "memory") | ||
41 | #define rmb() __asm__ __volatile__ ("lwsync" : : : "memory") | ||
42 | #define wmb() __asm__ __volatile__ ("sync" : : : "memory") | ||
43 | #define read_barrier_depends() do { } while(0) | ||
44 | |||
45 | #define set_mb(var, value) do { var = value; smp_mb(); } while (0) | ||
46 | #define set_wmb(var, value) do { var = value; smp_wmb(); } while (0) | ||
47 | |||
48 | #ifdef CONFIG_SMP | ||
49 | #define smp_mb() mb() | ||
50 | #define smp_rmb() rmb() | ||
51 | #define smp_wmb() __asm__ __volatile__ ("eieio" : : : "memory") | ||
52 | #define smp_read_barrier_depends() read_barrier_depends() | ||
53 | #else | ||
54 | #define smp_mb() __asm__ __volatile__("": : :"memory") | ||
55 | #define smp_rmb() __asm__ __volatile__("": : :"memory") | ||
56 | #define smp_wmb() __asm__ __volatile__("": : :"memory") | ||
57 | #define smp_read_barrier_depends() do { } while(0) | ||
58 | #endif /* CONFIG_SMP */ | ||
59 | |||
60 | #ifdef __KERNEL__ | ||
61 | struct task_struct; | ||
62 | struct pt_regs; | ||
63 | |||
64 | #ifdef CONFIG_DEBUGGER | ||
65 | |||
66 | extern int (*__debugger)(struct pt_regs *regs); | ||
67 | extern int (*__debugger_ipi)(struct pt_regs *regs); | ||
68 | extern int (*__debugger_bpt)(struct pt_regs *regs); | ||
69 | extern int (*__debugger_sstep)(struct pt_regs *regs); | ||
70 | extern int (*__debugger_iabr_match)(struct pt_regs *regs); | ||
71 | extern int (*__debugger_dabr_match)(struct pt_regs *regs); | ||
72 | extern int (*__debugger_fault_handler)(struct pt_regs *regs); | ||
73 | |||
74 | #define DEBUGGER_BOILERPLATE(__NAME) \ | ||
75 | static inline int __NAME(struct pt_regs *regs) \ | ||
76 | { \ | ||
77 | if (unlikely(__ ## __NAME)) \ | ||
78 | return __ ## __NAME(regs); \ | ||
79 | return 0; \ | ||
80 | } | ||
81 | |||
82 | DEBUGGER_BOILERPLATE(debugger) | ||
83 | DEBUGGER_BOILERPLATE(debugger_ipi) | ||
84 | DEBUGGER_BOILERPLATE(debugger_bpt) | ||
85 | DEBUGGER_BOILERPLATE(debugger_sstep) | ||
86 | DEBUGGER_BOILERPLATE(debugger_iabr_match) | ||
87 | DEBUGGER_BOILERPLATE(debugger_dabr_match) | ||
88 | DEBUGGER_BOILERPLATE(debugger_fault_handler) | ||
89 | |||
90 | #ifdef CONFIG_XMON | ||
91 | extern void xmon_init(void); | ||
92 | #endif | ||
93 | |||
94 | #else | ||
95 | static inline int debugger(struct pt_regs *regs) { return 0; } | ||
96 | static inline int debugger_ipi(struct pt_regs *regs) { return 0; } | ||
97 | static inline int debugger_bpt(struct pt_regs *regs) { return 0; } | ||
98 | static inline int debugger_sstep(struct pt_regs *regs) { return 0; } | ||
99 | static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; } | ||
100 | static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; } | ||
101 | static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } | ||
102 | #endif | ||
103 | |||
104 | extern int fix_alignment(struct pt_regs *regs); | ||
105 | extern void bad_page_fault(struct pt_regs *regs, unsigned long address, | ||
106 | int sig); | ||
107 | extern void show_regs(struct pt_regs * regs); | ||
108 | extern void low_hash_fault(struct pt_regs *regs, unsigned long address); | ||
109 | extern int die(const char *str, struct pt_regs *regs, long err); | ||
110 | |||
111 | extern int _get_PVR(void); | ||
112 | extern void giveup_fpu(struct task_struct *); | ||
113 | extern void disable_kernel_fp(void); | ||
114 | extern void flush_fp_to_thread(struct task_struct *); | ||
115 | extern void enable_kernel_fp(void); | ||
116 | extern void giveup_altivec(struct task_struct *); | ||
117 | extern void disable_kernel_altivec(void); | ||
118 | extern void enable_kernel_altivec(void); | ||
119 | extern int emulate_altivec(struct pt_regs *); | ||
120 | extern void cvt_fd(float *from, double *to, unsigned long *fpscr); | ||
121 | extern void cvt_df(double *from, float *to, unsigned long *fpscr); | ||
122 | |||
123 | #ifdef CONFIG_ALTIVEC | ||
124 | extern void flush_altivec_to_thread(struct task_struct *); | ||
125 | #else | ||
126 | static inline void flush_altivec_to_thread(struct task_struct *t) | ||
127 | { | ||
128 | } | ||
129 | #endif | ||
130 | |||
131 | extern int mem_init_done; /* set on boot once kmalloc can be called */ | ||
132 | |||
133 | /* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */ | ||
134 | extern unsigned char e2a(unsigned char); | ||
135 | |||
136 | extern struct task_struct *__switch_to(struct task_struct *, | ||
137 | struct task_struct *); | ||
138 | #define switch_to(prev, next, last) ((last) = __switch_to((prev), (next))) | ||
139 | |||
140 | struct thread_struct; | ||
141 | extern struct task_struct * _switch(struct thread_struct *prev, | ||
142 | struct thread_struct *next); | ||
143 | |||
144 | static inline int __is_processor(unsigned long pv) | ||
145 | { | ||
146 | unsigned long pvr; | ||
147 | asm("mfspr %0, 0x11F" : "=r" (pvr)); | ||
148 | return(PVR_VER(pvr) == pv); | ||
149 | } | ||
150 | |||
151 | /* | ||
152 | * Atomic exchange | ||
153 | * | ||
154 | * Changes the memory location '*ptr' to be val and returns | ||
155 | * the previous value stored there. | ||
156 | * | ||
157 | * Inline asm pulled from arch/ppc/kernel/misc.S so ppc64 | ||
158 | * is more like most of the other architectures. | ||
159 | */ | ||
160 | static __inline__ unsigned long | ||
161 | __xchg_u32(volatile int *m, unsigned long val) | ||
162 | { | ||
163 | unsigned long dummy; | ||
164 | |||
165 | __asm__ __volatile__( | ||
166 | EIEIO_ON_SMP | ||
167 | "1: lwarx %0,0,%3 # __xchg_u32\n\ | ||
168 | stwcx. %2,0,%3\n\ | ||
169 | 2: bne- 1b" | ||
170 | ISYNC_ON_SMP | ||
171 | : "=&r" (dummy), "=m" (*m) | ||
172 | : "r" (val), "r" (m) | ||
173 | : "cc", "memory"); | ||
174 | |||
175 | return (dummy); | ||
176 | } | ||
177 | |||
178 | static __inline__ unsigned long | ||
179 | __xchg_u64(volatile long *m, unsigned long val) | ||
180 | { | ||
181 | unsigned long dummy; | ||
182 | |||
183 | __asm__ __volatile__( | ||
184 | EIEIO_ON_SMP | ||
185 | "1: ldarx %0,0,%3 # __xchg_u64\n\ | ||
186 | stdcx. %2,0,%3\n\ | ||
187 | 2: bne- 1b" | ||
188 | ISYNC_ON_SMP | ||
189 | : "=&r" (dummy), "=m" (*m) | ||
190 | : "r" (val), "r" (m) | ||
191 | : "cc", "memory"); | ||
192 | |||
193 | return (dummy); | ||
194 | } | ||
195 | |||
196 | /* | ||
197 | * This function doesn't exist, so you'll get a linker error | ||
198 | * if something tries to do an invalid xchg(). | ||
199 | */ | ||
200 | extern void __xchg_called_with_bad_pointer(void); | ||
201 | |||
202 | static __inline__ unsigned long | ||
203 | __xchg(volatile void *ptr, unsigned long x, int size) | ||
204 | { | ||
205 | switch (size) { | ||
206 | case 4: | ||
207 | return __xchg_u32(ptr, x); | ||
208 | case 8: | ||
209 | return __xchg_u64(ptr, x); | ||
210 | } | ||
211 | __xchg_called_with_bad_pointer(); | ||
212 | return x; | ||
213 | } | ||
214 | |||
215 | #define xchg(ptr,x) \ | ||
216 | ({ \ | ||
217 | __typeof__(*(ptr)) _x_ = (x); \ | ||
218 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \ | ||
219 | }) | ||
220 | |||
221 | #define tas(ptr) (xchg((ptr),1)) | ||
222 | |||
223 | #define __HAVE_ARCH_CMPXCHG 1 | ||
224 | |||
225 | static __inline__ unsigned long | ||
226 | __cmpxchg_u32(volatile int *p, int old, int new) | ||
227 | { | ||
228 | unsigned int prev; | ||
229 | |||
230 | __asm__ __volatile__ ( | ||
231 | EIEIO_ON_SMP | ||
232 | "1: lwarx %0,0,%2 # __cmpxchg_u32\n\ | ||
233 | cmpw 0,%0,%3\n\ | ||
234 | bne- 2f\n\ | ||
235 | stwcx. %4,0,%2\n\ | ||
236 | bne- 1b" | ||
237 | ISYNC_ON_SMP | ||
238 | "\n\ | ||
239 | 2:" | ||
240 | : "=&r" (prev), "=m" (*p) | ||
241 | : "r" (p), "r" (old), "r" (new), "m" (*p) | ||
242 | : "cc", "memory"); | ||
243 | |||
244 | return prev; | ||
245 | } | ||
246 | |||
247 | static __inline__ unsigned long | ||
248 | __cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new) | ||
249 | { | ||
250 | unsigned long prev; | ||
251 | |||
252 | __asm__ __volatile__ ( | ||
253 | EIEIO_ON_SMP | ||
254 | "1: ldarx %0,0,%2 # __cmpxchg_u64\n\ | ||
255 | cmpd 0,%0,%3\n\ | ||
256 | bne- 2f\n\ | ||
257 | stdcx. %4,0,%2\n\ | ||
258 | bne- 1b" | ||
259 | ISYNC_ON_SMP | ||
260 | "\n\ | ||
261 | 2:" | ||
262 | : "=&r" (prev), "=m" (*p) | ||
263 | : "r" (p), "r" (old), "r" (new), "m" (*p) | ||
264 | : "cc", "memory"); | ||
265 | |||
266 | return prev; | ||
267 | } | ||
268 | |||
269 | /* This function doesn't exist, so you'll get a linker error | ||
270 | if something tries to do an invalid cmpxchg(). */ | ||
271 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
272 | |||
273 | static __inline__ unsigned long | ||
274 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | ||
275 | { | ||
276 | switch (size) { | ||
277 | case 4: | ||
278 | return __cmpxchg_u32(ptr, old, new); | ||
279 | case 8: | ||
280 | return __cmpxchg_u64(ptr, old, new); | ||
281 | } | ||
282 | __cmpxchg_called_with_bad_pointer(); | ||
283 | return old; | ||
284 | } | ||
285 | |||
286 | #define cmpxchg(ptr,o,n) \ | ||
287 | ({ \ | ||
288 | __typeof__(*(ptr)) _o_ = (o); \ | ||
289 | __typeof__(*(ptr)) _n_ = (n); \ | ||
290 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
291 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
292 | }) | ||
293 | |||
294 | /* | ||
295 | * We handle most unaligned accesses in hardware. On the other hand | ||
296 | * unaligned DMA can be very expensive on some ppc64 IO chips (it does | ||
297 | * powers of 2 writes until it reaches sufficient alignment). | ||
298 | * | ||
299 | * Based on this we disable the IP header alignment in network drivers. | ||
300 | */ | ||
301 | #define NET_IP_ALIGN 0 | ||
302 | |||
303 | #define arch_align_stack(x) (x) | ||
304 | |||
305 | #endif /* __KERNEL__ */ | ||
306 | #endif | ||
diff --git a/include/asm-ppc64/systemcfg.h b/include/asm-ppc64/systemcfg.h new file mode 100644 index 000000000000..9b86b53129aa --- /dev/null +++ b/include/asm-ppc64/systemcfg.h | |||
@@ -0,0 +1,64 @@ | |||
1 | #ifndef _SYSTEMCFG_H | ||
2 | #define _SYSTEMCFG_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | /* Change Activity: | ||
14 | * 2002/09/30 : bergner : Created | ||
15 | * End Change Activity | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * If the major version changes we are incompatible. | ||
20 | * Minor version changes are a hint. | ||
21 | */ | ||
22 | #define SYSTEMCFG_MAJOR 1 | ||
23 | #define SYSTEMCFG_MINOR 1 | ||
24 | |||
25 | #ifndef __ASSEMBLY__ | ||
26 | |||
27 | #include <linux/unistd.h> | ||
28 | |||
29 | #define SYSCALL_MAP_SIZE ((__NR_syscalls + 31) / 32) | ||
30 | |||
31 | struct systemcfg { | ||
32 | __u8 eye_catcher[16]; /* Eyecatcher: SYSTEMCFG:PPC64 0x00 */ | ||
33 | struct { /* Systemcfg version numbers */ | ||
34 | __u32 major; /* Major number 0x10 */ | ||
35 | __u32 minor; /* Minor number 0x14 */ | ||
36 | } version; | ||
37 | |||
38 | __u32 platform; /* Platform flags 0x18 */ | ||
39 | __u32 processor; /* Processor type 0x1C */ | ||
40 | __u64 processorCount; /* # of physical processors 0x20 */ | ||
41 | __u64 physicalMemorySize; /* Size of real memory(B) 0x28 */ | ||
42 | __u64 tb_orig_stamp; /* Timebase at boot 0x30 */ | ||
43 | __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */ | ||
44 | __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */ | ||
45 | __u64 stamp_xsec; /* 0x48 */ | ||
46 | __u64 tb_update_count; /* Timebase atomicity ctr 0x50 */ | ||
47 | __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */ | ||
48 | __u32 tz_dsttime; /* Type of dst correction 0x5C */ | ||
49 | /* next four are no longer used except to be exported to /proc */ | ||
50 | __u32 dcache_size; /* L1 d-cache size 0x60 */ | ||
51 | __u32 dcache_line_size; /* L1 d-cache line size 0x64 */ | ||
52 | __u32 icache_size; /* L1 i-cache size 0x68 */ | ||
53 | __u32 icache_line_size; /* L1 i-cache line size 0x6C */ | ||
54 | __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of available syscalls 0x70 */ | ||
55 | __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of available syscalls */ | ||
56 | }; | ||
57 | |||
58 | #ifdef __KERNEL__ | ||
59 | extern struct systemcfg *systemcfg; | ||
60 | #endif | ||
61 | |||
62 | #endif /* __ASSEMBLY__ */ | ||
63 | |||
64 | #endif /* _SYSTEMCFG_H */ | ||
diff --git a/include/asm-ppc64/termbits.h b/include/asm-ppc64/termbits.h new file mode 100644 index 000000000000..d1a2bee10cef --- /dev/null +++ b/include/asm-ppc64/termbits.h | |||
@@ -0,0 +1,193 @@ | |||
1 | #ifndef _PPC64_TERMBITS_H | ||
2 | #define _PPC64_TERMBITS_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <linux/posix_types.h> | ||
12 | |||
13 | typedef unsigned char cc_t; | ||
14 | typedef unsigned int speed_t; | ||
15 | typedef unsigned int tcflag_t; | ||
16 | |||
17 | /* | ||
18 | * termios type and macro definitions. Be careful about adding stuff | ||
19 | * to this file since it's used in GNU libc and there are strict rules | ||
20 | * concerning namespace pollution. | ||
21 | */ | ||
22 | |||
23 | #define NCCS 19 | ||
24 | struct termios { | ||
25 | tcflag_t c_iflag; /* input mode flags */ | ||
26 | tcflag_t c_oflag; /* output mode flags */ | ||
27 | tcflag_t c_cflag; /* control mode flags */ | ||
28 | tcflag_t c_lflag; /* local mode flags */ | ||
29 | cc_t c_cc[NCCS]; /* control characters */ | ||
30 | cc_t c_line; /* line discipline (== c_cc[19]) */ | ||
31 | speed_t c_ispeed; /* input speed */ | ||
32 | speed_t c_ospeed; /* output speed */ | ||
33 | }; | ||
34 | |||
35 | /* c_cc characters */ | ||
36 | #define VINTR 0 | ||
37 | #define VQUIT 1 | ||
38 | #define VERASE 2 | ||
39 | #define VKILL 3 | ||
40 | #define VEOF 4 | ||
41 | #define VMIN 5 | ||
42 | #define VEOL 6 | ||
43 | #define VTIME 7 | ||
44 | #define VEOL2 8 | ||
45 | #define VSWTC 9 | ||
46 | #define VWERASE 10 | ||
47 | #define VREPRINT 11 | ||
48 | #define VSUSP 12 | ||
49 | #define VSTART 13 | ||
50 | #define VSTOP 14 | ||
51 | #define VLNEXT 15 | ||
52 | #define VDISCARD 16 | ||
53 | |||
54 | /* c_iflag bits */ | ||
55 | #define IGNBRK 0000001 | ||
56 | #define BRKINT 0000002 | ||
57 | #define IGNPAR 0000004 | ||
58 | #define PARMRK 0000010 | ||
59 | #define INPCK 0000020 | ||
60 | #define ISTRIP 0000040 | ||
61 | #define INLCR 0000100 | ||
62 | #define IGNCR 0000200 | ||
63 | #define ICRNL 0000400 | ||
64 | #define IXON 0001000 | ||
65 | #define IXOFF 0002000 | ||
66 | #define IXANY 0004000 | ||
67 | #define IUCLC 0010000 | ||
68 | #define IMAXBEL 0020000 | ||
69 | #define IUTF8 0040000 | ||
70 | |||
71 | /* c_oflag bits */ | ||
72 | #define OPOST 0000001 | ||
73 | #define ONLCR 0000002 | ||
74 | #define OLCUC 0000004 | ||
75 | |||
76 | #define OCRNL 0000010 | ||
77 | #define ONOCR 0000020 | ||
78 | #define ONLRET 0000040 | ||
79 | |||
80 | #define OFILL 00000100 | ||
81 | #define OFDEL 00000200 | ||
82 | #define NLDLY 00001400 | ||
83 | #define NL0 00000000 | ||
84 | #define NL1 00000400 | ||
85 | #define NL2 00001000 | ||
86 | #define NL3 00001400 | ||
87 | #define TABDLY 00006000 | ||
88 | #define TAB0 00000000 | ||
89 | #define TAB1 00002000 | ||
90 | #define TAB2 00004000 | ||
91 | #define TAB3 00006000 | ||
92 | #define XTABS 00006000 /* required by POSIX to == TAB3 */ | ||
93 | #define CRDLY 00030000 | ||
94 | #define CR0 00000000 | ||
95 | #define CR1 00010000 | ||
96 | #define CR2 00020000 | ||
97 | #define CR3 00030000 | ||
98 | #define FFDLY 00040000 | ||
99 | #define FF0 00000000 | ||
100 | #define FF1 00040000 | ||
101 | #define BSDLY 00100000 | ||
102 | #define BS0 00000000 | ||
103 | #define BS1 00100000 | ||
104 | #define VTDLY 00200000 | ||
105 | #define VT0 00000000 | ||
106 | #define VT1 00200000 | ||
107 | |||
108 | /* c_cflag bit meaning */ | ||
109 | #define CBAUD 0000377 | ||
110 | #define B0 0000000 /* hang up */ | ||
111 | #define B50 0000001 | ||
112 | #define B75 0000002 | ||
113 | #define B110 0000003 | ||
114 | #define B134 0000004 | ||
115 | #define B150 0000005 | ||
116 | #define B200 0000006 | ||
117 | #define B300 0000007 | ||
118 | #define B600 0000010 | ||
119 | #define B1200 0000011 | ||
120 | #define B1800 0000012 | ||
121 | #define B2400 0000013 | ||
122 | #define B4800 0000014 | ||
123 | #define B9600 0000015 | ||
124 | #define B19200 0000016 | ||
125 | #define B38400 0000017 | ||
126 | #define EXTA B19200 | ||
127 | #define EXTB B38400 | ||
128 | #define CBAUDEX 0000000 | ||
129 | #define B57600 00020 | ||
130 | #define B115200 00021 | ||
131 | #define B230400 00022 | ||
132 | #define B460800 00023 | ||
133 | #define B500000 00024 | ||
134 | #define B576000 00025 | ||
135 | #define B921600 00026 | ||
136 | #define B1000000 00027 | ||
137 | #define B1152000 00030 | ||
138 | #define B1500000 00031 | ||
139 | #define B2000000 00032 | ||
140 | #define B2500000 00033 | ||
141 | #define B3000000 00034 | ||
142 | #define B3500000 00035 | ||
143 | #define B4000000 00036 | ||
144 | |||
145 | #define CSIZE 00001400 | ||
146 | #define CS5 00000000 | ||
147 | #define CS6 00000400 | ||
148 | #define CS7 00001000 | ||
149 | #define CS8 00001400 | ||
150 | |||
151 | #define CSTOPB 00002000 | ||
152 | #define CREAD 00004000 | ||
153 | #define PARENB 00010000 | ||
154 | #define PARODD 00020000 | ||
155 | #define HUPCL 00040000 | ||
156 | |||
157 | #define CLOCAL 00100000 | ||
158 | #define CRTSCTS 020000000000 /* flow control */ | ||
159 | |||
160 | /* c_lflag bits */ | ||
161 | #define ISIG 0x00000080 | ||
162 | #define ICANON 0x00000100 | ||
163 | #define XCASE 0x00004000 | ||
164 | #define ECHO 0x00000008 | ||
165 | #define ECHOE 0x00000002 | ||
166 | #define ECHOK 0x00000004 | ||
167 | #define ECHONL 0x00000010 | ||
168 | #define NOFLSH 0x80000000 | ||
169 | #define TOSTOP 0x00400000 | ||
170 | #define ECHOCTL 0x00000040 | ||
171 | #define ECHOPRT 0x00000020 | ||
172 | #define ECHOKE 0x00000001 | ||
173 | #define FLUSHO 0x00800000 | ||
174 | #define PENDIN 0x20000000 | ||
175 | #define IEXTEN 0x00000400 | ||
176 | |||
177 | /* Values for the ACTION argument to `tcflow'. */ | ||
178 | #define TCOOFF 0 | ||
179 | #define TCOON 1 | ||
180 | #define TCIOFF 2 | ||
181 | #define TCION 3 | ||
182 | |||
183 | /* Values for the QUEUE_SELECTOR argument to `tcflush'. */ | ||
184 | #define TCIFLUSH 0 | ||
185 | #define TCOFLUSH 1 | ||
186 | #define TCIOFLUSH 2 | ||
187 | |||
188 | /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ | ||
189 | #define TCSANOW 0 | ||
190 | #define TCSADRAIN 1 | ||
191 | #define TCSAFLUSH 2 | ||
192 | |||
193 | #endif /* _PPC64_TERMBITS_H */ | ||
diff --git a/include/asm-ppc64/termios.h b/include/asm-ppc64/termios.h new file mode 100644 index 000000000000..02c3d283aa62 --- /dev/null +++ b/include/asm-ppc64/termios.h | |||
@@ -0,0 +1,235 @@ | |||
1 | #ifndef _PPC64_TERMIOS_H | ||
2 | #define _PPC64_TERMIOS_H | ||
3 | |||
4 | /* | ||
5 | * Liberally adapted from alpha/termios.h. In particular, the c_cc[] | ||
6 | * fields have been reordered so that termio & termios share the | ||
7 | * common subset in the same order (for brain dead programs that don't | ||
8 | * know or care about the differences). | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #include <asm/ioctls.h> | ||
17 | #include <asm/termbits.h> | ||
18 | |||
19 | struct sgttyb { | ||
20 | char sg_ispeed; | ||
21 | char sg_ospeed; | ||
22 | char sg_erase; | ||
23 | char sg_kill; | ||
24 | short sg_flags; | ||
25 | }; | ||
26 | |||
27 | struct tchars { | ||
28 | char t_intrc; | ||
29 | char t_quitc; | ||
30 | char t_startc; | ||
31 | char t_stopc; | ||
32 | char t_eofc; | ||
33 | char t_brkc; | ||
34 | }; | ||
35 | |||
36 | struct ltchars { | ||
37 | char t_suspc; | ||
38 | char t_dsuspc; | ||
39 | char t_rprntc; | ||
40 | char t_flushc; | ||
41 | char t_werasc; | ||
42 | char t_lnextc; | ||
43 | }; | ||
44 | |||
45 | struct winsize { | ||
46 | unsigned short ws_row; | ||
47 | unsigned short ws_col; | ||
48 | unsigned short ws_xpixel; | ||
49 | unsigned short ws_ypixel; | ||
50 | }; | ||
51 | |||
52 | #define NCC 10 | ||
53 | struct termio { | ||
54 | unsigned short c_iflag; /* input mode flags */ | ||
55 | unsigned short c_oflag; /* output mode flags */ | ||
56 | unsigned short c_cflag; /* control mode flags */ | ||
57 | unsigned short c_lflag; /* local mode flags */ | ||
58 | unsigned char c_line; /* line discipline */ | ||
59 | unsigned char c_cc[NCC]; /* control characters */ | ||
60 | }; | ||
61 | |||
62 | /* c_cc characters */ | ||
63 | #define _VINTR 0 | ||
64 | #define _VQUIT 1 | ||
65 | #define _VERASE 2 | ||
66 | #define _VKILL 3 | ||
67 | #define _VEOF 4 | ||
68 | #define _VMIN 5 | ||
69 | #define _VEOL 6 | ||
70 | #define _VTIME 7 | ||
71 | #define _VEOL2 8 | ||
72 | #define _VSWTC 9 | ||
73 | |||
74 | /* line disciplines */ | ||
75 | #define N_TTY 0 | ||
76 | #define N_SLIP 1 | ||
77 | #define N_MOUSE 2 | ||
78 | #define N_PPP 3 | ||
79 | #define N_STRIP 4 | ||
80 | #define N_AX25 5 | ||
81 | #define N_X25 6 /* X.25 async */ | ||
82 | #define N_6PACK 7 | ||
83 | #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ | ||
84 | #define N_R3964 9 /* Reserved for Simatic R3964 module */ | ||
85 | #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ | ||
86 | #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ | ||
87 | #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ | ||
88 | #define N_HDLC 13 /* synchronous HDLC */ | ||
89 | #define N_SYNC_PPP 14 | ||
90 | |||
91 | #ifdef __KERNEL__ | ||
92 | /* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */ | ||
93 | #define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" | ||
94 | #endif | ||
95 | |||
96 | #define FIOCLEX _IO('f', 1) | ||
97 | #define FIONCLEX _IO('f', 2) | ||
98 | #define FIOASYNC _IOW('f', 125, int) | ||
99 | #define FIONBIO _IOW('f', 126, int) | ||
100 | #define FIONREAD _IOR('f', 127, int) | ||
101 | #define TIOCINQ FIONREAD | ||
102 | |||
103 | #define TIOCGETP _IOR('t', 8, struct sgttyb) | ||
104 | #define TIOCSETP _IOW('t', 9, struct sgttyb) | ||
105 | #define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ | ||
106 | |||
107 | #define TIOCSETC _IOW('t', 17, struct tchars) | ||
108 | #define TIOCGETC _IOR('t', 18, struct tchars) | ||
109 | #define TCGETS _IOR('t', 19, struct termios) | ||
110 | #define TCSETS _IOW('t', 20, struct termios) | ||
111 | #define TCSETSW _IOW('t', 21, struct termios) | ||
112 | #define TCSETSF _IOW('t', 22, struct termios) | ||
113 | |||
114 | #define TCGETA _IOR('t', 23, struct termio) | ||
115 | #define TCSETA _IOW('t', 24, struct termio) | ||
116 | #define TCSETAW _IOW('t', 25, struct termio) | ||
117 | #define TCSETAF _IOW('t', 28, struct termio) | ||
118 | |||
119 | #define TCSBRK _IO('t', 29) | ||
120 | #define TCXONC _IO('t', 30) | ||
121 | #define TCFLSH _IO('t', 31) | ||
122 | |||
123 | #define TIOCSWINSZ _IOW('t', 103, struct winsize) | ||
124 | #define TIOCGWINSZ _IOR('t', 104, struct winsize) | ||
125 | #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ | ||
126 | #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ | ||
127 | #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ | ||
128 | |||
129 | #define TIOCGLTC _IOR('t', 116, struct ltchars) | ||
130 | #define TIOCSLTC _IOW('t', 117, struct ltchars) | ||
131 | #define TIOCSPGRP _IOW('t', 118, int) | ||
132 | #define TIOCGPGRP _IOR('t', 119, int) | ||
133 | |||
134 | #define TIOCEXCL 0x540C | ||
135 | #define TIOCNXCL 0x540D | ||
136 | #define TIOCSCTTY 0x540E | ||
137 | |||
138 | #define TIOCSTI 0x5412 | ||
139 | #define TIOCMGET 0x5415 | ||
140 | #define TIOCMBIS 0x5416 | ||
141 | #define TIOCMBIC 0x5417 | ||
142 | #define TIOCMSET 0x5418 | ||
143 | #define TIOCGSOFTCAR 0x5419 | ||
144 | #define TIOCSSOFTCAR 0x541A | ||
145 | #define TIOCLINUX 0x541C | ||
146 | #define TIOCCONS 0x541D | ||
147 | #define TIOCGSERIAL 0x541E | ||
148 | #define TIOCSSERIAL 0x541F | ||
149 | #define TIOCPKT 0x5420 | ||
150 | |||
151 | #define TIOCNOTTY 0x5422 | ||
152 | #define TIOCSETD 0x5423 | ||
153 | #define TIOCGETD 0x5424 | ||
154 | #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ | ||
155 | |||
156 | #define TIOCSERCONFIG 0x5453 | ||
157 | #define TIOCSERGWILD 0x5454 | ||
158 | #define TIOCSERSWILD 0x5455 | ||
159 | #define TIOCGLCKTRMIOS 0x5456 | ||
160 | #define TIOCSLCKTRMIOS 0x5457 | ||
161 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
162 | #define TIOCSERGETLSR 0x5459 /* Get line status register */ | ||
163 | #define TIOCSERGETMULTI 0x545A /* Get multiport config */ | ||
164 | #define TIOCSERSETMULTI 0x545B /* Set multiport config */ | ||
165 | |||
166 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ | ||
167 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | ||
168 | |||
169 | /* Used for packet mode */ | ||
170 | #define TIOCPKT_DATA 0 | ||
171 | #define TIOCPKT_FLUSHREAD 1 | ||
172 | #define TIOCPKT_FLUSHWRITE 2 | ||
173 | #define TIOCPKT_STOP 4 | ||
174 | #define TIOCPKT_START 8 | ||
175 | #define TIOCPKT_NOSTOP 16 | ||
176 | #define TIOCPKT_DOSTOP 32 | ||
177 | |||
178 | /* modem lines */ | ||
179 | #define TIOCM_LE 0x001 | ||
180 | #define TIOCM_DTR 0x002 | ||
181 | #define TIOCM_RTS 0x004 | ||
182 | #define TIOCM_ST 0x008 | ||
183 | #define TIOCM_SR 0x010 | ||
184 | #define TIOCM_CTS 0x020 | ||
185 | #define TIOCM_CAR 0x040 | ||
186 | #define TIOCM_RNG 0x080 | ||
187 | #define TIOCM_DSR 0x100 | ||
188 | #define TIOCM_CD TIOCM_CAR | ||
189 | #define TIOCM_RI TIOCM_RNG | ||
190 | #define TIOCM_OUT1 0x2000 | ||
191 | #define TIOCM_OUT2 0x4000 | ||
192 | #define TIOCM_LOOP 0x8000 | ||
193 | |||
194 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
195 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
196 | |||
197 | #ifdef __KERNEL__ | ||
198 | |||
199 | /* | ||
200 | * Translate a "termio" structure into a "termios". Ugh. | ||
201 | */ | ||
202 | #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ | ||
203 | unsigned short __tmp; \ | ||
204 | get_user(__tmp,&(termio)->x); \ | ||
205 | (termios)->x = (0xffff0000 & (termios)->x) | __tmp; \ | ||
206 | } | ||
207 | |||
208 | #define user_termio_to_kernel_termios(termios, termio) \ | ||
209 | ({ \ | ||
210 | SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ | ||
211 | SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ | ||
212 | SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ | ||
213 | SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ | ||
214 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | ||
215 | }) | ||
216 | |||
217 | /* | ||
218 | * Translate a "termios" structure into a "termio". Ugh. | ||
219 | */ | ||
220 | #define kernel_termios_to_user_termio(termio, termios) \ | ||
221 | ({ \ | ||
222 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | ||
223 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | ||
224 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | ||
225 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | ||
226 | put_user((termios)->c_line, &(termio)->c_line); \ | ||
227 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
228 | }) | ||
229 | |||
230 | #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) | ||
231 | #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) | ||
232 | |||
233 | #endif /* __KERNEL__ */ | ||
234 | |||
235 | #endif /* _PPC64_TERMIOS_H */ | ||
diff --git a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h new file mode 100644 index 000000000000..037b5e06083c --- /dev/null +++ b/include/asm-ppc64/thread_info.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* thread_info.h: PPC low-level thread information | ||
2 | * adapted from the i386 version by Paul Mackerras | ||
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 | #ifdef __KERNEL__ | ||
12 | |||
13 | #ifndef __ASSEMBLY__ | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/cache.h> | ||
16 | #include <asm/processor.h> | ||
17 | #include <asm/page.h> | ||
18 | #include <linux/stringify.h> | ||
19 | |||
20 | /* | ||
21 | * low level task data. | ||
22 | */ | ||
23 | struct thread_info { | ||
24 | struct task_struct *task; /* main task structure */ | ||
25 | struct exec_domain *exec_domain; /* execution domain */ | ||
26 | int cpu; /* cpu we're on */ | ||
27 | int preempt_count; | ||
28 | struct restart_block restart_block; | ||
29 | /* set by force_successful_syscall_return */ | ||
30 | unsigned char syscall_noerror; | ||
31 | /* low level flags - has atomic operations done on it */ | ||
32 | unsigned long flags ____cacheline_aligned_in_smp; | ||
33 | }; | ||
34 | |||
35 | /* | ||
36 | * macros/functions for gaining access to the thread information structure | ||
37 | * | ||
38 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
39 | */ | ||
40 | #define INIT_THREAD_INFO(tsk) \ | ||
41 | { \ | ||
42 | .task = &tsk, \ | ||
43 | .exec_domain = &default_exec_domain, \ | ||
44 | .cpu = 0, \ | ||
45 | .preempt_count = 1, \ | ||
46 | .restart_block = { \ | ||
47 | .fn = do_no_restart_syscall, \ | ||
48 | }, \ | ||
49 | .flags = 0, \ | ||
50 | } | ||
51 | |||
52 | #define init_thread_info (init_thread_union.thread_info) | ||
53 | #define init_stack (init_thread_union.stack) | ||
54 | |||
55 | /* thread information allocation */ | ||
56 | |||
57 | #define THREAD_ORDER 2 | ||
58 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) | ||
59 | #define THREAD_SHIFT (PAGE_SHIFT + THREAD_ORDER) | ||
60 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
61 | #define alloc_thread_info(tsk) \ | ||
62 | ({ \ | ||
63 | struct thread_info *ret; \ | ||
64 | \ | ||
65 | ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \ | ||
66 | if (ret) \ | ||
67 | memset(ret, 0, THREAD_SIZE); \ | ||
68 | ret; \ | ||
69 | }) | ||
70 | #else | ||
71 | #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) | ||
72 | #endif | ||
73 | #define free_thread_info(ti) kfree(ti) | ||
74 | #define get_thread_info(ti) get_task_struct((ti)->task) | ||
75 | #define put_thread_info(ti) put_task_struct((ti)->task) | ||
76 | |||
77 | /* how to get the thread information struct from C */ | ||
78 | static inline struct thread_info *current_thread_info(void) | ||
79 | { | ||
80 | struct thread_info *ti; | ||
81 | __asm__("clrrdi %0,1,%1" : "=r"(ti) : "i" (THREAD_SHIFT)); | ||
82 | return ti; | ||
83 | } | ||
84 | |||
85 | #endif /* __ASSEMBLY__ */ | ||
86 | |||
87 | #define PREEMPT_ACTIVE 0x10000000 | ||
88 | |||
89 | /* | ||
90 | * thread information flag bit numbers | ||
91 | */ | ||
92 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
93 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
94 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
95 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
96 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling | ||
97 | TIF_NEED_RESCHED */ | ||
98 | #define TIF_32BIT 5 /* 32 bit binary */ | ||
99 | #define TIF_RUN_LIGHT 6 /* iSeries run light */ | ||
100 | #define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */ | ||
101 | #define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */ | ||
102 | #define TIF_SINGLESTEP 9 /* singlestepping active */ | ||
103 | #define TIF_MEMDIE 10 | ||
104 | #define TIF_SECCOMP 11 /* secure computing */ | ||
105 | |||
106 | /* as above, but as bit values */ | ||
107 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
108 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
109 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
110 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
111 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
112 | #define _TIF_32BIT (1<<TIF_32BIT) | ||
113 | #define _TIF_RUN_LIGHT (1<<TIF_RUN_LIGHT) | ||
114 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) | ||
115 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | ||
116 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | ||
117 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | ||
118 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) | ||
119 | |||
120 | #define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ | ||
121 | _TIF_NEED_RESCHED) | ||
122 | |||
123 | #endif /* __KERNEL__ */ | ||
124 | |||
125 | #endif /* _ASM_THREAD_INFO_H */ | ||
diff --git a/include/asm-ppc64/time.h b/include/asm-ppc64/time.h new file mode 100644 index 000000000000..8d6e3760ee10 --- /dev/null +++ b/include/asm-ppc64/time.h | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | * Common time prototypes and such for all ppc machines. | ||
3 | * | ||
4 | * Written by Cort Dougan (cort@cs.nmt.edu) to merge | ||
5 | * Paul Mackerras' version and mine for PReP and Pmac. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __PPC64_TIME_H | ||
14 | #define __PPC64_TIME_H | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/types.h> | ||
19 | #include <linux/mc146818rtc.h> | ||
20 | |||
21 | #include <asm/processor.h> | ||
22 | #include <asm/paca.h> | ||
23 | #include <asm/iSeries/HvCall.h> | ||
24 | |||
25 | /* time.c */ | ||
26 | extern unsigned long tb_ticks_per_jiffy; | ||
27 | extern unsigned long tb_ticks_per_usec; | ||
28 | extern unsigned long tb_ticks_per_sec; | ||
29 | extern unsigned long tb_to_xs; | ||
30 | extern unsigned tb_to_us; | ||
31 | extern unsigned long tb_last_stamp; | ||
32 | |||
33 | struct rtc_time; | ||
34 | extern void to_tm(int tim, struct rtc_time * tm); | ||
35 | extern time_t last_rtc_update; | ||
36 | |||
37 | /* | ||
38 | * By putting all of this stuff into a single struct we | ||
39 | * reduce the number of cache lines touched by do_gettimeofday. | ||
40 | * Both by collecting all of the data in one cache line and | ||
41 | * by touching only one TOC entry | ||
42 | */ | ||
43 | struct gettimeofday_vars { | ||
44 | unsigned long tb_to_xs; | ||
45 | unsigned long stamp_xsec; | ||
46 | unsigned long tb_orig_stamp; | ||
47 | }; | ||
48 | |||
49 | struct gettimeofday_struct { | ||
50 | unsigned long tb_ticks_per_sec; | ||
51 | struct gettimeofday_vars vars[2]; | ||
52 | struct gettimeofday_vars * volatile varp; | ||
53 | unsigned var_idx; | ||
54 | unsigned tb_to_us; | ||
55 | }; | ||
56 | |||
57 | struct div_result { | ||
58 | unsigned long result_high; | ||
59 | unsigned long result_low; | ||
60 | }; | ||
61 | |||
62 | int via_calibrate_decr(void); | ||
63 | |||
64 | static __inline__ unsigned long get_tb(void) | ||
65 | { | ||
66 | return mftb(); | ||
67 | } | ||
68 | |||
69 | /* Accessor functions for the decrementer register. */ | ||
70 | static __inline__ unsigned int get_dec(void) | ||
71 | { | ||
72 | return (mfspr(SPRN_DEC)); | ||
73 | } | ||
74 | |||
75 | static __inline__ void set_dec(int val) | ||
76 | { | ||
77 | #ifdef CONFIG_PPC_ISERIES | ||
78 | struct paca_struct *lpaca = get_paca(); | ||
79 | int cur_dec; | ||
80 | |||
81 | if (lpaca->lppaca.shared_proc) { | ||
82 | lpaca->lppaca.virtual_decr = val; | ||
83 | cur_dec = get_dec(); | ||
84 | if (cur_dec > val) | ||
85 | HvCall_setVirtualDecr(); | ||
86 | } else | ||
87 | #endif | ||
88 | mtspr(SPRN_DEC, val); | ||
89 | } | ||
90 | |||
91 | static inline unsigned long tb_ticks_since(unsigned long tstamp) | ||
92 | { | ||
93 | return get_tb() - tstamp; | ||
94 | } | ||
95 | |||
96 | #define mulhwu(x,y) \ | ||
97 | ({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;}) | ||
98 | #define mulhdu(x,y) \ | ||
99 | ({unsigned long z; asm ("mulhdu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;}) | ||
100 | |||
101 | |||
102 | unsigned mulhwu_scale_factor(unsigned, unsigned); | ||
103 | void div128_by_32( unsigned long dividend_high, unsigned long dividend_low, | ||
104 | unsigned divisor, struct div_result *dr ); | ||
105 | |||
106 | /* Used to store Processor Utilization register (purr) values */ | ||
107 | |||
108 | struct cpu_usage { | ||
109 | u64 current_tb; /* Holds the current purr register values */ | ||
110 | }; | ||
111 | |||
112 | DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array); | ||
113 | |||
114 | #endif /* __KERNEL__ */ | ||
115 | #endif /* __PPC64_TIME_H */ | ||
diff --git a/include/asm-ppc64/timex.h b/include/asm-ppc64/timex.h new file mode 100644 index 000000000000..8db4da4064cd --- /dev/null +++ b/include/asm-ppc64/timex.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * linux/include/asm-ppc/timex.h | ||
3 | * | ||
4 | * PPC64 architecture timex specifications | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef _ASMPPC64_TIMEX_H | ||
12 | #define _ASMPPC64_TIMEX_H | ||
13 | |||
14 | #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ | ||
15 | |||
16 | typedef unsigned long cycles_t; | ||
17 | |||
18 | static inline cycles_t get_cycles(void) | ||
19 | { | ||
20 | cycles_t ret; | ||
21 | |||
22 | __asm__ __volatile__("mftb %0" : "=r" (ret) : ); | ||
23 | return ret; | ||
24 | } | ||
25 | |||
26 | #endif | ||
diff --git a/include/asm-ppc64/tlb.h b/include/asm-ppc64/tlb.h new file mode 100644 index 000000000000..97cb696ce68d --- /dev/null +++ b/include/asm-ppc64/tlb.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * TLB shootdown specifics for PPC64 | ||
3 | * | ||
4 | * Copyright (C) 2002 Anton Blanchard, IBM Corp. | ||
5 | * Copyright (C) 2002 Paul Mackerras, IBM Corp. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | #ifndef _PPC64_TLB_H | ||
13 | #define _PPC64_TLB_H | ||
14 | |||
15 | #include <asm/tlbflush.h> | ||
16 | |||
17 | struct mmu_gather; | ||
18 | |||
19 | extern void pte_free_finish(void); | ||
20 | |||
21 | static inline void tlb_flush(struct mmu_gather *tlb) | ||
22 | { | ||
23 | flush_tlb_pending(); | ||
24 | pte_free_finish(); | ||
25 | } | ||
26 | |||
27 | /* Avoid pulling in another include just for this */ | ||
28 | #define check_pgt_cache() do { } while (0) | ||
29 | |||
30 | /* Get the generic bits... */ | ||
31 | #include <asm-generic/tlb.h> | ||
32 | |||
33 | /* Nothing needed here in fact... */ | ||
34 | #define tlb_start_vma(tlb, vma) do { } while (0) | ||
35 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
36 | |||
37 | #define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) | ||
38 | |||
39 | #endif /* _PPC64_TLB_H */ | ||
diff --git a/include/asm-ppc64/tlbflush.h b/include/asm-ppc64/tlbflush.h new file mode 100644 index 000000000000..45411a67e082 --- /dev/null +++ b/include/asm-ppc64/tlbflush.h | |||
@@ -0,0 +1,54 @@ | |||
1 | #ifndef _PPC64_TLBFLUSH_H | ||
2 | #define _PPC64_TLBFLUSH_H | ||
3 | |||
4 | /* | ||
5 | * TLB flushing: | ||
6 | * | ||
7 | * - flush_tlb_mm(mm) flushes the specified mm context TLB's | ||
8 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
9 | * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB | ||
10 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
11 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | ||
12 | * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | ||
13 | */ | ||
14 | |||
15 | #include <linux/percpu.h> | ||
16 | #include <asm/page.h> | ||
17 | |||
18 | #define PPC64_TLB_BATCH_NR 192 | ||
19 | |||
20 | struct mm_struct; | ||
21 | struct ppc64_tlb_batch { | ||
22 | unsigned long index; | ||
23 | unsigned long context; | ||
24 | struct mm_struct *mm; | ||
25 | pte_t pte[PPC64_TLB_BATCH_NR]; | ||
26 | unsigned long addr[PPC64_TLB_BATCH_NR]; | ||
27 | unsigned long vaddr[PPC64_TLB_BATCH_NR]; | ||
28 | }; | ||
29 | DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); | ||
30 | |||
31 | extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); | ||
32 | |||
33 | static inline void flush_tlb_pending(void) | ||
34 | { | ||
35 | struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); | ||
36 | |||
37 | if (batch->index) | ||
38 | __flush_tlb_pending(batch); | ||
39 | put_cpu_var(ppc64_tlb_batch); | ||
40 | } | ||
41 | |||
42 | #define flush_tlb_mm(mm) flush_tlb_pending() | ||
43 | #define flush_tlb_page(vma, addr) flush_tlb_pending() | ||
44 | #define flush_tlb_page_nohash(vma, addr) do { } while (0) | ||
45 | #define flush_tlb_range(vma, start, end) \ | ||
46 | do { (void)(start); flush_tlb_pending(); } while (0) | ||
47 | #define flush_tlb_kernel_range(start, end) flush_tlb_pending() | ||
48 | #define flush_tlb_pgtables(mm, start, end) do { } while (0) | ||
49 | |||
50 | extern void flush_hash_page(unsigned long context, unsigned long ea, pte_t pte, | ||
51 | int local); | ||
52 | void flush_hash_range(unsigned long context, unsigned long number, int local); | ||
53 | |||
54 | #endif /* _PPC64_TLBFLUSH_H */ | ||
diff --git a/include/asm-ppc64/topology.h b/include/asm-ppc64/topology.h new file mode 100644 index 000000000000..d58d9dd79998 --- /dev/null +++ b/include/asm-ppc64/topology.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef _ASM_PPC64_TOPOLOGY_H | ||
2 | #define _ASM_PPC64_TOPOLOGY_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <asm/mmzone.h> | ||
6 | |||
7 | #ifdef CONFIG_NUMA | ||
8 | |||
9 | static inline int cpu_to_node(int cpu) | ||
10 | { | ||
11 | int node; | ||
12 | |||
13 | node = numa_cpu_lookup_table[cpu]; | ||
14 | |||
15 | #ifdef DEBUG_NUMA | ||
16 | BUG_ON(node == -1); | ||
17 | #endif | ||
18 | |||
19 | return node; | ||
20 | } | ||
21 | |||
22 | #define parent_node(node) (node) | ||
23 | |||
24 | static inline cpumask_t node_to_cpumask(int node) | ||
25 | { | ||
26 | return numa_cpumask_lookup_table[node]; | ||
27 | } | ||
28 | |||
29 | static inline int node_to_first_cpu(int node) | ||
30 | { | ||
31 | cpumask_t tmp; | ||
32 | tmp = node_to_cpumask(node); | ||
33 | return first_cpu(tmp); | ||
34 | } | ||
35 | |||
36 | #define pcibus_to_cpumask(bus) (cpu_online_map) | ||
37 | |||
38 | #define nr_cpus_node(node) (nr_cpus_in_node[node]) | ||
39 | |||
40 | /* sched_domains SD_NODE_INIT for PPC64 machines */ | ||
41 | #define SD_NODE_INIT (struct sched_domain) { \ | ||
42 | .span = CPU_MASK_NONE, \ | ||
43 | .parent = NULL, \ | ||
44 | .groups = NULL, \ | ||
45 | .min_interval = 8, \ | ||
46 | .max_interval = 32, \ | ||
47 | .busy_factor = 32, \ | ||
48 | .imbalance_pct = 125, \ | ||
49 | .cache_hot_time = (10*1000000), \ | ||
50 | .cache_nice_tries = 1, \ | ||
51 | .per_cpu_gain = 100, \ | ||
52 | .flags = SD_LOAD_BALANCE \ | ||
53 | | SD_BALANCE_EXEC \ | ||
54 | | SD_BALANCE_NEWIDLE \ | ||
55 | | SD_WAKE_IDLE \ | ||
56 | | SD_WAKE_BALANCE, \ | ||
57 | .last_balance = jiffies, \ | ||
58 | .balance_interval = 1, \ | ||
59 | .nr_balance_failed = 0, \ | ||
60 | } | ||
61 | |||
62 | #else /* !CONFIG_NUMA */ | ||
63 | |||
64 | #include <asm-generic/topology.h> | ||
65 | |||
66 | #endif /* CONFIG_NUMA */ | ||
67 | |||
68 | #endif /* _ASM_PPC64_TOPOLOGY_H */ | ||
diff --git a/include/asm-ppc64/types.h b/include/asm-ppc64/types.h new file mode 100644 index 000000000000..5b8c2cfa1138 --- /dev/null +++ b/include/asm-ppc64/types.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef _PPC64_TYPES_H | ||
2 | #define _PPC64_TYPES_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | /* | ||
7 | * This file is never included by application software unless | ||
8 | * explicitly requested (e.g., via linux/types.h) in which case the | ||
9 | * application is Linux specific so (user-) name space pollution is | ||
10 | * not a major issue. However, for interoperability, libraries still | ||
11 | * need to be careful to avoid a name clashes. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | */ | ||
18 | |||
19 | typedef unsigned int umode_t; | ||
20 | |||
21 | /* | ||
22 | * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the | ||
23 | * header files exported to user space | ||
24 | */ | ||
25 | |||
26 | typedef __signed__ char __s8; | ||
27 | typedef unsigned char __u8; | ||
28 | |||
29 | typedef __signed__ short __s16; | ||
30 | typedef unsigned short __u16; | ||
31 | |||
32 | typedef __signed__ int __s32; | ||
33 | typedef unsigned int __u32; | ||
34 | |||
35 | typedef __signed__ long __s64; | ||
36 | typedef unsigned long __u64; | ||
37 | |||
38 | typedef struct { | ||
39 | __u32 u[4]; | ||
40 | } __attribute((aligned(16))) __vector128; | ||
41 | |||
42 | #endif /* __ASSEMBLY__ */ | ||
43 | |||
44 | #ifdef __KERNEL__ | ||
45 | /* | ||
46 | * These aren't exported outside the kernel to avoid name space clashes | ||
47 | */ | ||
48 | #define BITS_PER_LONG 64 | ||
49 | |||
50 | #ifndef __ASSEMBLY__ | ||
51 | |||
52 | typedef signed char s8; | ||
53 | typedef unsigned char u8; | ||
54 | |||
55 | typedef signed short s16; | ||
56 | typedef unsigned short u16; | ||
57 | |||
58 | typedef signed int s32; | ||
59 | typedef unsigned int u32; | ||
60 | |||
61 | typedef signed long s64; | ||
62 | typedef unsigned long u64; | ||
63 | |||
64 | typedef __vector128 vector128; | ||
65 | |||
66 | typedef u32 dma_addr_t; | ||
67 | typedef u64 dma64_addr_t; | ||
68 | |||
69 | typedef struct { | ||
70 | unsigned long entry; | ||
71 | unsigned long toc; | ||
72 | unsigned long env; | ||
73 | } func_descr_t; | ||
74 | |||
75 | typedef unsigned int kmem_bufctl_t; | ||
76 | #endif /* __ASSEMBLY__ */ | ||
77 | |||
78 | #endif /* __KERNEL__ */ | ||
79 | |||
80 | #endif /* _PPC64_TYPES_H */ | ||
diff --git a/include/asm-ppc64/uaccess.h b/include/asm-ppc64/uaccess.h new file mode 100644 index 000000000000..05b5943ab1ee --- /dev/null +++ b/include/asm-ppc64/uaccess.h | |||
@@ -0,0 +1,346 @@ | |||
1 | #ifndef _PPC64_UACCESS_H | ||
2 | #define _PPC64_UACCESS_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASSEMBLY__ | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <asm/processor.h> | ||
15 | |||
16 | #define VERIFY_READ 0 | ||
17 | #define VERIFY_WRITE 1 | ||
18 | |||
19 | /* | ||
20 | * The fs value determines whether argument validity checking should be | ||
21 | * performed or not. If get_fs() == USER_DS, checking is performed, with | ||
22 | * get_fs() == KERNEL_DS, checking is bypassed. | ||
23 | * | ||
24 | * For historical reasons, these macros are grossly misnamed. | ||
25 | */ | ||
26 | |||
27 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | ||
28 | |||
29 | #define KERNEL_DS MAKE_MM_SEG(0UL) | ||
30 | #define USER_DS MAKE_MM_SEG(0xf000000000000000UL) | ||
31 | |||
32 | #define get_ds() (KERNEL_DS) | ||
33 | #define get_fs() (current->thread.fs) | ||
34 | #define set_fs(val) (current->thread.fs = (val)) | ||
35 | |||
36 | #define segment_eq(a,b) ((a).seg == (b).seg) | ||
37 | |||
38 | /* | ||
39 | * Use the alpha trick for checking ranges: | ||
40 | * | ||
41 | * Is a address valid? This does a straightforward calculation rather | ||
42 | * than tests. | ||
43 | * | ||
44 | * Address valid if: | ||
45 | * - "addr" doesn't have any high-bits set | ||
46 | * - AND "size" doesn't have any high-bits set | ||
47 | * - OR we are in kernel mode. | ||
48 | * | ||
49 | * We dont have to check for high bits in (addr+size) because the first | ||
50 | * two checks force the maximum result to be below the start of the | ||
51 | * kernel region. | ||
52 | */ | ||
53 | #define __access_ok(addr,size,segment) \ | ||
54 | (((segment).seg & (addr | size )) == 0) | ||
55 | |||
56 | #define access_ok(type,addr,size) \ | ||
57 | __access_ok(((__force unsigned long)(addr)),(size),get_fs()) | ||
58 | |||
59 | /* this function will go away soon - use access_ok() instead */ | ||
60 | static inline int __deprecated verify_area(int type, const void __user *addr, unsigned long size) | ||
61 | { | ||
62 | return access_ok(type,addr,size) ? 0 : -EFAULT; | ||
63 | } | ||
64 | |||
65 | |||
66 | /* | ||
67 | * The exception table consists of pairs of addresses: the first is the | ||
68 | * address of an instruction that is allowed to fault, and the second is | ||
69 | * the address at which the program should continue. No registers are | ||
70 | * modified, so it is entirely up to the continuation code to figure out | ||
71 | * what to do. | ||
72 | * | ||
73 | * All the routines below use bits of fixup code that are out of line | ||
74 | * with the main instruction path. This means when everything is well, | ||
75 | * we don't even have to jump over them. Further, they do not intrude | ||
76 | * on our cache or tlb entries. | ||
77 | */ | ||
78 | |||
79 | struct exception_table_entry | ||
80 | { | ||
81 | unsigned long insn, fixup; | ||
82 | }; | ||
83 | |||
84 | /* Returns 0 if exception not found and fixup otherwise. */ | ||
85 | extern unsigned long search_exception_table(unsigned long); | ||
86 | |||
87 | /* | ||
88 | * These are the main single-value transfer routines. They automatically | ||
89 | * use the right size if we just have the right pointer type. | ||
90 | * | ||
91 | * This gets kind of ugly. We want to return _two_ values in "get_user()" | ||
92 | * and yet we don't want to do any pointers, because that is too much | ||
93 | * of a performance impact. Thus we have a few rather ugly macros here, | ||
94 | * and hide all the ugliness from the user. | ||
95 | * | ||
96 | * The "__xxx" versions of the user access functions are versions that | ||
97 | * do not verify the address space, that must have been done previously | ||
98 | * with a separate "access_ok()" call (this is used when we do multiple | ||
99 | * accesses to the same area of user memory). | ||
100 | * | ||
101 | * As we use the same address space for kernel and user data on the | ||
102 | * PowerPC, we can just do these as direct assignments. (Of course, the | ||
103 | * exception handling means that it's no longer "just"...) | ||
104 | */ | ||
105 | #define get_user(x,ptr) \ | ||
106 | __get_user_check((x),(ptr),sizeof(*(ptr))) | ||
107 | #define put_user(x,ptr) \ | ||
108 | __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) | ||
109 | |||
110 | #define __get_user(x,ptr) \ | ||
111 | __get_user_nocheck((x),(ptr),sizeof(*(ptr))) | ||
112 | #define __put_user(x,ptr) \ | ||
113 | __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) | ||
114 | |||
115 | #define __get_user_unaligned __get_user | ||
116 | #define __put_user_unaligned __put_user | ||
117 | |||
118 | extern long __put_user_bad(void); | ||
119 | |||
120 | #define __put_user_nocheck(x,ptr,size) \ | ||
121 | ({ \ | ||
122 | long __pu_err; \ | ||
123 | might_sleep(); \ | ||
124 | __chk_user_ptr(ptr); \ | ||
125 | __put_user_size((x),(ptr),(size),__pu_err,-EFAULT); \ | ||
126 | __pu_err; \ | ||
127 | }) | ||
128 | |||
129 | #define __put_user_check(x,ptr,size) \ | ||
130 | ({ \ | ||
131 | long __pu_err = -EFAULT; \ | ||
132 | void __user *__pu_addr = (ptr); \ | ||
133 | might_sleep(); \ | ||
134 | if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ | ||
135 | __put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT); \ | ||
136 | __pu_err; \ | ||
137 | }) | ||
138 | |||
139 | #define __put_user_size(x,ptr,size,retval,errret) \ | ||
140 | do { \ | ||
141 | retval = 0; \ | ||
142 | switch (size) { \ | ||
143 | case 1: __put_user_asm(x,ptr,retval,"stb",errret); break; \ | ||
144 | case 2: __put_user_asm(x,ptr,retval,"sth",errret); break; \ | ||
145 | case 4: __put_user_asm(x,ptr,retval,"stw",errret); break; \ | ||
146 | case 8: __put_user_asm(x,ptr,retval,"std",errret); break; \ | ||
147 | default: __put_user_bad(); \ | ||
148 | } \ | ||
149 | } while (0) | ||
150 | |||
151 | /* | ||
152 | * We don't tell gcc that we are accessing memory, but this is OK | ||
153 | * because we do not write to any memory gcc knows about, so there | ||
154 | * are no aliasing issues. | ||
155 | */ | ||
156 | #define __put_user_asm(x, addr, err, op, errret) \ | ||
157 | __asm__ __volatile__( \ | ||
158 | "1: "op" %1,0(%2) # put_user\n" \ | ||
159 | "2:\n" \ | ||
160 | ".section .fixup,\"ax\"\n" \ | ||
161 | "3: li %0,%3\n" \ | ||
162 | " b 2b\n" \ | ||
163 | ".previous\n" \ | ||
164 | ".section __ex_table,\"a\"\n" \ | ||
165 | " .align 3\n" \ | ||
166 | " .llong 1b,3b\n" \ | ||
167 | ".previous" \ | ||
168 | : "=r"(err) \ | ||
169 | : "r"(x), "b"(addr), "i"(errret), "0"(err)) | ||
170 | |||
171 | |||
172 | #define __get_user_nocheck(x,ptr,size) \ | ||
173 | ({ \ | ||
174 | long __gu_err, __gu_val; \ | ||
175 | might_sleep(); \ | ||
176 | __get_user_size(__gu_val,(ptr),(size),__gu_err,-EFAULT);\ | ||
177 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
178 | __gu_err; \ | ||
179 | }) | ||
180 | |||
181 | #define __get_user_check(x,ptr,size) \ | ||
182 | ({ \ | ||
183 | long __gu_err = -EFAULT, __gu_val = 0; \ | ||
184 | const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ | ||
185 | might_sleep(); \ | ||
186 | if (access_ok(VERIFY_READ,__gu_addr,size)) \ | ||
187 | __get_user_size(__gu_val,__gu_addr,(size),__gu_err,-EFAULT);\ | ||
188 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
189 | __gu_err; \ | ||
190 | }) | ||
191 | |||
192 | extern long __get_user_bad(void); | ||
193 | |||
194 | #define __get_user_size(x,ptr,size,retval,errret) \ | ||
195 | do { \ | ||
196 | retval = 0; \ | ||
197 | __chk_user_ptr(ptr); \ | ||
198 | switch (size) { \ | ||
199 | case 1: __get_user_asm(x,ptr,retval,"lbz",errret); break; \ | ||
200 | case 2: __get_user_asm(x,ptr,retval,"lhz",errret); break; \ | ||
201 | case 4: __get_user_asm(x,ptr,retval,"lwz",errret); break; \ | ||
202 | case 8: __get_user_asm(x,ptr,retval,"ld",errret); break; \ | ||
203 | default: (x) = __get_user_bad(); \ | ||
204 | } \ | ||
205 | } while (0) | ||
206 | |||
207 | #define __get_user_asm(x, addr, err, op, errret) \ | ||
208 | __asm__ __volatile__( \ | ||
209 | "1: "op" %1,0(%2) # get_user\n" \ | ||
210 | "2:\n" \ | ||
211 | ".section .fixup,\"ax\"\n" \ | ||
212 | "3: li %0,%3\n" \ | ||
213 | " li %1,0\n" \ | ||
214 | " b 2b\n" \ | ||
215 | ".previous\n" \ | ||
216 | ".section __ex_table,\"a\"\n" \ | ||
217 | " .align 3\n" \ | ||
218 | " .llong 1b,3b\n" \ | ||
219 | ".previous" \ | ||
220 | : "=r"(err), "=r"(x) \ | ||
221 | : "b"(addr), "i"(errret), "0"(err)) | ||
222 | |||
223 | /* more complex routines */ | ||
224 | |||
225 | extern unsigned long __copy_tofrom_user(void __user *to, const void __user *from, | ||
226 | unsigned long size); | ||
227 | |||
228 | static inline unsigned long | ||
229 | __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) | ||
230 | { | ||
231 | if (__builtin_constant_p(n)) { | ||
232 | unsigned long ret; | ||
233 | |||
234 | switch (n) { | ||
235 | case 1: | ||
236 | __get_user_size(*(u8 *)to, from, 1, ret, 1); | ||
237 | return ret; | ||
238 | case 2: | ||
239 | __get_user_size(*(u16 *)to, from, 2, ret, 2); | ||
240 | return ret; | ||
241 | case 4: | ||
242 | __get_user_size(*(u32 *)to, from, 4, ret, 4); | ||
243 | return ret; | ||
244 | case 8: | ||
245 | __get_user_size(*(u64 *)to, from, 8, ret, 8); | ||
246 | return ret; | ||
247 | } | ||
248 | } | ||
249 | return __copy_tofrom_user((__force void __user *) to, from, n); | ||
250 | } | ||
251 | |||
252 | static inline unsigned long | ||
253 | __copy_from_user(void *to, const void __user *from, unsigned long n) | ||
254 | { | ||
255 | might_sleep(); | ||
256 | return __copy_from_user_inatomic(to, from, n); | ||
257 | } | ||
258 | |||
259 | static inline unsigned long | ||
260 | __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n) | ||
261 | { | ||
262 | if (__builtin_constant_p(n)) { | ||
263 | unsigned long ret; | ||
264 | |||
265 | switch (n) { | ||
266 | case 1: | ||
267 | __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret, 1); | ||
268 | return ret; | ||
269 | case 2: | ||
270 | __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret, 2); | ||
271 | return ret; | ||
272 | case 4: | ||
273 | __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret, 4); | ||
274 | return ret; | ||
275 | case 8: | ||
276 | __put_user_size(*(u64 *)from, (u64 __user *)to, 8, ret, 8); | ||
277 | return ret; | ||
278 | } | ||
279 | } | ||
280 | return __copy_tofrom_user(to, (__force const void __user *) from, n); | ||
281 | } | ||
282 | |||
283 | static inline unsigned long | ||
284 | __copy_to_user(void __user *to, const void *from, unsigned long n) | ||
285 | { | ||
286 | might_sleep(); | ||
287 | return __copy_to_user_inatomic(to, from, n); | ||
288 | } | ||
289 | |||
290 | #define __copy_in_user(to, from, size) \ | ||
291 | __copy_tofrom_user((to), (from), (size)) | ||
292 | |||
293 | extern unsigned long copy_from_user(void *to, const void __user *from, | ||
294 | unsigned long n); | ||
295 | extern unsigned long copy_to_user(void __user *to, const void *from, | ||
296 | unsigned long n); | ||
297 | extern unsigned long copy_in_user(void __user *to, const void __user *from, | ||
298 | unsigned long n); | ||
299 | |||
300 | extern unsigned long __clear_user(void __user *addr, unsigned long size); | ||
301 | |||
302 | static inline unsigned long | ||
303 | clear_user(void __user *addr, unsigned long size) | ||
304 | { | ||
305 | might_sleep(); | ||
306 | if (likely(access_ok(VERIFY_WRITE, addr, size))) | ||
307 | size = __clear_user(addr, size); | ||
308 | return size; | ||
309 | } | ||
310 | |||
311 | extern int __strncpy_from_user(char *dst, const char __user *src, long count); | ||
312 | |||
313 | static inline long | ||
314 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
315 | { | ||
316 | might_sleep(); | ||
317 | if (likely(access_ok(VERIFY_READ, src, 1))) | ||
318 | return __strncpy_from_user(dst, src, count); | ||
319 | return -EFAULT; | ||
320 | } | ||
321 | |||
322 | /* | ||
323 | * Return the size of a string (including the ending 0) | ||
324 | * | ||
325 | * Return 0 for error | ||
326 | */ | ||
327 | extern int __strnlen_user(const char __user *str, long len); | ||
328 | |||
329 | /* | ||
330 | * Returns the length of the string at str (including the null byte), | ||
331 | * or 0 if we hit a page we can't access, | ||
332 | * or something > len if we didn't find a null byte. | ||
333 | */ | ||
334 | static inline int strnlen_user(const char __user *str, long len) | ||
335 | { | ||
336 | might_sleep(); | ||
337 | if (likely(access_ok(VERIFY_READ, str, 1))) | ||
338 | return __strnlen_user(str, len); | ||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | #define strlen_user(str) strnlen_user((str), 0x7ffffffe) | ||
343 | |||
344 | #endif /* __ASSEMBLY__ */ | ||
345 | |||
346 | #endif /* _PPC64_UACCESS_H */ | ||
diff --git a/include/asm-ppc64/ucontext.h b/include/asm-ppc64/ucontext.h new file mode 100644 index 000000000000..ef8cc5b37542 --- /dev/null +++ b/include/asm-ppc64/ucontext.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _ASMPPC64_UCONTEXT_H | ||
2 | #define _ASMPPC64_UCONTEXT_H | ||
3 | |||
4 | #include <asm/sigcontext.h> | ||
5 | |||
6 | /* | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | struct ucontext { | ||
14 | unsigned long uc_flags; | ||
15 | struct ucontext *uc_link; | ||
16 | stack_t uc_stack; | ||
17 | sigset_t uc_sigmask; | ||
18 | sigset_t __unsued[15]; /* Allow for uc_sigmask growth */ | ||
19 | struct sigcontext uc_mcontext; /* last for extensibility */ | ||
20 | }; | ||
21 | |||
22 | #endif /* _ASMPPC64_UCONTEXT_H */ | ||
diff --git a/include/asm-ppc64/udbg.h b/include/asm-ppc64/udbg.h new file mode 100644 index 000000000000..a6e04d014b2b --- /dev/null +++ b/include/asm-ppc64/udbg.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef __UDBG_HDR | ||
2 | #define __UDBG_HDR | ||
3 | |||
4 | #include <linux/compiler.h> | ||
5 | |||
6 | /* | ||
7 | * c 2001 PPC 64 Team, IBM Corp | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | void udbg_init_uart(void __iomem *comport, unsigned int speed); | ||
16 | void udbg_putc(unsigned char c); | ||
17 | unsigned char udbg_getc(void); | ||
18 | int udbg_getc_poll(void); | ||
19 | void udbg_puts(const char *s); | ||
20 | int udbg_write(const char *s, int n); | ||
21 | int udbg_read(char *buf, int buflen); | ||
22 | struct console; | ||
23 | void udbg_console_write(struct console *con, const char *s, unsigned int n); | ||
24 | void udbg_printf(const char *fmt, ...); | ||
25 | void udbg_ppcdbg(unsigned long flags, const char *fmt, ...); | ||
26 | unsigned long udbg_ifdebug(unsigned long flags); | ||
27 | |||
28 | #endif | ||
diff --git a/include/asm-ppc64/unaligned.h b/include/asm-ppc64/unaligned.h new file mode 100644 index 000000000000..636e93c4f379 --- /dev/null +++ b/include/asm-ppc64/unaligned.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __PPC64_UNALIGNED_H | ||
2 | #define __PPC64_UNALIGNED_H | ||
3 | |||
4 | /* | ||
5 | * The PowerPC can do unaligned accesses itself in big endian mode. | ||
6 | * | ||
7 | * The strange macros are there to make sure these can't | ||
8 | * be misused in a way that makes them not work on other | ||
9 | * architectures where unaligned accesses aren't as simple. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | #define get_unaligned(ptr) (*(ptr)) | ||
18 | |||
19 | #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) | ||
20 | |||
21 | #endif /* __PPC64_UNALIGNED_H */ | ||
diff --git a/include/asm-ppc64/uninorth.h b/include/asm-ppc64/uninorth.h new file mode 100644 index 000000000000..7ad7059f2c80 --- /dev/null +++ b/include/asm-ppc64/uninorth.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <asm-ppc/uninorth.h> | ||
2 | |||
diff --git a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h new file mode 100644 index 000000000000..605d91e011ec --- /dev/null +++ b/include/asm-ppc64/unistd.h | |||
@@ -0,0 +1,482 @@ | |||
1 | #ifndef _ASM_PPC_UNISTD_H_ | ||
2 | #define _ASM_PPC_UNISTD_H_ | ||
3 | |||
4 | /* | ||
5 | * This file contains the system call numbers. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #define __NR_restart_syscall 0 | ||
14 | #define __NR_exit 1 | ||
15 | #define __NR_fork 2 | ||
16 | #define __NR_read 3 | ||
17 | #define __NR_write 4 | ||
18 | #define __NR_open 5 | ||
19 | #define __NR_close 6 | ||
20 | #define __NR_waitpid 7 | ||
21 | #define __NR_creat 8 | ||
22 | #define __NR_link 9 | ||
23 | #define __NR_unlink 10 | ||
24 | #define __NR_execve 11 | ||
25 | #define __NR_chdir 12 | ||
26 | #define __NR_time 13 | ||
27 | #define __NR_mknod 14 | ||
28 | #define __NR_chmod 15 | ||
29 | #define __NR_lchown 16 | ||
30 | #define __NR_break 17 | ||
31 | #define __NR_oldstat 18 | ||
32 | #define __NR_lseek 19 | ||
33 | #define __NR_getpid 20 | ||
34 | #define __NR_mount 21 | ||
35 | #define __NR_umount 22 | ||
36 | #define __NR_setuid 23 | ||
37 | #define __NR_getuid 24 | ||
38 | #define __NR_stime 25 | ||
39 | #define __NR_ptrace 26 | ||
40 | #define __NR_alarm 27 | ||
41 | #define __NR_oldfstat 28 | ||
42 | #define __NR_pause 29 | ||
43 | #define __NR_utime 30 | ||
44 | #define __NR_stty 31 | ||
45 | #define __NR_gtty 32 | ||
46 | #define __NR_access 33 | ||
47 | #define __NR_nice 34 | ||
48 | #define __NR_ftime 35 | ||
49 | #define __NR_sync 36 | ||
50 | #define __NR_kill 37 | ||
51 | #define __NR_rename 38 | ||
52 | #define __NR_mkdir 39 | ||
53 | #define __NR_rmdir 40 | ||
54 | #define __NR_dup 41 | ||
55 | #define __NR_pipe 42 | ||
56 | #define __NR_times 43 | ||
57 | #define __NR_prof 44 | ||
58 | #define __NR_brk 45 | ||
59 | #define __NR_setgid 46 | ||
60 | #define __NR_getgid 47 | ||
61 | #define __NR_signal 48 | ||
62 | #define __NR_geteuid 49 | ||
63 | #define __NR_getegid 50 | ||
64 | #define __NR_acct 51 | ||
65 | #define __NR_umount2 52 | ||
66 | #define __NR_lock 53 | ||
67 | #define __NR_ioctl 54 | ||
68 | #define __NR_fcntl 55 | ||
69 | #define __NR_mpx 56 | ||
70 | #define __NR_setpgid 57 | ||
71 | #define __NR_ulimit 58 | ||
72 | #define __NR_oldolduname 59 | ||
73 | #define __NR_umask 60 | ||
74 | #define __NR_chroot 61 | ||
75 | #define __NR_ustat 62 | ||
76 | #define __NR_dup2 63 | ||
77 | #define __NR_getppid 64 | ||
78 | #define __NR_getpgrp 65 | ||
79 | #define __NR_setsid 66 | ||
80 | #define __NR_sigaction 67 | ||
81 | #define __NR_sgetmask 68 | ||
82 | #define __NR_ssetmask 69 | ||
83 | #define __NR_setreuid 70 | ||
84 | #define __NR_setregid 71 | ||
85 | #define __NR_sigsuspend 72 | ||
86 | #define __NR_sigpending 73 | ||
87 | #define __NR_sethostname 74 | ||
88 | #define __NR_setrlimit 75 | ||
89 | #define __NR_getrlimit 76 | ||
90 | #define __NR_getrusage 77 | ||
91 | #define __NR_gettimeofday 78 | ||
92 | #define __NR_settimeofday 79 | ||
93 | #define __NR_getgroups 80 | ||
94 | #define __NR_setgroups 81 | ||
95 | #define __NR_select 82 | ||
96 | #define __NR_symlink 83 | ||
97 | #define __NR_oldlstat 84 | ||
98 | #define __NR_readlink 85 | ||
99 | #define __NR_uselib 86 | ||
100 | #define __NR_swapon 87 | ||
101 | #define __NR_reboot 88 | ||
102 | #define __NR_readdir 89 | ||
103 | #define __NR_mmap 90 | ||
104 | #define __NR_munmap 91 | ||
105 | #define __NR_truncate 92 | ||
106 | #define __NR_ftruncate 93 | ||
107 | #define __NR_fchmod 94 | ||
108 | #define __NR_fchown 95 | ||
109 | #define __NR_getpriority 96 | ||
110 | #define __NR_setpriority 97 | ||
111 | #define __NR_profil 98 | ||
112 | #define __NR_statfs 99 | ||
113 | #define __NR_fstatfs 100 | ||
114 | #define __NR_ioperm 101 | ||
115 | #define __NR_socketcall 102 | ||
116 | #define __NR_syslog 103 | ||
117 | #define __NR_setitimer 104 | ||
118 | #define __NR_getitimer 105 | ||
119 | #define __NR_stat 106 | ||
120 | #define __NR_lstat 107 | ||
121 | #define __NR_fstat 108 | ||
122 | #define __NR_olduname 109 | ||
123 | #define __NR_iopl 110 | ||
124 | #define __NR_vhangup 111 | ||
125 | #define __NR_idle 112 | ||
126 | #define __NR_vm86 113 | ||
127 | #define __NR_wait4 114 | ||
128 | #define __NR_swapoff 115 | ||
129 | #define __NR_sysinfo 116 | ||
130 | #define __NR_ipc 117 | ||
131 | #define __NR_fsync 118 | ||
132 | #define __NR_sigreturn 119 | ||
133 | #define __NR_clone 120 | ||
134 | #define __NR_setdomainname 121 | ||
135 | #define __NR_uname 122 | ||
136 | #define __NR_modify_ldt 123 | ||
137 | #define __NR_adjtimex 124 | ||
138 | #define __NR_mprotect 125 | ||
139 | #define __NR_sigprocmask 126 | ||
140 | #define __NR_create_module 127 | ||
141 | #define __NR_init_module 128 | ||
142 | #define __NR_delete_module 129 | ||
143 | #define __NR_get_kernel_syms 130 | ||
144 | #define __NR_quotactl 131 | ||
145 | #define __NR_getpgid 132 | ||
146 | #define __NR_fchdir 133 | ||
147 | #define __NR_bdflush 134 | ||
148 | #define __NR_sysfs 135 | ||
149 | #define __NR_personality 136 | ||
150 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
151 | #define __NR_setfsuid 138 | ||
152 | #define __NR_setfsgid 139 | ||
153 | #define __NR__llseek 140 | ||
154 | #define __NR_getdents 141 | ||
155 | #define __NR__newselect 142 | ||
156 | #define __NR_flock 143 | ||
157 | #define __NR_msync 144 | ||
158 | #define __NR_readv 145 | ||
159 | #define __NR_writev 146 | ||
160 | #define __NR_getsid 147 | ||
161 | #define __NR_fdatasync 148 | ||
162 | #define __NR__sysctl 149 | ||
163 | #define __NR_mlock 150 | ||
164 | #define __NR_munlock 151 | ||
165 | #define __NR_mlockall 152 | ||
166 | #define __NR_munlockall 153 | ||
167 | #define __NR_sched_setparam 154 | ||
168 | #define __NR_sched_getparam 155 | ||
169 | #define __NR_sched_setscheduler 156 | ||
170 | #define __NR_sched_getscheduler 157 | ||
171 | #define __NR_sched_yield 158 | ||
172 | #define __NR_sched_get_priority_max 159 | ||
173 | #define __NR_sched_get_priority_min 160 | ||
174 | #define __NR_sched_rr_get_interval 161 | ||
175 | #define __NR_nanosleep 162 | ||
176 | #define __NR_mremap 163 | ||
177 | #define __NR_setresuid 164 | ||
178 | #define __NR_getresuid 165 | ||
179 | #define __NR_query_module 166 | ||
180 | #define __NR_poll 167 | ||
181 | #define __NR_nfsservctl 168 | ||
182 | #define __NR_setresgid 169 | ||
183 | #define __NR_getresgid 170 | ||
184 | #define __NR_prctl 171 | ||
185 | #define __NR_rt_sigreturn 172 | ||
186 | #define __NR_rt_sigaction 173 | ||
187 | #define __NR_rt_sigprocmask 174 | ||
188 | #define __NR_rt_sigpending 175 | ||
189 | #define __NR_rt_sigtimedwait 176 | ||
190 | #define __NR_rt_sigqueueinfo 177 | ||
191 | #define __NR_rt_sigsuspend 178 | ||
192 | #define __NR_pread64 179 | ||
193 | #define __NR_pwrite64 180 | ||
194 | #define __NR_chown 181 | ||
195 | #define __NR_getcwd 182 | ||
196 | #define __NR_capget 183 | ||
197 | #define __NR_capset 184 | ||
198 | #define __NR_sigaltstack 185 | ||
199 | #define __NR_sendfile 186 | ||
200 | #define __NR_getpmsg 187 /* some people actually want streams */ | ||
201 | #define __NR_putpmsg 188 /* some people actually want streams */ | ||
202 | #define __NR_vfork 189 | ||
203 | #define __NR_ugetrlimit 190 /* SuS compliant getrlimit */ | ||
204 | #define __NR_readahead 191 | ||
205 | /* #define __NR_mmap2 192 32bit only */ | ||
206 | /* #define __NR_truncate64 193 32bit only */ | ||
207 | /* #define __NR_ftruncate64 194 32bit only */ | ||
208 | /* #define __NR_stat64 195 32bit only */ | ||
209 | /* #define __NR_lstat64 196 32bit only */ | ||
210 | /* #define __NR_fstat64 197 32bit only */ | ||
211 | #define __NR_pciconfig_read 198 | ||
212 | #define __NR_pciconfig_write 199 | ||
213 | #define __NR_pciconfig_iobase 200 | ||
214 | #define __NR_multiplexer 201 | ||
215 | #define __NR_getdents64 202 | ||
216 | #define __NR_pivot_root 203 | ||
217 | /* #define __NR_fcntl64 204 32bit only */ | ||
218 | #define __NR_madvise 205 | ||
219 | #define __NR_mincore 206 | ||
220 | #define __NR_gettid 207 | ||
221 | #define __NR_tkill 208 | ||
222 | #define __NR_setxattr 209 | ||
223 | #define __NR_lsetxattr 210 | ||
224 | #define __NR_fsetxattr 211 | ||
225 | #define __NR_getxattr 212 | ||
226 | #define __NR_lgetxattr 213 | ||
227 | #define __NR_fgetxattr 214 | ||
228 | #define __NR_listxattr 215 | ||
229 | #define __NR_llistxattr 216 | ||
230 | #define __NR_flistxattr 217 | ||
231 | #define __NR_removexattr 218 | ||
232 | #define __NR_lremovexattr 219 | ||
233 | #define __NR_fremovexattr 220 | ||
234 | #define __NR_futex 221 | ||
235 | #define __NR_sched_setaffinity 222 | ||
236 | #define __NR_sched_getaffinity 223 | ||
237 | /* 224 currently unused */ | ||
238 | #define __NR_tuxcall 225 | ||
239 | /* #define __NR_sendfile64 226 32bit only */ | ||
240 | #define __NR_io_setup 227 | ||
241 | #define __NR_io_destroy 228 | ||
242 | #define __NR_io_getevents 229 | ||
243 | #define __NR_io_submit 230 | ||
244 | #define __NR_io_cancel 231 | ||
245 | #define __NR_set_tid_address 232 | ||
246 | #define __NR_fadvise64 233 | ||
247 | #define __NR_exit_group 234 | ||
248 | #define __NR_lookup_dcookie 235 | ||
249 | #define __NR_epoll_create 236 | ||
250 | #define __NR_epoll_ctl 237 | ||
251 | #define __NR_epoll_wait 238 | ||
252 | #define __NR_remap_file_pages 239 | ||
253 | #define __NR_timer_create 240 | ||
254 | #define __NR_timer_settime 241 | ||
255 | #define __NR_timer_gettime 242 | ||
256 | #define __NR_timer_getoverrun 243 | ||
257 | #define __NR_timer_delete 244 | ||
258 | #define __NR_clock_settime 245 | ||
259 | #define __NR_clock_gettime 246 | ||
260 | #define __NR_clock_getres 247 | ||
261 | #define __NR_clock_nanosleep 248 | ||
262 | #define __NR_swapcontext 249 | ||
263 | #define __NR_tgkill 250 | ||
264 | #define __NR_utimes 251 | ||
265 | #define __NR_statfs64 252 | ||
266 | #define __NR_fstatfs64 253 | ||
267 | /* #define __NR_fadvise64_64 254 32bit only */ | ||
268 | #define __NR_rtas 255 | ||
269 | /* Number 256 is reserved for sys_debug_setcontext */ | ||
270 | /* Number 257 is reserved for vserver */ | ||
271 | /* Number 258 is reserved for new sys_remap_file_pages */ | ||
272 | #define __NR_mbind 259 | ||
273 | #define __NR_get_mempolicy 260 | ||
274 | #define __NR_set_mempolicy 261 | ||
275 | #define __NR_mq_open 262 | ||
276 | #define __NR_mq_unlink 263 | ||
277 | #define __NR_mq_timedsend 264 | ||
278 | #define __NR_mq_timedreceive 265 | ||
279 | #define __NR_mq_notify 266 | ||
280 | #define __NR_mq_getsetattr 267 | ||
281 | #define __NR_kexec_load 268 | ||
282 | #define __NR_add_key 269 | ||
283 | #define __NR_request_key 270 | ||
284 | #define __NR_keyctl 271 | ||
285 | #define __NR_waitid 272 | ||
286 | |||
287 | #define __NR_syscalls 273 | ||
288 | #ifdef __KERNEL__ | ||
289 | #define NR_syscalls __NR_syscalls | ||
290 | #endif | ||
291 | |||
292 | #ifndef __ASSEMBLY__ | ||
293 | |||
294 | /* On powerpc a system call basically clobbers the same registers like a | ||
295 | * function call, with the exception of LR (which is needed for the | ||
296 | * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal | ||
297 | * an error return status). | ||
298 | */ | ||
299 | |||
300 | #define __syscall_nr(nr, type, name, args...) \ | ||
301 | unsigned long __sc_ret, __sc_err; \ | ||
302 | { \ | ||
303 | register unsigned long __sc_0 __asm__ ("r0"); \ | ||
304 | register unsigned long __sc_3 __asm__ ("r3"); \ | ||
305 | register unsigned long __sc_4 __asm__ ("r4"); \ | ||
306 | register unsigned long __sc_5 __asm__ ("r5"); \ | ||
307 | register unsigned long __sc_6 __asm__ ("r6"); \ | ||
308 | register unsigned long __sc_7 __asm__ ("r7"); \ | ||
309 | register unsigned long __sc_8 __asm__ ("r8"); \ | ||
310 | \ | ||
311 | __sc_loadargs_##nr(name, args); \ | ||
312 | __asm__ __volatile__ \ | ||
313 | ("sc \n\t" \ | ||
314 | "mfcr %0 " \ | ||
315 | : "=&r" (__sc_0), \ | ||
316 | "=&r" (__sc_3), "=&r" (__sc_4), \ | ||
317 | "=&r" (__sc_5), "=&r" (__sc_6), \ | ||
318 | "=&r" (__sc_7), "=&r" (__sc_8) \ | ||
319 | : __sc_asm_input_##nr \ | ||
320 | : "cr0", "ctr", "memory", \ | ||
321 | "r9", "r10","r11", "r12"); \ | ||
322 | __sc_ret = __sc_3; \ | ||
323 | __sc_err = __sc_0; \ | ||
324 | } \ | ||
325 | if (__sc_err & 0x10000000) \ | ||
326 | { \ | ||
327 | errno = __sc_ret; \ | ||
328 | __sc_ret = -1; \ | ||
329 | } \ | ||
330 | return (type) __sc_ret | ||
331 | |||
332 | #define __sc_loadargs_0(name, dummy...) \ | ||
333 | __sc_0 = __NR_##name | ||
334 | #define __sc_loadargs_1(name, arg1) \ | ||
335 | __sc_loadargs_0(name); \ | ||
336 | __sc_3 = (unsigned long) (arg1) | ||
337 | #define __sc_loadargs_2(name, arg1, arg2) \ | ||
338 | __sc_loadargs_1(name, arg1); \ | ||
339 | __sc_4 = (unsigned long) (arg2) | ||
340 | #define __sc_loadargs_3(name, arg1, arg2, arg3) \ | ||
341 | __sc_loadargs_2(name, arg1, arg2); \ | ||
342 | __sc_5 = (unsigned long) (arg3) | ||
343 | #define __sc_loadargs_4(name, arg1, arg2, arg3, arg4) \ | ||
344 | __sc_loadargs_3(name, arg1, arg2, arg3); \ | ||
345 | __sc_6 = (unsigned long) (arg4) | ||
346 | #define __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5) \ | ||
347 | __sc_loadargs_4(name, arg1, arg2, arg3, arg4); \ | ||
348 | __sc_7 = (unsigned long) (arg5) | ||
349 | #define __sc_loadargs_6(name, arg1, arg2, arg3, arg4, arg5, arg6) \ | ||
350 | __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5); \ | ||
351 | __sc_8 = (unsigned long) (arg6) | ||
352 | |||
353 | #define __sc_asm_input_0 "0" (__sc_0) | ||
354 | #define __sc_asm_input_1 __sc_asm_input_0, "1" (__sc_3) | ||
355 | #define __sc_asm_input_2 __sc_asm_input_1, "2" (__sc_4) | ||
356 | #define __sc_asm_input_3 __sc_asm_input_2, "3" (__sc_5) | ||
357 | #define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6) | ||
358 | #define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7) | ||
359 | #define __sc_asm_input_6 __sc_asm_input_5, "6" (__sc_8) | ||
360 | |||
361 | #define _syscall0(type,name) \ | ||
362 | type name(void) \ | ||
363 | { \ | ||
364 | __syscall_nr(0, type, name); \ | ||
365 | } | ||
366 | |||
367 | #define _syscall1(type,name,type1,arg1) \ | ||
368 | type name(type1 arg1) \ | ||
369 | { \ | ||
370 | __syscall_nr(1, type, name, arg1); \ | ||
371 | } | ||
372 | |||
373 | #define _syscall2(type,name,type1,arg1,type2,arg2) \ | ||
374 | type name(type1 arg1, type2 arg2) \ | ||
375 | { \ | ||
376 | __syscall_nr(2, type, name, arg1, arg2); \ | ||
377 | } | ||
378 | |||
379 | #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ | ||
380 | type name(type1 arg1, type2 arg2, type3 arg3) \ | ||
381 | { \ | ||
382 | __syscall_nr(3, type, name, arg1, arg2, arg3); \ | ||
383 | } | ||
384 | |||
385 | #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ | ||
386 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ | ||
387 | { \ | ||
388 | __syscall_nr(4, type, name, arg1, arg2, arg3, arg4); \ | ||
389 | } | ||
390 | |||
391 | #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ | ||
392 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ | ||
393 | { \ | ||
394 | __syscall_nr(5, type, name, arg1, arg2, arg3, arg4, arg5); \ | ||
395 | } | ||
396 | #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ | ||
397 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ | ||
398 | { \ | ||
399 | __syscall_nr(6, type, name, arg1, arg2, arg3, arg4, arg5, arg6); \ | ||
400 | } | ||
401 | |||
402 | #ifdef __KERNEL_SYSCALLS__ | ||
403 | |||
404 | /* | ||
405 | * Forking from kernel space will result in the child getting a new, | ||
406 | * empty kernel stack area. Thus the child cannot access automatic | ||
407 | * variables set in the parent unless they are in registers, and the | ||
408 | * procedure where the fork was done cannot return to its caller in | ||
409 | * the child. | ||
410 | */ | ||
411 | |||
412 | /* | ||
413 | * System call prototypes. | ||
414 | */ | ||
415 | static inline _syscall3(int, execve, __const__ char *, file, char **, argv, | ||
416 | char **,envp) | ||
417 | |||
418 | #endif /* __KERNEL_SYSCALLS__ */ | ||
419 | |||
420 | #ifdef __KERNEL__ | ||
421 | |||
422 | #include <linux/types.h> | ||
423 | #include <linux/compiler.h> | ||
424 | #include <linux/linkage.h> | ||
425 | |||
426 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
427 | #define __ARCH_WANT_OLD_READDIR | ||
428 | #define __ARCH_WANT_STAT64 | ||
429 | #define __ARCH_WANT_SYS_ALARM | ||
430 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
431 | #define __ARCH_WANT_SYS_PAUSE | ||
432 | #define __ARCH_WANT_SYS_SGETMASK | ||
433 | #define __ARCH_WANT_SYS_SIGNAL | ||
434 | #define __ARCH_WANT_SYS_TIME | ||
435 | #define __ARCH_WANT_COMPAT_SYS_TIME | ||
436 | #define __ARCH_WANT_SYS_UTIME | ||
437 | #define __ARCH_WANT_SYS_WAITPID | ||
438 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
439 | #define __ARCH_WANT_SYS_FADVISE64 | ||
440 | #define __ARCH_WANT_SYS_GETPGRP | ||
441 | #define __ARCH_WANT_SYS_LLSEEK | ||
442 | #define __ARCH_WANT_SYS_NICE | ||
443 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
444 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
445 | #define __ARCH_WANT_SYS_SIGPENDING | ||
446 | #define __ARCH_WANT_SYS_SIGPROCMASK | ||
447 | #define __ARCH_WANT_SYS_RT_SIGACTION | ||
448 | |||
449 | unsigned long sys_mmap(unsigned long addr, size_t len, unsigned long prot, | ||
450 | unsigned long flags, unsigned long fd, off_t offset); | ||
451 | struct pt_regs; | ||
452 | int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, | ||
453 | unsigned long a3, unsigned long a4, unsigned long a5, | ||
454 | struct pt_regs *regs); | ||
455 | int sys_clone(unsigned long clone_flags, unsigned long p2, unsigned long p3, | ||
456 | unsigned long p4, unsigned long p5, unsigned long p6, | ||
457 | struct pt_regs *regs); | ||
458 | int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3, | ||
459 | unsigned long p4, unsigned long p5, unsigned long p6, | ||
460 | struct pt_regs *regs); | ||
461 | int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3, | ||
462 | unsigned long p4, unsigned long p5, unsigned long p6, | ||
463 | struct pt_regs *regs); | ||
464 | int sys_pipe(int __user *fildes); | ||
465 | int sys_ptrace(long request, long pid, long addr, long data); | ||
466 | struct sigaction; | ||
467 | long sys_rt_sigaction(int sig, const struct sigaction __user *act, | ||
468 | struct sigaction __user *oact, size_t sigsetsize); | ||
469 | |||
470 | /* | ||
471 | * "Conditional" syscalls | ||
472 | * | ||
473 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
474 | * but it doesn't work on all toolchains, so we just do it by hand | ||
475 | */ | ||
476 | #define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_syscall") | ||
477 | |||
478 | #endif /* __KERNEL__ */ | ||
479 | |||
480 | #endif /* __ASSEMBLY__ */ | ||
481 | |||
482 | #endif /* _ASM_PPC_UNISTD_H_ */ | ||
diff --git a/include/asm-ppc64/user.h b/include/asm-ppc64/user.h new file mode 100644 index 000000000000..d7d6554a421f --- /dev/null +++ b/include/asm-ppc64/user.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef _PPC_USER_H | ||
2 | #define _PPC_USER_H | ||
3 | |||
4 | /* Adapted from <asm-alpha/user.h> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <asm/ptrace.h> | ||
13 | #include <asm/page.h> | ||
14 | |||
15 | /* | ||
16 | * Core file format: The core file is written in such a way that gdb | ||
17 | * can understand it and provide useful information to the user (under | ||
18 | * linux we use the `trad-core' bfd, NOT the osf-core). The file contents | ||
19 | * are as follows: | ||
20 | * | ||
21 | * upage: 1 page consisting of a user struct that tells gdb | ||
22 | * what is present in the file. Directly after this is a | ||
23 | * copy of the task_struct, which is currently not used by gdb, | ||
24 | * but it may come in handy at some point. All of the registers | ||
25 | * are stored as part of the upage. The upage should always be | ||
26 | * only one page long. | ||
27 | * data: The data segment follows next. We use current->end_text to | ||
28 | * current->brk to pick up all of the user variables, plus any memory | ||
29 | * that may have been sbrk'ed. No attempt is made to determine if a | ||
30 | * page is demand-zero or if a page is totally unused, we just cover | ||
31 | * the entire range. All of the addresses are rounded in such a way | ||
32 | * that an integral number of pages is written. | ||
33 | * stack: We need the stack information in order to get a meaningful | ||
34 | * backtrace. We need to write the data from usp to | ||
35 | * current->start_stack, so we round each of these in order to be able | ||
36 | * to write an integer number of pages. | ||
37 | */ | ||
38 | struct user { | ||
39 | struct pt_regs regs; /* entire machine state */ | ||
40 | size_t u_tsize; /* text size (pages) */ | ||
41 | size_t u_dsize; /* data size (pages) */ | ||
42 | size_t u_ssize; /* stack size (pages) */ | ||
43 | unsigned long start_code; /* text starting address */ | ||
44 | unsigned long start_data; /* data starting address */ | ||
45 | unsigned long start_stack; /* stack starting address */ | ||
46 | long int signal; /* signal causing core dump */ | ||
47 | struct regs * u_ar0; /* help gdb find registers */ | ||
48 | unsigned long magic; /* identifies a core file */ | ||
49 | char u_comm[32]; /* user command name */ | ||
50 | }; | ||
51 | |||
52 | #define NBPG PAGE_SIZE | ||
53 | #define UPAGES 1 | ||
54 | #define HOST_TEXT_START_ADDR (u.start_code) | ||
55 | #define HOST_DATA_START_ADDR (u.start_data) | ||
56 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | ||
57 | |||
58 | #endif /* _PPC_USER_H */ | ||
diff --git a/include/asm-ppc64/vdso.h b/include/asm-ppc64/vdso.h new file mode 100644 index 000000000000..b74e16c0cf01 --- /dev/null +++ b/include/asm-ppc64/vdso.h | |||
@@ -0,0 +1,83 @@ | |||
1 | #ifndef __PPC64_VDSO_H__ | ||
2 | #define __PPC64_VDSO_H__ | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | /* Default link addresses for the vDSOs */ | ||
7 | #define VDSO32_LBASE 0 | ||
8 | #define VDSO64_LBASE 0 | ||
9 | |||
10 | /* Default map addresses */ | ||
11 | #define VDSO32_MBASE 0x100000 | ||
12 | #define VDSO64_MBASE 0x100000 | ||
13 | |||
14 | #define VDSO_VERSION_STRING LINUX_2.6.12 | ||
15 | |||
16 | /* Define if 64 bits VDSO has procedure descriptors */ | ||
17 | #undef VDS64_HAS_DESCRIPTORS | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | ||
20 | |||
21 | extern unsigned int vdso64_pages; | ||
22 | extern unsigned int vdso32_pages; | ||
23 | |||
24 | /* Offsets relative to thread->vdso_base */ | ||
25 | extern unsigned long vdso64_rt_sigtramp; | ||
26 | extern unsigned long vdso32_sigtramp; | ||
27 | extern unsigned long vdso32_rt_sigtramp; | ||
28 | |||
29 | extern void vdso_init(void); | ||
30 | |||
31 | #else /* __ASSEMBLY__ */ | ||
32 | |||
33 | #ifdef __VDSO64__ | ||
34 | #ifdef VDS64_HAS_DESCRIPTORS | ||
35 | #define V_FUNCTION_BEGIN(name) \ | ||
36 | .globl name; \ | ||
37 | .section ".opd","a"; \ | ||
38 | .align 3; \ | ||
39 | name: \ | ||
40 | .quad .name,.TOC.@tocbase,0; \ | ||
41 | .previous; \ | ||
42 | .globl .name; \ | ||
43 | .type .name,@function; \ | ||
44 | .name: \ | ||
45 | |||
46 | #define V_FUNCTION_END(name) \ | ||
47 | .size .name,.-.name; | ||
48 | |||
49 | #define V_LOCAL_FUNC(name) (.name) | ||
50 | |||
51 | #else /* VDS64_HAS_DESCRIPTORS */ | ||
52 | |||
53 | #define V_FUNCTION_BEGIN(name) \ | ||
54 | .globl name; \ | ||
55 | name: \ | ||
56 | |||
57 | #define V_FUNCTION_END(name) \ | ||
58 | .size name,.-name; | ||
59 | |||
60 | #define V_LOCAL_FUNC(name) (name) | ||
61 | |||
62 | #endif /* VDS64_HAS_DESCRIPTORS */ | ||
63 | #endif /* __VDSO64__ */ | ||
64 | |||
65 | #ifdef __VDSO32__ | ||
66 | |||
67 | #define V_FUNCTION_BEGIN(name) \ | ||
68 | .globl name; \ | ||
69 | .type name,@function; \ | ||
70 | name: \ | ||
71 | |||
72 | #define V_FUNCTION_END(name) \ | ||
73 | .size name,.-name; | ||
74 | |||
75 | #define V_LOCAL_FUNC(name) (name) | ||
76 | |||
77 | #endif /* __VDSO32__ */ | ||
78 | |||
79 | #endif /* __ASSEMBLY__ */ | ||
80 | |||
81 | #endif /* __KERNEL__ */ | ||
82 | |||
83 | #endif /* __PPC64_VDSO_H__ */ | ||
diff --git a/include/asm-ppc64/vga.h b/include/asm-ppc64/vga.h new file mode 100644 index 000000000000..c09849743f45 --- /dev/null +++ b/include/asm-ppc64/vga.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Access to VGA videoram | ||
3 | * | ||
4 | * (c) 1998 Martin Mares <mj@ucw.cz> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_ASM_VGA_H_ | ||
13 | #define _LINUX_ASM_VGA_H_ | ||
14 | |||
15 | #include <asm/io.h> | ||
16 | |||
17 | #include <linux/config.h> | ||
18 | |||
19 | #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE) | ||
20 | |||
21 | #define VT_BUF_HAVE_RW | ||
22 | /* | ||
23 | * These are only needed for supporting VGA or MDA text mode, which use little | ||
24 | * endian byte ordering. | ||
25 | * In other cases, we can optimize by using native byte ordering and | ||
26 | * <linux/vt_buffer.h> has already done the right job for us. | ||
27 | */ | ||
28 | |||
29 | static inline void scr_writew(u16 val, volatile u16 *addr) | ||
30 | { | ||
31 | st_le16(addr, val); | ||
32 | } | ||
33 | |||
34 | static inline u16 scr_readw(volatile const u16 *addr) | ||
35 | { | ||
36 | return ld_le16(addr); | ||
37 | } | ||
38 | |||
39 | #define VT_BUF_HAVE_MEMCPYW | ||
40 | #define scr_memcpyw memcpy | ||
41 | |||
42 | #endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */ | ||
43 | |||
44 | extern unsigned long vgacon_remap_base; | ||
45 | #define VGA_MAP_MEM(x) ((unsigned long) ioremap((x), 0)) | ||
46 | |||
47 | #define vga_readb(x) (*(x)) | ||
48 | #define vga_writeb(x,y) (*(y) = (x)) | ||
49 | |||
50 | #endif | ||
diff --git a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h new file mode 100644 index 000000000000..20cd98ee6337 --- /dev/null +++ b/include/asm-ppc64/vio.h | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * IBM PowerPC Virtual I/O Infrastructure Support. | ||
3 | * | ||
4 | * Copyright (c) 2003 IBM Corp. | ||
5 | * Dave Engebretsen engebret@us.ibm.com | ||
6 | * Santiago Leon santil@us.ibm.com | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #ifndef _ASM_VIO_H | ||
15 | #define _ASM_VIO_H | ||
16 | |||
17 | #include <linux/config.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/errno.h> | ||
20 | #include <linux/device.h> | ||
21 | #include <linux/dma-mapping.h> | ||
22 | #include <asm/hvcall.h> | ||
23 | #include <asm/prom.h> | ||
24 | #include <asm/scatterlist.h> | ||
25 | /* | ||
26 | * Architecture-specific constants for drivers to | ||
27 | * extract attributes of the device using vio_get_attribute() | ||
28 | */ | ||
29 | #define VETH_MAC_ADDR "local-mac-address" | ||
30 | #define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters" | ||
31 | |||
32 | /* End architecture-specific constants */ | ||
33 | |||
34 | #define h_vio_signal(ua, mode) \ | ||
35 | plpar_hcall_norets(H_VIO_SIGNAL, ua, mode) | ||
36 | |||
37 | #define VIO_IRQ_DISABLE 0UL | ||
38 | #define VIO_IRQ_ENABLE 1UL | ||
39 | |||
40 | struct vio_dev; | ||
41 | struct vio_driver; | ||
42 | struct vio_device_id; | ||
43 | struct iommu_table; | ||
44 | |||
45 | int vio_register_driver(struct vio_driver *drv); | ||
46 | void vio_unregister_driver(struct vio_driver *drv); | ||
47 | |||
48 | #ifdef CONFIG_PPC_PSERIES | ||
49 | struct vio_dev * __devinit vio_register_device_node( | ||
50 | struct device_node *node_vdev); | ||
51 | #endif | ||
52 | void __devinit vio_unregister_device(struct vio_dev *dev); | ||
53 | struct vio_dev *vio_find_node(struct device_node *vnode); | ||
54 | |||
55 | const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length); | ||
56 | int vio_get_irq(struct vio_dev *dev); | ||
57 | int vio_enable_interrupts(struct vio_dev *dev); | ||
58 | int vio_disable_interrupts(struct vio_dev *dev); | ||
59 | |||
60 | extern struct dma_mapping_ops vio_dma_ops; | ||
61 | |||
62 | extern struct bus_type vio_bus_type; | ||
63 | |||
64 | struct vio_device_id { | ||
65 | char *type; | ||
66 | char *compat; | ||
67 | }; | ||
68 | |||
69 | struct vio_driver { | ||
70 | struct list_head node; | ||
71 | char *name; | ||
72 | const struct vio_device_id *id_table; /* NULL if wants all devices */ | ||
73 | int (*probe) (struct vio_dev *dev, const struct vio_device_id *id); /* New device inserted */ | ||
74 | int (*remove) (struct vio_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ | ||
75 | unsigned long driver_data; | ||
76 | |||
77 | struct device_driver driver; | ||
78 | }; | ||
79 | |||
80 | static inline struct vio_driver *to_vio_driver(struct device_driver *drv) | ||
81 | { | ||
82 | return container_of(drv, struct vio_driver, driver); | ||
83 | } | ||
84 | |||
85 | /* | ||
86 | * The vio_dev structure is used to describe virtual I/O devices. | ||
87 | */ | ||
88 | struct vio_dev { | ||
89 | struct iommu_table *iommu_table; /* vio_map_* uses this */ | ||
90 | char *name; | ||
91 | char *type; | ||
92 | uint32_t unit_address; | ||
93 | unsigned int irq; | ||
94 | |||
95 | struct device dev; | ||
96 | }; | ||
97 | |||
98 | static inline struct vio_dev *to_vio_dev(struct device *dev) | ||
99 | { | ||
100 | return container_of(dev, struct vio_dev, dev); | ||
101 | } | ||
102 | |||
103 | #endif /* _ASM_VIO_H */ | ||
diff --git a/include/asm-ppc64/xics.h b/include/asm-ppc64/xics.h new file mode 100644 index 000000000000..0027da4364ac --- /dev/null +++ b/include/asm-ppc64/xics.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * arch/ppc64/kernel/xics.h | ||
3 | * | ||
4 | * Copyright 2000 IBM Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _PPC64_KERNEL_XICS_H | ||
13 | #define _PPC64_KERNEL_XICS_H | ||
14 | |||
15 | #include <linux/cache.h> | ||
16 | |||
17 | void xics_init_IRQ(void); | ||
18 | int xics_get_irq(struct pt_regs *); | ||
19 | void xics_setup_cpu(void); | ||
20 | void xics_cause_IPI(int cpu); | ||
21 | void xics_request_IPIs(void); | ||
22 | void xics_migrate_irqs_away(void); | ||
23 | |||
24 | /* first argument is ignored for now*/ | ||
25 | void pSeriesLP_cppr_info(int n_cpu, u8 value); | ||
26 | |||
27 | struct xics_ipi_struct { | ||
28 | volatile unsigned long value; | ||
29 | } ____cacheline_aligned; | ||
30 | |||
31 | extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; | ||
32 | |||
33 | extern unsigned int default_distrib_server; | ||
34 | extern unsigned int interrupt_server_size; | ||
35 | |||
36 | #endif /* _PPC64_KERNEL_XICS_H */ | ||
diff --git a/include/asm-ppc64/xor.h b/include/asm-ppc64/xor.h new file mode 100644 index 000000000000..c82eb12a5b18 --- /dev/null +++ b/include/asm-ppc64/xor.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/xor.h> | |||