aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-30 11:10:12 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-30 11:10:12 -0400
commit24a77daf3d80bddcece044e6dc3675e427eef3f3 (patch)
tree2c5e0b0bea394d6fe62c5d5857c252e83e48ac48 /arch/powerpc
parente389f9aec689209724105ae80a6c91fd2e747bc9 (diff)
parentf900e9777fc9b65140cb9570438597bc8fae56ab (diff)
Merge branch 'for-2.6.22' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'for-2.6.22' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (255 commits) [POWERPC] Remove dev_dbg redefinition in drivers/ps3/vuart.c [POWERPC] remove kernel module option for booke wdt [POWERPC] Avoid putting cpu node twice [POWERPC] Spinlock initializer cleanup [POWERPC] ppc4xx_sgdma needs dma-mapping.h [POWERPC] arch/powerpc/sysdev/timer.c build fix [POWERPC] get_property cleanups [POWERPC] Remove the unused HTDMSOUND driver [POWERPC] cell: cbe_cpufreq cleanup and crash fix [POWERPC] Declare enable_kernel_spe in a header [POWERPC] Add dt_xlate_addr() to bootwrapper [POWERPC] bootwrapper: CONFIG_ -> CONFIG_DEVICE_TREE [POWERPC] Don't define a custom bd_t for Xilixn Virtex based boards. [POWERPC] Add sane defaults for Xilinx EDK generated xparameters files [POWERPC] Add uartlite boot console driver for the zImage wrapper [POWERPC] Stop using ppc_sys for Xilinx Virtex boards [POWERPC] New registration for common Xilinx Virtex ppc405 platform devices [POWERPC] Merge common virtex header files [POWERPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform [POWERPC] Clean up cpufreq Kconfig dependencies ...
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig472
-rw-r--r--arch/powerpc/Kconfig.debug12
-rw-r--r--arch/powerpc/Makefile11
-rw-r--r--arch/powerpc/boot/.gitignore3
-rw-r--r--arch/powerpc/boot/Makefile122
-rw-r--r--arch/powerpc/boot/crt0.S37
-rw-r--r--arch/powerpc/boot/cuboot-83xx.c68
-rw-r--r--arch/powerpc/boot/cuboot-85xx.c69
-rw-r--r--arch/powerpc/boot/devtree.c307
-rw-r--r--arch/powerpc/boot/dts/kuroboxHD.dts7
-rw-r--r--arch/powerpc/boot/dts/kuroboxHG.dts7
-rw-r--r--arch/powerpc/boot/dts/lite5200.dts1
-rw-r--r--arch/powerpc/boot/dts/lite5200b.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc7448hpc2.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8272ads.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8313erdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc832x_rdb.dts291
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitxgp.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8540ads.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8541cds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts136
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8555cds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8560ads.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8568mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8641_hpcn.dts25
-rw-r--r--arch/powerpc/boot/dts/mpc866ads.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc885ads.dts1
-rw-r--r--arch/powerpc/boot/elf.h8
-rw-r--r--arch/powerpc/boot/elf_util.c76
-rw-r--r--arch/powerpc/boot/flatdevtree.c199
-rw-r--r--arch/powerpc/boot/flatdevtree.h7
-rw-r--r--arch/powerpc/boot/flatdevtree_misc.c42
-rw-r--r--arch/powerpc/boot/gunzip_util.c206
-rw-r--r--arch/powerpc/boot/gunzip_util.h45
-rw-r--r--arch/powerpc/boot/main.c369
-rw-r--r--arch/powerpc/boot/ns16550.c9
-rw-r--r--arch/powerpc/boot/of.c21
-rw-r--r--arch/powerpc/boot/ops.h103
-rw-r--r--arch/powerpc/boot/ppcboot.h108
-rw-r--r--arch/powerpc/boot/reg.h22
-rw-r--r--arch/powerpc/boot/simple_alloc.c31
-rw-r--r--arch/powerpc/boot/stdio.h5
-rwxr-xr-xarch/powerpc/boot/wrapper53
-rw-r--r--arch/powerpc/boot/zImage.coff.lds.S3
-rw-r--r--arch/powerpc/boot/zImage.lds.S1
-rw-r--r--arch/powerpc/configs/cell_defconfig57
-rw-r--r--arch/powerpc/configs/g5_defconfig2
-rw-r--r--arch/powerpc/configs/maple_defconfig2
-rw-r--r--arch/powerpc/configs/mpc832x_rdb_defconfig1292
-rw-r--r--arch/powerpc/configs/mpc8544_ds_defconfig1077
-rw-r--r--arch/powerpc/configs/ppc64_defconfig2
-rw-r--r--arch/powerpc/kernel/Makefile4
-rw-r--r--arch/powerpc/kernel/align.c56
-rw-r--r--arch/powerpc/kernel/asm-offsets.c2
-rw-r--r--arch/powerpc/kernel/btext.c22
-rw-r--r--arch/powerpc/kernel/cpu_setup_pa6t.S2
-rw-r--r--arch/powerpc/kernel/cputable.c14
-rw-r--r--arch/powerpc/kernel/entry_32.S1
-rw-r--r--arch/powerpc/kernel/head_64.S16
-rw-r--r--arch/powerpc/kernel/ibmebus.c288
-rw-r--r--arch/powerpc/kernel/iommu.c35
-rw-r--r--arch/powerpc/kernel/irq.c2
-rw-r--r--arch/powerpc/kernel/kprobes.c36
-rw-r--r--arch/powerpc/kernel/legacy_serial.c24
-rw-r--r--arch/powerpc/kernel/lparcfg.c58
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c14
-rw-r--r--arch/powerpc/kernel/misc_32.S4
-rw-r--r--arch/powerpc/kernel/of_device.c112
-rw-r--r--arch/powerpc/kernel/of_platform.c5
-rw-r--r--arch/powerpc/kernel/pci_32.c42
-rw-r--r--arch/powerpc/kernel/pci_64.c32
-rw-r--r--arch/powerpc/kernel/pci_dn.c9
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c1
-rw-r--r--arch/powerpc/kernel/process.c54
-rw-r--r--arch/powerpc/kernel/prom.c167
-rw-r--r--arch/powerpc/kernel/prom_init.c55
-rw-r--r--arch/powerpc/kernel/prom_parse.c51
-rw-r--r--arch/powerpc/kernel/rtas-proc.c4
-rw-r--r--arch/powerpc/kernel/rtas.c19
-rw-r--r--arch/powerpc/kernel/rtas_pci.c14
-rw-r--r--arch/powerpc/kernel/setup-common.c68
-rw-r--r--arch/powerpc/kernel/setup_32.c17
-rw-r--r--arch/powerpc/kernel/setup_64.c11
-rw-r--r--arch/powerpc/kernel/smp.c4
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c4
-rw-r--r--arch/powerpc/kernel/sysfs.c17
-rw-r--r--arch/powerpc/kernel/time.c2
-rw-r--r--arch/powerpc/kernel/traps.c76
-rw-r--r--arch/powerpc/kernel/vio.c17
-rw-r--r--arch/powerpc/lib/copyuser_64.S6
-rw-r--r--arch/powerpc/lib/locks.c4
-rw-r--r--arch/powerpc/lib/mem_64.S6
-rw-r--r--arch/powerpc/lib/memcpy_64.S6
-rw-r--r--arch/powerpc/lib/sstep.c45
-rw-r--r--arch/powerpc/mm/hash_low_32.S22
-rw-r--r--arch/powerpc/mm/hash_low_64.S5
-rw-r--r--arch/powerpc/mm/hash_native_64.c2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c127
-rw-r--r--arch/powerpc/mm/hugetlbpage.c16
-rw-r--r--arch/powerpc/mm/init_32.c4
-rw-r--r--arch/powerpc/mm/lmb.c4
-rw-r--r--arch/powerpc/mm/mem.c3
-rw-r--r--arch/powerpc/mm/mmu_decl.h5
-rw-r--r--arch/powerpc/mm/numa.c24
-rw-r--r--arch/powerpc/mm/pgtable_32.c76
-rw-r--r--arch/powerpc/mm/ppc_mmu_32.c4
-rw-r--r--arch/powerpc/mm/tlb_64.c68
-rw-r--r--arch/powerpc/oprofile/Makefile2
-rw-r--r--arch/powerpc/oprofile/common.c3
-rw-r--r--arch/powerpc/oprofile/op_model_cell.c3
-rw-r--r--arch/powerpc/oprofile/op_model_pa6t.c234
-rw-r--r--arch/powerpc/platforms/4xx/Kconfig372
-rw-r--r--arch/powerpc/platforms/52xx/Kconfig35
-rw-r--r--arch/powerpc/platforms/52xx/efika.c15
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c12
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pci.c2
-rw-r--r--arch/powerpc/platforms/82xx/Kconfig45
-rw-r--r--arch/powerpc/platforms/82xx/mpc82xx.c6
-rw-r--r--arch/powerpc/platforms/82xx/mpc82xx_ads.c12
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig15
-rw-r--r--arch/powerpc/platforms/83xx/Makefile1
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.h19
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c138
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.h23
-rw-r--r--arch/powerpc/platforms/83xx/pci.c2
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig38
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/mpc8544_ds.c144
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c2
-rw-r--r--arch/powerpc/platforms/85xx/pci.c2
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig18
-rw-r--r--arch/powerpc/platforms/86xx/Makefile2
-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/8xx/Kconfig67
-rw-r--r--arch/powerpc/platforms/8xx/m8xx_setup.c8
-rw-r--r--arch/powerpc/platforms/8xx/mpc86xads.h2
-rw-r--r--arch/powerpc/platforms/8xx/mpc86xads_setup.c4
-rw-r--r--arch/powerpc/platforms/8xx/mpc885ads.h2
-rw-r--r--arch/powerpc/platforms/8xx/mpc885ads_setup.c4
-rw-r--r--arch/powerpc/platforms/Kconfig259
-rw-r--r--arch/powerpc/platforms/cell/Kconfig24
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq.c112
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.c168
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.h5
-rw-r--r--arch/powerpc/platforms/cell/cbe_thermal.c181
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c4
-rw-r--r--arch/powerpc/platforms/cell/io-workarounds.c2
-rw-r--r--arch/powerpc/platforms/cell/iommu.c16
-rw-r--r--arch/powerpc/platforms/cell/ras.c160
-rw-r--r--arch/powerpc/platforms/cell/setup.c12
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c8
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c163
-rw-r--r--arch/powerpc/platforms/cell/spu_coredump.c34
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c18
-rw-r--r--arch/powerpc/platforms/cell/spufs/Makefile2
-rw-r--r--arch/powerpc/platforms/cell/spufs/backing_ops.c6
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c45
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c19
-rw-r--r--arch/powerpc/platforms/cell/spufs/fault.c211
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c152
-rw-r--r--arch/powerpc/platforms/cell/spufs/hw_ops.c9
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c44
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c123
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c113
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h34
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c8
-rw-r--r--arch/powerpc/platforms/celleb/Kconfig9
-rw-r--r--arch/powerpc/platforms/celleb/iommu.c6
-rw-r--r--arch/powerpc/platforms/celleb/pci.c18
-rw-r--r--arch/powerpc/platforms/celleb/setup.c12
-rw-r--r--arch/powerpc/platforms/chrp/Kconfig11
-rw-r--r--arch/powerpc/platforms/chrp/nvram.c2
-rw-r--r--arch/powerpc/platforms/chrp/pci.c25
-rw-r--r--arch/powerpc/platforms/chrp/setup.c52
-rw-r--r--arch/powerpc/platforms/chrp/time.c13
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig264
-rw-r--r--arch/powerpc/platforms/embedded6xx/linkstation.c8
-rw-r--r--arch/powerpc/platforms/embedded6xx/ls_uart.c4
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c15
-rw-r--r--arch/powerpc/platforms/iseries/Kconfig4
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c4
-rw-r--r--arch/powerpc/platforms/iseries/irq.c4
-rw-r--r--arch/powerpc/platforms/iseries/pci.c5
-rw-r--r--arch/powerpc/platforms/iseries/setup.c10
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c2
-rw-r--r--arch/powerpc/platforms/maple/Kconfig17
-rw-r--r--arch/powerpc/platforms/maple/pci.c8
-rw-r--r--arch/powerpc/platforms/maple/setup.c17
-rw-r--r--arch/powerpc/platforms/pasemi/Kconfig19
-rw-r--r--arch/powerpc/platforms/pasemi/Makefile3
-rw-r--r--arch/powerpc/platforms/pasemi/cpufreq.c308
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c339
-rw-r--r--arch/powerpc/platforms/pasemi/idle.c9
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c6
-rw-r--r--arch/powerpc/platforms/pasemi/pasemi.h8
-rw-r--r--arch/powerpc/platforms/pasemi/pci.c16
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c28
-rw-r--r--arch/powerpc/platforms/powermac/Kconfig20
-rw-r--r--arch/powerpc/platforms/powermac/backlight.c9
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c24
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c16
-rw-r--r--arch/powerpc/platforms/powermac/feature.c101
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c15
-rw-r--r--arch/powerpc/platforms/powermac/pci.c41
-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/pic.c8
-rw-r--r--arch/powerpc/platforms/powermac/setup.c61
-rw-r--r--arch/powerpc/platforms/powermac/smp.c11
-rw-r--r--arch/powerpc/platforms/powermac/time.c38
-rw-r--r--arch/powerpc/platforms/powermac/udbg_scc.c6
-rw-r--r--arch/powerpc/platforms/prep/Kconfig9
-rw-r--r--arch/powerpc/platforms/ps3/Kconfig16
-rw-r--r--arch/powerpc/platforms/ps3/htab.c2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig10
-rw-r--r--arch/powerpc/platforms/pseries/Makefile5
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c204
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c78
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c8
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c4
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c67
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c6
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci.c3
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c1
-rw-r--r--arch/powerpc/platforms/pseries/ras.c2
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c44
-rw-r--r--arch/powerpc/platforms/pseries/xics.c17
-rw-r--r--arch/powerpc/sysdev/Makefile5
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c4
-rw-r--r--arch/powerpc/sysdev/dcr.c14
-rw-r--r--arch/powerpc/sysdev/fsl_pcie.c (renamed from arch/powerpc/platforms/86xx/mpc86xx_pcie.c)2
-rw-r--r--arch/powerpc/sysdev/fsl_pcie.h94
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c90
-rw-r--r--arch/powerpc/sysdev/mpic.c32
-rw-r--r--arch/powerpc/sysdev/pmi.c29
-rw-r--r--arch/powerpc/sysdev/qe_lib/Kconfig10
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c4
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_io.c6
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_slow.c4
-rw-r--r--arch/powerpc/sysdev/timer.c71
-rw-r--r--arch/powerpc/sysdev/tsi108_dev.c16
-rw-r--r--arch/powerpc/sysdev/tsi108_pci.c2
-rw-r--r--arch/powerpc/sysdev/uic.c342
-rw-r--r--arch/powerpc/xmon/xmon.c11
257 files changed, 9824 insertions, 3288 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6dfbd52694ab..a54a9a2e36f3 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -11,6 +11,11 @@ config PPC64
11 This option selects whether a 32-bit or a 64-bit kernel 11 This option selects whether a 32-bit or a 64-bit kernel
12 will be built. 12 will be built.
13 13
14config PPC_PM_NEEDS_RTC_LIB
15 bool
16 select RTC_LIB
17 default y if PM
18
14config PPC32 19config PPC32
15 bool 20 bool
16 default y if !PPC64 21 default y if !PPC64
@@ -89,7 +94,7 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
89 94
90config ARCH_MAY_HAVE_PC_FDC 95config ARCH_MAY_HAVE_PC_FDC
91 bool 96 bool
92 default y 97 default !PPC_PSERIES || PCI
93 98
94config PPC_OF 99config PPC_OF
95 def_bool y 100 def_bool y
@@ -157,17 +162,20 @@ config PPC_83xx
157 select FSL_SOC 162 select FSL_SOC
158 select 83xx 163 select 83xx
159 select PPC_FPU 164 select PPC_FPU
165 select WANT_DEVICE_TREE
160 166
161config PPC_85xx 167config PPC_85xx
162 bool "Freescale 85xx" 168 bool "Freescale 85xx"
163 select E500 169 select E500
164 select FSL_SOC 170 select FSL_SOC
165 select 85xx 171 select 85xx
172 select WANT_DEVICE_TREE
166 173
167config PPC_86xx 174config PPC_86xx
168 bool "Freescale 86xx" 175 bool "Freescale 86xx"
169 select 6xx 176 select 6xx
170 select FSL_SOC 177 select FSL_SOC
178 select FSL_PCIE
171 select PPC_FPU 179 select PPC_FPU
172 select ALTIVEC 180 select ALTIVEC
173 help 181 help
@@ -186,7 +194,6 @@ config 44x
186 bool "AMCC 44x" 194 bool "AMCC 44x"
187 select PPC_DCR_NATIVE 195 select PPC_DCR_NATIVE
188 196
189
190config E200 197config E200
191 bool "Freescale e200" 198 bool "Freescale e200"
192 199
@@ -367,394 +374,7 @@ endmenu
367 374
368source "init/Kconfig" 375source "init/Kconfig"
369 376
370menu "Platform support" 377source "arch/powerpc/platforms/Kconfig"
371 depends on PPC64 || CLASSIC32
372
373choice
374 prompt "Machine type"
375 default PPC_MULTIPLATFORM
376
377config PPC_MULTIPLATFORM
378 bool "Generic desktop/server/laptop"
379 help
380 Select this option if configuring for an IBM pSeries or
381 RS/6000 machine, an Apple machine, or a PReP, CHRP,
382 Maple or Cell-based machine.
383
384config EMBEDDED6xx
385 bool "Embedded 6xx/7xx/7xxx-based board"
386 depends on PPC32 && (BROKEN||BROKEN_ON_SMP)
387
388config APUS
389 bool "Amiga-APUS"
390 depends on PPC32 && BROKEN
391 help
392 Select APUS if configuring for a PowerUP Amiga.
393 More information is available at:
394 <http://linux-apus.sourceforge.net/>.
395endchoice
396
397config QUICC_ENGINE
398 bool
399 depends on PPC_MPC836x || PPC_MPC832x
400 default y
401 help
402 The QUICC Engine (QE) is a new generation of communications
403 coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
404 Selecting this option means that you wish to build a kernel
405 for a machine with a QE coprocessor.
406
407config PPC_PSERIES
408 depends on PPC_MULTIPLATFORM && PPC64
409 bool "IBM pSeries & new (POWER5-based) iSeries"
410 select MPIC
411 select PPC_I8259
412 select PPC_RTAS
413 select RTAS_ERROR_LOGGING
414 select PPC_UDBG_16550
415 select PPC_NATIVE
416 default y
417
418config PPC_ISERIES
419 bool "IBM Legacy iSeries"
420 depends on PPC_MULTIPLATFORM && PPC64
421 select PPC_INDIRECT_IO
422
423config PPC_CHRP
424 bool "Common Hardware Reference Platform (CHRP) based machines"
425 depends on PPC_MULTIPLATFORM && PPC32
426 select MPIC
427 select PPC_I8259
428 select PPC_INDIRECT_PCI
429 select PPC_RTAS
430 select PPC_MPC106
431 select PPC_UDBG_16550
432 select PPC_NATIVE
433 default y
434
435config PPC_MPC52xx
436 bool
437 default n
438
439config PPC_MPC5200
440 bool
441 select PPC_MPC52xx
442 default n
443
444config PPC_MPC5200_BUGFIX
445 bool "MPC5200 (L25R) bugfix support"
446 depends on PPC_MPC5200
447 default n
448 help
449 Enable workarounds for original MPC5200 errata. This is not required
450 for MPC5200B based boards.
451
452 It is safe to say 'Y' here
453
454config PPC_EFIKA
455 bool "bPlan Efika 5k2. MPC5200B based computer"
456 depends on PPC_MULTIPLATFORM && PPC32
457 select PPC_RTAS
458 select RTAS_PROC
459 select PPC_MPC52xx
460 select PPC_NATIVE
461 default n
462
463config PPC_LITE5200
464 bool "Freescale Lite5200 Eval Board"
465 depends on PPC_MULTIPLATFORM && PPC32
466 select PPC_MPC5200
467 default n
468
469config PPC_PMAC
470 bool "Apple PowerMac based machines"
471 depends on PPC_MULTIPLATFORM
472 select MPIC
473 select PPC_INDIRECT_PCI if PPC32
474 select PPC_MPC106 if PPC32
475 select PPC_NATIVE
476 default y
477
478config PPC_PMAC64
479 bool
480 depends on PPC_PMAC && POWER4
481 select MPIC
482 select U3_DART
483 select MPIC_BROKEN_U3
484 select GENERIC_TBSYNC
485 select PPC_970_NAP
486 default y
487
488config PPC_PREP
489 bool "PowerPC Reference Platform (PReP) based machines"
490 depends on PPC_MULTIPLATFORM && PPC32 && BROKEN
491 select MPIC
492 select PPC_I8259
493 select PPC_INDIRECT_PCI
494 select PPC_UDBG_16550
495 select PPC_NATIVE
496 default n
497
498config PPC_MAPLE
499 depends on PPC_MULTIPLATFORM && PPC64
500 bool "Maple 970FX Evaluation Board"
501 select MPIC
502 select U3_DART
503 select MPIC_BROKEN_U3
504 select GENERIC_TBSYNC
505 select PPC_UDBG_16550
506 select PPC_970_NAP
507 select PPC_NATIVE
508 select PPC_RTAS
509 select MMIO_NVRAM
510 select ATA_NONSTANDARD if ATA
511 default n
512 help
513 This option enables support for the Maple 970FX Evaluation Board.
514 For more information, refer to <http://www.970eval.com>
515
516config PPC_PASEMI
517 depends on PPC_MULTIPLATFORM && PPC64
518 bool "PA Semi SoC-based platforms"
519 default n
520 select MPIC
521 select PPC_UDBG_16550
522 select GENERIC_TBSYNC
523 select PPC_NATIVE
524 help
525 This option enables support for PA Semi's PWRficient line
526 of SoC processors, including PA6T-1682M
527
528config PPC_CELL
529 bool
530 default n
531
532config PPC_CELL_NATIVE
533 bool
534 select PPC_CELL
535 select PPC_DCR_MMIO
536 select PPC_OF_PLATFORM_PCI
537 select PPC_INDIRECT_IO
538 select PPC_NATIVE
539 select MPIC
540 default n
541
542config PPC_IBM_CELL_BLADE
543 bool "IBM Cell Blade"
544 depends on PPC_MULTIPLATFORM && PPC64
545 select PPC_CELL_NATIVE
546 select PPC_RTAS
547 select MMIO_NVRAM
548 select PPC_UDBG_16550
549 select UDBG_RTAS_CONSOLE
550
551config PPC_PS3
552 bool "Sony PS3 (incomplete)"
553 depends on PPC_MULTIPLATFORM && PPC64
554 select PPC_CELL
555 select USB_ARCH_HAS_OHCI
556 select USB_OHCI_LITTLE_ENDIAN
557 select USB_OHCI_BIG_ENDIAN_MMIO
558 select USB_ARCH_HAS_EHCI
559 select USB_EHCI_BIG_ENDIAN_MMIO
560 help
561 This option enables support for the Sony PS3 game console
562 and other platforms using the PS3 hypervisor.
563 Support for this platform is not yet complete, so
564 enabling this will not result in a bootable kernel on a
565 PS3 system.
566
567config PPC_CELLEB
568 bool "Toshiba's Cell Reference Set 'Celleb' Architecture"
569 depends on PPC_MULTIPLATFORM && PPC64
570 select PPC_CELL
571 select PPC_OF_PLATFORM_PCI
572 select HAS_TXX9_SERIAL
573 select PPC_UDBG_BEAT
574 select USB_OHCI_BIG_ENDIAN_MMIO
575 select USB_EHCI_BIG_ENDIAN_MMIO
576
577config PPC_NATIVE
578 bool
579 depends on PPC_MULTIPLATFORM
580 help
581 Support for running natively on the hardware, i.e. without
582 a hypervisor. This option is not user-selectable but should
583 be selected by all platforms that need it.
584
585config UDBG_RTAS_CONSOLE
586 bool "RTAS based debug console"
587 depends on PPC_RTAS
588 default n
589
590config PPC_UDBG_BEAT
591 bool "BEAT based debug console"
592 depends on PPC_CELLEB
593 default n
594
595config XICS
596 depends on PPC_PSERIES
597 bool
598 default y
599
600config U3_DART
601 bool
602 depends on PPC_MULTIPLATFORM && PPC64
603 default n
604
605config PPC_RTAS
606 bool
607 default n
608
609config RTAS_ERROR_LOGGING
610 bool
611 depends on PPC_RTAS
612 default n
613
614config RTAS_PROC
615 bool "Proc interface to RTAS"
616 depends on PPC_RTAS
617 default y
618
619config RTAS_FLASH
620 tristate "Firmware flash interface"
621 depends on PPC64 && RTAS_PROC
622
623config PPC_PMI
624 tristate "Support for PMI"
625 depends PPC_IBM_CELL_BLADE
626 help
627 PMI (Platform Management Interrupt) is a way to
628 communicate with the BMC (Baseboard Mangement Controller).
629 It is used in some IBM Cell blades.
630 default m
631
632config MMIO_NVRAM
633 bool
634 default n
635
636config MPIC_BROKEN_U3
637 bool
638 depends on PPC_MAPLE
639 default y
640
641config IBMVIO
642 depends on PPC_PSERIES || PPC_ISERIES
643 bool
644 default y
645
646config IBMEBUS
647 depends on PPC_PSERIES
648 bool "Support for GX bus based adapters"
649 help
650 Bus device driver for GX bus based adapters.
651
652config PPC_MPC106
653 bool
654 default n
655
656config PPC_970_NAP
657 bool
658 default n
659
660config PPC_INDIRECT_IO
661 bool
662 select GENERIC_IOMAP
663 default n
664
665config GENERIC_IOMAP
666 bool
667 default n
668
669source "drivers/cpufreq/Kconfig"
670
671config CPU_FREQ_PMAC
672 bool "Support for Apple PowerBooks"
673 depends on CPU_FREQ && ADB_PMU && PPC32
674 select CPU_FREQ_TABLE
675 help
676 This adds support for frequency switching on Apple PowerBooks,
677 this currently includes some models of iBook & Titanium
678 PowerBook.
679
680config CPU_FREQ_PMAC64
681 bool "Support for some Apple G5s"
682 depends on CPU_FREQ && PPC64
683 select CPU_FREQ_TABLE
684 help
685 This adds support for frequency switching on Apple iMac G5,
686 and some of the more recent desktop G5 machines as well.
687
688config PPC601_SYNC_FIX
689 bool "Workarounds for PPC601 bugs"
690 depends on 6xx && (PPC_PREP || PPC_PMAC)
691 help
692 Some versions of the PPC601 (the first PowerPC chip) have bugs which
693 mean that extra synchronization instructions are required near
694 certain instructions, typically those that make major changes to the
695 CPU state. These extra instructions reduce performance slightly.
696 If you say N here, these extra instructions will not be included,
697 resulting in a kernel which will run faster but may not run at all
698 on some systems with the PPC601 chip.
699
700 If in doubt, say Y here.
701
702config TAU
703 bool "On-chip CPU temperature sensor support"
704 depends on 6xx
705 help
706 G3 and G4 processors have an on-chip temperature sensor called the
707 'Thermal Assist Unit (TAU)', which, in theory, can measure the on-die
708 temperature within 2-4 degrees Celsius. This option shows the current
709 on-die temperature in /proc/cpuinfo if the cpu supports it.
710
711 Unfortunately, on some chip revisions, this sensor is very inaccurate
712 and in many cases, does not work at all, so don't assume the cpu
713 temp is actually what /proc/cpuinfo says it is.
714
715config TAU_INT
716 bool "Interrupt driven TAU driver (DANGEROUS)"
717 depends on TAU
718 ---help---
719 The TAU supports an interrupt driven mode which causes an interrupt
720 whenever the temperature goes out of range. This is the fastest way
721 to get notified the temp has exceeded a range. With this option off,
722 a timer is used to re-check the temperature periodically.
723
724 However, on some cpus it appears that the TAU interrupt hardware
725 is buggy and can cause a situation which would lead unexplained hard
726 lockups.
727
728 Unless you are extending the TAU driver, or enjoy kernel/hardware
729 debugging, leave this option off.
730
731config TAU_AVERAGE
732 bool "Average high and low temp"
733 depends on TAU
734 ---help---
735 The TAU hardware can compare the temperature to an upper and lower
736 bound. The default behavior is to show both the upper and lower
737 bound in /proc/cpuinfo. If the range is large, the temperature is
738 either changing a lot, or the TAU hardware is broken (likely on some
739 G4's). If the range is small (around 4 degrees), the temperature is
740 relatively stable. If you say Y here, a single temperature value,
741 halfway between the upper and lower bounds, will be reported in
742 /proc/cpuinfo.
743
744 If in doubt, say N here.
745
746endmenu
747
748source arch/powerpc/platforms/embedded6xx/Kconfig
749source arch/powerpc/platforms/4xx/Kconfig
750source arch/powerpc/platforms/82xx/Kconfig
751source arch/powerpc/platforms/83xx/Kconfig
752source arch/powerpc/platforms/85xx/Kconfig
753source arch/powerpc/platforms/86xx/Kconfig
754source arch/powerpc/platforms/8xx/Kconfig
755source arch/powerpc/platforms/cell/Kconfig
756source arch/powerpc/platforms/ps3/Kconfig
757source arch/powerpc/platforms/pasemi/Kconfig
758 378
759menu "Kernel options" 379menu "Kernel options"
760 380
@@ -837,15 +457,6 @@ config CRASH_DUMP
837 457
838 Don't change this unless you know what you are doing. 458 Don't change this unless you know what you are doing.
839 459
840config EMBEDDEDBOOT
841 bool
842 depends on 8xx || 8260
843 default y
844
845config PC_KEYBOARD
846 bool "PC PS/2 style Keyboard"
847 depends on 4xx || CPM2
848
849config PPCBUG_NVRAM 460config PPCBUG_NVRAM
850 bool "Enable reading PPCBUG NVRAM during boot" if PPLUS || LOPEC 461 bool "Enable reading PPCBUG NVRAM during boot" if PPLUS || LOPEC
851 default y if PPC_PREP 462 default y if PPC_PREP
@@ -859,8 +470,6 @@ config IRQ_ALL_CPUS
859 CPU. Generally saying Y is safe, although some problems have been 470 CPU. Generally saying Y is safe, although some problems have been
860 reported with SMP Power Macintoshes with this option enabled. 471 reported with SMP Power Macintoshes with this option enabled.
861 472
862source "arch/powerpc/platforms/pseries/Kconfig"
863
864config NUMA 473config NUMA
865 bool "NUMA support" 474 bool "NUMA support"
866 depends on PPC64 475 depends on PPC64
@@ -910,10 +519,10 @@ config PPC_64K_PAGES
910 depends on PPC64 519 depends on PPC64
911 help 520 help
912 This option changes the kernel logical page size to 64k. On machines 521 This option changes the kernel logical page size to 64k. On machines
913 without processor support for 64k pages, the kernel will simulate 522 without processor support for 64k pages, the kernel will simulate
914 them by loading each individual 4k page on demand transparently, 523 them by loading each individual 4k page on demand transparently,
915 while on hardware with such support, it will be used to map 524 while on hardware with such support, it will be used to map
916 normal application pages. 525 normal application pages.
917 526
918config SCHED_SMT 527config SCHED_SMT
919 bool "SMT (Hyperthreading) scheduler support" 528 bool "SMT (Hyperthreading) scheduler support"
@@ -931,8 +540,6 @@ config PROC_DEVICETREE
931 an image of the device tree that the kernel copies from Open 540 an image of the device tree that the kernel copies from Open
932 Firmware or other boot firmware. If unsure, say Y here. 541 Firmware or other boot firmware. If unsure, say Y here.
933 542
934source "arch/powerpc/platforms/prep/Kconfig"
935
936config CMDLINE_BOOL 543config CMDLINE_BOOL
937 bool "Default bootloader kernel arguments" 544 bool "Default bootloader kernel arguments"
938 545
@@ -967,6 +574,29 @@ config SECCOMP
967 574
968 If unsure, say Y. Only embedded should say N here. 575 If unsure, say Y. Only embedded should say N here.
969 576
577config WANT_DEVICE_TREE
578 bool
579 default n
580
581config DEVICE_TREE
582 string "Static device tree source file"
583 depends on WANT_DEVICE_TREE
584 help
585 This specifies the device tree source (.dts) file to be
586 compiled and included when building the bootwrapper. If a
587 relative filename is given, then it will be relative to
588 arch/powerpc/boot/dts. If you are not using the bootwrapper,
589 or do not need to build a dts into the bootwrapper, this
590 field is ignored.
591
592 For example, this is required when building a cuImage target
593 for an older U-Boot, which cannot pass a device tree itself.
594 Such a kernel will not work with a newer U-Boot that tries to
595 pass a device tree (unless you tell it not to). If your U-Boot
596 does not mention a device tree in "help bootm", then use the
597 cuImage target and specify a device tree here. Otherwise, use
598 the uImage target and leave this field blank.
599
970endmenu 600endmenu
971 601
972config ISA_DMA_API 602config ISA_DMA_API
@@ -995,24 +625,17 @@ config GENERIC_ISA_DMA
995 depends on PPC64 || POWER4 || 6xx && !CPM2 625 depends on PPC64 || POWER4 || 6xx && !CPM2
996 default y 626 default y
997 627
998config MPIC
999 bool
1000 default n
1001
1002config MPIC_WEIRD
1003 bool
1004 default n
1005
1006config PPC_I8259
1007 bool
1008 default n
1009
1010config PPC_INDIRECT_PCI 628config PPC_INDIRECT_PCI
1011 bool 629 bool
1012 depends on PCI 630 depends on PCI
1013 default y if 40x || 44x 631 default y if 40x || 44x
1014 default n 632 default n
1015 633
634config PPC_INDIRECT_PCI_BE
635 bool
636 depends PPC_INDIRECT_PCI
637 default n
638
1016config EISA 639config EISA
1017 bool 640 bool
1018 641
@@ -1022,13 +645,18 @@ config SBUS
1022config FSL_SOC 645config FSL_SOC
1023 bool 646 bool
1024 647
648config FSL_PCIE
649 bool
650 depends on PPC_86xx
651
1025# Yes MCA RS/6000s exist but Linux-PPC does not currently support any 652# Yes MCA RS/6000s exist but Linux-PPC does not currently support any
1026config MCA 653config MCA
1027 bool 654 bool
1028 655
1029config PCI 656config PCI
1030 bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx \ 657 bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx \
1031 || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) || MPC7448HPC2 || PPC_PS3 658 || PPC_MPC52xx || (EMBEDDED && (PPC_PSERIES || PPC_ISERIES)) \
659 || MPC7448HPC2 || PPC_PS3
1032 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx \ 660 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx \
1033 && !PPC_85xx && !PPC_86xx 661 && !PPC_85xx && !PPC_86xx
1034 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS 662 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS
@@ -1228,12 +856,10 @@ source "fs/Kconfig"
1228 856
1229source "arch/powerpc/sysdev/qe_lib/Kconfig" 857source "arch/powerpc/sysdev/qe_lib/Kconfig"
1230 858
1231source "arch/powerpc/platforms/iseries/Kconfig"
1232
1233source "lib/Kconfig" 859source "lib/Kconfig"
1234 860
1235menu "Instrumentation Support" 861menu "Instrumentation Support"
1236 depends on EXPERIMENTAL 862 depends on EXPERIMENTAL
1237 863
1238source "arch/powerpc/oprofile/Kconfig" 864source "arch/powerpc/oprofile/Kconfig"
1239 865
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index d39d13327e6d..86aa3745af7f 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -18,6 +18,15 @@ 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 DEBUG_PAGEALLOC
22 bool "Debug page memory allocations"
23 depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
24 help
25 Unmap pages from the kernel linear mapping after free_pages().
26 This results in a large slowdown, but helps to find certain types
27 of memory corruptions.
28
29
21config HCALL_STATS 30config HCALL_STATS
22 bool "Hypervisor call instrumentation" 31 bool "Hypervisor call instrumentation"
23 depends on PPC_PSERIES && DEBUG_FS 32 depends on PPC_PSERIES && DEBUG_FS
@@ -132,8 +141,7 @@ config BOOTX_TEXT
132 141
133config SERIAL_TEXT_DEBUG 142config SERIAL_TEXT_DEBUG
134 bool "Support for early boot texts over serial port" 143 bool "Support for early boot texts over serial port"
135 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \ 144 depends on 4xx
136 PPC_GEN550 || PPC_MPC52xx
137 145
138config PPC_EARLY_DEBUG 146config PPC_EARLY_DEBUG
139 bool "Early debugging (dangerous)" 147 bool "Early debugging (dangerous)"
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index a00fe7236555..794992025d8d 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -102,9 +102,9 @@ CFLAGS += $(call cc-option,-mno-altivec)
102# kernel considerably. 102# kernel considerably.
103CFLAGS += $(call cc-option,-funit-at-a-time) 103CFLAGS += $(call cc-option,-funit-at-a-time)
104 104
105ifndef CONFIG_FSL_BOOKE 105# Never use string load/store instructions as they are
106CFLAGS += -mstring 106# often slow when they are implemented at all
107endif 107CFLAGS += -mno-string
108 108
109ifeq ($(CONFIG_6xx),y) 109ifeq ($(CONFIG_6xx),y)
110CFLAGS += -mcpu=powerpc 110CFLAGS += -mcpu=powerpc
@@ -148,7 +148,7 @@ all: $(KBUILD_IMAGE)
148 148
149CPPFLAGS_vmlinux.lds := -Upowerpc 149CPPFLAGS_vmlinux.lds := -Upowerpc
150 150
151BOOT_TARGETS = zImage zImage.initrd uImage 151BOOT_TARGETS = zImage zImage.initrd uImage cuImage
152 152
153PHONY += $(BOOT_TARGETS) 153PHONY += $(BOOT_TARGETS)
154 154
@@ -166,6 +166,9 @@ define archhelp
166 @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 166 @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs'
167endef 167endef
168 168
169install:
170 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
171
169archclean: 172archclean:
170 $(Q)$(MAKE) $(clean)=$(boot) 173 $(Q)$(MAKE) $(clean)=$(boot)
171 174
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index 0734b2fc1d95..eec7af7e5993 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -18,6 +18,9 @@ kernel-vmlinux.strip.c
18kernel-vmlinux.strip.gz 18kernel-vmlinux.strip.gz
19mktree 19mktree
20uImage 20uImage
21cuImage
22cuImage.bin.gz
23cuImage.elf
21zImage 24zImage
22zImage.chrp 25zImage.chrp
23zImage.coff 26zImage.coff
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index dc779407de14..3716594ea33e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -40,10 +40,11 @@ zliblinuxheader := zlib.h zconf.h zutil.h
40$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ 40$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \
41 $(addprefix $(obj)/,$(zlibheader)) 41 $(addprefix $(obj)/,$(zlibheader))
42 42
43src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ 43src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
44 ns16550.c serial.c simple_alloc.c div64.S util.S $(zlib) 44 ns16550.c serial.c simple_alloc.c div64.S util.S \
45src-plat := of.c 45 gunzip_util.c elf_util.c $(zlib) devtree.c
46src-boot := crt0.S $(src-wlib) $(src-plat) empty.c 46src-plat := of.c cuboot-83xx.c cuboot-85xx.c
47src-boot := $(src-wlib) $(src-plat) empty.c
47 48
48src-boot := $(addprefix $(obj)/, $(src-boot)) 49src-boot := $(addprefix $(obj)/, $(src-boot))
49obj-boot := $(addsuffix .o, $(basename $(src-boot))) 50obj-boot := $(addsuffix .o, $(basename $(src-boot)))
@@ -75,7 +76,7 @@ $(obj)/zImage.lds $(obj)/zImage.coff.lds: $(obj)/%: $(srctree)/$(src)/%.S
75 @cp $< $@ 76 @cp $< $@
76 77
77clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ 78clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
78 empty.c zImage zImage.coff.lds zImage.lds zImage.sandpoint 79 empty.c zImage.coff.lds zImage.lds
79 80
80quiet_cmd_bootcc = BOOTCC $@ 81quiet_cmd_bootcc = BOOTCC $@
81 cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 82 cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
@@ -84,23 +85,25 @@ quiet_cmd_bootas = BOOTAS $@
84 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 85 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
85 86
86quiet_cmd_bootar = BOOTAR $@ 87quiet_cmd_bootar = BOOTAR $@
87 cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $^; mv $@.$$$$ $@ 88 cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
88 89
89$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c 90$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
90 $(call if_changed_dep,bootcc) 91 $(call if_changed_dep,bootcc)
91$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S 92$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
92 $(call if_changed_dep,bootas) 93 $(call if_changed_dep,bootas)
93 94
94$(obj)/wrapper.a: $(obj-wlib) 95$(obj)/wrapper.a: $(obj-wlib) FORCE
95 $(call cmd,bootar) 96 $(call if_changed,bootar)
96 97
97hostprogs-y := addnote addRamDisk hack-coff mktree 98hostprogs-y := addnote addRamDisk hack-coff mktree
98 99
99extra-y := $(obj)/crt0.o $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 100targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
101extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
100 $(obj)/zImage.lds $(obj)/zImage.coff.lds 102 $(obj)/zImage.lds $(obj)/zImage.coff.lds
101 103
102wrapper :=$(srctree)/$(src)/wrapper 104wrapper :=$(srctree)/$(src)/wrapper
103wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) 105wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
106 $(wrapper) FORCE
104 107
105############# 108#############
106# Bits for building various flavours of zImage 109# Bits for building various flavours of zImage
@@ -113,50 +116,10 @@ CROSSWRAP := -C "$(CROSS_COMPILE)"
113endif 116endif
114endif 117endif
115 118
119# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
116quiet_cmd_wrap = WRAP $@ 120quiet_cmd_wrap = WRAP $@
117 cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) vmlinux 121 cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
118quiet_cmd_wrap_initrd = WRAP $@ 122 $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux
119 cmd_wrap_initrd =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
120 -i $(obj)/ramdisk.image.gz vmlinux
121
122$(obj)/zImage.chrp: vmlinux $(wrapperbits)
123 $(call cmd,wrap,chrp)
124
125$(obj)/zImage.initrd.chrp: vmlinux $(wrapperbits)
126 $(call cmd,wrap_initrd,chrp)
127
128$(obj)/zImage.pseries: vmlinux $(wrapperbits)
129 $(call cmd,wrap,pseries)
130
131$(obj)/zImage.initrd.pseries: vmlinux $(wrapperbits)
132 $(call cmd,wrap_initrd,pseries)
133
134$(obj)/zImage.pmac: vmlinux $(wrapperbits)
135 $(call cmd,wrap,pmac)
136
137$(obj)/zImage.initrd.pmac: vmlinux $(wrapperbits)
138 $(call cmd,wrap_initrd,pmac)
139
140$(obj)/zImage.coff: vmlinux $(wrapperbits)
141 $(call cmd,wrap,pmaccoff)
142
143$(obj)/zImage.initrd.coff: vmlinux $(wrapperbits)
144 $(call cmd,wrap_initrd,pmaccoff)
145
146$(obj)/zImage.miboot: vmlinux $(wrapperbits)
147 $(call cmd,wrap,miboot)
148
149$(obj)/zImage.initrd.miboot: vmlinux $(wrapperbits)
150 $(call cmd,wrap_initrd,miboot)
151
152$(obj)/zImage.ps3: vmlinux
153 $(STRIP) -s -R .comment $< -o $@
154
155$(obj)/zImage.initrd.ps3: vmlinux
156 @echo " WARNING zImage.initrd.ps3 not supported (yet)"
157
158$(obj)/uImage: vmlinux $(wrapperbits)
159 $(call cmd,wrap,uboot)
160 123
161image-$(CONFIG_PPC_PSERIES) += zImage.pseries 124image-$(CONFIG_PPC_PSERIES) += zImage.pseries
162image-$(CONFIG_PPC_MAPLE) += zImage.pseries 125image-$(CONFIG_PPC_MAPLE) += zImage.pseries
@@ -166,7 +129,7 @@ image-$(CONFIG_PPC_CELLEB) += zImage.pseries
166image-$(CONFIG_PPC_CHRP) += zImage.chrp 129image-$(CONFIG_PPC_CHRP) += zImage.chrp
167image-$(CONFIG_PPC_EFIKA) += zImage.chrp 130image-$(CONFIG_PPC_EFIKA) += zImage.chrp
168image-$(CONFIG_PPC_PMAC) += zImage.pmac 131image-$(CONFIG_PPC_PMAC) += zImage.pmac
169image-$(CONFIG_DEFAULT_UIMAGE) += uImage 132image-$(CONFIG_DEFAULT_UIMAGE) += uImage cuImage
170 133
171# For 32-bit powermacs, build the COFF and miboot images 134# For 32-bit powermacs, build the COFF and miboot images
172# as well as the ELF images. 135# as well as the ELF images.
@@ -174,16 +137,55 @@ ifeq ($(CONFIG_PPC32),y)
174image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot 137image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
175endif 138endif
176 139
140initrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-))
177initrd-y := $(patsubst zImage%, zImage.initrd%, $(image-y)) 141initrd-y := $(patsubst zImage%, zImage.initrd%, $(image-y))
142initrd-y := $(filter-out $(image-y), $(initrd-y))
143targets += $(image-y) $(initrd-y)
144
145$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
146
147# Don't put the ramdisk on the pattern rule; when its missing make will try
148# the pattern rule with less dependencies that also matches (even with the
149# hard dependency listed).
150$(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
151 $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
152
153$(obj)/zImage.%: vmlinux $(wrapperbits)
154 $(call if_changed,wrap,$*)
155
156$(obj)/zImage.ps3: vmlinux
157 $(STRIP) -s -R .comment $< -o $@
158
159$(obj)/zImage.initrd.ps3: vmlinux
160 @echo " WARNING zImage.initrd.ps3 not supported (yet)"
161
162$(obj)/uImage: vmlinux $(wrapperbits)
163 $(call if_changed,wrap,uboot)
164
165cuboot-plat-$(CONFIG_83xx) += 83xx
166cuboot-plat-$(CONFIG_85xx) += 85xx
167cuboot-plat-y += unknown-platform
168
169dts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\
170 ,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE)
171
172$(obj)/cuImage: vmlinux $(wrapperbits)
173 $(call if_changed,wrap,cuboot-$(word 1,$(cuboot-plat-y)),$(dts))
178 174
179$(obj)/zImage: $(addprefix $(obj)/, $(image-y)) 175$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
180 @rm -f $@; ln $< $@ 176 @rm -f $@; ln $< $@
181$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) 177$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
182 @rm -f $@; ln $< $@ 178 @rm -f $@; ln $< $@
183 179
184install: $(CONFIGURE) $(image-y) 180install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
185 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< 181 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
186 182
187clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip.gz) 183# anything not in $(targets)
188clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.bin.gz) 184clean-files += $(image-) $(initrd-) zImage zImage.initrd \
189clean-files += $(image-) 185 cuImage.elf cuImage.bin.gz
186
187# clean up files cached by wrapper
188clean-kernel := vmlinux.strip vmlinux.bin
189clean-kernel += $(addsuffix .gz,$(clean-kernel))
190# If not absolute clean-files are relative to $(obj).
191clean-files += $(addprefix $(objtree)/, $(clean-kernel))
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 70e65b13e033..5a4215c4b014 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -16,8 +16,11 @@
16_zimage_start_opd: 16_zimage_start_opd:
17 .long _zimage_start, 0, 0, 0 17 .long _zimage_start, 0, 0, 0
18 18
19 .weak _zimage_start
19 .globl _zimage_start 20 .globl _zimage_start
20_zimage_start: 21_zimage_start:
22 .globl _zimage_start_lib
23_zimage_start_lib:
21 /* Work out the offset between the address we were linked at 24 /* Work out the offset between the address we were linked at
22 and the address where we're running. */ 25 and the address where we're running. */
23 bl 1f 26 bl 1f
@@ -44,7 +47,7 @@ _zimage_start:
44 addi r9,r9,4 47 addi r9,r9,4
45 bdnz 2b 48 bdnz 2b
46 49
47 /* Do a cache flush for our text, in case OF didn't */ 50 /* Do a cache flush for our text, in case the loader didn't */
483: lis r9,_start@ha 513: lis r9,_start@ha
49 addi r9,r9,_start@l 52 addi r9,r9,_start@l
50 add r9,r0,r9 53 add r9,r0,r9
@@ -59,6 +62,34 @@ _zimage_start:
59 sync 62 sync
60 isync 63 isync
61 64
62 mr r6,r1 65 /* Clear the BSS */
63 b start 66 lis r9,__bss_start@ha
67 addi r9,r9,__bss_start@l
68 add r9,r0,r9
69 lis r8,_end@ha
70 addi r8,r8,_end@l
71 add r8,r0,r8
72 li r10,0
735: stw r10,0(r9)
74 addi r9,r9,4
75 cmplw cr0,r9,r8
76 blt 5b
64 77
78 /* Possibly set up a custom stack */
79.weak _platform_stack_top
80 lis r8,_platform_stack_top@ha
81 addi r8,r8,_platform_stack_top@l
82 cmpwi r8,0
83 beq 6f
84 add r8,r0,r8
85 lwz r1,0(r8)
86 add r1,r0,r1
87 li r0,0
88 stwu r0,-16(r1) /* establish a stack frame */
896:
90
91 /* Call platform_init() */
92 bl platform_init
93
94 /* Call start */
95 b start
diff --git a/arch/powerpc/boot/cuboot-83xx.c b/arch/powerpc/boot/cuboot-83xx.c
new file mode 100644
index 000000000000..6cbc20afb4d8
--- /dev/null
+++ b/arch/powerpc/boot/cuboot-83xx.c
@@ -0,0 +1,68 @@
1/*
2 * Old U-boot compatibility for 83xx
3 *
4 * Author: Scott Wood <scottwood@freescale.com>
5 *
6 * Copyright (c) 2007 Freescale Semiconductor, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
11 */
12
13#include "ops.h"
14#include "stdio.h"
15
16#define TARGET_83xx
17#include "ppcboot.h"
18
19static bd_t bd;
20extern char _end[];
21extern char _dtb_start[], _dtb_end[];
22
23static void platform_fixups(void)
24{
25 void *soc;
26
27 dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
28 dt_fixup_mac_addresses(bd.bi_enetaddr, bd.bi_enet1addr);
29 dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
30
31 /* Unfortunately, the specific model number is encoded in the
32 * soc node name in existing dts files -- once that is fixed,
33 * this can do a simple path lookup.
34 */
35 soc = find_node_by_devtype(NULL, "soc");
36 if (soc) {
37 void *serial = NULL;
38
39 setprop(soc, "bus-frequency", &bd.bi_busfreq,
40 sizeof(bd.bi_busfreq));
41
42 while ((serial = find_node_by_devtype(serial, "serial"))) {
43 if (get_parent(serial) != soc)
44 continue;
45
46 setprop(serial, "clock-frequency", &bd.bi_busfreq,
47 sizeof(bd.bi_busfreq));
48 }
49 }
50}
51
52void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
53 unsigned long r6, unsigned long r7)
54{
55 unsigned long end_of_ram = bd.bi_memstart + bd.bi_memsize;
56 unsigned long avail_ram = end_of_ram - (unsigned long)_end;
57
58 memcpy(&bd, (bd_t *)r3, sizeof(bd));
59 loader_info.initrd_addr = r4;
60 loader_info.initrd_size = r4 ? r5 : 0;
61 loader_info.cmdline = (char *)r6;
62 loader_info.cmdline_len = r7 - r6;
63
64 simple_alloc_init(_end, avail_ram - 1024*1024, 32, 64);
65 ft_init(_dtb_start, _dtb_end - _dtb_start, 32);
66 serial_console_init();
67 platform_ops.fixups = platform_fixups;
68}
diff --git a/arch/powerpc/boot/cuboot-85xx.c b/arch/powerpc/boot/cuboot-85xx.c
new file mode 100644
index 000000000000..f88ba00ac122
--- /dev/null
+++ b/arch/powerpc/boot/cuboot-85xx.c
@@ -0,0 +1,69 @@
1/*
2 * Old U-boot compatibility for 85xx
3 *
4 * Author: Scott Wood <scottwood@freescale.com>
5 *
6 * Copyright (c) 2007 Freescale Semiconductor, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
11 */
12
13#include "ops.h"
14#include "stdio.h"
15
16#define TARGET_85xx
17#include "ppcboot.h"
18
19static bd_t bd;
20extern char _end[];
21extern char _dtb_start[], _dtb_end[];
22
23static void platform_fixups(void)
24{
25 void *soc;
26
27 dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
28 dt_fixup_mac_addresses(bd.bi_enetaddr, bd.bi_enet1addr,
29 bd.bi_enet2addr);
30 dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 8, bd.bi_busfreq);
31
32 /* Unfortunately, the specific model number is encoded in the
33 * soc node name in existing dts files -- once that is fixed,
34 * this can do a simple path lookup.
35 */
36 soc = find_node_by_devtype(NULL, "soc");
37 if (soc) {
38 void *serial = NULL;
39
40 setprop(soc, "bus-frequency", &bd.bi_busfreq,
41 sizeof(bd.bi_busfreq));
42
43 while ((serial = find_node_by_devtype(serial, "serial"))) {
44 if (get_parent(serial) != soc)
45 continue;
46
47 setprop(serial, "clock-frequency", &bd.bi_busfreq,
48 sizeof(bd.bi_busfreq));
49 }
50 }
51}
52
53void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
54 unsigned long r6, unsigned long r7)
55{
56 unsigned long end_of_ram = bd.bi_memstart + bd.bi_memsize;
57 unsigned long avail_ram = end_of_ram - (unsigned long)_end;
58
59 memcpy(&bd, (bd_t *)r3, sizeof(bd));
60 loader_info.initrd_addr = r4;
61 loader_info.initrd_size = r4 ? r5 : 0;
62 loader_info.cmdline = (char *)r6;
63 loader_info.cmdline_len = r7 - r6;
64
65 simple_alloc_init(_end, avail_ram - 1024*1024, 32, 64);
66 ft_init(_dtb_start, _dtb_end - _dtb_start, 32);
67 serial_console_init();
68 platform_ops.fixups = platform_fixups;
69}
diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
new file mode 100644
index 000000000000..c9951550ed2c
--- /dev/null
+++ b/arch/powerpc/boot/devtree.c
@@ -0,0 +1,307 @@
1/*
2 * devtree.c - convenience functions for device tree manipulation
3 * Copyright 2007 David Gibson, IBM Corporation.
4 * Copyright (c) 2007 Freescale Semiconductor, Inc.
5 *
6 * Authors: David Gibson <david@gibson.dropbear.id.au>
7 * Scott Wood <scottwood@freescale.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14#include <stdarg.h>
15#include <stddef.h>
16#include "types.h"
17#include "string.h"
18#include "stdio.h"
19#include "ops.h"
20
21void dt_fixup_memory(u64 start, u64 size)
22{
23 void *root, *memory;
24 int naddr, nsize, i;
25 u32 memreg[4];
26
27 root = finddevice("/");
28 if (getprop(root, "#address-cells", &naddr, sizeof(naddr)) < 0)
29 naddr = 2;
30 if (naddr < 1 || naddr > 2)
31 fatal("Can't cope with #address-cells == %d in /\n\r", naddr);
32
33 if (getprop(root, "#size-cells", &nsize, sizeof(nsize)) < 0)
34 nsize = 1;
35 if (nsize < 1 || nsize > 2)
36 fatal("Can't cope with #size-cells == %d in /\n\r", nsize);
37
38 i = 0;
39 if (naddr == 2)
40 memreg[i++] = start >> 32;
41 memreg[i++] = start & 0xffffffff;
42 if (nsize == 2)
43 memreg[i++] = size >> 32;
44 memreg[i++] = size & 0xffffffff;
45
46 memory = finddevice("/memory");
47 if (! memory) {
48 memory = create_node(NULL, "memory");
49 setprop_str(memory, "device_type", "memory");
50 }
51
52 printf("Memory <- <0x%x", memreg[0]);
53 for (i = 1; i < (naddr + nsize); i++)
54 printf(" 0x%x", memreg[i]);
55 printf("> (%ldMB)\n\r", (unsigned long)(size >> 20));
56
57 setprop(memory, "reg", memreg, (naddr + nsize)*sizeof(u32));
58}
59
60#define MHZ(x) ((x + 500000) / 1000000)
61
62void dt_fixup_cpu_clocks(u32 cpu, u32 tb, u32 bus)
63{
64 void *devp = NULL;
65
66 printf("CPU clock-frequency <- 0x%x (%dMHz)\n\r", cpu, MHZ(cpu));
67 printf("CPU timebase-frequency <- 0x%x (%dMHz)\n\r", tb, MHZ(tb));
68 if (bus > 0)
69 printf("CPU bus-frequency <- 0x%x (%dMHz)\n\r", bus, MHZ(bus));
70
71 while ((devp = find_node_by_devtype(devp, "cpu"))) {
72 setprop_val(devp, "clock-frequency", cpu);
73 setprop_val(devp, "timebase-frequency", tb);
74 if (bus > 0)
75 setprop_val(devp, "bus-frequency", bus);
76 }
77}
78
79void dt_fixup_clock(const char *path, u32 freq)
80{
81 void *devp = finddevice(path);
82
83 if (devp) {
84 printf("%s: clock-frequency <- %x (%dMHz)\n\r", path, freq, MHZ(freq));
85 setprop_val(devp, "clock-frequency", freq);
86 }
87}
88
89void __dt_fixup_mac_addresses(u32 startindex, ...)
90{
91 va_list ap;
92 u32 index = startindex;
93 void *devp;
94 const u8 *addr;
95
96 va_start(ap, startindex);
97 while ((addr = va_arg(ap, const u8 *))) {
98 devp = find_node_by_prop_value(NULL, "linux,network-index",
99 (void*)&index, sizeof(index));
100
101 printf("ENET%d: local-mac-address <-"
102 " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
103 addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
104
105 if (devp)
106 setprop(devp, "local-mac-address", addr, 6);
107
108 index++;
109 }
110 va_end(ap);
111}
112
113#define MAX_ADDR_CELLS 4
114#define MAX_RANGES 8
115
116static void get_reg_format(void *node, u32 *naddr, u32 *nsize)
117{
118 if (getprop(node, "#address-cells", naddr, 4) != 4)
119 *naddr = 2;
120 if (getprop(node, "#size-cells", nsize, 4) != 4)
121 *nsize = 1;
122}
123
124static void copy_val(u32 *dest, u32 *src, int naddr)
125{
126 int pad = MAX_ADDR_CELLS - naddr;
127
128 memset(dest, 0, pad * 4);
129 memcpy(dest + pad, src, naddr * 4);
130}
131
132static int sub_reg(u32 *reg, u32 *sub)
133{
134 int i, borrow = 0;
135
136 for (i = MAX_ADDR_CELLS - 1; i >= 0; i--) {
137 int prev_borrow = borrow;
138 borrow = reg[i] < sub[i] + prev_borrow;
139 reg[i] -= sub[i] + prev_borrow;
140 }
141
142 return !borrow;
143}
144
145static int add_reg(u32 *reg, u32 *add, int naddr)
146{
147 int i, carry = 0;
148
149 for (i = MAX_ADDR_CELLS - 1; i >= MAX_ADDR_CELLS - naddr; i--) {
150 u64 tmp = (u64)reg[i] + add[i] + carry;
151 carry = tmp >> 32;
152 reg[i] = (u32)tmp;
153 }
154
155 return !carry;
156}
157
158/* It is assumed that if the first byte of reg fits in a
159 * range, then the whole reg block fits.
160 */
161static int compare_reg(u32 *reg, u32 *range, u32 *rangesize)
162{
163 int i;
164 u32 end;
165
166 for (i = 0; i < MAX_ADDR_CELLS; i++) {
167 if (reg[i] < range[i])
168 return 0;
169 if (reg[i] > range[i])
170 break;
171 }
172
173 for (i = 0; i < MAX_ADDR_CELLS; i++) {
174 end = range[i] + rangesize[i];
175
176 if (reg[i] < end)
177 break;
178 if (reg[i] > end)
179 return 0;
180 }
181
182 return reg[i] != end;
183}
184
185/* reg must be MAX_ADDR_CELLS */
186static int find_range(u32 *reg, u32 *ranges, int nregaddr,
187 int naddr, int nsize, int buflen)
188{
189 int nrange = nregaddr + naddr + nsize;
190 int i;
191
192 for (i = 0; i + nrange <= buflen; i += nrange) {
193 u32 range_addr[MAX_ADDR_CELLS];
194 u32 range_size[MAX_ADDR_CELLS];
195
196 copy_val(range_addr, ranges + i, naddr);
197 copy_val(range_size, ranges + i + nregaddr + naddr, nsize);
198
199 if (compare_reg(reg, range_addr, range_size))
200 return i;
201 }
202
203 return -1;
204}
205
206/* Currently only generic buses without special encodings are supported.
207 * In particular, PCI is not supported. Also, only the beginning of the
208 * reg block is tracked; size is ignored except in ranges.
209 */
210static u32 dt_xlate_buf[MAX_ADDR_CELLS * MAX_RANGES * 3];
211
212static int dt_xlate(void *node, int res, int reglen, unsigned long *addr,
213 unsigned long *size)
214{
215 u32 last_addr[MAX_ADDR_CELLS];
216 u32 this_addr[MAX_ADDR_CELLS];
217 void *parent;
218 u64 ret_addr, ret_size;
219 u32 naddr, nsize, prev_naddr;
220 int buflen, offset;
221
222 parent = get_parent(node);
223 if (!parent)
224 return 0;
225
226 get_reg_format(parent, &naddr, &nsize);
227
228 if (nsize > 2)
229 return 0;
230
231 offset = (naddr + nsize) * res;
232
233 if (reglen < offset + naddr + nsize ||
234 sizeof(dt_xlate_buf) < offset + naddr + nsize)
235 return 0;
236
237 copy_val(last_addr, dt_xlate_buf + offset, naddr);
238
239 ret_size = dt_xlate_buf[offset + naddr];
240 if (nsize == 2) {
241 ret_size <<= 32;
242 ret_size |= dt_xlate_buf[offset + naddr + 1];
243 }
244
245 while ((node = get_parent(node))) {
246 prev_naddr = naddr;
247
248 get_reg_format(node, &naddr, &nsize);
249
250 buflen = getprop(node, "ranges", dt_xlate_buf,
251 sizeof(dt_xlate_buf));
252 if (buflen < 0)
253 continue;
254 if (buflen > sizeof(dt_xlate_buf))
255 return 0;
256
257 offset = find_range(last_addr, dt_xlate_buf, prev_naddr,
258 naddr, nsize, buflen / 4);
259
260 if (offset < 0)
261 return 0;
262
263 copy_val(this_addr, dt_xlate_buf + offset, prev_naddr);
264
265 if (!sub_reg(last_addr, this_addr))
266 return 0;
267
268 copy_val(this_addr, dt_xlate_buf + offset + prev_naddr, naddr);
269
270 if (!add_reg(last_addr, this_addr, naddr))
271 return 0;
272 }
273
274 if (naddr > 2)
275 return 0;
276
277 ret_addr = ((u64)last_addr[2] << 32) | last_addr[3];
278
279 if (sizeof(void *) == 4 &&
280 (ret_addr >= 0x100000000ULL || ret_size > 0x100000000ULL ||
281 ret_addr + ret_size > 0x100000000ULL))
282 return 0;
283
284 *addr = ret_addr;
285 if (size)
286 *size = ret_size;
287
288 return 1;
289}
290
291int dt_xlate_reg(void *node, int res, unsigned long *addr, unsigned long *size)
292{
293 int reglen;
294
295 reglen = getprop(node, "reg", dt_xlate_buf, sizeof(dt_xlate_buf)) / 4;
296 return dt_xlate(node, res, reglen, addr, size);
297}
298
299int dt_xlate_addr(void *node, u32 *buf, int buflen, unsigned long *xlated_addr)
300{
301
302 if (buflen > sizeof(dt_xlate_buf))
303 return 0;
304
305 memcpy(dt_xlate_buf, buf, buflen);
306 return dt_xlate(node, 0, buflen / 4, xlated_addr, NULL);
307}
diff --git a/arch/powerpc/boot/dts/kuroboxHD.dts b/arch/powerpc/boot/dts/kuroboxHD.dts
index b89791802e86..157dc98d3988 100644
--- a/arch/powerpc/boot/dts/kuroboxHD.dts
+++ b/arch/powerpc/boot/dts/kuroboxHD.dts
@@ -29,7 +29,6 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHD.dtb -V 16 kuroboxHD.dts"
29 29
30 cpus { 30 cpus {
31 linux,phandle = <2000>; 31 linux,phandle = <2000>;
32 #cpus = <1>;
33 #address-cells = <1>; 32 #address-cells = <1>;
34 #size-cells = <0>; 33 #size-cells = <0>;
35 34
@@ -126,17 +125,17 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHD.dtb -V 16 kuroboxHD.dts"
126 interrupt-parent = <4400>; 125 interrupt-parent = <4400>;
127 interrupt-map-mask = <f800 0 0 7>; 126 interrupt-map-mask = <f800 0 0 7>;
128 interrupt-map = < 127 interrupt-map = <
129 /* IDSEL 0x11 - IRQ0 ETH */ 128 /* IDSEL 11 - IRQ0 ETH */
130 5800 0 0 1 4400 0 1 129 5800 0 0 1 4400 0 1
131 5800 0 0 2 4400 1 1 130 5800 0 0 2 4400 1 1
132 5800 0 0 3 4400 2 1 131 5800 0 0 3 4400 2 1
133 5800 0 0 4 4400 3 1 132 5800 0 0 4 4400 3 1
134 /* IDSEL 0x12 - IRQ1 IDE0 */ 133 /* IDSEL 12 - IRQ1 IDE0 */
135 6000 0 0 1 4400 1 1 134 6000 0 0 1 4400 1 1
136 6000 0 0 2 4400 2 1 135 6000 0 0 2 4400 2 1
137 6000 0 0 3 4400 3 1 136 6000 0 0 3 4400 3 1
138 6000 0 0 4 4400 0 1 137 6000 0 0 4 4400 0 1
139 /* IDSEL 0x14 - IRQ3 USB2.0 */ 138 /* IDSEL 14 - IRQ3 USB2.0 */
140 7000 0 0 1 4400 3 1 139 7000 0 0 1 4400 3 1
141 7000 0 0 2 4400 3 1 140 7000 0 0 2 4400 3 1
142 7000 0 0 3 4400 3 1 141 7000 0 0 3 4400 3 1
diff --git a/arch/powerpc/boot/dts/kuroboxHG.dts b/arch/powerpc/boot/dts/kuroboxHG.dts
index 753102752d8b..919eb29097db 100644
--- a/arch/powerpc/boot/dts/kuroboxHG.dts
+++ b/arch/powerpc/boot/dts/kuroboxHG.dts
@@ -29,7 +29,6 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts"
29 29
30 cpus { 30 cpus {
31 linux,phandle = <2000>; 31 linux,phandle = <2000>;
32 #cpus = <1>;
33 #address-cells = <1>; 32 #address-cells = <1>;
34 #size-cells = <0>; 33 #size-cells = <0>;
35 34
@@ -126,17 +125,17 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts"
126 interrupt-parent = <4400>; 125 interrupt-parent = <4400>;
127 interrupt-map-mask = <f800 0 0 7>; 126 interrupt-map-mask = <f800 0 0 7>;
128 interrupt-map = < 127 interrupt-map = <
129 /* IDSEL 0x11 - IRQ0 ETH */ 128 /* IDSEL 11 - IRQ0 ETH */
130 5800 0 0 1 4400 0 1 129 5800 0 0 1 4400 0 1
131 5800 0 0 2 4400 1 1 130 5800 0 0 2 4400 1 1
132 5800 0 0 3 4400 2 1 131 5800 0 0 3 4400 2 1
133 5800 0 0 4 4400 3 1 132 5800 0 0 4 4400 3 1
134 /* IDSEL 0x12 - IRQ1 IDE0 */ 133 /* IDSEL 12 - IRQ1 IDE0 */
135 6000 0 0 1 4400 1 1 134 6000 0 0 1 4400 1 1
136 6000 0 0 2 4400 2 1 135 6000 0 0 2 4400 2 1
137 6000 0 0 3 4400 3 1 136 6000 0 0 3 4400 3 1
138 6000 0 0 4 4400 0 1 137 6000 0 0 4 4400 0 1
139 /* IDSEL 0x14 - IRQ3 USB2.0 */ 138 /* IDSEL 14 - IRQ3 USB2.0 */
140 7000 0 0 1 4400 3 1 139 7000 0 0 1 4400 3 1
141 7000 0 0 2 4400 3 1 140 7000 0 0 2 4400 3 1
142 7000 0 0 3 4400 3 1 141 7000 0 0 3 4400 3 1
diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts
index c03103c63285..ba54c6b40a09 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -24,7 +24,6 @@
24 #size-cells = <1>; 24 #size-cells = <1>;
25 25
26 cpus { 26 cpus {
27 #cpus = <1>;
28 #address-cells = <1>; 27 #address-cells = <1>;
29 #size-cells = <0>; 28 #size-cells = <0>;
30 29
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
index 3875ca9a9a62..2e003081b0d3 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -24,7 +24,6 @@
24 #size-cells = <1>; 24 #size-cells = <1>;
25 25
26 cpus { 26 cpus {
27 #cpus = <1>;
28 #address-cells = <1>; 27 #address-cells = <1>;
29 #size-cells = <0>; 28 #size-cells = <0>;
30 29
diff --git a/arch/powerpc/boot/dts/mpc7448hpc2.dts b/arch/powerpc/boot/dts/mpc7448hpc2.dts
index 41d0720c5900..6fa3754f293a 100644
--- a/arch/powerpc/boot/dts/mpc7448hpc2.dts
+++ b/arch/powerpc/boot/dts/mpc7448hpc2.dts
@@ -19,7 +19,6 @@
19 linux,phandle = <100>; 19 linux,phandle = <100>;
20 20
21 cpus { 21 cpus {
22 #cpus = <1>;
23 #address-cells = <1>; 22 #address-cells = <1>;
24 #size-cells =<0>; 23 #size-cells =<0>;
25 linux,phandle = <200>; 24 linux,phandle = <200>;
diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts
index 260b2e447779..423eedcf634f 100644
--- a/arch/powerpc/boot/dts/mpc8272ads.dts
+++ b/arch/powerpc/boot/dts/mpc8272ads.dts
@@ -17,7 +17,6 @@
17 linux,phandle = <100>; 17 linux,phandle = <100>;
18 18
19 cpus { 19 cpus {
20 #cpus = <1>;
21 #address-cells = <1>; 20 #address-cells = <1>;
22 #size-cells = <0>; 21 #size-cells = <0>;
23 linux,phandle = <200>; 22 linux,phandle = <200>;
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 6d721900d00e..a1533cc07d09 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -16,7 +16,6 @@
16 #size-cells = <1>; 16 #size-cells = <1>;
17 17
18 cpus { 18 cpus {
19 #cpus = <1>;
20 #address-cells = <1>; 19 #address-cells = <1>;
21 #size-cells = <0>; 20 #size-cells = <0>;
22 21
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 06b310698a02..c798491f4cd0 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -16,7 +16,6 @@
16 #size-cells = <1>; 16 #size-cells = <1>;
17 17
18 cpus { 18 cpus {
19 #cpus = <1>;
20 #address-cells = <1>; 19 #address-cells = <1>;
21 #size-cells = <0>; 20 #size-cells = <0>;
22 21
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
new file mode 100644
index 000000000000..b55bced1593d
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -0,0 +1,291 @@
1/*
2 * MPC832x RDB Device Tree Source
3 *
4 * Copyright 2007 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12/ {
13 model = "MPC8323ERDB";
14 compatible = "MPC8323ERDB", "MPC832xRDB", "MPC83xxRDB";
15 #address-cells = <1>;
16 #size-cells = <1>;
17
18 cpus {
19 #address-cells = <1>;
20 #size-cells = <0>;
21
22 PowerPC,8323@0 {
23 device_type = "cpu";
24 reg = <0>;
25 d-cache-line-size = <20>; // 32 bytes
26 i-cache-line-size = <20>; // 32 bytes
27 d-cache-size = <4000>; // L1, 16K
28 i-cache-size = <4000>; // L1, 16K
29 timebase-frequency = <0>;
30 bus-frequency = <0>;
31 clock-frequency = <0>;
32 32-bit;
33 };
34 };
35
36 memory {
37 device_type = "memory";
38 reg = <00000000 04000000>;
39 };
40
41 soc8323@e0000000 {
42 #address-cells = <1>;
43 #size-cells = <1>;
44 #interrupt-cells = <2>;
45 device_type = "soc";
46 ranges = <0 e0000000 00100000>;
47 reg = <e0000000 00000200>;
48 bus-frequency = <0>;
49
50 wdt@200 {
51 device_type = "watchdog";
52 compatible = "mpc83xx_wdt";
53 reg = <200 100>;
54 };
55
56 i2c@3000 {
57 device_type = "i2c";
58 compatible = "fsl-i2c";
59 reg = <3000 100>;
60 interrupts = <e 8>;
61 interrupt-parent = <&pic>;
62 dfsrr;
63 };
64
65 serial@4500 {
66 device_type = "serial";
67 compatible = "ns16550";
68 reg = <4500 100>;
69 clock-frequency = <0>;
70 interrupts = <9 8>;
71 interrupt-parent = <&pic>;
72 };
73
74 serial@4600 {
75 device_type = "serial";
76 compatible = "ns16550";
77 reg = <4600 100>;
78 clock-frequency = <0>;
79 interrupts = <a 8>;
80 interrupt-parent = <&pic>;
81 };
82
83 crypto@30000 {
84 device_type = "crypto";
85 model = "SEC2";
86 compatible = "talitos";
87 reg = <30000 7000>;
88 interrupts = <b 8>;
89 interrupt-parent = <&pic>;
90 /* Rev. 2.2 */
91 num-channels = <1>;
92 channel-fifo-len = <18>;
93 exec-units-mask = <0000004c>;
94 descriptor-types-mask = <0122003f>;
95 };
96
97 pci@8500 {
98 interrupt-map-mask = <f800 0 0 7>;
99 interrupt-map = <
100 /* IDSEL 0x10 AD16 (USB) */
101 8000 0 0 1 &pic 11 8
102
103 /* IDSEL 0x11 AD17 (Mini1)*/
104 8800 0 0 1 &pic 12 8
105 8800 0 0 2 &pic 13 8
106 8800 0 0 3 &pic 14 8
107 8800 0 0 4 &pic 30 8
108
109 /* IDSEL 0x12 AD18 (PCI/Mini2) */
110 9000 0 0 1 &pic 13 8
111 9000 0 0 2 &pic 14 8
112 9000 0 0 3 &pic 30 8
113 9000 0 0 4 &pic 11 8>;
114
115 interrupt-parent = <&pic>;
116 interrupts = <42 8>;
117 bus-range = <0 0>;
118 ranges = <42000000 0 80000000 80000000 0 10000000
119 02000000 0 90000000 90000000 0 10000000
120 01000000 0 d0000000 d0000000 0 04000000>;
121 clock-frequency = <0>;
122 #interrupt-cells = <1>;
123 #size-cells = <2>;
124 #address-cells = <3>;
125 reg = <8500 100>;
126 compatible = "83xx";
127 device_type = "pci";
128 };
129
130 pic:pic@700 {
131 interrupt-controller;
132 #address-cells = <0>;
133 #interrupt-cells = <2>;
134 reg = <700 100>;
135 built-in;
136 device_type = "ipic";
137 };
138
139 par_io@1400 {
140 reg = <1400 100>;
141 device_type = "par_io";
142 num-ports = <7>;
143
144 ucc2pio:ucc_pin@02 {
145 pio-map = <
146 /* port pin dir open_drain assignment has_irq */
147 3 4 3 0 2 0 /* MDIO */
148 3 5 1 0 2 0 /* MDC */
149 3 15 2 0 1 0 /* RX_CLK (CLK16) */
150 3 17 2 0 1 0 /* TX_CLK (CLK3) */
151 0 12 1 0 1 0 /* TxD0 */
152 0 13 1 0 1 0 /* TxD1 */
153 0 14 1 0 1 0 /* TxD2 */
154 0 15 1 0 1 0 /* TxD3 */
155 0 16 2 0 1 0 /* RxD0 */
156 0 17 2 0 1 0 /* RxD1 */
157 0 18 2 0 1 0 /* RxD2 */
158 0 19 2 0 1 0 /* RxD3 */
159 0 1a 2 0 1 0 /* RX_ER */
160 0 1b 1 0 1 0 /* TX_ER */
161 0 1c 2 0 1 0 /* RX_DV */
162 0 1d 2 0 1 0 /* COL */
163 0 1e 1 0 1 0 /* TX_EN */
164 0 1f 2 0 1 0>; /* CRS */
165 };
166 ucc3pio:ucc_pin@03 {
167 pio-map = <
168 /* port pin dir open_drain assignment has_irq */
169 0 d 2 0 1 0 /* RX_CLK (CLK9) */
170 3 18 2 0 1 0 /* TX_CLK (CLK10) */
171 1 0 1 0 1 0 /* TxD0 */
172 1 1 1 0 1 0 /* TxD1 */
173 1 2 1 0 1 0 /* TxD2 */
174 1 3 1 0 1 0 /* TxD3 */
175 1 4 2 0 1 0 /* RxD0 */
176 1 5 2 0 1 0 /* RxD1 */
177 1 6 2 0 1 0 /* RxD2 */
178 1 7 2 0 1 0 /* RxD3 */
179 1 8 2 0 1 0 /* RX_ER */
180 1 9 1 0 1 0 /* TX_ER */
181 1 a 2 0 1 0 /* RX_DV */
182 1 b 2 0 1 0 /* COL */
183 1 c 1 0 1 0 /* TX_EN */
184 1 d 2 0 1 0>; /* CRS */
185 };
186 };
187 };
188
189 qe@e0100000 {
190 #address-cells = <1>;
191 #size-cells = <1>;
192 device_type = "qe";
193 model = "QE";
194 ranges = <0 e0100000 00100000>;
195 reg = <e0100000 480>;
196 brg-frequency = <0>;
197 bus-frequency = <BCD3D80>;
198
199 muram@10000 {
200 device_type = "muram";
201 ranges = <0 00010000 00004000>;
202
203 data-only@0 {
204 reg = <0 4000>;
205 };
206 };
207
208 spi@4c0 {
209 device_type = "spi";
210 compatible = "fsl_spi";
211 reg = <4c0 40>;
212 interrupts = <2>;
213 interrupt-parent = <&qeic>;
214 mode = "cpu";
215 };
216
217 spi@500 {
218 device_type = "spi";
219 compatible = "fsl_spi";
220 reg = <500 40>;
221 interrupts = <1>;
222 interrupt-parent = <&qeic>;
223 mode = "cpu";
224 };
225
226 ucc@3000 {
227 device_type = "network";
228 compatible = "ucc_geth";
229 model = "UCC";
230 device-id = <2>;
231 reg = <3000 200>;
232 interrupts = <21>;
233 interrupt-parent = <&qeic>;
234 mac-address = [ 00 04 9f ef 03 02 ];
235 rx-clock = <20>;
236 tx-clock = <13>;
237 phy-handle = <&phy00>;
238 pio-handle = <&ucc2pio>;
239 };
240
241 ucc@2200 {
242 device_type = "network";
243 compatible = "ucc_geth";
244 model = "UCC";
245 device-id = <3>;
246 reg = <2200 200>;
247 interrupts = <22>;
248 interrupt-parent = <&qeic>;
249 mac-address = [ 00 04 9f ef 03 01 ];
250 rx-clock = <19>;
251 tx-clock = <1a>;
252 phy-handle = <&phy04>;
253 pio-handle = <&ucc3pio>;
254 };
255
256 mdio@3120 {
257 #address-cells = <1>;
258 #size-cells = <0>;
259 reg = <3120 18>;
260 device_type = "mdio";
261 compatible = "ucc_geth_phy";
262
263 phy00:ethernet-phy@00 {
264 interrupt-parent = <&pic>;
265 interrupts = <0>;
266 reg = <0>;
267 device_type = "ethernet-phy";
268 interface = <3>; //ENET_100_MII
269 };
270 phy04:ethernet-phy@04 {
271 interrupt-parent = <&pic>;
272 interrupts = <0>;
273 reg = <4>;
274 device_type = "ethernet-phy";
275 interface = <3>;
276 };
277 };
278
279 qeic:qeic@80 {
280 interrupt-controller;
281 device_type = "qeic";
282 #address-cells = <0>;
283 #interrupt-cells = <1>;
284 reg = <80 80>;
285 built-in;
286 big-endian;
287 interrupts = <20 8 21 8>; //high:32 low:33
288 interrupt-parent = <&pic>;
289 };
290 };
291};
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 61b550bf1645..db0d00303275 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -15,7 +15,6 @@
15 #size-cells = <1>; 15 #size-cells = <1>;
16 16
17 cpus { 17 cpus {
18 #cpus = <1>;
19 #address-cells = <1>; 18 #address-cells = <1>;
20 #size-cells = <0>; 19 #size-cells = <0>;
21 20
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index b2e1a5ec3779..f636528a3c72 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -15,7 +15,6 @@
15 #size-cells = <1>; 15 #size-cells = <1>;
16 16
17 cpus { 17 cpus {
18 #cpus = <1>;
19 #address-cells = <1>; 18 #address-cells = <1>;
20 #size-cells = <0>; 19 #size-cells = <0>;
21 20
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index e4b43c24bc0b..07bcc5194d2b 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -16,7 +16,6 @@
16 #size-cells = <1>; 16 #size-cells = <1>;
17 17
18 cpus { 18 cpus {
19 #cpus = <1>;
20 #address-cells = <1>; 19 #address-cells = <1>;
21 #size-cells = <0>; 20 #size-cells = <0>;
22 21
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 4fe45c021848..7f578eb57082 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -21,7 +21,6 @@
21 #size-cells = <1>; 21 #size-cells = <1>;
22 22
23 cpus { 23 cpus {
24 #cpus = <1>;
25 #address-cells = <1>; 24 #address-cells = <1>;
26 #size-cells = <0>; 25 #size-cells = <0>;
27 26
diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index 3c0917fa791c..f261d647ac85 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -17,7 +17,6 @@
17 #size-cells = <1>; 17 #size-cells = <1>;
18 18
19 cpus { 19 cpus {
20 #cpus = <1>;
21 #address-cells = <1>; 20 #address-cells = <1>;
22 #size-cells = <0>; 21 #size-cells = <0>;
23 22
diff --git a/arch/powerpc/boot/dts/mpc8541cds.dts b/arch/powerpc/boot/dts/mpc8541cds.dts
index 2a1ae760ab3a..5fdcb69554f2 100644
--- a/arch/powerpc/boot/dts/mpc8541cds.dts
+++ b/arch/powerpc/boot/dts/mpc8541cds.dts
@@ -17,7 +17,6 @@
17 #size-cells = <1>; 17 #size-cells = <1>;
18 18
19 cpus { 19 cpus {
20 #cpus = <1>;
21 #address-cells = <1>; 20 #address-cells = <1>;
22 #size-cells = <0>; 21 #size-cells = <0>;
23 22
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
new file mode 100644
index 000000000000..6b084605bb4b
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -0,0 +1,136 @@
1/*
2 * MPC8544 DS Device Tree Source
3 *
4 * Copyright 2007 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12/ {
13 model = "MPC8544DS";
14 compatible = "MPC8544DS", "MPC85xxDS";
15 #address-cells = <1>;
16 #size-cells = <1>;
17
18 cpus {
19 #cpus = <1>;
20 #address-cells = <1>;
21 #size-cells = <0>;
22
23 PowerPC,8544@0 {
24 device_type = "cpu";
25 reg = <0>;
26 d-cache-line-size = <20>; // 32 bytes
27 i-cache-line-size = <20>; // 32 bytes
28 d-cache-size = <8000>; // L1, 32K
29 i-cache-size = <8000>; // L1, 32K
30 timebase-frequency = <0>;
31 bus-frequency = <0>;
32 clock-frequency = <0>;
33 32-bit;
34 };
35 };
36
37 memory {
38 device_type = "memory";
39 reg = <00000000 00000000>; // Filled by U-Boot
40 };
41
42 soc8544@e0000000 {
43 #address-cells = <1>;
44 #size-cells = <1>;
45 #interrupt-cells = <2>;
46 device_type = "soc";
47 ranges = <0 e0000000 00100000>;
48 reg = <e0000000 00100000>; // CCSRBAR 1M
49 bus-frequency = <0>; // Filled out by uboot.
50
51 i2c@3000 {
52 device_type = "i2c";
53 compatible = "fsl-i2c";
54 reg = <3000 100>;
55 interrupts = <1b 2>;
56 interrupt-parent = <&mpic>;
57 dfsrr;
58 };
59
60 mdio@24520 {
61 #address-cells = <1>;
62 #size-cells = <0>;
63 device_type = "mdio";
64 compatible = "gianfar";
65 reg = <24520 20>;
66 phy0: ethernet-phy@0 {
67 interrupt-parent = <&mpic>;
68 interrupts = <3a 1>;
69 reg = <0>;
70 device_type = "ethernet-phy";
71 };
72 phy1: ethernet-phy@1 {
73 interrupt-parent = <&mpic>;
74 interrupts = <3a 1>;
75 reg = <1>;
76 device_type = "ethernet-phy";
77 };
78 };
79
80 ethernet@24000 {
81 #address-cells = <1>;
82 #size-cells = <0>;
83 device_type = "network";
84 model = "TSEC";
85 compatible = "gianfar";
86 reg = <24000 1000>;
87 local-mac-address = [ 00 00 00 00 00 00 ];
88 interrupts = <d 2 e 2 12 2>;
89 interrupt-parent = <&mpic>;
90 phy-handle = <&phy0>;
91 };
92
93 ethernet@26000 {
94 #address-cells = <1>;
95 #size-cells = <0>;
96 device_type = "network";
97 model = "TSEC";
98 compatible = "gianfar";
99 reg = <26000 1000>;
100 local-mac-address = [ 00 00 00 00 00 00 ];
101 interrupts = <f 2 10 2 11 2>;
102 interrupt-parent = <&mpic>;
103 phy-handle = <&phy1>;
104 };
105
106 serial@4500 {
107 device_type = "serial";
108 compatible = "ns16550";
109 reg = <4500 100>;
110 clock-frequency = <0>;
111 interrupts = <1a 2>;
112 interrupt-parent = <&mpic>;
113 };
114
115 serial@4600 {
116 device_type = "serial";
117 compatible = "ns16550";
118 reg = <4600 100>;
119 clock-frequency = <0>;
120 interrupts = <1a 2>;
121 interrupt-parent = <&mpic>;
122 };
123
124 mpic: pic@40000 {
125 clock-frequency = <0>;
126 interrupt-controller;
127 #address-cells = <0>;
128 #interrupt-cells = <2>;
129 reg = <40000 40000>;
130 built-in;
131 compatible = "chrp,open-pic";
132 device_type = "open-pic";
133 big-endian;
134 };
135 };
136};
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dts b/arch/powerpc/boot/dts/mpc8548cds.dts
index 7eb5d81d5eec..b2b2200d0425 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds.dts
@@ -17,7 +17,6 @@
17 #size-cells = <1>; 17 #size-cells = <1>;
18 18
19 cpus { 19 cpus {
20 #cpus = <1>;
21 #address-cells = <1>; 20 #address-cells = <1>;
22 #size-cells = <0>; 21 #size-cells = <0>;
23 22
diff --git a/arch/powerpc/boot/dts/mpc8555cds.dts b/arch/powerpc/boot/dts/mpc8555cds.dts
index 5f9c102a0ab4..68a4795720dc 100644
--- a/arch/powerpc/boot/dts/mpc8555cds.dts
+++ b/arch/powerpc/boot/dts/mpc8555cds.dts
@@ -17,7 +17,6 @@
17 #size-cells = <1>; 17 #size-cells = <1>;
18 18
19 cpus { 19 cpus {
20 #cpus = <1>;
21 #address-cells = <1>; 20 #address-cells = <1>;
22 #size-cells = <0>; 21 #size-cells = <0>;
23 22
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index 10502638b0e9..1f2afe9291d2 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -17,7 +17,6 @@
17 #size-cells = <1>; 17 #size-cells = <1>;
18 18
19 cpus { 19 cpus {
20 #cpus = <1>;
21 #address-cells = <1>; 20 #address-cells = <1>;
22 #size-cells = <0>; 21 #size-cells = <0>;
23 22
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index bf49d8c997b9..7361b36749cb 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -21,7 +21,6 @@
21 #size-cells = <1>; 21 #size-cells = <1>;
22 22
23 cpus { 23 cpus {
24 #cpus = <1>;
25 #address-cells = <1>; 24 #address-cells = <1>;
26 #size-cells = <0>; 25 #size-cells = <0>;
27 26
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
index 8a4995a85ba0..260b264c869e 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -17,7 +17,6 @@
17 #size-cells = <1>; 17 #size-cells = <1>;
18 18
19 cpus { 19 cpus {
20 #cpus = <2>;
21 #address-cells = <1>; 20 #address-cells = <1>;
22 #size-cells = <0>; 21 #size-cells = <0>;
23 22
@@ -300,6 +299,30 @@
300 }; 299 };
301 300
302 }; 301 };
302
303 pci@9000 {
304 compatible = "86xx";
305 device_type = "pci";
306 #interrupt-cells = <1>;
307 #size-cells = <2>;
308 #address-cells = <3>;
309 reg = <9000 1000>;
310 bus-range = <0 ff>;
311 ranges = <02000000 0 a0000000 a0000000 0 20000000
312 01000000 0 00000000 e3000000 0 00100000>;
313 clock-frequency = <1fca055>;
314 interrupt-parent = <&mpic>;
315 interrupts = <19 2>;
316 interrupt-map-mask = <f800 0 0 7>;
317 interrupt-map = <
318 /* IDSEL 0x0 */
319 0000 0 0 1 &mpic 44 1
320 0000 0 0 2 &mpic 45 1
321 0000 0 0 3 &mpic 46 1
322 0000 0 0 4 &mpic 47 1
323 >;
324 };
325
303 mpic: pic@40000 { 326 mpic: pic@40000 {
304 clock-frequency = <0>; 327 clock-frequency = <0>;
305 interrupt-controller; 328 interrupt-controller;
diff --git a/arch/powerpc/boot/dts/mpc866ads.dts b/arch/powerpc/boot/dts/mpc866ads.dts
index 2b56b5df451a..c0d06fd12927 100644
--- a/arch/powerpc/boot/dts/mpc866ads.dts
+++ b/arch/powerpc/boot/dts/mpc866ads.dts
@@ -18,7 +18,6 @@
18 linux,phandle = <100>; 18 linux,phandle = <100>;
19 19
20 cpus { 20 cpus {
21 #cpus = <1>;
22 #address-cells = <1>; 21 #address-cells = <1>;
23 #size-cells = <0>; 22 #size-cells = <0>;
24 linux,phandle = <200>; 23 linux,phandle = <200>;
diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts
index faecd08c54da..110bf6170603 100644
--- a/arch/powerpc/boot/dts/mpc885ads.dts
+++ b/arch/powerpc/boot/dts/mpc885ads.dts
@@ -18,7 +18,6 @@
18 linux,phandle = <100>; 18 linux,phandle = <100>;
19 19
20 cpus { 20 cpus {
21 #cpus = <1>;
22 #address-cells = <1>; 21 #address-cells = <1>;
23 #size-cells = <0>; 22 #size-cells = <0>;
24 linux,phandle = <200>; 23 linux,phandle = <200>;
diff --git a/arch/powerpc/boot/elf.h b/arch/powerpc/boot/elf.h
index d4828fcf1cb9..1941bc50d4c5 100644
--- a/arch/powerpc/boot/elf.h
+++ b/arch/powerpc/boot/elf.h
@@ -146,4 +146,12 @@ typedef struct elf64_phdr {
146#define ELFOSABI_NONE 0 146#define ELFOSABI_NONE 0
147#define ELFOSABI_LINUX 3 147#define ELFOSABI_LINUX 3
148 148
149struct elf_info {
150 unsigned long loadsize;
151 unsigned long memsize;
152 unsigned long elfoffset;
153};
154int parse_elf64(void *hdr, struct elf_info *info);
155int parse_elf32(void *hdr, struct elf_info *info);
156
149#endif /* _PPC_BOOT_ELF_H_ */ 157#endif /* _PPC_BOOT_ELF_H_ */
diff --git a/arch/powerpc/boot/elf_util.c b/arch/powerpc/boot/elf_util.c
new file mode 100644
index 000000000000..7454aa4cc20c
--- /dev/null
+++ b/arch/powerpc/boot/elf_util.c
@@ -0,0 +1,76 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * Updates for PPC64 by Todd Inglett, Dave Engebretsen & Peter Bergner.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <stdarg.h>
12#include <stddef.h>
13#include "elf.h"
14#include "page.h"
15#include "string.h"
16#include "stdio.h"
17
18int parse_elf64(void *hdr, struct elf_info *info)
19{
20 Elf64_Ehdr *elf64 = hdr;
21 Elf64_Phdr *elf64ph;
22 unsigned int i;
23
24 if (!(elf64->e_ident[EI_MAG0] == ELFMAG0 &&
25 elf64->e_ident[EI_MAG1] == ELFMAG1 &&
26 elf64->e_ident[EI_MAG2] == ELFMAG2 &&
27 elf64->e_ident[EI_MAG3] == ELFMAG3 &&
28 elf64->e_ident[EI_CLASS] == ELFCLASS64 &&
29 elf64->e_ident[EI_DATA] == ELFDATA2MSB &&
30 elf64->e_type == ET_EXEC &&
31 elf64->e_machine == EM_PPC64))
32 return 0;
33
34 elf64ph = (Elf64_Phdr *)((unsigned long)elf64 +
35 (unsigned long)elf64->e_phoff);
36 for (i = 0; i < (unsigned int)elf64->e_phnum; i++, elf64ph++)
37 if (elf64ph->p_type == PT_LOAD)
38 break;
39 if (i >= (unsigned int)elf64->e_phnum)
40 return 0;
41
42 info->loadsize = (unsigned long)elf64ph->p_filesz;
43 info->memsize = (unsigned long)elf64ph->p_memsz;
44 info->elfoffset = (unsigned long)elf64ph->p_offset;
45
46 return 1;
47}
48
49int parse_elf32(void *hdr, struct elf_info *info)
50{
51 Elf32_Ehdr *elf32 = hdr;
52 Elf32_Phdr *elf32ph;
53 unsigned int i;
54
55 if (!(elf32->e_ident[EI_MAG0] == ELFMAG0 &&
56 elf32->e_ident[EI_MAG1] == ELFMAG1 &&
57 elf32->e_ident[EI_MAG2] == ELFMAG2 &&
58 elf32->e_ident[EI_MAG3] == ELFMAG3 &&
59 elf32->e_ident[EI_CLASS] == ELFCLASS32 &&
60 elf32->e_ident[EI_DATA] == ELFDATA2MSB &&
61 elf32->e_type == ET_EXEC &&
62 elf32->e_machine == EM_PPC))
63 return 0;
64
65 elf32ph = (Elf32_Phdr *) ((unsigned long)elf32 + elf32->e_phoff);
66 for (i = 0; i < elf32->e_phnum; i++, elf32ph++)
67 if (elf32ph->p_type == PT_LOAD)
68 break;
69 if (i >= elf32->e_phnum)
70 return 0;
71
72 info->loadsize = elf32ph->p_filesz;
73 info->memsize = elf32ph->p_memsz;
74 info->elfoffset = elf32ph->p_offset;
75 return 1;
76}
diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index c76c194715b2..d00fbd92a458 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -29,12 +29,20 @@
29 29
30#define _ALIGN(x, al) (((x) + (al) - 1) & ~((al) - 1)) 30#define _ALIGN(x, al) (((x) + (al) - 1) & ~((al) - 1))
31 31
32static char *ft_root_node(struct ft_cxt *cxt)
33{
34 return cxt->rgn[FT_STRUCT].start;
35}
36
32/* Routines for keeping node ptrs returned by ft_find_device current */ 37/* Routines for keeping node ptrs returned by ft_find_device current */
33/* First entry not used b/c it would return 0 and be taken as NULL/error */ 38/* First entry not used b/c it would return 0 and be taken as NULL/error */
34static void *ft_node_add(struct ft_cxt *cxt, char *node) 39static void *ft_get_phandle(struct ft_cxt *cxt, char *node)
35{ 40{
36 unsigned int i; 41 unsigned int i;
37 42
43 if (!node)
44 return NULL;
45
38 for (i = 1; i < cxt->nodes_used; i++) /* already there? */ 46 for (i = 1; i < cxt->nodes_used; i++) /* already there? */
39 if (cxt->node_tbl[i] == node) 47 if (cxt->node_tbl[i] == node)
40 return (void *)i; 48 return (void *)i;
@@ -238,7 +246,7 @@ static int ft_shuffle(struct ft_cxt *cxt, char **pp, enum ft_rgn_id rgn,
238 if (rgn == FT_STRUCT) 246 if (rgn == FT_STRUCT)
239 ft_node_update_before(cxt, p, -nextra); 247 ft_node_update_before(cxt, p, -nextra);
240 } 248 }
241 *p -= nextra; 249 *pp -= nextra;
242 cxt->rgn[rgn].start -= nextra; 250 cxt->rgn[rgn].start -= nextra;
243 cxt->rgn[rgn].size += nextra; 251 cxt->rgn[rgn].size += nextra;
244 return 1; 252 return 1;
@@ -253,8 +261,14 @@ static int ft_make_space(struct ft_cxt *cxt, char **pp, enum ft_rgn_id rgn,
253 char *str, *next; 261 char *str, *next;
254 enum ft_rgn_id r; 262 enum ft_rgn_id r;
255 263
256 if (!cxt->isordered && !ft_reorder(cxt, nextra)) 264 if (!cxt->isordered) {
257 return 0; 265 unsigned long rgn_off = *pp - cxt->rgn[rgn].start;
266
267 if (!ft_reorder(cxt, nextra))
268 return 0;
269
270 *pp = cxt->rgn[rgn].start + rgn_off;
271 }
258 if (ft_shuffle(cxt, pp, rgn, nextra)) 272 if (ft_shuffle(cxt, pp, rgn, nextra))
259 return 1; 273 return 1;
260 274
@@ -415,7 +429,7 @@ int ft_prop(struct ft_cxt *cxt, const char *name, const void *data,
415{ 429{
416 int off, len; 430 int off, len;
417 431
418 off = lookup_string(cxt, name); 432 off = map_string(cxt, name);
419 if (off == NO_STRING) 433 if (off == NO_STRING)
420 return -1; 434 return -1;
421 435
@@ -590,7 +604,7 @@ int ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size)
590 604
591void ft_begin_tree(struct ft_cxt *cxt) 605void ft_begin_tree(struct ft_cxt *cxt)
592{ 606{
593 cxt->p = cxt->rgn[FT_STRUCT].start; 607 cxt->p = ft_root_node(cxt);
594} 608}
595 609
596void ft_end_tree(struct ft_cxt *cxt) 610void ft_end_tree(struct ft_cxt *cxt)
@@ -636,8 +650,21 @@ void *ft_find_device(struct ft_cxt *cxt, const char *srch_path)
636 /* require absolute path */ 650 /* require absolute path */
637 if (srch_path[0] != '/') 651 if (srch_path[0] != '/')
638 return NULL; 652 return NULL;
639 node = ft_find_descendent(cxt, cxt->rgn[FT_STRUCT].start, srch_path); 653 node = ft_find_descendent(cxt, ft_root_node(cxt), srch_path);
640 return ft_node_add(cxt, node); 654 return ft_get_phandle(cxt, node);
655}
656
657void *ft_find_device_rel(struct ft_cxt *cxt, const void *top,
658 const char *srch_path)
659{
660 char *node;
661
662 node = ft_node_ph2node(cxt, top);
663 if (node == NULL)
664 return NULL;
665
666 node = ft_find_descendent(cxt, node, srch_path);
667 return ft_get_phandle(cxt, node);
641} 668}
642 669
643void *ft_find_descendent(struct ft_cxt *cxt, void *top, const char *srch_path) 670void *ft_find_descendent(struct ft_cxt *cxt, void *top, const char *srch_path)
@@ -701,23 +728,18 @@ void *ft_find_descendent(struct ft_cxt *cxt, void *top, const char *srch_path)
701 return NULL; 728 return NULL;
702} 729}
703 730
704void *ft_get_parent(struct ft_cxt *cxt, const void *phandle) 731void *__ft_get_parent(struct ft_cxt *cxt, void *node)
705{ 732{
706 void *node;
707 int d; 733 int d;
708 struct ft_atom atom; 734 struct ft_atom atom;
709 char *p; 735 char *p;
710 736
711 node = ft_node_ph2node(cxt, phandle);
712 if (node == NULL)
713 return NULL;
714
715 for (d = 0; cxt->genealogy[d] != NULL; ++d) 737 for (d = 0; cxt->genealogy[d] != NULL; ++d)
716 if (cxt->genealogy[d] == node) 738 if (cxt->genealogy[d] == node)
717 return cxt->genealogy[d > 0 ? d - 1 : 0]; 739 return d > 0 ? cxt->genealogy[d - 1] : NULL;
718 740
719 /* have to do it the hard way... */ 741 /* have to do it the hard way... */
720 p = cxt->rgn[FT_STRUCT].start; 742 p = ft_root_node(cxt);
721 d = 0; 743 d = 0;
722 while ((p = ft_next(cxt, p, &atom)) != NULL) { 744 while ((p = ft_next(cxt, p, &atom)) != NULL) {
723 switch (atom.tag) { 745 switch (atom.tag) {
@@ -726,7 +748,7 @@ void *ft_get_parent(struct ft_cxt *cxt, const void *phandle)
726 if (node == atom.data) { 748 if (node == atom.data) {
727 /* found it */ 749 /* found it */
728 cxt->genealogy[d + 1] = NULL; 750 cxt->genealogy[d + 1] = NULL;
729 return d > 0 ? cxt->genealogy[d - 1] : node; 751 return d > 0 ? cxt->genealogy[d - 1] : NULL;
730 } 752 }
731 ++d; 753 ++d;
732 break; 754 break;
@@ -738,41 +760,131 @@ void *ft_get_parent(struct ft_cxt *cxt, const void *phandle)
738 return NULL; 760 return NULL;
739} 761}
740 762
741int ft_get_prop(struct ft_cxt *cxt, const void *phandle, const char *propname, 763void *ft_get_parent(struct ft_cxt *cxt, const void *phandle)
742 void *buf, const unsigned int buflen)
743{ 764{
744 struct ft_atom atom; 765 void *node = ft_node_ph2node(cxt, phandle);
745 void *node;
746 char *p;
747 int depth;
748 unsigned int size;
749
750 node = ft_node_ph2node(cxt, phandle);
751 if (node == NULL) 766 if (node == NULL)
752 return -1; 767 return NULL;
753 768
754 depth = 0; 769 node = __ft_get_parent(cxt, node);
755 p = (char *)node; 770 return ft_get_phandle(cxt, node);
771}
756 772
757 while ((p = ft_next(cxt, p, &atom)) != NULL) { 773static const void *__ft_get_prop(struct ft_cxt *cxt, void *node,
774 const char *propname, unsigned int *len)
775{
776 struct ft_atom atom;
777 int depth = 0;
778
779 while ((node = ft_next(cxt, node, &atom)) != NULL) {
758 switch (atom.tag) { 780 switch (atom.tag) {
759 case OF_DT_BEGIN_NODE: 781 case OF_DT_BEGIN_NODE:
760 ++depth; 782 ++depth;
761 break; 783 break;
784
762 case OF_DT_PROP: 785 case OF_DT_PROP:
763 if ((depth != 1) || strcmp(atom.name, propname)) 786 if (depth != 1 || strcmp(atom.name, propname))
764 break; 787 break;
765 size = min(atom.size, buflen); 788
766 memcpy(buf, atom.data, size); 789 if (len)
767 return atom.size; 790 *len = atom.size;
791
792 return atom.data;
793
768 case OF_DT_END_NODE: 794 case OF_DT_END_NODE:
769 if (--depth <= 0) 795 if (--depth <= 0)
770 return -1; 796 return NULL;
771 } 797 }
772 } 798 }
799
800 return NULL;
801}
802
803int ft_get_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
804 void *buf, const unsigned int buflen)
805{
806 const void *data;
807 unsigned int size;
808
809 void *node = ft_node_ph2node(cxt, phandle);
810 if (!node)
811 return -1;
812
813 data = __ft_get_prop(cxt, node, propname, &size);
814 if (data) {
815 unsigned int clipped_size = min(size, buflen);
816 memcpy(buf, data, clipped_size);
817 return size;
818 }
819
773 return -1; 820 return -1;
774} 821}
775 822
823void *__ft_find_node_by_prop_value(struct ft_cxt *cxt, void *prev,
824 const char *propname, const char *propval,
825 unsigned int proplen)
826{
827 struct ft_atom atom;
828 char *p = ft_root_node(cxt);
829 char *next;
830 int past_prev = prev ? 0 : 1;
831 int depth = -1;
832
833 while ((next = ft_next(cxt, p, &atom)) != NULL) {
834 const void *data;
835 unsigned int size;
836
837 switch (atom.tag) {
838 case OF_DT_BEGIN_NODE:
839 depth++;
840
841 if (prev == p) {
842 past_prev = 1;
843 break;
844 }
845
846 if (!past_prev || depth < 1)
847 break;
848
849 data = __ft_get_prop(cxt, p, propname, &size);
850 if (!data || size != proplen)
851 break;
852 if (memcmp(data, propval, size))
853 break;
854
855 return p;
856
857 case OF_DT_END_NODE:
858 if (depth-- == 0)
859 return NULL;
860
861 break;
862 }
863
864 p = next;
865 }
866
867 return NULL;
868}
869
870void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev,
871 const char *propname, const char *propval,
872 int proplen)
873{
874 void *node = NULL;
875
876 if (prev) {
877 node = ft_node_ph2node(cxt, prev);
878
879 if (!node)
880 return NULL;
881 }
882
883 node = __ft_find_node_by_prop_value(cxt, node, propname,
884 propval, proplen);
885 return ft_get_phandle(cxt, node);
886}
887
776int ft_set_prop(struct ft_cxt *cxt, const void *phandle, const char *propname, 888int ft_set_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
777 const void *buf, const unsigned int buflen) 889 const void *buf, const unsigned int buflen)
778{ 890{
@@ -849,19 +961,26 @@ int ft_del_prop(struct ft_cxt *cxt, const void *phandle, const char *propname)
849 return -1; 961 return -1;
850} 962}
851 963
852void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path) 964void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name)
853{ 965{
854 struct ft_atom atom; 966 struct ft_atom atom;
855 char *p, *next; 967 char *p, *next;
856 int depth = 0; 968 int depth = 0;
857 969
858 p = cxt->rgn[FT_STRUCT].start; 970 if (parent) {
971 p = ft_node_ph2node(cxt, parent);
972 if (!p)
973 return NULL;
974 } else {
975 p = ft_root_node(cxt);
976 }
977
859 while ((next = ft_next(cxt, p, &atom)) != NULL) { 978 while ((next = ft_next(cxt, p, &atom)) != NULL) {
860 switch (atom.tag) { 979 switch (atom.tag) {
861 case OF_DT_BEGIN_NODE: 980 case OF_DT_BEGIN_NODE:
862 ++depth; 981 ++depth;
863 if (depth == 1 && strcmp(atom.name, path) == 0) 982 if (depth == 1 && strcmp(atom.name, name) == 0)
864 /* duplicate node path, return error */ 983 /* duplicate node name, return error */
865 return NULL; 984 return NULL;
866 break; 985 break;
867 case OF_DT_END_NODE: 986 case OF_DT_END_NODE:
@@ -870,7 +989,7 @@ void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path)
870 break; 989 break;
871 /* end of node, insert here */ 990 /* end of node, insert here */
872 cxt->p = p; 991 cxt->p = p;
873 ft_begin_node(cxt, path); 992 ft_begin_node(cxt, name);
874 ft_end_node(cxt); 993 ft_end_node(cxt);
875 return p; 994 return p;
876 } 995 }
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index b9cd9f61f351..cb26325d72db 100644
--- a/arch/powerpc/boot/flatdevtree.h
+++ b/arch/powerpc/boot/flatdevtree.h
@@ -97,10 +97,17 @@ int ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size);
97void ft_dump_blob(const void *bphp); 97void ft_dump_blob(const void *bphp);
98void ft_merge_blob(struct ft_cxt *cxt, void *blob); 98void ft_merge_blob(struct ft_cxt *cxt, void *blob);
99void *ft_find_device(struct ft_cxt *cxt, const char *srch_path); 99void *ft_find_device(struct ft_cxt *cxt, const char *srch_path);
100void *ft_find_device_rel(struct ft_cxt *cxt, const void *top,
101 const char *srch_path);
100void *ft_find_descendent(struct ft_cxt *cxt, void *top, const char *srch_path); 102void *ft_find_descendent(struct ft_cxt *cxt, void *top, const char *srch_path);
101int ft_get_prop(struct ft_cxt *cxt, const void *phandle, const char *propname, 103int ft_get_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
102 void *buf, const unsigned int buflen); 104 void *buf, const unsigned int buflen);
103int ft_set_prop(struct ft_cxt *cxt, const void *phandle, const char *propname, 105int ft_set_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
104 const void *buf, const unsigned int buflen); 106 const void *buf, const unsigned int buflen);
107void *ft_get_parent(struct ft_cxt *cxt, const void *phandle);
108void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev,
109 const char *propname, const char *propval,
110 int proplen);
111void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name);
105 112
106#endif /* FLATDEVTREE_H */ 113#endif /* FLATDEVTREE_H */
diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
index 04da38fa477f..4341e6558c1a 100644
--- a/arch/powerpc/boot/flatdevtree_misc.c
+++ b/arch/powerpc/boot/flatdevtree_misc.c
@@ -16,24 +16,43 @@
16 16
17static struct ft_cxt cxt; 17static struct ft_cxt cxt;
18 18
19static void *ft_finddevice(const char *name) 19static void *fdtm_finddevice(const char *name)
20{ 20{
21 return ft_find_device(&cxt, name); 21 return ft_find_device(&cxt, name);
22} 22}
23 23
24static int ft_getprop(const void *phandle, const char *propname, void *buf, 24static int fdtm_getprop(const void *phandle, const char *propname,
25 const int buflen) 25 void *buf, const int buflen)
26{ 26{
27 return ft_get_prop(&cxt, phandle, propname, buf, buflen); 27 return ft_get_prop(&cxt, phandle, propname, buf, buflen);
28} 28}
29 29
30static int ft_setprop(const void *phandle, const char *propname, 30static int fdtm_setprop(const void *phandle, const char *propname,
31 const void *buf, const int buflen) 31 const void *buf, const int buflen)
32{ 32{
33 return ft_set_prop(&cxt, phandle, propname, buf, buflen); 33 return ft_set_prop(&cxt, phandle, propname, buf, buflen);
34} 34}
35 35
36static unsigned long ft_finalize(void) 36static void *fdtm_get_parent(const void *phandle)
37{
38 return ft_get_parent(&cxt, phandle);
39}
40
41static void *fdtm_create_node(const void *phandle, const char *name)
42{
43 return ft_create_node(&cxt, phandle, name);
44}
45
46static void *fdtm_find_node_by_prop_value(const void *prev,
47 const char *propname,
48 const char *propval,
49 int proplen)
50{
51 return ft_find_node_by_prop_value(&cxt, prev, propname,
52 propval, proplen);
53}
54
55static unsigned long fdtm_finalize(void)
37{ 56{
38 ft_end_tree(&cxt); 57 ft_end_tree(&cxt);
39 return (unsigned long)cxt.bph; 58 return (unsigned long)cxt.bph;
@@ -41,10 +60,13 @@ static unsigned long ft_finalize(void)
41 60
42int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device) 61int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device)
43{ 62{
44 dt_ops.finddevice = ft_finddevice; 63 dt_ops.finddevice = fdtm_finddevice;
45 dt_ops.getprop = ft_getprop; 64 dt_ops.getprop = fdtm_getprop;
46 dt_ops.setprop = ft_setprop; 65 dt_ops.setprop = fdtm_setprop;
47 dt_ops.finalize = ft_finalize; 66 dt_ops.get_parent = fdtm_get_parent;
67 dt_ops.create_node = fdtm_create_node;
68 dt_ops.find_node_by_prop_value = fdtm_find_node_by_prop_value;
69 dt_ops.finalize = fdtm_finalize;
48 70
49 return ft_open(&cxt, dt_blob, max_size, max_find_device, 71 return ft_open(&cxt, dt_blob, max_size, max_find_device,
50 platform_ops.realloc); 72 platform_ops.realloc);
diff --git a/arch/powerpc/boot/gunzip_util.c b/arch/powerpc/boot/gunzip_util.c
new file mode 100644
index 000000000000..df8ab07e9ff4
--- /dev/null
+++ b/arch/powerpc/boot/gunzip_util.c
@@ -0,0 +1,206 @@
1/*
2 * Copyright 2007 David Gibson, IBM Corporation.
3 * Based on earlier work, Copyright (C) Paul Mackerras 1997.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <stddef.h>
12#include "string.h"
13#include "stdio.h"
14#include "ops.h"
15#include "gunzip_util.h"
16
17#define HEAD_CRC 2
18#define EXTRA_FIELD 4
19#define ORIG_NAME 8
20#define COMMENT 0x10
21#define RESERVED 0xe0
22
23/**
24 * gunzip_start - prepare to decompress gzip data
25 * @state: decompressor state structure to be initialized
26 * @src: buffer containing gzip compressed or uncompressed data
27 * @srclen: size in bytes of the buffer at src
28 *
29 * If the buffer at @src contains a gzip header, this function
30 * initializes zlib to decompress the data, storing the decompression
31 * state in @state. The other functions in this file can then be used
32 * to decompress data from the gzipped stream.
33 *
34 * If the buffer at @src does not contain a gzip header, it is assumed
35 * to contain uncompressed data. The buffer information is recorded
36 * in @state and the other functions in this file will simply copy
37 * data from the uncompressed data stream at @src.
38 *
39 * Any errors, such as bad compressed data, cause an error to be
40 * printed an the platform's exit() function to be called.
41 */
42void gunzip_start(struct gunzip_state *state, void *src, int srclen)
43{
44 char *hdr = src;
45 int hdrlen = 0;
46
47 memset(state, 0, sizeof(*state));
48
49 /* Check for gzip magic number */
50 if ((hdr[0] == 0x1f) && (hdr[1] == 0x8b)) {
51 /* gzip data, initialize zlib parameters */
52 int r, flags;
53
54 state->s.workspace = state->scratch;
55 if (zlib_inflate_workspacesize() > sizeof(state->scratch))
56 fatal("insufficient scratch space for gunzip\n\r");
57
58 /* skip header */
59 hdrlen = 10;
60 flags = hdr[3];
61 if (hdr[2] != Z_DEFLATED || (flags & RESERVED) != 0)
62 fatal("bad gzipped data\n\r");
63 if ((flags & EXTRA_FIELD) != 0)
64 hdrlen = 12 + hdr[10] + (hdr[11] << 8);
65 if ((flags & ORIG_NAME) != 0)
66 while (hdr[hdrlen++] != 0)
67 ;
68 if ((flags & COMMENT) != 0)
69 while (hdr[hdrlen++] != 0)
70 ;
71 if ((flags & HEAD_CRC) != 0)
72 hdrlen += 2;
73 if (hdrlen >= srclen)
74 fatal("gunzip_start: ran out of data in header\n\r");
75
76 r = zlib_inflateInit2(&state->s, -MAX_WBITS);
77 if (r != Z_OK)
78 fatal("inflateInit2 returned %d\n\r", r);
79 }
80
81 state->s.next_in = src + hdrlen;
82 state->s.avail_in = srclen - hdrlen;
83}
84
85/**
86 * gunzip_partial - extract bytes from a gzip data stream
87 * @state: gzip state structure previously initialized by gunzip_start()
88 * @dst: buffer to store extracted data
89 * @dstlen: maximum number of bytes to extract
90 *
91 * This function extracts at most @dstlen bytes from the data stream
92 * previously associated with @state by gunzip_start(), decompressing
93 * if necessary. Exactly @dstlen bytes are extracted unless the data
94 * stream doesn't contain enough bytes, in which case the entire
95 * remainder of the stream is decompressed.
96 *
97 * Returns the actual number of bytes extracted. If any errors occur,
98 * such as a corrupted compressed stream, an error is printed an the
99 * platform's exit() function is called.
100 */
101int gunzip_partial(struct gunzip_state *state, void *dst, int dstlen)
102{
103 int len;
104
105 if (state->s.workspace) {
106 /* gunzipping */
107 int r;
108
109 state->s.next_out = dst;
110 state->s.avail_out = dstlen;
111 r = zlib_inflate(&state->s, Z_FULL_FLUSH);
112 if (r != Z_OK && r != Z_STREAM_END)
113 fatal("inflate returned %d msg: %s\n\r", r, state->s.msg);
114 len = state->s.next_out - (unsigned char *)dst;
115 } else {
116 /* uncompressed image */
117 len = min(state->s.avail_in, (unsigned)dstlen);
118 memcpy(dst, state->s.next_in, len);
119 state->s.next_in += len;
120 state->s.avail_in -= len;
121 }
122 return len;
123}
124
125/**
126 * gunzip_exactly - extract a fixed number of bytes from a gzip data stream
127 * @state: gzip state structure previously initialized by gunzip_start()
128 * @dst: buffer to store extracted data
129 * @dstlen: number of bytes to extract
130 *
131 * This function extracts exactly @dstlen bytes from the data stream
132 * previously associated with @state by gunzip_start(), decompressing
133 * if necessary.
134 *
135 * If there are less @dstlen bytes available in the data stream, or if
136 * any other errors occur, such as a corrupted compressed stream, an
137 * error is printed an the platform's exit() function is called.
138 */
139void gunzip_exactly(struct gunzip_state *state, void *dst, int dstlen)
140{
141 int len;
142
143 len = gunzip_partial(state, dst, dstlen);
144 if (len < dstlen)
145 fatal("\n\rgunzip_exactly: ran out of data!"
146 " Wanted %d, got %d.\n\r", dstlen, len);
147}
148
149/**
150 * gunzip_discard - discard bytes from a gzip data stream
151 * @state: gzip state structure previously initialized by gunzip_start()
152 * @len: number of bytes to discard
153 *
154 * This function extracts, then discards exactly @len bytes from the
155 * data stream previously associated with @state by gunzip_start().
156 * Subsequent gunzip_partial(), gunzip_exactly() or gunzip_finish()
157 * calls will extract the data following the discarded bytes in the
158 * data stream.
159 *
160 * If there are less @len bytes available in the data stream, or if
161 * any other errors occur, such as a corrupted compressed stream, an
162 * error is printed an the platform's exit() function is called.
163 */
164void gunzip_discard(struct gunzip_state *state, int len)
165{
166 static char discard_buf[128];
167
168 while (len > sizeof(discard_buf)) {
169 gunzip_exactly(state, discard_buf, sizeof(discard_buf));
170 len -= sizeof(discard_buf);
171 }
172
173 if (len > 0)
174 gunzip_exactly(state, discard_buf, len);
175}
176
177/**
178 * gunzip_finish - extract all remaining bytes from a gzip data stream
179 * @state: gzip state structure previously initialized by gunzip_start()
180 * @dst: buffer to store extracted data
181 * @dstlen: maximum number of bytes to extract
182 *
183 * This function extracts all remaining data, or at most @dstlen
184 * bytes, from the stream previously associated with @state by
185 * gunzip_start(). zlib is then shut down, so it is an error to use
186 * any of the functions in this file on @state until it is
187 * re-initialized with another call to gunzip_start().
188 *
189 * If any errors occur, such as a corrupted compressed stream, an
190 * error is printed an the platform's exit() function is called.
191 */
192int gunzip_finish(struct gunzip_state *state, void *dst, int dstlen)
193{
194 int len;
195
196 if (state->s.workspace) {
197 len = gunzip_partial(state, dst, dstlen);
198 zlib_inflateEnd(&state->s);
199 } else {
200 /* uncompressed image */
201 len = min(state->s.avail_in, (unsigned)dstlen);
202 memcpy(dst, state->s.next_in, len);
203 }
204
205 return len;
206}
diff --git a/arch/powerpc/boot/gunzip_util.h b/arch/powerpc/boot/gunzip_util.h
new file mode 100644
index 000000000000..b3dfa6e87b3a
--- /dev/null
+++ b/arch/powerpc/boot/gunzip_util.h
@@ -0,0 +1,45 @@
1/*
2 * Decompression convenience functions
3 *
4 * Copyright 2007 David Gibson, IBM Corporation.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#ifndef _PPC_BOOT_GUNZIP_UTIL_H_
11#define _PPC_BOOT_GUNZIP_UTIL_H_
12
13#include "zlib.h"
14
15/*
16 * These functions are designed to make life easy for decompressing
17 * kernel images, initrd images or any other gzip compressed image,
18 * particularly if its useful to decompress part of the image (e.g. to
19 * examine headers) before decompressing the remainder.
20 *
21 * To use:
22 * - declare a gunzip_state structure
23 * - use gunzip_start() to initialize the state, associating it
24 * with a stream of compressed data
25 * - use gunzip_partial(), gunzip_exactly() and gunzip_discard()
26 * in any combination to extract pieces of data from the stream
27 * - Finally use gunzip_finish() to extract the tail of the
28 * compressed stream and wind up zlib
29 */
30
31/* scratch space for gunzip; 46912 is from zlib_inflate_workspacesize() */
32#define GUNZIP_SCRATCH_SIZE 46912
33
34struct gunzip_state {
35 z_stream s;
36 char scratch[46912];
37};
38
39void gunzip_start(struct gunzip_state *state, void *src, int srclen);
40int gunzip_partial(struct gunzip_state *state, void *dst, int dstlen);
41void gunzip_exactly(struct gunzip_state *state, void *dst, int len);
42void gunzip_discard(struct gunzip_state *state, int len);
43int gunzip_finish(struct gunzip_state *state, void *dst, int len);
44
45#endif /* _PPC_BOOT_GUNZIP_UTIL_H_ */
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 6f6b50d238b6..56b56a8d4b23 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -14,11 +14,10 @@
14#include "page.h" 14#include "page.h"
15#include "string.h" 15#include "string.h"
16#include "stdio.h" 16#include "stdio.h"
17#include "zlib.h"
18#include "ops.h" 17#include "ops.h"
18#include "gunzip_util.h"
19#include "flatdevtree.h" 19#include "flatdevtree.h"
20 20#include "reg.h"
21extern void flush_cache(void *, unsigned long);
22 21
23extern char _start[]; 22extern char _start[];
24extern char __bss_start[]; 23extern char __bss_start[];
@@ -30,304 +29,173 @@ extern char _initrd_end[];
30extern char _dtb_start[]; 29extern char _dtb_start[];
31extern char _dtb_end[]; 30extern char _dtb_end[];
32 31
32static struct gunzip_state gzstate;
33
33struct addr_range { 34struct addr_range {
34 unsigned long addr; 35 void *addr;
35 unsigned long size; 36 unsigned long size;
36 unsigned long memsize;
37}; 37};
38static struct addr_range vmlinux;
39static struct addr_range vmlinuz;
40static struct addr_range initrd;
41
42static unsigned long elfoffset;
43static int is_64bit;
44
45/* scratch space for gunzip; 46912 is from zlib_inflate_workspacesize() */
46static char scratch[46912];
47static char elfheader[256];
48 38
49typedef void (*kernel_entry_t)(unsigned long, unsigned long, void *); 39typedef void (*kernel_entry_t)(unsigned long, unsigned long, void *);
50 40
51#undef DEBUG 41#undef DEBUG
52 42
53#define HEAD_CRC 2 43static struct addr_range prep_kernel(void)
54#define EXTRA_FIELD 4
55#define ORIG_NAME 8
56#define COMMENT 0x10
57#define RESERVED 0xe0
58
59static void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
60{ 44{
61 z_stream s; 45 char elfheader[256];
62 int r, i, flags; 46 void *vmlinuz_addr = _vmlinux_start;
63 47 unsigned long vmlinuz_size = _vmlinux_end - _vmlinux_start;
64 /* skip header */ 48 void *addr = 0;
65 i = 10; 49 struct elf_info ei;
66 flags = src[3]; 50 int len;
67 if (src[2] != Z_DEFLATED || (flags & RESERVED) != 0) {
68 printf("bad gzipped data\n\r");
69 exit();
70 }
71 if ((flags & EXTRA_FIELD) != 0)
72 i = 12 + src[10] + (src[11] << 8);
73 if ((flags & ORIG_NAME) != 0)
74 while (src[i++] != 0)
75 ;
76 if ((flags & COMMENT) != 0)
77 while (src[i++] != 0)
78 ;
79 if ((flags & HEAD_CRC) != 0)
80 i += 2;
81 if (i >= *lenp) {
82 printf("gunzip: ran out of data in header\n\r");
83 exit();
84 }
85 51
86 if (zlib_inflate_workspacesize() > sizeof(scratch)) { 52 /* gunzip the ELF header of the kernel */
87 printf("gunzip needs more mem\n"); 53 gunzip_start(&gzstate, vmlinuz_addr, vmlinuz_size);
88 exit(); 54 gunzip_exactly(&gzstate, elfheader, sizeof(elfheader));
89 } 55
90 memset(&s, 0, sizeof(s)); 56 if (!parse_elf64(elfheader, &ei) && !parse_elf32(elfheader, &ei))
91 s.workspace = scratch; 57 fatal("Error: not a valid PPC32 or PPC64 ELF file!\n\r");
92 r = zlib_inflateInit2(&s, -MAX_WBITS); 58
93 if (r != Z_OK) { 59 if (platform_ops.image_hdr)
94 printf("inflateInit2 returned %d\n\r", r); 60 platform_ops.image_hdr(elfheader);
95 exit(); 61
96 } 62 /* We need to alloc the memsize: gzip will expand the kernel
97 s.next_in = src + i; 63 * text/data, then possible rubbish we don't care about. But
98 s.avail_in = *lenp - i; 64 * the kernel bss must be claimed (it will be zero'd by the
99 s.next_out = dst; 65 * kernel itself)
100 s.avail_out = dstlen; 66 */
101 r = zlib_inflate(&s, Z_FULL_FLUSH); 67 printf("Allocating 0x%lx bytes for kernel ...\n\r", ei.memsize);
102 if (r != Z_OK && r != Z_STREAM_END) { 68
103 printf("inflate returned %d msg: %s\n\r", r, s.msg); 69 if (platform_ops.vmlinux_alloc) {
104 exit(); 70 addr = platform_ops.vmlinux_alloc(ei.memsize);
71 } else {
72 if ((unsigned long)_start < ei.memsize)
73 fatal("Insufficient memory for kernel at address 0!"
74 " (_start=%p)\n\r", _start);
105 } 75 }
106 *lenp = s.next_out - (unsigned char *) dst;
107 zlib_inflateEnd(&s);
108}
109 76
110static int is_elf64(void *hdr) 77 /* Finally, gunzip the kernel */
111{ 78 printf("gunzipping (0x%p <- 0x%p:0x%p)...", addr,
112 Elf64_Ehdr *elf64 = hdr; 79 vmlinuz_addr, vmlinuz_addr+vmlinuz_size);
113 Elf64_Phdr *elf64ph; 80 /* discard up to the actual load data */
114 unsigned int i; 81 gunzip_discard(&gzstate, ei.elfoffset - sizeof(elfheader));
115 82 len = gunzip_finish(&gzstate, addr, ei.loadsize);
116 if (!(elf64->e_ident[EI_MAG0] == ELFMAG0 && 83 if (len != ei.loadsize)
117 elf64->e_ident[EI_MAG1] == ELFMAG1 && 84 fatal("ran out of data! only got 0x%x of 0x%lx bytes.\n\r",
118 elf64->e_ident[EI_MAG2] == ELFMAG2 && 85 len, ei.loadsize);
119 elf64->e_ident[EI_MAG3] == ELFMAG3 && 86 printf("done 0x%x bytes\n\r", len);
120 elf64->e_ident[EI_CLASS] == ELFCLASS64 &&
121 elf64->e_ident[EI_DATA] == ELFDATA2MSB &&
122 elf64->e_type == ET_EXEC &&
123 elf64->e_machine == EM_PPC64))
124 return 0;
125
126 elf64ph = (Elf64_Phdr *)((unsigned long)elf64 +
127 (unsigned long)elf64->e_phoff);
128 for (i = 0; i < (unsigned int)elf64->e_phnum; i++, elf64ph++)
129 if (elf64ph->p_type == PT_LOAD)
130 break;
131 if (i >= (unsigned int)elf64->e_phnum)
132 return 0;
133
134 elfoffset = (unsigned long)elf64ph->p_offset;
135 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset;
136 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset;
137
138 is_64bit = 1;
139 return 1;
140}
141 87
142static int is_elf32(void *hdr) 88 flush_cache(addr, ei.loadsize);
143{ 89
144 Elf32_Ehdr *elf32 = hdr; 90 return (struct addr_range){addr, ei.memsize};
145 Elf32_Phdr *elf32ph;
146 unsigned int i;
147
148 if (!(elf32->e_ident[EI_MAG0] == ELFMAG0 &&
149 elf32->e_ident[EI_MAG1] == ELFMAG1 &&
150 elf32->e_ident[EI_MAG2] == ELFMAG2 &&
151 elf32->e_ident[EI_MAG3] == ELFMAG3 &&
152 elf32->e_ident[EI_CLASS] == ELFCLASS32 &&
153 elf32->e_ident[EI_DATA] == ELFDATA2MSB &&
154 elf32->e_type == ET_EXEC &&
155 elf32->e_machine == EM_PPC))
156 return 0;
157
158 elf32 = (Elf32_Ehdr *)elfheader;
159 elf32ph = (Elf32_Phdr *) ((unsigned long)elf32 + elf32->e_phoff);
160 for (i = 0; i < elf32->e_phnum; i++, elf32ph++)
161 if (elf32ph->p_type == PT_LOAD)
162 break;
163 if (i >= elf32->e_phnum)
164 return 0;
165
166 elfoffset = elf32ph->p_offset;
167 vmlinux.size = elf32ph->p_filesz + elf32ph->p_offset;
168 vmlinux.memsize = elf32ph->p_memsz + elf32ph->p_offset;
169 return 1;
170} 91}
171 92
172static void prep_kernel(unsigned long a1, unsigned long a2) 93static struct addr_range prep_initrd(struct addr_range vmlinux, void *chosen,
94 unsigned long initrd_addr,
95 unsigned long initrd_size)
173{ 96{
174 int len; 97 /* If we have an image attached to us, it overrides anything
175 98 * supplied by the loader. */
176 vmlinuz.addr = (unsigned long)_vmlinux_start; 99 if (_initrd_end > _initrd_start) {
177 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); 100 printf("Attached initrd image at 0x%p-0x%p\n\r",
178 101 _initrd_start, _initrd_end);
179 /* gunzip the ELF header of the kernel */ 102 initrd_addr = (unsigned long)_initrd_start;
180 if (*(unsigned short *)vmlinuz.addr == 0x1f8b) { 103 initrd_size = _initrd_end - _initrd_start;
181 len = vmlinuz.size; 104 } else if (initrd_size > 0) {
182 gunzip(elfheader, sizeof(elfheader), 105 printf("Using loader supplied ramdisk at 0x%lx-0x%lx\n\r",
183 (unsigned char *)vmlinuz.addr, &len); 106 initrd_addr, initrd_addr + initrd_size);
184 } else
185 memcpy(elfheader, (const void *)vmlinuz.addr,
186 sizeof(elfheader));
187
188 if (!is_elf64(elfheader) && !is_elf32(elfheader)) {
189 printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r");
190 exit();
191 } 107 }
192 if (platform_ops.image_hdr)
193 platform_ops.image_hdr(elfheader);
194 108
195 /* We need to alloc the memsize plus the file offset since gzip 109 /* If there's no initrd at all, we're done */
196 * will expand the header (file offset), then the kernel, then 110 if (! initrd_size)
197 * possible rubbish we don't care about. But the kernel bss must 111 return (struct addr_range){0, 0};
198 * be claimed (it will be zero'd by the kernel itself)
199 */
200 printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux.memsize);
201 vmlinux.addr = (unsigned long)malloc(vmlinux.memsize);
202 if (vmlinux.addr == 0) {
203 printf("Can't allocate memory for kernel image !\n\r");
204 exit();
205 }
206 112
207 /* 113 /*
208 * Now find the initrd 114 * If the initrd is too low it will be clobbered when the
209 * 115 * kernel relocates to its final location. In this case,
210 * First see if we have an image attached to us. If so 116 * allocate a safer place and move it.
211 * allocate memory for it and copy it there.
212 */ 117 */
213 initrd.size = (unsigned long)(_initrd_end - _initrd_start); 118 if (initrd_addr < vmlinux.size) {
214 initrd.memsize = initrd.size; 119 void *old_addr = (void *)initrd_addr;
215 if (initrd.size > 0) { 120
216 printf("Allocating 0x%lx bytes for initrd ...\n\r", 121 printf("Allocating 0x%lx bytes for initrd ...\n\r",
217 initrd.size); 122 initrd_size);
218 initrd.addr = (unsigned long)malloc((u32)initrd.size); 123 initrd_addr = (unsigned long)malloc(initrd_size);
219 if (initrd.addr == 0) { 124 if (! initrd_addr)
220 printf("Can't allocate memory for initial " 125 fatal("Can't allocate memory for initial "
221 "ramdisk !\n\r"); 126 "ramdisk !\n\r");
222 exit(); 127 printf("Relocating initrd 0x%lx <- 0x%p (0x%lx bytes)\n\r",
223 } 128 initrd_addr, old_addr, initrd_size);
224 printf("initial ramdisk moving 0x%lx <- 0x%lx " 129 memmove((void *)initrd_addr, old_addr, initrd_size);
225 "(0x%lx bytes)\n\r", initrd.addr,
226 (unsigned long)_initrd_start, initrd.size);
227 memmove((void *)initrd.addr, (void *)_initrd_start,
228 initrd.size);
229 printf("initrd head: 0x%lx\n\r",
230 *((unsigned long *)initrd.addr));
231 } else if (a2 != 0) {
232 /* Otherwise, see if yaboot or another loader gave us an initrd */
233 initrd.addr = a1;
234 initrd.memsize = initrd.size = a2;
235 printf("Using loader supplied initrd at 0x%lx (0x%lx bytes)\n\r",
236 initrd.addr, initrd.size);
237 } 130 }
238 131
239 /* Eventually gunzip the kernel */ 132 printf("initrd head: 0x%lx\n\r", *((unsigned long *)initrd_addr));
240 if (*(unsigned short *)vmlinuz.addr == 0x1f8b) {
241 printf("gunzipping (0x%lx <- 0x%lx:0x%0lx)...",
242 vmlinux.addr, vmlinuz.addr, vmlinuz.addr+vmlinuz.size);
243 len = vmlinuz.size;
244 gunzip((void *)vmlinux.addr, vmlinux.memsize,
245 (unsigned char *)vmlinuz.addr, &len);
246 printf("done 0x%lx bytes\n\r", len);
247 } else {
248 memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,
249 vmlinuz.size);
250 }
251 133
252 /* Skip over the ELF header */ 134 /* Tell the kernel initrd address via device tree */
253#ifdef DEBUG 135 setprop_val(chosen, "linux,initrd-start", (u32)(initrd_addr));
254 printf("... skipping 0x%lx bytes of ELF header\n\r", 136 setprop_val(chosen, "linux,initrd-end", (u32)(initrd_addr+initrd_size));
255 elfoffset);
256#endif
257 vmlinux.addr += elfoffset;
258 137
259 flush_cache((void *)vmlinux.addr, vmlinux.size); 138 return (struct addr_range){(void *)initrd_addr, initrd_size};
260} 139}
261 140
262/* A buffer that may be edited by tools operating on a zImage binary so as to 141/* A buffer that may be edited by tools operating on a zImage binary so as to
263 * edit the command line passed to vmlinux (by setting /chosen/bootargs). 142 * edit the command line passed to vmlinux (by setting /chosen/bootargs).
264 * The buffer is put in it's own section so that tools may locate it easier. 143 * The buffer is put in it's own section so that tools may locate it easier.
265 */ 144 */
266static char builtin_cmdline[COMMAND_LINE_SIZE] 145static char cmdline[COMMAND_LINE_SIZE]
267 __attribute__((__section__("__builtin_cmdline"))); 146 __attribute__((__section__("__builtin_cmdline")));
268 147
269static void get_cmdline(char *buf, int size) 148static void prep_cmdline(void *chosen)
270{ 149{
271 void *devp; 150 if (cmdline[0] == '\0')
272 int len = strlen(builtin_cmdline); 151 getprop(chosen, "bootargs", cmdline, COMMAND_LINE_SIZE-1);
273
274 buf[0] = '\0';
275
276 if (len > 0) { /* builtin_cmdline overrides dt's /chosen/bootargs */
277 len = min(len, size-1);
278 strncpy(buf, builtin_cmdline, len);
279 buf[len] = '\0';
280 }
281 else if ((devp = finddevice("/chosen")))
282 getprop(devp, "bootargs", buf, size);
283}
284 152
285static void set_cmdline(char *buf) 153 printf("\n\rLinux/PowerPC load: %s", cmdline);
286{ 154 /* If possible, edit the command line */
287 void *devp; 155 if (console_ops.edit_cmdline)
156 console_ops.edit_cmdline(cmdline, COMMAND_LINE_SIZE);
157 printf("\n\r");
288 158
289 if ((devp = finddevice("/chosen"))) 159 /* Put the command line back into the devtree for the kernel */
290 setprop(devp, "bootargs", buf, strlen(buf) + 1); 160 setprop_str(chosen, "bootargs", cmdline);
291} 161}
292 162
293struct platform_ops platform_ops; 163struct platform_ops platform_ops;
294struct dt_ops dt_ops; 164struct dt_ops dt_ops;
295struct console_ops console_ops; 165struct console_ops console_ops;
166struct loader_info loader_info;
296 167
297void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) 168void start(void)
298{ 169{
170 struct addr_range vmlinux, initrd;
299 kernel_entry_t kentry; 171 kernel_entry_t kentry;
300 char cmdline[COMMAND_LINE_SIZE];
301 unsigned long ft_addr = 0; 172 unsigned long ft_addr = 0;
173 void *chosen;
302 174
303 memset(__bss_start, 0, _end - __bss_start); 175 /* Do this first, because malloc() could clobber the loader's
304 memset(&platform_ops, 0, sizeof(platform_ops)); 176 * command line. Only use the loader command line if a
305 memset(&dt_ops, 0, sizeof(dt_ops)); 177 * built-in command line wasn't set by an external tool */
306 memset(&console_ops, 0, sizeof(console_ops)); 178 if ((loader_info.cmdline_len > 0) && (cmdline[0] == '\0'))
179 memmove(cmdline, loader_info.cmdline,
180 min(loader_info.cmdline_len, COMMAND_LINE_SIZE-1));
307 181
308 if (platform_init(promptr, _dtb_start, _dtb_end))
309 exit();
310 if (console_ops.open && (console_ops.open() < 0)) 182 if (console_ops.open && (console_ops.open() < 0))
311 exit(); 183 exit();
312 if (platform_ops.fixups) 184 if (platform_ops.fixups)
313 platform_ops.fixups(); 185 platform_ops.fixups();
314 186
315 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", 187 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r",
316 _start, sp); 188 _start, get_sp());
317 189
318 prep_kernel(a1, a2); 190 /* Ensure that the device tree has a /chosen node */
191 chosen = finddevice("/chosen");
192 if (!chosen)
193 chosen = create_node(NULL, "chosen");
319 194
320 /* If cmdline came from zimage wrapper or if we can edit the one 195 vmlinux = prep_kernel();
321 * in the dt, print it out and edit it, if possible. 196 initrd = prep_initrd(vmlinux, chosen,
322 */ 197 loader_info.initrd_addr, loader_info.initrd_size);
323 if ((strlen(builtin_cmdline) > 0) || console_ops.edit_cmdline) { 198 prep_cmdline(chosen);
324 get_cmdline(cmdline, COMMAND_LINE_SIZE);
325 printf("\n\rLinux/PowerPC load: %s", cmdline);
326 if (console_ops.edit_cmdline)
327 console_ops.edit_cmdline(cmdline, COMMAND_LINE_SIZE);
328 printf("\n\r");
329 set_cmdline(cmdline);
330 }
331 199
332 printf("Finalizing device tree..."); 200 printf("Finalizing device tree...");
333 if (dt_ops.finalize) 201 if (dt_ops.finalize)
@@ -335,7 +203,7 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
335 if (ft_addr) 203 if (ft_addr)
336 printf(" flat tree at 0x%lx\n\r", ft_addr); 204 printf(" flat tree at 0x%lx\n\r", ft_addr);
337 else 205 else
338 printf(" using OF tree (promptr=%p)\n\r", promptr); 206 printf(" using OF tree (promptr=%p)\n\r", loader_info.promptr);
339 207
340 if (console_ops.close) 208 if (console_ops.close)
341 console_ops.close(); 209 console_ops.close();
@@ -344,10 +212,9 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
344 if (ft_addr) 212 if (ft_addr)
345 kentry(ft_addr, 0, NULL); 213 kentry(ft_addr, 0, NULL);
346 else 214 else
347 /* XXX initrd addr/size should be passed in properties */ 215 kentry((unsigned long)initrd.addr, initrd.size,
348 kentry(initrd.addr, initrd.size, promptr); 216 loader_info.promptr);
349 217
350 /* console closed so printf below may not work */ 218 /* console closed so printf in fatal below may not work */
351 printf("Error: Linux kernel returned to zImage boot wrapper!\n\r"); 219 fatal("Error: Linux kernel returned to zImage boot wrapper!\n\r");
352 exit();
353} 220}
diff --git a/arch/powerpc/boot/ns16550.c b/arch/powerpc/boot/ns16550.c
index 1ffe72e35cdc..f8f1b2f31412 100644
--- a/arch/powerpc/boot/ns16550.c
+++ b/arch/powerpc/boot/ns16550.c
@@ -55,10 +55,15 @@ static u8 ns16550_tstc(void)
55int ns16550_console_init(void *devp, struct serial_console_data *scdp) 55int ns16550_console_init(void *devp, struct serial_console_data *scdp)
56{ 56{
57 int n; 57 int n;
58 unsigned long reg_phys;
58 59
59 n = getprop(devp, "virtual-reg", &reg_base, sizeof(reg_base)); 60 n = getprop(devp, "virtual-reg", &reg_base, sizeof(reg_base));
60 if (n != sizeof(reg_base)) 61 if (n != sizeof(reg_base)) {
61 return -1; 62 if (!dt_xlate_reg(devp, 0, &reg_phys, NULL))
63 return -1;
64
65 reg_base = (void *)reg_phys;
66 }
62 67
63 n = getprop(devp, "reg-shift", &reg_shift, sizeof(reg_shift)); 68 n = getprop(devp, "reg-shift", &reg_shift, sizeof(reg_shift));
64 if (n != sizeof(reg_shift)) 69 if (n != sizeof(reg_shift))
diff --git a/arch/powerpc/boot/of.c b/arch/powerpc/boot/of.c
index 0182f384f3e6..d16ee3e3f868 100644
--- a/arch/powerpc/boot/of.c
+++ b/arch/powerpc/boot/of.c
@@ -173,7 +173,7 @@ static void *claim(unsigned long virt, unsigned long size, unsigned long align)
173 return (void *) virt; 173 return (void *) virt;
174} 174}
175 175
176static void *of_try_claim(u32 size) 176static void *of_try_claim(unsigned long size)
177{ 177{
178 unsigned long addr = 0; 178 unsigned long addr = 0;
179 179
@@ -208,6 +208,16 @@ static void of_image_hdr(const void *hdr)
208 } 208 }
209} 209}
210 210
211static void *of_vmlinux_alloc(unsigned long size)
212{
213 void *p = malloc(size);
214
215 if (!p)
216 fatal("Can't allocate memory for kernel image!\n\r");
217
218 return p;
219}
220
211static void of_exit(void) 221static void of_exit(void)
212{ 222{
213 call_prom("exit", 0, 0); 223 call_prom("exit", 0, 0);
@@ -256,11 +266,12 @@ static void of_console_write(char *buf, int len)
256 call_prom("write", 3, 1, of_stdout_handle, buf, len); 266 call_prom("write", 3, 1, of_stdout_handle, buf, len);
257} 267}
258 268
259int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end) 269void platform_init(unsigned long a1, unsigned long a2, void *promptr)
260{ 270{
261 platform_ops.image_hdr = of_image_hdr; 271 platform_ops.image_hdr = of_image_hdr;
262 platform_ops.malloc = of_try_claim; 272 platform_ops.malloc = of_try_claim;
263 platform_ops.exit = of_exit; 273 platform_ops.exit = of_exit;
274 platform_ops.vmlinux_alloc = of_vmlinux_alloc;
264 275
265 dt_ops.finddevice = of_finddevice; 276 dt_ops.finddevice = of_finddevice;
266 dt_ops.getprop = of_getprop; 277 dt_ops.getprop = of_getprop;
@@ -270,5 +281,9 @@ int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end)
270 console_ops.write = of_console_write; 281 console_ops.write = of_console_write;
271 282
272 prom = (int (*)(void *))promptr; 283 prom = (int (*)(void *))promptr;
273 return 0; 284 loader_info.promptr = promptr;
285 if (a1 && a2 && a2 != 0xdeadbeef) {
286 loader_info.initrd_addr = a1;
287 loader_info.initrd_size = a2;
288 }
274} 289}
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 8abb6516bb7c..73bd47a3a079 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -11,7 +11,9 @@
11#ifndef _PPC_BOOT_OPS_H_ 11#ifndef _PPC_BOOT_OPS_H_
12#define _PPC_BOOT_OPS_H_ 12#define _PPC_BOOT_OPS_H_
13 13
14#include <stddef.h>
14#include "types.h" 15#include "types.h"
16#include "string.h"
15 17
16#define COMMAND_LINE_SIZE 512 18#define COMMAND_LINE_SIZE 512
17#define MAX_PATH_LEN 256 19#define MAX_PATH_LEN 256
@@ -21,10 +23,11 @@
21struct platform_ops { 23struct platform_ops {
22 void (*fixups)(void); 24 void (*fixups)(void);
23 void (*image_hdr)(const void *); 25 void (*image_hdr)(const void *);
24 void * (*malloc)(u32 size); 26 void * (*malloc)(unsigned long size);
25 void (*free)(void *ptr); 27 void (*free)(void *ptr);
26 void * (*realloc)(void *ptr, unsigned long size); 28 void * (*realloc)(void *ptr, unsigned long size);
27 void (*exit)(void); 29 void (*exit)(void);
30 void * (*vmlinux_alloc)(unsigned long size);
28}; 31};
29extern struct platform_ops platform_ops; 32extern struct platform_ops platform_ops;
30 33
@@ -35,6 +38,12 @@ struct dt_ops {
35 const int buflen); 38 const int buflen);
36 int (*setprop)(const void *phandle, const char *name, 39 int (*setprop)(const void *phandle, const char *name,
37 const void *buf, const int buflen); 40 const void *buf, const int buflen);
41 void *(*get_parent)(const void *phandle);
42 /* The node must not already exist. */
43 void *(*create_node)(const void *parent, const char *name);
44 void *(*find_node_by_prop_value)(const void *prev,
45 const char *propname,
46 const char *propval, int proplen);
38 unsigned long (*finalize)(void); 47 unsigned long (*finalize)(void);
39}; 48};
40extern struct dt_ops dt_ops; 49extern struct dt_ops dt_ops;
@@ -58,13 +67,23 @@ struct serial_console_data {
58 void (*close)(void); 67 void (*close)(void);
59}; 68};
60 69
61int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end); 70struct loader_info {
71 void *promptr;
72 unsigned long initrd_addr, initrd_size;
73 char *cmdline;
74 int cmdline_len;
75};
76extern struct loader_info loader_info;
77
78void start(void);
62int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device); 79int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device);
63int serial_console_init(void); 80int serial_console_init(void);
64int ns16550_console_init(void *devp, struct serial_console_data *scdp); 81int ns16550_console_init(void *devp, struct serial_console_data *scdp);
65void *simple_alloc_init(char *base, u32 heap_size, u32 granularity, 82void *simple_alloc_init(char *base, unsigned long heap_size,
66 u32 max_allocs); 83 unsigned long granularity, unsigned long max_allocs);
67 84extern void flush_cache(void *, unsigned long);
85int dt_xlate_reg(void *node, int res, unsigned long *addr, unsigned long *size);
86int dt_xlate_addr(void *node, u32 *buf, int buflen, unsigned long *xlated_addr);
68 87
69static inline void *finddevice(const char *name) 88static inline void *finddevice(const char *name)
70{ 89{
@@ -76,12 +95,76 @@ static inline int getprop(void *devp, const char *name, void *buf, int buflen)
76 return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1; 95 return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1;
77} 96}
78 97
79static inline int setprop(void *devp, const char *name, void *buf, int buflen) 98static inline int setprop(void *devp, const char *name,
99 const void *buf, int buflen)
80{ 100{
81 return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1; 101 return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1;
82} 102}
103#define setprop_val(devp, name, val) \
104 do { \
105 typeof(val) x = (val); \
106 setprop((devp), (name), &x, sizeof(x)); \
107 } while (0)
108
109static inline int setprop_str(void *devp, const char *name, const char *buf)
110{
111 if (dt_ops.setprop)
112 return dt_ops.setprop(devp, name, buf, strlen(buf) + 1);
113
114 return -1;
115}
116
117static inline void *get_parent(const char *devp)
118{
119 return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL;
120}
121
122static inline void *create_node(const void *parent, const char *name)
123{
124 return dt_ops.create_node ? dt_ops.create_node(parent, name) : NULL;
125}
126
83 127
84static inline void *malloc(u32 size) 128static inline void *find_node_by_prop_value(const void *prev,
129 const char *propname,
130 const char *propval, int proplen)
131{
132 if (dt_ops.find_node_by_prop_value)
133 return dt_ops.find_node_by_prop_value(prev, propname,
134 propval, proplen);
135
136 return NULL;
137}
138
139static inline void *find_node_by_prop_value_str(const void *prev,
140 const char *propname,
141 const char *propval)
142{
143 return find_node_by_prop_value(prev, propname, propval,
144 strlen(propval) + 1);
145}
146
147static inline void *find_node_by_devtype(const void *prev,
148 const char *type)
149{
150 return find_node_by_prop_value_str(prev, "device_type", type);
151}
152
153void dt_fixup_memory(u64 start, u64 size);
154void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq);
155void dt_fixup_clock(const char *path, u32 freq);
156void __dt_fixup_mac_addresses(u32 startindex, ...);
157#define dt_fixup_mac_addresses(...) \
158 __dt_fixup_mac_addresses(0, __VA_ARGS__, NULL)
159
160
161static inline void *find_node_by_linuxphandle(const u32 linuxphandle)
162{
163 return find_node_by_prop_value(NULL, "linux,phandle",
164 (char *)&linuxphandle, sizeof(u32));
165}
166
167static inline void *malloc(unsigned long size)
85{ 168{
86 return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL; 169 return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL;
87} 170}
@@ -98,5 +181,11 @@ static inline void exit(void)
98 platform_ops.exit(); 181 platform_ops.exit();
99 for(;;); 182 for(;;);
100} 183}
184#define fatal(args...) { printf(args); exit(); }
185
186
187#define BSS_STACK(size) \
188 static char _bss_stack[size]; \
189 void *_platform_stack_top = _bss_stack + sizeof(_bss_stack);
101 190
102#endif /* _PPC_BOOT_OPS_H_ */ 191#endif /* _PPC_BOOT_OPS_H_ */
diff --git a/arch/powerpc/boot/ppcboot.h b/arch/powerpc/boot/ppcboot.h
new file mode 100644
index 000000000000..5290ff2c2b2b
--- /dev/null
+++ b/arch/powerpc/boot/ppcboot.h
@@ -0,0 +1,108 @@
1/*
2 * This interface is used for compatibility with old U-boots *ONLY*.
3 * Please do not imitate or extend this.
4 */
5
6/*
7 * (C) Copyright 2000, 2001
8 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
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,
23 * MA 02111-1307 USA
24 */
25
26#ifndef __PPCBOOT_H__
27#define __PPCBOOT_H__
28
29/*
30 * Board information passed to kernel from PPCBoot
31 *
32 * include/asm-ppc/ppcboot.h
33 */
34
35#include "types.h"
36
37typedef struct bd_info {
38 unsigned long bi_memstart; /* start of DRAM memory */
39 unsigned long bi_memsize; /* size of DRAM memory in bytes */
40 unsigned long bi_flashstart; /* start of FLASH memory */
41 unsigned long bi_flashsize; /* size of FLASH memory */
42 unsigned long bi_flashoffset; /* reserved area for startup monitor */
43 unsigned long bi_sramstart; /* start of SRAM memory */
44 unsigned long bi_sramsize; /* size of SRAM memory */
45#if defined(TARGET_8xx) || defined(TARGET_CPM2) || defined(TARGET_85xx) ||\
46 defined(TARGET_83xx)
47 unsigned long bi_immr_base; /* base of IMMR register */
48#endif
49#if defined(TARGET_PPC_MPC52xx)
50 unsigned long bi_mbar_base; /* base of internal registers */
51#endif
52 unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
53 unsigned long bi_ip_addr; /* IP Address */
54 unsigned char bi_enetaddr[6]; /* Ethernet address */
55 unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
56 unsigned long bi_intfreq; /* Internal Freq, in MHz */
57 unsigned long bi_busfreq; /* Bus Freq, in MHz */
58#if defined(TARGET_CPM2)
59 unsigned long bi_cpmfreq; /* CPM_CLK Freq, in MHz */
60 unsigned long bi_brgfreq; /* BRG_CLK Freq, in MHz */
61 unsigned long bi_sccfreq; /* SCC_CLK Freq, in MHz */
62 unsigned long bi_vco; /* VCO Out from PLL, in MHz */
63#endif
64#if defined(TARGET_PPC_MPC52xx)
65 unsigned long bi_ipbfreq; /* IPB Bus Freq, in MHz */
66 unsigned long bi_pcifreq; /* PCI Bus Freq, in MHz */
67#endif
68 unsigned long bi_baudrate; /* Console Baudrate */
69#if defined(TARGET_4xx)
70 unsigned char bi_s_version[4]; /* Version of this structure */
71 unsigned char bi_r_version[32]; /* Version of the ROM (IBM) */
72 unsigned int bi_procfreq; /* CPU (Internal) Freq, in Hz */
73 unsigned int bi_plb_busfreq; /* PLB Bus speed, in Hz */
74 unsigned int bi_pci_busfreq; /* PCI Bus speed, in Hz */
75 unsigned char bi_pci_enetaddr[6]; /* PCI Ethernet MAC address */
76#endif
77#if defined(TARGET_HYMOD)
78 hymod_conf_t bi_hymod_conf; /* hymod configuration information */
79#endif
80#if defined(TARGET_EVB64260) || defined(TARGET_405EP) || defined(TARGET_44x) || \
81 defined(TARGET_85xx) || defined(TARGET_83xx)
82 /* second onboard ethernet port */
83 unsigned char bi_enet1addr[6];
84#define HAVE_ENET1ADDR
85#endif
86#if defined(TARGET_EVB64260) || defined(TARGET_440GX) || defined(TARGET_85xx)
87 /* third onboard ethernet ports */
88 unsigned char bi_enet2addr[6];
89#define HAVE_ENET2ADDR
90#endif
91#if defined(TARGET_440GX)
92 /* fourth onboard ethernet ports */
93 unsigned char bi_enet3addr[6];
94#define HAVE_ENET3ADDR
95#endif
96#if defined(TARGET_4xx)
97 unsigned int bi_opbfreq; /* OB clock in Hz */
98 int bi_iic_fast[2]; /* Use fast i2c mode */
99#endif
100#if defined(TARGET_440GX)
101 int bi_phynum[4]; /* phy mapping */
102 int bi_phymode[4]; /* phy mode */
103#endif
104} bd_t;
105
106#define bi_tbfreq bi_intfreq
107
108#endif /* __PPCBOOT_H__ */
diff --git a/arch/powerpc/boot/reg.h b/arch/powerpc/boot/reg.h
new file mode 100644
index 000000000000..d3cd9ee98afb
--- /dev/null
+++ b/arch/powerpc/boot/reg.h
@@ -0,0 +1,22 @@
1#ifndef _PPC_BOOT_REG_H
2#define _PPC_BOOT_REG_H
3/*
4 * Copyright 2007 Davud Gibson, IBM Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12static inline u32 mfpvr(void)
13{
14 u32 pvr;
15 asm volatile ("mfpvr %0" : "=r"(pvr));
16 return pvr;
17}
18
19register void *__stack_pointer asm("r1");
20#define get_sp() (__stack_pointer)
21
22#endif /* _PPC_BOOT_REG_H */
diff --git a/arch/powerpc/boot/simple_alloc.c b/arch/powerpc/boot/simple_alloc.c
index cfe3a7505ba0..65ec135d0157 100644
--- a/arch/powerpc/boot/simple_alloc.c
+++ b/arch/powerpc/boot/simple_alloc.c
@@ -19,24 +19,24 @@
19#define ENTRY_IN_USE 0x02 19#define ENTRY_IN_USE 0x02
20 20
21static struct alloc_info { 21static struct alloc_info {
22 u32 flags; 22 unsigned long flags;
23 u32 base; 23 unsigned long base;
24 u32 size; 24 unsigned long size;
25} *alloc_tbl; 25} *alloc_tbl;
26 26
27static u32 tbl_entries; 27static unsigned long tbl_entries;
28static u32 alloc_min; 28static unsigned long alloc_min;
29static u32 next_base; 29static unsigned long next_base;
30static u32 space_left; 30static unsigned long space_left;
31 31
32/* 32/*
33 * First time an entry is used, its base and size are set. 33 * First time an entry is used, its base and size are set.
34 * An entry can be freed and re-malloc'd but its base & size don't change. 34 * An entry can be freed and re-malloc'd but its base & size don't change.
35 * Should be smart enough for needs of bootwrapper. 35 * Should be smart enough for needs of bootwrapper.
36 */ 36 */
37static void *simple_malloc(u32 size) 37static void *simple_malloc(unsigned long size)
38{ 38{
39 u32 i; 39 unsigned long i;
40 struct alloc_info *p = alloc_tbl; 40 struct alloc_info *p = alloc_tbl;
41 41
42 if (size == 0) 42 if (size == 0)
@@ -67,13 +67,14 @@ err_out:
67 67
68static struct alloc_info *simple_find_entry(void *ptr) 68static struct alloc_info *simple_find_entry(void *ptr)
69{ 69{
70 u32 i; 70 unsigned long i;
71 struct alloc_info *p = alloc_tbl; 71 struct alloc_info *p = alloc_tbl;
72 72
73 for (i=0; i<tbl_entries; i++,p++) { 73 for (i=0; i<tbl_entries; i++,p++) {
74 if (!(p->flags & ENTRY_BEEN_USED)) 74 if (!(p->flags & ENTRY_BEEN_USED))
75 break; 75 break;
76 if ((p->flags & ENTRY_IN_USE) && (p->base == (u32)ptr)) 76 if ((p->flags & ENTRY_IN_USE) &&
77 (p->base == (unsigned long)ptr))
77 return p; 78 return p;
78 } 79 }
79 return NULL; 80 return NULL;
@@ -122,10 +123,10 @@ static void *simple_realloc(void *ptr, unsigned long size)
122 * Returns addr of first byte after heap so caller can see if it took 123 * Returns addr of first byte after heap so caller can see if it took
123 * too much space. If so, change args & try again. 124 * too much space. If so, change args & try again.
124 */ 125 */
125void *simple_alloc_init(char *base, u32 heap_size, u32 granularity, 126void *simple_alloc_init(char *base, unsigned long heap_size,
126 u32 max_allocs) 127 unsigned long granularity, unsigned long max_allocs)
127{ 128{
128 u32 heap_base, tbl_size; 129 unsigned long heap_base, tbl_size;
129 130
130 heap_size = _ALIGN_UP(heap_size, granularity); 131 heap_size = _ALIGN_UP(heap_size, granularity);
131 alloc_min = granularity; 132 alloc_min = granularity;
@@ -136,7 +137,7 @@ void *simple_alloc_init(char *base, u32 heap_size, u32 granularity,
136 alloc_tbl = (struct alloc_info *)_ALIGN_UP((unsigned long)base, 8); 137 alloc_tbl = (struct alloc_info *)_ALIGN_UP((unsigned long)base, 8);
137 memset(alloc_tbl, 0, tbl_size); 138 memset(alloc_tbl, 0, tbl_size);
138 139
139 heap_base = _ALIGN_UP((u32)alloc_tbl + tbl_size, alloc_min); 140 heap_base = _ALIGN_UP((unsigned long)alloc_tbl + tbl_size, alloc_min);
140 141
141 next_base = heap_base; 142 next_base = heap_base;
142 space_left = heap_size; 143 space_left = heap_size;
diff --git a/arch/powerpc/boot/stdio.h b/arch/powerpc/boot/stdio.h
index 73b8a91bfb34..adffc58412d4 100644
--- a/arch/powerpc/boot/stdio.h
+++ b/arch/powerpc/boot/stdio.h
@@ -7,11 +7,12 @@
7#define EINVAL 22 /* Invalid argument */ 7#define EINVAL 22 /* Invalid argument */
8#define ENOSPC 28 /* No space left on device */ 8#define ENOSPC 28 /* No space left on device */
9 9
10extern int printf(const char *fmt, ...); 10extern int printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
11 11
12#define fprintf(fmt, args...) printf(args) 12#define fprintf(fmt, args...) printf(args)
13 13
14extern int sprintf(char *buf, const char *fmt, ...); 14extern int sprintf(char *buf, const char *fmt, ...)
15 __attribute__((format(printf, 2, 3)));
15 16
16extern int vsprintf(char *buf, const char *fmt, va_list args); 17extern int vsprintf(char *buf, const char *fmt, va_list args);
17 18
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 024e4d425c59..5cedd901201f 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -29,6 +29,7 @@ initrd=
29dtb= 29dtb=
30dts= 30dts=
31cacheit= 31cacheit=
32gzip=.gz
32 33
33# cross-compilation prefix 34# cross-compilation prefix
34CROSS= 35CROSS=
@@ -42,7 +43,7 @@ tmpdir=.
42usage() { 43usage() {
43 echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2 44 echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
44 echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2 45 echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2
45 echo ' [-D datadir] [-W workingdir] [vmlinux]' >&2 46 echo ' [-D datadir] [-W workingdir] [--no-gzip] [vmlinux]' >&2
46 exit 1 47 exit 1
47} 48}
48 49
@@ -91,6 +92,9 @@ while [ "$#" -gt 0 ]; do
91 [ "$#" -gt 0 ] || usage 92 [ "$#" -gt 0 ] || usage
92 tmpdir="$1" 93 tmpdir="$1"
93 ;; 94 ;;
95 --no-gzip)
96 gzip=
97 ;;
94 -?) 98 -?)
95 usage 99 usage
96 ;; 100 ;;
@@ -137,31 +141,44 @@ miboot|uboot)
137 ksection=image 141 ksection=image
138 isection=initrd 142 isection=initrd
139 ;; 143 ;;
144cuboot*)
145 gzip=
146 ;;
140esac 147esac
141 148
142vmz="$tmpdir/`basename \"$kernel\"`.$ext" 149vmz="$tmpdir/`basename \"$kernel\"`.$ext"
143if [ -z "$cacheit" -o ! -f "$vmz.gz" -o "$vmz.gz" -ot "$kernel" ]; then 150if [ -z "$cacheit" -o ! -f "$vmz$gzip" -o "$vmz$gzip" -ot "$kernel" ]; then
144 ${CROSS}objcopy $objflags "$kernel" "$vmz.$$" 151 ${CROSS}objcopy $objflags "$kernel" "$vmz.$$"
145 gzip -f -9 "$vmz.$$" 152
153 if [ -n "$gzip" ]; then
154 gzip -f -9 "$vmz.$$"
155 fi
156
146 if [ -n "$cacheit" ]; then 157 if [ -n "$cacheit" ]; then
147 mv -f "$vmz.$$.gz" "$vmz.gz" 158 mv -f "$vmz.$$$gzip" "$vmz$gzip"
148 else 159 else
149 vmz="$vmz.$$" 160 vmz="$vmz.$$"
150 fi 161 fi
151fi 162fi
152 163
164vmz="$vmz$gzip"
165
153case "$platform" in 166case "$platform" in
154uboot) 167uboot|cuboot*)
155 rm -f "$ofile"
156 version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ 168 version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
157 cut -d' ' -f3` 169 cut -d' ' -f3`
158 if [ -n "$version" ]; then 170 if [ -n "$version" ]; then
159 version="-n Linux-$version" 171 version="-n Linux-$version"
160 fi 172 fi
173esac
174
175case "$platform" in
176uboot)
177 rm -f "$ofile"
161 mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \ 178 mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
162 $version -d "$vmz.gz" "$ofile" 179 $version -d "$vmz" "$ofile"
163 if [ -z "$cacheit" ]; then 180 if [ -z "$cacheit" ]; then
164 rm -f $vmz.gz 181 rm -f "$vmz"
165 fi 182 fi
166 exit 0 183 exit 0
167 ;; 184 ;;
@@ -173,9 +190,9 @@ addsec() {
173 --set-section-flags=$3=contents,alloc,load,readonly,data 190 --set-section-flags=$3=contents,alloc,load,readonly,data
174} 191}
175 192
176addsec $tmp "$vmz.gz" $ksection $object/empty.o 193addsec $tmp "$vmz" $ksection $object/empty.o
177if [ -z "$cacheit" ]; then 194if [ -z "$cacheit" ]; then
178 rm -f "$vmz.gz" 195 rm -f "$vmz"
179fi 196fi
180 197
181if [ -n "$initrd" ]; then 198if [ -n "$initrd" ]; then
@@ -191,7 +208,7 @@ fi
191 208
192if [ "$platform" != "miboot" ]; then 209if [ "$platform" != "miboot" ]; then
193 ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \ 210 ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
194 $object/crt0.o $platformo $tmp $object/wrapper.a 211 $platformo $tmp $object/wrapper.a
195 rm $tmp 212 rm $tmp
196fi 213fi
197 214
@@ -201,7 +218,19 @@ pseries|chrp)
201 $object/addnote "$ofile" 218 $object/addnote "$ofile"
202 ;; 219 ;;
203pmaccoff) 220pmaccoff)
204 ${CROSS}objcopy -O aixcoff-rs6000 --set-start 0x500000 "$ofile" 221 entry=`objdump -f "$ofile" | grep '^start address ' | \
222 cut -d' ' -f3`
223 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
205 $object/hack-coff "$ofile" 224 $object/hack-coff "$ofile"
206 ;; 225 ;;
226cuboot*)
227 base=`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
228 entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | \
229 cut -d' ' -f3`
230 mv "$ofile" "$ofile".elf
231 ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin
232 gzip -f -9 "$ofile".bin
233 mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
234 $version -d "$ofile".bin.gz "$ofile"
235 ;;
207esac 236esac
diff --git a/arch/powerpc/boot/zImage.coff.lds.S b/arch/powerpc/boot/zImage.coff.lds.S
index a360905e5428..fe87a90ce7f1 100644
--- a/arch/powerpc/boot/zImage.coff.lds.S
+++ b/arch/powerpc/boot/zImage.coff.lds.S
@@ -1,5 +1,6 @@
1OUTPUT_ARCH(powerpc:common) 1OUTPUT_ARCH(powerpc:common)
2ENTRY(_start) 2ENTRY(_zimage_start_opd)
3EXTERN(_zimage_start_opd)
3SECTIONS 4SECTIONS
4{ 5{
5 . = (5*1024*1024); 6 . = (5*1024*1024);
diff --git a/arch/powerpc/boot/zImage.lds.S b/arch/powerpc/boot/zImage.lds.S
index 4be3c6414b04..f6e380fdb388 100644
--- a/arch/powerpc/boot/zImage.lds.S
+++ b/arch/powerpc/boot/zImage.lds.S
@@ -1,5 +1,6 @@
1OUTPUT_ARCH(powerpc:common) 1OUTPUT_ARCH(powerpc:common)
2ENTRY(_zimage_start) 2ENTRY(_zimage_start)
3EXTERN(_zimage_start)
3SECTIONS 4SECTIONS
4{ 5{
5 . = (4*1024*1024); 6 . = (4*1024*1024);
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index cf7e316ad4f6..6061e5f7696e 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc3 3# Linux kernel version: 2.6.21-rc6
4# Fri Mar 9 23:34:53 2007 4# Mon Apr 23 20:46:48 2007
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -139,11 +139,31 @@ CONFIG_PPC_MULTIPLATFORM=y
139# CONFIG_PPC_PMAC is not set 139# CONFIG_PPC_PMAC is not set
140# CONFIG_PPC_MAPLE is not set 140# CONFIG_PPC_MAPLE is not set
141# CONFIG_PPC_PASEMI is not set 141# CONFIG_PPC_PASEMI is not set
142CONFIG_PPC_CELLEB=y
143CONFIG_PPC_PS3=y
144
145#
146# PS3 Platform Options
147#
148# CONFIG_PS3_ADVANCED is not set
149CONFIG_PS3_HTAB_SIZE=20
150# CONFIG_PS3_DYNAMIC_DMA is not set
151CONFIG_PS3_USE_LPAR_ADDR=y
152CONFIG_PS3_VUART=y
153CONFIG_PS3_PS3AV=y
154CONFIG_PS3_SYS_MANAGER=y
142CONFIG_PPC_CELL=y 155CONFIG_PPC_CELL=y
143CONFIG_PPC_CELL_NATIVE=y 156CONFIG_PPC_CELL_NATIVE=y
144CONFIG_PPC_IBM_CELL_BLADE=y 157CONFIG_PPC_IBM_CELL_BLADE=y
145CONFIG_PPC_PS3=y 158
146CONFIG_PPC_CELLEB=y 159#
160# Cell Broadband Engine options
161#
162CONFIG_SPU_FS=m
163CONFIG_SPU_BASE=y
164CONFIG_CBE_RAS=y
165CONFIG_CBE_THERM=m
166CONFIG_CBE_CPUFREQ=m
147CONFIG_PPC_NATIVE=y 167CONFIG_PPC_NATIVE=y
148CONFIG_UDBG_RTAS_CONSOLE=y 168CONFIG_UDBG_RTAS_CONSOLE=y
149CONFIG_PPC_UDBG_BEAT=y 169CONFIG_PPC_UDBG_BEAT=y
@@ -175,26 +195,6 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
175CONFIG_MPIC=y 195CONFIG_MPIC=y
176 196
177# 197#
178# Cell Broadband Engine options
179#
180CONFIG_SPU_FS=m
181CONFIG_SPU_BASE=y
182CONFIG_CBE_RAS=y
183CONFIG_CBE_THERM=m
184CONFIG_CBE_CPUFREQ=m
185
186#
187# PS3 Platform Options
188#
189# CONFIG_PS3_ADVANCED is not set
190CONFIG_PS3_HTAB_SIZE=20
191# CONFIG_PS3_DYNAMIC_DMA is not set
192CONFIG_PS3_USE_LPAR_ADDR=y
193CONFIG_PS3_VUART=y
194CONFIG_PS3_PS3AV=y
195CONFIG_PS3_SYS_MANAGER=y
196
197#
198# Kernel options 198# Kernel options
199# 199#
200# CONFIG_HZ_100 is not set 200# CONFIG_HZ_100 is not set
@@ -534,7 +534,6 @@ CONFIG_BLK_DEV_GENERIC=y
534# CONFIG_BLK_DEV_OPTI621 is not set 534# CONFIG_BLK_DEV_OPTI621 is not set
535CONFIG_BLK_DEV_IDEDMA_PCI=y 535CONFIG_BLK_DEV_IDEDMA_PCI=y
536# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 536# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
537CONFIG_IDEDMA_PCI_AUTO=y
538# CONFIG_IDEDMA_ONLYDISK is not set 537# CONFIG_IDEDMA_ONLYDISK is not set
539CONFIG_BLK_DEV_AEC62XX=y 538CONFIG_BLK_DEV_AEC62XX=y
540# CONFIG_BLK_DEV_ALI15X3 is not set 539# CONFIG_BLK_DEV_ALI15X3 is not set
@@ -561,11 +560,10 @@ CONFIG_BLK_DEV_SIIMAGE=y
561# CONFIG_BLK_DEV_TRM290 is not set 560# CONFIG_BLK_DEV_TRM290 is not set
562# CONFIG_BLK_DEV_VIA82CXXX is not set 561# CONFIG_BLK_DEV_VIA82CXXX is not set
563# CONFIG_BLK_DEV_TC86C001 is not set 562# CONFIG_BLK_DEV_TC86C001 is not set
564CONFIG_BLK_DEV_IDE_CELLEB=y 563CONFIG_BLK_DEV_CELLEB=y
565# CONFIG_IDE_ARM is not set 564# CONFIG_IDE_ARM is not set
566CONFIG_BLK_DEV_IDEDMA=y 565CONFIG_BLK_DEV_IDEDMA=y
567# CONFIG_IDEDMA_IVB is not set 566# CONFIG_IDEDMA_IVB is not set
568CONFIG_IDEDMA_AUTO=y
569# CONFIG_BLK_DEV_HD is not set 567# CONFIG_BLK_DEV_HD is not set
570 568
571# 569#
@@ -937,7 +935,7 @@ CONFIG_UNIX98_PTYS=y
937# CONFIG_LEGACY_PTYS is not set 935# CONFIG_LEGACY_PTYS is not set
938CONFIG_HVC_DRIVER=y 936CONFIG_HVC_DRIVER=y
939CONFIG_HVC_RTAS=y 937CONFIG_HVC_RTAS=y
940# CONFIG_HVC_BEAT is not set 938CONFIG_HVC_BEAT=y
941 939
942# 940#
943# IPMI 941# IPMI
@@ -1482,6 +1480,8 @@ CONFIG_NLS_ISO8859_15=m
1482# Distributed Lock Manager 1480# Distributed Lock Manager
1483# 1481#
1484# CONFIG_DLM is not set 1482# CONFIG_DLM is not set
1483# CONFIG_UCC_SLOW is not set
1484# CONFIG_UCC_FAST is not set
1485 1485
1486# 1486#
1487# Library routines 1487# Library routines
@@ -1540,6 +1540,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1540# CONFIG_FAULT_INJECTION is not set 1540# CONFIG_FAULT_INJECTION is not set
1541# CONFIG_DEBUG_STACKOVERFLOW is not set 1541# CONFIG_DEBUG_STACKOVERFLOW is not set
1542# CONFIG_DEBUG_STACK_USAGE is not set 1542# CONFIG_DEBUG_STACK_USAGE is not set
1543# CONFIG_DEBUG_PAGEALLOC is not set
1543CONFIG_DEBUGGER=y 1544CONFIG_DEBUGGER=y
1544CONFIG_XMON=y 1545CONFIG_XMON=y
1545CONFIG_XMON_DEFAULT=y 1546CONFIG_XMON_DEFAULT=y
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index 7724847f702a..3ccf19d8da38 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -143,7 +143,7 @@ CONFIG_PPC_NATIVE=y
143CONFIG_U3_DART=y 143CONFIG_U3_DART=y
144# CONFIG_PPC_RTAS is not set 144# CONFIG_PPC_RTAS is not set
145# CONFIG_MMIO_NVRAM is not set 145# CONFIG_MMIO_NVRAM is not set
146CONFIG_MPIC_BROKEN_U3=y 146CONFIG_MPIC_U3_HT_IRQS=y
147# CONFIG_PPC_MPC106 is not set 147# CONFIG_PPC_MPC106 is not set
148CONFIG_PPC_970_NAP=y 148CONFIG_PPC_970_NAP=y
149# CONFIG_PPC_INDIRECT_IO is not set 149# CONFIG_PPC_INDIRECT_IO is not set
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig
index de97f2f0ae96..15366f0e489f 100644
--- a/arch/powerpc/configs/maple_defconfig
+++ b/arch/powerpc/configs/maple_defconfig
@@ -146,7 +146,7 @@ CONFIG_PPC_RTAS=y
146CONFIG_RTAS_PROC=y 146CONFIG_RTAS_PROC=y
147# CONFIG_RTAS_FLASH is not set 147# CONFIG_RTAS_FLASH is not set
148# CONFIG_MMIO_NVRAM is not set 148# CONFIG_MMIO_NVRAM is not set
149CONFIG_MPIC_BROKEN_U3=y 149CONFIG_MPIC_U3_HT_IRQS=y
150# CONFIG_PPC_MPC106 is not set 150# CONFIG_PPC_MPC106 is not set
151CONFIG_PPC_970_NAP=y 151CONFIG_PPC_970_NAP=y
152# CONFIG_PPC_INDIRECT_IO is not set 152# CONFIG_PPC_INDIRECT_IO is not set
diff --git a/arch/powerpc/configs/mpc832x_rdb_defconfig b/arch/powerpc/configs/mpc832x_rdb_defconfig
new file mode 100644
index 000000000000..56fc0a824458
--- /dev/null
+++ b/arch/powerpc/configs/mpc832x_rdb_defconfig
@@ -0,0 +1,1292 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc3
4# Mon Mar 12 17:32:19 2007
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
13CONFIG_ARCH_HAS_ILOG2_U32=y
14CONFIG_GENERIC_HWEIGHT=y
15CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_FIND_NEXT_BIT=y
17CONFIG_PPC=y
18CONFIG_EARLY_PRINTK=y
19CONFIG_GENERIC_NVRAM=y
20CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
21CONFIG_ARCH_MAY_HAVE_PC_FDC=y
22CONFIG_PPC_OF=y
23CONFIG_PPC_UDBG_16550=y
24# CONFIG_GENERIC_TBSYNC is not set
25CONFIG_AUDIT_ARCH=y
26CONFIG_GENERIC_BUG=y
27CONFIG_DEFAULT_UIMAGE=y
28
29#
30# Processor support
31#
32# CONFIG_CLASSIC32 is not set
33# CONFIG_PPC_82xx is not set
34CONFIG_PPC_83xx=y
35# CONFIG_PPC_85xx is not set
36# CONFIG_PPC_86xx is not set
37# CONFIG_PPC_8xx is not set
38# CONFIG_40x is not set
39# CONFIG_44x is not set
40# CONFIG_E200 is not set
41CONFIG_6xx=y
42CONFIG_83xx=y
43CONFIG_PPC_FPU=y
44# CONFIG_PPC_DCR_NATIVE is not set
45# CONFIG_PPC_DCR_MMIO is not set
46CONFIG_PPC_STD_MMU=y
47CONFIG_PPC_STD_MMU_32=y
48# CONFIG_SMP is not set
49CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
50
51#
52# Code maturity level options
53#
54CONFIG_EXPERIMENTAL=y
55CONFIG_BROKEN_ON_SMP=y
56CONFIG_INIT_ENV_ARG_LIMIT=32
57
58#
59# General setup
60#
61CONFIG_LOCALVERSION=""
62CONFIG_LOCALVERSION_AUTO=y
63CONFIG_SWAP=y
64CONFIG_SYSVIPC=y
65# CONFIG_IPC_NS is not set
66CONFIG_SYSVIPC_SYSCTL=y
67# CONFIG_POSIX_MQUEUE is not set
68# CONFIG_BSD_PROCESS_ACCT is not set
69# CONFIG_TASKSTATS is not set
70# CONFIG_UTS_NS is not set
71# CONFIG_AUDIT is not set
72# CONFIG_IKCONFIG is not set
73CONFIG_SYSFS_DEPRECATED=y
74# CONFIG_RELAY is not set
75CONFIG_BLK_DEV_INITRD=y
76CONFIG_INITRAMFS_SOURCE=""
77# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
78CONFIG_SYSCTL=y
79CONFIG_EMBEDDED=y
80CONFIG_SYSCTL_SYSCALL=y
81# CONFIG_KALLSYMS is not set
82CONFIG_HOTPLUG=y
83CONFIG_PRINTK=y
84CONFIG_BUG=y
85CONFIG_ELF_CORE=y
86CONFIG_BASE_FULL=y
87CONFIG_FUTEX=y
88# CONFIG_EPOLL is not set
89CONFIG_SHMEM=y
90CONFIG_SLAB=y
91CONFIG_VM_EVENT_COUNTERS=y
92CONFIG_RT_MUTEXES=y
93# CONFIG_TINY_SHMEM is not set
94CONFIG_BASE_SMALL=0
95# CONFIG_SLOB is not set
96
97#
98# Loadable module support
99#
100CONFIG_MODULES=y
101CONFIG_MODULE_UNLOAD=y
102# CONFIG_MODULE_FORCE_UNLOAD is not set
103# CONFIG_MODVERSIONS is not set
104# CONFIG_MODULE_SRCVERSION_ALL is not set
105# CONFIG_KMOD is not set
106
107#
108# Block layer
109#
110CONFIG_BLOCK=y
111# CONFIG_LBD is not set
112# CONFIG_BLK_DEV_IO_TRACE is not set
113# CONFIG_LSF is not set
114
115#
116# IO Schedulers
117#
118CONFIG_IOSCHED_NOOP=y
119CONFIG_IOSCHED_AS=y
120CONFIG_IOSCHED_DEADLINE=y
121CONFIG_IOSCHED_CFQ=y
122CONFIG_DEFAULT_AS=y
123# CONFIG_DEFAULT_DEADLINE is not set
124# CONFIG_DEFAULT_CFQ is not set
125# CONFIG_DEFAULT_NOOP is not set
126CONFIG_DEFAULT_IOSCHED="anticipatory"
127CONFIG_QUICC_ENGINE=y
128CONFIG_PPC_GEN550=y
129# CONFIG_WANT_EARLY_SERIAL is not set
130
131#
132# Platform support
133#
134# CONFIG_MPC8313_RDB is not set
135# CONFIG_MPC832x_MDS is not set
136CONFIG_MPC832x_RDB=y
137# CONFIG_MPC834x_MDS is not set
138# CONFIG_MPC834x_ITX is not set
139# CONFIG_MPC836x_MDS is not set
140CONFIG_PPC_MPC832x=y
141# CONFIG_MPIC is not set
142
143#
144# Kernel options
145#
146# CONFIG_HIGHMEM is not set
147# CONFIG_HZ_100 is not set
148CONFIG_HZ_250=y
149# CONFIG_HZ_300 is not set
150# CONFIG_HZ_1000 is not set
151CONFIG_HZ=250
152CONFIG_PREEMPT_NONE=y
153# CONFIG_PREEMPT_VOLUNTARY is not set
154# CONFIG_PREEMPT is not set
155CONFIG_BINFMT_ELF=y
156# CONFIG_BINFMT_MISC is not set
157CONFIG_MATH_EMULATION=y
158CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
159CONFIG_ARCH_FLATMEM_ENABLE=y
160CONFIG_ARCH_POPULATES_NODE_MAP=y
161CONFIG_SELECT_MEMORY_MODEL=y
162CONFIG_FLATMEM_MANUAL=y
163# CONFIG_DISCONTIGMEM_MANUAL is not set
164# CONFIG_SPARSEMEM_MANUAL is not set
165CONFIG_FLATMEM=y
166CONFIG_FLAT_NODE_MEM_MAP=y
167# CONFIG_SPARSEMEM_STATIC is not set
168CONFIG_SPLIT_PTLOCK_CPUS=4
169# CONFIG_RESOURCES_64BIT is not set
170CONFIG_ZONE_DMA_FLAG=1
171CONFIG_PROC_DEVICETREE=y
172# CONFIG_CMDLINE_BOOL is not set
173# CONFIG_PM is not set
174CONFIG_SECCOMP=y
175CONFIG_ISA_DMA_API=y
176
177#
178# Bus options
179#
180CONFIG_ZONE_DMA=y
181CONFIG_GENERIC_ISA_DMA=y
182# CONFIG_MPIC_WEIRD is not set
183# CONFIG_PPC_I8259 is not set
184CONFIG_PPC_INDIRECT_PCI=y
185CONFIG_FSL_SOC=y
186CONFIG_PCI=y
187CONFIG_PCI_DOMAINS=y
188# CONFIG_PCIEPORTBUS is not set
189
190#
191# PCCARD (PCMCIA/CardBus) support
192#
193# CONFIG_PCCARD is not set
194
195#
196# PCI Hotplug Support
197#
198# CONFIG_HOTPLUG_PCI is not set
199
200#
201# Advanced setup
202#
203# CONFIG_ADVANCED_OPTIONS is not set
204
205#
206# Default settings for advanced configuration options are used
207#
208CONFIG_HIGHMEM_START=0xfe000000
209CONFIG_LOWMEM_SIZE=0x30000000
210CONFIG_KERNEL_START=0xc0000000
211CONFIG_TASK_SIZE=0x80000000
212CONFIG_BOOT_LOAD=0x00800000
213
214#
215# Networking
216#
217CONFIG_NET=y
218
219#
220# Networking options
221#
222# CONFIG_NETDEBUG is not set
223CONFIG_PACKET=y
224# CONFIG_PACKET_MMAP is not set
225CONFIG_UNIX=y
226CONFIG_XFRM=y
227# CONFIG_XFRM_USER is not set
228# CONFIG_XFRM_SUB_POLICY is not set
229# CONFIG_XFRM_MIGRATE is not set
230# CONFIG_NET_KEY is not set
231CONFIG_INET=y
232CONFIG_IP_MULTICAST=y
233# CONFIG_IP_ADVANCED_ROUTER is not set
234CONFIG_IP_FIB_HASH=y
235CONFIG_IP_PNP=y
236CONFIG_IP_PNP_DHCP=y
237CONFIG_IP_PNP_BOOTP=y
238# CONFIG_IP_PNP_RARP is not set
239# CONFIG_NET_IPIP is not set
240# CONFIG_NET_IPGRE is not set
241# CONFIG_IP_MROUTE is not set
242# CONFIG_ARPD is not set
243CONFIG_SYN_COOKIES=y
244# CONFIG_INET_AH is not set
245# CONFIG_INET_ESP is not set
246# CONFIG_INET_IPCOMP is not set
247# CONFIG_INET_XFRM_TUNNEL is not set
248# CONFIG_INET_TUNNEL is not set
249CONFIG_INET_XFRM_MODE_TRANSPORT=y
250CONFIG_INET_XFRM_MODE_TUNNEL=y
251CONFIG_INET_XFRM_MODE_BEET=y
252CONFIG_INET_DIAG=y
253CONFIG_INET_TCP_DIAG=y
254# CONFIG_TCP_CONG_ADVANCED is not set
255CONFIG_TCP_CONG_CUBIC=y
256CONFIG_DEFAULT_TCP_CONG="cubic"
257# CONFIG_TCP_MD5SIG is not set
258# CONFIG_IPV6 is not set
259# CONFIG_INET6_XFRM_TUNNEL is not set
260# CONFIG_INET6_TUNNEL is not set
261# CONFIG_NETWORK_SECMARK is not set
262# CONFIG_NETFILTER is not set
263
264#
265# DCCP Configuration (EXPERIMENTAL)
266#
267# CONFIG_IP_DCCP is not set
268
269#
270# SCTP Configuration (EXPERIMENTAL)
271#
272# CONFIG_IP_SCTP is not set
273
274#
275# TIPC Configuration (EXPERIMENTAL)
276#
277# CONFIG_TIPC is not set
278# CONFIG_ATM is not set
279# CONFIG_BRIDGE is not set
280# CONFIG_VLAN_8021Q is not set
281# CONFIG_DECNET is not set
282# CONFIG_LLC2 is not set
283# CONFIG_IPX is not set
284# CONFIG_ATALK is not set
285# CONFIG_X25 is not set
286# CONFIG_LAPB is not set
287# CONFIG_ECONET is not set
288# CONFIG_WAN_ROUTER is not set
289
290#
291# QoS and/or fair queueing
292#
293# CONFIG_NET_SCHED is not set
294
295#
296# Network testing
297#
298# CONFIG_NET_PKTGEN is not set
299# CONFIG_HAMRADIO is not set
300# CONFIG_IRDA is not set
301# CONFIG_BT is not set
302# CONFIG_IEEE80211 is not set
303
304#
305# Device Drivers
306#
307
308#
309# Generic Driver Options
310#
311CONFIG_STANDALONE=y
312CONFIG_PREVENT_FIRMWARE_BUILD=y
313# CONFIG_FW_LOADER is not set
314# CONFIG_SYS_HYPERVISOR is not set
315
316#
317# Connector - unified userspace <-> kernelspace linker
318#
319# CONFIG_CONNECTOR is not set
320
321#
322# Memory Technology Devices (MTD)
323#
324# CONFIG_MTD is not set
325
326#
327# Parallel port support
328#
329# CONFIG_PARPORT is not set
330
331#
332# Plug and Play support
333#
334# CONFIG_PNPACPI is not set
335
336#
337# Block devices
338#
339# CONFIG_BLK_DEV_FD is not set
340# CONFIG_BLK_CPQ_DA is not set
341# CONFIG_BLK_CPQ_CISS_DA is not set
342# CONFIG_BLK_DEV_DAC960 is not set
343# CONFIG_BLK_DEV_UMEM is not set
344# CONFIG_BLK_DEV_COW_COMMON is not set
345CONFIG_BLK_DEV_LOOP=y
346# CONFIG_BLK_DEV_CRYPTOLOOP is not set
347# CONFIG_BLK_DEV_NBD is not set
348# CONFIG_BLK_DEV_SX8 is not set
349# CONFIG_BLK_DEV_UB is not set
350CONFIG_BLK_DEV_RAM=y
351CONFIG_BLK_DEV_RAM_COUNT=16
352CONFIG_BLK_DEV_RAM_SIZE=32768
353CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
354# CONFIG_CDROM_PKTCDVD is not set
355# CONFIG_ATA_OVER_ETH is not set
356
357#
358# Misc devices
359#
360# CONFIG_SGI_IOC4 is not set
361# CONFIG_TIFM_CORE is not set
362
363#
364# ATA/ATAPI/MFM/RLL support
365#
366# CONFIG_IDE is not set
367
368#
369# SCSI device support
370#
371# CONFIG_RAID_ATTRS is not set
372CONFIG_SCSI=y
373# CONFIG_SCSI_TGT is not set
374# CONFIG_SCSI_NETLINK is not set
375CONFIG_SCSI_PROC_FS=y
376
377#
378# SCSI support type (disk, tape, CD-ROM)
379#
380CONFIG_BLK_DEV_SD=y
381# CONFIG_CHR_DEV_ST is not set
382# CONFIG_CHR_DEV_OSST is not set
383# CONFIG_BLK_DEV_SR is not set
384# CONFIG_CHR_DEV_SG is not set
385# CONFIG_CHR_DEV_SCH is not set
386
387#
388# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
389#
390# CONFIG_SCSI_MULTI_LUN is not set
391# CONFIG_SCSI_CONSTANTS is not set
392# CONFIG_SCSI_LOGGING is not set
393# CONFIG_SCSI_SCAN_ASYNC is not set
394
395#
396# SCSI Transports
397#
398# CONFIG_SCSI_SPI_ATTRS is not set
399# CONFIG_SCSI_FC_ATTRS is not set
400# CONFIG_SCSI_ISCSI_ATTRS is not set
401# CONFIG_SCSI_SAS_ATTRS is not set
402# CONFIG_SCSI_SAS_LIBSAS is not set
403
404#
405# SCSI low-level drivers
406#
407# CONFIG_ISCSI_TCP is not set
408# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
409# CONFIG_SCSI_3W_9XXX is not set
410# CONFIG_SCSI_ACARD is not set
411# CONFIG_SCSI_AACRAID is not set
412# CONFIG_SCSI_AIC7XXX is not set
413# CONFIG_SCSI_AIC7XXX_OLD is not set
414# CONFIG_SCSI_AIC79XX is not set
415# CONFIG_SCSI_AIC94XX is not set
416# CONFIG_SCSI_DPT_I2O is not set
417# CONFIG_SCSI_ARCMSR is not set
418# CONFIG_MEGARAID_NEWGEN is not set
419# CONFIG_MEGARAID_LEGACY is not set
420# CONFIG_MEGARAID_SAS is not set
421# CONFIG_SCSI_HPTIOP is not set
422# CONFIG_SCSI_BUSLOGIC is not set
423# CONFIG_SCSI_DMX3191D is not set
424# CONFIG_SCSI_EATA is not set
425# CONFIG_SCSI_FUTURE_DOMAIN is not set
426# CONFIG_SCSI_GDTH is not set
427# CONFIG_SCSI_IPS is not set
428# CONFIG_SCSI_INITIO is not set
429# CONFIG_SCSI_INIA100 is not set
430# CONFIG_SCSI_STEX is not set
431# CONFIG_SCSI_SYM53C8XX_2 is not set
432# CONFIG_SCSI_QLOGIC_1280 is not set
433# CONFIG_SCSI_QLA_FC is not set
434# CONFIG_SCSI_QLA_ISCSI is not set
435# CONFIG_SCSI_LPFC is not set
436# CONFIG_SCSI_DC395x is not set
437# CONFIG_SCSI_DC390T is not set
438# CONFIG_SCSI_NSP32 is not set
439# CONFIG_SCSI_DEBUG is not set
440# CONFIG_SCSI_SRP is not set
441
442#
443# Serial ATA (prod) and Parallel ATA (experimental) drivers
444#
445# CONFIG_ATA is not set
446
447#
448# Multi-device support (RAID and LVM)
449#
450# CONFIG_MD is not set
451
452#
453# Fusion MPT device support
454#
455# CONFIG_FUSION is not set
456# CONFIG_FUSION_SPI is not set
457# CONFIG_FUSION_FC is not set
458# CONFIG_FUSION_SAS is not set
459
460#
461# IEEE 1394 (FireWire) support
462#
463# CONFIG_IEEE1394 is not set
464
465#
466# I2O device support
467#
468# CONFIG_I2O is not set
469
470#
471# Macintosh device drivers
472#
473# CONFIG_MAC_EMUMOUSEBTN is not set
474# CONFIG_WINDFARM is not set
475
476#
477# Network device support
478#
479CONFIG_NETDEVICES=y
480# CONFIG_DUMMY is not set
481# CONFIG_BONDING is not set
482# CONFIG_EQUALIZER is not set
483# CONFIG_TUN is not set
484
485#
486# ARCnet devices
487#
488# CONFIG_ARCNET is not set
489
490#
491# PHY device support
492#
493# CONFIG_PHYLIB is not set
494
495#
496# Ethernet (10 or 100Mbit)
497#
498CONFIG_NET_ETHERNET=y
499CONFIG_MII=y
500# CONFIG_HAPPYMEAL is not set
501# CONFIG_SUNGEM is not set
502# CONFIG_CASSINI is not set
503# CONFIG_NET_VENDOR_3COM is not set
504
505#
506# Tulip family network device support
507#
508# CONFIG_NET_TULIP is not set
509# CONFIG_HP100 is not set
510# CONFIG_NET_PCI is not set
511
512#
513# Ethernet (1000 Mbit)
514#
515# CONFIG_ACENIC is not set
516# CONFIG_DL2K is not set
517CONFIG_E1000=y
518# CONFIG_E1000_NAPI is not set
519# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
520# CONFIG_NS83820 is not set
521# CONFIG_HAMACHI is not set
522# CONFIG_YELLOWFIN is not set
523# CONFIG_R8169 is not set
524# CONFIG_SIS190 is not set
525# CONFIG_SKGE is not set
526# CONFIG_SKY2 is not set
527# CONFIG_SK98LIN is not set
528# CONFIG_TIGON3 is not set
529# CONFIG_BNX2 is not set
530# CONFIG_GIANFAR is not set
531CONFIG_UCC_GETH=y
532CONFIG_UGETH_NAPI=y
533# CONFIG_UGETH_MAGIC_PACKET is not set
534# CONFIG_UGETH_FILTERING is not set
535# CONFIG_UGETH_TX_ON_DEMOND is not set
536# CONFIG_QLA3XXX is not set
537# CONFIG_ATL1 is not set
538
539#
540# Ethernet (10000 Mbit)
541#
542# CONFIG_CHELSIO_T1 is not set
543# CONFIG_CHELSIO_T3 is not set
544# CONFIG_IXGB is not set
545# CONFIG_S2IO is not set
546# CONFIG_MYRI10GE is not set
547# CONFIG_NETXEN_NIC is not set
548
549#
550# Token Ring devices
551#
552# CONFIG_TR is not set
553
554#
555# Wireless LAN (non-hamradio)
556#
557# CONFIG_NET_RADIO is not set
558
559#
560# Wan interfaces
561#
562# CONFIG_WAN is not set
563# CONFIG_FDDI is not set
564# CONFIG_HIPPI is not set
565# CONFIG_PPP is not set
566# CONFIG_SLIP is not set
567# CONFIG_NET_FC is not set
568# CONFIG_SHAPER is not set
569# CONFIG_NETCONSOLE is not set
570# CONFIG_NETPOLL is not set
571# CONFIG_NET_POLL_CONTROLLER is not set
572
573#
574# ISDN subsystem
575#
576# CONFIG_ISDN is not set
577
578#
579# Telephony Support
580#
581# CONFIG_PHONE is not set
582
583#
584# Input device support
585#
586CONFIG_INPUT=y
587# CONFIG_INPUT_FF_MEMLESS is not set
588
589#
590# Userland interfaces
591#
592# CONFIG_INPUT_MOUSEDEV is not set
593# CONFIG_INPUT_JOYDEV is not set
594# CONFIG_INPUT_TSDEV is not set
595# CONFIG_INPUT_EVDEV is not set
596# CONFIG_INPUT_EVBUG is not set
597
598#
599# Input Device Drivers
600#
601# CONFIG_INPUT_KEYBOARD is not set
602# CONFIG_INPUT_MOUSE is not set
603# CONFIG_INPUT_JOYSTICK is not set
604# CONFIG_INPUT_TOUCHSCREEN is not set
605# CONFIG_INPUT_MISC is not set
606
607#
608# Hardware I/O ports
609#
610# CONFIG_SERIO is not set
611# CONFIG_GAMEPORT is not set
612
613#
614# Character devices
615#
616# CONFIG_VT is not set
617# CONFIG_SERIAL_NONSTANDARD is not set
618
619#
620# Serial drivers
621#
622CONFIG_SERIAL_8250=y
623CONFIG_SERIAL_8250_CONSOLE=y
624CONFIG_SERIAL_8250_PCI=y
625CONFIG_SERIAL_8250_NR_UARTS=4
626CONFIG_SERIAL_8250_RUNTIME_UARTS=4
627# CONFIG_SERIAL_8250_EXTENDED is not set
628
629#
630# Non-8250 serial port support
631#
632# CONFIG_SERIAL_UARTLITE is not set
633CONFIG_SERIAL_CORE=y
634CONFIG_SERIAL_CORE_CONSOLE=y
635# CONFIG_SERIAL_JSM is not set
636# CONFIG_SERIAL_OF_PLATFORM is not set
637CONFIG_UNIX98_PTYS=y
638CONFIG_LEGACY_PTYS=y
639CONFIG_LEGACY_PTY_COUNT=256
640
641#
642# IPMI
643#
644# CONFIG_IPMI_HANDLER is not set
645
646#
647# Watchdog Cards
648#
649CONFIG_WATCHDOG=y
650# CONFIG_WATCHDOG_NOWAYOUT is not set
651
652#
653# Watchdog Device Drivers
654#
655# CONFIG_SOFT_WATCHDOG is not set
656CONFIG_83xx_WDT=y
657
658#
659# PCI-based Watchdog Cards
660#
661# CONFIG_PCIPCWATCHDOG is not set
662# CONFIG_WDTPCI is not set
663
664#
665# USB-based Watchdog Cards
666#
667# CONFIG_USBPCWATCHDOG is not set
668CONFIG_HW_RANDOM=y
669# CONFIG_NVRAM is not set
670CONFIG_GEN_RTC=y
671# CONFIG_GEN_RTC_X is not set
672# CONFIG_DTLK is not set
673# CONFIG_R3964 is not set
674# CONFIG_APPLICOM is not set
675# CONFIG_AGP is not set
676# CONFIG_DRM is not set
677# CONFIG_RAW_DRIVER is not set
678
679#
680# TPM devices
681#
682# CONFIG_TCG_TPM is not set
683
684#
685# I2C support
686#
687CONFIG_I2C=y
688CONFIG_I2C_CHARDEV=y
689
690#
691# I2C Algorithms
692#
693# CONFIG_I2C_ALGOBIT is not set
694# CONFIG_I2C_ALGOPCF is not set
695# CONFIG_I2C_ALGOPCA is not set
696
697#
698# I2C Hardware Bus support
699#
700# CONFIG_I2C_ALI1535 is not set
701# CONFIG_I2C_ALI1563 is not set
702# CONFIG_I2C_ALI15X3 is not set
703# CONFIG_I2C_AMD756 is not set
704# CONFIG_I2C_AMD8111 is not set
705# CONFIG_I2C_I801 is not set
706# CONFIG_I2C_I810 is not set
707# CONFIG_I2C_PIIX4 is not set
708CONFIG_I2C_MPC=y
709# CONFIG_I2C_NFORCE2 is not set
710# CONFIG_I2C_OCORES is not set
711# CONFIG_I2C_PARPORT_LIGHT is not set
712# CONFIG_I2C_PASEMI is not set
713# CONFIG_I2C_PROSAVAGE is not set
714# CONFIG_I2C_SAVAGE4 is not set
715# CONFIG_I2C_SIS5595 is not set
716# CONFIG_I2C_SIS630 is not set
717# CONFIG_I2C_SIS96X is not set
718# CONFIG_I2C_STUB is not set
719# CONFIG_I2C_VIA is not set
720# CONFIG_I2C_VIAPRO is not set
721# CONFIG_I2C_VOODOO3 is not set
722# CONFIG_I2C_PCA_ISA is not set
723
724#
725# Miscellaneous I2C Chip support
726#
727# CONFIG_SENSORS_DS1337 is not set
728# CONFIG_SENSORS_DS1374 is not set
729# CONFIG_SENSORS_EEPROM is not set
730# CONFIG_SENSORS_PCF8574 is not set
731# CONFIG_SENSORS_PCA9539 is not set
732# CONFIG_SENSORS_PCF8591 is not set
733# CONFIG_SENSORS_M41T00 is not set
734# CONFIG_SENSORS_MAX6875 is not set
735# CONFIG_I2C_DEBUG_CORE is not set
736# CONFIG_I2C_DEBUG_ALGO is not set
737# CONFIG_I2C_DEBUG_BUS is not set
738# CONFIG_I2C_DEBUG_CHIP is not set
739
740#
741# SPI support
742#
743# CONFIG_SPI is not set
744# CONFIG_SPI_MASTER is not set
745
746#
747# Dallas's 1-wire bus
748#
749# CONFIG_W1 is not set
750
751#
752# Hardware Monitoring support
753#
754CONFIG_HWMON=y
755# CONFIG_HWMON_VID is not set
756# CONFIG_SENSORS_ABITUGURU is not set
757# CONFIG_SENSORS_ADM1021 is not set
758# CONFIG_SENSORS_ADM1025 is not set
759# CONFIG_SENSORS_ADM1026 is not set
760# CONFIG_SENSORS_ADM1029 is not set
761# CONFIG_SENSORS_ADM1031 is not set
762# CONFIG_SENSORS_ADM9240 is not set
763# CONFIG_SENSORS_ASB100 is not set
764# CONFIG_SENSORS_ATXP1 is not set
765# CONFIG_SENSORS_DS1621 is not set
766# CONFIG_SENSORS_F71805F is not set
767# CONFIG_SENSORS_FSCHER is not set
768# CONFIG_SENSORS_FSCPOS is not set
769# CONFIG_SENSORS_GL518SM is not set
770# CONFIG_SENSORS_GL520SM is not set
771# CONFIG_SENSORS_IT87 is not set
772# CONFIG_SENSORS_LM63 is not set
773# CONFIG_SENSORS_LM75 is not set
774# CONFIG_SENSORS_LM77 is not set
775# CONFIG_SENSORS_LM78 is not set
776# CONFIG_SENSORS_LM80 is not set
777# CONFIG_SENSORS_LM83 is not set
778# CONFIG_SENSORS_LM85 is not set
779# CONFIG_SENSORS_LM87 is not set
780# CONFIG_SENSORS_LM90 is not set
781# CONFIG_SENSORS_LM92 is not set
782# CONFIG_SENSORS_MAX1619 is not set
783# CONFIG_SENSORS_PC87360 is not set
784# CONFIG_SENSORS_PC87427 is not set
785# CONFIG_SENSORS_SIS5595 is not set
786# CONFIG_SENSORS_SMSC47M1 is not set
787# CONFIG_SENSORS_SMSC47M192 is not set
788# CONFIG_SENSORS_SMSC47B397 is not set
789# CONFIG_SENSORS_VIA686A is not set
790# CONFIG_SENSORS_VT1211 is not set
791# CONFIG_SENSORS_VT8231 is not set
792# CONFIG_SENSORS_W83781D is not set
793# CONFIG_SENSORS_W83791D is not set
794# CONFIG_SENSORS_W83792D is not set
795# CONFIG_SENSORS_W83793 is not set
796# CONFIG_SENSORS_W83L785TS is not set
797# CONFIG_SENSORS_W83627HF is not set
798# CONFIG_SENSORS_W83627EHF is not set
799# CONFIG_HWMON_DEBUG_CHIP is not set
800
801#
802# Multifunction device drivers
803#
804# CONFIG_MFD_SM501 is not set
805
806#
807# Multimedia devices
808#
809# CONFIG_VIDEO_DEV is not set
810
811#
812# Digital Video Broadcasting Devices
813#
814# CONFIG_DVB is not set
815# CONFIG_USB_DABUSB is not set
816
817#
818# Graphics support
819#
820# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
821# CONFIG_FB is not set
822# CONFIG_FB_IBM_GXT4500 is not set
823
824#
825# Sound
826#
827# CONFIG_SOUND is not set
828
829#
830# HID Devices
831#
832CONFIG_HID=y
833# CONFIG_HID_DEBUG is not set
834
835#
836# USB support
837#
838CONFIG_USB_ARCH_HAS_HCD=y
839CONFIG_USB_ARCH_HAS_OHCI=y
840CONFIG_USB_ARCH_HAS_EHCI=y
841CONFIG_USB=y
842# CONFIG_USB_DEBUG is not set
843
844#
845# Miscellaneous USB options
846#
847CONFIG_USB_DEVICEFS=y
848# CONFIG_USB_DYNAMIC_MINORS is not set
849# CONFIG_USB_OTG is not set
850
851#
852# USB Host Controller Drivers
853#
854CONFIG_USB_EHCI_HCD=y
855# CONFIG_USB_EHCI_SPLIT_ISO is not set
856# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
857# CONFIG_USB_EHCI_TT_NEWSCHED is not set
858# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
859# CONFIG_USB_ISP116X_HCD is not set
860CONFIG_USB_OHCI_HCD=y
861CONFIG_USB_OHCI_HCD_PPC_OF=y
862CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
863# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
864CONFIG_USB_OHCI_HCD_PCI=y
865CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
866CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
867CONFIG_USB_OHCI_LITTLE_ENDIAN=y
868# CONFIG_USB_UHCI_HCD is not set
869# CONFIG_USB_SL811_HCD is not set
870
871#
872# USB Device Class drivers
873#
874# CONFIG_USB_ACM is not set
875# CONFIG_USB_PRINTER is not set
876
877#
878# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
879#
880
881#
882# may also be needed; see USB_STORAGE Help for more information
883#
884CONFIG_USB_STORAGE=y
885# CONFIG_USB_STORAGE_DEBUG is not set
886# CONFIG_USB_STORAGE_DATAFAB is not set
887# CONFIG_USB_STORAGE_FREECOM is not set
888# CONFIG_USB_STORAGE_DPCM is not set
889# CONFIG_USB_STORAGE_USBAT is not set
890# CONFIG_USB_STORAGE_SDDR09 is not set
891# CONFIG_USB_STORAGE_SDDR55 is not set
892# CONFIG_USB_STORAGE_JUMPSHOT is not set
893# CONFIG_USB_STORAGE_ALAUDA is not set
894# CONFIG_USB_STORAGE_KARMA is not set
895# CONFIG_USB_LIBUSUAL is not set
896
897#
898# USB Input Devices
899#
900# CONFIG_USB_HID is not set
901
902#
903# USB HID Boot Protocol drivers
904#
905# CONFIG_USB_KBD is not set
906# CONFIG_USB_MOUSE is not set
907# CONFIG_USB_AIPTEK is not set
908# CONFIG_USB_WACOM is not set
909# CONFIG_USB_ACECAD is not set
910# CONFIG_USB_KBTAB is not set
911# CONFIG_USB_POWERMATE is not set
912# CONFIG_USB_TOUCHSCREEN is not set
913# CONFIG_USB_YEALINK is not set
914# CONFIG_USB_XPAD is not set
915# CONFIG_USB_ATI_REMOTE is not set
916# CONFIG_USB_ATI_REMOTE2 is not set
917# CONFIG_USB_KEYSPAN_REMOTE is not set
918# CONFIG_USB_APPLETOUCH is not set
919# CONFIG_USB_GTCO is not set
920
921#
922# USB Imaging devices
923#
924# CONFIG_USB_MDC800 is not set
925# CONFIG_USB_MICROTEK is not set
926
927#
928# USB Network Adapters
929#
930# CONFIG_USB_CATC is not set
931# CONFIG_USB_KAWETH is not set
932# CONFIG_USB_PEGASUS is not set
933# CONFIG_USB_RTL8150 is not set
934# CONFIG_USB_USBNET_MII is not set
935# CONFIG_USB_USBNET is not set
936CONFIG_USB_MON=y
937
938#
939# USB port drivers
940#
941
942#
943# USB Serial Converter support
944#
945# CONFIG_USB_SERIAL is not set
946
947#
948# USB Miscellaneous drivers
949#
950# CONFIG_USB_EMI62 is not set
951# CONFIG_USB_EMI26 is not set
952# CONFIG_USB_ADUTUX is not set
953# CONFIG_USB_AUERSWALD is not set
954# CONFIG_USB_RIO500 is not set
955# CONFIG_USB_LEGOTOWER is not set
956# CONFIG_USB_LCD is not set
957# CONFIG_USB_BERRY_CHARGE is not set
958# CONFIG_USB_LED is not set
959# CONFIG_USB_CYPRESS_CY7C63 is not set
960# CONFIG_USB_CYTHERM is not set
961# CONFIG_USB_PHIDGET is not set
962# CONFIG_USB_IDMOUSE is not set
963# CONFIG_USB_FTDI_ELAN is not set
964# CONFIG_USB_APPLEDISPLAY is not set
965# CONFIG_USB_SISUSBVGA is not set
966# CONFIG_USB_LD is not set
967# CONFIG_USB_TRANCEVIBRATOR is not set
968# CONFIG_USB_IOWARRIOR is not set
969# CONFIG_USB_TEST is not set
970
971#
972# USB DSL modem support
973#
974
975#
976# USB Gadget Support
977#
978# CONFIG_USB_GADGET is not set
979
980#
981# MMC/SD Card support
982#
983# CONFIG_MMC is not set
984
985#
986# LED devices
987#
988# CONFIG_NEW_LEDS is not set
989
990#
991# LED drivers
992#
993
994#
995# LED Triggers
996#
997
998#
999# InfiniBand support
1000#
1001# CONFIG_INFINIBAND is not set
1002
1003#
1004# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1005#
1006
1007#
1008# Real Time Clock
1009#
1010# CONFIG_RTC_CLASS is not set
1011
1012#
1013# DMA Engine support
1014#
1015# CONFIG_DMA_ENGINE is not set
1016
1017#
1018# DMA Clients
1019#
1020
1021#
1022# DMA Devices
1023#
1024
1025#
1026# Auxiliary Display support
1027#
1028
1029#
1030# Virtualization
1031#
1032
1033#
1034# File systems
1035#
1036CONFIG_EXT2_FS=y
1037# CONFIG_EXT2_FS_XATTR is not set
1038# CONFIG_EXT2_FS_XIP is not set
1039CONFIG_EXT3_FS=y
1040CONFIG_EXT3_FS_XATTR=y
1041# CONFIG_EXT3_FS_POSIX_ACL is not set
1042# CONFIG_EXT3_FS_SECURITY is not set
1043# CONFIG_EXT4DEV_FS is not set
1044CONFIG_JBD=y
1045# CONFIG_JBD_DEBUG is not set
1046CONFIG_FS_MBCACHE=y
1047# CONFIG_REISERFS_FS is not set
1048# CONFIG_JFS_FS is not set
1049# CONFIG_FS_POSIX_ACL is not set
1050# CONFIG_XFS_FS is not set
1051# CONFIG_GFS2_FS is not set
1052# CONFIG_OCFS2_FS is not set
1053# CONFIG_MINIX_FS is not set
1054# CONFIG_ROMFS_FS is not set
1055CONFIG_INOTIFY=y
1056CONFIG_INOTIFY_USER=y
1057# CONFIG_QUOTA is not set
1058CONFIG_DNOTIFY=y
1059# CONFIG_AUTOFS_FS is not set
1060# CONFIG_AUTOFS4_FS is not set
1061# CONFIG_FUSE_FS is not set
1062
1063#
1064# CD-ROM/DVD Filesystems
1065#
1066# CONFIG_ISO9660_FS is not set
1067# CONFIG_UDF_FS is not set
1068
1069#
1070# DOS/FAT/NT Filesystems
1071#
1072CONFIG_FAT_FS=y
1073CONFIG_MSDOS_FS=y
1074CONFIG_VFAT_FS=y
1075CONFIG_FAT_DEFAULT_CODEPAGE=437
1076CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1077# CONFIG_NTFS_FS is not set
1078
1079#
1080# Pseudo filesystems
1081#
1082CONFIG_PROC_FS=y
1083CONFIG_PROC_KCORE=y
1084CONFIG_PROC_SYSCTL=y
1085CONFIG_SYSFS=y
1086CONFIG_TMPFS=y
1087# CONFIG_TMPFS_POSIX_ACL is not set
1088# CONFIG_HUGETLB_PAGE is not set
1089CONFIG_RAMFS=y
1090# CONFIG_CONFIGFS_FS is not set
1091
1092#
1093# Miscellaneous filesystems
1094#
1095# CONFIG_ADFS_FS is not set
1096# CONFIG_AFFS_FS is not set
1097# CONFIG_HFS_FS is not set
1098# CONFIG_HFSPLUS_FS is not set
1099# CONFIG_BEFS_FS is not set
1100# CONFIG_BFS_FS is not set
1101# CONFIG_EFS_FS is not set
1102# CONFIG_CRAMFS is not set
1103# CONFIG_VXFS_FS is not set
1104# CONFIG_HPFS_FS is not set
1105# CONFIG_QNX4FS_FS is not set
1106# CONFIG_SYSV_FS is not set
1107# CONFIG_UFS_FS is not set
1108
1109#
1110# Network File Systems
1111#
1112CONFIG_NFS_FS=y
1113CONFIG_NFS_V3=y
1114# CONFIG_NFS_V3_ACL is not set
1115CONFIG_NFS_V4=y
1116# CONFIG_NFS_DIRECTIO is not set
1117# CONFIG_NFSD is not set
1118CONFIG_ROOT_NFS=y
1119CONFIG_LOCKD=y
1120CONFIG_LOCKD_V4=y
1121CONFIG_NFS_COMMON=y
1122CONFIG_SUNRPC=y
1123CONFIG_SUNRPC_GSS=y
1124CONFIG_RPCSEC_GSS_KRB5=y
1125# CONFIG_RPCSEC_GSS_SPKM3 is not set
1126# CONFIG_SMB_FS is not set
1127# CONFIG_CIFS is not set
1128# CONFIG_NCP_FS is not set
1129# CONFIG_CODA_FS is not set
1130# CONFIG_AFS_FS is not set
1131# CONFIG_9P_FS is not set
1132
1133#
1134# Partition Types
1135#
1136CONFIG_PARTITION_ADVANCED=y
1137# CONFIG_ACORN_PARTITION is not set
1138# CONFIG_OSF_PARTITION is not set
1139# CONFIG_AMIGA_PARTITION is not set
1140# CONFIG_ATARI_PARTITION is not set
1141# CONFIG_MAC_PARTITION is not set
1142CONFIG_MSDOS_PARTITION=y
1143# CONFIG_BSD_DISKLABEL is not set
1144# CONFIG_MINIX_SUBPARTITION is not set
1145# CONFIG_SOLARIS_X86_PARTITION is not set
1146# CONFIG_UNIXWARE_DISKLABEL is not set
1147CONFIG_LDM_PARTITION=y
1148# CONFIG_LDM_DEBUG is not set
1149# CONFIG_SGI_PARTITION is not set
1150# CONFIG_ULTRIX_PARTITION is not set
1151# CONFIG_SUN_PARTITION is not set
1152# CONFIG_KARMA_PARTITION is not set
1153# CONFIG_EFI_PARTITION is not set
1154
1155#
1156# Native Language Support
1157#
1158CONFIG_NLS=y
1159CONFIG_NLS_DEFAULT="iso8859-1"
1160CONFIG_NLS_CODEPAGE_437=y
1161# CONFIG_NLS_CODEPAGE_737 is not set
1162# CONFIG_NLS_CODEPAGE_775 is not set
1163# CONFIG_NLS_CODEPAGE_850 is not set
1164# CONFIG_NLS_CODEPAGE_852 is not set
1165# CONFIG_NLS_CODEPAGE_855 is not set
1166# CONFIG_NLS_CODEPAGE_857 is not set
1167# CONFIG_NLS_CODEPAGE_860 is not set
1168# CONFIG_NLS_CODEPAGE_861 is not set
1169# CONFIG_NLS_CODEPAGE_862 is not set
1170# CONFIG_NLS_CODEPAGE_863 is not set
1171# CONFIG_NLS_CODEPAGE_864 is not set
1172# CONFIG_NLS_CODEPAGE_865 is not set
1173# CONFIG_NLS_CODEPAGE_866 is not set
1174# CONFIG_NLS_CODEPAGE_869 is not set
1175# CONFIG_NLS_CODEPAGE_936 is not set
1176# CONFIG_NLS_CODEPAGE_950 is not set
1177CONFIG_NLS_CODEPAGE_932=y
1178# CONFIG_NLS_CODEPAGE_949 is not set
1179# CONFIG_NLS_CODEPAGE_874 is not set
1180CONFIG_NLS_ISO8859_8=y
1181# CONFIG_NLS_CODEPAGE_1250 is not set
1182# CONFIG_NLS_CODEPAGE_1251 is not set
1183# CONFIG_NLS_ASCII is not set
1184CONFIG_NLS_ISO8859_1=y
1185# CONFIG_NLS_ISO8859_2 is not set
1186# CONFIG_NLS_ISO8859_3 is not set
1187# CONFIG_NLS_ISO8859_4 is not set
1188# CONFIG_NLS_ISO8859_5 is not set
1189# CONFIG_NLS_ISO8859_6 is not set
1190# CONFIG_NLS_ISO8859_7 is not set
1191# CONFIG_NLS_ISO8859_9 is not set
1192# CONFIG_NLS_ISO8859_13 is not set
1193# CONFIG_NLS_ISO8859_14 is not set
1194# CONFIG_NLS_ISO8859_15 is not set
1195# CONFIG_NLS_KOI8_R is not set
1196# CONFIG_NLS_KOI8_U is not set
1197# CONFIG_NLS_UTF8 is not set
1198
1199#
1200# Distributed Lock Manager
1201#
1202# CONFIG_DLM is not set
1203
1204#
1205# QE Options
1206#
1207CONFIG_UCC_SLOW=y
1208CONFIG_UCC_FAST=y
1209CONFIG_UCC=y
1210
1211#
1212# Library routines
1213#
1214CONFIG_BITREVERSE=y
1215# CONFIG_CRC_CCITT is not set
1216# CONFIG_CRC16 is not set
1217CONFIG_CRC32=y
1218# CONFIG_LIBCRC32C is not set
1219CONFIG_PLIST=y
1220CONFIG_HAS_IOMEM=y
1221CONFIG_HAS_IOPORT=y
1222
1223#
1224# Instrumentation Support
1225#
1226# CONFIG_PROFILING is not set
1227
1228#
1229# Kernel hacking
1230#
1231# CONFIG_PRINTK_TIME is not set
1232CONFIG_ENABLE_MUST_CHECK=y
1233# CONFIG_MAGIC_SYSRQ is not set
1234# CONFIG_UNUSED_SYMBOLS is not set
1235# CONFIG_DEBUG_FS is not set
1236# CONFIG_HEADERS_CHECK is not set
1237# CONFIG_DEBUG_KERNEL is not set
1238CONFIG_LOG_BUF_SHIFT=14
1239# CONFIG_DEBUG_BUGVERBOSE is not set
1240# CONFIG_BOOTX_TEXT is not set
1241# CONFIG_SERIAL_TEXT_DEBUG is not set
1242# CONFIG_PPC_EARLY_DEBUG is not set
1243
1244#
1245# Security options
1246#
1247# CONFIG_KEYS is not set
1248# CONFIG_SECURITY is not set
1249
1250#
1251# Cryptographic options
1252#
1253CONFIG_CRYPTO=y
1254CONFIG_CRYPTO_ALGAPI=y
1255CONFIG_CRYPTO_BLKCIPHER=y
1256CONFIG_CRYPTO_MANAGER=y
1257# CONFIG_CRYPTO_HMAC is not set
1258# CONFIG_CRYPTO_XCBC is not set
1259# CONFIG_CRYPTO_NULL is not set
1260# CONFIG_CRYPTO_MD4 is not set
1261CONFIG_CRYPTO_MD5=y
1262# CONFIG_CRYPTO_SHA1 is not set
1263# CONFIG_CRYPTO_SHA256 is not set
1264# CONFIG_CRYPTO_SHA512 is not set
1265# CONFIG_CRYPTO_WP512 is not set
1266# CONFIG_CRYPTO_TGR192 is not set
1267# CONFIG_CRYPTO_GF128MUL is not set
1268CONFIG_CRYPTO_ECB=m
1269CONFIG_CRYPTO_CBC=y
1270CONFIG_CRYPTO_PCBC=m
1271# CONFIG_CRYPTO_LRW is not set
1272CONFIG_CRYPTO_DES=y
1273# CONFIG_CRYPTO_FCRYPT is not set
1274# CONFIG_CRYPTO_BLOWFISH is not set
1275# CONFIG_CRYPTO_TWOFISH is not set
1276# CONFIG_CRYPTO_SERPENT is not set
1277# CONFIG_CRYPTO_AES is not set
1278# CONFIG_CRYPTO_CAST5 is not set
1279# CONFIG_CRYPTO_CAST6 is not set
1280# CONFIG_CRYPTO_TEA is not set
1281# CONFIG_CRYPTO_ARC4 is not set
1282# CONFIG_CRYPTO_KHAZAD is not set
1283# CONFIG_CRYPTO_ANUBIS is not set
1284# CONFIG_CRYPTO_DEFLATE is not set
1285# CONFIG_CRYPTO_MICHAEL_MIC is not set
1286# CONFIG_CRYPTO_CRC32C is not set
1287# CONFIG_CRYPTO_CAMELLIA is not set
1288# CONFIG_CRYPTO_TEST is not set
1289
1290#
1291# Hardware crypto devices
1292#
diff --git a/arch/powerpc/configs/mpc8544_ds_defconfig b/arch/powerpc/configs/mpc8544_ds_defconfig
new file mode 100644
index 000000000000..b563513cc96c
--- /dev/null
+++ b/arch/powerpc/configs/mpc8544_ds_defconfig
@@ -0,0 +1,1077 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc3
4# Mon Mar 19 17:18:49 2007
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
13CONFIG_ARCH_HAS_ILOG2_U32=y
14CONFIG_GENERIC_HWEIGHT=y
15CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_FIND_NEXT_BIT=y
17CONFIG_PPC=y
18CONFIG_EARLY_PRINTK=y
19CONFIG_GENERIC_NVRAM=y
20CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
21CONFIG_ARCH_MAY_HAVE_PC_FDC=y
22CONFIG_PPC_OF=y
23CONFIG_PPC_UDBG_16550=y
24# CONFIG_GENERIC_TBSYNC is not set
25CONFIG_AUDIT_ARCH=y
26CONFIG_GENERIC_BUG=y
27CONFIG_DEFAULT_UIMAGE=y
28
29#
30# Processor support
31#
32# CONFIG_CLASSIC32 is not set
33# CONFIG_PPC_82xx is not set
34# CONFIG_PPC_83xx is not set
35CONFIG_PPC_85xx=y
36# CONFIG_PPC_86xx is not set
37# CONFIG_PPC_8xx is not set
38# CONFIG_40x is not set
39# CONFIG_44x is not set
40# CONFIG_E200 is not set
41CONFIG_85xx=y
42CONFIG_E500=y
43# CONFIG_PPC_DCR_NATIVE is not set
44# CONFIG_PPC_DCR_MMIO is not set
45CONFIG_BOOKE=y
46CONFIG_FSL_BOOKE=y
47# CONFIG_PHYS_64BIT is not set
48# CONFIG_SPE is not set
49CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
50
51#
52# Code maturity level options
53#
54CONFIG_EXPERIMENTAL=y
55CONFIG_BROKEN_ON_SMP=y
56CONFIG_INIT_ENV_ARG_LIMIT=32
57
58#
59# General setup
60#
61CONFIG_LOCALVERSION=""
62CONFIG_LOCALVERSION_AUTO=y
63CONFIG_SWAP=y
64CONFIG_SYSVIPC=y
65CONFIG_IPC_NS=y
66CONFIG_SYSVIPC_SYSCTL=y
67CONFIG_POSIX_MQUEUE=y
68CONFIG_BSD_PROCESS_ACCT=y
69# CONFIG_BSD_PROCESS_ACCT_V3 is not set
70# CONFIG_TASKSTATS is not set
71# CONFIG_UTS_NS is not set
72CONFIG_AUDIT=y
73# CONFIG_AUDITSYSCALL is not set
74CONFIG_IKCONFIG=y
75CONFIG_IKCONFIG_PROC=y
76CONFIG_SYSFS_DEPRECATED=y
77# CONFIG_RELAY is not set
78CONFIG_BLK_DEV_INITRD=y
79CONFIG_INITRAMFS_SOURCE=""
80# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
81CONFIG_SYSCTL=y
82CONFIG_EMBEDDED=y
83CONFIG_SYSCTL_SYSCALL=y
84CONFIG_KALLSYMS=y
85CONFIG_KALLSYMS_ALL=y
86# CONFIG_KALLSYMS_EXTRA_PASS is not set
87# CONFIG_HOTPLUG is not set
88CONFIG_PRINTK=y
89CONFIG_BUG=y
90CONFIG_ELF_CORE=y
91CONFIG_BASE_FULL=y
92CONFIG_FUTEX=y
93CONFIG_EPOLL=y
94CONFIG_SHMEM=y
95CONFIG_SLAB=y
96CONFIG_VM_EVENT_COUNTERS=y
97CONFIG_RT_MUTEXES=y
98# CONFIG_TINY_SHMEM is not set
99CONFIG_BASE_SMALL=0
100# CONFIG_SLOB is not set
101
102#
103# Loadable module support
104#
105CONFIG_MODULES=y
106CONFIG_MODULE_UNLOAD=y
107CONFIG_MODULE_FORCE_UNLOAD=y
108CONFIG_MODVERSIONS=y
109# CONFIG_MODULE_SRCVERSION_ALL is not set
110CONFIG_KMOD=y
111
112#
113# Block layer
114#
115CONFIG_BLOCK=y
116CONFIG_LBD=y
117# CONFIG_BLK_DEV_IO_TRACE is not set
118# CONFIG_LSF is not set
119
120#
121# IO Schedulers
122#
123CONFIG_IOSCHED_NOOP=y
124CONFIG_IOSCHED_AS=y
125CONFIG_IOSCHED_DEADLINE=y
126CONFIG_IOSCHED_CFQ=y
127# CONFIG_DEFAULT_AS is not set
128# CONFIG_DEFAULT_DEADLINE is not set
129CONFIG_DEFAULT_CFQ=y
130# CONFIG_DEFAULT_NOOP is not set
131CONFIG_DEFAULT_IOSCHED="cfq"
132# CONFIG_WANT_EARLY_SERIAL is not set
133
134#
135# Platform support
136#
137# CONFIG_MPC8540_ADS is not set
138# CONFIG_MPC8560_ADS is not set
139# CONFIG_MPC85xx_CDS is not set
140# CONFIG_MPC85xx_MDS is not set
141CONFIG_MPC8544_DS=y
142CONFIG_MPC85xx=y
143CONFIG_PPC_INDIRECT_PCI_BE=y
144CONFIG_MPIC=y
145
146#
147# Kernel options
148#
149CONFIG_HIGHMEM=y
150# CONFIG_HZ_100 is not set
151CONFIG_HZ_250=y
152# CONFIG_HZ_300 is not set
153# CONFIG_HZ_1000 is not set
154CONFIG_HZ=250
155CONFIG_PREEMPT_NONE=y
156# CONFIG_PREEMPT_VOLUNTARY is not set
157# CONFIG_PREEMPT is not set
158CONFIG_BINFMT_ELF=y
159CONFIG_BINFMT_MISC=m
160CONFIG_MATH_EMULATION=y
161CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
162CONFIG_ARCH_FLATMEM_ENABLE=y
163CONFIG_ARCH_POPULATES_NODE_MAP=y
164CONFIG_SELECT_MEMORY_MODEL=y
165CONFIG_FLATMEM_MANUAL=y
166# CONFIG_DISCONTIGMEM_MANUAL is not set
167# CONFIG_SPARSEMEM_MANUAL is not set
168CONFIG_FLATMEM=y
169CONFIG_FLAT_NODE_MEM_MAP=y
170# CONFIG_SPARSEMEM_STATIC is not set
171CONFIG_SPLIT_PTLOCK_CPUS=4
172# CONFIG_RESOURCES_64BIT is not set
173CONFIG_ZONE_DMA_FLAG=1
174CONFIG_PROC_DEVICETREE=y
175CONFIG_CMDLINE_BOOL=y
176CONFIG_CMDLINE="root=/dev/sda3 rw console=ttyS0,115200"
177# CONFIG_PM is not set
178CONFIG_SECCOMP=y
179CONFIG_ISA_DMA_API=y
180
181#
182# Bus options
183#
184CONFIG_ZONE_DMA=y
185# CONFIG_MPIC_WEIRD is not set
186# CONFIG_PPC_I8259 is not set
187CONFIG_PPC_INDIRECT_PCI=y
188CONFIG_FSL_SOC=y
189# CONFIG_PCI is not set
190# CONFIG_PCI_DOMAINS is not set
191
192#
193# PCCARD (PCMCIA/CardBus) support
194#
195
196#
197# PCI Hotplug Support
198#
199
200#
201# Advanced setup
202#
203# CONFIG_ADVANCED_OPTIONS is not set
204
205#
206# Default settings for advanced configuration options are used
207#
208CONFIG_HIGHMEM_START=0xfe000000
209CONFIG_LOWMEM_SIZE=0x30000000
210CONFIG_KERNEL_START=0xc0000000
211CONFIG_TASK_SIZE=0x80000000
212CONFIG_BOOT_LOAD=0x00800000
213
214#
215# Networking
216#
217CONFIG_NET=y
218
219#
220# Networking options
221#
222# CONFIG_NETDEBUG is not set
223CONFIG_PACKET=y
224# CONFIG_PACKET_MMAP is not set
225CONFIG_UNIX=y
226CONFIG_XFRM=y
227CONFIG_XFRM_USER=m
228# CONFIG_XFRM_SUB_POLICY is not set
229# CONFIG_XFRM_MIGRATE is not set
230CONFIG_NET_KEY=m
231# CONFIG_NET_KEY_MIGRATE is not set
232CONFIG_INET=y
233CONFIG_IP_MULTICAST=y
234CONFIG_IP_ADVANCED_ROUTER=y
235CONFIG_ASK_IP_FIB_HASH=y
236# CONFIG_IP_FIB_TRIE is not set
237CONFIG_IP_FIB_HASH=y
238CONFIG_IP_MULTIPLE_TABLES=y
239CONFIG_IP_ROUTE_MULTIPATH=y
240# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set
241CONFIG_IP_ROUTE_VERBOSE=y
242CONFIG_IP_PNP=y
243CONFIG_IP_PNP_DHCP=y
244CONFIG_IP_PNP_BOOTP=y
245CONFIG_IP_PNP_RARP=y
246CONFIG_NET_IPIP=y
247CONFIG_NET_IPGRE=y
248CONFIG_NET_IPGRE_BROADCAST=y
249CONFIG_IP_MROUTE=y
250CONFIG_IP_PIMSM_V1=y
251CONFIG_IP_PIMSM_V2=y
252CONFIG_ARPD=y
253# CONFIG_SYN_COOKIES is not set
254# CONFIG_INET_AH is not set
255# CONFIG_INET_ESP is not set
256# CONFIG_INET_IPCOMP is not set
257# CONFIG_INET_XFRM_TUNNEL is not set
258CONFIG_INET_TUNNEL=y
259# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
260# CONFIG_INET_XFRM_MODE_TUNNEL is not set
261# CONFIG_INET_XFRM_MODE_BEET is not set
262CONFIG_INET_DIAG=y
263CONFIG_INET_TCP_DIAG=y
264# CONFIG_TCP_CONG_ADVANCED is not set
265CONFIG_TCP_CONG_CUBIC=y
266CONFIG_DEFAULT_TCP_CONG="cubic"
267# CONFIG_TCP_MD5SIG is not set
268# CONFIG_IPV6 is not set
269# CONFIG_INET6_XFRM_TUNNEL is not set
270# CONFIG_INET6_TUNNEL is not set
271# CONFIG_NETWORK_SECMARK is not set
272# CONFIG_NETFILTER is not set
273
274#
275# DCCP Configuration (EXPERIMENTAL)
276#
277# CONFIG_IP_DCCP is not set
278
279#
280# SCTP Configuration (EXPERIMENTAL)
281#
282CONFIG_IP_SCTP=m
283# CONFIG_SCTP_DBG_MSG is not set
284# CONFIG_SCTP_DBG_OBJCNT is not set
285# CONFIG_SCTP_HMAC_NONE is not set
286# CONFIG_SCTP_HMAC_SHA1 is not set
287CONFIG_SCTP_HMAC_MD5=y
288
289#
290# TIPC Configuration (EXPERIMENTAL)
291#
292# CONFIG_TIPC is not set
293# CONFIG_ATM is not set
294# CONFIG_BRIDGE is not set
295# CONFIG_VLAN_8021Q is not set
296# CONFIG_DECNET is not set
297# CONFIG_LLC2 is not set
298# CONFIG_IPX is not set
299# CONFIG_ATALK is not set
300# CONFIG_X25 is not set
301# CONFIG_LAPB is not set
302# CONFIG_ECONET is not set
303# CONFIG_WAN_ROUTER is not set
304
305#
306# QoS and/or fair queueing
307#
308# CONFIG_NET_SCHED is not set
309
310#
311# Network testing
312#
313# CONFIG_NET_PKTGEN is not set
314# CONFIG_HAMRADIO is not set
315# CONFIG_IRDA is not set
316# CONFIG_BT is not set
317# CONFIG_IEEE80211 is not set
318CONFIG_FIB_RULES=y
319
320#
321# Device Drivers
322#
323
324#
325# Generic Driver Options
326#
327CONFIG_STANDALONE=y
328CONFIG_PREVENT_FIRMWARE_BUILD=y
329# CONFIG_DEBUG_DRIVER is not set
330# CONFIG_DEBUG_DEVRES is not set
331# CONFIG_SYS_HYPERVISOR is not set
332
333#
334# Connector - unified userspace <-> kernelspace linker
335#
336# CONFIG_CONNECTOR is not set
337
338#
339# Memory Technology Devices (MTD)
340#
341# CONFIG_MTD is not set
342
343#
344# Parallel port support
345#
346# CONFIG_PARPORT is not set
347
348#
349# Plug and Play support
350#
351# CONFIG_PNPACPI is not set
352
353#
354# Block devices
355#
356# CONFIG_BLK_DEV_FD is not set
357# CONFIG_BLK_DEV_COW_COMMON is not set
358CONFIG_BLK_DEV_LOOP=y
359# CONFIG_BLK_DEV_CRYPTOLOOP is not set
360CONFIG_BLK_DEV_NBD=y
361CONFIG_BLK_DEV_RAM=y
362CONFIG_BLK_DEV_RAM_COUNT=2
363CONFIG_BLK_DEV_RAM_SIZE=16384
364CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
365# CONFIG_CDROM_PKTCDVD is not set
366# CONFIG_ATA_OVER_ETH is not set
367
368#
369# Misc devices
370#
371
372#
373# ATA/ATAPI/MFM/RLL support
374#
375# CONFIG_IDE is not set
376
377#
378# SCSI device support
379#
380# CONFIG_RAID_ATTRS is not set
381CONFIG_SCSI=y
382# CONFIG_SCSI_TGT is not set
383# CONFIG_SCSI_NETLINK is not set
384CONFIG_SCSI_PROC_FS=y
385
386#
387# SCSI support type (disk, tape, CD-ROM)
388#
389CONFIG_BLK_DEV_SD=y
390CONFIG_CHR_DEV_ST=y
391# CONFIG_CHR_DEV_OSST is not set
392# CONFIG_BLK_DEV_SR is not set
393CONFIG_CHR_DEV_SG=y
394# CONFIG_CHR_DEV_SCH is not set
395
396#
397# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
398#
399CONFIG_SCSI_MULTI_LUN=y
400# CONFIG_SCSI_CONSTANTS is not set
401CONFIG_SCSI_LOGGING=y
402# CONFIG_SCSI_SCAN_ASYNC is not set
403
404#
405# SCSI Transports
406#
407# CONFIG_SCSI_SPI_ATTRS is not set
408# CONFIG_SCSI_FC_ATTRS is not set
409# CONFIG_SCSI_ISCSI_ATTRS is not set
410# CONFIG_SCSI_SAS_ATTRS is not set
411# CONFIG_SCSI_SAS_LIBSAS is not set
412
413#
414# SCSI low-level drivers
415#
416# CONFIG_ISCSI_TCP is not set
417# CONFIG_SCSI_DEBUG is not set
418
419#
420# Serial ATA (prod) and Parallel ATA (experimental) drivers
421#
422CONFIG_ATA=y
423# CONFIG_ATA_NONSTANDARD is not set
424# CONFIG_PATA_PLATFORM is not set
425
426#
427# Multi-device support (RAID and LVM)
428#
429# CONFIG_MD is not set
430
431#
432# Fusion MPT device support
433#
434# CONFIG_FUSION is not set
435
436#
437# IEEE 1394 (FireWire) support
438#
439
440#
441# I2O device support
442#
443
444#
445# Macintosh device drivers
446#
447# CONFIG_MAC_EMUMOUSEBTN is not set
448# CONFIG_WINDFARM is not set
449
450#
451# Network device support
452#
453CONFIG_NETDEVICES=y
454# CONFIG_DUMMY is not set
455# CONFIG_BONDING is not set
456# CONFIG_EQUALIZER is not set
457# CONFIG_TUN is not set
458
459#
460# PHY device support
461#
462CONFIG_PHYLIB=y
463
464#
465# MII PHY device drivers
466#
467# CONFIG_MARVELL_PHY is not set
468# CONFIG_DAVICOM_PHY is not set
469# CONFIG_QSEMI_PHY is not set
470# CONFIG_LXT_PHY is not set
471# CONFIG_CICADA_PHY is not set
472CONFIG_VITESSE_PHY=y
473# CONFIG_SMSC_PHY is not set
474# CONFIG_BROADCOM_PHY is not set
475# CONFIG_FIXED_PHY is not set
476
477#
478# Ethernet (10 or 100Mbit)
479#
480CONFIG_NET_ETHERNET=y
481CONFIG_MII=y
482
483#
484# Ethernet (1000 Mbit)
485#
486CONFIG_GIANFAR=y
487CONFIG_GFAR_NAPI=y
488
489#
490# Ethernet (10000 Mbit)
491#
492
493#
494# Token Ring devices
495#
496
497#
498# Wireless LAN (non-hamradio)
499#
500# CONFIG_NET_RADIO is not set
501
502#
503# Wan interfaces
504#
505# CONFIG_WAN is not set
506# CONFIG_PPP is not set
507# CONFIG_SLIP is not set
508# CONFIG_SHAPER is not set
509# CONFIG_NETCONSOLE is not set
510# CONFIG_NETPOLL is not set
511# CONFIG_NET_POLL_CONTROLLER is not set
512
513#
514# ISDN subsystem
515#
516# CONFIG_ISDN is not set
517
518#
519# Telephony Support
520#
521# CONFIG_PHONE is not set
522
523#
524# Input device support
525#
526CONFIG_INPUT=y
527# CONFIG_INPUT_FF_MEMLESS is not set
528
529#
530# Userland interfaces
531#
532# CONFIG_INPUT_MOUSEDEV is not set
533# CONFIG_INPUT_JOYDEV is not set
534# CONFIG_INPUT_TSDEV is not set
535# CONFIG_INPUT_EVDEV is not set
536# CONFIG_INPUT_EVBUG is not set
537
538#
539# Input Device Drivers
540#
541# CONFIG_INPUT_KEYBOARD is not set
542# CONFIG_INPUT_MOUSE is not set
543# CONFIG_INPUT_JOYSTICK is not set
544# CONFIG_INPUT_TOUCHSCREEN is not set
545# CONFIG_INPUT_MISC is not set
546
547#
548# Hardware I/O ports
549#
550CONFIG_SERIO=y
551CONFIG_SERIO_I8042=y
552CONFIG_SERIO_SERPORT=y
553CONFIG_SERIO_LIBPS2=y
554# CONFIG_SERIO_RAW is not set
555# CONFIG_GAMEPORT is not set
556
557#
558# Character devices
559#
560CONFIG_VT=y
561CONFIG_VT_CONSOLE=y
562CONFIG_HW_CONSOLE=y
563# CONFIG_VT_HW_CONSOLE_BINDING is not set
564# CONFIG_SERIAL_NONSTANDARD is not set
565
566#
567# Serial drivers
568#
569CONFIG_SERIAL_8250=y
570CONFIG_SERIAL_8250_CONSOLE=y
571CONFIG_SERIAL_8250_NR_UARTS=4
572CONFIG_SERIAL_8250_RUNTIME_UARTS=4
573# CONFIG_SERIAL_8250_EXTENDED is not set
574
575#
576# Non-8250 serial port support
577#
578# CONFIG_SERIAL_UARTLITE is not set
579CONFIG_SERIAL_CORE=y
580CONFIG_SERIAL_CORE_CONSOLE=y
581# CONFIG_SERIAL_OF_PLATFORM is not set
582CONFIG_UNIX98_PTYS=y
583CONFIG_LEGACY_PTYS=y
584CONFIG_LEGACY_PTY_COUNT=256
585
586#
587# IPMI
588#
589# CONFIG_IPMI_HANDLER is not set
590
591#
592# Watchdog Cards
593#
594# CONFIG_WATCHDOG is not set
595# CONFIG_HW_RANDOM is not set
596CONFIG_NVRAM=y
597CONFIG_GEN_RTC=y
598CONFIG_GEN_RTC_X=y
599# CONFIG_DTLK is not set
600# CONFIG_R3964 is not set
601# CONFIG_RAW_DRIVER is not set
602
603#
604# TPM devices
605#
606# CONFIG_TCG_TPM is not set
607
608#
609# I2C support
610#
611# CONFIG_I2C is not set
612
613#
614# SPI support
615#
616# CONFIG_SPI is not set
617# CONFIG_SPI_MASTER is not set
618
619#
620# Dallas's 1-wire bus
621#
622# CONFIG_W1 is not set
623
624#
625# Hardware Monitoring support
626#
627# CONFIG_HWMON is not set
628# CONFIG_HWMON_VID is not set
629
630#
631# Multifunction device drivers
632#
633# CONFIG_MFD_SM501 is not set
634
635#
636# Multimedia devices
637#
638# CONFIG_VIDEO_DEV is not set
639
640#
641# Digital Video Broadcasting Devices
642#
643CONFIG_DVB=y
644CONFIG_DVB_CORE=m
645# CONFIG_DVB_CORE_ATTACH is not set
646
647#
648# Supported DVB Frontends
649#
650
651#
652# Customise DVB Frontends
653#
654# CONFIG_DVB_FE_CUSTOMISE is not set
655
656#
657# DVB-S (satellite) frontends
658#
659
660#
661# DVB-T (terrestrial) frontends
662#
663
664#
665# DVB-C (cable) frontends
666#
667
668#
669# ATSC (North American/Korean Terrestrial/Cable DTV) frontends
670#
671
672#
673# Tuners/PLL support
674#
675
676#
677# Miscellaneous devices
678#
679
680#
681# Graphics support
682#
683# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
684# CONFIG_FB is not set
685# CONFIG_FB_IBM_GXT4500 is not set
686
687#
688# Console display driver support
689#
690# CONFIG_VGA_CONSOLE is not set
691CONFIG_DUMMY_CONSOLE=y
692
693#
694# Sound
695#
696# CONFIG_SOUND is not set
697
698#
699# HID Devices
700#
701CONFIG_HID=y
702# CONFIG_HID_DEBUG is not set
703
704#
705# USB support
706#
707# CONFIG_USB_ARCH_HAS_HCD is not set
708# CONFIG_USB_ARCH_HAS_OHCI is not set
709# CONFIG_USB_ARCH_HAS_EHCI is not set
710
711#
712# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
713#
714
715#
716# USB Gadget Support
717#
718# CONFIG_USB_GADGET is not set
719
720#
721# MMC/SD Card support
722#
723# CONFIG_MMC is not set
724
725#
726# LED devices
727#
728# CONFIG_NEW_LEDS is not set
729
730#
731# LED drivers
732#
733
734#
735# LED Triggers
736#
737
738#
739# InfiniBand support
740#
741
742#
743# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
744#
745
746#
747# Real Time Clock
748#
749CONFIG_RTC_LIB=y
750CONFIG_RTC_CLASS=y
751CONFIG_RTC_HCTOSYS=y
752CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
753# CONFIG_RTC_DEBUG is not set
754
755#
756# RTC interfaces
757#
758CONFIG_RTC_INTF_SYSFS=y
759CONFIG_RTC_INTF_PROC=y
760CONFIG_RTC_INTF_DEV=y
761# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
762
763#
764# RTC drivers
765#
766# CONFIG_RTC_DRV_DS1553 is not set
767# CONFIG_RTC_DRV_DS1742 is not set
768# CONFIG_RTC_DRV_M48T86 is not set
769# CONFIG_RTC_DRV_TEST is not set
770# CONFIG_RTC_DRV_V3020 is not set
771
772#
773# DMA Engine support
774#
775# CONFIG_DMA_ENGINE is not set
776
777#
778# DMA Clients
779#
780
781#
782# DMA Devices
783#
784
785#
786# Auxiliary Display support
787#
788
789#
790# Virtualization
791#
792
793#
794# File systems
795#
796CONFIG_EXT2_FS=y
797# CONFIG_EXT2_FS_XATTR is not set
798# CONFIG_EXT2_FS_XIP is not set
799CONFIG_EXT3_FS=y
800CONFIG_EXT3_FS_XATTR=y
801# CONFIG_EXT3_FS_POSIX_ACL is not set
802# CONFIG_EXT3_FS_SECURITY is not set
803# CONFIG_EXT4DEV_FS is not set
804CONFIG_JBD=y
805# CONFIG_JBD_DEBUG is not set
806CONFIG_FS_MBCACHE=y
807# CONFIG_REISERFS_FS is not set
808# CONFIG_JFS_FS is not set
809# CONFIG_FS_POSIX_ACL is not set
810# CONFIG_XFS_FS is not set
811# CONFIG_GFS2_FS is not set
812# CONFIG_OCFS2_FS is not set
813# CONFIG_MINIX_FS is not set
814# CONFIG_ROMFS_FS is not set
815CONFIG_INOTIFY=y
816CONFIG_INOTIFY_USER=y
817# CONFIG_QUOTA is not set
818CONFIG_DNOTIFY=y
819# CONFIG_AUTOFS_FS is not set
820# CONFIG_AUTOFS4_FS is not set
821# CONFIG_FUSE_FS is not set
822
823#
824# CD-ROM/DVD Filesystems
825#
826CONFIG_ISO9660_FS=m
827CONFIG_JOLIET=y
828CONFIG_ZISOFS=y
829CONFIG_UDF_FS=m
830CONFIG_UDF_NLS=y
831
832#
833# DOS/FAT/NT Filesystems
834#
835CONFIG_FAT_FS=y
836CONFIG_MSDOS_FS=m
837CONFIG_VFAT_FS=y
838CONFIG_FAT_DEFAULT_CODEPAGE=437
839CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
840CONFIG_NTFS_FS=y
841# CONFIG_NTFS_DEBUG is not set
842# CONFIG_NTFS_RW is not set
843
844#
845# Pseudo filesystems
846#
847CONFIG_PROC_FS=y
848CONFIG_PROC_KCORE=y
849CONFIG_PROC_SYSCTL=y
850CONFIG_SYSFS=y
851CONFIG_TMPFS=y
852# CONFIG_TMPFS_POSIX_ACL is not set
853# CONFIG_HUGETLB_PAGE is not set
854CONFIG_RAMFS=y
855# CONFIG_CONFIGFS_FS is not set
856
857#
858# Miscellaneous filesystems
859#
860CONFIG_ADFS_FS=m
861# CONFIG_ADFS_FS_RW is not set
862CONFIG_AFFS_FS=m
863CONFIG_HFS_FS=m
864CONFIG_HFSPLUS_FS=m
865CONFIG_BEFS_FS=m
866# CONFIG_BEFS_DEBUG is not set
867CONFIG_BFS_FS=m
868CONFIG_EFS_FS=m
869CONFIG_CRAMFS=y
870CONFIG_VXFS_FS=m
871CONFIG_HPFS_FS=m
872CONFIG_QNX4FS_FS=m
873CONFIG_SYSV_FS=m
874CONFIG_UFS_FS=m
875# CONFIG_UFS_FS_WRITE is not set
876# CONFIG_UFS_DEBUG is not set
877
878#
879# Network File Systems
880#
881CONFIG_NFS_FS=y
882CONFIG_NFS_V3=y
883# CONFIG_NFS_V3_ACL is not set
884CONFIG_NFS_V4=y
885# CONFIG_NFS_DIRECTIO is not set
886# CONFIG_NFSD is not set
887CONFIG_ROOT_NFS=y
888CONFIG_LOCKD=y
889CONFIG_LOCKD_V4=y
890CONFIG_NFS_COMMON=y
891CONFIG_SUNRPC=y
892CONFIG_SUNRPC_GSS=y
893CONFIG_RPCSEC_GSS_KRB5=y
894# CONFIG_RPCSEC_GSS_SPKM3 is not set
895# CONFIG_SMB_FS is not set
896# CONFIG_CIFS is not set
897# CONFIG_NCP_FS is not set
898# CONFIG_CODA_FS is not set
899# CONFIG_AFS_FS is not set
900# CONFIG_9P_FS is not set
901
902#
903# Partition Types
904#
905CONFIG_PARTITION_ADVANCED=y
906# CONFIG_ACORN_PARTITION is not set
907# CONFIG_OSF_PARTITION is not set
908# CONFIG_AMIGA_PARTITION is not set
909# CONFIG_ATARI_PARTITION is not set
910# CONFIG_MAC_PARTITION is not set
911CONFIG_MSDOS_PARTITION=y
912# CONFIG_BSD_DISKLABEL is not set
913# CONFIG_MINIX_SUBPARTITION is not set
914# CONFIG_SOLARIS_X86_PARTITION is not set
915# CONFIG_UNIXWARE_DISKLABEL is not set
916# CONFIG_LDM_PARTITION is not set
917# CONFIG_SGI_PARTITION is not set
918# CONFIG_ULTRIX_PARTITION is not set
919# CONFIG_SUN_PARTITION is not set
920# CONFIG_KARMA_PARTITION is not set
921# CONFIG_EFI_PARTITION is not set
922
923#
924# Native Language Support
925#
926CONFIG_NLS=y
927CONFIG_NLS_DEFAULT="iso8859-1"
928# CONFIG_NLS_CODEPAGE_437 is not set
929# CONFIG_NLS_CODEPAGE_737 is not set
930# CONFIG_NLS_CODEPAGE_775 is not set
931# CONFIG_NLS_CODEPAGE_850 is not set
932# CONFIG_NLS_CODEPAGE_852 is not set
933# CONFIG_NLS_CODEPAGE_855 is not set
934# CONFIG_NLS_CODEPAGE_857 is not set
935# CONFIG_NLS_CODEPAGE_860 is not set
936# CONFIG_NLS_CODEPAGE_861 is not set
937# CONFIG_NLS_CODEPAGE_862 is not set
938# CONFIG_NLS_CODEPAGE_863 is not set
939# CONFIG_NLS_CODEPAGE_864 is not set
940# CONFIG_NLS_CODEPAGE_865 is not set
941# CONFIG_NLS_CODEPAGE_866 is not set
942# CONFIG_NLS_CODEPAGE_869 is not set
943# CONFIG_NLS_CODEPAGE_936 is not set
944# CONFIG_NLS_CODEPAGE_950 is not set
945# CONFIG_NLS_CODEPAGE_932 is not set
946# CONFIG_NLS_CODEPAGE_949 is not set
947# CONFIG_NLS_CODEPAGE_874 is not set
948# CONFIG_NLS_ISO8859_8 is not set
949# CONFIG_NLS_CODEPAGE_1250 is not set
950# CONFIG_NLS_CODEPAGE_1251 is not set
951# CONFIG_NLS_ASCII is not set
952# CONFIG_NLS_ISO8859_1 is not set
953# CONFIG_NLS_ISO8859_2 is not set
954# CONFIG_NLS_ISO8859_3 is not set
955# CONFIG_NLS_ISO8859_4 is not set
956# CONFIG_NLS_ISO8859_5 is not set
957# CONFIG_NLS_ISO8859_6 is not set
958# CONFIG_NLS_ISO8859_7 is not set
959# CONFIG_NLS_ISO8859_9 is not set
960# CONFIG_NLS_ISO8859_13 is not set
961# CONFIG_NLS_ISO8859_14 is not set
962# CONFIG_NLS_ISO8859_15 is not set
963# CONFIG_NLS_KOI8_R is not set
964# CONFIG_NLS_KOI8_U is not set
965CONFIG_NLS_UTF8=m
966
967#
968# Distributed Lock Manager
969#
970# CONFIG_DLM is not set
971
972#
973# Library routines
974#
975CONFIG_BITREVERSE=y
976# CONFIG_CRC_CCITT is not set
977# CONFIG_CRC16 is not set
978CONFIG_CRC32=y
979CONFIG_LIBCRC32C=m
980CONFIG_ZLIB_INFLATE=y
981CONFIG_PLIST=y
982CONFIG_HAS_IOMEM=y
983CONFIG_HAS_IOPORT=y
984
985#
986# Instrumentation Support
987#
988# CONFIG_PROFILING is not set
989
990#
991# Kernel hacking
992#
993# CONFIG_PRINTK_TIME is not set
994CONFIG_ENABLE_MUST_CHECK=y
995# CONFIG_MAGIC_SYSRQ is not set
996# CONFIG_UNUSED_SYMBOLS is not set
997# CONFIG_DEBUG_FS is not set
998# CONFIG_HEADERS_CHECK is not set
999CONFIG_DEBUG_KERNEL=y
1000# CONFIG_DEBUG_SHIRQ is not set
1001CONFIG_LOG_BUF_SHIFT=14
1002CONFIG_DETECT_SOFTLOCKUP=y
1003# CONFIG_SCHEDSTATS is not set
1004# CONFIG_TIMER_STATS is not set
1005# CONFIG_DEBUG_SLAB is not set
1006# CONFIG_DEBUG_RT_MUTEXES is not set
1007# CONFIG_RT_MUTEX_TESTER is not set
1008# CONFIG_DEBUG_SPINLOCK is not set
1009# CONFIG_DEBUG_MUTEXES is not set
1010# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1011# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1012# CONFIG_DEBUG_KOBJECT is not set
1013# CONFIG_DEBUG_HIGHMEM is not set
1014# CONFIG_DEBUG_BUGVERBOSE is not set
1015CONFIG_DEBUG_INFO=y
1016# CONFIG_DEBUG_VM is not set
1017# CONFIG_DEBUG_LIST is not set
1018CONFIG_FORCED_INLINING=y
1019# CONFIG_RCU_TORTURE_TEST is not set
1020# CONFIG_FAULT_INJECTION is not set
1021# CONFIG_DEBUG_STACKOVERFLOW is not set
1022# CONFIG_DEBUG_STACK_USAGE is not set
1023# CONFIG_DEBUGGER is not set
1024# CONFIG_BDI_SWITCH is not set
1025# CONFIG_BOOTX_TEXT is not set
1026# CONFIG_PPC_EARLY_DEBUG is not set
1027
1028#
1029# Security options
1030#
1031# CONFIG_KEYS is not set
1032# CONFIG_SECURITY is not set
1033
1034#
1035# Cryptographic options
1036#
1037CONFIG_CRYPTO=y
1038CONFIG_CRYPTO_ALGAPI=y
1039CONFIG_CRYPTO_BLKCIPHER=y
1040CONFIG_CRYPTO_HASH=y
1041CONFIG_CRYPTO_MANAGER=y
1042CONFIG_CRYPTO_HMAC=y
1043# CONFIG_CRYPTO_XCBC is not set
1044# CONFIG_CRYPTO_NULL is not set
1045# CONFIG_CRYPTO_MD4 is not set
1046CONFIG_CRYPTO_MD5=y
1047# CONFIG_CRYPTO_SHA1 is not set
1048# CONFIG_CRYPTO_SHA256 is not set
1049# CONFIG_CRYPTO_SHA512 is not set
1050# CONFIG_CRYPTO_WP512 is not set
1051# CONFIG_CRYPTO_TGR192 is not set
1052# CONFIG_CRYPTO_GF128MUL is not set
1053# CONFIG_CRYPTO_ECB is not set
1054CONFIG_CRYPTO_CBC=y
1055CONFIG_CRYPTO_PCBC=m
1056# CONFIG_CRYPTO_LRW is not set
1057CONFIG_CRYPTO_DES=y
1058# CONFIG_CRYPTO_FCRYPT is not set
1059# CONFIG_CRYPTO_BLOWFISH is not set
1060# CONFIG_CRYPTO_TWOFISH is not set
1061# CONFIG_CRYPTO_SERPENT is not set
1062# CONFIG_CRYPTO_AES is not set
1063# CONFIG_CRYPTO_CAST5 is not set
1064# CONFIG_CRYPTO_CAST6 is not set
1065# CONFIG_CRYPTO_TEA is not set
1066# CONFIG_CRYPTO_ARC4 is not set
1067# CONFIG_CRYPTO_KHAZAD is not set
1068# CONFIG_CRYPTO_ANUBIS is not set
1069# CONFIG_CRYPTO_DEFLATE is not set
1070# CONFIG_CRYPTO_MICHAEL_MIC is not set
1071# CONFIG_CRYPTO_CRC32C is not set
1072# CONFIG_CRYPTO_CAMELLIA is not set
1073# CONFIG_CRYPTO_TEST is not set
1074
1075#
1076# Hardware crypto devices
1077#
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index a8da0aea3b87..126b9f87df25 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -152,7 +152,7 @@ CONFIG_RTAS_ERROR_LOGGING=y
152CONFIG_RTAS_PROC=y 152CONFIG_RTAS_PROC=y
153CONFIG_RTAS_FLASH=m 153CONFIG_RTAS_FLASH=m
154CONFIG_MMIO_NVRAM=y 154CONFIG_MMIO_NVRAM=y
155CONFIG_MPIC_BROKEN_U3=y 155CONFIG_MPIC_U3_HT_IRQS=y
156CONFIG_IBMVIO=y 156CONFIG_IBMVIO=y
157# CONFIG_IBMEBUS is not set 157# CONFIG_IBMEBUS is not set
158# CONFIG_PPC_MPC106 is not set 158# CONFIG_PPC_MPC106 is not set
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 8120d428ebfd..e0fa80eca366 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -25,8 +25,8 @@ obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
25obj-$(CONFIG_PPC_OF) += of_device.o of_platform.o prom_parse.o 25obj-$(CONFIG_PPC_OF) += of_device.o of_platform.o prom_parse.o
26procfs-$(CONFIG_PPC64) := proc_ppc64.o 26procfs-$(CONFIG_PPC64) := proc_ppc64.o
27obj-$(CONFIG_PROC_FS) += $(procfs-y) 27obj-$(CONFIG_PROC_FS) += $(procfs-y)
28rtaspci-$(CONFIG_PPC64) := rtas_pci.o 28rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI) := rtas_pci.o
29obj-$(CONFIG_PPC_RTAS) += rtas.o rtas-rtc.o $(rtaspci-y) 29obj-$(CONFIG_PPC_RTAS) += rtas.o rtas-rtc.o $(rtaspci-y-y)
30obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o 30obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o
31obj-$(CONFIG_RTAS_PROC) += rtas-proc.o 31obj-$(CONFIG_RTAS_PROC) += rtas-proc.o
32obj-$(CONFIG_LPARCFG) += lparcfg.o 32obj-$(CONFIG_LPARCFG) += lparcfg.o
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 4734b5de599d..5c9ff7f5c44e 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -241,7 +241,7 @@ static int emulate_dcbz(struct pt_regs *regs, unsigned char __user *addr)
241 if (user_mode(regs) && !access_ok(VERIFY_WRITE, p, size)) 241 if (user_mode(regs) && !access_ok(VERIFY_WRITE, p, size))
242 return -EFAULT; 242 return -EFAULT;
243 for (i = 0; i < size / sizeof(long); ++i) 243 for (i = 0; i < size / sizeof(long); ++i)
244 if (__put_user(0, p+i)) 244 if (__put_user_inatomic(0, p+i))
245 return -EFAULT; 245 return -EFAULT;
246 return 1; 246 return 1;
247} 247}
@@ -288,7 +288,8 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
288 } else { 288 } else {
289 unsigned long pc = regs->nip ^ (swiz & 4); 289 unsigned long pc = regs->nip ^ (swiz & 4);
290 290
291 if (__get_user(instr, (unsigned int __user *)pc)) 291 if (__get_user_inatomic(instr,
292 (unsigned int __user *)pc))
292 return -EFAULT; 293 return -EFAULT;
293 if (swiz == 0 && (flags & SW)) 294 if (swiz == 0 && (flags & SW))
294 instr = cpu_to_le32(instr); 295 instr = cpu_to_le32(instr);
@@ -324,27 +325,31 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
324 ((nb0 + 3) / 4) * sizeof(unsigned long)); 325 ((nb0 + 3) / 4) * sizeof(unsigned long));
325 326
326 for (i = 0; i < nb; ++i, ++p) 327 for (i = 0; i < nb; ++i, ++p)
327 if (__get_user(REG_BYTE(rptr, i ^ bswiz), SWIZ_PTR(p))) 328 if (__get_user_inatomic(REG_BYTE(rptr, i ^ bswiz),
329 SWIZ_PTR(p)))
328 return -EFAULT; 330 return -EFAULT;
329 if (nb0 > 0) { 331 if (nb0 > 0) {
330 rptr = &regs->gpr[0]; 332 rptr = &regs->gpr[0];
331 addr += nb; 333 addr += nb;
332 for (i = 0; i < nb0; ++i, ++p) 334 for (i = 0; i < nb0; ++i, ++p)
333 if (__get_user(REG_BYTE(rptr, i ^ bswiz), 335 if (__get_user_inatomic(REG_BYTE(rptr,
334 SWIZ_PTR(p))) 336 i ^ bswiz),
337 SWIZ_PTR(p)))
335 return -EFAULT; 338 return -EFAULT;
336 } 339 }
337 340
338 } else { 341 } else {
339 for (i = 0; i < nb; ++i, ++p) 342 for (i = 0; i < nb; ++i, ++p)
340 if (__put_user(REG_BYTE(rptr, i ^ bswiz), SWIZ_PTR(p))) 343 if (__put_user_inatomic(REG_BYTE(rptr, i ^ bswiz),
344 SWIZ_PTR(p)))
341 return -EFAULT; 345 return -EFAULT;
342 if (nb0 > 0) { 346 if (nb0 > 0) {
343 rptr = &regs->gpr[0]; 347 rptr = &regs->gpr[0];
344 addr += nb; 348 addr += nb;
345 for (i = 0; i < nb0; ++i, ++p) 349 for (i = 0; i < nb0; ++i, ++p)
346 if (__put_user(REG_BYTE(rptr, i ^ bswiz), 350 if (__put_user_inatomic(REG_BYTE(rptr,
347 SWIZ_PTR(p))) 351 i ^ bswiz),
352 SWIZ_PTR(p)))
348 return -EFAULT; 353 return -EFAULT;
349 } 354 }
350 } 355 }
@@ -398,7 +403,8 @@ int fix_alignment(struct pt_regs *regs)
398 403
399 if (cpu_has_feature(CPU_FTR_PPC_LE) && (regs->msr & MSR_LE)) 404 if (cpu_has_feature(CPU_FTR_PPC_LE) && (regs->msr & MSR_LE))
400 pc ^= 4; 405 pc ^= 4;
401 if (unlikely(__get_user(instr, (unsigned int __user *)pc))) 406 if (unlikely(__get_user_inatomic(instr,
407 (unsigned int __user *)pc)))
402 return -EFAULT; 408 return -EFAULT;
403 if (cpu_has_feature(CPU_FTR_REAL_LE) && (regs->msr & MSR_LE)) 409 if (cpu_has_feature(CPU_FTR_REAL_LE) && (regs->msr & MSR_LE))
404 instr = cpu_to_le32(instr); 410 instr = cpu_to_le32(instr);
@@ -474,16 +480,16 @@ int fix_alignment(struct pt_regs *regs)
474 p = (unsigned long) addr; 480 p = (unsigned long) addr;
475 switch (nb) { 481 switch (nb) {
476 case 8: 482 case 8:
477 ret |= __get_user(data.v[0], SWIZ_PTR(p++)); 483 ret |= __get_user_inatomic(data.v[0], SWIZ_PTR(p++));
478 ret |= __get_user(data.v[1], SWIZ_PTR(p++)); 484 ret |= __get_user_inatomic(data.v[1], SWIZ_PTR(p++));
479 ret |= __get_user(data.v[2], SWIZ_PTR(p++)); 485 ret |= __get_user_inatomic(data.v[2], SWIZ_PTR(p++));
480 ret |= __get_user(data.v[3], SWIZ_PTR(p++)); 486 ret |= __get_user_inatomic(data.v[3], SWIZ_PTR(p++));
481 case 4: 487 case 4:
482 ret |= __get_user(data.v[4], SWIZ_PTR(p++)); 488 ret |= __get_user_inatomic(data.v[4], SWIZ_PTR(p++));
483 ret |= __get_user(data.v[5], SWIZ_PTR(p++)); 489 ret |= __get_user_inatomic(data.v[5], SWIZ_PTR(p++));
484 case 2: 490 case 2:
485 ret |= __get_user(data.v[6], SWIZ_PTR(p++)); 491 ret |= __get_user_inatomic(data.v[6], SWIZ_PTR(p++));
486 ret |= __get_user(data.v[7], SWIZ_PTR(p++)); 492 ret |= __get_user_inatomic(data.v[7], SWIZ_PTR(p++));
487 if (unlikely(ret)) 493 if (unlikely(ret))
488 return -EFAULT; 494 return -EFAULT;
489 } 495 }
@@ -551,16 +557,16 @@ int fix_alignment(struct pt_regs *regs)
551 p = (unsigned long) addr; 557 p = (unsigned long) addr;
552 switch (nb) { 558 switch (nb) {
553 case 8: 559 case 8:
554 ret |= __put_user(data.v[0], SWIZ_PTR(p++)); 560 ret |= __put_user_inatomic(data.v[0], SWIZ_PTR(p++));
555 ret |= __put_user(data.v[1], SWIZ_PTR(p++)); 561 ret |= __put_user_inatomic(data.v[1], SWIZ_PTR(p++));
556 ret |= __put_user(data.v[2], SWIZ_PTR(p++)); 562 ret |= __put_user_inatomic(data.v[2], SWIZ_PTR(p++));
557 ret |= __put_user(data.v[3], SWIZ_PTR(p++)); 563 ret |= __put_user_inatomic(data.v[3], SWIZ_PTR(p++));
558 case 4: 564 case 4:
559 ret |= __put_user(data.v[4], SWIZ_PTR(p++)); 565 ret |= __put_user_inatomic(data.v[4], SWIZ_PTR(p++));
560 ret |= __put_user(data.v[5], SWIZ_PTR(p++)); 566 ret |= __put_user_inatomic(data.v[5], SWIZ_PTR(p++));
561 case 2: 567 case 2:
562 ret |= __put_user(data.v[6], SWIZ_PTR(p++)); 568 ret |= __put_user_inatomic(data.v[6], SWIZ_PTR(p++));
563 ret |= __put_user(data.v[7], SWIZ_PTR(p++)); 569 ret |= __put_user_inatomic(data.v[7], SWIZ_PTR(p++));
564 } 570 }
565 if (unlikely(ret)) 571 if (unlikely(ret))
566 return -EFAULT; 572 return -EFAULT;
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 030d300cd71c..0c5150c69175 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -77,7 +77,6 @@ int main(void)
77 DEFINE(KSP_VSID, offsetof(struct thread_struct, ksp_vsid)); 77 DEFINE(KSP_VSID, offsetof(struct thread_struct, ksp_vsid));
78#else /* CONFIG_PPC64 */ 78#else /* CONFIG_PPC64 */
79 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir)); 79 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir));
80 DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
81#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 80#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
82 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0)); 81 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0));
83 DEFINE(PT_PTRACED, PT_PTRACED); 82 DEFINE(PT_PTRACED, PT_PTRACED);
@@ -140,6 +139,7 @@ int main(void)
140 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 139 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
141 DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); 140 DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
142 DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); 141 DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
142 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
143 143
144 DEFINE(SLBSHADOW_STACKVSID, 144 DEFINE(SLBSHADOW_STACKVSID,
145 offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); 145 offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid));
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 3678997339d6..e7b684689e04 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -161,33 +161,33 @@ int btext_initialize(struct device_node *np)
161 unsigned long address = 0; 161 unsigned long address = 0;
162 const u32 *prop; 162 const u32 *prop;
163 163
164 prop = get_property(np, "linux,bootx-width", NULL); 164 prop = of_get_property(np, "linux,bootx-width", NULL);
165 if (prop == NULL) 165 if (prop == NULL)
166 prop = get_property(np, "width", NULL); 166 prop = of_get_property(np, "width", NULL);
167 if (prop == NULL) 167 if (prop == NULL)
168 return -EINVAL; 168 return -EINVAL;
169 width = *prop; 169 width = *prop;
170 prop = get_property(np, "linux,bootx-height", NULL); 170 prop = of_get_property(np, "linux,bootx-height", NULL);
171 if (prop == NULL) 171 if (prop == NULL)
172 prop = get_property(np, "height", NULL); 172 prop = of_get_property(np, "height", NULL);
173 if (prop == NULL) 173 if (prop == NULL)
174 return -EINVAL; 174 return -EINVAL;
175 height = *prop; 175 height = *prop;
176 prop = get_property(np, "linux,bootx-depth", NULL); 176 prop = of_get_property(np, "linux,bootx-depth", NULL);
177 if (prop == NULL) 177 if (prop == NULL)
178 prop = get_property(np, "depth", NULL); 178 prop = of_get_property(np, "depth", NULL);
179 if (prop == NULL) 179 if (prop == NULL)
180 return -EINVAL; 180 return -EINVAL;
181 depth = *prop; 181 depth = *prop;
182 pitch = width * ((depth + 7) / 8); 182 pitch = width * ((depth + 7) / 8);
183 prop = get_property(np, "linux,bootx-linebytes", NULL); 183 prop = of_get_property(np, "linux,bootx-linebytes", NULL);
184 if (prop == NULL) 184 if (prop == NULL)
185 prop = get_property(np, "linebytes", NULL); 185 prop = of_get_property(np, "linebytes", NULL);
186 if (prop && *prop != 0xffffffffu) 186 if (prop && *prop != 0xffffffffu)
187 pitch = *prop; 187 pitch = *prop;
188 if (pitch == 1) 188 if (pitch == 1)
189 pitch = 0x1000; 189 pitch = 0x1000;
190 prop = get_property(np, "address", NULL); 190 prop = of_get_property(np, "address", NULL);
191 if (prop) 191 if (prop)
192 address = *prop; 192 address = *prop;
193 193
@@ -219,7 +219,7 @@ int __init btext_find_display(int allow_nonstdout)
219 struct device_node *np = NULL; 219 struct device_node *np = NULL;
220 int rc = -ENODEV; 220 int rc = -ENODEV;
221 221
222 name = get_property(of_chosen, "linux,stdout-path", NULL); 222 name = of_get_property(of_chosen, "linux,stdout-path", NULL);
223 if (name != NULL) { 223 if (name != NULL) {
224 np = of_find_node_by_path(name); 224 np = of_find_node_by_path(name);
225 if (np != NULL) { 225 if (np != NULL) {
@@ -236,7 +236,7 @@ int __init btext_find_display(int allow_nonstdout)
236 return rc; 236 return rc;
237 237
238 for (np = NULL; (np = of_find_node_by_type(np, "display"));) { 238 for (np = NULL; (np = of_find_node_by_type(np, "display"));) {
239 if (get_property(np, "linux,opened", NULL)) { 239 if (of_get_property(np, "linux,opened", NULL)) {
240 printk("trying %s ...\n", np->full_name); 240 printk("trying %s ...\n", np->full_name);
241 rc = btext_initialize(np); 241 rc = btext_initialize(np);
242 printk("result: %d\n", rc); 242 printk("result: %d\n", rc);
diff --git a/arch/powerpc/kernel/cpu_setup_pa6t.S b/arch/powerpc/kernel/cpu_setup_pa6t.S
index 4047be25c4d2..d62cb9cae4e9 100644
--- a/arch/powerpc/kernel/cpu_setup_pa6t.S
+++ b/arch/powerpc/kernel/cpu_setup_pa6t.S
@@ -34,7 +34,7 @@ _GLOBAL(__setup_cpu_pa6t)
34 beqlr 34 beqlr
35 35
36 mfspr r0,SPRN_HID5 36 mfspr r0,SPRN_HID5
37 ori r0,r0,0x30 37 ori r0,r0,0x38
38 mtspr SPRN_HID5,r0 38 mtspr SPRN_HID5,r0
39 39
40 mfspr r0,SPRN_LPCR 40 mfspr r0,SPRN_LPCR
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index e4006dc087ca..9cb24d20f0f9 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -389,6 +389,8 @@ static struct cpu_spec cpu_specs[] = {
389 .pmc_type = PPC_PMC_PA6T, 389 .pmc_type = PPC_PMC_PA6T,
390 .cpu_setup = __setup_cpu_pa6t, 390 .cpu_setup = __setup_cpu_pa6t,
391 .cpu_restore = __restore_cpu_pa6t, 391 .cpu_restore = __restore_cpu_pa6t,
392 .oprofile_cpu_type = "ppc64/pa6t",
393 .oprofile_type = PPC_OPROFILE_PA6T,
392 .platform = "pa6t", 394 .platform = "pa6t",
393 }, 395 },
394 { /* default match */ 396 { /* default match */
@@ -558,6 +560,18 @@ static struct cpu_spec cpu_specs[] = {
558 .cpu_setup = __setup_cpu_750cx, 560 .cpu_setup = __setup_cpu_750cx,
559 .platform = "ppc750", 561 .platform = "ppc750",
560 }, 562 },
563 { /* 750CL */
564 .pvr_mask = 0xfffff0f0,
565 .pvr_value = 0x00087010,
566 .cpu_name = "750CL",
567 .cpu_features = CPU_FTRS_750CL,
568 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
569 .icache_bsize = 32,
570 .dcache_bsize = 32,
571 .num_pmcs = 4,
572 .cpu_setup = __setup_cpu_750,
573 .platform = "ppc750",
574 },
561 { /* 745/755 */ 575 { /* 745/755 */
562 .pvr_mask = 0xfffff000, 576 .pvr_mask = 0xfffff000,
563 .pvr_value = 0x00083000, 577 .pvr_value = 0x00083000,
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index c03e829fee3c..c29d1652a421 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -191,7 +191,6 @@ stack_ovf:
1910: 1910:
192 192
193_GLOBAL(DoSyscall) 193_GLOBAL(DoSyscall)
194 stw r0,THREAD+LAST_SYSCALL(r2)
195 stw r3,ORIG_GPR3(r1) 194 stw r3,ORIG_GPR3(r1)
196 li r12,0 195 li r12,0
197 stw r12,RESULT(r1) 196 stw r12,RESULT(r1)
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 97cedcd6c9b4..1111fcec7673 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -278,8 +278,12 @@ exception_marker:
278 beq- 1f; \ 278 beq- 1f; \
279 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \ 279 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
2801: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \ 2801: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \
281 bge- cr1,bad_stack; /* abort if it is */ \ 281 bge- cr1,2f; /* abort if it is */ \
282 std r9,_CCR(r1); /* save CR in stackframe */ \ 282 b 3f; \
2832: li r1,(n); /* will be reloaded later */ \
284 sth r1,PACA_TRAP_SAVE(r13); \
285 b bad_stack; \
2863: std r9,_CCR(r1); /* save CR in stackframe */ \
283 std r11,_NIP(r1); /* save SRR0 in stackframe */ \ 287 std r11,_NIP(r1); /* save SRR0 in stackframe */ \
284 std r12,_MSR(r1); /* save SRR1 in stackframe */ \ 288 std r12,_MSR(r1); /* save SRR1 in stackframe */ \
285 std r10,0(r1); /* make stack chain pointer */ \ 289 std r10,0(r1); /* make stack chain pointer */ \
@@ -940,6 +944,8 @@ bad_stack:
940 SAVE_2GPRS(7,r1) 944 SAVE_2GPRS(7,r1)
941 SAVE_10GPRS(12,r1) 945 SAVE_10GPRS(12,r1)
942 SAVE_10GPRS(22,r1) 946 SAVE_10GPRS(22,r1)
947 lhz r12,PACA_TRAP_SAVE(r13)
948 std r12,_TRAP(r1)
943 addi r11,r1,INT_FRAME_SIZE 949 addi r11,r1,INT_FRAME_SIZE
944 std r11,0(r1) 950 std r11,0(r1)
945 li r12,0 951 li r12,0
@@ -1555,7 +1561,6 @@ _GLOBAL(generic_secondary_smp_init)
1555 1561
1556 /* turn on 64-bit mode */ 1562 /* turn on 64-bit mode */
1557 bl .enable_64b_mode 1563 bl .enable_64b_mode
1558 isync
1559 1564
1560 /* Set up a paca value for this processor. Since we have the 1565 /* Set up a paca value for this processor. Since we have the
1561 * physical cpu id in r24, we need to search the pacas to find 1566 * physical cpu id in r24, we need to search the pacas to find
@@ -1735,10 +1740,6 @@ _STATIC(__boot_from_prom)
1735 /* We never return */ 1740 /* We never return */
1736 trap 1741 trap
1737 1742
1738/*
1739 * At this point, r3 contains the physical address we are running at,
1740 * returned by prom_init()
1741 */
1742_STATIC(__after_prom_start) 1743_STATIC(__after_prom_start)
1743 1744
1744/* 1745/*
@@ -1851,7 +1852,6 @@ __secondary_start_pmac_0:
1851_GLOBAL(pmac_secondary_start) 1852_GLOBAL(pmac_secondary_start)
1852 /* turn on 64-bit mode */ 1853 /* turn on 64-bit mode */
1853 bl .enable_64b_mode 1854 bl .enable_64b_mode
1854 isync
1855 1855
1856 /* Copy some CPU settings from CPU 0 */ 1856 /* Copy some CPU settings from CPU 0 */
1857 bl .__restore_cpu_ppc970 1857 bl .__restore_cpu_ppc970
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 82bd2f10770f..9a8c9af43b22 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -2,36 +2,37 @@
2 * IBM PowerPC IBM eBus Infrastructure Support. 2 * IBM PowerPC IBM eBus Infrastructure Support.
3 * 3 *
4 * Copyright (c) 2005 IBM Corporation 4 * Copyright (c) 2005 IBM Corporation
5 * Joachim Fenkes <fenkes@de.ibm.com>
5 * Heiko J Schick <schickhj@de.ibm.com> 6 * Heiko J Schick <schickhj@de.ibm.com>
6 * 7 *
7 * All rights reserved. 8 * All rights reserved.
8 * 9 *
9 * This source code is distributed under a dual license of GPL v2.0 and OpenIB 10 * This source code is distributed under a dual license of GPL v2.0 and OpenIB
10 * BSD. 11 * BSD.
11 * 12 *
12 * OpenIB BSD License 13 * OpenIB BSD License
13 * 14 *
14 * Redistribution and use in source and binary forms, with or without 15 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are met: 16 * modification, are permitted provided that the following conditions are met:
16 * 17 *
17 * Redistributions of source code must retain the above copyright notice, this 18 * Redistributions of source code must retain the above copyright notice, this
18 * list of conditions and the following disclaimer. 19 * list of conditions and the following disclaimer.
19 * 20 *
20 * Redistributions in binary form must reproduce the above copyright notice, 21 * Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimer in the documentation 22 * this list of conditions and the following disclaimer in the documentation
22 * and/or other materials 23 * and/or other materials
23 * provided with the distribution. 24 * provided with the distribution.
24 * 25 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
33 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
36 */ 37 */
37 38
@@ -43,19 +44,19 @@
43#include <asm/ibmebus.h> 44#include <asm/ibmebus.h>
44#include <asm/abs_addr.h> 45#include <asm/abs_addr.h>
45 46
46static struct ibmebus_dev ibmebus_bus_device = { /* fake "parent" device */ 47static struct device ibmebus_bus_device = { /* fake "parent" device */
47 .name = ibmebus_bus_device.ofdev.dev.bus_id, 48 .bus_id = "ibmebus",
48 .ofdev.dev.bus_id = "ibmebus",
49 .ofdev.dev.bus = &ibmebus_bus_type,
50}; 49};
51 50
51struct bus_type ibmebus_bus_type;
52
52static void *ibmebus_alloc_coherent(struct device *dev, 53static void *ibmebus_alloc_coherent(struct device *dev,
53 size_t size, 54 size_t size,
54 dma_addr_t *dma_handle, 55 dma_addr_t *dma_handle,
55 gfp_t flag) 56 gfp_t flag)
56{ 57{
57 void *mem; 58 void *mem;
58 59
59 mem = kmalloc(size, flag); 60 mem = kmalloc(size, flag);
60 *dma_handle = (dma_addr_t)mem; 61 *dma_handle = (dma_addr_t)mem;
61 62
@@ -63,7 +64,7 @@ static void *ibmebus_alloc_coherent(struct device *dev,
63} 64}
64 65
65static void ibmebus_free_coherent(struct device *dev, 66static void ibmebus_free_coherent(struct device *dev,
66 size_t size, void *vaddr, 67 size_t size, void *vaddr,
67 dma_addr_t dma_handle) 68 dma_addr_t dma_handle)
68{ 69{
69 kfree(vaddr); 70 kfree(vaddr);
@@ -79,7 +80,7 @@ static dma_addr_t ibmebus_map_single(struct device *dev,
79 80
80static void ibmebus_unmap_single(struct device *dev, 81static void ibmebus_unmap_single(struct device *dev,
81 dma_addr_t dma_addr, 82 dma_addr_t dma_addr,
82 size_t size, 83 size_t size,
83 enum dma_data_direction direction) 84 enum dma_data_direction direction)
84{ 85{
85 return; 86 return;
@@ -90,13 +91,13 @@ static int ibmebus_map_sg(struct device *dev,
90 int nents, enum dma_data_direction direction) 91 int nents, enum dma_data_direction direction)
91{ 92{
92 int i; 93 int i;
93 94
94 for (i = 0; i < nents; i++) { 95 for (i = 0; i < nents; i++) {
95 sg[i].dma_address = (dma_addr_t)page_address(sg[i].page) 96 sg[i].dma_address = (dma_addr_t)page_address(sg[i].page)
96 + sg[i].offset; 97 + sg[i].offset;
97 sg[i].dma_length = sg[i].length; 98 sg[i].dma_length = sg[i].length;
98 } 99 }
99 100
100 return nents; 101 return nents;
101} 102}
102 103
@@ -128,15 +129,15 @@ static int ibmebus_bus_probe(struct device *dev)
128 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver); 129 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
129 const struct of_device_id *id; 130 const struct of_device_id *id;
130 int error = -ENODEV; 131 int error = -ENODEV;
131 132
132 if (!ibmebusdrv->probe) 133 if (!ibmebusdrv->probe)
133 return error; 134 return error;
134 135
135 id = of_match_device(ibmebusdrv->id_table, &ibmebusdev->ofdev); 136 id = of_match_device(ibmebusdrv->id_table, &ibmebusdev->ofdev);
136 if (id) { 137 if (id) {
137 error = ibmebusdrv->probe(ibmebusdev, id); 138 error = ibmebusdrv->probe(ibmebusdev, id);
138 } 139 }
139 140
140 return error; 141 return error;
141} 142}
142 143
@@ -144,11 +145,11 @@ static int ibmebus_bus_remove(struct device *dev)
144{ 145{
145 struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev); 146 struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev);
146 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver); 147 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
147 148
148 if (ibmebusdrv->remove) { 149 if (ibmebusdrv->remove) {
149 return ibmebusdrv->remove(ibmebusdev); 150 return ibmebusdrv->remove(ibmebusdev);
150 } 151 }
151 152
152 return 0; 153 return 0;
153} 154}
154 155
@@ -158,21 +159,12 @@ static void __devinit ibmebus_dev_release(struct device *dev)
158 kfree(to_ibmebus_dev(dev)); 159 kfree(to_ibmebus_dev(dev));
159} 160}
160 161
161static ssize_t ibmebusdev_show_name(struct device *dev, 162static int __devinit ibmebus_register_device_common(
162 struct device_attribute *attr, char *buf)
163{
164 return sprintf(buf, "%s\n", to_ibmebus_dev(dev)->name);
165}
166static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name,
167 NULL);
168
169static struct ibmebus_dev* __devinit ibmebus_register_device_common(
170 struct ibmebus_dev *dev, const char *name) 163 struct ibmebus_dev *dev, const char *name)
171{ 164{
172 int err = 0; 165 int err = 0;
173 166
174 dev->name = name; 167 dev->ofdev.dev.parent = &ibmebus_bus_device;
175 dev->ofdev.dev.parent = &ibmebus_bus_device.ofdev.dev;
176 dev->ofdev.dev.bus = &ibmebus_bus_type; 168 dev->ofdev.dev.bus = &ibmebus_bus_type;
177 dev->ofdev.dev.release = ibmebus_dev_release; 169 dev->ofdev.dev.release = ibmebus_dev_release;
178 170
@@ -181,17 +173,15 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_common(
181 dev->ofdev.dev.archdata.numa_node = of_node_to_nid(dev->ofdev.node); 173 dev->ofdev.dev.archdata.numa_node = of_node_to_nid(dev->ofdev.node);
182 174
183 /* An ibmebusdev is based on a of_device. We have to change the 175 /* An ibmebusdev is based on a of_device. We have to change the
184 * bus type to use our own DMA mapping operations. 176 * bus type to use our own DMA mapping operations.
185 */ 177 */
186 if ((err = of_device_register(&dev->ofdev)) != 0) { 178 if ((err = of_device_register(&dev->ofdev)) != 0) {
187 printk(KERN_ERR "%s: failed to register device (%d).\n", 179 printk(KERN_ERR "%s: failed to register device (%d).\n",
188 __FUNCTION__, err); 180 __FUNCTION__, err);
189 return NULL; 181 return -ENODEV;
190 } 182 }
191 183
192 device_create_file(&dev->ofdev.dev, &dev_attr_name); 184 return 0;
193
194 return dev;
195} 185}
196 186
197static struct ibmebus_dev* __devinit ibmebus_register_device_node( 187static struct ibmebus_dev* __devinit ibmebus_register_device_node(
@@ -201,35 +191,35 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
201 const char *loc_code; 191 const char *loc_code;
202 int length; 192 int length;
203 193
204 loc_code = get_property(dn, "ibm,loc-code", NULL); 194 loc_code = of_get_property(dn, "ibm,loc-code", NULL);
205 if (!loc_code) { 195 if (!loc_code) {
206 printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n", 196 printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n",
207 __FUNCTION__, dn->name ? dn->name : "<unknown>"); 197 __FUNCTION__, dn->name ? dn->name : "<unknown>");
208 return NULL; 198 return ERR_PTR(-EINVAL);
209 } 199 }
210 200
211 if (strlen(loc_code) == 0) { 201 if (strlen(loc_code) == 0) {
212 printk(KERN_WARNING "%s: 'ibm,loc-code' is invalid\n", 202 printk(KERN_WARNING "%s: 'ibm,loc-code' is invalid\n",
213 __FUNCTION__); 203 __FUNCTION__);
214 return NULL; 204 return ERR_PTR(-EINVAL);
215 } 205 }
216 206
217 dev = kzalloc(sizeof(struct ibmebus_dev), GFP_KERNEL); 207 dev = kzalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
218 if (!dev) { 208 if (!dev) {
219 return NULL; 209 return ERR_PTR(-ENOMEM);
220 } 210 }
221 211
222 dev->ofdev.node = of_node_get(dn); 212 dev->ofdev.node = of_node_get(dn);
223 213
224 length = strlen(loc_code); 214 length = strlen(loc_code);
225 memcpy(dev->ofdev.dev.bus_id, loc_code 215 memcpy(dev->ofdev.dev.bus_id, loc_code
226 + (length - min(length, BUS_ID_SIZE - 1)), 216 + (length - min(length, BUS_ID_SIZE - 1)),
227 min(length, BUS_ID_SIZE - 1)); 217 min(length, BUS_ID_SIZE - 1));
228 218
229 /* Register with generic device framework. */ 219 /* Register with generic device framework. */
230 if (ibmebus_register_device_common(dev, dn->name) == NULL) { 220 if (ibmebus_register_device_common(dev, dn->name) != 0) {
231 kfree(dev); 221 kfree(dev);
232 return NULL; 222 return ERR_PTR(-ENODEV);
233 } 223 }
234 224
235 return dev; 225 return dev;
@@ -238,17 +228,16 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
238static void ibmebus_probe_of_nodes(char* name) 228static void ibmebus_probe_of_nodes(char* name)
239{ 229{
240 struct device_node *dn = NULL; 230 struct device_node *dn = NULL;
241 231
242 while ((dn = of_find_node_by_name(dn, name))) { 232 while ((dn = of_find_node_by_name(dn, name))) {
243 if (ibmebus_register_device_node(dn) == NULL) { 233 if (IS_ERR(ibmebus_register_device_node(dn))) {
244 of_node_put(dn); 234 of_node_put(dn);
245
246 return; 235 return;
247 } 236 }
248 } 237 }
249 238
250 of_node_put(dn); 239 of_node_put(dn);
251 240
252 return; 241 return;
253} 242}
254 243
@@ -262,17 +251,21 @@ static void ibmebus_add_devices_by_id(struct of_device_id *idt)
262 return; 251 return;
263} 252}
264 253
265static int ibmebus_match_helper(struct device *dev, void *data) 254static int ibmebus_match_name(struct device *dev, void *data)
266{ 255{
267 if (strcmp((char*)data, to_ibmebus_dev(dev)->name) == 0) 256 const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
257 const char *name;
258
259 name = of_get_property(ebus_dev->ofdev.node, "name", NULL);
260
261 if (name && (strcmp(data, name) == 0))
268 return 1; 262 return 1;
269 263
270 return 0; 264 return 0;
271} 265}
272 266
273static int ibmebus_unregister_device(struct device *dev) 267static int ibmebus_unregister_device(struct device *dev)
274{ 268{
275 device_remove_file(dev, &dev_attr_name);
276 of_device_unregister(to_of_device(dev)); 269 of_device_unregister(to_of_device(dev));
277 270
278 return 0; 271 return 0;
@@ -281,17 +274,16 @@ static int ibmebus_unregister_device(struct device *dev)
281static void ibmebus_remove_devices_by_id(struct of_device_id *idt) 274static void ibmebus_remove_devices_by_id(struct of_device_id *idt)
282{ 275{
283 struct device *dev; 276 struct device *dev;
284 277
285 while (strlen(idt->name) > 0) { 278 while (strlen(idt->name) > 0) {
286 while ((dev = bus_find_device(&ibmebus_bus_type, NULL, 279 while ((dev = bus_find_device(&ibmebus_bus_type, NULL,
287 (void*)idt->name, 280 (void*)idt->name,
288 ibmebus_match_helper))) { 281 ibmebus_match_name))) {
289 ibmebus_unregister_device(dev); 282 ibmebus_unregister_device(dev);
290 } 283 }
291 idt++; 284 idt++;
292
293 } 285 }
294 286
295 return; 287 return;
296} 288}
297 289
@@ -307,30 +299,33 @@ int ibmebus_register_driver(struct ibmebus_driver *drv)
307 if ((err = driver_register(&drv->driver) != 0)) 299 if ((err = driver_register(&drv->driver) != 0))
308 return err; 300 return err;
309 301
302 /* remove all supported devices first, in case someone
303 * probed them manually before registering the driver */
304 ibmebus_remove_devices_by_id(drv->id_table);
310 ibmebus_add_devices_by_id(drv->id_table); 305 ibmebus_add_devices_by_id(drv->id_table);
311 306
312 return 0; 307 return 0;
313} 308}
314EXPORT_SYMBOL(ibmebus_register_driver); 309EXPORT_SYMBOL(ibmebus_register_driver);
315 310
316void ibmebus_unregister_driver(struct ibmebus_driver *drv) 311void ibmebus_unregister_driver(struct ibmebus_driver *drv)
317{ 312{
318 driver_unregister(&drv->driver); 313 driver_unregister(&drv->driver);
319 ibmebus_remove_devices_by_id(drv->id_table); 314 ibmebus_remove_devices_by_id(drv->id_table);
320} 315}
321EXPORT_SYMBOL(ibmebus_unregister_driver); 316EXPORT_SYMBOL(ibmebus_unregister_driver);
322 317
323int ibmebus_request_irq(struct ibmebus_dev *dev, 318int ibmebus_request_irq(struct ibmebus_dev *dev,
324 u32 ist, 319 u32 ist,
325 irq_handler_t handler, 320 irq_handler_t handler,
326 unsigned long irq_flags, const char * devname, 321 unsigned long irq_flags, const char * devname,
327 void *dev_id) 322 void *dev_id)
328{ 323{
329 unsigned int irq = irq_create_mapping(NULL, ist); 324 unsigned int irq = irq_create_mapping(NULL, ist);
330 325
331 if (irq == NO_IRQ) 326 if (irq == NO_IRQ)
332 return -EINVAL; 327 return -EINVAL;
333 328
334 return request_irq(irq, handler, 329 return request_irq(irq, handler,
335 irq_flags, devname, dev_id); 330 irq_flags, devname, dev_id);
336} 331}
@@ -339,56 +334,163 @@ EXPORT_SYMBOL(ibmebus_request_irq);
339void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id) 334void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id)
340{ 335{
341 unsigned int irq = irq_find_mapping(NULL, ist); 336 unsigned int irq = irq_find_mapping(NULL, ist);
342 337
343 free_irq(irq, dev_id); 338 free_irq(irq, dev_id);
344} 339}
345EXPORT_SYMBOL(ibmebus_free_irq); 340EXPORT_SYMBOL(ibmebus_free_irq);
346 341
347static int ibmebus_bus_match(struct device *dev, struct device_driver *drv) 342static int ibmebus_bus_match(struct device *dev, struct device_driver *drv)
348{ 343{
349 const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev); 344 const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
350 struct ibmebus_driver *ebus_drv = to_ibmebus_driver(drv); 345 struct ibmebus_driver *ebus_drv = to_ibmebus_driver(drv);
351 const struct of_device_id *ids = ebus_drv->id_table; 346 const struct of_device_id *ids = ebus_drv->id_table;
352 const struct of_device_id *found_id; 347 const struct of_device_id *found_id;
353 348
354 if (!ids) 349 if (!ids)
355 return 0; 350 return 0;
356 351
357 found_id = of_match_device(ids, &ebus_dev->ofdev); 352 found_id = of_match_device(ids, &ebus_dev->ofdev);
358 if (found_id) 353 if (found_id)
359 return 1; 354 return 1;
360 355
361 return 0; 356 return 0;
362} 357}
363 358
359static ssize_t name_show(struct device *dev,
360 struct device_attribute *attr, char *buf)
361{
362 struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
363 const char *name = of_get_property(ebus_dev->ofdev.node, "name", NULL);
364 return sprintf(buf, "%s\n", name);
365}
366
367static struct device_attribute ibmebus_dev_attrs[] = {
368 __ATTR_RO(name),
369 __ATTR_NULL
370};
371
372static int ibmebus_match_path(struct device *dev, void *data)
373{
374 int rc;
375 struct device_node *dn =
376 of_node_get(to_ibmebus_dev(dev)->ofdev.node);
377
378 rc = (dn->full_name && (strcasecmp((char*)data, dn->full_name) == 0));
379
380 of_node_put(dn);
381 return rc;
382}
383
384static char *ibmebus_chomp(const char *in, size_t count)
385{
386 char *out = (char*)kmalloc(count + 1, GFP_KERNEL);
387 if (!out)
388 return NULL;
389
390 memcpy(out, in, count);
391 out[count] = '\0';
392 if (out[count - 1] == '\n')
393 out[count - 1] = '\0';
394
395 return out;
396}
397
398static ssize_t ibmebus_store_probe(struct bus_type *bus,
399 const char *buf, size_t count)
400{
401 struct device_node *dn = NULL;
402 struct ibmebus_dev *dev;
403 char *path;
404 ssize_t rc;
405
406 path = ibmebus_chomp(buf, count);
407 if (!path)
408 return -ENOMEM;
409
410 if (bus_find_device(&ibmebus_bus_type, NULL, path,
411 ibmebus_match_path)) {
412 printk(KERN_WARNING "%s: %s has already been probed\n",
413 __FUNCTION__, path);
414 rc = -EINVAL;
415 goto out;
416 }
417
418 if ((dn = of_find_node_by_path(path))) {
419 dev = ibmebus_register_device_node(dn);
420 of_node_put(dn);
421 rc = IS_ERR(dev) ? PTR_ERR(dev) : count;
422 } else {
423 printk(KERN_WARNING "%s: no such device node: %s\n",
424 __FUNCTION__, path);
425 rc = -ENODEV;
426 }
427
428out:
429 kfree(path);
430 return rc;
431}
432
433static ssize_t ibmebus_store_remove(struct bus_type *bus,
434 const char *buf, size_t count)
435{
436 struct device *dev;
437 char *path;
438
439 path = ibmebus_chomp(buf, count);
440 if (!path)
441 return -ENOMEM;
442
443 if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path,
444 ibmebus_match_path))) {
445 ibmebus_unregister_device(dev);
446
447 kfree(path);
448 return count;
449 } else {
450 printk(KERN_WARNING "%s: %s not on the bus\n",
451 __FUNCTION__, path);
452
453 kfree(path);
454 return -ENODEV;
455 }
456}
457
458static struct bus_attribute ibmebus_bus_attrs[] = {
459 __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe),
460 __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove),
461 __ATTR_NULL
462};
463
364struct bus_type ibmebus_bus_type = { 464struct bus_type ibmebus_bus_type = {
365 .name = "ibmebus", 465 .name = "ibmebus",
366 .match = ibmebus_bus_match, 466 .match = ibmebus_bus_match,
467 .dev_attrs = ibmebus_dev_attrs,
468 .bus_attrs = ibmebus_bus_attrs
367}; 469};
368EXPORT_SYMBOL(ibmebus_bus_type); 470EXPORT_SYMBOL(ibmebus_bus_type);
369 471
370static int __init ibmebus_bus_init(void) 472static int __init ibmebus_bus_init(void)
371{ 473{
372 int err; 474 int err;
373 475
374 printk(KERN_INFO "IBM eBus Device Driver\n"); 476 printk(KERN_INFO "IBM eBus Device Driver\n");
375 477
376 err = bus_register(&ibmebus_bus_type); 478 err = bus_register(&ibmebus_bus_type);
377 if (err) { 479 if (err) {
378 printk(KERN_ERR ":%s: failed to register IBM eBus.\n", 480 printk(KERN_ERR ":%s: failed to register IBM eBus.\n",
379 __FUNCTION__); 481 __FUNCTION__);
380 return err; 482 return err;
381 } 483 }
382 484
383 err = device_register(&ibmebus_bus_device.ofdev.dev); 485 err = device_register(&ibmebus_bus_device);
384 if (err) { 486 if (err) {
385 printk(KERN_WARNING "%s: device_register returned %i\n", 487 printk(KERN_WARNING "%s: device_register returned %i\n",
386 __FUNCTION__, err); 488 __FUNCTION__, err);
387 bus_unregister(&ibmebus_bus_type); 489 bus_unregister(&ibmebus_bus_type);
388 490
389 return err; 491 return err;
390 } 492 }
391 493
392 return 0; 494 return 0;
393} 495}
394__initcall(ibmebus_bus_init); 496__initcall(ibmebus_bus_init);
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 95edad4faf26..c08ceca6277d 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -47,6 +47,8 @@ static int novmerge = 0;
47static int novmerge = 1; 47static int novmerge = 1;
48#endif 48#endif
49 49
50static int protect4gb = 1;
51
50static inline unsigned long iommu_num_pages(unsigned long vaddr, 52static inline unsigned long iommu_num_pages(unsigned long vaddr,
51 unsigned long slen) 53 unsigned long slen)
52{ 54{
@@ -58,6 +60,16 @@ static inline unsigned long iommu_num_pages(unsigned long vaddr,
58 return npages; 60 return npages;
59} 61}
60 62
63static int __init setup_protect4gb(char *str)
64{
65 if (strcmp(str, "on") == 0)
66 protect4gb = 1;
67 else if (strcmp(str, "off") == 0)
68 protect4gb = 0;
69
70 return 1;
71}
72
61static int __init setup_iommu(char *str) 73static int __init setup_iommu(char *str)
62{ 74{
63 if (!strcmp(str, "novmerge")) 75 if (!strcmp(str, "novmerge"))
@@ -67,6 +79,7 @@ static int __init setup_iommu(char *str)
67 return 1; 79 return 1;
68} 80}
69 81
82__setup("protect4gb=", setup_protect4gb);
70__setup("iommu=", setup_iommu); 83__setup("iommu=", setup_iommu);
71 84
72static unsigned long iommu_range_alloc(struct iommu_table *tbl, 85static unsigned long iommu_range_alloc(struct iommu_table *tbl,
@@ -429,6 +442,9 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
429struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid) 442struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
430{ 443{
431 unsigned long sz; 444 unsigned long sz;
445 unsigned long start_index, end_index;
446 unsigned long entries_per_4g;
447 unsigned long index;
432 static int welcomed = 0; 448 static int welcomed = 0;
433 struct page *page; 449 struct page *page;
434 450
@@ -450,7 +466,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
450 466
451#ifdef CONFIG_CRASH_DUMP 467#ifdef CONFIG_CRASH_DUMP
452 if (ppc_md.tce_get) { 468 if (ppc_md.tce_get) {
453 unsigned long index, tceval; 469 unsigned long tceval;
454 unsigned long tcecount = 0; 470 unsigned long tcecount = 0;
455 471
456 /* 472 /*
@@ -480,6 +496,23 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
480 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size); 496 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
481#endif 497#endif
482 498
499 /*
500 * DMA cannot cross 4 GB boundary. Mark last entry of each 4
501 * GB chunk as reserved.
502 */
503 if (protect4gb) {
504 entries_per_4g = 0x100000000l >> IOMMU_PAGE_SHIFT;
505
506 /* Mark the last bit before a 4GB boundary as used */
507 start_index = tbl->it_offset | (entries_per_4g - 1);
508 start_index -= tbl->it_offset;
509
510 end_index = tbl->it_size;
511
512 for (index = start_index; index < end_index - 1; index += entries_per_4g)
513 __set_bit(index, tbl->it_map);
514 }
515
483 if (!welcomed) { 516 if (!welcomed) {
484 printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n", 517 printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n",
485 novmerge ? "disabled" : "enabled"); 518 novmerge ? "disabled" : "enabled");
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 100930826850..6c83fe229e60 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -394,7 +394,7 @@ EXPORT_SYMBOL(do_softirq);
394#ifdef CONFIG_PPC_MERGE 394#ifdef CONFIG_PPC_MERGE
395 395
396static LIST_HEAD(irq_hosts); 396static LIST_HEAD(irq_hosts);
397static spinlock_t irq_big_lock = SPIN_LOCK_UNLOCKED; 397static DEFINE_SPINLOCK(irq_big_lock);
398static DEFINE_PER_CPU(unsigned int, irq_radix_reader); 398static DEFINE_PER_CPU(unsigned int, irq_radix_reader);
399static unsigned int irq_radix_writer; 399static unsigned int irq_radix_writer;
400struct irq_map_entry irq_map[NR_IRQS]; 400struct irq_map_entry irq_map[NR_IRQS];
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index dd2886f97e98..ef647e7a9dc3 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -59,12 +59,14 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
59 } 59 }
60 60
61 if (!ret) { 61 if (!ret) {
62 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 62 memcpy(p->ainsn.insn, p->addr,
63 MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
63 p->opcode = *p->addr; 64 p->opcode = *p->addr;
64 flush_icache_range((unsigned long)p->ainsn.insn, 65 flush_icache_range((unsigned long)p->ainsn.insn,
65 (unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t)); 66 (unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t));
66 } 67 }
67 68
69 p->ainsn.boostable = 0;
68 return ret; 70 return ret;
69} 71}
70 72
@@ -232,6 +234,38 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
232 return 1; 234 return 1;
233 235
234ss_probe: 236ss_probe:
237 if (p->ainsn.boostable >= 0) {
238 unsigned int insn = *p->ainsn.insn;
239
240 /* regs->nip is also adjusted if emulate_step returns 1 */
241 ret = emulate_step(regs, insn);
242 if (ret > 0) {
243 /*
244 * Once this instruction has been boosted
245 * successfully, set the boostable flag
246 */
247 if (unlikely(p->ainsn.boostable == 0))
248 p->ainsn.boostable = 1;
249
250 if (p->post_handler)
251 p->post_handler(p, regs, 0);
252
253 kcb->kprobe_status = KPROBE_HIT_SSDONE;
254 reset_current_kprobe();
255 preempt_enable_no_resched();
256 return 1;
257 } else if (ret < 0) {
258 /*
259 * We don't allow kprobes on mtmsr(d)/rfi(d), etc.
260 * So, we should never get here... but, its still
261 * good to catch them, just in case...
262 */
263 printk("Can't step on instruction %x\n", insn);
264 BUG();
265 } else if (ret == 0)
266 /* This instruction can't be boosted */
267 p->ainsn.boostable = -1;
268 }
235 prepare_singlestep(p, regs); 269 prepare_singlestep(p, regs);
236 kcb->kprobe_status = KPROBE_HIT_SS; 270 kcb->kprobe_status = KPROBE_HIT_SS;
237 return 1; 271 return 1;
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 325f490a10cc..63dd2c3ad95e 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -44,12 +44,12 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
44 int index; 44 int index;
45 45
46 /* get clock freq. if present */ 46 /* get clock freq. if present */
47 clk = get_property(np, "clock-frequency", NULL); 47 clk = of_get_property(np, "clock-frequency", NULL);
48 if (clk && *clk) 48 if (clk && *clk)
49 clock = *clk; 49 clock = *clk;
50 50
51 /* get default speed if present */ 51 /* get default speed if present */
52 spd = get_property(np, "current-speed", NULL); 52 spd = of_get_property(np, "current-speed", NULL);
53 53
54 /* If we have a location index, then try to use it */ 54 /* If we have a location index, then try to use it */
55 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) 55 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS)
@@ -121,11 +121,11 @@ static int __init add_legacy_soc_port(struct device_node *np,
121 /* We only support ports that have a clock frequency properly 121 /* We only support ports that have a clock frequency properly
122 * encoded in the device-tree. 122 * encoded in the device-tree.
123 */ 123 */
124 if (get_property(np, "clock-frequency", NULL) == NULL) 124 if (of_get_property(np, "clock-frequency", NULL) == NULL)
125 return -1; 125 return -1;
126 126
127 /* if rtas uses this device, don't try to use it as well */ 127 /* if rtas uses this device, don't try to use it as well */
128 if (get_property(np, "used-by-rtas", NULL) != NULL) 128 if (of_get_property(np, "used-by-rtas", NULL) != NULL)
129 return -1; 129 return -1;
130 130
131 /* Get the address */ 131 /* Get the address */
@@ -157,7 +157,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
157 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); 157 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
158 158
159 /* Get the ISA port number */ 159 /* Get the ISA port number */
160 reg = get_property(np, "reg", NULL); 160 reg = of_get_property(np, "reg", NULL);
161 if (reg == NULL) 161 if (reg == NULL)
162 return -1; 162 return -1;
163 163
@@ -168,7 +168,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
168 /* Now look for an "ibm,aix-loc" property that gives us ordering 168 /* Now look for an "ibm,aix-loc" property that gives us ordering
169 * if any... 169 * if any...
170 */ 170 */
171 typep = get_property(np, "ibm,aix-loc", NULL); 171 typep = of_get_property(np, "ibm,aix-loc", NULL);
172 172
173 /* If we have a location index, then use it */ 173 /* If we have a location index, then use it */
174 if (typep && *typep == 'S') 174 if (typep && *typep == 'S')
@@ -206,7 +206,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
206 * compatible UARTs on PCI need all sort of quirks (port offsets 206 * compatible UARTs on PCI need all sort of quirks (port offsets
207 * etc...) that this code doesn't know about 207 * etc...) that this code doesn't know about
208 */ 208 */
209 if (get_property(np, "clock-frequency", NULL) == NULL) 209 if (of_get_property(np, "clock-frequency", NULL) == NULL)
210 return -1; 210 return -1;
211 211
212 /* Get the PCI address. Assume BAR 0 */ 212 /* Get the PCI address. Assume BAR 0 */
@@ -232,7 +232,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
232 * we get to their "reg" property 232 * we get to their "reg" property
233 */ 233 */
234 if (np != pci_dev) { 234 if (np != pci_dev) {
235 const u32 *reg = get_property(np, "reg", NULL); 235 const u32 *reg = of_get_property(np, "reg", NULL);
236 if (reg && (*reg < 4)) 236 if (reg && (*reg < 4))
237 index = lindex = *reg; 237 index = lindex = *reg;
238 } 238 }
@@ -296,7 +296,7 @@ void __init find_legacy_serial_ports(void)
296 DBG(" -> find_legacy_serial_port()\n"); 296 DBG(" -> find_legacy_serial_port()\n");
297 297
298 /* Now find out if one of these is out firmware console */ 298 /* Now find out if one of these is out firmware console */
299 path = get_property(of_chosen, "linux,stdout-path", NULL); 299 path = of_get_property(of_chosen, "linux,stdout-path", NULL);
300 if (path != NULL) { 300 if (path != NULL) {
301 stdout = of_find_node_by_path(path); 301 stdout = of_find_node_by_path(path);
302 if (stdout) 302 if (stdout)
@@ -529,7 +529,7 @@ static int __init check_legacy_serial_console(void)
529 } 529 }
530 /* We are getting a weird phandle from OF ... */ 530 /* We are getting a weird phandle from OF ... */
531 /* ... So use the full path instead */ 531 /* ... So use the full path instead */
532 name = get_property(of_chosen, "linux,stdout-path", NULL); 532 name = of_get_property(of_chosen, "linux,stdout-path", NULL);
533 if (name == NULL) { 533 if (name == NULL) {
534 DBG(" no linux,stdout-path !\n"); 534 DBG(" no linux,stdout-path !\n");
535 return -ENODEV; 535 return -ENODEV;
@@ -541,12 +541,12 @@ static int __init check_legacy_serial_console(void)
541 } 541 }
542 DBG("stdout is %s\n", prom_stdout->full_name); 542 DBG("stdout is %s\n", prom_stdout->full_name);
543 543
544 name = get_property(prom_stdout, "name", NULL); 544 name = of_get_property(prom_stdout, "name", NULL);
545 if (!name) { 545 if (!name) {
546 DBG(" stdout package has no name !\n"); 546 DBG(" stdout package has no name !\n");
547 goto not_found; 547 goto not_found;
548 } 548 }
549 spd = get_property(prom_stdout, "current-speed", NULL); 549 spd = of_get_property(prom_stdout, "current-speed", NULL);
550 if (spd) 550 if (spd)
551 speed = *spd; 551 speed = *spd;
552 552
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 89486b631284..c492cee90e0f 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -130,30 +130,31 @@ static int iseries_lparcfg_data(struct seq_file *m, void *v)
130/* 130/*
131 * Methods used to fetch LPAR data when running on a pSeries platform. 131 * Methods used to fetch LPAR data when running on a pSeries platform.
132 */ 132 */
133/* find a better place for this function... */
134static void log_plpar_hcall_return(unsigned long rc, char *tag) 133static void log_plpar_hcall_return(unsigned long rc, char *tag)
135{ 134{
136 if (rc == 0) /* success, return */ 135 switch(rc) {
136 case 0:
137 return; 137 return;
138/* check for null tag ? */ 138 case H_HARDWARE:
139 if (rc == H_HARDWARE) 139 printk(KERN_INFO "plpar-hcall (%s) "
140 printk(KERN_INFO 140 "Hardware fault\n", tag);
141 "plpar-hcall (%s) failed with hardware fault\n", tag); 141 return;
142 else if (rc == H_FUNCTION) 142 case H_FUNCTION:
143 printk(KERN_INFO 143 printk(KERN_INFO "plpar-hcall (%s) "
144 "plpar-hcall (%s) failed; function not allowed\n", tag); 144 "Function not allowed\n", tag);
145 else if (rc == H_AUTHORITY) 145 return;
146 printk(KERN_INFO 146 case H_AUTHORITY:
147 "plpar-hcall (%s) failed; not authorized to this" 147 printk(KERN_INFO "plpar-hcall (%s) "
148 " function\n", tag); 148 "Not authorized to this function\n", tag);
149 else if (rc == H_PARAMETER) 149 return;
150 printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n", 150 case H_PARAMETER:
151 tag); 151 printk(KERN_INFO "plpar-hcall (%s) "
152 else 152 "Bad parameter(s)\n",tag);
153 printk(KERN_INFO 153 return;
154 "plpar-hcall (%s) failed with unexpected rc(0x%lx)\n", 154 default:
155 tag, rc); 155 printk(KERN_INFO "plpar-hcall (%s) "
156 156 "Unexpected rc(0x%lx)\n", tag, rc);
157 }
157} 158}
158 159
159/* 160/*
@@ -321,15 +322,16 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
321 struct device_node *rtas_node; 322 struct device_node *rtas_node;
322 const int *lrdrp = NULL; 323 const int *lrdrp = NULL;
323 324
324 rtas_node = find_path_device("/rtas"); 325 rtas_node = of_find_node_by_path("/rtas");
325 if (rtas_node) 326 if (rtas_node)
326 lrdrp = get_property(rtas_node, "ibm,lrdr-capacity", NULL); 327 lrdrp = of_get_property(rtas_node, "ibm,lrdr-capacity", NULL);
327 328
328 if (lrdrp == NULL) { 329 if (lrdrp == NULL) {
329 partition_potential_processors = vdso_data->processorCount; 330 partition_potential_processors = vdso_data->processorCount;
330 } else { 331 } else {
331 partition_potential_processors = *(lrdrp + 4); 332 partition_potential_processors = *(lrdrp + 4);
332 } 333 }
334 of_node_put(rtas_node);
333 335
334 partition_active_processors = lparcfg_count_active_processors(); 336 partition_active_processors = lparcfg_count_active_processors();
335 337
@@ -537,25 +539,27 @@ static int lparcfg_data(struct seq_file *m, void *v)
537 539
538 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); 540 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
539 541
540 rootdn = find_path_device("/"); 542 rootdn = of_find_node_by_path("/");
541 if (rootdn) { 543 if (rootdn) {
542 tmp = get_property(rootdn, "model", NULL); 544 tmp = of_get_property(rootdn, "model", NULL);
543 if (tmp) { 545 if (tmp) {
544 model = tmp; 546 model = tmp;
545 /* Skip "IBM," - see platforms/iseries/dt.c */ 547 /* Skip "IBM," - see platforms/iseries/dt.c */
546 if (firmware_has_feature(FW_FEATURE_ISERIES)) 548 if (firmware_has_feature(FW_FEATURE_ISERIES))
547 model += 4; 549 model += 4;
548 } 550 }
549 tmp = get_property(rootdn, "system-id", NULL); 551 tmp = of_get_property(rootdn, "system-id", NULL);
550 if (tmp) { 552 if (tmp) {
551 system_id = tmp; 553 system_id = tmp;
552 /* Skip "IBM," - see platforms/iseries/dt.c */ 554 /* Skip "IBM," - see platforms/iseries/dt.c */
553 if (firmware_has_feature(FW_FEATURE_ISERIES)) 555 if (firmware_has_feature(FW_FEATURE_ISERIES))
554 system_id += 4; 556 system_id += 4;
555 } 557 }
556 lp_index_ptr = get_property(rootdn, "ibm,partition-no", NULL); 558 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
559 NULL);
557 if (lp_index_ptr) 560 if (lp_index_ptr)
558 lp_index = *lp_index_ptr; 561 lp_index = *lp_index_ptr;
562 of_node_put(rootdn);
559 } 563 }
560 seq_printf(m, "serial_number=%s\n", system_id); 564 seq_printf(m, "serial_number=%s\n", system_id);
561 seq_printf(m, "system_type=%s\n", model); 565 seq_printf(m, "system_type=%s\n", model);
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index a24b09c27718..704375bda73a 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -72,8 +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 = get_property(node, "linux,tce-base", NULL); 75 basep = of_get_property(node, "linux,tce-base", NULL);
76 sizep = get_property(node, "linux,tce-size", NULL); 76 sizep = of_get_property(node, "linux,tce-size", NULL);
77 if (basep == NULL || sizep == NULL) 77 if (basep == NULL || sizep == NULL)
78 continue; 78 continue;
79 79
@@ -294,19 +294,19 @@ static unsigned long htab_base, kernel_end;
294static struct property htab_base_prop = { 294static struct property htab_base_prop = {
295 .name = "linux,htab-base", 295 .name = "linux,htab-base",
296 .length = sizeof(unsigned long), 296 .length = sizeof(unsigned long),
297 .value = (unsigned char *)&htab_base, 297 .value = &htab_base,
298}; 298};
299 299
300static struct property htab_size_prop = { 300static struct property htab_size_prop = {
301 .name = "linux,htab-size", 301 .name = "linux,htab-size",
302 .length = sizeof(unsigned long), 302 .length = sizeof(unsigned long),
303 .value = (unsigned char *)&htab_size_bytes, 303 .value = &htab_size_bytes,
304}; 304};
305 305
306static struct property kernel_end_prop = { 306static struct property kernel_end_prop = {
307 .name = "linux,kernel-end", 307 .name = "linux,kernel-end",
308 .length = sizeof(unsigned long), 308 .length = sizeof(unsigned long),
309 .value = (unsigned char *)&kernel_end, 309 .value = &kernel_end,
310}; 310};
311 311
312static void __init export_htab_values(void) 312static void __init export_htab_values(void)
@@ -335,7 +335,7 @@ static void __init export_htab_values(void)
335static struct property crashk_base_prop = { 335static struct property crashk_base_prop = {
336 .name = "linux,crashkernel-base", 336 .name = "linux,crashkernel-base",
337 .length = sizeof(unsigned long), 337 .length = sizeof(unsigned long),
338 .value = (unsigned char *)&crashk_res.start, 338 .value = &crashk_res.start,
339}; 339};
340 340
341static unsigned long crashk_size; 341static unsigned long crashk_size;
@@ -343,7 +343,7 @@ static unsigned long crashk_size;
343static struct property crashk_size_prop = { 343static struct property crashk_size_prop = {
344 .name = "linux,crashkernel-size", 344 .name = "linux,crashkernel-size",
345 .length = sizeof(unsigned long), 345 .length = sizeof(unsigned long),
346 .value = (unsigned char *)&crashk_size, 346 .value = &crashk_size,
347}; 347};
348 348
349static void __init export_crashk_values(void) 349static void __init export_crashk_values(void)
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 412bea3cf813..98decf8ebff4 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -734,10 +734,6 @@ _GLOBAL(abs)
734 sub r3,r3,r4 734 sub r3,r3,r4
735 blr 735 blr
736 736
737_GLOBAL(_get_SP)
738 mr r3,r1 /* Close enough */
739 blr
740
741/* 737/*
742 * Create a kernel thread 738 * Create a kernel thread
743 * kernel_thread(fn, arg, flags) 739 * kernel_thread(fn, arg, flags)
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index e921514e655b..0c8ea7659d92 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -120,6 +120,117 @@ void of_device_unregister(struct of_device *ofdev)
120} 120}
121 121
122 122
123static ssize_t of_device_get_modalias(struct of_device *ofdev,
124 char *str, ssize_t len)
125{
126 const char *compat;
127 int cplen, i;
128 ssize_t tsize, csize, repend;
129
130 /* Name & Type */
131 csize = snprintf(str, len, "of:N%sT%s",
132 ofdev->node->name, ofdev->node->type);
133
134 /* Get compatible property if any */
135 compat = of_get_property(ofdev->node, "compatible", &cplen);
136 if (!compat)
137 return csize;
138
139 /* Find true end (we tolerate multiple \0 at the end */
140 for (i=(cplen-1); i>=0 && !compat[i]; i--)
141 cplen--;
142 if (!cplen)
143 return csize;
144 cplen++;
145
146 /* Check space (need cplen+1 chars including final \0) */
147 tsize = csize + cplen;
148 repend = tsize;
149
150 if (csize>=len) /* @ the limit, all is already filled */
151 return tsize;
152
153 if (tsize>=len) { /* limit compat list */
154 cplen = len-csize-1;
155 repend = len;
156 }
157
158 /* Copy and do char replacement */
159 memcpy(&str[csize+1], compat, cplen);
160 for (i=csize; i<repend; i++) {
161 char c = str[i];
162 if (c=='\0')
163 str[i] = 'C';
164 else if (c==' ')
165 str[i] = '_';
166 }
167
168 return tsize;
169}
170
171int of_device_uevent(struct device *dev,
172 char **envp, int num_envp, char *buffer, int buffer_size)
173{
174 struct of_device *ofdev;
175 const char *compat;
176 int i = 0, length = 0, seen = 0, cplen, sl;
177
178 if (!dev)
179 return -ENODEV;
180
181 ofdev = to_of_device(dev);
182
183 if (add_uevent_var(envp, num_envp, &i,
184 buffer, buffer_size, &length,
185 "OF_NAME=%s", ofdev->node->name))
186 return -ENOMEM;
187
188 if (add_uevent_var(envp, num_envp, &i,
189 buffer, buffer_size, &length,
190 "OF_TYPE=%s", ofdev->node->type))
191 return -ENOMEM;
192
193 /* Since the compatible field can contain pretty much anything
194 * it's not really legal to split it out with commas. We split it
195 * up using a number of environment variables instead. */
196
197 compat = of_get_property(ofdev->node, "compatible", &cplen);
198 while (compat && *compat && cplen > 0) {
199 if (add_uevent_var(envp, num_envp, &i,
200 buffer, buffer_size, &length,
201 "OF_COMPATIBLE_%d=%s", seen, compat))
202 return -ENOMEM;
203
204 sl = strlen (compat) + 1;
205 compat += sl;
206 cplen -= sl;
207 seen++;
208 }
209
210 if (add_uevent_var(envp, num_envp, &i,
211 buffer, buffer_size, &length,
212 "OF_COMPATIBLE_N=%d", seen))
213 return -ENOMEM;
214
215 /* modalias is trickier, we add it in 2 steps */
216 if (add_uevent_var(envp, num_envp, &i,
217 buffer, buffer_size, &length,
218 "MODALIAS="))
219 return -ENOMEM;
220
221 sl = of_device_get_modalias(ofdev, &buffer[length-1],
222 buffer_size-length);
223 if (sl >= (buffer_size-length))
224 return -ENOMEM;
225
226 length += sl;
227
228 envp[i] = NULL;
229
230 return 0;
231}
232
233
123EXPORT_SYMBOL(of_match_node); 234EXPORT_SYMBOL(of_match_node);
124EXPORT_SYMBOL(of_match_device); 235EXPORT_SYMBOL(of_match_device);
125EXPORT_SYMBOL(of_device_register); 236EXPORT_SYMBOL(of_device_register);
@@ -127,3 +238,4 @@ EXPORT_SYMBOL(of_device_unregister);
127EXPORT_SYMBOL(of_dev_get); 238EXPORT_SYMBOL(of_dev_get);
128EXPORT_SYMBOL(of_dev_put); 239EXPORT_SYMBOL(of_dev_put);
129EXPORT_SYMBOL(of_release_dev); 240EXPORT_SYMBOL(of_release_dev);
241EXPORT_SYMBOL(of_device_uevent);
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 9e7a4d249f03..908ed7926db4 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -133,6 +133,7 @@ static int of_platform_device_resume(struct device * dev)
133struct bus_type of_platform_bus_type = { 133struct bus_type of_platform_bus_type = {
134 .name = "of_platform", 134 .name = "of_platform",
135 .match = of_platform_bus_match, 135 .match = of_platform_bus_match,
136 .uevent = of_device_uevent,
136 .probe = of_platform_device_probe, 137 .probe = of_platform_device_probe,
137 .remove = of_platform_device_remove, 138 .remove = of_platform_device_remove,
138 .suspend = of_platform_device_suspend, 139 .suspend = of_platform_device_suspend,
@@ -177,7 +178,7 @@ static void of_platform_make_bus_id(struct of_device *dev)
177 * and 'D' for MMIO DCRs. 178 * and 'D' for MMIO DCRs.
178 */ 179 */
179#ifdef CONFIG_PPC_DCR 180#ifdef CONFIG_PPC_DCR
180 reg = get_property(node, "dcr-reg", NULL); 181 reg = of_get_property(node, "dcr-reg", NULL);
181 if (reg) { 182 if (reg) {
182#ifdef CONFIG_PPC_DCR_NATIVE 183#ifdef CONFIG_PPC_DCR_NATIVE
183 snprintf(name, BUS_ID_SIZE, "d%x.%s", 184 snprintf(name, BUS_ID_SIZE, "d%x.%s",
@@ -197,7 +198,7 @@ static void of_platform_make_bus_id(struct of_device *dev)
197 /* 198 /*
198 * For MMIO, get the physical address 199 * For MMIO, get the physical address
199 */ 200 */
200 reg = get_property(node, "reg", NULL); 201 reg = of_get_property(node, "reg", NULL);
201 if (reg) { 202 if (reg) {
202 addr = of_translate_address(node, reg); 203 addr = of_translate_address(node, reg);
203 if (addr != OF_BAD_ADDR) { 204 if (addr != OF_BAD_ADDR) {
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index d8ef2e100505..f022862de344 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -637,7 +637,7 @@ make_one_node_map(struct device_node* node, u8 pci_bus)
637 637
638 if (pci_bus >= pci_bus_count) 638 if (pci_bus >= pci_bus_count)
639 return; 639 return;
640 bus_range = get_property(node, "bus-range", &len); 640 bus_range = of_get_property(node, "bus-range", &len);
641 if (bus_range == NULL || len < 2 * sizeof(int)) { 641 if (bus_range == NULL || len < 2 * sizeof(int)) {
642 printk(KERN_WARNING "Can't get bus-range for %s, " 642 printk(KERN_WARNING "Can't get bus-range for %s, "
643 "assuming it starts at 0\n", node->full_name); 643 "assuming it starts at 0\n", node->full_name);
@@ -649,17 +649,20 @@ make_one_node_map(struct device_node* node, u8 pci_bus)
649 struct pci_dev* dev; 649 struct pci_dev* dev;
650 const unsigned int *class_code, *reg; 650 const unsigned int *class_code, *reg;
651 651
652 class_code = get_property(node, "class-code", NULL); 652 class_code = of_get_property(node, "class-code", NULL);
653 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 653 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
654 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 654 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
655 continue; 655 continue;
656 reg = get_property(node, "reg", NULL); 656 reg = of_get_property(node, "reg", NULL);
657 if (!reg) 657 if (!reg)
658 continue; 658 continue;
659 dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); 659 dev = pci_get_bus_and_slot(pci_bus, ((reg[0] >> 8) & 0xff));
660 if (!dev || !dev->subordinate) 660 if (!dev || !dev->subordinate) {
661 pci_dev_put(dev);
661 continue; 662 continue;
663 }
662 make_one_node_map(node, dev->subordinate->number); 664 make_one_node_map(node, dev->subordinate->number);
665 pci_dev_put(dev);
663 } 666 }
664} 667}
665 668
@@ -669,6 +672,7 @@ pcibios_make_OF_bus_map(void)
669 int i; 672 int i;
670 struct pci_controller* hose; 673 struct pci_controller* hose;
671 struct property *map_prop; 674 struct property *map_prop;
675 struct device_node *dn;
672 676
673 pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL); 677 pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL);
674 if (!pci_to_OF_bus_map) { 678 if (!pci_to_OF_bus_map) {
@@ -690,12 +694,13 @@ pcibios_make_OF_bus_map(void)
690 continue; 694 continue;
691 make_one_node_map(node, hose->first_busno); 695 make_one_node_map(node, hose->first_busno);
692 } 696 }
693 map_prop = of_find_property(find_path_device("/"), 697 dn = of_find_node_by_path("/");
694 "pci-OF-bus-map", NULL); 698 map_prop = of_find_property(dn, "pci-OF-bus-map", NULL);
695 if (map_prop) { 699 if (map_prop) {
696 BUG_ON(pci_bus_count > map_prop->length); 700 BUG_ON(pci_bus_count > map_prop->length);
697 memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count); 701 memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count);
698 } 702 }
703 of_node_put(dn);
699#ifdef DEBUG 704#ifdef DEBUG
700 printk("PCI->OF bus map:\n"); 705 printk("PCI->OF bus map:\n");
701 for (i=0; i<pci_bus_count; i++) { 706 for (i=0; i<pci_bus_count; i++) {
@@ -724,7 +729,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void*
724 * a fake root for all functions of a multi-function device, 729 * a fake root for all functions of a multi-function device,
725 * we go down them as well. 730 * we go down them as well.
726 */ 731 */
727 class_code = get_property(node, "class-code", NULL); 732 class_code = of_get_property(node, "class-code", NULL);
728 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 733 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
729 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && 734 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) &&
730 strcmp(node->name, "multifunc-device")) 735 strcmp(node->name, "multifunc-device"))
@@ -744,7 +749,7 @@ static struct device_node *scan_OF_for_pci_dev(struct device_node *parent,
744 unsigned int psize; 749 unsigned int psize;
745 750
746 while ((np = of_get_next_child(parent, np)) != NULL) { 751 while ((np = of_get_next_child(parent, np)) != NULL) {
747 reg = get_property(np, "reg", &psize); 752 reg = of_get_property(np, "reg", &psize);
748 if (reg == NULL || psize < 4) 753 if (reg == NULL || psize < 4)
749 continue; 754 continue;
750 if (((reg[0] >> 8) & 0xff) == devfn) 755 if (((reg[0] >> 8) & 0xff) == devfn)
@@ -859,7 +864,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
859 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, 864 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
860 find_OF_pci_device_filter, (void *)node)) 865 find_OF_pci_device_filter, (void *)node))
861 return -ENODEV; 866 return -ENODEV;
862 reg = get_property(node, "reg", NULL); 867 reg = of_get_property(node, "reg", NULL);
863 if (!reg) 868 if (!reg)
864 return -ENODEV; 869 return -ENODEV;
865 *bus = (reg[0] >> 16) & 0xff; 870 *bus = (reg[0] >> 16) & 0xff;
@@ -895,14 +900,14 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
895 int rlen = 0, orig_rlen; 900 int rlen = 0, orig_rlen;
896 int memno = 0; 901 int memno = 0;
897 struct resource *res; 902 struct resource *res;
898 int np, na = prom_n_addr_cells(dev); 903 int np, na = of_n_addr_cells(dev);
899 np = na + 5; 904 np = na + 5;
900 905
901 /* First we try to merge ranges to fix a problem with some pmacs 906 /* First we try to merge ranges to fix a problem with some pmacs
902 * that can have more than 3 ranges, fortunately using contiguous 907 * that can have more than 3 ranges, fortunately using contiguous
903 * addresses -- BenH 908 * addresses -- BenH
904 */ 909 */
905 dt_ranges = get_property(dev, "ranges", &rlen); 910 dt_ranges = of_get_property(dev, "ranges", &rlen);
906 if (!dt_ranges) 911 if (!dt_ranges)
907 return; 912 return;
908 /* Sanity check, though hopefully that never happens */ 913 /* Sanity check, though hopefully that never happens */
@@ -1006,14 +1011,19 @@ void __init
1006pci_create_OF_bus_map(void) 1011pci_create_OF_bus_map(void)
1007{ 1012{
1008 struct property* of_prop; 1013 struct property* of_prop;
1009 1014 struct device_node *dn;
1015
1010 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256); 1016 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256);
1011 if (of_prop && find_path_device("/")) { 1017 if (!of_prop)
1018 return;
1019 dn = of_find_node_by_path("/");
1020 if (dn) {
1012 memset(of_prop, -1, sizeof(struct property) + 256); 1021 memset(of_prop, -1, sizeof(struct property) + 256);
1013 of_prop->name = "pci-OF-bus-map"; 1022 of_prop->name = "pci-OF-bus-map";
1014 of_prop->length = 256; 1023 of_prop->length = 256;
1015 of_prop->value = (unsigned char *)&of_prop[1]; 1024 of_prop->value = &of_prop[1];
1016 prom_add_property(find_path_device("/"), of_prop); 1025 prom_add_property(dn, of_prop);
1026 of_node_put(dn);
1017 } 1027 }
1018} 1028}
1019 1029
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 7e97d71a5f8f..60d7d4baa227 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -61,8 +61,7 @@ void iSeries_pcibios_init(void);
61 61
62LIST_HEAD(hose_list); 62LIST_HEAD(hose_list);
63 63
64struct dma_mapping_ops *pci_dma_ops; 64static struct dma_mapping_ops *pci_dma_ops;
65EXPORT_SYMBOL(pci_dma_ops);
66 65
67int global_phb_number; /* Global phb counter */ 66int global_phb_number; /* Global phb counter */
68 67
@@ -70,6 +69,17 @@ int global_phb_number; /* Global phb counter */
70struct pci_dev *ppc64_isabridge_dev = NULL; 69struct pci_dev *ppc64_isabridge_dev = NULL;
71EXPORT_SYMBOL_GPL(ppc64_isabridge_dev); 70EXPORT_SYMBOL_GPL(ppc64_isabridge_dev);
72 71
72void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
73{
74 pci_dma_ops = dma_ops;
75}
76
77struct dma_mapping_ops *get_pci_dma_ops(void)
78{
79 return pci_dma_ops;
80}
81EXPORT_SYMBOL(get_pci_dma_ops);
82
73static void fixup_broken_pcnet32(struct pci_dev* dev) 83static void fixup_broken_pcnet32(struct pci_dev* dev)
74{ 84{
75 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) { 85 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
@@ -258,7 +268,7 @@ static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
258 const u32 *prop; 268 const u32 *prop;
259 int len; 269 int len;
260 270
261 prop = get_property(np, name, &len); 271 prop = of_get_property(np, name, &len);
262 if (prop && len >= 4) 272 if (prop && len >= 4)
263 return *prop; 273 return *prop;
264 return def; 274 return def;
@@ -291,7 +301,7 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
291 u32 i; 301 u32 i;
292 int proplen; 302 int proplen;
293 303
294 addrs = get_property(node, "assigned-addresses", &proplen); 304 addrs = of_get_property(node, "assigned-addresses", &proplen);
295 if (!addrs) 305 if (!addrs)
296 return; 306 return;
297 DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); 307 DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs);
@@ -333,7 +343,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
333 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 343 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
334 if (!dev) 344 if (!dev)
335 return NULL; 345 return NULL;
336 type = get_property(node, "device_type", NULL); 346 type = of_get_property(node, "device_type", NULL);
337 if (type == NULL) 347 if (type == NULL)
338 type = ""; 348 type = "";
339 349
@@ -397,7 +407,7 @@ void __devinit of_scan_bus(struct device_node *node,
397 407
398 while ((child = of_get_next_child(node, child)) != NULL) { 408 while ((child = of_get_next_child(node, child)) != NULL) {
399 DBG(" * %s\n", child->full_name); 409 DBG(" * %s\n", child->full_name);
400 reg = get_property(child, "reg", &reglen); 410 reg = of_get_property(child, "reg", &reglen);
401 if (reg == NULL || reglen < 20) 411 if (reg == NULL || reglen < 20)
402 continue; 412 continue;
403 devfn = (reg[0] >> 8) & 0xff; 413 devfn = (reg[0] >> 8) & 0xff;
@@ -430,13 +440,13 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
430 DBG("of_scan_pci_bridge(%s)\n", node->full_name); 440 DBG("of_scan_pci_bridge(%s)\n", node->full_name);
431 441
432 /* parse bus-range property */ 442 /* parse bus-range property */
433 busrange = get_property(node, "bus-range", &len); 443 busrange = of_get_property(node, "bus-range", &len);
434 if (busrange == NULL || len != 8) { 444 if (busrange == NULL || len != 8) {
435 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", 445 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n",
436 node->full_name); 446 node->full_name);
437 return; 447 return;
438 } 448 }
439 ranges = get_property(node, "ranges", &len); 449 ranges = of_get_property(node, "ranges", &len);
440 if (ranges == NULL) { 450 if (ranges == NULL) {
441 printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n", 451 printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n",
442 node->full_name); 452 node->full_name);
@@ -900,7 +910,7 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
900 unsigned int size; 910 unsigned int size;
901 int rlen = 0; 911 int rlen = 0;
902 912
903 range = get_property(isa_node, "ranges", &rlen); 913 range = of_get_property(isa_node, "ranges", &rlen);
904 if (range == NULL || (rlen < sizeof(struct isa_range))) { 914 if (range == NULL || (rlen < sizeof(struct isa_range))) {
905 printk(KERN_ERR "no ISA ranges or unexpected isa range size," 915 printk(KERN_ERR "no ISA ranges or unexpected isa range size,"
906 "mapping 64k\n"); 916 "mapping 64k\n");
@@ -947,7 +957,7 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
947 int rlen = 0; 957 int rlen = 0;
948 int memno = 0; 958 int memno = 0;
949 struct resource *res; 959 struct resource *res;
950 int np, na = prom_n_addr_cells(dev); 960 int np, na = of_n_addr_cells(dev);
951 unsigned long pci_addr, cpu_phys_addr; 961 unsigned long pci_addr, cpu_phys_addr;
952 962
953 np = na + 5; 963 np = na + 5;
@@ -960,7 +970,7 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
960 * (size depending on dev->n_addr_cells) 970 * (size depending on dev->n_addr_cells)
961 * cells 4+5 or 5+6: the size of the range 971 * cells 4+5 or 5+6: the size of the range
962 */ 972 */
963 ranges = get_property(dev, "ranges", &rlen); 973 ranges = of_get_property(dev, "ranges", &rlen);
964 if (ranges == NULL) 974 if (ranges == NULL)
965 return; 975 return;
966 hose->io_base_phys = 0; 976 hose->io_base_phys = 0;
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 68df018dae0e..d7d36df9c053 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -40,7 +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 const int *type = get_property(dn, "ibm,pci-config-space-type", NULL); 43 const int *type =
44 of_get_property(dn, "ibm,pci-config-space-type", NULL);
44 const u32 *regs; 45 const u32 *regs;
45 struct pci_dn *pdn; 46 struct pci_dn *pdn;
46 47
@@ -54,14 +55,14 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
54 dn->data = pdn; 55 dn->data = pdn;
55 pdn->node = dn; 56 pdn->node = dn;
56 pdn->phb = phb; 57 pdn->phb = phb;
57 regs = get_property(dn, "reg", NULL); 58 regs = of_get_property(dn, "reg", NULL);
58 if (regs) { 59 if (regs) {
59 /* First register entry is addr (00BBSS00) */ 60 /* First register entry is addr (00BBSS00) */
60 pdn->busno = (regs[0] >> 16) & 0xff; 61 pdn->busno = (regs[0] >> 16) & 0xff;
61 pdn->devfn = (regs[0] >> 8) & 0xff; 62 pdn->devfn = (regs[0] >> 8) & 0xff;
62 } 63 }
63 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 64 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
64 const u32 *busp = get_property(dn, "linux,subbus", NULL); 65 const u32 *busp = of_get_property(dn, "linux,subbus", NULL);
65 if (busp) 66 if (busp)
66 pdn->bussubno = *busp; 67 pdn->bussubno = *busp;
67 } 68 }
@@ -100,7 +101,7 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
100 u32 class; 101 u32 class;
101 102
102 nextdn = NULL; 103 nextdn = NULL;
103 classp = get_property(dn, "class-code", NULL); 104 classp = of_get_property(dn, "class-code", NULL);
104 class = classp ? *classp : 0; 105 class = classp ? *classp : 0;
105 106
106 if (pre && ((ret = pre(dn, data)) != NULL)) 107 if (pre && ((ret = pre(dn, data)) != NULL))
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 2f8e9c02c92a..ff252aaead12 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -20,7 +20,6 @@
20#include <asm/processor.h> 20#include <asm/processor.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/ide.h>
24#include <asm/atomic.h> 23#include <asm/atomic.h>
25#include <asm/checksum.h> 24#include <asm/checksum.h>
26#include <asm/pgtable.h> 25#include <asm/pgtable.h>
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e53b2988d1bf..e509aae2feb3 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -305,9 +305,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
305 set_dabr(new->thread.dabr); 305 set_dabr(new->thread.dabr);
306 __get_cpu_var(current_dabr) = new->thread.dabr; 306 __get_cpu_var(current_dabr) = new->thread.dabr;
307 } 307 }
308 308#endif /* CONFIG_PPC64 */
309 flush_tlb_pending();
310#endif
311 309
312 new_thread = &new->thread; 310 new_thread = &new->thread;
313 old_thread = &current->thread; 311 old_thread = &current->thread;
@@ -402,11 +400,11 @@ static void printbits(unsigned long val, struct regbit *bits)
402} 400}
403 401
404#ifdef CONFIG_PPC64 402#ifdef CONFIG_PPC64
405#define REG "%016lX" 403#define REG "%016lx"
406#define REGS_PER_LINE 4 404#define REGS_PER_LINE 4
407#define LAST_VOLATILE 13 405#define LAST_VOLATILE 13
408#else 406#else
409#define REG "%08lX" 407#define REG "%08lx"
410#define REGS_PER_LINE 8 408#define REGS_PER_LINE 8
411#define LAST_VOLATILE 12 409#define LAST_VOLATILE 12
412#endif 410#endif
@@ -421,7 +419,7 @@ void show_regs(struct pt_regs * regs)
421 regs, regs->trap, print_tainted(), init_utsname()->release); 419 regs, regs->trap, print_tainted(), init_utsname()->release);
422 printk("MSR: "REG" ", regs->msr); 420 printk("MSR: "REG" ", regs->msr);
423 printbits(regs->msr, msr_bits); 421 printbits(regs->msr, msr_bits);
424 printk(" CR: %08lX XER: %08lX\n", regs->ccr, regs->xer); 422 printk(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer);
425 trap = TRAP(regs); 423 trap = TRAP(regs);
426 if (trap == 0x300 || trap == 0x600) 424 if (trap == 0x300 || trap == 0x600)
427 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr); 425 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
@@ -572,7 +570,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
572 kregs->nip = *((unsigned long *)ret_from_fork); 570 kregs->nip = *((unsigned long *)ret_from_fork);
573#else 571#else
574 kregs->nip = (unsigned long)ret_from_fork; 572 kregs->nip = (unsigned long)ret_from_fork;
575 p->thread.last_syscall = -1;
576#endif 573#endif
577 574
578 return 0; 575 return 0;
@@ -823,6 +820,35 @@ out:
823 return error; 820 return error;
824} 821}
825 822
823#ifdef CONFIG_IRQSTACKS
824static inline int valid_irq_stack(unsigned long sp, struct task_struct *p,
825 unsigned long nbytes)
826{
827 unsigned long stack_page;
828 unsigned long cpu = task_cpu(p);
829
830 /*
831 * Avoid crashing if the stack has overflowed and corrupted
832 * task_cpu(p), which is in the thread_info struct.
833 */
834 if (cpu < NR_CPUS && cpu_possible(cpu)) {
835 stack_page = (unsigned long) hardirq_ctx[cpu];
836 if (sp >= stack_page + sizeof(struct thread_struct)
837 && sp <= stack_page + THREAD_SIZE - nbytes)
838 return 1;
839
840 stack_page = (unsigned long) softirq_ctx[cpu];
841 if (sp >= stack_page + sizeof(struct thread_struct)
842 && sp <= stack_page + THREAD_SIZE - nbytes)
843 return 1;
844 }
845 return 0;
846}
847
848#else
849#define valid_irq_stack(sp, p, nb) 0
850#endif /* CONFIG_IRQSTACKS */
851
826int validate_sp(unsigned long sp, struct task_struct *p, 852int validate_sp(unsigned long sp, struct task_struct *p,
827 unsigned long nbytes) 853 unsigned long nbytes)
828{ 854{
@@ -832,19 +858,7 @@ int validate_sp(unsigned long sp, struct task_struct *p,
832 && sp <= stack_page + THREAD_SIZE - nbytes) 858 && sp <= stack_page + THREAD_SIZE - nbytes)
833 return 1; 859 return 1;
834 860
835#ifdef CONFIG_IRQSTACKS 861 return valid_irq_stack(sp, p, nbytes);
836 stack_page = (unsigned long) hardirq_ctx[task_cpu(p)];
837 if (sp >= stack_page + sizeof(struct thread_struct)
838 && sp <= stack_page + THREAD_SIZE - nbytes)
839 return 1;
840
841 stack_page = (unsigned long) softirq_ctx[task_cpu(p)];
842 if (sp >= stack_page + sizeof(struct thread_struct)
843 && sp <= stack_page + THREAD_SIZE - nbytes)
844 return 1;
845#endif
846
847 return 0;
848} 862}
849 863
850#ifdef CONFIG_PPC64 864#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 8d52b23348bd..caef555f2dc0 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -390,18 +390,19 @@ static unsigned long __init unflatten_dt_node(unsigned long mem,
390 if (allnextpp) { 390 if (allnextpp) {
391 pp->name = "name"; 391 pp->name = "name";
392 pp->length = sz; 392 pp->length = sz;
393 pp->value = (unsigned char *)(pp + 1); 393 pp->value = pp + 1;
394 *prev_pp = pp; 394 *prev_pp = pp;
395 prev_pp = &pp->next; 395 prev_pp = &pp->next;
396 memcpy(pp->value, ps, sz - 1); 396 memcpy(pp->value, ps, sz - 1);
397 ((char *)pp->value)[sz - 1] = 0; 397 ((char *)pp->value)[sz - 1] = 0;
398 DBG("fixed up name for %s -> %s\n", pathp, pp->value); 398 DBG("fixed up name for %s -> %s\n", pathp,
399 (char *)pp->value);
399 } 400 }
400 } 401 }
401 if (allnextpp) { 402 if (allnextpp) {
402 *prev_pp = NULL; 403 *prev_pp = NULL;
403 np->name = get_property(np, "name", NULL); 404 np->name = of_get_property(np, "name", NULL);
404 np->type = get_property(np, "device_type", NULL); 405 np->type = of_get_property(np, "device_type", NULL);
405 406
406 if (!np->name) 407 if (!np->name)
407 np->name = "<NULL>"; 408 np->name = "<NULL>";
@@ -719,6 +720,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
719 const char *uname, int depth, void *data) 720 const char *uname, int depth, void *data)
720{ 721{
721 unsigned long *lprop; 722 unsigned long *lprop;
723 u32 *prop;
722 unsigned long l; 724 unsigned long l;
723 char *p; 725 char *p;
724 726
@@ -760,6 +762,22 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
760 crashk_res.end = crashk_res.start + *lprop - 1; 762 crashk_res.end = crashk_res.start + *lprop - 1;
761#endif 763#endif
762 764
765#ifdef CONFIG_BLK_DEV_INITRD
766 DBG("Looking for initrd properties... ");
767 prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
768 if (prop) {
769 initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
770 prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
771 if (prop) {
772 initrd_end = (unsigned long)__va(of_read_ulong(prop, l/4));
773 initrd_below_start_ok = 1;
774 } else {
775 initrd_start = 0;
776 }
777 }
778 DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end);
779#endif /* CONFIG_BLK_DEV_INITRD */
780
763 /* Retreive command line */ 781 /* Retreive command line */
764 p = of_get_flat_dt_prop(node, "bootargs", &l); 782 p = of_get_flat_dt_prop(node, "bootargs", &l);
765 if (p != NULL && l > 0) 783 if (p != NULL && l > 0)
@@ -926,6 +944,12 @@ static void __init early_reserve_mem(void)
926 self_size = initial_boot_params->totalsize; 944 self_size = initial_boot_params->totalsize;
927 lmb_reserve(self_base, self_size); 945 lmb_reserve(self_base, self_size);
928 946
947#ifdef CONFIG_BLK_DEV_INITRD
948 /* then reserve the initrd, if any */
949 if (initrd_start && (initrd_end > initrd_start))
950 lmb_reserve(__pa(initrd_start), initrd_end - initrd_start);
951#endif /* CONFIG_BLK_DEV_INITRD */
952
929#ifdef CONFIG_PPC32 953#ifdef CONFIG_PPC32
930 /* 954 /*
931 * Handle the case where we might be booting from an old kexec 955 * Handle the case where we might be booting from an old kexec
@@ -954,9 +978,6 @@ static void __init early_reserve_mem(void)
954 size = *(reserve_map++); 978 size = *(reserve_map++);
955 if (size == 0) 979 if (size == 0)
956 break; 980 break;
957 /* skip if the reservation is for the blob */
958 if (base == self_base && size == self_size)
959 continue;
960 DBG("reserving: %llx -> %llx\n", base, size); 981 DBG("reserving: %llx -> %llx\n", base, size);
961 lmb_reserve(base, size); 982 lmb_reserve(base, size);
962 } 983 }
@@ -1021,102 +1042,46 @@ void __init early_init_devtree(void *params)
1021 1042
1022#undef printk 1043#undef printk
1023 1044
1024int 1045int of_n_addr_cells(struct device_node* np)
1025prom_n_addr_cells(struct device_node* np)
1026{ 1046{
1027 const int *ip; 1047 const int *ip;
1028 do { 1048 do {
1029 if (np->parent) 1049 if (np->parent)
1030 np = np->parent; 1050 np = np->parent;
1031 ip = get_property(np, "#address-cells", NULL); 1051 ip = of_get_property(np, "#address-cells", NULL);
1032 if (ip != NULL) 1052 if (ip != NULL)
1033 return *ip; 1053 return *ip;
1034 } while (np->parent); 1054 } while (np->parent);
1035 /* No #address-cells property for the root node, default to 1 */ 1055 /* No #address-cells property for the root node, default to 1 */
1036 return 1; 1056 return 1;
1037} 1057}
1038EXPORT_SYMBOL(prom_n_addr_cells); 1058EXPORT_SYMBOL(of_n_addr_cells);
1039 1059
1040int 1060int of_n_size_cells(struct device_node* np)
1041prom_n_size_cells(struct device_node* np)
1042{ 1061{
1043 const int* ip; 1062 const int* ip;
1044 do { 1063 do {
1045 if (np->parent) 1064 if (np->parent)
1046 np = np->parent; 1065 np = np->parent;
1047 ip = get_property(np, "#size-cells", NULL); 1066 ip = of_get_property(np, "#size-cells", NULL);
1048 if (ip != NULL) 1067 if (ip != NULL)
1049 return *ip; 1068 return *ip;
1050 } while (np->parent); 1069 } while (np->parent);
1051 /* No #size-cells property for the root node, default to 1 */ 1070 /* No #size-cells property for the root node, default to 1 */
1052 return 1; 1071 return 1;
1053} 1072}
1054EXPORT_SYMBOL(prom_n_size_cells); 1073EXPORT_SYMBOL(of_n_size_cells);
1055
1056/**
1057 * Construct and return a list of the device_nodes with a given name.
1058 */
1059struct device_node *find_devices(const char *name)
1060{
1061 struct device_node *head, **prevp, *np;
1062
1063 prevp = &head;
1064 for (np = allnodes; np != 0; np = np->allnext) {
1065 if (np->name != 0 && strcasecmp(np->name, name) == 0) {
1066 *prevp = np;
1067 prevp = &np->next;
1068 }
1069 }
1070 *prevp = NULL;
1071 return head;
1072}
1073EXPORT_SYMBOL(find_devices);
1074
1075/**
1076 * Construct and return a list of the device_nodes with a given type.
1077 */
1078struct device_node *find_type_devices(const char *type)
1079{
1080 struct device_node *head, **prevp, *np;
1081
1082 prevp = &head;
1083 for (np = allnodes; np != 0; np = np->allnext) {
1084 if (np->type != 0 && strcasecmp(np->type, type) == 0) {
1085 *prevp = np;
1086 prevp = &np->next;
1087 }
1088 }
1089 *prevp = NULL;
1090 return head;
1091}
1092EXPORT_SYMBOL(find_type_devices);
1093
1094/**
1095 * Returns all nodes linked together
1096 */
1097struct device_node *find_all_nodes(void)
1098{
1099 struct device_node *head, **prevp, *np;
1100
1101 prevp = &head;
1102 for (np = allnodes; np != 0; np = np->allnext) {
1103 *prevp = np;
1104 prevp = &np->next;
1105 }
1106 *prevp = NULL;
1107 return head;
1108}
1109EXPORT_SYMBOL(find_all_nodes);
1110 1074
1111/** Checks if the given "compat" string matches one of the strings in 1075/** Checks if the given "compat" string matches one of the strings in
1112 * the device's "compatible" property 1076 * the device's "compatible" property
1113 */ 1077 */
1114int device_is_compatible(const struct device_node *device, const char *compat) 1078int of_device_is_compatible(const struct device_node *device,
1079 const char *compat)
1115{ 1080{
1116 const char* cp; 1081 const char* cp;
1117 int cplen, l; 1082 int cplen, l;
1118 1083
1119 cp = get_property(device, "compatible", &cplen); 1084 cp = of_get_property(device, "compatible", &cplen);
1120 if (cp == NULL) 1085 if (cp == NULL)
1121 return 0; 1086 return 0;
1122 while (cplen > 0) { 1087 while (cplen > 0) {
@@ -1129,7 +1094,7 @@ int device_is_compatible(const struct device_node *device, const char *compat)
1129 1094
1130 return 0; 1095 return 0;
1131} 1096}
1132EXPORT_SYMBOL(device_is_compatible); 1097EXPORT_SYMBOL(of_device_is_compatible);
1133 1098
1134 1099
1135/** 1100/**
@@ -1143,51 +1108,13 @@ int machine_is_compatible(const char *compat)
1143 1108
1144 root = of_find_node_by_path("/"); 1109 root = of_find_node_by_path("/");
1145 if (root) { 1110 if (root) {
1146 rc = device_is_compatible(root, compat); 1111 rc = of_device_is_compatible(root, compat);
1147 of_node_put(root); 1112 of_node_put(root);
1148 } 1113 }
1149 return rc; 1114 return rc;
1150} 1115}
1151EXPORT_SYMBOL(machine_is_compatible); 1116EXPORT_SYMBOL(machine_is_compatible);
1152 1117
1153/**
1154 * Construct and return a list of the device_nodes with a given type
1155 * and compatible property.
1156 */
1157struct device_node *find_compatible_devices(const char *type,
1158 const char *compat)
1159{
1160 struct device_node *head, **prevp, *np;
1161
1162 prevp = &head;
1163 for (np = allnodes; np != 0; np = np->allnext) {
1164 if (type != NULL
1165 && !(np->type != 0 && strcasecmp(np->type, type) == 0))
1166 continue;
1167 if (device_is_compatible(np, compat)) {
1168 *prevp = np;
1169 prevp = &np->next;
1170 }
1171 }
1172 *prevp = NULL;
1173 return head;
1174}
1175EXPORT_SYMBOL(find_compatible_devices);
1176
1177/**
1178 * Find the device_node with a given full_name.
1179 */
1180struct device_node *find_path_device(const char *path)
1181{
1182 struct device_node *np;
1183
1184 for (np = allnodes; np != 0; np = np->allnext)
1185 if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0)
1186 return np;
1187 return NULL;
1188}
1189EXPORT_SYMBOL(find_path_device);
1190
1191/******* 1118/*******
1192 * 1119 *
1193 * New implementation of the OF "find" APIs, return a refcounted 1120 * New implementation of the OF "find" APIs, return a refcounted
@@ -1280,7 +1207,7 @@ struct device_node *of_find_compatible_node(struct device_node *from,
1280 if (type != NULL 1207 if (type != NULL
1281 && !(np->type != 0 && strcasecmp(np->type, type) == 0)) 1208 && !(np->type != 0 && strcasecmp(np->type, type) == 0))
1282 continue; 1209 continue;
1283 if (device_is_compatible(np, compatible) && of_node_get(np)) 1210 if (of_device_is_compatible(np, compatible) && of_node_get(np))
1284 break; 1211 break;
1285 } 1212 }
1286 of_node_put(from); 1213 of_node_put(from);
@@ -1527,8 +1454,8 @@ static int of_finish_dynamic_node(struct device_node *node)
1527 int err = 0; 1454 int err = 0;
1528 const phandle *ibm_phandle; 1455 const phandle *ibm_phandle;
1529 1456
1530 node->name = get_property(node, "name", NULL); 1457 node->name = of_get_property(node, "name", NULL);
1531 node->type = get_property(node, "device_type", NULL); 1458 node->type = of_get_property(node, "device_type", NULL);
1532 1459
1533 if (!parent) { 1460 if (!parent) {
1534 err = -ENODEV; 1461 err = -ENODEV;
@@ -1542,7 +1469,7 @@ static int of_finish_dynamic_node(struct device_node *node)
1542 return -ENODEV; 1469 return -ENODEV;
1543 1470
1544 /* fix up new node's linux_phandle field */ 1471 /* fix up new node's linux_phandle field */
1545 if ((ibm_phandle = get_property(node, "ibm,phandle", NULL))) 1472 if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL)))
1546 node->linux_phandle = *ibm_phandle; 1473 node->linux_phandle = *ibm_phandle;
1547 1474
1548out: 1475out:
@@ -1605,13 +1532,13 @@ EXPORT_SYMBOL(of_find_property);
1605 * Find a property with a given name for a given node 1532 * Find a property with a given name for a given node
1606 * and return the value. 1533 * and return the value.
1607 */ 1534 */
1608const void *get_property(const struct device_node *np, const char *name, 1535const void *of_get_property(const struct device_node *np, const char *name,
1609 int *lenp) 1536 int *lenp)
1610{ 1537{
1611 struct property *pp = of_find_property(np,name,lenp); 1538 struct property *pp = of_find_property(np,name,lenp);
1612 return pp ? pp->value : NULL; 1539 return pp ? pp->value : NULL;
1613} 1540}
1614EXPORT_SYMBOL(get_property); 1541EXPORT_SYMBOL(of_get_property);
1615 1542
1616/* 1543/*
1617 * Add a property to a node 1544 * Add a property to a node
@@ -1742,10 +1669,10 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
1742 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist 1669 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
1743 * fallback to "reg" property and assume no threads 1670 * fallback to "reg" property and assume no threads
1744 */ 1671 */
1745 intserv = get_property(np, "ibm,ppc-interrupt-server#s", 1672 intserv = of_get_property(np, "ibm,ppc-interrupt-server#s",
1746 &plen); 1673 &plen);
1747 if (intserv == NULL) { 1674 if (intserv == NULL) {
1748 const u32 *reg = get_property(np, "reg", NULL); 1675 const u32 *reg = of_get_property(np, "reg", NULL);
1749 if (reg == NULL) 1676 if (reg == NULL)
1750 continue; 1677 continue;
1751 if (*reg == hardid) { 1678 if (*reg == hardid) {
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 4fb5938ce6d3..e27d9d1b6e67 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2035,39 +2035,50 @@ static void __init fixup_device_tree_maple(void)
2035#endif 2035#endif
2036 2036
2037#ifdef CONFIG_PPC_CHRP 2037#ifdef CONFIG_PPC_CHRP
2038/* Pegasos and BriQ lacks the "ranges" property in the isa node */ 2038/*
2039 * Pegasos and BriQ lacks the "ranges" property in the isa node
2040 * Pegasos needs decimal IRQ 14/15, not hexadecimal
2041 */
2039static void __init fixup_device_tree_chrp(void) 2042static void __init fixup_device_tree_chrp(void)
2040{ 2043{
2041 phandle isa; 2044 phandle ph;
2042 u32 isa_ranges[6]; 2045 u32 prop[6];
2043 u32 rloc = 0x01006000; /* IO space; PCI device = 12 */ 2046 u32 rloc = 0x01006000; /* IO space; PCI device = 12 */
2044 char *name; 2047 char *name;
2045 int rc; 2048 int rc;
2046 2049
2047 name = "/pci@80000000/isa@c"; 2050 name = "/pci@80000000/isa@c";
2048 isa = call_prom("finddevice", 1, 1, ADDR(name)); 2051 ph = call_prom("finddevice", 1, 1, ADDR(name));
2049 if (!PHANDLE_VALID(isa)) { 2052 if (!PHANDLE_VALID(ph)) {
2050 name = "/pci@ff500000/isa@6"; 2053 name = "/pci@ff500000/isa@6";
2051 isa = call_prom("finddevice", 1, 1, ADDR(name)); 2054 ph = call_prom("finddevice", 1, 1, ADDR(name));
2052 rloc = 0x01003000; /* IO space; PCI device = 6 */ 2055 rloc = 0x01003000; /* IO space; PCI device = 6 */
2053 } 2056 }
2054 if (!PHANDLE_VALID(isa)) 2057 if (PHANDLE_VALID(ph)) {
2055 return; 2058 rc = prom_getproplen(ph, "ranges");
2056 2059 if (rc == 0 || rc == PROM_ERROR) {
2057 rc = prom_getproplen(isa, "ranges"); 2060 prom_printf("Fixing up missing ISA range on Pegasos...\n");
2058 if (rc != 0 && rc != PROM_ERROR) 2061
2059 return; 2062 prop[0] = 0x1;
2060 2063 prop[1] = 0x0;
2061 prom_printf("Fixing up missing ISA range on Pegasos...\n"); 2064 prop[2] = rloc;
2065 prop[3] = 0x0;
2066 prop[4] = 0x0;
2067 prop[5] = 0x00010000;
2068 prom_setprop(ph, name, "ranges", prop, sizeof(prop));
2069 }
2070 }
2062 2071
2063 isa_ranges[0] = 0x1; 2072 name = "/pci@80000000/ide@C,1";
2064 isa_ranges[1] = 0x0; 2073 ph = call_prom("finddevice", 1, 1, ADDR(name));
2065 isa_ranges[2] = rloc; 2074 if (PHANDLE_VALID(ph)) {
2066 isa_ranges[3] = 0x0; 2075 prom_printf("Fixing up IDE interrupt on Pegasos...\n");
2067 isa_ranges[4] = 0x0; 2076 prop[0] = 14;
2068 isa_ranges[5] = 0x00010000; 2077 prop[1] = 0x0;
2069 prom_setprop(isa, name, "ranges", 2078 prop[2] = 15;
2070 isa_ranges, sizeof(isa_ranges)); 2079 prop[3] = 0x0;
2080 prom_setprop(ph, name, "interrupts", prop, 4*sizeof(u32));
2081 }
2071} 2082}
2072#else 2083#else
2073#define fixup_device_tree_chrp() 2084#define fixup_device_tree_chrp()
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 91b443c9a488..aa40a5307294 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -68,9 +68,9 @@ static void of_bus_default_count_cells(struct device_node *dev,
68 int *addrc, int *sizec) 68 int *addrc, int *sizec)
69{ 69{
70 if (addrc) 70 if (addrc)
71 *addrc = prom_n_addr_cells(dev); 71 *addrc = of_n_addr_cells(dev);
72 if (sizec) 72 if (sizec)
73 *sizec = prom_n_size_cells(dev); 73 *sizec = of_n_size_cells(dev);
74} 74}
75 75
76static u64 of_bus_default_map(u32 *addr, const u32 *range, 76static u64 of_bus_default_map(u32 *addr, const u32 *range,
@@ -196,7 +196,7 @@ const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
196 return NULL; 196 return NULL;
197 197
198 /* Get "reg" or "assigned-addresses" property */ 198 /* Get "reg" or "assigned-addresses" property */
199 prop = get_property(dev, bus->addresses, &psize); 199 prop = of_get_property(dev, bus->addresses, &psize);
200 if (prop == NULL) 200 if (prop == NULL)
201 return NULL; 201 return NULL;
202 psize /= 4; 202 psize /= 4;
@@ -438,7 +438,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
438 * to translate addresses that aren't supposed to be translated in 438 * to translate addresses that aren't supposed to be translated in
439 * the first place. --BenH. 439 * the first place. --BenH.
440 */ 440 */
441 ranges = get_property(parent, "ranges", &rlen); 441 ranges = of_get_property(parent, "ranges", &rlen);
442 if (ranges == NULL || rlen == 0) { 442 if (ranges == NULL || rlen == 0) {
443 offset = of_read_number(addr, na); 443 offset = of_read_number(addr, na);
444 memset(addr, 0, pna * 4); 444 memset(addr, 0, pna * 4);
@@ -578,7 +578,7 @@ const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
578 return NULL; 578 return NULL;
579 579
580 /* Get "reg" or "assigned-addresses" property */ 580 /* Get "reg" or "assigned-addresses" property */
581 prop = get_property(dev, bus->addresses, &psize); 581 prop = of_get_property(dev, bus->addresses, &psize);
582 if (prop == NULL) 582 if (prop == NULL)
583 return NULL; 583 return NULL;
584 psize /= 4; 584 psize /= 4;
@@ -650,17 +650,17 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
650 /* busno is always one cell */ 650 /* busno is always one cell */
651 *busno = *(dma_window++); 651 *busno = *(dma_window++);
652 652
653 prop = get_property(dn, "ibm,#dma-address-cells", NULL); 653 prop = of_get_property(dn, "ibm,#dma-address-cells", NULL);
654 if (!prop) 654 if (!prop)
655 prop = get_property(dn, "#address-cells", NULL); 655 prop = of_get_property(dn, "#address-cells", NULL);
656 656
657 cells = prop ? *(u32 *)prop : prom_n_addr_cells(dn); 657 cells = prop ? *(u32 *)prop : of_n_addr_cells(dn);
658 *phys = of_read_number(dma_window, cells); 658 *phys = of_read_number(dma_window, cells);
659 659
660 dma_window += cells; 660 dma_window += cells;
661 661
662 prop = get_property(dn, "ibm,#dma-size-cells", NULL); 662 prop = of_get_property(dn, "ibm,#dma-size-cells", NULL);
663 cells = prop ? *(u32 *)prop : prom_n_size_cells(dn); 663 cells = prop ? *(u32 *)prop : of_n_size_cells(dn);
664 *size = of_read_number(dma_window, cells); 664 *size = of_read_number(dma_window, cells);
665} 665}
666 666
@@ -680,7 +680,7 @@ static struct device_node *of_irq_find_parent(struct device_node *child)
680 return NULL; 680 return NULL;
681 681
682 do { 682 do {
683 parp = get_property(child, "interrupt-parent", NULL); 683 parp = of_get_property(child, "interrupt-parent", NULL);
684 if (parp == NULL) 684 if (parp == NULL)
685 p = of_get_parent(child); 685 p = of_get_parent(child);
686 else { 686 else {
@@ -691,7 +691,7 @@ static struct device_node *of_irq_find_parent(struct device_node *child)
691 } 691 }
692 of_node_put(child); 692 of_node_put(child);
693 child = p; 693 child = p;
694 } while (p && get_property(p, "#interrupt-cells", NULL) == NULL); 694 } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
695 695
696 return p; 696 return p;
697} 697}
@@ -716,7 +716,7 @@ void of_irq_map_init(unsigned int flags)
716 struct device_node *np; 716 struct device_node *np;
717 717
718 for(np = NULL; (np = of_find_all_nodes(np)) != NULL;) { 718 for(np = NULL; (np = of_find_all_nodes(np)) != NULL;) {
719 if (get_property(np, "interrupt-controller", NULL) 719 if (of_get_property(np, "interrupt-controller", NULL)
720 == NULL) 720 == NULL)
721 continue; 721 continue;
722 /* Skip /chosen/interrupt-controller */ 722 /* Skip /chosen/interrupt-controller */
@@ -755,7 +755,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
755 * is none, we are nice and just walk up the tree 755 * is none, we are nice and just walk up the tree
756 */ 756 */
757 do { 757 do {
758 tmp = get_property(ipar, "#interrupt-cells", NULL); 758 tmp = of_get_property(ipar, "#interrupt-cells", NULL);
759 if (tmp != NULL) { 759 if (tmp != NULL) {
760 intsize = *tmp; 760 intsize = *tmp;
761 break; 761 break;
@@ -779,7 +779,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
779 */ 779 */
780 old = of_node_get(ipar); 780 old = of_node_get(ipar);
781 do { 781 do {
782 tmp = get_property(old, "#address-cells", NULL); 782 tmp = of_get_property(old, "#address-cells", NULL);
783 tnode = of_get_parent(old); 783 tnode = of_get_parent(old);
784 of_node_put(old); 784 of_node_put(old);
785 old = tnode; 785 old = tnode;
@@ -795,7 +795,8 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
795 /* Now check if cursor is an interrupt-controller and if it is 795 /* Now check if cursor is an interrupt-controller and if it is
796 * then we are done 796 * then we are done
797 */ 797 */
798 if (get_property(ipar, "interrupt-controller", NULL) != NULL) { 798 if (of_get_property(ipar, "interrupt-controller", NULL) !=
799 NULL) {
799 DBG(" -> got it !\n"); 800 DBG(" -> got it !\n");
800 memcpy(out_irq->specifier, intspec, 801 memcpy(out_irq->specifier, intspec,
801 intsize * sizeof(u32)); 802 intsize * sizeof(u32));
@@ -806,7 +807,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
806 } 807 }
807 808
808 /* Now look for an interrupt-map */ 809 /* Now look for an interrupt-map */
809 imap = get_property(ipar, "interrupt-map", &imaplen); 810 imap = of_get_property(ipar, "interrupt-map", &imaplen);
810 /* No interrupt map, check for an interrupt parent */ 811 /* No interrupt map, check for an interrupt parent */
811 if (imap == NULL) { 812 if (imap == NULL) {
812 DBG(" -> no map, getting parent\n"); 813 DBG(" -> no map, getting parent\n");
@@ -816,7 +817,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
816 imaplen /= sizeof(u32); 817 imaplen /= sizeof(u32);
817 818
818 /* Look for a mask */ 819 /* Look for a mask */
819 imask = get_property(ipar, "interrupt-map-mask", NULL); 820 imask = of_get_property(ipar, "interrupt-map-mask", NULL);
820 821
821 /* If we were passed no "reg" property and we attempt to parse 822 /* If we were passed no "reg" property and we attempt to parse
822 * an interrupt-map, then #address-cells must be 0. 823 * an interrupt-map, then #address-cells must be 0.
@@ -863,15 +864,13 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
863 /* Get #interrupt-cells and #address-cells of new 864 /* Get #interrupt-cells and #address-cells of new
864 * parent 865 * parent
865 */ 866 */
866 tmp = get_property(newpar, "#interrupt-cells", 867 tmp = of_get_property(newpar, "#interrupt-cells", NULL);
867 NULL);
868 if (tmp == NULL) { 868 if (tmp == NULL) {
869 DBG(" -> parent lacks #interrupt-cells !\n"); 869 DBG(" -> parent lacks #interrupt-cells !\n");
870 goto fail; 870 goto fail;
871 } 871 }
872 newintsize = *tmp; 872 newintsize = *tmp;
873 tmp = get_property(newpar, "#address-cells", 873 tmp = of_get_property(newpar, "#address-cells", NULL);
874 NULL);
875 newaddrsize = (tmp == NULL) ? 0 : *tmp; 874 newaddrsize = (tmp == NULL) ? 0 : *tmp;
876 875
877 DBG(" -> newintsize=%d, newaddrsize=%d\n", 876 DBG(" -> newintsize=%d, newaddrsize=%d\n",
@@ -928,7 +927,7 @@ static int of_irq_map_oldworld(struct device_node *device, int index,
928 * everything together on these) 927 * everything together on these)
929 */ 928 */
930 while (device) { 929 while (device) {
931 ints = get_property(device, "AAPL,interrupts", &intlen); 930 ints = of_get_property(device, "AAPL,interrupts", &intlen);
932 if (ints != NULL) 931 if (ints != NULL)
933 break; 932 break;
934 device = device->parent; 933 device = device->parent;
@@ -970,13 +969,13 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
970 return of_irq_map_oldworld(device, index, out_irq); 969 return of_irq_map_oldworld(device, index, out_irq);
971 970
972 /* Get the interrupts property */ 971 /* Get the interrupts property */
973 intspec = get_property(device, "interrupts", &intlen); 972 intspec = of_get_property(device, "interrupts", &intlen);
974 if (intspec == NULL) 973 if (intspec == NULL)
975 return -EINVAL; 974 return -EINVAL;
976 intlen /= sizeof(u32); 975 intlen /= sizeof(u32);
977 976
978 /* Get the reg property (if any) */ 977 /* Get the reg property (if any) */
979 addr = get_property(device, "reg", NULL); 978 addr = of_get_property(device, "reg", NULL);
980 979
981 /* Look for the interrupt parent. */ 980 /* Look for the interrupt parent. */
982 p = of_irq_find_parent(device); 981 p = of_irq_find_parent(device);
@@ -984,7 +983,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
984 return -EINVAL; 983 return -EINVAL;
985 984
986 /* Get size of interrupt specifier */ 985 /* Get size of interrupt specifier */
987 tmp = get_property(p, "#interrupt-cells", NULL); 986 tmp = of_get_property(p, "#interrupt-cells", NULL);
988 if (tmp == NULL) { 987 if (tmp == NULL) {
989 of_node_put(p); 988 of_node_put(p);
990 return -EINVAL; 989 return -EINVAL;
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index 6cbf2ae5d7aa..190b7ed1dbfb 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -450,7 +450,7 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v)
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 = get_property(rtas_node, rstr, &llen); 453 loc = of_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++) {
@@ -477,7 +477,7 @@ static int ppc_rtas_find_all_sensors(void)
477 const unsigned int *utmp; 477 const unsigned int *utmp;
478 int len, i; 478 int len, i;
479 479
480 utmp = get_property(rtas_node, "rtas-sensors", &len); 480 utmp = of_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;
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 9d0735a54564..214780798289 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -192,18 +192,19 @@ void rtas_progress(char *s, unsigned short hex)
192 192
193 if (display_width == 0) { 193 if (display_width == 0) {
194 display_width = 0x10; 194 display_width = 0x10;
195 if ((root = find_path_device("/rtas"))) { 195 if ((root = of_find_node_by_path("/rtas"))) {
196 if ((p = get_property(root, 196 if ((p = of_get_property(root,
197 "ibm,display-line-length", NULL))) 197 "ibm,display-line-length", NULL)))
198 display_width = *p; 198 display_width = *p;
199 if ((p = get_property(root, 199 if ((p = of_get_property(root,
200 "ibm,form-feed", NULL))) 200 "ibm,form-feed", NULL)))
201 form_feed = *p; 201 form_feed = *p;
202 if ((p = get_property(root, 202 if ((p = of_get_property(root,
203 "ibm,display-number-of-lines", NULL))) 203 "ibm,display-number-of-lines", NULL)))
204 display_lines = *p; 204 display_lines = *p;
205 row_width = get_property(root, 205 row_width = of_get_property(root,
206 "ibm,display-truncation-length", NULL); 206 "ibm,display-truncation-length", NULL);
207 of_node_put(root);
207 } 208 }
208 display_character = rtas_token("display-character"); 209 display_character = rtas_token("display-character");
209 set_indicator = rtas_token("set-indicator"); 210 set_indicator = rtas_token("set-indicator");
@@ -298,7 +299,7 @@ int rtas_token(const char *service)
298 const int *tokp; 299 const int *tokp;
299 if (rtas.dev == NULL) 300 if (rtas.dev == NULL)
300 return RTAS_UNKNOWN_SERVICE; 301 return RTAS_UNKNOWN_SERVICE;
301 tokp = get_property(rtas.dev, service, NULL); 302 tokp = of_get_property(rtas.dev, service, NULL);
302 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; 303 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
303} 304}
304EXPORT_SYMBOL(rtas_token); 305EXPORT_SYMBOL(rtas_token);
@@ -832,12 +833,12 @@ void __init rtas_initialize(void)
832 if (rtas.dev) { 833 if (rtas.dev) {
833 const u32 *basep, *entryp, *sizep; 834 const u32 *basep, *entryp, *sizep;
834 835
835 basep = get_property(rtas.dev, "linux,rtas-base", NULL); 836 basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
836 sizep = get_property(rtas.dev, "rtas-size", NULL); 837 sizep = of_get_property(rtas.dev, "rtas-size", NULL);
837 if (basep != NULL && sizep != NULL) { 838 if (basep != NULL && sizep != NULL) {
838 rtas.base = *basep; 839 rtas.base = *basep;
839 rtas.size = *sizep; 840 rtas.size = *sizep;
840 entryp = get_property(rtas.dev, 841 entryp = of_get_property(rtas.dev,
841 "linux,rtas-entry", NULL); 842 "linux,rtas-entry", NULL);
842 if (entryp == NULL) /* Ugh */ 843 if (entryp == NULL) /* Ugh */
843 rtas.entry = rtas.base; 844 rtas.entry = rtas.base;
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index ace9f4c86e67..f2286822be09 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -60,7 +60,7 @@ static int of_device_available(struct device_node * dn)
60{ 60{
61 const char *status; 61 const char *status;
62 62
63 status = get_property(dn, "status", NULL); 63 status = of_get_property(dn, "status", NULL);
64 64
65 if (!status) 65 if (!status)
66 return 1; 66 return 1;
@@ -177,7 +177,7 @@ struct pci_ops rtas_pci_ops = {
177 177
178int is_python(struct device_node *dev) 178int is_python(struct device_node *dev)
179{ 179{
180 const char *model = get_property(dev, "model", NULL); 180 const char *model = of_get_property(dev, "model", NULL);
181 181
182 if (model && strstr(model, "Python")) 182 if (model && strstr(model, "Python"))
183 return 1; 183 return 1;
@@ -247,7 +247,7 @@ static int phb_set_bus_ranges(struct device_node *dev,
247 const int *bus_range; 247 const int *bus_range;
248 unsigned int len; 248 unsigned int len;
249 249
250 bus_range = get_property(dev, "bus-range", &len); 250 bus_range = of_get_property(dev, "bus-range", &len);
251 if (bus_range == NULL || len < 2 * sizeof(int)) { 251 if (bus_range == NULL || len < 2 * sizeof(int)) {
252 return 1; 252 return 1;
253 } 253 }
@@ -274,7 +274,7 @@ int __devinit rtas_setup_phb(struct pci_controller *phb)
274 return 0; 274 return 0;
275} 275}
276 276
277unsigned long __init find_and_init_phbs(void) 277void __init find_and_init_phbs(void)
278{ 278{
279 struct device_node *node; 279 struct device_node *node;
280 struct pci_controller *phb; 280 struct pci_controller *phb;
@@ -309,18 +309,16 @@ unsigned long __init find_and_init_phbs(void)
309 if (of_chosen) { 309 if (of_chosen) {
310 const int *prop; 310 const int *prop;
311 311
312 prop = get_property(of_chosen, 312 prop = of_get_property(of_chosen,
313 "linux,pci-probe-only", NULL); 313 "linux,pci-probe-only", NULL);
314 if (prop) 314 if (prop)
315 pci_probe_only = *prop; 315 pci_probe_only = *prop;
316 316
317 prop = get_property(of_chosen, 317 prop = of_get_property(of_chosen,
318 "linux,pci-assign-all-buses", NULL); 318 "linux,pci-assign-all-buses", NULL);
319 if (prop) 319 if (prop)
320 pci_assign_all_buses = *prop; 320 pci_assign_all_buses = *prop;
321 } 321 }
322
323 return 0;
324} 322}
325 323
326/* RPA-specific bits for removing PHBs */ 324/* RPA-specific bits for removing PHBs */
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 89cfaf49d3de..370803722e47 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -21,7 +21,6 @@
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/initrd.h> 22#include <linux/initrd.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/ide.h>
25#include <linux/seq_file.h> 24#include <linux/seq_file.h>
26#include <linux/ioport.h> 25#include <linux/ioport.h>
27#include <linux/console.h> 26#include <linux/console.h>
@@ -304,26 +303,8 @@ struct seq_operations cpuinfo_op = {
304void __init check_for_initrd(void) 303void __init check_for_initrd(void)
305{ 304{
306#ifdef CONFIG_BLK_DEV_INITRD 305#ifdef CONFIG_BLK_DEV_INITRD
307 const unsigned int *prop; 306 DBG(" -> check_for_initrd() initrd_start=0x%lx initrd_end=0x%lx\n",
308 int len; 307 initrd_start, initrd_end);
309
310 DBG(" -> check_for_initrd()\n");
311
312 if (of_chosen) {
313 prop = get_property(of_chosen, "linux,initrd-start", &len);
314 if (prop != NULL) {
315 initrd_start = (unsigned long)
316 __va(of_read_ulong(prop, len / 4));
317 prop = get_property(of_chosen,
318 "linux,initrd-end", &len);
319 if (prop != NULL) {
320 initrd_end = (unsigned long)
321 __va(of_read_ulong(prop, len / 4));
322 initrd_below_start_ok = 1;
323 } else
324 initrd_start = 0;
325 }
326 }
327 308
328 /* If we were passed an initrd, set the ROOT_DEV properly if the values 309 /* If we were passed an initrd, set the ROOT_DEV properly if the values
329 * look sensible. If not, clear initrd reference. 310 * look sensible. If not, clear initrd reference.
@@ -371,11 +352,12 @@ void __init smp_setup_cpu_maps(void)
371 const int *intserv; 352 const int *intserv;
372 int j, len = sizeof(u32), nthreads = 1; 353 int j, len = sizeof(u32), nthreads = 1;
373 354
374 intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len); 355 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s",
356 &len);
375 if (intserv) 357 if (intserv)
376 nthreads = len / sizeof(int); 358 nthreads = len / sizeof(int);
377 else { 359 else {
378 intserv = get_property(dn, "reg", NULL); 360 intserv = of_get_property(dn, "reg", NULL);
379 if (!intserv) 361 if (!intserv)
380 intserv = &cpu; /* assume logical == phys */ 362 intserv = &cpu; /* assume logical == phys */
381 } 363 }
@@ -398,10 +380,10 @@ void __init smp_setup_cpu_maps(void)
398 int num_addr_cell, num_size_cell, maxcpus; 380 int num_addr_cell, num_size_cell, maxcpus;
399 const unsigned int *ireg; 381 const unsigned int *ireg;
400 382
401 num_addr_cell = prom_n_addr_cells(dn); 383 num_addr_cell = of_n_addr_cells(dn);
402 num_size_cell = prom_n_size_cells(dn); 384 num_size_cell = of_n_size_cells(dn);
403 385
404 ireg = get_property(dn, "ibm,lrdr-capacity", NULL); 386 ireg = of_get_property(dn, "ibm,lrdr-capacity", NULL);
405 387
406 if (!ireg) 388 if (!ireg)
407 goto out; 389 goto out;
@@ -496,11 +478,39 @@ void probe_machine(void)
496 printk(KERN_INFO "Using %s machine description\n", ppc_md.name); 478 printk(KERN_INFO "Using %s machine description\n", ppc_md.name);
497} 479}
498 480
481/* Match a class of boards, not a specific device configuration. */
499int check_legacy_ioport(unsigned long base_port) 482int check_legacy_ioport(unsigned long base_port)
500{ 483{
501 if (ppc_md.check_legacy_ioport == NULL) 484 struct device_node *parent, *np = NULL;
502 return 0; 485 int ret = -ENODEV;
503 return ppc_md.check_legacy_ioport(base_port); 486
487 switch(base_port) {
488 case I8042_DATA_REG:
489 np = of_find_node_by_type(NULL, "8042");
490 break;
491 case FDC_BASE: /* FDC1 */
492 np = of_find_node_by_type(NULL, "fdc");
493 break;
494#ifdef CONFIG_PPC_PREP
495 case _PIDXR:
496 case _PNPWRP:
497 case PNPBIOS_BASE:
498 /* implement me */
499#endif
500 default:
501 /* ipmi is supposed to fail here */
502 break;
503 }
504 if (!np)
505 return ret;
506 parent = of_get_parent(np);
507 if (parent) {
508 if (strcmp(parent->type, "isa") == 0)
509 ret = 0;
510 of_node_put(parent);
511 }
512 of_node_put(np);
513 return ret;
504} 514}
505EXPORT_SYMBOL(check_legacy_ioport); 515EXPORT_SYMBOL(check_legacy_ioport);
506 516
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 44a6a3c47feb..35f8f443c14f 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -92,7 +92,8 @@ unsigned long __init early_init(unsigned long dt_ptr)
92 92
93 /* First zero the BSS -- use memset_io, some platforms don't have 93 /* First zero the BSS -- use memset_io, some platforms don't have
94 * caches on yet */ 94 * caches on yet */
95 memset_io((void __iomem *)PTRRELOC(&__bss_start), 0, _end - __bss_start); 95 memset_io((void __iomem *)PTRRELOC(&__bss_start), 0,
96 __bss_stop - __bss_start);
96 97
97 /* 98 /*
98 * Identify the CPU type and fix up code sections 99 * Identify the CPU type and fix up code sections
@@ -195,18 +196,22 @@ EXPORT_SYMBOL(nvram_sync);
195 196
196#endif /* CONFIG_NVRAM */ 197#endif /* CONFIG_NVRAM */
197 198
198static struct cpu cpu_devices[NR_CPUS]; 199static DEFINE_PER_CPU(struct cpu, cpu_devices);
199 200
200int __init ppc_init(void) 201int __init ppc_init(void)
201{ 202{
202 int i; 203 int cpu;
203 204
204 /* clear the progress line */ 205 /* clear the progress line */
205 if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff); 206 if (ppc_md.progress)
207 ppc_md.progress(" ", 0xffff);
206 208
207 /* register CPU devices */ 209 /* register CPU devices */
208 for_each_possible_cpu(i) 210 for_each_possible_cpu(cpu) {
209 register_cpu(&cpu_devices[i], i); 211 struct cpu *c = &per_cpu(cpu_devices, cpu);
212 c->hotpluggable = 1;
213 register_cpu(c, cpu);
214 }
210 215
211 /* call platform init */ 216 /* call platform init */
212 if (ppc_md.init != NULL) { 217 if (ppc_md.init != NULL) {
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 3733de30e84d..22083ce3cc30 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -20,7 +20,6 @@
20#include <linux/reboot.h> 20#include <linux/reboot.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/initrd.h> 22#include <linux/initrd.h>
23#include <linux/ide.h>
24#include <linux/seq_file.h> 23#include <linux/seq_file.h>
25#include <linux/ioport.h> 24#include <linux/ioport.h>
26#include <linux/console.h> 25#include <linux/console.h>
@@ -110,7 +109,7 @@ static void check_smt_enabled(void)
110 dn = of_find_node_by_path("/options"); 109 dn = of_find_node_by_path("/options");
111 110
112 if (dn) { 111 if (dn) {
113 smt_option = get_property(dn, "ibm,smt-enabled", NULL); 112 smt_option = of_get_property(dn, "ibm,smt-enabled", NULL);
114 113
115 if (smt_option) { 114 if (smt_option) {
116 if (!strcmp(smt_option, "on")) 115 if (!strcmp(smt_option, "on"))
@@ -305,10 +304,10 @@ static void __init initialize_cache_info(void)
305 304
306 size = 0; 305 size = 0;
307 lsize = cur_cpu_spec->dcache_bsize; 306 lsize = cur_cpu_spec->dcache_bsize;
308 sizep = get_property(np, "d-cache-size", NULL); 307 sizep = of_get_property(np, "d-cache-size", NULL);
309 if (sizep != NULL) 308 if (sizep != NULL)
310 size = *sizep; 309 size = *sizep;
311 lsizep = get_property(np, dc, NULL); 310 lsizep = of_get_property(np, dc, NULL);
312 if (lsizep != NULL) 311 if (lsizep != NULL)
313 lsize = *lsizep; 312 lsize = *lsizep;
314 if (sizep == 0 || lsizep == 0) 313 if (sizep == 0 || lsizep == 0)
@@ -322,10 +321,10 @@ static void __init initialize_cache_info(void)
322 321
323 size = 0; 322 size = 0;
324 lsize = cur_cpu_spec->icache_bsize; 323 lsize = cur_cpu_spec->icache_bsize;
325 sizep = get_property(np, "i-cache-size", NULL); 324 sizep = of_get_property(np, "i-cache-size", NULL);
326 if (sizep != NULL) 325 if (sizep != NULL)
327 size = *sizep; 326 size = *sizep;
328 lsizep = get_property(np, ic, NULL); 327 lsizep = of_get_property(np, ic, NULL);
329 if (lsizep != NULL) 328 if (lsizep != NULL)
330 lsize = *lsizep; 329 lsize = *lsizep;
331 if (sizep == 0 || lsizep == 0) 330 if (sizep == 0 || lsizep == 0)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 924d692bc8f9..d8e503b2e1af 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -428,10 +428,6 @@ void generic_mach_cpu_die(void)
428 smp_wmb(); 428 smp_wmb();
429 while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE) 429 while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
430 cpu_relax(); 430 cpu_relax();
431
432#ifdef CONFIG_PPC64
433 flush_tlb_pending();
434#endif
435 cpu_set(cpu, cpu_online_map); 431 cpu_set(cpu, cpu_online_map);
436 local_irq_enable(); 432 local_irq_enable();
437} 433}
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 673e8d9df7f5..047246ad4f65 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -53,10 +53,6 @@
53#include <asm/ppc-pci.h> 53#include <asm/ppc-pci.h>
54#include <asm/syscalls.h> 54#include <asm/syscalls.h>
55 55
56/* readdir & getdents */
57#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
58#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
59
60struct old_linux_dirent32 { 56struct old_linux_dirent32 {
61 u32 d_ino; 57 u32 d_ino;
62 u32 d_offset; 58 u32 d_offset;
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index d57818aea081..933e214c33e8 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -66,16 +66,17 @@ static int __init smt_setup(void)
66 if (!cpu_has_feature(CPU_FTR_SMT)) 66 if (!cpu_has_feature(CPU_FTR_SMT))
67 return -ENODEV; 67 return -ENODEV;
68 68
69 options = find_path_device("/options"); 69 options = of_find_node_by_path("/options");
70 if (!options) 70 if (!options)
71 return -ENODEV; 71 return -ENODEV;
72 72
73 val = get_property(options, "ibm,smt-snooze-delay", NULL); 73 val = of_get_property(options, "ibm,smt-snooze-delay", NULL);
74 if (!smt_snooze_cmdline && val) { 74 if (!smt_snooze_cmdline && val) {
75 for_each_possible_cpu(cpu) 75 for_each_possible_cpu(cpu)
76 per_cpu(smt_snooze_delay, cpu) = *val; 76 per_cpu(smt_snooze_delay, cpu) = *val;
77 } 77 }
78 78
79 of_node_put(options);
79 return 0; 80 return 0;
80} 81}
81__initcall(smt_setup); 82__initcall(smt_setup);
@@ -189,12 +190,12 @@ SYSFS_PMCSETUP(purr, SPRN_PURR);
189SYSFS_PMCSETUP(spurr, SPRN_SPURR); 190SYSFS_PMCSETUP(spurr, SPRN_SPURR);
190SYSFS_PMCSETUP(dscr, SPRN_DSCR); 191SYSFS_PMCSETUP(dscr, SPRN_DSCR);
191 192
192SYSFS_PMCSETUP(pa6t_pmc0, PA6T_SPRN_PMC0); 193SYSFS_PMCSETUP(pa6t_pmc0, SPRN_PA6T_PMC0);
193SYSFS_PMCSETUP(pa6t_pmc1, PA6T_SPRN_PMC1); 194SYSFS_PMCSETUP(pa6t_pmc1, SPRN_PA6T_PMC1);
194SYSFS_PMCSETUP(pa6t_pmc2, PA6T_SPRN_PMC2); 195SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2);
195SYSFS_PMCSETUP(pa6t_pmc3, PA6T_SPRN_PMC3); 196SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
196SYSFS_PMCSETUP(pa6t_pmc4, PA6T_SPRN_PMC4); 197SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
197SYSFS_PMCSETUP(pa6t_pmc5, PA6T_SPRN_PMC5); 198SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
198 199
199 200
200static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 201static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index f6f0c6b07c4c..7cedef8f5f70 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -834,7 +834,7 @@ static int __init get_freq(char *name, int cells, unsigned long *val)
834 cpu = of_find_node_by_type(NULL, "cpu"); 834 cpu = of_find_node_by_type(NULL, "cpu");
835 835
836 if (cpu) { 836 if (cpu) {
837 fp = get_property(cpu, name, NULL); 837 fp = of_get_property(cpu, name, NULL);
838 if (fp) { 838 if (fp) {
839 found = 1; 839 found = 1;
840 *val = of_read_ulong(fp, cells); 840 *val = of_read_ulong(fp, cells);
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 17724fb2067f..f7862224fe85 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -90,21 +90,11 @@ EXPORT_SYMBOL(unregister_die_notifier);
90 * Trap & Exception support 90 * Trap & Exception support
91 */ 91 */
92 92
93static DEFINE_SPINLOCK(die_lock);
94
95int die(const char *str, struct pt_regs *regs, long err)
96{
97 static int die_counter;
98
99 if (debugger(regs))
100 return 1;
101
102 console_verbose();
103 spin_lock_irq(&die_lock);
104 bust_spinlocks(1);
105#ifdef CONFIG_PMAC_BACKLIGHT 93#ifdef CONFIG_PMAC_BACKLIGHT
94static void pmac_backlight_unblank(void)
95{
106 mutex_lock(&pmac_backlight_mutex); 96 mutex_lock(&pmac_backlight_mutex);
107 if (machine_is(powermac) && pmac_backlight) { 97 if (pmac_backlight) {
108 struct backlight_properties *props; 98 struct backlight_properties *props;
109 99
110 props = &pmac_backlight->props; 100 props = &pmac_backlight->props;
@@ -113,26 +103,67 @@ int die(const char *str, struct pt_regs *regs, long err)
113 backlight_update_status(pmac_backlight); 103 backlight_update_status(pmac_backlight);
114 } 104 }
115 mutex_unlock(&pmac_backlight_mutex); 105 mutex_unlock(&pmac_backlight_mutex);
106}
107#else
108static inline void pmac_backlight_unblank(void) { }
116#endif 109#endif
117 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); 110
111int die(const char *str, struct pt_regs *regs, long err)
112{
113 static struct {
114 spinlock_t lock;
115 u32 lock_owner;
116 int lock_owner_depth;
117 } die = {
118 .lock = __SPIN_LOCK_UNLOCKED(die.lock),
119 .lock_owner = -1,
120 .lock_owner_depth = 0
121 };
122 static int die_counter;
123 unsigned long flags;
124
125 if (debugger(regs))
126 return 1;
127
128 oops_enter();
129
130 if (die.lock_owner != raw_smp_processor_id()) {
131 console_verbose();
132 spin_lock_irqsave(&die.lock, flags);
133 die.lock_owner = smp_processor_id();
134 die.lock_owner_depth = 0;
135 bust_spinlocks(1);
136 if (machine_is(powermac))
137 pmac_backlight_unblank();
138 } else {
139 local_save_flags(flags);
140 }
141
142 if (++die.lock_owner_depth < 3) {
143 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
118#ifdef CONFIG_PREEMPT 144#ifdef CONFIG_PREEMPT
119 printk("PREEMPT "); 145 printk("PREEMPT ");
120#endif 146#endif
121#ifdef CONFIG_SMP 147#ifdef CONFIG_SMP
122 printk("SMP NR_CPUS=%d ", NR_CPUS); 148 printk("SMP NR_CPUS=%d ", NR_CPUS);
123#endif 149#endif
124#ifdef CONFIG_DEBUG_PAGEALLOC 150#ifdef CONFIG_DEBUG_PAGEALLOC
125 printk("DEBUG_PAGEALLOC "); 151 printk("DEBUG_PAGEALLOC ");
126#endif 152#endif
127#ifdef CONFIG_NUMA 153#ifdef CONFIG_NUMA
128 printk("NUMA "); 154 printk("NUMA ");
129#endif 155#endif
130 printk("%s\n", ppc_md.name ? "" : ppc_md.name); 156 printk("%s\n", ppc_md.name ? ppc_md.name : "");
157
158 print_modules();
159 show_regs(regs);
160 } else {
161 printk("Recursive die() failure, output suppressed\n");
162 }
131 163
132 print_modules();
133 show_regs(regs);
134 bust_spinlocks(0); 164 bust_spinlocks(0);
135 spin_unlock_irq(&die_lock); 165 die.lock_owner = -1;
166 spin_unlock_irqrestore(&die.lock, flags);
136 167
137 if (kexec_should_crash(current) || 168 if (kexec_should_crash(current) ||
138 kexec_sr_activated(smp_processor_id())) 169 kexec_sr_activated(smp_processor_id()))
@@ -145,6 +176,7 @@ int die(const char *str, struct pt_regs *regs, long err)
145 if (panic_on_oops) 176 if (panic_on_oops)
146 panic("Fatal exception"); 177 panic("Fatal exception");
147 178
179 oops_exit();
148 do_exit(err); 180 do_exit(err);
149 181
150 return 0; 182 return 0;
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 2968ffeafdb6..9eaefac5053f 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -81,7 +81,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
81 struct iommu_table *tbl; 81 struct iommu_table *tbl;
82 unsigned long offset, size; 82 unsigned long offset, size;
83 83
84 dma_window = get_property(dev->dev.archdata.of_node, 84 dma_window = of_get_property(dev->dev.archdata.of_node,
85 "ibm,my-dma-window", NULL); 85 "ibm,my-dma-window", NULL);
86 if (!dma_window) 86 if (!dma_window)
87 return NULL; 87 return NULL;
@@ -226,7 +226,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
226 return NULL; 226 return NULL;
227 } 227 }
228 228
229 unit_address = get_property(of_node, "reg", NULL); 229 unit_address = of_get_property(of_node, "reg", NULL);
230 if (unit_address == NULL) { 230 if (unit_address == NULL) {
231 printk(KERN_WARNING "%s: node %s missing 'reg'\n", 231 printk(KERN_WARNING "%s: node %s missing 'reg'\n",
232 __FUNCTION__, 232 __FUNCTION__,
@@ -246,7 +246,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
246 viodev->type = of_node->type; 246 viodev->type = of_node->type;
247 viodev->unit_address = *unit_address; 247 viodev->unit_address = *unit_address;
248 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 248 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
249 unit_address = get_property(of_node, 249 unit_address = of_get_property(of_node,
250 "linux,unit_address", NULL); 250 "linux,unit_address", NULL);
251 if (unit_address != NULL) 251 if (unit_address != NULL)
252 viodev->unit_address = *unit_address; 252 viodev->unit_address = *unit_address;
@@ -308,7 +308,7 @@ static int __init vio_bus_init(void)
308 return err; 308 return err;
309 } 309 }
310 310
311 node_vroot = find_devices("vdevice"); 311 node_vroot = of_find_node_by_name(NULL, "vdevice");
312 if (node_vroot) { 312 if (node_vroot) {
313 struct device_node *of_node; 313 struct device_node *of_node;
314 314
@@ -322,6 +322,7 @@ static int __init vio_bus_init(void)
322 __FUNCTION__, of_node); 322 __FUNCTION__, of_node);
323 vio_register_device_node(of_node); 323 vio_register_device_node(of_node);
324 } 324 }
325 of_node_put(node_vroot);
325 } 326 }
326 327
327 return 0; 328 return 0;
@@ -377,7 +378,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
377 dn = dev->archdata.of_node; 378 dn = dev->archdata.of_node;
378 if (!dn) 379 if (!dn)
379 return -ENODEV; 380 return -ENODEV;
380 cp = get_property(dn, "compatible", &length); 381 cp = of_get_property(dn, "compatible", &length);
381 if (!cp) 382 if (!cp)
382 return -ENODEV; 383 return -ENODEV;
383 384
@@ -406,12 +407,12 @@ struct bus_type vio_bus_type = {
406 * @which: The property/attribute to be extracted. 407 * @which: The property/attribute to be extracted.
407 * @length: Pointer to length of returned data size (unused if NULL). 408 * @length: Pointer to length of returned data size (unused if NULL).
408 * 409 *
409 * Calls prom.c's get_property() to return the value of the 410 * Calls prom.c's of_get_property() to return the value of the
410 * attribute specified by @which 411 * attribute specified by @which
411*/ 412*/
412const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length) 413const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length)
413{ 414{
414 return get_property(vdev->dev.archdata.of_node, which, length); 415 return of_get_property(vdev->dev.archdata.of_node, which, length);
415} 416}
416EXPORT_SYMBOL(vio_get_attribute); 417EXPORT_SYMBOL(vio_get_attribute);
417 418
@@ -443,7 +444,7 @@ struct vio_dev *vio_find_node(struct device_node *vnode)
443 char kobj_name[BUS_ID_SIZE]; 444 char kobj_name[BUS_ID_SIZE];
444 445
445 /* construct the kobject name from the device node */ 446 /* construct the kobject name from the device node */
446 unit_address = get_property(vnode, "reg", NULL); 447 unit_address = of_get_property(vnode, "reg", NULL);
447 if (!unit_address) 448 if (!unit_address)
448 return NULL; 449 return NULL;
449 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); 450 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index a6b54cb97c49..25ec5378afa4 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -24,7 +24,7 @@ _GLOBAL(__copy_tofrom_user)
24 dcbt 0,r4 24 dcbt 0,r4
25 beq .Lcopy_page_4K 25 beq .Lcopy_page_4K
26 andi. r6,r6,7 26 andi. r6,r6,7
27 mtcrf 0x01,r5 27 PPC_MTOCRF 0x01,r5
28 blt cr1,.Lshort_copy 28 blt cr1,.Lshort_copy
29 bne .Ldst_unaligned 29 bne .Ldst_unaligned
30.Ldst_aligned: 30.Ldst_aligned:
@@ -135,7 +135,7 @@ _GLOBAL(__copy_tofrom_user)
135 b .Ldo_tail 135 b .Ldo_tail
136 136
137.Ldst_unaligned: 137.Ldst_unaligned:
138 mtcrf 0x01,r6 /* put #bytes to 8B bdry into cr7 */ 138 PPC_MTOCRF 0x01,r6 /* put #bytes to 8B bdry into cr7 */
139 subf r5,r6,r5 139 subf r5,r6,r5
140 li r7,0 140 li r7,0
141 cmpldi r1,r5,16 141 cmpldi r1,r5,16
@@ -150,7 +150,7 @@ _GLOBAL(__copy_tofrom_user)
1502: bf cr7*4+1,3f 1502: bf cr7*4+1,3f
15137: lwzx r0,r7,r4 15137: lwzx r0,r7,r4
15283: stwx r0,r7,r3 15283: stwx r0,r7,r3
1533: mtcrf 0x01,r5 1533: PPC_MTOCRF 0x01,r5
154 add r4,r6,r4 154 add r4,r6,r4
155 add r3,r6,r3 155 add r3,r6,r3
156 b .Ldst_aligned 156 b .Ldst_aligned
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index 80b482ca30df..79d0fa3a470d 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -43,9 +43,11 @@ void __spin_yield(raw_spinlock_t *lock)
43 if (firmware_has_feature(FW_FEATURE_ISERIES)) 43 if (firmware_has_feature(FW_FEATURE_ISERIES))
44 HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 44 HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
45 ((u64)holder_cpu << 32) | yield_count); 45 ((u64)holder_cpu << 32) | yield_count);
46#ifdef CONFIG_PPC_SPLPAR
46 else 47 else
47 plpar_hcall_norets(H_CONFER, 48 plpar_hcall_norets(H_CONFER,
48 get_hard_smp_processor_id(holder_cpu), yield_count); 49 get_hard_smp_processor_id(holder_cpu), yield_count);
50#endif
49} 51}
50 52
51/* 53/*
@@ -72,9 +74,11 @@ void __rw_yield(raw_rwlock_t *rw)
72 if (firmware_has_feature(FW_FEATURE_ISERIES)) 74 if (firmware_has_feature(FW_FEATURE_ISERIES))
73 HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 75 HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
74 ((u64)holder_cpu << 32) | yield_count); 76 ((u64)holder_cpu << 32) | yield_count);
77#ifdef CONFIG_PPC_SPLPAR
75 else 78 else
76 plpar_hcall_norets(H_CONFER, 79 plpar_hcall_norets(H_CONFER,
77 get_hard_smp_processor_id(holder_cpu), yield_count); 80 get_hard_smp_processor_id(holder_cpu), yield_count);
81#endif
78} 82}
79#endif 83#endif
80 84
diff --git a/arch/powerpc/lib/mem_64.S b/arch/powerpc/lib/mem_64.S
index 68df20283ff5..11ce045e21fd 100644
--- a/arch/powerpc/lib/mem_64.S
+++ b/arch/powerpc/lib/mem_64.S
@@ -19,7 +19,7 @@ _GLOBAL(memset)
19 rlwimi r4,r4,16,0,15 19 rlwimi r4,r4,16,0,15
20 cmplw cr1,r5,r0 /* do we get that far? */ 20 cmplw cr1,r5,r0 /* do we get that far? */
21 rldimi r4,r4,32,0 21 rldimi r4,r4,32,0
22 mtcrf 1,r0 22 PPC_MTOCRF 1,r0
23 mr r6,r3 23 mr r6,r3
24 blt cr1,8f 24 blt cr1,8f
25 beq+ 3f /* if already 8-byte aligned */ 25 beq+ 3f /* if already 8-byte aligned */
@@ -49,7 +49,7 @@ _GLOBAL(memset)
49 bdnz 4b 49 bdnz 4b
505: srwi. r0,r5,3 505: srwi. r0,r5,3
51 clrlwi r5,r5,29 51 clrlwi r5,r5,29
52 mtcrf 1,r0 52 PPC_MTOCRF 1,r0
53 beq 8f 53 beq 8f
54 bf 29,6f 54 bf 29,6f
55 std r4,0(r6) 55 std r4,0(r6)
@@ -65,7 +65,7 @@ _GLOBAL(memset)
65 std r4,0(r6) 65 std r4,0(r6)
66 addi r6,r6,8 66 addi r6,r6,8
678: cmpwi r5,0 678: cmpwi r5,0
68 mtcrf 1,r5 68 PPC_MTOCRF 1,r5
69 beqlr+ 69 beqlr+
70 bf 29,9f 70 bf 29,9f
71 stw r4,0(r6) 71 stw r4,0(r6)
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index 7173ba98f427..3f131129d1c1 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -12,7 +12,7 @@
12 .align 7 12 .align 7
13_GLOBAL(memcpy) 13_GLOBAL(memcpy)
14 std r3,48(r1) /* save destination pointer for return value */ 14 std r3,48(r1) /* save destination pointer for return value */
15 mtcrf 0x01,r5 15 PPC_MTOCRF 0x01,r5
16 cmpldi cr1,r5,16 16 cmpldi cr1,r5,16
17 neg r6,r3 # LS 3 bits = # bytes to 8-byte dest bdry 17 neg r6,r3 # LS 3 bits = # bytes to 8-byte dest bdry
18 andi. r6,r6,7 18 andi. r6,r6,7
@@ -128,7 +128,7 @@ _GLOBAL(memcpy)
128 b .Ldo_tail 128 b .Ldo_tail
129 129
130.Ldst_unaligned: 130.Ldst_unaligned:
131 mtcrf 0x01,r6 # put #bytes to 8B bdry into cr7 131 PPC_MTOCRF 0x01,r6 # put #bytes to 8B bdry into cr7
132 subf r5,r6,r5 132 subf r5,r6,r5
133 li r7,0 133 li r7,0
134 cmpldi r1,r5,16 134 cmpldi r1,r5,16
@@ -143,7 +143,7 @@ _GLOBAL(memcpy)
1432: bf cr7*4+1,3f 1432: bf cr7*4+1,3f
144 lwzx r0,r7,r4 144 lwzx r0,r7,r4
145 stwx r0,r7,r3 145 stwx r0,r7,r3
1463: mtcrf 0x01,r5 1463: PPC_MTOCRF 0x01,r5
147 add r4,r6,r4 147 add r4,r6,r4
148 add r3,r6,r3 148 add r3,r6,r3
149 b .Ldst_aligned 149 b .Ldst_aligned
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 7e8ded051b5b..4aae0c387645 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -54,7 +54,7 @@ static int __kprobes branch_taken(unsigned int instr, struct pt_regs *regs)
54 */ 54 */
55int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) 55int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
56{ 56{
57 unsigned int opcode, rd; 57 unsigned int opcode, rs, rb, rd, spr;
58 unsigned long int imm; 58 unsigned long int imm;
59 59
60 opcode = instr >> 26; 60 opcode = instr >> 26;
@@ -152,6 +152,49 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
152 regs->nip &= 0xffffffffUL; 152 regs->nip &= 0xffffffffUL;
153 return 1; 153 return 1;
154#endif 154#endif
155 case 0x26: /* mfcr */
156 regs->gpr[rd] = regs->ccr;
157 regs->gpr[rd] &= 0xffffffffUL;
158 goto mtspr_out;
159 case 0x2a6: /* mfspr */
160 spr = (instr >> 11) & 0x3ff;
161 switch (spr) {
162 case 0x20: /* mfxer */
163 regs->gpr[rd] = regs->xer;
164 regs->gpr[rd] &= 0xffffffffUL;
165 goto mtspr_out;
166 case 0x100: /* mflr */
167 regs->gpr[rd] = regs->link;
168 goto mtspr_out;
169 case 0x120: /* mfctr */
170 regs->gpr[rd] = regs->ctr;
171 goto mtspr_out;
172 }
173 break;
174 case 0x378: /* orx */
175 rs = (instr >> 21) & 0x1f;
176 rb = (instr >> 11) & 0x1f;
177 if (rs == rb) { /* mr */
178 rd = (instr >> 16) & 0x1f;
179 regs->gpr[rd] = regs->gpr[rs];
180 goto mtspr_out;
181 }
182 break;
183 case 0x3a6: /* mtspr */
184 spr = (instr >> 11) & 0x3ff;
185 switch (spr) {
186 case 0x20: /* mtxer */
187 regs->xer = (regs->gpr[rd] & 0xffffffffUL);
188 goto mtspr_out;
189 case 0x100: /* mtlr */
190 regs->link = regs->gpr[rd];
191 goto mtspr_out;
192 case 0x120: /* mtctr */
193 regs->ctr = regs->gpr[rd];
194mtspr_out:
195 regs->nip += 4;
196 return 1;
197 }
155 } 198 }
156 } 199 }
157 return 0; 200 return 0;
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index bd68df5fa78a..ddceefc06ecc 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -283,6 +283,7 @@ Hash_msk = (((1 << Hash_bits) - 1) * 64)
283#define PTEG_SIZE 64 283#define PTEG_SIZE 64
284#define LG_PTEG_SIZE 6 284#define LG_PTEG_SIZE 6
285#define LDPTEu lwzu 285#define LDPTEu lwzu
286#define LDPTE lwz
286#define STPTE stw 287#define STPTE stw
287#define CMPPTE cmpw 288#define CMPPTE cmpw
288#define PTE_H 0x40 289#define PTE_H 0x40
@@ -389,13 +390,30 @@ _GLOBAL(hash_page_patch_C)
389 * and we know there is a definite (although small) speed 390 * and we know there is a definite (although small) speed
390 * advantage to putting the PTE in the primary PTEG, we always 391 * advantage to putting the PTE in the primary PTEG, we always
391 * put the PTE in the primary PTEG. 392 * put the PTE in the primary PTEG.
393 *
394 * In addition, we skip any slot that is mapping kernel text in
395 * order to avoid a deadlock when not using BAT mappings if
396 * trying to hash in the kernel hash code itself after it has
397 * already taken the hash table lock. This works in conjunction
398 * with pre-faulting of the kernel text.
399 *
400 * If the hash table bucket is full of kernel text entries, we'll
401 * lockup here but that shouldn't happen
392 */ 402 */
393 addis r4,r7,next_slot@ha 403
4041: addis r4,r7,next_slot@ha /* get next evict slot */
394 lwz r6,next_slot@l(r4) 405 lwz r6,next_slot@l(r4)
395 addi r6,r6,PTE_SIZE 406 addi r6,r6,PTE_SIZE /* search for candidate */
396 andi. r6,r6,7*PTE_SIZE 407 andi. r6,r6,7*PTE_SIZE
397 stw r6,next_slot@l(r4) 408 stw r6,next_slot@l(r4)
398 add r4,r3,r6 409 add r4,r3,r6
410 LDPTE r0,PTE_SIZE/2(r4) /* get PTE second word */
411 clrrwi r0,r0,12
412 lis r6,etext@h
413 ori r6,r6,etext@l /* get etext */
414 tophys(r6,r6)
415 cmpl cr0,r0,r6 /* compare and try again */
416 blt 1b
399 417
400#ifndef CONFIG_SMP 418#ifndef CONFIG_SMP
401 /* Store PTE in PTEG */ 419 /* Store PTE in PTEG */
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index 9bc0a9c2b9bc..e64ce3eec36e 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -445,9 +445,12 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
445 445
446htab_insert_pte: 446htab_insert_pte:
447 /* real page number in r5, PTE RPN value + index */ 447 /* real page number in r5, PTE RPN value + index */
448 rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT 448 andis. r0,r31,_PAGE_4K_PFN@h
449 srdi r5,r31,PTE_RPN_SHIFT
450 bne- htab_special_pfn
449 sldi r5,r5,PAGE_SHIFT-HW_PAGE_SHIFT 451 sldi r5,r5,PAGE_SHIFT-HW_PAGE_SHIFT
450 add r5,r5,r25 452 add r5,r5,r25
453htab_special_pfn:
451 sldi r5,r5,HW_PAGE_SHIFT 454 sldi r5,r5,HW_PAGE_SHIFT
452 455
453 /* Calculate primary group hash */ 456 /* Calculate primary group hash */
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 6f1016acdbf6..79aedaf36f2b 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -505,7 +505,7 @@ static inline int tlb_batching_enabled(void)
505 int enabled = 1; 505 int enabled = 1;
506 506
507 if (root) { 507 if (root) {
508 const char *model = get_property(root, "model", NULL); 508 const char *model = of_get_property(root, "model", NULL);
509 if (model && !strcmp(model, "IBM,9076-N81")) 509 if (model && !strcmp(model, "IBM,9076-N81"))
510 enabled = 0; 510 enabled = 0;
511 of_node_put(root); 511 of_node_put(root);
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 3c7fe2c65b5a..49618461defb 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -100,6 +100,11 @@ unsigned int HPAGE_SHIFT;
100#ifdef CONFIG_PPC_64K_PAGES 100#ifdef CONFIG_PPC_64K_PAGES
101int mmu_ci_restrictions; 101int mmu_ci_restrictions;
102#endif 102#endif
103#ifdef CONFIG_DEBUG_PAGEALLOC
104static u8 *linear_map_hash_slots;
105static unsigned long linear_map_hash_count;
106static spinlock_t linear_map_hash_lock;
107#endif /* CONFIG_DEBUG_PAGEALLOC */
103 108
104/* There are definitions of page sizes arrays to be used when none 109/* There are definitions of page sizes arrays to be used when none
105 * is provided by the firmware. 110 * is provided by the firmware.
@@ -152,11 +157,10 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
152 157
153 for (vaddr = vstart, paddr = pstart; vaddr < vend; 158 for (vaddr = vstart, paddr = pstart; vaddr < vend;
154 vaddr += step, paddr += step) { 159 vaddr += step, paddr += step) {
155 unsigned long vpn, hash, hpteg; 160 unsigned long hash, hpteg;
156 unsigned long vsid = get_kernel_vsid(vaddr); 161 unsigned long vsid = get_kernel_vsid(vaddr);
157 unsigned long va = (vsid << 28) | (vaddr & 0x0fffffff); 162 unsigned long va = (vsid << 28) | (vaddr & 0x0fffffff);
158 163
159 vpn = va >> shift;
160 tmp_mode = mode; 164 tmp_mode = mode;
161 165
162 /* Make non-kernel text non-executable */ 166 /* Make non-kernel text non-executable */
@@ -174,6 +178,10 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
174 178
175 if (ret < 0) 179 if (ret < 0)
176 break; 180 break;
181#ifdef CONFIG_DEBUG_PAGEALLOC
182 if ((paddr >> PAGE_SHIFT) < linear_map_hash_count)
183 linear_map_hash_slots[paddr >> PAGE_SHIFT] = ret | 0x80;
184#endif /* CONFIG_DEBUG_PAGEALLOC */
177 } 185 }
178 return ret < 0 ? ret : 0; 186 return ret < 0 ? ret : 0;
179} 187}
@@ -281,6 +289,7 @@ static void __init htab_init_page_sizes(void)
281 memcpy(mmu_psize_defs, mmu_psize_defaults_gp, 289 memcpy(mmu_psize_defs, mmu_psize_defaults_gp,
282 sizeof(mmu_psize_defaults_gp)); 290 sizeof(mmu_psize_defaults_gp));
283 found: 291 found:
292#ifndef CONFIG_DEBUG_PAGEALLOC
284 /* 293 /*
285 * Pick a size for the linear mapping. Currently, we only support 294 * Pick a size for the linear mapping. Currently, we only support
286 * 16M, 1M and 4K which is the default 295 * 16M, 1M and 4K which is the default
@@ -289,6 +298,7 @@ static void __init htab_init_page_sizes(void)
289 mmu_linear_psize = MMU_PAGE_16M; 298 mmu_linear_psize = MMU_PAGE_16M;
290 else if (mmu_psize_defs[MMU_PAGE_1M].shift) 299 else if (mmu_psize_defs[MMU_PAGE_1M].shift)
291 mmu_linear_psize = MMU_PAGE_1M; 300 mmu_linear_psize = MMU_PAGE_1M;
301#endif /* CONFIG_DEBUG_PAGEALLOC */
292 302
293#ifdef CONFIG_PPC_64K_PAGES 303#ifdef CONFIG_PPC_64K_PAGES
294 /* 304 /*
@@ -303,12 +313,14 @@ static void __init htab_init_page_sizes(void)
303 if (mmu_psize_defs[MMU_PAGE_64K].shift) { 313 if (mmu_psize_defs[MMU_PAGE_64K].shift) {
304 mmu_virtual_psize = MMU_PAGE_64K; 314 mmu_virtual_psize = MMU_PAGE_64K;
305 mmu_vmalloc_psize = MMU_PAGE_64K; 315 mmu_vmalloc_psize = MMU_PAGE_64K;
316 if (mmu_linear_psize == MMU_PAGE_4K)
317 mmu_linear_psize = MMU_PAGE_64K;
306 if (cpu_has_feature(CPU_FTR_CI_LARGE_PAGE)) 318 if (cpu_has_feature(CPU_FTR_CI_LARGE_PAGE))
307 mmu_io_psize = MMU_PAGE_64K; 319 mmu_io_psize = MMU_PAGE_64K;
308 else 320 else
309 mmu_ci_restrictions = 1; 321 mmu_ci_restrictions = 1;
310 } 322 }
311#endif 323#endif /* CONFIG_PPC_64K_PAGES */
312 324
313 printk(KERN_DEBUG "Page orders: linear mapping = %d, " 325 printk(KERN_DEBUG "Page orders: linear mapping = %d, "
314 "virtual = %d, io = %d\n", 326 "virtual = %d, io = %d\n",
@@ -476,6 +488,13 @@ void __init htab_initialize(void)
476 488
477 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX; 489 mode_rw = _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
478 490
491#ifdef CONFIG_DEBUG_PAGEALLOC
492 linear_map_hash_count = lmb_end_of_DRAM() >> PAGE_SHIFT;
493 linear_map_hash_slots = __va(lmb_alloc_base(linear_map_hash_count,
494 1, lmb.rmo_size));
495 memset(linear_map_hash_slots, 0, linear_map_hash_count);
496#endif /* CONFIG_DEBUG_PAGEALLOC */
497
479 /* On U3 based machines, we need to reserve the DART area and 498 /* On U3 based machines, we need to reserve the DART area and
480 * _NOT_ map it to avoid cache paradoxes as it's remapped non 499 * _NOT_ map it to avoid cache paradoxes as it's remapped non
481 * cacheable later on 500 * cacheable later on
@@ -573,6 +592,27 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap)
573 return pp; 592 return pp;
574} 593}
575 594
595/*
596 * Demote a segment to using 4k pages.
597 * For now this makes the whole process use 4k pages.
598 */
599void demote_segment_4k(struct mm_struct *mm, unsigned long addr)
600{
601#ifdef CONFIG_PPC_64K_PAGES
602 if (mm->context.user_psize == MMU_PAGE_4K)
603 return;
604 mm->context.user_psize = MMU_PAGE_4K;
605 mm->context.sllp = SLB_VSID_USER | mmu_psize_defs[MMU_PAGE_4K].sllp;
606 get_paca()->context = mm->context;
607 slb_flush_and_rebolt();
608#ifdef CONFIG_SPE_BASE
609 spu_flush_all_slbs(mm);
610#endif
611#endif
612}
613
614EXPORT_SYMBOL_GPL(demote_segment_4k);
615
576/* Result code is: 616/* Result code is:
577 * 0 - handled 617 * 0 - handled
578 * 1 - normal page fault 618 * 1 - normal page fault
@@ -665,15 +705,19 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
665#ifndef CONFIG_PPC_64K_PAGES 705#ifndef CONFIG_PPC_64K_PAGES
666 rc = __hash_page_4K(ea, access, vsid, ptep, trap, local); 706 rc = __hash_page_4K(ea, access, vsid, ptep, trap, local);
667#else 707#else
708 /* If _PAGE_4K_PFN is set, make sure this is a 4k segment */
709 if (pte_val(*ptep) & _PAGE_4K_PFN) {
710 demote_segment_4k(mm, ea);
711 psize = MMU_PAGE_4K;
712 }
713
668 if (mmu_ci_restrictions) { 714 if (mmu_ci_restrictions) {
669 /* If this PTE is non-cacheable, switch to 4k */ 715 /* If this PTE is non-cacheable, switch to 4k */
670 if (psize == MMU_PAGE_64K && 716 if (psize == MMU_PAGE_64K &&
671 (pte_val(*ptep) & _PAGE_NO_CACHE)) { 717 (pte_val(*ptep) & _PAGE_NO_CACHE)) {
672 if (user_region) { 718 if (user_region) {
719 demote_segment_4k(mm, ea);
673 psize = MMU_PAGE_4K; 720 psize = MMU_PAGE_4K;
674 mm->context.user_psize = MMU_PAGE_4K;
675 mm->context.sllp = SLB_VSID_USER |
676 mmu_psize_defs[MMU_PAGE_4K].sllp;
677 } else if (ea < VMALLOC_END) { 721 } else if (ea < VMALLOC_END) {
678 /* 722 /*
679 * some driver did a non-cacheable mapping 723 * some driver did a non-cacheable mapping
@@ -756,16 +800,8 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
756 if (mmu_ci_restrictions) { 800 if (mmu_ci_restrictions) {
757 /* If this PTE is non-cacheable, switch to 4k */ 801 /* If this PTE is non-cacheable, switch to 4k */
758 if (mm->context.user_psize == MMU_PAGE_64K && 802 if (mm->context.user_psize == MMU_PAGE_64K &&
759 (pte_val(*ptep) & _PAGE_NO_CACHE)) { 803 (pte_val(*ptep) & _PAGE_NO_CACHE))
760 mm->context.user_psize = MMU_PAGE_4K; 804 demote_segment_4k(mm, ea);
761 mm->context.sllp = SLB_VSID_USER |
762 mmu_psize_defs[MMU_PAGE_4K].sllp;
763 get_paca()->context = mm->context;
764 slb_flush_and_rebolt();
765#ifdef CONFIG_SPE_BASE
766 spu_flush_all_slbs(mm);
767#endif
768 }
769 } 805 }
770 if (mm->context.user_psize == MMU_PAGE_64K) 806 if (mm->context.user_psize == MMU_PAGE_64K)
771 __hash_page_64K(ea, access, vsid, ptep, trap, local); 807 __hash_page_64K(ea, access, vsid, ptep, trap, local);
@@ -825,3 +861,62 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address)
825 } 861 }
826 bad_page_fault(regs, address, SIGBUS); 862 bad_page_fault(regs, address, SIGBUS);
827} 863}
864
865#ifdef CONFIG_DEBUG_PAGEALLOC
866static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
867{
868 unsigned long hash, hpteg, vsid = get_kernel_vsid(vaddr);
869 unsigned long va = (vsid << 28) | (vaddr & 0x0fffffff);
870 unsigned long mode = _PAGE_ACCESSED | _PAGE_DIRTY |
871 _PAGE_COHERENT | PP_RWXX | HPTE_R_N;
872 int ret;
873
874 hash = hpt_hash(va, PAGE_SHIFT);
875 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
876
877 ret = ppc_md.hpte_insert(hpteg, va, __pa(vaddr),
878 mode, HPTE_V_BOLTED, mmu_linear_psize);
879 BUG_ON (ret < 0);
880 spin_lock(&linear_map_hash_lock);
881 BUG_ON(linear_map_hash_slots[lmi] & 0x80);
882 linear_map_hash_slots[lmi] = ret | 0x80;
883 spin_unlock(&linear_map_hash_lock);
884}
885
886static void kernel_unmap_linear_page(unsigned long vaddr, unsigned long lmi)
887{
888 unsigned long hash, hidx, slot, vsid = get_kernel_vsid(vaddr);
889 unsigned long va = (vsid << 28) | (vaddr & 0x0fffffff);
890
891 hash = hpt_hash(va, PAGE_SHIFT);
892 spin_lock(&linear_map_hash_lock);
893 BUG_ON(!(linear_map_hash_slots[lmi] & 0x80));
894 hidx = linear_map_hash_slots[lmi] & 0x7f;
895 linear_map_hash_slots[lmi] = 0;
896 spin_unlock(&linear_map_hash_lock);
897 if (hidx & _PTEIDX_SECONDARY)
898 hash = ~hash;
899 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
900 slot += hidx & _PTEIDX_GROUP_IX;
901 ppc_md.hpte_invalidate(slot, va, mmu_linear_psize, 0);
902}
903
904void kernel_map_pages(struct page *page, int numpages, int enable)
905{
906 unsigned long flags, vaddr, lmi;
907 int i;
908
909 local_irq_save(flags);
910 for (i = 0; i < numpages; i++, page++) {
911 vaddr = (unsigned long)page_address(page);
912 lmi = __pa(vaddr) >> PAGE_SHIFT;
913 if (lmi >= linear_map_hash_count)
914 continue;
915 if (enable)
916 kernel_map_linear_page(vaddr, lmi);
917 else
918 kernel_unmap_linear_page(vaddr, lmi);
919 }
920 local_irq_restore(flags);
921}
922#endif /* CONFIG_DEBUG_PAGEALLOC */
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index f6ffaaa7a5bf..8508f973d9cc 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -316,12 +316,11 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
316{ 316{
317 if (pte_present(*ptep)) { 317 if (pte_present(*ptep)) {
318 /* We open-code pte_clear because we need to pass the right 318 /* We open-code pte_clear because we need to pass the right
319 * argument to hpte_update (huge / !huge) 319 * argument to hpte_need_flush (huge / !huge). Might not be
320 * necessary anymore if we make hpte_need_flush() get the
321 * page size from the slices
320 */ 322 */
321 unsigned long old = pte_update(ptep, ~0UL); 323 pte_update(mm, addr & HPAGE_MASK, ptep, ~0UL, 1);
322 if (old & _PAGE_HASHPTE)
323 hpte_update(mm, addr & HPAGE_MASK, ptep, old, 1);
324 flush_tlb_pending();
325 } 324 }
326 *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); 325 *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
327} 326}
@@ -329,12 +328,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
329pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, 328pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
330 pte_t *ptep) 329 pte_t *ptep)
331{ 330{
332 unsigned long old = pte_update(ptep, ~0UL); 331 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 1);
333
334 if (old & _PAGE_HASHPTE)
335 hpte_update(mm, addr & HPAGE_MASK, ptep, old, 1);
336 *ptep = __pte(0);
337
338 return __pte(old); 332 return __pte(old);
339} 333}
340 334
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 0e53ca8f02fb..5fce6ccecb8d 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -115,6 +115,10 @@ void MMU_setup(void)
115 if (strstr(cmd_line, "noltlbs")) { 115 if (strstr(cmd_line, "noltlbs")) {
116 __map_without_ltlbs = 1; 116 __map_without_ltlbs = 1;
117 } 117 }
118#ifdef CONFIG_DEBUG_PAGEALLOC
119 __map_without_bats = 1;
120 __map_without_ltlbs = 1;
121#endif
118} 122}
119 123
120/* 124/*
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 716a2906a24d..e3a1e8dc536a 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -146,6 +146,10 @@ static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base,
146 unsigned long rgnbase = rgn->region[i].base; 146 unsigned long rgnbase = rgn->region[i].base;
147 unsigned long rgnsize = rgn->region[i].size; 147 unsigned long rgnsize = rgn->region[i].size;
148 148
149 if ((rgnbase == base) && (rgnsize == size))
150 /* Already have this region, so we're done */
151 return 0;
152
149 adjacent = lmb_addrs_adjacent(base,size,rgnbase,rgnsize); 153 adjacent = lmb_addrs_adjacent(base,size,rgnbase,rgnsize);
150 if ( adjacent > 0 ) { 154 if ( adjacent > 0 ) {
151 rgn->region[i].base -= size; 155 rgn->region[i].base -= size;
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 52f397c108a7..c4bcd7546424 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -58,9 +58,6 @@ int init_bootmem_done;
58int mem_init_done; 58int mem_init_done;
59unsigned long memory_limit; 59unsigned long memory_limit;
60 60
61extern void hash_preload(struct mm_struct *mm, unsigned long ea,
62 unsigned long access, unsigned long trap);
63
64int page_is_ram(unsigned long pfn) 61int page_is_ram(unsigned long pfn)
65{ 62{
66 unsigned long paddr = (pfn << PAGE_SHIFT); 63 unsigned long paddr = (pfn << PAGE_SHIFT);
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index bea2d21ac6f7..9c4538bb04b0 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -19,9 +19,14 @@
19 * 2 of the License, or (at your option) any later version. 19 * 2 of the License, or (at your option) any later version.
20 * 20 *
21 */ 21 */
22#include <linux/mm.h>
22#include <asm/tlbflush.h> 23#include <asm/tlbflush.h>
23#include <asm/mmu.h> 24#include <asm/mmu.h>
24 25
26extern void hash_preload(struct mm_struct *mm, unsigned long ea,
27 unsigned long access, unsigned long trap);
28
29
25#ifdef CONFIG_PPC32 30#ifdef CONFIG_PPC32
26extern void mapin_ram(void); 31extern void mapin_ram(void);
27extern int map_page(unsigned long va, phys_addr_t pa, int flags); 32extern int map_page(unsigned long va, phys_addr_t pa, int flags);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index e86c37c82cfd..b3a592b25ab3 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -74,7 +74,7 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu)
74 74
75 while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) { 75 while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) {
76 /* Try interrupt server first */ 76 /* Try interrupt server first */
77 interrupt_server = get_property(cpu_node, 77 interrupt_server = of_get_property(cpu_node,
78 "ibm,ppc-interrupt-server#s", &len); 78 "ibm,ppc-interrupt-server#s", &len);
79 79
80 len = len / sizeof(u32); 80 len = len / sizeof(u32);
@@ -85,7 +85,7 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu)
85 return cpu_node; 85 return cpu_node;
86 } 86 }
87 } else { 87 } else {
88 reg = get_property(cpu_node, "reg", &len); 88 reg = of_get_property(cpu_node, "reg", &len);
89 if (reg && (len > 0) && (reg[0] == hw_cpuid)) 89 if (reg && (len > 0) && (reg[0] == hw_cpuid))
90 return cpu_node; 90 return cpu_node;
91 } 91 }
@@ -97,7 +97,7 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu)
97/* must hold reference to node during call */ 97/* must hold reference to node during call */
98static const int *of_get_associativity(struct device_node *dev) 98static const int *of_get_associativity(struct device_node *dev)
99{ 99{
100 return get_property(dev, "ibm,associativity", NULL); 100 return of_get_property(dev, "ibm,associativity", NULL);
101} 101}
102 102
103/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa 103/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa
@@ -179,7 +179,7 @@ static int __init find_min_common_depth(void)
179 * configuration (should be all 0's) and the second is for a normal 179 * configuration (should be all 0's) and the second is for a normal
180 * NUMA configuration. 180 * NUMA configuration.
181 */ 181 */
182 ref_points = get_property(rtas_root, 182 ref_points = of_get_property(rtas_root,
183 "ibm,associativity-reference-points", &len); 183 "ibm,associativity-reference-points", &len);
184 184
185 if ((len >= 1) && ref_points) { 185 if ((len >= 1) && ref_points) {
@@ -201,8 +201,8 @@ static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
201 if (!memory) 201 if (!memory)
202 panic("numa.c: No memory nodes found!"); 202 panic("numa.c: No memory nodes found!");
203 203
204 *n_addr_cells = prom_n_addr_cells(memory); 204 *n_addr_cells = of_n_addr_cells(memory);
205 *n_size_cells = prom_n_size_cells(memory); 205 *n_size_cells = of_n_size_cells(memory);
206 of_node_put(memory); 206 of_node_put(memory);
207} 207}
208 208
@@ -308,9 +308,9 @@ static void __init parse_drconf_memory(struct device_node *memory)
308 int nid, default_nid = 0; 308 int nid, default_nid = 0;
309 unsigned int start, ai, flags; 309 unsigned int start, ai, flags;
310 310
311 lm = get_property(memory, "ibm,lmb-size", &ls); 311 lm = of_get_property(memory, "ibm,lmb-size", &ls);
312 dm = get_property(memory, "ibm,dynamic-memory", &ld); 312 dm = of_get_property(memory, "ibm,dynamic-memory", &ld);
313 aa = get_property(memory, "ibm,associativity-lookup-arrays", &la); 313 aa = of_get_property(memory, "ibm,associativity-lookup-arrays", &la);
314 if (!lm || !dm || !aa || 314 if (!lm || !dm || !aa ||
315 ls < sizeof(unsigned int) || ld < sizeof(unsigned int) || 315 ls < sizeof(unsigned int) || ld < sizeof(unsigned int) ||
316 la < 2 * sizeof(unsigned int)) 316 la < 2 * sizeof(unsigned int))
@@ -404,10 +404,10 @@ static int __init parse_numa_properties(void)
404 const unsigned int *memcell_buf; 404 const unsigned int *memcell_buf;
405 unsigned int len; 405 unsigned int len;
406 406
407 memcell_buf = get_property(memory, 407 memcell_buf = of_get_property(memory,
408 "linux,usable-memory", &len); 408 "linux,usable-memory", &len);
409 if (!memcell_buf || len <= 0) 409 if (!memcell_buf || len <= 0)
410 memcell_buf = get_property(memory, "reg", &len); 410 memcell_buf = of_get_property(memory, "reg", &len);
411 if (!memcell_buf || len <= 0) 411 if (!memcell_buf || len <= 0)
412 continue; 412 continue;
413 413
@@ -725,7 +725,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
725 const unsigned int *memcell_buf; 725 const unsigned int *memcell_buf;
726 unsigned int len; 726 unsigned int len;
727 727
728 memcell_buf = get_property(memory, "reg", &len); 728 memcell_buf = of_get_property(memory, "reg", &len);
729 if (!memcell_buf || len <= 0) 729 if (!memcell_buf || len <= 0)
730 continue; 730 continue;
731 731
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index c284bdac9947..bca560374927 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -183,8 +183,8 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
183 * mem_init() sets high_memory so only do the check after that. 183 * mem_init() sets high_memory so only do the check after that.
184 */ 184 */
185 if (mem_init_done && (p < virt_to_phys(high_memory))) { 185 if (mem_init_done && (p < virt_to_phys(high_memory))) {
186 printk("__ioremap(): phys addr "PHYS_FMT" is RAM lr %p\n", p, 186 printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
187 __builtin_return_address(0)); 187 (unsigned long long)p, __builtin_return_address(0));
188 return NULL; 188 return NULL;
189 } 189 }
190 190
@@ -266,9 +266,12 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
266 pg = pte_alloc_kernel(pd, va); 266 pg = pte_alloc_kernel(pd, va);
267 if (pg != 0) { 267 if (pg != 0) {
268 err = 0; 268 err = 0;
269 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags))); 269 /* The PTE should never be already set nor present in the
270 if (mem_init_done) 270 * hash table
271 flush_HPTE(0, va, pmd_val(*pd)); 271 */
272 BUG_ON(pte_val(*pg) & (_PAGE_PRESENT | _PAGE_HASHPTE));
273 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT,
274 __pgprot(flags)));
272 } 275 }
273 return err; 276 return err;
274} 277}
@@ -279,16 +282,19 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
279void __init mapin_ram(void) 282void __init mapin_ram(void)
280{ 283{
281 unsigned long v, p, s, f; 284 unsigned long v, p, s, f;
285 int ktext;
282 286
283 s = mmu_mapin_ram(); 287 s = mmu_mapin_ram();
284 v = KERNELBASE + s; 288 v = KERNELBASE + s;
285 p = PPC_MEMSTART + s; 289 p = PPC_MEMSTART + s;
286 for (; s < total_lowmem; s += PAGE_SIZE) { 290 for (; s < total_lowmem; s += PAGE_SIZE) {
287 if ((char *) v >= _stext && (char *) v < etext) 291 ktext = ((char *) v >= _stext && (char *) v < etext);
288 f = _PAGE_RAM_TEXT; 292 f = ktext ?_PAGE_RAM_TEXT : _PAGE_RAM;
289 else
290 f = _PAGE_RAM;
291 map_page(v, p, f); 293 map_page(v, p, f);
294#ifdef CONFIG_PPC_STD_MMU_32
295 if (ktext)
296 hash_preload(&init_mm, v, 0, 0x300);
297#endif
292 v += PAGE_SIZE; 298 v += PAGE_SIZE;
293 p += PAGE_SIZE; 299 p += PAGE_SIZE;
294 } 300 }
@@ -445,3 +451,55 @@ exit:
445 return ret; 451 return ret;
446} 452}
447 453
454#ifdef CONFIG_DEBUG_PAGEALLOC
455
456static int __change_page_attr(struct page *page, pgprot_t prot)
457{
458 pte_t *kpte;
459 pmd_t *kpmd;
460 unsigned long address;
461
462 BUG_ON(PageHighMem(page));
463 address = (unsigned long)page_address(page);
464
465 if (v_mapped_by_bats(address) || v_mapped_by_tlbcam(address))
466 return 0;
467 if (!get_pteptr(&init_mm, address, &kpte, &kpmd))
468 return -EINVAL;
469 set_pte_at(&init_mm, address, kpte, mk_pte(page, prot));
470 wmb();
471 flush_HPTE(0, address, pmd_val(*kpmd));
472 pte_unmap(kpte);
473
474 return 0;
475}
476
477/*
478 * Change the page attributes of an page in the linear mapping.
479 *
480 * THIS CONFLICTS WITH BAT MAPPINGS, DEBUG USE ONLY
481 */
482static int change_page_attr(struct page *page, int numpages, pgprot_t prot)
483{
484 int i, err = 0;
485 unsigned long flags;
486
487 local_irq_save(flags);
488 for (i = 0; i < numpages; i++, page++) {
489 err = __change_page_attr(page, prot);
490 if (err)
491 break;
492 }
493 local_irq_restore(flags);
494 return err;
495}
496
497
498void kernel_map_pages(struct page *page, int numpages, int enable)
499{
500 if (PageHighMem(page))
501 return;
502
503 change_page_attr(page, numpages, enable ? PAGE_KERNEL : __pgprot(0));
504}
505#endif /* CONFIG_DEBUG_PAGEALLOC */
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index 7cceb2c44cb9..05066674a7a0 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -85,8 +85,10 @@ unsigned long __init mmu_mapin_ram(void)
85 unsigned long max_size = (256<<20); 85 unsigned long max_size = (256<<20);
86 unsigned long align; 86 unsigned long align;
87 87
88 if (__map_without_bats) 88 if (__map_without_bats) {
89 printk(KERN_DEBUG "RAM mapped without BATs\n");
89 return 0; 90 return 0;
91 }
90 92
91 /* Set up BAT2 and if necessary BAT3 to cover RAM. */ 93 /* Set up BAT2 and if necessary BAT3 to cover RAM. */
92 94
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index b58baa65c4a7..fd8d08c325eb 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -120,17 +120,20 @@ void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf)
120} 120}
121 121
122/* 122/*
123 * Update the MMU hash table to correspond with a change to 123 * A linux PTE was changed and the corresponding hash table entry
124 * a Linux PTE. If wrprot is true, it is permissible to 124 * neesd to be flushed. This function will either perform the flush
125 * change the existing HPTE to read-only rather than removing it 125 * immediately or will batch it up if the current CPU has an active
126 * (if we remove it we should clear the _PTE_HPTEFLAGS bits). 126 * batch on it.
127 *
128 * Must be called from within some kind of spinlock/non-preempt region...
127 */ 129 */
128void hpte_update(struct mm_struct *mm, unsigned long addr, 130void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
129 pte_t *ptep, unsigned long pte, int huge) 131 pte_t *ptep, unsigned long pte, int huge)
130{ 132{
131 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 133 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
132 unsigned long vsid; 134 unsigned long vsid, vaddr;
133 unsigned int psize; 135 unsigned int psize;
136 real_pte_t rpte;
134 int i; 137 int i;
135 138
136 i = batch->index; 139 i = batch->index;
@@ -151,6 +154,26 @@ void hpte_update(struct mm_struct *mm, unsigned long addr,
151 } else 154 } else
152 psize = pte_pagesize_index(pte); 155 psize = pte_pagesize_index(pte);
153 156
157 /* Build full vaddr */
158 if (!is_kernel_addr(addr)) {
159 vsid = get_vsid(mm->context.id, addr);
160 WARN_ON(vsid == 0);
161 } else
162 vsid = get_kernel_vsid(addr);
163 vaddr = (vsid << 28 ) | (addr & 0x0fffffff);
164 rpte = __real_pte(__pte(pte), ptep);
165
166 /*
167 * Check if we have an active batch on this CPU. If not, just
168 * flush now and return. For now, we don global invalidates
169 * in that case, might be worth testing the mm cpu mask though
170 * and decide to use local invalidates instead...
171 */
172 if (!batch->active) {
173 flush_hash_page(vaddr, rpte, psize, 0);
174 return;
175 }
176
154 /* 177 /*
155 * This can happen when we are in the middle of a TLB batch and 178 * This can happen when we are in the middle of a TLB batch and
156 * we encounter memory pressure (eg copy_page_range when it tries 179 * we encounter memory pressure (eg copy_page_range when it tries
@@ -162,47 +185,42 @@ void hpte_update(struct mm_struct *mm, unsigned long addr,
162 * batch 185 * batch
163 */ 186 */
164 if (i != 0 && (mm != batch->mm || batch->psize != psize)) { 187 if (i != 0 && (mm != batch->mm || batch->psize != psize)) {
165 flush_tlb_pending(); 188 __flush_tlb_pending(batch);
166 i = 0; 189 i = 0;
167 } 190 }
168 if (i == 0) { 191 if (i == 0) {
169 batch->mm = mm; 192 batch->mm = mm;
170 batch->psize = psize; 193 batch->psize = psize;
171 } 194 }
172 if (!is_kernel_addr(addr)) { 195 batch->pte[i] = rpte;
173 vsid = get_vsid(mm->context.id, addr); 196 batch->vaddr[i] = vaddr;
174 WARN_ON(vsid == 0);
175 } else
176 vsid = get_kernel_vsid(addr);
177 batch->vaddr[i] = (vsid << 28 ) | (addr & 0x0fffffff);
178 batch->pte[i] = __real_pte(__pte(pte), ptep);
179 batch->index = ++i; 197 batch->index = ++i;
180 if (i >= PPC64_TLB_BATCH_NR) 198 if (i >= PPC64_TLB_BATCH_NR)
181 flush_tlb_pending(); 199 __flush_tlb_pending(batch);
182} 200}
183 201
202/*
203 * This function is called when terminating an mmu batch or when a batch
204 * is full. It will perform the flush of all the entries currently stored
205 * in a batch.
206 *
207 * Must be called from within some kind of spinlock/non-preempt region...
208 */
184void __flush_tlb_pending(struct ppc64_tlb_batch *batch) 209void __flush_tlb_pending(struct ppc64_tlb_batch *batch)
185{ 210{
186 int i;
187 int cpu;
188 cpumask_t tmp; 211 cpumask_t tmp;
189 int local = 0; 212 int i, local = 0;
190 213
191 BUG_ON(in_interrupt());
192
193 cpu = get_cpu();
194 i = batch->index; 214 i = batch->index;
195 tmp = cpumask_of_cpu(cpu); 215 tmp = cpumask_of_cpu(smp_processor_id());
196 if (cpus_equal(batch->mm->cpu_vm_mask, tmp)) 216 if (cpus_equal(batch->mm->cpu_vm_mask, tmp))
197 local = 1; 217 local = 1;
198
199 if (i == 1) 218 if (i == 1)
200 flush_hash_page(batch->vaddr[0], batch->pte[0], 219 flush_hash_page(batch->vaddr[0], batch->pte[0],
201 batch->psize, local); 220 batch->psize, local);
202 else 221 else
203 flush_hash_range(i, local); 222 flush_hash_range(i, local);
204 batch->index = 0; 223 batch->index = 0;
205 put_cpu();
206} 224}
207 225
208void pte_free_finish(void) 226void pte_free_finish(void)
diff --git a/arch/powerpc/oprofile/Makefile b/arch/powerpc/oprofile/Makefile
index 4ccef2d5530c..4b5f9528218c 100644
--- a/arch/powerpc/oprofile/Makefile
+++ b/arch/powerpc/oprofile/Makefile
@@ -12,6 +12,6 @@ DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \
12 12
13oprofile-y := $(DRIVER_OBJS) common.o backtrace.o 13oprofile-y := $(DRIVER_OBJS) common.o backtrace.o
14oprofile-$(CONFIG_PPC_CELL_NATIVE) += op_model_cell.o 14oprofile-$(CONFIG_PPC_CELL_NATIVE) += op_model_cell.o
15oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o 15oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o op_model_pa6t.o
16oprofile-$(CONFIG_FSL_BOOKE) += op_model_fsl_booke.o 16oprofile-$(CONFIG_FSL_BOOKE) += op_model_fsl_booke.o
17oprofile-$(CONFIG_6xx) += op_model_7450.o 17oprofile-$(CONFIG_6xx) += op_model_7450.o
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index fbd62eacfdf4..1a7ef7e246d2 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -160,6 +160,9 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
160 case PPC_OPROFILE_POWER4: 160 case PPC_OPROFILE_POWER4:
161 model = &op_model_power4; 161 model = &op_model_power4;
162 break; 162 break;
163 case PPC_OPROFILE_PA6T:
164 model = &op_model_pa6t;
165 break;
163#endif 166#endif
164#ifdef CONFIG_6xx 167#ifdef CONFIG_6xx
165 case PPC_OPROFILE_G4: 168 case PPC_OPROFILE_G4:
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c
index e08e1d7b3dc5..626b29f38304 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -37,6 +37,7 @@
37#include <asm/system.h> 37#include <asm/system.h>
38 38
39#include "../platforms/cell/interrupt.h" 39#include "../platforms/cell/interrupt.h"
40#include "../platforms/cell/cbe_regs.h"
40 41
41#define PPU_CYCLES_EVENT_NUM 1 /* event number for CYCLES */ 42#define PPU_CYCLES_EVENT_NUM 1 /* event number for CYCLES */
42#define PPU_CYCLES_GRP_NUM 1 /* special group number for identifying 43#define PPU_CYCLES_GRP_NUM 1 /* special group number for identifying
@@ -130,7 +131,7 @@ static int pm_rtas_token;
130static u32 reset_value[NR_PHYS_CTRS]; 131static u32 reset_value[NR_PHYS_CTRS];
131static int num_counters; 132static int num_counters;
132static int oprofile_running; 133static int oprofile_running;
133static spinlock_t virt_cntr_lock = SPIN_LOCK_UNLOCKED; 134static DEFINE_SPINLOCK(virt_cntr_lock);
134 135
135static u32 ctr_enabled; 136static u32 ctr_enabled;
136 137
diff --git a/arch/powerpc/oprofile/op_model_pa6t.c b/arch/powerpc/oprofile/op_model_pa6t.c
new file mode 100644
index 000000000000..e8a56b0adadc
--- /dev/null
+++ b/arch/powerpc/oprofile/op_model_pa6t.c
@@ -0,0 +1,234 @@
1/*
2 * Copyright (C) 2006-2007 PA Semi, Inc
3 *
4 * Author: Shashi Rao, PA Semi
5 *
6 * Maintained by: Olof Johansson <olof@lixom.net>
7 *
8 * Based on arch/powerpc/oprofile/op_model_power4.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/oprofile.h>
25#include <linux/init.h>
26#include <linux/smp.h>
27#include <linux/percpu.h>
28#include <asm/processor.h>
29#include <asm/cputable.h>
30#include <asm/oprofile_impl.h>
31#include <asm/reg.h>
32
33static unsigned char oprofile_running;
34
35/* mmcr values are set in pa6t_reg_setup, used in pa6t_cpu_setup */
36static u64 mmcr0_val;
37static u64 mmcr1_val;
38
39/* inited in pa6t_reg_setup */
40static u64 reset_value[OP_MAX_COUNTER];
41
42static inline u64 ctr_read(unsigned int i)
43{
44 switch (i) {
45 case 0:
46 return mfspr(SPRN_PA6T_PMC0);
47 case 1:
48 return mfspr(SPRN_PA6T_PMC1);
49 case 2:
50 return mfspr(SPRN_PA6T_PMC2);
51 case 3:
52 return mfspr(SPRN_PA6T_PMC3);
53 case 4:
54 return mfspr(SPRN_PA6T_PMC4);
55 case 5:
56 return mfspr(SPRN_PA6T_PMC5);
57 default:
58 printk(KERN_ERR "ctr_read called with bad arg %u\n", i);
59 return 0;
60 }
61}
62
63static inline void ctr_write(unsigned int i, u64 val)
64{
65 switch (i) {
66 case 0:
67 mtspr(SPRN_PA6T_PMC0, val);
68 break;
69 case 1:
70 mtspr(SPRN_PA6T_PMC1, val);
71 break;
72 case 2:
73 mtspr(SPRN_PA6T_PMC2, val);
74 break;
75 case 3:
76 mtspr(SPRN_PA6T_PMC3, val);
77 break;
78 case 4:
79 mtspr(SPRN_PA6T_PMC4, val);
80 break;
81 case 5:
82 mtspr(SPRN_PA6T_PMC5, val);
83 break;
84 default:
85 printk(KERN_ERR "ctr_write called with bad arg %u\n", i);
86 break;
87 }
88}
89
90
91/* precompute the values to stuff in the hardware registers */
92static void pa6t_reg_setup(struct op_counter_config *ctr,
93 struct op_system_config *sys,
94 int num_ctrs)
95{
96 int pmc;
97
98 /*
99 * adjust the mmcr0.en[0-5] and mmcr0.inten[0-5] values obtained from the
100 * event_mappings file by turning off the counters that the user doesn't
101 * care about
102 *
103 * setup user and kernel profiling
104 */
105 for (pmc = 0; pmc < cur_cpu_spec->num_pmcs; pmc++)
106 if (!ctr[pmc].enabled) {
107 sys->mmcr0 &= ~(0x1UL << pmc);
108 sys->mmcr0 &= ~(0x1UL << (pmc+12));
109 pr_debug("turned off counter %u\n", pmc);
110 }
111
112 if (sys->enable_kernel)
113 sys->mmcr0 |= PA6T_MMCR0_SUPEN | PA6T_MMCR0_HYPEN;
114 else
115 sys->mmcr0 &= ~(PA6T_MMCR0_SUPEN | PA6T_MMCR0_HYPEN);
116
117 if (sys->enable_user)
118 sys->mmcr0 |= PA6T_MMCR0_PREN;
119 else
120 sys->mmcr0 &= ~PA6T_MMCR0_PREN;
121
122 /*
123 * The performance counter event settings are given in the mmcr0 and
124 * mmcr1 values passed from the user in the op_system_config
125 * structure (sys variable).
126 */
127 mmcr0_val = sys->mmcr0;
128 mmcr1_val = sys->mmcr1;
129 pr_debug("mmcr0_val inited to %016lx\n", sys->mmcr0);
130 pr_debug("mmcr1_val inited to %016lx\n", sys->mmcr1);
131
132 for (pmc = 0; pmc < cur_cpu_spec->num_pmcs; pmc++) {
133 /* counters are 40 bit. Move to cputable at some point? */
134 reset_value[pmc] = (0x1UL << 39) - ctr[pmc].count;
135 pr_debug("reset_value for pmc%u inited to 0x%lx\n",
136 pmc, reset_value[pmc]);
137 }
138}
139
140/* configure registers on this cpu */
141static void pa6t_cpu_setup(struct op_counter_config *ctr)
142{
143 u64 mmcr0 = mmcr0_val;
144 u64 mmcr1 = mmcr1_val;
145
146 /* Default is all PMCs off */
147 mmcr0 &= ~(0x3FUL);
148 mtspr(SPRN_PA6T_MMCR0, mmcr0);
149
150 /* program selected programmable events in */
151 mtspr(SPRN_PA6T_MMCR1, mmcr1);
152
153 pr_debug("setup on cpu %d, mmcr0 %016lx\n", smp_processor_id(),
154 mfspr(SPRN_PA6T_MMCR0));
155 pr_debug("setup on cpu %d, mmcr1 %016lx\n", smp_processor_id(),
156 mfspr(SPRN_PA6T_MMCR1));
157}
158
159static void pa6t_start(struct op_counter_config *ctr)
160{
161 int i;
162
163 /* Hold off event counting until rfid */
164 u64 mmcr0 = mmcr0_val | PA6T_MMCR0_HANDDIS;
165
166 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
167 if (ctr[i].enabled)
168 ctr_write(i, reset_value[i]);
169 else
170 ctr_write(i, 0UL);
171
172 mtspr(SPRN_PA6T_MMCR0, mmcr0);
173
174 oprofile_running = 1;
175
176 pr_debug("start on cpu %d, mmcr0 %lx\n", smp_processor_id(), mmcr0);
177}
178
179static void pa6t_stop(void)
180{
181 u64 mmcr0;
182
183 /* freeze counters */
184 mmcr0 = mfspr(SPRN_PA6T_MMCR0);
185 mmcr0 |= PA6T_MMCR0_FCM0;
186 mtspr(SPRN_PA6T_MMCR0, mmcr0);
187
188 oprofile_running = 0;
189
190 pr_debug("stop on cpu %d, mmcr0 %lx\n", smp_processor_id(), mmcr0);
191}
192
193/* handle the perfmon overflow vector */
194static void pa6t_handle_interrupt(struct pt_regs *regs,
195 struct op_counter_config *ctr)
196{
197 unsigned long pc = mfspr(SPRN_PA6T_SIAR);
198 int is_kernel = is_kernel_addr(pc);
199 u64 val;
200 int i;
201 u64 mmcr0;
202
203 /* disable perfmon counting until rfid */
204 mmcr0 = mfspr(SPRN_PA6T_MMCR0);
205 mtspr(SPRN_PA6T_MMCR0, mmcr0 | PA6T_MMCR0_HANDDIS);
206
207 /* Record samples. We've got one global bit for whether a sample
208 * was taken, so add it for any counter that triggered overflow.
209 */
210 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) {
211 val = ctr_read(i);
212 if (val & (0x1UL << 39)) { /* Overflow bit set */
213 if (oprofile_running && ctr[i].enabled) {
214 if (mmcr0 & PA6T_MMCR0_SIARLOG)
215 oprofile_add_ext_sample(pc, regs, i, is_kernel);
216 ctr_write(i, reset_value[i]);
217 } else {
218 ctr_write(i, 0UL);
219 }
220 }
221 }
222
223 /* Restore mmcr0 to a good known value since the PMI changes it */
224 mmcr0 = mmcr0_val | PA6T_MMCR0_HANDDIS;
225 mtspr(SPRN_PA6T_MMCR0, mmcr0);
226}
227
228struct op_powerpc_model op_model_pa6t = {
229 .reg_setup = pa6t_reg_setup,
230 .cpu_setup = pa6t_cpu_setup,
231 .start = pa6t_start,
232 .stop = pa6t_stop,
233 .handle_interrupt = pa6t_handle_interrupt,
234};
diff --git a/arch/powerpc/platforms/4xx/Kconfig b/arch/powerpc/platforms/4xx/Kconfig
index 2f2a13ed7667..ded357c17414 100644
--- a/arch/powerpc/platforms/4xx/Kconfig
+++ b/arch/powerpc/platforms/4xx/Kconfig
@@ -3,278 +3,206 @@ config 4xx
3 depends on 40x || 44x 3 depends on 40x || 44x
4 default y 4 default y
5 5
6config WANT_EARLY_SERIAL 6config BOOKE
7 bool 7 bool
8 select SERIAL_8250
9 default n
10
11menu "AMCC 4xx options"
12 depends on 4xx
13
14choice
15 prompt "Machine Type"
16 depends on 40x
17 default WALNUT
18
19config BUBINGA
20 bool "Bubinga"
21 select WANT_EARLY_SERIAL
22 help
23 This option enables support for the IBM 405EP evaluation board.
24
25config CPCI405
26 bool "CPCI405"
27 help
28 This option enables support for the CPCI405 board.
29
30config EP405
31 bool "EP405/EP405PC"
32 help
33 This option enables support for the EP405/EP405PC boards.
34
35config REDWOOD_5
36 bool "Redwood-5"
37 help
38 This option enables support for the IBM STB04 evaluation board.
39
40config REDWOOD_6
41 bool "Redwood-6"
42 help
43 This option enables support for the IBM STBx25xx evaluation board.
44
45config SYCAMORE
46 bool "Sycamore"
47 help
48 This option enables support for the IBM PPC405GPr evaluation board.
49
50config WALNUT
51 bool "Walnut"
52 help
53 This option enables support for the IBM PPC405GP evaluation board.
54
55config XILINX_ML300
56 bool "Xilinx-ML300"
57 help
58 This option enables support for the Xilinx ML300 evaluation board.
59
60endchoice
61
62choice
63 prompt "Machine Type"
64 depends on 44x 8 depends on 44x
65 default EBONY 9 default y
66
67config BAMBOO
68 bool "Bamboo"
69 select WANT_EARLY_SERIAL
70 help
71 This option enables support for the IBM PPC440EP evaluation board.
72
73config EBONY
74 bool "Ebony"
75 select WANT_EARLY_SERIAL
76 help
77 This option enables support for the IBM PPC440GP evaluation board.
78
79config LUAN
80 bool "Luan"
81 select WANT_EARLY_SERIAL
82 help
83 This option enables support for the IBM PPC440SP evaluation board.
84
85config OCOTEA
86 bool "Ocotea"
87 select WANT_EARLY_SERIAL
88 help
89 This option enables support for the IBM PPC440GX evaluation board.
90 10
91endchoice 11menu "AMCC 40x options"
12 depends on 40x
92 13
93config EP405PC 14#config BUBINGA
94 bool "EP405PC Support" 15# bool "Bubinga"
95 depends on EP405 16# depends on 40x
17# default n
18# select 405EP
19# help
20# This option enables support for the IBM 405EP evaluation board.
21
22#config CPCI405
23# bool "CPCI405"
24# depends on 40x
25# default n
26# select 405GP
27# help
28# This option enables support for the CPCI405 board.
29
30#config EP405
31# bool "EP405/EP405PC"
32# depends on 40x
33# default n
34# select 405GP
35# help
36# This option enables support for the EP405/EP405PC boards.
37
38#config EP405PC
39# bool "EP405PC Support"
40# depends on EP405
41# default y
42# help
43# This option enables support for the extra features of the EP405PC board.
44
45#config REDWOOD_5
46# bool "Redwood-5"
47# depends on 40x
48# default n
49# select STB03xxx
50# help
51# This option enables support for the IBM STB04 evaluation board.
52
53#config REDWOOD_6
54# bool "Redwood-6"
55# depends on 40x
56# default n
57# select STB03xxx
58# help
59# This option enables support for the IBM STBx25xx evaluation board.
60
61#config SYCAMORE
62# bool "Sycamore"
63# depends on 40x
64# default n
65# select 405GPR
66# help
67# This option enables support for the IBM PPC405GPr evaluation board.
68
69#config WALNUT
70# bool "Walnut"
71# depends on 40x
72# default y
73# select 405GP
74# help
75# This option enables support for the IBM PPC405GP evaluation board.
76
77#config XILINX_ML300
78# bool "Xilinx-ML300"
79# depends on 40x
80# default y
81# select VIRTEX_II_PRO
82# help
83# This option enables support for the Xilinx ML300 evaluation board.
96 84
85endmenu
97 86
98# It's often necessary to know the specific 4xx processor type. 87# 40x specific CPU modules, selected based on the board above.
99# Fortunately, it is impled (so far) from the board type, so we
100# don't need to ask more redundant questions.
101config NP405H 88config NP405H
102 bool 89 bool
103 depends on ASH 90 #depends on ASH
104 default y
105 91
106config 440EP 92# OAK doesn't exist but wanted to keep this around for any future 403GCX boards
93config 403GCX
107 bool 94 bool
108 depends on BAMBOO 95 #depends on OAK
109 select PPC_FPU 96 select IBM405_ERR51
110 default y
111 97
112config 440GP 98config 405GP
113 bool 99 bool
114 depends on EBONY 100 select IBM405_ERR77
115 default y 101 select IBM405_ERR51
116 102
117config 440GX 103config 405EP
118 bool 104 bool
119 depends on OCOTEA
120 default y
121 105
122config 440SP 106config 405GPR
123 bool 107 bool
124 depends on LUAN
125 default y
126 108
127config 440 109config VIRTEX_II_PRO
128 bool 110 bool
129 depends on 440GP || 440SP || 440EP 111 select IBM405_ERR77
130 default y 112 select IBM405_ERR51
131 113
132config 440A 114config STB03xxx
133 bool 115 bool
134 depends on 440GX 116 select IBM405_ERR77
135 default y 117 select IBM405_ERR51
136 118
137config IBM440EP_ERR42 119# 40x errata/workaround config symbols, selected by the CPU models above
138 bool
139 depends on 440EP
140 default y
141 120
142# All 405-based cores up until the 405GPR and 405EP have this errata. 121# All 405-based cores up until the 405GPR and 405EP have this errata.
143config IBM405_ERR77 122config IBM405_ERR77
144 bool 123 bool
145 depends on 40x && !403GCX && !405GPR && !405EP
146 default y
147 124
148# All 40x-based cores, up until the 405GPR and 405EP have this errata. 125# All 40x-based cores, up until the 405GPR and 405EP have this errata.
149config IBM405_ERR51 126config IBM405_ERR51
150 bool 127 bool
151 depends on 40x && !405GPR && !405EP
152 default y
153 128
154config BOOKE 129menu "AMCC 44x options"
155 bool
156 depends on 44x 130 depends on 44x
157 default y
158
159config IBM_OCP
160 bool
161 depends on ASH || BAMBOO || BUBINGA || CPCI405 || EBONY || EP405 || LUAN || OCOTEA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
162 default y
163 131
164config XILINX_OCP 132#config BAMBOO
165 bool 133# bool "Bamboo"
166 depends on XILINX_ML300 134# depends on 44x
167 default y 135# default n
136# select 440EP
137# help
138# This option enables support for the IBM PPC440EP evaluation board.
168 139
169config IBM_EMAC4 140config EBONY
170 bool 141 bool "Ebony"
171 depends on 440GX || 440SP 142 depends on 44x
172 default y
173
174config BIOS_FIXUP
175 bool
176 depends on BUBINGA || EP405 || SYCAMORE || WALNUT
177 default y
178
179# OAK doesn't exist but wanted to keep this around for any future 403GCX boards
180config 403GCX
181 bool
182 depends on OAK
183 default y
184
185config 405EP
186 bool
187 depends on BUBINGA
188 default y
189
190config 405GP
191 bool
192 depends on CPCI405 || EP405 || WALNUT
193 default y
194
195config 405GPR
196 bool
197 depends on SYCAMORE
198 default y 143 default y
144 select 440GP
145 help
146 This option enables support for the IBM PPC440GP evaluation board.
199 147
200config VIRTEX_II_PRO 148#config LUAN
201 bool 149# bool "Luan"
202 depends on XILINX_ML300 150# depends on 44x
203 default y 151# default n
152# select 440SP
153# help
154# This option enables support for the IBM PPC440SP evaluation board.
155
156#config OCOTEA
157# bool "Ocotea"
158# depends on 44x
159# default n
160# select 440GX
161# help
162# This option enables support for the IBM PPC440GX evaluation board.
204 163
205config STB03xxx 164endmenu
206 bool
207 depends on REDWOOD_5 || REDWOOD_6
208 default y
209 165
210config EMBEDDEDBOOT 166# 44x specific CPU modules, selected based on the board above.
167config 440EP
211 bool 168 bool
212 depends on EP405 || XILINX_ML300 169 select PPC_FPU
213 default y 170 select IBM440EP_ERR42
214 171
215config IBM_OPENBIOS 172config 440GP
216 bool 173 bool
217 depends on ASH || BUBINGA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT 174 select IBM_NEW_EMAC_ZMII
218 default y
219 175
220config PPC4xx_DMA 176config 440GX
221 bool "PPC4xx DMA controller support"
222 depends on 4xx
223
224config PPC4xx_EDMA
225 bool 177 bool
226 depends on !STB03xxx && PPC4xx_DMA
227 default y
228 178
229config PPC_GEN550 179config 440SP
230 bool 180 bool
231 depends on 4xx
232 default y
233
234choice
235 prompt "TTYS0 device and default console"
236 depends on 40x
237 default UART0_TTYS0
238
239config UART0_TTYS0
240 bool "UART0"
241 181
242config UART0_TTYS1 182config 440A
243 bool "UART1"
244
245endchoice
246
247config SERIAL_SICC
248 bool "SICC Serial port support"
249 depends on STB03xxx
250
251config UART1_DFLT_CONSOLE
252 bool 183 bool
253 depends on SERIAL_SICC && UART0_TTYS1 184 depends on 440GX
254 default y 185 default y
255 186
256config SERIAL_SICC_CONSOLE 187# 44x errata/workaround config symbols, selected by the CPU models above
188config IBM440EP_ERR42
257 bool 189 bool
258 depends on SERIAL_SICC && UART0_TTYS1
259 default y
260endmenu
261 190
191#config XILINX_OCP
192# bool
193# depends on XILINX_ML300
194# default y
262 195
263menu "IBM 40x options" 196#config BIOS_FIXUP
264 depends on 40x 197# bool
265 198# depends on BUBINGA || EP405 || SYCAMORE || WALNUT
266config SERIAL_SICC 199# default y
267 bool "SICC Serial port"
268 depends on STB03xxx
269
270config UART1_DFLT_CONSOLE
271 bool
272 depends on SERIAL_SICC && UART0_TTYS1
273 default y
274 200
275config SERIAL_SICC_CONSOLE 201#config PPC4xx_DMA
276 bool 202# bool "PPC4xx DMA controller support"
277 depends on SERIAL_SICC && UART0_TTYS1 203# depends on 4xx
278 default y
279 204
280endmenu 205#config PPC4xx_EDMA
206# bool
207# depends on !STB03xxx && PPC4xx_DMA
208# default y
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig
new file mode 100644
index 000000000000..bc4aa4a80a12
--- /dev/null
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -0,0 +1,35 @@
1config PPC_MPC52xx
2 bool
3 default n
4
5config PPC_MPC5200
6 bool
7 select PPC_MPC52xx
8 default n
9
10config PPC_MPC5200_BUGFIX
11 bool "MPC5200 (L25R) bugfix support"
12 depends on PPC_MPC5200
13 default n
14 help
15 Enable workarounds for original MPC5200 errata. This is not required
16 for MPC5200B based boards.
17
18 It is safe to say 'Y' here
19
20config PPC_EFIKA
21 bool "bPlan Efika 5k2. MPC5200B based computer"
22 depends on PPC_MULTIPLATFORM && PPC32
23 select PPC_RTAS
24 select RTAS_PROC
25 select PPC_MPC52xx
26 select PPC_NATIVE
27 default n
28
29config PPC_LITE5200
30 bool "Freescale Lite5200 Eval Board"
31 depends on PPC_MULTIPLATFORM && PPC32
32 select PPC_MPC5200
33 default n
34
35
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 8de034116681..a6bba97314eb 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -112,7 +112,7 @@ void __init efika_pcisetup(void)
112 return; 112 return;
113 } 113 }
114 114
115 bus_range = get_property(pcictrl, "bus-range", &len); 115 bus_range = of_get_property(pcictrl, "bus-range", &len);
116 if (bus_range == NULL || len < 2 * sizeof(int)) { 116 if (bus_range == NULL || len < 2 * sizeof(int)) {
117 printk(KERN_WARNING EFIKA_PLATFORM_NAME 117 printk(KERN_WARNING EFIKA_PLATFORM_NAME
118 ": Can't get bus-range for %s\n", pcictrl->full_name); 118 ": Can't get bus-range for %s\n", pcictrl->full_name);
@@ -158,18 +158,17 @@ void __init efika_pcisetup(void)
158static void efika_show_cpuinfo(struct seq_file *m) 158static void efika_show_cpuinfo(struct seq_file *m)
159{ 159{
160 struct device_node *root; 160 struct device_node *root;
161 const char *revision = NULL; 161 const char *revision;
162 const char *codegendescription = NULL; 162 const char *codegendescription;
163 const char *codegenvendor = NULL; 163 const char *codegenvendor;
164 164
165 root = of_find_node_by_path("/"); 165 root = of_find_node_by_path("/");
166 if (!root) 166 if (!root)
167 return; 167 return;
168 168
169 revision = get_property(root, "revision", NULL); 169 revision = of_get_property(root, "revision", NULL);
170 codegendescription = 170 codegendescription = of_get_property(root, "CODEGEN,description", NULL);
171 get_property(root, "CODEGEN,description", NULL); 171 codegenvendor = of_get_property(root, "CODEGEN,vendor", NULL);
172 codegenvendor = get_property(root, "CODEGEN,vendor", NULL);
173 172
174 if (codegendescription) 173 if (codegendescription)
175 seq_printf(m, "machine\t\t: %s\n", codegendescription); 174 seq_printf(m, "machine\t\t: %s\n", codegendescription);
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index cc3b40de21dd..8e2646ac417b 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -94,8 +94,8 @@ static void __init lite5200_setup_arch(void)
94 94
95 np = of_find_node_by_type(NULL, "cpu"); 95 np = of_find_node_by_type(NULL, "cpu");
96 if (np) { 96 if (np) {
97 unsigned int *fp = 97 const unsigned int *fp =
98 (int *)get_property(np, "clock-frequency", NULL); 98 of_get_property(np, "clock-frequency", NULL);
99 if (fp != 0) 99 if (fp != 0)
100 loops_per_jiffy = *fp / HZ; 100 loops_per_jiffy = *fp / HZ;
101 else 101 else
@@ -108,9 +108,11 @@ static void __init lite5200_setup_arch(void)
108 lite5200_setup_cpu(); /* Platorm specific */ 108 lite5200_setup_cpu(); /* Platorm specific */
109 109
110#ifdef CONFIG_PCI 110#ifdef CONFIG_PCI
111 np = of_find_node_by_type(np, "pci"); 111 np = of_find_node_by_type(NULL, "pci");
112 if (np) 112 if (np) {
113 mpc52xx_add_bridge(np); 113 mpc52xx_add_bridge(np);
114 of_node_put(np);
115 }
114#endif 116#endif
115 117
116#ifdef CONFIG_BLK_DEV_INITRD 118#ifdef CONFIG_BLK_DEV_INITRD
@@ -132,7 +134,7 @@ void lite5200_show_cpuinfo(struct seq_file *m)
132 const char *model = NULL; 134 const char *model = NULL;
133 135
134 if (np) 136 if (np)
135 model = get_property(np, "model", NULL); 137 model = of_get_property(np, "model", NULL);
136 138
137 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n"); 139 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n");
138 seq_printf(m, "machine\t\t: %s\n", model ? model : "unknown"); 140 seq_printf(m, "machine\t\t: %s\n", model ? model : "unknown");
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index ed0cb694aea8..2dd415ff55a9 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -60,7 +60,7 @@ mpc52xx_find_ipb_freq(struct device_node *node)
60 60
61 of_node_get(node); 61 of_node_get(node);
62 while (node) { 62 while (node) {
63 p_ipb_freq = get_property(node, "bus-frequency", NULL); 63 p_ipb_freq = of_get_property(node, "bus-frequency", NULL);
64 if (p_ipb_freq) 64 if (p_ipb_freq)
65 break; 65 break;
66 66
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
index faf161bdbc1c..34d34a26d305 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -370,7 +370,7 @@ mpc52xx_add_bridge(struct device_node *node)
370 return -EINVAL; 370 return -EINVAL;
371 } 371 }
372 372
373 bus_range = get_property(node, "bus-range", &len); 373 bus_range = of_get_property(node, "bus-range", &len);
374 if (bus_range == NULL || len < 2 * sizeof(int)) { 374 if (bus_range == NULL || len < 2 * sizeof(int)) {
375 printk(KERN_WARNING "Can't get %s bus-range, assume bus 0\n", 375 printk(KERN_WARNING "Can't get %s bus-range, assume bus 0\n",
376 node->full_name); 376 node->full_name);
diff --git a/arch/powerpc/platforms/82xx/Kconfig b/arch/powerpc/platforms/82xx/Kconfig
index 47d841ecf2e2..de7fce9cb6eb 100644
--- a/arch/powerpc/platforms/82xx/Kconfig
+++ b/arch/powerpc/platforms/82xx/Kconfig
@@ -1,21 +1,36 @@
1menu "Platform support"
2 depends on PPC_82xx
3
4choice 1choice
5 prompt "Machine Type" 2 prompt "Machine Type"
6 default MPC82xx_ADS 3 depends on PPC_82xx
4 default MPC82xx_ADS
7 5
8config MPC82xx_ADS 6config MPC82xx_ADS
9 bool "Freescale MPC82xx ADS" 7 bool "Freescale MPC82xx ADS"
10 select DEFAULT_UIMAGE 8 select DEFAULT_UIMAGE
11 select PQ2ADS 9 select PQ2ADS
12 select 8272 10 select 8272
13 select 8260 11 select 8260
14 select CPM2 12 select FSL_SOC
15 select FSL_SOC 13 help
16 help 14 This option enables support for the MPC8272 ADS board
17 This option enables support for the MPC8272 ADS board
18 15
19endchoice 16endchoice
20 17
21endmenu 18config PQ2ADS
19 bool
20 default n
21
22config 8260
23 bool
24 depends on 6xx
25 select CPM2
26 help
27 The MPC8260 is a typical embedded CPU made by Freescale. Selecting
28 this option means that you wish to build a kernel for a machine with
29 an 8260 class CPU.
30
31config 8272
32 bool
33 select 8260
34 help
35 The MPC8272 CPM has a different internal dpram setup than other CPM2
36 devices
diff --git a/arch/powerpc/platforms/82xx/mpc82xx.c b/arch/powerpc/platforms/82xx/mpc82xx.c
index 74e7892cdfcf..cc9900d2e5ee 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx.c
@@ -55,17 +55,17 @@
55static int __init get_freq(char *name, unsigned long *val) 55static int __init get_freq(char *name, unsigned long *val)
56{ 56{
57 struct device_node *cpu; 57 struct device_node *cpu;
58 unsigned int *fp; 58 const unsigned int *fp;
59 int found = 0; 59 int found = 0;
60 60
61 /* The cpu node should have timebase and clock frequency properties */ 61 /* The cpu node should have timebase and clock frequency properties */
62 cpu = of_find_node_by_type(NULL, "cpu"); 62 cpu = of_find_node_by_type(NULL, "cpu");
63 63
64 if (cpu) { 64 if (cpu) {
65 fp = (unsigned int *)get_property(cpu, name, NULL); 65 fp = of_get_property(cpu, name, NULL);
66 if (fp) { 66 if (fp) {
67 found = 1; 67 found = 1;
68 *val = *fp++; 68 *val = *fp;
69 } 69 }
70 70
71 of_node_put(cpu); 71 of_node_put(cpu);
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
index 7334c1a15b90..47cb09f08052 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
@@ -456,7 +456,7 @@ void m82xx_pci_init_irq(void)
456 iounmap(immap); 456 iounmap(immap);
457 return; 457 return;
458 } 458 }
459 irq_map = get_property(np, "interrupt-map", &size); 459 irq_map = of_get_property(np, "interrupt-map", &size);
460 if ((!irq_map) || (size <= 7)) { 460 if ((!irq_map) || (size <= 7)) {
461 printk(KERN_INFO "No interrupt-map property of pci node\n"); 461 printk(KERN_INFO "No interrupt-map property of pci node\n");
462 iounmap(immap); 462 iounmap(immap);
@@ -481,7 +481,7 @@ void m82xx_pci_init_irq(void)
481 } 481 }
482 pci_pic_node = of_node_get(np); 482 pci_pic_node = of_node_get(np);
483 /* PCI interrupt controller registers: status and mask */ 483 /* PCI interrupt controller registers: status and mask */
484 regs = get_property(np, "reg", &size); 484 regs = of_get_property(np, "reg", &size);
485 if ((!regs) || (size <= 2)) { 485 if ((!regs) || (size <= 2)) {
486 printk(KERN_INFO "No reg property in pci pic node\n"); 486 printk(KERN_INFO "No reg property in pci pic node\n");
487 iounmap(immap); 487 iounmap(immap);
@@ -521,20 +521,20 @@ void __init add_bridge(struct device_node *np)
521 struct pci_controller *hose; 521 struct pci_controller *hose;
522 struct resource r; 522 struct resource r;
523 const int *bus_range; 523 const int *bus_range;
524 const void *ptr; 524 const uint *ptr;
525 525
526 memset(&r, 0, sizeof(r)); 526 memset(&r, 0, sizeof(r));
527 if (of_address_to_resource(np, 0, &r)) { 527 if (of_address_to_resource(np, 0, &r)) {
528 printk(KERN_INFO "No PCI reg property in device tree\n"); 528 printk(KERN_INFO "No PCI reg property in device tree\n");
529 return; 529 return;
530 } 530 }
531 if (!(ptr = get_property(np, "clock-frequency", NULL))) { 531 if (!(ptr = of_get_property(np, "clock-frequency", NULL))) {
532 printk(KERN_INFO "No clock-frequency property in PCI node"); 532 printk(KERN_INFO "No clock-frequency property in PCI node");
533 return; 533 return;
534 } 534 }
535 pci_clk_frq = *(uint *) ptr; 535 pci_clk_frq = *ptr;
536 of_node_put(np); 536 of_node_put(np);
537 bus_range = get_property(np, "bus-range", &len); 537 bus_range = of_get_property(np, "bus-range", &len);
538 if (bus_range == NULL || len < 2 * sizeof(int)) { 538 if (bus_range == NULL || len < 2 * sizeof(int)) {
539 printk(KERN_WARNING "Can't get bus-range for %s, assume" 539 printk(KERN_WARNING "Can't get bus-range for %s, assume"
540 " bus 0\n", np->full_name); 540 " bus 0\n", np->full_name);
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index 713b31a16ce9..19cafdf6df93 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -1,8 +1,6 @@
1menu "Platform support"
2 depends on PPC_83xx
3
4choice 1choice
5 prompt "Machine Type" 2 prompt "Machine Type"
3 depends on PPC_83xx
6 default MPC834x_MDS 4 default MPC834x_MDS
7 5
8config MPC8313_RDB 6config MPC8313_RDB
@@ -18,6 +16,13 @@ config MPC832x_MDS
18 help 16 help
19 This option enables support for the MPC832x MDS evaluation board. 17 This option enables support for the MPC832x MDS evaluation board.
20 18
19config MPC832x_RDB
20 bool "Freescale MPC832x RDB"
21 select DEFAULT_UIMAGE
22 select QUICC_ENGINE
23 help
24 This option enables support for the MPC8323 RDB board.
25
21config MPC834x_MDS 26config MPC834x_MDS
22 bool "Freescale MPC834x MDS" 27 bool "Freescale MPC834x MDS"
23 select DEFAULT_UIMAGE 28 select DEFAULT_UIMAGE
@@ -57,7 +62,7 @@ config PPC_MPC832x
57 bool 62 bool
58 select PPC_UDBG_16550 63 select PPC_UDBG_16550
59 select PPC_INDIRECT_PCI 64 select PPC_INDIRECT_PCI
60 default y if MPC832x_MDS 65 default y if MPC832x_MDS || MPC832x_RDB
61 66
62config MPC834x 67config MPC834x
63 bool 68 bool
@@ -70,5 +75,3 @@ config PPC_MPC836x
70 select PPC_UDBG_16550 75 select PPC_UDBG_16550
71 select PPC_INDIRECT_PCI 76 select PPC_INDIRECT_PCI
72 default y if MPC836x_MDS 77 default y if MPC836x_MDS
73
74endmenu
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index dfc970d0df10..31a91b53f528 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -4,6 +4,7 @@
4obj-y := misc.o 4obj-y := misc.o
5obj-$(CONFIG_PCI) += pci.o 5obj-$(CONFIG_PCI) += pci.o
6obj-$(CONFIG_MPC8313_RDB) += mpc8313_rdb.o 6obj-$(CONFIG_MPC8313_RDB) += mpc8313_rdb.o
7obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
7obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o 8obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
8obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o 9obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
9obj-$(CONFIG_MPC836x_MDS) += mpc836x_mds.o 10obj-$(CONFIG_MPC836x_MDS) += mpc836x_mds.o
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 17e3a3c6d8b4..fff09f5d6edf 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -41,7 +41,6 @@
41#include <asm/qe_ic.h> 41#include <asm/qe_ic.h>
42 42
43#include "mpc83xx.h" 43#include "mpc83xx.h"
44#include "mpc832x_mds.h"
45 44
46#undef DEBUG 45#undef DEBUG
47#ifdef DEBUG 46#ifdef DEBUG
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.h b/arch/powerpc/platforms/83xx/mpc832x_mds.h
deleted file mode 100644
index a49588904f8a..000000000000
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
3 *
4 * Description:
5 * MPC832x MDS board specific header.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __MACH_MPC832x_MDS_H__
15#define __MACH_MPC832x_MDS_H__
16
17extern u8 *get_bcsr(void);
18
19#endif /* __MACH_MPC832x_MDS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
new file mode 100644
index 000000000000..6b71e9ffb11a
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -0,0 +1,138 @@
1/*
2 * arch/powerpc/platforms/83xx/mpc832x_rdb.c
3 *
4 * Copyright (C) Freescale Semiconductor, Inc. 2007. All rights reserved.
5 *
6 * Description:
7 * MPC832x RDB board specific routines.
8 * This file is based on mpc832x_mds.c and mpc8313_rdb.c
9 * Author: Michael Barkowski <michael.barkowski@freescale.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17#include <linux/pci.h>
18
19#include <asm/of_platform.h>
20#include <asm/time.h>
21#include <asm/ipic.h>
22#include <asm/udbg.h>
23#include <asm/qe.h>
24#include <asm/qe_ic.h>
25
26#include "mpc83xx.h"
27
28#undef DEBUG
29#ifdef DEBUG
30#define DBG(fmt...) udbg_printf(fmt)
31#else
32#define DBG(fmt...)
33#endif
34
35#ifndef CONFIG_PCI
36unsigned long isa_io_base = 0;
37unsigned long isa_mem_base = 0;
38#endif
39
40/* ************************************************************************
41 *
42 * Setup the architecture
43 *
44 */
45static void __init mpc832x_rdb_setup_arch(void)
46{
47 struct device_node *np;
48
49 if (ppc_md.progress)
50 ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
51
52#ifdef CONFIG_PCI
53 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
54 add_bridge(np);
55
56 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
57#endif
58
59#ifdef CONFIG_QUICC_ENGINE
60 qe_reset();
61
62 if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
63 par_io_init(np);
64 of_node_put(np);
65
66 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
67 par_io_of_config(np);
68 }
69#endif /* CONFIG_QUICC_ENGINE */
70}
71
72static struct of_device_id mpc832x_ids[] = {
73 { .type = "soc", },
74 { .compatible = "soc", },
75 { .type = "qe", },
76 {},
77};
78
79static int __init mpc832x_declare_of_platform_devices(void)
80{
81 if (!machine_is(mpc832x_rdb))
82 return 0;
83
84 /* Publish the QE devices */
85 of_platform_bus_probe(NULL, mpc832x_ids, NULL);
86
87 return 0;
88}
89device_initcall(mpc832x_declare_of_platform_devices);
90
91void __init mpc832x_rdb_init_IRQ(void)
92{
93
94 struct device_node *np;
95
96 np = of_find_node_by_type(NULL, "ipic");
97 if (!np)
98 return;
99
100 ipic_init(np, 0);
101
102 /* Initialize the default interrupt mapping priorities,
103 * in case the boot rom changed something on us.
104 */
105 ipic_set_default_priority();
106 of_node_put(np);
107
108#ifdef CONFIG_QUICC_ENGINE
109 np = of_find_node_by_type(NULL, "qeic");
110 if (!np)
111 return;
112
113 qe_ic_init(np, 0);
114 of_node_put(np);
115#endif /* CONFIG_QUICC_ENGINE */
116}
117
118/*
119 * Called very early, MMU is off, device-tree isn't unflattened
120 */
121static int __init mpc832x_rdb_probe(void)
122{
123 unsigned long root = of_get_flat_dt_root();
124
125 return of_flat_dt_is_compatible(root, "MPC832xRDB");
126}
127
128define_machine(mpc832x_rdb) {
129 .name = "MPC832x RDB",
130 .probe = mpc832x_rdb_probe,
131 .setup_arch = mpc832x_rdb_setup_arch,
132 .init_IRQ = mpc832x_rdb_init_IRQ,
133 .get_irq = ipic_get_irq,
134 .restart = mpc83xx_restart,
135 .time_init = mpc83xx_time_init,
136 .calibrate_decr = generic_calibrate_decr,
137 .progress = udbg_progress,
138};
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.h b/arch/powerpc/platforms/83xx/mpc834x_itx.h
deleted file mode 100644
index 174ca4ef55f3..000000000000
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/powerpc/platforms/83xx/mpc834x_itx.h
3 *
4 * MPC834X ITX common board definitions
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MACH_MPC83XX_ITX_H__
16#define __MACH_MPC83XX_ITX_H__
17
18#define PIRQA MPC83xx_IRQ_EXT4
19#define PIRQB MPC83xx_IRQ_EXT5
20#define PIRQC MPC83xx_IRQ_EXT6
21#define PIRQD MPC83xx_IRQ_EXT7
22
23#endif /* __MACH_MPC83XX_ITX_H__ */
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c
index 9c3650555144..774457d09e94 100644
--- a/arch/powerpc/platforms/83xx/pci.c
+++ b/arch/powerpc/platforms/83xx/pci.c
@@ -60,7 +60,7 @@ int __init add_bridge(struct device_node *dev)
60 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 60 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
61 61
62 /* Get bus range if any */ 62 /* Get bus range if any */
63 bus_range = get_property(dev, "bus-range", &len); 63 bus_range = of_get_property(dev, "bus-range", &len);
64 if (bus_range == NULL || len < 2 * sizeof(int)) { 64 if (bus_range == NULL || len < 2 * sizeof(int)) {
65 printk(KERN_WARNING "Can't get bus-range for %s, assume" 65 printk(KERN_WARNING "Can't get bus-range for %s, assume"
66 " bus 0\n", dev->full_name); 66 " bus 0\n", dev->full_name);
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index e764c0aced88..629926e01e90 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -1,8 +1,6 @@
1menu "Platform support"
2 depends on PPC_85xx
3
4choice 1choice
5 prompt "Machine Type" 2 prompt "Machine Type"
3 depends on PPC_85xx
6 default MPC8540_ADS 4 default MPC8540_ADS
7 5
8config MPC8540_ADS 6config MPC8540_ADS
@@ -30,6 +28,12 @@ config MPC85xx_MDS
30 help 28 help
31 This option enables support for the MPC85xx MDS board 29 This option enables support for the MPC85xx MDS board
32 30
31config MPC8544_DS
32 bool "Freescale MPC8544 DS"
33 select DEFAULT_UIMAGE
34 help
35 This option enables support for the MPC8544 DS board
36
33endchoice 37endchoice
34 38
35config MPC8540 39config MPC8540
@@ -40,33 +44,15 @@ config MPC8540
40 44
41config MPC8560 45config MPC8560
42 bool 46 bool
43 select PPC_INDIRECT_PCI 47 select CPM2
44 default y if MPC8560_ADS 48 default y if MPC8560_ADS
45 49
46config MPC85xx 50config MPC85xx
47 bool 51 bool
48 select PPC_UDBG_16550 52 select PPC_UDBG_16550
49 select PPC_INDIRECT_PCI 53 select PPC_INDIRECT_PCI
54 select PPC_INDIRECT_PCI_BE
55 select MPIC
50 select SERIAL_8250_SHARE_IRQ if SERIAL_8250 56 select SERIAL_8250_SHARE_IRQ if SERIAL_8250
51 default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS || MPC85xx_MDS 57 default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \
52 58 || MPC85xx_MDS || MPC8544_DS
53config PPC_INDIRECT_PCI_BE
54 bool
55 depends on PPC_85xx
56 default y
57
58config MPIC
59 bool
60 default y
61
62config CPM2
63 bool
64 depends on MPC8560
65 default y
66 help
67 The CPM2 (Communications Processor Module) is a coprocessor on
68 embedded CPUs made by Motorola. Selecting this option means that
69 you wish to build a kernel for a machine with a CPM2 coprocessor
70 on it.
71
72endmenu
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 4e63917ada9d..4e02cbb14cf7 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -5,4 +5,5 @@ obj-$(CONFIG_PPC_85xx) += misc.o pci.o
5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o 5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
6obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o 6obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
7obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o 7obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
8obj-$(CONFIG_MPC8544_DS) += mpc8544_ds.o
8obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o 9obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
diff --git a/arch/powerpc/platforms/85xx/mpc8544_ds.c b/arch/powerpc/platforms/85xx/mpc8544_ds.c
new file mode 100644
index 000000000000..2867f85e6325
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc8544_ds.c
@@ -0,0 +1,144 @@
1/*
2 * MPC8544 DS Board Setup
3 *
4 * Author Xianghua Xiao (x.xiao@freescale.com)
5 * Copyright 2007 Freescale Semiconductor Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/kdev_t.h>
16#include <linux/delay.h>
17#include <linux/seq_file.h>
18
19#include <asm/system.h>
20#include <asm/time.h>
21#include <asm/machdep.h>
22#include <asm/mpc85xx.h>
23#include <mm/mmu_decl.h>
24#include <asm/prom.h>
25#include <asm/udbg.h>
26#include <asm/mpic.h>
27#include <asm/i8259.h>
28
29#include <sysdev/fsl_soc.h>
30#include "mpc85xx.h"
31
32#undef DEBUG
33
34#ifdef DEBUG
35#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
36#else
37#define DBG(fmt, args...)
38#endif
39
40
41void __init mpc8544_ds_pic_init(void)
42{
43 struct mpic *mpic;
44 struct resource r;
45 struct device_node *np = NULL;
46#ifdef CONFIG_PPC_I8259
47 struct device_node *cascade_node = NULL;
48 int cascade_irq;
49#endif
50
51 np = of_find_node_by_type(np, "open-pic");
52
53 if (np == NULL) {
54 printk(KERN_ERR "Could not find open-pic node\n");
55 return;
56 }
57
58 if (of_address_to_resource(np, 0, &r)) {
59 printk(KERN_ERR "Failed to map mpic register space\n");
60 of_node_put(np);
61 return;
62 }
63
64 /* Alloc mpic structure and per isu has 16 INT entries. */
65 mpic = mpic_alloc(np, r.start,
66 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
67 16, 64, " OPENPIC ");
68 BUG_ON(mpic == NULL);
69
70 /*
71 * 48 Internal Interrupts
72 */
73 mpic_assign_isu(mpic, 0, r.start + 0x10200);
74 mpic_assign_isu(mpic, 1, r.start + 0x10400);
75 mpic_assign_isu(mpic, 2, r.start + 0x10600);
76
77 /*
78 * 16 External interrupts
79 */
80 mpic_assign_isu(mpic, 3, r.start + 0x10000);
81
82 mpic_init(mpic);
83
84#ifdef CONFIG_PPC_I8259
85 /* Initialize the i8259 controller */
86 for_each_node_by_type(np, "interrupt-controller")
87 if (device_is_compatible(np, "chrp,iic")) {
88 cascade_node = np;
89 break;
90 }
91
92 if (cascade_node == NULL) {
93 printk(KERN_DEBUG "Could not find i8259 PIC\n");
94 return;
95 }
96
97 cascade_irq = irq_of_parse_and_map(cascade_node, 0);
98 if (cascade_irq == NO_IRQ) {
99 printk(KERN_ERR "Failed to map cascade interrupt\n");
100 return;
101 }
102
103 DBG("mpc8544ds: cascade mapped to irq %d\n", cascade_irq);
104
105 i8259_init(cascade_node, 0);
106 of_node_put(cascade_node);
107
108 set_irq_chained_handler(cascade_irq, mpc8544_8259_cascade);
109#endif /* CONFIG_PPC_I8259 */
110}
111
112
113/*
114 * Setup the architecture
115 */
116static void __init mpc8544_ds_setup_arch(void)
117{
118 if (ppc_md.progress)
119 ppc_md.progress("mpc8544_ds_setup_arch()", 0);
120
121 printk("MPC8544 DS board from Freescale Semiconductor\n");
122}
123
124
125/*
126 * Called very early, device-tree isn't unflattened
127 */
128static int __init mpc8544_ds_probe(void)
129{
130 unsigned long root = of_get_flat_dt_root();
131
132 return of_flat_dt_is_compatible(root, "MPC8544DS");
133}
134
135define_machine(mpc8544_ds) {
136 .name = "MPC8544 DS",
137 .probe = mpc8544_ds_probe,
138 .setup_arch = mpc8544_ds_setup_arch,
139 .init_IRQ = mpc8544_ds_pic_init,
140 .get_irq = mpic_get_irq,
141 .restart = mpc85xx_restart,
142 .calibrate_decr = generic_calibrate_decr,
143 .progress = udbg_progress,
144};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 8ed034aeca5f..5d27621f0927 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -227,7 +227,7 @@ static void __init mpc85xx_ads_setup_arch(void)
227 if (cpu != 0) { 227 if (cpu != 0) {
228 const unsigned int *fp; 228 const unsigned int *fp;
229 229
230 fp = get_property(cpu, "clock-frequency", NULL); 230 fp = of_get_property(cpu, "clock-frequency", NULL);
231 if (fp != 0) 231 if (fp != 0)
232 loops_per_jiffy = *fp / HZ; 232 loops_per_jiffy = *fp / HZ;
233 else 233 else
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 4232686be441..7e71636f9098 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -237,7 +237,7 @@ static void __init mpc85xx_cds_setup_arch(void)
237 if (cpu != 0) { 237 if (cpu != 0) {
238 const unsigned int *fp; 238 const unsigned int *fp;
239 239
240 fp = get_property(cpu, "clock-frequency", NULL); 240 fp = of_get_property(cpu, "clock-frequency", NULL);
241 if (fp != 0) 241 if (fp != 0)
242 loops_per_jiffy = *fp / HZ; 242 loops_per_jiffy = *fp / HZ;
243 else 243 else
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 81144d2ae455..54db41689954 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -80,7 +80,7 @@ static void __init mpc85xx_mds_setup_arch(void)
80 np = of_find_node_by_type(NULL, "cpu"); 80 np = of_find_node_by_type(NULL, "cpu");
81 if (np != NULL) { 81 if (np != NULL) {
82 const unsigned int *fp = 82 const unsigned int *fp =
83 get_property(np, "clock-frequency", NULL); 83 of_get_property(np, "clock-frequency", NULL);
84 if (fp != NULL) 84 if (fp != NULL)
85 loops_per_jiffy = *fp / HZ; 85 loops_per_jiffy = *fp / HZ;
86 else 86 else
diff --git a/arch/powerpc/platforms/85xx/pci.c b/arch/powerpc/platforms/85xx/pci.c
index 05930eeb6e7f..48f17e23d771 100644
--- a/arch/powerpc/platforms/85xx/pci.c
+++ b/arch/powerpc/platforms/85xx/pci.c
@@ -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 = get_property(dev, "bus-range", &len); 54 bus_range = of_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/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 0c70944d0e37..d1bcff500464 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -1,8 +1,6 @@
1menu "Platform Support"
2 depends on PPC_86xx
3
4choice 1choice
5 prompt "Machine Type" 2 prompt "Machine Type"
3 depends on PPC_86xx
6 default MPC8641_HPCN 4 default MPC8641_HPCN
7 5
8config MPC8641_HPCN 6config MPC8641_HPCN
@@ -14,20 +12,10 @@ config MPC8641_HPCN
14 12
15endchoice 13endchoice
16 14
17
18config MPC8641 15config MPC8641
19 bool 16 bool
20 select PPC_INDIRECT_PCI 17 select PPC_INDIRECT_PCI
18 select PPC_INDIRECT_PCI_BE
21 select PPC_UDBG_16550 19 select PPC_UDBG_16550
20 select MPIC
22 default y if MPC8641_HPCN 21 default y if MPC8641_HPCN
23
24config MPIC
25 bool
26 default y
27
28config PPC_INDIRECT_PCI_BE
29 bool
30 depends on PPC_86xx
31 default y
32
33endmenu
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
index 476a6eeee710..418fd8f4d268 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -4,4 +4,4 @@
4 4
5obj-$(CONFIG_SMP) += mpc86xx_smp.o 5obj-$(CONFIG_SMP) += mpc86xx_smp.o
6obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o 6obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
7obj-$(CONFIG_PCI) += pci.o mpc86xx_pcie.o 7obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index f42f801cf84e..3d3d98f5bd4a 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -349,7 +349,7 @@ mpc86xx_hpcn_setup_arch(void)
349 if (np != 0) { 349 if (np != 0) {
350 const unsigned int *fp; 350 const unsigned int *fp;
351 351
352 fp = get_property(np, "clock-frequency", NULL); 352 fp = of_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
@@ -384,7 +384,7 @@ mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
384 384
385 root = of_find_node_by_path("/"); 385 root = of_find_node_by_path("/");
386 if (root) 386 if (root)
387 model = get_property(root, "model", NULL); 387 model = of_get_property(root, "model", NULL);
388 seq_printf(m, "Machine\t\t: %s\n", model); 388 seq_printf(m, "Machine\t\t: %s\n", model);
389 of_node_put(root); 389 of_node_put(root);
390 390
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c
index 481e18ed5be9..8235c562661f 100644
--- a/arch/powerpc/platforms/86xx/pci.c
+++ b/arch/powerpc/platforms/86xx/pci.c
@@ -22,9 +22,9 @@
22#include <asm/atomic.h> 22#include <asm/atomic.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/prom.h> 24#include <asm/prom.h>
25#include <asm/immap_86xx.h>
26#include <asm/pci-bridge.h> 25#include <asm/pci-bridge.h>
27#include <sysdev/fsl_soc.h> 26#include <sysdev/fsl_soc.h>
27#include <sysdev/fsl_pcie.h>
28 28
29#include "mpc86xx.h" 29#include "mpc86xx.h"
30 30
@@ -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 = get_property(dev, "bus-range", &len); 166 bus_range = of_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/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index beea6834bb7e..39bb8c5ebe70 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -1,6 +1,3 @@
1menu "Platform support"
2 depends on PPC_8xx
3
4config FADS 1config FADS
5 bool 2 bool
6 3
@@ -9,6 +6,7 @@ config CPM1
9 6
10choice 7choice
11 prompt "8xx Machine Type" 8 prompt "8xx Machine Type"
9 depends on PPC_8xx
12 depends on 8xx 10 depends on 8xx
13 default MPC885ADS 11 default MPC885ADS
14 12
@@ -36,38 +34,36 @@ config MPC885ADS
36endchoice 34endchoice
37 35
38menu "Freescale Ethernet driver platform-specific options" 36menu "Freescale Ethernet driver platform-specific options"
39 depends on (FS_ENET && MPC885ADS) 37 depends on (FS_ENET && MPC885ADS)
40
41 config MPC8xx_SECOND_ETH
42 bool "Second Ethernet channel"
43 depends on MPC885ADS
44 default y
45 help
46 This enables support for second Ethernet on MPC885ADS and MPC86xADS boards.
47 The latter will use SCC1, for 885ADS you can select it below.
48
49 choice
50 prompt "Second Ethernet channel"
51 depends on MPC8xx_SECOND_ETH
52 default MPC8xx_SECOND_ETH_FEC2
53
54 config MPC8xx_SECOND_ETH_FEC2
55 bool "FEC2"
56 depends on MPC885ADS
57 help
58 Enable FEC2 to serve as 2-nd Ethernet channel. Note that SMC2
59 (often 2-nd UART) will not work if this is enabled.
60
61 config MPC8xx_SECOND_ETH_SCC3
62 bool "SCC3"
63 depends on MPC885ADS
64 help
65 Enable SCC3 to serve as 2-nd Ethernet channel. Note that SMC1
66 (often 1-nd UART) will not work if this is enabled.
67
68 endchoice
69 38
70endmenu 39 config MPC8xx_SECOND_ETH
40 bool "Second Ethernet channel"
41 depends on MPC885ADS
42 default y
43 help
44 This enables support for second Ethernet on MPC885ADS and MPC86xADS boards.
45 The latter will use SCC1, for 885ADS you can select it below.
46
47 choice
48 prompt "Second Ethernet channel"
49 depends on MPC8xx_SECOND_ETH
50 default MPC8xx_SECOND_ETH_FEC2
51
52 config MPC8xx_SECOND_ETH_FEC2
53 bool "FEC2"
54 depends on MPC885ADS
55 help
56 Enable FEC2 to serve as 2-nd Ethernet channel. Note that SMC2
57 (often 2-nd UART) will not work if this is enabled.
58
59 config MPC8xx_SECOND_ETH_SCC3
60 bool "SCC3"
61 depends on MPC885ADS
62 help
63 Enable SCC3 to serve as 2-nd Ethernet channel. Note that SMC1
64 (often 1-nd UART) will not work if this is enabled.
65
66 endchoice
71 67
72endmenu 68endmenu
73 69
@@ -98,7 +94,7 @@ config 8xx_CPU6
98 require workarounds for Linux (and most other OSes to work). If you 94 require workarounds for Linux (and most other OSes to work). If you
99 get a BUG() very early in boot, this might fix the problem. For 95 get a BUG() very early in boot, this might fix the problem. For
100 more details read the document entitled "MPC860 Family Device Errata 96 more details read the document entitled "MPC860 Family Device Errata
101 Reference" on Motorola's website. This option also incurs a 97 Reference" on Freescale's website. This option also incurs a
102 performance hit. 98 performance hit.
103 99
104 If in doubt, say N here. 100 If in doubt, say N here.
@@ -135,4 +131,3 @@ config UCODE_PATCH
135 depends on !NO_UCODE_PATCH 131 depends on !NO_UCODE_PATCH
136 132
137endmenu 133endmenu
138
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c
index 9ed7125f0150..0901dbada350 100644
--- a/arch/powerpc/platforms/8xx/m8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -85,17 +85,17 @@ init_internal_rtc(void)
85static int __init get_freq(char *name, unsigned long *val) 85static int __init get_freq(char *name, unsigned long *val)
86{ 86{
87 struct device_node *cpu; 87 struct device_node *cpu;
88 unsigned int *fp; 88 const unsigned int *fp;
89 int found = 0; 89 int found = 0;
90 90
91 /* The cpu node should have timebase and clock frequency properties */ 91 /* The cpu node should have timebase and clock frequency properties */
92 cpu = of_find_node_by_type(NULL, "cpu"); 92 cpu = of_find_node_by_type(NULL, "cpu");
93 93
94 if (cpu) { 94 if (cpu) {
95 fp = (unsigned int *)get_property(cpu, name, NULL); 95 fp = of_get_property(cpu, name, NULL);
96 if (fp) { 96 if (fp) {
97 found = 1; 97 found = 1;
98 *val = *fp++; 98 *val = *fp;
99 } 99 }
100 100
101 of_node_put(cpu); 101 of_node_put(cpu);
@@ -262,7 +262,7 @@ void mpc8xx_show_cpuinfo(struct seq_file *m)
262 262
263 root = of_find_node_by_path("/"); 263 root = of_find_node_by_path("/");
264 if (root) 264 if (root)
265 model = get_property(root, "model", NULL); 265 model = of_get_property(root, "model", NULL);
266 seq_printf(m, "Machine\t\t: %s\n", model); 266 seq_printf(m, "Machine\t\t: %s\n", model);
267 of_node_put(root); 267 of_node_put(root);
268 268
diff --git a/arch/powerpc/platforms/8xx/mpc86xads.h b/arch/powerpc/platforms/8xx/mpc86xads.h
index b5d19dd0619c..59bad2f9ae51 100644
--- a/arch/powerpc/platforms/8xx/mpc86xads.h
+++ b/arch/powerpc/platforms/8xx/mpc86xads.h
@@ -37,7 +37,7 @@
37#define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET) 37#define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET)
38#define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver 38#define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver
39 39
40#define PCMCIA_MEM_ADDR (uint)0xff020000) 40#define PCMCIA_MEM_ADDR ((uint)0xff020000)
41#define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) 41#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
42 42
43/* Bits of interest in the BCSRs. 43/* Bits of interest in the BCSRs.
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
index ef52ce701b0e..a35315af5c53 100644
--- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
@@ -247,7 +247,7 @@ void init_smc_ioports(struct fs_uart_platform_info *data)
247 } 247 }
248} 248}
249 249
250int platform_device_skip(char *model, int id) 250int platform_device_skip(const char *model, int id)
251{ 251{
252 return 0; 252 return 0;
253} 253}
@@ -260,7 +260,7 @@ static void __init mpc86xads_setup_arch(void)
260 if (cpu != 0) { 260 if (cpu != 0) {
261 const unsigned int *fp; 261 const unsigned int *fp;
262 262
263 fp = get_property(cpu, "clock-frequency", NULL); 263 fp = of_get_property(cpu, "clock-frequency", NULL);
264 if (fp != 0) 264 if (fp != 0)
265 loops_per_jiffy = *fp / HZ; 265 loops_per_jiffy = *fp / HZ;
266 else 266 else
diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h
index 30cbebfe84c5..7c31aec284c2 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads.h
+++ b/arch/powerpc/platforms/8xx/mpc885ads.h
@@ -37,7 +37,7 @@
37#define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET) 37#define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET)
38#define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver 38#define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver
39 39
40#define PCMCIA_MEM_ADDR (uint)0xff020000) 40#define PCMCIA_MEM_ADDR ((uint)0xff020000)
41#define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) 41#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
42 42
43/* Bits of interest in the BCSRs. 43/* Bits of interest in the BCSRs.
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index c5fefdf66c0a..a57b57785acd 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -322,7 +322,7 @@ void init_smc_ioports(struct fs_uart_platform_info *data)
322 } 322 }
323} 323}
324 324
325int platform_device_skip(char *model, int id) 325int platform_device_skip(const char *model, int id)
326{ 326{
327#ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 327#ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3
328 const char *dev = "FEC"; 328 const char *dev = "FEC";
@@ -346,7 +346,7 @@ static void __init mpc885ads_setup_arch(void)
346 if (cpu != 0) { 346 if (cpu != 0) {
347 const unsigned int *fp; 347 const unsigned int *fp;
348 348
349 fp = get_property(cpu, "clock-frequency", NULL); 349 fp = of_get_property(cpu, "clock-frequency", NULL);
350 if (fp != 0) 350 if (fp != 0)
351 loops_per_jiffy = *fp / HZ; 351 loops_per_jiffy = *fp / HZ;
352 else 352 else
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
new file mode 100644
index 000000000000..51e33347c147
--- /dev/null
+++ b/arch/powerpc/platforms/Kconfig
@@ -0,0 +1,259 @@
1menu "Platform support"
2
3choice
4 prompt "Machine type"
5 depends on PPC64 || CLASSIC32
6 default PPC_MULTIPLATFORM
7
8config PPC_MULTIPLATFORM
9 bool "Generic desktop/server/laptop"
10 help
11 Select this option if configuring for an IBM pSeries or
12 RS/6000 machine, an Apple machine, or a PReP, CHRP,
13 Maple or Cell-based machine.
14
15config EMBEDDED6xx
16 bool "Embedded 6xx/7xx/7xxx-based board"
17 depends on PPC32 && (BROKEN||BROKEN_ON_SMP)
18
19config APUS
20 bool "Amiga-APUS"
21 depends on PPC32 && BROKEN
22 help
23 Select APUS if configuring for a PowerUP Amiga.
24 More information is available at:
25 <http://linux-apus.sourceforge.net/>.
26endchoice
27
28source "arch/powerpc/platforms/pseries/Kconfig"
29source "arch/powerpc/platforms/iseries/Kconfig"
30source "arch/powerpc/platforms/chrp/Kconfig"
31source "arch/powerpc/platforms/52xx/Kconfig"
32source "arch/powerpc/platforms/powermac/Kconfig"
33source "arch/powerpc/platforms/prep/Kconfig"
34source "arch/powerpc/platforms/maple/Kconfig"
35source "arch/powerpc/platforms/pasemi/Kconfig"
36source "arch/powerpc/platforms/celleb/Kconfig"
37source "arch/powerpc/platforms/ps3/Kconfig"
38source "arch/powerpc/platforms/cell/Kconfig"
39source "arch/powerpc/platforms/8xx/Kconfig"
40source "arch/powerpc/platforms/82xx/Kconfig"
41source "arch/powerpc/platforms/83xx/Kconfig"
42source "arch/powerpc/platforms/85xx/Kconfig"
43source "arch/powerpc/platforms/86xx/Kconfig"
44source "arch/powerpc/platforms/embedded6xx/Kconfig"
45#source "arch/powerpc/platforms/4xx/Kconfig
46
47config PPC_NATIVE
48 bool
49 depends on PPC_MULTIPLATFORM
50 help
51 Support for running natively on the hardware, i.e. without
52 a hypervisor. This option is not user-selectable but should
53 be selected by all platforms that need it.
54
55config UDBG_RTAS_CONSOLE
56 bool "RTAS based debug console"
57 depends on PPC_RTAS
58 default n
59
60config PPC_UDBG_BEAT
61 bool "BEAT based debug console"
62 depends on PPC_CELLEB
63 default n
64
65config XICS
66 depends on PPC_PSERIES
67 bool
68 default y
69
70config MPIC
71 bool
72 default n
73
74config MPIC_WEIRD
75 bool
76 default n
77
78config PPC_I8259
79 bool
80 default n
81
82config U3_DART
83 bool
84 depends on PPC_MULTIPLATFORM && PPC64
85 default n
86
87config PPC_RTAS
88 bool
89 default n
90
91config RTAS_ERROR_LOGGING
92 bool
93 depends on PPC_RTAS
94 default n
95
96config RTAS_PROC
97 bool "Proc interface to RTAS"
98 depends on PPC_RTAS
99 default y
100
101config RTAS_FLASH
102 tristate "Firmware flash interface"
103 depends on PPC64 && RTAS_PROC
104
105config PPC_PMI
106 tristate "Support for PMI"
107 depends PPC_IBM_CELL_BLADE
108 help
109 PMI (Platform Management Interrupt) is a way to
110 communicate with the BMC (Baseboard Mangement Controller).
111 It is used in some IBM Cell blades.
112 default m
113
114config MMIO_NVRAM
115 bool
116 default n
117
118config MPIC_U3_HT_IRQS
119 bool
120 depends on PPC_MAPLE
121 default y
122
123config IBMVIO
124 depends on PPC_PSERIES || PPC_ISERIES
125 bool
126 default y
127
128config IBMEBUS
129 depends on PPC_PSERIES
130 bool "Support for GX bus based adapters"
131 help
132 Bus device driver for GX bus based adapters.
133
134config PPC_MPC106
135 bool
136 default n
137
138config PPC_970_NAP
139 bool
140 default n
141
142config PPC_INDIRECT_IO
143 bool
144 select GENERIC_IOMAP
145 default n
146
147config GENERIC_IOMAP
148 bool
149 default n
150
151source "drivers/cpufreq/Kconfig"
152
153menu "CPU Frequency drivers"
154 depends on CPU_FREQ
155
156config CPU_FREQ_PMAC
157 bool "Support for Apple PowerBooks"
158 depends on ADB_PMU && PPC32
159 select CPU_FREQ_TABLE
160 help
161 This adds support for frequency switching on Apple PowerBooks,
162 this currently includes some models of iBook & Titanium
163 PowerBook.
164
165config CPU_FREQ_PMAC64
166 bool "Support for some Apple G5s"
167 depends on PPC_PMAC && PPC64
168 select CPU_FREQ_TABLE
169 help
170 This adds support for frequency switching on Apple iMac G5,
171 and some of the more recent desktop G5 machines as well.
172
173config PPC_PASEMI_CPUFREQ
174 bool "Support for PA Semi PWRficient"
175 depends on PPC_PASEMI
176 default y
177 select CPU_FREQ_TABLE
178 help
179 This adds the support for frequency switching on PA Semi
180 PWRficient processors.
181
182endmenu
183
184config PPC601_SYNC_FIX
185 bool "Workarounds for PPC601 bugs"
186 depends on 6xx && (PPC_PREP || PPC_PMAC)
187 help
188 Some versions of the PPC601 (the first PowerPC chip) have bugs which
189 mean that extra synchronization instructions are required near
190 certain instructions, typically those that make major changes to the
191 CPU state. These extra instructions reduce performance slightly.
192 If you say N here, these extra instructions will not be included,
193 resulting in a kernel which will run faster but may not run at all
194 on some systems with the PPC601 chip.
195
196 If in doubt, say Y here.
197
198config TAU
199 bool "On-chip CPU temperature sensor support"
200 depends on CLASSIC32
201 help
202 G3 and G4 processors have an on-chip temperature sensor called the
203 'Thermal Assist Unit (TAU)', which, in theory, can measure the on-die
204 temperature within 2-4 degrees Celsius. This option shows the current
205 on-die temperature in /proc/cpuinfo if the cpu supports it.
206
207 Unfortunately, on some chip revisions, this sensor is very inaccurate
208 and in many cases, does not work at all, so don't assume the cpu
209 temp is actually what /proc/cpuinfo says it is.
210
211config TAU_INT
212 bool "Interrupt driven TAU driver (DANGEROUS)"
213 depends on TAU
214 ---help---
215 The TAU supports an interrupt driven mode which causes an interrupt
216 whenever the temperature goes out of range. This is the fastest way
217 to get notified the temp has exceeded a range. With this option off,
218 a timer is used to re-check the temperature periodically.
219
220 However, on some cpus it appears that the TAU interrupt hardware
221 is buggy and can cause a situation which would lead unexplained hard
222 lockups.
223
224 Unless you are extending the TAU driver, or enjoy kernel/hardware
225 debugging, leave this option off.
226
227config TAU_AVERAGE
228 bool "Average high and low temp"
229 depends on TAU
230 ---help---
231 The TAU hardware can compare the temperature to an upper and lower
232 bound. The default behavior is to show both the upper and lower
233 bound in /proc/cpuinfo. If the range is large, the temperature is
234 either changing a lot, or the TAU hardware is broken (likely on some
235 G4's). If the range is small (around 4 degrees), the temperature is
236 relatively stable. If you say Y here, a single temperature value,
237 halfway between the upper and lower bounds, will be reported in
238 /proc/cpuinfo.
239
240 If in doubt, say N here.
241
242config QUICC_ENGINE
243 bool
244 help
245 The QUICC Engine (QE) is a new generation of communications
246 coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
247 Selecting this option means that you wish to build a kernel
248 for a machine with a QE coprocessor.
249
250config CPM2
251 bool
252 default n
253 help
254 The CPM2 (Communications Processor Module) is a coprocessor on
255 embedded CPUs made by Freescale. Selecting this option means that
256 you wish to build a kernel for a machine with a CPM2 coprocessor
257 on it (826x, 827x, 8560).
258
259endmenu
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 06a85b704331..82551770917c 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -1,3 +1,26 @@
1config PPC_CELL
2 bool
3 default n
4
5config PPC_CELL_NATIVE
6 bool
7 select PPC_CELL
8 select PPC_DCR_MMIO
9 select PPC_OF_PLATFORM_PCI
10 select PPC_INDIRECT_IO
11 select PPC_NATIVE
12 select MPIC
13 default n
14
15config PPC_IBM_CELL_BLADE
16 bool "IBM Cell Blade"
17 depends on PPC_MULTIPLATFORM && PPC64
18 select PPC_CELL_NATIVE
19 select PPC_RTAS
20 select MMIO_NVRAM
21 select PPC_UDBG_16550
22 select UDBG_RTAS_CONSOLE
23
1menu "Cell Broadband Engine options" 24menu "Cell Broadband Engine options"
2 depends on PPC_CELL 25 depends on PPC_CELL
3 26
@@ -18,6 +41,7 @@ config SPU_BASE
18 41
19config CBE_RAS 42config CBE_RAS
20 bool "RAS features for bare metal Cell BE" 43 bool "RAS features for bare metal Cell BE"
44 depends on PPC_CELL_NATIVE
21 default y 45 default y
22 46
23config CBE_THERM 47config CBE_THERM
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c
index a3850fd1e94c..f9ac3fe3be97 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -25,9 +25,12 @@
25 25
26#include <asm/hw_irq.h> 26#include <asm/hw_irq.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/machdep.h>
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/prom.h> 30#include <asm/prom.h>
30#include <asm/time.h> 31#include <asm/time.h>
32#include <asm/pmi.h>
33#include <asm/of_platform.h>
31 34
32#include "cbe_regs.h" 35#include "cbe_regs.h"
33 36
@@ -68,6 +71,38 @@ static u64 MIC_Slow_Next_Timer_table[] = {
68 * hardware specific functions 71 * hardware specific functions
69 */ 72 */
70 73
74static struct of_device *pmi_dev;
75
76static int set_pmode_pmi(int cpu, unsigned int pmode)
77{
78 int ret;
79 pmi_message_t pmi_msg;
80#ifdef DEBUG
81 u64 time;
82#endif
83
84 pmi_msg.type = PMI_TYPE_FREQ_CHANGE;
85 pmi_msg.data1 = cbe_cpu_to_node(cpu);
86 pmi_msg.data2 = pmode;
87
88#ifdef DEBUG
89 time = (u64) get_cycles();
90#endif
91
92 pmi_send_message(pmi_dev, pmi_msg);
93 ret = pmi_msg.data2;
94
95 pr_debug("PMI returned slow mode %d\n", ret);
96
97#ifdef DEBUG
98 time = (u64) get_cycles() - time; /* actual cycles (not cpu cycles!) */
99 time = 1000000000 * time / CLOCK_TICK_RATE; /* time in ns (10^-9) */
100 pr_debug("had to wait %lu ns for a transition\n", time);
101#endif
102 return ret;
103}
104
105
71static int get_pmode(int cpu) 106static int get_pmode(int cpu)
72{ 107{
73 int ret; 108 int ret;
@@ -79,7 +114,7 @@ static int get_pmode(int cpu)
79 return ret; 114 return ret;
80} 115}
81 116
82static int set_pmode(int cpu, unsigned int pmode) 117static int set_pmode_reg(int cpu, unsigned int pmode)
83{ 118{
84 struct cbe_pmd_regs __iomem *pmd_regs; 119 struct cbe_pmd_regs __iomem *pmd_regs;
85 struct cbe_mic_tm_regs __iomem *mic_tm_regs; 120 struct cbe_mic_tm_regs __iomem *mic_tm_regs;
@@ -120,37 +155,71 @@ static int set_pmode(int cpu, unsigned int pmode)
120 return 0; 155 return 0;
121} 156}
122 157
158static int set_pmode(int cpu, unsigned int slow_mode) {
159 if (pmi_dev)
160 return set_pmode_pmi(cpu, slow_mode);
161 else
162 return set_pmode_reg(cpu, slow_mode);
163}
164
165static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
166{
167 struct cpufreq_policy policy;
168 u8 cpu;
169 u8 cbe_pmode_new;
170
171 BUG_ON(pmi_msg.type != PMI_TYPE_FREQ_CHANGE);
172
173 cpu = cbe_node_to_cpu(pmi_msg.data1);
174 cbe_pmode_new = pmi_msg.data2;
175
176 cpufreq_get_policy(&policy, cpu);
177
178 policy.max = min(policy.max, cbe_freqs[cbe_pmode_new].frequency);
179 policy.min = min(policy.min, policy.max);
180
181 pr_debug("cbe_handle_pmi: new policy.min=%d policy.max=%d\n", policy.min, policy.max);
182 cpufreq_set_policy(&policy);
183}
184
185static struct pmi_handler cbe_pmi_handler = {
186 .type = PMI_TYPE_FREQ_CHANGE,
187 .handle_pmi_message = cbe_cpufreq_handle_pmi,
188};
189
190
123/* 191/*
124 * cpufreq functions 192 * cpufreq functions
125 */ 193 */
126 194
127static int cbe_cpufreq_cpu_init (struct cpufreq_policy *policy) 195static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
128{ 196{
129 u32 *max_freq; 197 const u32 *max_freqp;
198 u32 max_freq;
130 int i, cur_pmode; 199 int i, cur_pmode;
131 struct device_node *cpu; 200 struct device_node *cpu;
132 201
133 cpu = of_get_cpu_node(policy->cpu, NULL); 202 cpu = of_get_cpu_node(policy->cpu, NULL);
134 203
135 if(!cpu) 204 if (!cpu)
136 return -ENODEV; 205 return -ENODEV;
137 206
138 pr_debug("init cpufreq on CPU %d\n", policy->cpu); 207 pr_debug("init cpufreq on CPU %d\n", policy->cpu);
139 208
140 max_freq = (u32*) get_property(cpu, "clock-frequency", NULL); 209 max_freqp = of_get_property(cpu, "clock-frequency", NULL);
141 210
142 if(!max_freq) 211 if (!max_freqp)
143 return -EINVAL; 212 return -EINVAL;
144 213
145 // we need the freq in kHz 214 /* we need the freq in kHz */
146 *max_freq /= 1000; 215 max_freq = *max_freqp / 1000;
147 216
148 pr_debug("max clock-frequency is at %u kHz\n", *max_freq); 217 pr_debug("max clock-frequency is at %u kHz\n", max_freq);
149 pr_debug("initializing frequency table\n"); 218 pr_debug("initializing frequency table\n");
150 219
151 // initialize frequency table 220 /* initialize frequency table */
152 for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) { 221 for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
153 cbe_freqs[i].frequency = *max_freq / cbe_freqs[i].index; 222 cbe_freqs[i].frequency = max_freq / cbe_freqs[i].index;
154 pr_debug("%d: %d\n", i, cbe_freqs[i].frequency); 223 pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
155 } 224 }
156 225
@@ -167,10 +236,10 @@ static int cbe_cpufreq_cpu_init (struct cpufreq_policy *policy)
167 policy->cpus = cpu_sibling_map[policy->cpu]; 236 policy->cpus = cpu_sibling_map[policy->cpu];
168#endif 237#endif
169 238
170 cpufreq_frequency_table_get_attr (cbe_freqs, policy->cpu); 239 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
171 240
172 /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ 241 /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */
173 return cpufreq_frequency_table_cpuinfo (policy, cbe_freqs); 242 return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs);
174} 243}
175 244
176static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) 245static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
@@ -202,7 +271,7 @@ static int cbe_cpufreq_target(struct cpufreq_policy *policy, unsigned int target
202 freqs.new = cbe_freqs[cbe_pmode_new].frequency; 271 freqs.new = cbe_freqs[cbe_pmode_new].frequency;
203 freqs.cpu = policy->cpu; 272 freqs.cpu = policy->cpu;
204 273
205 mutex_lock (&cbe_switch_mutex); 274 mutex_lock(&cbe_switch_mutex);
206 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 275 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
207 276
208 pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n", 277 pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n",
@@ -233,11 +302,26 @@ static struct cpufreq_driver cbe_cpufreq_driver = {
233 302
234static int __init cbe_cpufreq_init(void) 303static int __init cbe_cpufreq_init(void)
235{ 304{
305 struct device_node *np;
306
307 if (!machine_is(cell))
308 return -ENODEV;
309
310 np = of_find_node_by_type(NULL, "ibm,pmi");
311
312 pmi_dev = of_find_device_by_node(np);
313
314 if (pmi_dev)
315 pmi_register_handler(pmi_dev, &cbe_pmi_handler);
316
236 return cpufreq_register_driver(&cbe_cpufreq_driver); 317 return cpufreq_register_driver(&cbe_cpufreq_driver);
237} 318}
238 319
239static void __exit cbe_cpufreq_exit(void) 320static void __exit cbe_cpufreq_exit(void)
240{ 321{
322 if (pmi_dev)
323 pmi_unregister_handler(pmi_dev, &cbe_pmi_handler);
324
241 cpufreq_unregister_driver(&cbe_cpufreq_driver); 325 cpufreq_unregister_driver(&cbe_cpufreq_driver);
242} 326}
243 327
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platforms/cell/cbe_regs.c
index 9a0ee62691d5..12c9674b4b1f 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.c
+++ b/arch/powerpc/platforms/cell/cbe_regs.c
@@ -14,6 +14,8 @@
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15#include <asm/prom.h> 15#include <asm/prom.h>
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/of_device.h>
18#include <asm/of_platform.h>
17 19
18#include "cbe_regs.h" 20#include "cbe_regs.h"
19 21
@@ -27,6 +29,7 @@
27static struct cbe_regs_map 29static struct cbe_regs_map
28{ 30{
29 struct device_node *cpu_node; 31 struct device_node *cpu_node;
32 struct device_node *be_node;
30 struct cbe_pmd_regs __iomem *pmd_regs; 33 struct cbe_pmd_regs __iomem *pmd_regs;
31 struct cbe_iic_regs __iomem *iic_regs; 34 struct cbe_iic_regs __iomem *iic_regs;
32 struct cbe_mic_tm_regs __iomem *mic_tm_regs; 35 struct cbe_mic_tm_regs __iomem *mic_tm_regs;
@@ -37,30 +40,43 @@ static int cbe_regs_map_count;
37static struct cbe_thread_map 40static struct cbe_thread_map
38{ 41{
39 struct device_node *cpu_node; 42 struct device_node *cpu_node;
43 struct device_node *be_node;
40 struct cbe_regs_map *regs; 44 struct cbe_regs_map *regs;
45 unsigned int thread_id;
46 unsigned int cbe_id;
41} cbe_thread_map[NR_CPUS]; 47} cbe_thread_map[NR_CPUS];
42 48
49static cpumask_t cbe_local_mask[MAX_CBE] = { [0 ... MAX_CBE-1] = CPU_MASK_NONE };
50static cpumask_t cbe_first_online_cpu = CPU_MASK_NONE;
51
43static struct cbe_regs_map *cbe_find_map(struct device_node *np) 52static struct cbe_regs_map *cbe_find_map(struct device_node *np)
44{ 53{
45 int i; 54 int i;
46 struct device_node *tmp_np; 55 struct device_node *tmp_np;
47 56
48 if (strcasecmp(np->type, "spe") == 0) { 57 if (strcasecmp(np->type, "spe")) {
49 if (np->data == NULL) { 58 for (i = 0; i < cbe_regs_map_count; i++)
50 /* walk up path until cpu node was found */ 59 if (cbe_regs_maps[i].cpu_node == np ||
51 tmp_np = np->parent; 60 cbe_regs_maps[i].be_node == np)
52 while (tmp_np != NULL && strcasecmp(tmp_np->type, "cpu") != 0) 61 return &cbe_regs_maps[i];
53 tmp_np = tmp_np->parent; 62 return NULL;
63 }
54 64
55 np->data = cbe_find_map(tmp_np); 65 if (np->data)
56 }
57 return np->data; 66 return np->data;
58 }
59 67
60 for (i = 0; i < cbe_regs_map_count; i++) 68 /* walk up path until cpu or be node was found */
61 if (cbe_regs_maps[i].cpu_node == np) 69 tmp_np = np;
62 return &cbe_regs_maps[i]; 70 do {
63 return NULL; 71 tmp_np = tmp_np->parent;
72 /* on a correct devicetree we wont get up to root */
73 BUG_ON(!tmp_np);
74 } while (strcasecmp(tmp_np->type, "cpu") &&
75 strcasecmp(tmp_np->type, "be"));
76
77 np->data = cbe_find_map(tmp_np);
78
79 return np->data;
64} 80}
65 81
66struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np) 82struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np)
@@ -130,38 +146,105 @@ struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu)
130} 146}
131EXPORT_SYMBOL_GPL(cbe_get_cpu_mic_tm_regs); 147EXPORT_SYMBOL_GPL(cbe_get_cpu_mic_tm_regs);
132 148
133/* FIXME
134 * This is little more than a stub at the moment. It should be
135 * fleshed out so that it works for both SMT and non-SMT, no
136 * matter if the passed cpu is odd or even.
137 * For SMT enabled, returns 0 for even-numbered cpu; otherwise 1.
138 * For SMT disabled, returns 0 for all cpus.
139 */
140u32 cbe_get_hw_thread_id(int cpu) 149u32 cbe_get_hw_thread_id(int cpu)
141{ 150{
142 return (cpu & 1); 151 return cbe_thread_map[cpu].thread_id;
143} 152}
144EXPORT_SYMBOL_GPL(cbe_get_hw_thread_id); 153EXPORT_SYMBOL_GPL(cbe_get_hw_thread_id);
145 154
146void __init cbe_regs_init(void) 155u32 cbe_cpu_to_node(int cpu)
147{ 156{
148 int i; 157 return cbe_thread_map[cpu].cbe_id;
149 struct device_node *cpu; 158}
159EXPORT_SYMBOL_GPL(cbe_cpu_to_node);
150 160
151 /* Build local fast map of CPUs */ 161u32 cbe_node_to_cpu(int node)
152 for_each_possible_cpu(i) 162{
153 cbe_thread_map[i].cpu_node = of_get_cpu_node(i, NULL); 163 return find_first_bit( (unsigned long *) &cbe_local_mask[node], sizeof(cpumask_t));
164}
165EXPORT_SYMBOL_GPL(cbe_node_to_cpu);
154 166
155 /* Find maps for each device tree CPU */ 167static struct device_node *cbe_get_be_node(int cpu_id)
156 for_each_node_by_type(cpu, "cpu") { 168{
157 struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++]; 169 struct device_node *np;
170
171 for_each_node_by_type (np, "be") {
172 int len,i;
173 const phandle *cpu_handle;
174
175 cpu_handle = of_get_property(np, "cpus", &len);
176
177 for (i=0; i<len; i++)
178 if (of_find_node_by_phandle(cpu_handle[i]) == of_get_cpu_node(cpu_id, NULL))
179 return np;
180 }
181
182 return NULL;
183}
184
185void __init cbe_fill_regs_map(struct cbe_regs_map *map)
186{
187 if(map->be_node) {
188 struct device_node *be, *np;
189
190 be = map->be_node;
191
192 for_each_node_by_type(np, "pervasive")
193 if (of_get_parent(np) == be)
194 map->pmd_regs = of_iomap(np, 0);
195
196 for_each_node_by_type(np, "CBEA-Internal-Interrupt-Controller")
197 if (of_get_parent(np) == be)
198 map->iic_regs = of_iomap(np, 2);
158 199
200 for_each_node_by_type(np, "mic-tm")
201 if (of_get_parent(np) == be)
202 map->mic_tm_regs = of_iomap(np, 0);
203 } else {
204 struct device_node *cpu;
159 /* That hack must die die die ! */ 205 /* That hack must die die die ! */
160 const struct address_prop { 206 const struct address_prop {
161 unsigned long address; 207 unsigned long address;
162 unsigned int len; 208 unsigned int len;
163 } __attribute__((packed)) *prop; 209 } __attribute__((packed)) *prop;
164 210
211 cpu = map->cpu_node;
212
213 prop = of_get_property(cpu, "pervasive", NULL);
214 if (prop != NULL)
215 map->pmd_regs = ioremap(prop->address, prop->len);
216
217 prop = of_get_property(cpu, "iic", NULL);
218 if (prop != NULL)
219 map->iic_regs = ioremap(prop->address, prop->len);
220
221 prop = of_get_property(cpu, "mic-tm", NULL);
222 if (prop != NULL)
223 map->mic_tm_regs = ioremap(prop->address, prop->len);
224 }
225}
226
227
228void __init cbe_regs_init(void)
229{
230 int i;
231 unsigned int thread_id;
232 struct device_node *cpu;
233
234 /* Build local fast map of CPUs */
235 for_each_possible_cpu(i) {
236 cbe_thread_map[i].cpu_node = of_get_cpu_node(i, &thread_id);
237 cbe_thread_map[i].be_node = cbe_get_be_node(i);
238 cbe_thread_map[i].thread_id = thread_id;
239 }
240
241 /* Find maps for each device tree CPU */
242 for_each_node_by_type(cpu, "cpu") {
243 struct cbe_regs_map *map;
244 unsigned int cbe_id;
245
246 cbe_id = cbe_regs_map_count++;
247 map = &cbe_regs_maps[cbe_id];
165 248
166 if (cbe_regs_map_count > MAX_CBE) { 249 if (cbe_regs_map_count > MAX_CBE) {
167 printk(KERN_ERR "cbe_regs: More BE chips than supported" 250 printk(KERN_ERR "cbe_regs: More BE chips than supported"
@@ -170,22 +253,21 @@ void __init cbe_regs_init(void)
170 return; 253 return;
171 } 254 }
172 map->cpu_node = cpu; 255 map->cpu_node = cpu;
173 for_each_possible_cpu(i)
174 if (cbe_thread_map[i].cpu_node == cpu)
175 cbe_thread_map[i].regs = map;
176 256
177 prop = get_property(cpu, "pervasive", NULL); 257 for_each_possible_cpu(i) {
178 if (prop != NULL) 258 struct cbe_thread_map *thread = &cbe_thread_map[i];
179 map->pmd_regs = ioremap(prop->address, prop->len);
180 259
181 prop = get_property(cpu, "iic", NULL); 260 if (thread->cpu_node == cpu) {
182 if (prop != NULL) 261 thread->regs = map;
183 map->iic_regs = ioremap(prop->address, prop->len); 262 thread->cbe_id = cbe_id;
263 map->be_node = thread->be_node;
264 cpu_set(i, cbe_local_mask[cbe_id]);
265 if(thread->thread_id == 0)
266 cpu_set(i, cbe_first_online_cpu);
267 }
268 }
184 269
185 prop = (struct address_prop *)get_property(cpu, "mic-tm", 270 cbe_fill_regs_map(map);
186 NULL);
187 if (prop != NULL)
188 map->mic_tm_regs = ioremap(prop->address, prop->len);
189 } 271 }
190} 272}
191 273
diff --git a/arch/powerpc/platforms/cell/cbe_regs.h b/arch/powerpc/platforms/cell/cbe_regs.h
index 440a7ecc66ea..17d597144877 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.h
+++ b/arch/powerpc/platforms/cell/cbe_regs.h
@@ -255,6 +255,11 @@ struct cbe_mic_tm_regs {
255extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np); 255extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);
256extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu); 256extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu);
257 257
258/* some utility functions to deal with SMT */
259extern u32 cbe_get_hw_thread_id(int cpu);
260extern u32 cbe_cpu_to_node(int cpu);
261extern u32 cbe_node_to_cpu(int node);
262
258/* Init this module early */ 263/* Init this module early */
259extern void cbe_regs_init(void); 264extern void cbe_regs_init(void);
260 265
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c
index 70e0d968d30f..f370f0fa6f4c 100644
--- a/arch/powerpc/platforms/cell/cbe_thermal.c
+++ b/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -1,6 +1,31 @@
1/* 1/*
2 * thermal support for the cell processor 2 * thermal support for the cell processor
3 * 3 *
4 * This module adds some sysfs attributes to cpu and spu nodes.
5 * Base for measurements are the digital thermal sensors (DTS)
6 * located on the chip.
7 * The accuracy is 2 degrees, starting from 65 up to 125 degrees celsius
8 * The attributes can be found under
9 * /sys/devices/system/cpu/cpuX/thermal
10 * /sys/devices/system/spu/spuX/thermal
11 *
12 * The following attributes are added for each node:
13 * temperature:
14 * contains the current temperature measured by the DTS
15 * throttle_begin:
16 * throttling begins when temperature is greater or equal to
17 * throttle_begin. Setting this value to 125 prevents throttling.
18 * throttle_end:
19 * throttling is being ceased, if the temperature is lower than
20 * throttle_end. Due to a delay between applying throttling and
21 * a reduced temperature this value should be less than throttle_begin.
22 * A value equal to throttle_begin provides only a very little hysteresis.
23 * throttle_full_stop:
24 * If the temperatrue is greater or equal to throttle_full_stop,
25 * full throttling is applied to the cpu or spu. This value should be
26 * greater than throttle_begin and throttle_end. Setting this value to
27 * 65 prevents the unit from running code at all.
28 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 29 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 * 30 *
6 * Author: Christian Krafft <krafft@de.ibm.com> 31 * Author: Christian Krafft <krafft@de.ibm.com>
@@ -31,6 +56,26 @@
31#include "cbe_regs.h" 56#include "cbe_regs.h"
32#include "spu_priv1_mmio.h" 57#include "spu_priv1_mmio.h"
33 58
59#define TEMP_MIN 65
60#define TEMP_MAX 125
61
62#define SYSDEV_PREFIX_ATTR(_prefix,_name,_mode) \
63struct sysdev_attribute attr_ ## _prefix ## _ ## _name = { \
64 .attr = { .name = __stringify(_name), .mode = _mode }, \
65 .show = _prefix ## _show_ ## _name, \
66 .store = _prefix ## _store_ ## _name, \
67};
68
69static inline u8 reg_to_temp(u8 reg_value)
70{
71 return ((reg_value & 0x3f) << 1) + TEMP_MIN;
72}
73
74static inline u8 temp_to_reg(u8 temp)
75{
76 return ((temp - TEMP_MIN) >> 1) & 0x3f;
77}
78
34static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) 79static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev)
35{ 80{
36 struct spu *spu; 81 struct spu *spu;
@@ -43,14 +88,14 @@ static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev)
43/* returns the value for a given spu in a given register */ 88/* returns the value for a given spu in a given register */
44static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg) 89static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg)
45{ 90{
46 unsigned int *id; 91 const unsigned int *id;
47 union spe_reg value; 92 union spe_reg value;
48 struct spu *spu; 93 struct spu *spu;
49 94
50 /* getting the id from the reg attribute will not work on future device-tree layouts 95 /* getting the id from the reg attribute will not work on future device-tree layouts
51 * in future we should store the id to the spu struct and use it here */ 96 * in future we should store the id to the spu struct and use it here */
52 spu = container_of(sysdev, struct spu, sysdev); 97 spu = container_of(sysdev, struct spu, sysdev);
53 id = (unsigned int *)get_property(spu_devnode(spu), "reg", NULL); 98 id = of_get_property(spu_devnode(spu), "reg", NULL);
54 value.val = in_be64(&reg->val); 99 value.val = in_be64(&reg->val);
55 100
56 return value.spe[*id]; 101 return value.spe[*id];
@@ -58,20 +103,81 @@ static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iom
58 103
59static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf) 104static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf)
60{ 105{
61 int value; 106 u8 value;
62 struct cbe_pmd_regs __iomem *pmd_regs; 107 struct cbe_pmd_regs __iomem *pmd_regs;
63 108
64 pmd_regs = get_pmd_regs(sysdev); 109 pmd_regs = get_pmd_regs(sysdev);
65 110
66 value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1); 111 value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1);
67 /* clear all other bits */ 112
113 return sprintf(buf, "%d\n", reg_to_temp(value));
114}
115
116static ssize_t show_throttle(struct cbe_pmd_regs __iomem *pmd_regs, char *buf, int pos)
117{
118 u64 value;
119
120 value = in_be64(&pmd_regs->tm_tpr.val);
121 /* access the corresponding byte */
122 value >>= pos;
68 value &= 0x3F; 123 value &= 0x3F;
69 /* temp is stored in steps of 2 degrees */
70 value *= 2;
71 /* base temp is 65 degrees */
72 value += 65;
73 124
74 return sprintf(buf, "%d\n", (int) value); 125 return sprintf(buf, "%d\n", reg_to_temp(value));
126}
127
128static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos)
129{
130 u64 reg_value;
131 int temp;
132 u64 new_value;
133 int ret;
134
135 ret = sscanf(buf, "%u", &temp);
136
137 if (ret != 1 || temp < TEMP_MIN || temp > TEMP_MAX)
138 return -EINVAL;
139
140 new_value = temp_to_reg(temp);
141
142 reg_value = in_be64(&pmd_regs->tm_tpr.val);
143
144 /* zero out bits for new value */
145 reg_value &= ~(0xffull << pos);
146 /* set bits to new value */
147 reg_value |= new_value << pos;
148
149 out_be64(&pmd_regs->tm_tpr.val, reg_value);
150 return size;
151}
152
153static ssize_t spu_show_throttle_end(struct sys_device *sysdev, char *buf)
154{
155 return show_throttle(get_pmd_regs(sysdev), buf, 0);
156}
157
158static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, char *buf)
159{
160 return show_throttle(get_pmd_regs(sysdev), buf, 8);
161}
162
163static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, char *buf)
164{
165 return show_throttle(get_pmd_regs(sysdev), buf, 16);
166}
167
168static ssize_t spu_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size)
169{
170 return store_throttle(get_pmd_regs(sysdev), buf, size, 0);
171}
172
173static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size)
174{
175 return store_throttle(get_pmd_regs(sysdev), buf, size, 8);
176}
177
178static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size)
179{
180 return store_throttle(get_pmd_regs(sysdev), buf, size, 16);
75} 181}
76 182
77static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) 183static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos)
@@ -82,16 +188,9 @@ static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos)
82 pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); 188 pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id);
83 value = in_be64(&pmd_regs->ts_ctsr2); 189 value = in_be64(&pmd_regs->ts_ctsr2);
84 190
85 /* access the corresponding byte */ 191 value = (value >> pos) & 0x3f;
86 value >>= pos;
87 /* clear all other bits */
88 value &= 0x3F;
89 /* temp is stored in steps of 2 degrees */
90 value *= 2;
91 /* base temp is 65 degrees */
92 value += 65;
93 192
94 return sprintf(buf, "%d\n", (int) value); 193 return sprintf(buf, "%d\n", reg_to_temp(value));
95} 194}
96 195
97 196
@@ -108,13 +207,52 @@ static ssize_t ppe_show_temp1(struct sys_device *sysdev, char *buf)
108 return ppe_show_temp(sysdev, buf, 0); 207 return ppe_show_temp(sysdev, buf, 0);
109} 208}
110 209
210static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, char *buf)
211{
212 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32);
213}
214
215static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, char *buf)
216{
217 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40);
218}
219
220static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, char *buf)
221{
222 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48);
223}
224
225static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size)
226{
227 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32);
228}
229
230static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size)
231{
232 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40);
233}
234
235static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size)
236{
237 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48);
238}
239
240
111static struct sysdev_attribute attr_spu_temperature = { 241static struct sysdev_attribute attr_spu_temperature = {
112 .attr = {.name = "temperature", .mode = 0400 }, 242 .attr = {.name = "temperature", .mode = 0400 },
113 .show = spu_show_temp, 243 .show = spu_show_temp,
114}; 244};
115 245
246static SYSDEV_PREFIX_ATTR(spu, throttle_end, 0600);
247static SYSDEV_PREFIX_ATTR(spu, throttle_begin, 0600);
248static SYSDEV_PREFIX_ATTR(spu, throttle_full_stop, 0600);
249
250
116static struct attribute *spu_attributes[] = { 251static struct attribute *spu_attributes[] = {
117 &attr_spu_temperature.attr, 252 &attr_spu_temperature.attr,
253 &attr_spu_throttle_end.attr,
254 &attr_spu_throttle_begin.attr,
255 &attr_spu_throttle_full_stop.attr,
118 NULL, 256 NULL,
119}; 257};
120 258
@@ -133,9 +271,16 @@ static struct sysdev_attribute attr_ppe_temperature1 = {
133 .show = ppe_show_temp1, 271 .show = ppe_show_temp1,
134}; 272};
135 273
274static SYSDEV_PREFIX_ATTR(ppe, throttle_end, 0600);
275static SYSDEV_PREFIX_ATTR(ppe, throttle_begin, 0600);
276static SYSDEV_PREFIX_ATTR(ppe, throttle_full_stop, 0600);
277
136static struct attribute *ppe_attributes[] = { 278static struct attribute *ppe_attributes[] = {
137 &attr_ppe_temperature0.attr, 279 &attr_ppe_temperature0.attr,
138 &attr_ppe_temperature1.attr, 280 &attr_ppe_temperature1.attr,
281 &attr_ppe_throttle_end.attr,
282 &attr_ppe_throttle_begin.attr,
283 &attr_ppe_throttle_full_stop.attr,
139 NULL, 284 NULL,
140}; 285};
141 286
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 6666d037eb44..4fc4e92775d0 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -261,7 +261,7 @@ static int iic_host_xlate(struct irq_host *h, struct device_node *ct,
261 return -ENODEV; 261 return -ENODEV;
262 if (intsize != 1) 262 if (intsize != 1)
263 return -ENODEV; 263 return -ENODEV;
264 val = get_property(ct, "#interrupt-cells", NULL); 264 val = of_get_property(ct, "#interrupt-cells", NULL);
265 if (val == NULL || *val != 1) 265 if (val == NULL || *val != 1)
266 return -ENODEV; 266 return -ENODEV;
267 267
@@ -327,7 +327,7 @@ static int __init setup_iic(void)
327 if (!device_is_compatible(dn, 327 if (!device_is_compatible(dn,
328 "IBM,CBEA-Internal-Interrupt-Controller")) 328 "IBM,CBEA-Internal-Interrupt-Controller"))
329 continue; 329 continue;
330 np = get_property(dn, "ibm,interrupt-server-ranges", NULL); 330 np = of_get_property(dn, "ibm,interrupt-server-ranges", NULL);
331 if (np == NULL) { 331 if (np == NULL) {
332 printk(KERN_WARNING "IIC: CPU association not found\n"); 332 printk(KERN_WARNING "IIC: CPU association not found\n");
333 of_node_put(dn); 333 of_node_put(dn);
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
index 7c73128305ec..d68d920eb2c4 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.c
+++ b/arch/powerpc/platforms/cell/io-workarounds.c
@@ -318,7 +318,7 @@ static int __init spider_pci_workaround_init(void)
318 */ 318 */
319 list_for_each_entry(phb, &hose_list, list_node) { 319 list_for_each_entry(phb, &hose_list, list_node) {
320 struct device_node *np = phb->arch_data; 320 struct device_node *np = phb->arch_data;
321 const char *model = get_property(np, "model", NULL); 321 const char *model = of_get_property(np, "model", NULL);
322 322
323 /* If no model property or name isn't exactly "pci", skip */ 323 /* If no model property or name isn't exactly "pci", skip */
324 if (model == NULL || strcmp(np->name, "pci")) 324 if (model == NULL || strcmp(np->name, "pci"))
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 67d617b60a23..760caa76841a 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -291,9 +291,9 @@ static int cell_iommu_find_ioc(int nid, unsigned long *base)
291 const unsigned int *nidp; 291 const unsigned int *nidp;
292 const unsigned long *tmp; 292 const unsigned long *tmp;
293 293
294 nidp = get_property(np, "node-id", NULL); 294 nidp = of_get_property(np, "node-id", NULL);
295 if (nidp && *nidp == nid) { 295 if (nidp && *nidp == nid) {
296 tmp = get_property(np, "ioc-translation", NULL); 296 tmp = of_get_property(np, "ioc-translation", NULL);
297 if (tmp) { 297 if (tmp) {
298 *base = *tmp; 298 *base = *tmp;
299 of_node_put(np); 299 of_node_put(np);
@@ -430,7 +430,7 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
430 struct iommu_window *window; 430 struct iommu_window *window;
431 const unsigned int *ioid; 431 const unsigned int *ioid;
432 432
433 ioid = get_property(np, "ioid", NULL); 433 ioid = of_get_property(np, "ioid", NULL);
434 if (ioid == NULL) 434 if (ioid == NULL)
435 printk(KERN_WARNING "iommu: missing ioid for %s using 0\n", 435 printk(KERN_WARNING "iommu: missing ioid for %s using 0\n",
436 np->full_name); 436 np->full_name);
@@ -496,7 +496,7 @@ static void cell_dma_dev_setup(struct device *dev)
496 struct dev_archdata *archdata = &dev->archdata; 496 struct dev_archdata *archdata = &dev->archdata;
497 497
498 /* If we run without iommu, no need to do anything */ 498 /* If we run without iommu, no need to do anything */
499 if (pci_dma_ops == &dma_direct_ops) 499 if (get_pci_dma_ops() == &dma_direct_ops)
500 return; 500 return;
501 501
502 /* Current implementation uses the first window available in that 502 /* Current implementation uses the first window available in that
@@ -530,7 +530,7 @@ static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action,
530 return 0; 530 return 0;
531 531
532 /* We use the PCI DMA ops */ 532 /* We use the PCI DMA ops */
533 dev->archdata.dma_ops = pci_dma_ops; 533 dev->archdata.dma_ops = get_pci_dma_ops();
534 534
535 cell_dma_dev_setup(dev); 535 cell_dma_dev_setup(dev);
536 536
@@ -549,7 +549,7 @@ static int __init cell_iommu_get_window(struct device_node *np,
549 unsigned long index; 549 unsigned long index;
550 550
551 /* Use ibm,dma-window if available, else, hard code ! */ 551 /* Use ibm,dma-window if available, else, hard code ! */
552 dma_window = get_property(np, "ibm,dma-window", NULL); 552 dma_window = of_get_property(np, "ibm,dma-window", NULL);
553 if (dma_window == NULL) { 553 if (dma_window == NULL) {
554 *base = 0; 554 *base = 0;
555 *size = 0x80000000u; 555 *size = 0x80000000u;
@@ -646,7 +646,7 @@ static int __init cell_iommu_init_disabled(void)
646 unsigned long base = 0, size; 646 unsigned long base = 0, size;
647 647
648 /* When no iommu is present, we use direct DMA ops */ 648 /* When no iommu is present, we use direct DMA ops */
649 pci_dma_ops = &dma_direct_ops; 649 set_pci_dma_ops(&dma_direct_ops);
650 650
651 /* First make sure all IOC translation is turned off */ 651 /* First make sure all IOC translation is turned off */
652 cell_disable_iommus(); 652 cell_disable_iommus();
@@ -734,7 +734,7 @@ static int __init cell_iommu_init(void)
734 } 734 }
735 735
736 /* Setup default PCI iommu ops */ 736 /* Setup default PCI iommu ops */
737 pci_dma_ops = &dma_iommu_ops; 737 set_pci_dma_ops(&dma_iommu_ops);
738 738
739 bail: 739 bail:
740 /* Register callbacks on OF platform device addition/removal 740 /* Register callbacks on OF platform device addition/removal
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 0984c7071695..3961a085b432 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -3,11 +3,13 @@
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/smp.h> 5#include <linux/smp.h>
6#include <linux/reboot.h>
6 7
7#include <asm/reg.h> 8#include <asm/reg.h>
8#include <asm/io.h> 9#include <asm/io.h>
9#include <asm/prom.h> 10#include <asm/prom.h>
10#include <asm/machdep.h> 11#include <asm/machdep.h>
12#include <asm/rtas.h>
11 13
12#include "ras.h" 14#include "ras.h"
13#include "cbe_regs.h" 15#include "cbe_regs.h"
@@ -82,6 +84,164 @@ static int cbe_machine_check_handler(struct pt_regs *regs)
82 return 0; 84 return 0;
83} 85}
84 86
87struct ptcal_area {
88 struct list_head list;
89 int nid;
90 int order;
91 struct page *pages;
92};
93
94static LIST_HEAD(ptcal_list);
95
96static int ptcal_start_tok, ptcal_stop_tok;
97
98static int __init cbe_ptcal_enable_on_node(int nid, int order)
99{
100 struct ptcal_area *area;
101 int ret = -ENOMEM;
102 unsigned long addr;
103
104#ifdef CONFIG_CRASH_DUMP
105 rtas_call(ptcal_stop_tok, 1, 1, NULL, nid);
106#endif
107
108 area = kmalloc(sizeof(*area), GFP_KERNEL);
109 if (!area)
110 goto out_err;
111
112 area->nid = nid;
113 area->order = order;
114 area->pages = alloc_pages_node(area->nid, GFP_KERNEL, area->order);
115
116 if (!area->pages)
117 goto out_free_area;
118
119 addr = __pa(page_address(area->pages));
120
121 ret = -EIO;
122 if (rtas_call(ptcal_start_tok, 3, 1, NULL, area->nid,
123 (unsigned int)(addr >> 32),
124 (unsigned int)(addr & 0xffffffff))) {
125 printk(KERN_ERR "%s: error enabling PTCAL on node %d!\n",
126 __FUNCTION__, nid);
127 goto out_free_pages;
128 }
129
130 list_add(&area->list, &ptcal_list);
131
132 return 0;
133
134out_free_pages:
135 __free_pages(area->pages, area->order);
136out_free_area:
137 kfree(area);
138out_err:
139 return ret;
140}
141
142static int __init cbe_ptcal_enable(void)
143{
144 const u32 *size;
145 struct device_node *np;
146 int order, found_mic = 0;
147
148 np = of_find_node_by_path("/rtas");
149 if (!np)
150 return -ENODEV;
151
152 size = of_get_property(np, "ibm,cbe-ptcal-size", NULL);
153 if (!size)
154 return -ENODEV;
155
156 pr_debug("%s: enabling PTCAL, size = 0x%x\n", __FUNCTION__, *size);
157 order = get_order(*size);
158 of_node_put(np);
159
160 /* support for malta device trees, with be@/mic@ nodes */
161 for_each_node_by_type(np, "mic-tm") {
162 cbe_ptcal_enable_on_node(of_node_to_nid(np), order);
163 found_mic = 1;
164 }
165
166 if (found_mic)
167 return 0;
168
169 /* support for older device tree - use cpu nodes */
170 for_each_node_by_type(np, "cpu") {
171 const u32 *nid = of_get_property(np, "node-id", NULL);
172 if (!nid) {
173 printk(KERN_ERR "%s: node %s is missing node-id?\n",
174 __FUNCTION__, np->full_name);
175 continue;
176 }
177 cbe_ptcal_enable_on_node(*nid, order);
178 found_mic = 1;
179 }
180
181 return found_mic ? 0 : -ENODEV;
182}
183
184static int cbe_ptcal_disable(void)
185{
186 struct ptcal_area *area, *tmp;
187 int ret = 0;
188
189 pr_debug("%s: disabling PTCAL\n", __FUNCTION__);
190
191 list_for_each_entry_safe(area, tmp, &ptcal_list, list) {
192 /* disable ptcal on this node */
193 if (rtas_call(ptcal_stop_tok, 1, 1, NULL, area->nid)) {
194 printk(KERN_ERR "%s: error disabling PTCAL "
195 "on node %d!\n", __FUNCTION__,
196 area->nid);
197 ret = -EIO;
198 continue;
199 }
200
201 /* ensure we can access the PTCAL area */
202 memset(page_address(area->pages), 0,
203 1 << (area->order + PAGE_SHIFT));
204
205 /* clean up */
206 list_del(&area->list);
207 __free_pages(area->pages, area->order);
208 kfree(area);
209 }
210
211 return ret;
212}
213
214static int cbe_ptcal_notify_reboot(struct notifier_block *nb,
215 unsigned long code, void *data)
216{
217 return cbe_ptcal_disable();
218}
219
220static struct notifier_block cbe_ptcal_reboot_notifier = {
221 .notifier_call = cbe_ptcal_notify_reboot
222};
223
224int __init cbe_ptcal_init(void)
225{
226 int ret;
227 ptcal_start_tok = rtas_token("ibm,cbe-start-ptcal");
228 ptcal_stop_tok = rtas_token("ibm,cbe-stop-ptcal");
229
230 if (ptcal_start_tok == RTAS_UNKNOWN_SERVICE
231 || ptcal_stop_tok == RTAS_UNKNOWN_SERVICE)
232 return -ENODEV;
233
234 ret = register_reboot_notifier(&cbe_ptcal_reboot_notifier);
235 if (ret) {
236 printk(KERN_ERR "Can't disable PTCAL, so not enabling\n");
237 return ret;
238 }
239
240 return cbe_ptcal_enable();
241}
242
243arch_initcall(cbe_ptcal_init);
244
85void __init cbe_ras_init(void) 245void __init cbe_ras_init(void)
86{ 246{
87 unsigned long hid0; 247 unsigned long hid0;
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 36989c2eee66..54b96183cb64 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -71,7 +71,7 @@ static void cell_show_cpuinfo(struct seq_file *m)
71 71
72 root = of_find_node_by_path("/"); 72 root = of_find_node_by_path("/");
73 if (root) 73 if (root)
74 model = get_property(root, "model", NULL); 74 model = of_get_property(root, "model", NULL);
75 seq_printf(m, "machine\t\t: CHRP %s\n", model); 75 seq_printf(m, "machine\t\t: CHRP %s\n", model);
76 of_node_put(root); 76 of_node_put(root);
77} 77}
@@ -190,15 +190,6 @@ static int __init cell_probe(void)
190 return 1; 190 return 1;
191} 191}
192 192
193/*
194 * Cell has no legacy IO; anything calling this function has to
195 * fail or bad things will happen
196 */
197static int cell_check_legacy_ioport(unsigned int baseport)
198{
199 return -ENODEV;
200}
201
202define_machine(cell) { 193define_machine(cell) {
203 .name = "Cell", 194 .name = "Cell",
204 .probe = cell_probe, 195 .probe = cell_probe,
@@ -211,7 +202,6 @@ define_machine(cell) {
211 .get_rtc_time = rtas_get_rtc_time, 202 .get_rtc_time = rtas_get_rtc_time,
212 .set_rtc_time = rtas_set_rtc_time, 203 .set_rtc_time = rtas_set_rtc_time,
213 .calibrate_decr = generic_calibrate_decr, 204 .calibrate_decr = generic_calibrate_decr,
214 .check_legacy_ioport = cell_check_legacy_ioport,
215 .progress = cell_progress, 205 .progress = cell_progress,
216 .init_IRQ = cell_init_irq, 206 .init_IRQ = cell_init_irq,
217 .pci_setup_phb = rtas_setup_phb, 207 .pci_setup_phb = rtas_setup_phb,
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 21a9ebd4978e..fb1f15797bbb 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -254,25 +254,25 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
254 } 254 }
255 255
256 /* Now do the horrible hacks */ 256 /* Now do the horrible hacks */
257 tmp = get_property(pic->of_node, "#interrupt-cells", NULL); 257 tmp = of_get_property(pic->of_node, "#interrupt-cells", NULL);
258 if (tmp == NULL) 258 if (tmp == NULL)
259 return NO_IRQ; 259 return NO_IRQ;
260 intsize = *tmp; 260 intsize = *tmp;
261 imap = get_property(pic->of_node, "interrupt-map", &imaplen); 261 imap = of_get_property(pic->of_node, "interrupt-map", &imaplen);
262 if (imap == NULL || imaplen < (intsize + 1)) 262 if (imap == NULL || imaplen < (intsize + 1))
263 return NO_IRQ; 263 return NO_IRQ;
264 iic = of_find_node_by_phandle(imap[intsize]); 264 iic = of_find_node_by_phandle(imap[intsize]);
265 if (iic == NULL) 265 if (iic == NULL)
266 return NO_IRQ; 266 return NO_IRQ;
267 imap += intsize + 1; 267 imap += intsize + 1;
268 tmp = get_property(iic, "#interrupt-cells", NULL); 268 tmp = of_get_property(iic, "#interrupt-cells", NULL);
269 if (tmp == NULL) 269 if (tmp == NULL)
270 return NO_IRQ; 270 return NO_IRQ;
271 intsize = *tmp; 271 intsize = *tmp;
272 /* Assume unit is last entry of interrupt specifier */ 272 /* Assume unit is last entry of interrupt specifier */
273 unit = imap[intsize - 1]; 273 unit = imap[intsize - 1];
274 /* Ok, we have a unit, now let's try to get the node */ 274 /* Ok, we have a unit, now let's try to get the node */
275 tmp = get_property(iic, "ibm,interrupt-server-ranges", NULL); 275 tmp = of_get_property(iic, "ibm,interrupt-server-ranges", NULL);
276 if (tmp == NULL) { 276 if (tmp == NULL) {
277 of_node_put(iic); 277 of_node_put(iic);
278 return NO_IRQ; 278 return NO_IRQ;
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index eba7a2641dce..fec51525252e 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -36,12 +36,14 @@
36#include <asm/xmon.h> 36#include <asm/xmon.h>
37 37
38const struct spu_management_ops *spu_management_ops; 38const struct spu_management_ops *spu_management_ops;
39EXPORT_SYMBOL_GPL(spu_management_ops);
40
39const struct spu_priv1_ops *spu_priv1_ops; 41const struct spu_priv1_ops *spu_priv1_ops;
40 42
41static struct list_head spu_list[MAX_NUMNODES]; 43static struct list_head spu_list[MAX_NUMNODES];
42static LIST_HEAD(spu_full_list); 44static LIST_HEAD(spu_full_list);
43static DEFINE_MUTEX(spu_mutex); 45static DEFINE_MUTEX(spu_mutex);
44static spinlock_t spu_list_lock = SPIN_LOCK_UNLOCKED; 46static DEFINE_SPINLOCK(spu_list_lock);
45 47
46EXPORT_SYMBOL_GPL(spu_priv1_ops); 48EXPORT_SYMBOL_GPL(spu_priv1_ops);
47 49
@@ -290,7 +292,6 @@ spu_irq_class_1(int irq, void *data)
290 292
291 return stat ? IRQ_HANDLED : IRQ_NONE; 293 return stat ? IRQ_HANDLED : IRQ_NONE;
292} 294}
293EXPORT_SYMBOL_GPL(spu_irq_class_1_bottom);
294 295
295static irqreturn_t 296static irqreturn_t
296spu_irq_class_2(int irq, void *data) 297spu_irq_class_2(int irq, void *data)
@@ -431,10 +432,11 @@ struct spu *spu_alloc_node(int node)
431 spu = list_entry(spu_list[node].next, struct spu, list); 432 spu = list_entry(spu_list[node].next, struct spu, list);
432 list_del_init(&spu->list); 433 list_del_init(&spu->list);
433 pr_debug("Got SPU %d %d\n", spu->number, spu->node); 434 pr_debug("Got SPU %d %d\n", spu->number, spu->node);
434 spu_init_channels(spu);
435 } 435 }
436 mutex_unlock(&spu_mutex); 436 mutex_unlock(&spu_mutex);
437 437
438 if (spu)
439 spu_init_channels(spu);
438 return spu; 440 return spu;
439} 441}
440EXPORT_SYMBOL_GPL(spu_alloc_node); 442EXPORT_SYMBOL_GPL(spu_alloc_node);
@@ -461,108 +463,6 @@ void spu_free(struct spu *spu)
461} 463}
462EXPORT_SYMBOL_GPL(spu_free); 464EXPORT_SYMBOL_GPL(spu_free);
463 465
464static int spu_handle_mm_fault(struct spu *spu)
465{
466 struct mm_struct *mm = spu->mm;
467 struct vm_area_struct *vma;
468 u64 ea, dsisr, is_write;
469 int ret;
470
471 ea = spu->dar;
472 dsisr = spu->dsisr;
473#if 0
474 if (!IS_VALID_EA(ea)) {
475 return -EFAULT;
476 }
477#endif /* XXX */
478 if (mm == NULL) {
479 return -EFAULT;
480 }
481 if (mm->pgd == NULL) {
482 return -EFAULT;
483 }
484
485 down_read(&mm->mmap_sem);
486 vma = find_vma(mm, ea);
487 if (!vma)
488 goto bad_area;
489 if (vma->vm_start <= ea)
490 goto good_area;
491 if (!(vma->vm_flags & VM_GROWSDOWN))
492 goto bad_area;
493#if 0
494 if (expand_stack(vma, ea))
495 goto bad_area;
496#endif /* XXX */
497good_area:
498 is_write = dsisr & MFC_DSISR_ACCESS_PUT;
499 if (is_write) {
500 if (!(vma->vm_flags & VM_WRITE))
501 goto bad_area;
502 } else {
503 if (dsisr & MFC_DSISR_ACCESS_DENIED)
504 goto bad_area;
505 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
506 goto bad_area;
507 }
508 ret = 0;
509 switch (handle_mm_fault(mm, vma, ea, is_write)) {
510 case VM_FAULT_MINOR:
511 current->min_flt++;
512 break;
513 case VM_FAULT_MAJOR:
514 current->maj_flt++;
515 break;
516 case VM_FAULT_SIGBUS:
517 ret = -EFAULT;
518 goto bad_area;
519 case VM_FAULT_OOM:
520 ret = -ENOMEM;
521 goto bad_area;
522 default:
523 BUG();
524 }
525 up_read(&mm->mmap_sem);
526 return ret;
527
528bad_area:
529 up_read(&mm->mmap_sem);
530 return -EFAULT;
531}
532
533int spu_irq_class_1_bottom(struct spu *spu)
534{
535 u64 ea, dsisr, access, error = 0UL;
536 int ret = 0;
537
538 ea = spu->dar;
539 dsisr = spu->dsisr;
540 if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) {
541 u64 flags;
542
543 access = (_PAGE_PRESENT | _PAGE_USER);
544 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL;
545 local_irq_save(flags);
546 if (hash_page(ea, access, 0x300) != 0)
547 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR;
548 local_irq_restore(flags);
549 }
550 if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) {
551 if ((ret = spu_handle_mm_fault(spu)) != 0)
552 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR;
553 else
554 error &= ~CLASS1_ENABLE_STORAGE_FAULT_INTR;
555 }
556 spu->dar = 0UL;
557 spu->dsisr = 0UL;
558 if (!error) {
559 spu_restart_dma(spu);
560 } else {
561 spu->dma_callback(spu, SPE_EVENT_SPE_DATA_STORAGE);
562 }
563 return ret;
564}
565
566struct sysdev_class spu_sysdev_class = { 466struct sysdev_class spu_sysdev_class = {
567 set_kset_name("spu") 467 set_kset_name("spu")
568}; 468};
@@ -636,12 +536,6 @@ static int spu_create_sysdev(struct spu *spu)
636 return 0; 536 return 0;
637} 537}
638 538
639static void spu_destroy_sysdev(struct spu *spu)
640{
641 sysfs_remove_device_from_node(&spu->sysdev, spu->node);
642 sysdev_unregister(&spu->sysdev);
643}
644
645static int __init create_spu(void *data) 539static int __init create_spu(void *data)
646{ 540{
647 struct spu *spu; 541 struct spu *spu;
@@ -693,58 +587,37 @@ out:
693 return ret; 587 return ret;
694} 588}
695 589
696static void destroy_spu(struct spu *spu)
697{
698 list_del_init(&spu->list);
699 list_del_init(&spu->full_list);
700
701 spu_destroy_sysdev(spu);
702 spu_free_irqs(spu);
703 spu_destroy_spu(spu);
704 kfree(spu);
705}
706
707static void cleanup_spu_base(void)
708{
709 struct spu *spu, *tmp;
710 int node;
711
712 mutex_lock(&spu_mutex);
713 for (node = 0; node < MAX_NUMNODES; node++) {
714 list_for_each_entry_safe(spu, tmp, &spu_list[node], list)
715 destroy_spu(spu);
716 }
717 mutex_unlock(&spu_mutex);
718 sysdev_class_unregister(&spu_sysdev_class);
719}
720module_exit(cleanup_spu_base);
721
722static int __init init_spu_base(void) 590static int __init init_spu_base(void)
723{ 591{
724 int i, ret; 592 int i, ret = 0;
593
594 for (i = 0; i < MAX_NUMNODES; i++)
595 INIT_LIST_HEAD(&spu_list[i]);
725 596
726 if (!spu_management_ops) 597 if (!spu_management_ops)
727 return 0; 598 goto out;
728 599
729 /* create sysdev class for spus */ 600 /* create sysdev class for spus */
730 ret = sysdev_class_register(&spu_sysdev_class); 601 ret = sysdev_class_register(&spu_sysdev_class);
731 if (ret) 602 if (ret)
732 return ret; 603 goto out;
733
734 for (i = 0; i < MAX_NUMNODES; i++)
735 INIT_LIST_HEAD(&spu_list[i]);
736 604
737 ret = spu_enumerate_spus(create_spu); 605 ret = spu_enumerate_spus(create_spu);
738 606
739 if (ret) { 607 if (ret) {
740 printk(KERN_WARNING "%s: Error initializing spus\n", 608 printk(KERN_WARNING "%s: Error initializing spus\n",
741 __FUNCTION__); 609 __FUNCTION__);
742 cleanup_spu_base(); 610 goto out_unregister_sysdev_class;
743 return ret;
744 } 611 }
745 612
746 xmon_register_spus(&spu_full_list); 613 xmon_register_spus(&spu_full_list);
747 614
615 return 0;
616
617 out_unregister_sysdev_class:
618 sysdev_class_unregister(&spu_sysdev_class);
619 out:
620
748 return ret; 621 return ret;
749} 622}
750module_init(init_spu_base); 623module_init(init_spu_base);
diff --git a/arch/powerpc/platforms/cell/spu_coredump.c b/arch/powerpc/platforms/cell/spu_coredump.c
index 6915b418ee73..4fd37ff1e210 100644
--- a/arch/powerpc/platforms/cell/spu_coredump.c
+++ b/arch/powerpc/platforms/cell/spu_coredump.c
@@ -26,19 +26,18 @@
26 26
27#include <asm/spu.h> 27#include <asm/spu.h>
28 28
29static struct spu_coredump_calls spu_coredump_calls; 29static struct spu_coredump_calls *spu_coredump_calls;
30static DEFINE_MUTEX(spu_coredump_mutex); 30static DEFINE_MUTEX(spu_coredump_mutex);
31 31
32int arch_notes_size(void) 32int arch_notes_size(void)
33{ 33{
34 long ret; 34 long ret;
35 struct module *owner = spu_coredump_calls.owner;
36 35
37 ret = -ENOSYS; 36 ret = -ENOSYS;
38 mutex_lock(&spu_coredump_mutex); 37 mutex_lock(&spu_coredump_mutex);
39 if (owner && try_module_get(owner)) { 38 if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
40 ret = spu_coredump_calls.arch_notes_size(); 39 ret = spu_coredump_calls->arch_notes_size();
41 module_put(owner); 40 module_put(spu_coredump_calls->owner);
42 } 41 }
43 mutex_unlock(&spu_coredump_mutex); 42 mutex_unlock(&spu_coredump_mutex);
44 return ret; 43 return ret;
@@ -46,36 +45,35 @@ int arch_notes_size(void)
46 45
47void arch_write_notes(struct file *file) 46void arch_write_notes(struct file *file)
48{ 47{
49 struct module *owner = spu_coredump_calls.owner;
50
51 mutex_lock(&spu_coredump_mutex); 48 mutex_lock(&spu_coredump_mutex);
52 if (owner && try_module_get(owner)) { 49 if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
53 spu_coredump_calls.arch_write_notes(file); 50 spu_coredump_calls->arch_write_notes(file);
54 module_put(owner); 51 module_put(spu_coredump_calls->owner);
55 } 52 }
56 mutex_unlock(&spu_coredump_mutex); 53 mutex_unlock(&spu_coredump_mutex);
57} 54}
58 55
59int register_arch_coredump_calls(struct spu_coredump_calls *calls) 56int register_arch_coredump_calls(struct spu_coredump_calls *calls)
60{ 57{
61 if (spu_coredump_calls.owner) 58 int ret = 0;
62 return -EBUSY; 59
63 60
64 mutex_lock(&spu_coredump_mutex); 61 mutex_lock(&spu_coredump_mutex);
65 spu_coredump_calls.arch_notes_size = calls->arch_notes_size; 62 if (spu_coredump_calls)
66 spu_coredump_calls.arch_write_notes = calls->arch_write_notes; 63 ret = -EBUSY;
67 spu_coredump_calls.owner = calls->owner; 64 else
65 spu_coredump_calls = calls;
68 mutex_unlock(&spu_coredump_mutex); 66 mutex_unlock(&spu_coredump_mutex);
69 return 0; 67 return ret;
70} 68}
71EXPORT_SYMBOL_GPL(register_arch_coredump_calls); 69EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
72 70
73void unregister_arch_coredump_calls(struct spu_coredump_calls *calls) 71void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
74{ 72{
75 BUG_ON(spu_coredump_calls.owner != calls->owner); 73 BUG_ON(spu_coredump_calls != calls);
76 74
77 mutex_lock(&spu_coredump_mutex); 75 mutex_lock(&spu_coredump_mutex);
78 spu_coredump_calls.owner = NULL; 76 spu_coredump_calls = NULL;
79 mutex_unlock(&spu_coredump_mutex); 77 mutex_unlock(&spu_coredump_mutex);
80} 78}
81EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls); 79EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index e34599f53d28..1d4562ae463d 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -48,11 +48,11 @@ static u64 __init find_spu_unit_number(struct device_node *spe)
48{ 48{
49 const unsigned int *prop; 49 const unsigned int *prop;
50 int proplen; 50 int proplen;
51 prop = get_property(spe, "unit-id", &proplen); 51 prop = of_get_property(spe, "unit-id", &proplen);
52 if (proplen == 4) 52 if (proplen == 4)
53 return (u64)*prop; 53 return (u64)*prop;
54 54
55 prop = get_property(spe, "reg", &proplen); 55 prop = of_get_property(spe, "reg", &proplen);
56 if (proplen == 4) 56 if (proplen == 4)
57 return (u64)*prop; 57 return (u64)*prop;
58 58
@@ -76,12 +76,12 @@ static int __init spu_map_interrupts_old(struct spu *spu,
76 int nid; 76 int nid;
77 77
78 /* Get the interrupt source unit from the device-tree */ 78 /* Get the interrupt source unit from the device-tree */
79 tmp = get_property(np, "isrc", NULL); 79 tmp = of_get_property(np, "isrc", NULL);
80 if (!tmp) 80 if (!tmp)
81 return -ENODEV; 81 return -ENODEV;
82 isrc = tmp[0]; 82 isrc = tmp[0];
83 83
84 tmp = get_property(np->parent->parent, "node-id", NULL); 84 tmp = of_get_property(np->parent->parent, "node-id", NULL);
85 if (!tmp) { 85 if (!tmp) {
86 printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__); 86 printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__);
87 nid = spu->node; 87 nid = spu->node;
@@ -110,7 +110,7 @@ static void __iomem * __init spu_map_prop_old(struct spu *spu,
110 } __attribute__((packed)) *prop; 110 } __attribute__((packed)) *prop;
111 int proplen; 111 int proplen;
112 112
113 prop = get_property(n, name, &proplen); 113 prop = of_get_property(n, name, &proplen);
114 if (prop == NULL || proplen != sizeof (struct address_prop)) 114 if (prop == NULL || proplen != sizeof (struct address_prop))
115 return NULL; 115 return NULL;
116 116
@@ -124,11 +124,11 @@ static int __init spu_map_device_old(struct spu *spu)
124 int ret; 124 int ret;
125 125
126 ret = -ENODEV; 126 ret = -ENODEV;
127 spu->name = get_property(node, "name", NULL); 127 spu->name = of_get_property(node, "name", NULL);
128 if (!spu->name) 128 if (!spu->name)
129 goto out; 129 goto out;
130 130
131 prop = get_property(node, "local-store", NULL); 131 prop = of_get_property(node, "local-store", NULL);
132 if (!prop) 132 if (!prop)
133 goto out; 133 goto out;
134 spu->local_store_phys = *(unsigned long *)prop; 134 spu->local_store_phys = *(unsigned long *)prop;
@@ -139,7 +139,7 @@ static int __init spu_map_device_old(struct spu *spu)
139 if (!spu->local_store) 139 if (!spu->local_store)
140 goto out; 140 goto out;
141 141
142 prop = get_property(node, "problem", NULL); 142 prop = of_get_property(node, "problem", NULL);
143 if (!prop) 143 if (!prop)
144 goto out_unmap; 144 goto out_unmap;
145 spu->problem_phys = *(unsigned long *)prop; 145 spu->problem_phys = *(unsigned long *)prop;
@@ -226,7 +226,7 @@ static int __init spu_map_device(struct spu *spu)
226 struct device_node *np = spu->devnode; 226 struct device_node *np = spu->devnode;
227 int ret = -ENODEV; 227 int ret = -ENODEV;
228 228
229 spu->name = get_property(np, "name", NULL); 229 spu->name = of_get_property(np, "name", NULL);
230 if (!spu->name) 230 if (!spu->name)
231 goto out; 231 goto out;
232 232
diff --git a/arch/powerpc/platforms/cell/spufs/Makefile b/arch/powerpc/platforms/cell/spufs/Makefile
index 472217d19faf..2cd89c11af5a 100644
--- a/arch/powerpc/platforms/cell/spufs/Makefile
+++ b/arch/powerpc/platforms/cell/spufs/Makefile
@@ -1,4 +1,4 @@
1obj-y += switch.o 1obj-y += switch.o fault.o
2 2
3obj-$(CONFIG_SPU_FS) += spufs.o 3obj-$(CONFIG_SPU_FS) += spufs.o
4spufs-y += inode.o file.o context.o syscalls.o coredump.o 4spufs-y += inode.o file.o context.o syscalls.o coredump.o
diff --git a/arch/powerpc/platforms/cell/spufs/backing_ops.c b/arch/powerpc/platforms/cell/spufs/backing_ops.c
index 1898f0d3a8b8..3322528fa6eb 100644
--- a/arch/powerpc/platforms/cell/spufs/backing_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/backing_ops.c
@@ -350,6 +350,11 @@ static int spu_backing_send_mfc_command(struct spu_context *ctx,
350 return ret; 350 return ret;
351} 351}
352 352
353static void spu_backing_restart_dma(struct spu_context *ctx)
354{
355 /* nothing to do here */
356}
357
353struct spu_context_ops spu_backing_ops = { 358struct spu_context_ops spu_backing_ops = {
354 .mbox_read = spu_backing_mbox_read, 359 .mbox_read = spu_backing_mbox_read,
355 .mbox_stat_read = spu_backing_mbox_stat_read, 360 .mbox_stat_read = spu_backing_mbox_stat_read,
@@ -376,4 +381,5 @@ struct spu_context_ops spu_backing_ops = {
376 .read_mfc_tagstatus = spu_backing_read_mfc_tagstatus, 381 .read_mfc_tagstatus = spu_backing_read_mfc_tagstatus,
377 .get_mfc_free_elements = spu_backing_get_mfc_free_elements, 382 .get_mfc_free_elements = spu_backing_get_mfc_free_elements,
378 .send_mfc_command = spu_backing_send_mfc_command, 383 .send_mfc_command = spu_backing_send_mfc_command,
384 .restart_dma = spu_backing_restart_dma,
379}; 385};
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 04ad2e364e97..a87d9ca3dba2 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -41,9 +41,10 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
41 goto out_free; 41 goto out_free;
42 } 42 }
43 spin_lock_init(&ctx->mmio_lock); 43 spin_lock_init(&ctx->mmio_lock);
44 spin_lock_init(&ctx->mapping_lock);
44 kref_init(&ctx->kref); 45 kref_init(&ctx->kref);
45 mutex_init(&ctx->state_mutex); 46 mutex_init(&ctx->state_mutex);
46 init_MUTEX(&ctx->run_sema); 47 mutex_init(&ctx->run_mutex);
47 init_waitqueue_head(&ctx->ibox_wq); 48 init_waitqueue_head(&ctx->ibox_wq);
48 init_waitqueue_head(&ctx->wbox_wq); 49 init_waitqueue_head(&ctx->wbox_wq);
49 init_waitqueue_head(&ctx->stop_wq); 50 init_waitqueue_head(&ctx->stop_wq);
@@ -51,6 +52,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
51 ctx->state = SPU_STATE_SAVED; 52 ctx->state = SPU_STATE_SAVED;
52 ctx->ops = &spu_backing_ops; 53 ctx->ops = &spu_backing_ops;
53 ctx->owner = get_task_mm(current); 54 ctx->owner = get_task_mm(current);
55 INIT_LIST_HEAD(&ctx->rq);
54 if (gang) 56 if (gang)
55 spu_gang_add_ctx(gang, ctx); 57 spu_gang_add_ctx(gang, ctx);
56 ctx->rt_priority = current->rt_priority; 58 ctx->rt_priority = current->rt_priority;
@@ -75,6 +77,7 @@ void destroy_spu_context(struct kref *kref)
75 spu_fini_csa(&ctx->csa); 77 spu_fini_csa(&ctx->csa);
76 if (ctx->gang) 78 if (ctx->gang)
77 spu_gang_remove_ctx(ctx->gang, ctx); 79 spu_gang_remove_ctx(ctx->gang, ctx);
80 BUG_ON(!list_empty(&ctx->rq));
78 kfree(ctx); 81 kfree(ctx);
79} 82}
80 83
@@ -119,46 +122,6 @@ void spu_unmap_mappings(struct spu_context *ctx)
119} 122}
120 123
121/** 124/**
122 * spu_acquire_exclusive - lock spu contex and protect against userspace access
123 * @ctx: spu contex to lock
124 *
125 * Note:
126 * Returns 0 and with the context locked on success
127 * Returns negative error and with the context _unlocked_ on failure.
128 */
129int spu_acquire_exclusive(struct spu_context *ctx)
130{
131 int ret = -EINVAL;
132
133 spu_acquire(ctx);
134 /*
135 * Context is about to be freed, so we can't acquire it anymore.
136 */
137 if (!ctx->owner)
138 goto out_unlock;
139
140 if (ctx->state == SPU_STATE_SAVED) {
141 ret = spu_activate(ctx, 0);
142 if (ret)
143 goto out_unlock;
144 } else {
145 /*
146 * We need to exclude userspace access to the context.
147 *
148 * To protect against memory access we invalidate all ptes
149 * and make sure the pagefault handlers block on the mutex.
150 */
151 spu_unmap_mappings(ctx);
152 }
153
154 return 0;
155
156 out_unlock:
157 spu_release(ctx);
158 return ret;
159}
160
161/**
162 * spu_acquire_runnable - lock spu contex and make sure it is in runnable state 125 * spu_acquire_runnable - lock spu contex and make sure it is in runnable state
163 * @ctx: spu contex to lock 126 * @ctx: spu contex to lock
164 * 127 *
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index 725e19561159..5d9ad5a0307b 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -169,12 +169,12 @@ static void spufs_arch_write_note(struct spufs_ctx_info *ctx_info, int i,
169 struct spu_context *ctx; 169 struct spu_context *ctx;
170 loff_t pos = 0; 170 loff_t pos = 0;
171 int sz, dfd, rc, total = 0; 171 int sz, dfd, rc, total = 0;
172 const int bufsz = 4096; 172 const int bufsz = PAGE_SIZE;
173 char *name; 173 char *name;
174 char fullname[80], *buf; 174 char fullname[80], *buf;
175 struct elf_note en; 175 struct elf_note en;
176 176
177 buf = kmalloc(bufsz, GFP_KERNEL); 177 buf = (void *)get_zeroed_page(GFP_KERNEL);
178 if (!buf) 178 if (!buf)
179 return; 179 return;
180 180
@@ -187,9 +187,8 @@ static void spufs_arch_write_note(struct spufs_ctx_info *ctx_info, int i,
187 sz = spufs_coredump_read[i].size; 187 sz = spufs_coredump_read[i].size;
188 188
189 ctx = ctx_info->ctx; 189 ctx = ctx_info->ctx;
190 if (!ctx) { 190 if (!ctx)
191 return; 191 goto out;
192 }
193 192
194 sprintf(fullname, "SPU/%d/%s", dfd, name); 193 sprintf(fullname, "SPU/%d/%s", dfd, name);
195 en.n_namesz = strlen(fullname) + 1; 194 en.n_namesz = strlen(fullname) + 1;
@@ -197,23 +196,25 @@ static void spufs_arch_write_note(struct spufs_ctx_info *ctx_info, int i,
197 en.n_type = NT_SPU; 196 en.n_type = NT_SPU;
198 197
199 if (!spufs_dump_write(file, &en, sizeof(en))) 198 if (!spufs_dump_write(file, &en, sizeof(en)))
200 return; 199 goto out;
201 if (!spufs_dump_write(file, fullname, en.n_namesz)) 200 if (!spufs_dump_write(file, fullname, en.n_namesz))
202 return; 201 goto out;
203 if (!spufs_dump_seek(file, roundup((unsigned long)file->f_pos, 4))) 202 if (!spufs_dump_seek(file, roundup((unsigned long)file->f_pos, 4)))
204 return; 203 goto out;
205 204
206 do { 205 do {
207 rc = do_coredump_read(i, ctx, buf, bufsz, &pos); 206 rc = do_coredump_read(i, ctx, buf, bufsz, &pos);
208 if (rc > 0) { 207 if (rc > 0) {
209 if (!spufs_dump_write(file, buf, rc)) 208 if (!spufs_dump_write(file, buf, rc))
210 return; 209 goto out;
211 total += rc; 210 total += rc;
212 } 211 }
213 } while (rc == bufsz && total < sz); 212 } while (rc == bufsz && total < sz);
214 213
215 spufs_dump_seek(file, roundup((unsigned long)file->f_pos 214 spufs_dump_seek(file, roundup((unsigned long)file->f_pos
216 - total + sz, 4)); 215 - total + sz, 4));
216out:
217 free_page((unsigned long)buf);
217} 218}
218 219
219static void spufs_arch_write_notes(struct file *file) 220static void spufs_arch_write_notes(struct file *file)
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c
new file mode 100644
index 000000000000..0f75c07e29d8
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/fault.c
@@ -0,0 +1,211 @@
1/*
2 * Low-level SPU handling
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22#include <linux/sched.h>
23#include <linux/mm.h>
24#include <linux/module.h>
25
26#include <asm/spu.h>
27#include <asm/spu_csa.h>
28
29#include "spufs.h"
30
31/*
32 * This ought to be kept in sync with the powerpc specific do_page_fault
33 * function. Currently, there are a few corner cases that we haven't had
34 * to handle fortunately.
35 */
36static int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea, unsigned long dsisr)
37{
38 struct vm_area_struct *vma;
39 unsigned long is_write;
40 int ret;
41
42#if 0
43 if (!IS_VALID_EA(ea)) {
44 return -EFAULT;
45 }
46#endif /* XXX */
47 if (mm == NULL) {
48 return -EFAULT;
49 }
50 if (mm->pgd == NULL) {
51 return -EFAULT;
52 }
53
54 down_read(&mm->mmap_sem);
55 vma = find_vma(mm, ea);
56 if (!vma)
57 goto bad_area;
58 if (vma->vm_start <= ea)
59 goto good_area;
60 if (!(vma->vm_flags & VM_GROWSDOWN))
61 goto bad_area;
62 if (expand_stack(vma, ea))
63 goto bad_area;
64good_area:
65 is_write = dsisr & MFC_DSISR_ACCESS_PUT;
66 if (is_write) {
67 if (!(vma->vm_flags & VM_WRITE))
68 goto bad_area;
69 } else {
70 if (dsisr & MFC_DSISR_ACCESS_DENIED)
71 goto bad_area;
72 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
73 goto bad_area;
74 }
75 ret = 0;
76 switch (handle_mm_fault(mm, vma, ea, is_write)) {
77 case VM_FAULT_MINOR:
78 current->min_flt++;
79 break;
80 case VM_FAULT_MAJOR:
81 current->maj_flt++;
82 break;
83 case VM_FAULT_SIGBUS:
84 ret = -EFAULT;
85 goto bad_area;
86 case VM_FAULT_OOM:
87 ret = -ENOMEM;
88 goto bad_area;
89 default:
90 BUG();
91 }
92 up_read(&mm->mmap_sem);
93 return ret;
94
95bad_area:
96 up_read(&mm->mmap_sem);
97 return -EFAULT;
98}
99
100static void spufs_handle_dma_error(struct spu_context *ctx,
101 unsigned long ea, int type)
102{
103 if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) {
104 ctx->event_return |= type;
105 wake_up_all(&ctx->stop_wq);
106 } else {
107 siginfo_t info;
108 memset(&info, 0, sizeof(info));
109
110 switch (type) {
111 case SPE_EVENT_INVALID_DMA:
112 info.si_signo = SIGBUS;
113 info.si_code = BUS_OBJERR;
114 break;
115 case SPE_EVENT_SPE_DATA_STORAGE:
116 info.si_signo = SIGBUS;
117 info.si_addr = (void __user *)ea;
118 info.si_code = BUS_ADRERR;
119 break;
120 case SPE_EVENT_DMA_ALIGNMENT:
121 info.si_signo = SIGBUS;
122 /* DAR isn't set for an alignment fault :( */
123 info.si_code = BUS_ADRALN;
124 break;
125 case SPE_EVENT_SPE_ERROR:
126 info.si_signo = SIGILL;
127 info.si_addr = (void __user *)(unsigned long)
128 ctx->ops->npc_read(ctx) - 4;
129 info.si_code = ILL_ILLOPC;
130 break;
131 }
132 if (info.si_signo)
133 force_sig_info(info.si_signo, &info, current);
134 }
135}
136
137void spufs_dma_callback(struct spu *spu, int type)
138{
139 spufs_handle_dma_error(spu->ctx, spu->dar, type);
140}
141EXPORT_SYMBOL_GPL(spufs_dma_callback);
142
143/*
144 * bottom half handler for page faults, we can't do this from
145 * interrupt context, since we might need to sleep.
146 * we also need to give up the mutex so we can get scheduled
147 * out while waiting for the backing store.
148 *
149 * TODO: try calling hash_page from the interrupt handler first
150 * in order to speed up the easy case.
151 */
152int spufs_handle_class1(struct spu_context *ctx)
153{
154 u64 ea, dsisr, access;
155 unsigned long flags;
156 int ret;
157
158 /*
159 * dar and dsisr get passed from the registers
160 * to the spu_context, to this function, but not
161 * back to the spu if it gets scheduled again.
162 *
163 * if we don't handle the fault for a saved context
164 * in time, we can still expect to get the same fault
165 * the immediately after the context restore.
166 */
167 if (ctx->state == SPU_STATE_RUNNABLE) {
168 ea = ctx->spu->dar;
169 dsisr = ctx->spu->dsisr;
170 ctx->spu->dar= ctx->spu->dsisr = 0;
171 } else {
172 ea = ctx->csa.priv1.mfc_dar_RW;
173 dsisr = ctx->csa.priv1.mfc_dsisr_RW;
174 ctx->csa.priv1.mfc_dar_RW = 0;
175 ctx->csa.priv1.mfc_dsisr_RW = 0;
176 }
177
178 if (!(dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)))
179 return 0;
180
181 pr_debug("ctx %p: ea %016lx, dsisr %016lx state %d\n", ctx, ea,
182 dsisr, ctx->state);
183
184 /* we must not hold the lock when entering spu_handle_mm_fault */
185 spu_release(ctx);
186
187 access = (_PAGE_PRESENT | _PAGE_USER);
188 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL;
189 local_irq_save(flags);
190 ret = hash_page(ea, access, 0x300);
191 local_irq_restore(flags);
192
193 /* hashing failed, so try the actual fault handler */
194 if (ret)
195 ret = spu_handle_mm_fault(current->mm, ea, dsisr);
196
197 spu_acquire(ctx);
198 /*
199 * If we handled the fault successfully and are in runnable
200 * state, restart the DMA.
201 * In case of unhandled error report the problem to user space.
202 */
203 if (!ret) {
204 if (ctx->spu)
205 ctx->ops->restart_dma(ctx);
206 } else
207 spufs_handle_dma_error(ctx, ea, SPE_EVENT_SPE_DATA_STORAGE);
208
209 return ret;
210}
211EXPORT_SYMBOL_GPL(spufs_handle_class1);
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 505266a568d4..d010b2464a98 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -44,9 +44,25 @@ spufs_mem_open(struct inode *inode, struct file *file)
44{ 44{
45 struct spufs_inode_info *i = SPUFS_I(inode); 45 struct spufs_inode_info *i = SPUFS_I(inode);
46 struct spu_context *ctx = i->i_ctx; 46 struct spu_context *ctx = i->i_ctx;
47
48 spin_lock(&ctx->mapping_lock);
47 file->private_data = ctx; 49 file->private_data = ctx;
48 ctx->local_store = inode->i_mapping; 50 if (!i->i_openers++)
49 smp_wmb(); 51 ctx->local_store = inode->i_mapping;
52 spin_unlock(&ctx->mapping_lock);
53 return 0;
54}
55
56static int
57spufs_mem_release(struct inode *inode, struct file *file)
58{
59 struct spufs_inode_info *i = SPUFS_I(inode);
60 struct spu_context *ctx = i->i_ctx;
61
62 spin_lock(&ctx->mapping_lock);
63 if (!--i->i_openers)
64 ctx->local_store = NULL;
65 spin_unlock(&ctx->mapping_lock);
50 return 0; 66 return 0;
51} 67}
52 68
@@ -149,6 +165,7 @@ spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
149 165
150static const struct file_operations spufs_mem_fops = { 166static const struct file_operations spufs_mem_fops = {
151 .open = spufs_mem_open, 167 .open = spufs_mem_open,
168 .release = spufs_mem_release,
152 .read = spufs_mem_read, 169 .read = spufs_mem_read,
153 .write = spufs_mem_write, 170 .write = spufs_mem_write,
154 .llseek = generic_file_llseek, 171 .llseek = generic_file_llseek,
@@ -238,16 +255,33 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
238 struct spufs_inode_info *i = SPUFS_I(inode); 255 struct spufs_inode_info *i = SPUFS_I(inode);
239 struct spu_context *ctx = i->i_ctx; 256 struct spu_context *ctx = i->i_ctx;
240 257
258 spin_lock(&ctx->mapping_lock);
241 file->private_data = ctx; 259 file->private_data = ctx;
242 ctx->cntl = inode->i_mapping; 260 if (!i->i_openers++)
243 smp_wmb(); 261 ctx->cntl = inode->i_mapping;
262 spin_unlock(&ctx->mapping_lock);
244 return simple_attr_open(inode, file, spufs_cntl_get, 263 return simple_attr_open(inode, file, spufs_cntl_get,
245 spufs_cntl_set, "0x%08lx"); 264 spufs_cntl_set, "0x%08lx");
246} 265}
247 266
267static int
268spufs_cntl_release(struct inode *inode, struct file *file)
269{
270 struct spufs_inode_info *i = SPUFS_I(inode);
271 struct spu_context *ctx = i->i_ctx;
272
273 simple_attr_close(inode, file);
274
275 spin_lock(&ctx->mapping_lock);
276 if (!--i->i_openers)
277 ctx->cntl = NULL;
278 spin_unlock(&ctx->mapping_lock);
279 return 0;
280}
281
248static const struct file_operations spufs_cntl_fops = { 282static const struct file_operations spufs_cntl_fops = {
249 .open = spufs_cntl_open, 283 .open = spufs_cntl_open,
250 .release = simple_attr_close, 284 .release = spufs_cntl_release,
251 .read = simple_attr_read, 285 .read = simple_attr_read,
252 .write = simple_attr_write, 286 .write = simple_attr_write,
253 .mmap = spufs_cntl_mmap, 287 .mmap = spufs_cntl_mmap,
@@ -723,12 +757,28 @@ static int spufs_signal1_open(struct inode *inode, struct file *file)
723{ 757{
724 struct spufs_inode_info *i = SPUFS_I(inode); 758 struct spufs_inode_info *i = SPUFS_I(inode);
725 struct spu_context *ctx = i->i_ctx; 759 struct spu_context *ctx = i->i_ctx;
760
761 spin_lock(&ctx->mapping_lock);
726 file->private_data = ctx; 762 file->private_data = ctx;
727 ctx->signal1 = inode->i_mapping; 763 if (!i->i_openers++)
728 smp_wmb(); 764 ctx->signal1 = inode->i_mapping;
765 spin_unlock(&ctx->mapping_lock);
729 return nonseekable_open(inode, file); 766 return nonseekable_open(inode, file);
730} 767}
731 768
769static int
770spufs_signal1_release(struct inode *inode, struct file *file)
771{
772 struct spufs_inode_info *i = SPUFS_I(inode);
773 struct spu_context *ctx = i->i_ctx;
774
775 spin_lock(&ctx->mapping_lock);
776 if (!--i->i_openers)
777 ctx->signal1 = NULL;
778 spin_unlock(&ctx->mapping_lock);
779 return 0;
780}
781
732static ssize_t __spufs_signal1_read(struct spu_context *ctx, char __user *buf, 782static ssize_t __spufs_signal1_read(struct spu_context *ctx, char __user *buf,
733 size_t len, loff_t *pos) 783 size_t len, loff_t *pos)
734{ 784{
@@ -821,6 +871,7 @@ static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
821 871
822static const struct file_operations spufs_signal1_fops = { 872static const struct file_operations spufs_signal1_fops = {
823 .open = spufs_signal1_open, 873 .open = spufs_signal1_open,
874 .release = spufs_signal1_release,
824 .read = spufs_signal1_read, 875 .read = spufs_signal1_read,
825 .write = spufs_signal1_write, 876 .write = spufs_signal1_write,
826 .mmap = spufs_signal1_mmap, 877 .mmap = spufs_signal1_mmap,
@@ -830,12 +881,28 @@ static int spufs_signal2_open(struct inode *inode, struct file *file)
830{ 881{
831 struct spufs_inode_info *i = SPUFS_I(inode); 882 struct spufs_inode_info *i = SPUFS_I(inode);
832 struct spu_context *ctx = i->i_ctx; 883 struct spu_context *ctx = i->i_ctx;
884
885 spin_lock(&ctx->mapping_lock);
833 file->private_data = ctx; 886 file->private_data = ctx;
834 ctx->signal2 = inode->i_mapping; 887 if (!i->i_openers++)
835 smp_wmb(); 888 ctx->signal2 = inode->i_mapping;
889 spin_unlock(&ctx->mapping_lock);
836 return nonseekable_open(inode, file); 890 return nonseekable_open(inode, file);
837} 891}
838 892
893static int
894spufs_signal2_release(struct inode *inode, struct file *file)
895{
896 struct spufs_inode_info *i = SPUFS_I(inode);
897 struct spu_context *ctx = i->i_ctx;
898
899 spin_lock(&ctx->mapping_lock);
900 if (!--i->i_openers)
901 ctx->signal2 = NULL;
902 spin_unlock(&ctx->mapping_lock);
903 return 0;
904}
905
839static ssize_t __spufs_signal2_read(struct spu_context *ctx, char __user *buf, 906static ssize_t __spufs_signal2_read(struct spu_context *ctx, char __user *buf,
840 size_t len, loff_t *pos) 907 size_t len, loff_t *pos)
841{ 908{
@@ -932,6 +999,7 @@ static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
932 999
933static const struct file_operations spufs_signal2_fops = { 1000static const struct file_operations spufs_signal2_fops = {
934 .open = spufs_signal2_open, 1001 .open = spufs_signal2_open,
1002 .release = spufs_signal2_release,
935 .read = spufs_signal2_read, 1003 .read = spufs_signal2_read,
936 .write = spufs_signal2_write, 1004 .write = spufs_signal2_write,
937 .mmap = spufs_signal2_mmap, 1005 .mmap = spufs_signal2_mmap,
@@ -1031,13 +1099,30 @@ static int spufs_mss_open(struct inode *inode, struct file *file)
1031 struct spu_context *ctx = i->i_ctx; 1099 struct spu_context *ctx = i->i_ctx;
1032 1100
1033 file->private_data = i->i_ctx; 1101 file->private_data = i->i_ctx;
1034 ctx->mss = inode->i_mapping; 1102
1035 smp_wmb(); 1103 spin_lock(&ctx->mapping_lock);
1104 if (!i->i_openers++)
1105 ctx->mss = inode->i_mapping;
1106 spin_unlock(&ctx->mapping_lock);
1036 return nonseekable_open(inode, file); 1107 return nonseekable_open(inode, file);
1037} 1108}
1038 1109
1110static int
1111spufs_mss_release(struct inode *inode, struct file *file)
1112{
1113 struct spufs_inode_info *i = SPUFS_I(inode);
1114 struct spu_context *ctx = i->i_ctx;
1115
1116 spin_lock(&ctx->mapping_lock);
1117 if (!--i->i_openers)
1118 ctx->mss = NULL;
1119 spin_unlock(&ctx->mapping_lock);
1120 return 0;
1121}
1122
1039static const struct file_operations spufs_mss_fops = { 1123static const struct file_operations spufs_mss_fops = {
1040 .open = spufs_mss_open, 1124 .open = spufs_mss_open,
1125 .release = spufs_mss_release,
1041 .mmap = spufs_mss_mmap, 1126 .mmap = spufs_mss_mmap,
1042}; 1127};
1043 1128
@@ -1072,14 +1157,30 @@ static int spufs_psmap_open(struct inode *inode, struct file *file)
1072 struct spufs_inode_info *i = SPUFS_I(inode); 1157 struct spufs_inode_info *i = SPUFS_I(inode);
1073 struct spu_context *ctx = i->i_ctx; 1158 struct spu_context *ctx = i->i_ctx;
1074 1159
1160 spin_lock(&ctx->mapping_lock);
1075 file->private_data = i->i_ctx; 1161 file->private_data = i->i_ctx;
1076 ctx->psmap = inode->i_mapping; 1162 if (!i->i_openers++)
1077 smp_wmb(); 1163 ctx->psmap = inode->i_mapping;
1164 spin_unlock(&ctx->mapping_lock);
1078 return nonseekable_open(inode, file); 1165 return nonseekable_open(inode, file);
1079} 1166}
1080 1167
1168static int
1169spufs_psmap_release(struct inode *inode, struct file *file)
1170{
1171 struct spufs_inode_info *i = SPUFS_I(inode);
1172 struct spu_context *ctx = i->i_ctx;
1173
1174 spin_lock(&ctx->mapping_lock);
1175 if (!--i->i_openers)
1176 ctx->psmap = NULL;
1177 spin_unlock(&ctx->mapping_lock);
1178 return 0;
1179}
1180
1081static const struct file_operations spufs_psmap_fops = { 1181static const struct file_operations spufs_psmap_fops = {
1082 .open = spufs_psmap_open, 1182 .open = spufs_psmap_open,
1183 .release = spufs_psmap_release,
1083 .mmap = spufs_psmap_mmap, 1184 .mmap = spufs_psmap_mmap,
1084}; 1185};
1085 1186
@@ -1126,12 +1227,27 @@ static int spufs_mfc_open(struct inode *inode, struct file *file)
1126 if (atomic_read(&inode->i_count) != 1) 1227 if (atomic_read(&inode->i_count) != 1)
1127 return -EBUSY; 1228 return -EBUSY;
1128 1229
1230 spin_lock(&ctx->mapping_lock);
1129 file->private_data = ctx; 1231 file->private_data = ctx;
1130 ctx->mfc = inode->i_mapping; 1232 if (!i->i_openers++)
1131 smp_wmb(); 1233 ctx->mfc = inode->i_mapping;
1234 spin_unlock(&ctx->mapping_lock);
1132 return nonseekable_open(inode, file); 1235 return nonseekable_open(inode, file);
1133} 1236}
1134 1237
1238static int
1239spufs_mfc_release(struct inode *inode, struct file *file)
1240{
1241 struct spufs_inode_info *i = SPUFS_I(inode);
1242 struct spu_context *ctx = i->i_ctx;
1243
1244 spin_lock(&ctx->mapping_lock);
1245 if (!--i->i_openers)
1246 ctx->mfc = NULL;
1247 spin_unlock(&ctx->mapping_lock);
1248 return 0;
1249}
1250
1135/* interrupt-level mfc callback function. */ 1251/* interrupt-level mfc callback function. */
1136void spufs_mfc_callback(struct spu *spu) 1252void spufs_mfc_callback(struct spu *spu)
1137{ 1253{
@@ -1313,7 +1429,10 @@ static ssize_t spufs_mfc_write(struct file *file, const char __user *buffer,
1313 if (ret) 1429 if (ret)
1314 goto out; 1430 goto out;
1315 1431
1316 spu_acquire_runnable(ctx, 0); 1432 ret = spu_acquire_runnable(ctx, 0);
1433 if (ret)
1434 goto out;
1435
1317 if (file->f_flags & O_NONBLOCK) { 1436 if (file->f_flags & O_NONBLOCK) {
1318 ret = ctx->ops->send_mfc_command(ctx, &cmd); 1437 ret = ctx->ops->send_mfc_command(ctx, &cmd);
1319 } else { 1438 } else {
@@ -1399,6 +1518,7 @@ static int spufs_mfc_fasync(int fd, struct file *file, int on)
1399 1518
1400static const struct file_operations spufs_mfc_fops = { 1519static const struct file_operations spufs_mfc_fops = {
1401 .open = spufs_mfc_open, 1520 .open = spufs_mfc_open,
1521 .release = spufs_mfc_release,
1402 .read = spufs_mfc_read, 1522 .read = spufs_mfc_read,
1403 .write = spufs_mfc_write, 1523 .write = spufs_mfc_write,
1404 .poll = spufs_mfc_poll, 1524 .poll = spufs_mfc_poll,
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c
index ae42e03b8c86..428875c5e4ec 100644
--- a/arch/powerpc/platforms/cell/spufs/hw_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c
@@ -296,6 +296,14 @@ static int spu_hw_send_mfc_command(struct spu_context *ctx,
296 } 296 }
297} 297}
298 298
299static void spu_hw_restart_dma(struct spu_context *ctx)
300{
301 struct spu_priv2 __iomem *priv2 = ctx->spu->priv2;
302
303 if (!test_bit(SPU_CONTEXT_SWITCH_PENDING, &ctx->spu->flags))
304 out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND);
305}
306
299struct spu_context_ops spu_hw_ops = { 307struct spu_context_ops spu_hw_ops = {
300 .mbox_read = spu_hw_mbox_read, 308 .mbox_read = spu_hw_mbox_read,
301 .mbox_stat_read = spu_hw_mbox_stat_read, 309 .mbox_stat_read = spu_hw_mbox_stat_read,
@@ -320,4 +328,5 @@ struct spu_context_ops spu_hw_ops = {
320 .read_mfc_tagstatus = spu_hw_read_mfc_tagstatus, 328 .read_mfc_tagstatus = spu_hw_read_mfc_tagstatus,
321 .get_mfc_free_elements = spu_hw_get_mfc_free_elements, 329 .get_mfc_free_elements = spu_hw_get_mfc_free_elements,
322 .send_mfc_command = spu_hw_send_mfc_command, 330 .send_mfc_command = spu_hw_send_mfc_command,
331 .restart_dma = spu_hw_restart_dma,
323}; 332};
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 8079983ef94f..13e4f70ec8c0 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -36,6 +36,7 @@
36#include <asm/prom.h> 36#include <asm/prom.h>
37#include <asm/semaphore.h> 37#include <asm/semaphore.h>
38#include <asm/spu.h> 38#include <asm/spu.h>
39#include <asm/spu_priv1.h>
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
40 41
41#include "spufs.h" 42#include "spufs.h"
@@ -54,6 +55,7 @@ spufs_alloc_inode(struct super_block *sb)
54 55
55 ei->i_gang = NULL; 56 ei->i_gang = NULL;
56 ei->i_ctx = NULL; 57 ei->i_ctx = NULL;
58 ei->i_openers = 0;
57 59
58 return &ei->vfs_inode; 60 return &ei->vfs_inode;
59} 61}
@@ -520,13 +522,14 @@ out:
520 522
521/* File system initialization */ 523/* File system initialization */
522enum { 524enum {
523 Opt_uid, Opt_gid, Opt_err, 525 Opt_uid, Opt_gid, Opt_mode, Opt_err,
524}; 526};
525 527
526static match_table_t spufs_tokens = { 528static match_table_t spufs_tokens = {
527 { Opt_uid, "uid=%d" }, 529 { Opt_uid, "uid=%d" },
528 { Opt_gid, "gid=%d" }, 530 { Opt_gid, "gid=%d" },
529 { Opt_err, NULL }, 531 { Opt_mode, "mode=%o" },
532 { Opt_err, NULL },
530}; 533};
531 534
532static int 535static int
@@ -553,6 +556,11 @@ spufs_parse_options(char *options, struct inode *root)
553 return 0; 556 return 0;
554 root->i_gid = option; 557 root->i_gid = option;
555 break; 558 break;
559 case Opt_mode:
560 if (match_octal(&args[0], &option))
561 return 0;
562 root->i_mode = option | S_IFDIR;
563 break;
556 default: 564 default:
557 return 0; 565 return 0;
558 } 566 }
@@ -560,6 +568,11 @@ spufs_parse_options(char *options, struct inode *root)
560 return 1; 568 return 1;
561} 569}
562 570
571static void spufs_exit_isolated_loader(void)
572{
573 kfree(isolated_loader);
574}
575
563static void 576static void
564spufs_init_isolated_loader(void) 577spufs_init_isolated_loader(void)
565{ 578{
@@ -571,7 +584,7 @@ spufs_init_isolated_loader(void)
571 if (!dn) 584 if (!dn)
572 return; 585 return;
573 586
574 loader = get_property(dn, "loader", &size); 587 loader = of_get_property(dn, "loader", &size);
575 if (!loader) 588 if (!loader)
576 return; 589 return;
577 590
@@ -653,6 +666,10 @@ static int __init spufs_init(void)
653{ 666{
654 int ret; 667 int ret;
655 668
669 ret = -ENODEV;
670 if (!spu_management_ops)
671 goto out;
672
656 ret = -ENOMEM; 673 ret = -ENOMEM;
657 spufs_inode_cache = kmem_cache_create("spufs_inode_cache", 674 spufs_inode_cache = kmem_cache_create("spufs_inode_cache",
658 sizeof(struct spufs_inode_info), 0, 675 sizeof(struct spufs_inode_info), 0,
@@ -660,25 +677,29 @@ static int __init spufs_init(void)
660 677
661 if (!spufs_inode_cache) 678 if (!spufs_inode_cache)
662 goto out; 679 goto out;
663 if (spu_sched_init() != 0) { 680 ret = spu_sched_init();
664 kmem_cache_destroy(spufs_inode_cache);
665 goto out;
666 }
667 ret = register_filesystem(&spufs_type);
668 if (ret) 681 if (ret)
669 goto out_cache; 682 goto out_cache;
683 ret = register_filesystem(&spufs_type);
684 if (ret)
685 goto out_sched;
670 ret = register_spu_syscalls(&spufs_calls); 686 ret = register_spu_syscalls(&spufs_calls);
671 if (ret) 687 if (ret)
672 goto out_fs; 688 goto out_fs;
673 ret = register_arch_coredump_calls(&spufs_coredump_calls); 689 ret = register_arch_coredump_calls(&spufs_coredump_calls);
674 if (ret) 690 if (ret)
675 goto out_fs; 691 goto out_syscalls;
676 692
677 spufs_init_isolated_loader(); 693 spufs_init_isolated_loader();
678 694
679 return 0; 695 return 0;
696
697out_syscalls:
698 unregister_spu_syscalls(&spufs_calls);
680out_fs: 699out_fs:
681 unregister_filesystem(&spufs_type); 700 unregister_filesystem(&spufs_type);
701out_sched:
702 spu_sched_exit();
682out_cache: 703out_cache:
683 kmem_cache_destroy(spufs_inode_cache); 704 kmem_cache_destroy(spufs_inode_cache);
684out: 705out:
@@ -689,6 +710,7 @@ module_init(spufs_init);
689static void __exit spufs_exit(void) 710static void __exit spufs_exit(void)
690{ 711{
691 spu_sched_exit(); 712 spu_sched_exit();
713 spufs_exit_isolated_loader();
692 unregister_arch_coredump_calls(&spufs_coredump_calls); 714 unregister_arch_coredump_calls(&spufs_coredump_calls);
693 unregister_spu_syscalls(&spufs_calls); 715 unregister_spu_syscalls(&spufs_calls);
694 unregister_filesystem(&spufs_type); 716 unregister_filesystem(&spufs_type);
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index f95a611ca362..57626600b1a4 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -18,27 +18,6 @@ void spufs_stop_callback(struct spu *spu)
18 wake_up_all(&ctx->stop_wq); 18 wake_up_all(&ctx->stop_wq);
19} 19}
20 20
21void spufs_dma_callback(struct spu *spu, int type)
22{
23 struct spu_context *ctx = spu->ctx;
24
25 if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) {
26 ctx->event_return |= type;
27 wake_up_all(&ctx->stop_wq);
28 } else {
29 switch (type) {
30 case SPE_EVENT_DMA_ALIGNMENT:
31 case SPE_EVENT_SPE_DATA_STORAGE:
32 case SPE_EVENT_INVALID_DMA:
33 force_sig(SIGBUS, /* info, */ current);
34 break;
35 case SPE_EVENT_SPE_ERROR:
36 force_sig(SIGILL, /* info */ current);
37 break;
38 }
39 }
40}
41
42static inline int spu_stopped(struct spu_context *ctx, u32 * stat) 21static inline int spu_stopped(struct spu_context *ctx, u32 * stat)
43{ 22{
44 struct spu *spu; 23 struct spu *spu;
@@ -63,13 +42,18 @@ static int spu_setup_isolated(struct spu_context *ctx)
63 const u32 status_loading = SPU_STATUS_RUNNING 42 const u32 status_loading = SPU_STATUS_RUNNING
64 | SPU_STATUS_ISOLATED_STATE | SPU_STATUS_ISOLATED_LOAD_STATUS; 43 | SPU_STATUS_ISOLATED_STATE | SPU_STATUS_ISOLATED_LOAD_STATUS;
65 44
45 ret = -ENODEV;
66 if (!isolated_loader) 46 if (!isolated_loader)
67 return -ENODEV;
68
69 ret = spu_acquire_exclusive(ctx);
70 if (ret)
71 goto out; 47 goto out;
72 48
49 /*
50 * We need to exclude userspace access to the context.
51 *
52 * To protect against memory access we invalidate all ptes
53 * and make sure the pagefault handlers block on the mutex.
54 */
55 spu_unmap_mappings(ctx);
56
73 mfc_cntl = &ctx->spu->priv2->mfc_control_RW; 57 mfc_cntl = &ctx->spu->priv2->mfc_control_RW;
74 58
75 /* purge the MFC DMA queue to ensure no spurious accesses before we 59 /* purge the MFC DMA queue to ensure no spurious accesses before we
@@ -82,7 +66,7 @@ static int spu_setup_isolated(struct spu_context *ctx)
82 printk(KERN_ERR "%s: timeout flushing MFC DMA queue\n", 66 printk(KERN_ERR "%s: timeout flushing MFC DMA queue\n",
83 __FUNCTION__); 67 __FUNCTION__);
84 ret = -EIO; 68 ret = -EIO;
85 goto out_unlock; 69 goto out;
86 } 70 }
87 cond_resched(); 71 cond_resched();
88 } 72 }
@@ -119,12 +103,15 @@ static int spu_setup_isolated(struct spu_context *ctx)
119 pr_debug("%s: isolated LOAD failed\n", __FUNCTION__); 103 pr_debug("%s: isolated LOAD failed\n", __FUNCTION__);
120 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); 104 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
121 ret = -EACCES; 105 ret = -EACCES;
106 goto out_drop_priv;
107 }
122 108
123 } else if (!(status & SPU_STATUS_ISOLATED_STATE)) { 109 if (!(status & SPU_STATUS_ISOLATED_STATE)) {
124 /* This isn't allowed by the CBEA, but check anyway */ 110 /* This isn't allowed by the CBEA, but check anyway */
125 pr_debug("%s: SPU fell out of isolated mode?\n", __FUNCTION__); 111 pr_debug("%s: SPU fell out of isolated mode?\n", __FUNCTION__);
126 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_STOP); 112 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_STOP);
127 ret = -EINVAL; 113 ret = -EINVAL;
114 goto out_drop_priv;
128 } 115 }
129 116
130out_drop_priv: 117out_drop_priv:
@@ -132,30 +119,19 @@ out_drop_priv:
132 sr1 |= MFC_STATE1_PROBLEM_STATE_MASK; 119 sr1 |= MFC_STATE1_PROBLEM_STATE_MASK;
133 spu_mfc_sr1_set(ctx->spu, sr1); 120 spu_mfc_sr1_set(ctx->spu, sr1);
134 121
135out_unlock:
136 spu_release(ctx);
137out: 122out:
138 return ret; 123 return ret;
139} 124}
140 125
141static inline int spu_run_init(struct spu_context *ctx, u32 * npc) 126static int spu_run_init(struct spu_context *ctx, u32 * npc)
142{ 127{
143 int ret;
144 unsigned long runcntl = SPU_RUNCNTL_RUNNABLE;
145
146 ret = spu_acquire_runnable(ctx, 0);
147 if (ret)
148 return ret;
149
150 if (ctx->flags & SPU_CREATE_ISOLATE) { 128 if (ctx->flags & SPU_CREATE_ISOLATE) {
129 unsigned long runcntl;
130
151 if (!(ctx->ops->status_read(ctx) & SPU_STATUS_ISOLATED_STATE)) { 131 if (!(ctx->ops->status_read(ctx) & SPU_STATUS_ISOLATED_STATE)) {
152 /* Need to release ctx, because spu_setup_isolated will 132 int ret = spu_setup_isolated(ctx);
153 * acquire it exclusively. 133 if (ret)
154 */ 134 return ret;
155 spu_release(ctx);
156 ret = spu_setup_isolated(ctx);
157 if (!ret)
158 ret = spu_acquire_runnable(ctx, 0);
159 } 135 }
160 136
161 /* if userspace has set the runcntrl register (eg, to issue an 137 /* if userspace has set the runcntrl register (eg, to issue an
@@ -164,16 +140,17 @@ static inline int spu_run_init(struct spu_context *ctx, u32 * npc)
164 (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE); 140 (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE);
165 if (runcntl == 0) 141 if (runcntl == 0)
166 runcntl = SPU_RUNCNTL_RUNNABLE; 142 runcntl = SPU_RUNCNTL_RUNNABLE;
143 ctx->ops->runcntl_write(ctx, runcntl);
167 } else { 144 } else {
168 spu_start_tick(ctx); 145 spu_start_tick(ctx);
169 ctx->ops->npc_write(ctx, *npc); 146 ctx->ops->npc_write(ctx, *npc);
147 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
170 } 148 }
171 149
172 ctx->ops->runcntl_write(ctx, runcntl); 150 return 0;
173 return ret;
174} 151}
175 152
176static inline int spu_run_fini(struct spu_context *ctx, u32 * npc, 153static int spu_run_fini(struct spu_context *ctx, u32 * npc,
177 u32 * status) 154 u32 * status)
178{ 155{
179 int ret = 0; 156 int ret = 0;
@@ -189,19 +166,27 @@ static inline int spu_run_fini(struct spu_context *ctx, u32 * npc,
189 return ret; 166 return ret;
190} 167}
191 168
192static inline int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc, 169static int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc,
193 u32 *status) 170 u32 *status)
194{ 171{
195 int ret; 172 int ret;
196 173
197 if ((ret = spu_run_fini(ctx, npc, status)) != 0) 174 ret = spu_run_fini(ctx, npc, status);
175 if (ret)
198 return ret; 176 return ret;
199 if (*status & (SPU_STATUS_STOPPED_BY_STOP | 177
200 SPU_STATUS_STOPPED_BY_HALT)) { 178 if (*status & (SPU_STATUS_STOPPED_BY_STOP | SPU_STATUS_STOPPED_BY_HALT))
201 return *status; 179 return *status;
202 } 180
203 if ((ret = spu_run_init(ctx, npc)) != 0) 181 ret = spu_acquire_runnable(ctx, 0);
182 if (ret)
183 return ret;
184
185 ret = spu_run_init(ctx, npc);
186 if (ret) {
187 spu_release(ctx);
204 return ret; 188 return ret;
189 }
205 return 0; 190 return 0;
206} 191}
207 192
@@ -253,17 +238,17 @@ int spu_process_callback(struct spu_context *ctx)
253{ 238{
254 struct spu_syscall_block s; 239 struct spu_syscall_block s;
255 u32 ls_pointer, npc; 240 u32 ls_pointer, npc;
256 char *ls; 241 void __iomem *ls;
257 long spu_ret; 242 long spu_ret;
258 int ret; 243 int ret;
259 244
260 /* get syscall block from local store */ 245 /* get syscall block from local store */
261 npc = ctx->ops->npc_read(ctx); 246 npc = ctx->ops->npc_read(ctx) & ~3;
262 ls = ctx->ops->get_ls(ctx); 247 ls = (void __iomem *)ctx->ops->get_ls(ctx);
263 ls_pointer = *(u32*)(ls + npc); 248 ls_pointer = in_be32(ls + npc);
264 if (ls_pointer > (LS_SIZE - sizeof(s))) 249 if (ls_pointer > (LS_SIZE - sizeof(s)))
265 return -EFAULT; 250 return -EFAULT;
266 memcpy(&s, ls + ls_pointer, sizeof (s)); 251 memcpy_fromio(&s, ls + ls_pointer, sizeof(s));
267 252
268 /* do actual syscall without pinning the spu */ 253 /* do actual syscall without pinning the spu */
269 ret = 0; 254 ret = 0;
@@ -283,7 +268,7 @@ int spu_process_callback(struct spu_context *ctx)
283 } 268 }
284 269
285 /* write result, jump over indirect pointer */ 270 /* write result, jump over indirect pointer */
286 memcpy(ls + ls_pointer, &spu_ret, sizeof (spu_ret)); 271 memcpy_toio(ls + ls_pointer, &spu_ret, sizeof(spu_ret));
287 ctx->ops->npc_write(ctx, npc); 272 ctx->ops->npc_write(ctx, npc);
288 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); 273 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
289 return ret; 274 return ret;
@@ -292,11 +277,8 @@ int spu_process_callback(struct spu_context *ctx)
292static inline int spu_process_events(struct spu_context *ctx) 277static inline int spu_process_events(struct spu_context *ctx)
293{ 278{
294 struct spu *spu = ctx->spu; 279 struct spu *spu = ctx->spu;
295 u64 pte_fault = MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED;
296 int ret = 0; 280 int ret = 0;
297 281
298 if (spu->dsisr & pte_fault)
299 ret = spu_irq_class_1_bottom(spu);
300 if (spu->class_0_pending) 282 if (spu->class_0_pending)
301 ret = spu_irq_class_0_bottom(spu); 283 ret = spu_irq_class_0_bottom(spu);
302 if (!ret && signal_pending(current)) 284 if (!ret && signal_pending(current))
@@ -310,14 +292,21 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx,
310 int ret; 292 int ret;
311 u32 status; 293 u32 status;
312 294
313 if (down_interruptible(&ctx->run_sema)) 295 if (mutex_lock_interruptible(&ctx->run_mutex))
314 return -ERESTARTSYS; 296 return -ERESTARTSYS;
315 297
316 ctx->ops->master_start(ctx); 298 ctx->ops->master_start(ctx);
317 ctx->event_return = 0; 299 ctx->event_return = 0;
318 ret = spu_run_init(ctx, npc); 300
301 ret = spu_acquire_runnable(ctx, 0);
319 if (ret) 302 if (ret)
303 return ret;
304
305 ret = spu_run_init(ctx, npc);
306 if (ret) {
307 spu_release(ctx);
320 goto out; 308 goto out;
309 }
321 310
322 do { 311 do {
323 ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, &status)); 312 ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, &status));
@@ -330,6 +319,10 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx,
330 break; 319 break;
331 status &= ~SPU_STATUS_STOPPED_BY_STOP; 320 status &= ~SPU_STATUS_STOPPED_BY_STOP;
332 } 321 }
322 ret = spufs_handle_class1(ctx);
323 if (ret)
324 break;
325
333 if (unlikely(ctx->state != SPU_STATE_RUNNABLE)) { 326 if (unlikely(ctx->state != SPU_STATE_RUNNABLE)) {
334 ret = spu_reacquire_runnable(ctx, npc, &status); 327 ret = spu_reacquire_runnable(ctx, npc, &status);
335 if (ret) { 328 if (ret) {
@@ -363,6 +356,6 @@ out2:
363 356
364out: 357out:
365 *event = ctx->event_return; 358 *event = ctx->event_return;
366 up(&ctx->run_sema); 359 mutex_unlock(&ctx->run_mutex);
367 return ret; 360 return ret;
368} 361}
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 39823cec0844..91030b8abdca 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -71,14 +71,27 @@ static inline int node_allowed(int node)
71 71
72void spu_start_tick(struct spu_context *ctx) 72void spu_start_tick(struct spu_context *ctx)
73{ 73{
74 if (ctx->policy == SCHED_RR) 74 if (ctx->policy == SCHED_RR) {
75 /*
76 * Make sure the exiting bit is cleared.
77 */
78 clear_bit(SPU_SCHED_EXITING, &ctx->sched_flags);
79 mb();
75 queue_delayed_work(spu_sched_wq, &ctx->sched_work, SPU_TIMESLICE); 80 queue_delayed_work(spu_sched_wq, &ctx->sched_work, SPU_TIMESLICE);
81 }
76} 82}
77 83
78void spu_stop_tick(struct spu_context *ctx) 84void spu_stop_tick(struct spu_context *ctx)
79{ 85{
80 if (ctx->policy == SCHED_RR) 86 if (ctx->policy == SCHED_RR) {
87 /*
88 * While the work can be rearming normally setting this flag
89 * makes sure it does not rearm itself anymore.
90 */
91 set_bit(SPU_SCHED_EXITING, &ctx->sched_flags);
92 mb();
81 cancel_delayed_work(&ctx->sched_work); 93 cancel_delayed_work(&ctx->sched_work);
94 }
82} 95}
83 96
84void spu_sched_tick(struct work_struct *work) 97void spu_sched_tick(struct work_struct *work)
@@ -86,7 +99,15 @@ void spu_sched_tick(struct work_struct *work)
86 struct spu_context *ctx = 99 struct spu_context *ctx =
87 container_of(work, struct spu_context, sched_work.work); 100 container_of(work, struct spu_context, sched_work.work);
88 struct spu *spu; 101 struct spu *spu;
89 int rearm = 1; 102 int preempted = 0;
103
104 /*
105 * If this context is being stopped avoid rescheduling from the
106 * scheduler tick because we would block on the state_mutex.
107 * The caller will yield the spu later on anyway.
108 */
109 if (test_bit(SPU_SCHED_EXITING, &ctx->sched_flags))
110 return;
90 111
91 mutex_lock(&ctx->state_mutex); 112 mutex_lock(&ctx->state_mutex);
92 spu = ctx->spu; 113 spu = ctx->spu;
@@ -94,12 +115,19 @@ void spu_sched_tick(struct work_struct *work)
94 int best = sched_find_first_bit(spu_prio->bitmap); 115 int best = sched_find_first_bit(spu_prio->bitmap);
95 if (best <= ctx->prio) { 116 if (best <= ctx->prio) {
96 spu_deactivate(ctx); 117 spu_deactivate(ctx);
97 rearm = 0; 118 preempted = 1;
98 } 119 }
99 } 120 }
100 mutex_unlock(&ctx->state_mutex); 121 mutex_unlock(&ctx->state_mutex);
101 122
102 if (rearm) 123 if (preempted) {
124 /*
125 * We need to break out of the wait loop in spu_run manually
126 * to ensure this context gets put on the runqueue again
127 * ASAP.
128 */
129 wake_up(&ctx->stop_wq);
130 } else
103 spu_start_tick(ctx); 131 spu_start_tick(ctx);
104} 132}
105 133
@@ -208,58 +236,40 @@ static void spu_unbind_context(struct spu *spu, struct spu_context *ctx)
208 * spu_add_to_rq - add a context to the runqueue 236 * spu_add_to_rq - add a context to the runqueue
209 * @ctx: context to add 237 * @ctx: context to add
210 */ 238 */
211static void spu_add_to_rq(struct spu_context *ctx) 239static void __spu_add_to_rq(struct spu_context *ctx)
212{ 240{
213 spin_lock(&spu_prio->runq_lock); 241 int prio = ctx->prio;
214 list_add_tail(&ctx->rq, &spu_prio->runq[ctx->prio]);
215 set_bit(ctx->prio, spu_prio->bitmap);
216 spin_unlock(&spu_prio->runq_lock);
217}
218 242
219/** 243 list_add_tail(&ctx->rq, &spu_prio->runq[prio]);
220 * spu_del_from_rq - remove a context from the runqueue 244 set_bit(prio, spu_prio->bitmap);
221 * @ctx: context to remove
222 */
223static void spu_del_from_rq(struct spu_context *ctx)
224{
225 spin_lock(&spu_prio->runq_lock);
226 list_del_init(&ctx->rq);
227 if (list_empty(&spu_prio->runq[ctx->prio]))
228 clear_bit(ctx->prio, spu_prio->bitmap);
229 spin_unlock(&spu_prio->runq_lock);
230} 245}
231 246
232/** 247static void __spu_del_from_rq(struct spu_context *ctx)
233 * spu_grab_context - remove one context from the runqueue
234 * @prio: priority of the context to be removed
235 *
236 * This function removes one context from the runqueue for priority @prio.
237 * If there is more than one context with the given priority the first
238 * task on the runqueue will be taken.
239 *
240 * Returns the spu_context it just removed.
241 *
242 * Must be called with spu_prio->runq_lock held.
243 */
244static struct spu_context *spu_grab_context(int prio)
245{ 248{
246 struct list_head *rq = &spu_prio->runq[prio]; 249 int prio = ctx->prio;
247 250
248 if (list_empty(rq)) 251 if (!list_empty(&ctx->rq))
249 return NULL; 252 list_del_init(&ctx->rq);
250 return list_entry(rq->next, struct spu_context, rq); 253 if (list_empty(&spu_prio->runq[prio]))
254 clear_bit(prio, spu_prio->bitmap);
251} 255}
252 256
253static void spu_prio_wait(struct spu_context *ctx) 257static void spu_prio_wait(struct spu_context *ctx)
254{ 258{
255 DEFINE_WAIT(wait); 259 DEFINE_WAIT(wait);
256 260
261 spin_lock(&spu_prio->runq_lock);
257 prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE); 262 prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE);
258 if (!signal_pending(current)) { 263 if (!signal_pending(current)) {
264 __spu_add_to_rq(ctx);
265 spin_unlock(&spu_prio->runq_lock);
259 mutex_unlock(&ctx->state_mutex); 266 mutex_unlock(&ctx->state_mutex);
260 schedule(); 267 schedule();
261 mutex_lock(&ctx->state_mutex); 268 mutex_lock(&ctx->state_mutex);
269 spin_lock(&spu_prio->runq_lock);
270 __spu_del_from_rq(ctx);
262 } 271 }
272 spin_unlock(&spu_prio->runq_lock);
263 __set_current_state(TASK_RUNNING); 273 __set_current_state(TASK_RUNNING);
264 remove_wait_queue(&ctx->stop_wq, &wait); 274 remove_wait_queue(&ctx->stop_wq, &wait);
265} 275}
@@ -280,9 +290,14 @@ static void spu_reschedule(struct spu *spu)
280 spin_lock(&spu_prio->runq_lock); 290 spin_lock(&spu_prio->runq_lock);
281 best = sched_find_first_bit(spu_prio->bitmap); 291 best = sched_find_first_bit(spu_prio->bitmap);
282 if (best < MAX_PRIO) { 292 if (best < MAX_PRIO) {
283 struct spu_context *ctx = spu_grab_context(best); 293 struct list_head *rq = &spu_prio->runq[best];
284 if (ctx) 294 struct spu_context *ctx;
285 wake_up(&ctx->stop_wq); 295
296 BUG_ON(list_empty(rq));
297
298 ctx = list_entry(rq->next, struct spu_context, rq);
299 __spu_del_from_rq(ctx);
300 wake_up(&ctx->stop_wq);
286 } 301 }
287 spin_unlock(&spu_prio->runq_lock); 302 spin_unlock(&spu_prio->runq_lock);
288} 303}
@@ -365,6 +380,12 @@ static struct spu *find_victim(struct spu_context *ctx)
365 } 380 }
366 spu_unbind_context(spu, victim); 381 spu_unbind_context(spu, victim);
367 mutex_unlock(&victim->state_mutex); 382 mutex_unlock(&victim->state_mutex);
383 /*
384 * We need to break out of the wait loop in spu_run
385 * manually to ensure this context gets put on the
386 * runqueue again ASAP.
387 */
388 wake_up(&victim->stop_wq);
368 return spu; 389 return spu;
369 } 390 }
370 } 391 }
@@ -377,7 +398,7 @@ static struct spu *find_victim(struct spu_context *ctx)
377 * @ctx: spu context to schedule 398 * @ctx: spu context to schedule
378 * @flags: flags (currently ignored) 399 * @flags: flags (currently ignored)
379 * 400 *
380 * Tries to find a free spu to run @ctx. If no free spu is availble 401 * Tries to find a free spu to run @ctx. If no free spu is available
381 * add the context to the runqueue so it gets woken up once an spu 402 * add the context to the runqueue so it gets woken up once an spu
382 * is available. 403 * is available.
383 */ 404 */
@@ -402,9 +423,7 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
402 return 0; 423 return 0;
403 } 424 }
404 425
405 spu_add_to_rq(ctx);
406 spu_prio_wait(ctx); 426 spu_prio_wait(ctx);
407 spu_del_from_rq(ctx);
408 } while (!signal_pending(current)); 427 } while (!signal_pending(current));
409 428
410 return -ERESTARTSYS; 429 return -ERESTARTSYS;
@@ -438,7 +457,6 @@ void spu_deactivate(struct spu_context *ctx)
438void spu_yield(struct spu_context *ctx) 457void spu_yield(struct spu_context *ctx)
439{ 458{
440 struct spu *spu; 459 struct spu *spu;
441 int need_yield = 0;
442 460
443 if (mutex_trylock(&ctx->state_mutex)) { 461 if (mutex_trylock(&ctx->state_mutex)) {
444 if ((spu = ctx->spu) != NULL) { 462 if ((spu = ctx->spu) != NULL) {
@@ -447,13 +465,10 @@ void spu_yield(struct spu_context *ctx)
447 pr_debug("%s: yielding SPU %d NODE %d\n", 465 pr_debug("%s: yielding SPU %d NODE %d\n",
448 __FUNCTION__, spu->number, spu->node); 466 __FUNCTION__, spu->number, spu->node);
449 spu_deactivate(ctx); 467 spu_deactivate(ctx);
450 need_yield = 1;
451 } 468 }
452 } 469 }
453 mutex_unlock(&ctx->state_mutex); 470 mutex_unlock(&ctx->state_mutex);
454 } 471 }
455 if (unlikely(need_yield))
456 yield();
457} 472}
458 473
459int __init spu_sched_init(void) 474int __init spu_sched_init(void)
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 5c4e47d69d79..0a947fd7de57 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -41,7 +41,7 @@ struct spu_gang;
41 41
42/* ctx->sched_flags */ 42/* ctx->sched_flags */
43enum { 43enum {
44 SPU_SCHED_WAKE = 0, /* currently unused */ 44 SPU_SCHED_EXITING = 0,
45}; 45};
46 46
47struct spu_context { 47struct spu_context {
@@ -50,16 +50,17 @@ struct spu_context {
50 spinlock_t mmio_lock; /* protects mmio access */ 50 spinlock_t mmio_lock; /* protects mmio access */
51 struct address_space *local_store; /* local store mapping. */ 51 struct address_space *local_store; /* local store mapping. */
52 struct address_space *mfc; /* 'mfc' area mappings. */ 52 struct address_space *mfc; /* 'mfc' area mappings. */
53 struct address_space *cntl; /* 'control' area mappings. */ 53 struct address_space *cntl; /* 'control' area mappings. */
54 struct address_space *signal1; /* 'signal1' area mappings. */ 54 struct address_space *signal1; /* 'signal1' area mappings. */
55 struct address_space *signal2; /* 'signal2' area mappings. */ 55 struct address_space *signal2; /* 'signal2' area mappings. */
56 struct address_space *mss; /* 'mss' area mappings. */ 56 struct address_space *mss; /* 'mss' area mappings. */
57 struct address_space *psmap; /* 'psmap' area mappings. */ 57 struct address_space *psmap; /* 'psmap' area mappings. */
58 spinlock_t mapping_lock;
58 u64 object_id; /* user space pointer for oprofile */ 59 u64 object_id; /* user space pointer for oprofile */
59 60
60 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; 61 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
61 struct mutex state_mutex; 62 struct mutex state_mutex;
62 struct semaphore run_sema; 63 struct mutex run_mutex;
63 64
64 struct mm_struct *owner; 65 struct mm_struct *owner;
65 66
@@ -140,6 +141,7 @@ struct spu_context_ops {
140 struct spu_dma_info * info); 141 struct spu_dma_info * info);
141 void (*proxydma_info_read) (struct spu_context * ctx, 142 void (*proxydma_info_read) (struct spu_context * ctx,
142 struct spu_proxydma_info * info); 143 struct spu_proxydma_info * info);
144 void (*restart_dma)(struct spu_context *ctx);
143}; 145};
144 146
145extern struct spu_context_ops spu_hw_ops; 147extern struct spu_context_ops spu_hw_ops;
@@ -149,6 +151,7 @@ struct spufs_inode_info {
149 struct spu_context *i_ctx; 151 struct spu_context *i_ctx;
150 struct spu_gang *i_gang; 152 struct spu_gang *i_gang;
151 struct inode vfs_inode; 153 struct inode vfs_inode;
154 int i_openers;
152}; 155};
153#define SPUFS_I(inode) \ 156#define SPUFS_I(inode) \
154 container_of(inode, struct spufs_inode_info, vfs_inode) 157 container_of(inode, struct spufs_inode_info, vfs_inode)
@@ -170,6 +173,9 @@ int put_spu_gang(struct spu_gang *gang);
170void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx); 173void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx);
171void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx); 174void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx);
172 175
176/* fault handling */
177int spufs_handle_class1(struct spu_context *ctx);
178
173/* context management */ 179/* context management */
174static inline void spu_acquire(struct spu_context *ctx) 180static inline void spu_acquire(struct spu_context *ctx)
175{ 181{
@@ -190,7 +196,6 @@ void spu_unmap_mappings(struct spu_context *ctx);
190void spu_forget(struct spu_context *ctx); 196void spu_forget(struct spu_context *ctx);
191int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags); 197int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags);
192void spu_acquire_saved(struct spu_context *ctx); 198void spu_acquire_saved(struct spu_context *ctx);
193int spu_acquire_exclusive(struct spu_context *ctx);
194 199
195int spu_activate(struct spu_context *ctx, unsigned long flags); 200int spu_activate(struct spu_context *ctx, unsigned long flags);
196void spu_deactivate(struct spu_context *ctx); 201void spu_deactivate(struct spu_context *ctx);
@@ -218,14 +223,13 @@ extern char *isolated_loader;
218 prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \ 223 prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \
219 if (condition) \ 224 if (condition) \
220 break; \ 225 break; \
221 if (!signal_pending(current)) { \ 226 if (signal_pending(current)) { \
222 spu_release(ctx); \ 227 __ret = -ERESTARTSYS; \
223 schedule(); \ 228 break; \
224 spu_acquire(ctx); \
225 continue; \
226 } \ 229 } \
227 __ret = -ERESTARTSYS; \ 230 spu_release(ctx); \
228 break; \ 231 schedule(); \
232 spu_acquire(ctx); \
229 } \ 233 } \
230 finish_wait(&(wq), &__wait); \ 234 finish_wait(&(wq), &__wait); \
231 __ret; \ 235 __ret; \
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index fd91c73de34e..8347c4a3f894 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -2084,6 +2084,10 @@ int spu_save(struct spu_state *prev, struct spu *spu)
2084 int rc; 2084 int rc;
2085 2085
2086 acquire_spu_lock(spu); /* Step 1. */ 2086 acquire_spu_lock(spu); /* Step 1. */
2087 prev->dar = spu->dar;
2088 prev->dsisr = spu->dsisr;
2089 spu->dar = 0;
2090 spu->dsisr = 0;
2087 rc = __do_spu_save(prev, spu); /* Steps 2-53. */ 2091 rc = __do_spu_save(prev, spu); /* Steps 2-53. */
2088 release_spu_lock(spu); 2092 release_spu_lock(spu);
2089 if (rc != 0 && rc != 2 && rc != 6) { 2093 if (rc != 0 && rc != 2 && rc != 6) {
@@ -2109,9 +2113,9 @@ int spu_restore(struct spu_state *new, struct spu *spu)
2109 2113
2110 acquire_spu_lock(spu); 2114 acquire_spu_lock(spu);
2111 harvest(NULL, spu); 2115 harvest(NULL, spu);
2112 spu->dar = 0;
2113 spu->dsisr = 0;
2114 spu->slb_replace = 0; 2116 spu->slb_replace = 0;
2117 new->dar = 0;
2118 new->dsisr = 0;
2115 spu->class_0_pending = 0; 2119 spu->class_0_pending = 0;
2116 rc = __do_spu_restore(new, spu); 2120 rc = __do_spu_restore(new, spu);
2117 release_spu_lock(spu); 2121 release_spu_lock(spu);
diff --git a/arch/powerpc/platforms/celleb/Kconfig b/arch/powerpc/platforms/celleb/Kconfig
new file mode 100644
index 000000000000..2db1e293433e
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/Kconfig
@@ -0,0 +1,9 @@
1config PPC_CELLEB
2 bool "Toshiba's Cell Reference Set 'Celleb' Architecture"
3 depends on PPC_MULTIPLATFORM && PPC64
4 select PPC_CELL
5 select PPC_OF_PLATFORM_PCI
6 select HAS_TXX9_SERIAL
7 select PPC_UDBG_BEAT
8 select USB_OHCI_BIG_ENDIAN_MMIO
9 select USB_EHCI_BIG_ENDIAN_MMIO
diff --git a/arch/powerpc/platforms/celleb/iommu.c b/arch/powerpc/platforms/celleb/iommu.c
index f63b94c65353..755d869d8553 100644
--- a/arch/powerpc/platforms/celleb/iommu.c
+++ b/arch/powerpc/platforms/celleb/iommu.c
@@ -37,7 +37,7 @@ static int __init find_dma_window(u64 *io_space_id, u64 *ioid,
37 const unsigned long *dma_window; 37 const unsigned long *dma_window;
38 38
39 for_each_node_by_type(dn, "ioif") { 39 for_each_node_by_type(dn, "ioif") {
40 dma_window = get_property(dn, "toshiba,dma-window", NULL); 40 dma_window = of_get_property(dn, "toshiba,dma-window", NULL);
41 if (dma_window) { 41 if (dma_window) {
42 *io_space_id = (dma_window[0] >> 32) & 0xffffffffUL; 42 *io_space_id = (dma_window[0] >> 32) & 0xffffffffUL;
43 *ioid = dma_window[0] & 0x7ffUL; 43 *ioid = dma_window[0] & 0x7ffUL;
@@ -80,7 +80,7 @@ static int celleb_of_bus_notify(struct notifier_block *nb,
80 if (action != BUS_NOTIFY_ADD_DEVICE) 80 if (action != BUS_NOTIFY_ADD_DEVICE)
81 return 0; 81 return 0;
82 82
83 dev->archdata.dma_ops = pci_dma_ops; 83 dev->archdata.dma_ops = get_pci_dma_ops();
84 84
85 return 0; 85 return 0;
86} 86}
@@ -95,7 +95,7 @@ static int __init celleb_init_iommu(void)
95 return -ENODEV; 95 return -ENODEV;
96 96
97 celleb_init_direct_mapping(); 97 celleb_init_direct_mapping();
98 pci_dma_ops = &dma_direct_ops; 98 set_pci_dma_ops(&dma_direct_ops);
99 bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier); 99 bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier);
100 100
101 return 0; 101 return 0;
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c
index 98de836dfed3..d1adf34cd5e8 100644
--- a/arch/powerpc/platforms/celleb/pci.c
+++ b/arch/powerpc/platforms/celleb/pci.c
@@ -309,13 +309,13 @@ static int __devinit celleb_setup_fake_pci_device(struct device_node *node,
309 goto error; 309 goto error;
310 } 310 }
311 311
312 name = get_property(node, "model", &rlen); 312 name = of_get_property(node, "model", &rlen);
313 if (!name) { 313 if (!name) {
314 printk(KERN_ERR "PCI: model property not found.\n"); 314 printk(KERN_ERR "PCI: model property not found.\n");
315 goto error; 315 goto error;
316 } 316 }
317 317
318 wi4 = get_property(node, "reg", &rlen); 318 wi4 = of_get_property(node, "reg", &rlen);
319 if (wi4 == NULL) 319 if (wi4 == NULL)
320 goto error; 320 goto error;
321 321
@@ -352,10 +352,10 @@ static int __devinit celleb_setup_fake_pci_device(struct device_node *node,
352 } 352 }
353 pr_debug("PCI: res assigned 0x%016lx\n", (unsigned long)*res); 353 pr_debug("PCI: res assigned 0x%016lx\n", (unsigned long)*res);
354 354
355 wi0 = get_property(node, "device-id", NULL); 355 wi0 = of_get_property(node, "device-id", NULL);
356 wi1 = get_property(node, "vendor-id", NULL); 356 wi1 = of_get_property(node, "vendor-id", NULL);
357 wi2 = get_property(node, "class-code", NULL); 357 wi2 = of_get_property(node, "class-code", NULL);
358 wi3 = get_property(node, "revision-id", NULL); 358 wi3 = of_get_property(node, "revision-id", NULL);
359 359
360 celleb_config_write_fake(*config, PCI_DEVICE_ID, 2, wi0[0] & 0xffff); 360 celleb_config_write_fake(*config, PCI_DEVICE_ID, 2, wi0[0] & 0xffff);
361 celleb_config_write_fake(*config, PCI_VENDOR_ID, 2, wi1[0] & 0xffff); 361 celleb_config_write_fake(*config, PCI_VENDOR_ID, 2, wi1[0] & 0xffff);
@@ -376,7 +376,7 @@ static int __devinit celleb_setup_fake_pci_device(struct device_node *node,
376 376
377 celleb_setup_pci_base_addrs(hose, devno, fn, num_base_addr); 377 celleb_setup_pci_base_addrs(hose, devno, fn, num_base_addr);
378 378
379 li = get_property(node, "interrupts", &rlen); 379 li = of_get_property(node, "interrupts", &rlen);
380 val = li[0]; 380 val = li[0];
381 celleb_config_write_fake(*config, PCI_INTERRUPT_PIN, 1, 1); 381 celleb_config_write_fake(*config, PCI_INTERRUPT_PIN, 1, 1);
382 celleb_config_write_fake(*config, PCI_INTERRUPT_LINE, 1, val); 382 celleb_config_write_fake(*config, PCI_INTERRUPT_LINE, 1, val);
@@ -424,7 +424,7 @@ static int __devinit phb_set_bus_ranges(struct device_node *dev,
424 const int *bus_range; 424 const int *bus_range;
425 unsigned int len; 425 unsigned int len;
426 426
427 bus_range = get_property(dev, "bus-range", &len); 427 bus_range = of_get_property(dev, "bus-range", &len);
428 if (bus_range == NULL || len < 2 * sizeof(int)) 428 if (bus_range == NULL || len < 2 * sizeof(int))
429 return 1; 429 return 1;
430 430
@@ -451,7 +451,7 @@ int __devinit celleb_setup_phb(struct pci_controller *phb)
451 struct device_node *node; 451 struct device_node *node;
452 unsigned int rlen; 452 unsigned int rlen;
453 453
454 name = get_property(dev, "name", &rlen); 454 name = of_get_property(dev, "name", &rlen);
455 if (!name) 455 if (!name)
456 return 1; 456 return 1;
457 457
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
index 5f4d0d933238..596ab2a788d4 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -67,7 +67,7 @@ static void celleb_show_cpuinfo(struct seq_file *m)
67 67
68 root = of_find_node_by_path("/"); 68 root = of_find_node_by_path("/");
69 if (root) 69 if (root)
70 model = get_property(root, "model", NULL); 70 model = of_get_property(root, "model", NULL);
71 /* using "CHRP" is to trick anaconda into installing FCx into Celleb */ 71 /* using "CHRP" is to trick anaconda into installing FCx into Celleb */
72 seq_printf(m, "machine\t\t: %s %s\n", celleb_machine_type, model); 72 seq_printf(m, "machine\t\t: %s %s\n", celleb_machine_type, model);
73 of_node_put(root); 73 of_node_put(root);
@@ -128,15 +128,6 @@ static int __init celleb_probe(void)
128 return 1; 128 return 1;
129} 129}
130 130
131/*
132 * Cell has no legacy IO; anything calling this function has to
133 * fail or bad things will happen
134 */
135static int celleb_check_legacy_ioport(unsigned int baseport)
136{
137 return -ENODEV;
138}
139
140#ifdef CONFIG_KEXEC 131#ifdef CONFIG_KEXEC
141static void celleb_kexec_cpu_down(int crash, int secondary) 132static void celleb_kexec_cpu_down(int crash, int secondary)
142{ 133{
@@ -173,7 +164,6 @@ define_machine(celleb) {
173 .get_rtc_time = beat_get_rtc_time, 164 .get_rtc_time = beat_get_rtc_time,
174 .set_rtc_time = beat_set_rtc_time, 165 .set_rtc_time = beat_set_rtc_time,
175 .calibrate_decr = generic_calibrate_decr, 166 .calibrate_decr = generic_calibrate_decr,
176 .check_legacy_ioport = celleb_check_legacy_ioport,
177 .progress = celleb_progress, 167 .progress = celleb_progress,
178 .power_save = beat_power_save, 168 .power_save = beat_power_save,
179 .nvram_size = beat_nvram_get_size, 169 .nvram_size = beat_nvram_get_size,
diff --git a/arch/powerpc/platforms/chrp/Kconfig b/arch/powerpc/platforms/chrp/Kconfig
new file mode 100644
index 000000000000..d2c690531963
--- /dev/null
+++ b/arch/powerpc/platforms/chrp/Kconfig
@@ -0,0 +1,11 @@
1config PPC_CHRP
2 bool "Common Hardware Reference Platform (CHRP) based machines"
3 depends on PPC_MULTIPLATFORM && PPC32
4 select MPIC
5 select PPC_I8259
6 select PPC_INDIRECT_PCI
7 select PPC_RTAS
8 select PPC_MPC106
9 select PPC_UDBG_16550
10 select PPC_NATIVE
11 default y
diff --git a/arch/powerpc/platforms/chrp/nvram.c b/arch/powerpc/platforms/chrp/nvram.c
index 0dd4a64757d9..8efd4244701c 100644
--- a/arch/powerpc/platforms/chrp/nvram.c
+++ b/arch/powerpc/platforms/chrp/nvram.c
@@ -74,7 +74,7 @@ void __init chrp_nvram_init(void)
74 if (nvram == NULL) 74 if (nvram == NULL)
75 return; 75 return;
76 76
77 nbytes_p = get_property(nvram, "#bytes", &proplen); 77 nbytes_p = of_get_property(nvram, "#bytes", &proplen);
78 if (nbytes_p == NULL || proplen != sizeof(unsigned int)) 78 if (nbytes_p == NULL || proplen != sizeof(unsigned int))
79 return; 79 return;
80 80
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index ddb4a116ea89..1469d6478f67 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -7,7 +7,6 @@
7#include <linux/delay.h> 7#include <linux/delay.h>
8#include <linux/string.h> 8#include <linux/string.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/ide.h>
11 10
12#include <asm/io.h> 11#include <asm/io.h>
13#include <asm/pgtable.h> 12#include <asm/pgtable.h>
@@ -137,9 +136,11 @@ hydra_init(void)
137 struct device_node *np; 136 struct device_node *np;
138 struct resource r; 137 struct resource r;
139 138
140 np = find_devices("mac-io"); 139 np = of_find_node_by_name(NULL, "mac-io");
141 if (np == NULL || of_address_to_resource(np, 0, &r)) 140 if (np == NULL || of_address_to_resource(np, 0, &r)) {
141 of_node_put(np);
142 return 0; 142 return 0;
143 }
143 Hydra = ioremap(r.start, r.end-r.start); 144 Hydra = ioremap(r.start, r.end-r.start);
144 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); 145 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start);
145 printk("Hydra Feature_Control was %x", 146 printk("Hydra Feature_Control was %x",
@@ -186,10 +187,9 @@ setup_python(struct pci_controller *hose, struct device_node *dev)
186/* Marvell Discovery II based Pegasos 2 */ 187/* Marvell Discovery II based Pegasos 2 */
187static void __init setup_peg2(struct pci_controller *hose, struct device_node *dev) 188static void __init setup_peg2(struct pci_controller *hose, struct device_node *dev)
188{ 189{
189 struct device_node *root = find_path_device("/"); 190 struct device_node *root = of_find_node_by_path("/");
190 struct device_node *rtas; 191 struct device_node *rtas;
191 192
192 of_node_get(root);
193 rtas = of_find_node_by_name (root, "rtas"); 193 rtas = of_find_node_by_name (root, "rtas");
194 if (rtas) { 194 if (rtas) {
195 hose->ops = &rtas_pci_ops; 195 hose->ops = &rtas_pci_ops;
@@ -199,6 +199,7 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
199 " your firmware\n"); 199 " your firmware\n");
200 } 200 }
201 pci_assign_all_buses = 1; 201 pci_assign_all_buses = 1;
202 /* keep the reference to the root node */
202} 203}
203 204
204void __init 205void __init
@@ -211,14 +212,14 @@ chrp_find_bridges(void)
211 const unsigned int *dma; 212 const unsigned int *dma;
212 const char *model, *machine; 213 const char *model, *machine;
213 int is_longtrail = 0, is_mot = 0, is_pegasos = 0; 214 int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
214 struct device_node *root = find_path_device("/"); 215 struct device_node *root = of_find_node_by_path("/");
215 struct resource r; 216 struct resource r;
216 /* 217 /*
217 * The PCI host bridge nodes on some machines don't have 218 * The PCI host bridge nodes on some machines don't have
218 * properties to adequately identify them, so we have to 219 * properties to adequately identify them, so we have to
219 * look at what sort of machine this is as well. 220 * look at what sort of machine this is as well.
220 */ 221 */
221 machine = get_property(root, "model", NULL); 222 machine = of_get_property(root, "model", NULL);
222 if (machine != NULL) { 223 if (machine != NULL) {
223 is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0; 224 is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0;
224 is_mot = strncmp(machine, "MOT", 3) == 0; 225 is_mot = strncmp(machine, "MOT", 3) == 0;
@@ -237,7 +238,7 @@ chrp_find_bridges(void)
237 dev->full_name); 238 dev->full_name);
238 continue; 239 continue;
239 } 240 }
240 bus_range = get_property(dev, "bus-range", &len); 241 bus_range = of_get_property(dev, "bus-range", &len);
241 if (bus_range == NULL || len < 2 * sizeof(int)) { 242 if (bus_range == NULL || len < 2 * sizeof(int)) {
242 printk(KERN_WARNING "Can't get bus-range for %s\n", 243 printk(KERN_WARNING "Can't get bus-range for %s\n",
243 dev->full_name); 244 dev->full_name);
@@ -263,7 +264,7 @@ chrp_find_bridges(void)
263 hose->first_busno = bus_range[0]; 264 hose->first_busno = bus_range[0];
264 hose->last_busno = bus_range[1]; 265 hose->last_busno = bus_range[1];
265 266
266 model = get_property(dev, "model", NULL); 267 model = of_get_property(dev, "model", NULL);
267 if (model == NULL) 268 if (model == NULL)
268 model = "<none>"; 269 model = "<none>";
269 if (device_is_compatible(dev, "IBM,python")) { 270 if (device_is_compatible(dev, "IBM,python")) {
@@ -285,7 +286,8 @@ chrp_find_bridges(void)
285 r.start + 0x000f8000, 286 r.start + 0x000f8000,
286 r.start + 0x000f8010); 287 r.start + 0x000f8010);
287 if (index == 0) { 288 if (index == 0) {
288 dma = get_property(dev, "system-dma-base",&len); 289 dma = of_get_property(dev, "system-dma-base",
290 &len);
289 if (dma && len >= sizeof(*dma)) { 291 if (dma && len >= sizeof(*dma)) {
290 dma = (unsigned int *) 292 dma = (unsigned int *)
291 (((unsigned long)dma) + 293 (((unsigned long)dma) +
@@ -303,12 +305,13 @@ chrp_find_bridges(void)
303 305
304 /* check the first bridge for a property that we can 306 /* check the first bridge for a property that we can
305 use to set pci_dram_offset */ 307 use to set pci_dram_offset */
306 dma = get_property(dev, "ibm,dma-ranges", &len); 308 dma = of_get_property(dev, "ibm,dma-ranges", &len);
307 if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) { 309 if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) {
308 pci_dram_offset = dma[2] - dma[3]; 310 pci_dram_offset = dma[2] - dma[3];
309 printk("pci_dram_offset = %lx\n", pci_dram_offset); 311 printk("pci_dram_offset = %lx\n", pci_dram_offset);
310 } 312 }
311 } 313 }
314 of_node_put(root);
312} 315}
313 316
314/* SL82C105 IDE Control/Status Register */ 317/* SL82C105 IDE Control/Status Register */
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 117c9a0055bd..1870038a8e0a 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -28,7 +28,6 @@
28#include <linux/adb.h> 28#include <linux/adb.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/ide.h>
32#include <linux/console.h> 31#include <linux/console.h>
33#include <linux/seq_file.h> 32#include <linux/seq_file.h>
34#include <linux/root_dev.h> 33#include <linux/root_dev.h>
@@ -111,9 +110,9 @@ void chrp_show_cpuinfo(struct seq_file *m)
111 struct device_node *root; 110 struct device_node *root;
112 const char *model = ""; 111 const char *model = "";
113 112
114 root = find_path_device("/"); 113 root = of_find_node_by_path("/");
115 if (root) 114 if (root)
116 model = get_property(root, "model", NULL); 115 model = of_get_property(root, "model", NULL);
117 seq_printf(m, "machine\t\t: CHRP %s\n", model); 116 seq_printf(m, "machine\t\t: CHRP %s\n", model);
118 117
119 /* longtrail (goldengate) stuff */ 118 /* longtrail (goldengate) stuff */
@@ -161,6 +160,7 @@ void chrp_show_cpuinfo(struct seq_file *m)
161 gg2_cachetypes[(t>>2) & 3], 160 gg2_cachetypes[(t>>2) & 3],
162 gg2_cachemodes[t & 3]); 161 gg2_cachemodes[t & 3]);
163 } 162 }
163 of_node_put(root);
164} 164}
165 165
166/* 166/*
@@ -205,13 +205,15 @@ static void __init sio_init(void)
205{ 205{
206 struct device_node *root; 206 struct device_node *root;
207 207
208 if ((root = find_path_device("/")) && 208 if ((root = of_find_node_by_path("/")) &&
209 !strncmp(get_property(root, "model", NULL), "IBM,LongTrail", 13)) { 209 !strncmp(of_get_property(root, "model", NULL),
210 "IBM,LongTrail", 13)) {
210 /* logical device 0 (KBC/Keyboard) */ 211 /* logical device 0 (KBC/Keyboard) */
211 sio_fixup_irq("keyboard", 0, 1, 2); 212 sio_fixup_irq("keyboard", 0, 1, 2);
212 /* select logical device 1 (KBC/Mouse) */ 213 /* select logical device 1 (KBC/Mouse) */
213 sio_fixup_irq("mouse", 1, 12, 2); 214 sio_fixup_irq("mouse", 1, 12, 2);
214 } 215 }
216 of_node_put(root);
215} 217}
216 218
217 219
@@ -224,12 +226,12 @@ static void __init pegasos_set_l2cr(void)
224 return; 226 return;
225 227
226 /* Enable L2 cache if needed */ 228 /* Enable L2 cache if needed */
227 np = find_type_devices("cpu"); 229 np = of_find_node_by_type(NULL, "cpu");
228 if (np != NULL) { 230 if (np != NULL) {
229 const unsigned int *l2cr = get_property(np, "l2cr", NULL); 231 const unsigned int *l2cr = of_get_property(np, "l2cr", NULL);
230 if (l2cr == NULL) { 232 if (l2cr == NULL) {
231 printk ("Pegasos l2cr : no cpu l2cr property found\n"); 233 printk ("Pegasos l2cr : no cpu l2cr property found\n");
232 return; 234 goto out;
233 } 235 }
234 if (!((*l2cr) & 0x80000000)) { 236 if (!((*l2cr) & 0x80000000)) {
235 printk ("Pegasos l2cr : L2 cache was not active, " 237 printk ("Pegasos l2cr : L2 cache was not active, "
@@ -238,6 +240,8 @@ static void __init pegasos_set_l2cr(void)
238 _set_L2CR((*l2cr) | 0x80000000); 240 _set_L2CR((*l2cr) | 0x80000000);
239 } 241 }
240 } 242 }
243out:
244 of_node_put(np);
241} 245}
242 246
243static void briq_restart(char *cmd) 247static void briq_restart(char *cmd)
@@ -250,14 +254,14 @@ static void briq_restart(char *cmd)
250 254
251void __init chrp_setup_arch(void) 255void __init chrp_setup_arch(void)
252{ 256{
253 struct device_node *root = find_path_device ("/"); 257 struct device_node *root = of_find_node_by_path("/");
254 const char *machine = NULL; 258 const char *machine = NULL;
255 259
256 /* init to some ~sane value until calibrate_delay() runs */ 260 /* init to some ~sane value until calibrate_delay() runs */
257 loops_per_jiffy = 50000000/HZ; 261 loops_per_jiffy = 50000000/HZ;
258 262
259 if (root) 263 if (root)
260 machine = get_property(root, "model", NULL); 264 machine = of_get_property(root, "model", NULL);
261 if (machine && strncmp(machine, "Pegasos", 7) == 0) { 265 if (machine && strncmp(machine, "Pegasos", 7) == 0) {
262 _chrp_type = _CHRP_Pegasos; 266 _chrp_type = _CHRP_Pegasos;
263 } else if (machine && strncmp(machine, "IBM", 3) == 0) { 267 } else if (machine && strncmp(machine, "IBM", 3) == 0) {
@@ -273,6 +277,7 @@ void __init chrp_setup_arch(void)
273 /* Let's assume it is an IBM chrp if all else fails */ 277 /* Let's assume it is an IBM chrp if all else fails */
274 _chrp_type = _CHRP_IBM; 278 _chrp_type = _CHRP_IBM;
275 } 279 }
280 of_node_put(root);
276 printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]); 281 printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]);
277 282
278 rtas_initialize(); 283 rtas_initialize();
@@ -361,8 +366,8 @@ static void __init chrp_find_openpic(void)
361 return; 366 return;
362 root = of_find_node_by_path("/"); 367 root = of_find_node_by_path("/");
363 if (root) { 368 if (root) {
364 opprop = get_property(root, "platform-open-pic", &oplen); 369 opprop = of_get_property(root, "platform-open-pic", &oplen);
365 na = prom_n_addr_cells(root); 370 na = of_n_addr_cells(root);
366 } 371 }
367 if (opprop && oplen >= na * sizeof(unsigned int)) { 372 if (opprop && oplen >= na * sizeof(unsigned int)) {
368 opaddr = opprop[na-1]; /* assume 32-bit */ 373 opaddr = opprop[na-1]; /* assume 32-bit */
@@ -378,7 +383,7 @@ static void __init chrp_find_openpic(void)
378 383
379 printk(KERN_INFO "OpenPIC at %lx\n", opaddr); 384 printk(KERN_INFO "OpenPIC at %lx\n", opaddr);
380 385
381 iranges = get_property(np, "interrupt-ranges", &len); 386 iranges = of_get_property(np, "interrupt-ranges", &len);
382 if (iranges == NULL) 387 if (iranges == NULL)
383 len = 0; /* non-distributed mpic */ 388 len = 0; /* non-distributed mpic */
384 else 389 else
@@ -427,7 +432,7 @@ static void __init chrp_find_openpic(void)
427 of_node_put(np); 432 of_node_put(np);
428} 433}
429 434
430#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) 435#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
431static struct irqaction xmon_irqaction = { 436static struct irqaction xmon_irqaction = {
432 .handler = xmon_irq, 437 .handler = xmon_irq,
433 .mask = CPU_MASK_NONE, 438 .mask = CPU_MASK_NONE,
@@ -463,15 +468,16 @@ static void __init chrp_find_8259(void)
463 * Also, Pegasos-type platforms don't have a proper node to start 468 * Also, Pegasos-type platforms don't have a proper node to start
464 * from anyway 469 * from anyway
465 */ 470 */
466 for (np = find_devices("pci"); np != NULL; np = np->next) { 471 for_each_node_by_name(np, "pci") {
467 const unsigned int *addrp = get_property(np, 472 const unsigned int *addrp = of_get_property(np,
468 "8259-interrupt-acknowledge", NULL); 473 "8259-interrupt-acknowledge", NULL);
469 474
470 if (addrp == NULL) 475 if (addrp == NULL)
471 continue; 476 continue;
472 chrp_int_ack = addrp[prom_n_addr_cells(np)-1]; 477 chrp_int_ack = addrp[of_n_addr_cells(np)-1];
473 break; 478 break;
474 } 479 }
480 of_node_put(np);
475 if (np == NULL) 481 if (np == NULL)
476 printk(KERN_WARNING "Cannot find PCI interrupt acknowledge" 482 printk(KERN_WARNING "Cannot find PCI interrupt acknowledge"
477 " address, polling\n"); 483 " address, polling\n");
@@ -493,7 +499,7 @@ static void __init chrp_find_8259(void)
493 499
494void __init chrp_init_IRQ(void) 500void __init chrp_init_IRQ(void)
495{ 501{
496#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) 502#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
497 struct device_node *kbd; 503 struct device_node *kbd;
498#endif 504#endif
499 chrp_find_openpic(); 505 chrp_find_openpic();
@@ -510,13 +516,14 @@ void __init chrp_init_IRQ(void)
510 if (_chrp_type == _CHRP_Pegasos) 516 if (_chrp_type == _CHRP_Pegasos)
511 ppc_md.get_irq = i8259_irq; 517 ppc_md.get_irq = i8259_irq;
512 518
513#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) 519#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
514 /* see if there is a keyboard in the device tree 520 /* see if there is a keyboard in the device tree
515 with a parent of type "adb" */ 521 with a parent of type "adb" */
516 for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next) 522 for_each_node_by_name(kbd, "keyboard")
517 if (kbd->parent && kbd->parent->type 523 if (kbd->parent && kbd->parent->type
518 && strcmp(kbd->parent->type, "adb") == 0) 524 && strcmp(kbd->parent->type, "adb") == 0)
519 break; 525 break;
526 of_node_put(kbd);
520 if (kbd) 527 if (kbd)
521 setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction); 528 setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction);
522#endif 529#endif
@@ -542,9 +549,9 @@ chrp_init2(void)
542 /* Get the event scan rate for the rtas so we know how 549 /* Get the event scan rate for the rtas so we know how
543 * often it expects a heartbeat. -- Cort 550 * often it expects a heartbeat. -- Cort
544 */ 551 */
545 device = find_devices("rtas"); 552 device = of_find_node_by_name(NULL, "rtas");
546 if (device) 553 if (device)
547 p = get_property(device, "rtas-event-scan-rate", NULL); 554 p = of_get_property(device, "rtas-event-scan-rate", NULL);
548 if (p && *p) { 555 if (p && *p) {
549 /* 556 /*
550 * Arrange to call chrp_event_scan at least *p times 557 * Arrange to call chrp_event_scan at least *p times
@@ -571,6 +578,7 @@ chrp_init2(void)
571 printk("RTAS Event Scan Rate: %u (%lu jiffies)\n", 578 printk("RTAS Event Scan Rate: %u (%lu jiffies)\n",
572 *p, interval); 579 *p, interval);
573 } 580 }
581 of_node_put(device);
574 582
575 if (ppc_md.progress) 583 if (ppc_md.progress)
576 ppc_md.progress(" Have fun! ", 0x7777); 584 ppc_md.progress(" Have fun! ", 0x7777);
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 7d7889026936..96d1e4b3c493 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -39,12 +39,17 @@ long __init chrp_time_init(void)
39 struct resource r; 39 struct resource r;
40 int base; 40 int base;
41 41
42 rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 42 rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00");
43 if (rtcs == NULL) 43 if (rtcs == NULL)
44 rtcs = find_compatible_devices("rtc", "ds1385-rtc"); 44 rtcs = of_find_compatible_node(NULL, "rtc", "ds1385-rtc");
45 if (rtcs == NULL || of_address_to_resource(rtcs, 0, &r)) 45 if (rtcs == NULL)
46 return 0;
47 if (of_address_to_resource(rtcs, 0, &r)) {
48 of_node_put(rtcs);
46 return 0; 49 return 0;
47 50 }
51 of_node_put(rtcs);
52
48 base = r.start; 53 base = r.start;
49 nvram_as1 = 0; 54 nvram_as1 = 0;
50 nvram_as0 = base; 55 nvram_as0 = base;
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 3410bcbc9dbe..9557908ef545 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -2,78 +2,6 @@ choice
2 prompt "Machine Type" 2 prompt "Machine Type"
3 depends on EMBEDDED6xx 3 depends on EMBEDDED6xx
4 4
5config KATANA
6 bool "Artesyn-Katana"
7 help
8 Select KATANA if configuring an Artesyn KATANA 750i or 3750
9 cPCI board.
10
11config WILLOW
12 bool "Cogent-Willow"
13
14config CPCI690
15 bool "Force-CPCI690"
16 help
17 Select CPCI690 if configuring a Force CPCI690 cPCI board.
18
19config POWERPMC250
20 bool "Force-PowerPMC250"
21
22config CHESTNUT
23 bool "IBM 750FX Eval board or 750GX Eval board"
24 help
25 Select CHESTNUT if configuring an IBM 750FX Eval Board or a
26 IBM 750GX Eval board.
27
28config SPRUCE
29 bool "IBM-Spruce"
30 select PPC_INDIRECT_PCI
31
32config HDPU
33 bool "Sky-HDPU"
34 help
35 Select HDPU if configuring a Sky Computers Compute Blade.
36
37config HDPU_FEATURES
38 depends on HDPU
39 tristate "HDPU-Features"
40 help
41 Select to enable HDPU enhanced features.
42
43config EV64260
44 bool "Marvell-EV64260BP"
45 help
46 Select EV64260 if configuring a Marvell (formerly Galileo)
47 EV64260BP Evaluation platform.
48
49config LOPEC
50 bool "Motorola-LoPEC"
51 select PPC_I8259
52
53config MVME5100
54 bool "Motorola-MVME5100"
55 select PPC_INDIRECT_PCI
56
57config PPLUS
58 bool "Motorola-PowerPlus"
59 select PPC_I8259
60 select PPC_INDIRECT_PCI
61
62config PRPMC750
63 bool "Motorola-PrPMC750"
64 select PPC_INDIRECT_PCI
65
66config PRPMC800
67 bool "Motorola-PrPMC800"
68 select PPC_INDIRECT_PCI
69
70config SANDPOINT
71 bool "Motorola-Sandpoint"
72 select PPC_I8259
73 help
74 Select SANDPOINT if configuring for a Motorola Sandpoint X3
75 (any flavor).
76
77config LINKSTATION 5config LINKSTATION
78 bool "Linkstation / Kurobox(HG) from Buffalo" 6 bool "Linkstation / Kurobox(HG) from Buffalo"
79 select MPIC 7 select MPIC
@@ -97,212 +25,24 @@ config MPC7448HPC2
97 help 25 help
98 Select MPC7448HPC2 if configuring for Freescale MPC7448HPC2 (Taiga) 26 Select MPC7448HPC2 if configuring for Freescale MPC7448HPC2 (Taiga)
99 platform 27 platform
100
101config RADSTONE_PPC7D
102 bool "Radstone Technology PPC7D board"
103 select PPC_I8259
104
105config PAL4
106 bool "SBS-Palomar4"
107
108config EST8260
109 bool "EST8260"
110 ---help---
111 The EST8260 is a single-board computer manufactured by Wind River
112 Systems, Inc. (formerly Embedded Support Tools Corp.) and based on
113 the MPC8260. Wind River Systems has a website at
114 <http://www.windriver.com/>, but the EST8260 cannot be found on it
115 and has probably been discontinued or rebadged.
116
117config SBC82xx
118 bool "SBC82xx"
119 ---help---
120 SBC PowerQUICC II, single-board computer with MPC82xx CPU
121 Manufacturer: Wind River Systems, Inc.
122 Date of Release: May 2003
123 End of Life: -
124 URL: <http://www.windriver.com/>
125
126config SBS8260
127 bool "SBS8260"
128
129config RPX8260
130 bool "RPXSUPER"
131
132config TQM8260
133 bool "TQM8260"
134 ---help---
135 MPC8260 based module, little larger than credit card,
136 up to 128 MB global + 64 MB local RAM, 32 MB Flash,
137 32 kB EEPROM, 256 kB L@ Cache, 10baseT + 100baseT Ethernet,
138 2 x serial ports, ...
139 Manufacturer: TQ Components, www.tq-group.de
140 Date of Release: June 2001
141 End of Life: not yet :-)
142 URL: <http://www.denx.de/PDF/TQM82xx_SPEC_Rev005.pdf>
143
144config ADS8272
145 bool "ADS8272"
146
147config PQ2FADS
148 bool "Freescale-PQ2FADS"
149 help
150 Select PQ2FADS if you wish to configure for a Freescale
151 PQ2FADS board (-VR or -ZU).
152
153config EV64360
154 bool "Marvell-EV64360BP"
155 help
156 Select EV64360 if configuring a Marvell EV64360BP Evaluation
157 platform.
158endchoice 28endchoice
159 29
160config PQ2ADS
161 bool
162 depends on ADS8272
163 default y
164
165config TQM8xxL
166 bool
167 depends on 8xx && (TQM823L || TQM850L || FPS850L || TQM855L || TQM860L)
168 default y
169
170config 8260
171 bool "CPM2 Support" if WILLOW
172 depends on 6xx
173 default y if TQM8260 || RPX8260 || EST8260 || SBS8260 || SBC82xx || PQ2FADS
174 help
175 The MPC8260 is a typical embedded CPU made by Motorola. Selecting
176 this option means that you wish to build a kernel for a machine with
177 an 8260 class CPU.
178
179config 8272
180 bool
181 depends on 6xx
182 default y if ADS8272
183 select 8260
184 help
185 The MPC8272 CPM has a different internal dpram setup than other CPM2
186 devices
187
188config CPM2
189 bool
190 depends on 8260 || MPC8560 || MPC8555
191 default y
192 help
193 The CPM2 (Communications Processor Module) is a coprocessor on
194 embedded CPUs made by Motorola. Selecting this option means that
195 you wish to build a kernel for a machine with a CPM2 coprocessor
196 on it (826x, 827x, 8560).
197
198config PPC_GEN550
199 bool
200 depends on SANDPOINT || SPRUCE || PPLUS || \
201 PRPMC750 || PRPMC800 || LOPEC || \
202 (EV64260 && !SERIAL_MPSC) || CHESTNUT || RADSTONE_PPC7D || \
203 83xx || LINKSTATION
204 default y
205
206config FORCE
207 bool
208 depends on 6xx && POWERPMC250
209 default y
210
211config GT64260
212 bool
213 depends on EV64260 || CPCI690
214 default y
215
216config MV64360 # Really MV64360 & MV64460
217 bool
218 depends on CHESTNUT || KATANA || RADSTONE_PPC7D || HDPU || EV64360
219 default y
220
221config MV64X60
222 bool
223 depends on (GT64260 || MV64360)
224 select PPC_INDIRECT_PCI
225 default y
226
227config TSI108_BRIDGE 30config TSI108_BRIDGE
228 bool 31 bool
229 depends on MPC7448HPC2 32 depends on MPC7448HPC2
230 default y 33 default y
231 34
232menu "Set bridge options"
233 depends on MV64X60
234
235config NOT_COHERENT_CACHE
236 bool "Turn off Cache Coherency"
237 default n
238 help
239 Some 64x60 bridges lock up when trying to enforce cache coherency.
240 When this option is selected, cache coherency will be turned off.
241 Note that this can cause other problems (e.g., stale data being
242 speculatively loaded via a cached mapping). Use at your own risk.
243
244config MV64X60_BASE
245 hex "Set bridge base used by firmware"
246 default "0xf1000000"
247 help
248 A firmware can leave the base address of the bridge's registers at
249 a non-standard location. If so, set this value to reflect the
250 address of that non-standard location.
251
252config MV64X60_NEW_BASE
253 hex "Set bridge base used by kernel"
254 default "0xf1000000"
255 help
256 If the current base address of the bridge's registers is not where
257 you want it, set this value to the address that you want it moved to.
258
259endmenu
260
261config NONMONARCH_SUPPORT
262 bool "Enable Non-Monarch Support"
263 depends on PRPMC800
264
265config HARRIER
266 bool
267 depends on PRPMC800
268 default y
269
270config EPIC_SERIAL_MODE
271 bool
272 depends on 6xx && (LOPEC || SANDPOINT)
273 default y
274
275config MPC10X_BRIDGE 35config MPC10X_BRIDGE
276 bool 36 bool
277 depends on POWERPMC250 || LOPEC || SANDPOINT || LINKSTATION 37 depends on LINKSTATION
278 select PPC_INDIRECT_PCI 38 select PPC_INDIRECT_PCI
279 default y 39 default y
280 40
281config MPC10X_OPENPIC 41config MPC10X_OPENPIC
282 bool 42 bool
283 depends on POWERPMC250 || LOPEC || SANDPOINT || LINKSTATION 43 depends on LINKSTATION
284 default y 44 default y
285 45
286config MPC10X_STORE_GATHERING 46config MPC10X_STORE_GATHERING
287 bool "Enable MPC10x store gathering" 47 bool "Enable MPC10x store gathering"
288 depends on MPC10X_BRIDGE 48 depends on MPC10X_BRIDGE
289
290config SANDPOINT_ENABLE_UART1
291 bool "Enable DUART mode on Sandpoint"
292 depends on SANDPOINT
293 help
294 If this option is enabled then the MPC824x processor will run
295 in DUART mode instead of UART mode.
296
297config HARRIER_STORE_GATHERING
298 bool "Enable Harrier store gathering"
299 depends on HARRIER
300
301config MVME5100_IPMC761_PRESENT
302 bool "MVME5100 configured with an IPMC761"
303 depends on MVME5100
304 select PPC_I8259
305
306config SPRUCE_BAUD_33M
307 bool "Spruce baud clock support"
308 depends on SPRUCE
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 3f6c4114f908..b412f006a9c5 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -58,11 +58,11 @@ static int __init add_bridge(struct device_node *dev)
58{ 58{
59 int len; 59 int len;
60 struct pci_controller *hose; 60 struct pci_controller *hose;
61 int *bus_range; 61 const int *bus_range;
62 62
63 printk("Adding PCI host bridge %s\n", dev->full_name); 63 printk("Adding PCI host bridge %s\n", dev->full_name);
64 64
65 bus_range = (int *) get_property(dev, "bus-range", &len); 65 bus_range = of_get_property(dev, "bus-range", &len);
66 if (bus_range == NULL || len < 2 * sizeof(int)) 66 if (bus_range == NULL || len < 2 * sizeof(int))
67 printk(KERN_WARNING "Can't get bus-range for %s, assume" 67 printk(KERN_WARNING "Can't get bus-range for %s, assume"
68 " bus 0\n", dev->full_name); 68 " bus 0\n", dev->full_name);
@@ -106,7 +106,7 @@ static void __init linkstation_init_IRQ(void)
106{ 106{
107 struct mpic *mpic; 107 struct mpic *mpic;
108 struct device_node *dnp; 108 struct device_node *dnp;
109 void *prop; 109 const u32 *prop;
110 int size; 110 int size;
111 phys_addr_t paddr; 111 phys_addr_t paddr;
112 112
@@ -114,7 +114,7 @@ static void __init linkstation_init_IRQ(void)
114 if (dnp == NULL) 114 if (dnp == NULL)
115 return; 115 return;
116 116
117 prop = (struct device_node *)get_property(dnp, "reg", &size); 117 prop = of_get_property(dnp, "reg", &size);
118 paddr = (phys_addr_t)of_translate_address(dnp, prop); 118 paddr = (phys_addr_t)of_translate_address(dnp, prop);
119 119
120 mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET, 4, 32, " EPIC "); 120 mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET, 4, 32, " EPIC ");
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c
index 0e837762cc5b..d0bee9f19e4e 100644
--- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
+++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
@@ -110,8 +110,8 @@ static int __init ls_uarts_init(void)
110 if (!avr) 110 if (!avr)
111 return -EINVAL; 111 return -EINVAL;
112 112
113 avr_clock = *(u32*)get_property(avr, "clock-frequency", &len); 113 avr_clock = *(u32*)of_get_property(avr, "clock-frequency", &len);
114 phys_addr = ((u32*)get_property(avr, "reg", &len))[0]; 114 phys_addr = ((u32*)of_get_property(avr, "reg", &len))[0];
115 115
116 if (!avr_clock || !phys_addr) 116 if (!avr_clock || !phys_addr)
117 return -EINVAL; 117 return -EINVAL;
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index 3fcc85f60fbf..c3f64ddb0be6 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -25,7 +25,6 @@
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/ide.h>
29#include <linux/seq_file.h> 28#include <linux/seq_file.h>
30#include <linux/root_dev.h> 29#include <linux/root_dev.h>
31#include <linux/serial.h> 30#include <linux/serial.h>
@@ -82,7 +81,7 @@ static void __init mpc7448_hpc2_setup_arch(void)
82 if (cpu != 0) { 81 if (cpu != 0) {
83 const unsigned int *fp; 82 const unsigned int *fp;
84 83
85 fp = get_property(cpu, "clock-frequency", NULL); 84 fp = of_get_property(cpu, "clock-frequency", NULL);
86 if (fp != 0) 85 if (fp != 0)
87 loops_per_jiffy = *fp / HZ; 86 loops_per_jiffy = *fp / HZ;
88 else 87 else
@@ -91,16 +90,6 @@ static void __init mpc7448_hpc2_setup_arch(void)
91 } 90 }
92 tsi108_csr_vir_base = get_vir_csrbase(); 91 tsi108_csr_vir_base = get_vir_csrbase();
93 92
94#ifdef CONFIG_ROOT_NFS
95 ROOT_DEV = Root_NFS;
96#else
97 ROOT_DEV = Root_HDA1;
98#endif
99
100#ifdef CONFIG_BLK_DEV_INITRD
101 ROOT_DEV = Root_RAM0;
102#endif
103
104 /* setup PCI host bridge */ 93 /* setup PCI host bridge */
105#ifdef CONFIG_PCI 94#ifdef CONFIG_PCI
106 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) 95 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
@@ -143,7 +132,7 @@ static void __init mpc7448_hpc2_init_IRQ(void)
143 tsi_pic = of_find_node_by_type(NULL, "open-pic"); 132 tsi_pic = of_find_node_by_type(NULL, "open-pic");
144 if (tsi_pic) { 133 if (tsi_pic) {
145 unsigned int size; 134 unsigned int size;
146 const void *prop = get_property(tsi_pic, "reg", &size); 135 const void *prop = of_get_property(tsi_pic, "reg", &size);
147 mpic_paddr = of_translate_address(tsi_pic, prop); 136 mpic_paddr = of_translate_address(tsi_pic, prop);
148 } 137 }
149 138
diff --git a/arch/powerpc/platforms/iseries/Kconfig b/arch/powerpc/platforms/iseries/Kconfig
index 54e6b3b6f261..46c3a8e7c3a8 100644
--- a/arch/powerpc/platforms/iseries/Kconfig
+++ b/arch/powerpc/platforms/iseries/Kconfig
@@ -1,3 +1,7 @@
1config PPC_ISERIES
2 bool "IBM Legacy iSeries"
3 depends on PPC_MULTIPLATFORM && PPC64
4 select PPC_INDIRECT_IO
1 5
2menu "iSeries device drivers" 6menu "iSeries device drivers"
3 depends on PPC_ISERIES 7 depends on PPC_ISERIES
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index d7a756d5135c..3b6a9666c2c0 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -171,7 +171,7 @@ void iommu_devnode_init_iSeries(struct pci_dev *pdev, struct device_node *dn)
171{ 171{
172 struct iommu_table *tbl; 172 struct iommu_table *tbl;
173 struct pci_dn *pdn = PCI_DN(dn); 173 struct pci_dn *pdn = PCI_DN(dn);
174 const u32 *lsn = get_property(dn, "linux,logical-slot-number", NULL); 174 const u32 *lsn = of_get_property(dn, "linux,logical-slot-number", NULL);
175 175
176 BUG_ON(lsn == NULL); 176 BUG_ON(lsn == NULL);
177 177
@@ -194,5 +194,5 @@ void iommu_init_early_iSeries(void)
194 ppc_md.tce_build = tce_build_iSeries; 194 ppc_md.tce_build = tce_build_iSeries;
195 ppc_md.tce_free = tce_free_iSeries; 195 ppc_md.tce_free = tce_free_iSeries;
196 196
197 pci_dma_ops = &dma_iommu_ops; 197 set_pci_dma_ops(&dma_iommu_ops);
198} 198}
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index 5225abfafd9b..63b33675848b 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -30,7 +30,6 @@
30#include <linux/param.h> 30#include <linux/param.h>
31#include <linux/string.h> 31#include <linux/string.h>
32#include <linux/bootmem.h> 32#include <linux/bootmem.h>
33#include <linux/ide.h>
34#include <linux/irq.h> 33#include <linux/irq.h>
35#include <linux/spinlock.h> 34#include <linux/spinlock.h>
36 35
@@ -337,6 +336,8 @@ unsigned int iSeries_get_irq(void)
337 return irq; 336 return irq;
338} 337}
339 338
339#ifdef CONFIG_PCI
340
340static int iseries_irq_host_map(struct irq_host *h, unsigned int virq, 341static int iseries_irq_host_map(struct irq_host *h, unsigned int virq,
341 irq_hw_number_t hw) 342 irq_hw_number_t hw)
342{ 343{
@@ -384,3 +385,4 @@ void __init iSeries_init_IRQ(void)
384 "failed with rc 0x%x\n", ret); 385 "failed with rc 0x%x\n", ret);
385} 386}
386 387
388#endif /* CONFIG_PCI */
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 4a06d9c34986..9c974227155e 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -24,7 +24,6 @@
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/ide.h>
28#include <linux/pci.h> 27#include <linux/pci.h>
29 28
30#include <asm/io.h> 29#include <asm/io.h>
@@ -177,7 +176,7 @@ void __init iSeries_pci_final_fixup(void)
177 struct pci_dn *pdn = PCI_DN(node); 176 struct pci_dn *pdn = PCI_DN(node);
178 const u32 *agent; 177 const u32 *agent;
179 178
180 agent = get_property(node, "linux,agent-id", NULL); 179 agent = of_get_property(node, "linux,agent-id", NULL);
181 if ((pdn != NULL) && (agent != NULL)) { 180 if ((pdn != NULL) && (agent != NULL)) {
182 u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, 181 u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
183 pdn->bussubno); 182 pdn->bussubno);
@@ -755,7 +754,7 @@ void __init iSeries_pcibios_init(void)
755 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) 754 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
756 continue; 755 continue;
757 756
758 busp = get_property(node, "bus-range", NULL); 757 busp = of_get_property(node, "bus-range", NULL);
759 if (busp == NULL) 758 if (busp == NULL)
760 continue; 759 continue;
761 bus = *busp; 760 bus = *busp;
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index cce7e309340c..7f5dcee814d4 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -628,15 +628,6 @@ static void iseries_iounmap(volatile void __iomem *token)
628{ 628{
629} 629}
630 630
631/*
632 * iSeries has no legacy IO, anything calling this function has to
633 * fail or bad things will happen
634 */
635static int iseries_check_legacy_ioport(unsigned int baseport)
636{
637 return -ENODEV;
638}
639
640static int __init iseries_probe(void) 631static int __init iseries_probe(void)
641{ 632{
642 unsigned long root = of_get_flat_dt_root(); 633 unsigned long root = of_get_flat_dt_root();
@@ -667,7 +658,6 @@ define_machine(iseries) {
667 .calibrate_decr = generic_calibrate_decr, 658 .calibrate_decr = generic_calibrate_decr,
668 .progress = iSeries_progress, 659 .progress = iSeries_progress,
669 .probe = iseries_probe, 660 .probe = iseries_probe,
670 .check_legacy_ioport = iseries_check_legacy_ioport,
671 .ioremap = iseries_ioremap, 661 .ioremap = iseries_ioremap,
672 .iounmap = iseries_iounmap, 662 .iounmap = iseries_iounmap,
673 /* XXX Implement enable_pmcs for iSeries */ 663 /* XXX Implement enable_pmcs for iSeries */
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
index e2100ece9c65..2ca2d8a9de97 100644
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -155,7 +155,7 @@ static int proc_viopath_show(struct seq_file *m, void *v)
155 node = of_find_node_by_path("/"); 155 node = of_find_node_by_path("/");
156 sysid = NULL; 156 sysid = NULL;
157 if (node != NULL) 157 if (node != NULL)
158 sysid = get_property(node, "system-id", NULL); 158 sysid = of_get_property(node, "system-id", NULL);
159 159
160 if (sysid == NULL) 160 if (sysid == NULL)
161 seq_printf(m, "SRLNBR=<UNKNOWN>\n"); 161 seq_printf(m, "SRLNBR=<UNKNOWN>\n");
diff --git a/arch/powerpc/platforms/maple/Kconfig b/arch/powerpc/platforms/maple/Kconfig
new file mode 100644
index 000000000000..f7c95eb5d8ba
--- /dev/null
+++ b/arch/powerpc/platforms/maple/Kconfig
@@ -0,0 +1,17 @@
1config PPC_MAPLE
2 depends on PPC_MULTIPLATFORM && PPC64
3 bool "Maple 970FX Evaluation Board"
4 select MPIC
5 select U3_DART
6 select MPIC_U3_HT_IRQS
7 select GENERIC_TBSYNC
8 select PPC_UDBG_16550
9 select PPC_970_NAP
10 select PPC_NATIVE
11 select PPC_RTAS
12 select MMIO_NVRAM
13 select ATA_NONSTANDARD if ATA
14 default n
15 help
16 This option enables support for the Maple 970FX Evaluation Board.
17 For more information, refer to <http://www.970eval.com>
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 73c59904697f..b1d3b99c3f9d 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -44,11 +44,11 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher
44 int len; 44 int len;
45 45
46 /* For PCI<->PCI bridges or CardBus bridges, we go down */ 46 /* For PCI<->PCI bridges or CardBus bridges, we go down */
47 class_code = get_property(node, "class-code", NULL); 47 class_code = of_get_property(node, "class-code", NULL);
48 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 48 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
49 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 49 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
50 continue; 50 continue;
51 bus_range = get_property(node, "bus-range", &len); 51 bus_range = of_get_property(node, "bus-range", &len);
52 if (bus_range != NULL && len > 2 * sizeof(int)) { 52 if (bus_range != NULL && len > 2 * sizeof(int)) {
53 if (bus_range[1] > higher) 53 if (bus_range[1] > higher)
54 higher = bus_range[1]; 54 higher = bus_range[1];
@@ -77,7 +77,7 @@ static void __init fixup_bus_range(struct device_node *bridge)
77 bridge->full_name); 77 bridge->full_name);
78 return; 78 return;
79 } 79 }
80 bus_range = (int *)prop->value; 80 bus_range = prop->value;
81 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); 81 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
82} 82}
83 83
@@ -454,7 +454,7 @@ static int __init add_bridge(struct device_node *dev)
454 454
455 DBG("Adding PCI host bridge %s\n", dev->full_name); 455 DBG("Adding PCI host bridge %s\n", dev->full_name);
456 456
457 bus_range = get_property(dev, "bus-range", &len); 457 bus_range = of_get_property(dev, "bus-range", &len);
458 if (bus_range == NULL || len < 2 * sizeof(int)) { 458 if (bus_range == NULL || len < 2 * sizeof(int)) {
459 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 459 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
460 dev->full_name); 460 dev->full_name);
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 82d3f9e28d7c..2a30c5b2532e 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -32,7 +32,6 @@
32#include <linux/initrd.h> 32#include <linux/initrd.h>
33#include <linux/vt_kern.h> 33#include <linux/vt_kern.h>
34#include <linux/console.h> 34#include <linux/console.h>
35#include <linux/ide.h>
36#include <linux/pci.h> 35#include <linux/pci.h>
37#include <linux/adb.h> 36#include <linux/adb.h>
38#include <linux/cuda.h> 37#include <linux/cuda.h>
@@ -114,8 +113,8 @@ static void maple_restart(char *cmd)
114 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 113 printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
115 goto fail; 114 goto fail;
116 } 115 }
117 maple_nvram_offset = get_property(sp, "restart-addr", NULL); 116 maple_nvram_offset = of_get_property(sp, "restart-addr", NULL);
118 maple_nvram_command = get_property(sp, "restart-value", NULL); 117 maple_nvram_command = of_get_property(sp, "restart-value", NULL);
119 of_node_put(sp); 118 of_node_put(sp);
120 119
121 /* send command */ 120 /* send command */
@@ -141,8 +140,8 @@ static void maple_power_off(void)
141 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 140 printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
142 goto fail; 141 goto fail;
143 } 142 }
144 maple_nvram_offset = get_property(sp, "power-off-addr", NULL); 143 maple_nvram_offset = of_get_property(sp, "power-off-addr", NULL);
145 maple_nvram_command = get_property(sp, "power-off-value", NULL); 144 maple_nvram_command = of_get_property(sp, "power-off-value", NULL);
146 of_node_put(sp); 145 of_node_put(sp);
147 146
148 /* send command */ 147 /* send command */
@@ -249,8 +248,8 @@ static void __init maple_init_IRQ(void)
249 248
250 /* Find address list in /platform-open-pic */ 249 /* Find address list in /platform-open-pic */
251 root = of_find_node_by_path("/"); 250 root = of_find_node_by_path("/");
252 naddr = prom_n_addr_cells(root); 251 naddr = of_n_addr_cells(root);
253 opprop = get_property(root, "platform-open-pic", &opplen); 252 opprop = of_get_property(root, "platform-open-pic", &opplen);
254 if (opprop != 0) { 253 if (opprop != 0) {
255 openpic_addr = of_read_number(opprop, naddr); 254 openpic_addr = of_read_number(opprop, naddr);
256 has_isus = (opplen > naddr); 255 has_isus = (opplen > naddr);
@@ -261,11 +260,11 @@ static void __init maple_init_IRQ(void)
261 BUG_ON(openpic_addr == 0); 260 BUG_ON(openpic_addr == 0);
262 261
263 /* Check for a big endian MPIC */ 262 /* Check for a big endian MPIC */
264 if (get_property(np, "big-endian", NULL) != NULL) 263 if (of_get_property(np, "big-endian", NULL) != NULL)
265 flags |= MPIC_BIG_ENDIAN; 264 flags |= MPIC_BIG_ENDIAN;
266 265
267 /* XXX Maple specific bits */ 266 /* XXX Maple specific bits */
268 flags |= MPIC_BROKEN_U3 | MPIC_WANTS_RESET; 267 flags |= MPIC_U3_HT_IRQS | MPIC_WANTS_RESET;
269 /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */ 268 /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */
270 flags |= MPIC_BIG_ENDIAN; 269 flags |= MPIC_BIG_ENDIAN;
271 270
diff --git a/arch/powerpc/platforms/pasemi/Kconfig b/arch/powerpc/platforms/pasemi/Kconfig
index 68dc529dfd2f..eb4dbc705b06 100644
--- a/arch/powerpc/platforms/pasemi/Kconfig
+++ b/arch/powerpc/platforms/pasemi/Kconfig
@@ -1,3 +1,15 @@
1config PPC_PASEMI
2 depends on PPC_MULTIPLATFORM && PPC64
3 bool "PA Semi SoC-based platforms"
4 default n
5 select MPIC
6 select PPC_UDBG_16550
7 select GENERIC_TBSYNC
8 select PPC_NATIVE
9 help
10 This option enables support for PA Semi's PWRficient line
11 of SoC processors, including PA6T-1682M
12
1menu "PA Semi PWRficient options" 13menu "PA Semi PWRficient options"
2 depends on PPC_PASEMI 14 depends on PPC_PASEMI
3 15
@@ -7,4 +19,11 @@ config PPC_PASEMI_IOMMU
7 help 19 help
8 IOMMU support for PA6T-1682M 20 IOMMU support for PA6T-1682M
9 21
22config PPC_PASEMI_MDIO
23 depends on PHYLIB
24 tristate "MDIO support via GPIO"
25 default y
26 help
27 Driver for MDIO via GPIO on PWRficient platforms
28
10endmenu 29endmenu
diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile
index e657ccae90a9..2cd2a4f26a48 100644
--- a/arch/powerpc/platforms/pasemi/Makefile
+++ b/arch/powerpc/platforms/pasemi/Makefile
@@ -1,2 +1,3 @@
1obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o 1obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o
2 2obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o
3obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c
new file mode 100644
index 000000000000..2a57d6023685
--- /dev/null
+++ b/arch/powerpc/platforms/pasemi/cpufreq.c
@@ -0,0 +1,308 @@
1/*
2 * Copyright (C) 2007 PA Semi, Inc
3 *
4 * Authors: Egor Martovetsky <egor@pasemi.com>
5 * Olof Johansson <olof@lixom.net>
6 *
7 * Maintained by: Olof Johansson <olof@lixom.net>
8 *
9 * Based on arch/powerpc/platforms/cell/cbe_cpufreq.c:
10 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 */
27
28#include <linux/cpufreq.h>
29#include <linux/timer.h>
30
31#include <asm/hw_irq.h>
32#include <asm/io.h>
33#include <asm/prom.h>
34
35#define SDCASR_REG 0x0100
36#define SDCASR_REG_STRIDE 0x1000
37#define SDCPWR_CFGA0_REG 0x0100
38#define SDCPWR_PWST0_REG 0x0000
39#define SDCPWR_GIZTIME_REG 0x0440
40
41/* SDCPWR_GIZTIME_REG fields */
42#define SDCPWR_GIZTIME_GR 0x80000000
43#define SDCPWR_GIZTIME_LONGLOCK 0x000000ff
44
45/* Offset of ASR registers from SDC base */
46#define SDCASR_OFFSET 0x120000
47
48static void __iomem *sdcpwr_mapbase;
49static void __iomem *sdcasr_mapbase;
50
51static DEFINE_MUTEX(pas_switch_mutex);
52
53/* Current astate, is used when waking up from power savings on
54 * one core, in case the other core has switched states during
55 * the idle time.
56 */
57static int current_astate;
58
59/* We support 5(A0-A4) power states excluding turbo(A5-A6) modes */
60static struct cpufreq_frequency_table pas_freqs[] = {
61 {0, 0},
62 {1, 0},
63 {2, 0},
64 {3, 0},
65 {4, 0},
66 {0, CPUFREQ_TABLE_END},
67};
68
69static struct freq_attr *pas_cpu_freqs_attr[] = {
70 &cpufreq_freq_attr_scaling_available_freqs,
71 NULL,
72};
73
74/*
75 * hardware specific functions
76 */
77
78static int get_astate_freq(int astate)
79{
80 u32 ret;
81 ret = in_le32(sdcpwr_mapbase + SDCPWR_CFGA0_REG + (astate * 0x10));
82
83 return ret & 0x3f;
84}
85
86static int get_cur_astate(int cpu)
87{
88 u32 ret;
89
90 ret = in_le32(sdcpwr_mapbase + SDCPWR_PWST0_REG);
91 ret = (ret >> (cpu * 4)) & 0x7;
92
93 return ret;
94}
95
96static int get_gizmo_latency(void)
97{
98 u32 giztime, ret;
99
100 giztime = in_le32(sdcpwr_mapbase + SDCPWR_GIZTIME_REG);
101
102 /* just provide the upper bound */
103 if (giztime & SDCPWR_GIZTIME_GR)
104 ret = (giztime & SDCPWR_GIZTIME_LONGLOCK) * 128000;
105 else
106 ret = (giztime & SDCPWR_GIZTIME_LONGLOCK) * 1000;
107
108 return ret;
109}
110
111static void set_astate(int cpu, unsigned int astate)
112{
113 u64 flags;
114
115 /* Return if called before init has run */
116 if (unlikely(!sdcasr_mapbase))
117 return;
118
119 local_irq_save(flags);
120
121 out_le32(sdcasr_mapbase + SDCASR_REG + SDCASR_REG_STRIDE*cpu, astate);
122
123 local_irq_restore(flags);
124}
125
126void restore_astate(int cpu)
127{
128 set_astate(cpu, current_astate);
129}
130
131/*
132 * cpufreq functions
133 */
134
135static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
136{
137 const u32 *max_freqp;
138 u32 max_freq;
139 int i, cur_astate;
140 struct resource res;
141 struct device_node *cpu, *dn;
142 int err = -ENODEV;
143
144 cpu = of_get_cpu_node(policy->cpu, NULL);
145
146 if (!cpu)
147 goto out;
148
149 dn = of_find_compatible_node(NULL, "sdc", "1682m-sdc");
150 if (!dn)
151 goto out;
152 err = of_address_to_resource(dn, 0, &res);
153 of_node_put(dn);
154 if (err)
155 goto out;
156 sdcasr_mapbase = ioremap(res.start + SDCASR_OFFSET, 0x2000);
157 if (!sdcasr_mapbase) {
158 err = -EINVAL;
159 goto out;
160 }
161
162 dn = of_find_compatible_node(NULL, "gizmo", "1682m-gizmo");
163 if (!dn) {
164 err = -ENODEV;
165 goto out_unmap_sdcasr;
166 }
167 err = of_address_to_resource(dn, 0, &res);
168 of_node_put(dn);
169 if (err)
170 goto out_unmap_sdcasr;
171 sdcpwr_mapbase = ioremap(res.start, 0x1000);
172 if (!sdcpwr_mapbase) {
173 err = -EINVAL;
174 goto out_unmap_sdcasr;
175 }
176
177 pr_debug("init cpufreq on CPU %d\n", policy->cpu);
178
179 max_freqp = of_get_property(cpu, "clock-frequency", NULL);
180 if (!max_freqp) {
181 err = -EINVAL;
182 goto out_unmap_sdcpwr;
183 }
184
185 /* we need the freq in kHz */
186 max_freq = *max_freqp / 1000;
187
188 pr_debug("max clock-frequency is at %u kHz\n", max_freq);
189 pr_debug("initializing frequency table\n");
190
191 /* initialize frequency table */
192 for (i=0; pas_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
193 pas_freqs[i].frequency = get_astate_freq(pas_freqs[i].index) * 100000;
194 pr_debug("%d: %d\n", i, pas_freqs[i].frequency);
195 }
196
197 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
198
199 policy->cpuinfo.transition_latency = get_gizmo_latency();
200
201 cur_astate = get_cur_astate(policy->cpu);
202 pr_debug("current astate is at %d\n",cur_astate);
203
204 policy->cur = pas_freqs[cur_astate].frequency;
205 policy->cpus = cpu_online_map;
206
207 cpufreq_frequency_table_get_attr(pas_freqs, policy->cpu);
208
209 /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max
210 * are set correctly
211 */
212 return cpufreq_frequency_table_cpuinfo(policy, pas_freqs);
213
214out_unmap_sdcpwr:
215 iounmap(sdcpwr_mapbase);
216
217out_unmap_sdcasr:
218 iounmap(sdcasr_mapbase);
219out:
220 return err;
221}
222
223static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy)
224{
225 if (sdcasr_mapbase)
226 iounmap(sdcasr_mapbase);
227 if (sdcpwr_mapbase)
228 iounmap(sdcpwr_mapbase);
229
230 cpufreq_frequency_table_put_attr(policy->cpu);
231 return 0;
232}
233
234static int pas_cpufreq_verify(struct cpufreq_policy *policy)
235{
236 return cpufreq_frequency_table_verify(policy, pas_freqs);
237}
238
239static int pas_cpufreq_target(struct cpufreq_policy *policy,
240 unsigned int target_freq,
241 unsigned int relation)
242{
243 struct cpufreq_freqs freqs;
244 int pas_astate_new;
245 int i;
246
247 cpufreq_frequency_table_target(policy,
248 pas_freqs,
249 target_freq,
250 relation,
251 &pas_astate_new);
252
253 freqs.old = policy->cur;
254 freqs.new = pas_freqs[pas_astate_new].frequency;
255 freqs.cpu = policy->cpu;
256
257 mutex_lock(&pas_switch_mutex);
258 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
259
260 pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n",
261 policy->cpu,
262 pas_freqs[pas_astate_new].frequency,
263 pas_freqs[pas_astate_new].index);
264
265 current_astate = pas_astate_new;
266
267 for_each_online_cpu(i)
268 set_astate(i, pas_astate_new);
269
270 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
271 mutex_unlock(&pas_switch_mutex);
272
273 return 0;
274}
275
276static struct cpufreq_driver pas_cpufreq_driver = {
277 .name = "pas-cpufreq",
278 .owner = THIS_MODULE,
279 .flags = CPUFREQ_CONST_LOOPS,
280 .init = pas_cpufreq_cpu_init,
281 .exit = pas_cpufreq_cpu_exit,
282 .verify = pas_cpufreq_verify,
283 .target = pas_cpufreq_target,
284 .attr = pas_cpu_freqs_attr,
285};
286
287/*
288 * module init and destoy
289 */
290
291static int __init pas_cpufreq_init(void)
292{
293 if (!machine_is_compatible("PA6T-1682M"))
294 return -ENODEV;
295
296 return cpufreq_register_driver(&pas_cpufreq_driver);
297}
298
299static void __exit pas_cpufreq_exit(void)
300{
301 cpufreq_unregister_driver(&pas_cpufreq_driver);
302}
303
304module_init(pas_cpufreq_init);
305module_exit(pas_cpufreq_exit);
306
307MODULE_LICENSE("GPL");
308MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>, Olof Johansson <olof@lixom.net>");
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
new file mode 100644
index 000000000000..c91a33593bb8
--- /dev/null
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -0,0 +1,339 @@
1/*
2 * Copyright (C) 2006-2007 PA Semi, Inc
3 *
4 * Author: Olof Johansson, PA Semi
5 *
6 * Maintained by: Olof Johansson <olof@lixom.net>
7 *
8 * Based on drivers/net/fs_enet/mii-bitbang.c.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/io.h>
25#include <linux/module.h>
26#include <linux/types.h>
27#include <linux/sched.h>
28#include <linux/errno.h>
29#include <linux/ioport.h>
30#include <linux/interrupt.h>
31#include <linux/phy.h>
32#include <linux/platform_device.h>
33#include <asm/of_platform.h>
34
35#define DELAY 1
36
37static void __iomem *gpio_regs;
38
39struct gpio_priv {
40 int mdc_pin;
41 int mdio_pin;
42};
43
44#define MDC_PIN(bus) (((struct gpio_priv *)bus->priv)->mdc_pin)
45#define MDIO_PIN(bus) (((struct gpio_priv *)bus->priv)->mdio_pin)
46
47static inline void mdio_lo(struct mii_bus *bus)
48{
49 out_le32(gpio_regs+0x10, 1 << MDIO_PIN(bus));
50}
51
52static inline void mdio_hi(struct mii_bus *bus)
53{
54 out_le32(gpio_regs, 1 << MDIO_PIN(bus));
55}
56
57static inline void mdc_lo(struct mii_bus *bus)
58{
59 out_le32(gpio_regs+0x10, 1 << MDC_PIN(bus));
60}
61
62static inline void mdc_hi(struct mii_bus *bus)
63{
64 out_le32(gpio_regs, 1 << MDC_PIN(bus));
65}
66
67static inline void mdio_active(struct mii_bus *bus)
68{
69 out_le32(gpio_regs+0x20, (1 << MDC_PIN(bus)) | (1 << MDIO_PIN(bus)));
70}
71
72static inline void mdio_tristate(struct mii_bus *bus)
73{
74 out_le32(gpio_regs+0x30, (1 << MDIO_PIN(bus)));
75}
76
77static inline int mdio_read(struct mii_bus *bus)
78{
79 return !!(in_le32(gpio_regs+0x40) & (1 << MDIO_PIN(bus)));
80}
81
82static void clock_out(struct mii_bus *bus, int bit)
83{
84 if (bit)
85 mdio_hi(bus);
86 else
87 mdio_lo(bus);
88 udelay(DELAY);
89 mdc_hi(bus);
90 udelay(DELAY);
91 mdc_lo(bus);
92}
93
94/* Utility to send the preamble, address, and register (common to read and write). */
95static void bitbang_pre(struct mii_bus *bus, int read, u8 addr, u8 reg)
96{
97 int i;
98
99 /* CFE uses a really long preamble (40 bits). We'll do the same. */
100 mdio_active(bus);
101 for (i = 0; i < 40; i++) {
102 clock_out(bus, 1);
103 }
104
105 /* send the start bit (01) and the read opcode (10) or write (10) */
106 clock_out(bus, 0);
107 clock_out(bus, 1);
108
109 clock_out(bus, read);
110 clock_out(bus, !read);
111
112 /* send the PHY address */
113 for (i = 0; i < 5; i++) {
114 clock_out(bus, (addr & 0x10) != 0);
115 addr <<= 1;
116 }
117
118 /* send the register address */
119 for (i = 0; i < 5; i++) {
120 clock_out(bus, (reg & 0x10) != 0);
121 reg <<= 1;
122 }
123}
124
125static int gpio_mdio_read(struct mii_bus *bus, int phy_id, int location)
126{
127 u16 rdreg;
128 int ret, i;
129 u8 addr = phy_id & 0xff;
130 u8 reg = location & 0xff;
131
132 bitbang_pre(bus, 1, addr, reg);
133
134 /* tri-state our MDIO I/O pin so we can read */
135 mdio_tristate(bus);
136 udelay(DELAY);
137 mdc_hi(bus);
138 udelay(DELAY);
139 mdc_lo(bus);
140
141 /* read 16 bits of register data, MSB first */
142 rdreg = 0;
143 for (i = 0; i < 16; i++) {
144 mdc_lo(bus);
145 udelay(DELAY);
146 mdc_hi(bus);
147 udelay(DELAY);
148 mdc_lo(bus);
149 udelay(DELAY);
150 rdreg <<= 1;
151 rdreg |= mdio_read(bus);
152 }
153
154 mdc_hi(bus);
155 udelay(DELAY);
156 mdc_lo(bus);
157 udelay(DELAY);
158
159 ret = rdreg;
160
161 return ret;
162}
163
164static int gpio_mdio_write(struct mii_bus *bus, int phy_id, int location, u16 val)
165{
166 int i;
167
168 u8 addr = phy_id & 0xff;
169 u8 reg = location & 0xff;
170 u16 value = val & 0xffff;
171
172 bitbang_pre(bus, 0, addr, reg);
173
174 /* send the turnaround (10) */
175 mdc_lo(bus);
176 mdio_hi(bus);
177 udelay(DELAY);
178 mdc_hi(bus);
179 udelay(DELAY);
180 mdc_lo(bus);
181 mdio_lo(bus);
182 udelay(DELAY);
183 mdc_hi(bus);
184 udelay(DELAY);
185
186 /* write 16 bits of register data, MSB first */
187 for (i = 0; i < 16; i++) {
188 mdc_lo(bus);
189 if (value & 0x8000)
190 mdio_hi(bus);
191 else
192 mdio_lo(bus);
193 udelay(DELAY);
194 mdc_hi(bus);
195 udelay(DELAY);
196 value <<= 1;
197 }
198
199 /*
200 * Tri-state the MDIO line.
201 */
202 mdio_tristate(bus);
203 mdc_lo(bus);
204 udelay(DELAY);
205 mdc_hi(bus);
206 udelay(DELAY);
207 return 0;
208}
209
210static int gpio_mdio_reset(struct mii_bus *bus)
211{
212 /*nothing here - dunno how to reset it*/
213 return 0;
214}
215
216
217static int __devinit gpio_mdio_probe(struct of_device *ofdev,
218 const struct of_device_id *match)
219{
220 struct device *dev = &ofdev->dev;
221 struct device_node *np = ofdev->node;
222 struct device_node *gpio_np;
223 struct mii_bus *new_bus;
224 struct resource res;
225 struct gpio_priv *priv;
226 const unsigned int *prop;
227 int err = 0;
228 int i;
229
230 gpio_np = of_find_compatible_node(NULL, "gpio", "1682m-gpio");
231
232 if (!gpio_np)
233 return -ENODEV;
234
235 err = of_address_to_resource(gpio_np, 0, &res);
236 of_node_put(gpio_np);
237
238 if (err)
239 return -EINVAL;
240
241 if (!gpio_regs)
242 gpio_regs = ioremap(res.start, 0x100);
243
244 if (!gpio_regs)
245 return -EPERM;
246
247 priv = kzalloc(sizeof(struct gpio_priv), GFP_KERNEL);
248 if (priv == NULL)
249 return -ENOMEM;
250
251 new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);
252
253 if (new_bus == NULL)
254 return -ENOMEM;
255
256 new_bus->name = "pasemi gpio mdio bus",
257 new_bus->read = &gpio_mdio_read,
258 new_bus->write = &gpio_mdio_write,
259 new_bus->reset = &gpio_mdio_reset,
260
261 prop = of_get_property(np, "reg", NULL);
262 new_bus->id = *prop;
263 new_bus->priv = priv;
264
265 new_bus->phy_mask = 0;
266
267 new_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
268 for(i = 0; i < PHY_MAX_ADDR; ++i)
269 new_bus->irq[i] = irq_create_mapping(NULL, 10);
270
271
272 prop = of_get_property(np, "mdc-pin", NULL);
273 priv->mdc_pin = *prop;
274
275 prop = of_get_property(np, "mdio-pin", NULL);
276 priv->mdio_pin = *prop;
277
278 new_bus->dev = dev;
279 dev_set_drvdata(dev, new_bus);
280
281 err = mdiobus_register(new_bus);
282
283 if (0 != err) {
284 printk(KERN_ERR "%s: Cannot register as MDIO bus, err %d\n",
285 new_bus->name, err);
286 goto bus_register_fail;
287 }
288
289 return 0;
290
291bus_register_fail:
292 kfree(new_bus);
293
294 return err;
295}
296
297
298static int gpio_mdio_remove(struct of_device *dev)
299{
300 struct mii_bus *bus = dev_get_drvdata(&dev->dev);
301
302 mdiobus_unregister(bus);
303
304 dev_set_drvdata(&dev->dev, NULL);
305
306 kfree(bus->priv);
307 bus->priv = NULL;
308 kfree(bus);
309
310 return 0;
311}
312
313static struct of_device_id gpio_mdio_match[] =
314{
315 {
316 .compatible = "gpio-mdio",
317 },
318 {},
319};
320
321static struct of_platform_driver gpio_mdio_driver =
322{
323 .name = "gpio-mdio-bitbang",
324 .match_table = gpio_mdio_match,
325 .probe = gpio_mdio_probe,
326 .remove = gpio_mdio_remove,
327};
328
329int gpio_mdio_init(void)
330{
331 return of_register_platform_driver(&gpio_mdio_driver);
332}
333
334void gpio_mdio_exit(void)
335{
336 of_unregister_platform_driver(&gpio_mdio_driver);
337}
338device_initcall(gpio_mdio_init);
339
diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
index 1ca3ff381591..5985ce0c5c48 100644
--- a/arch/powerpc/platforms/pasemi/idle.c
+++ b/arch/powerpc/platforms/pasemi/idle.c
@@ -61,6 +61,10 @@ static int pasemi_system_reset_exception(struct pt_regs *regs)
61 /* do system reset */ 61 /* do system reset */
62 return 0; 62 return 0;
63 } 63 }
64
65 /* Set higher astate since we come out of power savings at 0 */
66 restore_astate(hard_smp_processor_id());
67
64 /* everything handled */ 68 /* everything handled */
65 regs->msr |= MSR_RI; 69 regs->msr |= MSR_RI;
66 return 1; 70 return 1;
@@ -68,6 +72,11 @@ static int pasemi_system_reset_exception(struct pt_regs *regs)
68 72
69void __init pasemi_idle_init(void) 73void __init pasemi_idle_init(void)
70{ 74{
75#ifndef CONFIG_PPC_PASEMI_CPUFREQ
76 printk(KERN_WARNING "No cpufreq driver, powersavings modes disabled\n");
77 current_mode = 0;
78#endif
79
71 ppc_md.system_reset_exception = pasemi_system_reset_exception; 80 ppc_md.system_reset_exception = pasemi_system_reset_exception;
72 ppc_md.power_save = modes[current_mode].entry; 81 ppc_md.power_save = modes[current_mode].entry;
73 printk(KERN_INFO "Using PA6T idle loop (%s)\n", modes[current_mode].name); 82 printk(KERN_INFO "Using PA6T idle loop (%s)\n", modes[current_mode].name);
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 71dbf1a56e13..95fa6a7d15ee 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -249,13 +249,13 @@ void iommu_init_early_pasemi(void)
249 iommu_off = 1; 249 iommu_off = 1;
250#else 250#else
251 iommu_off = of_chosen && 251 iommu_off = of_chosen &&
252 get_property(of_chosen, "linux,iommu-off", NULL); 252 of_get_property(of_chosen, "linux,iommu-off", NULL);
253#endif 253#endif
254 if (iommu_off) { 254 if (iommu_off) {
255 /* Direct I/O, IOMMU off */ 255 /* Direct I/O, IOMMU off */
256 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null; 256 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null;
257 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null; 257 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null;
258 pci_dma_ops = &dma_direct_ops; 258 set_pci_dma_ops(&dma_direct_ops);
259 259
260 return; 260 return;
261 } 261 }
@@ -266,7 +266,7 @@ void iommu_init_early_pasemi(void)
266 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi; 266 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi;
267 ppc_md.tce_build = iobmap_build; 267 ppc_md.tce_build = iobmap_build;
268 ppc_md.tce_free = iobmap_free; 268 ppc_md.tce_free = iobmap_free;
269 pci_dma_ops = &dma_iommu_ops; 269 set_pci_dma_ops(&dma_iommu_ops);
270} 270}
271 271
272void __init alloc_iobmap_l2(void) 272void __init alloc_iobmap_l2(void)
diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h
index 2d3927e6edb0..be8495497611 100644
--- a/arch/powerpc/platforms/pasemi/pasemi.h
+++ b/arch/powerpc/platforms/pasemi/pasemi.h
@@ -14,6 +14,14 @@ extern void __init pasemi_idle_init(void);
14extern void idle_spin(void); 14extern void idle_spin(void);
15extern void idle_doze(void); 15extern void idle_doze(void);
16 16
17/* Restore astate to last set */
18#ifdef CONFIG_PPC_PASEMI_CPUFREQ
19extern void restore_astate(int cpu);
20#else
21static inline void restore_astate(int cpu)
22{
23}
24#endif
17 25
18 26
19#endif /* _PASEMI_PASEMI_H */ 27#endif /* _PASEMI_PASEMI_H */
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index 7ecb2ba24db9..056243da360b 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -33,7 +33,17 @@
33 33
34#define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) 34#define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off))
35 35
36#define CONFIG_OFFSET_VALID(off) ((off) < 4096) 36static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset)
37{
38 /* Device 0 Function 0 is special: It's config space spans function 1 as
39 * well, so allow larger offset. It's really a two-function device but the
40 * second function does not probe.
41 */
42 if (bus == 0 && devfn == 0)
43 return offset < 8192;
44 else
45 return offset < 4096;
46}
37 47
38static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose, 48static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose,
39 u8 bus, u8 devfn, int offset) 49 u8 bus, u8 devfn, int offset)
@@ -51,7 +61,7 @@ static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
51 if (!hose) 61 if (!hose)
52 return PCIBIOS_DEVICE_NOT_FOUND; 62 return PCIBIOS_DEVICE_NOT_FOUND;
53 63
54 if (!CONFIG_OFFSET_VALID(offset)) 64 if (!pa_pxp_offset_valid(bus->number, devfn, offset))
55 return PCIBIOS_BAD_REGISTER_NUMBER; 65 return PCIBIOS_BAD_REGISTER_NUMBER;
56 66
57 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); 67 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
@@ -85,7 +95,7 @@ static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn,
85 if (!hose) 95 if (!hose)
86 return PCIBIOS_DEVICE_NOT_FOUND; 96 return PCIBIOS_DEVICE_NOT_FOUND;
87 97
88 if (!CONFIG_OFFSET_VALID(offset)) 98 if (!pa_pxp_offset_valid(bus->number, devfn, offset))
89 return PCIBIOS_BAD_REGISTER_NUMBER; 99 return PCIBIOS_BAD_REGISTER_NUMBER;
90 100
91 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); 101 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 449cf1a08291..f88f0ec4c8cb 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -35,6 +35,7 @@
35#include <asm/mpic.h> 35#include <asm/mpic.h>
36#include <asm/smp.h> 36#include <asm/smp.h>
37#include <asm/time.h> 37#include <asm/time.h>
38#include <asm/of_platform.h>
38 39
39#include "pasemi.h" 40#include "pasemi.h"
40 41
@@ -101,12 +102,6 @@ void __init pas_setup_arch(void)
101 pasemi_idle_init(); 102 pasemi_idle_init();
102} 103}
103 104
104/* No legacy IO on our parts */
105static int pas_check_legacy_ioport(unsigned int baseport)
106{
107 return -ENODEV;
108}
109
110static __init void pas_init_IRQ(void) 105static __init void pas_init_IRQ(void)
111{ 106{
112 struct device_node *np; 107 struct device_node *np;
@@ -136,8 +131,8 @@ static __init void pas_init_IRQ(void)
136 131
137 /* Find address list in /platform-open-pic */ 132 /* Find address list in /platform-open-pic */
138 root = of_find_node_by_path("/"); 133 root = of_find_node_by_path("/");
139 naddr = prom_n_addr_cells(root); 134 naddr = of_n_addr_cells(root);
140 opprop = get_property(root, "platform-open-pic", &opplen); 135 opprop = of_get_property(root, "platform-open-pic", &opplen);
141 if (!opprop) { 136 if (!opprop) {
142 printk(KERN_ERR "No platform-open-pic property.\n"); 137 printk(KERN_ERR "No platform-open-pic property.\n");
143 of_node_put(root); 138 of_node_put(root);
@@ -147,7 +142,7 @@ static __init void pas_init_IRQ(void)
147 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 142 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
148 143
149 mpic = mpic_alloc(mpic_node, openpic_addr, 144 mpic = mpic_alloc(mpic_node, openpic_addr,
150 MPIC_PRIMARY|MPIC_LARGE_VECTORS, 145 MPIC_PRIMARY|MPIC_LARGE_VECTORS|MPIC_WANTS_RESET,
151 0, 0, " PAS-OPIC "); 146 0, 0, " PAS-OPIC ");
152 BUG_ON(!mpic); 147 BUG_ON(!mpic);
153 148
@@ -209,6 +204,20 @@ static void __init pas_init_early(void)
209 iommu_init_early_pasemi(); 204 iommu_init_early_pasemi();
210} 205}
211 206
207static struct of_device_id pasemi_bus_ids[] = {
208 { .type = "sdc", },
209 {},
210};
211
212static int __init pasemi_publish_devices(void)
213{
214 /* Publish OF platform devices for southbridge IOs */
215 of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
216
217 return 0;
218}
219device_initcall(pasemi_publish_devices);
220
212 221
213/* 222/*
214 * Called very early, MMU is off, device-tree isn't unflattened 223 * Called very early, MMU is off, device-tree isn't unflattened
@@ -237,7 +246,6 @@ define_machine(pas) {
237 .restart = pas_restart, 246 .restart = pas_restart,
238 .get_boot_time = pas_get_boot_time, 247 .get_boot_time = pas_get_boot_time,
239 .calibrate_decr = generic_calibrate_decr, 248 .calibrate_decr = generic_calibrate_decr,
240 .check_legacy_ioport = pas_check_legacy_ioport,
241 .progress = pas_progress, 249 .progress = pas_progress,
242 .machine_check_exception = pas_machine_check_handler, 250 .machine_check_exception = pas_machine_check_handler,
243 .pci_irq_fixup = pas_pci_irq_fixup, 251 .pci_irq_fixup = pas_pci_irq_fixup,
diff --git a/arch/powerpc/platforms/powermac/Kconfig b/arch/powerpc/platforms/powermac/Kconfig
new file mode 100644
index 000000000000..5b7afe50039a
--- /dev/null
+++ b/arch/powerpc/platforms/powermac/Kconfig
@@ -0,0 +1,20 @@
1config PPC_PMAC
2 bool "Apple PowerMac based machines"
3 depends on PPC_MULTIPLATFORM
4 select MPIC
5 select PPC_INDIRECT_PCI if PPC32
6 select PPC_MPC106 if PPC32
7 select PPC_NATIVE
8 default y
9
10config PPC_PMAC64
11 bool
12 depends on PPC_PMAC && POWER4
13 select MPIC
14 select U3_DART
15 select MPIC_U3_HT_IRQS
16 select GENERIC_TBSYNC
17 select PPC_970_NAP
18 default y
19
20
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
index de7440e62cc4..d679964ae2ab 100644
--- a/arch/powerpc/platforms/powermac/backlight.c
+++ b/arch/powerpc/platforms/powermac/backlight.c
@@ -56,13 +56,16 @@ struct backlight_device *pmac_backlight;
56 56
57int pmac_has_backlight_type(const char *type) 57int pmac_has_backlight_type(const char *type)
58{ 58{
59 struct device_node* bk_node = find_devices("backlight"); 59 struct device_node* bk_node = of_find_node_by_name(NULL, "backlight");
60 60
61 if (bk_node) { 61 if (bk_node) {
62 const char *prop = get_property(bk_node, 62 const char *prop = of_get_property(bk_node,
63 "backlight-control", NULL); 63 "backlight-control", NULL);
64 if (prop && strncmp(prop, type, strlen(type)) == 0) 64 if (prop && strncmp(prop, type, strlen(type)) == 0) {
65 of_node_put(bk_node);
65 return 1; 66 return 1;
67 }
68 of_node_put(bk_node);
66 } 69 }
67 70
68 return 0; 71 return 0;
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index c2b6b4134f68..8943a9456bb7 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 const u32 *reg = get_property(np, "reg", NULL); 424 const u32 *reg = of_get_property(np, "reg", NULL);
425 u32 offset; 425 u32 offset;
426 426
427 if (reg == NULL) 427 if (reg == NULL)
@@ -521,13 +521,14 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
521 int lenp, rc; 521 int lenp, rc;
522 const u32 *freqs, *ratio; 522 const u32 *freqs, *ratio;
523 523
524 freqs = get_property(cpunode, "bus-frequencies", &lenp); 524 freqs = of_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 = get_property(cpunode, "processor-to-bus-ratio*2", NULL); 530 ratio = of_get_property(cpunode, "processor-to-bus-ratio*2",
531 NULL);
531 if (ratio == NULL) { 532 if (ratio == NULL) {
532 printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); 533 printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n");
533 return 1; 534 return 1;
@@ -562,7 +563,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 563 /* If we use the PMU, look for the min & max frequencies in the
563 * device-tree 564 * device-tree
564 */ 565 */
565 value = get_property(cpunode, "min-clock-frequency", NULL); 566 value = of_get_property(cpunode, "min-clock-frequency", NULL);
566 if (!value) 567 if (!value)
567 return 1; 568 return 1;
568 low_freq = (*value) / 1000; 569 low_freq = (*value) / 1000;
@@ -571,7 +572,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
571 if (low_freq < 100000) 572 if (low_freq < 100000)
572 low_freq *= 10; 573 low_freq *= 10;
573 574
574 value = get_property(cpunode, "max-clock-frequency", NULL); 575 value = of_get_property(cpunode, "max-clock-frequency", NULL);
575 if (!value) 576 if (!value)
576 return 1; 577 return 1;
577 hi_freq = (*value) / 1000; 578 hi_freq = (*value) / 1000;
@@ -585,7 +586,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode)
585{ 586{
586 struct device_node *volt_gpio_np; 587 struct device_node *volt_gpio_np;
587 588
588 if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) 589 if (of_get_property(cpunode, "dynamic-power-step", NULL) == NULL)
589 return 1; 590 return 1;
590 591
591 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); 592 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
@@ -614,11 +615,11 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
614 u32 pvr; 615 u32 pvr;
615 const u32 *value; 616 const u32 *value;
616 617
617 if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) 618 if (of_get_property(cpunode, "dynamic-power-step", NULL) == NULL)
618 return 1; 619 return 1;
619 620
620 hi_freq = cur_freq; 621 hi_freq = cur_freq;
621 value = get_property(cpunode, "reduced-clock-frequency", NULL); 622 value = of_get_property(cpunode, "reduced-clock-frequency", NULL);
622 if (!value) 623 if (!value)
623 return 1; 624 return 1;
624 low_freq = (*value) / 1000; 625 low_freq = (*value) / 1000;
@@ -657,19 +658,19 @@ static int __init pmac_cpufreq_setup(void)
657 return 0; 658 return 0;
658 659
659 /* Assume only one CPU */ 660 /* Assume only one CPU */
660 cpunode = find_type_devices("cpu"); 661 cpunode = of_find_node_by_type(NULL, "cpu");
661 if (!cpunode) 662 if (!cpunode)
662 goto out; 663 goto out;
663 664
664 /* Get current cpu clock freq */ 665 /* Get current cpu clock freq */
665 value = get_property(cpunode, "clock-frequency", NULL); 666 value = of_get_property(cpunode, "clock-frequency", NULL);
666 if (!value) 667 if (!value)
667 goto out; 668 goto out;
668 cur_freq = (*value) / 1000; 669 cur_freq = (*value) / 1000;
669 670
670 /* Check for 7447A based MacRISC3 */ 671 /* Check for 7447A based MacRISC3 */
671 if (machine_is_compatible("MacRISC3") && 672 if (machine_is_compatible("MacRISC3") &&
672 get_property(cpunode, "dynamic-power-step", NULL) && 673 of_get_property(cpunode, "dynamic-power-step", NULL) &&
673 PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { 674 PVR_VER(mfspr(SPRN_PVR)) == 0x8003) {
674 pmac_cpufreq_init_7447A(cpunode); 675 pmac_cpufreq_init_7447A(cpunode);
675 /* Check for other MacRISC3 machines */ 676 /* Check for other MacRISC3 machines */
@@ -707,6 +708,7 @@ static int __init pmac_cpufreq_setup(void)
707 else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000) 708 else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000)
708 pmac_cpufreq_init_750FX(cpunode); 709 pmac_cpufreq_init_750FX(cpunode);
709out: 710out:
711 of_node_put(cpunode);
710 if (set_speed_proc == NULL) 712 if (set_speed_proc == NULL)
711 return -ENODEV; 713 return -ENODEV;
712 714
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
index 9d22361a26d6..567d5523b690 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -410,7 +410,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
410 /* Get first CPU node */ 410 /* Get first CPU node */
411 for (cpunode = NULL; 411 for (cpunode = NULL;
412 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { 412 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
413 const u32 *reg = get_property(cpunode, "reg", NULL); 413 const u32 *reg = of_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 = get_property(cpunode, "cpu-version", NULL); 425 valp = of_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 = get_property(cpunode, "power-mode-data",&psize); 437 g5_pmode_data = of_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;
@@ -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 = get_property(cpunode, "clock-frequency", NULL); 496 valp = of_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;
@@ -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 = get_property(cpuid, "cpuid", NULL); 566 eeprom = of_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,13 +573,13 @@ 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 const char *loc = get_property(hwclock, 576 const char *loc = of_get_property(hwclock,
577 "hwctrl-location", NULL); 577 "hwctrl-location", NULL);
578 if (loc == NULL) 578 if (loc == NULL)
579 continue; 579 continue;
580 if (strcmp(loc, "CPU CLOCK")) 580 if (strcmp(loc, "CPU CLOCK"))
581 continue; 581 continue;
582 if (!get_property(hwclock, "platform-get-frequency", NULL)) 582 if (!of_get_property(hwclock, "platform-get-frequency", NULL))
583 continue; 583 continue;
584 break; 584 break;
585 } 585 }
@@ -638,7 +638,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
638 */ 638 */
639 639
640 /* Get max frequency from device-tree */ 640 /* Get max frequency from device-tree */
641 valp = get_property(cpunode, "clock-frequency", NULL); 641 valp = of_get_property(cpunode, "clock-frequency", NULL);
642 if (!valp) { 642 if (!valp) {
643 printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n"); 643 printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n");
644 rc = -ENODEV; 644 rc = -ENODEV;
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 24cc50c1774a..52cfdd86c928 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -1044,6 +1044,7 @@ core99_reset_cpu(struct device_node *node, long param, long value)
1044 unsigned long flags; 1044 unsigned long flags;
1045 struct macio_chip *macio; 1045 struct macio_chip *macio;
1046 struct device_node *np; 1046 struct device_node *np;
1047 struct device_node *cpus;
1047 const int dflt_reset_lines[] = { KL_GPIO_RESET_CPU0, 1048 const int dflt_reset_lines[] = { KL_GPIO_RESET_CPU0,
1048 KL_GPIO_RESET_CPU1, 1049 KL_GPIO_RESET_CPU1,
1049 KL_GPIO_RESET_CPU2, 1050 KL_GPIO_RESET_CPU2,
@@ -1053,12 +1054,12 @@ core99_reset_cpu(struct device_node *node, long param, long value)
1053 if (macio->type != macio_keylargo) 1054 if (macio->type != macio_keylargo)
1054 return -ENODEV; 1055 return -ENODEV;
1055 1056
1056 np = find_path_device("/cpus"); 1057 cpus = of_find_node_by_path("/cpus");
1057 if (np == NULL) 1058 if (cpus == NULL)
1058 return -ENODEV; 1059 return -ENODEV;
1059 for (np = np->child; np != NULL; np = np->sibling) { 1060 for (np = cpus->child; np != NULL; np = np->sibling) {
1060 const u32 *num = get_property(np, "reg", NULL); 1061 const u32 *num = of_get_property(np, "reg", NULL);
1061 const u32 *rst = get_property(np, "soft-reset", NULL); 1062 const u32 *rst = of_get_property(np, "soft-reset", NULL);
1062 if (num == NULL || rst == NULL) 1063 if (num == NULL || rst == NULL)
1063 continue; 1064 continue;
1064 if (param == *num) { 1065 if (param == *num) {
@@ -1066,6 +1067,7 @@ core99_reset_cpu(struct device_node *node, long param, long value)
1066 break; 1067 break;
1067 } 1068 }
1068 } 1069 }
1070 of_node_put(cpus);
1069 if (np == NULL || reset_io == 0) 1071 if (np == NULL || reset_io == 0)
1070 reset_io = dflt_reset_lines[param]; 1072 reset_io = dflt_reset_lines[param];
1071 1073
@@ -1095,7 +1097,7 @@ core99_usb_enable(struct device_node *node, long param, long value)
1095 macio->type != macio_intrepid) 1097 macio->type != macio_intrepid)
1096 return -ENODEV; 1098 return -ENODEV;
1097 1099
1098 prop = get_property(node, "AAPL,clock-id", NULL); 1100 prop = of_get_property(node, "AAPL,clock-id", NULL);
1099 if (!prop) 1101 if (!prop)
1100 return -ENODEV; 1102 return -ENODEV;
1101 if (strncmp(prop, "usb0u048", 8) == 0) 1103 if (strncmp(prop, "usb0u048", 8) == 0)
@@ -1497,17 +1499,18 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
1497 unsigned long flags; 1499 unsigned long flags;
1498 struct macio_chip *macio; 1500 struct macio_chip *macio;
1499 struct device_node *np; 1501 struct device_node *np;
1502 struct device_node *cpus;
1500 1503
1501 macio = &macio_chips[0]; 1504 macio = &macio_chips[0];
1502 if (macio->type != macio_keylargo2 && macio->type != macio_shasta) 1505 if (macio->type != macio_keylargo2 && macio->type != macio_shasta)
1503 return -ENODEV; 1506 return -ENODEV;
1504 1507
1505 np = find_path_device("/cpus"); 1508 cpus = of_find_node_by_path("/cpus");
1506 if (np == NULL) 1509 if (cpus == NULL)
1507 return -ENODEV; 1510 return -ENODEV;
1508 for (np = np->child; np != NULL; np = np->sibling) { 1511 for (np = cpus->child; np != NULL; np = np->sibling) {
1509 const u32 *num = get_property(np, "reg", NULL); 1512 const u32 *num = of_get_property(np, "reg", NULL);
1510 const u32 *rst = get_property(np, "soft-reset", NULL); 1513 const u32 *rst = of_get_property(np, "soft-reset", NULL);
1511 if (num == NULL || rst == NULL) 1514 if (num == NULL || rst == NULL)
1512 continue; 1515 continue;
1513 if (param == *num) { 1516 if (param == *num) {
@@ -1515,6 +1518,7 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
1515 break; 1518 break;
1516 } 1519 }
1517 } 1520 }
1521 of_node_put(cpus);
1518 if (np == NULL || reset_io == 0) 1522 if (np == NULL || reset_io == 0)
1519 return -ENODEV; 1523 return -ENODEV;
1520 1524
@@ -2404,14 +2408,15 @@ static int __init probe_motherboard(void)
2404 struct macio_chip *macio = &macio_chips[0]; 2408 struct macio_chip *macio = &macio_chips[0];
2405 const char *model = NULL; 2409 const char *model = NULL;
2406 struct device_node *dt; 2410 struct device_node *dt;
2411 int ret = 0;
2407 2412
2408 /* Lookup known motherboard type in device-tree. First try an 2413 /* Lookup known motherboard type in device-tree. First try an
2409 * exact match on the "model" property, then try a "compatible" 2414 * exact match on the "model" property, then try a "compatible"
2410 * match is none is found. 2415 * match is none is found.
2411 */ 2416 */
2412 dt = find_devices("device-tree"); 2417 dt = of_find_node_by_name(NULL, "device-tree");
2413 if (dt != NULL) 2418 if (dt != NULL)
2414 model = get_property(dt, "model", NULL); 2419 model = of_get_property(dt, "model", NULL);
2415 for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { 2420 for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
2416 if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { 2421 if (strcmp(model, pmac_mb_defs[i].model_string) == 0) {
2417 pmac_mb = pmac_mb_defs[i]; 2422 pmac_mb = pmac_mb_defs[i];
@@ -2474,15 +2479,18 @@ static int __init probe_motherboard(void)
2474 break; 2479 break;
2475#endif /* CONFIG_POWER4 */ 2480#endif /* CONFIG_POWER4 */
2476 default: 2481 default:
2477 return -ENODEV; 2482 ret = -ENODEV;
2483 goto done;
2478 } 2484 }
2479found: 2485found:
2480#ifndef CONFIG_POWER4 2486#ifndef CONFIG_POWER4
2481 /* Fixup Hooper vs. Comet */ 2487 /* Fixup Hooper vs. Comet */
2482 if (pmac_mb.model_id == PMAC_TYPE_HOOPER) { 2488 if (pmac_mb.model_id == PMAC_TYPE_HOOPER) {
2483 u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4); 2489 u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4);
2484 if (!mach_id_ptr) 2490 if (!mach_id_ptr) {
2485 return -ENODEV; 2491 ret = -ENODEV;
2492 goto done;
2493 }
2486 /* Here, I used to disable the media-bay on comet. It 2494 /* Here, I used to disable the media-bay on comet. It
2487 * appears this is wrong, the floppy connector is actually 2495 * appears this is wrong, the floppy connector is actually
2488 * a kind of media-bay and works with the current driver. 2496 * a kind of media-bay and works with the current driver.
@@ -2499,18 +2507,26 @@ found:
2499 * that all Apple OF revs did it properly, I do it the paranoid way. 2507 * that all Apple OF revs did it properly, I do it the paranoid way.
2500 */ 2508 */
2501 while (uninorth_base && uninorth_rev > 3) { 2509 while (uninorth_base && uninorth_rev > 3) {
2502 struct device_node *np = find_path_device("/cpus"); 2510 struct device_node *cpus = of_find_node_by_path("/cpus");
2503 if (!np || !np->child) { 2511 struct device_node *np;
2512
2513 if (!cpus || !cpus->child) {
2504 printk(KERN_WARNING "Can't find CPU(s) in device tree !\n"); 2514 printk(KERN_WARNING "Can't find CPU(s) in device tree !\n");
2515 of_node_put(cpus);
2505 break; 2516 break;
2506 } 2517 }
2507 np = np->child; 2518 np = cpus->child;
2508 /* Nap mode not supported on SMP */ 2519 /* Nap mode not supported on SMP */
2509 if (np->sibling) 2520 if (np->sibling) {
2521 of_node_put(cpus);
2510 break; 2522 break;
2523 }
2511 /* Nap mode not supported if flush-on-lock property is present */ 2524 /* Nap mode not supported if flush-on-lock property is present */
2512 if (get_property(np, "flush-on-lock", NULL)) 2525 if (of_get_property(np, "flush-on-lock", NULL)) {
2526 of_node_put(cpus);
2513 break; 2527 break;
2528 }
2529 of_node_put(cpus);
2514 powersave_nap = 1; 2530 powersave_nap = 1;
2515 printk(KERN_DEBUG "Processor NAP mode on idle enabled.\n"); 2531 printk(KERN_DEBUG "Processor NAP mode on idle enabled.\n");
2516 break; 2532 break;
@@ -2532,7 +2548,9 @@ found:
2532 2548
2533 2549
2534 printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name); 2550 printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name);
2535 return 0; 2551done:
2552 of_node_put(dt);
2553 return ret;
2536} 2554}
2537 2555
2538/* Initialize the Core99 UniNorth host bridge and memory controller 2556/* Initialize the Core99 UniNorth host bridge and memory controller
@@ -2558,7 +2576,7 @@ static void __init probe_uninorth(void)
2558 if (uninorth_node == NULL) 2576 if (uninorth_node == NULL)
2559 return; 2577 return;
2560 2578
2561 addrp = get_property(uninorth_node, "reg", NULL); 2579 addrp = of_get_property(uninorth_node, "reg", NULL);
2562 if (addrp == NULL) 2580 if (addrp == NULL)
2563 return; 2581 return;
2564 address = of_translate_address(uninorth_node, addrp); 2582 address = of_translate_address(uninorth_node, addrp);
@@ -2642,7 +2660,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
2642 return; 2660 return;
2643 } 2661 }
2644 if (type == macio_keylargo || type == macio_keylargo2) { 2662 if (type == macio_keylargo || type == macio_keylargo2) {
2645 const u32 *did = get_property(node, "device-id", NULL); 2663 const u32 *did = of_get_property(node, "device-id", NULL);
2646 if (*did == 0x00000025) 2664 if (*did == 0x00000025)
2647 type = macio_pangea; 2665 type = macio_pangea;
2648 if (*did == 0x0000003e) 2666 if (*did == 0x0000003e)
@@ -2655,7 +2673,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
2655 macio_chips[i].base = base; 2673 macio_chips[i].base = base;
2656 macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; 2674 macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON;
2657 macio_chips[i].name = macio_names[type]; 2675 macio_chips[i].name = macio_names[type];
2658 revp = get_property(node, "revision-id", NULL); 2676 revp = of_get_property(node, "revision-id", NULL);
2659 if (revp) 2677 if (revp)
2660 macio_chips[i].rev = *revp; 2678 macio_chips[i].rev = *revp;
2661 printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", 2679 printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n",
@@ -2706,8 +2724,8 @@ initial_serial_shutdown(struct device_node *np)
2706 int port_type = PMAC_SCC_ASYNC; 2724 int port_type = PMAC_SCC_ASYNC;
2707 int modem = 0; 2725 int modem = 0;
2708 2726
2709 slots = get_property(np, "slot-names", &len); 2727 slots = of_get_property(np, "slot-names", &len);
2710 conn = get_property(np, "AAPL,connector", &len); 2728 conn = of_get_property(np, "AAPL,connector", &len);
2711 if (conn && (strcmp(conn, "infrared") == 0)) 2729 if (conn && (strcmp(conn, "infrared") == 0))
2712 port_type = PMAC_SCC_IRDA; 2730 port_type = PMAC_SCC_IRDA;
2713 else if (device_is_compatible(np, "cobalt")) 2731 else if (device_is_compatible(np, "cobalt"))
@@ -2735,12 +2753,14 @@ set_initial_features(void)
2735 * differenciate them all and since that hack was there for a long 2753 * differenciate them all and since that hack was there for a long
2736 * time, I'll keep it around 2754 * time, I'll keep it around
2737 */ 2755 */
2738 if (macio_chips[0].type == macio_ohare && !find_devices("via-pmu")) { 2756 if (macio_chips[0].type == macio_ohare) {
2739 struct macio_chip *macio = &macio_chips[0]; 2757 struct macio_chip *macio = &macio_chips[0];
2740 MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES); 2758 np = of_find_node_by_name(NULL, "via-pmu");
2741 } else if (macio_chips[0].type == macio_ohare) { 2759 if (np)
2742 struct macio_chip *macio = &macio_chips[0]; 2760 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
2743 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); 2761 else
2762 MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES);
2763 of_node_put(np);
2744 } else if (macio_chips[1].type == macio_ohare) { 2764 } else if (macio_chips[1].type == macio_ohare) {
2745 struct macio_chip *macio = &macio_chips[1]; 2765 struct macio_chip *macio = &macio_chips[1];
2746 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); 2766 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
@@ -2833,14 +2853,13 @@ set_initial_features(void)
2833 } 2853 }
2834 2854
2835 /* Switch airport off */ 2855 /* Switch airport off */
2836 np = find_devices("radio"); 2856 for_each_node_by_name(np, "radio") {
2837 while(np) {
2838 if (np && np->parent == macio_chips[0].of_node) { 2857 if (np && np->parent == macio_chips[0].of_node) {
2839 macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON; 2858 macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON;
2840 core99_airport_enable(np, 0, 0); 2859 core99_airport_enable(np, 0, 0);
2841 } 2860 }
2842 np = np->next;
2843 } 2861 }
2862 of_node_put(np);
2844 } 2863 }
2845 2864
2846 /* On all machines that support sound PM, switch sound off */ 2865 /* On all machines that support sound PM, switch sound off */
@@ -2860,16 +2879,12 @@ set_initial_features(void)
2860#endif /* CONFIG_POWER4 */ 2879#endif /* CONFIG_POWER4 */
2861 2880
2862 /* On all machines, switch modem & serial ports off */ 2881 /* On all machines, switch modem & serial ports off */
2863 np = find_devices("ch-a"); 2882 for_each_node_by_name(np, "ch-a")
2864 while(np) {
2865 initial_serial_shutdown(np); 2883 initial_serial_shutdown(np);
2866 np = np->next; 2884 of_node_put(np);
2867 } 2885 for_each_node_by_name(np, "ch-b")
2868 np = find_devices("ch-b");
2869 while(np) {
2870 initial_serial_shutdown(np); 2886 initial_serial_shutdown(np);
2871 np = np->next; 2887 of_node_put(np);
2872 }
2873} 2888}
2874 2889
2875void __init 2890void __init
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index bfc4829162f1..5430e146b3e9 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -491,7 +491,7 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
491 * 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
492 * to macio parsing if that wasn't the case 492 * to macio parsing if that wasn't the case
493 */ 493 */
494 addrp = get_property(np, "AAPL,address", NULL); 494 addrp = of_get_property(np, "AAPL,address", NULL);
495 if (addrp == NULL) { 495 if (addrp == NULL) {
496 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",
497 np->full_name); 497 np->full_name);
@@ -505,13 +505,13 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
505 host->timeout_timer.function = kw_i2c_timeout; 505 host->timeout_timer.function = kw_i2c_timeout;
506 host->timeout_timer.data = (unsigned long)host; 506 host->timeout_timer.data = (unsigned long)host;
507 507
508 psteps = get_property(np, "AAPL,address-step", NULL); 508 psteps = of_get_property(np, "AAPL,address-step", NULL);
509 steps = psteps ? (*psteps) : 0x10; 509 steps = psteps ? (*psteps) : 0x10;
510 for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) 510 for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++)
511 steps >>= 1; 511 steps >>= 1;
512 /* Select interface rate */ 512 /* Select interface rate */
513 host->speed = KW_I2C_MODE_25KHZ; 513 host->speed = KW_I2C_MODE_25KHZ;
514 prate = get_property(np, "AAPL,i2c-rate", NULL); 514 prate = of_get_property(np, "AAPL,i2c-rate", NULL);
515 if (prate) switch(*prate) { 515 if (prate) switch(*prate) {
516 case 100: 516 case 100:
517 host->speed = KW_I2C_MODE_100KHZ; 517 host->speed = KW_I2C_MODE_100KHZ;
@@ -619,7 +619,7 @@ static void __init kw_i2c_probe(void)
619 } else { 619 } else {
620 for (child = NULL; 620 for (child = NULL;
621 (child = of_get_next_child(np, child)) != NULL;) { 621 (child = of_get_next_child(np, child)) != NULL;) {
622 const u32 *reg = get_property(child, 622 const u32 *reg = of_get_property(child,
623 "reg", NULL); 623 "reg", NULL);
624 if (reg == NULL) 624 if (reg == NULL)
625 continue; 625 continue;
@@ -905,7 +905,7 @@ static void __init smu_i2c_probe(void)
905 if (strcmp(busnode->type, "i2c") && 905 if (strcmp(busnode->type, "i2c") &&
906 strcmp(busnode->type, "i2c-bus")) 906 strcmp(busnode->type, "i2c-bus"))
907 continue; 907 continue;
908 reg = get_property(busnode, "reg", NULL); 908 reg = of_get_property(busnode, "reg", NULL);
909 if (reg == NULL) 909 if (reg == NULL)
910 continue; 910 continue;
911 911
@@ -950,7 +950,8 @@ struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node)
950 if (p == bus->busnode) { 950 if (p == bus->busnode) {
951 if (prev && bus->flags & pmac_i2c_multibus) { 951 if (prev && bus->flags & pmac_i2c_multibus) {
952 const u32 *reg; 952 const u32 *reg;
953 reg = get_property(prev, "reg", NULL); 953 reg = of_get_property(prev, "reg",
954 NULL);
954 if (!reg) 955 if (!reg)
955 continue; 956 continue;
956 if (((*reg) >> 8) != bus->channel) 957 if (((*reg) >> 8) != bus->channel)
@@ -971,7 +972,7 @@ EXPORT_SYMBOL_GPL(pmac_i2c_find_bus);
971 972
972u8 pmac_i2c_get_dev_addr(struct device_node *device) 973u8 pmac_i2c_get_dev_addr(struct device_node *device)
973{ 974{
974 const u32 *reg = get_property(device, "reg", NULL); 975 const u32 *reg = of_get_property(device, "reg", NULL);
975 976
976 if (reg == NULL) 977 if (reg == NULL)
977 return 0; 978 return 0;
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 6fbac308ded6..22c4ae4c6934 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -70,11 +70,11 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher
70 int len; 70 int len;
71 71
72 /* For PCI<->PCI bridges or CardBus bridges, we go down */ 72 /* For PCI<->PCI bridges or CardBus bridges, we go down */
73 class_code = get_property(node, "class-code", NULL); 73 class_code = of_get_property(node, "class-code", NULL);
74 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 74 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
75 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 75 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
76 continue; 76 continue;
77 bus_range = get_property(node, "bus-range", &len); 77 bus_range = of_get_property(node, "bus-range", &len);
78 if (bus_range != NULL && len > 2 * sizeof(int)) { 78 if (bus_range != NULL && len > 2 * sizeof(int)) {
79 if (bus_range[1] > higher) 79 if (bus_range[1] > higher)
80 higher = bus_range[1]; 80 higher = bus_range[1];
@@ -100,7 +100,7 @@ static void __init fixup_bus_range(struct device_node *bridge)
100 if (prop == NULL || prop->length < 2 * sizeof(int)) 100 if (prop == NULL || prop->length < 2 * sizeof(int))
101 return; 101 return;
102 102
103 bus_range = (int *)prop->value; 103 bus_range = prop->value;
104 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); 104 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
105} 105}
106 106
@@ -246,8 +246,8 @@ static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
246 if (np == NULL) 246 if (np == NULL)
247 return PCIBIOS_DEVICE_NOT_FOUND; 247 return PCIBIOS_DEVICE_NOT_FOUND;
248 248
249 vendor = get_property(np, "vendor-id", NULL); 249 vendor = of_get_property(np, "vendor-id", NULL);
250 device = get_property(np, "device-id", NULL); 250 device = of_get_property(np, "device-id", NULL);
251 if (vendor == NULL || device == NULL) 251 if (vendor == NULL || device == NULL)
252 return PCIBIOS_DEVICE_NOT_FOUND; 252 return PCIBIOS_DEVICE_NOT_FOUND;
253 253
@@ -622,13 +622,14 @@ static void __init init_p2pbridge(void)
622 622
623 /* XXX it would be better here to identify the specific 623 /* XXX it would be better here to identify the specific
624 PCI-PCI bridge chip we have. */ 624 PCI-PCI bridge chip we have. */
625 if ((p2pbridge = find_devices("pci-bridge")) == 0 625 p2pbridge = of_find_node_by_name(NULL, "pci-bridge");
626 if (p2pbridge == NULL
626 || p2pbridge->parent == NULL 627 || p2pbridge->parent == NULL
627 || strcmp(p2pbridge->parent->name, "pci") != 0) 628 || strcmp(p2pbridge->parent->name, "pci") != 0)
628 return; 629 goto done;
629 if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) { 630 if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) {
630 DBG("Can't find PCI infos for PCI<->PCI bridge\n"); 631 DBG("Can't find PCI infos for PCI<->PCI bridge\n");
631 return; 632 goto done;
632 } 633 }
633 /* Warning: At this point, we have not yet renumbered all busses. 634 /* Warning: At this point, we have not yet renumbered all busses.
634 * So we must use OF walking to find out hose 635 * So we must use OF walking to find out hose
@@ -636,16 +637,18 @@ static void __init init_p2pbridge(void)
636 hose = pci_find_hose_for_OF_device(p2pbridge); 637 hose = pci_find_hose_for_OF_device(p2pbridge);
637 if (!hose) { 638 if (!hose) {
638 DBG("Can't find hose for PCI<->PCI bridge\n"); 639 DBG("Can't find hose for PCI<->PCI bridge\n");
639 return; 640 goto done;
640 } 641 }
641 if (early_read_config_word(hose, bus, devfn, 642 if (early_read_config_word(hose, bus, devfn,
642 PCI_BRIDGE_CONTROL, &val) < 0) { 643 PCI_BRIDGE_CONTROL, &val) < 0) {
643 printk(KERN_ERR "init_p2pbridge: couldn't read bridge" 644 printk(KERN_ERR "init_p2pbridge: couldn't read bridge"
644 " control\n"); 645 " control\n");
645 return; 646 goto done;
646 } 647 }
647 val &= ~PCI_BRIDGE_CTL_MASTER_ABORT; 648 val &= ~PCI_BRIDGE_CTL_MASTER_ABORT;
648 early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val); 649 early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val);
650done:
651 of_node_put(p2pbridge);
649} 652}
650 653
651static void __init init_second_ohare(void) 654static void __init init_second_ohare(void)
@@ -691,17 +694,17 @@ static void __init fixup_nec_usb2(void)
691 const u32 *prop; 694 const u32 *prop;
692 u8 bus, devfn; 695 u8 bus, devfn;
693 696
694 prop = get_property(nec, "vendor-id", NULL); 697 prop = of_get_property(nec, "vendor-id", NULL);
695 if (prop == NULL) 698 if (prop == NULL)
696 continue; 699 continue;
697 if (0x1033 != *prop) 700 if (0x1033 != *prop)
698 continue; 701 continue;
699 prop = get_property(nec, "device-id", NULL); 702 prop = of_get_property(nec, "device-id", NULL);
700 if (prop == NULL) 703 if (prop == NULL)
701 continue; 704 continue;
702 if (0x0035 != *prop) 705 if (0x0035 != *prop)
703 continue; 706 continue;
704 prop = get_property(nec, "reg", NULL); 707 prop = of_get_property(nec, "reg", NULL);
705 if (prop == NULL) 708 if (prop == NULL)
706 continue; 709 continue;
707 devfn = (prop[0] >> 8) & 0xff; 710 devfn = (prop[0] >> 8) & 0xff;
@@ -909,7 +912,7 @@ static int __init add_bridge(struct device_node *dev)
909 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 912 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
910 913
911 /* Get bus range if any */ 914 /* Get bus range if any */
912 bus_range = get_property(dev, "bus-range", &len); 915 bus_range = of_get_property(dev, "bus-range", &len);
913 if (bus_range == NULL || len < 2 * sizeof(int)) { 916 if (bus_range == NULL || len < 2 * sizeof(int)) {
914 printk(KERN_WARNING "Can't get bus-range for %s, assume" 917 printk(KERN_WARNING "Can't get bus-range for %s, assume"
915 " bus 0\n", dev->full_name); 918 " bus 0\n", dev->full_name);
@@ -1199,8 +1202,7 @@ void __init pmac_pcibios_after_init(void)
1199 } 1202 }
1200#endif /* CONFIG_BLK_DEV_IDE */ 1203#endif /* CONFIG_BLK_DEV_IDE */
1201 1204
1202 nd = find_devices("firewire"); 1205 for_each_node_by_name(nd, "firewire") {
1203 while (nd) {
1204 if (nd->parent && (device_is_compatible(nd, "pci106b,18") || 1206 if (nd->parent && (device_is_compatible(nd, "pci106b,18") ||
1205 device_is_compatible(nd, "pci106b,30") || 1207 device_is_compatible(nd, "pci106b,30") ||
1206 device_is_compatible(nd, "pci11c1,5811")) 1208 device_is_compatible(nd, "pci11c1,5811"))
@@ -1208,15 +1210,14 @@ void __init pmac_pcibios_after_init(void)
1208 pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0); 1210 pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0);
1209 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0); 1211 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0);
1210 } 1212 }
1211 nd = nd->next;
1212 } 1213 }
1213 nd = find_devices("ethernet"); 1214 of_node_put(nd);
1214 while (nd) { 1215 for_each_node_by_name(nd, "ethernet") {
1215 if (nd->parent && device_is_compatible(nd, "gmac") 1216 if (nd->parent && device_is_compatible(nd, "gmac")
1216 && device_is_compatible(nd->parent, "uni-north")) 1217 && device_is_compatible(nd->parent, "uni-north"))
1217 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0); 1218 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0);
1218 nd = nd->next;
1219 } 1219 }
1220 of_node_put(nd);
1220} 1221}
1221 1222
1222#ifdef CONFIG_PPC32 1223#ifdef CONFIG_PPC32
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
index 5c6c15c5f9a3..45d54b9ad9e0 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 const u32 *reg = get_property(gp, "reg", NULL); 117 const u32 *reg = of_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 7651f278615a..85434231ae14 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -692,8 +692,7 @@ static int pmf_add_functions(struct pmf_device *dev, void *driverdata)
692 name = pp->name + plen; 692 name = pp->name + plen;
693 if (strlen(name) && pp->length >= 12) 693 if (strlen(name) && pp->length >= 12)
694 count += pmf_add_function_prop(dev, driverdata, name, 694 count += pmf_add_function_prop(dev, driverdata, name,
695 (u32 *)pp->value, 695 pp->value, pp->length);
696 pp->length);
697 } 696 }
698 return count; 697 return count;
699} 698}
@@ -821,7 +820,7 @@ struct pmf_function *__pmf_find_function(struct device_node *target,
821 * one, then we fallback to a direct call attempt 820 * one, then we fallback to a direct call attempt
822 */ 821 */
823 snprintf(fname, 63, "platform-%s", name); 822 snprintf(fname, 63, "platform-%s", name);
824 prop = get_property(target, fname, NULL); 823 prop = of_get_property(target, fname, NULL);
825 if (prop == NULL) 824 if (prop == NULL)
826 goto find_it; 825 goto find_it;
827 ph = *prop; 826 ph = *prop;
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 5e5c0e4add91..ae5097ac0378 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -482,14 +482,14 @@ static struct mpic * __init pmac_setup_one_mpic(struct device_node *np,
482 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0); 482 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0);
483 483
484 flags |= MPIC_WANTS_RESET; 484 flags |= MPIC_WANTS_RESET;
485 if (get_property(np, "big-endian", NULL)) 485 if (of_get_property(np, "big-endian", NULL))
486 flags |= MPIC_BIG_ENDIAN; 486 flags |= MPIC_BIG_ENDIAN;
487 487
488 /* Primary Big Endian means HT interrupts. This is quite dodgy 488 /* Primary Big Endian means HT interrupts. This is quite dodgy
489 * but works until I find a better way 489 * but works until I find a better way
490 */ 490 */
491 if (master && (flags & MPIC_BIG_ENDIAN)) 491 if (master && (flags & MPIC_BIG_ENDIAN))
492 flags |= MPIC_BROKEN_U3; 492 flags |= MPIC_U3_HT_IRQS;
493 493
494 mpic = mpic_alloc(np, r.start, flags, 0, 0, name); 494 mpic = mpic_alloc(np, r.start, flags, 0, 0, name);
495 if (mpic == NULL) 495 if (mpic == NULL)
@@ -510,7 +510,7 @@ static int __init pmac_pic_probe_mpic(void)
510 for (np = NULL; (np = of_find_node_by_type(np, "open-pic")) 510 for (np = NULL; (np = of_find_node_by_type(np, "open-pic"))
511 != NULL;) { 511 != NULL;) {
512 if (master == NULL && 512 if (master == NULL &&
513 get_property(np, "interrupts", NULL) == NULL) 513 of_get_property(np, "interrupts", NULL) == NULL)
514 master = of_node_get(np); 514 master = of_node_get(np);
515 else if (slave == NULL) 515 else if (slave == NULL)
516 slave = of_node_get(np); 516 slave = of_node_get(np);
@@ -575,7 +575,7 @@ void __init pmac_pic_init(void)
575#ifdef CONFIG_PPC32 575#ifdef CONFIG_PPC32
576 if (!pmac_newworld) 576 if (!pmac_newworld)
577 flags |= OF_IMAP_OLDWORLD_MAC; 577 flags |= OF_IMAP_OLDWORLD_MAC;
578 if (get_property(of_chosen, "linux,bootx", NULL) != NULL) 578 if (of_get_property(of_chosen, "linux,bootx", NULL) != NULL)
579 flags |= OF_IMAP_NO_PHANDLE; 579 flags |= OF_IMAP_NO_PHANDLE;
580#endif /* CONFIG_PPC_32 */ 580#endif /* CONFIG_PPC_32 */
581 581
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 651fa424ea06..b820cabac697 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -42,7 +42,6 @@
42#include <linux/initrd.h> 42#include <linux/initrd.h>
43#include <linux/vt_kern.h> 43#include <linux/vt_kern.h>
44#include <linux/console.h> 44#include <linux/console.h>
45#include <linux/ide.h>
46#include <linux/pci.h> 45#include <linux/pci.h>
47#include <linux/adb.h> 46#include <linux/adb.h>
48#include <linux/cuda.h> 47#include <linux/cuda.h>
@@ -135,12 +134,12 @@ static void pmac_show_cpuinfo(struct seq_file *m)
135 seq_printf(m, "machine\t\t: "); 134 seq_printf(m, "machine\t\t: ");
136 np = of_find_node_by_path("/"); 135 np = of_find_node_by_path("/");
137 if (np != NULL) { 136 if (np != NULL) {
138 pp = get_property(np, "model", NULL); 137 pp = of_get_property(np, "model", NULL);
139 if (pp != NULL) 138 if (pp != NULL)
140 seq_printf(m, "%s\n", pp); 139 seq_printf(m, "%s\n", pp);
141 else 140 else
142 seq_printf(m, "PowerMac\n"); 141 seq_printf(m, "PowerMac\n");
143 pp = get_property(np, "compatible", &plen); 142 pp = of_get_property(np, "compatible", &plen);
144 if (pp != NULL) { 143 if (pp != NULL) {
145 seq_printf(m, "motherboard\t:"); 144 seq_printf(m, "motherboard\t:");
146 while (plen > 0) { 145 while (plen > 0) {
@@ -164,11 +163,13 @@ static void pmac_show_cpuinfo(struct seq_file *m)
164 if (np == NULL) 163 if (np == NULL)
165 np = of_find_node_by_type(NULL, "cache"); 164 np = of_find_node_by_type(NULL, "cache");
166 if (np != NULL) { 165 if (np != NULL) {
167 const unsigned int *ic = get_property(np, "i-cache-size", NULL); 166 const unsigned int *ic =
168 const unsigned int *dc = get_property(np, "d-cache-size", NULL); 167 of_get_property(np, "i-cache-size", NULL);
168 const unsigned int *dc =
169 of_get_property(np, "d-cache-size", NULL);
169 seq_printf(m, "L2 cache\t:"); 170 seq_printf(m, "L2 cache\t:");
170 has_l2cache = 1; 171 has_l2cache = 1;
171 if (get_property(np, "cache-unified", NULL) != 0 && dc) { 172 if (of_get_property(np, "cache-unified", NULL) != 0 && dc) {
172 seq_printf(m, " %dK unified", *dc / 1024); 173 seq_printf(m, " %dK unified", *dc / 1024);
173 } else { 174 } else {
174 if (ic) 175 if (ic)
@@ -177,7 +178,7 @@ static void pmac_show_cpuinfo(struct seq_file *m)
177 seq_printf(m, "%s %dK data", 178 seq_printf(m, "%s %dK data",
178 (ic? " +": ""), *dc / 1024); 179 (ic? " +": ""), *dc / 1024);
179 } 180 }
180 pp = get_property(np, "ram-type", NULL); 181 pp = of_get_property(np, "ram-type", NULL);
181 if (pp) 182 if (pp)
182 seq_printf(m, " %s", pp); 183 seq_printf(m, " %s", pp);
183 seq_printf(m, "\n"); 184 seq_printf(m, "\n");
@@ -192,8 +193,11 @@ static void pmac_show_cpuinfo(struct seq_file *m)
192#ifndef CONFIG_ADB_CUDA 193#ifndef CONFIG_ADB_CUDA
193int find_via_cuda(void) 194int find_via_cuda(void)
194{ 195{
195 if (!find_devices("via-cuda")) 196 struct device_node *dn = of_find_node_by_name(NULL, "via-cuda");
197
198 if (!dn)
196 return 0; 199 return 0;
200 of_node_put(dn);
197 printk("WARNING ! Your machine is CUDA-based but your kernel\n"); 201 printk("WARNING ! Your machine is CUDA-based but your kernel\n");
198 printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n"); 202 printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n");
199 return 0; 203 return 0;
@@ -203,8 +207,11 @@ int find_via_cuda(void)
203#ifndef CONFIG_ADB_PMU 207#ifndef CONFIG_ADB_PMU
204int find_via_pmu(void) 208int find_via_pmu(void)
205{ 209{
206 if (!find_devices("via-pmu")) 210 struct device_node *dn = of_find_node_by_name(NULL, "via-pmu");
211
212 if (!dn)
207 return 0; 213 return 0;
214 of_node_put(dn);
208 printk("WARNING ! Your machine is PMU-based but your kernel\n"); 215 printk("WARNING ! Your machine is PMU-based but your kernel\n");
209 printk(" wasn't compiled with CONFIG_ADB_PMU option !\n"); 216 printk(" wasn't compiled with CONFIG_ADB_PMU option !\n");
210 return 0; 217 return 0;
@@ -224,6 +231,8 @@ static volatile u32 *sysctrl_regs;
224 231
225static void __init ohare_init(void) 232static void __init ohare_init(void)
226{ 233{
234 struct device_node *dn;
235
227 /* this area has the CPU identification register 236 /* this area has the CPU identification register
228 and some registers used by smp boards */ 237 and some registers used by smp boards */
229 sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000); 238 sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
@@ -233,7 +242,9 @@ static void __init ohare_init(void)
233 * We assume that we have a PSX memory controller iff 242 * We assume that we have a PSX memory controller iff
234 * we have an ohare I/O controller. 243 * we have an ohare I/O controller.
235 */ 244 */
236 if (find_devices("ohare") != NULL) { 245 dn = of_find_node_by_name(NULL, "ohare");
246 if (dn) {
247 of_node_put(dn);
237 if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) { 248 if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
238 if (sysctrl_regs[4] & 0x10) 249 if (sysctrl_regs[4] & 0x10)
239 sysctrl_regs[4] |= 0x04000020; 250 sysctrl_regs[4] |= 0x04000020;
@@ -249,18 +260,19 @@ static void __init l2cr_init(void)
249{ 260{
250 /* Checks "l2cr-value" property in the registry */ 261 /* Checks "l2cr-value" property in the registry */
251 if (cpu_has_feature(CPU_FTR_L2CR)) { 262 if (cpu_has_feature(CPU_FTR_L2CR)) {
252 struct device_node *np = find_devices("cpus"); 263 struct device_node *np = of_find_node_by_name(NULL, "cpus");
253 if (np == 0) 264 if (np == 0)
254 np = find_type_devices("cpu"); 265 np = of_find_node_by_type(NULL, "cpu");
255 if (np != 0) { 266 if (np != 0) {
256 const unsigned int *l2cr = 267 const unsigned int *l2cr =
257 get_property(np, "l2cr-value", NULL); 268 of_get_property(np, "l2cr-value", NULL);
258 if (l2cr != 0) { 269 if (l2cr != 0) {
259 ppc_override_l2cr = 1; 270 ppc_override_l2cr = 1;
260 ppc_override_l2cr_value = *l2cr; 271 ppc_override_l2cr_value = *l2cr;
261 _set_L2CR(0); 272 _set_L2CR(0);
262 _set_L2CR(ppc_override_l2cr_value); 273 _set_L2CR(ppc_override_l2cr_value);
263 } 274 }
275 of_node_put(np);
264 } 276 }
265 } 277 }
266 278
@@ -286,7 +298,7 @@ static void __init pmac_setup_arch(void)
286 loops_per_jiffy = 50000000 / HZ; 298 loops_per_jiffy = 50000000 / HZ;
287 cpu = of_find_node_by_type(NULL, "cpu"); 299 cpu = of_find_node_by_type(NULL, "cpu");
288 if (cpu != NULL) { 300 if (cpu != NULL) {
289 fp = get_property(cpu, "clock-frequency", NULL); 301 fp = of_get_property(cpu, "clock-frequency", NULL);
290 if (fp != NULL) { 302 if (fp != NULL) {
291 if (pvr >= 0x30 && pvr < 0x80) 303 if (pvr >= 0x30 && pvr < 0x80)
292 /* PPC970 etc. */ 304 /* PPC970 etc. */
@@ -303,7 +315,7 @@ static void __init pmac_setup_arch(void)
303 315
304 /* See if newworld or oldworld */ 316 /* See if newworld or oldworld */
305 for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; ) 317 for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; )
306 if (get_property(ic, "interrupt-controller", NULL)) 318 if (of_get_property(ic, "interrupt-controller", NULL))
307 break; 319 break;
308 if (ic) { 320 if (ic) {
309 pmac_newworld = 1; 321 pmac_newworld = 1;
@@ -341,8 +353,15 @@ static void __init pmac_setup_arch(void)
341 353
342#ifdef CONFIG_SMP 354#ifdef CONFIG_SMP
343 /* Check for Core99 */ 355 /* Check for Core99 */
344 if (find_devices("uni-n") || find_devices("u3") || find_devices("u4")) 356 ic = of_find_node_by_name(NULL, "uni-n");
357 if (!ic)
358 ic = of_find_node_by_name(NULL, "u3");
359 if (!ic)
360 ic = of_find_node_by_name(NULL, "u4");
361 if (ic) {
362 of_node_put(ic);
345 smp_ops = &core99_smp_ops; 363 smp_ops = &core99_smp_ops;
364 }
346#ifdef CONFIG_PPC32 365#ifdef CONFIG_PPC32
347 else 366 else
348 smp_ops = &psurge_smp_ops; 367 smp_ops = &psurge_smp_ops;
@@ -616,15 +635,6 @@ static void __init pmac_init_early(void)
616#endif 635#endif
617} 636}
618 637
619/*
620 * pmac has no legacy IO, anything calling this function has to
621 * fail or bad things will happen
622 */
623static int pmac_check_legacy_ioport(unsigned int baseport)
624{
625 return -ENODEV;
626}
627
628static int __init pmac_declare_of_platform_devices(void) 638static int __init pmac_declare_of_platform_devices(void)
629{ 639{
630 struct device_node *np; 640 struct device_node *np;
@@ -736,7 +746,6 @@ define_machine(powermac) {
736 .get_rtc_time = pmac_get_rtc_time, 746 .get_rtc_time = pmac_get_rtc_time,
737 .calibrate_decr = pmac_calibrate_decr, 747 .calibrate_decr = pmac_calibrate_decr,
738 .feature_call = pmac_do_feature_call, 748 .feature_call = pmac_do_feature_call,
739 .check_legacy_ioport = pmac_check_legacy_ioport,
740 .progress = udbg_progress, 749 .progress = udbg_progress,
741#ifdef CONFIG_PPC64 750#ifdef CONFIG_PPC64
742 .pci_probe_mode = pmac_pci_probe_mode, 751 .pci_probe_mode = pmac_pci_probe_mode,
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index d73fb73802bb..6f32c4eca6e5 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -264,6 +264,7 @@ static void __init psurge_quad_init(void)
264static int __init smp_psurge_probe(void) 264static int __init smp_psurge_probe(void)
265{ 265{
266 int i, ncpus; 266 int i, ncpus;
267 struct device_node *dn;
267 268
268 /* We don't do SMP on the PPC601 -- paulus */ 269 /* We don't do SMP on the PPC601 -- paulus */
269 if (PVR_VER(mfspr(SPRN_PVR)) == 1) 270 if (PVR_VER(mfspr(SPRN_PVR)) == 1)
@@ -279,8 +280,10 @@ static int __init smp_psurge_probe(void)
279 * in the hammerhead memory controller in the case of the 280 * in the hammerhead memory controller in the case of the
280 * dual-cpu powersurge board. -- paulus. 281 * dual-cpu powersurge board. -- paulus.
281 */ 282 */
282 if (find_devices("hammerhead") == NULL) 283 dn = of_find_node_by_name(NULL, "hammerhead");
284 if (dn == NULL)
283 return 1; 285 return 1;
286 of_node_put(dn);
284 287
285 hhead_base = ioremap(HAMMERHEAD_BASE, 0x800); 288 hhead_base = ioremap(HAMMERHEAD_BASE, 0x800);
286 quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024); 289 quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024);
@@ -567,7 +570,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus)
567 pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc); 570 pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc);
568 if (pmac_tb_clock_chip_host == NULL) 571 if (pmac_tb_clock_chip_host == NULL)
569 continue; 572 continue;
570 reg = get_property(cc, "reg", NULL); 573 reg = of_get_property(cc, "reg", NULL);
571 if (reg == NULL) 574 if (reg == NULL)
572 continue; 575 continue;
573 switch (*reg) { 576 switch (*reg) {
@@ -695,7 +698,7 @@ static void __init smp_core99_setup(int ncpus)
695 struct device_node *cpus = 698 struct device_node *cpus =
696 of_find_node_by_path("/cpus"); 699 of_find_node_by_path("/cpus");
697 if (cpus && 700 if (cpus &&
698 get_property(cpus, "platform-cpu-timebase", NULL)) { 701 of_get_property(cpus, "platform-cpu-timebase", NULL)) {
699 pmac_tb_freeze = smp_core99_pfunc_tb_freeze; 702 pmac_tb_freeze = smp_core99_pfunc_tb_freeze;
700 printk(KERN_INFO "Processor timebase sync using" 703 printk(KERN_INFO "Processor timebase sync using"
701 " platform function\n"); 704 " platform function\n");
@@ -712,7 +715,7 @@ static void __init smp_core99_setup(int ncpus)
712 core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ 715 core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */
713 cpu = of_find_node_by_type(NULL, "cpu"); 716 cpu = of_find_node_by_type(NULL, "cpu");
714 if (cpu != NULL) { 717 if (cpu != NULL) {
715 tbprop = get_property(cpu, "timebase-enable", NULL); 718 tbprop = of_get_property(cpu, "timebase-enable", NULL);
716 if (tbprop) 719 if (tbprop)
717 core99_tb_gpio = *tbprop; 720 core99_tb_gpio = *tbprop;
718 of_node_put(cpu); 721 of_node_put(cpu);
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index a4173906e945..bf9da56942e8 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -297,49 +297,11 @@ int __init via_calibrate_decr(void)
297} 297}
298#endif 298#endif
299 299
300#ifdef CONFIG_PM
301/*
302 * Reset the time after a sleep.
303 */
304static int
305time_sleep_notify(struct pmu_sleep_notifier *self, int when)
306{
307 static unsigned long time_diff;
308 unsigned long flags;
309 unsigned long seq;
310 struct timespec tv;
311
312 switch (when) {
313 case PBOOK_SLEEP_NOW:
314 do {
315 seq = read_seqbegin_irqsave(&xtime_lock, flags);
316 time_diff = xtime.tv_sec - pmac_get_boot_time();
317 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
318 break;
319 case PBOOK_WAKE:
320 tv.tv_sec = pmac_get_boot_time() + time_diff;
321 tv.tv_nsec = 0;
322 do_settimeofday(&tv);
323 break;
324 }
325 return PBOOK_SLEEP_OK;
326}
327
328static struct pmu_sleep_notifier time_sleep_notifier = {
329 time_sleep_notify, SLEEP_LEVEL_MISC,
330};
331#endif /* CONFIG_PM */
332
333/* 300/*
334 * Query the OF and get the decr frequency. 301 * Query the OF and get the decr frequency.
335 */ 302 */
336void __init pmac_calibrate_decr(void) 303void __init pmac_calibrate_decr(void)
337{ 304{
338#if defined(CONFIG_PM) && defined(CONFIG_ADB_PMU)
339 /* XXX why here? */
340 pmu_register_sleep_notifier(&time_sleep_notifier);
341#endif
342
343 generic_calibrate_decr(); 305 generic_calibrate_decr();
344 306
345#ifdef CONFIG_PPC32 307#ifdef CONFIG_PPC32
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index 379db05b0082..47de4d3fc167 100644
--- a/arch/powerpc/platforms/powermac/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -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 = get_property(of_chosen, "linux,stdout-path", NULL); 84 path = of_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 = get_property(escc, "reg", NULL); 99 reg = of_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 = get_property(macio, "assigned-addresses", NULL); 105 reg = of_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/prep/Kconfig b/arch/powerpc/platforms/prep/Kconfig
index 673ac47a1626..29d411279b0c 100644
--- a/arch/powerpc/platforms/prep/Kconfig
+++ b/arch/powerpc/platforms/prep/Kconfig
@@ -1,3 +1,12 @@
1config PPC_PREP
2 bool "PowerPC Reference Platform (PReP) based machines"
3 depends on PPC_MULTIPLATFORM && PPC32 && BROKEN
4 select MPIC
5 select PPC_I8259
6 select PPC_INDIRECT_PCI
7 select PPC_UDBG_16550
8 select PPC_NATIVE
9 default n
1 10
2config PREP_RESIDUAL 11config PREP_RESIDUAL
3 bool "Support for PReP Residual Data" 12 bool "Support for PReP Residual Data"
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig
index 1a481a60a883..40f0008af4d1 100644
--- a/arch/powerpc/platforms/ps3/Kconfig
+++ b/arch/powerpc/platforms/ps3/Kconfig
@@ -1,3 +1,19 @@
1config PPC_PS3
2 bool "Sony PS3 (incomplete)"
3 depends on PPC_MULTIPLATFORM && PPC64
4 select PPC_CELL
5 select USB_ARCH_HAS_OHCI
6 select USB_OHCI_LITTLE_ENDIAN
7 select USB_OHCI_BIG_ENDIAN_MMIO
8 select USB_ARCH_HAS_EHCI
9 select USB_EHCI_BIG_ENDIAN_MMIO
10 help
11 This option enables support for the Sony PS3 game console
12 and other platforms using the PS3 hypervisor.
13 Support for this platform is not yet complete, so
14 enabling this will not result in a bootable kernel on a
15 PS3 system.
16
1menu "PS3 Platform Options" 17menu "PS3 Platform Options"
2 depends on PPC_PS3 18 depends on PPC_PS3
3 19
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index e12e59fea13a..ea60c451cf87 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -39,7 +39,7 @@ static unsigned long htab_addr;
39static unsigned char *bolttab; 39static unsigned char *bolttab;
40static unsigned char *inusetab; 40static unsigned char *inusetab;
41 41
42static spinlock_t ps3_bolttab_lock = SPIN_LOCK_UNLOCKED; 42static DEFINE_SPINLOCK(ps3_bolttab_lock);
43 43
44#define debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g) \ 44#define debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g) \
45 _debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g, __func__, __LINE__) 45 _debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g, __func__, __LINE__)
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index a57032cf6f1b..16e4e401b820 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -1,3 +1,13 @@
1config PPC_PSERIES
2 depends on PPC_MULTIPLATFORM && PPC64
3 bool "IBM pSeries & new (POWER5-based) iSeries"
4 select MPIC
5 select PPC_I8259
6 select PPC_RTAS
7 select RTAS_ERROR_LOGGING
8 select PPC_UDBG_16550
9 select PPC_NATIVE
10 default y
1 11
2config PPC_SPLPAR 12config PPC_SPLPAR
3 depends on PPC_PSERIES 13 depends on PPC_PSERIES
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 2dfd05095a25..90235d598751 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -2,14 +2,15 @@ ifeq ($(CONFIG_PPC64),y)
2EXTRA_CFLAGS += -mno-minimal-toc 2EXTRA_CFLAGS += -mno-minimal-toc
3endif 3endif
4 4
5obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ 5obj-y := lpar.o hvCall.o nvram.o reconfig.o \
6 setup.o iommu.o ras.o rtasd.o pci_dlpar.o \ 6 setup.o iommu.o ras.o rtasd.o \
7 firmware.o power.o 7 firmware.o power.o
8obj-$(CONFIG_SMP) += smp.o 8obj-$(CONFIG_SMP) += smp.o
9obj-$(CONFIG_XICS) += xics.o 9obj-$(CONFIG_XICS) += xics.o
10obj-$(CONFIG_SCANLOG) += scanlog.o 10obj-$(CONFIG_SCANLOG) += scanlog.o
11obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o 11obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o
12obj-$(CONFIG_KEXEC) += kexec.o 12obj-$(CONFIG_KEXEC) += kexec.o
13obj-$(CONFIG_PCI) += pci.o pci_dlpar.o
13 14
14obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o 15obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o
15 16
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 6cedbc002e0f..48fbd442e9df 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -74,7 +74,10 @@
74 * is broken and panic. This sets the threshold for how many read 74 * is broken and panic. This sets the threshold for how many read
75 * attempts we allow before panicking. 75 * attempts we allow before panicking.
76 */ 76 */
77#define EEH_MAX_FAILS 100000 77#define EEH_MAX_FAILS 2100000
78
79/* Time to wait for a PCI slot to retport status, in milliseconds */
80#define PCI_BUS_RESET_WAIT_MSEC (60*1000)
78 81
79/* RTAS tokens */ 82/* RTAS tokens */
80static int ibm_set_eeh_option; 83static int ibm_set_eeh_option;
@@ -83,6 +86,7 @@ static int ibm_read_slot_reset_state;
83static int ibm_read_slot_reset_state2; 86static int ibm_read_slot_reset_state2;
84static int ibm_slot_error_detail; 87static int ibm_slot_error_detail;
85static int ibm_get_config_addr_info; 88static int ibm_get_config_addr_info;
89static int ibm_get_config_addr_info2;
86static int ibm_configure_bridge; 90static int ibm_configure_bridge;
87 91
88int eeh_subsystem_enabled; 92int eeh_subsystem_enabled;
@@ -168,6 +172,55 @@ static int read_slot_reset_state(struct pci_dn *pdn, int rets[])
168} 172}
169 173
170/** 174/**
175 * eeh_wait_for_slot_status - returns error status of slot
176 * @pdn pci device node
177 * @max_wait_msecs maximum number to millisecs to wait
178 *
179 * Return negative value if a permanent error, else return
180 * Partition Endpoint (PE) status value.
181 *
182 * If @max_wait_msecs is positive, then this routine will
183 * sleep until a valid status can be obtained, or until
184 * the max allowed wait time is exceeded, in which case
185 * a -2 is returned.
186 */
187int
188eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs)
189{
190 int rc;
191 int rets[3];
192 int mwait;
193
194 while (1) {
195 rc = read_slot_reset_state(pdn, rets);
196 if (rc) return rc;
197 if (rets[1] == 0) return -1; /* EEH is not supported */
198
199 if (rets[0] != 5) return rets[0]; /* return actual status */
200
201 if (rets[2] == 0) return -1; /* permanently unavailable */
202
203 if (max_wait_msecs <= 0) return -1;
204
205 mwait = rets[2];
206 if (mwait <= 0) {
207 printk (KERN_WARNING
208 "EEH: Firmware returned bad wait value=%d\n", mwait);
209 mwait = 1000;
210 } else if (mwait > 300*1000) {
211 printk (KERN_WARNING
212 "EEH: Firmware is taking too long, time=%d\n", mwait);
213 mwait = 300*1000;
214 }
215 max_wait_msecs -= mwait;
216 msleep (mwait);
217 }
218
219 printk(KERN_WARNING "EEH: Timed out waiting for slot status\n");
220 return -2;
221}
222
223/**
171 * eeh_token_to_phys - convert EEH address token to phys address 224 * eeh_token_to_phys - convert EEH address token to phys address
172 * @token i/o token, should be address in the form 0xA.... 225 * @token i/o token, should be address in the form 0xA....
173 */ 226 */
@@ -229,7 +282,7 @@ void eeh_mark_slot (struct device_node *dn, int mode_flag)
229 dn = find_device_pe (dn); 282 dn = find_device_pe (dn);
230 283
231 /* Back up one, since config addrs might be shared */ 284 /* Back up one, since config addrs might be shared */
232 if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr) 285 if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
233 dn = dn->parent; 286 dn = dn->parent;
234 287
235 PCI_DN(dn)->eeh_mode |= mode_flag; 288 PCI_DN(dn)->eeh_mode |= mode_flag;
@@ -263,7 +316,7 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag)
263 dn = find_device_pe (dn); 316 dn = find_device_pe (dn);
264 317
265 /* Back up one, since config addrs might be shared */ 318 /* Back up one, since config addrs might be shared */
266 if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr) 319 if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
267 dn = dn->parent; 320 dn = dn->parent;
268 321
269 PCI_DN(dn)->eeh_mode &= ~mode_flag; 322 PCI_DN(dn)->eeh_mode &= ~mode_flag;
@@ -293,7 +346,6 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
293 int rets[3]; 346 int rets[3];
294 unsigned long flags; 347 unsigned long flags;
295 struct pci_dn *pdn; 348 struct pci_dn *pdn;
296 enum pci_channel_state state;
297 int rc = 0; 349 int rc = 0;
298 350
299 total_mmio_ffs++; 351 total_mmio_ffs++;
@@ -367,25 +419,25 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
367 goto dn_unlock; 419 goto dn_unlock;
368 } 420 }
369 421
370 /* If EEH is not supported on this device, punt. */ 422 /* Note that config-io to empty slots may fail;
371 if (rets[1] != 1) { 423 * they are empty when they don't have children. */
372 printk(KERN_WARNING "EEH: event on unsupported device, rc=%d dn=%s\n", 424 if ((rets[0] == 5) && (dn->child == NULL)) {
373 ret, dn->full_name);
374 false_positives++; 425 false_positives++;
375 rc = 0; 426 rc = 0;
376 goto dn_unlock; 427 goto dn_unlock;
377 } 428 }
378 429
379 /* If not the kind of error we know about, punt. */ 430 /* If EEH is not supported on this device, punt. */
380 if (rets[0] != 2 && rets[0] != 4 && rets[0] != 5) { 431 if (rets[1] != 1) {
432 printk(KERN_WARNING "EEH: event on unsupported device, rc=%d dn=%s\n",
433 ret, dn->full_name);
381 false_positives++; 434 false_positives++;
382 rc = 0; 435 rc = 0;
383 goto dn_unlock; 436 goto dn_unlock;
384 } 437 }
385 438
386 /* Note that config-io to empty slots may fail; 439 /* If not the kind of error we know about, punt. */
387 * we recognize empty because they don't have children. */ 440 if (rets[0] != 1 && rets[0] != 2 && rets[0] != 4 && rets[0] != 5) {
388 if ((rets[0] == 5) && (dn->child == NULL)) {
389 false_positives++; 441 false_positives++;
390 rc = 0; 442 rc = 0;
391 goto dn_unlock; 443 goto dn_unlock;
@@ -399,17 +451,12 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
399 eeh_mark_slot (dn, EEH_MODE_ISOLATED); 451 eeh_mark_slot (dn, EEH_MODE_ISOLATED);
400 spin_unlock_irqrestore(&confirm_error_lock, flags); 452 spin_unlock_irqrestore(&confirm_error_lock, flags);
401 453
402 state = pci_channel_io_normal; 454 eeh_send_failure_event (dn, dev);
403 if ((rets[0] == 2) || (rets[0] == 4))
404 state = pci_channel_io_frozen;
405 if (rets[0] == 5)
406 state = pci_channel_io_perm_failure;
407 eeh_send_failure_event (dn, dev, state, rets[2]);
408 455
409 /* Most EEH events are due to device driver bugs. Having 456 /* Most EEH events are due to device driver bugs. Having
410 * a stack trace will help the device-driver authors figure 457 * a stack trace will help the device-driver authors figure
411 * out what happened. So print that out. */ 458 * out what happened. So print that out. */
412 if (rets[0] != 5) dump_stack(); 459 dump_stack();
413 return 1; 460 return 1;
414 461
415dn_unlock: 462dn_unlock:
@@ -458,38 +505,6 @@ EXPORT_SYMBOL(eeh_check_failure);
458/* The code below deals with error recovery */ 505/* The code below deals with error recovery */
459 506
460/** 507/**
461 * eeh_slot_availability - returns error status of slot
462 * @pdn pci device node
463 *
464 * Return negative value if a permanent error, else return
465 * a number of milliseconds to wait until the PCI slot is
466 * ready to be used.
467 */
468static int
469eeh_slot_availability(struct pci_dn *pdn)
470{
471 int rc;
472 int rets[3];
473
474 rc = read_slot_reset_state(pdn, rets);
475
476 if (rc) return rc;
477
478 if (rets[1] == 0) return -1; /* EEH is not supported */
479 if (rets[0] == 0) return 0; /* Oll Korrect */
480 if (rets[0] == 5) {
481 if (rets[2] == 0) return -1; /* permanently unavailable */
482 return rets[2]; /* number of millisecs to wait */
483 }
484 if (rets[0] == 1)
485 return 250;
486
487 printk (KERN_ERR "EEH: Slot unavailable: rc=%d, rets=%d %d %d\n",
488 rc, rets[0], rets[1], rets[2]);
489 return -2;
490}
491
492/**
493 * rtas_pci_enable - enable MMIO or DMA transfers for this slot 508 * rtas_pci_enable - enable MMIO or DMA transfers for this slot
494 * @pdn pci device node 509 * @pdn pci device node
495 */ 510 */
@@ -512,9 +527,13 @@ rtas_pci_enable(struct pci_dn *pdn, int function)
512 function); 527 function);
513 528
514 if (rc) 529 if (rc)
515 printk(KERN_WARNING "EEH: Cannot enable function %d, err=%d dn=%s\n", 530 printk(KERN_WARNING "EEH: Unexpected state change %d, err=%d dn=%s\n",
516 function, rc, pdn->node->full_name); 531 function, rc, pdn->node->full_name);
517 532
533 rc = eeh_wait_for_slot_status (pdn, PCI_BUS_RESET_WAIT_MSEC);
534 if ((rc == 4) && (function == EEH_THAW_MMIO))
535 return 0;
536
518 return rc; 537 return rc;
519} 538}
520 539
@@ -595,36 +614,24 @@ int rtas_set_slot_reset(struct pci_dn *pdn)
595{ 614{
596 int i, rc; 615 int i, rc;
597 616
598 __rtas_set_slot_reset(pdn); 617 /* Take three shots at resetting the bus */
618 for (i=0; i<3; i++) {
619 __rtas_set_slot_reset(pdn);
599 620
600 /* Now double check with the firmware to make sure the device is 621 rc = eeh_wait_for_slot_status(pdn, PCI_BUS_RESET_WAIT_MSEC);
601 * ready to be used; if not, wait for recovery. */
602 for (i=0; i<10; i++) {
603 rc = eeh_slot_availability (pdn);
604 if (rc == 0) 622 if (rc == 0)
605 return 0; 623 return 0;
606 624
607 if (rc == -2) {
608 printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n",
609 i, pdn->node->full_name);
610 __rtas_set_slot_reset(pdn);
611 continue;
612 }
613
614 if (rc < 0) { 625 if (rc < 0) {
615 printk (KERN_ERR "EEH: unrecoverable slot failure %s\n", 626 printk (KERN_ERR "EEH: unrecoverable slot failure %s\n",
616 pdn->node->full_name); 627 pdn->node->full_name);
617 return -1; 628 return -1;
618 } 629 }
619 630 printk (KERN_ERR "EEH: bus reset %d failed on slot %s\n",
620 msleep (rc+100); 631 i+1, pdn->node->full_name);
621 } 632 }
622 633
623 rc = eeh_slot_availability (pdn); 634 return -1;
624 if (rc)
625 printk (KERN_ERR "EEH: timeout resetting slot %s\n", pdn->node->full_name);
626
627 return rc;
628} 635}
629 636
630/* ------------------------------------------------------- */ 637/* ------------------------------------------------------- */
@@ -744,16 +751,48 @@ struct eeh_early_enable_info {
744 unsigned int buid_lo; 751 unsigned int buid_lo;
745}; 752};
746 753
754static int get_pe_addr (int config_addr,
755 struct eeh_early_enable_info *info)
756{
757 unsigned int rets[3];
758 int ret;
759
760 /* Use latest config-addr token on power6 */
761 if (ibm_get_config_addr_info2 != RTAS_UNKNOWN_SERVICE) {
762 /* Make sure we have a PE in hand */
763 ret = rtas_call (ibm_get_config_addr_info2, 4, 2, rets,
764 config_addr, info->buid_hi, info->buid_lo, 1);
765 if (ret || (rets[0]==0))
766 return 0;
767
768 ret = rtas_call (ibm_get_config_addr_info2, 4, 2, rets,
769 config_addr, info->buid_hi, info->buid_lo, 0);
770 if (ret)
771 return 0;
772 return rets[0];
773 }
774
775 /* Use older config-addr token on power5 */
776 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) {
777 ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets,
778 config_addr, info->buid_hi, info->buid_lo, 0);
779 if (ret)
780 return 0;
781 return rets[0];
782 }
783 return 0;
784}
785
747/* Enable eeh for the given device node. */ 786/* Enable eeh for the given device node. */
748static void *early_enable_eeh(struct device_node *dn, void *data) 787static void *early_enable_eeh(struct device_node *dn, void *data)
749{ 788{
750 unsigned int rets[3]; 789 unsigned int rets[3];
751 struct eeh_early_enable_info *info = data; 790 struct eeh_early_enable_info *info = data;
752 int ret; 791 int ret;
753 const char *status = get_property(dn, "status", NULL); 792 const char *status = of_get_property(dn, "status", NULL);
754 const u32 *class_code = get_property(dn, "class-code", NULL); 793 const u32 *class_code = of_get_property(dn, "class-code", NULL);
755 const u32 *vendor_id = get_property(dn, "vendor-id", NULL); 794 const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL);
756 const u32 *device_id = get_property(dn, "device-id", NULL); 795 const u32 *device_id = of_get_property(dn, "device-id", NULL);
757 const u32 *regs; 796 const u32 *regs;
758 int enable; 797 int enable;
759 struct pci_dn *pdn = PCI_DN(dn); 798 struct pci_dn *pdn = PCI_DN(dn);
@@ -796,7 +835,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
796 835
797 /* Ok... see if this device supports EEH. Some do, some don't, 836 /* Ok... see if this device supports EEH. Some do, some don't,
798 * and the only way to find out is to check each and every one. */ 837 * and the only way to find out is to check each and every one. */
799 regs = get_property(dn, "reg", NULL); 838 regs = of_get_property(dn, "reg", NULL);
800 if (regs) { 839 if (regs) {
801 /* First register entry is addr (00BBSS00) */ 840 /* First register entry is addr (00BBSS00) */
802 /* Try to enable eeh */ 841 /* Try to enable eeh */
@@ -810,15 +849,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
810 849
811 /* If the newer, better, ibm,get-config-addr-info is supported, 850 /* If the newer, better, ibm,get-config-addr-info is supported,
812 * then use that instead. */ 851 * then use that instead. */
813 pdn->eeh_pe_config_addr = 0; 852 pdn->eeh_pe_config_addr = get_pe_addr(pdn->eeh_config_addr, info);
814 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) {
815 ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets,
816 pdn->eeh_config_addr,
817 info->buid_hi, info->buid_lo,
818 0);
819 if (ret == 0)
820 pdn->eeh_pe_config_addr = rets[0];
821 }
822 853
823 /* Some older systems (Power4) allow the 854 /* Some older systems (Power4) allow the
824 * ibm,set-eeh-option call to succeed even on nodes 855 * ibm,set-eeh-option call to succeed even on nodes
@@ -889,6 +920,7 @@ void __init eeh_init(void)
889 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state"); 920 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state");
890 ibm_slot_error_detail = rtas_token("ibm,slot-error-detail"); 921 ibm_slot_error_detail = rtas_token("ibm,slot-error-detail");
891 ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info"); 922 ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info");
923 ibm_get_config_addr_info2 = rtas_token("ibm,get-config-addr-info2");
892 ibm_configure_bridge = rtas_token ("ibm,configure-bridge"); 924 ibm_configure_bridge = rtas_token ("ibm,configure-bridge");
893 925
894 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) 926 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE)
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index a4c0bf84ef2e..3170e003f76a 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -158,7 +158,8 @@ static void eeh_report_reset(struct pci_dev *dev, void *userdata)
158 return; 158 return;
159 159
160 rc = driver->err_handler->slot_reset(dev); 160 rc = driver->err_handler->slot_reset(dev);
161 if (*res == PCI_ERS_RESULT_NONE) *res = rc; 161 if ((*res == PCI_ERS_RESULT_NONE) ||
162 (*res == PCI_ERS_RESULT_RECOVERED)) *res = rc;
162 if (*res == PCI_ERS_RESULT_DISCONNECT && 163 if (*res == PCI_ERS_RESULT_DISCONNECT &&
163 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 164 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
164} 165}
@@ -248,6 +249,7 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata)
248 249
249static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) 250static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
250{ 251{
252 struct device_node *dn;
251 int cnt, rc; 253 int cnt, rc;
252 254
253 /* pcibios will clear the counter; save the value */ 255 /* pcibios will clear the counter; save the value */
@@ -263,23 +265,20 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
263 if (rc) 265 if (rc)
264 return rc; 266 return rc;
265 267
266 /* New-style config addrs might be shared across multiple devices, 268 /* Walk over all functions on this device. */
267 * Walk over all functions on this device */ 269 dn = pe_dn->node;
268 if (pe_dn->eeh_pe_config_addr) { 270 if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
269 struct device_node *pe = pe_dn->node; 271 dn = dn->parent->child;
270 pe = pe->parent->child; 272
271 while (pe) { 273 while (dn) {
272 struct pci_dn *ppe = PCI_DN(pe); 274 struct pci_dn *ppe = PCI_DN(dn);
273 if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) { 275 /* On Power4, always true because eeh_pe_config_addr=0 */
274 rtas_configure_bridge(ppe); 276 if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) {
275 eeh_restore_bars(ppe); 277 rtas_configure_bridge(ppe);
276 } 278 eeh_restore_bars(ppe);
277 pe = pe->sibling;
278 } 279 }
279 } else { 280 dn = dn->sibling;
280 rtas_configure_bridge(pe_dn); 281 }
281 eeh_restore_bars(pe_dn);
282 }
283 282
284 /* Give the system 5 seconds to finish running the user-space 283 /* Give the system 5 seconds to finish running the user-space
285 * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, 284 * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes,
@@ -299,7 +298,7 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
299/* The longest amount of time to wait for a pci device 298/* The longest amount of time to wait for a pci device
300 * to come back on line, in seconds. 299 * to come back on line, in seconds.
301 */ 300 */
302#define MAX_WAIT_FOR_RECOVERY 15 301#define MAX_WAIT_FOR_RECOVERY 150
303 302
304struct pci_dn * handle_eeh_events (struct eeh_event *event) 303struct pci_dn * handle_eeh_events (struct eeh_event *event)
305{ 304{
@@ -315,14 +314,14 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
315 314
316 if (!frozen_dn) { 315 if (!frozen_dn) {
317 316
318 location = get_property(event->dn, "ibm,loc-code", NULL); 317 location = of_get_property(event->dn, "ibm,loc-code", NULL);
319 location = location ? location : "unknown"; 318 location = location ? location : "unknown";
320 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " 319 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
321 "for location=%s pci addr=%s\n", 320 "for location=%s pci addr=%s\n",
322 location, pci_name(event->dev)); 321 location, pci_name(event->dev));
323 return NULL; 322 return NULL;
324 } 323 }
325 location = get_property(frozen_dn, "ibm,loc-code", NULL); 324 location = of_get_property(frozen_dn, "ibm,loc-code", NULL);
326 location = location ? location : "unknown"; 325 location = location ? location : "unknown";
327 326
328 /* There are two different styles for coming up with the PE. 327 /* There are two different styles for coming up with the PE.
@@ -341,13 +340,6 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
341 return NULL; 340 return NULL;
342 } 341 }
343 342
344#if 0
345 /* We may get "permanent failure" messages on empty slots.
346 * These are false alarms. Empty slots have no child dn. */
347 if ((event->state == pci_channel_io_perm_failure) && (frozen_device == NULL))
348 return;
349#endif
350
351 frozen_pdn = PCI_DN(frozen_dn); 343 frozen_pdn = PCI_DN(frozen_dn);
352 frozen_pdn->eeh_freeze_count++; 344 frozen_pdn->eeh_freeze_count++;
353 345
@@ -362,13 +354,12 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
362 if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES) 354 if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES)
363 goto excess_failures; 355 goto excess_failures;
364 356
365 /* If the reset state is a '5' and the time to reset is 0 (infinity) 357 /* Get the current PCI slot state. */
366 * or is more then 15 seconds, then mark this as a permanent failure. 358 rc = eeh_wait_for_slot_status (frozen_pdn, MAX_WAIT_FOR_RECOVERY*1000);
367 */ 359 if (rc < 0) {
368 if ((event->state == pci_channel_io_perm_failure) && 360 printk(KERN_WARNING "EEH: Permanent failure\n");
369 ((event->time_unavail <= 0) ||
370 (event->time_unavail > MAX_WAIT_FOR_RECOVERY*1000)))
371 goto hard_fail; 361 goto hard_fail;
362 }
372 363
373 eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */); 364 eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */);
374 printk(KERN_WARNING 365 printk(KERN_WARNING
@@ -390,14 +381,18 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
390 */ 381 */
391 if (result == PCI_ERS_RESULT_NONE) { 382 if (result == PCI_ERS_RESULT_NONE) {
392 rc = eeh_reset_device(frozen_pdn, frozen_bus); 383 rc = eeh_reset_device(frozen_pdn, frozen_bus);
393 if (rc) 384 if (rc) {
385 printk(KERN_WARNING "EEH: Unable to reset, rc=%d\n", rc);
394 goto hard_fail; 386 goto hard_fail;
387 }
395 } 388 }
396 389
397 /* If all devices reported they can proceed, then re-enable MMIO */ 390 /* If all devices reported they can proceed, then re-enable MMIO */
398 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 391 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
399 rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO); 392 rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO);
400 393
394 if (rc < 0)
395 goto hard_fail;
401 if (rc) { 396 if (rc) {
402 result = PCI_ERS_RESULT_NEED_RESET; 397 result = PCI_ERS_RESULT_NEED_RESET;
403 } else { 398 } else {
@@ -410,6 +405,8 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
410 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 405 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
411 rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA); 406 rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA);
412 407
408 if (rc < 0)
409 goto hard_fail;
413 if (rc) 410 if (rc)
414 result = PCI_ERS_RESULT_NEED_RESET; 411 result = PCI_ERS_RESULT_NEED_RESET;
415 else 412 else
@@ -417,21 +414,28 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
417 } 414 }
418 415
419 /* If any device has a hard failure, then shut off everything. */ 416 /* If any device has a hard failure, then shut off everything. */
420 if (result == PCI_ERS_RESULT_DISCONNECT) 417 if (result == PCI_ERS_RESULT_DISCONNECT) {
418 printk(KERN_WARNING "EEH: Device driver gave up\n");
421 goto hard_fail; 419 goto hard_fail;
420 }
422 421
423 /* If any device called out for a reset, then reset the slot */ 422 /* If any device called out for a reset, then reset the slot */
424 if (result == PCI_ERS_RESULT_NEED_RESET) { 423 if (result == PCI_ERS_RESULT_NEED_RESET) {
425 rc = eeh_reset_device(frozen_pdn, NULL); 424 rc = eeh_reset_device(frozen_pdn, NULL);
426 if (rc) 425 if (rc) {
426 printk(KERN_WARNING "EEH: Cannot reset, rc=%d\n", rc);
427 goto hard_fail; 427 goto hard_fail;
428 }
428 result = PCI_ERS_RESULT_NONE; 429 result = PCI_ERS_RESULT_NONE;
429 pci_walk_bus(frozen_bus, eeh_report_reset, &result); 430 pci_walk_bus(frozen_bus, eeh_report_reset, &result);
430 } 431 }
431 432
432 /* All devices should claim they have recovered by now. */ 433 /* All devices should claim they have recovered by now. */
433 if (result != PCI_ERS_RESULT_RECOVERED) 434 if ((result != PCI_ERS_RESULT_RECOVERED) &&
435 (result != PCI_ERS_RESULT_NONE)) {
436 printk(KERN_WARNING "EEH: Not recovered\n");
434 goto hard_fail; 437 goto hard_fail;
438 }
435 439
436 /* Tell all device drivers that they can resume operations */ 440 /* Tell all device drivers that they can resume operations */
437 pci_walk_bus(frozen_bus, eeh_report_resume, NULL); 441 pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index 49037edf7d39..ddb80f5d850b 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -118,9 +118,7 @@ static void eeh_thread_launcher(struct work_struct *dummy)
118 * (from a workqueue). 118 * (from a workqueue).
119 */ 119 */
120int eeh_send_failure_event (struct device_node *dn, 120int eeh_send_failure_event (struct device_node *dn,
121 struct pci_dev *dev, 121 struct pci_dev *dev)
122 enum pci_channel_state state,
123 int time_unavail)
124{ 122{
125 unsigned long flags; 123 unsigned long flags;
126 struct eeh_event *event; 124 struct eeh_event *event;
@@ -128,7 +126,7 @@ int eeh_send_failure_event (struct device_node *dn,
128 126
129 if (!mem_init_done) { 127 if (!mem_init_done) {
130 printk(KERN_ERR "EEH: event during early boot not handled\n"); 128 printk(KERN_ERR "EEH: event during early boot not handled\n");
131 location = get_property(dn, "ibm,loc-code", NULL); 129 location = of_get_property(dn, "ibm,loc-code", NULL);
132 printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); 130 printk(KERN_ERR "EEH: device node = %s\n", dn->full_name);
133 printk(KERN_ERR "EEH: PCI location = %s\n", location); 131 printk(KERN_ERR "EEH: PCI location = %s\n", location);
134 return 1; 132 return 1;
@@ -144,8 +142,6 @@ int eeh_send_failure_event (struct device_node *dn,
144 142
145 event->dn = dn; 143 event->dn = dn;
146 event->dev = dev; 144 event->dev = dev;
147 event->state = state;
148 event->time_unavail = time_unavail;
149 145
150 /* We may or may not be called in an interrupt context */ 146 /* We may or may not be called in an interrupt context */
151 spin_lock_irqsave(&eeh_eventlist_lock, flags); 147 spin_lock_irqsave(&eeh_eventlist_lock, flags);
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 90522e3c9d46..29bf83bfb1f0 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -80,7 +80,7 @@ void __init fw_feature_init(void)
80 goto out; 80 goto out;
81 } 81 }
82 82
83 hypertas = get_property(dn, "ibm,hypertas-functions", &len); 83 hypertas = of_get_property(dn, "ibm,hypertas-functions", &len);
84 if (hypertas == NULL) 84 if (hypertas == NULL)
85 goto out; 85 goto out;
86 86
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index f460b9cbfd46..9711eb0d5496 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -143,7 +143,7 @@ static int pseries_add_processor(struct device_node *np)
143 int err = -ENOSPC, len, nthreads, i; 143 int err = -ENOSPC, len, nthreads, i;
144 const u32 *intserv; 144 const u32 *intserv;
145 145
146 intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); 146 intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len);
147 if (!intserv) 147 if (!intserv)
148 return 0; 148 return 0;
149 149
@@ -203,7 +203,7 @@ static void pseries_remove_processor(struct device_node *np)
203 int len, nthreads, i; 203 int len, nthreads, i;
204 const u32 *intserv; 204 const u32 *intserv;
205 205
206 intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); 206 intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len);
207 if (!intserv) 207 if (!intserv)
208 return; 208 return;
209 209
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index e6653a868b91..66665c82415c 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -242,6 +242,7 @@ static unsigned long tce_get_pSeriesLP(struct iommu_table *tbl, long tcenum)
242 return tce_ret; 242 return tce_ret;
243} 243}
244 244
245#ifdef CONFIG_PCI
245static void iommu_table_setparms(struct pci_controller *phb, 246static void iommu_table_setparms(struct pci_controller *phb,
246 struct device_node *dn, 247 struct device_node *dn,
247 struct iommu_table *tbl) 248 struct iommu_table *tbl)
@@ -252,8 +253,8 @@ static void iommu_table_setparms(struct pci_controller *phb,
252 253
253 node = (struct device_node *)phb->arch_data; 254 node = (struct device_node *)phb->arch_data;
254 255
255 basep = get_property(node, "linux,tce-base", NULL); 256 basep = of_get_property(node, "linux,tce-base", NULL);
256 sizep = get_property(node, "linux,tce-size", NULL); 257 sizep = of_get_property(node, "linux,tce-size", NULL);
257 if (basep == NULL || sizep == NULL) { 258 if (basep == NULL || sizep == NULL) {
258 printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has " 259 printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has "
259 "missing tce entries !\n", dn->full_name); 260 "missing tce entries !\n", dn->full_name);
@@ -403,7 +404,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
403 404
404 /* Find nearest ibm,dma-window, walking up the device tree */ 405 /* Find nearest ibm,dma-window, walking up the device tree */
405 for (pdn = dn; pdn != NULL; pdn = pdn->parent) { 406 for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
406 dma_window = get_property(pdn, "ibm,dma-window", NULL); 407 dma_window = of_get_property(pdn, "ibm,dma-window", NULL);
407 if (dma_window != NULL) 408 if (dma_window != NULL)
408 break; 409 break;
409 } 410 }
@@ -478,29 +479,6 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
478 pci_name(dev)); 479 pci_name(dev));
479} 480}
480 481
481static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
482{
483 int err = NOTIFY_OK;
484 struct device_node *np = node;
485 struct pci_dn *pci = PCI_DN(np);
486
487 switch (action) {
488 case PSERIES_RECONFIG_REMOVE:
489 if (pci && pci->iommu_table &&
490 get_property(np, "ibm,dma-window", NULL))
491 iommu_free_table(np);
492 break;
493 default:
494 err = NOTIFY_DONE;
495 break;
496 }
497 return err;
498}
499
500static struct notifier_block iommu_reconfig_nb = {
501 .notifier_call = iommu_reconfig_notifier,
502};
503
504static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) 482static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
505{ 483{
506 struct device_node *pdn, *dn; 484 struct device_node *pdn, *dn;
@@ -521,7 +499,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
521 499
522 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table; 500 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
523 pdn = pdn->parent) { 501 pdn = pdn->parent) {
524 dma_window = get_property(pdn, "ibm,dma-window", NULL); 502 dma_window = of_get_property(pdn, "ibm,dma-window", NULL);
525 if (dma_window) 503 if (dma_window)
526 break; 504 break;
527 } 505 }
@@ -554,15 +532,44 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
554 532
555 dev->dev.archdata.dma_data = pci->iommu_table; 533 dev->dev.archdata.dma_data = pci->iommu_table;
556} 534}
535#else /* CONFIG_PCI */
536#define pci_dma_bus_setup_pSeries NULL
537#define pci_dma_dev_setup_pSeries NULL
538#define pci_dma_bus_setup_pSeriesLP NULL
539#define pci_dma_dev_setup_pSeriesLP NULL
540#endif /* !CONFIG_PCI */
541
542static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
543{
544 int err = NOTIFY_OK;
545 struct device_node *np = node;
546 struct pci_dn *pci = PCI_DN(np);
547
548 switch (action) {
549 case PSERIES_RECONFIG_REMOVE:
550 if (pci && pci->iommu_table &&
551 of_get_property(np, "ibm,dma-window", NULL))
552 iommu_free_table(np);
553 break;
554 default:
555 err = NOTIFY_DONE;
556 break;
557 }
558 return err;
559}
560
561static struct notifier_block iommu_reconfig_nb = {
562 .notifier_call = iommu_reconfig_notifier,
563};
557 564
558/* These are called very early. */ 565/* These are called very early. */
559void iommu_init_early_pSeries(void) 566void iommu_init_early_pSeries(void)
560{ 567{
561 if (of_chosen && get_property(of_chosen, "linux,iommu-off", NULL)) { 568 if (of_chosen && of_get_property(of_chosen, "linux,iommu-off", NULL)) {
562 /* Direct I/O, IOMMU off */ 569 /* Direct I/O, IOMMU off */
563 ppc_md.pci_dma_dev_setup = NULL; 570 ppc_md.pci_dma_dev_setup = NULL;
564 ppc_md.pci_dma_bus_setup = NULL; 571 ppc_md.pci_dma_bus_setup = NULL;
565 pci_dma_ops = &dma_direct_ops; 572 set_pci_dma_ops(&dma_direct_ops);
566 return; 573 return;
567 } 574 }
568 575
@@ -588,6 +595,6 @@ void iommu_init_early_pSeries(void)
588 595
589 pSeries_reconfig_notifier_register(&iommu_reconfig_nb); 596 pSeries_reconfig_notifier_register(&iommu_reconfig_nb);
590 597
591 pci_dma_ops = &dma_iommu_ops; 598 set_pci_dma_ops(&dma_iommu_ops);
592} 599}
593 600
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 843ee9643211..3a70e8ad7bc8 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -209,13 +209,13 @@ void __init find_udbg_vterm(void)
209 /* find the boot console from /chosen/stdout */ 209 /* find the boot console from /chosen/stdout */
210 if (!of_chosen) 210 if (!of_chosen)
211 return; 211 return;
212 name = get_property(of_chosen, "linux,stdout-path", NULL); 212 name = of_get_property(of_chosen, "linux,stdout-path", NULL);
213 if (name == NULL) 213 if (name == NULL)
214 return; 214 return;
215 stdout_node = of_find_node_by_path(name); 215 stdout_node = of_find_node_by_path(name);
216 if (!stdout_node) 216 if (!stdout_node)
217 return; 217 return;
218 name = get_property(stdout_node, "name", NULL); 218 name = of_get_property(stdout_node, "name", NULL);
219 if (!name) { 219 if (!name) {
220 printk(KERN_WARNING "stdout node missing 'name' property!\n"); 220 printk(KERN_WARNING "stdout node missing 'name' property!\n");
221 goto out; 221 goto out;
@@ -226,7 +226,7 @@ void __init find_udbg_vterm(void)
226 /* Check if it's a virtual terminal */ 226 /* Check if it's a virtual terminal */
227 if (strncmp(name, "vty", 3) != 0) 227 if (strncmp(name, "vty", 3) != 0)
228 goto out; 228 goto out;
229 termno = get_property(stdout_node, "reg", NULL); 229 termno = of_get_property(stdout_node, "reg", NULL);
230 if (termno == NULL) 230 if (termno == NULL)
231 goto out; 231 goto out;
232 vtermno = termno[0]; 232 vtermno = termno[0];
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 64163cecdf93..f68903e15bd5 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -130,7 +130,7 @@ int __init pSeries_nvram_init(void)
130 if (nvram == NULL) 130 if (nvram == NULL)
131 return -ENODEV; 131 return -ENODEV;
132 132
133 nbytes_p = get_property(nvram, "#bytes", &proplen); 133 nbytes_p = of_get_property(nvram, "#bytes", &proplen);
134 if (nbytes_p == NULL || proplen != sizeof(unsigned int)) 134 if (nbytes_p == NULL || proplen != sizeof(unsigned int))
135 return -EIO; 135 return -EIO;
136 136
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index fa59124ce3fe..2c6ded29f73d 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -25,6 +25,7 @@
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/string.h> 26#include <linux/string.h>
27 27
28#include <asm/eeh.h>
28#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
29#include <asm/prom.h> 30#include <asm/prom.h>
30#include <asm/ppc-pci.h> 31#include <asm/ppc-pci.h>
@@ -39,7 +40,7 @@ void pcibios_name_device(struct pci_dev *dev)
39 */ 40 */
40 dn = pci_device_to_OF_node(dev); 41 dn = pci_device_to_OF_node(dev);
41 if (dn) { 42 if (dn) {
42 char *loc_code = get_property(dn, "ibm,loc-code", 0); 43 const char *loc_code = of_get_property(dn, "ibm,loc-code", 0);
43 if (loc_code) { 44 if (loc_code) {
44 int loc_len = strlen(loc_code); 45 int loc_len = strlen(loc_code);
45 if (loc_len < sizeof(dev->dev.name)) { 46 if (loc_len < sizeof(dev->dev.name)) {
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index ac56b868913a..fdc1a369f767 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -29,6 +29,7 @@
29#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
30#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
31#include <asm/firmware.h> 31#include <asm/firmware.h>
32#include <asm/eeh.h>
32 33
33static struct pci_bus * 34static struct pci_bus *
34find_bus_among_children(struct pci_bus *bus, 35find_bus_among_children(struct pci_bus *bus,
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index edc038873113..53aa04101ced 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -85,7 +85,7 @@ static void request_ras_irqs(struct device_node *np,
85 * map those interrupts using the default interrupt host and default 85 * map those interrupts using the default interrupt host and default
86 * trigger 86 * trigger
87 */ 87 */
88 opicprop = get_property(np, "open-pic-interrupt", &opicplen); 88 opicprop = of_get_property(np, "open-pic-interrupt", &opicplen);
89 if (opicprop) { 89 if (opicprop) {
90 opicplen /= sizeof(u32); 90 opicplen /= sizeof(u32);
91 for (i = 0; i < opicplen; i++) { 91 for (i = 0; i < opicplen; i++) {
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index 77d0937d5c07..9797b10b2935 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -363,7 +363,7 @@ static int get_eventscan_parms(void)
363 363
364 node = of_find_node_by_path("/rtas"); 364 node = of_find_node_by_path("/rtas");
365 365
366 ip = get_property(node, "rtas-event-scan-rate", NULL); 366 ip = of_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 34aff47b1f55..33eec2822c66 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -65,6 +65,7 @@
65#include <asm/udbg.h> 65#include <asm/udbg.h>
66#include <asm/smp.h> 66#include <asm/smp.h>
67#include <asm/firmware.h> 67#include <asm/firmware.h>
68#include <asm/eeh.h>
68 69
69#include "plpar_wrappers.h" 70#include "plpar_wrappers.h"
70#include "pseries.h" 71#include "pseries.h"
@@ -92,7 +93,7 @@ static void pSeries_show_cpuinfo(struct seq_file *m)
92 93
93 root = of_find_node_by_path("/"); 94 root = of_find_node_by_path("/");
94 if (root) 95 if (root)
95 model = get_property(root, "model", NULL); 96 model = of_get_property(root, "model", NULL);
96 seq_printf(m, "machine\t\t: CHRP %s\n", model); 97 seq_printf(m, "machine\t\t: CHRP %s\n", model);
97 of_node_put(root); 98 of_node_put(root);
98} 99}
@@ -138,8 +139,8 @@ static void __init pseries_mpic_init_IRQ(void)
138 struct mpic *mpic; 139 struct mpic *mpic;
139 140
140 np = of_find_node_by_path("/"); 141 np = of_find_node_by_path("/");
141 naddr = prom_n_addr_cells(np); 142 naddr = of_n_addr_cells(np);
142 opprop = get_property(np, "platform-open-pic", &opplen); 143 opprop = of_get_property(np, "platform-open-pic", &opplen);
143 if (opprop != 0) { 144 if (opprop != 0) {
144 openpic_addr = of_read_number(opprop, naddr); 145 openpic_addr = of_read_number(opprop, naddr);
145 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 146 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
@@ -188,11 +189,11 @@ static void __init pseries_mpic_init_IRQ(void)
188 break; 189 break;
189 if (strcmp(np->name, "pci") != 0) 190 if (strcmp(np->name, "pci") != 0)
190 continue; 191 continue;
191 addrp = get_property(np, "8259-interrupt-acknowledge", 192 addrp = of_get_property(np, "8259-interrupt-acknowledge",
192 NULL); 193 NULL);
193 if (addrp == NULL) 194 if (addrp == NULL)
194 continue; 195 continue;
195 naddr = prom_n_addr_cells(np); 196 naddr = of_n_addr_cells(np);
196 intack = addrp[naddr-1]; 197 intack = addrp[naddr-1];
197 if (naddr > 1) 198 if (naddr > 1)
198 intack |= ((unsigned long)addrp[naddr-2]) << 32; 199 intack |= ((unsigned long)addrp[naddr-2]) << 32;
@@ -225,7 +226,7 @@ static void __init pseries_discover_pic(void)
225 226
226 for (np = NULL; (np = of_find_node_by_name(np, 227 for (np = NULL; (np = of_find_node_by_name(np,
227 "interrupt-controller"));) { 228 "interrupt-controller"));) {
228 typep = get_property(np, "compatible", NULL); 229 typep = of_get_property(np, "compatible", NULL);
229 if (strstr(typep, "open-pic")) { 230 if (strstr(typep, "open-pic")) {
230 pSeries_mpic_node = of_node_get(np); 231 pSeries_mpic_node = of_node_get(np);
231 ppc_md.init_IRQ = pseries_mpic_init_IRQ; 232 ppc_md.init_IRQ = pseries_mpic_init_IRQ;
@@ -334,32 +335,6 @@ static void __init pSeries_init_early(void)
334 DBG(" <- pSeries_init_early()\n"); 335 DBG(" <- pSeries_init_early()\n");
335} 336}
336 337
337
338static int pSeries_check_legacy_ioport(unsigned int baseport)
339{
340 struct device_node *np;
341
342#define I8042_DATA_REG 0x60
343#define FDC_BASE 0x3f0
344
345
346 switch(baseport) {
347 case I8042_DATA_REG:
348 np = of_find_node_by_type(NULL, "8042");
349 if (np == NULL)
350 return -ENODEV;
351 of_node_put(np);
352 break;
353 case FDC_BASE:
354 np = of_find_node_by_type(NULL, "fdc");
355 if (np == NULL)
356 return -ENODEV;
357 of_node_put(np);
358 break;
359 }
360 return 0;
361}
362
363/* 338/*
364 * Called very early, MMU is off, device-tree isn't unflattened 339 * Called very early, MMU is off, device-tree isn't unflattened
365 */ 340 */
@@ -514,6 +489,10 @@ void pSeries_power_off(void)
514 for (;;); 489 for (;;);
515} 490}
516 491
492#ifndef CONFIG_PCI
493void pSeries_final_fixup(void) { }
494#endif
495
517define_machine(pseries) { 496define_machine(pseries) {
518 .name = "pSeries", 497 .name = "pSeries",
519 .probe = pSeries_probe, 498 .probe = pSeries_probe,
@@ -532,7 +511,6 @@ define_machine(pseries) {
532 .set_rtc_time = rtas_set_rtc_time, 511 .set_rtc_time = rtas_set_rtc_time,
533 .calibrate_decr = generic_calibrate_decr, 512 .calibrate_decr = generic_calibrate_decr,
534 .progress = rtas_progress, 513 .progress = rtas_progress,
535 .check_legacy_ioport = pSeries_check_legacy_ioport,
536 .system_reset_exception = pSeries_system_reset_exception, 514 .system_reset_exception = pSeries_system_reset_exception,
537 .machine_check_exception = pSeries_machine_check_exception, 515 .machine_check_exception = pSeries_machine_check_exception,
538}; 516};
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 81d172d65038..896cbf340c42 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -576,7 +576,7 @@ static void __init xics_init_one_node(struct device_node *np,
576 * This happens to be the case so far but we are playing with fire... 576 * This happens to be the case so far but we are playing with fire...
577 * should be fixed one of these days. -BenH. 577 * should be fixed one of these days. -BenH.
578 */ 578 */
579 ireg = get_property(np, "ibm,interrupt-server-ranges", NULL); 579 ireg = of_get_property(np, "ibm,interrupt-server-ranges", NULL);
580 580
581 /* Do that ever happen ? we'll know soon enough... but even good'old 581 /* Do that ever happen ? we'll know soon enough... but even good'old
582 * f80 does have that property .. 582 * f80 does have that property ..
@@ -588,7 +588,7 @@ static void __init xics_init_one_node(struct device_node *np,
588 */ 588 */
589 *indx = *ireg; 589 *indx = *ireg;
590 } 590 }
591 ireg = get_property(np, "reg", &ilen); 591 ireg = of_get_property(np, "reg", &ilen);
592 if (!ireg) 592 if (!ireg)
593 panic("xics_init_IRQ: can't find interrupt reg property"); 593 panic("xics_init_IRQ: can't find interrupt reg property");
594 594
@@ -640,10 +640,10 @@ static void __init xics_setup_8259_cascade(void)
640 break; 640 break;
641 if (strcmp(np->name, "pci") != 0) 641 if (strcmp(np->name, "pci") != 0)
642 continue; 642 continue;
643 addrp = get_property(np, "8259-interrupt-acknowledge", NULL); 643 addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
644 if (addrp == NULL) 644 if (addrp == NULL)
645 continue; 645 continue;
646 naddr = prom_n_addr_cells(np); 646 naddr = of_n_addr_cells(np);
647 intack = addrp[naddr-1]; 647 intack = addrp[naddr-1];
648 if (naddr > 1) 648 if (naddr > 1)
649 intack |= ((unsigned long)addrp[naddr-2]) << 32; 649 intack |= ((unsigned long)addrp[naddr-2]) << 32;
@@ -664,10 +664,11 @@ static struct device_node *cpuid_to_of_node(int cpu)
664 int i, len; 664 int i, len;
665 const u32 *intserv; 665 const u32 *intserv;
666 666
667 intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); 667 intserv = of_get_property(np, "ibm,ppc-interrupt-server#s",
668 &len);
668 669
669 if (!intserv) 670 if (!intserv)
670 intserv = get_property(np, "reg", &len); 671 intserv = of_get_property(np, "reg", &len);
671 672
672 i = len / sizeof(u32); 673 i = len / sizeof(u32);
673 674
@@ -709,7 +710,7 @@ void __init xics_init_IRQ(void)
709 /* Find the server numbers for the boot cpu. */ 710 /* Find the server numbers for the boot cpu. */
710 np = cpuid_to_of_node(boot_cpuid); 711 np = cpuid_to_of_node(boot_cpuid);
711 BUG_ON(!np); 712 BUG_ON(!np);
712 ireg = get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen); 713 ireg = of_get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen);
713 if (!ireg) 714 if (!ireg)
714 goto skip_gserver_check; 715 goto skip_gserver_check;
715 i = ilen / sizeof(int); 716 i = ilen / sizeof(int);
@@ -725,7 +726,7 @@ void __init xics_init_IRQ(void)
725 default_server = hcpuid; 726 default_server = hcpuid;
726 default_distrib_server = ireg[j+1]; 727 default_distrib_server = ireg[j+1];
727 728
728 isize = get_property(np, 729 isize = of_get_property(np,
729 "ibm,interrupt-server#-size", NULL); 730 "ibm,interrupt-server#-size", NULL);
730 if (isize) 731 if (isize)
731 interrupt_server_size = *isize; 732 interrupt_server_size = *isize;
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 26ca3ffbc1de..e96ca9618dbb 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -11,12 +11,17 @@ obj-$(CONFIG_PPC_PMI) += pmi.o
11obj-$(CONFIG_U3_DART) += dart_iommu.o 11obj-$(CONFIG_U3_DART) += dart_iommu.o
12obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o 12obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o
13obj-$(CONFIG_FSL_SOC) += fsl_soc.o 13obj-$(CONFIG_FSL_SOC) += fsl_soc.o
14obj-$(CONFIG_FSL_PCIE) += fsl_pcie.o
14obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o 15obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o
15obj-$(CONFIG_QUICC_ENGINE) += qe_lib/ 16obj-$(CONFIG_QUICC_ENGINE) += qe_lib/
16 17
18# contains only the suspend handler for time
19obj-$(CONFIG_PM) += timer.o
20
17ifeq ($(CONFIG_PPC_MERGE),y) 21ifeq ($(CONFIG_PPC_MERGE),y)
18obj-$(CONFIG_PPC_I8259) += i8259.o 22obj-$(CONFIG_PPC_I8259) += i8259.o
19obj-$(CONFIG_PPC_83xx) += ipic.o 23obj-$(CONFIG_PPC_83xx) += ipic.o
24obj-$(CONFIG_4xx) += uic.o
20endif 25endif
21 26
22# Temporary hack until we have migrated to asm-powerpc 27# Temporary hack until we have migrated to asm-powerpc
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 1488535b0e13..336186dd7f10 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -333,7 +333,7 @@ void iommu_init_early_dart(void)
333 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; 333 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart;
334 334
335 /* Setup pci_dma ops */ 335 /* Setup pci_dma ops */
336 pci_dma_ops = &dma_iommu_ops; 336 set_pci_dma_ops(&dma_iommu_ops);
337 return; 337 return;
338 } 338 }
339 339
@@ -343,7 +343,7 @@ void iommu_init_early_dart(void)
343 ppc_md.pci_dma_bus_setup = NULL; 343 ppc_md.pci_dma_bus_setup = NULL;
344 344
345 /* Setup pci_dma ops */ 345 /* Setup pci_dma ops */
346 pci_dma_ops = &dma_direct_ops; 346 set_pci_dma_ops(&dma_direct_ops);
347} 347}
348 348
349 349
diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c
index 1fc5819e7d18..574b6ef44e0b 100644
--- a/arch/powerpc/sysdev/dcr.c
+++ b/arch/powerpc/sysdev/dcr.c
@@ -26,7 +26,7 @@
26unsigned int dcr_resource_start(struct device_node *np, unsigned int index) 26unsigned int dcr_resource_start(struct device_node *np, unsigned int index)
27{ 27{
28 unsigned int ds; 28 unsigned int ds;
29 const u32 *dr = get_property(np, "dcr-reg", &ds); 29 const u32 *dr = of_get_property(np, "dcr-reg", &ds);
30 30
31 if (dr == NULL || ds & 1 || index >= (ds / 8)) 31 if (dr == NULL || ds & 1 || index >= (ds / 8))
32 return 0; 32 return 0;
@@ -37,7 +37,7 @@ unsigned int dcr_resource_start(struct device_node *np, unsigned int index)
37unsigned int dcr_resource_len(struct device_node *np, unsigned int index) 37unsigned int dcr_resource_len(struct device_node *np, unsigned int index)
38{ 38{
39 unsigned int ds; 39 unsigned int ds;
40 const u32 *dr = get_property(np, "dcr-reg", &ds); 40 const u32 *dr = of_get_property(np, "dcr-reg", &ds);
41 41
42 if (dr == NULL || ds & 1 || index >= (ds / 8)) 42 if (dr == NULL || ds & 1 || index >= (ds / 8))
43 return 0; 43 return 0;
@@ -53,9 +53,9 @@ static struct device_node * find_dcr_parent(struct device_node * node)
53 const u32 *p; 53 const u32 *p;
54 54
55 for (par = of_node_get(node); par;) { 55 for (par = of_node_get(node); par;) {
56 if (get_property(par, "dcr-controller", NULL)) 56 if (of_get_property(par, "dcr-controller", NULL))
57 break; 57 break;
58 p = get_property(par, "dcr-parent", NULL); 58 p = of_get_property(par, "dcr-parent", NULL);
59 tmp = par; 59 tmp = par;
60 if (p == NULL) 60 if (p == NULL)
61 par = of_get_parent(par); 61 par = of_get_parent(par);
@@ -80,13 +80,13 @@ u64 of_translate_dcr_address(struct device_node *dev,
80 return OF_BAD_ADDR; 80 return OF_BAD_ADDR;
81 81
82 /* Stride is not properly defined yet, default to 0x10 for Axon */ 82 /* Stride is not properly defined yet, default to 0x10 for Axon */
83 p = get_property(dp, "dcr-mmio-stride", NULL); 83 p = of_get_property(dp, "dcr-mmio-stride", NULL);
84 stride = (p == NULL) ? 0x10 : *p; 84 stride = (p == NULL) ? 0x10 : *p;
85 85
86 /* XXX FIXME: Which property name is to use of the 2 following ? */ 86 /* XXX FIXME: Which property name is to use of the 2 following ? */
87 p = get_property(dp, "dcr-mmio-range", NULL); 87 p = of_get_property(dp, "dcr-mmio-range", NULL);
88 if (p == NULL) 88 if (p == NULL)
89 p = get_property(dp, "dcr-mmio-space", NULL); 89 p = of_get_property(dp, "dcr-mmio-space", NULL);
90 if (p == NULL) 90 if (p == NULL)
91 return OF_BAD_ADDR; 91 return OF_BAD_ADDR;
92 92
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_pcie.c b/arch/powerpc/sysdev/fsl_pcie.c
index a2f4f730213e..041c07e8b665 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_pcie.c
+++ b/arch/powerpc/sysdev/fsl_pcie.c
@@ -24,8 +24,6 @@
24#include <asm/pci-bridge.h> 24#include <asm/pci-bridge.h>
25#include <asm/machdep.h> 25#include <asm/machdep.h>
26 26
27#include "mpc86xx.h"
28
29#define PCI_CFG_OUT out_be32 27#define PCI_CFG_OUT out_be32
30 28
31/* ERRATA PCI-Ex 14 PCIE Controller timeout */ 29/* ERRATA PCI-Ex 14 PCIE Controller timeout */
diff --git a/arch/powerpc/sysdev/fsl_pcie.h b/arch/powerpc/sysdev/fsl_pcie.h
new file mode 100644
index 000000000000..8d9779c84bea
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_pcie.h
@@ -0,0 +1,94 @@
1/*
2 * MPC85xx/86xx PCI Express structure define
3 *
4 * Copyright 2007 Freescale Semiconductor, Inc
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifdef __KERNEL__
14#ifndef __POWERPC_FSL_PCIE_H
15#define __POWERPC_FSL_PCIE_H
16
17/* PCIE Express IO block registers in 85xx/86xx */
18
19struct ccsr_pex {
20 __be32 __iomem pex_config_addr; /* 0x.000 - PCI Express Configuration Address Register */
21 __be32 __iomem pex_config_data; /* 0x.004 - PCI Express Configuration Data Register */
22 u8 __iomem res1[4];
23 __be32 __iomem pex_otb_cpl_tor; /* 0x.00c - PCI Express Outbound completion timeout register */
24 __be32 __iomem pex_conf_tor; /* 0x.010 - PCI Express configuration timeout register */
25 u8 __iomem res2[12];
26 __be32 __iomem pex_pme_mes_dr; /* 0x.020 - PCI Express PME and message detect register */
27 __be32 __iomem pex_pme_mes_disr; /* 0x.024 - PCI Express PME and message disable register */
28 __be32 __iomem pex_pme_mes_ier; /* 0x.028 - PCI Express PME and message interrupt enable register */
29 __be32 __iomem pex_pmcr; /* 0x.02c - PCI Express power management command register */
30 u8 __iomem res3[3024];
31 __be32 __iomem pexotar0; /* 0x.c00 - PCI Express outbound translation address register 0 */
32 __be32 __iomem pexotear0; /* 0x.c04 - PCI Express outbound translation extended address register 0*/
33 u8 __iomem res4[8];
34 __be32 __iomem pexowar0; /* 0x.c10 - PCI Express outbound window attributes register 0*/
35 u8 __iomem res5[12];
36 __be32 __iomem pexotar1; /* 0x.c20 - PCI Express outbound translation address register 1 */
37 __be32 __iomem pexotear1; /* 0x.c24 - PCI Express outbound translation extended address register 1*/
38 __be32 __iomem pexowbar1; /* 0x.c28 - PCI Express outbound window base address register 1*/
39 u8 __iomem res6[4];
40 __be32 __iomem pexowar1; /* 0x.c30 - PCI Express outbound window attributes register 1*/
41 u8 __iomem res7[12];
42 __be32 __iomem pexotar2; /* 0x.c40 - PCI Express outbound translation address register 2 */
43 __be32 __iomem pexotear2; /* 0x.c44 - PCI Express outbound translation extended address register 2*/
44 __be32 __iomem pexowbar2; /* 0x.c48 - PCI Express outbound window base address register 2*/
45 u8 __iomem res8[4];
46 __be32 __iomem pexowar2; /* 0x.c50 - PCI Express outbound window attributes register 2*/
47 u8 __iomem res9[12];
48 __be32 __iomem pexotar3; /* 0x.c60 - PCI Express outbound translation address register 3 */
49 __be32 __iomem pexotear3; /* 0x.c64 - PCI Express outbound translation extended address register 3*/
50 __be32 __iomem pexowbar3; /* 0x.c68 - PCI Express outbound window base address register 3*/
51 u8 __iomem res10[4];
52 __be32 __iomem pexowar3; /* 0x.c70 - PCI Express outbound window attributes register 3*/
53 u8 __iomem res11[12];
54 __be32 __iomem pexotar4; /* 0x.c80 - PCI Express outbound translation address register 4 */
55 __be32 __iomem pexotear4; /* 0x.c84 - PCI Express outbound translation extended address register 4*/
56 __be32 __iomem pexowbar4; /* 0x.c88 - PCI Express outbound window base address register 4*/
57 u8 __iomem res12[4];
58 __be32 __iomem pexowar4; /* 0x.c90 - PCI Express outbound window attributes register 4*/
59 u8 __iomem res13[12];
60 u8 __iomem res14[256];
61 __be32 __iomem pexitar3; /* 0x.da0 - PCI Express inbound translation address register 3 */
62 u8 __iomem res15[4];
63 __be32 __iomem pexiwbar3; /* 0x.da8 - PCI Express inbound window base address register 3 */
64 __be32 __iomem pexiwbear3; /* 0x.dac - PCI Express inbound window base extended address register 3 */
65 __be32 __iomem pexiwar3; /* 0x.db0 - PCI Express inbound window attributes register 3 */
66 u8 __iomem res16[12];
67 __be32 __iomem pexitar2; /* 0x.dc0 - PCI Express inbound translation address register 2 */
68 u8 __iomem res17[4];
69 __be32 __iomem pexiwbar2; /* 0x.dc8 - PCI Express inbound window base address register 2 */
70 __be32 __iomem pexiwbear2; /* 0x.dcc - PCI Express inbound window base extended address register 2 */
71 __be32 __iomem pexiwar2; /* 0x.dd0 - PCI Express inbound window attributes register 2 */
72 u8 __iomem res18[12];
73 __be32 __iomem pexitar1; /* 0x.de0 - PCI Express inbound translation address register 2 */
74 u8 __iomem res19[4];
75 __be32 __iomem pexiwbar1; /* 0x.de8 - PCI Express inbound window base address register 2 */
76 __be32 __iomem pexiwbear1; /* 0x.dec - PCI Express inbound window base extended address register 2 */
77 __be32 __iomem pexiwar1; /* 0x.df0 - PCI Express inbound window attributes register 2 */
78 u8 __iomem res20[12];
79 __be32 __iomem pex_err_dr; /* 0x.e00 - PCI Express error detect register */
80 u8 __iomem res21[4];
81 __be32 __iomem pex_err_en; /* 0x.e08 - PCI Express error interrupt enable register */
82 u8 __iomem res22[4];
83 __be32 __iomem pex_err_disr; /* 0x.e10 - PCI Express error disable register */
84 u8 __iomem res23[12];
85 __be32 __iomem pex_err_cap_stat; /* 0x.e20 - PCI Express error capture status register */
86 u8 __iomem res24[4];
87 __be32 __iomem pex_err_cap_r0; /* 0x.e28 - PCI Express error capture register 0 */
88 __be32 __iomem pex_err_cap_r1; /* 0x.e2c - PCI Express error capture register 0 */
89 __be32 __iomem pex_err_cap_r2; /* 0x.e30 - PCI Express error capture register 0 */
90 __be32 __iomem pex_err_cap_r3; /* 0x.e34 - PCI Express error capture register 0 */
91};
92
93#endif /* __POWERPC_FSL_PCIE_H */
94#endif /* __KERNEL__ */
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index d20f02927f72..8a123c71449f 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -52,7 +52,7 @@ phys_addr_t get_immrbase(void)
52 soc = of_find_node_by_type(NULL, "soc"); 52 soc = of_find_node_by_type(NULL, "soc");
53 if (soc) { 53 if (soc) {
54 unsigned int size; 54 unsigned int size;
55 const void *prop = get_property(soc, "reg", &size); 55 const void *prop = of_get_property(soc, "reg", &size);
56 56
57 if (prop) 57 if (prop)
58 immrbase = of_translate_address(soc, prop); 58 immrbase = of_translate_address(soc, prop);
@@ -78,8 +78,8 @@ u32 get_brgfreq(void)
78 node = of_find_node_by_type(NULL, "cpm"); 78 node = of_find_node_by_type(NULL, "cpm");
79 if (node) { 79 if (node) {
80 unsigned int size; 80 unsigned int size;
81 const unsigned int *prop = get_property(node, "brg-frequency", 81 const unsigned int *prop = of_get_property(node,
82 &size); 82 "brg-frequency", &size);
83 83
84 if (prop) 84 if (prop)
85 brgfreq = *prop; 85 brgfreq = *prop;
@@ -103,8 +103,8 @@ u32 get_baudrate(void)
103 node = of_find_node_by_type(NULL, "serial"); 103 node = of_find_node_by_type(NULL, "serial");
104 if (node) { 104 if (node) {
105 unsigned int size; 105 unsigned int size;
106 const unsigned int *prop = get_property(node, "current-speed", 106 const unsigned int *prop = of_get_property(node,
107 &size); 107 "current-speed", &size);
108 108
109 if (prop) 109 if (prop)
110 fs_baudrate = *prop; 110 fs_baudrate = *prop;
@@ -153,7 +153,8 @@ static int __init gfar_mdio_of_init(void)
153 while ((child = of_get_next_child(np, child)) != NULL) { 153 while ((child = of_get_next_child(np, child)) != NULL) {
154 int irq = irq_of_parse_and_map(child, 0); 154 int irq = irq_of_parse_and_map(child, 0);
155 if (irq != NO_IRQ) { 155 if (irq != NO_IRQ) {
156 const u32 *id = get_property(child, "reg", NULL); 156 const u32 *id = of_get_property(child,
157 "reg", NULL);
157 mdio_data.irq[*id] = irq; 158 mdio_data.irq[*id] = irq;
158 } 159 }
159 } 160 }
@@ -209,7 +210,7 @@ static int __init gfar_of_init(void)
209 210
210 of_irq_to_resource(np, 0, &r[1]); 211 of_irq_to_resource(np, 0, &r[1]);
211 212
212 model = get_property(np, "model", NULL); 213 model = of_get_property(np, "model", NULL);
213 214
214 /* If we aren't the FEC we have multiple interrupts */ 215 /* If we aren't the FEC we have multiple interrupts */
215 if (model && strcasecmp(model, "FEC")) { 216 if (model && strcasecmp(model, "FEC")) {
@@ -253,7 +254,7 @@ static int __init gfar_of_init(void)
253 FSL_GIANFAR_DEV_HAS_VLAN | 254 FSL_GIANFAR_DEV_HAS_VLAN |
254 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; 255 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
255 256
256 ph = get_property(np, "phy-handle", NULL); 257 ph = of_get_property(np, "phy-handle", NULL);
257 phy = of_find_node_by_phandle(*ph); 258 phy = of_find_node_by_phandle(*ph);
258 259
259 if (phy == NULL) { 260 if (phy == NULL) {
@@ -263,7 +264,7 @@ static int __init gfar_of_init(void)
263 264
264 mdio = of_get_parent(phy); 265 mdio = of_get_parent(phy);
265 266
266 id = get_property(phy, "reg", NULL); 267 id = of_get_property(phy, "reg", NULL);
267 ret = of_address_to_resource(mdio, 0, &res); 268 ret = of_address_to_resource(mdio, 0, &res);
268 if (ret) { 269 if (ret) {
269 of_node_put(phy); 270 of_node_put(phy);
@@ -325,11 +326,11 @@ static int __init fsl_i2c_of_init(void)
325 } 326 }
326 327
327 i2c_data.device_flags = 0; 328 i2c_data.device_flags = 0;
328 flags = get_property(np, "dfsrr", NULL); 329 flags = of_get_property(np, "dfsrr", NULL);
329 if (flags) 330 if (flags)
330 i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR; 331 i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
331 332
332 flags = get_property(np, "fsl5200-clocking", NULL); 333 flags = of_get_property(np, "fsl5200-clocking", NULL);
333 if (flags) 334 if (flags)
334 i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200; 335 i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
335 336
@@ -374,7 +375,7 @@ static int __init mpc83xx_wdt_init(void)
374 goto nosoc; 375 goto nosoc;
375 } 376 }
376 377
377 freq = get_property(soc, "bus-frequency", NULL); 378 freq = of_get_property(soc, "bus-frequency", NULL);
378 if (!freq) { 379 if (!freq) {
379 ret = -ENODEV; 380 ret = -ENODEV;
380 goto err; 381 goto err;
@@ -466,15 +467,15 @@ static int __init fsl_usb_of_init(void)
466 467
467 usb_data.operating_mode = FSL_USB2_MPH_HOST; 468 usb_data.operating_mode = FSL_USB2_MPH_HOST;
468 469
469 prop = get_property(np, "port0", NULL); 470 prop = of_get_property(np, "port0", NULL);
470 if (prop) 471 if (prop)
471 usb_data.port_enables |= FSL_USB2_PORT0_ENABLED; 472 usb_data.port_enables |= FSL_USB2_PORT0_ENABLED;
472 473
473 prop = get_property(np, "port1", NULL); 474 prop = of_get_property(np, "port1", NULL);
474 if (prop) 475 if (prop)
475 usb_data.port_enables |= FSL_USB2_PORT1_ENABLED; 476 usb_data.port_enables |= FSL_USB2_PORT1_ENABLED;
476 477
477 prop = get_property(np, "phy_type", NULL); 478 prop = of_get_property(np, "phy_type", NULL);
478 usb_data.phy_mode = determine_usb_phy(prop); 479 usb_data.phy_mode = determine_usb_phy(prop);
479 480
480 ret = 481 ret =
@@ -501,7 +502,7 @@ static int __init fsl_usb_of_init(void)
501 502
502 of_irq_to_resource(np, 0, &r[1]); 503 of_irq_to_resource(np, 0, &r[1]);
503 504
504 prop = get_property(np, "dr_mode", NULL); 505 prop = of_get_property(np, "dr_mode", NULL);
505 506
506 if (!prop || !strcmp(prop, "host")) { 507 if (!prop || !strcmp(prop, "host")) {
507 usb_data.operating_mode = FSL_USB2_DR_HOST; 508 usb_data.operating_mode = FSL_USB2_DR_HOST;
@@ -538,7 +539,7 @@ static int __init fsl_usb_of_init(void)
538 goto err; 539 goto err;
539 } 540 }
540 541
541 prop = get_property(np, "phy_type", NULL); 542 prop = of_get_property(np, "phy_type", NULL);
542 usb_data.phy_mode = determine_usb_phy(prop); 543 usb_data.phy_mode = determine_usb_phy(prop);
543 544
544 if (usb_dev_dr_host) { 545 if (usb_dev_dr_host) {
@@ -633,7 +634,7 @@ static int __init fs_enet_of_init(void)
633 goto err; 634 goto err;
634 } 635 }
635 636
636 model = get_property(np, "model", NULL); 637 model = of_get_property(np, "model", NULL);
637 if (model == NULL) { 638 if (model == NULL) {
638 ret = -ENODEV; 639 ret = -ENODEV;
639 goto unreg; 640 goto unreg;
@@ -643,7 +644,7 @@ static int __init fs_enet_of_init(void)
643 if (mac_addr) 644 if (mac_addr)
644 memcpy(fs_enet_data.macaddr, mac_addr, 6); 645 memcpy(fs_enet_data.macaddr, mac_addr, 6);
645 646
646 ph = get_property(np, "phy-handle", NULL); 647 ph = of_get_property(np, "phy-handle", NULL);
647 phy = of_find_node_by_phandle(*ph); 648 phy = of_find_node_by_phandle(*ph);
648 649
649 if (phy == NULL) { 650 if (phy == NULL) {
@@ -651,12 +652,12 @@ static int __init fs_enet_of_init(void)
651 goto unreg; 652 goto unreg;
652 } 653 }
653 654
654 phy_addr = get_property(phy, "reg", NULL); 655 phy_addr = of_get_property(phy, "reg", NULL);
655 fs_enet_data.phy_addr = *phy_addr; 656 fs_enet_data.phy_addr = *phy_addr;
656 657
657 phy_irq = get_property(phy, "interrupts", NULL); 658 phy_irq = of_get_property(phy, "interrupts", NULL);
658 659
659 id = get_property(np, "device-id", NULL); 660 id = of_get_property(np, "device-id", NULL);
660 fs_enet_data.fs_no = *id; 661 fs_enet_data.fs_no = *id;
661 strcpy(fs_enet_data.fs_type, model); 662 strcpy(fs_enet_data.fs_type, model);
662 663
@@ -668,8 +669,10 @@ static int __init fs_enet_of_init(void)
668 goto unreg; 669 goto unreg;
669 } 670 }
670 671
671 fs_enet_data.clk_rx = *((u32 *) get_property(np, "rx-clock", NULL)); 672 fs_enet_data.clk_rx = *((u32 *)of_get_property(np,
672 fs_enet_data.clk_tx = *((u32 *) get_property(np, "tx-clock", NULL)); 673 "rx-clock", NULL));
674 fs_enet_data.clk_tx = *((u32 *)of_get_property(np,
675 "tx-clock", NULL));
673 676
674 if (strstr(model, "FCC")) { 677 if (strstr(model, "FCC")) {
675 int fcc_index = *id - 1; 678 int fcc_index = *id - 1;
@@ -690,7 +693,7 @@ static int __init fs_enet_of_init(void)
690 fs_enet_data.bus_id = (char*)&bus_id[(*id)]; 693 fs_enet_data.bus_id = (char*)&bus_id[(*id)];
691 fs_enet_data.init_ioports = init_fcc_ioports; 694 fs_enet_data.init_ioports = init_fcc_ioports;
692 695
693 mdio_bb_prop = get_property(phy, "bitbang", NULL); 696 mdio_bb_prop = of_get_property(phy, "bitbang", NULL);
694 if (mdio_bb_prop) { 697 if (mdio_bb_prop) {
695 struct platform_device *fs_enet_mdio_bb_dev; 698 struct platform_device *fs_enet_mdio_bb_dev;
696 struct fs_mii_bb_platform_info fs_enet_mdio_bb_data; 699 struct fs_mii_bb_platform_info fs_enet_mdio_bb_data;
@@ -796,10 +799,10 @@ static int __init cpm_uart_of_init(void)
796 goto err; 799 goto err;
797 } 800 }
798 801
799 id = get_property(np, "device-id", NULL); 802 id = of_get_property(np, "device-id", NULL);
800 cpm_uart_data.fs_no = *id; 803 cpm_uart_data.fs_no = *id;
801 804
802 model = (char*)get_property(np, "model", NULL); 805 model = of_get_property(np, "model", NULL);
803 strcpy(cpm_uart_data.fs_type, model); 806 strcpy(cpm_uart_data.fs_type, model);
804 807
805 cpm_uart_data.uart_clk = ppc_proc_freq; 808 cpm_uart_data.uart_clk = ppc_proc_freq;
@@ -808,8 +811,10 @@ static int __init cpm_uart_of_init(void)
808 cpm_uart_data.tx_buf_size = 32; 811 cpm_uart_data.tx_buf_size = 32;
809 cpm_uart_data.rx_num_fifo = 4; 812 cpm_uart_data.rx_num_fifo = 4;
810 cpm_uart_data.rx_buf_size = 32; 813 cpm_uart_data.rx_buf_size = 32;
811 cpm_uart_data.clk_rx = *((u32 *) get_property(np, "rx-clock", NULL)); 814 cpm_uart_data.clk_rx = *((u32 *)of_get_property(np,
812 cpm_uart_data.clk_tx = *((u32 *) get_property(np, "tx-clock", NULL)); 815 "rx-clock", NULL));
816 cpm_uart_data.clk_tx = *((u32 *)of_get_property(np,
817 "tx-clock", NULL));
813 818
814 ret = 819 ret =
815 platform_device_add_data(cpm_uart_dev, &cpm_uart_data, 820 platform_device_add_data(cpm_uart_dev, &cpm_uart_data,
@@ -833,7 +838,7 @@ arch_initcall(cpm_uart_of_init);
833#ifdef CONFIG_8xx 838#ifdef CONFIG_8xx
834 839
835extern void init_scc_ioports(struct fs_platform_info*); 840extern void init_scc_ioports(struct fs_platform_info*);
836extern int platform_device_skip(char *model, int id); 841extern int platform_device_skip(const char *model, int id);
837 842
838static int __init fs_enet_mdio_of_init(void) 843static int __init fs_enet_mdio_of_init(void)
839{ 844{
@@ -900,21 +905,22 @@ static int __init fs_enet_of_init(void)
900 struct resource r[4]; 905 struct resource r[4];
901 struct device_node *phy = NULL, *mdio = NULL; 906 struct device_node *phy = NULL, *mdio = NULL;
902 struct fs_platform_info fs_enet_data; 907 struct fs_platform_info fs_enet_data;
903 unsigned int *id, *phy_addr; 908 const unsigned int *id;
909 const unsigned int *phy_addr;
904 void *mac_addr; 910 void *mac_addr;
905 phandle *ph; 911 const phandle *ph;
906 char *model; 912 const char *model;
907 913
908 memset(r, 0, sizeof(r)); 914 memset(r, 0, sizeof(r));
909 memset(&fs_enet_data, 0, sizeof(fs_enet_data)); 915 memset(&fs_enet_data, 0, sizeof(fs_enet_data));
910 916
911 model = (char *)get_property(np, "model", NULL); 917 model = of_get_property(np, "model", NULL);
912 if (model == NULL) { 918 if (model == NULL) {
913 ret = -ENODEV; 919 ret = -ENODEV;
914 goto unreg; 920 goto unreg;
915 } 921 }
916 922
917 id = (u32 *) get_property(np, "device-id", NULL); 923 id = of_get_property(np, "device-id", NULL);
918 fs_enet_data.fs_no = *id; 924 fs_enet_data.fs_no = *id;
919 925
920 if (platform_device_skip(model, *id)) 926 if (platform_device_skip(model, *id))
@@ -929,12 +935,12 @@ static int __init fs_enet_of_init(void)
929 if (mac_addr) 935 if (mac_addr)
930 memcpy(fs_enet_data.macaddr, mac_addr, 6); 936 memcpy(fs_enet_data.macaddr, mac_addr, 6);
931 937
932 ph = (phandle *) get_property(np, "phy-handle", NULL); 938 ph = of_get_property(np, "phy-handle", NULL);
933 if (ph != NULL) 939 if (ph != NULL)
934 phy = of_find_node_by_phandle(*ph); 940 phy = of_find_node_by_phandle(*ph);
935 941
936 if (phy != NULL) { 942 if (phy != NULL) {
937 phy_addr = (u32 *) get_property(phy, "reg", NULL); 943 phy_addr = of_get_property(phy, "reg", NULL);
938 fs_enet_data.phy_addr = *phy_addr; 944 fs_enet_data.phy_addr = *phy_addr;
939 fs_enet_data.has_phy = 1; 945 fs_enet_data.has_phy = 1;
940 946
@@ -947,7 +953,7 @@ static int __init fs_enet_of_init(void)
947 } 953 }
948 } 954 }
949 955
950 model = (char*)get_property(np, "model", NULL); 956 model = of_get_property(np, "model", NULL);
951 strcpy(fs_enet_data.fs_type, model); 957 strcpy(fs_enet_data.fs_type, model);
952 958
953 if (strstr(model, "FEC")) { 959 if (strstr(model, "FEC")) {
@@ -1038,8 +1044,8 @@ static int __init cpm_smc_uart_of_init(void)
1038 i++) { 1044 i++) {
1039 struct resource r[3]; 1045 struct resource r[3];
1040 struct fs_uart_platform_info cpm_uart_data; 1046 struct fs_uart_platform_info cpm_uart_data;
1041 int *id; 1047 const int *id;
1042 char *model; 1048 const char *model;
1043 1049
1044 memset(r, 0, sizeof(r)); 1050 memset(r, 0, sizeof(r));
1045 memset(&cpm_uart_data, 0, sizeof(cpm_uart_data)); 1051 memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
@@ -1066,10 +1072,10 @@ static int __init cpm_smc_uart_of_init(void)
1066 goto err; 1072 goto err;
1067 } 1073 }
1068 1074
1069 model = (char*)get_property(np, "model", NULL); 1075 model = of_get_property(np, "model", NULL);
1070 strcpy(cpm_uart_data.fs_type, model); 1076 strcpy(cpm_uart_data.fs_type, model);
1071 1077
1072 id = (int*)get_property(np, "device-id", NULL); 1078 id = of_get_property(np, "device-id", NULL);
1073 cpm_uart_data.fs_no = *id; 1079 cpm_uart_data.fs_no = *id;
1074 cpm_uart_data.uart_clk = ppc_proc_freq; 1080 cpm_uart_data.uart_clk = ppc_proc_freq;
1075 1081
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index bcfb900481f8..0b84b7c775d8 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -304,7 +304,7 @@ static void __init mpic_test_broken_ipi(struct mpic *mpic)
304 } 304 }
305} 305}
306 306
307#ifdef CONFIG_MPIC_BROKEN_U3 307#ifdef CONFIG_MPIC_U3_HT_IRQS
308 308
309/* Test if an interrupt is sourced from HyperTransport (used on broken U3s) 309/* Test if an interrupt is sourced from HyperTransport (used on broken U3s)
310 * to force the edge setting on the MPIC and do the ack workaround. 310 * to force the edge setting on the MPIC and do the ack workaround.
@@ -476,7 +476,7 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
476 } 476 }
477} 477}
478 478
479#else /* CONFIG_MPIC_BROKEN_U3 */ 479#else /* CONFIG_MPIC_U3_HT_IRQS */
480 480
481static inline int mpic_is_ht_interrupt(struct mpic *mpic, unsigned int source) 481static inline int mpic_is_ht_interrupt(struct mpic *mpic, unsigned int source)
482{ 482{
@@ -487,7 +487,7 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
487{ 487{
488} 488}
489 489
490#endif /* CONFIG_MPIC_BROKEN_U3 */ 490#endif /* CONFIG_MPIC_U3_HT_IRQS */
491 491
492 492
493#define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq) 493#define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
@@ -615,7 +615,7 @@ static void mpic_end_irq(unsigned int irq)
615 mpic_eoi(mpic); 615 mpic_eoi(mpic);
616} 616}
617 617
618#ifdef CONFIG_MPIC_BROKEN_U3 618#ifdef CONFIG_MPIC_U3_HT_IRQS
619 619
620static void mpic_unmask_ht_irq(unsigned int irq) 620static void mpic_unmask_ht_irq(unsigned int irq)
621{ 621{
@@ -665,7 +665,7 @@ static void mpic_end_ht_irq(unsigned int irq)
665 mpic_ht_end_irq(mpic, src); 665 mpic_ht_end_irq(mpic, src);
666 mpic_eoi(mpic); 666 mpic_eoi(mpic);
667} 667}
668#endif /* !CONFIG_MPIC_BROKEN_U3 */ 668#endif /* !CONFIG_MPIC_U3_HT_IRQS */
669 669
670#ifdef CONFIG_SMP 670#ifdef CONFIG_SMP
671 671
@@ -788,7 +788,7 @@ static struct irq_chip mpic_ipi_chip = {
788}; 788};
789#endif /* CONFIG_SMP */ 789#endif /* CONFIG_SMP */
790 790
791#ifdef CONFIG_MPIC_BROKEN_U3 791#ifdef CONFIG_MPIC_U3_HT_IRQS
792static struct irq_chip mpic_irq_ht_chip = { 792static struct irq_chip mpic_irq_ht_chip = {
793 .startup = mpic_startup_ht_irq, 793 .startup = mpic_startup_ht_irq,
794 .shutdown = mpic_shutdown_ht_irq, 794 .shutdown = mpic_shutdown_ht_irq,
@@ -797,7 +797,7 @@ static struct irq_chip mpic_irq_ht_chip = {
797 .eoi = mpic_end_ht_irq, 797 .eoi = mpic_end_ht_irq,
798 .set_type = mpic_set_irq_type, 798 .set_type = mpic_set_irq_type,
799}; 799};
800#endif /* CONFIG_MPIC_BROKEN_U3 */ 800#endif /* CONFIG_MPIC_U3_HT_IRQS */
801 801
802 802
803static int mpic_host_match(struct irq_host *h, struct device_node *node) 803static int mpic_host_match(struct irq_host *h, struct device_node *node)
@@ -837,11 +837,11 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,
837 /* Default chip */ 837 /* Default chip */
838 chip = &mpic->hc_irq; 838 chip = &mpic->hc_irq;
839 839
840#ifdef CONFIG_MPIC_BROKEN_U3 840#ifdef CONFIG_MPIC_U3_HT_IRQS
841 /* Check for HT interrupts, override vecpri */ 841 /* Check for HT interrupts, override vecpri */
842 if (mpic_is_ht_interrupt(mpic, hw)) 842 if (mpic_is_ht_interrupt(mpic, hw))
843 chip = &mpic->hc_ht_irq; 843 chip = &mpic->hc_ht_irq;
844#endif /* CONFIG_MPIC_BROKEN_U3 */ 844#endif /* CONFIG_MPIC_U3_HT_IRQS */
845 845
846 DBG("mpic: mapping to irq chip @%p\n", chip); 846 DBG("mpic: mapping to irq chip @%p\n", chip);
847 847
@@ -937,12 +937,12 @@ struct mpic * __init mpic_alloc(struct device_node *node,
937 mpic->hc_irq.typename = name; 937 mpic->hc_irq.typename = name;
938 if (flags & MPIC_PRIMARY) 938 if (flags & MPIC_PRIMARY)
939 mpic->hc_irq.set_affinity = mpic_set_affinity; 939 mpic->hc_irq.set_affinity = mpic_set_affinity;
940#ifdef CONFIG_MPIC_BROKEN_U3 940#ifdef CONFIG_MPIC_U3_HT_IRQS
941 mpic->hc_ht_irq = mpic_irq_ht_chip; 941 mpic->hc_ht_irq = mpic_irq_ht_chip;
942 mpic->hc_ht_irq.typename = name; 942 mpic->hc_ht_irq.typename = name;
943 if (flags & MPIC_PRIMARY) 943 if (flags & MPIC_PRIMARY)
944 mpic->hc_ht_irq.set_affinity = mpic_set_affinity; 944 mpic->hc_ht_irq.set_affinity = mpic_set_affinity;
945#endif /* CONFIG_MPIC_BROKEN_U3 */ 945#endif /* CONFIG_MPIC_U3_HT_IRQS */
946 946
947#ifdef CONFIG_SMP 947#ifdef CONFIG_SMP
948 mpic->hc_ipi = mpic_ipi_chip; 948 mpic->hc_ipi = mpic_ipi_chip;
@@ -970,7 +970,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
970 mpic->spurious_vec = intvec_top; 970 mpic->spurious_vec = intvec_top;
971 971
972 /* Check for "big-endian" in device-tree */ 972 /* Check for "big-endian" in device-tree */
973 if (node && get_property(node, "big-endian", NULL) != NULL) 973 if (node && of_get_property(node, "big-endian", NULL) != NULL)
974 mpic->flags |= MPIC_BIG_ENDIAN; 974 mpic->flags |= MPIC_BIG_ENDIAN;
975 975
976 976
@@ -986,13 +986,13 @@ struct mpic * __init mpic_alloc(struct device_node *node,
986 BUG_ON(paddr == 0 && node == NULL); 986 BUG_ON(paddr == 0 && node == NULL);
987 987
988 /* If no physical address passed in, check if it's dcr based */ 988 /* If no physical address passed in, check if it's dcr based */
989 if (paddr == 0 && get_property(node, "dcr-reg", NULL) != NULL) 989 if (paddr == 0 && of_get_property(node, "dcr-reg", NULL) != NULL)
990 mpic->flags |= MPIC_USES_DCR; 990 mpic->flags |= MPIC_USES_DCR;
991 991
992#ifdef CONFIG_PPC_DCR 992#ifdef CONFIG_PPC_DCR
993 if (mpic->flags & MPIC_USES_DCR) { 993 if (mpic->flags & MPIC_USES_DCR) {
994 const u32 *dbasep; 994 const u32 *dbasep;
995 dbasep = get_property(node, "dcr-reg", NULL); 995 dbasep = of_get_property(node, "dcr-reg", NULL);
996 BUG_ON(dbasep == NULL); 996 BUG_ON(dbasep == NULL);
997 mpic->dcr_base = *dbasep; 997 mpic->dcr_base = *dbasep;
998 mpic->reg_type = mpic_access_dcr; 998 mpic->reg_type = mpic_access_dcr;
@@ -1006,7 +1006,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1006 */ 1006 */
1007 if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) { 1007 if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) {
1008 const u32 *reg; 1008 const u32 *reg;
1009 reg = get_property(node, "reg", NULL); 1009 reg = of_get_property(node, "reg", NULL);
1010 BUG_ON(reg == NULL); 1010 BUG_ON(reg == NULL);
1011 paddr = of_translate_address(node, reg); 1011 paddr = of_translate_address(node, reg);
1012 BUG_ON(paddr == OF_BAD_ADDR); 1012 BUG_ON(paddr == OF_BAD_ADDR);
@@ -1142,7 +1142,7 @@ void __init mpic_init(struct mpic *mpic)
1142 1142
1143 /* Do the HT PIC fixups on U3 broken mpic */ 1143 /* Do the HT PIC fixups on U3 broken mpic */
1144 DBG("MPIC flags: %x\n", mpic->flags); 1144 DBG("MPIC flags: %x\n", mpic->flags);
1145 if ((mpic->flags & MPIC_BROKEN_U3) && (mpic->flags & MPIC_PRIMARY)) 1145 if ((mpic->flags & MPIC_U3_HT_IRQS) && (mpic->flags & MPIC_PRIMARY))
1146 mpic_scan_ht_pics(mpic); 1146 mpic_scan_ht_pics(mpic);
1147 1147
1148 for (i = 0; i < mpic->num_sources; i++) { 1148 for (i = 0; i < mpic->num_sources; i++) {
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index a5282011d39e..85a7c99c1003 100644
--- a/arch/powerpc/sysdev/pmi.c
+++ b/arch/powerpc/sysdev/pmi.c
@@ -33,7 +33,7 @@
33#include <asm/of_platform.h> 33#include <asm/of_platform.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/pmi.h> 35#include <asm/pmi.h>
36 36#include <asm/prom.h>
37 37
38struct pmi_data { 38struct pmi_data {
39 struct list_head handler; 39 struct list_head handler;
@@ -49,21 +49,6 @@ struct pmi_data {
49}; 49};
50 50
51 51
52
53static void __iomem *of_iomap(struct device_node *np)
54{
55 struct resource res;
56
57 if (of_address_to_resource(np, 0, &res))
58 return NULL;
59
60 pr_debug("Resource start: 0x%lx\n", res.start);
61 pr_debug("Resource end: 0x%lx\n", res.end);
62
63 return ioremap(res.start, 1 + res.end - res.start);
64}
65
66
67static int pmi_irq_handler(int irq, void *dev_id) 52static int pmi_irq_handler(int irq, void *dev_id)
68{ 53{
69 struct pmi_data *data; 54 struct pmi_data *data;
@@ -118,6 +103,7 @@ out:
118 103
119static struct of_device_id pmi_match[] = { 104static struct of_device_id pmi_match[] = {
120 { .type = "ibm,pmi", .name = "ibm,pmi" }, 105 { .type = "ibm,pmi", .name = "ibm,pmi" },
106 { .type = "ibm,pmi" },
121 {}, 107 {},
122}; 108};
123 109
@@ -153,7 +139,7 @@ static int pmi_of_probe(struct of_device *dev,
153 goto out; 139 goto out;
154 } 140 }
155 141
156 data->pmi_reg = of_iomap(np); 142 data->pmi_reg = of_iomap(np, 0);
157 if (!data->pmi_reg) { 143 if (!data->pmi_reg) {
158 printk(KERN_ERR "pmi: invalid register address.\n"); 144 printk(KERN_ERR "pmi: invalid register address.\n");
159 rc = -EFAULT; 145 rc = -EFAULT;
@@ -279,6 +265,9 @@ void pmi_register_handler(struct of_device *device,
279 struct pmi_data *data; 265 struct pmi_data *data;
280 data = device->dev.driver_data; 266 data = device->dev.driver_data;
281 267
268 if (!data)
269 return;
270
282 spin_lock(&data->handler_spinlock); 271 spin_lock(&data->handler_spinlock);
283 list_add_tail(&handler->node, &data->handler); 272 list_add_tail(&handler->node, &data->handler);
284 spin_unlock(&data->handler_spinlock); 273 spin_unlock(&data->handler_spinlock);
@@ -289,10 +278,12 @@ void pmi_unregister_handler(struct of_device *device,
289 struct pmi_handler *handler) 278 struct pmi_handler *handler)
290{ 279{
291 struct pmi_data *data; 280 struct pmi_data *data;
281 data = device->dev.driver_data;
292 282
293 pr_debug("pmi: unregistering handler %p\n", handler); 283 if (!data)
284 return;
294 285
295 data = device->dev.driver_data; 286 pr_debug("pmi: unregistering handler %p\n", handler);
296 287
297 spin_lock(&data->handler_spinlock); 288 spin_lock(&data->handler_spinlock);
298 list_del(&handler->node); 289 list_del(&handler->node);
diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig b/arch/powerpc/sysdev/qe_lib/Kconfig
index a725e80befa8..887739f3badc 100644
--- a/arch/powerpc/sysdev/qe_lib/Kconfig
+++ b/arch/powerpc/sysdev/qe_lib/Kconfig
@@ -2,11 +2,8 @@
2# QE Communication options 2# QE Communication options
3# 3#
4 4
5menu "QE Options"
6 depends on QUICC_ENGINE
7
8config UCC_SLOW 5config UCC_SLOW
9 bool "UCC Slow Protocols Support" 6 bool
10 default n 7 default n
11 select UCC 8 select UCC
12 help 9 help
@@ -14,10 +11,9 @@ config UCC_SLOW
14 protocols: UART, BISYNC, QMC 11 protocols: UART, BISYNC, QMC
15 12
16config UCC_FAST 13config UCC_FAST
17 bool "UCC Fast Protocols Support" 14 bool
18 default n 15 default n
19 select UCC 16 select UCC
20 select UCC_SLOW
21 help 17 help
22 This option provides qe_lib support to UCC fast 18 This option provides qe_lib support to UCC fast
23 protocols: HDLC, Ethernet, ATM, transparent 19 protocols: HDLC, Ethernet, ATM, transparent
@@ -26,5 +22,3 @@ config UCC
26 bool 22 bool
27 default y if UCC_FAST || UCC_SLOW 23 default y if UCC_FAST || UCC_SLOW
28 24
29endmenu
30
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 43f6cc9d7ea0..7f4c07543961 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -71,7 +71,7 @@ phys_addr_t get_qe_base(void)
71 qe = of_find_node_by_type(NULL, "qe"); 71 qe = of_find_node_by_type(NULL, "qe");
72 if (qe) { 72 if (qe) {
73 unsigned int size; 73 unsigned int size;
74 const void *prop = get_property(qe, "reg", &size); 74 const void *prop = of_get_property(qe, "reg", &size);
75 qebase = of_translate_address(qe, prop); 75 qebase = of_translate_address(qe, prop);
76 of_node_put(qe); 76 of_node_put(qe);
77 }; 77 };
@@ -158,7 +158,7 @@ unsigned int get_brg_clk(void)
158 qe = of_find_node_by_type(NULL, "qe"); 158 qe = of_find_node_by_type(NULL, "qe");
159 if (qe) { 159 if (qe) {
160 unsigned int size; 160 unsigned int size;
161 const u32 *prop = get_property(qe, "brg-frequency", &size); 161 const u32 *prop = of_get_property(qe, "brg-frequency", &size);
162 brg_clk = *prop; 162 brg_clk = *prop;
163 of_node_put(qe); 163 of_node_put(qe);
164 }; 164 };
diff --git a/arch/powerpc/sysdev/qe_lib/qe_io.c b/arch/powerpc/sysdev/qe_lib/qe_io.c
index 0afe6bfe3714..e32b45bf9ff5 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_io.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_io.c
@@ -53,7 +53,7 @@ int par_io_init(struct device_node *np)
53 return ret; 53 return ret;
54 par_io = ioremap(res.start, res.end - res.start + 1); 54 par_io = ioremap(res.start, res.end - res.start + 1);
55 55
56 num_ports = get_property(np, "num-ports", NULL); 56 num_ports = of_get_property(np, "num-ports", NULL);
57 if (num_ports) 57 if (num_ports)
58 num_par_io_ports = *num_ports; 58 num_par_io_ports = *num_ports;
59 59
@@ -161,7 +161,7 @@ int par_io_of_config(struct device_node *np)
161 return -1; 161 return -1;
162 } 162 }
163 163
164 ph = get_property(np, "pio-handle", NULL); 164 ph = of_get_property(np, "pio-handle", NULL);
165 if (ph == 0) { 165 if (ph == 0) {
166 printk(KERN_ERR "pio-handle not available \n"); 166 printk(KERN_ERR "pio-handle not available \n");
167 return -1; 167 return -1;
@@ -169,7 +169,7 @@ int par_io_of_config(struct device_node *np)
169 169
170 pio = of_find_node_by_phandle(*ph); 170 pio = of_find_node_by_phandle(*ph);
171 171
172 pio_map = get_property(pio, "pio-map", &pio_map_len); 172 pio_map = of_get_property(pio, "pio-map", &pio_map_len);
173 if (pio_map == NULL) { 173 if (pio_map == NULL) {
174 printk(KERN_ERR "pio-map is not set! \n"); 174 printk(KERN_ERR "pio-map is not set! \n");
175 return -1; 175 return -1;
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
index 817df73ecf56..b930d686a4d1 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
@@ -187,7 +187,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
187 uccs->us_pram = qe_muram_addr(uccs->us_pram_offset); 187 uccs->us_pram = qe_muram_addr(uccs->us_pram_offset);
188 188
189 /* Init Guemr register */ 189 /* Init Guemr register */
190 if ((ret = ucc_init_guemr((struct ucc_common *) (us_info->regs)))) { 190 if ((ret = ucc_init_guemr((struct ucc_common *) us_regs))) {
191 printk(KERN_ERR "%s: cannot init GUEMR", __FUNCTION__); 191 printk(KERN_ERR "%s: cannot init GUEMR", __FUNCTION__);
192 ucc_slow_free(uccs); 192 ucc_slow_free(uccs);
193 return ret; 193 return ret;
@@ -195,7 +195,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
195 195
196 /* Set UCC to slow type */ 196 /* Set UCC to slow type */
197 if ((ret = ucc_set_type(us_info->ucc_num, 197 if ((ret = ucc_set_type(us_info->ucc_num,
198 (struct ucc_common *) (us_info->regs), 198 (struct ucc_common *) us_regs,
199 UCC_SPEED_TYPE_SLOW))) { 199 UCC_SPEED_TYPE_SLOW))) {
200 printk(KERN_ERR "%s: cannot set UCC type", __FUNCTION__); 200 printk(KERN_ERR "%s: cannot set UCC type", __FUNCTION__);
201 ucc_slow_free(uccs); 201 ucc_slow_free(uccs);
diff --git a/arch/powerpc/sysdev/timer.c b/arch/powerpc/sysdev/timer.c
new file mode 100644
index 000000000000..4a01748b4217
--- /dev/null
+++ b/arch/powerpc/sysdev/timer.c
@@ -0,0 +1,71 @@
1/*
2 * Common code to keep time when machine suspends.
3 *
4 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
5 *
6 * GPLv2
7 */
8
9#include <linux/time.h>
10#include <linux/sysdev.h>
11#include <asm/rtc.h>
12
13static unsigned long suspend_rtc_time;
14
15/*
16 * Reset the time after a sleep.
17 */
18static int timer_resume(struct sys_device *dev)
19{
20 struct timeval tv;
21 struct timespec ts;
22 struct rtc_time cur_rtc_tm;
23 unsigned long cur_rtc_time, diff;
24
25 /* get current RTC time and convert to seconds */
26 get_rtc_time(&cur_rtc_tm);
27 rtc_tm_to_time(&cur_rtc_tm, &cur_rtc_time);
28
29 diff = cur_rtc_time - suspend_rtc_time;
30
31 /* adjust time of day by seconds that elapsed while
32 * we were suspended */
33 do_gettimeofday(&tv);
34 ts.tv_sec = tv.tv_sec + diff;
35 ts.tv_nsec = tv.tv_usec * NSEC_PER_USEC;
36 do_settimeofday(&ts);
37
38 return 0;
39}
40
41static int timer_suspend(struct sys_device *dev, pm_message_t state)
42{
43 struct rtc_time suspend_rtc_tm;
44 WARN_ON(!ppc_md.get_rtc_time);
45
46 get_rtc_time(&suspend_rtc_tm);
47 rtc_tm_to_time(&suspend_rtc_tm, &suspend_rtc_time);
48
49 return 0;
50}
51
52static struct sysdev_class timer_sysclass = {
53 .resume = timer_resume,
54 .suspend = timer_suspend,
55 set_kset_name("timer"),
56};
57
58static struct sys_device device_timer = {
59 .id = 0,
60 .cls = &timer_sysclass,
61};
62
63static int time_init_device(void)
64{
65 int error = sysdev_class_register(&timer_sysclass);
66 if (!error)
67 error = sysdev_register(&device_timer);
68 return error;
69}
70
71device_initcall(time_init_device);
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
index 97f37ef4bbbf..337039ee51e6 100644
--- a/arch/powerpc/sysdev/tsi108_dev.c
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -48,7 +48,7 @@ phys_addr_t get_csrbase(void)
48 tsi = of_find_node_by_type(NULL, "tsi-bridge"); 48 tsi = of_find_node_by_type(NULL, "tsi-bridge");
49 if (tsi) { 49 if (tsi) {
50 unsigned int size; 50 unsigned int size;
51 const void *prop = get_property(tsi, "reg", &size); 51 const void *prop = of_get_property(tsi, "reg", &size);
52 tsi108_csr_base = of_translate_address(tsi, prop); 52 tsi108_csr_base = of_translate_address(tsi, prop);
53 of_node_put(tsi); 53 of_node_put(tsi);
54 }; 54 };
@@ -77,10 +77,10 @@ static int __init tsi108_eth_of_init(void)
77 struct resource r[2]; 77 struct resource r[2];
78 struct device_node *phy; 78 struct device_node *phy;
79 hw_info tsi_eth_data; 79 hw_info tsi_eth_data;
80 unsigned int *id; 80 const unsigned int *id;
81 unsigned int *phy_id; 81 const unsigned int *phy_id;
82 const void *mac_addr; 82 const void *mac_addr;
83 phandle *ph; 83 const phandle *ph;
84 84
85 memset(r, 0, sizeof(r)); 85 memset(r, 0, sizeof(r));
86 memset(&tsi_eth_data, 0, sizeof(tsi_eth_data)); 86 memset(&tsi_eth_data, 0, sizeof(tsi_eth_data));
@@ -107,10 +107,10 @@ static int __init tsi108_eth_of_init(void)
107 goto err; 107 goto err;
108 } 108 }
109 109
110 mac_addr = get_property(np, "address", NULL); 110 mac_addr = of_get_property(np, "address", NULL);
111 memcpy(tsi_eth_data.mac_addr, mac_addr, 6); 111 memcpy(tsi_eth_data.mac_addr, mac_addr, 6);
112 112
113 ph = (phandle *) get_property(np, "phy-handle", NULL); 113 ph = of_get_property(np, "phy-handle", NULL);
114 phy = of_find_node_by_phandle(*ph); 114 phy = of_find_node_by_phandle(*ph);
115 115
116 if (phy == NULL) { 116 if (phy == NULL) {
@@ -118,8 +118,8 @@ static int __init tsi108_eth_of_init(void)
118 goto unreg; 118 goto unreg;
119 } 119 }
120 120
121 id = (u32 *) get_property(phy, "reg", NULL); 121 id = of_get_property(phy, "reg", NULL);
122 phy_id = (u32 *) get_property(phy, "phy-id", NULL); 122 phy_id = of_get_property(phy, "phy-id", NULL);
123 ret = of_address_to_resource(phy, 0, &res); 123 ret = of_address_to_resource(phy, 0, &res);
124 if (ret) { 124 if (ret) {
125 of_node_put(phy); 125 of_node_put(phy);
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c
index ae249c6bbbcf..58b9e7f8abf2 100644
--- a/arch/powerpc/sysdev/tsi108_pci.c
+++ b/arch/powerpc/sysdev/tsi108_pci.c
@@ -211,7 +211,7 @@ int __init tsi108_setup_pci(struct device_node *dev)
211 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 211 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
212 212
213 /* Get bus range if any */ 213 /* Get bus range if any */
214 bus_range = get_property(dev, "bus-range", &len); 214 bus_range = of_get_property(dev, "bus-range", &len);
215 if (bus_range == NULL || len < 2 * sizeof(int)) { 215 if (bus_range == NULL || len < 2 * sizeof(int)) {
216 printk(KERN_WARNING "Can't get bus-range for %s, assume" 216 printk(KERN_WARNING "Can't get bus-range for %s, assume"
217 " bus 0\n", dev->full_name); 217 " bus 0\n", dev->full_name);
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
new file mode 100644
index 000000000000..968fb40af9dc
--- /dev/null
+++ b/arch/powerpc/sysdev/uic.c
@@ -0,0 +1,342 @@
1/*
2 * arch/powerpc/sysdev/uic.c
3 *
4 * IBM PowerPC 4xx Universal Interrupt Controller
5 *
6 * Copyright 2007 David Gibson <dwg@au1.ibm.com>, IBM Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/errno.h>
16#include <linux/reboot.h>
17#include <linux/slab.h>
18#include <linux/stddef.h>
19#include <linux/sched.h>
20#include <linux/signal.h>
21#include <linux/sysdev.h>
22#include <linux/device.h>
23#include <linux/bootmem.h>
24#include <linux/spinlock.h>
25#include <linux/irq.h>
26#include <linux/interrupt.h>
27#include <asm/irq.h>
28#include <asm/io.h>
29#include <asm/prom.h>
30#include <asm/dcr.h>
31
32#define NR_UIC_INTS 32
33
34#define UIC_SR 0x0
35#define UIC_ER 0x2
36#define UIC_CR 0x3
37#define UIC_PR 0x4
38#define UIC_TR 0x5
39#define UIC_MSR 0x6
40#define UIC_VR 0x7
41#define UIC_VCR 0x8
42
43#define uic_irq_to_hw(virq) (irq_map[virq].hwirq)
44
45struct uic *primary_uic;
46
47struct uic {
48 int index;
49 int dcrbase;
50
51 spinlock_t lock;
52
53 /* The remapper for this UIC */
54 struct irq_host *irqhost;
55
56 /* For secondary UICs, the cascade interrupt's irqaction */
57 struct irqaction cascade;
58
59 /* The device node of the interrupt controller */
60 struct device_node *of_node;
61};
62
63static void uic_unmask_irq(unsigned int virq)
64{
65 struct uic *uic = get_irq_chip_data(virq);
66 unsigned int src = uic_irq_to_hw(virq);
67 unsigned long flags;
68 u32 er;
69
70 spin_lock_irqsave(&uic->lock, flags);
71 er = mfdcr(uic->dcrbase + UIC_ER);
72 er |= 1 << (31 - src);
73 mtdcr(uic->dcrbase + UIC_ER, er);
74 spin_unlock_irqrestore(&uic->lock, flags);
75}
76
77static void uic_mask_irq(unsigned int virq)
78{
79 struct uic *uic = get_irq_chip_data(virq);
80 unsigned int src = uic_irq_to_hw(virq);
81 unsigned long flags;
82 u32 er;
83
84 spin_lock_irqsave(&uic->lock, flags);
85 er = mfdcr(uic->dcrbase + UIC_ER);
86 er &= ~(1 << (31 - src));
87 mtdcr(uic->dcrbase + UIC_ER, er);
88 spin_unlock_irqrestore(&uic->lock, flags);
89}
90
91static void uic_ack_irq(unsigned int virq)
92{
93 struct uic *uic = get_irq_chip_data(virq);
94 unsigned int src = uic_irq_to_hw(virq);
95 unsigned long flags;
96
97 spin_lock_irqsave(&uic->lock, flags);
98 mtdcr(uic->dcrbase + UIC_SR, 1 << (31-src));
99 spin_unlock_irqrestore(&uic->lock, flags);
100}
101
102static int uic_set_irq_type(unsigned int virq, unsigned int flow_type)
103{
104 struct uic *uic = get_irq_chip_data(virq);
105 unsigned int src = uic_irq_to_hw(virq);
106 struct irq_desc *desc = get_irq_desc(virq);
107 unsigned long flags;
108 int trigger, polarity;
109 u32 tr, pr, mask;
110
111 switch (flow_type & IRQ_TYPE_SENSE_MASK) {
112 case IRQ_TYPE_NONE:
113 uic_mask_irq(virq);
114 return 0;
115
116 case IRQ_TYPE_EDGE_RISING:
117 trigger = 1; polarity = 1;
118 break;
119 case IRQ_TYPE_EDGE_FALLING:
120 trigger = 1; polarity = 0;
121 break;
122 case IRQ_TYPE_LEVEL_HIGH:
123 trigger = 0; polarity = 1;
124 break;
125 case IRQ_TYPE_LEVEL_LOW:
126 trigger = 0; polarity = 0;
127 break;
128 default:
129 return -EINVAL;
130 }
131
132 mask = ~(1 << (31 - src));
133
134 spin_lock_irqsave(&uic->lock, flags);
135 tr = mfdcr(uic->dcrbase + UIC_TR);
136 pr = mfdcr(uic->dcrbase + UIC_PR);
137 tr = (tr & mask) | (trigger << (31-src));
138 pr = (pr & mask) | (polarity << (31-src));
139
140 mtdcr(uic->dcrbase + UIC_PR, pr);
141 mtdcr(uic->dcrbase + UIC_TR, tr);
142
143 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
144 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
145 if (trigger)
146 desc->status |= IRQ_LEVEL;
147
148 spin_unlock_irqrestore(&uic->lock, flags);
149
150 return 0;
151}
152
153static struct irq_chip uic_irq_chip = {
154 .typename = " UIC ",
155 .unmask = uic_unmask_irq,
156 .mask = uic_mask_irq,
157/* .mask_ack = uic_mask_irq_and_ack, */
158 .ack = uic_ack_irq,
159 .set_type = uic_set_irq_type,
160};
161
162static int uic_host_match(struct irq_host *h, struct device_node *node)
163{
164 struct uic *uic = h->host_data;
165 return uic->of_node == node;
166}
167
168static int uic_host_map(struct irq_host *h, unsigned int virq,
169 irq_hw_number_t hw)
170{
171 struct uic *uic = h->host_data;
172
173 set_irq_chip_data(virq, uic);
174 /* Despite the name, handle_level_irq() works for both level
175 * and edge irqs on UIC. FIXME: check this is correct */
176 set_irq_chip_and_handler(virq, &uic_irq_chip, handle_level_irq);
177
178 /* Set default irq type */
179 set_irq_type(virq, IRQ_TYPE_NONE);
180
181 return 0;
182}
183
184static int uic_host_xlate(struct irq_host *h, struct device_node *ct,
185 u32 *intspec, unsigned int intsize,
186 irq_hw_number_t *out_hwirq, unsigned int *out_type)
187
188{
189 /* UIC intspecs must have 2 cells */
190 BUG_ON(intsize != 2);
191 *out_hwirq = intspec[0];
192 *out_type = intspec[1];
193 return 0;
194}
195
196static struct irq_host_ops uic_host_ops = {
197 .match = uic_host_match,
198 .map = uic_host_map,
199 .xlate = uic_host_xlate,
200};
201
202irqreturn_t uic_cascade(int virq, void *data)
203{
204 struct uic *uic = data;
205 u32 msr;
206 int src;
207 int subvirq;
208
209 msr = mfdcr(uic->dcrbase + UIC_MSR);
210 src = 32 - ffs(msr);
211
212 subvirq = irq_linear_revmap(uic->irqhost, src);
213 generic_handle_irq(subvirq);
214
215 return IRQ_HANDLED;
216}
217
218static struct uic * __init uic_init_one(struct device_node *node)
219{
220 struct uic *uic;
221 const u32 *indexp, *dcrreg;
222 int len;
223
224 BUG_ON(! device_is_compatible(node, "ibm,uic"));
225
226 uic = alloc_bootmem(sizeof(*uic));
227 if (! uic)
228 return NULL; /* FIXME: panic? */
229
230 memset(uic, 0, sizeof(*uic));
231 spin_lock_init(&uic->lock);
232 uic->of_node = of_node_get(node);
233 indexp = of_get_property(node, "cell-index", &len);
234 if (!indexp || (len != sizeof(u32))) {
235 printk(KERN_ERR "uic: Device node %s has missing or invalid "
236 "cell-index property\n", node->full_name);
237 return NULL;
238 }
239 uic->index = *indexp;
240
241 dcrreg = of_get_property(node, "dcr-reg", &len);
242 if (!dcrreg || (len != 2*sizeof(u32))) {
243 printk(KERN_ERR "uic: Device node %s has missing or invalid "
244 "dcr-reg property\n", node->full_name);
245 return NULL;
246 }
247 uic->dcrbase = *dcrreg;
248
249 uic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, NR_UIC_INTS,
250 &uic_host_ops, -1);
251 if (! uic->irqhost) {
252 of_node_put(node);
253 return NULL; /* FIXME: panic? */
254 }
255
256 uic->irqhost->host_data = uic;
257
258 /* Start with all interrupts disabled, level and non-critical */
259 mtdcr(uic->dcrbase + UIC_ER, 0);
260 mtdcr(uic->dcrbase + UIC_CR, 0);
261 mtdcr(uic->dcrbase + UIC_TR, 0);
262 /* Clear any pending interrupts, in case the firmware left some */
263 mtdcr(uic->dcrbase + UIC_SR, 0xffffffff);
264
265 printk ("UIC%d (%d IRQ sources) at DCR 0x%x\n", uic->index,
266 NR_UIC_INTS, uic->dcrbase);
267
268 return uic;
269}
270
271void __init uic_init_tree(void)
272{
273 struct device_node *np;
274 struct uic *uic;
275 const u32 *interrupts;
276
277 /* First locate and initialize the top-level UIC */
278
279 np = of_find_compatible_node(NULL, NULL, "ibm,uic");
280 while (np) {
281 interrupts = of_get_property(np, "interrupts", NULL);
282 if (! interrupts)
283 break;
284
285 np = of_find_compatible_node(np, NULL, "ibm,uic");
286 }
287
288 BUG_ON(!np); /* uic_init_tree() assumes there's a UIC as the
289 * top-level interrupt controller */
290 primary_uic = uic_init_one(np);
291 if (! primary_uic)
292 panic("Unable to initialize primary UIC %s\n", np->full_name);
293
294 irq_set_default_host(primary_uic->irqhost);
295 of_node_put(np);
296
297 /* The scan again for cascaded UICs */
298 np = of_find_compatible_node(NULL, NULL, "ibm,uic");
299 while (np) {
300 interrupts = of_get_property(np, "interrupts", NULL);
301 if (interrupts) {
302 /* Secondary UIC */
303 int cascade_virq;
304 int ret;
305
306 uic = uic_init_one(np);
307 if (! uic)
308 panic("Unable to initialize a secondary UIC %s\n",
309 np->full_name);
310
311 cascade_virq = irq_of_parse_and_map(np, 0);
312
313 uic->cascade.handler = uic_cascade;
314 uic->cascade.name = "UIC cascade";
315 uic->cascade.dev_id = uic;
316
317 ret = setup_irq(cascade_virq, &uic->cascade);
318 if (ret)
319 printk(KERN_ERR "Failed to setup_irq(%d) for "
320 "UIC%d cascade\n", cascade_virq,
321 uic->index);
322
323 /* FIXME: setup critical cascade?? */
324 }
325
326 np = of_find_compatible_node(np, NULL, "ibm,uic");
327 }
328}
329
330/* Return an interrupt vector or NO_IRQ if no interrupt is pending. */
331unsigned int uic_get_irq(void)
332{
333 u32 msr;
334 int src;
335
336 BUG_ON(! primary_uic);
337
338 msr = mfdcr(primary_uic->dcrbase + UIC_MSR);
339 src = 32 - ffs(msr);
340
341 return irq_linear_revmap(primary_uic->irqhost, src);
342}
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index bf299b66f3fc..b481db1dacb4 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -330,18 +330,17 @@ static void release_output_lock(void)
330static int xmon_core(struct pt_regs *regs, int fromipi) 330static int xmon_core(struct pt_regs *regs, int fromipi)
331{ 331{
332 int cmd = 0; 332 int cmd = 0;
333 unsigned long msr;
334 struct bpt *bp; 333 struct bpt *bp;
335 long recurse_jmp[JMP_BUF_LEN]; 334 long recurse_jmp[JMP_BUF_LEN];
336 unsigned long offset; 335 unsigned long offset;
336 unsigned long flags;
337#ifdef CONFIG_SMP 337#ifdef CONFIG_SMP
338 int cpu; 338 int cpu;
339 int secondary; 339 int secondary;
340 unsigned long timeout; 340 unsigned long timeout;
341#endif 341#endif
342 342
343 msr = mfmsr(); 343 local_irq_save(flags);
344 mtmsr(msr & ~MSR_EE); /* disable interrupts */
345 344
346 bp = in_breakpoint_table(regs->nip, &offset); 345 bp = in_breakpoint_table(regs->nip, &offset);
347 if (bp != NULL) { 346 if (bp != NULL) {
@@ -516,7 +515,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
516 515
517 insert_cpu_bpts(); 516 insert_cpu_bpts();
518 517
519 mtmsr(msr); /* restore interrupt enable */ 518 local_irq_restore(flags);
520 519
521 return cmd != 'X' && cmd != EOF; 520 return cmd != 'X' && cmd != EOF;
522} 521}
@@ -1360,8 +1359,12 @@ static void print_bug_trap(struct pt_regs *regs)
1360 if (is_warning_bug(bug)) 1359 if (is_warning_bug(bug))
1361 return; 1360 return;
1362 1361
1362#ifdef CONFIG_DEBUG_BUGVERBOSE
1363 printf("kernel BUG at %s:%u!\n", 1363 printf("kernel BUG at %s:%u!\n",
1364 bug->file, bug->line); 1364 bug->file, bug->line);
1365#else
1366 printf("kernel BUG at %p!\n", (void *)bug->bug_addr);
1367#endif
1365} 1368}
1366 1369
1367void excprint(struct pt_regs *fp) 1370void excprint(struct pt_regs *fp)