aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Kconfig14
-rw-r--r--arch/powerpc/Kconfig.debug16
-rw-r--r--arch/powerpc/boot/Makefile4
-rw-r--r--arch/powerpc/configs/maple_defconfig2
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/asm-offsets.c16
-rw-r--r--arch/powerpc/kernel/btext.c24
-rw-r--r--arch/powerpc/kernel/cpu_setup_ppc970.S (renamed from arch/powerpc/kernel/cpu_setup_power4.S)103
-rw-r--r--arch/powerpc/kernel/cputable.c20
-rw-r--r--arch/powerpc/kernel/crash_dump.c2
-rw-r--r--arch/powerpc/kernel/dma_64.c65
-rw-r--r--arch/powerpc/kernel/entry_64.S8
-rw-r--r--arch/powerpc/kernel/head_64.S54
-rw-r--r--arch/powerpc/kernel/ibmebus.c6
-rw-r--r--arch/powerpc/kernel/irq.c5
-rw-r--r--arch/powerpc/kernel/legacy_serial.c35
-rw-r--r--arch/powerpc/kernel/lparcfg.c30
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c10
-rw-r--r--arch/powerpc/kernel/of_device.c24
-rw-r--r--arch/powerpc/kernel/paca.c15
-rw-r--r--arch/powerpc/kernel/pci_32.c39
-rw-r--r--arch/powerpc/kernel/pci_64.c67
-rw-r--r--arch/powerpc/kernel/pci_dn.c13
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c3
-rw-r--r--arch/powerpc/kernel/prom.c25
-rw-r--r--arch/powerpc/kernel/prom_init.c10
-rw-r--r--arch/powerpc/kernel/prom_parse.c90
-rw-r--r--arch/powerpc/kernel/rtas-proc.c25
-rw-r--r--arch/powerpc/kernel/rtas.c47
-rw-r--r--arch/powerpc/kernel/rtas_pci.c28
-rw-r--r--arch/powerpc/kernel/setup-common.c23
-rw-r--r--arch/powerpc/kernel/setup_64.c23
-rw-r--r--arch/powerpc/kernel/sysfs.c9
-rw-r--r--arch/powerpc/kernel/time.c4
-rw-r--r--arch/powerpc/kernel/traps.c25
-rw-r--r--arch/powerpc/kernel/vio.c16
-rw-r--r--arch/powerpc/lib/Makefile1
-rw-r--r--arch/powerpc/lib/e2a.c116
-rw-r--r--arch/powerpc/mm/numa.c31
-rw-r--r--arch/powerpc/mm/slb.c37
-rw-r--r--arch/powerpc/mm/tlb_64.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c4
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.c4
-rw-r--r--arch/powerpc/platforms/83xx/pci.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c4
-rw-r--r--arch/powerpc/platforms/85xx/pci.c4
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c4
-rw-r--r--arch/powerpc/platforms/86xx/pci.c4
-rw-r--r--arch/powerpc/platforms/Makefile1
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.c8
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c25
-rw-r--r--arch/powerpc/platforms/cell/iommu.c22
-rw-r--r--arch/powerpc/platforms/cell/setup.c4
-rw-r--r--arch/powerpc/platforms/cell/smp.c4
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c10
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c18
-rw-r--r--arch/powerpc/platforms/chrp/nvram.c5
-rw-r--r--arch/powerpc/platforms/chrp/pci.c53
-rw-r--r--arch/powerpc/platforms/chrp/setup.c48
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c8
-rw-r--r--arch/powerpc/platforms/iseries/Kconfig8
-rw-r--r--arch/powerpc/platforms/iseries/dt.c45
-rw-r--r--arch/powerpc/platforms/iseries/hvlpconfig.c13
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c19
-rw-r--r--arch/powerpc/platforms/iseries/it_exp_vpd_panel.h51
-rw-r--r--arch/powerpc/platforms/iseries/it_lp_naca.h80
-rw-r--r--arch/powerpc/platforms/iseries/lpardata.c6
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c2
-rw-r--r--arch/powerpc/platforms/iseries/main_store.h126
-rw-r--r--arch/powerpc/platforms/iseries/pci.c9
-rw-r--r--arch/powerpc/platforms/iseries/setup.c1
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c28
-rw-r--r--arch/powerpc/platforms/iseries/vpdinfo.c22
-rw-r--r--arch/powerpc/platforms/maple/pci.c20
-rw-r--r--arch/powerpc/platforms/maple/setup.c27
-rw-r--r--arch/powerpc/platforms/pasemi/Makefile1
-rw-r--r--arch/powerpc/platforms/pasemi/pasemi.h8
-rw-r--r--arch/powerpc/platforms/pasemi/pci.c198
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c188
-rw-r--r--arch/powerpc/platforms/pasemi/time.c29
-rw-r--r--arch/powerpc/platforms/powermac/backlight.c3
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c23
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c25
-rw-r--r--arch/powerpc/platforms/powermac/feature.c30
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c24
-rw-r--r--arch/powerpc/platforms/powermac/pci.c37
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_base.c2
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_core.c5
-rw-r--r--arch/powerpc/platforms/powermac/setup.c18
-rw-r--r--arch/powerpc/platforms/powermac/smp.c7
-rw-r--r--arch/powerpc/platforms/powermac/udbg_scc.c10
-rw-r--r--arch/powerpc/platforms/pseries/Makefile1
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c12
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c4
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c4
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c2
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S273
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c129
-rw-r--r--arch/powerpc/platforms/pseries/hvconsole.c5
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c13
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c46
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c5
-rw-r--r--arch/powerpc/platforms/pseries/pci.c2
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h107
-rw-r--r--arch/powerpc/platforms/pseries/ras.c4
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c4
-rw-r--r--arch/powerpc/platforms/pseries/setup.c42
-rw-r--r--arch/powerpc/platforms/pseries/smp.c12
-rw-r--r--arch/powerpc/platforms/pseries/xics.c44
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c28
-rw-r--r--arch/powerpc/sysdev/i8259.c2
-rw-r--r--arch/powerpc/sysdev/mmio_nvram.c4
-rw-r--r--arch/powerpc/sysdev/tsi108_pci.c4
-rw-r--r--arch/powerpc/xmon/xmon.c10
-rw-r--r--arch/ppc/Kconfig6
-rw-r--r--arch/ppc/kernel/setup.c17
-rw-r--r--arch/ppc/xmon/start.c28
-rw-r--r--arch/ppc/xmon/xmon.c26
119 files changed, 2025 insertions, 1200 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
420config 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
420config PPC_CELL 431config 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
438config UDBG_RTAS_CONSOLE 449config UDBG_RTAS_CONSOLE
439 bool 450 bool "RTAS based debug console"
451 depends on PPC_RTAS
440 default n 452 default n
441 453
442config XICS 454config 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
21config 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
21config DEBUGGER 35config 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
78config XMON_DEFAULT 94config 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..afc776f821e5 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -41,6 +41,10 @@ src-boot += $(zlib)
41src-boot := $(addprefix $(obj)/, $(src-boot)) 41src-boot := $(addprefix $(obj)/, $(src-boot))
42obj-boot := $(addsuffix .o, $(basename $(src-boot))) 42obj-boot := $(addsuffix .o, $(basename $(src-boot)))
43 43
44ifeq ($(call cc-option-yn, -fstack-protector),y)
45BOOTCFLAGS += -fno-stack-protector
46endif
47
44BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) 48BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
45 49
46quiet_cmd_copy_zlib = COPY $@ 50quiet_cmd_copy_zlib = COPY $@
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 499CONFIG_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..8b3f4faf5768 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 \
16obj-y += vdso32/ 16obj-y += vdso32/
17obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ 17obj-$(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
21obj-$(CONFIG_PPC64) += vdso64/ 21obj-$(CONFIG_PPC64) += vdso64/
22obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o 22obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 7ee84968087b..c578e7ab8173 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -40,9 +40,9 @@
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#endif 46#endif
47 47
48#define DEFINE(sym, val) \ 48#define DEFINE(sym, val) \
@@ -136,11 +136,18 @@ int main(void)
136 DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); 136 DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
137 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); 137 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
138 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 138 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
139 DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
140 DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
139 141
142 DEFINE(SLBSHADOW_STACKVSID,
143 offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid));
144 DEFINE(SLBSHADOW_STACKESID,
145 offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].esid));
140 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); 146 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0));
141 DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1)); 147 DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1));
142 DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); 148 DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int));
143 DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); 149 DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int));
150 DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area));
144#endif /* CONFIG_PPC64 */ 151#endif /* CONFIG_PPC64 */
145 152
146 /* RTAS */ 153 /* RTAS */
@@ -159,6 +166,12 @@ int main(void)
159 /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */ 166 /* 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); 167 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); 168 DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16);
169
170 /* hcall statistics */
171 DEFINE(HCALL_STAT_SIZE, sizeof(struct hcall_stats));
172 DEFINE(HCALL_STAT_CALLS, offsetof(struct hcall_stats, num_calls));
173 DEFINE(HCALL_STAT_TB, offsetof(struct hcall_stats, tb_total));
174 DEFINE(HCALL_STAT_PURR, offsetof(struct hcall_stats, purr_total));
162#endif /* CONFIG_PPC64 */ 175#endif /* CONFIG_PPC64 */
163 DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0])); 176 DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0]));
164 DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1])); 177 DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1]));
@@ -240,6 +253,7 @@ int main(void)
240 DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value)); 253 DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
241 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); 254 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
242 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); 255 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
256 DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
243 257
244#ifndef CONFIG_PPC64 258#ifndef CONFIG_PPC64
245 DEFINE(pbe_address, offsetof(struct pbe, address)); 259 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
215int __init btext_find_display(int allow_nonstdout) 215int __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
381:
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
1291: /* 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
1442:
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
1681: /* 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..db65c9f6559a 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);
39extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec); 39extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
40extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec); 40extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
41#endif /* CONFIG_PPC32 */ 41#endif /* CONFIG_PPC32 */
42#ifdef CONFIG_PPC64
42extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); 43extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
44extern 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,
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}
43EXPORT_SYMBOL(dma_supported); 42EXPORT_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}
74EXPORT_SYMBOL(dma_alloc_coherent); 72EXPORT_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}
86EXPORT_SYMBOL(dma_free_coherent); 83EXPORT_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}
98EXPORT_SYMBOL(dma_map_single); 94EXPORT_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}
110EXPORT_SYMBOL(dma_unmap_single); 105EXPORT_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}
124EXPORT_SYMBOL(dma_map_page); 118EXPORT_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}
136EXPORT_SYMBOL(dma_unmap_page); 129EXPORT_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}
148EXPORT_SYMBOL(dma_map_sg); 140EXPORT_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}
160EXPORT_SYMBOL(dma_unmap_sg); 151EXPORT_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
15394: /* 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
16331: bl .__cpu_preinit_ppc970
16342:
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
17314: li r0,16 /* Use the least common */ 17514: 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
169static struct ibmebus_dev* __devinit ibmebus_register_device_common( 169static 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/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}
879EXPORT_SYMBOL(pci_enable_msi);
878 880
879void pci_disable_msi(struct pci_dev * pdev) 881void 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}
886EXPORT_SYMBOL(pci_disable_msi);
884 887
885void pci_scan_msi_device(struct pci_dev *dev) {} 888void pci_scan_msi_device(struct pci_dev *dev) {}
886int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) {return -1;} 889int 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) {}
888void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} 891void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
889void disable_msi_mode(struct pci_dev *dev, int pos, int type) {} 892void disable_msi_mode(struct pci_dev *dev, int pos, int type) {}
890void pci_no_msi(void) {} 893void pci_no_msi(void) {}
894EXPORT_SYMBOL(pci_enable_msix);
895EXPORT_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,
144static int __init add_legacy_isa_port(struct device_node *np, 145static 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)
285void __init find_legacy_serial_ports(void) 286void __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,
194static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs) 199static 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/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)
189int of_device_register(struct of_device *ofdev) 189int 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
222void of_device_unregister(struct of_device *ofdev) 204void 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 */
53struct 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)
633static void 633static void
634make_one_node_map(struct device_node* node, u8 pci_bus) 634make_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*
737static int 740static int
738scan_OF_pci_childs_iterator(struct device_node* node, void* data) 741scan_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)
841int 844int
842pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) 845pci_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
188static 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
216struct pci_controller * pcibios_alloc_controller(struct device_node *dev) 188struct 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
236void pcibios_free_controller(struct pci_controller *phb) 206void 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
284static u32 get_int_prop(struct device_node *np, const char *name, u32 def) 247static 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", &reglen); 393 reg = get_property(child, "reg", &reglen);
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,
976void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, 940void __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 @@
40static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) 40static 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..b2edac8ddf0a 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -91,6 +91,9 @@ EXPORT_SYMBOL(__copy_tofrom_user);
91EXPORT_SYMBOL(__clear_user); 91EXPORT_SYMBOL(__clear_user);
92EXPORT_SYMBOL(__strncpy_from_user); 92EXPORT_SYMBOL(__strncpy_from_user);
93EXPORT_SYMBOL(__strnlen_user); 93EXPORT_SYMBOL(__strnlen_user);
94#ifdef CONFIG_PPC64
95EXPORT_SYMBOL(copy_4K_page);
96#endif
94 97
95#ifndef __powerpc64__ 98#ifndef __powerpc64__
96EXPORT_SYMBOL(__ide_mm_insl); 99EXPORT_SYMBOL(__ide_mm_insl);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index a1787ffb6319..bf2005b2feb6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -942,11 +942,11 @@ void __init early_init_devtree(void *params)
942int 942int
943prom_n_addr_cells(struct device_node* np) 943prom_n_addr_cells(struct device_node* np)
944{ 944{
945 int* ip; 945 const int *ip;
946 do { 946 do {
947 if (np->parent) 947 if (np->parent)
948 np = np->parent; 948 np = np->parent;
949 ip = (int *) get_property(np, "#address-cells", NULL); 949 ip = get_property(np, "#address-cells", NULL);
950 if (ip != NULL) 950 if (ip != NULL)
951 return *ip; 951 return *ip;
952 } while (np->parent); 952 } while (np->parent);
@@ -958,11 +958,11 @@ EXPORT_SYMBOL(prom_n_addr_cells);
958int 958int
959prom_n_size_cells(struct device_node* np) 959prom_n_size_cells(struct device_node* np)
960{ 960{
961 int* ip; 961 const int* ip;
962 do { 962 do {
963 if (np->parent) 963 if (np->parent)
964 np = np->parent; 964 np = np->parent;
965 ip = (int *) get_property(np, "#size-cells", NULL); 965 ip = get_property(np, "#size-cells", NULL);
966 if (ip != NULL) 966 if (ip != NULL)
967 return *ip; 967 return *ip;
968 } while (np->parent); 968 } while (np->parent);
@@ -1034,7 +1034,7 @@ int device_is_compatible(struct device_node *device, const char *compat)
1034 const char* cp; 1034 const char* cp;
1035 int cplen, l; 1035 int cplen, l;
1036 1036
1037 cp = (char *) get_property(device, "compatible", &cplen); 1037 cp = get_property(device, "compatible", &cplen);
1038 if (cp == NULL) 1038 if (cp == NULL)
1039 return 0; 1039 return 0;
1040 while (cplen > 0) { 1040 while (cplen > 0) {
@@ -1449,7 +1449,7 @@ static int of_finish_dynamic_node(struct device_node *node)
1449{ 1449{
1450 struct device_node *parent = of_get_parent(node); 1450 struct device_node *parent = of_get_parent(node);
1451 int err = 0; 1451 int err = 0;
1452 phandle *ibm_phandle; 1452 const phandle *ibm_phandle;
1453 1453
1454 node->name = get_property(node, "name", NULL); 1454 node->name = get_property(node, "name", NULL);
1455 node->type = get_property(node, "device_type", NULL); 1455 node->type = get_property(node, "device_type", NULL);
@@ -1466,8 +1466,7 @@ static int of_finish_dynamic_node(struct device_node *node)
1466 return -ENODEV; 1466 return -ENODEV;
1467 1467
1468 /* fix up new node's linux_phandle field */ 1468 /* fix up new node's linux_phandle field */
1469 if ((ibm_phandle = (unsigned int *)get_property(node, 1469 if ((ibm_phandle = get_property(node, "ibm,phandle", NULL)))
1470 "ibm,phandle", NULL)))
1471 node->linux_phandle = *ibm_phandle; 1470 node->linux_phandle = *ibm_phandle;
1472 1471
1473out: 1472out:
@@ -1528,7 +1527,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 1527 * Find a property with a given name for a given node
1529 * and return the value. 1528 * and return the value.
1530 */ 1529 */
1531void *get_property(struct device_node *np, const char *name, int *lenp) 1530const void *get_property(struct device_node *np, const char *name, int *lenp)
1532{ 1531{
1533 struct property *pp = of_find_property(np,name,lenp); 1532 struct property *pp = of_find_property(np,name,lenp);
1534 return pp ? pp->value : NULL; 1533 return pp ? pp->value : NULL;
@@ -1658,16 +1657,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
1658 hardid = get_hard_smp_processor_id(cpu); 1657 hardid = get_hard_smp_processor_id(cpu);
1659 1658
1660 for_each_node_by_type(np, "cpu") { 1659 for_each_node_by_type(np, "cpu") {
1661 u32 *intserv; 1660 const u32 *intserv;
1662 unsigned int plen, t; 1661 unsigned int plen, t;
1663 1662
1664 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist 1663 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
1665 * fallback to "reg" property and assume no threads 1664 * fallback to "reg" property and assume no threads
1666 */ 1665 */
1667 intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", 1666 intserv = get_property(np, "ibm,ppc-interrupt-server#s",
1668 &plen); 1667 &plen);
1669 if (intserv == NULL) { 1668 if (intserv == NULL) {
1670 u32 *reg = (u32 *)get_property(np, "reg", NULL); 1669 const u32 *reg = get_property(np, "reg", NULL);
1671 if (reg == NULL) 1670 if (reg == NULL)
1672 continue; 1671 continue;
1673 if (*reg == hardid) { 1672 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 */
2037static void __init fixup_device_tree_chrp(void) 2037static 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
30static void of_dump_addr(const char *s, u32 *addr, int na) 30static 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
38static void of_dump_addr(const char *s, u32 *addr, int na) { } 38static 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
68static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna) 69static 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
96static unsigned int of_bus_default_get_flags(u32 *addr) 98static 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
121static u64 of_bus_pci_map(u32 *addr, u32 *range, int na, int ns, int pna) 123static 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
146static unsigned int of_bus_pci_get_flags(u32 *addr) 148static 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
181static u64 of_bus_isa_map(u32 *addr, u32 *range, int na, int ns, int pna) 183static 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
206static unsigned int of_bus_isa_get_flags(u32 *addr) 208static 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 */
331u64 of_translate_address(struct device_node *dev, u32 *in_addr) 333u64 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}
406EXPORT_SYMBOL(of_translate_address); 408EXPORT_SYMBOL(of_translate_address);
407 409
408u32 *of_get_address(struct device_node *dev, int index, u64 *size, 410const 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}
444EXPORT_SYMBOL(of_get_address); 446EXPORT_SYMBOL(of_get_address);
445 447
446u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, 448const 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}
486EXPORT_SYMBOL(of_get_pci_address); 488EXPORT_SYMBOL(of_get_pci_address);
487 489
488static int __of_address_to_resource(struct device_node *dev, u32 *addrp, 490static 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,
516int of_address_to_resource(struct device_node *dev, int index, 518int 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);
530int of_pci_address_to_resource(struct device_node *dev, int bar, 532int 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}
542EXPORT_SYMBOL_GPL(of_pci_address_to_resource); 544EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
543 545
544void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, 546void 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;
576static struct device_node *of_irq_find_parent(struct device_node *child) 579static 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
642int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, 645int 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);
818static int of_irq_map_oldworld(struct device_node *device, int index, 821static 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,
850int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) 853int 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
247static int ppc_rtas_find_all_sensors(void); 247static int ppc_rtas_find_all_sensors(void);
248static void ppc_rtas_process_sensor(struct seq_file *m, 248static 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);
250static char *ppc_rtas_process_error(int error); 250static char *ppc_rtas_process_error(int error);
251static void get_location_code(struct seq_file *m, 251static void get_location_code(struct seq_file *m,
252 struct individual_sensor *s, char *loc); 252 struct individual_sensor *s, const char *loc);
253static void check_location_string(struct seq_file *m, char *c); 253static void check_location_string(struct seq_file *m, const char *c);
254static void check_location(struct seq_file *m, char *c); 254static void check_location(struct seq_file *m, const char *c);
255 255
256static int __init proc_rtas_init(void) 256static 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
475static int ppc_rtas_find_all_sensors(void) 475static 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
532static void ppc_rtas_process_sensor(struct seq_file *m, 532static 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
685static void check_location(struct seq_file *m, char *c) 685static 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 */
722static void check_location_string(struct seq_file *m, char *c) 722static 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
736static void get_location_code(struct seq_file *m, struct individual_sensor *s, char *loc) 736static 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)
177void rtas_progress(char *s, unsigned short hex) 177void 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
294int rtas_token(const char *service) 296int 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}
302EXPORT_SYMBOL(rtas_token); 304EXPORT_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
58static int of_device_available(struct device_node * dn) 58static 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
179int is_python(struct device_node *dev) 177int 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)
234unsigned long __devinit get_phb_buid (struct device_node *phb) 232unsigned 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)
264static int phb_set_bus_ranges(struct device_node *dev, 262static 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..465e7435efbc 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -304,16 +304,15 @@ struct seq_operations cpuinfo_op = {
304void __init check_for_initrd(void) 304void __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 long *prop;
308 308
309 DBG(" -> check_for_initrd()\n"); 309 DBG(" -> check_for_initrd()\n");
310 310
311 if (of_chosen) { 311 if (of_chosen) {
312 prop = (unsigned long *)get_property(of_chosen, 312 prop = get_property(of_chosen, "linux,initrd-start", NULL);
313 "linux,initrd-start", NULL);
314 if (prop != NULL) { 313 if (prop != NULL) {
315 initrd_start = (unsigned long)__va(*prop); 314 initrd_start = (unsigned long)__va(*prop);
316 prop = (unsigned long *)get_property(of_chosen, 315 prop = get_property(of_chosen,
317 "linux,initrd-end", NULL); 316 "linux,initrd-end", NULL);
318 if (prop != NULL) { 317 if (prop != NULL) {
319 initrd_end = (unsigned long)__va(*prop); 318 initrd_end = (unsigned long)__va(*prop);
@@ -366,15 +365,14 @@ void __init smp_setup_cpu_maps(void)
366 int cpu = 0; 365 int cpu = 0;
367 366
368 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { 367 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
369 int *intserv; 368 const int *intserv;
370 int j, len = sizeof(u32), nthreads = 1; 369 int j, len = sizeof(u32), nthreads = 1;
371 370
372 intserv = (int *)get_property(dn, "ibm,ppc-interrupt-server#s", 371 intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len);
373 &len);
374 if (intserv) 372 if (intserv)
375 nthreads = len / sizeof(int); 373 nthreads = len / sizeof(int);
376 else { 374 else {
377 intserv = (int *) get_property(dn, "reg", NULL); 375 intserv = get_property(dn, "reg", NULL);
378 if (!intserv) 376 if (!intserv)
379 intserv = &cpu; /* assume logical == phys */ 377 intserv = &cpu; /* assume logical == phys */
380 } 378 }
@@ -395,13 +393,12 @@ void __init smp_setup_cpu_maps(void)
395 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && 393 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
396 (dn = of_find_node_by_path("/rtas"))) { 394 (dn = of_find_node_by_path("/rtas"))) {
397 int num_addr_cell, num_size_cell, maxcpus; 395 int num_addr_cell, num_size_cell, maxcpus;
398 unsigned int *ireg; 396 const unsigned int *ireg;
399 397
400 num_addr_cell = prom_n_addr_cells(dn); 398 num_addr_cell = prom_n_addr_cells(dn);
401 num_size_cell = prom_n_size_cells(dn); 399 num_size_cell = prom_n_size_cells(dn);
402 400
403 ireg = (unsigned int *) 401 ireg = get_property(dn, "ibm,lrdr-capacity", NULL);
404 get_property(dn, "ibm,lrdr-capacity", NULL);
405 402
406 if (!ireg) 403 if (!ireg)
407 goto out; 404 goto out;
@@ -444,6 +441,8 @@ void __init smp_setup_cpu_maps(void)
444 441
445int __initdata do_early_xmon; 442int __initdata do_early_xmon;
446#ifdef CONFIG_XMON 443#ifdef CONFIG_XMON
444extern int xmon_no_auto_backtrace;
445
447static int __init early_xmon(char *p) 446static int __init early_xmon(char *p)
448{ 447{
449 /* ensure xmon is enabled */ 448 /* ensure xmon is enabled */
@@ -452,6 +451,8 @@ static int __init early_xmon(char *p)
452 xmon_init(1); 451 xmon_init(1);
453 if (strncmp(p, "off", 3) == 0) 452 if (strncmp(p, "off", 3) == 0)
454 xmon_init(0); 453 xmon_init(0);
454 if (strncmp(p, "nobt", 4) == 0)
455 xmon_no_auto_backtrace = 1;
455 if (strncmp(p, "early", 5) != 0) 456 if (strncmp(p, "early", 5) != 0)
456 return 0; 457 return 0;
457 } 458 }
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 */
81struct ppc64_caches ppc64_caches = { 80struct 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};
87EXPORT_SYMBOL_GPL(ppc64_caches); 86EXPORT_SYMBOL_GPL(ppc64_caches);
88 87
@@ -107,7 +106,7 @@ static int smt_enabled_cmdline;
107static void check_smt_enabled(void) 106static 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;
60static int __init smt_setup(void) 60static 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..b9a2061cfdb7 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -860,14 +860,14 @@ EXPORT_SYMBOL(do_settimeofday);
860static int __init get_freq(char *name, int cells, unsigned long *val) 860static 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 = 0;
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
601static int emulate_string_inst(struct pt_regs *regs, u32 instword) 604static 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
672static 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
669static int emulate_instruction(struct pt_regs *regs) 689static 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)
217struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) 217struct 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 */
494struct vio_dev *vio_find_node(struct device_node *vnode) 494struct 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
14obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \ 14obj-$(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
17obj-$(CONFIG_PPC_ISERIES) += e2a.o
18obj-$(CONFIG_XMON) += sstep.o 17obj-$(CONFIG_XMON) += sstep.o
19 18
20ifeq ($(CONFIG_PPC64),y) 19ifeq ($(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
26unsigned 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}
104EXPORT_SYMBOL(e2a);
105
106unsigned 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/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 */
189static int *of_get_associativity(struct device_node *dev) 188static 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)
197static int of_node_to_nid_single(struct device_node *device) 196static 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);
255static int __init find_min_common_depth(void) 254static 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
300static unsigned long __devinit read_n_cells(int n, unsigned int **buf) 299static 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
53static inline void create_slbe(unsigned long ea, unsigned long flags, 55static 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
70static 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/
13obj-$(CONFIG_PPC_PSERIES) += pseries/ 13obj-$(CONFIG_PPC_PSERIES) += pseries/
14obj-$(CONFIG_PPC_ISERIES) += iseries/ 14obj-$(CONFIG_PPC_ISERIES) += iseries/
15obj-$(CONFIG_PPC_MAPLE) += maple/ 15obj-$(CONFIG_PPC_MAPLE) += maple/
16obj-$(CONFIG_PPC_PASEMI) += pasemi/
16obj-$(CONFIG_PPC_CELL) += cell/ 17obj-$(CONFIG_PPC_CELL) += cell/
17obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/ 18obj-$(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 */
90static unsigned int iic_get_irq(struct pt_regs *regs) 90static 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
309static void iommu_devnode_setup(struct device_node *d) 309static 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
372static int cell_map_iommu(void) 373static 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 */
58static cpumask_t of_spin_map; 58static cpumask_t of_spin_map;
59 59
60extern void pSeries_secondary_smp_init(unsigned long); 60extern 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,
240static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) 240static 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
489static int __init find_spu_node_id(struct device_node *spe) 489static 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,
531static void __iomem * __init map_spe_prop(struct spu *spu, 531static 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
594static int __init spu_map_device(struct spu *spu, struct device_node *node) 594static 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)
67void __init chrp_nvram_init(void) 67void __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
214chrp_find_bridges(void) 214chrp_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 */
327void 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}
345DECLARE_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
75extern unsigned long loops_per_jiffy; 75extern unsigned long loops_per_jiffy;
76 76
77/* To be replaced by RTAS when available */
78static unsigned int *briq_SPOR;
79
77#ifdef CONFIG_SMP 80#ifdef CONFIG_SMP
78extern struct smp_ops_t chrp_smp_ops; 81extern 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
98static const char *chrp_names[] = {
99 "Unknown",
100 "","","",
101 "Motorola",
102 "IBM or Longtrail",
103 "Genesi Pegasos",
104 "Total Impact Briq"
105};
106
95void chrp_show_cpuinfo(struct seq_file *m) 107void 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
243static void briq_restart(char *cmd)
244{
245 local_irq_disable();
246 if (briq_SPOR)
247 out_be32(briq_SPOR, 0);
248 for(;;);
249}
250
232void __init chrp_setup_arch(void) 251void __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
502chrp_init2(void) 525chrp_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
5config VIOCONS 5config 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
8config VIODASD 12config 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
14config VIOCD 18config 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";
76static char __initdata device_type_vdevice[] = "vdevice"; 77static char __initdata device_type_vdevice[] = "vdevice";
77static char __initdata device_type_vscsi[] = "vscsi"; 78static char __initdata device_type_vscsi[] = "vscsi";
78 79
80
81/* EBCDIC to ASCII conversion routines */
82
83static 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
104static 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
79static struct iseries_flat_dt * __init dt_init(void) 117static 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
22HvLpIndex HvLpConfig_getLpIndex_outline(void) 23HvLpIndex HvLpConfig_getLpIndex_outline(void)
23{ 24{
24 return HvLpConfig_getLpIndex(); 25 return HvLpConfig_getLpIndex();
25} 26}
26EXPORT_SYMBOL(HvLpConfig_getLpIndex_outline); 27EXPORT_SYMBOL(HvLpConfig_getLpIndex_outline);
28
29HvLpIndex HvLpConfig_getLpIndex(void)
30{
31 return itLpNaca.xLpIndex;
32}
33EXPORT_SYMBOL(HvLpConfig_getLpIndex);
34
35HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
36{
37 return itLpNaca.xPrimaryLpIndex;
38}
39EXPORT_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 */
93struct 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
30struct 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
49extern 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
28struct 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
73extern 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};
130EXPORT_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 */
133struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data"))); 132struct 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 */
136struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data"))); 135struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data")));
137EXPORT_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 */
64struct IoHriMainStoreChipInfo1 { 64struct __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
69struct IoHriMainStoreVpdIdData { 69struct IoHriMainStoreVpdIdData {
@@ -73,72 +73,72 @@ struct IoHriMainStoreVpdIdData {
73 char serialNumber[12]; 73 char serialNumber[12];
74}; 74};
75 75
76struct IoHriMainStoreVpdFruData { 76struct __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
83struct IoHriMainStoreAdrRangeBlock { 83struct __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
91struct IoHriMainStoreArea4 { 91struct __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..f4d427a7bb2d 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -176,12 +176,12 @@ void iSeries_pcibios_init(void)
176 } 176 }
177 while ((node = of_get_next_child(root, node)) != NULL) { 177 while ((node = of_get_next_child(root, node)) != NULL) {
178 HvBusNumber bus; 178 HvBusNumber bus;
179 u32 *busp; 179 const u32 *busp;
180 180
181 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) 181 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
182 continue; 182 continue;
183 183
184 busp = (u32 *)get_property(node, "bus-range", NULL); 184 busp = get_property(node, "bus-range", NULL);
185 if (busp == NULL) 185 if (busp == NULL)
186 continue; 186 continue;
187 bus = *busp; 187 bus = *busp;
@@ -221,10 +221,9 @@ void __init iSeries_pci_final_fixup(void)
221 221
222 if (node != NULL) { 222 if (node != NULL) {
223 struct pci_dn *pdn = PCI_DN(node); 223 struct pci_dn *pdn = PCI_DN(node);
224 u32 *agent; 224 const u32 *agent;
225 225
226 agent = (u32 *)get_property(node, "linux,agent-id", 226 agent = get_property(node, "linux,agent-id", NULL);
227 NULL);
228 if ((pdn != NULL) && (agent != NULL)) { 227 if ((pdn != NULL) && (agent != NULL)) {
229 u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, 228 u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
230 pdn->bussubno); 229 pdn->bussubno);
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
208static void __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent, 208static 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;
231out_free: 233out_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..dc05af5156a9 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;
38static int __init fixup_one_level_bus_range(struct device_node *node, int higher) 38static 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,16 +65,18 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher
65 */ 65 */
66static void __init fixup_bus_range(struct device_node *bridge) 66static 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
@@ -314,12 +316,12 @@ static int __init add_bridge(struct device_node *dev)
314 int len; 316 int len;
315 struct pci_controller *hose; 317 struct pci_controller *hose;
316 char* disp_name; 318 char* disp_name;
317 int *bus_range; 319 const int *bus_range;
318 int primary = 1; 320 int primary = 1;
319 321
320 DBG("Adding PCI host bridge %s\n", dev->full_name); 322 DBG("Adding PCI host bridge %s\n", dev->full_name);
321 323
322 bus_range = (int *) get_property(dev, "bus-range", &len); 324 bus_range = get_property(dev, "bus-range", &len);
323 if (bus_range == NULL || len < 2 * sizeof(int)) { 325 if (bus_range == NULL || len < 2 * sizeof(int)) {
324 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 326 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
325 dev->full_name); 327 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)
99static void maple_restart(char *cmd) 99static 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)
129static void maple_power_off(void) 126static 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)
211static void __init maple_init_IRQ(void) 205static 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
4extern unsigned long pas_get_boot_time(void);
5extern void pas_pci_init(void);
6extern 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
38static 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
44static 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
78static 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
114static struct pci_ops pa_pxp_ops = {
115 pa_pxp_read_config,
116 pa_pxp_write_config,
117};
118
119static 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
125static 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
151void __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
159static 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
174void __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
41static void pas_restart(char *cmd)
42{
43 printk("restart unimplemented, looping...\n");
44 for (;;) ;
45}
46
47static void pas_power_off(void)
48{
49 printk("power off unimplemented, looping...\n");
50 for (;;) ;
51}
52
53static void pas_halt(void)
54{
55 pas_power_off();
56}
57
58#ifdef CONFIG_SMP
59struct 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
69void __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
85static void iommu_dev_setup_null(struct pci_dev *dev) { }
86static void iommu_bus_setup_null(struct pci_bus *bus) { }
87
88static 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 */
97static int pas_check_legacy_ioport(unsigned int baseport)
98{
99 return -ENODEV;
100}
101
102static __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
152static 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 */
161static 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
173define_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
25unsigned 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
422static u32 read_gpio(struct device_node *np) 422static 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)
611static int pmac_cpufreq_init_750FX(struct device_node *cpunode) 611static 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)
650static int __init pmac_cpufreq_setup(void) 651static 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..167cd3ce8a13 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -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)
541static int __init g5_pm72_cpufreq_init(struct device_node *cpus) 541static 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 */
2537static void __init probe_uninorth(void) 2537static 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
2695initial_serial_shutdown(struct device_node *np) 2695initial_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,
477static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) 477static 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
972u8 pmac_i2c_get_dev_addr(struct device_node *device) 972u8 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];
66static int __init fixup_one_level_bus_range(struct device_node *node, int higher) 66static 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 */
94static void __init fixup_bus_range(struct device_node *bridge) 94static 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 =
237static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) 239static 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;
116static void pmac_show_cpuinfo(struct seq_file *m) 116static 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)
277static void __init pmac_setup_arch(void) 275static 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
69void udbg_scc_init(int force_scc) 69void 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
13obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o 13obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
14obj-$(CONFIG_HVCS) += hvcserver.o 14obj-$(CONFIG_HVCS) += hvcserver.o
15obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 32eaddfa5470..5a23ce5e16ff 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -691,11 +691,11 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
691{ 691{
692 struct eeh_early_enable_info *info = data; 692 struct eeh_early_enable_info *info = data;
693 int ret; 693 int ret;
694 char *status = get_property(dn, "status", NULL); 694 const char *status = get_property(dn, "status", NULL);
695 u32 *class_code = (u32 *)get_property(dn, "class-code", NULL); 695 const u32 *class_code = get_property(dn, "class-code", NULL);
696 u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", NULL); 696 const u32 *vendor_id = get_property(dn, "vendor-id", NULL);
697 u32 *device_id = (u32 *)get_property(dn, "device-id", NULL); 697 const u32 *device_id = get_property(dn, "device-id", NULL);
698 u32 *regs; 698 const u32 *regs;
699 int enable; 699 int enable;
700 struct pci_dn *pdn = PCI_DN(dn); 700 struct pci_dn *pdn = PCI_DN(dn);
701 701
@@ -737,7 +737,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
737 737
738 /* Ok... see if this device supports EEH. Some do, some don't, 738 /* 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. */ 739 * and the only way to find out is to check each and every one. */
740 regs = (u32 *)get_property(dn, "reg", NULL); 740 regs = get_property(dn, "reg", NULL);
741 if (regs) { 741 if (regs) {
742 /* First register entry is addr (00BBSS00) */ 742 /* First register entry is addr (00BBSS00) */
743 /* Try to enable eeh */ 743 /* Try to enable eeh */
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index aaad2c0afcbf..3269d2cd428b 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -268,14 +268,14 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
268 268
269 if (!frozen_dn) { 269 if (!frozen_dn) {
270 270
271 location = (char *) get_property(event->dn, "ibm,loc-code", NULL); 271 location = get_property(event->dn, "ibm,loc-code", NULL);
272 location = location ? location : "unknown"; 272 location = location ? location : "unknown";
273 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " 273 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
274 "for location=%s pci addr=%s\n", 274 "for location=%s pci addr=%s\n",
275 location, pci_name(event->dev)); 275 location, pci_name(event->dev));
276 return NULL; 276 return NULL;
277 } 277 }
278 location = (char *) get_property(frozen_dn, "ibm,loc-code", NULL); 278 location = get_property(frozen_dn, "ibm,loc-code", NULL);
279 location = location ? location : "unknown"; 279 location = location ? location : "unknown";
280 280
281 /* There are two different styles for coming up with the PE. 281 /* There are two different styles for coming up with the PE.
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] = {
68void __init fw_feature_init(void) 68void __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 26BEGIN_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) 29END_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) 42BEGIN_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 */ \
46END_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); \
65BEGIN_FTR_SECTION; \
66 ld r7,HCALL_STAT_PURR(r4); /* PURR */ \
67 add r7,r7,r6; \
68 std r7,HCALL_STAT_PURR(r4); \
69END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
701:
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
30DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats);
31
32/*
33 * Routines for displaying the statistics in debugfs
34 */
35static 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
43static void *hc_next(struct seq_file *m, void *p, loff_t * pos)
44{
45 ++*pos;
46
47 return hc_start(m, pos);
48}
49
50static void hc_stop(struct seq_file *m, void *p)
51{
52}
53
54static 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
74static 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
81static 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
93static 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
103static 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,
315static void iommu_table_setparms_lpar(struct pci_controller *phb, 314static 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 */
52EXPORT_SYMBOL(plpar_hcall); 52EXPORT_SYMBOL(plpar_hcall);
53EXPORT_SYMBOL(plpar_hcall_4out); 53EXPORT_SYMBOL(plpar_hcall9);
54EXPORT_SYMBOL(plpar_hcall_norets); 54EXPORT_SYMBOL(plpar_hcall_norets);
55EXPORT_SYMBOL(plpar_hcall_8arg_2ret); 55
56EXPORT_SYMBOL(plpar_hcall_7arg_7ret);
57EXPORT_SYMBOL(plpar_hcall_9arg_9ret);
58extern void pSeries_find_serial_port(void); 56extern void pSeries_find_serial_port(void);
59 57
60 58
@@ -204,20 +202,20 @@ void __init udbg_init_debug_lpar(void)
204void __init find_udbg_vterm(void) 202void __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:
254void vpa_init(int cpu) 252void 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
271long pSeries_lpar_hpte_insert(unsigned long hpte_group, 285long 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)
123int __init pSeries_nvram_init(void) 123int __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);
60static void __devinit check_s7a(void) 60static 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
6static inline long poll_pending(void) 6static 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
12static inline long prod_processor(void) 11static 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
18static inline long cede_processor(void) 16static 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
24static inline long vpa_call(unsigned long flags, unsigned long cpu, 21static 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
40static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa)
41{
42 return vpa_call(0x7, cpu, vpa);
43}
44
45static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
46{
47 return vpa_call(0x3, cpu, vpa);
48}
49
43extern void vpa_init(int cpu); 50extern void vpa_init(int cpu);
44 51
52static 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
45static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex, 66static 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
54static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, 81static 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
62static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, 95static 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,
68static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba, 101static 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
76static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba, 114static 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,
94static inline long plpar_get_term_char(unsigned long termno, 132static 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
102static inline long plpar_put_term_char(unsigned long termno, unsigned long len, 148static 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
156static inline long plpar_eoi(unsigned long xirr)
157{
158 return plpar_hcall_norets(H_EOI, xirr);
159}
160
161static inline long plpar_cppr(unsigned long cppr)
162{
163 return plpar_hcall_norets(H_CPPR, cppr);
164}
165
166static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr)
167{
168 return plpar_hcall_norets(H_IPI, servernum, mfrr);
169}
170
171static 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)
359static int get_eventscan_parms(void) 359static 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,
133static void __init pseries_mpic_init_IRQ(void) 133static 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
226static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary) 226static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
227{
228 mpic_teardown_this_cpu(secondary);
229}
230
231static 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
248static 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
254static 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)
247static void __init pseries_discover_pic(void) 261static 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 */
63static cpumask_t of_spin_map; 63static cpumask_t of_spin_map;
64 64
65extern void pSeries_secondary_smp_init(unsigned long); 65extern 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
113static inline long plpar_eoi(unsigned long xirr)
114{
115 return plpar_hcall_norets(H_EOI, xirr);
116}
117
118static inline long plpar_cppr(unsigned long cppr)
119{
120 return plpar_hcall_norets(H_CPPR, cppr);
121}
122
123static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr)
124{
125 return plpar_hcall_norets(H_IPI, servernum, mfrr);
126}
127
128static 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
134static inline unsigned int lpar_xirr_info_get(int n_cpu) 114static 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:
355arch_initcall(mpc83xx_wdt_init); 355arch_initcall(mpc83xx_wdt_init);
356#endif 356#endif
357 357
358static enum fsl_usb2_phy_modes determine_usb_phy(char * phy_type) 358static 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/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/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)
80int __init mmio_nvram_init(void) 80int __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);
137static void proccall(void); 137static void proccall(void);
138void dump_segments(void); 138void dump_segments(void);
139static void symbol_lookup(void); 139static void symbol_lookup(void);
140static void xmon_show_stack(unsigned long sp, unsigned long lr,
141 unsigned long pc);
140static void xmon_print_symbol(unsigned long address, const char *mid, 142static void xmon_print_symbol(unsigned long address, const char *mid,
141 const char *after); 143 const char *after);
142static const char *getvecname(unsigned long vec); 144static const char *getvecname(unsigned long vec);
143 145
146int xmon_no_auto_backtrace;
147
144extern int print_insn_powerpc(unsigned long, unsigned long, int); 148extern int print_insn_powerpc(unsigned long, unsigned long, int);
145 149
146extern void xmon_enter(void); 150extern 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());
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index a04cdf01596b..8fa10cf661a8 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -1204,7 +1204,7 @@ config PCI_DOMAINS
1204 default PCI 1204 default PCI
1205 1205
1206config MPC83xx_PCI2 1206config MPC83xx_PCI2
1207 bool " Supprt for 2nd PCI host controller" 1207 bool "Support for 2nd PCI host controller"
1208 depends on PCI && MPC834x 1208 depends on PCI && MPC834x
1209 default y if MPC834x_SYS 1209 default y if MPC834x_SYS
1210 1210
@@ -1223,12 +1223,12 @@ config PCI_8260
1223 default y 1223 default y
1224 1224
1225config 8260_PCI9 1225config 8260_PCI9
1226 bool " Enable workaround for MPC826x erratum PCI 9" 1226 bool "Enable workaround for MPC826x erratum PCI 9"
1227 depends on PCI_8260 && !ADS8272 1227 depends on PCI_8260 && !ADS8272
1228 default y 1228 default y
1229 1229
1230choice 1230choice
1231 prompt " IDMA channel for PCI 9 workaround" 1231 prompt "IDMA channel for PCI 9 workaround"
1232 depends on 8260_PCI9 1232 depends on 8260_PCI9
1233 1233
1234config 8260_PCI9_IDMA1 1234config 8260_PCI9_IDMA1
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index a74f46d9826f..5458ac5da7c3 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -127,11 +127,8 @@ void machine_restart(char *cmd)
127 ppc_md.restart(cmd); 127 ppc_md.restart(cmd);
128} 128}
129 129
130void machine_power_off(void) 130static void ppc_generic_power_off(void)
131{ 131{
132#ifdef CONFIG_NVRAM
133 nvram_sync();
134#endif
135 ppc_md.power_off(); 132 ppc_md.power_off();
136} 133}
137 134
@@ -143,7 +140,17 @@ void machine_halt(void)
143 ppc_md.halt(); 140 ppc_md.halt();
144} 141}
145 142
146void (*pm_power_off)(void) = machine_power_off; 143void (*pm_power_off)(void) = ppc_generic_power_off;
144
145void machine_power_off(void)
146{
147#ifdef CONFIG_NVRAM
148 nvram_sync();
149#endif
150 if (pm_power_off)
151 pm_power_off();
152 ppc_generic_power_off();
153}
147 154
148#ifdef CONFIG_TAU 155#ifdef CONFIG_TAU
149extern u32 cpu_temp(unsigned long cpu); 156extern u32 cpu_temp(unsigned long cpu);
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
index f7e92986952a..d74a883e5bde 100644
--- a/arch/ppc/xmon/start.c
+++ b/arch/ppc/xmon/start.c
@@ -15,6 +15,7 @@
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/delay.h> 16#include <asm/delay.h>
17#include <asm/btext.h> 17#include <asm/btext.h>
18#include <asm/ibm4xx.h>
18 19
19static volatile unsigned char *sccc, *sccd; 20static volatile unsigned char *sccc, *sccd;
20unsigned int TXRDY, RXRDY, DLAB; 21unsigned int TXRDY, RXRDY, DLAB;
@@ -57,23 +58,30 @@ static struct sysrq_key_op sysrq_xmon_op =
57void 58void
58xmon_map_scc(void) 59xmon_map_scc(void)
59{ 60{
60#ifdef CONFIG_PPC_PREP 61#if defined(CONFIG_GEMINI)
61 volatile unsigned char *base;
62
63#elif defined(CONFIG_GEMINI)
64 /* should already be mapped by the kernel boot */ 62 /* should already be mapped by the kernel boot */
65 sccc = (volatile unsigned char *) 0xffeffb0d;
66 sccd = (volatile unsigned char *) 0xffeffb08; 63 sccd = (volatile unsigned char *) 0xffeffb08;
67 TXRDY = 0x20;
68 RXRDY = 1;
69 DLAB = 0x80;
70#elif defined(CONFIG_405GP) 64#elif defined(CONFIG_405GP)
71 sccc = (volatile unsigned char *)0xef600305;
72 sccd = (volatile unsigned char *)0xef600300; 65 sccd = (volatile unsigned char *)0xef600300;
66#elif defined(CONFIG_440EP)
67 sccd = (volatile unsigned char *) ioremap(PPC440EP_UART0_ADDR, 8);
68#elif defined(CONFIG_440SP)
69 sccd = (volatile unsigned char *) ioremap64(PPC440SP_UART0_ADDR, 8);
70#elif defined(CONFIG_440SPE)
71 sccd = (volatile unsigned char *) ioremap64(PPC440SPE_UART0_ADDR, 8);
72#elif defined(CONFIG_44x)
73 /* This is the default for 44x platforms. Any boards that have a
74 different UART address need to be put in cases before this or the
75 port will be mapped incorrectly */
76 sccd = (volatile unsigned char *) ioremap64(PPC440GP_UART0_ADDR, 8);
77#endif /* platform */
78
79#ifndef CONFIG_PPC_PREP
80 sccc = sccd + 5;
73 TXRDY = 0x20; 81 TXRDY = 0x20;
74 RXRDY = 1; 82 RXRDY = 1;
75 DLAB = 0x80; 83 DLAB = 0x80;
76#endif /* platform */ 84#endif
77 85
78 register_sysrq_key('x', &sysrq_xmon_op); 86 register_sysrq_key('x', &sysrq_xmon_op);
79} 87}
diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c
index 37d234f93394..25d032b2aec7 100644
--- a/arch/ppc/xmon/xmon.c
+++ b/arch/ppc/xmon/xmon.c
@@ -153,6 +153,12 @@ static int xmon_trace[NR_CPUS];
153#define SSTEP 1 /* stepping because of 's' command */ 153#define SSTEP 1 /* stepping because of 's' command */
154#define BRSTEP 2 /* stepping over breakpoint */ 154#define BRSTEP 2 /* stepping over breakpoint */
155 155
156#ifdef CONFIG_4xx
157#define MSR_SSTEP_ENABLE 0x200
158#else
159#define MSR_SSTEP_ENABLE 0x400
160#endif
161
156static struct pt_regs *xmon_regs[NR_CPUS]; 162static struct pt_regs *xmon_regs[NR_CPUS];
157 163
158extern inline void sync(void) 164extern inline void sync(void)
@@ -211,6 +217,14 @@ static void get_tb(unsigned *p)
211 p[1] = lo; 217 p[1] = lo;
212} 218}
213 219
220static inline void xmon_enable_sstep(struct pt_regs *regs)
221{
222 regs->msr |= MSR_SSTEP_ENABLE;
223#ifdef CONFIG_4xx
224 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
225#endif
226}
227
214int xmon(struct pt_regs *excp) 228int xmon(struct pt_regs *excp)
215{ 229{
216 struct pt_regs regs; 230 struct pt_regs regs;
@@ -254,10 +268,10 @@ int xmon(struct pt_regs *excp)
254 cmd = cmds(excp); 268 cmd = cmds(excp);
255 if (cmd == 's') { 269 if (cmd == 's') {
256 xmon_trace[smp_processor_id()] = SSTEP; 270 xmon_trace[smp_processor_id()] = SSTEP;
257 excp->msr |= 0x400; 271 xmon_enable_sstep(excp);
258 } else if (at_breakpoint(excp->nip)) { 272 } else if (at_breakpoint(excp->nip)) {
259 xmon_trace[smp_processor_id()] = BRSTEP; 273 xmon_trace[smp_processor_id()] = BRSTEP;
260 excp->msr |= 0x400; 274 xmon_enable_sstep(excp);
261 } else { 275 } else {
262 xmon_trace[smp_processor_id()] = 0; 276 xmon_trace[smp_processor_id()] = 0;
263 insert_bpts(); 277 insert_bpts();
@@ -298,7 +312,7 @@ xmon_bpt(struct pt_regs *regs)
298 remove_bpts(); 312 remove_bpts();
299 excprint(regs); 313 excprint(regs);
300 xmon_trace[smp_processor_id()] = BRSTEP; 314 xmon_trace[smp_processor_id()] = BRSTEP;
301 regs->msr |= 0x400; 315 xmon_enable_sstep(regs);
302 } else { 316 } else {
303 xmon(regs); 317 xmon(regs);
304 } 318 }
@@ -385,7 +399,7 @@ insert_bpts(void)
385 } 399 }
386 store_inst((void *) bp->address); 400 store_inst((void *) bp->address);
387 } 401 }
388#if !defined(CONFIG_8xx) 402#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
389 if (dabr.enabled) 403 if (dabr.enabled)
390 set_dabr(dabr.address); 404 set_dabr(dabr.address);
391 if (iabr.enabled) 405 if (iabr.enabled)
@@ -400,7 +414,7 @@ remove_bpts(void)
400 struct bpt *bp; 414 struct bpt *bp;
401 unsigned instr; 415 unsigned instr;
402 416
403#if !defined(CONFIG_8xx) 417#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
404 set_dabr(0); 418 set_dabr(0);
405 set_iabr(0); 419 set_iabr(0);
406#endif 420#endif
@@ -677,7 +691,7 @@ bpt_cmds(void)
677 691
678 cmd = inchar(); 692 cmd = inchar();
679 switch (cmd) { 693 switch (cmd) {
680#if !defined(CONFIG_8xx) 694#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
681 case 'd': 695 case 'd':
682 mode = 7; 696 mode = 7;
683 cmd = inchar(); 697 cmd = inchar();