diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-09 13:03:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-09 13:03:44 -0500 |
commit | 6150c32589d1976ca8a5c987df951088c05a7542 (patch) | |
tree | 94073696576323ff966e365d8c47b8ecd8372f97 /include/asm-powerpc | |
parent | 44637a12f80b80157d9c1bc5b7d6ef09c9e05713 (diff) | |
parent | be42d5fa3772241b8ecebd443f1fb36247959c54 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge
Diffstat (limited to 'include/asm-powerpc')
91 files changed, 2041 insertions, 182 deletions
diff --git a/include/asm-powerpc/abs_addr.h b/include/asm-powerpc/abs_addr.h index 18415108fc56..c5c3259e0f86 100644 --- a/include/asm-powerpc/abs_addr.h +++ b/include/asm-powerpc/abs_addr.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_ABS_ADDR_H | 1 | #ifndef _ASM_POWERPC_ABS_ADDR_H |
2 | #define _ASM_POWERPC_ABS_ADDR_H | 2 | #define _ASM_POWERPC_ABS_ADDR_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <linux/config.h> | 5 | #include <linux/config.h> |
5 | 6 | ||
@@ -70,4 +71,5 @@ static inline unsigned long phys_to_abs(unsigned long pa) | |||
70 | #define iseries_hv_addr(virtaddr) \ | 71 | #define iseries_hv_addr(virtaddr) \ |
71 | (0x8000000000000000 | virt_to_abs(virtaddr)) | 72 | (0x8000000000000000 | virt_to_abs(virtaddr)) |
72 | 73 | ||
74 | #endif /* __KERNEL__ */ | ||
73 | #endif /* _ASM_POWERPC_ABS_ADDR_H */ | 75 | #endif /* _ASM_POWERPC_ABS_ADDR_H */ |
diff --git a/include/asm-powerpc/agp.h b/include/asm-powerpc/agp.h index 885b4631a6cf..e5ccaca2f5a4 100644 --- a/include/asm-powerpc/agp.h +++ b/include/asm-powerpc/agp.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_AGP_H | 1 | #ifndef _ASM_POWERPC_AGP_H |
2 | #define _ASM_POWERPC_AGP_H | 2 | #define _ASM_POWERPC_AGP_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <asm/io.h> | 5 | #include <asm/io.h> |
5 | 6 | ||
@@ -18,4 +19,5 @@ | |||
18 | #define free_gatt_pages(table, order) \ | 19 | #define free_gatt_pages(table, order) \ |
19 | free_pages((unsigned long)(table), (order)) | 20 | free_pages((unsigned long)(table), (order)) |
20 | 21 | ||
22 | #endif /* __KERNEL__ */ | ||
21 | #endif /* _ASM_POWERPC_AGP_H */ | 23 | #endif /* _ASM_POWERPC_AGP_H */ |
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h index 8b133efc9f79..8e64be0cc47d 100644 --- a/include/asm-powerpc/asm-compat.h +++ b/include/asm-powerpc/asm-compat.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_ASM_COMPAT_H | 1 | #ifndef _ASM_POWERPC_ASM_COMPAT_H |
2 | #define _ASM_POWERPC_ASM_COMPAT_H | 2 | #define _ASM_POWERPC_ASM_COMPAT_H |
3 | 3 | ||
4 | #include <linux/config.h> | ||
5 | #include <asm/types.h> | 4 | #include <asm/types.h> |
6 | 5 | ||
7 | #ifdef __ASSEMBLY__ | 6 | #ifdef __ASSEMBLY__ |
@@ -41,6 +40,7 @@ | |||
41 | 40 | ||
42 | #endif | 41 | #endif |
43 | 42 | ||
43 | #ifdef __KERNEL__ | ||
44 | #ifdef CONFIG_IBM405_ERR77 | 44 | #ifdef CONFIG_IBM405_ERR77 |
45 | /* Erratum #77 on the 405 means we need a sync or dcbt before every | 45 | /* Erratum #77 on the 405 means we need a sync or dcbt before every |
46 | * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this. | 46 | * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this. |
@@ -51,5 +51,6 @@ | |||
51 | #define PPC405_ERR77(ra,rb) | 51 | #define PPC405_ERR77(ra,rb) |
52 | #define PPC405_ERR77_SYNC | 52 | #define PPC405_ERR77_SYNC |
53 | #endif | 53 | #endif |
54 | #endif | ||
54 | 55 | ||
55 | #endif /* _ASM_POWERPC_ASM_COMPAT_H */ | 56 | #endif /* _ASM_POWERPC_ASM_COMPAT_H */ |
diff --git a/include/asm-powerpc/bootx.h b/include/asm-powerpc/bootx.h new file mode 100644 index 000000000000..57b82e3f89ce --- /dev/null +++ b/include/asm-powerpc/bootx.h | |||
@@ -0,0 +1,171 @@ | |||
1 | /* | ||
2 | * This file describes the structure passed from the BootX application | ||
3 | * (for MacOS) when it is used to boot Linux. | ||
4 | * | ||
5 | * Written by Benjamin Herrenschmidt. | ||
6 | */ | ||
7 | |||
8 | |||
9 | #ifndef __ASM_BOOTX_H__ | ||
10 | #define __ASM_BOOTX_H__ | ||
11 | |||
12 | #include <asm/types.h> | ||
13 | |||
14 | #ifdef macintosh | ||
15 | #include <Types.h> | ||
16 | #include "linux_type_defs.h" | ||
17 | #endif | ||
18 | |||
19 | #ifdef macintosh | ||
20 | /* All this requires PowerPC alignment */ | ||
21 | #pragma options align=power | ||
22 | #endif | ||
23 | |||
24 | /* On kernel entry: | ||
25 | * | ||
26 | * r3 = 0x426f6f58 ('BooX') | ||
27 | * r4 = pointer to boot_infos | ||
28 | * r5 = NULL | ||
29 | * | ||
30 | * Data and instruction translation disabled, interrupts | ||
31 | * disabled, kernel loaded at physical 0x00000000 on PCI | ||
32 | * machines (will be different on NuBus). | ||
33 | */ | ||
34 | |||
35 | #define BOOT_INFO_VERSION 5 | ||
36 | #define BOOT_INFO_COMPATIBLE_VERSION 1 | ||
37 | |||
38 | /* Bit in the architecture flag mask. More to be defined in | ||
39 | future versions. Note that either BOOT_ARCH_PCI or | ||
40 | BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are | ||
41 | set additionally when BOOT_ARCH_NUBUS is set. | ||
42 | */ | ||
43 | #define BOOT_ARCH_PCI 0x00000001UL | ||
44 | #define BOOT_ARCH_NUBUS 0x00000002UL | ||
45 | #define BOOT_ARCH_NUBUS_PDM 0x00000010UL | ||
46 | #define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL | ||
47 | #define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL | ||
48 | |||
49 | /* Maximum number of ranges in phys memory map */ | ||
50 | #define MAX_MEM_MAP_SIZE 26 | ||
51 | |||
52 | /* This is the format of an element in the physical memory map. Note that | ||
53 | the map is optional and current BootX will only build it for pre-PCI | ||
54 | machines */ | ||
55 | typedef struct boot_info_map_entry | ||
56 | { | ||
57 | __u32 physAddr; /* Physical starting address */ | ||
58 | __u32 size; /* Size in bytes */ | ||
59 | } boot_info_map_entry_t; | ||
60 | |||
61 | |||
62 | /* Here are the boot informations that are passed to the bootstrap | ||
63 | * Note that the kernel arguments and the device tree are appended | ||
64 | * at the end of this structure. */ | ||
65 | typedef struct boot_infos | ||
66 | { | ||
67 | /* Version of this structure */ | ||
68 | __u32 version; | ||
69 | /* backward compatible down to version: */ | ||
70 | __u32 compatible_version; | ||
71 | |||
72 | /* NEW (vers. 2) this holds the current _logical_ base addr of | ||
73 | the frame buffer (for use by early boot message) */ | ||
74 | __u8* logicalDisplayBase; | ||
75 | |||
76 | /* NEW (vers. 4) Apple's machine identification */ | ||
77 | __u32 machineID; | ||
78 | |||
79 | /* NEW (vers. 4) Detected hw architecture */ | ||
80 | __u32 architecture; | ||
81 | |||
82 | /* The device tree (internal addresses relative to the beginning of the tree, | ||
83 | * device tree offset relative to the beginning of this structure). | ||
84 | * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this | ||
85 | * field is 0. | ||
86 | */ | ||
87 | __u32 deviceTreeOffset; /* Device tree offset */ | ||
88 | __u32 deviceTreeSize; /* Size of the device tree */ | ||
89 | |||
90 | /* Some infos about the current MacOS display */ | ||
91 | __u32 dispDeviceRect[4]; /* left,top,right,bottom */ | ||
92 | __u32 dispDeviceDepth; /* (8, 16 or 32) */ | ||
93 | __u8* dispDeviceBase; /* base address (physical) */ | ||
94 | __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */ | ||
95 | __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */ | ||
96 | /* Optional offset in the registry to the current | ||
97 | * MacOS display. (Can be 0 when not detected) */ | ||
98 | __u32 dispDeviceRegEntryOffset; | ||
99 | |||
100 | /* Optional pointer to boot ramdisk (offset from this structure) */ | ||
101 | __u32 ramDisk; | ||
102 | __u32 ramDiskSize; /* size of ramdisk image */ | ||
103 | |||
104 | /* Kernel command line arguments (offset from this structure) */ | ||
105 | __u32 kernelParamsOffset; | ||
106 | |||
107 | /* ALL BELOW NEW (vers. 4) */ | ||
108 | |||
109 | /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag | ||
110 | (non-PCI) only. On PCI, memory is contiguous and it's size is in the | ||
111 | device-tree. */ | ||
112 | boot_info_map_entry_t | ||
113 | physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */ | ||
114 | __u32 physMemoryMapSize; /* How many entries in map */ | ||
115 | |||
116 | |||
117 | /* The framebuffer size (optional, currently 0) */ | ||
118 | __u32 frameBufferSize; /* Represents a max size, can be 0. */ | ||
119 | |||
120 | /* NEW (vers. 5) */ | ||
121 | |||
122 | /* Total params size (args + colormap + device tree + ramdisk) */ | ||
123 | __u32 totalParamsSize; | ||
124 | |||
125 | } boot_infos_t; | ||
126 | |||
127 | #ifdef __KERNEL__ | ||
128 | /* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index | ||
129 | * is represented by 3 short words containing a 16 bits (unsigned) color | ||
130 | * component. Later versions may contain the gamma table for direct-color | ||
131 | * devices here. | ||
132 | */ | ||
133 | #define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL) | ||
134 | |||
135 | /* BootX passes the device-tree using a format that comes from earlier | ||
136 | * ppc32 kernels. This used to match what is in prom.h, but not anymore | ||
137 | * so we now define it here | ||
138 | */ | ||
139 | struct bootx_dt_prop { | ||
140 | u32 name; | ||
141 | int length; | ||
142 | u32 value; | ||
143 | u32 next; | ||
144 | }; | ||
145 | |||
146 | struct bootx_dt_node { | ||
147 | u32 unused0; | ||
148 | u32 unused1; | ||
149 | u32 phandle; /* not really available */ | ||
150 | u32 unused2; | ||
151 | u32 unused3; | ||
152 | u32 unused4; | ||
153 | u32 unused5; | ||
154 | u32 full_name; | ||
155 | u32 properties; | ||
156 | u32 parent; | ||
157 | u32 child; | ||
158 | u32 sibling; | ||
159 | u32 next; | ||
160 | u32 allnext; | ||
161 | }; | ||
162 | |||
163 | extern void bootx_init(unsigned long r4, unsigned long phys); | ||
164 | |||
165 | #endif /* __KERNEL__ */ | ||
166 | |||
167 | #ifdef macintosh | ||
168 | #pragma options align=reset | ||
169 | #endif | ||
170 | |||
171 | #endif | ||
diff --git a/include/asm-powerpc/btext.h b/include/asm-powerpc/btext.h index 71cce36bc630..906f46e31006 100644 --- a/include/asm-powerpc/btext.h +++ b/include/asm-powerpc/btext.h | |||
@@ -7,21 +7,22 @@ | |||
7 | #define __PPC_BTEXT_H | 7 | #define __PPC_BTEXT_H |
8 | #ifdef __KERNEL__ | 8 | #ifdef __KERNEL__ |
9 | 9 | ||
10 | extern void btext_clearscreen(void); | 10 | extern int btext_find_display(int allow_nonstdout); |
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, | 11 | extern void btext_update_display(unsigned long phys, int width, int height, |
20 | int depth, int pitch); | 12 | int depth, int pitch); |
13 | extern void btext_setup_display(int width, int height, int depth, int pitch, | ||
14 | unsigned long address); | ||
15 | extern void btext_prepare_BAT(void); | ||
16 | extern void btext_unmap(void); | ||
21 | 17 | ||
22 | extern void btext_drawchar(char c); | 18 | extern void btext_drawchar(char c); |
23 | extern void btext_drawstring(const char *str); | 19 | extern void btext_drawstring(const char *str); |
24 | extern void btext_drawhex(unsigned long v); | 20 | extern void btext_drawhex(unsigned long v); |
21 | extern void btext_drawtext(const char *c, unsigned int len); | ||
22 | |||
23 | extern void btext_clearscreen(void); | ||
24 | extern void btext_flushscreen(void); | ||
25 | extern void btext_flushline(void); | ||
25 | 26 | ||
26 | #endif /* __KERNEL__ */ | 27 | #endif /* __KERNEL__ */ |
27 | #endif /* __PPC_BTEXT_H */ | 28 | #endif /* __PPC_BTEXT_H */ |
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h index b001ecb3cd99..99817a802ca4 100644 --- a/include/asm-powerpc/bug.h +++ b/include/asm-powerpc/bug.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_BUG_H | 1 | #ifndef _ASM_POWERPC_BUG_H |
2 | #define _ASM_POWERPC_BUG_H | 2 | #define _ASM_POWERPC_BUG_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <asm/asm-compat.h> | 5 | #include <asm/asm-compat.h> |
5 | /* | 6 | /* |
@@ -67,4 +68,5 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
67 | 68 | ||
68 | #include <asm-generic/bug.h> | 69 | #include <asm-generic/bug.h> |
69 | 70 | ||
71 | #endif /* __KERNEL__ */ | ||
70 | #endif /* _ASM_POWERPC_BUG_H */ | 72 | #endif /* _ASM_POWERPC_BUG_H */ |
diff --git a/include/asm-powerpc/checksum.h b/include/asm-powerpc/checksum.h index d8354d8a49ce..609ecbbd7210 100644 --- a/include/asm-powerpc/checksum.h +++ b/include/asm-powerpc/checksum.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_CHECKSUM_H | 1 | #ifndef _ASM_POWERPC_CHECKSUM_H |
2 | #define _ASM_POWERPC_CHECKSUM_H | 2 | #define _ASM_POWERPC_CHECKSUM_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -129,4 +130,5 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, | |||
129 | } | 130 | } |
130 | 131 | ||
131 | #endif | 132 | #endif |
133 | #endif /* __KERNEL__ */ | ||
132 | #endif | 134 | #endif |
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h index 4db4360c4d4a..accb80c9a339 100644 --- a/include/asm-powerpc/compat.h +++ b/include/asm-powerpc/compat.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_COMPAT_H | 1 | #ifndef _ASM_POWERPC_COMPAT_H |
2 | #define _ASM_POWERPC_COMPAT_H | 2 | #define _ASM_POWERPC_COMPAT_H |
3 | #ifdef __KERNEL__ | ||
3 | /* | 4 | /* |
4 | * Architecture specific compatibility types | 5 | * Architecture specific compatibility types |
5 | */ | 6 | */ |
@@ -202,4 +203,5 @@ struct compat_shmid64_ds { | |||
202 | compat_ulong_t __unused6; | 203 | compat_ulong_t __unused6; |
203 | }; | 204 | }; |
204 | 205 | ||
206 | #endif /* __KERNEL__ */ | ||
205 | #endif /* _ASM_POWERPC_COMPAT_H */ | 207 | #endif /* _ASM_POWERPC_COMPAT_H */ |
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index d1cfa3f515ea..ef6ead34a773 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __ASM_POWERPC_CPUTABLE_H | 1 | #ifndef __ASM_POWERPC_CPUTABLE_H |
2 | #define __ASM_POWERPC_CPUTABLE_H | 2 | #define __ASM_POWERPC_CPUTABLE_H |
3 | 3 | ||
4 | #include <linux/config.h> | ||
5 | #include <asm/asm-compat.h> | 4 | #include <asm/asm-compat.h> |
6 | 5 | ||
7 | #define PPC_FEATURE_32 0x80000000 | 6 | #define PPC_FEATURE_32 0x80000000 |
@@ -28,10 +27,17 @@ | |||
28 | * via the mkdefs mechanism. | 27 | * via the mkdefs mechanism. |
29 | */ | 28 | */ |
30 | struct cpu_spec; | 29 | struct cpu_spec; |
31 | struct op_powerpc_model; | ||
32 | 30 | ||
33 | typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); | 31 | typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); |
34 | 32 | ||
33 | enum powerpc_oprofile_type { | ||
34 | INVALID = 0, | ||
35 | RS64 = 1, | ||
36 | POWER4 = 2, | ||
37 | G4 = 3, | ||
38 | BOOKE = 4, | ||
39 | }; | ||
40 | |||
35 | struct cpu_spec { | 41 | struct cpu_spec { |
36 | /* CPU is matched via (PVR & pvr_mask) == pvr_value */ | 42 | /* CPU is matched via (PVR & pvr_mask) == pvr_value */ |
37 | unsigned int pvr_mask; | 43 | unsigned int pvr_mask; |
@@ -57,7 +63,7 @@ struct cpu_spec { | |||
57 | char *oprofile_cpu_type; | 63 | char *oprofile_cpu_type; |
58 | 64 | ||
59 | /* Processor specific oprofile operations */ | 65 | /* Processor specific oprofile operations */ |
60 | struct op_powerpc_model *oprofile_model; | 66 | enum powerpc_oprofile_type oprofile_type; |
61 | }; | 67 | }; |
62 | 68 | ||
63 | extern struct cpu_spec *cur_cpu_spec; | 69 | extern struct cpu_spec *cur_cpu_spec; |
@@ -106,6 +112,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); | |||
106 | #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) | 112 | #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) |
107 | #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) | 113 | #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) |
108 | #define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) | 114 | #define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) |
115 | #define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000) | ||
109 | #else | 116 | #else |
110 | /* ensure on 32b processors the flags are available for compiling but | 117 | /* ensure on 32b processors the flags are available for compiling but |
111 | * don't do anything */ | 118 | * don't do anything */ |
@@ -305,12 +312,18 @@ enum { | |||
305 | CPU_FTR_MMCRA_SIHV, | 312 | CPU_FTR_MMCRA_SIHV, |
306 | CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | | 313 | CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | |
307 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | | 314 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | |
308 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT, | 315 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | |
316 | CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO, | ||
309 | CPU_FTRS_COMPATIBLE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | | 317 | CPU_FTRS_COMPATIBLE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | |
310 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2, | 318 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2, |
311 | #endif | 319 | #endif |
312 | 320 | ||
313 | CPU_FTRS_POSSIBLE = | 321 | CPU_FTRS_POSSIBLE = |
322 | #ifdef __powerpc64__ | ||
323 | CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | | ||
324 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL | | ||
325 | CPU_FTR_CI_LARGE_PAGE | | ||
326 | #else | ||
314 | #if CLASSIC_PPC | 327 | #if CLASSIC_PPC |
315 | CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | | 328 | CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | |
316 | CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | | 329 | CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | |
@@ -344,14 +357,14 @@ enum { | |||
344 | #ifdef CONFIG_E500 | 357 | #ifdef CONFIG_E500 |
345 | CPU_FTRS_E500 | CPU_FTRS_E500_2 | | 358 | CPU_FTRS_E500 | CPU_FTRS_E500_2 | |
346 | #endif | 359 | #endif |
347 | #ifdef __powerpc64__ | 360 | #endif /* __powerpc64__ */ |
348 | CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | | ||
349 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL | | ||
350 | CPU_FTR_CI_LARGE_PAGE | | ||
351 | #endif | ||
352 | 0, | 361 | 0, |
353 | 362 | ||
354 | CPU_FTRS_ALWAYS = | 363 | CPU_FTRS_ALWAYS = |
364 | #ifdef __powerpc64__ | ||
365 | CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & | ||
366 | CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_CELL & | ||
367 | #else | ||
355 | #if CLASSIC_PPC | 368 | #if CLASSIC_PPC |
356 | CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & | 369 | CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & |
357 | CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & | 370 | CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & |
@@ -385,10 +398,7 @@ enum { | |||
385 | #ifdef CONFIG_E500 | 398 | #ifdef CONFIG_E500 |
386 | CPU_FTRS_E500 & CPU_FTRS_E500_2 & | 399 | CPU_FTRS_E500 & CPU_FTRS_E500_2 & |
387 | #endif | 400 | #endif |
388 | #ifdef __powerpc64__ | 401 | #endif /* __powerpc64__ */ |
389 | CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & | ||
390 | CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_CELL & | ||
391 | #endif | ||
392 | CPU_FTRS_POSSIBLE, | 402 | CPU_FTRS_POSSIBLE, |
393 | }; | 403 | }; |
394 | 404 | ||
diff --git a/include/asm-powerpc/current.h b/include/asm-powerpc/current.h index 82cd4a9ca99a..1938d6abd255 100644 --- a/include/asm-powerpc/current.h +++ b/include/asm-powerpc/current.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_CURRENT_H | 1 | #ifndef _ASM_POWERPC_CURRENT_H |
2 | #define _ASM_POWERPC_CURRENT_H | 2 | #define _ASM_POWERPC_CURRENT_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -24,4 +25,5 @@ register struct task_struct *current asm ("r2"); | |||
24 | 25 | ||
25 | #endif | 26 | #endif |
26 | 27 | ||
28 | #endif /* __KERNEL__ */ | ||
27 | #endif /* _ASM_POWERPC_CURRENT_H */ | 29 | #endif /* _ASM_POWERPC_CURRENT_H */ |
diff --git a/include/asm-powerpc/delay.h b/include/asm-powerpc/delay.h index 54fe1f4f8fd0..057a60955474 100644 --- a/include/asm-powerpc/delay.h +++ b/include/asm-powerpc/delay.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_DELAY_H | 1 | #ifndef _ASM_POWERPC_DELAY_H |
2 | #define _ASM_POWERPC_DELAY_H | 2 | #define _ASM_POWERPC_DELAY_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * Copyright 1996, Paul Mackerras. | 6 | * Copyright 1996, Paul Mackerras. |
@@ -16,4 +17,5 @@ | |||
16 | extern void __delay(unsigned long loops); | 17 | extern void __delay(unsigned long loops); |
17 | extern void udelay(unsigned long usecs); | 18 | extern void udelay(unsigned long usecs); |
18 | 19 | ||
20 | #endif /* __KERNEL__ */ | ||
19 | #endif /* _ASM_POWERPC_DELAY_H */ | 21 | #endif /* _ASM_POWERPC_DELAY_H */ |
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h index a96e5742ca32..837756ab7dc7 100644 --- a/include/asm-powerpc/dma-mapping.h +++ b/include/asm-powerpc/dma-mapping.h | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | #ifndef _ASM_DMA_MAPPING_H | 7 | #ifndef _ASM_DMA_MAPPING_H |
8 | #define _ASM_DMA_MAPPING_H | 8 | #define _ASM_DMA_MAPPING_H |
9 | #ifdef __KERNEL__ | ||
9 | 10 | ||
10 | #include <linux/config.h> | 11 | #include <linux/config.h> |
11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
@@ -282,4 +283,5 @@ struct dma_mapping_ops { | |||
282 | int (*dac_dma_supported)(struct device *dev, u64 mask); | 283 | int (*dac_dma_supported)(struct device *dev, u64 mask); |
283 | }; | 284 | }; |
284 | 285 | ||
286 | #endif /* __KERNEL__ */ | ||
285 | #endif /* _ASM_DMA_MAPPING_H */ | 287 | #endif /* _ASM_DMA_MAPPING_H */ |
diff --git a/include/asm-powerpc/dma.h b/include/asm-powerpc/dma.h index 926378d2cd94..4bb57fe37097 100644 --- a/include/asm-powerpc/dma.h +++ b/include/asm-powerpc/dma.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_DMA_H | 1 | #ifndef _ASM_POWERPC_DMA_H |
2 | #define _ASM_POWERPC_DMA_H | 2 | #define _ASM_POWERPC_DMA_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * Defines for using and allocating dma channels. | 6 | * Defines for using and allocating dma channels. |
@@ -387,4 +388,5 @@ extern int isa_dma_bridge_buggy; | |||
387 | 388 | ||
388 | #endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */ | 389 | #endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */ |
389 | 390 | ||
391 | #endif /* __KERNEL__ */ | ||
390 | #endif /* _ASM_POWERPC_DMA_H */ | 392 | #endif /* _ASM_POWERPC_DMA_H */ |
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h index f8633aafe4ba..4395b7bc1ed4 100644 --- a/include/asm-powerpc/eeh.h +++ b/include/asm-powerpc/eeh.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #ifndef _PPC64_EEH_H | 20 | #ifndef _PPC64_EEH_H |
21 | #define _PPC64_EEH_H | 21 | #define _PPC64_EEH_H |
22 | #ifdef __KERNEL__ | ||
22 | 23 | ||
23 | #include <linux/config.h> | 24 | #include <linux/config.h> |
24 | #include <linux/init.h> | 25 | #include <linux/init.h> |
@@ -57,6 +58,7 @@ void __init pci_addr_cache_build(void); | |||
57 | * to finish the eeh setup for this device. | 58 | * to finish the eeh setup for this device. |
58 | */ | 59 | */ |
59 | void eeh_add_device_early(struct device_node *); | 60 | void eeh_add_device_early(struct device_node *); |
61 | void eeh_add_device_tree_early(struct device_node *); | ||
60 | void eeh_add_device_late(struct pci_dev *); | 62 | void eeh_add_device_late(struct pci_dev *); |
61 | 63 | ||
62 | /** | 64 | /** |
@@ -72,6 +74,15 @@ void eeh_add_device_late(struct pci_dev *); | |||
72 | void eeh_remove_device(struct pci_dev *); | 74 | void eeh_remove_device(struct pci_dev *); |
73 | 75 | ||
74 | /** | 76 | /** |
77 | * eeh_remove_device_recursive - undo EEH for device & children. | ||
78 | * @dev: pci device to be removed | ||
79 | * | ||
80 | * As above, this removes the device; it also removes child | ||
81 | * pci devices as well. | ||
82 | */ | ||
83 | void eeh_remove_bus_device(struct pci_dev *); | ||
84 | |||
85 | /** | ||
75 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. | 86 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. |
76 | * | 87 | * |
77 | * If this macro yields TRUE, the caller relays to eeh_check_failure() | 88 | * If this macro yields TRUE, the caller relays to eeh_check_failure() |
@@ -107,6 +118,9 @@ static inline void eeh_add_device_late(struct pci_dev *dev) { } | |||
107 | 118 | ||
108 | static inline void eeh_remove_device(struct pci_dev *dev) { } | 119 | static inline void eeh_remove_device(struct pci_dev *dev) { } |
109 | 120 | ||
121 | static inline void eeh_add_device_tree_early(struct device_node *dn) { } | ||
122 | |||
123 | static inline void eeh_remove_bus_device(struct pci_dev *dev) { } | ||
110 | #define EEH_POSSIBLE_ERROR(val, type) (0) | 124 | #define EEH_POSSIBLE_ERROR(val, type) (0) |
111 | #define EEH_IO_ERROR_VALUE(size) (-1UL) | 125 | #define EEH_IO_ERROR_VALUE(size) (-1UL) |
112 | #endif /* CONFIG_EEH */ | 126 | #endif /* CONFIG_EEH */ |
@@ -363,4 +377,5 @@ static inline void eeh_insl_ns(unsigned long port, void * buf, int nl) | |||
363 | eeh_check_failure((void __iomem *)(port), *(u32*)buf); | 377 | eeh_check_failure((void __iomem *)(port), *(u32*)buf); |
364 | } | 378 | } |
365 | 379 | ||
380 | #endif /* __KERNEL__ */ | ||
366 | #endif /* _PPC64_EEH_H */ | 381 | #endif /* _PPC64_EEH_H */ |
diff --git a/include/asm-powerpc/eeh_event.h b/include/asm-powerpc/eeh_event.h index d168a30b3866..5e11a00b6fa0 100644 --- a/include/asm-powerpc/eeh_event.h +++ b/include/asm-powerpc/eeh_event.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #ifndef ASM_PPC64_EEH_EVENT_H | 21 | #ifndef ASM_PPC64_EEH_EVENT_H |
22 | #define ASM_PPC64_EEH_EVENT_H | 22 | #define ASM_PPC64_EEH_EVENT_H |
23 | #ifdef __KERNEL__ | ||
23 | 24 | ||
24 | /** EEH event -- structure holding pci controller data that describes | 25 | /** EEH event -- structure holding pci controller data that describes |
25 | * a change in the isolation status of a PCI slot. A pointer | 26 | * a change in the isolation status of a PCI slot. A pointer |
@@ -49,4 +50,5 @@ int eeh_send_failure_event (struct device_node *dn, | |||
49 | int reset_state, | 50 | int reset_state, |
50 | int time_unavail); | 51 | int time_unavail); |
51 | 52 | ||
53 | #endif /* __KERNEL__ */ | ||
52 | #endif /* ASM_PPC64_EEH_EVENT_H */ | 54 | #endif /* ASM_PPC64_EEH_EVENT_H */ |
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h index 3dcd65edf978..c5a635d9bba4 100644 --- a/include/asm-powerpc/elf.h +++ b/include/asm-powerpc/elf.h | |||
@@ -1,7 +1,10 @@ | |||
1 | #ifndef _ASM_POWERPC_ELF_H | 1 | #ifndef _ASM_POWERPC_ELF_H |
2 | #define _ASM_POWERPC_ELF_H | 2 | #define _ASM_POWERPC_ELF_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
4 | #include <linux/sched.h> /* for task_struct */ | 5 | #include <linux/sched.h> /* for task_struct */ |
6 | #endif | ||
7 | |||
5 | #include <asm/types.h> | 8 | #include <asm/types.h> |
6 | #include <asm/ptrace.h> | 9 | #include <asm/ptrace.h> |
7 | #include <asm/cputable.h> | 10 | #include <asm/cputable.h> |
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h index 12fabbcb04f0..f804b34cf06a 100644 --- a/include/asm-powerpc/firmware.h +++ b/include/asm-powerpc/firmware.h | |||
@@ -98,6 +98,12 @@ typedef struct { | |||
98 | extern firmware_feature_t firmware_features_table[]; | 98 | extern firmware_feature_t firmware_features_table[]; |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | extern void system_reset_fwnmi(void); | ||
102 | extern void machine_check_fwnmi(void); | ||
103 | |||
104 | /* This is true if we are using the firmware NMI handler (typically LPAR) */ | ||
105 | extern int fwnmi_active; | ||
106 | |||
101 | #endif /* __ASSEMBLY__ */ | 107 | #endif /* __ASSEMBLY__ */ |
102 | #endif /* __KERNEL__ */ | 108 | #endif /* __KERNEL__ */ |
103 | #endif /* __ASM_POWERPC_FIRMWARE_H */ | 109 | #endif /* __ASM_POWERPC_FIRMWARE_H */ |
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h index 64276a3f6153..e258778ca429 100644 --- a/include/asm-powerpc/floppy.h +++ b/include/asm-powerpc/floppy.h | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | #ifndef __ASM_POWERPC_FLOPPY_H | 10 | #ifndef __ASM_POWERPC_FLOPPY_H |
11 | #define __ASM_POWERPC_FLOPPY_H | 11 | #define __ASM_POWERPC_FLOPPY_H |
12 | #ifdef __KERNEL__ | ||
12 | 13 | ||
13 | #include <linux/config.h> | 14 | #include <linux/config.h> |
14 | #include <asm/machdep.h> | 15 | #include <asm/machdep.h> |
@@ -102,4 +103,5 @@ static int FDC2 = -1; | |||
102 | 103 | ||
103 | #define EXTRA_FLOPPY_PARAMS | 104 | #define EXTRA_FLOPPY_PARAMS |
104 | 105 | ||
106 | #endif /* __KERNEL__ */ | ||
105 | #endif /* __ASM_POWERPC_FLOPPY_H */ | 107 | #endif /* __ASM_POWERPC_FLOPPY_H */ |
diff --git a/include/asm-powerpc/grackle.h b/include/asm-powerpc/grackle.h index 563c7a5e64c9..bd7812a519d4 100644 --- a/include/asm-powerpc/grackle.h +++ b/include/asm-powerpc/grackle.h | |||
@@ -1,3 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_GRACKLE_H | ||
2 | #define _ASM_POWERPC_GRACKLE_H | ||
3 | #ifdef __KERNEL__ | ||
1 | /* | 4 | /* |
2 | * Functions for setting up and using a MPC106 northbridge | 5 | * Functions for setting up and using a MPC106 northbridge |
3 | */ | 6 | */ |
@@ -5,3 +8,5 @@ | |||
5 | #include <asm/pci-bridge.h> | 8 | #include <asm/pci-bridge.h> |
6 | 9 | ||
7 | extern void setup_grackle(struct pci_controller *hose); | 10 | extern void setup_grackle(struct pci_controller *hose); |
11 | #endif /* __KERNEL__ */ | ||
12 | #endif /* _ASM_POWERPC_GRACKLE_H */ | ||
diff --git a/include/asm-powerpc/hardirq.h b/include/asm-powerpc/hardirq.h index 3b3e3b49ec12..288e14d53b7f 100644 --- a/include/asm-powerpc/hardirq.h +++ b/include/asm-powerpc/hardirq.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_HARDIRQ_H | 1 | #ifndef _ASM_POWERPC_HARDIRQ_H |
2 | #define _ASM_POWERPC_HARDIRQ_H | 2 | #define _ASM_POWERPC_HARDIRQ_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <asm/irq.h> | 5 | #include <asm/irq.h> |
5 | #include <asm/bug.h> | 6 | #include <asm/bug.h> |
@@ -24,4 +25,5 @@ static inline void ack_bad_irq(int irq) | |||
24 | BUG(); | 25 | BUG(); |
25 | } | 26 | } |
26 | 27 | ||
28 | #endif /* __KERNEL__ */ | ||
27 | #endif /* _ASM_POWERPC_HARDIRQ_H */ | 29 | #endif /* _ASM_POWERPC_HARDIRQ_H */ |
diff --git a/include/asm-powerpc/heathrow.h b/include/asm-powerpc/heathrow.h index 22ac179856b9..93f54958a9d1 100644 --- a/include/asm-powerpc/heathrow.h +++ b/include/asm-powerpc/heathrow.h | |||
@@ -1,3 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_HEATHROW_H | ||
2 | #define _ASM_POWERPC_HEATHROW_H | ||
3 | #ifdef __KERNEL__ | ||
1 | /* | 4 | /* |
2 | * heathrow.h: definitions for using the "Heathrow" I/O controller chip. | 5 | * heathrow.h: definitions for using the "Heathrow" I/O controller chip. |
3 | * | 6 | * |
@@ -60,3 +63,5 @@ | |||
60 | /* Looks like Heathrow has some sort of GPIOs as well... */ | 63 | /* Looks like Heathrow has some sort of GPIOs as well... */ |
61 | #define HRW_GPIO_MODEM_RESET 0x6d | 64 | #define HRW_GPIO_MODEM_RESET 0x6d |
62 | 65 | ||
66 | #endif /* __KERNEL__ */ | ||
67 | #endif /* _ASM_POWERPC_HEATHROW_H */ | ||
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h index d36da61dbc53..da7af5a720e0 100644 --- a/include/asm-powerpc/hvcall.h +++ b/include/asm-powerpc/hvcall.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_HVCALL_H | 1 | #ifndef _ASM_POWERPC_HVCALL_H |
2 | #define _ASM_POWERPC_HVCALL_H | 2 | #define _ASM_POWERPC_HVCALL_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #define HVSC .long 0x44000022 | 5 | #define HVSC .long 0x44000022 |
5 | 6 | ||
@@ -170,4 +171,5 @@ long plpar_hcall_4out(unsigned long opcode, | |||
170 | unsigned long *out4); | 171 | unsigned long *out4); |
171 | 172 | ||
172 | #endif /* __ASSEMBLY__ */ | 173 | #endif /* __ASSEMBLY__ */ |
174 | #endif /* __KERNEL__ */ | ||
173 | #endif /* _ASM_POWERPC_HVCALL_H */ | 175 | #endif /* _ASM_POWERPC_HVCALL_H */ |
diff --git a/include/asm-powerpc/hvconsole.h b/include/asm-powerpc/hvconsole.h index 6da93ce74dc0..34daf7b9b62f 100644 --- a/include/asm-powerpc/hvconsole.h +++ b/include/asm-powerpc/hvconsole.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #ifndef _PPC64_HVCONSOLE_H | 22 | #ifndef _PPC64_HVCONSOLE_H |
23 | #define _PPC64_HVCONSOLE_H | 23 | #define _PPC64_HVCONSOLE_H |
24 | #ifdef __KERNEL__ | ||
24 | 25 | ||
25 | /* | 26 | /* |
26 | * This is the max number of console adapters that can/will be found as | 27 | * This is the max number of console adapters that can/will be found as |
@@ -46,4 +47,5 @@ extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, | |||
46 | struct hv_ops *ops); | 47 | struct hv_ops *ops); |
47 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ | 48 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ |
48 | extern int __devexit hvc_remove(struct hvc_struct *hp); | 49 | extern int __devexit hvc_remove(struct hvc_struct *hp); |
50 | #endif /* __KERNEL__ */ | ||
49 | #endif /* _PPC64_HVCONSOLE_H */ | 51 | #endif /* _PPC64_HVCONSOLE_H */ |
diff --git a/include/asm-powerpc/hvcserver.h b/include/asm-powerpc/hvcserver.h index aecba9665796..67d7da3a4da4 100644 --- a/include/asm-powerpc/hvcserver.h +++ b/include/asm-powerpc/hvcserver.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #ifndef _PPC64_HVCSERVER_H | 22 | #ifndef _PPC64_HVCSERVER_H |
23 | #define _PPC64_HVCSERVER_H | 23 | #define _PPC64_HVCSERVER_H |
24 | #ifdef __KERNEL__ | ||
24 | 25 | ||
25 | #include <linux/list.h> | 26 | #include <linux/list.h> |
26 | 27 | ||
@@ -54,4 +55,5 @@ extern int hvcs_register_connection(uint32_t unit_address, | |||
54 | uint32_t p_partition_ID, uint32_t p_unit_address); | 55 | uint32_t p_partition_ID, uint32_t p_unit_address); |
55 | extern int hvcs_free_connection(uint32_t unit_address); | 56 | extern int hvcs_free_connection(uint32_t unit_address); |
56 | 57 | ||
58 | #endif /* __KERNEL__ */ | ||
57 | #endif /* _PPC64_HVCSERVER_H */ | 59 | #endif /* _PPC64_HVCSERVER_H */ |
diff --git a/include/asm-powerpc/i8259.h b/include/asm-powerpc/i8259.h index fc4bfee124d7..0392159e16e4 100644 --- a/include/asm-powerpc/i8259.h +++ b/include/asm-powerpc/i8259.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_I8259_H | 1 | #ifndef _ASM_POWERPC_I8259_H |
2 | #define _ASM_POWERPC_I8259_H | 2 | #define _ASM_POWERPC_I8259_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <linux/irq.h> | 5 | #include <linux/irq.h> |
5 | 6 | ||
@@ -9,4 +10,5 @@ extern void i8259_init(unsigned long intack_addr, int offset); | |||
9 | extern int i8259_irq(struct pt_regs *regs); | 10 | extern int i8259_irq(struct pt_regs *regs); |
10 | extern int i8259_irq_cascade(struct pt_regs *regs, void *unused); | 11 | extern int i8259_irq_cascade(struct pt_regs *regs, void *unused); |
11 | 12 | ||
13 | #endif /* __KERNEL__ */ | ||
12 | #endif /* _ASM_POWERPC_I8259_H */ | 14 | #endif /* _ASM_POWERPC_I8259_H */ |
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h new file mode 100644 index 000000000000..7a42723d107c --- /dev/null +++ b/include/asm-powerpc/ibmebus.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * IBM PowerPC eBus Infrastructure Support. | ||
3 | * | ||
4 | * Copyright (c) 2005 IBM Corporation | ||
5 | * Heiko J Schick <schickhj@de.ibm.com> | ||
6 | * | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * This source code is distributed under a dual license of GPL v2.0 and OpenIB | ||
10 | * BSD. | ||
11 | * | ||
12 | * OpenIB BSD License | ||
13 | * | ||
14 | * Redistribution and use in source and binary forms, with or without | ||
15 | * modification, are permitted provided that the following conditions are met: | ||
16 | * | ||
17 | * Redistributions of source code must retain the above copyright notice, this | ||
18 | * list of conditions and the following disclaimer. | ||
19 | * | ||
20 | * Redistributions in binary form must reproduce the above copyright notice, | ||
21 | * this list of conditions and the following disclaimer in the documentation | ||
22 | * and/or other materials | ||
23 | * provided with the distribution. | ||
24 | * | ||
25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
32 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
33 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
35 | * POSSIBILITY OF SUCH DAMAGE. | ||
36 | */ | ||
37 | |||
38 | #ifndef _ASM_EBUS_H | ||
39 | #define _ASM_EBUS_H | ||
40 | #ifdef __KERNEL__ | ||
41 | |||
42 | #include <linux/device.h> | ||
43 | #include <linux/interrupt.h> | ||
44 | #include <linux/mod_devicetable.h> | ||
45 | #include <asm/of_device.h> | ||
46 | |||
47 | extern struct dma_mapping_ops ibmebus_dma_ops; | ||
48 | extern struct bus_type ibmebus_bus_type; | ||
49 | |||
50 | struct ibmebus_dev { | ||
51 | char *name; | ||
52 | struct of_device ofdev; | ||
53 | }; | ||
54 | |||
55 | struct ibmebus_driver { | ||
56 | char *name; | ||
57 | struct of_device_id *id_table; | ||
58 | int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id); | ||
59 | int (*remove) (struct ibmebus_dev *dev); | ||
60 | struct device_driver driver; | ||
61 | }; | ||
62 | |||
63 | int ibmebus_register_driver(struct ibmebus_driver *drv); | ||
64 | void ibmebus_unregister_driver(struct ibmebus_driver *drv); | ||
65 | |||
66 | int ibmebus_request_irq(struct ibmebus_dev *dev, | ||
67 | u32 ist, | ||
68 | irqreturn_t (*handler)(int, void*, struct pt_regs *), | ||
69 | unsigned long irq_flags, const char * devname, | ||
70 | void *dev_id); | ||
71 | void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id); | ||
72 | |||
73 | static inline struct ibmebus_driver *to_ibmebus_driver(struct device_driver *drv) | ||
74 | { | ||
75 | return container_of(drv, struct ibmebus_driver, driver); | ||
76 | } | ||
77 | |||
78 | static inline struct ibmebus_dev *to_ibmebus_dev(struct device *dev) | ||
79 | { | ||
80 | return container_of(dev, struct ibmebus_dev, ofdev.dev); | ||
81 | } | ||
82 | |||
83 | |||
84 | #endif /* __KERNEL__ */ | ||
85 | #endif /* _ASM_IBMEBUS_H */ | ||
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h index 48938d84d055..68efbea379c9 100644 --- a/include/asm-powerpc/io.h +++ b/include/asm-powerpc/io.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_IO_H | 1 | #ifndef _ASM_POWERPC_IO_H |
2 | #define _ASM_POWERPC_IO_H | 2 | #define _ASM_POWERPC_IO_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -186,7 +187,6 @@ extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); | |||
186 | #define IO_SPACE_LIMIT ~(0UL) | 187 | #define IO_SPACE_LIMIT ~(0UL) |
187 | 188 | ||
188 | 189 | ||
189 | #ifdef __KERNEL__ | ||
190 | extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr, | 190 | extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr, |
191 | unsigned long size, unsigned long flags); | 191 | unsigned long size, unsigned long flags); |
192 | extern void __iomem *__ioremap(unsigned long address, unsigned long size, | 192 | extern void __iomem *__ioremap(unsigned long address, unsigned long size, |
@@ -256,8 +256,6 @@ static inline void * phys_to_virt(unsigned long address) | |||
256 | */ | 256 | */ |
257 | #define BIO_VMERGE_BOUNDARY 0 | 257 | #define BIO_VMERGE_BOUNDARY 0 |
258 | 258 | ||
259 | #endif /* __KERNEL__ */ | ||
260 | |||
261 | static inline void iosync(void) | 259 | static inline void iosync(void) |
262 | { | 260 | { |
263 | __asm__ __volatile__ ("sync" : : : "memory"); | 261 | __asm__ __volatile__ ("sync" : : : "memory"); |
@@ -405,8 +403,6 @@ static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long | |||
405 | #include <asm/eeh.h> | 403 | #include <asm/eeh.h> |
406 | #endif | 404 | #endif |
407 | 405 | ||
408 | #ifdef __KERNEL__ | ||
409 | |||
410 | /** | 406 | /** |
411 | * check_signature - find BIOS signatures | 407 | * check_signature - find BIOS signatures |
412 | * @io_addr: mmio address to check | 408 | * @io_addr: mmio address to check |
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h index f89f06050893..8a8393e50774 100644 --- a/include/asm-powerpc/iommu.h +++ b/include/asm-powerpc/iommu.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #ifndef _ASM_IOMMU_H | 21 | #ifndef _ASM_IOMMU_H |
22 | #define _ASM_IOMMU_H | 22 | #define _ASM_IOMMU_H |
23 | #ifdef __KERNEL__ | ||
23 | 24 | ||
24 | #include <linux/config.h> | 25 | #include <linux/config.h> |
25 | #include <asm/types.h> | 26 | #include <asm/types.h> |
@@ -56,7 +57,7 @@ struct device_node; | |||
56 | 57 | ||
57 | /* Walks all buses and creates iommu tables */ | 58 | /* Walks all buses and creates iommu tables */ |
58 | extern void iommu_setup_pSeries(void); | 59 | extern void iommu_setup_pSeries(void); |
59 | extern void iommu_setup_u3(void); | 60 | extern void iommu_setup_dart(void); |
60 | 61 | ||
61 | /* Frees table for an individual device node */ | 62 | /* Frees table for an individual device node */ |
62 | extern void iommu_free_table(struct device_node *dn); | 63 | extern void iommu_free_table(struct device_node *dn); |
@@ -104,7 +105,7 @@ extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, | |||
104 | 105 | ||
105 | extern void iommu_init_early_pSeries(void); | 106 | extern void iommu_init_early_pSeries(void); |
106 | extern void iommu_init_early_iSeries(void); | 107 | extern void iommu_init_early_iSeries(void); |
107 | extern void iommu_init_early_u3(void); | 108 | extern void iommu_init_early_dart(void); |
108 | 109 | ||
109 | #ifdef CONFIG_PCI | 110 | #ifdef CONFIG_PCI |
110 | extern void pci_iommu_init(void); | 111 | extern void pci_iommu_init(void); |
@@ -113,6 +114,7 @@ extern void pci_direct_iommu_init(void); | |||
113 | static inline void pci_iommu_init(void) { } | 114 | static inline void pci_iommu_init(void) { } |
114 | #endif | 115 | #endif |
115 | 116 | ||
116 | extern void alloc_u3_dart_table(void); | 117 | extern void alloc_dart_table(void); |
117 | 118 | ||
119 | #endif /* __KERNEL__ */ | ||
118 | #endif /* _ASM_IOMMU_H */ | 120 | #endif /* _ASM_IOMMU_H */ |
diff --git a/include/asm-powerpc/ipic.h b/include/asm-powerpc/ipic.h new file mode 100644 index 000000000000..0fe396a2b666 --- /dev/null +++ b/include/asm-powerpc/ipic.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * include/asm-ppc/ipic.h | ||
3 | * | ||
4 | * IPIC external definitions and structure. | ||
5 | * | ||
6 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> | ||
7 | * | ||
8 | * Copyright 2005 Freescale Semiconductor, Inc | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | */ | ||
15 | #ifdef __KERNEL__ | ||
16 | #ifndef __ASM_IPIC_H__ | ||
17 | #define __ASM_IPIC_H__ | ||
18 | |||
19 | #include <linux/irq.h> | ||
20 | |||
21 | /* Flags when we init the IPIC */ | ||
22 | #define IPIC_SPREADMODE_GRP_A 0x00000001 | ||
23 | #define IPIC_SPREADMODE_GRP_D 0x00000002 | ||
24 | #define IPIC_SPREADMODE_MIX_A 0x00000004 | ||
25 | #define IPIC_SPREADMODE_MIX_B 0x00000008 | ||
26 | #define IPIC_DISABLE_MCP_OUT 0x00000010 | ||
27 | #define IPIC_IRQ0_MCP 0x00000020 | ||
28 | |||
29 | /* IPIC registers offsets */ | ||
30 | #define IPIC_SICFR 0x00 /* System Global Interrupt Configuration Register */ | ||
31 | #define IPIC_SIVCR 0x04 /* System Global Interrupt Vector Register */ | ||
32 | #define IPIC_SIPNR_H 0x08 /* System Internal Interrupt Pending Register (HIGH) */ | ||
33 | #define IPIC_SIPNR_L 0x0C /* System Internal Interrupt Pending Register (LOW) */ | ||
34 | #define IPIC_SIPRR_A 0x10 /* System Internal Interrupt group A Priority Register */ | ||
35 | #define IPIC_SIPRR_B 0x14 /* System Internal Interrupt group B Priority Register */ | ||
36 | #define IPIC_SIPRR_C 0x18 /* System Internal Interrupt group C Priority Register */ | ||
37 | #define IPIC_SIPRR_D 0x1C /* System Internal Interrupt group D Priority Register */ | ||
38 | #define IPIC_SIMSR_H 0x20 /* System Internal Interrupt Mask Register (HIGH) */ | ||
39 | #define IPIC_SIMSR_L 0x24 /* System Internal Interrupt Mask Register (LOW) */ | ||
40 | #define IPIC_SICNR 0x28 /* System Internal Interrupt Control Register */ | ||
41 | #define IPIC_SEPNR 0x2C /* System External Interrupt Pending Register */ | ||
42 | #define IPIC_SMPRR_A 0x30 /* System Mixed Interrupt group A Priority Register */ | ||
43 | #define IPIC_SMPRR_B 0x34 /* System Mixed Interrupt group B Priority Register */ | ||
44 | #define IPIC_SEMSR 0x38 /* System External Interrupt Mask Register */ | ||
45 | #define IPIC_SECNR 0x3C /* System External Interrupt Control Register */ | ||
46 | #define IPIC_SERSR 0x40 /* System Error Status Register */ | ||
47 | #define IPIC_SERMR 0x44 /* System Error Mask Register */ | ||
48 | #define IPIC_SERCR 0x48 /* System Error Control Register */ | ||
49 | #define IPIC_SIFCR_H 0x50 /* System Internal Interrupt Force Register (HIGH) */ | ||
50 | #define IPIC_SIFCR_L 0x54 /* System Internal Interrupt Force Register (LOW) */ | ||
51 | #define IPIC_SEFCR 0x58 /* System External Interrupt Force Register */ | ||
52 | #define IPIC_SERFR 0x5C /* System Error Force Register */ | ||
53 | #define IPIC_SCVCR 0x60 /* System Critical Interrupt Vector Register */ | ||
54 | #define IPIC_SMVCR 0x64 /* System Management Interrupt Vector Register */ | ||
55 | |||
56 | enum ipic_prio_grp { | ||
57 | IPIC_INT_GRP_A = IPIC_SIPRR_A, | ||
58 | IPIC_INT_GRP_D = IPIC_SIPRR_D, | ||
59 | IPIC_MIX_GRP_A = IPIC_SMPRR_A, | ||
60 | IPIC_MIX_GRP_B = IPIC_SMPRR_B, | ||
61 | }; | ||
62 | |||
63 | enum ipic_mcp_irq { | ||
64 | IPIC_MCP_IRQ0 = 0, | ||
65 | IPIC_MCP_WDT = 1, | ||
66 | IPIC_MCP_SBA = 2, | ||
67 | IPIC_MCP_PCI1 = 5, | ||
68 | IPIC_MCP_PCI2 = 6, | ||
69 | IPIC_MCP_MU = 7, | ||
70 | }; | ||
71 | |||
72 | extern void ipic_init(phys_addr_t phys_addr, unsigned int flags, | ||
73 | unsigned int irq_offset, | ||
74 | unsigned char *senses, unsigned int senses_count); | ||
75 | extern int ipic_set_priority(unsigned int irq, unsigned int priority); | ||
76 | extern void ipic_set_highest_priority(unsigned int irq); | ||
77 | extern void ipic_set_default_priority(void); | ||
78 | extern void ipic_enable_mcp(enum ipic_mcp_irq mcp_irq); | ||
79 | extern void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq); | ||
80 | extern u32 ipic_get_mcp_status(void); | ||
81 | extern void ipic_clear_mcp_status(u32 mask); | ||
82 | extern int ipic_get_irq(struct pt_regs *regs); | ||
83 | |||
84 | #endif /* __ASM_IPIC_H__ */ | ||
85 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-powerpc/iseries/it_lp_reg_save.h b/include/asm-powerpc/iseries/it_lp_reg_save.h index 288044b702de..81824e1bb767 100644 --- a/include/asm-powerpc/iseries/it_lp_reg_save.h +++ b/include/asm-powerpc/iseries/it_lp_reg_save.h | |||
@@ -81,4 +81,6 @@ struct ItLpRegSave { | |||
81 | u8 xRsvd3[176]; // Reserved 350-3FF | 81 | u8 xRsvd3[176]; // Reserved 350-3FF |
82 | }; | 82 | }; |
83 | 83 | ||
84 | extern struct ItLpRegSave iseries_reg_save[]; | ||
85 | |||
84 | #endif /* _ITLPREGSAVE_H */ | 86 | #endif /* _ITLPREGSAVE_H */ |
diff --git a/include/asm-powerpc/kdebug.h b/include/asm-powerpc/kdebug.h index 9dcbac674811..7c16265568e0 100644 --- a/include/asm-powerpc/kdebug.h +++ b/include/asm-powerpc/kdebug.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_KDEBUG_H | 1 | #ifndef _ASM_POWERPC_KDEBUG_H |
2 | #define _ASM_POWERPC_KDEBUG_H | 2 | #define _ASM_POWERPC_KDEBUG_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* nearly identical to x86_64/i386 code */ | 5 | /* nearly identical to x86_64/i386 code */ |
5 | 6 | ||
@@ -39,4 +40,5 @@ static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,lon | |||
39 | return notifier_call_chain(&powerpc_die_chain, val, &args); | 40 | return notifier_call_chain(&powerpc_die_chain, val, &args); |
40 | } | 41 | } |
41 | 42 | ||
43 | #endif /* __KERNEL__ */ | ||
42 | #endif /* _ASM_POWERPC_KDEBUG_H */ | 44 | #endif /* _ASM_POWERPC_KDEBUG_H */ |
diff --git a/include/asm-powerpc/kdump.h b/include/asm-powerpc/kdump.h new file mode 100644 index 000000000000..a87aed00d61f --- /dev/null +++ b/include/asm-powerpc/kdump.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _PPC64_KDUMP_H | ||
2 | #define _PPC64_KDUMP_H | ||
3 | |||
4 | /* How many bytes to reserve at zero for kdump. The reserve limit should | ||
5 | * be greater or equal to the trampoline's end address. */ | ||
6 | #define KDUMP_RESERVE_LIMIT 0x8000 | ||
7 | |||
8 | #define KDUMP_TRAMPOLINE_START 0x0100 | ||
9 | #define KDUMP_TRAMPOLINE_END 0x3000 | ||
10 | |||
11 | extern void kdump_setup(void); | ||
12 | |||
13 | #endif /* __PPC64_KDUMP_H */ | ||
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h index c72ffc709ea8..4263af3cadfd 100644 --- a/include/asm-powerpc/kexec.h +++ b/include/asm-powerpc/kexec.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_KEXEC_H | 1 | #ifndef _ASM_POWERPC_KEXEC_H |
2 | #define _ASM_POWERPC_KEXEC_H | 2 | #define _ASM_POWERPC_KEXEC_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * Maximum page that is mapped directly into kernel memory. | 6 | * Maximum page that is mapped directly into kernel memory. |
@@ -30,8 +31,12 @@ | |||
30 | #define KEXEC_ARCH KEXEC_ARCH_PPC | 31 | #define KEXEC_ARCH KEXEC_ARCH_PPC |
31 | #endif | 32 | #endif |
32 | 33 | ||
34 | #define HAVE_ARCH_COPY_OLDMEM_PAGE | ||
35 | |||
33 | #ifndef __ASSEMBLY__ | 36 | #ifndef __ASSEMBLY__ |
34 | 37 | ||
38 | #ifdef CONFIG_KEXEC | ||
39 | |||
35 | #define MAX_NOTE_BYTES 1024 | 40 | #define MAX_NOTE_BYTES 1024 |
36 | typedef u32 note_buf_t[MAX_NOTE_BYTES / sizeof(u32)]; | 41 | typedef u32 note_buf_t[MAX_NOTE_BYTES / sizeof(u32)]; |
37 | 42 | ||
@@ -41,10 +46,18 @@ extern note_buf_t crash_notes[]; | |||
41 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for | 46 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for |
42 | master to copy new code to 0 */ | 47 | master to copy new code to 0 */ |
43 | extern void __init kexec_setup(void); | 48 | extern void __init kexec_setup(void); |
44 | #else | 49 | extern int crashing_cpu; |
50 | extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)); | ||
51 | #endif /* __powerpc64 __ */ | ||
52 | |||
45 | struct kimage; | 53 | struct kimage; |
46 | extern void machine_kexec_simple(struct kimage *image); | 54 | struct pt_regs; |
47 | #endif | 55 | extern void default_machine_kexec(struct kimage *image); |
56 | extern int default_machine_kexec_prepare(struct kimage *image); | ||
57 | extern void default_machine_crash_shutdown(struct pt_regs *regs); | ||
58 | |||
59 | #endif /* !CONFIG_KEXEC */ | ||
48 | 60 | ||
49 | #endif /* ! __ASSEMBLY__ */ | 61 | #endif /* ! __ASSEMBLY__ */ |
62 | #endif /* __KERNEL__ */ | ||
50 | #endif /* _ASM_POWERPC_KEXEC_H */ | 63 | #endif /* _ASM_POWERPC_KEXEC_H */ |
diff --git a/include/asm-powerpc/keylargo.h b/include/asm-powerpc/keylargo.h index a669a3f0f5a2..d8520ef121f9 100644 --- a/include/asm-powerpc/keylargo.h +++ b/include/asm-powerpc/keylargo.h | |||
@@ -1,3 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_KEYLARGO_H | ||
2 | #define _ASM_POWERPC_KEYLARGO_H | ||
3 | #ifdef __KERNEL__ | ||
1 | /* | 4 | /* |
2 | * keylargo.h: definitions for using the "KeyLargo" I/O controller chip. | 5 | * keylargo.h: definitions for using the "KeyLargo" I/O controller chip. |
3 | * | 6 | * |
@@ -232,10 +235,12 @@ | |||
232 | #define K2_FCR1_I2S0_RESET 0x00000800 | 235 | #define K2_FCR1_I2S0_RESET 0x00000800 |
233 | #define K2_FCR1_I2S0_CLK_ENABLE_BIT 0x00001000 | 236 | #define K2_FCR1_I2S0_CLK_ENABLE_BIT 0x00001000 |
234 | #define K2_FCR1_I2S0_ENABLE 0x00002000 | 237 | #define K2_FCR1_I2S0_ENABLE 0x00002000 |
235 | |||
236 | #define K2_FCR1_PCI1_CLK_ENABLE 0x00004000 | 238 | #define K2_FCR1_PCI1_CLK_ENABLE 0x00004000 |
237 | #define K2_FCR1_FW_CLK_ENABLE 0x00008000 | 239 | #define K2_FCR1_FW_CLK_ENABLE 0x00008000 |
238 | #define K2_FCR1_FW_RESET_N 0x00010000 | 240 | #define K2_FCR1_FW_RESET_N 0x00010000 |
241 | #define K2_FCR1_I2S1_CELL_ENABLE 0x00020000 | ||
242 | #define K2_FCR1_I2S1_CLK_ENABLE_BIT 0x00080000 | ||
243 | #define K2_FCR1_I2S1_ENABLE 0x00100000 | ||
239 | #define K2_FCR1_GMAC_CLK_ENABLE 0x00400000 | 244 | #define K2_FCR1_GMAC_CLK_ENABLE 0x00400000 |
240 | #define K2_FCR1_GMAC_POWER_DOWN 0x00800000 | 245 | #define K2_FCR1_GMAC_POWER_DOWN 0x00800000 |
241 | #define K2_FCR1_GMAC_RESET_N 0x01000000 | 246 | #define K2_FCR1_GMAC_RESET_N 0x01000000 |
@@ -246,3 +251,11 @@ | |||
246 | #define K2_FCR1_UATA_RESET_N 0x40000000 | 251 | #define K2_FCR1_UATA_RESET_N 0x40000000 |
247 | #define K2_FCR1_UATA_CHOOSE_CLK66 0x80000000 | 252 | #define K2_FCR1_UATA_CHOOSE_CLK66 0x80000000 |
248 | 253 | ||
254 | /* Shasta definitions */ | ||
255 | #define SH_FCR1_I2S2_CELL_ENABLE 0x00000010 | ||
256 | #define SH_FCR1_I2S2_CLK_ENABLE_BIT 0x00000040 | ||
257 | #define SH_FCR1_I2S2_ENABLE 0x00000080 | ||
258 | #define SH_FCR3_I2S2_CLK18_ENABLE 0x00008000 | ||
259 | |||
260 | #endif /* __KERNEL__ */ | ||
261 | #endif /* _ASM_POWERPC_KEYLARGO_H */ | ||
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h index 6cd0a3bfa280..0654f79b06df 100644 --- a/include/asm-powerpc/kprobes.h +++ b/include/asm-powerpc/kprobes.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_KPROBES_H | 1 | #ifndef _ASM_POWERPC_KPROBES_H |
2 | #define _ASM_POWERPC_KPROBES_H | 2 | #define _ASM_POWERPC_KPROBES_H |
3 | #ifdef __KERNEL__ | ||
3 | /* | 4 | /* |
4 | * Kernel Probes (KProbes) | 5 | * Kernel Probes (KProbes) |
5 | * | 6 | * |
@@ -78,4 +79,5 @@ static inline int kprobe_exceptions_notify(struct notifier_block *self, | |||
78 | return 0; | 79 | return 0; |
79 | } | 80 | } |
80 | #endif | 81 | #endif |
82 | #endif /* __KERNEL__ */ | ||
81 | #endif /* _ASM_POWERPC_KPROBES_H */ | 83 | #endif /* _ASM_POWERPC_KPROBES_H */ |
diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h index ea0afe343545..d3546c4c9f46 100644 --- a/include/asm-powerpc/lmb.h +++ b/include/asm-powerpc/lmb.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _PPC64_LMB_H | 1 | #ifndef _PPC64_LMB_H |
2 | #define _PPC64_LMB_H | 2 | #define _PPC64_LMB_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * Definitions for talking to the Open Firmware PROM on | 6 | * Definitions for talking to the Open Firmware PROM on |
@@ -78,4 +79,5 @@ lmb_end_pfn(struct lmb_region *type, unsigned long region_nr) | |||
78 | lmb_size_pages(type, region_nr); | 79 | lmb_size_pages(type, region_nr); |
79 | } | 80 | } |
80 | 81 | ||
82 | #endif /* __KERNEL__ */ | ||
81 | #endif /* _PPC64_LMB_H */ | 83 | #endif /* _PPC64_LMB_H */ |
diff --git a/include/asm-powerpc/lppaca.h b/include/asm-powerpc/lppaca.h index c1bedab1515b..ff82ea7c4829 100644 --- a/include/asm-powerpc/lppaca.h +++ b/include/asm-powerpc/lppaca.h | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #ifndef _ASM_POWERPC_LPPACA_H | 19 | #ifndef _ASM_POWERPC_LPPACA_H |
20 | #define _ASM_POWERPC_LPPACA_H | 20 | #define _ASM_POWERPC_LPPACA_H |
21 | #ifdef __KERNEL__ | ||
21 | 22 | ||
22 | //============================================================================= | 23 | //============================================================================= |
23 | // | 24 | // |
@@ -128,4 +129,5 @@ struct lppaca { | |||
128 | u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF | 129 | u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF |
129 | }; | 130 | }; |
130 | 131 | ||
132 | #endif /* __KERNEL__ */ | ||
131 | #endif /* _ASM_POWERPC_LPPACA_H */ | 133 | #endif /* _ASM_POWERPC_LPPACA_H */ |
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h index c011abb8b600..5348b820788c 100644 --- a/include/asm-powerpc/machdep.h +++ b/include/asm-powerpc/machdep.h | |||
@@ -27,6 +27,9 @@ struct device_node; | |||
27 | struct iommu_table; | 27 | struct iommu_table; |
28 | struct rtc_time; | 28 | struct rtc_time; |
29 | struct file; | 29 | struct file; |
30 | #ifdef CONFIG_KEXEC | ||
31 | struct kimage; | ||
32 | #endif | ||
30 | 33 | ||
31 | #ifdef CONFIG_SMP | 34 | #ifdef CONFIG_SMP |
32 | struct smp_ops_t { | 35 | struct smp_ops_t { |
@@ -131,7 +134,7 @@ struct machdep_calls { | |||
131 | void (*nvram_sync)(void); | 134 | void (*nvram_sync)(void); |
132 | 135 | ||
133 | /* Exception handlers */ | 136 | /* Exception handlers */ |
134 | void (*system_reset_exception)(struct pt_regs *regs); | 137 | int (*system_reset_exception)(struct pt_regs *regs); |
135 | int (*machine_check_exception)(struct pt_regs *regs); | 138 | int (*machine_check_exception)(struct pt_regs *regs); |
136 | 139 | ||
137 | /* Motherboard/chipset features. This is a kind of general purpose | 140 | /* Motherboard/chipset features. This is a kind of general purpose |
@@ -207,19 +210,19 @@ struct machdep_calls { | |||
207 | 210 | ||
208 | /* this is for modules, since _machine can be a define -- Cort */ | 211 | /* this is for modules, since _machine can be a define -- Cort */ |
209 | int ppc_machine; | 212 | int ppc_machine; |
213 | #endif /* CONFIG_PPC32 */ | ||
210 | 214 | ||
211 | #ifdef CONFIG_KEXEC | ||
212 | /* Called to shutdown machine specific hardware not already controlled | 215 | /* Called to shutdown machine specific hardware not already controlled |
213 | * by other drivers. | 216 | * by other drivers. |
214 | * XXX Should we move this one out of kexec scope? | ||
215 | */ | 217 | */ |
216 | void (*machine_shutdown)(void); | 218 | void (*machine_shutdown)(void); |
217 | 219 | ||
220 | #ifdef CONFIG_KEXEC | ||
218 | /* Called to do the minimal shutdown needed to run a kexec'd kernel | 221 | /* Called to do the minimal shutdown needed to run a kexec'd kernel |
219 | * to run successfully. | 222 | * to run successfully. |
220 | * XXX Should we move this one out of kexec scope? | 223 | * XXX Should we move this one out of kexec scope? |
221 | */ | 224 | */ |
222 | void (*machine_crash_shutdown)(void); | 225 | void (*machine_crash_shutdown)(struct pt_regs *regs); |
223 | 226 | ||
224 | /* Called to do what every setup is needed on image and the | 227 | /* Called to do what every setup is needed on image and the |
225 | * reboot code buffer. Returns 0 on success. | 228 | * reboot code buffer. Returns 0 on success. |
@@ -237,7 +240,6 @@ struct machdep_calls { | |||
237 | */ | 240 | */ |
238 | void (*machine_kexec)(struct kimage *image); | 241 | void (*machine_kexec)(struct kimage *image); |
239 | #endif /* CONFIG_KEXEC */ | 242 | #endif /* CONFIG_KEXEC */ |
240 | #endif /* CONFIG_PPC32 */ | ||
241 | }; | 243 | }; |
242 | 244 | ||
243 | extern void default_idle(void); | 245 | extern void default_idle(void); |
diff --git a/include/asm-powerpc/macio.h b/include/asm-powerpc/macio.h index b553dd4b139e..3a6cb1a513b7 100644 --- a/include/asm-powerpc/macio.h +++ b/include/asm-powerpc/macio.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef __MACIO_ASIC_H__ | 1 | #ifndef __MACIO_ASIC_H__ |
2 | #define __MACIO_ASIC_H__ | 2 | #define __MACIO_ASIC_H__ |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <asm/of_device.h> | 5 | #include <asm/of_device.h> |
5 | 6 | ||
@@ -137,4 +138,5 @@ struct macio_driver | |||
137 | extern int macio_register_driver(struct macio_driver *); | 138 | extern int macio_register_driver(struct macio_driver *); |
138 | extern void macio_unregister_driver(struct macio_driver *); | 139 | extern void macio_unregister_driver(struct macio_driver *); |
139 | 140 | ||
141 | #endif /* __KERNEL__ */ | ||
140 | #endif /* __MACIO_ASIC_H__ */ | 142 | #endif /* __MACIO_ASIC_H__ */ |
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h index 29b0bb0086d3..d096d9e76ad7 100644 --- a/include/asm-powerpc/mmu.h +++ b/include/asm-powerpc/mmu.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_MMU_H_ | 1 | #ifndef _ASM_POWERPC_MMU_H_ |
2 | #define _ASM_POWERPC_MMU_H_ | 2 | #define _ASM_POWERPC_MMU_H_ |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #ifndef CONFIG_PPC64 | 5 | #ifndef CONFIG_PPC64 |
5 | #include <asm-ppc/mmu.h> | 6 | #include <asm-ppc/mmu.h> |
@@ -33,7 +34,8 @@ | |||
33 | 34 | ||
34 | /* Location of cpu0's segment table */ | 35 | /* Location of cpu0's segment table */ |
35 | #define STAB0_PAGE 0x6 | 36 | #define STAB0_PAGE 0x6 |
36 | #define STAB0_PHYS_ADDR (STAB0_PAGE<<12) | 37 | #define STAB0_OFFSET (STAB0_PAGE << 12) |
38 | #define STAB0_PHYS_ADDR (STAB0_OFFSET + PHYSICAL_START) | ||
37 | 39 | ||
38 | #ifndef __ASSEMBLY__ | 40 | #ifndef __ASSEMBLY__ |
39 | extern char initial_stab[]; | 41 | extern char initial_stab[]; |
@@ -394,7 +396,12 @@ static inline unsigned long get_vsid(unsigned long context, unsigned long ea) | |||
394 | #define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS) | 396 | #define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS) |
395 | #define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea)) | 397 | #define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea)) |
396 | 398 | ||
399 | /* Physical address used by some IO functions */ | ||
400 | typedef unsigned long phys_addr_t; | ||
401 | |||
402 | |||
397 | #endif /* __ASSEMBLY */ | 403 | #endif /* __ASSEMBLY */ |
398 | 404 | ||
399 | #endif /* CONFIG_PPC64 */ | 405 | #endif /* CONFIG_PPC64 */ |
406 | #endif /* __KERNEL__ */ | ||
400 | #endif /* _ASM_POWERPC_MMU_H_ */ | 407 | #endif /* _ASM_POWERPC_MMU_H_ */ |
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h index ea6798c7d5fc..1b8a25fd48f3 100644 --- a/include/asm-powerpc/mmu_context.h +++ b/include/asm-powerpc/mmu_context.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef __ASM_POWERPC_MMU_CONTEXT_H | 1 | #ifndef __ASM_POWERPC_MMU_CONTEXT_H |
2 | #define __ASM_POWERPC_MMU_CONTEXT_H | 2 | #define __ASM_POWERPC_MMU_CONTEXT_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #ifndef CONFIG_PPC64 | 5 | #ifndef CONFIG_PPC64 |
5 | #include <asm-ppc/mmu_context.h> | 6 | #include <asm-ppc/mmu_context.h> |
@@ -86,4 +87,5 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) | |||
86 | } | 87 | } |
87 | 88 | ||
88 | #endif /* CONFIG_PPC64 */ | 89 | #endif /* CONFIG_PPC64 */ |
90 | #endif /* __KERNEL__ */ | ||
89 | #endif /* __ASM_POWERPC_MMU_CONTEXT_H */ | 91 | #endif /* __ASM_POWERPC_MMU_CONTEXT_H */ |
diff --git a/include/asm-powerpc/mmzone.h b/include/asm-powerpc/mmzone.h index 54958d6cae04..88d70bae7769 100644 --- a/include/asm-powerpc/mmzone.h +++ b/include/asm-powerpc/mmzone.h | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | #ifndef _ASM_MMZONE_H_ | 7 | #ifndef _ASM_MMZONE_H_ |
8 | #define _ASM_MMZONE_H_ | 8 | #define _ASM_MMZONE_H_ |
9 | #ifdef __KERNEL__ | ||
9 | 10 | ||
10 | #include <linux/config.h> | 11 | #include <linux/config.h> |
11 | 12 | ||
@@ -47,4 +48,5 @@ extern unsigned long max_pfn; | |||
47 | extern int __init early_pfn_to_nid(unsigned long pfn); | 48 | extern int __init early_pfn_to_nid(unsigned long pfn); |
48 | #endif | 49 | #endif |
49 | 50 | ||
51 | #endif /* __KERNEL__ */ | ||
50 | #endif /* _ASM_MMZONE_H_ */ | 52 | #endif /* _ASM_MMZONE_H_ */ |
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h index 7ecd05e03051..584fabfb4f08 100644 --- a/include/asm-powerpc/module.h +++ b/include/asm-powerpc/module.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_MODULE_H | 1 | #ifndef _ASM_POWERPC_MODULE_H |
2 | #define _ASM_POWERPC_MODULE_H | 2 | #define _ASM_POWERPC_MODULE_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -74,4 +75,5 @@ struct exception_table_entry; | |||
74 | void sort_ex_table(struct exception_table_entry *start, | 75 | void sort_ex_table(struct exception_table_entry *start, |
75 | struct exception_table_entry *finish); | 76 | struct exception_table_entry *finish); |
76 | 77 | ||
78 | #endif /* __KERNEL__ */ | ||
77 | #endif /* _ASM_POWERPC_MODULE_H */ | 79 | #endif /* _ASM_POWERPC_MODULE_H */ |
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h index 7083d1f74260..6b9e78142f4f 100644 --- a/include/asm-powerpc/mpic.h +++ b/include/asm-powerpc/mpic.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_MPIC_H | 1 | #ifndef _ASM_POWERPC_MPIC_H |
2 | #define _ASM_POWERPC_MPIC_H | 2 | #define _ASM_POWERPC_MPIC_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <linux/irq.h> | 5 | #include <linux/irq.h> |
5 | 6 | ||
@@ -117,7 +118,9 @@ typedef int (*mpic_cascade_t)(struct pt_regs *regs, void *data); | |||
117 | struct mpic_irq_fixup | 118 | struct mpic_irq_fixup |
118 | { | 119 | { |
119 | u8 __iomem *base; | 120 | u8 __iomem *base; |
120 | unsigned int irq; | 121 | u8 __iomem *applebase; |
122 | u32 data; | ||
123 | unsigned int index; | ||
121 | }; | 124 | }; |
122 | #endif /* CONFIG_MPIC_BROKEN_U3 */ | 125 | #endif /* CONFIG_MPIC_BROKEN_U3 */ |
123 | 126 | ||
@@ -284,4 +287,5 @@ extern int mpic_get_irq(struct pt_regs *regs); | |||
284 | /* global mpic for pSeries */ | 287 | /* global mpic for pSeries */ |
285 | extern struct mpic *pSeries_mpic; | 288 | extern struct mpic *pSeries_mpic; |
286 | 289 | ||
290 | #endif /* __KERNEL__ */ | ||
287 | #endif /* _ASM_POWERPC_MPIC_H */ | 291 | #endif /* _ASM_POWERPC_MPIC_H */ |
diff --git a/include/asm-powerpc/numnodes.h b/include/asm-powerpc/numnodes.h index 795533aca095..e138edae09dd 100644 --- a/include/asm-powerpc/numnodes.h +++ b/include/asm-powerpc/numnodes.h | |||
@@ -1,7 +1,9 @@ | |||
1 | #ifndef _ASM_POWERPC_MAX_NUMNODES_H | 1 | #ifndef _ASM_POWERPC_MAX_NUMNODES_H |
2 | #define _ASM_POWERPC_MAX_NUMNODES_H | 2 | #define _ASM_POWERPC_MAX_NUMNODES_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* Max 16 Nodes */ | 5 | /* Max 16 Nodes */ |
5 | #define NODES_SHIFT 4 | 6 | #define NODES_SHIFT 4 |
6 | 7 | ||
8 | #endif /* __KERNEL__ */ | ||
7 | #endif /* _ASM_POWERPC_MAX_NUMNODES_H */ | 9 | #endif /* _ASM_POWERPC_MAX_NUMNODES_H */ |
diff --git a/include/asm-powerpc/nvram.h b/include/asm-powerpc/nvram.h index 24bd8c2388ea..f3563e11e260 100644 --- a/include/asm-powerpc/nvram.h +++ b/include/asm-powerpc/nvram.h | |||
@@ -55,6 +55,7 @@ struct nvram_header { | |||
55 | char name[12]; | 55 | char name[12]; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #ifdef __KERNEL__ | ||
58 | struct nvram_partition { | 59 | struct nvram_partition { |
59 | struct list_head partition; | 60 | struct list_head partition; |
60 | struct nvram_header header; | 61 | struct nvram_header header; |
@@ -69,6 +70,7 @@ extern struct nvram_partition *nvram_find_partition(int sig, const char *name); | |||
69 | 70 | ||
70 | extern int pSeries_nvram_init(void); | 71 | extern int pSeries_nvram_init(void); |
71 | extern int mmio_nvram_init(void); | 72 | extern int mmio_nvram_init(void); |
73 | #endif /* __KERNEL__ */ | ||
72 | 74 | ||
73 | /* PowerMac specific nvram stuffs */ | 75 | /* PowerMac specific nvram stuffs */ |
74 | 76 | ||
@@ -78,6 +80,7 @@ enum { | |||
78 | pmac_nvram_NR /* MacOS Name Registry partition */ | 80 | pmac_nvram_NR /* MacOS Name Registry partition */ |
79 | }; | 81 | }; |
80 | 82 | ||
83 | #ifdef __KERNEL__ | ||
81 | /* Return partition offset in nvram */ | 84 | /* Return partition offset in nvram */ |
82 | extern int pmac_get_partition(int partition); | 85 | extern int pmac_get_partition(int partition); |
83 | 86 | ||
@@ -91,6 +94,7 @@ extern void nvram_sync(void); | |||
91 | /* Normal access to NVRAM */ | 94 | /* Normal access to NVRAM */ |
92 | extern unsigned char nvram_read_byte(int i); | 95 | extern unsigned char nvram_read_byte(int i); |
93 | extern void nvram_write_byte(unsigned char c, int i); | 96 | extern void nvram_write_byte(unsigned char c, int i); |
97 | #endif | ||
94 | 98 | ||
95 | /* Some offsets in XPRAM */ | 99 | /* Some offsets in XPRAM */ |
96 | #define PMAC_XPRAM_MACHINE_LOC 0xe4 | 100 | #define PMAC_XPRAM_MACHINE_LOC 0xe4 |
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h index ddb16aae0bd6..6249a7c39639 100644 --- a/include/asm-powerpc/of_device.h +++ b/include/asm-powerpc/of_device.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_OF_DEVICE_H | 1 | #ifndef _ASM_POWERPC_OF_DEVICE_H |
2 | #define _ASM_POWERPC_OF_DEVICE_H | 2 | #define _ASM_POWERPC_OF_DEVICE_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <linux/device.h> | 5 | #include <linux/device.h> |
5 | #include <linux/mod_devicetable.h> | 6 | #include <linux/mod_devicetable.h> |
@@ -61,4 +62,5 @@ extern struct of_device *of_platform_device_create(struct device_node *np, | |||
61 | struct device *parent); | 62 | struct device *parent); |
62 | extern void of_release_dev(struct device *dev); | 63 | extern void of_release_dev(struct device *dev); |
63 | 64 | ||
65 | #endif /* __KERNEL__ */ | ||
64 | #endif /* _ASM_POWERPC_OF_DEVICE_H */ | 66 | #endif /* _ASM_POWERPC_OF_DEVICE_H */ |
diff --git a/include/asm-powerpc/ohare.h b/include/asm-powerpc/ohare.h index 023b59772231..0d030f9dea24 100644 --- a/include/asm-powerpc/ohare.h +++ b/include/asm-powerpc/ohare.h | |||
@@ -1,3 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_OHARE_H | ||
2 | #define _ASM_POWERPC_OHARE_H | ||
3 | #ifdef __KERNEL__ | ||
1 | /* | 4 | /* |
2 | * ohare.h: definitions for using the "O'Hare" I/O controller chip. | 5 | * ohare.h: definitions for using the "O'Hare" I/O controller chip. |
3 | * | 6 | * |
@@ -46,3 +49,6 @@ | |||
46 | * Contributed by Harry Eaton. | 49 | * Contributed by Harry Eaton. |
47 | */ | 50 | */ |
48 | #define STARMAX_FEATURES 0xbeff7a | 51 | #define STARMAX_FEATURES 0xbeff7a |
52 | |||
53 | #endif /* __KERNEL__ */ | ||
54 | #endif /* _ASM_POWERPC_OHARE_H */ | ||
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h index 8013cd273ced..338e6a7cff4a 100644 --- a/include/asm-powerpc/oprofile_impl.h +++ b/include/asm-powerpc/oprofile_impl.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #ifndef _ASM_POWERPC_OPROFILE_IMPL_H | 12 | #ifndef _ASM_POWERPC_OPROFILE_IMPL_H |
13 | #define _ASM_POWERPC_OPROFILE_IMPL_H | 13 | #define _ASM_POWERPC_OPROFILE_IMPL_H |
14 | #ifdef __KERNEL__ | ||
14 | 15 | ||
15 | #define OP_MAX_COUNTER 8 | 16 | #define OP_MAX_COUNTER 8 |
16 | 17 | ||
@@ -22,24 +23,22 @@ struct op_counter_config { | |||
22 | unsigned long enabled; | 23 | unsigned long enabled; |
23 | unsigned long event; | 24 | unsigned long event; |
24 | unsigned long count; | 25 | unsigned long count; |
26 | /* Classic doesn't support per-counter user/kernel selection */ | ||
25 | unsigned long kernel; | 27 | unsigned long kernel; |
26 | #ifdef __powerpc64__ | ||
27 | /* We dont support per counter user/kernel selection */ | ||
28 | #endif | ||
29 | unsigned long user; | 28 | unsigned long user; |
30 | unsigned long unit_mask; | 29 | unsigned long unit_mask; |
31 | }; | 30 | }; |
32 | 31 | ||
33 | /* System-wide configuration as set via oprofilefs. */ | 32 | /* System-wide configuration as set via oprofilefs. */ |
34 | struct op_system_config { | 33 | struct op_system_config { |
35 | #ifdef __powerpc64__ | 34 | #ifdef CONFIG_PPC64 |
36 | unsigned long mmcr0; | 35 | unsigned long mmcr0; |
37 | unsigned long mmcr1; | 36 | unsigned long mmcr1; |
38 | unsigned long mmcra; | 37 | unsigned long mmcra; |
39 | #endif | 38 | #endif |
40 | unsigned long enable_kernel; | 39 | unsigned long enable_kernel; |
41 | unsigned long enable_user; | 40 | unsigned long enable_user; |
42 | #ifdef __powerpc64__ | 41 | #ifdef CONFIG_PPC64 |
43 | unsigned long backtrace_spinlocks; | 42 | unsigned long backtrace_spinlocks; |
44 | #endif | 43 | #endif |
45 | }; | 44 | }; |
@@ -49,9 +48,7 @@ struct op_powerpc_model { | |||
49 | void (*reg_setup) (struct op_counter_config *, | 48 | void (*reg_setup) (struct op_counter_config *, |
50 | struct op_system_config *, | 49 | struct op_system_config *, |
51 | int num_counters); | 50 | int num_counters); |
52 | #ifdef __powerpc64__ | ||
53 | void (*cpu_setup) (void *); | 51 | void (*cpu_setup) (void *); |
54 | #endif | ||
55 | void (*start) (struct op_counter_config *); | 52 | void (*start) (struct op_counter_config *); |
56 | void (*stop) (void); | 53 | void (*stop) (void); |
57 | void (*handle_interrupt) (struct pt_regs *, | 54 | void (*handle_interrupt) (struct pt_regs *, |
@@ -59,10 +56,19 @@ struct op_powerpc_model { | |||
59 | int num_counters; | 56 | int num_counters; |
60 | }; | 57 | }; |
61 | 58 | ||
62 | #ifdef __powerpc64__ | 59 | #ifdef CONFIG_FSL_BOOKE |
60 | extern struct op_powerpc_model op_model_fsl_booke; | ||
61 | #else /* Otherwise, it's classic */ | ||
62 | |||
63 | #ifdef CONFIG_PPC64 | ||
63 | extern struct op_powerpc_model op_model_rs64; | 64 | extern struct op_powerpc_model op_model_rs64; |
64 | extern struct op_powerpc_model op_model_power4; | 65 | extern struct op_powerpc_model op_model_power4; |
65 | 66 | ||
67 | #else /* Otherwise, CONFIG_PPC32 */ | ||
68 | extern struct op_powerpc_model op_model_7450; | ||
69 | #endif | ||
70 | |||
71 | /* All the classic PPC parts use these */ | ||
66 | static inline unsigned int ctr_read(unsigned int i) | 72 | static inline unsigned int ctr_read(unsigned int i) |
67 | { | 73 | { |
68 | switch(i) { | 74 | switch(i) { |
@@ -78,10 +84,14 @@ static inline unsigned int ctr_read(unsigned int i) | |||
78 | return mfspr(SPRN_PMC5); | 84 | return mfspr(SPRN_PMC5); |
79 | case 5: | 85 | case 5: |
80 | return mfspr(SPRN_PMC6); | 86 | return mfspr(SPRN_PMC6); |
87 | |||
88 | /* No PPC32 chip has more than 6 so far */ | ||
89 | #ifdef CONFIG_PPC64 | ||
81 | case 6: | 90 | case 6: |
82 | return mfspr(SPRN_PMC7); | 91 | return mfspr(SPRN_PMC7); |
83 | case 7: | 92 | case 7: |
84 | return mfspr(SPRN_PMC8); | 93 | return mfspr(SPRN_PMC8); |
94 | #endif | ||
85 | default: | 95 | default: |
86 | return 0; | 96 | return 0; |
87 | } | 97 | } |
@@ -108,16 +118,21 @@ static inline void ctr_write(unsigned int i, unsigned int val) | |||
108 | case 5: | 118 | case 5: |
109 | mtspr(SPRN_PMC6, val); | 119 | mtspr(SPRN_PMC6, val); |
110 | break; | 120 | break; |
121 | |||
122 | /* No PPC32 chip has more than 6, yet */ | ||
123 | #ifdef CONFIG_PPC64 | ||
111 | case 6: | 124 | case 6: |
112 | mtspr(SPRN_PMC7, val); | 125 | mtspr(SPRN_PMC7, val); |
113 | break; | 126 | break; |
114 | case 7: | 127 | case 7: |
115 | mtspr(SPRN_PMC8, val); | 128 | mtspr(SPRN_PMC8, val); |
116 | break; | 129 | break; |
130 | #endif | ||
117 | default: | 131 | default: |
118 | break; | 132 | break; |
119 | } | 133 | } |
120 | } | 134 | } |
121 | #endif /* __powerpc64__ */ | 135 | #endif /* !CONFIG_FSL_BOOKE */ |
122 | 136 | ||
137 | #endif /* __KERNEL__ */ | ||
123 | #endif /* _ASM_POWERPC_OPROFILE_IMPL_H */ | 138 | #endif /* _ASM_POWERPC_OPROFILE_IMPL_H */ |
diff --git a/include/asm-powerpc/pSeries_reconfig.h b/include/asm-powerpc/pSeries_reconfig.h index c0db1ea7f7d1..ea6cfb8efb84 100644 --- a/include/asm-powerpc/pSeries_reconfig.h +++ b/include/asm-powerpc/pSeries_reconfig.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _PPC64_PSERIES_RECONFIG_H | 1 | #ifndef _PPC64_PSERIES_RECONFIG_H |
2 | #define _PPC64_PSERIES_RECONFIG_H | 2 | #define _PPC64_PSERIES_RECONFIG_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <linux/notifier.h> | 5 | #include <linux/notifier.h> |
5 | 6 | ||
@@ -22,4 +23,5 @@ static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb) | |||
22 | static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { } | 23 | static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { } |
23 | #endif /* CONFIG_PPC_PSERIES */ | 24 | #endif /* CONFIG_PPC_PSERIES */ |
24 | 25 | ||
26 | #endif /* __KERNEL__ */ | ||
25 | #endif /* _PPC64_PSERIES_RECONFIG_H */ | 27 | #endif /* _PPC64_PSERIES_RECONFIG_H */ |
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h index 92c765c35bd0..3ae52d9dc9ff 100644 --- a/include/asm-powerpc/paca.h +++ b/include/asm-powerpc/paca.h | |||
@@ -14,11 +14,11 @@ | |||
14 | */ | 14 | */ |
15 | #ifndef _ASM_POWERPC_PACA_H | 15 | #ifndef _ASM_POWERPC_PACA_H |
16 | #define _ASM_POWERPC_PACA_H | 16 | #define _ASM_POWERPC_PACA_H |
17 | #ifdef __KERNEL__ | ||
17 | 18 | ||
18 | #include <linux/config.h> | 19 | #include <linux/config.h> |
19 | #include <asm/types.h> | 20 | #include <asm/types.h> |
20 | #include <asm/lppaca.h> | 21 | #include <asm/lppaca.h> |
21 | #include <asm/iseries/it_lp_reg_save.h> | ||
22 | #include <asm/mmu.h> | 22 | #include <asm/mmu.h> |
23 | 23 | ||
24 | register struct paca_struct *local_paca asm("r13"); | 24 | register struct paca_struct *local_paca asm("r13"); |
@@ -31,9 +31,9 @@ struct task_struct; | |||
31 | * | 31 | * |
32 | * This structure is not directly accessed by firmware or the service | 32 | * This structure is not directly accessed by firmware or the service |
33 | * processor except for the first two pointers that point to the | 33 | * processor except for the first two pointers that point to the |
34 | * lppaca area and the ItLpRegSave area for this CPU. Both the | 34 | * lppaca area and the ItLpRegSave area for this CPU. The lppaca |
35 | * lppaca and ItLpRegSave objects are currently contained within the | 35 | * object is currently contained within the PACA but it doesn't need |
36 | * PACA but they do not need to be. | 36 | * to be. |
37 | */ | 37 | */ |
38 | struct paca_struct { | 38 | struct paca_struct { |
39 | /* | 39 | /* |
@@ -48,7 +48,9 @@ struct paca_struct { | |||
48 | * accessed by the firmware | 48 | * accessed by the firmware |
49 | */ | 49 | */ |
50 | struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ | 50 | struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ |
51 | struct ItLpRegSave *reg_save_ptr; /* Pointer to LpRegSave for PLIC */ | 51 | #ifdef CONFIG_PPC_ISERIES |
52 | void *reg_save_ptr; /* Pointer to LpRegSave for PLIC */ | ||
53 | #endif /* CONFIG_PPC_ISERIES */ | ||
52 | 54 | ||
53 | /* | 55 | /* |
54 | * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c | 56 | * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c |
@@ -59,7 +61,6 @@ struct paca_struct { | |||
59 | u16 lock_token; /* Constant 0x8000, used in locks */ | 61 | u16 lock_token; /* Constant 0x8000, used in locks */ |
60 | u16 paca_index; /* Logical processor number */ | 62 | u16 paca_index; /* Logical processor number */ |
61 | 63 | ||
62 | u32 default_decr; /* Default decrementer value */ | ||
63 | u64 kernel_toc; /* Kernel TOC address */ | 64 | u64 kernel_toc; /* Kernel TOC address */ |
64 | u64 stab_real; /* Absolute address of segment table */ | 65 | u64 stab_real; /* Absolute address of segment table */ |
65 | u64 stab_addr; /* Virtual address of segment table */ | 66 | u64 stab_addr; /* Virtual address of segment table */ |
@@ -90,14 +91,10 @@ struct paca_struct { | |||
90 | struct task_struct *__current; /* Pointer to current */ | 91 | struct task_struct *__current; /* Pointer to current */ |
91 | u64 kstack; /* Saved Kernel stack addr */ | 92 | u64 kstack; /* Saved Kernel stack addr */ |
92 | u64 stab_rr; /* stab/slb round-robin counter */ | 93 | u64 stab_rr; /* stab/slb round-robin counter */ |
93 | u64 next_jiffy_update_tb; /* TB value for next jiffy update */ | ||
94 | u64 saved_r1; /* r1 save for RTAS calls */ | 94 | u64 saved_r1; /* r1 save for RTAS calls */ |
95 | u64 saved_msr; /* MSR saved here by enter_rtas */ | 95 | u64 saved_msr; /* MSR saved here by enter_rtas */ |
96 | u8 proc_enabled; /* irq soft-enable flag */ | 96 | u8 proc_enabled; /* irq soft-enable flag */ |
97 | 97 | ||
98 | /* not yet used */ | ||
99 | u64 exdsi[8]; /* used for linear mapping hash table misses */ | ||
100 | |||
101 | /* | 98 | /* |
102 | * iSeries structure which the hypervisor knows about - | 99 | * iSeries structure which the hypervisor knows about - |
103 | * this structure should not cross a page boundary. | 100 | * this structure should not cross a page boundary. |
@@ -110,11 +107,9 @@ struct paca_struct { | |||
110 | * cross a page boundary. | 107 | * cross a page boundary. |
111 | */ | 108 | */ |
112 | struct lppaca lppaca __attribute__((__aligned__(0x400))); | 109 | struct lppaca lppaca __attribute__((__aligned__(0x400))); |
113 | #ifdef CONFIG_PPC_ISERIES | ||
114 | struct ItLpRegSave reg_save; | ||
115 | #endif | ||
116 | }; | 110 | }; |
117 | 111 | ||
118 | extern struct paca_struct paca[]; | 112 | extern struct paca_struct paca[]; |
119 | 113 | ||
114 | #endif /* __KERNEL__ */ | ||
120 | #endif /* _ASM_POWERPC_PACA_H */ | 115 | #endif /* _ASM_POWERPC_PACA_H */ |
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h index 18c1e5ee81a3..76d7cb4b4ffc 100644 --- a/include/asm-powerpc/page.h +++ b/include/asm-powerpc/page.h | |||
@@ -37,8 +37,30 @@ | |||
37 | */ | 37 | */ |
38 | #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) | 38 | #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) |
39 | 39 | ||
40 | /* | ||
41 | * KERNELBASE is the virtual address of the start of the kernel, it's often | ||
42 | * the same as PAGE_OFFSET, but _might not be_. | ||
43 | * | ||
44 | * The kdump dump kernel is one example where KERNELBASE != PAGE_OFFSET. | ||
45 | * | ||
46 | * To get a physical address from a virtual one you subtract PAGE_OFFSET, | ||
47 | * _not_ KERNELBASE. | ||
48 | * | ||
49 | * If you want to know something's offset from the start of the kernel you | ||
50 | * should subtract KERNELBASE. | ||
51 | * | ||
52 | * If you want to test if something's a kernel address, use is_kernel_addr(). | ||
53 | */ | ||
54 | |||
55 | #ifdef CONFIG_CRASH_DUMP | ||
56 | /* Kdump kernel runs at 32 MB, change at your peril. */ | ||
57 | #define PHYSICAL_START 0x2000000 | ||
58 | #else | ||
59 | #define PHYSICAL_START 0x0 | ||
60 | #endif | ||
61 | |||
40 | #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) | 62 | #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) |
41 | #define KERNELBASE PAGE_OFFSET | 63 | #define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) |
42 | 64 | ||
43 | #ifdef CONFIG_DISCONTIGMEM | 65 | #ifdef CONFIG_DISCONTIGMEM |
44 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) | 66 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) |
@@ -56,7 +78,7 @@ | |||
56 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 78 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
57 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 79 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
58 | 80 | ||
59 | #define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) | 81 | #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) |
60 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) | 82 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) |
61 | 83 | ||
62 | /* | 84 | /* |
@@ -86,6 +108,12 @@ | |||
86 | /* to align the pointer to the (next) page boundary */ | 108 | /* to align the pointer to the (next) page boundary */ |
87 | #define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) | 109 | #define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) |
88 | 110 | ||
111 | /* | ||
112 | * Don't compare things with KERNELBASE or PAGE_OFFSET to test for | ||
113 | * "kernelness", use is_kernel_addr() - it should do what you want. | ||
114 | */ | ||
115 | #define is_kernel_addr(x) ((x) >= PAGE_OFFSET) | ||
116 | |||
89 | #ifndef __ASSEMBLY__ | 117 | #ifndef __ASSEMBLY__ |
90 | 118 | ||
91 | #undef STRICT_MM_TYPECHECKS | 119 | #undef STRICT_MM_TYPECHECKS |
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h index 7259cfd85da9..2677bad70f40 100644 --- a/include/asm-powerpc/page_32.h +++ b/include/asm-powerpc/page_32.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_PAGE_32_H | 1 | #ifndef _ASM_POWERPC_PAGE_32_H |
2 | #define _ASM_POWERPC_PAGE_32_H | 2 | #define _ASM_POWERPC_PAGE_32_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32 | 5 | #define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32 |
5 | 6 | ||
@@ -37,4 +38,5 @@ extern __inline__ int get_order(unsigned long size) | |||
37 | 38 | ||
38 | #endif /* __ASSEMBLY__ */ | 39 | #endif /* __ASSEMBLY__ */ |
39 | 40 | ||
41 | #endif /* __KERNEL__ */ | ||
40 | #endif /* _ASM_POWERPC_PAGE_32_H */ | 42 | #endif /* _ASM_POWERPC_PAGE_32_H */ |
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h index 6642c0125001..3fb061bab9ec 100644 --- a/include/asm-powerpc/page_64.h +++ b/include/asm-powerpc/page_64.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_PAGE_64_H | 1 | #ifndef _ASM_POWERPC_PAGE_64_H |
2 | #define _ASM_POWERPC_PAGE_64_H | 2 | #define _ASM_POWERPC_PAGE_64_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * Copyright (C) 2001 PPC64 Team, IBM Corp | 6 | * Copyright (C) 2001 PPC64 Team, IBM Corp |
@@ -25,16 +26,6 @@ | |||
25 | */ | 26 | */ |
26 | #define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT) | 27 | #define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT) |
27 | 28 | ||
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 */ | 29 | /* Segment size */ |
39 | #define SID_SHIFT 28 | 30 | #define SID_SHIFT 28 |
40 | #define SID_MASK 0xfffffffffUL | 31 | #define SID_MASK 0xfffffffffUL |
@@ -180,4 +171,5 @@ extern unsigned int HPAGE_SHIFT; | |||
180 | 171 | ||
181 | #include <asm-generic/page.h> | 172 | #include <asm-generic/page.h> |
182 | 173 | ||
174 | #endif /* __KERNEL__ */ | ||
183 | #endif /* _ASM_POWERPC_PAGE_64_H */ | 175 | #endif /* _ASM_POWERPC_PAGE_64_H */ |
diff --git a/include/asm-powerpc/param.h b/include/asm-powerpc/param.h index bdc724f70884..094f63d4d5ca 100644 --- a/include/asm-powerpc/param.h +++ b/include/asm-powerpc/param.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_PARAM_H | 1 | #ifndef _ASM_POWERPC_PARAM_H |
2 | #define _ASM_POWERPC_PARAM_H | 2 | #define _ASM_POWERPC_PARAM_H |
3 | 3 | ||
4 | #include <linux/config.h> | ||
5 | |||
6 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
7 | #define HZ CONFIG_HZ /* internal kernel timer frequency */ | 5 | #define HZ CONFIG_HZ /* internal kernel timer frequency */ |
8 | #define USER_HZ 100 /* for user interfaces in "ticks" */ | 6 | #define USER_HZ 100 /* for user interfaces in "ticks" */ |
diff --git a/include/asm-powerpc/parport.h b/include/asm-powerpc/parport.h index d86b410a6f8b..897e49a88a6b 100644 --- a/include/asm-powerpc/parport.h +++ b/include/asm-powerpc/parport.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #ifndef _ASM_POWERPC_PARPORT_H | 9 | #ifndef _ASM_POWERPC_PARPORT_H |
10 | #define _ASM_POWERPC_PARPORT_H | 10 | #define _ASM_POWERPC_PARPORT_H |
11 | #ifdef __KERNEL__ | ||
11 | 12 | ||
12 | static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); | 13 | static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); |
13 | static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) | 14 | static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) |
@@ -15,4 +16,5 @@ static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) | |||
15 | return parport_pc_find_isa_ports (autoirq, autodma); | 16 | return parport_pc_find_isa_ports (autoirq, autodma); |
16 | } | 17 | } |
17 | 18 | ||
19 | #endif /* __KERNEL__ */ | ||
18 | #endif /* !(_ASM_POWERPC_PARPORT_H) */ | 20 | #endif /* !(_ASM_POWERPC_PARPORT_H) */ |
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h index 223ec7bd81da..1a08860e789e 100644 --- a/include/asm-powerpc/pci-bridge.h +++ b/include/asm-powerpc/pci-bridge.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_PCI_BRIDGE_H | 1 | #ifndef _ASM_POWERPC_PCI_BRIDGE_H |
2 | #define _ASM_POWERPC_PCI_BRIDGE_H | 2 | #define _ASM_POWERPC_PCI_BRIDGE_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #ifndef CONFIG_PPC64 | 5 | #ifndef CONFIG_PPC64 |
5 | #include <asm-ppc/pci-bridge.h> | 6 | #include <asm-ppc/pci-bridge.h> |
@@ -125,9 +126,19 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) | |||
125 | return bus->sysdata; /* Must be root bus (PHB) */ | 126 | return bus->sysdata; /* Must be root bus (PHB) */ |
126 | } | 127 | } |
127 | 128 | ||
129 | /** Find the bus corresponding to the indicated device node */ | ||
130 | struct pci_bus * pcibios_find_pci_bus(struct device_node *dn); | ||
131 | |||
128 | extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, | 132 | extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, |
129 | struct device_node *dev, int primary); | 133 | struct device_node *dev, int primary); |
130 | 134 | ||
135 | /** Remove all of the PCI devices under this bus */ | ||
136 | void pcibios_remove_pci_devices(struct pci_bus *bus); | ||
137 | |||
138 | /** Discover new pci devices under this bus, and add them */ | ||
139 | void pcibios_add_pci_devices(struct pci_bus * bus); | ||
140 | void pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus); | ||
141 | |||
131 | extern int pcibios_remove_root_bus(struct pci_controller *phb); | 142 | extern int pcibios_remove_root_bus(struct pci_controller *phb); |
132 | 143 | ||
133 | extern void phbs_remap_io(void); | 144 | extern void phbs_remap_io(void); |
@@ -140,14 +151,27 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) | |||
140 | return PCI_DN(busdn)->phb; | 151 | return PCI_DN(busdn)->phb; |
141 | } | 152 | } |
142 | 153 | ||
154 | extern struct pci_controller* | ||
155 | pci_find_hose_for_OF_device(struct device_node* node); | ||
156 | |||
143 | extern struct pci_controller * | 157 | extern struct pci_controller * |
144 | pcibios_alloc_controller(struct device_node *dev); | 158 | pcibios_alloc_controller(struct device_node *dev); |
145 | extern void pcibios_free_controller(struct pci_controller *phb); | 159 | extern void pcibios_free_controller(struct pci_controller *phb); |
146 | 160 | ||
161 | #ifdef CONFIG_PCI | ||
162 | extern unsigned long pci_address_to_pio(phys_addr_t address); | ||
163 | #else | ||
164 | static inline unsigned long pci_address_to_pio(phys_addr_t address) | ||
165 | { | ||
166 | return (unsigned long)-1; | ||
167 | } | ||
168 | #endif | ||
169 | |||
147 | /* Return values for ppc_md.pci_probe_mode function */ | 170 | /* Return values for ppc_md.pci_probe_mode function */ |
148 | #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ | 171 | #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ |
149 | #define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ | 172 | #define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ |
150 | #define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ | 173 | #define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ |
151 | 174 | ||
152 | #endif /* CONFIG_PPC64 */ | 175 | #endif /* CONFIG_PPC64 */ |
176 | #endif /* __KERNEL__ */ | ||
153 | #endif | 177 | #endif |
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h index d5934a076bd0..5d2c9e6c4be2 100644 --- a/include/asm-powerpc/pci.h +++ b/include/asm-powerpc/pci.h | |||
@@ -216,6 +216,8 @@ extern int remap_bus_range(struct pci_bus *bus); | |||
216 | extern void pcibios_fixup_device_resources(struct pci_dev *dev, | 216 | extern void pcibios_fixup_device_resources(struct pci_dev *dev, |
217 | struct pci_bus *bus); | 217 | struct pci_bus *bus); |
218 | 218 | ||
219 | extern void pcibios_claim_one_bus(struct pci_bus *b); | ||
220 | |||
219 | extern struct pci_controller *init_phb_dynamic(struct device_node *dn); | 221 | extern struct pci_controller *init_phb_dynamic(struct device_node *dn); |
220 | 222 | ||
221 | extern struct pci_dev *of_create_pci_dev(struct device_node *node, | 223 | extern struct pci_dev *of_create_pci_dev(struct device_node *node, |
diff --git a/include/asm-powerpc/pgalloc.h b/include/asm-powerpc/pgalloc.h index bfc2113b3630..9f5b052784a5 100644 --- a/include/asm-powerpc/pgalloc.h +++ b/include/asm-powerpc/pgalloc.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_PGALLOC_H | 1 | #ifndef _ASM_POWERPC_PGALLOC_H |
2 | #define _ASM_POWERPC_PGALLOC_H | 2 | #define _ASM_POWERPC_PGALLOC_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #ifndef CONFIG_PPC64 | 5 | #ifndef CONFIG_PPC64 |
5 | #include <asm-ppc/pgalloc.h> | 6 | #include <asm-ppc/pgalloc.h> |
@@ -153,4 +154,5 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); | |||
153 | #define check_pgt_cache() do { } while (0) | 154 | #define check_pgt_cache() do { } while (0) |
154 | 155 | ||
155 | #endif /* CONFIG_PPC64 */ | 156 | #endif /* CONFIG_PPC64 */ |
157 | #endif /* __KERNEL__ */ | ||
156 | #endif /* _ASM_POWERPC_PGALLOC_H */ | 158 | #endif /* _ASM_POWERPC_PGALLOC_H */ |
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h index 154f1840ece4..653915014dcd 100644 --- a/include/asm-powerpc/pgtable-64k.h +++ b/include/asm-powerpc/pgtable-64k.h | |||
@@ -1,3 +1,7 @@ | |||
1 | #ifndef _ASM_POWERPC_PGTABLE_64K_H | ||
2 | #define _ASM_POWERPC_PGTABLE_64K_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
1 | #include <asm-generic/pgtable-nopud.h> | 5 | #include <asm-generic/pgtable-nopud.h> |
2 | 6 | ||
3 | 7 | ||
@@ -88,3 +92,5 @@ | |||
88 | 92 | ||
89 | 93 | ||
90 | #endif /* __ASSEMBLY__ */ | 94 | #endif /* __ASSEMBLY__ */ |
95 | #endif /* __KERNEL__ */ | ||
96 | #endif /* _ASM_POWERPC_PGTABLE_64K_H */ | ||
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h index 0303f57366c1..e38931379a72 100644 --- a/include/asm-powerpc/pgtable.h +++ b/include/asm-powerpc/pgtable.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_PGTABLE_H | 1 | #ifndef _ASM_POWERPC_PGTABLE_H |
2 | #define _ASM_POWERPC_PGTABLE_H | 2 | #define _ASM_POWERPC_PGTABLE_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #ifndef CONFIG_PPC64 | 5 | #ifndef CONFIG_PPC64 |
5 | #include <asm-ppc/pgtable.h> | 6 | #include <asm-ppc/pgtable.h> |
@@ -58,6 +59,17 @@ struct mm_struct; | |||
58 | #define IMALLOC_END (VMALLOC_START + PGTABLE_RANGE) | 59 | #define IMALLOC_END (VMALLOC_START + PGTABLE_RANGE) |
59 | 60 | ||
60 | /* | 61 | /* |
62 | * Region IDs | ||
63 | */ | ||
64 | #define REGION_SHIFT 60UL | ||
65 | #define REGION_MASK (0xfUL << REGION_SHIFT) | ||
66 | #define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT) | ||
67 | |||
68 | #define VMALLOC_REGION_ID (REGION_ID(VMALLOC_START)) | ||
69 | #define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET)) | ||
70 | #define USER_REGION_ID (0UL) | ||
71 | |||
72 | /* | ||
61 | * Common bits in a linux-style PTE. These match the bits in the | 73 | * Common bits in a linux-style PTE. These match the bits in the |
62 | * (hardware-defined) PowerPC PTE as closely as possible. Additional | 74 | * (hardware-defined) PowerPC PTE as closely as possible. Additional |
63 | * bits may be defined in pgtable-*.h | 75 | * bits may be defined in pgtable-*.h |
@@ -521,4 +533,5 @@ void pgtable_cache_init(void); | |||
521 | #endif /* __ASSEMBLY__ */ | 533 | #endif /* __ASSEMBLY__ */ |
522 | 534 | ||
523 | #endif /* CONFIG_PPC64 */ | 535 | #endif /* CONFIG_PPC64 */ |
536 | #endif /* __KERNEL__ */ | ||
524 | #endif /* _ASM_POWERPC_PGTABLE_H */ | 537 | #endif /* _ASM_POWERPC_PGTABLE_H */ |
diff --git a/include/asm-powerpc/pmac_feature.h b/include/asm-powerpc/pmac_feature.h index e9683bcff19b..3221628130c4 100644 --- a/include/asm-powerpc/pmac_feature.h +++ b/include/asm-powerpc/pmac_feature.h | |||
@@ -121,6 +121,7 @@ | |||
121 | #define PMAC_TYPE_IMAC_G5 0x152 /* iMac G5 */ | 121 | #define PMAC_TYPE_IMAC_G5 0x152 /* iMac G5 */ |
122 | #define PMAC_TYPE_XSERVE_G5 0x153 /* Xserve G5 */ | 122 | #define PMAC_TYPE_XSERVE_G5 0x153 /* Xserve G5 */ |
123 | #define PMAC_TYPE_UNKNOWN_K2 0x19f /* Any other K2 based */ | 123 | #define PMAC_TYPE_UNKNOWN_K2 0x19f /* Any other K2 based */ |
124 | #define PMAC_TYPE_UNKNOWN_SHASTA 0x19e /* Any other Shasta based */ | ||
124 | 125 | ||
125 | /* | 126 | /* |
126 | * Motherboard flags | 127 | * Motherboard flags |
@@ -317,10 +318,6 @@ extern void pmac_register_agp_pm(struct pci_dev *bridge, | |||
317 | extern void pmac_suspend_agp_for_card(struct pci_dev *dev); | 318 | extern void pmac_suspend_agp_for_card(struct pci_dev *dev); |
318 | extern void pmac_resume_agp_for_card(struct pci_dev *dev); | 319 | extern void pmac_resume_agp_for_card(struct pci_dev *dev); |
319 | 320 | ||
320 | /* Used by the via-pmu driver for suspend/resume | ||
321 | */ | ||
322 | extern void pmac_tweak_clock_spreading(int enable); | ||
323 | |||
324 | /* | 321 | /* |
325 | * The part below is for use by macio_asic.c only, do not rely | 322 | * The part below is for use by macio_asic.c only, do not rely |
326 | * on the data structures or constants below in a normal driver | 323 | * on the data structures or constants below in a normal driver |
@@ -341,6 +338,7 @@ enum { | |||
341 | macio_pangea, | 338 | macio_pangea, |
342 | macio_intrepid, | 339 | macio_intrepid, |
343 | macio_keylargo2, | 340 | macio_keylargo2, |
341 | macio_shasta, | ||
344 | }; | 342 | }; |
345 | 343 | ||
346 | struct macio_chip | 344 | struct macio_chip |
@@ -376,5 +374,24 @@ extern struct macio_chip* macio_find(struct device_node* child, int type); | |||
376 | #define MACIO_IN8(r) (in_8(MACIO_FCR8(macio,r))) | 374 | #define MACIO_IN8(r) (in_8(MACIO_FCR8(macio,r))) |
377 | #define MACIO_OUT8(r,v) (out_8(MACIO_FCR8(macio,r), (v))) | 375 | #define MACIO_OUT8(r,v) (out_8(MACIO_FCR8(macio,r), (v))) |
378 | 376 | ||
377 | /* | ||
378 | * Those are exported by pmac feature for internal use by arch code | ||
379 | * only like the platform function callbacks, do not use directly in drivers | ||
380 | */ | ||
381 | extern spinlock_t feature_lock; | ||
382 | extern struct device_node *uninorth_node; | ||
383 | extern u32 __iomem *uninorth_base; | ||
384 | |||
385 | /* | ||
386 | * Uninorth reg. access. Note that Uni-N regs are big endian | ||
387 | */ | ||
388 | |||
389 | #define UN_REG(r) (uninorth_base + ((r) >> 2)) | ||
390 | #define UN_IN(r) (in_be32(UN_REG(r))) | ||
391 | #define UN_OUT(r,v) (out_be32(UN_REG(r), (v))) | ||
392 | #define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v))) | ||
393 | #define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v))) | ||
394 | |||
395 | |||
379 | #endif /* __PPC_ASM_PMAC_FEATURE_H */ | 396 | #endif /* __PPC_ASM_PMAC_FEATURE_H */ |
380 | #endif /* __KERNEL__ */ | 397 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-powerpc/pmac_low_i2c.h b/include/asm-powerpc/pmac_low_i2c.h index 809a5963d5e7..131011bd7e76 100644 --- a/include/asm-powerpc/pmac_low_i2c.h +++ b/include/asm-powerpc/pmac_low_i2c.h | |||
@@ -11,33 +11,97 @@ | |||
11 | */ | 11 | */ |
12 | #ifndef __PMAC_LOW_I2C_H__ | 12 | #ifndef __PMAC_LOW_I2C_H__ |
13 | #define __PMAC_LOW_I2C_H__ | 13 | #define __PMAC_LOW_I2C_H__ |
14 | #ifdef __KERNEL__ | ||
14 | 15 | ||
15 | /* i2c mode (based on the platform functions format) */ | 16 | /* i2c mode (based on the platform functions format) */ |
16 | enum { | 17 | enum { |
17 | pmac_low_i2c_mode_dumb = 1, | 18 | pmac_i2c_mode_dumb = 1, |
18 | pmac_low_i2c_mode_std = 2, | 19 | pmac_i2c_mode_std = 2, |
19 | pmac_low_i2c_mode_stdsub = 3, | 20 | pmac_i2c_mode_stdsub = 3, |
20 | pmac_low_i2c_mode_combined = 4, | 21 | pmac_i2c_mode_combined = 4, |
21 | }; | 22 | }; |
22 | 23 | ||
23 | /* RW bit in address */ | 24 | /* RW bit in address */ |
24 | enum { | 25 | enum { |
25 | pmac_low_i2c_read = 0x01, | 26 | pmac_i2c_read = 0x01, |
26 | pmac_low_i2c_write = 0x00 | 27 | pmac_i2c_write = 0x00 |
27 | }; | 28 | }; |
28 | 29 | ||
30 | /* i2c bus type */ | ||
31 | enum { | ||
32 | pmac_i2c_bus_keywest = 0, | ||
33 | pmac_i2c_bus_pmu = 1, | ||
34 | pmac_i2c_bus_smu = 2, | ||
35 | }; | ||
36 | |||
37 | /* i2c bus features */ | ||
38 | enum { | ||
39 | /* can_largesub : supports >1 byte subaddresses (SMU only) */ | ||
40 | pmac_i2c_can_largesub = 0x00000001u, | ||
41 | |||
42 | /* multibus : device node holds multiple busses, bus number is | ||
43 | * encoded in bits 0xff00 of "reg" of a given device | ||
44 | */ | ||
45 | pmac_i2c_multibus = 0x00000002u, | ||
46 | }; | ||
47 | |||
48 | /* i2c busses in the system */ | ||
49 | struct pmac_i2c_bus; | ||
50 | struct i2c_adapter; | ||
51 | |||
29 | /* Init, called early during boot */ | 52 | /* Init, called early during boot */ |
30 | extern void pmac_init_low_i2c(void); | 53 | extern int pmac_i2c_init(void); |
54 | |||
55 | /* Lookup an i2c bus for a device-node. The node can be either the bus | ||
56 | * node itself or a device below it. In the case of a multibus, the bus | ||
57 | * node itself is the controller node, else, it's a child of the controller | ||
58 | * node | ||
59 | */ | ||
60 | extern struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node); | ||
61 | |||
62 | /* Get the address for an i2c device. This strips the bus number if | ||
63 | * necessary. The 7 bits address is returned 1 bit right shifted so that the | ||
64 | * direction can be directly ored in | ||
65 | */ | ||
66 | extern u8 pmac_i2c_get_dev_addr(struct device_node *device); | ||
67 | |||
68 | /* Get infos about a bus */ | ||
69 | extern struct device_node *pmac_i2c_get_controller(struct pmac_i2c_bus *bus); | ||
70 | extern struct device_node *pmac_i2c_get_bus_node(struct pmac_i2c_bus *bus); | ||
71 | extern int pmac_i2c_get_type(struct pmac_i2c_bus *bus); | ||
72 | extern int pmac_i2c_get_flags(struct pmac_i2c_bus *bus); | ||
73 | extern int pmac_i2c_get_channel(struct pmac_i2c_bus *bus); | ||
74 | |||
75 | /* i2c layer adapter attach/detach */ | ||
76 | extern void pmac_i2c_attach_adapter(struct pmac_i2c_bus *bus, | ||
77 | struct i2c_adapter *adapter); | ||
78 | extern void pmac_i2c_detach_adapter(struct pmac_i2c_bus *bus, | ||
79 | struct i2c_adapter *adapter); | ||
80 | extern struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus); | ||
81 | extern struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter); | ||
82 | |||
83 | /* March a device or bus with an i2c adapter structure, to be used by drivers | ||
84 | * to match device-tree nodes with i2c adapters during adapter discovery | ||
85 | * callbacks | ||
86 | */ | ||
87 | extern int pmac_i2c_match_adapter(struct device_node *dev, | ||
88 | struct i2c_adapter *adapter); | ||
89 | |||
31 | 90 | ||
32 | /* Locking functions exposed to i2c-keywest */ | 91 | /* (legacy) Locking functions exposed to i2c-keywest */ |
33 | int pmac_low_i2c_lock(struct device_node *np); | 92 | extern int pmac_low_i2c_lock(struct device_node *np); |
34 | int pmac_low_i2c_unlock(struct device_node *np); | 93 | extern int pmac_low_i2c_unlock(struct device_node *np); |
35 | 94 | ||
36 | /* Access functions for platform code */ | 95 | /* Access functions for platform code */ |
37 | int pmac_low_i2c_open(struct device_node *np, int channel); | 96 | extern int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled); |
38 | int pmac_low_i2c_close(struct device_node *np); | 97 | extern void pmac_i2c_close(struct pmac_i2c_bus *bus); |
39 | int pmac_low_i2c_setmode(struct device_node *np, int mode); | 98 | extern int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode); |
40 | int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len); | 99 | extern int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, |
100 | u32 subaddr, u8 *data, int len); | ||
41 | 101 | ||
102 | /* Suspend/resume code called by via-pmu directly for now */ | ||
103 | extern void pmac_pfunc_i2c_suspend(void); | ||
104 | extern void pmac_pfunc_i2c_resume(void); | ||
42 | 105 | ||
106 | #endif /* __KERNEL__ */ | ||
43 | #endif /* __PMAC_LOW_I2C_H__ */ | 107 | #endif /* __PMAC_LOW_I2C_H__ */ |
diff --git a/include/asm-powerpc/pmac_pfunc.h b/include/asm-powerpc/pmac_pfunc.h new file mode 100644 index 000000000000..d9728c80f86d --- /dev/null +++ b/include/asm-powerpc/pmac_pfunc.h | |||
@@ -0,0 +1,253 @@ | |||
1 | #ifndef __PMAC_PFUNC_H__ | ||
2 | #define __PMAC_PFUNC_H__ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/list.h> | ||
6 | |||
7 | /* Flags in command lists */ | ||
8 | #define PMF_FLAGS_ON_INIT 0x80000000u | ||
9 | #define PMF_FLGAS_ON_TERM 0x40000000u | ||
10 | #define PMF_FLAGS_ON_SLEEP 0x20000000u | ||
11 | #define PMF_FLAGS_ON_WAKE 0x10000000u | ||
12 | #define PMF_FLAGS_ON_DEMAND 0x08000000u | ||
13 | #define PMF_FLAGS_INT_GEN 0x04000000u | ||
14 | #define PMF_FLAGS_HIGH_SPEED 0x02000000u | ||
15 | #define PMF_FLAGS_LOW_SPEED 0x01000000u | ||
16 | #define PMF_FLAGS_SIDE_EFFECTS 0x00800000u | ||
17 | |||
18 | /* | ||
19 | * Arguments to a platform function call. | ||
20 | * | ||
21 | * NOTE: By convention, pointer arguments point to an u32 | ||
22 | */ | ||
23 | struct pmf_args { | ||
24 | union { | ||
25 | u32 v; | ||
26 | u32 *p; | ||
27 | } u[4]; | ||
28 | unsigned int count; | ||
29 | }; | ||
30 | |||
31 | /* | ||
32 | * A driver capable of interpreting commands provides a handlers | ||
33 | * structure filled with whatever handlers are implemented by this | ||
34 | * driver. Non implemented handlers are left NULL. | ||
35 | * | ||
36 | * PMF_STD_ARGS are the same arguments that are passed to the parser | ||
37 | * and that gets passed back to the various handlers. | ||
38 | * | ||
39 | * Interpreting a given function always start with a begin() call which | ||
40 | * returns an instance data to be passed around subsequent calls, and | ||
41 | * ends with an end() call. This allows the low level driver to implement | ||
42 | * locking policy or per-function instance data. | ||
43 | * | ||
44 | * For interrupt capable functions, irq_enable() is called when a client | ||
45 | * registers, and irq_disable() is called when the last client unregisters | ||
46 | * Note that irq_enable & irq_disable are called within a semaphore held | ||
47 | * by the core, thus you should not try to register yourself to some other | ||
48 | * pmf interrupt during those calls. | ||
49 | */ | ||
50 | |||
51 | #define PMF_STD_ARGS struct pmf_function *func, void *instdata, \ | ||
52 | struct pmf_args *args | ||
53 | |||
54 | struct pmf_function; | ||
55 | |||
56 | struct pmf_handlers { | ||
57 | void * (*begin)(struct pmf_function *func, struct pmf_args *args); | ||
58 | void (*end)(struct pmf_function *func, void *instdata); | ||
59 | |||
60 | int (*irq_enable)(struct pmf_function *func); | ||
61 | int (*irq_disable)(struct pmf_function *func); | ||
62 | |||
63 | int (*write_gpio)(PMF_STD_ARGS, u8 value, u8 mask); | ||
64 | int (*read_gpio)(PMF_STD_ARGS, u8 mask, int rshift, u8 xor); | ||
65 | |||
66 | int (*write_reg32)(PMF_STD_ARGS, u32 offset, u32 value, u32 mask); | ||
67 | int (*read_reg32)(PMF_STD_ARGS, u32 offset); | ||
68 | int (*write_reg16)(PMF_STD_ARGS, u32 offset, u16 value, u16 mask); | ||
69 | int (*read_reg16)(PMF_STD_ARGS, u32 offset); | ||
70 | int (*write_reg8)(PMF_STD_ARGS, u32 offset, u8 value, u8 mask); | ||
71 | int (*read_reg8)(PMF_STD_ARGS, u32 offset); | ||
72 | |||
73 | int (*delay)(PMF_STD_ARGS, u32 duration); | ||
74 | |||
75 | int (*wait_reg32)(PMF_STD_ARGS, u32 offset, u32 value, u32 mask); | ||
76 | int (*wait_reg16)(PMF_STD_ARGS, u32 offset, u16 value, u16 mask); | ||
77 | int (*wait_reg8)(PMF_STD_ARGS, u32 offset, u8 value, u8 mask); | ||
78 | |||
79 | int (*read_i2c)(PMF_STD_ARGS, u32 len); | ||
80 | int (*write_i2c)(PMF_STD_ARGS, u32 len, const u8 *data); | ||
81 | int (*rmw_i2c)(PMF_STD_ARGS, u32 masklen, u32 valuelen, u32 totallen, | ||
82 | const u8 *maskdata, const u8 *valuedata); | ||
83 | |||
84 | int (*read_cfg)(PMF_STD_ARGS, u32 offset, u32 len); | ||
85 | int (*write_cfg)(PMF_STD_ARGS, u32 offset, u32 len, const u8 *data); | ||
86 | int (*rmw_cfg)(PMF_STD_ARGS, u32 offset, u32 masklen, u32 valuelen, | ||
87 | u32 totallen, const u8 *maskdata, const u8 *valuedata); | ||
88 | |||
89 | int (*read_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 len); | ||
90 | int (*write_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 len, const u8 *data); | ||
91 | int (*set_i2c_mode)(PMF_STD_ARGS, int mode); | ||
92 | int (*rmw_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 masklen, u32 valuelen, | ||
93 | u32 totallen, const u8 *maskdata, | ||
94 | const u8 *valuedata); | ||
95 | |||
96 | int (*read_reg32_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift, | ||
97 | u32 xor); | ||
98 | int (*read_reg16_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift, | ||
99 | u32 xor); | ||
100 | int (*read_reg8_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift, | ||
101 | u32 xor); | ||
102 | |||
103 | int (*write_reg32_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask); | ||
104 | int (*write_reg16_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask); | ||
105 | int (*write_reg8_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask); | ||
106 | |||
107 | int (*mask_and_compare)(PMF_STD_ARGS, u32 len, const u8 *maskdata, | ||
108 | const u8 *valuedata); | ||
109 | |||
110 | struct module *owner; | ||
111 | }; | ||
112 | |||
113 | |||
114 | /* | ||
115 | * Drivers who expose platform functions register at init time, this | ||
116 | * causes the platform functions for that device node to be parsed in | ||
117 | * advance and associated with the device. The data structures are | ||
118 | * partially public so a driver can walk the list of platform functions | ||
119 | * and eventually inspect the flags | ||
120 | */ | ||
121 | struct pmf_device; | ||
122 | |||
123 | struct pmf_function { | ||
124 | /* All functions for a given driver are linked */ | ||
125 | struct list_head link; | ||
126 | |||
127 | /* Function node & driver data */ | ||
128 | struct device_node *node; | ||
129 | void *driver_data; | ||
130 | |||
131 | /* For internal use by core */ | ||
132 | struct pmf_device *dev; | ||
133 | |||
134 | /* The name is the "xxx" in "platform-do-xxx", this is how | ||
135 | * platform functions are identified by this code. Some functions | ||
136 | * only operate for a given target, in which case the phandle is | ||
137 | * here (or 0 if the filter doesn't apply) | ||
138 | */ | ||
139 | const char *name; | ||
140 | u32 phandle; | ||
141 | |||
142 | /* The flags for that function. You can have several functions | ||
143 | * with the same name and different flag | ||
144 | */ | ||
145 | u32 flags; | ||
146 | |||
147 | /* The actual tokenized function blob */ | ||
148 | const void *data; | ||
149 | unsigned int length; | ||
150 | |||
151 | /* Interrupt clients */ | ||
152 | struct list_head irq_clients; | ||
153 | |||
154 | /* Refcounting */ | ||
155 | struct kref ref; | ||
156 | }; | ||
157 | |||
158 | /* | ||
159 | * For platform functions that are interrupts, one can register | ||
160 | * irq_client structures. You canNOT use the same structure twice | ||
161 | * as it contains a link member. Also, the callback is called with | ||
162 | * a spinlock held, you must not call back into any of the pmf_* functions | ||
163 | * from within that callback | ||
164 | */ | ||
165 | struct pmf_irq_client { | ||
166 | void (*handler)(void *data); | ||
167 | void *data; | ||
168 | struct module *owner; | ||
169 | struct list_head link; | ||
170 | }; | ||
171 | |||
172 | |||
173 | /* | ||
174 | * Register/Unregister a function-capable driver and its handlers | ||
175 | */ | ||
176 | extern int pmf_register_driver(struct device_node *np, | ||
177 | struct pmf_handlers *handlers, | ||
178 | void *driverdata); | ||
179 | |||
180 | extern void pmf_unregister_driver(struct device_node *np); | ||
181 | |||
182 | |||
183 | /* | ||
184 | * Register/Unregister interrupt clients | ||
185 | */ | ||
186 | extern int pmf_register_irq_client(struct device_node *np, | ||
187 | const char *name, | ||
188 | struct pmf_irq_client *client); | ||
189 | |||
190 | extern void pmf_unregister_irq_client(struct device_node *np, | ||
191 | const char *name, | ||
192 | struct pmf_irq_client *client); | ||
193 | |||
194 | /* | ||
195 | * Called by the handlers when an irq happens | ||
196 | */ | ||
197 | extern void pmf_do_irq(struct pmf_function *func); | ||
198 | |||
199 | |||
200 | /* | ||
201 | * Low level call to platform functions. | ||
202 | * | ||
203 | * The phandle can filter on the target object for functions that have | ||
204 | * multiple targets, the flags allow you to restrict the call to a given | ||
205 | * combination of flags. | ||
206 | * | ||
207 | * The args array contains as many arguments as is required by the function, | ||
208 | * this is dependent on the function you are calling, unfortunately Apple | ||
209 | * mecanism provides no way to encode that so you have to get it right at | ||
210 | * the call site. Some functions require no args, in which case, you can | ||
211 | * pass NULL. | ||
212 | * | ||
213 | * You can also pass NULL to the name. This will match any function that has | ||
214 | * the appropriate combination of flags & phandle or you can pass 0 to the | ||
215 | * phandle to match any | ||
216 | */ | ||
217 | extern int pmf_do_functions(struct device_node *np, const char *name, | ||
218 | u32 phandle, u32 flags, struct pmf_args *args); | ||
219 | |||
220 | |||
221 | |||
222 | /* | ||
223 | * High level call to a platform function. | ||
224 | * | ||
225 | * This one looks for the platform-xxx first so you should call it to the | ||
226 | * actual target if any. It will fallback to platform-do-xxx if it can't | ||
227 | * find one. It will also exclusively target functions that have | ||
228 | * the "OnDemand" flag. | ||
229 | */ | ||
230 | |||
231 | extern int pmf_call_function(struct device_node *target, const char *name, | ||
232 | struct pmf_args *args); | ||
233 | |||
234 | |||
235 | /* | ||
236 | * For low latency interrupt usage, you can lookup for on-demand functions | ||
237 | * using the functions below | ||
238 | */ | ||
239 | |||
240 | extern struct pmf_function *pmf_find_function(struct device_node *target, | ||
241 | const char *name); | ||
242 | |||
243 | extern struct pmf_function * pmf_get_function(struct pmf_function *func); | ||
244 | extern void pmf_put_function(struct pmf_function *func); | ||
245 | |||
246 | extern int pmf_call_one(struct pmf_function *func, struct pmf_args *args); | ||
247 | |||
248 | |||
249 | /* Suspend/resume code called by via-pmu directly for now */ | ||
250 | extern void pmac_pfunc_base_suspend(void); | ||
251 | extern void pmac_pfunc_base_resume(void); | ||
252 | |||
253 | #endif /* __PMAC_PFUNC_H__ */ | ||
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h index 5f41f3a2b293..07d6a4279319 100644 --- a/include/asm-powerpc/pmc.h +++ b/include/asm-powerpc/pmc.h | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #ifndef _POWERPC_PMC_H | 19 | #ifndef _POWERPC_PMC_H |
20 | #define _POWERPC_PMC_H | 20 | #define _POWERPC_PMC_H |
21 | #ifdef __KERNEL__ | ||
21 | 22 | ||
22 | #include <asm/ptrace.h> | 23 | #include <asm/ptrace.h> |
23 | 24 | ||
@@ -44,4 +45,5 @@ void dump_pmcs(void); | |||
44 | extern struct op_powerpc_model op_model_fsl_booke; | 45 | extern struct op_powerpc_model op_model_fsl_booke; |
45 | #endif | 46 | #endif |
46 | 47 | ||
48 | #endif /* __KERNEL__ */ | ||
47 | #endif /* _POWERPC_PMC_H */ | 49 | #endif /* _POWERPC_PMC_H */ |
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index 36cdc869e580..bdef312900a1 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | #ifndef _ASM_POWERPC_PPC_PCI_H | 9 | #ifndef _ASM_POWERPC_PPC_PCI_H |
10 | #define _ASM_POWERPC_PPC_PCI_H | 10 | #define _ASM_POWERPC_PPC_PCI_H |
11 | #ifdef __KERNEL__ | ||
11 | 12 | ||
12 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
13 | #include <asm/pci-bridge.h> | 14 | #include <asm/pci-bridge.h> |
@@ -93,4 +94,5 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag); | |||
93 | 94 | ||
94 | #endif | 95 | #endif |
95 | 96 | ||
97 | #endif /* __KERNEL__ */ | ||
96 | #endif /* _ASM_POWERPC_PPC_PCI_H */ | 98 | #endif /* _ASM_POWERPC_PPC_PCI_H */ |
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h index c27baa0563fe..0dc798d46ea4 100644 --- a/include/asm-powerpc/ppc_asm.h +++ b/include/asm-powerpc/ppc_asm.h | |||
@@ -94,6 +94,7 @@ | |||
94 | #define RFDI .long 0x4c00004e /* rfdi instruction */ | 94 | #define RFDI .long 0x4c00004e /* rfdi instruction */ |
95 | #define RFMCI .long 0x4c00004c /* rfmci instruction */ | 95 | #define RFMCI .long 0x4c00004c /* rfmci instruction */ |
96 | 96 | ||
97 | #ifdef __KERNEL__ | ||
97 | #ifdef CONFIG_PPC64 | 98 | #ifdef CONFIG_PPC64 |
98 | 99 | ||
99 | #define XGLUE(a,b) a##b | 100 | #define XGLUE(a,b) a##b |
@@ -325,6 +326,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) | |||
325 | #define CLR_TOP32(r) | 326 | #define CLR_TOP32(r) |
326 | #endif | 327 | #endif |
327 | 328 | ||
329 | #endif /* __KERNEL__ */ | ||
330 | |||
328 | /* The boring bits... */ | 331 | /* The boring bits... */ |
329 | 332 | ||
330 | /* Condition Register Bit Fields */ | 333 | /* Condition Register Bit Fields */ |
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h index d12382d292d4..415fa393b00c 100644 --- a/include/asm-powerpc/processor.h +++ b/include/asm-powerpc/processor.h | |||
@@ -10,7 +10,6 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | #include <asm/reg.h> | 13 | #include <asm/reg.h> |
15 | 14 | ||
16 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
@@ -50,6 +49,7 @@ | |||
50 | #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ | 49 | #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ |
51 | #define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ | 50 | #define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ |
52 | 51 | ||
52 | #ifdef __KERNEL__ | ||
53 | #define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ | 53 | #define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ |
54 | _machine == PLATFORM_PSERIES_LPAR) | 54 | _machine == PLATFORM_PSERIES_LPAR) |
55 | #define platform_is_lpar() (!!(_machine & PLATFORM_LPAR)) | 55 | #define platform_is_lpar() (!!(_machine & PLATFORM_LPAR)) |
@@ -68,7 +68,6 @@ extern int _chrp_type; | |||
68 | * vendor. Board revision is also made available. This will be moved | 68 | * vendor. Board revision is also made available. This will be moved |
69 | * elsewhere soon | 69 | * elsewhere soon |
70 | */ | 70 | */ |
71 | extern unsigned char ucSystemType; | ||
72 | extern unsigned char ucBoardRev; | 71 | extern unsigned char ucBoardRev; |
73 | extern unsigned char ucBoardRevMaj, ucBoardRevMin; | 72 | extern unsigned char ucBoardRevMaj, ucBoardRevMin; |
74 | 73 | ||
@@ -82,7 +81,7 @@ extern unsigned char ucBoardRevMaj, ucBoardRevMin; | |||
82 | #else | 81 | #else |
83 | #define _machine 0 | 82 | #define _machine 0 |
84 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | 83 | #endif /* CONFIG_PPC_MULTIPLATFORM */ |
85 | 84 | #endif /* __KERNEL__ */ | |
86 | /* | 85 | /* |
87 | * Default implementation of macro that returns current | 86 | * Default implementation of macro that returns current |
88 | * instruction pointer ("program counter"). | 87 | * instruction pointer ("program counter"). |
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index f999df1c5c90..329e9bf62260 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h | |||
@@ -65,49 +65,11 @@ struct boot_param_header | |||
65 | typedef u32 phandle; | 65 | typedef u32 phandle; |
66 | typedef u32 ihandle; | 66 | typedef u32 ihandle; |
67 | 67 | ||
68 | struct address_range { | ||
69 | unsigned long space; | ||
70 | unsigned long address; | ||
71 | unsigned long size; | ||
72 | }; | ||
73 | |||
74 | struct interrupt_info { | 68 | struct interrupt_info { |
75 | int line; | 69 | int line; |
76 | int sense; /* +ve/-ve logic, edge or level, etc. */ | 70 | int sense; /* +ve/-ve logic, edge or level, etc. */ |
77 | }; | 71 | }; |
78 | 72 | ||
79 | struct pci_address { | ||
80 | u32 a_hi; | ||
81 | u32 a_mid; | ||
82 | u32 a_lo; | ||
83 | }; | ||
84 | |||
85 | struct isa_address { | ||
86 | u32 a_hi; | ||
87 | u32 a_lo; | ||
88 | }; | ||
89 | |||
90 | struct isa_range { | ||
91 | struct isa_address isa_addr; | ||
92 | struct pci_address pci_addr; | ||
93 | unsigned int size; | ||
94 | }; | ||
95 | |||
96 | struct reg_property { | ||
97 | unsigned long address; | ||
98 | unsigned long size; | ||
99 | }; | ||
100 | |||
101 | struct reg_property32 { | ||
102 | unsigned int address; | ||
103 | unsigned int size; | ||
104 | }; | ||
105 | |||
106 | struct reg_property64 { | ||
107 | u64 address; | ||
108 | u64 size; | ||
109 | }; | ||
110 | |||
111 | struct property { | 73 | struct property { |
112 | char *name; | 74 | char *name; |
113 | int length; | 75 | int length; |
@@ -120,8 +82,6 @@ struct device_node { | |||
120 | char *type; | 82 | char *type; |
121 | phandle node; | 83 | phandle node; |
122 | phandle linux_phandle; | 84 | phandle linux_phandle; |
123 | int n_addrs; | ||
124 | struct address_range *addrs; | ||
125 | int n_intrs; | 85 | int n_intrs; |
126 | struct interrupt_info *intrs; | 86 | struct interrupt_info *intrs; |
127 | char *full_name; | 87 | char *full_name; |
@@ -223,5 +183,36 @@ extern struct resource *request_OF_resource(struct device_node* node, | |||
223 | int index, const char* name_postfix); | 183 | int index, const char* name_postfix); |
224 | extern int release_OF_resource(struct device_node* node, int index); | 184 | extern int release_OF_resource(struct device_node* node, int index); |
225 | 185 | ||
186 | |||
187 | /* | ||
188 | * OF address retreival & translation | ||
189 | */ | ||
190 | |||
191 | |||
192 | /* Translate an OF address block into a CPU physical address | ||
193 | */ | ||
194 | #define OF_BAD_ADDR ((u64)-1) | ||
195 | extern u64 of_translate_address(struct device_node *np, u32 *addr); | ||
196 | |||
197 | /* Extract an address from a device, returns the region size and | ||
198 | * the address space flags too. The PCI version uses a BAR number | ||
199 | * instead of an absolute index | ||
200 | */ | ||
201 | extern u32 *of_get_address(struct device_node *dev, int index, | ||
202 | u64 *size, unsigned int *flags); | ||
203 | extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, | ||
204 | u64 *size, unsigned int *flags); | ||
205 | |||
206 | /* Get an address as a resource. Note that if your address is | ||
207 | * a PIO address, the conversion will fail if the physical address | ||
208 | * can't be internally converted to an IO token with | ||
209 | * pci_address_to_pio(), that is because it's either called to early | ||
210 | * or it can't be matched to any host bridge IO space | ||
211 | */ | ||
212 | extern int of_address_to_resource(struct device_node *dev, int index, | ||
213 | struct resource *r); | ||
214 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | ||
215 | struct resource *r); | ||
216 | |||
226 | #endif /* __KERNEL__ */ | 217 | #endif /* __KERNEL__ */ |
227 | #endif /* _POWERPC_PROM_H */ | 218 | #endif /* _POWERPC_PROM_H */ |
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h index 1f7ecdb0b6ce..9c550b314823 100644 --- a/include/asm-powerpc/ptrace.h +++ b/include/asm-powerpc/ptrace.h | |||
@@ -87,7 +87,7 @@ extern unsigned long profile_pc(struct pt_regs *regs); | |||
87 | 87 | ||
88 | #define force_successful_syscall_return() \ | 88 | #define force_successful_syscall_return() \ |
89 | do { \ | 89 | do { \ |
90 | current_thread_info()->syscall_noerror = 1; \ | 90 | set_thread_flag(TIF_NOERROR); \ |
91 | } while(0) | 91 | } while(0) |
92 | 92 | ||
93 | /* | 93 | /* |
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h index eb392d038ed7..12ecc9b9f285 100644 --- a/include/asm-powerpc/reg.h +++ b/include/asm-powerpc/reg.h | |||
@@ -145,6 +145,10 @@ | |||
145 | #define SPRN_CTR 0x009 /* Count Register */ | 145 | #define SPRN_CTR 0x009 /* Count Register */ |
146 | #define SPRN_CTRLF 0x088 | 146 | #define SPRN_CTRLF 0x088 |
147 | #define SPRN_CTRLT 0x098 | 147 | #define SPRN_CTRLT 0x098 |
148 | #define CTRL_CT 0xc0000000 /* current thread */ | ||
149 | #define CTRL_CT0 0x80000000 /* thread 0 */ | ||
150 | #define CTRL_CT1 0x40000000 /* thread 1 */ | ||
151 | #define CTRL_TE 0x00c00000 /* thread enable */ | ||
148 | #define CTRL_RUNLATCH 0x1 | 152 | #define CTRL_RUNLATCH 0x1 |
149 | #define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ | 153 | #define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ |
150 | #define DABR_TRANSLATION (1UL << 2) | 154 | #define DABR_TRANSLATION (1UL << 2) |
@@ -257,11 +261,11 @@ | |||
257 | #define SPRN_HID6 0x3F9 /* BE HID 6 */ | 261 | #define SPRN_HID6 0x3F9 /* BE HID 6 */ |
258 | #define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */ | 262 | #define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */ |
259 | #define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */ | 263 | #define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */ |
260 | #define SPRN_TSCR 0x399 /* Thread switch control on BE */ | 264 | #define SPRN_TSC_CELL 0x399 /* Thread switch control on Cell */ |
261 | #define SPRN_TTR 0x39A /* Thread switch timeout on BE */ | 265 | #define TSC_CELL_DEC_ENABLE_0 0x400000 /* Decrementer Interrupt */ |
262 | #define TSCR_DEC_ENABLE 0x200000 /* Decrementer Interrupt */ | 266 | #define TSC_CELL_DEC_ENABLE_1 0x200000 /* Decrementer Interrupt */ |
263 | #define TSCR_EE_ENABLE 0x100000 /* External Interrupt */ | 267 | #define TSC_CELL_EE_ENABLE 0x100000 /* External Interrupt */ |
264 | #define TSCR_EE_BOOST 0x080000 /* External Interrupt Boost */ | 268 | #define TSC_CELL_EE_BOOST 0x080000 /* External Interrupt Boost */ |
265 | #define SPRN_TSC 0x3FD /* Thread switch control on others */ | 269 | #define SPRN_TSC 0x3FD /* Thread switch control on others */ |
266 | #define SPRN_TST 0x3FC /* Thread switch timeout on others */ | 270 | #define SPRN_TST 0x3FC /* Thread switch timeout on others */ |
267 | #if !defined(SPRN_IAC1) && !defined(SPRN_IAC2) | 271 | #if !defined(SPRN_IAC1) && !defined(SPRN_IAC2) |
@@ -375,6 +379,14 @@ | |||
375 | #define SPRN_SPRG7 0x117 /* Special Purpose Register General 7 */ | 379 | #define SPRN_SPRG7 0x117 /* Special Purpose Register General 7 */ |
376 | #define SPRN_SRR0 0x01A /* Save/Restore Register 0 */ | 380 | #define SPRN_SRR0 0x01A /* Save/Restore Register 0 */ |
377 | #define SPRN_SRR1 0x01B /* Save/Restore Register 1 */ | 381 | #define SPRN_SRR1 0x01B /* Save/Restore Register 1 */ |
382 | #define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */ | ||
383 | #define SRR1_WAKERESET 0x00380000 /* System reset */ | ||
384 | #define SRR1_WAKESYSERR 0x00300000 /* System error */ | ||
385 | #define SRR1_WAKEEE 0x00200000 /* External interrupt */ | ||
386 | #define SRR1_WAKEMT 0x00280000 /* mtctrl */ | ||
387 | #define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */ | ||
388 | #define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */ | ||
389 | |||
378 | #ifndef SPRN_SVR | 390 | #ifndef SPRN_SVR |
379 | #define SPRN_SVR 0x11E /* System Version Register */ | 391 | #define SPRN_SVR 0x11E /* System Version Register */ |
380 | #endif | 392 | #endif |
@@ -443,12 +455,35 @@ | |||
443 | #define SPRN_SDAR 781 | 455 | #define SPRN_SDAR 781 |
444 | 456 | ||
445 | #else /* 32-bit */ | 457 | #else /* 32-bit */ |
446 | #define SPRN_MMCR0 0x3B8 /* Monitor Mode Control Register 0 */ | 458 | #define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */ |
447 | #define SPRN_MMCR1 0x3BC /* Monitor Mode Control Register 1 */ | 459 | #define MMCR0_FC 0x80000000UL /* freeze counters */ |
448 | #define SPRN_PMC1 0x3B9 /* Performance Counter Register 1 */ | 460 | #define MMCR0_FCS 0x40000000UL /* freeze in supervisor state */ |
449 | #define SPRN_PMC2 0x3BA /* Performance Counter Register 2 */ | 461 | #define MMCR0_FCP 0x20000000UL /* freeze in problem state */ |
450 | #define SPRN_PMC3 0x3BD /* Performance Counter Register 3 */ | 462 | #define MMCR0_FCM1 0x10000000UL /* freeze counters while MSR mark = 1 */ |
451 | #define SPRN_PMC4 0x3BE /* Performance Counter Register 4 */ | 463 | #define MMCR0_FCM0 0x08000000UL /* freeze counters while MSR mark = 0 */ |
464 | #define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */ | ||
465 | #define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */ | ||
466 | #define MMCR0_TBEE 0x00400000UL /* time base exception enable */ | ||
467 | #define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/ | ||
468 | #define MMCR0_PMCnCE 0x00004000UL /* count enable for all but PMC 1*/ | ||
469 | #define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */ | ||
470 | #define MMCR0_PMC1SEL 0x00001fc0UL /* PMC 1 Event */ | ||
471 | #define MMCR0_PMC2SEL 0x0000003fUL /* PMC 2 Event */ | ||
472 | |||
473 | #define SPRN_MMCR1 956 | ||
474 | #define MMCR1_PMC3SEL 0xf8000000UL /* PMC 3 Event */ | ||
475 | #define MMCR1_PMC4SEL 0x07c00000UL /* PMC 4 Event */ | ||
476 | #define MMCR1_PMC5SEL 0x003e0000UL /* PMC 5 Event */ | ||
477 | #define MMCR1_PMC6SEL 0x0001f800UL /* PMC 6 Event */ | ||
478 | #define SPRN_MMCR2 944 | ||
479 | #define SPRN_PMC1 953 /* Performance Counter Register 1 */ | ||
480 | #define SPRN_PMC2 954 /* Performance Counter Register 2 */ | ||
481 | #define SPRN_PMC3 957 /* Performance Counter Register 3 */ | ||
482 | #define SPRN_PMC4 958 /* Performance Counter Register 4 */ | ||
483 | #define SPRN_PMC5 945 /* Performance Counter Register 5 */ | ||
484 | #define SPRN_PMC6 946 /* Performance Counter Register 6 */ | ||
485 | |||
486 | #define SPRN_SIAR 955 /* Sampled Instruction Address Register */ | ||
452 | 487 | ||
453 | /* Bit definitions for MMCR0 and PMC1 / PMC2. */ | 488 | /* Bit definitions for MMCR0 and PMC1 / PMC2. */ |
454 | #define MMCR0_PMC1_CYCLES (1 << 7) | 489 | #define MMCR0_PMC1_CYCLES (1 << 7) |
@@ -458,7 +493,6 @@ | |||
458 | #define MMCR0_PMC2_CYCLES 0x1 | 493 | #define MMCR0_PMC2_CYCLES 0x1 |
459 | #define MMCR0_PMC2_ITLB 0x7 | 494 | #define MMCR0_PMC2_ITLB 0x7 |
460 | #define MMCR0_PMC2_LOADMISSTIME 0x5 | 495 | #define MMCR0_PMC2_LOADMISSTIME 0x5 |
461 | #define MMCR0_PMXE (1 << 26) | ||
462 | #endif | 496 | #endif |
463 | 497 | ||
464 | /* Processor Version Register (PVR) field extraction */ | 498 | /* Processor Version Register (PVR) field extraction */ |
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h index d1bb611ea626..3428889e27b7 100644 --- a/include/asm-powerpc/rtas.h +++ b/include/asm-powerpc/rtas.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _POWERPC_RTAS_H | 1 | #ifndef _POWERPC_RTAS_H |
2 | #define _POWERPC_RTAS_H | 2 | #define _POWERPC_RTAS_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <linux/spinlock.h> | 5 | #include <linux/spinlock.h> |
5 | #include <asm/page.h> | 6 | #include <asm/page.h> |
@@ -229,4 +230,5 @@ extern unsigned long rtas_rmo_buf; | |||
229 | 230 | ||
230 | #define GLOBAL_INTERRUPT_QUEUE 9005 | 231 | #define GLOBAL_INTERRUPT_QUEUE 9005 |
231 | 232 | ||
233 | #endif /* __KERNEL__ */ | ||
232 | #endif /* _POWERPC_RTAS_H */ | 234 | #endif /* _POWERPC_RTAS_H */ |
diff --git a/include/asm-powerpc/seccomp.h b/include/asm-powerpc/seccomp.h index 1e1cfe12882b..853765eb1f65 100644 --- a/include/asm-powerpc/seccomp.h +++ b/include/asm-powerpc/seccomp.h | |||
@@ -1,6 +1,10 @@ | |||
1 | #ifndef _ASM_POWERPC_SECCOMP_H | 1 | #ifndef _ASM_POWERPC_SECCOMP_H |
2 | #define _ASM_POWERPC_SECCOMP_H | ||
2 | 3 | ||
4 | #ifdef __KERNEL__ | ||
3 | #include <linux/thread_info.h> | 5 | #include <linux/thread_info.h> |
6 | #endif | ||
7 | |||
4 | #include <linux/unistd.h> | 8 | #include <linux/unistd.h> |
5 | 9 | ||
6 | #define __NR_seccomp_read __NR_read | 10 | #define __NR_seccomp_read __NR_read |
diff --git a/include/asm-powerpc/sections.h b/include/asm-powerpc/sections.h index 47be2ac2a925..916018e425c4 100644 --- a/include/asm-powerpc/sections.h +++ b/include/asm-powerpc/sections.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_SECTIONS_H | 1 | #ifndef _ASM_POWERPC_SECTIONS_H |
2 | #define _ASM_POWERPC_SECTIONS_H | 2 | #define _ASM_POWERPC_SECTIONS_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <asm-generic/sections.h> | 5 | #include <asm-generic/sections.h> |
5 | 6 | ||
@@ -17,4 +18,5 @@ static inline int in_kernel_text(unsigned long addr) | |||
17 | 18 | ||
18 | #endif | 19 | #endif |
19 | 20 | ||
21 | #endif /* __KERNEL__ */ | ||
20 | #endif /* _ASM_POWERPC_SECTIONS_H */ | 22 | #endif /* _ASM_POWERPC_SECTIONS_H */ |
diff --git a/include/asm-powerpc/serial.h b/include/asm-powerpc/serial.h index b273d630b32f..6dc9546d6908 100644 --- a/include/asm-powerpc/serial.h +++ b/include/asm-powerpc/serial.h | |||
@@ -15,4 +15,6 @@ | |||
15 | /* Default baud base if not found in device-tree */ | 15 | /* Default baud base if not found in device-tree */ |
16 | #define BASE_BAUD ( 1843200 / 16 ) | 16 | #define BASE_BAUD ( 1843200 / 16 ) |
17 | 17 | ||
18 | extern void find_legacy_serial_ports(void); | ||
19 | |||
18 | #endif /* _PPC64_SERIAL_H */ | 20 | #endif /* _PPC64_SERIAL_H */ |
diff --git a/include/asm-powerpc/signal.h b/include/asm-powerpc/signal.h index 694c8d2dab87..a4d8f8648541 100644 --- a/include/asm-powerpc/signal.h +++ b/include/asm-powerpc/signal.h | |||
@@ -2,10 +2,13 @@ | |||
2 | #define _ASM_POWERPC_SIGNAL_H | 2 | #define _ASM_POWERPC_SIGNAL_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/config.h> | ||
6 | 5 | ||
7 | #define _NSIG 64 | 6 | #define _NSIG 64 |
8 | #define _NSIG_BPW BITS_PER_LONG | 7 | #ifdef __powerpc64__ |
8 | #define _NSIG_BPW 64 | ||
9 | #else | ||
10 | #define _NSIG_BPW 32 | ||
11 | #endif | ||
9 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | 12 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) |
10 | 13 | ||
11 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | 14 | typedef unsigned long old_sigset_t; /* at least 32 bits */ |
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h index 76c29a9784dd..134c2b5be0f2 100644 --- a/include/asm-powerpc/smu.h +++ b/include/asm-powerpc/smu.h | |||
@@ -4,9 +4,11 @@ | |||
4 | /* | 4 | /* |
5 | * Definitions for talking to the SMU chip in newer G5 PowerMacs | 5 | * Definitions for talking to the SMU chip in newer G5 PowerMacs |
6 | */ | 6 | */ |
7 | 7 | #ifdef __KERNEL__ | |
8 | #include <linux/config.h> | 8 | #include <linux/config.h> |
9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
10 | #endif | ||
11 | #include <linux/types.h> | ||
10 | 12 | ||
11 | /* | 13 | /* |
12 | * Known SMU commands | 14 | * Known SMU commands |
@@ -356,6 +358,9 @@ extern unsigned long smu_cmdbuf_abs; | |||
356 | * Kenrel asynchronous i2c interface | 358 | * Kenrel asynchronous i2c interface |
357 | */ | 359 | */ |
358 | 360 | ||
361 | #define SMU_I2C_READ_MAX 0x1d | ||
362 | #define SMU_I2C_WRITE_MAX 0x15 | ||
363 | |||
359 | /* SMU i2c header, exactly matches i2c header on wire */ | 364 | /* SMU i2c header, exactly matches i2c header on wire */ |
360 | struct smu_i2c_param | 365 | struct smu_i2c_param |
361 | { | 366 | { |
@@ -366,12 +371,9 @@ struct smu_i2c_param | |||
366 | u8 subaddr[3]; /* subaddress */ | 371 | u8 subaddr[3]; /* subaddress */ |
367 | u8 caddr; /* combined address, filled by SMU driver */ | 372 | u8 caddr; /* combined address, filled by SMU driver */ |
368 | u8 datalen; /* length of transfer */ | 373 | u8 datalen; /* length of transfer */ |
369 | u8 data[7]; /* data */ | 374 | u8 data[SMU_I2C_READ_MAX]; /* data */ |
370 | }; | 375 | }; |
371 | 376 | ||
372 | #define SMU_I2C_READ_MAX 0x0d | ||
373 | #define SMU_I2C_WRITE_MAX 0x05 | ||
374 | |||
375 | struct smu_i2c_cmd | 377 | struct smu_i2c_cmd |
376 | { | 378 | { |
377 | /* public */ | 379 | /* public */ |
@@ -385,7 +387,7 @@ struct smu_i2c_cmd | |||
385 | int read; | 387 | int read; |
386 | int stage; | 388 | int stage; |
387 | int retries; | 389 | int retries; |
388 | u8 pdata[0x10]; | 390 | u8 pdata[32]; |
389 | struct list_head link; | 391 | struct list_head link; |
390 | }; | 392 | }; |
391 | 393 | ||
@@ -487,8 +489,8 @@ struct smu_sdbp_slotspow { | |||
487 | #define SMU_SDB_SENSORTREE_ID 0x25 | 489 | #define SMU_SDB_SENSORTREE_ID 0x25 |
488 | 490 | ||
489 | struct smu_sdbp_sensortree { | 491 | struct smu_sdbp_sensortree { |
490 | u8 model_id; | 492 | __u8 model_id; |
491 | u8 unknown[3]; | 493 | __u8 unknown[3]; |
492 | }; | 494 | }; |
493 | 495 | ||
494 | /* This partition contains CPU thermal control PID informations. So far | 496 | /* This partition contains CPU thermal control PID informations. So far |
@@ -498,13 +500,13 @@ struct smu_sdbp_sensortree { | |||
498 | #define SMU_SDB_CPUPIDDATA_ID 0x17 | 500 | #define SMU_SDB_CPUPIDDATA_ID 0x17 |
499 | 501 | ||
500 | struct smu_sdbp_cpupiddata { | 502 | struct smu_sdbp_cpupiddata { |
501 | u8 unknown1; | 503 | __u8 unknown1; |
502 | u8 target_temp_delta; | 504 | __u8 target_temp_delta; |
503 | u8 unknown2; | 505 | __u8 unknown2; |
504 | u8 history_len; | 506 | __u8 history_len; |
505 | s16 power_adj; | 507 | __s16 power_adj; |
506 | u16 max_power; | 508 | __u16 max_power; |
507 | s32 gp,gr,gd; | 509 | __s32 gp,gr,gd; |
508 | }; | 510 | }; |
509 | 511 | ||
510 | 512 | ||
@@ -517,7 +519,7 @@ struct smu_sdbp_cpupiddata { | |||
517 | * if not found. The data format is described below | 519 | * if not found. The data format is described below |
518 | */ | 520 | */ |
519 | extern struct smu_sdbp_header *smu_get_sdb_partition(int id, | 521 | extern struct smu_sdbp_header *smu_get_sdb_partition(int id, |
520 | unsigned int *size); | 522 | unsigned int *size); |
521 | 523 | ||
522 | #endif /* __KERNEL__ */ | 524 | #endif /* __KERNEL__ */ |
523 | 525 | ||
diff --git a/include/asm-powerpc/sparsemem.h b/include/asm-powerpc/sparsemem.h index ba1b34fdb967..38b1ea3b58fd 100644 --- a/include/asm-powerpc/sparsemem.h +++ b/include/asm-powerpc/sparsemem.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_SPARSEMEM_H | 1 | #ifndef _ASM_POWERPC_SPARSEMEM_H |
2 | #define _ASM_POWERPC_SPARSEMEM_H 1 | 2 | #define _ASM_POWERPC_SPARSEMEM_H 1 |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #ifdef CONFIG_SPARSEMEM | 5 | #ifdef CONFIG_SPARSEMEM |
5 | /* | 6 | /* |
@@ -13,8 +14,17 @@ | |||
13 | 14 | ||
14 | #ifdef CONFIG_MEMORY_HOTPLUG | 15 | #ifdef CONFIG_MEMORY_HOTPLUG |
15 | extern void create_section_mapping(unsigned long start, unsigned long end); | 16 | extern void create_section_mapping(unsigned long start, unsigned long end); |
17 | #ifdef CONFIG_NUMA | ||
18 | extern int hot_add_scn_to_nid(unsigned long scn_addr); | ||
19 | #else | ||
20 | static inline int hot_add_scn_to_nid(unsigned long scn_addr) | ||
21 | { | ||
22 | return 0; | ||
23 | } | ||
24 | #endif /* CONFIG_NUMA */ | ||
16 | #endif /* CONFIG_MEMORY_HOTPLUG */ | 25 | #endif /* CONFIG_MEMORY_HOTPLUG */ |
17 | 26 | ||
18 | #endif /* CONFIG_SPARSEMEM */ | 27 | #endif /* CONFIG_SPARSEMEM */ |
19 | 28 | ||
29 | #endif /* __KERNEL__ */ | ||
20 | #endif /* _ASM_POWERPC_SPARSEMEM_H */ | 30 | #endif /* _ASM_POWERPC_SPARSEMEM_H */ |
diff --git a/include/asm-powerpc/spinlock.h b/include/asm-powerpc/spinlock.h index caa4b14e0e94..754900901cd8 100644 --- a/include/asm-powerpc/spinlock.h +++ b/include/asm-powerpc/spinlock.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef __ASM_SPINLOCK_H | 1 | #ifndef __ASM_SPINLOCK_H |
2 | #define __ASM_SPINLOCK_H | 2 | #define __ASM_SPINLOCK_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * Simple spin lock operations. | 6 | * Simple spin lock operations. |
@@ -266,4 +267,5 @@ static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) | |||
266 | rw->lock = 0; | 267 | rw->lock = 0; |
267 | } | 268 | } |
268 | 269 | ||
270 | #endif /* __KERNEL__ */ | ||
269 | #endif /* __ASM_SPINLOCK_H */ | 271 | #endif /* __ASM_SPINLOCK_H */ |
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h new file mode 100644 index 000000000000..38bacf2f6e0c --- /dev/null +++ b/include/asm-powerpc/spu.h | |||
@@ -0,0 +1,600 @@ | |||
1 | /* | ||
2 | * SPU core / file system interface and HW structures | ||
3 | * | ||
4 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 | ||
5 | * | ||
6 | * Author: Arnd Bergmann <arndb@de.ibm.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2, or (at your option) | ||
11 | * any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef _SPU_H | ||
24 | #define _SPU_H | ||
25 | #ifdef __KERNEL__ | ||
26 | |||
27 | #include <linux/config.h> | ||
28 | #include <linux/kref.h> | ||
29 | #include <linux/workqueue.h> | ||
30 | |||
31 | #define LS_SIZE (256 * 1024) | ||
32 | #define LS_ADDR_MASK (LS_SIZE - 1) | ||
33 | |||
34 | #define MFC_PUT_CMD 0x20 | ||
35 | #define MFC_PUTS_CMD 0x28 | ||
36 | #define MFC_PUTR_CMD 0x30 | ||
37 | #define MFC_PUTF_CMD 0x22 | ||
38 | #define MFC_PUTB_CMD 0x21 | ||
39 | #define MFC_PUTFS_CMD 0x2A | ||
40 | #define MFC_PUTBS_CMD 0x29 | ||
41 | #define MFC_PUTRF_CMD 0x32 | ||
42 | #define MFC_PUTRB_CMD 0x31 | ||
43 | #define MFC_PUTL_CMD 0x24 | ||
44 | #define MFC_PUTRL_CMD 0x34 | ||
45 | #define MFC_PUTLF_CMD 0x26 | ||
46 | #define MFC_PUTLB_CMD 0x25 | ||
47 | #define MFC_PUTRLF_CMD 0x36 | ||
48 | #define MFC_PUTRLB_CMD 0x35 | ||
49 | |||
50 | #define MFC_GET_CMD 0x40 | ||
51 | #define MFC_GETS_CMD 0x48 | ||
52 | #define MFC_GETF_CMD 0x42 | ||
53 | #define MFC_GETB_CMD 0x41 | ||
54 | #define MFC_GETFS_CMD 0x4A | ||
55 | #define MFC_GETBS_CMD 0x49 | ||
56 | #define MFC_GETL_CMD 0x44 | ||
57 | #define MFC_GETLF_CMD 0x46 | ||
58 | #define MFC_GETLB_CMD 0x45 | ||
59 | |||
60 | #define MFC_SDCRT_CMD 0x80 | ||
61 | #define MFC_SDCRTST_CMD 0x81 | ||
62 | #define MFC_SDCRZ_CMD 0x89 | ||
63 | #define MFC_SDCRS_CMD 0x8D | ||
64 | #define MFC_SDCRF_CMD 0x8F | ||
65 | |||
66 | #define MFC_GETLLAR_CMD 0xD0 | ||
67 | #define MFC_PUTLLC_CMD 0xB4 | ||
68 | #define MFC_PUTLLUC_CMD 0xB0 | ||
69 | #define MFC_PUTQLLUC_CMD 0xB8 | ||
70 | #define MFC_SNDSIG_CMD 0xA0 | ||
71 | #define MFC_SNDSIGB_CMD 0xA1 | ||
72 | #define MFC_SNDSIGF_CMD 0xA2 | ||
73 | #define MFC_BARRIER_CMD 0xC0 | ||
74 | #define MFC_EIEIO_CMD 0xC8 | ||
75 | #define MFC_SYNC_CMD 0xCC | ||
76 | |||
77 | #define MFC_MIN_DMA_SIZE_SHIFT 4 /* 16 bytes */ | ||
78 | #define MFC_MAX_DMA_SIZE_SHIFT 14 /* 16384 bytes */ | ||
79 | #define MFC_MIN_DMA_SIZE (1 << MFC_MIN_DMA_SIZE_SHIFT) | ||
80 | #define MFC_MAX_DMA_SIZE (1 << MFC_MAX_DMA_SIZE_SHIFT) | ||
81 | #define MFC_MIN_DMA_SIZE_MASK (MFC_MIN_DMA_SIZE - 1) | ||
82 | #define MFC_MAX_DMA_SIZE_MASK (MFC_MAX_DMA_SIZE - 1) | ||
83 | #define MFC_MIN_DMA_LIST_SIZE 0x0008 /* 8 bytes */ | ||
84 | #define MFC_MAX_DMA_LIST_SIZE 0x4000 /* 16K bytes */ | ||
85 | |||
86 | #define MFC_TAGID_TO_TAGMASK(tag_id) (1 << (tag_id & 0x1F)) | ||
87 | |||
88 | /* Events for Channels 0-2 */ | ||
89 | #define MFC_DMA_TAG_STATUS_UPDATE_EVENT 0x00000001 | ||
90 | #define MFC_DMA_TAG_CMD_STALL_NOTIFY_EVENT 0x00000002 | ||
91 | #define MFC_DMA_QUEUE_AVAILABLE_EVENT 0x00000008 | ||
92 | #define MFC_SPU_MAILBOX_WRITTEN_EVENT 0x00000010 | ||
93 | #define MFC_DECREMENTER_EVENT 0x00000020 | ||
94 | #define MFC_PU_INT_MAILBOX_AVAILABLE_EVENT 0x00000040 | ||
95 | #define MFC_PU_MAILBOX_AVAILABLE_EVENT 0x00000080 | ||
96 | #define MFC_SIGNAL_2_EVENT 0x00000100 | ||
97 | #define MFC_SIGNAL_1_EVENT 0x00000200 | ||
98 | #define MFC_LLR_LOST_EVENT 0x00000400 | ||
99 | #define MFC_PRIV_ATTN_EVENT 0x00000800 | ||
100 | #define MFC_MULTI_SRC_EVENT 0x00001000 | ||
101 | |||
102 | /* Flags indicating progress during context switch. */ | ||
103 | #define SPU_CONTEXT_SWITCH_PENDING 0UL | ||
104 | #define SPU_CONTEXT_SWITCH_ACTIVE 1UL | ||
105 | |||
106 | struct spu_context; | ||
107 | struct spu_runqueue; | ||
108 | |||
109 | struct spu { | ||
110 | char *name; | ||
111 | unsigned long local_store_phys; | ||
112 | u8 *local_store; | ||
113 | struct spu_problem __iomem *problem; | ||
114 | struct spu_priv1 __iomem *priv1; | ||
115 | struct spu_priv2 __iomem *priv2; | ||
116 | struct list_head list; | ||
117 | struct list_head sched_list; | ||
118 | int number; | ||
119 | u32 isrc; | ||
120 | u32 node; | ||
121 | u64 flags; | ||
122 | u64 dar; | ||
123 | u64 dsisr; | ||
124 | struct kref kref; | ||
125 | size_t ls_size; | ||
126 | unsigned int slb_replace; | ||
127 | struct mm_struct *mm; | ||
128 | struct spu_context *ctx; | ||
129 | struct spu_runqueue *rq; | ||
130 | unsigned long long timestamp; | ||
131 | pid_t pid; | ||
132 | int prio; | ||
133 | int class_0_pending; | ||
134 | spinlock_t register_lock; | ||
135 | |||
136 | u32 stop_code; | ||
137 | void (* wbox_callback)(struct spu *spu); | ||
138 | void (* ibox_callback)(struct spu *spu); | ||
139 | void (* stop_callback)(struct spu *spu); | ||
140 | |||
141 | char irq_c0[8]; | ||
142 | char irq_c1[8]; | ||
143 | char irq_c2[8]; | ||
144 | }; | ||
145 | |||
146 | struct spu *spu_alloc(void); | ||
147 | void spu_free(struct spu *spu); | ||
148 | int spu_irq_class_0_bottom(struct spu *spu); | ||
149 | int spu_irq_class_1_bottom(struct spu *spu); | ||
150 | void spu_irq_setaffinity(struct spu *spu, int cpu); | ||
151 | |||
152 | extern struct spufs_calls { | ||
153 | asmlinkage long (*create_thread)(const char __user *name, | ||
154 | unsigned int flags, mode_t mode); | ||
155 | asmlinkage long (*spu_run)(struct file *filp, __u32 __user *unpc, | ||
156 | __u32 __user *ustatus); | ||
157 | struct module *owner; | ||
158 | } spufs_calls; | ||
159 | |||
160 | #ifdef CONFIG_SPU_FS_MODULE | ||
161 | int register_spu_syscalls(struct spufs_calls *calls); | ||
162 | void unregister_spu_syscalls(struct spufs_calls *calls); | ||
163 | #else | ||
164 | static inline int register_spu_syscalls(struct spufs_calls *calls) | ||
165 | { | ||
166 | return 0; | ||
167 | } | ||
168 | static inline void unregister_spu_syscalls(struct spufs_calls *calls) | ||
169 | { | ||
170 | } | ||
171 | #endif /* MODULE */ | ||
172 | |||
173 | |||
174 | /* access to priv1 registers */ | ||
175 | void spu_int_mask_and(struct spu *spu, int class, u64 mask); | ||
176 | void spu_int_mask_or(struct spu *spu, int class, u64 mask); | ||
177 | void spu_int_mask_set(struct spu *spu, int class, u64 mask); | ||
178 | u64 spu_int_mask_get(struct spu *spu, int class); | ||
179 | void spu_int_stat_clear(struct spu *spu, int class, u64 stat); | ||
180 | u64 spu_int_stat_get(struct spu *spu, int class); | ||
181 | void spu_int_route_set(struct spu *spu, u64 route); | ||
182 | u64 spu_mfc_dar_get(struct spu *spu); | ||
183 | u64 spu_mfc_dsisr_get(struct spu *spu); | ||
184 | void spu_mfc_dsisr_set(struct spu *spu, u64 dsisr); | ||
185 | void spu_mfc_sdr_set(struct spu *spu, u64 sdr); | ||
186 | void spu_mfc_sr1_set(struct spu *spu, u64 sr1); | ||
187 | u64 spu_mfc_sr1_get(struct spu *spu); | ||
188 | void spu_mfc_tclass_id_set(struct spu *spu, u64 tclass_id); | ||
189 | u64 spu_mfc_tclass_id_get(struct spu *spu); | ||
190 | void spu_tlb_invalidate(struct spu *spu); | ||
191 | void spu_resource_allocation_groupID_set(struct spu *spu, u64 id); | ||
192 | u64 spu_resource_allocation_groupID_get(struct spu *spu); | ||
193 | void spu_resource_allocation_enable_set(struct spu *spu, u64 enable); | ||
194 | u64 spu_resource_allocation_enable_get(struct spu *spu); | ||
195 | |||
196 | |||
197 | /* | ||
198 | * This defines the Local Store, Problem Area and Privlege Area of an SPU. | ||
199 | */ | ||
200 | |||
201 | union mfc_tag_size_class_cmd { | ||
202 | struct { | ||
203 | u16 mfc_size; | ||
204 | u16 mfc_tag; | ||
205 | u8 pad; | ||
206 | u8 mfc_rclassid; | ||
207 | u16 mfc_cmd; | ||
208 | } u; | ||
209 | struct { | ||
210 | u32 mfc_size_tag32; | ||
211 | u32 mfc_class_cmd32; | ||
212 | } by32; | ||
213 | u64 all64; | ||
214 | }; | ||
215 | |||
216 | struct mfc_cq_sr { | ||
217 | u64 mfc_cq_data0_RW; | ||
218 | u64 mfc_cq_data1_RW; | ||
219 | u64 mfc_cq_data2_RW; | ||
220 | u64 mfc_cq_data3_RW; | ||
221 | }; | ||
222 | |||
223 | struct spu_problem { | ||
224 | #define MS_SYNC_PENDING 1L | ||
225 | u64 spc_mssync_RW; /* 0x0000 */ | ||
226 | u8 pad_0x0008_0x3000[0x3000 - 0x0008]; | ||
227 | |||
228 | /* DMA Area */ | ||
229 | u8 pad_0x3000_0x3004[0x4]; /* 0x3000 */ | ||
230 | u32 mfc_lsa_W; /* 0x3004 */ | ||
231 | u64 mfc_ea_W; /* 0x3008 */ | ||
232 | union mfc_tag_size_class_cmd mfc_union_W; /* 0x3010 */ | ||
233 | u8 pad_0x3018_0x3104[0xec]; /* 0x3018 */ | ||
234 | u32 dma_qstatus_R; /* 0x3104 */ | ||
235 | u8 pad_0x3108_0x3204[0xfc]; /* 0x3108 */ | ||
236 | u32 dma_querytype_RW; /* 0x3204 */ | ||
237 | u8 pad_0x3208_0x321c[0x14]; /* 0x3208 */ | ||
238 | u32 dma_querymask_RW; /* 0x321c */ | ||
239 | u8 pad_0x3220_0x322c[0xc]; /* 0x3220 */ | ||
240 | u32 dma_tagstatus_R; /* 0x322c */ | ||
241 | #define DMA_TAGSTATUS_INTR_ANY 1u | ||
242 | #define DMA_TAGSTATUS_INTR_ALL 2u | ||
243 | u8 pad_0x3230_0x4000[0x4000 - 0x3230]; /* 0x3230 */ | ||
244 | |||
245 | /* SPU Control Area */ | ||
246 | u8 pad_0x4000_0x4004[0x4]; /* 0x4000 */ | ||
247 | u32 pu_mb_R; /* 0x4004 */ | ||
248 | u8 pad_0x4008_0x400c[0x4]; /* 0x4008 */ | ||
249 | u32 spu_mb_W; /* 0x400c */ | ||
250 | u8 pad_0x4010_0x4014[0x4]; /* 0x4010 */ | ||
251 | u32 mb_stat_R; /* 0x4014 */ | ||
252 | u8 pad_0x4018_0x401c[0x4]; /* 0x4018 */ | ||
253 | u32 spu_runcntl_RW; /* 0x401c */ | ||
254 | #define SPU_RUNCNTL_STOP 0L | ||
255 | #define SPU_RUNCNTL_RUNNABLE 1L | ||
256 | u8 pad_0x4020_0x4024[0x4]; /* 0x4020 */ | ||
257 | u32 spu_status_R; /* 0x4024 */ | ||
258 | #define SPU_STOP_STATUS_SHIFT 16 | ||
259 | #define SPU_STATUS_STOPPED 0x0 | ||
260 | #define SPU_STATUS_RUNNING 0x1 | ||
261 | #define SPU_STATUS_STOPPED_BY_STOP 0x2 | ||
262 | #define SPU_STATUS_STOPPED_BY_HALT 0x4 | ||
263 | #define SPU_STATUS_WAITING_FOR_CHANNEL 0x8 | ||
264 | #define SPU_STATUS_SINGLE_STEP 0x10 | ||
265 | #define SPU_STATUS_INVALID_INSTR 0x20 | ||
266 | #define SPU_STATUS_INVALID_CH 0x40 | ||
267 | #define SPU_STATUS_ISOLATED_STATE 0x80 | ||
268 | #define SPU_STATUS_ISOLATED_LOAD_STAUTUS 0x200 | ||
269 | #define SPU_STATUS_ISOLATED_EXIT_STAUTUS 0x400 | ||
270 | u8 pad_0x4028_0x402c[0x4]; /* 0x4028 */ | ||
271 | u32 spu_spe_R; /* 0x402c */ | ||
272 | u8 pad_0x4030_0x4034[0x4]; /* 0x4030 */ | ||
273 | u32 spu_npc_RW; /* 0x4034 */ | ||
274 | u8 pad_0x4038_0x14000[0x14000 - 0x4038]; /* 0x4038 */ | ||
275 | |||
276 | /* Signal Notification Area */ | ||
277 | u8 pad_0x14000_0x1400c[0xc]; /* 0x14000 */ | ||
278 | u32 signal_notify1; /* 0x1400c */ | ||
279 | u8 pad_0x14010_0x1c00c[0x7ffc]; /* 0x14010 */ | ||
280 | u32 signal_notify2; /* 0x1c00c */ | ||
281 | } __attribute__ ((aligned(0x20000))); | ||
282 | |||
283 | /* SPU Privilege 2 State Area */ | ||
284 | struct spu_priv2 { | ||
285 | /* MFC Registers */ | ||
286 | u8 pad_0x0000_0x1100[0x1100 - 0x0000]; /* 0x0000 */ | ||
287 | |||
288 | /* SLB Management Registers */ | ||
289 | u8 pad_0x1100_0x1108[0x8]; /* 0x1100 */ | ||
290 | u64 slb_index_W; /* 0x1108 */ | ||
291 | #define SLB_INDEX_MASK 0x7L | ||
292 | u64 slb_esid_RW; /* 0x1110 */ | ||
293 | u64 slb_vsid_RW; /* 0x1118 */ | ||
294 | #define SLB_VSID_SUPERVISOR_STATE (0x1ull << 11) | ||
295 | #define SLB_VSID_SUPERVISOR_STATE_MASK (0x1ull << 11) | ||
296 | #define SLB_VSID_PROBLEM_STATE (0x1ull << 10) | ||
297 | #define SLB_VSID_PROBLEM_STATE_MASK (0x1ull << 10) | ||
298 | #define SLB_VSID_EXECUTE_SEGMENT (0x1ull << 9) | ||
299 | #define SLB_VSID_NO_EXECUTE_SEGMENT (0x1ull << 9) | ||
300 | #define SLB_VSID_EXECUTE_SEGMENT_MASK (0x1ull << 9) | ||
301 | #define SLB_VSID_4K_PAGE (0x0 << 8) | ||
302 | #define SLB_VSID_LARGE_PAGE (0x1ull << 8) | ||
303 | #define SLB_VSID_PAGE_SIZE_MASK (0x1ull << 8) | ||
304 | #define SLB_VSID_CLASS_MASK (0x1ull << 7) | ||
305 | #define SLB_VSID_VIRTUAL_PAGE_SIZE_MASK (0x1ull << 6) | ||
306 | u64 slb_invalidate_entry_W; /* 0x1120 */ | ||
307 | u64 slb_invalidate_all_W; /* 0x1128 */ | ||
308 | u8 pad_0x1130_0x2000[0x2000 - 0x1130]; /* 0x1130 */ | ||
309 | |||
310 | /* Context Save / Restore Area */ | ||
311 | struct mfc_cq_sr spuq[16]; /* 0x2000 */ | ||
312 | struct mfc_cq_sr puq[8]; /* 0x2200 */ | ||
313 | u8 pad_0x2300_0x3000[0x3000 - 0x2300]; /* 0x2300 */ | ||
314 | |||
315 | /* MFC Control */ | ||
316 | u64 mfc_control_RW; /* 0x3000 */ | ||
317 | #define MFC_CNTL_RESUME_DMA_QUEUE (0ull << 0) | ||
318 | #define MFC_CNTL_SUSPEND_DMA_QUEUE (1ull << 0) | ||
319 | #define MFC_CNTL_SUSPEND_DMA_QUEUE_MASK (1ull << 0) | ||
320 | #define MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION (0ull << 8) | ||
321 | #define MFC_CNTL_SUSPEND_IN_PROGRESS (1ull << 8) | ||
322 | #define MFC_CNTL_SUSPEND_COMPLETE (3ull << 8) | ||
323 | #define MFC_CNTL_SUSPEND_DMA_STATUS_MASK (3ull << 8) | ||
324 | #define MFC_CNTL_DMA_QUEUES_EMPTY (1ull << 14) | ||
325 | #define MFC_CNTL_DMA_QUEUES_EMPTY_MASK (1ull << 14) | ||
326 | #define MFC_CNTL_PURGE_DMA_REQUEST (1ull << 15) | ||
327 | #define MFC_CNTL_PURGE_DMA_IN_PROGRESS (1ull << 24) | ||
328 | #define MFC_CNTL_PURGE_DMA_COMPLETE (3ull << 24) | ||
329 | #define MFC_CNTL_PURGE_DMA_STATUS_MASK (3ull << 24) | ||
330 | #define MFC_CNTL_RESTART_DMA_COMMAND (1ull << 32) | ||
331 | #define MFC_CNTL_DMA_COMMAND_REISSUE_PENDING (1ull << 32) | ||
332 | #define MFC_CNTL_DMA_COMMAND_REISSUE_STATUS_MASK (1ull << 32) | ||
333 | #define MFC_CNTL_MFC_PRIVILEGE_STATE (2ull << 33) | ||
334 | #define MFC_CNTL_MFC_PROBLEM_STATE (3ull << 33) | ||
335 | #define MFC_CNTL_MFC_KEY_PROTECTION_STATE_MASK (3ull << 33) | ||
336 | #define MFC_CNTL_DECREMENTER_HALTED (1ull << 35) | ||
337 | #define MFC_CNTL_DECREMENTER_RUNNING (1ull << 40) | ||
338 | #define MFC_CNTL_DECREMENTER_STATUS_MASK (1ull << 40) | ||
339 | u8 pad_0x3008_0x4000[0x4000 - 0x3008]; /* 0x3008 */ | ||
340 | |||
341 | /* Interrupt Mailbox */ | ||
342 | u64 puint_mb_R; /* 0x4000 */ | ||
343 | u8 pad_0x4008_0x4040[0x4040 - 0x4008]; /* 0x4008 */ | ||
344 | |||
345 | /* SPU Control */ | ||
346 | u64 spu_privcntl_RW; /* 0x4040 */ | ||
347 | #define SPU_PRIVCNTL_MODE_NORMAL (0x0ull << 0) | ||
348 | #define SPU_PRIVCNTL_MODE_SINGLE_STEP (0x1ull << 0) | ||
349 | #define SPU_PRIVCNTL_MODE_MASK (0x1ull << 0) | ||
350 | #define SPU_PRIVCNTL_NO_ATTENTION_EVENT (0x0ull << 1) | ||
351 | #define SPU_PRIVCNTL_ATTENTION_EVENT (0x1ull << 1) | ||
352 | #define SPU_PRIVCNTL_ATTENTION_EVENT_MASK (0x1ull << 1) | ||
353 | #define SPU_PRIVCNT_LOAD_REQUEST_NORMAL (0x0ull << 2) | ||
354 | #define SPU_PRIVCNT_LOAD_REQUEST_ENABLE_MASK (0x1ull << 2) | ||
355 | u8 pad_0x4048_0x4058[0x10]; /* 0x4048 */ | ||
356 | u64 spu_lslr_RW; /* 0x4058 */ | ||
357 | u64 spu_chnlcntptr_RW; /* 0x4060 */ | ||
358 | u64 spu_chnlcnt_RW; /* 0x4068 */ | ||
359 | u64 spu_chnldata_RW; /* 0x4070 */ | ||
360 | u64 spu_cfg_RW; /* 0x4078 */ | ||
361 | u8 pad_0x4080_0x5000[0x5000 - 0x4080]; /* 0x4080 */ | ||
362 | |||
363 | /* PV2_ImplRegs: Implementation-specific privileged-state 2 regs */ | ||
364 | u64 spu_pm_trace_tag_status_RW; /* 0x5000 */ | ||
365 | u64 spu_tag_status_query_RW; /* 0x5008 */ | ||
366 | #define TAG_STATUS_QUERY_CONDITION_BITS (0x3ull << 32) | ||
367 | #define TAG_STATUS_QUERY_MASK_BITS (0xffffffffull) | ||
368 | u64 spu_cmd_buf1_RW; /* 0x5010 */ | ||
369 | #define SPU_COMMAND_BUFFER_1_LSA_BITS (0x7ffffull << 32) | ||
370 | #define SPU_COMMAND_BUFFER_1_EAH_BITS (0xffffffffull) | ||
371 | u64 spu_cmd_buf2_RW; /* 0x5018 */ | ||
372 | #define SPU_COMMAND_BUFFER_2_EAL_BITS ((0xffffffffull) << 32) | ||
373 | #define SPU_COMMAND_BUFFER_2_TS_BITS (0xffffull << 16) | ||
374 | #define SPU_COMMAND_BUFFER_2_TAG_BITS (0x3full) | ||
375 | u64 spu_atomic_status_RW; /* 0x5020 */ | ||
376 | } __attribute__ ((aligned(0x20000))); | ||
377 | |||
378 | /* SPU Privilege 1 State Area */ | ||
379 | struct spu_priv1 { | ||
380 | /* Control and Configuration Area */ | ||
381 | u64 mfc_sr1_RW; /* 0x000 */ | ||
382 | #define MFC_STATE1_LOCAL_STORAGE_DECODE_MASK 0x01ull | ||
383 | #define MFC_STATE1_BUS_TLBIE_MASK 0x02ull | ||
384 | #define MFC_STATE1_REAL_MODE_OFFSET_ENABLE_MASK 0x04ull | ||
385 | #define MFC_STATE1_PROBLEM_STATE_MASK 0x08ull | ||
386 | #define MFC_STATE1_RELOCATE_MASK 0x10ull | ||
387 | #define MFC_STATE1_MASTER_RUN_CONTROL_MASK 0x20ull | ||
388 | u64 mfc_lpid_RW; /* 0x008 */ | ||
389 | u64 spu_idr_RW; /* 0x010 */ | ||
390 | u64 mfc_vr_RO; /* 0x018 */ | ||
391 | #define MFC_VERSION_BITS (0xffff << 16) | ||
392 | #define MFC_REVISION_BITS (0xffff) | ||
393 | #define MFC_GET_VERSION_BITS(vr) (((vr) & MFC_VERSION_BITS) >> 16) | ||
394 | #define MFC_GET_REVISION_BITS(vr) ((vr) & MFC_REVISION_BITS) | ||
395 | u64 spu_vr_RO; /* 0x020 */ | ||
396 | #define SPU_VERSION_BITS (0xffff << 16) | ||
397 | #define SPU_REVISION_BITS (0xffff) | ||
398 | #define SPU_GET_VERSION_BITS(vr) (vr & SPU_VERSION_BITS) >> 16 | ||
399 | #define SPU_GET_REVISION_BITS(vr) (vr & SPU_REVISION_BITS) | ||
400 | u8 pad_0x28_0x100[0x100 - 0x28]; /* 0x28 */ | ||
401 | |||
402 | |||
403 | /* Interrupt Area */ | ||
404 | u64 int_mask_RW[3]; /* 0x100 */ | ||
405 | #define CLASS0_ENABLE_DMA_ALIGNMENT_INTR 0x1L | ||
406 | #define CLASS0_ENABLE_INVALID_DMA_COMMAND_INTR 0x2L | ||
407 | #define CLASS0_ENABLE_SPU_ERROR_INTR 0x4L | ||
408 | #define CLASS0_ENABLE_MFC_FIR_INTR 0x8L | ||
409 | #define CLASS1_ENABLE_SEGMENT_FAULT_INTR 0x1L | ||
410 | #define CLASS1_ENABLE_STORAGE_FAULT_INTR 0x2L | ||
411 | #define CLASS1_ENABLE_LS_COMPARE_SUSPEND_ON_GET_INTR 0x4L | ||
412 | #define CLASS1_ENABLE_LS_COMPARE_SUSPEND_ON_PUT_INTR 0x8L | ||
413 | #define CLASS2_ENABLE_MAILBOX_INTR 0x1L | ||
414 | #define CLASS2_ENABLE_SPU_STOP_INTR 0x2L | ||
415 | #define CLASS2_ENABLE_SPU_HALT_INTR 0x4L | ||
416 | #define CLASS2_ENABLE_SPU_DMA_TAG_GROUP_COMPLETE_INTR 0x8L | ||
417 | u8 pad_0x118_0x140[0x28]; /* 0x118 */ | ||
418 | u64 int_stat_RW[3]; /* 0x140 */ | ||
419 | u8 pad_0x158_0x180[0x28]; /* 0x158 */ | ||
420 | u64 int_route_RW; /* 0x180 */ | ||
421 | |||
422 | /* Interrupt Routing */ | ||
423 | u8 pad_0x188_0x200[0x200 - 0x188]; /* 0x188 */ | ||
424 | |||
425 | /* Atomic Unit Control Area */ | ||
426 | u64 mfc_atomic_flush_RW; /* 0x200 */ | ||
427 | #define mfc_atomic_flush_enable 0x1L | ||
428 | u8 pad_0x208_0x280[0x78]; /* 0x208 */ | ||
429 | u64 resource_allocation_groupID_RW; /* 0x280 */ | ||
430 | u64 resource_allocation_enable_RW; /* 0x288 */ | ||
431 | u8 pad_0x290_0x3c8[0x3c8 - 0x290]; /* 0x290 */ | ||
432 | |||
433 | /* SPU_Cache_ImplRegs: Implementation-dependent cache registers */ | ||
434 | |||
435 | u64 smf_sbi_signal_sel; /* 0x3c8 */ | ||
436 | #define smf_sbi_mask_lsb 56 | ||
437 | #define smf_sbi_shift (63 - smf_sbi_mask_lsb) | ||
438 | #define smf_sbi_mask (0x301LL << smf_sbi_shift) | ||
439 | #define smf_sbi_bus0_bits (0x001LL << smf_sbi_shift) | ||
440 | #define smf_sbi_bus2_bits (0x100LL << smf_sbi_shift) | ||
441 | #define smf_sbi2_bus0_bits (0x201LL << smf_sbi_shift) | ||
442 | #define smf_sbi2_bus2_bits (0x300LL << smf_sbi_shift) | ||
443 | u64 smf_ato_signal_sel; /* 0x3d0 */ | ||
444 | #define smf_ato_mask_lsb 35 | ||
445 | #define smf_ato_shift (63 - smf_ato_mask_lsb) | ||
446 | #define smf_ato_mask (0x3LL << smf_ato_shift) | ||
447 | #define smf_ato_bus0_bits (0x2LL << smf_ato_shift) | ||
448 | #define smf_ato_bus2_bits (0x1LL << smf_ato_shift) | ||
449 | u8 pad_0x3d8_0x400[0x400 - 0x3d8]; /* 0x3d8 */ | ||
450 | |||
451 | /* TLB Management Registers */ | ||
452 | u64 mfc_sdr_RW; /* 0x400 */ | ||
453 | u8 pad_0x408_0x500[0xf8]; /* 0x408 */ | ||
454 | u64 tlb_index_hint_RO; /* 0x500 */ | ||
455 | u64 tlb_index_W; /* 0x508 */ | ||
456 | u64 tlb_vpn_RW; /* 0x510 */ | ||
457 | u64 tlb_rpn_RW; /* 0x518 */ | ||
458 | u8 pad_0x520_0x540[0x20]; /* 0x520 */ | ||
459 | u64 tlb_invalidate_entry_W; /* 0x540 */ | ||
460 | u64 tlb_invalidate_all_W; /* 0x548 */ | ||
461 | u8 pad_0x550_0x580[0x580 - 0x550]; /* 0x550 */ | ||
462 | |||
463 | /* SPU_MMU_ImplRegs: Implementation-dependent MMU registers */ | ||
464 | u64 smm_hid; /* 0x580 */ | ||
465 | #define PAGE_SIZE_MASK 0xf000000000000000ull | ||
466 | #define PAGE_SIZE_16MB_64KB 0x2000000000000000ull | ||
467 | u8 pad_0x588_0x600[0x600 - 0x588]; /* 0x588 */ | ||
468 | |||
469 | /* MFC Status/Control Area */ | ||
470 | u64 mfc_accr_RW; /* 0x600 */ | ||
471 | #define MFC_ACCR_EA_ACCESS_GET (1 << 0) | ||
472 | #define MFC_ACCR_EA_ACCESS_PUT (1 << 1) | ||
473 | #define MFC_ACCR_LS_ACCESS_GET (1 << 3) | ||
474 | #define MFC_ACCR_LS_ACCESS_PUT (1 << 4) | ||
475 | u8 pad_0x608_0x610[0x8]; /* 0x608 */ | ||
476 | u64 mfc_dsisr_RW; /* 0x610 */ | ||
477 | #define MFC_DSISR_PTE_NOT_FOUND (1 << 30) | ||
478 | #define MFC_DSISR_ACCESS_DENIED (1 << 27) | ||
479 | #define MFC_DSISR_ATOMIC (1 << 26) | ||
480 | #define MFC_DSISR_ACCESS_PUT (1 << 25) | ||
481 | #define MFC_DSISR_ADDR_MATCH (1 << 22) | ||
482 | #define MFC_DSISR_LS (1 << 17) | ||
483 | #define MFC_DSISR_L (1 << 16) | ||
484 | #define MFC_DSISR_ADDRESS_OVERFLOW (1 << 0) | ||
485 | u8 pad_0x618_0x620[0x8]; /* 0x618 */ | ||
486 | u64 mfc_dar_RW; /* 0x620 */ | ||
487 | u8 pad_0x628_0x700[0x700 - 0x628]; /* 0x628 */ | ||
488 | |||
489 | /* Replacement Management Table (RMT) Area */ | ||
490 | u64 rmt_index_RW; /* 0x700 */ | ||
491 | u8 pad_0x708_0x710[0x8]; /* 0x708 */ | ||
492 | u64 rmt_data1_RW; /* 0x710 */ | ||
493 | u8 pad_0x718_0x800[0x800 - 0x718]; /* 0x718 */ | ||
494 | |||
495 | /* Control/Configuration Registers */ | ||
496 | u64 mfc_dsir_R; /* 0x800 */ | ||
497 | #define MFC_DSIR_Q (1 << 31) | ||
498 | #define MFC_DSIR_SPU_QUEUE MFC_DSIR_Q | ||
499 | u64 mfc_lsacr_RW; /* 0x808 */ | ||
500 | #define MFC_LSACR_COMPARE_MASK ((~0ull) << 32) | ||
501 | #define MFC_LSACR_COMPARE_ADDR ((~0ull) >> 32) | ||
502 | u64 mfc_lscrr_R; /* 0x810 */ | ||
503 | #define MFC_LSCRR_Q (1 << 31) | ||
504 | #define MFC_LSCRR_SPU_QUEUE MFC_LSCRR_Q | ||
505 | #define MFC_LSCRR_QI_SHIFT 32 | ||
506 | #define MFC_LSCRR_QI_MASK ((~0ull) << MFC_LSCRR_QI_SHIFT) | ||
507 | u8 pad_0x818_0x820[0x8]; /* 0x818 */ | ||
508 | u64 mfc_tclass_id_RW; /* 0x820 */ | ||
509 | #define MFC_TCLASS_ID_ENABLE (1L << 0L) | ||
510 | #define MFC_TCLASS_SLOT2_ENABLE (1L << 5L) | ||
511 | #define MFC_TCLASS_SLOT1_ENABLE (1L << 6L) | ||
512 | #define MFC_TCLASS_SLOT0_ENABLE (1L << 7L) | ||
513 | #define MFC_TCLASS_QUOTA_2_SHIFT 8L | ||
514 | #define MFC_TCLASS_QUOTA_1_SHIFT 16L | ||
515 | #define MFC_TCLASS_QUOTA_0_SHIFT 24L | ||
516 | #define MFC_TCLASS_QUOTA_2_MASK (0x1FL << MFC_TCLASS_QUOTA_2_SHIFT) | ||
517 | #define MFC_TCLASS_QUOTA_1_MASK (0x1FL << MFC_TCLASS_QUOTA_1_SHIFT) | ||
518 | #define MFC_TCLASS_QUOTA_0_MASK (0x1FL << MFC_TCLASS_QUOTA_0_SHIFT) | ||
519 | u8 pad_0x828_0x900[0x900 - 0x828]; /* 0x828 */ | ||
520 | |||
521 | /* Real Mode Support Registers */ | ||
522 | u64 mfc_rm_boundary; /* 0x900 */ | ||
523 | u8 pad_0x908_0x938[0x30]; /* 0x908 */ | ||
524 | u64 smf_dma_signal_sel; /* 0x938 */ | ||
525 | #define mfc_dma1_mask_lsb 41 | ||
526 | #define mfc_dma1_shift (63 - mfc_dma1_mask_lsb) | ||
527 | #define mfc_dma1_mask (0x3LL << mfc_dma1_shift) | ||
528 | #define mfc_dma1_bits (0x1LL << mfc_dma1_shift) | ||
529 | #define mfc_dma2_mask_lsb 43 | ||
530 | #define mfc_dma2_shift (63 - mfc_dma2_mask_lsb) | ||
531 | #define mfc_dma2_mask (0x3LL << mfc_dma2_shift) | ||
532 | #define mfc_dma2_bits (0x1LL << mfc_dma2_shift) | ||
533 | u8 pad_0x940_0xa38[0xf8]; /* 0x940 */ | ||
534 | u64 smm_signal_sel; /* 0xa38 */ | ||
535 | #define smm_sig_mask_lsb 12 | ||
536 | #define smm_sig_shift (63 - smm_sig_mask_lsb) | ||
537 | #define smm_sig_mask (0x3LL << smm_sig_shift) | ||
538 | #define smm_sig_bus0_bits (0x2LL << smm_sig_shift) | ||
539 | #define smm_sig_bus2_bits (0x1LL << smm_sig_shift) | ||
540 | u8 pad_0xa40_0xc00[0xc00 - 0xa40]; /* 0xa40 */ | ||
541 | |||
542 | /* DMA Command Error Area */ | ||
543 | u64 mfc_cer_R; /* 0xc00 */ | ||
544 | #define MFC_CER_Q (1 << 31) | ||
545 | #define MFC_CER_SPU_QUEUE MFC_CER_Q | ||
546 | u8 pad_0xc08_0x1000[0x1000 - 0xc08]; /* 0xc08 */ | ||
547 | |||
548 | /* PV1_ImplRegs: Implementation-dependent privileged-state 1 regs */ | ||
549 | /* DMA Command Error Area */ | ||
550 | u64 spu_ecc_cntl_RW; /* 0x1000 */ | ||
551 | #define SPU_ECC_CNTL_E (1ull << 0ull) | ||
552 | #define SPU_ECC_CNTL_ENABLE SPU_ECC_CNTL_E | ||
553 | #define SPU_ECC_CNTL_DISABLE (~SPU_ECC_CNTL_E & 1L) | ||
554 | #define SPU_ECC_CNTL_S (1ull << 1ull) | ||
555 | #define SPU_ECC_STOP_AFTER_ERROR SPU_ECC_CNTL_S | ||
556 | #define SPU_ECC_CONTINUE_AFTER_ERROR (~SPU_ECC_CNTL_S & 2L) | ||
557 | #define SPU_ECC_CNTL_B (1ull << 2ull) | ||
558 | #define SPU_ECC_BACKGROUND_ENABLE SPU_ECC_CNTL_B | ||
559 | #define SPU_ECC_BACKGROUND_DISABLE (~SPU_ECC_CNTL_B & 4L) | ||
560 | #define SPU_ECC_CNTL_I_SHIFT 3ull | ||
561 | #define SPU_ECC_CNTL_I_MASK (3ull << SPU_ECC_CNTL_I_SHIFT) | ||
562 | #define SPU_ECC_WRITE_ALWAYS (~SPU_ECC_CNTL_I & 12L) | ||
563 | #define SPU_ECC_WRITE_CORRECTABLE (1ull << SPU_ECC_CNTL_I_SHIFT) | ||
564 | #define SPU_ECC_WRITE_UNCORRECTABLE (3ull << SPU_ECC_CNTL_I_SHIFT) | ||
565 | #define SPU_ECC_CNTL_D (1ull << 5ull) | ||
566 | #define SPU_ECC_DETECTION_ENABLE SPU_ECC_CNTL_D | ||
567 | #define SPU_ECC_DETECTION_DISABLE (~SPU_ECC_CNTL_D & 32L) | ||
568 | u64 spu_ecc_stat_RW; /* 0x1008 */ | ||
569 | #define SPU_ECC_CORRECTED_ERROR (1ull << 0ul) | ||
570 | #define SPU_ECC_UNCORRECTED_ERROR (1ull << 1ul) | ||
571 | #define SPU_ECC_SCRUB_COMPLETE (1ull << 2ul) | ||
572 | #define SPU_ECC_SCRUB_IN_PROGRESS (1ull << 3ul) | ||
573 | #define SPU_ECC_INSTRUCTION_ERROR (1ull << 4ul) | ||
574 | #define SPU_ECC_DATA_ERROR (1ull << 5ul) | ||
575 | #define SPU_ECC_DMA_ERROR (1ull << 6ul) | ||
576 | #define SPU_ECC_STATUS_CNT_MASK (256ull << 8) | ||
577 | u64 spu_ecc_addr_RW; /* 0x1010 */ | ||
578 | u64 spu_err_mask_RW; /* 0x1018 */ | ||
579 | #define SPU_ERR_ILLEGAL_INSTR (1ull << 0ul) | ||
580 | #define SPU_ERR_ILLEGAL_CHANNEL (1ull << 1ul) | ||
581 | u8 pad_0x1020_0x1028[0x1028 - 0x1020]; /* 0x1020 */ | ||
582 | |||
583 | /* SPU Debug-Trace Bus (DTB) Selection Registers */ | ||
584 | u64 spu_trig0_sel; /* 0x1028 */ | ||
585 | u64 spu_trig1_sel; /* 0x1030 */ | ||
586 | u64 spu_trig2_sel; /* 0x1038 */ | ||
587 | u64 spu_trig3_sel; /* 0x1040 */ | ||
588 | u64 spu_trace_sel; /* 0x1048 */ | ||
589 | #define spu_trace_sel_mask 0x1f1fLL | ||
590 | #define spu_trace_sel_bus0_bits 0x1000LL | ||
591 | #define spu_trace_sel_bus2_bits 0x0010LL | ||
592 | u64 spu_event0_sel; /* 0x1050 */ | ||
593 | u64 spu_event1_sel; /* 0x1058 */ | ||
594 | u64 spu_event2_sel; /* 0x1060 */ | ||
595 | u64 spu_event3_sel; /* 0x1068 */ | ||
596 | u64 spu_trace_cntl; /* 0x1070 */ | ||
597 | } __attribute__ ((aligned(0x2000))); | ||
598 | |||
599 | #endif /* __KERNEL__ */ | ||
600 | #endif | ||
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h new file mode 100644 index 000000000000..ba18d7d4dde2 --- /dev/null +++ b/include/asm-powerpc/spu_csa.h | |||
@@ -0,0 +1,255 @@ | |||
1 | /* | ||
2 | * spu_csa.h: Definitions for SPU context save area (CSA). | ||
3 | * | ||
4 | * (C) Copyright IBM 2005 | ||
5 | * | ||
6 | * Author: Mark Nutter <mnutter@us.ibm.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2, or (at your option) | ||
11 | * any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef _SPU_CSA_H_ | ||
24 | #define _SPU_CSA_H_ | ||
25 | #ifdef __KERNEL__ | ||
26 | |||
27 | /* | ||
28 | * Total number of 128-bit registers. | ||
29 | */ | ||
30 | #define NR_SPU_GPRS 128 | ||
31 | #define NR_SPU_SPRS 9 | ||
32 | #define NR_SPU_REGS_PAD 7 | ||
33 | #define NR_SPU_SPILL_REGS 144 /* GPRS + SPRS + PAD */ | ||
34 | #define SIZEOF_SPU_SPILL_REGS NR_SPU_SPILL_REGS * 16 | ||
35 | |||
36 | #define SPU_SAVE_COMPLETE 0x3FFB | ||
37 | #define SPU_RESTORE_COMPLETE 0x3FFC | ||
38 | |||
39 | /* | ||
40 | * Definitions for various 'stopped' status conditions, | ||
41 | * to be recreated during context restore. | ||
42 | */ | ||
43 | #define SPU_STOPPED_STATUS_P 1 | ||
44 | #define SPU_STOPPED_STATUS_I 2 | ||
45 | #define SPU_STOPPED_STATUS_H 3 | ||
46 | #define SPU_STOPPED_STATUS_S 4 | ||
47 | #define SPU_STOPPED_STATUS_S_I 5 | ||
48 | #define SPU_STOPPED_STATUS_S_P 6 | ||
49 | #define SPU_STOPPED_STATUS_P_H 7 | ||
50 | #define SPU_STOPPED_STATUS_P_I 8 | ||
51 | #define SPU_STOPPED_STATUS_R 9 | ||
52 | |||
53 | #ifndef __ASSEMBLY__ | ||
54 | /** | ||
55 | * spu_reg128 - generic 128-bit register definition. | ||
56 | */ | ||
57 | struct spu_reg128 { | ||
58 | u32 slot[4]; | ||
59 | }; | ||
60 | |||
61 | /** | ||
62 | * struct spu_lscsa - Local Store Context Save Area. | ||
63 | * @gprs: Array of saved registers. | ||
64 | * @fpcr: Saved floating point status control register. | ||
65 | * @decr: Saved decrementer value. | ||
66 | * @decr_status: Indicates decrementer run status. | ||
67 | * @ppu_mb: Saved PPU mailbox data. | ||
68 | * @ppuint_mb: Saved PPU interrupting mailbox data. | ||
69 | * @tag_mask: Saved tag group mask. | ||
70 | * @event_mask: Saved event mask. | ||
71 | * @srr0: Saved SRR0. | ||
72 | * @stopped_status: Conditions to be recreated by restore. | ||
73 | * @ls: Saved contents of Local Storage Area. | ||
74 | * | ||
75 | * The LSCSA represents state that is primarily saved and | ||
76 | * restored by SPU-side code. | ||
77 | */ | ||
78 | struct spu_lscsa { | ||
79 | struct spu_reg128 gprs[128]; | ||
80 | struct spu_reg128 fpcr; | ||
81 | struct spu_reg128 decr; | ||
82 | struct spu_reg128 decr_status; | ||
83 | struct spu_reg128 ppu_mb; | ||
84 | struct spu_reg128 ppuint_mb; | ||
85 | struct spu_reg128 tag_mask; | ||
86 | struct spu_reg128 event_mask; | ||
87 | struct spu_reg128 srr0; | ||
88 | struct spu_reg128 stopped_status; | ||
89 | struct spu_reg128 pad[119]; /* 'ls' must be page-aligned. */ | ||
90 | unsigned char ls[LS_SIZE]; | ||
91 | }; | ||
92 | |||
93 | /* | ||
94 | * struct spu_problem_collapsed - condensed problem state area, w/o pads. | ||
95 | */ | ||
96 | struct spu_problem_collapsed { | ||
97 | u64 spc_mssync_RW; | ||
98 | u32 mfc_lsa_W; | ||
99 | u32 unused_pad0; | ||
100 | u64 mfc_ea_W; | ||
101 | union mfc_tag_size_class_cmd mfc_union_W; | ||
102 | u32 dma_qstatus_R; | ||
103 | u32 dma_querytype_RW; | ||
104 | u32 dma_querymask_RW; | ||
105 | u32 dma_tagstatus_R; | ||
106 | u32 pu_mb_R; | ||
107 | u32 spu_mb_W; | ||
108 | u32 mb_stat_R; | ||
109 | u32 spu_runcntl_RW; | ||
110 | u32 spu_status_R; | ||
111 | u32 spu_spc_R; | ||
112 | u32 spu_npc_RW; | ||
113 | u32 signal_notify1; | ||
114 | u32 signal_notify2; | ||
115 | u32 unused_pad1; | ||
116 | }; | ||
117 | |||
118 | /* | ||
119 | * struct spu_priv1_collapsed - condensed privileged 1 area, w/o pads. | ||
120 | */ | ||
121 | struct spu_priv1_collapsed { | ||
122 | u64 mfc_sr1_RW; | ||
123 | u64 mfc_lpid_RW; | ||
124 | u64 spu_idr_RW; | ||
125 | u64 mfc_vr_RO; | ||
126 | u64 spu_vr_RO; | ||
127 | u64 int_mask_class0_RW; | ||
128 | u64 int_mask_class1_RW; | ||
129 | u64 int_mask_class2_RW; | ||
130 | u64 int_stat_class0_RW; | ||
131 | u64 int_stat_class1_RW; | ||
132 | u64 int_stat_class2_RW; | ||
133 | u64 int_route_RW; | ||
134 | u64 mfc_atomic_flush_RW; | ||
135 | u64 resource_allocation_groupID_RW; | ||
136 | u64 resource_allocation_enable_RW; | ||
137 | u64 mfc_fir_R; | ||
138 | u64 mfc_fir_status_or_W; | ||
139 | u64 mfc_fir_status_and_W; | ||
140 | u64 mfc_fir_mask_R; | ||
141 | u64 mfc_fir_mask_or_W; | ||
142 | u64 mfc_fir_mask_and_W; | ||
143 | u64 mfc_fir_chkstp_enable_RW; | ||
144 | u64 smf_sbi_signal_sel; | ||
145 | u64 smf_ato_signal_sel; | ||
146 | u64 mfc_sdr_RW; | ||
147 | u64 tlb_index_hint_RO; | ||
148 | u64 tlb_index_W; | ||
149 | u64 tlb_vpn_RW; | ||
150 | u64 tlb_rpn_RW; | ||
151 | u64 tlb_invalidate_entry_W; | ||
152 | u64 tlb_invalidate_all_W; | ||
153 | u64 smm_hid; | ||
154 | u64 mfc_accr_RW; | ||
155 | u64 mfc_dsisr_RW; | ||
156 | u64 mfc_dar_RW; | ||
157 | u64 rmt_index_RW; | ||
158 | u64 rmt_data1_RW; | ||
159 | u64 mfc_dsir_R; | ||
160 | u64 mfc_lsacr_RW; | ||
161 | u64 mfc_lscrr_R; | ||
162 | u64 mfc_tclass_id_RW; | ||
163 | u64 mfc_rm_boundary; | ||
164 | u64 smf_dma_signal_sel; | ||
165 | u64 smm_signal_sel; | ||
166 | u64 mfc_cer_R; | ||
167 | u64 pu_ecc_cntl_RW; | ||
168 | u64 pu_ecc_stat_RW; | ||
169 | u64 spu_ecc_addr_RW; | ||
170 | u64 spu_err_mask_RW; | ||
171 | u64 spu_trig0_sel; | ||
172 | u64 spu_trig1_sel; | ||
173 | u64 spu_trig2_sel; | ||
174 | u64 spu_trig3_sel; | ||
175 | u64 spu_trace_sel; | ||
176 | u64 spu_event0_sel; | ||
177 | u64 spu_event1_sel; | ||
178 | u64 spu_event2_sel; | ||
179 | u64 spu_event3_sel; | ||
180 | u64 spu_trace_cntl; | ||
181 | }; | ||
182 | |||
183 | /* | ||
184 | * struct spu_priv2_collapsed - condensed priviliged 2 area, w/o pads. | ||
185 | */ | ||
186 | struct spu_priv2_collapsed { | ||
187 | u64 slb_index_W; | ||
188 | u64 slb_esid_RW; | ||
189 | u64 slb_vsid_RW; | ||
190 | u64 slb_invalidate_entry_W; | ||
191 | u64 slb_invalidate_all_W; | ||
192 | struct mfc_cq_sr spuq[16]; | ||
193 | struct mfc_cq_sr puq[8]; | ||
194 | u64 mfc_control_RW; | ||
195 | u64 puint_mb_R; | ||
196 | u64 spu_privcntl_RW; | ||
197 | u64 spu_lslr_RW; | ||
198 | u64 spu_chnlcntptr_RW; | ||
199 | u64 spu_chnlcnt_RW; | ||
200 | u64 spu_chnldata_RW; | ||
201 | u64 spu_cfg_RW; | ||
202 | u64 spu_tag_status_query_RW; | ||
203 | u64 spu_cmd_buf1_RW; | ||
204 | u64 spu_cmd_buf2_RW; | ||
205 | u64 spu_atomic_status_RW; | ||
206 | }; | ||
207 | |||
208 | /** | ||
209 | * struct spu_state | ||
210 | * @lscsa: Local Store Context Save Area. | ||
211 | * @prob: Collapsed Problem State Area, w/o pads. | ||
212 | * @priv1: Collapsed Privileged 1 Area, w/o pads. | ||
213 | * @priv2: Collapsed Privileged 2 Area, w/o pads. | ||
214 | * @spu_chnlcnt_RW: Array of saved channel counts. | ||
215 | * @spu_chnldata_RW: Array of saved channel data. | ||
216 | * @suspend_time: Time stamp when decrementer disabled. | ||
217 | * @slb_esid_RW: Array of saved SLB esid entries. | ||
218 | * @slb_vsid_RW: Array of saved SLB vsid entries. | ||
219 | * | ||
220 | * Structure representing the whole of the SPU | ||
221 | * context save area (CSA). This struct contains | ||
222 | * all of the state necessary to suspend and then | ||
223 | * later optionally resume execution of an SPU | ||
224 | * context. | ||
225 | * | ||
226 | * The @lscsa region is by far the largest, and is | ||
227 | * allocated separately so that it may either be | ||
228 | * pinned or mapped to/from application memory, as | ||
229 | * appropriate for the OS environment. | ||
230 | */ | ||
231 | struct spu_state { | ||
232 | struct spu_lscsa *lscsa; | ||
233 | struct spu_problem_collapsed prob; | ||
234 | struct spu_priv1_collapsed priv1; | ||
235 | struct spu_priv2_collapsed priv2; | ||
236 | u64 spu_chnlcnt_RW[32]; | ||
237 | u64 spu_chnldata_RW[32]; | ||
238 | u32 spu_mailbox_data[4]; | ||
239 | u32 pu_mailbox_data[1]; | ||
240 | unsigned long suspend_time; | ||
241 | u64 slb_esid_RW[8]; | ||
242 | u64 slb_vsid_RW[8]; | ||
243 | spinlock_t register_lock; | ||
244 | }; | ||
245 | |||
246 | extern void spu_init_csa(struct spu_state *csa); | ||
247 | extern void spu_fini_csa(struct spu_state *csa); | ||
248 | extern int spu_save(struct spu_state *prev, struct spu *spu); | ||
249 | extern int spu_restore(struct spu_state *new, struct spu *spu); | ||
250 | extern int spu_switch(struct spu_state *prev, struct spu_state *new, | ||
251 | struct spu *spu); | ||
252 | |||
253 | #endif /* __KERNEL__ */ | ||
254 | #endif /* !__ASSEMBLY__ */ | ||
255 | #endif /* _SPU_CSA_H_ */ | ||
diff --git a/include/asm-powerpc/synch.h b/include/asm-powerpc/synch.h index 4660c0394a77..794870ab8fd3 100644 --- a/include/asm-powerpc/synch.h +++ b/include/asm-powerpc/synch.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_SYNCH_H | 1 | #ifndef _ASM_POWERPC_SYNCH_H |
2 | #define _ASM_POWERPC_SYNCH_H | 2 | #define _ASM_POWERPC_SYNCH_H |
3 | 3 | #ifdef __KERNEL__ | |
4 | #include <linux/config.h> | ||
5 | 4 | ||
6 | #ifdef __powerpc64__ | 5 | #ifdef __powerpc64__ |
7 | #define __SUBARCH_HAS_LWSYNC | 6 | #define __SUBARCH_HAS_LWSYNC |
@@ -47,5 +46,6 @@ static inline void isync(void) | |||
47 | #define isync_on_smp() __asm__ __volatile__("": : :"memory") | 46 | #define isync_on_smp() __asm__ __volatile__("": : :"memory") |
48 | #endif | 47 | #endif |
49 | 48 | ||
49 | #endif /* __KERNEL__ */ | ||
50 | #endif /* _ASM_POWERPC_SYNCH_H */ | 50 | #endif /* _ASM_POWERPC_SYNCH_H */ |
51 | 51 | ||
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index 5341b75c75cb..0c58e32a9570 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h | |||
@@ -4,7 +4,6 @@ | |||
4 | #ifndef _ASM_POWERPC_SYSTEM_H | 4 | #ifndef _ASM_POWERPC_SYSTEM_H |
5 | #define _ASM_POWERPC_SYSTEM_H | 5 | #define _ASM_POWERPC_SYSTEM_H |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
9 | 8 | ||
10 | #include <asm/hw_irq.h> | 9 | #include <asm/hw_irq.h> |
@@ -42,6 +41,7 @@ | |||
42 | #define set_mb(var, value) do { var = value; mb(); } while (0) | 41 | #define set_mb(var, value) do { var = value; mb(); } while (0) |
43 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | 42 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) |
44 | 43 | ||
44 | #ifdef __KERNEL__ | ||
45 | #ifdef CONFIG_SMP | 45 | #ifdef CONFIG_SMP |
46 | #define smp_mb() mb() | 46 | #define smp_mb() mb() |
47 | #define smp_rmb() rmb() | 47 | #define smp_rmb() rmb() |
@@ -54,7 +54,6 @@ | |||
54 | #define smp_read_barrier_depends() do { } while(0) | 54 | #define smp_read_barrier_depends() do { } while(0) |
55 | #endif /* CONFIG_SMP */ | 55 | #endif /* CONFIG_SMP */ |
56 | 56 | ||
57 | #ifdef __KERNEL__ | ||
58 | struct task_struct; | 57 | struct task_struct; |
59 | struct pt_regs; | 58 | struct pt_regs; |
60 | 59 | ||
diff --git a/include/asm-powerpc/tce.h b/include/asm-powerpc/tce.h index 980a094fd5a7..6fa200ad7a7f 100644 --- a/include/asm-powerpc/tce.h +++ b/include/asm-powerpc/tce.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #ifndef _ASM_POWERPC_TCE_H | 21 | #ifndef _ASM_POWERPC_TCE_H |
22 | #define _ASM_POWERPC_TCE_H | 22 | #define _ASM_POWERPC_TCE_H |
23 | #ifdef __KERNEL__ | ||
23 | 24 | ||
24 | /* | 25 | /* |
25 | * Tces come in two formats, one for the virtual bus and a different | 26 | * Tces come in two formats, one for the virtual bus and a different |
@@ -61,4 +62,5 @@ union tce_entry { | |||
61 | }; | 62 | }; |
62 | 63 | ||
63 | 64 | ||
65 | #endif /* __KERNEL__ */ | ||
64 | #endif /* _ASM_POWERPC_TCE_H */ | 66 | #endif /* _ASM_POWERPC_TCE_H */ |
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h index e525f49bd179..ac1e80e6033e 100644 --- a/include/asm-powerpc/thread_info.h +++ b/include/asm-powerpc/thread_info.h | |||
@@ -37,8 +37,7 @@ struct thread_info { | |||
37 | int preempt_count; /* 0 => preemptable, | 37 | int preempt_count; /* 0 => preemptable, |
38 | <0 => BUG */ | 38 | <0 => BUG */ |
39 | struct restart_block restart_block; | 39 | struct restart_block restart_block; |
40 | /* set by force_successful_syscall_return */ | 40 | void *nvgprs_frame; |
41 | unsigned char syscall_noerror; | ||
42 | /* low level flags - has atomic operations done on it */ | 41 | /* low level flags - has atomic operations done on it */ |
43 | unsigned long flags ____cacheline_aligned_in_smp; | 42 | unsigned long flags ____cacheline_aligned_in_smp; |
44 | }; | 43 | }; |
@@ -123,6 +122,9 @@ static inline struct thread_info *current_thread_info(void) | |||
123 | #define TIF_SINGLESTEP 9 /* singlestepping active */ | 122 | #define TIF_SINGLESTEP 9 /* singlestepping active */ |
124 | #define TIF_MEMDIE 10 | 123 | #define TIF_MEMDIE 10 |
125 | #define TIF_SECCOMP 11 /* secure computing */ | 124 | #define TIF_SECCOMP 11 /* secure computing */ |
125 | #define TIF_RESTOREALL 12 /* Restore all regs (implies NOERROR) */ | ||
126 | #define TIF_SAVE_NVGPRS 13 /* Save r14-r31 in signal frame */ | ||
127 | #define TIF_NOERROR 14 /* Force successful syscall return */ | ||
126 | 128 | ||
127 | /* as above, but as bit values */ | 129 | /* as above, but as bit values */ |
128 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 130 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
@@ -136,10 +138,14 @@ static inline struct thread_info *current_thread_info(void) | |||
136 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 138 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
137 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | 139 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) |
138 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 140 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
141 | #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) | ||
142 | #define _TIF_SAVE_NVGPRS (1<<TIF_SAVE_NVGPRS) | ||
143 | #define _TIF_NOERROR (1<<TIF_NOERROR) | ||
139 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) | 144 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) |
140 | 145 | ||
141 | #define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ | 146 | #define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ |
142 | _TIF_NEED_RESCHED) | 147 | _TIF_NEED_RESCHED | _TIF_RESTOREALL) |
148 | #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR|_TIF_SAVE_NVGPRS) | ||
143 | 149 | ||
144 | #endif /* __KERNEL__ */ | 150 | #endif /* __KERNEL__ */ |
145 | 151 | ||
diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h index 56659f121779..601a53cf96d5 100644 --- a/include/asm-powerpc/tlb.h +++ b/include/asm-powerpc/tlb.h | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | #ifndef _ASM_POWERPC_TLB_H | 12 | #ifndef _ASM_POWERPC_TLB_H |
13 | #define _ASM_POWERPC_TLB_H | 13 | #define _ASM_POWERPC_TLB_H |
14 | #ifdef __KERNEL__ | ||
14 | 15 | ||
15 | #include <linux/config.h> | 16 | #include <linux/config.h> |
16 | #ifndef __powerpc64__ | 17 | #ifndef __powerpc64__ |
@@ -67,4 +68,5 @@ static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, | |||
67 | } | 68 | } |
68 | 69 | ||
69 | #endif | 70 | #endif |
71 | #endif /* __KERNEL__ */ | ||
70 | #endif /* __ASM_POWERPC_TLB_H */ | 72 | #endif /* __ASM_POWERPC_TLB_H */ |
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h index db8095cbe09b..9f3d4da261c4 100644 --- a/include/asm-powerpc/topology.h +++ b/include/asm-powerpc/topology.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _ASM_POWERPC_TOPOLOGY_H | 1 | #ifndef _ASM_POWERPC_TOPOLOGY_H |
2 | #define _ASM_POWERPC_TOPOLOGY_H | 2 | #define _ASM_POWERPC_TOPOLOGY_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | #include <linux/config.h> | 5 | #include <linux/config.h> |
5 | 6 | ||
@@ -55,10 +56,15 @@ static inline int node_to_first_cpu(int node) | |||
55 | .nr_balance_failed = 0, \ | 56 | .nr_balance_failed = 0, \ |
56 | } | 57 | } |
57 | 58 | ||
59 | extern void __init dump_numa_cpu_topology(void); | ||
60 | |||
58 | #else | 61 | #else |
59 | 62 | ||
63 | static inline void dump_numa_cpu_topology(void) {} | ||
64 | |||
60 | #include <asm-generic/topology.h> | 65 | #include <asm-generic/topology.h> |
61 | 66 | ||
62 | #endif /* CONFIG_NUMA */ | 67 | #endif /* CONFIG_NUMA */ |
63 | 68 | ||
69 | #endif /* __KERNEL__ */ | ||
64 | #endif /* _ASM_POWERPC_TOPOLOGY_H */ | 70 | #endif /* _ASM_POWERPC_TOPOLOGY_H */ |
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h index a383383bc4d4..479f2d8ff74a 100644 --- a/include/asm-powerpc/udbg.h +++ b/include/asm-powerpc/udbg.h | |||
@@ -9,12 +9,13 @@ | |||
9 | 9 | ||
10 | #ifndef _ASM_POWERPC_UDBG_H | 10 | #ifndef _ASM_POWERPC_UDBG_H |
11 | #define _ASM_POWERPC_UDBG_H | 11 | #define _ASM_POWERPC_UDBG_H |
12 | #ifdef __KERNEL__ | ||
12 | 13 | ||
13 | #include <linux/compiler.h> | 14 | #include <linux/compiler.h> |
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | 16 | ||
16 | extern void (*udbg_putc)(unsigned char c); | 17 | extern void (*udbg_putc)(char c); |
17 | extern unsigned char (*udbg_getc)(void); | 18 | extern int (*udbg_getc)(void); |
18 | extern int (*udbg_getc_poll)(void); | 19 | extern int (*udbg_getc_poll)(void); |
19 | 20 | ||
20 | extern void udbg_puts(const char *s); | 21 | extern void udbg_puts(const char *s); |
@@ -23,9 +24,17 @@ extern int udbg_read(char *buf, int buflen); | |||
23 | 24 | ||
24 | extern void register_early_udbg_console(void); | 25 | extern void register_early_udbg_console(void); |
25 | extern void udbg_printf(const char *fmt, ...); | 26 | extern void udbg_printf(const char *fmt, ...); |
27 | extern void udbg_progress(char *s, unsigned short hex); | ||
26 | 28 | ||
27 | extern void udbg_init_uart(void __iomem *comport, unsigned int speed); | 29 | extern void udbg_init_uart(void __iomem *comport, unsigned int speed, |
30 | unsigned int clock); | ||
31 | extern unsigned int udbg_probe_uart_speed(void __iomem *comport, | ||
32 | unsigned int clock); | ||
28 | 33 | ||
29 | struct device_node; | 34 | struct device_node; |
30 | extern void udbg_init_scc(struct device_node *np); | 35 | extern void udbg_scc_init(int force_scc); |
36 | extern int udbg_adb_init(int force_btext); | ||
37 | extern void udbg_adb_init_early(void); | ||
38 | |||
39 | #endif /* __KERNEL__ */ | ||
31 | #endif /* _ASM_POWERPC_UDBG_H */ | 40 | #endif /* _ASM_POWERPC_UDBG_H */ |
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h index 0991dfceef1d..19eaac3fbbf9 100644 --- a/include/asm-powerpc/unistd.h +++ b/include/asm-powerpc/unistd.h | |||
@@ -296,8 +296,10 @@ | |||
296 | #define __NR_inotify_init 275 | 296 | #define __NR_inotify_init 275 |
297 | #define __NR_inotify_add_watch 276 | 297 | #define __NR_inotify_add_watch 276 |
298 | #define __NR_inotify_rm_watch 277 | 298 | #define __NR_inotify_rm_watch 277 |
299 | #define __NR_spu_run 278 | ||
300 | #define __NR_spu_create 279 | ||
299 | 301 | ||
300 | #define __NR_syscalls 278 | 302 | #define __NR_syscalls 280 |
301 | 303 | ||
302 | #ifdef __KERNEL__ | 304 | #ifdef __KERNEL__ |
303 | #define __NR__exit __NR_exit | 305 | #define __NR__exit __NR_exit |
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h index 411832d5bbdb..7aa92086c3fb 100644 --- a/include/asm-powerpc/vdso_datapage.h +++ b/include/asm-powerpc/vdso_datapage.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _VDSO_DATAPAGE_H | 1 | #ifndef _VDSO_DATAPAGE_H |
2 | #define _VDSO_DATAPAGE_H | 2 | #define _VDSO_DATAPAGE_H |
3 | #ifdef __KERNEL__ | ||
3 | 4 | ||
4 | /* | 5 | /* |
5 | * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM | 6 | * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM |
@@ -105,4 +106,5 @@ extern struct vdso_data *vdso_data; | |||
105 | 106 | ||
106 | #endif /* __ASSEMBLY__ */ | 107 | #endif /* __ASSEMBLY__ */ |
107 | 108 | ||
109 | #endif /* __KERNEL__ */ | ||
108 | #endif /* _SYSTEMCFG_H */ | 110 | #endif /* _SYSTEMCFG_H */ |
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h index e0ccf108277c..0544ece51761 100644 --- a/include/asm-powerpc/vio.h +++ b/include/asm-powerpc/vio.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #ifndef _ASM_POWERPC_VIO_H | 14 | #ifndef _ASM_POWERPC_VIO_H |
15 | #define _ASM_POWERPC_VIO_H | 15 | #define _ASM_POWERPC_VIO_H |
16 | #ifdef __KERNEL__ | ||
16 | 17 | ||
17 | #include <linux/config.h> | 18 | #include <linux/config.h> |
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
@@ -103,4 +104,5 @@ static inline struct vio_dev *to_vio_dev(struct device *dev) | |||
103 | return container_of(dev, struct vio_dev, dev); | 104 | return container_of(dev, struct vio_dev, dev); |
104 | } | 105 | } |
105 | 106 | ||
107 | #endif /* __KERNEL__ */ | ||
106 | #endif /* _ASM_POWERPC_VIO_H */ | 108 | #endif /* _ASM_POWERPC_VIO_H */ |