diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-14 20:56:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-14 20:56:00 -0500 |
commit | 0174f72f848dfe7dc7488799776303c81b181b16 (patch) | |
tree | 3f92a0ea6d1780823f2c56e512942bcc6e7817ef /include | |
parent | 302fe1758d85ad9c868e77625f61b7edad106381 (diff) | |
parent | ba76cd575ffd461d83507c23cf53c78d56d1ea0a (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-powerpc/btext.h (renamed from include/asm-ppc64/btext.h) | 0 | ||||
-rw-r--r-- | include/asm-powerpc/delay.h (renamed from include/asm-ppc64/delay.h) | 19 | ||||
-rw-r--r-- | include/asm-powerpc/eeh.h (renamed from include/asm-ppc64/eeh.h) | 0 | ||||
-rw-r--r-- | include/asm-powerpc/floppy.h (renamed from include/asm-ppc64/floppy.h) | 25 | ||||
-rw-r--r-- | include/asm-powerpc/hvconsole.h (renamed from include/asm-ppc64/hvconsole.h) | 0 | ||||
-rw-r--r-- | include/asm-powerpc/hvcserver.h (renamed from include/asm-ppc64/hvcserver.h) | 0 | ||||
-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 (renamed from include/asm-ppc64/nvram.h) | 17 | ||||
-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 (renamed from include/asm-ppc64/serial.h) | 19 | ||||
-rw-r--r-- | include/asm-powerpc/vdso_datapage.h | 2 | ||||
-rw-r--r-- | include/asm-ppc/nvram.h | 73 | ||||
-rw-r--r-- | include/asm-ppc64/page.h | 328 | ||||
-rw-r--r-- | include/asm-ppc64/prom.h | 220 | ||||
-rw-r--r-- | include/asm-ppc64/system.h | 310 |
18 files changed, 440 insertions, 971 deletions
diff --git a/include/asm-ppc64/btext.h b/include/asm-powerpc/btext.h index 71cce36bc630..71cce36bc630 100644 --- a/include/asm-ppc64/btext.h +++ b/include/asm-powerpc/btext.h | |||
diff --git a/include/asm-ppc64/delay.h b/include/asm-powerpc/delay.h index 05f198cf73d9..1492aa9ab716 100644 --- a/include/asm-ppc64/delay.h +++ b/include/asm-powerpc/delay.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _PPC64_DELAY_H | 1 | #ifndef _ASM_POWERPC_DELAY_H |
2 | #define _PPC64_DELAY_H | 2 | #define _ASM_POWERPC_DELAY_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Copyright 1996, Paul Mackerras. | 5 | * Copyright 1996, Paul Mackerras. |
@@ -15,10 +15,17 @@ | |||
15 | 15 | ||
16 | extern unsigned long tb_ticks_per_usec; | 16 | extern unsigned long tb_ticks_per_usec; |
17 | 17 | ||
18 | /* define these here to prevent circular dependencies */ | 18 | #ifdef CONFIG_PPC64 |
19 | /* define these here to prevent circular dependencies */ | ||
20 | /* these instructions control the thread priority on multi-threaded cpus */ | ||
19 | #define __HMT_low() asm volatile("or 1,1,1") | 21 | #define __HMT_low() asm volatile("or 1,1,1") |
20 | #define __HMT_medium() asm volatile("or 2,2,2") | 22 | #define __HMT_medium() asm volatile("or 2,2,2") |
21 | #define __barrier() asm volatile("":::"memory") | 23 | #else |
24 | #define __HMT_low() | ||
25 | #define __HMT_medium() | ||
26 | #endif | ||
27 | |||
28 | #define __barrier() asm volatile("" ::: "memory") | ||
22 | 29 | ||
23 | static inline unsigned long __get_tb(void) | 30 | static inline unsigned long __get_tb(void) |
24 | { | 31 | { |
@@ -32,7 +39,7 @@ static inline void __delay(unsigned long loops) | |||
32 | { | 39 | { |
33 | unsigned long start = __get_tb(); | 40 | unsigned long start = __get_tb(); |
34 | 41 | ||
35 | while((__get_tb()-start) < loops) | 42 | while((__get_tb() - start) < loops) |
36 | __HMT_low(); | 43 | __HMT_low(); |
37 | __HMT_medium(); | 44 | __HMT_medium(); |
38 | __barrier(); | 45 | __barrier(); |
@@ -45,4 +52,4 @@ static inline void udelay(unsigned long usecs) | |||
45 | __delay(loops); | 52 | __delay(loops); |
46 | } | 53 | } |
47 | 54 | ||
48 | #endif /* _PPC64_DELAY_H */ | 55 | #endif /* _ASM_POWERPC_DELAY_H */ |
diff --git a/include/asm-ppc64/eeh.h b/include/asm-powerpc/eeh.h index 89f26ab31908..89f26ab31908 100644 --- a/include/asm-ppc64/eeh.h +++ b/include/asm-powerpc/eeh.h | |||
diff --git a/include/asm-ppc64/floppy.h b/include/asm-powerpc/floppy.h index 5c497b588e54..64276a3f6153 100644 --- a/include/asm-ppc64/floppy.h +++ b/include/asm-powerpc/floppy.h | |||
@@ -7,22 +7,22 @@ | |||
7 | * | 7 | * |
8 | * Copyright (C) 1995 | 8 | * Copyright (C) 1995 |
9 | */ | 9 | */ |
10 | #ifndef __ASM_PPC64_FLOPPY_H | 10 | #ifndef __ASM_POWERPC_FLOPPY_H |
11 | #define __ASM_PPC64_FLOPPY_H | 11 | #define __ASM_POWERPC_FLOPPY_H |
12 | 12 | ||
13 | #include <linux/config.h> | 13 | #include <linux/config.h> |
14 | #include <asm/machdep.h> | 14 | #include <asm/machdep.h> |
15 | 15 | ||
16 | #define fd_inb(port) inb_p(port) | 16 | #define fd_inb(port) inb_p(port) |
17 | #define fd_outb(value,port) outb_p(value,port) | 17 | #define fd_outb(value,port) outb_p(value,port) |
18 | 18 | ||
19 | #define fd_enable_dma() enable_dma(FLOPPY_DMA) | 19 | #define fd_enable_dma() enable_dma(FLOPPY_DMA) |
20 | #define fd_disable_dma() disable_dma(FLOPPY_DMA) | 20 | #define fd_disable_dma() disable_dma(FLOPPY_DMA) |
21 | #define fd_request_dma() request_dma(FLOPPY_DMA,"floppy") | 21 | #define fd_request_dma() request_dma(FLOPPY_DMA, "floppy") |
22 | #define fd_free_dma() free_dma(FLOPPY_DMA) | 22 | #define fd_free_dma() free_dma(FLOPPY_DMA) |
23 | #define fd_clear_dma_ff() clear_dma_ff(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) | 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) | 25 | #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA, count) |
26 | #define fd_enable_irq() enable_irq(FLOPPY_IRQ) | 26 | #define fd_enable_irq() enable_irq(FLOPPY_IRQ) |
27 | #define fd_disable_irq() disable_irq(FLOPPY_IRQ) | 27 | #define fd_disable_irq() disable_irq(FLOPPY_IRQ) |
28 | #define fd_cacheflush(addr,size) /* nothing */ | 28 | #define fd_cacheflush(addr,size) /* nothing */ |
@@ -35,10 +35,10 @@ | |||
35 | 35 | ||
36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
37 | 37 | ||
38 | #define fd_dma_setup(addr,size,mode,io) ppc64_fd_dma_setup(addr,size,mode,io) | 38 | #define fd_dma_setup(addr,size,mode,io) powerpc_fd_dma_setup(addr,size,mode,io) |
39 | 39 | ||
40 | static __inline__ int | 40 | static __inline__ int powerpc_fd_dma_setup(char *addr, unsigned long size, |
41 | ppc64_fd_dma_setup(char *addr, unsigned long size, int mode, int io) | 41 | int mode, int io) |
42 | { | 42 | { |
43 | static unsigned long prev_size; | 43 | static unsigned long prev_size; |
44 | static dma_addr_t bus_addr = 0; | 44 | static dma_addr_t bus_addr = 0; |
@@ -55,9 +55,8 @@ ppc64_fd_dma_setup(char *addr, unsigned long size, int mode, int io) | |||
55 | bus_addr = 0; | 55 | bus_addr = 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | if (!bus_addr) /* need to map it */ { | 58 | if (!bus_addr) /* need to map it */ |
59 | bus_addr = pci_map_single(NULL, addr, size, dir); | 59 | bus_addr = pci_map_single(NULL, addr, size, dir); |
60 | } | ||
61 | 60 | ||
62 | /* remember this one as prev */ | 61 | /* remember this one as prev */ |
63 | prev_addr = addr; | 62 | prev_addr = addr; |
@@ -103,4 +102,4 @@ static int FDC2 = -1; | |||
103 | 102 | ||
104 | #define EXTRA_FLOPPY_PARAMS | 103 | #define EXTRA_FLOPPY_PARAMS |
105 | 104 | ||
106 | #endif /* __ASM_PPC64_FLOPPY_H */ | 105 | #endif /* __ASM_POWERPC_FLOPPY_H */ |
diff --git a/include/asm-ppc64/hvconsole.h b/include/asm-powerpc/hvconsole.h index 6da93ce74dc0..6da93ce74dc0 100644 --- a/include/asm-ppc64/hvconsole.h +++ b/include/asm-powerpc/hvconsole.h | |||
diff --git a/include/asm-ppc64/hvcserver.h b/include/asm-powerpc/hvcserver.h index aecba9665796..aecba9665796 100644 --- a/include/asm-ppc64/hvcserver.h +++ b/include/asm-powerpc/hvcserver.h | |||
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h index 062ab9ba68eb..c72ffc709ea8 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 5670f0cd6143..c011abb8b600 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-ppc64/nvram.h b/include/asm-powerpc/nvram.h index def47d720d3d..24bd8c2388ea 100644 --- a/include/asm-ppc64/nvram.h +++ b/include/asm-powerpc/nvram.h | |||
@@ -1,6 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * PreP compliant NVRAM access | 2 | * NVRAM definitions and access functions. |
3 | * This needs to be updated for PPC64 | ||
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
@@ -8,8 +7,8 @@ | |||
8 | * 2 of the License, or (at your option) any later version. | 7 | * 2 of the License, or (at your option) any later version. |
9 | */ | 8 | */ |
10 | 9 | ||
11 | #ifndef _PPC64_NVRAM_H | 10 | #ifndef _ASM_POWERPC_NVRAM_H |
12 | #define _PPC64_NVRAM_H | 11 | #define _ASM_POWERPC_NVRAM_H |
13 | 12 | ||
14 | #define NVRW_CNT 0x20 | 13 | #define NVRW_CNT 0x20 |
15 | #define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */ | 14 | #define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */ |
@@ -69,7 +68,6 @@ extern int nvram_clear_error_log(void); | |||
69 | extern struct nvram_partition *nvram_find_partition(int sig, const char *name); | 68 | extern struct nvram_partition *nvram_find_partition(int sig, const char *name); |
70 | 69 | ||
71 | extern int pSeries_nvram_init(void); | 70 | extern int pSeries_nvram_init(void); |
72 | extern int pmac_nvram_init(void); | ||
73 | extern int mmio_nvram_init(void); | 71 | extern int mmio_nvram_init(void); |
74 | 72 | ||
75 | /* PowerMac specific nvram stuffs */ | 73 | /* PowerMac specific nvram stuffs */ |
@@ -88,7 +86,11 @@ extern u8 pmac_xpram_read(int xpaddr); | |||
88 | extern void pmac_xpram_write(int xpaddr, u8 data); | 86 | extern void pmac_xpram_write(int xpaddr, u8 data); |
89 | 87 | ||
90 | /* Synchronize NVRAM */ | 88 | /* Synchronize NVRAM */ |
91 | extern int nvram_sync(void); | 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); | ||
92 | 94 | ||
93 | /* Some offsets in XPRAM */ | 95 | /* Some offsets in XPRAM */ |
94 | #define PMAC_XPRAM_MACHINE_LOC 0xe4 | 96 | #define PMAC_XPRAM_MACHINE_LOC 0xe4 |
@@ -112,5 +114,6 @@ struct pmac_machine_location { | |||
112 | _IOWR('p', 0x40, int) | 114 | _IOWR('p', 0x40, int) |
113 | 115 | ||
114 | #define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */ | 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 */ | ||
115 | 118 | ||
116 | #endif /* _PPC64_NVRAM_H */ | 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 000000000000..18c1e5ee81a3 --- /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 000000000000..7259cfd85da9 --- /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 000000000000..c16f106b5373 --- /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-ppc64/serial.h b/include/asm-powerpc/serial.h index d6bcb79b7d7b..b273d630b32f 100644 --- a/include/asm-ppc64/serial.h +++ b/include/asm-powerpc/serial.h | |||
@@ -1,21 +1,16 @@ | |||
1 | /* | 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 | 2 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU General Public License | 3 | * modify it under the terms of the GNU General Public License |
16 | * as published by the Free Software Foundation; either version | 4 | * as published by the Free Software Foundation; either version |
17 | * 2 of the License, or (at your option) any later version. | 5 | * 2 of the License, or (at your option) any later version. |
18 | */ | 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 | */ | ||
19 | 14 | ||
20 | /* Default baud base if not found in device-tree */ | 15 | /* Default baud base if not found in device-tree */ |
21 | #define BASE_BAUD ( 1843200 / 16 ) | 16 | #define BASE_BAUD ( 1843200 / 16 ) |
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h index fc323b51366b..411832d5bbdb 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 */ |
diff --git a/include/asm-ppc/nvram.h b/include/asm-ppc/nvram.h deleted file mode 100644 index 31ef16e3fc4f..000000000000 --- a/include/asm-ppc/nvram.h +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* | ||
2 | * PreP compliant NVRAM access | ||
3 | */ | ||
4 | |||
5 | #ifdef __KERNEL__ | ||
6 | #ifndef _PPC_NVRAM_H | ||
7 | #define _PPC_NVRAM_H | ||
8 | |||
9 | #define NVRAM_AS0 0x74 | ||
10 | #define NVRAM_AS1 0x75 | ||
11 | #define NVRAM_DATA 0x77 | ||
12 | |||
13 | |||
14 | /* RTC Offsets */ | ||
15 | |||
16 | #define MOTO_RTC_SECONDS 0x1FF9 | ||
17 | #define MOTO_RTC_MINUTES 0x1FFA | ||
18 | #define MOTO_RTC_HOURS 0x1FFB | ||
19 | #define MOTO_RTC_DAY_OF_WEEK 0x1FFC | ||
20 | #define MOTO_RTC_DAY_OF_MONTH 0x1FFD | ||
21 | #define MOTO_RTC_MONTH 0x1FFE | ||
22 | #define MOTO_RTC_YEAR 0x1FFF | ||
23 | #define MOTO_RTC_CONTROLA 0x1FF8 | ||
24 | #define MOTO_RTC_CONTROLB 0x1FF9 | ||
25 | |||
26 | /* PowerMac specific nvram stuffs */ | ||
27 | |||
28 | enum { | ||
29 | pmac_nvram_OF, /* Open Firmware partition */ | ||
30 | pmac_nvram_XPRAM, /* MacOS XPRAM partition */ | ||
31 | pmac_nvram_NR /* MacOS Name Registry partition */ | ||
32 | }; | ||
33 | |||
34 | /* Return partition offset in nvram */ | ||
35 | extern int pmac_get_partition(int partition); | ||
36 | |||
37 | /* Direct access to XPRAM on PowerMacs */ | ||
38 | extern u8 pmac_xpram_read(int xpaddr); | ||
39 | extern void pmac_xpram_write(int xpaddr, u8 data); | ||
40 | |||
41 | /* Synchronize NVRAM */ | ||
42 | extern void nvram_sync(void); | ||
43 | |||
44 | /* Normal access to NVRAM */ | ||
45 | extern unsigned char nvram_read_byte(int i); | ||
46 | extern void nvram_write_byte(unsigned char c, int i); | ||
47 | |||
48 | /* Some offsets in XPRAM */ | ||
49 | #define PMAC_XPRAM_MACHINE_LOC 0xe4 | ||
50 | #define PMAC_XPRAM_SOUND_VOLUME 0x08 | ||
51 | |||
52 | /* Machine location structure in PowerMac XPRAM */ | ||
53 | struct pmac_machine_location { | ||
54 | unsigned int latitude; /* 2+30 bit Fractional number */ | ||
55 | unsigned int longitude; /* 2+30 bit Fractional number */ | ||
56 | unsigned int delta; /* mix of GMT delta and DLS */ | ||
57 | }; | ||
58 | |||
59 | /* | ||
60 | * /dev/nvram ioctls | ||
61 | * | ||
62 | * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is | ||
63 | * definitely obsolete. Do not use it if you can avoid it | ||
64 | */ | ||
65 | |||
66 | #define OBSOLETE_PMAC_NVRAM_GET_OFFSET \ | ||
67 | _IOWR('p', 0x40, int) | ||
68 | |||
69 | #define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */ | ||
70 | #define IOC_NVRAM_SYNC _IO('p', 0x43) /* Sync NVRAM image */ | ||
71 | |||
72 | #endif | ||
73 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h deleted file mode 100644 index 3efc3288f7e9..000000000000 --- a/include/asm-ppc64/page.h +++ /dev/null | |||
@@ -1,328 +0,0 @@ | |||
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 | #include <asm/asm-compat.h> | ||
15 | |||
16 | /* | ||
17 | * We support either 4k or 64k software page size. When using 64k pages | ||
18 | * however, wether we are really supporting 64k pages in HW or not is | ||
19 | * irrelevant to those definitions. We always define HW_PAGE_SHIFT to 12 | ||
20 | * as use of 64k pages remains a linux kernel specific, every notion of | ||
21 | * page number shared with the firmware, TCEs, iommu, etc... still assumes | ||
22 | * a page size of 4096. | ||
23 | */ | ||
24 | #ifdef CONFIG_PPC_64K_PAGES | ||
25 | #define PAGE_SHIFT 16 | ||
26 | #else | ||
27 | #define PAGE_SHIFT 12 | ||
28 | #endif | ||
29 | |||
30 | #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) | ||
31 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
32 | |||
33 | /* HW_PAGE_SHIFT is always 4k pages */ | ||
34 | #define HW_PAGE_SHIFT 12 | ||
35 | #define HW_PAGE_SIZE (ASM_CONST(1) << HW_PAGE_SHIFT) | ||
36 | #define HW_PAGE_MASK (~(HW_PAGE_SIZE-1)) | ||
37 | |||
38 | /* PAGE_FACTOR is the number of bits factor between PAGE_SHIFT and | ||
39 | * HW_PAGE_SHIFT, that is 4k pages | ||
40 | */ | ||
41 | #define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT) | ||
42 | |||
43 | /* Segment size */ | ||
44 | #define SID_SHIFT 28 | ||
45 | #define SID_MASK 0xfffffffffUL | ||
46 | #define ESID_MASK 0xfffffffff0000000UL | ||
47 | #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) | ||
48 | |||
49 | /* Large pages size */ | ||
50 | |||
51 | #ifndef __ASSEMBLY__ | ||
52 | extern unsigned int HPAGE_SHIFT; | ||
53 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | ||
54 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | ||
55 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | ||
56 | #endif /* __ASSEMBLY__ */ | ||
57 | |||
58 | #ifdef CONFIG_HUGETLB_PAGE | ||
59 | |||
60 | |||
61 | #define HTLB_AREA_SHIFT 40 | ||
62 | #define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT) | ||
63 | #define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT) | ||
64 | |||
65 | #define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ | ||
66 | - (1U << GET_ESID(addr))) & 0xffff) | ||
67 | #define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \ | ||
68 | - (1U << GET_HTLB_AREA(addr))) & 0xffff) | ||
69 | |||
70 | #define ARCH_HAS_HUGEPAGE_ONLY_RANGE | ||
71 | #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE | ||
72 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
73 | |||
74 | #define touches_hugepage_low_range(mm, addr, len) \ | ||
75 | (LOW_ESID_MASK((addr), (len)) & (mm)->context.low_htlb_areas) | ||
76 | #define touches_hugepage_high_range(mm, addr, len) \ | ||
77 | (HTLB_AREA_MASK((addr), (len)) & (mm)->context.high_htlb_areas) | ||
78 | |||
79 | #define __within_hugepage_low_range(addr, len, segmask) \ | ||
80 | ((LOW_ESID_MASK((addr), (len)) | (segmask)) == (segmask)) | ||
81 | #define within_hugepage_low_range(addr, len) \ | ||
82 | __within_hugepage_low_range((addr), (len), \ | ||
83 | current->mm->context.low_htlb_areas) | ||
84 | #define __within_hugepage_high_range(addr, len, zonemask) \ | ||
85 | ((HTLB_AREA_MASK((addr), (len)) | (zonemask)) == (zonemask)) | ||
86 | #define within_hugepage_high_range(addr, len) \ | ||
87 | __within_hugepage_high_range((addr), (len), \ | ||
88 | current->mm->context.high_htlb_areas) | ||
89 | |||
90 | #define is_hugepage_only_range(mm, addr, len) \ | ||
91 | (touches_hugepage_high_range((mm), (addr), (len)) || \ | ||
92 | touches_hugepage_low_range((mm), (addr), (len))) | ||
93 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | ||
94 | |||
95 | #define in_hugepage_area(context, addr) \ | ||
96 | (cpu_has_feature(CPU_FTR_16M_PAGE) && \ | ||
97 | ( ((1 << GET_HTLB_AREA(addr)) & (context).high_htlb_areas) || \ | ||
98 | ( ((addr) < 0x100000000L) && \ | ||
99 | ((1 << GET_ESID(addr)) & (context).low_htlb_areas) ) ) ) | ||
100 | |||
101 | #else /* !CONFIG_HUGETLB_PAGE */ | ||
102 | |||
103 | #define in_hugepage_area(mm, addr) 0 | ||
104 | |||
105 | #endif /* !CONFIG_HUGETLB_PAGE */ | ||
106 | |||
107 | /* align addr on a size boundary - adjust address up/down if needed */ | ||
108 | #define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) | ||
109 | #define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) | ||
110 | |||
111 | /* align addr on a size boundary - adjust address up if needed */ | ||
112 | #define _ALIGN(addr,size) _ALIGN_UP(addr,size) | ||
113 | |||
114 | /* to align the pointer to the (next) page boundary */ | ||
115 | #define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) | ||
116 | |||
117 | #ifdef __KERNEL__ | ||
118 | #ifndef __ASSEMBLY__ | ||
119 | #include <asm/cache.h> | ||
120 | |||
121 | #undef STRICT_MM_TYPECHECKS | ||
122 | |||
123 | #define REGION_SIZE 4UL | ||
124 | #define REGION_SHIFT 60UL | ||
125 | #define REGION_MASK (((1UL<<REGION_SIZE)-1UL)<<REGION_SHIFT) | ||
126 | |||
127 | static __inline__ void clear_page(void *addr) | ||
128 | { | ||
129 | unsigned long lines, line_size; | ||
130 | |||
131 | line_size = ppc64_caches.dline_size; | ||
132 | lines = ppc64_caches.dlines_per_page; | ||
133 | |||
134 | __asm__ __volatile__( | ||
135 | "mtctr %1 # clear_page\n\ | ||
136 | 1: dcbz 0,%0\n\ | ||
137 | add %0,%0,%3\n\ | ||
138 | bdnz+ 1b" | ||
139 | : "=r" (addr) | ||
140 | : "r" (lines), "0" (addr), "r" (line_size) | ||
141 | : "ctr", "memory"); | ||
142 | } | ||
143 | |||
144 | extern void copy_4K_page(void *to, void *from); | ||
145 | |||
146 | #ifdef CONFIG_PPC_64K_PAGES | ||
147 | static inline void copy_page(void *to, void *from) | ||
148 | { | ||
149 | unsigned int i; | ||
150 | for (i=0; i < (1 << (PAGE_SHIFT - 12)); i++) { | ||
151 | copy_4K_page(to, from); | ||
152 | to += 4096; | ||
153 | from += 4096; | ||
154 | } | ||
155 | } | ||
156 | #else /* CONFIG_PPC_64K_PAGES */ | ||
157 | static inline void copy_page(void *to, void *from) | ||
158 | { | ||
159 | copy_4K_page(to, from); | ||
160 | } | ||
161 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
162 | |||
163 | struct page; | ||
164 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); | ||
165 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *p); | ||
166 | |||
167 | #ifdef STRICT_MM_TYPECHECKS | ||
168 | /* | ||
169 | * These are used to make use of C type-checking. | ||
170 | * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b. | ||
171 | */ | ||
172 | |||
173 | /* PTE level */ | ||
174 | typedef struct { unsigned long pte; } pte_t; | ||
175 | #define pte_val(x) ((x).pte) | ||
176 | #define __pte(x) ((pte_t) { (x) }) | ||
177 | |||
178 | /* 64k pages additionally define a bigger "real PTE" type that gathers | ||
179 | * the "second half" part of the PTE for pseudo 64k pages | ||
180 | */ | ||
181 | #ifdef CONFIG_PPC_64K_PAGES | ||
182 | typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; | ||
183 | #else | ||
184 | typedef struct { pte_t pte; } real_pte_t; | ||
185 | #endif | ||
186 | |||
187 | /* PMD level */ | ||
188 | typedef struct { unsigned long pmd; } pmd_t; | ||
189 | #define pmd_val(x) ((x).pmd) | ||
190 | #define __pmd(x) ((pmd_t) { (x) }) | ||
191 | |||
192 | /* PUD level exusts only on 4k pages */ | ||
193 | #ifndef CONFIG_PPC_64K_PAGES | ||
194 | typedef struct { unsigned long pud; } pud_t; | ||
195 | #define pud_val(x) ((x).pud) | ||
196 | #define __pud(x) ((pud_t) { (x) }) | ||
197 | #endif | ||
198 | |||
199 | /* PGD level */ | ||
200 | typedef struct { unsigned long pgd; } pgd_t; | ||
201 | #define pgd_val(x) ((x).pgd) | ||
202 | #define __pgd(x) ((pgd_t) { (x) }) | ||
203 | |||
204 | /* Page protection bits */ | ||
205 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
206 | #define pgprot_val(x) ((x).pgprot) | ||
207 | #define __pgprot(x) ((pgprot_t) { (x) }) | ||
208 | |||
209 | #else | ||
210 | |||
211 | /* | ||
212 | * .. while these make it easier on the compiler | ||
213 | */ | ||
214 | |||
215 | typedef unsigned long pte_t; | ||
216 | #define pte_val(x) (x) | ||
217 | #define __pte(x) (x) | ||
218 | |||
219 | #ifdef CONFIG_PPC_64K_PAGES | ||
220 | typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; | ||
221 | #else | ||
222 | typedef unsigned long real_pte_t; | ||
223 | #endif | ||
224 | |||
225 | |||
226 | typedef unsigned long pmd_t; | ||
227 | #define pmd_val(x) (x) | ||
228 | #define __pmd(x) (x) | ||
229 | |||
230 | #ifndef CONFIG_PPC_64K_PAGES | ||
231 | typedef unsigned long pud_t; | ||
232 | #define pud_val(x) (x) | ||
233 | #define __pud(x) (x) | ||
234 | #endif | ||
235 | |||
236 | typedef unsigned long pgd_t; | ||
237 | #define pgd_val(x) (x) | ||
238 | #define pgprot_val(x) (x) | ||
239 | |||
240 | typedef unsigned long pgprot_t; | ||
241 | #define __pgd(x) (x) | ||
242 | #define __pgprot(x) (x) | ||
243 | |||
244 | #endif | ||
245 | |||
246 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | ||
247 | |||
248 | extern int page_is_ram(unsigned long pfn); | ||
249 | |||
250 | extern u64 ppc64_pft_size; /* Log 2 of page table size */ | ||
251 | |||
252 | /* We do define AT_SYSINFO_EHDR but don't use the gate mecanism */ | ||
253 | #define __HAVE_ARCH_GATE_AREA 1 | ||
254 | |||
255 | #endif /* __ASSEMBLY__ */ | ||
256 | |||
257 | #ifdef MODULE | ||
258 | #define __page_aligned __attribute__((__aligned__(PAGE_SIZE))) | ||
259 | #else | ||
260 | #define __page_aligned \ | ||
261 | __attribute__((__aligned__(PAGE_SIZE), \ | ||
262 | __section__(".data.page_aligned"))) | ||
263 | #endif | ||
264 | |||
265 | |||
266 | /* This must match the -Ttext linker address */ | ||
267 | /* Note: tophys & tovirt make assumptions about how */ | ||
268 | /* KERNELBASE is defined for performance reasons. */ | ||
269 | /* When KERNELBASE moves, those macros may have */ | ||
270 | /* to change! */ | ||
271 | #define PAGE_OFFSET ASM_CONST(0xC000000000000000) | ||
272 | #define KERNELBASE PAGE_OFFSET | ||
273 | #define VMALLOCBASE ASM_CONST(0xD000000000000000) | ||
274 | |||
275 | #define VMALLOC_REGION_ID (VMALLOCBASE >> REGION_SHIFT) | ||
276 | #define KERNEL_REGION_ID (KERNELBASE >> REGION_SHIFT) | ||
277 | #define USER_REGION_ID (0UL) | ||
278 | #define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT) | ||
279 | |||
280 | #define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) | ||
281 | |||
282 | #ifdef CONFIG_FLATMEM | ||
283 | #define pfn_to_page(pfn) (mem_map + (pfn)) | ||
284 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
285 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | ||
286 | #endif | ||
287 | |||
288 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
289 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | ||
290 | |||
291 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
292 | |||
293 | /* | ||
294 | * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI, | ||
295 | * and needs to be executable. This means the whole heap ends | ||
296 | * up being executable. | ||
297 | */ | ||
298 | #define VM_DATA_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \ | ||
299 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
300 | |||
301 | #define VM_DATA_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \ | ||
302 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
303 | |||
304 | #define VM_DATA_DEFAULT_FLAGS \ | ||
305 | (test_thread_flag(TIF_32BIT) ? \ | ||
306 | VM_DATA_DEFAULT_FLAGS32 : VM_DATA_DEFAULT_FLAGS64) | ||
307 | |||
308 | /* | ||
309 | * This is the default if a program doesn't have a PT_GNU_STACK | ||
310 | * program header entry. The PPC64 ELF ABI has a non executable stack | ||
311 | * stack by default, so in the absense of a PT_GNU_STACK program header | ||
312 | * we turn execute permission off. | ||
313 | */ | ||
314 | #define VM_STACK_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \ | ||
315 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
316 | |||
317 | #define VM_STACK_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \ | ||
318 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
319 | |||
320 | #define VM_STACK_DEFAULT_FLAGS \ | ||
321 | (test_thread_flag(TIF_32BIT) ? \ | ||
322 | VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) | ||
323 | |||
324 | #endif /* __KERNEL__ */ | ||
325 | |||
326 | #include <asm-generic/page.h> | ||
327 | |||
328 | #endif /* _PPC64_PAGE_H */ | ||
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h deleted file mode 100644 index ddfe186589fa..000000000000 --- a/include/asm-ppc64/prom.h +++ /dev/null | |||
@@ -1,220 +0,0 @@ | |||
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/config.h> | ||
18 | #include <linux/proc_fs.h> | ||
19 | #include <asm/atomic.h> | ||
20 | |||
21 | #define PTRRELOC(x) ((typeof(x))((unsigned long)(x) - offset)) | ||
22 | #define PTRUNRELOC(x) ((typeof(x))((unsigned long)(x) + offset)) | ||
23 | #define RELOC(x) (*PTRRELOC(&(x))) | ||
24 | |||
25 | /* Definitions used by the flattened device tree */ | ||
26 | #define OF_DT_HEADER 0xd00dfeed /* marker */ | ||
27 | #define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ | ||
28 | #define OF_DT_END_NODE 0x2 /* End node */ | ||
29 | #define OF_DT_PROP 0x3 /* Property: name off, size, | ||
30 | * content */ | ||
31 | #define OF_DT_NOP 0x4 /* nop */ | ||
32 | #define OF_DT_END 0x9 | ||
33 | |||
34 | #define OF_DT_VERSION 0x10 | ||
35 | |||
36 | /* | ||
37 | * This is what gets passed to the kernel by prom_init or kexec | ||
38 | * | ||
39 | * The dt struct contains the device tree structure, full pathes and | ||
40 | * property contents. The dt strings contain a separate block with just | ||
41 | * the strings for the property names, and is fully page aligned and | ||
42 | * self contained in a page, so that it can be kept around by the kernel, | ||
43 | * each property name appears only once in this page (cheap compression) | ||
44 | * | ||
45 | * the mem_rsvmap contains a map of reserved ranges of physical memory, | ||
46 | * passing it here instead of in the device-tree itself greatly simplifies | ||
47 | * the job of everybody. It's just a list of u64 pairs (base/size) that | ||
48 | * ends when size is 0 | ||
49 | */ | ||
50 | struct boot_param_header | ||
51 | { | ||
52 | u32 magic; /* magic word OF_DT_HEADER */ | ||
53 | u32 totalsize; /* total size of DT block */ | ||
54 | u32 off_dt_struct; /* offset to structure */ | ||
55 | u32 off_dt_strings; /* offset to strings */ | ||
56 | u32 off_mem_rsvmap; /* offset to memory reserve map */ | ||
57 | u32 version; /* format version */ | ||
58 | u32 last_comp_version; /* last compatible version */ | ||
59 | /* version 2 fields below */ | ||
60 | u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ | ||
61 | /* version 3 fields below */ | ||
62 | u32 dt_strings_size; /* size of the DT strings block */ | ||
63 | }; | ||
64 | |||
65 | |||
66 | |||
67 | typedef u32 phandle; | ||
68 | typedef u32 ihandle; | ||
69 | |||
70 | struct address_range { | ||
71 | unsigned long space; | ||
72 | unsigned long address; | ||
73 | unsigned long size; | ||
74 | }; | ||
75 | |||
76 | struct interrupt_info { | ||
77 | int line; | ||
78 | int sense; /* +ve/-ve logic, edge or level, etc. */ | ||
79 | }; | ||
80 | |||
81 | struct pci_address { | ||
82 | u32 a_hi; | ||
83 | u32 a_mid; | ||
84 | u32 a_lo; | ||
85 | }; | ||
86 | |||
87 | struct isa_address { | ||
88 | u32 a_hi; | ||
89 | u32 a_lo; | ||
90 | }; | ||
91 | |||
92 | struct isa_range { | ||
93 | struct isa_address isa_addr; | ||
94 | struct pci_address pci_addr; | ||
95 | unsigned int size; | ||
96 | }; | ||
97 | |||
98 | struct reg_property { | ||
99 | unsigned long address; | ||
100 | unsigned long size; | ||
101 | }; | ||
102 | |||
103 | struct reg_property32 { | ||
104 | unsigned int address; | ||
105 | unsigned int size; | ||
106 | }; | ||
107 | |||
108 | struct reg_property64 { | ||
109 | unsigned long address; | ||
110 | unsigned long size; | ||
111 | }; | ||
112 | |||
113 | struct property { | ||
114 | char *name; | ||
115 | int length; | ||
116 | unsigned char *value; | ||
117 | struct property *next; | ||
118 | }; | ||
119 | |||
120 | struct device_node { | ||
121 | char *name; | ||
122 | char *type; | ||
123 | phandle node; | ||
124 | phandle linux_phandle; | ||
125 | int n_addrs; | ||
126 | struct address_range *addrs; | ||
127 | int n_intrs; | ||
128 | struct interrupt_info *intrs; | ||
129 | char *full_name; | ||
130 | |||
131 | struct property *properties; | ||
132 | struct device_node *parent; | ||
133 | struct device_node *child; | ||
134 | struct device_node *sibling; | ||
135 | struct device_node *next; /* next device of same type */ | ||
136 | struct device_node *allnext; /* next in list of all nodes */ | ||
137 | struct proc_dir_entry *pde; /* this node's proc directory */ | ||
138 | struct kref kref; | ||
139 | unsigned long _flags; | ||
140 | void *data; | ||
141 | #ifdef CONFIG_PPC_ISERIES | ||
142 | struct list_head Device_List; | ||
143 | #endif | ||
144 | }; | ||
145 | |||
146 | extern struct device_node *of_chosen; | ||
147 | |||
148 | /* flag descriptions */ | ||
149 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | ||
150 | |||
151 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | ||
152 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | ||
153 | |||
154 | /* | ||
155 | * Until 32-bit ppc can add proc_dir_entries to its device_node | ||
156 | * definition, we cannot refer to pde, name_link, and addr_link | ||
157 | * in arch-independent code. | ||
158 | */ | ||
159 | #define HAVE_ARCH_DEVTREE_FIXUPS | ||
160 | |||
161 | static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) | ||
162 | { | ||
163 | dn->pde = de; | ||
164 | } | ||
165 | |||
166 | |||
167 | /* OBSOLETE: Old stlye node lookup */ | ||
168 | extern struct device_node *find_devices(const char *name); | ||
169 | extern struct device_node *find_type_devices(const char *type); | ||
170 | extern struct device_node *find_path_device(const char *path); | ||
171 | extern struct device_node *find_compatible_devices(const char *type, | ||
172 | const char *compat); | ||
173 | extern struct device_node *find_all_nodes(void); | ||
174 | |||
175 | /* New style node lookup */ | ||
176 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
177 | const char *name); | ||
178 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
179 | const char *type); | ||
180 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
181 | const char *type, const char *compat); | ||
182 | extern struct device_node *of_find_node_by_path(const char *path); | ||
183 | extern struct device_node *of_find_node_by_phandle(phandle handle); | ||
184 | extern struct device_node *of_find_all_nodes(struct device_node *prev); | ||
185 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
186 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
187 | struct device_node *prev); | ||
188 | extern struct device_node *of_node_get(struct device_node *node); | ||
189 | extern void of_node_put(struct device_node *node); | ||
190 | |||
191 | /* For scanning the flat device-tree at boot time */ | ||
192 | int __init of_scan_flat_dt(int (*it)(unsigned long node, | ||
193 | const char *uname, int depth, | ||
194 | void *data), | ||
195 | void *data); | ||
196 | void* __init of_get_flat_dt_prop(unsigned long node, const char *name, | ||
197 | unsigned long *size); | ||
198 | |||
199 | /* For updating the device tree at runtime */ | ||
200 | extern void of_attach_node(struct device_node *); | ||
201 | extern void of_detach_node(const struct device_node *); | ||
202 | |||
203 | /* Other Prototypes */ | ||
204 | extern unsigned long prom_init(unsigned long, unsigned long, unsigned long, | ||
205 | unsigned long, unsigned long); | ||
206 | extern void finish_device_tree(void); | ||
207 | extern void unflatten_device_tree(void); | ||
208 | extern void early_init_devtree(void *); | ||
209 | extern int device_is_compatible(struct device_node *device, const char *); | ||
210 | extern int machine_is_compatible(const char *compat); | ||
211 | extern unsigned char *get_property(struct device_node *node, const char *name, | ||
212 | int *lenp); | ||
213 | extern void print_properties(struct device_node *node); | ||
214 | extern int prom_n_addr_cells(struct device_node* np); | ||
215 | extern int prom_n_size_cells(struct device_node* np); | ||
216 | extern int prom_n_intr_cells(struct device_node* np); | ||
217 | extern void prom_get_irq_senses(unsigned char *senses, int off, int max); | ||
218 | extern int prom_add_property(struct device_node* np, struct property* prop); | ||
219 | |||
220 | #endif /* _PPC64_PROM_H */ | ||
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h deleted file mode 100644 index bf9a6aba19c9..000000000000 --- a/include/asm-ppc64/system.h +++ /dev/null | |||
@@ -1,310 +0,0 @@ | |||
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/synch.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() eieio() | ||
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(int enable); | ||
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 set_dabr(unsigned long dabr); | ||
105 | extern void _exception(int signr, struct pt_regs *regs, int code, | ||
106 | unsigned long addr); | ||
107 | extern int fix_alignment(struct pt_regs *regs); | ||
108 | extern void bad_page_fault(struct pt_regs *regs, unsigned long address, | ||
109 | int sig); | ||
110 | extern void show_regs(struct pt_regs * regs); | ||
111 | extern void low_hash_fault(struct pt_regs *regs, unsigned long address); | ||
112 | extern int die(const char *str, struct pt_regs *regs, long err); | ||
113 | |||
114 | extern int _get_PVR(void); | ||
115 | extern void giveup_fpu(struct task_struct *); | ||
116 | extern void disable_kernel_fp(void); | ||
117 | extern void flush_fp_to_thread(struct task_struct *); | ||
118 | extern void enable_kernel_fp(void); | ||
119 | extern void giveup_altivec(struct task_struct *); | ||
120 | extern void disable_kernel_altivec(void); | ||
121 | extern void enable_kernel_altivec(void); | ||
122 | extern int emulate_altivec(struct pt_regs *); | ||
123 | extern void cvt_fd(float *from, double *to, struct thread_struct *thread); | ||
124 | extern void cvt_df(double *from, float *to, struct thread_struct *thread); | ||
125 | |||
126 | #ifdef CONFIG_ALTIVEC | ||
127 | extern void flush_altivec_to_thread(struct task_struct *); | ||
128 | #else | ||
129 | static inline void flush_altivec_to_thread(struct task_struct *t) | ||
130 | { | ||
131 | } | ||
132 | #endif | ||
133 | |||
134 | static inline void flush_spe_to_thread(struct task_struct *t) | ||
135 | { | ||
136 | } | ||
137 | |||
138 | extern int mem_init_done; /* set on boot once kmalloc can be called */ | ||
139 | extern unsigned long memory_limit; | ||
140 | |||
141 | /* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */ | ||
142 | extern unsigned char e2a(unsigned char); | ||
143 | |||
144 | extern struct task_struct *__switch_to(struct task_struct *, | ||
145 | struct task_struct *); | ||
146 | #define switch_to(prev, next, last) ((last) = __switch_to((prev), (next))) | ||
147 | |||
148 | struct thread_struct; | ||
149 | extern struct task_struct * _switch(struct thread_struct *prev, | ||
150 | struct thread_struct *next); | ||
151 | |||
152 | extern unsigned long klimit; | ||
153 | |||
154 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ | ||
155 | |||
156 | /* | ||
157 | * Atomic exchange | ||
158 | * | ||
159 | * Changes the memory location '*ptr' to be val and returns | ||
160 | * the previous value stored there. | ||
161 | * | ||
162 | * Inline asm pulled from arch/ppc/kernel/misc.S so ppc64 | ||
163 | * is more like most of the other architectures. | ||
164 | */ | ||
165 | static __inline__ unsigned long | ||
166 | __xchg_u32(volatile unsigned int *m, unsigned long val) | ||
167 | { | ||
168 | unsigned long dummy; | ||
169 | |||
170 | __asm__ __volatile__( | ||
171 | EIEIO_ON_SMP | ||
172 | "1: lwarx %0,0,%3 # __xchg_u32\n\ | ||
173 | stwcx. %2,0,%3\n\ | ||
174 | 2: bne- 1b" | ||
175 | ISYNC_ON_SMP | ||
176 | : "=&r" (dummy), "=m" (*m) | ||
177 | : "r" (val), "r" (m) | ||
178 | : "cc", "memory"); | ||
179 | |||
180 | return (dummy); | ||
181 | } | ||
182 | |||
183 | static __inline__ unsigned long | ||
184 | __xchg_u64(volatile long *m, unsigned long val) | ||
185 | { | ||
186 | unsigned long dummy; | ||
187 | |||
188 | __asm__ __volatile__( | ||
189 | EIEIO_ON_SMP | ||
190 | "1: ldarx %0,0,%3 # __xchg_u64\n\ | ||
191 | stdcx. %2,0,%3\n\ | ||
192 | 2: bne- 1b" | ||
193 | ISYNC_ON_SMP | ||
194 | : "=&r" (dummy), "=m" (*m) | ||
195 | : "r" (val), "r" (m) | ||
196 | : "cc", "memory"); | ||
197 | |||
198 | return (dummy); | ||
199 | } | ||
200 | |||
201 | /* | ||
202 | * This function doesn't exist, so you'll get a linker error | ||
203 | * if something tries to do an invalid xchg(). | ||
204 | */ | ||
205 | extern void __xchg_called_with_bad_pointer(void); | ||
206 | |||
207 | static __inline__ unsigned long | ||
208 | __xchg(volatile void *ptr, unsigned long x, unsigned int size) | ||
209 | { | ||
210 | switch (size) { | ||
211 | case 4: | ||
212 | return __xchg_u32(ptr, x); | ||
213 | case 8: | ||
214 | return __xchg_u64(ptr, x); | ||
215 | } | ||
216 | __xchg_called_with_bad_pointer(); | ||
217 | return x; | ||
218 | } | ||
219 | |||
220 | #define xchg(ptr,x) \ | ||
221 | ({ \ | ||
222 | __typeof__(*(ptr)) _x_ = (x); \ | ||
223 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \ | ||
224 | }) | ||
225 | |||
226 | #define tas(ptr) (xchg((ptr),1)) | ||
227 | |||
228 | #define __HAVE_ARCH_CMPXCHG 1 | ||
229 | |||
230 | static __inline__ unsigned long | ||
231 | __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new) | ||
232 | { | ||
233 | unsigned int prev; | ||
234 | |||
235 | __asm__ __volatile__ ( | ||
236 | EIEIO_ON_SMP | ||
237 | "1: lwarx %0,0,%2 # __cmpxchg_u32\n\ | ||
238 | cmpw 0,%0,%3\n\ | ||
239 | bne- 2f\n\ | ||
240 | stwcx. %4,0,%2\n\ | ||
241 | bne- 1b" | ||
242 | ISYNC_ON_SMP | ||
243 | "\n\ | ||
244 | 2:" | ||
245 | : "=&r" (prev), "=m" (*p) | ||
246 | : "r" (p), "r" (old), "r" (new), "m" (*p) | ||
247 | : "cc", "memory"); | ||
248 | |||
249 | return prev; | ||
250 | } | ||
251 | |||
252 | static __inline__ unsigned long | ||
253 | __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new) | ||
254 | { | ||
255 | unsigned long prev; | ||
256 | |||
257 | __asm__ __volatile__ ( | ||
258 | EIEIO_ON_SMP | ||
259 | "1: ldarx %0,0,%2 # __cmpxchg_u64\n\ | ||
260 | cmpd 0,%0,%3\n\ | ||
261 | bne- 2f\n\ | ||
262 | stdcx. %4,0,%2\n\ | ||
263 | bne- 1b" | ||
264 | ISYNC_ON_SMP | ||
265 | "\n\ | ||
266 | 2:" | ||
267 | : "=&r" (prev), "=m" (*p) | ||
268 | : "r" (p), "r" (old), "r" (new), "m" (*p) | ||
269 | : "cc", "memory"); | ||
270 | |||
271 | return prev; | ||
272 | } | ||
273 | |||
274 | /* This function doesn't exist, so you'll get a linker error | ||
275 | if something tries to do an invalid cmpxchg(). */ | ||
276 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
277 | |||
278 | static __inline__ unsigned long | ||
279 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, | ||
280 | unsigned int size) | ||
281 | { | ||
282 | switch (size) { | ||
283 | case 4: | ||
284 | return __cmpxchg_u32(ptr, old, new); | ||
285 | case 8: | ||
286 | return __cmpxchg_u64(ptr, old, new); | ||
287 | } | ||
288 | __cmpxchg_called_with_bad_pointer(); | ||
289 | return old; | ||
290 | } | ||
291 | |||
292 | #define cmpxchg(ptr,o,n)\ | ||
293 | ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ | ||
294 | (unsigned long)(n),sizeof(*(ptr)))) | ||
295 | |||
296 | /* | ||
297 | * We handle most unaligned accesses in hardware. On the other hand | ||
298 | * unaligned DMA can be very expensive on some ppc64 IO chips (it does | ||
299 | * powers of 2 writes until it reaches sufficient alignment). | ||
300 | * | ||
301 | * Based on this we disable the IP header alignment in network drivers. | ||
302 | */ | ||
303 | #define NET_IP_ALIGN 0 | ||
304 | |||
305 | #define arch_align_stack(x) (x) | ||
306 | |||
307 | extern unsigned long reloc_offset(void); | ||
308 | |||
309 | #endif /* __KERNEL__ */ | ||
310 | #endif | ||