diff options
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r-- | include/asm-powerpc/btext.h | 27 | ||||
-rw-r--r-- | include/asm-powerpc/delay.h | 55 | ||||
-rw-r--r-- | include/asm-powerpc/eeh.h | 364 | ||||
-rw-r--r-- | include/asm-powerpc/floppy.h | 105 | ||||
-rw-r--r-- | include/asm-powerpc/hvconsole.h | 49 | ||||
-rw-r--r-- | include/asm-powerpc/hvcserver.h | 57 | ||||
-rw-r--r-- | include/asm-powerpc/kexec.h | 1 | ||||
-rw-r--r-- | include/asm-powerpc/machdep.h | 4 | ||||
-rw-r--r-- | include/asm-powerpc/nvram.h | 119 | ||||
-rw-r--r-- | include/asm-powerpc/page.h | 179 | ||||
-rw-r--r-- | include/asm-powerpc/page_32.h | 40 | ||||
-rw-r--r-- | include/asm-powerpc/page_64.h | 174 | ||||
-rw-r--r-- | include/asm-powerpc/serial.h | 18 | ||||
-rw-r--r-- | include/asm-powerpc/vdso_datapage.h | 2 |
14 files changed, 1192 insertions, 2 deletions
diff --git a/include/asm-powerpc/btext.h b/include/asm-powerpc/btext.h new file mode 100644 index 00000000000..71cce36bc63 --- /dev/null +++ b/include/asm-powerpc/btext.h | |||
@@ -0,0 +1,27 @@ | |||
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 init_boot_display(void); | ||
19 | extern void btext_update_display(unsigned long phys, int width, int height, | ||
20 | int depth, int pitch); | ||
21 | |||
22 | extern void btext_drawchar(char c); | ||
23 | extern void btext_drawstring(const char *str); | ||
24 | extern void btext_drawhex(unsigned long v); | ||
25 | |||
26 | #endif /* __KERNEL__ */ | ||
27 | #endif /* __PPC_BTEXT_H */ | ||
diff --git a/include/asm-powerpc/delay.h b/include/asm-powerpc/delay.h new file mode 100644 index 00000000000..1492aa9ab71 --- /dev/null +++ b/include/asm-powerpc/delay.h | |||
@@ -0,0 +1,55 @@ | |||
1 | #ifndef _ASM_POWERPC_DELAY_H | ||
2 | #define _ASM_POWERPC_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 | #ifdef CONFIG_PPC64 | ||
19 | /* define these here to prevent circular dependencies */ | ||
20 | /* these instructions control the thread priority on multi-threaded cpus */ | ||
21 | #define __HMT_low() asm volatile("or 1,1,1") | ||
22 | #define __HMT_medium() asm volatile("or 2,2,2") | ||
23 | #else | ||
24 | #define __HMT_low() | ||
25 | #define __HMT_medium() | ||
26 | #endif | ||
27 | |||
28 | #define __barrier() asm volatile("" ::: "memory") | ||
29 | |||
30 | static inline unsigned long __get_tb(void) | ||
31 | { | ||
32 | unsigned long rval; | ||
33 | |||
34 | asm volatile("mftb %0" : "=r" (rval)); | ||
35 | return rval; | ||
36 | } | ||
37 | |||
38 | static inline void __delay(unsigned long loops) | ||
39 | { | ||
40 | unsigned long start = __get_tb(); | ||
41 | |||
42 | while((__get_tb() - start) < loops) | ||
43 | __HMT_low(); | ||
44 | __HMT_medium(); | ||
45 | __barrier(); | ||
46 | } | ||
47 | |||
48 | static inline void udelay(unsigned long usecs) | ||
49 | { | ||
50 | unsigned long loops = tb_ticks_per_usec * usecs; | ||
51 | |||
52 | __delay(loops); | ||
53 | } | ||
54 | |||
55 | #endif /* _ASM_POWERPC_DELAY_H */ | ||
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h new file mode 100644 index 00000000000..89f26ab3190 --- /dev/null +++ b/include/asm-powerpc/eeh.h | |||
@@ -0,0 +1,364 @@ | |||
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 | |||
31 | #ifdef CONFIG_EEH | ||
32 | |||
33 | /* Values for eeh_mode bits in device_node */ | ||
34 | #define EEH_MODE_SUPPORTED (1<<0) | ||
35 | #define EEH_MODE_NOCHECK (1<<1) | ||
36 | #define EEH_MODE_ISOLATED (1<<2) | ||
37 | |||
38 | /* Max number of EEH freezes allowed before we consider the device | ||
39 | * to be permanently disabled. */ | ||
40 | #define EEH_MAX_ALLOWED_FREEZES 5 | ||
41 | |||
42 | void __init eeh_init(void); | ||
43 | unsigned long eeh_check_failure(const volatile void __iomem *token, | ||
44 | unsigned long val); | ||
45 | int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev); | ||
46 | void __init pci_addr_cache_build(void); | ||
47 | |||
48 | /** | ||
49 | * eeh_add_device_early | ||
50 | * eeh_add_device_late | ||
51 | * | ||
52 | * Perform eeh initialization for devices added after boot. | ||
53 | * Call eeh_add_device_early before doing any i/o to the | ||
54 | * device (including config space i/o). Call eeh_add_device_late | ||
55 | * to finish the eeh setup for this device. | ||
56 | */ | ||
57 | void eeh_add_device_early(struct device_node *); | ||
58 | void eeh_add_device_late(struct pci_dev *); | ||
59 | |||
60 | /** | ||
61 | * eeh_remove_device - undo EEH setup for the indicated pci device | ||
62 | * @dev: pci device to be removed | ||
63 | * | ||
64 | * This routine should be called when a device is removed from | ||
65 | * a running system (e.g. by hotplug or dlpar). It unregisters | ||
66 | * the PCI device from the EEH subsystem. I/O errors affecting | ||
67 | * this device will no longer be detected after this call; thus, | ||
68 | * i/o errors affecting this slot may leave this device unusable. | ||
69 | */ | ||
70 | void eeh_remove_device(struct pci_dev *); | ||
71 | |||
72 | /** | ||
73 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. | ||
74 | * | ||
75 | * If this macro yields TRUE, the caller relays to eeh_check_failure() | ||
76 | * which does further tests out of line. | ||
77 | */ | ||
78 | #define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0) | ||
79 | |||
80 | /* | ||
81 | * Reads from a device which has been isolated by EEH will return | ||
82 | * all 1s. This macro gives an all-1s value of the given size (in | ||
83 | * bytes: 1, 2, or 4) for comparing with the result of a read. | ||
84 | */ | ||
85 | #define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8)) | ||
86 | |||
87 | #else /* !CONFIG_EEH */ | ||
88 | static inline void eeh_init(void) { } | ||
89 | |||
90 | static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) | ||
91 | { | ||
92 | return val; | ||
93 | } | ||
94 | |||
95 | static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) | ||
96 | { | ||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static inline void pci_addr_cache_build(void) { } | ||
101 | |||
102 | static inline void eeh_add_device_early(struct device_node *dn) { } | ||
103 | |||
104 | static inline void eeh_add_device_late(struct pci_dev *dev) { } | ||
105 | |||
106 | static inline void eeh_remove_device(struct pci_dev *dev) { } | ||
107 | |||
108 | #define EEH_POSSIBLE_ERROR(val, type) (0) | ||
109 | #define EEH_IO_ERROR_VALUE(size) (-1UL) | ||
110 | #endif /* CONFIG_EEH */ | ||
111 | |||
112 | /* | ||
113 | * MMIO read/write operations with EEH support. | ||
114 | */ | ||
115 | static inline u8 eeh_readb(const volatile void __iomem *addr) | ||
116 | { | ||
117 | u8 val = in_8(addr); | ||
118 | if (EEH_POSSIBLE_ERROR(val, u8)) | ||
119 | return eeh_check_failure(addr, val); | ||
120 | return val; | ||
121 | } | ||
122 | static inline void eeh_writeb(u8 val, volatile void __iomem *addr) | ||
123 | { | ||
124 | out_8(addr, val); | ||
125 | } | ||
126 | |||
127 | static inline u16 eeh_readw(const volatile void __iomem *addr) | ||
128 | { | ||
129 | u16 val = in_le16(addr); | ||
130 | if (EEH_POSSIBLE_ERROR(val, u16)) | ||
131 | return eeh_check_failure(addr, val); | ||
132 | return val; | ||
133 | } | ||
134 | static inline void eeh_writew(u16 val, volatile void __iomem *addr) | ||
135 | { | ||
136 | out_le16(addr, val); | ||
137 | } | ||
138 | static inline u16 eeh_raw_readw(const volatile void __iomem *addr) | ||
139 | { | ||
140 | u16 val = in_be16(addr); | ||
141 | if (EEH_POSSIBLE_ERROR(val, u16)) | ||
142 | return eeh_check_failure(addr, val); | ||
143 | return val; | ||
144 | } | ||
145 | static inline void eeh_raw_writew(u16 val, volatile void __iomem *addr) { | ||
146 | volatile u16 __iomem *vaddr = (volatile u16 __iomem *) addr; | ||
147 | out_be16(vaddr, val); | ||
148 | } | ||
149 | |||
150 | static inline u32 eeh_readl(const volatile void __iomem *addr) | ||
151 | { | ||
152 | u32 val = in_le32(addr); | ||
153 | if (EEH_POSSIBLE_ERROR(val, u32)) | ||
154 | return eeh_check_failure(addr, val); | ||
155 | return val; | ||
156 | } | ||
157 | static inline void eeh_writel(u32 val, volatile void __iomem *addr) | ||
158 | { | ||
159 | out_le32(addr, val); | ||
160 | } | ||
161 | static inline u32 eeh_raw_readl(const volatile void __iomem *addr) | ||
162 | { | ||
163 | u32 val = in_be32(addr); | ||
164 | if (EEH_POSSIBLE_ERROR(val, u32)) | ||
165 | return eeh_check_failure(addr, val); | ||
166 | return val; | ||
167 | } | ||
168 | static inline void eeh_raw_writel(u32 val, volatile void __iomem *addr) | ||
169 | { | ||
170 | out_be32(addr, val); | ||
171 | } | ||
172 | |||
173 | static inline u64 eeh_readq(const volatile void __iomem *addr) | ||
174 | { | ||
175 | u64 val = in_le64(addr); | ||
176 | if (EEH_POSSIBLE_ERROR(val, u64)) | ||
177 | return eeh_check_failure(addr, val); | ||
178 | return val; | ||
179 | } | ||
180 | static inline void eeh_writeq(u64 val, volatile void __iomem *addr) | ||
181 | { | ||
182 | out_le64(addr, val); | ||
183 | } | ||
184 | static inline u64 eeh_raw_readq(const volatile void __iomem *addr) | ||
185 | { | ||
186 | u64 val = in_be64(addr); | ||
187 | if (EEH_POSSIBLE_ERROR(val, u64)) | ||
188 | return eeh_check_failure(addr, val); | ||
189 | return val; | ||
190 | } | ||
191 | static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr) | ||
192 | { | ||
193 | out_be64(addr, val); | ||
194 | } | ||
195 | |||
196 | #define EEH_CHECK_ALIGN(v,a) \ | ||
197 | ((((unsigned long)(v)) & ((a) - 1)) == 0) | ||
198 | |||
199 | static inline void eeh_memset_io(volatile void __iomem *addr, int c, | ||
200 | unsigned long n) | ||
201 | { | ||
202 | void *p = (void __force *)addr; | ||
203 | u32 lc = c; | ||
204 | lc |= lc << 8; | ||
205 | lc |= lc << 16; | ||
206 | |||
207 | while(n && !EEH_CHECK_ALIGN(p, 4)) { | ||
208 | *((volatile u8 *)p) = c; | ||
209 | p++; | ||
210 | n--; | ||
211 | } | ||
212 | while(n >= 4) { | ||
213 | *((volatile u32 *)p) = lc; | ||
214 | p += 4; | ||
215 | n -= 4; | ||
216 | } | ||
217 | while(n) { | ||
218 | *((volatile u8 *)p) = c; | ||
219 | p++; | ||
220 | n--; | ||
221 | } | ||
222 | __asm__ __volatile__ ("sync" : : : "memory"); | ||
223 | } | ||
224 | static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *src, | ||
225 | unsigned long n) | ||
226 | { | ||
227 | void *vsrc = (void __force *) src; | ||
228 | void *destsave = dest; | ||
229 | unsigned long nsave = n; | ||
230 | |||
231 | while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { | ||
232 | *((u8 *)dest) = *((volatile u8 *)vsrc); | ||
233 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
234 | vsrc++; | ||
235 | dest++; | ||
236 | n--; | ||
237 | } | ||
238 | while(n > 4) { | ||
239 | *((u32 *)dest) = *((volatile u32 *)vsrc); | ||
240 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
241 | vsrc += 4; | ||
242 | dest += 4; | ||
243 | n -= 4; | ||
244 | } | ||
245 | while(n) { | ||
246 | *((u8 *)dest) = *((volatile u8 *)vsrc); | ||
247 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
248 | vsrc++; | ||
249 | dest++; | ||
250 | n--; | ||
251 | } | ||
252 | __asm__ __volatile__ ("sync" : : : "memory"); | ||
253 | |||
254 | /* Look for ffff's here at dest[n]. Assume that at least 4 bytes | ||
255 | * were copied. Check all four bytes. | ||
256 | */ | ||
257 | if ((nsave >= 4) && | ||
258 | (EEH_POSSIBLE_ERROR((*((u32 *) destsave+nsave-4)), u32))) { | ||
259 | eeh_check_failure(src, (*((u32 *) destsave+nsave-4))); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src, | ||
264 | unsigned long n) | ||
265 | { | ||
266 | void *vdest = (void __force *) dest; | ||
267 | |||
268 | while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { | ||
269 | *((volatile u8 *)vdest) = *((u8 *)src); | ||
270 | src++; | ||
271 | vdest++; | ||
272 | n--; | ||
273 | } | ||
274 | while(n > 4) { | ||
275 | *((volatile u32 *)vdest) = *((volatile u32 *)src); | ||
276 | src += 4; | ||
277 | vdest += 4; | ||
278 | n-=4; | ||
279 | } | ||
280 | while(n) { | ||
281 | *((volatile u8 *)vdest) = *((u8 *)src); | ||
282 | src++; | ||
283 | vdest++; | ||
284 | n--; | ||
285 | } | ||
286 | __asm__ __volatile__ ("sync" : : : "memory"); | ||
287 | } | ||
288 | |||
289 | #undef EEH_CHECK_ALIGN | ||
290 | |||
291 | static inline u8 eeh_inb(unsigned long port) | ||
292 | { | ||
293 | u8 val; | ||
294 | if (!_IO_IS_VALID(port)) | ||
295 | return ~0; | ||
296 | val = in_8((u8 __iomem *)(port+pci_io_base)); | ||
297 | if (EEH_POSSIBLE_ERROR(val, u8)) | ||
298 | return eeh_check_failure((void __iomem *)(port), val); | ||
299 | return val; | ||
300 | } | ||
301 | |||
302 | static inline void eeh_outb(u8 val, unsigned long port) | ||
303 | { | ||
304 | if (_IO_IS_VALID(port)) | ||
305 | out_8((u8 __iomem *)(port+pci_io_base), val); | ||
306 | } | ||
307 | |||
308 | static inline u16 eeh_inw(unsigned long port) | ||
309 | { | ||
310 | u16 val; | ||
311 | if (!_IO_IS_VALID(port)) | ||
312 | return ~0; | ||
313 | val = in_le16((u16 __iomem *)(port+pci_io_base)); | ||
314 | if (EEH_POSSIBLE_ERROR(val, u16)) | ||
315 | return eeh_check_failure((void __iomem *)(port), val); | ||
316 | return val; | ||
317 | } | ||
318 | |||
319 | static inline void eeh_outw(u16 val, unsigned long port) | ||
320 | { | ||
321 | if (_IO_IS_VALID(port)) | ||
322 | out_le16((u16 __iomem *)(port+pci_io_base), val); | ||
323 | } | ||
324 | |||
325 | static inline u32 eeh_inl(unsigned long port) | ||
326 | { | ||
327 | u32 val; | ||
328 | if (!_IO_IS_VALID(port)) | ||
329 | return ~0; | ||
330 | val = in_le32((u32 __iomem *)(port+pci_io_base)); | ||
331 | if (EEH_POSSIBLE_ERROR(val, u32)) | ||
332 | return eeh_check_failure((void __iomem *)(port), val); | ||
333 | return val; | ||
334 | } | ||
335 | |||
336 | static inline void eeh_outl(u32 val, unsigned long port) | ||
337 | { | ||
338 | if (_IO_IS_VALID(port)) | ||
339 | out_le32((u32 __iomem *)(port+pci_io_base), val); | ||
340 | } | ||
341 | |||
342 | /* in-string eeh macros */ | ||
343 | static inline void eeh_insb(unsigned long port, void * buf, int ns) | ||
344 | { | ||
345 | _insb((u8 __iomem *)(port+pci_io_base), buf, ns); | ||
346 | if (EEH_POSSIBLE_ERROR((*(((u8*)buf)+ns-1)), u8)) | ||
347 | eeh_check_failure((void __iomem *)(port), *(u8*)buf); | ||
348 | } | ||
349 | |||
350 | static inline void eeh_insw_ns(unsigned long port, void * buf, int ns) | ||
351 | { | ||
352 | _insw_ns((u16 __iomem *)(port+pci_io_base), buf, ns); | ||
353 | if (EEH_POSSIBLE_ERROR((*(((u16*)buf)+ns-1)), u16)) | ||
354 | eeh_check_failure((void __iomem *)(port), *(u16*)buf); | ||
355 | } | ||
356 | |||
357 | static inline void eeh_insl_ns(unsigned long port, void * buf, int nl) | ||
358 | { | ||
359 | _insl_ns((u32 __iomem *)(port+pci_io_base), buf, nl); | ||
360 | if (EEH_POSSIBLE_ERROR((*(((u32*)buf)+nl-1)), u32)) | ||
361 | eeh_check_failure((void __iomem *)(port), *(u32*)buf); | ||
362 | } | ||
363 | |||
364 | #endif /* _PPC64_EEH_H */ | ||
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h new file mode 100644 index 00000000000..64276a3f615 --- /dev/null +++ b/include/asm-powerpc/floppy.h | |||
@@ -0,0 +1,105 @@ | |||
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_POWERPC_FLOPPY_H | ||
11 | #define __ASM_POWERPC_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) powerpc_fd_dma_setup(addr,size,mode,io) | ||
39 | |||
40 | static __inline__ int powerpc_fd_dma_setup(char *addr, unsigned long size, | ||
41 | 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 | /* remember this one as prev */ | ||
62 | prev_addr = addr; | ||
63 | prev_size = size; | ||
64 | prev_dir = dir; | ||
65 | |||
66 | fd_clear_dma_ff(); | ||
67 | fd_cacheflush(addr, size); | ||
68 | fd_set_dma_mode(mode); | ||
69 | set_dma_addr(FLOPPY_DMA, bus_addr); | ||
70 | fd_set_dma_count(size); | ||
71 | virtual_dma_port = io; | ||
72 | fd_enable_dma(); | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | #endif /* CONFIG_PCI */ | ||
78 | |||
79 | __inline__ void virtual_dma_init(void) | ||
80 | { | ||
81 | /* Nothing to do on PowerPC */ | ||
82 | } | ||
83 | |||
84 | static int FDC1 = 0x3f0; | ||
85 | static int FDC2 = -1; | ||
86 | |||
87 | /* | ||
88 | * Again, the CMOS information not available | ||
89 | */ | ||
90 | #define FLOPPY0_TYPE 6 | ||
91 | #define FLOPPY1_TYPE 0 | ||
92 | |||
93 | #define N_FDC 2 /* Don't change this! */ | ||
94 | #define N_DRIVE 8 | ||
95 | |||
96 | #define FLOPPY_MOTOR_MASK 0xf0 | ||
97 | |||
98 | /* | ||
99 | * The PowerPC has no problems with floppy DMA crossing 64k borders. | ||
100 | */ | ||
101 | #define CROSS_64KB(a,s) (0) | ||
102 | |||
103 | #define EXTRA_FLOPPY_PARAMS | ||
104 | |||
105 | #endif /* __ASM_POWERPC_FLOPPY_H */ | ||
diff --git a/include/asm-powerpc/hvconsole.h b/include/asm-powerpc/hvconsole.h new file mode 100644 index 00000000000..6da93ce74dc --- /dev/null +++ b/include/asm-powerpc/hvconsole.h | |||
@@ -0,0 +1,49 @@ | |||
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 | /* implemented by a low level driver */ | ||
33 | struct hv_ops { | ||
34 | int (*get_chars)(uint32_t vtermno, char *buf, int count); | ||
35 | int (*put_chars)(uint32_t vtermno, const char *buf, int count); | ||
36 | }; | ||
37 | extern int hvc_get_chars(uint32_t vtermno, char *buf, int count); | ||
38 | extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count); | ||
39 | |||
40 | struct hvc_struct; | ||
41 | |||
42 | /* Register a vterm and a slot index for use as a console (console_init) */ | ||
43 | extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops); | ||
44 | /* register a vterm for hvc tty operation (module_init or hotplug add) */ | ||
45 | extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, | ||
46 | struct hv_ops *ops); | ||
47 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ | ||
48 | extern int __devexit hvc_remove(struct hvc_struct *hp); | ||
49 | #endif /* _PPC64_HVCONSOLE_H */ | ||
diff --git a/include/asm-powerpc/hvcserver.h b/include/asm-powerpc/hvcserver.h new file mode 100644 index 00000000000..aecba966579 --- /dev/null +++ b/include/asm-powerpc/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-powerpc/kexec.h b/include/asm-powerpc/kexec.h index 062ab9ba68e..c72ffc709ea 100644 --- a/include/asm-powerpc/kexec.h +++ b/include/asm-powerpc/kexec.h | |||
@@ -40,6 +40,7 @@ extern note_buf_t crash_notes[]; | |||
40 | #ifdef __powerpc64__ | 40 | #ifdef __powerpc64__ |
41 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for | 41 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for |
42 | master to copy new code to 0 */ | 42 | master to copy new code to 0 */ |
43 | extern void __init kexec_setup(void); | ||
43 | #else | 44 | #else |
44 | struct kimage; | 45 | struct kimage; |
45 | extern void machine_kexec_simple(struct kimage *image); | 46 | extern void machine_kexec_simple(struct kimage *image); |
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h index 5670f0cd614..c011abb8b60 100644 --- a/include/asm-powerpc/machdep.h +++ b/include/asm-powerpc/machdep.h | |||
@@ -93,7 +93,9 @@ struct machdep_calls { | |||
93 | 93 | ||
94 | void (*init_IRQ)(void); | 94 | void (*init_IRQ)(void); |
95 | int (*get_irq)(struct pt_regs *); | 95 | int (*get_irq)(struct pt_regs *); |
96 | void (*cpu_irq_down)(int secondary); | 96 | #ifdef CONFIG_KEXEC |
97 | void (*kexec_cpu_down)(int crash_shutdown, int secondary); | ||
98 | #endif | ||
97 | 99 | ||
98 | /* PCI stuff */ | 100 | /* PCI stuff */ |
99 | /* Called after scanning the bus, before allocating resources */ | 101 | /* Called after scanning the bus, before allocating resources */ |
diff --git a/include/asm-powerpc/nvram.h b/include/asm-powerpc/nvram.h new file mode 100644 index 00000000000..24bd8c2388e --- /dev/null +++ b/include/asm-powerpc/nvram.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * NVRAM definitions and access functions. | ||
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 | #ifndef _ASM_POWERPC_NVRAM_H | ||
11 | #define _ASM_POWERPC_NVRAM_H | ||
12 | |||
13 | #define NVRW_CNT 0x20 | ||
14 | #define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */ | ||
15 | #define NVRAM_BLOCK_LEN 16 | ||
16 | #define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN) | ||
17 | #define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN) | ||
18 | |||
19 | #define NVRAM_AS0 0x74 | ||
20 | #define NVRAM_AS1 0x75 | ||
21 | #define NVRAM_DATA 0x77 | ||
22 | |||
23 | |||
24 | /* RTC Offsets */ | ||
25 | |||
26 | #define MOTO_RTC_SECONDS 0x1FF9 | ||
27 | #define MOTO_RTC_MINUTES 0x1FFA | ||
28 | #define MOTO_RTC_HOURS 0x1FFB | ||
29 | #define MOTO_RTC_DAY_OF_WEEK 0x1FFC | ||
30 | #define MOTO_RTC_DAY_OF_MONTH 0x1FFD | ||
31 | #define MOTO_RTC_MONTH 0x1FFE | ||
32 | #define MOTO_RTC_YEAR 0x1FFF | ||
33 | #define MOTO_RTC_CONTROLA 0x1FF8 | ||
34 | #define MOTO_RTC_CONTROLB 0x1FF9 | ||
35 | |||
36 | #define NVRAM_SIG_SP 0x02 /* support processor */ | ||
37 | #define NVRAM_SIG_OF 0x50 /* open firmware config */ | ||
38 | #define NVRAM_SIG_FW 0x51 /* general firmware */ | ||
39 | #define NVRAM_SIG_HW 0x52 /* hardware (VPD) */ | ||
40 | #define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */ | ||
41 | #define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */ | ||
42 | #define NVRAM_SIG_SYS 0x70 /* system env vars */ | ||
43 | #define NVRAM_SIG_CFG 0x71 /* config data */ | ||
44 | #define NVRAM_SIG_ELOG 0x72 /* error log */ | ||
45 | #define NVRAM_SIG_VEND 0x7e /* vendor defined */ | ||
46 | #define NVRAM_SIG_FREE 0x7f /* Free space */ | ||
47 | #define NVRAM_SIG_OS 0xa0 /* OS defined */ | ||
48 | #define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */ | ||
49 | |||
50 | /* If change this size, then change the size of NVNAME_LEN */ | ||
51 | struct nvram_header { | ||
52 | unsigned char signature; | ||
53 | unsigned char checksum; | ||
54 | unsigned short length; | ||
55 | char name[12]; | ||
56 | }; | ||
57 | |||
58 | struct nvram_partition { | ||
59 | struct list_head partition; | ||
60 | struct nvram_header header; | ||
61 | unsigned int index; | ||
62 | }; | ||
63 | |||
64 | |||
65 | extern int nvram_write_error_log(char * buff, int length, unsigned int err_type); | ||
66 | extern int nvram_read_error_log(char * buff, int length, unsigned int * err_type); | ||
67 | extern int nvram_clear_error_log(void); | ||
68 | extern struct nvram_partition *nvram_find_partition(int sig, const char *name); | ||
69 | |||
70 | extern int pSeries_nvram_init(void); | ||
71 | extern int mmio_nvram_init(void); | ||
72 | |||
73 | /* PowerMac specific nvram stuffs */ | ||
74 | |||
75 | enum { | ||
76 | pmac_nvram_OF, /* Open Firmware partition */ | ||
77 | pmac_nvram_XPRAM, /* MacOS XPRAM partition */ | ||
78 | pmac_nvram_NR /* MacOS Name Registry partition */ | ||
79 | }; | ||
80 | |||
81 | /* Return partition offset in nvram */ | ||
82 | extern int pmac_get_partition(int partition); | ||
83 | |||
84 | /* Direct access to XPRAM on PowerMacs */ | ||
85 | extern u8 pmac_xpram_read(int xpaddr); | ||
86 | extern void pmac_xpram_write(int xpaddr, u8 data); | ||
87 | |||
88 | /* Synchronize NVRAM */ | ||
89 | extern void nvram_sync(void); | ||
90 | |||
91 | /* Normal access to NVRAM */ | ||
92 | extern unsigned char nvram_read_byte(int i); | ||
93 | extern void nvram_write_byte(unsigned char c, int i); | ||
94 | |||
95 | /* Some offsets in XPRAM */ | ||
96 | #define PMAC_XPRAM_MACHINE_LOC 0xe4 | ||
97 | #define PMAC_XPRAM_SOUND_VOLUME 0x08 | ||
98 | |||
99 | /* Machine location structure in PowerMac XPRAM */ | ||
100 | struct pmac_machine_location { | ||
101 | unsigned int latitude; /* 2+30 bit Fractional number */ | ||
102 | unsigned int longitude; /* 2+30 bit Fractional number */ | ||
103 | unsigned int delta; /* mix of GMT delta and DLS */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | * /dev/nvram ioctls | ||
108 | * | ||
109 | * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is | ||
110 | * definitely obsolete. Do not use it if you can avoid it | ||
111 | */ | ||
112 | |||
113 | #define OBSOLETE_PMAC_NVRAM_GET_OFFSET \ | ||
114 | _IOWR('p', 0x40, int) | ||
115 | |||
116 | #define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */ | ||
117 | #define IOC_NVRAM_SYNC _IO('p', 0x43) /* Sync NVRAM image */ | ||
118 | |||
119 | #endif /* _ASM_POWERPC_NVRAM_H */ | ||
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h new file mode 100644 index 00000000000..18c1e5ee81a --- /dev/null +++ b/include/asm-powerpc/page.h | |||
@@ -0,0 +1,179 @@ | |||
1 | #ifndef _ASM_POWERPC_PAGE_H | ||
2 | #define _ASM_POWERPC_PAGE_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2001,2005 IBM Corporation. | ||
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 | #ifdef __KERNEL__ | ||
14 | #include <linux/config.h> | ||
15 | #include <asm/asm-compat.h> | ||
16 | |||
17 | /* | ||
18 | * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software | ||
19 | * page size. When using 64K pages however, whether we are really supporting | ||
20 | * 64K pages in HW or not is irrelevant to those definitions. | ||
21 | */ | ||
22 | #ifdef CONFIG_PPC_64K_PAGES | ||
23 | #define PAGE_SHIFT 16 | ||
24 | #else | ||
25 | #define PAGE_SHIFT 12 | ||
26 | #endif | ||
27 | |||
28 | #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) | ||
29 | |||
30 | /* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */ | ||
31 | #define __HAVE_ARCH_GATE_AREA 1 | ||
32 | |||
33 | /* | ||
34 | * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we | ||
35 | * assign PAGE_MASK to a larger type it gets extended the way we want | ||
36 | * (i.e. with 1s in the high bits) | ||
37 | */ | ||
38 | #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) | ||
39 | |||
40 | #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) | ||
41 | #define KERNELBASE PAGE_OFFSET | ||
42 | |||
43 | #ifdef CONFIG_DISCONTIGMEM | ||
44 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) | ||
45 | #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) | ||
46 | #define pfn_valid(pfn) discontigmem_pfn_valid(pfn) | ||
47 | #endif | ||
48 | |||
49 | #ifdef CONFIG_FLATMEM | ||
50 | #define pfn_to_page(pfn) (mem_map + (pfn)) | ||
51 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
52 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | ||
53 | #endif | ||
54 | |||
55 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
56 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | ||
57 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
58 | |||
59 | #define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) | ||
60 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) | ||
61 | |||
62 | /* | ||
63 | * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI, | ||
64 | * and needs to be executable. This means the whole heap ends | ||
65 | * up being executable. | ||
66 | */ | ||
67 | #define VM_DATA_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \ | ||
68 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
69 | |||
70 | #define VM_DATA_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \ | ||
71 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
72 | |||
73 | #ifdef __powerpc64__ | ||
74 | #include <asm/page_64.h> | ||
75 | #else | ||
76 | #include <asm/page_32.h> | ||
77 | #endif | ||
78 | |||
79 | /* align addr on a size boundary - adjust address up/down if needed */ | ||
80 | #define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) | ||
81 | #define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) | ||
82 | |||
83 | /* align addr on a size boundary - adjust address up if needed */ | ||
84 | #define _ALIGN(addr,size) _ALIGN_UP(addr,size) | ||
85 | |||
86 | /* to align the pointer to the (next) page boundary */ | ||
87 | #define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) | ||
88 | |||
89 | #ifndef __ASSEMBLY__ | ||
90 | |||
91 | #undef STRICT_MM_TYPECHECKS | ||
92 | |||
93 | #ifdef STRICT_MM_TYPECHECKS | ||
94 | /* These are used to make use of C type-checking. */ | ||
95 | |||
96 | /* PTE level */ | ||
97 | typedef struct { pte_basic_t pte; } pte_t; | ||
98 | #define pte_val(x) ((x).pte) | ||
99 | #define __pte(x) ((pte_t) { (x) }) | ||
100 | |||
101 | /* 64k pages additionally define a bigger "real PTE" type that gathers | ||
102 | * the "second half" part of the PTE for pseudo 64k pages | ||
103 | */ | ||
104 | #ifdef CONFIG_PPC_64K_PAGES | ||
105 | typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; | ||
106 | #else | ||
107 | typedef struct { pte_t pte; } real_pte_t; | ||
108 | #endif | ||
109 | |||
110 | /* PMD level */ | ||
111 | typedef struct { unsigned long pmd; } pmd_t; | ||
112 | #define pmd_val(x) ((x).pmd) | ||
113 | #define __pmd(x) ((pmd_t) { (x) }) | ||
114 | |||
115 | /* PUD level exusts only on 4k pages */ | ||
116 | #ifndef CONFIG_PPC_64K_PAGES | ||
117 | typedef struct { unsigned long pud; } pud_t; | ||
118 | #define pud_val(x) ((x).pud) | ||
119 | #define __pud(x) ((pud_t) { (x) }) | ||
120 | #endif | ||
121 | |||
122 | /* PGD level */ | ||
123 | typedef struct { unsigned long pgd; } pgd_t; | ||
124 | #define pgd_val(x) ((x).pgd) | ||
125 | #define __pgd(x) ((pgd_t) { (x) }) | ||
126 | |||
127 | /* Page protection bits */ | ||
128 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
129 | #define pgprot_val(x) ((x).pgprot) | ||
130 | #define __pgprot(x) ((pgprot_t) { (x) }) | ||
131 | |||
132 | #else | ||
133 | |||
134 | /* | ||
135 | * .. while these make it easier on the compiler | ||
136 | */ | ||
137 | |||
138 | typedef pte_basic_t pte_t; | ||
139 | #define pte_val(x) (x) | ||
140 | #define __pte(x) (x) | ||
141 | |||
142 | #ifdef CONFIG_PPC_64K_PAGES | ||
143 | typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; | ||
144 | #else | ||
145 | typedef unsigned long real_pte_t; | ||
146 | #endif | ||
147 | |||
148 | |||
149 | typedef unsigned long pmd_t; | ||
150 | #define pmd_val(x) (x) | ||
151 | #define __pmd(x) (x) | ||
152 | |||
153 | #ifndef CONFIG_PPC_64K_PAGES | ||
154 | typedef unsigned long pud_t; | ||
155 | #define pud_val(x) (x) | ||
156 | #define __pud(x) (x) | ||
157 | #endif | ||
158 | |||
159 | typedef unsigned long pgd_t; | ||
160 | #define pgd_val(x) (x) | ||
161 | #define pgprot_val(x) (x) | ||
162 | |||
163 | typedef unsigned long pgprot_t; | ||
164 | #define __pgd(x) (x) | ||
165 | #define __pgprot(x) (x) | ||
166 | |||
167 | #endif | ||
168 | |||
169 | struct page; | ||
170 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); | ||
171 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, | ||
172 | struct page *p); | ||
173 | extern int page_is_ram(unsigned long pfn); | ||
174 | |||
175 | #endif /* __ASSEMBLY__ */ | ||
176 | |||
177 | #endif /* __KERNEL__ */ | ||
178 | |||
179 | #endif /* _ASM_POWERPC_PAGE_H */ | ||
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h new file mode 100644 index 00000000000..7259cfd85da --- /dev/null +++ b/include/asm-powerpc/page_32.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef _ASM_POWERPC_PAGE_32_H | ||
2 | #define _ASM_POWERPC_PAGE_32_H | ||
3 | |||
4 | #define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32 | ||
5 | |||
6 | #define PPC_MEMSTART 0 | ||
7 | |||
8 | #ifndef __ASSEMBLY__ | ||
9 | /* | ||
10 | * The basic type of a PTE - 64 bits for those CPUs with > 32 bit | ||
11 | * physical addressing. For now this just the IBM PPC440. | ||
12 | */ | ||
13 | #ifdef CONFIG_PTE_64BIT | ||
14 | typedef unsigned long long pte_basic_t; | ||
15 | #define PTE_SHIFT (PAGE_SHIFT - 3) /* 512 ptes per page */ | ||
16 | #define PTE_FMT "%16Lx" | ||
17 | #else | ||
18 | typedef unsigned long pte_basic_t; | ||
19 | #define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */ | ||
20 | #define PTE_FMT "%.8lx" | ||
21 | #endif | ||
22 | |||
23 | struct page; | ||
24 | extern void clear_pages(void *page, int order); | ||
25 | static inline void clear_page(void *page) { clear_pages(page, 0); } | ||
26 | extern void copy_page(void *to, void *from); | ||
27 | |||
28 | /* Pure 2^n version of get_order */ | ||
29 | extern __inline__ int get_order(unsigned long size) | ||
30 | { | ||
31 | int lz; | ||
32 | |||
33 | size = (size-1) >> PAGE_SHIFT; | ||
34 | asm ("cntlzw %0,%1" : "=r" (lz) : "r" (size)); | ||
35 | return 32 - lz; | ||
36 | } | ||
37 | |||
38 | #endif /* __ASSEMBLY__ */ | ||
39 | |||
40 | #endif /* _ASM_POWERPC_PAGE_32_H */ | ||
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h new file mode 100644 index 00000000000..c16f106b537 --- /dev/null +++ b/include/asm-powerpc/page_64.h | |||
@@ -0,0 +1,174 @@ | |||
1 | #ifndef _ASM_POWERPC_PAGE_64_H | ||
2 | #define _ASM_POWERPC_PAGE_64_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 | /* | ||
14 | * We always define HW_PAGE_SHIFT to 12 as use of 64K pages remains Linux | ||
15 | * specific, every notion of page number shared with the firmware, TCEs, | ||
16 | * iommu, etc... still uses a page size of 4K. | ||
17 | */ | ||
18 | #define HW_PAGE_SHIFT 12 | ||
19 | #define HW_PAGE_SIZE (ASM_CONST(1) << HW_PAGE_SHIFT) | ||
20 | #define HW_PAGE_MASK (~(HW_PAGE_SIZE-1)) | ||
21 | |||
22 | /* | ||
23 | * PAGE_FACTOR is the number of bits factor between PAGE_SHIFT and | ||
24 | * HW_PAGE_SHIFT, that is 4K pages. | ||
25 | */ | ||
26 | #define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT) | ||
27 | |||
28 | #define REGION_SIZE 4UL | ||
29 | #define REGION_SHIFT 60UL | ||
30 | #define REGION_MASK (((1UL<<REGION_SIZE)-1UL)<<REGION_SHIFT) | ||
31 | |||
32 | #define VMALLOCBASE ASM_CONST(0xD000000000000000) | ||
33 | #define VMALLOC_REGION_ID (VMALLOCBASE >> REGION_SHIFT) | ||
34 | #define KERNEL_REGION_ID (KERNELBASE >> REGION_SHIFT) | ||
35 | #define USER_REGION_ID (0UL) | ||
36 | #define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT) | ||
37 | |||
38 | /* Segment size */ | ||
39 | #define SID_SHIFT 28 | ||
40 | #define SID_MASK 0xfffffffffUL | ||
41 | #define ESID_MASK 0xfffffffff0000000UL | ||
42 | #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) | ||
43 | |||
44 | #ifndef __ASSEMBLY__ | ||
45 | #include <asm/cache.h> | ||
46 | |||
47 | typedef unsigned long pte_basic_t; | ||
48 | |||
49 | static __inline__ void clear_page(void *addr) | ||
50 | { | ||
51 | unsigned long lines, line_size; | ||
52 | |||
53 | line_size = ppc64_caches.dline_size; | ||
54 | lines = ppc64_caches.dlines_per_page; | ||
55 | |||
56 | __asm__ __volatile__( | ||
57 | "mtctr %1 # clear_page\n\ | ||
58 | 1: dcbz 0,%0\n\ | ||
59 | add %0,%0,%3\n\ | ||
60 | bdnz+ 1b" | ||
61 | : "=r" (addr) | ||
62 | : "r" (lines), "0" (addr), "r" (line_size) | ||
63 | : "ctr", "memory"); | ||
64 | } | ||
65 | |||
66 | extern void copy_4K_page(void *to, void *from); | ||
67 | |||
68 | #ifdef CONFIG_PPC_64K_PAGES | ||
69 | static inline void copy_page(void *to, void *from) | ||
70 | { | ||
71 | unsigned int i; | ||
72 | for (i=0; i < (1 << (PAGE_SHIFT - 12)); i++) { | ||
73 | copy_4K_page(to, from); | ||
74 | to += 4096; | ||
75 | from += 4096; | ||
76 | } | ||
77 | } | ||
78 | #else /* CONFIG_PPC_64K_PAGES */ | ||
79 | static inline void copy_page(void *to, void *from) | ||
80 | { | ||
81 | copy_4K_page(to, from); | ||
82 | } | ||
83 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
84 | |||
85 | /* Log 2 of page table size */ | ||
86 | extern u64 ppc64_pft_size; | ||
87 | |||
88 | /* Large pages size */ | ||
89 | extern unsigned int HPAGE_SHIFT; | ||
90 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | ||
91 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | ||
92 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | ||
93 | |||
94 | #endif /* __ASSEMBLY__ */ | ||
95 | |||
96 | #ifdef CONFIG_HUGETLB_PAGE | ||
97 | |||
98 | #define HTLB_AREA_SHIFT 40 | ||
99 | #define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT) | ||
100 | #define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT) | ||
101 | |||
102 | #define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ | ||
103 | - (1U << GET_ESID(addr))) & 0xffff) | ||
104 | #define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \ | ||
105 | - (1U << GET_HTLB_AREA(addr))) & 0xffff) | ||
106 | |||
107 | #define ARCH_HAS_HUGEPAGE_ONLY_RANGE | ||
108 | #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE | ||
109 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
110 | |||
111 | #define touches_hugepage_low_range(mm, addr, len) \ | ||
112 | (LOW_ESID_MASK((addr), (len)) & (mm)->context.low_htlb_areas) | ||
113 | #define touches_hugepage_high_range(mm, addr, len) \ | ||
114 | (HTLB_AREA_MASK((addr), (len)) & (mm)->context.high_htlb_areas) | ||
115 | |||
116 | #define __within_hugepage_low_range(addr, len, segmask) \ | ||
117 | ((LOW_ESID_MASK((addr), (len)) | (segmask)) == (segmask)) | ||
118 | #define within_hugepage_low_range(addr, len) \ | ||
119 | __within_hugepage_low_range((addr), (len), \ | ||
120 | current->mm->context.low_htlb_areas) | ||
121 | #define __within_hugepage_high_range(addr, len, zonemask) \ | ||
122 | ((HTLB_AREA_MASK((addr), (len)) | (zonemask)) == (zonemask)) | ||
123 | #define within_hugepage_high_range(addr, len) \ | ||
124 | __within_hugepage_high_range((addr), (len), \ | ||
125 | current->mm->context.high_htlb_areas) | ||
126 | |||
127 | #define is_hugepage_only_range(mm, addr, len) \ | ||
128 | (touches_hugepage_high_range((mm), (addr), (len)) || \ | ||
129 | touches_hugepage_low_range((mm), (addr), (len))) | ||
130 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | ||
131 | |||
132 | #define in_hugepage_area(context, addr) \ | ||
133 | (cpu_has_feature(CPU_FTR_16M_PAGE) && \ | ||
134 | ( ((1 << GET_HTLB_AREA(addr)) & (context).high_htlb_areas) || \ | ||
135 | ( ((addr) < 0x100000000L) && \ | ||
136 | ((1 << GET_ESID(addr)) & (context).low_htlb_areas) ) ) ) | ||
137 | |||
138 | #else /* !CONFIG_HUGETLB_PAGE */ | ||
139 | |||
140 | #define in_hugepage_area(mm, addr) 0 | ||
141 | |||
142 | #endif /* !CONFIG_HUGETLB_PAGE */ | ||
143 | |||
144 | #ifdef MODULE | ||
145 | #define __page_aligned __attribute__((__aligned__(PAGE_SIZE))) | ||
146 | #else | ||
147 | #define __page_aligned \ | ||
148 | __attribute__((__aligned__(PAGE_SIZE), \ | ||
149 | __section__(".data.page_aligned"))) | ||
150 | #endif | ||
151 | |||
152 | #define VM_DATA_DEFAULT_FLAGS \ | ||
153 | (test_thread_flag(TIF_32BIT) ? \ | ||
154 | VM_DATA_DEFAULT_FLAGS32 : VM_DATA_DEFAULT_FLAGS64) | ||
155 | |||
156 | /* | ||
157 | * This is the default if a program doesn't have a PT_GNU_STACK | ||
158 | * program header entry. The PPC64 ELF ABI has a non executable stack | ||
159 | * stack by default, so in the absense of a PT_GNU_STACK program header | ||
160 | * we turn execute permission off. | ||
161 | */ | ||
162 | #define VM_STACK_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \ | ||
163 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
164 | |||
165 | #define VM_STACK_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \ | ||
166 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
167 | |||
168 | #define VM_STACK_DEFAULT_FLAGS \ | ||
169 | (test_thread_flag(TIF_32BIT) ? \ | ||
170 | VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) | ||
171 | |||
172 | #include <asm-generic/page.h> | ||
173 | |||
174 | #endif /* _ASM_POWERPC_PAGE_64_H */ | ||
diff --git a/include/asm-powerpc/serial.h b/include/asm-powerpc/serial.h new file mode 100644 index 00000000000..b273d630b32 --- /dev/null +++ b/include/asm-powerpc/serial.h | |||
@@ -0,0 +1,18 @@ | |||
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 _ASM_POWERPC_SERIAL_H | ||
8 | #define _ASM_POWERPC_SERIAL_H | ||
9 | |||
10 | /* | ||
11 | * Serial ports are not listed here, because they are discovered | ||
12 | * through the device tree. | ||
13 | */ | ||
14 | |||
15 | /* Default baud base if not found in device-tree */ | ||
16 | #define BASE_BAUD ( 1843200 / 16 ) | ||
17 | |||
18 | #endif /* _PPC64_SERIAL_H */ | ||
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h index fc323b51366..411832d5bbd 100644 --- a/include/asm-powerpc/vdso_datapage.h +++ b/include/asm-powerpc/vdso_datapage.h | |||
@@ -73,7 +73,7 @@ struct vdso_data { | |||
73 | /* those additional ones don't have to be located anywhere | 73 | /* those additional ones don't have to be located anywhere |
74 | * special as they were not part of the original systemcfg | 74 | * special as they were not part of the original systemcfg |
75 | */ | 75 | */ |
76 | __s64 wtom_clock_sec; /* Wall to monotonic clock */ | 76 | __s32 wtom_clock_sec; /* Wall to monotonic clock */ |
77 | __s32 wtom_clock_nsec; | 77 | __s32 wtom_clock_nsec; |
78 | __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ | 78 | __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ |
79 | __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ | 79 | __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ |