diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-23 08:34:10 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-23 08:34:10 -0400 |
commit | 919251758195919ae3568021bc221e4f8c4b20eb (patch) | |
tree | 81137a037ff8e6c91cc8de72d568275605c653c5 /arch/powerpc | |
parent | c394f1eafef61c6666f5876afde6110a276c4c9f (diff) | |
parent | 3eeab61aa3ddd3c0bedb7449ada1599de22fdb5a (diff) |
Merge branch 'mainline' into upstream-linus
Diffstat (limited to 'arch/powerpc')
130 files changed, 3013 insertions, 1724 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 694b0c63ee50..de1ef2fa1a20 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -417,6 +417,17 @@ config PPC_MAPLE | |||
417 | This option enables support for the Maple 970FX Evaluation Board. | 417 | This option enables support for the Maple 970FX Evaluation Board. |
418 | For more informations, refer to <http://www.970eval.com> | 418 | For more informations, refer to <http://www.970eval.com> |
419 | 419 | ||
420 | config PPC_PASEMI | ||
421 | depends on PPC_MULTIPLATFORM && PPC64 | ||
422 | bool "PA Semi SoC-based platforms" | ||
423 | default n | ||
424 | select MPIC | ||
425 | select PPC_UDBG_16550 | ||
426 | select GENERIC_TBSYNC | ||
427 | help | ||
428 | This option enables support for PA Semi's PWRficient line | ||
429 | of SoC processors, including PA6T-1682M | ||
430 | |||
420 | config PPC_CELL | 431 | config PPC_CELL |
421 | bool | 432 | bool |
422 | default n | 433 | default n |
@@ -436,7 +447,8 @@ config PPC_IBM_CELL_BLADE | |||
436 | select UDBG_RTAS_CONSOLE | 447 | select UDBG_RTAS_CONSOLE |
437 | 448 | ||
438 | config UDBG_RTAS_CONSOLE | 449 | config UDBG_RTAS_CONSOLE |
439 | bool | 450 | bool "RTAS based debug console" |
451 | depends on PPC_RTAS | ||
440 | default n | 452 | default n |
441 | 453 | ||
442 | config XICS | 454 | config XICS |
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index e29ef77d3b00..5ad149b47e34 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
@@ -18,6 +18,20 @@ config DEBUG_STACK_USAGE | |||
18 | 18 | ||
19 | This option will slow down process creation somewhat. | 19 | This option will slow down process creation somewhat. |
20 | 20 | ||
21 | config HCALL_STATS | ||
22 | bool "Hypervisor call instrumentation" | ||
23 | depends on PPC_PSERIES && DEBUG_FS | ||
24 | help | ||
25 | Adds code to keep track of the number of hypervisor calls made and | ||
26 | the amount of time spent in hypervisor callsr. Wall time spent in | ||
27 | each call is always calculated, and if available CPU cycles spent | ||
28 | are also calculated. A directory named hcall_inst is added at the | ||
29 | root of the debugfs filesystem. Within the hcall_inst directory | ||
30 | are files that contain CPU specific call statistics. | ||
31 | |||
32 | This option will add a small amount of overhead to all hypervisor | ||
33 | calls. | ||
34 | |||
21 | config DEBUGGER | 35 | config DEBUGGER |
22 | bool "Enable debugger hooks" | 36 | bool "Enable debugger hooks" |
23 | depends on DEBUG_KERNEL | 37 | depends on DEBUG_KERNEL |
@@ -74,6 +88,8 @@ config XMON | |||
74 | very early during boot. 'xmon=on' will just enable the xmon | 88 | very early during boot. 'xmon=on' will just enable the xmon |
75 | debugger hooks. 'xmon=off' will disable the debugger hooks | 89 | debugger hooks. 'xmon=off' will disable the debugger hooks |
76 | if CONFIG_XMON_DEFAULT is set. | 90 | if CONFIG_XMON_DEFAULT is set. |
91 | xmon will print a backtrace on the very first invocation. | ||
92 | 'xmon=nobt' will disable this autobacktrace. | ||
77 | 93 | ||
78 | config XMON_DEFAULT | 94 | config XMON_DEFAULT |
79 | bool "Enable xmon by default" | 95 | bool "Enable xmon by default" |
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index d961bfeed05f..e73774136b55 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -36,11 +36,16 @@ zliblinuxheader := zlib.h zconf.h zutil.h | |||
36 | $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) | 36 | $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) |
37 | #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) | 37 | #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) |
38 | 38 | ||
39 | src-boot := crt0.S string.S prom.c stdio.c main.c div64.S | 39 | src-boot-$(CONFIG_PPC_MULTIPLATFORM) := of.c |
40 | src-boot := crt0.S string.S stdio.c main.c div64.S $(src-boot-y) | ||
40 | src-boot += $(zlib) | 41 | src-boot += $(zlib) |
41 | src-boot := $(addprefix $(obj)/, $(src-boot)) | 42 | src-boot := $(addprefix $(obj)/, $(src-boot)) |
42 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) | 43 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) |
43 | 44 | ||
45 | ifeq ($(call cc-option-yn, -fstack-protector),y) | ||
46 | BOOTCFLAGS += -fno-stack-protector | ||
47 | endif | ||
48 | |||
44 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | 49 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) |
45 | 50 | ||
46 | quiet_cmd_copy_zlib = COPY $@ | 51 | quiet_cmd_copy_zlib = COPY $@ |
diff --git a/arch/powerpc/boot/dts/mpc8349emds.dts b/arch/powerpc/boot/dts/mpc8349emds.dts index 12f5dbf3055f..efceb3432653 100644 --- a/arch/powerpc/boot/dts/mpc8349emds.dts +++ b/arch/powerpc/boot/dts/mpc8349emds.dts | |||
@@ -214,10 +214,10 @@ | |||
214 | b800 0 0 4 700 15 8 | 214 | b800 0 0 4 700 15 8 |
215 | 215 | ||
216 | /* IDSEL 0x18 */ | 216 | /* IDSEL 0x18 */ |
217 | b000 0 0 1 700 15 8 | 217 | c000 0 0 1 700 15 8 |
218 | b000 0 0 2 700 16 8 | 218 | c000 0 0 2 700 16 8 |
219 | b000 0 0 3 700 17 8 | 219 | c000 0 0 3 700 17 8 |
220 | b000 0 0 4 700 14 8>; | 220 | c000 0 0 4 700 14 8>; |
221 | interrupt-parent = <700>; | 221 | interrupt-parent = <700>; |
222 | interrupts = <42 8>; | 222 | interrupts = <42 8>; |
223 | bus-range = <0 0>; | 223 | bus-range = <0 0>; |
@@ -274,10 +274,10 @@ | |||
274 | b800 0 0 4 700 15 8 | 274 | b800 0 0 4 700 15 8 |
275 | 275 | ||
276 | /* IDSEL 0x18 */ | 276 | /* IDSEL 0x18 */ |
277 | b000 0 0 1 700 15 8 | 277 | c000 0 0 1 700 15 8 |
278 | b000 0 0 2 700 16 8 | 278 | c000 0 0 2 700 16 8 |
279 | b000 0 0 3 700 17 8 | 279 | c000 0 0 3 700 17 8 |
280 | b000 0 0 4 700 14 8>; | 280 | c000 0 0 4 700 14 8>; |
281 | interrupt-parent = <700>; | 281 | interrupt-parent = <700>; |
282 | interrupts = <42 8>; | 282 | interrupts = <42 8>; |
283 | bus-range = <0 0>; | 283 | bus-range = <0 0>; |
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h new file mode 100644 index 000000000000..761c8dc84008 --- /dev/null +++ b/arch/powerpc/boot/flatdevtree.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License as published by | ||
4 | * the Free Software Foundation; either version 2 of the License, or | ||
5 | * (at your option) any later version. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program; if not, write to the Free Software | ||
14 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
15 | */ | ||
16 | |||
17 | #ifndef FLATDEVTREE_H | ||
18 | #define FLATDEVTREE_H | ||
19 | |||
20 | #include "types.h" | ||
21 | |||
22 | /* Definitions used by the flattened device tree */ | ||
23 | #define OF_DT_HEADER 0xd00dfeed /* marker */ | ||
24 | #define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ | ||
25 | #define OF_DT_END_NODE 0x2 /* End node */ | ||
26 | #define OF_DT_PROP 0x3 /* Property: name off, size, content */ | ||
27 | #define OF_DT_NOP 0x4 /* nop */ | ||
28 | #define OF_DT_END 0x9 | ||
29 | |||
30 | #define OF_DT_VERSION 0x10 | ||
31 | |||
32 | struct boot_param_header { | ||
33 | u32 magic; /* magic word OF_DT_HEADER */ | ||
34 | u32 totalsize; /* total size of DT block */ | ||
35 | u32 off_dt_struct; /* offset to structure */ | ||
36 | u32 off_dt_strings; /* offset to strings */ | ||
37 | u32 off_mem_rsvmap; /* offset to memory reserve map */ | ||
38 | u32 version; /* format version */ | ||
39 | u32 last_comp_version; /* last compatible version */ | ||
40 | /* version 2 fields below */ | ||
41 | u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ | ||
42 | /* version 3 fields below */ | ||
43 | u32 dt_strings_size; /* size of the DT strings block */ | ||
44 | }; | ||
45 | |||
46 | #endif /* FLATDEVTREE_H */ | ||
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c index b66634c9ea34..d719bb9333d1 100644 --- a/arch/powerpc/boot/main.c +++ b/arch/powerpc/boot/main.c | |||
@@ -14,17 +14,12 @@ | |||
14 | #include "page.h" | 14 | #include "page.h" |
15 | #include "string.h" | 15 | #include "string.h" |
16 | #include "stdio.h" | 16 | #include "stdio.h" |
17 | #include "prom.h" | ||
18 | #include "zlib.h" | 17 | #include "zlib.h" |
18 | #include "ops.h" | ||
19 | #include "flatdevtree.h" | ||
19 | 20 | ||
20 | extern void flush_cache(void *, unsigned long); | 21 | extern void flush_cache(void *, unsigned long); |
21 | 22 | ||
22 | |||
23 | /* Value picked to match that used by yaboot */ | ||
24 | #define PROG_START 0x01400000 /* only used on 64-bit systems */ | ||
25 | #define RAM_END (512<<20) /* Fixme: use OF */ | ||
26 | #define ONE_MB 0x100000 | ||
27 | |||
28 | extern char _start[]; | 23 | extern char _start[]; |
29 | extern char __bss_start[]; | 24 | extern char __bss_start[]; |
30 | extern char _end[]; | 25 | extern char _end[]; |
@@ -33,14 +28,6 @@ extern char _vmlinux_end[]; | |||
33 | extern char _initrd_start[]; | 28 | extern char _initrd_start[]; |
34 | extern char _initrd_end[]; | 29 | extern char _initrd_end[]; |
35 | 30 | ||
36 | /* A buffer that may be edited by tools operating on a zImage binary so as to | ||
37 | * edit the command line passed to vmlinux (by setting /chosen/bootargs). | ||
38 | * The buffer is put in it's own section so that tools may locate it easier. | ||
39 | */ | ||
40 | static char builtin_cmdline[512] | ||
41 | __attribute__((section("__builtin_cmdline"))); | ||
42 | |||
43 | |||
44 | struct addr_range { | 31 | struct addr_range { |
45 | unsigned long addr; | 32 | unsigned long addr; |
46 | unsigned long size; | 33 | unsigned long size; |
@@ -51,21 +38,16 @@ static struct addr_range vmlinuz; | |||
51 | static struct addr_range initrd; | 38 | static struct addr_range initrd; |
52 | 39 | ||
53 | static unsigned long elfoffset; | 40 | static unsigned long elfoffset; |
41 | static int is_64bit; | ||
54 | 42 | ||
55 | static char scratch[46912]; /* scratch space for gunzip, from zlib_inflate_workspacesize() */ | 43 | /* scratch space for gunzip; 46912 is from zlib_inflate_workspacesize() */ |
44 | static char scratch[46912]; | ||
56 | static char elfheader[256]; | 45 | static char elfheader[256]; |
57 | 46 | ||
58 | 47 | typedef void (*kernel_entry_t)(unsigned long, unsigned long, void *); | |
59 | typedef void (*kernel_entry_t)( unsigned long, | ||
60 | unsigned long, | ||
61 | void *, | ||
62 | void *); | ||
63 | |||
64 | 48 | ||
65 | #undef DEBUG | 49 | #undef DEBUG |
66 | 50 | ||
67 | static unsigned long claim_base; | ||
68 | |||
69 | #define HEAD_CRC 2 | 51 | #define HEAD_CRC 2 |
70 | #define EXTRA_FIELD 4 | 52 | #define EXTRA_FIELD 4 |
71 | #define ORIG_NAME 8 | 53 | #define ORIG_NAME 8 |
@@ -123,24 +105,6 @@ static void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) | |||
123 | zlib_inflateEnd(&s); | 105 | zlib_inflateEnd(&s); |
124 | } | 106 | } |
125 | 107 | ||
126 | static unsigned long try_claim(unsigned long size) | ||
127 | { | ||
128 | unsigned long addr = 0; | ||
129 | |||
130 | for(; claim_base < RAM_END; claim_base += ONE_MB) { | ||
131 | #ifdef DEBUG | ||
132 | printf(" trying: 0x%08lx\n\r", claim_base); | ||
133 | #endif | ||
134 | addr = (unsigned long)claim(claim_base, size, 0); | ||
135 | if ((void *)addr != (void *)-1) | ||
136 | break; | ||
137 | } | ||
138 | if (addr == 0) | ||
139 | return 0; | ||
140 | claim_base = PAGE_ALIGN(claim_base + size); | ||
141 | return addr; | ||
142 | } | ||
143 | |||
144 | static int is_elf64(void *hdr) | 108 | static int is_elf64(void *hdr) |
145 | { | 109 | { |
146 | Elf64_Ehdr *elf64 = hdr; | 110 | Elf64_Ehdr *elf64 = hdr; |
@@ -169,16 +133,7 @@ static int is_elf64(void *hdr) | |||
169 | vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset; | 133 | vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset; |
170 | vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset; | 134 | vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset; |
171 | 135 | ||
172 | #if defined(PROG_START) | 136 | is_64bit = 1; |
173 | /* | ||
174 | * Maintain a "magic" minimum address. This keeps some older | ||
175 | * firmware platforms running. | ||
176 | */ | ||
177 | |||
178 | if (claim_base < PROG_START) | ||
179 | claim_base = PROG_START; | ||
180 | #endif | ||
181 | |||
182 | return 1; | 137 | return 1; |
183 | } | 138 | } |
184 | 139 | ||
@@ -212,47 +167,9 @@ static int is_elf32(void *hdr) | |||
212 | return 1; | 167 | return 1; |
213 | } | 168 | } |
214 | 169 | ||
215 | void export_cmdline(void* chosen_handle) | 170 | static void prep_kernel(unsigned long *a1, unsigned long *a2) |
216 | { | ||
217 | int len; | ||
218 | char cmdline[2] = { 0, 0 }; | ||
219 | |||
220 | if (builtin_cmdline[0] == 0) | ||
221 | return; | ||
222 | |||
223 | len = getprop(chosen_handle, "bootargs", cmdline, sizeof(cmdline)); | ||
224 | if (len > 0 && cmdline[0] != 0) | ||
225 | return; | ||
226 | |||
227 | setprop(chosen_handle, "bootargs", builtin_cmdline, | ||
228 | strlen(builtin_cmdline) + 1); | ||
229 | } | ||
230 | |||
231 | |||
232 | void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) | ||
233 | { | 171 | { |
234 | int len; | 172 | int len; |
235 | kernel_entry_t kernel_entry; | ||
236 | |||
237 | memset(__bss_start, 0, _end - __bss_start); | ||
238 | |||
239 | prom = (int (*)(void *)) promptr; | ||
240 | chosen_handle = finddevice("/chosen"); | ||
241 | if (chosen_handle == (void *) -1) | ||
242 | exit(); | ||
243 | if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4) | ||
244 | exit(); | ||
245 | |||
246 | printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp); | ||
247 | |||
248 | /* | ||
249 | * The first available claim_base must be above the end of the | ||
250 | * the loaded kernel wrapper file (_start to _end includes the | ||
251 | * initrd image if it is present) and rounded up to a nice | ||
252 | * 1 MB boundary for good measure. | ||
253 | */ | ||
254 | |||
255 | claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB); | ||
256 | 173 | ||
257 | vmlinuz.addr = (unsigned long)_vmlinux_start; | 174 | vmlinuz.addr = (unsigned long)_vmlinux_start; |
258 | vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); | 175 | vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); |
@@ -263,43 +180,51 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) | |||
263 | gunzip(elfheader, sizeof(elfheader), | 180 | gunzip(elfheader, sizeof(elfheader), |
264 | (unsigned char *)vmlinuz.addr, &len); | 181 | (unsigned char *)vmlinuz.addr, &len); |
265 | } else | 182 | } else |
266 | memcpy(elfheader, (const void *)vmlinuz.addr, sizeof(elfheader)); | 183 | memcpy(elfheader, (const void *)vmlinuz.addr, |
184 | sizeof(elfheader)); | ||
267 | 185 | ||
268 | if (!is_elf64(elfheader) && !is_elf32(elfheader)) { | 186 | if (!is_elf64(elfheader) && !is_elf32(elfheader)) { |
269 | printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r"); | 187 | printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r"); |
270 | exit(); | 188 | exit(); |
271 | } | 189 | } |
190 | if (platform_ops.image_hdr) | ||
191 | platform_ops.image_hdr(elfheader); | ||
272 | 192 | ||
273 | /* We need to claim the memsize plus the file offset since gzip | 193 | /* We need to alloc the memsize plus the file offset since gzip |
274 | * will expand the header (file offset), then the kernel, then | 194 | * will expand the header (file offset), then the kernel, then |
275 | * possible rubbish we don't care about. But the kernel bss must | 195 | * possible rubbish we don't care about. But the kernel bss must |
276 | * be claimed (it will be zero'd by the kernel itself) | 196 | * be claimed (it will be zero'd by the kernel itself) |
277 | */ | 197 | */ |
278 | printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux.memsize); | 198 | printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux.memsize); |
279 | vmlinux.addr = try_claim(vmlinux.memsize); | 199 | vmlinux.addr = (unsigned long)malloc(vmlinux.memsize); |
280 | if (vmlinux.addr == 0) { | 200 | if (vmlinux.addr == 0) { |
281 | printf("Can't allocate memory for kernel image !\n\r"); | 201 | printf("Can't allocate memory for kernel image !\n\r"); |
282 | exit(); | 202 | exit(); |
283 | } | 203 | } |
284 | 204 | ||
285 | /* | 205 | /* |
286 | * Now we try to claim memory for the initrd (and copy it there) | 206 | * Now we try to alloc memory for the initrd (and copy it there) |
287 | */ | 207 | */ |
288 | initrd.size = (unsigned long)(_initrd_end - _initrd_start); | 208 | initrd.size = (unsigned long)(_initrd_end - _initrd_start); |
289 | initrd.memsize = initrd.size; | 209 | initrd.memsize = initrd.size; |
290 | if ( initrd.size > 0 ) { | 210 | if ( initrd.size > 0 ) { |
291 | printf("Allocating 0x%lx bytes for initrd ...\n\r", initrd.size); | 211 | printf("Allocating 0x%lx bytes for initrd ...\n\r", |
292 | initrd.addr = try_claim(initrd.size); | 212 | initrd.size); |
213 | initrd.addr = (unsigned long)malloc((u32)initrd.size); | ||
293 | if (initrd.addr == 0) { | 214 | if (initrd.addr == 0) { |
294 | printf("Can't allocate memory for initial ramdisk !\n\r"); | 215 | printf("Can't allocate memory for initial " |
216 | "ramdisk !\n\r"); | ||
295 | exit(); | 217 | exit(); |
296 | } | 218 | } |
297 | a1 = initrd.addr; | 219 | *a1 = initrd.addr; |
298 | a2 = initrd.size; | 220 | *a2 = initrd.size; |
299 | printf("initial ramdisk moving 0x%lx <- 0x%lx (0x%lx bytes)\n\r", | 221 | printf("initial ramdisk moving 0x%lx <- 0x%lx " |
300 | initrd.addr, (unsigned long)_initrd_start, initrd.size); | 222 | "(0x%lx bytes)\n\r", initrd.addr, |
301 | memmove((void *)initrd.addr, (void *)_initrd_start, initrd.size); | 223 | (unsigned long)_initrd_start, initrd.size); |
302 | printf("initrd head: 0x%lx\n\r", *((unsigned long *)initrd.addr)); | 224 | memmove((void *)initrd.addr, (void *)_initrd_start, |
225 | initrd.size); | ||
226 | printf("initrd head: 0x%lx\n\r", | ||
227 | *((unsigned long *)initrd.addr)); | ||
303 | } | 228 | } |
304 | 229 | ||
305 | /* Eventually gunzip the kernel */ | 230 | /* Eventually gunzip the kernel */ |
@@ -311,11 +236,10 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) | |||
311 | (unsigned char *)vmlinuz.addr, &len); | 236 | (unsigned char *)vmlinuz.addr, &len); |
312 | printf("done 0x%lx bytes\n\r", len); | 237 | printf("done 0x%lx bytes\n\r", len); |
313 | } else { | 238 | } else { |
314 | memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size); | 239 | memmove((void *)vmlinux.addr,(void *)vmlinuz.addr, |
240 | vmlinuz.size); | ||
315 | } | 241 | } |
316 | 242 | ||
317 | export_cmdline(chosen_handle); | ||
318 | |||
319 | /* Skip over the ELF header */ | 243 | /* Skip over the ELF header */ |
320 | #ifdef DEBUG | 244 | #ifdef DEBUG |
321 | printf("... skipping 0x%lx bytes of ELF header\n\r", | 245 | printf("... skipping 0x%lx bytes of ELF header\n\r", |
@@ -324,23 +248,107 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) | |||
324 | vmlinux.addr += elfoffset; | 248 | vmlinux.addr += elfoffset; |
325 | 249 | ||
326 | flush_cache((void *)vmlinux.addr, vmlinux.size); | 250 | flush_cache((void *)vmlinux.addr, vmlinux.size); |
251 | } | ||
327 | 252 | ||
328 | kernel_entry = (kernel_entry_t)vmlinux.addr; | 253 | void __attribute__ ((weak)) ft_init(void *dt_blob) |
329 | #ifdef DEBUG | 254 | { |
330 | printf( "kernel:\n\r" | 255 | } |
331 | " entry addr = 0x%lx\n\r" | ||
332 | " a1 = 0x%lx,\n\r" | ||
333 | " a2 = 0x%lx,\n\r" | ||
334 | " prom = 0x%lx,\n\r" | ||
335 | " bi_recs = 0x%lx,\n\r", | ||
336 | (unsigned long)kernel_entry, a1, a2, | ||
337 | (unsigned long)prom, NULL); | ||
338 | #endif | ||
339 | 256 | ||
340 | kernel_entry(a1, a2, prom, NULL); | 257 | /* A buffer that may be edited by tools operating on a zImage binary so as to |
258 | * edit the command line passed to vmlinux (by setting /chosen/bootargs). | ||
259 | * The buffer is put in it's own section so that tools may locate it easier. | ||
260 | */ | ||
261 | static char builtin_cmdline[COMMAND_LINE_SIZE] | ||
262 | __attribute__((__section__("__builtin_cmdline"))); | ||
341 | 263 | ||
342 | printf("Error: Linux kernel returned to zImage bootloader!\n\r"); | 264 | static void get_cmdline(char *buf, int size) |
265 | { | ||
266 | void *devp; | ||
267 | int len = strlen(builtin_cmdline); | ||
343 | 268 | ||
344 | exit(); | 269 | buf[0] = '\0'; |
270 | |||
271 | if (len > 0) { /* builtin_cmdline overrides dt's /chosen/bootargs */ | ||
272 | len = min(len, size-1); | ||
273 | strncpy(buf, builtin_cmdline, len); | ||
274 | buf[len] = '\0'; | ||
275 | } | ||
276 | else if ((devp = finddevice("/chosen"))) | ||
277 | getprop(devp, "bootargs", buf, size); | ||
278 | } | ||
279 | |||
280 | static void set_cmdline(char *buf) | ||
281 | { | ||
282 | void *devp; | ||
283 | |||
284 | if ((devp = finddevice("/chosen"))) | ||
285 | setprop(devp, "bootargs", buf, strlen(buf) + 1); | ||
345 | } | 286 | } |
346 | 287 | ||
288 | /* Section where ft can be tacked on after zImage is built */ | ||
289 | union blobspace { | ||
290 | struct boot_param_header hdr; | ||
291 | char space[8*1024]; | ||
292 | } dt_blob __attribute__((__section__("__builtin_ft"))); | ||
293 | |||
294 | struct platform_ops platform_ops; | ||
295 | struct dt_ops dt_ops; | ||
296 | struct console_ops console_ops; | ||
297 | |||
298 | void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) | ||
299 | { | ||
300 | int have_dt = 0; | ||
301 | kernel_entry_t kentry; | ||
302 | char cmdline[COMMAND_LINE_SIZE]; | ||
303 | |||
304 | memset(__bss_start, 0, _end - __bss_start); | ||
305 | memset(&platform_ops, 0, sizeof(platform_ops)); | ||
306 | memset(&dt_ops, 0, sizeof(dt_ops)); | ||
307 | memset(&console_ops, 0, sizeof(console_ops)); | ||
308 | |||
309 | /* Override the dt_ops and device tree if there was an flat dev | ||
310 | * tree attached to the zImage. | ||
311 | */ | ||
312 | if (dt_blob.hdr.magic == OF_DT_HEADER) { | ||
313 | have_dt = 1; | ||
314 | ft_init(&dt_blob); | ||
315 | } | ||
316 | |||
317 | if (platform_init(promptr)) | ||
318 | exit(); | ||
319 | if (console_ops.open && (console_ops.open() < 0)) | ||
320 | exit(); | ||
321 | if (platform_ops.fixups) | ||
322 | platform_ops.fixups(); | ||
323 | |||
324 | printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", | ||
325 | _start, sp); | ||
326 | |||
327 | prep_kernel(&a1, &a2); | ||
328 | |||
329 | /* If cmdline came from zimage wrapper or if we can edit the one | ||
330 | * in the dt, print it out and edit it, if possible. | ||
331 | */ | ||
332 | if ((strlen(builtin_cmdline) > 0) || console_ops.edit_cmdline) { | ||
333 | get_cmdline(cmdline, COMMAND_LINE_SIZE); | ||
334 | printf("\n\rLinux/PowerPC load: %s", cmdline); | ||
335 | if (console_ops.edit_cmdline) | ||
336 | console_ops.edit_cmdline(cmdline, COMMAND_LINE_SIZE); | ||
337 | printf("\n\r"); | ||
338 | set_cmdline(cmdline); | ||
339 | } | ||
340 | |||
341 | if (console_ops.close) | ||
342 | console_ops.close(); | ||
343 | |||
344 | kentry = (kernel_entry_t) vmlinux.addr; | ||
345 | if (have_dt) | ||
346 | kentry(dt_ops.ft_addr(), 0, NULL); | ||
347 | else | ||
348 | /* XXX initrd addr/size should be passed in properties */ | ||
349 | kentry(a1, a2, promptr); | ||
350 | |||
351 | /* console closed so printf below may not work */ | ||
352 | printf("Error: Linux kernel returned to zImage boot wrapper!\n\r"); | ||
353 | exit(); | ||
354 | } | ||
diff --git a/arch/powerpc/boot/prom.c b/arch/powerpc/boot/of.c index fa0057736f6b..fd99f789a37b 100644 --- a/arch/powerpc/boot/prom.c +++ b/arch/powerpc/boot/of.c | |||
@@ -8,15 +8,29 @@ | |||
8 | */ | 8 | */ |
9 | #include <stdarg.h> | 9 | #include <stdarg.h> |
10 | #include <stddef.h> | 10 | #include <stddef.h> |
11 | #include "types.h" | ||
12 | #include "elf.h" | ||
11 | #include "string.h" | 13 | #include "string.h" |
12 | #include "stdio.h" | 14 | #include "stdio.h" |
13 | #include "prom.h" | 15 | #include "page.h" |
16 | #include "ops.h" | ||
14 | 17 | ||
15 | int (*prom)(void *); | 18 | typedef void *ihandle; |
16 | phandle chosen_handle; | 19 | typedef void *phandle; |
17 | ihandle stdout; | ||
18 | 20 | ||
19 | int call_prom(const char *service, int nargs, int nret, ...) | 21 | extern char _end[]; |
22 | |||
23 | /* Value picked to match that used by yaboot */ | ||
24 | #define PROG_START 0x01400000 /* only used on 64-bit systems */ | ||
25 | #define RAM_END (512<<20) /* Fixme: use OF */ | ||
26 | #define ONE_MB 0x100000 | ||
27 | |||
28 | int (*prom) (void *); | ||
29 | |||
30 | |||
31 | static unsigned long claim_base; | ||
32 | |||
33 | static int call_prom(const char *service, int nargs, int nret, ...) | ||
20 | { | 34 | { |
21 | int i; | 35 | int i; |
22 | struct prom_args { | 36 | struct prom_args { |
@@ -45,7 +59,7 @@ int call_prom(const char *service, int nargs, int nret, ...) | |||
45 | return (nret > 0)? args.args[nargs]: 0; | 59 | return (nret > 0)? args.args[nargs]: 0; |
46 | } | 60 | } |
47 | 61 | ||
48 | int call_prom_ret(const char *service, int nargs, int nret, | 62 | static int call_prom_ret(const char *service, int nargs, int nret, |
49 | unsigned int *rets, ...) | 63 | unsigned int *rets, ...) |
50 | { | 64 | { |
51 | int i; | 65 | int i; |
@@ -79,11 +93,6 @@ int call_prom_ret(const char *service, int nargs, int nret, | |||
79 | return (nret > 0)? args.args[nargs]: 0; | 93 | return (nret > 0)? args.args[nargs]: 0; |
80 | } | 94 | } |
81 | 95 | ||
82 | int write(void *handle, void *ptr, int nb) | ||
83 | { | ||
84 | return call_prom("write", 3, 1, handle, ptr, nb); | ||
85 | } | ||
86 | |||
87 | /* | 96 | /* |
88 | * Older OF's require that when claiming a specific range of addresses, | 97 | * Older OF's require that when claiming a specific range of addresses, |
89 | * we claim the physical space in the /memory node and the virtual | 98 | * we claim the physical space in the /memory node and the virtual |
@@ -142,7 +151,7 @@ static int check_of_version(void) | |||
142 | return 1; | 151 | return 1; |
143 | } | 152 | } |
144 | 153 | ||
145 | void *claim(unsigned long virt, unsigned long size, unsigned long align) | 154 | static void *claim(unsigned long virt, unsigned long size, unsigned long align) |
146 | { | 155 | { |
147 | int ret; | 156 | int ret; |
148 | unsigned int result; | 157 | unsigned int result; |
@@ -151,7 +160,7 @@ void *claim(unsigned long virt, unsigned long size, unsigned long align) | |||
151 | need_map = check_of_version(); | 160 | need_map = check_of_version(); |
152 | if (align || !need_map) | 161 | if (align || !need_map) |
153 | return (void *) call_prom("claim", 3, 1, virt, size, align); | 162 | return (void *) call_prom("claim", 3, 1, virt, size, align); |
154 | 163 | ||
155 | ret = call_prom_ret("call-method", 5, 2, &result, "claim", memory, | 164 | ret = call_prom_ret("call-method", 5, 2, &result, "claim", memory, |
156 | align, size, virt); | 165 | align, size, virt); |
157 | if (ret != 0 || result == -1) | 166 | if (ret != 0 || result == -1) |
@@ -163,3 +172,112 @@ void *claim(unsigned long virt, unsigned long size, unsigned long align) | |||
163 | 0x12, size, virt, virt); | 172 | 0x12, size, virt, virt); |
164 | return (void *) virt; | 173 | return (void *) virt; |
165 | } | 174 | } |
175 | |||
176 | static void *of_try_claim(u32 size) | ||
177 | { | ||
178 | unsigned long addr = 0; | ||
179 | static u8 first_time = 1; | ||
180 | |||
181 | if (first_time) { | ||
182 | claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB); | ||
183 | first_time = 0; | ||
184 | } | ||
185 | |||
186 | for(; claim_base < RAM_END; claim_base += ONE_MB) { | ||
187 | #ifdef DEBUG | ||
188 | printf(" trying: 0x%08lx\n\r", claim_base); | ||
189 | #endif | ||
190 | addr = (unsigned long)claim(claim_base, size, 0); | ||
191 | if ((void *)addr != (void *)-1) | ||
192 | break; | ||
193 | } | ||
194 | if (addr == 0) | ||
195 | return NULL; | ||
196 | claim_base = PAGE_ALIGN(claim_base + size); | ||
197 | return (void *)addr; | ||
198 | } | ||
199 | |||
200 | static void of_image_hdr(const void *hdr) | ||
201 | { | ||
202 | const Elf64_Ehdr *elf64 = hdr; | ||
203 | |||
204 | if (elf64->e_ident[EI_CLASS] == ELFCLASS64) { | ||
205 | /* | ||
206 | * Maintain a "magic" minimum address. This keeps some older | ||
207 | * firmware platforms running. | ||
208 | */ | ||
209 | if (claim_base < PROG_START) | ||
210 | claim_base = PROG_START; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | static void of_exit(void) | ||
215 | { | ||
216 | call_prom("exit", 0, 0); | ||
217 | } | ||
218 | |||
219 | /* | ||
220 | * OF device tree routines | ||
221 | */ | ||
222 | static void *of_finddevice(const char *name) | ||
223 | { | ||
224 | return (phandle) call_prom("finddevice", 1, 1, name); | ||
225 | } | ||
226 | |||
227 | static int of_getprop(const void *phandle, const char *name, void *buf, | ||
228 | const int buflen) | ||
229 | { | ||
230 | return call_prom("getprop", 4, 1, phandle, name, buf, buflen); | ||
231 | } | ||
232 | |||
233 | static int of_setprop(const void *phandle, const char *name, const void *buf, | ||
234 | const int buflen) | ||
235 | { | ||
236 | return call_prom("setprop", 4, 1, phandle, name, buf, buflen); | ||
237 | } | ||
238 | |||
239 | /* | ||
240 | * OF console routines | ||
241 | */ | ||
242 | static void *of_stdout_handle; | ||
243 | |||
244 | static int of_console_open(void) | ||
245 | { | ||
246 | void *devp; | ||
247 | |||
248 | if (((devp = finddevice("/chosen")) != NULL) | ||
249 | && (getprop(devp, "stdout", &of_stdout_handle, | ||
250 | sizeof(of_stdout_handle)) | ||
251 | == sizeof(of_stdout_handle))) | ||
252 | return 0; | ||
253 | |||
254 | return -1; | ||
255 | } | ||
256 | |||
257 | static void of_console_write(char *buf, int len) | ||
258 | { | ||
259 | call_prom("write", 3, 1, of_stdout_handle, buf, len); | ||
260 | } | ||
261 | |||
262 | int platform_init(void *promptr) | ||
263 | { | ||
264 | platform_ops.fixups = NULL; | ||
265 | platform_ops.image_hdr = of_image_hdr; | ||
266 | platform_ops.malloc = of_try_claim; | ||
267 | platform_ops.free = NULL; | ||
268 | platform_ops.exit = of_exit; | ||
269 | |||
270 | dt_ops.finddevice = of_finddevice; | ||
271 | dt_ops.getprop = of_getprop; | ||
272 | dt_ops.setprop = of_setprop; | ||
273 | dt_ops.translate_addr = NULL; | ||
274 | |||
275 | console_ops.open = of_console_open; | ||
276 | console_ops.write = of_console_write; | ||
277 | console_ops.edit_cmdline = NULL; | ||
278 | console_ops.close = NULL; | ||
279 | console_ops.data = NULL; | ||
280 | |||
281 | prom = (int (*)(void *))promptr; | ||
282 | return 0; | ||
283 | } | ||
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h new file mode 100644 index 000000000000..135eb4bb03b4 --- /dev/null +++ b/arch/powerpc/boot/ops.h | |||
@@ -0,0 +1,100 @@ | |||
1 | /* | ||
2 | * Global definition of all the bootwrapper operations. | ||
3 | * | ||
4 | * Author: Mark A. Greer <mgreer@mvista.com> | ||
5 | * | ||
6 | * 2006 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | #ifndef _PPC_BOOT_OPS_H_ | ||
12 | #define _PPC_BOOT_OPS_H_ | ||
13 | |||
14 | #include "types.h" | ||
15 | |||
16 | #define COMMAND_LINE_SIZE 512 | ||
17 | #define MAX_PATH_LEN 256 | ||
18 | #define MAX_PROP_LEN 256 /* What should this be? */ | ||
19 | |||
20 | /* Platform specific operations */ | ||
21 | struct platform_ops { | ||
22 | void (*fixups)(void); | ||
23 | void (*image_hdr)(const void *); | ||
24 | void * (*malloc)(u32 size); | ||
25 | void (*free)(void *ptr, u32 size); | ||
26 | void (*exit)(void); | ||
27 | }; | ||
28 | extern struct platform_ops platform_ops; | ||
29 | |||
30 | /* Device Tree operations */ | ||
31 | struct dt_ops { | ||
32 | void * (*finddevice)(const char *name); | ||
33 | int (*getprop)(const void *node, const char *name, void *buf, | ||
34 | const int buflen); | ||
35 | int (*setprop)(const void *node, const char *name, | ||
36 | const void *buf, const int buflen); | ||
37 | u64 (*translate_addr)(const char *path, const u32 *in_addr, | ||
38 | const u32 addr_len); | ||
39 | unsigned long (*ft_addr)(void); | ||
40 | }; | ||
41 | extern struct dt_ops dt_ops; | ||
42 | |||
43 | /* Console operations */ | ||
44 | struct console_ops { | ||
45 | int (*open)(void); | ||
46 | void (*write)(char *buf, int len); | ||
47 | void (*edit_cmdline)(char *buf, int len); | ||
48 | void (*close)(void); | ||
49 | void *data; | ||
50 | }; | ||
51 | extern struct console_ops console_ops; | ||
52 | |||
53 | /* Serial console operations */ | ||
54 | struct serial_console_data { | ||
55 | int (*open)(void); | ||
56 | void (*putc)(unsigned char c); | ||
57 | unsigned char (*getc)(void); | ||
58 | u8 (*tstc)(void); | ||
59 | void (*close)(void); | ||
60 | }; | ||
61 | |||
62 | extern int platform_init(void *promptr); | ||
63 | extern void simple_alloc_init(void); | ||
64 | extern void ft_init(void *dt_blob); | ||
65 | extern int serial_console_init(void); | ||
66 | |||
67 | static inline void *finddevice(const char *name) | ||
68 | { | ||
69 | return (dt_ops.finddevice) ? dt_ops.finddevice(name) : NULL; | ||
70 | } | ||
71 | |||
72 | static inline int getprop(void *devp, const char *name, void *buf, int buflen) | ||
73 | { | ||
74 | return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1; | ||
75 | } | ||
76 | |||
77 | static inline int setprop(void *devp, const char *name, void *buf, int buflen) | ||
78 | { | ||
79 | return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1; | ||
80 | } | ||
81 | |||
82 | static inline void *malloc(u32 size) | ||
83 | { | ||
84 | return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL; | ||
85 | } | ||
86 | |||
87 | static inline void free(void *ptr, u32 size) | ||
88 | { | ||
89 | if (platform_ops.free) | ||
90 | platform_ops.free(ptr, size); | ||
91 | } | ||
92 | |||
93 | static inline void exit(void) | ||
94 | { | ||
95 | if (platform_ops.exit) | ||
96 | platform_ops.exit(); | ||
97 | for(;;); | ||
98 | } | ||
99 | |||
100 | #endif /* _PPC_BOOT_OPS_H_ */ | ||
diff --git a/arch/powerpc/boot/prom.h b/arch/powerpc/boot/prom.h deleted file mode 100644 index a57b184c564f..000000000000 --- a/arch/powerpc/boot/prom.h +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | #ifndef _PPC_BOOT_PROM_H_ | ||
2 | #define _PPC_BOOT_PROM_H_ | ||
3 | |||
4 | typedef void *phandle; | ||
5 | typedef void *ihandle; | ||
6 | |||
7 | extern int (*prom) (void *); | ||
8 | extern phandle chosen_handle; | ||
9 | extern ihandle stdout; | ||
10 | |||
11 | int call_prom(const char *service, int nargs, int nret, ...); | ||
12 | int call_prom_ret(const char *service, int nargs, int nret, | ||
13 | unsigned int *rets, ...); | ||
14 | |||
15 | extern int write(void *handle, void *ptr, int nb); | ||
16 | extern void *claim(unsigned long virt, unsigned long size, unsigned long aln); | ||
17 | |||
18 | static inline void exit(void) | ||
19 | { | ||
20 | call_prom("exit", 0, 0); | ||
21 | } | ||
22 | |||
23 | static inline phandle finddevice(const char *name) | ||
24 | { | ||
25 | return (phandle) call_prom("finddevice", 1, 1, name); | ||
26 | } | ||
27 | |||
28 | static inline int getprop(void *phandle, const char *name, | ||
29 | void *buf, int buflen) | ||
30 | { | ||
31 | return call_prom("getprop", 4, 1, phandle, name, buf, buflen); | ||
32 | } | ||
33 | |||
34 | |||
35 | static inline int setprop(void *phandle, const char *name, | ||
36 | void *buf, int buflen) | ||
37 | { | ||
38 | return call_prom("setprop", 4, 1, phandle, name, buf, buflen); | ||
39 | } | ||
40 | |||
41 | #endif /* _PPC_BOOT_PROM_H_ */ | ||
diff --git a/arch/powerpc/boot/stdio.c b/arch/powerpc/boot/stdio.c index b5aa522f8b77..6d5f6382e1ce 100644 --- a/arch/powerpc/boot/stdio.c +++ b/arch/powerpc/boot/stdio.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <stddef.h> | 10 | #include <stddef.h> |
11 | #include "string.h" | 11 | #include "string.h" |
12 | #include "stdio.h" | 12 | #include "stdio.h" |
13 | #include "prom.h" | 13 | #include "ops.h" |
14 | 14 | ||
15 | size_t strnlen(const char * s, size_t count) | 15 | size_t strnlen(const char * s, size_t count) |
16 | { | 16 | { |
@@ -320,6 +320,6 @@ printf(const char *fmt, ...) | |||
320 | va_start(args, fmt); | 320 | va_start(args, fmt); |
321 | n = vsprintf(sprint_buf, fmt, args); | 321 | n = vsprintf(sprint_buf, fmt, args); |
322 | va_end(args); | 322 | va_end(args); |
323 | write(stdout, sprint_buf, n); | 323 | console_ops.write(sprint_buf, n); |
324 | return n; | 324 | return n; |
325 | } | 325 | } |
diff --git a/arch/powerpc/boot/stdio.h b/arch/powerpc/boot/stdio.h index eb9e16c87aef..73b8a91bfb34 100644 --- a/arch/powerpc/boot/stdio.h +++ b/arch/powerpc/boot/stdio.h | |||
@@ -1,8 +1,16 @@ | |||
1 | #ifndef _PPC_BOOT_STDIO_H_ | 1 | #ifndef _PPC_BOOT_STDIO_H_ |
2 | #define _PPC_BOOT_STDIO_H_ | 2 | #define _PPC_BOOT_STDIO_H_ |
3 | 3 | ||
4 | #include <stdarg.h> | ||
5 | |||
6 | #define ENOMEM 12 /* Out of Memory */ | ||
7 | #define EINVAL 22 /* Invalid argument */ | ||
8 | #define ENOSPC 28 /* No space left on device */ | ||
9 | |||
4 | extern int printf(const char *fmt, ...); | 10 | extern int printf(const char *fmt, ...); |
5 | 11 | ||
12 | #define fprintf(fmt, args...) printf(args) | ||
13 | |||
6 | extern int sprintf(char *buf, const char *fmt, ...); | 14 | extern int sprintf(char *buf, const char *fmt, ...); |
7 | 15 | ||
8 | extern int vsprintf(char *buf, const char *fmt, va_list args); | 16 | extern int vsprintf(char *buf, const char *fmt, va_list args); |
diff --git a/arch/powerpc/boot/types.h b/arch/powerpc/boot/types.h new file mode 100644 index 000000000000..79d26e708677 --- /dev/null +++ b/arch/powerpc/boot/types.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _TYPES_H_ | ||
2 | #define _TYPES_H_ | ||
3 | |||
4 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
5 | |||
6 | typedef unsigned char u8; | ||
7 | typedef unsigned short u16; | ||
8 | typedef unsigned int u32; | ||
9 | typedef unsigned long long u64; | ||
10 | |||
11 | #define min(x,y) ({ \ | ||
12 | typeof(x) _x = (x); \ | ||
13 | typeof(y) _y = (y); \ | ||
14 | (void) (&_x == &_y); \ | ||
15 | _x < _y ? _x : _y; }) | ||
16 | |||
17 | #define max(x,y) ({ \ | ||
18 | typeof(x) _x = (x); \ | ||
19 | typeof(y) _y = (y); \ | ||
20 | (void) (&_x == &_y); \ | ||
21 | _x > _y ? _x : _y; }) | ||
22 | |||
23 | #endif /* _TYPES_H_ */ | ||
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig index 2860be106f4f..62ba66091a13 100644 --- a/arch/powerpc/configs/maple_defconfig +++ b/arch/powerpc/configs/maple_defconfig | |||
@@ -496,7 +496,7 @@ CONFIG_E1000=y | |||
496 | # CONFIG_SKY2 is not set | 496 | # CONFIG_SKY2 is not set |
497 | # CONFIG_SK98LIN is not set | 497 | # CONFIG_SK98LIN is not set |
498 | # CONFIG_VIA_VELOCITY is not set | 498 | # CONFIG_VIA_VELOCITY is not set |
499 | # CONFIG_TIGON3 is not set | 499 | CONFIG_TIGON3=y |
500 | # CONFIG_BNX2 is not set | 500 | # CONFIG_BNX2 is not set |
501 | # CONFIG_MV643XX_ETH is not set | 501 | # CONFIG_MV643XX_ETH is not set |
502 | 502 | ||
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 7d32ad0194a4..8b133afbdc20 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -16,7 +16,7 @@ obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ | |||
16 | obj-y += vdso32/ | 16 | obj-y += vdso32/ |
17 | obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ | 17 | obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ |
18 | signal_64.o ptrace32.o \ | 18 | signal_64.o ptrace32.o \ |
19 | paca.o cpu_setup_power4.o \ | 19 | paca.o cpu_setup_ppc970.o \ |
20 | firmware.o sysfs.o | 20 | firmware.o sysfs.o |
21 | obj-$(CONFIG_PPC64) += vdso64/ | 21 | obj-$(CONFIG_PPC64) += vdso64/ |
22 | obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o | 22 | obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o |
@@ -51,7 +51,7 @@ extra-$(CONFIG_8xx) := head_8xx.o | |||
51 | extra-y += vmlinux.lds | 51 | extra-y += vmlinux.lds |
52 | 52 | ||
53 | obj-y += time.o prom.o traps.o setup-common.o \ | 53 | obj-y += time.o prom.o traps.o setup-common.o \ |
54 | udbg.o misc.o | 54 | udbg.o misc.o io.o |
55 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o | 55 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o |
56 | obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o | 56 | obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o |
57 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o | 57 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 7ee84968087b..d06f378597bb 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -40,9 +40,10 @@ | |||
40 | #ifdef CONFIG_PPC64 | 40 | #ifdef CONFIG_PPC64 |
41 | #include <asm/paca.h> | 41 | #include <asm/paca.h> |
42 | #include <asm/lppaca.h> | 42 | #include <asm/lppaca.h> |
43 | #include <asm/iseries/hv_lp_event.h> | ||
44 | #include <asm/cache.h> | 43 | #include <asm/cache.h> |
45 | #include <asm/compat.h> | 44 | #include <asm/compat.h> |
45 | #include <asm/mmu.h> | ||
46 | #include <asm/hvcall.h> | ||
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | #define DEFINE(sym, val) \ | 49 | #define DEFINE(sym, val) \ |
@@ -136,11 +137,18 @@ int main(void) | |||
136 | DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); | 137 | DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); |
137 | DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); | 138 | DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); |
138 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); | 139 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); |
140 | DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); | ||
141 | DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); | ||
139 | 142 | ||
143 | DEFINE(SLBSHADOW_STACKVSID, | ||
144 | offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); | ||
145 | DEFINE(SLBSHADOW_STACKESID, | ||
146 | offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].esid)); | ||
140 | DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); | 147 | DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); |
141 | DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1)); | 148 | DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1)); |
142 | DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); | 149 | DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); |
143 | DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); | 150 | DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); |
151 | DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area)); | ||
144 | #endif /* CONFIG_PPC64 */ | 152 | #endif /* CONFIG_PPC64 */ |
145 | 153 | ||
146 | /* RTAS */ | 154 | /* RTAS */ |
@@ -159,6 +167,12 @@ int main(void) | |||
159 | /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */ | 167 | /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */ |
160 | DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); | 168 | DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); |
161 | DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); | 169 | DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); |
170 | |||
171 | /* hcall statistics */ | ||
172 | DEFINE(HCALL_STAT_SIZE, sizeof(struct hcall_stats)); | ||
173 | DEFINE(HCALL_STAT_CALLS, offsetof(struct hcall_stats, num_calls)); | ||
174 | DEFINE(HCALL_STAT_TB, offsetof(struct hcall_stats, tb_total)); | ||
175 | DEFINE(HCALL_STAT_PURR, offsetof(struct hcall_stats, purr_total)); | ||
162 | #endif /* CONFIG_PPC64 */ | 176 | #endif /* CONFIG_PPC64 */ |
163 | DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0])); | 177 | DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0])); |
164 | DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1])); | 178 | DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1])); |
@@ -240,6 +254,7 @@ int main(void) | |||
240 | DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value)); | 254 | DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value)); |
241 | DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); | 255 | DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); |
242 | DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); | 256 | DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); |
257 | DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore)); | ||
243 | 258 | ||
244 | #ifndef CONFIG_PPC64 | 259 | #ifndef CONFIG_PPC64 |
245 | DEFINE(pbe_address, offsetof(struct pbe, address)); | 260 | DEFINE(pbe_address, offsetof(struct pbe, address)); |
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index f4e5e14ee2b6..995fcef156fd 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c | |||
@@ -158,35 +158,35 @@ int btext_initialize(struct device_node *np) | |||
158 | { | 158 | { |
159 | unsigned int width, height, depth, pitch; | 159 | unsigned int width, height, depth, pitch; |
160 | unsigned long address = 0; | 160 | unsigned long address = 0; |
161 | u32 *prop; | 161 | const u32 *prop; |
162 | 162 | ||
163 | prop = (u32 *)get_property(np, "linux,bootx-width", NULL); | 163 | prop = get_property(np, "linux,bootx-width", NULL); |
164 | if (prop == NULL) | 164 | if (prop == NULL) |
165 | prop = (u32 *)get_property(np, "width", NULL); | 165 | prop = get_property(np, "width", NULL); |
166 | if (prop == NULL) | 166 | if (prop == NULL) |
167 | return -EINVAL; | 167 | return -EINVAL; |
168 | width = *prop; | 168 | width = *prop; |
169 | prop = (u32 *)get_property(np, "linux,bootx-height", NULL); | 169 | prop = get_property(np, "linux,bootx-height", NULL); |
170 | if (prop == NULL) | 170 | if (prop == NULL) |
171 | prop = (u32 *)get_property(np, "height", NULL); | 171 | prop = get_property(np, "height", NULL); |
172 | if (prop == NULL) | 172 | if (prop == NULL) |
173 | return -EINVAL; | 173 | return -EINVAL; |
174 | height = *prop; | 174 | height = *prop; |
175 | prop = (u32 *)get_property(np, "linux,bootx-depth", NULL); | 175 | prop = get_property(np, "linux,bootx-depth", NULL); |
176 | if (prop == NULL) | 176 | if (prop == NULL) |
177 | prop = (u32 *)get_property(np, "depth", NULL); | 177 | prop = get_property(np, "depth", NULL); |
178 | if (prop == NULL) | 178 | if (prop == NULL) |
179 | return -EINVAL; | 179 | return -EINVAL; |
180 | depth = *prop; | 180 | depth = *prop; |
181 | pitch = width * ((depth + 7) / 8); | 181 | pitch = width * ((depth + 7) / 8); |
182 | prop = (u32 *)get_property(np, "linux,bootx-linebytes", NULL); | 182 | prop = get_property(np, "linux,bootx-linebytes", NULL); |
183 | if (prop == NULL) | 183 | if (prop == NULL) |
184 | prop = (u32 *)get_property(np, "linebytes", NULL); | 184 | prop = get_property(np, "linebytes", NULL); |
185 | if (prop) | 185 | if (prop) |
186 | pitch = *prop; | 186 | pitch = *prop; |
187 | if (pitch == 1) | 187 | if (pitch == 1) |
188 | pitch = 0x1000; | 188 | pitch = 0x1000; |
189 | prop = (u32 *)get_property(np, "address", NULL); | 189 | prop = get_property(np, "address", NULL); |
190 | if (prop) | 190 | if (prop) |
191 | address = *prop; | 191 | address = *prop; |
192 | 192 | ||
@@ -214,11 +214,11 @@ int btext_initialize(struct device_node *np) | |||
214 | 214 | ||
215 | int __init btext_find_display(int allow_nonstdout) | 215 | int __init btext_find_display(int allow_nonstdout) |
216 | { | 216 | { |
217 | char *name; | 217 | const char *name; |
218 | struct device_node *np = NULL; | 218 | struct device_node *np = NULL; |
219 | int rc = -ENODEV; | 219 | int rc = -ENODEV; |
220 | 220 | ||
221 | name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 221 | name = get_property(of_chosen, "linux,stdout-path", NULL); |
222 | if (name != NULL) { | 222 | if (name != NULL) { |
223 | np = of_find_node_by_path(name); | 223 | np = of_find_node_by_path(name); |
224 | if (np != NULL) { | 224 | if (np != NULL) { |
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_ppc970.S index 76e97aa71c45..652594891d58 100644 --- a/arch/powerpc/kernel/cpu_setup_power4.S +++ b/arch/powerpc/kernel/cpu_setup_ppc970.S | |||
@@ -16,27 +16,12 @@ | |||
16 | #include <asm/asm-offsets.h> | 16 | #include <asm/asm-offsets.h> |
17 | #include <asm/cache.h> | 17 | #include <asm/cache.h> |
18 | 18 | ||
19 | _GLOBAL(__970_cpu_preinit) | 19 | _GLOBAL(__cpu_preinit_ppc970) |
20 | /* | 20 | /* Do nothing if not running in HV mode */ |
21 | * Do nothing if not running in HV mode | ||
22 | */ | ||
23 | mfmsr r0 | 21 | mfmsr r0 |
24 | rldicl. r0,r0,4,63 | 22 | rldicl. r0,r0,4,63 |
25 | beqlr | 23 | beqlr |
26 | 24 | ||
27 | /* | ||
28 | * Deal only with PPC970 and PPC970FX. | ||
29 | */ | ||
30 | mfspr r0,SPRN_PVR | ||
31 | srwi r0,r0,16 | ||
32 | cmpwi r0,0x39 | ||
33 | beq 1f | ||
34 | cmpwi r0,0x3c | ||
35 | beq 1f | ||
36 | cmpwi r0,0x44 | ||
37 | bnelr | ||
38 | 1: | ||
39 | |||
40 | /* Make sure HID4:rm_ci is off before MMU is turned off, that large | 25 | /* Make sure HID4:rm_ci is off before MMU is turned off, that large |
41 | * pages are enabled with HID4:61 and clear HID5:DCBZ_size and | 26 | * pages are enabled with HID4:61 and clear HID5:DCBZ_size and |
42 | * HID5:DCBZ32_ill | 27 | * HID5:DCBZ32_ill |
@@ -72,23 +57,6 @@ _GLOBAL(__970_cpu_preinit) | |||
72 | isync | 57 | isync |
73 | blr | 58 | blr |
74 | 59 | ||
75 | _GLOBAL(__setup_cpu_ppc970) | ||
76 | mfspr r0,SPRN_HID0 | ||
77 | li r11,5 /* clear DOZE and SLEEP */ | ||
78 | rldimi r0,r11,52,8 /* set NAP and DPM */ | ||
79 | li r11,0 | ||
80 | rldimi r0,r11,32,31 /* clear EN_ATTN */ | ||
81 | mtspr SPRN_HID0,r0 | ||
82 | mfspr r0,SPRN_HID0 | ||
83 | mfspr r0,SPRN_HID0 | ||
84 | mfspr r0,SPRN_HID0 | ||
85 | mfspr r0,SPRN_HID0 | ||
86 | mfspr r0,SPRN_HID0 | ||
87 | mfspr r0,SPRN_HID0 | ||
88 | sync | ||
89 | isync | ||
90 | blr | ||
91 | |||
92 | /* Definitions for the table use to save CPU states */ | 60 | /* Definitions for the table use to save CPU states */ |
93 | #define CS_HID0 0 | 61 | #define CS_HID0 0 |
94 | #define CS_HID1 8 | 62 | #define CS_HID1 8 |
@@ -103,33 +71,30 @@ cpu_state_storage: | |||
103 | .balign L1_CACHE_BYTES,0 | 71 | .balign L1_CACHE_BYTES,0 |
104 | .text | 72 | .text |
105 | 73 | ||
106 | /* Called in normal context to backup CPU 0 state. This | ||
107 | * does not include cache settings. This function is also | ||
108 | * called for machine sleep. This does not include the MMU | ||
109 | * setup, BATs, etc... but rather the "special" registers | ||
110 | * like HID0, HID1, HID4, etc... | ||
111 | */ | ||
112 | _GLOBAL(__save_cpu_setup) | ||
113 | /* Some CR fields are volatile, we back it up all */ | ||
114 | mfcr r7 | ||
115 | |||
116 | /* Get storage ptr */ | ||
117 | LOAD_REG_IMMEDIATE(r5,cpu_state_storage) | ||
118 | 74 | ||
119 | /* We only deal with 970 for now */ | 75 | _GLOBAL(__setup_cpu_ppc970) |
120 | mfspr r0,SPRN_PVR | 76 | /* Do nothing if not running in HV mode */ |
121 | srwi r0,r0,16 | ||
122 | cmpwi r0,0x39 | ||
123 | beq 1f | ||
124 | cmpwi r0,0x3c | ||
125 | beq 1f | ||
126 | cmpwi r0,0x44 | ||
127 | bne 2f | ||
128 | |||
129 | 1: /* skip if not running in HV mode */ | ||
130 | mfmsr r0 | 77 | mfmsr r0 |
131 | rldicl. r0,r0,4,63 | 78 | rldicl. r0,r0,4,63 |
132 | beq 2f | 79 | beqlr |
80 | |||
81 | mfspr r0,SPRN_HID0 | ||
82 | li r11,5 /* clear DOZE and SLEEP */ | ||
83 | rldimi r0,r11,52,8 /* set NAP and DPM */ | ||
84 | li r11,0 | ||
85 | rldimi r0,r11,32,31 /* clear EN_ATTN */ | ||
86 | mtspr SPRN_HID0,r0 | ||
87 | mfspr r0,SPRN_HID0 | ||
88 | mfspr r0,SPRN_HID0 | ||
89 | mfspr r0,SPRN_HID0 | ||
90 | mfspr r0,SPRN_HID0 | ||
91 | mfspr r0,SPRN_HID0 | ||
92 | mfspr r0,SPRN_HID0 | ||
93 | sync | ||
94 | isync | ||
95 | |||
96 | /* Save away cpu state */ | ||
97 | LOAD_REG_IMMEDIATE(r5,cpu_state_storage) | ||
133 | 98 | ||
134 | /* Save HID0,1,4 and 5 */ | 99 | /* Save HID0,1,4 and 5 */ |
135 | mfspr r3,SPRN_HID0 | 100 | mfspr r3,SPRN_HID0 |
@@ -141,35 +106,19 @@ _GLOBAL(__save_cpu_setup) | |||
141 | mfspr r3,SPRN_HID5 | 106 | mfspr r3,SPRN_HID5 |
142 | std r3,CS_HID5(r5) | 107 | std r3,CS_HID5(r5) |
143 | 108 | ||
144 | 2: | ||
145 | mtcr r7 | ||
146 | blr | 109 | blr |
147 | 110 | ||
148 | /* Called with no MMU context (typically MSR:IR/DR off) to | 111 | /* Called with no MMU context (typically MSR:IR/DR off) to |
149 | * restore CPU state as backed up by the previous | 112 | * restore CPU state as backed up by the previous |
150 | * function. This does not include cache setting | 113 | * function. This does not include cache setting |
151 | */ | 114 | */ |
152 | _GLOBAL(__restore_cpu_setup) | 115 | _GLOBAL(__restore_cpu_ppc970) |
153 | /* Get storage ptr (FIXME when using anton reloc as we | 116 | /* Do nothing if not running in HV mode */ |
154 | * are running with translation disabled here | ||
155 | */ | ||
156 | LOAD_REG_IMMEDIATE(r5,cpu_state_storage) | ||
157 | |||
158 | /* We only deal with 970 for now */ | ||
159 | mfspr r0,SPRN_PVR | ||
160 | srwi r0,r0,16 | ||
161 | cmpwi r0,0x39 | ||
162 | beq 1f | ||
163 | cmpwi r0,0x3c | ||
164 | beq 1f | ||
165 | cmpwi r0,0x44 | ||
166 | bnelr | ||
167 | |||
168 | 1: /* skip if not running in HV mode */ | ||
169 | mfmsr r0 | 117 | mfmsr r0 |
170 | rldicl. r0,r0,4,63 | 118 | rldicl. r0,r0,4,63 |
171 | beqlr | 119 | beqlr |
172 | 120 | ||
121 | LOAD_REG_IMMEDIATE(r5,cpu_state_storage) | ||
173 | /* Before accessing memory, we make sure rm_ci is clear */ | 122 | /* Before accessing memory, we make sure rm_ci is clear */ |
174 | li r0,0 | 123 | li r0,0 |
175 | mfspr r3,SPRN_HID4 | 124 | mfspr r3,SPRN_HID4 |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 272e43622fd6..190a57e20765 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -39,7 +39,10 @@ extern void __setup_cpu_7400(unsigned long offset, struct cpu_spec* spec); | |||
39 | extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec); | 39 | extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec); |
40 | extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec); | 40 | extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec); |
41 | #endif /* CONFIG_PPC32 */ | 41 | #endif /* CONFIG_PPC32 */ |
42 | #ifdef CONFIG_PPC64 | ||
42 | extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); | 43 | extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); |
44 | extern void __restore_cpu_ppc970(void); | ||
45 | #endif /* CONFIG_PPC64 */ | ||
43 | 46 | ||
44 | /* This table only contains "desktop" CPUs, it need to be filled with embedded | 47 | /* This table only contains "desktop" CPUs, it need to be filled with embedded |
45 | * ones as well... | 48 | * ones as well... |
@@ -55,6 +58,9 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); | |||
55 | #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\ | 58 | #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\ |
56 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \ | 59 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \ |
57 | PPC_FEATURE_TRUE_LE) | 60 | PPC_FEATURE_TRUE_LE) |
61 | #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\ | ||
62 | PPC_FEATURE_TRUE_LE | \ | ||
63 | PPC_FEATURE_HAS_ALTIVEC_COMP) | ||
58 | #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ | 64 | #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ |
59 | PPC_FEATURE_BOOKE) | 65 | PPC_FEATURE_BOOKE) |
60 | 66 | ||
@@ -184,6 +190,7 @@ struct cpu_spec cpu_specs[] = { | |||
184 | .dcache_bsize = 128, | 190 | .dcache_bsize = 128, |
185 | .num_pmcs = 8, | 191 | .num_pmcs = 8, |
186 | .cpu_setup = __setup_cpu_ppc970, | 192 | .cpu_setup = __setup_cpu_ppc970, |
193 | .cpu_restore = __restore_cpu_ppc970, | ||
187 | .oprofile_cpu_type = "ppc64/970", | 194 | .oprofile_cpu_type = "ppc64/970", |
188 | .oprofile_type = PPC_OPROFILE_POWER4, | 195 | .oprofile_type = PPC_OPROFILE_POWER4, |
189 | .platform = "ppc970", | 196 | .platform = "ppc970", |
@@ -199,6 +206,7 @@ struct cpu_spec cpu_specs[] = { | |||
199 | .dcache_bsize = 128, | 206 | .dcache_bsize = 128, |
200 | .num_pmcs = 8, | 207 | .num_pmcs = 8, |
201 | .cpu_setup = __setup_cpu_ppc970, | 208 | .cpu_setup = __setup_cpu_ppc970, |
209 | .cpu_restore = __restore_cpu_ppc970, | ||
202 | .oprofile_cpu_type = "ppc64/970", | 210 | .oprofile_cpu_type = "ppc64/970", |
203 | .oprofile_type = PPC_OPROFILE_POWER4, | 211 | .oprofile_type = PPC_OPROFILE_POWER4, |
204 | .platform = "ppc970", | 212 | .platform = "ppc970", |
@@ -214,6 +222,7 @@ struct cpu_spec cpu_specs[] = { | |||
214 | .dcache_bsize = 128, | 222 | .dcache_bsize = 128, |
215 | .num_pmcs = 8, | 223 | .num_pmcs = 8, |
216 | .cpu_setup = __setup_cpu_ppc970, | 224 | .cpu_setup = __setup_cpu_ppc970, |
225 | .cpu_restore = __restore_cpu_ppc970, | ||
217 | .oprofile_cpu_type = "ppc64/970", | 226 | .oprofile_cpu_type = "ppc64/970", |
218 | .oprofile_type = PPC_OPROFILE_POWER4, | 227 | .oprofile_type = PPC_OPROFILE_POWER4, |
219 | .platform = "ppc970", | 228 | .platform = "ppc970", |
@@ -280,6 +289,17 @@ struct cpu_spec cpu_specs[] = { | |||
280 | .dcache_bsize = 128, | 289 | .dcache_bsize = 128, |
281 | .platform = "ppc-cell-be", | 290 | .platform = "ppc-cell-be", |
282 | }, | 291 | }, |
292 | { /* PA Semi PA6T */ | ||
293 | .pvr_mask = 0x7fff0000, | ||
294 | .pvr_value = 0x00900000, | ||
295 | .cpu_name = "PA6T", | ||
296 | .cpu_features = CPU_FTRS_PA6T, | ||
297 | .cpu_user_features = COMMON_USER_PA6T, | ||
298 | .icache_bsize = 64, | ||
299 | .dcache_bsize = 64, | ||
300 | .num_pmcs = 6, | ||
301 | .platform = "pa6t", | ||
302 | }, | ||
283 | { /* default match */ | 303 | { /* default match */ |
284 | .pvr_mask = 0x00000000, | 304 | .pvr_mask = 0x00000000, |
285 | .pvr_value = 0x00000000, | 305 | .pvr_value = 0x00000000, |
@@ -929,6 +949,7 @@ struct cpu_spec cpu_specs[] = { | |||
929 | PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, | 949 | PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, |
930 | .icache_bsize = 32, | 950 | .icache_bsize = 32, |
931 | .dcache_bsize = 32, | 951 | .dcache_bsize = 32, |
952 | .platform = "ppc405", | ||
932 | }, | 953 | }, |
933 | { /* 405EP */ | 954 | { /* 405EP */ |
934 | .pvr_mask = 0xffff0000, | 955 | .pvr_mask = 0xffff0000, |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 371973be8d71..2f6f5a7bc69e 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -80,7 +80,7 @@ static int __init parse_savemaxmem(char *p) | |||
80 | } | 80 | } |
81 | __setup("savemaxmem=", parse_savemaxmem); | 81 | __setup("savemaxmem=", parse_savemaxmem); |
82 | 82 | ||
83 | /* | 83 | /** |
84 | * copy_oldmem_page - copy one page from "oldmem" | 84 | * copy_oldmem_page - copy one page from "oldmem" |
85 | * @pfn: page frame number to be copied | 85 | * @pfn: page frame number to be copied |
86 | * @buf: target memory address for the copy; this can be in kernel address | 86 | * @buf: target memory address for the copy; this can be in kernel address |
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c index 36aaa7663f02..6c168f6ea142 100644 --- a/arch/powerpc/kernel/dma_64.c +++ b/arch/powerpc/kernel/dma_64.c | |||
@@ -35,10 +35,9 @@ int dma_supported(struct device *dev, u64 mask) | |||
35 | { | 35 | { |
36 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 36 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
37 | 37 | ||
38 | if (dma_ops) | 38 | BUG_ON(!dma_ops); |
39 | return dma_ops->dma_supported(dev, mask); | 39 | |
40 | BUG(); | 40 | return dma_ops->dma_supported(dev, mask); |
41 | return 0; | ||
42 | } | 41 | } |
43 | EXPORT_SYMBOL(dma_supported); | 42 | EXPORT_SYMBOL(dma_supported); |
44 | 43 | ||
@@ -66,10 +65,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, | |||
66 | { | 65 | { |
67 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 66 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
68 | 67 | ||
69 | if (dma_ops) | 68 | BUG_ON(!dma_ops); |
70 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); | 69 | |
71 | BUG(); | 70 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); |
72 | return NULL; | ||
73 | } | 71 | } |
74 | EXPORT_SYMBOL(dma_alloc_coherent); | 72 | EXPORT_SYMBOL(dma_alloc_coherent); |
75 | 73 | ||
@@ -78,10 +76,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | |||
78 | { | 76 | { |
79 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 77 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
80 | 78 | ||
81 | if (dma_ops) | 79 | BUG_ON(!dma_ops); |
82 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | 80 | |
83 | else | 81 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); |
84 | BUG(); | ||
85 | } | 82 | } |
86 | EXPORT_SYMBOL(dma_free_coherent); | 83 | EXPORT_SYMBOL(dma_free_coherent); |
87 | 84 | ||
@@ -90,10 +87,9 @@ dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size, | |||
90 | { | 87 | { |
91 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 88 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
92 | 89 | ||
93 | if (dma_ops) | 90 | BUG_ON(!dma_ops); |
94 | return dma_ops->map_single(dev, cpu_addr, size, direction); | 91 | |
95 | BUG(); | 92 | return dma_ops->map_single(dev, cpu_addr, size, direction); |
96 | return (dma_addr_t)0; | ||
97 | } | 93 | } |
98 | EXPORT_SYMBOL(dma_map_single); | 94 | EXPORT_SYMBOL(dma_map_single); |
99 | 95 | ||
@@ -102,10 +98,9 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
102 | { | 98 | { |
103 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 99 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
104 | 100 | ||
105 | if (dma_ops) | 101 | BUG_ON(!dma_ops); |
106 | dma_ops->unmap_single(dev, dma_addr, size, direction); | 102 | |
107 | else | 103 | dma_ops->unmap_single(dev, dma_addr, size, direction); |
108 | BUG(); | ||
109 | } | 104 | } |
110 | EXPORT_SYMBOL(dma_unmap_single); | 105 | EXPORT_SYMBOL(dma_unmap_single); |
111 | 106 | ||
@@ -115,11 +110,10 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, | |||
115 | { | 110 | { |
116 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 111 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
117 | 112 | ||
118 | if (dma_ops) | 113 | BUG_ON(!dma_ops); |
119 | return dma_ops->map_single(dev, | 114 | |
120 | (page_address(page) + offset), size, direction); | 115 | return dma_ops->map_single(dev, page_address(page) + offset, size, |
121 | BUG(); | 116 | direction); |
122 | return (dma_addr_t)0; | ||
123 | } | 117 | } |
124 | EXPORT_SYMBOL(dma_map_page); | 118 | EXPORT_SYMBOL(dma_map_page); |
125 | 119 | ||
@@ -128,10 +122,9 @@ void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | |||
128 | { | 122 | { |
129 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 123 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
130 | 124 | ||
131 | if (dma_ops) | 125 | BUG_ON(!dma_ops); |
132 | dma_ops->unmap_single(dev, dma_address, size, direction); | 126 | |
133 | else | 127 | dma_ops->unmap_single(dev, dma_address, size, direction); |
134 | BUG(); | ||
135 | } | 128 | } |
136 | EXPORT_SYMBOL(dma_unmap_page); | 129 | EXPORT_SYMBOL(dma_unmap_page); |
137 | 130 | ||
@@ -140,10 +133,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
140 | { | 133 | { |
141 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 134 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
142 | 135 | ||
143 | if (dma_ops) | 136 | BUG_ON(!dma_ops); |
144 | return dma_ops->map_sg(dev, sg, nents, direction); | 137 | |
145 | BUG(); | 138 | return dma_ops->map_sg(dev, sg, nents, direction); |
146 | return 0; | ||
147 | } | 139 | } |
148 | EXPORT_SYMBOL(dma_map_sg); | 140 | EXPORT_SYMBOL(dma_map_sg); |
149 | 141 | ||
@@ -152,9 +144,8 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | |||
152 | { | 144 | { |
153 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 145 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
154 | 146 | ||
155 | if (dma_ops) | 147 | BUG_ON(!dma_ops); |
156 | dma_ops->unmap_sg(dev, sg, nhwentries, direction); | 148 | |
157 | else | 149 | dma_ops->unmap_sg(dev, sg, nhwentries, direction); |
158 | BUG(); | ||
159 | } | 150 | } |
160 | EXPORT_SYMBOL(dma_unmap_sg); | 151 | EXPORT_SYMBOL(dma_unmap_sg); |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 54d9f5cdaab4..2cd872b5283b 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -375,6 +375,14 @@ BEGIN_FTR_SECTION | |||
375 | ld r7,KSP_VSID(r4) /* Get new stack's VSID */ | 375 | ld r7,KSP_VSID(r4) /* Get new stack's VSID */ |
376 | oris r0,r6,(SLB_ESID_V)@h | 376 | oris r0,r6,(SLB_ESID_V)@h |
377 | ori r0,r0,(SLB_NUM_BOLTED-1)@l | 377 | ori r0,r0,(SLB_NUM_BOLTED-1)@l |
378 | |||
379 | /* Update the last bolted SLB */ | ||
380 | ld r9,PACA_SLBSHADOWPTR(r13) | ||
381 | li r12,0 | ||
382 | std r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */ | ||
383 | std r7,SLBSHADOW_STACKVSID(r9) /* Save VSID */ | ||
384 | std r0,SLBSHADOW_STACKESID(r9) /* Save ESID */ | ||
385 | |||
378 | slbie r6 | 386 | slbie r6 |
379 | slbie r6 /* Workaround POWER5 < DD2.1 issue */ | 387 | slbie r6 /* Workaround POWER5 < DD2.1 issue */ |
380 | slbmte r7,r0 | 388 | slbmte r7,r0 |
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 6ff3cf506088..3065b472b95d 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -132,7 +132,7 @@ _GLOBAL(__secondary_hold) | |||
132 | bne 100b | 132 | bne 100b |
133 | 133 | ||
134 | #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) | 134 | #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) |
135 | LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init) | 135 | LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init) |
136 | mtctr r4 | 136 | mtctr r4 |
137 | mr r3,r24 | 137 | mr r3,r24 |
138 | bctr | 138 | bctr |
@@ -1484,19 +1484,17 @@ fwnmi_data_area: | |||
1484 | . = 0x8000 | 1484 | . = 0x8000 |
1485 | 1485 | ||
1486 | /* | 1486 | /* |
1487 | * On pSeries, secondary processors spin in the following code. | 1487 | * On pSeries and most other platforms, secondary processors spin |
1488 | * in the following code. | ||
1488 | * At entry, r3 = this processor's number (physical cpu id) | 1489 | * At entry, r3 = this processor's number (physical cpu id) |
1489 | */ | 1490 | */ |
1490 | _GLOBAL(pSeries_secondary_smp_init) | 1491 | _GLOBAL(generic_secondary_smp_init) |
1491 | mr r24,r3 | 1492 | mr r24,r3 |
1492 | 1493 | ||
1493 | /* turn on 64-bit mode */ | 1494 | /* turn on 64-bit mode */ |
1494 | bl .enable_64b_mode | 1495 | bl .enable_64b_mode |
1495 | isync | 1496 | isync |
1496 | 1497 | ||
1497 | /* Copy some CPU settings from CPU 0 */ | ||
1498 | bl .__restore_cpu_setup | ||
1499 | |||
1500 | /* Set up a paca value for this processor. Since we have the | 1498 | /* Set up a paca value for this processor. Since we have the |
1501 | * physical cpu id in r24, we need to search the pacas to find | 1499 | * physical cpu id in r24, we need to search the pacas to find |
1502 | * which logical id maps to our physical one. | 1500 | * which logical id maps to our physical one. |
@@ -1522,15 +1520,28 @@ _GLOBAL(pSeries_secondary_smp_init) | |||
1522 | /* start. */ | 1520 | /* start. */ |
1523 | sync | 1521 | sync |
1524 | 1522 | ||
1525 | /* Create a temp kernel stack for use before relocation is on. */ | 1523 | #ifndef CONFIG_SMP |
1524 | b 3b /* Never go on non-SMP */ | ||
1525 | #else | ||
1526 | cmpwi 0,r23,0 | ||
1527 | beq 3b /* Loop until told to go */ | ||
1528 | |||
1529 | /* See if we need to call a cpu state restore handler */ | ||
1530 | LOAD_REG_IMMEDIATE(r23, cur_cpu_spec) | ||
1531 | ld r23,0(r23) | ||
1532 | ld r23,CPU_SPEC_RESTORE(r23) | ||
1533 | cmpdi 0,r23,0 | ||
1534 | beq 4f | ||
1535 | ld r23,0(r23) | ||
1536 | mtctr r23 | ||
1537 | bctrl | ||
1538 | |||
1539 | 4: /* Create a temp kernel stack for use before relocation is on. */ | ||
1526 | ld r1,PACAEMERGSP(r13) | 1540 | ld r1,PACAEMERGSP(r13) |
1527 | subi r1,r1,STACK_FRAME_OVERHEAD | 1541 | subi r1,r1,STACK_FRAME_OVERHEAD |
1528 | 1542 | ||
1529 | cmpwi 0,r23,0 | 1543 | b .__secondary_start |
1530 | #ifdef CONFIG_SMP | ||
1531 | bne .__secondary_start | ||
1532 | #endif | 1544 | #endif |
1533 | b 3b /* Loop until told to go */ | ||
1534 | 1545 | ||
1535 | #ifdef CONFIG_PPC_ISERIES | 1546 | #ifdef CONFIG_PPC_ISERIES |
1536 | _STATIC(__start_initialization_iSeries) | 1547 | _STATIC(__start_initialization_iSeries) |
@@ -1611,7 +1622,16 @@ _GLOBAL(__start_initialization_multiplatform) | |||
1611 | bl .enable_64b_mode | 1622 | bl .enable_64b_mode |
1612 | 1623 | ||
1613 | /* Setup some critical 970 SPRs before switching MMU off */ | 1624 | /* Setup some critical 970 SPRs before switching MMU off */ |
1614 | bl .__970_cpu_preinit | 1625 | mfspr r0,SPRN_PVR |
1626 | srwi r0,r0,16 | ||
1627 | cmpwi r0,0x39 /* 970 */ | ||
1628 | beq 1f | ||
1629 | cmpwi r0,0x3c /* 970FX */ | ||
1630 | beq 1f | ||
1631 | cmpwi r0,0x44 /* 970MP */ | ||
1632 | bne 2f | ||
1633 | 1: bl .__cpu_preinit_ppc970 | ||
1634 | 2: | ||
1615 | 1635 | ||
1616 | /* Switch off MMU if not already */ | 1636 | /* Switch off MMU if not already */ |
1617 | LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) | 1637 | LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) |
@@ -1728,7 +1748,7 @@ _STATIC(__after_prom_start) | |||
1728 | _GLOBAL(copy_and_flush) | 1748 | _GLOBAL(copy_and_flush) |
1729 | addi r5,r5,-8 | 1749 | addi r5,r5,-8 |
1730 | addi r6,r6,-8 | 1750 | addi r6,r6,-8 |
1731 | 4: li r0,16 /* Use the least common */ | 1751 | 4: li r0,8 /* Use the smallest common */ |
1732 | /* denominator cache line */ | 1752 | /* denominator cache line */ |
1733 | /* size. This results in */ | 1753 | /* size. This results in */ |
1734 | /* extra cache line flushes */ | 1754 | /* extra cache line flushes */ |
@@ -1782,7 +1802,7 @@ _GLOBAL(pmac_secondary_start) | |||
1782 | isync | 1802 | isync |
1783 | 1803 | ||
1784 | /* Copy some CPU settings from CPU 0 */ | 1804 | /* Copy some CPU settings from CPU 0 */ |
1785 | bl .__restore_cpu_setup | 1805 | bl .__restore_cpu_ppc970 |
1786 | 1806 | ||
1787 | /* pSeries do that early though I don't think we really need it */ | 1807 | /* pSeries do that early though I don't think we really need it */ |
1788 | mfmsr r3 | 1808 | mfmsr r3 |
@@ -1932,12 +1952,6 @@ _STATIC(start_here_multiplatform) | |||
1932 | mr r5,r26 | 1952 | mr r5,r26 |
1933 | bl .identify_cpu | 1953 | bl .identify_cpu |
1934 | 1954 | ||
1935 | /* Save some low level config HIDs of CPU0 to be copied to | ||
1936 | * other CPUs later on, or used for suspend/resume | ||
1937 | */ | ||
1938 | bl .__save_cpu_setup | ||
1939 | sync | ||
1940 | |||
1941 | /* Do very early kernel initializations, including initial hash table, | 1955 | /* Do very early kernel initializations, including initial hash table, |
1942 | * stab and slb setup before we turn on relocation. */ | 1956 | * stab and slb setup before we turn on relocation. */ |
1943 | 1957 | ||
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c index 68e5ab0443d2..124dbcba94a8 100644 --- a/arch/powerpc/kernel/ibmebus.c +++ b/arch/powerpc/kernel/ibmebus.c | |||
@@ -167,7 +167,7 @@ static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name, | |||
167 | NULL); | 167 | NULL); |
168 | 168 | ||
169 | static struct ibmebus_dev* __devinit ibmebus_register_device_common( | 169 | static struct ibmebus_dev* __devinit ibmebus_register_device_common( |
170 | struct ibmebus_dev *dev, char *name) | 170 | struct ibmebus_dev *dev, const char *name) |
171 | { | 171 | { |
172 | int err = 0; | 172 | int err = 0; |
173 | 173 | ||
@@ -194,10 +194,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node( | |||
194 | struct device_node *dn) | 194 | struct device_node *dn) |
195 | { | 195 | { |
196 | struct ibmebus_dev *dev; | 196 | struct ibmebus_dev *dev; |
197 | char *loc_code; | 197 | const char *loc_code; |
198 | int length; | 198 | int length; |
199 | 199 | ||
200 | loc_code = (char *)get_property(dn, "ibm,loc-code", NULL); | 200 | loc_code = get_property(dn, "ibm,loc-code", NULL); |
201 | if (!loc_code) { | 201 | if (!loc_code) { |
202 | printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n", | 202 | printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n", |
203 | __FUNCTION__, dn->name ? dn->name : "<unknown>"); | 203 | __FUNCTION__, dn->name ? dn->name : "<unknown>"); |
diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c new file mode 100644 index 000000000000..e98180686b35 --- /dev/null +++ b/arch/powerpc/kernel/io.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * I/O string operations | ||
3 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) | ||
4 | * Copyright (C) 2006 IBM Corporation | ||
5 | * | ||
6 | * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) | ||
7 | * and Paul Mackerras. | ||
8 | * | ||
9 | * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com) | ||
10 | * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) | ||
11 | * | ||
12 | * Rewritten in C by Stephen Rothwell. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version | ||
17 | * 2 of the License, or (at your option) any later version. | ||
18 | */ | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/compiler.h> | ||
22 | #include <linux/module.h> | ||
23 | |||
24 | #include <asm/io.h> | ||
25 | #include <asm/firmware.h> | ||
26 | #include <asm/bug.h> | ||
27 | |||
28 | void _insb(volatile u8 __iomem *port, void *buf, long count) | ||
29 | { | ||
30 | u8 *tbuf = buf; | ||
31 | u8 tmp; | ||
32 | |||
33 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
34 | |||
35 | if (unlikely(count <= 0)) | ||
36 | return; | ||
37 | asm volatile("sync"); | ||
38 | do { | ||
39 | tmp = *port; | ||
40 | asm volatile("eieio"); | ||
41 | *tbuf++ = tmp; | ||
42 | } while (--count != 0); | ||
43 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
44 | } | ||
45 | EXPORT_SYMBOL(_insb); | ||
46 | |||
47 | void _outsb(volatile u8 __iomem *port, const void *buf, long count) | ||
48 | { | ||
49 | const u8 *tbuf = buf; | ||
50 | |||
51 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
52 | |||
53 | if (unlikely(count <= 0)) | ||
54 | return; | ||
55 | asm volatile("sync"); | ||
56 | do { | ||
57 | *port = *tbuf++; | ||
58 | } while (--count != 0); | ||
59 | asm volatile("sync"); | ||
60 | } | ||
61 | EXPORT_SYMBOL(_outsb); | ||
62 | |||
63 | void _insw_ns(volatile u16 __iomem *port, void *buf, long count) | ||
64 | { | ||
65 | u16 *tbuf = buf; | ||
66 | u16 tmp; | ||
67 | |||
68 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
69 | |||
70 | if (unlikely(count <= 0)) | ||
71 | return; | ||
72 | asm volatile("sync"); | ||
73 | do { | ||
74 | tmp = *port; | ||
75 | asm volatile("eieio"); | ||
76 | *tbuf++ = tmp; | ||
77 | } while (--count != 0); | ||
78 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
79 | } | ||
80 | EXPORT_SYMBOL(_insw_ns); | ||
81 | |||
82 | void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count) | ||
83 | { | ||
84 | const u16 *tbuf = buf; | ||
85 | |||
86 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
87 | |||
88 | if (unlikely(count <= 0)) | ||
89 | return; | ||
90 | asm volatile("sync"); | ||
91 | do { | ||
92 | *port = *tbuf++; | ||
93 | } while (--count != 0); | ||
94 | asm volatile("sync"); | ||
95 | } | ||
96 | EXPORT_SYMBOL(_outsw_ns); | ||
97 | |||
98 | void _insl_ns(volatile u32 __iomem *port, void *buf, long count) | ||
99 | { | ||
100 | u32 *tbuf = buf; | ||
101 | u32 tmp; | ||
102 | |||
103 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
104 | |||
105 | if (unlikely(count <= 0)) | ||
106 | return; | ||
107 | asm volatile("sync"); | ||
108 | do { | ||
109 | tmp = *port; | ||
110 | asm volatile("eieio"); | ||
111 | *tbuf++ = tmp; | ||
112 | } while (--count != 0); | ||
113 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
114 | } | ||
115 | EXPORT_SYMBOL(_insl_ns); | ||
116 | |||
117 | void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count) | ||
118 | { | ||
119 | const u32 *tbuf = buf; | ||
120 | |||
121 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
122 | |||
123 | if (unlikely(count <= 0)) | ||
124 | return; | ||
125 | asm volatile("sync"); | ||
126 | do { | ||
127 | *port = *tbuf++; | ||
128 | } while (--count != 0); | ||
129 | asm volatile("sync"); | ||
130 | } | ||
131 | EXPORT_SYMBOL(_outsl_ns); | ||
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 12c5971d6565..b4432332341f 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/radix-tree.h> | 52 | #include <linux/radix-tree.h> |
53 | #include <linux/mutex.h> | 53 | #include <linux/mutex.h> |
54 | #include <linux/bootmem.h> | 54 | #include <linux/bootmem.h> |
55 | #include <linux/pci.h> | ||
55 | 56 | ||
56 | #include <asm/uaccess.h> | 57 | #include <asm/uaccess.h> |
57 | #include <asm/system.h> | 58 | #include <asm/system.h> |
@@ -875,12 +876,14 @@ int pci_enable_msi(struct pci_dev * pdev) | |||
875 | else | 876 | else |
876 | return -1; | 877 | return -1; |
877 | } | 878 | } |
879 | EXPORT_SYMBOL(pci_enable_msi); | ||
878 | 880 | ||
879 | void pci_disable_msi(struct pci_dev * pdev) | 881 | void pci_disable_msi(struct pci_dev * pdev) |
880 | { | 882 | { |
881 | if (ppc_md.disable_msi) | 883 | if (ppc_md.disable_msi) |
882 | ppc_md.disable_msi(pdev); | 884 | ppc_md.disable_msi(pdev); |
883 | } | 885 | } |
886 | EXPORT_SYMBOL(pci_disable_msi); | ||
884 | 887 | ||
885 | void pci_scan_msi_device(struct pci_dev *dev) {} | 888 | void pci_scan_msi_device(struct pci_dev *dev) {} |
886 | int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) {return -1;} | 889 | int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) {return -1;} |
@@ -888,6 +891,8 @@ void pci_disable_msix(struct pci_dev *dev) {} | |||
888 | void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} | 891 | void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} |
889 | void disable_msi_mode(struct pci_dev *dev, int pos, int type) {} | 892 | void disable_msi_mode(struct pci_dev *dev, int pos, int type) {} |
890 | void pci_no_msi(void) {} | 893 | void pci_no_msi(void) {} |
894 | EXPORT_SYMBOL(pci_enable_msix); | ||
895 | EXPORT_SYMBOL(pci_disable_msix); | ||
891 | 896 | ||
892 | #endif | 897 | #endif |
893 | 898 | ||
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index 40a39291861f..5e6ddfa474c0 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c | |||
@@ -39,16 +39,17 @@ static int __init add_legacy_port(struct device_node *np, int want_index, | |||
39 | phys_addr_t taddr, unsigned long irq, | 39 | phys_addr_t taddr, unsigned long irq, |
40 | upf_t flags, int irq_check_parent) | 40 | upf_t flags, int irq_check_parent) |
41 | { | 41 | { |
42 | u32 *clk, *spd, clock = BASE_BAUD * 16; | 42 | const u32 *clk, *spd; |
43 | u32 clock = BASE_BAUD * 16; | ||
43 | int index; | 44 | int index; |
44 | 45 | ||
45 | /* get clock freq. if present */ | 46 | /* get clock freq. if present */ |
46 | clk = (u32 *)get_property(np, "clock-frequency", NULL); | 47 | clk = get_property(np, "clock-frequency", NULL); |
47 | if (clk && *clk) | 48 | if (clk && *clk) |
48 | clock = *clk; | 49 | clock = *clk; |
49 | 50 | ||
50 | /* get default speed if present */ | 51 | /* get default speed if present */ |
51 | spd = (u32 *)get_property(np, "current-speed", NULL); | 52 | spd = get_property(np, "current-speed", NULL); |
52 | 53 | ||
53 | /* If we have a location index, then try to use it */ | 54 | /* If we have a location index, then try to use it */ |
54 | if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) | 55 | if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) |
@@ -113,7 +114,7 @@ static int __init add_legacy_soc_port(struct device_node *np, | |||
113 | struct device_node *soc_dev) | 114 | struct device_node *soc_dev) |
114 | { | 115 | { |
115 | u64 addr; | 116 | u64 addr; |
116 | u32 *addrp; | 117 | const u32 *addrp; |
117 | upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; | 118 | upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; |
118 | struct device_node *tsi = of_get_parent(np); | 119 | struct device_node *tsi = of_get_parent(np); |
119 | 120 | ||
@@ -144,15 +145,15 @@ static int __init add_legacy_soc_port(struct device_node *np, | |||
144 | static int __init add_legacy_isa_port(struct device_node *np, | 145 | static int __init add_legacy_isa_port(struct device_node *np, |
145 | struct device_node *isa_brg) | 146 | struct device_node *isa_brg) |
146 | { | 147 | { |
147 | u32 *reg; | 148 | const u32 *reg; |
148 | char *typep; | 149 | const char *typep; |
149 | int index = -1; | 150 | int index = -1; |
150 | u64 taddr; | 151 | u64 taddr; |
151 | 152 | ||
152 | DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); | 153 | DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); |
153 | 154 | ||
154 | /* Get the ISA port number */ | 155 | /* Get the ISA port number */ |
155 | reg = (u32 *)get_property(np, "reg", NULL); | 156 | reg = get_property(np, "reg", NULL); |
156 | if (reg == NULL) | 157 | if (reg == NULL) |
157 | return -1; | 158 | return -1; |
158 | 159 | ||
@@ -163,7 +164,7 @@ static int __init add_legacy_isa_port(struct device_node *np, | |||
163 | /* Now look for an "ibm,aix-loc" property that gives us ordering | 164 | /* Now look for an "ibm,aix-loc" property that gives us ordering |
164 | * if any... | 165 | * if any... |
165 | */ | 166 | */ |
166 | typep = (char *)get_property(np, "ibm,aix-loc", NULL); | 167 | typep = get_property(np, "ibm,aix-loc", NULL); |
167 | 168 | ||
168 | /* If we have a location index, then use it */ | 169 | /* If we have a location index, then use it */ |
169 | if (typep && *typep == 'S') | 170 | if (typep && *typep == 'S') |
@@ -188,7 +189,7 @@ static int __init add_legacy_pci_port(struct device_node *np, | |||
188 | struct device_node *pci_dev) | 189 | struct device_node *pci_dev) |
189 | { | 190 | { |
190 | u64 addr, base; | 191 | u64 addr, base; |
191 | u32 *addrp; | 192 | const u32 *addrp; |
192 | unsigned int flags; | 193 | unsigned int flags; |
193 | int iotype, index = -1, lindex = 0; | 194 | int iotype, index = -1, lindex = 0; |
194 | 195 | ||
@@ -227,7 +228,7 @@ static int __init add_legacy_pci_port(struct device_node *np, | |||
227 | * we get to their "reg" property | 228 | * we get to their "reg" property |
228 | */ | 229 | */ |
229 | if (np != pci_dev) { | 230 | if (np != pci_dev) { |
230 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 231 | const u32 *reg = get_property(np, "reg", NULL); |
231 | if (reg && (*reg < 4)) | 232 | if (reg && (*reg < 4)) |
232 | index = lindex = *reg; | 233 | index = lindex = *reg; |
233 | } | 234 | } |
@@ -285,13 +286,13 @@ static void __init setup_legacy_serial_console(int console) | |||
285 | void __init find_legacy_serial_ports(void) | 286 | void __init find_legacy_serial_ports(void) |
286 | { | 287 | { |
287 | struct device_node *np, *stdout = NULL; | 288 | struct device_node *np, *stdout = NULL; |
288 | char *path; | 289 | const char *path; |
289 | int index; | 290 | int index; |
290 | 291 | ||
291 | DBG(" -> find_legacy_serial_port()\n"); | 292 | DBG(" -> find_legacy_serial_port()\n"); |
292 | 293 | ||
293 | /* Now find out if one of these is out firmware console */ | 294 | /* Now find out if one of these is out firmware console */ |
294 | path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 295 | path = get_property(of_chosen, "linux,stdout-path", NULL); |
295 | if (path != NULL) { | 296 | if (path != NULL) { |
296 | stdout = of_find_node_by_path(path); | 297 | stdout = of_find_node_by_path(path); |
297 | if (stdout) | 298 | if (stdout) |
@@ -491,8 +492,8 @@ static int __init check_legacy_serial_console(void) | |||
491 | { | 492 | { |
492 | struct device_node *prom_stdout = NULL; | 493 | struct device_node *prom_stdout = NULL; |
493 | int speed = 0, offset = 0; | 494 | int speed = 0, offset = 0; |
494 | char *name; | 495 | const char *name; |
495 | u32 *spd; | 496 | const u32 *spd; |
496 | 497 | ||
497 | DBG(" -> check_legacy_serial_console()\n"); | 498 | DBG(" -> check_legacy_serial_console()\n"); |
498 | 499 | ||
@@ -513,7 +514,7 @@ static int __init check_legacy_serial_console(void) | |||
513 | } | 514 | } |
514 | /* We are getting a weird phandle from OF ... */ | 515 | /* We are getting a weird phandle from OF ... */ |
515 | /* ... So use the full path instead */ | 516 | /* ... So use the full path instead */ |
516 | name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 517 | name = get_property(of_chosen, "linux,stdout-path", NULL); |
517 | if (name == NULL) { | 518 | if (name == NULL) { |
518 | DBG(" no linux,stdout-path !\n"); | 519 | DBG(" no linux,stdout-path !\n"); |
519 | return -ENODEV; | 520 | return -ENODEV; |
@@ -525,12 +526,12 @@ static int __init check_legacy_serial_console(void) | |||
525 | } | 526 | } |
526 | DBG("stdout is %s\n", prom_stdout->full_name); | 527 | DBG("stdout is %s\n", prom_stdout->full_name); |
527 | 528 | ||
528 | name = (char *)get_property(prom_stdout, "name", NULL); | 529 | name = get_property(prom_stdout, "name", NULL); |
529 | if (!name) { | 530 | if (!name) { |
530 | DBG(" stdout package has no name !\n"); | 531 | DBG(" stdout package has no name !\n"); |
531 | goto not_found; | 532 | goto not_found; |
532 | } | 533 | } |
533 | spd = (u32 *)get_property(prom_stdout, "current-speed", NULL); | 534 | spd = get_property(prom_stdout, "current-speed", NULL); |
534 | if (spd) | 535 | if (spd) |
535 | speed = *spd; | 536 | speed = *spd; |
536 | 537 | ||
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index 23f34daa044a..41c05dcd68f4 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <asm/rtas.h> | 32 | #include <asm/rtas.h> |
33 | #include <asm/system.h> | 33 | #include <asm/system.h> |
34 | #include <asm/time.h> | 34 | #include <asm/time.h> |
35 | #include <asm/iseries/it_exp_vpd_panel.h> | ||
36 | #include <asm/prom.h> | 35 | #include <asm/prom.h> |
37 | #include <asm/vdso_datapage.h> | 36 | #include <asm/vdso_datapage.h> |
38 | 37 | ||
@@ -183,8 +182,14 @@ static unsigned int h_get_ppp(unsigned long *entitled, | |||
183 | unsigned long *resource) | 182 | unsigned long *resource) |
184 | { | 183 | { |
185 | unsigned long rc; | 184 | unsigned long rc; |
186 | rc = plpar_hcall_4out(H_GET_PPP, 0, 0, 0, 0, entitled, unallocated, | 185 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
187 | aggregation, resource); | 186 | |
187 | rc = plpar_hcall(H_GET_PPP, retbuf); | ||
188 | |||
189 | *entitled = retbuf[0]; | ||
190 | *unallocated = retbuf[1]; | ||
191 | *aggregation = retbuf[2]; | ||
192 | *resource = retbuf[3]; | ||
188 | 193 | ||
189 | log_plpar_hcall_return(rc, "H_GET_PPP"); | 194 | log_plpar_hcall_return(rc, "H_GET_PPP"); |
190 | 195 | ||
@@ -194,8 +199,12 @@ static unsigned int h_get_ppp(unsigned long *entitled, | |||
194 | static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs) | 199 | static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs) |
195 | { | 200 | { |
196 | unsigned long rc; | 201 | unsigned long rc; |
197 | unsigned long dummy; | 202 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
198 | rc = plpar_hcall(H_PIC, 0, 0, 0, 0, pool_idle_time, num_procs, &dummy); | 203 | |
204 | rc = plpar_hcall(H_PIC, retbuf); | ||
205 | |||
206 | *pool_idle_time = retbuf[0]; | ||
207 | *num_procs = retbuf[1]; | ||
199 | 208 | ||
200 | if (rc != H_AUTHORITY) | 209 | if (rc != H_AUTHORITY) |
201 | log_plpar_hcall_return(rc, "H_PIC"); | 210 | log_plpar_hcall_return(rc, "H_PIC"); |
@@ -310,12 +319,11 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) | |||
310 | int partition_potential_processors; | 319 | int partition_potential_processors; |
311 | int partition_active_processors; | 320 | int partition_active_processors; |
312 | struct device_node *rtas_node; | 321 | struct device_node *rtas_node; |
313 | int *lrdrp = NULL; | 322 | const int *lrdrp = NULL; |
314 | 323 | ||
315 | rtas_node = find_path_device("/rtas"); | 324 | rtas_node = find_path_device("/rtas"); |
316 | if (rtas_node) | 325 | if (rtas_node) |
317 | lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", | 326 | lrdrp = get_property(rtas_node, "ibm,lrdr-capacity", NULL); |
318 | NULL); | ||
319 | 327 | ||
320 | if (lrdrp == NULL) { | 328 | if (lrdrp == NULL) { |
321 | partition_potential_processors = vdso_data->processorCount; | 329 | partition_potential_processors = vdso_data->processorCount; |
@@ -520,7 +528,8 @@ static int lparcfg_data(struct seq_file *m, void *v) | |||
520 | const char *model = ""; | 528 | const char *model = ""; |
521 | const char *system_id = ""; | 529 | const char *system_id = ""; |
522 | const char *tmp; | 530 | const char *tmp; |
523 | unsigned int *lp_index_ptr, lp_index = 0; | 531 | const unsigned int *lp_index_ptr; |
532 | unsigned int lp_index = 0; | ||
524 | 533 | ||
525 | seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); | 534 | seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); |
526 | 535 | ||
@@ -540,8 +549,7 @@ static int lparcfg_data(struct seq_file *m, void *v) | |||
540 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | 549 | if (firmware_has_feature(FW_FEATURE_ISERIES)) |
541 | system_id += 4; | 550 | system_id += 4; |
542 | } | 551 | } |
543 | lp_index_ptr = (unsigned int *) | 552 | lp_index_ptr = get_property(rootdn, "ibm,partition-no", NULL); |
544 | get_property(rootdn, "ibm,partition-no", NULL); | ||
545 | if (lp_index_ptr) | 553 | if (lp_index_ptr) |
546 | lp_index = *lp_index_ptr; | 554 | lp_index = *lp_index_ptr; |
547 | } | 555 | } |
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index be58985c7681..a24b09c27718 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c | |||
@@ -31,8 +31,8 @@ int default_machine_kexec_prepare(struct kimage *image) | |||
31 | unsigned long begin, end; /* limits of segment */ | 31 | unsigned long begin, end; /* limits of segment */ |
32 | unsigned long low, high; /* limits of blocked memory range */ | 32 | unsigned long low, high; /* limits of blocked memory range */ |
33 | struct device_node *node; | 33 | struct device_node *node; |
34 | unsigned long *basep; | 34 | const unsigned long *basep; |
35 | unsigned int *sizep; | 35 | const unsigned int *sizep; |
36 | 36 | ||
37 | if (!ppc_md.hpte_clear_all) | 37 | if (!ppc_md.hpte_clear_all) |
38 | return -ENOENT; | 38 | return -ENOENT; |
@@ -72,10 +72,8 @@ int default_machine_kexec_prepare(struct kimage *image) | |||
72 | /* We also should not overwrite the tce tables */ | 72 | /* We also should not overwrite the tce tables */ |
73 | for (node = of_find_node_by_type(NULL, "pci"); node != NULL; | 73 | for (node = of_find_node_by_type(NULL, "pci"); node != NULL; |
74 | node = of_find_node_by_type(node, "pci")) { | 74 | node = of_find_node_by_type(node, "pci")) { |
75 | basep = (unsigned long *)get_property(node, "linux,tce-base", | 75 | basep = get_property(node, "linux,tce-base", NULL); |
76 | NULL); | 76 | sizep = get_property(node, "linux,tce-size", NULL); |
77 | sizep = (unsigned int *)get_property(node, "linux,tce-size", | ||
78 | NULL); | ||
79 | if (basep == NULL || sizep == NULL) | 77 | if (basep == NULL || sizep == NULL) |
80 | continue; | 78 | continue; |
81 | 79 | ||
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S index f770805f1215..330c9dc7db86 100644 --- a/arch/powerpc/kernel/misc.S +++ b/arch/powerpc/kernel/misc.S | |||
@@ -43,162 +43,3 @@ _GLOBAL(add_reloc_offset) | |||
43 | add r3,r3,r5 | 43 | add r3,r3,r5 |
44 | mtlr r0 | 44 | mtlr r0 |
45 | blr | 45 | blr |
46 | |||
47 | /* | ||
48 | * I/O string operations | ||
49 | * | ||
50 | * insb(port, buf, len) | ||
51 | * outsb(port, buf, len) | ||
52 | * insw(port, buf, len) | ||
53 | * outsw(port, buf, len) | ||
54 | * insl(port, buf, len) | ||
55 | * outsl(port, buf, len) | ||
56 | * insw_ns(port, buf, len) | ||
57 | * outsw_ns(port, buf, len) | ||
58 | * insl_ns(port, buf, len) | ||
59 | * outsl_ns(port, buf, len) | ||
60 | * | ||
61 | * The *_ns versions don't do byte-swapping. | ||
62 | */ | ||
63 | _GLOBAL(_insb) | ||
64 | sync | ||
65 | cmpwi 0,r5,0 | ||
66 | mtctr r5 | ||
67 | subi r4,r4,1 | ||
68 | blelr- | ||
69 | 00: lbz r5,0(r3) | ||
70 | eieio | ||
71 | stbu r5,1(r4) | ||
72 | bdnz 00b | ||
73 | twi 0,r5,0 | ||
74 | isync | ||
75 | blr | ||
76 | |||
77 | _GLOBAL(_outsb) | ||
78 | cmpwi 0,r5,0 | ||
79 | mtctr r5 | ||
80 | subi r4,r4,1 | ||
81 | blelr- | ||
82 | sync | ||
83 | 00: lbzu r5,1(r4) | ||
84 | stb r5,0(r3) | ||
85 | bdnz 00b | ||
86 | sync | ||
87 | blr | ||
88 | |||
89 | _GLOBAL(_insw) | ||
90 | sync | ||
91 | cmpwi 0,r5,0 | ||
92 | mtctr r5 | ||
93 | subi r4,r4,2 | ||
94 | blelr- | ||
95 | 00: lhbrx r5,0,r3 | ||
96 | eieio | ||
97 | sthu r5,2(r4) | ||
98 | bdnz 00b | ||
99 | twi 0,r5,0 | ||
100 | isync | ||
101 | blr | ||
102 | |||
103 | _GLOBAL(_outsw) | ||
104 | cmpwi 0,r5,0 | ||
105 | mtctr r5 | ||
106 | subi r4,r4,2 | ||
107 | blelr- | ||
108 | sync | ||
109 | 00: lhzu r5,2(r4) | ||
110 | sthbrx r5,0,r3 | ||
111 | bdnz 00b | ||
112 | sync | ||
113 | blr | ||
114 | |||
115 | _GLOBAL(_insl) | ||
116 | sync | ||
117 | cmpwi 0,r5,0 | ||
118 | mtctr r5 | ||
119 | subi r4,r4,4 | ||
120 | blelr- | ||
121 | 00: lwbrx r5,0,r3 | ||
122 | eieio | ||
123 | stwu r5,4(r4) | ||
124 | bdnz 00b | ||
125 | twi 0,r5,0 | ||
126 | isync | ||
127 | blr | ||
128 | |||
129 | _GLOBAL(_outsl) | ||
130 | cmpwi 0,r5,0 | ||
131 | mtctr r5 | ||
132 | subi r4,r4,4 | ||
133 | blelr- | ||
134 | sync | ||
135 | 00: lwzu r5,4(r4) | ||
136 | stwbrx r5,0,r3 | ||
137 | bdnz 00b | ||
138 | sync | ||
139 | blr | ||
140 | |||
141 | #ifdef CONFIG_PPC32 | ||
142 | _GLOBAL(__ide_mm_insw) | ||
143 | #endif | ||
144 | _GLOBAL(_insw_ns) | ||
145 | sync | ||
146 | cmpwi 0,r5,0 | ||
147 | mtctr r5 | ||
148 | subi r4,r4,2 | ||
149 | blelr- | ||
150 | 00: lhz r5,0(r3) | ||
151 | eieio | ||
152 | sthu r5,2(r4) | ||
153 | bdnz 00b | ||
154 | twi 0,r5,0 | ||
155 | isync | ||
156 | blr | ||
157 | |||
158 | #ifdef CONFIG_PPC32 | ||
159 | _GLOBAL(__ide_mm_outsw) | ||
160 | #endif | ||
161 | _GLOBAL(_outsw_ns) | ||
162 | cmpwi 0,r5,0 | ||
163 | mtctr r5 | ||
164 | subi r4,r4,2 | ||
165 | blelr- | ||
166 | sync | ||
167 | 00: lhzu r5,2(r4) | ||
168 | sth r5,0(r3) | ||
169 | bdnz 00b | ||
170 | sync | ||
171 | blr | ||
172 | |||
173 | #ifdef CONFIG_PPC32 | ||
174 | _GLOBAL(__ide_mm_insl) | ||
175 | #endif | ||
176 | _GLOBAL(_insl_ns) | ||
177 | sync | ||
178 | cmpwi 0,r5,0 | ||
179 | mtctr r5 | ||
180 | subi r4,r4,4 | ||
181 | blelr- | ||
182 | 00: lwz r5,0(r3) | ||
183 | eieio | ||
184 | stwu r5,4(r4) | ||
185 | bdnz 00b | ||
186 | twi 0,r5,0 | ||
187 | isync | ||
188 | blr | ||
189 | |||
190 | #ifdef CONFIG_PPC32 | ||
191 | _GLOBAL(__ide_mm_outsl) | ||
192 | #endif | ||
193 | _GLOBAL(_outsl_ns) | ||
194 | cmpwi 0,r5,0 | ||
195 | mtctr r5 | ||
196 | subi r4,r4,4 | ||
197 | blelr- | ||
198 | sync | ||
199 | 00: lwzu r5,4(r4) | ||
200 | stw r5,0(r3) | ||
201 | bdnz 00b | ||
202 | sync | ||
203 | blr | ||
204 | |||
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c index 3262b73a3a68..397c83eda20e 100644 --- a/arch/powerpc/kernel/of_device.c +++ b/arch/powerpc/kernel/of_device.c | |||
@@ -189,27 +189,9 @@ void of_release_dev(struct device *dev) | |||
189 | int of_device_register(struct of_device *ofdev) | 189 | int of_device_register(struct of_device *ofdev) |
190 | { | 190 | { |
191 | int rc; | 191 | int rc; |
192 | struct of_device **odprop; | ||
193 | 192 | ||
194 | BUG_ON(ofdev->node == NULL); | 193 | BUG_ON(ofdev->node == NULL); |
195 | 194 | ||
196 | odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL); | ||
197 | if (!odprop) { | ||
198 | struct property *new_prop; | ||
199 | |||
200 | new_prop = kmalloc(sizeof(struct property) + sizeof(struct of_device *), | ||
201 | GFP_KERNEL); | ||
202 | if (new_prop == NULL) | ||
203 | return -ENOMEM; | ||
204 | new_prop->name = "linux,device"; | ||
205 | new_prop->length = sizeof(sizeof(struct of_device *)); | ||
206 | new_prop->value = (unsigned char *)&new_prop[1]; | ||
207 | odprop = (struct of_device **)new_prop->value; | ||
208 | *odprop = NULL; | ||
209 | prom_add_property(ofdev->node, new_prop); | ||
210 | } | ||
211 | *odprop = ofdev; | ||
212 | |||
213 | rc = device_register(&ofdev->dev); | 195 | rc = device_register(&ofdev->dev); |
214 | if (rc) | 196 | if (rc) |
215 | return rc; | 197 | return rc; |
@@ -221,14 +203,8 @@ int of_device_register(struct of_device *ofdev) | |||
221 | 203 | ||
222 | void of_device_unregister(struct of_device *ofdev) | 204 | void of_device_unregister(struct of_device *ofdev) |
223 | { | 205 | { |
224 | struct of_device **odprop; | ||
225 | |||
226 | device_remove_file(&ofdev->dev, &dev_attr_devspec); | 206 | device_remove_file(&ofdev->dev, &dev_attr_devspec); |
227 | 207 | ||
228 | odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL); | ||
229 | if (odprop) | ||
230 | *odprop = NULL; | ||
231 | |||
232 | device_unregister(&ofdev->dev); | 208 | device_unregister(&ofdev->dev); |
233 | } | 209 | } |
234 | 210 | ||
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index c68741fed14b..55f1a25085cd 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/lppaca.h> | 17 | #include <asm/lppaca.h> |
18 | #include <asm/iseries/it_lp_reg_save.h> | 18 | #include <asm/iseries/it_lp_reg_save.h> |
19 | #include <asm/paca.h> | 19 | #include <asm/paca.h> |
20 | #include <asm/mmu.h> | ||
20 | 21 | ||
21 | 22 | ||
22 | /* This symbol is provided by the linker - let it fill in the paca | 23 | /* This symbol is provided by the linker - let it fill in the paca |
@@ -45,6 +46,17 @@ struct lppaca lppaca[] = { | |||
45 | }, | 46 | }, |
46 | }; | 47 | }; |
47 | 48 | ||
49 | /* | ||
50 | * 3 persistent SLBs are registered here. The buffer will be zero | ||
51 | * initially, hence will all be invaild until we actually write them. | ||
52 | */ | ||
53 | struct slb_shadow slb_shadow[] __cacheline_aligned = { | ||
54 | [0 ... (NR_CPUS-1)] = { | ||
55 | .persistent = SLB_NUM_BOLTED, | ||
56 | .buffer_length = sizeof(struct slb_shadow), | ||
57 | }, | ||
58 | }; | ||
59 | |||
48 | /* The Paca is an array with one entry per processor. Each contains an | 60 | /* The Paca is an array with one entry per processor. Each contains an |
49 | * lppaca, which contains the information shared between the | 61 | * lppaca, which contains the information shared between the |
50 | * hypervisor and Linux. | 62 | * hypervisor and Linux. |
@@ -59,7 +71,8 @@ struct lppaca lppaca[] = { | |||
59 | .lock_token = 0x8000, \ | 71 | .lock_token = 0x8000, \ |
60 | .paca_index = (number), /* Paca Index */ \ | 72 | .paca_index = (number), /* Paca Index */ \ |
61 | .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ | 73 | .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ |
62 | .hw_cpu_id = 0xffff, | 74 | .hw_cpu_id = 0xffff, \ |
75 | .slb_shadow_ptr = &slb_shadow[number], | ||
63 | 76 | ||
64 | #ifdef CONFIG_PPC_ISERIES | 77 | #ifdef CONFIG_PPC_ISERIES |
65 | #define PACA_INIT_ISERIES(number) \ | 78 | #define PACA_INIT_ISERIES(number) \ |
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 09b1e1bbb29b..9b49f8691d29 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c | |||
@@ -633,12 +633,12 @@ pcibios_alloc_controller(void) | |||
633 | static void | 633 | static void |
634 | make_one_node_map(struct device_node* node, u8 pci_bus) | 634 | make_one_node_map(struct device_node* node, u8 pci_bus) |
635 | { | 635 | { |
636 | int *bus_range; | 636 | const int *bus_range; |
637 | int len; | 637 | int len; |
638 | 638 | ||
639 | if (pci_bus >= pci_bus_count) | 639 | if (pci_bus >= pci_bus_count) |
640 | return; | 640 | return; |
641 | bus_range = (int *) get_property(node, "bus-range", &len); | 641 | bus_range = get_property(node, "bus-range", &len); |
642 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 642 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
643 | printk(KERN_WARNING "Can't get bus-range for %s, " | 643 | printk(KERN_WARNING "Can't get bus-range for %s, " |
644 | "assuming it starts at 0\n", node->full_name); | 644 | "assuming it starts at 0\n", node->full_name); |
@@ -648,13 +648,13 @@ make_one_node_map(struct device_node* node, u8 pci_bus) | |||
648 | 648 | ||
649 | for (node=node->child; node != 0;node = node->sibling) { | 649 | for (node=node->child; node != 0;node = node->sibling) { |
650 | struct pci_dev* dev; | 650 | struct pci_dev* dev; |
651 | unsigned int *class_code, *reg; | 651 | const unsigned int *class_code, *reg; |
652 | 652 | ||
653 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 653 | class_code = get_property(node, "class-code", NULL); |
654 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 654 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
655 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | 655 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) |
656 | continue; | 656 | continue; |
657 | reg = (unsigned int *)get_property(node, "reg", NULL); | 657 | reg = get_property(node, "reg", NULL); |
658 | if (!reg) | 658 | if (!reg) |
659 | continue; | 659 | continue; |
660 | dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); | 660 | dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); |
@@ -669,7 +669,7 @@ pcibios_make_OF_bus_map(void) | |||
669 | { | 669 | { |
670 | int i; | 670 | int i; |
671 | struct pci_controller* hose; | 671 | struct pci_controller* hose; |
672 | u8* of_prop_map; | 672 | struct property *map_prop; |
673 | 673 | ||
674 | pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); | 674 | pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); |
675 | if (!pci_to_OF_bus_map) { | 675 | if (!pci_to_OF_bus_map) { |
@@ -691,9 +691,12 @@ pcibios_make_OF_bus_map(void) | |||
691 | continue; | 691 | continue; |
692 | make_one_node_map(node, hose->first_busno); | 692 | make_one_node_map(node, hose->first_busno); |
693 | } | 693 | } |
694 | of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL); | 694 | map_prop = of_find_property(find_path_device("/"), |
695 | if (of_prop_map) | 695 | "pci-OF-bus-map", NULL); |
696 | memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count); | 696 | if (map_prop) { |
697 | BUG_ON(pci_bus_count > map_prop->length); | ||
698 | memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count); | ||
699 | } | ||
697 | #ifdef DEBUG | 700 | #ifdef DEBUG |
698 | printk("PCI->OF bus map:\n"); | 701 | printk("PCI->OF bus map:\n"); |
699 | for (i=0; i<pci_bus_count; i++) { | 702 | for (i=0; i<pci_bus_count; i++) { |
@@ -712,7 +715,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
712 | struct device_node* sub_node; | 715 | struct device_node* sub_node; |
713 | 716 | ||
714 | for (; node != 0;node = node->sibling) { | 717 | for (; node != 0;node = node->sibling) { |
715 | unsigned int *class_code; | 718 | const unsigned int *class_code; |
716 | 719 | ||
717 | if (filter(node, data)) | 720 | if (filter(node, data)) |
718 | return node; | 721 | return node; |
@@ -722,7 +725,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
722 | * a fake root for all functions of a multi-function device, | 725 | * a fake root for all functions of a multi-function device, |
723 | * we go down them as well. | 726 | * we go down them as well. |
724 | */ | 727 | */ |
725 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 728 | class_code = get_property(node, "class-code", NULL); |
726 | if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 729 | if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
727 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && | 730 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && |
728 | strcmp(node->name, "multifunc-device")) | 731 | strcmp(node->name, "multifunc-device")) |
@@ -737,10 +740,10 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
737 | static int | 740 | static int |
738 | scan_OF_pci_childs_iterator(struct device_node* node, void* data) | 741 | scan_OF_pci_childs_iterator(struct device_node* node, void* data) |
739 | { | 742 | { |
740 | unsigned int *reg; | 743 | const unsigned int *reg; |
741 | u8* fdata = (u8*)data; | 744 | u8* fdata = (u8*)data; |
742 | 745 | ||
743 | reg = (unsigned int *) get_property(node, "reg", NULL); | 746 | reg = get_property(node, "reg", NULL); |
744 | if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] | 747 | if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] |
745 | && ((reg[0] >> 16) & 0xff) == fdata[0]) | 748 | && ((reg[0] >> 16) & 0xff) == fdata[0]) |
746 | return 1; | 749 | return 1; |
@@ -841,7 +844,7 @@ find_OF_pci_device_filter(struct device_node* node, void* data) | |||
841 | int | 844 | int |
842 | pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) | 845 | pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) |
843 | { | 846 | { |
844 | unsigned int *reg; | 847 | const unsigned int *reg; |
845 | struct pci_controller* hose; | 848 | struct pci_controller* hose; |
846 | struct pci_dev* dev = NULL; | 849 | struct pci_dev* dev = NULL; |
847 | 850 | ||
@@ -854,7 +857,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) | |||
854 | if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, | 857 | if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, |
855 | find_OF_pci_device_filter, (void *)node)) | 858 | find_OF_pci_device_filter, (void *)node)) |
856 | return -ENODEV; | 859 | return -ENODEV; |
857 | reg = (unsigned int *) get_property(node, "reg", NULL); | 860 | reg = get_property(node, "reg", NULL); |
858 | if (!reg) | 861 | if (!reg) |
859 | return -ENODEV; | 862 | return -ENODEV; |
860 | *bus = (reg[0] >> 16) & 0xff; | 863 | *bus = (reg[0] >> 16) & 0xff; |
@@ -885,8 +888,8 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
885 | struct device_node *dev, int primary) | 888 | struct device_node *dev, int primary) |
886 | { | 889 | { |
887 | static unsigned int static_lc_ranges[256] __initdata; | 890 | static unsigned int static_lc_ranges[256] __initdata; |
888 | unsigned int *dt_ranges, *lc_ranges, *ranges, *prev; | 891 | const unsigned int *dt_ranges; |
889 | unsigned int size; | 892 | unsigned int *lc_ranges, *ranges, *prev, size; |
890 | int rlen = 0, orig_rlen; | 893 | int rlen = 0, orig_rlen; |
891 | int memno = 0; | 894 | int memno = 0; |
892 | struct resource *res; | 895 | struct resource *res; |
@@ -897,7 +900,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
897 | * that can have more than 3 ranges, fortunately using contiguous | 900 | * that can have more than 3 ranges, fortunately using contiguous |
898 | * addresses -- BenH | 901 | * addresses -- BenH |
899 | */ | 902 | */ |
900 | dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen); | 903 | dt_ranges = get_property(dev, "ranges", &rlen); |
901 | if (!dt_ranges) | 904 | if (!dt_ranges) |
902 | return; | 905 | return; |
903 | /* Sanity check, though hopefully that never happens */ | 906 | /* Sanity check, though hopefully that never happens */ |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 138134c8c17d..c1b1e14775e4 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -185,34 +185,6 @@ static void __devinit pci_setup_pci_controller(struct pci_controller *hose) | |||
185 | spin_unlock(&hose_spinlock); | 185 | spin_unlock(&hose_spinlock); |
186 | } | 186 | } |
187 | 187 | ||
188 | static void add_linux_pci_domain(struct device_node *dev, | ||
189 | struct pci_controller *phb) | ||
190 | { | ||
191 | struct property *of_prop; | ||
192 | unsigned int size; | ||
193 | |||
194 | of_prop = (struct property *) | ||
195 | get_property(dev, "linux,pci-domain", &size); | ||
196 | if (of_prop != NULL) | ||
197 | return; | ||
198 | WARN_ON(of_prop && size < sizeof(int)); | ||
199 | if (of_prop && size < sizeof(int)) | ||
200 | of_prop = NULL; | ||
201 | size = sizeof(struct property) + sizeof(int); | ||
202 | if (of_prop == NULL) { | ||
203 | if (mem_init_done) | ||
204 | of_prop = kmalloc(size, GFP_KERNEL); | ||
205 | else | ||
206 | of_prop = alloc_bootmem(size); | ||
207 | } | ||
208 | memset(of_prop, 0, sizeof(struct property)); | ||
209 | of_prop->name = "linux,pci-domain"; | ||
210 | of_prop->length = sizeof(int); | ||
211 | of_prop->value = (unsigned char *)&of_prop[1]; | ||
212 | *((int *)of_prop->value) = phb->global_number; | ||
213 | prom_add_property(dev, of_prop); | ||
214 | } | ||
215 | |||
216 | struct pci_controller * pcibios_alloc_controller(struct device_node *dev) | 188 | struct pci_controller * pcibios_alloc_controller(struct device_node *dev) |
217 | { | 189 | { |
218 | struct pci_controller *phb; | 190 | struct pci_controller *phb; |
@@ -226,22 +198,13 @@ struct pci_controller * pcibios_alloc_controller(struct device_node *dev) | |||
226 | pci_setup_pci_controller(phb); | 198 | pci_setup_pci_controller(phb); |
227 | phb->arch_data = dev; | 199 | phb->arch_data = dev; |
228 | phb->is_dynamic = mem_init_done; | 200 | phb->is_dynamic = mem_init_done; |
229 | if (dev) { | 201 | if (dev) |
230 | PHB_SET_NODE(phb, of_node_to_nid(dev)); | 202 | PHB_SET_NODE(phb, of_node_to_nid(dev)); |
231 | add_linux_pci_domain(dev, phb); | ||
232 | } | ||
233 | return phb; | 203 | return phb; |
234 | } | 204 | } |
235 | 205 | ||
236 | void pcibios_free_controller(struct pci_controller *phb) | 206 | void pcibios_free_controller(struct pci_controller *phb) |
237 | { | 207 | { |
238 | if (phb->arch_data) { | ||
239 | struct device_node *np = phb->arch_data; | ||
240 | int *domain = (int *)get_property(np, | ||
241 | "linux,pci-domain", NULL); | ||
242 | if (domain) | ||
243 | *domain = -1; | ||
244 | } | ||
245 | if (phb->is_dynamic) | 208 | if (phb->is_dynamic) |
246 | kfree(phb); | 209 | kfree(phb); |
247 | } | 210 | } |
@@ -283,10 +246,10 @@ static void __init pcibios_claim_of_setup(void) | |||
283 | #ifdef CONFIG_PPC_MULTIPLATFORM | 246 | #ifdef CONFIG_PPC_MULTIPLATFORM |
284 | static u32 get_int_prop(struct device_node *np, const char *name, u32 def) | 247 | static u32 get_int_prop(struct device_node *np, const char *name, u32 def) |
285 | { | 248 | { |
286 | u32 *prop; | 249 | const u32 *prop; |
287 | int len; | 250 | int len; |
288 | 251 | ||
289 | prop = (u32 *) get_property(np, name, &len); | 252 | prop = get_property(np, name, &len); |
290 | if (prop && len >= 4) | 253 | if (prop && len >= 4) |
291 | return *prop; | 254 | return *prop; |
292 | return def; | 255 | return def; |
@@ -315,10 +278,11 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev) | |||
315 | u64 base, size; | 278 | u64 base, size; |
316 | unsigned int flags; | 279 | unsigned int flags; |
317 | struct resource *res; | 280 | struct resource *res; |
318 | u32 *addrs, i; | 281 | const u32 *addrs; |
282 | u32 i; | ||
319 | int proplen; | 283 | int proplen; |
320 | 284 | ||
321 | addrs = (u32 *) get_property(node, "assigned-addresses", &proplen); | 285 | addrs = get_property(node, "assigned-addresses", &proplen); |
322 | if (!addrs) | 286 | if (!addrs) |
323 | return; | 287 | return; |
324 | DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); | 288 | DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); |
@@ -418,7 +382,7 @@ void __devinit of_scan_bus(struct device_node *node, | |||
418 | struct pci_bus *bus) | 382 | struct pci_bus *bus) |
419 | { | 383 | { |
420 | struct device_node *child = NULL; | 384 | struct device_node *child = NULL; |
421 | u32 *reg; | 385 | const u32 *reg; |
422 | int reglen, devfn; | 386 | int reglen, devfn; |
423 | struct pci_dev *dev; | 387 | struct pci_dev *dev; |
424 | 388 | ||
@@ -426,7 +390,7 @@ void __devinit of_scan_bus(struct device_node *node, | |||
426 | 390 | ||
427 | while ((child = of_get_next_child(node, child)) != NULL) { | 391 | while ((child = of_get_next_child(node, child)) != NULL) { |
428 | DBG(" * %s\n", child->full_name); | 392 | DBG(" * %s\n", child->full_name); |
429 | reg = (u32 *) get_property(child, "reg", ®len); | 393 | reg = get_property(child, "reg", ®len); |
430 | if (reg == NULL || reglen < 20) | 394 | if (reg == NULL || reglen < 20) |
431 | continue; | 395 | continue; |
432 | devfn = (reg[0] >> 8) & 0xff; | 396 | devfn = (reg[0] >> 8) & 0xff; |
@@ -450,7 +414,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node, | |||
450 | struct pci_dev *dev) | 414 | struct pci_dev *dev) |
451 | { | 415 | { |
452 | struct pci_bus *bus; | 416 | struct pci_bus *bus; |
453 | u32 *busrange, *ranges; | 417 | const u32 *busrange, *ranges; |
454 | int len, i, mode; | 418 | int len, i, mode; |
455 | struct resource *res; | 419 | struct resource *res; |
456 | unsigned int flags; | 420 | unsigned int flags; |
@@ -459,13 +423,13 @@ void __devinit of_scan_pci_bridge(struct device_node *node, | |||
459 | DBG("of_scan_pci_bridge(%s)\n", node->full_name); | 423 | DBG("of_scan_pci_bridge(%s)\n", node->full_name); |
460 | 424 | ||
461 | /* parse bus-range property */ | 425 | /* parse bus-range property */ |
462 | busrange = (u32 *) get_property(node, "bus-range", &len); | 426 | busrange = get_property(node, "bus-range", &len); |
463 | if (busrange == NULL || len != 8) { | 427 | if (busrange == NULL || len != 8) { |
464 | printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", | 428 | printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", |
465 | node->full_name); | 429 | node->full_name); |
466 | return; | 430 | return; |
467 | } | 431 | } |
468 | ranges = (u32 *) get_property(node, "ranges", &len); | 432 | ranges = get_property(node, "ranges", &len); |
469 | if (ranges == NULL) { | 433 | if (ranges == NULL) { |
470 | printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n", | 434 | printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n", |
471 | node->full_name); | 435 | node->full_name); |
@@ -929,13 +893,13 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, | |||
929 | unsigned int size; | 893 | unsigned int size; |
930 | }; | 894 | }; |
931 | 895 | ||
932 | struct isa_range *range; | 896 | const struct isa_range *range; |
933 | unsigned long pci_addr; | 897 | unsigned long pci_addr; |
934 | unsigned int isa_addr; | 898 | unsigned int isa_addr; |
935 | unsigned int size; | 899 | unsigned int size; |
936 | int rlen = 0; | 900 | int rlen = 0; |
937 | 901 | ||
938 | range = (struct isa_range *) get_property(isa_node, "ranges", &rlen); | 902 | range = get_property(isa_node, "ranges", &rlen); |
939 | if (range == NULL || (rlen < sizeof(struct isa_range))) { | 903 | if (range == NULL || (rlen < sizeof(struct isa_range))) { |
940 | printk(KERN_ERR "no ISA ranges or unexpected isa range size," | 904 | printk(KERN_ERR "no ISA ranges or unexpected isa range size," |
941 | "mapping 64k\n"); | 905 | "mapping 64k\n"); |
@@ -976,7 +940,8 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, | |||
976 | void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, | 940 | void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, |
977 | struct device_node *dev, int prim) | 941 | struct device_node *dev, int prim) |
978 | { | 942 | { |
979 | unsigned int *ranges, pci_space; | 943 | const unsigned int *ranges; |
944 | unsigned int pci_space; | ||
980 | unsigned long size; | 945 | unsigned long size; |
981 | int rlen = 0; | 946 | int rlen = 0; |
982 | int memno = 0; | 947 | int memno = 0; |
@@ -994,7 +959,7 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
994 | * (size depending on dev->n_addr_cells) | 959 | * (size depending on dev->n_addr_cells) |
995 | * cells 4+5 or 5+6: the size of the range | 960 | * cells 4+5 or 5+6: the size of the range |
996 | */ | 961 | */ |
997 | ranges = (unsigned int *) get_property(dev, "ranges", &rlen); | 962 | ranges = get_property(dev, "ranges", &rlen); |
998 | if (ranges == NULL) | 963 | if (ranges == NULL) |
999 | return; | 964 | return; |
1000 | hose->io_base_phys = 0; | 965 | hose->io_base_phys = 0; |
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index 1c18953514c3..68df018dae0e 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c | |||
@@ -40,8 +40,8 @@ | |||
40 | static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) | 40 | static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) |
41 | { | 41 | { |
42 | struct pci_controller *phb = data; | 42 | struct pci_controller *phb = data; |
43 | int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL); | 43 | const int *type = get_property(dn, "ibm,pci-config-space-type", NULL); |
44 | u32 *regs; | 44 | const u32 *regs; |
45 | struct pci_dn *pdn; | 45 | struct pci_dn *pdn; |
46 | 46 | ||
47 | if (mem_init_done) | 47 | if (mem_init_done) |
@@ -54,14 +54,14 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) | |||
54 | dn->data = pdn; | 54 | dn->data = pdn; |
55 | pdn->node = dn; | 55 | pdn->node = dn; |
56 | pdn->phb = phb; | 56 | pdn->phb = phb; |
57 | regs = (u32 *)get_property(dn, "reg", NULL); | 57 | regs = get_property(dn, "reg", NULL); |
58 | if (regs) { | 58 | if (regs) { |
59 | /* First register entry is addr (00BBSS00) */ | 59 | /* First register entry is addr (00BBSS00) */ |
60 | pdn->busno = (regs[0] >> 16) & 0xff; | 60 | pdn->busno = (regs[0] >> 16) & 0xff; |
61 | pdn->devfn = (regs[0] >> 8) & 0xff; | 61 | pdn->devfn = (regs[0] >> 8) & 0xff; |
62 | } | 62 | } |
63 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { | 63 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { |
64 | u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL); | 64 | const u32 *busp = get_property(dn, "linux,subbus", NULL); |
65 | if (busp) | 65 | if (busp) |
66 | pdn->bussubno = *busp; | 66 | pdn->bussubno = *busp; |
67 | } | 67 | } |
@@ -96,10 +96,11 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre, | |||
96 | 96 | ||
97 | /* We started with a phb, iterate all childs */ | 97 | /* We started with a phb, iterate all childs */ |
98 | for (dn = start->child; dn; dn = nextdn) { | 98 | for (dn = start->child; dn; dn = nextdn) { |
99 | u32 *classp, class; | 99 | const u32 *classp; |
100 | u32 class; | ||
100 | 101 | ||
101 | nextdn = NULL; | 102 | nextdn = NULL; |
102 | classp = (u32 *)get_property(dn, "class-code", NULL); | 103 | classp = get_property(dn, "class-code", NULL); |
103 | class = classp ? *classp : 0; | 104 | class = classp ? *classp : 0; |
104 | 105 | ||
105 | if (pre && ((ret = pre(dn, data)) != NULL)) | 106 | if (pre && ((ret = pre(dn, data)) != NULL)) |
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 39d3bfcabcd2..807193a3c784 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -91,25 +91,10 @@ EXPORT_SYMBOL(__copy_tofrom_user); | |||
91 | EXPORT_SYMBOL(__clear_user); | 91 | EXPORT_SYMBOL(__clear_user); |
92 | EXPORT_SYMBOL(__strncpy_from_user); | 92 | EXPORT_SYMBOL(__strncpy_from_user); |
93 | EXPORT_SYMBOL(__strnlen_user); | 93 | EXPORT_SYMBOL(__strnlen_user); |
94 | 94 | #ifdef CONFIG_PPC64 | |
95 | #ifndef __powerpc64__ | 95 | EXPORT_SYMBOL(copy_4K_page); |
96 | EXPORT_SYMBOL(__ide_mm_insl); | ||
97 | EXPORT_SYMBOL(__ide_mm_outsw); | ||
98 | EXPORT_SYMBOL(__ide_mm_insw); | ||
99 | EXPORT_SYMBOL(__ide_mm_outsl); | ||
100 | #endif | 96 | #endif |
101 | 97 | ||
102 | EXPORT_SYMBOL(_insb); | ||
103 | EXPORT_SYMBOL(_outsb); | ||
104 | EXPORT_SYMBOL(_insw); | ||
105 | EXPORT_SYMBOL(_outsw); | ||
106 | EXPORT_SYMBOL(_insl); | ||
107 | EXPORT_SYMBOL(_outsl); | ||
108 | EXPORT_SYMBOL(_insw_ns); | ||
109 | EXPORT_SYMBOL(_outsw_ns); | ||
110 | EXPORT_SYMBOL(_insl_ns); | ||
111 | EXPORT_SYMBOL(_outsl_ns); | ||
112 | |||
113 | #if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) | 98 | #if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) |
114 | EXPORT_SYMBOL(ppc_ide_md); | 99 | EXPORT_SYMBOL(ppc_ide_md); |
115 | #endif | 100 | #endif |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index a1787ffb6319..eb913f80bfb1 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -757,24 +757,9 @@ static int __init early_init_dt_scan_root(unsigned long node, | |||
757 | static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) | 757 | static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) |
758 | { | 758 | { |
759 | cell_t *p = *cellp; | 759 | cell_t *p = *cellp; |
760 | unsigned long r; | ||
761 | 760 | ||
762 | /* Ignore more than 2 cells */ | 761 | *cellp = p + s; |
763 | while (s > sizeof(unsigned long) / 4) { | 762 | return of_read_ulong(p, s); |
764 | p++; | ||
765 | s--; | ||
766 | } | ||
767 | r = *p++; | ||
768 | #ifdef CONFIG_PPC64 | ||
769 | if (s > 1) { | ||
770 | r <<= 32; | ||
771 | r |= *(p++); | ||
772 | s--; | ||
773 | } | ||
774 | #endif | ||
775 | |||
776 | *cellp = p; | ||
777 | return r; | ||
778 | } | 763 | } |
779 | 764 | ||
780 | 765 | ||
@@ -942,11 +927,11 @@ void __init early_init_devtree(void *params) | |||
942 | int | 927 | int |
943 | prom_n_addr_cells(struct device_node* np) | 928 | prom_n_addr_cells(struct device_node* np) |
944 | { | 929 | { |
945 | int* ip; | 930 | const int *ip; |
946 | do { | 931 | do { |
947 | if (np->parent) | 932 | if (np->parent) |
948 | np = np->parent; | 933 | np = np->parent; |
949 | ip = (int *) get_property(np, "#address-cells", NULL); | 934 | ip = get_property(np, "#address-cells", NULL); |
950 | if (ip != NULL) | 935 | if (ip != NULL) |
951 | return *ip; | 936 | return *ip; |
952 | } while (np->parent); | 937 | } while (np->parent); |
@@ -958,11 +943,11 @@ EXPORT_SYMBOL(prom_n_addr_cells); | |||
958 | int | 943 | int |
959 | prom_n_size_cells(struct device_node* np) | 944 | prom_n_size_cells(struct device_node* np) |
960 | { | 945 | { |
961 | int* ip; | 946 | const int* ip; |
962 | do { | 947 | do { |
963 | if (np->parent) | 948 | if (np->parent) |
964 | np = np->parent; | 949 | np = np->parent; |
965 | ip = (int *) get_property(np, "#size-cells", NULL); | 950 | ip = get_property(np, "#size-cells", NULL); |
966 | if (ip != NULL) | 951 | if (ip != NULL) |
967 | return *ip; | 952 | return *ip; |
968 | } while (np->parent); | 953 | } while (np->parent); |
@@ -1034,7 +1019,7 @@ int device_is_compatible(struct device_node *device, const char *compat) | |||
1034 | const char* cp; | 1019 | const char* cp; |
1035 | int cplen, l; | 1020 | int cplen, l; |
1036 | 1021 | ||
1037 | cp = (char *) get_property(device, "compatible", &cplen); | 1022 | cp = get_property(device, "compatible", &cplen); |
1038 | if (cp == NULL) | 1023 | if (cp == NULL) |
1039 | return 0; | 1024 | return 0; |
1040 | while (cplen > 0) { | 1025 | while (cplen > 0) { |
@@ -1449,7 +1434,7 @@ static int of_finish_dynamic_node(struct device_node *node) | |||
1449 | { | 1434 | { |
1450 | struct device_node *parent = of_get_parent(node); | 1435 | struct device_node *parent = of_get_parent(node); |
1451 | int err = 0; | 1436 | int err = 0; |
1452 | phandle *ibm_phandle; | 1437 | const phandle *ibm_phandle; |
1453 | 1438 | ||
1454 | node->name = get_property(node, "name", NULL); | 1439 | node->name = get_property(node, "name", NULL); |
1455 | node->type = get_property(node, "device_type", NULL); | 1440 | node->type = get_property(node, "device_type", NULL); |
@@ -1466,8 +1451,7 @@ static int of_finish_dynamic_node(struct device_node *node) | |||
1466 | return -ENODEV; | 1451 | return -ENODEV; |
1467 | 1452 | ||
1468 | /* fix up new node's linux_phandle field */ | 1453 | /* fix up new node's linux_phandle field */ |
1469 | if ((ibm_phandle = (unsigned int *)get_property(node, | 1454 | if ((ibm_phandle = get_property(node, "ibm,phandle", NULL))) |
1470 | "ibm,phandle", NULL))) | ||
1471 | node->linux_phandle = *ibm_phandle; | 1455 | node->linux_phandle = *ibm_phandle; |
1472 | 1456 | ||
1473 | out: | 1457 | out: |
@@ -1528,7 +1512,7 @@ struct property *of_find_property(struct device_node *np, const char *name, | |||
1528 | * Find a property with a given name for a given node | 1512 | * Find a property with a given name for a given node |
1529 | * and return the value. | 1513 | * and return the value. |
1530 | */ | 1514 | */ |
1531 | void *get_property(struct device_node *np, const char *name, int *lenp) | 1515 | const void *get_property(struct device_node *np, const char *name, int *lenp) |
1532 | { | 1516 | { |
1533 | struct property *pp = of_find_property(np,name,lenp); | 1517 | struct property *pp = of_find_property(np,name,lenp); |
1534 | return pp ? pp->value : NULL; | 1518 | return pp ? pp->value : NULL; |
@@ -1658,16 +1642,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) | |||
1658 | hardid = get_hard_smp_processor_id(cpu); | 1642 | hardid = get_hard_smp_processor_id(cpu); |
1659 | 1643 | ||
1660 | for_each_node_by_type(np, "cpu") { | 1644 | for_each_node_by_type(np, "cpu") { |
1661 | u32 *intserv; | 1645 | const u32 *intserv; |
1662 | unsigned int plen, t; | 1646 | unsigned int plen, t; |
1663 | 1647 | ||
1664 | /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist | 1648 | /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist |
1665 | * fallback to "reg" property and assume no threads | 1649 | * fallback to "reg" property and assume no threads |
1666 | */ | 1650 | */ |
1667 | intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", | 1651 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", |
1668 | &plen); | 1652 | &plen); |
1669 | if (intserv == NULL) { | 1653 | if (intserv == NULL) { |
1670 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 1654 | const u32 *reg = get_property(np, "reg", NULL); |
1671 | if (reg == NULL) | 1655 | if (reg == NULL) |
1672 | continue; | 1656 | continue; |
1673 | if (*reg == hardid) { | 1657 | if (*reg == hardid) { |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 4394e545f9f7..b91761639d96 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -2033,16 +2033,22 @@ static void __init fixup_device_tree_maple(void) | |||
2033 | #endif | 2033 | #endif |
2034 | 2034 | ||
2035 | #ifdef CONFIG_PPC_CHRP | 2035 | #ifdef CONFIG_PPC_CHRP |
2036 | /* Pegasos lacks the "ranges" property in the isa node */ | 2036 | /* Pegasos and BriQ lacks the "ranges" property in the isa node */ |
2037 | static void __init fixup_device_tree_chrp(void) | 2037 | static void __init fixup_device_tree_chrp(void) |
2038 | { | 2038 | { |
2039 | phandle isa; | 2039 | phandle isa; |
2040 | u32 isa_ranges[6]; | 2040 | u32 isa_ranges[6]; |
2041 | u32 rloc = 0x01006000; /* IO space; PCI device = 12 */ | ||
2041 | char *name; | 2042 | char *name; |
2042 | int rc; | 2043 | int rc; |
2043 | 2044 | ||
2044 | name = "/pci@80000000/isa@c"; | 2045 | name = "/pci@80000000/isa@c"; |
2045 | isa = call_prom("finddevice", 1, 1, ADDR(name)); | 2046 | isa = call_prom("finddevice", 1, 1, ADDR(name)); |
2047 | if (!PHANDLE_VALID(isa)) { | ||
2048 | name = "/pci@ff500000/isa@6"; | ||
2049 | isa = call_prom("finddevice", 1, 1, ADDR(name)); | ||
2050 | rloc = 0x01003000; /* IO space; PCI device = 6 */ | ||
2051 | } | ||
2046 | if (!PHANDLE_VALID(isa)) | 2052 | if (!PHANDLE_VALID(isa)) |
2047 | return; | 2053 | return; |
2048 | 2054 | ||
@@ -2054,7 +2060,7 @@ static void __init fixup_device_tree_chrp(void) | |||
2054 | 2060 | ||
2055 | isa_ranges[0] = 0x1; | 2061 | isa_ranges[0] = 0x1; |
2056 | isa_ranges[1] = 0x0; | 2062 | isa_ranges[1] = 0x0; |
2057 | isa_ranges[2] = 0x01006000; | 2063 | isa_ranges[2] = rloc; |
2058 | isa_ranges[3] = 0x0; | 2064 | isa_ranges[3] = 0x0; |
2059 | isa_ranges[4] = 0x0; | 2065 | isa_ranges[4] = 0x0; |
2060 | isa_ranges[5] = 0x00010000; | 2066 | isa_ranges[5] = 0x00010000; |
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index a10825a5dfe6..603dff3ad62a 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | /* Debug utility */ | 28 | /* Debug utility */ |
29 | #ifdef DEBUG | 29 | #ifdef DEBUG |
30 | static void of_dump_addr(const char *s, u32 *addr, int na) | 30 | static void of_dump_addr(const char *s, const u32 *addr, int na) |
31 | { | 31 | { |
32 | printk("%s", s); | 32 | printk("%s", s); |
33 | while(na--) | 33 | while(na--) |
@@ -35,7 +35,7 @@ static void of_dump_addr(const char *s, u32 *addr, int na) | |||
35 | printk("\n"); | 35 | printk("\n"); |
36 | } | 36 | } |
37 | #else | 37 | #else |
38 | static void of_dump_addr(const char *s, u32 *addr, int na) { } | 38 | static void of_dump_addr(const char *s, const u32 *addr, int na) { } |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | 41 | ||
@@ -46,9 +46,10 @@ struct of_bus { | |||
46 | int (*match)(struct device_node *parent); | 46 | int (*match)(struct device_node *parent); |
47 | void (*count_cells)(struct device_node *child, | 47 | void (*count_cells)(struct device_node *child, |
48 | int *addrc, int *sizec); | 48 | int *addrc, int *sizec); |
49 | u64 (*map)(u32 *addr, u32 *range, int na, int ns, int pna); | 49 | u64 (*map)(u32 *addr, const u32 *range, |
50 | int na, int ns, int pna); | ||
50 | int (*translate)(u32 *addr, u64 offset, int na); | 51 | int (*translate)(u32 *addr, u64 offset, int na); |
51 | unsigned int (*get_flags)(u32 *addr); | 52 | unsigned int (*get_flags)(const u32 *addr); |
52 | }; | 53 | }; |
53 | 54 | ||
54 | 55 | ||
@@ -65,7 +66,8 @@ static void of_bus_default_count_cells(struct device_node *dev, | |||
65 | *sizec = prom_n_size_cells(dev); | 66 | *sizec = prom_n_size_cells(dev); |
66 | } | 67 | } |
67 | 68 | ||
68 | static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna) | 69 | static u64 of_bus_default_map(u32 *addr, const u32 *range, |
70 | int na, int ns, int pna) | ||
69 | { | 71 | { |
70 | u64 cp, s, da; | 72 | u64 cp, s, da; |
71 | 73 | ||
@@ -93,7 +95,7 @@ static int of_bus_default_translate(u32 *addr, u64 offset, int na) | |||
93 | return 0; | 95 | return 0; |
94 | } | 96 | } |
95 | 97 | ||
96 | static unsigned int of_bus_default_get_flags(u32 *addr) | 98 | static unsigned int of_bus_default_get_flags(const u32 *addr) |
97 | { | 99 | { |
98 | return IORESOURCE_MEM; | 100 | return IORESOURCE_MEM; |
99 | } | 101 | } |
@@ -118,7 +120,7 @@ static void of_bus_pci_count_cells(struct device_node *np, | |||
118 | *sizec = 2; | 120 | *sizec = 2; |
119 | } | 121 | } |
120 | 122 | ||
121 | static u64 of_bus_pci_map(u32 *addr, u32 *range, int na, int ns, int pna) | 123 | static u64 of_bus_pci_map(u32 *addr, const u32 *range, int na, int ns, int pna) |
122 | { | 124 | { |
123 | u64 cp, s, da; | 125 | u64 cp, s, da; |
124 | 126 | ||
@@ -143,7 +145,7 @@ static int of_bus_pci_translate(u32 *addr, u64 offset, int na) | |||
143 | return of_bus_default_translate(addr + 1, offset, na - 1); | 145 | return of_bus_default_translate(addr + 1, offset, na - 1); |
144 | } | 146 | } |
145 | 147 | ||
146 | static unsigned int of_bus_pci_get_flags(u32 *addr) | 148 | static unsigned int of_bus_pci_get_flags(const u32 *addr) |
147 | { | 149 | { |
148 | unsigned int flags = 0; | 150 | unsigned int flags = 0; |
149 | u32 w = addr[0]; | 151 | u32 w = addr[0]; |
@@ -178,7 +180,7 @@ static void of_bus_isa_count_cells(struct device_node *child, | |||
178 | *sizec = 1; | 180 | *sizec = 1; |
179 | } | 181 | } |
180 | 182 | ||
181 | static u64 of_bus_isa_map(u32 *addr, u32 *range, int na, int ns, int pna) | 183 | static u64 of_bus_isa_map(u32 *addr, const u32 *range, int na, int ns, int pna) |
182 | { | 184 | { |
183 | u64 cp, s, da; | 185 | u64 cp, s, da; |
184 | 186 | ||
@@ -203,7 +205,7 @@ static int of_bus_isa_translate(u32 *addr, u64 offset, int na) | |||
203 | return of_bus_default_translate(addr + 1, offset, na - 1); | 205 | return of_bus_default_translate(addr + 1, offset, na - 1); |
204 | } | 206 | } |
205 | 207 | ||
206 | static unsigned int of_bus_isa_get_flags(u32 *addr) | 208 | static unsigned int of_bus_isa_get_flags(const u32 *addr) |
207 | { | 209 | { |
208 | unsigned int flags = 0; | 210 | unsigned int flags = 0; |
209 | u32 w = addr[0]; | 211 | u32 w = addr[0]; |
@@ -268,7 +270,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
268 | struct of_bus *pbus, u32 *addr, | 270 | struct of_bus *pbus, u32 *addr, |
269 | int na, int ns, int pna) | 271 | int na, int ns, int pna) |
270 | { | 272 | { |
271 | u32 *ranges; | 273 | const u32 *ranges; |
272 | unsigned int rlen; | 274 | unsigned int rlen; |
273 | int rone; | 275 | int rone; |
274 | u64 offset = OF_BAD_ADDR; | 276 | u64 offset = OF_BAD_ADDR; |
@@ -285,7 +287,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
285 | * to translate addresses that aren't supposed to be translated in | 287 | * to translate addresses that aren't supposed to be translated in |
286 | * the first place. --BenH. | 288 | * the first place. --BenH. |
287 | */ | 289 | */ |
288 | ranges = (u32 *)get_property(parent, "ranges", &rlen); | 290 | ranges = get_property(parent, "ranges", &rlen); |
289 | if (ranges == NULL || rlen == 0) { | 291 | if (ranges == NULL || rlen == 0) { |
290 | offset = of_read_number(addr, na); | 292 | offset = of_read_number(addr, na); |
291 | memset(addr, 0, pna * 4); | 293 | memset(addr, 0, pna * 4); |
@@ -328,7 +330,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
328 | * that can be mapped to a cpu physical address). This is not really specified | 330 | * that can be mapped to a cpu physical address). This is not really specified |
329 | * that way, but this is traditionally the way IBM at least do things | 331 | * that way, but this is traditionally the way IBM at least do things |
330 | */ | 332 | */ |
331 | u64 of_translate_address(struct device_node *dev, u32 *in_addr) | 333 | u64 of_translate_address(struct device_node *dev, const u32 *in_addr) |
332 | { | 334 | { |
333 | struct device_node *parent = NULL; | 335 | struct device_node *parent = NULL; |
334 | struct of_bus *bus, *pbus; | 336 | struct of_bus *bus, *pbus; |
@@ -405,10 +407,10 @@ u64 of_translate_address(struct device_node *dev, u32 *in_addr) | |||
405 | } | 407 | } |
406 | EXPORT_SYMBOL(of_translate_address); | 408 | EXPORT_SYMBOL(of_translate_address); |
407 | 409 | ||
408 | u32 *of_get_address(struct device_node *dev, int index, u64 *size, | 410 | const u32 *of_get_address(struct device_node *dev, int index, u64 *size, |
409 | unsigned int *flags) | 411 | unsigned int *flags) |
410 | { | 412 | { |
411 | u32 *prop; | 413 | const u32 *prop; |
412 | unsigned int psize; | 414 | unsigned int psize; |
413 | struct device_node *parent; | 415 | struct device_node *parent; |
414 | struct of_bus *bus; | 416 | struct of_bus *bus; |
@@ -425,7 +427,7 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size, | |||
425 | return NULL; | 427 | return NULL; |
426 | 428 | ||
427 | /* Get "reg" or "assigned-addresses" property */ | 429 | /* Get "reg" or "assigned-addresses" property */ |
428 | prop = (u32 *)get_property(dev, bus->addresses, &psize); | 430 | prop = get_property(dev, bus->addresses, &psize); |
429 | if (prop == NULL) | 431 | if (prop == NULL) |
430 | return NULL; | 432 | return NULL; |
431 | psize /= 4; | 433 | psize /= 4; |
@@ -443,10 +445,10 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size, | |||
443 | } | 445 | } |
444 | EXPORT_SYMBOL(of_get_address); | 446 | EXPORT_SYMBOL(of_get_address); |
445 | 447 | ||
446 | u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, | 448 | const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, |
447 | unsigned int *flags) | 449 | unsigned int *flags) |
448 | { | 450 | { |
449 | u32 *prop; | 451 | const u32 *prop; |
450 | unsigned int psize; | 452 | unsigned int psize; |
451 | struct device_node *parent; | 453 | struct device_node *parent; |
452 | struct of_bus *bus; | 454 | struct of_bus *bus; |
@@ -467,7 +469,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, | |||
467 | return NULL; | 469 | return NULL; |
468 | 470 | ||
469 | /* Get "reg" or "assigned-addresses" property */ | 471 | /* Get "reg" or "assigned-addresses" property */ |
470 | prop = (u32 *)get_property(dev, bus->addresses, &psize); | 472 | prop = get_property(dev, bus->addresses, &psize); |
471 | if (prop == NULL) | 473 | if (prop == NULL) |
472 | return NULL; | 474 | return NULL; |
473 | psize /= 4; | 475 | psize /= 4; |
@@ -485,7 +487,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, | |||
485 | } | 487 | } |
486 | EXPORT_SYMBOL(of_get_pci_address); | 488 | EXPORT_SYMBOL(of_get_pci_address); |
487 | 489 | ||
488 | static int __of_address_to_resource(struct device_node *dev, u32 *addrp, | 490 | static int __of_address_to_resource(struct device_node *dev, const u32 *addrp, |
489 | u64 size, unsigned int flags, | 491 | u64 size, unsigned int flags, |
490 | struct resource *r) | 492 | struct resource *r) |
491 | { | 493 | { |
@@ -516,7 +518,7 @@ static int __of_address_to_resource(struct device_node *dev, u32 *addrp, | |||
516 | int of_address_to_resource(struct device_node *dev, int index, | 518 | int of_address_to_resource(struct device_node *dev, int index, |
517 | struct resource *r) | 519 | struct resource *r) |
518 | { | 520 | { |
519 | u32 *addrp; | 521 | const u32 *addrp; |
520 | u64 size; | 522 | u64 size; |
521 | unsigned int flags; | 523 | unsigned int flags; |
522 | 524 | ||
@@ -530,7 +532,7 @@ EXPORT_SYMBOL_GPL(of_address_to_resource); | |||
530 | int of_pci_address_to_resource(struct device_node *dev, int bar, | 532 | int of_pci_address_to_resource(struct device_node *dev, int bar, |
531 | struct resource *r) | 533 | struct resource *r) |
532 | { | 534 | { |
533 | u32 *addrp; | 535 | const u32 *addrp; |
534 | u64 size; | 536 | u64 size; |
535 | unsigned int flags; | 537 | unsigned int flags; |
536 | 538 | ||
@@ -541,13 +543,14 @@ int of_pci_address_to_resource(struct device_node *dev, int bar, | |||
541 | } | 543 | } |
542 | EXPORT_SYMBOL_GPL(of_pci_address_to_resource); | 544 | EXPORT_SYMBOL_GPL(of_pci_address_to_resource); |
543 | 545 | ||
544 | void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, | 546 | void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, |
545 | unsigned long *busno, unsigned long *phys, unsigned long *size) | 547 | unsigned long *busno, unsigned long *phys, unsigned long *size) |
546 | { | 548 | { |
547 | u32 *dma_window, cells; | 549 | const u32 *dma_window; |
548 | unsigned char *prop; | 550 | u32 cells; |
551 | const unsigned char *prop; | ||
549 | 552 | ||
550 | dma_window = (u32 *)dma_window_prop; | 553 | dma_window = dma_window_prop; |
551 | 554 | ||
552 | /* busno is always one cell */ | 555 | /* busno is always one cell */ |
553 | *busno = *(dma_window++); | 556 | *busno = *(dma_window++); |
@@ -576,13 +579,13 @@ static struct device_node *of_irq_dflt_pic; | |||
576 | static struct device_node *of_irq_find_parent(struct device_node *child) | 579 | static struct device_node *of_irq_find_parent(struct device_node *child) |
577 | { | 580 | { |
578 | struct device_node *p; | 581 | struct device_node *p; |
579 | phandle *parp; | 582 | const phandle *parp; |
580 | 583 | ||
581 | if (!of_node_get(child)) | 584 | if (!of_node_get(child)) |
582 | return NULL; | 585 | return NULL; |
583 | 586 | ||
584 | do { | 587 | do { |
585 | parp = (phandle *)get_property(child, "interrupt-parent", NULL); | 588 | parp = get_property(child, "interrupt-parent", NULL); |
586 | if (parp == NULL) | 589 | if (parp == NULL) |
587 | p = of_get_parent(child); | 590 | p = of_get_parent(child); |
588 | else { | 591 | else { |
@@ -639,11 +642,11 @@ void of_irq_map_init(unsigned int flags) | |||
639 | 642 | ||
640 | } | 643 | } |
641 | 644 | ||
642 | int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | 645 | int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, |
643 | u32 *addr, struct of_irq *out_irq) | 646 | const u32 *addr, struct of_irq *out_irq) |
644 | { | 647 | { |
645 | struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; | 648 | struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; |
646 | u32 *tmp, *imap, *imask; | 649 | const u32 *tmp, *imap, *imask; |
647 | u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; | 650 | u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; |
648 | int imaplen, match, i; | 651 | int imaplen, match, i; |
649 | 652 | ||
@@ -657,7 +660,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
657 | * is none, we are nice and just walk up the tree | 660 | * is none, we are nice and just walk up the tree |
658 | */ | 661 | */ |
659 | do { | 662 | do { |
660 | tmp = (u32 *)get_property(ipar, "#interrupt-cells", NULL); | 663 | tmp = get_property(ipar, "#interrupt-cells", NULL); |
661 | if (tmp != NULL) { | 664 | if (tmp != NULL) { |
662 | intsize = *tmp; | 665 | intsize = *tmp; |
663 | break; | 666 | break; |
@@ -681,7 +684,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
681 | */ | 684 | */ |
682 | old = of_node_get(ipar); | 685 | old = of_node_get(ipar); |
683 | do { | 686 | do { |
684 | tmp = (u32 *)get_property(old, "#address-cells", NULL); | 687 | tmp = get_property(old, "#address-cells", NULL); |
685 | tnode = of_get_parent(old); | 688 | tnode = of_get_parent(old); |
686 | of_node_put(old); | 689 | of_node_put(old); |
687 | old = tnode; | 690 | old = tnode; |
@@ -708,7 +711,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
708 | } | 711 | } |
709 | 712 | ||
710 | /* Now look for an interrupt-map */ | 713 | /* Now look for an interrupt-map */ |
711 | imap = (u32 *)get_property(ipar, "interrupt-map", &imaplen); | 714 | imap = get_property(ipar, "interrupt-map", &imaplen); |
712 | /* No interrupt map, check for an interrupt parent */ | 715 | /* No interrupt map, check for an interrupt parent */ |
713 | if (imap == NULL) { | 716 | if (imap == NULL) { |
714 | DBG(" -> no map, getting parent\n"); | 717 | DBG(" -> no map, getting parent\n"); |
@@ -718,7 +721,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
718 | imaplen /= sizeof(u32); | 721 | imaplen /= sizeof(u32); |
719 | 722 | ||
720 | /* Look for a mask */ | 723 | /* Look for a mask */ |
721 | imask = (u32 *)get_property(ipar, "interrupt-map-mask", NULL); | 724 | imask = get_property(ipar, "interrupt-map-mask", NULL); |
722 | 725 | ||
723 | /* If we were passed no "reg" property and we attempt to parse | 726 | /* If we were passed no "reg" property and we attempt to parse |
724 | * an interrupt-map, then #address-cells must be 0. | 727 | * an interrupt-map, then #address-cells must be 0. |
@@ -765,14 +768,14 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
765 | /* Get #interrupt-cells and #address-cells of new | 768 | /* Get #interrupt-cells and #address-cells of new |
766 | * parent | 769 | * parent |
767 | */ | 770 | */ |
768 | tmp = (u32 *)get_property(newpar, "#interrupt-cells", | 771 | tmp = get_property(newpar, "#interrupt-cells", |
769 | NULL); | 772 | NULL); |
770 | if (tmp == NULL) { | 773 | if (tmp == NULL) { |
771 | DBG(" -> parent lacks #interrupt-cells !\n"); | 774 | DBG(" -> parent lacks #interrupt-cells !\n"); |
772 | goto fail; | 775 | goto fail; |
773 | } | 776 | } |
774 | newintsize = *tmp; | 777 | newintsize = *tmp; |
775 | tmp = (u32 *)get_property(newpar, "#address-cells", | 778 | tmp = get_property(newpar, "#address-cells", |
776 | NULL); | 779 | NULL); |
777 | newaddrsize = (tmp == NULL) ? 0 : *tmp; | 780 | newaddrsize = (tmp == NULL) ? 0 : *tmp; |
778 | 781 | ||
@@ -818,14 +821,14 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw); | |||
818 | static int of_irq_map_oldworld(struct device_node *device, int index, | 821 | static int of_irq_map_oldworld(struct device_node *device, int index, |
819 | struct of_irq *out_irq) | 822 | struct of_irq *out_irq) |
820 | { | 823 | { |
821 | u32 *ints; | 824 | const u32 *ints; |
822 | int intlen; | 825 | int intlen; |
823 | 826 | ||
824 | /* | 827 | /* |
825 | * Old machines just have a list of interrupt numbers | 828 | * Old machines just have a list of interrupt numbers |
826 | * and no interrupt-controller nodes. | 829 | * and no interrupt-controller nodes. |
827 | */ | 830 | */ |
828 | ints = (u32 *) get_property(device, "AAPL,interrupts", &intlen); | 831 | ints = get_property(device, "AAPL,interrupts", &intlen); |
829 | if (ints == NULL) | 832 | if (ints == NULL) |
830 | return -EINVAL; | 833 | return -EINVAL; |
831 | intlen /= sizeof(u32); | 834 | intlen /= sizeof(u32); |
@@ -850,7 +853,8 @@ static int of_irq_map_oldworld(struct device_node *device, int index, | |||
850 | int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) | 853 | int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) |
851 | { | 854 | { |
852 | struct device_node *p; | 855 | struct device_node *p; |
853 | u32 *intspec, *tmp, intsize, intlen, *addr; | 856 | const u32 *intspec, *tmp, *addr; |
857 | u32 intsize, intlen; | ||
854 | int res; | 858 | int res; |
855 | 859 | ||
856 | DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); | 860 | DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); |
@@ -860,13 +864,13 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
860 | return of_irq_map_oldworld(device, index, out_irq); | 864 | return of_irq_map_oldworld(device, index, out_irq); |
861 | 865 | ||
862 | /* Get the interrupts property */ | 866 | /* Get the interrupts property */ |
863 | intspec = (u32 *)get_property(device, "interrupts", &intlen); | 867 | intspec = get_property(device, "interrupts", &intlen); |
864 | if (intspec == NULL) | 868 | if (intspec == NULL) |
865 | return -EINVAL; | 869 | return -EINVAL; |
866 | intlen /= sizeof(u32); | 870 | intlen /= sizeof(u32); |
867 | 871 | ||
868 | /* Get the reg property (if any) */ | 872 | /* Get the reg property (if any) */ |
869 | addr = (u32 *)get_property(device, "reg", NULL); | 873 | addr = get_property(device, "reg", NULL); |
870 | 874 | ||
871 | /* Look for the interrupt parent. */ | 875 | /* Look for the interrupt parent. */ |
872 | p = of_irq_find_parent(device); | 876 | p = of_irq_find_parent(device); |
@@ -874,7 +878,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
874 | return -EINVAL; | 878 | return -EINVAL; |
875 | 879 | ||
876 | /* Get size of interrupt specifier */ | 880 | /* Get size of interrupt specifier */ |
877 | tmp = (u32 *)get_property(p, "#interrupt-cells", NULL); | 881 | tmp = get_property(p, "#interrupt-cells", NULL); |
878 | if (tmp == NULL) { | 882 | if (tmp == NULL) { |
879 | of_node_put(p); | 883 | of_node_put(p); |
880 | return -EINVAL; | 884 | return -EINVAL; |
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c index 9c9ad1fa9cce..2fe82abf1c52 100644 --- a/arch/powerpc/kernel/rtas-proc.c +++ b/arch/powerpc/kernel/rtas-proc.c | |||
@@ -246,12 +246,12 @@ struct file_operations ppc_rtas_rmo_buf_ops = { | |||
246 | 246 | ||
247 | static int ppc_rtas_find_all_sensors(void); | 247 | static int ppc_rtas_find_all_sensors(void); |
248 | static void ppc_rtas_process_sensor(struct seq_file *m, | 248 | static void ppc_rtas_process_sensor(struct seq_file *m, |
249 | struct individual_sensor *s, int state, int error, char *loc); | 249 | struct individual_sensor *s, int state, int error, const char *loc); |
250 | static char *ppc_rtas_process_error(int error); | 250 | static char *ppc_rtas_process_error(int error); |
251 | static void get_location_code(struct seq_file *m, | 251 | static void get_location_code(struct seq_file *m, |
252 | struct individual_sensor *s, char *loc); | 252 | struct individual_sensor *s, const char *loc); |
253 | static void check_location_string(struct seq_file *m, char *c); | 253 | static void check_location_string(struct seq_file *m, const char *c); |
254 | static void check_location(struct seq_file *m, char *c); | 254 | static void check_location(struct seq_file *m, const char *c); |
255 | 255 | ||
256 | static int __init proc_rtas_init(void) | 256 | static int __init proc_rtas_init(void) |
257 | { | 257 | { |
@@ -446,11 +446,11 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v) | |||
446 | for (i=0; i<sensors.quant; i++) { | 446 | for (i=0; i<sensors.quant; i++) { |
447 | struct individual_sensor *p = &sensors.sensor[i]; | 447 | struct individual_sensor *p = &sensors.sensor[i]; |
448 | char rstr[64]; | 448 | char rstr[64]; |
449 | char *loc; | 449 | const char *loc; |
450 | int llen, offs; | 450 | int llen, offs; |
451 | 451 | ||
452 | sprintf (rstr, SENSOR_PREFIX"%04d", p->token); | 452 | sprintf (rstr, SENSOR_PREFIX"%04d", p->token); |
453 | loc = (char *) get_property(rtas_node, rstr, &llen); | 453 | loc = get_property(rtas_node, rstr, &llen); |
454 | 454 | ||
455 | /* A sensor may have multiple instances */ | 455 | /* A sensor may have multiple instances */ |
456 | for (j = 0, offs = 0; j <= p->quant; j++) { | 456 | for (j = 0, offs = 0; j <= p->quant; j++) { |
@@ -474,10 +474,10 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v) | |||
474 | 474 | ||
475 | static int ppc_rtas_find_all_sensors(void) | 475 | static int ppc_rtas_find_all_sensors(void) |
476 | { | 476 | { |
477 | unsigned int *utmp; | 477 | const unsigned int *utmp; |
478 | int len, i; | 478 | int len, i; |
479 | 479 | ||
480 | utmp = (unsigned int *) get_property(rtas_node, "rtas-sensors", &len); | 480 | utmp = get_property(rtas_node, "rtas-sensors", &len); |
481 | if (utmp == NULL) { | 481 | if (utmp == NULL) { |
482 | printk (KERN_ERR "error: could not get rtas-sensors\n"); | 482 | printk (KERN_ERR "error: could not get rtas-sensors\n"); |
483 | return 1; | 483 | return 1; |
@@ -530,7 +530,7 @@ static char *ppc_rtas_process_error(int error) | |||
530 | */ | 530 | */ |
531 | 531 | ||
532 | static void ppc_rtas_process_sensor(struct seq_file *m, | 532 | static void ppc_rtas_process_sensor(struct seq_file *m, |
533 | struct individual_sensor *s, int state, int error, char *loc) | 533 | struct individual_sensor *s, int state, int error, const char *loc) |
534 | { | 534 | { |
535 | /* Defined return vales */ | 535 | /* Defined return vales */ |
536 | const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t", | 536 | const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t", |
@@ -682,7 +682,7 @@ static void ppc_rtas_process_sensor(struct seq_file *m, | |||
682 | 682 | ||
683 | /* ****************************************************************** */ | 683 | /* ****************************************************************** */ |
684 | 684 | ||
685 | static void check_location(struct seq_file *m, char *c) | 685 | static void check_location(struct seq_file *m, const char *c) |
686 | { | 686 | { |
687 | switch (c[0]) { | 687 | switch (c[0]) { |
688 | case LOC_PLANAR: | 688 | case LOC_PLANAR: |
@@ -719,7 +719,7 @@ static void check_location(struct seq_file *m, char *c) | |||
719 | * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ] | 719 | * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ] |
720 | * the '.' may be an abbrevation | 720 | * the '.' may be an abbrevation |
721 | */ | 721 | */ |
722 | static void check_location_string(struct seq_file *m, char *c) | 722 | static void check_location_string(struct seq_file *m, const char *c) |
723 | { | 723 | { |
724 | while (*c) { | 724 | while (*c) { |
725 | if (isalpha(*c) || *c == '.') | 725 | if (isalpha(*c) || *c == '.') |
@@ -733,7 +733,8 @@ static void check_location_string(struct seq_file *m, char *c) | |||
733 | 733 | ||
734 | /* ****************************************************************** */ | 734 | /* ****************************************************************** */ |
735 | 735 | ||
736 | static void get_location_code(struct seq_file *m, struct individual_sensor *s, char *loc) | 736 | static void get_location_code(struct seq_file *m, struct individual_sensor *s, |
737 | const char *loc) | ||
737 | { | 738 | { |
738 | if (!loc || !*loc) { | 739 | if (!loc || !*loc) { |
739 | seq_printf(m, "---");/* does not have a location */ | 740 | seq_printf(m, "---");/* does not have a location */ |
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 77f1e06d208d..6ef80d4e38d3 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
@@ -177,10 +177,12 @@ void __init udbg_init_rtas_console(void) | |||
177 | void rtas_progress(char *s, unsigned short hex) | 177 | void rtas_progress(char *s, unsigned short hex) |
178 | { | 178 | { |
179 | struct device_node *root; | 179 | struct device_node *root; |
180 | int width, *p; | 180 | int width; |
181 | const int *p; | ||
181 | char *os; | 182 | char *os; |
182 | static int display_character, set_indicator; | 183 | static int display_character, set_indicator; |
183 | static int display_width, display_lines, *row_width, form_feed; | 184 | static int display_width, display_lines, form_feed; |
185 | const static int *row_width; | ||
184 | static DEFINE_SPINLOCK(progress_lock); | 186 | static DEFINE_SPINLOCK(progress_lock); |
185 | static int current_line; | 187 | static int current_line; |
186 | static int pending_newline = 0; /* did last write end with unprinted newline? */ | 188 | static int pending_newline = 0; /* did last write end with unprinted newline? */ |
@@ -191,16 +193,16 @@ void rtas_progress(char *s, unsigned short hex) | |||
191 | if (display_width == 0) { | 193 | if (display_width == 0) { |
192 | display_width = 0x10; | 194 | display_width = 0x10; |
193 | if ((root = find_path_device("/rtas"))) { | 195 | if ((root = find_path_device("/rtas"))) { |
194 | if ((p = (unsigned int *)get_property(root, | 196 | if ((p = get_property(root, |
195 | "ibm,display-line-length", NULL))) | 197 | "ibm,display-line-length", NULL))) |
196 | display_width = *p; | 198 | display_width = *p; |
197 | if ((p = (unsigned int *)get_property(root, | 199 | if ((p = get_property(root, |
198 | "ibm,form-feed", NULL))) | 200 | "ibm,form-feed", NULL))) |
199 | form_feed = *p; | 201 | form_feed = *p; |
200 | if ((p = (unsigned int *)get_property(root, | 202 | if ((p = get_property(root, |
201 | "ibm,display-number-of-lines", NULL))) | 203 | "ibm,display-number-of-lines", NULL))) |
202 | display_lines = *p; | 204 | display_lines = *p; |
203 | row_width = (unsigned int *)get_property(root, | 205 | row_width = get_property(root, |
204 | "ibm,display-truncation-length", NULL); | 206 | "ibm,display-truncation-length", NULL); |
205 | } | 207 | } |
206 | display_character = rtas_token("display-character"); | 208 | display_character = rtas_token("display-character"); |
@@ -293,10 +295,10 @@ EXPORT_SYMBOL(rtas_progress); /* needed by rtas_flash module */ | |||
293 | 295 | ||
294 | int rtas_token(const char *service) | 296 | int rtas_token(const char *service) |
295 | { | 297 | { |
296 | int *tokp; | 298 | const int *tokp; |
297 | if (rtas.dev == NULL) | 299 | if (rtas.dev == NULL) |
298 | return RTAS_UNKNOWN_SERVICE; | 300 | return RTAS_UNKNOWN_SERVICE; |
299 | tokp = (int *) get_property(rtas.dev, service, NULL); | 301 | tokp = get_property(rtas.dev, service, NULL); |
300 | return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; | 302 | return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; |
301 | } | 303 | } |
302 | EXPORT_SYMBOL(rtas_token); | 304 | EXPORT_SYMBOL(rtas_token); |
@@ -626,6 +628,9 @@ void rtas_os_term(char *str) | |||
626 | { | 628 | { |
627 | int status; | 629 | int status; |
628 | 630 | ||
631 | if (panic_timeout) | ||
632 | return; | ||
633 | |||
629 | if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term")) | 634 | if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term")) |
630 | return; | 635 | return; |
631 | 636 | ||
@@ -687,15 +692,14 @@ static int rtas_ibm_suspend_me(struct rtas_args *args) | |||
687 | int i; | 692 | int i; |
688 | long state; | 693 | long state; |
689 | long rc; | 694 | long rc; |
690 | unsigned long dummy; | 695 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
691 | |||
692 | struct rtas_suspend_me_data data; | 696 | struct rtas_suspend_me_data data; |
693 | 697 | ||
694 | /* Make sure the state is valid */ | 698 | /* Make sure the state is valid */ |
695 | rc = plpar_hcall(H_VASI_STATE, | 699 | rc = plpar_hcall(H_VASI_STATE, retbuf, |
696 | ((u64)args->args[0] << 32) | args->args[1], | 700 | ((u64)args->args[0] << 32) | args->args[1]); |
697 | 0, 0, 0, | 701 | |
698 | &state, &dummy, &dummy); | 702 | state = retbuf[0]; |
699 | 703 | ||
700 | if (rc) { | 704 | if (rc) { |
701 | printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc); | 705 | printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc); |
@@ -845,15 +849,15 @@ void __init rtas_initialize(void) | |||
845 | */ | 849 | */ |
846 | rtas.dev = of_find_node_by_name(NULL, "rtas"); | 850 | rtas.dev = of_find_node_by_name(NULL, "rtas"); |
847 | if (rtas.dev) { | 851 | if (rtas.dev) { |
848 | u32 *basep, *entryp; | 852 | const u32 *basep, *entryp, *sizep; |
849 | u32 *sizep; | ||
850 | 853 | ||
851 | basep = (u32 *)get_property(rtas.dev, "linux,rtas-base", NULL); | 854 | basep = get_property(rtas.dev, "linux,rtas-base", NULL); |
852 | sizep = (u32 *)get_property(rtas.dev, "rtas-size", NULL); | 855 | sizep = get_property(rtas.dev, "rtas-size", NULL); |
853 | if (basep != NULL && sizep != NULL) { | 856 | if (basep != NULL && sizep != NULL) { |
854 | rtas.base = *basep; | 857 | rtas.base = *basep; |
855 | rtas.size = *sizep; | 858 | rtas.size = *sizep; |
856 | entryp = (u32 *)get_property(rtas.dev, "linux,rtas-entry", NULL); | 859 | entryp = get_property(rtas.dev, |
860 | "linux,rtas-entry", NULL); | ||
857 | if (entryp == NULL) /* Ugh */ | 861 | if (entryp == NULL) /* Ugh */ |
858 | rtas.entry = rtas.base; | 862 | rtas.entry = rtas.base; |
859 | else | 863 | else |
@@ -909,6 +913,11 @@ int __init early_init_dt_scan_rtas(unsigned long node, | |||
909 | basep = of_get_flat_dt_prop(node, "get-term-char", NULL); | 913 | basep = of_get_flat_dt_prop(node, "get-term-char", NULL); |
910 | if (basep) | 914 | if (basep) |
911 | rtas_getchar_token = *basep; | 915 | rtas_getchar_token = *basep; |
916 | |||
917 | if (rtas_putchar_token != RTAS_UNKNOWN_SERVICE && | ||
918 | rtas_getchar_token != RTAS_UNKNOWN_SERVICE) | ||
919 | udbg_init_rtas_console(); | ||
920 | |||
912 | #endif | 921 | #endif |
913 | 922 | ||
914 | /* break now */ | 923 | /* break now */ |
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c index cda022657324..b4a0de79c060 100644 --- a/arch/powerpc/kernel/rtas_pci.c +++ b/arch/powerpc/kernel/rtas_pci.c | |||
@@ -57,7 +57,7 @@ static inline int config_access_valid(struct pci_dn *dn, int where) | |||
57 | 57 | ||
58 | static int of_device_available(struct device_node * dn) | 58 | static int of_device_available(struct device_node * dn) |
59 | { | 59 | { |
60 | char * status; | 60 | const char *status; |
61 | 61 | ||
62 | status = get_property(dn, "status", NULL); | 62 | status = get_property(dn, "status", NULL); |
63 | 63 | ||
@@ -81,8 +81,7 @@ int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) | |||
81 | if (!config_access_valid(pdn, where)) | 81 | if (!config_access_valid(pdn, where)) |
82 | return PCIBIOS_BAD_REGISTER_NUMBER; | 82 | return PCIBIOS_BAD_REGISTER_NUMBER; |
83 | 83 | ||
84 | addr = ((where & 0xf00) << 20) | (pdn->busno << 16) | | 84 | addr = rtas_config_addr(pdn->busno, pdn->devfn, where); |
85 | (pdn->devfn << 8) | (where & 0xff); | ||
86 | buid = pdn->phb->buid; | 85 | buid = pdn->phb->buid; |
87 | if (buid) { | 86 | if (buid) { |
88 | ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, | 87 | ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, |
@@ -134,8 +133,7 @@ int rtas_write_config(struct pci_dn *pdn, int where, int size, u32 val) | |||
134 | if (!config_access_valid(pdn, where)) | 133 | if (!config_access_valid(pdn, where)) |
135 | return PCIBIOS_BAD_REGISTER_NUMBER; | 134 | return PCIBIOS_BAD_REGISTER_NUMBER; |
136 | 135 | ||
137 | addr = ((where & 0xf00) << 20) | (pdn->busno << 16) | | 136 | addr = rtas_config_addr(pdn->busno, pdn->devfn, where); |
138 | (pdn->devfn << 8) | (where & 0xff); | ||
139 | buid = pdn->phb->buid; | 137 | buid = pdn->phb->buid; |
140 | if (buid) { | 138 | if (buid) { |
141 | ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, | 139 | ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, |
@@ -178,7 +176,7 @@ struct pci_ops rtas_pci_ops = { | |||
178 | 176 | ||
179 | int is_python(struct device_node *dev) | 177 | int is_python(struct device_node *dev) |
180 | { | 178 | { |
181 | char *model = (char *)get_property(dev, "model", NULL); | 179 | const char *model = get_property(dev, "model", NULL); |
182 | 180 | ||
183 | if (model && strstr(model, "Python")) | 181 | if (model && strstr(model, "Python")) |
184 | return 1; | 182 | return 1; |
@@ -234,7 +232,7 @@ void __init init_pci_config_tokens (void) | |||
234 | unsigned long __devinit get_phb_buid (struct device_node *phb) | 232 | unsigned long __devinit get_phb_buid (struct device_node *phb) |
235 | { | 233 | { |
236 | int addr_cells; | 234 | int addr_cells; |
237 | unsigned int *buid_vals; | 235 | const unsigned int *buid_vals; |
238 | unsigned int len; | 236 | unsigned int len; |
239 | unsigned long buid; | 237 | unsigned long buid; |
240 | 238 | ||
@@ -247,7 +245,7 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) | |||
247 | if (phb->parent->parent) | 245 | if (phb->parent->parent) |
248 | return 0; | 246 | return 0; |
249 | 247 | ||
250 | buid_vals = (unsigned int *) get_property(phb, "reg", &len); | 248 | buid_vals = get_property(phb, "reg", &len); |
251 | if (buid_vals == NULL) | 249 | if (buid_vals == NULL) |
252 | return 0; | 250 | return 0; |
253 | 251 | ||
@@ -264,10 +262,10 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) | |||
264 | static int phb_set_bus_ranges(struct device_node *dev, | 262 | static int phb_set_bus_ranges(struct device_node *dev, |
265 | struct pci_controller *phb) | 263 | struct pci_controller *phb) |
266 | { | 264 | { |
267 | int *bus_range; | 265 | const int *bus_range; |
268 | unsigned int len; | 266 | unsigned int len; |
269 | 267 | ||
270 | bus_range = (int *) get_property(dev, "bus-range", &len); | 268 | bus_range = get_property(dev, "bus-range", &len); |
271 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 269 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
272 | return 1; | 270 | return 1; |
273 | } | 271 | } |
@@ -325,15 +323,15 @@ unsigned long __init find_and_init_phbs(void) | |||
325 | * in chosen. | 323 | * in chosen. |
326 | */ | 324 | */ |
327 | if (of_chosen) { | 325 | if (of_chosen) { |
328 | int *prop; | 326 | const int *prop; |
329 | 327 | ||
330 | prop = (int *)get_property(of_chosen, "linux,pci-probe-only", | 328 | prop = get_property(of_chosen, |
331 | NULL); | 329 | "linux,pci-probe-only", NULL); |
332 | if (prop) | 330 | if (prop) |
333 | pci_probe_only = *prop; | 331 | pci_probe_only = *prop; |
334 | 332 | ||
335 | prop = (int *)get_property(of_chosen, | 333 | prop = get_property(of_chosen, |
336 | "linux,pci-assign-all-buses", NULL); | 334 | "linux,pci-assign-all-buses", NULL); |
337 | if (prop) | 335 | if (prop) |
338 | pci_assign_all_buses = *prop; | 336 | pci_assign_all_buses = *prop; |
339 | } | 337 | } |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 499c3861074f..0af3fc1bdcc9 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -304,19 +304,21 @@ struct seq_operations cpuinfo_op = { | |||
304 | void __init check_for_initrd(void) | 304 | void __init check_for_initrd(void) |
305 | { | 305 | { |
306 | #ifdef CONFIG_BLK_DEV_INITRD | 306 | #ifdef CONFIG_BLK_DEV_INITRD |
307 | unsigned long *prop; | 307 | const unsigned int *prop; |
308 | int len; | ||
308 | 309 | ||
309 | DBG(" -> check_for_initrd()\n"); | 310 | DBG(" -> check_for_initrd()\n"); |
310 | 311 | ||
311 | if (of_chosen) { | 312 | if (of_chosen) { |
312 | prop = (unsigned long *)get_property(of_chosen, | 313 | prop = get_property(of_chosen, "linux,initrd-start", &len); |
313 | "linux,initrd-start", NULL); | ||
314 | if (prop != NULL) { | 314 | if (prop != NULL) { |
315 | initrd_start = (unsigned long)__va(*prop); | 315 | initrd_start = (unsigned long) |
316 | prop = (unsigned long *)get_property(of_chosen, | 316 | __va(of_read_ulong(prop, len / 4)); |
317 | "linux,initrd-end", NULL); | 317 | prop = get_property(of_chosen, |
318 | "linux,initrd-end", &len); | ||
318 | if (prop != NULL) { | 319 | if (prop != NULL) { |
319 | initrd_end = (unsigned long)__va(*prop); | 320 | initrd_end = (unsigned long) |
321 | __va(of_read_ulong(prop, len / 4)); | ||
320 | initrd_below_start_ok = 1; | 322 | initrd_below_start_ok = 1; |
321 | } else | 323 | } else |
322 | initrd_start = 0; | 324 | initrd_start = 0; |
@@ -366,15 +368,14 @@ void __init smp_setup_cpu_maps(void) | |||
366 | int cpu = 0; | 368 | int cpu = 0; |
367 | 369 | ||
368 | while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { | 370 | while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { |
369 | int *intserv; | 371 | const int *intserv; |
370 | int j, len = sizeof(u32), nthreads = 1; | 372 | int j, len = sizeof(u32), nthreads = 1; |
371 | 373 | ||
372 | intserv = (int *)get_property(dn, "ibm,ppc-interrupt-server#s", | 374 | intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len); |
373 | &len); | ||
374 | if (intserv) | 375 | if (intserv) |
375 | nthreads = len / sizeof(int); | 376 | nthreads = len / sizeof(int); |
376 | else { | 377 | else { |
377 | intserv = (int *) get_property(dn, "reg", NULL); | 378 | intserv = get_property(dn, "reg", NULL); |
378 | if (!intserv) | 379 | if (!intserv) |
379 | intserv = &cpu; /* assume logical == phys */ | 380 | intserv = &cpu; /* assume logical == phys */ |
380 | } | 381 | } |
@@ -395,13 +396,12 @@ void __init smp_setup_cpu_maps(void) | |||
395 | if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && | 396 | if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && |
396 | (dn = of_find_node_by_path("/rtas"))) { | 397 | (dn = of_find_node_by_path("/rtas"))) { |
397 | int num_addr_cell, num_size_cell, maxcpus; | 398 | int num_addr_cell, num_size_cell, maxcpus; |
398 | unsigned int *ireg; | 399 | const unsigned int *ireg; |
399 | 400 | ||
400 | num_addr_cell = prom_n_addr_cells(dn); | 401 | num_addr_cell = prom_n_addr_cells(dn); |
401 | num_size_cell = prom_n_size_cells(dn); | 402 | num_size_cell = prom_n_size_cells(dn); |
402 | 403 | ||
403 | ireg = (unsigned int *) | 404 | ireg = get_property(dn, "ibm,lrdr-capacity", NULL); |
404 | get_property(dn, "ibm,lrdr-capacity", NULL); | ||
405 | 405 | ||
406 | if (!ireg) | 406 | if (!ireg) |
407 | goto out; | 407 | goto out; |
@@ -444,6 +444,8 @@ void __init smp_setup_cpu_maps(void) | |||
444 | 444 | ||
445 | int __initdata do_early_xmon; | 445 | int __initdata do_early_xmon; |
446 | #ifdef CONFIG_XMON | 446 | #ifdef CONFIG_XMON |
447 | extern int xmon_no_auto_backtrace; | ||
448 | |||
447 | static int __init early_xmon(char *p) | 449 | static int __init early_xmon(char *p) |
448 | { | 450 | { |
449 | /* ensure xmon is enabled */ | 451 | /* ensure xmon is enabled */ |
@@ -452,6 +454,8 @@ static int __init early_xmon(char *p) | |||
452 | xmon_init(1); | 454 | xmon_init(1); |
453 | if (strncmp(p, "off", 3) == 0) | 455 | if (strncmp(p, "off", 3) == 0) |
454 | xmon_init(0); | 456 | xmon_init(0); |
457 | if (strncmp(p, "nobt", 4) == 0) | ||
458 | xmon_no_auto_backtrace = 1; | ||
455 | if (strncmp(p, "early", 5) != 0) | 459 | if (strncmp(p, "early", 5) != 0) |
456 | return 0; | 460 | return 0; |
457 | } | 461 | } |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index fd1785e4c9bb..00d6b8addd78 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -56,7 +56,6 @@ | |||
56 | #include <asm/page.h> | 56 | #include <asm/page.h> |
57 | #include <asm/mmu.h> | 57 | #include <asm/mmu.h> |
58 | #include <asm/lmb.h> | 58 | #include <asm/lmb.h> |
59 | #include <asm/iseries/it_lp_naca.h> | ||
60 | #include <asm/firmware.h> | 59 | #include <asm/firmware.h> |
61 | #include <asm/xmon.h> | 60 | #include <asm/xmon.h> |
62 | #include <asm/udbg.h> | 61 | #include <asm/udbg.h> |
@@ -79,10 +78,10 @@ u64 ppc64_pft_size; | |||
79 | * before we've read this from the device tree. | 78 | * before we've read this from the device tree. |
80 | */ | 79 | */ |
81 | struct ppc64_caches ppc64_caches = { | 80 | struct ppc64_caches ppc64_caches = { |
82 | .dline_size = 0x80, | 81 | .dline_size = 0x40, |
83 | .log_dline_size = 7, | 82 | .log_dline_size = 6, |
84 | .iline_size = 0x80, | 83 | .iline_size = 0x40, |
85 | .log_iline_size = 7 | 84 | .log_iline_size = 6 |
86 | }; | 85 | }; |
87 | EXPORT_SYMBOL_GPL(ppc64_caches); | 86 | EXPORT_SYMBOL_GPL(ppc64_caches); |
88 | 87 | ||
@@ -107,7 +106,7 @@ static int smt_enabled_cmdline; | |||
107 | static void check_smt_enabled(void) | 106 | static void check_smt_enabled(void) |
108 | { | 107 | { |
109 | struct device_node *dn; | 108 | struct device_node *dn; |
110 | char *smt_option; | 109 | const char *smt_option; |
111 | 110 | ||
112 | /* Allow the command line to overrule the OF option */ | 111 | /* Allow the command line to overrule the OF option */ |
113 | if (smt_enabled_cmdline) | 112 | if (smt_enabled_cmdline) |
@@ -116,7 +115,7 @@ static void check_smt_enabled(void) | |||
116 | dn = of_find_node_by_path("/options"); | 115 | dn = of_find_node_by_path("/options"); |
117 | 116 | ||
118 | if (dn) { | 117 | if (dn) { |
119 | smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL); | 118 | smt_option = get_property(dn, "ibm,smt-enabled", NULL); |
120 | 119 | ||
121 | if (smt_option) { | 120 | if (smt_option) { |
122 | if (!strcmp(smt_option, "on")) | 121 | if (!strcmp(smt_option, "on")) |
@@ -293,7 +292,7 @@ static void __init initialize_cache_info(void) | |||
293 | */ | 292 | */ |
294 | 293 | ||
295 | if ( num_cpus == 1 ) { | 294 | if ( num_cpus == 1 ) { |
296 | u32 *sizep, *lsizep; | 295 | const u32 *sizep, *lsizep; |
297 | u32 size, lsize; | 296 | u32 size, lsize; |
298 | const char *dc, *ic; | 297 | const char *dc, *ic; |
299 | 298 | ||
@@ -308,10 +307,10 @@ static void __init initialize_cache_info(void) | |||
308 | 307 | ||
309 | size = 0; | 308 | size = 0; |
310 | lsize = cur_cpu_spec->dcache_bsize; | 309 | lsize = cur_cpu_spec->dcache_bsize; |
311 | sizep = (u32 *)get_property(np, "d-cache-size", NULL); | 310 | sizep = get_property(np, "d-cache-size", NULL); |
312 | if (sizep != NULL) | 311 | if (sizep != NULL) |
313 | size = *sizep; | 312 | size = *sizep; |
314 | lsizep = (u32 *) get_property(np, dc, NULL); | 313 | lsizep = get_property(np, dc, NULL); |
315 | if (lsizep != NULL) | 314 | if (lsizep != NULL) |
316 | lsize = *lsizep; | 315 | lsize = *lsizep; |
317 | if (sizep == 0 || lsizep == 0) | 316 | if (sizep == 0 || lsizep == 0) |
@@ -325,10 +324,10 @@ static void __init initialize_cache_info(void) | |||
325 | 324 | ||
326 | size = 0; | 325 | size = 0; |
327 | lsize = cur_cpu_spec->icache_bsize; | 326 | lsize = cur_cpu_spec->icache_bsize; |
328 | sizep = (u32 *)get_property(np, "i-cache-size", NULL); | 327 | sizep = get_property(np, "i-cache-size", NULL); |
329 | if (sizep != NULL) | 328 | if (sizep != NULL) |
330 | size = *sizep; | 329 | size = *sizep; |
331 | lsizep = (u32 *)get_property(np, ic, NULL); | 330 | lsizep = get_property(np, ic, NULL); |
332 | if (lsizep != NULL) | 331 | if (lsizep != NULL) |
333 | lsize = *lsizep; | 332 | lsize = *lsizep; |
334 | if (sizep == 0 || lsizep == 0) | 333 | if (sizep == 0 || lsizep == 0) |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index fec228cd0163..406f308ddead 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -60,7 +60,7 @@ static int smt_snooze_cmdline; | |||
60 | static int __init smt_setup(void) | 60 | static int __init smt_setup(void) |
61 | { | 61 | { |
62 | struct device_node *options; | 62 | struct device_node *options; |
63 | unsigned int *val; | 63 | const unsigned int *val; |
64 | unsigned int cpu; | 64 | unsigned int cpu; |
65 | 65 | ||
66 | if (!cpu_has_feature(CPU_FTR_SMT)) | 66 | if (!cpu_has_feature(CPU_FTR_SMT)) |
@@ -70,8 +70,7 @@ static int __init smt_setup(void) | |||
70 | if (!options) | 70 | if (!options) |
71 | return -ENODEV; | 71 | return -ENODEV; |
72 | 72 | ||
73 | val = (unsigned int *)get_property(options, "ibm,smt-snooze-delay", | 73 | val = get_property(options, "ibm,smt-snooze-delay", NULL); |
74 | NULL); | ||
75 | if (!smt_snooze_cmdline && val) { | 74 | if (!smt_snooze_cmdline && val) { |
76 | for_each_possible_cpu(cpu) | 75 | for_each_possible_cpu(cpu) |
77 | per_cpu(smt_snooze_delay, cpu) = *val; | 76 | per_cpu(smt_snooze_delay, cpu) = *val; |
@@ -231,7 +230,7 @@ static void register_cpu_online(unsigned int cpu) | |||
231 | if (cur_cpu_spec->num_pmcs >= 8) | 230 | if (cur_cpu_spec->num_pmcs >= 8) |
232 | sysdev_create_file(s, &attr_pmc8); | 231 | sysdev_create_file(s, &attr_pmc8); |
233 | 232 | ||
234 | if (cpu_has_feature(CPU_FTR_SMT)) | 233 | if (cpu_has_feature(CPU_FTR_PURR)) |
235 | sysdev_create_file(s, &attr_purr); | 234 | sysdev_create_file(s, &attr_purr); |
236 | } | 235 | } |
237 | 236 | ||
@@ -273,7 +272,7 @@ static void unregister_cpu_online(unsigned int cpu) | |||
273 | if (cur_cpu_spec->num_pmcs >= 8) | 272 | if (cur_cpu_spec->num_pmcs >= 8) |
274 | sysdev_remove_file(s, &attr_pmc8); | 273 | sysdev_remove_file(s, &attr_pmc8); |
275 | 274 | ||
276 | if (cpu_has_feature(CPU_FTR_SMT)) | 275 | if (cpu_has_feature(CPU_FTR_PURR)) |
277 | sysdev_remove_file(s, &attr_purr); | 276 | sysdev_remove_file(s, &attr_purr); |
278 | } | 277 | } |
279 | #endif /* CONFIG_HOTPLUG_CPU */ | 278 | #endif /* CONFIG_HOTPLUG_CPU */ |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index a124499e65d9..7a3c3f791ade 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -860,19 +860,17 @@ EXPORT_SYMBOL(do_settimeofday); | |||
860 | static int __init get_freq(char *name, int cells, unsigned long *val) | 860 | static int __init get_freq(char *name, int cells, unsigned long *val) |
861 | { | 861 | { |
862 | struct device_node *cpu; | 862 | struct device_node *cpu; |
863 | unsigned int *fp; | 863 | const unsigned int *fp; |
864 | int found = 0; | 864 | int found = 0; |
865 | 865 | ||
866 | /* The cpu node should have timebase and clock frequency properties */ | 866 | /* The cpu node should have timebase and clock frequency properties */ |
867 | cpu = of_find_node_by_type(NULL, "cpu"); | 867 | cpu = of_find_node_by_type(NULL, "cpu"); |
868 | 868 | ||
869 | if (cpu) { | 869 | if (cpu) { |
870 | fp = (unsigned int *)get_property(cpu, name, NULL); | 870 | fp = get_property(cpu, name, NULL); |
871 | if (fp) { | 871 | if (fp) { |
872 | found = 1; | 872 | found = 1; |
873 | *val = 0; | 873 | *val = of_read_ulong(fp, cells); |
874 | while (cells--) | ||
875 | *val = (*val << 32) | *fp++; | ||
876 | } | 874 | } |
877 | 875 | ||
878 | of_node_put(cpu); | 876 | of_node_put(cpu); |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 9b352bd0a460..d9f10f2fc372 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -598,6 +598,9 @@ static void parse_fpe(struct pt_regs *regs) | |||
598 | #define INST_STSWI 0x7c0005aa | 598 | #define INST_STSWI 0x7c0005aa |
599 | #define INST_STSWX 0x7c00052a | 599 | #define INST_STSWX 0x7c00052a |
600 | 600 | ||
601 | #define INST_POPCNTB 0x7c0000f4 | ||
602 | #define INST_POPCNTB_MASK 0xfc0007fe | ||
603 | |||
601 | static int emulate_string_inst(struct pt_regs *regs, u32 instword) | 604 | static int emulate_string_inst(struct pt_regs *regs, u32 instword) |
602 | { | 605 | { |
603 | u8 rT = (instword >> 21) & 0x1f; | 606 | u8 rT = (instword >> 21) & 0x1f; |
@@ -666,6 +669,23 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword) | |||
666 | return 0; | 669 | return 0; |
667 | } | 670 | } |
668 | 671 | ||
672 | static int emulate_popcntb_inst(struct pt_regs *regs, u32 instword) | ||
673 | { | ||
674 | u32 ra,rs; | ||
675 | unsigned long tmp; | ||
676 | |||
677 | ra = (instword >> 16) & 0x1f; | ||
678 | rs = (instword >> 21) & 0x1f; | ||
679 | |||
680 | tmp = regs->gpr[rs]; | ||
681 | tmp = tmp - ((tmp >> 1) & 0x5555555555555555ULL); | ||
682 | tmp = (tmp & 0x3333333333333333ULL) + ((tmp >> 2) & 0x3333333333333333ULL); | ||
683 | tmp = (tmp + (tmp >> 4)) & 0x0f0f0f0f0f0f0f0fULL; | ||
684 | regs->gpr[ra] = tmp; | ||
685 | |||
686 | return 0; | ||
687 | } | ||
688 | |||
669 | static int emulate_instruction(struct pt_regs *regs) | 689 | static int emulate_instruction(struct pt_regs *regs) |
670 | { | 690 | { |
671 | u32 instword; | 691 | u32 instword; |
@@ -703,6 +723,11 @@ static int emulate_instruction(struct pt_regs *regs) | |||
703 | if ((instword & INST_STRING_GEN_MASK) == INST_STRING) | 723 | if ((instword & INST_STRING_GEN_MASK) == INST_STRING) |
704 | return emulate_string_inst(regs, instword); | 724 | return emulate_string_inst(regs, instword); |
705 | 725 | ||
726 | /* Emulate the popcntb (Population Count Bytes) instruction. */ | ||
727 | if ((instword & INST_POPCNTB_MASK) == INST_POPCNTB) { | ||
728 | return emulate_popcntb_inst(regs, instword); | ||
729 | } | ||
730 | |||
706 | return -EINVAL; | 731 | return -EINVAL; |
707 | } | 732 | } |
708 | 733 | ||
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index fad8580f9081..cb87e71eec66 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -77,7 +77,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) | |||
77 | } else | 77 | } else |
78 | #endif | 78 | #endif |
79 | { | 79 | { |
80 | unsigned char *dma_window; | 80 | const unsigned char *dma_window; |
81 | struct iommu_table *tbl; | 81 | struct iommu_table *tbl; |
82 | unsigned long offset, size; | 82 | unsigned long offset, size; |
83 | 83 | ||
@@ -217,7 +217,7 @@ static void __devinit vio_dev_release(struct device *dev) | |||
217 | struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) | 217 | struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) |
218 | { | 218 | { |
219 | struct vio_dev *viodev; | 219 | struct vio_dev *viodev; |
220 | unsigned int *unit_address; | 220 | const unsigned int *unit_address; |
221 | 221 | ||
222 | /* we need the 'device_type' property, in order to match with drivers */ | 222 | /* we need the 'device_type' property, in order to match with drivers */ |
223 | if (of_node->type == NULL) { | 223 | if (of_node->type == NULL) { |
@@ -227,7 +227,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) | |||
227 | return NULL; | 227 | return NULL; |
228 | } | 228 | } |
229 | 229 | ||
230 | unit_address = (unsigned int *)get_property(of_node, "reg", NULL); | 230 | unit_address = get_property(of_node, "reg", NULL); |
231 | if (unit_address == NULL) { | 231 | if (unit_address == NULL) { |
232 | printk(KERN_WARNING "%s: node %s missing 'reg'\n", | 232 | printk(KERN_WARNING "%s: node %s missing 'reg'\n", |
233 | __FUNCTION__, | 233 | __FUNCTION__, |
@@ -249,7 +249,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) | |||
249 | viodev->type = of_node->type; | 249 | viodev->type = of_node->type; |
250 | viodev->unit_address = *unit_address; | 250 | viodev->unit_address = *unit_address; |
251 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { | 251 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { |
252 | unit_address = (unsigned int *)get_property(of_node, | 252 | unit_address = get_property(of_node, |
253 | "linux,unit_address", NULL); | 253 | "linux,unit_address", NULL); |
254 | if (unit_address != NULL) | 254 | if (unit_address != NULL) |
255 | viodev->unit_address = *unit_address; | 255 | viodev->unit_address = *unit_address; |
@@ -423,7 +423,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, | |||
423 | { | 423 | { |
424 | const struct vio_dev *vio_dev = to_vio_dev(dev); | 424 | const struct vio_dev *vio_dev = to_vio_dev(dev); |
425 | struct device_node *dn = dev->platform_data; | 425 | struct device_node *dn = dev->platform_data; |
426 | char *cp; | 426 | const char *cp; |
427 | int length; | 427 | int length; |
428 | 428 | ||
429 | if (!num_envp) | 429 | if (!num_envp) |
@@ -431,7 +431,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, | |||
431 | 431 | ||
432 | if (!dn) | 432 | if (!dn) |
433 | return -ENODEV; | 433 | return -ENODEV; |
434 | cp = (char *)get_property(dn, "compatible", &length); | 434 | cp = get_property(dn, "compatible", &length); |
435 | if (!cp) | 435 | if (!cp) |
436 | return -ENODEV; | 436 | return -ENODEV; |
437 | 437 | ||
@@ -493,11 +493,11 @@ static struct vio_dev *vio_find_name(const char *kobj_name) | |||
493 | */ | 493 | */ |
494 | struct vio_dev *vio_find_node(struct device_node *vnode) | 494 | struct vio_dev *vio_find_node(struct device_node *vnode) |
495 | { | 495 | { |
496 | uint32_t *unit_address; | 496 | const uint32_t *unit_address; |
497 | char kobj_name[BUS_ID_SIZE]; | 497 | char kobj_name[BUS_ID_SIZE]; |
498 | 498 | ||
499 | /* construct the kobject name from the device node */ | 499 | /* construct the kobject name from the device node */ |
500 | unit_address = (uint32_t *)get_property(vnode, "reg", NULL); | 500 | unit_address = get_property(vnode, "reg", NULL); |
501 | if (!unit_address) | 501 | if (!unit_address) |
502 | return NULL; | 502 | return NULL; |
503 | snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); | 503 | snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); |
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index ff7096458249..336dd191f768 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile | |||
@@ -14,7 +14,6 @@ endif | |||
14 | obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \ | 14 | obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \ |
15 | memcpy_64.o usercopy_64.o mem_64.o string.o \ | 15 | memcpy_64.o usercopy_64.o mem_64.o string.o \ |
16 | strcase.o | 16 | strcase.o |
17 | obj-$(CONFIG_PPC_ISERIES) += e2a.o | ||
18 | obj-$(CONFIG_XMON) += sstep.o | 17 | obj-$(CONFIG_XMON) += sstep.o |
19 | 18 | ||
20 | ifeq ($(CONFIG_PPC64),y) | 19 | ifeq ($(CONFIG_PPC64),y) |
diff --git a/arch/powerpc/lib/e2a.c b/arch/powerpc/lib/e2a.c deleted file mode 100644 index 4b72ed8fd50e..000000000000 --- a/arch/powerpc/lib/e2a.c +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /* | ||
2 | * EBCDIC to ASCII conversion | ||
3 | * | ||
4 | * This function moved here from arch/powerpc/platforms/iseries/viopath.c | ||
5 | * | ||
6 | * (C) Copyright 2000-2004 IBM Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License as | ||
10 | * published by the Free Software Foundation; either version 2 of the | ||
11 | * License, or (at your option) anyu later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * 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 Foundation, | ||
20 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #include <linux/module.h> | ||
25 | |||
26 | unsigned char e2a(unsigned char x) | ||
27 | { | ||
28 | switch (x) { | ||
29 | case 0xF0: | ||
30 | return '0'; | ||
31 | case 0xF1: | ||
32 | return '1'; | ||
33 | case 0xF2: | ||
34 | return '2'; | ||
35 | case 0xF3: | ||
36 | return '3'; | ||
37 | case 0xF4: | ||
38 | return '4'; | ||
39 | case 0xF5: | ||
40 | return '5'; | ||
41 | case 0xF6: | ||
42 | return '6'; | ||
43 | case 0xF7: | ||
44 | return '7'; | ||
45 | case 0xF8: | ||
46 | return '8'; | ||
47 | case 0xF9: | ||
48 | return '9'; | ||
49 | case 0xC1: | ||
50 | return 'A'; | ||
51 | case 0xC2: | ||
52 | return 'B'; | ||
53 | case 0xC3: | ||
54 | return 'C'; | ||
55 | case 0xC4: | ||
56 | return 'D'; | ||
57 | case 0xC5: | ||
58 | return 'E'; | ||
59 | case 0xC6: | ||
60 | return 'F'; | ||
61 | case 0xC7: | ||
62 | return 'G'; | ||
63 | case 0xC8: | ||
64 | return 'H'; | ||
65 | case 0xC9: | ||
66 | return 'I'; | ||
67 | case 0xD1: | ||
68 | return 'J'; | ||
69 | case 0xD2: | ||
70 | return 'K'; | ||
71 | case 0xD3: | ||
72 | return 'L'; | ||
73 | case 0xD4: | ||
74 | return 'M'; | ||
75 | case 0xD5: | ||
76 | return 'N'; | ||
77 | case 0xD6: | ||
78 | return 'O'; | ||
79 | case 0xD7: | ||
80 | return 'P'; | ||
81 | case 0xD8: | ||
82 | return 'Q'; | ||
83 | case 0xD9: | ||
84 | return 'R'; | ||
85 | case 0xE2: | ||
86 | return 'S'; | ||
87 | case 0xE3: | ||
88 | return 'T'; | ||
89 | case 0xE4: | ||
90 | return 'U'; | ||
91 | case 0xE5: | ||
92 | return 'V'; | ||
93 | case 0xE6: | ||
94 | return 'W'; | ||
95 | case 0xE7: | ||
96 | return 'X'; | ||
97 | case 0xE8: | ||
98 | return 'Y'; | ||
99 | case 0xE9: | ||
100 | return 'Z'; | ||
101 | } | ||
102 | return ' '; | ||
103 | } | ||
104 | EXPORT_SYMBOL(e2a); | ||
105 | |||
106 | unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n) | ||
107 | { | ||
108 | int i; | ||
109 | |||
110 | n = strnlen(src, n); | ||
111 | |||
112 | for (i = 0; i < n; i++) | ||
113 | dest[i] = e2a(src[i]); | ||
114 | |||
115 | return dest; | ||
116 | } | ||
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c index 077bed7dc52b..80b482ca30df 100644 --- a/arch/powerpc/lib/locks.c +++ b/arch/powerpc/lib/locks.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/hvcall.h> | 23 | #include <asm/hvcall.h> |
24 | #include <asm/iseries/hv_call.h> | 24 | #include <asm/iseries/hv_call.h> |
25 | #include <asm/smp.h> | 25 | #include <asm/smp.h> |
26 | #include <asm/firmware.h> | ||
26 | 27 | ||
27 | void __spin_yield(raw_spinlock_t *lock) | 28 | void __spin_yield(raw_spinlock_t *lock) |
28 | { | 29 | { |
@@ -39,13 +40,12 @@ void __spin_yield(raw_spinlock_t *lock) | |||
39 | rmb(); | 40 | rmb(); |
40 | if (lock->slock != lock_value) | 41 | if (lock->slock != lock_value) |
41 | return; /* something has changed */ | 42 | return; /* something has changed */ |
42 | #ifdef CONFIG_PPC_ISERIES | 43 | if (firmware_has_feature(FW_FEATURE_ISERIES)) |
43 | HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, | 44 | HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, |
44 | ((u64)holder_cpu << 32) | yield_count); | 45 | ((u64)holder_cpu << 32) | yield_count); |
45 | #else | 46 | else |
46 | plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu), | 47 | plpar_hcall_norets(H_CONFER, |
47 | yield_count); | 48 | get_hard_smp_processor_id(holder_cpu), yield_count); |
48 | #endif | ||
49 | } | 49 | } |
50 | 50 | ||
51 | /* | 51 | /* |
@@ -69,13 +69,12 @@ void __rw_yield(raw_rwlock_t *rw) | |||
69 | rmb(); | 69 | rmb(); |
70 | if (rw->lock != lock_value) | 70 | if (rw->lock != lock_value) |
71 | return; /* something has changed */ | 71 | return; /* something has changed */ |
72 | #ifdef CONFIG_PPC_ISERIES | 72 | if (firmware_has_feature(FW_FEATURE_ISERIES)) |
73 | HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, | 73 | HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, |
74 | ((u64)holder_cpu << 32) | yield_count); | 74 | ((u64)holder_cpu << 32) | yield_count); |
75 | #else | 75 | else |
76 | plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu), | 76 | plpar_hcall_norets(H_CONFER, |
77 | yield_count); | 77 | get_hard_smp_processor_id(holder_cpu), yield_count); |
78 | #endif | ||
79 | } | 78 | } |
80 | #endif | 79 | #endif |
81 | 80 | ||
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index fbe23933f731..6c0f1c7d83e5 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -159,12 +159,12 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) | |||
159 | { | 159 | { |
160 | unsigned int hw_cpuid = get_hard_smp_processor_id(cpu); | 160 | unsigned int hw_cpuid = get_hard_smp_processor_id(cpu); |
161 | struct device_node *cpu_node = NULL; | 161 | struct device_node *cpu_node = NULL; |
162 | unsigned int *interrupt_server, *reg; | 162 | const unsigned int *interrupt_server, *reg; |
163 | int len; | 163 | int len; |
164 | 164 | ||
165 | while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) { | 165 | while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) { |
166 | /* Try interrupt server first */ | 166 | /* Try interrupt server first */ |
167 | interrupt_server = (unsigned int *)get_property(cpu_node, | 167 | interrupt_server = get_property(cpu_node, |
168 | "ibm,ppc-interrupt-server#s", &len); | 168 | "ibm,ppc-interrupt-server#s", &len); |
169 | 169 | ||
170 | len = len / sizeof(u32); | 170 | len = len / sizeof(u32); |
@@ -175,8 +175,7 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) | |||
175 | return cpu_node; | 175 | return cpu_node; |
176 | } | 176 | } |
177 | } else { | 177 | } else { |
178 | reg = (unsigned int *)get_property(cpu_node, | 178 | reg = get_property(cpu_node, "reg", &len); |
179 | "reg", &len); | ||
180 | if (reg && (len > 0) && (reg[0] == hw_cpuid)) | 179 | if (reg && (len > 0) && (reg[0] == hw_cpuid)) |
181 | return cpu_node; | 180 | return cpu_node; |
182 | } | 181 | } |
@@ -186,9 +185,9 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) | |||
186 | } | 185 | } |
187 | 186 | ||
188 | /* must hold reference to node during call */ | 187 | /* must hold reference to node during call */ |
189 | static int *of_get_associativity(struct device_node *dev) | 188 | static const int *of_get_associativity(struct device_node *dev) |
190 | { | 189 | { |
191 | return (unsigned int *)get_property(dev, "ibm,associativity", NULL); | 190 | return get_property(dev, "ibm,associativity", NULL); |
192 | } | 191 | } |
193 | 192 | ||
194 | /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa | 193 | /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa |
@@ -197,7 +196,7 @@ static int *of_get_associativity(struct device_node *dev) | |||
197 | static int of_node_to_nid_single(struct device_node *device) | 196 | static int of_node_to_nid_single(struct device_node *device) |
198 | { | 197 | { |
199 | int nid = -1; | 198 | int nid = -1; |
200 | unsigned int *tmp; | 199 | const unsigned int *tmp; |
201 | 200 | ||
202 | if (min_common_depth == -1) | 201 | if (min_common_depth == -1) |
203 | goto out; | 202 | goto out; |
@@ -255,7 +254,7 @@ EXPORT_SYMBOL_GPL(of_node_to_nid); | |||
255 | static int __init find_min_common_depth(void) | 254 | static int __init find_min_common_depth(void) |
256 | { | 255 | { |
257 | int depth; | 256 | int depth; |
258 | unsigned int *ref_points; | 257 | const unsigned int *ref_points; |
259 | struct device_node *rtas_root; | 258 | struct device_node *rtas_root; |
260 | unsigned int len; | 259 | unsigned int len; |
261 | 260 | ||
@@ -270,7 +269,7 @@ static int __init find_min_common_depth(void) | |||
270 | * configuration (should be all 0's) and the second is for a normal | 269 | * configuration (should be all 0's) and the second is for a normal |
271 | * NUMA configuration. | 270 | * NUMA configuration. |
272 | */ | 271 | */ |
273 | ref_points = (unsigned int *)get_property(rtas_root, | 272 | ref_points = get_property(rtas_root, |
274 | "ibm,associativity-reference-points", &len); | 273 | "ibm,associativity-reference-points", &len); |
275 | 274 | ||
276 | if ((len >= 1) && ref_points) { | 275 | if ((len >= 1) && ref_points) { |
@@ -297,7 +296,7 @@ static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells) | |||
297 | of_node_put(memory); | 296 | of_node_put(memory); |
298 | } | 297 | } |
299 | 298 | ||
300 | static unsigned long __devinit read_n_cells(int n, unsigned int **buf) | 299 | static unsigned long __devinit read_n_cells(int n, const unsigned int **buf) |
301 | { | 300 | { |
302 | unsigned long result = 0; | 301 | unsigned long result = 0; |
303 | 302 | ||
@@ -435,15 +434,13 @@ static int __init parse_numa_properties(void) | |||
435 | unsigned long size; | 434 | unsigned long size; |
436 | int nid; | 435 | int nid; |
437 | int ranges; | 436 | int ranges; |
438 | unsigned int *memcell_buf; | 437 | const unsigned int *memcell_buf; |
439 | unsigned int len; | 438 | unsigned int len; |
440 | 439 | ||
441 | memcell_buf = (unsigned int *)get_property(memory, | 440 | memcell_buf = get_property(memory, |
442 | "linux,usable-memory", &len); | 441 | "linux,usable-memory", &len); |
443 | if (!memcell_buf || len <= 0) | 442 | if (!memcell_buf || len <= 0) |
444 | memcell_buf = | 443 | memcell_buf = get_property(memory, "reg", &len); |
445 | (unsigned int *)get_property(memory, "reg", | ||
446 | &len); | ||
447 | if (!memcell_buf || len <= 0) | 444 | if (!memcell_buf || len <= 0) |
448 | continue; | 445 | continue; |
449 | 446 | ||
@@ -787,10 +784,10 @@ int hot_add_scn_to_nid(unsigned long scn_addr) | |||
787 | while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { | 784 | while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { |
788 | unsigned long start, size; | 785 | unsigned long start, size; |
789 | int ranges; | 786 | int ranges; |
790 | unsigned int *memcell_buf; | 787 | const unsigned int *memcell_buf; |
791 | unsigned int len; | 788 | unsigned int len; |
792 | 789 | ||
793 | memcell_buf = (unsigned int *)get_property(memory, "reg", &len); | 790 | memcell_buf = get_property(memory, "reg", &len); |
794 | if (!memcell_buf || len <= 0) | 791 | if (!memcell_buf || len <= 0) |
795 | continue; | 792 | continue; |
796 | 793 | ||
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index de0c8842415c..d3733912adb4 100644 --- a/arch/powerpc/mm/slb.c +++ b/arch/powerpc/mm/slb.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <asm/paca.h> | 22 | #include <asm/paca.h> |
23 | #include <asm/cputable.h> | 23 | #include <asm/cputable.h> |
24 | #include <asm/cacheflush.h> | 24 | #include <asm/cacheflush.h> |
25 | #include <asm/smp.h> | ||
26 | #include <linux/compiler.h> | ||
25 | 27 | ||
26 | #ifdef DEBUG | 28 | #ifdef DEBUG |
27 | #define DBG(fmt...) udbg_printf(fmt) | 29 | #define DBG(fmt...) udbg_printf(fmt) |
@@ -50,9 +52,32 @@ static inline unsigned long mk_vsid_data(unsigned long ea, unsigned long flags) | |||
50 | return (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | flags; | 52 | return (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | flags; |
51 | } | 53 | } |
52 | 54 | ||
53 | static inline void create_slbe(unsigned long ea, unsigned long flags, | 55 | static inline void slb_shadow_update(unsigned long esid, unsigned long vsid, |
54 | unsigned long entry) | 56 | unsigned long entry) |
55 | { | 57 | { |
58 | /* | ||
59 | * Clear the ESID first so the entry is not valid while we are | ||
60 | * updating it. | ||
61 | */ | ||
62 | get_slb_shadow()->save_area[entry].esid = 0; | ||
63 | barrier(); | ||
64 | get_slb_shadow()->save_area[entry].vsid = vsid; | ||
65 | barrier(); | ||
66 | get_slb_shadow()->save_area[entry].esid = esid; | ||
67 | |||
68 | } | ||
69 | |||
70 | static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags, | ||
71 | unsigned long entry) | ||
72 | { | ||
73 | /* | ||
74 | * Updating the shadow buffer before writing the SLB ensures | ||
75 | * we don't get a stale entry here if we get preempted by PHYP | ||
76 | * between these two statements. | ||
77 | */ | ||
78 | slb_shadow_update(mk_esid_data(ea, entry), mk_vsid_data(ea, flags), | ||
79 | entry); | ||
80 | |||
56 | asm volatile("slbmte %0,%1" : | 81 | asm volatile("slbmte %0,%1" : |
57 | : "r" (mk_vsid_data(ea, flags)), | 82 | : "r" (mk_vsid_data(ea, flags)), |
58 | "r" (mk_esid_data(ea, entry)) | 83 | "r" (mk_esid_data(ea, entry)) |
@@ -77,6 +102,10 @@ void slb_flush_and_rebolt(void) | |||
77 | if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) | 102 | if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) |
78 | ksp_esid_data &= ~SLB_ESID_V; | 103 | ksp_esid_data &= ~SLB_ESID_V; |
79 | 104 | ||
105 | /* Only third entry (stack) may change here so only resave that */ | ||
106 | slb_shadow_update(ksp_esid_data, | ||
107 | mk_vsid_data(ksp_esid_data, lflags), 2); | ||
108 | |||
80 | /* We need to do this all in asm, so we're sure we don't touch | 109 | /* We need to do this all in asm, so we're sure we don't touch |
81 | * the stack between the slbia and rebolting it. */ | 110 | * the stack between the slbia and rebolting it. */ |
82 | asm volatile("isync\n" | 111 | asm volatile("isync\n" |
@@ -209,9 +238,9 @@ void slb_initialize(void) | |||
209 | asm volatile("isync":::"memory"); | 238 | asm volatile("isync":::"memory"); |
210 | asm volatile("slbmte %0,%0"::"r" (0) : "memory"); | 239 | asm volatile("slbmte %0,%0"::"r" (0) : "memory"); |
211 | asm volatile("isync; slbia; isync":::"memory"); | 240 | asm volatile("isync; slbia; isync":::"memory"); |
212 | create_slbe(PAGE_OFFSET, lflags, 0); | 241 | create_shadowed_slbe(PAGE_OFFSET, lflags, 0); |
213 | 242 | ||
214 | create_slbe(VMALLOC_START, vflags, 1); | 243 | create_shadowed_slbe(VMALLOC_START, vflags, 1); |
215 | 244 | ||
216 | /* We don't bolt the stack for the time being - we're in boot, | 245 | /* We don't bolt the stack for the time being - we're in boot, |
217 | * so the stack is in the bolted segment. By the time it goes | 246 | * so the stack is in the bolted segment. By the time it goes |
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c index f6eef78efd29..b58baa65c4a7 100644 --- a/arch/powerpc/mm/tlb_64.c +++ b/arch/powerpc/mm/tlb_64.c | |||
@@ -146,6 +146,7 @@ void hpte_update(struct mm_struct *mm, unsigned long addr, | |||
146 | psize = mmu_huge_psize; | 146 | psize = mmu_huge_psize; |
147 | #else | 147 | #else |
148 | BUG(); | 148 | BUG(); |
149 | psize = pte_pagesize_index(pte); /* shutup gcc */ | ||
149 | #endif | 150 | #endif |
150 | } else | 151 | } else |
151 | psize = pte_pagesize_index(pte); | 152 | psize = pte_pagesize_index(pte); |
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c index cf3967a66fb5..969fbb6d8c46 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c | |||
@@ -60,8 +60,8 @@ static void __init mpc834x_itx_setup_arch(void) | |||
60 | 60 | ||
61 | np = of_find_node_by_type(NULL, "cpu"); | 61 | np = of_find_node_by_type(NULL, "cpu"); |
62 | if (np != 0) { | 62 | if (np != 0) { |
63 | unsigned int *fp = | 63 | const unsigned int *fp = |
64 | (int *)get_property(np, "clock-frequency", NULL); | 64 | get_property(np, "clock-frequency", NULL); |
65 | if (fp != 0) | 65 | if (fp != 0) |
66 | loops_per_jiffy = *fp / HZ; | 66 | loops_per_jiffy = *fp / HZ; |
67 | else | 67 | else |
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c index 32df239d1c48..677196187a4e 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_sys.c +++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c | |||
@@ -57,8 +57,8 @@ static void __init mpc834x_sys_setup_arch(void) | |||
57 | 57 | ||
58 | np = of_find_node_by_type(NULL, "cpu"); | 58 | np = of_find_node_by_type(NULL, "cpu"); |
59 | if (np != 0) { | 59 | if (np != 0) { |
60 | unsigned int *fp = | 60 | const unsigned int *fp = |
61 | (int *)get_property(np, "clock-frequency", NULL); | 61 | get_property(np, "clock-frequency", NULL); |
62 | if (fp != 0) | 62 | if (fp != 0) |
63 | loops_per_jiffy = *fp / HZ; | 63 | loops_per_jiffy = *fp / HZ; |
64 | else | 64 | else |
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c index 5d84a9ccd103..4557ac5255c1 100644 --- a/arch/powerpc/platforms/83xx/pci.c +++ b/arch/powerpc/platforms/83xx/pci.c | |||
@@ -59,7 +59,7 @@ int __init add_bridge(struct device_node *dev) | |||
59 | int len; | 59 | int len; |
60 | struct pci_controller *hose; | 60 | struct pci_controller *hose; |
61 | struct resource rsrc; | 61 | struct resource rsrc; |
62 | int *bus_range; | 62 | const int *bus_range; |
63 | int primary = 1, has_address = 0; | 63 | int primary = 1, has_address = 0; |
64 | phys_addr_t immr = get_immrbase(); | 64 | phys_addr_t immr = get_immrbase(); |
65 | 65 | ||
@@ -69,7 +69,7 @@ int __init add_bridge(struct device_node *dev) | |||
69 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 69 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
70 | 70 | ||
71 | /* Get bus range if any */ | 71 | /* Get bus range if any */ |
72 | bus_range = (int *)get_property(dev, "bus-range", &len); | 72 | bus_range = get_property(dev, "bus-range", &len); |
73 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 73 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
74 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 74 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
75 | " bus 0\n", dev->full_name); | 75 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c index 9d2acfbbeccd..cae6b73357d5 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c | |||
@@ -121,9 +121,9 @@ static void __init mpc85xx_ads_setup_arch(void) | |||
121 | 121 | ||
122 | cpu = of_find_node_by_type(NULL, "cpu"); | 122 | cpu = of_find_node_by_type(NULL, "cpu"); |
123 | if (cpu != 0) { | 123 | if (cpu != 0) { |
124 | unsigned int *fp; | 124 | const unsigned int *fp; |
125 | 125 | ||
126 | fp = (int *)get_property(cpu, "clock-frequency", NULL); | 126 | fp = get_property(cpu, "clock-frequency", NULL); |
127 | if (fp != 0) | 127 | if (fp != 0) |
128 | loops_per_jiffy = *fp / HZ; | 128 | loops_per_jiffy = *fp / HZ; |
129 | else | 129 | else |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c index 1d357d32a29f..4c1fede6470e 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c | |||
@@ -241,9 +241,9 @@ mpc85xx_cds_setup_arch(void) | |||
241 | 241 | ||
242 | cpu = of_find_node_by_type(NULL, "cpu"); | 242 | cpu = of_find_node_by_type(NULL, "cpu"); |
243 | if (cpu != 0) { | 243 | if (cpu != 0) { |
244 | unsigned int *fp; | 244 | const unsigned int *fp; |
245 | 245 | ||
246 | fp = (int *)get_property(cpu, "clock-frequency", NULL); | 246 | fp = get_property(cpu, "clock-frequency", NULL); |
247 | if (fp != 0) | 247 | if (fp != 0) |
248 | loops_per_jiffy = *fp / HZ; | 248 | loops_per_jiffy = *fp / HZ; |
249 | else | 249 | else |
diff --git a/arch/powerpc/platforms/85xx/pci.c b/arch/powerpc/platforms/85xx/pci.c index 1d51f3242ab1..05930eeb6e7f 100644 --- a/arch/powerpc/platforms/85xx/pci.c +++ b/arch/powerpc/platforms/85xx/pci.c | |||
@@ -41,7 +41,7 @@ int __init add_bridge(struct device_node *dev) | |||
41 | int len; | 41 | int len; |
42 | struct pci_controller *hose; | 42 | struct pci_controller *hose; |
43 | struct resource rsrc; | 43 | struct resource rsrc; |
44 | int *bus_range; | 44 | const int *bus_range; |
45 | int primary = 1, has_address = 0; | 45 | int primary = 1, has_address = 0; |
46 | phys_addr_t immr = get_immrbase(); | 46 | phys_addr_t immr = get_immrbase(); |
47 | 47 | ||
@@ -51,7 +51,7 @@ int __init add_bridge(struct device_node *dev) | |||
51 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 51 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
52 | 52 | ||
53 | /* Get bus range if any */ | 53 | /* Get bus range if any */ |
54 | bus_range = (int *) get_property(dev, "bus-range", &len); | 54 | bus_range = get_property(dev, "bus-range", &len); |
55 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 55 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
56 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 56 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
57 | " bus 0\n", dev->full_name); | 57 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index 5e583cf38786..b637e8157f7b 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | |||
@@ -347,9 +347,9 @@ mpc86xx_hpcn_setup_arch(void) | |||
347 | 347 | ||
348 | np = of_find_node_by_type(NULL, "cpu"); | 348 | np = of_find_node_by_type(NULL, "cpu"); |
349 | if (np != 0) { | 349 | if (np != 0) { |
350 | unsigned int *fp; | 350 | const unsigned int *fp; |
351 | 351 | ||
352 | fp = (int *)get_property(np, "clock-frequency", NULL); | 352 | fp = get_property(np, "clock-frequency", NULL); |
353 | if (fp != 0) | 353 | if (fp != 0) |
354 | loops_per_jiffy = *fp / HZ; | 354 | loops_per_jiffy = *fp / HZ; |
355 | else | 355 | else |
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c index a8c8f0a44055..481e18ed5be9 100644 --- a/arch/powerpc/platforms/86xx/pci.c +++ b/arch/powerpc/platforms/86xx/pci.c | |||
@@ -153,7 +153,7 @@ int __init add_bridge(struct device_node *dev) | |||
153 | int len; | 153 | int len; |
154 | struct pci_controller *hose; | 154 | struct pci_controller *hose; |
155 | struct resource rsrc; | 155 | struct resource rsrc; |
156 | int *bus_range; | 156 | const int *bus_range; |
157 | int has_address = 0; | 157 | int has_address = 0; |
158 | int primary = 0; | 158 | int primary = 0; |
159 | 159 | ||
@@ -163,7 +163,7 @@ int __init add_bridge(struct device_node *dev) | |||
163 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 163 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
164 | 164 | ||
165 | /* Get bus range if any */ | 165 | /* Get bus range if any */ |
166 | bus_range = (int *) get_property(dev, "bus-range", &len); | 166 | bus_range = get_property(dev, "bus-range", &len); |
167 | if (bus_range == NULL || len < 2 * sizeof(int)) | 167 | if (bus_range == NULL || len < 2 * sizeof(int)) |
168 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 168 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
169 | " bus 0\n", dev->full_name); | 169 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile index 5cf46dc57895..e58fa953a50b 100644 --- a/arch/powerpc/platforms/Makefile +++ b/arch/powerpc/platforms/Makefile | |||
@@ -13,5 +13,6 @@ obj-$(CONFIG_PPC_86xx) += 86xx/ | |||
13 | obj-$(CONFIG_PPC_PSERIES) += pseries/ | 13 | obj-$(CONFIG_PPC_PSERIES) += pseries/ |
14 | obj-$(CONFIG_PPC_ISERIES) += iseries/ | 14 | obj-$(CONFIG_PPC_ISERIES) += iseries/ |
15 | obj-$(CONFIG_PPC_MAPLE) += maple/ | 15 | obj-$(CONFIG_PPC_MAPLE) += maple/ |
16 | obj-$(CONFIG_PPC_PASEMI) += pasemi/ | ||
16 | obj-$(CONFIG_PPC_CELL) += cell/ | 17 | obj-$(CONFIG_PPC_CELL) += cell/ |
17 | obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/ | 18 | obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/ |
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platforms/cell/cbe_regs.c index ce696c1cca75..3f3859d12e00 100644 --- a/arch/powerpc/platforms/cell/cbe_regs.c +++ b/arch/powerpc/platforms/cell/cbe_regs.c | |||
@@ -97,7 +97,7 @@ void __init cbe_regs_init(void) | |||
97 | struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++]; | 97 | struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++]; |
98 | 98 | ||
99 | /* That hack must die die die ! */ | 99 | /* That hack must die die die ! */ |
100 | struct address_prop { | 100 | const struct address_prop { |
101 | unsigned long address; | 101 | unsigned long address; |
102 | unsigned int len; | 102 | unsigned int len; |
103 | } __attribute__((packed)) *prop; | 103 | } __attribute__((packed)) *prop; |
@@ -114,13 +114,11 @@ void __init cbe_regs_init(void) | |||
114 | if (cbe_thread_map[i].cpu_node == cpu) | 114 | if (cbe_thread_map[i].cpu_node == cpu) |
115 | cbe_thread_map[i].regs = map; | 115 | cbe_thread_map[i].regs = map; |
116 | 116 | ||
117 | prop = (struct address_prop *)get_property(cpu, "pervasive", | 117 | prop = get_property(cpu, "pervasive", NULL); |
118 | NULL); | ||
119 | if (prop != NULL) | 118 | if (prop != NULL) |
120 | map->pmd_regs = ioremap(prop->address, prop->len); | 119 | map->pmd_regs = ioremap(prop->address, prop->len); |
121 | 120 | ||
122 | prop = (struct address_prop *)get_property(cpu, "iic", | 121 | prop = get_property(cpu, "iic", NULL); |
123 | NULL); | ||
124 | if (prop != NULL) | 122 | if (prop != NULL) |
125 | map->iic_regs = ioremap(prop->address, prop->len); | 123 | map->iic_regs = ioremap(prop->address, prop->len); |
126 | } | 124 | } |
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c index d7bbb61109f9..6b57a47c5d37 100644 --- a/arch/powerpc/platforms/cell/interrupt.c +++ b/arch/powerpc/platforms/cell/interrupt.c | |||
@@ -89,17 +89,17 @@ static struct irq_chip iic_chip = { | |||
89 | /* Get an IRQ number from the pending state register of the IIC */ | 89 | /* Get an IRQ number from the pending state register of the IIC */ |
90 | static unsigned int iic_get_irq(struct pt_regs *regs) | 90 | static unsigned int iic_get_irq(struct pt_regs *regs) |
91 | { | 91 | { |
92 | struct cbe_iic_pending_bits pending; | 92 | struct cbe_iic_pending_bits pending; |
93 | struct iic *iic; | 93 | struct iic *iic; |
94 | 94 | ||
95 | iic = &__get_cpu_var(iic); | 95 | iic = &__get_cpu_var(iic); |
96 | *(unsigned long *) &pending = | 96 | *(unsigned long *) &pending = |
97 | in_be64((unsigned long __iomem *) &iic->regs->pending_destr); | 97 | in_be64((unsigned long __iomem *) &iic->regs->pending_destr); |
98 | iic->eoi_stack[++iic->eoi_ptr] = pending.prio; | 98 | iic->eoi_stack[++iic->eoi_ptr] = pending.prio; |
99 | BUG_ON(iic->eoi_ptr > 15); | 99 | BUG_ON(iic->eoi_ptr > 15); |
100 | if (pending.flags & CBE_IIC_IRQ_VALID) | 100 | if (pending.flags & CBE_IIC_IRQ_VALID) |
101 | return irq_linear_revmap(iic->host, | 101 | return irq_linear_revmap(iic->host, |
102 | iic_pending_to_hwnum(pending)); | 102 | iic_pending_to_hwnum(pending)); |
103 | return NO_IRQ; | 103 | return NO_IRQ; |
104 | } | 104 | } |
105 | 105 | ||
@@ -250,16 +250,15 @@ static int __init setup_iic(void) | |||
250 | struct resource r0, r1; | 250 | struct resource r0, r1; |
251 | struct irq_host *host; | 251 | struct irq_host *host; |
252 | int found = 0; | 252 | int found = 0; |
253 | u32 *np; | 253 | const u32 *np; |
254 | 254 | ||
255 | for (dn = NULL; | 255 | for (dn = NULL; |
256 | (dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) { | 256 | (dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) { |
257 | if (!device_is_compatible(dn, | 257 | if (!device_is_compatible(dn, |
258 | "IBM,CBEA-Internal-Interrupt-Controller")) | 258 | "IBM,CBEA-Internal-Interrupt-Controller")) |
259 | continue; | 259 | continue; |
260 | np = (u32 *)get_property(dn, "ibm,interrupt-server-ranges", | 260 | np = get_property(dn, "ibm,interrupt-server-ranges", NULL); |
261 | NULL); | 261 | if (np == NULL) { |
262 | if (np == NULL) { | ||
263 | printk(KERN_WARNING "IIC: CPU association not found\n"); | 262 | printk(KERN_WARNING "IIC: CPU association not found\n"); |
264 | of_node_put(dn); | 263 | of_node_put(dn); |
265 | return -ENODEV; | 264 | return -ENODEV; |
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index a35004e14c69..d2b20eba5b87 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -308,15 +308,16 @@ static void cell_do_map_iommu(struct cell_iommu *iommu, | |||
308 | 308 | ||
309 | static void iommu_devnode_setup(struct device_node *d) | 309 | static void iommu_devnode_setup(struct device_node *d) |
310 | { | 310 | { |
311 | unsigned int *ioid; | 311 | const unsigned int *ioid; |
312 | unsigned long *dma_window, map_start, map_size, token; | 312 | unsigned long map_start, map_size, token; |
313 | const unsigned long *dma_window; | ||
313 | struct cell_iommu *iommu; | 314 | struct cell_iommu *iommu; |
314 | 315 | ||
315 | ioid = (unsigned int *)get_property(d, "ioid", NULL); | 316 | ioid = get_property(d, "ioid", NULL); |
316 | if (!ioid) | 317 | if (!ioid) |
317 | pr_debug("No ioid entry found !\n"); | 318 | pr_debug("No ioid entry found !\n"); |
318 | 319 | ||
319 | dma_window = (unsigned long *)get_property(d, "ibm,dma-window", NULL); | 320 | dma_window = get_property(d, "ibm,dma-window", NULL); |
320 | if (!dma_window) | 321 | if (!dma_window) |
321 | pr_debug("No ibm,dma-window entry found !\n"); | 322 | pr_debug("No ibm,dma-window entry found !\n"); |
322 | 323 | ||
@@ -371,8 +372,9 @@ static int cell_map_iommu_hardcoded(int num_nodes) | |||
371 | 372 | ||
372 | static int cell_map_iommu(void) | 373 | static int cell_map_iommu(void) |
373 | { | 374 | { |
374 | unsigned int num_nodes = 0, *node_id; | 375 | unsigned int num_nodes = 0; |
375 | unsigned long *base, *mmio_base; | 376 | const unsigned int *node_id; |
377 | const unsigned long *base, *mmio_base; | ||
376 | struct device_node *dn; | 378 | struct device_node *dn; |
377 | struct cell_iommu *iommu = NULL; | 379 | struct cell_iommu *iommu = NULL; |
378 | 380 | ||
@@ -381,7 +383,7 @@ static int cell_map_iommu(void) | |||
381 | for(dn = of_find_node_by_type(NULL, "cpu"); | 383 | for(dn = of_find_node_by_type(NULL, "cpu"); |
382 | dn; | 384 | dn; |
383 | dn = of_find_node_by_type(dn, "cpu")) { | 385 | dn = of_find_node_by_type(dn, "cpu")) { |
384 | node_id = (unsigned int *)get_property(dn, "node-id", NULL); | 386 | node_id = get_property(dn, "node-id", NULL); |
385 | 387 | ||
386 | if (num_nodes < *node_id) | 388 | if (num_nodes < *node_id) |
387 | num_nodes = *node_id; | 389 | num_nodes = *node_id; |
@@ -396,9 +398,9 @@ static int cell_map_iommu(void) | |||
396 | dn; | 398 | dn; |
397 | dn = of_find_node_by_type(dn, "cpu")) { | 399 | dn = of_find_node_by_type(dn, "cpu")) { |
398 | 400 | ||
399 | node_id = (unsigned int *)get_property(dn, "node-id", NULL); | 401 | node_id = get_property(dn, "node-id", NULL); |
400 | base = (unsigned long *)get_property(dn, "ioc-cache", NULL); | 402 | base = get_property(dn, "ioc-cache", NULL); |
401 | mmio_base = (unsigned long *)get_property(dn, "ioc-translation", NULL); | 403 | mmio_base = get_property(dn, "ioc-translation", NULL); |
402 | 404 | ||
403 | if (!base || !mmio_base || !node_id) | 405 | if (!base || !mmio_base || !node_id) |
404 | return cell_map_iommu_hardcoded(num_nodes); | 406 | return cell_map_iommu_hardcoded(num_nodes); |
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index 282987d6d4a2..22c228a49c33 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c | |||
@@ -150,10 +150,6 @@ static int __init cell_probe(void) | |||
150 | !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) | 150 | !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) |
151 | return 0; | 151 | return 0; |
152 | 152 | ||
153 | #ifdef CONFIG_UDBG_RTAS_CONSOLE | ||
154 | udbg_init_rtas_console(); | ||
155 | #endif | ||
156 | |||
157 | hpte_init_native(); | 153 | hpte_init_native(); |
158 | 154 | ||
159 | return 1; | 155 | return 1; |
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c index 46aef0640742..1c0acbad7425 100644 --- a/arch/powerpc/platforms/cell/smp.c +++ b/arch/powerpc/platforms/cell/smp.c | |||
@@ -57,7 +57,7 @@ | |||
57 | */ | 57 | */ |
58 | static cpumask_t of_spin_map; | 58 | static cpumask_t of_spin_map; |
59 | 59 | ||
60 | extern void pSeries_secondary_smp_init(unsigned long); | 60 | extern void generic_secondary_smp_init(unsigned long); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * smp_startup_cpu() - start the given cpu | 63 | * smp_startup_cpu() - start the given cpu |
@@ -74,7 +74,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) | |||
74 | { | 74 | { |
75 | int status; | 75 | int status; |
76 | unsigned long start_here = __pa((u32)*((unsigned long *) | 76 | unsigned long start_here = __pa((u32)*((unsigned long *) |
77 | pSeries_secondary_smp_init)); | 77 | generic_secondary_smp_init)); |
78 | unsigned int pcpu; | 78 | unsigned int pcpu; |
79 | int start_cpu; | 79 | int start_cpu; |
80 | 80 | ||
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c index 15217bb0402f..742a03282b44 100644 --- a/arch/powerpc/platforms/cell/spider-pic.c +++ b/arch/powerpc/platforms/cell/spider-pic.c | |||
@@ -240,7 +240,7 @@ static void spider_irq_cascade(unsigned int irq, struct irq_desc *desc, | |||
240 | static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) | 240 | static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) |
241 | { | 241 | { |
242 | unsigned int virq; | 242 | unsigned int virq; |
243 | u32 *imap, *tmp; | 243 | const u32 *imap, *tmp; |
244 | int imaplen, intsize, unit; | 244 | int imaplen, intsize, unit; |
245 | struct device_node *iic; | 245 | struct device_node *iic; |
246 | struct irq_host *iic_host; | 246 | struct irq_host *iic_host; |
@@ -258,25 +258,25 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) | |||
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | /* Now do the horrible hacks */ | 260 | /* Now do the horrible hacks */ |
261 | tmp = (u32 *)get_property(pic->of_node, "#interrupt-cells", NULL); | 261 | tmp = get_property(pic->of_node, "#interrupt-cells", NULL); |
262 | if (tmp == NULL) | 262 | if (tmp == NULL) |
263 | return NO_IRQ; | 263 | return NO_IRQ; |
264 | intsize = *tmp; | 264 | intsize = *tmp; |
265 | imap = (u32 *)get_property(pic->of_node, "interrupt-map", &imaplen); | 265 | imap = get_property(pic->of_node, "interrupt-map", &imaplen); |
266 | if (imap == NULL || imaplen < (intsize + 1)) | 266 | if (imap == NULL || imaplen < (intsize + 1)) |
267 | return NO_IRQ; | 267 | return NO_IRQ; |
268 | iic = of_find_node_by_phandle(imap[intsize]); | 268 | iic = of_find_node_by_phandle(imap[intsize]); |
269 | if (iic == NULL) | 269 | if (iic == NULL) |
270 | return NO_IRQ; | 270 | return NO_IRQ; |
271 | imap += intsize + 1; | 271 | imap += intsize + 1; |
272 | tmp = (u32 *)get_property(iic, "#interrupt-cells", NULL); | 272 | tmp = get_property(iic, "#interrupt-cells", NULL); |
273 | if (tmp == NULL) | 273 | if (tmp == NULL) |
274 | return NO_IRQ; | 274 | return NO_IRQ; |
275 | intsize = *tmp; | 275 | intsize = *tmp; |
276 | /* Assume unit is last entry of interrupt specifier */ | 276 | /* Assume unit is last entry of interrupt specifier */ |
277 | unit = imap[intsize - 1]; | 277 | unit = imap[intsize - 1]; |
278 | /* Ok, we have a unit, now let's try to get the node */ | 278 | /* Ok, we have a unit, now let's try to get the node */ |
279 | tmp = (u32 *)get_property(iic, "ibm,interrupt-server-ranges", NULL); | 279 | tmp = get_property(iic, "ibm,interrupt-server-ranges", NULL); |
280 | if (tmp == NULL) { | 280 | if (tmp == NULL) { |
281 | of_node_put(iic); | 281 | of_node_put(iic); |
282 | return NO_IRQ; | 282 | return NO_IRQ; |
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index d06042deb021..3bd36d46ab4a 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -488,10 +488,10 @@ int spu_irq_class_1_bottom(struct spu *spu) | |||
488 | 488 | ||
489 | static int __init find_spu_node_id(struct device_node *spe) | 489 | static int __init find_spu_node_id(struct device_node *spe) |
490 | { | 490 | { |
491 | unsigned int *id; | 491 | const unsigned int *id; |
492 | struct device_node *cpu; | 492 | struct device_node *cpu; |
493 | cpu = spe->parent->parent; | 493 | cpu = spe->parent->parent; |
494 | id = (unsigned int *)get_property(cpu, "node-id", NULL); | 494 | id = get_property(cpu, "node-id", NULL); |
495 | return id ? *id : 0; | 495 | return id ? *id : 0; |
496 | } | 496 | } |
497 | 497 | ||
@@ -500,7 +500,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, | |||
500 | { | 500 | { |
501 | static DEFINE_MUTEX(add_spumem_mutex); | 501 | static DEFINE_MUTEX(add_spumem_mutex); |
502 | 502 | ||
503 | struct address_prop { | 503 | const struct address_prop { |
504 | unsigned long address; | 504 | unsigned long address; |
505 | unsigned int len; | 505 | unsigned int len; |
506 | } __attribute__((packed)) *p; | 506 | } __attribute__((packed)) *p; |
@@ -511,7 +511,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, | |||
511 | struct zone *zone; | 511 | struct zone *zone; |
512 | int ret; | 512 | int ret; |
513 | 513 | ||
514 | p = (void*)get_property(spe, prop, &proplen); | 514 | p = get_property(spe, prop, &proplen); |
515 | WARN_ON(proplen != sizeof (*p)); | 515 | WARN_ON(proplen != sizeof (*p)); |
516 | 516 | ||
517 | start_pfn = p->address >> PAGE_SHIFT; | 517 | start_pfn = p->address >> PAGE_SHIFT; |
@@ -531,12 +531,12 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, | |||
531 | static void __iomem * __init map_spe_prop(struct spu *spu, | 531 | static void __iomem * __init map_spe_prop(struct spu *spu, |
532 | struct device_node *n, const char *name) | 532 | struct device_node *n, const char *name) |
533 | { | 533 | { |
534 | struct address_prop { | 534 | const struct address_prop { |
535 | unsigned long address; | 535 | unsigned long address; |
536 | unsigned int len; | 536 | unsigned int len; |
537 | } __attribute__((packed)) *prop; | 537 | } __attribute__((packed)) *prop; |
538 | 538 | ||
539 | void *p; | 539 | const void *p; |
540 | int proplen; | 540 | int proplen; |
541 | void* ret = NULL; | 541 | void* ret = NULL; |
542 | int err = 0; | 542 | int err = 0; |
@@ -570,14 +570,14 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) | |||
570 | { | 570 | { |
571 | struct irq_host *host; | 571 | struct irq_host *host; |
572 | unsigned int isrc; | 572 | unsigned int isrc; |
573 | u32 *tmp; | 573 | const u32 *tmp; |
574 | 574 | ||
575 | host = iic_get_irq_host(spu->node); | 575 | host = iic_get_irq_host(spu->node); |
576 | if (host == NULL) | 576 | if (host == NULL) |
577 | return -ENODEV; | 577 | return -ENODEV; |
578 | 578 | ||
579 | /* Get the interrupt source from the device-tree */ | 579 | /* Get the interrupt source from the device-tree */ |
580 | tmp = (u32 *)get_property(np, "isrc", NULL); | 580 | tmp = get_property(np, "isrc", NULL); |
581 | if (!tmp) | 581 | if (!tmp) |
582 | return -ENODEV; | 582 | return -ENODEV; |
583 | spu->isrc = isrc = tmp[0]; | 583 | spu->isrc = isrc = tmp[0]; |
@@ -593,7 +593,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) | |||
593 | 593 | ||
594 | static int __init spu_map_device(struct spu *spu, struct device_node *node) | 594 | static int __init spu_map_device(struct spu *spu, struct device_node *node) |
595 | { | 595 | { |
596 | char *prop; | 596 | const char *prop; |
597 | int ret; | 597 | int ret; |
598 | 598 | ||
599 | ret = -ENODEV; | 599 | ret = -ENODEV; |
diff --git a/arch/powerpc/platforms/chrp/nvram.c b/arch/powerpc/platforms/chrp/nvram.c index 150f67d6f90c..0dd4a64757d9 100644 --- a/arch/powerpc/platforms/chrp/nvram.c +++ b/arch/powerpc/platforms/chrp/nvram.c | |||
@@ -67,13 +67,14 @@ static void chrp_nvram_write(int addr, unsigned char val) | |||
67 | void __init chrp_nvram_init(void) | 67 | void __init chrp_nvram_init(void) |
68 | { | 68 | { |
69 | struct device_node *nvram; | 69 | struct device_node *nvram; |
70 | unsigned int *nbytes_p, proplen; | 70 | const unsigned int *nbytes_p; |
71 | unsigned int proplen; | ||
71 | 72 | ||
72 | nvram = of_find_node_by_type(NULL, "nvram"); | 73 | nvram = of_find_node_by_type(NULL, "nvram"); |
73 | if (nvram == NULL) | 74 | if (nvram == NULL) |
74 | return; | 75 | return; |
75 | 76 | ||
76 | nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen); | 77 | nbytes_p = get_property(nvram, "#bytes", &proplen); |
77 | if (nbytes_p == NULL || proplen != sizeof(unsigned int)) | 78 | if (nbytes_p == NULL || proplen != sizeof(unsigned int)) |
78 | return; | 79 | return; |
79 | 80 | ||
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c index 6802cdc3168a..0f4340506c75 100644 --- a/arch/powerpc/platforms/chrp/pci.c +++ b/arch/powerpc/platforms/chrp/pci.c | |||
@@ -214,11 +214,11 @@ void __init | |||
214 | chrp_find_bridges(void) | 214 | chrp_find_bridges(void) |
215 | { | 215 | { |
216 | struct device_node *dev; | 216 | struct device_node *dev; |
217 | int *bus_range; | 217 | const int *bus_range; |
218 | int len, index = -1; | 218 | int len, index = -1; |
219 | struct pci_controller *hose; | 219 | struct pci_controller *hose; |
220 | unsigned int *dma; | 220 | const unsigned int *dma; |
221 | char *model, *machine; | 221 | const char *model, *machine; |
222 | int is_longtrail = 0, is_mot = 0, is_pegasos = 0; | 222 | int is_longtrail = 0, is_mot = 0, is_pegasos = 0; |
223 | struct device_node *root = find_path_device("/"); | 223 | struct device_node *root = find_path_device("/"); |
224 | struct resource r; | 224 | struct resource r; |
@@ -246,7 +246,7 @@ chrp_find_bridges(void) | |||
246 | dev->full_name); | 246 | dev->full_name); |
247 | continue; | 247 | continue; |
248 | } | 248 | } |
249 | bus_range = (int *) get_property(dev, "bus-range", &len); | 249 | bus_range = get_property(dev, "bus-range", &len); |
250 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 250 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
251 | printk(KERN_WARNING "Can't get bus-range for %s\n", | 251 | printk(KERN_WARNING "Can't get bus-range for %s\n", |
252 | dev->full_name); | 252 | dev->full_name); |
@@ -257,7 +257,7 @@ chrp_find_bridges(void) | |||
257 | else | 257 | else |
258 | printk(KERN_INFO "PCI buses %d..%d", | 258 | printk(KERN_INFO "PCI buses %d..%d", |
259 | bus_range[0], bus_range[1]); | 259 | bus_range[0], bus_range[1]); |
260 | printk(" controlled by %s", dev->type); | 260 | printk(" controlled by %s", dev->full_name); |
261 | if (!is_longtrail) | 261 | if (!is_longtrail) |
262 | printk(" at %llx", (unsigned long long)r.start); | 262 | printk(" at %llx", (unsigned long long)r.start); |
263 | printk("\n"); | 263 | printk("\n"); |
@@ -289,6 +289,19 @@ chrp_find_bridges(void) | |||
289 | setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc); | 289 | setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc); |
290 | } else if (is_pegasos == 2) { | 290 | } else if (is_pegasos == 2) { |
291 | setup_peg2(hose, dev); | 291 | setup_peg2(hose, dev); |
292 | } else if (!strncmp(model, "IBM,CPC710", 10)) { | ||
293 | setup_indirect_pci(hose, | ||
294 | r.start + 0x000f8000, | ||
295 | r.start + 0x000f8010); | ||
296 | if (index == 0) { | ||
297 | dma = get_property(dev, "system-dma-base",&len); | ||
298 | if (dma && len >= sizeof(*dma)) { | ||
299 | dma = (unsigned int *) | ||
300 | (((unsigned long)dma) + | ||
301 | len - sizeof(*dma)); | ||
302 | pci_dram_offset = *dma; | ||
303 | } | ||
304 | } | ||
292 | } else { | 305 | } else { |
293 | printk("No methods for %s (model %s), using RTAS\n", | 306 | printk("No methods for %s (model %s), using RTAS\n", |
294 | dev->full_name, model); | 307 | dev->full_name, model); |
@@ -299,15 +312,35 @@ chrp_find_bridges(void) | |||
299 | 312 | ||
300 | /* check the first bridge for a property that we can | 313 | /* check the first bridge for a property that we can |
301 | use to set pci_dram_offset */ | 314 | use to set pci_dram_offset */ |
302 | dma = (unsigned int *) | 315 | dma = get_property(dev, "ibm,dma-ranges", &len); |
303 | get_property(dev, "ibm,dma-ranges", &len); | ||
304 | if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) { | 316 | if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) { |
305 | pci_dram_offset = dma[2] - dma[3]; | 317 | pci_dram_offset = dma[2] - dma[3]; |
306 | printk("pci_dram_offset = %lx\n", pci_dram_offset); | 318 | printk("pci_dram_offset = %lx\n", pci_dram_offset); |
307 | } | 319 | } |
308 | } | 320 | } |
321 | } | ||
322 | |||
323 | /* SL82C105 IDE Control/Status Register */ | ||
324 | #define SL82C105_IDECSR 0x40 | ||
325 | |||
326 | /* Fixup for Winbond ATA quirk, required for briq */ | ||
327 | void chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105) | ||
328 | { | ||
329 | u8 progif; | ||
309 | 330 | ||
310 | /* Do not fixup interrupts from OF tree on pegasos */ | 331 | /* If non-briq machines need that fixup too, please speak up */ |
311 | if (is_pegasos) | 332 | if (!machine_is(chrp) || _chrp_type != _CHRP_briq) |
312 | ppc_md.pcibios_fixup = NULL; | 333 | return; |
334 | |||
335 | if ((sl82c105->class & 5) != 5) { | ||
336 | printk("W83C553: Switching SL82C105 IDE to PCI native mode\n"); | ||
337 | /* Enable SL82C105 PCI native IDE mode */ | ||
338 | pci_read_config_byte(sl82c105, PCI_CLASS_PROG, &progif); | ||
339 | pci_write_config_byte(sl82c105, PCI_CLASS_PROG, progif | 0x05); | ||
340 | sl82c105->class |= 0x05; | ||
341 | /* Disable SL82C105 second port */ | ||
342 | pci_write_config_word(sl82c105, SL82C105_IDECSR, 0x0003); | ||
343 | } | ||
313 | } | 344 | } |
345 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, | ||
346 | chrp_pci_fixup_winbond_ata); | ||
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c index 9c08ff322290..488dbd9b51ae 100644 --- a/arch/powerpc/platforms/chrp/setup.c +++ b/arch/powerpc/platforms/chrp/setup.c | |||
@@ -74,6 +74,9 @@ extern irqreturn_t xmon_irq(int, void *, struct pt_regs *); | |||
74 | 74 | ||
75 | extern unsigned long loops_per_jiffy; | 75 | extern unsigned long loops_per_jiffy; |
76 | 76 | ||
77 | /* To be replaced by RTAS when available */ | ||
78 | static unsigned int *briq_SPOR; | ||
79 | |||
77 | #ifdef CONFIG_SMP | 80 | #ifdef CONFIG_SMP |
78 | extern struct smp_ops_t chrp_smp_ops; | 81 | extern struct smp_ops_t chrp_smp_ops; |
79 | #endif | 82 | #endif |
@@ -92,6 +95,15 @@ static const char *gg2_cachemodes[4] = { | |||
92 | "Disabled", "Write-Through", "Copy-Back", "Transparent Mode" | 95 | "Disabled", "Write-Through", "Copy-Back", "Transparent Mode" |
93 | }; | 96 | }; |
94 | 97 | ||
98 | static const char *chrp_names[] = { | ||
99 | "Unknown", | ||
100 | "","","", | ||
101 | "Motorola", | ||
102 | "IBM or Longtrail", | ||
103 | "Genesi Pegasos", | ||
104 | "Total Impact Briq" | ||
105 | }; | ||
106 | |||
95 | void chrp_show_cpuinfo(struct seq_file *m) | 107 | void chrp_show_cpuinfo(struct seq_file *m) |
96 | { | 108 | { |
97 | int i, sdramen; | 109 | int i, sdramen; |
@@ -214,8 +226,7 @@ static void __init pegasos_set_l2cr(void) | |||
214 | /* Enable L2 cache if needed */ | 226 | /* Enable L2 cache if needed */ |
215 | np = find_type_devices("cpu"); | 227 | np = find_type_devices("cpu"); |
216 | if (np != NULL) { | 228 | if (np != NULL) { |
217 | unsigned int *l2cr = (unsigned int *) | 229 | const unsigned int *l2cr = get_property(np, "l2cr", NULL); |
218 | get_property (np, "l2cr", NULL); | ||
219 | if (l2cr == NULL) { | 230 | if (l2cr == NULL) { |
220 | printk ("Pegasos l2cr : no cpu l2cr property found\n"); | 231 | printk ("Pegasos l2cr : no cpu l2cr property found\n"); |
221 | return; | 232 | return; |
@@ -229,10 +240,18 @@ static void __init pegasos_set_l2cr(void) | |||
229 | } | 240 | } |
230 | } | 241 | } |
231 | 242 | ||
243 | static void briq_restart(char *cmd) | ||
244 | { | ||
245 | local_irq_disable(); | ||
246 | if (briq_SPOR) | ||
247 | out_be32(briq_SPOR, 0); | ||
248 | for(;;); | ||
249 | } | ||
250 | |||
232 | void __init chrp_setup_arch(void) | 251 | void __init chrp_setup_arch(void) |
233 | { | 252 | { |
234 | struct device_node *root = find_path_device ("/"); | 253 | struct device_node *root = find_path_device ("/"); |
235 | char *machine = NULL; | 254 | const char *machine = NULL; |
236 | 255 | ||
237 | /* init to some ~sane value until calibrate_delay() runs */ | 256 | /* init to some ~sane value until calibrate_delay() runs */ |
238 | loops_per_jiffy = 50000000/HZ; | 257 | loops_per_jiffy = 50000000/HZ; |
@@ -245,11 +264,16 @@ void __init chrp_setup_arch(void) | |||
245 | _chrp_type = _CHRP_IBM; | 264 | _chrp_type = _CHRP_IBM; |
246 | } else if (machine && strncmp(machine, "MOT", 3) == 0) { | 265 | } else if (machine && strncmp(machine, "MOT", 3) == 0) { |
247 | _chrp_type = _CHRP_Motorola; | 266 | _chrp_type = _CHRP_Motorola; |
267 | } else if (machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0) { | ||
268 | _chrp_type = _CHRP_briq; | ||
269 | /* Map the SPOR register on briq and change the restart hook */ | ||
270 | briq_SPOR = (unsigned int *)ioremap(0xff0000e8, 4); | ||
271 | ppc_md.restart = briq_restart; | ||
248 | } else { | 272 | } else { |
249 | /* Let's assume it is an IBM chrp if all else fails */ | 273 | /* Let's assume it is an IBM chrp if all else fails */ |
250 | _chrp_type = _CHRP_IBM; | 274 | _chrp_type = _CHRP_IBM; |
251 | } | 275 | } |
252 | printk("chrp type = %x\n", _chrp_type); | 276 | printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]); |
253 | 277 | ||
254 | rtas_initialize(); | 278 | rtas_initialize(); |
255 | if (rtas_token("display-character") >= 0) | 279 | if (rtas_token("display-character") >= 0) |
@@ -328,7 +352,7 @@ static void __init chrp_find_openpic(void) | |||
328 | struct device_node *np, *root; | 352 | struct device_node *np, *root; |
329 | int len, i, j; | 353 | int len, i, j; |
330 | int isu_size, idu_size; | 354 | int isu_size, idu_size; |
331 | unsigned int *iranges, *opprop = NULL; | 355 | const unsigned int *iranges, *opprop = NULL; |
332 | int oplen = 0; | 356 | int oplen = 0; |
333 | unsigned long opaddr; | 357 | unsigned long opaddr; |
334 | int na = 1; | 358 | int na = 1; |
@@ -338,8 +362,7 @@ static void __init chrp_find_openpic(void) | |||
338 | return; | 362 | return; |
339 | root = of_find_node_by_path("/"); | 363 | root = of_find_node_by_path("/"); |
340 | if (root) { | 364 | if (root) { |
341 | opprop = (unsigned int *) get_property | 365 | opprop = get_property(root, "platform-open-pic", &oplen); |
342 | (root, "platform-open-pic", &oplen); | ||
343 | na = prom_n_addr_cells(root); | 366 | na = prom_n_addr_cells(root); |
344 | } | 367 | } |
345 | if (opprop && oplen >= na * sizeof(unsigned int)) { | 368 | if (opprop && oplen >= na * sizeof(unsigned int)) { |
@@ -356,7 +379,7 @@ static void __init chrp_find_openpic(void) | |||
356 | 379 | ||
357 | printk(KERN_INFO "OpenPIC at %lx\n", opaddr); | 380 | printk(KERN_INFO "OpenPIC at %lx\n", opaddr); |
358 | 381 | ||
359 | iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len); | 382 | iranges = get_property(np, "interrupt-ranges", &len); |
360 | if (iranges == NULL) | 383 | if (iranges == NULL) |
361 | len = 0; /* non-distributed mpic */ | 384 | len = 0; /* non-distributed mpic */ |
362 | else | 385 | else |
@@ -442,8 +465,8 @@ static void __init chrp_find_8259(void) | |||
442 | * from anyway | 465 | * from anyway |
443 | */ | 466 | */ |
444 | for (np = find_devices("pci"); np != NULL; np = np->next) { | 467 | for (np = find_devices("pci"); np != NULL; np = np->next) { |
445 | unsigned int *addrp = (unsigned int *) | 468 | const unsigned int *addrp = get_property(np, |
446 | get_property(np, "8259-interrupt-acknowledge", NULL); | 469 | "8259-interrupt-acknowledge", NULL); |
447 | 470 | ||
448 | if (addrp == NULL) | 471 | if (addrp == NULL) |
449 | continue; | 472 | continue; |
@@ -502,7 +525,7 @@ void __init | |||
502 | chrp_init2(void) | 525 | chrp_init2(void) |
503 | { | 526 | { |
504 | struct device_node *device; | 527 | struct device_node *device; |
505 | unsigned int *p = NULL; | 528 | const unsigned int *p = NULL; |
506 | 529 | ||
507 | #ifdef CONFIG_NVRAM | 530 | #ifdef CONFIG_NVRAM |
508 | chrp_nvram_init(); | 531 | chrp_nvram_init(); |
@@ -520,8 +543,7 @@ chrp_init2(void) | |||
520 | */ | 543 | */ |
521 | device = find_devices("rtas"); | 544 | device = find_devices("rtas"); |
522 | if (device) | 545 | if (device) |
523 | p = (unsigned int *) get_property | 546 | p = get_property(device, "rtas-event-scan-rate", NULL); |
524 | (device, "rtas-event-scan-rate", NULL); | ||
525 | if (p && *p) { | 547 | if (p && *p) { |
526 | /* | 548 | /* |
527 | * Arrange to call chrp_event_scan at least *p times | 549 | * Arrange to call chrp_event_scan at least *p times |
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c index 5d393eb94935..e4f2b9df5e17 100644 --- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c +++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | |||
@@ -95,7 +95,7 @@ void mpc7448_hpc2_fixup_irq(struct pci_dev *dev) | |||
95 | { | 95 | { |
96 | struct pci_controller *hose; | 96 | struct pci_controller *hose; |
97 | struct device_node *node; | 97 | struct device_node *node; |
98 | unsigned int *interrupt; | 98 | const unsigned int *interrupt; |
99 | int busnr; | 99 | int busnr; |
100 | int len; | 100 | int len; |
101 | u8 slot; | 101 | u8 slot; |
@@ -112,7 +112,7 @@ void mpc7448_hpc2_fixup_irq(struct pci_dev *dev) | |||
112 | if (!node) | 112 | if (!node) |
113 | printk(KERN_ERR "No pci node found\n"); | 113 | printk(KERN_ERR "No pci node found\n"); |
114 | 114 | ||
115 | interrupt = (unsigned int *) get_property(node, "interrupt-map", &len); | 115 | interrupt = get_property(node, "interrupt-map", &len); |
116 | slot = find_slot_by_devfn(interrupt, dev->devfn); | 116 | slot = find_slot_by_devfn(interrupt, dev->devfn); |
117 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | 117 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); |
118 | if (pin == 0 || pin > 4) | 118 | if (pin == 0 || pin > 4) |
@@ -141,9 +141,9 @@ static void __init mpc7448_hpc2_setup_arch(void) | |||
141 | 141 | ||
142 | cpu = of_find_node_by_type(NULL, "cpu"); | 142 | cpu = of_find_node_by_type(NULL, "cpu"); |
143 | if (cpu != 0) { | 143 | if (cpu != 0) { |
144 | unsigned int *fp; | 144 | const unsigned int *fp; |
145 | 145 | ||
146 | fp = (int *)get_property(cpu, "clock-frequency", NULL); | 146 | fp = get_property(cpu, "clock-frequency", NULL); |
147 | if (fp != 0) | 147 | if (fp != 0) |
148 | loops_per_jiffy = *fp / HZ; | 148 | loops_per_jiffy = *fp / HZ; |
149 | else | 149 | else |
diff --git a/arch/powerpc/platforms/iseries/Kconfig b/arch/powerpc/platforms/iseries/Kconfig index 3d957a30c8c2..887b68804e6d 100644 --- a/arch/powerpc/platforms/iseries/Kconfig +++ b/arch/powerpc/platforms/iseries/Kconfig | |||
@@ -3,13 +3,17 @@ menu "iSeries device drivers" | |||
3 | depends on PPC_ISERIES | 3 | depends on PPC_ISERIES |
4 | 4 | ||
5 | config VIOCONS | 5 | config VIOCONS |
6 | tristate "iSeries Virtual Console Support" | 6 | tristate "iSeries Virtual Console Support (Obsolete)" |
7 | help | ||
8 | This is the old virtual console driver for legacy iSeries. | ||
9 | You should use the iSeries Hypervisor Virtual Console | ||
10 | support instead. | ||
7 | 11 | ||
8 | config VIODASD | 12 | config VIODASD |
9 | tristate "iSeries Virtual I/O disk support" | 13 | tristate "iSeries Virtual I/O disk support" |
10 | help | 14 | help |
11 | If you are running on an iSeries system and you want to use | 15 | If you are running on an iSeries system and you want to use |
12 | virtual disks created and managed by OS/400, say Y. | 16 | virtual disks created and managed by OS/400, say Y. |
13 | 17 | ||
14 | config VIOCD | 18 | config VIOCD |
15 | tristate "iSeries Virtual I/O CD support" | 19 | tristate "iSeries Virtual I/O CD support" |
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c index d194140c1ebf..e305deee7f44 100644 --- a/arch/powerpc/platforms/iseries/dt.c +++ b/arch/powerpc/platforms/iseries/dt.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2005-2006 Michael Ellerman, IBM Corporation | 2 | * Copyright (C) 2005-2006 Michael Ellerman, IBM Corporation |
3 | * Copyright (C) 2000-2004, IBM Corporation | ||
3 | * | 4 | * |
4 | * Description: | 5 | * Description: |
5 | * This file contains all the routines to build a flattened device | 6 | * This file contains all the routines to build a flattened device |
@@ -33,13 +34,13 @@ | |||
33 | #include <asm/iseries/hv_types.h> | 34 | #include <asm/iseries/hv_types.h> |
34 | #include <asm/iseries/hv_lp_config.h> | 35 | #include <asm/iseries/hv_lp_config.h> |
35 | #include <asm/iseries/hv_call_xm.h> | 36 | #include <asm/iseries/hv_call_xm.h> |
36 | #include <asm/iseries/it_exp_vpd_panel.h> | ||
37 | #include <asm/udbg.h> | 37 | #include <asm/udbg.h> |
38 | 38 | ||
39 | #include "processor_vpd.h" | 39 | #include "processor_vpd.h" |
40 | #include "call_hpt.h" | 40 | #include "call_hpt.h" |
41 | #include "call_pci.h" | 41 | #include "call_pci.h" |
42 | #include "pci.h" | 42 | #include "pci.h" |
43 | #include "it_exp_vpd_panel.h" | ||
43 | 44 | ||
44 | #ifdef DEBUG | 45 | #ifdef DEBUG |
45 | #define DBG(fmt...) udbg_printf(fmt) | 46 | #define DBG(fmt...) udbg_printf(fmt) |
@@ -76,6 +77,43 @@ static char __initdata device_type_pci[] = "pci"; | |||
76 | static char __initdata device_type_vdevice[] = "vdevice"; | 77 | static char __initdata device_type_vdevice[] = "vdevice"; |
77 | static char __initdata device_type_vscsi[] = "vscsi"; | 78 | static char __initdata device_type_vscsi[] = "vscsi"; |
78 | 79 | ||
80 | |||
81 | /* EBCDIC to ASCII conversion routines */ | ||
82 | |||
83 | static unsigned char __init e2a(unsigned char x) | ||
84 | { | ||
85 | switch (x) { | ||
86 | case 0x81 ... 0x89: | ||
87 | return x - 0x81 + 'a'; | ||
88 | case 0x91 ... 0x99: | ||
89 | return x - 0x91 + 'j'; | ||
90 | case 0xA2 ... 0xA9: | ||
91 | return x - 0xA2 + 's'; | ||
92 | case 0xC1 ... 0xC9: | ||
93 | return x - 0xC1 + 'A'; | ||
94 | case 0xD1 ... 0xD9: | ||
95 | return x - 0xD1 + 'J'; | ||
96 | case 0xE2 ... 0xE9: | ||
97 | return x - 0xE2 + 'S'; | ||
98 | case 0xF0 ... 0xF9: | ||
99 | return x - 0xF0 + '0'; | ||
100 | } | ||
101 | return ' '; | ||
102 | } | ||
103 | |||
104 | static unsigned char * __init strne2a(unsigned char *dest, | ||
105 | const unsigned char *src, size_t n) | ||
106 | { | ||
107 | int i; | ||
108 | |||
109 | n = strnlen(src, n); | ||
110 | |||
111 | for (i = 0; i < n; i++) | ||
112 | dest[i] = e2a(src[i]); | ||
113 | |||
114 | return dest; | ||
115 | } | ||
116 | |||
79 | static struct iseries_flat_dt * __init dt_init(void) | 117 | static struct iseries_flat_dt * __init dt_init(void) |
80 | { | 118 | { |
81 | struct iseries_flat_dt *dt; | 119 | struct iseries_flat_dt *dt; |
@@ -298,7 +336,8 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt) | |||
298 | dt_prop_u32(dt, "#address-cells", 1); | 336 | dt_prop_u32(dt, "#address-cells", 1); |
299 | dt_prop_u32(dt, "#size-cells", 0); | 337 | dt_prop_u32(dt, "#size-cells", 0); |
300 | 338 | ||
301 | dt_do_vdevice(dt, "vty", reg, -1, device_type_serial, NULL, 1); | 339 | dt_do_vdevice(dt, "vty", reg, -1, device_type_serial, |
340 | "IBM,iSeries-vty", 1); | ||
302 | reg++; | 341 | reg++; |
303 | 342 | ||
304 | dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi, | 343 | dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi, |
diff --git a/arch/powerpc/platforms/iseries/hvlpconfig.c b/arch/powerpc/platforms/iseries/hvlpconfig.c index 663a1affb4bb..f0475f0b1853 100644 --- a/arch/powerpc/platforms/iseries/hvlpconfig.c +++ b/arch/powerpc/platforms/iseries/hvlpconfig.c | |||
@@ -18,9 +18,22 @@ | |||
18 | 18 | ||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <asm/iseries/hv_lp_config.h> | 20 | #include <asm/iseries/hv_lp_config.h> |
21 | #include "it_lp_naca.h" | ||
21 | 22 | ||
22 | HvLpIndex HvLpConfig_getLpIndex_outline(void) | 23 | HvLpIndex HvLpConfig_getLpIndex_outline(void) |
23 | { | 24 | { |
24 | return HvLpConfig_getLpIndex(); | 25 | return HvLpConfig_getLpIndex(); |
25 | } | 26 | } |
26 | EXPORT_SYMBOL(HvLpConfig_getLpIndex_outline); | 27 | EXPORT_SYMBOL(HvLpConfig_getLpIndex_outline); |
28 | |||
29 | HvLpIndex HvLpConfig_getLpIndex(void) | ||
30 | { | ||
31 | return itLpNaca.xLpIndex; | ||
32 | } | ||
33 | EXPORT_SYMBOL(HvLpConfig_getLpIndex); | ||
34 | |||
35 | HvLpIndex HvLpConfig_getPrimaryLpIndex(void) | ||
36 | { | ||
37 | return itLpNaca.xPrimaryLpIndex; | ||
38 | } | ||
39 | EXPORT_SYMBOL_GPL(HvLpConfig_getPrimaryLpIndex); | ||
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c index e3bd2015f2c9..f4cbbcf8773a 100644 --- a/arch/powerpc/platforms/iseries/iommu.c +++ b/arch/powerpc/platforms/iseries/iommu.c | |||
@@ -88,6 +88,23 @@ static void tce_free_iSeries(struct iommu_table *tbl, long index, long npages) | |||
88 | } | 88 | } |
89 | 89 | ||
90 | /* | 90 | /* |
91 | * Structure passed to HvCallXm_getTceTableParms | ||
92 | */ | ||
93 | struct iommu_table_cb { | ||
94 | unsigned long itc_busno; /* Bus number for this tce table */ | ||
95 | unsigned long itc_start; /* Will be NULL for secondary */ | ||
96 | unsigned long itc_totalsize; /* Size (in pages) of whole table */ | ||
97 | unsigned long itc_offset; /* Index into real tce table of the | ||
98 | start of our section */ | ||
99 | unsigned long itc_size; /* Size (in pages) of our section */ | ||
100 | unsigned long itc_index; /* Index of this tce table */ | ||
101 | unsigned short itc_maxtables; /* Max num of tables for partition */ | ||
102 | unsigned char itc_virtbus; /* Flag to indicate virtual bus */ | ||
103 | unsigned char itc_slotno; /* IOA Tce Slot Index */ | ||
104 | unsigned char itc_rsvd[4]; | ||
105 | }; | ||
106 | |||
107 | /* | ||
91 | * Call Hv with the architected data structure to get TCE table info. | 108 | * Call Hv with the architected data structure to get TCE table info. |
92 | * info. Put the returned data into the Linux representation of the | 109 | * info. Put the returned data into the Linux representation of the |
93 | * TCE table data. | 110 | * TCE table data. |
@@ -162,7 +179,7 @@ void iommu_devnode_init_iSeries(struct device_node *dn) | |||
162 | { | 179 | { |
163 | struct iommu_table *tbl; | 180 | struct iommu_table *tbl; |
164 | struct pci_dn *pdn = PCI_DN(dn); | 181 | struct pci_dn *pdn = PCI_DN(dn); |
165 | u32 *lsn = (u32 *)get_property(dn, "linux,logical-slot-number", NULL); | 182 | const u32 *lsn = get_property(dn, "linux,logical-slot-number", NULL); |
166 | 183 | ||
167 | BUG_ON(lsn == NULL); | 184 | BUG_ON(lsn == NULL); |
168 | 185 | ||
diff --git a/arch/powerpc/platforms/iseries/it_exp_vpd_panel.h b/arch/powerpc/platforms/iseries/it_exp_vpd_panel.h new file mode 100644 index 000000000000..6de9097b7f57 --- /dev/null +++ b/arch/powerpc/platforms/iseries/it_exp_vpd_panel.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Dave Boutcher IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H | ||
19 | #define _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H | ||
20 | |||
21 | /* | ||
22 | * This struct maps the panel information | ||
23 | * | ||
24 | * Warning: | ||
25 | * This data must match the architecture for the panel information | ||
26 | */ | ||
27 | |||
28 | #include <asm/types.h> | ||
29 | |||
30 | struct ItExtVpdPanel { | ||
31 | /* Definition of the Extended Vpd On Panel Data Area */ | ||
32 | char systemSerial[8]; | ||
33 | char mfgID[4]; | ||
34 | char reserved1[24]; | ||
35 | char machineType[4]; | ||
36 | char systemID[6]; | ||
37 | char somUniqueCnt[4]; | ||
38 | char serialNumberCount; | ||
39 | char reserved2[7]; | ||
40 | u16 bbu3; | ||
41 | u16 bbu2; | ||
42 | u16 bbu1; | ||
43 | char xLocationLabel[8]; | ||
44 | u8 xRsvd1[6]; | ||
45 | u16 xFrameId; | ||
46 | u8 xRsvd2[48]; | ||
47 | }; | ||
48 | |||
49 | extern struct ItExtVpdPanel xItExtVpdPanel; | ||
50 | |||
51 | #endif /* _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H */ | ||
diff --git a/arch/powerpc/platforms/iseries/it_lp_naca.h b/arch/powerpc/platforms/iseries/it_lp_naca.h new file mode 100644 index 000000000000..9bbf58986819 --- /dev/null +++ b/arch/powerpc/platforms/iseries/it_lp_naca.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _PLATFORMS_ISERIES_IT_LP_NACA_H | ||
19 | #define _PLATFORMS_ISERIES_IT_LP_NACA_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | |||
23 | /* | ||
24 | * This control block contains the data that is shared between the | ||
25 | * hypervisor (PLIC) and the OS. | ||
26 | */ | ||
27 | |||
28 | struct ItLpNaca { | ||
29 | // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data | ||
30 | u32 xDesc; // Eye catcher x00-x03 | ||
31 | u16 xSize; // Size of this class x04-x05 | ||
32 | u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07 | ||
33 | u8 xMaxIntHdlrEntries; // Number of entries in array x08-x08 | ||
34 | u8 xPrimaryLpIndex; // LP Index of Primary x09-x09 | ||
35 | u8 xServiceLpIndex; // LP Ind of Service Focal Pointx0A-x0A | ||
36 | u8 xLpIndex; // LP Index x0B-x0B | ||
37 | u16 xMaxLpQueues; // Number of allocated queues x0C-x0D | ||
38 | u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F | ||
39 | u8 xPirEnvironMode; // Piranha or hardware x10-x10 | ||
40 | u8 xPirConsoleMode; // Piranha console indicator x11-x11 | ||
41 | u8 xPirDasdMode; // Piranha dasd indicator x12-x12 | ||
42 | u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17 | ||
43 | u8 flags; // flags, see below x18-x1F | ||
44 | u8 xSpVpdFormat; // VPD areas are in CSP format ... | ||
45 | u8 xIntProcRatio; // Ratio of int procs to procs ... | ||
46 | u8 xRsvd1_2[5]; // Reserved ... | ||
47 | u16 xRsvd1_3; // Reserved x20-x21 | ||
48 | u16 xPlicVrmIndex; // VRM index of PLIC x22-x23 | ||
49 | u16 xMinSupportedSlicVrmInd;// Min supported OS VRM index x24-x25 | ||
50 | u16 xMinCompatableSlicVrmInd;// Min compatible OS VRM index x26-x27 | ||
51 | u64 xLoadAreaAddr; // ER address of load area x28-x2F | ||
52 | u32 xLoadAreaChunks; // Chunks for the load area x30-x33 | ||
53 | u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37 | ||
54 | // doing an ASR switch on PASE | ||
55 | // system call. | ||
56 | u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f | ||
57 | u8 xRsvd1_4[64]; // x40-x7F | ||
58 | |||
59 | // CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data | ||
60 | u8 xRsvd2_0[128]; // Reserved x00-x7F | ||
61 | |||
62 | // CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators | ||
63 | // NB: Padding required to keep xInterrruptHdlr at x300 which is required | ||
64 | // for v4r4 PLIC. | ||
65 | u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F | ||
66 | u8 xRsvd3_0[384]; // Reserved 180-2FF | ||
67 | |||
68 | // CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt | ||
69 | // handlers | ||
70 | u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF | ||
71 | }; | ||
72 | |||
73 | extern struct ItLpNaca itLpNaca; | ||
74 | |||
75 | #define ITLPNACA_LPAR 0x80 /* Is LPAR installed on the system */ | ||
76 | #define ITLPNACA_PARTITIONED 0x40 /* Is the system partitioned */ | ||
77 | #define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */ | ||
78 | #define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */ | ||
79 | |||
80 | #endif /* _PLATFORMS_ISERIES_IT_LP_NACA_H */ | ||
diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c index a7769445d6c7..8162049bb04d 100644 --- a/arch/powerpc/platforms/iseries/lpardata.c +++ b/arch/powerpc/platforms/iseries/lpardata.c | |||
@@ -13,12 +13,10 @@ | |||
13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
14 | #include <asm/ptrace.h> | 14 | #include <asm/ptrace.h> |
15 | #include <asm/abs_addr.h> | 15 | #include <asm/abs_addr.h> |
16 | #include <asm/iseries/it_lp_naca.h> | ||
17 | #include <asm/lppaca.h> | 16 | #include <asm/lppaca.h> |
18 | #include <asm/iseries/it_lp_reg_save.h> | 17 | #include <asm/iseries/it_lp_reg_save.h> |
19 | #include <asm/paca.h> | 18 | #include <asm/paca.h> |
20 | #include <asm/iseries/lpar_map.h> | 19 | #include <asm/iseries/lpar_map.h> |
21 | #include <asm/iseries/it_exp_vpd_panel.h> | ||
22 | #include <asm/iseries/it_lp_queue.h> | 20 | #include <asm/iseries/it_lp_queue.h> |
23 | 21 | ||
24 | #include "naca.h" | 22 | #include "naca.h" |
@@ -27,6 +25,8 @@ | |||
27 | #include "ipl_parms.h" | 25 | #include "ipl_parms.h" |
28 | #include "processor_vpd.h" | 26 | #include "processor_vpd.h" |
29 | #include "release_data.h" | 27 | #include "release_data.h" |
28 | #include "it_exp_vpd_panel.h" | ||
29 | #include "it_lp_naca.h" | ||
30 | 30 | ||
31 | /* The HvReleaseData is the root of the information shared between | 31 | /* The HvReleaseData is the root of the information shared between |
32 | * the hypervisor and Linux. | 32 | * the hypervisor and Linux. |
@@ -127,14 +127,12 @@ struct ItLpNaca itLpNaca = { | |||
127 | (u64)instruction_access_slb_iSeries /* 0x480 I-SLB */ | 127 | (u64)instruction_access_slb_iSeries /* 0x480 I-SLB */ |
128 | } | 128 | } |
129 | }; | 129 | }; |
130 | EXPORT_SYMBOL(itLpNaca); | ||
131 | 130 | ||
132 | /* May be filled in by the hypervisor so cannot end up in the BSS */ | 131 | /* May be filled in by the hypervisor so cannot end up in the BSS */ |
133 | struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data"))); | 132 | struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data"))); |
134 | 133 | ||
135 | /* May be filled in by the hypervisor so cannot end up in the BSS */ | 134 | /* May be filled in by the hypervisor so cannot end up in the BSS */ |
136 | struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data"))); | 135 | struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data"))); |
137 | EXPORT_SYMBOL(xItExtVpdPanel); | ||
138 | 136 | ||
139 | #define maxPhysicalProcessors 32 | 137 | #define maxPhysicalProcessors 32 |
140 | 138 | ||
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c index 2a9f81ea27d6..98c1c2440aad 100644 --- a/arch/powerpc/platforms/iseries/lpevents.c +++ b/arch/powerpc/platforms/iseries/lpevents.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <asm/iseries/it_lp_queue.h> | 20 | #include <asm/iseries/it_lp_queue.h> |
21 | #include <asm/iseries/hv_lp_event.h> | 21 | #include <asm/iseries/hv_lp_event.h> |
22 | #include <asm/iseries/hv_call_event.h> | 22 | #include <asm/iseries/hv_call_event.h> |
23 | #include <asm/iseries/it_lp_naca.h> | 23 | #include "it_lp_naca.h" |
24 | 24 | ||
25 | /* | 25 | /* |
26 | * The LpQueue is used to pass event data from the hypervisor to | 26 | * The LpQueue is used to pass event data from the hypervisor to |
diff --git a/arch/powerpc/platforms/iseries/main_store.h b/arch/powerpc/platforms/iseries/main_store.h index 74f6889f834f..1a7a3f50e40b 100644 --- a/arch/powerpc/platforms/iseries/main_store.h +++ b/arch/powerpc/platforms/iseries/main_store.h | |||
@@ -61,9 +61,9 @@ struct IoHriMainStoreSegment4 { | |||
61 | }; | 61 | }; |
62 | 62 | ||
63 | /* Main Store VPD for Power4 */ | 63 | /* Main Store VPD for Power4 */ |
64 | struct IoHriMainStoreChipInfo1 { | 64 | struct __attribute((packed)) IoHriMainStoreChipInfo1 { |
65 | u32 chipMfgID __attribute((packed)); | 65 | u32 chipMfgID; |
66 | char chipECLevel[4] __attribute((packed)); | 66 | char chipECLevel[4]; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | struct IoHriMainStoreVpdIdData { | 69 | struct IoHriMainStoreVpdIdData { |
@@ -73,72 +73,72 @@ struct IoHriMainStoreVpdIdData { | |||
73 | char serialNumber[12]; | 73 | char serialNumber[12]; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | struct IoHriMainStoreVpdFruData { | 76 | struct __attribute((packed)) IoHriMainStoreVpdFruData { |
77 | char fruLabel[8] __attribute((packed)); | 77 | char fruLabel[8]; |
78 | u8 numberOfSlots __attribute((packed)); | 78 | u8 numberOfSlots; |
79 | u8 pluggingType __attribute((packed)); | 79 | u8 pluggingType; |
80 | u16 slotMapIndex __attribute((packed)); | 80 | u16 slotMapIndex; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | struct IoHriMainStoreAdrRangeBlock { | 83 | struct __attribute((packed)) IoHriMainStoreAdrRangeBlock { |
84 | void *blockStart __attribute((packed)); | 84 | void *blockStart; |
85 | void *blockEnd __attribute((packed)); | 85 | void *blockEnd; |
86 | u32 blockProcChipId __attribute((packed)); | 86 | u32 blockProcChipId; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | #define MaxAreaAdrRangeBlocks 4 | 89 | #define MaxAreaAdrRangeBlocks 4 |
90 | 90 | ||
91 | struct IoHriMainStoreArea4 { | 91 | struct __attribute((packed)) IoHriMainStoreArea4 { |
92 | u32 msVpdFormat __attribute((packed)); | 92 | u32 msVpdFormat; |
93 | u8 containedVpdType __attribute((packed)); | 93 | u8 containedVpdType; |
94 | u8 reserved1 __attribute((packed)); | 94 | u8 reserved1; |
95 | u16 reserved2 __attribute((packed)); | 95 | u16 reserved2; |
96 | 96 | ||
97 | u64 msExists __attribute((packed)); | 97 | u64 msExists; |
98 | u64 msFunctional __attribute((packed)); | 98 | u64 msFunctional; |
99 | 99 | ||
100 | u32 memorySize __attribute((packed)); | 100 | u32 memorySize; |
101 | u32 procNodeId __attribute((packed)); | 101 | u32 procNodeId; |
102 | 102 | ||
103 | u32 numAdrRangeBlocks __attribute((packed)); | 103 | u32 numAdrRangeBlocks; |
104 | struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks] __attribute((packed)); | 104 | struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks]; |
105 | 105 | ||
106 | struct IoHriMainStoreChipInfo1 chipInfo0 __attribute((packed)); | 106 | struct IoHriMainStoreChipInfo1 chipInfo0; |
107 | struct IoHriMainStoreChipInfo1 chipInfo1 __attribute((packed)); | 107 | struct IoHriMainStoreChipInfo1 chipInfo1; |
108 | struct IoHriMainStoreChipInfo1 chipInfo2 __attribute((packed)); | 108 | struct IoHriMainStoreChipInfo1 chipInfo2; |
109 | struct IoHriMainStoreChipInfo1 chipInfo3 __attribute((packed)); | 109 | struct IoHriMainStoreChipInfo1 chipInfo3; |
110 | struct IoHriMainStoreChipInfo1 chipInfo4 __attribute((packed)); | 110 | struct IoHriMainStoreChipInfo1 chipInfo4; |
111 | struct IoHriMainStoreChipInfo1 chipInfo5 __attribute((packed)); | 111 | struct IoHriMainStoreChipInfo1 chipInfo5; |
112 | struct IoHriMainStoreChipInfo1 chipInfo6 __attribute((packed)); | 112 | struct IoHriMainStoreChipInfo1 chipInfo6; |
113 | struct IoHriMainStoreChipInfo1 chipInfo7 __attribute((packed)); | 113 | struct IoHriMainStoreChipInfo1 chipInfo7; |
114 | 114 | ||
115 | void *msRamAreaArray __attribute((packed)); | 115 | void *msRamAreaArray; |
116 | u32 msRamAreaArrayNumEntries __attribute((packed)); | 116 | u32 msRamAreaArrayNumEntries; |
117 | u32 msRamAreaArrayEntrySize __attribute((packed)); | 117 | u32 msRamAreaArrayEntrySize; |
118 | 118 | ||
119 | u32 numaDimmExists __attribute((packed)); | 119 | u32 numaDimmExists; |
120 | u32 numaDimmFunctional __attribute((packed)); | 120 | u32 numaDimmFunctional; |
121 | void *numaDimmArray __attribute((packed)); | 121 | void *numaDimmArray; |
122 | u32 numaDimmArrayNumEntries __attribute((packed)); | 122 | u32 numaDimmArrayNumEntries; |
123 | u32 numaDimmArrayEntrySize __attribute((packed)); | 123 | u32 numaDimmArrayEntrySize; |
124 | 124 | ||
125 | struct IoHriMainStoreVpdIdData idData __attribute((packed)); | 125 | struct IoHriMainStoreVpdIdData idData; |
126 | 126 | ||
127 | u64 powerData __attribute((packed)); | 127 | u64 powerData; |
128 | u64 cardAssemblyPartNum __attribute((packed)); | 128 | u64 cardAssemblyPartNum; |
129 | u64 chipSerialNum __attribute((packed)); | 129 | u64 chipSerialNum; |
130 | 130 | ||
131 | u64 reserved3 __attribute((packed)); | 131 | u64 reserved3; |
132 | char reserved4[16] __attribute((packed)); | 132 | char reserved4[16]; |
133 | 133 | ||
134 | struct IoHriMainStoreVpdFruData fruData __attribute((packed)); | 134 | struct IoHriMainStoreVpdFruData fruData; |
135 | 135 | ||
136 | u8 vpdPortNum __attribute((packed)); | 136 | u8 vpdPortNum; |
137 | u8 reserved5 __attribute((packed)); | 137 | u8 reserved5; |
138 | u8 frameId __attribute((packed)); | 138 | u8 frameId; |
139 | u8 rackUnit __attribute((packed)); | 139 | u8 rackUnit; |
140 | char asciiKeywordVpd[256] __attribute((packed)); | 140 | char asciiKeywordVpd[256]; |
141 | u32 reserved6 __attribute((packed)); | 141 | u32 reserved6; |
142 | }; | 142 | }; |
143 | 143 | ||
144 | 144 | ||
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c index 35bcc98111f5..3eb12065df23 100644 --- a/arch/powerpc/platforms/iseries/pci.c +++ b/arch/powerpc/platforms/iseries/pci.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <asm/pci-bridge.h> | 34 | #include <asm/pci-bridge.h> |
35 | #include <asm/iommu.h> | 35 | #include <asm/iommu.h> |
36 | #include <asm/abs_addr.h> | 36 | #include <asm/abs_addr.h> |
37 | #include <asm/firmware.h> | ||
37 | 38 | ||
38 | #include <asm/iseries/hv_call_xm.h> | 39 | #include <asm/iseries/hv_call_xm.h> |
39 | #include <asm/iseries/mf.h> | 40 | #include <asm/iseries/mf.h> |
@@ -176,12 +177,12 @@ void iSeries_pcibios_init(void) | |||
176 | } | 177 | } |
177 | while ((node = of_get_next_child(root, node)) != NULL) { | 178 | while ((node = of_get_next_child(root, node)) != NULL) { |
178 | HvBusNumber bus; | 179 | HvBusNumber bus; |
179 | u32 *busp; | 180 | const u32 *busp; |
180 | 181 | ||
181 | if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) | 182 | if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) |
182 | continue; | 183 | continue; |
183 | 184 | ||
184 | busp = (u32 *)get_property(node, "bus-range", NULL); | 185 | busp = get_property(node, "bus-range", NULL); |
185 | if (busp == NULL) | 186 | if (busp == NULL) |
186 | continue; | 187 | continue; |
187 | bus = *busp; | 188 | bus = *busp; |
@@ -221,10 +222,9 @@ void __init iSeries_pci_final_fixup(void) | |||
221 | 222 | ||
222 | if (node != NULL) { | 223 | if (node != NULL) { |
223 | struct pci_dn *pdn = PCI_DN(node); | 224 | struct pci_dn *pdn = PCI_DN(node); |
224 | u32 *agent; | 225 | const u32 *agent; |
225 | 226 | ||
226 | agent = (u32 *)get_property(node, "linux,agent-id", | 227 | agent = get_property(node, "linux,agent-id", NULL); |
227 | NULL); | ||
228 | if ((pdn != NULL) && (agent != NULL)) { | 228 | if ((pdn != NULL) && (agent != NULL)) { |
229 | u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, | 229 | u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, |
230 | pdn->bussubno); | 230 | pdn->bussubno); |
@@ -271,46 +271,6 @@ void pcibios_fixup_resources(struct pci_dev *pdev) | |||
271 | } | 271 | } |
272 | 272 | ||
273 | /* | 273 | /* |
274 | * I/0 Memory copy MUST use mmio commands on iSeries | ||
275 | * To do; For performance, include the hv call directly | ||
276 | */ | ||
277 | void iSeries_memset_io(volatile void __iomem *dest, char c, size_t Count) | ||
278 | { | ||
279 | u8 ByteValue = c; | ||
280 | long NumberOfBytes = Count; | ||
281 | |||
282 | while (NumberOfBytes > 0) { | ||
283 | iSeries_Write_Byte(ByteValue, dest++); | ||
284 | -- NumberOfBytes; | ||
285 | } | ||
286 | } | ||
287 | EXPORT_SYMBOL(iSeries_memset_io); | ||
288 | |||
289 | void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t count) | ||
290 | { | ||
291 | char *src = source; | ||
292 | long NumberOfBytes = count; | ||
293 | |||
294 | while (NumberOfBytes > 0) { | ||
295 | iSeries_Write_Byte(*src++, dest++); | ||
296 | -- NumberOfBytes; | ||
297 | } | ||
298 | } | ||
299 | EXPORT_SYMBOL(iSeries_memcpy_toio); | ||
300 | |||
301 | void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src, size_t count) | ||
302 | { | ||
303 | char *dst = dest; | ||
304 | long NumberOfBytes = count; | ||
305 | |||
306 | while (NumberOfBytes > 0) { | ||
307 | *dst++ = iSeries_Read_Byte(src++); | ||
308 | -- NumberOfBytes; | ||
309 | } | ||
310 | } | ||
311 | EXPORT_SYMBOL(iSeries_memcpy_fromio); | ||
312 | |||
313 | /* | ||
314 | * Look down the chain to find the matching Device Device | 274 | * Look down the chain to find the matching Device Device |
315 | */ | 275 | */ |
316 | static struct device_node *find_Device_Node(int bus, int devfn) | 276 | static struct device_node *find_Device_Node(int bus, int devfn) |
@@ -492,7 +452,7 @@ static inline struct device_node *xlate_iomm_address( | |||
492 | * iSeries_Read_Word = Read Word (16 bit) | 452 | * iSeries_Read_Word = Read Word (16 bit) |
493 | * iSeries_Read_Long = Read Long (32 bit) | 453 | * iSeries_Read_Long = Read Long (32 bit) |
494 | */ | 454 | */ |
495 | u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) | 455 | static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) |
496 | { | 456 | { |
497 | u64 BarOffset; | 457 | u64 BarOffset; |
498 | u64 dsa; | 458 | u64 dsa; |
@@ -519,9 +479,8 @@ u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) | |||
519 | 479 | ||
520 | return (u8)ret.value; | 480 | return (u8)ret.value; |
521 | } | 481 | } |
522 | EXPORT_SYMBOL(iSeries_Read_Byte); | ||
523 | 482 | ||
524 | u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) | 483 | static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) |
525 | { | 484 | { |
526 | u64 BarOffset; | 485 | u64 BarOffset; |
527 | u64 dsa; | 486 | u64 dsa; |
@@ -549,9 +508,8 @@ u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) | |||
549 | 508 | ||
550 | return swab16((u16)ret.value); | 509 | return swab16((u16)ret.value); |
551 | } | 510 | } |
552 | EXPORT_SYMBOL(iSeries_Read_Word); | ||
553 | 511 | ||
554 | u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) | 512 | static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) |
555 | { | 513 | { |
556 | u64 BarOffset; | 514 | u64 BarOffset; |
557 | u64 dsa; | 515 | u64 dsa; |
@@ -579,7 +537,6 @@ u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) | |||
579 | 537 | ||
580 | return swab32((u32)ret.value); | 538 | return swab32((u32)ret.value); |
581 | } | 539 | } |
582 | EXPORT_SYMBOL(iSeries_Read_Long); | ||
583 | 540 | ||
584 | /* | 541 | /* |
585 | * Write MM I/O Instructions for the iSeries | 542 | * Write MM I/O Instructions for the iSeries |
@@ -588,7 +545,7 @@ EXPORT_SYMBOL(iSeries_Read_Long); | |||
588 | * iSeries_Write_Word = Write Word(16 bit) | 545 | * iSeries_Write_Word = Write Word(16 bit) |
589 | * iSeries_Write_Long = Write Long(32 bit) | 546 | * iSeries_Write_Long = Write Long(32 bit) |
590 | */ | 547 | */ |
591 | void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) | 548 | static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) |
592 | { | 549 | { |
593 | u64 BarOffset; | 550 | u64 BarOffset; |
594 | u64 dsa; | 551 | u64 dsa; |
@@ -613,9 +570,8 @@ void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) | |||
613 | rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0); | 570 | rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0); |
614 | } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0); | 571 | } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0); |
615 | } | 572 | } |
616 | EXPORT_SYMBOL(iSeries_Write_Byte); | ||
617 | 573 | ||
618 | void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) | 574 | static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) |
619 | { | 575 | { |
620 | u64 BarOffset; | 576 | u64 BarOffset; |
621 | u64 dsa; | 577 | u64 dsa; |
@@ -640,9 +596,8 @@ void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) | |||
640 | rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0); | 596 | rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0); |
641 | } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0); | 597 | } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0); |
642 | } | 598 | } |
643 | EXPORT_SYMBOL(iSeries_Write_Word); | ||
644 | 599 | ||
645 | void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) | 600 | static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) |
646 | { | 601 | { |
647 | u64 BarOffset; | 602 | u64 BarOffset; |
648 | u64 dsa; | 603 | u64 dsa; |
@@ -667,4 +622,224 @@ void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) | |||
667 | rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0); | 622 | rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0); |
668 | } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0); | 623 | } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0); |
669 | } | 624 | } |
670 | EXPORT_SYMBOL(iSeries_Write_Long); | 625 | |
626 | extern unsigned char __raw_readb(const volatile void __iomem *addr) | ||
627 | { | ||
628 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
629 | |||
630 | return *(volatile unsigned char __force *)addr; | ||
631 | } | ||
632 | EXPORT_SYMBOL(__raw_readb); | ||
633 | |||
634 | extern unsigned short __raw_readw(const volatile void __iomem *addr) | ||
635 | { | ||
636 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
637 | |||
638 | return *(volatile unsigned short __force *)addr; | ||
639 | } | ||
640 | EXPORT_SYMBOL(__raw_readw); | ||
641 | |||
642 | extern unsigned int __raw_readl(const volatile void __iomem *addr) | ||
643 | { | ||
644 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
645 | |||
646 | return *(volatile unsigned int __force *)addr; | ||
647 | } | ||
648 | EXPORT_SYMBOL(__raw_readl); | ||
649 | |||
650 | extern unsigned long __raw_readq(const volatile void __iomem *addr) | ||
651 | { | ||
652 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
653 | |||
654 | return *(volatile unsigned long __force *)addr; | ||
655 | } | ||
656 | EXPORT_SYMBOL(__raw_readq); | ||
657 | |||
658 | extern void __raw_writeb(unsigned char v, volatile void __iomem *addr) | ||
659 | { | ||
660 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
661 | |||
662 | *(volatile unsigned char __force *)addr = v; | ||
663 | } | ||
664 | EXPORT_SYMBOL(__raw_writeb); | ||
665 | |||
666 | extern void __raw_writew(unsigned short v, volatile void __iomem *addr) | ||
667 | { | ||
668 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
669 | |||
670 | *(volatile unsigned short __force *)addr = v; | ||
671 | } | ||
672 | EXPORT_SYMBOL(__raw_writew); | ||
673 | |||
674 | extern void __raw_writel(unsigned int v, volatile void __iomem *addr) | ||
675 | { | ||
676 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
677 | |||
678 | *(volatile unsigned int __force *)addr = v; | ||
679 | } | ||
680 | EXPORT_SYMBOL(__raw_writel); | ||
681 | |||
682 | extern void __raw_writeq(unsigned long v, volatile void __iomem *addr) | ||
683 | { | ||
684 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
685 | |||
686 | *(volatile unsigned long __force *)addr = v; | ||
687 | } | ||
688 | EXPORT_SYMBOL(__raw_writeq); | ||
689 | |||
690 | int in_8(const volatile unsigned char __iomem *addr) | ||
691 | { | ||
692 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | ||
693 | return iSeries_Read_Byte(addr); | ||
694 | return __in_8(addr); | ||
695 | } | ||
696 | EXPORT_SYMBOL(in_8); | ||
697 | |||
698 | void out_8(volatile unsigned char __iomem *addr, int val) | ||
699 | { | ||
700 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | ||
701 | iSeries_Write_Byte(val, addr); | ||
702 | else | ||
703 | __out_8(addr, val); | ||
704 | } | ||
705 | EXPORT_SYMBOL(out_8); | ||
706 | |||
707 | int in_le16(const volatile unsigned short __iomem *addr) | ||
708 | { | ||
709 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | ||
710 | return iSeries_Read_Word(addr); | ||
711 | return __in_le16(addr); | ||
712 | } | ||
713 | EXPORT_SYMBOL(in_le16); | ||
714 | |||
715 | int in_be16(const volatile unsigned short __iomem *addr) | ||
716 | { | ||
717 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
718 | |||
719 | return __in_be16(addr); | ||
720 | } | ||
721 | EXPORT_SYMBOL(in_be16); | ||
722 | |||
723 | void out_le16(volatile unsigned short __iomem *addr, int val) | ||
724 | { | ||
725 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | ||
726 | iSeries_Write_Word(val, addr); | ||
727 | else | ||
728 | __out_le16(addr, val); | ||
729 | } | ||
730 | EXPORT_SYMBOL(out_le16); | ||
731 | |||
732 | void out_be16(volatile unsigned short __iomem *addr, int val) | ||
733 | { | ||
734 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
735 | |||
736 | __out_be16(addr, val); | ||
737 | } | ||
738 | EXPORT_SYMBOL(out_be16); | ||
739 | |||
740 | unsigned in_le32(const volatile unsigned __iomem *addr) | ||
741 | { | ||
742 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | ||
743 | return iSeries_Read_Long(addr); | ||
744 | return __in_le32(addr); | ||
745 | } | ||
746 | EXPORT_SYMBOL(in_le32); | ||
747 | |||
748 | unsigned in_be32(const volatile unsigned __iomem *addr) | ||
749 | { | ||
750 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
751 | |||
752 | return __in_be32(addr); | ||
753 | } | ||
754 | EXPORT_SYMBOL(in_be32); | ||
755 | |||
756 | void out_le32(volatile unsigned __iomem *addr, int val) | ||
757 | { | ||
758 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | ||
759 | iSeries_Write_Long(val, addr); | ||
760 | else | ||
761 | __out_le32(addr, val); | ||
762 | } | ||
763 | EXPORT_SYMBOL(out_le32); | ||
764 | |||
765 | void out_be32(volatile unsigned __iomem *addr, int val) | ||
766 | { | ||
767 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
768 | |||
769 | __out_be32(addr, val); | ||
770 | } | ||
771 | EXPORT_SYMBOL(out_be32); | ||
772 | |||
773 | unsigned long in_le64(const volatile unsigned long __iomem *addr) | ||
774 | { | ||
775 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
776 | |||
777 | return __in_le64(addr); | ||
778 | } | ||
779 | EXPORT_SYMBOL(in_le64); | ||
780 | |||
781 | unsigned long in_be64(const volatile unsigned long __iomem *addr) | ||
782 | { | ||
783 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
784 | |||
785 | return __in_be64(addr); | ||
786 | } | ||
787 | EXPORT_SYMBOL(in_be64); | ||
788 | |||
789 | void out_le64(volatile unsigned long __iomem *addr, unsigned long val) | ||
790 | { | ||
791 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
792 | |||
793 | __out_le64(addr, val); | ||
794 | } | ||
795 | EXPORT_SYMBOL(out_le64); | ||
796 | |||
797 | void out_be64(volatile unsigned long __iomem *addr, unsigned long val) | ||
798 | { | ||
799 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
800 | |||
801 | __out_be64(addr, val); | ||
802 | } | ||
803 | EXPORT_SYMBOL(out_be64); | ||
804 | |||
805 | void memset_io(volatile void __iomem *addr, int c, unsigned long n) | ||
806 | { | ||
807 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { | ||
808 | volatile char __iomem *d = addr; | ||
809 | |||
810 | while (n-- > 0) { | ||
811 | iSeries_Write_Byte(c, d++); | ||
812 | } | ||
813 | } else | ||
814 | eeh_memset_io(addr, c, n); | ||
815 | } | ||
816 | EXPORT_SYMBOL(memset_io); | ||
817 | |||
818 | void memcpy_fromio(void *dest, const volatile void __iomem *src, | ||
819 | unsigned long n) | ||
820 | { | ||
821 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { | ||
822 | char *d = dest; | ||
823 | const volatile char __iomem *s = src; | ||
824 | |||
825 | while (n-- > 0) { | ||
826 | *d++ = iSeries_Read_Byte(s++); | ||
827 | } | ||
828 | } else | ||
829 | eeh_memcpy_fromio(dest, src, n); | ||
830 | } | ||
831 | EXPORT_SYMBOL(memcpy_fromio); | ||
832 | |||
833 | void memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n) | ||
834 | { | ||
835 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { | ||
836 | const char *s = src; | ||
837 | volatile char __iomem *d = dest; | ||
838 | |||
839 | while (n-- > 0) { | ||
840 | iSeries_Write_Byte(*s++, d++); | ||
841 | } | ||
842 | } else | ||
843 | eeh_memcpy_toio(dest, src, n); | ||
844 | } | ||
845 | EXPORT_SYMBOL(memcpy_toio); | ||
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index c9605d773a77..7f1953066ff8 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include "irq.h" | 59 | #include "irq.h" |
60 | #include "vpd_areas.h" | 60 | #include "vpd_areas.h" |
61 | #include "processor_vpd.h" | 61 | #include "processor_vpd.h" |
62 | #include "it_lp_naca.h" | ||
62 | #include "main_store.h" | 63 | #include "main_store.h" |
63 | #include "call_sm.h" | 64 | #include "call_sm.h" |
64 | #include "call_hpt.h" | 65 | #include "call_hpt.h" |
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c index 622a30149b48..9baa4ee82592 100644 --- a/arch/powerpc/platforms/iseries/viopath.c +++ b/arch/powerpc/platforms/iseries/viopath.c | |||
@@ -41,8 +41,8 @@ | |||
41 | 41 | ||
42 | #include <asm/system.h> | 42 | #include <asm/system.h> |
43 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
44 | #include <asm/prom.h> | ||
44 | #include <asm/iseries/hv_types.h> | 45 | #include <asm/iseries/hv_types.h> |
45 | #include <asm/iseries/it_exp_vpd_panel.h> | ||
46 | #include <asm/iseries/hv_lp_event.h> | 46 | #include <asm/iseries/hv_lp_event.h> |
47 | #include <asm/iseries/hv_lp_config.h> | 47 | #include <asm/iseries/hv_lp_config.h> |
48 | #include <asm/iseries/mf.h> | 48 | #include <asm/iseries/mf.h> |
@@ -116,6 +116,8 @@ static int proc_viopath_show(struct seq_file *m, void *v) | |||
116 | dma_addr_t handle; | 116 | dma_addr_t handle; |
117 | HvLpEvent_Rc hvrc; | 117 | HvLpEvent_Rc hvrc; |
118 | DECLARE_MUTEX_LOCKED(Semaphore); | 118 | DECLARE_MUTEX_LOCKED(Semaphore); |
119 | struct device_node *node; | ||
120 | const char *sysid; | ||
119 | 121 | ||
120 | buf = kmalloc(HW_PAGE_SIZE, GFP_KERNEL); | 122 | buf = kmalloc(HW_PAGE_SIZE, GFP_KERNEL); |
121 | if (!buf) | 123 | if (!buf) |
@@ -143,20 +145,26 @@ static int proc_viopath_show(struct seq_file *m, void *v) | |||
143 | 145 | ||
144 | buf[HW_PAGE_SIZE-1] = '\0'; | 146 | buf[HW_PAGE_SIZE-1] = '\0'; |
145 | seq_printf(m, "%s", buf); | 147 | seq_printf(m, "%s", buf); |
146 | seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap); | ||
147 | seq_printf(m, "SRLNBR=%c%c%c%c%c%c%c\n", | ||
148 | e2a(xItExtVpdPanel.mfgID[2]), | ||
149 | e2a(xItExtVpdPanel.mfgID[3]), | ||
150 | e2a(xItExtVpdPanel.systemSerial[1]), | ||
151 | e2a(xItExtVpdPanel.systemSerial[2]), | ||
152 | e2a(xItExtVpdPanel.systemSerial[3]), | ||
153 | e2a(xItExtVpdPanel.systemSerial[4]), | ||
154 | e2a(xItExtVpdPanel.systemSerial[5])); | ||
155 | 148 | ||
156 | dma_unmap_single(iSeries_vio_dev, handle, HW_PAGE_SIZE, | 149 | dma_unmap_single(iSeries_vio_dev, handle, HW_PAGE_SIZE, |
157 | DMA_FROM_DEVICE); | 150 | DMA_FROM_DEVICE); |
158 | kfree(buf); | 151 | kfree(buf); |
159 | 152 | ||
153 | seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap); | ||
154 | |||
155 | node = of_find_node_by_path("/"); | ||
156 | sysid = NULL; | ||
157 | if (node != NULL) | ||
158 | sysid = get_property(node, "system-id", NULL); | ||
159 | |||
160 | if (sysid == NULL) | ||
161 | seq_printf(m, "SRLNBR=<UNKNOWN>\n"); | ||
162 | else | ||
163 | /* Skip "IBM," on front of serial number, see dt.c */ | ||
164 | seq_printf(m, "SRLNBR=%s\n", sysid + 4); | ||
165 | |||
166 | of_node_put(node); | ||
167 | |||
160 | return 0; | 168 | return 0; |
161 | } | 169 | } |
162 | 170 | ||
diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c b/arch/powerpc/platforms/iseries/vpdinfo.c index 23a6d1e5b429..9f83878a0c2e 100644 --- a/arch/powerpc/platforms/iseries/vpdinfo.c +++ b/arch/powerpc/platforms/iseries/vpdinfo.c | |||
@@ -188,7 +188,7 @@ static void __init iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen, | |||
188 | { | 188 | { |
189 | u8 *TagPtr = VpdData; | 189 | u8 *TagPtr = VpdData; |
190 | int DataLen = VpdDataLen - 3; | 190 | int DataLen = VpdDataLen - 3; |
191 | u8 PhbId; | 191 | u8 PhbId = 0xff; |
192 | 192 | ||
193 | while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) { | 193 | while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) { |
194 | int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256); | 194 | int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256); |
@@ -205,15 +205,16 @@ static void __init iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen, | |||
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | static void __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent, | 208 | static int __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent, |
209 | u8 *frame, char card[4]) | 209 | u8 *frame, char card[4]) |
210 | { | 210 | { |
211 | int status = 0; | ||
211 | int BusVpdLen = 0; | 212 | int BusVpdLen = 0; |
212 | u8 *BusVpdPtr = kmalloc(BUS_VPDSIZE, GFP_KERNEL); | 213 | u8 *BusVpdPtr = kmalloc(BUS_VPDSIZE, GFP_KERNEL); |
213 | 214 | ||
214 | if (BusVpdPtr == NULL) { | 215 | if (BusVpdPtr == NULL) { |
215 | printk("PCI: Bus VPD Buffer allocation failure.\n"); | 216 | printk("PCI: Bus VPD Buffer allocation failure.\n"); |
216 | return; | 217 | return 0; |
217 | } | 218 | } |
218 | BusVpdLen = HvCallPci_getBusVpd(bus, iseries_hv_addr(BusVpdPtr), | 219 | BusVpdLen = HvCallPci_getBusVpd(bus, iseries_hv_addr(BusVpdPtr), |
219 | BUS_VPDSIZE); | 220 | BUS_VPDSIZE); |
@@ -228,8 +229,10 @@ static void __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent, | |||
228 | goto out_free; | 229 | goto out_free; |
229 | } | 230 | } |
230 | iSeries_Parse_Vpd(BusVpdPtr, BusVpdLen, agent, frame, card); | 231 | iSeries_Parse_Vpd(BusVpdPtr, BusVpdLen, agent, frame, card); |
232 | status = 1; | ||
231 | out_free: | 233 | out_free: |
232 | kfree(BusVpdPtr); | 234 | kfree(BusVpdPtr); |
235 | return status; | ||
233 | } | 236 | } |
234 | 237 | ||
235 | /* | 238 | /* |
@@ -246,7 +249,7 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count) | |||
246 | struct device_node *DevNode = PciDev->sysdata; | 249 | struct device_node *DevNode = PciDev->sysdata; |
247 | struct pci_dn *pdn; | 250 | struct pci_dn *pdn; |
248 | u16 bus; | 251 | u16 bus; |
249 | u8 frame; | 252 | u8 frame = 0; |
250 | char card[4]; | 253 | char card[4]; |
251 | HvSubBusNumber subbus; | 254 | HvSubBusNumber subbus; |
252 | HvAgentId agent; | 255 | HvAgentId agent; |
@@ -262,10 +265,11 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count) | |||
262 | subbus = pdn->bussubno; | 265 | subbus = pdn->bussubno; |
263 | agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), | 266 | agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), |
264 | ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); | 267 | ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); |
265 | iSeries_Get_Location_Code(bus, agent, &frame, card); | ||
266 | 268 | ||
267 | printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, Card %4s ", | 269 | if (iSeries_Get_Location_Code(bus, agent, &frame, card)) { |
268 | count, bus, PCI_SLOT(PciDev->devfn), PciDev->vendor, | 270 | printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, " |
269 | frame, card); | 271 | "Card %4s 0x%04X\n", count, bus, |
270 | printk("0x%04X\n", (int)(PciDev->class >> 8)); | 272 | PCI_SLOT(PciDev->devfn), PciDev->vendor, frame, |
273 | card, (int)(PciDev->class >> 8)); | ||
274 | } | ||
271 | } | 275 | } |
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c index 63a1670d3bfd..c3aa46b8e2b9 100644 --- a/arch/powerpc/platforms/maple/pci.c +++ b/arch/powerpc/platforms/maple/pci.c | |||
@@ -38,16 +38,16 @@ static struct pci_controller *u3_agp, *u3_ht; | |||
38 | static int __init fixup_one_level_bus_range(struct device_node *node, int higher) | 38 | static int __init fixup_one_level_bus_range(struct device_node *node, int higher) |
39 | { | 39 | { |
40 | for (; node != 0;node = node->sibling) { | 40 | for (; node != 0;node = node->sibling) { |
41 | int * bus_range; | 41 | const int *bus_range; |
42 | unsigned int *class_code; | 42 | const unsigned int *class_code; |
43 | int len; | 43 | int len; |
44 | 44 | ||
45 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ | 45 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ |
46 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 46 | class_code = get_property(node, "class-code", NULL); |
47 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 47 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
48 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | 48 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) |
49 | continue; | 49 | continue; |
50 | bus_range = (int *) get_property(node, "bus-range", &len); | 50 | bus_range = get_property(node, "bus-range", &len); |
51 | if (bus_range != NULL && len > 2 * sizeof(int)) { | 51 | if (bus_range != NULL && len > 2 * sizeof(int)) { |
52 | if (bus_range[1] > higher) | 52 | if (bus_range[1] > higher) |
53 | higher = bus_range[1]; | 53 | higher = bus_range[1]; |
@@ -65,30 +65,36 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher | |||
65 | */ | 65 | */ |
66 | static void __init fixup_bus_range(struct device_node *bridge) | 66 | static void __init fixup_bus_range(struct device_node *bridge) |
67 | { | 67 | { |
68 | int * bus_range; | 68 | int *bus_range; |
69 | struct property *prop; | ||
69 | int len; | 70 | int len; |
70 | 71 | ||
71 | /* Lookup the "bus-range" property for the hose */ | 72 | /* Lookup the "bus-range" property for the hose */ |
72 | bus_range = (int *) get_property(bridge, "bus-range", &len); | 73 | prop = of_find_property(bridge, "bus-range", &len); |
73 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 74 | if (prop == NULL || prop->value == NULL || len < 2 * sizeof(int)) { |
74 | printk(KERN_WARNING "Can't get bus-range for %s\n", | 75 | printk(KERN_WARNING "Can't get bus-range for %s\n", |
75 | bridge->full_name); | 76 | bridge->full_name); |
76 | return; | 77 | return; |
77 | } | 78 | } |
79 | bus_range = (int *)prop->value; | ||
78 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); | 80 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); |
79 | } | 81 | } |
80 | 82 | ||
81 | 83 | ||
82 | #define U3_AGP_CFA0(devfn, off) \ | 84 | static unsigned long u3_agp_cfa0(u8 devfn, u8 off) |
83 | ((1 << (unsigned long)PCI_SLOT(dev_fn)) \ | 85 | { |
84 | | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \ | 86 | return (1 << (unsigned long)PCI_SLOT(devfn)) | |
85 | | (((unsigned long)(off)) & 0xFCUL)) | 87 | ((unsigned long)PCI_FUNC(devfn) << 8) | |
88 | ((unsigned long)off & 0xFCUL); | ||
89 | } | ||
86 | 90 | ||
87 | #define U3_AGP_CFA1(bus, devfn, off) \ | 91 | static unsigned long u3_agp_cfa1(u8 bus, u8 devfn, u8 off) |
88 | ((((unsigned long)(bus)) << 16) \ | 92 | { |
89 | |(((unsigned long)(devfn)) << 8) \ | 93 | return ((unsigned long)bus << 16) | |
90 | |(((unsigned long)(off)) & 0xFCUL) \ | 94 | ((unsigned long)devfn << 8) | |
91 | |1UL) | 95 | ((unsigned long)off & 0xFCUL) | |
96 | 1UL; | ||
97 | } | ||
92 | 98 | ||
93 | static unsigned long u3_agp_cfg_access(struct pci_controller* hose, | 99 | static unsigned long u3_agp_cfg_access(struct pci_controller* hose, |
94 | u8 bus, u8 dev_fn, u8 offset) | 100 | u8 bus, u8 dev_fn, u8 offset) |
@@ -98,9 +104,9 @@ static unsigned long u3_agp_cfg_access(struct pci_controller* hose, | |||
98 | if (bus == hose->first_busno) { | 104 | if (bus == hose->first_busno) { |
99 | if (dev_fn < (11 << 3)) | 105 | if (dev_fn < (11 << 3)) |
100 | return 0; | 106 | return 0; |
101 | caddr = U3_AGP_CFA0(dev_fn, offset); | 107 | caddr = u3_agp_cfa0(dev_fn, offset); |
102 | } else | 108 | } else |
103 | caddr = U3_AGP_CFA1(bus, dev_fn, offset); | 109 | caddr = u3_agp_cfa1(bus, dev_fn, offset); |
104 | 110 | ||
105 | /* Uninorth will return garbage if we don't read back the value ! */ | 111 | /* Uninorth will return garbage if we don't read back the value ! */ |
106 | do { | 112 | do { |
@@ -182,13 +188,15 @@ static struct pci_ops u3_agp_pci_ops = | |||
182 | u3_agp_write_config | 188 | u3_agp_write_config |
183 | }; | 189 | }; |
184 | 190 | ||
191 | static unsigned long u3_ht_cfa0(u8 devfn, u8 off) | ||
192 | { | ||
193 | return (devfn << 8) | off; | ||
194 | } | ||
185 | 195 | ||
186 | #define U3_HT_CFA0(devfn, off) \ | 196 | static unsigned long u3_ht_cfa1(u8 bus, u8 devfn, u8 off) |
187 | ((((unsigned long)devfn) << 8) | offset) | 197 | { |
188 | #define U3_HT_CFA1(bus, devfn, off) \ | 198 | return u3_ht_cfa0(devfn, off) + (bus << 16) + 0x01000000UL; |
189 | (U3_HT_CFA0(devfn, off) \ | 199 | } |
190 | + (((unsigned long)bus) << 16) \ | ||
191 | + 0x01000000UL) | ||
192 | 200 | ||
193 | static unsigned long u3_ht_cfg_access(struct pci_controller* hose, | 201 | static unsigned long u3_ht_cfg_access(struct pci_controller* hose, |
194 | u8 bus, u8 devfn, u8 offset) | 202 | u8 bus, u8 devfn, u8 offset) |
@@ -196,9 +204,9 @@ static unsigned long u3_ht_cfg_access(struct pci_controller* hose, | |||
196 | if (bus == hose->first_busno) { | 204 | if (bus == hose->first_busno) { |
197 | if (PCI_SLOT(devfn) == 0) | 205 | if (PCI_SLOT(devfn) == 0) |
198 | return 0; | 206 | return 0; |
199 | return ((unsigned long)hose->cfg_data) + U3_HT_CFA0(devfn, offset); | 207 | return ((unsigned long)hose->cfg_data) + u3_ht_cfa0(devfn, offset); |
200 | } else | 208 | } else |
201 | return ((unsigned long)hose->cfg_data) + U3_HT_CFA1(bus, devfn, offset); | 209 | return ((unsigned long)hose->cfg_data) + u3_ht_cfa1(bus, devfn, offset); |
202 | } | 210 | } |
203 | 211 | ||
204 | static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, | 212 | static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, |
@@ -211,6 +219,9 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, | |||
211 | if (hose == NULL) | 219 | if (hose == NULL) |
212 | return PCIBIOS_DEVICE_NOT_FOUND; | 220 | return PCIBIOS_DEVICE_NOT_FOUND; |
213 | 221 | ||
222 | if (offset > 0xff) | ||
223 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
224 | |||
214 | addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); | 225 | addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); |
215 | if (!addr) | 226 | if (!addr) |
216 | return PCIBIOS_DEVICE_NOT_FOUND; | 227 | return PCIBIOS_DEVICE_NOT_FOUND; |
@@ -243,6 +254,9 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, | |||
243 | if (hose == NULL) | 254 | if (hose == NULL) |
244 | return PCIBIOS_DEVICE_NOT_FOUND; | 255 | return PCIBIOS_DEVICE_NOT_FOUND; |
245 | 256 | ||
257 | if (offset > 0xff) | ||
258 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
259 | |||
246 | addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); | 260 | addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); |
247 | if (!addr) | 261 | if (!addr) |
248 | return PCIBIOS_DEVICE_NOT_FOUND; | 262 | return PCIBIOS_DEVICE_NOT_FOUND; |
@@ -314,12 +328,12 @@ static int __init add_bridge(struct device_node *dev) | |||
314 | int len; | 328 | int len; |
315 | struct pci_controller *hose; | 329 | struct pci_controller *hose; |
316 | char* disp_name; | 330 | char* disp_name; |
317 | int *bus_range; | 331 | const int *bus_range; |
318 | int primary = 1; | 332 | int primary = 1; |
319 | 333 | ||
320 | DBG("Adding PCI host bridge %s\n", dev->full_name); | 334 | DBG("Adding PCI host bridge %s\n", dev->full_name); |
321 | 335 | ||
322 | bus_range = (int *) get_property(dev, "bus-range", &len); | 336 | bus_range = get_property(dev, "bus-range", &len); |
323 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 337 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
324 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", | 338 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", |
325 | dev->full_name); | 339 | dev->full_name); |
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index 57567dfb9819..fe6b9bff61b9 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c | |||
@@ -99,8 +99,7 @@ static unsigned long maple_find_nvram_base(void) | |||
99 | static void maple_restart(char *cmd) | 99 | static void maple_restart(char *cmd) |
100 | { | 100 | { |
101 | unsigned int maple_nvram_base; | 101 | unsigned int maple_nvram_base; |
102 | unsigned int maple_nvram_offset; | 102 | const unsigned int *maple_nvram_offset, *maple_nvram_command; |
103 | unsigned int maple_nvram_command; | ||
104 | struct device_node *sp; | 103 | struct device_node *sp; |
105 | 104 | ||
106 | maple_nvram_base = maple_find_nvram_base(); | 105 | maple_nvram_base = maple_find_nvram_base(); |
@@ -113,14 +112,12 @@ static void maple_restart(char *cmd) | |||
113 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); | 112 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); |
114 | goto fail; | 113 | goto fail; |
115 | } | 114 | } |
116 | maple_nvram_offset = *(unsigned int*) get_property(sp, | 115 | maple_nvram_offset = get_property(sp, "restart-addr", NULL); |
117 | "restart-addr", NULL); | 116 | maple_nvram_command = get_property(sp, "restart-value", NULL); |
118 | maple_nvram_command = *(unsigned int*) get_property(sp, | ||
119 | "restart-value", NULL); | ||
120 | of_node_put(sp); | 117 | of_node_put(sp); |
121 | 118 | ||
122 | /* send command */ | 119 | /* send command */ |
123 | outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); | 120 | outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset); |
124 | for (;;) ; | 121 | for (;;) ; |
125 | fail: | 122 | fail: |
126 | printk(KERN_EMERG "Maple: Manual Restart Required\n"); | 123 | printk(KERN_EMERG "Maple: Manual Restart Required\n"); |
@@ -129,8 +126,7 @@ static void maple_restart(char *cmd) | |||
129 | static void maple_power_off(void) | 126 | static void maple_power_off(void) |
130 | { | 127 | { |
131 | unsigned int maple_nvram_base; | 128 | unsigned int maple_nvram_base; |
132 | unsigned int maple_nvram_offset; | 129 | const unsigned int *maple_nvram_offset, *maple_nvram_command; |
133 | unsigned int maple_nvram_command; | ||
134 | struct device_node *sp; | 130 | struct device_node *sp; |
135 | 131 | ||
136 | maple_nvram_base = maple_find_nvram_base(); | 132 | maple_nvram_base = maple_find_nvram_base(); |
@@ -143,14 +139,12 @@ static void maple_power_off(void) | |||
143 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); | 139 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); |
144 | goto fail; | 140 | goto fail; |
145 | } | 141 | } |
146 | maple_nvram_offset = *(unsigned int*) get_property(sp, | 142 | maple_nvram_offset = get_property(sp, "power-off-addr", NULL); |
147 | "power-off-addr", NULL); | 143 | maple_nvram_command = get_property(sp, "power-off-value", NULL); |
148 | maple_nvram_command = *(unsigned int*) get_property(sp, | ||
149 | "power-off-value", NULL); | ||
150 | of_node_put(sp); | 144 | of_node_put(sp); |
151 | 145 | ||
152 | /* send command */ | 146 | /* send command */ |
153 | outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); | 147 | outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset); |
154 | for (;;) ; | 148 | for (;;) ; |
155 | fail: | 149 | fail: |
156 | printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); | 150 | printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); |
@@ -211,7 +205,7 @@ static void __init maple_init_early(void) | |||
211 | static void __init maple_init_IRQ(void) | 205 | static void __init maple_init_IRQ(void) |
212 | { | 206 | { |
213 | struct device_node *root, *np, *mpic_node = NULL; | 207 | struct device_node *root, *np, *mpic_node = NULL; |
214 | unsigned int *opprop; | 208 | const unsigned int *opprop; |
215 | unsigned long openpic_addr = 0; | 209 | unsigned long openpic_addr = 0; |
216 | int naddr, n, i, opplen, has_isus = 0; | 210 | int naddr, n, i, opplen, has_isus = 0; |
217 | struct mpic *mpic; | 211 | struct mpic *mpic; |
@@ -241,8 +235,7 @@ static void __init maple_init_IRQ(void) | |||
241 | /* Find address list in /platform-open-pic */ | 235 | /* Find address list in /platform-open-pic */ |
242 | root = of_find_node_by_path("/"); | 236 | root = of_find_node_by_path("/"); |
243 | naddr = prom_n_addr_cells(root); | 237 | naddr = prom_n_addr_cells(root); |
244 | opprop = (unsigned int *) get_property(root, "platform-open-pic", | 238 | opprop = get_property(root, "platform-open-pic", &opplen); |
245 | &opplen); | ||
246 | if (opprop != 0) { | 239 | if (opprop != 0) { |
247 | openpic_addr = of_read_number(opprop, naddr); | 240 | openpic_addr = of_read_number(opprop, naddr); |
248 | has_isus = (opplen > naddr); | 241 | has_isus = (opplen > naddr); |
diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile new file mode 100644 index 000000000000..1be1a993c5f5 --- /dev/null +++ b/arch/powerpc/platforms/pasemi/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-y += setup.o pci.o time.o | |||
diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h new file mode 100644 index 000000000000..fd71d72736b2 --- /dev/null +++ b/arch/powerpc/platforms/pasemi/pasemi.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _PASEMI_PASEMI_H | ||
2 | #define _PASEMI_PASEMI_H | ||
3 | |||
4 | extern unsigned long pas_get_boot_time(void); | ||
5 | extern void pas_pci_init(void); | ||
6 | extern void pas_pcibios_fixup(void); | ||
7 | |||
8 | #endif /* _PASEMI_PASEMI_H */ | ||
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c new file mode 100644 index 000000000000..4679c5230413 --- /dev/null +++ b/arch/powerpc/platforms/pasemi/pci.c | |||
@@ -0,0 +1,198 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 PA Semi, Inc | ||
3 | * | ||
4 | * Authors: Kip Walker, PA Semi | ||
5 | * Olof Johansson, PA Semi | ||
6 | * | ||
7 | * Maintained by: Olof Johansson <olof@lixom.net> | ||
8 | * | ||
9 | * Based on arch/powerpc/platforms/maple/pci.c | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/pci.h> | ||
28 | |||
29 | #include <asm/pci-bridge.h> | ||
30 | #include <asm/machdep.h> | ||
31 | |||
32 | #include <asm/ppc-pci.h> | ||
33 | |||
34 | #define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) | ||
35 | |||
36 | #define CONFIG_OFFSET_VALID(off) ((off) < 4096) | ||
37 | |||
38 | static unsigned long pa_pxp_cfg_addr(struct pci_controller *hose, | ||
39 | u8 bus, u8 devfn, int offset) | ||
40 | { | ||
41 | return ((unsigned long)hose->cfg_data) + PA_PXP_CFA(bus, devfn, offset); | ||
42 | } | ||
43 | |||
44 | static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn, | ||
45 | int offset, int len, u32 *val) | ||
46 | { | ||
47 | struct pci_controller *hose; | ||
48 | unsigned long addr; | ||
49 | |||
50 | hose = pci_bus_to_host(bus); | ||
51 | if (!hose) | ||
52 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
53 | |||
54 | if (!CONFIG_OFFSET_VALID(offset)) | ||
55 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
56 | |||
57 | addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); | ||
58 | |||
59 | /* | ||
60 | * Note: the caller has already checked that offset is | ||
61 | * suitably aligned and that len is 1, 2 or 4. | ||
62 | */ | ||
63 | switch (len) { | ||
64 | case 1: | ||
65 | *val = in_8((u8 *)addr); | ||
66 | break; | ||
67 | case 2: | ||
68 | *val = in_le16((u16 *)addr); | ||
69 | break; | ||
70 | default: | ||
71 | *val = in_le32((u32 *)addr); | ||
72 | break; | ||
73 | } | ||
74 | |||
75 | return PCIBIOS_SUCCESSFUL; | ||
76 | } | ||
77 | |||
78 | static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn, | ||
79 | int offset, int len, u32 val) | ||
80 | { | ||
81 | struct pci_controller *hose; | ||
82 | unsigned long addr; | ||
83 | |||
84 | hose = pci_bus_to_host(bus); | ||
85 | if (!hose) | ||
86 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
87 | |||
88 | if (!CONFIG_OFFSET_VALID(offset)) | ||
89 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
90 | |||
91 | addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); | ||
92 | |||
93 | /* | ||
94 | * Note: the caller has already checked that offset is | ||
95 | * suitably aligned and that len is 1, 2 or 4. | ||
96 | */ | ||
97 | switch (len) { | ||
98 | case 1: | ||
99 | out_8((u8 *)addr, val); | ||
100 | (void) in_8((u8 *)addr); | ||
101 | break; | ||
102 | case 2: | ||
103 | out_le16((u16 *)addr, val); | ||
104 | (void) in_le16((u16 *)addr); | ||
105 | break; | ||
106 | default: | ||
107 | out_le32((u32 *)addr, val); | ||
108 | (void) in_le32((u32 *)addr); | ||
109 | break; | ||
110 | } | ||
111 | return PCIBIOS_SUCCESSFUL; | ||
112 | } | ||
113 | |||
114 | static struct pci_ops pa_pxp_ops = { | ||
115 | pa_pxp_read_config, | ||
116 | pa_pxp_write_config, | ||
117 | }; | ||
118 | |||
119 | static void __init setup_pa_pxp(struct pci_controller *hose) | ||
120 | { | ||
121 | hose->ops = &pa_pxp_ops; | ||
122 | hose->cfg_data = ioremap(0xe0000000, 0x10000000); | ||
123 | } | ||
124 | |||
125 | static int __init add_bridge(struct device_node *dev) | ||
126 | { | ||
127 | struct pci_controller *hose; | ||
128 | |||
129 | pr_debug("Adding PCI host bridge %s\n", dev->full_name); | ||
130 | |||
131 | hose = pcibios_alloc_controller(dev); | ||
132 | if (!hose) | ||
133 | return -ENOMEM; | ||
134 | |||
135 | hose->first_busno = 0; | ||
136 | hose->last_busno = 0xff; | ||
137 | |||
138 | setup_pa_pxp(hose); | ||
139 | |||
140 | printk(KERN_INFO "Found PA-PXP PCI host bridge.\n"); | ||
141 | |||
142 | /* Interpret the "ranges" property */ | ||
143 | /* This also maps the I/O region and sets isa_io/mem_base */ | ||
144 | pci_process_bridge_OF_ranges(hose, dev, 1); | ||
145 | pci_setup_phb_io(hose, 1); | ||
146 | |||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | |||
151 | void __init pas_pcibios_fixup(void) | ||
152 | { | ||
153 | struct pci_dev *dev = NULL; | ||
154 | |||
155 | for_each_pci_dev(dev) | ||
156 | pci_read_irq_line(dev); | ||
157 | } | ||
158 | |||
159 | static void __init pas_fixup_phb_resources(void) | ||
160 | { | ||
161 | struct pci_controller *hose, *tmp; | ||
162 | |||
163 | list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { | ||
164 | unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base; | ||
165 | hose->io_resource.start += offset; | ||
166 | hose->io_resource.end += offset; | ||
167 | printk(KERN_INFO "PCI Host %d, io start: %lx; io end: %lx\n", | ||
168 | hose->global_number, | ||
169 | hose->io_resource.start, hose->io_resource.end); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | |||
174 | void __init pas_pci_init(void) | ||
175 | { | ||
176 | struct device_node *np, *root; | ||
177 | |||
178 | root = of_find_node_by_path("/"); | ||
179 | if (!root) { | ||
180 | printk(KERN_CRIT "pas_pci_init: can't find root " | ||
181 | "of device tree\n"); | ||
182 | return; | ||
183 | } | ||
184 | |||
185 | for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) | ||
186 | if (np->name && !strcmp(np->name, "pxp") && !add_bridge(np)) | ||
187 | of_node_get(np); | ||
188 | |||
189 | of_node_put(root); | ||
190 | |||
191 | pas_fixup_phb_resources(); | ||
192 | |||
193 | /* Setup the linkage between OF nodes and PHBs */ | ||
194 | pci_devs_phb_init(); | ||
195 | |||
196 | /* Use the common resource allocation mechanism */ | ||
197 | pci_probe_only = 1; | ||
198 | } | ||
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c new file mode 100644 index 000000000000..628482671c15 --- /dev/null +++ b/arch/powerpc/platforms/pasemi/setup.c | |||
@@ -0,0 +1,188 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 PA Semi, Inc | ||
3 | * | ||
4 | * Authors: Kip Walker, PA Semi | ||
5 | * Olof Johansson, PA Semi | ||
6 | * | ||
7 | * Maintained by: Olof Johansson <olof@lixom.net> | ||
8 | * | ||
9 | * Based on arch/powerpc/platforms/maple/setup.c | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #include <linux/config.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/console.h> | ||
30 | |||
31 | #include <asm/prom.h> | ||
32 | #include <asm/system.h> | ||
33 | #include <asm/iommu.h> | ||
34 | #include <asm/machdep.h> | ||
35 | #include <asm/mpic.h> | ||
36 | #include <asm/smp.h> | ||
37 | #include <asm/time.h> | ||
38 | |||
39 | #include "pasemi.h" | ||
40 | |||
41 | static void pas_restart(char *cmd) | ||
42 | { | ||
43 | printk("restart unimplemented, looping...\n"); | ||
44 | for (;;) ; | ||
45 | } | ||
46 | |||
47 | static void pas_power_off(void) | ||
48 | { | ||
49 | printk("power off unimplemented, looping...\n"); | ||
50 | for (;;) ; | ||
51 | } | ||
52 | |||
53 | static void pas_halt(void) | ||
54 | { | ||
55 | pas_power_off(); | ||
56 | } | ||
57 | |||
58 | #ifdef CONFIG_SMP | ||
59 | struct smp_ops_t pas_smp_ops = { | ||
60 | .probe = smp_mpic_probe, | ||
61 | .message_pass = smp_mpic_message_pass, | ||
62 | .kick_cpu = smp_generic_kick_cpu, | ||
63 | .setup_cpu = smp_mpic_setup_cpu, | ||
64 | .give_timebase = smp_generic_give_timebase, | ||
65 | .take_timebase = smp_generic_take_timebase, | ||
66 | }; | ||
67 | #endif /* CONFIG_SMP */ | ||
68 | |||
69 | void __init pas_setup_arch(void) | ||
70 | { | ||
71 | #ifdef CONFIG_SMP | ||
72 | /* Setup SMP callback */ | ||
73 | smp_ops = &pas_smp_ops; | ||
74 | #endif | ||
75 | /* Lookup PCI hosts */ | ||
76 | pas_pci_init(); | ||
77 | |||
78 | #ifdef CONFIG_DUMMY_CONSOLE | ||
79 | conswitchp = &dummy_con; | ||
80 | #endif | ||
81 | |||
82 | printk(KERN_DEBUG "Using default idle loop\n"); | ||
83 | } | ||
84 | |||
85 | static void iommu_dev_setup_null(struct pci_dev *dev) { } | ||
86 | static void iommu_bus_setup_null(struct pci_bus *bus) { } | ||
87 | |||
88 | static void __init pas_init_early(void) | ||
89 | { | ||
90 | /* No iommu code yet */ | ||
91 | ppc_md.iommu_dev_setup = iommu_dev_setup_null; | ||
92 | ppc_md.iommu_bus_setup = iommu_bus_setup_null; | ||
93 | pci_direct_iommu_init(); | ||
94 | } | ||
95 | |||
96 | /* No legacy IO on our parts */ | ||
97 | static int pas_check_legacy_ioport(unsigned int baseport) | ||
98 | { | ||
99 | return -ENODEV; | ||
100 | } | ||
101 | |||
102 | static __init void pas_init_IRQ(void) | ||
103 | { | ||
104 | struct device_node *np; | ||
105 | struct device_node *root, *mpic_node; | ||
106 | unsigned long openpic_addr; | ||
107 | const unsigned int *opprop; | ||
108 | int naddr, opplen; | ||
109 | struct mpic *mpic; | ||
110 | |||
111 | mpic_node = NULL; | ||
112 | |||
113 | for_each_node_by_type(np, "interrupt-controller") | ||
114 | if (device_is_compatible(np, "open-pic")) { | ||
115 | mpic_node = np; | ||
116 | break; | ||
117 | } | ||
118 | if (!mpic_node) | ||
119 | for_each_node_by_type(np, "open-pic") { | ||
120 | mpic_node = np; | ||
121 | break; | ||
122 | } | ||
123 | if (!mpic_node) { | ||
124 | printk(KERN_ERR | ||
125 | "Failed to locate the MPIC interrupt controller\n"); | ||
126 | return; | ||
127 | } | ||
128 | |||
129 | /* Find address list in /platform-open-pic */ | ||
130 | root = of_find_node_by_path("/"); | ||
131 | naddr = prom_n_addr_cells(root); | ||
132 | opprop = get_property(root, "platform-open-pic", &opplen); | ||
133 | if (!opprop) { | ||
134 | printk(KERN_ERR "No platform-open-pic property.\n"); | ||
135 | of_node_put(root); | ||
136 | return; | ||
137 | } | ||
138 | openpic_addr = of_read_number(opprop, naddr); | ||
139 | printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); | ||
140 | of_node_put(root); | ||
141 | |||
142 | mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0, | ||
143 | " PAS-OPIC "); | ||
144 | BUG_ON(!mpic); | ||
145 | |||
146 | mpic_assign_isu(mpic, 0, openpic_addr + 0x10000); | ||
147 | mpic_init(mpic); | ||
148 | of_node_put(mpic_node); | ||
149 | of_node_put(root); | ||
150 | } | ||
151 | |||
152 | static void __init pas_progress(char *s, unsigned short hex) | ||
153 | { | ||
154 | printk("[%04x] : %s\n", hex, s ? s : ""); | ||
155 | } | ||
156 | |||
157 | |||
158 | /* | ||
159 | * Called very early, MMU is off, device-tree isn't unflattened | ||
160 | */ | ||
161 | static int __init pas_probe(void) | ||
162 | { | ||
163 | unsigned long root = of_get_flat_dt_root(); | ||
164 | |||
165 | if (!of_flat_dt_is_compatible(root, "PA6T-1682M")) | ||
166 | return 0; | ||
167 | |||
168 | hpte_init_native(); | ||
169 | |||
170 | return 1; | ||
171 | } | ||
172 | |||
173 | define_machine(pas) { | ||
174 | .name = "PA Semi PA6T-1682M", | ||
175 | .probe = pas_probe, | ||
176 | .setup_arch = pas_setup_arch, | ||
177 | .init_early = pas_init_early, | ||
178 | .init_IRQ = pas_init_IRQ, | ||
179 | .get_irq = mpic_get_irq, | ||
180 | .pcibios_fixup = pas_pcibios_fixup, | ||
181 | .restart = pas_restart, | ||
182 | .power_off = pas_power_off, | ||
183 | .halt = pas_halt, | ||
184 | .get_boot_time = pas_get_boot_time, | ||
185 | .calibrate_decr = generic_calibrate_decr, | ||
186 | .check_legacy_ioport = pas_check_legacy_ioport, | ||
187 | .progress = pas_progress, | ||
188 | }; | ||
diff --git a/arch/powerpc/platforms/pasemi/time.c b/arch/powerpc/platforms/pasemi/time.c new file mode 100644 index 000000000000..9bd410b8fec6 --- /dev/null +++ b/arch/powerpc/platforms/pasemi/time.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 PA Semi, Inc | ||
3 | * | ||
4 | * Maintained by: Olof Johansson <olof@lixom.net> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/config.h> | ||
21 | #include <linux/time.h> | ||
22 | |||
23 | #include <asm/time.h> | ||
24 | |||
25 | unsigned long __init pas_get_boot_time(void) | ||
26 | { | ||
27 | /* Let's just return a fake date right now */ | ||
28 | return mktime(2006, 1, 1, 12, 0, 0); | ||
29 | } | ||
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c index d66415491055..afa593a8544a 100644 --- a/arch/powerpc/platforms/powermac/backlight.c +++ b/arch/powerpc/platforms/powermac/backlight.c | |||
@@ -60,7 +60,8 @@ int pmac_has_backlight_type(const char *type) | |||
60 | struct device_node* bk_node = find_devices("backlight"); | 60 | struct device_node* bk_node = find_devices("backlight"); |
61 | 61 | ||
62 | if (bk_node) { | 62 | if (bk_node) { |
63 | char *prop = get_property(bk_node, "backlight-control", NULL); | 63 | const char *prop = get_property(bk_node, |
64 | "backlight-control", NULL); | ||
64 | if (prop && strncmp(prop, type, strlen(type)) == 0) | 65 | if (prop && strncmp(prop, type, strlen(type)) == 0) |
65 | return 1; | 66 | return 1; |
66 | } | 67 | } |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c index 62926248bdb8..c2b6b4134f68 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_32.c +++ b/arch/powerpc/platforms/powermac/cpufreq_32.c | |||
@@ -421,7 +421,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
421 | 421 | ||
422 | static u32 read_gpio(struct device_node *np) | 422 | static u32 read_gpio(struct device_node *np) |
423 | { | 423 | { |
424 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 424 | const u32 *reg = get_property(np, "reg", NULL); |
425 | u32 offset; | 425 | u32 offset; |
426 | 426 | ||
427 | if (reg == NULL) | 427 | if (reg == NULL) |
@@ -497,7 +497,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
497 | "frequency-gpio"); | 497 | "frequency-gpio"); |
498 | struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL, | 498 | struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL, |
499 | "slewing-done"); | 499 | "slewing-done"); |
500 | u32 *value; | 500 | const u32 *value; |
501 | 501 | ||
502 | /* | 502 | /* |
503 | * Check to see if it's GPIO driven or PMU only | 503 | * Check to see if it's GPIO driven or PMU only |
@@ -519,15 +519,15 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
519 | */ | 519 | */ |
520 | if (frequency_gpio && slew_done_gpio) { | 520 | if (frequency_gpio && slew_done_gpio) { |
521 | int lenp, rc; | 521 | int lenp, rc; |
522 | u32 *freqs, *ratio; | 522 | const u32 *freqs, *ratio; |
523 | 523 | ||
524 | freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp); | 524 | freqs = get_property(cpunode, "bus-frequencies", &lenp); |
525 | lenp /= sizeof(u32); | 525 | lenp /= sizeof(u32); |
526 | if (freqs == NULL || lenp != 2) { | 526 | if (freqs == NULL || lenp != 2) { |
527 | printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n"); | 527 | printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n"); |
528 | return 1; | 528 | return 1; |
529 | } | 529 | } |
530 | ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL); | 530 | ratio = get_property(cpunode, "processor-to-bus-ratio*2", NULL); |
531 | if (ratio == NULL) { | 531 | if (ratio == NULL) { |
532 | printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); | 532 | printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); |
533 | return 1; | 533 | return 1; |
@@ -562,7 +562,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
562 | /* If we use the PMU, look for the min & max frequencies in the | 562 | /* If we use the PMU, look for the min & max frequencies in the |
563 | * device-tree | 563 | * device-tree |
564 | */ | 564 | */ |
565 | value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL); | 565 | value = get_property(cpunode, "min-clock-frequency", NULL); |
566 | if (!value) | 566 | if (!value) |
567 | return 1; | 567 | return 1; |
568 | low_freq = (*value) / 1000; | 568 | low_freq = (*value) / 1000; |
@@ -571,7 +571,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
571 | if (low_freq < 100000) | 571 | if (low_freq < 100000) |
572 | low_freq *= 10; | 572 | low_freq *= 10; |
573 | 573 | ||
574 | value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL); | 574 | value = get_property(cpunode, "max-clock-frequency", NULL); |
575 | if (!value) | 575 | if (!value) |
576 | return 1; | 576 | return 1; |
577 | hi_freq = (*value) / 1000; | 577 | hi_freq = (*value) / 1000; |
@@ -611,13 +611,14 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) | |||
611 | static int pmac_cpufreq_init_750FX(struct device_node *cpunode) | 611 | static int pmac_cpufreq_init_750FX(struct device_node *cpunode) |
612 | { | 612 | { |
613 | struct device_node *volt_gpio_np; | 613 | struct device_node *volt_gpio_np; |
614 | u32 pvr, *value; | 614 | u32 pvr; |
615 | const u32 *value; | ||
615 | 616 | ||
616 | if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) | 617 | if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) |
617 | return 1; | 618 | return 1; |
618 | 619 | ||
619 | hi_freq = cur_freq; | 620 | hi_freq = cur_freq; |
620 | value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL); | 621 | value = get_property(cpunode, "reduced-clock-frequency", NULL); |
621 | if (!value) | 622 | if (!value) |
622 | return 1; | 623 | return 1; |
623 | low_freq = (*value) / 1000; | 624 | low_freq = (*value) / 1000; |
@@ -650,7 +651,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) | |||
650 | static int __init pmac_cpufreq_setup(void) | 651 | static int __init pmac_cpufreq_setup(void) |
651 | { | 652 | { |
652 | struct device_node *cpunode; | 653 | struct device_node *cpunode; |
653 | u32 *value; | 654 | const u32 *value; |
654 | 655 | ||
655 | if (strstr(cmd_line, "nocpufreq")) | 656 | if (strstr(cmd_line, "nocpufreq")) |
656 | return 0; | 657 | return 0; |
@@ -661,7 +662,7 @@ static int __init pmac_cpufreq_setup(void) | |||
661 | goto out; | 662 | goto out; |
662 | 663 | ||
663 | /* Get current cpu clock freq */ | 664 | /* Get current cpu clock freq */ |
664 | value = (u32 *)get_property(cpunode, "clock-frequency", NULL); | 665 | value = get_property(cpunode, "clock-frequency", NULL); |
665 | if (!value) | 666 | if (!value) |
666 | goto out; | 667 | goto out; |
667 | cur_freq = (*value) / 1000; | 668 | cur_freq = (*value) / 1000; |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c index 7b1156ea5341..d30466d74194 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_64.c +++ b/arch/powerpc/platforms/powermac/cpufreq_64.c | |||
@@ -89,7 +89,7 @@ static DEFINE_MUTEX(g5_switch_mutex); | |||
89 | 89 | ||
90 | #ifdef CONFIG_PMAC_SMU | 90 | #ifdef CONFIG_PMAC_SMU |
91 | 91 | ||
92 | static u32 *g5_pmode_data; | 92 | static const u32 *g5_pmode_data; |
93 | static int g5_pmode_max; | 93 | static int g5_pmode_max; |
94 | 94 | ||
95 | static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ | 95 | static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ |
@@ -391,7 +391,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
391 | unsigned int psize, ssize; | 391 | unsigned int psize, ssize; |
392 | unsigned long max_freq; | 392 | unsigned long max_freq; |
393 | char *freq_method, *volt_method; | 393 | char *freq_method, *volt_method; |
394 | u32 *valp, pvr_hi; | 394 | const u32 *valp; |
395 | u32 pvr_hi; | ||
395 | int use_volts_vdnap = 0; | 396 | int use_volts_vdnap = 0; |
396 | int use_volts_smu = 0; | 397 | int use_volts_smu = 0; |
397 | int rc = -ENODEV; | 398 | int rc = -ENODEV; |
@@ -409,8 +410,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
409 | /* Get first CPU node */ | 410 | /* Get first CPU node */ |
410 | for (cpunode = NULL; | 411 | for (cpunode = NULL; |
411 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { | 412 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { |
412 | u32 *reg = | 413 | const u32 *reg = get_property(cpunode, "reg", NULL); |
413 | (u32 *)get_property(cpunode, "reg", NULL); | ||
414 | if (reg == NULL || (*reg) != 0) | 414 | if (reg == NULL || (*reg) != 0) |
415 | continue; | 415 | continue; |
416 | if (!strcmp(cpunode->type, "cpu")) | 416 | if (!strcmp(cpunode->type, "cpu")) |
@@ -422,7 +422,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | /* Check 970FX for now */ | 424 | /* Check 970FX for now */ |
425 | valp = (u32 *)get_property(cpunode, "cpu-version", NULL); | 425 | valp = get_property(cpunode, "cpu-version", NULL); |
426 | if (!valp) { | 426 | if (!valp) { |
427 | DBG("No cpu-version property !\n"); | 427 | DBG("No cpu-version property !\n"); |
428 | goto bail_noprops; | 428 | goto bail_noprops; |
@@ -434,7 +434,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
434 | } | 434 | } |
435 | 435 | ||
436 | /* Look for the powertune data in the device-tree */ | 436 | /* Look for the powertune data in the device-tree */ |
437 | g5_pmode_data = (u32 *)get_property(cpunode, "power-mode-data",&psize); | 437 | g5_pmode_data = get_property(cpunode, "power-mode-data",&psize); |
438 | if (!g5_pmode_data) { | 438 | if (!g5_pmode_data) { |
439 | DBG("No power-mode-data !\n"); | 439 | DBG("No power-mode-data !\n"); |
440 | goto bail_noprops; | 440 | goto bail_noprops; |
@@ -442,7 +442,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
442 | g5_pmode_max = psize / sizeof(u32) - 1; | 442 | g5_pmode_max = psize / sizeof(u32) - 1; |
443 | 443 | ||
444 | if (use_volts_smu) { | 444 | if (use_volts_smu) { |
445 | struct smu_sdbp_header *shdr; | 445 | const struct smu_sdbp_header *shdr; |
446 | 446 | ||
447 | /* Look for the FVT table */ | 447 | /* Look for the FVT table */ |
448 | shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL); | 448 | shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL); |
@@ -493,7 +493,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
493 | * half freq in this version. So far, I haven't yet seen a machine | 493 | * half freq in this version. So far, I haven't yet seen a machine |
494 | * supporting anything else. | 494 | * supporting anything else. |
495 | */ | 495 | */ |
496 | valp = (u32 *)get_property(cpunode, "clock-frequency", NULL); | 496 | valp = get_property(cpunode, "clock-frequency", NULL); |
497 | if (!valp) | 497 | if (!valp) |
498 | return -ENODEV; | 498 | return -ENODEV; |
499 | max_freq = (*valp)/1000; | 499 | max_freq = (*valp)/1000; |
@@ -541,8 +541,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
541 | static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | 541 | static int __init g5_pm72_cpufreq_init(struct device_node *cpus) |
542 | { | 542 | { |
543 | struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; | 543 | struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; |
544 | u8 *eeprom = NULL; | 544 | const u8 *eeprom = NULL; |
545 | u32 *valp; | 545 | const u32 *valp; |
546 | u64 max_freq, min_freq, ih, il; | 546 | u64 max_freq, min_freq, ih, il; |
547 | int has_volt = 1, rc = 0; | 547 | int has_volt = 1, rc = 0; |
548 | 548 | ||
@@ -563,7 +563,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
563 | /* Lookup the cpuid eeprom node */ | 563 | /* Lookup the cpuid eeprom node */ |
564 | cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); | 564 | cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); |
565 | if (cpuid != NULL) | 565 | if (cpuid != NULL) |
566 | eeprom = (u8 *)get_property(cpuid, "cpuid", NULL); | 566 | eeprom = get_property(cpuid, "cpuid", NULL); |
567 | if (eeprom == NULL) { | 567 | if (eeprom == NULL) { |
568 | printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n"); | 568 | printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n"); |
569 | rc = -ENODEV; | 569 | rc = -ENODEV; |
@@ -573,7 +573,8 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
573 | /* Lookup the i2c hwclock */ | 573 | /* Lookup the i2c hwclock */ |
574 | for (hwclock = NULL; | 574 | for (hwclock = NULL; |
575 | (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){ | 575 | (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){ |
576 | char *loc = get_property(hwclock, "hwctrl-location", NULL); | 576 | const char *loc = get_property(hwclock, |
577 | "hwctrl-location", NULL); | ||
577 | if (loc == NULL) | 578 | if (loc == NULL) |
578 | continue; | 579 | continue; |
579 | if (strcmp(loc, "CPU CLOCK")) | 580 | if (strcmp(loc, "CPU CLOCK")) |
@@ -637,7 +638,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
637 | */ | 638 | */ |
638 | 639 | ||
639 | /* Get max frequency from device-tree */ | 640 | /* Get max frequency from device-tree */ |
640 | valp = (u32 *)get_property(cpunode, "clock-frequency", NULL); | 641 | valp = get_property(cpunode, "clock-frequency", NULL); |
641 | if (!valp) { | 642 | if (!valp) { |
642 | printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n"); | 643 | printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n"); |
643 | rc = -ENODEV; | 644 | rc = -ENODEV; |
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index f8313bf9a9f7..13fcaf5b1796 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c | |||
@@ -1058,8 +1058,8 @@ core99_reset_cpu(struct device_node *node, long param, long value) | |||
1058 | if (np == NULL) | 1058 | if (np == NULL) |
1059 | return -ENODEV; | 1059 | return -ENODEV; |
1060 | for (np = np->child; np != NULL; np = np->sibling) { | 1060 | for (np = np->child; np != NULL; np = np->sibling) { |
1061 | u32 *num = (u32 *)get_property(np, "reg", NULL); | 1061 | u32 *num = get_property(np, "reg", NULL); |
1062 | u32 *rst = (u32 *)get_property(np, "soft-reset", NULL); | 1062 | u32 *rst = get_property(np, "soft-reset", NULL); |
1063 | if (num == NULL || rst == NULL) | 1063 | if (num == NULL || rst == NULL) |
1064 | continue; | 1064 | continue; |
1065 | if (param == *num) { | 1065 | if (param == *num) { |
@@ -1087,7 +1087,7 @@ core99_usb_enable(struct device_node *node, long param, long value) | |||
1087 | { | 1087 | { |
1088 | struct macio_chip *macio; | 1088 | struct macio_chip *macio; |
1089 | unsigned long flags; | 1089 | unsigned long flags; |
1090 | char *prop; | 1090 | const char *prop; |
1091 | int number; | 1091 | int number; |
1092 | u32 reg; | 1092 | u32 reg; |
1093 | 1093 | ||
@@ -1096,7 +1096,7 @@ core99_usb_enable(struct device_node *node, long param, long value) | |||
1096 | macio->type != macio_intrepid) | 1096 | macio->type != macio_intrepid) |
1097 | return -ENODEV; | 1097 | return -ENODEV; |
1098 | 1098 | ||
1099 | prop = (char *)get_property(node, "AAPL,clock-id", NULL); | 1099 | prop = get_property(node, "AAPL,clock-id", NULL); |
1100 | if (!prop) | 1100 | if (!prop) |
1101 | return -ENODEV; | 1101 | return -ENODEV; |
1102 | if (strncmp(prop, "usb0u048", 8) == 0) | 1102 | if (strncmp(prop, "usb0u048", 8) == 0) |
@@ -1507,8 +1507,8 @@ static long g5_reset_cpu(struct device_node *node, long param, long value) | |||
1507 | if (np == NULL) | 1507 | if (np == NULL) |
1508 | return -ENODEV; | 1508 | return -ENODEV; |
1509 | for (np = np->child; np != NULL; np = np->sibling) { | 1509 | for (np = np->child; np != NULL; np = np->sibling) { |
1510 | u32 *num = (u32 *)get_property(np, "reg", NULL); | 1510 | const u32 *num = get_property(np, "reg", NULL); |
1511 | u32 *rst = (u32 *)get_property(np, "soft-reset", NULL); | 1511 | const u32 *rst = get_property(np, "soft-reset", NULL); |
1512 | if (num == NULL || rst == NULL) | 1512 | if (num == NULL || rst == NULL) |
1513 | continue; | 1513 | continue; |
1514 | if (param == *num) { | 1514 | if (param == *num) { |
@@ -2408,7 +2408,7 @@ static int __init probe_motherboard(void) | |||
2408 | */ | 2408 | */ |
2409 | dt = find_devices("device-tree"); | 2409 | dt = find_devices("device-tree"); |
2410 | if (dt != NULL) | 2410 | if (dt != NULL) |
2411 | model = (const char *) get_property(dt, "model", NULL); | 2411 | model = get_property(dt, "model", NULL); |
2412 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { | 2412 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { |
2413 | if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { | 2413 | if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { |
2414 | pmac_mb = pmac_mb_defs[i]; | 2414 | pmac_mb = pmac_mb_defs[i]; |
@@ -2536,7 +2536,7 @@ found: | |||
2536 | */ | 2536 | */ |
2537 | static void __init probe_uninorth(void) | 2537 | static void __init probe_uninorth(void) |
2538 | { | 2538 | { |
2539 | u32 *addrp; | 2539 | const u32 *addrp; |
2540 | phys_addr_t address; | 2540 | phys_addr_t address; |
2541 | unsigned long actrl; | 2541 | unsigned long actrl; |
2542 | 2542 | ||
@@ -2555,7 +2555,7 @@ static void __init probe_uninorth(void) | |||
2555 | if (uninorth_node == NULL) | 2555 | if (uninorth_node == NULL) |
2556 | return; | 2556 | return; |
2557 | 2557 | ||
2558 | addrp = (u32 *)get_property(uninorth_node, "reg", NULL); | 2558 | addrp = get_property(uninorth_node, "reg", NULL); |
2559 | if (addrp == NULL) | 2559 | if (addrp == NULL) |
2560 | return; | 2560 | return; |
2561 | address = of_translate_address(uninorth_node, addrp); | 2561 | address = of_translate_address(uninorth_node, addrp); |
@@ -2596,7 +2596,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ | |||
2596 | struct device_node* node; | 2596 | struct device_node* node; |
2597 | int i; | 2597 | int i; |
2598 | volatile u32 __iomem *base; | 2598 | volatile u32 __iomem *base; |
2599 | u32 *addrp, *revp; | 2599 | const u32 *addrp, *revp; |
2600 | phys_addr_t addr; | 2600 | phys_addr_t addr; |
2601 | u64 size; | 2601 | u64 size; |
2602 | 2602 | ||
@@ -2639,7 +2639,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ | |||
2639 | return; | 2639 | return; |
2640 | } | 2640 | } |
2641 | if (type == macio_keylargo || type == macio_keylargo2) { | 2641 | if (type == macio_keylargo || type == macio_keylargo2) { |
2642 | u32 *did = (u32 *)get_property(node, "device-id", NULL); | 2642 | const u32 *did = get_property(node, "device-id", NULL); |
2643 | if (*did == 0x00000025) | 2643 | if (*did == 0x00000025) |
2644 | type = macio_pangea; | 2644 | type = macio_pangea; |
2645 | if (*did == 0x0000003e) | 2645 | if (*did == 0x0000003e) |
@@ -2652,7 +2652,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ | |||
2652 | macio_chips[i].base = base; | 2652 | macio_chips[i].base = base; |
2653 | macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; | 2653 | macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; |
2654 | macio_chips[i].name = macio_names[type]; | 2654 | macio_chips[i].name = macio_names[type]; |
2655 | revp = (u32 *)get_property(node, "revision-id", NULL); | 2655 | revp = get_property(node, "revision-id", NULL); |
2656 | if (revp) | 2656 | if (revp) |
2657 | macio_chips[i].rev = *revp; | 2657 | macio_chips[i].rev = *revp; |
2658 | printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", | 2658 | printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", |
@@ -2695,15 +2695,15 @@ static void __init | |||
2695 | initial_serial_shutdown(struct device_node *np) | 2695 | initial_serial_shutdown(struct device_node *np) |
2696 | { | 2696 | { |
2697 | int len; | 2697 | int len; |
2698 | struct slot_names_prop { | 2698 | const struct slot_names_prop { |
2699 | int count; | 2699 | int count; |
2700 | char name[1]; | 2700 | char name[1]; |
2701 | } *slots; | 2701 | } *slots; |
2702 | char *conn; | 2702 | const char *conn; |
2703 | int port_type = PMAC_SCC_ASYNC; | 2703 | int port_type = PMAC_SCC_ASYNC; |
2704 | int modem = 0; | 2704 | int modem = 0; |
2705 | 2705 | ||
2706 | slots = (struct slot_names_prop *)get_property(np, "slot-names", &len); | 2706 | slots = get_property(np, "slot-names", &len); |
2707 | conn = get_property(np, "AAPL,connector", &len); | 2707 | conn = get_property(np, "AAPL,connector", &len); |
2708 | if (conn && (strcmp(conn, "infrared") == 0)) | 2708 | if (conn && (strcmp(conn, "infrared") == 0)) |
2709 | port_type = PMAC_SCC_IRDA; | 2709 | port_type = PMAC_SCC_IRDA; |
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index 8677f50c2586..c2c7cf75dd5f 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c | |||
@@ -477,7 +477,8 @@ static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, | |||
477 | static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | 477 | static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) |
478 | { | 478 | { |
479 | struct pmac_i2c_host_kw *host; | 479 | struct pmac_i2c_host_kw *host; |
480 | u32 *psteps, *prate, *addrp, steps; | 480 | const u32 *psteps, *prate, *addrp; |
481 | u32 steps; | ||
481 | 482 | ||
482 | host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL); | 483 | host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL); |
483 | if (host == NULL) { | 484 | if (host == NULL) { |
@@ -490,7 +491,7 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | |||
490 | * on all i2c keywest nodes so far ... we would have to fallback | 491 | * on all i2c keywest nodes so far ... we would have to fallback |
491 | * to macio parsing if that wasn't the case | 492 | * to macio parsing if that wasn't the case |
492 | */ | 493 | */ |
493 | addrp = (u32 *)get_property(np, "AAPL,address", NULL); | 494 | addrp = get_property(np, "AAPL,address", NULL); |
494 | if (addrp == NULL) { | 495 | if (addrp == NULL) { |
495 | printk(KERN_ERR "low_i2c: Can't find address for %s\n", | 496 | printk(KERN_ERR "low_i2c: Can't find address for %s\n", |
496 | np->full_name); | 497 | np->full_name); |
@@ -504,13 +505,13 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | |||
504 | host->timeout_timer.function = kw_i2c_timeout; | 505 | host->timeout_timer.function = kw_i2c_timeout; |
505 | host->timeout_timer.data = (unsigned long)host; | 506 | host->timeout_timer.data = (unsigned long)host; |
506 | 507 | ||
507 | psteps = (u32 *)get_property(np, "AAPL,address-step", NULL); | 508 | psteps = get_property(np, "AAPL,address-step", NULL); |
508 | steps = psteps ? (*psteps) : 0x10; | 509 | steps = psteps ? (*psteps) : 0x10; |
509 | for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) | 510 | for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) |
510 | steps >>= 1; | 511 | steps >>= 1; |
511 | /* Select interface rate */ | 512 | /* Select interface rate */ |
512 | host->speed = KW_I2C_MODE_25KHZ; | 513 | host->speed = KW_I2C_MODE_25KHZ; |
513 | prate = (u32 *)get_property(np, "AAPL,i2c-rate", NULL); | 514 | prate = get_property(np, "AAPL,i2c-rate", NULL); |
514 | if (prate) switch(*prate) { | 515 | if (prate) switch(*prate) { |
515 | case 100: | 516 | case 100: |
516 | host->speed = KW_I2C_MODE_100KHZ; | 517 | host->speed = KW_I2C_MODE_100KHZ; |
@@ -618,8 +619,8 @@ static void __init kw_i2c_probe(void) | |||
618 | } else { | 619 | } else { |
619 | for (child = NULL; | 620 | for (child = NULL; |
620 | (child = of_get_next_child(np, child)) != NULL;) { | 621 | (child = of_get_next_child(np, child)) != NULL;) { |
621 | u32 *reg = | 622 | const u32 *reg = get_property(child, |
622 | (u32 *)get_property(child, "reg", NULL); | 623 | "reg", NULL); |
623 | if (reg == NULL) | 624 | if (reg == NULL) |
624 | continue; | 625 | continue; |
625 | kw_i2c_add(host, np, child, *reg); | 626 | kw_i2c_add(host, np, child, *reg); |
@@ -881,7 +882,7 @@ static void __init smu_i2c_probe(void) | |||
881 | { | 882 | { |
882 | struct device_node *controller, *busnode; | 883 | struct device_node *controller, *busnode; |
883 | struct pmac_i2c_bus *bus; | 884 | struct pmac_i2c_bus *bus; |
884 | u32 *reg; | 885 | const u32 *reg; |
885 | int sz; | 886 | int sz; |
886 | 887 | ||
887 | if (!smu_present()) | 888 | if (!smu_present()) |
@@ -904,7 +905,7 @@ static void __init smu_i2c_probe(void) | |||
904 | if (strcmp(busnode->type, "i2c") && | 905 | if (strcmp(busnode->type, "i2c") && |
905 | strcmp(busnode->type, "i2c-bus")) | 906 | strcmp(busnode->type, "i2c-bus")) |
906 | continue; | 907 | continue; |
907 | reg = (u32 *)get_property(busnode, "reg", NULL); | 908 | reg = get_property(busnode, "reg", NULL); |
908 | if (reg == NULL) | 909 | if (reg == NULL) |
909 | continue; | 910 | continue; |
910 | 911 | ||
@@ -948,9 +949,8 @@ struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node) | |||
948 | list_for_each_entry(bus, &pmac_i2c_busses, link) { | 949 | list_for_each_entry(bus, &pmac_i2c_busses, link) { |
949 | if (p == bus->busnode) { | 950 | if (p == bus->busnode) { |
950 | if (prev && bus->flags & pmac_i2c_multibus) { | 951 | if (prev && bus->flags & pmac_i2c_multibus) { |
951 | u32 *reg; | 952 | const u32 *reg; |
952 | reg = (u32 *)get_property(prev, "reg", | 953 | reg = get_property(prev, "reg", NULL); |
953 | NULL); | ||
954 | if (!reg) | 954 | if (!reg) |
955 | continue; | 955 | continue; |
956 | if (((*reg) >> 8) != bus->channel) | 956 | if (((*reg) >> 8) != bus->channel) |
@@ -971,7 +971,7 @@ EXPORT_SYMBOL_GPL(pmac_i2c_find_bus); | |||
971 | 971 | ||
972 | u8 pmac_i2c_get_dev_addr(struct device_node *device) | 972 | u8 pmac_i2c_get_dev_addr(struct device_node *device) |
973 | { | 973 | { |
974 | u32 *reg = (u32 *)get_property(device, "reg", NULL); | 974 | const u32 *reg = get_property(device, "reg", NULL); |
975 | 975 | ||
976 | if (reg == NULL) | 976 | if (reg == NULL) |
977 | return 0; | 977 | return 0; |
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index 205d04471161..9923adc5248e 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
@@ -66,16 +66,16 @@ struct device_node *k2_skiplist[2]; | |||
66 | static int __init fixup_one_level_bus_range(struct device_node *node, int higher) | 66 | static int __init fixup_one_level_bus_range(struct device_node *node, int higher) |
67 | { | 67 | { |
68 | for (; node != 0;node = node->sibling) { | 68 | for (; node != 0;node = node->sibling) { |
69 | int * bus_range; | 69 | const int * bus_range; |
70 | unsigned int *class_code; | 70 | const unsigned int *class_code; |
71 | int len; | 71 | int len; |
72 | 72 | ||
73 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ | 73 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ |
74 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 74 | class_code = get_property(node, "class-code", NULL); |
75 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 75 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
76 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | 76 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) |
77 | continue; | 77 | continue; |
78 | bus_range = (int *) get_property(node, "bus-range", &len); | 78 | bus_range = get_property(node, "bus-range", &len); |
79 | if (bus_range != NULL && len > 2 * sizeof(int)) { | 79 | if (bus_range != NULL && len > 2 * sizeof(int)) { |
80 | if (bus_range[1] > higher) | 80 | if (bus_range[1] > higher) |
81 | higher = bus_range[1]; | 81 | higher = bus_range[1]; |
@@ -93,13 +93,15 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher | |||
93 | */ | 93 | */ |
94 | static void __init fixup_bus_range(struct device_node *bridge) | 94 | static void __init fixup_bus_range(struct device_node *bridge) |
95 | { | 95 | { |
96 | int * bus_range; | 96 | int *bus_range, len; |
97 | int len; | 97 | struct property *prop; |
98 | 98 | ||
99 | /* Lookup the "bus-range" property for the hose */ | 99 | /* Lookup the "bus-range" property for the hose */ |
100 | bus_range = (int *) get_property(bridge, "bus-range", &len); | 100 | prop = of_find_property(bridge, "bus-range", &len); |
101 | if (bus_range == NULL || len < 2 * sizeof(int)) | 101 | if (prop == NULL || prop->length < 2 * sizeof(int)) |
102 | return; | 102 | return; |
103 | |||
104 | bus_range = (int *)prop->value; | ||
103 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); | 105 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); |
104 | } | 106 | } |
105 | 107 | ||
@@ -237,7 +239,7 @@ static struct pci_ops macrisc_pci_ops = | |||
237 | static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) | 239 | static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) |
238 | { | 240 | { |
239 | struct device_node *np; | 241 | struct device_node *np; |
240 | u32 *vendor, *device; | 242 | const u32 *vendor, *device; |
241 | 243 | ||
242 | if (offset >= 0x100) | 244 | if (offset >= 0x100) |
243 | return PCIBIOS_BAD_REGISTER_NUMBER; | 245 | return PCIBIOS_BAD_REGISTER_NUMBER; |
@@ -245,8 +247,8 @@ static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) | |||
245 | if (np == NULL) | 247 | if (np == NULL) |
246 | return PCIBIOS_DEVICE_NOT_FOUND; | 248 | return PCIBIOS_DEVICE_NOT_FOUND; |
247 | 249 | ||
248 | vendor = (u32 *)get_property(np, "vendor-id", NULL); | 250 | vendor = get_property(np, "vendor-id", NULL); |
249 | device = (u32 *)get_property(np, "device-id", NULL); | 251 | device = get_property(np, "device-id", NULL); |
250 | if (vendor == NULL || device == NULL) | 252 | if (vendor == NULL || device == NULL) |
251 | return PCIBIOS_DEVICE_NOT_FOUND; | 253 | return PCIBIOS_DEVICE_NOT_FOUND; |
252 | 254 | ||
@@ -686,20 +688,21 @@ static void __init fixup_nec_usb2(void) | |||
686 | 688 | ||
687 | for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { | 689 | for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { |
688 | struct pci_controller *hose; | 690 | struct pci_controller *hose; |
689 | u32 data, *prop; | 691 | u32 data; |
692 | const u32 *prop; | ||
690 | u8 bus, devfn; | 693 | u8 bus, devfn; |
691 | 694 | ||
692 | prop = (u32 *)get_property(nec, "vendor-id", NULL); | 695 | prop = get_property(nec, "vendor-id", NULL); |
693 | if (prop == NULL) | 696 | if (prop == NULL) |
694 | continue; | 697 | continue; |
695 | if (0x1033 != *prop) | 698 | if (0x1033 != *prop) |
696 | continue; | 699 | continue; |
697 | prop = (u32 *)get_property(nec, "device-id", NULL); | 700 | prop = get_property(nec, "device-id", NULL); |
698 | if (prop == NULL) | 701 | if (prop == NULL) |
699 | continue; | 702 | continue; |
700 | if (0x0035 != *prop) | 703 | if (0x0035 != *prop) |
701 | continue; | 704 | continue; |
702 | prop = (u32 *)get_property(nec, "reg", NULL); | 705 | prop = get_property(nec, "reg", NULL); |
703 | if (prop == NULL) | 706 | if (prop == NULL) |
704 | continue; | 707 | continue; |
705 | devfn = (prop[0] >> 8) & 0xff; | 708 | devfn = (prop[0] >> 8) & 0xff; |
@@ -898,7 +901,7 @@ static int __init add_bridge(struct device_node *dev) | |||
898 | struct pci_controller *hose; | 901 | struct pci_controller *hose; |
899 | struct resource rsrc; | 902 | struct resource rsrc; |
900 | char *disp_name; | 903 | char *disp_name; |
901 | int *bus_range; | 904 | const int *bus_range; |
902 | int primary = 1, has_address = 0; | 905 | int primary = 1, has_address = 0; |
903 | 906 | ||
904 | DBG("Adding PCI host bridge %s\n", dev->full_name); | 907 | DBG("Adding PCI host bridge %s\n", dev->full_name); |
@@ -907,7 +910,7 @@ static int __init add_bridge(struct device_node *dev) | |||
907 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 910 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
908 | 911 | ||
909 | /* Get bus range if any */ | 912 | /* Get bus range if any */ |
910 | bus_range = (int *) get_property(dev, "bus-range", &len); | 913 | bus_range = get_property(dev, "bus-range", &len); |
911 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 914 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
912 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 915 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
913 | " bus 0\n", dev->full_name); | 916 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c index aacfa59595d1..ee3b223ab17a 100644 --- a/arch/powerpc/platforms/powermac/pfunc_base.c +++ b/arch/powerpc/platforms/powermac/pfunc_base.c | |||
@@ -114,7 +114,7 @@ static void macio_gpio_init_one(struct macio_chip *macio) | |||
114 | * we just create them all | 114 | * we just create them all |
115 | */ | 115 | */ |
116 | for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) { | 116 | for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) { |
117 | u32 *reg = (u32 *)get_property(gp, "reg", NULL); | 117 | const u32 *reg = get_property(gp, "reg", NULL); |
118 | unsigned long offset; | 118 | unsigned long offset; |
119 | if (reg == NULL) | 119 | if (reg == NULL) |
120 | continue; | 120 | continue; |
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c index b117adbf9571..7651f278615a 100644 --- a/arch/powerpc/platforms/powermac/pfunc_core.c +++ b/arch/powerpc/platforms/powermac/pfunc_core.c | |||
@@ -813,14 +813,15 @@ struct pmf_function *__pmf_find_function(struct device_node *target, | |||
813 | struct pmf_device *dev; | 813 | struct pmf_device *dev; |
814 | struct pmf_function *func, *result = NULL; | 814 | struct pmf_function *func, *result = NULL; |
815 | char fname[64]; | 815 | char fname[64]; |
816 | u32 *prop, ph; | 816 | const u32 *prop; |
817 | u32 ph; | ||
817 | 818 | ||
818 | /* | 819 | /* |
819 | * Look for a "platform-*" function reference. If we can't find | 820 | * Look for a "platform-*" function reference. If we can't find |
820 | * one, then we fallback to a direct call attempt | 821 | * one, then we fallback to a direct call attempt |
821 | */ | 822 | */ |
822 | snprintf(fname, 63, "platform-%s", name); | 823 | snprintf(fname, 63, "platform-%s", name); |
823 | prop = (u32 *)get_property(target, fname, NULL); | 824 | prop = get_property(target, fname, NULL); |
824 | if (prop == NULL) | 825 | if (prop == NULL) |
825 | goto find_it; | 826 | goto find_it; |
826 | ph = *prop; | 827 | ph = *prop; |
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 31a9da769fa2..824a618396ab 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -116,7 +116,7 @@ extern struct smp_ops_t core99_smp_ops; | |||
116 | static void pmac_show_cpuinfo(struct seq_file *m) | 116 | static void pmac_show_cpuinfo(struct seq_file *m) |
117 | { | 117 | { |
118 | struct device_node *np; | 118 | struct device_node *np; |
119 | char *pp; | 119 | const char *pp; |
120 | int plen; | 120 | int plen; |
121 | int mbmodel; | 121 | int mbmodel; |
122 | unsigned int mbflags; | 122 | unsigned int mbflags; |
@@ -134,12 +134,12 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
134 | seq_printf(m, "machine\t\t: "); | 134 | seq_printf(m, "machine\t\t: "); |
135 | np = of_find_node_by_path("/"); | 135 | np = of_find_node_by_path("/"); |
136 | if (np != NULL) { | 136 | if (np != NULL) { |
137 | pp = (char *) get_property(np, "model", NULL); | 137 | pp = get_property(np, "model", NULL); |
138 | if (pp != NULL) | 138 | if (pp != NULL) |
139 | seq_printf(m, "%s\n", pp); | 139 | seq_printf(m, "%s\n", pp); |
140 | else | 140 | else |
141 | seq_printf(m, "PowerMac\n"); | 141 | seq_printf(m, "PowerMac\n"); |
142 | pp = (char *) get_property(np, "compatible", &plen); | 142 | pp = get_property(np, "compatible", &plen); |
143 | if (pp != NULL) { | 143 | if (pp != NULL) { |
144 | seq_printf(m, "motherboard\t:"); | 144 | seq_printf(m, "motherboard\t:"); |
145 | while (plen > 0) { | 145 | while (plen > 0) { |
@@ -163,10 +163,8 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
163 | if (np == NULL) | 163 | if (np == NULL) |
164 | np = of_find_node_by_type(NULL, "cache"); | 164 | np = of_find_node_by_type(NULL, "cache"); |
165 | if (np != NULL) { | 165 | if (np != NULL) { |
166 | unsigned int *ic = (unsigned int *) | 166 | const unsigned int *ic = get_property(np, "i-cache-size", NULL); |
167 | get_property(np, "i-cache-size", NULL); | 167 | const unsigned int *dc = get_property(np, "d-cache-size", NULL); |
168 | unsigned int *dc = (unsigned int *) | ||
169 | get_property(np, "d-cache-size", NULL); | ||
170 | seq_printf(m, "L2 cache\t:"); | 168 | seq_printf(m, "L2 cache\t:"); |
171 | has_l2cache = 1; | 169 | has_l2cache = 1; |
172 | if (get_property(np, "cache-unified", NULL) != 0 && dc) { | 170 | if (get_property(np, "cache-unified", NULL) != 0 && dc) { |
@@ -254,7 +252,7 @@ static void __init l2cr_init(void) | |||
254 | if (np == 0) | 252 | if (np == 0) |
255 | np = find_type_devices("cpu"); | 253 | np = find_type_devices("cpu"); |
256 | if (np != 0) { | 254 | if (np != 0) { |
257 | unsigned int *l2cr = (unsigned int *) | 255 | const unsigned int *l2cr = |
258 | get_property(np, "l2cr-value", NULL); | 256 | get_property(np, "l2cr-value", NULL); |
259 | if (l2cr != 0) { | 257 | if (l2cr != 0) { |
260 | ppc_override_l2cr = 1; | 258 | ppc_override_l2cr = 1; |
@@ -277,7 +275,7 @@ static void __init l2cr_init(void) | |||
277 | static void __init pmac_setup_arch(void) | 275 | static void __init pmac_setup_arch(void) |
278 | { | 276 | { |
279 | struct device_node *cpu, *ic; | 277 | struct device_node *cpu, *ic; |
280 | int *fp; | 278 | const int *fp; |
281 | unsigned long pvr; | 279 | unsigned long pvr; |
282 | 280 | ||
283 | pvr = PVR_VER(mfspr(SPRN_PVR)); | 281 | pvr = PVR_VER(mfspr(SPRN_PVR)); |
@@ -287,7 +285,7 @@ static void __init pmac_setup_arch(void) | |||
287 | loops_per_jiffy = 50000000 / HZ; | 285 | loops_per_jiffy = 50000000 / HZ; |
288 | cpu = of_find_node_by_type(NULL, "cpu"); | 286 | cpu = of_find_node_by_type(NULL, "cpu"); |
289 | if (cpu != NULL) { | 287 | if (cpu != NULL) { |
290 | fp = (int *) get_property(cpu, "clock-frequency", NULL); | 288 | fp = get_property(cpu, "clock-frequency", NULL); |
291 | if (fp != NULL) { | 289 | if (fp != NULL) { |
292 | if (pvr >= 0x30 && pvr < 0x80) | 290 | if (pvr >= 0x30 && pvr < 0x80) |
293 | /* PPC970 etc. */ | 291 | /* PPC970 etc. */ |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index 827b7121ffb8..653eeb64d1e2 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -548,7 +548,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus) | |||
548 | struct device_node *cc = NULL; | 548 | struct device_node *cc = NULL; |
549 | struct device_node *p; | 549 | struct device_node *p; |
550 | const char *name = NULL; | 550 | const char *name = NULL; |
551 | u32 *reg; | 551 | const u32 *reg; |
552 | int ok; | 552 | int ok; |
553 | 553 | ||
554 | /* Look for the clock chip */ | 554 | /* Look for the clock chip */ |
@@ -562,7 +562,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus) | |||
562 | pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc); | 562 | pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc); |
563 | if (pmac_tb_clock_chip_host == NULL) | 563 | if (pmac_tb_clock_chip_host == NULL) |
564 | continue; | 564 | continue; |
565 | reg = (u32 *)get_property(cc, "reg", NULL); | 565 | reg = get_property(cc, "reg", NULL); |
566 | if (reg == NULL) | 566 | if (reg == NULL) |
567 | continue; | 567 | continue; |
568 | switch (*reg) { | 568 | switch (*reg) { |
@@ -707,8 +707,7 @@ static void __init smp_core99_setup(int ncpus) | |||
707 | core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ | 707 | core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ |
708 | cpu = of_find_node_by_type(NULL, "cpu"); | 708 | cpu = of_find_node_by_type(NULL, "cpu"); |
709 | if (cpu != NULL) { | 709 | if (cpu != NULL) { |
710 | tbprop = (u32 *)get_property(cpu, "timebase-enable", | 710 | tbprop = get_property(cpu, "timebase-enable", NULL); |
711 | NULL); | ||
712 | if (tbprop) | 711 | if (tbprop) |
713 | core99_tb_gpio = *tbprop; | 712 | core99_tb_gpio = *tbprop; |
714 | of_node_put(cpu); | 713 | of_node_put(cpu); |
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c index 37e5b1eff911..ce1a235855f7 100644 --- a/arch/powerpc/platforms/powermac/udbg_scc.c +++ b/arch/powerpc/platforms/powermac/udbg_scc.c | |||
@@ -68,11 +68,11 @@ static unsigned char scc_inittab[] = { | |||
68 | 68 | ||
69 | void udbg_scc_init(int force_scc) | 69 | void udbg_scc_init(int force_scc) |
70 | { | 70 | { |
71 | u32 *reg; | 71 | const u32 *reg; |
72 | unsigned long addr; | 72 | unsigned long addr; |
73 | struct device_node *stdout = NULL, *escc = NULL, *macio = NULL; | 73 | struct device_node *stdout = NULL, *escc = NULL, *macio = NULL; |
74 | struct device_node *ch, *ch_def = NULL, *ch_a = NULL; | 74 | struct device_node *ch, *ch_def = NULL, *ch_a = NULL; |
75 | char *path; | 75 | const char *path; |
76 | int i, x; | 76 | int i, x; |
77 | 77 | ||
78 | escc = of_find_node_by_name(NULL, "escc"); | 78 | escc = of_find_node_by_name(NULL, "escc"); |
@@ -81,7 +81,7 @@ void udbg_scc_init(int force_scc) | |||
81 | macio = of_get_parent(escc); | 81 | macio = of_get_parent(escc); |
82 | if (macio == NULL) | 82 | if (macio == NULL) |
83 | goto bail; | 83 | goto bail; |
84 | path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 84 | path = get_property(of_chosen, "linux,stdout-path", NULL); |
85 | if (path != NULL) | 85 | if (path != NULL) |
86 | stdout = of_find_node_by_path(path); | 86 | stdout = of_find_node_by_path(path); |
87 | for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) { | 87 | for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) { |
@@ -96,13 +96,13 @@ void udbg_scc_init(int force_scc) | |||
96 | ch = ch_def ? ch_def : ch_a; | 96 | ch = ch_def ? ch_def : ch_a; |
97 | 97 | ||
98 | /* Get address within mac-io ASIC */ | 98 | /* Get address within mac-io ASIC */ |
99 | reg = (u32 *)get_property(escc, "reg", NULL); | 99 | reg = get_property(escc, "reg", NULL); |
100 | if (reg == NULL) | 100 | if (reg == NULL) |
101 | goto bail; | 101 | goto bail; |
102 | addr = reg[0]; | 102 | addr = reg[0]; |
103 | 103 | ||
104 | /* Get address of mac-io PCI itself */ | 104 | /* Get address of mac-io PCI itself */ |
105 | reg = (u32 *)get_property(macio, "assigned-addresses", NULL); | 105 | reg = get_property(macio, "assigned-addresses", NULL); |
106 | if (reg == NULL) | 106 | if (reg == NULL) |
107 | goto bail; | 107 | goto bail; |
108 | addr += reg[2]; | 108 | addr += reg[2]; |
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index e5e0ff466904..997243a91be8 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile | |||
@@ -12,3 +12,4 @@ obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o | |||
12 | 12 | ||
13 | obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o | 13 | obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o |
14 | obj-$(CONFIG_HVCS) += hvcserver.o | 14 | obj-$(CONFIG_HVCS) += hvcserver.o |
15 | obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o | ||
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 32eaddfa5470..84bc8f7e17ef 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -449,7 +449,11 @@ EXPORT_SYMBOL(eeh_check_failure); | |||
449 | /* ------------------------------------------------------------- */ | 449 | /* ------------------------------------------------------------- */ |
450 | /* The code below deals with error recovery */ | 450 | /* The code below deals with error recovery */ |
451 | 451 | ||
452 | /** Return negative value if a permanent error, else return | 452 | /** |
453 | * eeh_slot_availability - returns error status of slot | ||
454 | * @pdn pci device node | ||
455 | * | ||
456 | * Return negative value if a permanent error, else return | ||
453 | * a number of milliseconds to wait until the PCI slot is | 457 | * a number of milliseconds to wait until the PCI slot is |
454 | * ready to be used. | 458 | * ready to be used. |
455 | */ | 459 | */ |
@@ -474,11 +478,42 @@ eeh_slot_availability(struct pci_dn *pdn) | |||
474 | 478 | ||
475 | printk (KERN_ERR "EEH: Slot unavailable: rc=%d, rets=%d %d %d\n", | 479 | printk (KERN_ERR "EEH: Slot unavailable: rc=%d, rets=%d %d %d\n", |
476 | rc, rets[0], rets[1], rets[2]); | 480 | rc, rets[0], rets[1], rets[2]); |
477 | return -1; | 481 | return -2; |
482 | } | ||
483 | |||
484 | /** | ||
485 | * rtas_pci_enable - enable MMIO or DMA transfers for this slot | ||
486 | * @pdn pci device node | ||
487 | */ | ||
488 | |||
489 | int | ||
490 | rtas_pci_enable(struct pci_dn *pdn, int function) | ||
491 | { | ||
492 | int config_addr; | ||
493 | int rc; | ||
494 | |||
495 | /* Use PE configuration address, if present */ | ||
496 | config_addr = pdn->eeh_config_addr; | ||
497 | if (pdn->eeh_pe_config_addr) | ||
498 | config_addr = pdn->eeh_pe_config_addr; | ||
499 | |||
500 | rc = rtas_call(ibm_set_eeh_option, 4, 1, NULL, | ||
501 | config_addr, | ||
502 | BUID_HI(pdn->phb->buid), | ||
503 | BUID_LO(pdn->phb->buid), | ||
504 | function); | ||
505 | |||
506 | if (rc) | ||
507 | printk(KERN_WARNING "EEH: Cannot enable function %d, err=%d dn=%s\n", | ||
508 | function, rc, pdn->node->full_name); | ||
509 | |||
510 | return rc; | ||
478 | } | 511 | } |
479 | 512 | ||
480 | /** rtas_pci_slot_reset raises/lowers the pci #RST line | 513 | /** |
481 | * state: 1/0 to raise/lower the #RST | 514 | * rtas_pci_slot_reset - raises/lowers the pci #RST line |
515 | * @pdn pci device node | ||
516 | * @state: 1/0 to raise/lower the #RST | ||
482 | * | 517 | * |
483 | * Clear the EEH-frozen condition on a slot. This routine | 518 | * Clear the EEH-frozen condition on a slot. This routine |
484 | * asserts the PCI #RST line if the 'state' argument is '1', | 519 | * asserts the PCI #RST line if the 'state' argument is '1', |
@@ -511,24 +546,21 @@ rtas_pci_slot_reset(struct pci_dn *pdn, int state) | |||
511 | BUID_HI(pdn->phb->buid), | 546 | BUID_HI(pdn->phb->buid), |
512 | BUID_LO(pdn->phb->buid), | 547 | BUID_LO(pdn->phb->buid), |
513 | state); | 548 | state); |
514 | if (rc) { | 549 | if (rc) |
515 | printk (KERN_WARNING "EEH: Unable to reset the failed slot, (%d) #RST=%d dn=%s\n", | 550 | printk (KERN_WARNING "EEH: Unable to reset the failed slot," |
551 | " (%d) #RST=%d dn=%s\n", | ||
516 | rc, state, pdn->node->full_name); | 552 | rc, state, pdn->node->full_name); |
517 | return; | ||
518 | } | ||
519 | } | 553 | } |
520 | 554 | ||
521 | /** rtas_set_slot_reset -- assert the pci #RST line for 1/4 second | 555 | /** |
522 | * dn -- device node to be reset. | 556 | * rtas_set_slot_reset -- assert the pci #RST line for 1/4 second |
557 | * @pdn: pci device node to be reset. | ||
523 | * | 558 | * |
524 | * Return 0 if success, else a non-zero value. | 559 | * Return 0 if success, else a non-zero value. |
525 | */ | 560 | */ |
526 | 561 | ||
527 | int | 562 | static void __rtas_set_slot_reset(struct pci_dn *pdn) |
528 | rtas_set_slot_reset(struct pci_dn *pdn) | ||
529 | { | 563 | { |
530 | int i, rc; | ||
531 | |||
532 | rtas_pci_slot_reset (pdn, 1); | 564 | rtas_pci_slot_reset (pdn, 1); |
533 | 565 | ||
534 | /* The PCI bus requires that the reset be held high for at least | 566 | /* The PCI bus requires that the reset be held high for at least |
@@ -549,17 +581,33 @@ rtas_set_slot_reset(struct pci_dn *pdn) | |||
549 | * up traffic. */ | 581 | * up traffic. */ |
550 | #define PCI_BUS_SETTLE_TIME_MSEC 1800 | 582 | #define PCI_BUS_SETTLE_TIME_MSEC 1800 |
551 | msleep (PCI_BUS_SETTLE_TIME_MSEC); | 583 | msleep (PCI_BUS_SETTLE_TIME_MSEC); |
584 | } | ||
585 | |||
586 | int rtas_set_slot_reset(struct pci_dn *pdn) | ||
587 | { | ||
588 | int i, rc; | ||
589 | |||
590 | __rtas_set_slot_reset(pdn); | ||
552 | 591 | ||
553 | /* Now double check with the firmware to make sure the device is | 592 | /* Now double check with the firmware to make sure the device is |
554 | * ready to be used; if not, wait for recovery. */ | 593 | * ready to be used; if not, wait for recovery. */ |
555 | for (i=0; i<10; i++) { | 594 | for (i=0; i<10; i++) { |
556 | rc = eeh_slot_availability (pdn); | 595 | rc = eeh_slot_availability (pdn); |
557 | if (rc < 0) | ||
558 | printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n", rc, pdn->node->full_name); | ||
559 | if (rc == 0) | 596 | if (rc == 0) |
560 | return 0; | 597 | return 0; |
561 | if (rc < 0) | 598 | |
599 | if (rc == -2) { | ||
600 | printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n", | ||
601 | i, pdn->node->full_name); | ||
602 | __rtas_set_slot_reset(pdn); | ||
603 | continue; | ||
604 | } | ||
605 | |||
606 | if (rc < 0) { | ||
607 | printk (KERN_ERR "EEH: unrecoverable slot failure %s\n", | ||
608 | pdn->node->full_name); | ||
562 | return -1; | 609 | return -1; |
610 | } | ||
563 | 611 | ||
564 | msleep (rc+100); | 612 | msleep (rc+100); |
565 | } | 613 | } |
@@ -582,6 +630,8 @@ rtas_set_slot_reset(struct pci_dn *pdn) | |||
582 | 630 | ||
583 | /** | 631 | /** |
584 | * __restore_bars - Restore the Base Address Registers | 632 | * __restore_bars - Restore the Base Address Registers |
633 | * @pdn: pci device node | ||
634 | * | ||
585 | * Loads the PCI configuration space base address registers, | 635 | * Loads the PCI configuration space base address registers, |
586 | * the expansion ROM base address, the latency timer, and etc. | 636 | * the expansion ROM base address, the latency timer, and etc. |
587 | * from the saved values in the device node. | 637 | * from the saved values in the device node. |
@@ -691,11 +741,11 @@ static void *early_enable_eeh(struct device_node *dn, void *data) | |||
691 | { | 741 | { |
692 | struct eeh_early_enable_info *info = data; | 742 | struct eeh_early_enable_info *info = data; |
693 | int ret; | 743 | int ret; |
694 | char *status = get_property(dn, "status", NULL); | 744 | const char *status = get_property(dn, "status", NULL); |
695 | u32 *class_code = (u32 *)get_property(dn, "class-code", NULL); | 745 | const u32 *class_code = get_property(dn, "class-code", NULL); |
696 | u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", NULL); | 746 | const u32 *vendor_id = get_property(dn, "vendor-id", NULL); |
697 | u32 *device_id = (u32 *)get_property(dn, "device-id", NULL); | 747 | const u32 *device_id = get_property(dn, "device-id", NULL); |
698 | u32 *regs; | 748 | const u32 *regs; |
699 | int enable; | 749 | int enable; |
700 | struct pci_dn *pdn = PCI_DN(dn); | 750 | struct pci_dn *pdn = PCI_DN(dn); |
701 | 751 | ||
@@ -737,7 +787,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data) | |||
737 | 787 | ||
738 | /* Ok... see if this device supports EEH. Some do, some don't, | 788 | /* Ok... see if this device supports EEH. Some do, some don't, |
739 | * and the only way to find out is to check each and every one. */ | 789 | * and the only way to find out is to check each and every one. */ |
740 | regs = (u32 *)get_property(dn, "reg", NULL); | 790 | regs = get_property(dn, "reg", NULL); |
741 | if (regs) { | 791 | if (regs) { |
742 | /* First register entry is addr (00BBSS00) */ | 792 | /* First register entry is addr (00BBSS00) */ |
743 | /* Try to enable eeh */ | 793 | /* Try to enable eeh */ |
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c index c37a8497c60f..b6b462d3c604 100644 --- a/arch/powerpc/platforms/pseries/eeh_cache.c +++ b/arch/powerpc/platforms/pseries/eeh_cache.c | |||
@@ -157,6 +157,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, | |||
157 | if (!piar) | 157 | if (!piar) |
158 | return NULL; | 158 | return NULL; |
159 | 159 | ||
160 | pci_dev_get(dev); | ||
160 | piar->addr_lo = alo; | 161 | piar->addr_lo = alo; |
161 | piar->addr_hi = ahi; | 162 | piar->addr_hi = ahi; |
162 | piar->pcidev = dev; | 163 | piar->pcidev = dev; |
@@ -178,7 +179,6 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) | |||
178 | struct device_node *dn; | 179 | struct device_node *dn; |
179 | struct pci_dn *pdn; | 180 | struct pci_dn *pdn; |
180 | int i; | 181 | int i; |
181 | int inserted = 0; | ||
182 | 182 | ||
183 | dn = pci_device_to_OF_node(dev); | 183 | dn = pci_device_to_OF_node(dev); |
184 | if (!dn) { | 184 | if (!dn) { |
@@ -197,9 +197,6 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) | |||
197 | return; | 197 | return; |
198 | } | 198 | } |
199 | 199 | ||
200 | /* The cache holds a reference to the device... */ | ||
201 | pci_dev_get(dev); | ||
202 | |||
203 | /* Walk resources on this device, poke them into the tree */ | 200 | /* Walk resources on this device, poke them into the tree */ |
204 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | 201 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
205 | unsigned long start = pci_resource_start(dev,i); | 202 | unsigned long start = pci_resource_start(dev,i); |
@@ -212,12 +209,7 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) | |||
212 | if (start == 0 || ~start == 0 || end == 0 || ~end == 0) | 209 | if (start == 0 || ~start == 0 || end == 0 || ~end == 0) |
213 | continue; | 210 | continue; |
214 | pci_addr_cache_insert(dev, start, end, flags); | 211 | pci_addr_cache_insert(dev, start, end, flags); |
215 | inserted = 1; | ||
216 | } | 212 | } |
217 | |||
218 | /* If there was nothing to add, the cache has no reference... */ | ||
219 | if (!inserted) | ||
220 | pci_dev_put(dev); | ||
221 | } | 213 | } |
222 | 214 | ||
223 | /** | 215 | /** |
@@ -240,7 +232,6 @@ void pci_addr_cache_insert_device(struct pci_dev *dev) | |||
240 | static inline void __pci_addr_cache_remove_device(struct pci_dev *dev) | 232 | static inline void __pci_addr_cache_remove_device(struct pci_dev *dev) |
241 | { | 233 | { |
242 | struct rb_node *n; | 234 | struct rb_node *n; |
243 | int removed = 0; | ||
244 | 235 | ||
245 | restart: | 236 | restart: |
246 | n = rb_first(&pci_io_addr_cache_root.rb_root); | 237 | n = rb_first(&pci_io_addr_cache_root.rb_root); |
@@ -250,16 +241,12 @@ restart: | |||
250 | 241 | ||
251 | if (piar->pcidev == dev) { | 242 | if (piar->pcidev == dev) { |
252 | rb_erase(n, &pci_io_addr_cache_root.rb_root); | 243 | rb_erase(n, &pci_io_addr_cache_root.rb_root); |
253 | removed = 1; | 244 | pci_dev_put(piar->pcidev); |
254 | kfree(piar); | 245 | kfree(piar); |
255 | goto restart; | 246 | goto restart; |
256 | } | 247 | } |
257 | n = rb_next(n); | 248 | n = rb_next(n); |
258 | } | 249 | } |
259 | |||
260 | /* The cache no longer holds its reference to this device... */ | ||
261 | if (removed) | ||
262 | pci_dev_put(dev); | ||
263 | } | 250 | } |
264 | 251 | ||
265 | /** | 252 | /** |
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c index aaad2c0afcbf..c2bc9904f1cb 100644 --- a/arch/powerpc/platforms/pseries/eeh_driver.c +++ b/arch/powerpc/platforms/pseries/eeh_driver.c | |||
@@ -77,8 +77,12 @@ static int irq_in_use(unsigned int irq) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /* ------------------------------------------------------- */ | 79 | /* ------------------------------------------------------- */ |
80 | /** eeh_report_error - report an EEH error to each device, | 80 | /** |
81 | * collect up and merge the device responses. | 81 | * eeh_report_error - report pci error to each device driver |
82 | * | ||
83 | * Report an EEH error to each device driver, collect up and | ||
84 | * merge the device driver responses. Cumulative response | ||
85 | * passed back in "userdata". | ||
82 | */ | 86 | */ |
83 | 87 | ||
84 | static void eeh_report_error(struct pci_dev *dev, void *userdata) | 88 | static void eeh_report_error(struct pci_dev *dev, void *userdata) |
@@ -96,24 +100,49 @@ static void eeh_report_error(struct pci_dev *dev, void *userdata) | |||
96 | PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED; | 100 | PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED; |
97 | disable_irq_nosync(dev->irq); | 101 | disable_irq_nosync(dev->irq); |
98 | } | 102 | } |
99 | if (!driver->err_handler) | 103 | if (!driver->err_handler || |
100 | return; | 104 | !driver->err_handler->error_detected) |
101 | if (!driver->err_handler->error_detected) | ||
102 | return; | 105 | return; |
103 | 106 | ||
104 | rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen); | 107 | rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen); |
105 | if (*res == PCI_ERS_RESULT_NONE) *res = rc; | 108 | if (*res == PCI_ERS_RESULT_NONE) *res = rc; |
106 | if (*res == PCI_ERS_RESULT_NEED_RESET) return; | ||
107 | if (*res == PCI_ERS_RESULT_DISCONNECT && | 109 | if (*res == PCI_ERS_RESULT_DISCONNECT && |
108 | rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; | 110 | rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; |
109 | } | 111 | } |
110 | 112 | ||
111 | /** eeh_report_reset -- tell this device that the pci slot | 113 | /** |
112 | * has been reset. | 114 | * eeh_report_mmio_enabled - tell drivers that MMIO has been enabled |
115 | * | ||
116 | * Report an EEH error to each device driver, collect up and | ||
117 | * merge the device driver responses. Cumulative response | ||
118 | * passed back in "userdata". | ||
119 | */ | ||
120 | |||
121 | static void eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata) | ||
122 | { | ||
123 | enum pci_ers_result rc, *res = userdata; | ||
124 | struct pci_driver *driver = dev->driver; | ||
125 | |||
126 | // dev->error_state = pci_channel_mmio_enabled; | ||
127 | |||
128 | if (!driver || | ||
129 | !driver->err_handler || | ||
130 | !driver->err_handler->mmio_enabled) | ||
131 | return; | ||
132 | |||
133 | rc = driver->err_handler->mmio_enabled (dev); | ||
134 | if (*res == PCI_ERS_RESULT_NONE) *res = rc; | ||
135 | if (*res == PCI_ERS_RESULT_DISCONNECT && | ||
136 | rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; | ||
137 | } | ||
138 | |||
139 | /** | ||
140 | * eeh_report_reset - tell device that slot has been reset | ||
113 | */ | 141 | */ |
114 | 142 | ||
115 | static void eeh_report_reset(struct pci_dev *dev, void *userdata) | 143 | static void eeh_report_reset(struct pci_dev *dev, void *userdata) |
116 | { | 144 | { |
145 | enum pci_ers_result rc, *res = userdata; | ||
117 | struct pci_driver *driver = dev->driver; | 146 | struct pci_driver *driver = dev->driver; |
118 | struct device_node *dn = pci_device_to_OF_node(dev); | 147 | struct device_node *dn = pci_device_to_OF_node(dev); |
119 | 148 | ||
@@ -124,14 +153,20 @@ static void eeh_report_reset(struct pci_dev *dev, void *userdata) | |||
124 | PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED; | 153 | PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED; |
125 | enable_irq(dev->irq); | 154 | enable_irq(dev->irq); |
126 | } | 155 | } |
127 | if (!driver->err_handler) | 156 | if (!driver->err_handler || |
128 | return; | 157 | !driver->err_handler->slot_reset) |
129 | if (!driver->err_handler->slot_reset) | ||
130 | return; | 158 | return; |
131 | 159 | ||
132 | driver->err_handler->slot_reset(dev); | 160 | rc = driver->err_handler->slot_reset(dev); |
161 | if (*res == PCI_ERS_RESULT_NONE) *res = rc; | ||
162 | if (*res == PCI_ERS_RESULT_DISCONNECT && | ||
163 | rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; | ||
133 | } | 164 | } |
134 | 165 | ||
166 | /** | ||
167 | * eeh_report_resume - tell device to resume normal operations | ||
168 | */ | ||
169 | |||
135 | static void eeh_report_resume(struct pci_dev *dev, void *userdata) | 170 | static void eeh_report_resume(struct pci_dev *dev, void *userdata) |
136 | { | 171 | { |
137 | struct pci_driver *driver = dev->driver; | 172 | struct pci_driver *driver = dev->driver; |
@@ -148,6 +183,13 @@ static void eeh_report_resume(struct pci_dev *dev, void *userdata) | |||
148 | driver->err_handler->resume(dev); | 183 | driver->err_handler->resume(dev); |
149 | } | 184 | } |
150 | 185 | ||
186 | /** | ||
187 | * eeh_report_failure - tell device driver that device is dead. | ||
188 | * | ||
189 | * This informs the device driver that the device is permanently | ||
190 | * dead, and that no further recovery attempts will be made on it. | ||
191 | */ | ||
192 | |||
151 | static void eeh_report_failure(struct pci_dev *dev, void *userdata) | 193 | static void eeh_report_failure(struct pci_dev *dev, void *userdata) |
152 | { | 194 | { |
153 | struct pci_driver *driver = dev->driver; | 195 | struct pci_driver *driver = dev->driver; |
@@ -190,11 +232,11 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata) | |||
190 | 232 | ||
191 | /** | 233 | /** |
192 | * eeh_reset_device() -- perform actual reset of a pci slot | 234 | * eeh_reset_device() -- perform actual reset of a pci slot |
193 | * Args: bus: pointer to the pci bus structure corresponding | 235 | * @bus: pointer to the pci bus structure corresponding |
194 | * to the isolated slot. A non-null value will | 236 | * to the isolated slot. A non-null value will |
195 | * cause all devices under the bus to be removed | 237 | * cause all devices under the bus to be removed |
196 | * and then re-added. | 238 | * and then re-added. |
197 | * pe_dn: pointer to a "Partionable Endpoint" device node. | 239 | * @pe_dn: pointer to a "Partionable Endpoint" device node. |
198 | * This is the top-level structure on which pci | 240 | * This is the top-level structure on which pci |
199 | * bus resets can be performed. | 241 | * bus resets can be performed. |
200 | */ | 242 | */ |
@@ -268,14 +310,14 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
268 | 310 | ||
269 | if (!frozen_dn) { | 311 | if (!frozen_dn) { |
270 | 312 | ||
271 | location = (char *) get_property(event->dn, "ibm,loc-code", NULL); | 313 | location = get_property(event->dn, "ibm,loc-code", NULL); |
272 | location = location ? location : "unknown"; | 314 | location = location ? location : "unknown"; |
273 | printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " | 315 | printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " |
274 | "for location=%s pci addr=%s\n", | 316 | "for location=%s pci addr=%s\n", |
275 | location, pci_name(event->dev)); | 317 | location, pci_name(event->dev)); |
276 | return NULL; | 318 | return NULL; |
277 | } | 319 | } |
278 | location = (char *) get_property(frozen_dn, "ibm,loc-code", NULL); | 320 | location = get_property(frozen_dn, "ibm,loc-code", NULL); |
279 | location = location ? location : "unknown"; | 321 | location = location ? location : "unknown"; |
280 | 322 | ||
281 | /* There are two different styles for coming up with the PE. | 323 | /* There are two different styles for coming up with the PE. |
@@ -347,23 +389,43 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
347 | goto hard_fail; | 389 | goto hard_fail; |
348 | } | 390 | } |
349 | 391 | ||
350 | /* If any device called out for a reset, then reset the slot */ | 392 | /* If all devices reported they can proceed, then re-enable MMIO */ |
351 | if (result == PCI_ERS_RESULT_NEED_RESET) { | 393 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { |
352 | rc = eeh_reset_device(frozen_pdn, NULL); | 394 | rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO); |
353 | if (rc) | 395 | |
354 | goto hard_fail; | 396 | if (rc) { |
355 | pci_walk_bus(frozen_bus, eeh_report_reset, NULL); | 397 | result = PCI_ERS_RESULT_NEED_RESET; |
398 | } else { | ||
399 | result = PCI_ERS_RESULT_NONE; | ||
400 | pci_walk_bus(frozen_bus, eeh_report_mmio_enabled, &result); | ||
401 | } | ||
356 | } | 402 | } |
357 | 403 | ||
358 | /* If all devices reported they can proceed, the re-enable PIO */ | 404 | /* If all devices reported they can proceed, then re-enable DMA */ |
359 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { | 405 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { |
360 | /* XXX Not supported; we brute-force reset the device */ | 406 | rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA); |
407 | |||
408 | if (rc) | ||
409 | result = PCI_ERS_RESULT_NEED_RESET; | ||
410 | } | ||
411 | |||
412 | /* If any device has a hard failure, then shut off everything. */ | ||
413 | if (result == PCI_ERS_RESULT_DISCONNECT) | ||
414 | goto hard_fail; | ||
415 | |||
416 | /* If any device called out for a reset, then reset the slot */ | ||
417 | if (result == PCI_ERS_RESULT_NEED_RESET) { | ||
361 | rc = eeh_reset_device(frozen_pdn, NULL); | 418 | rc = eeh_reset_device(frozen_pdn, NULL); |
362 | if (rc) | 419 | if (rc) |
363 | goto hard_fail; | 420 | goto hard_fail; |
364 | pci_walk_bus(frozen_bus, eeh_report_reset, NULL); | 421 | result = PCI_ERS_RESULT_NONE; |
422 | pci_walk_bus(frozen_bus, eeh_report_reset, &result); | ||
365 | } | 423 | } |
366 | 424 | ||
425 | /* All devices should claim they have recovered by now. */ | ||
426 | if (result != PCI_ERS_RESULT_RECOVERED) | ||
427 | goto hard_fail; | ||
428 | |||
367 | /* Tell all device drivers that they can resume operations */ | 429 | /* Tell all device drivers that they can resume operations */ |
368 | pci_walk_bus(frozen_bus, eeh_report_resume, NULL); | 430 | pci_walk_bus(frozen_bus, eeh_report_resume, NULL); |
369 | 431 | ||
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c index 45ccc687e57c..137077451316 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/platforms/pseries/eeh_event.c | |||
@@ -124,11 +124,11 @@ int eeh_send_failure_event (struct device_node *dn, | |||
124 | { | 124 | { |
125 | unsigned long flags; | 125 | unsigned long flags; |
126 | struct eeh_event *event; | 126 | struct eeh_event *event; |
127 | char *location; | 127 | const char *location; |
128 | 128 | ||
129 | if (!mem_init_done) { | 129 | if (!mem_init_done) { |
130 | printk(KERN_ERR "EEH: event during early boot not handled\n"); | 130 | printk(KERN_ERR "EEH: event during early boot not handled\n"); |
131 | location = (char *) get_property(dn, "ibm,loc-code", NULL); | 131 | location = get_property(dn, "ibm,loc-code", NULL); |
132 | printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); | 132 | printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); |
133 | printk(KERN_ERR "EEH: PCI location = %s\n", location); | 133 | printk(KERN_ERR "EEH: PCI location = %s\n", location); |
134 | return 1; | 134 | return 1; |
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c index c01d8f0cbe6d..1c7b2baa5f73 100644 --- a/arch/powerpc/platforms/pseries/firmware.c +++ b/arch/powerpc/platforms/pseries/firmware.c | |||
@@ -68,7 +68,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = { | |||
68 | void __init fw_feature_init(void) | 68 | void __init fw_feature_init(void) |
69 | { | 69 | { |
70 | struct device_node *dn; | 70 | struct device_node *dn; |
71 | char *hypertas, *s; | 71 | const char *hypertas, *s; |
72 | int len, i; | 72 | int len, i; |
73 | 73 | ||
74 | DBG(" -> fw_feature_init()\n"); | 74 | DBG(" -> fw_feature_init()\n"); |
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S index c9ff547f9d25..c00cfed7af2c 100644 --- a/arch/powerpc/platforms/pseries/hvCall.S +++ b/arch/powerpc/platforms/pseries/hvCall.S | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * This file contains the generic code to perform a call to the | 2 | * This file contains the generic code to perform a call to the |
3 | * pSeries LPAR hypervisor. | 3 | * pSeries LPAR hypervisor. |
4 | * NOTE: this file will go away when we move to inline this work. | ||
5 | * | 4 | * |
6 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
@@ -11,217 +10,153 @@ | |||
11 | #include <asm/hvcall.h> | 10 | #include <asm/hvcall.h> |
12 | #include <asm/processor.h> | 11 | #include <asm/processor.h> |
13 | #include <asm/ppc_asm.h> | 12 | #include <asm/ppc_asm.h> |
13 | #include <asm/asm-offsets.h> | ||
14 | 14 | ||
15 | #define STK_PARM(i) (48 + ((i)-3)*8) | 15 | #define STK_PARM(i) (48 + ((i)-3)*8) |
16 | 16 | ||
17 | .text | 17 | #ifdef CONFIG_HCALL_STATS |
18 | 18 | /* | |
19 | /* long plpar_hcall(unsigned long opcode, R3 | 19 | * precall must preserve all registers. use unused STK_PARM() |
20 | unsigned long arg1, R4 | 20 | * areas to save snapshots and opcode. |
21 | unsigned long arg2, R5 | ||
22 | unsigned long arg3, R6 | ||
23 | unsigned long arg4, R7 | ||
24 | unsigned long *out1, R8 | ||
25 | unsigned long *out2, R9 | ||
26 | unsigned long *out3); R10 | ||
27 | */ | 21 | */ |
28 | _GLOBAL(plpar_hcall) | 22 | #define HCALL_INST_PRECALL \ |
29 | HMT_MEDIUM | 23 | std r3,STK_PARM(r3)(r1); /* save opcode */ \ |
30 | 24 | mftb r0; /* get timebase and */ \ | |
31 | mfcr r0 | 25 | std r0,STK_PARM(r5)(r1); /* save for later */ \ |
32 | 26 | BEGIN_FTR_SECTION; \ | |
33 | std r8,STK_PARM(r8)(r1) /* Save out ptrs */ | 27 | mfspr r0,SPRN_PURR; /* get PURR and */ \ |
34 | std r9,STK_PARM(r9)(r1) | 28 | std r0,STK_PARM(r6)(r1); /* save for later */ \ |
35 | std r10,STK_PARM(r10)(r1) | 29 | END_FTR_SECTION_IFCLR(CPU_FTR_PURR); |
36 | 30 | ||
37 | stw r0,8(r1) | 31 | /* |
38 | 32 | * postcall is performed immediately before function return which | |
39 | HVSC /* invoke the hypervisor */ | 33 | * allows liberal use of volatile registers. |
40 | 34 | */ | |
41 | lwz r0,8(r1) | 35 | #define HCALL_INST_POSTCALL \ |
42 | 36 | ld r4,STK_PARM(r3)(r1); /* validate opcode */ \ | |
43 | ld r8,STK_PARM(r8)(r1) /* Fetch r4-r6 ret args */ | 37 | cmpldi cr7,r4,MAX_HCALL_OPCODE; \ |
44 | ld r9,STK_PARM(r9)(r1) | 38 | bgt- cr7,1f; \ |
45 | ld r10,STK_PARM(r10)(r1) | 39 | \ |
46 | std r4,0(r8) | 40 | /* get time and PURR snapshots after hcall */ \ |
47 | std r5,0(r9) | 41 | mftb r7; /* timebase after */ \ |
48 | std r6,0(r10) | 42 | BEGIN_FTR_SECTION; \ |
49 | 43 | mfspr r8,SPRN_PURR; /* PURR after */ \ | |
50 | mtcrf 0xff,r0 | 44 | ld r6,STK_PARM(r6)(r1); /* PURR before */ \ |
51 | blr /* return r3 = status */ | 45 | subf r6,r6,r8; /* delta */ \ |
46 | END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | ||
47 | ld r5,STK_PARM(r5)(r1); /* timebase before */ \ | ||
48 | subf r5,r5,r7; /* time delta */ \ | ||
49 | \ | ||
50 | /* calculate address of stat structure r4 = opcode */ \ | ||
51 | srdi r4,r4,2; /* index into array */ \ | ||
52 | mulli r4,r4,HCALL_STAT_SIZE; \ | ||
53 | LOAD_REG_ADDR(r7, per_cpu__hcall_stats); \ | ||
54 | add r4,r4,r7; \ | ||
55 | ld r7,PACA_DATA_OFFSET(r13); /* per cpu offset */ \ | ||
56 | add r4,r4,r7; \ | ||
57 | \ | ||
58 | /* update stats */ \ | ||
59 | ld r7,HCALL_STAT_CALLS(r4); /* count */ \ | ||
60 | addi r7,r7,1; \ | ||
61 | std r7,HCALL_STAT_CALLS(r4); \ | ||
62 | ld r7,HCALL_STAT_TB(r4); /* timebase */ \ | ||
63 | add r7,r7,r5; \ | ||
64 | std r7,HCALL_STAT_TB(r4); \ | ||
65 | BEGIN_FTR_SECTION; \ | ||
66 | ld r7,HCALL_STAT_PURR(r4); /* PURR */ \ | ||
67 | add r7,r7,r6; \ | ||
68 | std r7,HCALL_STAT_PURR(r4); \ | ||
69 | END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | ||
70 | 1: | ||
71 | #else | ||
72 | #define HCALL_INST_PRECALL | ||
73 | #define HCALL_INST_POSTCALL | ||
74 | #endif | ||
52 | 75 | ||
76 | .text | ||
53 | 77 | ||
54 | /* Simple interface with no output values (other than status) */ | ||
55 | _GLOBAL(plpar_hcall_norets) | 78 | _GLOBAL(plpar_hcall_norets) |
56 | HMT_MEDIUM | 79 | HMT_MEDIUM |
57 | 80 | ||
58 | mfcr r0 | 81 | mfcr r0 |
59 | stw r0,8(r1) | 82 | stw r0,8(r1) |
60 | 83 | ||
61 | HVSC /* invoke the hypervisor */ | 84 | HCALL_INST_PRECALL |
62 | |||
63 | lwz r0,8(r1) | ||
64 | mtcrf 0xff,r0 | ||
65 | blr /* return r3 = status */ | ||
66 | |||
67 | |||
68 | /* long plpar_hcall_8arg_2ret(unsigned long opcode, R3 | ||
69 | unsigned long arg1, R4 | ||
70 | unsigned long arg2, R5 | ||
71 | unsigned long arg3, R6 | ||
72 | unsigned long arg4, R7 | ||
73 | unsigned long arg5, R8 | ||
74 | unsigned long arg6, R9 | ||
75 | unsigned long arg7, R10 | ||
76 | unsigned long arg8, 112(R1) | ||
77 | unsigned long *out1); 120(R1) | ||
78 | */ | ||
79 | _GLOBAL(plpar_hcall_8arg_2ret) | ||
80 | HMT_MEDIUM | ||
81 | |||
82 | mfcr r0 | ||
83 | ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */ | ||
84 | stw r0,8(r1) | ||
85 | 85 | ||
86 | HVSC /* invoke the hypervisor */ | 86 | HVSC /* invoke the hypervisor */ |
87 | 87 | ||
88 | HCALL_INST_POSTCALL | ||
89 | |||
88 | lwz r0,8(r1) | 90 | lwz r0,8(r1) |
89 | ld r10,STK_PARM(r12)(r1) /* Fetch r4 ret arg */ | ||
90 | std r4,0(r10) | ||
91 | mtcrf 0xff,r0 | 91 | mtcrf 0xff,r0 |
92 | blr /* return r3 = status */ | 92 | blr /* return r3 = status */ |
93 | 93 | ||
94 | 94 | _GLOBAL(plpar_hcall) | |
95 | /* long plpar_hcall_4out(unsigned long opcode, R3 | ||
96 | unsigned long arg1, R4 | ||
97 | unsigned long arg2, R5 | ||
98 | unsigned long arg3, R6 | ||
99 | unsigned long arg4, R7 | ||
100 | unsigned long *out1, R8 | ||
101 | unsigned long *out2, R9 | ||
102 | unsigned long *out3, R10 | ||
103 | unsigned long *out4); 112(R1) | ||
104 | */ | ||
105 | _GLOBAL(plpar_hcall_4out) | ||
106 | HMT_MEDIUM | 95 | HMT_MEDIUM |
107 | 96 | ||
108 | mfcr r0 | 97 | mfcr r0 |
109 | stw r0,8(r1) | 98 | stw r0,8(r1) |
110 | 99 | ||
111 | std r8,STK_PARM(r8)(r1) /* Save out ptrs */ | 100 | HCALL_INST_PRECALL |
112 | std r9,STK_PARM(r9)(r1) | ||
113 | std r10,STK_PARM(r10)(r1) | ||
114 | |||
115 | HVSC /* invoke the hypervisor */ | ||
116 | |||
117 | lwz r0,8(r1) | ||
118 | 101 | ||
119 | ld r8,STK_PARM(r8)(r1) /* Fetch r4-r7 ret args */ | 102 | std r4,STK_PARM(r4)(r1) /* Save ret buffer */ |
120 | ld r9,STK_PARM(r9)(r1) | ||
121 | ld r10,STK_PARM(r10)(r1) | ||
122 | ld r11,STK_PARM(r11)(r1) | ||
123 | std r4,0(r8) | ||
124 | std r5,0(r9) | ||
125 | std r6,0(r10) | ||
126 | std r7,0(r11) | ||
127 | 103 | ||
128 | mtcrf 0xff,r0 | 104 | mr r4,r5 |
129 | blr /* return r3 = status */ | 105 | mr r5,r6 |
130 | 106 | mr r6,r7 | |
131 | /* plpar_hcall_7arg_7ret(unsigned long opcode, R3 | 107 | mr r7,r8 |
132 | unsigned long arg1, R4 | 108 | mr r8,r9 |
133 | unsigned long arg2, R5 | 109 | mr r9,r10 |
134 | unsigned long arg3, R6 | ||
135 | unsigned long arg4, R7 | ||
136 | unsigned long arg5, R8 | ||
137 | unsigned long arg6, R9 | ||
138 | unsigned long arg7, R10 | ||
139 | unsigned long *out1, 112(R1) | ||
140 | unsigned long *out2, 110(R1) | ||
141 | unsigned long *out3, 108(R1) | ||
142 | unsigned long *out4, 106(R1) | ||
143 | unsigned long *out5, 104(R1) | ||
144 | unsigned long *out6, 102(R1) | ||
145 | unsigned long *out7); 100(R1) | ||
146 | */ | ||
147 | _GLOBAL(plpar_hcall_7arg_7ret) | ||
148 | HMT_MEDIUM | ||
149 | |||
150 | mfcr r0 | ||
151 | stw r0,8(r1) | ||
152 | 110 | ||
153 | HVSC /* invoke the hypervisor */ | 111 | HVSC /* invoke the hypervisor */ |
154 | 112 | ||
155 | lwz r0,8(r1) | 113 | ld r12,STK_PARM(r4)(r1) |
114 | std r4, 0(r12) | ||
115 | std r5, 8(r12) | ||
116 | std r6, 16(r12) | ||
117 | std r7, 24(r12) | ||
156 | 118 | ||
157 | ld r11,STK_PARM(r11)(r1) /* Fetch r4 ret arg */ | 119 | HCALL_INST_POSTCALL |
158 | std r4,0(r11) | ||
159 | ld r11,STK_PARM(r12)(r1) /* Fetch r5 ret arg */ | ||
160 | std r5,0(r11) | ||
161 | ld r11,STK_PARM(r13)(r1) /* Fetch r6 ret arg */ | ||
162 | std r6,0(r11) | ||
163 | ld r11,STK_PARM(r14)(r1) /* Fetch r7 ret arg */ | ||
164 | std r7,0(r11) | ||
165 | ld r11,STK_PARM(r15)(r1) /* Fetch r8 ret arg */ | ||
166 | std r8,0(r11) | ||
167 | ld r11,STK_PARM(r16)(r1) /* Fetch r9 ret arg */ | ||
168 | std r9,0(r11) | ||
169 | ld r11,STK_PARM(r17)(r1) /* Fetch r10 ret arg */ | ||
170 | std r10,0(r11) | ||
171 | 120 | ||
121 | lwz r0,8(r1) | ||
172 | mtcrf 0xff,r0 | 122 | mtcrf 0xff,r0 |
173 | 123 | ||
174 | blr /* return r3 = status */ | 124 | blr /* return r3 = status */ |
175 | 125 | ||
176 | /* plpar_hcall_9arg_9ret(unsigned long opcode, R3 | 126 | _GLOBAL(plpar_hcall9) |
177 | unsigned long arg1, R4 | ||
178 | unsigned long arg2, R5 | ||
179 | unsigned long arg3, R6 | ||
180 | unsigned long arg4, R7 | ||
181 | unsigned long arg5, R8 | ||
182 | unsigned long arg6, R9 | ||
183 | unsigned long arg7, R10 | ||
184 | unsigned long arg8, 112(R1) | ||
185 | unsigned long arg9, 110(R1) | ||
186 | unsigned long *out1, 108(R1) | ||
187 | unsigned long *out2, 106(R1) | ||
188 | unsigned long *out3, 104(R1) | ||
189 | unsigned long *out4, 102(R1) | ||
190 | unsigned long *out5, 100(R1) | ||
191 | unsigned long *out6, 98(R1) | ||
192 | unsigned long *out7); 96(R1) | ||
193 | unsigned long *out8, 94(R1) | ||
194 | unsigned long *out9, 92(R1) | ||
195 | */ | ||
196 | _GLOBAL(plpar_hcall_9arg_9ret) | ||
197 | HMT_MEDIUM | 127 | HMT_MEDIUM |
198 | 128 | ||
199 | mfcr r0 | 129 | mfcr r0 |
200 | stw r0,8(r1) | 130 | stw r0,8(r1) |
201 | 131 | ||
202 | ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */ | 132 | HCALL_INST_PRECALL |
203 | ld r12,STK_PARM(r12)(r1) /* put arg9 in R12 */ | 133 | |
134 | std r4,STK_PARM(r4)(r1) /* Save ret buffer */ | ||
135 | |||
136 | mr r4,r5 | ||
137 | mr r5,r6 | ||
138 | mr r6,r7 | ||
139 | mr r7,r8 | ||
140 | mr r8,r9 | ||
141 | mr r9,r10 | ||
142 | ld r10,STK_PARM(r11)(r1) /* put arg7 in R10 */ | ||
143 | ld r11,STK_PARM(r12)(r1) /* put arg8 in R11 */ | ||
144 | ld r12,STK_PARM(r13)(r1) /* put arg9 in R12 */ | ||
204 | 145 | ||
205 | HVSC /* invoke the hypervisor */ | 146 | HVSC /* invoke the hypervisor */ |
206 | 147 | ||
207 | ld r0,STK_PARM(r13)(r1) /* Fetch r4 ret arg */ | 148 | ld r12,STK_PARM(r4)(r1) |
208 | stdx r4,r0,r0 | 149 | std r4, 0(r12) |
209 | ld r0,STK_PARM(r14)(r1) /* Fetch r5 ret arg */ | 150 | std r5, 8(r12) |
210 | stdx r5,r0,r0 | 151 | std r6, 16(r12) |
211 | ld r0,STK_PARM(r15)(r1) /* Fetch r6 ret arg */ | 152 | std r7, 24(r12) |
212 | stdx r6,r0,r0 | 153 | std r8, 32(r12) |
213 | ld r0,STK_PARM(r16)(r1) /* Fetch r7 ret arg */ | 154 | std r9, 40(r12) |
214 | stdx r7,r0,r0 | 155 | std r10,48(r12) |
215 | ld r0,STK_PARM(r17)(r1) /* Fetch r8 ret arg */ | 156 | std r11,56(r12) |
216 | stdx r8,r0,r0 | 157 | std r12,64(r12) |
217 | ld r0,STK_PARM(r18)(r1) /* Fetch r9 ret arg */ | 158 | |
218 | stdx r9,r0,r0 | 159 | HCALL_INST_POSTCALL |
219 | ld r0,STK_PARM(r19)(r1) /* Fetch r10 ret arg */ | ||
220 | stdx r10,r0,r0 | ||
221 | ld r0,STK_PARM(r20)(r1) /* Fetch r11 ret arg */ | ||
222 | stdx r11,r0,r0 | ||
223 | ld r0,STK_PARM(r21)(r1) /* Fetch r12 ret arg */ | ||
224 | stdx r12,r0,r0 | ||
225 | 160 | ||
226 | lwz r0,8(r1) | 161 | lwz r0,8(r1) |
227 | mtcrf 0xff,r0 | 162 | mtcrf 0xff,r0 |
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c new file mode 100644 index 000000000000..641e6511cf06 --- /dev/null +++ b/arch/powerpc/platforms/pseries/hvCall_inst.c | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Mike Kravetz IBM Corporation | ||
3 | * | ||
4 | * Hypervisor Call Instrumentation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/percpu.h> | ||
23 | #include <linux/debugfs.h> | ||
24 | #include <linux/seq_file.h> | ||
25 | #include <linux/cpumask.h> | ||
26 | #include <asm/hvcall.h> | ||
27 | #include <asm/firmware.h> | ||
28 | #include <asm/cputable.h> | ||
29 | |||
30 | DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats); | ||
31 | |||
32 | /* | ||
33 | * Routines for displaying the statistics in debugfs | ||
34 | */ | ||
35 | static void *hc_start(struct seq_file *m, loff_t *pos) | ||
36 | { | ||
37 | if ((int)*pos < HCALL_STAT_ARRAY_SIZE) | ||
38 | return (void *)(unsigned long)(*pos + 1); | ||
39 | |||
40 | return NULL; | ||
41 | } | ||
42 | |||
43 | static void *hc_next(struct seq_file *m, void *p, loff_t * pos) | ||
44 | { | ||
45 | ++*pos; | ||
46 | |||
47 | return hc_start(m, pos); | ||
48 | } | ||
49 | |||
50 | static void hc_stop(struct seq_file *m, void *p) | ||
51 | { | ||
52 | } | ||
53 | |||
54 | static int hc_show(struct seq_file *m, void *p) | ||
55 | { | ||
56 | unsigned long h_num = (unsigned long)p; | ||
57 | struct hcall_stats *hs = (struct hcall_stats *)m->private; | ||
58 | |||
59 | if (hs[h_num].num_calls) { | ||
60 | if (!cpu_has_feature(CPU_FTR_PURR)) | ||
61 | seq_printf(m, "%lu %lu %lu %lu\n", h_num<<2, | ||
62 | hs[h_num].num_calls, | ||
63 | hs[h_num].tb_total, | ||
64 | hs[h_num].purr_total); | ||
65 | else | ||
66 | seq_printf(m, "%lu %lu %lu\n", h_num<<2, | ||
67 | hs[h_num].num_calls, | ||
68 | hs[h_num].tb_total); | ||
69 | } | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static struct seq_operations hcall_inst_seq_ops = { | ||
75 | .start = hc_start, | ||
76 | .next = hc_next, | ||
77 | .stop = hc_stop, | ||
78 | .show = hc_show | ||
79 | }; | ||
80 | |||
81 | static int hcall_inst_seq_open(struct inode *inode, struct file *file) | ||
82 | { | ||
83 | int rc; | ||
84 | struct seq_file *seq; | ||
85 | |||
86 | rc = seq_open(file, &hcall_inst_seq_ops); | ||
87 | seq = file->private_data; | ||
88 | seq->private = file->f_dentry->d_inode->u.generic_ip; | ||
89 | |||
90 | return rc; | ||
91 | } | ||
92 | |||
93 | static struct file_operations hcall_inst_seq_fops = { | ||
94 | .open = hcall_inst_seq_open, | ||
95 | .read = seq_read, | ||
96 | .llseek = seq_lseek, | ||
97 | .release = seq_release, | ||
98 | }; | ||
99 | |||
100 | #define HCALL_ROOT_DIR "hcall_inst" | ||
101 | #define CPU_NAME_BUF_SIZE 32 | ||
102 | |||
103 | static int __init hcall_inst_init(void) | ||
104 | { | ||
105 | struct dentry *hcall_root; | ||
106 | struct dentry *hcall_file; | ||
107 | char cpu_name_buf[CPU_NAME_BUF_SIZE]; | ||
108 | int cpu; | ||
109 | |||
110 | if (!firmware_has_feature(FW_FEATURE_LPAR)) | ||
111 | return 0; | ||
112 | |||
113 | hcall_root = debugfs_create_dir(HCALL_ROOT_DIR, NULL); | ||
114 | if (!hcall_root) | ||
115 | return -ENOMEM; | ||
116 | |||
117 | for_each_possible_cpu(cpu) { | ||
118 | snprintf(cpu_name_buf, CPU_NAME_BUF_SIZE, "cpu%d", cpu); | ||
119 | hcall_file = debugfs_create_file(cpu_name_buf, S_IRUGO, | ||
120 | hcall_root, | ||
121 | per_cpu(hcall_stats, cpu), | ||
122 | &hcall_inst_seq_fops); | ||
123 | if (!hcall_file) | ||
124 | return -ENOMEM; | ||
125 | } | ||
126 | |||
127 | return 0; | ||
128 | } | ||
129 | __initcall(hcall_inst_init); | ||
diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c index a72a987f1d4d..3f6a89b09816 100644 --- a/arch/powerpc/platforms/pseries/hvconsole.c +++ b/arch/powerpc/platforms/pseries/hvconsole.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <asm/hvcall.h> | 28 | #include <asm/hvcall.h> |
29 | #include <asm/hvconsole.h> | 29 | #include <asm/hvconsole.h> |
30 | #include "plpar_wrappers.h" | ||
30 | 31 | ||
31 | /** | 32 | /** |
32 | * hvc_get_chars - retrieve characters from firmware for denoted vterm adatper | 33 | * hvc_get_chars - retrieve characters from firmware for denoted vterm adatper |
@@ -40,9 +41,9 @@ int hvc_get_chars(uint32_t vtermno, char *buf, int count) | |||
40 | { | 41 | { |
41 | unsigned long got; | 42 | unsigned long got; |
42 | 43 | ||
43 | if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got, | 44 | if (plpar_get_term_char(vtermno, &got, buf) == H_SUCCESS) |
44 | (unsigned long *)buf, (unsigned long *)buf+1) == H_SUCCESS) | ||
45 | return got; | 45 | return got; |
46 | |||
46 | return 0; | 47 | return 0; |
47 | } | 48 | } |
48 | 49 | ||
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index d67af2c65754..bbf2e34dc358 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -267,13 +267,12 @@ static void iommu_table_setparms(struct pci_controller *phb, | |||
267 | struct iommu_table *tbl) | 267 | struct iommu_table *tbl) |
268 | { | 268 | { |
269 | struct device_node *node; | 269 | struct device_node *node; |
270 | unsigned long *basep; | 270 | const unsigned long *basep, *sizep; |
271 | unsigned int *sizep; | ||
272 | 271 | ||
273 | node = (struct device_node *)phb->arch_data; | 272 | node = (struct device_node *)phb->arch_data; |
274 | 273 | ||
275 | basep = (unsigned long *)get_property(node, "linux,tce-base", NULL); | 274 | basep = get_property(node, "linux,tce-base", NULL); |
276 | sizep = (unsigned int *)get_property(node, "linux,tce-size", NULL); | 275 | sizep = get_property(node, "linux,tce-size", NULL); |
277 | if (basep == NULL || sizep == NULL) { | 276 | if (basep == NULL || sizep == NULL) { |
278 | printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has " | 277 | printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has " |
279 | "missing tce entries !\n", dn->full_name); | 278 | "missing tce entries !\n", dn->full_name); |
@@ -315,7 +314,7 @@ static void iommu_table_setparms(struct pci_controller *phb, | |||
315 | static void iommu_table_setparms_lpar(struct pci_controller *phb, | 314 | static void iommu_table_setparms_lpar(struct pci_controller *phb, |
316 | struct device_node *dn, | 315 | struct device_node *dn, |
317 | struct iommu_table *tbl, | 316 | struct iommu_table *tbl, |
318 | unsigned char *dma_window) | 317 | const void *dma_window) |
319 | { | 318 | { |
320 | unsigned long offset, size; | 319 | unsigned long offset, size; |
321 | 320 | ||
@@ -415,7 +414,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus) | |||
415 | struct iommu_table *tbl; | 414 | struct iommu_table *tbl; |
416 | struct device_node *dn, *pdn; | 415 | struct device_node *dn, *pdn; |
417 | struct pci_dn *ppci; | 416 | struct pci_dn *ppci; |
418 | unsigned char *dma_window = NULL; | 417 | const void *dma_window = NULL; |
419 | 418 | ||
420 | DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); | 419 | DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); |
421 | 420 | ||
@@ -519,7 +518,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev) | |||
519 | { | 518 | { |
520 | struct device_node *pdn, *dn; | 519 | struct device_node *pdn, *dn; |
521 | struct iommu_table *tbl; | 520 | struct iommu_table *tbl; |
522 | unsigned char *dma_window = NULL; | 521 | const void *dma_window = NULL; |
523 | struct pci_dn *pci; | 522 | struct pci_dn *pci; |
524 | 523 | ||
525 | DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev)); | 524 | DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev)); |
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 3aeb40699042..1820a0b0a8c6 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -48,13 +48,11 @@ | |||
48 | #define DBG_LOW(fmt...) do { } while(0) | 48 | #define DBG_LOW(fmt...) do { } while(0) |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | /* in pSeries_hvCall.S */ | 51 | /* in hvCall.S */ |
52 | EXPORT_SYMBOL(plpar_hcall); | 52 | EXPORT_SYMBOL(plpar_hcall); |
53 | EXPORT_SYMBOL(plpar_hcall_4out); | 53 | EXPORT_SYMBOL(plpar_hcall9); |
54 | EXPORT_SYMBOL(plpar_hcall_norets); | 54 | EXPORT_SYMBOL(plpar_hcall_norets); |
55 | EXPORT_SYMBOL(plpar_hcall_8arg_2ret); | 55 | |
56 | EXPORT_SYMBOL(plpar_hcall_7arg_7ret); | ||
57 | EXPORT_SYMBOL(plpar_hcall_9arg_9ret); | ||
58 | extern void pSeries_find_serial_port(void); | 56 | extern void pSeries_find_serial_port(void); |
59 | 57 | ||
60 | 58 | ||
@@ -204,20 +202,20 @@ void __init udbg_init_debug_lpar(void) | |||
204 | void __init find_udbg_vterm(void) | 202 | void __init find_udbg_vterm(void) |
205 | { | 203 | { |
206 | struct device_node *stdout_node; | 204 | struct device_node *stdout_node; |
207 | u32 *termno; | 205 | const u32 *termno; |
208 | char *name; | 206 | const char *name; |
209 | int add_console; | 207 | int add_console; |
210 | 208 | ||
211 | /* find the boot console from /chosen/stdout */ | 209 | /* find the boot console from /chosen/stdout */ |
212 | if (!of_chosen) | 210 | if (!of_chosen) |
213 | return; | 211 | return; |
214 | name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 212 | name = get_property(of_chosen, "linux,stdout-path", NULL); |
215 | if (name == NULL) | 213 | if (name == NULL) |
216 | return; | 214 | return; |
217 | stdout_node = of_find_node_by_path(name); | 215 | stdout_node = of_find_node_by_path(name); |
218 | if (!stdout_node) | 216 | if (!stdout_node) |
219 | return; | 217 | return; |
220 | name = (char *)get_property(stdout_node, "name", NULL); | 218 | name = get_property(stdout_node, "name", NULL); |
221 | if (!name) { | 219 | if (!name) { |
222 | printk(KERN_WARNING "stdout node missing 'name' property!\n"); | 220 | printk(KERN_WARNING "stdout node missing 'name' property!\n"); |
223 | goto out; | 221 | goto out; |
@@ -228,7 +226,7 @@ void __init find_udbg_vterm(void) | |||
228 | /* Check if it's a virtual terminal */ | 226 | /* Check if it's a virtual terminal */ |
229 | if (strncmp(name, "vty", 3) != 0) | 227 | if (strncmp(name, "vty", 3) != 0) |
230 | goto out; | 228 | goto out; |
231 | termno = (u32 *)get_property(stdout_node, "reg", NULL); | 229 | termno = get_property(stdout_node, "reg", NULL); |
232 | if (termno == NULL) | 230 | if (termno == NULL) |
233 | goto out; | 231 | goto out; |
234 | vtermno = termno[0]; | 232 | vtermno = termno[0]; |
@@ -254,18 +252,34 @@ out: | |||
254 | void vpa_init(int cpu) | 252 | void vpa_init(int cpu) |
255 | { | 253 | { |
256 | int hwcpu = get_hard_smp_processor_id(cpu); | 254 | int hwcpu = get_hard_smp_processor_id(cpu); |
257 | unsigned long vpa = __pa(&lppaca[cpu]); | 255 | unsigned long addr; |
258 | long ret; | 256 | long ret; |
259 | 257 | ||
260 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) | 258 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) |
261 | lppaca[cpu].vmxregs_in_use = 1; | 259 | lppaca[cpu].vmxregs_in_use = 1; |
262 | 260 | ||
263 | ret = register_vpa(hwcpu, vpa); | 261 | addr = __pa(&lppaca[cpu]); |
262 | ret = register_vpa(hwcpu, addr); | ||
264 | 263 | ||
265 | if (ret) | 264 | if (ret) { |
266 | printk(KERN_ERR "WARNING: vpa_init: VPA registration for " | 265 | printk(KERN_ERR "WARNING: vpa_init: VPA registration for " |
267 | "cpu %d (hw %d) of area %lx returns %ld\n", | 266 | "cpu %d (hw %d) of area %lx returns %ld\n", |
268 | cpu, hwcpu, vpa, ret); | 267 | cpu, hwcpu, addr, ret); |
268 | return; | ||
269 | } | ||
270 | /* | ||
271 | * PAPR says this feature is SLB-Buffer but firmware never | ||
272 | * reports that. All SPLPAR support SLB shadow buffer. | ||
273 | */ | ||
274 | addr = __pa(&slb_shadow[cpu]); | ||
275 | if (firmware_has_feature(FW_FEATURE_SPLPAR)) { | ||
276 | ret = register_slb_shadow(hwcpu, addr); | ||
277 | if (ret) | ||
278 | printk(KERN_ERR | ||
279 | "WARNING: vpa_init: SLB shadow buffer " | ||
280 | "registration for cpu %d (hw %d) of area %lx " | ||
281 | "returns %ld\n", cpu, hwcpu, addr, ret); | ||
282 | } | ||
269 | } | 283 | } |
270 | 284 | ||
271 | long pSeries_lpar_hpte_insert(unsigned long hpte_group, | 285 | long pSeries_lpar_hpte_insert(unsigned long hpte_group, |
@@ -277,7 +291,6 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
277 | unsigned long flags; | 291 | unsigned long flags; |
278 | unsigned long slot; | 292 | unsigned long slot; |
279 | unsigned long hpte_v, hpte_r; | 293 | unsigned long hpte_v, hpte_r; |
280 | unsigned long dummy0, dummy1; | ||
281 | 294 | ||
282 | if (!(vflags & HPTE_V_BOLTED)) | 295 | if (!(vflags & HPTE_V_BOLTED)) |
283 | DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " | 296 | DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " |
@@ -302,8 +315,7 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
302 | if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE)) | 315 | if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE)) |
303 | hpte_r &= ~_PAGE_COHERENT; | 316 | hpte_r &= ~_PAGE_COHERENT; |
304 | 317 | ||
305 | lpar_rc = plpar_hcall(H_ENTER, flags, hpte_group, hpte_v, | 318 | lpar_rc = plpar_pte_enter(flags, hpte_group, hpte_v, hpte_r, &slot); |
306 | hpte_r, &slot, &dummy0, &dummy1); | ||
307 | if (unlikely(lpar_rc == H_PTEG_FULL)) { | 319 | if (unlikely(lpar_rc == H_PTEG_FULL)) { |
308 | if (!(vflags & HPTE_V_BOLTED)) | 320 | if (!(vflags & HPTE_V_BOLTED)) |
309 | DBG_LOW(" full\n"); | 321 | DBG_LOW(" full\n"); |
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c index 18abfb1f4e24..64163cecdf93 100644 --- a/arch/powerpc/platforms/pseries/nvram.c +++ b/arch/powerpc/platforms/pseries/nvram.c | |||
@@ -123,13 +123,14 @@ static ssize_t pSeries_nvram_get_size(void) | |||
123 | int __init pSeries_nvram_init(void) | 123 | int __init pSeries_nvram_init(void) |
124 | { | 124 | { |
125 | struct device_node *nvram; | 125 | struct device_node *nvram; |
126 | unsigned int *nbytes_p, proplen; | 126 | const unsigned int *nbytes_p; |
127 | unsigned int proplen; | ||
127 | 128 | ||
128 | nvram = of_find_node_by_type(NULL, "nvram"); | 129 | nvram = of_find_node_by_type(NULL, "nvram"); |
129 | if (nvram == NULL) | 130 | if (nvram == NULL) |
130 | return -ENODEV; | 131 | return -ENODEV; |
131 | 132 | ||
132 | nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen); | 133 | nbytes_p = get_property(nvram, "#bytes", &proplen); |
133 | if (nbytes_p == NULL || proplen != sizeof(unsigned int)) | 134 | if (nbytes_p == NULL || proplen != sizeof(unsigned int)) |
134 | return -EIO; | 135 | return -EIO; |
135 | 136 | ||
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c index e97e67f5e079..410a6bcc4ca0 100644 --- a/arch/powerpc/platforms/pseries/pci.c +++ b/arch/powerpc/platforms/pseries/pci.c | |||
@@ -60,7 +60,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device); | |||
60 | static void __devinit check_s7a(void) | 60 | static void __devinit check_s7a(void) |
61 | { | 61 | { |
62 | struct device_node *root; | 62 | struct device_node *root; |
63 | char *model; | 63 | const char *model; |
64 | 64 | ||
65 | s7a_workaround = 0; | 65 | s7a_workaround = 0; |
66 | root = of_find_node_by_path("/"); | 66 | root = of_find_node_by_path("/"); |
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h index 3bd1b3e06003..3eb7b294d92f 100644 --- a/arch/powerpc/platforms/pseries/plpar_wrappers.h +++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h | |||
@@ -5,20 +5,17 @@ | |||
5 | 5 | ||
6 | static inline long poll_pending(void) | 6 | static inline long poll_pending(void) |
7 | { | 7 | { |
8 | unsigned long dummy; | 8 | return plpar_hcall_norets(H_POLL_PENDING); |
9 | return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, &dummy, &dummy, &dummy); | ||
10 | } | 9 | } |
11 | 10 | ||
12 | static inline long prod_processor(void) | 11 | static inline long prod_processor(void) |
13 | { | 12 | { |
14 | plpar_hcall_norets(H_PROD); | 13 | return plpar_hcall_norets(H_PROD); |
15 | return 0; | ||
16 | } | 14 | } |
17 | 15 | ||
18 | static inline long cede_processor(void) | 16 | static inline long cede_processor(void) |
19 | { | 17 | { |
20 | plpar_hcall_norets(H_CEDE); | 18 | return plpar_hcall_norets(H_CEDE); |
21 | return 0; | ||
22 | } | 19 | } |
23 | 20 | ||
24 | static inline long vpa_call(unsigned long flags, unsigned long cpu, | 21 | static inline long vpa_call(unsigned long flags, unsigned long cpu, |
@@ -40,23 +37,59 @@ static inline long register_vpa(unsigned long cpu, unsigned long vpa) | |||
40 | return vpa_call(0x1, cpu, vpa); | 37 | return vpa_call(0x1, cpu, vpa); |
41 | } | 38 | } |
42 | 39 | ||
40 | static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa) | ||
41 | { | ||
42 | return vpa_call(0x7, cpu, vpa); | ||
43 | } | ||
44 | |||
45 | static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa) | ||
46 | { | ||
47 | return vpa_call(0x3, cpu, vpa); | ||
48 | } | ||
49 | |||
43 | extern void vpa_init(int cpu); | 50 | extern void vpa_init(int cpu); |
44 | 51 | ||
52 | static inline long plpar_pte_enter(unsigned long flags, | ||
53 | unsigned long hpte_group, unsigned long hpte_v, | ||
54 | unsigned long hpte_r, unsigned long *slot) | ||
55 | { | ||
56 | long rc; | ||
57 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; | ||
58 | |||
59 | rc = plpar_hcall(H_ENTER, retbuf, flags, hpte_group, hpte_v, hpte_r); | ||
60 | |||
61 | *slot = retbuf[0]; | ||
62 | |||
63 | return rc; | ||
64 | } | ||
65 | |||
45 | static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex, | 66 | static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex, |
46 | unsigned long avpn, unsigned long *old_pteh_ret, | 67 | unsigned long avpn, unsigned long *old_pteh_ret, |
47 | unsigned long *old_ptel_ret) | 68 | unsigned long *old_ptel_ret) |
48 | { | 69 | { |
49 | unsigned long dummy; | 70 | long rc; |
50 | return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, old_pteh_ret, | 71 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
51 | old_ptel_ret, &dummy); | 72 | |
73 | rc = plpar_hcall(H_REMOVE, retbuf, flags, ptex, avpn); | ||
74 | |||
75 | *old_pteh_ret = retbuf[0]; | ||
76 | *old_ptel_ret = retbuf[1]; | ||
77 | |||
78 | return rc; | ||
52 | } | 79 | } |
53 | 80 | ||
54 | static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, | 81 | static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, |
55 | unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) | 82 | unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) |
56 | { | 83 | { |
57 | unsigned long dummy; | 84 | long rc; |
58 | return plpar_hcall(H_READ, flags, ptex, 0, 0, old_pteh_ret, | 85 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
59 | old_ptel_ret, &dummy); | 86 | |
87 | rc = plpar_hcall(H_READ, retbuf, flags, ptex); | ||
88 | |||
89 | *old_pteh_ret = retbuf[0]; | ||
90 | *old_ptel_ret = retbuf[1]; | ||
91 | |||
92 | return rc; | ||
60 | } | 93 | } |
61 | 94 | ||
62 | static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, | 95 | static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, |
@@ -68,9 +101,14 @@ static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, | |||
68 | static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba, | 101 | static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba, |
69 | unsigned long *tce_ret) | 102 | unsigned long *tce_ret) |
70 | { | 103 | { |
71 | unsigned long dummy; | 104 | long rc; |
72 | return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, tce_ret, &dummy, | 105 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
73 | &dummy); | 106 | |
107 | rc = plpar_hcall(H_GET_TCE, retbuf, liobn, ioba); | ||
108 | |||
109 | *tce_ret = retbuf[0]; | ||
110 | |||
111 | return rc; | ||
74 | } | 112 | } |
75 | 113 | ||
76 | static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba, | 114 | static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba, |
@@ -94,9 +132,17 @@ static inline long plpar_tce_stuff(unsigned long liobn, unsigned long ioba, | |||
94 | static inline long plpar_get_term_char(unsigned long termno, | 132 | static inline long plpar_get_term_char(unsigned long termno, |
95 | unsigned long *len_ret, char *buf_ret) | 133 | unsigned long *len_ret, char *buf_ret) |
96 | { | 134 | { |
135 | long rc; | ||
136 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; | ||
97 | unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */ | 137 | unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */ |
98 | return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, len_ret, | 138 | |
99 | lbuf + 0, lbuf + 1); | 139 | rc = plpar_hcall(H_GET_TERM_CHAR, retbuf, termno); |
140 | |||
141 | *len_ret = retbuf[0]; | ||
142 | lbuf[0] = retbuf[1]; | ||
143 | lbuf[1] = retbuf[2]; | ||
144 | |||
145 | return rc; | ||
100 | } | 146 | } |
101 | 147 | ||
102 | static inline long plpar_put_term_char(unsigned long termno, unsigned long len, | 148 | static inline long plpar_put_term_char(unsigned long termno, unsigned long len, |
@@ -107,4 +153,31 @@ static inline long plpar_put_term_char(unsigned long termno, unsigned long len, | |||
107 | lbuf[1]); | 153 | lbuf[1]); |
108 | } | 154 | } |
109 | 155 | ||
156 | static inline long plpar_eoi(unsigned long xirr) | ||
157 | { | ||
158 | return plpar_hcall_norets(H_EOI, xirr); | ||
159 | } | ||
160 | |||
161 | static inline long plpar_cppr(unsigned long cppr) | ||
162 | { | ||
163 | return plpar_hcall_norets(H_CPPR, cppr); | ||
164 | } | ||
165 | |||
166 | static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr) | ||
167 | { | ||
168 | return plpar_hcall_norets(H_IPI, servernum, mfrr); | ||
169 | } | ||
170 | |||
171 | static inline long plpar_xirr(unsigned long *xirr_ret) | ||
172 | { | ||
173 | long rc; | ||
174 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; | ||
175 | |||
176 | rc = plpar_hcall(H_XIRR, retbuf); | ||
177 | |||
178 | *xirr_ret = retbuf[0]; | ||
179 | |||
180 | return rc; | ||
181 | } | ||
182 | |||
110 | #endif /* _PSERIES_PLPAR_WRAPPERS_H */ | 183 | #endif /* _PSERIES_PLPAR_WRAPPERS_H */ |
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c index c7ffde1a614e..903115d67fdc 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c | |||
@@ -79,7 +79,7 @@ static void request_ras_irqs(struct device_node *np, | |||
79 | { | 79 | { |
80 | int i, index, count = 0; | 80 | int i, index, count = 0; |
81 | struct of_irq oirq; | 81 | struct of_irq oirq; |
82 | u32 *opicprop; | 82 | const u32 *opicprop; |
83 | unsigned int opicplen; | 83 | unsigned int opicplen; |
84 | unsigned int virqs[16]; | 84 | unsigned int virqs[16]; |
85 | 85 | ||
@@ -87,7 +87,7 @@ static void request_ras_irqs(struct device_node *np, | |||
87 | * map those interrupts using the default interrupt host and default | 87 | * map those interrupts using the default interrupt host and default |
88 | * trigger | 88 | * trigger |
89 | */ | 89 | */ |
90 | opicprop = (u32 *)get_property(np, "open-pic-interrupt", &opicplen); | 90 | opicprop = get_property(np, "open-pic-interrupt", &opicplen); |
91 | if (opicprop) { | 91 | if (opicprop) { |
92 | opicplen /= sizeof(u32); | 92 | opicplen /= sizeof(u32); |
93 | for (i = 0; i < opicplen; i++) { | 93 | for (i = 0; i < opicplen; i++) { |
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index 2e4e04042d85..8ca2612221d6 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c | |||
@@ -359,11 +359,11 @@ static int enable_surveillance(int timeout) | |||
359 | static int get_eventscan_parms(void) | 359 | static int get_eventscan_parms(void) |
360 | { | 360 | { |
361 | struct device_node *node; | 361 | struct device_node *node; |
362 | int *ip; | 362 | const int *ip; |
363 | 363 | ||
364 | node = of_find_node_by_path("/rtas"); | 364 | node = of_find_node_by_path("/rtas"); |
365 | 365 | ||
366 | ip = (int *)get_property(node, "rtas-event-scan-rate", NULL); | 366 | ip = get_property(node, "rtas-event-scan-rate", NULL); |
367 | if (ip == NULL) { | 367 | if (ip == NULL) { |
368 | printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n"); | 368 | printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n"); |
369 | of_node_put(node); | 369 | of_node_put(node); |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 31867a701fcb..a6398fbe530d 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -133,9 +133,9 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc, | |||
133 | static void __init pseries_mpic_init_IRQ(void) | 133 | static void __init pseries_mpic_init_IRQ(void) |
134 | { | 134 | { |
135 | struct device_node *np, *old, *cascade = NULL; | 135 | struct device_node *np, *old, *cascade = NULL; |
136 | unsigned int *addrp; | 136 | const unsigned int *addrp; |
137 | unsigned long intack = 0; | 137 | unsigned long intack = 0; |
138 | unsigned int *opprop; | 138 | const unsigned int *opprop; |
139 | unsigned long openpic_addr = 0; | 139 | unsigned long openpic_addr = 0; |
140 | unsigned int cascade_irq; | 140 | unsigned int cascade_irq; |
141 | int naddr, n, i, opplen; | 141 | int naddr, n, i, opplen; |
@@ -143,7 +143,7 @@ static void __init pseries_mpic_init_IRQ(void) | |||
143 | 143 | ||
144 | np = of_find_node_by_path("/"); | 144 | np = of_find_node_by_path("/"); |
145 | naddr = prom_n_addr_cells(np); | 145 | naddr = prom_n_addr_cells(np); |
146 | opprop = (unsigned int *) get_property(np, "platform-open-pic", &opplen); | 146 | opprop = get_property(np, "platform-open-pic", &opplen); |
147 | if (opprop != 0) { | 147 | if (opprop != 0) { |
148 | openpic_addr = of_read_number(opprop, naddr); | 148 | openpic_addr = of_read_number(opprop, naddr); |
149 | printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); | 149 | printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); |
@@ -192,7 +192,7 @@ static void __init pseries_mpic_init_IRQ(void) | |||
192 | break; | 192 | break; |
193 | if (strcmp(np->name, "pci") != 0) | 193 | if (strcmp(np->name, "pci") != 0) |
194 | continue; | 194 | continue; |
195 | addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", | 195 | addrp = get_property(np, "8259-interrupt-acknowledge", |
196 | NULL); | 196 | NULL); |
197 | if (addrp == NULL) | 197 | if (addrp == NULL) |
198 | continue; | 198 | continue; |
@@ -223,23 +223,37 @@ static void pseries_lpar_enable_pmcs(void) | |||
223 | } | 223 | } |
224 | 224 | ||
225 | #ifdef CONFIG_KEXEC | 225 | #ifdef CONFIG_KEXEC |
226 | static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary) | 226 | static void pseries_kexec_cpu_down(int crash_shutdown, int secondary) |
227 | { | ||
228 | mpic_teardown_this_cpu(secondary); | ||
229 | } | ||
230 | |||
231 | static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary) | ||
232 | { | 227 | { |
233 | /* Don't risk a hypervisor call if we're crashing */ | 228 | /* Don't risk a hypervisor call if we're crashing */ |
234 | if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { | 229 | if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { |
235 | unsigned long vpa = __pa(get_lppaca()); | 230 | unsigned long addr; |
236 | 231 | ||
237 | if (unregister_vpa(hard_smp_processor_id(), vpa)) { | 232 | addr = __pa(get_slb_shadow()); |
233 | if (unregister_slb_shadow(hard_smp_processor_id(), addr)) | ||
234 | printk("SLB shadow buffer deregistration of " | ||
235 | "cpu %u (hw_cpu_id %d) failed\n", | ||
236 | smp_processor_id(), | ||
237 | hard_smp_processor_id()); | ||
238 | |||
239 | addr = __pa(get_lppaca()); | ||
240 | if (unregister_vpa(hard_smp_processor_id(), addr)) { | ||
238 | printk("VPA deregistration of cpu %u (hw_cpu_id %d) " | 241 | printk("VPA deregistration of cpu %u (hw_cpu_id %d) " |
239 | "failed\n", smp_processor_id(), | 242 | "failed\n", smp_processor_id(), |
240 | hard_smp_processor_id()); | 243 | hard_smp_processor_id()); |
241 | } | 244 | } |
242 | } | 245 | } |
246 | } | ||
247 | |||
248 | static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary) | ||
249 | { | ||
250 | pseries_kexec_cpu_down(crash_shutdown, secondary); | ||
251 | mpic_teardown_this_cpu(secondary); | ||
252 | } | ||
253 | |||
254 | static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary) | ||
255 | { | ||
256 | pseries_kexec_cpu_down(crash_shutdown, secondary); | ||
243 | xics_teardown_cpu(secondary); | 257 | xics_teardown_cpu(secondary); |
244 | } | 258 | } |
245 | #endif /* CONFIG_KEXEC */ | 259 | #endif /* CONFIG_KEXEC */ |
@@ -247,11 +261,11 @@ static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary) | |||
247 | static void __init pseries_discover_pic(void) | 261 | static void __init pseries_discover_pic(void) |
248 | { | 262 | { |
249 | struct device_node *np; | 263 | struct device_node *np; |
250 | char *typep; | 264 | const char *typep; |
251 | 265 | ||
252 | for (np = NULL; (np = of_find_node_by_name(np, | 266 | for (np = NULL; (np = of_find_node_by_name(np, |
253 | "interrupt-controller"));) { | 267 | "interrupt-controller"));) { |
254 | typep = (char *)get_property(np, "compatible", NULL); | 268 | typep = get_property(np, "compatible", NULL); |
255 | if (strstr(typep, "open-pic")) { | 269 | if (strstr(typep, "open-pic")) { |
256 | pSeries_mpic_node = of_node_get(np); | 270 | pSeries_mpic_node = of_node_get(np); |
257 | ppc_md.init_IRQ = pseries_mpic_init_IRQ; | 271 | ppc_md.init_IRQ = pseries_mpic_init_IRQ; |
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c index ac61098ff401..c6624b8a0e77 100644 --- a/arch/powerpc/platforms/pseries/smp.c +++ b/arch/powerpc/platforms/pseries/smp.c | |||
@@ -62,7 +62,7 @@ | |||
62 | */ | 62 | */ |
63 | static cpumask_t of_spin_map; | 63 | static cpumask_t of_spin_map; |
64 | 64 | ||
65 | extern void pSeries_secondary_smp_init(unsigned long); | 65 | extern void generic_secondary_smp_init(unsigned long); |
66 | 66 | ||
67 | #ifdef CONFIG_HOTPLUG_CPU | 67 | #ifdef CONFIG_HOTPLUG_CPU |
68 | 68 | ||
@@ -145,9 +145,9 @@ static int pSeries_add_processor(struct device_node *np) | |||
145 | unsigned int cpu; | 145 | unsigned int cpu; |
146 | cpumask_t candidate_map, tmp = CPU_MASK_NONE; | 146 | cpumask_t candidate_map, tmp = CPU_MASK_NONE; |
147 | int err = -ENOSPC, len, nthreads, i; | 147 | int err = -ENOSPC, len, nthreads, i; |
148 | u32 *intserv; | 148 | const u32 *intserv; |
149 | 149 | ||
150 | intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", &len); | 150 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); |
151 | if (!intserv) | 151 | if (!intserv) |
152 | return 0; | 152 | return 0; |
153 | 153 | ||
@@ -205,9 +205,9 @@ static void pSeries_remove_processor(struct device_node *np) | |||
205 | { | 205 | { |
206 | unsigned int cpu; | 206 | unsigned int cpu; |
207 | int len, nthreads, i; | 207 | int len, nthreads, i; |
208 | u32 *intserv; | 208 | const u32 *intserv; |
209 | 209 | ||
210 | intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", &len); | 210 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); |
211 | if (!intserv) | 211 | if (!intserv) |
212 | return; | 212 | return; |
213 | 213 | ||
@@ -270,7 +270,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) | |||
270 | { | 270 | { |
271 | int status; | 271 | int status; |
272 | unsigned long start_here = __pa((u32)*((unsigned long *) | 272 | unsigned long start_here = __pa((u32)*((unsigned long *) |
273 | pSeries_secondary_smp_init)); | 273 | generic_secondary_smp_init)); |
274 | unsigned int pcpu; | 274 | unsigned int pcpu; |
275 | int start_cpu; | 275 | int start_cpu; |
276 | 276 | ||
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index e98863025721..253972e5479f 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <asm/i8259.h> | 34 | #include <asm/i8259.h> |
35 | 35 | ||
36 | #include "xics.h" | 36 | #include "xics.h" |
37 | #include "plpar_wrappers.h" | ||
37 | 38 | ||
38 | #define XICS_IPI 2 | 39 | #define XICS_IPI 2 |
39 | #define XICS_IRQ_SPURIOUS 0 | 40 | #define XICS_IRQ_SPURIOUS 0 |
@@ -110,27 +111,6 @@ static inline void direct_qirr_info(int n_cpu, u8 value) | |||
110 | /* LPAR low level accessors */ | 111 | /* LPAR low level accessors */ |
111 | 112 | ||
112 | 113 | ||
113 | static inline long plpar_eoi(unsigned long xirr) | ||
114 | { | ||
115 | return plpar_hcall_norets(H_EOI, xirr); | ||
116 | } | ||
117 | |||
118 | static inline long plpar_cppr(unsigned long cppr) | ||
119 | { | ||
120 | return plpar_hcall_norets(H_CPPR, cppr); | ||
121 | } | ||
122 | |||
123 | static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr) | ||
124 | { | ||
125 | return plpar_hcall_norets(H_IPI, servernum, mfrr); | ||
126 | } | ||
127 | |||
128 | static inline long plpar_xirr(unsigned long *xirr_ret) | ||
129 | { | ||
130 | unsigned long dummy; | ||
131 | return plpar_hcall(H_XIRR, 0, 0, 0, 0, xirr_ret, &dummy, &dummy); | ||
132 | } | ||
133 | |||
134 | static inline unsigned int lpar_xirr_info_get(int n_cpu) | 114 | static inline unsigned int lpar_xirr_info_get(int n_cpu) |
135 | { | 115 | { |
136 | unsigned long lpar_rc; | 116 | unsigned long lpar_rc; |
@@ -590,14 +570,14 @@ static void __init xics_init_one_node(struct device_node *np, | |||
590 | unsigned int *indx) | 570 | unsigned int *indx) |
591 | { | 571 | { |
592 | unsigned int ilen; | 572 | unsigned int ilen; |
593 | u32 *ireg; | 573 | const u32 *ireg; |
594 | 574 | ||
595 | /* This code does the theorically broken assumption that the interrupt | 575 | /* This code does the theorically broken assumption that the interrupt |
596 | * server numbers are the same as the hard CPU numbers. | 576 | * server numbers are the same as the hard CPU numbers. |
597 | * This happens to be the case so far but we are playing with fire... | 577 | * This happens to be the case so far but we are playing with fire... |
598 | * should be fixed one of these days. -BenH. | 578 | * should be fixed one of these days. -BenH. |
599 | */ | 579 | */ |
600 | ireg = (u32 *)get_property(np, "ibm,interrupt-server-ranges", NULL); | 580 | ireg = get_property(np, "ibm,interrupt-server-ranges", NULL); |
601 | 581 | ||
602 | /* Do that ever happen ? we'll know soon enough... but even good'old | 582 | /* Do that ever happen ? we'll know soon enough... but even good'old |
603 | * f80 does have that property .. | 583 | * f80 does have that property .. |
@@ -609,7 +589,7 @@ static void __init xics_init_one_node(struct device_node *np, | |||
609 | */ | 589 | */ |
610 | *indx = *ireg; | 590 | *indx = *ireg; |
611 | } | 591 | } |
612 | ireg = (u32 *)get_property(np, "reg", &ilen); | 592 | ireg = get_property(np, "reg", &ilen); |
613 | if (!ireg) | 593 | if (!ireg) |
614 | panic("xics_init_IRQ: can't find interrupt reg property"); | 594 | panic("xics_init_IRQ: can't find interrupt reg property"); |
615 | 595 | ||
@@ -635,7 +615,7 @@ static void __init xics_setup_8259_cascade(void) | |||
635 | { | 615 | { |
636 | struct device_node *np, *old, *found = NULL; | 616 | struct device_node *np, *old, *found = NULL; |
637 | int cascade, naddr; | 617 | int cascade, naddr; |
638 | u32 *addrp; | 618 | const u32 *addrp; |
639 | unsigned long intack = 0; | 619 | unsigned long intack = 0; |
640 | 620 | ||
641 | for_each_node_by_type(np, "interrupt-controller") | 621 | for_each_node_by_type(np, "interrupt-controller") |
@@ -661,7 +641,7 @@ static void __init xics_setup_8259_cascade(void) | |||
661 | break; | 641 | break; |
662 | if (strcmp(np->name, "pci") != 0) | 642 | if (strcmp(np->name, "pci") != 0) |
663 | continue; | 643 | continue; |
664 | addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", NULL); | 644 | addrp = get_property(np, "8259-interrupt-acknowledge", NULL); |
665 | if (addrp == NULL) | 645 | if (addrp == NULL) |
666 | continue; | 646 | continue; |
667 | naddr = prom_n_addr_cells(np); | 647 | naddr = prom_n_addr_cells(np); |
@@ -680,7 +660,8 @@ void __init xics_init_IRQ(void) | |||
680 | { | 660 | { |
681 | int i; | 661 | int i; |
682 | struct device_node *np; | 662 | struct device_node *np; |
683 | u32 *ireg, ilen, indx = 0; | 663 | u32 ilen, indx = 0; |
664 | const u32 *ireg; | ||
684 | int found = 0; | 665 | int found = 0; |
685 | 666 | ||
686 | ppc64_boot_msg(0x20, "XICS Init"); | 667 | ppc64_boot_msg(0x20, "XICS Init"); |
@@ -705,18 +686,17 @@ void __init xics_init_IRQ(void) | |||
705 | for (np = of_find_node_by_type(NULL, "cpu"); | 686 | for (np = of_find_node_by_type(NULL, "cpu"); |
706 | np; | 687 | np; |
707 | np = of_find_node_by_type(np, "cpu")) { | 688 | np = of_find_node_by_type(np, "cpu")) { |
708 | ireg = (u32 *)get_property(np, "reg", &ilen); | 689 | ireg = get_property(np, "reg", &ilen); |
709 | if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) { | 690 | if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) { |
710 | ireg = (u32 *)get_property(np, | 691 | ireg = get_property(np, |
711 | "ibm,ppc-interrupt-gserver#s", | 692 | "ibm,ppc-interrupt-gserver#s", &ilen); |
712 | &ilen); | ||
713 | i = ilen / sizeof(int); | 693 | i = ilen / sizeof(int); |
714 | if (ireg && i > 0) { | 694 | if (ireg && i > 0) { |
715 | default_server = ireg[0]; | 695 | default_server = ireg[0]; |
716 | /* take last element */ | 696 | /* take last element */ |
717 | default_distrib_server = ireg[i-1]; | 697 | default_distrib_server = ireg[i-1]; |
718 | } | 698 | } |
719 | ireg = (u32 *)get_property(np, | 699 | ireg = get_property(np, |
720 | "ibm,interrupt-server#-size", NULL); | 700 | "ibm,interrupt-server#-size", NULL); |
721 | if (ireg) | 701 | if (ireg) |
722 | interrupt_server_size = *ireg; | 702 | interrupt_server_size = *ireg; |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index ef10bcf2d943..92ba378b7990 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -41,7 +41,7 @@ phys_addr_t get_immrbase(void) | |||
41 | soc = of_find_node_by_type(NULL, "soc"); | 41 | soc = of_find_node_by_type(NULL, "soc"); |
42 | if (soc) { | 42 | if (soc) { |
43 | unsigned int size; | 43 | unsigned int size; |
44 | void *prop = get_property(soc, "reg", &size); | 44 | const void *prop = get_property(soc, "reg", &size); |
45 | immrbase = of_translate_address(soc, prop); | 45 | immrbase = of_translate_address(soc, prop); |
46 | of_node_put(soc); | 46 | of_node_put(soc); |
47 | }; | 47 | }; |
@@ -85,7 +85,7 @@ static int __init gfar_mdio_of_init(void) | |||
85 | mdio_data.irq[k] = -1; | 85 | mdio_data.irq[k] = -1; |
86 | 86 | ||
87 | while ((child = of_get_next_child(np, child)) != NULL) { | 87 | while ((child = of_get_next_child(np, child)) != NULL) { |
88 | u32 *id = get_property(child, "reg", NULL); | 88 | const u32 *id = get_property(child, "reg", NULL); |
89 | mdio_data.irq[*id] = irq_of_parse_and_map(child, 0); | 89 | mdio_data.irq[*id] = irq_of_parse_and_map(child, 0); |
90 | } | 90 | } |
91 | 91 | ||
@@ -124,10 +124,10 @@ static int __init gfar_of_init(void) | |||
124 | struct resource r[4]; | 124 | struct resource r[4]; |
125 | struct device_node *phy, *mdio; | 125 | struct device_node *phy, *mdio; |
126 | struct gianfar_platform_data gfar_data; | 126 | struct gianfar_platform_data gfar_data; |
127 | unsigned int *id; | 127 | const unsigned int *id; |
128 | char *model; | 128 | const char *model; |
129 | void *mac_addr; | 129 | const void *mac_addr; |
130 | phandle *ph; | 130 | const phandle *ph; |
131 | int n_res = 1; | 131 | int n_res = 1; |
132 | 132 | ||
133 | memset(r, 0, sizeof(r)); | 133 | memset(r, 0, sizeof(r)); |
@@ -193,7 +193,7 @@ static int __init gfar_of_init(void) | |||
193 | FSL_GIANFAR_DEV_HAS_VLAN | | 193 | FSL_GIANFAR_DEV_HAS_VLAN | |
194 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; | 194 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; |
195 | 195 | ||
196 | ph = (phandle *) get_property(np, "phy-handle", NULL); | 196 | ph = get_property(np, "phy-handle", NULL); |
197 | phy = of_find_node_by_phandle(*ph); | 197 | phy = of_find_node_by_phandle(*ph); |
198 | 198 | ||
199 | if (phy == NULL) { | 199 | if (phy == NULL) { |
@@ -203,7 +203,7 @@ static int __init gfar_of_init(void) | |||
203 | 203 | ||
204 | mdio = of_get_parent(phy); | 204 | mdio = of_get_parent(phy); |
205 | 205 | ||
206 | id = (u32 *) get_property(phy, "reg", NULL); | 206 | id = get_property(phy, "reg", NULL); |
207 | ret = of_address_to_resource(mdio, 0, &res); | 207 | ret = of_address_to_resource(mdio, 0, &res); |
208 | if (ret) { | 208 | if (ret) { |
209 | of_node_put(phy); | 209 | of_node_put(phy); |
@@ -247,7 +247,7 @@ static int __init fsl_i2c_of_init(void) | |||
247 | i++) { | 247 | i++) { |
248 | struct resource r[2]; | 248 | struct resource r[2]; |
249 | struct fsl_i2c_platform_data i2c_data; | 249 | struct fsl_i2c_platform_data i2c_data; |
250 | unsigned char *flags = NULL; | 250 | const unsigned char *flags = NULL; |
251 | 251 | ||
252 | memset(&r, 0, sizeof(r)); | 252 | memset(&r, 0, sizeof(r)); |
253 | memset(&i2c_data, 0, sizeof(i2c_data)); | 253 | memset(&i2c_data, 0, sizeof(i2c_data)); |
@@ -298,7 +298,7 @@ static int __init mpc83xx_wdt_init(void) | |||
298 | struct resource r; | 298 | struct resource r; |
299 | struct device_node *soc, *np; | 299 | struct device_node *soc, *np; |
300 | struct platform_device *dev; | 300 | struct platform_device *dev; |
301 | unsigned int *freq; | 301 | const unsigned int *freq; |
302 | int ret; | 302 | int ret; |
303 | 303 | ||
304 | np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt"); | 304 | np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt"); |
@@ -315,7 +315,7 @@ static int __init mpc83xx_wdt_init(void) | |||
315 | goto nosoc; | 315 | goto nosoc; |
316 | } | 316 | } |
317 | 317 | ||
318 | freq = (unsigned int *)get_property(soc, "bus-frequency", NULL); | 318 | freq = get_property(soc, "bus-frequency", NULL); |
319 | if (!freq) { | 319 | if (!freq) { |
320 | ret = -ENODEV; | 320 | ret = -ENODEV; |
321 | goto err; | 321 | goto err; |
@@ -355,7 +355,7 @@ nodev: | |||
355 | arch_initcall(mpc83xx_wdt_init); | 355 | arch_initcall(mpc83xx_wdt_init); |
356 | #endif | 356 | #endif |
357 | 357 | ||
358 | static enum fsl_usb2_phy_modes determine_usb_phy(char * phy_type) | 358 | static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type) |
359 | { | 359 | { |
360 | if (!phy_type) | 360 | if (!phy_type) |
361 | return FSL_USB2_PHY_NONE; | 361 | return FSL_USB2_PHY_NONE; |
@@ -383,7 +383,7 @@ static int __init fsl_usb_of_init(void) | |||
383 | i++) { | 383 | i++) { |
384 | struct resource r[2]; | 384 | struct resource r[2]; |
385 | struct fsl_usb2_platform_data usb_data; | 385 | struct fsl_usb2_platform_data usb_data; |
386 | unsigned char *prop = NULL; | 386 | const unsigned char *prop = NULL; |
387 | 387 | ||
388 | memset(&r, 0, sizeof(r)); | 388 | memset(&r, 0, sizeof(r)); |
389 | memset(&usb_data, 0, sizeof(usb_data)); | 389 | memset(&usb_data, 0, sizeof(usb_data)); |
@@ -431,7 +431,7 @@ static int __init fsl_usb_of_init(void) | |||
431 | i++) { | 431 | i++) { |
432 | struct resource r[2]; | 432 | struct resource r[2]; |
433 | struct fsl_usb2_platform_data usb_data; | 433 | struct fsl_usb2_platform_data usb_data; |
434 | unsigned char *prop = NULL; | 434 | const unsigned char *prop = NULL; |
435 | 435 | ||
436 | memset(&r, 0, sizeof(r)); | 436 | memset(&r, 0, sizeof(r)); |
437 | memset(&usb_data, 0, sizeof(usb_data)); | 437 | memset(&usb_data, 0, sizeof(usb_data)); |
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h index c433d3f39edd..5a3dd480d2fd 100644 --- a/arch/powerpc/sysdev/fsl_soc.h +++ b/arch/powerpc/sysdev/fsl_soc.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define __PPC_FSL_SOC_H | 2 | #define __PPC_FSL_SOC_H |
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | #include <asm/mmu.h> | ||
6 | |||
5 | extern phys_addr_t get_immrbase(void); | 7 | extern phys_addr_t get_immrbase(void); |
6 | 8 | ||
7 | #endif | 9 | #endif |
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c index 9855820b9548..26a6a3becd66 100644 --- a/arch/powerpc/sysdev/i8259.c +++ b/arch/powerpc/sysdev/i8259.c | |||
@@ -224,7 +224,7 @@ static struct irq_host_ops i8259_host_ops = { | |||
224 | .xlate = i8259_host_xlate, | 224 | .xlate = i8259_host_xlate, |
225 | }; | 225 | }; |
226 | 226 | ||
227 | /**** | 227 | /** |
228 | * i8259_init - Initialize the legacy controller | 228 | * i8259_init - Initialize the legacy controller |
229 | * @node: device node of the legacy PIC (can be NULL, but then, it will match | 229 | * @node: device node of the legacy PIC (can be NULL, but then, it will match |
230 | * all interrupts, so beware) | 230 | * all interrupts, so beware) |
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c index 70e707785d49..0251b7c68d0e 100644 --- a/arch/powerpc/sysdev/ipic.c +++ b/arch/powerpc/sysdev/ipic.c | |||
@@ -210,7 +210,7 @@ static struct ipic_info ipic_info[] = { | |||
210 | .prio_mask = 4, | 210 | .prio_mask = 4, |
211 | }, | 211 | }, |
212 | [64] = { | 212 | [64] = { |
213 | .pend = IPIC_SIPNR_H, | 213 | .pend = IPIC_SIPNR_L, |
214 | .mask = IPIC_SIMSR_L, | 214 | .mask = IPIC_SIMSR_L, |
215 | .prio = IPIC_SMPRR_A, | 215 | .prio = IPIC_SMPRR_A, |
216 | .force = IPIC_SIFCR_L, | 216 | .force = IPIC_SIFCR_L, |
@@ -218,7 +218,7 @@ static struct ipic_info ipic_info[] = { | |||
218 | .prio_mask = 0, | 218 | .prio_mask = 0, |
219 | }, | 219 | }, |
220 | [65] = { | 220 | [65] = { |
221 | .pend = IPIC_SIPNR_H, | 221 | .pend = IPIC_SIPNR_L, |
222 | .mask = IPIC_SIMSR_L, | 222 | .mask = IPIC_SIMSR_L, |
223 | .prio = IPIC_SMPRR_A, | 223 | .prio = IPIC_SMPRR_A, |
224 | .force = IPIC_SIFCR_L, | 224 | .force = IPIC_SIFCR_L, |
@@ -226,7 +226,7 @@ static struct ipic_info ipic_info[] = { | |||
226 | .prio_mask = 1, | 226 | .prio_mask = 1, |
227 | }, | 227 | }, |
228 | [66] = { | 228 | [66] = { |
229 | .pend = IPIC_SIPNR_H, | 229 | .pend = IPIC_SIPNR_L, |
230 | .mask = IPIC_SIMSR_L, | 230 | .mask = IPIC_SIMSR_L, |
231 | .prio = IPIC_SMPRR_A, | 231 | .prio = IPIC_SMPRR_A, |
232 | .force = IPIC_SIFCR_L, | 232 | .force = IPIC_SIFCR_L, |
@@ -234,7 +234,7 @@ static struct ipic_info ipic_info[] = { | |||
234 | .prio_mask = 2, | 234 | .prio_mask = 2, |
235 | }, | 235 | }, |
236 | [67] = { | 236 | [67] = { |
237 | .pend = IPIC_SIPNR_H, | 237 | .pend = IPIC_SIPNR_L, |
238 | .mask = IPIC_SIMSR_L, | 238 | .mask = IPIC_SIMSR_L, |
239 | .prio = IPIC_SMPRR_A, | 239 | .prio = IPIC_SMPRR_A, |
240 | .force = IPIC_SIFCR_L, | 240 | .force = IPIC_SIFCR_L, |
@@ -242,7 +242,7 @@ static struct ipic_info ipic_info[] = { | |||
242 | .prio_mask = 3, | 242 | .prio_mask = 3, |
243 | }, | 243 | }, |
244 | [68] = { | 244 | [68] = { |
245 | .pend = IPIC_SIPNR_H, | 245 | .pend = IPIC_SIPNR_L, |
246 | .mask = IPIC_SIMSR_L, | 246 | .mask = IPIC_SIMSR_L, |
247 | .prio = IPIC_SMPRR_B, | 247 | .prio = IPIC_SMPRR_B, |
248 | .force = IPIC_SIFCR_L, | 248 | .force = IPIC_SIFCR_L, |
@@ -250,7 +250,7 @@ static struct ipic_info ipic_info[] = { | |||
250 | .prio_mask = 0, | 250 | .prio_mask = 0, |
251 | }, | 251 | }, |
252 | [69] = { | 252 | [69] = { |
253 | .pend = IPIC_SIPNR_H, | 253 | .pend = IPIC_SIPNR_L, |
254 | .mask = IPIC_SIMSR_L, | 254 | .mask = IPIC_SIMSR_L, |
255 | .prio = IPIC_SMPRR_B, | 255 | .prio = IPIC_SMPRR_B, |
256 | .force = IPIC_SIFCR_L, | 256 | .force = IPIC_SIFCR_L, |
@@ -258,7 +258,7 @@ static struct ipic_info ipic_info[] = { | |||
258 | .prio_mask = 1, | 258 | .prio_mask = 1, |
259 | }, | 259 | }, |
260 | [70] = { | 260 | [70] = { |
261 | .pend = IPIC_SIPNR_H, | 261 | .pend = IPIC_SIPNR_L, |
262 | .mask = IPIC_SIMSR_L, | 262 | .mask = IPIC_SIMSR_L, |
263 | .prio = IPIC_SMPRR_B, | 263 | .prio = IPIC_SMPRR_B, |
264 | .force = IPIC_SIFCR_L, | 264 | .force = IPIC_SIFCR_L, |
@@ -266,7 +266,7 @@ static struct ipic_info ipic_info[] = { | |||
266 | .prio_mask = 2, | 266 | .prio_mask = 2, |
267 | }, | 267 | }, |
268 | [71] = { | 268 | [71] = { |
269 | .pend = IPIC_SIPNR_H, | 269 | .pend = IPIC_SIPNR_L, |
270 | .mask = IPIC_SIMSR_L, | 270 | .mask = IPIC_SIMSR_L, |
271 | .prio = IPIC_SMPRR_B, | 271 | .prio = IPIC_SMPRR_B, |
272 | .force = IPIC_SIFCR_L, | 272 | .force = IPIC_SIFCR_L, |
@@ -274,91 +274,91 @@ static struct ipic_info ipic_info[] = { | |||
274 | .prio_mask = 3, | 274 | .prio_mask = 3, |
275 | }, | 275 | }, |
276 | [72] = { | 276 | [72] = { |
277 | .pend = IPIC_SIPNR_H, | 277 | .pend = IPIC_SIPNR_L, |
278 | .mask = IPIC_SIMSR_L, | 278 | .mask = IPIC_SIMSR_L, |
279 | .prio = 0, | 279 | .prio = 0, |
280 | .force = IPIC_SIFCR_L, | 280 | .force = IPIC_SIFCR_L, |
281 | .bit = 8, | 281 | .bit = 8, |
282 | }, | 282 | }, |
283 | [73] = { | 283 | [73] = { |
284 | .pend = IPIC_SIPNR_H, | 284 | .pend = IPIC_SIPNR_L, |
285 | .mask = IPIC_SIMSR_L, | 285 | .mask = IPIC_SIMSR_L, |
286 | .prio = 0, | 286 | .prio = 0, |
287 | .force = IPIC_SIFCR_L, | 287 | .force = IPIC_SIFCR_L, |
288 | .bit = 9, | 288 | .bit = 9, |
289 | }, | 289 | }, |
290 | [74] = { | 290 | [74] = { |
291 | .pend = IPIC_SIPNR_H, | 291 | .pend = IPIC_SIPNR_L, |
292 | .mask = IPIC_SIMSR_L, | 292 | .mask = IPIC_SIMSR_L, |
293 | .prio = 0, | 293 | .prio = 0, |
294 | .force = IPIC_SIFCR_L, | 294 | .force = IPIC_SIFCR_L, |
295 | .bit = 10, | 295 | .bit = 10, |
296 | }, | 296 | }, |
297 | [75] = { | 297 | [75] = { |
298 | .pend = IPIC_SIPNR_H, | 298 | .pend = IPIC_SIPNR_L, |
299 | .mask = IPIC_SIMSR_L, | 299 | .mask = IPIC_SIMSR_L, |
300 | .prio = 0, | 300 | .prio = 0, |
301 | .force = IPIC_SIFCR_L, | 301 | .force = IPIC_SIFCR_L, |
302 | .bit = 11, | 302 | .bit = 11, |
303 | }, | 303 | }, |
304 | [76] = { | 304 | [76] = { |
305 | .pend = IPIC_SIPNR_H, | 305 | .pend = IPIC_SIPNR_L, |
306 | .mask = IPIC_SIMSR_L, | 306 | .mask = IPIC_SIMSR_L, |
307 | .prio = 0, | 307 | .prio = 0, |
308 | .force = IPIC_SIFCR_L, | 308 | .force = IPIC_SIFCR_L, |
309 | .bit = 12, | 309 | .bit = 12, |
310 | }, | 310 | }, |
311 | [77] = { | 311 | [77] = { |
312 | .pend = IPIC_SIPNR_H, | 312 | .pend = IPIC_SIPNR_L, |
313 | .mask = IPIC_SIMSR_L, | 313 | .mask = IPIC_SIMSR_L, |
314 | .prio = 0, | 314 | .prio = 0, |
315 | .force = IPIC_SIFCR_L, | 315 | .force = IPIC_SIFCR_L, |
316 | .bit = 13, | 316 | .bit = 13, |
317 | }, | 317 | }, |
318 | [78] = { | 318 | [78] = { |
319 | .pend = IPIC_SIPNR_H, | 319 | .pend = IPIC_SIPNR_L, |
320 | .mask = IPIC_SIMSR_L, | 320 | .mask = IPIC_SIMSR_L, |
321 | .prio = 0, | 321 | .prio = 0, |
322 | .force = IPIC_SIFCR_L, | 322 | .force = IPIC_SIFCR_L, |
323 | .bit = 14, | 323 | .bit = 14, |
324 | }, | 324 | }, |
325 | [79] = { | 325 | [79] = { |
326 | .pend = IPIC_SIPNR_H, | 326 | .pend = IPIC_SIPNR_L, |
327 | .mask = IPIC_SIMSR_L, | 327 | .mask = IPIC_SIMSR_L, |
328 | .prio = 0, | 328 | .prio = 0, |
329 | .force = IPIC_SIFCR_L, | 329 | .force = IPIC_SIFCR_L, |
330 | .bit = 15, | 330 | .bit = 15, |
331 | }, | 331 | }, |
332 | [80] = { | 332 | [80] = { |
333 | .pend = IPIC_SIPNR_H, | 333 | .pend = IPIC_SIPNR_L, |
334 | .mask = IPIC_SIMSR_L, | 334 | .mask = IPIC_SIMSR_L, |
335 | .prio = 0, | 335 | .prio = 0, |
336 | .force = IPIC_SIFCR_L, | 336 | .force = IPIC_SIFCR_L, |
337 | .bit = 16, | 337 | .bit = 16, |
338 | }, | 338 | }, |
339 | [84] = { | 339 | [84] = { |
340 | .pend = IPIC_SIPNR_H, | 340 | .pend = IPIC_SIPNR_L, |
341 | .mask = IPIC_SIMSR_L, | 341 | .mask = IPIC_SIMSR_L, |
342 | .prio = 0, | 342 | .prio = 0, |
343 | .force = IPIC_SIFCR_L, | 343 | .force = IPIC_SIFCR_L, |
344 | .bit = 20, | 344 | .bit = 20, |
345 | }, | 345 | }, |
346 | [85] = { | 346 | [85] = { |
347 | .pend = IPIC_SIPNR_H, | 347 | .pend = IPIC_SIPNR_L, |
348 | .mask = IPIC_SIMSR_L, | 348 | .mask = IPIC_SIMSR_L, |
349 | .prio = 0, | 349 | .prio = 0, |
350 | .force = IPIC_SIFCR_L, | 350 | .force = IPIC_SIFCR_L, |
351 | .bit = 21, | 351 | .bit = 21, |
352 | }, | 352 | }, |
353 | [90] = { | 353 | [90] = { |
354 | .pend = IPIC_SIPNR_H, | 354 | .pend = IPIC_SIPNR_L, |
355 | .mask = IPIC_SIMSR_L, | 355 | .mask = IPIC_SIMSR_L, |
356 | .prio = 0, | 356 | .prio = 0, |
357 | .force = IPIC_SIFCR_L, | 357 | .force = IPIC_SIFCR_L, |
358 | .bit = 26, | 358 | .bit = 26, |
359 | }, | 359 | }, |
360 | [91] = { | 360 | [91] = { |
361 | .pend = IPIC_SIPNR_H, | 361 | .pend = IPIC_SIPNR_L, |
362 | .mask = IPIC_SIMSR_L, | 362 | .mask = IPIC_SIMSR_L, |
363 | .prio = 0, | 363 | .prio = 0, |
364 | .force = IPIC_SIFCR_L, | 364 | .force = IPIC_SIFCR_L, |
diff --git a/arch/powerpc/sysdev/mmio_nvram.c b/arch/powerpc/sysdev/mmio_nvram.c index 615350d46b52..ff23f5a4d4b9 100644 --- a/arch/powerpc/sysdev/mmio_nvram.c +++ b/arch/powerpc/sysdev/mmio_nvram.c | |||
@@ -80,7 +80,7 @@ static ssize_t mmio_nvram_get_size(void) | |||
80 | int __init mmio_nvram_init(void) | 80 | int __init mmio_nvram_init(void) |
81 | { | 81 | { |
82 | struct device_node *nvram_node; | 82 | struct device_node *nvram_node; |
83 | unsigned long *buffer; | 83 | const unsigned long *buffer; |
84 | int proplen; | 84 | int proplen; |
85 | unsigned long nvram_addr; | 85 | unsigned long nvram_addr; |
86 | int ret; | 86 | int ret; |
@@ -91,7 +91,7 @@ int __init mmio_nvram_init(void) | |||
91 | goto out; | 91 | goto out; |
92 | 92 | ||
93 | ret = -EIO; | 93 | ret = -EIO; |
94 | buffer = (unsigned long *)get_property(nvram_node, "reg", &proplen); | 94 | buffer = get_property(nvram_node, "reg", &proplen); |
95 | if (proplen != 2*sizeof(unsigned long)) | 95 | if (proplen != 2*sizeof(unsigned long)) |
96 | goto out; | 96 | goto out; |
97 | 97 | ||
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c index 2ab06ed3ae73..c28f69bef8e2 100644 --- a/arch/powerpc/sysdev/tsi108_pci.c +++ b/arch/powerpc/sysdev/tsi108_pci.c | |||
@@ -194,7 +194,7 @@ int __init tsi108_setup_pci(struct device_node *dev) | |||
194 | int len; | 194 | int len; |
195 | struct pci_controller *hose; | 195 | struct pci_controller *hose; |
196 | struct resource rsrc; | 196 | struct resource rsrc; |
197 | int *bus_range; | 197 | const int *bus_range; |
198 | int primary = 0, has_address = 0; | 198 | int primary = 0, has_address = 0; |
199 | 199 | ||
200 | /* PCI Config mapping */ | 200 | /* PCI Config mapping */ |
@@ -207,7 +207,7 @@ int __init tsi108_setup_pci(struct device_node *dev) | |||
207 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 207 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
208 | 208 | ||
209 | /* Get bus range if any */ | 209 | /* Get bus range if any */ |
210 | bus_range = (int *)get_property(dev, "bus-range", &len); | 210 | bus_range = get_property(dev, "bus-range", &len); |
211 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 211 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
212 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 212 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
213 | " bus 0\n", dev->full_name); | 213 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 179b10ced8c7..8adad1444a51 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -137,10 +137,14 @@ static void bootcmds(void); | |||
137 | static void proccall(void); | 137 | static void proccall(void); |
138 | void dump_segments(void); | 138 | void dump_segments(void); |
139 | static void symbol_lookup(void); | 139 | static void symbol_lookup(void); |
140 | static void xmon_show_stack(unsigned long sp, unsigned long lr, | ||
141 | unsigned long pc); | ||
140 | static void xmon_print_symbol(unsigned long address, const char *mid, | 142 | static void xmon_print_symbol(unsigned long address, const char *mid, |
141 | const char *after); | 143 | const char *after); |
142 | static const char *getvecname(unsigned long vec); | 144 | static const char *getvecname(unsigned long vec); |
143 | 145 | ||
146 | int xmon_no_auto_backtrace; | ||
147 | |||
144 | extern int print_insn_powerpc(unsigned long, unsigned long, int); | 148 | extern int print_insn_powerpc(unsigned long, unsigned long, int); |
145 | 149 | ||
146 | extern void xmon_enter(void); | 150 | extern void xmon_enter(void); |
@@ -736,6 +740,12 @@ cmds(struct pt_regs *excp) | |||
736 | 740 | ||
737 | last_cmd = NULL; | 741 | last_cmd = NULL; |
738 | xmon_regs = excp; | 742 | xmon_regs = excp; |
743 | |||
744 | if (!xmon_no_auto_backtrace) { | ||
745 | xmon_no_auto_backtrace = 1; | ||
746 | xmon_show_stack(excp->gpr[1], excp->link, excp->nip); | ||
747 | } | ||
748 | |||
739 | for(;;) { | 749 | for(;;) { |
740 | #ifdef CONFIG_SMP | 750 | #ifdef CONFIG_SMP |
741 | printf("%x:", smp_processor_id()); | 751 | printf("%x:", smp_processor_id()); |