aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2008-10-17 12:20:26 -0400
committerArjan van de Ven <arjan@linux.intel.com>2008-10-17 12:20:26 -0400
commit651dab4264e4ba0e563f5ff56f748127246e9065 (patch)
tree016630974bdcb00fe529b673f96d389e0fd6dc94 /arch/powerpc
parent40b8606253552109815786e5d4b0de98782d31f5 (diff)
parent2e532d68a2b3e2aa6b19731501222069735c741c (diff)
Merge commit 'linus/master' into merge-linus
Conflicts: arch/x86/kvm/i8254.c
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig19
-rw-r--r--arch/powerpc/Kconfig.debug5
-rw-r--r--arch/powerpc/Makefile7
-rw-r--r--arch/powerpc/boot/Makefile7
-rw-r--r--arch/powerpc/boot/addnote.c144
-rw-r--r--arch/powerpc/boot/dtc-src/Makefile.dtc18
-rw-r--r--arch/powerpc/boot/dtc-src/checks.c305
-rw-r--r--arch/powerpc/boot/dtc-src/data.c62
-rw-r--r--arch/powerpc/boot/dtc-src/dtc-lexer.l120
-rw-r--r--arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped445
-rw-r--r--arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped387
-rw-r--r--arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped12
-rw-r--r--arch/powerpc/boot/dtc-src/dtc-parser.y67
-rw-r--r--arch/powerpc/boot/dtc-src/dtc.c41
-rw-r--r--arch/powerpc/boot/dtc-src/dtc.h43
-rw-r--r--arch/powerpc/boot/dtc-src/flattree.c232
-rw-r--r--arch/powerpc/boot/dtc-src/fstree.c8
-rw-r--r--arch/powerpc/boot/dtc-src/libfdt_env.h23
-rw-r--r--arch/powerpc/boot/dtc-src/livetree.c9
-rw-r--r--arch/powerpc/boot/dtc-src/srcpos.c121
-rw-r--r--arch/powerpc/boot/dtc-src/srcpos.h30
-rw-r--r--arch/powerpc/boot/dtc-src/treesource.c15
-rw-r--r--arch/powerpc/boot/dtc-src/version_gen.h2
-rw-r--r--arch/powerpc/boot/dts/arches.dts293
-rw-r--r--arch/powerpc/boot/dts/asp834x-redboot.dts4
-rw-r--r--arch/powerpc/boot/dts/gef_sbc610.dts293
-rw-r--r--arch/powerpc/boot/dts/glacier.dts2
-rw-r--r--arch/powerpc/boot/dts/holly.dts106
-rw-r--r--arch/powerpc/boot/dts/mgcoge.dts174
-rw-r--r--arch/powerpc/boot/dts/mgsuvd.dts163
-rw-r--r--arch/powerpc/boot/dts/mpc5121ads.dts3
-rw-r--r--arch/powerpc/boot/dts/mpc8313erdb.dts7
-rw-r--r--arch/powerpc/boot/dts/mpc8315erdb.dts7
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts7
-rw-r--r--arch/powerpc/boot/dts/mpc832x_rdb.dts7
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts10
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitxgp.dts7
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts10
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts30
-rw-r--r--arch/powerpc/boot/dts/mpc836x_rdk.dts19
-rw-r--r--arch/powerpc/boot/dts/mpc8377_mds.dts14
-rw-r--r--arch/powerpc/boot/dts/mpc8377_rdb.dts7
-rw-r--r--arch/powerpc/boot/dts/mpc8378_mds.dts14
-rw-r--r--arch/powerpc/boot/dts/mpc8378_rdb.dts7
-rw-r--r--arch/powerpc/boot/dts/mpc8379_mds.dts14
-rw-r--r--arch/powerpc/boot/dts/mpc8379_rdb.dts7
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8610_hpcd.dts20
-rw-r--r--arch/powerpc/boot/dts/sbc8349.dts7
-rw-r--r--arch/powerpc/boot/dts/sequoia.dts9
-rw-r--r--arch/powerpc/boot/dts/yosemite.dts2
-rw-r--r--arch/powerpc/boot/elf_util.c6
-rw-r--r--arch/powerpc/boot/libfdt/Makefile.libfdt8
-rw-r--r--arch/powerpc/boot/libfdt/fdt.c61
-rw-r--r--arch/powerpc/boot/libfdt/fdt_ro.c329
-rw-r--r--arch/powerpc/boot/libfdt/fdt_rw.c200
-rw-r--r--arch/powerpc/boot/libfdt/fdt_strerror.c34
-rw-r--r--arch/powerpc/boot/libfdt/fdt_sw.c55
-rw-r--r--arch/powerpc/boot/libfdt/fdt_wip.c9
-rw-r--r--arch/powerpc/boot/libfdt/libfdt.h383
-rw-r--r--arch/powerpc/boot/libfdt/libfdt_internal.h24
-rw-r--r--arch/powerpc/boot/libfdt_env.h1
-rwxr-xr-xarch/powerpc/boot/wrapper4
-rw-r--r--arch/powerpc/configs/44x/arches_defconfig767
-rw-r--r--arch/powerpc/configs/83xx/asp8347_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc8313_rdb_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc8315_rdb_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc832x_mds_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc832x_rdb_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc834x_itx_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc834x_mds_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc836x_mds_defconfig83
-rw-r--r--arch/powerpc/configs/83xx/mpc836x_rdk_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc837x_mds_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/mpc837x_rdb_defconfig4
-rw-r--r--arch/powerpc/configs/83xx/sbc834x_defconfig4
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc610_defconfig1657
-rw-r--r--arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig (renamed from arch/powerpc/configs/mpc8610_hpcd_defconfig)4
-rw-r--r--arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig (renamed from arch/powerpc/configs/mpc8641_hpcn_defconfig)4
-rw-r--r--arch/powerpc/configs/86xx/sbc8641d_defconfig (renamed from arch/powerpc/configs/sbc8641d_defconfig)4
-rw-r--r--arch/powerpc/configs/ep8248e_defconfig4
-rw-r--r--arch/powerpc/configs/mgcoge_defconfig900
-rw-r--r--arch/powerpc/configs/mgsuvd_defconfig872
-rw-r--r--arch/powerpc/configs/mpc8272_ads_defconfig4
-rw-r--r--arch/powerpc/configs/mpc83xx_defconfig4
-rw-r--r--arch/powerpc/configs/mpc86xx_defconfig1646
-rw-r--r--arch/powerpc/configs/pq2fads_defconfig4
-rw-r--r--arch/powerpc/include/asm/a.out.h20
-rw-r--r--arch/powerpc/include/asm/cputable.h10
-rw-r--r--arch/powerpc/include/asm/dcr-regs.h11
-rw-r--r--arch/powerpc/include/asm/device.h3
-rw-r--r--arch/powerpc/include/asm/dma-mapping.h187
-rw-r--r--arch/powerpc/include/asm/elf.h11
-rw-r--r--arch/powerpc/include/asm/exception.h42
-rw-r--r--arch/powerpc/include/asm/fsl_lbc.h48
-rw-r--r--arch/powerpc/include/asm/highmem.h2
-rw-r--r--arch/powerpc/include/asm/io.h2
-rw-r--r--arch/powerpc/include/asm/irq.h18
-rw-r--r--arch/powerpc/include/asm/kvm_host.h14
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h12
-rw-r--r--arch/powerpc/include/asm/machdep.h5
-rw-r--r--arch/powerpc/include/asm/mman.h2
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h2
-rw-r--r--arch/powerpc/include/asm/mpic.h4
-rw-r--r--arch/powerpc/include/asm/msi_bitmap.h35
-rw-r--r--arch/powerpc/include/asm/of_device.h3
-rw-r--r--arch/powerpc/include/asm/of_platform.h3
-rw-r--r--arch/powerpc/include/asm/paca.h2
-rw-r--r--arch/powerpc/include/asm/page.h14
-rw-r--r--arch/powerpc/include/asm/page_32.h8
-rw-r--r--arch/powerpc/include/asm/pci.h14
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc32.h72
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h12
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h2
-rw-r--r--arch/powerpc/include/asm/reg_booke.h7
-rw-r--r--arch/powerpc/include/asm/sections.h19
-rw-r--r--arch/powerpc/include/asm/sfp-machine.h (renamed from arch/powerpc/math-emu/sfp-machine.h)114
-rw-r--r--arch/powerpc/include/asm/siginfo.h5
-rw-r--r--arch/powerpc/include/asm/smp.h42
-rw-r--r--arch/powerpc/include/asm/statfs.h54
-rw-r--r--arch/powerpc/include/asm/systbl.h2
-rw-r--r--arch/powerpc/include/asm/tlbflush.h13
-rw-r--r--arch/powerpc/include/asm/types.h9
-rw-r--r--arch/powerpc/kernel/.gitignore1
-rw-r--r--arch/powerpc/kernel/Makefile9
-rw-r--r--arch/powerpc/kernel/asm-offsets.c7
-rw-r--r--arch/powerpc/kernel/btext.c34
-rw-r--r--arch/powerpc/kernel/cpu_setup_ppc970.S4
-rw-r--r--arch/powerpc/kernel/cputable.c24
-rw-r--r--arch/powerpc/kernel/dma-iommu.c (renamed from arch/powerpc/kernel/dma_64.c)101
-rw-r--r--arch/powerpc/kernel/dma.c131
-rw-r--r--arch/powerpc/kernel/entry_64.S69
-rw-r--r--arch/powerpc/kernel/head_32.S10
-rw-r--r--arch/powerpc/kernel/head_64.S473
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S26
-rw-r--r--arch/powerpc/kernel/idle.c6
-rw-r--r--arch/powerpc/kernel/iommu.c23
-rw-r--r--arch/powerpc/kernel/irq.c169
-rw-r--r--arch/powerpc/kernel/kgdb.c5
-rw-r--r--arch/powerpc/kernel/lparcfg.c8
-rw-r--r--arch/powerpc/kernel/misc.S10
-rw-r--r--arch/powerpc/kernel/misc_32.S62
-rw-r--r--arch/powerpc/kernel/misc_64.S8
-rw-r--r--arch/powerpc/kernel/module_64.c8
-rw-r--r--arch/powerpc/kernel/of_device.c2
-rw-r--r--arch/powerpc/kernel/paca.c3
-rw-r--r--arch/powerpc/kernel/pci-common.c216
-rw-r--r--arch/powerpc/kernel/pci_32.c18
-rw-r--r--arch/powerpc/kernel/pci_64.c49
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c3
-rw-r--r--arch/powerpc/kernel/prom.c43
-rw-r--r--arch/powerpc/kernel/prom_init.c29
-rw-r--r--arch/powerpc/kernel/reloc_64.S87
-rw-r--r--arch/powerpc/kernel/setup-common.c17
-rw-r--r--arch/powerpc/kernel/setup_32.c13
-rw-r--r--arch/powerpc/kernel/setup_64.c9
-rw-r--r--arch/powerpc/kernel/smp.c4
-rw-r--r--arch/powerpc/kernel/softemu8xx.c1
-rw-r--r--arch/powerpc/kernel/swsusp_asm64.S2
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c107
-rw-r--r--arch/powerpc/kernel/sysfs.c119
-rw-r--r--arch/powerpc/kernel/traps.c1
-rw-r--r--arch/powerpc/kernel/vio.c2
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S18
-rw-r--r--arch/powerpc/kvm/44x_tlb.c53
-rw-r--r--arch/powerpc/kvm/Kconfig11
-rw-r--r--arch/powerpc/kvm/Makefile6
-rw-r--r--arch/powerpc/kvm/booke_guest.c17
-rw-r--r--arch/powerpc/kvm/booke_interrupts.S79
-rw-r--r--arch/powerpc/kvm/emulate.c8
-rw-r--r--arch/powerpc/kvm/powerpc.c99
-rw-r--r--arch/powerpc/lib/copypage_64.S198
-rw-r--r--arch/powerpc/lib/dma-noncoherent.c2
-rw-r--r--arch/powerpc/math-emu/Makefile7
-rw-r--r--arch/powerpc/math-emu/double.h129
-rw-r--r--arch/powerpc/math-emu/fadd.c17
-rw-r--r--arch/powerpc/math-emu/fadds.c20
-rw-r--r--arch/powerpc/math-emu/fcmpo.c10
-rw-r--r--arch/powerpc/math-emu/fcmpu.c10
-rw-r--r--arch/powerpc/math-emu/fctiw.c8
-rw-r--r--arch/powerpc/math-emu/fctiwz.c8
-rw-r--r--arch/powerpc/math-emu/fdiv.c14
-rw-r--r--arch/powerpc/math-emu/fdivs.c16
-rw-r--r--arch/powerpc/math-emu/fmadd.c16
-rw-r--r--arch/powerpc/math-emu/fmadds.c18
-rw-r--r--arch/powerpc/math-emu/fmsub.c16
-rw-r--r--arch/powerpc/math-emu/fmsubs.c18
-rw-r--r--arch/powerpc/math-emu/fmul.c14
-rw-r--r--arch/powerpc/math-emu/fmuls.c16
-rw-r--r--arch/powerpc/math-emu/fnmadd.c16
-rw-r--r--arch/powerpc/math-emu/fnmadds.c18
-rw-r--r--arch/powerpc/math-emu/fnmsub.c16
-rw-r--r--arch/powerpc/math-emu/fnmsubs.c18
-rw-r--r--arch/powerpc/math-emu/frsp.c14
-rw-r--r--arch/powerpc/math-emu/fsel.c8
-rw-r--r--arch/powerpc/math-emu/fsqrt.c12
-rw-r--r--arch/powerpc/math-emu/fsqrts.c14
-rw-r--r--arch/powerpc/math-emu/fsub.c14
-rw-r--r--arch/powerpc/math-emu/fsubs.c16
-rw-r--r--arch/powerpc/math-emu/lfd.c4
-rw-r--r--arch/powerpc/math-emu/lfs.c19
-rw-r--r--arch/powerpc/math-emu/math.c8
-rw-r--r--arch/powerpc/math-emu/mcrfs.c3
-rw-r--r--arch/powerpc/math-emu/mffs.c3
-rw-r--r--arch/powerpc/math-emu/mtfsb0.c3
-rw-r--r--arch/powerpc/math-emu/mtfsb1.c3
-rw-r--r--arch/powerpc/math-emu/mtfsf.c20
-rw-r--r--arch/powerpc/math-emu/mtfsfi.c3
-rw-r--r--arch/powerpc/math-emu/op-1.h245
-rw-r--r--arch/powerpc/math-emu/op-2.h434
-rw-r--r--arch/powerpc/math-emu/op-4.h317
-rw-r--r--arch/powerpc/math-emu/op-common.h688
-rw-r--r--arch/powerpc/math-emu/single.h66
-rw-r--r--arch/powerpc/math-emu/soft-fp.h104
-rw-r--r--arch/powerpc/math-emu/stfs.c19
-rw-r--r--arch/powerpc/math-emu/types.c51
-rw-r--r--arch/powerpc/math-emu/udivmodti4.c2
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c5
-rw-r--r--arch/powerpc/mm/gup.c7
-rw-r--r--arch/powerpc/mm/hash_low_32.S122
-rw-r--r--arch/powerpc/mm/hash_utils_64.c8
-rw-r--r--arch/powerpc/mm/hugetlbpage.c59
-rw-r--r--arch/powerpc/mm/init_64.c4
-rw-r--r--arch/powerpc/mm/mem.c5
-rw-r--r--arch/powerpc/mm/numa.c185
-rw-r--r--arch/powerpc/mm/pgtable_32.c4
-rw-r--r--arch/powerpc/mm/tlb_32.c1
-rw-r--r--arch/powerpc/oprofile/cell/vma_map.c2
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c4
-rw-r--r--arch/powerpc/platforms/44x/Kconfig42
-rw-r--r--arch/powerpc/platforms/44x/Makefile8
-rw-r--r--arch/powerpc/platforms/44x/bamboo.c62
-rw-r--r--arch/powerpc/platforms/44x/canyonlands.c63
-rw-r--r--arch/powerpc/platforms/44x/katmai.c62
-rw-r--r--arch/powerpc/platforms/44x/ppc44x_simple.c88
-rw-r--r--arch/powerpc/platforms/44x/rainier.c62
-rw-r--r--arch/powerpc/platforms/44x/sequoia.c63
-rw-r--r--arch/powerpc/platforms/44x/taishan.c72
-rw-r--r--arch/powerpc/platforms/512x/Kconfig2
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_ads.c10
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c5
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pci.c13
-rw-r--r--arch/powerpc/platforms/82xx/Kconfig8
-rw-r--r--arch/powerpc/platforms/82xx/Makefile1
-rw-r--r--arch/powerpc/platforms/82xx/ep8248e.c2
-rw-r--r--arch/powerpc/platforms/82xx/mgcoge.c129
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig5
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_mds.c8
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c1
-rw-r--r--arch/powerpc/platforms/85xx/sbc8560.c3
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig9
-rw-r--r--arch/powerpc/platforms/86xx/Makefile1
-rw-r--r--arch/powerpc/platforms/86xx/gef_pic.c258
-rw-r--r--arch/powerpc/platforms/86xx/gef_pic.h11
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c221
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c1
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c8
-rw-r--r--arch/powerpc/platforms/86xx/sbc8641d.c8
-rw-r--r--arch/powerpc/platforms/8xx/Kconfig6
-rw-r--r--arch/powerpc/platforms/8xx/Makefile1
-rw-r--r--arch/powerpc/platforms/8xx/mgsuvd.c92
-rw-r--r--arch/powerpc/platforms/Kconfig21
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype18
-rw-r--r--arch/powerpc/platforms/cell/iommu.c6
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c13
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c29
-rw-r--r--arch/powerpc/platforms/chrp/pci.c4
-rw-r--r--arch/powerpc/platforms/chrp/setup.c1
-rw-r--r--arch/powerpc/platforms/chrp/time.c24
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c1
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c12
-rw-r--r--arch/powerpc/platforms/iseries/exception.S23
-rw-r--r--arch/powerpc/platforms/iseries/mf.c26
-rw-r--r--arch/powerpc/platforms/maple/setup.c1
-rw-r--r--arch/powerpc/platforms/maple/time.c24
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c6
-rw-r--r--arch/powerpc/platforms/powermac/feature.c2
-rw-r--r--arch/powerpc/platforms/powermac/setup.c1
-rw-r--r--arch/powerpc/platforms/powermac/smp.c4
-rw-r--r--arch/powerpc/platforms/powermac/time.c3
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c2
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c4
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c2
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c6
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c26
-rw-r--r--arch/powerpc/platforms/pseries/setup.c1
-rw-r--r--arch/powerpc/platforms/pseries/smp.c32
-rw-r--r--arch/powerpc/platforms/pseries/xics.c550
-rw-r--r--arch/powerpc/platforms/pseries/xics.h12
-rw-r--r--arch/powerpc/sysdev/Kconfig6
-rw-r--r--arch/powerpc/sysdev/Makefile5
-rw-r--r--arch/powerpc/sysdev/cpm1.c74
-rw-r--r--arch/powerpc/sysdev/fsl_lbc.c53
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c109
-rw-r--r--arch/powerpc/sysdev/fsl_msi.h8
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c58
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c85
-rw-r--r--arch/powerpc/sysdev/fsl_soc.h8
-rw-r--r--arch/powerpc/sysdev/mpc8xxx_gpio.c171
-rw-r--r--arch/powerpc/sysdev/mpic.h2
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c123
-rw-r--r--arch/powerpc/sysdev/mpic_pasemi_msi.c24
-rw-r--r--arch/powerpc/sysdev/mpic_u3msi.c22
-rw-r--r--arch/powerpc/sysdev/msi_bitmap.c247
-rw-r--r--arch/powerpc/sysdev/mv64x60_dev.c6
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c48
-rw-r--r--arch/powerpc/sysdev/qe_lib/Kconfig9
310 files changed, 13291 insertions, 6539 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 587da5e0990f..380baa1780e9 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -22,6 +22,9 @@ config WORD_SIZE
22config PPC_MERGE 22config PPC_MERGE
23 def_bool y 23 def_bool y
24 24
25config ARCH_PHYS_ADDR_T_64BIT
26 def_bool PPC64 || PHYS_64BIT
27
25config MMU 28config MMU
26 bool 29 bool
27 default y 30 default y
@@ -415,8 +418,11 @@ config PPC_64K_PAGES
415 418
416config FORCE_MAX_ZONEORDER 419config FORCE_MAX_ZONEORDER
417 int "Maximum zone order" 420 int "Maximum zone order"
421 range 9 64 if PPC_64K_PAGES
418 default "9" if PPC_64K_PAGES 422 default "9" if PPC_64K_PAGES
423 range 13 64 if PPC64 && !PPC_64K_PAGES
419 default "13" if PPC64 && !PPC_64K_PAGES 424 default "13" if PPC64 && !PPC_64K_PAGES
425 range 11 64
420 default "11" 426 default "11"
421 help 427 help
422 The kernel memory allocator divides physically contiguous memory 428 The kernel memory allocator divides physically contiguous memory
@@ -806,6 +812,19 @@ config PIN_TLB
806endmenu 812endmenu
807 813
808if PPC64 814if PPC64
815config RELOCATABLE
816 bool "Build a relocatable kernel"
817 help
818 This builds a kernel image that is capable of running anywhere
819 in the RMA (real memory area) at any 16k-aligned base address.
820 The kernel is linked as a position-independent executable (PIE)
821 and contains dynamic relocations which are processed early
822 in the bootup process.
823
824 One use is for the kexec on panic case where the recovery kernel
825 must live at a different physical address than the primary
826 kernel.
827
809config PAGE_OFFSET 828config PAGE_OFFSET
810 hex 829 hex
811 default "0xc000000000000000" 830 default "0xc000000000000000"
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 4ebc52a19f0a..15eb27861fc7 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -51,6 +51,11 @@ config FTR_FIXUP_SELFTEST
51 depends on DEBUG_KERNEL 51 depends on DEBUG_KERNEL
52 default n 52 default n
53 53
54config MSI_BITMAP_SELFTEST
55 bool "Run self-tests of the MSI bitmap code."
56 depends on DEBUG_KERNEL
57 default n
58
54config XMON 59config XMON
55 bool "Include xmon kernel debugger" 60 bool "Include xmon kernel debugger"
56 depends on DEBUG_KERNEL 61 depends on DEBUG_KERNEL
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index c6be19e9ceae..24dd1a37f8fb 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -63,7 +63,9 @@ override CC += -m$(CONFIG_WORD_SIZE)
63override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR) 63override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR)
64endif 64endif
65 65
66LDFLAGS_vmlinux := -Bstatic 66LDFLAGS_vmlinux-yy := -Bstatic
67LDFLAGS_vmlinux-$(CONFIG_PPC64)$(CONFIG_RELOCATABLE) := -pie
68LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-yy)
67 69
68CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc 70CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc
69CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple 71CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple
@@ -102,7 +104,10 @@ endif
102KBUILD_CFLAGS += $(call cc-option,-mno-altivec) 104KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
103 105
104# No SPE instruction when building kernel 106# No SPE instruction when building kernel
107# (We use all available options to help semi-broken compilers)
105KBUILD_CFLAGS += $(call cc-option,-mno-spe) 108KBUILD_CFLAGS += $(call cc-option,-mno-spe)
109KBUILD_CFLAGS += $(call cc-option,-mspe=no)
110KBUILD_CFLAGS += $(call cc-option,-mabi=no-spe)
106 111
107# Enable unit-at-a-time mode when possible. It shrinks the 112# Enable unit-at-a-time mode when possible. It shrinks the
108# kernel considerably. 113# kernel considerably.
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 14174aa24074..aac1406ccba5 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -49,7 +49,7 @@ zlib := inffast.c inflate.c inftrees.c
49zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h 49zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
50zliblinuxheader := zlib.h zconf.h zutil.h 50zliblinuxheader := zlib.h zconf.h zutil.h
51 51
52$(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ 52$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o prpmc2800.o): \
53 $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 53 $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
54 54
55src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c 55src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
@@ -195,7 +195,7 @@ image-$(CONFIG_PPC_CELLEB) += zImage.pseries
195image-$(CONFIG_PPC_CHRP) += zImage.chrp 195image-$(CONFIG_PPC_CHRP) += zImage.chrp
196image-$(CONFIG_PPC_EFIKA) += zImage.chrp 196image-$(CONFIG_PPC_EFIKA) += zImage.chrp
197image-$(CONFIG_PPC_PMAC) += zImage.pmac 197image-$(CONFIG_PPC_PMAC) += zImage.pmac
198image-$(CONFIG_PPC_HOLLY) += zImage.holly 198image-$(CONFIG_PPC_HOLLY) += dtbImage.holly
199image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800 199image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800
200image-$(CONFIG_PPC_ISERIES) += zImage.iseries 200image-$(CONFIG_PPC_ISERIES) += zImage.iseries
201image-$(CONFIG_DEFAULT_UIMAGE) += uImage 201image-$(CONFIG_DEFAULT_UIMAGE) += uImage
@@ -310,8 +310,11 @@ $(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
310$(obj)/vmlinux.strip: vmlinux 310$(obj)/vmlinux.strip: vmlinux
311 $(STRIP) -s -R .comment $< -o $@ 311 $(STRIP) -s -R .comment $< -o $@
312 312
313# The iseries hypervisor won't take an ET_DYN executable, so this
314# changes the type (byte 17) in the file to ET_EXEC (2).
313$(obj)/zImage.iseries: vmlinux 315$(obj)/zImage.iseries: vmlinux
314 $(STRIP) -s -R .comment $< -o $@ 316 $(STRIP) -s -R .comment $< -o $@
317 printf "\x02" | dd of=$@ conv=notrunc bs=1 seek=17
315 318
316$(obj)/uImage: vmlinux $(wrapperbits) 319$(obj)/uImage: vmlinux $(wrapperbits)
317 $(call if_changed,wrap,uboot) 320 $(call if_changed,wrap,uboot)
diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c
index b1e5611b2ab1..dcc9ab2ca823 100644
--- a/arch/powerpc/boot/addnote.c
+++ b/arch/powerpc/boot/addnote.c
@@ -11,7 +11,12 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 * 13 *
14 * Usage: addnote zImage 14 * Usage: addnote zImage [note.elf]
15 *
16 * If note.elf is supplied, it is the name of an ELF file that contains
17 * an RPA note to use instead of the built-in one. Alternatively, the
18 * note.elf file may be empty, in which case the built-in RPA note is
19 * used (this is to simplify how this is invoked from the wrapper script).
15 */ 20 */
16#include <stdio.h> 21#include <stdio.h>
17#include <stdlib.h> 22#include <stdlib.h>
@@ -43,27 +48,29 @@ char rpaname[] = "IBM,RPA-Client-Config";
43 */ 48 */
44#define N_RPA_DESCR 8 49#define N_RPA_DESCR 8
45unsigned int rpanote[N_RPA_DESCR] = { 50unsigned int rpanote[N_RPA_DESCR] = {
46 0, /* lparaffinity */ 51 1, /* lparaffinity */
47 64, /* min_rmo_size */ 52 128, /* min_rmo_size */
48 0, /* min_rmo_percent */ 53 0, /* min_rmo_percent */
49 40, /* max_pft_size */ 54 46, /* max_pft_size */
50 1, /* splpar */ 55 1, /* splpar */
51 -1, /* min_load */ 56 -1, /* min_load */
52 0, /* new_mem_def */ 57 1, /* new_mem_def */
53 1, /* ignore_my_client_config */ 58 0, /* ignore_my_client_config */
54}; 59};
55 60
56#define ROUNDUP(len) (((len) + 3) & ~3) 61#define ROUNDUP(len) (((len) + 3) & ~3)
57 62
58unsigned char buf[512]; 63unsigned char buf[512];
64unsigned char notebuf[512];
59 65
60#define GET_16BE(off) ((buf[off] << 8) + (buf[(off)+1])) 66#define GET_16BE(b, off) (((b)[off] << 8) + ((b)[(off)+1]))
61#define GET_32BE(off) ((GET_16BE(off) << 16) + GET_16BE((off)+2)) 67#define GET_32BE(b, off) ((GET_16BE((b), (off)) << 16) + \
68 GET_16BE((b), (off)+2))
62 69
63#define PUT_16BE(off, v) (buf[off] = ((v) >> 8) & 0xff, \ 70#define PUT_16BE(b, off, v) ((b)[off] = ((v) >> 8) & 0xff, \
64 buf[(off) + 1] = (v) & 0xff) 71 (b)[(off) + 1] = (v) & 0xff)
65#define PUT_32BE(off, v) (PUT_16BE((off), (v) >> 16), \ 72#define PUT_32BE(b, off, v) (PUT_16BE((b), (off), (v) >> 16), \
66 PUT_16BE((off) + 2, (v))) 73 PUT_16BE((b), (off) + 2, (v)))
67 74
68/* Structure of an ELF file */ 75/* Structure of an ELF file */
69#define E_IDENT 0 /* ELF header */ 76#define E_IDENT 0 /* ELF header */
@@ -88,15 +95,71 @@ unsigned char buf[512];
88 95
89unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' }; 96unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' };
90 97
98unsigned char *read_rpanote(const char *fname, int *nnp)
99{
100 int notefd, nr, i;
101 int ph, ps, np;
102 int note, notesize;
103
104 notefd = open(fname, O_RDONLY);
105 if (notefd < 0) {
106 perror(fname);
107 exit(1);
108 }
109 nr = read(notefd, notebuf, sizeof(notebuf));
110 if (nr < 0) {
111 perror("read note");
112 exit(1);
113 }
114 if (nr == 0) /* empty file */
115 return NULL;
116 if (nr < E_HSIZE ||
117 memcmp(&notebuf[E_IDENT+EI_MAGIC], elf_magic, 4) != 0 ||
118 notebuf[E_IDENT+EI_CLASS] != ELFCLASS32 ||
119 notebuf[E_IDENT+EI_DATA] != ELFDATA2MSB)
120 goto notelf;
121 close(notefd);
122
123 /* now look for the RPA-note */
124 ph = GET_32BE(notebuf, E_PHOFF);
125 ps = GET_16BE(notebuf, E_PHENTSIZE);
126 np = GET_16BE(notebuf, E_PHNUM);
127 if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
128 goto notelf;
129
130 for (i = 0; i < np; ++i, ph += ps) {
131 if (GET_32BE(notebuf, ph + PH_TYPE) != PT_NOTE)
132 continue;
133 note = GET_32BE(notebuf, ph + PH_OFFSET);
134 notesize = GET_32BE(notebuf, ph + PH_FILESZ);
135 if (notesize < 34 || note + notesize > nr)
136 continue;
137 if (GET_32BE(notebuf, note) != strlen(rpaname) + 1 ||
138 GET_32BE(notebuf, note + 8) != 0x12759999 ||
139 strcmp((char *)&notebuf[note + 12], rpaname) != 0)
140 continue;
141 /* looks like an RPA note, return it */
142 *nnp = notesize;
143 return &notebuf[note];
144 }
145 /* no RPA note found */
146 return NULL;
147
148 notelf:
149 fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n", fname);
150 exit(1);
151}
152
91int 153int
92main(int ac, char **av) 154main(int ac, char **av)
93{ 155{
94 int fd, n, i; 156 int fd, n, i;
95 int ph, ps, np; 157 int ph, ps, np;
96 int nnote, nnote2, ns; 158 int nnote, nnote2, ns;
159 unsigned char *rpap;
97 160
98 if (ac != 2) { 161 if (ac != 2 && ac != 3) {
99 fprintf(stderr, "Usage: %s elf-file\n", av[0]); 162 fprintf(stderr, "Usage: %s elf-file [rpanote.elf]\n", av[0]);
100 exit(1); 163 exit(1);
101 } 164 }
102 fd = open(av[1], O_RDWR); 165 fd = open(av[1], O_RDWR);
@@ -107,6 +170,7 @@ main(int ac, char **av)
107 170
108 nnote = 12 + ROUNDUP(strlen(arch) + 1) + sizeof(descr); 171 nnote = 12 + ROUNDUP(strlen(arch) + 1) + sizeof(descr);
109 nnote2 = 12 + ROUNDUP(strlen(rpaname) + 1) + sizeof(rpanote); 172 nnote2 = 12 + ROUNDUP(strlen(rpaname) + 1) + sizeof(rpanote);
173 rpap = NULL;
110 174
111 n = read(fd, buf, sizeof(buf)); 175 n = read(fd, buf, sizeof(buf));
112 if (n < 0) { 176 if (n < 0) {
@@ -124,16 +188,19 @@ main(int ac, char **av)
124 exit(1); 188 exit(1);
125 } 189 }
126 190
127 ph = GET_32BE(E_PHOFF); 191 if (ac == 3)
128 ps = GET_16BE(E_PHENTSIZE); 192 rpap = read_rpanote(av[2], &nnote2);
129 np = GET_16BE(E_PHNUM); 193
194 ph = GET_32BE(buf, E_PHOFF);
195 ps = GET_16BE(buf, E_PHENTSIZE);
196 np = GET_16BE(buf, E_PHNUM);
130 if (ph < E_HSIZE || ps < PH_HSIZE || np < 1) 197 if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
131 goto notelf; 198 goto notelf;
132 if (ph + (np + 2) * ps + nnote + nnote2 > n) 199 if (ph + (np + 2) * ps + nnote + nnote2 > n)
133 goto nospace; 200 goto nospace;
134 201
135 for (i = 0; i < np; ++i) { 202 for (i = 0; i < np; ++i) {
136 if (GET_32BE(ph + PH_TYPE) == PT_NOTE) { 203 if (GET_32BE(buf, ph + PH_TYPE) == PT_NOTE) {
137 fprintf(stderr, "%s already has a note entry\n", 204 fprintf(stderr, "%s already has a note entry\n",
138 av[1]); 205 av[1]);
139 exit(0); 206 exit(0);
@@ -148,37 +215,42 @@ main(int ac, char **av)
148 215
149 /* fill in the program header entry */ 216 /* fill in the program header entry */
150 ns = ph + 2 * ps; 217 ns = ph + 2 * ps;
151 PUT_32BE(ph + PH_TYPE, PT_NOTE); 218 PUT_32BE(buf, ph + PH_TYPE, PT_NOTE);
152 PUT_32BE(ph + PH_OFFSET, ns); 219 PUT_32BE(buf, ph + PH_OFFSET, ns);
153 PUT_32BE(ph + PH_FILESZ, nnote); 220 PUT_32BE(buf, ph + PH_FILESZ, nnote);
154 221
155 /* fill in the note area we point to */ 222 /* fill in the note area we point to */
156 /* XXX we should probably make this a proper section */ 223 /* XXX we should probably make this a proper section */
157 PUT_32BE(ns, strlen(arch) + 1); 224 PUT_32BE(buf, ns, strlen(arch) + 1);
158 PUT_32BE(ns + 4, N_DESCR * 4); 225 PUT_32BE(buf, ns + 4, N_DESCR * 4);
159 PUT_32BE(ns + 8, 0x1275); 226 PUT_32BE(buf, ns + 8, 0x1275);
160 strcpy((char *) &buf[ns + 12], arch); 227 strcpy((char *) &buf[ns + 12], arch);
161 ns += 12 + strlen(arch) + 1; 228 ns += 12 + strlen(arch) + 1;
162 for (i = 0; i < N_DESCR; ++i, ns += 4) 229 for (i = 0; i < N_DESCR; ++i, ns += 4)
163 PUT_32BE(ns, descr[i]); 230 PUT_32BE(buf, ns, descr[i]);
164 231
165 /* fill in the second program header entry and the RPA note area */ 232 /* fill in the second program header entry and the RPA note area */
166 ph += ps; 233 ph += ps;
167 PUT_32BE(ph + PH_TYPE, PT_NOTE); 234 PUT_32BE(buf, ph + PH_TYPE, PT_NOTE);
168 PUT_32BE(ph + PH_OFFSET, ns); 235 PUT_32BE(buf, ph + PH_OFFSET, ns);
169 PUT_32BE(ph + PH_FILESZ, nnote2); 236 PUT_32BE(buf, ph + PH_FILESZ, nnote2);
170 237
171 /* fill in the note area we point to */ 238 /* fill in the note area we point to */
172 PUT_32BE(ns, strlen(rpaname) + 1); 239 if (rpap) {
173 PUT_32BE(ns + 4, sizeof(rpanote)); 240 /* RPA note supplied in file, just copy the whole thing over */
174 PUT_32BE(ns + 8, 0x12759999); 241 memcpy(buf + ns, rpap, nnote2);
175 strcpy((char *) &buf[ns + 12], rpaname); 242 } else {
176 ns += 12 + ROUNDUP(strlen(rpaname) + 1); 243 PUT_32BE(buf, ns, strlen(rpaname) + 1);
177 for (i = 0; i < N_RPA_DESCR; ++i, ns += 4) 244 PUT_32BE(buf, ns + 4, sizeof(rpanote));
178 PUT_32BE(ns, rpanote[i]); 245 PUT_32BE(buf, ns + 8, 0x12759999);
246 strcpy((char *) &buf[ns + 12], rpaname);
247 ns += 12 + ROUNDUP(strlen(rpaname) + 1);
248 for (i = 0; i < N_RPA_DESCR; ++i, ns += 4)
249 PUT_32BE(buf, ns, rpanote[i]);
250 }
179 251
180 /* Update the number of program headers */ 252 /* Update the number of program headers */
181 PUT_16BE(E_PHNUM, np + 2); 253 PUT_16BE(buf, E_PHNUM, np + 2);
182 254
183 /* write back */ 255 /* write back */
184 lseek(fd, (long) 0, SEEK_SET); 256 lseek(fd, (long) 0, SEEK_SET);
diff --git a/arch/powerpc/boot/dtc-src/Makefile.dtc b/arch/powerpc/boot/dtc-src/Makefile.dtc
index d607fdb8df8d..6ddf9ecac669 100644
--- a/arch/powerpc/boot/dtc-src/Makefile.dtc
+++ b/arch/powerpc/boot/dtc-src/Makefile.dtc
@@ -5,21 +5,5 @@
5# 5#
6DTC_SRCS = dtc.c flattree.c fstree.c data.c livetree.c treesource.c srcpos.c \ 6DTC_SRCS = dtc.c flattree.c fstree.c data.c livetree.c treesource.c srcpos.c \
7 checks.c 7 checks.c
8DTC_EXTRA = dtc.h srcpos.h 8DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.c
9DTC_LEXFILES = dtc-lexer.l
10DTC_BISONFILES = dtc-parser.y
11
12DTC_LEX_SRCS = $(DTC_LEXFILES:%.l=%.lex.c)
13DTC_BISON_SRCS = $(DTC_BISONFILES:%.y=%.tab.c)
14DTC_BISON_INCLUDES = $(DTC_BISONFILES:%.y=%.tab.h)
15
16DTC_GEN_SRCS = $(DTC_LEX_SRCS) $(DTC_BISON_SRCS)
17DTC_GEN_ALL = $(DTC_GEN_SRCS) $(DTC_BISON_INCLUDES)
18DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o) 9DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o)
19
20DTC_CLEANFILES = $(DTC_GEN_ALL)
21
22# We assume the containing Makefile system can do auto-dependencies for most
23# things, but we supply the dependencies on generated header files explicitly
24
25$(addprefix $(DTC_objdir)/,$(DTC_GEN_SRCS:%.c=%.o)): $(addprefix $(DTC_objdir)/,$(DTC_BISON_INCLUDES))
diff --git a/arch/powerpc/boot/dtc-src/checks.c b/arch/powerpc/boot/dtc-src/checks.c
index 2ce961cd414d..95485796f253 100644
--- a/arch/powerpc/boot/dtc-src/checks.c
+++ b/arch/powerpc/boot/dtc-src/checks.c
@@ -242,6 +242,42 @@ static void check_duplicate_property_names(struct check *c, struct node *dt,
242} 242}
243NODE_CHECK(duplicate_property_names, NULL, ERROR); 243NODE_CHECK(duplicate_property_names, NULL, ERROR);
244 244
245#define LOWERCASE "abcdefghijklmnopqrstuvwxyz"
246#define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
247#define DIGITS "0123456789"
248#define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
249
250static void check_node_name_chars(struct check *c, struct node *dt,
251 struct node *node)
252{
253 int n = strspn(node->name, c->data);
254
255 if (n < strlen(node->name))
256 FAIL(c, "Bad character '%c' in node %s",
257 node->name[n], node->fullpath);
258}
259NODE_CHECK(node_name_chars, PROPNODECHARS "@", ERROR);
260
261static void check_node_name_format(struct check *c, struct node *dt,
262 struct node *node)
263{
264 if (strchr(get_unitname(node), '@'))
265 FAIL(c, "Node %s has multiple '@' characters in name",
266 node->fullpath);
267}
268NODE_CHECK(node_name_format, NULL, ERROR, &node_name_chars);
269
270static void check_property_name_chars(struct check *c, struct node *dt,
271 struct node *node, struct property *prop)
272{
273 int n = strspn(prop->name, c->data);
274
275 if (n < strlen(prop->name))
276 FAIL(c, "Bad character '%c' in property name \"%s\", node %s",
277 prop->name[n], prop->name, node->fullpath);
278}
279PROP_CHECK(property_name_chars, PROPNODECHARS, ERROR);
280
245static void check_explicit_phandles(struct check *c, struct node *root, 281static void check_explicit_phandles(struct check *c, struct node *root,
246 struct node *node) 282 struct node *node)
247{ 283{
@@ -280,16 +316,29 @@ NODE_CHECK(explicit_phandles, NULL, ERROR);
280static void check_name_properties(struct check *c, struct node *root, 316static void check_name_properties(struct check *c, struct node *root,
281 struct node *node) 317 struct node *node)
282{ 318{
283 struct property *prop; 319 struct property **pp, *prop = NULL;
320
321 for (pp = &node->proplist; *pp; pp = &((*pp)->next))
322 if (streq((*pp)->name, "name")) {
323 prop = *pp;
324 break;
325 }
284 326
285 prop = get_property(node, "name");
286 if (!prop) 327 if (!prop)
287 return; /* No name property, that's fine */ 328 return; /* No name property, that's fine */
288 329
289 if ((prop->val.len != node->basenamelen+1) 330 if ((prop->val.len != node->basenamelen+1)
290 || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) 331 || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) {
291 FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead" 332 FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead"
292 " of base node name)", node->fullpath, prop->val.val); 333 " of base node name)", node->fullpath, prop->val.val);
334 } else {
335 /* The name property is correct, and therefore redundant.
336 * Delete it */
337 *pp = prop->next;
338 free(prop->name);
339 data_free(prop->val);
340 free(prop);
341 }
293} 342}
294CHECK_IS_STRING(name_is_string, "name", ERROR); 343CHECK_IS_STRING(name_is_string, "name", ERROR);
295NODE_CHECK(name_properties, NULL, ERROR, &name_is_string); 344NODE_CHECK(name_properties, NULL, ERROR, &name_is_string);
@@ -301,23 +350,23 @@ NODE_CHECK(name_properties, NULL, ERROR, &name_is_string);
301static void fixup_phandle_references(struct check *c, struct node *dt, 350static void fixup_phandle_references(struct check *c, struct node *dt,
302 struct node *node, struct property *prop) 351 struct node *node, struct property *prop)
303{ 352{
304 struct marker *m = prop->val.markers; 353 struct marker *m = prop->val.markers;
305 struct node *refnode; 354 struct node *refnode;
306 cell_t phandle; 355 cell_t phandle;
307 356
308 for_each_marker_of_type(m, REF_PHANDLE) { 357 for_each_marker_of_type(m, REF_PHANDLE) {
309 assert(m->offset + sizeof(cell_t) <= prop->val.len); 358 assert(m->offset + sizeof(cell_t) <= prop->val.len);
310 359
311 refnode = get_node_by_ref(dt, m->ref); 360 refnode = get_node_by_ref(dt, m->ref);
312 if (! refnode) { 361 if (! refnode) {
313 FAIL(c, "Reference to non-existent node or label \"%s\"\n", 362 FAIL(c, "Reference to non-existent node or label \"%s\"\n",
314 m->ref); 363 m->ref);
315 continue; 364 continue;
316 } 365 }
317 366
318 phandle = get_node_phandle(dt, refnode); 367 phandle = get_node_phandle(dt, refnode);
319 *((cell_t *)(prop->val.val + m->offset)) = cpu_to_be32(phandle); 368 *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
320 } 369 }
321} 370}
322CHECK(phandle_references, NULL, NULL, fixup_phandle_references, NULL, ERROR, 371CHECK(phandle_references, NULL, NULL, fixup_phandle_references, NULL, ERROR,
323 &duplicate_node_names, &explicit_phandles); 372 &duplicate_node_names, &explicit_phandles);
@@ -498,6 +547,7 @@ TREE_CHECK(obsolete_chosen_interrupt_controller, NULL, WARN);
498 547
499static struct check *check_table[] = { 548static struct check *check_table[] = {
500 &duplicate_node_names, &duplicate_property_names, 549 &duplicate_node_names, &duplicate_property_names,
550 &node_name_chars, &node_name_format, &property_name_chars,
501 &name_is_string, &name_properties, 551 &name_is_string, &name_properties,
502 &explicit_phandles, 552 &explicit_phandles,
503 &phandle_references, &path_references, 553 &phandle_references, &path_references,
@@ -511,10 +561,7 @@ static struct check *check_table[] = {
511 &obsolete_chosen_interrupt_controller, 561 &obsolete_chosen_interrupt_controller,
512}; 562};
513 563
514int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys); 564void process_checks(int force, struct boot_info *bi)
515
516void process_checks(int force, struct boot_info *bi,
517 int checkflag, int outversion, int boot_cpuid_phys)
518{ 565{
519 struct node *dt = bi->dt; 566 struct node *dt = bi->dt;
520 int i; 567 int i;
@@ -537,214 +584,4 @@ void process_checks(int force, struct boot_info *bi,
537 "output forced\n"); 584 "output forced\n");
538 } 585 }
539 } 586 }
540
541 if (checkflag) {
542 if (error) {
543 fprintf(stderr, "Warning: Skipping semantic checks due to structural errors\n");
544 } else {
545 if (!check_semantics(bi->dt, outversion,
546 boot_cpuid_phys))
547 fprintf(stderr, "Warning: Input tree has semantic errors\n");
548 }
549 }
550}
551
552/*
553 * Semantic check functions
554 */
555
556#define ERRMSG(...) if (quiet < 2) fprintf(stderr, "ERROR: " __VA_ARGS__)
557#define WARNMSG(...) if (quiet < 1) fprintf(stderr, "Warning: " __VA_ARGS__)
558
559#define DO_ERR(...) do {ERRMSG(__VA_ARGS__); ok = 0; } while (0)
560
561#define CHECK_HAVE(node, propname) \
562 do { \
563 if (! (prop = get_property((node), (propname)))) \
564 DO_ERR("Missing \"%s\" property in %s\n", (propname), \
565 (node)->fullpath); \
566 } while (0);
567
568#define CHECK_HAVE_WARN(node, propname) \
569 do { \
570 if (! (prop = get_property((node), (propname)))) \
571 WARNMSG("%s has no \"%s\" property\n", \
572 (node)->fullpath, (propname)); \
573 } while (0)
574
575#define CHECK_HAVE_STRING(node, propname) \
576 do { \
577 CHECK_HAVE((node), (propname)); \
578 if (prop && !data_is_one_string(prop->val)) \
579 DO_ERR("\"%s\" property in %s is not a string\n", \
580 (propname), (node)->fullpath); \
581 } while (0)
582
583#define CHECK_HAVE_STREQ(node, propname, value) \
584 do { \
585 CHECK_HAVE_STRING((node), (propname)); \
586 if (prop && !streq(prop->val.val, (value))) \
587 DO_ERR("%s has wrong %s, %s (should be %s\n", \
588 (node)->fullpath, (propname), \
589 prop->val.val, (value)); \
590 } while (0)
591
592#define CHECK_HAVE_ONECELL(node, propname) \
593 do { \
594 CHECK_HAVE((node), (propname)); \
595 if (prop && (prop->val.len != sizeof(cell_t))) \
596 DO_ERR("\"%s\" property in %s has wrong size %d (should be 1 cell)\n", (propname), (node)->fullpath, prop->val.len); \
597 } while (0)
598
599#define CHECK_HAVE_WARN_ONECELL(node, propname) \
600 do { \
601 CHECK_HAVE_WARN((node), (propname)); \
602 if (prop && (prop->val.len != sizeof(cell_t))) \
603 DO_ERR("\"%s\" property in %s has wrong size %d (should be 1 cell)\n", (propname), (node)->fullpath, prop->val.len); \
604 } while (0)
605
606#define CHECK_HAVE_WARN_PHANDLE(xnode, propname, root) \
607 do { \
608 struct node *ref; \
609 CHECK_HAVE_WARN_ONECELL((xnode), (propname)); \
610 if (prop) {\
611 cell_t phandle = propval_cell(prop); \
612 if ((phandle == 0) || (phandle == -1)) { \
613 DO_ERR("\"%s\" property in %s contains an invalid phandle %x\n", (propname), (xnode)->fullpath, phandle); \
614 } else { \
615 ref = get_node_by_phandle((root), propval_cell(prop)); \
616 if (! ref) \
617 DO_ERR("\"%s\" property in %s refers to non-existant phandle %x\n", (propname), (xnode)->fullpath, propval_cell(prop)); \
618 } \
619 } \
620 } while (0)
621
622#define CHECK_HAVE_WARN_STRING(node, propname) \
623 do { \
624 CHECK_HAVE_WARN((node), (propname)); \
625 if (prop && !data_is_one_string(prop->val)) \
626 DO_ERR("\"%s\" property in %s is not a string\n", \
627 (propname), (node)->fullpath); \
628 } while (0)
629
630static int check_root(struct node *root)
631{
632 struct property *prop;
633 int ok = 1;
634
635 CHECK_HAVE_STRING(root, "model");
636 CHECK_HAVE_WARN(root, "compatible");
637
638 return ok;
639}
640
641static int check_cpus(struct node *root, int outversion, int boot_cpuid_phys)
642{
643 struct node *cpus, *cpu;
644 struct property *prop;
645 struct node *bootcpu = NULL;
646 int ok = 1;
647
648 cpus = get_subnode(root, "cpus");
649 if (! cpus) {
650 ERRMSG("Missing /cpus node\n");
651 return 0;
652 }
653
654 if (cpus->addr_cells != 1)
655 DO_ERR("%s has bad #address-cells value %d (should be 1)\n",
656 cpus->fullpath, cpus->addr_cells);
657 if (cpus->size_cells != 0)
658 DO_ERR("%s has bad #size-cells value %d (should be 0)\n",
659 cpus->fullpath, cpus->size_cells);
660
661 for_each_child(cpus, cpu) {
662 CHECK_HAVE_STREQ(cpu, "device_type", "cpu");
663
664 CHECK_HAVE_ONECELL(cpu, "reg");
665 if (prop) {
666 cell_t unitnum;
667 char *eptr;
668
669 unitnum = strtol(get_unitname(cpu), &eptr, 16);
670 if (*eptr) {
671 WARNMSG("%s has bad format unit name %s (should be CPU number\n",
672 cpu->fullpath, get_unitname(cpu));
673 } else if (unitnum != propval_cell(prop)) {
674 WARNMSG("%s unit name \"%s\" does not match \"reg\" property <%x>\n",
675 cpu->fullpath, get_unitname(cpu),
676 propval_cell(prop));
677 }
678 }
679
680/* CHECK_HAVE_ONECELL(cpu, "d-cache-line-size"); */
681/* CHECK_HAVE_ONECELL(cpu, "i-cache-line-size"); */
682 CHECK_HAVE_ONECELL(cpu, "d-cache-size");
683 CHECK_HAVE_ONECELL(cpu, "i-cache-size");
684
685 CHECK_HAVE_WARN_ONECELL(cpu, "clock-frequency");
686 CHECK_HAVE_WARN_ONECELL(cpu, "timebase-frequency");
687
688 prop = get_property(cpu, "linux,boot-cpu");
689 if (prop) {
690 if (prop->val.len)
691 WARNMSG("\"linux,boot-cpu\" property in %s is non-empty\n",
692 cpu->fullpath);
693 if (bootcpu)
694 DO_ERR("Multiple boot cpus (%s and %s)\n",
695 bootcpu->fullpath, cpu->fullpath);
696 else
697 bootcpu = cpu;
698 }
699 }
700
701 if (outversion < 2) {
702 if (! bootcpu)
703 WARNMSG("No cpu has \"linux,boot-cpu\" property\n");
704 } else {
705 if (bootcpu)
706 WARNMSG("\"linux,boot-cpu\" property is deprecated in blob version 2 or higher\n");
707 if (boot_cpuid_phys == 0xfeedbeef)
708 WARNMSG("physical boot CPU not set. Use -b option to set\n");
709 }
710
711 return ok;
712}
713
714static int check_memory(struct node *root)
715{
716 struct node *mem;
717 struct property *prop;
718 int nnodes = 0;
719 int ok = 1;
720
721 for_each_child(root, mem) {
722 if (! strneq(mem->name, "memory", mem->basenamelen))
723 continue;
724
725 nnodes++;
726
727 CHECK_HAVE_STREQ(mem, "device_type", "memory");
728 CHECK_HAVE(mem, "reg");
729 }
730
731 if (nnodes == 0) {
732 ERRMSG("No memory nodes\n");
733 return 0;
734 }
735
736 return ok;
737}
738
739int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys)
740{
741 int ok = 1;
742
743 ok = ok && check_root(dt);
744 ok = ok && check_cpus(dt, outversion, boot_cpuid_phys);
745 ok = ok && check_memory(dt);
746 if (! ok)
747 return 0;
748
749 return 1;
750} 587}
diff --git a/arch/powerpc/boot/dtc-src/data.c b/arch/powerpc/boot/dtc-src/data.c
index a94718c731a9..dd2e3d39d4c1 100644
--- a/arch/powerpc/boot/dtc-src/data.c
+++ b/arch/powerpc/boot/dtc-src/data.c
@@ -32,8 +32,6 @@ void data_free(struct data d)
32 m = nm; 32 m = nm;
33 } 33 }
34 34
35 assert(!d.val || d.asize);
36
37 if (d.val) 35 if (d.val)
38 free(d.val); 36 free(d.val);
39} 37}
@@ -43,9 +41,6 @@ struct data data_grow_for(struct data d, int xlen)
43 struct data nd; 41 struct data nd;
44 int newsize; 42 int newsize;
45 43
46 /* we must start with an allocated datum */
47 assert(!d.val || d.asize);
48
49 if (xlen == 0) 44 if (xlen == 0)
50 return d; 45 return d;
51 46
@@ -56,11 +51,8 @@ struct data data_grow_for(struct data d, int xlen)
56 while ((d.len + xlen) > newsize) 51 while ((d.len + xlen) > newsize)
57 newsize *= 2; 52 newsize *= 2;
58 53
59 nd.asize = newsize;
60 nd.val = xrealloc(d.val, newsize); 54 nd.val = xrealloc(d.val, newsize);
61 55
62 assert(nd.asize >= (d.len + xlen));
63
64 return nd; 56 return nd;
65} 57}
66 58
@@ -83,16 +75,11 @@ static char get_oct_char(const char *s, int *i)
83 long val; 75 long val;
84 76
85 x[3] = '\0'; 77 x[3] = '\0';
86 x[0] = s[(*i)]; 78 strncpy(x, s + *i, 3);
87 if (x[0]) {
88 x[1] = s[(*i)+1];
89 if (x[1])
90 x[2] = s[(*i)+2];
91 }
92 79
93 val = strtol(x, &endx, 8); 80 val = strtol(x, &endx, 8);
94 if ((endx - x) == 0) 81
95 fprintf(stderr, "Empty \\nnn escape\n"); 82 assert(endx > x);
96 83
97 (*i) += endx - x; 84 (*i) += endx - x;
98 return val; 85 return val;
@@ -105,13 +92,11 @@ static char get_hex_char(const char *s, int *i)
105 long val; 92 long val;
106 93
107 x[2] = '\0'; 94 x[2] = '\0';
108 x[0] = s[(*i)]; 95 strncpy(x, s + *i, 2);
109 if (x[0])
110 x[1] = s[(*i)+1];
111 96
112 val = strtol(x, &endx, 16); 97 val = strtol(x, &endx, 16);
113 if ((endx - x) == 0) 98 if (!(endx > x))
114 fprintf(stderr, "Empty \\x escape\n"); 99 die("\\x used with no following hex digits\n");
115 100
116 (*i) += endx - x; 101 (*i) += endx - x;
117 return val; 102 return val;
@@ -182,14 +167,29 @@ struct data data_copy_escape_string(const char *s, int len)
182 return d; 167 return d;
183} 168}
184 169
185struct data data_copy_file(FILE *f, size_t len) 170struct data data_copy_file(FILE *f, size_t maxlen)
186{ 171{
187 struct data d; 172 struct data d = empty_data;
188 173
189 d = data_grow_for(empty_data, len); 174 while (!feof(f) && (d.len < maxlen)) {
175 size_t chunksize, ret;
190 176
191 d.len = len; 177 if (maxlen == -1)
192 fread(d.val, len, 1, f); 178 chunksize = 4096;
179 else
180 chunksize = maxlen - d.len;
181
182 d = data_grow_for(d, chunksize);
183 ret = fread(d.val + d.len, 1, chunksize, f);
184
185 if (ferror(f))
186 die("Error reading file into data: %s", strerror(errno));
187
188 if (d.len + ret < d.len)
189 die("Overflow reading file into data\n");
190
191 d.len += ret;
192 }
193 193
194 return d; 194 return d;
195} 195}
@@ -247,7 +247,7 @@ struct data data_merge(struct data d1, struct data d2)
247 247
248struct data data_append_cell(struct data d, cell_t word) 248struct data data_append_cell(struct data d, cell_t word)
249{ 249{
250 cell_t beword = cpu_to_be32(word); 250 cell_t beword = cpu_to_fdt32(word);
251 251
252 return data_append_data(d, &beword, sizeof(beword)); 252 return data_append_data(d, &beword, sizeof(beword));
253} 253}
@@ -256,15 +256,15 @@ struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
256{ 256{
257 struct fdt_reserve_entry bere; 257 struct fdt_reserve_entry bere;
258 258
259 bere.address = cpu_to_be64(re->address); 259 bere.address = cpu_to_fdt64(re->address);
260 bere.size = cpu_to_be64(re->size); 260 bere.size = cpu_to_fdt64(re->size);
261 261
262 return data_append_data(d, &bere, sizeof(bere)); 262 return data_append_data(d, &bere, sizeof(bere));
263} 263}
264 264
265struct data data_append_addr(struct data d, u64 addr) 265struct data data_append_addr(struct data d, uint64_t addr)
266{ 266{
267 u64 beaddr = cpu_to_be64(addr); 267 uint64_t beaddr = cpu_to_fdt64(addr);
268 268
269 return data_append_data(d, &beaddr, sizeof(beaddr)); 269 return data_append_data(d, &beaddr, sizeof(beaddr));
270} 270}
diff --git a/arch/powerpc/boot/dtc-src/dtc-lexer.l b/arch/powerpc/boot/dtc-src/dtc-lexer.l
index c811b221b31e..44dbfd3f0976 100644
--- a/arch/powerpc/boot/dtc-src/dtc-lexer.l
+++ b/arch/powerpc/boot/dtc-src/dtc-lexer.l
@@ -28,6 +28,10 @@
28PROPNODECHAR [a-zA-Z0-9,._+*#?@-] 28PROPNODECHAR [a-zA-Z0-9,._+*#?@-]
29PATHCHAR ({PROPNODECHAR}|[/]) 29PATHCHAR ({PROPNODECHAR}|[/])
30LABEL [a-zA-Z_][a-zA-Z0-9_]* 30LABEL [a-zA-Z_][a-zA-Z0-9_]*
31STRING \"([^\\"]|\\.)*\"
32WS [[:space:]]
33COMMENT "/*"([^*]|\*+[^*/])*\*+"/"
34LINECOMMENT "//".*\n
31 35
32%{ 36%{
33#include "dtc.h" 37#include "dtc.h"
@@ -52,29 +56,26 @@ static int dts_version; /* = 0 */
52 DPRINT("<V1>\n"); \ 56 DPRINT("<V1>\n"); \
53 BEGIN(V1); \ 57 BEGIN(V1); \
54 } 58 }
59
60static void push_input_file(const char *filename);
61static int pop_input_file(void);
55%} 62%}
56 63
57%% 64%%
58<*>"/include/" BEGIN(INCLUDE); 65<*>"/include/"{WS}*{STRING} {
59 66 char *name = strchr(yytext, '\"') + 1;
60<INCLUDE>\"[^"\n]*\" { 67 yytext[yyleng-1] = '\0';
61 yytext[strlen(yytext) - 1] = 0; 68 push_input_file(name);
62 if (!push_input_file(yytext + 1)) {
63 /* Some unrecoverable error.*/
64 exit(1);
65 }
66 BEGIN_DEFAULT();
67 } 69 }
68 70
69
70<*><<EOF>> { 71<*><<EOF>> {
71 if (!pop_input_file()) { 72 if (!pop_input_file()) {
72 yyterminate(); 73 yyterminate();
73 } 74 }
74 } 75 }
75 76
76<*>\"([^\\"]|\\.)*\" { 77<*>{STRING} {
77 yylloc.filenum = srcpos_filenum; 78 yylloc.file = srcpos_file;
78 yylloc.first_line = yylineno; 79 yylloc.first_line = yylineno;
79 DPRINT("String: %s\n", yytext); 80 DPRINT("String: %s\n", yytext);
80 yylval.data = data_copy_escape_string(yytext+1, 81 yylval.data = data_copy_escape_string(yytext+1,
@@ -84,7 +85,7 @@ static int dts_version; /* = 0 */
84 } 85 }
85 86
86<*>"/dts-v1/" { 87<*>"/dts-v1/" {
87 yylloc.filenum = srcpos_filenum; 88 yylloc.file = srcpos_file;
88 yylloc.first_line = yylineno; 89 yylloc.first_line = yylineno;
89 DPRINT("Keyword: /dts-v1/\n"); 90 DPRINT("Keyword: /dts-v1/\n");
90 dts_version = 1; 91 dts_version = 1;
@@ -93,7 +94,7 @@ static int dts_version; /* = 0 */
93 } 94 }
94 95
95<*>"/memreserve/" { 96<*>"/memreserve/" {
96 yylloc.filenum = srcpos_filenum; 97 yylloc.file = srcpos_file;
97 yylloc.first_line = yylineno; 98 yylloc.first_line = yylineno;
98 DPRINT("Keyword: /memreserve/\n"); 99 DPRINT("Keyword: /memreserve/\n");
99 BEGIN_DEFAULT(); 100 BEGIN_DEFAULT();
@@ -101,7 +102,7 @@ static int dts_version; /* = 0 */
101 } 102 }
102 103
103<*>{LABEL}: { 104<*>{LABEL}: {
104 yylloc.filenum = srcpos_filenum; 105 yylloc.file = srcpos_file;
105 yylloc.first_line = yylineno; 106 yylloc.first_line = yylineno;
106 DPRINT("Label: %s\n", yytext); 107 DPRINT("Label: %s\n", yytext);
107 yylval.labelref = strdup(yytext); 108 yylval.labelref = strdup(yytext);
@@ -110,7 +111,7 @@ static int dts_version; /* = 0 */
110 } 111 }
111 112
112<INITIAL>[bodh]# { 113<INITIAL>[bodh]# {
113 yylloc.filenum = srcpos_filenum; 114 yylloc.file = srcpos_file;
114 yylloc.first_line = yylineno; 115 yylloc.first_line = yylineno;
115 if (*yytext == 'b') 116 if (*yytext == 'b')
116 yylval.cbase = 2; 117 yylval.cbase = 2;
@@ -125,7 +126,7 @@ static int dts_version; /* = 0 */
125 } 126 }
126 127
127<INITIAL>[0-9a-fA-F]+ { 128<INITIAL>[0-9a-fA-F]+ {
128 yylloc.filenum = srcpos_filenum; 129 yylloc.file = srcpos_file;
129 yylloc.first_line = yylineno; 130 yylloc.first_line = yylineno;
130 yylval.literal = strdup(yytext); 131 yylval.literal = strdup(yytext);
131 DPRINT("Literal: '%s'\n", yylval.literal); 132 DPRINT("Literal: '%s'\n", yylval.literal);
@@ -133,7 +134,7 @@ static int dts_version; /* = 0 */
133 } 134 }
134 135
135<V1>[0-9]+|0[xX][0-9a-fA-F]+ { 136<V1>[0-9]+|0[xX][0-9a-fA-F]+ {
136 yylloc.filenum = srcpos_filenum; 137 yylloc.file = srcpos_file;
137 yylloc.first_line = yylineno; 138 yylloc.first_line = yylineno;
138 yylval.literal = strdup(yytext); 139 yylval.literal = strdup(yytext);
139 DPRINT("Literal: '%s'\n", yylval.literal); 140 DPRINT("Literal: '%s'\n", yylval.literal);
@@ -141,7 +142,7 @@ static int dts_version; /* = 0 */
141 } 142 }
142 143
143\&{LABEL} { /* label reference */ 144\&{LABEL} { /* label reference */
144 yylloc.filenum = srcpos_filenum; 145 yylloc.file = srcpos_file;
145 yylloc.first_line = yylineno; 146 yylloc.first_line = yylineno;
146 DPRINT("Ref: %s\n", yytext+1); 147 DPRINT("Ref: %s\n", yytext+1);
147 yylval.labelref = strdup(yytext+1); 148 yylval.labelref = strdup(yytext+1);
@@ -149,7 +150,7 @@ static int dts_version; /* = 0 */
149 } 150 }
150 151
151"&{/"{PATHCHAR}+\} { /* new-style path reference */ 152"&{/"{PATHCHAR}+\} { /* new-style path reference */
152 yylloc.filenum = srcpos_filenum; 153 yylloc.file = srcpos_file;
153 yylloc.first_line = yylineno; 154 yylloc.first_line = yylineno;
154 yytext[yyleng-1] = '\0'; 155 yytext[yyleng-1] = '\0';
155 DPRINT("Ref: %s\n", yytext+2); 156 DPRINT("Ref: %s\n", yytext+2);
@@ -158,7 +159,7 @@ static int dts_version; /* = 0 */
158 } 159 }
159 160
160<INITIAL>"&/"{PATHCHAR}+ { /* old-style path reference */ 161<INITIAL>"&/"{PATHCHAR}+ { /* old-style path reference */
161 yylloc.filenum = srcpos_filenum; 162 yylloc.file = srcpos_file;
162 yylloc.first_line = yylineno; 163 yylloc.first_line = yylineno;
163 DPRINT("Ref: %s\n", yytext+1); 164 DPRINT("Ref: %s\n", yytext+1);
164 yylval.labelref = strdup(yytext+1); 165 yylval.labelref = strdup(yytext+1);
@@ -166,7 +167,7 @@ static int dts_version; /* = 0 */
166 } 167 }
167 168
168<BYTESTRING>[0-9a-fA-F]{2} { 169<BYTESTRING>[0-9a-fA-F]{2} {
169 yylloc.filenum = srcpos_filenum; 170 yylloc.file = srcpos_file;
170 yylloc.first_line = yylineno; 171 yylloc.first_line = yylineno;
171 yylval.byte = strtol(yytext, NULL, 16); 172 yylval.byte = strtol(yytext, NULL, 16);
172 DPRINT("Byte: %02x\n", (int)yylval.byte); 173 DPRINT("Byte: %02x\n", (int)yylval.byte);
@@ -174,7 +175,7 @@ static int dts_version; /* = 0 */
174 } 175 }
175 176
176<BYTESTRING>"]" { 177<BYTESTRING>"]" {
177 yylloc.filenum = srcpos_filenum; 178 yylloc.file = srcpos_file;
178 yylloc.first_line = yylineno; 179 yylloc.first_line = yylineno;
179 DPRINT("/BYTESTRING\n"); 180 DPRINT("/BYTESTRING\n");
180 BEGIN_DEFAULT(); 181 BEGIN_DEFAULT();
@@ -182,7 +183,7 @@ static int dts_version; /* = 0 */
182 } 183 }
183 184
184<PROPNODENAME>{PROPNODECHAR}+ { 185<PROPNODENAME>{PROPNODECHAR}+ {
185 yylloc.filenum = srcpos_filenum; 186 yylloc.file = srcpos_file;
186 yylloc.first_line = yylineno; 187 yylloc.first_line = yylineno;
187 DPRINT("PropNodeName: %s\n", yytext); 188 DPRINT("PropNodeName: %s\n", yytext);
188 yylval.propnodename = strdup(yytext); 189 yylval.propnodename = strdup(yytext);
@@ -190,20 +191,19 @@ static int dts_version; /* = 0 */
190 return DT_PROPNODENAME; 191 return DT_PROPNODENAME;
191 } 192 }
192 193
193 194"/incbin/" {
194<*>[[:space:]]+ /* eat whitespace */ 195 yylloc.file = srcpos_file;
195
196<*>"/*"([^*]|\*+[^*/])*\*+"/" {
197 yylloc.filenum = srcpos_filenum;
198 yylloc.first_line = yylineno; 196 yylloc.first_line = yylineno;
199 DPRINT("Comment: %s\n", yytext); 197 DPRINT("Binary Include\n");
200 /* eat comments */ 198 return DT_INCBIN;
201 } 199 }
202 200
203<*>"//".*\n /* eat line comments */ 201<*>{WS}+ /* eat whitespace */
202<*>{COMMENT}+ /* eat C-style comments */
203<*>{LINECOMMENT}+ /* eat C++-style comments */
204 204
205<*>. { 205<*>. {
206 yylloc.filenum = srcpos_filenum; 206 yylloc.file = srcpos_file;
207 yylloc.first_line = yylineno; 207 yylloc.first_line = yylineno;
208 DPRINT("Char: %c (\\x%02x)\n", yytext[0], 208 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
209 (unsigned)yytext[0]); 209 (unsigned)yytext[0]);
@@ -227,14 +227,13 @@ static int dts_version; /* = 0 */
227 */ 227 */
228 228
229struct incl_file { 229struct incl_file {
230 int filenum; 230 struct dtc_file *file;
231 FILE *file;
232 YY_BUFFER_STATE yy_prev_buf; 231 YY_BUFFER_STATE yy_prev_buf;
233 int yy_prev_lineno; 232 int yy_prev_lineno;
234 struct incl_file *prev; 233 struct incl_file *prev;
235}; 234};
236 235
237struct incl_file *incl_file_stack; 236static struct incl_file *incl_file_stack;
238 237
239 238
240/* 239/*
@@ -245,36 +244,34 @@ struct incl_file *incl_file_stack;
245static int incl_depth = 0; 244static int incl_depth = 0;
246 245
247 246
248int push_input_file(const char *filename) 247static void push_input_file(const char *filename)
249{ 248{
250 FILE *f;
251 struct incl_file *incl_file; 249 struct incl_file *incl_file;
250 struct dtc_file *newfile;
251 struct search_path search, *searchptr = NULL;
252 252
253 if (!filename) { 253 assert(filename);
254 yyerror("No include file name given.");
255 return 0;
256 }
257 254
258 if (incl_depth++ >= MAX_INCLUDE_DEPTH) { 255 if (incl_depth++ >= MAX_INCLUDE_DEPTH)
259 yyerror("Includes nested too deeply"); 256 die("Includes nested too deeply");
260 return 0; 257
258 if (srcpos_file) {
259 search.dir = srcpos_file->dir;
260 search.next = NULL;
261 search.prev = NULL;
262 searchptr = &search;
261 } 263 }
262 264
263 f = dtc_open_file(filename); 265 newfile = dtc_open_file(filename, searchptr);
264 266
265 incl_file = malloc(sizeof(struct incl_file)); 267 incl_file = xmalloc(sizeof(struct incl_file));
266 if (!incl_file) {
267 yyerror("Can not allocate include file space.");
268 return 0;
269 }
270 268
271 /* 269 /*
272 * Save current context. 270 * Save current context.
273 */ 271 */
274 incl_file->yy_prev_buf = YY_CURRENT_BUFFER; 272 incl_file->yy_prev_buf = YY_CURRENT_BUFFER;
275 incl_file->yy_prev_lineno = yylineno; 273 incl_file->yy_prev_lineno = yylineno;
276 incl_file->filenum = srcpos_filenum; 274 incl_file->file = srcpos_file;
277 incl_file->file = yyin;
278 incl_file->prev = incl_file_stack; 275 incl_file->prev = incl_file_stack;
279 276
280 incl_file_stack = incl_file; 277 incl_file_stack = incl_file;
@@ -282,23 +279,21 @@ int push_input_file(const char *filename)
282 /* 279 /*
283 * Establish new context. 280 * Establish new context.
284 */ 281 */
285 srcpos_filenum = lookup_file_name(filename, 0); 282 srcpos_file = newfile;
286 yylineno = 1; 283 yylineno = 1;
287 yyin = f; 284 yyin = newfile->file;
288 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); 285 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
289
290 return 1;
291} 286}
292 287
293 288
294int pop_input_file(void) 289static int pop_input_file(void)
295{ 290{
296 struct incl_file *incl_file; 291 struct incl_file *incl_file;
297 292
298 if (incl_file_stack == 0) 293 if (incl_file_stack == 0)
299 return 0; 294 return 0;
300 295
301 fclose(yyin); 296 dtc_close_file(srcpos_file);
302 297
303 /* 298 /*
304 * Pop. 299 * Pop.
@@ -313,16 +308,13 @@ int pop_input_file(void)
313 yy_delete_buffer(YY_CURRENT_BUFFER); 308 yy_delete_buffer(YY_CURRENT_BUFFER);
314 yy_switch_to_buffer(incl_file->yy_prev_buf); 309 yy_switch_to_buffer(incl_file->yy_prev_buf);
315 yylineno = incl_file->yy_prev_lineno; 310 yylineno = incl_file->yy_prev_lineno;
316 srcpos_filenum = incl_file->filenum; 311 srcpos_file = incl_file->file;
317 yyin = incl_file->file; 312 yyin = incl_file->file ? incl_file->file->file : NULL;
318 313
319 /* 314 /*
320 * Free old state. 315 * Free old state.
321 */ 316 */
322 free(incl_file); 317 free(incl_file);
323 318
324 if (YY_CURRENT_BUFFER == 0)
325 return 0;
326
327 return 1; 319 return 1;
328} 320}
diff --git a/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped b/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
index d0f742460f92..ac392cb040f6 100644
--- a/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
+++ b/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
@@ -9,7 +9,7 @@
9#define FLEX_SCANNER 9#define FLEX_SCANNER
10#define YY_FLEX_MAJOR_VERSION 2 10#define YY_FLEX_MAJOR_VERSION 2
11#define YY_FLEX_MINOR_VERSION 5 11#define YY_FLEX_MINOR_VERSION 5
12#define YY_FLEX_SUBMINOR_VERSION 33 12#define YY_FLEX_SUBMINOR_VERSION 34
13#if YY_FLEX_SUBMINOR_VERSION > 0 13#if YY_FLEX_SUBMINOR_VERSION > 0
14#define FLEX_BETA 14#define FLEX_BETA
15#endif 15#endif
@@ -31,7 +31,7 @@
31 31
32/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 32/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 33
34#if __STDC_VERSION__ >= 199901L 34#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 35
36/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 36/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types. 37 * if you want the limit (max/min) macros for int types.
@@ -94,11 +94,12 @@ typedef unsigned int flex_uint32_t;
94 94
95#else /* ! __cplusplus */ 95#else /* ! __cplusplus */
96 96
97#if __STDC__ 97/* C99 requires __STDC__ to be defined as 1. */
98#if defined (__STDC__)
98 99
99#define YY_USE_CONST 100#define YY_USE_CONST
100 101
101#endif /* __STDC__ */ 102#endif /* defined (__STDC__) */
102#endif /* ! __cplusplus */ 103#endif /* ! __cplusplus */
103 104
104#ifdef YY_USE_CONST 105#ifdef YY_USE_CONST
@@ -194,11 +195,13 @@ extern FILE *yyin, *yyout;
194/* The following is because we cannot portably get our hands on size_t 195/* The following is because we cannot portably get our hands on size_t
195 * (without autoconf's help, which isn't available because we want 196 * (without autoconf's help, which isn't available because we want
196 * flex-generated scanners to compile on their own). 197 * flex-generated scanners to compile on their own).
198 * Given that the standard has decreed that size_t exists since 1989,
199 * I guess we can afford to depend on it. Manoj.
197 */ 200 */
198 201
199#ifndef YY_TYPEDEF_YY_SIZE_T 202#ifndef YY_TYPEDEF_YY_SIZE_T
200#define YY_TYPEDEF_YY_SIZE_T 203#define YY_TYPEDEF_YY_SIZE_T
201typedef unsigned int yy_size_t; 204typedef size_t yy_size_t;
202#endif 205#endif
203 206
204#ifndef YY_STRUCT_YY_BUFFER_STATE 207#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -349,7 +352,7 @@ void yyfree (void * );
349 352
350/* Begin user sect3 */ 353/* Begin user sect3 */
351 354
352#define yywrap() 1 355#define yywrap(n) 1
353#define YY_SKIP_YYWRAP 356#define YY_SKIP_YYWRAP
354 357
355typedef unsigned char YY_CHAR; 358typedef unsigned char YY_CHAR;
@@ -389,19 +392,20 @@ struct yy_trans_info
389 flex_int32_t yy_verify; 392 flex_int32_t yy_verify;
390 flex_int32_t yy_nxt; 393 flex_int32_t yy_nxt;
391 }; 394 };
392static yyconst flex_int16_t yy_accept[94] = 395static yyconst flex_int16_t yy_accept[104] =
393 { 0, 396 { 0,
394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
395 21, 19, 16, 16, 19, 19, 19, 8, 8, 19, 398 21, 19, 16, 16, 19, 19, 19, 7, 7, 19,
396 8, 19, 19, 19, 19, 14, 15, 15, 19, 9, 399 7, 19, 19, 19, 19, 13, 14, 14, 19, 8,
397 9, 16, 0, 3, 0, 0, 10, 0, 0, 0, 400 8, 16, 0, 2, 0, 0, 9, 0, 0, 0,
398 0, 0, 0, 8, 8, 6, 0, 7, 0, 2, 401 0, 0, 0, 7, 7, 5, 0, 6, 0, 12,
399 0, 13, 13, 15, 15, 9, 0, 12, 10, 0, 402 12, 14, 14, 8, 0, 11, 9, 0, 0, 0,
400 0, 0, 0, 18, 0, 0, 0, 2, 9, 0, 403 0, 18, 0, 0, 0, 0, 8, 0, 17, 0,
401 17, 0, 0, 0, 11, 0, 0, 0, 0, 0, 404 0, 0, 0, 0, 10, 0, 0, 0, 0, 0,
402 0, 0, 0, 0, 4, 0, 0, 1, 0, 0, 405 0, 0, 0, 0, 0, 0, 0, 0, 3, 15,
403 0, 5, 0 406 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
404 407
408 0, 4, 0
405 } ; 409 } ;
406 410
407static yyconst flex_int32_t yy_ec[256] = 411static yyconst flex_int32_t yy_ec[256] =
@@ -444,122 +448,126 @@ static yyconst flex_int32_t yy_meta[36] =
444 7, 7, 7, 8, 1 448 7, 7, 7, 8, 1
445 } ; 449 } ;
446 450
447static yyconst flex_int16_t yy_base[107] = 451static yyconst flex_int16_t yy_base[117] =
448 { 0, 452 { 0,
449 0, 0, 32, 0, 53, 0, 76, 0, 108, 111, 453 0, 0, 30, 0, 44, 0, 67, 0, 97, 105,
450 280, 288, 37, 39, 33, 36, 106, 0, 123, 146, 454 302, 303, 35, 44, 40, 94, 112, 0, 129, 152,
451 255, 251, 45, 0, 159, 288, 0, 53, 108, 172, 455 296, 295, 159, 0, 176, 303, 0, 116, 95, 165,
452 114, 127, 158, 288, 245, 0, 0, 234, 235, 236, 456 49, 46, 102, 303, 296, 0, 0, 288, 290, 293,
453 197, 195, 199, 0, 0, 288, 0, 288, 160, 288, 457 264, 266, 270, 0, 0, 303, 0, 303, 264, 303,
454 183, 288, 0, 0, 183, 182, 0, 0, 0, 0, 458 0, 0, 195, 101, 0, 0, 0, 0, 284, 125,
455 204, 189, 207, 288, 179, 187, 180, 194, 0, 171, 459 277, 265, 225, 230, 216, 218, 0, 202, 224, 221,
456 288, 196, 178, 174, 288, 169, 169, 177, 165, 153, 460 217, 107, 196, 188, 303, 206, 179, 186, 178, 185,
457 143, 155, 137, 118, 288, 122, 42, 288, 36, 36, 461 183, 162, 161, 150, 169, 160, 145, 125, 303, 303,
458 40, 288, 288, 212, 218, 223, 229, 234, 239, 245, 462 137, 109, 190, 103, 203, 167, 108, 197, 303, 123,
459 463
460 251, 255, 262, 270, 275, 280 464 29, 303, 303, 215, 221, 226, 229, 234, 240, 246,
465 250, 257, 265, 270, 275, 282
461 } ; 466 } ;
462 467
463static yyconst flex_int16_t yy_def[107] = 468static yyconst flex_int16_t yy_def[117] =
464 { 0, 469 { 0,
465 93, 1, 1, 3, 3, 5, 93, 7, 3, 3, 470 103, 1, 1, 3, 3, 5, 103, 7, 3, 3,
466 93, 93, 93, 93, 94, 95, 93, 96, 93, 19, 471 103, 103, 103, 103, 104, 105, 103, 106, 103, 19,
467 19, 20, 97, 98, 20, 93, 99, 100, 95, 93, 472 19, 20, 103, 107, 20, 103, 108, 109, 105, 103,
468 93, 93, 94, 93, 94, 101, 102, 93, 103, 104, 473 103, 103, 104, 103, 104, 110, 111, 103, 112, 113,
469 93, 93, 93, 96, 19, 93, 20, 93, 97, 93, 474 103, 103, 103, 106, 19, 103, 20, 103, 103, 103,
470 97, 93, 20, 99, 100, 93, 105, 101, 102, 106, 475 20, 108, 109, 103, 114, 110, 111, 115, 112, 112,
471 103, 103, 104, 93, 93, 93, 93, 94, 105, 106, 476 113, 103, 103, 103, 103, 103, 114, 115, 103, 103,
472 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 477 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
473 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 478 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
474 93, 93, 0, 93, 93, 93, 93, 93, 93, 93, 479 103, 103, 103, 103, 103, 116, 103, 116, 103, 116,
475 480
476 93, 93, 93, 93, 93, 93 481 103, 103, 0, 103, 103, 103, 103, 103, 103, 103,
482 103, 103, 103, 103, 103, 103
477 } ; 483 } ;
478 484
479static yyconst flex_int16_t yy_nxt[324] = 485static yyconst flex_int16_t yy_nxt[339] =
480 { 0, 486 { 0,
481 12, 13, 14, 15, 12, 16, 12, 12, 12, 17, 487 12, 13, 14, 15, 12, 16, 12, 12, 12, 17,
482 18, 18, 18, 12, 19, 20, 20, 12, 12, 21, 488 18, 18, 18, 12, 19, 20, 20, 12, 12, 21,
483 19, 21, 19, 22, 20, 20, 20, 20, 20, 20, 489 19, 21, 19, 22, 20, 20, 20, 20, 20, 20,
484 20, 20, 20, 12, 12, 23, 34, 12, 32, 32, 490 20, 20, 20, 12, 12, 12, 32, 32, 102, 23,
485 32, 32, 12, 12, 12, 36, 20, 33, 50, 92, 491 12, 12, 12, 34, 20, 32, 32, 32, 32, 20,
486 35, 20, 20, 20, 20, 20, 15, 54, 91, 54, 492 20, 20, 20, 20, 24, 24, 24, 35, 25, 54,
487 54, 54, 51, 24, 24, 24, 46, 25, 90, 38, 493 54, 54, 26, 25, 25, 25, 25, 12, 13, 14,
488 89, 26, 25, 25, 25, 25, 12, 13, 14, 15, 494 15, 27, 12, 27, 27, 27, 23, 27, 27, 27,
489 27, 12, 27, 27, 27, 17, 27, 27, 27, 12, 495 12, 28, 28, 28, 12, 12, 28, 28, 28, 28,
490 28, 28, 28, 12, 12, 28, 28, 28, 28, 28, 496 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
491 497
492 28, 28, 28, 28, 28, 28, 28, 28, 28, 12, 498 12, 12, 29, 36, 103, 34, 17, 30, 31, 31,
493 12, 15, 39, 29, 15, 40, 29, 93, 30, 31, 499 29, 54, 54, 54, 17, 30, 31, 31, 39, 35,
494 31, 30, 31, 31, 56, 56, 56, 41, 32, 32, 500 52, 40, 52, 52, 52, 103, 78, 38, 38, 46,
495 42, 88, 43, 45, 45, 45, 46, 45, 47, 47, 501 101, 60, 79, 41, 69, 97, 42, 94, 43, 45,
496 87, 38, 45, 45, 45, 45, 47, 47, 47, 47, 502 45, 45, 46, 45, 47, 47, 93, 92, 45, 45,
497 47, 47, 47, 47, 47, 47, 47, 47, 47, 86, 503 45, 45, 47, 47, 47, 47, 47, 47, 47, 47,
498 47, 34, 33, 50, 85, 47, 47, 47, 47, 53, 504 47, 47, 47, 47, 47, 39, 47, 91, 40, 90,
499 53, 53, 84, 53, 83, 35, 82, 51, 53, 53, 505 99, 47, 47, 47, 47, 54, 54, 54, 89, 88,
500 53, 53, 56, 56, 56, 93, 68, 54, 57, 54, 506 41, 55, 87, 49, 100, 43, 51, 51, 51, 86,
501 54, 54, 56, 56, 56, 62, 46, 34, 71, 81, 507 51, 95, 95, 96, 85, 51, 51, 51, 51, 52,
502 508
503 80, 79, 78, 77, 76, 75, 74, 73, 72, 64, 509 99, 52, 52, 52, 95, 95, 96, 84, 46, 83,
504 62, 35, 33, 33, 33, 33, 33, 33, 33, 33, 510 82, 81, 39, 79, 100, 33, 33, 33, 33, 33,
505 37, 67, 66, 37, 37, 37, 44, 65, 44, 49, 511 33, 33, 33, 37, 80, 77, 37, 37, 37, 44,
506 49, 49, 49, 49, 49, 49, 49, 52, 64, 52, 512 40, 44, 50, 76, 50, 52, 75, 52, 74, 52,
507 54, 62, 54, 60, 54, 54, 55, 93, 55, 55, 513 52, 53, 73, 53, 53, 53, 53, 56, 56, 56,
508 55, 55, 58, 58, 58, 48, 58, 58, 59, 48, 514 72, 56, 56, 57, 71, 57, 57, 59, 59, 59,
509 59, 59, 61, 61, 61, 61, 61, 61, 61, 61, 515 59, 59, 59, 59, 59, 61, 61, 61, 61, 61,
510 63, 63, 63, 63, 63, 63, 63, 63, 69, 93, 516 61, 61, 61, 67, 70, 67, 68, 68, 68, 62,
511 69, 70, 70, 70, 93, 70, 70, 11, 93, 93, 517 68, 68, 98, 98, 98, 98, 98, 98, 98, 98,
512 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 518 60, 66, 65, 64, 63, 62, 60, 58, 103, 48,
513 519
514 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 520 48, 103, 11, 103, 103, 103, 103, 103, 103, 103,
515 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 521 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
516 93, 93, 93 522 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
523 103, 103, 103, 103, 103, 103, 103, 103
517 } ; 524 } ;
518 525
519static yyconst flex_int16_t yy_chk[324] = 526static yyconst flex_int16_t yy_chk[339] =
520 { 0, 527 { 0,
521 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 528 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
522 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 529 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
523 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 530 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
524 1, 1, 1, 1, 1, 3, 15, 3, 13, 13, 531 1, 1, 1, 1, 1, 3, 13, 13, 101, 3,
525 14, 14, 3, 3, 3, 16, 3, 23, 23, 91, 532 3, 3, 3, 15, 3, 14, 14, 32, 32, 3,
526 15, 3, 3, 3, 3, 3, 5, 28, 90, 28, 533 3, 3, 3, 3, 5, 5, 5, 15, 5, 31,
527 28, 28, 23, 5, 5, 5, 28, 5, 89, 16, 534 31, 31, 5, 5, 5, 5, 5, 7, 7, 7,
528 87, 5, 5, 5, 5, 5, 7, 7, 7, 7,
529 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 535 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
530 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 536 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
531
532 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 537 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
533 7, 9, 17, 9, 10, 17, 10, 29, 9, 9, 538
534 9, 10, 10, 10, 31, 31, 31, 17, 32, 32, 539 7, 7, 9, 16, 29, 33, 9, 9, 9, 9,
535 17, 86, 17, 19, 19, 19, 19, 19, 19, 19, 540 10, 54, 54, 54, 10, 10, 10, 10, 17, 33,
536 84, 29, 19, 19, 19, 19, 19, 19, 19, 19, 541 28, 17, 28, 28, 28, 100, 72, 16, 29, 28,
537 19, 19, 19, 19, 19, 19, 20, 20, 20, 83, 542 97, 60, 72, 17, 60, 94, 17, 92, 17, 19,
538 20, 33, 49, 49, 82, 20, 20, 20, 20, 25, 543 19, 19, 19, 19, 19, 19, 91, 88, 19, 19,
539 25, 25, 81, 25, 80, 33, 79, 49, 25, 25, 544 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
540 25, 25, 30, 30, 30, 51, 51, 55, 30, 55, 545 19, 19, 20, 20, 20, 23, 20, 87, 23, 86,
541 55, 55, 56, 56, 56, 62, 55, 68, 62, 78, 546 96, 20, 20, 20, 20, 30, 30, 30, 85, 84,
542 547 23, 30, 83, 23, 96, 23, 25, 25, 25, 82,
543 77, 76, 74, 73, 72, 70, 67, 66, 65, 63, 548 25, 93, 93, 93, 81, 25, 25, 25, 25, 53,
544 61, 68, 94, 94, 94, 94, 94, 94, 94, 94, 549
545 95, 43, 42, 95, 95, 95, 96, 41, 96, 97, 550 98, 53, 53, 53, 95, 95, 95, 80, 53, 79,
546 97, 97, 97, 97, 97, 97, 97, 98, 40, 98, 551 78, 77, 76, 74, 98, 104, 104, 104, 104, 104,
547 99, 39, 99, 38, 99, 99, 100, 35, 100, 100, 552 104, 104, 104, 105, 73, 71, 105, 105, 105, 106,
548 100, 100, 101, 101, 101, 22, 101, 101, 102, 21, 553 70, 106, 107, 69, 107, 108, 68, 108, 66, 108,
549 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 554 108, 109, 65, 109, 109, 109, 109, 110, 110, 110,
550 104, 104, 104, 104, 104, 104, 104, 104, 105, 11, 555 64, 110, 110, 111, 63, 111, 111, 112, 112, 112,
551 105, 106, 106, 106, 0, 106, 106, 93, 93, 93, 556 112, 112, 112, 112, 112, 113, 113, 113, 113, 113,
552 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 557 113, 113, 113, 114, 62, 114, 115, 115, 115, 61,
553 558 115, 115, 116, 116, 116, 116, 116, 116, 116, 116,
554 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 559 59, 49, 43, 42, 41, 40, 39, 38, 35, 22,
555 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 560
556 93, 93, 93 561 21, 11, 103, 103, 103, 103, 103, 103, 103, 103,
562 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
563 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
564 103, 103, 103, 103, 103, 103, 103, 103
557 } ; 565 } ;
558 566
559/* Table of booleans, true if rule could match eol. */ 567/* Table of booleans, true if rule could match eol. */
560static yyconst flex_int32_t yy_rule_can_match_eol[21] = 568static yyconst flex_int32_t yy_rule_can_match_eol[21] =
561 { 0, 569 { 0,
5620, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 5701, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
563 0, }; 571 0, };
564 572
565static yy_state_type yy_last_accepting_state; 573static yy_state_type yy_last_accepting_state;
@@ -600,7 +608,7 @@ char *yytext;
600 608
601 609
602 610
603#line 33 "dtc-lexer.l" 611#line 37 "dtc-lexer.l"
604#include "dtc.h" 612#include "dtc.h"
605#include "srcpos.h" 613#include "srcpos.h"
606#include "dtc-parser.tab.h" 614#include "dtc-parser.tab.h"
@@ -623,7 +631,10 @@ static int dts_version; /* = 0 */
623 DPRINT("<V1>\n"); \ 631 DPRINT("<V1>\n"); \
624 BEGIN(V1); \ 632 BEGIN(V1); \
625 } 633 }
626#line 627 "dtc-lexer.lex.c" 634
635static void push_input_file(const char *filename);
636static int pop_input_file(void);
637#line 638 "dtc-lexer.lex.c"
627 638
628#define INITIAL 0 639#define INITIAL 0
629#define INCLUDE 1 640#define INCLUDE 1
@@ -685,7 +696,7 @@ static int input (void );
685/* This used to be an fputs(), but since the string might contain NUL's, 696/* This used to be an fputs(), but since the string might contain NUL's,
686 * we now use fwrite(). 697 * we now use fwrite().
687 */ 698 */
688#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) 699#define ECHO fwrite( yytext, yyleng, 1, yyout )
689#endif 700#endif
690 701
691/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 702/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -696,7 +707,7 @@ static int input (void );
696 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 707 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
697 { \ 708 { \
698 int c = '*'; \ 709 int c = '*'; \
699 size_t n; \ 710 int n; \
700 for ( n = 0; n < max_size && \ 711 for ( n = 0; n < max_size && \
701 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 712 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
702 buf[n] = (char) c; \ 713 buf[n] = (char) c; \
@@ -778,9 +789,9 @@ YY_DECL
778 register char *yy_cp, *yy_bp; 789 register char *yy_cp, *yy_bp;
779 register int yy_act; 790 register int yy_act;
780 791
781#line 57 "dtc-lexer.l" 792#line 64 "dtc-lexer.l"
782 793
783#line 784 "dtc-lexer.lex.c" 794#line 795 "dtc-lexer.lex.c"
784 795
785 if ( !(yy_init) ) 796 if ( !(yy_init) )
786 { 797 {
@@ -833,13 +844,13 @@ yy_match:
833 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 844 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
834 { 845 {
835 yy_current_state = (int) yy_def[yy_current_state]; 846 yy_current_state = (int) yy_def[yy_current_state];
836 if ( yy_current_state >= 94 ) 847 if ( yy_current_state >= 104 )
837 yy_c = yy_meta[(unsigned int) yy_c]; 848 yy_c = yy_meta[(unsigned int) yy_c];
838 } 849 }
839 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 850 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
840 ++yy_cp; 851 ++yy_cp;
841 } 852 }
842 while ( yy_base[yy_current_state] != 288 ); 853 while ( yy_base[yy_current_state] != 303 );
843 854
844yy_find_action: 855yy_find_action:
845 yy_act = yy_accept[yy_current_state]; 856 yy_act = yy_accept[yy_current_state];
@@ -874,20 +885,13 @@ do_action: /* This label is used only to access EOF actions. */
874 goto yy_find_action; 885 goto yy_find_action;
875 886
876case 1: 887case 1:
888/* rule 1 can match eol */
877YY_RULE_SETUP 889YY_RULE_SETUP
878#line 58 "dtc-lexer.l" 890#line 65 "dtc-lexer.l"
879BEGIN(INCLUDE);
880 YY_BREAK
881case 2:
882YY_RULE_SETUP
883#line 60 "dtc-lexer.l"
884{ 891{
885 yytext[strlen(yytext) - 1] = 0; 892 char *name = strchr(yytext, '\"') + 1;
886 if (!push_input_file(yytext + 1)) { 893 yytext[yyleng-1] = '\0';
887 /* Some unrecoverable error.*/ 894 push_input_file(name);
888 exit(1);
889 }
890 BEGIN_DEFAULT();
891 } 895 }
892 YY_BREAK 896 YY_BREAK
893case YY_STATE_EOF(INITIAL): 897case YY_STATE_EOF(INITIAL):
@@ -895,19 +899,19 @@ case YY_STATE_EOF(INCLUDE):
895case YY_STATE_EOF(BYTESTRING): 899case YY_STATE_EOF(BYTESTRING):
896case YY_STATE_EOF(PROPNODENAME): 900case YY_STATE_EOF(PROPNODENAME):
897case YY_STATE_EOF(V1): 901case YY_STATE_EOF(V1):
898#line 70 "dtc-lexer.l" 902#line 71 "dtc-lexer.l"
899{ 903{
900 if (!pop_input_file()) { 904 if (!pop_input_file()) {
901 yyterminate(); 905 yyterminate();
902 } 906 }
903 } 907 }
904 YY_BREAK 908 YY_BREAK
905case 3: 909case 2:
906/* rule 3 can match eol */ 910/* rule 2 can match eol */
907YY_RULE_SETUP 911YY_RULE_SETUP
908#line 76 "dtc-lexer.l" 912#line 77 "dtc-lexer.l"
909{ 913{
910 yylloc.filenum = srcpos_filenum; 914 yylloc.file = srcpos_file;
911 yylloc.first_line = yylineno; 915 yylloc.first_line = yylineno;
912 DPRINT("String: %s\n", yytext); 916 DPRINT("String: %s\n", yytext);
913 yylval.data = data_copy_escape_string(yytext+1, 917 yylval.data = data_copy_escape_string(yytext+1,
@@ -916,11 +920,11 @@ YY_RULE_SETUP
916 return DT_STRING; 920 return DT_STRING;
917 } 921 }
918 YY_BREAK 922 YY_BREAK
919case 4: 923case 3:
920YY_RULE_SETUP 924YY_RULE_SETUP
921#line 86 "dtc-lexer.l" 925#line 87 "dtc-lexer.l"
922{ 926{
923 yylloc.filenum = srcpos_filenum; 927 yylloc.file = srcpos_file;
924 yylloc.first_line = yylineno; 928 yylloc.first_line = yylineno;
925 DPRINT("Keyword: /dts-v1/\n"); 929 DPRINT("Keyword: /dts-v1/\n");
926 dts_version = 1; 930 dts_version = 1;
@@ -928,22 +932,22 @@ YY_RULE_SETUP
928 return DT_V1; 932 return DT_V1;
929 } 933 }
930 YY_BREAK 934 YY_BREAK
931case 5: 935case 4:
932YY_RULE_SETUP 936YY_RULE_SETUP
933#line 95 "dtc-lexer.l" 937#line 96 "dtc-lexer.l"
934{ 938{
935 yylloc.filenum = srcpos_filenum; 939 yylloc.file = srcpos_file;
936 yylloc.first_line = yylineno; 940 yylloc.first_line = yylineno;
937 DPRINT("Keyword: /memreserve/\n"); 941 DPRINT("Keyword: /memreserve/\n");
938 BEGIN_DEFAULT(); 942 BEGIN_DEFAULT();
939 return DT_MEMRESERVE; 943 return DT_MEMRESERVE;
940 } 944 }
941 YY_BREAK 945 YY_BREAK
942case 6: 946case 5:
943YY_RULE_SETUP 947YY_RULE_SETUP
944#line 103 "dtc-lexer.l" 948#line 104 "dtc-lexer.l"
945{ 949{
946 yylloc.filenum = srcpos_filenum; 950 yylloc.file = srcpos_file;
947 yylloc.first_line = yylineno; 951 yylloc.first_line = yylineno;
948 DPRINT("Label: %s\n", yytext); 952 DPRINT("Label: %s\n", yytext);
949 yylval.labelref = strdup(yytext); 953 yylval.labelref = strdup(yytext);
@@ -951,11 +955,11 @@ YY_RULE_SETUP
951 return DT_LABEL; 955 return DT_LABEL;
952 } 956 }
953 YY_BREAK 957 YY_BREAK
954case 7: 958case 6:
955YY_RULE_SETUP 959YY_RULE_SETUP
956#line 112 "dtc-lexer.l" 960#line 113 "dtc-lexer.l"
957{ 961{
958 yylloc.filenum = srcpos_filenum; 962 yylloc.file = srcpos_file;
959 yylloc.first_line = yylineno; 963 yylloc.first_line = yylineno;
960 if (*yytext == 'b') 964 if (*yytext == 'b')
961 yylval.cbase = 2; 965 yylval.cbase = 2;
@@ -969,44 +973,44 @@ YY_RULE_SETUP
969 return DT_BASE; 973 return DT_BASE;
970 } 974 }
971 YY_BREAK 975 YY_BREAK
972case 8: 976case 7:
973YY_RULE_SETUP 977YY_RULE_SETUP
974#line 127 "dtc-lexer.l" 978#line 128 "dtc-lexer.l"
975{ 979{
976 yylloc.filenum = srcpos_filenum; 980 yylloc.file = srcpos_file;
977 yylloc.first_line = yylineno; 981 yylloc.first_line = yylineno;
978 yylval.literal = strdup(yytext); 982 yylval.literal = strdup(yytext);
979 DPRINT("Literal: '%s'\n", yylval.literal); 983 DPRINT("Literal: '%s'\n", yylval.literal);
980 return DT_LEGACYLITERAL; 984 return DT_LEGACYLITERAL;
981 } 985 }
982 YY_BREAK 986 YY_BREAK
983case 9: 987case 8:
984YY_RULE_SETUP 988YY_RULE_SETUP
985#line 135 "dtc-lexer.l" 989#line 136 "dtc-lexer.l"
986{ 990{
987 yylloc.filenum = srcpos_filenum; 991 yylloc.file = srcpos_file;
988 yylloc.first_line = yylineno; 992 yylloc.first_line = yylineno;
989 yylval.literal = strdup(yytext); 993 yylval.literal = strdup(yytext);
990 DPRINT("Literal: '%s'\n", yylval.literal); 994 DPRINT("Literal: '%s'\n", yylval.literal);
991 return DT_LITERAL; 995 return DT_LITERAL;
992 } 996 }
993 YY_BREAK 997 YY_BREAK
994case 10: 998case 9:
995YY_RULE_SETUP 999YY_RULE_SETUP
996#line 143 "dtc-lexer.l" 1000#line 144 "dtc-lexer.l"
997{ /* label reference */ 1001{ /* label reference */
998 yylloc.filenum = srcpos_filenum; 1002 yylloc.file = srcpos_file;
999 yylloc.first_line = yylineno; 1003 yylloc.first_line = yylineno;
1000 DPRINT("Ref: %s\n", yytext+1); 1004 DPRINT("Ref: %s\n", yytext+1);
1001 yylval.labelref = strdup(yytext+1); 1005 yylval.labelref = strdup(yytext+1);
1002 return DT_REF; 1006 return DT_REF;
1003 } 1007 }
1004 YY_BREAK 1008 YY_BREAK
1005case 11: 1009case 10:
1006YY_RULE_SETUP 1010YY_RULE_SETUP
1007#line 151 "dtc-lexer.l" 1011#line 152 "dtc-lexer.l"
1008{ /* new-style path reference */ 1012{ /* new-style path reference */
1009 yylloc.filenum = srcpos_filenum; 1013 yylloc.file = srcpos_file;
1010 yylloc.first_line = yylineno; 1014 yylloc.first_line = yylineno;
1011 yytext[yyleng-1] = '\0'; 1015 yytext[yyleng-1] = '\0';
1012 DPRINT("Ref: %s\n", yytext+2); 1016 DPRINT("Ref: %s\n", yytext+2);
@@ -1014,44 +1018,44 @@ YY_RULE_SETUP
1014 return DT_REF; 1018 return DT_REF;
1015 } 1019 }
1016 YY_BREAK 1020 YY_BREAK
1017case 12: 1021case 11:
1018YY_RULE_SETUP 1022YY_RULE_SETUP
1019#line 160 "dtc-lexer.l" 1023#line 161 "dtc-lexer.l"
1020{ /* old-style path reference */ 1024{ /* old-style path reference */
1021 yylloc.filenum = srcpos_filenum; 1025 yylloc.file = srcpos_file;
1022 yylloc.first_line = yylineno; 1026 yylloc.first_line = yylineno;
1023 DPRINT("Ref: %s\n", yytext+1); 1027 DPRINT("Ref: %s\n", yytext+1);
1024 yylval.labelref = strdup(yytext+1); 1028 yylval.labelref = strdup(yytext+1);
1025 return DT_REF; 1029 return DT_REF;
1026 } 1030 }
1027 YY_BREAK 1031 YY_BREAK
1028case 13: 1032case 12:
1029YY_RULE_SETUP 1033YY_RULE_SETUP
1030#line 168 "dtc-lexer.l" 1034#line 169 "dtc-lexer.l"
1031{ 1035{
1032 yylloc.filenum = srcpos_filenum; 1036 yylloc.file = srcpos_file;
1033 yylloc.first_line = yylineno; 1037 yylloc.first_line = yylineno;
1034 yylval.byte = strtol(yytext, NULL, 16); 1038 yylval.byte = strtol(yytext, NULL, 16);
1035 DPRINT("Byte: %02x\n", (int)yylval.byte); 1039 DPRINT("Byte: %02x\n", (int)yylval.byte);
1036 return DT_BYTE; 1040 return DT_BYTE;
1037 } 1041 }
1038 YY_BREAK 1042 YY_BREAK
1039case 14: 1043case 13:
1040YY_RULE_SETUP 1044YY_RULE_SETUP
1041#line 176 "dtc-lexer.l" 1045#line 177 "dtc-lexer.l"
1042{ 1046{
1043 yylloc.filenum = srcpos_filenum; 1047 yylloc.file = srcpos_file;
1044 yylloc.first_line = yylineno; 1048 yylloc.first_line = yylineno;
1045 DPRINT("/BYTESTRING\n"); 1049 DPRINT("/BYTESTRING\n");
1046 BEGIN_DEFAULT(); 1050 BEGIN_DEFAULT();
1047 return ']'; 1051 return ']';
1048 } 1052 }
1049 YY_BREAK 1053 YY_BREAK
1050case 15: 1054case 14:
1051YY_RULE_SETUP 1055YY_RULE_SETUP
1052#line 184 "dtc-lexer.l" 1056#line 185 "dtc-lexer.l"
1053{ 1057{
1054 yylloc.filenum = srcpos_filenum; 1058 yylloc.file = srcpos_file;
1055 yylloc.first_line = yylineno; 1059 yylloc.first_line = yylineno;
1056 DPRINT("PropNodeName: %s\n", yytext); 1060 DPRINT("PropNodeName: %s\n", yytext);
1057 yylval.propnodename = strdup(yytext); 1061 yylval.propnodename = strdup(yytext);
@@ -1059,34 +1063,39 @@ YY_RULE_SETUP
1059 return DT_PROPNODENAME; 1063 return DT_PROPNODENAME;
1060 } 1064 }
1061 YY_BREAK 1065 YY_BREAK
1066case 15:
1067YY_RULE_SETUP
1068#line 194 "dtc-lexer.l"
1069{
1070 yylloc.file = srcpos_file;
1071 yylloc.first_line = yylineno;
1072 DPRINT("Binary Include\n");
1073 return DT_INCBIN;
1074 }
1075 YY_BREAK
1062case 16: 1076case 16:
1063/* rule 16 can match eol */ 1077/* rule 16 can match eol */
1064YY_RULE_SETUP 1078YY_RULE_SETUP
1065#line 194 "dtc-lexer.l" 1079#line 201 "dtc-lexer.l"
1066/* eat whitespace */ 1080/* eat whitespace */
1067 YY_BREAK 1081 YY_BREAK
1068case 17: 1082case 17:
1069/* rule 17 can match eol */ 1083/* rule 17 can match eol */
1070YY_RULE_SETUP 1084YY_RULE_SETUP
1071#line 196 "dtc-lexer.l" 1085#line 202 "dtc-lexer.l"
1072{ 1086/* eat C-style comments */
1073 yylloc.filenum = srcpos_filenum;
1074 yylloc.first_line = yylineno;
1075 DPRINT("Comment: %s\n", yytext);
1076 /* eat comments */
1077 }
1078 YY_BREAK 1087 YY_BREAK
1079case 18: 1088case 18:
1080/* rule 18 can match eol */ 1089/* rule 18 can match eol */
1081YY_RULE_SETUP 1090YY_RULE_SETUP
1082#line 203 "dtc-lexer.l" 1091#line 203 "dtc-lexer.l"
1083/* eat line comments */ 1092/* eat C++-style comments */
1084 YY_BREAK 1093 YY_BREAK
1085case 19: 1094case 19:
1086YY_RULE_SETUP 1095YY_RULE_SETUP
1087#line 205 "dtc-lexer.l" 1096#line 205 "dtc-lexer.l"
1088{ 1097{
1089 yylloc.filenum = srcpos_filenum; 1098 yylloc.file = srcpos_file;
1090 yylloc.first_line = yylineno; 1099 yylloc.first_line = yylineno;
1091 DPRINT("Char: %c (\\x%02x)\n", yytext[0], 1100 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1092 (unsigned)yytext[0]); 1101 (unsigned)yytext[0]);
@@ -1107,7 +1116,7 @@ YY_RULE_SETUP
1107#line 222 "dtc-lexer.l" 1116#line 222 "dtc-lexer.l"
1108ECHO; 1117ECHO;
1109 YY_BREAK 1118 YY_BREAK
1110#line 1111 "dtc-lexer.lex.c" 1119#line 1120 "dtc-lexer.lex.c"
1111 1120
1112 case YY_END_OF_BUFFER: 1121 case YY_END_OF_BUFFER:
1113 { 1122 {
@@ -1360,6 +1369,14 @@ static int yy_get_next_buffer (void)
1360 else 1369 else
1361 ret_val = EOB_ACT_CONTINUE_SCAN; 1370 ret_val = EOB_ACT_CONTINUE_SCAN;
1362 1371
1372 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1373 /* Extend the array by 50%, plus the number we really need. */
1374 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1375 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1376 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1377 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1378 }
1379
1363 (yy_n_chars) += number_to_move; 1380 (yy_n_chars) += number_to_move;
1364 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1381 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1365 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1382 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1389,7 +1406,7 @@ static int yy_get_next_buffer (void)
1389 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1406 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1390 { 1407 {
1391 yy_current_state = (int) yy_def[yy_current_state]; 1408 yy_current_state = (int) yy_def[yy_current_state];
1392 if ( yy_current_state >= 94 ) 1409 if ( yy_current_state >= 104 )
1393 yy_c = yy_meta[(unsigned int) yy_c]; 1410 yy_c = yy_meta[(unsigned int) yy_c];
1394 } 1411 }
1395 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1412 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1417,11 +1434,11 @@ static int yy_get_next_buffer (void)
1417 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1434 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1418 { 1435 {
1419 yy_current_state = (int) yy_def[yy_current_state]; 1436 yy_current_state = (int) yy_def[yy_current_state];
1420 if ( yy_current_state >= 94 ) 1437 if ( yy_current_state >= 104 )
1421 yy_c = yy_meta[(unsigned int) yy_c]; 1438 yy_c = yy_meta[(unsigned int) yy_c];
1422 } 1439 }
1423 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1440 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1424 yy_is_jam = (yy_current_state == 93); 1441 yy_is_jam = (yy_current_state == 103);
1425 1442
1426 return yy_is_jam ? 0 : yy_current_state; 1443 return yy_is_jam ? 0 : yy_current_state;
1427} 1444}
@@ -1743,7 +1760,9 @@ static void yyensure_buffer_stack (void)
1743 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1760 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1744 (num_to_alloc * sizeof(struct yy_buffer_state*) 1761 (num_to_alloc * sizeof(struct yy_buffer_state*)
1745 ); 1762 );
1746 1763 if ( ! (yy_buffer_stack) )
1764 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1765
1747 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1766 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1748 1767
1749 (yy_buffer_stack_max) = num_to_alloc; 1768 (yy_buffer_stack_max) = num_to_alloc;
@@ -1761,6 +1780,8 @@ static void yyensure_buffer_stack (void)
1761 ((yy_buffer_stack), 1780 ((yy_buffer_stack),
1762 num_to_alloc * sizeof(struct yy_buffer_state*) 1781 num_to_alloc * sizeof(struct yy_buffer_state*)
1763 ); 1782 );
1783 if ( ! (yy_buffer_stack) )
1784 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1764 1785
1765 /* zero only the new slots.*/ 1786 /* zero only the new slots.*/
1766 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1787 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -2072,14 +2093,13 @@ void yyfree (void * ptr )
2072 */ 2093 */
2073 2094
2074struct incl_file { 2095struct incl_file {
2075 int filenum; 2096 struct dtc_file *file;
2076 FILE *file;
2077 YY_BUFFER_STATE yy_prev_buf; 2097 YY_BUFFER_STATE yy_prev_buf;
2078 int yy_prev_lineno; 2098 int yy_prev_lineno;
2079 struct incl_file *prev; 2099 struct incl_file *prev;
2080}; 2100};
2081 2101
2082struct incl_file *incl_file_stack; 2102static struct incl_file *incl_file_stack;
2083 2103
2084 2104
2085/* 2105/*
@@ -2090,36 +2110,34 @@ struct incl_file *incl_file_stack;
2090static int incl_depth = 0; 2110static int incl_depth = 0;
2091 2111
2092 2112
2093int push_input_file(const char *filename) 2113static void push_input_file(const char *filename)
2094{ 2114{
2095 FILE *f;
2096 struct incl_file *incl_file; 2115 struct incl_file *incl_file;
2116 struct dtc_file *newfile;
2117 struct search_path search, *searchptr = NULL;
2097 2118
2098 if (!filename) { 2119 assert(filename);
2099 yyerror("No include file name given.");
2100 return 0;
2101 }
2102 2120
2103 if (incl_depth++ >= MAX_INCLUDE_DEPTH) { 2121 if (incl_depth++ >= MAX_INCLUDE_DEPTH)
2104 yyerror("Includes nested too deeply"); 2122 die("Includes nested too deeply");
2105 return 0; 2123
2124 if (srcpos_file) {
2125 search.dir = srcpos_file->dir;
2126 search.next = NULL;
2127 search.prev = NULL;
2128 searchptr = &search;
2106 } 2129 }
2107 2130
2108 f = dtc_open_file(filename); 2131 newfile = dtc_open_file(filename, searchptr);
2109 2132
2110 incl_file = malloc(sizeof(struct incl_file)); 2133 incl_file = xmalloc(sizeof(struct incl_file));
2111 if (!incl_file) {
2112 yyerror("Can not allocate include file space.");
2113 return 0;
2114 }
2115 2134
2116 /* 2135 /*
2117 * Save current context. 2136 * Save current context.
2118 */ 2137 */
2119 incl_file->yy_prev_buf = YY_CURRENT_BUFFER; 2138 incl_file->yy_prev_buf = YY_CURRENT_BUFFER;
2120 incl_file->yy_prev_lineno = yylineno; 2139 incl_file->yy_prev_lineno = yylineno;
2121 incl_file->filenum = srcpos_filenum; 2140 incl_file->file = srcpos_file;
2122 incl_file->file = yyin;
2123 incl_file->prev = incl_file_stack; 2141 incl_file->prev = incl_file_stack;
2124 2142
2125 incl_file_stack = incl_file; 2143 incl_file_stack = incl_file;
@@ -2127,23 +2145,21 @@ int push_input_file(const char *filename)
2127 /* 2145 /*
2128 * Establish new context. 2146 * Establish new context.
2129 */ 2147 */
2130 srcpos_filenum = lookup_file_name(filename, 0); 2148 srcpos_file = newfile;
2131 yylineno = 1; 2149 yylineno = 1;
2132 yyin = f; 2150 yyin = newfile->file;
2133 yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); 2151 yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
2134
2135 return 1;
2136} 2152}
2137 2153
2138 2154
2139int pop_input_file(void) 2155static int pop_input_file(void)
2140{ 2156{
2141 struct incl_file *incl_file; 2157 struct incl_file *incl_file;
2142 2158
2143 if (incl_file_stack == 0) 2159 if (incl_file_stack == 0)
2144 return 0; 2160 return 0;
2145 2161
2146 fclose(yyin); 2162 dtc_close_file(srcpos_file);
2147 2163
2148 /* 2164 /*
2149 * Pop. 2165 * Pop.
@@ -2158,17 +2174,14 @@ int pop_input_file(void)
2158 yy_delete_buffer(YY_CURRENT_BUFFER); 2174 yy_delete_buffer(YY_CURRENT_BUFFER);
2159 yy_switch_to_buffer(incl_file->yy_prev_buf); 2175 yy_switch_to_buffer(incl_file->yy_prev_buf);
2160 yylineno = incl_file->yy_prev_lineno; 2176 yylineno = incl_file->yy_prev_lineno;
2161 srcpos_filenum = incl_file->filenum; 2177 srcpos_file = incl_file->file;
2162 yyin = incl_file->file; 2178 yyin = incl_file->file ? incl_file->file->file : NULL;
2163 2179
2164 /* 2180 /*
2165 * Free old state. 2181 * Free old state.
2166 */ 2182 */
2167 free(incl_file); 2183 free(incl_file);
2168 2184
2169 if (YY_CURRENT_BUFFER == 0)
2170 return 0;
2171
2172 return 1; 2185 return 1;
2173} 2186}
2174 2187
diff --git a/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped b/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
index 28e6ec0296a1..27129377e5d2 100644
--- a/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
+++ b/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
@@ -75,7 +75,8 @@
75 DT_BYTE = 264, 75 DT_BYTE = 264,
76 DT_STRING = 265, 76 DT_STRING = 265,
77 DT_LABEL = 266, 77 DT_LABEL = 266,
78 DT_REF = 267 78 DT_REF = 267,
79 DT_INCBIN = 268
79 }; 80 };
80#endif 81#endif
81/* Tokens. */ 82/* Tokens. */
@@ -89,6 +90,7 @@
89#define DT_STRING 265 90#define DT_STRING 265
90#define DT_LABEL 266 91#define DT_LABEL 266
91#define DT_REF 267 92#define DT_REF 267
93#define DT_INCBIN 268
92 94
93 95
94 96
@@ -96,14 +98,17 @@
96/* Copy the first part of user declarations. */ 98/* Copy the first part of user declarations. */
97#line 23 "dtc-parser.y" 99#line 23 "dtc-parser.y"
98 100
101#include <stdio.h>
102
99#include "dtc.h" 103#include "dtc.h"
100#include "srcpos.h" 104#include "srcpos.h"
101 105
102int yylex(void); 106extern int yylex(void);
103unsigned long long eval_literal(const char *s, int base, int bits);
104 107
105extern struct boot_info *the_boot_info; 108extern struct boot_info *the_boot_info;
109extern int treesource_error;
106 110
111static unsigned long long eval_literal(const char *s, int base, int bits);
107 112
108 113
109/* Enabling traces. */ 114/* Enabling traces. */
@@ -126,16 +131,16 @@ extern struct boot_info *the_boot_info;
126 131
127#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 132#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
128typedef union YYSTYPE 133typedef union YYSTYPE
129#line 34 "dtc-parser.y" 134#line 37 "dtc-parser.y"
130{ 135{
131 char *propnodename; 136 char *propnodename;
132 char *literal; 137 char *literal;
133 char *labelref; 138 char *labelref;
134 unsigned int cbase; 139 unsigned int cbase;
135 u8 byte; 140 uint8_t byte;
136 struct data data; 141 struct data data;
137 142
138 u64 addr; 143 uint64_t addr;
139 cell_t cell; 144 cell_t cell;
140 struct property *prop; 145 struct property *prop;
141 struct property *proplist; 146 struct property *proplist;
@@ -144,7 +149,7 @@ typedef union YYSTYPE
144 struct reserve_info *re; 149 struct reserve_info *re;
145} 150}
146/* Line 187 of yacc.c. */ 151/* Line 187 of yacc.c. */
147#line 148 "dtc-parser.tab.c" 152#line 153 "dtc-parser.tab.c"
148 YYSTYPE; 153 YYSTYPE;
149# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 154# define yystype YYSTYPE /* obsolescent; will be withdrawn */
150# define YYSTYPE_IS_DECLARED 1 155# define YYSTYPE_IS_DECLARED 1
@@ -169,7 +174,7 @@ typedef struct YYLTYPE
169 174
170 175
171/* Line 216 of yacc.c. */ 176/* Line 216 of yacc.c. */
172#line 173 "dtc-parser.tab.c" 177#line 178 "dtc-parser.tab.c"
173 178
174#ifdef short 179#ifdef short
175# undef short 180# undef short
@@ -386,20 +391,20 @@ union yyalloc
386/* YYFINAL -- State number of the termination state. */ 391/* YYFINAL -- State number of the termination state. */
387#define YYFINAL 9 392#define YYFINAL 9
388/* YYLAST -- Last index in YYTABLE. */ 393/* YYLAST -- Last index in YYTABLE. */
389#define YYLAST 60 394#define YYLAST 73
390 395
391/* YYNTOKENS -- Number of terminals. */ 396/* YYNTOKENS -- Number of terminals. */
392#define YYNTOKENS 24 397#define YYNTOKENS 27
393/* YYNNTS -- Number of nonterminals. */ 398/* YYNNTS -- Number of nonterminals. */
394#define YYNNTS 20 399#define YYNNTS 20
395/* YYNRULES -- Number of rules. */ 400/* YYNRULES -- Number of rules. */
396#define YYNRULES 43 401#define YYNRULES 45
397/* YYNRULES -- Number of states. */ 402/* YYNRULES -- Number of states. */
398#define YYNSTATES 67 403#define YYNSTATES 76
399 404
400/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 405/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
401#define YYUNDEFTOK 2 406#define YYUNDEFTOK 2
402#define YYMAXUTOK 267 407#define YYMAXUTOK 268
403 408
404#define YYTRANSLATE(YYX) \ 409#define YYTRANSLATE(YYX) \
405 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 410 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -411,15 +416,15 @@ static const yytype_uint8 yytranslate[] =
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 23, 14, 2, 15, 2, 2, 419 24, 26, 2, 2, 25, 15, 2, 16, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 420 2, 2, 2, 2, 2, 2, 2, 2, 2, 14,
416 19, 18, 20, 2, 2, 2, 2, 2, 2, 2, 421 20, 19, 21, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 21, 2, 22, 2, 2, 2, 2, 2, 2, 424 2, 22, 2, 23, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 16, 2, 17, 2, 2, 2, 2, 427 2, 2, 2, 17, 2, 18, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -433,7 +438,7 @@ static const yytype_uint8 yytranslate[] =
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 440 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
436 5, 6, 7, 8, 9, 10, 11, 12 441 5, 6, 7, 8, 9, 10, 11, 12, 13
437}; 442};
438 443
439#if YYDEBUG 444#if YYDEBUG
@@ -443,37 +448,39 @@ static const yytype_uint8 yyprhs[] =
443{ 448{
444 0, 0, 3, 8, 11, 12, 15, 21, 22, 25, 449 0, 0, 3, 8, 11, 12, 15, 21, 22, 25,
445 27, 34, 36, 38, 41, 47, 48, 51, 57, 61, 450 27, 34, 36, 38, 41, 47, 48, 51, 57, 61,
446 64, 69, 74, 77, 80, 81, 84, 87, 88, 91, 451 64, 69, 74, 77, 87, 93, 96, 97, 100, 103,
447 94, 97, 98, 100, 102, 105, 106, 109, 112, 113, 452 104, 107, 110, 113, 114, 116, 118, 121, 122, 125,
448 116, 119, 123, 124 453 128, 129, 132, 135, 139, 140
449}; 454};
450 455
451/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 456/* YYRHS -- A `-1'-separated list of the rules' RHS. */
452static const yytype_int8 yyrhs[] = 457static const yytype_int8 yyrhs[] =
453{ 458{
454 25, 0, -1, 3, 13, 26, 31, -1, 28, 31, 459 28, 0, -1, 3, 14, 29, 34, -1, 31, 34,
455 -1, -1, 27, 26, -1, 43, 4, 30, 30, 13, 460 -1, -1, 30, 29, -1, 46, 4, 33, 33, 14,
456 -1, -1, 29, 28, -1, 27, -1, 43, 4, 30, 461 -1, -1, 32, 31, -1, 30, -1, 46, 4, 33,
457 14, 30, 13, -1, 6, -1, 7, -1, 15, 32, 462 15, 33, 14, -1, 6, -1, 7, -1, 16, 35,
458 -1, 16, 33, 41, 17, 13, -1, -1, 33, 34, 463 -1, 17, 36, 44, 18, 14, -1, -1, 36, 37,
459 -1, 43, 5, 18, 35, 13, -1, 43, 5, 13, 464 -1, 46, 5, 19, 38, 14, -1, 46, 5, 14,
460 -1, 36, 10, -1, 36, 19, 37, 20, -1, 36, 465 -1, 39, 10, -1, 39, 20, 40, 21, -1, 39,
461 21, 40, 22, -1, 36, 12, -1, 35, 11, -1, 466 22, 43, 23, -1, 39, 12, -1, 39, 13, 24,
462 -1, 35, 23, -1, 36, 11, -1, -1, 37, 39, 467 10, 25, 33, 25, 33, 26, -1, 39, 13, 24,
463 -1, 37, 12, -1, 37, 11, -1, -1, 8, -1, 468 10, 26, -1, 38, 11, -1, -1, 38, 25, -1,
464 6, -1, 38, 7, -1, -1, 40, 9, -1, 40, 469 39, 11, -1, -1, 40, 42, -1, 40, 12, -1,
465 11, -1, -1, 42, 41, -1, 42, 34, -1, 43, 470 40, 11, -1, -1, 8, -1, 6, -1, 41, 7,
466 5, 32, -1, -1, 11, -1 471 -1, -1, 43, 9, -1, 43, 11, -1, -1, 45,
472 44, -1, 45, 37, -1, 46, 5, 35, -1, -1,
473 11, -1
467}; 474};
468 475
469/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 476/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
470static const yytype_uint16 yyrline[] = 477static const yytype_uint16 yyrline[] =
471{ 478{
472 0, 85, 85, 89, 97, 100, 107, 115, 118, 125, 479 0, 89, 89, 93, 101, 104, 111, 119, 122, 129,
473 129, 136, 140, 147, 154, 162, 165, 172, 176, 183, 480 133, 140, 144, 151, 158, 166, 169, 176, 180, 187,
474 187, 191, 195, 199, 207, 210, 214, 222, 225, 229, 481 191, 195, 199, 203, 220, 231, 239, 242, 246, 254,
475 234, 242, 245, 249, 253, 261, 264, 268, 276, 279, 482 257, 261, 266, 274, 277, 281, 285, 293, 296, 300,
476 283, 291, 299, 302 483 308, 311, 315, 323, 331, 334
477}; 484};
478#endif 485#endif
479 486
@@ -484,12 +491,12 @@ static const char *const yytname[] =
484{ 491{
485 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", 492 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE",
486 "DT_PROPNODENAME", "DT_LITERAL", "DT_LEGACYLITERAL", "DT_BASE", 493 "DT_PROPNODENAME", "DT_LITERAL", "DT_LEGACYLITERAL", "DT_BASE",
487 "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", "';'", "'-'", "'/'", "'{'", 494 "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", "DT_INCBIN", "';'", "'-'",
488 "'}'", "'='", "'<'", "'>'", "'['", "']'", "','", "$accept", "sourcefile", 495 "'/'", "'{'", "'}'", "'='", "'<'", "'>'", "'['", "']'", "'('", "','",
489 "memreserves", "memreserve", "v0_memreserves", "v0_memreserve", "addr", 496 "')'", "$accept", "sourcefile", "memreserves", "memreserve",
490 "devicetree", "nodedef", "proplist", "propdef", "propdata", 497 "v0_memreserves", "v0_memreserve", "addr", "devicetree", "nodedef",
491 "propdataprefix", "celllist", "cellbase", "cellval", "bytestring", 498 "proplist", "propdef", "propdata", "propdataprefix", "celllist",
492 "subnodes", "subnode", "label", 0 499 "cellbase", "cellval", "bytestring", "subnodes", "subnode", "label", 0
493}; 500};
494#endif 501#endif
495 502
@@ -499,19 +506,19 @@ static const char *const yytname[] =
499static const yytype_uint16 yytoknum[] = 506static const yytype_uint16 yytoknum[] =
500{ 507{
501 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 508 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
502 265, 266, 267, 59, 45, 47, 123, 125, 61, 60, 509 265, 266, 267, 268, 59, 45, 47, 123, 125, 61,
503 62, 91, 93, 44 510 60, 62, 91, 93, 40, 44, 41
504}; 511};
505# endif 512# endif
506 513
507/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 514/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
508static const yytype_uint8 yyr1[] = 515static const yytype_uint8 yyr1[] =
509{ 516{
510 0, 24, 25, 25, 26, 26, 27, 28, 28, 29, 517 0, 27, 28, 28, 29, 29, 30, 31, 31, 32,
511 29, 30, 30, 31, 32, 33, 33, 34, 34, 35, 518 32, 33, 33, 34, 35, 36, 36, 37, 37, 38,
512 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 519 38, 38, 38, 38, 38, 38, 39, 39, 39, 40,
513 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 520 40, 40, 40, 41, 41, 42, 42, 43, 43, 43,
514 41, 42, 43, 43 521 44, 44, 44, 45, 46, 46
515}; 522};
516 523
517/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 524/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -519,9 +526,9 @@ static const yytype_uint8 yyr2[] =
519{ 526{
520 0, 2, 4, 2, 0, 2, 5, 0, 2, 1, 527 0, 2, 4, 2, 0, 2, 5, 0, 2, 1,
521 6, 1, 1, 2, 5, 0, 2, 5, 3, 2, 528 6, 1, 1, 2, 5, 0, 2, 5, 3, 2,
522 4, 4, 2, 2, 0, 2, 2, 0, 2, 2, 529 4, 4, 2, 9, 5, 2, 0, 2, 2, 0,
523 2, 0, 1, 1, 2, 0, 2, 2, 0, 2, 530 2, 2, 2, 0, 1, 1, 2, 0, 2, 2,
524 2, 3, 0, 1 531 0, 2, 2, 3, 0, 1
525}; 532};
526 533
527/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 534/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -529,81 +536,86 @@ static const yytype_uint8 yyr2[] =
529 means the default is an error. */ 536 means the default is an error. */
530static const yytype_uint8 yydefact[] = 537static const yytype_uint8 yydefact[] =
531{ 538{
532 7, 0, 43, 0, 9, 0, 7, 0, 4, 1, 539 7, 0, 45, 0, 9, 0, 7, 0, 4, 1,
533 0, 3, 8, 0, 0, 4, 0, 15, 13, 11, 540 0, 3, 8, 0, 0, 4, 0, 15, 13, 11,
534 12, 0, 2, 5, 0, 38, 0, 0, 0, 16, 541 12, 0, 2, 5, 0, 40, 0, 0, 0, 16,
535 0, 38, 0, 0, 6, 0, 40, 39, 0, 10, 542 0, 40, 0, 0, 6, 0, 42, 41, 0, 10,
536 14, 18, 24, 41, 0, 0, 23, 17, 25, 19, 543 14, 18, 26, 43, 0, 0, 25, 17, 27, 19,
537 26, 22, 27, 35, 31, 0, 33, 32, 30, 29, 544 28, 22, 0, 29, 37, 0, 33, 0, 0, 35,
538 20, 0, 28, 36, 37, 21, 34 545 34, 32, 31, 20, 0, 30, 38, 39, 21, 0,
546 24, 36, 0, 0, 0, 23
539}; 547};
540 548
541/* YYDEFGOTO[NTERM-NUM]. */ 549/* YYDEFGOTO[NTERM-NUM]. */
542static const yytype_int8 yydefgoto[] = 550static const yytype_int8 yydefgoto[] =
543{ 551{
544 -1, 3, 14, 4, 5, 6, 27, 11, 18, 25, 552 -1, 3, 14, 4, 5, 6, 27, 11, 18, 25,
545 29, 44, 45, 54, 61, 62, 55, 30, 31, 7 553 29, 44, 45, 56, 64, 65, 57, 30, 31, 7
546}; 554};
547 555
548/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 556/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
549 STATE-NUM. */ 557 STATE-NUM. */
550#define YYPACT_NINF -13 558#define YYPACT_NINF -14
551static const yytype_int8 yypact[] = 559static const yytype_int8 yypact[] =
552{ 560{
553 23, 11, -13, 37, -13, -4, 18, 39, 18, -13, 561 30, -11, -14, 7, -14, -1, 27, 13, 27, -14,
554 28, -13, -13, 34, -4, 18, 41, -13, -13, -13, 562 8, -14, -14, 40, -1, 27, 35, -14, -14, -14,
555 -13, 25, -13, -13, 34, -3, 34, 33, 34, -13, 563 -14, 21, -14, -14, 40, 24, 40, 28, 40, -14,
556 30, -3, 43, 36, -13, 38, -13, -13, 20, -13, 564 32, 24, 46, 38, -14, 39, -14, -14, 26, -14,
557 -13, -13, -13, -13, 2, 9, -13, -13, -13, -13, 565 -14, -14, -14, -14, -9, 10, -14, -14, -14, -14,
558 -13, -13, -13, -13, -2, -6, -13, -13, -13, -13, 566 -14, -14, 31, -14, -14, 44, -2, 3, 23, -14,
559 -13, 45, -13, -13, -13, -13, -13 567 -14, -14, -14, -14, 50, -14, -14, -14, -14, 40,
568 -14, -14, 33, 40, 36, -14
560}; 569};
561 570
562/* YYPGOTO[NTERM-NUM]. */ 571/* YYPGOTO[NTERM-NUM]. */
563static const yytype_int8 yypgoto[] = 572static const yytype_int8 yypgoto[] =
564{ 573{
565 -13, -13, 35, 27, 47, -13, -12, 40, 17, -13, 574 -14, -14, 48, 29, 53, -14, -13, 47, 34, -14,
566 26, -13, -13, -13, -13, -13, -13, 29, -13, -8 575 37, -14, -14, -14, -14, -14, -14, 42, -14, -7
567}; 576};
568 577
569/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 578/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
570 positive, shift that token. If negative, reduce the rule which 579 positive, shift that token. If negative, reduce the rule which
571 number is the opposite. If zero, do what YYDEFACT says. 580 number is the opposite. If zero, do what YYDEFACT says.
572 If YYTABLE_NINF, syntax error. */ 581 If YYTABLE_NINF, syntax error. */
573#define YYTABLE_NINF -43 582#define YYTABLE_NINF -45
574static const yytype_int8 yytable[] = 583static const yytype_int8 yytable[] =
575{ 584{
576 16, 21, -42, 63, 56, 64, 57, 16, 2, 58, 585 21, 16, 46, 8, 59, 47, 60, 9, 16, 61,
577 59, 10, 28, 46, 33, 47, 65, 32, 60, 49, 586 62, 28, 66, 33, 67, 10, 48, 13, 32, 63,
578 50, 51, -42, 32, 8, 48, 1, -42, 52, 2, 587 49, 50, 51, 52, 32, 17, 68, 19, 20, -44,
579 53, 19, 20, 41, 2, 15, 17, 9, 42, 26, 588 53, -44, 54, 1, -44, 2, 26, 15, 2, 24,
580 19, 20, 15, 13, 17, 24, 34, 35, 38, 39, 589 41, 2, 34, 17, 15, 42, 19, 20, 69, 70,
581 23, 40, 66, 12, 22, 43, 0, 36, 0, 0, 590 35, 38, 39, 40, 58, 55, 72, 71, 73, 12,
582 37 591 74, 22, 75, 23, 0, 0, 0, 0, 36, 0,
592 0, 0, 43, 37
583}; 593};
584 594
585static const yytype_int8 yycheck[] = 595static const yytype_int8 yycheck[] =
586{ 596{
587 8, 13, 5, 9, 6, 11, 8, 15, 11, 11, 597 13, 8, 11, 14, 6, 14, 8, 0, 15, 11,
588 12, 15, 24, 11, 26, 13, 22, 25, 20, 10, 598 12, 24, 9, 26, 11, 16, 25, 4, 25, 21,
589 11, 12, 4, 31, 13, 23, 3, 4, 19, 11, 599 10, 11, 12, 13, 31, 17, 23, 6, 7, 5,
590 21, 6, 7, 13, 11, 8, 16, 0, 18, 14, 600 20, 4, 22, 3, 4, 11, 15, 8, 11, 4,
591 6, 7, 15, 4, 16, 4, 13, 17, 5, 13, 601 14, 11, 14, 17, 15, 19, 6, 7, 25, 26,
592 15, 13, 7, 6, 14, 38, -1, 31, -1, -1, 602 18, 5, 14, 14, 10, 24, 69, 7, 25, 6,
593 31 603 73, 14, 26, 15, -1, -1, -1, -1, 31, -1,
604 -1, -1, 38, 31
594}; 605};
595 606
596/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 607/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
597 symbol of state STATE-NUM. */ 608 symbol of state STATE-NUM. */
598static const yytype_uint8 yystos[] = 609static const yytype_uint8 yystos[] =
599{ 610{
600 0, 3, 11, 25, 27, 28, 29, 43, 13, 0, 611 0, 3, 11, 28, 30, 31, 32, 46, 14, 0,
601 15, 31, 28, 4, 26, 27, 43, 16, 32, 6, 612 16, 34, 31, 4, 29, 30, 46, 17, 35, 6,
602 7, 30, 31, 26, 4, 33, 14, 30, 30, 34, 613 7, 33, 34, 29, 4, 36, 15, 33, 33, 37,
603 41, 42, 43, 30, 13, 17, 34, 41, 5, 13, 614 44, 45, 46, 33, 14, 18, 37, 44, 5, 14,
604 13, 13, 18, 32, 35, 36, 11, 13, 23, 10, 615 14, 14, 19, 35, 38, 39, 11, 14, 25, 10,
605 11, 12, 19, 21, 37, 40, 6, 8, 11, 12, 616 11, 12, 13, 20, 22, 24, 40, 43, 10, 6,
606 20, 38, 39, 9, 11, 22, 7 617 8, 11, 12, 21, 41, 42, 9, 11, 23, 25,
618 26, 7, 33, 25, 33, 26
607}; 619};
608 620
609#define yyerrok (yyerrstatus = 0) 621#define yyerrok (yyerrstatus = 0)
@@ -1440,289 +1452,323 @@ yyreduce:
1440 switch (yyn) 1452 switch (yyn)
1441 { 1453 {
1442 case 2: 1454 case 2:
1443#line 86 "dtc-parser.y" 1455#line 90 "dtc-parser.y"
1444 { 1456 {
1445 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node)); 1457 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), 0);
1446 ;} 1458 ;}
1447 break; 1459 break;
1448 1460
1449 case 3: 1461 case 3:
1450#line 90 "dtc-parser.y" 1462#line 94 "dtc-parser.y"
1451 { 1463 {
1452 the_boot_info = build_boot_info((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].node)); 1464 the_boot_info = build_boot_info((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].node), 0);
1453 ;} 1465 ;}
1454 break; 1466 break;
1455 1467
1456 case 4: 1468 case 4:
1457#line 97 "dtc-parser.y" 1469#line 101 "dtc-parser.y"
1458 { 1470 {
1459 (yyval.re) = NULL; 1471 (yyval.re) = NULL;
1460 ;} 1472 ;}
1461 break; 1473 break;
1462 1474
1463 case 5: 1475 case 5:
1464#line 101 "dtc-parser.y" 1476#line 105 "dtc-parser.y"
1465 { 1477 {
1466 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); 1478 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
1467 ;} 1479 ;}
1468 break; 1480 break;
1469 1481
1470 case 6: 1482 case 6:
1471#line 108 "dtc-parser.y" 1483#line 112 "dtc-parser.y"
1472 { 1484 {
1473 (yyval.re) = build_reserve_entry((yyvsp[(3) - (5)].addr), (yyvsp[(4) - (5)].addr), (yyvsp[(1) - (5)].labelref)); 1485 (yyval.re) = build_reserve_entry((yyvsp[(3) - (5)].addr), (yyvsp[(4) - (5)].addr), (yyvsp[(1) - (5)].labelref));
1474 ;} 1486 ;}
1475 break; 1487 break;
1476 1488
1477 case 7: 1489 case 7:
1478#line 115 "dtc-parser.y" 1490#line 119 "dtc-parser.y"
1479 { 1491 {
1480 (yyval.re) = NULL; 1492 (yyval.re) = NULL;
1481 ;} 1493 ;}
1482 break; 1494 break;
1483 1495
1484 case 8: 1496 case 8:
1485#line 119 "dtc-parser.y" 1497#line 123 "dtc-parser.y"
1486 { 1498 {
1487 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); 1499 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
1488 ;} 1500 ;}
1489 break; 1501 break;
1490 1502
1491 case 9: 1503 case 9:
1492#line 126 "dtc-parser.y" 1504#line 130 "dtc-parser.y"
1493 { 1505 {
1494 (yyval.re) = (yyvsp[(1) - (1)].re); 1506 (yyval.re) = (yyvsp[(1) - (1)].re);
1495 ;} 1507 ;}
1496 break; 1508 break;
1497 1509
1498 case 10: 1510 case 10:
1499#line 130 "dtc-parser.y" 1511#line 134 "dtc-parser.y"
1500 { 1512 {
1501 (yyval.re) = build_reserve_entry((yyvsp[(3) - (6)].addr), (yyvsp[(5) - (6)].addr) - (yyvsp[(3) - (6)].addr) + 1, (yyvsp[(1) - (6)].labelref)); 1513 (yyval.re) = build_reserve_entry((yyvsp[(3) - (6)].addr), (yyvsp[(5) - (6)].addr) - (yyvsp[(3) - (6)].addr) + 1, (yyvsp[(1) - (6)].labelref));
1502 ;} 1514 ;}
1503 break; 1515 break;
1504 1516
1505 case 11: 1517 case 11:
1506#line 137 "dtc-parser.y" 1518#line 141 "dtc-parser.y"
1507 { 1519 {
1508 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); 1520 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
1509 ;} 1521 ;}
1510 break; 1522 break;
1511 1523
1512 case 12: 1524 case 12:
1513#line 141 "dtc-parser.y" 1525#line 145 "dtc-parser.y"
1514 { 1526 {
1515 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 16, 64); 1527 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 16, 64);
1516 ;} 1528 ;}
1517 break; 1529 break;
1518 1530
1519 case 13: 1531 case 13:
1520#line 148 "dtc-parser.y" 1532#line 152 "dtc-parser.y"
1521 { 1533 {
1522 (yyval.node) = name_node((yyvsp[(2) - (2)].node), "", NULL); 1534 (yyval.node) = name_node((yyvsp[(2) - (2)].node), "", NULL);
1523 ;} 1535 ;}
1524 break; 1536 break;
1525 1537
1526 case 14: 1538 case 14:
1527#line 155 "dtc-parser.y" 1539#line 159 "dtc-parser.y"
1528 { 1540 {
1529 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); 1541 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
1530 ;} 1542 ;}
1531 break; 1543 break;
1532 1544
1533 case 15: 1545 case 15:
1534#line 162 "dtc-parser.y" 1546#line 166 "dtc-parser.y"
1535 { 1547 {
1536 (yyval.proplist) = NULL; 1548 (yyval.proplist) = NULL;
1537 ;} 1549 ;}
1538 break; 1550 break;
1539 1551
1540 case 16: 1552 case 16:
1541#line 166 "dtc-parser.y" 1553#line 170 "dtc-parser.y"
1542 { 1554 {
1543 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); 1555 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
1544 ;} 1556 ;}
1545 break; 1557 break;
1546 1558
1547 case 17: 1559 case 17:
1548#line 173 "dtc-parser.y" 1560#line 177 "dtc-parser.y"
1549 { 1561 {
1550 (yyval.prop) = build_property((yyvsp[(2) - (5)].propnodename), (yyvsp[(4) - (5)].data), (yyvsp[(1) - (5)].labelref)); 1562 (yyval.prop) = build_property((yyvsp[(2) - (5)].propnodename), (yyvsp[(4) - (5)].data), (yyvsp[(1) - (5)].labelref));
1551 ;} 1563 ;}
1552 break; 1564 break;
1553 1565
1554 case 18: 1566 case 18:
1555#line 177 "dtc-parser.y" 1567#line 181 "dtc-parser.y"
1556 { 1568 {
1557 (yyval.prop) = build_property((yyvsp[(2) - (3)].propnodename), empty_data, (yyvsp[(1) - (3)].labelref)); 1569 (yyval.prop) = build_property((yyvsp[(2) - (3)].propnodename), empty_data, (yyvsp[(1) - (3)].labelref));
1558 ;} 1570 ;}
1559 break; 1571 break;
1560 1572
1561 case 19: 1573 case 19:
1562#line 184 "dtc-parser.y" 1574#line 188 "dtc-parser.y"
1563 { 1575 {
1564 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); 1576 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
1565 ;} 1577 ;}
1566 break; 1578 break;
1567 1579
1568 case 20: 1580 case 20:
1569#line 188 "dtc-parser.y" 1581#line 192 "dtc-parser.y"
1570 { 1582 {
1571 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); 1583 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
1572 ;} 1584 ;}
1573 break; 1585 break;
1574 1586
1575 case 21: 1587 case 21:
1576#line 192 "dtc-parser.y" 1588#line 196 "dtc-parser.y"
1577 { 1589 {
1578 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); 1590 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
1579 ;} 1591 ;}
1580 break; 1592 break;
1581 1593
1582 case 22: 1594 case 22:
1583#line 196 "dtc-parser.y" 1595#line 200 "dtc-parser.y"
1584 { 1596 {
1585 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); 1597 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
1586 ;} 1598 ;}
1587 break; 1599 break;
1588 1600
1589 case 23: 1601 case 23:
1590#line 200 "dtc-parser.y" 1602#line 204 "dtc-parser.y"
1591 { 1603 {
1592 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1604 struct search_path path = { srcpos_file->dir, NULL, NULL };
1605 struct dtc_file *file = dtc_open_file((yyvsp[(4) - (9)].data).val, &path);
1606 struct data d = empty_data;
1607
1608 if ((yyvsp[(6) - (9)].addr) != 0)
1609 if (fseek(file->file, (yyvsp[(6) - (9)].addr), SEEK_SET) != 0)
1610 yyerrorf("Couldn't seek to offset %llu in \"%s\": %s",
1611 (unsigned long long)(yyvsp[(6) - (9)].addr),
1612 (yyvsp[(4) - (9)].data).val, strerror(errno));
1613
1614 d = data_copy_file(file->file, (yyvsp[(8) - (9)].addr));
1615
1616 (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
1617 dtc_close_file(file);
1593 ;} 1618 ;}
1594 break; 1619 break;
1595 1620
1596 case 24: 1621 case 24:
1597#line 207 "dtc-parser.y" 1622#line 221 "dtc-parser.y"
1598 { 1623 {
1599 (yyval.data) = empty_data; 1624 struct search_path path = { srcpos_file->dir, NULL, NULL };
1625 struct dtc_file *file = dtc_open_file((yyvsp[(4) - (5)].data).val, &path);
1626 struct data d = empty_data;
1627
1628 d = data_copy_file(file->file, -1);
1629
1630 (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
1631 dtc_close_file(file);
1600 ;} 1632 ;}
1601 break; 1633 break;
1602 1634
1603 case 25: 1635 case 25:
1604#line 211 "dtc-parser.y" 1636#line 232 "dtc-parser.y"
1605 { 1637 {
1606 (yyval.data) = (yyvsp[(1) - (2)].data); 1638 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1607 ;} 1639 ;}
1608 break; 1640 break;
1609 1641
1610 case 26: 1642 case 26:
1611#line 215 "dtc-parser.y" 1643#line 239 "dtc-parser.y"
1612 { 1644 {
1613 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1645 (yyval.data) = empty_data;
1614 ;} 1646 ;}
1615 break; 1647 break;
1616 1648
1617 case 27: 1649 case 27:
1618#line 222 "dtc-parser.y" 1650#line 243 "dtc-parser.y"
1619 { 1651 {
1620 (yyval.data) = empty_data; 1652 (yyval.data) = (yyvsp[(1) - (2)].data);
1621 ;} 1653 ;}
1622 break; 1654 break;
1623 1655
1624 case 28: 1656 case 28:
1625#line 226 "dtc-parser.y" 1657#line 247 "dtc-parser.y"
1626 { 1658 {
1627 (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell)); 1659 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1628 ;} 1660 ;}
1629 break; 1661 break;
1630 1662
1631 case 29: 1663 case 29:
1632#line 230 "dtc-parser.y" 1664#line 254 "dtc-parser.y"
1665 {
1666 (yyval.data) = empty_data;
1667 ;}
1668 break;
1669
1670 case 30:
1671#line 258 "dtc-parser.y"
1672 {
1673 (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell));
1674 ;}
1675 break;
1676
1677 case 31:
1678#line 262 "dtc-parser.y"
1633 { 1679 {
1634 (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE, 1680 (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE,
1635 (yyvsp[(2) - (2)].labelref)), -1); 1681 (yyvsp[(2) - (2)].labelref)), -1);
1636 ;} 1682 ;}
1637 break; 1683 break;
1638 1684
1639 case 30: 1685 case 32:
1640#line 235 "dtc-parser.y" 1686#line 267 "dtc-parser.y"
1641 { 1687 {
1642 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1688 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1643 ;} 1689 ;}
1644 break; 1690 break;
1645 1691
1646 case 31: 1692 case 33:
1647#line 242 "dtc-parser.y" 1693#line 274 "dtc-parser.y"
1648 { 1694 {
1649 (yyval.cbase) = 16; 1695 (yyval.cbase) = 16;
1650 ;} 1696 ;}
1651 break; 1697 break;
1652 1698
1653 case 33: 1699 case 35:
1654#line 250 "dtc-parser.y" 1700#line 282 "dtc-parser.y"
1655 { 1701 {
1656 (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32); 1702 (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32);
1657 ;} 1703 ;}
1658 break; 1704 break;
1659 1705
1660 case 34: 1706 case 36:
1661#line 254 "dtc-parser.y" 1707#line 286 "dtc-parser.y"
1662 { 1708 {
1663 (yyval.cell) = eval_literal((yyvsp[(2) - (2)].literal), (yyvsp[(1) - (2)].cbase), 32); 1709 (yyval.cell) = eval_literal((yyvsp[(2) - (2)].literal), (yyvsp[(1) - (2)].cbase), 32);
1664 ;} 1710 ;}
1665 break; 1711 break;
1666 1712
1667 case 35: 1713 case 37:
1668#line 261 "dtc-parser.y" 1714#line 293 "dtc-parser.y"
1669 { 1715 {
1670 (yyval.data) = empty_data; 1716 (yyval.data) = empty_data;
1671 ;} 1717 ;}
1672 break; 1718 break;
1673 1719
1674 case 36: 1720 case 38:
1675#line 265 "dtc-parser.y" 1721#line 297 "dtc-parser.y"
1676 { 1722 {
1677 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); 1723 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
1678 ;} 1724 ;}
1679 break; 1725 break;
1680 1726
1681 case 37: 1727 case 39:
1682#line 269 "dtc-parser.y" 1728#line 301 "dtc-parser.y"
1683 { 1729 {
1684 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1730 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1685 ;} 1731 ;}
1686 break; 1732 break;
1687 1733
1688 case 38: 1734 case 40:
1689#line 276 "dtc-parser.y" 1735#line 308 "dtc-parser.y"
1690 { 1736 {
1691 (yyval.nodelist) = NULL; 1737 (yyval.nodelist) = NULL;
1692 ;} 1738 ;}
1693 break; 1739 break;
1694 1740
1695 case 39: 1741 case 41:
1696#line 280 "dtc-parser.y" 1742#line 312 "dtc-parser.y"
1697 { 1743 {
1698 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); 1744 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
1699 ;} 1745 ;}
1700 break; 1746 break;
1701 1747
1702 case 40: 1748 case 42:
1703#line 284 "dtc-parser.y" 1749#line 316 "dtc-parser.y"
1704 { 1750 {
1705 yyerror("syntax error: properties must precede subnodes\n"); 1751 yyerror("syntax error: properties must precede subnodes");
1706 YYERROR; 1752 YYERROR;
1707 ;} 1753 ;}
1708 break; 1754 break;
1709 1755
1710 case 41: 1756 case 43:
1711#line 292 "dtc-parser.y" 1757#line 324 "dtc-parser.y"
1712 { 1758 {
1713 (yyval.node) = name_node((yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].propnodename), (yyvsp[(1) - (3)].labelref)); 1759 (yyval.node) = name_node((yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].propnodename), (yyvsp[(1) - (3)].labelref));
1714 ;} 1760 ;}
1715 break; 1761 break;
1716 1762
1717 case 42: 1763 case 44:
1718#line 299 "dtc-parser.y" 1764#line 331 "dtc-parser.y"
1719 { 1765 {
1720 (yyval.labelref) = NULL; 1766 (yyval.labelref) = NULL;
1721 ;} 1767 ;}
1722 break; 1768 break;
1723 1769
1724 case 43: 1770 case 45:
1725#line 303 "dtc-parser.y" 1771#line 335 "dtc-parser.y"
1726 { 1772 {
1727 (yyval.labelref) = (yyvsp[(1) - (1)].labelref); 1773 (yyval.labelref) = (yyvsp[(1) - (1)].labelref);
1728 ;} 1774 ;}
@@ -1730,7 +1776,7 @@ yyreduce:
1730 1776
1731 1777
1732/* Line 1267 of yacc.c. */ 1778/* Line 1267 of yacc.c. */
1733#line 1734 "dtc-parser.tab.c" 1779#line 1780 "dtc-parser.tab.c"
1734 default: break; 1780 default: break;
1735 } 1781 }
1736 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1782 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1950,21 +1996,32 @@ yyreturn:
1950} 1996}
1951 1997
1952 1998
1953#line 308 "dtc-parser.y" 1999#line 340 "dtc-parser.y"
1954 2000
1955 2001
1956void yyerror (char const *s) 2002void yyerrorf(char const *s, ...)
1957{ 2003{
1958 const char *fname = srcpos_filename_for_num(yylloc.filenum); 2004 const char *fname = srcpos_file ? srcpos_file->name : "<no-file>";
2005 va_list va;
2006 va_start(va, s);
1959 2007
1960 if (strcmp(fname, "-") == 0) 2008 if (strcmp(fname, "-") == 0)
1961 fname = "stdin"; 2009 fname = "stdin";
1962 2010
1963 fprintf(stderr, "%s:%d %s\n", 2011 fprintf(stderr, "%s:%d ", fname, yylloc.first_line);
1964 fname, yylloc.first_line, s); 2012 vfprintf(stderr, s, va);
2013 fprintf(stderr, "\n");
2014
2015 treesource_error = 1;
2016 va_end(va);
2017}
2018
2019void yyerror (char const *s)
2020{
2021 yyerrorf("%s", s);
1965} 2022}
1966 2023
1967unsigned long long eval_literal(const char *s, int base, int bits) 2024static unsigned long long eval_literal(const char *s, int base, int bits)
1968{ 2025{
1969 unsigned long long val; 2026 unsigned long long val;
1970 char *e; 2027 char *e;
diff --git a/arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped b/arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped
index 4707b029ed25..ba99100d55c9 100644
--- a/arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped
+++ b/arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped
@@ -48,7 +48,8 @@
48 DT_BYTE = 264, 48 DT_BYTE = 264,
49 DT_STRING = 265, 49 DT_STRING = 265,
50 DT_LABEL = 266, 50 DT_LABEL = 266,
51 DT_REF = 267 51 DT_REF = 267,
52 DT_INCBIN = 268
52 }; 53 };
53#endif 54#endif
54/* Tokens. */ 55/* Tokens. */
@@ -62,22 +63,23 @@
62#define DT_STRING 265 63#define DT_STRING 265
63#define DT_LABEL 266 64#define DT_LABEL 266
64#define DT_REF 267 65#define DT_REF 267
66#define DT_INCBIN 268
65 67
66 68
67 69
68 70
69#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 71#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
70typedef union YYSTYPE 72typedef union YYSTYPE
71#line 34 "dtc-parser.y" 73#line 37 "dtc-parser.y"
72{ 74{
73 char *propnodename; 75 char *propnodename;
74 char *literal; 76 char *literal;
75 char *labelref; 77 char *labelref;
76 unsigned int cbase; 78 unsigned int cbase;
77 u8 byte; 79 uint8_t byte;
78 struct data data; 80 struct data data;
79 81
80 u64 addr; 82 uint64_t addr;
81 cell_t cell; 83 cell_t cell;
82 struct property *prop; 84 struct property *prop;
83 struct property *proplist; 85 struct property *proplist;
@@ -86,7 +88,7 @@ typedef union YYSTYPE
86 struct reserve_info *re; 88 struct reserve_info *re;
87} 89}
88/* Line 1489 of yacc.c. */ 90/* Line 1489 of yacc.c. */
89#line 90 "dtc-parser.tab.h" 91#line 92 "dtc-parser.tab.h"
90 YYSTYPE; 92 YYSTYPE;
91# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 93# define yystype YYSTYPE /* obsolescent; will be withdrawn */
92# define YYSTYPE_IS_DECLARED 1 94# define YYSTYPE_IS_DECLARED 1
diff --git a/arch/powerpc/boot/dtc-src/dtc-parser.y b/arch/powerpc/boot/dtc-src/dtc-parser.y
index 002ea7fef184..b2ab562420ea 100644
--- a/arch/powerpc/boot/dtc-src/dtc-parser.y
+++ b/arch/powerpc/boot/dtc-src/dtc-parser.y
@@ -21,14 +21,17 @@
21%locations 21%locations
22 22
23%{ 23%{
24#include <stdio.h>
25
24#include "dtc.h" 26#include "dtc.h"
25#include "srcpos.h" 27#include "srcpos.h"
26 28
27int yylex(void); 29extern int yylex(void);
28unsigned long long eval_literal(const char *s, int base, int bits);
29 30
30extern struct boot_info *the_boot_info; 31extern struct boot_info *the_boot_info;
32extern int treesource_error;
31 33
34static unsigned long long eval_literal(const char *s, int base, int bits);
32%} 35%}
33 36
34%union { 37%union {
@@ -36,10 +39,10 @@ extern struct boot_info *the_boot_info;
36 char *literal; 39 char *literal;
37 char *labelref; 40 char *labelref;
38 unsigned int cbase; 41 unsigned int cbase;
39 u8 byte; 42 uint8_t byte;
40 struct data data; 43 struct data data;
41 44
42 u64 addr; 45 uint64_t addr;
43 cell_t cell; 46 cell_t cell;
44 struct property *prop; 47 struct property *prop;
45 struct property *proplist; 48 struct property *proplist;
@@ -58,6 +61,7 @@ extern struct boot_info *the_boot_info;
58%token <data> DT_STRING 61%token <data> DT_STRING
59%token <labelref> DT_LABEL 62%token <labelref> DT_LABEL
60%token <labelref> DT_REF 63%token <labelref> DT_REF
64%token DT_INCBIN
61 65
62%type <data> propdata 66%type <data> propdata
63%type <data> propdataprefix 67%type <data> propdataprefix
@@ -84,11 +88,11 @@ extern struct boot_info *the_boot_info;
84sourcefile: 88sourcefile:
85 DT_V1 ';' memreserves devicetree 89 DT_V1 ';' memreserves devicetree
86 { 90 {
87 the_boot_info = build_boot_info($3, $4); 91 the_boot_info = build_boot_info($3, $4, 0);
88 } 92 }
89 | v0_memreserves devicetree 93 | v0_memreserves devicetree
90 { 94 {
91 the_boot_info = build_boot_info($1, $2); 95 the_boot_info = build_boot_info($1, $2, 0);
92 } 96 }
93 ; 97 ;
94 98
@@ -196,6 +200,34 @@ propdata:
196 { 200 {
197 $$ = data_add_marker($1, REF_PATH, $2); 201 $$ = data_add_marker($1, REF_PATH, $2);
198 } 202 }
203 | propdataprefix DT_INCBIN '(' DT_STRING ',' addr ',' addr ')'
204 {
205 struct search_path path = { srcpos_file->dir, NULL, NULL };
206 struct dtc_file *file = dtc_open_file($4.val, &path);
207 struct data d = empty_data;
208
209 if ($6 != 0)
210 if (fseek(file->file, $6, SEEK_SET) != 0)
211 yyerrorf("Couldn't seek to offset %llu in \"%s\": %s",
212 (unsigned long long)$6,
213 $4.val, strerror(errno));
214
215 d = data_copy_file(file->file, $8);
216
217 $$ = data_merge($1, d);
218 dtc_close_file(file);
219 }
220 | propdataprefix DT_INCBIN '(' DT_STRING ')'
221 {
222 struct search_path path = { srcpos_file->dir, NULL, NULL };
223 struct dtc_file *file = dtc_open_file($4.val, &path);
224 struct data d = empty_data;
225
226 d = data_copy_file(file->file, -1);
227
228 $$ = data_merge($1, d);
229 dtc_close_file(file);
230 }
199 | propdata DT_LABEL 231 | propdata DT_LABEL
200 { 232 {
201 $$ = data_add_marker($1, LABEL, $2); 233 $$ = data_add_marker($1, LABEL, $2);
@@ -282,7 +314,7 @@ subnodes:
282 } 314 }
283 | subnode propdef 315 | subnode propdef
284 { 316 {
285 yyerror("syntax error: properties must precede subnodes\n"); 317 yyerror("syntax error: properties must precede subnodes");
286 YYERROR; 318 YYERROR;
287 } 319 }
288 ; 320 ;
@@ -307,18 +339,29 @@ label:
307 339
308%% 340%%
309 341
310void yyerror (char const *s) 342void yyerrorf(char const *s, ...)
311{ 343{
312 const char *fname = srcpos_filename_for_num(yylloc.filenum); 344 const char *fname = srcpos_file ? srcpos_file->name : "<no-file>";
345 va_list va;
346 va_start(va, s);
313 347
314 if (strcmp(fname, "-") == 0) 348 if (strcmp(fname, "-") == 0)
315 fname = "stdin"; 349 fname = "stdin";
316 350
317 fprintf(stderr, "%s:%d %s\n", 351 fprintf(stderr, "%s:%d ", fname, yylloc.first_line);
318 fname, yylloc.first_line, s); 352 vfprintf(stderr, s, va);
353 fprintf(stderr, "\n");
354
355 treesource_error = 1;
356 va_end(va);
357}
358
359void yyerror (char const *s)
360{
361 yyerrorf("%s", s);
319} 362}
320 363
321unsigned long long eval_literal(const char *s, int base, int bits) 364static unsigned long long eval_literal(const char *s, int base, int bits)
322{ 365{
323 unsigned long long val; 366 unsigned long long val;
324 char *e; 367 char *e;
diff --git a/arch/powerpc/boot/dtc-src/dtc.c b/arch/powerpc/boot/dtc-src/dtc.c
index 01131d7c2d5e..d8fd43b4ac1a 100644
--- a/arch/powerpc/boot/dtc-src/dtc.c
+++ b/arch/powerpc/boot/dtc-src/dtc.c
@@ -55,7 +55,7 @@ char *join_path(const char *path, const char *name)
55 return str; 55 return str;
56} 56}
57 57
58void fill_fullpaths(struct node *tree, const char *prefix) 58static void fill_fullpaths(struct node *tree, const char *prefix)
59{ 59{
60 struct node *child; 60 struct node *child;
61 const char *unit; 61 const char *unit;
@@ -106,7 +106,7 @@ static void __attribute__ ((noreturn)) usage(void)
106 fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n"); 106 fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n");
107 fprintf(stderr, "\t-v\n"); 107 fprintf(stderr, "\t-v\n");
108 fprintf(stderr, "\t\tPrint DTC version and exit\n"); 108 fprintf(stderr, "\t\tPrint DTC version and exit\n");
109 exit(2); 109 exit(3);
110} 110}
111 111
112int main(int argc, char *argv[]) 112int main(int argc, char *argv[])
@@ -118,10 +118,9 @@ int main(int argc, char *argv[])
118 int force = 0, check = 0; 118 int force = 0, check = 0;
119 const char *arg; 119 const char *arg;
120 int opt; 120 int opt;
121 FILE *inf = NULL;
122 FILE *outf = NULL; 121 FILE *outf = NULL;
123 int outversion = DEFAULT_FDT_VERSION; 122 int outversion = DEFAULT_FDT_VERSION;
124 int boot_cpuid_phys = 0xfeedbeef; 123 long long cmdline_boot_cpuid = -1;
125 124
126 quiet = 0; 125 quiet = 0;
127 reservenum = 0; 126 reservenum = 0;
@@ -161,11 +160,11 @@ int main(int argc, char *argv[])
161 quiet++; 160 quiet++;
162 break; 161 break;
163 case 'b': 162 case 'b':
164 boot_cpuid_phys = strtol(optarg, NULL, 0); 163 cmdline_boot_cpuid = strtoll(optarg, NULL, 0);
165 break; 164 break;
166 case 'v': 165 case 'v':
167 printf("Version: %s\n", DTC_VERSION); 166 printf("Version: %s\n", DTC_VERSION);
168 exit(0); 167 exit(0);
169 case 'h': 168 case 'h':
170 default: 169 default:
171 usage(); 170 usage();
@@ -180,31 +179,27 @@ int main(int argc, char *argv[])
180 arg = argv[optind]; 179 arg = argv[optind];
181 180
182 /* minsize and padsize are mutually exclusive */ 181 /* minsize and padsize are mutually exclusive */
183 if ((minsize) && (padsize)) { 182 if (minsize && padsize)
184 die("Can't set both -p and -S\n"); 183 die("Can't set both -p and -S\n");
185 }
186 184
187 fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", 185 fprintf(stderr, "DTC: %s->%s on file \"%s\"\n",
188 inform, outform, arg); 186 inform, outform, arg);
189 187
190 if (streq(inform, "dts")) { 188 if (streq(inform, "dts"))
191 bi = dt_from_source(arg); 189 bi = dt_from_source(arg);
192 } else if (streq(inform, "fs")) { 190 else if (streq(inform, "fs"))
193 bi = dt_from_fs(arg); 191 bi = dt_from_fs(arg);
194 } else if(streq(inform, "dtb")) { 192 else if(streq(inform, "dtb"))
195 inf = dtc_open_file(arg); 193 bi = dt_from_blob(arg);
196 bi = dt_from_blob(inf); 194 else
197 } else {
198 die("Unknown input format \"%s\"\n", inform); 195 die("Unknown input format \"%s\"\n", inform);
199 }
200 196
201 if (inf && (inf != stdin)) 197 if (cmdline_boot_cpuid != -1)
202 fclose(inf); 198 bi->boot_cpuid_phys = cmdline_boot_cpuid;
203 199
204 if (! bi || ! bi->dt) 200 fill_fullpaths(bi->dt, "");
205 die("Couldn't read input tree\n"); 201 process_checks(force, bi);
206 202
207 process_checks(force, bi, check, outversion, boot_cpuid_phys);
208 203
209 if (streq(outname, "-")) { 204 if (streq(outname, "-")) {
210 outf = stdout; 205 outf = stdout;
@@ -218,9 +213,9 @@ int main(int argc, char *argv[])
218 if (streq(outform, "dts")) { 213 if (streq(outform, "dts")) {
219 dt_to_source(outf, bi); 214 dt_to_source(outf, bi);
220 } else if (streq(outform, "dtb")) { 215 } else if (streq(outform, "dtb")) {
221 dt_to_blob(outf, bi, outversion, boot_cpuid_phys); 216 dt_to_blob(outf, bi, outversion);
222 } else if (streq(outform, "asm")) { 217 } else if (streq(outform, "asm")) {
223 dt_to_asm(outf, bi, outversion, boot_cpuid_phys); 218 dt_to_asm(outf, bi, outversion);
224 } else if (streq(outform, "null")) { 219 } else if (streq(outform, "null")) {
225 /* do nothing */ 220 /* do nothing */
226 } else { 221 } else {
diff --git a/arch/powerpc/boot/dtc-src/dtc.h b/arch/powerpc/boot/dtc-src/dtc.h
index 65281777a167..08d54c870086 100644
--- a/arch/powerpc/boot/dtc-src/dtc.h
+++ b/arch/powerpc/boot/dtc-src/dtc.h
@@ -30,10 +30,8 @@
30#include <ctype.h> 30#include <ctype.h>
31#include <errno.h> 31#include <errno.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <netinet/in.h>
34#include <endian.h>
35#include <byteswap.h>
36 33
34#include <libfdt_env.h>
37#include <fdt.h> 35#include <fdt.h>
38 36
39#define DEFAULT_FDT_VERSION 17 37#define DEFAULT_FDT_VERSION 17
@@ -75,25 +73,8 @@ static inline void *xrealloc(void *p, size_t len)
75 return new; 73 return new;
76} 74}
77 75
78typedef uint8_t u8; 76typedef uint32_t cell_t;
79typedef uint16_t u16;
80typedef uint32_t u32;
81typedef uint64_t u64;
82typedef u32 cell_t;
83 77
84#define cpu_to_be16(x) htons(x)
85#define be16_to_cpu(x) ntohs(x)
86
87#define cpu_to_be32(x) htonl(x)
88#define be32_to_cpu(x) ntohl(x)
89
90#if __BYTE_ORDER == __BIG_ENDIAN
91#define cpu_to_be64(x) (x)
92#define be64_to_cpu(x) (x)
93#else
94#define cpu_to_be64(x) bswap_64(x)
95#define be64_to_cpu(x) bswap_64(x)
96#endif
97 78
98#define streq(a, b) (strcmp((a), (b)) == 0) 79#define streq(a, b) (strcmp((a), (b)) == 0)
99#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0) 80#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
@@ -118,7 +99,6 @@ struct marker {
118struct data { 99struct data {
119 int len; 100 int len;
120 char *val; 101 char *val;
121 int asize;
122 struct marker *markers; 102 struct marker *markers;
123}; 103};
124 104
@@ -145,7 +125,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m,
145struct data data_merge(struct data d1, struct data d2); 125struct data data_merge(struct data d1, struct data d2);
146struct data data_append_cell(struct data d, cell_t word); 126struct data data_append_cell(struct data d, cell_t word);
147struct data data_append_re(struct data d, const struct fdt_reserve_entry *re); 127struct data data_append_re(struct data d, const struct fdt_reserve_entry *re);
148struct data data_append_addr(struct data d, u64 addr); 128struct data data_append_addr(struct data d, uint64_t addr);
149struct data data_append_byte(struct data d, uint8_t byte); 129struct data data_append_byte(struct data d, uint8_t byte);
150struct data data_append_zeroes(struct data d, int len); 130struct data data_append_zeroes(struct data d, int len);
151struct data data_append_align(struct data d, int align); 131struct data data_append_align(struct data d, int align);
@@ -223,7 +203,7 @@ struct reserve_info {
223 char *label; 203 char *label;
224}; 204};
225 205
226struct reserve_info *build_reserve_entry(u64 start, u64 len, char *label); 206struct reserve_info *build_reserve_entry(uint64_t start, uint64_t len, char *label);
227struct reserve_info *chain_reserve_entry(struct reserve_info *first, 207struct reserve_info *chain_reserve_entry(struct reserve_info *first,
228 struct reserve_info *list); 208 struct reserve_info *list);
229struct reserve_info *add_reserve_entry(struct reserve_info *list, 209struct reserve_info *add_reserve_entry(struct reserve_info *list,
@@ -233,24 +213,22 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list,
233struct boot_info { 213struct boot_info {
234 struct reserve_info *reservelist; 214 struct reserve_info *reservelist;
235 struct node *dt; /* the device tree */ 215 struct node *dt; /* the device tree */
216 uint32_t boot_cpuid_phys;
236}; 217};
237 218
238struct boot_info *build_boot_info(struct reserve_info *reservelist, 219struct boot_info *build_boot_info(struct reserve_info *reservelist,
239 struct node *tree); 220 struct node *tree, uint32_t boot_cpuid_phys);
240 221
241/* Checks */ 222/* Checks */
242 223
243void process_checks(int force, struct boot_info *bi, 224void process_checks(int force, struct boot_info *bi);
244 int checkflag, int outversion, int boot_cpuid_phys);
245 225
246/* Flattened trees */ 226/* Flattened trees */
247 227
248void dt_to_blob(FILE *f, struct boot_info *bi, int version, 228void dt_to_blob(FILE *f, struct boot_info *bi, int version);
249 int boot_cpuid_phys); 229void dt_to_asm(FILE *f, struct boot_info *bi, int version);
250void dt_to_asm(FILE *f, struct boot_info *bi, int version,
251 int boot_cpuid_phys);
252 230
253struct boot_info *dt_from_blob(FILE *f); 231struct boot_info *dt_from_blob(const char *fname);
254 232
255/* Tree source */ 233/* Tree source */
256 234
@@ -264,6 +242,5 @@ struct boot_info *dt_from_fs(const char *dirname);
264/* misc */ 242/* misc */
265 243
266char *join_path(const char *path, const char *name); 244char *join_path(const char *path, const char *name);
267void fill_fullpaths(struct node *tree, const char *prefix);
268 245
269#endif /* _DTC_H */ 246#endif /* _DTC_H */
diff --git a/arch/powerpc/boot/dtc-src/flattree.c b/arch/powerpc/boot/dtc-src/flattree.c
index a7cfb843d334..76acd28c068d 100644
--- a/arch/powerpc/boot/dtc-src/flattree.c
+++ b/arch/powerpc/boot/dtc-src/flattree.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include "dtc.h" 21#include "dtc.h"
22#include "srcpos.h"
22 23
23#define FTF_FULLPATH 0x1 24#define FTF_FULLPATH 0x1
24#define FTF_VARALIGN 0x2 25#define FTF_VARALIGN 0x2
@@ -162,28 +163,18 @@ static void asm_emit_data(void *e, struct data d)
162{ 163{
163 FILE *f = e; 164 FILE *f = e;
164 int off = 0; 165 int off = 0;
165 struct marker *m; 166 struct marker *m = d.markers;
166 167
167 m = d.markers; 168 for_each_marker_of_type(m, LABEL)
168 while (m) { 169 emit_offset_label(f, m->ref, m->offset);
169 if (m->type == LABEL)
170 emit_offset_label(f, m->ref, m->offset);
171 m = m->next;
172 }
173 170
174 while ((d.len - off) >= sizeof(u32)) { 171 while ((d.len - off) >= sizeof(uint32_t)) {
175 fprintf(f, "\t.long\t0x%x\n", 172 fprintf(f, "\t.long\t0x%x\n",
176 be32_to_cpu(*((u32 *)(d.val+off)))); 173 fdt32_to_cpu(*((uint32_t *)(d.val+off))));
177 off += sizeof(u32); 174 off += sizeof(uint32_t);
178 }
179
180 if ((d.len - off) >= sizeof(u16)) {
181 fprintf(f, "\t.short\t0x%hx\n",
182 be16_to_cpu(*((u16 *)(d.val+off))));
183 off += sizeof(u16);
184 } 175 }
185 176
186 if ((d.len - off) >= 1) { 177 while ((d.len - off) >= 1) {
187 fprintf(f, "\t.byte\t0x%hhx\n", d.val[off]); 178 fprintf(f, "\t.byte\t0x%hhx\n", d.val[off]);
188 off += 1; 179 off += 1;
189 } 180 }
@@ -336,29 +327,28 @@ static void make_fdt_header(struct fdt_header *fdt,
336 327
337 memset(fdt, 0xff, sizeof(*fdt)); 328 memset(fdt, 0xff, sizeof(*fdt));
338 329
339 fdt->magic = cpu_to_be32(FDT_MAGIC); 330 fdt->magic = cpu_to_fdt32(FDT_MAGIC);
340 fdt->version = cpu_to_be32(vi->version); 331 fdt->version = cpu_to_fdt32(vi->version);
341 fdt->last_comp_version = cpu_to_be32(vi->last_comp_version); 332 fdt->last_comp_version = cpu_to_fdt32(vi->last_comp_version);
342 333
343 /* Reserve map should be doubleword aligned */ 334 /* Reserve map should be doubleword aligned */
344 reserve_off = ALIGN(vi->hdr_size, 8); 335 reserve_off = ALIGN(vi->hdr_size, 8);
345 336
346 fdt->off_mem_rsvmap = cpu_to_be32(reserve_off); 337 fdt->off_mem_rsvmap = cpu_to_fdt32(reserve_off);
347 fdt->off_dt_struct = cpu_to_be32(reserve_off + reservesize); 338 fdt->off_dt_struct = cpu_to_fdt32(reserve_off + reservesize);
348 fdt->off_dt_strings = cpu_to_be32(reserve_off + reservesize 339 fdt->off_dt_strings = cpu_to_fdt32(reserve_off + reservesize
349 + dtsize); 340 + dtsize);
350 fdt->totalsize = cpu_to_be32(reserve_off + reservesize + dtsize + strsize); 341 fdt->totalsize = cpu_to_fdt32(reserve_off + reservesize + dtsize + strsize);
351 342
352 if (vi->flags & FTF_BOOTCPUID) 343 if (vi->flags & FTF_BOOTCPUID)
353 fdt->boot_cpuid_phys = cpu_to_be32(boot_cpuid_phys); 344 fdt->boot_cpuid_phys = cpu_to_fdt32(boot_cpuid_phys);
354 if (vi->flags & FTF_STRTABSIZE) 345 if (vi->flags & FTF_STRTABSIZE)
355 fdt->size_dt_strings = cpu_to_be32(strsize); 346 fdt->size_dt_strings = cpu_to_fdt32(strsize);
356 if (vi->flags & FTF_STRUCTSIZE) 347 if (vi->flags & FTF_STRUCTSIZE)
357 fdt->size_dt_struct = cpu_to_be32(dtsize); 348 fdt->size_dt_struct = cpu_to_fdt32(dtsize);
358} 349}
359 350
360void dt_to_blob(FILE *f, struct boot_info *bi, int version, 351void dt_to_blob(FILE *f, struct boot_info *bi, int version)
361 int boot_cpuid_phys)
362{ 352{
363 struct version_info *vi = NULL; 353 struct version_info *vi = NULL;
364 int i; 354 int i;
@@ -383,26 +373,26 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
383 373
384 /* Make header */ 374 /* Make header */
385 make_fdt_header(&fdt, vi, reservebuf.len, dtbuf.len, strbuf.len, 375 make_fdt_header(&fdt, vi, reservebuf.len, dtbuf.len, strbuf.len,
386 boot_cpuid_phys); 376 bi->boot_cpuid_phys);
387 377
388 /* 378 /*
389 * If the user asked for more space than is used, adjust the totalsize. 379 * If the user asked for more space than is used, adjust the totalsize.
390 */ 380 */
391 if (minsize > 0) { 381 if (minsize > 0) {
392 padlen = minsize - be32_to_cpu(fdt.totalsize); 382 padlen = minsize - fdt32_to_cpu(fdt.totalsize);
393 if ((padlen < 0) && (quiet < 1)) 383 if ((padlen < 0) && (quiet < 1))
394 fprintf(stderr, 384 fprintf(stderr,
395 "Warning: blob size %d >= minimum size %d\n", 385 "Warning: blob size %d >= minimum size %d\n",
396 be32_to_cpu(fdt.totalsize), minsize); 386 fdt32_to_cpu(fdt.totalsize), minsize);
397 } 387 }
398 388
399 if (padsize > 0) 389 if (padsize > 0)
400 padlen = padsize; 390 padlen = padsize;
401 391
402 if (padlen > 0) { 392 if (padlen > 0) {
403 int tsize = be32_to_cpu(fdt.totalsize); 393 int tsize = fdt32_to_cpu(fdt.totalsize);
404 tsize += padlen; 394 tsize += padlen;
405 fdt.totalsize = cpu_to_be32(tsize); 395 fdt.totalsize = cpu_to_fdt32(tsize);
406 } 396 }
407 397
408 /* 398 /*
@@ -410,7 +400,7 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
410 * the reserve buffer, add the reserve map terminating zeroes, 400 * the reserve buffer, add the reserve map terminating zeroes,
411 * the device tree itself, and finally the strings. 401 * the device tree itself, and finally the strings.
412 */ 402 */
413 blob = data_append_data(blob, &fdt, sizeof(fdt)); 403 blob = data_append_data(blob, &fdt, vi->hdr_size);
414 blob = data_append_align(blob, 8); 404 blob = data_append_align(blob, 8);
415 blob = data_merge(blob, reservebuf); 405 blob = data_merge(blob, reservebuf);
416 blob = data_append_zeroes(blob, sizeof(struct fdt_reserve_entry)); 406 blob = data_append_zeroes(blob, sizeof(struct fdt_reserve_entry));
@@ -449,7 +439,7 @@ static void dump_stringtable_asm(FILE *f, struct data strbuf)
449 } 439 }
450} 440}
451 441
452void dt_to_asm(FILE *f, struct boot_info *bi, int version, int boot_cpuid_phys) 442void dt_to_asm(FILE *f, struct boot_info *bi, int version)
453{ 443{
454 struct version_info *vi = NULL; 444 struct version_info *vi = NULL;
455 int i; 445 int i;
@@ -489,7 +479,7 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version, int boot_cpuid_phys)
489 479
490 if (vi->flags & FTF_BOOTCPUID) 480 if (vi->flags & FTF_BOOTCPUID)
491 fprintf(f, "\t.long\t%i\t\t\t\t\t/* boot_cpuid_phys */\n", 481 fprintf(f, "\t.long\t%i\t\t\t\t\t/* boot_cpuid_phys */\n",
492 boot_cpuid_phys); 482 bi->boot_cpuid_phys);
493 483
494 if (vi->flags & FTF_STRTABSIZE) 484 if (vi->flags & FTF_STRTABSIZE)
495 fprintf(f, "\t.long\t_%s_strings_end - _%s_strings_start\t/* size_dt_strings */\n", 485 fprintf(f, "\t.long\t_%s_strings_end - _%s_strings_start\t/* size_dt_strings */\n",
@@ -579,15 +569,15 @@ static void flat_read_chunk(struct inbuf *inb, void *p, int len)
579 inb->ptr += len; 569 inb->ptr += len;
580} 570}
581 571
582static u32 flat_read_word(struct inbuf *inb) 572static uint32_t flat_read_word(struct inbuf *inb)
583{ 573{
584 u32 val; 574 uint32_t val;
585 575
586 assert(((inb->ptr - inb->base) % sizeof(val)) == 0); 576 assert(((inb->ptr - inb->base) % sizeof(val)) == 0);
587 577
588 flat_read_chunk(inb, &val, sizeof(val)); 578 flat_read_chunk(inb, &val, sizeof(val));
589 579
590 return be32_to_cpu(val); 580 return fdt32_to_cpu(val);
591} 581}
592 582
593static void flat_realign(struct inbuf *inb, int align) 583static void flat_realign(struct inbuf *inb, int align)
@@ -615,7 +605,7 @@ static char *flat_read_string(struct inbuf *inb)
615 605
616 inb->ptr += len; 606 inb->ptr += len;
617 607
618 flat_realign(inb, sizeof(u32)); 608 flat_realign(inb, sizeof(uint32_t));
619 609
620 return str; 610 return str;
621} 611}
@@ -632,7 +622,7 @@ static struct data flat_read_data(struct inbuf *inb, int len)
632 622
633 flat_read_chunk(inb, d.val, len); 623 flat_read_chunk(inb, d.val, len);
634 624
635 flat_realign(inb, sizeof(u32)); 625 flat_realign(inb, sizeof(uint32_t));
636 626
637 return d; 627 return d;
638} 628}
@@ -659,7 +649,7 @@ static char *flat_read_stringtable(struct inbuf *inb, int offset)
659static struct property *flat_read_property(struct inbuf *dtbuf, 649static struct property *flat_read_property(struct inbuf *dtbuf,
660 struct inbuf *strbuf, int flags) 650 struct inbuf *strbuf, int flags)
661{ 651{
662 u32 proplen, stroff; 652 uint32_t proplen, stroff;
663 char *name; 653 char *name;
664 struct data val; 654 struct data val;
665 655
@@ -693,8 +683,8 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
693 p = inb->ptr; 683 p = inb->ptr;
694 while (1) { 684 while (1) {
695 flat_read_chunk(inb, &re, sizeof(re)); 685 flat_read_chunk(inb, &re, sizeof(re));
696 re.address = be64_to_cpu(re.address); 686 re.address = fdt64_to_cpu(re.address);
697 re.size = be64_to_cpu(re.size); 687 re.size = fdt64_to_cpu(re.size);
698 if (re.size == 0) 688 if (re.size == 0)
699 break; 689 break;
700 690
@@ -708,77 +698,37 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
708 698
709static char *nodename_from_path(const char *ppath, const char *cpath) 699static char *nodename_from_path(const char *ppath, const char *cpath)
710{ 700{
711 const char *lslash;
712 int plen; 701 int plen;
713 702
714 lslash = strrchr(cpath, '/'); 703 plen = strlen(ppath);
715 if (! lslash)
716 return NULL;
717
718 plen = lslash - cpath;
719
720 if (streq(cpath, "/") && streq(ppath, ""))
721 return "";
722
723 if ((plen == 0) && streq(ppath, "/"))
724 return strdup(lslash+1);
725
726 if (! strneq(ppath, cpath, plen))
727 return NULL;
728
729 return strdup(lslash+1);
730}
731
732static const char PROPCHAR[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,._+*#?-";
733static const char UNITCHAR[] = "0123456789abcdef,";
734
735static int check_node_name(const char *name)
736{
737 const char *atpos;
738 int basenamelen;
739 704
740 atpos = strrchr(name, '@'); 705 if (!strneq(ppath, cpath, plen))
706 die("Path \"%s\" is not valid as a child of \"%s\"\n",
707 cpath, ppath);
741 708
742 if (atpos) 709 /* root node is a special case */
743 basenamelen = atpos - name; 710 if (!streq(ppath, "/"))
744 else 711 plen++;
745 basenamelen = strlen(name);
746
747 if (strspn(name, PROPCHAR) < basenamelen)
748 return -1;
749 712
750 if (atpos 713 return strdup(cpath + plen);
751 && ((basenamelen + 1 + strspn(atpos+1, UNITCHAR)) < strlen(name)))
752 return -1;
753
754 return basenamelen;
755} 714}
756 715
757static struct node *unflatten_tree(struct inbuf *dtbuf, 716static struct node *unflatten_tree(struct inbuf *dtbuf,
758 struct inbuf *strbuf, 717 struct inbuf *strbuf,
759 const char *parent_path, int flags) 718 const char *parent_flatname, int flags)
760{ 719{
761 struct node *node; 720 struct node *node;
762 u32 val; 721 char *flatname;
722 uint32_t val;
763 723
764 node = build_node(NULL, NULL); 724 node = build_node(NULL, NULL);
765 725
766 if (flags & FTF_FULLPATH) { 726 flatname = flat_read_string(dtbuf);
767 node->fullpath = flat_read_string(dtbuf);
768 node->name = nodename_from_path(parent_path, node->fullpath);
769
770 if (! node->name)
771 die("Path \"%s\" is not valid as a child of \"%s\"\n",
772 node->fullpath, parent_path);
773 } else {
774 node->name = flat_read_string(dtbuf);
775 node->fullpath = join_path(parent_path, node->name);
776 }
777 727
778 node->basenamelen = check_node_name(node->name); 728 if (flags & FTF_FULLPATH)
779 if (node->basenamelen < 0) { 729 node->name = nodename_from_path(parent_flatname, flatname);
780 fprintf(stderr, "Warning \"%s\" has incorrect format\n", node->name); 730 else
781 } 731 node->name = flatname;
782 732
783 do { 733 do {
784 struct property *prop; 734 struct property *prop;
@@ -795,8 +745,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
795 break; 745 break;
796 746
797 case FDT_BEGIN_NODE: 747 case FDT_BEGIN_NODE:
798 child = unflatten_tree(dtbuf,strbuf, node->fullpath, 748 child = unflatten_tree(dtbuf,strbuf, flatname, flags);
799 flags);
800 add_child(node, child); 749 add_child(node, child);
801 break; 750 break;
802 751
@@ -825,10 +774,11 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
825} 774}
826 775
827 776
828struct boot_info *dt_from_blob(FILE *f) 777struct boot_info *dt_from_blob(const char *fname)
829{ 778{
830 u32 magic, totalsize, version, size_str, size_dt; 779 struct dtc_file *dtcf;
831 u32 off_dt, off_str, off_mem_rsvmap; 780 uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys;
781 uint32_t off_dt, off_str, off_mem_rsvmap;
832 int rc; 782 int rc;
833 char *blob; 783 char *blob;
834 struct fdt_header *fdt; 784 struct fdt_header *fdt;
@@ -838,54 +788,56 @@ struct boot_info *dt_from_blob(FILE *f)
838 int sizeleft; 788 int sizeleft;
839 struct reserve_info *reservelist; 789 struct reserve_info *reservelist;
840 struct node *tree; 790 struct node *tree;
841 u32 val; 791 uint32_t val;
842 int flags = 0; 792 int flags = 0;
843 793
844 rc = fread(&magic, sizeof(magic), 1, f); 794 dtcf = dtc_open_file(fname, NULL);
845 if (ferror(f)) 795
796 rc = fread(&magic, sizeof(magic), 1, dtcf->file);
797 if (ferror(dtcf->file))
846 die("Error reading DT blob magic number: %s\n", 798 die("Error reading DT blob magic number: %s\n",
847 strerror(errno)); 799 strerror(errno));
848 if (rc < 1) { 800 if (rc < 1) {
849 if (feof(f)) 801 if (feof(dtcf->file))
850 die("EOF reading DT blob magic number\n"); 802 die("EOF reading DT blob magic number\n");
851 else 803 else
852 die("Mysterious short read reading magic number\n"); 804 die("Mysterious short read reading magic number\n");
853 } 805 }
854 806
855 magic = be32_to_cpu(magic); 807 magic = fdt32_to_cpu(magic);
856 if (magic != FDT_MAGIC) 808 if (magic != FDT_MAGIC)
857 die("Blob has incorrect magic number\n"); 809 die("Blob has incorrect magic number\n");
858 810
859 rc = fread(&totalsize, sizeof(totalsize), 1, f); 811 rc = fread(&totalsize, sizeof(totalsize), 1, dtcf->file);
860 if (ferror(f)) 812 if (ferror(dtcf->file))
861 die("Error reading DT blob size: %s\n", strerror(errno)); 813 die("Error reading DT blob size: %s\n", strerror(errno));
862 if (rc < 1) { 814 if (rc < 1) {
863 if (feof(f)) 815 if (feof(dtcf->file))
864 die("EOF reading DT blob size\n"); 816 die("EOF reading DT blob size\n");
865 else 817 else
866 die("Mysterious short read reading blob size\n"); 818 die("Mysterious short read reading blob size\n");
867 } 819 }
868 820
869 totalsize = be32_to_cpu(totalsize); 821 totalsize = fdt32_to_cpu(totalsize);
870 if (totalsize < FDT_V1_SIZE) 822 if (totalsize < FDT_V1_SIZE)
871 die("DT blob size (%d) is too small\n", totalsize); 823 die("DT blob size (%d) is too small\n", totalsize);
872 824
873 blob = xmalloc(totalsize); 825 blob = xmalloc(totalsize);
874 826
875 fdt = (struct fdt_header *)blob; 827 fdt = (struct fdt_header *)blob;
876 fdt->magic = cpu_to_be32(magic); 828 fdt->magic = cpu_to_fdt32(magic);
877 fdt->totalsize = cpu_to_be32(totalsize); 829 fdt->totalsize = cpu_to_fdt32(totalsize);
878 830
879 sizeleft = totalsize - sizeof(magic) - sizeof(totalsize); 831 sizeleft = totalsize - sizeof(magic) - sizeof(totalsize);
880 p = blob + sizeof(magic) + sizeof(totalsize); 832 p = blob + sizeof(magic) + sizeof(totalsize);
881 833
882 while (sizeleft) { 834 while (sizeleft) {
883 if (feof(f)) 835 if (feof(dtcf->file))
884 die("EOF before reading %d bytes of DT blob\n", 836 die("EOF before reading %d bytes of DT blob\n",
885 totalsize); 837 totalsize);
886 838
887 rc = fread(p, 1, sizeleft, f); 839 rc = fread(p, 1, sizeleft, dtcf->file);
888 if (ferror(f)) 840 if (ferror(dtcf->file))
889 die("Error reading DT blob: %s\n", 841 die("Error reading DT blob: %s\n",
890 strerror(errno)); 842 strerror(errno));
891 843
@@ -893,19 +845,11 @@ struct boot_info *dt_from_blob(FILE *f)
893 p += rc; 845 p += rc;
894 } 846 }
895 847
896 off_dt = be32_to_cpu(fdt->off_dt_struct); 848 off_dt = fdt32_to_cpu(fdt->off_dt_struct);
897 off_str = be32_to_cpu(fdt->off_dt_strings); 849 off_str = fdt32_to_cpu(fdt->off_dt_strings);
898 off_mem_rsvmap = be32_to_cpu(fdt->off_mem_rsvmap); 850 off_mem_rsvmap = fdt32_to_cpu(fdt->off_mem_rsvmap);
899 version = be32_to_cpu(fdt->version); 851 version = fdt32_to_cpu(fdt->version);
900 852 boot_cpuid_phys = fdt32_to_cpu(fdt->boot_cpuid_phys);
901 fprintf(stderr, "\tmagic:\t\t\t0x%x\n", magic);
902 fprintf(stderr, "\ttotalsize:\t\t%d\n", totalsize);
903 fprintf(stderr, "\toff_dt_struct:\t\t0x%x\n", off_dt);
904 fprintf(stderr, "\toff_dt_strings:\t\t0x%x\n", off_str);
905 fprintf(stderr, "\toff_mem_rsvmap:\t\t0x%x\n", off_mem_rsvmap);
906 fprintf(stderr, "\tversion:\t\t0x%x\n", version );
907 fprintf(stderr, "\tlast_comp_version:\t0x%x\n",
908 be32_to_cpu(fdt->last_comp_version));
909 853
910 if (off_mem_rsvmap >= totalsize) 854 if (off_mem_rsvmap >= totalsize)
911 die("Mem Reserve structure offset exceeds total size\n"); 855 die("Mem Reserve structure offset exceeds total size\n");
@@ -916,21 +860,17 @@ struct boot_info *dt_from_blob(FILE *f)
916 if (off_str > totalsize) 860 if (off_str > totalsize)
917 die("String table offset exceeds total size\n"); 861 die("String table offset exceeds total size\n");
918 862
919 if (version >= 2)
920 fprintf(stderr, "\tboot_cpuid_phys:\t0x%x\n",
921 be32_to_cpu(fdt->boot_cpuid_phys));
922
923 size_str = -1;
924 if (version >= 3) { 863 if (version >= 3) {
925 size_str = be32_to_cpu(fdt->size_dt_strings); 864 uint32_t size_str = fdt32_to_cpu(fdt->size_dt_strings);
926 fprintf(stderr, "\tsize_dt_strings:\t%d\n", size_str);
927 if (off_str+size_str > totalsize) 865 if (off_str+size_str > totalsize)
928 die("String table extends past total size\n"); 866 die("String table extends past total size\n");
867 inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
868 } else {
869 inbuf_init(&strbuf, blob + off_str, blob + totalsize);
929 } 870 }
930 871
931 if (version >= 17) { 872 if (version >= 17) {
932 size_dt = be32_to_cpu(fdt->size_dt_struct); 873 size_dt = fdt32_to_cpu(fdt->size_dt_struct);
933 fprintf(stderr, "\tsize_dt_struct:\t\t%d\n", size_dt);
934 if (off_dt+size_dt > totalsize) 874 if (off_dt+size_dt > totalsize)
935 die("Structure block extends past total size\n"); 875 die("Structure block extends past total size\n");
936 } 876 }
@@ -944,10 +884,6 @@ struct boot_info *dt_from_blob(FILE *f)
944 inbuf_init(&memresvbuf, 884 inbuf_init(&memresvbuf,
945 blob + off_mem_rsvmap, blob + totalsize); 885 blob + off_mem_rsvmap, blob + totalsize);
946 inbuf_init(&dtbuf, blob + off_dt, blob + totalsize); 886 inbuf_init(&dtbuf, blob + off_dt, blob + totalsize);
947 if (size_str >= 0)
948 inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
949 else
950 inbuf_init(&strbuf, blob + off_str, blob + totalsize);
951 887
952 reservelist = flat_read_mem_reserve(&memresvbuf); 888 reservelist = flat_read_mem_reserve(&memresvbuf);
953 889
@@ -964,5 +900,7 @@ struct boot_info *dt_from_blob(FILE *f)
964 900
965 free(blob); 901 free(blob);
966 902
967 return build_boot_info(reservelist, tree); 903 dtc_close_file(dtcf);
904
905 return build_boot_info(reservelist, tree, boot_cpuid_phys);
968} 906}
diff --git a/arch/powerpc/boot/dtc-src/fstree.c b/arch/powerpc/boot/dtc-src/fstree.c
index 2a160a46998e..766b2694d935 100644
--- a/arch/powerpc/boot/dtc-src/fstree.c
+++ b/arch/powerpc/boot/dtc-src/fstree.c
@@ -31,8 +31,8 @@ static struct node *read_fstree(const char *dirname)
31 struct node *tree; 31 struct node *tree;
32 32
33 d = opendir(dirname); 33 d = opendir(dirname);
34 if (! d) 34 if (!d)
35 die("opendir(): %s\n", strerror(errno)); 35 die("Couldn't opendir() \"%s\": %s\n", dirname, strerror(errno));
36 36
37 tree = build_node(NULL, NULL); 37 tree = build_node(NULL, NULL);
38 38
@@ -87,8 +87,6 @@ struct boot_info *dt_from_fs(const char *dirname)
87 tree = read_fstree(dirname); 87 tree = read_fstree(dirname);
88 tree = name_node(tree, "", NULL); 88 tree = name_node(tree, "", NULL);
89 89
90 fill_fullpaths(tree, ""); 90 return build_boot_info(NULL, tree, 0);
91
92 return build_boot_info(NULL, tree);
93} 91}
94 92
diff --git a/arch/powerpc/boot/dtc-src/libfdt_env.h b/arch/powerpc/boot/dtc-src/libfdt_env.h
new file mode 100644
index 000000000000..449bf602daf1
--- /dev/null
+++ b/arch/powerpc/boot/dtc-src/libfdt_env.h
@@ -0,0 +1,23 @@
1#ifndef _LIBFDT_ENV_H
2#define _LIBFDT_ENV_H
3
4#include <stddef.h>
5#include <stdint.h>
6#include <string.h>
7
8#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
9static inline uint32_t fdt32_to_cpu(uint32_t x)
10{
11 return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
12}
13#define cpu_to_fdt32(x) fdt32_to_cpu(x)
14
15static inline uint64_t fdt64_to_cpu(uint64_t x)
16{
17 return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
18 | (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
19}
20#define cpu_to_fdt64(x) fdt64_to_cpu(x)
21#undef _B
22
23#endif /* _LIBFDT_ENV_H */
diff --git a/arch/powerpc/boot/dtc-src/livetree.c b/arch/powerpc/boot/dtc-src/livetree.c
index 6ba0846b4310..0ca3de550b3f 100644
--- a/arch/powerpc/boot/dtc-src/livetree.c
+++ b/arch/powerpc/boot/dtc-src/livetree.c
@@ -115,6 +115,7 @@ void add_child(struct node *parent, struct node *child)
115 struct node **p; 115 struct node **p;
116 116
117 child->next_sibling = NULL; 117 child->next_sibling = NULL;
118 child->parent = parent;
118 119
119 p = &parent->children; 120 p = &parent->children;
120 while (*p) 121 while (*p)
@@ -123,7 +124,8 @@ void add_child(struct node *parent, struct node *child)
123 *p = child; 124 *p = child;
124} 125}
125 126
126struct reserve_info *build_reserve_entry(u64 address, u64 size, char *label) 127struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size,
128 char *label)
127{ 129{
128 struct reserve_info *new = xmalloc(sizeof(*new)); 130 struct reserve_info *new = xmalloc(sizeof(*new));
129 131
@@ -165,13 +167,14 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list,
165} 167}
166 168
167struct boot_info *build_boot_info(struct reserve_info *reservelist, 169struct boot_info *build_boot_info(struct reserve_info *reservelist,
168 struct node *tree) 170 struct node *tree, uint32_t boot_cpuid_phys)
169{ 171{
170 struct boot_info *bi; 172 struct boot_info *bi;
171 173
172 bi = xmalloc(sizeof(*bi)); 174 bi = xmalloc(sizeof(*bi));
173 bi->reservelist = reservelist; 175 bi->reservelist = reservelist;
174 bi->dt = tree; 176 bi->dt = tree;
177 bi->boot_cpuid_phys = boot_cpuid_phys;
175 178
176 return bi; 179 return bi;
177} 180}
@@ -202,7 +205,7 @@ struct property *get_property(struct node *node, const char *propname)
202cell_t propval_cell(struct property *prop) 205cell_t propval_cell(struct property *prop)
203{ 206{
204 assert(prop->val.len == sizeof(cell_t)); 207 assert(prop->val.len == sizeof(cell_t));
205 return be32_to_cpu(*((cell_t *)prop->val.val)); 208 return fdt32_to_cpu(*((cell_t *)prop->val.val));
206} 209}
207 210
208struct node *get_subnode(struct node *node, const char *nodename) 211struct node *get_subnode(struct node *node, const char *nodename)
diff --git a/arch/powerpc/boot/dtc-src/srcpos.c b/arch/powerpc/boot/dtc-src/srcpos.c
index 352b0fe06fde..9641b7628b4d 100644
--- a/arch/powerpc/boot/dtc-src/srcpos.c
+++ b/arch/powerpc/boot/dtc-src/srcpos.c
@@ -20,86 +20,97 @@
20#include "dtc.h" 20#include "dtc.h"
21#include "srcpos.h" 21#include "srcpos.h"
22 22
23
24/*
25 * Record the complete unique set of opened file names.
26 * Primarily used to cache source position file names.
27 */
28#define MAX_N_FILE_NAMES (100)
29
30const char *file_names[MAX_N_FILE_NAMES];
31static int n_file_names = 0;
32
33/* 23/*
34 * Like yylineno, this is the current open file pos. 24 * Like yylineno, this is the current open file pos.
35 */ 25 */
36 26
37int srcpos_filenum = -1; 27struct dtc_file *srcpos_file;
38
39 28
40 29static int dtc_open_one(struct dtc_file *file,
41FILE *dtc_open_file(const char *fname) 30 const char *search,
31 const char *fname)
42{ 32{
43 FILE *f; 33 char *fullname;
44 34
45 if (lookup_file_name(fname, 1) < 0) 35 if (search) {
46 die("Too many files opened\n"); 36 fullname = xmalloc(strlen(search) + strlen(fname) + 2);
47 37
48 if (streq(fname, "-")) 38 strcpy(fullname, search);
49 f = stdin; 39 strcat(fullname, "/");
50 else 40 strcat(fullname, fname);
51 f = fopen(fname, "r"); 41 } else {
42 fullname = strdup(fname);
43 }
52 44
53 if (! f) 45 file->file = fopen(fullname, "r");
54 die("Couldn't open \"%s\": %s\n", fname, strerror(errno)); 46 if (!file->file) {
47 free(fullname);
48 return 0;
49 }
55 50
56 return f; 51 file->name = fullname;
52 return 1;
57} 53}
58 54
59 55
56struct dtc_file *dtc_open_file(const char *fname,
57 const struct search_path *search)
58{
59 static const struct search_path default_search = { NULL, NULL, NULL };
60 60
61/* 61 struct dtc_file *file;
62 * Locate and optionally add filename fname in the file_names[] array. 62 const char *slash;
63 *
64 * If the filename is currently not in the array and the boolean
65 * add_it is non-zero, an attempt to add the filename will be made.
66 *
67 * Returns;
68 * Index [0..MAX_N_FILE_NAMES) where the filename is kept
69 * -1 if the name can not be recorded
70 */
71 63
72int lookup_file_name(const char *fname, int add_it) 64 file = xmalloc(sizeof(struct dtc_file));
73{
74 int i;
75 65
76 for (i = 0; i < n_file_names; i++) { 66 slash = strrchr(fname, '/');
77 if (strcmp(file_names[i], fname) == 0) 67 if (slash) {
78 return i; 68 char *dir = xmalloc(slash - fname + 1);
69
70 memcpy(dir, fname, slash - fname);
71 dir[slash - fname] = 0;
72 file->dir = dir;
73 } else {
74 file->dir = NULL;
79 } 75 }
80 76
81 if (add_it) { 77 if (streq(fname, "-")) {
82 if (n_file_names < MAX_N_FILE_NAMES) { 78 file->name = "stdin";
83 file_names[n_file_names] = strdup(fname); 79 file->file = stdin;
84 return n_file_names++; 80 return file;
85 }
86 } 81 }
87 82
88 return -1; 83 if (fname[0] == '/') {
89} 84 file->file = fopen(fname, "r");
85 if (!file->file)
86 goto fail;
87
88 file->name = strdup(fname);
89 return file;
90 }
90 91
92 if (!search)
93 search = &default_search;
91 94
92const char *srcpos_filename_for_num(int filenum) 95 while (search) {
93{ 96 if (dtc_open_one(file, search->dir, fname))
94 if (0 <= filenum && filenum < n_file_names) { 97 return file;
95 return file_names[filenum]; 98
99 if (errno != ENOENT)
100 goto fail;
101
102 search = search->next;
96 } 103 }
97 104
98 return 0; 105fail:
106 die("Couldn't open \"%s\": %s\n", fname, strerror(errno));
99} 107}
100 108
101 109void dtc_close_file(struct dtc_file *file)
102const char *srcpos_get_filename(void)
103{ 110{
104 return srcpos_filename_for_num(srcpos_filenum); 111 if (fclose(file->file))
112 die("Error closing \"%s\": %s\n", file->name, strerror(errno));
113
114 free(file->dir);
115 free(file);
105} 116}
diff --git a/arch/powerpc/boot/dtc-src/srcpos.h b/arch/powerpc/boot/dtc-src/srcpos.h
index ce7ab5ba5b46..e17c7c04db8e 100644
--- a/arch/powerpc/boot/dtc-src/srcpos.h
+++ b/arch/powerpc/boot/dtc-src/srcpos.h
@@ -22,13 +22,21 @@
22 * array of all opened filenames. 22 * array of all opened filenames.
23 */ 23 */
24 24
25#include <stdio.h>
26
27struct dtc_file {
28 char *dir;
29 const char *name;
30 FILE *file;
31};
32
25#if ! defined(YYLTYPE) && ! defined(YYLTYPE_IS_DECLARED) 33#if ! defined(YYLTYPE) && ! defined(YYLTYPE_IS_DECLARED)
26typedef struct YYLTYPE { 34typedef struct YYLTYPE {
27 int first_line; 35 int first_line;
28 int first_column; 36 int first_column;
29 int last_line; 37 int last_line;
30 int last_column; 38 int last_column;
31 int filenum; 39 struct dtc_file *file;
32} YYLTYPE; 40} YYLTYPE;
33 41
34#define YYLTYPE_IS_DECLARED 1 42#define YYLTYPE_IS_DECLARED 1
@@ -48,7 +56,7 @@ typedef struct YYLTYPE {
48 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 56 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
49 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 57 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
50 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 58 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
51 (Current).filenum = YYRHSLOC (Rhs, N).filenum; \ 59 (Current).file = YYRHSLOC (Rhs, N).file; \
52 } \ 60 } \
53 else \ 61 else \
54 { \ 62 { \
@@ -56,20 +64,22 @@ typedef struct YYLTYPE {
56 YYRHSLOC (Rhs, 0).last_line; \ 64 YYRHSLOC (Rhs, 0).last_line; \
57 (Current).first_column = (Current).last_column = \ 65 (Current).first_column = (Current).last_column = \
58 YYRHSLOC (Rhs, 0).last_column; \ 66 YYRHSLOC (Rhs, 0).last_column; \
59 (Current).filenum = YYRHSLOC (Rhs, 0).filenum; \ 67 (Current).file = YYRHSLOC (Rhs, 0).file; \
60 } \ 68 } \
61 while (YYID (0)) 69 while (YYID (0))
62 70
63 71
64 72
65extern void yyerror(char const *); 73extern void yyerror(char const *);
74extern void yyerrorf(char const *, ...) __attribute__((format(printf, 1, 2)));
66 75
67extern int srcpos_filenum; 76extern struct dtc_file *srcpos_file;
68 77
69extern int push_input_file(const char *filename); 78struct search_path {
70extern int pop_input_file(void); 79 const char *dir; /* NULL for current directory */
80 struct search_path *prev, *next;
81};
71 82
72extern FILE *dtc_open_file(const char *fname); 83extern struct dtc_file *dtc_open_file(const char *fname,
73extern int lookup_file_name(const char *fname, int add_it); 84 const struct search_path *search);
74extern const char *srcpos_filename_for_num(int filenum); 85extern void dtc_close_file(struct dtc_file *file);
75const char *srcpos_get_filename(void);
diff --git a/arch/powerpc/boot/dtc-src/treesource.c b/arch/powerpc/boot/dtc-src/treesource.c
index a6a776797636..ebeb6eb27907 100644
--- a/arch/powerpc/boot/dtc-src/treesource.c
+++ b/arch/powerpc/boot/dtc-src/treesource.c
@@ -23,20 +23,23 @@
23 23
24extern FILE *yyin; 24extern FILE *yyin;
25extern int yyparse(void); 25extern int yyparse(void);
26extern void yyerror(char const *);
27 26
28struct boot_info *the_boot_info; 27struct boot_info *the_boot_info;
28int treesource_error;
29 29
30struct boot_info *dt_from_source(const char *fname) 30struct boot_info *dt_from_source(const char *fname)
31{ 31{
32 the_boot_info = NULL; 32 the_boot_info = NULL;
33 treesource_error = 0;
33 34
34 push_input_file(fname); 35 srcpos_file = dtc_open_file(fname, NULL);
36 yyin = srcpos_file->file;
35 37
36 if (yyparse() != 0) 38 if (yyparse() != 0)
37 return NULL; 39 die("Unable to parse input tree\n");
38 40
39 fill_fullpaths(the_boot_info->dt, ""); 41 if (treesource_error)
42 die("Syntax error parsing input tree\n");
40 43
41 return the_boot_info; 44 return the_boot_info;
42} 45}
@@ -144,7 +147,7 @@ static void write_propval_cells(FILE *f, struct data val)
144 m = m->next; 147 m = m->next;
145 } 148 }
146 149
147 fprintf(f, "0x%x", be32_to_cpu(*cp++)); 150 fprintf(f, "0x%x", fdt32_to_cpu(*cp++));
148 if ((void *)cp >= propend) 151 if ((void *)cp >= propend)
149 break; 152 break;
150 fprintf(f, " "); 153 fprintf(f, " ");
@@ -173,7 +176,7 @@ static void write_propval_bytes(FILE *f, struct data val)
173 } 176 }
174 177
175 fprintf(f, "%02hhx", *bp++); 178 fprintf(f, "%02hhx", *bp++);
176 if ((void *)bp >= propend) 179 if ((const void *)bp >= propend)
177 break; 180 break;
178 fprintf(f, " "); 181 fprintf(f, " ");
179 } 182 }
diff --git a/arch/powerpc/boot/dtc-src/version_gen.h b/arch/powerpc/boot/dtc-src/version_gen.h
index 6c343031538e..658ff42429d6 100644
--- a/arch/powerpc/boot/dtc-src/version_gen.h
+++ b/arch/powerpc/boot/dtc-src/version_gen.h
@@ -1 +1 @@
#define DTC_VERSION "DTC 1.0.0-gd6f9b62f" #define DTC_VERSION "DTC 1.2.0"
diff --git a/arch/powerpc/boot/dts/arches.dts b/arch/powerpc/boot/dts/arches.dts
new file mode 100644
index 000000000000..d9113b1e8c1d
--- /dev/null
+++ b/arch/powerpc/boot/dts/arches.dts
@@ -0,0 +1,293 @@
1/*
2 * Device Tree Source for AMCC Arches (dual 460GT board)
3 *
4 * (C) Copyright 2008 Applied Micro Circuits Corporation
5 * Victor Gallardo <vgallardo@amcc.com>
6 * Adam Graham <agraham@amcc.com>
7 *
8 * Based on the glacier.dts file
9 * Stefan Roese <sr@denx.de>
10 * Copyright 2008 DENX Software Engineering
11 *
12 * See file CREDITS for list of people who contributed to this
13 * project.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
29 */
30
31/dts-v1/;
32
33/ {
34 #address-cells = <2>;
35 #size-cells = <1>;
36 model = "amcc,arches";
37 compatible = "amcc,arches";
38 dcr-parent = <&{/cpus/cpu@0}>;
39
40 aliases {
41 ethernet0 = &EMAC0;
42 ethernet1 = &EMAC1;
43 ethernet2 = &EMAC2;
44 serial0 = &UART0;
45 };
46
47 cpus {
48 #address-cells = <1>;
49 #size-cells = <0>;
50
51 cpu@0 {
52 device_type = "cpu";
53 model = "PowerPC,460GT";
54 reg = <0x00000000>;
55 clock-frequency = <0>; /* Filled in by U-Boot */
56 timebase-frequency = <0>; /* Filled in by U-Boot */
57 i-cache-line-size = <32>;
58 d-cache-line-size = <32>;
59 i-cache-size = <32768>;
60 d-cache-size = <32768>;
61 dcr-controller;
62 dcr-access-method = "native";
63 };
64 };
65
66 memory {
67 device_type = "memory";
68 reg = <0x00000000 0x00000000 0x00000000>; /* Filled in by U-Boot */
69 };
70
71 UIC0: interrupt-controller0 {
72 compatible = "ibm,uic-460gt","ibm,uic";
73 interrupt-controller;
74 cell-index = <0>;
75 dcr-reg = <0x0c0 0x009>;
76 #address-cells = <0>;
77 #size-cells = <0>;
78 #interrupt-cells = <2>;
79 };
80
81 UIC1: interrupt-controller1 {
82 compatible = "ibm,uic-460gt","ibm,uic";
83 interrupt-controller;
84 cell-index = <1>;
85 dcr-reg = <0x0d0 0x009>;
86 #address-cells = <0>;
87 #size-cells = <0>;
88 #interrupt-cells = <2>;
89 interrupts = <0x1e 0x4 0x1f 0x4>; /* cascade */
90 interrupt-parent = <&UIC0>;
91 };
92
93 UIC2: interrupt-controller2 {
94 compatible = "ibm,uic-460gt","ibm,uic";
95 interrupt-controller;
96 cell-index = <2>;
97 dcr-reg = <0x0e0 0x009>;
98 #address-cells = <0>;
99 #size-cells = <0>;
100 #interrupt-cells = <2>;
101 interrupts = <0xa 0x4 0xb 0x4>; /* cascade */
102 interrupt-parent = <&UIC0>;
103 };
104
105 UIC3: interrupt-controller3 {
106 compatible = "ibm,uic-460gt","ibm,uic";
107 interrupt-controller;
108 cell-index = <3>;
109 dcr-reg = <0x0f0 0x009>;
110 #address-cells = <0>;
111 #size-cells = <0>;
112 #interrupt-cells = <2>;
113 interrupts = <0x10 0x4 0x11 0x4>; /* cascade */
114 interrupt-parent = <&UIC0>;
115 };
116
117 SDR0: sdr {
118 compatible = "ibm,sdr-460gt";
119 dcr-reg = <0x00e 0x002>;
120 };
121
122 CPR0: cpr {
123 compatible = "ibm,cpr-460gt";
124 dcr-reg = <0x00c 0x002>;
125 };
126
127 plb {
128 compatible = "ibm,plb-460gt", "ibm,plb4";
129 #address-cells = <2>;
130 #size-cells = <1>;
131 ranges;
132 clock-frequency = <0>; /* Filled in by U-Boot */
133
134 SDRAM0: sdram {
135 compatible = "ibm,sdram-460gt", "ibm,sdram-405gp";
136 dcr-reg = <0x010 0x002>;
137 };
138
139 MAL0: mcmal {
140 compatible = "ibm,mcmal-460gt", "ibm,mcmal2";
141 dcr-reg = <0x180 0x062>;
142 num-tx-chans = <3>;
143 num-rx-chans = <24>;
144 #address-cells = <0>;
145 #size-cells = <0>;
146 interrupt-parent = <&UIC2>;
147 interrupts = < /*TXEOB*/ 0x6 0x4
148 /*RXEOB*/ 0x7 0x4
149 /*SERR*/ 0x3 0x4
150 /*TXDE*/ 0x4 0x4
151 /*RXDE*/ 0x5 0x4>;
152 desc-base-addr-high = <0x8>;
153 };
154
155 POB0: opb {
156 compatible = "ibm,opb-460gt", "ibm,opb";
157 #address-cells = <1>;
158 #size-cells = <1>;
159 ranges = <0xb0000000 0x00000004 0xb0000000 0x50000000>;
160 clock-frequency = <0>; /* Filled in by U-Boot */
161
162 EBC0: ebc {
163 compatible = "ibm,ebc-460gt", "ibm,ebc";
164 dcr-reg = <0x012 0x002>;
165 #address-cells = <2>;
166 #size-cells = <1>;
167 clock-frequency = <0>; /* Filled in by U-Boot */
168 /* ranges property is supplied by U-Boot */
169 interrupts = <0x6 0x4>;
170 interrupt-parent = <&UIC1>;
171 };
172
173 UART0: serial@ef600300 {
174 device_type = "serial";
175 compatible = "ns16550";
176 reg = <0xef600300 0x00000008>;
177 virtual-reg = <0xef600300>;
178 clock-frequency = <0>; /* Filled in by U-Boot */
179 current-speed = <0>; /* Filled in by U-Boot */
180 interrupt-parent = <&UIC1>;
181 interrupts = <0x1 0x4>;
182 };
183
184 IIC0: i2c@ef600700 {
185 compatible = "ibm,iic-460gt", "ibm,iic";
186 reg = <0xef600700 0x00000014>;
187 interrupt-parent = <&UIC0>;
188 interrupts = <0x2 0x4>;
189 };
190
191 IIC1: i2c@ef600800 {
192 compatible = "ibm,iic-460gt", "ibm,iic";
193 reg = <0xef600800 0x00000014>;
194 interrupt-parent = <&UIC0>;
195 interrupts = <0x3 0x4>;
196 };
197
198 TAH0: emac-tah@ef601350 {
199 compatible = "ibm,tah-460gt", "ibm,tah";
200 reg = <0xef601350 0x00000030>;
201 };
202
203 TAH1: emac-tah@ef601450 {
204 compatible = "ibm,tah-460gt", "ibm,tah";
205 reg = <0xef601450 0x00000030>;
206 };
207
208 EMAC0: ethernet@ef600e00 {
209 device_type = "network";
210 compatible = "ibm,emac-460gt", "ibm,emac4sync";
211 interrupt-parent = <&EMAC0>;
212 interrupts = <0x0 0x1>;
213 #interrupt-cells = <1>;
214 #address-cells = <0>;
215 #size-cells = <0>;
216 interrupt-map = </*Status*/ 0x0 &UIC2 0x10 0x4
217 /*Wake*/ 0x1 &UIC2 0x14 0x4>;
218 reg = <0xef600e00 0x000000c4>;
219 local-mac-address = [000000000000]; /* Filled in by U-Boot */
220 mal-device = <&MAL0>;
221 mal-tx-channel = <0>;
222 mal-rx-channel = <0>;
223 cell-index = <0>;
224 max-frame-size = <9000>;
225 rx-fifo-size = <4096>;
226 tx-fifo-size = <2048>;
227 phy-mode = "sgmii";
228 phy-map = <0xffffffff>;
229 gpcs-address = <0x0000000a>;
230 tah-device = <&TAH0>;
231 tah-channel = <0>;
232 has-inverted-stacr-oc;
233 has-new-stacr-staopc;
234 };
235
236 EMAC1: ethernet@ef600f00 {
237 device_type = "network";
238 compatible = "ibm,emac-460gt", "ibm,emac4sync";
239 interrupt-parent = <&EMAC1>;
240 interrupts = <0x0 0x1>;
241 #interrupt-cells = <1>;
242 #address-cells = <0>;
243 #size-cells = <0>;
244 interrupt-map = </*Status*/ 0x0 &UIC2 0x11 0x4
245 /*Wake*/ 0x1 &UIC2 0x15 0x4>;
246 reg = <0xef600f00 0x000000c4>;
247 local-mac-address = [000000000000]; /* Filled in by U-Boot */
248 mal-device = <&MAL0>;
249 mal-tx-channel = <1>;
250 mal-rx-channel = <8>;
251 cell-index = <1>;
252 max-frame-size = <9000>;
253 rx-fifo-size = <4096>;
254 tx-fifo-size = <2048>;
255 phy-mode = "sgmii";
256 phy-map = <0x00000000>;
257 gpcs-address = <0x0000000b>;
258 tah-device = <&TAH1>;
259 tah-channel = <1>;
260 has-inverted-stacr-oc;
261 has-new-stacr-staopc;
262 mdio-device = <&EMAC0>;
263 };
264
265 EMAC2: ethernet@ef601100 {
266 device_type = "network";
267 compatible = "ibm,emac-460gt", "ibm,emac4sync";
268 interrupt-parent = <&EMAC2>;
269 interrupts = <0x0 0x1>;
270 #interrupt-cells = <1>;
271 #address-cells = <0>;
272 #size-cells = <0>;
273 interrupt-map = </*Status*/ 0x0 &UIC2 0x12 0x4
274 /*Wake*/ 0x1 &UIC2 0x16 0x4>;
275 reg = <0xef601100 0x000000c4>;
276 local-mac-address = [000000000000]; /* Filled in by U-Boot */
277 mal-device = <&MAL0>;
278 mal-tx-channel = <2>;
279 mal-rx-channel = <16>;
280 cell-index = <2>;
281 max-frame-size = <9000>;
282 rx-fifo-size = <4096>;
283 tx-fifo-size = <2048>;
284 phy-mode = "sgmii";
285 phy-map = <0x00000001>;
286 gpcs-address = <0x0000000C>;
287 has-inverted-stacr-oc;
288 has-new-stacr-staopc;
289 mdio-device = <&EMAC0>;
290 };
291 };
292 };
293};
diff --git a/arch/powerpc/boot/dts/asp834x-redboot.dts b/arch/powerpc/boot/dts/asp834x-redboot.dts
index 8b1bb0e41905..6235fca445de 100644
--- a/arch/powerpc/boot/dts/asp834x-redboot.dts
+++ b/arch/powerpc/boot/dts/asp834x-redboot.dts
@@ -130,24 +130,28 @@
130 dma-channel@0 { 130 dma-channel@0 {
131 compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel"; 131 compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel";
132 reg = <0 0x80>; 132 reg = <0 0x80>;
133 cell-index = <0>;
133 interrupt-parent = <&ipic>; 134 interrupt-parent = <&ipic>;
134 interrupts = <71 8>; 135 interrupts = <71 8>;
135 }; 136 };
136 dma-channel@80 { 137 dma-channel@80 {
137 compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel"; 138 compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel";
138 reg = <0x80 0x80>; 139 reg = <0x80 0x80>;
140 cell-index = <1>;
139 interrupt-parent = <&ipic>; 141 interrupt-parent = <&ipic>;
140 interrupts = <71 8>; 142 interrupts = <71 8>;
141 }; 143 };
142 dma-channel@100 { 144 dma-channel@100 {
143 compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel"; 145 compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel";
144 reg = <0x100 0x80>; 146 reg = <0x100 0x80>;
147 cell-index = <2>;
145 interrupt-parent = <&ipic>; 148 interrupt-parent = <&ipic>;
146 interrupts = <71 8>; 149 interrupts = <71 8>;
147 }; 150 };
148 dma-channel@180 { 151 dma-channel@180 {
149 compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel"; 152 compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel";
150 reg = <0x180 0x28>; 153 reg = <0x180 0x28>;
154 cell-index = <3>;
151 interrupt-parent = <&ipic>; 155 interrupt-parent = <&ipic>;
152 interrupts = <71 8>; 156 interrupts = <71 8>;
153 }; 157 };
diff --git a/arch/powerpc/boot/dts/gef_sbc610.dts b/arch/powerpc/boot/dts/gef_sbc610.dts
new file mode 100644
index 000000000000..6ed608322ddc
--- /dev/null
+++ b/arch/powerpc/boot/dts/gef_sbc610.dts
@@ -0,0 +1,293 @@
1/*
2 * GE Fanuc SBC610 Device Tree Source
3 *
4 * Copyright 2008 GE Fanuc Intelligent Platforms Embedded Systems, 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 * Based on: SBS CM6 Device Tree Source
12 * Copyright 2007 SBS Technologies GmbH & Co. KG
13 * And: mpc8641_hpcn.dts (MPC8641 HPCN Device Tree Source)
14 * Copyright 2006 Freescale Semiconductor Inc.
15 */
16
17/*
18 * Compiled with dtc -I dts -O dtb -o gef_sbc610.dtb gef_sbc610.dts
19 */
20
21/dts-v1/;
22
23/ {
24 model = "GEF_SBC610";
25 compatible = "gef,sbc610";
26 #address-cells = <1>;
27 #size-cells = <1>;
28
29 aliases {
30 ethernet0 = &enet0;
31 ethernet1 = &enet1;
32 serial0 = &serial0;
33 serial1 = &serial1;
34 pci0 = &pci0;
35 };
36
37 cpus {
38 #address-cells = <1>;
39 #size-cells = <0>;
40
41 PowerPC,8641@0 {
42 device_type = "cpu";
43 reg = <0>;
44 d-cache-line-size = <32>; // 32 bytes
45 i-cache-line-size = <32>; // 32 bytes
46 d-cache-size = <32768>; // L1, 32K
47 i-cache-size = <32768>; // L1, 32K
48 timebase-frequency = <0>; // From uboot
49 bus-frequency = <0>; // From uboot
50 clock-frequency = <0>; // From uboot
51 };
52 PowerPC,8641@1 {
53 device_type = "cpu";
54 reg = <1>;
55 d-cache-line-size = <32>; // 32 bytes
56 i-cache-line-size = <32>; // 32 bytes
57 d-cache-size = <32768>; // L1, 32K
58 i-cache-size = <32768>; // L1, 32K
59 timebase-frequency = <0>; // From uboot
60 bus-frequency = <0>; // From uboot
61 clock-frequency = <0>; // From uboot
62 };
63 };
64
65 memory {
66 device_type = "memory";
67 reg = <0x0 0x40000000>; // set by uboot
68 };
69
70 localbus@fef05000 {
71 #address-cells = <2>;
72 #size-cells = <1>;
73 compatible = "fsl,mpc8641-localbus", "simple-bus";
74 reg = <0xf8005000 0x1000>;
75 interrupts = <19 2>;
76 interrupt-parent = <&mpic>;
77
78 ranges = <0 0 0xff000000 0x01000000 // 16MB Boot flash
79 1 0 0xe8000000 0x08000000 // Paged Flash 0
80 2 0 0xe0000000 0x08000000 // Paged Flash 1
81 3 0 0xfc100000 0x00020000 // NVRAM
82 4 0 0xfc000000 0x00008000 // FPGA
83 5 0 0xfc008000 0x00008000 // AFIX FPGA
84 6 0 0xfd000000 0x00800000 // IO FPGA (8-bit)
85 7 0 0xfd800000 0x00800000>; // IO FPGA (32-bit)
86
87 fpga@4,0 {
88 compatible = "gef,fpga-regs";
89 reg = <0x4 0x0 0x40>;
90 };
91 gef_pic: pic@4,4000 {
92 #interrupt-cells = <1>;
93 interrupt-controller;
94 compatible = "gef,fpga-pic";
95 reg = <0x4 0x4000 0x20>;
96 interrupts = <0x8
97 0x9>;
98 interrupt-parent = <&mpic>;
99
100 };
101 };
102
103 soc@fef00000 {
104 #address-cells = <1>;
105 #size-cells = <1>;
106 #interrupt-cells = <2>;
107 device_type = "soc";
108 compatible = "simple-bus";
109 ranges = <0x0 0xfef00000 0x00100000>;
110 reg = <0xfef00000 0x100000>; // CCSRBAR 1M
111 bus-frequency = <0>;
112
113 i2c1: i2c@3000 {
114 #address-cells = <1>;
115 #size-cells = <0>;
116 compatible = "fsl-i2c";
117 reg = <0x3000 0x100>;
118 interrupts = <0x2b 0x2>;
119 interrupt-parent = <&mpic>;
120 dfsrr;
121
122 eti@6b {
123 compatible = "dallas,ds1682";
124 reg = <0x6b>;
125 };
126 };
127
128 i2c2: i2c@3100 {
129 #address-cells = <1>;
130 #size-cells = <0>;
131 compatible = "fsl-i2c";
132 reg = <0x3100 0x100>;
133 interrupts = <0x2b 0x2>;
134 interrupt-parent = <&mpic>;
135 dfsrr;
136 };
137
138 dma@21300 {
139 #address-cells = <1>;
140 #size-cells = <1>;
141 compatible = "fsl,mpc8641-dma", "fsl,eloplus-dma";
142 reg = <0x21300 0x4>;
143 ranges = <0x0 0x21100 0x200>;
144 cell-index = <0>;
145 dma-channel@0 {
146 compatible = "fsl,mpc8641-dma-channel",
147 "fsl,eloplus-dma-channel";
148 reg = <0x0 0x80>;
149 cell-index = <0>;
150 interrupt-parent = <&mpic>;
151 interrupts = <20 2>;
152 };
153 dma-channel@80 {
154 compatible = "fsl,mpc8641-dma-channel",
155 "fsl,eloplus-dma-channel";
156 reg = <0x80 0x80>;
157 cell-index = <1>;
158 interrupt-parent = <&mpic>;
159 interrupts = <21 2>;
160 };
161 dma-channel@100 {
162 compatible = "fsl,mpc8641-dma-channel",
163 "fsl,eloplus-dma-channel";
164 reg = <0x100 0x80>;
165 cell-index = <2>;
166 interrupt-parent = <&mpic>;
167 interrupts = <22 2>;
168 };
169 dma-channel@180 {
170 compatible = "fsl,mpc8641-dma-channel",
171 "fsl,eloplus-dma-channel";
172 reg = <0x180 0x80>;
173 cell-index = <3>;
174 interrupt-parent = <&mpic>;
175 interrupts = <23 2>;
176 };
177 };
178
179 mdio@24520 {
180 #address-cells = <1>;
181 #size-cells = <0>;
182 compatible = "fsl,gianfar-mdio";
183 reg = <0x24520 0x20>;
184
185 phy0: ethernet-phy@0 {
186 interrupt-parent = <&gef_pic>;
187 interrupts = <0x9 0x4>;
188 reg = <1>;
189 };
190 phy2: ethernet-phy@2 {
191 interrupt-parent = <&gef_pic>;
192 interrupts = <0x8 0x4>;
193 reg = <3>;
194 };
195 };
196
197 enet0: ethernet@24000 {
198 device_type = "network";
199 model = "eTSEC";
200 compatible = "gianfar";
201 reg = <0x24000 0x1000>;
202 local-mac-address = [ 00 00 00 00 00 00 ];
203 interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>;
204 interrupt-parent = <&mpic>;
205 phy-handle = <&phy0>;
206 phy-connection-type = "gmii";
207 };
208
209 enet1: ethernet@26000 {
210 device_type = "network";
211 model = "eTSEC";
212 compatible = "gianfar";
213 reg = <0x26000 0x1000>;
214 local-mac-address = [ 00 00 00 00 00 00 ];
215 interrupts = <0x1f 0x2 0x20 0x2 0x21 0x2>;
216 interrupt-parent = <&mpic>;
217 phy-handle = <&phy2>;
218 phy-connection-type = "gmii";
219 };
220
221 serial0: serial@4500 {
222 cell-index = <0>;
223 device_type = "serial";
224 compatible = "ns16550";
225 reg = <0x4500 0x100>;
226 clock-frequency = <0>;
227 interrupts = <0x2a 0x2>;
228 interrupt-parent = <&mpic>;
229 };
230
231 serial1: serial@4600 {
232 cell-index = <1>;
233 device_type = "serial";
234 compatible = "ns16550";
235 reg = <0x4600 0x100>;
236 clock-frequency = <0>;
237 interrupts = <0x1c 0x2>;
238 interrupt-parent = <&mpic>;
239 };
240
241 mpic: pic@40000 {
242 clock-frequency = <0>;
243 interrupt-controller;
244 #address-cells = <0>;
245 #interrupt-cells = <2>;
246 reg = <0x40000 0x40000>;
247 compatible = "chrp,open-pic";
248 device_type = "open-pic";
249 };
250
251 global-utilities@e0000 {
252 compatible = "fsl,mpc8641-guts";
253 reg = <0xe0000 0x1000>;
254 fsl,has-rstcr;
255 };
256 };
257
258 pci0: pcie@fef08000 {
259 compatible = "fsl,mpc8641-pcie";
260 device_type = "pci";
261 #interrupt-cells = <1>;
262 #size-cells = <2>;
263 #address-cells = <3>;
264 reg = <0xfef08000 0x1000>;
265 bus-range = <0x0 0xff>;
266 ranges = <0x02000000 0x0 0x80000000 0x80000000 0x0 0x40000000
267 0x01000000 0x0 0x00000000 0xfe000000 0x0 0x00400000>;
268 clock-frequency = <33333333>;
269 interrupt-parent = <&mpic>;
270 interrupts = <0x18 0x2>;
271 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
272 interrupt-map = <
273 0x0000 0x0 0x0 0x1 &mpic 0x0 0x1
274 0x0000 0x0 0x0 0x2 &mpic 0x1 0x1
275 0x0000 0x0 0x0 0x3 &mpic 0x2 0x1
276 0x0000 0x0 0x0 0x4 &mpic 0x3 0x1
277 >;
278
279 pcie@0 {
280 reg = <0 0 0 0 0>;
281 #size-cells = <2>;
282 #address-cells = <3>;
283 device_type = "pci";
284 ranges = <0x02000000 0x0 0x80000000
285 0x02000000 0x0 0x80000000
286 0x0 0x40000000
287
288 0x01000000 0x0 0x00000000
289 0x01000000 0x0 0x00000000
290 0x0 0x00400000>;
291 };
292 };
293};
diff --git a/arch/powerpc/boot/dts/glacier.dts b/arch/powerpc/boot/dts/glacier.dts
index 24cf0dba120c..f3787a27f634 100644
--- a/arch/powerpc/boot/dts/glacier.dts
+++ b/arch/powerpc/boot/dts/glacier.dts
@@ -14,7 +14,7 @@
14 #address-cells = <2>; 14 #address-cells = <2>;
15 #size-cells = <1>; 15 #size-cells = <1>;
16 model = "amcc,glacier"; 16 model = "amcc,glacier";
17 compatible = "amcc,glacier", "amcc,canyonlands"; 17 compatible = "amcc,glacier";
18 dcr-parent = <&{/cpus/cpu@0}>; 18 dcr-parent = <&{/cpus/cpu@0}>;
19 19
20 aliases { 20 aliases {
diff --git a/arch/powerpc/boot/dts/holly.dts b/arch/powerpc/boot/dts/holly.dts
index f87fe7b9ced9..c6e11ebecebb 100644
--- a/arch/powerpc/boot/dts/holly.dts
+++ b/arch/powerpc/boot/dts/holly.dts
@@ -133,61 +133,61 @@
133 reg = <0x00007400 0x00000400>; 133 reg = <0x00007400 0x00000400>;
134 big-endian; 134 big-endian;
135 }; 135 };
136 };
136 137
137 pci@1000 { 138 pci@c0001000 {
138 device_type = "pci"; 139 device_type = "pci";
139 compatible = "tsi109-pci", "tsi108-pci"; 140 compatible = "tsi109-pci", "tsi108-pci";
140 #interrupt-cells = <1>; 141 #interrupt-cells = <1>;
141 #size-cells = <2>; 142 #size-cells = <2>;
142 #address-cells = <3>; 143 #address-cells = <3>;
143 reg = <0x00001000 0x00001000>; 144 reg = <0xc0001000 0x00001000>;
144 bus-range = <0x0 0x0>; 145 bus-range = <0x0 0x0>;
145 /*----------------------------------------------------+ 146 /*----------------------------------------------------+
146 | PCI memory range. 147 | PCI memory range.
147 | 01 denotes I/O space 148 | 01 denotes I/O space
148 | 02 denotes 32-bit memory space 149 | 02 denotes 32-bit memory space
149 +----------------------------------------------------*/ 150 +----------------------------------------------------*/
150 ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000 151 ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000
151 0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>; 152 0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>;
152 clock-frequency = <133333332>; 153 clock-frequency = <133333332>;
153 interrupt-parent = <&MPIC>; 154 interrupt-parent = <&MPIC>;
155 interrupts = <0x17 0x2>;
156 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
157 /*----------------------------------------------------+
158 | The INTA, INTB, INTC, INTD are shared.
159 +----------------------------------------------------*/
160 interrupt-map = <
161 0x800 0x0 0x0 0x1 &RT0 0x24 0x0
162 0x800 0x0 0x0 0x2 &RT0 0x25 0x0
163 0x800 0x0 0x0 0x3 &RT0 0x26 0x0
164 0x800 0x0 0x0 0x4 &RT0 0x27 0x0
165
166 0x1000 0x0 0x0 0x1 &RT0 0x25 0x0
167 0x1000 0x0 0x0 0x2 &RT0 0x26 0x0
168 0x1000 0x0 0x0 0x3 &RT0 0x27 0x0
169 0x1000 0x0 0x0 0x4 &RT0 0x24 0x0
170
171 0x1800 0x0 0x0 0x1 &RT0 0x26 0x0
172 0x1800 0x0 0x0 0x2 &RT0 0x27 0x0
173 0x1800 0x0 0x0 0x3 &RT0 0x24 0x0
174 0x1800 0x0 0x0 0x4 &RT0 0x25 0x0
175
176 0x2000 0x0 0x0 0x1 &RT0 0x27 0x0
177 0x2000 0x0 0x0 0x2 &RT0 0x24 0x0
178 0x2000 0x0 0x0 0x3 &RT0 0x25 0x0
179 0x2000 0x0 0x0 0x4 &RT0 0x26 0x0
180 >;
181
182 RT0: router@1180 {
183 device_type = "pic-router";
184 interrupt-controller;
185 big-endian;
186 clock-frequency = <0>;
187 #address-cells = <0>;
188 #interrupt-cells = <2>;
154 interrupts = <0x17 0x2>; 189 interrupts = <0x17 0x2>;
155 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 190 interrupt-parent = <&MPIC>;
156 /*----------------------------------------------------+
157 | The INTA, INTB, INTC, INTD are shared.
158 +----------------------------------------------------*/
159 interrupt-map = <
160 0x800 0x0 0x0 0x1 &RT0 0x24 0x0
161 0x800 0x0 0x0 0x2 &RT0 0x25 0x0
162 0x800 0x0 0x0 0x3 &RT0 0x26 0x0
163 0x800 0x0 0x0 0x4 &RT0 0x27 0x0
164
165 0x1000 0x0 0x0 0x1 &RT0 0x25 0x0
166 0x1000 0x0 0x0 0x2 &RT0 0x26 0x0
167 0x1000 0x0 0x0 0x3 &RT0 0x27 0x0
168 0x1000 0x0 0x0 0x4 &RT0 0x24 0x0
169
170 0x1800 0x0 0x0 0x1 &RT0 0x26 0x0
171 0x1800 0x0 0x0 0x2 &RT0 0x27 0x0
172 0x1800 0x0 0x0 0x3 &RT0 0x24 0x0
173 0x1800 0x0 0x0 0x4 &RT0 0x25 0x0
174
175 0x2000 0x0 0x0 0x1 &RT0 0x27 0x0
176 0x2000 0x0 0x0 0x2 &RT0 0x24 0x0
177 0x2000 0x0 0x0 0x3 &RT0 0x25 0x0
178 0x2000 0x0 0x0 0x4 &RT0 0x26 0x0
179 >;
180
181 RT0: router@1180 {
182 device_type = "pic-router";
183 interrupt-controller;
184 big-endian;
185 clock-frequency = <0>;
186 #address-cells = <0>;
187 #interrupt-cells = <2>;
188 interrupts = <0x17 0x2>;
189 interrupt-parent = <&MPIC>;
190 };
191 }; 191 };
192 }; 192 };
193 193
diff --git a/arch/powerpc/boot/dts/mgcoge.dts b/arch/powerpc/boot/dts/mgcoge.dts
new file mode 100644
index 000000000000..633255a97557
--- /dev/null
+++ b/arch/powerpc/boot/dts/mgcoge.dts
@@ -0,0 +1,174 @@
1/*
2 * Device Tree for the MGCOGE plattform from keymile
3 *
4 * Copyright 2008 DENX Software Engineering GmbH
5 * Heiko Schocher <hs@denx.de>
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/dts-v1/;
14/ {
15 model = "MGCOGE";
16 compatible = "keymile,mgcoge";
17 #address-cells = <1>;
18 #size-cells = <1>;
19
20 aliases {
21 ethernet0 = &eth0;
22 serial0 = &smc2;
23 };
24
25 cpus {
26 #address-cells = <1>;
27 #size-cells = <0>;
28
29 PowerPC,8247@0 {
30 device_type = "cpu";
31 reg = <0>;
32 d-cache-line-size = <32>;
33 i-cache-line-size = <32>;
34 d-cache-size = <16384>;
35 i-cache-size = <16384>;
36 timebase-frequency = <0>; /* Filled in by U-Boot */
37 clock-frequency = <0>; /* Filled in by U-Boot */
38 bus-frequency = <0>; /* Filled in by U-Boot */
39 };
40 };
41
42 localbus@f0010100 {
43 compatible = "fsl,mpc8247-localbus",
44 "fsl,pq2-localbus",
45 "simple-bus";
46 #address-cells = <2>;
47 #size-cells = <1>;
48 reg = <0xf0010100 0x40>;
49
50 ranges = <0 0 0xfe000000 0x00400000
51 5 0 0x50000000 0x20000000
52 >; /* Filled in by U-Boot */
53
54 flash@0,0 {
55 compatible = "cfi-flash";
56 reg = <0 0x0 0x400000>;
57 #address-cells = <1>;
58 #size-cells = <1>;
59 bank-width = <1>;
60 device-width = <1>;
61 partition@0 {
62 label = "u-boot";
63 reg = <0 0x40000>;
64 };
65 partition@40000 {
66 label = "env";
67 reg = <0x40000 0x20000>;
68 };
69 partition@60000 {
70 label = "kernel";
71 reg = <0x60000 0x220000>;
72 };
73 partition@280000 {
74 label = "dtb";
75 reg = <0x280000 0x20000>;
76 };
77 };
78
79 flash@5,0 {
80 compatible = "cfi-flash";
81 reg = <5 0x0 0x2000000>;
82 #address-cells = <1>;
83 #size-cells = <1>;
84 bank-width = <2>;
85 device-width = <2>;
86 partition@0 {
87 label = "ramdisk";
88 reg = <0 0x7a0000>;
89 };
90 partition@7a0000 {
91 label = "user";
92 reg = <0x7a0000 0x1860000>;
93 };
94 };
95 };
96
97 memory {
98 device_type = "memory";
99 reg = <0 0>; /* Filled in by U-Boot */
100 };
101
102 soc@f0000000 {
103 #address-cells = <1>;
104 #size-cells = <1>;
105 compatible = "fsl,mpc8247-immr", "fsl,pq2-soc", "simple-bus";
106 ranges = <0x00000000 0xf0000000 0x00053000>;
107
108 // Temporary until code stops depending on it.
109 device_type = "soc";
110
111 cpm@119c0 {
112 #address-cells = <1>;
113 #size-cells = <1>;
114 #interrupt-cells = <2>;
115 compatible = "fsl,mpc8247-cpm", "fsl,cpm2",
116 "simple-bus";
117 reg = <0x119c0 0x30>;
118 ranges;
119
120 muram {
121 compatible = "fsl,cpm-muram";
122 #address-cells = <1>;
123 #size-cells = <1>;
124 ranges = <0 0 0x10000>;
125
126 data@0 {
127 compatible = "fsl,cpm-muram-data";
128 reg = <0x80 0x1f80 0x9800 0x800>;
129 };
130 };
131
132 brg@119f0 {
133 compatible = "fsl,mpc8247-brg",
134 "fsl,cpm2-brg",
135 "fsl,cpm-brg";
136 reg = <0x119f0 0x10 0x115f0 0x10>;
137 };
138
139 /* Monitor port/SMC2 */
140 smc2: serial@11a90 {
141 device_type = "serial";
142 compatible = "fsl,mpc8247-smc-uart",
143 "fsl,cpm2-smc-uart";
144 reg = <0x11a90 0x20 0x88fc 0x02>;
145 interrupts = <5 8>;
146 interrupt-parent = <&PIC>;
147 fsl,cpm-brg = <2>;
148 fsl,cpm-command = <0x21200000>;
149 current-speed = <0>; /* Filled in by U-Boot */
150 };
151
152 eth0: ethernet@11a60 {
153 device_type = "network";
154 compatible = "fsl,mpc8247-scc-enet",
155 "fsl,cpm2-scc-enet";
156 reg = <0x11a60 0x20 0x8300 0x100 0x11390 1>;
157 local-mac-address = [ 00 00 00 00 00 00 ]; /* Filled in by U-Boot */
158 interrupts = <43 8>;
159 interrupt-parent = <&PIC>;
160 linux,network-index = <0>;
161 fsl,cpm-command = <0xce00000>;
162 fixed-link = <0 0 10 0 0>;
163 };
164
165 };
166
167 PIC: interrupt-controller@10c00 {
168 #interrupt-cells = <2>;
169 interrupt-controller;
170 reg = <0x10c00 0x80>;
171 compatible = "fsl,mpc8247-pic", "fsl,pq2-pic";
172 };
173 };
174};
diff --git a/arch/powerpc/boot/dts/mgsuvd.dts b/arch/powerpc/boot/dts/mgsuvd.dts
new file mode 100644
index 000000000000..e4fc53ab42bd
--- /dev/null
+++ b/arch/powerpc/boot/dts/mgsuvd.dts
@@ -0,0 +1,163 @@
1/*
2 * MGSUVD Device Tree Source
3 *
4 * Copyright 2008 DENX Software Engineering GmbH
5 * Heiko Schocher <hs@denx.de>
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/dts-v1/;
14/ {
15 model = "MGSUVD";
16 compatible = "keymile,mgsuvd";
17 #address-cells = <1>;
18 #size-cells = <1>;
19
20 cpus {
21 #address-cells = <1>;
22 #size-cells = <0>;
23
24 PowerPC,852@0 {
25 device_type = "cpu";
26 reg = <0>;
27 d-cache-line-size = <16>;
28 i-cache-line-size = <16>;
29 d-cache-size = <8192>;
30 i-cache-size = <8192>;
31 timebase-frequency = <0>; /* Filled in by u-boot */
32 bus-frequency = <0>; /* Filled in by u-boot */
33 clock-frequency = <0>; /* Filled in by u-boot */
34 interrupts = <15 2>; /* decrementer interrupt */
35 interrupt-parent = <&PIC>;
36 };
37 };
38
39 memory {
40 device_type = "memory";
41 reg = <00000000 0x4000000>; /* Filled in by u-boot */
42 };
43
44 localbus@fff00100 {
45 compatible = "fsl,mpc852-localbus", "fsl,pq1-localbus", "simple-bus";
46 #address-cells = <2>;
47 #size-cells = <1>;
48 reg = <0xfff00100 0x40>;
49
50 ranges = <0 0 0xf0000000 0x01000000>; /* Filled in by u-boot */
51
52 flash@0,0 {
53 compatible = "cfi-flash";
54 reg = <0 0 0x1000000>;
55 #address-cells = <1>;
56 #size-cells = <1>;
57 bank-width = <1>;
58 device-width = <1>;
59 partition@0 {
60 label = "u-boot";
61 reg = <0 0x80000>;
62 };
63 partition@80000 {
64 label = "env";
65 reg = <0x80000 0x20000>;
66 };
67 partition@a0000 {
68 label = "kernel";
69 reg = <0xa0000 0x1e0000>;
70 };
71 partition@280000 {
72 label = "dtb";
73 reg = <0x280000 0x20000>;
74 };
75 partition@2a0000 {
76 label = "root";
77 reg = <0x2a0000 0x500000>;
78 };
79 partition@7a0000 {
80 label = "user";
81 reg = <0x7a0000 0x860000>;
82 };
83 };
84 };
85
86 soc@fff00000 {
87 compatible = "fsl,mpc852", "fsl,pq1-soc", "simple-bus";
88 #address-cells = <1>;
89 #size-cells = <1>;
90 device_type = "soc";
91 ranges = <0 0xfff00000 0x00004000>;
92
93 PIC: interrupt-controller@0 {
94 interrupt-controller;
95 #interrupt-cells = <2>;
96 reg = <0 24>;
97 compatible = "fsl,mpc852-pic", "fsl,pq1-pic";
98 };
99
100 cpm@9c0 {
101 #address-cells = <1>;
102 #size-cells = <1>;
103 compatible = "fsl,mpc852-cpm", "fsl,cpm1", "simple-bus";
104 interrupts = <0>; /* cpm error interrupt */
105 interrupt-parent = <&CPM_PIC>;
106 reg = <0x9c0 10>;
107 ranges;
108
109 muram@2000 {
110 compatible = "fsl,cpm-muram";
111 #address-cells = <1>;
112 #size-cells = <1>;
113 ranges = <0 0x2000 0x2000>;
114
115 data@0 {
116 compatible = "fsl,cpm-muram-data";
117 reg = <0x800 0x1800>;
118 };
119 };
120
121 brg@9f0 {
122 compatible = "fsl,mpc852-brg",
123 "fsl,cpm1-brg",
124 "fsl,cpm-brg";
125 reg = <0x9f0 0x10>;
126 clock-frequency = <0>; /* Filled in by u-boot */
127 };
128
129 CPM_PIC: interrupt-controller@930 {
130 interrupt-controller;
131 #interrupt-cells = <1>;
132 interrupts = <5 2 0 2>;
133 interrupt-parent = <&PIC>;
134 reg = <0x930 0x20>;
135 compatible = "fsl,cpm1-pic";
136 };
137
138 /* MON-1 */
139 serial@a80 {
140 device_type = "serial";
141 compatible = "fsl,cpm1-smc-uart";
142 reg = <0xa80 0x10 0x3fc0 0x40>;
143 interrupts = <4>;
144 interrupt-parent = <&CPM_PIC>;
145 fsl,cpm-brg = <1>;
146 fsl,cpm-command = <0x0090>;
147 current-speed = <0>; /* Filled in by u-boot */
148 };
149
150 ethernet@a40 {
151 device_type = "network";
152 compatible = "fsl,mpc866-scc-enet",
153 "fsl,cpm1-scc-enet";
154 reg = <0xa40 0x18 0x3e00 0x100>;
155 local-mac-address = [ 00 00 00 00 00 00 ]; /* Filled in by u-boot */
156 interrupts = <28>;
157 interrupt-parent = <&CPM_PIC>;
158 fsl,cpm-command = <0x80>;
159 fixed-link = <0 0 10 0 0>;
160 };
161 };
162 };
163};
diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts
index 1f9036c317b4..c2b8dbfab79e 100644
--- a/arch/powerpc/boot/dts/mpc5121ads.dts
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -403,7 +403,8 @@
403 #interrupt-cells = <1>; 403 #interrupt-cells = <1>;
404 #size-cells = <2>; 404 #size-cells = <2>;
405 #address-cells = <3>; 405 #address-cells = <3>;
406 reg = <0x80008500 0x100>; 406 reg = <0x80008500 0x100 /* internal registers */
407 0x80008300 0x8>; /* config space access registers */
407 compatible = "fsl,mpc5121-pci"; 408 compatible = "fsl,mpc5121-pci";
408 device_type = "pci"; 409 device_type = "pci";
409 }; 410 };
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 2a94ae0dc8b8..747f27676332 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -176,24 +176,28 @@
176 dma-channel@0 { 176 dma-channel@0 {
177 compatible = "fsl,mpc8313-dma-channel", "fsl,elo-dma-channel"; 177 compatible = "fsl,mpc8313-dma-channel", "fsl,elo-dma-channel";
178 reg = <0 0x80>; 178 reg = <0 0x80>;
179 cell-index = <0>;
179 interrupt-parent = <&ipic>; 180 interrupt-parent = <&ipic>;
180 interrupts = <71 8>; 181 interrupts = <71 8>;
181 }; 182 };
182 dma-channel@80 { 183 dma-channel@80 {
183 compatible = "fsl,mpc8313-dma-channel", "fsl,elo-dma-channel"; 184 compatible = "fsl,mpc8313-dma-channel", "fsl,elo-dma-channel";
184 reg = <0x80 0x80>; 185 reg = <0x80 0x80>;
186 cell-index = <1>;
185 interrupt-parent = <&ipic>; 187 interrupt-parent = <&ipic>;
186 interrupts = <71 8>; 188 interrupts = <71 8>;
187 }; 189 };
188 dma-channel@100 { 190 dma-channel@100 {
189 compatible = "fsl,mpc8313-dma-channel", "fsl,elo-dma-channel"; 191 compatible = "fsl,mpc8313-dma-channel", "fsl,elo-dma-channel";
190 reg = <0x100 0x80>; 192 reg = <0x100 0x80>;
193 cell-index = <2>;
191 interrupt-parent = <&ipic>; 194 interrupt-parent = <&ipic>;
192 interrupts = <71 8>; 195 interrupts = <71 8>;
193 }; 196 };
194 dma-channel@180 { 197 dma-channel@180 {
195 compatible = "fsl,mpc8313-dma-channel", "fsl,elo-dma-channel"; 198 compatible = "fsl,mpc8313-dma-channel", "fsl,elo-dma-channel";
196 reg = <0x180 0x28>; 199 reg = <0x180 0x28>;
200 cell-index = <3>;
197 interrupt-parent = <&ipic>; 201 interrupt-parent = <&ipic>;
198 interrupts = <71 8>; 202 interrupts = <71 8>;
199 }; 203 };
@@ -359,7 +363,8 @@
359 #interrupt-cells = <1>; 363 #interrupt-cells = <1>;
360 #size-cells = <2>; 364 #size-cells = <2>;
361 #address-cells = <3>; 365 #address-cells = <3>;
362 reg = <0xe0008500 0x100>; 366 reg = <0xe0008500 0x100 /* internal registers */
367 0xe0008300 0x8>; /* config space access registers */
363 compatible = "fsl,mpc8349-pci"; 368 compatible = "fsl,mpc8349-pci";
364 device_type = "pci"; 369 device_type = "pci";
365 }; 370 };
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index f704513fb930..7449e54c1a90 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -144,24 +144,28 @@
144 dma-channel@0 { 144 dma-channel@0 {
145 compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel"; 145 compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
146 reg = <0 0x80>; 146 reg = <0 0x80>;
147 cell-index = <0>;
147 interrupt-parent = <&ipic>; 148 interrupt-parent = <&ipic>;
148 interrupts = <71 8>; 149 interrupts = <71 8>;
149 }; 150 };
150 dma-channel@80 { 151 dma-channel@80 {
151 compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel"; 152 compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
152 reg = <0x80 0x80>; 153 reg = <0x80 0x80>;
154 cell-index = <1>;
153 interrupt-parent = <&ipic>; 155 interrupt-parent = <&ipic>;
154 interrupts = <71 8>; 156 interrupts = <71 8>;
155 }; 157 };
156 dma-channel@100 { 158 dma-channel@100 {
157 compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel"; 159 compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
158 reg = <0x100 0x80>; 160 reg = <0x100 0x80>;
161 cell-index = <2>;
159 interrupt-parent = <&ipic>; 162 interrupt-parent = <&ipic>;
160 interrupts = <71 8>; 163 interrupts = <71 8>;
161 }; 164 };
162 dma-channel@180 { 165 dma-channel@180 {
163 compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel"; 166 compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
164 reg = <0x180 0x28>; 167 reg = <0x180 0x28>;
168 cell-index = <3>;
165 interrupt-parent = <&ipic>; 169 interrupt-parent = <&ipic>;
166 interrupts = <71 8>; 170 interrupts = <71 8>;
167 }; 171 };
@@ -314,7 +318,8 @@
314 #interrupt-cells = <1>; 318 #interrupt-cells = <1>;
315 #size-cells = <2>; 319 #size-cells = <2>;
316 #address-cells = <3>; 320 #address-cells = <3>;
317 reg = <0xe0008500 0x100>; 321 reg = <0xe0008500 0x100 /* internal registers */
322 0xe0008300 0x8>; /* config space access registers */
318 compatible = "fsl,mpc8349-pci"; 323 compatible = "fsl,mpc8349-pci";
319 device_type = "pci"; 324 device_type = "pci";
320 }; 325 };
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index fbc930410ff6..e4cc1768f241 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -127,24 +127,28 @@
127 dma-channel@0 { 127 dma-channel@0 {
128 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel"; 128 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
129 reg = <0 0x80>; 129 reg = <0 0x80>;
130 cell-index = <0>;
130 interrupt-parent = <&ipic>; 131 interrupt-parent = <&ipic>;
131 interrupts = <71 8>; 132 interrupts = <71 8>;
132 }; 133 };
133 dma-channel@80 { 134 dma-channel@80 {
134 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel"; 135 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
135 reg = <0x80 0x80>; 136 reg = <0x80 0x80>;
137 cell-index = <1>;
136 interrupt-parent = <&ipic>; 138 interrupt-parent = <&ipic>;
137 interrupts = <71 8>; 139 interrupts = <71 8>;
138 }; 140 };
139 dma-channel@100 { 141 dma-channel@100 {
140 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel"; 142 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
141 reg = <0x100 0x80>; 143 reg = <0x100 0x80>;
144 cell-index = <2>;
142 interrupt-parent = <&ipic>; 145 interrupt-parent = <&ipic>;
143 interrupts = <71 8>; 146 interrupts = <71 8>;
144 }; 147 };
145 dma-channel@180 { 148 dma-channel@180 {
146 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel"; 149 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
147 reg = <0x180 0x28>; 150 reg = <0x180 0x28>;
151 cell-index = <3>;
148 interrupt-parent = <&ipic>; 152 interrupt-parent = <&ipic>;
149 interrupts = <71 8>; 153 interrupts = <71 8>;
150 }; 154 };
@@ -419,7 +423,8 @@
419 #interrupt-cells = <1>; 423 #interrupt-cells = <1>;
420 #size-cells = <2>; 424 #size-cells = <2>;
421 #address-cells = <3>; 425 #address-cells = <3>;
422 reg = <0xe0008500 0x100>; 426 reg = <0xe0008500 0x100 /* internal registers */
427 0xe0008300 0x8>; /* config space access registers */
423 compatible = "fsl,mpc8349-pci"; 428 compatible = "fsl,mpc8349-pci";
424 device_type = "pci"; 429 device_type = "pci";
425 }; 430 };
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index b157d1885a28..226ff066652b 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -105,24 +105,28 @@
105 dma-channel@0 { 105 dma-channel@0 {
106 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel"; 106 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
107 reg = <0 0x80>; 107 reg = <0 0x80>;
108 cell-index = <0>;
108 interrupt-parent = <&ipic>; 109 interrupt-parent = <&ipic>;
109 interrupts = <71 8>; 110 interrupts = <71 8>;
110 }; 111 };
111 dma-channel@80 { 112 dma-channel@80 {
112 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel"; 113 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
113 reg = <0x80 0x80>; 114 reg = <0x80 0x80>;
115 cell-index = <1>;
114 interrupt-parent = <&ipic>; 116 interrupt-parent = <&ipic>;
115 interrupts = <71 8>; 117 interrupts = <71 8>;
116 }; 118 };
117 dma-channel@100 { 119 dma-channel@100 {
118 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel"; 120 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
119 reg = <0x100 0x80>; 121 reg = <0x100 0x80>;
122 cell-index = <2>;
120 interrupt-parent = <&ipic>; 123 interrupt-parent = <&ipic>;
121 interrupts = <71 8>; 124 interrupts = <71 8>;
122 }; 125 };
123 dma-channel@180 { 126 dma-channel@180 {
124 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel"; 127 compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
125 reg = <0x180 0x28>; 128 reg = <0x180 0x28>;
129 cell-index = <3>;
126 interrupt-parent = <&ipic>; 130 interrupt-parent = <&ipic>;
127 interrupts = <71 8>; 131 interrupts = <71 8>;
128 }; 132 };
@@ -327,7 +331,8 @@
327 #interrupt-cells = <1>; 331 #interrupt-cells = <1>;
328 #size-cells = <2>; 332 #size-cells = <2>;
329 #address-cells = <3>; 333 #address-cells = <3>;
330 reg = <0xe0008500 0x100>; 334 reg = <0xe0008500 0x100 /* internal registers */
335 0xe0008300 0x8>; /* config space access registers */
331 compatible = "fsl,mpc8349-pci"; 336 compatible = "fsl,mpc8349-pci";
332 device_type = "pci"; 337 device_type = "pci";
333 }; 338 };
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 700e076ef3f5..5cedf373a1d8 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -106,24 +106,28 @@
106 dma-channel@0 { 106 dma-channel@0 {
107 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 107 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
108 reg = <0 0x80>; 108 reg = <0 0x80>;
109 cell-index = <0>;
109 interrupt-parent = <&ipic>; 110 interrupt-parent = <&ipic>;
110 interrupts = <71 8>; 111 interrupts = <71 8>;
111 }; 112 };
112 dma-channel@80 { 113 dma-channel@80 {
113 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 114 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
114 reg = <0x80 0x80>; 115 reg = <0x80 0x80>;
116 cell-index = <1>;
115 interrupt-parent = <&ipic>; 117 interrupt-parent = <&ipic>;
116 interrupts = <71 8>; 118 interrupts = <71 8>;
117 }; 119 };
118 dma-channel@100 { 120 dma-channel@100 {
119 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 121 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
120 reg = <0x100 0x80>; 122 reg = <0x100 0x80>;
123 cell-index = <2>;
121 interrupt-parent = <&ipic>; 124 interrupt-parent = <&ipic>;
122 interrupts = <71 8>; 125 interrupts = <71 8>;
123 }; 126 };
124 dma-channel@180 { 127 dma-channel@180 {
125 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 128 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
126 reg = <0x180 0x28>; 129 reg = <0x180 0x28>;
130 cell-index = <3>;
127 interrupt-parent = <&ipic>; 131 interrupt-parent = <&ipic>;
128 interrupts = <71 8>; 132 interrupts = <71 8>;
129 }; 133 };
@@ -250,7 +254,8 @@
250 #interrupt-cells = <1>; 254 #interrupt-cells = <1>;
251 #size-cells = <2>; 255 #size-cells = <2>;
252 #address-cells = <3>; 256 #address-cells = <3>;
253 reg = <0xe0008500 0x100>; 257 reg = <0xe0008500 0x100 /* internal registers */
258 0xe0008300 0x8>; /* config space access registers */
254 compatible = "fsl,mpc8349-pci"; 259 compatible = "fsl,mpc8349-pci";
255 device_type = "pci"; 260 device_type = "pci";
256 }; 261 };
@@ -276,7 +281,8 @@
276 #interrupt-cells = <1>; 281 #interrupt-cells = <1>;
277 #size-cells = <2>; 282 #size-cells = <2>;
278 #address-cells = <3>; 283 #address-cells = <3>;
279 reg = <0xe0008600 0x100>; 284 reg = <0xe0008600 0x100 /* internal registers */
285 0xe0008380 0x8>; /* config space access registers */
280 compatible = "fsl,mpc8349-pci"; 286 compatible = "fsl,mpc8349-pci";
281 device_type = "pci"; 287 device_type = "pci";
282 }; 288 };
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index cdd3063258ea..81ae1d3e9440 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -104,24 +104,28 @@
104 dma-channel@0 { 104 dma-channel@0 {
105 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 105 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
106 reg = <0 0x80>; 106 reg = <0 0x80>;
107 cell-index = <0>;
107 interrupt-parent = <&ipic>; 108 interrupt-parent = <&ipic>;
108 interrupts = <71 8>; 109 interrupts = <71 8>;
109 }; 110 };
110 dma-channel@80 { 111 dma-channel@80 {
111 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 112 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
112 reg = <0x80 0x80>; 113 reg = <0x80 0x80>;
114 cell-index = <1>;
113 interrupt-parent = <&ipic>; 115 interrupt-parent = <&ipic>;
114 interrupts = <71 8>; 116 interrupts = <71 8>;
115 }; 117 };
116 dma-channel@100 { 118 dma-channel@100 {
117 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 119 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
118 reg = <0x100 0x80>; 120 reg = <0x100 0x80>;
121 cell-index = <2>;
119 interrupt-parent = <&ipic>; 122 interrupt-parent = <&ipic>;
120 interrupts = <71 8>; 123 interrupts = <71 8>;
121 }; 124 };
122 dma-channel@180 { 125 dma-channel@180 {
123 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 126 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
124 reg = <0x180 0x28>; 127 reg = <0x180 0x28>;
128 cell-index = <3>;
125 interrupt-parent = <&ipic>; 129 interrupt-parent = <&ipic>;
126 interrupts = <71 8>; 130 interrupts = <71 8>;
127 }; 131 };
@@ -224,7 +228,8 @@
224 #interrupt-cells = <1>; 228 #interrupt-cells = <1>;
225 #size-cells = <2>; 229 #size-cells = <2>;
226 #address-cells = <3>; 230 #address-cells = <3>;
227 reg = <0xe0008600 0x100>; 231 reg = <0xe0008600 0x100 /* internal registers */
232 0xe0008380 0x8>; /* config space access registers */
228 compatible = "fsl,mpc8349-pci"; 233 compatible = "fsl,mpc8349-pci";
229 device_type = "pci"; 234 device_type = "pci";
230 }; 235 };
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 783241c00240..04bfde3ea605 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -116,24 +116,28 @@
116 dma-channel@0 { 116 dma-channel@0 {
117 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 117 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
118 reg = <0 0x80>; 118 reg = <0 0x80>;
119 cell-index = <0>;
119 interrupt-parent = <&ipic>; 120 interrupt-parent = <&ipic>;
120 interrupts = <71 8>; 121 interrupts = <71 8>;
121 }; 122 };
122 dma-channel@80 { 123 dma-channel@80 {
123 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 124 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
124 reg = <0x80 0x80>; 125 reg = <0x80 0x80>;
126 cell-index = <1>;
125 interrupt-parent = <&ipic>; 127 interrupt-parent = <&ipic>;
126 interrupts = <71 8>; 128 interrupts = <71 8>;
127 }; 129 };
128 dma-channel@100 { 130 dma-channel@100 {
129 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 131 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
130 reg = <0x100 0x80>; 132 reg = <0x100 0x80>;
133 cell-index = <2>;
131 interrupt-parent = <&ipic>; 134 interrupt-parent = <&ipic>;
132 interrupts = <71 8>; 135 interrupts = <71 8>;
133 }; 136 };
134 dma-channel@180 { 137 dma-channel@180 {
135 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 138 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
136 reg = <0x180 0x28>; 139 reg = <0x180 0x28>;
140 cell-index = <3>;
137 interrupt-parent = <&ipic>; 141 interrupt-parent = <&ipic>;
138 interrupts = <71 8>; 142 interrupts = <71 8>;
139 }; 143 };
@@ -311,7 +315,8 @@
311 #interrupt-cells = <1>; 315 #interrupt-cells = <1>;
312 #size-cells = <2>; 316 #size-cells = <2>;
313 #address-cells = <3>; 317 #address-cells = <3>;
314 reg = <0xe0008500 0x100>; 318 reg = <0xe0008500 0x100 /* internal registers */
319 0xe0008300 0x8>; /* config space access registers */
315 compatible = "fsl,mpc8349-pci"; 320 compatible = "fsl,mpc8349-pci";
316 device_type = "pci"; 321 device_type = "pci";
317 }; 322 };
@@ -372,7 +377,8 @@
372 #interrupt-cells = <1>; 377 #interrupt-cells = <1>;
373 #size-cells = <2>; 378 #size-cells = <2>;
374 #address-cells = <3>; 379 #address-cells = <3>;
375 reg = <0xe0008600 0x100>; 380 reg = <0xe0008600 0x100 /* internal registers */
381 0xe0008380 0x8>; /* config space access registers */
376 compatible = "fsl,mpc8349-pci"; 382 compatible = "fsl,mpc8349-pci";
377 device_type = "pci"; 383 device_type = "pci";
378 }; 384 };
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index a3b76a709951..66a12d2631fb 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -52,9 +52,26 @@
52 reg = <0x00000000 0x10000000>; 52 reg = <0x00000000 0x10000000>;
53 }; 53 };
54 54
55 bcsr@f8000000 { 55 localbus@e0005000 {
56 device_type = "board-control"; 56 #address-cells = <2>;
57 reg = <0xf8000000 0x8000>; 57 #size-cells = <1>;
58 compatible = "fsl,mpc8360-localbus", "fsl,pq2pro-localbus",
59 "simple-bus";
60 reg = <0xe0005000 0xd8>;
61 ranges = <0 0 0xfe000000 0x02000000
62 1 0 0xf8000000 0x00008000>;
63
64 flash@0,0 {
65 compatible = "cfi-flash";
66 reg = <0 0 0x2000000>;
67 bank-width = <2>;
68 device-width = <1>;
69 };
70
71 bcsr@1,0 {
72 device_type = "board-control";
73 reg = <1 0 0x8000>;
74 };
58 }; 75 };
59 76
60 soc8360@e0000000 { 77 soc8360@e0000000 {
@@ -131,24 +148,28 @@
131 dma-channel@0 { 148 dma-channel@0 {
132 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel"; 149 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel";
133 reg = <0 0x80>; 150 reg = <0 0x80>;
151 cell-index = <0>;
134 interrupt-parent = <&ipic>; 152 interrupt-parent = <&ipic>;
135 interrupts = <71 8>; 153 interrupts = <71 8>;
136 }; 154 };
137 dma-channel@80 { 155 dma-channel@80 {
138 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel"; 156 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel";
139 reg = <0x80 0x80>; 157 reg = <0x80 0x80>;
158 cell-index = <1>;
140 interrupt-parent = <&ipic>; 159 interrupt-parent = <&ipic>;
141 interrupts = <71 8>; 160 interrupts = <71 8>;
142 }; 161 };
143 dma-channel@100 { 162 dma-channel@100 {
144 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel"; 163 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel";
145 reg = <0x100 0x80>; 164 reg = <0x100 0x80>;
165 cell-index = <2>;
146 interrupt-parent = <&ipic>; 166 interrupt-parent = <&ipic>;
147 interrupts = <71 8>; 167 interrupts = <71 8>;
148 }; 168 };
149 dma-channel@180 { 169 dma-channel@180 {
150 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel"; 170 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel";
151 reg = <0x180 0x28>; 171 reg = <0x180 0x28>;
172 cell-index = <3>;
152 interrupt-parent = <&ipic>; 173 interrupt-parent = <&ipic>;
153 interrupts = <71 8>; 174 interrupts = <71 8>;
154 }; 175 };
@@ -405,7 +426,8 @@
405 #interrupt-cells = <1>; 426 #interrupt-cells = <1>;
406 #size-cells = <2>; 427 #size-cells = <2>;
407 #address-cells = <3>; 428 #address-cells = <3>;
408 reg = <0xe0008500 0x100>; 429 reg = <0xe0008500 0x100 /* internal registers */
430 0xe0008300 0x8>; /* config space access registers */
409 compatible = "fsl,mpc8349-pci"; 431 compatible = "fsl,mpc8349-pci";
410 device_type = "pci"; 432 device_type = "pci";
411 }; 433 };
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index 89c9202f8bd7..decadf3d9e98 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -125,24 +125,28 @@
125 dma-channel@0 { 125 dma-channel@0 {
126 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel"; 126 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel";
127 reg = <0 0x80>; 127 reg = <0 0x80>;
128 cell-index = <0>;
128 interrupt-parent = <&ipic>; 129 interrupt-parent = <&ipic>;
129 interrupts = <71 8>; 130 interrupts = <71 8>;
130 }; 131 };
131 dma-channel@80 { 132 dma-channel@80 {
132 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel"; 133 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel";
133 reg = <0x80 0x80>; 134 reg = <0x80 0x80>;
135 cell-index = <1>;
134 interrupt-parent = <&ipic>; 136 interrupt-parent = <&ipic>;
135 interrupts = <71 8>; 137 interrupts = <71 8>;
136 }; 138 };
137 dma-channel@100 { 139 dma-channel@100 {
138 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel"; 140 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel";
139 reg = <0x100 0x80>; 141 reg = <0x100 0x80>;
142 cell-index = <2>;
140 interrupt-parent = <&ipic>; 143 interrupt-parent = <&ipic>;
141 interrupts = <71 8>; 144 interrupts = <71 8>;
142 }; 145 };
143 dma-channel@180 { 146 dma-channel@180 {
144 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel"; 147 compatible = "fsl,mpc8360-dma-channel", "fsl,elo-dma-channel";
145 reg = <0x180 0x28>; 148 reg = <0x180 0x28>;
149 cell-index = <3>;
146 interrupt-parent = <&ipic>; 150 interrupt-parent = <&ipic>;
147 interrupts = <71 8>; 151 interrupts = <71 8>;
148 }; 152 };
@@ -383,6 +387,18 @@
383 device-width = <1>; 387 device-width = <1>;
384 }; 388 };
385 389
390 upm@1,0 {
391 compatible = "fsl,upm-nand";
392 reg = <1 0 1>;
393 fsl,upm-addr-offset = <16>;
394 fsl,upm-cmd-offset = <8>;
395 gpios = <&qe_pio_e 18 0>;
396
397 flash {
398 compatible = "stm,nand512-a";
399 };
400 };
401
386 display@2,0 { 402 display@2,0 {
387 device_type = "display"; 403 device_type = "display";
388 compatible = "fujitsu,MB86277", "fujitsu,mint"; 404 compatible = "fujitsu,MB86277", "fujitsu,mint";
@@ -405,7 +421,8 @@
405 #interrupt-cells = <1>; 421 #interrupt-cells = <1>;
406 device_type = "pci"; 422 device_type = "pci";
407 compatible = "fsl,mpc8360-pci", "fsl,mpc8349-pci"; 423 compatible = "fsl,mpc8360-pci", "fsl,mpc8349-pci";
408 reg = <0xe0008500 0x100>; 424 reg = <0xe0008500 0x100 /* internal registers */
425 0xe0008300 0x8>; /* config space access registers */
409 ranges = <0x02000000 0 0x90000000 0x90000000 0 0x10000000 426 ranges = <0x02000000 0 0x90000000 0x90000000 0 0x10000000
410 0x42000000 0 0x80000000 0x80000000 0 0x10000000 427 0x42000000 0 0x80000000 0x80000000 0 0x10000000
411 0x01000000 0 0xe0300000 0xe0300000 0 0x00100000>; 428 0x01000000 0 0xe0300000 0xe0300000 0 0x00100000>;
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index 432782b6d20a..0484561bd2c0 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -136,6 +136,13 @@
136 interrupts = <14 0x8>; 136 interrupts = <14 0x8>;
137 interrupt-parent = <&ipic>; 137 interrupt-parent = <&ipic>;
138 dfsrr; 138 dfsrr;
139
140 rtc@68 {
141 compatible = "dallas,ds1374";
142 reg = <0x68>;
143 interrupts = <19 0x8>;
144 interrupt-parent = <&ipic>;
145 };
139 }; 146 };
140 147
141 i2c@3100 { 148 i2c@3100 {
@@ -246,24 +253,28 @@
246 dma-channel@0 { 253 dma-channel@0 {
247 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel"; 254 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
248 reg = <0 0x80>; 255 reg = <0 0x80>;
256 cell-index = <0>;
249 interrupt-parent = <&ipic>; 257 interrupt-parent = <&ipic>;
250 interrupts = <0x47 8>; 258 interrupts = <0x47 8>;
251 }; 259 };
252 dma-channel@80 { 260 dma-channel@80 {
253 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel"; 261 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
254 reg = <0x80 0x80>; 262 reg = <0x80 0x80>;
263 cell-index = <1>;
255 interrupt-parent = <&ipic>; 264 interrupt-parent = <&ipic>;
256 interrupts = <0x47 8>; 265 interrupts = <0x47 8>;
257 }; 266 };
258 dma-channel@100 { 267 dma-channel@100 {
259 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel"; 268 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
260 reg = <0x100 0x80>; 269 reg = <0x100 0x80>;
270 cell-index = <2>;
261 interrupt-parent = <&ipic>; 271 interrupt-parent = <&ipic>;
262 interrupts = <0x47 8>; 272 interrupts = <0x47 8>;
263 }; 273 };
264 dma-channel@180 { 274 dma-channel@180 {
265 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel"; 275 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
266 reg = <0x180 0x28>; 276 reg = <0x180 0x28>;
277 cell-index = <3>;
267 interrupt-parent = <&ipic>; 278 interrupt-parent = <&ipic>;
268 interrupts = <0x47 8>; 279 interrupts = <0x47 8>;
269 }; 280 };
@@ -374,7 +385,8 @@
374 #interrupt-cells = <1>; 385 #interrupt-cells = <1>;
375 #size-cells = <2>; 386 #size-cells = <2>;
376 #address-cells = <3>; 387 #address-cells = <3>;
377 reg = <0xe0008500 0x100>; 388 reg = <0xe0008500 0x100 /* internal registers */
389 0xe0008300 0x8>; /* config space access registers */
378 compatible = "fsl,mpc8349-pci"; 390 compatible = "fsl,mpc8349-pci";
379 device_type = "pci"; 391 device_type = "pci";
380 }; 392 };
diff --git a/arch/powerpc/boot/dts/mpc8377_rdb.dts b/arch/powerpc/boot/dts/mpc8377_rdb.dts
index ed137aa83d5f..53191ba67aaa 100644
--- a/arch/powerpc/boot/dts/mpc8377_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8377_rdb.dts
@@ -155,24 +155,28 @@
155 dma-channel@0 { 155 dma-channel@0 {
156 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel"; 156 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
157 reg = <0 0x80>; 157 reg = <0 0x80>;
158 cell-index = <0>;
158 interrupt-parent = <&ipic>; 159 interrupt-parent = <&ipic>;
159 interrupts = <71 8>; 160 interrupts = <71 8>;
160 }; 161 };
161 dma-channel@80 { 162 dma-channel@80 {
162 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel"; 163 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
163 reg = <0x80 0x80>; 164 reg = <0x80 0x80>;
165 cell-index = <1>;
164 interrupt-parent = <&ipic>; 166 interrupt-parent = <&ipic>;
165 interrupts = <71 8>; 167 interrupts = <71 8>;
166 }; 168 };
167 dma-channel@100 { 169 dma-channel@100 {
168 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel"; 170 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
169 reg = <0x100 0x80>; 171 reg = <0x100 0x80>;
172 cell-index = <2>;
170 interrupt-parent = <&ipic>; 173 interrupt-parent = <&ipic>;
171 interrupts = <71 8>; 174 interrupts = <71 8>;
172 }; 175 };
173 dma-channel@180 { 176 dma-channel@180 {
174 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel"; 177 compatible = "fsl,mpc8377-dma-channel", "fsl,elo-dma-channel";
175 reg = <0x180 0x28>; 178 reg = <0x180 0x28>;
179 cell-index = <3>;
176 interrupt-parent = <&ipic>; 180 interrupt-parent = <&ipic>;
177 interrupts = <71 8>; 181 interrupts = <71 8>;
178 }; 182 };
@@ -315,7 +319,8 @@
315 #interrupt-cells = <1>; 319 #interrupt-cells = <1>;
316 #size-cells = <2>; 320 #size-cells = <2>;
317 #address-cells = <3>; 321 #address-cells = <3>;
318 reg = <0xe0008500 0x100>; 322 reg = <0xe0008500 0x100 /* internal registers */
323 0xe0008300 0x8>; /* config space access registers */
319 compatible = "fsl,mpc8349-pci"; 324 compatible = "fsl,mpc8349-pci";
320 device_type = "pci"; 325 device_type = "pci";
321 }; 326 };
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts
index ed32c8ddafe3..67a08d2e2ff2 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -136,6 +136,13 @@
136 interrupts = <14 0x8>; 136 interrupts = <14 0x8>;
137 interrupt-parent = <&ipic>; 137 interrupt-parent = <&ipic>;
138 dfsrr; 138 dfsrr;
139
140 rtc@68 {
141 compatible = "dallas,ds1374";
142 reg = <0x68>;
143 interrupts = <19 0x8>;
144 interrupt-parent = <&ipic>;
145 };
139 }; 146 };
140 147
141 i2c@3100 { 148 i2c@3100 {
@@ -170,24 +177,28 @@
170 dma-channel@0 { 177 dma-channel@0 {
171 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel"; 178 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel";
172 reg = <0 0x80>; 179 reg = <0 0x80>;
180 cell-index = <0>;
173 interrupt-parent = <&ipic>; 181 interrupt-parent = <&ipic>;
174 interrupts = <71 8>; 182 interrupts = <71 8>;
175 }; 183 };
176 dma-channel@80 { 184 dma-channel@80 {
177 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel"; 185 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel";
178 reg = <0x80 0x80>; 186 reg = <0x80 0x80>;
187 cell-index = <1>;
179 interrupt-parent = <&ipic>; 188 interrupt-parent = <&ipic>;
180 interrupts = <71 8>; 189 interrupts = <71 8>;
181 }; 190 };
182 dma-channel@100 { 191 dma-channel@100 {
183 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel"; 192 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel";
184 reg = <0x100 0x80>; 193 reg = <0x100 0x80>;
194 cell-index = <2>;
185 interrupt-parent = <&ipic>; 195 interrupt-parent = <&ipic>;
186 interrupts = <71 8>; 196 interrupts = <71 8>;
187 }; 197 };
188 dma-channel@180 { 198 dma-channel@180 {
189 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel"; 199 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel";
190 reg = <0x180 0x28>; 200 reg = <0x180 0x28>;
201 cell-index = <3>;
191 interrupt-parent = <&ipic>; 202 interrupt-parent = <&ipic>;
192 interrupts = <71 8>; 203 interrupts = <71 8>;
193 }; 204 };
@@ -360,7 +371,8 @@
360 #interrupt-cells = <1>; 371 #interrupt-cells = <1>;
361 #size-cells = <2>; 372 #size-cells = <2>;
362 #address-cells = <3>; 373 #address-cells = <3>;
363 reg = <0xe0008500 0x100>; 374 reg = <0xe0008500 0x100 /* internal registers */
375 0xe0008300 0x8>; /* config space access registers */
364 compatible = "fsl,mpc8349-pci"; 376 compatible = "fsl,mpc8349-pci";
365 device_type = "pci"; 377 device_type = "pci";
366 }; 378 };
diff --git a/arch/powerpc/boot/dts/mpc8378_rdb.dts b/arch/powerpc/boot/dts/mpc8378_rdb.dts
index 34a7f2f935e1..4a09153d160c 100644
--- a/arch/powerpc/boot/dts/mpc8378_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8378_rdb.dts
@@ -155,24 +155,28 @@
155 dma-channel@0 { 155 dma-channel@0 {
156 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel"; 156 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel";
157 reg = <0 0x80>; 157 reg = <0 0x80>;
158 cell-index = <0>;
158 interrupt-parent = <&ipic>; 159 interrupt-parent = <&ipic>;
159 interrupts = <71 8>; 160 interrupts = <71 8>;
160 }; 161 };
161 dma-channel@80 { 162 dma-channel@80 {
162 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel"; 163 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel";
163 reg = <0x80 0x80>; 164 reg = <0x80 0x80>;
165 cell-index = <1>;
164 interrupt-parent = <&ipic>; 166 interrupt-parent = <&ipic>;
165 interrupts = <71 8>; 167 interrupts = <71 8>;
166 }; 168 };
167 dma-channel@100 { 169 dma-channel@100 {
168 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel"; 170 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel";
169 reg = <0x100 0x80>; 171 reg = <0x100 0x80>;
172 cell-index = <2>;
170 interrupt-parent = <&ipic>; 173 interrupt-parent = <&ipic>;
171 interrupts = <71 8>; 174 interrupts = <71 8>;
172 }; 175 };
173 dma-channel@180 { 176 dma-channel@180 {
174 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel"; 177 compatible = "fsl,mpc8378-dma-channel", "fsl,elo-dma-channel";
175 reg = <0x180 0x28>; 178 reg = <0x180 0x28>;
179 cell-index = <3>;
176 interrupt-parent = <&ipic>; 180 interrupt-parent = <&ipic>;
177 interrupts = <71 8>; 181 interrupts = <71 8>;
178 }; 182 };
@@ -301,7 +305,8 @@
301 #interrupt-cells = <1>; 305 #interrupt-cells = <1>;
302 #size-cells = <2>; 306 #size-cells = <2>;
303 #address-cells = <3>; 307 #address-cells = <3>;
304 reg = <0xe0008500 0x100>; 308 reg = <0xe0008500 0x100 /* internal registers */
309 0xe0008300 0x8>; /* config space access registers */
305 compatible = "fsl,mpc8349-pci"; 310 compatible = "fsl,mpc8349-pci";
306 device_type = "pci"; 311 device_type = "pci";
307 }; 312 };
diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts
index f4db9ed4a301..323370a2b5ff 100644
--- a/arch/powerpc/boot/dts/mpc8379_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -136,6 +136,13 @@
136 interrupts = <14 0x8>; 136 interrupts = <14 0x8>;
137 interrupt-parent = <&ipic>; 137 interrupt-parent = <&ipic>;
138 dfsrr; 138 dfsrr;
139
140 rtc@68 {
141 compatible = "dallas,ds1374";
142 reg = <0x68>;
143 interrupts = <19 0x8>;
144 interrupt-parent = <&ipic>;
145 };
139 }; 146 };
140 147
141 i2c@3100 { 148 i2c@3100 {
@@ -170,24 +177,28 @@
170 dma-channel@0 { 177 dma-channel@0 {
171 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel"; 178 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel";
172 reg = <0 0x80>; 179 reg = <0 0x80>;
180 cell-index = <0>;
173 interrupt-parent = <&ipic>; 181 interrupt-parent = <&ipic>;
174 interrupts = <71 8>; 182 interrupts = <71 8>;
175 }; 183 };
176 dma-channel@80 { 184 dma-channel@80 {
177 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel"; 185 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel";
178 reg = <0x80 0x80>; 186 reg = <0x80 0x80>;
187 cell-index = <1>;
179 interrupt-parent = <&ipic>; 188 interrupt-parent = <&ipic>;
180 interrupts = <71 8>; 189 interrupts = <71 8>;
181 }; 190 };
182 dma-channel@100 { 191 dma-channel@100 {
183 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel"; 192 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel";
184 reg = <0x100 0x80>; 193 reg = <0x100 0x80>;
194 cell-index = <2>;
185 interrupt-parent = <&ipic>; 195 interrupt-parent = <&ipic>;
186 interrupts = <71 8>; 196 interrupts = <71 8>;
187 }; 197 };
188 dma-channel@180 { 198 dma-channel@180 {
189 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel"; 199 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel";
190 reg = <0x180 0x28>; 200 reg = <0x180 0x28>;
201 cell-index = <3>;
191 interrupt-parent = <&ipic>; 202 interrupt-parent = <&ipic>;
192 interrupts = <71 8>; 203 interrupts = <71 8>;
193 }; 204 };
@@ -388,7 +399,8 @@
388 #interrupt-cells = <1>; 399 #interrupt-cells = <1>;
389 #size-cells = <2>; 400 #size-cells = <2>;
390 #address-cells = <3>; 401 #address-cells = <3>;
391 reg = <0xe0008500 0x100>; 402 reg = <0xe0008500 0x100 /* internal registers */
403 0xe0008300 0x8>; /* config space access registers */
392 compatible = "fsl,mpc8349-pci"; 404 compatible = "fsl,mpc8349-pci";
393 device_type = "pci"; 405 device_type = "pci";
394 }; 406 };
diff --git a/arch/powerpc/boot/dts/mpc8379_rdb.dts b/arch/powerpc/boot/dts/mpc8379_rdb.dts
index e4d7030d50e5..bbd884ac9dc0 100644
--- a/arch/powerpc/boot/dts/mpc8379_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8379_rdb.dts
@@ -155,24 +155,28 @@
155 dma-channel@0 { 155 dma-channel@0 {
156 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel"; 156 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel";
157 reg = <0 0x80>; 157 reg = <0 0x80>;
158 cell-index = <0>;
158 interrupt-parent = <&ipic>; 159 interrupt-parent = <&ipic>;
159 interrupts = <71 8>; 160 interrupts = <71 8>;
160 }; 161 };
161 dma-channel@80 { 162 dma-channel@80 {
162 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel"; 163 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel";
163 reg = <0x80 0x80>; 164 reg = <0x80 0x80>;
165 cell-index = <1>;
164 interrupt-parent = <&ipic>; 166 interrupt-parent = <&ipic>;
165 interrupts = <71 8>; 167 interrupts = <71 8>;
166 }; 168 };
167 dma-channel@100 { 169 dma-channel@100 {
168 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel"; 170 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel";
169 reg = <0x100 0x80>; 171 reg = <0x100 0x80>;
172 cell-index = <2>;
170 interrupt-parent = <&ipic>; 173 interrupt-parent = <&ipic>;
171 interrupts = <71 8>; 174 interrupts = <71 8>;
172 }; 175 };
173 dma-channel@180 { 176 dma-channel@180 {
174 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel"; 177 compatible = "fsl,mpc8379-dma-channel", "fsl,elo-dma-channel";
175 reg = <0x180 0x28>; 178 reg = <0x180 0x28>;
179 cell-index = <3>;
176 interrupt-parent = <&ipic>; 180 interrupt-parent = <&ipic>;
177 interrupts = <71 8>; 181 interrupts = <71 8>;
178 }; 182 };
@@ -329,7 +333,8 @@
329 #interrupt-cells = <1>; 333 #interrupt-cells = <1>;
330 #size-cells = <2>; 334 #size-cells = <2>;
331 #address-cells = <3>; 335 #address-cells = <3>;
332 reg = <0xe0008500 0x100>; 336 reg = <0xe0008500 0x100 /* internal registers */
337 0xe0008300 0x8>; /* config space access registers */
333 compatible = "fsl,mpc8349-pci"; 338 compatible = "fsl,mpc8349-pci";
334 device_type = "pci"; 339 device_type = "pci";
335 }; 340 };
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dts b/arch/powerpc/boot/dts/mpc8536ds.dts
index 1505d6855eff..93fdd99901b6 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds.dts
@@ -91,6 +91,8 @@
91 rtc@68 { 91 rtc@68 {
92 compatible = "dallas,ds3232"; 92 compatible = "dallas,ds3232";
93 reg = <0x68>; 93 reg = <0x68>;
94 interrupts = <0 0x1>;
95 interrupt-parent = <&mpic>;
94 }; 96 };
95 }; 97 };
96 98
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index 3b3a1062cb25..f724d72c7b92 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -207,7 +207,7 @@
207 reg = <0xe4000 0x100>; 207 reg = <0xe4000 0x100>;
208 }; 208 };
209 209
210 i2s@16000 { 210 ssi@16000 {
211 compatible = "fsl,mpc8610-ssi"; 211 compatible = "fsl,mpc8610-ssi";
212 cell-index = <0>; 212 cell-index = <0>;
213 reg = <0x16000 0x100>; 213 reg = <0x16000 0x100>;
@@ -215,6 +215,8 @@
215 interrupts = <62 2>; 215 interrupts = <62 2>;
216 fsl,mode = "i2s-slave"; 216 fsl,mode = "i2s-slave";
217 codec-handle = <&cs4270>; 217 codec-handle = <&cs4270>;
218 fsl,playback-dma = <&dma00>;
219 fsl,capture-dma = <&dma01>;
218 }; 220 };
219 221
220 ssi@16100 { 222 ssi@16100 {
@@ -233,17 +235,17 @@
233 reg = <0x21300 0x4>; /* DMA general status register */ 235 reg = <0x21300 0x4>; /* DMA general status register */
234 ranges = <0x0 0x21100 0x200>; 236 ranges = <0x0 0x21100 0x200>;
235 237
236 dma-channel@0 { 238 dma00: dma-channel@0 {
237 compatible = "fsl,mpc8610-dma-channel", 239 compatible = "fsl,mpc8610-dma-channel",
238 "fsl,eloplus-dma-channel"; 240 "fsl,ssi-dma-channel";
239 cell-index = <0>; 241 cell-index = <0>;
240 reg = <0x0 0x80>; 242 reg = <0x0 0x80>;
241 interrupt-parent = <&mpic>; 243 interrupt-parent = <&mpic>;
242 interrupts = <20 2>; 244 interrupts = <20 2>;
243 }; 245 };
244 dma-channel@1 { 246 dma01: dma-channel@1 {
245 compatible = "fsl,mpc8610-dma-channel", 247 compatible = "fsl,mpc8610-dma-channel",
246 "fsl,eloplus-dma-channel"; 248 "fsl,ssi-dma-channel";
247 cell-index = <1>; 249 cell-index = <1>;
248 reg = <0x80 0x80>; 250 reg = <0x80 0x80>;
249 interrupt-parent = <&mpic>; 251 interrupt-parent = <&mpic>;
@@ -281,7 +283,7 @@
281 cell-index = <0>; 283 cell-index = <0>;
282 reg = <0x0 0x80>; 284 reg = <0x0 0x80>;
283 interrupt-parent = <&mpic>; 285 interrupt-parent = <&mpic>;
284 interrupts = <60 2>; 286 interrupts = <76 2>;
285 }; 287 };
286 dma-channel@1 { 288 dma-channel@1 {
287 compatible = "fsl,mpc8610-dma-channel", 289 compatible = "fsl,mpc8610-dma-channel",
@@ -289,7 +291,7 @@
289 cell-index = <1>; 291 cell-index = <1>;
290 reg = <0x80 0x80>; 292 reg = <0x80 0x80>;
291 interrupt-parent = <&mpic>; 293 interrupt-parent = <&mpic>;
292 interrupts = <61 2>; 294 interrupts = <77 2>;
293 }; 295 };
294 dma-channel@2 { 296 dma-channel@2 {
295 compatible = "fsl,mpc8610-dma-channel", 297 compatible = "fsl,mpc8610-dma-channel",
@@ -297,7 +299,7 @@
297 cell-index = <2>; 299 cell-index = <2>;
298 reg = <0x100 0x80>; 300 reg = <0x100 0x80>;
299 interrupt-parent = <&mpic>; 301 interrupt-parent = <&mpic>;
300 interrupts = <62 2>; 302 interrupts = <78 2>;
301 }; 303 };
302 dma-channel@3 { 304 dma-channel@3 {
303 compatible = "fsl,mpc8610-dma-channel", 305 compatible = "fsl,mpc8610-dma-channel",
@@ -305,7 +307,7 @@
305 cell-index = <3>; 307 cell-index = <3>;
306 reg = <0x180 0x80>; 308 reg = <0x180 0x80>;
307 interrupt-parent = <&mpic>; 309 interrupt-parent = <&mpic>;
308 interrupts = <63 2>; 310 interrupts = <79 2>;
309 }; 311 };
310 }; 312 };
311 313
diff --git a/arch/powerpc/boot/dts/sbc8349.dts b/arch/powerpc/boot/dts/sbc8349.dts
index 45f789b56709..0f941f310e44 100644
--- a/arch/powerpc/boot/dts/sbc8349.dts
+++ b/arch/powerpc/boot/dts/sbc8349.dts
@@ -107,24 +107,28 @@
107 dma-channel@0 { 107 dma-channel@0 {
108 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 108 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
109 reg = <0 0x80>; 109 reg = <0 0x80>;
110 cell-index = <0>;
110 interrupt-parent = <&ipic>; 111 interrupt-parent = <&ipic>;
111 interrupts = <71 8>; 112 interrupts = <71 8>;
112 }; 113 };
113 dma-channel@80 { 114 dma-channel@80 {
114 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 115 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
115 reg = <0x80 0x80>; 116 reg = <0x80 0x80>;
117 cell-index = <1>;
116 interrupt-parent = <&ipic>; 118 interrupt-parent = <&ipic>;
117 interrupts = <71 8>; 119 interrupts = <71 8>;
118 }; 120 };
119 dma-channel@100 { 121 dma-channel@100 {
120 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 122 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
121 reg = <0x100 0x80>; 123 reg = <0x100 0x80>;
124 cell-index = <2>;
122 interrupt-parent = <&ipic>; 125 interrupt-parent = <&ipic>;
123 interrupts = <71 8>; 126 interrupts = <71 8>;
124 }; 127 };
125 dma-channel@180 { 128 dma-channel@180 {
126 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; 129 compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
127 reg = <0x180 0x28>; 130 reg = <0x180 0x28>;
131 cell-index = <3>;
128 interrupt-parent = <&ipic>; 132 interrupt-parent = <&ipic>;
129 interrupts = <71 8>; 133 interrupts = <71 8>;
130 }; 134 };
@@ -268,7 +272,8 @@
268 #interrupt-cells = <1>; 272 #interrupt-cells = <1>;
269 #size-cells = <2>; 273 #size-cells = <2>;
270 #address-cells = <3>; 274 #address-cells = <3>;
271 reg = <0xe0008500 0x100>; 275 reg = <0xe0008500 0x100 /* internal registers */
276 0xe0008300 0x8>; /* config space access registers */
272 compatible = "fsl,mpc8349-pci"; 277 compatible = "fsl,mpc8349-pci";
273 device_type = "pci"; 278 device_type = "pci";
274 }; 279 };
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
index 72d15f075d34..3b295e8df53f 100644
--- a/arch/powerpc/boot/dts/sequoia.dts
+++ b/arch/powerpc/boot/dts/sequoia.dts
@@ -246,13 +246,22 @@
246 }; 246 };
247 247
248 IIC0: i2c@ef600700 { 248 IIC0: i2c@ef600700 {
249 #address-cells = <1>;
250 #size-cells = <0>;
249 compatible = "ibm,iic-440epx", "ibm,iic"; 251 compatible = "ibm,iic-440epx", "ibm,iic";
250 reg = <0xef600700 0x00000014>; 252 reg = <0xef600700 0x00000014>;
251 interrupt-parent = <&UIC0>; 253 interrupt-parent = <&UIC0>;
252 interrupts = <0x2 0x4>; 254 interrupts = <0x2 0x4>;
255
256 hwmon@48 {
257 compatible = "adi,ad7414";
258 reg = <0x48>;
259 };
253 }; 260 };
254 261
255 IIC1: i2c@ef600800 { 262 IIC1: i2c@ef600800 {
263 #address-cells = <1>;
264 #size-cells = <0>;
256 compatible = "ibm,iic-440epx", "ibm,iic"; 265 compatible = "ibm,iic-440epx", "ibm,iic";
257 reg = <0xef600800 0x00000014>; 266 reg = <0xef600800 0x00000014>;
258 interrupt-parent = <&UIC0>; 267 interrupt-parent = <&UIC0>;
diff --git a/arch/powerpc/boot/dts/yosemite.dts b/arch/powerpc/boot/dts/yosemite.dts
index e39422aa0d85..1fa3cb4c4ebb 100644
--- a/arch/powerpc/boot/dts/yosemite.dts
+++ b/arch/powerpc/boot/dts/yosemite.dts
@@ -15,7 +15,7 @@
15 #address-cells = <2>; 15 #address-cells = <2>;
16 #size-cells = <1>; 16 #size-cells = <1>;
17 model = "amcc,yosemite"; 17 model = "amcc,yosemite";
18 compatible = "amcc,yosemite","amcc,bamboo"; 18 compatible = "amcc,yosemite";
19 dcr-parent = <&{/cpus/cpu@0}>; 19 dcr-parent = <&{/cpus/cpu@0}>;
20 20
21 aliases { 21 aliases {
diff --git a/arch/powerpc/boot/elf_util.c b/arch/powerpc/boot/elf_util.c
index 7454aa4cc20c..1567a0c0f05c 100644
--- a/arch/powerpc/boot/elf_util.c
+++ b/arch/powerpc/boot/elf_util.c
@@ -27,7 +27,8 @@ int parse_elf64(void *hdr, struct elf_info *info)
27 elf64->e_ident[EI_MAG3] == ELFMAG3 && 27 elf64->e_ident[EI_MAG3] == ELFMAG3 &&
28 elf64->e_ident[EI_CLASS] == ELFCLASS64 && 28 elf64->e_ident[EI_CLASS] == ELFCLASS64 &&
29 elf64->e_ident[EI_DATA] == ELFDATA2MSB && 29 elf64->e_ident[EI_DATA] == ELFDATA2MSB &&
30 elf64->e_type == ET_EXEC && 30 (elf64->e_type == ET_EXEC ||
31 elf64->e_type == ET_DYN) &&
31 elf64->e_machine == EM_PPC64)) 32 elf64->e_machine == EM_PPC64))
32 return 0; 33 return 0;
33 34
@@ -58,7 +59,8 @@ int parse_elf32(void *hdr, struct elf_info *info)
58 elf32->e_ident[EI_MAG3] == ELFMAG3 && 59 elf32->e_ident[EI_MAG3] == ELFMAG3 &&
59 elf32->e_ident[EI_CLASS] == ELFCLASS32 && 60 elf32->e_ident[EI_CLASS] == ELFCLASS32 &&
60 elf32->e_ident[EI_DATA] == ELFDATA2MSB && 61 elf32->e_ident[EI_DATA] == ELFDATA2MSB &&
61 elf32->e_type == ET_EXEC && 62 (elf32->e_type == ET_EXEC ||
63 elf32->e_type == ET_DYN) &&
62 elf32->e_machine == EM_PPC)) 64 elf32->e_machine == EM_PPC))
63 return 0; 65 return 0;
64 66
diff --git a/arch/powerpc/boot/libfdt/Makefile.libfdt b/arch/powerpc/boot/libfdt/Makefile.libfdt
index 82f9c6a8287b..6c42acfa21ec 100644
--- a/arch/powerpc/boot/libfdt/Makefile.libfdt
+++ b/arch/powerpc/boot/libfdt/Makefile.libfdt
@@ -3,12 +3,6 @@
3# This is not a complete Makefile of itself. Instead, it is designed to 3# This is not a complete Makefile of itself. Instead, it is designed to
4# be easily embeddable into other systems of Makefiles. 4# be easily embeddable into other systems of Makefiles.
5# 5#
6LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
7LIBFDT_INCLUDES = fdt.h libfdt.h 6LIBFDT_INCLUDES = fdt.h libfdt.h
8LIBFDT_EXTRA = libfdt_internal.h 7LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
9LIBFDT_LIB = libfdt/libfdt.a
10
11LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) 8LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
12
13$(LIBFDT_objdir)/$(LIBFDT_LIB): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
14
diff --git a/arch/powerpc/boot/libfdt/fdt.c b/arch/powerpc/boot/libfdt/fdt.c
index 586a36136db2..2acaec5923ae 100644
--- a/arch/powerpc/boot/libfdt/fdt.c
+++ b/arch/powerpc/boot/libfdt/fdt.c
@@ -63,7 +63,7 @@ int fdt_check_header(const void *fdt)
63 return -FDT_ERR_BADVERSION; 63 return -FDT_ERR_BADVERSION;
64 if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION) 64 if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION)
65 return -FDT_ERR_BADVERSION; 65 return -FDT_ERR_BADVERSION;
66 } else if (fdt_magic(fdt) == SW_MAGIC) { 66 } else if (fdt_magic(fdt) == FDT_SW_MAGIC) {
67 /* Unfinished sequential-write blob */ 67 /* Unfinished sequential-write blob */
68 if (fdt_size_dt_struct(fdt) == 0) 68 if (fdt_size_dt_struct(fdt) == 0)
69 return -FDT_ERR_BADSTATE; 69 return -FDT_ERR_BADSTATE;
@@ -76,7 +76,7 @@ int fdt_check_header(const void *fdt)
76 76
77const void *fdt_offset_ptr(const void *fdt, int offset, int len) 77const void *fdt_offset_ptr(const void *fdt, int offset, int len)
78{ 78{
79 const void *p; 79 const char *p;
80 80
81 if (fdt_version(fdt) >= 0x11) 81 if (fdt_version(fdt) >= 0x11)
82 if (((offset + len) < offset) 82 if (((offset + len) < offset)
@@ -124,11 +124,59 @@ uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset)
124 } 124 }
125 125
126 if (nextoffset) 126 if (nextoffset)
127 *nextoffset = ALIGN(offset, FDT_TAGSIZE); 127 *nextoffset = FDT_TAGALIGN(offset);
128 128
129 return tag; 129 return tag;
130} 130}
131 131
132int _fdt_check_node_offset(const void *fdt, int offset)
133{
134 if ((offset < 0) || (offset % FDT_TAGSIZE)
135 || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE))
136 return -FDT_ERR_BADOFFSET;
137
138 return offset;
139}
140
141int fdt_next_node(const void *fdt, int offset, int *depth)
142{
143 int nextoffset = 0;
144 uint32_t tag;
145
146 if (offset >= 0)
147 if ((nextoffset = _fdt_check_node_offset(fdt, offset)) < 0)
148 return nextoffset;
149
150 do {
151 offset = nextoffset;
152 tag = fdt_next_tag(fdt, offset, &nextoffset);
153
154 switch (tag) {
155 case FDT_PROP:
156 case FDT_NOP:
157 break;
158
159 case FDT_BEGIN_NODE:
160 if (depth)
161 (*depth)++;
162 break;
163
164 case FDT_END_NODE:
165 if (depth)
166 (*depth)--;
167 break;
168
169 case FDT_END:
170 return -FDT_ERR_NOTFOUND;
171
172 default:
173 return -FDT_ERR_BADSTRUCTURE;
174 }
175 } while (tag != FDT_BEGIN_NODE);
176
177 return offset;
178}
179
132const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) 180const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
133{ 181{
134 int len = strlen(s) + 1; 182 int len = strlen(s) + 1;
@@ -136,17 +184,14 @@ const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
136 const char *p; 184 const char *p;
137 185
138 for (p = strtab; p <= last; p++) 186 for (p = strtab; p <= last; p++)
139 if (memeq(p, s, len)) 187 if (memcmp(p, s, len) == 0)
140 return p; 188 return p;
141 return NULL; 189 return NULL;
142} 190}
143 191
144int fdt_move(const void *fdt, void *buf, int bufsize) 192int fdt_move(const void *fdt, void *buf, int bufsize)
145{ 193{
146 int err = fdt_check_header(fdt); 194 FDT_CHECK_HEADER(fdt);
147
148 if (err)
149 return err;
150 195
151 if (fdt_totalsize(fdt) > bufsize) 196 if (fdt_totalsize(fdt) > bufsize)
152 return -FDT_ERR_NOSPACE; 197 return -FDT_ERR_NOSPACE;
diff --git a/arch/powerpc/boot/libfdt/fdt_ro.c b/arch/powerpc/boot/libfdt/fdt_ro.c
index 12a37d59f96e..129b532bcc1a 100644
--- a/arch/powerpc/boot/libfdt/fdt_ro.c
+++ b/arch/powerpc/boot/libfdt/fdt_ro.c
@@ -55,17 +55,10 @@
55 55
56#include "libfdt_internal.h" 56#include "libfdt_internal.h"
57 57
58#define CHECK_HEADER(fdt) \ 58static int _fdt_nodename_eq(const void *fdt, int offset,
59 { \ 59 const char *s, int len)
60 int err; \
61 if ((err = fdt_check_header(fdt)) != 0) \
62 return err; \
63 }
64
65static int nodename_eq(const void *fdt, int offset,
66 const char *s, int len)
67{ 60{
68 const char *p = fdt_offset_ptr(fdt, offset, len+1); 61 const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1);
69 62
70 if (! p) 63 if (! p)
71 /* short match */ 64 /* short match */
@@ -84,12 +77,12 @@ static int nodename_eq(const void *fdt, int offset,
84 77
85const char *fdt_string(const void *fdt, int stroffset) 78const char *fdt_string(const void *fdt, int stroffset)
86{ 79{
87 return (char *)fdt + fdt_off_dt_strings(fdt) + stroffset; 80 return (const char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
88} 81}
89 82
90int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) 83int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
91{ 84{
92 CHECK_HEADER(fdt); 85 FDT_CHECK_HEADER(fdt);
93 *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address); 86 *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address);
94 *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size); 87 *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size);
95 return 0; 88 return 0;
@@ -104,50 +97,24 @@ int fdt_num_mem_rsv(const void *fdt)
104 return i; 97 return i;
105} 98}
106 99
107int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, 100int fdt_subnode_offset_namelen(const void *fdt, int offset,
108 const char *name, int namelen) 101 const char *name, int namelen)
109{ 102{
110 int level = 0; 103 int depth;
111 uint32_t tag;
112 int offset, nextoffset;
113
114 CHECK_HEADER(fdt);
115
116 tag = fdt_next_tag(fdt, parentoffset, &nextoffset);
117 if (tag != FDT_BEGIN_NODE)
118 return -FDT_ERR_BADOFFSET;
119
120 do {
121 offset = nextoffset;
122 tag = fdt_next_tag(fdt, offset, &nextoffset);
123
124 switch (tag) {
125 case FDT_END:
126 return -FDT_ERR_TRUNCATED;
127
128 case FDT_BEGIN_NODE:
129 level++;
130 if (level != 1)
131 continue;
132 if (nodename_eq(fdt, offset+FDT_TAGSIZE, name, namelen))
133 /* Found it! */
134 return offset;
135 break;
136
137 case FDT_END_NODE:
138 level--;
139 break;
140 104
141 case FDT_PROP: 105 FDT_CHECK_HEADER(fdt);
142 case FDT_NOP:
143 break;
144 106
145 default: 107 for (depth = 0;
146 return -FDT_ERR_BADSTRUCTURE; 108 offset >= 0;
147 } 109 offset = fdt_next_node(fdt, offset, &depth)) {
148 } while (level >= 0); 110 if (depth < 0)
111 return -FDT_ERR_NOTFOUND;
112 else if ((depth == 1)
113 && _fdt_nodename_eq(fdt, offset, name, namelen))
114 return offset;
115 }
149 116
150 return -FDT_ERR_NOTFOUND; 117 return offset; /* error */
151} 118}
152 119
153int fdt_subnode_offset(const void *fdt, int parentoffset, 120int fdt_subnode_offset(const void *fdt, int parentoffset,
@@ -162,7 +129,7 @@ int fdt_path_offset(const void *fdt, const char *path)
162 const char *p = path; 129 const char *p = path;
163 int offset = 0; 130 int offset = 0;
164 131
165 CHECK_HEADER(fdt); 132 FDT_CHECK_HEADER(fdt);
166 133
167 if (*path != '/') 134 if (*path != '/')
168 return -FDT_ERR_BADPATH; 135 return -FDT_ERR_BADPATH;
@@ -190,16 +157,12 @@ int fdt_path_offset(const void *fdt, const char *path)
190 157
191const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) 158const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
192{ 159{
193 const struct fdt_node_header *nh; 160 const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset);
194 int err; 161 int err;
195 162
196 if ((err = fdt_check_header(fdt)) != 0) 163 if (((err = fdt_check_header(fdt)) != 0)
197 goto fail; 164 || ((err = _fdt_check_node_offset(fdt, nodeoffset)) < 0))
198 165 goto fail;
199 err = -FDT_ERR_BADOFFSET;
200 nh = fdt_offset_ptr(fdt, nodeoffset, sizeof(*nh));
201 if (!nh || (fdt32_to_cpu(nh->tag) != FDT_BEGIN_NODE))
202 goto fail;
203 166
204 if (len) 167 if (len)
205 *len = strlen(nh->name); 168 *len = strlen(nh->name);
@@ -222,17 +185,11 @@ const struct fdt_property *fdt_get_property(const void *fdt,
222 int offset, nextoffset; 185 int offset, nextoffset;
223 int err; 186 int err;
224 187
225 if ((err = fdt_check_header(fdt)) != 0) 188 if (((err = fdt_check_header(fdt)) != 0)
226 goto fail; 189 || ((err = _fdt_check_node_offset(fdt, nodeoffset)) < 0))
227 190 goto fail;
228 err = -FDT_ERR_BADOFFSET;
229 if (nodeoffset % FDT_TAGSIZE)
230 goto fail;
231
232 tag = fdt_next_tag(fdt, nodeoffset, &nextoffset);
233 if (tag != FDT_BEGIN_NODE)
234 goto fail;
235 191
192 nextoffset = err;
236 do { 193 do {
237 offset = nextoffset; 194 offset = nextoffset;
238 195
@@ -253,7 +210,7 @@ const struct fdt_property *fdt_get_property(const void *fdt,
253 if (! prop) 210 if (! prop)
254 goto fail; 211 goto fail;
255 namestroff = fdt32_to_cpu(prop->nameoff); 212 namestroff = fdt32_to_cpu(prop->nameoff);
256 if (streq(fdt_string(fdt, namestroff), name)) { 213 if (strcmp(fdt_string(fdt, namestroff), name) == 0) {
257 /* Found it! */ 214 /* Found it! */
258 int len = fdt32_to_cpu(prop->len); 215 int len = fdt32_to_cpu(prop->len);
259 prop = fdt_offset_ptr(fdt, offset, 216 prop = fdt_offset_ptr(fdt, offset,
@@ -307,115 +264,91 @@ uint32_t fdt_get_phandle(const void *fdt, int nodeoffset)
307 264
308int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) 265int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
309{ 266{
310 uint32_t tag; 267 int pdepth = 0, p = 0;
311 int p = 0, overflow = 0; 268 int offset, depth, namelen;
312 int offset, nextoffset, namelen;
313 const char *name; 269 const char *name;
314 270
315 CHECK_HEADER(fdt); 271 FDT_CHECK_HEADER(fdt);
316
317 tag = fdt_next_tag(fdt, 0, &nextoffset);
318 if (tag != FDT_BEGIN_NODE)
319 return -FDT_ERR_BADSTRUCTURE;
320 272
321 if (buflen < 2) 273 if (buflen < 2)
322 return -FDT_ERR_NOSPACE; 274 return -FDT_ERR_NOSPACE;
323 buf[0] = '/';
324 p = 1;
325 275
326 while (nextoffset <= nodeoffset) { 276 for (offset = 0, depth = 0;
327 offset = nextoffset; 277 (offset >= 0) && (offset <= nodeoffset);
328 tag = fdt_next_tag(fdt, offset, &nextoffset); 278 offset = fdt_next_node(fdt, offset, &depth)) {
329 switch (tag) { 279 if (pdepth < depth)
330 case FDT_END: 280 continue; /* overflowed buffer */
331 return -FDT_ERR_BADOFFSET;
332 281
333 case FDT_BEGIN_NODE: 282 while (pdepth > depth) {
334 name = fdt_get_name(fdt, offset, &namelen); 283 do {
335 if (!name) 284 p--;
336 return namelen; 285 } while (buf[p-1] != '/');
337 if (overflow || ((p + namelen + 1) > buflen)) { 286 pdepth--;
338 overflow++; 287 }
339 break; 288
340 } 289 name = fdt_get_name(fdt, offset, &namelen);
290 if (!name)
291 return namelen;
292 if ((p + namelen + 1) <= buflen) {
341 memcpy(buf + p, name, namelen); 293 memcpy(buf + p, name, namelen);
342 p += namelen; 294 p += namelen;
343 buf[p++] = '/'; 295 buf[p++] = '/';
344 break; 296 pdepth++;
345 297 }
346 case FDT_END_NODE:
347 if (overflow) {
348 overflow--;
349 break;
350 }
351 do {
352 p--;
353 } while (buf[p-1] != '/');
354 break;
355 298
356 case FDT_PROP: 299 if (offset == nodeoffset) {
357 case FDT_NOP: 300 if (pdepth < (depth + 1))
358 break; 301 return -FDT_ERR_NOSPACE;
359 302
360 default: 303 if (p > 1) /* special case so that root path is "/", not "" */
361 return -FDT_ERR_BADSTRUCTURE; 304 p--;
305 buf[p] = '\0';
306 return p;
362 } 307 }
363 } 308 }
364 309
365 if (overflow) 310 if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
366 return -FDT_ERR_NOSPACE; 311 return -FDT_ERR_BADOFFSET;
312 else if (offset == -FDT_ERR_BADOFFSET)
313 return -FDT_ERR_BADSTRUCTURE;
367 314
368 if (p > 1) /* special case so that root path is "/", not "" */ 315 return offset; /* error from fdt_next_node() */
369 p--;
370 buf[p] = '\0';
371 return p;
372} 316}
373 317
374int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, 318int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
375 int supernodedepth, int *nodedepth) 319 int supernodedepth, int *nodedepth)
376{ 320{
377 int level = -1; 321 int offset, depth;
378 uint32_t tag;
379 int offset, nextoffset = 0;
380 int supernodeoffset = -FDT_ERR_INTERNAL; 322 int supernodeoffset = -FDT_ERR_INTERNAL;
381 323
382 CHECK_HEADER(fdt); 324 FDT_CHECK_HEADER(fdt);
383 325
384 if (supernodedepth < 0) 326 if (supernodedepth < 0)
385 return -FDT_ERR_NOTFOUND; 327 return -FDT_ERR_NOTFOUND;
386 328
387 do { 329 for (offset = 0, depth = 0;
388 offset = nextoffset; 330 (offset >= 0) && (offset <= nodeoffset);
389 tag = fdt_next_tag(fdt, offset, &nextoffset); 331 offset = fdt_next_node(fdt, offset, &depth)) {
390 switch (tag) { 332 if (depth == supernodedepth)
391 case FDT_END: 333 supernodeoffset = offset;
392 return -FDT_ERR_BADOFFSET;
393
394 case FDT_BEGIN_NODE:
395 level++;
396 if (level == supernodedepth)
397 supernodeoffset = offset;
398 break;
399
400 case FDT_END_NODE:
401 level--;
402 break;
403 334
404 case FDT_PROP: 335 if (offset == nodeoffset) {
405 case FDT_NOP: 336 if (nodedepth)
406 break; 337 *nodedepth = depth;
407 338
408 default: 339 if (supernodedepth > depth)
409 return -FDT_ERR_BADSTRUCTURE; 340 return -FDT_ERR_NOTFOUND;
341 else
342 return supernodeoffset;
410 } 343 }
411 } while (offset < nodeoffset); 344 }
412 345
413 if (nodedepth) 346 if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
414 *nodedepth = level; 347 return -FDT_ERR_BADOFFSET;
348 else if (offset == -FDT_ERR_BADOFFSET)
349 return -FDT_ERR_BADSTRUCTURE;
415 350
416 if (supernodedepth > level) 351 return offset; /* error from fdt_next_node() */
417 return -FDT_ERR_NOTFOUND;
418 return supernodeoffset;
419} 352}
420 353
421int fdt_node_depth(const void *fdt, int nodeoffset) 354int fdt_node_depth(const void *fdt, int nodeoffset)
@@ -443,51 +376,27 @@ int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
443 const char *propname, 376 const char *propname,
444 const void *propval, int proplen) 377 const void *propval, int proplen)
445{ 378{
446 uint32_t tag; 379 int offset;
447 int offset, nextoffset;
448 const void *val; 380 const void *val;
449 int len; 381 int len;
450 382
451 CHECK_HEADER(fdt); 383 FDT_CHECK_HEADER(fdt);
452
453 if (startoffset >= 0) {
454 tag = fdt_next_tag(fdt, startoffset, &nextoffset);
455 if (tag != FDT_BEGIN_NODE)
456 return -FDT_ERR_BADOFFSET;
457 } else {
458 nextoffset = 0;
459 }
460 384
461 /* FIXME: The algorithm here is pretty horrible: we scan each 385 /* FIXME: The algorithm here is pretty horrible: we scan each
462 * property of a node in fdt_getprop(), then if that didn't 386 * property of a node in fdt_getprop(), then if that didn't
463 * find what we want, we scan over them again making our way 387 * find what we want, we scan over them again making our way
464 * to the next node. Still it's the easiest to implement 388 * to the next node. Still it's the easiest to implement
465 * approach; performance can come later. */ 389 * approach; performance can come later. */
466 do { 390 for (offset = fdt_next_node(fdt, startoffset, NULL);
467 offset = nextoffset; 391 offset >= 0;
468 tag = fdt_next_tag(fdt, offset, &nextoffset); 392 offset = fdt_next_node(fdt, offset, NULL)) {
469 393 val = fdt_getprop(fdt, offset, propname, &len);
470 switch (tag) { 394 if (val && (len == proplen)
471 case FDT_BEGIN_NODE: 395 && (memcmp(val, propval, len) == 0))
472 val = fdt_getprop(fdt, offset, propname, &len); 396 return offset;
473 if (val 397 }
474 && (len == proplen)
475 && (memcmp(val, propval, len) == 0))
476 return offset;
477 break;
478
479 case FDT_PROP:
480 case FDT_END:
481 case FDT_END_NODE:
482 case FDT_NOP:
483 break;
484
485 default:
486 return -FDT_ERR_BADSTRUCTURE;
487 }
488 } while (tag != FDT_END);
489 398
490 return -FDT_ERR_NOTFOUND; 399 return offset; /* error from fdt_next_node() */
491} 400}
492 401
493int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle) 402int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
@@ -499,10 +408,10 @@ int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
499 &phandle, sizeof(phandle)); 408 &phandle, sizeof(phandle));
500} 409}
501 410
502int _stringlist_contains(const void *strlist, int listlen, const char *str) 411int _stringlist_contains(const char *strlist, int listlen, const char *str)
503{ 412{
504 int len = strlen(str); 413 int len = strlen(str);
505 const void *p; 414 const char *p;
506 415
507 while (listlen >= len) { 416 while (listlen >= len) {
508 if (memcmp(str, strlist, len+1) == 0) 417 if (memcmp(str, strlist, len+1) == 0)
@@ -534,50 +443,24 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset,
534int fdt_node_offset_by_compatible(const void *fdt, int startoffset, 443int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
535 const char *compatible) 444 const char *compatible)
536{ 445{
537 uint32_t tag; 446 int offset, err;
538 int offset, nextoffset;
539 int err;
540
541 CHECK_HEADER(fdt);
542 447
543 if (startoffset >= 0) { 448 FDT_CHECK_HEADER(fdt);
544 tag = fdt_next_tag(fdt, startoffset, &nextoffset);
545 if (tag != FDT_BEGIN_NODE)
546 return -FDT_ERR_BADOFFSET;
547 } else {
548 nextoffset = 0;
549 }
550 449
551 /* FIXME: The algorithm here is pretty horrible: we scan each 450 /* FIXME: The algorithm here is pretty horrible: we scan each
552 * property of a node in fdt_node_check_compatible(), then if 451 * property of a node in fdt_node_check_compatible(), then if
553 * that didn't find what we want, we scan over them again 452 * that didn't find what we want, we scan over them again
554 * making our way to the next node. Still it's the easiest to 453 * making our way to the next node. Still it's the easiest to
555 * implement approach; performance can come later. */ 454 * implement approach; performance can come later. */
556 do { 455 for (offset = fdt_next_node(fdt, startoffset, NULL);
557 offset = nextoffset; 456 offset >= 0;
558 tag = fdt_next_tag(fdt, offset, &nextoffset); 457 offset = fdt_next_node(fdt, offset, NULL)) {
559 458 err = fdt_node_check_compatible(fdt, offset, compatible);
560 switch (tag) { 459 if ((err < 0) && (err != -FDT_ERR_NOTFOUND))
561 case FDT_BEGIN_NODE: 460 return err;
562 err = fdt_node_check_compatible(fdt, offset, 461 else if (err == 0)
563 compatible); 462 return offset;
564 if ((err < 0) 463 }
565 && (err != -FDT_ERR_NOTFOUND))
566 return err;
567 else if (err == 0)
568 return offset;
569 break;
570
571 case FDT_PROP:
572 case FDT_END:
573 case FDT_END_NODE:
574 case FDT_NOP:
575 break;
576
577 default:
578 return -FDT_ERR_BADSTRUCTURE;
579 }
580 } while (tag != FDT_END);
581 464
582 return -FDT_ERR_NOTFOUND; 465 return offset; /* error from fdt_next_node() */
583} 466}
diff --git a/arch/powerpc/boot/libfdt/fdt_rw.c b/arch/powerpc/boot/libfdt/fdt_rw.c
index 6673f8ec962a..8e7ec4cb7bcd 100644
--- a/arch/powerpc/boot/libfdt/fdt_rw.c
+++ b/arch/powerpc/boot/libfdt/fdt_rw.c
@@ -55,10 +55,10 @@
55 55
56#include "libfdt_internal.h" 56#include "libfdt_internal.h"
57 57
58static int _blocks_misordered(const void *fdt, 58static int _fdt_blocks_misordered(const void *fdt,
59 int mem_rsv_size, int struct_size) 59 int mem_rsv_size, int struct_size)
60{ 60{
61 return (fdt_off_mem_rsvmap(fdt) < ALIGN(sizeof(struct fdt_header), 8)) 61 return (fdt_off_mem_rsvmap(fdt) < FDT_ALIGN(sizeof(struct fdt_header), 8))
62 || (fdt_off_dt_struct(fdt) < 62 || (fdt_off_dt_struct(fdt) <
63 (fdt_off_mem_rsvmap(fdt) + mem_rsv_size)) 63 (fdt_off_mem_rsvmap(fdt) + mem_rsv_size))
64 || (fdt_off_dt_strings(fdt) < 64 || (fdt_off_dt_strings(fdt) <
@@ -67,16 +67,14 @@ static int _blocks_misordered(const void *fdt,
67 (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt))); 67 (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)));
68} 68}
69 69
70static int rw_check_header(void *fdt) 70static int _fdt_rw_check_header(void *fdt)
71{ 71{
72 int err; 72 FDT_CHECK_HEADER(fdt);
73 73
74 if ((err = fdt_check_header(fdt)))
75 return err;
76 if (fdt_version(fdt) < 17) 74 if (fdt_version(fdt) < 17)
77 return -FDT_ERR_BADVERSION; 75 return -FDT_ERR_BADVERSION;
78 if (_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry), 76 if (_fdt_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry),
79 fdt_size_dt_struct(fdt))) 77 fdt_size_dt_struct(fdt)))
80 return -FDT_ERR_BADLAYOUT; 78 return -FDT_ERR_BADLAYOUT;
81 if (fdt_version(fdt) > 17) 79 if (fdt_version(fdt) > 17)
82 fdt_set_version(fdt, 17); 80 fdt_set_version(fdt, 17);
@@ -84,36 +82,37 @@ static int rw_check_header(void *fdt)
84 return 0; 82 return 0;
85} 83}
86 84
87#define RW_CHECK_HEADER(fdt) \ 85#define FDT_RW_CHECK_HEADER(fdt) \
88 { \ 86 { \
89 int err; \ 87 int err; \
90 if ((err = rw_check_header(fdt)) != 0) \ 88 if ((err = _fdt_rw_check_header(fdt)) != 0) \
91 return err; \ 89 return err; \
92 } 90 }
93 91
94static inline int _blob_data_size(void *fdt) 92static inline int _fdt_data_size(void *fdt)
95{ 93{
96 return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); 94 return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
97} 95}
98 96
99static int _blob_splice(void *fdt, void *p, int oldlen, int newlen) 97static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen)
100{ 98{
101 void *end = fdt + _blob_data_size(fdt); 99 char *p = splicepoint;
100 char *end = (char *)fdt + _fdt_data_size(fdt);
102 101
103 if (((p + oldlen) < p) || ((p + oldlen) > end)) 102 if (((p + oldlen) < p) || ((p + oldlen) > end))
104 return -FDT_ERR_BADOFFSET; 103 return -FDT_ERR_BADOFFSET;
105 if ((end - oldlen + newlen) > (fdt + fdt_totalsize(fdt))) 104 if ((end - oldlen + newlen) > ((char *)fdt + fdt_totalsize(fdt)))
106 return -FDT_ERR_NOSPACE; 105 return -FDT_ERR_NOSPACE;
107 memmove(p + newlen, p + oldlen, end - p - oldlen); 106 memmove(p + newlen, p + oldlen, end - p - oldlen);
108 return 0; 107 return 0;
109} 108}
110 109
111static int _blob_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p, 110static int _fdt_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p,
112 int oldn, int newn) 111 int oldn, int newn)
113{ 112{
114 int delta = (newn - oldn) * sizeof(*p); 113 int delta = (newn - oldn) * sizeof(*p);
115 int err; 114 int err;
116 err = _blob_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p)); 115 err = _fdt_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p));
117 if (err) 116 if (err)
118 return err; 117 return err;
119 fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta); 118 fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta);
@@ -121,13 +120,13 @@ static int _blob_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p,
121 return 0; 120 return 0;
122} 121}
123 122
124static int _blob_splice_struct(void *fdt, void *p, 123static int _fdt_splice_struct(void *fdt, void *p,
125 int oldlen, int newlen) 124 int oldlen, int newlen)
126{ 125{
127 int delta = newlen - oldlen; 126 int delta = newlen - oldlen;
128 int err; 127 int err;
129 128
130 if ((err = _blob_splice(fdt, p, oldlen, newlen))) 129 if ((err = _fdt_splice(fdt, p, oldlen, newlen)))
131 return err; 130 return err;
132 131
133 fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta); 132 fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta);
@@ -135,19 +134,20 @@ static int _blob_splice_struct(void *fdt, void *p,
135 return 0; 134 return 0;
136} 135}
137 136
138static int _blob_splice_string(void *fdt, int newlen) 137static int _fdt_splice_string(void *fdt, int newlen)
139{ 138{
140 void *p = fdt + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); 139 void *p = (char *)fdt
140 + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
141 int err; 141 int err;
142 142
143 if ((err = _blob_splice(fdt, p, 0, newlen))) 143 if ((err = _fdt_splice(fdt, p, 0, newlen)))
144 return err; 144 return err;
145 145
146 fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen); 146 fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen);
147 return 0; 147 return 0;
148} 148}
149 149
150static int _find_add_string(void *fdt, const char *s) 150static int _fdt_find_add_string(void *fdt, const char *s)
151{ 151{
152 char *strtab = (char *)fdt + fdt_off_dt_strings(fdt); 152 char *strtab = (char *)fdt + fdt_off_dt_strings(fdt);
153 const char *p; 153 const char *p;
@@ -161,7 +161,7 @@ static int _find_add_string(void *fdt, const char *s)
161 return (p - strtab); 161 return (p - strtab);
162 162
163 new = strtab + fdt_size_dt_strings(fdt); 163 new = strtab + fdt_size_dt_strings(fdt);
164 err = _blob_splice_string(fdt, len); 164 err = _fdt_splice_string(fdt, len);
165 if (err) 165 if (err)
166 return err; 166 return err;
167 167
@@ -174,11 +174,10 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
174 struct fdt_reserve_entry *re; 174 struct fdt_reserve_entry *re;
175 int err; 175 int err;
176 176
177 if ((err = rw_check_header(fdt))) 177 FDT_RW_CHECK_HEADER(fdt);
178 return err;
179 178
180 re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt)); 179 re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt));
181 err = _blob_splice_mem_rsv(fdt, re, 0, 1); 180 err = _fdt_splice_mem_rsv(fdt, re, 0, 1);
182 if (err) 181 if (err)
183 return err; 182 return err;
184 183
@@ -192,19 +191,19 @@ int fdt_del_mem_rsv(void *fdt, int n)
192 struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n); 191 struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
193 int err; 192 int err;
194 193
195 if ((err = rw_check_header(fdt))) 194 FDT_RW_CHECK_HEADER(fdt);
196 return err; 195
197 if (n >= fdt_num_mem_rsv(fdt)) 196 if (n >= fdt_num_mem_rsv(fdt))
198 return -FDT_ERR_NOTFOUND; 197 return -FDT_ERR_NOTFOUND;
199 198
200 err = _blob_splice_mem_rsv(fdt, re, 1, 0); 199 err = _fdt_splice_mem_rsv(fdt, re, 1, 0);
201 if (err) 200 if (err)
202 return err; 201 return err;
203 return 0; 202 return 0;
204} 203}
205 204
206static int _resize_property(void *fdt, int nodeoffset, const char *name, int len, 205static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
207 struct fdt_property **prop) 206 int len, struct fdt_property **prop)
208{ 207{
209 int oldlen; 208 int oldlen;
210 int err; 209 int err;
@@ -213,36 +212,33 @@ static int _resize_property(void *fdt, int nodeoffset, const char *name, int len
213 if (! (*prop)) 212 if (! (*prop))
214 return oldlen; 213 return oldlen;
215 214
216 if ((err = _blob_splice_struct(fdt, (*prop)->data, 215 if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
217 ALIGN(oldlen, FDT_TAGSIZE), 216 FDT_TAGALIGN(len))))
218 ALIGN(len, FDT_TAGSIZE))))
219 return err; 217 return err;
220 218
221 (*prop)->len = cpu_to_fdt32(len); 219 (*prop)->len = cpu_to_fdt32(len);
222 return 0; 220 return 0;
223} 221}
224 222
225static int _add_property(void *fdt, int nodeoffset, const char *name, int len, 223static int _fdt_add_property(void *fdt, int nodeoffset, const char *name,
226 struct fdt_property **prop) 224 int len, struct fdt_property **prop)
227{ 225{
228 uint32_t tag;
229 int proplen; 226 int proplen;
230 int nextoffset; 227 int nextoffset;
231 int namestroff; 228 int namestroff;
232 int err; 229 int err;
233 230
234 tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); 231 if ((nextoffset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
235 if (tag != FDT_BEGIN_NODE) 232 return nextoffset;
236 return -FDT_ERR_BADOFFSET;
237 233
238 namestroff = _find_add_string(fdt, name); 234 namestroff = _fdt_find_add_string(fdt, name);
239 if (namestroff < 0) 235 if (namestroff < 0)
240 return namestroff; 236 return namestroff;
241 237
242 *prop = _fdt_offset_ptr_w(fdt, nextoffset); 238 *prop = _fdt_offset_ptr_w(fdt, nextoffset);
243 proplen = sizeof(**prop) + ALIGN(len, FDT_TAGSIZE); 239 proplen = sizeof(**prop) + FDT_TAGALIGN(len);
244 240
245 err = _blob_splice_struct(fdt, *prop, 0, proplen); 241 err = _fdt_splice_struct(fdt, *prop, 0, proplen);
246 if (err) 242 if (err)
247 return err; 243 return err;
248 244
@@ -252,18 +248,40 @@ static int _add_property(void *fdt, int nodeoffset, const char *name, int len,
252 return 0; 248 return 0;
253} 249}
254 250
251int fdt_set_name(void *fdt, int nodeoffset, const char *name)
252{
253 char *namep;
254 int oldlen, newlen;
255 int err;
256
257 FDT_RW_CHECK_HEADER(fdt);
258
259 namep = (char *)(uintptr_t)fdt_get_name(fdt, nodeoffset, &oldlen);
260 if (!namep)
261 return oldlen;
262
263 newlen = strlen(name);
264
265 err = _fdt_splice_struct(fdt, namep, FDT_TAGALIGN(oldlen+1),
266 FDT_TAGALIGN(newlen+1));
267 if (err)
268 return err;
269
270 memcpy(namep, name, newlen+1);
271 return 0;
272}
273
255int fdt_setprop(void *fdt, int nodeoffset, const char *name, 274int fdt_setprop(void *fdt, int nodeoffset, const char *name,
256 const void *val, int len) 275 const void *val, int len)
257{ 276{
258 struct fdt_property *prop; 277 struct fdt_property *prop;
259 int err; 278 int err;
260 279
261 if ((err = rw_check_header(fdt))) 280 FDT_RW_CHECK_HEADER(fdt);
262 return err;
263 281
264 err = _resize_property(fdt, nodeoffset, name, len, &prop); 282 err = _fdt_resize_property(fdt, nodeoffset, name, len, &prop);
265 if (err == -FDT_ERR_NOTFOUND) 283 if (err == -FDT_ERR_NOTFOUND)
266 err = _add_property(fdt, nodeoffset, name, len, &prop); 284 err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
267 if (err) 285 if (err)
268 return err; 286 return err;
269 287
@@ -276,14 +294,14 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name)
276 struct fdt_property *prop; 294 struct fdt_property *prop;
277 int len, proplen; 295 int len, proplen;
278 296
279 RW_CHECK_HEADER(fdt); 297 FDT_RW_CHECK_HEADER(fdt);
280 298
281 prop = fdt_get_property_w(fdt, nodeoffset, name, &len); 299 prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
282 if (! prop) 300 if (! prop)
283 return len; 301 return len;
284 302
285 proplen = sizeof(*prop) + ALIGN(len, FDT_TAGSIZE); 303 proplen = sizeof(*prop) + FDT_TAGALIGN(len);
286 return _blob_splice_struct(fdt, prop, proplen, 0); 304 return _fdt_splice_struct(fdt, prop, proplen, 0);
287} 305}
288 306
289int fdt_add_subnode_namelen(void *fdt, int parentoffset, 307int fdt_add_subnode_namelen(void *fdt, int parentoffset,
@@ -296,7 +314,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
296 uint32_t tag; 314 uint32_t tag;
297 uint32_t *endtag; 315 uint32_t *endtag;
298 316
299 RW_CHECK_HEADER(fdt); 317 FDT_RW_CHECK_HEADER(fdt);
300 318
301 offset = fdt_subnode_offset_namelen(fdt, parentoffset, name, namelen); 319 offset = fdt_subnode_offset_namelen(fdt, parentoffset, name, namelen);
302 if (offset >= 0) 320 if (offset >= 0)
@@ -309,19 +327,19 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
309 do { 327 do {
310 offset = nextoffset; 328 offset = nextoffset;
311 tag = fdt_next_tag(fdt, offset, &nextoffset); 329 tag = fdt_next_tag(fdt, offset, &nextoffset);
312 } while (tag == FDT_PROP); 330 } while ((tag == FDT_PROP) || (tag == FDT_NOP));
313 331
314 nh = _fdt_offset_ptr_w(fdt, offset); 332 nh = _fdt_offset_ptr_w(fdt, offset);
315 nodelen = sizeof(*nh) + ALIGN(namelen+1, FDT_TAGSIZE) + FDT_TAGSIZE; 333 nodelen = sizeof(*nh) + FDT_TAGALIGN(namelen+1) + FDT_TAGSIZE;
316 334
317 err = _blob_splice_struct(fdt, nh, 0, nodelen); 335 err = _fdt_splice_struct(fdt, nh, 0, nodelen);
318 if (err) 336 if (err)
319 return err; 337 return err;
320 338
321 nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); 339 nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE);
322 memset(nh->name, 0, ALIGN(namelen+1, FDT_TAGSIZE)); 340 memset(nh->name, 0, FDT_TAGALIGN(namelen+1));
323 memcpy(nh->name, name, namelen); 341 memcpy(nh->name, name, namelen);
324 endtag = (uint32_t *)((void *)nh + nodelen - FDT_TAGSIZE); 342 endtag = (uint32_t *)((char *)nh + nodelen - FDT_TAGSIZE);
325 *endtag = cpu_to_fdt32(FDT_END_NODE); 343 *endtag = cpu_to_fdt32(FDT_END_NODE);
326 344
327 return offset; 345 return offset;
@@ -336,36 +354,36 @@ int fdt_del_node(void *fdt, int nodeoffset)
336{ 354{
337 int endoffset; 355 int endoffset;
338 356
339 RW_CHECK_HEADER(fdt); 357 FDT_RW_CHECK_HEADER(fdt);
340 358
341 endoffset = _fdt_node_end_offset(fdt, nodeoffset); 359 endoffset = _fdt_node_end_offset(fdt, nodeoffset);
342 if (endoffset < 0) 360 if (endoffset < 0)
343 return endoffset; 361 return endoffset;
344 362
345 return _blob_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset), 363 return _fdt_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset),
346 endoffset - nodeoffset, 0); 364 endoffset - nodeoffset, 0);
347} 365}
348 366
349static void _packblocks(const void *fdt, void *buf, 367static void _fdt_packblocks(const char *old, char *new,
350 int mem_rsv_size, int struct_size) 368 int mem_rsv_size, int struct_size)
351{ 369{
352 int mem_rsv_off, struct_off, strings_off; 370 int mem_rsv_off, struct_off, strings_off;
353 371
354 mem_rsv_off = ALIGN(sizeof(struct fdt_header), 8); 372 mem_rsv_off = FDT_ALIGN(sizeof(struct fdt_header), 8);
355 struct_off = mem_rsv_off + mem_rsv_size; 373 struct_off = mem_rsv_off + mem_rsv_size;
356 strings_off = struct_off + struct_size; 374 strings_off = struct_off + struct_size;
357 375
358 memmove(buf + mem_rsv_off, fdt + fdt_off_mem_rsvmap(fdt), mem_rsv_size); 376 memmove(new + mem_rsv_off, old + fdt_off_mem_rsvmap(old), mem_rsv_size);
359 fdt_set_off_mem_rsvmap(buf, mem_rsv_off); 377 fdt_set_off_mem_rsvmap(new, mem_rsv_off);
360 378
361 memmove(buf + struct_off, fdt + fdt_off_dt_struct(fdt), struct_size); 379 memmove(new + struct_off, old + fdt_off_dt_struct(old), struct_size);
362 fdt_set_off_dt_struct(buf, struct_off); 380 fdt_set_off_dt_struct(new, struct_off);
363 fdt_set_size_dt_struct(buf, struct_size); 381 fdt_set_size_dt_struct(new, struct_size);
364 382
365 memmove(buf + strings_off, fdt + fdt_off_dt_strings(fdt), 383 memmove(new + strings_off, old + fdt_off_dt_strings(old),
366 fdt_size_dt_strings(fdt)); 384 fdt_size_dt_strings(old));
367 fdt_set_off_dt_strings(buf, strings_off); 385 fdt_set_off_dt_strings(new, strings_off);
368 fdt_set_size_dt_strings(buf, fdt_size_dt_strings(fdt)); 386 fdt_set_size_dt_strings(new, fdt_size_dt_strings(old));
369} 387}
370 388
371int fdt_open_into(const void *fdt, void *buf, int bufsize) 389int fdt_open_into(const void *fdt, void *buf, int bufsize)
@@ -373,11 +391,11 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
373 int err; 391 int err;
374 int mem_rsv_size, struct_size; 392 int mem_rsv_size, struct_size;
375 int newsize; 393 int newsize;
376 void *tmp; 394 const char *fdtstart = fdt;
395 const char *fdtend = fdtstart + fdt_totalsize(fdt);
396 char *tmp;
377 397
378 err = fdt_check_header(fdt); 398 FDT_CHECK_HEADER(fdt);
379 if (err)
380 return err;
381 399
382 mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) 400 mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
383 * sizeof(struct fdt_reserve_entry); 401 * sizeof(struct fdt_reserve_entry);
@@ -390,7 +408,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
390 ; 408 ;
391 } 409 }
392 410
393 if (!_blocks_misordered(fdt, mem_rsv_size, struct_size)) { 411 if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) {
394 /* no further work necessary */ 412 /* no further work necessary */
395 err = fdt_move(fdt, buf, bufsize); 413 err = fdt_move(fdt, buf, bufsize);
396 if (err) 414 if (err)
@@ -402,22 +420,23 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
402 } 420 }
403 421
404 /* Need to reorder */ 422 /* Need to reorder */
405 newsize = ALIGN(sizeof(struct fdt_header), 8) + mem_rsv_size 423 newsize = FDT_ALIGN(sizeof(struct fdt_header), 8) + mem_rsv_size
406 + struct_size + fdt_size_dt_strings(fdt); 424 + struct_size + fdt_size_dt_strings(fdt);
407 425
408 if (bufsize < newsize) 426 if (bufsize < newsize)
409 return -FDT_ERR_NOSPACE; 427 return -FDT_ERR_NOSPACE;
410 428
411 if (((buf + newsize) <= fdt) 429 /* First attempt to build converted tree at beginning of buffer */
412 || (buf >= (fdt + fdt_totalsize(fdt)))) { 430 tmp = buf;
413 tmp = buf; 431 /* But if that overlaps with the old tree... */
414 } else { 432 if (((tmp + newsize) > fdtstart) && (tmp < fdtend)) {
415 tmp = (void *)fdt + fdt_totalsize(fdt); 433 /* Try right after the old tree instead */
416 if ((tmp + newsize) > (buf + bufsize)) 434 tmp = (char *)(uintptr_t)fdtend;
435 if ((tmp + newsize) > ((char *)buf + bufsize))
417 return -FDT_ERR_NOSPACE; 436 return -FDT_ERR_NOSPACE;
418 } 437 }
419 438
420 _packblocks(fdt, tmp, mem_rsv_size, struct_size); 439 _fdt_packblocks(fdt, tmp, mem_rsv_size, struct_size);
421 memmove(buf, tmp, newsize); 440 memmove(buf, tmp, newsize);
422 441
423 fdt_set_magic(buf, FDT_MAGIC); 442 fdt_set_magic(buf, FDT_MAGIC);
@@ -432,16 +451,13 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
432int fdt_pack(void *fdt) 451int fdt_pack(void *fdt)
433{ 452{
434 int mem_rsv_size; 453 int mem_rsv_size;
435 int err;
436 454
437 err = rw_check_header(fdt); 455 FDT_RW_CHECK_HEADER(fdt);
438 if (err)
439 return err;
440 456
441 mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) 457 mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
442 * sizeof(struct fdt_reserve_entry); 458 * sizeof(struct fdt_reserve_entry);
443 _packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt)); 459 _fdt_packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
444 fdt_set_totalsize(fdt, _blob_data_size(fdt)); 460 fdt_set_totalsize(fdt, _fdt_data_size(fdt));
445 461
446 return 0; 462 return 0;
447} 463}
diff --git a/arch/powerpc/boot/libfdt/fdt_strerror.c b/arch/powerpc/boot/libfdt/fdt_strerror.c
index f9d32ef5360a..e6c3ceee8c58 100644
--- a/arch/powerpc/boot/libfdt/fdt_strerror.c
+++ b/arch/powerpc/boot/libfdt/fdt_strerror.c
@@ -55,29 +55,29 @@
55 55
56#include "libfdt_internal.h" 56#include "libfdt_internal.h"
57 57
58struct errtabent { 58struct fdt_errtabent {
59 const char *str; 59 const char *str;
60}; 60};
61 61
62#define ERRTABENT(val) \ 62#define FDT_ERRTABENT(val) \
63 [(val)] = { .str = #val, } 63 [(val)] = { .str = #val, }
64 64
65static struct errtabent errtable[] = { 65static struct fdt_errtabent fdt_errtable[] = {
66 ERRTABENT(FDT_ERR_NOTFOUND), 66 FDT_ERRTABENT(FDT_ERR_NOTFOUND),
67 ERRTABENT(FDT_ERR_EXISTS), 67 FDT_ERRTABENT(FDT_ERR_EXISTS),
68 ERRTABENT(FDT_ERR_NOSPACE), 68 FDT_ERRTABENT(FDT_ERR_NOSPACE),
69 69
70 ERRTABENT(FDT_ERR_BADOFFSET), 70 FDT_ERRTABENT(FDT_ERR_BADOFFSET),
71 ERRTABENT(FDT_ERR_BADPATH), 71 FDT_ERRTABENT(FDT_ERR_BADPATH),
72 ERRTABENT(FDT_ERR_BADSTATE), 72 FDT_ERRTABENT(FDT_ERR_BADSTATE),
73 73
74 ERRTABENT(FDT_ERR_TRUNCATED), 74 FDT_ERRTABENT(FDT_ERR_TRUNCATED),
75 ERRTABENT(FDT_ERR_BADMAGIC), 75 FDT_ERRTABENT(FDT_ERR_BADMAGIC),
76 ERRTABENT(FDT_ERR_BADVERSION), 76 FDT_ERRTABENT(FDT_ERR_BADVERSION),
77 ERRTABENT(FDT_ERR_BADSTRUCTURE), 77 FDT_ERRTABENT(FDT_ERR_BADSTRUCTURE),
78 ERRTABENT(FDT_ERR_BADLAYOUT), 78 FDT_ERRTABENT(FDT_ERR_BADLAYOUT),
79}; 79};
80#define ERRTABSIZE (sizeof(errtable) / sizeof(errtable[0])) 80#define FDT_ERRTABSIZE (sizeof(fdt_errtable) / sizeof(fdt_errtable[0]))
81 81
82const char *fdt_strerror(int errval) 82const char *fdt_strerror(int errval)
83{ 83{
@@ -85,8 +85,8 @@ const char *fdt_strerror(int errval)
85 return "<valid offset/length>"; 85 return "<valid offset/length>";
86 else if (errval == 0) 86 else if (errval == 0)
87 return "<no error>"; 87 return "<no error>";
88 else if (errval > -ERRTABSIZE) { 88 else if (errval > -FDT_ERRTABSIZE) {
89 const char *s = errtable[-errval].str; 89 const char *s = fdt_errtable[-errval].str;
90 90
91 if (s) 91 if (s)
92 return s; 92 return s;
diff --git a/arch/powerpc/boot/libfdt/fdt_sw.c b/arch/powerpc/boot/libfdt/fdt_sw.c
index dda2de34b2e0..698329e0ccaf 100644
--- a/arch/powerpc/boot/libfdt/fdt_sw.c
+++ b/arch/powerpc/boot/libfdt/fdt_sw.c
@@ -55,14 +55,22 @@
55 55
56#include "libfdt_internal.h" 56#include "libfdt_internal.h"
57 57
58static int check_header_sw(void *fdt) 58static int _fdt_sw_check_header(void *fdt)
59{ 59{
60 if (fdt_magic(fdt) != SW_MAGIC) 60 if (fdt_magic(fdt) != FDT_SW_MAGIC)
61 return -FDT_ERR_BADMAGIC; 61 return -FDT_ERR_BADMAGIC;
62 /* FIXME: should check more details about the header state */
62 return 0; 63 return 0;
63} 64}
64 65
65static void *grab_space(void *fdt, int len) 66#define FDT_SW_CHECK_HEADER(fdt) \
67 { \
68 int err; \
69 if ((err = _fdt_sw_check_header(fdt)) != 0) \
70 return err; \
71 }
72
73static void *_fdt_grab_space(void *fdt, int len)
66{ 74{
67 int offset = fdt_size_dt_struct(fdt); 75 int offset = fdt_size_dt_struct(fdt);
68 int spaceleft; 76 int spaceleft;
@@ -86,13 +94,13 @@ int fdt_create(void *buf, int bufsize)
86 94
87 memset(buf, 0, bufsize); 95 memset(buf, 0, bufsize);
88 96
89 fdt_set_magic(fdt, SW_MAGIC); 97 fdt_set_magic(fdt, FDT_SW_MAGIC);
90 fdt_set_version(fdt, FDT_LAST_SUPPORTED_VERSION); 98 fdt_set_version(fdt, FDT_LAST_SUPPORTED_VERSION);
91 fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION); 99 fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION);
92 fdt_set_totalsize(fdt, bufsize); 100 fdt_set_totalsize(fdt, bufsize);
93 101
94 fdt_set_off_mem_rsvmap(fdt, ALIGN(sizeof(struct fdt_header), 102 fdt_set_off_mem_rsvmap(fdt, FDT_ALIGN(sizeof(struct fdt_header),
95 sizeof(struct fdt_reserve_entry))); 103 sizeof(struct fdt_reserve_entry)));
96 fdt_set_off_dt_struct(fdt, fdt_off_mem_rsvmap(fdt)); 104 fdt_set_off_dt_struct(fdt, fdt_off_mem_rsvmap(fdt));
97 fdt_set_off_dt_strings(fdt, bufsize); 105 fdt_set_off_dt_strings(fdt, bufsize);
98 106
@@ -102,11 +110,10 @@ int fdt_create(void *buf, int bufsize)
102int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size) 110int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size)
103{ 111{
104 struct fdt_reserve_entry *re; 112 struct fdt_reserve_entry *re;
105 int err = check_header_sw(fdt);
106 int offset; 113 int offset;
107 114
108 if (err) 115 FDT_SW_CHECK_HEADER(fdt);
109 return err; 116
110 if (fdt_size_dt_struct(fdt)) 117 if (fdt_size_dt_struct(fdt))
111 return -FDT_ERR_BADSTATE; 118 return -FDT_ERR_BADSTATE;
112 119
@@ -114,7 +121,7 @@ int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size)
114 if ((offset + sizeof(*re)) > fdt_totalsize(fdt)) 121 if ((offset + sizeof(*re)) > fdt_totalsize(fdt))
115 return -FDT_ERR_NOSPACE; 122 return -FDT_ERR_NOSPACE;
116 123
117 re = (struct fdt_reserve_entry *)(fdt + offset); 124 re = (struct fdt_reserve_entry *)((char *)fdt + offset);
118 re->address = cpu_to_fdt64(addr); 125 re->address = cpu_to_fdt64(addr);
119 re->size = cpu_to_fdt64(size); 126 re->size = cpu_to_fdt64(size);
120 127
@@ -131,13 +138,11 @@ int fdt_finish_reservemap(void *fdt)
131int fdt_begin_node(void *fdt, const char *name) 138int fdt_begin_node(void *fdt, const char *name)
132{ 139{
133 struct fdt_node_header *nh; 140 struct fdt_node_header *nh;
134 int err = check_header_sw(fdt);
135 int namelen = strlen(name) + 1; 141 int namelen = strlen(name) + 1;
136 142
137 if (err) 143 FDT_SW_CHECK_HEADER(fdt);
138 return err;
139 144
140 nh = grab_space(fdt, sizeof(*nh) + ALIGN(namelen, FDT_TAGSIZE)); 145 nh = _fdt_grab_space(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen));
141 if (! nh) 146 if (! nh)
142 return -FDT_ERR_NOSPACE; 147 return -FDT_ERR_NOSPACE;
143 148
@@ -149,12 +154,10 @@ int fdt_begin_node(void *fdt, const char *name)
149int fdt_end_node(void *fdt) 154int fdt_end_node(void *fdt)
150{ 155{
151 uint32_t *en; 156 uint32_t *en;
152 int err = check_header_sw(fdt);
153 157
154 if (err) 158 FDT_SW_CHECK_HEADER(fdt);
155 return err;
156 159
157 en = grab_space(fdt, FDT_TAGSIZE); 160 en = _fdt_grab_space(fdt, FDT_TAGSIZE);
158 if (! en) 161 if (! en)
159 return -FDT_ERR_NOSPACE; 162 return -FDT_ERR_NOSPACE;
160 163
@@ -162,7 +165,7 @@ int fdt_end_node(void *fdt)
162 return 0; 165 return 0;
163} 166}
164 167
165static int find_add_string(void *fdt, const char *s) 168static int _fdt_find_add_string(void *fdt, const char *s)
166{ 169{
167 char *strtab = (char *)fdt + fdt_totalsize(fdt); 170 char *strtab = (char *)fdt + fdt_totalsize(fdt);
168 const char *p; 171 const char *p;
@@ -188,17 +191,15 @@ static int find_add_string(void *fdt, const char *s)
188int fdt_property(void *fdt, const char *name, const void *val, int len) 191int fdt_property(void *fdt, const char *name, const void *val, int len)
189{ 192{
190 struct fdt_property *prop; 193 struct fdt_property *prop;
191 int err = check_header_sw(fdt);
192 int nameoff; 194 int nameoff;
193 195
194 if (err) 196 FDT_SW_CHECK_HEADER(fdt);
195 return err;
196 197
197 nameoff = find_add_string(fdt, name); 198 nameoff = _fdt_find_add_string(fdt, name);
198 if (nameoff == 0) 199 if (nameoff == 0)
199 return -FDT_ERR_NOSPACE; 200 return -FDT_ERR_NOSPACE;
200 201
201 prop = grab_space(fdt, sizeof(*prop) + ALIGN(len, FDT_TAGSIZE)); 202 prop = _fdt_grab_space(fdt, sizeof(*prop) + FDT_TAGALIGN(len));
202 if (! prop) 203 if (! prop)
203 return -FDT_ERR_NOSPACE; 204 return -FDT_ERR_NOSPACE;
204 205
@@ -211,18 +212,16 @@ int fdt_property(void *fdt, const char *name, const void *val, int len)
211 212
212int fdt_finish(void *fdt) 213int fdt_finish(void *fdt)
213{ 214{
214 int err = check_header_sw(fdt);
215 char *p = (char *)fdt; 215 char *p = (char *)fdt;
216 uint32_t *end; 216 uint32_t *end;
217 int oldstroffset, newstroffset; 217 int oldstroffset, newstroffset;
218 uint32_t tag; 218 uint32_t tag;
219 int offset, nextoffset; 219 int offset, nextoffset;
220 220
221 if (err) 221 FDT_SW_CHECK_HEADER(fdt);
222 return err;
223 222
224 /* Add terminator */ 223 /* Add terminator */
225 end = grab_space(fdt, sizeof(*end)); 224 end = _fdt_grab_space(fdt, sizeof(*end));
226 if (! end) 225 if (! end)
227 return -FDT_ERR_NOSPACE; 226 return -FDT_ERR_NOSPACE;
228 *end = cpu_to_fdt32(FDT_END); 227 *end = cpu_to_fdt32(FDT_END);
diff --git a/arch/powerpc/boot/libfdt/fdt_wip.c b/arch/powerpc/boot/libfdt/fdt_wip.c
index 88e24b8318f4..a4652c6e787e 100644
--- a/arch/powerpc/boot/libfdt/fdt_wip.c
+++ b/arch/powerpc/boot/libfdt/fdt_wip.c
@@ -72,11 +72,11 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
72 return 0; 72 return 0;
73} 73}
74 74
75static void nop_region(void *start, int len) 75static void _fdt_nop_region(void *start, int len)
76{ 76{
77 uint32_t *p; 77 uint32_t *p;
78 78
79 for (p = start; (void *)p < (start + len); p++) 79 for (p = start; (char *)p < ((char *)start + len); p++)
80 *p = cpu_to_fdt32(FDT_NOP); 80 *p = cpu_to_fdt32(FDT_NOP);
81} 81}
82 82
@@ -89,7 +89,7 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
89 if (! prop) 89 if (! prop)
90 return len; 90 return len;
91 91
92 nop_region(prop, len + sizeof(*prop)); 92 _fdt_nop_region(prop, len + sizeof(*prop));
93 93
94 return 0; 94 return 0;
95} 95}
@@ -139,6 +139,7 @@ int fdt_nop_node(void *fdt, int nodeoffset)
139 if (endoffset < 0) 139 if (endoffset < 0)
140 return endoffset; 140 return endoffset;
141 141
142 nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0), endoffset - nodeoffset); 142 _fdt_nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0),
143 endoffset - nodeoffset);
143 return 0; 144 return 0;
144} 145}
diff --git a/arch/powerpc/boot/libfdt/libfdt.h b/arch/powerpc/boot/libfdt/libfdt.h
index 6b2fb92ea357..ce80e4fb41b2 100644
--- a/arch/powerpc/boot/libfdt/libfdt.h
+++ b/arch/powerpc/boot/libfdt/libfdt.h
@@ -125,12 +125,18 @@
125const void *fdt_offset_ptr(const void *fdt, int offset, int checklen); 125const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
126static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) 126static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
127{ 127{
128 return (void *)fdt_offset_ptr(fdt, offset, checklen); 128 return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
129} 129}
130 130
131uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); 131uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
132 132
133/**********************************************************************/ 133/**********************************************************************/
134/* Traversal functions */
135/**********************************************************************/
136
137int fdt_next_node(const void *fdt, int offset, int *depth);
138
139/**********************************************************************/
134/* General functions */ 140/* General functions */
135/**********************************************************************/ 141/**********************************************************************/
136 142
@@ -207,7 +213,7 @@ int fdt_move(const void *fdt, void *buf, int bufsize);
207/**********************************************************************/ 213/**********************************************************************/
208 214
209/** 215/**
210 * fdt_string - retreive a string from the strings block of a device tree 216 * fdt_string - retrieve a string from the strings block of a device tree
211 * @fdt: pointer to the device tree blob 217 * @fdt: pointer to the device tree blob
212 * @stroffset: offset of the string within the strings block (native endian) 218 * @stroffset: offset of the string within the strings block (native endian)
213 * 219 *
@@ -221,7 +227,7 @@ int fdt_move(const void *fdt, void *buf, int bufsize);
221const char *fdt_string(const void *fdt, int stroffset); 227const char *fdt_string(const void *fdt, int stroffset);
222 228
223/** 229/**
224 * fdt_num_mem_rsv - retreive the number of memory reserve map entries 230 * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
225 * @fdt: pointer to the device tree blob 231 * @fdt: pointer to the device tree blob
226 * 232 *
227 * Returns the number of entries in the device tree blob's memory 233 * Returns the number of entries in the device tree blob's memory
@@ -234,7 +240,7 @@ const char *fdt_string(const void *fdt, int stroffset);
234int fdt_num_mem_rsv(const void *fdt); 240int fdt_num_mem_rsv(const void *fdt);
235 241
236/** 242/**
237 * fdt_get_mem_rsv - retreive one memory reserve map entry 243 * fdt_get_mem_rsv - retrieve one memory reserve map entry
238 * @fdt: pointer to the device tree blob 244 * @fdt: pointer to the device tree blob
239 * @address, @size: pointers to 64-bit variables 245 * @address, @size: pointers to 64-bit variables
240 * 246 *
@@ -314,7 +320,7 @@ int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
314int fdt_path_offset(const void *fdt, const char *path); 320int fdt_path_offset(const void *fdt, const char *path);
315 321
316/** 322/**
317 * fdt_get_name - retreive the name of a given node 323 * fdt_get_name - retrieve the name of a given node
318 * @fdt: pointer to the device tree blob 324 * @fdt: pointer to the device tree blob
319 * @nodeoffset: structure block offset of the starting node 325 * @nodeoffset: structure block offset of the starting node
320 * @lenp: pointer to an integer variable (will be overwritten) or NULL 326 * @lenp: pointer to an integer variable (will be overwritten) or NULL
@@ -346,7 +352,7 @@ const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
346 * fdt_get_property() retrieves a pointer to the fdt_property 352 * fdt_get_property() retrieves a pointer to the fdt_property
347 * structure within the device tree blob corresponding to the property 353 * structure within the device tree blob corresponding to the property
348 * named 'name' of the node at offset nodeoffset. If lenp is 354 * named 'name' of the node at offset nodeoffset. If lenp is
349 * non-NULL, the length of the property value also returned, in the 355 * non-NULL, the length of the property value is also returned, in the
350 * integer pointed to by lenp. 356 * integer pointed to by lenp.
351 * 357 *
352 * returns: 358 * returns:
@@ -369,8 +375,8 @@ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
369 const char *name, 375 const char *name,
370 int *lenp) 376 int *lenp)
371{ 377{
372 return (struct fdt_property *)fdt_get_property(fdt, nodeoffset, 378 return (struct fdt_property *)(uintptr_t)
373 name, lenp); 379 fdt_get_property(fdt, nodeoffset, name, lenp);
374} 380}
375 381
376/** 382/**
@@ -383,7 +389,7 @@ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
383 * fdt_getprop() retrieves a pointer to the value of the property 389 * fdt_getprop() retrieves a pointer to the value of the property
384 * named 'name' of the node at offset nodeoffset (this will be a 390 * named 'name' of the node at offset nodeoffset (this will be a
385 * pointer to within the device blob itself, not a copy of the value). 391 * pointer to within the device blob itself, not a copy of the value).
386 * If lenp is non-NULL, the length of the property value also 392 * If lenp is non-NULL, the length of the property value is also
387 * returned, in the integer pointed to by lenp. 393 * returned, in the integer pointed to by lenp.
388 * 394 *
389 * returns: 395 * returns:
@@ -405,11 +411,11 @@ const void *fdt_getprop(const void *fdt, int nodeoffset,
405static inline void *fdt_getprop_w(void *fdt, int nodeoffset, 411static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
406 const char *name, int *lenp) 412 const char *name, int *lenp)
407{ 413{
408 return (void *)fdt_getprop(fdt, nodeoffset, name, lenp); 414 return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
409} 415}
410 416
411/** 417/**
412 * fdt_get_phandle - retreive the phandle of a given node 418 * fdt_get_phandle - retrieve the phandle of a given node
413 * @fdt: pointer to the device tree blob 419 * @fdt: pointer to the device tree blob
414 * @nodeoffset: structure block offset of the node 420 * @nodeoffset: structure block offset of the node
415 * 421 *
@@ -417,7 +423,7 @@ static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
417 * structure block offset nodeoffset. 423 * structure block offset nodeoffset.
418 * 424 *
419 * returns: 425 * returns:
420 * the phandle of the node at nodeoffset, on succes (!= 0, != -1) 426 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
421 * 0, if the node has no phandle, or another error occurs 427 * 0, if the node has no phandle, or another error occurs
422 */ 428 */
423uint32_t fdt_get_phandle(const void *fdt, int nodeoffset); 429uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
@@ -516,7 +522,7 @@ int fdt_node_depth(const void *fdt, int nodeoffset);
516 * structure from the start to nodeoffset, *twice*. 522 * structure from the start to nodeoffset, *twice*.
517 * 523 *
518 * returns: 524 * returns:
519 * stucture block offset of the parent of the node at nodeoffset 525 * structure block offset of the parent of the node at nodeoffset
520 * (>=0), on success 526 * (>=0), on success
521 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag 527 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
522 * -FDT_ERR_BADMAGIC, 528 * -FDT_ERR_BADMAGIC,
@@ -573,7 +579,7 @@ int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
573 * @fdt: pointer to the device tree blob 579 * @fdt: pointer to the device tree blob
574 * @phandle: phandle value 580 * @phandle: phandle value
575 * 581 *
576 * fdt_node_offset_by_prop_value() returns the offset of the node 582 * fdt_node_offset_by_phandle() returns the offset of the node
577 * which has the given phandle value. If there is more than one node 583 * which has the given phandle value. If there is more than one node
578 * in the tree with the given phandle (an invalid tree), results are 584 * in the tree with the given phandle (an invalid tree), results are
579 * undefined. 585 * undefined.
@@ -655,8 +661,65 @@ int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
655/* Write-in-place functions */ 661/* Write-in-place functions */
656/**********************************************************************/ 662/**********************************************************************/
657 663
664/**
665 * fdt_setprop_inplace - change a property's value, but not its size
666 * @fdt: pointer to the device tree blob
667 * @nodeoffset: offset of the node whose property to change
668 * @name: name of the property to change
669 * @val: pointer to data to replace the property value with
670 * @len: length of the property value
671 *
672 * fdt_setprop_inplace() replaces the value of a given property with
673 * the data in val, of length len. This function cannot change the
674 * size of a property, and so will only work if len is equal to the
675 * current length of the property.
676 *
677 * This function will alter only the bytes in the blob which contain
678 * the given property value, and will not alter or move any other part
679 * of the tree.
680 *
681 * returns:
682 * 0, on success
683 * -FDT_ERR_NOSPACE, if len is not equal to the property's current length
684 * -FDT_ERR_NOTFOUND, node does not have the named property
685 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
686 * -FDT_ERR_BADMAGIC,
687 * -FDT_ERR_BADVERSION,
688 * -FDT_ERR_BADSTATE,
689 * -FDT_ERR_BADSTRUCTURE,
690 * -FDT_ERR_TRUNCATED, standard meanings
691 */
658int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, 692int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
659 const void *val, int len); 693 const void *val, int len);
694
695/**
696 * fdt_setprop_inplace_cell - change the value of a single-cell property
697 * @fdt: pointer to the device tree blob
698 * @nodeoffset: offset of the node whose property to change
699 * @name: name of the property to change
700 * @val: cell (32-bit integer) value to replace the property with
701 *
702 * fdt_setprop_inplace_cell() replaces the value of a given property
703 * with the 32-bit integer cell value in val, converting val to
704 * big-endian if necessary. This function cannot change the size of a
705 * property, and so will only work if the property already exists and
706 * has length 4.
707 *
708 * This function will alter only the bytes in the blob which contain
709 * the given property value, and will not alter or move any other part
710 * of the tree.
711 *
712 * returns:
713 * 0, on success
714 * -FDT_ERR_NOSPACE, if the property's length is not equal to 4
715 * -FDT_ERR_NOTFOUND, node does not have the named property
716 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
717 * -FDT_ERR_BADMAGIC,
718 * -FDT_ERR_BADVERSION,
719 * -FDT_ERR_BADSTATE,
720 * -FDT_ERR_BADSTRUCTURE,
721 * -FDT_ERR_TRUNCATED, standard meanings
722 */
660static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, 723static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
661 const char *name, uint32_t val) 724 const char *name, uint32_t val)
662{ 725{
@@ -664,7 +727,54 @@ static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
664 return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); 727 return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val));
665} 728}
666 729
730/**
731 * fdt_nop_property - replace a property with nop tags
732 * @fdt: pointer to the device tree blob
733 * @nodeoffset: offset of the node whose property to nop
734 * @name: name of the property to nop
735 *
736 * fdt_nop_property() will replace a given property's representation
737 * in the blob with FDT_NOP tags, effectively removing it from the
738 * tree.
739 *
740 * This function will alter only the bytes in the blob which contain
741 * the property, and will not alter or move any other part of the
742 * tree.
743 *
744 * returns:
745 * 0, on success
746 * -FDT_ERR_NOTFOUND, node does not have the named property
747 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
748 * -FDT_ERR_BADMAGIC,
749 * -FDT_ERR_BADVERSION,
750 * -FDT_ERR_BADSTATE,
751 * -FDT_ERR_BADSTRUCTURE,
752 * -FDT_ERR_TRUNCATED, standard meanings
753 */
667int fdt_nop_property(void *fdt, int nodeoffset, const char *name); 754int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
755
756/**
757 * fdt_nop_node - replace a node (subtree) with nop tags
758 * @fdt: pointer to the device tree blob
759 * @nodeoffset: offset of the node to nop
760 *
761 * fdt_nop_node() will replace a given node's representation in the
762 * blob, including all its subnodes, if any, with FDT_NOP tags,
763 * effectively removing it from the tree.
764 *
765 * This function will alter only the bytes in the blob which contain
766 * the node and its properties and subnodes, and will not alter or
767 * move any other part of the tree.
768 *
769 * returns:
770 * 0, on success
771 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
772 * -FDT_ERR_BADMAGIC,
773 * -FDT_ERR_BADVERSION,
774 * -FDT_ERR_BADSTATE,
775 * -FDT_ERR_BADSTRUCTURE,
776 * -FDT_ERR_TRUNCATED, standard meanings
777 */
668int fdt_nop_node(void *fdt, int nodeoffset); 778int fdt_nop_node(void *fdt, int nodeoffset);
669 779
670/**********************************************************************/ 780/**********************************************************************/
@@ -693,23 +803,268 @@ int fdt_finish(void *fdt);
693int fdt_open_into(const void *fdt, void *buf, int bufsize); 803int fdt_open_into(const void *fdt, void *buf, int bufsize);
694int fdt_pack(void *fdt); 804int fdt_pack(void *fdt);
695 805
806/**
807 * fdt_add_mem_rsv - add one memory reserve map entry
808 * @fdt: pointer to the device tree blob
809 * @address, @size: 64-bit values (native endian)
810 *
811 * Adds a reserve map entry to the given blob reserving a region at
812 * address address of length size.
813 *
814 * This function will insert data into the reserve map and will
815 * therefore change the indexes of some entries in the table.
816 *
817 * returns:
818 * 0, on success
819 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
820 * contain the new reservation entry
821 * -FDT_ERR_BADMAGIC,
822 * -FDT_ERR_BADVERSION,
823 * -FDT_ERR_BADSTATE,
824 * -FDT_ERR_BADSTRUCTURE,
825 * -FDT_ERR_BADLAYOUT,
826 * -FDT_ERR_TRUNCATED, standard meanings
827 */
696int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size); 828int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
829
830/**
831 * fdt_del_mem_rsv - remove a memory reserve map entry
832 * @fdt: pointer to the device tree blob
833 * @n: entry to remove
834 *
835 * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
836 * the blob.
837 *
838 * This function will delete data from the reservation table and will
839 * therefore change the indexes of some entries in the table.
840 *
841 * returns:
842 * 0, on success
843 * -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
844 * are less than n+1 reserve map entries)
845 * -FDT_ERR_BADMAGIC,
846 * -FDT_ERR_BADVERSION,
847 * -FDT_ERR_BADSTATE,
848 * -FDT_ERR_BADSTRUCTURE,
849 * -FDT_ERR_BADLAYOUT,
850 * -FDT_ERR_TRUNCATED, standard meanings
851 */
697int fdt_del_mem_rsv(void *fdt, int n); 852int fdt_del_mem_rsv(void *fdt, int n);
698 853
854/**
855 * fdt_set_name - change the name of a given node
856 * @fdt: pointer to the device tree blob
857 * @nodeoffset: structure block offset of a node
858 * @name: name to give the node
859 *
860 * fdt_set_name() replaces the name (including unit address, if any)
861 * of the given node with the given string. NOTE: this function can't
862 * efficiently check if the new name is unique amongst the given
863 * node's siblings; results are undefined if this function is invoked
864 * with a name equal to one of the given node's siblings.
865 *
866 * This function may insert or delete data from the blob, and will
867 * therefore change the offsets of some existing nodes.
868 *
869 * returns:
870 * 0, on success
871 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob
872 * to contain the new name
873 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
874 * -FDT_ERR_BADMAGIC,
875 * -FDT_ERR_BADVERSION,
876 * -FDT_ERR_BADSTATE, standard meanings
877 */
878int fdt_set_name(void *fdt, int nodeoffset, const char *name);
879
880/**
881 * fdt_setprop - create or change a property
882 * @fdt: pointer to the device tree blob
883 * @nodeoffset: offset of the node whose property to change
884 * @name: name of the property to change
885 * @val: pointer to data to set the property value to
886 * @len: length of the property value
887 *
888 * fdt_setprop() sets the value of the named property in the given
889 * node to the given value and length, creating the property if it
890 * does not already exist.
891 *
892 * This function may insert or delete data from the blob, and will
893 * therefore change the offsets of some existing nodes.
894 *
895 * returns:
896 * 0, on success
897 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
898 * contain the new property value
899 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
900 * -FDT_ERR_BADLAYOUT,
901 * -FDT_ERR_BADMAGIC,
902 * -FDT_ERR_BADVERSION,
903 * -FDT_ERR_BADSTATE,
904 * -FDT_ERR_BADSTRUCTURE,
905 * -FDT_ERR_BADLAYOUT,
906 * -FDT_ERR_TRUNCATED, standard meanings
907 */
699int fdt_setprop(void *fdt, int nodeoffset, const char *name, 908int fdt_setprop(void *fdt, int nodeoffset, const char *name,
700 const void *val, int len); 909 const void *val, int len);
910
911/**
912 * fdt_setprop_cell - set a property to a single cell value
913 * @fdt: pointer to the device tree blob
914 * @nodeoffset: offset of the node whose property to change
915 * @name: name of the property to change
916 * @val: 32-bit integer value for the property (native endian)
917 *
918 * fdt_setprop_cell() sets the value of the named property in the
919 * given node to the given cell value (converting to big-endian if
920 * necessary), or creates a new property with that value if it does
921 * not already exist.
922 *
923 * This function may insert or delete data from the blob, and will
924 * therefore change the offsets of some existing nodes.
925 *
926 * returns:
927 * 0, on success
928 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
929 * contain the new property value
930 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
931 * -FDT_ERR_BADLAYOUT,
932 * -FDT_ERR_BADMAGIC,
933 * -FDT_ERR_BADVERSION,
934 * -FDT_ERR_BADSTATE,
935 * -FDT_ERR_BADSTRUCTURE,
936 * -FDT_ERR_BADLAYOUT,
937 * -FDT_ERR_TRUNCATED, standard meanings
938 */
701static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, 939static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
702 uint32_t val) 940 uint32_t val)
703{ 941{
704 val = cpu_to_fdt32(val); 942 val = cpu_to_fdt32(val);
705 return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); 943 return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val));
706} 944}
945
946/**
947 * fdt_setprop_string - set a property to a string value
948 * @fdt: pointer to the device tree blob
949 * @nodeoffset: offset of the node whose property to change
950 * @name: name of the property to change
951 * @str: string value for the property
952 *
953 * fdt_setprop_string() sets the value of the named property in the
954 * given node to the given string value (using the length of the
955 * string to determine the new length of the property), or creates a
956 * new property with that value if it does not already exist.
957 *
958 * This function may insert or delete data from the blob, and will
959 * therefore change the offsets of some existing nodes.
960 *
961 * returns:
962 * 0, on success
963 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
964 * contain the new property value
965 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
966 * -FDT_ERR_BADLAYOUT,
967 * -FDT_ERR_BADMAGIC,
968 * -FDT_ERR_BADVERSION,
969 * -FDT_ERR_BADSTATE,
970 * -FDT_ERR_BADSTRUCTURE,
971 * -FDT_ERR_BADLAYOUT,
972 * -FDT_ERR_TRUNCATED, standard meanings
973 */
707#define fdt_setprop_string(fdt, nodeoffset, name, str) \ 974#define fdt_setprop_string(fdt, nodeoffset, name, str) \
708 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1) 975 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
976
977/**
978 * fdt_delprop - delete a property
979 * @fdt: pointer to the device tree blob
980 * @nodeoffset: offset of the node whose property to nop
981 * @name: name of the property to nop
982 *
983 * fdt_del_property() will delete the given property.
984 *
985 * This function will delete data from the blob, and will therefore
986 * change the offsets of some existing nodes.
987 *
988 * returns:
989 * 0, on success
990 * -FDT_ERR_NOTFOUND, node does not have the named property
991 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
992 * -FDT_ERR_BADLAYOUT,
993 * -FDT_ERR_BADMAGIC,
994 * -FDT_ERR_BADVERSION,
995 * -FDT_ERR_BADSTATE,
996 * -FDT_ERR_BADSTRUCTURE,
997 * -FDT_ERR_TRUNCATED, standard meanings
998 */
709int fdt_delprop(void *fdt, int nodeoffset, const char *name); 999int fdt_delprop(void *fdt, int nodeoffset, const char *name);
1000
1001/**
1002 * fdt_add_subnode_namelen - creates a new node based on substring
1003 * @fdt: pointer to the device tree blob
1004 * @parentoffset: structure block offset of a node
1005 * @name: name of the subnode to locate
1006 * @namelen: number of characters of name to consider
1007 *
1008 * Identical to fdt_add_subnode(), but use only the first namelen
1009 * characters of name as the name of the new node. This is useful for
1010 * creating subnodes based on a portion of a larger string, such as a
1011 * full path.
1012 */
710int fdt_add_subnode_namelen(void *fdt, int parentoffset, 1013int fdt_add_subnode_namelen(void *fdt, int parentoffset,
711 const char *name, int namelen); 1014 const char *name, int namelen);
1015
1016/**
1017 * fdt_add_subnode - creates a new node
1018 * @fdt: pointer to the device tree blob
1019 * @parentoffset: structure block offset of a node
1020 * @name: name of the subnode to locate
1021 *
1022 * fdt_add_subnode() creates a new node as a subnode of the node at
1023 * structure block offset parentoffset, with the given name (which
1024 * should include the unit address, if any).
1025 *
1026 * This function will insert data into the blob, and will therefore
1027 * change the offsets of some existing nodes.
1028
1029 * returns:
1030 * structure block offset of the created nodeequested subnode (>=0), on success
1031 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
1032 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
1033 * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
1034 * the given name
1035 * -FDT_ERR_NOSPACE, if there is insufficient free space in the
1036 * blob to contain the new node
1037 * -FDT_ERR_NOSPACE
1038 * -FDT_ERR_BADLAYOUT
1039 * -FDT_ERR_BADMAGIC,
1040 * -FDT_ERR_BADVERSION,
1041 * -FDT_ERR_BADSTATE,
1042 * -FDT_ERR_BADSTRUCTURE,
1043 * -FDT_ERR_TRUNCATED, standard meanings.
1044 */
712int fdt_add_subnode(void *fdt, int parentoffset, const char *name); 1045int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
1046
1047/**
1048 * fdt_del_node - delete a node (subtree)
1049 * @fdt: pointer to the device tree blob
1050 * @nodeoffset: offset of the node to nop
1051 *
1052 * fdt_del_node() will remove the given node, including all its
1053 * subnodes if any, from the blob.
1054 *
1055 * This function will delete data from the blob, and will therefore
1056 * change the offsets of some existing nodes.
1057 *
1058 * returns:
1059 * 0, on success
1060 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1061 * -FDT_ERR_BADLAYOUT,
1062 * -FDT_ERR_BADMAGIC,
1063 * -FDT_ERR_BADVERSION,
1064 * -FDT_ERR_BADSTATE,
1065 * -FDT_ERR_BADSTRUCTURE,
1066 * -FDT_ERR_TRUNCATED, standard meanings
1067 */
713int fdt_del_node(void *fdt, int nodeoffset); 1068int fdt_del_node(void *fdt, int nodeoffset);
714 1069
715/**********************************************************************/ 1070/**********************************************************************/
diff --git a/arch/powerpc/boot/libfdt/libfdt_internal.h b/arch/powerpc/boot/libfdt/libfdt_internal.h
index 1e60936beb5b..46eb93e4af5c 100644
--- a/arch/powerpc/boot/libfdt/libfdt_internal.h
+++ b/arch/powerpc/boot/libfdt/libfdt_internal.h
@@ -52,38 +52,44 @@
52 */ 52 */
53#include <fdt.h> 53#include <fdt.h>
54 54
55#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) 55#define FDT_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
56#define PALIGN(p, a) ((void *)ALIGN((unsigned long)(p), (a))) 56#define FDT_TAGALIGN(x) (FDT_ALIGN((x), FDT_TAGSIZE))
57 57
58#define memeq(p, q, n) (memcmp((p), (q), (n)) == 0) 58#define FDT_CHECK_HEADER(fdt) \
59#define streq(p, q) (strcmp((p), (q)) == 0) 59 { \
60 int err; \
61 if ((err = fdt_check_header(fdt)) != 0) \
62 return err; \
63 }
60 64
61uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset); 65uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset);
66int _fdt_check_node_offset(const void *fdt, int offset);
62const char *_fdt_find_string(const char *strtab, int tabsize, const char *s); 67const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
63int _fdt_node_end_offset(void *fdt, int nodeoffset); 68int _fdt_node_end_offset(void *fdt, int nodeoffset);
64 69
65static inline const void *_fdt_offset_ptr(const void *fdt, int offset) 70static inline const void *_fdt_offset_ptr(const void *fdt, int offset)
66{ 71{
67 return fdt + fdt_off_dt_struct(fdt) + offset; 72 return (const char *)fdt + fdt_off_dt_struct(fdt) + offset;
68} 73}
69 74
70static inline void *_fdt_offset_ptr_w(void *fdt, int offset) 75static inline void *_fdt_offset_ptr_w(void *fdt, int offset)
71{ 76{
72 return (void *)_fdt_offset_ptr(fdt, offset); 77 return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset);
73} 78}
74 79
75static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n) 80static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n)
76{ 81{
77 const struct fdt_reserve_entry *rsv_table = 82 const struct fdt_reserve_entry *rsv_table =
78 fdt + fdt_off_mem_rsvmap(fdt); 83 (const struct fdt_reserve_entry *)
84 ((const char *)fdt + fdt_off_mem_rsvmap(fdt));
79 85
80 return rsv_table + n; 86 return rsv_table + n;
81} 87}
82static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n) 88static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
83{ 89{
84 return (void *)_fdt_mem_rsv(fdt, n); 90 return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n);
85} 91}
86 92
87#define SW_MAGIC (~FDT_MAGIC) 93#define FDT_SW_MAGIC (~FDT_MAGIC)
88 94
89#endif /* _LIBFDT_INTERNAL_H */ 95#endif /* _LIBFDT_INTERNAL_H */
diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h
index a4b0fc959ece..c89fdb1b80e1 100644
--- a/arch/powerpc/boot/libfdt_env.h
+++ b/arch/powerpc/boot/libfdt_env.h
@@ -6,6 +6,7 @@
6 6
7typedef u32 uint32_t; 7typedef u32 uint32_t;
8typedef u64 uint64_t; 8typedef u64 uint64_t;
9typedef unsigned long uintptr_t;
9 10
10#define fdt16_to_cpu(x) (x) 11#define fdt16_to_cpu(x) (x)
11#define cpu_to_fdt16(x) (x) 12#define cpu_to_fdt16(x) (x)
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 965c237c122d..ee0dc41d7c56 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -307,7 +307,9 @@ fi
307# post-processing needed for some platforms 307# post-processing needed for some platforms
308case "$platform" in 308case "$platform" in
309pseries|chrp) 309pseries|chrp)
310 $objbin/addnote "$ofile" 310 ${CROSS}objcopy -O binary -j .fakeelf "$kernel" "$ofile".rpanote
311 $objbin/addnote "$ofile" "$ofile".rpanote
312 rm -r "$ofile".rpanote
311 ;; 313 ;;
312coff) 314coff)
313 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" 315 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
diff --git a/arch/powerpc/configs/44x/arches_defconfig b/arch/powerpc/configs/44x/arches_defconfig
new file mode 100644
index 000000000000..70f46078eb6a
--- /dev/null
+++ b/arch/powerpc/configs/44x/arches_defconfig
@@ -0,0 +1,767 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc5
4# Wed Oct 1 15:54:57 2008
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11# CONFIG_6xx is not set
12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set
15CONFIG_44x=y
16# CONFIG_E200 is not set
17CONFIG_PPC_FPU=y
18CONFIG_4xx=y
19CONFIG_BOOKE=y
20CONFIG_PTE_64BIT=y
21CONFIG_PHYS_64BIT=y
22# CONFIG_PPC_MM_SLICES is not set
23CONFIG_NOT_COHERENT_CACHE=y
24CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32
26CONFIG_PPC_MERGE=y
27CONFIG_MMU=y
28CONFIG_GENERIC_CMOS_UPDATE=y
29CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
34CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_HAVE_LATENCYTOP_SUPPORT=y
37CONFIG_LOCKDEP_SUPPORT=y
38CONFIG_RWSEM_XCHGADD_ALGORITHM=y
39CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y
43# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
44CONFIG_PPC=y
45CONFIG_EARLY_PRINTK=y
46CONFIG_GENERIC_NVRAM=y
47CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
48CONFIG_ARCH_MAY_HAVE_PC_FDC=y
49CONFIG_PPC_OF=y
50CONFIG_OF=y
51CONFIG_PPC_UDBG_16550=y
52# CONFIG_GENERIC_TBSYNC is not set
53CONFIG_AUDIT_ARCH=y
54CONFIG_GENERIC_BUG=y
55# CONFIG_DEFAULT_UIMAGE is not set
56CONFIG_PPC_DCR_NATIVE=y
57# CONFIG_PPC_DCR_MMIO is not set
58CONFIG_PPC_DCR=y
59CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
60
61#
62# General setup
63#
64CONFIG_EXPERIMENTAL=y
65CONFIG_BROKEN_ON_SMP=y
66CONFIG_INIT_ENV_ARG_LIMIT=32
67CONFIG_LOCALVERSION=""
68CONFIG_LOCALVERSION_AUTO=y
69CONFIG_SWAP=y
70CONFIG_SYSVIPC=y
71CONFIG_SYSVIPC_SYSCTL=y
72CONFIG_POSIX_MQUEUE=y
73# CONFIG_BSD_PROCESS_ACCT is not set
74# CONFIG_TASKSTATS is not set
75# CONFIG_AUDIT is not set
76# CONFIG_IKCONFIG is not set
77CONFIG_LOG_BUF_SHIFT=14
78# CONFIG_CGROUPS is not set
79# CONFIG_GROUP_SCHED is not set
80CONFIG_SYSFS_DEPRECATED=y
81CONFIG_SYSFS_DEPRECATED_V2=y
82# CONFIG_RELAY is not set
83# CONFIG_NAMESPACES is not set
84CONFIG_BLK_DEV_INITRD=y
85CONFIG_INITRAMFS_SOURCE=""
86# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
87CONFIG_SYSCTL=y
88CONFIG_EMBEDDED=y
89CONFIG_SYSCTL_SYSCALL=y
90CONFIG_KALLSYMS=y
91# CONFIG_KALLSYMS_ALL is not set
92# CONFIG_KALLSYMS_EXTRA_PASS is not set
93CONFIG_HOTPLUG=y
94CONFIG_PRINTK=y
95CONFIG_BUG=y
96CONFIG_ELF_CORE=y
97CONFIG_COMPAT_BRK=y
98CONFIG_BASE_FULL=y
99CONFIG_FUTEX=y
100CONFIG_ANON_INODES=y
101CONFIG_EPOLL=y
102CONFIG_SIGNALFD=y
103CONFIG_TIMERFD=y
104CONFIG_EVENTFD=y
105CONFIG_SHMEM=y
106CONFIG_VM_EVENT_COUNTERS=y
107CONFIG_SLUB_DEBUG=y
108# CONFIG_SLAB is not set
109CONFIG_SLUB=y
110# CONFIG_SLOB is not set
111# CONFIG_PROFILING is not set
112# CONFIG_MARKERS is not set
113CONFIG_HAVE_OPROFILE=y
114# CONFIG_KPROBES is not set
115CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
116CONFIG_HAVE_IOREMAP_PROT=y
117CONFIG_HAVE_KPROBES=y
118CONFIG_HAVE_KRETPROBES=y
119CONFIG_HAVE_ARCH_TRACEHOOK=y
120# CONFIG_HAVE_DMA_ATTRS is not set
121# CONFIG_USE_GENERIC_SMP_HELPERS is not set
122# CONFIG_HAVE_CLK is not set
123CONFIG_PROC_PAGE_MONITOR=y
124# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
125CONFIG_SLABINFO=y
126CONFIG_RT_MUTEXES=y
127# CONFIG_TINY_SHMEM is not set
128CONFIG_BASE_SMALL=0
129CONFIG_MODULES=y
130# CONFIG_MODULE_FORCE_LOAD is not set
131CONFIG_MODULE_UNLOAD=y
132# CONFIG_MODULE_FORCE_UNLOAD is not set
133# CONFIG_MODVERSIONS is not set
134# CONFIG_MODULE_SRCVERSION_ALL is not set
135CONFIG_KMOD=y
136CONFIG_BLOCK=y
137CONFIG_LBD=y
138# CONFIG_BLK_DEV_IO_TRACE is not set
139# CONFIG_LSF is not set
140# CONFIG_BLK_DEV_BSG is not set
141# CONFIG_BLK_DEV_INTEGRITY is not set
142
143#
144# IO Schedulers
145#
146CONFIG_IOSCHED_NOOP=y
147CONFIG_IOSCHED_AS=y
148CONFIG_IOSCHED_DEADLINE=y
149CONFIG_IOSCHED_CFQ=y
150CONFIG_DEFAULT_AS=y
151# CONFIG_DEFAULT_DEADLINE is not set
152# CONFIG_DEFAULT_CFQ is not set
153# CONFIG_DEFAULT_NOOP is not set
154CONFIG_DEFAULT_IOSCHED="anticipatory"
155CONFIG_CLASSIC_RCU=y
156CONFIG_PPC4xx_PCI_EXPRESS=y
157
158#
159# Platform support
160#
161# CONFIG_PPC_CELL is not set
162# CONFIG_PPC_CELL_NATIVE is not set
163# CONFIG_PQ2ADS is not set
164# CONFIG_BAMBOO is not set
165# CONFIG_EBONY is not set
166# CONFIG_SAM440EP is not set
167# CONFIG_SEQUOIA is not set
168# CONFIG_TAISHAN is not set
169# CONFIG_KATMAI is not set
170# CONFIG_RAINIER is not set
171# CONFIG_WARP is not set
172CONFIG_ARCHES=y
173# CONFIG_CANYONLANDS is not set
174# CONFIG_GLACIER is not set
175# CONFIG_YOSEMITE is not set
176# CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
177CONFIG_PPC44x_SIMPLE=y
178CONFIG_460EX=y
179# CONFIG_IPIC is not set
180# CONFIG_MPIC is not set
181# CONFIG_MPIC_WEIRD is not set
182# CONFIG_PPC_I8259 is not set
183# CONFIG_PPC_RTAS is not set
184# CONFIG_MMIO_NVRAM is not set
185# CONFIG_PPC_MPC106 is not set
186# CONFIG_PPC_970_NAP is not set
187# CONFIG_PPC_INDIRECT_IO is not set
188# CONFIG_GENERIC_IOMAP is not set
189# CONFIG_CPU_FREQ is not set
190# CONFIG_FSL_ULI1575 is not set
191
192#
193# Kernel options
194#
195# CONFIG_HIGHMEM is not set
196CONFIG_TICK_ONESHOT=y
197CONFIG_NO_HZ=y
198CONFIG_HIGH_RES_TIMERS=y
199CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
200# CONFIG_HZ_100 is not set
201CONFIG_HZ_250=y
202# CONFIG_HZ_300 is not set
203# CONFIG_HZ_1000 is not set
204CONFIG_HZ=250
205CONFIG_SCHED_HRTICK=y
206CONFIG_PREEMPT_NONE=y
207# CONFIG_PREEMPT_VOLUNTARY is not set
208# CONFIG_PREEMPT is not set
209CONFIG_BINFMT_ELF=y
210# CONFIG_BINFMT_MISC is not set
211# CONFIG_MATH_EMULATION is not set
212# CONFIG_IOMMU_HELPER is not set
213CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
214CONFIG_ARCH_HAS_WALK_MEMORY=y
215CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
216CONFIG_ARCH_FLATMEM_ENABLE=y
217CONFIG_ARCH_POPULATES_NODE_MAP=y
218CONFIG_SELECT_MEMORY_MODEL=y
219CONFIG_FLATMEM_MANUAL=y
220# CONFIG_DISCONTIGMEM_MANUAL is not set
221# CONFIG_SPARSEMEM_MANUAL is not set
222CONFIG_FLATMEM=y
223CONFIG_FLAT_NODE_MEM_MAP=y
224# CONFIG_SPARSEMEM_STATIC is not set
225# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
226CONFIG_PAGEFLAGS_EXTENDED=y
227CONFIG_SPLIT_PTLOCK_CPUS=4
228CONFIG_MIGRATION=y
229CONFIG_RESOURCES_64BIT=y
230CONFIG_ZONE_DMA_FLAG=1
231CONFIG_BOUNCE=y
232CONFIG_VIRT_TO_BUS=y
233CONFIG_FORCE_MAX_ZONEORDER=11
234CONFIG_PROC_DEVICETREE=y
235CONFIG_CMDLINE_BOOL=y
236CONFIG_CMDLINE=""
237CONFIG_EXTRA_TARGETS=""
238CONFIG_SECCOMP=y
239CONFIG_ISA_DMA_API=y
240
241#
242# Bus options
243#
244CONFIG_ZONE_DMA=y
245CONFIG_PPC_INDIRECT_PCI=y
246CONFIG_4xx_SOC=y
247CONFIG_PPC_PCI_CHOICE=y
248CONFIG_PCI=y
249CONFIG_PCI_DOMAINS=y
250CONFIG_PCI_SYSCALL=y
251# CONFIG_PCIEPORTBUS is not set
252CONFIG_ARCH_SUPPORTS_MSI=y
253# CONFIG_PCI_MSI is not set
254CONFIG_PCI_LEGACY=y
255# CONFIG_PCI_DEBUG is not set
256# CONFIG_PCCARD is not set
257# CONFIG_HOTPLUG_PCI is not set
258# CONFIG_HAS_RAPIDIO is not set
259
260#
261# Advanced setup
262#
263# CONFIG_ADVANCED_OPTIONS is not set
264
265#
266# Default settings for advanced configuration options are used
267#
268CONFIG_LOWMEM_SIZE=0x30000000
269CONFIG_PAGE_OFFSET=0xc0000000
270CONFIG_KERNEL_START=0xc0000000
271CONFIG_PHYSICAL_START=0x00000000
272CONFIG_TASK_SIZE=0xc0000000
273CONFIG_CONSISTENT_START=0xff100000
274CONFIG_CONSISTENT_SIZE=0x00200000
275CONFIG_NET=y
276
277#
278# Networking options
279#
280CONFIG_PACKET=y
281# CONFIG_PACKET_MMAP is not set
282CONFIG_UNIX=y
283# CONFIG_NET_KEY is not set
284CONFIG_INET=y
285# CONFIG_IP_MULTICAST is not set
286# CONFIG_IP_ADVANCED_ROUTER is not set
287CONFIG_IP_FIB_HASH=y
288CONFIG_IP_PNP=y
289CONFIG_IP_PNP_DHCP=y
290CONFIG_IP_PNP_BOOTP=y
291# CONFIG_IP_PNP_RARP is not set
292# CONFIG_NET_IPIP is not set
293# CONFIG_NET_IPGRE is not set
294# CONFIG_ARPD is not set
295# CONFIG_SYN_COOKIES is not set
296# CONFIG_INET_AH is not set
297# CONFIG_INET_ESP is not set
298# CONFIG_INET_IPCOMP is not set
299# CONFIG_INET_XFRM_TUNNEL is not set
300# CONFIG_INET_TUNNEL is not set
301# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
302# CONFIG_INET_XFRM_MODE_TUNNEL is not set
303# CONFIG_INET_XFRM_MODE_BEET is not set
304# CONFIG_INET_LRO is not set
305CONFIG_INET_DIAG=y
306CONFIG_INET_TCP_DIAG=y
307# CONFIG_TCP_CONG_ADVANCED is not set
308CONFIG_TCP_CONG_CUBIC=y
309CONFIG_DEFAULT_TCP_CONG="cubic"
310# CONFIG_TCP_MD5SIG is not set
311# CONFIG_IPV6 is not set
312# CONFIG_NETWORK_SECMARK is not set
313# CONFIG_NETFILTER is not set
314# CONFIG_IP_DCCP is not set
315# CONFIG_IP_SCTP is not set
316# CONFIG_TIPC is not set
317# CONFIG_ATM is not set
318# CONFIG_BRIDGE is not set
319# CONFIG_VLAN_8021Q is not set
320# CONFIG_DECNET is not set
321# CONFIG_LLC2 is not set
322# CONFIG_IPX is not set
323# CONFIG_ATALK is not set
324# CONFIG_X25 is not set
325# CONFIG_LAPB is not set
326# CONFIG_ECONET is not set
327# CONFIG_WAN_ROUTER is not set
328# CONFIG_NET_SCHED is not set
329
330#
331# Network testing
332#
333# CONFIG_NET_PKTGEN is not set
334# CONFIG_HAMRADIO is not set
335# CONFIG_CAN is not set
336# CONFIG_IRDA is not set
337# CONFIG_BT is not set
338# CONFIG_AF_RXRPC is not set
339
340#
341# Wireless
342#
343# CONFIG_CFG80211 is not set
344# CONFIG_WIRELESS_EXT is not set
345# CONFIG_MAC80211 is not set
346# CONFIG_IEEE80211 is not set
347# CONFIG_RFKILL is not set
348# CONFIG_NET_9P is not set
349
350#
351# Device Drivers
352#
353
354#
355# Generic Driver Options
356#
357CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
358CONFIG_STANDALONE=y
359CONFIG_PREVENT_FIRMWARE_BUILD=y
360CONFIG_FW_LOADER=y
361CONFIG_FIRMWARE_IN_KERNEL=y
362CONFIG_EXTRA_FIRMWARE=""
363# CONFIG_DEBUG_DRIVER is not set
364# CONFIG_DEBUG_DEVRES is not set
365# CONFIG_SYS_HYPERVISOR is not set
366CONFIG_CONNECTOR=y
367CONFIG_PROC_EVENTS=y
368# CONFIG_MTD is not set
369CONFIG_OF_DEVICE=y
370# CONFIG_PARPORT is not set
371CONFIG_BLK_DEV=y
372# CONFIG_BLK_DEV_FD is not set
373# CONFIG_BLK_CPQ_DA is not set
374# CONFIG_BLK_CPQ_CISS_DA is not set
375# CONFIG_BLK_DEV_DAC960 is not set
376# CONFIG_BLK_DEV_UMEM is not set
377# CONFIG_BLK_DEV_COW_COMMON is not set
378# CONFIG_BLK_DEV_LOOP is not set
379# CONFIG_BLK_DEV_NBD is not set
380# CONFIG_BLK_DEV_SX8 is not set
381CONFIG_BLK_DEV_RAM=y
382CONFIG_BLK_DEV_RAM_COUNT=16
383CONFIG_BLK_DEV_RAM_SIZE=35000
384# CONFIG_BLK_DEV_XIP is not set
385# CONFIG_CDROM_PKTCDVD is not set
386# CONFIG_ATA_OVER_ETH is not set
387# CONFIG_XILINX_SYSACE is not set
388# CONFIG_BLK_DEV_HD is not set
389# CONFIG_MISC_DEVICES is not set
390CONFIG_HAVE_IDE=y
391# CONFIG_IDE is not set
392
393#
394# SCSI device support
395#
396# CONFIG_RAID_ATTRS is not set
397# CONFIG_SCSI is not set
398# CONFIG_SCSI_DMA is not set
399# CONFIG_SCSI_NETLINK is not set
400# CONFIG_ATA is not set
401# CONFIG_MD is not set
402# CONFIG_FUSION is not set
403
404#
405# IEEE 1394 (FireWire) support
406#
407
408#
409# Enable only one of the two stacks, unless you know what you are doing
410#
411# CONFIG_FIREWIRE is not set
412# CONFIG_IEEE1394 is not set
413# CONFIG_I2O is not set
414# CONFIG_MACINTOSH_DRIVERS is not set
415CONFIG_NETDEVICES=y
416# CONFIG_DUMMY is not set
417# CONFIG_BONDING is not set
418# CONFIG_MACVLAN is not set
419# CONFIG_EQUALIZER is not set
420# CONFIG_TUN is not set
421# CONFIG_VETH is not set
422# CONFIG_ARCNET is not set
423# CONFIG_PHYLIB is not set
424CONFIG_NET_ETHERNET=y
425# CONFIG_MII is not set
426# CONFIG_HAPPYMEAL is not set
427# CONFIG_SUNGEM is not set
428# CONFIG_CASSINI is not set
429# CONFIG_NET_VENDOR_3COM is not set
430# CONFIG_NET_TULIP is not set
431# CONFIG_HP100 is not set
432CONFIG_IBM_NEW_EMAC=y
433CONFIG_IBM_NEW_EMAC_RXB=256
434CONFIG_IBM_NEW_EMAC_TXB=256
435CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32
436CONFIG_IBM_NEW_EMAC_RX_COPY_THRESHOLD=256
437CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0
438# CONFIG_IBM_NEW_EMAC_DEBUG is not set
439# CONFIG_IBM_NEW_EMAC_ZMII is not set
440# CONFIG_IBM_NEW_EMAC_RGMII is not set
441CONFIG_IBM_NEW_EMAC_TAH=y
442CONFIG_IBM_NEW_EMAC_EMAC4=y
443# CONFIG_NET_PCI is not set
444# CONFIG_B44 is not set
445# CONFIG_NETDEV_1000 is not set
446# CONFIG_NETDEV_10000 is not set
447# CONFIG_TR is not set
448
449#
450# Wireless LAN
451#
452# CONFIG_WLAN_PRE80211 is not set
453# CONFIG_WLAN_80211 is not set
454# CONFIG_IWLWIFI_LEDS is not set
455# CONFIG_WAN is not set
456# CONFIG_FDDI is not set
457# CONFIG_HIPPI is not set
458# CONFIG_PPP is not set
459# CONFIG_SLIP is not set
460# CONFIG_NETCONSOLE is not set
461# CONFIG_NETPOLL is not set
462# CONFIG_NET_POLL_CONTROLLER is not set
463# CONFIG_ISDN is not set
464# CONFIG_PHONE is not set
465
466#
467# Input device support
468#
469# CONFIG_INPUT is not set
470
471#
472# Hardware I/O ports
473#
474# CONFIG_SERIO is not set
475# CONFIG_GAMEPORT is not set
476
477#
478# Character devices
479#
480# CONFIG_VT is not set
481CONFIG_DEVKMEM=y
482# CONFIG_SERIAL_NONSTANDARD is not set
483# CONFIG_NOZOMI is not set
484
485#
486# Serial drivers
487#
488CONFIG_SERIAL_8250=y
489CONFIG_SERIAL_8250_CONSOLE=y
490# CONFIG_SERIAL_8250_PCI is not set
491CONFIG_SERIAL_8250_NR_UARTS=4
492CONFIG_SERIAL_8250_RUNTIME_UARTS=4
493CONFIG_SERIAL_8250_EXTENDED=y
494# CONFIG_SERIAL_8250_MANY_PORTS is not set
495CONFIG_SERIAL_8250_SHARE_IRQ=y
496# CONFIG_SERIAL_8250_DETECT_IRQ is not set
497# CONFIG_SERIAL_8250_RSA is not set
498
499#
500# Non-8250 serial port support
501#
502# CONFIG_SERIAL_UARTLITE is not set
503CONFIG_SERIAL_CORE=y
504CONFIG_SERIAL_CORE_CONSOLE=y
505# CONFIG_SERIAL_JSM is not set
506CONFIG_SERIAL_OF_PLATFORM=y
507CONFIG_UNIX98_PTYS=y
508CONFIG_LEGACY_PTYS=y
509CONFIG_LEGACY_PTY_COUNT=256
510# CONFIG_IPMI_HANDLER is not set
511# CONFIG_HW_RANDOM is not set
512# CONFIG_NVRAM is not set
513# CONFIG_GEN_RTC is not set
514# CONFIG_R3964 is not set
515# CONFIG_APPLICOM is not set
516# CONFIG_RAW_DRIVER is not set
517# CONFIG_TCG_TPM is not set
518CONFIG_DEVPORT=y
519# CONFIG_I2C is not set
520# CONFIG_SPI is not set
521CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
522# CONFIG_GPIOLIB is not set
523# CONFIG_W1 is not set
524# CONFIG_POWER_SUPPLY is not set
525# CONFIG_HWMON is not set
526# CONFIG_THERMAL is not set
527# CONFIG_THERMAL_HWMON is not set
528# CONFIG_WATCHDOG is not set
529
530#
531# Sonics Silicon Backplane
532#
533CONFIG_SSB_POSSIBLE=y
534# CONFIG_SSB is not set
535
536#
537# Multifunction device drivers
538#
539# CONFIG_MFD_CORE is not set
540# CONFIG_MFD_SM501 is not set
541# CONFIG_HTC_PASIC3 is not set
542# CONFIG_MFD_TMIO is not set
543
544#
545# Multimedia devices
546#
547
548#
549# Multimedia core support
550#
551# CONFIG_VIDEO_DEV is not set
552# CONFIG_DVB_CORE is not set
553# CONFIG_VIDEO_MEDIA is not set
554
555#
556# Multimedia drivers
557#
558CONFIG_DAB=y
559
560#
561# Graphics support
562#
563# CONFIG_AGP is not set
564# CONFIG_DRM is not set
565# CONFIG_VGASTATE is not set
566CONFIG_VIDEO_OUTPUT_CONTROL=m
567# CONFIG_FB is not set
568# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
569
570#
571# Display device support
572#
573# CONFIG_DISPLAY_SUPPORT is not set
574# CONFIG_SOUND is not set
575# CONFIG_USB_SUPPORT is not set
576# CONFIG_MMC is not set
577# CONFIG_MEMSTICK is not set
578# CONFIG_NEW_LEDS is not set
579# CONFIG_ACCESSIBILITY is not set
580# CONFIG_INFINIBAND is not set
581# CONFIG_EDAC is not set
582# CONFIG_RTC_CLASS is not set
583# CONFIG_DMADEVICES is not set
584# CONFIG_UIO is not set
585
586#
587# File systems
588#
589CONFIG_EXT2_FS=y
590# CONFIG_EXT2_FS_XATTR is not set
591# CONFIG_EXT2_FS_XIP is not set
592# CONFIG_EXT3_FS is not set
593# CONFIG_EXT4DEV_FS is not set
594# CONFIG_REISERFS_FS is not set
595# CONFIG_JFS_FS is not set
596# CONFIG_FS_POSIX_ACL is not set
597# CONFIG_XFS_FS is not set
598# CONFIG_OCFS2_FS is not set
599CONFIG_DNOTIFY=y
600CONFIG_INOTIFY=y
601CONFIG_INOTIFY_USER=y
602# CONFIG_QUOTA is not set
603# CONFIG_AUTOFS_FS is not set
604# CONFIG_AUTOFS4_FS is not set
605# CONFIG_FUSE_FS is not set
606
607#
608# CD-ROM/DVD Filesystems
609#
610# CONFIG_ISO9660_FS is not set
611# CONFIG_UDF_FS is not set
612
613#
614# DOS/FAT/NT Filesystems
615#
616# CONFIG_MSDOS_FS is not set
617# CONFIG_VFAT_FS is not set
618# CONFIG_NTFS_FS is not set
619
620#
621# Pseudo filesystems
622#
623CONFIG_PROC_FS=y
624CONFIG_PROC_KCORE=y
625CONFIG_PROC_SYSCTL=y
626CONFIG_SYSFS=y
627CONFIG_TMPFS=y
628# CONFIG_TMPFS_POSIX_ACL is not set
629# CONFIG_HUGETLB_PAGE is not set
630# CONFIG_CONFIGFS_FS is not set
631
632#
633# Miscellaneous filesystems
634#
635# CONFIG_ADFS_FS is not set
636# CONFIG_AFFS_FS is not set
637# CONFIG_HFS_FS is not set
638# CONFIG_HFSPLUS_FS is not set
639# CONFIG_BEFS_FS is not set
640# CONFIG_BFS_FS is not set
641# CONFIG_EFS_FS is not set
642CONFIG_CRAMFS=y
643# CONFIG_VXFS_FS is not set
644# CONFIG_MINIX_FS is not set
645# CONFIG_OMFS_FS is not set
646# CONFIG_HPFS_FS is not set
647# CONFIG_QNX4FS_FS is not set
648# CONFIG_ROMFS_FS is not set
649# CONFIG_SYSV_FS is not set
650# CONFIG_UFS_FS is not set
651CONFIG_NETWORK_FILESYSTEMS=y
652CONFIG_NFS_FS=y
653CONFIG_NFS_V3=y
654# CONFIG_NFS_V3_ACL is not set
655# CONFIG_NFS_V4 is not set
656CONFIG_ROOT_NFS=y
657# CONFIG_NFSD is not set
658CONFIG_LOCKD=y
659CONFIG_LOCKD_V4=y
660CONFIG_NFS_COMMON=y
661CONFIG_SUNRPC=y
662# CONFIG_RPCSEC_GSS_KRB5 is not set
663# CONFIG_RPCSEC_GSS_SPKM3 is not set
664# CONFIG_SMB_FS is not set
665# CONFIG_CIFS is not set
666# CONFIG_NCP_FS is not set
667# CONFIG_CODA_FS is not set
668# CONFIG_AFS_FS is not set
669
670#
671# Partition Types
672#
673# CONFIG_PARTITION_ADVANCED is not set
674CONFIG_MSDOS_PARTITION=y
675# CONFIG_NLS is not set
676# CONFIG_DLM is not set
677
678#
679# Library routines
680#
681CONFIG_BITREVERSE=y
682# CONFIG_GENERIC_FIND_FIRST_BIT is not set
683# CONFIG_CRC_CCITT is not set
684# CONFIG_CRC16 is not set
685# CONFIG_CRC_T10DIF is not set
686# CONFIG_CRC_ITU_T is not set
687CONFIG_CRC32=y
688# CONFIG_CRC7 is not set
689# CONFIG_LIBCRC32C is not set
690CONFIG_ZLIB_INFLATE=y
691CONFIG_PLIST=y
692CONFIG_HAS_IOMEM=y
693CONFIG_HAS_IOPORT=y
694CONFIG_HAS_DMA=y
695CONFIG_HAVE_LMB=y
696
697#
698# Kernel hacking
699#
700# CONFIG_PRINTK_TIME is not set
701CONFIG_ENABLE_WARN_DEPRECATED=y
702CONFIG_ENABLE_MUST_CHECK=y
703CONFIG_FRAME_WARN=1024
704CONFIG_MAGIC_SYSRQ=y
705# CONFIG_UNUSED_SYMBOLS is not set
706CONFIG_DEBUG_FS=y
707# CONFIG_HEADERS_CHECK is not set
708CONFIG_DEBUG_KERNEL=y
709# CONFIG_DEBUG_SHIRQ is not set
710CONFIG_DETECT_SOFTLOCKUP=y
711# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
712CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
713CONFIG_SCHED_DEBUG=y
714# CONFIG_SCHEDSTATS is not set
715# CONFIG_TIMER_STATS is not set
716# CONFIG_DEBUG_OBJECTS is not set
717# CONFIG_SLUB_DEBUG_ON is not set
718# CONFIG_SLUB_STATS is not set
719# CONFIG_DEBUG_RT_MUTEXES is not set
720# CONFIG_RT_MUTEX_TESTER is not set
721# CONFIG_DEBUG_SPINLOCK is not set
722# CONFIG_DEBUG_MUTEXES is not set
723# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
724# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
725# CONFIG_DEBUG_KOBJECT is not set
726# CONFIG_DEBUG_BUGVERBOSE is not set
727# CONFIG_DEBUG_INFO is not set
728# CONFIG_DEBUG_VM is not set
729# CONFIG_DEBUG_WRITECOUNT is not set
730# CONFIG_DEBUG_MEMORY_INIT is not set
731# CONFIG_DEBUG_LIST is not set
732# CONFIG_DEBUG_SG is not set
733# CONFIG_BOOT_PRINTK_DELAY is not set
734# CONFIG_RCU_TORTURE_TEST is not set
735# CONFIG_BACKTRACE_SELF_TEST is not set
736# CONFIG_FAULT_INJECTION is not set
737# CONFIG_LATENCYTOP is not set
738CONFIG_SYSCTL_SYSCALL_CHECK=y
739CONFIG_HAVE_FTRACE=y
740CONFIG_HAVE_DYNAMIC_FTRACE=y
741# CONFIG_FTRACE is not set
742# CONFIG_SCHED_TRACER is not set
743# CONFIG_CONTEXT_SWITCH_TRACER is not set
744# CONFIG_SAMPLES is not set
745CONFIG_HAVE_ARCH_KGDB=y
746# CONFIG_KGDB is not set
747# CONFIG_DEBUG_STACKOVERFLOW is not set
748# CONFIG_DEBUG_STACK_USAGE is not set
749# CONFIG_DEBUG_PAGEALLOC is not set
750# CONFIG_CODE_PATCHING_SELFTEST is not set
751# CONFIG_FTR_FIXUP_SELFTEST is not set
752# CONFIG_MSI_BITMAP_SELFTEST is not set
753# CONFIG_XMON is not set
754# CONFIG_IRQSTACKS is not set
755# CONFIG_VIRQ_DEBUG is not set
756# CONFIG_BDI_SWITCH is not set
757# CONFIG_PPC_EARLY_DEBUG is not set
758
759#
760# Security options
761#
762# CONFIG_KEYS is not set
763# CONFIG_SECURITY is not set
764# CONFIG_SECURITY_FILE_CAPABILITIES is not set
765# CONFIG_CRYPTO is not set
766# CONFIG_PPC_CLOCK is not set
767# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/83xx/asp8347_defconfig b/arch/powerpc/configs/83xx/asp8347_defconfig
index 5e6780a088ce..0b1fa20f745c 100644
--- a/arch/powerpc/configs/83xx/asp8347_defconfig
+++ b/arch/powerpc/configs/83xx/asp8347_defconfig
@@ -164,11 +164,11 @@ CONFIG_CLASSIC_RCU=y
164# 164#
165CONFIG_PPC_MULTIPLATFORM=y 165CONFIG_PPC_MULTIPLATFORM=y
166CONFIG_CLASSIC32=y 166CONFIG_CLASSIC32=y
167CONFIG_PPC_CHRP=y 167# CONFIG_PPC_CHRP is not set
168# CONFIG_PPC_PMAC is not set
168# CONFIG_MPC5121_ADS is not set 169# CONFIG_MPC5121_ADS is not set
169# CONFIG_MPC5121_GENERIC is not set 170# CONFIG_MPC5121_GENERIC is not set
170# CONFIG_PPC_MPC52xx is not set 171# CONFIG_PPC_MPC52xx is not set
171CONFIG_PPC_PMAC=y
172# CONFIG_PPC_CELL is not set 172# CONFIG_PPC_CELL is not set
173# CONFIG_PPC_CELL_NATIVE is not set 173# CONFIG_PPC_CELL_NATIVE is not set
174# CONFIG_PPC_82xx is not set 174# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig b/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
index 2028337868b4..b7eae2bdf19c 100644
--- a/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
@@ -163,11 +163,11 @@ CONFIG_CLASSIC_RCU=y
163# 163#
164CONFIG_PPC_MULTIPLATFORM=y 164CONFIG_PPC_MULTIPLATFORM=y
165CONFIG_CLASSIC32=y 165CONFIG_CLASSIC32=y
166CONFIG_PPC_CHRP=y 166# CONFIG_PPC_CHRP is not set
167# CONFIG_PPC_PMAC is not set
167# CONFIG_MPC5121_ADS is not set 168# CONFIG_MPC5121_ADS is not set
168# CONFIG_MPC5121_GENERIC is not set 169# CONFIG_MPC5121_GENERIC is not set
169# CONFIG_PPC_MPC52xx is not set 170# CONFIG_PPC_MPC52xx is not set
170CONFIG_PPC_PMAC=y
171# CONFIG_PPC_CELL is not set 171# CONFIG_PPC_CELL is not set
172# CONFIG_PPC_CELL_NATIVE is not set 172# CONFIG_PPC_CELL_NATIVE is not set
173# CONFIG_PPC_82xx is not set 173# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig b/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
index dd80eb0a87a1..b0a27a67d8c7 100644
--- a/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
@@ -163,11 +163,11 @@ CONFIG_CLASSIC_RCU=y
163# 163#
164CONFIG_PPC_MULTIPLATFORM=y 164CONFIG_PPC_MULTIPLATFORM=y
165CONFIG_CLASSIC32=y 165CONFIG_CLASSIC32=y
166CONFIG_PPC_CHRP=y 166# CONFIG_PPC_CHRP is not set
167# CONFIG_PPC_PMAC is not set
167# CONFIG_MPC5121_ADS is not set 168# CONFIG_MPC5121_ADS is not set
168# CONFIG_MPC5121_GENERIC is not set 169# CONFIG_MPC5121_GENERIC is not set
169# CONFIG_PPC_MPC52xx is not set 170# CONFIG_PPC_MPC52xx is not set
170CONFIG_PPC_PMAC=y
171# CONFIG_PPC_CELL is not set 171# CONFIG_PPC_CELL is not set
172# CONFIG_PPC_CELL_NATIVE is not set 172# CONFIG_PPC_CELL_NATIVE is not set
173# CONFIG_PPC_82xx is not set 173# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc832x_mds_defconfig b/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
index bdf50c8a17e6..ad825bcddd1f 100644
--- a/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
@@ -163,11 +163,11 @@ CONFIG_CLASSIC_RCU=y
163# 163#
164CONFIG_PPC_MULTIPLATFORM=y 164CONFIG_PPC_MULTIPLATFORM=y
165CONFIG_CLASSIC32=y 165CONFIG_CLASSIC32=y
166CONFIG_PPC_CHRP=y 166# CONFIG_PPC_CHRP is not set
167# CONFIG_PPC_PMAC is not set
167# CONFIG_MPC5121_ADS is not set 168# CONFIG_MPC5121_ADS is not set
168# CONFIG_MPC5121_GENERIC is not set 169# CONFIG_MPC5121_GENERIC is not set
169# CONFIG_PPC_MPC52xx is not set 170# CONFIG_PPC_MPC52xx is not set
170CONFIG_PPC_PMAC=y
171# CONFIG_PPC_CELL is not set 171# CONFIG_PPC_CELL is not set
172# CONFIG_PPC_CELL_NATIVE is not set 172# CONFIG_PPC_CELL_NATIVE is not set
173# CONFIG_PPC_82xx is not set 173# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig b/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
index 4eef8c95480e..38267501f44d 100644
--- a/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
@@ -163,11 +163,11 @@ CONFIG_CLASSIC_RCU=y
163# 163#
164CONFIG_PPC_MULTIPLATFORM=y 164CONFIG_PPC_MULTIPLATFORM=y
165CONFIG_CLASSIC32=y 165CONFIG_CLASSIC32=y
166CONFIG_PPC_CHRP=y 166# CONFIG_PPC_CHRP is not set
167# CONFIG_PPC_PMAC is not set
167# CONFIG_MPC5121_ADS is not set 168# CONFIG_MPC5121_ADS is not set
168# CONFIG_MPC5121_GENERIC is not set 169# CONFIG_MPC5121_GENERIC is not set
169# CONFIG_PPC_MPC52xx is not set 170# CONFIG_PPC_MPC52xx is not set
170CONFIG_PPC_PMAC=y
171# CONFIG_PPC_CELL is not set 171# CONFIG_PPC_CELL is not set
172# CONFIG_PPC_CELL_NATIVE is not set 172# CONFIG_PPC_CELL_NATIVE is not set
173# CONFIG_PPC_82xx is not set 173# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc834x_itx_defconfig b/arch/powerpc/configs/83xx/mpc834x_itx_defconfig
index 8d6513931850..90aab340e7ff 100644
--- a/arch/powerpc/configs/83xx/mpc834x_itx_defconfig
+++ b/arch/powerpc/configs/83xx/mpc834x_itx_defconfig
@@ -163,11 +163,11 @@ CONFIG_CLASSIC_RCU=y
163# 163#
164CONFIG_PPC_MULTIPLATFORM=y 164CONFIG_PPC_MULTIPLATFORM=y
165CONFIG_CLASSIC32=y 165CONFIG_CLASSIC32=y
166CONFIG_PPC_CHRP=y 166# CONFIG_PPC_CHRP is not set
167# CONFIG_PPC_PMAC is not set
167# CONFIG_MPC5121_ADS is not set 168# CONFIG_MPC5121_ADS is not set
168# CONFIG_MPC5121_GENERIC is not set 169# CONFIG_MPC5121_GENERIC is not set
169# CONFIG_PPC_MPC52xx is not set 170# CONFIG_PPC_MPC52xx is not set
170CONFIG_PPC_PMAC=y
171# CONFIG_PPC_CELL is not set 171# CONFIG_PPC_CELL is not set
172# CONFIG_PPC_CELL_NATIVE is not set 172# CONFIG_PPC_CELL_NATIVE is not set
173# CONFIG_PPC_82xx is not set 173# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig b/arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig
index a8afa39d6f76..7458a242d251 100644
--- a/arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig
+++ b/arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig
@@ -163,11 +163,11 @@ CONFIG_CLASSIC_RCU=y
163# 163#
164CONFIG_PPC_MULTIPLATFORM=y 164CONFIG_PPC_MULTIPLATFORM=y
165CONFIG_CLASSIC32=y 165CONFIG_CLASSIC32=y
166CONFIG_PPC_CHRP=y 166# CONFIG_PPC_CHRP is not set
167# CONFIG_PPC_PMAC is not set
167# CONFIG_MPC5121_ADS is not set 168# CONFIG_MPC5121_ADS is not set
168# CONFIG_MPC5121_GENERIC is not set 169# CONFIG_MPC5121_GENERIC is not set
169# CONFIG_PPC_MPC52xx is not set 170# CONFIG_PPC_MPC52xx is not set
170CONFIG_PPC_PMAC=y
171# CONFIG_PPC_CELL is not set 171# CONFIG_PPC_CELL is not set
172# CONFIG_PPC_CELL_NATIVE is not set 172# CONFIG_PPC_CELL_NATIVE is not set
173# CONFIG_PPC_82xx is not set 173# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc834x_mds_defconfig b/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
index 24c320a36670..1a92798938cf 100644
--- a/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
@@ -163,11 +163,11 @@ CONFIG_CLASSIC_RCU=y
163# 163#
164CONFIG_PPC_MULTIPLATFORM=y 164CONFIG_PPC_MULTIPLATFORM=y
165CONFIG_CLASSIC32=y 165CONFIG_CLASSIC32=y
166CONFIG_PPC_CHRP=y 166# CONFIG_PPC_CHRP is not set
167# CONFIG_PPC_PMAC is not set
167# CONFIG_MPC5121_ADS is not set 168# CONFIG_MPC5121_ADS is not set
168# CONFIG_MPC5121_GENERIC is not set 169# CONFIG_MPC5121_GENERIC is not set
169# CONFIG_PPC_MPC52xx is not set 170# CONFIG_PPC_MPC52xx is not set
170CONFIG_PPC_PMAC=y
171# CONFIG_PPC_CELL is not set 171# CONFIG_PPC_CELL is not set
172# CONFIG_PPC_CELL_NATIVE is not set 172# CONFIG_PPC_CELL_NATIVE is not set
173# CONFIG_PPC_82xx is not set 173# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc836x_mds_defconfig b/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
index e029e9e14622..03d8cede0272 100644
--- a/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
@@ -163,11 +163,11 @@ CONFIG_CLASSIC_RCU=y
163# 163#
164CONFIG_PPC_MULTIPLATFORM=y 164CONFIG_PPC_MULTIPLATFORM=y
165CONFIG_CLASSIC32=y 165CONFIG_CLASSIC32=y
166CONFIG_PPC_CHRP=y 166# CONFIG_PPC_CHRP is not set
167# CONFIG_PPC_PMAC is not set
167# CONFIG_MPC5121_ADS is not set 168# CONFIG_MPC5121_ADS is not set
168# CONFIG_MPC5121_GENERIC is not set 169# CONFIG_MPC5121_GENERIC is not set
169# CONFIG_PPC_MPC52xx is not set 170# CONFIG_PPC_MPC52xx is not set
170CONFIG_PPC_PMAC=y
171# CONFIG_PPC_CELL is not set 171# CONFIG_PPC_CELL is not set
172# CONFIG_PPC_CELL_NATIVE is not set 172# CONFIG_PPC_CELL_NATIVE is not set
173# CONFIG_PPC_82xx is not set 173# CONFIG_PPC_82xx is not set
@@ -383,7 +383,84 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
383# CONFIG_FW_LOADER is not set 383# CONFIG_FW_LOADER is not set
384# CONFIG_SYS_HYPERVISOR is not set 384# CONFIG_SYS_HYPERVISOR is not set
385# CONFIG_CONNECTOR is not set 385# CONFIG_CONNECTOR is not set
386# CONFIG_MTD is not set 386CONFIG_MTD=y
387# CONFIG_MTD_DEBUG is not set
388# CONFIG_MTD_CONCAT is not set
389CONFIG_MTD_PARTITIONS=y
390# CONFIG_MTD_REDBOOT_PARTS is not set
391CONFIG_MTD_CMDLINE_PARTS=y
392# CONFIG_MTD_OF_PARTS is not set
393# CONFIG_MTD_AR7_PARTS is not set
394
395#
396# User Modules And Translation Layers
397#
398CONFIG_MTD_CHAR=y
399CONFIG_MTD_BLKDEVS=y
400CONFIG_MTD_BLOCK=y
401# CONFIG_FTL is not set
402# CONFIG_NFTL is not set
403# CONFIG_INFTL is not set
404# CONFIG_RFD_FTL is not set
405# CONFIG_SSFDC is not set
406# CONFIG_MTD_OOPS is not set
407
408#
409# RAM/ROM/Flash chip drivers
410#
411CONFIG_MTD_CFI=y
412# CONFIG_MTD_JEDECPROBE is not set
413CONFIG_MTD_GEN_PROBE=y
414# CONFIG_MTD_CFI_ADV_OPTIONS is not set
415CONFIG_MTD_MAP_BANK_WIDTH_1=y
416CONFIG_MTD_MAP_BANK_WIDTH_2=y
417CONFIG_MTD_MAP_BANK_WIDTH_4=y
418# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
419# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
420# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
421CONFIG_MTD_CFI_I1=y
422CONFIG_MTD_CFI_I2=y
423# CONFIG_MTD_CFI_I4 is not set
424# CONFIG_MTD_CFI_I8 is not set
425# CONFIG_MTD_CFI_INTELEXT is not set
426CONFIG_MTD_CFI_AMDSTD=y
427# CONFIG_MTD_CFI_STAA is not set
428CONFIG_MTD_CFI_UTIL=y
429# CONFIG_MTD_RAM is not set
430# CONFIG_MTD_ROM is not set
431# CONFIG_MTD_ABSENT is not set
432
433#
434# Mapping drivers for chip access
435#
436# CONFIG_MTD_COMPLEX_MAPPINGS is not set
437# CONFIG_MTD_PHYSMAP is not set
438CONFIG_MTD_PHYSMAP_OF=y
439# CONFIG_MTD_INTEL_VR_NOR is not set
440# CONFIG_MTD_PLATRAM is not set
441
442#
443# Self-contained MTD device drivers
444#
445# CONFIG_MTD_PMC551 is not set
446# CONFIG_MTD_SLRAM is not set
447# CONFIG_MTD_PHRAM is not set
448# CONFIG_MTD_MTDRAM is not set
449# CONFIG_MTD_BLOCK2MTD is not set
450
451#
452# Disk-On-Chip Device Drivers
453#
454# CONFIG_MTD_DOC2000 is not set
455# CONFIG_MTD_DOC2001 is not set
456# CONFIG_MTD_DOC2001PLUS is not set
457# CONFIG_MTD_NAND is not set
458# CONFIG_MTD_ONENAND is not set
459
460#
461# UBI - Unsorted block images
462#
463# CONFIG_MTD_UBI is not set
387CONFIG_OF_DEVICE=y 464CONFIG_OF_DEVICE=y
388CONFIG_OF_I2C=y 465CONFIG_OF_I2C=y
389# CONFIG_PARPORT is not set 466# CONFIG_PARPORT is not set
diff --git a/arch/powerpc/configs/83xx/mpc836x_rdk_defconfig b/arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
index 7d674be702fe..cdf84177370a 100644
--- a/arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
+++ b/arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
@@ -164,11 +164,11 @@ CONFIG_CLASSIC_RCU=y
164# 164#
165CONFIG_PPC_MULTIPLATFORM=y 165CONFIG_PPC_MULTIPLATFORM=y
166CONFIG_CLASSIC32=y 166CONFIG_CLASSIC32=y
167CONFIG_PPC_CHRP=y 167# CONFIG_PPC_CHRP is not set
168# CONFIG_PPC_PMAC is not set
168# CONFIG_MPC5121_ADS is not set 169# CONFIG_MPC5121_ADS is not set
169# CONFIG_MPC5121_GENERIC is not set 170# CONFIG_MPC5121_GENERIC is not set
170# CONFIG_PPC_MPC52xx is not set 171# CONFIG_PPC_MPC52xx is not set
171CONFIG_PPC_PMAC=y
172# CONFIG_PPC_CELL is not set 172# CONFIG_PPC_CELL is not set
173# CONFIG_PPC_CELL_NATIVE is not set 173# CONFIG_PPC_CELL_NATIVE is not set
174# CONFIG_PPC_82xx is not set 174# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc837x_mds_defconfig b/arch/powerpc/configs/83xx/mpc837x_mds_defconfig
index de472022aa81..97e02d7a5b09 100644
--- a/arch/powerpc/configs/83xx/mpc837x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc837x_mds_defconfig
@@ -164,11 +164,11 @@ CONFIG_CLASSIC_RCU=y
164# 164#
165CONFIG_PPC_MULTIPLATFORM=y 165CONFIG_PPC_MULTIPLATFORM=y
166CONFIG_CLASSIC32=y 166CONFIG_CLASSIC32=y
167CONFIG_PPC_CHRP=y 167# CONFIG_PPC_CHRP is not set
168# CONFIG_PPC_PMAC is not set
168# CONFIG_MPC5121_ADS is not set 169# CONFIG_MPC5121_ADS is not set
169# CONFIG_MPC5121_GENERIC is not set 170# CONFIG_MPC5121_GENERIC is not set
170# CONFIG_PPC_MPC52xx is not set 171# CONFIG_PPC_MPC52xx is not set
171CONFIG_PPC_PMAC=y
172# CONFIG_PPC_CELL is not set 172# CONFIG_PPC_CELL is not set
173# CONFIG_PPC_CELL_NATIVE is not set 173# CONFIG_PPC_CELL_NATIVE is not set
174# CONFIG_PPC_82xx is not set 174# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/mpc837x_rdb_defconfig b/arch/powerpc/configs/83xx/mpc837x_rdb_defconfig
index e8d2d691d26c..5ac33054ce2c 100644
--- a/arch/powerpc/configs/83xx/mpc837x_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc837x_rdb_defconfig
@@ -164,11 +164,11 @@ CONFIG_CLASSIC_RCU=y
164# 164#
165CONFIG_PPC_MULTIPLATFORM=y 165CONFIG_PPC_MULTIPLATFORM=y
166CONFIG_CLASSIC32=y 166CONFIG_CLASSIC32=y
167CONFIG_PPC_CHRP=y 167# CONFIG_PPC_CHRP is not set
168# CONFIG_PPC_PMAC is not set
168# CONFIG_MPC5121_ADS is not set 169# CONFIG_MPC5121_ADS is not set
169# CONFIG_MPC5121_GENERIC is not set 170# CONFIG_MPC5121_GENERIC is not set
170# CONFIG_PPC_MPC52xx is not set 171# CONFIG_PPC_MPC52xx is not set
171CONFIG_PPC_PMAC=y
172# CONFIG_PPC_CELL is not set 172# CONFIG_PPC_CELL is not set
173# CONFIG_PPC_CELL_NATIVE is not set 173# CONFIG_PPC_CELL_NATIVE is not set
174# CONFIG_PPC_82xx is not set 174# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/83xx/sbc834x_defconfig b/arch/powerpc/configs/83xx/sbc834x_defconfig
index 9245a67da200..c359cc2a380e 100644
--- a/arch/powerpc/configs/83xx/sbc834x_defconfig
+++ b/arch/powerpc/configs/83xx/sbc834x_defconfig
@@ -162,11 +162,11 @@ CONFIG_CLASSIC_RCU=y
162# 162#
163CONFIG_PPC_MULTIPLATFORM=y 163CONFIG_PPC_MULTIPLATFORM=y
164CONFIG_CLASSIC32=y 164CONFIG_CLASSIC32=y
165CONFIG_PPC_CHRP=y 165# CONFIG_PPC_CHRP is not set
166# CONFIG_PPC_PMAC is not set
166# CONFIG_MPC5121_ADS is not set 167# CONFIG_MPC5121_ADS is not set
167# CONFIG_MPC5121_GENERIC is not set 168# CONFIG_MPC5121_GENERIC is not set
168# CONFIG_PPC_MPC52xx is not set 169# CONFIG_PPC_MPC52xx is not set
169CONFIG_PPC_PMAC=y
170# CONFIG_PPC_CELL is not set 170# CONFIG_PPC_CELL is not set
171# CONFIG_PPC_CELL_NATIVE is not set 171# CONFIG_PPC_CELL_NATIVE is not set
172# CONFIG_PPC_82xx is not set 172# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
new file mode 100644
index 000000000000..312d7afbbe44
--- /dev/null
+++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
@@ -0,0 +1,1657 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5
4# Wed Jun 11 12:06:53 2008
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11CONFIG_6xx=y
12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set
15# CONFIG_44x is not set
16# CONFIG_E200 is not set
17CONFIG_PPC_FPU=y
18CONFIG_ALTIVEC=y
19CONFIG_PPC_STD_MMU=y
20CONFIG_PPC_STD_MMU_32=y
21# CONFIG_PPC_MM_SLICES is not set
22CONFIG_SMP=y
23CONFIG_NR_CPUS=2
24CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32
26CONFIG_PPC_MERGE=y
27CONFIG_MMU=y
28CONFIG_GENERIC_CMOS_UPDATE=y
29CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
34CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_LOCKDEP_SUPPORT=y
37CONFIG_RWSEM_XCHGADD_ALGORITHM=y
38CONFIG_GENERIC_LOCKBREAK=y
39CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y
43# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
44CONFIG_PPC=y
45CONFIG_EARLY_PRINTK=y
46CONFIG_GENERIC_NVRAM=y
47CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
48CONFIG_ARCH_MAY_HAVE_PC_FDC=y
49CONFIG_PPC_OF=y
50CONFIG_OF=y
51CONFIG_PPC_UDBG_16550=y
52CONFIG_GENERIC_TBSYNC=y
53CONFIG_AUDIT_ARCH=y
54CONFIG_GENERIC_BUG=y
55CONFIG_DEFAULT_UIMAGE=y
56# CONFIG_PPC_DCR_NATIVE is not set
57# CONFIG_PPC_DCR_MMIO is not set
58CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
59
60#
61# General setup
62#
63CONFIG_EXPERIMENTAL=y
64CONFIG_LOCK_KERNEL=y
65CONFIG_INIT_ENV_ARG_LIMIT=32
66CONFIG_LOCALVERSION=""
67CONFIG_LOCALVERSION_AUTO=y
68CONFIG_SWAP=y
69CONFIG_SYSVIPC=y
70CONFIG_SYSVIPC_SYSCTL=y
71CONFIG_POSIX_MQUEUE=y
72CONFIG_BSD_PROCESS_ACCT=y
73CONFIG_BSD_PROCESS_ACCT_V3=y
74# CONFIG_TASKSTATS is not set
75# CONFIG_AUDIT is not set
76CONFIG_IKCONFIG=y
77CONFIG_IKCONFIG_PROC=y
78CONFIG_LOG_BUF_SHIFT=14
79# CONFIG_CGROUPS is not set
80CONFIG_GROUP_SCHED=y
81CONFIG_FAIR_GROUP_SCHED=y
82# CONFIG_RT_GROUP_SCHED is not set
83CONFIG_USER_SCHED=y
84# CONFIG_CGROUP_SCHED is not set
85CONFIG_SYSFS_DEPRECATED=y
86CONFIG_SYSFS_DEPRECATED_V2=y
87CONFIG_RELAY=y
88# CONFIG_NAMESPACES is not set
89CONFIG_BLK_DEV_INITRD=y
90CONFIG_INITRAMFS_SOURCE=""
91# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
92CONFIG_SYSCTL=y
93CONFIG_EMBEDDED=y
94CONFIG_SYSCTL_SYSCALL=y
95CONFIG_SYSCTL_SYSCALL_CHECK=y
96CONFIG_KALLSYMS=y
97# CONFIG_KALLSYMS_ALL is not set
98# CONFIG_KALLSYMS_EXTRA_PASS is not set
99CONFIG_HOTPLUG=y
100CONFIG_PRINTK=y
101CONFIG_BUG=y
102CONFIG_ELF_CORE=y
103CONFIG_COMPAT_BRK=y
104CONFIG_BASE_FULL=y
105CONFIG_FUTEX=y
106CONFIG_ANON_INODES=y
107CONFIG_EPOLL=y
108CONFIG_SIGNALFD=y
109CONFIG_TIMERFD=y
110CONFIG_EVENTFD=y
111CONFIG_SHMEM=y
112CONFIG_VM_EVENT_COUNTERS=y
113CONFIG_SLAB=y
114# CONFIG_SLUB is not set
115# CONFIG_SLOB is not set
116# CONFIG_PROFILING is not set
117# CONFIG_MARKERS is not set
118CONFIG_HAVE_OPROFILE=y
119# CONFIG_KPROBES is not set
120CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y
122# CONFIG_HAVE_DMA_ATTRS is not set
123CONFIG_PROC_PAGE_MONITOR=y
124CONFIG_SLABINFO=y
125CONFIG_RT_MUTEXES=y
126# CONFIG_TINY_SHMEM is not set
127CONFIG_BASE_SMALL=0
128CONFIG_MODULES=y
129# CONFIG_MODULE_FORCE_LOAD is not set
130CONFIG_MODULE_UNLOAD=y
131# CONFIG_MODULE_FORCE_UNLOAD is not set
132# CONFIG_MODVERSIONS is not set
133# CONFIG_MODULE_SRCVERSION_ALL is not set
134CONFIG_KMOD=y
135CONFIG_STOP_MACHINE=y
136CONFIG_BLOCK=y
137# CONFIG_LBD is not set
138# CONFIG_BLK_DEV_IO_TRACE is not set
139# CONFIG_LSF is not set
140# CONFIG_BLK_DEV_BSG is not set
141
142#
143# IO Schedulers
144#
145CONFIG_IOSCHED_NOOP=y
146CONFIG_IOSCHED_AS=y
147CONFIG_IOSCHED_DEADLINE=y
148CONFIG_IOSCHED_CFQ=y
149# CONFIG_DEFAULT_AS is not set
150# CONFIG_DEFAULT_DEADLINE is not set
151CONFIG_DEFAULT_CFQ=y
152# CONFIG_DEFAULT_NOOP is not set
153CONFIG_DEFAULT_IOSCHED="cfq"
154CONFIG_CLASSIC_RCU=y
155
156#
157# Platform support
158#
159CONFIG_PPC_MULTIPLATFORM=y
160CONFIG_CLASSIC32=y
161# CONFIG_PPC_CHRP is not set
162# CONFIG_PPC_PMAC is not set
163# CONFIG_PPC_82xx is not set
164# CONFIG_PPC_83xx is not set
165CONFIG_PPC_86xx=y
166# CONFIG_PPC_MPC512x is not set
167# CONFIG_PPC_MPC5121 is not set
168# CONFIG_PPC_CELL is not set
169# CONFIG_PPC_CELL_NATIVE is not set
170# CONFIG_PQ2ADS is not set
171# CONFIG_MPC8641_HPCN is not set
172# CONFIG_SBC8641D is not set
173# CONFIG_MPC8610_HPCD is not set
174CONFIG_GEF_SBC610=y
175CONFIG_MPC8641=y
176# CONFIG_IPIC is not set
177CONFIG_MPIC=y
178# CONFIG_MPIC_WEIRD is not set
179# CONFIG_PPC_I8259 is not set
180# CONFIG_PPC_RTAS is not set
181# CONFIG_MMIO_NVRAM is not set
182# CONFIG_PPC_MPC106 is not set
183# CONFIG_PPC_970_NAP is not set
184# CONFIG_PPC_INDIRECT_IO is not set
185# CONFIG_GENERIC_IOMAP is not set
186# CONFIG_CPU_FREQ is not set
187# CONFIG_FSL_ULI1575 is not set
188
189#
190# Kernel options
191#
192# CONFIG_HIGHMEM is not set
193CONFIG_TICK_ONESHOT=y
194# CONFIG_NO_HZ is not set
195CONFIG_HIGH_RES_TIMERS=y
196CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
197# CONFIG_HZ_100 is not set
198# CONFIG_HZ_250 is not set
199# CONFIG_HZ_300 is not set
200CONFIG_HZ_1000=y
201CONFIG_HZ=1000
202# CONFIG_SCHED_HRTICK is not set
203# CONFIG_PREEMPT_NONE is not set
204# CONFIG_PREEMPT_VOLUNTARY is not set
205CONFIG_PREEMPT=y
206# CONFIG_PREEMPT_RCU is not set
207CONFIG_BINFMT_ELF=y
208CONFIG_BINFMT_MISC=m
209# CONFIG_IOMMU_HELPER is not set
210CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
211CONFIG_ARCH_HAS_WALK_MEMORY=y
212CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
213CONFIG_IRQ_ALL_CPUS=y
214CONFIG_ARCH_FLATMEM_ENABLE=y
215CONFIG_ARCH_POPULATES_NODE_MAP=y
216CONFIG_SELECT_MEMORY_MODEL=y
217CONFIG_FLATMEM_MANUAL=y
218# CONFIG_DISCONTIGMEM_MANUAL is not set
219# CONFIG_SPARSEMEM_MANUAL is not set
220CONFIG_FLATMEM=y
221CONFIG_FLAT_NODE_MEM_MAP=y
222# CONFIG_SPARSEMEM_STATIC is not set
223# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
224CONFIG_PAGEFLAGS_EXTENDED=y
225CONFIG_SPLIT_PTLOCK_CPUS=4
226# CONFIG_RESOURCES_64BIT is not set
227CONFIG_ZONE_DMA_FLAG=1
228CONFIG_BOUNCE=y
229CONFIG_VIRT_TO_BUS=y
230CONFIG_FORCE_MAX_ZONEORDER=11
231# CONFIG_PROC_DEVICETREE is not set
232# CONFIG_CMDLINE_BOOL is not set
233# CONFIG_PM is not set
234CONFIG_SECCOMP=y
235CONFIG_ISA_DMA_API=y
236
237#
238# Bus options
239#
240CONFIG_ZONE_DMA=y
241CONFIG_GENERIC_ISA_DMA=y
242CONFIG_PPC_INDIRECT_PCI=y
243CONFIG_FSL_SOC=y
244CONFIG_FSL_PCI=y
245CONFIG_PCI=y
246CONFIG_PCI_DOMAINS=y
247CONFIG_PCI_SYSCALL=y
248CONFIG_PCIEPORTBUS=y
249CONFIG_PCIEAER=y
250# CONFIG_PCIEASPM is not set
251CONFIG_ARCH_SUPPORTS_MSI=y
252# CONFIG_PCI_MSI is not set
253CONFIG_PCI_LEGACY=y
254CONFIG_PCI_DEBUG=y
255# CONFIG_PCCARD is not set
256# CONFIG_HOTPLUG_PCI is not set
257CONFIG_HAS_RAPIDIO=y
258# CONFIG_RAPIDIO is not set
259
260#
261# Advanced setup
262#
263# CONFIG_ADVANCED_OPTIONS is not set
264
265#
266# Default settings for advanced configuration options are used
267#
268CONFIG_LOWMEM_SIZE=0x30000000
269CONFIG_PAGE_OFFSET=0xc0000000
270CONFIG_KERNEL_START=0xc0000000
271CONFIG_PHYSICAL_START=0x00000000
272CONFIG_TASK_SIZE=0xc0000000
273
274#
275# Networking
276#
277CONFIG_NET=y
278
279#
280# Networking options
281#
282CONFIG_PACKET=y
283CONFIG_PACKET_MMAP=y
284CONFIG_UNIX=y
285CONFIG_XFRM=y
286CONFIG_XFRM_USER=m
287# CONFIG_XFRM_SUB_POLICY is not set
288# CONFIG_XFRM_MIGRATE is not set
289# CONFIG_XFRM_STATISTICS is not set
290CONFIG_NET_KEY=m
291# CONFIG_NET_KEY_MIGRATE is not set
292CONFIG_INET=y
293CONFIG_IP_MULTICAST=y
294CONFIG_IP_ADVANCED_ROUTER=y
295CONFIG_ASK_IP_FIB_HASH=y
296# CONFIG_IP_FIB_TRIE is not set
297CONFIG_IP_FIB_HASH=y
298CONFIG_IP_MULTIPLE_TABLES=y
299CONFIG_IP_ROUTE_MULTIPATH=y
300CONFIG_IP_ROUTE_VERBOSE=y
301CONFIG_IP_PNP=y
302CONFIG_IP_PNP_DHCP=y
303CONFIG_IP_PNP_BOOTP=y
304CONFIG_IP_PNP_RARP=y
305CONFIG_NET_IPIP=m
306CONFIG_NET_IPGRE=m
307CONFIG_NET_IPGRE_BROADCAST=y
308CONFIG_IP_MROUTE=y
309CONFIG_IP_PIMSM_V1=y
310CONFIG_IP_PIMSM_V2=y
311# CONFIG_ARPD is not set
312CONFIG_SYN_COOKIES=y
313CONFIG_INET_AH=m
314CONFIG_INET_ESP=m
315CONFIG_INET_IPCOMP=m
316CONFIG_INET_XFRM_TUNNEL=m
317CONFIG_INET_TUNNEL=m
318CONFIG_INET_XFRM_MODE_TRANSPORT=y
319CONFIG_INET_XFRM_MODE_TUNNEL=y
320CONFIG_INET_XFRM_MODE_BEET=y
321# CONFIG_INET_LRO is not set
322CONFIG_INET_DIAG=y
323CONFIG_INET_TCP_DIAG=y
324# CONFIG_TCP_CONG_ADVANCED is not set
325CONFIG_TCP_CONG_CUBIC=y
326CONFIG_DEFAULT_TCP_CONG="cubic"
327# CONFIG_TCP_MD5SIG is not set
328# CONFIG_IP_VS is not set
329CONFIG_IPV6=m
330# CONFIG_IPV6_PRIVACY is not set
331# CONFIG_IPV6_ROUTER_PREF is not set
332# CONFIG_IPV6_OPTIMISTIC_DAD is not set
333CONFIG_INET6_AH=m
334CONFIG_INET6_ESP=m
335CONFIG_INET6_IPCOMP=m
336# CONFIG_IPV6_MIP6 is not set
337CONFIG_INET6_XFRM_TUNNEL=m
338CONFIG_INET6_TUNNEL=m
339CONFIG_INET6_XFRM_MODE_TRANSPORT=m
340CONFIG_INET6_XFRM_MODE_TUNNEL=m
341CONFIG_INET6_XFRM_MODE_BEET=m
342# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
343CONFIG_IPV6_SIT=m
344CONFIG_IPV6_NDISC_NODETYPE=y
345CONFIG_IPV6_TUNNEL=m
346# CONFIG_IPV6_MULTIPLE_TABLES is not set
347# CONFIG_IPV6_MROUTE is not set
348# CONFIG_NETLABEL is not set
349# CONFIG_NETWORK_SECMARK is not set
350CONFIG_NETFILTER=y
351# CONFIG_NETFILTER_DEBUG is not set
352CONFIG_NETFILTER_ADVANCED=y
353CONFIG_BRIDGE_NETFILTER=y
354
355#
356# Core Netfilter Configuration
357#
358# CONFIG_NETFILTER_NETLINK_QUEUE is not set
359# CONFIG_NETFILTER_NETLINK_LOG is not set
360# CONFIG_NF_CONNTRACK is not set
361CONFIG_NETFILTER_XTABLES=m
362# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
363# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
364# CONFIG_NETFILTER_XT_TARGET_MARK is not set
365# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
366# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
367# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
368# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
369# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
370# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
371# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
372# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
373# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
374# CONFIG_NETFILTER_XT_MATCH_ESP is not set
375# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
376# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set
377# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
378# CONFIG_NETFILTER_XT_MATCH_MAC is not set
379# CONFIG_NETFILTER_XT_MATCH_MARK is not set
380# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
381# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
382# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set
383# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
384# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set
385# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
386# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
387# CONFIG_NETFILTER_XT_MATCH_REALM is not set
388# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
389# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
390# CONFIG_NETFILTER_XT_MATCH_STRING is not set
391# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
392# CONFIG_NETFILTER_XT_MATCH_TIME is not set
393# CONFIG_NETFILTER_XT_MATCH_U32 is not set
394# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
395
396#
397# IP: Netfilter Configuration
398#
399CONFIG_IP_NF_QUEUE=m
400CONFIG_IP_NF_IPTABLES=m
401CONFIG_IP_NF_MATCH_RECENT=m
402CONFIG_IP_NF_MATCH_ECN=m
403# CONFIG_IP_NF_MATCH_AH is not set
404CONFIG_IP_NF_MATCH_TTL=m
405CONFIG_IP_NF_MATCH_ADDRTYPE=m
406CONFIG_IP_NF_FILTER=m
407CONFIG_IP_NF_TARGET_REJECT=m
408CONFIG_IP_NF_TARGET_LOG=m
409CONFIG_IP_NF_TARGET_ULOG=m
410CONFIG_IP_NF_MANGLE=m
411CONFIG_IP_NF_TARGET_ECN=m
412# CONFIG_IP_NF_TARGET_TTL is not set
413CONFIG_IP_NF_RAW=m
414CONFIG_IP_NF_ARPTABLES=m
415CONFIG_IP_NF_ARPFILTER=m
416CONFIG_IP_NF_ARP_MANGLE=m
417
418#
419# IPv6: Netfilter Configuration
420#
421CONFIG_IP6_NF_QUEUE=m
422CONFIG_IP6_NF_IPTABLES=m
423CONFIG_IP6_NF_MATCH_RT=m
424CONFIG_IP6_NF_MATCH_OPTS=m
425CONFIG_IP6_NF_MATCH_FRAG=m
426CONFIG_IP6_NF_MATCH_HL=m
427CONFIG_IP6_NF_MATCH_IPV6HEADER=m
428# CONFIG_IP6_NF_MATCH_AH is not set
429# CONFIG_IP6_NF_MATCH_MH is not set
430CONFIG_IP6_NF_MATCH_EUI64=m
431CONFIG_IP6_NF_FILTER=m
432CONFIG_IP6_NF_TARGET_LOG=m
433# CONFIG_IP6_NF_TARGET_REJECT is not set
434CONFIG_IP6_NF_MANGLE=m
435# CONFIG_IP6_NF_TARGET_HL is not set
436CONFIG_IP6_NF_RAW=m
437
438#
439# Bridge: Netfilter Configuration
440#
441# CONFIG_BRIDGE_NF_EBTABLES is not set
442# CONFIG_IP_DCCP is not set
443CONFIG_IP_SCTP=m
444# CONFIG_SCTP_DBG_MSG is not set
445# CONFIG_SCTP_DBG_OBJCNT is not set
446# CONFIG_SCTP_HMAC_NONE is not set
447# CONFIG_SCTP_HMAC_SHA1 is not set
448CONFIG_SCTP_HMAC_MD5=y
449CONFIG_TIPC=m
450# CONFIG_TIPC_ADVANCED is not set
451# CONFIG_TIPC_DEBUG is not set
452CONFIG_ATM=m
453CONFIG_ATM_CLIP=m
454# CONFIG_ATM_CLIP_NO_ICMP is not set
455CONFIG_ATM_LANE=m
456CONFIG_ATM_MPOA=m
457CONFIG_ATM_BR2684=m
458# CONFIG_ATM_BR2684_IPFILTER is not set
459CONFIG_BRIDGE=m
460CONFIG_VLAN_8021Q=m
461# CONFIG_DECNET is not set
462CONFIG_LLC=m
463# CONFIG_LLC2 is not set
464# CONFIG_IPX is not set
465# CONFIG_ATALK is not set
466# CONFIG_X25 is not set
467# CONFIG_LAPB is not set
468# CONFIG_ECONET is not set
469CONFIG_WAN_ROUTER=m
470CONFIG_NET_SCHED=y
471
472#
473# Queueing/Scheduling
474#
475CONFIG_NET_SCH_CBQ=m
476CONFIG_NET_SCH_HTB=m
477CONFIG_NET_SCH_HFSC=m
478CONFIG_NET_SCH_ATM=m
479CONFIG_NET_SCH_PRIO=m
480# CONFIG_NET_SCH_RR is not set
481CONFIG_NET_SCH_RED=m
482CONFIG_NET_SCH_SFQ=m
483CONFIG_NET_SCH_TEQL=m
484CONFIG_NET_SCH_TBF=m
485CONFIG_NET_SCH_GRED=m
486CONFIG_NET_SCH_DSMARK=m
487CONFIG_NET_SCH_NETEM=m
488
489#
490# Classification
491#
492CONFIG_NET_CLS=y
493# CONFIG_NET_CLS_BASIC is not set
494CONFIG_NET_CLS_TCINDEX=m
495CONFIG_NET_CLS_ROUTE4=m
496CONFIG_NET_CLS_ROUTE=y
497CONFIG_NET_CLS_FW=m
498CONFIG_NET_CLS_U32=m
499# CONFIG_CLS_U32_PERF is not set
500# CONFIG_CLS_U32_MARK is not set
501CONFIG_NET_CLS_RSVP=m
502CONFIG_NET_CLS_RSVP6=m
503# CONFIG_NET_CLS_FLOW is not set
504# CONFIG_NET_EMATCH is not set
505# CONFIG_NET_CLS_ACT is not set
506# CONFIG_NET_CLS_IND is not set
507CONFIG_NET_SCH_FIFO=y
508
509#
510# Network testing
511#
512CONFIG_NET_PKTGEN=m
513# CONFIG_HAMRADIO is not set
514# CONFIG_CAN is not set
515# CONFIG_IRDA is not set
516# CONFIG_BT is not set
517# CONFIG_AF_RXRPC is not set
518CONFIG_FIB_RULES=y
519
520#
521# Wireless
522#
523# CONFIG_CFG80211 is not set
524# CONFIG_WIRELESS_EXT is not set
525# CONFIG_MAC80211 is not set
526# CONFIG_IEEE80211 is not set
527# CONFIG_RFKILL is not set
528# CONFIG_NET_9P is not set
529
530#
531# Device Drivers
532#
533
534#
535# Generic Driver Options
536#
537CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
538CONFIG_STANDALONE=y
539CONFIG_PREVENT_FIRMWARE_BUILD=y
540# CONFIG_FW_LOADER is not set
541# CONFIG_DEBUG_DRIVER is not set
542# CONFIG_DEBUG_DEVRES is not set
543# CONFIG_SYS_HYPERVISOR is not set
544# CONFIG_CONNECTOR is not set
545CONFIG_MTD=y
546# CONFIG_MTD_DEBUG is not set
547CONFIG_MTD_CONCAT=y
548CONFIG_MTD_PARTITIONS=y
549# CONFIG_MTD_REDBOOT_PARTS is not set
550# CONFIG_MTD_CMDLINE_PARTS is not set
551# CONFIG_MTD_OF_PARTS is not set
552# CONFIG_MTD_AR7_PARTS is not set
553
554#
555# User Modules And Translation Layers
556#
557CONFIG_MTD_CHAR=y
558CONFIG_MTD_BLKDEVS=y
559CONFIG_MTD_BLOCK=y
560# CONFIG_FTL is not set
561# CONFIG_NFTL is not set
562# CONFIG_INFTL is not set
563# CONFIG_RFD_FTL is not set
564# CONFIG_SSFDC is not set
565# CONFIG_MTD_OOPS is not set
566
567#
568# RAM/ROM/Flash chip drivers
569#
570CONFIG_MTD_CFI=y
571# CONFIG_MTD_JEDECPROBE is not set
572CONFIG_MTD_GEN_PROBE=y
573CONFIG_MTD_CFI_ADV_OPTIONS=y
574# CONFIG_MTD_CFI_NOSWAP is not set
575# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
576CONFIG_MTD_CFI_LE_BYTE_SWAP=y
577# CONFIG_MTD_CFI_GEOMETRY is not set
578CONFIG_MTD_MAP_BANK_WIDTH_1=y
579CONFIG_MTD_MAP_BANK_WIDTH_2=y
580CONFIG_MTD_MAP_BANK_WIDTH_4=y
581# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
582# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
583# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
584CONFIG_MTD_CFI_I1=y
585CONFIG_MTD_CFI_I2=y
586# CONFIG_MTD_CFI_I4 is not set
587# CONFIG_MTD_CFI_I8 is not set
588# CONFIG_MTD_OTP is not set
589CONFIG_MTD_CFI_INTELEXT=y
590CONFIG_MTD_CFI_AMDSTD=y
591# CONFIG_MTD_CFI_STAA is not set
592CONFIG_MTD_CFI_UTIL=y
593# CONFIG_MTD_RAM is not set
594# CONFIG_MTD_ROM is not set
595# CONFIG_MTD_ABSENT is not set
596
597#
598# Mapping drivers for chip access
599#
600# CONFIG_MTD_COMPLEX_MAPPINGS is not set
601# CONFIG_MTD_PHYSMAP is not set
602CONFIG_MTD_PHYSMAP_OF=y
603# CONFIG_MTD_INTEL_VR_NOR is not set
604# CONFIG_MTD_PLATRAM is not set
605
606#
607# Self-contained MTD device drivers
608#
609# CONFIG_MTD_PMC551 is not set
610# CONFIG_MTD_SLRAM is not set
611# CONFIG_MTD_PHRAM is not set
612# CONFIG_MTD_MTDRAM is not set
613# CONFIG_MTD_BLOCK2MTD is not set
614
615#
616# Disk-On-Chip Device Drivers
617#
618# CONFIG_MTD_DOC2000 is not set
619# CONFIG_MTD_DOC2001 is not set
620# CONFIG_MTD_DOC2001PLUS is not set
621# CONFIG_MTD_NAND is not set
622# CONFIG_MTD_ONENAND is not set
623
624#
625# UBI - Unsorted block images
626#
627# CONFIG_MTD_UBI is not set
628CONFIG_OF_DEVICE=y
629CONFIG_OF_I2C=y
630# CONFIG_PARPORT is not set
631CONFIG_BLK_DEV=y
632# CONFIG_BLK_DEV_FD is not set
633# CONFIG_BLK_CPQ_DA is not set
634# CONFIG_BLK_CPQ_CISS_DA is not set
635# CONFIG_BLK_DEV_DAC960 is not set
636# CONFIG_BLK_DEV_UMEM is not set
637# CONFIG_BLK_DEV_COW_COMMON is not set
638CONFIG_BLK_DEV_LOOP=m
639CONFIG_BLK_DEV_CRYPTOLOOP=m
640CONFIG_BLK_DEV_NBD=m
641# CONFIG_BLK_DEV_SX8 is not set
642# CONFIG_BLK_DEV_UB is not set
643CONFIG_BLK_DEV_RAM=y
644CONFIG_BLK_DEV_RAM_COUNT=16
645CONFIG_BLK_DEV_RAM_SIZE=131072
646# CONFIG_BLK_DEV_XIP is not set
647# CONFIG_CDROM_PKTCDVD is not set
648# CONFIG_ATA_OVER_ETH is not set
649CONFIG_MISC_DEVICES=y
650# CONFIG_PHANTOM is not set
651# CONFIG_EEPROM_93CX6 is not set
652# CONFIG_SGI_IOC4 is not set
653# CONFIG_TIFM_CORE is not set
654# CONFIG_ENCLOSURE_SERVICES is not set
655CONFIG_HAVE_IDE=y
656# CONFIG_IDE is not set
657
658#
659# SCSI device support
660#
661# CONFIG_RAID_ATTRS is not set
662CONFIG_SCSI=y
663CONFIG_SCSI_DMA=y
664# CONFIG_SCSI_TGT is not set
665# CONFIG_SCSI_NETLINK is not set
666CONFIG_SCSI_PROC_FS=y
667
668#
669# SCSI support type (disk, tape, CD-ROM)
670#
671CONFIG_BLK_DEV_SD=y
672CONFIG_CHR_DEV_ST=y
673# CONFIG_CHR_DEV_OSST is not set
674CONFIG_BLK_DEV_SR=y
675# CONFIG_BLK_DEV_SR_VENDOR is not set
676# CONFIG_CHR_DEV_SG is not set
677# CONFIG_CHR_DEV_SCH is not set
678
679#
680# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
681#
682# CONFIG_SCSI_MULTI_LUN is not set
683# CONFIG_SCSI_CONSTANTS is not set
684# CONFIG_SCSI_LOGGING is not set
685# CONFIG_SCSI_SCAN_ASYNC is not set
686CONFIG_SCSI_WAIT_SCAN=m
687
688#
689# SCSI Transports
690#
691# CONFIG_SCSI_SPI_ATTRS is not set
692# CONFIG_SCSI_FC_ATTRS is not set
693# CONFIG_SCSI_ISCSI_ATTRS is not set
694# CONFIG_SCSI_SAS_LIBSAS is not set
695# CONFIG_SCSI_SRP_ATTRS is not set
696CONFIG_SCSI_LOWLEVEL=y
697# CONFIG_ISCSI_TCP is not set
698# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
699# CONFIG_SCSI_3W_9XXX is not set
700# CONFIG_SCSI_ACARD is not set
701# CONFIG_SCSI_AACRAID is not set
702# CONFIG_SCSI_AIC7XXX is not set
703# CONFIG_SCSI_AIC7XXX_OLD is not set
704# CONFIG_SCSI_AIC79XX is not set
705# CONFIG_SCSI_AIC94XX is not set
706# CONFIG_SCSI_DPT_I2O is not set
707# CONFIG_SCSI_ADVANSYS is not set
708# CONFIG_SCSI_ARCMSR is not set
709# CONFIG_MEGARAID_NEWGEN is not set
710# CONFIG_MEGARAID_LEGACY is not set
711# CONFIG_MEGARAID_SAS is not set
712# CONFIG_SCSI_HPTIOP is not set
713# CONFIG_SCSI_BUSLOGIC is not set
714# CONFIG_SCSI_DMX3191D is not set
715# CONFIG_SCSI_EATA is not set
716# CONFIG_SCSI_FUTURE_DOMAIN is not set
717# CONFIG_SCSI_GDTH is not set
718# CONFIG_SCSI_IPS is not set
719# CONFIG_SCSI_INITIO is not set
720# CONFIG_SCSI_INIA100 is not set
721# CONFIG_SCSI_MVSAS is not set
722# CONFIG_SCSI_STEX is not set
723# CONFIG_SCSI_SYM53C8XX_2 is not set
724# CONFIG_SCSI_IPR is not set
725# CONFIG_SCSI_QLOGIC_1280 is not set
726# CONFIG_SCSI_QLA_FC is not set
727# CONFIG_SCSI_QLA_ISCSI is not set
728# CONFIG_SCSI_LPFC is not set
729# CONFIG_SCSI_DC395x is not set
730# CONFIG_SCSI_DC390T is not set
731# CONFIG_SCSI_NSP32 is not set
732# CONFIG_SCSI_DEBUG is not set
733# CONFIG_SCSI_SRP is not set
734CONFIG_ATA=y
735# CONFIG_ATA_NONSTANDARD is not set
736CONFIG_SATA_PMP=y
737# CONFIG_SATA_AHCI is not set
738# CONFIG_SATA_SIL24 is not set
739# CONFIG_SATA_FSL is not set
740CONFIG_ATA_SFF=y
741# CONFIG_SATA_SVW is not set
742# CONFIG_ATA_PIIX is not set
743# CONFIG_SATA_MV is not set
744# CONFIG_SATA_NV is not set
745# CONFIG_PDC_ADMA is not set
746# CONFIG_SATA_QSTOR is not set
747# CONFIG_SATA_PROMISE is not set
748# CONFIG_SATA_SX4 is not set
749CONFIG_SATA_SIL=y
750# CONFIG_SATA_SIS is not set
751# CONFIG_SATA_ULI is not set
752# CONFIG_SATA_VIA is not set
753# CONFIG_SATA_VITESSE is not set
754# CONFIG_SATA_INIC162X is not set
755# CONFIG_PATA_ALI is not set
756# CONFIG_PATA_AMD is not set
757# CONFIG_PATA_ARTOP is not set
758# CONFIG_PATA_ATIIXP is not set
759# CONFIG_PATA_CMD640_PCI is not set
760# CONFIG_PATA_CMD64X is not set
761# CONFIG_PATA_CS5520 is not set
762# CONFIG_PATA_CS5530 is not set
763# CONFIG_PATA_CYPRESS is not set
764# CONFIG_PATA_EFAR is not set
765# CONFIG_ATA_GENERIC is not set
766# CONFIG_PATA_HPT366 is not set
767# CONFIG_PATA_HPT37X is not set
768# CONFIG_PATA_HPT3X2N is not set
769# CONFIG_PATA_HPT3X3 is not set
770# CONFIG_PATA_IT821X is not set
771# CONFIG_PATA_IT8213 is not set
772# CONFIG_PATA_JMICRON is not set
773# CONFIG_PATA_TRIFLEX is not set
774# CONFIG_PATA_MARVELL is not set
775# CONFIG_PATA_MPIIX is not set
776# CONFIG_PATA_OLDPIIX is not set
777# CONFIG_PATA_NETCELL is not set
778# CONFIG_PATA_NINJA32 is not set
779# CONFIG_PATA_NS87410 is not set
780# CONFIG_PATA_NS87415 is not set
781# CONFIG_PATA_OPTI is not set
782# CONFIG_PATA_OPTIDMA is not set
783# CONFIG_PATA_PDC_OLD is not set
784# CONFIG_PATA_RADISYS is not set
785# CONFIG_PATA_RZ1000 is not set
786# CONFIG_PATA_SC1200 is not set
787# CONFIG_PATA_SERVERWORKS is not set
788# CONFIG_PATA_PDC2027X is not set
789# CONFIG_PATA_SIL680 is not set
790# CONFIG_PATA_SIS is not set
791# CONFIG_PATA_VIA is not set
792# CONFIG_PATA_WINBOND is not set
793# CONFIG_PATA_PLATFORM is not set
794# CONFIG_PATA_SCH is not set
795# CONFIG_MD is not set
796# CONFIG_FUSION is not set
797
798#
799# IEEE 1394 (FireWire) support
800#
801# CONFIG_FIREWIRE is not set
802# CONFIG_IEEE1394 is not set
803# CONFIG_I2O is not set
804# CONFIG_MACINTOSH_DRIVERS is not set
805CONFIG_NETDEVICES=y
806# CONFIG_NETDEVICES_MULTIQUEUE is not set
807CONFIG_DUMMY=m
808CONFIG_BONDING=m
809# CONFIG_MACVLAN is not set
810# CONFIG_EQUALIZER is not set
811CONFIG_TUN=m
812# CONFIG_VETH is not set
813# CONFIG_ARCNET is not set
814CONFIG_PHYLIB=y
815
816#
817# MII PHY device drivers
818#
819CONFIG_MARVELL_PHY=y
820# CONFIG_DAVICOM_PHY is not set
821# CONFIG_QSEMI_PHY is not set
822# CONFIG_LXT_PHY is not set
823# CONFIG_CICADA_PHY is not set
824# CONFIG_VITESSE_PHY is not set
825# CONFIG_SMSC_PHY is not set
826# CONFIG_BROADCOM_PHY is not set
827# CONFIG_ICPLUS_PHY is not set
828# CONFIG_REALTEK_PHY is not set
829# CONFIG_FIXED_PHY is not set
830# CONFIG_MDIO_BITBANG is not set
831CONFIG_NET_ETHERNET=y
832CONFIG_MII=y
833# CONFIG_HAPPYMEAL is not set
834# CONFIG_SUNGEM is not set
835# CONFIG_CASSINI is not set
836# CONFIG_NET_VENDOR_3COM is not set
837# CONFIG_NET_TULIP is not set
838# CONFIG_HP100 is not set
839# CONFIG_IBM_NEW_EMAC_ZMII is not set
840# CONFIG_IBM_NEW_EMAC_RGMII is not set
841# CONFIG_IBM_NEW_EMAC_TAH is not set
842# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
843# CONFIG_NET_PCI is not set
844# CONFIG_B44 is not set
845CONFIG_NETDEV_1000=y
846# CONFIG_ACENIC is not set
847# CONFIG_DL2K is not set
848# CONFIG_E1000 is not set
849# CONFIG_E1000E is not set
850# CONFIG_E1000E_ENABLED is not set
851# CONFIG_IP1000 is not set
852# CONFIG_IGB is not set
853# CONFIG_NS83820 is not set
854# CONFIG_HAMACHI is not set
855# CONFIG_YELLOWFIN is not set
856# CONFIG_R8169 is not set
857# CONFIG_SIS190 is not set
858# CONFIG_SKGE is not set
859# CONFIG_SKY2 is not set
860# CONFIG_VIA_VELOCITY is not set
861# CONFIG_TIGON3 is not set
862# CONFIG_BNX2 is not set
863CONFIG_GIANFAR=y
864# CONFIG_GFAR_NAPI is not set
865# CONFIG_QLA3XXX is not set
866# CONFIG_ATL1 is not set
867# CONFIG_NETDEV_10000 is not set
868# CONFIG_TR is not set
869
870#
871# Wireless LAN
872#
873# CONFIG_WLAN_PRE80211 is not set
874# CONFIG_WLAN_80211 is not set
875# CONFIG_IWLWIFI_LEDS is not set
876
877#
878# USB Network Adapters
879#
880# CONFIG_USB_CATC is not set
881# CONFIG_USB_KAWETH is not set
882# CONFIG_USB_PEGASUS is not set
883# CONFIG_USB_RTL8150 is not set
884# CONFIG_USB_USBNET is not set
885# CONFIG_WAN is not set
886CONFIG_ATM_DRIVERS=y
887# CONFIG_ATM_DUMMY is not set
888# CONFIG_ATM_TCP is not set
889# CONFIG_ATM_LANAI is not set
890# CONFIG_ATM_ENI is not set
891# CONFIG_ATM_FIRESTREAM is not set
892# CONFIG_ATM_ZATM is not set
893# CONFIG_ATM_NICSTAR is not set
894# CONFIG_ATM_IDT77252 is not set
895# CONFIG_ATM_AMBASSADOR is not set
896# CONFIG_ATM_HORIZON is not set
897# CONFIG_ATM_IA is not set
898# CONFIG_ATM_FORE200E_MAYBE is not set
899# CONFIG_ATM_HE is not set
900# CONFIG_FDDI is not set
901# CONFIG_HIPPI is not set
902CONFIG_PPP=m
903CONFIG_PPP_MULTILINK=y
904CONFIG_PPP_FILTER=y
905CONFIG_PPP_ASYNC=m
906CONFIG_PPP_SYNC_TTY=m
907CONFIG_PPP_DEFLATE=m
908CONFIG_PPP_BSDCOMP=m
909# CONFIG_PPP_MPPE is not set
910CONFIG_PPPOE=m
911CONFIG_PPPOATM=m
912# CONFIG_PPPOL2TP is not set
913CONFIG_SLIP=m
914CONFIG_SLIP_COMPRESSED=y
915CONFIG_SLHC=m
916CONFIG_SLIP_SMART=y
917CONFIG_SLIP_MODE_SLIP6=y
918# CONFIG_NET_FC is not set
919CONFIG_NETCONSOLE=y
920# CONFIG_NETCONSOLE_DYNAMIC is not set
921CONFIG_NETPOLL=y
922CONFIG_NETPOLL_TRAP=y
923CONFIG_NET_POLL_CONTROLLER=y
924# CONFIG_ISDN is not set
925# CONFIG_PHONE is not set
926
927#
928# Input device support
929#
930CONFIG_INPUT=y
931# CONFIG_INPUT_FF_MEMLESS is not set
932# CONFIG_INPUT_POLLDEV is not set
933
934#
935# Userland interfaces
936#
937CONFIG_INPUT_MOUSEDEV=y
938CONFIG_INPUT_MOUSEDEV_PSAUX=y
939CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
940CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
941# CONFIG_INPUT_JOYDEV is not set
942# CONFIG_INPUT_EVDEV is not set
943# CONFIG_INPUT_EVBUG is not set
944
945#
946# Input Device Drivers
947#
948# CONFIG_INPUT_KEYBOARD is not set
949# CONFIG_INPUT_MOUSE is not set
950# CONFIG_INPUT_JOYSTICK is not set
951# CONFIG_INPUT_TABLET is not set
952# CONFIG_INPUT_TOUCHSCREEN is not set
953# CONFIG_INPUT_MISC is not set
954
955#
956# Hardware I/O ports
957#
958# CONFIG_SERIO is not set
959# CONFIG_GAMEPORT is not set
960
961#
962# Character devices
963#
964CONFIG_VT=y
965CONFIG_VT_CONSOLE=y
966CONFIG_HW_CONSOLE=y
967# CONFIG_VT_HW_CONSOLE_BINDING is not set
968CONFIG_DEVKMEM=y
969# CONFIG_SERIAL_NONSTANDARD is not set
970# CONFIG_NOZOMI is not set
971
972#
973# Serial drivers
974#
975CONFIG_SERIAL_8250=y
976CONFIG_SERIAL_8250_CONSOLE=y
977# CONFIG_SERIAL_8250_PCI is not set
978CONFIG_SERIAL_8250_NR_UARTS=2
979CONFIG_SERIAL_8250_RUNTIME_UARTS=2
980# CONFIG_SERIAL_8250_EXTENDED is not set
981
982#
983# Non-8250 serial port support
984#
985# CONFIG_SERIAL_UARTLITE is not set
986CONFIG_SERIAL_CORE=y
987CONFIG_SERIAL_CORE_CONSOLE=y
988# CONFIG_SERIAL_JSM is not set
989# CONFIG_SERIAL_OF_PLATFORM is not set
990CONFIG_UNIX98_PTYS=y
991# CONFIG_LEGACY_PTYS is not set
992# CONFIG_IPMI_HANDLER is not set
993CONFIG_HW_RANDOM=y
994# CONFIG_NVRAM is not set
995# CONFIG_R3964 is not set
996# CONFIG_APPLICOM is not set
997# CONFIG_RAW_DRIVER is not set
998# CONFIG_TCG_TPM is not set
999CONFIG_DEVPORT=y
1000CONFIG_I2C=y
1001CONFIG_I2C_BOARDINFO=y
1002CONFIG_I2C_CHARDEV=y
1003
1004#
1005# I2C Hardware Bus support
1006#
1007# CONFIG_I2C_ALI1535 is not set
1008# CONFIG_I2C_ALI1563 is not set
1009# CONFIG_I2C_ALI15X3 is not set
1010# CONFIG_I2C_AMD756 is not set
1011# CONFIG_I2C_AMD8111 is not set
1012# CONFIG_I2C_I801 is not set
1013# CONFIG_I2C_I810 is not set
1014# CONFIG_I2C_PIIX4 is not set
1015CONFIG_I2C_MPC=y
1016# CONFIG_I2C_NFORCE2 is not set
1017# CONFIG_I2C_OCORES is not set
1018# CONFIG_I2C_PARPORT_LIGHT is not set
1019# CONFIG_I2C_PROSAVAGE is not set
1020# CONFIG_I2C_SAVAGE4 is not set
1021# CONFIG_I2C_SIMTEC is not set
1022# CONFIG_I2C_SIS5595 is not set
1023# CONFIG_I2C_SIS630 is not set
1024# CONFIG_I2C_SIS96X is not set
1025# CONFIG_I2C_TAOS_EVM is not set
1026# CONFIG_I2C_STUB is not set
1027# CONFIG_I2C_TINY_USB is not set
1028# CONFIG_I2C_VIA is not set
1029# CONFIG_I2C_VIAPRO is not set
1030# CONFIG_I2C_VOODOO3 is not set
1031# CONFIG_I2C_PCA_PLATFORM is not set
1032
1033#
1034# Miscellaneous I2C Chip support
1035#
1036CONFIG_DS1682=y
1037# CONFIG_SENSORS_EEPROM is not set
1038# CONFIG_SENSORS_PCF8574 is not set
1039# CONFIG_PCF8575 is not set
1040# CONFIG_SENSORS_PCF8591 is not set
1041# CONFIG_SENSORS_MAX6875 is not set
1042# CONFIG_SENSORS_TSL2550 is not set
1043# CONFIG_I2C_DEBUG_CORE is not set
1044# CONFIG_I2C_DEBUG_ALGO is not set
1045# CONFIG_I2C_DEBUG_BUS is not set
1046# CONFIG_I2C_DEBUG_CHIP is not set
1047# CONFIG_SPI is not set
1048# CONFIG_W1 is not set
1049# CONFIG_POWER_SUPPLY is not set
1050CONFIG_HWMON=y
1051# CONFIG_HWMON_VID is not set
1052# CONFIG_SENSORS_AD7418 is not set
1053# CONFIG_SENSORS_ADM1021 is not set
1054# CONFIG_SENSORS_ADM1025 is not set
1055# CONFIG_SENSORS_ADM1026 is not set
1056# CONFIG_SENSORS_ADM1029 is not set
1057# CONFIG_SENSORS_ADM1031 is not set
1058# CONFIG_SENSORS_ADM9240 is not set
1059# CONFIG_SENSORS_ADT7470 is not set
1060# CONFIG_SENSORS_ADT7473 is not set
1061# CONFIG_SENSORS_ATXP1 is not set
1062# CONFIG_SENSORS_DS1621 is not set
1063# CONFIG_SENSORS_I5K_AMB is not set
1064# CONFIG_SENSORS_F71805F is not set
1065# CONFIG_SENSORS_F71882FG is not set
1066# CONFIG_SENSORS_F75375S is not set
1067# CONFIG_SENSORS_GL518SM is not set
1068# CONFIG_SENSORS_GL520SM is not set
1069# CONFIG_SENSORS_IT87 is not set
1070# CONFIG_SENSORS_LM63 is not set
1071# CONFIG_SENSORS_LM75 is not set
1072# CONFIG_SENSORS_LM77 is not set
1073# CONFIG_SENSORS_LM78 is not set
1074# CONFIG_SENSORS_LM80 is not set
1075# CONFIG_SENSORS_LM83 is not set
1076# CONFIG_SENSORS_LM85 is not set
1077# CONFIG_SENSORS_LM87 is not set
1078CONFIG_SENSORS_LM90=y
1079CONFIG_SENSORS_LM92=y
1080# CONFIG_SENSORS_LM93 is not set
1081# CONFIG_SENSORS_MAX1619 is not set
1082# CONFIG_SENSORS_MAX6650 is not set
1083# CONFIG_SENSORS_PC87360 is not set
1084# CONFIG_SENSORS_PC87427 is not set
1085# CONFIG_SENSORS_SIS5595 is not set
1086# CONFIG_SENSORS_DME1737 is not set
1087# CONFIG_SENSORS_SMSC47M1 is not set
1088# CONFIG_SENSORS_SMSC47M192 is not set
1089# CONFIG_SENSORS_SMSC47B397 is not set
1090# CONFIG_SENSORS_ADS7828 is not set
1091# CONFIG_SENSORS_THMC50 is not set
1092# CONFIG_SENSORS_VIA686A is not set
1093# CONFIG_SENSORS_VT1211 is not set
1094# CONFIG_SENSORS_VT8231 is not set
1095# CONFIG_SENSORS_W83781D is not set
1096# CONFIG_SENSORS_W83791D is not set
1097# CONFIG_SENSORS_W83792D is not set
1098# CONFIG_SENSORS_W83793 is not set
1099# CONFIG_SENSORS_W83L785TS is not set
1100# CONFIG_SENSORS_W83L786NG is not set
1101# CONFIG_SENSORS_W83627HF is not set
1102# CONFIG_SENSORS_W83627EHF is not set
1103# CONFIG_HWMON_DEBUG_CHIP is not set
1104# CONFIG_THERMAL is not set
1105CONFIG_WATCHDOG=y
1106# CONFIG_WATCHDOG_NOWAYOUT is not set
1107
1108#
1109# Watchdog Device Drivers
1110#
1111# CONFIG_SOFT_WATCHDOG is not set
1112
1113#
1114# PCI-based Watchdog Cards
1115#
1116# CONFIG_PCIPCWATCHDOG is not set
1117# CONFIG_WDTPCI is not set
1118
1119#
1120# USB-based Watchdog Cards
1121#
1122# CONFIG_USBPCWATCHDOG is not set
1123
1124#
1125# Sonics Silicon Backplane
1126#
1127CONFIG_SSB_POSSIBLE=y
1128# CONFIG_SSB is not set
1129
1130#
1131# Multifunction device drivers
1132#
1133# CONFIG_MFD_SM501 is not set
1134# CONFIG_HTC_PASIC3 is not set
1135
1136#
1137# Multimedia devices
1138#
1139
1140#
1141# Multimedia core support
1142#
1143# CONFIG_VIDEO_DEV is not set
1144# CONFIG_DVB_CORE is not set
1145# CONFIG_VIDEO_MEDIA is not set
1146
1147#
1148# Multimedia drivers
1149#
1150CONFIG_DAB=y
1151# CONFIG_USB_DABUSB is not set
1152
1153#
1154# Graphics support
1155#
1156# CONFIG_AGP is not set
1157# CONFIG_DRM is not set
1158# CONFIG_VGASTATE is not set
1159CONFIG_VIDEO_OUTPUT_CONTROL=m
1160# CONFIG_FB is not set
1161# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1162
1163#
1164# Display device support
1165#
1166# CONFIG_DISPLAY_SUPPORT is not set
1167
1168#
1169# Console display driver support
1170#
1171CONFIG_VGA_CONSOLE=y
1172# CONFIG_VGACON_SOFT_SCROLLBACK is not set
1173CONFIG_DUMMY_CONSOLE=y
1174
1175#
1176# Sound
1177#
1178# CONFIG_SOUND is not set
1179CONFIG_HID_SUPPORT=y
1180CONFIG_HID=y
1181# CONFIG_HID_DEBUG is not set
1182# CONFIG_HIDRAW is not set
1183
1184#
1185# USB Input Devices
1186#
1187CONFIG_USB_HID=y
1188# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1189# CONFIG_HID_FF is not set
1190# CONFIG_USB_HIDDEV is not set
1191CONFIG_USB_SUPPORT=y
1192CONFIG_USB_ARCH_HAS_HCD=y
1193CONFIG_USB_ARCH_HAS_OHCI=y
1194CONFIG_USB_ARCH_HAS_EHCI=y
1195CONFIG_USB=y
1196# CONFIG_USB_DEBUG is not set
1197# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1198
1199#
1200# Miscellaneous USB options
1201#
1202# CONFIG_USB_DEVICEFS is not set
1203# CONFIG_USB_DEVICE_CLASS is not set
1204# CONFIG_USB_DYNAMIC_MINORS is not set
1205# CONFIG_USB_OTG is not set
1206# CONFIG_USB_OTG_WHITELIST is not set
1207# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1208
1209#
1210# USB Host Controller Drivers
1211#
1212# CONFIG_USB_C67X00_HCD is not set
1213CONFIG_USB_EHCI_HCD=y
1214# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1215# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1216# CONFIG_USB_EHCI_FSL is not set
1217# CONFIG_USB_EHCI_HCD_PPC_OF is not set
1218# CONFIG_USB_ISP116X_HCD is not set
1219# CONFIG_USB_ISP1760_HCD is not set
1220CONFIG_USB_OHCI_HCD=y
1221# CONFIG_USB_OHCI_HCD_PPC_OF is not set
1222# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1223# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1224CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1225# CONFIG_USB_UHCI_HCD is not set
1226# CONFIG_USB_SL811_HCD is not set
1227# CONFIG_USB_R8A66597_HCD is not set
1228
1229#
1230# USB Device Class drivers
1231#
1232# CONFIG_USB_ACM is not set
1233# CONFIG_USB_PRINTER is not set
1234# CONFIG_USB_WDM is not set
1235
1236#
1237# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1238#
1239
1240#
1241# may also be needed; see USB_STORAGE Help for more information
1242#
1243CONFIG_USB_STORAGE=y
1244# CONFIG_USB_STORAGE_DEBUG is not set
1245# CONFIG_USB_STORAGE_DATAFAB is not set
1246# CONFIG_USB_STORAGE_FREECOM is not set
1247# CONFIG_USB_STORAGE_ISD200 is not set
1248# CONFIG_USB_STORAGE_DPCM is not set
1249# CONFIG_USB_STORAGE_USBAT is not set
1250# CONFIG_USB_STORAGE_SDDR09 is not set
1251# CONFIG_USB_STORAGE_SDDR55 is not set
1252# CONFIG_USB_STORAGE_JUMPSHOT is not set
1253# CONFIG_USB_STORAGE_ALAUDA is not set
1254# CONFIG_USB_STORAGE_ONETOUCH is not set
1255# CONFIG_USB_STORAGE_KARMA is not set
1256# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1257# CONFIG_USB_LIBUSUAL is not set
1258
1259#
1260# USB Imaging devices
1261#
1262# CONFIG_USB_MDC800 is not set
1263# CONFIG_USB_MICROTEK is not set
1264# CONFIG_USB_MON is not set
1265
1266#
1267# USB port drivers
1268#
1269# CONFIG_USB_SERIAL is not set
1270
1271#
1272# USB Miscellaneous drivers
1273#
1274# CONFIG_USB_EMI62 is not set
1275# CONFIG_USB_EMI26 is not set
1276# CONFIG_USB_ADUTUX is not set
1277# CONFIG_USB_AUERSWALD is not set
1278# CONFIG_USB_RIO500 is not set
1279# CONFIG_USB_LEGOTOWER is not set
1280# CONFIG_USB_LCD is not set
1281# CONFIG_USB_BERRY_CHARGE is not set
1282# CONFIG_USB_LED is not set
1283# CONFIG_USB_CYPRESS_CY7C63 is not set
1284# CONFIG_USB_CYTHERM is not set
1285# CONFIG_USB_PHIDGET is not set
1286# CONFIG_USB_IDMOUSE is not set
1287# CONFIG_USB_FTDI_ELAN is not set
1288# CONFIG_USB_APPLEDISPLAY is not set
1289# CONFIG_USB_SISUSBVGA is not set
1290# CONFIG_USB_LD is not set
1291# CONFIG_USB_TRANCEVIBRATOR is not set
1292# CONFIG_USB_IOWARRIOR is not set
1293# CONFIG_USB_ISIGHTFW is not set
1294# CONFIG_USB_ATM is not set
1295# CONFIG_USB_GADGET is not set
1296# CONFIG_MMC is not set
1297# CONFIG_MEMSTICK is not set
1298# CONFIG_NEW_LEDS is not set
1299# CONFIG_ACCESSIBILITY is not set
1300# CONFIG_INFINIBAND is not set
1301# CONFIG_EDAC is not set
1302CONFIG_RTC_LIB=m
1303CONFIG_RTC_CLASS=m
1304
1305#
1306# RTC interfaces
1307#
1308CONFIG_RTC_INTF_SYSFS=y
1309# CONFIG_RTC_INTF_PROC is not set
1310CONFIG_RTC_INTF_DEV=y
1311# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1312# CONFIG_RTC_DRV_TEST is not set
1313
1314#
1315# I2C RTC drivers
1316#
1317# CONFIG_RTC_DRV_DS1307 is not set
1318# CONFIG_RTC_DRV_DS1374 is not set
1319# CONFIG_RTC_DRV_DS1672 is not set
1320# CONFIG_RTC_DRV_MAX6900 is not set
1321# CONFIG_RTC_DRV_RS5C372 is not set
1322# CONFIG_RTC_DRV_ISL1208 is not set
1323# CONFIG_RTC_DRV_X1205 is not set
1324# CONFIG_RTC_DRV_PCF8563 is not set
1325# CONFIG_RTC_DRV_PCF8583 is not set
1326# CONFIG_RTC_DRV_M41T80 is not set
1327# CONFIG_RTC_DRV_S35390A is not set
1328
1329#
1330# SPI RTC drivers
1331#
1332
1333#
1334# Platform RTC drivers
1335#
1336# CONFIG_RTC_DRV_CMOS is not set
1337# CONFIG_RTC_DRV_DS1511 is not set
1338# CONFIG_RTC_DRV_DS1553 is not set
1339# CONFIG_RTC_DRV_DS1742 is not set
1340# CONFIG_RTC_DRV_STK17TA8 is not set
1341# CONFIG_RTC_DRV_M48T86 is not set
1342# CONFIG_RTC_DRV_M48T59 is not set
1343# CONFIG_RTC_DRV_V3020 is not set
1344
1345#
1346# on-CPU RTC drivers
1347#
1348# CONFIG_RTC_DRV_PPC is not set
1349# CONFIG_DMADEVICES is not set
1350# CONFIG_UIO is not set
1351
1352#
1353# File systems
1354#
1355CONFIG_EXT2_FS=y
1356CONFIG_EXT2_FS_XATTR=y
1357CONFIG_EXT2_FS_POSIX_ACL=y
1358# CONFIG_EXT2_FS_SECURITY is not set
1359# CONFIG_EXT2_FS_XIP is not set
1360CONFIG_EXT3_FS=y
1361CONFIG_EXT3_FS_XATTR=y
1362CONFIG_EXT3_FS_POSIX_ACL=y
1363# CONFIG_EXT3_FS_SECURITY is not set
1364# CONFIG_EXT4DEV_FS is not set
1365CONFIG_JBD=y
1366CONFIG_FS_MBCACHE=y
1367# CONFIG_REISERFS_FS is not set
1368# CONFIG_JFS_FS is not set
1369CONFIG_FS_POSIX_ACL=y
1370# CONFIG_XFS_FS is not set
1371# CONFIG_OCFS2_FS is not set
1372CONFIG_DNOTIFY=y
1373CONFIG_INOTIFY=y
1374CONFIG_INOTIFY_USER=y
1375# CONFIG_QUOTA is not set
1376# CONFIG_AUTOFS_FS is not set
1377# CONFIG_AUTOFS4_FS is not set
1378# CONFIG_FUSE_FS is not set
1379
1380#
1381# CD-ROM/DVD Filesystems
1382#
1383# CONFIG_ISO9660_FS is not set
1384# CONFIG_UDF_FS is not set
1385
1386#
1387# DOS/FAT/NT Filesystems
1388#
1389CONFIG_FAT_FS=y
1390CONFIG_MSDOS_FS=y
1391CONFIG_VFAT_FS=y
1392CONFIG_FAT_DEFAULT_CODEPAGE=437
1393CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1394# CONFIG_NTFS_FS is not set
1395
1396#
1397# Pseudo filesystems
1398#
1399CONFIG_PROC_FS=y
1400CONFIG_PROC_KCORE=y
1401CONFIG_PROC_SYSCTL=y
1402CONFIG_SYSFS=y
1403CONFIG_TMPFS=y
1404# CONFIG_TMPFS_POSIX_ACL is not set
1405# CONFIG_HUGETLB_PAGE is not set
1406# CONFIG_CONFIGFS_FS is not set
1407
1408#
1409# Miscellaneous filesystems
1410#
1411# CONFIG_ADFS_FS is not set
1412# CONFIG_AFFS_FS is not set
1413# CONFIG_HFS_FS is not set
1414# CONFIG_HFSPLUS_FS is not set
1415# CONFIG_BEFS_FS is not set
1416# CONFIG_BFS_FS is not set
1417# CONFIG_EFS_FS is not set
1418# CONFIG_JFFS2_FS is not set
1419# CONFIG_CRAMFS is not set
1420# CONFIG_VXFS_FS is not set
1421# CONFIG_MINIX_FS is not set
1422# CONFIG_HPFS_FS is not set
1423# CONFIG_QNX4FS_FS is not set
1424# CONFIG_ROMFS_FS is not set
1425# CONFIG_SYSV_FS is not set
1426# CONFIG_UFS_FS is not set
1427CONFIG_NETWORK_FILESYSTEMS=y
1428CONFIG_NFS_FS=y
1429CONFIG_NFS_V3=y
1430# CONFIG_NFS_V3_ACL is not set
1431CONFIG_NFS_V4=y
1432# CONFIG_NFSD is not set
1433CONFIG_ROOT_NFS=y
1434CONFIG_LOCKD=y
1435CONFIG_LOCKD_V4=y
1436CONFIG_NFS_COMMON=y
1437CONFIG_SUNRPC=y
1438CONFIG_SUNRPC_GSS=y
1439# CONFIG_SUNRPC_BIND34 is not set
1440CONFIG_RPCSEC_GSS_KRB5=y
1441# CONFIG_RPCSEC_GSS_SPKM3 is not set
1442# CONFIG_SMB_FS is not set
1443CONFIG_CIFS=m
1444# CONFIG_CIFS_STATS is not set
1445# CONFIG_CIFS_WEAK_PW_HASH is not set
1446CONFIG_CIFS_XATTR=y
1447CONFIG_CIFS_POSIX=y
1448# CONFIG_CIFS_DEBUG2 is not set
1449# CONFIG_CIFS_EXPERIMENTAL is not set
1450# CONFIG_NCP_FS is not set
1451# CONFIG_CODA_FS is not set
1452# CONFIG_AFS_FS is not set
1453
1454#
1455# Partition Types
1456#
1457# CONFIG_PARTITION_ADVANCED is not set
1458CONFIG_MSDOS_PARTITION=y
1459CONFIG_NLS=y
1460CONFIG_NLS_DEFAULT="iso8859-1"
1461CONFIG_NLS_CODEPAGE_437=m
1462CONFIG_NLS_CODEPAGE_737=m
1463CONFIG_NLS_CODEPAGE_775=m
1464CONFIG_NLS_CODEPAGE_850=m
1465CONFIG_NLS_CODEPAGE_852=m
1466CONFIG_NLS_CODEPAGE_855=m
1467CONFIG_NLS_CODEPAGE_857=m
1468CONFIG_NLS_CODEPAGE_860=m
1469CONFIG_NLS_CODEPAGE_861=m
1470CONFIG_NLS_CODEPAGE_862=m
1471CONFIG_NLS_CODEPAGE_863=m
1472CONFIG_NLS_CODEPAGE_864=m
1473CONFIG_NLS_CODEPAGE_865=m
1474CONFIG_NLS_CODEPAGE_866=m
1475CONFIG_NLS_CODEPAGE_869=m
1476CONFIG_NLS_CODEPAGE_936=m
1477CONFIG_NLS_CODEPAGE_950=m
1478CONFIG_NLS_CODEPAGE_932=m
1479CONFIG_NLS_CODEPAGE_949=m
1480CONFIG_NLS_CODEPAGE_874=m
1481CONFIG_NLS_ISO8859_8=m
1482CONFIG_NLS_CODEPAGE_1250=m
1483CONFIG_NLS_CODEPAGE_1251=m
1484CONFIG_NLS_ASCII=m
1485CONFIG_NLS_ISO8859_1=m
1486CONFIG_NLS_ISO8859_2=m
1487CONFIG_NLS_ISO8859_3=m
1488CONFIG_NLS_ISO8859_4=m
1489CONFIG_NLS_ISO8859_5=m
1490CONFIG_NLS_ISO8859_6=m
1491CONFIG_NLS_ISO8859_7=m
1492CONFIG_NLS_ISO8859_9=m
1493CONFIG_NLS_ISO8859_13=m
1494CONFIG_NLS_ISO8859_14=m
1495CONFIG_NLS_ISO8859_15=m
1496CONFIG_NLS_KOI8_R=m
1497CONFIG_NLS_KOI8_U=m
1498CONFIG_NLS_UTF8=m
1499# CONFIG_DLM is not set
1500
1501#
1502# Library routines
1503#
1504CONFIG_BITREVERSE=y
1505# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1506CONFIG_CRC_CCITT=m
1507# CONFIG_CRC16 is not set
1508# CONFIG_CRC_ITU_T is not set
1509CONFIG_CRC32=y
1510# CONFIG_CRC7 is not set
1511CONFIG_LIBCRC32C=m
1512CONFIG_ZLIB_INFLATE=m
1513CONFIG_ZLIB_DEFLATE=m
1514CONFIG_PLIST=y
1515CONFIG_HAS_IOMEM=y
1516CONFIG_HAS_IOPORT=y
1517CONFIG_HAS_DMA=y
1518CONFIG_HAVE_LMB=y
1519
1520#
1521# Kernel hacking
1522#
1523# CONFIG_PRINTK_TIME is not set
1524CONFIG_ENABLE_WARN_DEPRECATED=y
1525CONFIG_ENABLE_MUST_CHECK=y
1526CONFIG_FRAME_WARN=1024
1527CONFIG_MAGIC_SYSRQ=y
1528# CONFIG_UNUSED_SYMBOLS is not set
1529# CONFIG_DEBUG_FS is not set
1530# CONFIG_HEADERS_CHECK is not set
1531CONFIG_DEBUG_KERNEL=y
1532# CONFIG_DEBUG_SHIRQ is not set
1533CONFIG_DETECT_SOFTLOCKUP=y
1534CONFIG_SCHED_DEBUG=y
1535# CONFIG_SCHEDSTATS is not set
1536# CONFIG_TIMER_STATS is not set
1537# CONFIG_DEBUG_OBJECTS is not set
1538# CONFIG_DEBUG_SLAB is not set
1539# CONFIG_DEBUG_RT_MUTEXES is not set
1540# CONFIG_RT_MUTEX_TESTER is not set
1541# CONFIG_DEBUG_SPINLOCK is not set
1542# CONFIG_DEBUG_MUTEXES is not set
1543# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1544# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1545# CONFIG_DEBUG_KOBJECT is not set
1546# CONFIG_DEBUG_BUGVERBOSE is not set
1547CONFIG_DEBUG_INFO=y
1548# CONFIG_DEBUG_VM is not set
1549# CONFIG_DEBUG_WRITECOUNT is not set
1550# CONFIG_DEBUG_LIST is not set
1551# CONFIG_DEBUG_SG is not set
1552# CONFIG_BOOT_PRINTK_DELAY is not set
1553# CONFIG_RCU_TORTURE_TEST is not set
1554# CONFIG_BACKTRACE_SELF_TEST is not set
1555# CONFIG_FAULT_INJECTION is not set
1556# CONFIG_SAMPLES is not set
1557# CONFIG_DEBUG_STACKOVERFLOW is not set
1558# CONFIG_DEBUG_STACK_USAGE is not set
1559# CONFIG_DEBUG_PAGEALLOC is not set
1560CONFIG_DEBUGGER=y
1561# CONFIG_XMON is not set
1562# CONFIG_IRQSTACKS is not set
1563# CONFIG_BDI_SWITCH is not set
1564# CONFIG_PPC_EARLY_DEBUG is not set
1565
1566#
1567# Security options
1568#
1569# CONFIG_KEYS is not set
1570CONFIG_SECURITY=y
1571CONFIG_SECURITY_NETWORK=y
1572# CONFIG_SECURITY_NETWORK_XFRM is not set
1573CONFIG_SECURITY_CAPABILITIES=y
1574# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1575# CONFIG_SECURITY_ROOTPLUG is not set
1576CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1577CONFIG_CRYPTO=y
1578
1579#
1580# Crypto core or helper
1581#
1582CONFIG_CRYPTO_ALGAPI=y
1583CONFIG_CRYPTO_AEAD=m
1584CONFIG_CRYPTO_BLKCIPHER=y
1585CONFIG_CRYPTO_HASH=y
1586CONFIG_CRYPTO_MANAGER=y
1587# CONFIG_CRYPTO_GF128MUL is not set
1588CONFIG_CRYPTO_NULL=m
1589# CONFIG_CRYPTO_CRYPTD is not set
1590CONFIG_CRYPTO_AUTHENC=m
1591CONFIG_CRYPTO_TEST=m
1592
1593#
1594# Authenticated Encryption with Associated Data
1595#
1596# CONFIG_CRYPTO_CCM is not set
1597# CONFIG_CRYPTO_GCM is not set
1598# CONFIG_CRYPTO_SEQIV is not set
1599
1600#
1601# Block modes
1602#
1603CONFIG_CRYPTO_CBC=y
1604# CONFIG_CRYPTO_CTR is not set
1605# CONFIG_CRYPTO_CTS is not set
1606CONFIG_CRYPTO_ECB=m
1607# CONFIG_CRYPTO_LRW is not set
1608CONFIG_CRYPTO_PCBC=m
1609# CONFIG_CRYPTO_XTS is not set
1610
1611#
1612# Hash modes
1613#
1614CONFIG_CRYPTO_HMAC=y
1615# CONFIG_CRYPTO_XCBC is not set
1616
1617#
1618# Digest
1619#
1620CONFIG_CRYPTO_CRC32C=m
1621CONFIG_CRYPTO_MD4=m
1622CONFIG_CRYPTO_MD5=y
1623CONFIG_CRYPTO_MICHAEL_MIC=m
1624CONFIG_CRYPTO_SHA1=m
1625CONFIG_CRYPTO_SHA256=m
1626CONFIG_CRYPTO_SHA512=m
1627# CONFIG_CRYPTO_TGR192 is not set
1628CONFIG_CRYPTO_WP512=m
1629
1630#
1631# Ciphers
1632#
1633CONFIG_CRYPTO_AES=m
1634CONFIG_CRYPTO_ANUBIS=m
1635CONFIG_CRYPTO_ARC4=m
1636CONFIG_CRYPTO_BLOWFISH=m
1637# CONFIG_CRYPTO_CAMELLIA is not set
1638CONFIG_CRYPTO_CAST5=m
1639CONFIG_CRYPTO_CAST6=m
1640CONFIG_CRYPTO_DES=y
1641# CONFIG_CRYPTO_FCRYPT is not set
1642CONFIG_CRYPTO_KHAZAD=m
1643# CONFIG_CRYPTO_SALSA20 is not set
1644# CONFIG_CRYPTO_SEED is not set
1645CONFIG_CRYPTO_SERPENT=m
1646CONFIG_CRYPTO_TEA=m
1647CONFIG_CRYPTO_TWOFISH=m
1648CONFIG_CRYPTO_TWOFISH_COMMON=m
1649
1650#
1651# Compression
1652#
1653CONFIG_CRYPTO_DEFLATE=m
1654# CONFIG_CRYPTO_LZO is not set
1655# CONFIG_CRYPTO_HW is not set
1656# CONFIG_PPC_CLOCK is not set
1657# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/mpc8610_hpcd_defconfig b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
index 1a9990731eb0..c98c6ee44492 100644
--- a/arch/powerpc/configs/mpc8610_hpcd_defconfig
+++ b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
@@ -165,11 +165,11 @@ CONFIG_CLASSIC_RCU=y
165# 165#
166CONFIG_PPC_MULTIPLATFORM=y 166CONFIG_PPC_MULTIPLATFORM=y
167CONFIG_CLASSIC32=y 167CONFIG_CLASSIC32=y
168CONFIG_PPC_CHRP=y 168# CONFIG_PPC_CHRP is not set
169# CONFIG_PPC_PMAC is not set
169# CONFIG_MPC5121_ADS is not set 170# CONFIG_MPC5121_ADS is not set
170# CONFIG_MPC5121_GENERIC is not set 171# CONFIG_MPC5121_GENERIC is not set
171# CONFIG_PPC_MPC52xx is not set 172# CONFIG_PPC_MPC52xx is not set
172CONFIG_PPC_PMAC=y
173# CONFIG_PPC_CELL is not set 173# CONFIG_PPC_CELL is not set
174# CONFIG_PPC_CELL_NATIVE is not set 174# CONFIG_PPC_CELL_NATIVE is not set
175# CONFIG_PPC_82xx is not set 175# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/mpc8641_hpcn_defconfig b/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
index ea09be31b6ea..444ddf98436d 100644
--- a/arch/powerpc/configs/mpc8641_hpcn_defconfig
+++ b/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
@@ -167,11 +167,11 @@ CONFIG_CLASSIC_RCU=y
167# 167#
168CONFIG_PPC_MULTIPLATFORM=y 168CONFIG_PPC_MULTIPLATFORM=y
169CONFIG_CLASSIC32=y 169CONFIG_CLASSIC32=y
170CONFIG_PPC_CHRP=y 170# CONFIG_PPC_CHRP is not set
171# CONFIG_PPC_PMAC is not set
171# CONFIG_MPC5121_ADS is not set 172# CONFIG_MPC5121_ADS is not set
172# CONFIG_MPC5121_GENERIC is not set 173# CONFIG_MPC5121_GENERIC is not set
173# CONFIG_PPC_MPC52xx is not set 174# CONFIG_PPC_MPC52xx is not set
174CONFIG_PPC_PMAC=y
175# CONFIG_PPC_CELL is not set 175# CONFIG_PPC_CELL is not set
176# CONFIG_PPC_CELL_NATIVE is not set 176# CONFIG_PPC_CELL_NATIVE is not set
177# CONFIG_PPC_82xx is not set 177# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/sbc8641d_defconfig b/arch/powerpc/configs/86xx/sbc8641d_defconfig
index f545421f9857..d900f8f376cf 100644
--- a/arch/powerpc/configs/sbc8641d_defconfig
+++ b/arch/powerpc/configs/86xx/sbc8641d_defconfig
@@ -166,11 +166,11 @@ CONFIG_CLASSIC_RCU=y
166# 166#
167CONFIG_PPC_MULTIPLATFORM=y 167CONFIG_PPC_MULTIPLATFORM=y
168CONFIG_CLASSIC32=y 168CONFIG_CLASSIC32=y
169CONFIG_PPC_CHRP=y 169# CONFIG_PPC_CHRP is not set
170# CONFIG_PPC_PMAC is not set
170# CONFIG_MPC5121_ADS is not set 171# CONFIG_MPC5121_ADS is not set
171# CONFIG_MPC5121_GENERIC is not set 172# CONFIG_MPC5121_GENERIC is not set
172# CONFIG_PPC_MPC52xx is not set 173# CONFIG_PPC_MPC52xx is not set
173CONFIG_PPC_PMAC=y
174# CONFIG_PPC_CELL is not set 174# CONFIG_PPC_CELL is not set
175# CONFIG_PPC_CELL_NATIVE is not set 175# CONFIG_PPC_CELL_NATIVE is not set
176# CONFIG_PPC_82xx is not set 176# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/ep8248e_defconfig b/arch/powerpc/configs/ep8248e_defconfig
index ef0c6e800508..cd691f770810 100644
--- a/arch/powerpc/configs/ep8248e_defconfig
+++ b/arch/powerpc/configs/ep8248e_defconfig
@@ -150,11 +150,11 @@ CONFIG_CLASSIC_RCU=y
150# 150#
151CONFIG_PPC_MULTIPLATFORM=y 151CONFIG_PPC_MULTIPLATFORM=y
152CONFIG_CLASSIC32=y 152CONFIG_CLASSIC32=y
153CONFIG_PPC_CHRP=y 153# CONFIG_PPC_CHRP is not set
154# CONFIG_PPC_PMAC is not set
154# CONFIG_MPC5121_ADS is not set 155# CONFIG_MPC5121_ADS is not set
155# CONFIG_MPC5121_GENERIC is not set 156# CONFIG_MPC5121_GENERIC is not set
156# CONFIG_PPC_MPC52xx is not set 157# CONFIG_PPC_MPC52xx is not set
157CONFIG_PPC_PMAC=y
158# CONFIG_PPC_CELL is not set 158# CONFIG_PPC_CELL is not set
159# CONFIG_PPC_CELL_NATIVE is not set 159# CONFIG_PPC_CELL_NATIVE is not set
160CONFIG_PPC_82xx=y 160CONFIG_PPC_82xx=y
diff --git a/arch/powerpc/configs/mgcoge_defconfig b/arch/powerpc/configs/mgcoge_defconfig
new file mode 100644
index 000000000000..cc9eaba8c9c9
--- /dev/null
+++ b/arch/powerpc/configs/mgcoge_defconfig
@@ -0,0 +1,900 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc2
4# Thu May 22 08:18:47 2008
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11CONFIG_6xx=y
12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set
15# CONFIG_44x is not set
16# CONFIG_E200 is not set
17CONFIG_PPC_FPU=y
18CONFIG_PPC_STD_MMU=y
19CONFIG_PPC_STD_MMU_32=y
20# CONFIG_PPC_MM_SLICES is not set
21# CONFIG_SMP is not set
22CONFIG_PPC32=y
23CONFIG_WORD_SIZE=32
24CONFIG_PPC_MERGE=y
25CONFIG_MMU=y
26CONFIG_GENERIC_CMOS_UPDATE=y
27CONFIG_GENERIC_TIME=y
28CONFIG_GENERIC_TIME_VSYSCALL=y
29CONFIG_GENERIC_CLOCKEVENTS=y
30CONFIG_GENERIC_HARDIRQS=y
31# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
32CONFIG_IRQ_PER_CPU=y
33CONFIG_STACKTRACE_SUPPORT=y
34CONFIG_LOCKDEP_SUPPORT=y
35CONFIG_RWSEM_XCHGADD_ALGORITHM=y
36CONFIG_ARCH_HAS_ILOG2_U32=y
37CONFIG_GENERIC_HWEIGHT=y
38CONFIG_GENERIC_CALIBRATE_DELAY=y
39CONFIG_GENERIC_FIND_NEXT_BIT=y
40# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
41CONFIG_PPC=y
42CONFIG_EARLY_PRINTK=y
43CONFIG_GENERIC_NVRAM=y
44CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
45CONFIG_ARCH_MAY_HAVE_PC_FDC=y
46CONFIG_PPC_OF=y
47CONFIG_OF=y
48# CONFIG_PPC_UDBG_16550 is not set
49# CONFIG_GENERIC_TBSYNC is not set
50CONFIG_AUDIT_ARCH=y
51CONFIG_GENERIC_BUG=y
52# CONFIG_DEFAULT_UIMAGE is not set
53# CONFIG_PPC_DCR_NATIVE is not set
54# CONFIG_PPC_DCR_MMIO is not set
55CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
56
57#
58# General setup
59#
60# CONFIG_EXPERIMENTAL is not set
61CONFIG_BROKEN_ON_SMP=y
62CONFIG_INIT_ENV_ARG_LIMIT=32
63CONFIG_LOCALVERSION=""
64CONFIG_LOCALVERSION_AUTO=y
65CONFIG_SWAP=y
66CONFIG_SYSVIPC=y
67CONFIG_SYSVIPC_SYSCTL=y
68# CONFIG_BSD_PROCESS_ACCT is not set
69# CONFIG_TASKSTATS is not set
70# CONFIG_AUDIT is not set
71CONFIG_IKCONFIG=y
72CONFIG_IKCONFIG_PROC=y
73CONFIG_LOG_BUF_SHIFT=14
74# CONFIG_CGROUPS is not set
75CONFIG_SYSFS_DEPRECATED=y
76CONFIG_SYSFS_DEPRECATED_V2=y
77# CONFIG_RELAY is not set
78# CONFIG_NAMESPACES is not set
79CONFIG_BLK_DEV_INITRD=y
80CONFIG_INITRAMFS_SOURCE=""
81CONFIG_CC_OPTIMIZE_FOR_SIZE=y
82CONFIG_SYSCTL=y
83CONFIG_EMBEDDED=y
84CONFIG_SYSCTL_SYSCALL=y
85CONFIG_SYSCTL_SYSCALL_CHECK=y
86CONFIG_KALLSYMS=y
87CONFIG_KALLSYMS_ALL=y
88# CONFIG_KALLSYMS_EXTRA_PASS is not set
89CONFIG_HOTPLUG=y
90CONFIG_PRINTK=y
91CONFIG_BUG=y
92CONFIG_ELF_CORE=y
93CONFIG_COMPAT_BRK=y
94CONFIG_BASE_FULL=y
95CONFIG_FUTEX=y
96CONFIG_ANON_INODES=y
97CONFIG_EPOLL=y
98CONFIG_SIGNALFD=y
99CONFIG_TIMERFD=y
100CONFIG_EVENTFD=y
101CONFIG_SHMEM=y
102CONFIG_VM_EVENT_COUNTERS=y
103CONFIG_SLAB=y
104# CONFIG_SLUB is not set
105# CONFIG_SLOB is not set
106# CONFIG_PROFILING is not set
107# CONFIG_MARKERS is not set
108CONFIG_HAVE_OPROFILE=y
109CONFIG_HAVE_KPROBES=y
110CONFIG_HAVE_KRETPROBES=y
111# CONFIG_HAVE_DMA_ATTRS is not set
112CONFIG_PROC_PAGE_MONITOR=y
113CONFIG_SLABINFO=y
114CONFIG_RT_MUTEXES=y
115# CONFIG_TINY_SHMEM is not set
116CONFIG_BASE_SMALL=0
117# CONFIG_MODULES is not set
118CONFIG_BLOCK=y
119# CONFIG_LBD is not set
120# CONFIG_BLK_DEV_IO_TRACE is not set
121# CONFIG_LSF is not set
122
123#
124# IO Schedulers
125#
126CONFIG_IOSCHED_NOOP=y
127# CONFIG_IOSCHED_AS is not set
128CONFIG_IOSCHED_DEADLINE=y
129# CONFIG_IOSCHED_CFQ is not set
130# CONFIG_DEFAULT_AS is not set
131CONFIG_DEFAULT_DEADLINE=y
132# CONFIG_DEFAULT_CFQ is not set
133# CONFIG_DEFAULT_NOOP is not set
134CONFIG_DEFAULT_IOSCHED="deadline"
135CONFIG_CLASSIC_RCU=y
136
137#
138# Platform support
139#
140# CONFIG_PPC_MULTIPLATFORM is not set
141CONFIG_PPC_82xx=y
142# CONFIG_PPC_83xx is not set
143# CONFIG_PPC_86xx is not set
144# CONFIG_PPC_MPC512x is not set
145# CONFIG_PPC_MPC5121 is not set
146# CONFIG_PPC_CELL is not set
147# CONFIG_PPC_CELL_NATIVE is not set
148# CONFIG_MPC8272_ADS is not set
149# CONFIG_PQ2FADS is not set
150# CONFIG_EP8248E is not set
151CONFIG_MGCOGE=y
152# CONFIG_PQ2ADS is not set
153CONFIG_8260=y
154CONFIG_8272=y
155# CONFIG_IPIC is not set
156# CONFIG_MPIC is not set
157# CONFIG_MPIC_WEIRD is not set
158# CONFIG_PPC_I8259 is not set
159# CONFIG_PPC_RTAS is not set
160# CONFIG_MMIO_NVRAM is not set
161# CONFIG_PPC_MPC106 is not set
162# CONFIG_PPC_970_NAP is not set
163# CONFIG_PPC_INDIRECT_IO is not set
164# CONFIG_GENERIC_IOMAP is not set
165# CONFIG_CPU_FREQ is not set
166CONFIG_CPM2=y
167CONFIG_PPC_CPM_NEW_BINDING=y
168# CONFIG_FSL_ULI1575 is not set
169CONFIG_CPM=y
170
171#
172# Kernel options
173#
174# CONFIG_HIGHMEM is not set
175# CONFIG_TICK_ONESHOT is not set
176# CONFIG_NO_HZ is not set
177# CONFIG_HIGH_RES_TIMERS is not set
178CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
179# CONFIG_HZ_100 is not set
180CONFIG_HZ_250=y
181# CONFIG_HZ_300 is not set
182# CONFIG_HZ_1000 is not set
183CONFIG_HZ=250
184# CONFIG_SCHED_HRTICK is not set
185CONFIG_PREEMPT_NONE=y
186# CONFIG_PREEMPT_VOLUNTARY is not set
187# CONFIG_PREEMPT is not set
188CONFIG_BINFMT_ELF=y
189CONFIG_BINFMT_MISC=y
190# CONFIG_IOMMU_HELPER is not set
191CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
192CONFIG_ARCH_HAS_WALK_MEMORY=y
193CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
194CONFIG_ARCH_FLATMEM_ENABLE=y
195CONFIG_ARCH_POPULATES_NODE_MAP=y
196CONFIG_FLATMEM=y
197CONFIG_FLAT_NODE_MEM_MAP=y
198# CONFIG_SPARSEMEM_STATIC is not set
199# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
200CONFIG_PAGEFLAGS_EXTENDED=y
201CONFIG_SPLIT_PTLOCK_CPUS=4
202# CONFIG_RESOURCES_64BIT is not set
203CONFIG_ZONE_DMA_FLAG=1
204CONFIG_BOUNCE=y
205CONFIG_VIRT_TO_BUS=y
206CONFIG_FORCE_MAX_ZONEORDER=11
207CONFIG_PROC_DEVICETREE=y
208# CONFIG_CMDLINE_BOOL is not set
209# CONFIG_PM is not set
210# CONFIG_SECCOMP is not set
211CONFIG_ISA_DMA_API=y
212
213#
214# Bus options
215#
216CONFIG_ZONE_DMA=y
217CONFIG_FSL_SOC=y
218# CONFIG_PCI is not set
219# CONFIG_PCI_DOMAINS is not set
220# CONFIG_PCI_SYSCALL is not set
221# CONFIG_ARCH_SUPPORTS_MSI is not set
222# CONFIG_PCCARD is not set
223# CONFIG_HAS_RAPIDIO is not set
224
225#
226# Advanced setup
227#
228# CONFIG_ADVANCED_OPTIONS is not set
229
230#
231# Default settings for advanced configuration options are used
232#
233CONFIG_LOWMEM_SIZE=0x30000000
234CONFIG_PAGE_OFFSET=0xc0000000
235CONFIG_KERNEL_START=0xc0000000
236CONFIG_PHYSICAL_START=0x00000000
237CONFIG_TASK_SIZE=0xc0000000
238
239#
240# Networking
241#
242CONFIG_NET=y
243
244#
245# Networking options
246#
247CONFIG_PACKET=y
248# CONFIG_PACKET_MMAP is not set
249CONFIG_UNIX=y
250CONFIG_XFRM=y
251# CONFIG_XFRM_USER is not set
252# CONFIG_NET_KEY is not set
253CONFIG_INET=y
254CONFIG_IP_MULTICAST=y
255# CONFIG_IP_ADVANCED_ROUTER is not set
256CONFIG_IP_FIB_HASH=y
257CONFIG_IP_PNP=y
258CONFIG_IP_PNP_DHCP=y
259CONFIG_IP_PNP_BOOTP=y
260# CONFIG_IP_PNP_RARP is not set
261# CONFIG_NET_IPIP is not set
262# CONFIG_NET_IPGRE is not set
263# CONFIG_IP_MROUTE is not set
264CONFIG_SYN_COOKIES=y
265# CONFIG_INET_AH is not set
266# CONFIG_INET_ESP is not set
267# CONFIG_INET_IPCOMP is not set
268# CONFIG_INET_XFRM_TUNNEL is not set
269# CONFIG_INET_TUNNEL is not set
270CONFIG_INET_XFRM_MODE_TRANSPORT=y
271CONFIG_INET_XFRM_MODE_TUNNEL=y
272CONFIG_INET_XFRM_MODE_BEET=y
273# CONFIG_INET_LRO is not set
274CONFIG_INET_DIAG=y
275CONFIG_INET_TCP_DIAG=y
276# CONFIG_TCP_CONG_ADVANCED is not set
277CONFIG_TCP_CONG_CUBIC=y
278CONFIG_DEFAULT_TCP_CONG="cubic"
279# CONFIG_IP_VS is not set
280# CONFIG_IPV6 is not set
281# CONFIG_NETWORK_SECMARK is not set
282CONFIG_NETFILTER=y
283# CONFIG_NETFILTER_DEBUG is not set
284CONFIG_NETFILTER_ADVANCED=y
285
286#
287# Core Netfilter Configuration
288#
289# CONFIG_NETFILTER_NETLINK_QUEUE is not set
290# CONFIG_NETFILTER_NETLINK_LOG is not set
291# CONFIG_NF_CONNTRACK is not set
292# CONFIG_NETFILTER_XTABLES is not set
293
294#
295# IP: Netfilter Configuration
296#
297# CONFIG_IP_NF_QUEUE is not set
298# CONFIG_IP_NF_IPTABLES is not set
299# CONFIG_IP_NF_ARPTABLES is not set
300# CONFIG_ATM is not set
301# CONFIG_BRIDGE is not set
302# CONFIG_VLAN_8021Q is not set
303# CONFIG_DECNET is not set
304# CONFIG_LLC2 is not set
305# CONFIG_IPX is not set
306# CONFIG_ATALK is not set
307# CONFIG_NET_SCHED is not set
308
309#
310# Network testing
311#
312# CONFIG_NET_PKTGEN is not set
313# CONFIG_HAMRADIO is not set
314# CONFIG_CAN is not set
315# CONFIG_IRDA is not set
316# CONFIG_BT is not set
317
318#
319# Wireless
320#
321# CONFIG_CFG80211 is not set
322# CONFIG_WIRELESS_EXT is not set
323# CONFIG_MAC80211 is not set
324# CONFIG_IEEE80211 is not set
325# CONFIG_RFKILL is not set
326
327#
328# Device Drivers
329#
330
331#
332# Generic Driver Options
333#
334CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
335CONFIG_STANDALONE=y
336CONFIG_PREVENT_FIRMWARE_BUILD=y
337# CONFIG_FW_LOADER is not set
338# CONFIG_DEBUG_DRIVER is not set
339# CONFIG_DEBUG_DEVRES is not set
340# CONFIG_SYS_HYPERVISOR is not set
341# CONFIG_CONNECTOR is not set
342CONFIG_MTD=y
343# CONFIG_MTD_DEBUG is not set
344CONFIG_MTD_CONCAT=y
345CONFIG_MTD_PARTITIONS=y
346# CONFIG_MTD_REDBOOT_PARTS is not set
347CONFIG_MTD_CMDLINE_PARTS=y
348CONFIG_MTD_OF_PARTS=y
349# CONFIG_MTD_AR7_PARTS is not set
350
351#
352# User Modules And Translation Layers
353#
354CONFIG_MTD_CHAR=y
355CONFIG_MTD_BLKDEVS=y
356# CONFIG_MTD_BLOCK is not set
357# CONFIG_MTD_BLOCK_RO is not set
358# CONFIG_FTL is not set
359# CONFIG_NFTL is not set
360# CONFIG_INFTL is not set
361# CONFIG_RFD_FTL is not set
362# CONFIG_SSFDC is not set
363# CONFIG_MTD_OOPS is not set
364
365#
366# RAM/ROM/Flash chip drivers
367#
368CONFIG_MTD_CFI=y
369# CONFIG_MTD_JEDECPROBE is not set
370CONFIG_MTD_GEN_PROBE=y
371CONFIG_MTD_CFI_ADV_OPTIONS=y
372CONFIG_MTD_CFI_NOSWAP=y
373# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
374# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
375CONFIG_MTD_CFI_GEOMETRY=y
376CONFIG_MTD_MAP_BANK_WIDTH_1=y
377CONFIG_MTD_MAP_BANK_WIDTH_2=y
378# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
379# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
380# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
381# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
382CONFIG_MTD_CFI_I1=y
383CONFIG_MTD_CFI_I2=y
384# CONFIG_MTD_CFI_I4 is not set
385# CONFIG_MTD_CFI_I8 is not set
386# CONFIG_MTD_OTP is not set
387CONFIG_MTD_CFI_INTELEXT=y
388CONFIG_MTD_CFI_AMDSTD=y
389# CONFIG_MTD_CFI_STAA is not set
390CONFIG_MTD_CFI_UTIL=y
391# CONFIG_MTD_RAM is not set
392# CONFIG_MTD_ROM is not set
393# CONFIG_MTD_ABSENT is not set
394
395#
396# Mapping drivers for chip access
397#
398# CONFIG_MTD_COMPLEX_MAPPINGS is not set
399# CONFIG_MTD_PHYSMAP is not set
400CONFIG_MTD_PHYSMAP_OF=y
401# CONFIG_MTD_PLATRAM is not set
402
403#
404# Self-contained MTD device drivers
405#
406# CONFIG_MTD_SLRAM is not set
407# CONFIG_MTD_PHRAM is not set
408# CONFIG_MTD_MTDRAM is not set
409# CONFIG_MTD_BLOCK2MTD is not set
410
411#
412# Disk-On-Chip Device Drivers
413#
414# CONFIG_MTD_DOC2000 is not set
415# CONFIG_MTD_DOC2001 is not set
416# CONFIG_MTD_DOC2001PLUS is not set
417# CONFIG_MTD_NAND is not set
418# CONFIG_MTD_ONENAND is not set
419
420#
421# UBI - Unsorted block images
422#
423# CONFIG_MTD_UBI is not set
424CONFIG_OF_DEVICE=y
425# CONFIG_PARPORT is not set
426CONFIG_BLK_DEV=y
427# CONFIG_BLK_DEV_FD is not set
428# CONFIG_BLK_DEV_COW_COMMON is not set
429CONFIG_BLK_DEV_LOOP=y
430# CONFIG_BLK_DEV_CRYPTOLOOP is not set
431# CONFIG_BLK_DEV_NBD is not set
432CONFIG_BLK_DEV_RAM=y
433CONFIG_BLK_DEV_RAM_COUNT=16
434CONFIG_BLK_DEV_RAM_SIZE=4096
435# CONFIG_BLK_DEV_XIP is not set
436# CONFIG_CDROM_PKTCDVD is not set
437# CONFIG_ATA_OVER_ETH is not set
438# CONFIG_MISC_DEVICES is not set
439CONFIG_HAVE_IDE=y
440# CONFIG_IDE is not set
441
442#
443# SCSI device support
444#
445# CONFIG_RAID_ATTRS is not set
446# CONFIG_SCSI is not set
447# CONFIG_SCSI_DMA is not set
448# CONFIG_SCSI_NETLINK is not set
449# CONFIG_ATA is not set
450# CONFIG_MD is not set
451# CONFIG_MACINTOSH_DRIVERS is not set
452CONFIG_NETDEVICES=y
453# CONFIG_NETDEVICES_MULTIQUEUE is not set
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# CONFIG_VETH is not set
459CONFIG_PHYLIB=y
460
461#
462# MII PHY device drivers
463#
464# CONFIG_MARVELL_PHY is not set
465# CONFIG_DAVICOM_PHY is not set
466# CONFIG_QSEMI_PHY is not set
467# CONFIG_LXT_PHY is not set
468# CONFIG_CICADA_PHY is not set
469# CONFIG_VITESSE_PHY is not set
470# CONFIG_SMSC_PHY is not set
471# CONFIG_BROADCOM_PHY is not set
472# CONFIG_ICPLUS_PHY is not set
473# CONFIG_REALTEK_PHY is not set
474CONFIG_FIXED_PHY=y
475# CONFIG_MDIO_BITBANG is not set
476CONFIG_NET_ETHERNET=y
477CONFIG_MII=y
478# CONFIG_IBM_NEW_EMAC_ZMII is not set
479# CONFIG_IBM_NEW_EMAC_RGMII is not set
480# CONFIG_IBM_NEW_EMAC_TAH is not set
481# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
482# CONFIG_B44 is not set
483CONFIG_FS_ENET=y
484CONFIG_FS_ENET_HAS_SCC=y
485# CONFIG_FS_ENET_HAS_FCC is not set
486# CONFIG_FS_ENET_MDIO_FCC is not set
487# CONFIG_NETDEV_1000 is not set
488# CONFIG_NETDEV_10000 is not set
489
490#
491# Wireless LAN
492#
493# CONFIG_WLAN_PRE80211 is not set
494# CONFIG_WLAN_80211 is not set
495# CONFIG_IWLWIFI_LEDS is not set
496# CONFIG_WAN is not set
497# CONFIG_PPP is not set
498# CONFIG_SLIP is not set
499# CONFIG_NETPOLL is not set
500# CONFIG_NET_POLL_CONTROLLER is not set
501# CONFIG_ISDN is not set
502# CONFIG_PHONE is not set
503
504#
505# Input device support
506#
507# CONFIG_INPUT is not set
508
509#
510# Hardware I/O ports
511#
512# CONFIG_SERIO is not set
513# CONFIG_GAMEPORT is not set
514
515#
516# Character devices
517#
518# CONFIG_VT is not set
519CONFIG_DEVKMEM=y
520# CONFIG_SERIAL_NONSTANDARD is not set
521
522#
523# Serial drivers
524#
525# CONFIG_SERIAL_8250 is not set
526
527#
528# Non-8250 serial port support
529#
530# CONFIG_SERIAL_UARTLITE is not set
531CONFIG_SERIAL_CORE=y
532CONFIG_SERIAL_CORE_CONSOLE=y
533CONFIG_SERIAL_CPM=y
534CONFIG_SERIAL_CPM_CONSOLE=y
535# CONFIG_SERIAL_CPM_SCC1 is not set
536# CONFIG_SERIAL_CPM_SCC2 is not set
537# CONFIG_SERIAL_CPM_SCC3 is not set
538# CONFIG_SERIAL_CPM_SCC4 is not set
539CONFIG_SERIAL_CPM_SMC1=y
540CONFIG_SERIAL_CPM_SMC2=y
541CONFIG_UNIX98_PTYS=y
542CONFIG_LEGACY_PTYS=y
543CONFIG_LEGACY_PTY_COUNT=256
544# CONFIG_IPMI_HANDLER is not set
545CONFIG_HW_RANDOM=y
546# CONFIG_NVRAM is not set
547# CONFIG_GEN_RTC is not set
548# CONFIG_R3964 is not set
549# CONFIG_RAW_DRIVER is not set
550# CONFIG_I2C is not set
551# CONFIG_SPI is not set
552# CONFIG_W1 is not set
553# CONFIG_POWER_SUPPLY is not set
554# CONFIG_HWMON is not set
555# CONFIG_THERMAL is not set
556# CONFIG_WATCHDOG is not set
557
558#
559# Sonics Silicon Backplane
560#
561CONFIG_SSB_POSSIBLE=y
562# CONFIG_SSB is not set
563
564#
565# Multifunction device drivers
566#
567# CONFIG_MFD_SM501 is not set
568# CONFIG_HTC_PASIC3 is not set
569
570#
571# Multimedia devices
572#
573
574#
575# Multimedia core support
576#
577# CONFIG_VIDEO_DEV is not set
578# CONFIG_DVB_CORE is not set
579# CONFIG_VIDEO_MEDIA is not set
580
581#
582# Multimedia drivers
583#
584# CONFIG_DAB is not set
585
586#
587# Graphics support
588#
589# CONFIG_VGASTATE is not set
590# CONFIG_VIDEO_OUTPUT_CONTROL is not set
591# CONFIG_FB is not set
592# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
593
594#
595# Display device support
596#
597# CONFIG_DISPLAY_SUPPORT is not set
598
599#
600# Sound
601#
602# CONFIG_SOUND is not set
603# CONFIG_USB_SUPPORT is not set
604# CONFIG_MMC is not set
605# CONFIG_MEMSTICK is not set
606# CONFIG_NEW_LEDS is not set
607# CONFIG_ACCESSIBILITY is not set
608# CONFIG_RTC_CLASS is not set
609# CONFIG_DMADEVICES is not set
610# CONFIG_UIO is not set
611
612#
613# File systems
614#
615CONFIG_EXT2_FS=y
616# CONFIG_EXT2_FS_XATTR is not set
617# CONFIG_EXT2_FS_XIP is not set
618CONFIG_EXT3_FS=y
619# CONFIG_EXT3_FS_XATTR is not set
620CONFIG_JBD=y
621# CONFIG_JBD_DEBUG is not set
622# CONFIG_REISERFS_FS is not set
623# CONFIG_JFS_FS is not set
624# CONFIG_FS_POSIX_ACL is not set
625# CONFIG_XFS_FS is not set
626# CONFIG_OCFS2_FS is not set
627CONFIG_DNOTIFY=y
628CONFIG_INOTIFY=y
629CONFIG_INOTIFY_USER=y
630# CONFIG_QUOTA is not set
631# CONFIG_AUTOFS_FS is not set
632CONFIG_AUTOFS4_FS=y
633# CONFIG_FUSE_FS is not set
634
635#
636# CD-ROM/DVD Filesystems
637#
638# CONFIG_ISO9660_FS is not set
639# CONFIG_UDF_FS is not set
640
641#
642# DOS/FAT/NT Filesystems
643#
644# CONFIG_MSDOS_FS is not set
645# CONFIG_VFAT_FS is not set
646# CONFIG_NTFS_FS is not set
647
648#
649# Pseudo filesystems
650#
651CONFIG_PROC_FS=y
652CONFIG_PROC_KCORE=y
653CONFIG_PROC_SYSCTL=y
654CONFIG_SYSFS=y
655CONFIG_TMPFS=y
656# CONFIG_TMPFS_POSIX_ACL is not set
657# CONFIG_HUGETLB_PAGE is not set
658# CONFIG_CONFIGFS_FS is not set
659
660#
661# Miscellaneous filesystems
662#
663# CONFIG_HFSPLUS_FS is not set
664CONFIG_JFFS2_FS=y
665CONFIG_JFFS2_FS_DEBUG=0
666CONFIG_JFFS2_FS_WRITEBUFFER=y
667# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
668# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
669CONFIG_JFFS2_ZLIB=y
670# CONFIG_JFFS2_LZO is not set
671CONFIG_JFFS2_RTIME=y
672# CONFIG_JFFS2_RUBIN is not set
673CONFIG_CRAMFS=y
674# CONFIG_VXFS_FS is not set
675# CONFIG_MINIX_FS is not set
676# CONFIG_HPFS_FS is not set
677# CONFIG_QNX4FS_FS is not set
678# CONFIG_ROMFS_FS is not set
679# CONFIG_SYSV_FS is not set
680# CONFIG_UFS_FS is not set
681CONFIG_NETWORK_FILESYSTEMS=y
682CONFIG_NFS_FS=y
683CONFIG_NFS_V3=y
684# CONFIG_NFS_V3_ACL is not set
685# CONFIG_NFSD is not set
686CONFIG_ROOT_NFS=y
687CONFIG_LOCKD=y
688CONFIG_LOCKD_V4=y
689CONFIG_NFS_COMMON=y
690CONFIG_SUNRPC=y
691# CONFIG_SMB_FS is not set
692# CONFIG_CIFS is not set
693# CONFIG_NCP_FS is not set
694# CONFIG_CODA_FS is not set
695
696#
697# Partition Types
698#
699CONFIG_PARTITION_ADVANCED=y
700# CONFIG_ACORN_PARTITION is not set
701# CONFIG_OSF_PARTITION is not set
702# CONFIG_AMIGA_PARTITION is not set
703# CONFIG_ATARI_PARTITION is not set
704# CONFIG_MAC_PARTITION is not set
705CONFIG_MSDOS_PARTITION=y
706# CONFIG_BSD_DISKLABEL is not set
707# CONFIG_MINIX_SUBPARTITION is not set
708# CONFIG_SOLARIS_X86_PARTITION is not set
709# CONFIG_UNIXWARE_DISKLABEL is not set
710# CONFIG_LDM_PARTITION is not set
711# CONFIG_SGI_PARTITION is not set
712# CONFIG_ULTRIX_PARTITION is not set
713# CONFIG_SUN_PARTITION is not set
714# CONFIG_KARMA_PARTITION is not set
715# CONFIG_EFI_PARTITION is not set
716# CONFIG_SYSV68_PARTITION is not set
717CONFIG_NLS=y
718CONFIG_NLS_DEFAULT="iso8859-1"
719CONFIG_NLS_CODEPAGE_437=y
720# CONFIG_NLS_CODEPAGE_737 is not set
721# CONFIG_NLS_CODEPAGE_775 is not set
722# CONFIG_NLS_CODEPAGE_850 is not set
723# CONFIG_NLS_CODEPAGE_852 is not set
724# CONFIG_NLS_CODEPAGE_855 is not set
725# CONFIG_NLS_CODEPAGE_857 is not set
726# CONFIG_NLS_CODEPAGE_860 is not set
727# CONFIG_NLS_CODEPAGE_861 is not set
728# CONFIG_NLS_CODEPAGE_862 is not set
729# CONFIG_NLS_CODEPAGE_863 is not set
730# CONFIG_NLS_CODEPAGE_864 is not set
731# CONFIG_NLS_CODEPAGE_865 is not set
732# CONFIG_NLS_CODEPAGE_866 is not set
733# CONFIG_NLS_CODEPAGE_869 is not set
734# CONFIG_NLS_CODEPAGE_936 is not set
735# CONFIG_NLS_CODEPAGE_950 is not set
736# CONFIG_NLS_CODEPAGE_932 is not set
737# CONFIG_NLS_CODEPAGE_949 is not set
738# CONFIG_NLS_CODEPAGE_874 is not set
739# CONFIG_NLS_ISO8859_8 is not set
740# CONFIG_NLS_CODEPAGE_1250 is not set
741# CONFIG_NLS_CODEPAGE_1251 is not set
742CONFIG_NLS_ASCII=y
743CONFIG_NLS_ISO8859_1=y
744# CONFIG_NLS_ISO8859_2 is not set
745# CONFIG_NLS_ISO8859_3 is not set
746# CONFIG_NLS_ISO8859_4 is not set
747# CONFIG_NLS_ISO8859_5 is not set
748# CONFIG_NLS_ISO8859_6 is not set
749# CONFIG_NLS_ISO8859_7 is not set
750# CONFIG_NLS_ISO8859_9 is not set
751# CONFIG_NLS_ISO8859_13 is not set
752# CONFIG_NLS_ISO8859_14 is not set
753# CONFIG_NLS_ISO8859_15 is not set
754# CONFIG_NLS_KOI8_R is not set
755# CONFIG_NLS_KOI8_U is not set
756CONFIG_NLS_UTF8=y
757
758#
759# Library routines
760#
761CONFIG_BITREVERSE=y
762# CONFIG_GENERIC_FIND_FIRST_BIT is not set
763# CONFIG_CRC_CCITT is not set
764# CONFIG_CRC16 is not set
765# CONFIG_CRC_ITU_T is not set
766CONFIG_CRC32=y
767# CONFIG_CRC7 is not set
768# CONFIG_LIBCRC32C is not set
769CONFIG_ZLIB_INFLATE=y
770CONFIG_ZLIB_DEFLATE=y
771CONFIG_PLIST=y
772CONFIG_HAS_IOMEM=y
773CONFIG_HAS_IOPORT=y
774CONFIG_HAS_DMA=y
775CONFIG_HAVE_LMB=y
776
777#
778# Kernel hacking
779#
780# CONFIG_PRINTK_TIME is not set
781CONFIG_ENABLE_WARN_DEPRECATED=y
782CONFIG_ENABLE_MUST_CHECK=y
783CONFIG_FRAME_WARN=1024
784CONFIG_MAGIC_SYSRQ=y
785# CONFIG_UNUSED_SYMBOLS is not set
786CONFIG_DEBUG_FS=y
787# CONFIG_HEADERS_CHECK is not set
788CONFIG_DEBUG_KERNEL=y
789# CONFIG_DEBUG_SHIRQ is not set
790# CONFIG_DETECT_SOFTLOCKUP is not set
791# CONFIG_SCHED_DEBUG is not set
792# CONFIG_SCHEDSTATS is not set
793# CONFIG_TIMER_STATS is not set
794# CONFIG_DEBUG_OBJECTS is not set
795# CONFIG_DEBUG_SLAB is not set
796# CONFIG_DEBUG_RT_MUTEXES is not set
797# CONFIG_RT_MUTEX_TESTER is not set
798# CONFIG_DEBUG_SPINLOCK is not set
799# CONFIG_DEBUG_MUTEXES is not set
800# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
801# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
802# CONFIG_DEBUG_KOBJECT is not set
803CONFIG_DEBUG_BUGVERBOSE=y
804CONFIG_DEBUG_INFO=y
805# CONFIG_DEBUG_VM is not set
806# CONFIG_DEBUG_WRITECOUNT is not set
807# CONFIG_DEBUG_LIST is not set
808# CONFIG_DEBUG_SG is not set
809# CONFIG_BOOT_PRINTK_DELAY is not set
810# CONFIG_BACKTRACE_SELF_TEST is not set
811# CONFIG_FAULT_INJECTION is not set
812# CONFIG_SAMPLES is not set
813# CONFIG_DEBUG_STACKOVERFLOW is not set
814# CONFIG_DEBUG_STACK_USAGE is not set
815# CONFIG_DEBUG_PAGEALLOC is not set
816# CONFIG_DEBUGGER is not set
817# CONFIG_KGDB_CONSOLE is not set
818# CONFIG_IRQSTACKS is not set
819# CONFIG_VIRQ_DEBUG is not set
820CONFIG_BDI_SWITCH=y
821# CONFIG_PPC_EARLY_DEBUG is not set
822
823#
824# Security options
825#
826# CONFIG_KEYS is not set
827# CONFIG_SECURITY is not set
828CONFIG_CRYPTO=y
829
830#
831# Crypto core or helper
832#
833CONFIG_CRYPTO_ALGAPI=y
834CONFIG_CRYPTO_BLKCIPHER=y
835CONFIG_CRYPTO_MANAGER=y
836# CONFIG_CRYPTO_NULL is not set
837# CONFIG_CRYPTO_CRYPTD is not set
838# CONFIG_CRYPTO_AUTHENC is not set
839
840#
841# Authenticated Encryption with Associated Data
842#
843# CONFIG_CRYPTO_CCM is not set
844# CONFIG_CRYPTO_GCM is not set
845# CONFIG_CRYPTO_SEQIV is not set
846
847#
848# Block modes
849#
850CONFIG_CRYPTO_CBC=y
851# CONFIG_CRYPTO_CTR is not set
852# CONFIG_CRYPTO_CTS is not set
853CONFIG_CRYPTO_ECB=y
854CONFIG_CRYPTO_PCBC=y
855
856#
857# Hash modes
858#
859# CONFIG_CRYPTO_HMAC is not set
860
861#
862# Digest
863#
864# CONFIG_CRYPTO_CRC32C is not set
865# CONFIG_CRYPTO_MD4 is not set
866CONFIG_CRYPTO_MD5=y
867# CONFIG_CRYPTO_MICHAEL_MIC is not set
868# CONFIG_CRYPTO_SHA1 is not set
869# CONFIG_CRYPTO_SHA256 is not set
870# CONFIG_CRYPTO_SHA512 is not set
871# CONFIG_CRYPTO_TGR192 is not set
872# CONFIG_CRYPTO_WP512 is not set
873
874#
875# Ciphers
876#
877# CONFIG_CRYPTO_AES is not set
878# CONFIG_CRYPTO_ANUBIS is not set
879# CONFIG_CRYPTO_ARC4 is not set
880# CONFIG_CRYPTO_BLOWFISH is not set
881# CONFIG_CRYPTO_CAMELLIA is not set
882# CONFIG_CRYPTO_CAST5 is not set
883# CONFIG_CRYPTO_CAST6 is not set
884CONFIG_CRYPTO_DES=y
885# CONFIG_CRYPTO_FCRYPT is not set
886# CONFIG_CRYPTO_KHAZAD is not set
887# CONFIG_CRYPTO_SEED is not set
888# CONFIG_CRYPTO_SERPENT is not set
889# CONFIG_CRYPTO_TEA is not set
890# CONFIG_CRYPTO_TWOFISH is not set
891
892#
893# Compression
894#
895# CONFIG_CRYPTO_DEFLATE is not set
896# CONFIG_CRYPTO_LZO is not set
897# CONFIG_CRYPTO_HW is not set
898# CONFIG_PPC_CLOCK is not set
899CONFIG_PPC_LIB_RHEAP=y
900# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/mgsuvd_defconfig b/arch/powerpc/configs/mgsuvd_defconfig
new file mode 100644
index 000000000000..3cd6ce4be827
--- /dev/null
+++ b/arch/powerpc/configs/mgsuvd_defconfig
@@ -0,0 +1,872 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc2
4# Wed May 21 13:30:33 2008
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11# CONFIG_6xx is not set
12# CONFIG_PPC_85xx is not set
13CONFIG_PPC_8xx=y
14# CONFIG_40x is not set
15# CONFIG_44x is not set
16# CONFIG_E200 is not set
17CONFIG_8xx=y
18# CONFIG_PPC_MM_SLICES is not set
19CONFIG_NOT_COHERENT_CACHE=y
20CONFIG_PPC32=y
21CONFIG_WORD_SIZE=32
22CONFIG_PPC_MERGE=y
23CONFIG_MMU=y
24CONFIG_GENERIC_CMOS_UPDATE=y
25CONFIG_GENERIC_TIME=y
26CONFIG_GENERIC_TIME_VSYSCALL=y
27CONFIG_GENERIC_CLOCKEVENTS=y
28CONFIG_GENERIC_HARDIRQS=y
29# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
30CONFIG_IRQ_PER_CPU=y
31CONFIG_STACKTRACE_SUPPORT=y
32CONFIG_LOCKDEP_SUPPORT=y
33CONFIG_RWSEM_XCHGADD_ALGORITHM=y
34CONFIG_ARCH_HAS_ILOG2_U32=y
35CONFIG_GENERIC_HWEIGHT=y
36CONFIG_GENERIC_CALIBRATE_DELAY=y
37CONFIG_GENERIC_FIND_NEXT_BIT=y
38# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
39CONFIG_PPC=y
40CONFIG_EARLY_PRINTK=y
41CONFIG_GENERIC_NVRAM=y
42CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
43CONFIG_ARCH_MAY_HAVE_PC_FDC=y
44CONFIG_PPC_OF=y
45CONFIG_OF=y
46# CONFIG_PPC_UDBG_16550 is not set
47# CONFIG_GENERIC_TBSYNC is not set
48CONFIG_AUDIT_ARCH=y
49# CONFIG_DEFAULT_UIMAGE is not set
50# CONFIG_PPC_DCR_NATIVE is not set
51# CONFIG_PPC_DCR_MMIO is not set
52CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
53
54#
55# General setup
56#
57CONFIG_EXPERIMENTAL=y
58CONFIG_BROKEN_ON_SMP=y
59CONFIG_INIT_ENV_ARG_LIMIT=32
60CONFIG_LOCALVERSION=""
61CONFIG_LOCALVERSION_AUTO=y
62# CONFIG_SWAP is not set
63CONFIG_SYSVIPC=y
64CONFIG_SYSVIPC_SYSCTL=y
65# CONFIG_POSIX_MQUEUE is not set
66# CONFIG_BSD_PROCESS_ACCT is not set
67# CONFIG_TASKSTATS is not set
68# CONFIG_AUDIT is not set
69# CONFIG_IKCONFIG is not set
70CONFIG_LOG_BUF_SHIFT=17
71# CONFIG_CGROUPS is not set
72CONFIG_GROUP_SCHED=y
73CONFIG_FAIR_GROUP_SCHED=y
74# CONFIG_RT_GROUP_SCHED is not set
75CONFIG_USER_SCHED=y
76# CONFIG_CGROUP_SCHED is not set
77CONFIG_SYSFS_DEPRECATED=y
78CONFIG_SYSFS_DEPRECATED_V2=y
79# CONFIG_RELAY is not set
80# CONFIG_NAMESPACES is not set
81CONFIG_BLK_DEV_INITRD=y
82CONFIG_INITRAMFS_SOURCE=""
83# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
84CONFIG_SYSCTL=y
85CONFIG_EMBEDDED=y
86# CONFIG_SYSCTL_SYSCALL is not set
87CONFIG_KALLSYMS=y
88# CONFIG_KALLSYMS_EXTRA_PASS is not set
89# CONFIG_HOTPLUG is not set
90CONFIG_PRINTK=y
91# CONFIG_BUG is not set
92CONFIG_ELF_CORE=y
93CONFIG_COMPAT_BRK=y
94# CONFIG_BASE_FULL is not set
95CONFIG_FUTEX=y
96CONFIG_ANON_INODES=y
97# CONFIG_EPOLL is not set
98CONFIG_SIGNALFD=y
99CONFIG_TIMERFD=y
100CONFIG_EVENTFD=y
101CONFIG_SHMEM=y
102# CONFIG_VM_EVENT_COUNTERS is not set
103CONFIG_SLAB=y
104# CONFIG_SLUB is not set
105# CONFIG_SLOB is not set
106# CONFIG_PROFILING is not set
107# CONFIG_MARKERS is not set
108CONFIG_HAVE_OPROFILE=y
109CONFIG_HAVE_KPROBES=y
110CONFIG_HAVE_KRETPROBES=y
111# CONFIG_HAVE_DMA_ATTRS is not set
112CONFIG_PROC_PAGE_MONITOR=y
113CONFIG_SLABINFO=y
114CONFIG_RT_MUTEXES=y
115# CONFIG_TINY_SHMEM is not set
116CONFIG_BASE_SMALL=1
117# CONFIG_MODULES is not set
118CONFIG_BLOCK=y
119# CONFIG_LBD is not set
120# CONFIG_BLK_DEV_IO_TRACE is not set
121# CONFIG_LSF is not set
122# CONFIG_BLK_DEV_BSG is not set
123
124#
125# IO Schedulers
126#
127CONFIG_IOSCHED_NOOP=y
128CONFIG_IOSCHED_AS=y
129CONFIG_IOSCHED_DEADLINE=y
130CONFIG_IOSCHED_CFQ=y
131CONFIG_DEFAULT_AS=y
132# CONFIG_DEFAULT_DEADLINE is not set
133# CONFIG_DEFAULT_CFQ is not set
134# CONFIG_DEFAULT_NOOP is not set
135CONFIG_DEFAULT_IOSCHED="anticipatory"
136CONFIG_CLASSIC_RCU=y
137
138#
139# Platform support
140#
141# CONFIG_PPC_MPC512x is not set
142# CONFIG_PPC_MPC5121 is not set
143# CONFIG_PPC_CELL is not set
144# CONFIG_PPC_CELL_NATIVE is not set
145CONFIG_CPM1=y
146# CONFIG_MPC8XXFADS is not set
147# CONFIG_MPC86XADS is not set
148# CONFIG_MPC885ADS is not set
149# CONFIG_PPC_EP88XC is not set
150# CONFIG_PPC_ADDER875 is not set
151CONFIG_PPC_MGSUVD=y
152
153#
154# MPC8xx CPM Options
155#
156
157#
158# Generic MPC8xx Options
159#
160CONFIG_8xx_COPYBACK=y
161CONFIG_8xx_CPU6=y
162CONFIG_8xx_CPU15=y
163# CONFIG_NO_UCODE_PATCH is not set
164# CONFIG_USB_SOF_UCODE_PATCH is not set
165# CONFIG_I2C_SPI_UCODE_PATCH is not set
166CONFIG_I2C_SPI_SMC1_UCODE_PATCH=y
167CONFIG_UCODE_PATCH=y
168# CONFIG_PQ2ADS is not set
169# CONFIG_IPIC is not set
170# CONFIG_MPIC is not set
171# CONFIG_MPIC_WEIRD is not set
172# CONFIG_PPC_I8259 is not set
173# CONFIG_PPC_RTAS is not set
174# CONFIG_MMIO_NVRAM is not set
175# CONFIG_PPC_MPC106 is not set
176# CONFIG_PPC_970_NAP is not set
177# CONFIG_PPC_INDIRECT_IO is not set
178# CONFIG_GENERIC_IOMAP is not set
179# CONFIG_CPU_FREQ is not set
180CONFIG_PPC_CPM_NEW_BINDING=y
181# CONFIG_FSL_ULI1575 is not set
182CONFIG_CPM=y
183
184#
185# Kernel options
186#
187# CONFIG_HIGHMEM is not set
188# CONFIG_TICK_ONESHOT is not set
189# CONFIG_NO_HZ is not set
190# CONFIG_HIGH_RES_TIMERS is not set
191CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
192# CONFIG_HZ_100 is not set
193# CONFIG_HZ_250 is not set
194# CONFIG_HZ_300 is not set
195CONFIG_HZ_1000=y
196CONFIG_HZ=1000
197# CONFIG_SCHED_HRTICK is not set
198CONFIG_PREEMPT_NONE=y
199# CONFIG_PREEMPT_VOLUNTARY is not set
200# CONFIG_PREEMPT is not set
201CONFIG_BINFMT_ELF=y
202# CONFIG_BINFMT_MISC is not set
203CONFIG_MATH_EMULATION=y
204# CONFIG_IOMMU_HELPER is not set
205CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
206CONFIG_ARCH_HAS_WALK_MEMORY=y
207CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
208CONFIG_ARCH_FLATMEM_ENABLE=y
209CONFIG_ARCH_POPULATES_NODE_MAP=y
210CONFIG_SELECT_MEMORY_MODEL=y
211CONFIG_FLATMEM_MANUAL=y
212# CONFIG_DISCONTIGMEM_MANUAL is not set
213# CONFIG_SPARSEMEM_MANUAL is not set
214CONFIG_FLATMEM=y
215CONFIG_FLAT_NODE_MEM_MAP=y
216# CONFIG_SPARSEMEM_STATIC is not set
217# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
218CONFIG_PAGEFLAGS_EXTENDED=y
219CONFIG_SPLIT_PTLOCK_CPUS=4
220# CONFIG_RESOURCES_64BIT is not set
221CONFIG_ZONE_DMA_FLAG=1
222CONFIG_BOUNCE=y
223CONFIG_VIRT_TO_BUS=y
224CONFIG_FORCE_MAX_ZONEORDER=11
225# CONFIG_PROC_DEVICETREE is not set
226# CONFIG_CMDLINE_BOOL is not set
227# CONFIG_PM is not set
228# CONFIG_SECCOMP is not set
229CONFIG_ISA_DMA_API=y
230
231#
232# Bus options
233#
234CONFIG_ZONE_DMA=y
235CONFIG_FSL_SOC=y
236# CONFIG_PCI is not set
237# CONFIG_PCI_DOMAINS is not set
238# CONFIG_PCI_SYSCALL is not set
239# CONFIG_PCI_QSPAN is not set
240# CONFIG_ARCH_SUPPORTS_MSI is not set
241# CONFIG_HAS_RAPIDIO is not set
242
243#
244# Advanced setup
245#
246# CONFIG_ADVANCED_OPTIONS is not set
247
248#
249# Default settings for advanced configuration options are used
250#
251CONFIG_LOWMEM_SIZE=0x30000000
252CONFIG_PAGE_OFFSET=0xc0000000
253CONFIG_KERNEL_START=0xc0000000
254CONFIG_PHYSICAL_START=0x00000000
255CONFIG_TASK_SIZE=0x80000000
256CONFIG_CONSISTENT_START=0xfd000000
257CONFIG_CONSISTENT_SIZE=0x00200000
258
259#
260# Networking
261#
262CONFIG_NET=y
263
264#
265# Networking options
266#
267CONFIG_PACKET=y
268# CONFIG_PACKET_MMAP is not set
269CONFIG_UNIX=y
270CONFIG_XFRM=y
271# CONFIG_XFRM_USER is not set
272# CONFIG_XFRM_SUB_POLICY is not set
273# CONFIG_XFRM_MIGRATE is not set
274# CONFIG_XFRM_STATISTICS is not set
275# CONFIG_NET_KEY is not set
276CONFIG_INET=y
277CONFIG_IP_MULTICAST=y
278# CONFIG_IP_ADVANCED_ROUTER is not set
279CONFIG_IP_FIB_HASH=y
280CONFIG_IP_PNP=y
281# CONFIG_IP_PNP_DHCP is not set
282# CONFIG_IP_PNP_BOOTP is not set
283# CONFIG_IP_PNP_RARP is not set
284# CONFIG_NET_IPIP is not set
285# CONFIG_NET_IPGRE is not set
286# CONFIG_IP_MROUTE is not set
287# CONFIG_ARPD is not set
288CONFIG_SYN_COOKIES=y
289# CONFIG_INET_AH is not set
290# CONFIG_INET_ESP is not set
291# CONFIG_INET_IPCOMP is not set
292# CONFIG_INET_XFRM_TUNNEL is not set
293# CONFIG_INET_TUNNEL is not set
294CONFIG_INET_XFRM_MODE_TRANSPORT=y
295CONFIG_INET_XFRM_MODE_TUNNEL=y
296CONFIG_INET_XFRM_MODE_BEET=y
297# CONFIG_INET_LRO is not set
298CONFIG_INET_DIAG=y
299CONFIG_INET_TCP_DIAG=y
300# CONFIG_TCP_CONG_ADVANCED is not set
301CONFIG_TCP_CONG_CUBIC=y
302CONFIG_DEFAULT_TCP_CONG="cubic"
303# CONFIG_TCP_MD5SIG is not set
304# CONFIG_IPV6 is not set
305# CONFIG_NETWORK_SECMARK is not set
306# CONFIG_NETFILTER is not set
307# CONFIG_IP_DCCP is not set
308# CONFIG_IP_SCTP is not set
309# CONFIG_TIPC is not set
310# CONFIG_ATM is not set
311# CONFIG_BRIDGE is not set
312# CONFIG_VLAN_8021Q is not set
313# CONFIG_DECNET is not set
314# CONFIG_LLC2 is not set
315# CONFIG_IPX is not set
316# CONFIG_ATALK is not set
317# CONFIG_X25 is not set
318# CONFIG_LAPB is not set
319# CONFIG_ECONET is not set
320# CONFIG_WAN_ROUTER is not set
321# CONFIG_NET_SCHED is not set
322
323#
324# Network testing
325#
326# CONFIG_NET_PKTGEN is not set
327# CONFIG_HAMRADIO is not set
328# CONFIG_CAN is not set
329# CONFIG_IRDA is not set
330# CONFIG_BT is not set
331# CONFIG_AF_RXRPC is not set
332
333#
334# Wireless
335#
336# CONFIG_CFG80211 is not set
337# CONFIG_WIRELESS_EXT is not set
338# CONFIG_MAC80211 is not set
339# CONFIG_IEEE80211 is not set
340# CONFIG_RFKILL is not set
341# CONFIG_NET_9P is not set
342
343#
344# Device Drivers
345#
346
347#
348# Generic Driver Options
349#
350CONFIG_STANDALONE=y
351CONFIG_PREVENT_FIRMWARE_BUILD=y
352# CONFIG_SYS_HYPERVISOR is not set
353# CONFIG_CONNECTOR is not set
354CONFIG_MTD=y
355# CONFIG_MTD_DEBUG is not set
356# CONFIG_MTD_CONCAT is not set
357CONFIG_MTD_PARTITIONS=y
358# CONFIG_MTD_REDBOOT_PARTS is not set
359CONFIG_MTD_CMDLINE_PARTS=y
360CONFIG_MTD_OF_PARTS=y
361# CONFIG_MTD_AR7_PARTS is not set
362
363#
364# User Modules And Translation Layers
365#
366CONFIG_MTD_CHAR=y
367CONFIG_MTD_BLKDEVS=y
368CONFIG_MTD_BLOCK=y
369# CONFIG_FTL is not set
370# CONFIG_NFTL is not set
371# CONFIG_INFTL is not set
372# CONFIG_RFD_FTL is not set
373# CONFIG_SSFDC is not set
374# CONFIG_MTD_OOPS is not set
375
376#
377# RAM/ROM/Flash chip drivers
378#
379CONFIG_MTD_CFI=y
380# CONFIG_MTD_JEDECPROBE is not set
381CONFIG_MTD_GEN_PROBE=y
382CONFIG_MTD_CFI_ADV_OPTIONS=y
383CONFIG_MTD_CFI_NOSWAP=y
384# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
385# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
386CONFIG_MTD_CFI_GEOMETRY=y
387CONFIG_MTD_MAP_BANK_WIDTH_1=y
388CONFIG_MTD_MAP_BANK_WIDTH_2=y
389# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
390# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
391# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
392# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
393CONFIG_MTD_CFI_I1=y
394CONFIG_MTD_CFI_I2=y
395# CONFIG_MTD_CFI_I4 is not set
396# CONFIG_MTD_CFI_I8 is not set
397# CONFIG_MTD_OTP is not set
398CONFIG_MTD_CFI_INTELEXT=y
399CONFIG_MTD_CFI_AMDSTD=y
400CONFIG_MTD_CFI_STAA=y
401CONFIG_MTD_CFI_UTIL=y
402# CONFIG_MTD_RAM is not set
403# CONFIG_MTD_ROM is not set
404# CONFIG_MTD_ABSENT is not set
405
406#
407# Mapping drivers for chip access
408#
409# CONFIG_MTD_COMPLEX_MAPPINGS is not set
410# CONFIG_MTD_PHYSMAP is not set
411CONFIG_MTD_PHYSMAP_OF=y
412# CONFIG_MTD_CFI_FLAGADM is not set
413# CONFIG_MTD_PLATRAM is not set
414
415#
416# Self-contained MTD device drivers
417#
418# CONFIG_MTD_SLRAM is not set
419# CONFIG_MTD_PHRAM is not set
420# CONFIG_MTD_MTDRAM is not set
421# CONFIG_MTD_BLOCK2MTD is not set
422
423#
424# Disk-On-Chip Device Drivers
425#
426# CONFIG_MTD_DOC2000 is not set
427# CONFIG_MTD_DOC2001 is not set
428# CONFIG_MTD_DOC2001PLUS is not set
429# CONFIG_MTD_NAND is not set
430# CONFIG_MTD_ONENAND is not set
431
432#
433# UBI - Unsorted block images
434#
435# CONFIG_MTD_UBI is not set
436CONFIG_OF_DEVICE=y
437# CONFIG_PARPORT is not set
438CONFIG_BLK_DEV=y
439# CONFIG_BLK_DEV_FD is not set
440# CONFIG_BLK_DEV_COW_COMMON is not set
441CONFIG_BLK_DEV_LOOP=y
442# CONFIG_BLK_DEV_CRYPTOLOOP is not set
443# CONFIG_BLK_DEV_NBD is not set
444CONFIG_BLK_DEV_RAM=y
445CONFIG_BLK_DEV_RAM_COUNT=16
446CONFIG_BLK_DEV_RAM_SIZE=4096
447# CONFIG_BLK_DEV_XIP is not set
448# CONFIG_CDROM_PKTCDVD is not set
449# CONFIG_ATA_OVER_ETH is not set
450# CONFIG_MISC_DEVICES is not set
451CONFIG_HAVE_IDE=y
452# CONFIG_IDE is not set
453
454#
455# SCSI device support
456#
457# CONFIG_RAID_ATTRS is not set
458# CONFIG_SCSI is not set
459# CONFIG_SCSI_DMA is not set
460# CONFIG_SCSI_NETLINK is not set
461# CONFIG_ATA is not set
462# CONFIG_MD is not set
463# CONFIG_MACINTOSH_DRIVERS is not set
464CONFIG_NETDEVICES=y
465# CONFIG_NETDEVICES_MULTIQUEUE is not set
466# CONFIG_DUMMY is not set
467# CONFIG_BONDING is not set
468# CONFIG_MACVLAN is not set
469# CONFIG_EQUALIZER is not set
470# CONFIG_TUN is not set
471# CONFIG_VETH is not set
472CONFIG_PHYLIB=y
473
474#
475# MII PHY device drivers
476#
477# CONFIG_MARVELL_PHY is not set
478# CONFIG_DAVICOM_PHY is not set
479# CONFIG_QSEMI_PHY is not set
480# CONFIG_LXT_PHY is not set
481# CONFIG_CICADA_PHY is not set
482# CONFIG_VITESSE_PHY is not set
483# CONFIG_SMSC_PHY is not set
484# CONFIG_BROADCOM_PHY is not set
485# CONFIG_ICPLUS_PHY is not set
486# CONFIG_REALTEK_PHY is not set
487CONFIG_FIXED_PHY=y
488# CONFIG_MDIO_BITBANG is not set
489CONFIG_NET_ETHERNET=y
490CONFIG_MII=y
491# CONFIG_IBM_NEW_EMAC_ZMII is not set
492# CONFIG_IBM_NEW_EMAC_RGMII is not set
493# CONFIG_IBM_NEW_EMAC_TAH is not set
494# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
495# CONFIG_B44 is not set
496CONFIG_FS_ENET=y
497CONFIG_FS_ENET_HAS_SCC=y
498# CONFIG_FS_ENET_HAS_FEC is not set
499# CONFIG_FS_ENET_MDIO_FEC is not set
500# CONFIG_NETDEV_1000 is not set
501# CONFIG_NETDEV_10000 is not set
502
503#
504# Wireless LAN
505#
506# CONFIG_WLAN_PRE80211 is not set
507# CONFIG_WLAN_80211 is not set
508# CONFIG_IWLWIFI_LEDS is not set
509# CONFIG_WAN is not set
510# CONFIG_PPP is not set
511# CONFIG_SLIP is not set
512# CONFIG_NETCONSOLE is not set
513# CONFIG_NETPOLL is not set
514# CONFIG_NET_POLL_CONTROLLER is not set
515# CONFIG_ISDN is not set
516# CONFIG_PHONE is not set
517
518#
519# Input device support
520#
521# CONFIG_INPUT is not set
522
523#
524# Hardware I/O ports
525#
526# CONFIG_SERIO is not set
527# CONFIG_GAMEPORT is not set
528
529#
530# Character devices
531#
532# CONFIG_VT is not set
533CONFIG_DEVKMEM=y
534# CONFIG_SERIAL_NONSTANDARD is not set
535
536#
537# Serial drivers
538#
539# CONFIG_SERIAL_8250 is not set
540
541#
542# Non-8250 serial port support
543#
544# CONFIG_SERIAL_UARTLITE is not set
545CONFIG_SERIAL_CORE=y
546CONFIG_SERIAL_CORE_CONSOLE=y
547CONFIG_SERIAL_CPM=y
548CONFIG_SERIAL_CPM_CONSOLE=y
549# CONFIG_SERIAL_CPM_SCC1 is not set
550# CONFIG_SERIAL_CPM_SCC2 is not set
551# CONFIG_SERIAL_CPM_SCC3 is not set
552# CONFIG_SERIAL_CPM_SCC4 is not set
553CONFIG_SERIAL_CPM_SMC1=y
554# CONFIG_SERIAL_CPM_SMC2 is not set
555CONFIG_UNIX98_PTYS=y
556# CONFIG_LEGACY_PTYS is not set
557# CONFIG_IPMI_HANDLER is not set
558CONFIG_HW_RANDOM=y
559# CONFIG_NVRAM is not set
560CONFIG_GEN_RTC=y
561# CONFIG_GEN_RTC_X is not set
562# CONFIG_R3964 is not set
563# CONFIG_RAW_DRIVER is not set
564# CONFIG_TCG_TPM is not set
565# CONFIG_I2C is not set
566# CONFIG_SPI is not set
567# CONFIG_W1 is not set
568# CONFIG_POWER_SUPPLY is not set
569# CONFIG_HWMON is not set
570# CONFIG_THERMAL is not set
571# CONFIG_WATCHDOG is not set
572
573#
574# Sonics Silicon Backplane
575#
576CONFIG_SSB_POSSIBLE=y
577# CONFIG_SSB is not set
578
579#
580# Multifunction device drivers
581#
582# CONFIG_MFD_SM501 is not set
583# CONFIG_HTC_PASIC3 is not set
584
585#
586# Multimedia devices
587#
588
589#
590# Multimedia core support
591#
592# CONFIG_VIDEO_DEV is not set
593# CONFIG_DVB_CORE is not set
594# CONFIG_VIDEO_MEDIA is not set
595
596#
597# Multimedia drivers
598#
599# CONFIG_DAB is not set
600
601#
602# Graphics support
603#
604# CONFIG_VGASTATE is not set
605# CONFIG_VIDEO_OUTPUT_CONTROL is not set
606# CONFIG_FB is not set
607# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
608
609#
610# Display device support
611#
612# CONFIG_DISPLAY_SUPPORT is not set
613
614#
615# Sound
616#
617# CONFIG_SOUND is not set
618# CONFIG_USB_SUPPORT is not set
619# CONFIG_MMC is not set
620# CONFIG_MEMSTICK is not set
621# CONFIG_NEW_LEDS is not set
622# CONFIG_ACCESSIBILITY is not set
623# CONFIG_EDAC is not set
624# CONFIG_RTC_CLASS is not set
625# CONFIG_DMADEVICES is not set
626# CONFIG_UIO is not set
627
628#
629# File systems
630#
631CONFIG_EXT2_FS=y
632CONFIG_EXT2_FS_XATTR=y
633# CONFIG_EXT2_FS_POSIX_ACL is not set
634# CONFIG_EXT2_FS_SECURITY is not set
635# CONFIG_EXT2_FS_XIP is not set
636CONFIG_EXT3_FS=y
637CONFIG_EXT3_FS_XATTR=y
638# CONFIG_EXT3_FS_POSIX_ACL is not set
639# CONFIG_EXT3_FS_SECURITY is not set
640# CONFIG_EXT4DEV_FS is not set
641CONFIG_JBD=y
642# CONFIG_JBD_DEBUG is not set
643CONFIG_FS_MBCACHE=y
644# CONFIG_REISERFS_FS is not set
645# CONFIG_JFS_FS is not set
646# CONFIG_FS_POSIX_ACL is not set
647# CONFIG_XFS_FS is not set
648# CONFIG_OCFS2_FS is not set
649CONFIG_DNOTIFY=y
650CONFIG_INOTIFY=y
651CONFIG_INOTIFY_USER=y
652# CONFIG_QUOTA is not set
653# CONFIG_AUTOFS_FS is not set
654# CONFIG_AUTOFS4_FS is not set
655# CONFIG_FUSE_FS is not set
656
657#
658# CD-ROM/DVD Filesystems
659#
660# CONFIG_ISO9660_FS is not set
661# CONFIG_UDF_FS is not set
662
663#
664# DOS/FAT/NT Filesystems
665#
666# CONFIG_MSDOS_FS is not set
667# CONFIG_VFAT_FS is not set
668# CONFIG_NTFS_FS is not set
669
670#
671# Pseudo filesystems
672#
673CONFIG_PROC_FS=y
674# CONFIG_PROC_KCORE is not set
675CONFIG_PROC_SYSCTL=y
676CONFIG_SYSFS=y
677CONFIG_TMPFS=y
678# CONFIG_TMPFS_POSIX_ACL is not set
679# CONFIG_HUGETLB_PAGE is not set
680# CONFIG_CONFIGFS_FS is not set
681
682#
683# Miscellaneous filesystems
684#
685# CONFIG_ADFS_FS is not set
686# CONFIG_AFFS_FS is not set
687# CONFIG_HFS_FS is not set
688# CONFIG_HFSPLUS_FS is not set
689# CONFIG_BEFS_FS is not set
690# CONFIG_BFS_FS is not set
691# CONFIG_EFS_FS is not set
692CONFIG_JFFS2_FS=y
693CONFIG_JFFS2_FS_DEBUG=0
694CONFIG_JFFS2_FS_WRITEBUFFER=y
695# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
696# CONFIG_JFFS2_SUMMARY is not set
697# CONFIG_JFFS2_FS_XATTR is not set
698# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
699CONFIG_JFFS2_ZLIB=y
700# CONFIG_JFFS2_LZO is not set
701CONFIG_JFFS2_RTIME=y
702# CONFIG_JFFS2_RUBIN is not set
703CONFIG_CRAMFS=y
704# CONFIG_VXFS_FS is not set
705# CONFIG_MINIX_FS is not set
706# CONFIG_HPFS_FS is not set
707# CONFIG_QNX4FS_FS is not set
708# CONFIG_ROMFS_FS is not set
709# CONFIG_SYSV_FS is not set
710# CONFIG_UFS_FS is not set
711CONFIG_NETWORK_FILESYSTEMS=y
712CONFIG_NFS_FS=y
713CONFIG_NFS_V3=y
714# CONFIG_NFS_V3_ACL is not set
715# CONFIG_NFS_V4 is not set
716# CONFIG_NFSD is not set
717CONFIG_ROOT_NFS=y
718CONFIG_LOCKD=y
719CONFIG_LOCKD_V4=y
720CONFIG_NFS_COMMON=y
721CONFIG_SUNRPC=y
722# CONFIG_SUNRPC_BIND34 is not set
723# CONFIG_RPCSEC_GSS_KRB5 is not set
724# CONFIG_RPCSEC_GSS_SPKM3 is not set
725# CONFIG_SMB_FS is not set
726# CONFIG_CIFS is not set
727# CONFIG_NCP_FS is not set
728# CONFIG_CODA_FS is not set
729# CONFIG_AFS_FS is not set
730
731#
732# Partition Types
733#
734CONFIG_PARTITION_ADVANCED=y
735# CONFIG_ACORN_PARTITION is not set
736# CONFIG_OSF_PARTITION is not set
737# CONFIG_AMIGA_PARTITION is not set
738# CONFIG_ATARI_PARTITION is not set
739# CONFIG_MAC_PARTITION is not set
740CONFIG_MSDOS_PARTITION=y
741# CONFIG_BSD_DISKLABEL is not set
742# CONFIG_MINIX_SUBPARTITION is not set
743# CONFIG_SOLARIS_X86_PARTITION is not set
744# CONFIG_UNIXWARE_DISKLABEL is not set
745# CONFIG_LDM_PARTITION is not set
746# CONFIG_SGI_PARTITION is not set
747# CONFIG_ULTRIX_PARTITION is not set
748# CONFIG_SUN_PARTITION is not set
749# CONFIG_KARMA_PARTITION is not set
750# CONFIG_EFI_PARTITION is not set
751# CONFIG_SYSV68_PARTITION is not set
752# CONFIG_NLS is not set
753# CONFIG_DLM is not set
754
755#
756# Library routines
757#
758CONFIG_BITREVERSE=y
759# CONFIG_GENERIC_FIND_FIRST_BIT is not set
760CONFIG_CRC_CCITT=y
761# CONFIG_CRC16 is not set
762# CONFIG_CRC_ITU_T is not set
763CONFIG_CRC32=y
764# CONFIG_CRC7 is not set
765# CONFIG_LIBCRC32C is not set
766CONFIG_ZLIB_INFLATE=y
767CONFIG_ZLIB_DEFLATE=y
768CONFIG_PLIST=y
769CONFIG_HAS_IOMEM=y
770CONFIG_HAS_IOPORT=y
771CONFIG_HAS_DMA=y
772CONFIG_HAVE_LMB=y
773
774#
775# Kernel hacking
776#
777# CONFIG_PRINTK_TIME is not set
778CONFIG_ENABLE_WARN_DEPRECATED=y
779CONFIG_ENABLE_MUST_CHECK=y
780CONFIG_FRAME_WARN=1024
781# CONFIG_MAGIC_SYSRQ is not set
782# CONFIG_UNUSED_SYMBOLS is not set
783CONFIG_DEBUG_FS=y
784# CONFIG_HEADERS_CHECK is not set
785# CONFIG_DEBUG_KERNEL is not set
786# CONFIG_SAMPLES is not set
787# CONFIG_IRQSTACKS is not set
788# CONFIG_VIRQ_DEBUG is not set
789# CONFIG_PPC_EARLY_DEBUG is not set
790
791#
792# Security options
793#
794# CONFIG_KEYS is not set
795# CONFIG_SECURITY is not set
796# CONFIG_SECURITY_FILE_CAPABILITIES is not set
797CONFIG_CRYPTO=y
798
799#
800# Crypto core or helper
801#
802# CONFIG_CRYPTO_MANAGER is not set
803# CONFIG_CRYPTO_GF128MUL is not set
804# CONFIG_CRYPTO_NULL is not set
805# CONFIG_CRYPTO_CRYPTD is not set
806# CONFIG_CRYPTO_AUTHENC is not set
807
808#
809# Authenticated Encryption with Associated Data
810#
811# CONFIG_CRYPTO_CCM is not set
812# CONFIG_CRYPTO_GCM is not set
813# CONFIG_CRYPTO_SEQIV is not set
814
815#
816# Block modes
817#
818# CONFIG_CRYPTO_CBC is not set
819# CONFIG_CRYPTO_CTR is not set
820# CONFIG_CRYPTO_CTS is not set
821# CONFIG_CRYPTO_ECB is not set
822# CONFIG_CRYPTO_LRW is not set
823# CONFIG_CRYPTO_PCBC is not set
824# CONFIG_CRYPTO_XTS is not set
825
826#
827# Hash modes
828#
829# CONFIG_CRYPTO_HMAC is not set
830# CONFIG_CRYPTO_XCBC is not set
831
832#
833# Digest
834#
835# CONFIG_CRYPTO_CRC32C is not set
836# CONFIG_CRYPTO_MD4 is not set
837# CONFIG_CRYPTO_MD5 is not set
838# CONFIG_CRYPTO_MICHAEL_MIC is not set
839# CONFIG_CRYPTO_SHA1 is not set
840# CONFIG_CRYPTO_SHA256 is not set
841# CONFIG_CRYPTO_SHA512 is not set
842# CONFIG_CRYPTO_TGR192 is not set
843# CONFIG_CRYPTO_WP512 is not set
844
845#
846# Ciphers
847#
848# CONFIG_CRYPTO_AES is not set
849# CONFIG_CRYPTO_ANUBIS is not set
850# CONFIG_CRYPTO_ARC4 is not set
851# CONFIG_CRYPTO_BLOWFISH is not set
852# CONFIG_CRYPTO_CAMELLIA is not set
853# CONFIG_CRYPTO_CAST5 is not set
854# CONFIG_CRYPTO_CAST6 is not set
855# CONFIG_CRYPTO_DES is not set
856# CONFIG_CRYPTO_FCRYPT is not set
857# CONFIG_CRYPTO_KHAZAD is not set
858# CONFIG_CRYPTO_SALSA20 is not set
859# CONFIG_CRYPTO_SEED is not set
860# CONFIG_CRYPTO_SERPENT is not set
861# CONFIG_CRYPTO_TEA is not set
862# CONFIG_CRYPTO_TWOFISH is not set
863
864#
865# Compression
866#
867# CONFIG_CRYPTO_DEFLATE is not set
868# CONFIG_CRYPTO_LZO is not set
869CONFIG_CRYPTO_HW=y
870# CONFIG_PPC_CLOCK is not set
871CONFIG_PPC_LIB_RHEAP=y
872# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/mpc8272_ads_defconfig b/arch/powerpc/configs/mpc8272_ads_defconfig
index 7c435c84c875..ff6f7c475f47 100644
--- a/arch/powerpc/configs/mpc8272_ads_defconfig
+++ b/arch/powerpc/configs/mpc8272_ads_defconfig
@@ -151,11 +151,11 @@ CONFIG_CLASSIC_RCU=y
151# 151#
152CONFIG_PPC_MULTIPLATFORM=y 152CONFIG_PPC_MULTIPLATFORM=y
153CONFIG_CLASSIC32=y 153CONFIG_CLASSIC32=y
154CONFIG_PPC_CHRP=y 154# CONFIG_PPC_CHRP is not set
155# CONFIG_PPC_PMAC is not set
155# CONFIG_MPC5121_ADS is not set 156# CONFIG_MPC5121_ADS is not set
156# CONFIG_MPC5121_GENERIC is not set 157# CONFIG_MPC5121_GENERIC is not set
157# CONFIG_PPC_MPC52xx is not set 158# CONFIG_PPC_MPC52xx is not set
158CONFIG_PPC_PMAC=y
159# CONFIG_PPC_CELL is not set 159# CONFIG_PPC_CELL is not set
160# CONFIG_PPC_CELL_NATIVE is not set 160# CONFIG_PPC_CELL_NATIVE is not set
161CONFIG_PPC_82xx=y 161CONFIG_PPC_82xx=y
diff --git a/arch/powerpc/configs/mpc83xx_defconfig b/arch/powerpc/configs/mpc83xx_defconfig
index 916e3df7cc45..991c9bda12a9 100644
--- a/arch/powerpc/configs/mpc83xx_defconfig
+++ b/arch/powerpc/configs/mpc83xx_defconfig
@@ -166,11 +166,11 @@ CONFIG_CLASSIC_RCU=y
166# 166#
167CONFIG_PPC_MULTIPLATFORM=y 167CONFIG_PPC_MULTIPLATFORM=y
168CONFIG_CLASSIC32=y 168CONFIG_CLASSIC32=y
169CONFIG_PPC_CHRP=y 169# CONFIG_PPC_CHRP is not set
170# CONFIG_PPC_PMAC is not set
170# CONFIG_MPC5121_ADS is not set 171# CONFIG_MPC5121_ADS is not set
171# CONFIG_MPC5121_GENERIC is not set 172# CONFIG_MPC5121_GENERIC is not set
172# CONFIG_PPC_MPC52xx is not set 173# CONFIG_PPC_MPC52xx is not set
173CONFIG_PPC_PMAC=y
174# CONFIG_PPC_CELL is not set 174# CONFIG_PPC_CELL is not set
175# CONFIG_PPC_CELL_NATIVE is not set 175# CONFIG_PPC_CELL_NATIVE is not set
176# CONFIG_PPC_82xx is not set 176# CONFIG_PPC_82xx is not set
diff --git a/arch/powerpc/configs/mpc86xx_defconfig b/arch/powerpc/configs/mpc86xx_defconfig
new file mode 100644
index 000000000000..9d4be820cf1f
--- /dev/null
+++ b/arch/powerpc/configs/mpc86xx_defconfig
@@ -0,0 +1,1646 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc5
4# Tue Sep 23 23:28:38 2008
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11CONFIG_6xx=y
12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set
15# CONFIG_44x is not set
16# CONFIG_E200 is not set
17CONFIG_PPC_FPU=y
18CONFIG_ALTIVEC=y
19CONFIG_PPC_STD_MMU=y
20CONFIG_PPC_STD_MMU_32=y
21# CONFIG_PPC_MM_SLICES is not set
22CONFIG_SMP=y
23CONFIG_NR_CPUS=2
24CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32
26CONFIG_PPC_MERGE=y
27CONFIG_MMU=y
28CONFIG_GENERIC_CMOS_UPDATE=y
29CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
34CONFIG_IRQ_PER_CPU=y
35CONFIG_STACKTRACE_SUPPORT=y
36CONFIG_HAVE_LATENCYTOP_SUPPORT=y
37CONFIG_LOCKDEP_SUPPORT=y
38CONFIG_RWSEM_XCHGADD_ALGORITHM=y
39CONFIG_ARCH_HAS_ILOG2_U32=y
40CONFIG_GENERIC_HWEIGHT=y
41CONFIG_GENERIC_CALIBRATE_DELAY=y
42CONFIG_GENERIC_FIND_NEXT_BIT=y
43# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
44CONFIG_PPC=y
45CONFIG_EARLY_PRINTK=y
46CONFIG_GENERIC_NVRAM=y
47CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
48CONFIG_ARCH_MAY_HAVE_PC_FDC=y
49CONFIG_PPC_OF=y
50CONFIG_OF=y
51CONFIG_PPC_UDBG_16550=y
52CONFIG_GENERIC_TBSYNC=y
53CONFIG_AUDIT_ARCH=y
54CONFIG_GENERIC_BUG=y
55CONFIG_DEFAULT_UIMAGE=y
56# CONFIG_PPC_DCR_NATIVE is not set
57# CONFIG_PPC_DCR_MMIO is not set
58CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
59
60#
61# General setup
62#
63CONFIG_EXPERIMENTAL=y
64CONFIG_LOCK_KERNEL=y
65CONFIG_INIT_ENV_ARG_LIMIT=32
66CONFIG_LOCALVERSION=""
67CONFIG_LOCALVERSION_AUTO=y
68CONFIG_SWAP=y
69CONFIG_SYSVIPC=y
70CONFIG_SYSVIPC_SYSCTL=y
71CONFIG_POSIX_MQUEUE=y
72CONFIG_BSD_PROCESS_ACCT=y
73# CONFIG_BSD_PROCESS_ACCT_V3 is not set
74# CONFIG_TASKSTATS is not set
75CONFIG_AUDIT=y
76# CONFIG_AUDITSYSCALL is not set
77CONFIG_IKCONFIG=y
78CONFIG_IKCONFIG_PROC=y
79CONFIG_LOG_BUF_SHIFT=14
80# CONFIG_CGROUPS is not set
81CONFIG_GROUP_SCHED=y
82# CONFIG_FAIR_GROUP_SCHED is not set
83# CONFIG_RT_GROUP_SCHED is not set
84CONFIG_USER_SCHED=y
85# CONFIG_CGROUP_SCHED is not set
86CONFIG_SYSFS_DEPRECATED=y
87CONFIG_SYSFS_DEPRECATED_V2=y
88# CONFIG_RELAY is not set
89# CONFIG_NAMESPACES is not set
90CONFIG_BLK_DEV_INITRD=y
91CONFIG_INITRAMFS_SOURCE=""
92# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
93CONFIG_SYSCTL=y
94CONFIG_EMBEDDED=y
95CONFIG_SYSCTL_SYSCALL=y
96CONFIG_KALLSYMS=y
97CONFIG_KALLSYMS_ALL=y
98CONFIG_KALLSYMS_EXTRA_PASS=y
99CONFIG_HOTPLUG=y
100CONFIG_PRINTK=y
101CONFIG_BUG=y
102CONFIG_ELF_CORE=y
103CONFIG_COMPAT_BRK=y
104CONFIG_BASE_FULL=y
105CONFIG_FUTEX=y
106CONFIG_ANON_INODES=y
107CONFIG_EPOLL=y
108CONFIG_SIGNALFD=y
109CONFIG_TIMERFD=y
110CONFIG_EVENTFD=y
111CONFIG_SHMEM=y
112CONFIG_VM_EVENT_COUNTERS=y
113CONFIG_SLUB_DEBUG=y
114# CONFIG_SLAB is not set
115CONFIG_SLUB=y
116# CONFIG_SLOB is not set
117# CONFIG_PROFILING is not set
118# CONFIG_MARKERS is not set
119CONFIG_HAVE_OPROFILE=y
120# CONFIG_KPROBES is not set
121CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
122CONFIG_HAVE_IOREMAP_PROT=y
123CONFIG_HAVE_KPROBES=y
124CONFIG_HAVE_KRETPROBES=y
125CONFIG_HAVE_ARCH_TRACEHOOK=y
126# CONFIG_HAVE_DMA_ATTRS is not set
127CONFIG_USE_GENERIC_SMP_HELPERS=y
128# CONFIG_HAVE_CLK is not set
129CONFIG_PROC_PAGE_MONITOR=y
130# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
131CONFIG_SLABINFO=y
132CONFIG_RT_MUTEXES=y
133# CONFIG_TINY_SHMEM is not set
134CONFIG_BASE_SMALL=0
135CONFIG_MODULES=y
136# CONFIG_MODULE_FORCE_LOAD is not set
137CONFIG_MODULE_UNLOAD=y
138CONFIG_MODULE_FORCE_UNLOAD=y
139CONFIG_MODVERSIONS=y
140# CONFIG_MODULE_SRCVERSION_ALL is not set
141CONFIG_KMOD=y
142CONFIG_STOP_MACHINE=y
143CONFIG_BLOCK=y
144CONFIG_LBD=y
145# CONFIG_BLK_DEV_IO_TRACE is not set
146# CONFIG_LSF is not set
147# CONFIG_BLK_DEV_BSG is not set
148# CONFIG_BLK_DEV_INTEGRITY is not set
149
150#
151# IO Schedulers
152#
153CONFIG_IOSCHED_NOOP=y
154CONFIG_IOSCHED_AS=y
155CONFIG_IOSCHED_DEADLINE=y
156CONFIG_IOSCHED_CFQ=y
157# CONFIG_DEFAULT_AS is not set
158# CONFIG_DEFAULT_DEADLINE is not set
159CONFIG_DEFAULT_CFQ=y
160# CONFIG_DEFAULT_NOOP is not set
161CONFIG_DEFAULT_IOSCHED="cfq"
162CONFIG_CLASSIC_RCU=y
163# CONFIG_MPC8xxx_GPIO is not set
164
165#
166# Platform support
167#
168CONFIG_PPC_MULTIPLATFORM=y
169CONFIG_CLASSIC32=y
170# CONFIG_PPC_CHRP is not set
171# CONFIG_MPC5121_ADS is not set
172# CONFIG_MPC5121_GENERIC is not set
173# CONFIG_PPC_MPC52xx is not set
174# CONFIG_PPC_PMAC is not set
175# CONFIG_PPC_CELL is not set
176# CONFIG_PPC_CELL_NATIVE is not set
177# CONFIG_PPC_82xx is not set
178# CONFIG_PQ2ADS is not set
179# CONFIG_PPC_83xx is not set
180CONFIG_PPC_86xx=y
181CONFIG_MPC8641_HPCN=y
182CONFIG_SBC8641D=y
183CONFIG_MPC8610_HPCD=y
184CONFIG_GEF_SBC610=y
185CONFIG_MPC8641=y
186CONFIG_MPC8610=y
187# CONFIG_IPIC is not set
188CONFIG_MPIC=y
189# CONFIG_MPIC_WEIRD is not set
190CONFIG_PPC_I8259=y
191# CONFIG_PPC_RTAS is not set
192# CONFIG_MMIO_NVRAM is not set
193# CONFIG_PPC_MPC106 is not set
194# CONFIG_PPC_970_NAP is not set
195# CONFIG_PPC_INDIRECT_IO is not set
196# CONFIG_GENERIC_IOMAP is not set
197# CONFIG_CPU_FREQ is not set
198# CONFIG_TAU is not set
199CONFIG_FSL_ULI1575=y
200
201#
202# Kernel options
203#
204CONFIG_HIGHMEM=y
205CONFIG_TICK_ONESHOT=y
206CONFIG_NO_HZ=y
207CONFIG_HIGH_RES_TIMERS=y
208CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
209# CONFIG_HZ_100 is not set
210# CONFIG_HZ_250 is not set
211# CONFIG_HZ_300 is not set
212CONFIG_HZ_1000=y
213CONFIG_HZ=1000
214CONFIG_SCHED_HRTICK=y
215CONFIG_PREEMPT_NONE=y
216# CONFIG_PREEMPT_VOLUNTARY is not set
217# CONFIG_PREEMPT is not set
218CONFIG_BINFMT_ELF=y
219CONFIG_BINFMT_MISC=m
220# CONFIG_IOMMU_HELPER is not set
221CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
222CONFIG_ARCH_HAS_WALK_MEMORY=y
223CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
224# CONFIG_KEXEC is not set
225# CONFIG_IRQ_ALL_CPUS is not set
226CONFIG_ARCH_FLATMEM_ENABLE=y
227CONFIG_ARCH_POPULATES_NODE_MAP=y
228CONFIG_SELECT_MEMORY_MODEL=y
229CONFIG_FLATMEM_MANUAL=y
230# CONFIG_DISCONTIGMEM_MANUAL is not set
231# CONFIG_SPARSEMEM_MANUAL is not set
232CONFIG_FLATMEM=y
233CONFIG_FLAT_NODE_MEM_MAP=y
234# CONFIG_SPARSEMEM_STATIC is not set
235# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
236CONFIG_PAGEFLAGS_EXTENDED=y
237CONFIG_SPLIT_PTLOCK_CPUS=4
238CONFIG_MIGRATION=y
239# CONFIG_RESOURCES_64BIT is not set
240CONFIG_ZONE_DMA_FLAG=1
241CONFIG_BOUNCE=y
242CONFIG_VIRT_TO_BUS=y
243CONFIG_FORCE_MAX_ZONEORDER=11
244CONFIG_PROC_DEVICETREE=y
245# CONFIG_CMDLINE_BOOL is not set
246CONFIG_EXTRA_TARGETS=""
247# CONFIG_PM is not set
248CONFIG_SECCOMP=y
249CONFIG_ISA_DMA_API=y
250
251#
252# Bus options
253#
254CONFIG_ZONE_DMA=y
255CONFIG_GENERIC_ISA_DMA=y
256CONFIG_PPC_INDIRECT_PCI=y
257CONFIG_FSL_SOC=y
258CONFIG_FSL_PCI=y
259CONFIG_PPC_PCI_CHOICE=y
260CONFIG_PCI=y
261CONFIG_PCI_DOMAINS=y
262CONFIG_PCI_SYSCALL=y
263# CONFIG_PCIEPORTBUS is not set
264CONFIG_ARCH_SUPPORTS_MSI=y
265# CONFIG_PCI_MSI is not set
266CONFIG_PCI_LEGACY=y
267# CONFIG_PCI_DEBUG is not set
268# CONFIG_PCCARD is not set
269# CONFIG_HOTPLUG_PCI is not set
270CONFIG_HAS_RAPIDIO=y
271# CONFIG_RAPIDIO is not set
272
273#
274# Advanced setup
275#
276# CONFIG_ADVANCED_OPTIONS is not set
277
278#
279# Default settings for advanced configuration options are used
280#
281CONFIG_LOWMEM_SIZE=0x30000000
282CONFIG_PAGE_OFFSET=0xc0000000
283CONFIG_KERNEL_START=0xc0000000
284CONFIG_PHYSICAL_START=0x00000000
285CONFIG_TASK_SIZE=0xc0000000
286CONFIG_NET=y
287
288#
289# Networking options
290#
291CONFIG_PACKET=y
292# CONFIG_PACKET_MMAP is not set
293CONFIG_UNIX=y
294CONFIG_XFRM=y
295CONFIG_XFRM_USER=y
296# CONFIG_XFRM_SUB_POLICY is not set
297# CONFIG_XFRM_MIGRATE is not set
298# CONFIG_XFRM_STATISTICS is not set
299CONFIG_NET_KEY=m
300# CONFIG_NET_KEY_MIGRATE is not set
301CONFIG_INET=y
302CONFIG_IP_MULTICAST=y
303CONFIG_IP_ADVANCED_ROUTER=y
304CONFIG_ASK_IP_FIB_HASH=y
305# CONFIG_IP_FIB_TRIE is not set
306CONFIG_IP_FIB_HASH=y
307CONFIG_IP_MULTIPLE_TABLES=y
308CONFIG_IP_ROUTE_MULTIPATH=y
309CONFIG_IP_ROUTE_VERBOSE=y
310CONFIG_IP_PNP=y
311CONFIG_IP_PNP_DHCP=y
312CONFIG_IP_PNP_BOOTP=y
313CONFIG_IP_PNP_RARP=y
314CONFIG_NET_IPIP=y
315CONFIG_NET_IPGRE=y
316CONFIG_NET_IPGRE_BROADCAST=y
317CONFIG_IP_MROUTE=y
318CONFIG_IP_PIMSM_V1=y
319CONFIG_IP_PIMSM_V2=y
320CONFIG_ARPD=y
321# CONFIG_SYN_COOKIES is not set
322# CONFIG_INET_AH is not set
323# CONFIG_INET_ESP is not set
324# CONFIG_INET_IPCOMP is not set
325# CONFIG_INET_XFRM_TUNNEL is not set
326CONFIG_INET_TUNNEL=y
327# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
328# CONFIG_INET_XFRM_MODE_TUNNEL is not set
329# CONFIG_INET_XFRM_MODE_BEET is not set
330# CONFIG_INET_LRO is not set
331CONFIG_INET_DIAG=y
332CONFIG_INET_TCP_DIAG=y
333# CONFIG_TCP_CONG_ADVANCED is not set
334CONFIG_TCP_CONG_CUBIC=y
335CONFIG_DEFAULT_TCP_CONG="cubic"
336# CONFIG_TCP_MD5SIG is not set
337CONFIG_IPV6=y
338# CONFIG_IPV6_PRIVACY is not set
339# CONFIG_IPV6_ROUTER_PREF is not set
340# CONFIG_IPV6_OPTIMISTIC_DAD is not set
341# CONFIG_INET6_AH is not set
342# CONFIG_INET6_ESP is not set
343# CONFIG_INET6_IPCOMP is not set
344# CONFIG_IPV6_MIP6 is not set
345# CONFIG_INET6_XFRM_TUNNEL is not set
346# CONFIG_INET6_TUNNEL is not set
347CONFIG_INET6_XFRM_MODE_TRANSPORT=y
348CONFIG_INET6_XFRM_MODE_TUNNEL=y
349CONFIG_INET6_XFRM_MODE_BEET=y
350# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
351CONFIG_IPV6_SIT=y
352CONFIG_IPV6_NDISC_NODETYPE=y
353# CONFIG_IPV6_TUNNEL is not set
354# CONFIG_IPV6_MULTIPLE_TABLES is not set
355# CONFIG_IPV6_MROUTE is not set
356# CONFIG_NETWORK_SECMARK is not set
357# CONFIG_NETFILTER is not set
358# CONFIG_IP_DCCP is not set
359CONFIG_IP_SCTP=m
360# CONFIG_SCTP_DBG_MSG is not set
361# CONFIG_SCTP_DBG_OBJCNT is not set
362# CONFIG_SCTP_HMAC_NONE is not set
363# CONFIG_SCTP_HMAC_SHA1 is not set
364CONFIG_SCTP_HMAC_MD5=y
365# CONFIG_TIPC is not set
366# CONFIG_ATM is not set
367# CONFIG_BRIDGE is not set
368# CONFIG_VLAN_8021Q is not set
369# CONFIG_DECNET is not set
370# CONFIG_LLC2 is not set
371# CONFIG_IPX is not set
372# CONFIG_ATALK is not set
373# CONFIG_X25 is not set
374# CONFIG_LAPB is not set
375# CONFIG_ECONET is not set
376# CONFIG_WAN_ROUTER is not set
377# CONFIG_NET_SCHED is not set
378
379#
380# Network testing
381#
382# CONFIG_NET_PKTGEN is not set
383# CONFIG_HAMRADIO is not set
384# CONFIG_CAN is not set
385# CONFIG_IRDA is not set
386# CONFIG_BT is not set
387# CONFIG_AF_RXRPC is not set
388CONFIG_FIB_RULES=y
389
390#
391# Wireless
392#
393# CONFIG_CFG80211 is not set
394# CONFIG_WIRELESS_EXT is not set
395# CONFIG_MAC80211 is not set
396# CONFIG_IEEE80211 is not set
397# CONFIG_RFKILL is not set
398# CONFIG_NET_9P is not set
399
400#
401# Device Drivers
402#
403
404#
405# Generic Driver Options
406#
407CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
408CONFIG_STANDALONE=y
409CONFIG_PREVENT_FIRMWARE_BUILD=y
410CONFIG_FW_LOADER=y
411CONFIG_FIRMWARE_IN_KERNEL=y
412CONFIG_EXTRA_FIRMWARE=""
413# CONFIG_DEBUG_DRIVER is not set
414# CONFIG_DEBUG_DEVRES is not set
415# CONFIG_SYS_HYPERVISOR is not set
416# CONFIG_CONNECTOR is not set
417# CONFIG_MTD is not set
418CONFIG_OF_DEVICE=y
419CONFIG_OF_I2C=y
420# CONFIG_PARPORT is not set
421CONFIG_BLK_DEV=y
422# CONFIG_BLK_DEV_FD is not set
423# CONFIG_BLK_CPQ_DA is not set
424# CONFIG_BLK_CPQ_CISS_DA is not set
425# CONFIG_BLK_DEV_DAC960 is not set
426# CONFIG_BLK_DEV_UMEM is not set
427# CONFIG_BLK_DEV_COW_COMMON is not set
428CONFIG_BLK_DEV_LOOP=y
429# CONFIG_BLK_DEV_CRYPTOLOOP is not set
430CONFIG_BLK_DEV_NBD=y
431# CONFIG_BLK_DEV_SX8 is not set
432# CONFIG_BLK_DEV_UB is not set
433CONFIG_BLK_DEV_RAM=y
434CONFIG_BLK_DEV_RAM_COUNT=16
435CONFIG_BLK_DEV_RAM_SIZE=131072
436# CONFIG_BLK_DEV_XIP is not set
437# CONFIG_CDROM_PKTCDVD is not set
438# CONFIG_ATA_OVER_ETH is not set
439# CONFIG_BLK_DEV_HD is not set
440CONFIG_MISC_DEVICES=y
441# CONFIG_PHANTOM is not set
442# CONFIG_EEPROM_93CX6 is not set
443# CONFIG_SGI_IOC4 is not set
444# CONFIG_TIFM_CORE is not set
445# CONFIG_ENCLOSURE_SERVICES is not set
446# CONFIG_HP_ILO is not set
447CONFIG_HAVE_IDE=y
448# CONFIG_IDE is not set
449
450#
451# SCSI device support
452#
453# CONFIG_RAID_ATTRS is not set
454CONFIG_SCSI=y
455CONFIG_SCSI_DMA=y
456# CONFIG_SCSI_TGT is not set
457# CONFIG_SCSI_NETLINK is not set
458CONFIG_SCSI_PROC_FS=y
459
460#
461# SCSI support type (disk, tape, CD-ROM)
462#
463CONFIG_BLK_DEV_SD=y
464CONFIG_CHR_DEV_ST=y
465# CONFIG_CHR_DEV_OSST is not set
466CONFIG_BLK_DEV_SR=y
467# CONFIG_BLK_DEV_SR_VENDOR is not set
468CONFIG_CHR_DEV_SG=y
469# CONFIG_CHR_DEV_SCH is not set
470
471#
472# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
473#
474CONFIG_SCSI_MULTI_LUN=y
475# CONFIG_SCSI_CONSTANTS is not set
476CONFIG_SCSI_LOGGING=y
477# CONFIG_SCSI_SCAN_ASYNC is not set
478CONFIG_SCSI_WAIT_SCAN=m
479
480#
481# SCSI Transports
482#
483# CONFIG_SCSI_SPI_ATTRS is not set
484# CONFIG_SCSI_FC_ATTRS is not set
485# CONFIG_SCSI_ISCSI_ATTRS is not set
486# CONFIG_SCSI_SAS_LIBSAS is not set
487# CONFIG_SCSI_SRP_ATTRS is not set
488CONFIG_SCSI_LOWLEVEL=y
489# CONFIG_ISCSI_TCP is not set
490# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
491# CONFIG_SCSI_3W_9XXX is not set
492# CONFIG_SCSI_ACARD is not set
493# CONFIG_SCSI_AACRAID is not set
494# CONFIG_SCSI_AIC7XXX is not set
495# CONFIG_SCSI_AIC7XXX_OLD is not set
496# CONFIG_SCSI_AIC79XX is not set
497# CONFIG_SCSI_AIC94XX is not set
498# CONFIG_SCSI_DPT_I2O is not set
499# CONFIG_SCSI_ADVANSYS is not set
500# CONFIG_SCSI_ARCMSR is not set
501# CONFIG_MEGARAID_NEWGEN is not set
502# CONFIG_MEGARAID_LEGACY is not set
503# CONFIG_MEGARAID_SAS is not set
504# CONFIG_SCSI_HPTIOP is not set
505# CONFIG_SCSI_BUSLOGIC is not set
506# CONFIG_SCSI_DMX3191D is not set
507# CONFIG_SCSI_EATA is not set
508# CONFIG_SCSI_FUTURE_DOMAIN is not set
509# CONFIG_SCSI_GDTH is not set
510# CONFIG_SCSI_IPS is not set
511# CONFIG_SCSI_INITIO is not set
512# CONFIG_SCSI_INIA100 is not set
513# CONFIG_SCSI_MVSAS is not set
514# CONFIG_SCSI_STEX is not set
515# CONFIG_SCSI_SYM53C8XX_2 is not set
516# CONFIG_SCSI_IPR is not set
517# CONFIG_SCSI_QLOGIC_1280 is not set
518# CONFIG_SCSI_QLA_FC is not set
519# CONFIG_SCSI_QLA_ISCSI is not set
520# CONFIG_SCSI_LPFC is not set
521# CONFIG_SCSI_DC395x is not set
522# CONFIG_SCSI_DC390T is not set
523# CONFIG_SCSI_NSP32 is not set
524# CONFIG_SCSI_DEBUG is not set
525# CONFIG_SCSI_SRP is not set
526# CONFIG_SCSI_DH is not set
527CONFIG_ATA=y
528# CONFIG_ATA_NONSTANDARD is not set
529CONFIG_SATA_PMP=y
530CONFIG_SATA_AHCI=y
531# CONFIG_SATA_SIL24 is not set
532# CONFIG_SATA_FSL is not set
533CONFIG_ATA_SFF=y
534# CONFIG_SATA_SVW is not set
535# CONFIG_ATA_PIIX is not set
536# CONFIG_SATA_MV is not set
537# CONFIG_SATA_NV is not set
538# CONFIG_PDC_ADMA is not set
539# CONFIG_SATA_QSTOR is not set
540# CONFIG_SATA_PROMISE is not set
541# CONFIG_SATA_SX4 is not set
542# CONFIG_SATA_SIL is not set
543# CONFIG_SATA_SIS is not set
544# CONFIG_SATA_ULI is not set
545# CONFIG_SATA_VIA is not set
546# CONFIG_SATA_VITESSE is not set
547# CONFIG_SATA_INIC162X is not set
548CONFIG_PATA_ALI=y
549# CONFIG_PATA_AMD is not set
550# CONFIG_PATA_ARTOP is not set
551# CONFIG_PATA_ATIIXP is not set
552# CONFIG_PATA_CMD640_PCI is not set
553# CONFIG_PATA_CMD64X is not set
554# CONFIG_PATA_CS5520 is not set
555# CONFIG_PATA_CS5530 is not set
556# CONFIG_PATA_CYPRESS is not set
557# CONFIG_PATA_EFAR is not set
558# CONFIG_ATA_GENERIC is not set
559# CONFIG_PATA_HPT366 is not set
560# CONFIG_PATA_HPT37X is not set
561# CONFIG_PATA_HPT3X2N is not set
562# CONFIG_PATA_HPT3X3 is not set
563# CONFIG_PATA_IT821X is not set
564# CONFIG_PATA_IT8213 is not set
565# CONFIG_PATA_JMICRON is not set
566# CONFIG_PATA_TRIFLEX is not set
567# CONFIG_PATA_MARVELL is not set
568# CONFIG_PATA_MPIIX is not set
569# CONFIG_PATA_OLDPIIX is not set
570# CONFIG_PATA_NETCELL is not set
571# CONFIG_PATA_NINJA32 is not set
572# CONFIG_PATA_NS87410 is not set
573# CONFIG_PATA_NS87415 is not set
574# CONFIG_PATA_OPTI is not set
575# CONFIG_PATA_OPTIDMA is not set
576# CONFIG_PATA_PDC_OLD is not set
577# CONFIG_PATA_RADISYS is not set
578# CONFIG_PATA_RZ1000 is not set
579# CONFIG_PATA_SC1200 is not set
580# CONFIG_PATA_SERVERWORKS is not set
581# CONFIG_PATA_PDC2027X is not set
582# CONFIG_PATA_SIL680 is not set
583# CONFIG_PATA_SIS is not set
584# CONFIG_PATA_VIA is not set
585# CONFIG_PATA_WINBOND is not set
586# CONFIG_PATA_PLATFORM is not set
587# CONFIG_PATA_SCH is not set
588# CONFIG_MD is not set
589# CONFIG_FUSION is not set
590
591#
592# IEEE 1394 (FireWire) support
593#
594
595#
596# Enable only one of the two stacks, unless you know what you are doing
597#
598# CONFIG_FIREWIRE is not set
599# CONFIG_IEEE1394 is not set
600# CONFIG_I2O is not set
601# CONFIG_MACINTOSH_DRIVERS is not set
602CONFIG_NETDEVICES=y
603CONFIG_DUMMY=y
604# CONFIG_BONDING is not set
605# CONFIG_MACVLAN is not set
606# CONFIG_EQUALIZER is not set
607# CONFIG_TUN is not set
608# CONFIG_VETH is not set
609# CONFIG_ARCNET is not set
610CONFIG_PHYLIB=y
611
612#
613# MII PHY device drivers
614#
615# CONFIG_MARVELL_PHY is not set
616# CONFIG_DAVICOM_PHY is not set
617# CONFIG_QSEMI_PHY is not set
618# CONFIG_LXT_PHY is not set
619# CONFIG_CICADA_PHY is not set
620CONFIG_VITESSE_PHY=y
621# CONFIG_SMSC_PHY is not set
622# CONFIG_BROADCOM_PHY is not set
623# CONFIG_ICPLUS_PHY is not set
624# CONFIG_REALTEK_PHY is not set
625# CONFIG_FIXED_PHY is not set
626# CONFIG_MDIO_BITBANG is not set
627CONFIG_NET_ETHERNET=y
628CONFIG_MII=y
629# CONFIG_HAPPYMEAL is not set
630# CONFIG_SUNGEM is not set
631# CONFIG_CASSINI is not set
632# CONFIG_NET_VENDOR_3COM is not set
633# CONFIG_NET_TULIP is not set
634# CONFIG_HP100 is not set
635# CONFIG_IBM_NEW_EMAC_ZMII is not set
636# CONFIG_IBM_NEW_EMAC_RGMII is not set
637# CONFIG_IBM_NEW_EMAC_TAH is not set
638# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
639# CONFIG_NET_PCI is not set
640# CONFIG_B44 is not set
641CONFIG_NETDEV_1000=y
642# CONFIG_ACENIC is not set
643# CONFIG_DL2K is not set
644# CONFIG_E1000 is not set
645# CONFIG_E1000E is not set
646# CONFIG_IP1000 is not set
647# CONFIG_IGB is not set
648# CONFIG_NS83820 is not set
649# CONFIG_HAMACHI is not set
650# CONFIG_YELLOWFIN is not set
651# CONFIG_R8169 is not set
652# CONFIG_SIS190 is not set
653# CONFIG_SKGE is not set
654# CONFIG_SKY2 is not set
655# CONFIG_VIA_VELOCITY is not set
656# CONFIG_TIGON3 is not set
657# CONFIG_BNX2 is not set
658CONFIG_GIANFAR=y
659# CONFIG_MV643XX_ETH is not set
660# CONFIG_QLA3XXX is not set
661# CONFIG_ATL1 is not set
662# CONFIG_ATL1E is not set
663CONFIG_NETDEV_10000=y
664# CONFIG_CHELSIO_T1 is not set
665# CONFIG_CHELSIO_T3 is not set
666# CONFIG_IXGBE is not set
667# CONFIG_IXGB is not set
668# CONFIG_S2IO is not set
669# CONFIG_MYRI10GE is not set
670# CONFIG_NETXEN_NIC is not set
671# CONFIG_NIU is not set
672# CONFIG_MLX4_CORE is not set
673# CONFIG_TEHUTI is not set
674# CONFIG_BNX2X is not set
675# CONFIG_SFC is not set
676# CONFIG_TR is not set
677
678#
679# Wireless LAN
680#
681# CONFIG_WLAN_PRE80211 is not set
682# CONFIG_WLAN_80211 is not set
683# CONFIG_IWLWIFI_LEDS is not set
684
685#
686# USB Network Adapters
687#
688# CONFIG_USB_CATC is not set
689# CONFIG_USB_KAWETH is not set
690# CONFIG_USB_PEGASUS is not set
691# CONFIG_USB_RTL8150 is not set
692# CONFIG_USB_USBNET is not set
693# CONFIG_WAN is not set
694# CONFIG_FDDI is not set
695# CONFIG_HIPPI is not set
696# CONFIG_PPP is not set
697# CONFIG_SLIP is not set
698# CONFIG_NET_FC is not set
699# CONFIG_NETCONSOLE is not set
700# CONFIG_NETPOLL is not set
701# CONFIG_NET_POLL_CONTROLLER is not set
702# CONFIG_ISDN is not set
703# CONFIG_PHONE is not set
704
705#
706# Input device support
707#
708CONFIG_INPUT=y
709# CONFIG_INPUT_FF_MEMLESS is not set
710# CONFIG_INPUT_POLLDEV is not set
711
712#
713# Userland interfaces
714#
715# CONFIG_INPUT_MOUSEDEV is not set
716# CONFIG_INPUT_JOYDEV is not set
717# CONFIG_INPUT_EVDEV is not set
718# CONFIG_INPUT_EVBUG is not set
719
720#
721# Input Device Drivers
722#
723# CONFIG_INPUT_KEYBOARD is not set
724# CONFIG_INPUT_MOUSE is not set
725# CONFIG_INPUT_JOYSTICK is not set
726# CONFIG_INPUT_TABLET is not set
727# CONFIG_INPUT_TOUCHSCREEN is not set
728# CONFIG_INPUT_MISC is not set
729
730#
731# Hardware I/O ports
732#
733CONFIG_SERIO=y
734CONFIG_SERIO_I8042=y
735CONFIG_SERIO_SERPORT=y
736# CONFIG_SERIO_PCIPS2 is not set
737CONFIG_SERIO_LIBPS2=y
738# CONFIG_SERIO_RAW is not set
739# CONFIG_SERIO_XILINX_XPS_PS2 is not set
740# CONFIG_GAMEPORT is not set
741
742#
743# Character devices
744#
745CONFIG_VT=y
746CONFIG_CONSOLE_TRANSLATIONS=y
747CONFIG_VT_CONSOLE=y
748CONFIG_HW_CONSOLE=y
749# CONFIG_VT_HW_CONSOLE_BINDING is not set
750CONFIG_DEVKMEM=y
751# CONFIG_SERIAL_NONSTANDARD is not set
752# CONFIG_NOZOMI is not set
753
754#
755# Serial drivers
756#
757CONFIG_SERIAL_8250=y
758CONFIG_SERIAL_8250_CONSOLE=y
759CONFIG_SERIAL_8250_PCI=y
760CONFIG_SERIAL_8250_NR_UARTS=2
761CONFIG_SERIAL_8250_RUNTIME_UARTS=2
762CONFIG_SERIAL_8250_EXTENDED=y
763CONFIG_SERIAL_8250_MANY_PORTS=y
764CONFIG_SERIAL_8250_SHARE_IRQ=y
765CONFIG_SERIAL_8250_DETECT_IRQ=y
766CONFIG_SERIAL_8250_RSA=y
767
768#
769# Non-8250 serial port support
770#
771# CONFIG_SERIAL_UARTLITE is not set
772CONFIG_SERIAL_CORE=y
773CONFIG_SERIAL_CORE_CONSOLE=y
774# CONFIG_SERIAL_JSM is not set
775# CONFIG_SERIAL_OF_PLATFORM is not set
776CONFIG_UNIX98_PTYS=y
777CONFIG_LEGACY_PTYS=y
778CONFIG_LEGACY_PTY_COUNT=256
779# CONFIG_IPMI_HANDLER is not set
780# CONFIG_HW_RANDOM is not set
781CONFIG_NVRAM=y
782# CONFIG_R3964 is not set
783# CONFIG_APPLICOM is not set
784# CONFIG_RAW_DRIVER is not set
785# CONFIG_TCG_TPM is not set
786CONFIG_DEVPORT=y
787CONFIG_I2C=y
788CONFIG_I2C_BOARDINFO=y
789# CONFIG_I2C_CHARDEV is not set
790CONFIG_I2C_HELPER_AUTO=y
791
792#
793# I2C Hardware Bus support
794#
795
796#
797# PC SMBus host controller drivers
798#
799# CONFIG_I2C_ALI1535 is not set
800# CONFIG_I2C_ALI1563 is not set
801# CONFIG_I2C_ALI15X3 is not set
802# CONFIG_I2C_AMD756 is not set
803# CONFIG_I2C_AMD8111 is not set
804# CONFIG_I2C_I801 is not set
805# CONFIG_I2C_ISCH is not set
806# CONFIG_I2C_PIIX4 is not set
807# CONFIG_I2C_NFORCE2 is not set
808# CONFIG_I2C_SIS5595 is not set
809# CONFIG_I2C_SIS630 is not set
810# CONFIG_I2C_SIS96X is not set
811# CONFIG_I2C_VIA is not set
812# CONFIG_I2C_VIAPRO is not set
813
814#
815# I2C system bus drivers (mostly embedded / system-on-chip)
816#
817CONFIG_I2C_MPC=y
818# CONFIG_I2C_OCORES is not set
819# CONFIG_I2C_SIMTEC is not set
820
821#
822# External I2C/SMBus adapter drivers
823#
824# CONFIG_I2C_PARPORT_LIGHT is not set
825# CONFIG_I2C_TAOS_EVM is not set
826# CONFIG_I2C_TINY_USB is not set
827
828#
829# Graphics adapter I2C/DDC channel drivers
830#
831# CONFIG_I2C_VOODOO3 is not set
832
833#
834# Other I2C/SMBus bus drivers
835#
836# CONFIG_I2C_PCA_PLATFORM is not set
837# CONFIG_I2C_STUB is not set
838
839#
840# Miscellaneous I2C Chip support
841#
842# CONFIG_DS1682 is not set
843# CONFIG_AT24 is not set
844CONFIG_SENSORS_EEPROM=y
845# CONFIG_SENSORS_PCF8574 is not set
846# CONFIG_PCF8575 is not set
847# CONFIG_SENSORS_PCA9539 is not set
848# CONFIG_SENSORS_PCF8591 is not set
849# CONFIG_SENSORS_MAX6875 is not set
850# CONFIG_SENSORS_TSL2550 is not set
851# CONFIG_I2C_DEBUG_CORE is not set
852# CONFIG_I2C_DEBUG_ALGO is not set
853# CONFIG_I2C_DEBUG_BUS is not set
854# CONFIG_I2C_DEBUG_CHIP is not set
855# CONFIG_SPI is not set
856CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
857# CONFIG_GPIOLIB is not set
858# CONFIG_W1 is not set
859# CONFIG_POWER_SUPPLY is not set
860# CONFIG_HWMON is not set
861# CONFIG_THERMAL is not set
862# CONFIG_THERMAL_HWMON is not set
863# CONFIG_WATCHDOG is not set
864
865#
866# Sonics Silicon Backplane
867#
868CONFIG_SSB_POSSIBLE=y
869# CONFIG_SSB is not set
870
871#
872# Multifunction device drivers
873#
874# CONFIG_MFD_CORE is not set
875# CONFIG_MFD_SM501 is not set
876# CONFIG_HTC_PASIC3 is not set
877# CONFIG_MFD_TMIO is not set
878
879#
880# Multimedia devices
881#
882
883#
884# Multimedia core support
885#
886# CONFIG_VIDEO_DEV is not set
887CONFIG_DVB_CORE=m
888CONFIG_VIDEO_MEDIA=m
889
890#
891# Multimedia drivers
892#
893# CONFIG_MEDIA_ATTACH is not set
894CONFIG_MEDIA_TUNER=m
895# CONFIG_MEDIA_TUNER_CUSTOMIZE is not set
896CONFIG_MEDIA_TUNER_SIMPLE=m
897CONFIG_MEDIA_TUNER_TDA8290=m
898CONFIG_MEDIA_TUNER_TDA9887=m
899CONFIG_MEDIA_TUNER_TEA5761=m
900CONFIG_MEDIA_TUNER_TEA5767=m
901CONFIG_MEDIA_TUNER_MT20XX=m
902CONFIG_MEDIA_TUNER_XC2028=m
903CONFIG_MEDIA_TUNER_XC5000=m
904CONFIG_DVB_CAPTURE_DRIVERS=y
905
906#
907# Supported SAA7146 based PCI Adapters
908#
909# CONFIG_TTPCI_EEPROM is not set
910# CONFIG_DVB_BUDGET_CORE is not set
911
912#
913# Supported USB Adapters
914#
915# CONFIG_DVB_USB is not set
916# CONFIG_DVB_TTUSB_BUDGET is not set
917# CONFIG_DVB_TTUSB_DEC is not set
918# CONFIG_DVB_CINERGYT2 is not set
919# CONFIG_DVB_SIANO_SMS1XXX is not set
920
921#
922# Supported FlexCopII (B2C2) Adapters
923#
924# CONFIG_DVB_B2C2_FLEXCOP is not set
925
926#
927# Supported BT878 Adapters
928#
929
930#
931# Supported Pluto2 Adapters
932#
933# CONFIG_DVB_PLUTO2 is not set
934
935#
936# Supported DVB Frontends
937#
938
939#
940# Customise DVB Frontends
941#
942# CONFIG_DVB_FE_CUSTOMISE is not set
943
944#
945# DVB-S (satellite) frontends
946#
947# CONFIG_DVB_CX24110 is not set
948# CONFIG_DVB_CX24123 is not set
949# CONFIG_DVB_MT312 is not set
950# CONFIG_DVB_S5H1420 is not set
951# CONFIG_DVB_STV0299 is not set
952# CONFIG_DVB_TDA8083 is not set
953# CONFIG_DVB_TDA10086 is not set
954# CONFIG_DVB_VES1X93 is not set
955# CONFIG_DVB_TUNER_ITD1000 is not set
956# CONFIG_DVB_TDA826X is not set
957# CONFIG_DVB_TUA6100 is not set
958
959#
960# DVB-T (terrestrial) frontends
961#
962# CONFIG_DVB_SP8870 is not set
963# CONFIG_DVB_SP887X is not set
964# CONFIG_DVB_CX22700 is not set
965# CONFIG_DVB_CX22702 is not set
966# CONFIG_DVB_DRX397XD is not set
967# CONFIG_DVB_L64781 is not set
968# CONFIG_DVB_TDA1004X is not set
969# CONFIG_DVB_NXT6000 is not set
970# CONFIG_DVB_MT352 is not set
971# CONFIG_DVB_ZL10353 is not set
972# CONFIG_DVB_DIB3000MB is not set
973# CONFIG_DVB_DIB3000MC is not set
974# CONFIG_DVB_DIB7000M is not set
975# CONFIG_DVB_DIB7000P is not set
976# CONFIG_DVB_TDA10048 is not set
977
978#
979# DVB-C (cable) frontends
980#
981# CONFIG_DVB_VES1820 is not set
982# CONFIG_DVB_TDA10021 is not set
983# CONFIG_DVB_TDA10023 is not set
984# CONFIG_DVB_STV0297 is not set
985
986#
987# ATSC (North American/Korean Terrestrial/Cable DTV) frontends
988#
989# CONFIG_DVB_NXT200X is not set
990# CONFIG_DVB_OR51211 is not set
991# CONFIG_DVB_OR51132 is not set
992# CONFIG_DVB_BCM3510 is not set
993# CONFIG_DVB_LGDT330X is not set
994# CONFIG_DVB_S5H1409 is not set
995# CONFIG_DVB_AU8522 is not set
996# CONFIG_DVB_S5H1411 is not set
997
998#
999# Digital terrestrial only tuners/PLL
1000#
1001# CONFIG_DVB_PLL is not set
1002# CONFIG_DVB_TUNER_DIB0070 is not set
1003
1004#
1005# SEC control devices for DVB-S
1006#
1007# CONFIG_DVB_LNBP21 is not set
1008# CONFIG_DVB_ISL6405 is not set
1009# CONFIG_DVB_ISL6421 is not set
1010CONFIG_DAB=y
1011# CONFIG_USB_DABUSB is not set
1012
1013#
1014# Graphics support
1015#
1016# CONFIG_AGP is not set
1017# CONFIG_DRM is not set
1018# CONFIG_VGASTATE is not set
1019CONFIG_VIDEO_OUTPUT_CONTROL=y
1020# CONFIG_FB is not set
1021# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1022
1023#
1024# Display device support
1025#
1026# CONFIG_DISPLAY_SUPPORT is not set
1027
1028#
1029# Console display driver support
1030#
1031CONFIG_VGA_CONSOLE=y
1032# CONFIG_VGACON_SOFT_SCROLLBACK is not set
1033CONFIG_DUMMY_CONSOLE=y
1034CONFIG_SOUND=y
1035CONFIG_SND=y
1036CONFIG_SND_TIMER=y
1037CONFIG_SND_PCM=y
1038# CONFIG_SND_SEQUENCER is not set
1039CONFIG_SND_OSSEMUL=y
1040CONFIG_SND_MIXER_OSS=y
1041CONFIG_SND_PCM_OSS=y
1042CONFIG_SND_PCM_OSS_PLUGINS=y
1043# CONFIG_SND_DYNAMIC_MINORS is not set
1044# CONFIG_SND_SUPPORT_OLD_API is not set
1045CONFIG_SND_VERBOSE_PROCFS=y
1046# CONFIG_SND_VERBOSE_PRINTK is not set
1047# CONFIG_SND_DEBUG is not set
1048CONFIG_SND_VMASTER=y
1049CONFIG_SND_AC97_CODEC=y
1050CONFIG_SND_DRIVERS=y
1051# CONFIG_SND_DUMMY is not set
1052# CONFIG_SND_MTPAV is not set
1053# CONFIG_SND_SERIAL_U16550 is not set
1054# CONFIG_SND_MPU401 is not set
1055# CONFIG_SND_AC97_POWER_SAVE is not set
1056CONFIG_SND_PCI=y
1057# CONFIG_SND_AD1889 is not set
1058# CONFIG_SND_ALS300 is not set
1059# CONFIG_SND_ALS4000 is not set
1060# CONFIG_SND_ALI5451 is not set
1061# CONFIG_SND_ATIIXP is not set
1062# CONFIG_SND_ATIIXP_MODEM is not set
1063# CONFIG_SND_AU8810 is not set
1064# CONFIG_SND_AU8820 is not set
1065# CONFIG_SND_AU8830 is not set
1066# CONFIG_SND_AW2 is not set
1067# CONFIG_SND_AZT3328 is not set
1068# CONFIG_SND_BT87X is not set
1069# CONFIG_SND_CA0106 is not set
1070# CONFIG_SND_CMIPCI is not set
1071# CONFIG_SND_OXYGEN is not set
1072# CONFIG_SND_CS4281 is not set
1073# CONFIG_SND_CS46XX is not set
1074# CONFIG_SND_CS5530 is not set
1075# CONFIG_SND_DARLA20 is not set
1076# CONFIG_SND_GINA20 is not set
1077# CONFIG_SND_LAYLA20 is not set
1078# CONFIG_SND_DARLA24 is not set
1079# CONFIG_SND_GINA24 is not set
1080# CONFIG_SND_LAYLA24 is not set
1081# CONFIG_SND_MONA is not set
1082# CONFIG_SND_MIA is not set
1083# CONFIG_SND_ECHO3G is not set
1084# CONFIG_SND_INDIGO is not set
1085# CONFIG_SND_INDIGOIO is not set
1086# CONFIG_SND_INDIGODJ is not set
1087# CONFIG_SND_EMU10K1 is not set
1088# CONFIG_SND_EMU10K1X is not set
1089# CONFIG_SND_ENS1370 is not set
1090# CONFIG_SND_ENS1371 is not set
1091# CONFIG_SND_ES1938 is not set
1092# CONFIG_SND_ES1968 is not set
1093# CONFIG_SND_FM801 is not set
1094# CONFIG_SND_HDA_INTEL is not set
1095# CONFIG_SND_HDSP is not set
1096# CONFIG_SND_HDSPM is not set
1097# CONFIG_SND_HIFIER is not set
1098# CONFIG_SND_ICE1712 is not set
1099# CONFIG_SND_ICE1724 is not set
1100CONFIG_SND_INTEL8X0=y
1101# CONFIG_SND_INTEL8X0M is not set
1102# CONFIG_SND_KORG1212 is not set
1103# CONFIG_SND_MAESTRO3 is not set
1104# CONFIG_SND_MIXART is not set
1105# CONFIG_SND_NM256 is not set
1106# CONFIG_SND_PCXHR is not set
1107# CONFIG_SND_RIPTIDE is not set
1108# CONFIG_SND_RME32 is not set
1109# CONFIG_SND_RME96 is not set
1110# CONFIG_SND_RME9652 is not set
1111# CONFIG_SND_SONICVIBES is not set
1112# CONFIG_SND_TRIDENT is not set
1113# CONFIG_SND_VIA82XX is not set
1114# CONFIG_SND_VIA82XX_MODEM is not set
1115# CONFIG_SND_VIRTUOSO is not set
1116# CONFIG_SND_VX222 is not set
1117# CONFIG_SND_YMFPCI is not set
1118CONFIG_SND_PPC=y
1119CONFIG_SND_USB=y
1120# CONFIG_SND_USB_AUDIO is not set
1121# CONFIG_SND_USB_USX2Y is not set
1122# CONFIG_SND_USB_CAIAQ is not set
1123# CONFIG_SND_SOC is not set
1124# CONFIG_SOUND_PRIME is not set
1125CONFIG_AC97_BUS=y
1126CONFIG_HID_SUPPORT=y
1127CONFIG_HID=y
1128# CONFIG_HID_DEBUG is not set
1129# CONFIG_HIDRAW is not set
1130
1131#
1132# USB Input Devices
1133#
1134CONFIG_USB_HID=y
1135# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1136# CONFIG_HID_FF is not set
1137# CONFIG_USB_HIDDEV is not set
1138CONFIG_USB_SUPPORT=y
1139CONFIG_USB_ARCH_HAS_HCD=y
1140CONFIG_USB_ARCH_HAS_OHCI=y
1141CONFIG_USB_ARCH_HAS_EHCI=y
1142CONFIG_USB=y
1143# CONFIG_USB_DEBUG is not set
1144# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1145
1146#
1147# Miscellaneous USB options
1148#
1149CONFIG_USB_DEVICEFS=y
1150CONFIG_USB_DEVICE_CLASS=y
1151# CONFIG_USB_DYNAMIC_MINORS is not set
1152# CONFIG_USB_OTG is not set
1153# CONFIG_USB_OTG_WHITELIST is not set
1154# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1155CONFIG_USB_MON=y
1156
1157#
1158# USB Host Controller Drivers
1159#
1160# CONFIG_USB_C67X00_HCD is not set
1161CONFIG_USB_EHCI_HCD=y
1162# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1163# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1164# CONFIG_USB_EHCI_FSL is not set
1165CONFIG_USB_EHCI_HCD_PPC_OF=y
1166# CONFIG_USB_ISP116X_HCD is not set
1167# CONFIG_USB_ISP1760_HCD is not set
1168CONFIG_USB_OHCI_HCD=y
1169CONFIG_USB_OHCI_HCD_PPC_OF=y
1170CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
1171CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
1172CONFIG_USB_OHCI_HCD_PCI=y
1173CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
1174CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
1175CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1176# CONFIG_USB_UHCI_HCD is not set
1177# CONFIG_USB_SL811_HCD is not set
1178# CONFIG_USB_R8A66597_HCD is not set
1179
1180#
1181# USB Device Class drivers
1182#
1183# CONFIG_USB_ACM is not set
1184# CONFIG_USB_PRINTER is not set
1185# CONFIG_USB_WDM is not set
1186
1187#
1188# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1189#
1190
1191#
1192# may also be needed; see USB_STORAGE Help for more information
1193#
1194CONFIG_USB_STORAGE=y
1195# CONFIG_USB_STORAGE_DEBUG is not set
1196# CONFIG_USB_STORAGE_DATAFAB is not set
1197# CONFIG_USB_STORAGE_FREECOM is not set
1198# CONFIG_USB_STORAGE_ISD200 is not set
1199# CONFIG_USB_STORAGE_DPCM is not set
1200# CONFIG_USB_STORAGE_USBAT is not set
1201# CONFIG_USB_STORAGE_SDDR09 is not set
1202# CONFIG_USB_STORAGE_SDDR55 is not set
1203# CONFIG_USB_STORAGE_JUMPSHOT is not set
1204# CONFIG_USB_STORAGE_ALAUDA is not set
1205# CONFIG_USB_STORAGE_ONETOUCH is not set
1206# CONFIG_USB_STORAGE_KARMA is not set
1207# CONFIG_USB_STORAGE_SIERRA is not set
1208# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1209# CONFIG_USB_LIBUSUAL is not set
1210
1211#
1212# USB Imaging devices
1213#
1214# CONFIG_USB_MDC800 is not set
1215# CONFIG_USB_MICROTEK is not set
1216
1217#
1218# USB port drivers
1219#
1220# CONFIG_USB_SERIAL is not set
1221
1222#
1223# USB Miscellaneous drivers
1224#
1225# CONFIG_USB_EMI62 is not set
1226# CONFIG_USB_EMI26 is not set
1227# CONFIG_USB_ADUTUX is not set
1228# CONFIG_USB_RIO500 is not set
1229# CONFIG_USB_LEGOTOWER is not set
1230# CONFIG_USB_LCD is not set
1231# CONFIG_USB_BERRY_CHARGE is not set
1232# CONFIG_USB_LED is not set
1233# CONFIG_USB_CYPRESS_CY7C63 is not set
1234# CONFIG_USB_CYTHERM is not set
1235# CONFIG_USB_PHIDGET is not set
1236# CONFIG_USB_IDMOUSE is not set
1237# CONFIG_USB_FTDI_ELAN is not set
1238# CONFIG_USB_APPLEDISPLAY is not set
1239# CONFIG_USB_SISUSBVGA is not set
1240# CONFIG_USB_LD is not set
1241# CONFIG_USB_TRANCEVIBRATOR is not set
1242# CONFIG_USB_IOWARRIOR is not set
1243# CONFIG_USB_TEST is not set
1244# CONFIG_USB_ISIGHTFW is not set
1245# CONFIG_USB_GADGET is not set
1246# CONFIG_MMC is not set
1247# CONFIG_MEMSTICK is not set
1248# CONFIG_NEW_LEDS is not set
1249# CONFIG_ACCESSIBILITY is not set
1250# CONFIG_INFINIBAND is not set
1251# CONFIG_EDAC is not set
1252CONFIG_RTC_LIB=y
1253CONFIG_RTC_CLASS=y
1254CONFIG_RTC_HCTOSYS=y
1255CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1256# CONFIG_RTC_DEBUG is not set
1257
1258#
1259# RTC interfaces
1260#
1261CONFIG_RTC_INTF_SYSFS=y
1262CONFIG_RTC_INTF_PROC=y
1263CONFIG_RTC_INTF_DEV=y
1264# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1265# CONFIG_RTC_DRV_TEST is not set
1266
1267#
1268# I2C RTC drivers
1269#
1270# CONFIG_RTC_DRV_DS1307 is not set
1271# CONFIG_RTC_DRV_DS1374 is not set
1272# CONFIG_RTC_DRV_DS1672 is not set
1273# CONFIG_RTC_DRV_MAX6900 is not set
1274# CONFIG_RTC_DRV_RS5C372 is not set
1275# CONFIG_RTC_DRV_ISL1208 is not set
1276# CONFIG_RTC_DRV_X1205 is not set
1277# CONFIG_RTC_DRV_PCF8563 is not set
1278# CONFIG_RTC_DRV_PCF8583 is not set
1279# CONFIG_RTC_DRV_M41T80 is not set
1280# CONFIG_RTC_DRV_S35390A is not set
1281# CONFIG_RTC_DRV_FM3130 is not set
1282
1283#
1284# SPI RTC drivers
1285#
1286
1287#
1288# Platform RTC drivers
1289#
1290CONFIG_RTC_DRV_CMOS=y
1291# CONFIG_RTC_DRV_DS1511 is not set
1292# CONFIG_RTC_DRV_DS1553 is not set
1293# CONFIG_RTC_DRV_DS1742 is not set
1294# CONFIG_RTC_DRV_STK17TA8 is not set
1295# CONFIG_RTC_DRV_M48T86 is not set
1296# CONFIG_RTC_DRV_M48T59 is not set
1297# CONFIG_RTC_DRV_V3020 is not set
1298
1299#
1300# on-CPU RTC drivers
1301#
1302# CONFIG_RTC_DRV_PPC is not set
1303# CONFIG_DMADEVICES is not set
1304# CONFIG_UIO is not set
1305
1306#
1307# File systems
1308#
1309CONFIG_EXT2_FS=y
1310# CONFIG_EXT2_FS_XATTR is not set
1311# CONFIG_EXT2_FS_XIP is not set
1312CONFIG_EXT3_FS=y
1313CONFIG_EXT3_FS_XATTR=y
1314# CONFIG_EXT3_FS_POSIX_ACL is not set
1315# CONFIG_EXT3_FS_SECURITY is not set
1316# CONFIG_EXT4DEV_FS is not set
1317CONFIG_JBD=y
1318CONFIG_FS_MBCACHE=y
1319# CONFIG_REISERFS_FS is not set
1320# CONFIG_JFS_FS is not set
1321# CONFIG_FS_POSIX_ACL is not set
1322# CONFIG_XFS_FS is not set
1323# CONFIG_OCFS2_FS is not set
1324CONFIG_DNOTIFY=y
1325CONFIG_INOTIFY=y
1326CONFIG_INOTIFY_USER=y
1327# CONFIG_QUOTA is not set
1328# CONFIG_AUTOFS_FS is not set
1329# CONFIG_AUTOFS4_FS is not set
1330# CONFIG_FUSE_FS is not set
1331
1332#
1333# CD-ROM/DVD Filesystems
1334#
1335CONFIG_ISO9660_FS=m
1336CONFIG_JOLIET=y
1337CONFIG_ZISOFS=y
1338CONFIG_UDF_FS=m
1339CONFIG_UDF_NLS=y
1340
1341#
1342# DOS/FAT/NT Filesystems
1343#
1344CONFIG_FAT_FS=y
1345CONFIG_MSDOS_FS=m
1346CONFIG_VFAT_FS=y
1347CONFIG_FAT_DEFAULT_CODEPAGE=437
1348CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1349CONFIG_NTFS_FS=y
1350# CONFIG_NTFS_DEBUG is not set
1351# CONFIG_NTFS_RW is not set
1352
1353#
1354# Pseudo filesystems
1355#
1356CONFIG_PROC_FS=y
1357CONFIG_PROC_KCORE=y
1358CONFIG_PROC_SYSCTL=y
1359CONFIG_SYSFS=y
1360CONFIG_TMPFS=y
1361# CONFIG_TMPFS_POSIX_ACL is not set
1362# CONFIG_HUGETLB_PAGE is not set
1363# CONFIG_CONFIGFS_FS is not set
1364
1365#
1366# Miscellaneous filesystems
1367#
1368CONFIG_ADFS_FS=m
1369# CONFIG_ADFS_FS_RW is not set
1370CONFIG_AFFS_FS=m
1371CONFIG_HFS_FS=m
1372CONFIG_HFSPLUS_FS=m
1373CONFIG_BEFS_FS=m
1374# CONFIG_BEFS_DEBUG is not set
1375CONFIG_BFS_FS=m
1376CONFIG_EFS_FS=m
1377CONFIG_CRAMFS=y
1378CONFIG_VXFS_FS=m
1379# CONFIG_MINIX_FS is not set
1380# CONFIG_OMFS_FS is not set
1381CONFIG_HPFS_FS=m
1382CONFIG_QNX4FS_FS=m
1383# CONFIG_ROMFS_FS is not set
1384CONFIG_SYSV_FS=m
1385CONFIG_UFS_FS=m
1386# CONFIG_UFS_FS_WRITE is not set
1387# CONFIG_UFS_DEBUG is not set
1388CONFIG_NETWORK_FILESYSTEMS=y
1389CONFIG_NFS_FS=y
1390CONFIG_NFS_V3=y
1391# CONFIG_NFS_V3_ACL is not set
1392CONFIG_NFS_V4=y
1393CONFIG_ROOT_NFS=y
1394CONFIG_NFSD=y
1395# CONFIG_NFSD_V3 is not set
1396# CONFIG_NFSD_V4 is not set
1397CONFIG_LOCKD=y
1398CONFIG_LOCKD_V4=y
1399CONFIG_EXPORTFS=y
1400CONFIG_NFS_COMMON=y
1401CONFIG_SUNRPC=y
1402CONFIG_SUNRPC_GSS=y
1403CONFIG_RPCSEC_GSS_KRB5=y
1404# CONFIG_RPCSEC_GSS_SPKM3 is not set
1405# CONFIG_SMB_FS is not set
1406# CONFIG_CIFS is not set
1407# CONFIG_NCP_FS is not set
1408# CONFIG_CODA_FS is not set
1409# CONFIG_AFS_FS is not set
1410
1411#
1412# Partition Types
1413#
1414CONFIG_PARTITION_ADVANCED=y
1415# CONFIG_ACORN_PARTITION is not set
1416# CONFIG_OSF_PARTITION is not set
1417# CONFIG_AMIGA_PARTITION is not set
1418# CONFIG_ATARI_PARTITION is not set
1419CONFIG_MAC_PARTITION=y
1420CONFIG_MSDOS_PARTITION=y
1421# CONFIG_BSD_DISKLABEL is not set
1422# CONFIG_MINIX_SUBPARTITION is not set
1423# CONFIG_SOLARIS_X86_PARTITION is not set
1424# CONFIG_UNIXWARE_DISKLABEL is not set
1425# CONFIG_LDM_PARTITION is not set
1426# CONFIG_SGI_PARTITION is not set
1427# CONFIG_ULTRIX_PARTITION is not set
1428# CONFIG_SUN_PARTITION is not set
1429# CONFIG_KARMA_PARTITION is not set
1430# CONFIG_EFI_PARTITION is not set
1431# CONFIG_SYSV68_PARTITION is not set
1432CONFIG_NLS=y
1433CONFIG_NLS_DEFAULT="iso8859-1"
1434# CONFIG_NLS_CODEPAGE_437 is not set
1435# CONFIG_NLS_CODEPAGE_737 is not set
1436# CONFIG_NLS_CODEPAGE_775 is not set
1437# CONFIG_NLS_CODEPAGE_850 is not set
1438# CONFIG_NLS_CODEPAGE_852 is not set
1439# CONFIG_NLS_CODEPAGE_855 is not set
1440# CONFIG_NLS_CODEPAGE_857 is not set
1441# CONFIG_NLS_CODEPAGE_860 is not set
1442# CONFIG_NLS_CODEPAGE_861 is not set
1443# CONFIG_NLS_CODEPAGE_862 is not set
1444# CONFIG_NLS_CODEPAGE_863 is not set
1445# CONFIG_NLS_CODEPAGE_864 is not set
1446# CONFIG_NLS_CODEPAGE_865 is not set
1447# CONFIG_NLS_CODEPAGE_866 is not set
1448# CONFIG_NLS_CODEPAGE_869 is not set
1449# CONFIG_NLS_CODEPAGE_936 is not set
1450# CONFIG_NLS_CODEPAGE_950 is not set
1451# CONFIG_NLS_CODEPAGE_932 is not set
1452# CONFIG_NLS_CODEPAGE_949 is not set
1453# CONFIG_NLS_CODEPAGE_874 is not set
1454# CONFIG_NLS_ISO8859_8 is not set
1455# CONFIG_NLS_CODEPAGE_1250 is not set
1456# CONFIG_NLS_CODEPAGE_1251 is not set
1457# CONFIG_NLS_ASCII is not set
1458# CONFIG_NLS_ISO8859_1 is not set
1459# CONFIG_NLS_ISO8859_2 is not set
1460# CONFIG_NLS_ISO8859_3 is not set
1461# CONFIG_NLS_ISO8859_4 is not set
1462# CONFIG_NLS_ISO8859_5 is not set
1463# CONFIG_NLS_ISO8859_6 is not set
1464# CONFIG_NLS_ISO8859_7 is not set
1465# CONFIG_NLS_ISO8859_9 is not set
1466# CONFIG_NLS_ISO8859_13 is not set
1467# CONFIG_NLS_ISO8859_14 is not set
1468# CONFIG_NLS_ISO8859_15 is not set
1469# CONFIG_NLS_KOI8_R is not set
1470# CONFIG_NLS_KOI8_U is not set
1471CONFIG_NLS_UTF8=m
1472# CONFIG_DLM is not set
1473
1474#
1475# Library routines
1476#
1477CONFIG_BITREVERSE=y
1478# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1479# CONFIG_CRC_CCITT is not set
1480# CONFIG_CRC16 is not set
1481CONFIG_CRC_T10DIF=y
1482CONFIG_CRC_ITU_T=m
1483CONFIG_CRC32=y
1484# CONFIG_CRC7 is not set
1485CONFIG_LIBCRC32C=m
1486CONFIG_ZLIB_INFLATE=y
1487CONFIG_PLIST=y
1488CONFIG_HAS_IOMEM=y
1489CONFIG_HAS_IOPORT=y
1490CONFIG_HAS_DMA=y
1491CONFIG_HAVE_LMB=y
1492
1493#
1494# Kernel hacking
1495#
1496# CONFIG_PRINTK_TIME is not set
1497CONFIG_ENABLE_WARN_DEPRECATED=y
1498CONFIG_ENABLE_MUST_CHECK=y
1499CONFIG_FRAME_WARN=1024
1500# CONFIG_MAGIC_SYSRQ is not set
1501# CONFIG_UNUSED_SYMBOLS is not set
1502# CONFIG_DEBUG_FS is not set
1503# CONFIG_HEADERS_CHECK is not set
1504CONFIG_DEBUG_KERNEL=y
1505# CONFIG_DEBUG_SHIRQ is not set
1506CONFIG_DETECT_SOFTLOCKUP=y
1507# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1508CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1509CONFIG_SCHED_DEBUG=y
1510# CONFIG_SCHEDSTATS is not set
1511# CONFIG_TIMER_STATS is not set
1512# CONFIG_DEBUG_OBJECTS is not set
1513# CONFIG_SLUB_DEBUG_ON is not set
1514# CONFIG_SLUB_STATS is not set
1515# CONFIG_DEBUG_RT_MUTEXES is not set
1516# CONFIG_RT_MUTEX_TESTER is not set
1517# CONFIG_DEBUG_SPINLOCK is not set
1518# CONFIG_DEBUG_MUTEXES is not set
1519# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1520# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1521# CONFIG_DEBUG_KOBJECT is not set
1522# CONFIG_DEBUG_HIGHMEM is not set
1523# CONFIG_DEBUG_BUGVERBOSE is not set
1524CONFIG_DEBUG_INFO=y
1525# CONFIG_DEBUG_VM is not set
1526# CONFIG_DEBUG_WRITECOUNT is not set
1527# CONFIG_DEBUG_MEMORY_INIT is not set
1528# CONFIG_DEBUG_LIST is not set
1529# CONFIG_DEBUG_SG is not set
1530# CONFIG_BOOT_PRINTK_DELAY is not set
1531# CONFIG_RCU_TORTURE_TEST is not set
1532# CONFIG_BACKTRACE_SELF_TEST is not set
1533# CONFIG_FAULT_INJECTION is not set
1534# CONFIG_LATENCYTOP is not set
1535CONFIG_SYSCTL_SYSCALL_CHECK=y
1536CONFIG_HAVE_FTRACE=y
1537CONFIG_HAVE_DYNAMIC_FTRACE=y
1538# CONFIG_FTRACE is not set
1539# CONFIG_SCHED_TRACER is not set
1540# CONFIG_CONTEXT_SWITCH_TRACER is not set
1541# CONFIG_SAMPLES is not set
1542CONFIG_HAVE_ARCH_KGDB=y
1543# CONFIG_KGDB is not set
1544# CONFIG_DEBUG_STACKOVERFLOW is not set
1545# CONFIG_DEBUG_STACK_USAGE is not set
1546# CONFIG_DEBUG_PAGEALLOC is not set
1547# CONFIG_CODE_PATCHING_SELFTEST is not set
1548# CONFIG_FTR_FIXUP_SELFTEST is not set
1549# CONFIG_MSI_BITMAP_SELFTEST is not set
1550# CONFIG_XMON is not set
1551# CONFIG_IRQSTACKS is not set
1552# CONFIG_BDI_SWITCH is not set
1553# CONFIG_BOOTX_TEXT is not set
1554# CONFIG_PPC_EARLY_DEBUG is not set
1555
1556#
1557# Security options
1558#
1559# CONFIG_KEYS is not set
1560# CONFIG_SECURITY is not set
1561# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1562CONFIG_CRYPTO=y
1563
1564#
1565# Crypto core or helper
1566#
1567CONFIG_CRYPTO_ALGAPI=y
1568CONFIG_CRYPTO_BLKCIPHER=y
1569CONFIG_CRYPTO_HASH=y
1570CONFIG_CRYPTO_MANAGER=y
1571# CONFIG_CRYPTO_GF128MUL is not set
1572# CONFIG_CRYPTO_NULL is not set
1573# CONFIG_CRYPTO_CRYPTD is not set
1574# CONFIG_CRYPTO_AUTHENC is not set
1575# CONFIG_CRYPTO_TEST is not set
1576
1577#
1578# Authenticated Encryption with Associated Data
1579#
1580# CONFIG_CRYPTO_CCM is not set
1581# CONFIG_CRYPTO_GCM is not set
1582# CONFIG_CRYPTO_SEQIV is not set
1583
1584#
1585# Block modes
1586#
1587CONFIG_CRYPTO_CBC=y
1588# CONFIG_CRYPTO_CTR is not set
1589# CONFIG_CRYPTO_CTS is not set
1590# CONFIG_CRYPTO_ECB is not set
1591# CONFIG_CRYPTO_LRW is not set
1592CONFIG_CRYPTO_PCBC=m
1593# CONFIG_CRYPTO_XTS is not set
1594
1595#
1596# Hash modes
1597#
1598CONFIG_CRYPTO_HMAC=y
1599# CONFIG_CRYPTO_XCBC is not set
1600
1601#
1602# Digest
1603#
1604# CONFIG_CRYPTO_CRC32C is not set
1605# CONFIG_CRYPTO_MD4 is not set
1606CONFIG_CRYPTO_MD5=y
1607# CONFIG_CRYPTO_MICHAEL_MIC is not set
1608# CONFIG_CRYPTO_RMD128 is not set
1609# CONFIG_CRYPTO_RMD160 is not set
1610# CONFIG_CRYPTO_RMD256 is not set
1611# CONFIG_CRYPTO_RMD320 is not set
1612CONFIG_CRYPTO_SHA1=m
1613# CONFIG_CRYPTO_SHA256 is not set
1614# CONFIG_CRYPTO_SHA512 is not set
1615# CONFIG_CRYPTO_TGR192 is not set
1616# CONFIG_CRYPTO_WP512 is not set
1617
1618#
1619# Ciphers
1620#
1621# CONFIG_CRYPTO_AES is not set
1622# CONFIG_CRYPTO_ANUBIS is not set
1623# CONFIG_CRYPTO_ARC4 is not set
1624# CONFIG_CRYPTO_BLOWFISH is not set
1625# CONFIG_CRYPTO_CAMELLIA is not set
1626# CONFIG_CRYPTO_CAST5 is not set
1627# CONFIG_CRYPTO_CAST6 is not set
1628CONFIG_CRYPTO_DES=y
1629# CONFIG_CRYPTO_FCRYPT is not set
1630# CONFIG_CRYPTO_KHAZAD is not set
1631# CONFIG_CRYPTO_SALSA20 is not set
1632# CONFIG_CRYPTO_SEED is not set
1633# CONFIG_CRYPTO_SERPENT is not set
1634# CONFIG_CRYPTO_TEA is not set
1635# CONFIG_CRYPTO_TWOFISH is not set
1636
1637#
1638# Compression
1639#
1640# CONFIG_CRYPTO_DEFLATE is not set
1641# CONFIG_CRYPTO_LZO is not set
1642CONFIG_CRYPTO_HW=y
1643# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1644# CONFIG_CRYPTO_DEV_TALITOS is not set
1645# CONFIG_PPC_CLOCK is not set
1646# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/pq2fads_defconfig b/arch/powerpc/configs/pq2fads_defconfig
index b390b7476649..7e17862c38b8 100644
--- a/arch/powerpc/configs/pq2fads_defconfig
+++ b/arch/powerpc/configs/pq2fads_defconfig
@@ -152,11 +152,11 @@ CONFIG_CLASSIC_RCU=y
152# 152#
153CONFIG_PPC_MULTIPLATFORM=y 153CONFIG_PPC_MULTIPLATFORM=y
154CONFIG_CLASSIC32=y 154CONFIG_CLASSIC32=y
155CONFIG_PPC_CHRP=y 155# CONFIG_PPC_CHRP is not set
156# CONFIG_PPC_PMAC is not set
156# CONFIG_MPC5121_ADS is not set 157# CONFIG_MPC5121_ADS is not set
157# CONFIG_MPC5121_GENERIC is not set 158# CONFIG_MPC5121_GENERIC is not set
158# CONFIG_PPC_MPC52xx is not set 159# CONFIG_PPC_MPC52xx is not set
159CONFIG_PPC_PMAC=y
160# CONFIG_PPC_CELL is not set 160# CONFIG_PPC_CELL is not set
161# CONFIG_PPC_CELL_NATIVE is not set 161# CONFIG_PPC_CELL_NATIVE is not set
162CONFIG_PPC_82xx=y 162CONFIG_PPC_82xx=y
diff --git a/arch/powerpc/include/asm/a.out.h b/arch/powerpc/include/asm/a.out.h
deleted file mode 100644
index 89cead6b176e..000000000000
--- a/arch/powerpc/include/asm/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_POWERPC_A_OUT_H
2#define _ASM_POWERPC_A_OUT_H
3
4struct exec
5{
6 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#endif /* _ASM_POWERPC_A_OUT_H */
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index ef8a248dfd55..1e94b07a020e 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -62,6 +62,7 @@ enum powerpc_pmc_type {
62 PPC_PMC_DEFAULT = 0, 62 PPC_PMC_DEFAULT = 0,
63 PPC_PMC_IBM = 1, 63 PPC_PMC_IBM = 1,
64 PPC_PMC_PA6T = 2, 64 PPC_PMC_PA6T = 2,
65 PPC_PMC_G4 = 3,
65}; 66};
66 67
67struct pt_regs; 68struct pt_regs;
@@ -192,6 +193,7 @@ extern const char *powerpc_base_platform;
192#define CPU_FTR_NO_SLBIE_B LONG_ASM_CONST(0x0008000000000000) 193#define CPU_FTR_NO_SLBIE_B LONG_ASM_CONST(0x0008000000000000)
193#define CPU_FTR_VSX LONG_ASM_CONST(0x0010000000000000) 194#define CPU_FTR_VSX LONG_ASM_CONST(0x0010000000000000)
194#define CPU_FTR_SAO LONG_ASM_CONST(0x0020000000000000) 195#define CPU_FTR_SAO LONG_ASM_CONST(0x0020000000000000)
196#define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0040000000000000)
195 197
196#ifndef __ASSEMBLY__ 198#ifndef __ASSEMBLY__
197 199
@@ -387,10 +389,11 @@ extern const char *powerpc_base_platform;
387 CPU_FTR_MMCRA | CPU_FTR_CTRL) 389 CPU_FTR_MMCRA | CPU_FTR_CTRL)
388#define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 390#define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
389 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 391 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
390 CPU_FTR_MMCRA) 392 CPU_FTR_MMCRA | CPU_FTR_CP_USE_DCBTZ)
391#define CPU_FTRS_PPC970 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 393#define CPU_FTRS_PPC970 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
392 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 394 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
393 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA) 395 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \
396 CPU_FTR_CP_USE_DCBTZ)
394#define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 397#define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
395 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 398 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
396 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 399 CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -411,7 +414,8 @@ extern const char *powerpc_base_platform;
411#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 414#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
412 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 415 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
413 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 416 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
414 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_CELL_TB_BUG) 417 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | \
418 CPU_FTR_CELL_TB_BUG | CPU_FTR_CP_USE_DCBTZ)
415#define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 419#define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
416 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 420 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
417 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \ 421 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
diff --git a/arch/powerpc/include/asm/dcr-regs.h b/arch/powerpc/include/asm/dcr-regs.h
index 29b0ecef980a..828e3aa1f2fc 100644
--- a/arch/powerpc/include/asm/dcr-regs.h
+++ b/arch/powerpc/include/asm/dcr-regs.h
@@ -68,6 +68,17 @@
68#define SDR0_UART3 0x0123 68#define SDR0_UART3 0x0123
69#define SDR0_CUST0 0x4000 69#define SDR0_CUST0 0x4000
70 70
71/* SDR for 405EZ */
72#define DCRN_SDR_ICINTSTAT 0x4510
73#define ICINTSTAT_ICRX 0x80000000
74#define ICINTSTAT_ICTX0 0x40000000
75#define ICINTSTAT_ICTX1 0x20000000
76#define ICINTSTAT_ICTX 0x60000000
77
78/* SDRs (460EX/460GT) */
79#define SDR0_ETH_CFG 0x4103
80#define SDR0_ETH_CFG_ECS 0x00000100 /* EMAC int clk source */
81
71/* 82/*
72 * All those DCR register addresses are offsets from the base address 83 * All those DCR register addresses are offsets from the base address
73 * for the SRAM0 controller (e.g. 0x20 on 440GX). The base address is 84 * for the SRAM0 controller (e.g. 0x20 on 440GX). The base address is
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 228ab2a315b9..dfd504caccc1 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -16,9 +16,6 @@ struct dev_archdata {
16 /* DMA operations on that device */ 16 /* DMA operations on that device */
17 struct dma_mapping_ops *dma_ops; 17 struct dma_mapping_ops *dma_ops;
18 void *dma_data; 18 void *dma_data;
19
20 /* NUMA node if applicable */
21 int numa_node;
22}; 19};
23 20
24#endif /* _ASM_POWERPC_DEVICE_H */ 21#endif /* _ASM_POWERPC_DEVICE_H */
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index c7ca45f97dd2..fddb229bd74f 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -44,8 +44,6 @@ extern void __dma_sync_page(struct page *page, unsigned long offset,
44 44
45#endif /* ! CONFIG_NOT_COHERENT_CACHE */ 45#endif /* ! CONFIG_NOT_COHERENT_CACHE */
46 46
47#ifdef CONFIG_PPC64
48
49static inline unsigned long device_to_mask(struct device *dev) 47static inline unsigned long device_to_mask(struct device *dev)
50{ 48{
51 if (dev->dma_mask && *dev->dma_mask) 49 if (dev->dma_mask && *dev->dma_mask)
@@ -76,8 +74,24 @@ struct dma_mapping_ops {
76 struct dma_attrs *attrs); 74 struct dma_attrs *attrs);
77 int (*dma_supported)(struct device *dev, u64 mask); 75 int (*dma_supported)(struct device *dev, u64 mask);
78 int (*set_dma_mask)(struct device *dev, u64 dma_mask); 76 int (*set_dma_mask)(struct device *dev, u64 dma_mask);
77 dma_addr_t (*map_page)(struct device *dev, struct page *page,
78 unsigned long offset, size_t size,
79 enum dma_data_direction direction,
80 struct dma_attrs *attrs);
81 void (*unmap_page)(struct device *dev,
82 dma_addr_t dma_address, size_t size,
83 enum dma_data_direction direction,
84 struct dma_attrs *attrs);
79}; 85};
80 86
87/*
88 * Available generic sets of operations
89 */
90#ifdef CONFIG_PPC64
91extern struct dma_mapping_ops dma_iommu_ops;
92#endif
93extern struct dma_mapping_ops dma_direct_ops;
94
81static inline struct dma_mapping_ops *get_dma_ops(struct device *dev) 95static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
82{ 96{
83 /* We don't handle the NULL dev case for ISA for now. We could 97 /* We don't handle the NULL dev case for ISA for now. We could
@@ -85,8 +99,19 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
85 * only ISA DMA device we support is the floppy and we have a hack 99 * only ISA DMA device we support is the floppy and we have a hack
86 * in the floppy driver directly to get a device for us. 100 * in the floppy driver directly to get a device for us.
87 */ 101 */
88 if (unlikely(dev == NULL || dev->archdata.dma_ops == NULL)) 102
103 if (unlikely(dev == NULL) || dev->archdata.dma_ops == NULL) {
104#ifdef CONFIG_PPC64
89 return NULL; 105 return NULL;
106#else
107 /* Use default on 32-bit if dma_ops is not set up */
108 /* TODO: Long term, we should fix drivers so that dev and
109 * archdata dma_ops are set up for all buses.
110 */
111 return &dma_direct_ops;
112#endif
113 }
114
90 return dev->archdata.dma_ops; 115 return dev->archdata.dma_ops;
91} 116}
92 117
@@ -123,6 +148,12 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
123 return 0; 148 return 0;
124} 149}
125 150
151/*
152 * TODO: map_/unmap_single will ideally go away, to be completely
153 * replaced by map/unmap_page. Until then, we allow dma_ops to have
154 * one or the other, or both by checking to see if the specific
155 * function requested exists; and if not, falling back on the other set.
156 */
126static inline dma_addr_t dma_map_single_attrs(struct device *dev, 157static inline dma_addr_t dma_map_single_attrs(struct device *dev,
127 void *cpu_addr, 158 void *cpu_addr,
128 size_t size, 159 size_t size,
@@ -132,7 +163,14 @@ static inline dma_addr_t dma_map_single_attrs(struct device *dev,
132 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 163 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
133 164
134 BUG_ON(!dma_ops); 165 BUG_ON(!dma_ops);
135 return dma_ops->map_single(dev, cpu_addr, size, direction, attrs); 166
167 if (dma_ops->map_single)
168 return dma_ops->map_single(dev, cpu_addr, size, direction,
169 attrs);
170
171 return dma_ops->map_page(dev, virt_to_page(cpu_addr),
172 (unsigned long)cpu_addr % PAGE_SIZE, size,
173 direction, attrs);
136} 174}
137 175
138static inline void dma_unmap_single_attrs(struct device *dev, 176static inline void dma_unmap_single_attrs(struct device *dev,
@@ -144,7 +182,13 @@ static inline void dma_unmap_single_attrs(struct device *dev,
144 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 182 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
145 183
146 BUG_ON(!dma_ops); 184 BUG_ON(!dma_ops);
147 dma_ops->unmap_single(dev, dma_addr, size, direction, attrs); 185
186 if (dma_ops->unmap_single) {
187 dma_ops->unmap_single(dev, dma_addr, size, direction, attrs);
188 return;
189 }
190
191 dma_ops->unmap_page(dev, dma_addr, size, direction, attrs);
148} 192}
149 193
150static inline dma_addr_t dma_map_page_attrs(struct device *dev, 194static inline dma_addr_t dma_map_page_attrs(struct device *dev,
@@ -156,8 +200,13 @@ static inline dma_addr_t dma_map_page_attrs(struct device *dev,
156 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 200 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
157 201
158 BUG_ON(!dma_ops); 202 BUG_ON(!dma_ops);
203
204 if (dma_ops->map_page)
205 return dma_ops->map_page(dev, page, offset, size, direction,
206 attrs);
207
159 return dma_ops->map_single(dev, page_address(page) + offset, size, 208 return dma_ops->map_single(dev, page_address(page) + offset, size,
160 direction, attrs); 209 direction, attrs);
161} 210}
162 211
163static inline void dma_unmap_page_attrs(struct device *dev, 212static inline void dma_unmap_page_attrs(struct device *dev,
@@ -169,6 +218,12 @@ static inline void dma_unmap_page_attrs(struct device *dev,
169 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 218 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
170 219
171 BUG_ON(!dma_ops); 220 BUG_ON(!dma_ops);
221
222 if (dma_ops->unmap_page) {
223 dma_ops->unmap_page(dev, dma_address, size, direction, attrs);
224 return;
225 }
226
172 dma_ops->unmap_single(dev, dma_address, size, direction, attrs); 227 dma_ops->unmap_single(dev, dma_address, size, direction, attrs);
173} 228}
174 229
@@ -253,126 +308,6 @@ static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
253 dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL); 308 dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL);
254} 309}
255 310
256/*
257 * Available generic sets of operations
258 */
259extern struct dma_mapping_ops dma_iommu_ops;
260extern struct dma_mapping_ops dma_direct_ops;
261
262#else /* CONFIG_PPC64 */
263
264#define dma_supported(dev, mask) (1)
265
266static inline int dma_set_mask(struct device *dev, u64 dma_mask)
267{
268 if (!dev->dma_mask || !dma_supported(dev, mask))
269 return -EIO;
270
271 *dev->dma_mask = dma_mask;
272
273 return 0;
274}
275
276static inline void *dma_alloc_coherent(struct device *dev, size_t size,
277 dma_addr_t * dma_handle,
278 gfp_t gfp)
279{
280#ifdef CONFIG_NOT_COHERENT_CACHE
281 return __dma_alloc_coherent(size, dma_handle, gfp);
282#else
283 void *ret;
284 /* ignore region specifiers */
285 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
286
287 if (dev == NULL || dev->coherent_dma_mask < 0xffffffff)
288 gfp |= GFP_DMA;
289
290 ret = (void *)__get_free_pages(gfp, get_order(size));
291
292 if (ret != NULL) {
293 memset(ret, 0, size);
294 *dma_handle = virt_to_bus(ret);
295 }
296
297 return ret;
298#endif
299}
300
301static inline void
302dma_free_coherent(struct device *dev, size_t size, void *vaddr,
303 dma_addr_t dma_handle)
304{
305#ifdef CONFIG_NOT_COHERENT_CACHE
306 __dma_free_coherent(size, vaddr);
307#else
308 free_pages((unsigned long)vaddr, get_order(size));
309#endif
310}
311
312static inline dma_addr_t
313dma_map_single(struct device *dev, void *ptr, size_t size,
314 enum dma_data_direction direction)
315{
316 BUG_ON(direction == DMA_NONE);
317
318 __dma_sync(ptr, size, direction);
319
320 return virt_to_bus(ptr);
321}
322
323static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
324 size_t size,
325 enum dma_data_direction direction)
326{
327 /* We do nothing. */
328}
329
330static inline dma_addr_t
331dma_map_page(struct device *dev, struct page *page,
332 unsigned long offset, size_t size,
333 enum dma_data_direction direction)
334{
335 BUG_ON(direction == DMA_NONE);
336
337 __dma_sync_page(page, offset, size, direction);
338
339 return page_to_bus(page) + offset;
340}
341
342static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
343 size_t size,
344 enum dma_data_direction direction)
345{
346 /* We do nothing. */
347}
348
349static inline int
350dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
351 enum dma_data_direction direction)
352{
353 struct scatterlist *sg;
354 int i;
355
356 BUG_ON(direction == DMA_NONE);
357
358 for_each_sg(sgl, sg, nents, i) {
359 BUG_ON(!sg_page(sg));
360 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
361 sg->dma_address = page_to_bus(sg_page(sg)) + sg->offset;
362 }
363
364 return nents;
365}
366
367static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
368 int nhwentries,
369 enum dma_data_direction direction)
370{
371 /* We don't do anything here. */
372}
373
374#endif /* CONFIG_PPC64 */
375
376static inline void dma_sync_single_for_cpu(struct device *dev, 311static inline void dma_sync_single_for_cpu(struct device *dev,
377 dma_addr_t dma_handle, size_t size, 312 dma_addr_t dma_handle, size_t size,
378 enum dma_data_direction direction) 313 enum dma_data_direction direction)
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 80d1f399ee51..d812929390e4 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -232,7 +232,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
232#endif /* __powerpc64__ */ 232#endif /* __powerpc64__ */
233 233
234#ifdef __powerpc64__ 234#ifdef __powerpc64__
235# define SET_PERSONALITY(ex, ibcs2) \ 235# define SET_PERSONALITY(ex) \
236do { \ 236do { \
237 unsigned long new_flags = 0; \ 237 unsigned long new_flags = 0; \
238 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ 238 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
@@ -256,7 +256,7 @@ do { \
256# define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \ 256# define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \
257 (exec_stk != EXSTACK_DISABLE_X) : 0) 257 (exec_stk != EXSTACK_DISABLE_X) : 0)
258#else 258#else
259# define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 259# define SET_PERSONALITY(ex) set_personality(PER_LINUX)
260#endif /* __powerpc64__ */ 260#endif /* __powerpc64__ */
261 261
262extern int dcache_bsize; 262extern int dcache_bsize;
@@ -409,6 +409,13 @@ do { \
409/* Keep this the last entry. */ 409/* Keep this the last entry. */
410#define R_PPC64_NUM 107 410#define R_PPC64_NUM 107
411 411
412/* There's actually a third entry here, but it's unused */
413struct ppc64_opd_entry
414{
415 unsigned long funcaddr;
416 unsigned long r2;
417};
418
412#ifdef __KERNEL__ 419#ifdef __KERNEL__
413 420
414#ifdef CONFIG_SPU_BASE 421#ifdef CONFIG_SPU_BASE
diff --git a/arch/powerpc/include/asm/exception.h b/arch/powerpc/include/asm/exception.h
index 329148b5acc6..d3d4534e3c74 100644
--- a/arch/powerpc/include/asm/exception.h
+++ b/arch/powerpc/include/asm/exception.h
@@ -53,14 +53,8 @@
53 * low halfword of the address, but for Kdump we need the whole low 53 * low halfword of the address, but for Kdump we need the whole low
54 * word. 54 * word.
55 */ 55 */
56#ifdef CONFIG_CRASH_DUMP
57#define LOAD_HANDLER(reg, label) \ 56#define LOAD_HANDLER(reg, label) \
58 oris reg,reg,(label)@h; /* virt addr of handler ... */ \ 57 addi reg,reg,(label)-_stext; /* virt addr of handler ... */
59 ori reg,reg,(label)@l; /* .. and the rest */
60#else
61#define LOAD_HANDLER(reg, label) \
62 ori reg,reg,(label)@l; /* virt addr of handler ... */
63#endif
64 58
65#define EXCEPTION_PROLOG_1(area) \ 59#define EXCEPTION_PROLOG_1(area) \
66 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 60 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
@@ -72,37 +66,12 @@
72 std r9,area+EX_R13(r13); \ 66 std r9,area+EX_R13(r13); \
73 mfcr r9 67 mfcr r9
74 68
75/*
76 * Equal to EXCEPTION_PROLOG_PSERIES, except that it forces 64bit mode.
77 * The firmware calls the registered system_reset_fwnmi and
78 * machine_check_fwnmi handlers in 32bit mode if the cpu happens to run
79 * a 32bit application at the time of the event.
80 * This firmware bug is present on POWER4 and JS20.
81 */
82#define EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(area, label) \
83 EXCEPTION_PROLOG_1(area); \
84 clrrdi r12,r13,32; /* get high part of &label */ \
85 mfmsr r10; \
86 /* force 64bit mode */ \
87 li r11,5; /* MSR_SF_LG|MSR_ISF_LG */ \
88 rldimi r10,r11,61,0; /* insert into top 3 bits */ \
89 /* done 64bit mode */ \
90 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
91 LOAD_HANDLER(r12,label) \
92 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
93 mtspr SPRN_SRR0,r12; \
94 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
95 mtspr SPRN_SRR1,r10; \
96 rfid; \
97 b . /* prevent speculative execution */
98
99#define EXCEPTION_PROLOG_PSERIES(area, label) \ 69#define EXCEPTION_PROLOG_PSERIES(area, label) \
100 EXCEPTION_PROLOG_1(area); \ 70 EXCEPTION_PROLOG_1(area); \
101 clrrdi r12,r13,32; /* get high part of &label */ \ 71 ld r12,PACAKBASE(r13); /* get high part of &label */ \
102 mfmsr r10; \ 72 ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \
103 mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 73 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
104 LOAD_HANDLER(r12,label) \ 74 LOAD_HANDLER(r12,label) \
105 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
106 mtspr SPRN_SRR0,r12; \ 75 mtspr SPRN_SRR0,r12; \
107 mfspr r12,SPRN_SRR1; /* and SRR1 */ \ 76 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
108 mtspr SPRN_SRR1,r10; \ 77 mtspr SPRN_SRR1,r10; \
@@ -210,11 +179,10 @@ label##_pSeries: \
210 std r10,PACA_EXGEN+EX_R13(r13); \ 179 std r10,PACA_EXGEN+EX_R13(r13); \
211 std r11,PACA_EXGEN+EX_R11(r13); \ 180 std r11,PACA_EXGEN+EX_R11(r13); \
212 std r12,PACA_EXGEN+EX_R12(r13); \ 181 std r12,PACA_EXGEN+EX_R12(r13); \
213 clrrdi r12,r13,32; /* get high part of &label */ \ 182 ld r12,PACAKBASE(r13); /* get high part of &label */ \
214 mfmsr r10; \ 183 ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \
215 mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 184 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
216 LOAD_HANDLER(r12,label##_common) \ 185 LOAD_HANDLER(r12,label##_common) \
217 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
218 mtspr SPRN_SRR0,r12; \ 186 mtspr SPRN_SRR0,r12; \
219 mfspr r12,SPRN_SRR1; /* and SRR1 */ \ 187 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
220 mtspr SPRN_SRR1,r10; \ 188 mtspr SPRN_SRR1,r10; \
diff --git a/arch/powerpc/include/asm/fsl_lbc.h b/arch/powerpc/include/asm/fsl_lbc.h
index 303f5484c050..63a4f779f531 100644
--- a/arch/powerpc/include/asm/fsl_lbc.h
+++ b/arch/powerpc/include/asm/fsl_lbc.h
@@ -23,9 +23,9 @@
23#ifndef __ASM_FSL_LBC_H 23#ifndef __ASM_FSL_LBC_H
24#define __ASM_FSL_LBC_H 24#define __ASM_FSL_LBC_H
25 25
26#include <linux/compiler.h>
26#include <linux/types.h> 27#include <linux/types.h>
27#include <linux/spinlock.h> 28#include <linux/io.h>
28#include <asm/io.h>
29 29
30struct fsl_lbc_bank { 30struct fsl_lbc_bank {
31 __be32 br; /**< Base Register */ 31 __be32 br; /**< Base Register */
@@ -227,9 +227,6 @@ struct fsl_lbc_regs {
227 u8 res8[0xF00]; 227 u8 res8[0xF00];
228}; 228};
229 229
230extern struct fsl_lbc_regs __iomem *fsl_lbc_regs;
231extern spinlock_t fsl_lbc_lock;
232
233/* 230/*
234 * FSL UPM routines 231 * FSL UPM routines
235 */ 232 */
@@ -268,44 +265,7 @@ static inline void fsl_upm_end_pattern(struct fsl_upm *upm)
268 cpu_relax(); 265 cpu_relax();
269} 266}
270 267
271/** 268extern int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base,
272 * fsl_upm_run_pattern - actually run an UPM pattern 269 u32 mar);
273 * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find
274 * @io_base: remapped pointer to where memory access should happen
275 * @mar: MAR register content during pattern execution
276 *
277 * This function triggers dummy write to the memory specified by the io_base,
278 * thus UPM pattern actually executed. Note that mar usage depends on the
279 * pre-programmed AMX bits in the UPM RAM.
280 */
281static inline int fsl_upm_run_pattern(struct fsl_upm *upm,
282 void __iomem *io_base, u32 mar)
283{
284 int ret = 0;
285 unsigned long flags;
286
287 spin_lock_irqsave(&fsl_lbc_lock, flags);
288
289 out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width));
290
291 switch (upm->width) {
292 case 8:
293 out_8(io_base, 0x0);
294 break;
295 case 16:
296 out_be16(io_base, 0x0);
297 break;
298 case 32:
299 out_be32(io_base, 0x0);
300 break;
301 default:
302 ret = -EINVAL;
303 break;
304 }
305
306 spin_unlock_irqrestore(&fsl_lbc_lock, flags);
307
308 return ret;
309}
310 270
311#endif /* __ASM_FSL_LBC_H */ 271#endif /* __ASM_FSL_LBC_H */
diff --git a/arch/powerpc/include/asm/highmem.h b/arch/powerpc/include/asm/highmem.h
index 5d99b6489d56..91c589520c0a 100644
--- a/arch/powerpc/include/asm/highmem.h
+++ b/arch/powerpc/include/asm/highmem.h
@@ -84,7 +84,7 @@ static inline void *kmap_atomic_prot(struct page *page, enum km_type type, pgpro
84#ifdef CONFIG_DEBUG_HIGHMEM 84#ifdef CONFIG_DEBUG_HIGHMEM
85 BUG_ON(!pte_none(*(kmap_pte-idx))); 85 BUG_ON(!pte_none(*(kmap_pte-idx)));
86#endif 86#endif
87 set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot)); 87 __set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
88 flush_tlb_page(NULL, vaddr); 88 flush_tlb_page(NULL, vaddr);
89 89
90 return (void*) vaddr; 90 return (void*) vaddr;
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 77c7fa025e65..08266d2728b3 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -711,7 +711,7 @@ static inline void * phys_to_virt(unsigned long address)
711/* 711/*
712 * Change "struct page" to physical address. 712 * Change "struct page" to physical address.
713 */ 713 */
714#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 714#define page_to_phys(page) ((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT)
715 715
716/* We do NOT want virtual merging, it would put too much pressure on 716/* We do NOT want virtual merging, it would put too much pressure on
717 * our iommu allocator. Instead, we want drivers to be smart enough 717 * our iommu allocator. Instead, we want drivers to be smart enough
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index a372f76836c2..0a5137676e1b 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -236,15 +236,27 @@ extern unsigned int irq_find_mapping(struct irq_host *host,
236extern unsigned int irq_create_direct_mapping(struct irq_host *host); 236extern unsigned int irq_create_direct_mapping(struct irq_host *host);
237 237
238/** 238/**
239 * irq_radix_revmap - Find a linux virq from a hw irq number. 239 * irq_radix_revmap_insert - Insert a hw irq to linux virq number mapping.
240 * @host: host owning this hardware interrupt
241 * @virq: linux irq number
242 * @hwirq: hardware irq number in that host space
243 *
244 * This is for use by irq controllers that use a radix tree reverse
245 * mapping for fast lookup.
246 */
247extern void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq,
248 irq_hw_number_t hwirq);
249
250/**
251 * irq_radix_revmap_lookup - Find a linux virq from a hw irq number.
240 * @host: host owning this hardware interrupt 252 * @host: host owning this hardware interrupt
241 * @hwirq: hardware irq number in that host space 253 * @hwirq: hardware irq number in that host space
242 * 254 *
243 * This is a fast path, for use by irq controller code that uses radix tree 255 * This is a fast path, for use by irq controller code that uses radix tree
244 * revmaps 256 * revmaps
245 */ 257 */
246extern unsigned int irq_radix_revmap(struct irq_host *host, 258extern unsigned int irq_radix_revmap_lookup(struct irq_host *host,
247 irq_hw_number_t hwirq); 259 irq_hw_number_t hwirq);
248 260
249/** 261/**
250 * irq_linear_revmap - Find a linux virq from a hw irq number. 262 * irq_linear_revmap - Find a linux virq from a hw irq number.
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 2655e2a4831e..34b52b7180cd 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -81,11 +81,17 @@ struct kvm_vcpu_arch {
81 struct tlbe shadow_tlb[PPC44x_TLB_SIZE]; 81 struct tlbe shadow_tlb[PPC44x_TLB_SIZE];
82 /* Pages which are referenced in the shadow TLB. */ 82 /* Pages which are referenced in the shadow TLB. */
83 struct page *shadow_pages[PPC44x_TLB_SIZE]; 83 struct page *shadow_pages[PPC44x_TLB_SIZE];
84 /* Copy of the host's TLB. */ 84
85 struct tlbe host_tlb[PPC44x_TLB_SIZE]; 85 /* Track which TLB entries we've modified in the current exit. */
86 u8 shadow_tlb_mod[PPC44x_TLB_SIZE];
86 87
87 u32 host_stack; 88 u32 host_stack;
88 u32 host_pid; 89 u32 host_pid;
90 u32 host_dbcr0;
91 u32 host_dbcr1;
92 u32 host_dbcr2;
93 u32 host_iac[4];
94 u32 host_msr;
89 95
90 u64 fpr[32]; 96 u64 fpr[32];
91 u32 gpr[32]; 97 u32 gpr[32];
@@ -123,7 +129,11 @@ struct kvm_vcpu_arch {
123 u32 ivor[16]; 129 u32 ivor[16];
124 u32 ivpr; 130 u32 ivpr;
125 u32 pir; 131 u32 pir;
132
133 u32 shadow_pid;
126 u32 pid; 134 u32 pid;
135 u32 swap_pid;
136
127 u32 pvr; 137 u32 pvr;
128 u32 ccr0; 138 u32 ccr0;
129 u32 ccr1; 139 u32 ccr1;
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index a8b068792260..8931ba729d2b 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -64,6 +64,10 @@ extern void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn,
64extern void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr, 64extern void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr,
65 gva_t eend, u32 asid); 65 gva_t eend, u32 asid);
66extern void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode); 66extern void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode);
67extern void kvmppc_mmu_switch_pid(struct kvm_vcpu *vcpu, u32 pid);
68
69/* XXX Book E specific */
70extern void kvmppc_tlbe_set_modified(struct kvm_vcpu *vcpu, unsigned int i);
67 71
68extern void kvmppc_check_and_deliver_interrupts(struct kvm_vcpu *vcpu); 72extern void kvmppc_check_and_deliver_interrupts(struct kvm_vcpu *vcpu);
69 73
@@ -92,4 +96,12 @@ static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
92 kvm_vcpu_block(vcpu); 96 kvm_vcpu_block(vcpu);
93} 97}
94 98
99static inline void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid)
100{
101 if (vcpu->arch.pid != new_pid) {
102 vcpu->arch.pid = new_pid;
103 vcpu->arch.swap_pid = 1;
104 }
105}
106
95#endif /* __POWERPC_KVM_PPC_H__ */ 107#endif /* __POWERPC_KVM_PPC_H__ */
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 893aafd87fde..2740c44ff717 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -88,8 +88,6 @@ struct machdep_calls {
88 unsigned long (*tce_get)(struct iommu_table *tbl, 88 unsigned long (*tce_get)(struct iommu_table *tbl,
89 long index); 89 long index);
90 void (*tce_flush)(struct iommu_table *tbl); 90 void (*tce_flush)(struct iommu_table *tbl);
91 void (*pci_dma_dev_setup)(struct pci_dev *dev);
92 void (*pci_dma_bus_setup)(struct pci_bus *bus);
93 91
94 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size, 92 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size,
95 unsigned long flags); 93 unsigned long flags);
@@ -101,6 +99,9 @@ struct machdep_calls {
101#endif 99#endif
102#endif /* CONFIG_PPC64 */ 100#endif /* CONFIG_PPC64 */
103 101
102 void (*pci_dma_dev_setup)(struct pci_dev *dev);
103 void (*pci_dma_bus_setup)(struct pci_bus *bus);
104
104 int (*probe)(void); 105 int (*probe)(void);
105 void (*setup_arch)(void); /* Optional, may be NULL */ 106 void (*setup_arch)(void); /* Optional, may be NULL */
106 void (*init_early)(void); 107 void (*init_early)(void);
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
index 9209f755763e..e7b99bac9f48 100644
--- a/arch/powerpc/include/asm/mman.h
+++ b/arch/powerpc/include/asm/mman.h
@@ -44,7 +44,7 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot)
44 44
45static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags) 45static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
46{ 46{
47 return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : 0; 47 return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
48} 48}
49#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags) 49#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
50 50
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index c2df53c5ceb9..5a441742ffba 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -437,7 +437,7 @@ typedef struct {
437 }) 437 })
438#endif /* 1 */ 438#endif /* 1 */
439 439
440/* This is only valid for addresses >= KERNELBASE */ 440/* This is only valid for addresses >= PAGE_OFFSET */
441static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) 441static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
442{ 442{
443 if (ssize == MMU_SEGSIZE_256M) 443 if (ssize == MMU_SEGSIZE_256M)
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index fe566a348a86..34d9ac433ace 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -5,6 +5,7 @@
5#include <linux/irq.h> 5#include <linux/irq.h>
6#include <linux/sysdev.h> 6#include <linux/sysdev.h>
7#include <asm/dcr.h> 7#include <asm/dcr.h>
8#include <asm/msi_bitmap.h>
8 9
9/* 10/*
10 * Global registers 11 * Global registers
@@ -301,8 +302,7 @@ struct mpic
301#endif 302#endif
302 303
303#ifdef CONFIG_PCI_MSI 304#ifdef CONFIG_PCI_MSI
304 spinlock_t bitmap_lock; 305 struct msi_bitmap msi_bitmap;
305 unsigned long *hwirq_bitmap;
306#endif 306#endif
307 307
308#ifdef CONFIG_MPIC_BROKEN_REGREAD 308#ifdef CONFIG_MPIC_BROKEN_REGREAD
diff --git a/arch/powerpc/include/asm/msi_bitmap.h b/arch/powerpc/include/asm/msi_bitmap.h
new file mode 100644
index 000000000000..97ac3f46ae0d
--- /dev/null
+++ b/arch/powerpc/include/asm/msi_bitmap.h
@@ -0,0 +1,35 @@
1#ifndef _POWERPC_SYSDEV_MSI_BITMAP_H
2#define _POWERPC_SYSDEV_MSI_BITMAP_H
3
4/*
5 * Copyright 2008, Michael Ellerman, IBM Corporation.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2 of the
10 * License.
11 *
12 */
13
14#include <linux/of.h>
15#include <asm/irq.h>
16
17struct msi_bitmap {
18 struct device_node *of_node;
19 unsigned long *bitmap;
20 spinlock_t lock;
21 unsigned int irq_count;
22};
23
24int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num);
25void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset,
26 unsigned int num);
27void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq);
28
29int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp);
30
31int msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
32 struct device_node *of_node);
33void msi_bitmap_free(struct msi_bitmap *bmp);
34
35#endif /* _POWERPC_SYSDEV_MSI_BITMAP_H */
diff --git a/arch/powerpc/include/asm/of_device.h b/arch/powerpc/include/asm/of_device.h
index 3c123990ca2e..a64debf177dc 100644
--- a/arch/powerpc/include/asm/of_device.h
+++ b/arch/powerpc/include/asm/of_device.h
@@ -24,8 +24,5 @@ extern struct of_device *of_device_alloc(struct device_node *np,
24extern int of_device_uevent(struct device *dev, 24extern int of_device_uevent(struct device *dev,
25 struct kobj_uevent_env *env); 25 struct kobj_uevent_env *env);
26 26
27/* This is just here during the transition */
28#include <linux/of_device.h>
29
30#endif /* __KERNEL__ */ 27#endif /* __KERNEL__ */
31#endif /* _ASM_POWERPC_OF_DEVICE_H */ 28#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/arch/powerpc/include/asm/of_platform.h b/arch/powerpc/include/asm/of_platform.h
index 18659ef72139..53b46507ffde 100644
--- a/arch/powerpc/include/asm/of_platform.h
+++ b/arch/powerpc/include/asm/of_platform.h
@@ -11,9 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14/* This is just here during the transition */
15#include <linux/of_platform.h>
16
17/* Platform drivers register/unregister */ 14/* Platform drivers register/unregister */
18static inline int of_register_platform_driver(struct of_platform_driver *drv) 15static inline int of_register_platform_driver(struct of_platform_driver *drv)
19{ 16{
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 6493a395508b..082b3aedf145 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -62,6 +62,8 @@ struct paca_struct {
62 u16 paca_index; /* Logical processor number */ 62 u16 paca_index; /* Logical processor number */
63 63
64 u64 kernel_toc; /* Kernel TOC address */ 64 u64 kernel_toc; /* Kernel TOC address */
65 u64 kernelbase; /* Base address of kernel */
66 u64 kernel_msr; /* MSR while running in kernel */
65 u64 stab_real; /* Absolute address of segment table */ 67 u64 stab_real; /* Absolute address of segment table */
66 u64 stab_addr; /* Virtual address of segment table */ 68 u64 stab_addr; /* Virtual address of segment table */
67 void *emergency_sp; /* pointer to emergency stack */ 69 void *emergency_sp; /* pointer to emergency stack */
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index e088545cb3f5..64e144505f65 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -71,15 +71,21 @@
71#define PAGE_OFFSET ASM_CONST(CONFIG_PAGE_OFFSET) 71#define PAGE_OFFSET ASM_CONST(CONFIG_PAGE_OFFSET)
72#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_PHYSICAL_START)) 72#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_PHYSICAL_START))
73 73
74#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_FLATMEM) 74#if defined(CONFIG_RELOCATABLE)
75#ifndef __ASSEMBLY__ 75#ifndef __ASSEMBLY__
76extern phys_addr_t memstart_addr; 76extern phys_addr_t memstart_addr;
77extern phys_addr_t kernstart_addr; 77extern phys_addr_t kernstart_addr;
78#endif 78#endif
79#define PHYSICAL_START kernstart_addr 79#define PHYSICAL_START kernstart_addr
80#define MEMORY_START memstart_addr
81#else 80#else
82#define PHYSICAL_START ASM_CONST(CONFIG_PHYSICAL_START) 81#define PHYSICAL_START ASM_CONST(CONFIG_PHYSICAL_START)
82#endif
83
84#ifdef CONFIG_PPC64
85#define MEMORY_START 0UL
86#elif defined(CONFIG_RELOCATABLE)
87#define MEMORY_START memstart_addr
88#else
83#define MEMORY_START (PHYSICAL_START + PAGE_OFFSET - KERNELBASE) 89#define MEMORY_START (PHYSICAL_START + PAGE_OFFSET - KERNELBASE)
84#endif 90#endif
85 91
@@ -92,8 +98,8 @@ extern phys_addr_t kernstart_addr;
92#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 98#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
93#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 99#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
94 100
95#define __va(x) ((void *)((unsigned long)(x) - PHYSICAL_START + KERNELBASE)) 101#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - MEMORY_START))
96#define __pa(x) ((unsigned long)(x) + PHYSICAL_START - KERNELBASE) 102#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START)
97 103
98/* 104/*
99 * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI, 105 * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI,
diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/asm/page_32.h
index ebfae530a379..d77072a32cc6 100644
--- a/arch/powerpc/include/asm/page_32.h
+++ b/arch/powerpc/include/asm/page_32.h
@@ -13,10 +13,16 @@
13#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES 13#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
14#endif 14#endif
15 15
16#ifdef CONFIG_PTE_64BIT
17#define PTE_FLAGS_OFFSET 4 /* offset of PTE flags, in bytes */
18#else
19#define PTE_FLAGS_OFFSET 0
20#endif
21
16#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
17/* 23/*
18 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit 24 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit
19 * physical addressing. For now this just the IBM PPC440. 25 * physical addressing.
20 */ 26 */
21#ifdef CONFIG_PTE_64BIT 27#ifdef CONFIG_PTE_64BIT
22typedef unsigned long long pte_basic_t; 28typedef unsigned long long pte_basic_t;
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index a05a942b1c25..0e52c7828ea4 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -60,6 +60,14 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
60 return channel ? 15 : 14; 60 return channel ? 15 : 14;
61} 61}
62 62
63#ifdef CONFIG_PCI
64extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
65extern struct dma_mapping_ops *get_pci_dma_ops(void);
66#else /* CONFIG_PCI */
67#define set_pci_dma_ops(d)
68#define get_pci_dma_ops() NULL
69#endif
70
63#ifdef CONFIG_PPC64 71#ifdef CONFIG_PPC64
64 72
65/* 73/*
@@ -70,9 +78,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
70#define PCI_DISABLE_MWI 78#define PCI_DISABLE_MWI
71 79
72#ifdef CONFIG_PCI 80#ifdef CONFIG_PCI
73extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
74extern struct dma_mapping_ops *get_pci_dma_ops(void);
75
76static inline void pci_dma_burst_advice(struct pci_dev *pdev, 81static inline void pci_dma_burst_advice(struct pci_dev *pdev,
77 enum pci_dma_burst_strategy *strat, 82 enum pci_dma_burst_strategy *strat,
78 unsigned long *strategy_parameter) 83 unsigned long *strategy_parameter)
@@ -89,9 +94,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
89 *strat = PCI_DMA_BURST_MULTIPLE; 94 *strat = PCI_DMA_BURST_MULTIPLE;
90 *strategy_parameter = cacheline_size; 95 *strategy_parameter = cacheline_size;
91} 96}
92#else /* CONFIG_PCI */
93#define set_pci_dma_ops(d)
94#define get_pci_dma_ops() NULL
95#endif 97#endif
96 98
97#else /* 32-bit */ 99#else /* 32-bit */
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
index 6fe39e327047..6ab7c67cb5ab 100644
--- a/arch/powerpc/include/asm/pgtable-ppc32.h
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -261,6 +261,7 @@ extern int icache_44x_need_flush;
261#define _PAGE_HWEXEC 0x00000004 /* H: Execute permission */ 261#define _PAGE_HWEXEC 0x00000004 /* H: Execute permission */
262#define _PAGE_ACCESSED 0x00000008 /* S: Page referenced */ 262#define _PAGE_ACCESSED 0x00000008 /* S: Page referenced */
263#define _PAGE_DIRTY 0x00000010 /* S: Page dirty */ 263#define _PAGE_DIRTY 0x00000010 /* S: Page dirty */
264#define _PAGE_SPECIAL 0x00000020 /* S: Special page */
264#define _PAGE_USER 0x00000040 /* S: User page */ 265#define _PAGE_USER 0x00000040 /* S: User page */
265#define _PAGE_ENDIAN 0x00000080 /* H: E bit */ 266#define _PAGE_ENDIAN 0x00000080 /* H: E bit */
266#define _PAGE_GUARDED 0x00000100 /* H: G bit */ 267#define _PAGE_GUARDED 0x00000100 /* H: G bit */
@@ -276,6 +277,7 @@ extern int icache_44x_need_flush;
276/* ERPN in a PTE never gets cleared, ignore it */ 277/* ERPN in a PTE never gets cleared, ignore it */
277#define _PTE_NONE_MASK 0xffffffff00000000ULL 278#define _PTE_NONE_MASK 0xffffffff00000000ULL
278 279
280#define __HAVE_ARCH_PTE_SPECIAL
279 281
280#elif defined(CONFIG_FSL_BOOKE) 282#elif defined(CONFIG_FSL_BOOKE)
281/* 283/*
@@ -305,6 +307,7 @@ extern int icache_44x_need_flush;
305#define _PAGE_COHERENT 0x00100 /* H: M bit */ 307#define _PAGE_COHERENT 0x00100 /* H: M bit */
306#define _PAGE_NO_CACHE 0x00200 /* H: I bit */ 308#define _PAGE_NO_CACHE 0x00200 /* H: I bit */
307#define _PAGE_WRITETHRU 0x00400 /* H: W bit */ 309#define _PAGE_WRITETHRU 0x00400 /* H: W bit */
310#define _PAGE_SPECIAL 0x00800 /* S: Special page */
308 311
309#ifdef CONFIG_PTE_64BIT 312#ifdef CONFIG_PTE_64BIT
310/* ERPN in a PTE never gets cleared, ignore it */ 313/* ERPN in a PTE never gets cleared, ignore it */
@@ -315,6 +318,8 @@ extern int icache_44x_need_flush;
315#define _PMD_PRESENT_MASK (PAGE_MASK) 318#define _PMD_PRESENT_MASK (PAGE_MASK)
316#define _PMD_BAD (~PAGE_MASK) 319#define _PMD_BAD (~PAGE_MASK)
317 320
321#define __HAVE_ARCH_PTE_SPECIAL
322
318#elif defined(CONFIG_8xx) 323#elif defined(CONFIG_8xx)
319/* Definitions for 8xx embedded chips. */ 324/* Definitions for 8xx embedded chips. */
320#define _PAGE_PRESENT 0x0001 /* Page is valid */ 325#define _PAGE_PRESENT 0x0001 /* Page is valid */
@@ -362,8 +367,14 @@ extern int icache_44x_need_flush;
362#define _PAGE_ACCESSED 0x100 /* R: page referenced */ 367#define _PAGE_ACCESSED 0x100 /* R: page referenced */
363#define _PAGE_EXEC 0x200 /* software: i-cache coherency required */ 368#define _PAGE_EXEC 0x200 /* software: i-cache coherency required */
364#define _PAGE_RW 0x400 /* software: user write access allowed */ 369#define _PAGE_RW 0x400 /* software: user write access allowed */
370#define _PAGE_SPECIAL 0x800 /* software: Special page */
365 371
372#ifdef CONFIG_PTE_64BIT
373/* We never clear the high word of the pte */
374#define _PTE_NONE_MASK (0xffffffff00000000ULL | _PAGE_HASHPTE)
375#else
366#define _PTE_NONE_MASK _PAGE_HASHPTE 376#define _PTE_NONE_MASK _PAGE_HASHPTE
377#endif
367 378
368#define _PMD_PRESENT 0 379#define _PMD_PRESENT 0
369#define _PMD_PRESENT_MASK (PAGE_MASK) 380#define _PMD_PRESENT_MASK (PAGE_MASK)
@@ -372,6 +383,8 @@ extern int icache_44x_need_flush;
372/* Hash table based platforms need atomic updates of the linux PTE */ 383/* Hash table based platforms need atomic updates of the linux PTE */
373#define PTE_ATOMIC_UPDATES 1 384#define PTE_ATOMIC_UPDATES 1
374 385
386#define __HAVE_ARCH_PTE_SPECIAL
387
375#endif 388#endif
376 389
377/* 390/*
@@ -404,6 +417,9 @@ extern int icache_44x_need_flush;
404#ifndef _PAGE_WRITETHRU 417#ifndef _PAGE_WRITETHRU
405#define _PAGE_WRITETHRU 0 418#define _PAGE_WRITETHRU 0
406#endif 419#endif
420#ifndef _PAGE_SPECIAL
421#define _PAGE_SPECIAL 0
422#endif
407#ifndef _PMD_PRESENT_MASK 423#ifndef _PMD_PRESENT_MASK
408#define _PMD_PRESENT_MASK _PMD_PRESENT 424#define _PMD_PRESENT_MASK _PMD_PRESENT
409#endif 425#endif
@@ -415,11 +431,11 @@ extern int icache_44x_need_flush;
415#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) 431#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
416 432
417 433
418#define PAGE_PROT_BITS __pgprot(_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \ 434#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \
419 _PAGE_WRITETHRU | _PAGE_ENDIAN | \ 435 _PAGE_WRITETHRU | _PAGE_ENDIAN | \
420 _PAGE_USER | _PAGE_ACCESSED | \ 436 _PAGE_USER | _PAGE_ACCESSED | \
421 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | \ 437 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | \
422 _PAGE_EXEC | _PAGE_HWEXEC) 438 _PAGE_EXEC | _PAGE_HWEXEC)
423/* 439/*
424 * Note: the _PAGE_COHERENT bit automatically gets set in the hardware 440 * Note: the _PAGE_COHERENT bit automatically gets set in the hardware
425 * PTE if CONFIG_SMP is defined (hash_page does this); there is no need 441 * PTE if CONFIG_SMP is defined (hash_page does this); there is no need
@@ -517,7 +533,8 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
517 533
518#define pte_none(pte) ((pte_val(pte) & ~_PTE_NONE_MASK) == 0) 534#define pte_none(pte) ((pte_val(pte) & ~_PTE_NONE_MASK) == 0)
519#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) 535#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
520#define pte_clear(mm,addr,ptep) do { set_pte_at((mm), (addr), (ptep), __pte(0)); } while (0) 536#define pte_clear(mm, addr, ptep) \
537 do { pte_update(ptep, ~_PAGE_HASHPTE, 0); } while (0)
521 538
522#define pmd_none(pmd) (!pmd_val(pmd)) 539#define pmd_none(pmd) (!pmd_val(pmd))
523#define pmd_bad(pmd) (pmd_val(pmd) & _PMD_BAD) 540#define pmd_bad(pmd) (pmd_val(pmd) & _PMD_BAD)
@@ -533,7 +550,7 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
533static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 550static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
534static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 551static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
535static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 552static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
536static inline int pte_special(pte_t pte) { return 0; } 553static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
537 554
538static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 555static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
539static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 556static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
@@ -552,10 +569,10 @@ static inline pte_t pte_mkdirty(pte_t pte) {
552static inline pte_t pte_mkyoung(pte_t pte) { 569static inline pte_t pte_mkyoung(pte_t pte) {
553 pte_val(pte) |= _PAGE_ACCESSED; return pte; } 570 pte_val(pte) |= _PAGE_ACCESSED; return pte; }
554static inline pte_t pte_mkspecial(pte_t pte) { 571static inline pte_t pte_mkspecial(pte_t pte) {
555 return pte; } 572 pte_val(pte) |= _PAGE_SPECIAL; return pte; }
556static inline unsigned long pte_pgprot(pte_t pte) 573static inline pgprot_t pte_pgprot(pte_t pte)
557{ 574{
558 return __pgprot(pte_val(pte)) & PAGE_PROT_BITS; 575 return __pgprot(pte_val(pte) & PAGE_PROT_BITS);
559} 576}
560 577
561static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 578static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
@@ -575,6 +592,10 @@ extern int flush_hash_pages(unsigned context, unsigned long va,
575extern void add_hash_page(unsigned context, unsigned long va, 592extern void add_hash_page(unsigned context, unsigned long va,
576 unsigned long pmdval); 593 unsigned long pmdval);
577 594
595/* Flush an entry from the TLB/hash table */
596extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep,
597 unsigned long address);
598
578/* 599/*
579 * Atomic PTE updates. 600 * Atomic PTE updates.
580 * 601 *
@@ -612,9 +633,6 @@ static inline unsigned long pte_update(pte_t *p,
612 return old; 633 return old;
613} 634}
614#else /* CONFIG_PTE_64BIT */ 635#else /* CONFIG_PTE_64BIT */
615/* TODO: Change that to only modify the low word and move set_pte_at()
616 * out of line
617 */
618static inline unsigned long long pte_update(pte_t *p, 636static inline unsigned long long pte_update(pte_t *p,
619 unsigned long clr, 637 unsigned long clr,
620 unsigned long set) 638 unsigned long set)
@@ -652,14 +670,36 @@ static inline unsigned long long pte_update(pte_t *p,
652 * On machines which use an MMU hash table we avoid changing the 670 * On machines which use an MMU hash table we avoid changing the
653 * _PAGE_HASHPTE bit. 671 * _PAGE_HASHPTE bit.
654 */ 672 */
655static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, 673
674static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
656 pte_t *ptep, pte_t pte) 675 pte_t *ptep, pte_t pte)
657{ 676{
658#if _PAGE_HASHPTE != 0 677#if (_PAGE_HASHPTE != 0) && defined(CONFIG_SMP) && !defined(CONFIG_PTE_64BIT)
659 pte_update(ptep, ~_PAGE_HASHPTE, pte_val(pte) & ~_PAGE_HASHPTE); 678 pte_update(ptep, ~_PAGE_HASHPTE, pte_val(pte) & ~_PAGE_HASHPTE);
679#elif defined(CONFIG_PTE_64BIT) && defined(CONFIG_SMP)
680#if _PAGE_HASHPTE != 0
681 if (pte_val(*ptep) & _PAGE_HASHPTE)
682 flush_hash_entry(mm, ptep, addr);
683#endif
684 __asm__ __volatile__("\
685 stw%U0%X0 %2,%0\n\
686 eieio\n\
687 stw%U0%X0 %L2,%1"
688 : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4))
689 : "r" (pte) : "memory");
660#else 690#else
661 *ptep = pte; 691 *ptep = __pte((pte_val(*ptep) & _PAGE_HASHPTE)
692 | (pte_val(pte) & ~_PAGE_HASHPTE));
693#endif
694}
695
696static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
697 pte_t *ptep, pte_t pte)
698{
699#if defined(CONFIG_PTE_64BIT) && defined(CONFIG_SMP)
700 WARN_ON(pte_present(*ptep));
662#endif 701#endif
702 __set_pte_at(mm, addr, ptep, pte);
663} 703}
664 704
665/* 705/*
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 4597c491e9b5..4c0a8c62859d 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -117,10 +117,10 @@
117#define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) 117#define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE)
118#define HAVE_PAGE_AGP 118#define HAVE_PAGE_AGP
119 119
120#define PAGE_PROT_BITS __pgprot(_PAGE_GUARDED | _PAGE_COHERENT | \ 120#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | \
121 _PAGE_NO_CACHE | _PAGE_WRITETHRU | \ 121 _PAGE_NO_CACHE | _PAGE_WRITETHRU | \
122 _PAGE_4K_PFN | _PAGE_RW | _PAGE_USER | \ 122 _PAGE_4K_PFN | _PAGE_RW | _PAGE_USER | \
123 _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_EXEC) 123 _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_EXEC)
124/* PTEIDX nibble */ 124/* PTEIDX nibble */
125#define _PTEIDX_SECONDARY 0x8 125#define _PTEIDX_SECONDARY 0x8
126#define _PTEIDX_GROUP_IX 0x7 126#define _PTEIDX_GROUP_IX 0x7
@@ -264,9 +264,9 @@ static inline pte_t pte_mkhuge(pte_t pte) {
264 return pte; } 264 return pte; }
265static inline pte_t pte_mkspecial(pte_t pte) { 265static inline pte_t pte_mkspecial(pte_t pte) {
266 pte_val(pte) |= _PAGE_SPECIAL; return pte; } 266 pte_val(pte) |= _PAGE_SPECIAL; return pte; }
267static inline unsigned long pte_pgprot(pte_t pte) 267static inline pgprot_t pte_pgprot(pte_t pte)
268{ 268{
269 return __pgprot(pte_val(pte)) & PAGE_PROT_BITS; 269 return __pgprot(pte_val(pte) & PAGE_PROT_BITS);
270} 270}
271 271
272/* Atomic PTE updates */ 272/* Atomic PTE updates */
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 0966899d974b..c4a029ccb4d3 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -268,7 +268,7 @@ n:
268 * Loads the value of the constant expression 'expr' into register 'rn' 268 * Loads the value of the constant expression 'expr' into register 'rn'
269 * using immediate instructions only. Use this when it's important not 269 * using immediate instructions only. Use this when it's important not
270 * to reference other data (i.e. on ppc64 when the TOC pointer is not 270 * to reference other data (i.e. on ppc64 when the TOC pointer is not
271 * valid). 271 * valid) and when 'expr' is a constant or absolute address.
272 * 272 *
273 * LOAD_REG_ADDR(rn, name) 273 * LOAD_REG_ADDR(rn, name)
274 * Loads the address of label 'name' into register 'rn'. Use this when 274 * Loads the address of label 'name' into register 'rn'. Use this when
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index be980f4ee495..67453766bff1 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -109,6 +109,7 @@
109#define SPRN_EVPR 0x3D6 /* Exception Vector Prefix Register */ 109#define SPRN_EVPR 0x3D6 /* Exception Vector Prefix Register */
110#define SPRN_L1CSR0 0x3F2 /* L1 Cache Control and Status Register 0 */ 110#define SPRN_L1CSR0 0x3F2 /* L1 Cache Control and Status Register 0 */
111#define SPRN_L1CSR1 0x3F3 /* L1 Cache Control and Status Register 1 */ 111#define SPRN_L1CSR1 0x3F3 /* L1 Cache Control and Status Register 1 */
112#define SPRN_MMUCSR0 0x3F4 /* MMU Control and Status Register 0 */
112#define SPRN_PIT 0x3DB /* Programmable Interval Timer */ 113#define SPRN_PIT 0x3DB /* Programmable Interval Timer */
113#define SPRN_BUCSR 0x3F5 /* Branch Unit Control and Status */ 114#define SPRN_BUCSR 0x3F5 /* Branch Unit Control and Status */
114#define SPRN_L2CSR0 0x3F9 /* L2 Data Cache Control and Status Register 0 */ 115#define SPRN_L2CSR0 0x3F9 /* L2 Data Cache Control and Status Register 0 */
@@ -410,6 +411,12 @@
410#define L2CSR0_L2LOA 0x00000080 /* L2 Cache Lock Overflow Allocate */ 411#define L2CSR0_L2LOA 0x00000080 /* L2 Cache Lock Overflow Allocate */
411#define L2CSR0_L2LO 0x00000020 /* L2 Cache Lock Overflow */ 412#define L2CSR0_L2LO 0x00000020 /* L2 Cache Lock Overflow */
412 413
414/* Bit definitions for MMUCSR0 */
415#define MMUCSR0_TLB1FI 0x00000002 /* TLB1 Flash invalidate */
416#define MMUCSR0_TLB0FI 0x00000004 /* TLB0 Flash invalidate */
417#define MMUCSR0_TLB2FI 0x00000040 /* TLB2 Flash invalidate */
418#define MMUCSR0_TLB3FI 0x00000020 /* TLB3 Flash invalidate */
419
413/* Bit definitions for SGR. */ 420/* Bit definitions for SGR. */
414#define SGR_NORMAL 0 /* Speculative fetching allowed. */ 421#define SGR_NORMAL 0 /* Speculative fetching allowed. */
415#define SGR_GUARDED 1 /* Speculative fetching disallowed. */ 422#define SGR_GUARDED 1 /* Speculative fetching disallowed. */
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
index 916018e425c4..6fbce725c710 100644
--- a/arch/powerpc/include/asm/sections.h
+++ b/arch/powerpc/include/asm/sections.h
@@ -2,6 +2,8 @@
2#define _ASM_POWERPC_SECTIONS_H 2#define _ASM_POWERPC_SECTIONS_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/elf.h>
6#include <linux/uaccess.h>
5#include <asm-generic/sections.h> 7#include <asm-generic/sections.h>
6 8
7#ifdef __powerpc64__ 9#ifdef __powerpc64__
@@ -16,6 +18,23 @@ static inline int in_kernel_text(unsigned long addr)
16 return 0; 18 return 0;
17} 19}
18 20
21static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
22{
23 return start < (unsigned long)__init_end &&
24 (unsigned long)_stext < end;
25}
26
27#undef dereference_function_descriptor
28static inline void *dereference_function_descriptor(void *ptr)
29{
30 struct ppc64_opd_entry *desc = ptr;
31 void *p;
32
33 if (!probe_kernel_address(&desc->funcaddr, p))
34 ptr = p;
35 return ptr;
36}
37
19#endif 38#endif
20 39
21#endif /* __KERNEL__ */ 40#endif /* __KERNEL__ */
diff --git a/arch/powerpc/math-emu/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h
index 4b17d83cfcdd..ced34f1dc8f8 100644
--- a/arch/powerpc/math-emu/sfp-machine.h
+++ b/arch/powerpc/include/asm/sfp-machine.h
@@ -79,27 +79,44 @@
79 * #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv_64(D,R,X,Y) 79 * #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv_64(D,R,X,Y)
80 */ 80 */
81 81
82#define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(S,R,X,Y,umul_ppmm) 82#define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
83#define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(D,R,X,Y,umul_ppmm) 83#define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
84 84
85#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) 85#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
86#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv_64(D,R,X,Y) 86#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
87 87
88/* These macros define what NaN looks like. They're supposed to expand to 88/* These macros define what NaN looks like. They're supposed to expand to
89 * a comma-separated set of 32bit unsigned ints that encode NaN. 89 * a comma-separated set of 32bit unsigned ints that encode NaN.
90 */ 90 */
91#define _FP_NANFRAC_S _FP_QNANBIT_S 91#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
92#define _FP_NANFRAC_D _FP_QNANBIT_D, 0 92#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
93#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0 93#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
94#define _FP_NANSIGN_S 0
95#define _FP_NANSIGN_D 0
96#define _FP_NANSIGN_Q 0
94 97
95#define _FP_KEEPNANFRACP 1 98#define _FP_KEEPNANFRACP 1
96 99
100/* Exception flags. We use the bit positions of the appropriate bits
101 in the FPSCR, which also correspond to the FE_* bits. This makes
102 everything easier ;-). */
103#define FP_EX_INVALID (1 << (31 - 2))
104#define FP_EX_INVALID_SNAN EFLAG_VXSNAN
105#define FP_EX_INVALID_ISI EFLAG_VXISI
106#define FP_EX_INVALID_IDI EFLAG_VXIDI
107#define FP_EX_INVALID_ZDZ EFLAG_VXZDZ
108#define FP_EX_INVALID_IMZ EFLAG_VXIMZ
109#define FP_EX_OVERFLOW (1 << (31 - 3))
110#define FP_EX_UNDERFLOW (1 << (31 - 4))
111#define FP_EX_DIVZERO (1 << (31 - 5))
112#define FP_EX_INEXACT (1 << (31 - 6))
113
97/* This macro appears to be called when both X and Y are NaNs, and 114/* This macro appears to be called when both X and Y are NaNs, and
98 * has to choose one and copy it to R. i386 goes for the larger of the 115 * has to choose one and copy it to R. i386 goes for the larger of the
99 * two, sparc64 just picks Y. I don't understand this at all so I'll 116 * two, sparc64 just picks Y. I don't understand this at all so I'll
100 * go with sparc64 because it's shorter :-> -- PMM 117 * go with sparc64 because it's shorter :-> -- PMM
101 */ 118 */
102#define _FP_CHOOSENAN(fs, wc, R, X, Y) \ 119#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
103 do { \ 120 do { \
104 R##_s = Y##_s; \ 121 R##_s = Y##_s; \
105 _FP_FRAC_COPY_##wc(R,Y); \ 122 _FP_FRAC_COPY_##wc(R,Y); \
@@ -107,62 +124,6 @@
107 } while (0) 124 } while (0)
108 125
109 126
110extern void fp_unpack_d(long *, unsigned long *, unsigned long *,
111 long *, long *, void *);
112extern int fp_pack_d(void *, long, unsigned long, unsigned long, long, long);
113extern int fp_pack_ds(void *, long, unsigned long, unsigned long, long, long);
114
115#define __FP_UNPACK_RAW_1(fs, X, val) \
116 do { \
117 union _FP_UNION_##fs *_flo = \
118 (union _FP_UNION_##fs *)val; \
119 \
120 X##_f = _flo->bits.frac; \
121 X##_e = _flo->bits.exp; \
122 X##_s = _flo->bits.sign; \
123 } while (0)
124
125#define __FP_UNPACK_RAW_2(fs, X, val) \
126 do { \
127 union _FP_UNION_##fs *_flo = \
128 (union _FP_UNION_##fs *)val; \
129 \
130 X##_f0 = _flo->bits.frac0; \
131 X##_f1 = _flo->bits.frac1; \
132 X##_e = _flo->bits.exp; \
133 X##_s = _flo->bits.sign; \
134 } while (0)
135
136#define __FP_UNPACK_S(X,val) \
137 do { \
138 __FP_UNPACK_RAW_1(S,X,val); \
139 _FP_UNPACK_CANONICAL(S,1,X); \
140 } while (0)
141
142#define __FP_UNPACK_D(X,val) \
143 fp_unpack_d(&X##_s, &X##_f1, &X##_f0, &X##_e, &X##_c, val)
144
145#define __FP_PACK_RAW_1(fs, val, X) \
146 do { \
147 union _FP_UNION_##fs *_flo = \
148 (union _FP_UNION_##fs *)val; \
149 \
150 _flo->bits.frac = X##_f; \
151 _flo->bits.exp = X##_e; \
152 _flo->bits.sign = X##_s; \
153 } while (0)
154
155#define __FP_PACK_RAW_2(fs, val, X) \
156 do { \
157 union _FP_UNION_##fs *_flo = \
158 (union _FP_UNION_##fs *)val; \
159 \
160 _flo->bits.frac0 = X##_f0; \
161 _flo->bits.frac1 = X##_f1; \
162 _flo->bits.exp = X##_e; \
163 _flo->bits.sign = X##_s; \
164 } while (0)
165
166#include <linux/kernel.h> 127#include <linux/kernel.h>
167#include <linux/sched.h> 128#include <linux/sched.h>
168 129
@@ -182,15 +143,30 @@ extern int fp_pack_ds(void *, long, unsigned long, unsigned long, long, long);
182#define __FP_PACK_S(val,X) \ 143#define __FP_PACK_S(val,X) \
183({ int __exc = _FP_PACK_CANONICAL(S,1,X); \ 144({ int __exc = _FP_PACK_CANONICAL(S,1,X); \
184 if(!__exc || !__FPU_TRAP_P(__exc)) \ 145 if(!__exc || !__FPU_TRAP_P(__exc)) \
185 __FP_PACK_RAW_1(S,val,X); \ 146 _FP_PACK_RAW_1_P(S,val,X); \
186 __exc; \ 147 __exc; \
187}) 148})
188 149
189#define __FP_PACK_D(val,X) \ 150#define __FP_PACK_D(val,X) \
190 fp_pack_d(val, X##_s, X##_f1, X##_f0, X##_e, X##_c) 151 do { \
191 152 _FP_PACK_CANONICAL(D, 2, X); \
192#define __FP_PACK_DS(val,X) \ 153 if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) \
193 fp_pack_ds(val, X##_s, X##_f1, X##_f0, X##_e, X##_c) 154 _FP_PACK_RAW_2_P(D, val, X); \
155 } while (0)
156
157#define __FP_PACK_DS(val,X) \
158 do { \
159 FP_DECL_S(__X); \
160 FP_CONV(S, D, 1, 2, __X, X); \
161 _FP_PACK_CANONICAL(S, 1, __X); \
162 if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) { \
163 _FP_UNPACK_CANONICAL(S, 1, __X); \
164 FP_CONV(D, S, 2, 1, X, __X); \
165 _FP_PACK_CANONICAL(D, 2, X); \
166 if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) \
167 _FP_PACK_RAW_2_P(D, val, X); \
168 } \
169 } while (0)
194 170
195/* Obtain the current rounding mode. */ 171/* Obtain the current rounding mode. */
196#define FP_ROUNDMODE \ 172#define FP_ROUNDMODE \
diff --git a/arch/powerpc/include/asm/siginfo.h b/arch/powerpc/include/asm/siginfo.h
index 12f1bce037be..49495b0534ed 100644
--- a/arch/powerpc/include/asm/siginfo.h
+++ b/arch/powerpc/include/asm/siginfo.h
@@ -15,11 +15,6 @@
15 15
16#include <asm-generic/siginfo.h> 16#include <asm-generic/siginfo.h>
17 17
18/*
19 * SIGTRAP si_codes
20 */
21#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
22#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */
23#undef NSIGTRAP 18#undef NSIGTRAP
24#define NSIGTRAP 4 19#define NSIGTRAP 4
25 20
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 4d28e1e4521b..1866cec4f967 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -56,9 +56,16 @@ extern int smp_hw_index[];
56 56
57#define raw_smp_processor_id() (current_thread_info()->cpu) 57#define raw_smp_processor_id() (current_thread_info()->cpu)
58#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()]) 58#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
59#define get_hard_smp_processor_id(cpu) (smp_hw_index[(cpu)]) 59
60#define set_hard_smp_processor_id(cpu, phys)\ 60static inline int get_hard_smp_processor_id(int cpu)
61 (smp_hw_index[(cpu)] = (phys)) 61{
62 return smp_hw_index[cpu];
63}
64
65static inline void set_hard_smp_processor_id(int cpu, int phys)
66{
67 smp_hw_index[cpu] = phys;
68}
62#endif 69#endif
63 70
64DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 71DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
@@ -86,15 +93,21 @@ extern void __cpu_die(unsigned int cpu);
86 93
87#else 94#else
88/* for UP */ 95/* for UP */
89#define hard_smp_processor_id() 0 96#define hard_smp_processor_id() get_hard_smp_processor_id(0)
90#define smp_setup_cpu_maps() 97#define smp_setup_cpu_maps()
91 98
92#endif /* CONFIG_SMP */ 99#endif /* CONFIG_SMP */
93 100
94#ifdef CONFIG_PPC64 101#ifdef CONFIG_PPC64
95#define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id) 102static inline int get_hard_smp_processor_id(int cpu)
96#define set_hard_smp_processor_id(CPU, VAL) \ 103{
97 do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0) 104 return paca[cpu].hw_cpu_id;
105}
106
107static inline void set_hard_smp_processor_id(int cpu, int phys)
108{
109 paca[cpu].hw_cpu_id = phys;
110}
98 111
99extern void smp_release_cpus(void); 112extern void smp_release_cpus(void);
100 113
@@ -102,10 +115,17 @@ extern void smp_release_cpus(void);
102/* 32-bit */ 115/* 32-bit */
103#ifndef CONFIG_SMP 116#ifndef CONFIG_SMP
104extern int boot_cpuid_phys; 117extern int boot_cpuid_phys;
105#define get_hard_smp_processor_id(cpu) boot_cpuid_phys 118static inline int get_hard_smp_processor_id(int cpu)
106#define set_hard_smp_processor_id(cpu, phys) 119{
107#endif 120 return boot_cpuid_phys;
108#endif 121}
122
123static inline void set_hard_smp_processor_id(int cpu, int phys)
124{
125 boot_cpuid_phys = phys;
126}
127#endif /* !CONFIG_SMP */
128#endif /* !CONFIG_PPC64 */
109 129
110extern int smt_enabled_at_boot; 130extern int smt_enabled_at_boot;
111 131
diff --git a/arch/powerpc/include/asm/statfs.h b/arch/powerpc/include/asm/statfs.h
index 67024026c10d..5244834583a4 100644
--- a/arch/powerpc/include/asm/statfs.h
+++ b/arch/powerpc/include/asm/statfs.h
@@ -1,60 +1,6 @@
1#ifndef _ASM_POWERPC_STATFS_H 1#ifndef _ASM_POWERPC_STATFS_H
2#define _ASM_POWERPC_STATFS_H 2#define _ASM_POWERPC_STATFS_H
3 3
4/* For ppc32 we just use the generic definitions, not so simple on ppc64 */
5
6#ifndef __powerpc64__
7#include <asm-generic/statfs.h> 4#include <asm-generic/statfs.h>
8#else
9
10#ifndef __KERNEL_STRICT_NAMES
11#include <linux/types.h>
12typedef __kernel_fsid_t fsid_t;
13#endif
14
15/*
16 * We're already 64-bit, so duplicate the definition
17 */
18struct statfs {
19 long f_type;
20 long f_bsize;
21 long f_blocks;
22 long f_bfree;
23 long f_bavail;
24 long f_files;
25 long f_ffree;
26 __kernel_fsid_t f_fsid;
27 long f_namelen;
28 long f_frsize;
29 long f_spare[5];
30};
31
32struct statfs64 {
33 long f_type;
34 long f_bsize;
35 long f_blocks;
36 long f_bfree;
37 long f_bavail;
38 long f_files;
39 long f_ffree;
40 __kernel_fsid_t f_fsid;
41 long f_namelen;
42 long f_frsize;
43 long f_spare[5];
44};
45 5
46struct compat_statfs64 {
47 __u32 f_type;
48 __u32 f_bsize;
49 __u64 f_blocks;
50 __u64 f_bfree;
51 __u64 f_bavail;
52 __u64 f_files;
53 __u64 f_ffree;
54 __kernel_fsid_t f_fsid;
55 __u32 f_namelen;
56 __u32 f_frsize;
57 __u32 f_spare[5];
58};
59#endif /* ! __powerpc64__ */
60#endif 6#endif
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index f6cc7a43b4fa..803def236654 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -32,7 +32,7 @@ COMPAT_SYS_SPU(stime)
32COMPAT_SYS(ptrace) 32COMPAT_SYS(ptrace)
33SYSCALL_SPU(alarm) 33SYSCALL_SPU(alarm)
34OLDSYS(fstat) 34OLDSYS(fstat)
35COMPAT_SYS(pause) 35SYSCALL(pause)
36COMPAT_SYS(utime) 36COMPAT_SYS(utime)
37SYSCALL(ni_syscall) 37SYSCALL(ni_syscall)
38SYSCALL(ni_syscall) 38SYSCALL(ni_syscall)
diff --git a/arch/powerpc/include/asm/tlbflush.h b/arch/powerpc/include/asm/tlbflush.h
index 361cd5c7a32b..a2c6bfd85fb7 100644
--- a/arch/powerpc/include/asm/tlbflush.h
+++ b/arch/powerpc/include/asm/tlbflush.h
@@ -29,6 +29,9 @@
29#include <linux/mm.h> 29#include <linux/mm.h>
30 30
31extern void _tlbie(unsigned long address, unsigned int pid); 31extern void _tlbie(unsigned long address, unsigned int pid);
32extern void _tlbil_all(void);
33extern void _tlbil_pid(unsigned int pid);
34extern void _tlbil_va(unsigned long address, unsigned int pid);
32 35
33#if defined(CONFIG_40x) || defined(CONFIG_8xx) 36#if defined(CONFIG_40x) || defined(CONFIG_8xx)
34#define _tlbia() asm volatile ("tlbia; sync" : : : "memory") 37#define _tlbia() asm volatile ("tlbia; sync" : : : "memory")
@@ -38,31 +41,31 @@ extern void _tlbia(void);
38 41
39static inline void flush_tlb_mm(struct mm_struct *mm) 42static inline void flush_tlb_mm(struct mm_struct *mm)
40{ 43{
41 _tlbia(); 44 _tlbil_pid(mm->context.id);
42} 45}
43 46
44static inline void flush_tlb_page(struct vm_area_struct *vma, 47static inline void flush_tlb_page(struct vm_area_struct *vma,
45 unsigned long vmaddr) 48 unsigned long vmaddr)
46{ 49{
47 _tlbie(vmaddr, vma ? vma->vm_mm->context.id : 0); 50 _tlbil_va(vmaddr, vma ? vma->vm_mm->context.id : 0);
48} 51}
49 52
50static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, 53static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
51 unsigned long vmaddr) 54 unsigned long vmaddr)
52{ 55{
53 _tlbie(vmaddr, vma ? vma->vm_mm->context.id : 0); 56 flush_tlb_page(vma, vmaddr);
54} 57}
55 58
56static inline void flush_tlb_range(struct vm_area_struct *vma, 59static inline void flush_tlb_range(struct vm_area_struct *vma,
57 unsigned long start, unsigned long end) 60 unsigned long start, unsigned long end)
58{ 61{
59 _tlbia(); 62 _tlbil_pid(vma->vm_mm->context.id);
60} 63}
61 64
62static inline void flush_tlb_kernel_range(unsigned long start, 65static inline void flush_tlb_kernel_range(unsigned long start,
63 unsigned long end) 66 unsigned long end)
64{ 67{
65 _tlbia(); 68 _tlbil_pid(0);
66} 69}
67 70
68#elif defined(CONFIG_PPC32) 71#elif defined(CONFIG_PPC32)
diff --git a/arch/powerpc/include/asm/types.h b/arch/powerpc/include/asm/types.h
index d3374bc865ba..c004c13f291e 100644
--- a/arch/powerpc/include/asm/types.h
+++ b/arch/powerpc/include/asm/types.h
@@ -48,14 +48,7 @@ typedef struct {
48 48
49typedef __vector128 vector128; 49typedef __vector128 vector128;
50 50
51/* Physical address used by some IO functions */ 51#if defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT)
52#if defined(CONFIG_PPC64) || defined(CONFIG_PHYS_64BIT)
53typedef u64 phys_addr_t;
54#else
55typedef u32 phys_addr_t;
56#endif
57
58#ifdef __powerpc64__
59typedef u64 dma_addr_t; 52typedef u64 dma_addr_t;
60#else 53#else
61typedef u32 dma_addr_t; 54typedef u32 dma_addr_t;
diff --git a/arch/powerpc/kernel/.gitignore b/arch/powerpc/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/powerpc/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 946daea780f1..fdb58253fa5b 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -28,13 +28,14 @@ endif
28obj-y := cputable.o ptrace.o syscalls.o \ 28obj-y := cputable.o ptrace.o syscalls.o \
29 irq.o align.o signal_32.o pmc.o vdso.o \ 29 irq.o align.o signal_32.o pmc.o vdso.o \
30 init_task.o process.o systbl.o idle.o \ 30 init_task.o process.o systbl.o idle.o \
31 signal.o 31 signal.o sysfs.o
32obj-y += vdso32/ 32obj-y += vdso32/
33obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \ 33obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
34 signal_64.o ptrace32.o \ 34 signal_64.o ptrace32.o \
35 paca.o cpu_setup_ppc970.o \ 35 paca.o cpu_setup_ppc970.o \
36 cpu_setup_pa6t.o \ 36 cpu_setup_pa6t.o \
37 firmware.o sysfs.o nvram_64.o 37 firmware.o nvram_64.o
38obj64-$(CONFIG_RELOCATABLE) += reloc_64.o
38obj-$(CONFIG_PPC64) += vdso64/ 39obj-$(CONFIG_PPC64) += vdso64/
39obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o 40obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
40obj-$(CONFIG_PPC_970_NAP) += idle_power4.o 41obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
@@ -69,10 +70,10 @@ extra-$(CONFIG_8xx) := head_8xx.o
69extra-y += vmlinux.lds 70extra-y += vmlinux.lds
70 71
71obj-y += time.o prom.o traps.o setup-common.o \ 72obj-y += time.o prom.o traps.o setup-common.o \
72 udbg.o misc.o io.o \ 73 udbg.o misc.o io.o dma.o \
73 misc_$(CONFIG_WORD_SIZE).o 74 misc_$(CONFIG_WORD_SIZE).o
74obj-$(CONFIG_PPC32) += entry_32.o setup_32.o 75obj-$(CONFIG_PPC32) += entry_32.o setup_32.o
75obj-$(CONFIG_PPC64) += dma_64.o iommu.o 76obj-$(CONFIG_PPC64) += dma-iommu.o iommu.o
76obj-$(CONFIG_KGDB) += kgdb.o 77obj-$(CONFIG_KGDB) += kgdb.o
77obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o 78obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
78obj-$(CONFIG_MODULES) += ppc_ksyms.o 79obj-$(CONFIG_MODULES) += ppc_ksyms.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 92768d3006f7..75c5dd0138fd 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -122,6 +122,8 @@ int main(void)
122 DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr)); 122 DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr));
123 DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1)); 123 DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1));
124 DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc)); 124 DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc));
125 DEFINE(PACAKBASE, offsetof(struct paca_struct, kernelbase));
126 DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr));
125 DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); 127 DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled));
126 DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled)); 128 DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled));
127 DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache)); 129 DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache));
@@ -350,14 +352,15 @@ int main(void)
350#endif 352#endif
351 353
352 DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE); 354 DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE);
355 DEFINE(PTE_SIZE, sizeof(pte_t));
353 356
354#ifdef CONFIG_KVM 357#ifdef CONFIG_KVM
355 DEFINE(TLBE_BYTES, sizeof(struct tlbe)); 358 DEFINE(TLBE_BYTES, sizeof(struct tlbe));
356 359
357 DEFINE(VCPU_HOST_STACK, offsetof(struct kvm_vcpu, arch.host_stack)); 360 DEFINE(VCPU_HOST_STACK, offsetof(struct kvm_vcpu, arch.host_stack));
358 DEFINE(VCPU_HOST_PID, offsetof(struct kvm_vcpu, arch.host_pid)); 361 DEFINE(VCPU_HOST_PID, offsetof(struct kvm_vcpu, arch.host_pid));
359 DEFINE(VCPU_HOST_TLB, offsetof(struct kvm_vcpu, arch.host_tlb));
360 DEFINE(VCPU_SHADOW_TLB, offsetof(struct kvm_vcpu, arch.shadow_tlb)); 362 DEFINE(VCPU_SHADOW_TLB, offsetof(struct kvm_vcpu, arch.shadow_tlb));
363 DEFINE(VCPU_SHADOW_MOD, offsetof(struct kvm_vcpu, arch.shadow_tlb_mod));
361 DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr)); 364 DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr));
362 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr)); 365 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
363 DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr)); 366 DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr));
@@ -369,7 +372,7 @@ int main(void)
369 DEFINE(VCPU_SPRG5, offsetof(struct kvm_vcpu, arch.sprg5)); 372 DEFINE(VCPU_SPRG5, offsetof(struct kvm_vcpu, arch.sprg5));
370 DEFINE(VCPU_SPRG6, offsetof(struct kvm_vcpu, arch.sprg6)); 373 DEFINE(VCPU_SPRG6, offsetof(struct kvm_vcpu, arch.sprg6));
371 DEFINE(VCPU_SPRG7, offsetof(struct kvm_vcpu, arch.sprg7)); 374 DEFINE(VCPU_SPRG7, offsetof(struct kvm_vcpu, arch.sprg7));
372 DEFINE(VCPU_PID, offsetof(struct kvm_vcpu, arch.pid)); 375 DEFINE(VCPU_SHADOW_PID, offsetof(struct kvm_vcpu, arch.shadow_pid));
373 376
374 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); 377 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
375 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); 378 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index d8f0329b1344..26e58630ed7b 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -442,28 +442,26 @@ void btext_drawtext(const char *c, unsigned int len)
442 442
443void btext_drawhex(unsigned long v) 443void btext_drawhex(unsigned long v)
444{ 444{
445 char *hex_table = "0123456789abcdef";
446
447 if (!boot_text_mapped) 445 if (!boot_text_mapped)
448 return; 446 return;
449#ifdef CONFIG_PPC64 447#ifdef CONFIG_PPC64
450 btext_drawchar(hex_table[(v >> 60) & 0x0000000FUL]); 448 btext_drawchar(hex_asc_hi(v >> 56));
451 btext_drawchar(hex_table[(v >> 56) & 0x0000000FUL]); 449 btext_drawchar(hex_asc_lo(v >> 56));
452 btext_drawchar(hex_table[(v >> 52) & 0x0000000FUL]); 450 btext_drawchar(hex_asc_hi(v >> 48));
453 btext_drawchar(hex_table[(v >> 48) & 0x0000000FUL]); 451 btext_drawchar(hex_asc_lo(v >> 48));
454 btext_drawchar(hex_table[(v >> 44) & 0x0000000FUL]); 452 btext_drawchar(hex_asc_hi(v >> 40));
455 btext_drawchar(hex_table[(v >> 40) & 0x0000000FUL]); 453 btext_drawchar(hex_asc_lo(v >> 40));
456 btext_drawchar(hex_table[(v >> 36) & 0x0000000FUL]); 454 btext_drawchar(hex_asc_hi(v >> 32));
457 btext_drawchar(hex_table[(v >> 32) & 0x0000000FUL]); 455 btext_drawchar(hex_asc_lo(v >> 32));
458#endif 456#endif
459 btext_drawchar(hex_table[(v >> 28) & 0x0000000FUL]); 457 btext_drawchar(hex_asc_hi(v >> 24));
460 btext_drawchar(hex_table[(v >> 24) & 0x0000000FUL]); 458 btext_drawchar(hex_asc_lo(v >> 24));
461 btext_drawchar(hex_table[(v >> 20) & 0x0000000FUL]); 459 btext_drawchar(hex_asc_hi(v >> 16));
462 btext_drawchar(hex_table[(v >> 16) & 0x0000000FUL]); 460 btext_drawchar(hex_asc_lo(v >> 16));
463 btext_drawchar(hex_table[(v >> 12) & 0x0000000FUL]); 461 btext_drawchar(hex_asc_hi(v >> 8));
464 btext_drawchar(hex_table[(v >> 8) & 0x0000000FUL]); 462 btext_drawchar(hex_asc_lo(v >> 8));
465 btext_drawchar(hex_table[(v >> 4) & 0x0000000FUL]); 463 btext_drawchar(hex_asc_hi(v));
466 btext_drawchar(hex_table[(v >> 0) & 0x0000000FUL]); 464 btext_drawchar(hex_asc_lo(v));
467 btext_drawchar(' '); 465 btext_drawchar(' ');
468} 466}
469 467
diff --git a/arch/powerpc/kernel/cpu_setup_ppc970.S b/arch/powerpc/kernel/cpu_setup_ppc970.S
index bf118c385752..27f2507279d8 100644
--- a/arch/powerpc/kernel/cpu_setup_ppc970.S
+++ b/arch/powerpc/kernel/cpu_setup_ppc970.S
@@ -110,7 +110,7 @@ load_hids:
110 isync 110 isync
111 111
112 /* Save away cpu state */ 112 /* Save away cpu state */
113 LOAD_REG_IMMEDIATE(r5,cpu_state_storage) 113 LOAD_REG_ADDR(r5,cpu_state_storage)
114 114
115 /* Save HID0,1,4 and 5 */ 115 /* Save HID0,1,4 and 5 */
116 mfspr r3,SPRN_HID0 116 mfspr r3,SPRN_HID0
@@ -134,7 +134,7 @@ _GLOBAL(__restore_cpu_ppc970)
134 rldicl. r0,r0,4,63 134 rldicl. r0,r0,4,63
135 beqlr 135 beqlr
136 136
137 LOAD_REG_IMMEDIATE(r5,cpu_state_storage) 137 LOAD_REG_ADDR(r5,cpu_state_storage)
138 /* Before accessing memory, we make sure rm_ci is clear */ 138 /* Before accessing memory, we make sure rm_ci is clear */
139 li r0,0 139 li r0,0
140 mfspr r3,SPRN_HID4 140 mfspr r3,SPRN_HID4
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 25c273c761d1..e70d0483fb4e 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -610,6 +610,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
610 .icache_bsize = 32, 610 .icache_bsize = 32,
611 .dcache_bsize = 32, 611 .dcache_bsize = 32,
612 .num_pmcs = 4, 612 .num_pmcs = 4,
613 .pmc_type = PPC_PMC_IBM,
613 .cpu_setup = __setup_cpu_750cx, 614 .cpu_setup = __setup_cpu_750cx,
614 .machine_check = machine_check_generic, 615 .machine_check = machine_check_generic,
615 .platform = "ppc750", 616 .platform = "ppc750",
@@ -623,6 +624,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
623 .icache_bsize = 32, 624 .icache_bsize = 32,
624 .dcache_bsize = 32, 625 .dcache_bsize = 32,
625 .num_pmcs = 4, 626 .num_pmcs = 4,
627 .pmc_type = PPC_PMC_IBM,
626 .cpu_setup = __setup_cpu_750cx, 628 .cpu_setup = __setup_cpu_750cx,
627 .machine_check = machine_check_generic, 629 .machine_check = machine_check_generic,
628 .platform = "ppc750", 630 .platform = "ppc750",
@@ -636,6 +638,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
636 .icache_bsize = 32, 638 .icache_bsize = 32,
637 .dcache_bsize = 32, 639 .dcache_bsize = 32,
638 .num_pmcs = 4, 640 .num_pmcs = 4,
641 .pmc_type = PPC_PMC_IBM,
639 .cpu_setup = __setup_cpu_750cx, 642 .cpu_setup = __setup_cpu_750cx,
640 .machine_check = machine_check_generic, 643 .machine_check = machine_check_generic,
641 .platform = "ppc750", 644 .platform = "ppc750",
@@ -649,6 +652,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
649 .icache_bsize = 32, 652 .icache_bsize = 32,
650 .dcache_bsize = 32, 653 .dcache_bsize = 32,
651 .num_pmcs = 4, 654 .num_pmcs = 4,
655 .pmc_type = PPC_PMC_IBM,
652 .cpu_setup = __setup_cpu_750, 656 .cpu_setup = __setup_cpu_750,
653 .machine_check = machine_check_generic, 657 .machine_check = machine_check_generic,
654 .platform = "ppc750", 658 .platform = "ppc750",
@@ -662,6 +666,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
662 .icache_bsize = 32, 666 .icache_bsize = 32,
663 .dcache_bsize = 32, 667 .dcache_bsize = 32,
664 .num_pmcs = 4, 668 .num_pmcs = 4,
669 .pmc_type = PPC_PMC_IBM,
665 .cpu_setup = __setup_cpu_750, 670 .cpu_setup = __setup_cpu_750,
666 .machine_check = machine_check_generic, 671 .machine_check = machine_check_generic,
667 .platform = "ppc750", 672 .platform = "ppc750",
@@ -675,6 +680,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
675 .icache_bsize = 32, 680 .icache_bsize = 32,
676 .dcache_bsize = 32, 681 .dcache_bsize = 32,
677 .num_pmcs = 4, 682 .num_pmcs = 4,
683 .pmc_type = PPC_PMC_IBM,
678 .cpu_setup = __setup_cpu_750, 684 .cpu_setup = __setup_cpu_750,
679 .machine_check = machine_check_generic, 685 .machine_check = machine_check_generic,
680 .platform = "ppc750", 686 .platform = "ppc750",
@@ -688,6 +694,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
688 .icache_bsize = 32, 694 .icache_bsize = 32,
689 .dcache_bsize = 32, 695 .dcache_bsize = 32,
690 .num_pmcs = 4, 696 .num_pmcs = 4,
697 .pmc_type = PPC_PMC_IBM,
691 .cpu_setup = __setup_cpu_750, 698 .cpu_setup = __setup_cpu_750,
692 .machine_check = machine_check_generic, 699 .machine_check = machine_check_generic,
693 .platform = "ppc750", 700 .platform = "ppc750",
@@ -701,6 +708,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
701 .icache_bsize = 32, 708 .icache_bsize = 32,
702 .dcache_bsize = 32, 709 .dcache_bsize = 32,
703 .num_pmcs = 4, 710 .num_pmcs = 4,
711 .pmc_type = PPC_PMC_IBM,
704 .cpu_setup = __setup_cpu_750fx, 712 .cpu_setup = __setup_cpu_750fx,
705 .machine_check = machine_check_generic, 713 .machine_check = machine_check_generic,
706 .platform = "ppc750", 714 .platform = "ppc750",
@@ -714,6 +722,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
714 .icache_bsize = 32, 722 .icache_bsize = 32,
715 .dcache_bsize = 32, 723 .dcache_bsize = 32,
716 .num_pmcs = 4, 724 .num_pmcs = 4,
725 .pmc_type = PPC_PMC_IBM,
717 .cpu_setup = __setup_cpu_750fx, 726 .cpu_setup = __setup_cpu_750fx,
718 .machine_check = machine_check_generic, 727 .machine_check = machine_check_generic,
719 .platform = "ppc750", 728 .platform = "ppc750",
@@ -727,6 +736,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
727 .icache_bsize = 32, 736 .icache_bsize = 32,
728 .dcache_bsize = 32, 737 .dcache_bsize = 32,
729 .num_pmcs = 4, 738 .num_pmcs = 4,
739 .pmc_type = PPC_PMC_IBM,
730 .cpu_setup = __setup_cpu_750, 740 .cpu_setup = __setup_cpu_750,
731 .machine_check = machine_check_generic, 741 .machine_check = machine_check_generic,
732 .platform = "ppc750", 742 .platform = "ppc750",
@@ -741,6 +751,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
741 .icache_bsize = 32, 751 .icache_bsize = 32,
742 .dcache_bsize = 32, 752 .dcache_bsize = 32,
743 .num_pmcs = 4, 753 .num_pmcs = 4,
754 .pmc_type = PPC_PMC_G4,
744 .cpu_setup = __setup_cpu_7400, 755 .cpu_setup = __setup_cpu_7400,
745 .machine_check = machine_check_generic, 756 .machine_check = machine_check_generic,
746 .platform = "ppc7400", 757 .platform = "ppc7400",
@@ -755,6 +766,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
755 .icache_bsize = 32, 766 .icache_bsize = 32,
756 .dcache_bsize = 32, 767 .dcache_bsize = 32,
757 .num_pmcs = 4, 768 .num_pmcs = 4,
769 .pmc_type = PPC_PMC_G4,
758 .cpu_setup = __setup_cpu_7400, 770 .cpu_setup = __setup_cpu_7400,
759 .machine_check = machine_check_generic, 771 .machine_check = machine_check_generic,
760 .platform = "ppc7400", 772 .platform = "ppc7400",
@@ -769,6 +781,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
769 .icache_bsize = 32, 781 .icache_bsize = 32,
770 .dcache_bsize = 32, 782 .dcache_bsize = 32,
771 .num_pmcs = 4, 783 .num_pmcs = 4,
784 .pmc_type = PPC_PMC_G4,
772 .cpu_setup = __setup_cpu_7410, 785 .cpu_setup = __setup_cpu_7410,
773 .machine_check = machine_check_generic, 786 .machine_check = machine_check_generic,
774 .platform = "ppc7400", 787 .platform = "ppc7400",
@@ -783,6 +796,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
783 .icache_bsize = 32, 796 .icache_bsize = 32,
784 .dcache_bsize = 32, 797 .dcache_bsize = 32,
785 .num_pmcs = 6, 798 .num_pmcs = 6,
799 .pmc_type = PPC_PMC_G4,
786 .cpu_setup = __setup_cpu_745x, 800 .cpu_setup = __setup_cpu_745x,
787 .oprofile_cpu_type = "ppc/7450", 801 .oprofile_cpu_type = "ppc/7450",
788 .oprofile_type = PPC_OPROFILE_G4, 802 .oprofile_type = PPC_OPROFILE_G4,
@@ -799,6 +813,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
799 .icache_bsize = 32, 813 .icache_bsize = 32,
800 .dcache_bsize = 32, 814 .dcache_bsize = 32,
801 .num_pmcs = 6, 815 .num_pmcs = 6,
816 .pmc_type = PPC_PMC_G4,
802 .cpu_setup = __setup_cpu_745x, 817 .cpu_setup = __setup_cpu_745x,
803 .oprofile_cpu_type = "ppc/7450", 818 .oprofile_cpu_type = "ppc/7450",
804 .oprofile_type = PPC_OPROFILE_G4, 819 .oprofile_type = PPC_OPROFILE_G4,
@@ -815,6 +830,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
815 .icache_bsize = 32, 830 .icache_bsize = 32,
816 .dcache_bsize = 32, 831 .dcache_bsize = 32,
817 .num_pmcs = 6, 832 .num_pmcs = 6,
833 .pmc_type = PPC_PMC_G4,
818 .cpu_setup = __setup_cpu_745x, 834 .cpu_setup = __setup_cpu_745x,
819 .oprofile_cpu_type = "ppc/7450", 835 .oprofile_cpu_type = "ppc/7450",
820 .oprofile_type = PPC_OPROFILE_G4, 836 .oprofile_type = PPC_OPROFILE_G4,
@@ -831,6 +847,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
831 .icache_bsize = 32, 847 .icache_bsize = 32,
832 .dcache_bsize = 32, 848 .dcache_bsize = 32,
833 .num_pmcs = 6, 849 .num_pmcs = 6,
850 .pmc_type = PPC_PMC_G4,
834 .cpu_setup = __setup_cpu_745x, 851 .cpu_setup = __setup_cpu_745x,
835 .oprofile_cpu_type = "ppc/7450", 852 .oprofile_cpu_type = "ppc/7450",
836 .oprofile_type = PPC_OPROFILE_G4, 853 .oprofile_type = PPC_OPROFILE_G4,
@@ -847,6 +864,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
847 .icache_bsize = 32, 864 .icache_bsize = 32,
848 .dcache_bsize = 32, 865 .dcache_bsize = 32,
849 .num_pmcs = 6, 866 .num_pmcs = 6,
867 .pmc_type = PPC_PMC_G4,
850 .cpu_setup = __setup_cpu_745x, 868 .cpu_setup = __setup_cpu_745x,
851 .oprofile_cpu_type = "ppc/7450", 869 .oprofile_cpu_type = "ppc/7450",
852 .oprofile_type = PPC_OPROFILE_G4, 870 .oprofile_type = PPC_OPROFILE_G4,
@@ -863,6 +881,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
863 .icache_bsize = 32, 881 .icache_bsize = 32,
864 .dcache_bsize = 32, 882 .dcache_bsize = 32,
865 .num_pmcs = 6, 883 .num_pmcs = 6,
884 .pmc_type = PPC_PMC_G4,
866 .cpu_setup = __setup_cpu_745x, 885 .cpu_setup = __setup_cpu_745x,
867 .oprofile_cpu_type = "ppc/7450", 886 .oprofile_cpu_type = "ppc/7450",
868 .oprofile_type = PPC_OPROFILE_G4, 887 .oprofile_type = PPC_OPROFILE_G4,
@@ -879,6 +898,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
879 .icache_bsize = 32, 898 .icache_bsize = 32,
880 .dcache_bsize = 32, 899 .dcache_bsize = 32,
881 .num_pmcs = 6, 900 .num_pmcs = 6,
901 .pmc_type = PPC_PMC_G4,
882 .cpu_setup = __setup_cpu_745x, 902 .cpu_setup = __setup_cpu_745x,
883 .oprofile_cpu_type = "ppc/7450", 903 .oprofile_cpu_type = "ppc/7450",
884 .oprofile_type = PPC_OPROFILE_G4, 904 .oprofile_type = PPC_OPROFILE_G4,
@@ -895,6 +915,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
895 .icache_bsize = 32, 915 .icache_bsize = 32,
896 .dcache_bsize = 32, 916 .dcache_bsize = 32,
897 .num_pmcs = 6, 917 .num_pmcs = 6,
918 .pmc_type = PPC_PMC_G4,
898 .cpu_setup = __setup_cpu_745x, 919 .cpu_setup = __setup_cpu_745x,
899 .oprofile_cpu_type = "ppc/7450", 920 .oprofile_cpu_type = "ppc/7450",
900 .oprofile_type = PPC_OPROFILE_G4, 921 .oprofile_type = PPC_OPROFILE_G4,
@@ -910,6 +931,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
910 .icache_bsize = 32, 931 .icache_bsize = 32,
911 .dcache_bsize = 32, 932 .dcache_bsize = 32,
912 .num_pmcs = 6, 933 .num_pmcs = 6,
934 .pmc_type = PPC_PMC_G4,
913 .cpu_setup = __setup_cpu_745x, 935 .cpu_setup = __setup_cpu_745x,
914 .oprofile_cpu_type = "ppc/7450", 936 .oprofile_cpu_type = "ppc/7450",
915 .oprofile_type = PPC_OPROFILE_G4, 937 .oprofile_type = PPC_OPROFILE_G4,
@@ -926,6 +948,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
926 .icache_bsize = 32, 948 .icache_bsize = 32,
927 .dcache_bsize = 32, 949 .dcache_bsize = 32,
928 .num_pmcs = 6, 950 .num_pmcs = 6,
951 .pmc_type = PPC_PMC_G4,
929 .cpu_setup = __setup_cpu_745x, 952 .cpu_setup = __setup_cpu_745x,
930 .oprofile_cpu_type = "ppc/7450", 953 .oprofile_cpu_type = "ppc/7450",
931 .oprofile_type = PPC_OPROFILE_G4, 954 .oprofile_type = PPC_OPROFILE_G4,
@@ -942,6 +965,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
942 .icache_bsize = 32, 965 .icache_bsize = 32,
943 .dcache_bsize = 32, 966 .dcache_bsize = 32,
944 .num_pmcs = 6, 967 .num_pmcs = 6,
968 .pmc_type = PPC_PMC_G4,
945 .cpu_setup = __setup_cpu_745x, 969 .cpu_setup = __setup_cpu_745x,
946 .oprofile_cpu_type = "ppc/7450", 970 .oprofile_cpu_type = "ppc/7450",
947 .oprofile_type = PPC_OPROFILE_G4, 971 .oprofile_type = PPC_OPROFILE_G4,
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma-iommu.c
index ae5708e3a312..49248f89ce23 100644
--- a/arch/powerpc/kernel/dma_64.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -2,14 +2,10 @@
2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corporation 2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corporation
3 * 3 *
4 * Provide default implementations of the DMA mapping callbacks for 4 * Provide default implementations of the DMA mapping callbacks for
5 * directly mapped busses and busses using the iommu infrastructure 5 * busses using the iommu infrastructure
6 */ 6 */
7 7
8#include <linux/device.h>
9#include <linux/dma-mapping.h>
10#include <asm/bug.h>
11#include <asm/iommu.h> 8#include <asm/iommu.h>
12#include <asm/abs_addr.h>
13 9
14/* 10/*
15 * Generic iommu implementation 11 * Generic iommu implementation
@@ -24,7 +20,7 @@ static void *dma_iommu_alloc_coherent(struct device *dev, size_t size,
24{ 20{
25 return iommu_alloc_coherent(dev, dev->archdata.dma_data, size, 21 return iommu_alloc_coherent(dev, dev->archdata.dma_data, size,
26 dma_handle, device_to_mask(dev), flag, 22 dma_handle, device_to_mask(dev), flag,
27 dev->archdata.numa_node); 23 dev_to_node(dev));
28} 24}
29 25
30static void dma_iommu_free_coherent(struct device *dev, size_t size, 26static void dma_iommu_free_coherent(struct device *dev, size_t size,
@@ -105,96 +101,3 @@ struct dma_mapping_ops dma_iommu_ops = {
105 .dma_supported = dma_iommu_dma_supported, 101 .dma_supported = dma_iommu_dma_supported,
106}; 102};
107EXPORT_SYMBOL(dma_iommu_ops); 103EXPORT_SYMBOL(dma_iommu_ops);
108
109/*
110 * Generic direct DMA implementation
111 *
112 * This implementation supports a per-device offset that can be applied if
113 * the address at which memory is visible to devices is not 0. Platform code
114 * can set archdata.dma_data to an unsigned long holding the offset. By
115 * default the offset is zero.
116 */
117
118static unsigned long get_dma_direct_offset(struct device *dev)
119{
120 return (unsigned long)dev->archdata.dma_data;
121}
122
123static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
124 dma_addr_t *dma_handle, gfp_t flag)
125{
126 struct page *page;
127 void *ret;
128 int node = dev->archdata.numa_node;
129
130 page = alloc_pages_node(node, flag, get_order(size));
131 if (page == NULL)
132 return NULL;
133 ret = page_address(page);
134 memset(ret, 0, size);
135 *dma_handle = virt_to_abs(ret) + get_dma_direct_offset(dev);
136
137 return ret;
138}
139
140static void dma_direct_free_coherent(struct device *dev, size_t size,
141 void *vaddr, dma_addr_t dma_handle)
142{
143 free_pages((unsigned long)vaddr, get_order(size));
144}
145
146static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr,
147 size_t size,
148 enum dma_data_direction direction,
149 struct dma_attrs *attrs)
150{
151 return virt_to_abs(ptr) + get_dma_direct_offset(dev);
152}
153
154static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr,
155 size_t size,
156 enum dma_data_direction direction,
157 struct dma_attrs *attrs)
158{
159}
160
161static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
162 int nents, enum dma_data_direction direction,
163 struct dma_attrs *attrs)
164{
165 struct scatterlist *sg;
166 int i;
167
168 for_each_sg(sgl, sg, nents, i) {
169 sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev);
170 sg->dma_length = sg->length;
171 }
172
173 return nents;
174}
175
176static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
177 int nents, enum dma_data_direction direction,
178 struct dma_attrs *attrs)
179{
180}
181
182static int dma_direct_dma_supported(struct device *dev, u64 mask)
183{
184 /* Could be improved to check for memory though it better be
185 * done via some global so platforms can set the limit in case
186 * they have limited DMA windows
187 */
188 return mask >= DMA_32BIT_MASK;
189}
190
191struct dma_mapping_ops dma_direct_ops = {
192 .alloc_coherent = dma_direct_alloc_coherent,
193 .free_coherent = dma_direct_free_coherent,
194 .map_single = dma_direct_map_single,
195 .unmap_single = dma_direct_unmap_single,
196 .map_sg = dma_direct_map_sg,
197 .unmap_sg = dma_direct_unmap_sg,
198 .dma_supported = dma_direct_dma_supported,
199};
200EXPORT_SYMBOL(dma_direct_ops);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
new file mode 100644
index 000000000000..1562daf8839a
--- /dev/null
+++ b/arch/powerpc/kernel/dma.c
@@ -0,0 +1,131 @@
1/*
2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corporation
3 *
4 * Provide default implementations of the DMA mapping callbacks for
5 * directly mapped busses.
6 */
7
8#include <linux/device.h>
9#include <linux/dma-mapping.h>
10#include <asm/bug.h>
11#include <asm/abs_addr.h>
12
13/*
14 * Generic direct DMA implementation
15 *
16 * This implementation supports a per-device offset that can be applied if
17 * the address at which memory is visible to devices is not 0. Platform code
18 * can set archdata.dma_data to an unsigned long holding the offset. By
19 * default the offset is PCI_DRAM_OFFSET.
20 */
21
22static unsigned long get_dma_direct_offset(struct device *dev)
23{
24 if (dev)
25 return (unsigned long)dev->archdata.dma_data;
26
27 return PCI_DRAM_OFFSET;
28}
29
30void *dma_direct_alloc_coherent(struct device *dev, size_t size,
31 dma_addr_t *dma_handle, gfp_t flag)
32{
33 void *ret;
34#ifdef CONFIG_NOT_COHERENT_CACHE
35 ret = __dma_alloc_coherent(size, dma_handle, flag);
36 if (ret == NULL)
37 return NULL;
38 *dma_handle += get_dma_direct_offset(dev);
39 return ret;
40#else
41 struct page *page;
42 int node = dev_to_node(dev);
43
44 /* ignore region specifiers */
45 flag &= ~(__GFP_HIGHMEM);
46
47 page = alloc_pages_node(node, flag, get_order(size));
48 if (page == NULL)
49 return NULL;
50 ret = page_address(page);
51 memset(ret, 0, size);
52 *dma_handle = virt_to_abs(ret) + get_dma_direct_offset(dev);
53
54 return ret;
55#endif
56}
57
58void dma_direct_free_coherent(struct device *dev, size_t size,
59 void *vaddr, dma_addr_t dma_handle)
60{
61#ifdef CONFIG_NOT_COHERENT_CACHE
62 __dma_free_coherent(size, vaddr);
63#else
64 free_pages((unsigned long)vaddr, get_order(size));
65#endif
66}
67
68static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
69 int nents, enum dma_data_direction direction,
70 struct dma_attrs *attrs)
71{
72 struct scatterlist *sg;
73 int i;
74
75 for_each_sg(sgl, sg, nents, i) {
76 sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev);
77 sg->dma_length = sg->length;
78 }
79
80 return nents;
81}
82
83static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
84 int nents, enum dma_data_direction direction,
85 struct dma_attrs *attrs)
86{
87}
88
89static int dma_direct_dma_supported(struct device *dev, u64 mask)
90{
91#ifdef CONFIG_PPC64
92 /* Could be improved to check for memory though it better be
93 * done via some global so platforms can set the limit in case
94 * they have limited DMA windows
95 */
96 return mask >= DMA_32BIT_MASK;
97#else
98 return 1;
99#endif
100}
101
102static inline dma_addr_t dma_direct_map_page(struct device *dev,
103 struct page *page,
104 unsigned long offset,
105 size_t size,
106 enum dma_data_direction dir,
107 struct dma_attrs *attrs)
108{
109 BUG_ON(dir == DMA_NONE);
110 __dma_sync_page(page, offset, size, dir);
111 return page_to_phys(page) + offset + get_dma_direct_offset(dev);
112}
113
114static inline void dma_direct_unmap_page(struct device *dev,
115 dma_addr_t dma_address,
116 size_t size,
117 enum dma_data_direction direction,
118 struct dma_attrs *attrs)
119{
120}
121
122struct dma_mapping_ops dma_direct_ops = {
123 .alloc_coherent = dma_direct_alloc_coherent,
124 .free_coherent = dma_direct_free_coherent,
125 .map_sg = dma_direct_map_sg,
126 .unmap_sg = dma_direct_unmap_sg,
127 .dma_supported = dma_direct_dma_supported,
128 .map_page = dma_direct_map_page,
129 .unmap_page = dma_direct_unmap_page,
130};
131EXPORT_SYMBOL(dma_direct_ops);
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 2d802e97097c..fd8b4bae9b04 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -512,31 +512,12 @@ _GLOBAL(ret_from_except_lite)
512#endif 512#endif
513 513
514restore: 514restore:
515 ld r5,SOFTE(r1)
516#ifdef CONFIG_PPC_ISERIES
517BEGIN_FW_FTR_SECTION 515BEGIN_FW_FTR_SECTION
518 cmpdi 0,r5,0 516 ld r5,SOFTE(r1)
519 beq 4f 517FW_FTR_SECTION_ELSE
520 /* Check for pending interrupts (iSeries) */ 518 b iseries_check_pending_irqs
521 ld r3,PACALPPACAPTR(r13) 519ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES)
522 ld r3,LPPACAANYINT(r3) 5202:
523 cmpdi r3,0
524 beq+ 4f /* skip do_IRQ if no interrupts */
525
526 li r3,0
527 stb r3,PACASOFTIRQEN(r13) /* ensure we are soft-disabled */
528#ifdef CONFIG_TRACE_IRQFLAGS
529 bl .trace_hardirqs_off
530 mfmsr r10
531#endif
532 ori r10,r10,MSR_EE
533 mtmsrd r10 /* hard-enable again */
534 addi r3,r1,STACK_FRAME_OVERHEAD
535 bl .do_IRQ
536 b .ret_from_except_lite /* loop back and handle more */
5374:
538END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
539#endif
540 TRACE_AND_RESTORE_IRQ(r5); 521 TRACE_AND_RESTORE_IRQ(r5);
541 522
542 /* extract EE bit and use it to restore paca->hard_enabled */ 523 /* extract EE bit and use it to restore paca->hard_enabled */
@@ -592,6 +573,30 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
592 rfid 573 rfid
593 b . /* prevent speculative execution */ 574 b . /* prevent speculative execution */
594 575
576iseries_check_pending_irqs:
577#ifdef CONFIG_PPC_ISERIES
578 ld r5,SOFTE(r1)
579 cmpdi 0,r5,0
580 beq 2b
581 /* Check for pending interrupts (iSeries) */
582 ld r3,PACALPPACAPTR(r13)
583 ld r3,LPPACAANYINT(r3)
584 cmpdi r3,0
585 beq+ 2b /* skip do_IRQ if no interrupts */
586
587 li r3,0
588 stb r3,PACASOFTIRQEN(r13) /* ensure we are soft-disabled */
589#ifdef CONFIG_TRACE_IRQFLAGS
590 bl .trace_hardirqs_off
591 mfmsr r10
592#endif
593 ori r10,r10,MSR_EE
594 mtmsrd r10 /* hard-enable again */
595 addi r3,r1,STACK_FRAME_OVERHEAD
596 bl .do_IRQ
597 b .ret_from_except_lite /* loop back and handle more */
598#endif
599
595do_work: 600do_work:
596#ifdef CONFIG_PREEMPT 601#ifdef CONFIG_PREEMPT
597 andi. r0,r3,MSR_PR /* Returning to user mode? */ 602 andi. r0,r3,MSR_PR /* Returning to user mode? */
@@ -685,10 +690,6 @@ _GLOBAL(enter_rtas)
685 std r7,_DAR(r1) 690 std r7,_DAR(r1)
686 mfdsisr r8 691 mfdsisr r8
687 std r8,_DSISR(r1) 692 std r8,_DSISR(r1)
688 mfsrr0 r9
689 std r9,_SRR0(r1)
690 mfsrr1 r10
691 std r10,_SRR1(r1)
692 693
693 /* Temporary workaround to clear CR until RTAS can be modified to 694 /* Temporary workaround to clear CR until RTAS can be modified to
694 * ignore all bits. 695 * ignore all bits.
@@ -749,6 +750,10 @@ _STATIC(rtas_return_loc)
749 mfspr r4,SPRN_SPRG3 /* Get PACA */ 750 mfspr r4,SPRN_SPRG3 /* Get PACA */
750 clrldi r4,r4,2 /* convert to realmode address */ 751 clrldi r4,r4,2 /* convert to realmode address */
751 752
753 bcl 20,31,$+4
7540: mflr r3
755 ld r3,(1f-0b)(r3) /* get &.rtas_restore_regs */
756
752 mfmsr r6 757 mfmsr r6
753 li r0,MSR_RI 758 li r0,MSR_RI
754 andc r6,r6,r0 759 andc r6,r6,r0
@@ -756,7 +761,6 @@ _STATIC(rtas_return_loc)
756 mtmsrd r6 761 mtmsrd r6
757 762
758 ld r1,PACAR1(r4) /* Restore our SP */ 763 ld r1,PACAR1(r4) /* Restore our SP */
759 LOAD_REG_IMMEDIATE(r3,.rtas_restore_regs)
760 ld r4,PACASAVEDMSR(r4) /* Restore our MSR */ 764 ld r4,PACASAVEDMSR(r4) /* Restore our MSR */
761 765
762 mtspr SPRN_SRR0,r3 766 mtspr SPRN_SRR0,r3
@@ -764,6 +768,9 @@ _STATIC(rtas_return_loc)
764 rfid 768 rfid
765 b . /* prevent speculative execution */ 769 b . /* prevent speculative execution */
766 770
771 .align 3
7721: .llong .rtas_restore_regs
773
767_STATIC(rtas_restore_regs) 774_STATIC(rtas_restore_regs)
768 /* relocation is on at this point */ 775 /* relocation is on at this point */
769 REST_GPR(2, r1) /* Restore the TOC */ 776 REST_GPR(2, r1) /* Restore the TOC */
@@ -783,10 +790,6 @@ _STATIC(rtas_restore_regs)
783 mtdar r7 790 mtdar r7
784 ld r8,_DSISR(r1) 791 ld r8,_DSISR(r1)
785 mtdsisr r8 792 mtdsisr r8
786 ld r9,_SRR0(r1)
787 mtsrr0 r9
788 ld r10,_SRR1(r1)
789 mtsrr1 r10
790 793
791 addi r1,r1,RTAS_FRAME_SIZE /* Unstack our frame */ 794 addi r1,r1,RTAS_FRAME_SIZE /* Unstack our frame */
792 ld r0,16(r1) /* get return address */ 795 ld r0,16(r1) /* get return address */
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 8bb657519299..0c326823c6d4 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -110,6 +110,12 @@ __start:
110#ifdef CONFIG_PPC_MULTIPLATFORM 110#ifdef CONFIG_PPC_MULTIPLATFORM
111 cmpwi 0,r5,0 111 cmpwi 0,r5,0
112 beq 1f 112 beq 1f
113
114 /* find out where we are now */
115 bcl 20,31,$+4
1160: mflr r8 /* r8 = runtime addr here */
117 addis r8,r8,(_stext - 0b)@ha
118 addi r8,r8,(_stext - 0b)@l /* current runtime base addr */
113 bl prom_init 119 bl prom_init
114 trap 120 trap
115#endif 121#endif
@@ -369,13 +375,13 @@ i##n: \
369DataAccess: 375DataAccess:
370 EXCEPTION_PROLOG 376 EXCEPTION_PROLOG
371 mfspr r10,SPRN_DSISR 377 mfspr r10,SPRN_DSISR
378 stw r10,_DSISR(r11)
372 andis. r0,r10,0xa470 /* weird error? */ 379 andis. r0,r10,0xa470 /* weird error? */
373 bne 1f /* if not, try to put a PTE */ 380 bne 1f /* if not, try to put a PTE */
374 mfspr r4,SPRN_DAR /* into the hash table */ 381 mfspr r4,SPRN_DAR /* into the hash table */
375 rlwinm r3,r10,32-15,21,21 /* DSISR_STORE -> _PAGE_RW */ 382 rlwinm r3,r10,32-15,21,21 /* DSISR_STORE -> _PAGE_RW */
376 bl hash_page 383 bl hash_page
3771: stw r10,_DSISR(r11) 3841: lwz r5,_DSISR(r11) /* get DSISR value */
378 mr r5,r10
379 mfspr r4,SPRN_DAR 385 mfspr r4,SPRN_DAR
380 EXC_XFER_EE_LITE(0x300, handle_page_fault) 386 EXC_XFER_EE_LITE(0x300, handle_page_fault)
381 387
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index cc8fb474d520..84856bee33a5 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -82,7 +82,11 @@ END_FTR_SECTION(0, 1)
82 /* Catch branch to 0 in real mode */ 82 /* Catch branch to 0 in real mode */
83 trap 83 trap
84 84
85 /* Secondary processors spin on this value until it goes to 1. */ 85 /* Secondary processors spin on this value until it becomes nonzero.
86 * When it does it contains the real address of the descriptor
87 * of the function that the cpu should jump to to continue
88 * initialization.
89 */
86 .globl __secondary_hold_spinloop 90 .globl __secondary_hold_spinloop
87__secondary_hold_spinloop: 91__secondary_hold_spinloop:
88 .llong 0x0 92 .llong 0x0
@@ -109,8 +113,11 @@ __secondary_hold_acknowledge:
109 * before the bulk of the kernel has been relocated. This code 113 * before the bulk of the kernel has been relocated. This code
110 * is relocated to physical address 0x60 before prom_init is run. 114 * is relocated to physical address 0x60 before prom_init is run.
111 * All of it must fit below the first exception vector at 0x100. 115 * All of it must fit below the first exception vector at 0x100.
116 * Use .globl here not _GLOBAL because we want __secondary_hold
117 * to be the actual text address, not a descriptor.
112 */ 118 */
113_GLOBAL(__secondary_hold) 119 .globl __secondary_hold
120__secondary_hold:
114 mfmsr r24 121 mfmsr r24
115 ori r24,r24,MSR_RI 122 ori r24,r24,MSR_RI
116 mtmsrd r24 /* RI on */ 123 mtmsrd r24 /* RI on */
@@ -121,16 +128,16 @@ _GLOBAL(__secondary_hold)
121 /* Tell the master cpu we're here */ 128 /* Tell the master cpu we're here */
122 /* Relocation is off & we are located at an address less */ 129 /* Relocation is off & we are located at an address less */
123 /* than 0x100, so only need to grab low order offset. */ 130 /* than 0x100, so only need to grab low order offset. */
124 std r24,__secondary_hold_acknowledge@l(0) 131 std r24,__secondary_hold_acknowledge-_stext(0)
125 sync 132 sync
126 133
127 /* All secondary cpus wait here until told to start. */ 134 /* All secondary cpus wait here until told to start. */
128100: ld r4,__secondary_hold_spinloop@l(0) 135100: ld r4,__secondary_hold_spinloop-_stext(0)
129 cmpdi 0,r4,1 136 cmpdi 0,r4,0
130 bne 100b 137 beq 100b
131 138
132#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) 139#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
133 LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init) 140 ld r4,0(r4) /* deref function descriptor */
134 mtctr r4 141 mtctr r4
135 mr r3,r24 142 mr r3,r24
136 bctr 143 bctr
@@ -147,6 +154,10 @@ exception_marker:
147/* 154/*
148 * This is the start of the interrupt handlers for pSeries 155 * This is the start of the interrupt handlers for pSeries
149 * This code runs with relocation off. 156 * This code runs with relocation off.
157 * Code from here to __end_interrupts gets copied down to real
158 * address 0x100 when we are running a relocatable kernel.
159 * Therefore any relative branches in this section must only
160 * branch to labels in this section.
150 */ 161 */
151 . = 0x100 162 . = 0x100
152 .globl __start_interrupts 163 .globl __start_interrupts
@@ -200,7 +211,20 @@ data_access_slb_pSeries:
200 mfspr r10,SPRN_SPRG1 211 mfspr r10,SPRN_SPRG1
201 std r10,PACA_EXSLB+EX_R13(r13) 212 std r10,PACA_EXSLB+EX_R13(r13)
202 mfspr r12,SPRN_SRR1 /* and SRR1 */ 213 mfspr r12,SPRN_SRR1 /* and SRR1 */
203 b .slb_miss_realmode /* Rel. branch works in real mode */ 214#ifndef CONFIG_RELOCATABLE
215 b .slb_miss_realmode
216#else
217 /*
218 * We can't just use a direct branch to .slb_miss_realmode
219 * because the distance from here to there depends on where
220 * the kernel ends up being put.
221 */
222 mfctr r11
223 ld r10,PACAKBASE(r13)
224 LOAD_HANDLER(r10, .slb_miss_realmode)
225 mtctr r10
226 bctr
227#endif
204 228
205 STD_EXCEPTION_PSERIES(0x400, instruction_access) 229 STD_EXCEPTION_PSERIES(0x400, instruction_access)
206 230
@@ -225,7 +249,15 @@ instruction_access_slb_pSeries:
225 mfspr r10,SPRN_SPRG1 249 mfspr r10,SPRN_SPRG1
226 std r10,PACA_EXSLB+EX_R13(r13) 250 std r10,PACA_EXSLB+EX_R13(r13)
227 mfspr r12,SPRN_SRR1 /* and SRR1 */ 251 mfspr r12,SPRN_SRR1 /* and SRR1 */
228 b .slb_miss_realmode /* Rel. branch works in real mode */ 252#ifndef CONFIG_RELOCATABLE
253 b .slb_miss_realmode
254#else
255 mfctr r11
256 ld r10,PACAKBASE(r13)
257 LOAD_HANDLER(r10, .slb_miss_realmode)
258 mtctr r10
259 bctr
260#endif
229 261
230 MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt) 262 MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt)
231 STD_EXCEPTION_PSERIES(0x600, alignment) 263 STD_EXCEPTION_PSERIES(0x600, alignment)
@@ -244,14 +276,12 @@ BEGIN_FTR_SECTION
244 beq- 1f 276 beq- 1f
245END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) 277END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
246 mr r9,r13 278 mr r9,r13
247 mfmsr r10
248 mfspr r13,SPRN_SPRG3 279 mfspr r13,SPRN_SPRG3
249 mfspr r11,SPRN_SRR0 280 mfspr r11,SPRN_SRR0
250 clrrdi r12,r13,32 281 ld r12,PACAKBASE(r13)
251 oris r12,r12,system_call_common@h 282 ld r10,PACAKMSR(r13)
252 ori r12,r12,system_call_common@l 283 LOAD_HANDLER(r12, system_call_entry)
253 mtspr SPRN_SRR0,r12 284 mtspr SPRN_SRR0,r12
254 ori r10,r10,MSR_IR|MSR_DR|MSR_RI
255 mfspr r12,SPRN_SRR1 285 mfspr r12,SPRN_SRR1
256 mtspr SPRN_SRR1,r10 286 mtspr SPRN_SRR1,r10
257 rfid 287 rfid
@@ -325,16 +355,32 @@ do_stab_bolted_pSeries:
325 mfspr r12,SPRN_SPRG2 355 mfspr r12,SPRN_SPRG2
326 EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted) 356 EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted)
327 357
358#ifdef CONFIG_PPC_PSERIES
359/*
360 * Vectors for the FWNMI option. Share common code.
361 */
362 .globl system_reset_fwnmi
363 .align 7
364system_reset_fwnmi:
365 HMT_MEDIUM
366 mtspr SPRN_SPRG1,r13 /* save r13 */
367 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
368
369 .globl machine_check_fwnmi
370 .align 7
371machine_check_fwnmi:
372 HMT_MEDIUM
373 mtspr SPRN_SPRG1,r13 /* save r13 */
374 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
375
376#endif /* CONFIG_PPC_PSERIES */
377
378#ifdef __DISABLED__
328/* 379/*
329 * We have some room here we use that to put
330 * the peries slb miss user trampoline code so it's reasonably
331 * away from slb_miss_user_common to avoid problems with rfid
332 *
333 * This is used for when the SLB miss handler has to go virtual, 380 * This is used for when the SLB miss handler has to go virtual,
334 * which doesn't happen for now anymore but will once we re-implement 381 * which doesn't happen for now anymore but will once we re-implement
335 * dynamic VSIDs for shared page tables 382 * dynamic VSIDs for shared page tables
336 */ 383 */
337#ifdef __DISABLED__
338slb_miss_user_pseries: 384slb_miss_user_pseries:
339 std r10,PACA_EXGEN+EX_R10(r13) 385 std r10,PACA_EXGEN+EX_R10(r13)
340 std r11,PACA_EXGEN+EX_R11(r13) 386 std r11,PACA_EXGEN+EX_R11(r13)
@@ -357,25 +403,17 @@ slb_miss_user_pseries:
357 b . /* prevent spec. execution */ 403 b . /* prevent spec. execution */
358#endif /* __DISABLED__ */ 404#endif /* __DISABLED__ */
359 405
360#ifdef CONFIG_PPC_PSERIES 406 .align 7
407 .globl __end_interrupts
408__end_interrupts:
409
361/* 410/*
362 * Vectors for the FWNMI option. Share common code. 411 * Code from here down to __end_handlers is invoked from the
412 * exception prologs above. Because the prologs assemble the
413 * addresses of these handlers using the LOAD_HANDLER macro,
414 * which uses an addi instruction, these handlers must be in
415 * the first 32k of the kernel image.
363 */ 416 */
364 .globl system_reset_fwnmi
365 .align 7
366system_reset_fwnmi:
367 HMT_MEDIUM
368 mtspr SPRN_SPRG1,r13 /* save r13 */
369 EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(PACA_EXGEN, system_reset_common)
370
371 .globl machine_check_fwnmi
372 .align 7
373machine_check_fwnmi:
374 HMT_MEDIUM
375 mtspr SPRN_SPRG1,r13 /* save r13 */
376 EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(PACA_EXMC, machine_check_common)
377
378#endif /* CONFIG_PPC_PSERIES */
379 417
380/*** Common interrupt handlers ***/ 418/*** Common interrupt handlers ***/
381 419
@@ -414,6 +452,10 @@ machine_check_common:
414 STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception) 452 STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception)
415#endif /* CONFIG_CBE_RAS */ 453#endif /* CONFIG_CBE_RAS */
416 454
455 .align 7
456system_call_entry:
457 b system_call_common
458
417/* 459/*
418 * Here we have detected that the kernel stack pointer is bad. 460 * Here we have detected that the kernel stack pointer is bad.
419 * R9 contains the saved CR, r13 points to the paca, 461 * R9 contains the saved CR, r13 points to the paca,
@@ -457,65 +499,6 @@ bad_stack:
457 b 1b 499 b 1b
458 500
459/* 501/*
460 * Return from an exception with minimal checks.
461 * The caller is assumed to have done EXCEPTION_PROLOG_COMMON.
462 * If interrupts have been enabled, or anything has been
463 * done that might have changed the scheduling status of
464 * any task or sent any task a signal, you should use
465 * ret_from_except or ret_from_except_lite instead of this.
466 */
467fast_exc_return_irq: /* restores irq state too */
468 ld r3,SOFTE(r1)
469 TRACE_AND_RESTORE_IRQ(r3);
470 ld r12,_MSR(r1)
471 rldicl r4,r12,49,63 /* get MSR_EE to LSB */
472 stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */
473 b 1f
474
475 .globl fast_exception_return
476fast_exception_return:
477 ld r12,_MSR(r1)
4781: ld r11,_NIP(r1)
479 andi. r3,r12,MSR_RI /* check if RI is set */
480 beq- unrecov_fer
481
482#ifdef CONFIG_VIRT_CPU_ACCOUNTING
483 andi. r3,r12,MSR_PR
484 beq 2f
485 ACCOUNT_CPU_USER_EXIT(r3, r4)
4862:
487#endif
488
489 ld r3,_CCR(r1)
490 ld r4,_LINK(r1)
491 ld r5,_CTR(r1)
492 ld r6,_XER(r1)
493 mtcr r3
494 mtlr r4
495 mtctr r5
496 mtxer r6
497 REST_GPR(0, r1)
498 REST_8GPRS(2, r1)
499
500 mfmsr r10
501 rldicl r10,r10,48,1 /* clear EE */
502 rldicr r10,r10,16,61 /* clear RI (LE is 0 already) */
503 mtmsrd r10,1
504
505 mtspr SPRN_SRR1,r12
506 mtspr SPRN_SRR0,r11
507 REST_4GPRS(10, r1)
508 ld r1,GPR1(r1)
509 rfid
510 b . /* prevent speculative execution */
511
512unrecov_fer:
513 bl .save_nvgprs
5141: addi r3,r1,STACK_FRAME_OVERHEAD
515 bl .unrecoverable_exception
516 b 1b
517
518/*
519 * Here r13 points to the paca, r9 contains the saved CR, 502 * Here r13 points to the paca, r9 contains the saved CR,
520 * SRR0 and SRR1 are saved in r11 and r12, 503 * SRR0 and SRR1 are saved in r11 and r12,
521 * r9 - r13 are saved in paca->exgen. 504 * r9 - r13 are saved in paca->exgen.
@@ -616,6 +599,9 @@ unrecov_user_slb:
616 */ 599 */
617_GLOBAL(slb_miss_realmode) 600_GLOBAL(slb_miss_realmode)
618 mflr r10 601 mflr r10
602#ifdef CONFIG_RELOCATABLE
603 mtctr r11
604#endif
619 605
620 stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ 606 stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
621 std r10,PACA_EXSLB+EX_LR(r13) /* save LR */ 607 std r10,PACA_EXSLB+EX_LR(r13) /* save LR */
@@ -666,11 +652,10 @@ BEGIN_FW_FTR_SECTION
666END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) 652END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
667#endif /* CONFIG_PPC_ISERIES */ 653#endif /* CONFIG_PPC_ISERIES */
668 mfspr r11,SPRN_SRR0 654 mfspr r11,SPRN_SRR0
669 clrrdi r10,r13,32 655 ld r10,PACAKBASE(r13)
670 LOAD_HANDLER(r10,unrecov_slb) 656 LOAD_HANDLER(r10,unrecov_slb)
671 mtspr SPRN_SRR0,r10 657 mtspr SPRN_SRR0,r10
672 mfmsr r10 658 ld r10,PACAKMSR(r13)
673 ori r10,r10,MSR_IR|MSR_DR|MSR_RI
674 mtspr SPRN_SRR1,r10 659 mtspr SPRN_SRR1,r10
675 rfid 660 rfid
676 b . 661 b .
@@ -766,6 +751,85 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
766 bl .altivec_unavailable_exception 751 bl .altivec_unavailable_exception
767 b .ret_from_except 752 b .ret_from_except
768 753
754 .align 7
755 .globl vsx_unavailable_common
756vsx_unavailable_common:
757 EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN)
758#ifdef CONFIG_VSX
759BEGIN_FTR_SECTION
760 bne .load_up_vsx
7611:
762END_FTR_SECTION_IFSET(CPU_FTR_VSX)
763#endif
764 bl .save_nvgprs
765 addi r3,r1,STACK_FRAME_OVERHEAD
766 ENABLE_INTS
767 bl .vsx_unavailable_exception
768 b .ret_from_except
769
770 .align 7
771 .globl __end_handlers
772__end_handlers:
773
774/*
775 * Return from an exception with minimal checks.
776 * The caller is assumed to have done EXCEPTION_PROLOG_COMMON.
777 * If interrupts have been enabled, or anything has been
778 * done that might have changed the scheduling status of
779 * any task or sent any task a signal, you should use
780 * ret_from_except or ret_from_except_lite instead of this.
781 */
782fast_exc_return_irq: /* restores irq state too */
783 ld r3,SOFTE(r1)
784 TRACE_AND_RESTORE_IRQ(r3);
785 ld r12,_MSR(r1)
786 rldicl r4,r12,49,63 /* get MSR_EE to LSB */
787 stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */
788 b 1f
789
790 .globl fast_exception_return
791fast_exception_return:
792 ld r12,_MSR(r1)
7931: ld r11,_NIP(r1)
794 andi. r3,r12,MSR_RI /* check if RI is set */
795 beq- unrecov_fer
796
797#ifdef CONFIG_VIRT_CPU_ACCOUNTING
798 andi. r3,r12,MSR_PR
799 beq 2f
800 ACCOUNT_CPU_USER_EXIT(r3, r4)
8012:
802#endif
803
804 ld r3,_CCR(r1)
805 ld r4,_LINK(r1)
806 ld r5,_CTR(r1)
807 ld r6,_XER(r1)
808 mtcr r3
809 mtlr r4
810 mtctr r5
811 mtxer r6
812 REST_GPR(0, r1)
813 REST_8GPRS(2, r1)
814
815 mfmsr r10
816 rldicl r10,r10,48,1 /* clear EE */
817 rldicr r10,r10,16,61 /* clear RI (LE is 0 already) */
818 mtmsrd r10,1
819
820 mtspr SPRN_SRR1,r12
821 mtspr SPRN_SRR0,r11
822 REST_4GPRS(10, r1)
823 ld r1,GPR1(r1)
824 rfid
825 b . /* prevent speculative execution */
826
827unrecov_fer:
828 bl .save_nvgprs
8291: addi r3,r1,STACK_FRAME_OVERHEAD
830 bl .unrecoverable_exception
831 b 1b
832
769#ifdef CONFIG_ALTIVEC 833#ifdef CONFIG_ALTIVEC
770/* 834/*
771 * load_up_altivec(unused, unused, tsk) 835 * load_up_altivec(unused, unused, tsk)
@@ -840,22 +904,6 @@ _STATIC(load_up_altivec)
840 blr 904 blr
841#endif /* CONFIG_ALTIVEC */ 905#endif /* CONFIG_ALTIVEC */
842 906
843 .align 7
844 .globl vsx_unavailable_common
845vsx_unavailable_common:
846 EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN)
847#ifdef CONFIG_VSX
848BEGIN_FTR_SECTION
849 bne .load_up_vsx
8501:
851END_FTR_SECTION_IFSET(CPU_FTR_VSX)
852#endif
853 bl .save_nvgprs
854 addi r3,r1,STACK_FRAME_OVERHEAD
855 ENABLE_INTS
856 bl .vsx_unavailable_exception
857 b .ret_from_except
858
859#ifdef CONFIG_VSX 907#ifdef CONFIG_VSX
860/* 908/*
861 * load_up_vsx(unused, unused, tsk) 909 * load_up_vsx(unused, unused, tsk)
@@ -1175,11 +1223,14 @@ _GLOBAL(generic_secondary_smp_init)
1175 /* turn on 64-bit mode */ 1223 /* turn on 64-bit mode */
1176 bl .enable_64b_mode 1224 bl .enable_64b_mode
1177 1225
1226 /* get the TOC pointer (real address) */
1227 bl .relative_toc
1228
1178 /* Set up a paca value for this processor. Since we have the 1229 /* Set up a paca value for this processor. Since we have the
1179 * physical cpu id in r24, we need to search the pacas to find 1230 * physical cpu id in r24, we need to search the pacas to find
1180 * which logical id maps to our physical one. 1231 * which logical id maps to our physical one.
1181 */ 1232 */
1182 LOAD_REG_IMMEDIATE(r13, paca) /* Get base vaddr of paca array */ 1233 LOAD_REG_ADDR(r13, paca) /* Get base vaddr of paca array */
1183 li r5,0 /* logical cpu id */ 1234 li r5,0 /* logical cpu id */
11841: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */ 12351: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */
1185 cmpw r6,r24 /* Compare to our id */ 1236 cmpw r6,r24 /* Compare to our id */
@@ -1208,7 +1259,7 @@ _GLOBAL(generic_secondary_smp_init)
1208 sync /* order paca.run and cur_cpu_spec */ 1259 sync /* order paca.run and cur_cpu_spec */
1209 1260
1210 /* See if we need to call a cpu state restore handler */ 1261 /* See if we need to call a cpu state restore handler */
1211 LOAD_REG_IMMEDIATE(r23, cur_cpu_spec) 1262 LOAD_REG_ADDR(r23, cur_cpu_spec)
1212 ld r23,0(r23) 1263 ld r23,0(r23)
1213 ld r23,CPU_SPEC_RESTORE(r23) 1264 ld r23,CPU_SPEC_RESTORE(r23)
1214 cmpdi 0,r23,0 1265 cmpdi 0,r23,0
@@ -1224,10 +1275,15 @@ _GLOBAL(generic_secondary_smp_init)
1224 b __secondary_start 1275 b __secondary_start
1225#endif 1276#endif
1226 1277
1278/*
1279 * Turn the MMU off.
1280 * Assumes we're mapped EA == RA if the MMU is on.
1281 */
1227_STATIC(__mmu_off) 1282_STATIC(__mmu_off)
1228 mfmsr r3 1283 mfmsr r3
1229 andi. r0,r3,MSR_IR|MSR_DR 1284 andi. r0,r3,MSR_IR|MSR_DR
1230 beqlr 1285 beqlr
1286 mflr r4
1231 andc r3,r3,r0 1287 andc r3,r3,r0
1232 mtspr SPRN_SRR0,r4 1288 mtspr SPRN_SRR0,r4
1233 mtspr SPRN_SRR1,r3 1289 mtspr SPRN_SRR1,r3
@@ -1248,6 +1304,18 @@ _STATIC(__mmu_off)
1248 * 1304 *
1249 */ 1305 */
1250_GLOBAL(__start_initialization_multiplatform) 1306_GLOBAL(__start_initialization_multiplatform)
1307 /* Make sure we are running in 64 bits mode */
1308 bl .enable_64b_mode
1309
1310 /* Get TOC pointer (current runtime address) */
1311 bl .relative_toc
1312
1313 /* find out where we are now */
1314 bcl 20,31,$+4
13150: mflr r26 /* r26 = runtime addr here */
1316 addis r26,r26,(_stext - 0b)@ha
1317 addi r26,r26,(_stext - 0b)@l /* current runtime base addr */
1318
1251 /* 1319 /*
1252 * Are we booted from a PROM Of-type client-interface ? 1320 * Are we booted from a PROM Of-type client-interface ?
1253 */ 1321 */
@@ -1259,9 +1327,6 @@ _GLOBAL(__start_initialization_multiplatform)
1259 mr r31,r3 1327 mr r31,r3
1260 mr r30,r4 1328 mr r30,r4
1261 1329
1262 /* Make sure we are running in 64 bits mode */
1263 bl .enable_64b_mode
1264
1265 /* Setup some critical 970 SPRs before switching MMU off */ 1330 /* Setup some critical 970 SPRs before switching MMU off */
1266 mfspr r0,SPRN_PVR 1331 mfspr r0,SPRN_PVR
1267 srwi r0,r0,16 1332 srwi r0,r0,16
@@ -1276,9 +1341,7 @@ _GLOBAL(__start_initialization_multiplatform)
12761: bl .__cpu_preinit_ppc970 13411: bl .__cpu_preinit_ppc970
12772: 13422:
1278 1343
1279 /* Switch off MMU if not already */ 1344 /* Switch off MMU if not already off */
1280 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
1281 add r4,r4,r30
1282 bl .__mmu_off 1345 bl .__mmu_off
1283 b .__after_prom_start 1346 b .__after_prom_start
1284 1347
@@ -1293,22 +1356,15 @@ _INIT_STATIC(__boot_from_prom)
1293 /* 1356 /*
1294 * Align the stack to 16-byte boundary 1357 * Align the stack to 16-byte boundary
1295 * Depending on the size and layout of the ELF sections in the initial 1358 * Depending on the size and layout of the ELF sections in the initial
1296 * boot binary, the stack pointer will be unalignet on PowerMac 1359 * boot binary, the stack pointer may be unaligned on PowerMac
1297 */ 1360 */
1298 rldicr r1,r1,0,59 1361 rldicr r1,r1,0,59
1299 1362
1300 /* Make sure we are running in 64 bits mode */ 1363#ifdef CONFIG_RELOCATABLE
1301 bl .enable_64b_mode 1364 /* Relocate code for where we are now */
1302 1365 mr r3,r26
1303 /* put a relocation offset into r3 */ 1366 bl .relocate
1304 bl .reloc_offset 1367#endif
1305
1306 LOAD_REG_IMMEDIATE(r2,__toc_start)
1307 addi r2,r2,0x4000
1308 addi r2,r2,0x4000
1309
1310 /* Relocate the TOC from a virt addr to a real addr */
1311 add r2,r2,r3
1312 1368
1313 /* Restore parameters */ 1369 /* Restore parameters */
1314 mr r3,r31 1370 mr r3,r31
@@ -1318,60 +1374,51 @@ _INIT_STATIC(__boot_from_prom)
1318 mr r7,r27 1374 mr r7,r27
1319 1375
1320 /* Do all of the interaction with OF client interface */ 1376 /* Do all of the interaction with OF client interface */
1377 mr r8,r26
1321 bl .prom_init 1378 bl .prom_init
1322 /* We never return */ 1379 /* We never return */
1323 trap 1380 trap
1324 1381
1325_STATIC(__after_prom_start) 1382_STATIC(__after_prom_start)
1383#ifdef CONFIG_RELOCATABLE
1384 /* process relocations for the final address of the kernel */
1385 lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */
1386 sldi r25,r25,32
1387 mr r3,r25
1388 bl .relocate
1389#endif
1326 1390
1327/* 1391/*
1328 * We need to run with __start at physical address PHYSICAL_START. 1392 * We need to run with _stext at physical address PHYSICAL_START.
1329 * This will leave some code in the first 256B of 1393 * This will leave some code in the first 256B of
1330 * real memory, which are reserved for software use. 1394 * real memory, which are reserved for software use.
1331 * The remainder of the first page is loaded with the fixed
1332 * interrupt vectors. The next two pages are filled with
1333 * unknown exception placeholders.
1334 * 1395 *
1335 * Note: This process overwrites the OF exception vectors. 1396 * Note: This process overwrites the OF exception vectors.
1336 * r26 == relocation offset
1337 * r27 == KERNELBASE
1338 */ 1397 */
1339 bl .reloc_offset 1398 li r3,0 /* target addr */
1340 mr r26,r3 1399 mr. r4,r26 /* In some cases the loader may */
1341 LOAD_REG_IMMEDIATE(r27, KERNELBASE) 1400 beq 9f /* have already put us at zero */
1342 1401 lis r5,(copy_to_here - _stext)@ha
1343 LOAD_REG_IMMEDIATE(r3, PHYSICAL_START) /* target addr */ 1402 addi r5,r5,(copy_to_here - _stext)@l /* # bytes of memory to copy */
1344
1345 // XXX FIXME: Use phys returned by OF (r30)
1346 add r4,r27,r26 /* source addr */
1347 /* current address of _start */
1348 /* i.e. where we are running */
1349 /* the source addr */
1350
1351 cmpdi r4,0 /* In some cases the loader may */
1352 bne 1f
1353 b .start_here_multiplatform /* have already put us at zero */
1354 /* so we can skip the copy. */
13551: LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
1356 sub r5,r5,r27
1357
1358 li r6,0x100 /* Start offset, the first 0x100 */ 1403 li r6,0x100 /* Start offset, the first 0x100 */
1359 /* bytes were copied earlier. */ 1404 /* bytes were copied earlier. */
1360 1405
1361 bl .copy_and_flush /* copy the first n bytes */ 1406 bl .copy_and_flush /* copy the first n bytes */
1362 /* this includes the code being */ 1407 /* this includes the code being */
1363 /* executed here. */ 1408 /* executed here. */
1364 1409 addis r8,r3,(4f - _stext)@ha /* Jump to the copy of this code */
1365 LOAD_REG_IMMEDIATE(r0, 4f) /* Jump to the copy of this code */ 1410 addi r8,r8,(4f - _stext)@l /* that we just made */
1366 mtctr r0 /* that we just made/relocated */ 1411 mtctr r8
1367 bctr 1412 bctr
1368 1413
13694: LOAD_REG_IMMEDIATE(r5,klimit) 14144: /* Now copy the rest of the kernel up to _end */
1370 add r5,r5,r26 1415 addis r5,r26,(p_end - _stext)@ha
1371 ld r5,0(r5) /* get the value of klimit */ 1416 ld r5,(p_end - _stext)@l(r5) /* get _end */
1372 sub r5,r5,r27
1373 bl .copy_and_flush /* copy the rest */ 1417 bl .copy_and_flush /* copy the rest */
1374 b .start_here_multiplatform 1418
14199: b .start_here_multiplatform
1420
1421p_end: .llong _end - _stext
1375 1422
1376/* 1423/*
1377 * Copy routine used to copy the kernel to start at physical address 0 1424 * Copy routine used to copy the kernel to start at physical address 0
@@ -1436,6 +1483,9 @@ _GLOBAL(pmac_secondary_start)
1436 /* turn on 64-bit mode */ 1483 /* turn on 64-bit mode */
1437 bl .enable_64b_mode 1484 bl .enable_64b_mode
1438 1485
1486 /* get TOC pointer (real address) */
1487 bl .relative_toc
1488
1439 /* Copy some CPU settings from CPU 0 */ 1489 /* Copy some CPU settings from CPU 0 */
1440 bl .__restore_cpu_ppc970 1490 bl .__restore_cpu_ppc970
1441 1491
@@ -1445,10 +1495,10 @@ _GLOBAL(pmac_secondary_start)
1445 mtmsrd r3 /* RI on */ 1495 mtmsrd r3 /* RI on */
1446 1496
1447 /* Set up a paca value for this processor. */ 1497 /* Set up a paca value for this processor. */
1448 LOAD_REG_IMMEDIATE(r4, paca) /* Get base vaddr of paca array */ 1498 LOAD_REG_ADDR(r4,paca) /* Get base vaddr of paca array */
1449 mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ 1499 mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */
1450 add r13,r13,r4 /* for this processor. */ 1500 add r13,r13,r4 /* for this processor. */
1451 mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */ 1501 mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */
1452 1502
1453 /* Create a temp kernel stack for use before relocation is on. */ 1503 /* Create a temp kernel stack for use before relocation is on. */
1454 ld r1,PACAEMERGSP(r13) 1504 ld r1,PACAEMERGSP(r13)
@@ -1476,9 +1526,6 @@ __secondary_start:
1476 /* Set thread priority to MEDIUM */ 1526 /* Set thread priority to MEDIUM */
1477 HMT_MEDIUM 1527 HMT_MEDIUM
1478 1528
1479 /* Load TOC */
1480 ld r2,PACATOC(r13)
1481
1482 /* Do early setup for that CPU (stab, slb, hash table pointer) */ 1529 /* Do early setup for that CPU (stab, slb, hash table pointer) */
1483 bl .early_setup_secondary 1530 bl .early_setup_secondary
1484 1531
@@ -1515,9 +1562,11 @@ END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES)
1515 1562
1516/* 1563/*
1517 * Running with relocation on at this point. All we want to do is 1564 * Running with relocation on at this point. All we want to do is
1518 * zero the stack back-chain pointer before going into C code. 1565 * zero the stack back-chain pointer and get the TOC virtual address
1566 * before going into C code.
1519 */ 1567 */
1520_GLOBAL(start_secondary_prolog) 1568_GLOBAL(start_secondary_prolog)
1569 ld r2,PACATOC(r13)
1521 li r3,0 1570 li r3,0
1522 std r3,0(r1) /* Zero the stack frame pointer */ 1571 std r3,0(r1) /* Zero the stack frame pointer */
1523 bl .start_secondary 1572 bl .start_secondary
@@ -1529,34 +1578,46 @@ _GLOBAL(start_secondary_prolog)
1529 */ 1578 */
1530_GLOBAL(enable_64b_mode) 1579_GLOBAL(enable_64b_mode)
1531 mfmsr r11 /* grab the current MSR */ 1580 mfmsr r11 /* grab the current MSR */
1532 li r12,1 1581 li r12,(MSR_SF | MSR_ISF)@highest
1533 rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG) 1582 sldi r12,r12,48
1534 or r11,r11,r12
1535 li r12,1
1536 rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
1537 or r11,r11,r12 1583 or r11,r11,r12
1538 mtmsrd r11 1584 mtmsrd r11
1539 isync 1585 isync
1540 blr 1586 blr
1541 1587
1542/* 1588/*
1589 * This puts the TOC pointer into r2, offset by 0x8000 (as expected
1590 * by the toolchain). It computes the correct value for wherever we
1591 * are running at the moment, using position-independent code.
1592 */
1593_GLOBAL(relative_toc)
1594 mflr r0
1595 bcl 20,31,$+4
15960: mflr r9
1597 ld r2,(p_toc - 0b)(r9)
1598 add r2,r2,r9
1599 mtlr r0
1600 blr
1601
1602p_toc: .llong __toc_start + 0x8000 - 0b
1603
1604/*
1543 * This is where the main kernel code starts. 1605 * This is where the main kernel code starts.
1544 */ 1606 */
1545_INIT_STATIC(start_here_multiplatform) 1607_INIT_STATIC(start_here_multiplatform)
1546 /* get a new offset, now that the kernel has moved. */ 1608 /* set up the TOC (real address) */
1547 bl .reloc_offset 1609 bl .relative_toc
1548 mr r26,r3
1549 1610
1550 /* Clear out the BSS. It may have been done in prom_init, 1611 /* Clear out the BSS. It may have been done in prom_init,
1551 * already but that's irrelevant since prom_init will soon 1612 * already but that's irrelevant since prom_init will soon
1552 * be detached from the kernel completely. Besides, we need 1613 * be detached from the kernel completely. Besides, we need
1553 * to clear it now for kexec-style entry. 1614 * to clear it now for kexec-style entry.
1554 */ 1615 */
1555 LOAD_REG_IMMEDIATE(r11,__bss_stop) 1616 LOAD_REG_ADDR(r11,__bss_stop)
1556 LOAD_REG_IMMEDIATE(r8,__bss_start) 1617 LOAD_REG_ADDR(r8,__bss_start)
1557 sub r11,r11,r8 /* bss size */ 1618 sub r11,r11,r8 /* bss size */
1558 addi r11,r11,7 /* round up to an even double word */ 1619 addi r11,r11,7 /* round up to an even double word */
1559 rldicl. r11,r11,61,3 /* shift right by 3 */ 1620 srdi. r11,r11,3 /* shift right by 3 */
1560 beq 4f 1621 beq 4f
1561 addi r8,r8,-8 1622 addi r8,r8,-8
1562 li r0,0 1623 li r0,0
@@ -1569,35 +1630,35 @@ _INIT_STATIC(start_here_multiplatform)
1569 ori r6,r6,MSR_RI 1630 ori r6,r6,MSR_RI
1570 mtmsrd r6 /* RI on */ 1631 mtmsrd r6 /* RI on */
1571 1632
1572 /* The following gets the stack and TOC set up with the regs */ 1633#ifdef CONFIG_RELOCATABLE
1634 /* Save the physical address we're running at in kernstart_addr */
1635 LOAD_REG_ADDR(r4, kernstart_addr)
1636 clrldi r0,r25,2
1637 std r0,0(r4)
1638#endif
1639
1640 /* The following gets the stack set up with the regs */
1573 /* pointing to the real addr of the kernel stack. This is */ 1641 /* pointing to the real addr of the kernel stack. This is */
1574 /* all done to support the C function call below which sets */ 1642 /* all done to support the C function call below which sets */
1575 /* up the htab. This is done because we have relocated the */ 1643 /* up the htab. This is done because we have relocated the */
1576 /* kernel but are still running in real mode. */ 1644 /* kernel but are still running in real mode. */
1577 1645
1578 LOAD_REG_IMMEDIATE(r3,init_thread_union) 1646 LOAD_REG_ADDR(r3,init_thread_union)
1579 add r3,r3,r26
1580 1647
1581 /* set up a stack pointer (physical address) */ 1648 /* set up a stack pointer */
1582 addi r1,r3,THREAD_SIZE 1649 addi r1,r3,THREAD_SIZE
1583 li r0,0 1650 li r0,0
1584 stdu r0,-STACK_FRAME_OVERHEAD(r1) 1651 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1585 1652
1586 /* set up the TOC (physical address) */
1587 LOAD_REG_IMMEDIATE(r2,__toc_start)
1588 addi r2,r2,0x4000
1589 addi r2,r2,0x4000
1590 add r2,r2,r26
1591
1592 /* Do very early kernel initializations, including initial hash table, 1653 /* Do very early kernel initializations, including initial hash table,
1593 * stab and slb setup before we turn on relocation. */ 1654 * stab and slb setup before we turn on relocation. */
1594 1655
1595 /* Restore parameters passed from prom_init/kexec */ 1656 /* Restore parameters passed from prom_init/kexec */
1596 mr r3,r31 1657 mr r3,r31
1597 bl .early_setup 1658 bl .early_setup /* also sets r13 and SPRG3 */
1598 1659
1599 LOAD_REG_IMMEDIATE(r3, .start_here_common) 1660 LOAD_REG_ADDR(r3, .start_here_common)
1600 LOAD_REG_IMMEDIATE(r4, MSR_KERNEL) 1661 ld r4,PACAKMSR(r13)
1601 mtspr SPRN_SRR0,r3 1662 mtspr SPRN_SRR0,r3
1602 mtspr SPRN_SRR1,r4 1663 mtspr SPRN_SRR1,r4
1603 rfid 1664 rfid
@@ -1606,20 +1667,10 @@ _INIT_STATIC(start_here_multiplatform)
1606 /* This is where all platforms converge execution */ 1667 /* This is where all platforms converge execution */
1607_INIT_GLOBAL(start_here_common) 1668_INIT_GLOBAL(start_here_common)
1608 /* relocation is on at this point */ 1669 /* relocation is on at this point */
1670 std r1,PACAKSAVE(r13)
1609 1671
1610 /* The following code sets up the SP and TOC now that we are */ 1672 /* Load the TOC (virtual address) */
1611 /* running with translation enabled. */
1612
1613 LOAD_REG_IMMEDIATE(r3,init_thread_union)
1614
1615 /* set up the stack */
1616 addi r1,r3,THREAD_SIZE
1617 li r0,0
1618 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1619
1620 /* Load the TOC */
1621 ld r2,PACATOC(r13) 1673 ld r2,PACATOC(r13)
1622 std r1,PACAKSAVE(r13)
1623 1674
1624 bl .setup_system 1675 bl .setup_system
1625 1676
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 3cb52fa0eda3..590304c24dad 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -422,7 +422,6 @@ skpinv: addi r6,r6,1 /* Increment */
422 * r12 is pointer to the pte 422 * r12 is pointer to the pte
423 */ 423 */
424#ifdef CONFIG_PTE_64BIT 424#ifdef CONFIG_PTE_64BIT
425#define PTE_FLAGS_OFFSET 4
426#define FIND_PTE \ 425#define FIND_PTE \
427 rlwinm r12, r10, 13, 19, 29; /* Compute pgdir/pmd offset */ \ 426 rlwinm r12, r10, 13, 19, 29; /* Compute pgdir/pmd offset */ \
428 lwzx r11, r12, r11; /* Get pgd/pmd entry */ \ 427 lwzx r11, r12, r11; /* Get pgd/pmd entry */ \
@@ -431,7 +430,6 @@ skpinv: addi r6,r6,1 /* Increment */
431 rlwimi r12, r10, 23, 20, 28; /* Compute pte address */ \ 430 rlwimi r12, r10, 23, 20, 28; /* Compute pte address */ \
432 lwz r11, 4(r12); /* Get pte entry */ 431 lwz r11, 4(r12); /* Get pte entry */
433#else 432#else
434#define PTE_FLAGS_OFFSET 0
435#define FIND_PTE \ 433#define FIND_PTE \
436 rlwimi r11, r10, 12, 20, 29; /* Create L1 (pgdir/pmd) address */ \ 434 rlwimi r11, r10, 12, 20, 29; /* Create L1 (pgdir/pmd) address */ \
437 lwz r11, 0(r11); /* Get L1 entry */ \ 435 lwz r11, 0(r11); /* Get L1 entry */ \
@@ -579,13 +577,19 @@ interrupt_base:
579 577
580 FIND_PTE 578 FIND_PTE
581 andc. r13,r13,r11 /* Check permission */ 579 andc. r13,r13,r11 /* Check permission */
582 bne 2f /* Bail if permission mismach */
583 580
584#ifdef CONFIG_PTE_64BIT 581#ifdef CONFIG_PTE_64BIT
585 lwz r13, 0(r12) 582#ifdef CONFIG_SMP
583 subf r10,r11,r12 /* create false data dep */
584 lwzx r13,r11,r10 /* Get upper pte bits */
585#else
586 lwz r13,0(r12) /* Get upper pte bits */
587#endif
586#endif 588#endif
587 589
588 /* Jump to common tlb load */ 590 bne 2f /* Bail if permission/valid mismach */
591
592 /* Jump to common tlb load */
589 b finish_tlb_load 593 b finish_tlb_load
5902: 5942:
591 /* The bailout. Restore registers to pre-exception conditions 595 /* The bailout. Restore registers to pre-exception conditions
@@ -640,12 +644,18 @@ interrupt_base:
640 644
641 FIND_PTE 645 FIND_PTE
642 andc. r13,r13,r11 /* Check permission */ 646 andc. r13,r13,r11 /* Check permission */
643 bne 2f /* Bail if permission mismach */
644 647
645#ifdef CONFIG_PTE_64BIT 648#ifdef CONFIG_PTE_64BIT
646 lwz r13, 0(r12) 649#ifdef CONFIG_SMP
650 subf r10,r11,r12 /* create false data dep */
651 lwzx r13,r11,r10 /* Get upper pte bits */
652#else
653 lwz r13,0(r12) /* Get upper pte bits */
654#endif
647#endif 655#endif
648 656
657 bne 2f /* Bail if permission mismach */
658
649 /* Jump to common TLB load point */ 659 /* Jump to common TLB load point */
650 b finish_tlb_load 660 b finish_tlb_load
651 661
@@ -702,7 +712,7 @@ interrupt_base:
702/* 712/*
703 * Both the instruction and data TLB miss get to this 713 * Both the instruction and data TLB miss get to this
704 * point to load the TLB. 714 * point to load the TLB.
705 * r10 - EA of fault 715 * r10 - available to use
706 * r11 - TLB (info from Linux PTE) 716 * r11 - TLB (info from Linux PTE)
707 * r12 - available to use 717 * r12 - available to use
708 * r13 - upper bits of PTE (if PTE_64BIT) or available to use 718 * r13 - upper bits of PTE (if PTE_64BIT) or available to use
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index d308a9f70f1b..31982d05d81a 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -34,11 +34,7 @@
34#include <asm/smp.h> 34#include <asm/smp.h>
35 35
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37/* this is used for software suspend, and that shuts down 37#define cpu_should_die() cpu_is_offline(smp_processor_id())
38 * CPUs even while the system is still booting... */
39#define cpu_should_die() (cpu_is_offline(smp_processor_id()) && \
40 (system_state == SYSTEM_RUNNING \
41 || system_state == SYSTEM_BOOTING))
42#else 38#else
43#define cpu_should_die() 0 39#define cpu_should_die() 0
44#endif 40#endif
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 550a19399bfa..ea1ba89f9c90 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -51,17 +51,6 @@ static int protect4gb = 1;
51 51
52static void __iommu_free(struct iommu_table *, dma_addr_t, unsigned int); 52static void __iommu_free(struct iommu_table *, dma_addr_t, unsigned int);
53 53
54static inline unsigned long iommu_num_pages(unsigned long vaddr,
55 unsigned long slen)
56{
57 unsigned long npages;
58
59 npages = IOMMU_PAGE_ALIGN(vaddr + slen) - (vaddr & IOMMU_PAGE_MASK);
60 npages >>= IOMMU_PAGE_SHIFT;
61
62 return npages;
63}
64
65static int __init setup_protect4gb(char *str) 54static int __init setup_protect4gb(char *str)
66{ 55{
67 if (strcmp(str, "on") == 0) 56 if (strcmp(str, "on") == 0)
@@ -325,7 +314,7 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
325 } 314 }
326 /* Allocate iommu entries for that segment */ 315 /* Allocate iommu entries for that segment */
327 vaddr = (unsigned long) sg_virt(s); 316 vaddr = (unsigned long) sg_virt(s);
328 npages = iommu_num_pages(vaddr, slen); 317 npages = iommu_num_pages(vaddr, slen, IOMMU_PAGE_SIZE);
329 align = 0; 318 align = 0;
330 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && slen >= PAGE_SIZE && 319 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && slen >= PAGE_SIZE &&
331 (vaddr & ~PAGE_MASK) == 0) 320 (vaddr & ~PAGE_MASK) == 0)
@@ -418,7 +407,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
418 unsigned long vaddr, npages; 407 unsigned long vaddr, npages;
419 408
420 vaddr = s->dma_address & IOMMU_PAGE_MASK; 409 vaddr = s->dma_address & IOMMU_PAGE_MASK;
421 npages = iommu_num_pages(s->dma_address, s->dma_length); 410 npages = iommu_num_pages(s->dma_address, s->dma_length,
411 IOMMU_PAGE_SIZE);
422 __iommu_free(tbl, vaddr, npages); 412 __iommu_free(tbl, vaddr, npages);
423 s->dma_address = DMA_ERROR_CODE; 413 s->dma_address = DMA_ERROR_CODE;
424 s->dma_length = 0; 414 s->dma_length = 0;
@@ -452,7 +442,8 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
452 442
453 if (sg->dma_length == 0) 443 if (sg->dma_length == 0)
454 break; 444 break;
455 npages = iommu_num_pages(dma_handle, sg->dma_length); 445 npages = iommu_num_pages(dma_handle, sg->dma_length,
446 IOMMU_PAGE_SIZE);
456 __iommu_free(tbl, dma_handle, npages); 447 __iommu_free(tbl, dma_handle, npages);
457 sg = sg_next(sg); 448 sg = sg_next(sg);
458 } 449 }
@@ -584,7 +575,7 @@ dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
584 BUG_ON(direction == DMA_NONE); 575 BUG_ON(direction == DMA_NONE);
585 576
586 uaddr = (unsigned long)vaddr; 577 uaddr = (unsigned long)vaddr;
587 npages = iommu_num_pages(uaddr, size); 578 npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE);
588 579
589 if (tbl) { 580 if (tbl) {
590 align = 0; 581 align = 0;
@@ -617,7 +608,7 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
617 BUG_ON(direction == DMA_NONE); 608 BUG_ON(direction == DMA_NONE);
618 609
619 if (tbl) { 610 if (tbl) {
620 npages = iommu_num_pages(dma_handle, size); 611 npages = iommu_num_pages(dma_handle, size, IOMMU_PAGE_SIZE);
621 iommu_free(tbl, dma_handle, npages); 612 iommu_free(tbl, dma_handle, npages);
622 } 613 }
623} 614}
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index d972decf0324..ac222d0ab12e 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -439,8 +439,8 @@ void do_softirq(void)
439 439
440static LIST_HEAD(irq_hosts); 440static LIST_HEAD(irq_hosts);
441static DEFINE_SPINLOCK(irq_big_lock); 441static DEFINE_SPINLOCK(irq_big_lock);
442static DEFINE_PER_CPU(unsigned int, irq_radix_reader); 442static unsigned int revmap_trees_allocated;
443static unsigned int irq_radix_writer; 443static DEFINE_MUTEX(revmap_trees_mutex);
444struct irq_map_entry irq_map[NR_IRQS]; 444struct irq_map_entry irq_map[NR_IRQS];
445static unsigned int irq_virq_count = NR_IRQS; 445static unsigned int irq_virq_count = NR_IRQS;
446static struct irq_host *irq_default_host; 446static struct irq_host *irq_default_host;
@@ -583,57 +583,6 @@ void irq_set_virq_count(unsigned int count)
583 irq_virq_count = count; 583 irq_virq_count = count;
584} 584}
585 585
586/* radix tree not lockless safe ! we use a brlock-type mecanism
587 * for now, until we can use a lockless radix tree
588 */
589static void irq_radix_wrlock(unsigned long *flags)
590{
591 unsigned int cpu, ok;
592
593 spin_lock_irqsave(&irq_big_lock, *flags);
594 irq_radix_writer = 1;
595 smp_mb();
596 do {
597 barrier();
598 ok = 1;
599 for_each_possible_cpu(cpu) {
600 if (per_cpu(irq_radix_reader, cpu)) {
601 ok = 0;
602 break;
603 }
604 }
605 if (!ok)
606 cpu_relax();
607 } while(!ok);
608}
609
610static void irq_radix_wrunlock(unsigned long flags)
611{
612 smp_wmb();
613 irq_radix_writer = 0;
614 spin_unlock_irqrestore(&irq_big_lock, flags);
615}
616
617static void irq_radix_rdlock(unsigned long *flags)
618{
619 local_irq_save(*flags);
620 __get_cpu_var(irq_radix_reader) = 1;
621 smp_mb();
622 if (likely(irq_radix_writer == 0))
623 return;
624 __get_cpu_var(irq_radix_reader) = 0;
625 smp_wmb();
626 spin_lock(&irq_big_lock);
627 __get_cpu_var(irq_radix_reader) = 1;
628 spin_unlock(&irq_big_lock);
629}
630
631static void irq_radix_rdunlock(unsigned long flags)
632{
633 __get_cpu_var(irq_radix_reader) = 0;
634 local_irq_restore(flags);
635}
636
637static int irq_setup_virq(struct irq_host *host, unsigned int virq, 586static int irq_setup_virq(struct irq_host *host, unsigned int virq,
638 irq_hw_number_t hwirq) 587 irq_hw_number_t hwirq)
639{ 588{
@@ -788,7 +737,6 @@ void irq_dispose_mapping(unsigned int virq)
788{ 737{
789 struct irq_host *host; 738 struct irq_host *host;
790 irq_hw_number_t hwirq; 739 irq_hw_number_t hwirq;
791 unsigned long flags;
792 740
793 if (virq == NO_IRQ) 741 if (virq == NO_IRQ)
794 return; 742 return;
@@ -821,12 +769,16 @@ void irq_dispose_mapping(unsigned int virq)
821 host->revmap_data.linear.revmap[hwirq] = NO_IRQ; 769 host->revmap_data.linear.revmap[hwirq] = NO_IRQ;
822 break; 770 break;
823 case IRQ_HOST_MAP_TREE: 771 case IRQ_HOST_MAP_TREE:
824 /* Check if radix tree allocated yet */ 772 /*
825 if (host->revmap_data.tree.gfp_mask == 0) 773 * Check if radix tree allocated yet, if not then nothing to
774 * remove.
775 */
776 smp_rmb();
777 if (revmap_trees_allocated < 1)
826 break; 778 break;
827 irq_radix_wrlock(&flags); 779 mutex_lock(&revmap_trees_mutex);
828 radix_tree_delete(&host->revmap_data.tree, hwirq); 780 radix_tree_delete(&host->revmap_data.tree, hwirq);
829 irq_radix_wrunlock(flags); 781 mutex_unlock(&revmap_trees_mutex);
830 break; 782 break;
831 } 783 }
832 784
@@ -875,43 +827,62 @@ unsigned int irq_find_mapping(struct irq_host *host,
875EXPORT_SYMBOL_GPL(irq_find_mapping); 827EXPORT_SYMBOL_GPL(irq_find_mapping);
876 828
877 829
878unsigned int irq_radix_revmap(struct irq_host *host, 830unsigned int irq_radix_revmap_lookup(struct irq_host *host,
879 irq_hw_number_t hwirq) 831 irq_hw_number_t hwirq)
880{ 832{
881 struct radix_tree_root *tree;
882 struct irq_map_entry *ptr; 833 struct irq_map_entry *ptr;
883 unsigned int virq; 834 unsigned int virq;
884 unsigned long flags;
885 835
886 WARN_ON(host->revmap_type != IRQ_HOST_MAP_TREE); 836 WARN_ON(host->revmap_type != IRQ_HOST_MAP_TREE);
887 837
888 /* Check if the radix tree exist yet. We test the value of 838 /*
889 * the gfp_mask for that. Sneaky but saves another int in the 839 * Check if the radix tree exists and has bee initialized.
890 * structure. If not, we fallback to slow mode 840 * If not, we fallback to slow mode
891 */ 841 */
892 tree = &host->revmap_data.tree; 842 if (revmap_trees_allocated < 2)
893 if (tree->gfp_mask == 0)
894 return irq_find_mapping(host, hwirq); 843 return irq_find_mapping(host, hwirq);
895 844
896 /* Now try to resolve */ 845 /* Now try to resolve */
897 irq_radix_rdlock(&flags); 846 /*
898 ptr = radix_tree_lookup(tree, hwirq); 847 * No rcu_read_lock(ing) needed, the ptr returned can't go under us
899 irq_radix_rdunlock(flags); 848 * as it's referencing an entry in the static irq_map table.
849 */
850 ptr = radix_tree_lookup(&host->revmap_data.tree, hwirq);
900 851
901 /* Found it, return */ 852 /*
902 if (ptr) { 853 * If found in radix tree, then fine.
854 * Else fallback to linear lookup - this should not happen in practice
855 * as it means that we failed to insert the node in the radix tree.
856 */
857 if (ptr)
903 virq = ptr - irq_map; 858 virq = ptr - irq_map;
904 return virq; 859 else
905 } 860 virq = irq_find_mapping(host, hwirq);
861
862 return virq;
863}
864
865void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq,
866 irq_hw_number_t hwirq)
867{
868
869 WARN_ON(host->revmap_type != IRQ_HOST_MAP_TREE);
870
871 /*
872 * Check if the radix tree exists yet.
873 * If not, then the irq will be inserted into the tree when it gets
874 * initialized.
875 */
876 smp_rmb();
877 if (revmap_trees_allocated < 1)
878 return;
906 879
907 /* If not there, try to insert it */
908 virq = irq_find_mapping(host, hwirq);
909 if (virq != NO_IRQ) { 880 if (virq != NO_IRQ) {
910 irq_radix_wrlock(&flags); 881 mutex_lock(&revmap_trees_mutex);
911 radix_tree_insert(tree, hwirq, &irq_map[virq]); 882 radix_tree_insert(&host->revmap_data.tree, hwirq,
912 irq_radix_wrunlock(flags); 883 &irq_map[virq]);
884 mutex_unlock(&revmap_trees_mutex);
913 } 885 }
914 return virq;
915} 886}
916 887
917unsigned int irq_linear_revmap(struct irq_host *host, 888unsigned int irq_linear_revmap(struct irq_host *host,
@@ -1020,14 +991,44 @@ void irq_early_init(void)
1020static int irq_late_init(void) 991static int irq_late_init(void)
1021{ 992{
1022 struct irq_host *h; 993 struct irq_host *h;
1023 unsigned long flags; 994 unsigned int i;
1024 995
1025 irq_radix_wrlock(&flags); 996 /*
997 * No mutual exclusion with respect to accessors of the tree is needed
998 * here as the synchronization is done via the state variable
999 * revmap_trees_allocated.
1000 */
1026 list_for_each_entry(h, &irq_hosts, link) { 1001 list_for_each_entry(h, &irq_hosts, link) {
1027 if (h->revmap_type == IRQ_HOST_MAP_TREE) 1002 if (h->revmap_type == IRQ_HOST_MAP_TREE)
1028 INIT_RADIX_TREE(&h->revmap_data.tree, GFP_ATOMIC); 1003 INIT_RADIX_TREE(&h->revmap_data.tree, GFP_KERNEL);
1004 }
1005
1006 /*
1007 * Make sure the radix trees inits are visible before setting
1008 * the flag
1009 */
1010 smp_wmb();
1011 revmap_trees_allocated = 1;
1012
1013 /*
1014 * Insert the reverse mapping for those interrupts already present
1015 * in irq_map[].
1016 */
1017 mutex_lock(&revmap_trees_mutex);
1018 for (i = 0; i < irq_virq_count; i++) {
1019 if (irq_map[i].host &&
1020 (irq_map[i].host->revmap_type == IRQ_HOST_MAP_TREE))
1021 radix_tree_insert(&irq_map[i].host->revmap_data.tree,
1022 irq_map[i].hwirq, &irq_map[i]);
1029 } 1023 }
1030 irq_radix_wrunlock(flags); 1024 mutex_unlock(&revmap_trees_mutex);
1025
1026 /*
1027 * Make sure the radix trees insertions are visible before setting
1028 * the flag
1029 */
1030 smp_wmb();
1031 revmap_trees_allocated = 2;
1031 1032
1032 return 0; 1033 return 0;
1033} 1034}
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index b4fdf2f2743c..fe8f71dd0b3f 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -347,9 +347,8 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
347 linux_regs->msr |= MSR_SE; 347 linux_regs->msr |= MSR_SE;
348#endif 348#endif
349 kgdb_single_step = 1; 349 kgdb_single_step = 1;
350 if (kgdb_contthread) 350 atomic_set(&kgdb_cpu_doing_single_step,
351 atomic_set(&kgdb_cpu_doing_single_step, 351 raw_smp_processor_id());
352 raw_smp_processor_id());
353 } 352 }
354 return 0; 353 return 0;
355 } 354 }
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index b3eef30b5131..d051e8cbcd03 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -510,10 +510,10 @@ static ssize_t update_ppp(u64 *entitlement, u8 *weight)
510 return -EINVAL; 510 return -EINVAL;
511 511
512 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 512 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
513 __FUNCTION__, ppp_data.entitlement, ppp_data.weight); 513 __func__, ppp_data.entitlement, ppp_data.weight);
514 514
515 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 515 pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
516 __FUNCTION__, new_entitled, new_weight); 516 __func__, new_entitled, new_weight);
517 517
518 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight); 518 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight);
519 return retval; 519 return retval;
@@ -556,10 +556,10 @@ static ssize_t update_mpp(u64 *entitlement, u8 *weight)
556 return -EINVAL; 556 return -EINVAL;
557 557
558 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 558 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
559 __FUNCTION__, mpp_data.entitled_mem, mpp_data.mem_weight); 559 __func__, mpp_data.entitled_mem, mpp_data.mem_weight);
560 560
561 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 561 pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
562 __FUNCTION__, new_entitled, new_weight); 562 __func__, new_entitled, new_weight);
563 563
564 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight); 564 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight);
565 return rc; 565 return rc;
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
index 85cb6f340846..2d29752cbe16 100644
--- a/arch/powerpc/kernel/misc.S
+++ b/arch/powerpc/kernel/misc.S
@@ -31,11 +31,14 @@ _GLOBAL(reloc_offset)
31 mflr r0 31 mflr r0
32 bl 1f 32 bl 1f
331: mflr r3 331: mflr r3
34 LOAD_REG_IMMEDIATE(r4,1b) 34 PPC_LL r4,(2f-1b)(r3)
35 subf r3,r4,r3 35 subf r3,r4,r3
36 mtlr r0 36 mtlr r0
37 blr 37 blr
38 38
39 .align 3
402: PPC_LONG 1b
41
39/* 42/*
40 * add_reloc_offset(x) returns x + reloc_offset(). 43 * add_reloc_offset(x) returns x + reloc_offset().
41 */ 44 */
@@ -43,12 +46,15 @@ _GLOBAL(add_reloc_offset)
43 mflr r0 46 mflr r0
44 bl 1f 47 bl 1f
451: mflr r5 481: mflr r5
46 LOAD_REG_IMMEDIATE(r4,1b) 49 PPC_LL r4,(2f-1b)(r5)
47 subf r5,r4,r5 50 subf r5,r4,r5
48 add r3,r3,r5 51 add r3,r3,r5
49 mtlr r0 52 mtlr r0
50 blr 53 blr
51 54
55 .align 3
562: PPC_LONG 1b
57
52_GLOBAL(kernel_execve) 58_GLOBAL(kernel_execve)
53 li r0,__NR_execve 59 li r0,__NR_execve
54 sc 60 sc
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 7a6dfbca7682..6a9b4bf0d173 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -274,6 +274,10 @@ _GLOBAL(real_writeb)
274/* 274/*
275 * Flush MMU TLB 275 * Flush MMU TLB
276 */ 276 */
277#ifndef CONFIG_FSL_BOOKE
278_GLOBAL(_tlbil_all)
279_GLOBAL(_tlbil_pid)
280#endif
277_GLOBAL(_tlbia) 281_GLOBAL(_tlbia)
278#if defined(CONFIG_40x) 282#if defined(CONFIG_40x)
279 sync /* Flush to memory before changing mapping */ 283 sync /* Flush to memory before changing mapping */
@@ -344,6 +348,9 @@ _GLOBAL(_tlbia)
344/* 348/*
345 * Flush MMU TLB for a particular address 349 * Flush MMU TLB for a particular address
346 */ 350 */
351#ifndef CONFIG_FSL_BOOKE
352_GLOBAL(_tlbil_va)
353#endif
347_GLOBAL(_tlbie) 354_GLOBAL(_tlbie)
348#if defined(CONFIG_40x) 355#if defined(CONFIG_40x)
349 /* We run the search with interrupts disabled because we have to change 356 /* We run the search with interrupts disabled because we have to change
@@ -436,6 +443,53 @@ _GLOBAL(_tlbie)
436#endif /* ! CONFIG_40x */ 443#endif /* ! CONFIG_40x */
437 blr 444 blr
438 445
446#if defined(CONFIG_FSL_BOOKE)
447/*
448 * Flush MMU TLB, but only on the local processor (no broadcast)
449 */
450_GLOBAL(_tlbil_all)
451#define MMUCSR0_TLBFI (MMUCSR0_TLB0FI | MMUCSR0_TLB1FI | \
452 MMUCSR0_TLB2FI | MMUCSR0_TLB3FI)
453 li r3,(MMUCSR0_TLBFI)@l
454 mtspr SPRN_MMUCSR0, r3
4551:
456 mfspr r3,SPRN_MMUCSR0
457 andi. r3,r3,MMUCSR0_TLBFI@l
458 bne 1b
459 blr
460
461/*
462 * Flush MMU TLB for a particular process id, but only on the local processor
463 * (no broadcast)
464 */
465_GLOBAL(_tlbil_pid)
466/* we currently do an invalidate all since we don't have per pid invalidate */
467 li r3,(MMUCSR0_TLBFI)@l
468 mtspr SPRN_MMUCSR0, r3
4691:
470 mfspr r3,SPRN_MMUCSR0
471 andi. r3,r3,MMUCSR0_TLBFI@l
472 bne 1b
473 blr
474
475/*
476 * Flush MMU TLB for a particular address, but only on the local processor
477 * (no broadcast)
478 */
479_GLOBAL(_tlbil_va)
480 slwi r4,r4,16
481 mtspr SPRN_MAS6,r4 /* assume AS=0 for now */
482 tlbsx 0,r3
483 mfspr r4,SPRN_MAS1 /* check valid */
484 andis. r3,r4,MAS1_VALID@h
485 beqlr
486 rlwinm r4,r4,0,1,31
487 mtspr SPRN_MAS1,r4
488 tlbwe
489 blr
490#endif /* CONFIG_FSL_BOOKE */
491
492
439/* 493/*
440 * Flush instruction cache. 494 * Flush instruction cache.
441 * This is a no-op on the 601. 495 * This is a no-op on the 601.
@@ -846,8 +900,10 @@ _GLOBAL(kernel_thread)
846 li r4,0 /* new sp (unused) */ 900 li r4,0 /* new sp (unused) */
847 li r0,__NR_clone 901 li r0,__NR_clone
848 sc 902 sc
849 cmpwi 0,r3,0 /* parent or child? */ 903 bns+ 1f /* did system call indicate error? */
850 bne 1f /* return if parent */ 904 neg r3,r3 /* if so, make return code negative */
9051: cmpwi 0,r3,0 /* parent or child? */
906 bne 2f /* return if parent */
851 li r0,0 /* make top-level stack frame */ 907 li r0,0 /* make top-level stack frame */
852 stwu r0,-16(r1) 908 stwu r0,-16(r1)
853 mtlr r30 /* fn addr in lr */ 909 mtlr r30 /* fn addr in lr */
@@ -857,7 +913,7 @@ _GLOBAL(kernel_thread)
857 li r0,__NR_exit /* exit if function returns */ 913 li r0,__NR_exit /* exit if function returns */
858 li r3,0 914 li r3,0
859 sc 915 sc
8601: lwz r30,8(r1) 9162: lwz r30,8(r1)
861 lwz r31,12(r1) 917 lwz r31,12(r1)
862 addi r1,r1,16 918 addi r1,r1,16
863 blr 919 blr
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 4dd70cf7bb4e..3053fe5c62f2 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -426,8 +426,10 @@ _GLOBAL(kernel_thread)
426 li r4,0 /* new sp (unused) */ 426 li r4,0 /* new sp (unused) */
427 li r0,__NR_clone 427 li r0,__NR_clone
428 sc 428 sc
429 cmpdi 0,r3,0 /* parent or child? */ 429 bns+ 1f /* did system call indicate error? */
430 bne 1f /* return if parent */ 430 neg r3,r3 /* if so, make return code negative */
4311: cmpdi 0,r3,0 /* parent or child? */
432 bne 2f /* return if parent */
431 li r0,0 433 li r0,0
432 stdu r0,-STACK_FRAME_OVERHEAD(r1) 434 stdu r0,-STACK_FRAME_OVERHEAD(r1)
433 ld r2,8(r29) 435 ld r2,8(r29)
@@ -438,7 +440,7 @@ _GLOBAL(kernel_thread)
438 li r0,__NR_exit /* exit after child exits */ 440 li r0,__NR_exit /* exit after child exits */
439 li r3,0 441 li r3,0
440 sc 442 sc
4411: addi r1,r1,STACK_FRAME_OVERHEAD 4432: addi r1,r1,STACK_FRAME_OVERHEAD
442 ld r29,-24(r1) 444 ld r29,-24(r1)
443 ld r30,-16(r1) 445 ld r30,-16(r1)
444 blr 446 blr
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index ee6a2982d567..1af2377e4992 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -22,7 +22,6 @@
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <linux/bug.h> 23#include <linux/bug.h>
24#include <asm/module.h> 24#include <asm/module.h>
25#include <asm/uaccess.h>
26#include <asm/firmware.h> 25#include <asm/firmware.h>
27#include <asm/code-patching.h> 26#include <asm/code-patching.h>
28#include <linux/sort.h> 27#include <linux/sort.h>
@@ -42,13 +41,6 @@
42#define DEBUGP(fmt , ...) 41#define DEBUGP(fmt , ...)
43#endif 42#endif
44 43
45/* There's actually a third entry here, but it's unused */
46struct ppc64_opd_entry
47{
48 unsigned long funcaddr;
49 unsigned long r2;
50};
51
52/* Like PPC32, we need little trampolines to do > 24-bit jumps (into 44/* Like PPC32, we need little trampolines to do > 24-bit jumps (into
53 the kernel itself). But on PPC64, these need to be used for every 45 the kernel itself). But on PPC64, these need to be used for every
54 jump, actually, to reset r2 (TOC+0x8000). */ 46 jump, actually, to reset r2 (TOC+0x8000). */
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index e9be908f199b..93ae5b169f41 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -78,7 +78,7 @@ struct of_device *of_device_alloc(struct device_node *np,
78 dev->dev.parent = parent; 78 dev->dev.parent = parent;
79 dev->dev.release = of_release_dev; 79 dev->dev.release = of_release_dev;
80 dev->dev.archdata.of_node = np; 80 dev->dev.archdata.of_node = np;
81 dev->dev.archdata.numa_node = of_node_to_nid(np); 81 set_dev_node(&dev->dev, of_node_to_nid(np));
82 82
83 if (bus_id) 83 if (bus_id)
84 strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE); 84 strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index c9bf17eec31b..48a347133f41 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -12,6 +12,7 @@
12 12
13#include <asm/lppaca.h> 13#include <asm/lppaca.h>
14#include <asm/paca.h> 14#include <asm/paca.h>
15#include <asm/sections.h>
15 16
16/* This symbol is provided by the linker - let it fill in the paca 17/* This symbol is provided by the linker - let it fill in the paca
17 * field correctly */ 18 * field correctly */
@@ -79,6 +80,8 @@ void __init initialise_pacas(void)
79 new_paca->lock_token = 0x8000; 80 new_paca->lock_token = 0x8000;
80 new_paca->paca_index = cpu; 81 new_paca->paca_index = cpu;
81 new_paca->kernel_toc = kernel_toc; 82 new_paca->kernel_toc = kernel_toc;
83 new_paca->kernelbase = (unsigned long) _stext;
84 new_paca->kernel_msr = MSR_KERNEL;
82 new_paca->hw_cpu_id = 0xffff; 85 new_paca->hw_cpu_id = 0xffff;
83 new_paca->slb_shadow_ptr = &slb_shadow[cpu]; 86 new_paca->slb_shadow_ptr = &slb_shadow[cpu];
84 new_paca->__current = &init_task; 87 new_paca->__current = &init_task;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index ea0c61e09b76..01ce8c38bae6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -56,6 +56,34 @@ resource_size_t isa_mem_base;
56/* Default PCI flags is 0 */ 56/* Default PCI flags is 0 */
57unsigned int ppc_pci_flags; 57unsigned int ppc_pci_flags;
58 58
59static struct dma_mapping_ops *pci_dma_ops;
60
61void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
62{
63 pci_dma_ops = dma_ops;
64}
65
66struct dma_mapping_ops *get_pci_dma_ops(void)
67{
68 return pci_dma_ops;
69}
70EXPORT_SYMBOL(get_pci_dma_ops);
71
72int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
73{
74 return dma_set_mask(&dev->dev, mask);
75}
76
77int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
78{
79 int rc;
80
81 rc = dma_set_mask(&dev->dev, mask);
82 dev->dev.coherent_dma_mask = dev->dma_mask;
83
84 return rc;
85}
86
59struct pci_controller *pcibios_alloc_controller(struct device_node *dev) 87struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
60{ 88{
61 struct pci_controller *phb; 89 struct pci_controller *phb;
@@ -180,6 +208,26 @@ char __devinit *pcibios_setup(char *str)
180 return str; 208 return str;
181} 209}
182 210
211void __devinit pcibios_setup_new_device(struct pci_dev *dev)
212{
213 struct dev_archdata *sd = &dev->dev.archdata;
214
215 sd->of_node = pci_device_to_OF_node(dev);
216
217 DBG("PCI: device %s OF node: %s\n", pci_name(dev),
218 sd->of_node ? sd->of_node->full_name : "<none>");
219
220 sd->dma_ops = pci_dma_ops;
221#ifdef CONFIG_PPC32
222 sd->dma_data = (void *)PCI_DRAM_OFFSET;
223#endif
224 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
225
226 if (ppc_md.pci_dma_dev_setup)
227 ppc_md.pci_dma_dev_setup(dev);
228}
229EXPORT_SYMBOL(pcibios_setup_new_device);
230
183/* 231/*
184 * Reads the interrupt pin to determine if interrupt is use by card. 232 * Reads the interrupt pin to determine if interrupt is use by card.
185 * If the interrupt is used, then gets the interrupt line from the 233 * If the interrupt is used, then gets the interrupt line from the
@@ -371,7 +419,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
371 struct pci_dev *pdev = NULL; 419 struct pci_dev *pdev = NULL;
372 struct resource *found = NULL; 420 struct resource *found = NULL;
373 unsigned long prot = pgprot_val(protection); 421 unsigned long prot = pgprot_val(protection);
374 unsigned long offset = pfn << PAGE_SHIFT; 422 resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT;
375 int i; 423 int i;
376 424
377 if (page_is_ram(pfn)) 425 if (page_is_ram(pfn))
@@ -422,7 +470,8 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
422int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 470int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
423 enum pci_mmap_state mmap_state, int write_combine) 471 enum pci_mmap_state mmap_state, int write_combine)
424{ 472{
425 resource_size_t offset = vma->vm_pgoff << PAGE_SHIFT; 473 resource_size_t offset =
474 ((resource_size_t)vma->vm_pgoff) << PAGE_SHIFT;
426 struct resource *rp; 475 struct resource *rp;
427 int ret; 476 int ret;
428 477
@@ -731,11 +780,6 @@ static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
731 780
732 res->start = (res->start + offset) & mask; 781 res->start = (res->start + offset) & mask;
733 res->end = (res->end + offset) & mask; 782 res->end = (res->end + offset) & mask;
734
735 pr_debug("PCI:%s %016llx-%016llx\n",
736 pci_name(dev),
737 (unsigned long long)res->start,
738 (unsigned long long)res->end);
739} 783}
740 784
741 785
@@ -781,6 +825,11 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
781 (unsigned int)res->flags); 825 (unsigned int)res->flags);
782 826
783 fixup_resource(res, dev); 827 fixup_resource(res, dev);
828
829 pr_debug("PCI:%s %016llx-%016llx\n",
830 pci_name(dev),
831 (unsigned long long)res->start,
832 (unsigned long long)res->end);
784 } 833 }
785 834
786 /* Call machine specific resource fixup */ 835 /* Call machine specific resource fixup */
@@ -789,58 +838,127 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
789} 838}
790DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources); 839DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
791 840
792static void __devinit __pcibios_fixup_bus(struct pci_bus *bus) 841/* This function tries to figure out if a bridge resource has been initialized
842 * by the firmware or not. It doesn't have to be absolutely bullet proof, but
843 * things go more smoothly when it gets it right. It should covers cases such
844 * as Apple "closed" bridge resources and bare-metal pSeries unassigned bridges
845 */
846static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
847 struct resource *res)
793{ 848{
794 struct pci_controller *hose = pci_bus_to_host(bus); 849 struct pci_controller *hose = pci_bus_to_host(bus);
795 struct pci_dev *dev = bus->self; 850 struct pci_dev *dev = bus->self;
851 resource_size_t offset;
852 u16 command;
853 int i;
796 854
797 pr_debug("PCI: Fixup bus %d (%s)\n", bus->number, dev ? pci_name(dev) : "PHB"); 855 /* We don't do anything if PCI_PROBE_ONLY is set */
856 if (ppc_pci_flags & PPC_PCI_PROBE_ONLY)
857 return 0;
798 858
799 /* Fixup PCI<->PCI bridges. Host bridges are handled separately, for 859 /* Job is a bit different between memory and IO */
800 * now differently between 32 and 64 bits. 860 if (res->flags & IORESOURCE_MEM) {
801 */ 861 /* If the BAR is non-0 (res != pci_mem_offset) then it's probably been
802 if (dev != NULL) { 862 * initialized by somebody
803 struct resource *res; 863 */
804 int i; 864 if (res->start != hose->pci_mem_offset)
865 return 0;
805 866
806 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { 867 /* The BAR is 0, let's check if memory decoding is enabled on
807 if ((res = bus->resource[i]) == NULL) 868 * the bridge. If not, we consider it unassigned
808 continue; 869 */
809 if (!res->flags) 870 pci_read_config_word(dev, PCI_COMMAND, &command);
810 continue; 871 if ((command & PCI_COMMAND_MEMORY) == 0)
811 if (i >= 3 && bus->self->transparent) 872 return 1;
812 continue;
813 /* On PowerMac, Apple leaves bridge windows open over
814 * an inaccessible region of memory space (0...fffff)
815 * which is somewhat bogus, but that's what they think
816 * means disabled...
817 *
818 * We clear those to force them to be reallocated later
819 *
820 * We detect such regions by the fact that the base is
821 * equal to the pci_mem_offset of the host bridge and
822 * their size is smaller than 1M.
823 */
824 if (res->flags & IORESOURCE_MEM &&
825 res->start == hose->pci_mem_offset &&
826 res->end < 0x100000) {
827 printk(KERN_INFO
828 "PCI: Closing bogus Apple Firmware"
829 " region %d on bus 0x%02x\n",
830 i, bus->number);
831 res->flags = 0;
832 continue;
833 }
834 873
835 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n", 874 /* Memory decoding is enabled and the BAR is 0. If any of the bridge
836 pci_name(dev), i, 875 * resources covers that starting address (0 then it's good enough for
837 (unsigned long long)res->start,\ 876 * us for memory
838 (unsigned long long)res->end, 877 */
839 (unsigned int)res->flags); 878 for (i = 0; i < 3; i++) {
879 if ((hose->mem_resources[i].flags & IORESOURCE_MEM) &&
880 hose->mem_resources[i].start == hose->pci_mem_offset)
881 return 0;
882 }
840 883
841 fixup_resource(res, dev); 884 /* Well, it starts at 0 and we know it will collide so we may as
885 * well consider it as unassigned. That covers the Apple case.
886 */
887 return 1;
888 } else {
889 /* If the BAR is non-0, then we consider it assigned */
890 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
891 if (((res->start - offset) & 0xfffffffful) != 0)
892 return 0;
893
894 /* Here, we are a bit different than memory as typically IO space
895 * starting at low addresses -is- valid. What we do instead if that
896 * we consider as unassigned anything that doesn't have IO enabled
897 * in the PCI command register, and that's it.
898 */
899 pci_read_config_word(dev, PCI_COMMAND, &command);
900 if (command & PCI_COMMAND_IO)
901 return 0;
902
903 /* It's starting at 0 and IO is disabled in the bridge, consider
904 * it unassigned
905 */
906 return 1;
907 }
908}
909
910/* Fixup resources of a PCI<->PCI bridge */
911static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
912{
913 struct resource *res;
914 int i;
915
916 struct pci_dev *dev = bus->self;
917
918 for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) {
919 if ((res = bus->resource[i]) == NULL)
920 continue;
921 if (!res->flags)
922 continue;
923 if (i >= 3 && bus->self->transparent)
924 continue;
925
926 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n",
927 pci_name(dev), i,
928 (unsigned long long)res->start,\
929 (unsigned long long)res->end,
930 (unsigned int)res->flags);
931
932 /* Perform fixup */
933 fixup_resource(res, dev);
934
935 /* Try to detect uninitialized P2P bridge resources,
936 * and clear them out so they get re-assigned later
937 */
938 if (pcibios_uninitialized_bridge_resource(bus, res)) {
939 res->flags = 0;
940 pr_debug("PCI:%s (unassigned)\n", pci_name(dev));
941 } else {
942
943 pr_debug("PCI:%s %016llx-%016llx\n",
944 pci_name(dev),
945 (unsigned long long)res->start,
946 (unsigned long long)res->end);
842 } 947 }
843 } 948 }
949}
950
951static void __devinit __pcibios_fixup_bus(struct pci_bus *bus)
952{
953 struct pci_dev *dev = bus->self;
954
955 pr_debug("PCI: Fixup bus %d (%s)\n", bus->number, dev ? pci_name(dev) : "PHB");
956
957 /* Fixup PCI<->PCI bridges. Host bridges are handled separately, for
958 * now differently between 32 and 64 bits.
959 */
960 if (dev != NULL)
961 pcibios_fixup_bridge(bus);
844 962
845 /* Additional setup that is different between 32 and 64 bits for now */ 963 /* Additional setup that is different between 32 and 64 bits for now */
846 pcibios_do_bus_setup(bus); 964 pcibios_do_bus_setup(bus);
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 88db4ffaf11c..131b1dfa68c6 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -53,12 +53,19 @@ LIST_HEAD(hose_list);
53 53
54static int pci_bus_count; 54static int pci_bus_count;
55 55
56/* This will remain NULL for now, until isa-bridge.c is made common
57 * to both 32-bit and 64-bit.
58 */
59struct pci_dev *isa_bridge_pcidev;
60EXPORT_SYMBOL_GPL(isa_bridge_pcidev);
61
56static void 62static void
57fixup_hide_host_resource_fsl(struct pci_dev* dev) 63fixup_hide_host_resource_fsl(struct pci_dev *dev)
58{ 64{
59 int i, class = dev->class >> 8; 65 int i, class = dev->class >> 8;
60 66
61 if ((class == PCI_CLASS_PROCESSOR_POWERPC) && 67 if ((class == PCI_CLASS_PROCESSOR_POWERPC ||
68 class == PCI_CLASS_BRIDGE_OTHER) &&
62 (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) && 69 (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) &&
63 (dev->bus->parent == NULL)) { 70 (dev->bus->parent == NULL)) {
64 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 71 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
@@ -424,6 +431,7 @@ void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
424 unsigned long io_offset; 431 unsigned long io_offset;
425 struct resource *res; 432 struct resource *res;
426 int i; 433 int i;
434 struct pci_dev *dev;
427 435
428 /* Hookup PHB resources */ 436 /* Hookup PHB resources */
429 io_offset = (unsigned long)hose->io_base_virt - isa_io_base; 437 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
@@ -457,6 +465,12 @@ void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
457 bus->resource[i+1] = res; 465 bus->resource[i+1] = res;
458 } 466 }
459 } 467 }
468
469 if (ppc_md.pci_dma_bus_setup)
470 ppc_md.pci_dma_bus_setup(bus);
471
472 list_for_each_entry(dev, &bus->devices, bus_list)
473 pcibios_setup_new_device(dev);
460} 474}
461 475
462/* the next one is stolen from the alpha port... */ 476/* the next one is stolen from the alpha port... */
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 30eedfc5a566..8247cff1cb3e 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -52,35 +52,6 @@ EXPORT_SYMBOL(pci_io_base);
52 52
53LIST_HEAD(hose_list); 53LIST_HEAD(hose_list);
54 54
55static struct dma_mapping_ops *pci_dma_ops;
56
57void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
58{
59 pci_dma_ops = dma_ops;
60}
61
62struct dma_mapping_ops *get_pci_dma_ops(void)
63{
64 return pci_dma_ops;
65}
66EXPORT_SYMBOL(get_pci_dma_ops);
67
68
69int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
70{
71 return dma_set_mask(&dev->dev, mask);
72}
73
74int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
75{
76 int rc;
77
78 rc = dma_set_mask(&dev->dev, mask);
79 dev->dev.coherent_dma_mask = dev->dma_mask;
80
81 return rc;
82}
83
84static void fixup_broken_pcnet32(struct pci_dev* dev) 55static void fixup_broken_pcnet32(struct pci_dev* dev)
85{ 56{
86 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) { 57 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
@@ -548,26 +519,6 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
548} 519}
549EXPORT_SYMBOL_GPL(pcibios_map_io_space); 520EXPORT_SYMBOL_GPL(pcibios_map_io_space);
550 521
551void __devinit pcibios_setup_new_device(struct pci_dev *dev)
552{
553 struct dev_archdata *sd = &dev->dev.archdata;
554
555 sd->of_node = pci_device_to_OF_node(dev);
556
557 DBG("PCI: device %s OF node: %s\n", pci_name(dev),
558 sd->of_node ? sd->of_node->full_name : "<none>");
559
560 sd->dma_ops = pci_dma_ops;
561#ifdef CONFIG_NUMA
562 sd->numa_node = pcibus_to_node(dev->bus);
563#else
564 sd->numa_node = -1;
565#endif
566 if (ppc_md.pci_dma_dev_setup)
567 ppc_md.pci_dma_dev_setup(dev);
568}
569EXPORT_SYMBOL(pcibios_setup_new_device);
570
571void __devinit pcibios_do_bus_setup(struct pci_bus *bus) 522void __devinit pcibios_do_bus_setup(struct pci_bus *bus)
572{ 523{
573 struct pci_dev *dev; 524 struct pci_dev *dev;
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index e1ea4fe5cfbd..8edc2359c419 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -119,6 +119,9 @@ EXPORT_SYMBOL(flush_instruction_cache);
119EXPORT_SYMBOL(flush_tlb_kernel_range); 119EXPORT_SYMBOL(flush_tlb_kernel_range);
120EXPORT_SYMBOL(flush_tlb_page); 120EXPORT_SYMBOL(flush_tlb_page);
121EXPORT_SYMBOL(_tlbie); 121EXPORT_SYMBOL(_tlbie);
122#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE)
123EXPORT_SYMBOL(_tlbil_va);
124#endif
122#endif 125#endif
123EXPORT_SYMBOL(__flush_icache_range); 126EXPORT_SYMBOL(__flush_icache_range);
124EXPORT_SYMBOL(flush_dcache_range); 127EXPORT_SYMBOL(flush_dcache_range);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 87d83c56b31e..3a2dc7e6586a 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -888,9 +888,10 @@ static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
888 */ 888 */
889static int __init early_init_dt_scan_drconf_memory(unsigned long node) 889static int __init early_init_dt_scan_drconf_memory(unsigned long node)
890{ 890{
891 cell_t *dm, *ls; 891 cell_t *dm, *ls, *usm;
892 unsigned long l, n, flags; 892 unsigned long l, n, flags;
893 u64 base, size, lmb_size; 893 u64 base, size, lmb_size;
894 unsigned int is_kexec_kdump = 0, rngs;
894 895
895 ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l); 896 ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
896 if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t)) 897 if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
@@ -905,6 +906,12 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
905 if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t)) 906 if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
906 return 0; 907 return 0;
907 908
909 /* check if this is a kexec/kdump kernel. */
910 usm = (cell_t *)of_get_flat_dt_prop(node, "linux,drconf-usable-memory",
911 &l);
912 if (usm != NULL)
913 is_kexec_kdump = 1;
914
908 for (; n != 0; --n) { 915 for (; n != 0; --n) {
909 base = dt_mem_next_cell(dt_root_addr_cells, &dm); 916 base = dt_mem_next_cell(dt_root_addr_cells, &dm);
910 flags = dm[3]; 917 flags = dm[3];
@@ -915,13 +922,34 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
915 if ((flags & 0x80) || !(flags & 0x8)) 922 if ((flags & 0x80) || !(flags & 0x8))
916 continue; 923 continue;
917 size = lmb_size; 924 size = lmb_size;
918 if (iommu_is_off) { 925 rngs = 1;
919 if (base >= 0x80000000ul) 926 if (is_kexec_kdump) {
927 /*
928 * For each lmb in ibm,dynamic-memory, a corresponding
929 * entry in linux,drconf-usable-memory property contains
930 * a counter 'p' followed by 'p' (base, size) duple.
931 * Now read the counter from
932 * linux,drconf-usable-memory property
933 */
934 rngs = dt_mem_next_cell(dt_root_size_cells, &usm);
935 if (!rngs) /* there are no (base, size) duple */
920 continue; 936 continue;
921 if ((base + size) > 0x80000000ul)
922 size = 0x80000000ul - base;
923 } 937 }
924 lmb_add(base, size); 938 do {
939 if (is_kexec_kdump) {
940 base = dt_mem_next_cell(dt_root_addr_cells,
941 &usm);
942 size = dt_mem_next_cell(dt_root_size_cells,
943 &usm);
944 }
945 if (iommu_is_off) {
946 if (base >= 0x80000000ul)
947 continue;
948 if ((base + size) > 0x80000000ul)
949 size = 0x80000000ul - base;
950 }
951 lmb_add(base, size);
952 } while (--rngs);
925 } 953 }
926 lmb_dump_all(); 954 lmb_dump_all();
927 return 0; 955 return 0;
@@ -1164,6 +1192,9 @@ void __init early_init_devtree(void *params)
1164 1192
1165 /* Reserve LMB regions used by kernel, initrd, dt, etc... */ 1193 /* Reserve LMB regions used by kernel, initrd, dt, etc... */
1166 lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START); 1194 lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
1195 /* If relocatable, reserve first 32k for interrupt vectors etc. */
1196 if (PHYSICAL_START > MEMORY_START)
1197 lmb_reserve(MEMORY_START, 0x8000);
1167 reserve_kdump_trampoline(); 1198 reserve_kdump_trampoline();
1168 reserve_crashkernel(); 1199 reserve_crashkernel();
1169 early_reserve_mem(); 1200 early_reserve_mem();
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index b72849ac7db3..2fdbc18ae94a 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -732,7 +732,7 @@ static struct fake_elf {
732 u32 ignore_me; 732 u32 ignore_me;
733 } rpadesc; 733 } rpadesc;
734 } rpanote; 734 } rpanote;
735} fake_elf = { 735} fake_elf __section(.fakeelf) = {
736 .elfhdr = { 736 .elfhdr = {
737 .e_ident = { 0x7f, 'E', 'L', 'F', 737 .e_ident = { 0x7f, 'E', 'L', 'F',
738 ELFCLASS32, ELFDATA2MSB, EV_CURRENT }, 738 ELFCLASS32, ELFDATA2MSB, EV_CURRENT },
@@ -774,13 +774,13 @@ static struct fake_elf {
774 .type = 0x12759999, 774 .type = 0x12759999,
775 .name = "IBM,RPA-Client-Config", 775 .name = "IBM,RPA-Client-Config",
776 .rpadesc = { 776 .rpadesc = {
777 .lpar_affinity = 0, 777 .lpar_affinity = 1,
778 .min_rmo_size = 64, /* in megabytes */ 778 .min_rmo_size = 128, /* in megabytes */
779 .min_rmo_percent = 0, 779 .min_rmo_percent = 0,
780 .max_pft_size = 48, /* 2^48 bytes max PFT size */ 780 .max_pft_size = 46, /* 2^46 bytes max PFT size */
781 .splpar = 1, 781 .splpar = 1,
782 .min_load = ~0U, 782 .min_load = ~0U,
783 .new_mem_def = 0 783 .new_mem_def = 1
784 } 784 }
785 } 785 }
786}; 786};
@@ -1321,7 +1321,7 @@ static void __init prom_initialize_tce_table(void)
1321 * 1321 *
1322 * -- Cort 1322 * -- Cort
1323 */ 1323 */
1324extern void __secondary_hold(void); 1324extern char __secondary_hold;
1325extern unsigned long __secondary_hold_spinloop; 1325extern unsigned long __secondary_hold_spinloop;
1326extern unsigned long __secondary_hold_acknowledge; 1326extern unsigned long __secondary_hold_acknowledge;
1327 1327
@@ -1342,13 +1342,7 @@ static void __init prom_hold_cpus(void)
1342 = (void *) LOW_ADDR(__secondary_hold_spinloop); 1342 = (void *) LOW_ADDR(__secondary_hold_spinloop);
1343 unsigned long *acknowledge 1343 unsigned long *acknowledge
1344 = (void *) LOW_ADDR(__secondary_hold_acknowledge); 1344 = (void *) LOW_ADDR(__secondary_hold_acknowledge);
1345#ifdef CONFIG_PPC64
1346 /* __secondary_hold is actually a descriptor, not the text address */
1347 unsigned long secondary_hold
1348 = __pa(*PTRRELOC((unsigned long *)__secondary_hold));
1349#else
1350 unsigned long secondary_hold = LOW_ADDR(__secondary_hold); 1345 unsigned long secondary_hold = LOW_ADDR(__secondary_hold);
1351#endif
1352 1346
1353 prom_debug("prom_hold_cpus: start...\n"); 1347 prom_debug("prom_hold_cpus: start...\n");
1354 prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop); 1348 prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop);
@@ -2315,13 +2309,14 @@ static void __init prom_check_initrd(unsigned long r3, unsigned long r4)
2315 2309
2316unsigned long __init prom_init(unsigned long r3, unsigned long r4, 2310unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2317 unsigned long pp, 2311 unsigned long pp,
2318 unsigned long r6, unsigned long r7) 2312 unsigned long r6, unsigned long r7,
2313 unsigned long kbase)
2319{ 2314{
2320 struct prom_t *_prom; 2315 struct prom_t *_prom;
2321 unsigned long hdr; 2316 unsigned long hdr;
2322 unsigned long offset = reloc_offset();
2323 2317
2324#ifdef CONFIG_PPC32 2318#ifdef CONFIG_PPC32
2319 unsigned long offset = reloc_offset();
2325 reloc_got2(offset); 2320 reloc_got2(offset);
2326#endif 2321#endif
2327 2322
@@ -2355,9 +2350,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2355 */ 2350 */
2356 RELOC(of_platform) = prom_find_machine_type(); 2351 RELOC(of_platform) = prom_find_machine_type();
2357 2352
2353#ifndef CONFIG_RELOCATABLE
2358 /* Bail if this is a kdump kernel. */ 2354 /* Bail if this is a kdump kernel. */
2359 if (PHYSICAL_START > 0) 2355 if (PHYSICAL_START > 0)
2360 prom_panic("Error: You can't boot a kdump kernel from OF!\n"); 2356 prom_panic("Error: You can't boot a kdump kernel from OF!\n");
2357#endif
2361 2358
2362 /* 2359 /*
2363 * Check for an initrd 2360 * Check for an initrd
@@ -2377,7 +2374,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2377 * Copy the CPU hold code 2374 * Copy the CPU hold code
2378 */ 2375 */
2379 if (RELOC(of_platform) != PLATFORM_POWERMAC) 2376 if (RELOC(of_platform) != PLATFORM_POWERMAC)
2380 copy_and_flush(0, KERNELBASE + offset, 0x100, 0); 2377 copy_and_flush(0, kbase, 0x100, 0);
2381 2378
2382 /* 2379 /*
2383 * Do early parsing of command line 2380 * Do early parsing of command line
@@ -2480,7 +2477,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2480 reloc_got2(-offset); 2477 reloc_got2(-offset);
2481#endif 2478#endif
2482 2479
2483 __start(hdr, KERNELBASE + offset, 0); 2480 __start(hdr, kbase, 0);
2484 2481
2485 return 0; 2482 return 0;
2486} 2483}
diff --git a/arch/powerpc/kernel/reloc_64.S b/arch/powerpc/kernel/reloc_64.S
new file mode 100644
index 000000000000..b47a0e1ab001
--- /dev/null
+++ b/arch/powerpc/kernel/reloc_64.S
@@ -0,0 +1,87 @@
1/*
2 * Code to process dynamic relocations in the kernel.
3 *
4 * Copyright 2008 Paul Mackerras, IBM Corp.
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
12#include <asm/ppc_asm.h>
13
14RELA = 7
15RELACOUNT = 0x6ffffff9
16R_PPC64_RELATIVE = 22
17
18/*
19 * r3 = desired final address of kernel
20 */
21_GLOBAL(relocate)
22 mflr r0
23 bcl 20,31,$+4
240: mflr r12 /* r12 has runtime addr of label 0 */
25 mtlr r0
26 ld r11,(p_dyn - 0b)(r12)
27 add r11,r11,r12 /* r11 has runtime addr of .dynamic section */
28 ld r9,(p_rela - 0b)(r12)
29 add r9,r9,r12 /* r9 has runtime addr of .rela.dyn section */
30 ld r10,(p_st - 0b)(r12)
31 add r10,r10,r12 /* r10 has runtime addr of _stext */
32
33 /*
34 * Scan the dynamic section for the RELA and RELACOUNT entries.
35 */
36 li r7,0
37 li r8,0
381: ld r6,0(r11) /* get tag */
39 cmpdi r6,0
40 beq 4f /* end of list */
41 cmpdi r6,RELA
42 bne 2f
43 ld r7,8(r11) /* get RELA pointer in r7 */
44 b 3f
452: addis r6,r6,(-RELACOUNT)@ha
46 cmpdi r6,RELACOUNT@l
47 bne 3f
48 ld r8,8(r11) /* get RELACOUNT value in r8 */
493: addi r11,r11,16
50 b 1b
514: cmpdi r7,0 /* check we have both RELA and RELACOUNT */
52 cmpdi cr1,r8,0
53 beq 6f
54 beq cr1,6f
55
56 /*
57 * Work out linktime address of _stext and hence the
58 * relocation offset to be applied.
59 * cur_offset [r7] = rela.run [r9] - rela.link [r7]
60 * _stext.link [r10] = _stext.run [r10] - cur_offset [r7]
61 * final_offset [r3] = _stext.final [r3] - _stext.link [r10]
62 */
63 subf r7,r7,r9 /* cur_offset */
64 subf r10,r7,r10
65 subf r3,r10,r3 /* final_offset */
66
67 /*
68 * Run through the list of relocations and process the
69 * R_PPC64_RELATIVE ones.
70 */
71 mtctr r8
725: lwz r0,12(9) /* ELF64_R_TYPE(reloc->r_info) */
73 cmpwi r0,R_PPC64_RELATIVE
74 bne 6f
75 ld r6,0(r9) /* reloc->r_offset */
76 ld r0,16(r9) /* reloc->r_addend */
77 add r0,r0,r3
78 stdx r0,r7,r6
79 addi r9,r9,24
80 bdnz 5b
81
826: blr
83
84p_dyn: .llong __dynamic_start - 0b
85p_rela: .llong __rela_dyn_start - 0b
86p_st: .llong _stext - 0b
87
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 9cc5a52711e5..5ec56ff03e86 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -254,8 +254,21 @@ static int show_cpuinfo(struct seq_file *m, void *v)
254 /* If we are a Freescale core do a simple check so 254 /* If we are a Freescale core do a simple check so
255 * we dont have to keep adding cases in the future */ 255 * we dont have to keep adding cases in the future */
256 if (PVR_VER(pvr) & 0x8000) { 256 if (PVR_VER(pvr) & 0x8000) {
257 maj = PVR_MAJ(pvr); 257 switch (PVR_VER(pvr)) {
258 min = PVR_MIN(pvr); 258 case 0x8000: /* 7441/7450/7451, Voyager */
259 case 0x8001: /* 7445/7455, Apollo 6 */
260 case 0x8002: /* 7447/7457, Apollo 7 */
261 case 0x8003: /* 7447A, Apollo 7 PM */
262 case 0x8004: /* 7448, Apollo 8 */
263 case 0x800c: /* 7410, Nitro */
264 maj = ((pvr >> 8) & 0xF);
265 min = PVR_MIN(pvr);
266 break;
267 default: /* e500/book-e */
268 maj = PVR_MAJ(pvr);
269 min = PVR_MIN(pvr);
270 break;
271 }
259 } else { 272 } else {
260 switch (PVR_VER(pvr)) { 273 switch (PVR_VER(pvr)) {
261 case 0x0020: /* 403 family */ 274 case 0x0020: /* 403 family */
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 066e65c59b58..c1a27626a940 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -111,7 +111,7 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
111 * This is called very early on the boot process, after a minimal 111 * This is called very early on the boot process, after a minimal
112 * MMU environment has been set up but before MMU_init is called. 112 * MMU environment has been set up but before MMU_init is called.
113 */ 113 */
114notrace void __init machine_init(unsigned long dt_ptr, unsigned long phys) 114notrace void __init machine_init(unsigned long dt_ptr)
115{ 115{
116 /* Enable early debugging if any specified (see udbg.h) */ 116 /* Enable early debugging if any specified (see udbg.h) */
117 udbg_early_init(); 117 udbg_early_init();
@@ -209,23 +209,12 @@ EXPORT_SYMBOL(nvram_sync);
209 209
210#endif /* CONFIG_NVRAM */ 210#endif /* CONFIG_NVRAM */
211 211
212static DEFINE_PER_CPU(struct cpu, cpu_devices);
213
214int __init ppc_init(void) 212int __init ppc_init(void)
215{ 213{
216 int cpu;
217
218 /* clear the progress line */ 214 /* clear the progress line */
219 if (ppc_md.progress) 215 if (ppc_md.progress)
220 ppc_md.progress(" ", 0xffff); 216 ppc_md.progress(" ", 0xffff);
221 217
222 /* register CPU devices */
223 for_each_possible_cpu(cpu) {
224 struct cpu *c = &per_cpu(cpu_devices, cpu);
225 c->hotpluggable = 1;
226 register_cpu(c, cpu);
227 }
228
229 /* call platform init */ 218 /* call platform init */
230 if (ppc_md.init != NULL) { 219 if (ppc_md.init != NULL) {
231 ppc_md.init(); 220 ppc_md.init();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 8b25f51f03bf..843c0af210d0 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -255,9 +255,11 @@ void early_setup_secondary(void)
255#endif /* CONFIG_SMP */ 255#endif /* CONFIG_SMP */
256 256
257#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) 257#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
258extern unsigned long __secondary_hold_spinloop;
259extern void generic_secondary_smp_init(void);
260
258void smp_release_cpus(void) 261void smp_release_cpus(void)
259{ 262{
260 extern unsigned long __secondary_hold_spinloop;
261 unsigned long *ptr; 263 unsigned long *ptr;
262 264
263 DBG(" -> smp_release_cpus()\n"); 265 DBG(" -> smp_release_cpus()\n");
@@ -266,12 +268,11 @@ void smp_release_cpus(void)
266 * all now so they can start to spin on their individual paca 268 * all now so they can start to spin on their individual paca
267 * spinloops. For non SMP kernels, the secondary cpus never get out 269 * spinloops. For non SMP kernels, the secondary cpus never get out
268 * of the common spinloop. 270 * of the common spinloop.
269 * This is useless but harmless on iSeries, secondaries are already 271 */
270 * waiting on their paca spinloops. */
271 272
272 ptr = (unsigned long *)((unsigned long)&__secondary_hold_spinloop 273 ptr = (unsigned long *)((unsigned long)&__secondary_hold_spinloop
273 - PHYSICAL_START); 274 - PHYSICAL_START);
274 *ptr = 1; 275 *ptr = __pa(generic_secondary_smp_init);
275 mb(); 276 mb();
276 277
277 DBG(" <- smp_release_cpus()\n"); 278 DBG(" <- smp_release_cpus()\n");
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 5337ca7bb649..ff9f7010097d 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -101,8 +101,7 @@ void smp_message_recv(int msg)
101 generic_smp_call_function_interrupt(); 101 generic_smp_call_function_interrupt();
102 break; 102 break;
103 case PPC_MSG_RESCHEDULE: 103 case PPC_MSG_RESCHEDULE:
104 /* XXX Do we have to do this? */ 104 /* we notice need_resched on exit */
105 set_need_resched();
106 break; 105 break;
107 case PPC_MSG_CALL_FUNC_SINGLE: 106 case PPC_MSG_CALL_FUNC_SINGLE:
108 generic_smp_call_function_single_interrupt(); 107 generic_smp_call_function_single_interrupt();
@@ -453,6 +452,7 @@ int __devinit start_secondary(void *unused)
453 secondary_cpu_time_init(); 452 secondary_cpu_time_init();
454 453
455 ipi_call_lock(); 454 ipi_call_lock();
455 notify_cpu_starting(cpu);
456 cpu_set(cpu, cpu_online_map); 456 cpu_set(cpu, cpu_online_map);
457 /* Update sibling maps */ 457 /* Update sibling maps */
458 base = cpu_first_thread_in_core(cpu); 458 base = cpu_first_thread_in_core(cpu);
diff --git a/arch/powerpc/kernel/softemu8xx.c b/arch/powerpc/kernel/softemu8xx.c
index c906c4bf6835..23c8c5e7dc4d 100644
--- a/arch/powerpc/kernel/softemu8xx.c
+++ b/arch/powerpc/kernel/softemu8xx.c
@@ -23,7 +23,6 @@
23#include <linux/ptrace.h> 23#include <linux/ptrace.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/user.h> 25#include <linux/user.h>
26#include <linux/a.out.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28 27
29#include <asm/pgtable.h> 28#include <asm/pgtable.h>
diff --git a/arch/powerpc/kernel/swsusp_asm64.S b/arch/powerpc/kernel/swsusp_asm64.S
index e092c3cbdb9b..86ac1d90d02b 100644
--- a/arch/powerpc/kernel/swsusp_asm64.S
+++ b/arch/powerpc/kernel/swsusp_asm64.S
@@ -133,7 +133,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
133 133
134 cmpdi r12,0 134 cmpdi r12,0
135 beq- nothing_to_copy 135 beq- nothing_to_copy
136 li r15,512 136 li r15,PAGE_SIZE>>3
137copyloop: 137copyloop:
138 ld r13,pbe_address(r12) 138 ld r13,pbe_address(r12)
139 ld r14,pbe_orig_address(r12) 139 ld r14,pbe_orig_address(r12)
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index d98634c76060..bb1cfcfdbbbb 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -61,42 +61,6 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x)); 61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x));
62} 62}
63 63
64int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
65{
66 compat_ino_t ino;
67 long err;
68
69 if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) ||
70 !new_valid_dev(stat->rdev))
71 return -EOVERFLOW;
72
73 ino = stat->ino;
74 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
75 return -EOVERFLOW;
76
77 err = access_ok(VERIFY_WRITE, statbuf, sizeof(*statbuf)) ? 0 : -EFAULT;
78 err |= __put_user(new_encode_dev(stat->dev), &statbuf->st_dev);
79 err |= __put_user(ino, &statbuf->st_ino);
80 err |= __put_user(stat->mode, &statbuf->st_mode);
81 err |= __put_user(stat->nlink, &statbuf->st_nlink);
82 err |= __put_user(stat->uid, &statbuf->st_uid);
83 err |= __put_user(stat->gid, &statbuf->st_gid);
84 err |= __put_user(new_encode_dev(stat->rdev), &statbuf->st_rdev);
85 err |= __put_user(stat->size, &statbuf->st_size);
86 err |= __put_user(stat->atime.tv_sec, &statbuf->st_atime);
87 err |= __put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
88 err |= __put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
89 err |= __put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
90 err |= __put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
91 err |= __put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
92 err |= __put_user(stat->blksize, &statbuf->st_blksize);
93 err |= __put_user(stat->blocks, &statbuf->st_blocks);
94 err |= __put_user(0, &statbuf->__unused4[0]);
95 err |= __put_user(0, &statbuf->__unused4[1]);
96
97 return err;
98}
99
100/* Note: it is necessary to treat option as an unsigned int, 64/* Note: it is necessary to treat option as an unsigned int,
101 * with the corresponding cast to a signed int to insure that the 65 * with the corresponding cast to a signed int to insure that the
102 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 66 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
@@ -107,77 +71,6 @@ asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
107 return sys_sysfs((int)option, arg1, arg2); 71 return sys_sysfs((int)option, arg1, arg2);
108} 72}
109 73
110asmlinkage long compat_sys_pause(void)
111{
112 current->state = TASK_INTERRUPTIBLE;
113 schedule();
114
115 return -ERESTARTNOHAND;
116}
117
118static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
119{
120 long usec;
121
122 if (!access_ok(VERIFY_READ, i, sizeof(*i)))
123 return -EFAULT;
124 if (__get_user(o->tv_sec, &i->tv_sec))
125 return -EFAULT;
126 if (__get_user(usec, &i->tv_usec))
127 return -EFAULT;
128 o->tv_nsec = usec * 1000;
129 return 0;
130}
131
132static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
133{
134 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
135 (__put_user(i->tv_sec, &o->tv_sec) |
136 __put_user(i->tv_usec, &o->tv_usec)));
137}
138
139
140
141
142/* Translations due to time_t size differences. Which affects all
143 sorts of things, like timeval and itimerval. */
144extern struct timezone sys_tz;
145
146asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
147{
148 if (tv) {
149 struct timeval ktv;
150 do_gettimeofday(&ktv);
151 if (put_tv32(tv, &ktv))
152 return -EFAULT;
153 }
154 if (tz) {
155 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
156 return -EFAULT;
157 }
158
159 return 0;
160}
161
162
163
164asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
165{
166 struct timespec kts;
167 struct timezone ktz;
168
169 if (tv) {
170 if (get_ts32(&kts, tv))
171 return -EFAULT;
172 }
173 if (tz) {
174 if (copy_from_user(&ktz, tz, sizeof(ktz)))
175 return -EFAULT;
176 }
177
178 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
179}
180
181#ifdef CONFIG_SYSVIPC 74#ifdef CONFIG_SYSVIPC
182long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, 75long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
183 u32 fifth) 76 u32 fifth)
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 56d172d16e56..86a2ffccef25 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -15,18 +15,24 @@
15#include <asm/firmware.h> 15#include <asm/firmware.h>
16#include <asm/hvcall.h> 16#include <asm/hvcall.h>
17#include <asm/prom.h> 17#include <asm/prom.h>
18#include <asm/paca.h>
19#include <asm/lppaca.h>
20#include <asm/machdep.h> 18#include <asm/machdep.h>
21#include <asm/smp.h> 19#include <asm/smp.h>
22 20
21#ifdef CONFIG_PPC64
22#include <asm/paca.h>
23#include <asm/lppaca.h>
24#endif
25
23static DEFINE_PER_CPU(struct cpu, cpu_devices); 26static DEFINE_PER_CPU(struct cpu, cpu_devices);
24 27
25static DEFINE_PER_CPU(struct kobject *, cache_toplevel); 28static DEFINE_PER_CPU(struct kobject *, cache_toplevel);
26 29
27/* SMT stuff */ 30/*
31 * SMT snooze delay stuff, 64-bit only for now
32 */
33
34#ifdef CONFIG_PPC64
28 35
29#ifdef CONFIG_PPC_MULTIPLATFORM
30/* Time in microseconds we delay before sleeping in the idle loop */ 36/* Time in microseconds we delay before sleeping in the idle loop */
31DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 }; 37DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 };
32 38
@@ -106,7 +112,7 @@ static int __init setup_smt_snooze_delay(char *str)
106} 112}
107__setup("smt-snooze-delay=", setup_smt_snooze_delay); 113__setup("smt-snooze-delay=", setup_smt_snooze_delay);
108 114
109#endif /* CONFIG_PPC_MULTIPLATFORM */ 115#endif /* CONFIG_PPC64 */
110 116
111/* 117/*
112 * Enabling PMCs will slow partition context switch times so we only do 118 * Enabling PMCs will slow partition context switch times so we only do
@@ -115,7 +121,7 @@ __setup("smt-snooze-delay=", setup_smt_snooze_delay);
115 121
116static DEFINE_PER_CPU(char, pmcs_enabled); 122static DEFINE_PER_CPU(char, pmcs_enabled);
117 123
118void ppc64_enable_pmcs(void) 124void ppc_enable_pmcs(void)
119{ 125{
120 /* Only need to enable them once */ 126 /* Only need to enable them once */
121 if (__get_cpu_var(pmcs_enabled)) 127 if (__get_cpu_var(pmcs_enabled))
@@ -126,8 +132,9 @@ void ppc64_enable_pmcs(void)
126 if (ppc_md.enable_pmcs) 132 if (ppc_md.enable_pmcs)
127 ppc_md.enable_pmcs(); 133 ppc_md.enable_pmcs();
128} 134}
129EXPORT_SYMBOL(ppc64_enable_pmcs); 135EXPORT_SYMBOL(ppc_enable_pmcs);
130 136
137#if defined(CONFIG_6xx) || defined(CONFIG_PPC64)
131/* XXX convert to rusty's on_one_cpu */ 138/* XXX convert to rusty's on_one_cpu */
132static unsigned long run_on_cpu(unsigned long cpu, 139static unsigned long run_on_cpu(unsigned long cpu,
133 unsigned long (*func)(unsigned long), 140 unsigned long (*func)(unsigned long),
@@ -146,6 +153,7 @@ static unsigned long run_on_cpu(unsigned long cpu,
146 153
147 return ret; 154 return ret;
148} 155}
156#endif
149 157
150#define SYSFS_PMCSETUP(NAME, ADDRESS) \ 158#define SYSFS_PMCSETUP(NAME, ADDRESS) \
151static unsigned long read_##NAME(unsigned long junk) \ 159static unsigned long read_##NAME(unsigned long junk) \
@@ -154,7 +162,7 @@ static unsigned long read_##NAME(unsigned long junk) \
154} \ 162} \
155static unsigned long write_##NAME(unsigned long val) \ 163static unsigned long write_##NAME(unsigned long val) \
156{ \ 164{ \
157 ppc64_enable_pmcs(); \ 165 ppc_enable_pmcs(); \
158 mtspr(ADDRESS, val); \ 166 mtspr(ADDRESS, val); \
159 return 0; \ 167 return 0; \
160} \ 168} \
@@ -184,28 +192,53 @@ static ssize_t __used \
184 * that are implemented on the current processor 192 * that are implemented on the current processor
185 */ 193 */
186 194
195#if defined(CONFIG_PPC64)
196#define HAS_PPC_PMC_CLASSIC 1
197#define HAS_PPC_PMC_IBM 1
198#define HAS_PPC_PMC_PA6T 1
199#elif defined(CONFIG_6xx)
200#define HAS_PPC_PMC_CLASSIC 1
201#define HAS_PPC_PMC_IBM 1
202#define HAS_PPC_PMC_G4 1
203#endif
204
205
206#ifdef HAS_PPC_PMC_CLASSIC
187SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0); 207SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0);
188SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1); 208SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1);
189SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
190SYSFS_PMCSETUP(pmc1, SPRN_PMC1); 209SYSFS_PMCSETUP(pmc1, SPRN_PMC1);
191SYSFS_PMCSETUP(pmc2, SPRN_PMC2); 210SYSFS_PMCSETUP(pmc2, SPRN_PMC2);
192SYSFS_PMCSETUP(pmc3, SPRN_PMC3); 211SYSFS_PMCSETUP(pmc3, SPRN_PMC3);
193SYSFS_PMCSETUP(pmc4, SPRN_PMC4); 212SYSFS_PMCSETUP(pmc4, SPRN_PMC4);
194SYSFS_PMCSETUP(pmc5, SPRN_PMC5); 213SYSFS_PMCSETUP(pmc5, SPRN_PMC5);
195SYSFS_PMCSETUP(pmc6, SPRN_PMC6); 214SYSFS_PMCSETUP(pmc6, SPRN_PMC6);
215
216#ifdef HAS_PPC_PMC_G4
217SYSFS_PMCSETUP(mmcr2, SPRN_MMCR2);
218#endif
219
220#ifdef CONFIG_PPC64
196SYSFS_PMCSETUP(pmc7, SPRN_PMC7); 221SYSFS_PMCSETUP(pmc7, SPRN_PMC7);
197SYSFS_PMCSETUP(pmc8, SPRN_PMC8); 222SYSFS_PMCSETUP(pmc8, SPRN_PMC8);
223
224SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
198SYSFS_PMCSETUP(purr, SPRN_PURR); 225SYSFS_PMCSETUP(purr, SPRN_PURR);
199SYSFS_PMCSETUP(spurr, SPRN_SPURR); 226SYSFS_PMCSETUP(spurr, SPRN_SPURR);
200SYSFS_PMCSETUP(dscr, SPRN_DSCR); 227SYSFS_PMCSETUP(dscr, SPRN_DSCR);
201 228
229static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
230static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL);
231static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr);
232static SYSDEV_ATTR(purr, 0600, show_purr, store_purr);
233#endif /* CONFIG_PPC64 */
234
235#ifdef HAS_PPC_PMC_PA6T
202SYSFS_PMCSETUP(pa6t_pmc0, SPRN_PA6T_PMC0); 236SYSFS_PMCSETUP(pa6t_pmc0, SPRN_PA6T_PMC0);
203SYSFS_PMCSETUP(pa6t_pmc1, SPRN_PA6T_PMC1); 237SYSFS_PMCSETUP(pa6t_pmc1, SPRN_PA6T_PMC1);
204SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2); 238SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2);
205SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3); 239SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
206SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4); 240SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
207SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5); 241SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
208
209#ifdef CONFIG_DEBUG_KERNEL 242#ifdef CONFIG_DEBUG_KERNEL
210SYSFS_PMCSETUP(hid0, SPRN_HID0); 243SYSFS_PMCSETUP(hid0, SPRN_HID0);
211SYSFS_PMCSETUP(hid1, SPRN_HID1); 244SYSFS_PMCSETUP(hid1, SPRN_HID1);
@@ -236,28 +269,37 @@ SYSFS_PMCSETUP(tsr1, SPRN_PA6T_TSR1);
236SYSFS_PMCSETUP(tsr2, SPRN_PA6T_TSR2); 269SYSFS_PMCSETUP(tsr2, SPRN_PA6T_TSR2);
237SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3); 270SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3);
238#endif /* CONFIG_DEBUG_KERNEL */ 271#endif /* CONFIG_DEBUG_KERNEL */
272#endif /* HAS_PPC_PMC_PA6T */
239 273
240static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 274#ifdef HAS_PPC_PMC_IBM
241static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL);
242static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr);
243static SYSDEV_ATTR(purr, 0600, show_purr, store_purr);
244
245static struct sysdev_attribute ibm_common_attrs[] = { 275static struct sysdev_attribute ibm_common_attrs[] = {
246 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 276 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
247 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 277 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
248}; 278};
279#endif /* HAS_PPC_PMC_G4 */
280
281#ifdef HAS_PPC_PMC_G4
282static struct sysdev_attribute g4_common_attrs[] = {
283 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
284 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
285 _SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2),
286};
287#endif /* HAS_PPC_PMC_G4 */
249 288
250static struct sysdev_attribute ibm_pmc_attrs[] = { 289static struct sysdev_attribute classic_pmc_attrs[] = {
251 _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), 290 _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1),
252 _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), 291 _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2),
253 _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), 292 _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3),
254 _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), 293 _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4),
255 _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), 294 _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5),
256 _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), 295 _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6),
296#ifdef CONFIG_PPC64
257 _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), 297 _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7),
258 _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), 298 _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8),
299#endif
259}; 300};
260 301
302#ifdef HAS_PPC_PMC_PA6T
261static struct sysdev_attribute pa6t_attrs[] = { 303static struct sysdev_attribute pa6t_attrs[] = {
262 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 304 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
263 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 305 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
@@ -298,6 +340,8 @@ static struct sysdev_attribute pa6t_attrs[] = {
298 _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), 340 _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3),
299#endif /* CONFIG_DEBUG_KERNEL */ 341#endif /* CONFIG_DEBUG_KERNEL */
300}; 342};
343#endif /* HAS_PPC_PMC_PA6T */
344#endif /* HAS_PPC_PMC_CLASSIC */
301 345
302struct cache_desc { 346struct cache_desc {
303 struct kobject kobj; 347 struct kobject kobj;
@@ -588,23 +632,36 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
588 struct sysdev_attribute *attrs, *pmc_attrs; 632 struct sysdev_attribute *attrs, *pmc_attrs;
589 int i, nattrs; 633 int i, nattrs;
590 634
635#ifdef CONFIG_PPC64
591 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 636 if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
592 cpu_has_feature(CPU_FTR_SMT)) 637 cpu_has_feature(CPU_FTR_SMT))
593 sysdev_create_file(s, &attr_smt_snooze_delay); 638 sysdev_create_file(s, &attr_smt_snooze_delay);
639#endif
594 640
595 /* PMC stuff */ 641 /* PMC stuff */
596 switch (cur_cpu_spec->pmc_type) { 642 switch (cur_cpu_spec->pmc_type) {
643#ifdef HAS_PPC_PMC_IBM
597 case PPC_PMC_IBM: 644 case PPC_PMC_IBM:
598 attrs = ibm_common_attrs; 645 attrs = ibm_common_attrs;
599 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 646 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute);
600 pmc_attrs = ibm_pmc_attrs; 647 pmc_attrs = classic_pmc_attrs;
601 break; 648 break;
649#endif /* HAS_PPC_PMC_IBM */
650#ifdef HAS_PPC_PMC_G4
651 case PPC_PMC_G4:
652 attrs = g4_common_attrs;
653 nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute);
654 pmc_attrs = classic_pmc_attrs;
655 break;
656#endif /* HAS_PPC_PMC_G4 */
657#ifdef HAS_PPC_PMC_PA6T
602 case PPC_PMC_PA6T: 658 case PPC_PMC_PA6T:
603 /* PA Semi starts counting at PMC0 */ 659 /* PA Semi starts counting at PMC0 */
604 attrs = pa6t_attrs; 660 attrs = pa6t_attrs;
605 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 661 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute);
606 pmc_attrs = NULL; 662 pmc_attrs = NULL;
607 break; 663 break;
664#endif /* HAS_PPC_PMC_PA6T */
608 default: 665 default:
609 attrs = NULL; 666 attrs = NULL;
610 nattrs = 0; 667 nattrs = 0;
@@ -618,6 +675,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
618 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 675 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
619 sysdev_create_file(s, &pmc_attrs[i]); 676 sysdev_create_file(s, &pmc_attrs[i]);
620 677
678#ifdef CONFIG_PPC64
621 if (cpu_has_feature(CPU_FTR_MMCRA)) 679 if (cpu_has_feature(CPU_FTR_MMCRA))
622 sysdev_create_file(s, &attr_mmcra); 680 sysdev_create_file(s, &attr_mmcra);
623 681
@@ -629,6 +687,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
629 687
630 if (cpu_has_feature(CPU_FTR_DSCR)) 688 if (cpu_has_feature(CPU_FTR_DSCR))
631 sysdev_create_file(s, &attr_dscr); 689 sysdev_create_file(s, &attr_dscr);
690#endif /* CONFIG_PPC64 */
632 691
633 create_cache_info(s); 692 create_cache_info(s);
634} 693}
@@ -641,16 +700,9 @@ static void remove_cache_info(struct sys_device *sysdev)
641 int cpu = sysdev->id; 700 int cpu = sysdev->id;
642 701
643 cache_desc = per_cpu(cache_desc, cpu); 702 cache_desc = per_cpu(cache_desc, cpu);
644 if (cache_desc != NULL) { 703 if (cache_desc != NULL)
645 sysfs_remove_file(&cache_desc->kobj, &cache_size_attr.attr);
646 sysfs_remove_file(&cache_desc->kobj, &cache_line_size_attr.attr);
647 sysfs_remove_file(&cache_desc->kobj, &cache_type_attr.attr);
648 sysfs_remove_file(&cache_desc->kobj, &cache_level_attr.attr);
649 sysfs_remove_file(&cache_desc->kobj, &cache_nr_sets_attr.attr);
650 sysfs_remove_file(&cache_desc->kobj, &cache_assoc_attr.attr);
651
652 kobject_put(&cache_desc->kobj); 704 kobject_put(&cache_desc->kobj);
653 } 705
654 cache_toplevel = per_cpu(cache_toplevel, cpu); 706 cache_toplevel = per_cpu(cache_toplevel, cpu);
655 if (cache_toplevel != NULL) 707 if (cache_toplevel != NULL)
656 kobject_put(cache_toplevel); 708 kobject_put(cache_toplevel);
@@ -671,17 +723,28 @@ static void unregister_cpu_online(unsigned int cpu)
671 723
672 /* PMC stuff */ 724 /* PMC stuff */
673 switch (cur_cpu_spec->pmc_type) { 725 switch (cur_cpu_spec->pmc_type) {
726#ifdef HAS_PPC_PMC_IBM
674 case PPC_PMC_IBM: 727 case PPC_PMC_IBM:
675 attrs = ibm_common_attrs; 728 attrs = ibm_common_attrs;
676 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 729 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute);
677 pmc_attrs = ibm_pmc_attrs; 730 pmc_attrs = classic_pmc_attrs;
731 break;
732#endif /* HAS_PPC_PMC_IBM */
733#ifdef HAS_PPC_PMC_G4
734 case PPC_PMC_G4:
735 attrs = g4_common_attrs;
736 nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute);
737 pmc_attrs = classic_pmc_attrs;
678 break; 738 break;
739#endif /* HAS_PPC_PMC_G4 */
740#ifdef HAS_PPC_PMC_PA6T
679 case PPC_PMC_PA6T: 741 case PPC_PMC_PA6T:
680 /* PA Semi starts counting at PMC0 */ 742 /* PA Semi starts counting at PMC0 */
681 attrs = pa6t_attrs; 743 attrs = pa6t_attrs;
682 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 744 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute);
683 pmc_attrs = NULL; 745 pmc_attrs = NULL;
684 break; 746 break;
747#endif /* HAS_PPC_PMC_PA6T */
685 default: 748 default:
686 attrs = NULL; 749 attrs = NULL;
687 nattrs = 0; 750 nattrs = 0;
@@ -695,6 +758,7 @@ static void unregister_cpu_online(unsigned int cpu)
695 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 758 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
696 sysdev_remove_file(s, &pmc_attrs[i]); 759 sysdev_remove_file(s, &pmc_attrs[i]);
697 760
761#ifdef CONFIG_PPC64
698 if (cpu_has_feature(CPU_FTR_MMCRA)) 762 if (cpu_has_feature(CPU_FTR_MMCRA))
699 sysdev_remove_file(s, &attr_mmcra); 763 sysdev_remove_file(s, &attr_mmcra);
700 764
@@ -706,6 +770,7 @@ static void unregister_cpu_online(unsigned int cpu)
706 770
707 if (cpu_has_feature(CPU_FTR_DSCR)) 771 if (cpu_has_feature(CPU_FTR_DSCR))
708 sysdev_remove_file(s, &attr_dscr); 772 sysdev_remove_file(s, &attr_dscr);
773#endif /* CONFIG_PPC64 */
709 774
710 remove_cache_info(s); 775 remove_cache_info(s);
711} 776}
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 81ccb8dd1a54..f5def6cf5cd6 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -23,7 +23,6 @@
23#include <linux/ptrace.h> 23#include <linux/ptrace.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/user.h> 25#include <linux/user.h>
26#include <linux/a.out.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/module.h> 28#include <linux/module.h>
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 2750fbab1975..434c92a85c03 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1232,7 +1232,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
1232 else 1232 else
1233 viodev->dev.archdata.dma_ops = &dma_iommu_ops; 1233 viodev->dev.archdata.dma_ops = &dma_iommu_ops;
1234 viodev->dev.archdata.dma_data = vio_build_iommu_table(viodev); 1234 viodev->dev.archdata.dma_data = vio_build_iommu_table(viodev);
1235 viodev->dev.archdata.numa_node = of_node_to_nid(of_node); 1235 set_dev_node(&viodev->dev, of_node_to_nid(of_node));
1236 1236
1237 /* init generic 'struct device' fields: */ 1237 /* init generic 'struct device' fields: */
1238 viodev->dev.parent = &vio_bus_device.dev; 1238 viodev->dev.parent = &vio_bus_device.dev;
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 9f6c1ca1739e..b39c27ed7919 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -187,6 +187,24 @@ SECTIONS
187 *(.machine.desc) 187 *(.machine.desc)
188 __machine_desc_end = . ; 188 __machine_desc_end = . ;
189 } 189 }
190 . = ALIGN(8);
191 .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET) { *(.dynsym) }
192 .dynstr : AT(ADDR(.dynstr) - LOAD_OFFSET) { *(.dynstr) }
193 .dynamic : AT(ADDR(.dynamic) - LOAD_OFFSET)
194 {
195 __dynamic_start = .;
196 *(.dynamic)
197 }
198 .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
199 .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
200 .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
201 {
202 __rela_dyn_start = .;
203 *(.rela*)
204 }
205
206 /* Fake ELF header containing RPA note; for addnote */
207 .fakeelf : AT(ADDR(.fakeelf) - LOAD_OFFSET) { *(.fakeelf) }
190 208
191 /* freed after init ends here */ 209 /* freed after init ends here */
192 . = ALIGN(PAGE_SIZE); 210 . = ALIGN(PAGE_SIZE);
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
index 5a5602da5091..2e227a412bc2 100644
--- a/arch/powerpc/kvm/44x_tlb.c
+++ b/arch/powerpc/kvm/44x_tlb.c
@@ -19,6 +19,7 @@
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/kvm.h>
22#include <linux/kvm_host.h> 23#include <linux/kvm_host.h>
23#include <linux/highmem.h> 24#include <linux/highmem.h>
24#include <asm/mmu-44x.h> 25#include <asm/mmu-44x.h>
@@ -109,7 +110,6 @@ static int kvmppc_44x_tlbe_is_writable(struct tlbe *tlbe)
109 return tlbe->word2 & (PPC44x_TLB_SW|PPC44x_TLB_UW); 110 return tlbe->word2 & (PPC44x_TLB_SW|PPC44x_TLB_UW);
110} 111}
111 112
112/* Must be called with mmap_sem locked for writing. */
113static void kvmppc_44x_shadow_release(struct kvm_vcpu *vcpu, 113static void kvmppc_44x_shadow_release(struct kvm_vcpu *vcpu,
114 unsigned int index) 114 unsigned int index)
115{ 115{
@@ -124,6 +124,11 @@ static void kvmppc_44x_shadow_release(struct kvm_vcpu *vcpu,
124 } 124 }
125} 125}
126 126
127void kvmppc_tlbe_set_modified(struct kvm_vcpu *vcpu, unsigned int i)
128{
129 vcpu->arch.shadow_tlb_mod[i] = 1;
130}
131
127/* Caller must ensure that the specified guest TLB entry is safe to insert into 132/* Caller must ensure that the specified guest TLB entry is safe to insert into
128 * the shadow TLB. */ 133 * the shadow TLB. */
129void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid, 134void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid,
@@ -142,19 +147,16 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid,
142 stlbe = &vcpu->arch.shadow_tlb[victim]; 147 stlbe = &vcpu->arch.shadow_tlb[victim];
143 148
144 /* Get reference to new page. */ 149 /* Get reference to new page. */
145 down_read(&current->mm->mmap_sem);
146 new_page = gfn_to_page(vcpu->kvm, gfn); 150 new_page = gfn_to_page(vcpu->kvm, gfn);
147 if (is_error_page(new_page)) { 151 if (is_error_page(new_page)) {
148 printk(KERN_ERR "Couldn't get guest page for gfn %lx!\n", gfn); 152 printk(KERN_ERR "Couldn't get guest page for gfn %lx!\n", gfn);
149 kvm_release_page_clean(new_page); 153 kvm_release_page_clean(new_page);
150 up_read(&current->mm->mmap_sem);
151 return; 154 return;
152 } 155 }
153 hpaddr = page_to_phys(new_page); 156 hpaddr = page_to_phys(new_page);
154 157
155 /* Drop reference to old page. */ 158 /* Drop reference to old page. */
156 kvmppc_44x_shadow_release(vcpu, victim); 159 kvmppc_44x_shadow_release(vcpu, victim);
157 up_read(&current->mm->mmap_sem);
158 160
159 vcpu->arch.shadow_pages[victim] = new_page; 161 vcpu->arch.shadow_pages[victim] = new_page;
160 162
@@ -164,27 +166,30 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid,
164 166
165 /* XXX what about AS? */ 167 /* XXX what about AS? */
166 168
167 stlbe->tid = asid & 0xff; 169 stlbe->tid = !(asid & 0xff);
168 170
169 /* Force TS=1 for all guest mappings. */ 171 /* Force TS=1 for all guest mappings. */
170 /* For now we hardcode 4KB mappings, but it will be important to 172 /* For now we hardcode 4KB mappings, but it will be important to
171 * use host large pages in the future. */ 173 * use host large pages in the future. */
172 stlbe->word0 = (gvaddr & PAGE_MASK) | PPC44x_TLB_VALID | PPC44x_TLB_TS 174 stlbe->word0 = (gvaddr & PAGE_MASK) | PPC44x_TLB_VALID | PPC44x_TLB_TS
173 | PPC44x_TLB_4K; 175 | PPC44x_TLB_4K;
174
175 stlbe->word1 = (hpaddr & 0xfffffc00) | ((hpaddr >> 32) & 0xf); 176 stlbe->word1 = (hpaddr & 0xfffffc00) | ((hpaddr >> 32) & 0xf);
176 stlbe->word2 = kvmppc_44x_tlb_shadow_attrib(flags, 177 stlbe->word2 = kvmppc_44x_tlb_shadow_attrib(flags,
177 vcpu->arch.msr & MSR_PR); 178 vcpu->arch.msr & MSR_PR);
179 kvmppc_tlbe_set_modified(vcpu, victim);
180
181 KVMTRACE_5D(STLB_WRITE, vcpu, victim,
182 stlbe->tid, stlbe->word0, stlbe->word1, stlbe->word2,
183 handler);
178} 184}
179 185
180void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr, 186void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr,
181 gva_t eend, u32 asid) 187 gva_t eend, u32 asid)
182{ 188{
183 unsigned int pid = asid & 0xff; 189 unsigned int pid = !(asid & 0xff);
184 int i; 190 int i;
185 191
186 /* XXX Replace loop with fancy data structures. */ 192 /* XXX Replace loop with fancy data structures. */
187 down_write(&current->mm->mmap_sem);
188 for (i = 0; i <= tlb_44x_hwater; i++) { 193 for (i = 0; i <= tlb_44x_hwater; i++) {
189 struct tlbe *stlbe = &vcpu->arch.shadow_tlb[i]; 194 struct tlbe *stlbe = &vcpu->arch.shadow_tlb[i];
190 unsigned int tid; 195 unsigned int tid;
@@ -204,21 +209,35 @@ void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr,
204 209
205 kvmppc_44x_shadow_release(vcpu, i); 210 kvmppc_44x_shadow_release(vcpu, i);
206 stlbe->word0 = 0; 211 stlbe->word0 = 0;
212 kvmppc_tlbe_set_modified(vcpu, i);
213 KVMTRACE_5D(STLB_INVAL, vcpu, i,
214 stlbe->tid, stlbe->word0, stlbe->word1,
215 stlbe->word2, handler);
207 } 216 }
208 up_write(&current->mm->mmap_sem);
209} 217}
210 218
211/* Invalidate all mappings, so that when they fault back in they will get the 219/* Invalidate all mappings on the privilege switch after PID has been changed.
212 * proper permission bits. */ 220 * The guest always runs with PID=1, so we must clear the entire TLB when
221 * switching address spaces. */
213void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode) 222void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode)
214{ 223{
215 int i; 224 int i;
216 225
217 /* XXX Replace loop with fancy data structures. */ 226 if (vcpu->arch.swap_pid) {
218 down_write(&current->mm->mmap_sem); 227 /* XXX Replace loop with fancy data structures. */
219 for (i = 0; i <= tlb_44x_hwater; i++) { 228 for (i = 0; i <= tlb_44x_hwater; i++) {
220 kvmppc_44x_shadow_release(vcpu, i); 229 struct tlbe *stlbe = &vcpu->arch.shadow_tlb[i];
221 vcpu->arch.shadow_tlb[i].word0 = 0; 230
231 /* Future optimization: clear only userspace mappings. */
232 kvmppc_44x_shadow_release(vcpu, i);
233 stlbe->word0 = 0;
234 kvmppc_tlbe_set_modified(vcpu, i);
235 KVMTRACE_5D(STLB_INVAL, vcpu, i,
236 stlbe->tid, stlbe->word0, stlbe->word1,
237 stlbe->word2, handler);
238 }
239 vcpu->arch.swap_pid = 0;
222 } 240 }
223 up_write(&current->mm->mmap_sem); 241
242 vcpu->arch.shadow_pid = !usermode;
224} 243}
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index 6b076010213b..53aaa66b25e5 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -37,6 +37,17 @@ config KVM_BOOKE_HOST
37 Provides host support for KVM on Book E PowerPC processors. Currently 37 Provides host support for KVM on Book E PowerPC processors. Currently
38 this works on 440 processors only. 38 this works on 440 processors only.
39 39
40config KVM_TRACE
41 bool "KVM trace support"
42 depends on KVM && MARKERS && SYSFS
43 select RELAY
44 select DEBUG_FS
45 default n
46 ---help---
47 This option allows reading a trace of kvm-related events through
48 relayfs. Note the ABI is not considered stable and will be
49 modified in future updates.
50
40source drivers/virtio/Kconfig 51source drivers/virtio/Kconfig
41 52
42endif # VIRTUALIZATION 53endif # VIRTUALIZATION
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index 04e3449e1f42..2a5d4397ac4b 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -4,9 +4,11 @@
4 4
5EXTRA_CFLAGS += -Ivirt/kvm -Iarch/powerpc/kvm 5EXTRA_CFLAGS += -Ivirt/kvm -Iarch/powerpc/kvm
6 6
7common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o) 7common-objs-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o)
8 8
9kvm-objs := $(common-objs) powerpc.o emulate.o booke_guest.o 9common-objs-$(CONFIG_KVM_TRACE) += $(addprefix ../../../virt/kvm/, kvm_trace.o)
10
11kvm-objs := $(common-objs-y) powerpc.o emulate.o booke_guest.o
10obj-$(CONFIG_KVM) += kvm.o 12obj-$(CONFIG_KVM) += kvm.o
11 13
12AFLAGS_booke_interrupts.o := -I$(obj) 14AFLAGS_booke_interrupts.o := -I$(obj)
diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c
index 9c8ad850c6e3..7b2591e26bae 100644
--- a/arch/powerpc/kvm/booke_guest.c
+++ b/arch/powerpc/kvm/booke_guest.c
@@ -410,6 +410,21 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
410 break; 410 break;
411 } 411 }
412 412
413 case BOOKE_INTERRUPT_DEBUG: {
414 u32 dbsr;
415
416 vcpu->arch.pc = mfspr(SPRN_CSRR0);
417
418 /* clear IAC events in DBSR register */
419 dbsr = mfspr(SPRN_DBSR);
420 dbsr &= DBSR_IAC1 | DBSR_IAC2 | DBSR_IAC3 | DBSR_IAC4;
421 mtspr(SPRN_DBSR, dbsr);
422
423 run->exit_reason = KVM_EXIT_DEBUG;
424 r = RESUME_HOST;
425 break;
426 }
427
413 default: 428 default:
414 printk(KERN_EMERG "exit_nr %d\n", exit_nr); 429 printk(KERN_EMERG "exit_nr %d\n", exit_nr);
415 BUG(); 430 BUG();
@@ -471,6 +486,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
471 vcpu->arch.msr = 0; 486 vcpu->arch.msr = 0;
472 vcpu->arch.gpr[1] = (16<<20) - 8; /* -8 for the callee-save LR slot */ 487 vcpu->arch.gpr[1] = (16<<20) - 8; /* -8 for the callee-save LR slot */
473 488
489 vcpu->arch.shadow_pid = 1;
490
474 /* Eye-catching number so we know if the guest takes an interrupt 491 /* Eye-catching number so we know if the guest takes an interrupt
475 * before it's programmed its own IVPR. */ 492 * before it's programmed its own IVPR. */
476 vcpu->arch.ivpr = 0x55550000; 493 vcpu->arch.ivpr = 0x55550000;
diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
index 3b653b5309b8..95e165baf85f 100644
--- a/arch/powerpc/kvm/booke_interrupts.S
+++ b/arch/powerpc/kvm/booke_interrupts.S
@@ -42,7 +42,8 @@
42#define HOST_STACK_LR (HOST_STACK_SIZE + 4) /* In caller stack frame. */ 42#define HOST_STACK_LR (HOST_STACK_SIZE + 4) /* In caller stack frame. */
43 43
44#define NEED_INST_MASK ((1<<BOOKE_INTERRUPT_PROGRAM) | \ 44#define NEED_INST_MASK ((1<<BOOKE_INTERRUPT_PROGRAM) | \
45 (1<<BOOKE_INTERRUPT_DTLB_MISS)) 45 (1<<BOOKE_INTERRUPT_DTLB_MISS) | \
46 (1<<BOOKE_INTERRUPT_DEBUG))
46 47
47#define NEED_DEAR_MASK ((1<<BOOKE_INTERRUPT_DATA_STORAGE) | \ 48#define NEED_DEAR_MASK ((1<<BOOKE_INTERRUPT_DATA_STORAGE) | \
48 (1<<BOOKE_INTERRUPT_DTLB_MISS)) 49 (1<<BOOKE_INTERRUPT_DTLB_MISS))
@@ -331,51 +332,57 @@ lightweight_exit:
331 332
332 mfspr r3, SPRN_PID 333 mfspr r3, SPRN_PID
333 stw r3, VCPU_HOST_PID(r4) 334 stw r3, VCPU_HOST_PID(r4)
334 lwz r3, VCPU_PID(r4) 335 lwz r3, VCPU_SHADOW_PID(r4)
335 mtspr SPRN_PID, r3 336 mtspr SPRN_PID, r3
336 337
337 /* Prevent all TLB updates. */ 338 /* Prevent all asynchronous TLB updates. */
338 mfmsr r5 339 mfmsr r5
339 lis r6, (MSR_EE|MSR_CE|MSR_ME|MSR_DE)@h 340 lis r6, (MSR_EE|MSR_CE|MSR_ME|MSR_DE)@h
340 ori r6, r6, (MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l 341 ori r6, r6, (MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
341 andc r6, r5, r6 342 andc r6, r5, r6
342 mtmsr r6 343 mtmsr r6
343 344
344 /* Save the host's non-pinned TLB mappings, and load the guest mappings 345 /* Load the guest mappings, leaving the host's "pinned" kernel mappings
345 * over them. Leave the host's "pinned" kernel mappings in place. */ 346 * in place. */
346 /* XXX optimization: use generation count to avoid swapping unmodified
347 * entries. */
348 mfspr r10, SPRN_MMUCR /* Save host MMUCR. */ 347 mfspr r10, SPRN_MMUCR /* Save host MMUCR. */
349 lis r8, tlb_44x_hwater@ha 348 li r5, PPC44x_TLB_SIZE
350 lwz r8, tlb_44x_hwater@l(r8) 349 lis r5, tlb_44x_hwater@ha
351 addi r3, r4, VCPU_HOST_TLB - 4 350 lwz r5, tlb_44x_hwater@l(r5)
352 addi r9, r4, VCPU_SHADOW_TLB - 4 351 mtctr r5
353 li r6, 0 352 addi r9, r4, VCPU_SHADOW_TLB
353 addi r5, r4, VCPU_SHADOW_MOD
354 li r3, 0
3541: 3551:
355 /* Save host entry. */ 356 lbzx r7, r3, r5
356 tlbre r7, r6, PPC44x_TLB_PAGEID 357 cmpwi r7, 0
357 mfspr r5, SPRN_MMUCR 358 beq 3f
358 stwu r5, 4(r3) 359
359 stwu r7, 4(r3)
360 tlbre r7, r6, PPC44x_TLB_XLAT
361 stwu r7, 4(r3)
362 tlbre r7, r6, PPC44x_TLB_ATTRIB
363 stwu r7, 4(r3)
364 /* Load guest entry. */ 360 /* Load guest entry. */
365 lwzu r7, 4(r9) 361 mulli r11, r3, TLBE_BYTES
362 add r11, r11, r9
363 lwz r7, 0(r11)
366 mtspr SPRN_MMUCR, r7 364 mtspr SPRN_MMUCR, r7
367 lwzu r7, 4(r9) 365 lwz r7, 4(r11)
368 tlbwe r7, r6, PPC44x_TLB_PAGEID 366 tlbwe r7, r3, PPC44x_TLB_PAGEID
369 lwzu r7, 4(r9) 367 lwz r7, 8(r11)
370 tlbwe r7, r6, PPC44x_TLB_XLAT 368 tlbwe r7, r3, PPC44x_TLB_XLAT
371 lwzu r7, 4(r9) 369 lwz r7, 12(r11)
372 tlbwe r7, r6, PPC44x_TLB_ATTRIB 370 tlbwe r7, r3, PPC44x_TLB_ATTRIB
373 /* Increment index. */ 3713:
374 addi r6, r6, 1 372 addi r3, r3, 1 /* Increment index. */
375 cmpw r6, r8 373 bdnz 1b
376 blt 1b 374
377 mtspr SPRN_MMUCR, r10 /* Restore host MMUCR. */ 375 mtspr SPRN_MMUCR, r10 /* Restore host MMUCR. */
378 376
377 /* Clear bitmap of modified TLB entries */
378 li r5, PPC44x_TLB_SIZE>>2
379 mtctr r5
380 addi r5, r4, VCPU_SHADOW_MOD - 4
381 li r6, 0
3821:
383 stwu r6, 4(r5)
384 bdnz 1b
385
379 iccci 0, 0 /* XXX hack */ 386 iccci 0, 0 /* XXX hack */
380 387
381 /* Load some guest volatiles. */ 388 /* Load some guest volatiles. */
@@ -431,6 +438,14 @@ lightweight_exit:
431 oris r3, r3, KVMPPC_MSR_MASK@h 438 oris r3, r3, KVMPPC_MSR_MASK@h
432 ori r3, r3, KVMPPC_MSR_MASK@l 439 ori r3, r3, KVMPPC_MSR_MASK@l
433 mtsrr1 r3 440 mtsrr1 r3
441
442 /* Clear any debug events which occurred since we disabled MSR[DE].
443 * XXX This gives us a 3-instruction window in which a breakpoint
444 * intended for guest context could fire in the host instead. */
445 lis r3, 0xffff
446 ori r3, r3, 0xffff
447 mtspr SPRN_DBSR, r3
448
434 lwz r3, VCPU_GPR(r3)(r4) 449 lwz r3, VCPU_GPR(r3)(r4)
435 lwz r4, VCPU_GPR(r4)(r4) 450 lwz r4, VCPU_GPR(r4)(r4)
436 rfi 451 rfi
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 8c605d0a5488..0fce4fbdc20d 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -170,6 +170,10 @@ static int kvmppc_emul_tlbwe(struct kvm_vcpu *vcpu, u32 inst)
170 kvmppc_mmu_map(vcpu, eaddr, raddr >> PAGE_SHIFT, asid, flags); 170 kvmppc_mmu_map(vcpu, eaddr, raddr >> PAGE_SHIFT, asid, flags);
171 } 171 }
172 172
173 KVMTRACE_5D(GTLB_WRITE, vcpu, index,
174 tlbe->tid, tlbe->word0, tlbe->word1, tlbe->word2,
175 handler);
176
173 return EMULATE_DONE; 177 return EMULATE_DONE;
174} 178}
175 179
@@ -504,7 +508,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
504 case SPRN_MMUCR: 508 case SPRN_MMUCR:
505 vcpu->arch.mmucr = vcpu->arch.gpr[rs]; break; 509 vcpu->arch.mmucr = vcpu->arch.gpr[rs]; break;
506 case SPRN_PID: 510 case SPRN_PID:
507 vcpu->arch.pid = vcpu->arch.gpr[rs]; break; 511 kvmppc_set_pid(vcpu, vcpu->arch.gpr[rs]); break;
508 case SPRN_CCR0: 512 case SPRN_CCR0:
509 vcpu->arch.ccr0 = vcpu->arch.gpr[rs]; break; 513 vcpu->arch.ccr0 = vcpu->arch.gpr[rs]; break;
510 case SPRN_CCR1: 514 case SPRN_CCR1:
@@ -765,6 +769,8 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
765 break; 769 break;
766 } 770 }
767 771
772 KVMTRACE_3D(PPC_INSTR, vcpu, inst, vcpu->arch.pc, emulated, entryexit);
773
768 if (advance) 774 if (advance)
769 vcpu->arch.pc += 4; /* Advance past emulated instruction. */ 775 vcpu->arch.pc += 4; /* Advance past emulated instruction. */
770 776
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 53826a5f6c06..90a6fc422b23 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -27,6 +27,7 @@
27#include <asm/cputable.h> 27#include <asm/cputable.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/kvm_ppc.h> 29#include <asm/kvm_ppc.h>
30#include <asm/tlbflush.h>
30 31
31 32
32gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) 33gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
@@ -239,18 +240,114 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
239{ 240{
240} 241}
241 242
243/* Note: clearing MSR[DE] just means that the debug interrupt will not be
244 * delivered *immediately*. Instead, it simply sets the appropriate DBSR bits.
245 * If those DBSR bits are still set when MSR[DE] is re-enabled, the interrupt
246 * will be delivered as an "imprecise debug event" (which is indicated by
247 * DBSR[IDE].
248 */
249static void kvmppc_disable_debug_interrupts(void)
250{
251 mtmsr(mfmsr() & ~MSR_DE);
252}
253
254static void kvmppc_restore_host_debug_state(struct kvm_vcpu *vcpu)
255{
256 kvmppc_disable_debug_interrupts();
257
258 mtspr(SPRN_IAC1, vcpu->arch.host_iac[0]);
259 mtspr(SPRN_IAC2, vcpu->arch.host_iac[1]);
260 mtspr(SPRN_IAC3, vcpu->arch.host_iac[2]);
261 mtspr(SPRN_IAC4, vcpu->arch.host_iac[3]);
262 mtspr(SPRN_DBCR1, vcpu->arch.host_dbcr1);
263 mtspr(SPRN_DBCR2, vcpu->arch.host_dbcr2);
264 mtspr(SPRN_DBCR0, vcpu->arch.host_dbcr0);
265 mtmsr(vcpu->arch.host_msr);
266}
267
268static void kvmppc_load_guest_debug_registers(struct kvm_vcpu *vcpu)
269{
270 struct kvm_guest_debug *dbg = &vcpu->guest_debug;
271 u32 dbcr0 = 0;
272
273 vcpu->arch.host_msr = mfmsr();
274 kvmppc_disable_debug_interrupts();
275
276 /* Save host debug register state. */
277 vcpu->arch.host_iac[0] = mfspr(SPRN_IAC1);
278 vcpu->arch.host_iac[1] = mfspr(SPRN_IAC2);
279 vcpu->arch.host_iac[2] = mfspr(SPRN_IAC3);
280 vcpu->arch.host_iac[3] = mfspr(SPRN_IAC4);
281 vcpu->arch.host_dbcr0 = mfspr(SPRN_DBCR0);
282 vcpu->arch.host_dbcr1 = mfspr(SPRN_DBCR1);
283 vcpu->arch.host_dbcr2 = mfspr(SPRN_DBCR2);
284
285 /* set registers up for guest */
286
287 if (dbg->bp[0]) {
288 mtspr(SPRN_IAC1, dbg->bp[0]);
289 dbcr0 |= DBCR0_IAC1 | DBCR0_IDM;
290 }
291 if (dbg->bp[1]) {
292 mtspr(SPRN_IAC2, dbg->bp[1]);
293 dbcr0 |= DBCR0_IAC2 | DBCR0_IDM;
294 }
295 if (dbg->bp[2]) {
296 mtspr(SPRN_IAC3, dbg->bp[2]);
297 dbcr0 |= DBCR0_IAC3 | DBCR0_IDM;
298 }
299 if (dbg->bp[3]) {
300 mtspr(SPRN_IAC4, dbg->bp[3]);
301 dbcr0 |= DBCR0_IAC4 | DBCR0_IDM;
302 }
303
304 mtspr(SPRN_DBCR0, dbcr0);
305 mtspr(SPRN_DBCR1, 0);
306 mtspr(SPRN_DBCR2, 0);
307}
308
242void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 309void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
243{ 310{
311 int i;
312
313 if (vcpu->guest_debug.enabled)
314 kvmppc_load_guest_debug_registers(vcpu);
315
316 /* Mark every guest entry in the shadow TLB entry modified, so that they
317 * will all be reloaded on the next vcpu run (instead of being
318 * demand-faulted). */
319 for (i = 0; i <= tlb_44x_hwater; i++)
320 kvmppc_tlbe_set_modified(vcpu, i);
244} 321}
245 322
246void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) 323void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
247{ 324{
325 if (vcpu->guest_debug.enabled)
326 kvmppc_restore_host_debug_state(vcpu);
327
328 /* Don't leave guest TLB entries resident when being de-scheduled. */
329 /* XXX It would be nice to differentiate between heavyweight exit and
330 * sched_out here, since we could avoid the TLB flush for heavyweight
331 * exits. */
332 _tlbia();
248} 333}
249 334
250int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, 335int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
251 struct kvm_debug_guest *dbg) 336 struct kvm_debug_guest *dbg)
252{ 337{
253 return -ENOTSUPP; 338 int i;
339
340 vcpu->guest_debug.enabled = dbg->enabled;
341 if (vcpu->guest_debug.enabled) {
342 for (i=0; i < ARRAY_SIZE(vcpu->guest_debug.bp); i++) {
343 if (dbg->breakpoints[i].enabled)
344 vcpu->guest_debug.bp[i] = dbg->breakpoints[i].address;
345 else
346 vcpu->guest_debug.bp[i] = 0;
347 }
348 }
349
350 return 0;
254} 351}
255 352
256static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu, 353static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu,
diff --git a/arch/powerpc/lib/copypage_64.S b/arch/powerpc/lib/copypage_64.S
index f9837f44ac0b..75f3267fdc30 100644
--- a/arch/powerpc/lib/copypage_64.S
+++ b/arch/powerpc/lib/copypage_64.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Paul Mackerras, IBM Corp. 2 * Copyright (C) 2008 Mark Nelson, IBM Corp.
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -8,112 +8,100 @@
8 */ 8 */
9#include <asm/processor.h> 9#include <asm/processor.h>
10#include <asm/ppc_asm.h> 10#include <asm/ppc_asm.h>
11#include <asm/asm-offsets.h>
12
13 .section ".toc","aw"
14PPC64_CACHES:
15 .tc ppc64_caches[TC],ppc64_caches
16 .section ".text"
17
11 18
12_GLOBAL(copy_4K_page) 19_GLOBAL(copy_4K_page)
13 std r31,-8(1) 20 li r5,4096 /* 4K page size */
14 std r30,-16(1) 21BEGIN_FTR_SECTION
15 std r29,-24(1) 22 ld r10,PPC64_CACHES@toc(r2)
16 std r28,-32(1) 23 lwz r11,DCACHEL1LOGLINESIZE(r10) /* log2 of cache line size */
17 std r27,-40(1) 24 lwz r12,DCACHEL1LINESIZE(r10) /* get cache line size */
18 std r26,-48(1) 25 li r9,0
19 std r25,-56(1) 26 srd r8,r5,r11
20 std r24,-64(1) 27
21 std r23,-72(1) 28 mtctr r8
22 std r22,-80(1) 29setup:
23 std r21,-88(1) 30 dcbt r9,r4
24 std r20,-96(1) 31 dcbz r9,r3
25 li r5,4096/32 - 1 32 add r9,r9,r12
33 bdnz setup
34END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ)
26 addi r3,r3,-8 35 addi r3,r3,-8
27 li r12,5 36 srdi r8,r5,7 /* page is copied in 128 byte strides */
280: addi r5,r5,-24 37 addi r8,r8,-1 /* one stride copied outside loop */
29 mtctr r12 38
30 ld r22,640(4) 39 mtctr r8
31 ld r21,512(4) 40
32 ld r20,384(4) 41 ld r5,0(r4)
33 ld r11,256(4) 42 ld r6,8(r4)
34 ld r9,128(4) 43 ld r7,16(r4)
35 ld r7,0(4) 44 ldu r8,24(r4)
36 ld r25,648(4) 451: std r5,8(r3)
37 ld r24,520(4) 46 ld r9,8(r4)
38 ld r23,392(4) 47 std r6,16(r3)
39 ld r10,264(4) 48 ld r10,16(r4)
40 ld r8,136(4) 49 std r7,24(r3)
41 ldu r6,8(4) 50 ld r11,24(r4)
42 cmpwi r5,24 51 std r8,32(r3)
431: std r22,648(3) 52 ld r12,32(r4)
44 std r21,520(3) 53 std r9,40(r3)
45 std r20,392(3) 54 ld r5,40(r4)
46 std r11,264(3) 55 std r10,48(r3)
47 std r9,136(3) 56 ld r6,48(r4)
48 std r7,8(3) 57 std r11,56(r3)
49 ld r28,648(4) 58 ld r7,56(r4)
50 ld r27,520(4) 59 std r12,64(r3)
51 ld r26,392(4) 60 ld r8,64(r4)
52 ld r31,264(4) 61 std r5,72(r3)
53 ld r30,136(4) 62 ld r9,72(r4)
54 ld r29,8(4) 63 std r6,80(r3)
55 std r25,656(3) 64 ld r10,80(r4)
56 std r24,528(3) 65 std r7,88(r3)
57 std r23,400(3) 66 ld r11,88(r4)
58 std r10,272(3) 67 std r8,96(r3)
59 std r8,144(3) 68 ld r12,96(r4)
60 std r6,16(3) 69 std r9,104(r3)
61 ld r22,656(4) 70 ld r5,104(r4)
62 ld r21,528(4) 71 std r10,112(r3)
63 ld r20,400(4) 72 ld r6,112(r4)
64 ld r11,272(4) 73 std r11,120(r3)
65 ld r9,144(4) 74 ld r7,120(r4)
66 ld r7,16(4) 75 stdu r12,128(r3)
67 std r28,664(3) 76 ldu r8,128(r4)
68 std r27,536(3)
69 std r26,408(3)
70 std r31,280(3)
71 std r30,152(3)
72 stdu r29,24(3)
73 ld r25,664(4)
74 ld r24,536(4)
75 ld r23,408(4)
76 ld r10,280(4)
77 ld r8,152(4)
78 ldu r6,24(4)
79 bdnz 1b 77 bdnz 1b
80 std r22,648(3) 78
81 std r21,520(3) 79 std r5,8(r3)
82 std r20,392(3) 80 ld r9,8(r4)
83 std r11,264(3) 81 std r6,16(r3)
84 std r9,136(3) 82 ld r10,16(r4)
85 std r7,8(3) 83 std r7,24(r3)
86 addi r4,r4,640 84 ld r11,24(r4)
87 addi r3,r3,648 85 std r8,32(r3)
88 bge 0b 86 ld r12,32(r4)
89 mtctr r5 87 std r9,40(r3)
90 ld r7,0(4) 88 ld r5,40(r4)
91 ld r8,8(4) 89 std r10,48(r3)
92 ldu r9,16(4) 90 ld r6,48(r4)
933: ld r10,8(4) 91 std r11,56(r3)
94 std r7,8(3) 92 ld r7,56(r4)
95 ld r7,16(4) 93 std r12,64(r3)
96 std r8,16(3) 94 ld r8,64(r4)
97 ld r8,24(4) 95 std r5,72(r3)
98 std r9,24(3) 96 ld r9,72(r4)
99 ldu r9,32(4) 97 std r6,80(r3)
100 stdu r10,32(3) 98 ld r10,80(r4)
101 bdnz 3b 99 std r7,88(r3)
1024: ld r10,8(4) 100 ld r11,88(r4)
103 std r7,8(3) 101 std r8,96(r3)
104 std r8,16(3) 102 ld r12,96(r4)
105 std r9,24(3) 103 std r9,104(r3)
106 std r10,32(3) 104 std r10,112(r3)
1079: ld r20,-96(1) 105 std r11,120(r3)
108 ld r21,-88(1) 106 std r12,128(r3)
109 ld r22,-80(1)
110 ld r23,-72(1)
111 ld r24,-64(1)
112 ld r25,-56(1)
113 ld r26,-48(1)
114 ld r27,-40(1)
115 ld r28,-32(1)
116 ld r29,-24(1)
117 ld r30,-16(1)
118 ld r31,-8(1)
119 blr 107 blr
diff --git a/arch/powerpc/lib/dma-noncoherent.c b/arch/powerpc/lib/dma-noncoherent.c
index 5d83907f6591..31734c0969cd 100644
--- a/arch/powerpc/lib/dma-noncoherent.c
+++ b/arch/powerpc/lib/dma-noncoherent.c
@@ -203,7 +203,7 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
203 /* 203 /*
204 * Set the "dma handle" 204 * Set the "dma handle"
205 */ 205 */
206 *handle = page_to_bus(page); 206 *handle = page_to_phys(page);
207 207
208 do { 208 do {
209 BUG_ON(!pte_none(*pte)); 209 BUG_ON(!pte_none(*pte));
diff --git a/arch/powerpc/math-emu/Makefile b/arch/powerpc/math-emu/Makefile
index 29bc9126241b..03aa98dd9f0a 100644
--- a/arch/powerpc/math-emu/Makefile
+++ b/arch/powerpc/math-emu/Makefile
@@ -4,13 +4,14 @@ obj-y := math.o fmr.o lfd.o stfd.o
4obj-$(CONFIG_MATH_EMULATION) += fabs.o fadd.o fadds.o fcmpo.o fcmpu.o \ 4obj-$(CONFIG_MATH_EMULATION) += fabs.o fadd.o fadds.o fcmpo.o fcmpu.o \
5 fctiw.o fctiwz.o fdiv.o fdivs.o \ 5 fctiw.o fctiwz.o fdiv.o fdivs.o \
6 fmadd.o fmadds.o fmsub.o fmsubs.o \ 6 fmadd.o fmadds.o fmsub.o fmsubs.o \
7 fmul.o fmuls.o fnabs.o fneg.o types.o \ 7 fmul.o fmuls.o fnabs.o fneg.o \
8 fnmadd.o fnmadds.o fnmsub.o fnmsubs.o \ 8 fnmadd.o fnmadds.o fnmsub.o fnmsubs.o \
9 fres.o frsp.o frsqrte.o fsel.o lfs.o \ 9 fres.o frsp.o frsqrte.o fsel.o lfs.o \
10 fsqrt.o fsqrts.o fsub.o fsubs.o \ 10 fsqrt.o fsqrts.o fsub.o fsubs.o \
11 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \ 11 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \
12 mtfsf.o mtfsfi.o stfiwx.o stfs.o \ 12 mtfsf.o mtfsfi.o stfiwx.o stfs.o
13 udivmodti4.o
14 13
15CFLAGS_fabs.o = -fno-builtin-fabs 14CFLAGS_fabs.o = -fno-builtin-fabs
16CFLAGS_math.o = -fno-builtin-fabs 15CFLAGS_math.o = -fno-builtin-fabs
16
17EXTRA_CFLAGS = -I. -Iinclude/math-emu -w
diff --git a/arch/powerpc/math-emu/double.h b/arch/powerpc/math-emu/double.h
deleted file mode 100644
index ffba8b67f059..000000000000
--- a/arch/powerpc/math-emu/double.h
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 * Definitions for IEEE Double Precision
3 */
4
5#if _FP_W_TYPE_SIZE < 32
6#error "Here's a nickel kid. Go buy yourself a real computer."
7#endif
8
9#if _FP_W_TYPE_SIZE < 64
10#define _FP_FRACTBITS_D (2 * _FP_W_TYPE_SIZE)
11#else
12#define _FP_FRACTBITS_D _FP_W_TYPE_SIZE
13#endif
14
15#define _FP_FRACBITS_D 53
16#define _FP_FRACXBITS_D (_FP_FRACTBITS_D - _FP_FRACBITS_D)
17#define _FP_WFRACBITS_D (_FP_WORKBITS + _FP_FRACBITS_D)
18#define _FP_WFRACXBITS_D (_FP_FRACTBITS_D - _FP_WFRACBITS_D)
19#define _FP_EXPBITS_D 11
20#define _FP_EXPBIAS_D 1023
21#define _FP_EXPMAX_D 2047
22
23#define _FP_QNANBIT_D \
24 ((_FP_W_TYPE)1 << ((_FP_FRACBITS_D-2) % _FP_W_TYPE_SIZE))
25#define _FP_IMPLBIT_D \
26 ((_FP_W_TYPE)1 << ((_FP_FRACBITS_D-1) % _FP_W_TYPE_SIZE))
27#define _FP_OVERFLOW_D \
28 ((_FP_W_TYPE)1 << (_FP_WFRACBITS_D % _FP_W_TYPE_SIZE))
29
30#if _FP_W_TYPE_SIZE < 64
31
32union _FP_UNION_D
33{
34 double flt;
35 struct {
36#if __BYTE_ORDER == __BIG_ENDIAN
37 unsigned sign : 1;
38 unsigned exp : _FP_EXPBITS_D;
39 unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;
40 unsigned frac0 : _FP_W_TYPE_SIZE;
41#else
42 unsigned frac0 : _FP_W_TYPE_SIZE;
43 unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;
44 unsigned exp : _FP_EXPBITS_D;
45 unsigned sign : 1;
46#endif
47 } bits __attribute__((packed));
48};
49
50#define FP_DECL_D(X) _FP_DECL(2,X)
51#define FP_UNPACK_RAW_D(X,val) _FP_UNPACK_RAW_2(D,X,val)
52#define FP_PACK_RAW_D(val,X) _FP_PACK_RAW_2(D,val,X)
53
54#define FP_UNPACK_D(X,val) \
55 do { \
56 _FP_UNPACK_RAW_2(D,X,val); \
57 _FP_UNPACK_CANONICAL(D,2,X); \
58 } while (0)
59
60#define FP_PACK_D(val,X) \
61 do { \
62 _FP_PACK_CANONICAL(D,2,X); \
63 _FP_PACK_RAW_2(D,val,X); \
64 } while (0)
65
66#define FP_NEG_D(R,X) _FP_NEG(D,2,R,X)
67#define FP_ADD_D(R,X,Y) _FP_ADD(D,2,R,X,Y)
68#define FP_SUB_D(R,X,Y) _FP_SUB(D,2,R,X,Y)
69#define FP_MUL_D(R,X,Y) _FP_MUL(D,2,R,X,Y)
70#define FP_DIV_D(R,X,Y) _FP_DIV(D,2,R,X,Y)
71#define FP_SQRT_D(R,X) _FP_SQRT(D,2,R,X)
72
73#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,2,r,X,Y,un)
74#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,2,r,X,Y)
75
76#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
77#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,2,X,r,rs,rt)
78
79#else
80
81union _FP_UNION_D
82{
83 double flt;
84 struct {
85#if __BYTE_ORDER == __BIG_ENDIAN
86 unsigned sign : 1;
87 unsigned exp : _FP_EXPBITS_D;
88 unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
89#else
90 unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
91 unsigned exp : _FP_EXPBITS_D;
92 unsigned sign : 1;
93#endif
94 } bits __attribute__((packed));
95};
96
97#define FP_DECL_D(X) _FP_DECL(1,X)
98#define FP_UNPACK_RAW_D(X,val) _FP_UNPACK_RAW_1(D,X,val)
99#define FP_PACK_RAW_D(val,X) _FP_PACK_RAW_1(D,val,X)
100
101#define FP_UNPACK_D(X,val) \
102 do { \
103 _FP_UNPACK_RAW_1(D,X,val); \
104 _FP_UNPACK_CANONICAL(D,1,X); \
105 } while (0)
106
107#define FP_PACK_D(val,X) \
108 do { \
109 _FP_PACK_CANONICAL(D,1,X); \
110 _FP_PACK_RAW_1(D,val,X); \
111 } while (0)
112
113#define FP_NEG_D(R,X) _FP_NEG(D,1,R,X)
114#define FP_ADD_D(R,X,Y) _FP_ADD(D,1,R,X,Y)
115#define FP_SUB_D(R,X,Y) _FP_SUB(D,1,R,X,Y)
116#define FP_MUL_D(R,X,Y) _FP_MUL(D,1,R,X,Y)
117#define FP_DIV_D(R,X,Y) _FP_DIV(D,1,R,X,Y)
118#define FP_SQRT_D(R,X) _FP_SQRT(D,1,R,X)
119
120/* The implementation of _FP_MUL_D and _FP_DIV_D should be chosen by
121 the target machine. */
122
123#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,1,r,X,Y,un)
124#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,1,r,X,Y)
125
126#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,1,r,X,rsz,rsg)
127#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,1,X,r,rs,rt)
128
129#endif /* W_TYPE_SIZE < 64 */
diff --git a/arch/powerpc/math-emu/fadd.c b/arch/powerpc/math-emu/fadd.c
index 7befbbf2c332..04d3b4aa32ce 100644
--- a/arch/powerpc/math-emu/fadd.c
+++ b/arch/powerpc/math-emu/fadd.c
@@ -2,8 +2,9 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fadd(void *frD, void *frA, void *frB) 10fadd(void *frD, void *frA, void *frB)
@@ -11,28 +12,28 @@ fadd(void *frD, void *frA, void *frB)
11 FP_DECL_D(A); 12 FP_DECL_D(A);
12 FP_DECL_D(B); 13 FP_DECL_D(B);
13 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX;
14 int ret = 0; 16 int ret = 0;
15 17
16#ifdef DEBUG 18#ifdef DEBUG
17 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 19 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
18#endif 20#endif
19 21
20 __FP_UNPACK_D(A, frA); 22 FP_UNPACK_DP(A, frA);
21 __FP_UNPACK_D(B, frB); 23 FP_UNPACK_DP(B, frB);
22 24
23#ifdef DEBUG 25#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 26 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
25 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c); 27 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
26#endif 28#endif
27 29
28 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
29 ret |= EFLAG_VXISI;
30
31 FP_ADD_D(R, A, B); 30 FP_ADD_D(R, A, B);
32 31
33#ifdef DEBUG 32#ifdef DEBUG
34 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 33 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
35#endif 34#endif
36 35
37 return (ret | __FP_PACK_D(frD, R)); 36 __FP_PACK_D(frD, R);
37
38 return FP_CUR_EXCEPTIONS;
38} 39}
diff --git a/arch/powerpc/math-emu/fadds.c b/arch/powerpc/math-emu/fadds.c
index 2b346b38b480..5930f40a8687 100644
--- a/arch/powerpc/math-emu/fadds.c
+++ b/arch/powerpc/math-emu/fadds.c
@@ -2,9 +2,10 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fadds(void *frD, void *frA, void *frB) 11fadds(void *frD, void *frA, void *frB)
@@ -12,28 +13,27 @@ fadds(void *frD, void *frA, void *frB)
12 FP_DECL_D(A); 13 FP_DECL_D(A);
13 FP_DECL_D(B); 14 FP_DECL_D(B);
14 FP_DECL_D(R); 15 FP_DECL_D(R);
15 int ret = 0; 16 FP_DECL_EX;
16 17
17#ifdef DEBUG 18#ifdef DEBUG
18 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 19 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
19#endif 20#endif
20 21
21 __FP_UNPACK_D(A, frA); 22 FP_UNPACK_DP(A, frA);
22 __FP_UNPACK_D(B, frB); 23 FP_UNPACK_DP(B, frB);
23 24
24#ifdef DEBUG 25#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 26 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
26 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c); 27 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
27#endif 28#endif
28 29
29 if (A_s != B_s && A_c == FP_CLS_INF && B_c == FP_CLS_INF)
30 ret |= EFLAG_VXISI;
31
32 FP_ADD_D(R, A, B); 30 FP_ADD_D(R, A, B);
33 31
34#ifdef DEBUG 32#ifdef DEBUG
35 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 33 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
36#endif 34#endif
37 35
38 return (ret | __FP_PACK_DS(frD, R)); 36 __FP_PACK_DS(frD, R);
37
38 return FP_CUR_EXCEPTIONS;
39} 39}
diff --git a/arch/powerpc/math-emu/fcmpo.c b/arch/powerpc/math-emu/fcmpo.c
index 36d689044c63..b5dc4498cd71 100644
--- a/arch/powerpc/math-emu/fcmpo.c
+++ b/arch/powerpc/math-emu/fcmpo.c
@@ -2,14 +2,16 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fcmpo(u32 *ccr, int crfD, void *frA, void *frB) 10fcmpo(u32 *ccr, int crfD, void *frA, void *frB)
10{ 11{
11 FP_DECL_D(A); 12 FP_DECL_D(A);
12 FP_DECL_D(B); 13 FP_DECL_D(B);
14 FP_DECL_EX;
13 int code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) }; 15 int code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) };
14 long cmp; 16 long cmp;
15 int ret = 0; 17 int ret = 0;
@@ -18,8 +20,8 @@ fcmpo(u32 *ccr, int crfD, void *frA, void *frB)
18 printk("%s: %p (%08x) %d %p %p\n", __func__, ccr, *ccr, crfD, frA, frB); 20 printk("%s: %p (%08x) %d %p %p\n", __func__, ccr, *ccr, crfD, frA, frB);
19#endif 21#endif
20 22
21 __FP_UNPACK_D(A, frA); 23 FP_UNPACK_DP(A, frA);
22 __FP_UNPACK_D(B, frB); 24 FP_UNPACK_DP(B, frB);
23 25
24#ifdef DEBUG 26#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
diff --git a/arch/powerpc/math-emu/fcmpu.c b/arch/powerpc/math-emu/fcmpu.c
index 53d93894f2a6..d4fb1babc6ad 100644
--- a/arch/powerpc/math-emu/fcmpu.c
+++ b/arch/powerpc/math-emu/fcmpu.c
@@ -2,14 +2,16 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fcmpu(u32 *ccr, int crfD, void *frA, void *frB) 10fcmpu(u32 *ccr, int crfD, void *frA, void *frB)
10{ 11{
11 FP_DECL_D(A); 12 FP_DECL_D(A);
12 FP_DECL_D(B); 13 FP_DECL_D(B);
14 FP_DECL_EX;
13 int code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) }; 15 int code[4] = { (1 << 3), (1 << 1), (1 << 2), (1 << 0) };
14 long cmp; 16 long cmp;
15 17
@@ -17,8 +19,8 @@ fcmpu(u32 *ccr, int crfD, void *frA, void *frB)
17 printk("%s: %p (%08x) %d %p %p\n", __func__, ccr, *ccr, crfD, frA, frB); 19 printk("%s: %p (%08x) %d %p %p\n", __func__, ccr, *ccr, crfD, frA, frB);
18#endif 20#endif
19 21
20 __FP_UNPACK_D(A, frA); 22 FP_UNPACK_DP(A, frA);
21 __FP_UNPACK_D(B, frB); 23 FP_UNPACK_DP(B, frB);
22 24
23#ifdef DEBUG 25#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 26 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
diff --git a/arch/powerpc/math-emu/fctiw.c b/arch/powerpc/math-emu/fctiw.c
index fcd7a95e021d..f694440ddc00 100644
--- a/arch/powerpc/math-emu/fctiw.c
+++ b/arch/powerpc/math-emu/fctiw.c
@@ -2,16 +2,18 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fctiw(u32 *frD, void *frB) 10fctiw(u32 *frD, void *frB)
10{ 11{
11 FP_DECL_D(B); 12 FP_DECL_D(B);
13 FP_DECL_EX;
12 unsigned int r; 14 unsigned int r;
13 15
14 __FP_UNPACK_D(B, frB); 16 FP_UNPACK_DP(B, frB);
15 FP_TO_INT_D(r, B, 32, 1); 17 FP_TO_INT_D(r, B, 32, 1);
16 frD[1] = r; 18 frD[1] = r;
17 19
diff --git a/arch/powerpc/math-emu/fctiwz.c b/arch/powerpc/math-emu/fctiwz.c
index 1514d59e146e..71e782fd4fe3 100644
--- a/arch/powerpc/math-emu/fctiwz.c
+++ b/arch/powerpc/math-emu/fctiwz.c
@@ -2,13 +2,15 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fctiwz(u32 *frD, void *frB) 10fctiwz(u32 *frD, void *frB)
10{ 11{
11 FP_DECL_D(B); 12 FP_DECL_D(B);
13 FP_DECL_EX;
12 u32 fpscr; 14 u32 fpscr;
13 unsigned int r; 15 unsigned int r;
14 16
@@ -16,7 +18,7 @@ fctiwz(u32 *frD, void *frB)
16 __FPU_FPSCR &= ~(3); 18 __FPU_FPSCR &= ~(3);
17 __FPU_FPSCR |= FP_RND_ZERO; 19 __FPU_FPSCR |= FP_RND_ZERO;
18 20
19 __FP_UNPACK_D(B, frB); 21 FP_UNPACK_DP(B, frB);
20 FP_TO_INT_D(r, B, 32, 1); 22 FP_TO_INT_D(r, B, 32, 1);
21 frD[1] = r; 23 frD[1] = r;
22 24
diff --git a/arch/powerpc/math-emu/fdiv.c b/arch/powerpc/math-emu/fdiv.c
index 18a20fe396b0..2db15097d98e 100644
--- a/arch/powerpc/math-emu/fdiv.c
+++ b/arch/powerpc/math-emu/fdiv.c
@@ -2,8 +2,9 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fdiv(void *frD, void *frA, void *frB) 10fdiv(void *frD, void *frA, void *frB)
@@ -11,14 +12,15 @@ fdiv(void *frD, void *frA, void *frB)
11 FP_DECL_D(A); 12 FP_DECL_D(A);
12 FP_DECL_D(B); 13 FP_DECL_D(B);
13 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX;
14 int ret = 0; 16 int ret = 0;
15 17
16#ifdef DEBUG 18#ifdef DEBUG
17 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 19 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
18#endif 20#endif
19 21
20 __FP_UNPACK_D(A, frA); 22 FP_UNPACK_DP(A, frA);
21 __FP_UNPACK_D(B, frB); 23 FP_UNPACK_DP(B, frB);
22 24
23#ifdef DEBUG 25#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 26 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -49,5 +51,7 @@ fdiv(void *frD, void *frA, void *frB)
49 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 51 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
50#endif 52#endif
51 53
52 return (ret | __FP_PACK_D(frD, R)); 54 __FP_PACK_D(frD, R);
55
56 return FP_CUR_EXCEPTIONS;
53} 57}
diff --git a/arch/powerpc/math-emu/fdivs.c b/arch/powerpc/math-emu/fdivs.c
index 24feed689c35..797f6a9a20b5 100644
--- a/arch/powerpc/math-emu/fdivs.c
+++ b/arch/powerpc/math-emu/fdivs.c
@@ -2,9 +2,10 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fdivs(void *frD, void *frA, void *frB) 11fdivs(void *frD, void *frA, void *frB)
@@ -12,14 +13,15 @@ fdivs(void *frD, void *frA, void *frB)
12 FP_DECL_D(A); 13 FP_DECL_D(A);
13 FP_DECL_D(B); 14 FP_DECL_D(B);
14 FP_DECL_D(R); 15 FP_DECL_D(R);
16 FP_DECL_EX;
15 int ret = 0; 17 int ret = 0;
16 18
17#ifdef DEBUG 19#ifdef DEBUG
18 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 20 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
19#endif 21#endif
20 22
21 __FP_UNPACK_D(A, frA); 23 FP_UNPACK_DP(A, frA);
22 __FP_UNPACK_D(B, frB); 24 FP_UNPACK_DP(B, frB);
23 25
24#ifdef DEBUG 26#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -51,5 +53,7 @@ fdivs(void *frD, void *frA, void *frB)
51 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 53 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
52#endif 54#endif
53 55
54 return (ret | __FP_PACK_DS(frD, R)); 56 __FP_PACK_DS(frD, R);
57
58 return FP_CUR_EXCEPTIONS;
55} 59}
diff --git a/arch/powerpc/math-emu/fmadd.c b/arch/powerpc/math-emu/fmadd.c
index dedb465fdc68..925313aa6f82 100644
--- a/arch/powerpc/math-emu/fmadd.c
+++ b/arch/powerpc/math-emu/fmadd.c
@@ -2,8 +2,9 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fmadd(void *frD, void *frA, void *frB, void *frC) 10fmadd(void *frD, void *frA, void *frB, void *frC)
@@ -13,15 +14,16 @@ fmadd(void *frD, void *frA, void *frB, void *frC)
13 FP_DECL_D(B); 14 FP_DECL_D(B);
14 FP_DECL_D(C); 15 FP_DECL_D(C);
15 FP_DECL_D(T); 16 FP_DECL_D(T);
17 FP_DECL_EX;
16 int ret = 0; 18 int ret = 0;
17 19
18#ifdef DEBUG 20#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
20#endif 22#endif
21 23
22 __FP_UNPACK_D(A, frA); 24 FP_UNPACK_DP(A, frA);
23 __FP_UNPACK_D(B, frB); 25 FP_UNPACK_DP(B, frB);
24 __FP_UNPACK_D(C, frC); 26 FP_UNPACK_DP(C, frC);
25 27
26#ifdef DEBUG 28#ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 29 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -44,5 +46,7 @@ fmadd(void *frD, void *frA, void *frB, void *frC)
44 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 46 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
45#endif 47#endif
46 48
47 return (ret | __FP_PACK_D(frD, R)); 49 __FP_PACK_D(frD, R);
50
51 return FP_CUR_EXCEPTIONS;
48} 52}
diff --git a/arch/powerpc/math-emu/fmadds.c b/arch/powerpc/math-emu/fmadds.c
index 6bbb56d5502c..aea80ef79399 100644
--- a/arch/powerpc/math-emu/fmadds.c
+++ b/arch/powerpc/math-emu/fmadds.c
@@ -2,9 +2,10 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fmadds(void *frD, void *frA, void *frB, void *frC) 11fmadds(void *frD, void *frA, void *frB, void *frC)
@@ -14,15 +15,16 @@ fmadds(void *frD, void *frA, void *frB, void *frC)
14 FP_DECL_D(B); 15 FP_DECL_D(B);
15 FP_DECL_D(C); 16 FP_DECL_D(C);
16 FP_DECL_D(T); 17 FP_DECL_D(T);
18 FP_DECL_EX;
17 int ret = 0; 19 int ret = 0;
18 20
19#ifdef DEBUG 21#ifdef DEBUG
20 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 22 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
21#endif 23#endif
22 24
23 __FP_UNPACK_D(A, frA); 25 FP_UNPACK_DP(A, frA);
24 __FP_UNPACK_D(B, frB); 26 FP_UNPACK_DP(B, frB);
25 __FP_UNPACK_D(C, frC); 27 FP_UNPACK_DP(C, frC);
26 28
27#ifdef DEBUG 29#ifdef DEBUG
28 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 30 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -45,5 +47,7 @@ fmadds(void *frD, void *frA, void *frB, void *frC)
45 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 47 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
46#endif 48#endif
47 49
48 return (ret | __FP_PACK_DS(frD, R)); 50 __FP_PACK_DS(frD, R);
51
52 return FP_CUR_EXCEPTIONS;
49} 53}
diff --git a/arch/powerpc/math-emu/fmsub.c b/arch/powerpc/math-emu/fmsub.c
index f311e2c7e67e..a644d525fca6 100644
--- a/arch/powerpc/math-emu/fmsub.c
+++ b/arch/powerpc/math-emu/fmsub.c
@@ -2,8 +2,9 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fmsub(void *frD, void *frA, void *frB, void *frC) 10fmsub(void *frD, void *frA, void *frB, void *frC)
@@ -13,15 +14,16 @@ fmsub(void *frD, void *frA, void *frB, void *frC)
13 FP_DECL_D(B); 14 FP_DECL_D(B);
14 FP_DECL_D(C); 15 FP_DECL_D(C);
15 FP_DECL_D(T); 16 FP_DECL_D(T);
17 FP_DECL_EX;
16 int ret = 0; 18 int ret = 0;
17 19
18#ifdef DEBUG 20#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
20#endif 22#endif
21 23
22 __FP_UNPACK_D(A, frA); 24 FP_UNPACK_DP(A, frA);
23 __FP_UNPACK_D(B, frB); 25 FP_UNPACK_DP(B, frB);
24 __FP_UNPACK_D(C, frC); 26 FP_UNPACK_DP(C, frC);
25 27
26#ifdef DEBUG 28#ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 29 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -47,5 +49,7 @@ fmsub(void *frD, void *frA, void *frB, void *frC)
47 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 49 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
48#endif 50#endif
49 51
50 return (ret | __FP_PACK_D(frD, R)); 52 __FP_PACK_D(frD, R);
53
54 return FP_CUR_EXCEPTIONS;
51} 55}
diff --git a/arch/powerpc/math-emu/fmsubs.c b/arch/powerpc/math-emu/fmsubs.c
index 81a716d3ee2e..2fdeeb9bb569 100644
--- a/arch/powerpc/math-emu/fmsubs.c
+++ b/arch/powerpc/math-emu/fmsubs.c
@@ -2,9 +2,10 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fmsubs(void *frD, void *frA, void *frB, void *frC) 11fmsubs(void *frD, void *frA, void *frB, void *frC)
@@ -14,15 +15,16 @@ fmsubs(void *frD, void *frA, void *frB, void *frC)
14 FP_DECL_D(B); 15 FP_DECL_D(B);
15 FP_DECL_D(C); 16 FP_DECL_D(C);
16 FP_DECL_D(T); 17 FP_DECL_D(T);
18 FP_DECL_EX;
17 int ret = 0; 19 int ret = 0;
18 20
19#ifdef DEBUG 21#ifdef DEBUG
20 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 22 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
21#endif 23#endif
22 24
23 __FP_UNPACK_D(A, frA); 25 FP_UNPACK_DP(A, frA);
24 __FP_UNPACK_D(B, frB); 26 FP_UNPACK_DP(B, frB);
25 __FP_UNPACK_D(C, frC); 27 FP_UNPACK_DP(C, frC);
26 28
27#ifdef DEBUG 29#ifdef DEBUG
28 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 30 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -48,5 +50,7 @@ fmsubs(void *frD, void *frA, void *frB, void *frC)
48 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 50 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
49#endif 51#endif
50 52
51 return (ret | __FP_PACK_DS(frD, R)); 53 __FP_PACK_DS(frD, R);
54
55 return FP_CUR_EXCEPTIONS;
52} 56}
diff --git a/arch/powerpc/math-emu/fmul.c b/arch/powerpc/math-emu/fmul.c
index 2f3d32784a04..391fd17d3440 100644
--- a/arch/powerpc/math-emu/fmul.c
+++ b/arch/powerpc/math-emu/fmul.c
@@ -2,8 +2,9 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fmul(void *frD, void *frA, void *frB) 10fmul(void *frD, void *frA, void *frB)
@@ -11,14 +12,15 @@ fmul(void *frD, void *frA, void *frB)
11 FP_DECL_D(A); 12 FP_DECL_D(A);
12 FP_DECL_D(B); 13 FP_DECL_D(B);
13 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX;
14 int ret = 0; 16 int ret = 0;
15 17
16#ifdef DEBUG 18#ifdef DEBUG
17 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 19 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
18#endif 20#endif
19 21
20 __FP_UNPACK_D(A, frA); 22 FP_UNPACK_DP(A, frA);
21 __FP_UNPACK_D(B, frB); 23 FP_UNPACK_DP(B, frB);
22 24
23#ifdef DEBUG 25#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n", 26 printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
@@ -38,5 +40,7 @@ fmul(void *frD, void *frA, void *frB)
38 R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023); 40 R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);
39#endif 41#endif
40 42
41 return (ret | __FP_PACK_D(frD, R)); 43 __FP_PACK_D(frD, R);
44
45 return FP_CUR_EXCEPTIONS;
42} 46}
diff --git a/arch/powerpc/math-emu/fmuls.c b/arch/powerpc/math-emu/fmuls.c
index 962b5883f784..2d3ec5f7da20 100644
--- a/arch/powerpc/math-emu/fmuls.c
+++ b/arch/powerpc/math-emu/fmuls.c
@@ -2,9 +2,10 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fmuls(void *frD, void *frA, void *frB) 11fmuls(void *frD, void *frA, void *frB)
@@ -12,14 +13,15 @@ fmuls(void *frD, void *frA, void *frB)
12 FP_DECL_D(A); 13 FP_DECL_D(A);
13 FP_DECL_D(B); 14 FP_DECL_D(B);
14 FP_DECL_D(R); 15 FP_DECL_D(R);
16 FP_DECL_EX;
15 int ret = 0; 17 int ret = 0;
16 18
17#ifdef DEBUG 19#ifdef DEBUG
18 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 20 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
19#endif 21#endif
20 22
21 __FP_UNPACK_D(A, frA); 23 FP_UNPACK_DP(A, frA);
22 __FP_UNPACK_D(B, frB); 24 FP_UNPACK_DP(B, frB);
23 25
24#ifdef DEBUG 26#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n", 27 printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
@@ -39,5 +41,7 @@ fmuls(void *frD, void *frA, void *frB)
39 R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023); 41 R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);
40#endif 42#endif
41 43
42 return (ret | __FP_PACK_DS(frD, R)); 44 __FP_PACK_DS(frD, R);
45
46 return FP_CUR_EXCEPTIONS;
43} 47}
diff --git a/arch/powerpc/math-emu/fnmadd.c b/arch/powerpc/math-emu/fnmadd.c
index 8cf7827c4fb5..2497b86494e5 100644
--- a/arch/powerpc/math-emu/fnmadd.c
+++ b/arch/powerpc/math-emu/fnmadd.c
@@ -2,8 +2,9 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fnmadd(void *frD, void *frA, void *frB, void *frC) 10fnmadd(void *frD, void *frA, void *frB, void *frC)
@@ -13,15 +14,16 @@ fnmadd(void *frD, void *frA, void *frB, void *frC)
13 FP_DECL_D(B); 14 FP_DECL_D(B);
14 FP_DECL_D(C); 15 FP_DECL_D(C);
15 FP_DECL_D(T); 16 FP_DECL_D(T);
17 FP_DECL_EX;
16 int ret = 0; 18 int ret = 0;
17 19
18#ifdef DEBUG 20#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
20#endif 22#endif
21 23
22 __FP_UNPACK_D(A, frA); 24 FP_UNPACK_DP(A, frA);
23 __FP_UNPACK_D(B, frB); 25 FP_UNPACK_DP(B, frB);
24 __FP_UNPACK_D(C, frC); 26 FP_UNPACK_DP(C, frC);
25 27
26#ifdef DEBUG 28#ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 29 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -47,5 +49,7 @@ fnmadd(void *frD, void *frA, void *frB, void *frC)
47 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 49 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
48#endif 50#endif
49 51
50 return (ret | __FP_PACK_D(frD, R)); 52 __FP_PACK_D(frD, R);
53
54 return FP_CUR_EXCEPTIONS;
51} 55}
diff --git a/arch/powerpc/math-emu/fnmadds.c b/arch/powerpc/math-emu/fnmadds.c
index f1c4f0f0d807..ee9d71e0b376 100644
--- a/arch/powerpc/math-emu/fnmadds.c
+++ b/arch/powerpc/math-emu/fnmadds.c
@@ -2,9 +2,10 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fnmadds(void *frD, void *frA, void *frB, void *frC) 11fnmadds(void *frD, void *frA, void *frB, void *frC)
@@ -14,15 +15,16 @@ fnmadds(void *frD, void *frA, void *frB, void *frC)
14 FP_DECL_D(B); 15 FP_DECL_D(B);
15 FP_DECL_D(C); 16 FP_DECL_D(C);
16 FP_DECL_D(T); 17 FP_DECL_D(T);
18 FP_DECL_EX;
17 int ret = 0; 19 int ret = 0;
18 20
19#ifdef DEBUG 21#ifdef DEBUG
20 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 22 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
21#endif 23#endif
22 24
23 __FP_UNPACK_D(A, frA); 25 FP_UNPACK_DP(A, frA);
24 __FP_UNPACK_D(B, frB); 26 FP_UNPACK_DP(B, frB);
25 __FP_UNPACK_D(C, frC); 27 FP_UNPACK_DP(C, frC);
26 28
27#ifdef DEBUG 29#ifdef DEBUG
28 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 30 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -48,5 +50,7 @@ fnmadds(void *frD, void *frA, void *frB, void *frC)
48 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 50 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
49#endif 51#endif
50 52
51 return (ret | __FP_PACK_DS(frD, R)); 53 __FP_PACK_DS(frD, R);
54
55 return FP_CUR_EXCEPTIONS;
52} 56}
diff --git a/arch/powerpc/math-emu/fnmsub.c b/arch/powerpc/math-emu/fnmsub.c
index 98944e6e2601..3885a77acc93 100644
--- a/arch/powerpc/math-emu/fnmsub.c
+++ b/arch/powerpc/math-emu/fnmsub.c
@@ -2,8 +2,9 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fnmsub(void *frD, void *frA, void *frB, void *frC) 10fnmsub(void *frD, void *frA, void *frB, void *frC)
@@ -13,15 +14,16 @@ fnmsub(void *frD, void *frA, void *frB, void *frC)
13 FP_DECL_D(B); 14 FP_DECL_D(B);
14 FP_DECL_D(C); 15 FP_DECL_D(C);
15 FP_DECL_D(T); 16 FP_DECL_D(T);
17 FP_DECL_EX;
16 int ret = 0; 18 int ret = 0;
17 19
18#ifdef DEBUG 20#ifdef DEBUG
19 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 21 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
20#endif 22#endif
21 23
22 __FP_UNPACK_D(A, frA); 24 FP_UNPACK_DP(A, frA);
23 __FP_UNPACK_D(B, frB); 25 FP_UNPACK_DP(B, frB);
24 __FP_UNPACK_D(C, frC); 26 FP_UNPACK_DP(C, frC);
25 27
26#ifdef DEBUG 28#ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 29 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -50,5 +52,7 @@ fnmsub(void *frD, void *frA, void *frB, void *frC)
50 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 52 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
51#endif 53#endif
52 54
53 return (ret | __FP_PACK_D(frD, R)); 55 __FP_PACK_D(frD, R);
56
57 return FP_CUR_EXCEPTIONS;
54} 58}
diff --git a/arch/powerpc/math-emu/fnmsubs.c b/arch/powerpc/math-emu/fnmsubs.c
index b20f4eb63fb9..f835dfeb0fd1 100644
--- a/arch/powerpc/math-emu/fnmsubs.c
+++ b/arch/powerpc/math-emu/fnmsubs.c
@@ -2,9 +2,10 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fnmsubs(void *frD, void *frA, void *frB, void *frC) 11fnmsubs(void *frD, void *frA, void *frB, void *frC)
@@ -14,15 +15,16 @@ fnmsubs(void *frD, void *frA, void *frB, void *frC)
14 FP_DECL_D(B); 15 FP_DECL_D(B);
15 FP_DECL_D(C); 16 FP_DECL_D(C);
16 FP_DECL_D(T); 17 FP_DECL_D(T);
18 FP_DECL_EX;
17 int ret = 0; 19 int ret = 0;
18 20
19#ifdef DEBUG 21#ifdef DEBUG
20 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 22 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
21#endif 23#endif
22 24
23 __FP_UNPACK_D(A, frA); 25 FP_UNPACK_DP(A, frA);
24 __FP_UNPACK_D(B, frB); 26 FP_UNPACK_DP(B, frB);
25 __FP_UNPACK_D(C, frC); 27 FP_UNPACK_DP(C, frC);
26 28
27#ifdef DEBUG 29#ifdef DEBUG
28 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 30 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -51,5 +53,7 @@ fnmsubs(void *frD, void *frA, void *frB, void *frC)
51 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 53 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
52#endif 54#endif
53 55
54 return (ret | __FP_PACK_DS(frD, R)); 56 __FP_PACK_DS(frD, R);
57
58 return FP_CUR_EXCEPTIONS;
55} 59}
diff --git a/arch/powerpc/math-emu/frsp.c b/arch/powerpc/math-emu/frsp.c
index 724ccbc0468e..ddcc14664b1a 100644
--- a/arch/powerpc/math-emu/frsp.c
+++ b/arch/powerpc/math-emu/frsp.c
@@ -2,24 +2,28 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10frsp(void *frD, void *frB) 11frsp(void *frD, void *frB)
11{ 12{
12 FP_DECL_D(B); 13 FP_DECL_D(B);
14 FP_DECL_EX;
13 15
14#ifdef DEBUG 16#ifdef DEBUG
15 printk("%s: D %p, B %p\n", __func__, frD, frB); 17 printk("%s: D %p, B %p\n", __func__, frD, frB);
16#endif 18#endif
17 19
18 __FP_UNPACK_D(B, frB); 20 FP_UNPACK_DP(B, frB);
19 21
20#ifdef DEBUG 22#ifdef DEBUG
21 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c); 23 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
22#endif 24#endif
23 25
24 return __FP_PACK_DS(frD, B); 26 __FP_PACK_DS(frD, B);
27
28 return FP_CUR_EXCEPTIONS;
25} 29}
diff --git a/arch/powerpc/math-emu/fsel.c b/arch/powerpc/math-emu/fsel.c
index ecb5f28eb1f3..1b0c14498032 100644
--- a/arch/powerpc/math-emu/fsel.c
+++ b/arch/powerpc/math-emu/fsel.c
@@ -2,19 +2,21 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fsel(u32 *frD, void *frA, u32 *frB, u32 *frC) 10fsel(u32 *frD, void *frA, u32 *frB, u32 *frC)
10{ 11{
11 FP_DECL_D(A); 12 FP_DECL_D(A);
13 FP_DECL_EX;
12 14
13#ifdef DEBUG 15#ifdef DEBUG
14 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC); 16 printk("%s: %p %p %p %p\n", __func__, frD, frA, frB, frC);
15#endif 17#endif
16 18
17 __FP_UNPACK_D(A, frA); 19 FP_UNPACK_DP(A, frA);
18 20
19#ifdef DEBUG 21#ifdef DEBUG
20 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 22 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
diff --git a/arch/powerpc/math-emu/fsqrt.c b/arch/powerpc/math-emu/fsqrt.c
index 38ec2b752e9d..3e90072693a0 100644
--- a/arch/powerpc/math-emu/fsqrt.c
+++ b/arch/powerpc/math-emu/fsqrt.c
@@ -2,21 +2,23 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fsqrt(void *frD, void *frB) 10fsqrt(void *frD, void *frB)
10{ 11{
11 FP_DECL_D(B); 12 FP_DECL_D(B);
12 FP_DECL_D(R); 13 FP_DECL_D(R);
14 FP_DECL_EX;
13 int ret = 0; 15 int ret = 0;
14 16
15#ifdef DEBUG 17#ifdef DEBUG
16 printk("%s: %p %p %p %p\n", __func__, frD, frB); 18 printk("%s: %p %p %p %p\n", __func__, frD, frB);
17#endif 19#endif
18 20
19 __FP_UNPACK_D(B, frB); 21 FP_UNPACK_DP(B, frB);
20 22
21#ifdef DEBUG 23#ifdef DEBUG
22 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c); 24 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
@@ -33,5 +35,7 @@ fsqrt(void *frD, void *frB)
33 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 35 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
34#endif 36#endif
35 37
36 return (ret | __FP_PACK_D(frD, R)); 38 __FP_PACK_D(frD, R);
39
40 return FP_CUR_EXCEPTIONS;
37} 41}
diff --git a/arch/powerpc/math-emu/fsqrts.c b/arch/powerpc/math-emu/fsqrts.c
index 335263e06ee5..2843be986e2e 100644
--- a/arch/powerpc/math-emu/fsqrts.c
+++ b/arch/powerpc/math-emu/fsqrts.c
@@ -2,22 +2,24 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fsqrts(void *frD, void *frB) 11fsqrts(void *frD, void *frB)
11{ 12{
12 FP_DECL_D(B); 13 FP_DECL_D(B);
13 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX;
14 int ret = 0; 16 int ret = 0;
15 17
16#ifdef DEBUG 18#ifdef DEBUG
17 printk("%s: %p %p %p %p\n", __func__, frD, frB); 19 printk("%s: %p %p %p %p\n", __func__, frD, frB);
18#endif 20#endif
19 21
20 __FP_UNPACK_D(B, frB); 22 FP_UNPACK_DP(B, frB);
21 23
22#ifdef DEBUG 24#ifdef DEBUG
23 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c); 25 printk("B: %ld %lu %lu %ld (%ld)\n", B_s, B_f1, B_f0, B_e, B_c);
@@ -34,5 +36,7 @@ fsqrts(void *frD, void *frB)
34 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 36 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
35#endif 37#endif
36 38
37 return (ret | __FP_PACK_DS(frD, R)); 39 __FP_PACK_DS(frD, R);
40
41 return FP_CUR_EXCEPTIONS;
38} 42}
diff --git a/arch/powerpc/math-emu/fsub.c b/arch/powerpc/math-emu/fsub.c
index 208d20fc52a5..78b09446a0e1 100644
--- a/arch/powerpc/math-emu/fsub.c
+++ b/arch/powerpc/math-emu/fsub.c
@@ -2,8 +2,9 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
7 8
8int 9int
9fsub(void *frD, void *frA, void *frB) 10fsub(void *frD, void *frA, void *frB)
@@ -11,14 +12,15 @@ fsub(void *frD, void *frA, void *frB)
11 FP_DECL_D(A); 12 FP_DECL_D(A);
12 FP_DECL_D(B); 13 FP_DECL_D(B);
13 FP_DECL_D(R); 14 FP_DECL_D(R);
15 FP_DECL_EX;
14 int ret = 0; 16 int ret = 0;
15 17
16#ifdef DEBUG 18#ifdef DEBUG
17 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 19 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
18#endif 20#endif
19 21
20 __FP_UNPACK_D(A, frA); 22 FP_UNPACK_DP(A, frA);
21 __FP_UNPACK_D(B, frB); 23 FP_UNPACK_DP(B, frB);
22 24
23#ifdef DEBUG 25#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 26 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -37,5 +39,7 @@ fsub(void *frD, void *frA, void *frB)
37 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 39 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
38#endif 40#endif
39 41
40 return (ret | __FP_PACK_D(frD, R)); 42 __FP_PACK_D(frD, R);
43
44 return FP_CUR_EXCEPTIONS;
41} 45}
diff --git a/arch/powerpc/math-emu/fsubs.c b/arch/powerpc/math-emu/fsubs.c
index 0e61b808c44b..d3bf90863cf2 100644
--- a/arch/powerpc/math-emu/fsubs.c
+++ b/arch/powerpc/math-emu/fsubs.c
@@ -2,9 +2,10 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10fsubs(void *frD, void *frA, void *frB) 11fsubs(void *frD, void *frA, void *frB)
@@ -12,14 +13,15 @@ fsubs(void *frD, void *frA, void *frB)
12 FP_DECL_D(A); 13 FP_DECL_D(A);
13 FP_DECL_D(B); 14 FP_DECL_D(B);
14 FP_DECL_D(R); 15 FP_DECL_D(R);
16 FP_DECL_EX;
15 int ret = 0; 17 int ret = 0;
16 18
17#ifdef DEBUG 19#ifdef DEBUG
18 printk("%s: %p %p %p\n", __func__, frD, frA, frB); 20 printk("%s: %p %p %p\n", __func__, frD, frA, frB);
19#endif 21#endif
20 22
21 __FP_UNPACK_D(A, frA); 23 FP_UNPACK_DP(A, frA);
22 __FP_UNPACK_D(B, frB); 24 FP_UNPACK_DP(B, frB);
23 25
24#ifdef DEBUG 26#ifdef DEBUG
25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -38,5 +40,7 @@ fsubs(void *frD, void *frA, void *frB)
38 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 40 printk("D: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
39#endif 41#endif
40 42
41 return (ret | __FP_PACK_DS(frD, R)); 43 __FP_PACK_DS(frD, R);
44
45 return FP_CUR_EXCEPTIONS;
42} 46}
diff --git a/arch/powerpc/math-emu/lfd.c b/arch/powerpc/math-emu/lfd.c
index 6ec90b57c61a..79ac76d596c3 100644
--- a/arch/powerpc/math-emu/lfd.c
+++ b/arch/powerpc/math-emu/lfd.c
@@ -2,8 +2,8 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "sfp-machine.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/double.h>
7 7
8int 8int
9lfd(void *frD, void *ea) 9lfd(void *frD, void *ea)
diff --git a/arch/powerpc/math-emu/lfs.c b/arch/powerpc/math-emu/lfs.c
index 6f18ebe3a7ff..434ed27be8db 100644
--- a/arch/powerpc/math-emu/lfs.c
+++ b/arch/powerpc/math-emu/lfs.c
@@ -2,15 +2,17 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10lfs(void *frD, void *ea) 11lfs(void *frD, void *ea)
11{ 12{
12 FP_DECL_D(R); 13 FP_DECL_D(R);
13 FP_DECL_S(A); 14 FP_DECL_S(A);
15 FP_DECL_EX;
14 float f; 16 float f;
15 17
16#ifdef DEBUG 18#ifdef DEBUG
@@ -20,7 +22,7 @@ lfs(void *frD, void *ea)
20 if (copy_from_user(&f, ea, sizeof(float))) 22 if (copy_from_user(&f, ea, sizeof(float)))
21 return -EFAULT; 23 return -EFAULT;
22 24
23 __FP_UNPACK_S(A, &f); 25 FP_UNPACK_S(A, f);
24 26
25#ifdef DEBUG 27#ifdef DEBUG
26 printk("A: %ld %lu %ld (%ld) [%08lx]\n", A_s, A_f, A_e, A_c, 28 printk("A: %ld %lu %ld (%ld) [%08lx]\n", A_s, A_f, A_e, A_c,
@@ -33,5 +35,12 @@ lfs(void *frD, void *ea)
33 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c); 35 printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
34#endif 36#endif
35 37
36 return __FP_PACK_D(frD, R); 38 if (R_c == FP_CLS_NAN) {
39 R_e = _FP_EXPMAX_D;
40 _FP_PACK_RAW_2_P(D, frD, R);
41 } else {
42 __FP_PACK_D(frD, R);
43 }
44
45 return 0;
37} 46}
diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c
index 29e545e0272e..164d55935bd8 100644
--- a/arch/powerpc/math-emu/math.c
+++ b/arch/powerpc/math-emu/math.c
@@ -8,8 +8,8 @@
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9#include <asm/reg.h> 9#include <asm/reg.h>
10 10
11#include "sfp-machine.h" 11#include <asm/sfp-machine.h>
12#include "double.h" 12#include <math-emu/double.h>
13 13
14#define FLOATFUNC(x) extern int x(void *, void *, void *, void *) 14#define FLOATFUNC(x) extern int x(void *, void *, void *, void *)
15 15
@@ -168,6 +168,8 @@ record_exception(struct pt_regs *regs, int eflag)
168 fpscr |= FPSCR_ZX; 168 fpscr |= FPSCR_ZX;
169 if (eflag & EFLAG_INEXACT) 169 if (eflag & EFLAG_INEXACT)
170 fpscr |= FPSCR_XX; 170 fpscr |= FPSCR_XX;
171 if (eflag & EFLAG_INVALID)
172 fpscr |= FPSCR_VX;
171 if (eflag & EFLAG_VXSNAN) 173 if (eflag & EFLAG_VXSNAN)
172 fpscr |= FPSCR_VXSNAN; 174 fpscr |= FPSCR_VXSNAN;
173 if (eflag & EFLAG_VXISI) 175 if (eflag & EFLAG_VXISI)
@@ -188,7 +190,7 @@ record_exception(struct pt_regs *regs, int eflag)
188 fpscr |= FPSCR_VXCVI; 190 fpscr |= FPSCR_VXCVI;
189 } 191 }
190 192
191 fpscr &= ~(FPSCR_VX); 193// fpscr &= ~(FPSCR_VX);
192 if (fpscr & (FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI | 194 if (fpscr & (FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI |
193 FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC | 195 FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC |
194 FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI)) 196 FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI))
diff --git a/arch/powerpc/math-emu/mcrfs.c b/arch/powerpc/math-emu/mcrfs.c
index 41ba247faf89..e948d5708e2b 100644
--- a/arch/powerpc/math-emu/mcrfs.c
+++ b/arch/powerpc/math-emu/mcrfs.c
@@ -2,7 +2,8 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include <math-emu/soft-fp.h>
6 7
7int 8int
8mcrfs(u32 *ccr, u32 crfD, u32 crfS) 9mcrfs(u32 *ccr, u32 crfD, u32 crfS)
diff --git a/arch/powerpc/math-emu/mffs.c b/arch/powerpc/math-emu/mffs.c
index b0e2106e6eb6..5526cf96ede5 100644
--- a/arch/powerpc/math-emu/mffs.c
+++ b/arch/powerpc/math-emu/mffs.c
@@ -2,7 +2,8 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include <math-emu/soft-fp.h>
6 7
7int 8int
8mffs(u32 *frD) 9mffs(u32 *frD)
diff --git a/arch/powerpc/math-emu/mtfsb0.c b/arch/powerpc/math-emu/mtfsb0.c
index d3062350ea21..bc985585bca8 100644
--- a/arch/powerpc/math-emu/mtfsb0.c
+++ b/arch/powerpc/math-emu/mtfsb0.c
@@ -2,7 +2,8 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include <math-emu/soft-fp.h>
6 7
7int 8int
8mtfsb0(int crbD) 9mtfsb0(int crbD)
diff --git a/arch/powerpc/math-emu/mtfsb1.c b/arch/powerpc/math-emu/mtfsb1.c
index 2e948704b56e..fe6ed5ac85b3 100644
--- a/arch/powerpc/math-emu/mtfsb1.c
+++ b/arch/powerpc/math-emu/mtfsb1.c
@@ -2,7 +2,8 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include <math-emu/soft-fp.h>
6 7
7int 8int
8mtfsb1(int crbD) 9mtfsb1(int crbD)
diff --git a/arch/powerpc/math-emu/mtfsf.c b/arch/powerpc/math-emu/mtfsf.c
index 48014d8e3af1..dbce92e4f046 100644
--- a/arch/powerpc/math-emu/mtfsf.c
+++ b/arch/powerpc/math-emu/mtfsf.c
@@ -2,12 +2,14 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include <math-emu/soft-fp.h>
6 7
7int 8int
8mtfsf(unsigned int FM, u32 *frB) 9mtfsf(unsigned int FM, u32 *frB)
9{ 10{
10 u32 mask; 11 u32 mask;
12 u32 fpscr;
11 13
12 if (FM == 0) 14 if (FM == 0)
13 return 0; 15 return 0;
@@ -37,6 +39,22 @@ mtfsf(unsigned int FM, u32 *frB)
37 __FPU_FPSCR &= ~(mask); 39 __FPU_FPSCR &= ~(mask);
38 __FPU_FPSCR |= (frB[1] & mask); 40 __FPU_FPSCR |= (frB[1] & mask);
39 41
42 __FPU_FPSCR &= ~(FPSCR_VX);
43 if (__FPU_FPSCR & (FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI |
44 FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC |
45 FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI))
46 __FPU_FPSCR |= FPSCR_VX;
47
48 fpscr = __FPU_FPSCR;
49 fpscr &= ~(FPSCR_FEX);
50 if (((fpscr & FPSCR_VX) && (fpscr & FPSCR_VE)) ||
51 ((fpscr & FPSCR_OX) && (fpscr & FPSCR_OE)) ||
52 ((fpscr & FPSCR_UX) && (fpscr & FPSCR_UE)) ||
53 ((fpscr & FPSCR_ZX) && (fpscr & FPSCR_ZE)) ||
54 ((fpscr & FPSCR_XX) && (fpscr & FPSCR_XE)))
55 fpscr |= FPSCR_FEX;
56 __FPU_FPSCR = fpscr;
57
40#ifdef DEBUG 58#ifdef DEBUG
41 printk("%s: %02x %p: %08lx\n", __func__, FM, frB, __FPU_FPSCR); 59 printk("%s: %02x %p: %08lx\n", __func__, FM, frB, __FPU_FPSCR);
42#endif 60#endif
diff --git a/arch/powerpc/math-emu/mtfsfi.c b/arch/powerpc/math-emu/mtfsfi.c
index 031e20093549..fd2acc26813b 100644
--- a/arch/powerpc/math-emu/mtfsfi.c
+++ b/arch/powerpc/math-emu/mtfsfi.c
@@ -2,7 +2,8 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include <math-emu/soft-fp.h>
6 7
7int 8int
8mtfsfi(unsigned int crfD, unsigned int IMM) 9mtfsfi(unsigned int crfD, unsigned int IMM)
diff --git a/arch/powerpc/math-emu/op-1.h b/arch/powerpc/math-emu/op-1.h
deleted file mode 100644
index c92fa95f562e..000000000000
--- a/arch/powerpc/math-emu/op-1.h
+++ /dev/null
@@ -1,245 +0,0 @@
1/*
2 * Basic one-word fraction declaration and manipulation.
3 */
4
5#define _FP_FRAC_DECL_1(X) _FP_W_TYPE X##_f
6#define _FP_FRAC_COPY_1(D,S) (D##_f = S##_f)
7#define _FP_FRAC_SET_1(X,I) (X##_f = I)
8#define _FP_FRAC_HIGH_1(X) (X##_f)
9#define _FP_FRAC_LOW_1(X) (X##_f)
10#define _FP_FRAC_WORD_1(X,w) (X##_f)
11
12#define _FP_FRAC_ADDI_1(X,I) (X##_f += I)
13#define _FP_FRAC_SLL_1(X,N) \
14 do { \
15 if (__builtin_constant_p(N) && (N) == 1) \
16 X##_f += X##_f; \
17 else \
18 X##_f <<= (N); \
19 } while (0)
20#define _FP_FRAC_SRL_1(X,N) (X##_f >>= N)
21
22/* Right shift with sticky-lsb. */
23#define _FP_FRAC_SRS_1(X,N,sz) __FP_FRAC_SRS_1(X##_f, N, sz)
24
25#define __FP_FRAC_SRS_1(X,N,sz) \
26 (X = (X >> (N) | (__builtin_constant_p(N) && (N) == 1 \
27 ? X & 1 : (X << (_FP_W_TYPE_SIZE - (N))) != 0)))
28
29#define _FP_FRAC_ADD_1(R,X,Y) (R##_f = X##_f + Y##_f)
30#define _FP_FRAC_SUB_1(R,X,Y) (R##_f = X##_f - Y##_f)
31#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ(z, X##_f)
32
33/* Predicates */
34#define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE)X##_f < 0)
35#define _FP_FRAC_ZEROP_1(X) (X##_f == 0)
36#define _FP_FRAC_OVERP_1(fs,X) (X##_f & _FP_OVERFLOW_##fs)
37#define _FP_FRAC_EQ_1(X, Y) (X##_f == Y##_f)
38#define _FP_FRAC_GE_1(X, Y) (X##_f >= Y##_f)
39#define _FP_FRAC_GT_1(X, Y) (X##_f > Y##_f)
40
41#define _FP_ZEROFRAC_1 0
42#define _FP_MINFRAC_1 1
43
44/*
45 * Unpack the raw bits of a native fp value. Do not classify or
46 * normalize the data.
47 */
48
49#define _FP_UNPACK_RAW_1(fs, X, val) \
50 do { \
51 union _FP_UNION_##fs _flo; _flo.flt = (val); \
52 \
53 X##_f = _flo.bits.frac; \
54 X##_e = _flo.bits.exp; \
55 X##_s = _flo.bits.sign; \
56 } while (0)
57
58
59/*
60 * Repack the raw bits of a native fp value.
61 */
62
63#define _FP_PACK_RAW_1(fs, val, X) \
64 do { \
65 union _FP_UNION_##fs _flo; \
66 \
67 _flo.bits.frac = X##_f; \
68 _flo.bits.exp = X##_e; \
69 _flo.bits.sign = X##_s; \
70 \
71 (val) = _flo.flt; \
72 } while (0)
73
74
75/*
76 * Multiplication algorithms:
77 */
78
79/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
80 multiplication immediately. */
81
82#define _FP_MUL_MEAT_1_imm(fs, R, X, Y) \
83 do { \
84 R##_f = X##_f * Y##_f; \
85 /* Normalize since we know where the msb of the multiplicands \
86 were (bit B), we know that the msb of the of the product is \
87 at either 2B or 2B-1. */ \
88 _FP_FRAC_SRS_1(R, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs); \
89 } while (0)
90
91/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
92
93#define _FP_MUL_MEAT_1_wide(fs, R, X, Y, doit) \
94 do { \
95 _FP_W_TYPE _Z_f0, _Z_f1; \
96 doit(_Z_f1, _Z_f0, X##_f, Y##_f); \
97 /* Normalize since we know where the msb of the multiplicands \
98 were (bit B), we know that the msb of the of the product is \
99 at either 2B or 2B-1. */ \
100 _FP_FRAC_SRS_2(_Z, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs); \
101 R##_f = _Z_f0; \
102 } while (0)
103
104/* Finally, a simple widening multiply algorithm. What fun! */
105
106#define _FP_MUL_MEAT_1_hard(fs, R, X, Y) \
107 do { \
108 _FP_W_TYPE _xh, _xl, _yh, _yl, _z_f0, _z_f1, _a_f0, _a_f1; \
109 \
110 /* split the words in half */ \
111 _xh = X##_f >> (_FP_W_TYPE_SIZE/2); \
112 _xl = X##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
113 _yh = Y##_f >> (_FP_W_TYPE_SIZE/2); \
114 _yl = Y##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
115 \
116 /* multiply the pieces */ \
117 _z_f0 = _xl * _yl; \
118 _a_f0 = _xh * _yl; \
119 _a_f1 = _xl * _yh; \
120 _z_f1 = _xh * _yh; \
121 \
122 /* reassemble into two full words */ \
123 if ((_a_f0 += _a_f1) < _a_f1) \
124 _z_f1 += (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2); \
125 _a_f1 = _a_f0 >> (_FP_W_TYPE_SIZE/2); \
126 _a_f0 = _a_f0 << (_FP_W_TYPE_SIZE/2); \
127 _FP_FRAC_ADD_2(_z, _z, _a); \
128 \
129 /* normalize */ \
130 _FP_FRAC_SRS_2(_z, _FP_WFRACBITS_##fs - 1, 2*_FP_WFRACBITS_##fs); \
131 R##_f = _z_f0; \
132 } while (0)
133
134
135/*
136 * Division algorithms:
137 */
138
139/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
140 division immediately. Give this macro either _FP_DIV_HELP_imm for
141 C primitives or _FP_DIV_HELP_ldiv for the ISO function. Which you
142 choose will depend on what the compiler does with divrem4. */
143
144#define _FP_DIV_MEAT_1_imm(fs, R, X, Y, doit) \
145 do { \
146 _FP_W_TYPE _q, _r; \
147 X##_f <<= (X##_f < Y##_f \
148 ? R##_e--, _FP_WFRACBITS_##fs \
149 : _FP_WFRACBITS_##fs - 1); \
150 doit(_q, _r, X##_f, Y##_f); \
151 R##_f = _q | (_r != 0); \
152 } while (0)
153
154/* GCC's longlong.h defines a 2W / 1W => (1W,1W) primitive udiv_qrnnd
155 that may be useful in this situation. This first is for a primitive
156 that requires normalization, the second for one that does not. Look
157 for UDIV_NEEDS_NORMALIZATION to tell which your machine needs. */
158
159#define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y) \
160 do { \
161 _FP_W_TYPE _nh, _nl, _q, _r; \
162 \
163 /* Normalize Y -- i.e. make the most significant bit set. */ \
164 Y##_f <<= _FP_WFRACXBITS_##fs - 1; \
165 \
166 /* Shift X op correspondingly high, that is, up one full word. */ \
167 if (X##_f <= Y##_f) \
168 { \
169 _nl = 0; \
170 _nh = X##_f; \
171 } \
172 else \
173 { \
174 R##_e++; \
175 _nl = X##_f << (_FP_W_TYPE_SIZE-1); \
176 _nh = X##_f >> 1; \
177 } \
178 \
179 udiv_qrnnd(_q, _r, _nh, _nl, Y##_f); \
180 R##_f = _q | (_r != 0); \
181 } while (0)
182
183#define _FP_DIV_MEAT_1_udiv(fs, R, X, Y) \
184 do { \
185 _FP_W_TYPE _nh, _nl, _q, _r; \
186 if (X##_f < Y##_f) \
187 { \
188 R##_e--; \
189 _nl = X##_f << _FP_WFRACBITS_##fs; \
190 _nh = X##_f >> _FP_WFRACXBITS_##fs; \
191 } \
192 else \
193 { \
194 _nl = X##_f << (_FP_WFRACBITS_##fs - 1); \
195 _nh = X##_f >> (_FP_WFRACXBITS_##fs + 1); \
196 } \
197 udiv_qrnnd(_q, _r, _nh, _nl, Y##_f); \
198 R##_f = _q | (_r != 0); \
199 } while (0)
200
201
202/*
203 * Square root algorithms:
204 * We have just one right now, maybe Newton approximation
205 * should be added for those machines where division is fast.
206 */
207
208#define _FP_SQRT_MEAT_1(R, S, T, X, q) \
209 do { \
210 while (q) \
211 { \
212 T##_f = S##_f + q; \
213 if (T##_f <= X##_f) \
214 { \
215 S##_f = T##_f + q; \
216 X##_f -= T##_f; \
217 R##_f += q; \
218 } \
219 _FP_FRAC_SLL_1(X, 1); \
220 q >>= 1; \
221 } \
222 } while (0)
223
224/*
225 * Assembly/disassembly for converting to/from integral types.
226 * No shifting or overflow handled here.
227 */
228
229#define _FP_FRAC_ASSEMBLE_1(r, X, rsize) (r = X##_f)
230#define _FP_FRAC_DISASSEMBLE_1(X, r, rsize) (X##_f = r)
231
232
233/*
234 * Convert FP values between word sizes
235 */
236
237#define _FP_FRAC_CONV_1_1(dfs, sfs, D, S) \
238 do { \
239 D##_f = S##_f; \
240 if (_FP_WFRACBITS_##sfs > _FP_WFRACBITS_##dfs) \
241 _FP_FRAC_SRS_1(D, (_FP_WFRACBITS_##sfs-_FP_WFRACBITS_##dfs), \
242 _FP_WFRACBITS_##sfs); \
243 else \
244 D##_f <<= _FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs; \
245 } while (0)
diff --git a/arch/powerpc/math-emu/op-2.h b/arch/powerpc/math-emu/op-2.h
deleted file mode 100644
index 7d6f17cc2929..000000000000
--- a/arch/powerpc/math-emu/op-2.h
+++ /dev/null
@@ -1,434 +0,0 @@
1/*
2 * Basic two-word fraction declaration and manipulation.
3 */
4
5#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1
6#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
7#define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I)
8#define _FP_FRAC_HIGH_2(X) (X##_f1)
9#define _FP_FRAC_LOW_2(X) (X##_f0)
10#define _FP_FRAC_WORD_2(X,w) (X##_f##w)
11
12#define _FP_FRAC_SLL_2(X,N) \
13 do { \
14 if ((N) < _FP_W_TYPE_SIZE) \
15 { \
16 if (__builtin_constant_p(N) && (N) == 1) \
17 { \
18 X##_f1 = X##_f1 + X##_f1 + (((_FP_WS_TYPE)(X##_f0)) < 0); \
19 X##_f0 += X##_f0; \
20 } \
21 else \
22 { \
23 X##_f1 = X##_f1 << (N) | X##_f0 >> (_FP_W_TYPE_SIZE - (N)); \
24 X##_f0 <<= (N); \
25 } \
26 } \
27 else \
28 { \
29 X##_f1 = X##_f0 << ((N) - _FP_W_TYPE_SIZE); \
30 X##_f0 = 0; \
31 } \
32 } while (0)
33
34#define _FP_FRAC_SRL_2(X,N) \
35 do { \
36 if ((N) < _FP_W_TYPE_SIZE) \
37 { \
38 X##_f0 = X##_f0 >> (N) | X##_f1 << (_FP_W_TYPE_SIZE - (N)); \
39 X##_f1 >>= (N); \
40 } \
41 else \
42 { \
43 X##_f0 = X##_f1 >> ((N) - _FP_W_TYPE_SIZE); \
44 X##_f1 = 0; \
45 } \
46 } while (0)
47
48/* Right shift with sticky-lsb. */
49#define _FP_FRAC_SRS_2(X,N,sz) \
50 do { \
51 if ((N) < _FP_W_TYPE_SIZE) \
52 { \
53 X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) | \
54 (__builtin_constant_p(N) && (N) == 1 \
55 ? X##_f0 & 1 \
56 : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
57 X##_f1 >>= (N); \
58 } \
59 else \
60 { \
61 X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) | \
62 (((X##_f1 << (2 * _FP_W_TYPE_SIZE - (N))) | \
63 X##_f0) != 0)); \
64 X##_f1 = 0; \
65 } \
66 } while (0)
67
68#define _FP_FRAC_ADDI_2(X,I) \
69 __FP_FRAC_ADDI_2(X##_f1, X##_f0, I)
70
71#define _FP_FRAC_ADD_2(R,X,Y) \
72 __FP_FRAC_ADD_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
73
74#define _FP_FRAC_SUB_2(R,X,Y) \
75 __FP_FRAC_SUB_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
76
77#define _FP_FRAC_CLZ_2(R,X) \
78 do { \
79 if (X##_f1) \
80 __FP_CLZ(R,X##_f1); \
81 else \
82 { \
83 __FP_CLZ(R,X##_f0); \
84 R += _FP_W_TYPE_SIZE; \
85 } \
86 } while(0)
87
88/* Predicates */
89#define _FP_FRAC_NEGP_2(X) ((_FP_WS_TYPE)X##_f1 < 0)
90#define _FP_FRAC_ZEROP_2(X) ((X##_f1 | X##_f0) == 0)
91#define _FP_FRAC_OVERP_2(fs,X) (X##_f1 & _FP_OVERFLOW_##fs)
92#define _FP_FRAC_EQ_2(X, Y) (X##_f1 == Y##_f1 && X##_f0 == Y##_f0)
93#define _FP_FRAC_GT_2(X, Y) \
94 ((X##_f1 > Y##_f1) || (X##_f1 == Y##_f1 && X##_f0 > Y##_f0))
95#define _FP_FRAC_GE_2(X, Y) \
96 ((X##_f1 > Y##_f1) || (X##_f1 == Y##_f1 && X##_f0 >= Y##_f0))
97
98#define _FP_ZEROFRAC_2 0, 0
99#define _FP_MINFRAC_2 0, 1
100
101/*
102 * Internals
103 */
104
105#define __FP_FRAC_SET_2(X,I1,I0) (X##_f0 = I0, X##_f1 = I1)
106
107#define __FP_CLZ_2(R, xh, xl) \
108 do { \
109 if (xh) \
110 __FP_CLZ(R,xl); \
111 else \
112 { \
113 __FP_CLZ(R,xl); \
114 R += _FP_W_TYPE_SIZE; \
115 } \
116 } while(0)
117
118#if 0
119
120#ifndef __FP_FRAC_ADDI_2
121#define __FP_FRAC_ADDI_2(xh, xl, i) \
122 (xh += ((xl += i) < i))
123#endif
124#ifndef __FP_FRAC_ADD_2
125#define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \
126 (rh = xh + yh + ((rl = xl + yl) < xl))
127#endif
128#ifndef __FP_FRAC_SUB_2
129#define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \
130 (rh = xh - yh - ((rl = xl - yl) > xl))
131#endif
132
133#else
134
135#undef __FP_FRAC_ADDI_2
136#define __FP_FRAC_ADDI_2(xh, xl, i) add_ssaaaa(xh, xl, xh, xl, 0, i)
137#undef __FP_FRAC_ADD_2
138#define __FP_FRAC_ADD_2 add_ssaaaa
139#undef __FP_FRAC_SUB_2
140#define __FP_FRAC_SUB_2 sub_ddmmss
141
142#endif
143
144/*
145 * Unpack the raw bits of a native fp value. Do not classify or
146 * normalize the data.
147 */
148
149#define _FP_UNPACK_RAW_2(fs, X, val) \
150 do { \
151 union _FP_UNION_##fs _flo; _flo.flt = (val); \
152 \
153 X##_f0 = _flo.bits.frac0; \
154 X##_f1 = _flo.bits.frac1; \
155 X##_e = _flo.bits.exp; \
156 X##_s = _flo.bits.sign; \
157 } while (0)
158
159
160/*
161 * Repack the raw bits of a native fp value.
162 */
163
164#define _FP_PACK_RAW_2(fs, val, X) \
165 do { \
166 union _FP_UNION_##fs _flo; \
167 \
168 _flo.bits.frac0 = X##_f0; \
169 _flo.bits.frac1 = X##_f1; \
170 _flo.bits.exp = X##_e; \
171 _flo.bits.sign = X##_s; \
172 \
173 (val) = _flo.flt; \
174 } while (0)
175
176
177/*
178 * Multiplication algorithms:
179 */
180
181/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
182
183#define _FP_MUL_MEAT_2_wide(fs, R, X, Y, doit) \
184 do { \
185 _FP_FRAC_DECL_4(_z); _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \
186 \
187 doit(_FP_FRAC_WORD_4(_z,1), _FP_FRAC_WORD_4(_z,0), X##_f0, Y##_f0); \
188 doit(_b_f1, _b_f0, X##_f0, Y##_f1); \
189 doit(_c_f1, _c_f0, X##_f1, Y##_f0); \
190 doit(_FP_FRAC_WORD_4(_z,3), _FP_FRAC_WORD_4(_z,2), X##_f1, Y##_f1); \
191 \
192 __FP_FRAC_ADD_4(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
193 _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0), \
194 0, _b_f1, _b_f0, 0, \
195 _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
196 _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0)); \
197 __FP_FRAC_ADD_4(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
198 _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0), \
199 0, _c_f1, _c_f0, 0, \
200 _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
201 _FP_FRAC_WORD_4(_z,1),_FP_FRAC_WORD_4(_z,0)); \
202 \
203 /* Normalize since we know where the msb of the multiplicands \
204 were (bit B), we know that the msb of the of the product is \
205 at either 2B or 2B-1. */ \
206 _FP_FRAC_SRS_4(_z, _FP_WFRACBITS_##fs-1, 2*_FP_WFRACBITS_##fs); \
207 R##_f0 = _FP_FRAC_WORD_4(_z,0); \
208 R##_f1 = _FP_FRAC_WORD_4(_z,1); \
209 } while (0)
210
211/* This next macro appears to be totally broken. Fortunately nowhere
212 * seems to use it :-> The problem is that we define _z[4] but
213 * then use it in _FP_FRAC_SRS_4, which will attempt to access
214 * _z_f[n] which will cause an error. The fix probably involves
215 * declaring it with _FP_FRAC_DECL_4, see previous macro. -- PMM 02/1998
216 */
217#define _FP_MUL_MEAT_2_gmp(fs, R, X, Y) \
218 do { \
219 _FP_W_TYPE _x[2], _y[2], _z[4]; \
220 _x[0] = X##_f0; _x[1] = X##_f1; \
221 _y[0] = Y##_f0; _y[1] = Y##_f1; \
222 \
223 mpn_mul_n(_z, _x, _y, 2); \
224 \
225 /* Normalize since we know where the msb of the multiplicands \
226 were (bit B), we know that the msb of the of the product is \
227 at either 2B or 2B-1. */ \
228 _FP_FRAC_SRS_4(_z, _FP_WFRACBITS##_fs-1, 2*_FP_WFRACBITS_##fs); \
229 R##_f0 = _z[0]; \
230 R##_f1 = _z[1]; \
231 } while (0)
232
233
234/*
235 * Division algorithms:
236 * This seems to be giving me difficulties -- PMM
237 * Look, NetBSD seems to be able to comment algorithms. Can't you?
238 * I've thrown printks at the problem.
239 * This now appears to work, but I still don't really know why.
240 * Also, I don't think the result is properly normalised...
241 */
242
243#define _FP_DIV_MEAT_2_udiv_64(fs, R, X, Y) \
244 do { \
245 extern void _fp_udivmodti4(_FP_W_TYPE q[2], _FP_W_TYPE r[2], \
246 _FP_W_TYPE n1, _FP_W_TYPE n0, \
247 _FP_W_TYPE d1, _FP_W_TYPE d0); \
248 _FP_W_TYPE _n_f3, _n_f2, _n_f1, _n_f0, _r_f1, _r_f0; \
249 _FP_W_TYPE _q_f1, _q_f0, _m_f1, _m_f0; \
250 _FP_W_TYPE _rmem[2], _qmem[2]; \
251 /* I think this check is to ensure that the result is normalised. \
252 * Assuming X,Y normalised (ie in [1.0,2.0)) X/Y will be in \
253 * [0.5,2.0). Furthermore, it will be less than 1.0 iff X < Y. \
254 * In this case we tweak things. (this is based on comments in \
255 * the NetBSD FPU emulation code. ) \
256 * We know X,Y are normalised because we ensure this as part of \
257 * the unpacking process. -- PMM \
258 */ \
259 if (_FP_FRAC_GT_2(X, Y)) \
260 { \
261/* R##_e++; */ \
262 _n_f3 = X##_f1 >> 1; \
263 _n_f2 = X##_f1 << (_FP_W_TYPE_SIZE - 1) | X##_f0 >> 1; \
264 _n_f1 = X##_f0 << (_FP_W_TYPE_SIZE - 1); \
265 _n_f0 = 0; \
266 } \
267 else \
268 { \
269 R##_e--; \
270 _n_f3 = X##_f1; \
271 _n_f2 = X##_f0; \
272 _n_f1 = _n_f0 = 0; \
273 } \
274 \
275 /* Normalize, i.e. make the most significant bit of the \
276 denominator set. CHANGED: - 1 to nothing -- PMM */ \
277 _FP_FRAC_SLL_2(Y, _FP_WFRACXBITS_##fs /* -1 */); \
278 \
279 /* Do the 256/128 bit division given the 128-bit _fp_udivmodtf4 \
280 primitive snagged from libgcc2.c. */ \
281 \
282 _fp_udivmodti4(_qmem, _rmem, _n_f3, _n_f2, 0, Y##_f1); \
283 _q_f1 = _qmem[0]; \
284 umul_ppmm(_m_f1, _m_f0, _q_f1, Y##_f0); \
285 _r_f1 = _rmem[0]; \
286 _r_f0 = _n_f1; \
287 if (_FP_FRAC_GT_2(_m, _r)) \
288 { \
289 _q_f1--; \
290 _FP_FRAC_ADD_2(_r, _r, Y); \
291 if (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r)) \
292 { \
293 _q_f1--; \
294 _FP_FRAC_ADD_2(_r, _r, Y); \
295 } \
296 } \
297 _FP_FRAC_SUB_2(_r, _r, _m); \
298 \
299 _fp_udivmodti4(_qmem, _rmem, _r_f1, _r_f0, 0, Y##_f1); \
300 _q_f0 = _qmem[0]; \
301 umul_ppmm(_m_f1, _m_f0, _q_f0, Y##_f0); \
302 _r_f1 = _rmem[0]; \
303 _r_f0 = _n_f0; \
304 if (_FP_FRAC_GT_2(_m, _r)) \
305 { \
306 _q_f0--; \
307 _FP_FRAC_ADD_2(_r, _r, Y); \
308 if (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r)) \
309 { \
310 _q_f0--; \
311 _FP_FRAC_ADD_2(_r, _r, Y); \
312 } \
313 } \
314 _FP_FRAC_SUB_2(_r, _r, _m); \
315 \
316 R##_f1 = _q_f1; \
317 R##_f0 = _q_f0 | ((_r_f1 | _r_f0) != 0); \
318 /* adjust so answer is normalized again. I'm not sure what the \
319 * final sz param should be. In practice it's never used since \
320 * N is 1 which is always going to be < _FP_W_TYPE_SIZE... \
321 */ \
322 /* _FP_FRAC_SRS_2(R,1,_FP_WFRACBITS_##fs); */ \
323 } while (0)
324
325
326#define _FP_DIV_MEAT_2_gmp(fs, R, X, Y) \
327 do { \
328 _FP_W_TYPE _x[4], _y[2], _z[4]; \
329 _y[0] = Y##_f0; _y[1] = Y##_f1; \
330 _x[0] = _x[3] = 0; \
331 if (_FP_FRAC_GT_2(X, Y)) \
332 { \
333 R##_e++; \
334 _x[1] = (X##_f0 << (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE) | \
335 X##_f1 >> (_FP_W_TYPE_SIZE - \
336 (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE))); \
337 _x[2] = X##_f1 << (_FP_WFRACBITS-1 - _FP_W_TYPE_SIZE); \
338 } \
339 else \
340 { \
341 _x[1] = (X##_f0 << (_FP_WFRACBITS - _FP_W_TYPE_SIZE) | \
342 X##_f1 >> (_FP_W_TYPE_SIZE - \
343 (_FP_WFRACBITS - _FP_W_TYPE_SIZE))); \
344 _x[2] = X##_f1 << (_FP_WFRACBITS - _FP_W_TYPE_SIZE); \
345 } \
346 \
347 (void) mpn_divrem (_z, 0, _x, 4, _y, 2); \
348 R##_f1 = _z[1]; \
349 R##_f0 = _z[0] | ((_x[0] | _x[1]) != 0); \
350 } while (0)
351
352
353/*
354 * Square root algorithms:
355 * We have just one right now, maybe Newton approximation
356 * should be added for those machines where division is fast.
357 */
358
359#define _FP_SQRT_MEAT_2(R, S, T, X, q) \
360 do { \
361 while (q) \
362 { \
363 T##_f1 = S##_f1 + q; \
364 if (T##_f1 <= X##_f1) \
365 { \
366 S##_f1 = T##_f1 + q; \
367 X##_f1 -= T##_f1; \
368 R##_f1 += q; \
369 } \
370 _FP_FRAC_SLL_2(X, 1); \
371 q >>= 1; \
372 } \
373 q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
374 while (q) \
375 { \
376 T##_f0 = S##_f0 + q; \
377 T##_f1 = S##_f1; \
378 if (T##_f1 < X##_f1 || \
379 (T##_f1 == X##_f1 && T##_f0 < X##_f0)) \
380 { \
381 S##_f0 = T##_f0 + q; \
382 if (((_FP_WS_TYPE)T##_f0) < 0 && \
383 ((_FP_WS_TYPE)S##_f0) >= 0) \
384 S##_f1++; \
385 _FP_FRAC_SUB_2(X, X, T); \
386 R##_f0 += q; \
387 } \
388 _FP_FRAC_SLL_2(X, 1); \
389 q >>= 1; \
390 } \
391 } while (0)
392
393
394/*
395 * Assembly/disassembly for converting to/from integral types.
396 * No shifting or overflow handled here.
397 */
398
399#define _FP_FRAC_ASSEMBLE_2(r, X, rsize) \
400 do { \
401 if (rsize <= _FP_W_TYPE_SIZE) \
402 r = X##_f0; \
403 else \
404 { \
405 r = X##_f1; \
406 r <<= _FP_W_TYPE_SIZE; \
407 r += X##_f0; \
408 } \
409 } while (0)
410
411#define _FP_FRAC_DISASSEMBLE_2(X, r, rsize) \
412 do { \
413 X##_f0 = r; \
414 X##_f1 = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
415 } while (0)
416
417/*
418 * Convert FP values between word sizes
419 */
420
421#define _FP_FRAC_CONV_1_2(dfs, sfs, D, S) \
422 do { \
423 _FP_FRAC_SRS_2(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
424 _FP_WFRACBITS_##sfs); \
425 D##_f = S##_f0; \
426 } while (0)
427
428#define _FP_FRAC_CONV_2_1(dfs, sfs, D, S) \
429 do { \
430 D##_f0 = S##_f; \
431 D##_f1 = 0; \
432 _FP_FRAC_SLL_2(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
433 } while (0)
434
diff --git a/arch/powerpc/math-emu/op-4.h b/arch/powerpc/math-emu/op-4.h
deleted file mode 100644
index c9ae626070da..000000000000
--- a/arch/powerpc/math-emu/op-4.h
+++ /dev/null
@@ -1,317 +0,0 @@
1/*
2 * Basic four-word fraction declaration and manipulation.
3 *
4 * When adding quadword support for 32 bit machines, we need
5 * to be a little careful as double multiply uses some of these
6 * macros: (in op-2.h)
7 * _FP_MUL_MEAT_2_wide() uses _FP_FRAC_DECL_4, _FP_FRAC_WORD_4,
8 * _FP_FRAC_ADD_4, _FP_FRAC_SRS_4
9 * _FP_MUL_MEAT_2_gmp() uses _FP_FRAC_SRS_4 (and should use
10 * _FP_FRAC_DECL_4: it appears to be broken and is not used
11 * anywhere anyway. )
12 *
13 * I've now fixed all the macros that were here from the sparc64 code.
14 * [*none* of the shift macros were correct!] -- PMM 02/1998
15 *
16 * The only quadword stuff that remains to be coded is:
17 * 1) the conversion to/from ints, which requires
18 * that we check (in op-common.h) that the following do the right thing
19 * for quadwords: _FP_TO_INT(Q,4,r,X,rsz,rsg), _FP_FROM_INT(Q,4,X,r,rs,rt)
20 * 2) multiply, divide and sqrt, which require:
21 * _FP_MUL_MEAT_4_*(R,X,Y), _FP_DIV_MEAT_4_*(R,X,Y), _FP_SQRT_MEAT_4(R,S,T,X,q),
22 * This also needs _FP_MUL_MEAT_Q and _FP_DIV_MEAT_Q to be defined to
23 * some suitable _FP_MUL_MEAT_4_* macros in sfp-machine.h.
24 * [we're free to choose whatever FP_MUL_MEAT_4_* macros we need for
25 * these; they are used nowhere else. ]
26 */
27
28#define _FP_FRAC_DECL_4(X) _FP_W_TYPE X##_f[4]
29#define _FP_FRAC_COPY_4(D,S) \
30 (D##_f[0] = S##_f[0], D##_f[1] = S##_f[1], \
31 D##_f[2] = S##_f[2], D##_f[3] = S##_f[3])
32/* The _FP_FRAC_SET_n(X,I) macro is intended for use with another
33 * macro such as _FP_ZEROFRAC_n which returns n comma separated values.
34 * The result is that we get an expansion of __FP_FRAC_SET_n(X,I0,I1,I2,I3)
35 * which just assigns the In values to the array X##_f[].
36 * This is why the number of parameters doesn't appear to match
37 * at first glance... -- PMM
38 */
39#define _FP_FRAC_SET_4(X,I) __FP_FRAC_SET_4(X, I)
40#define _FP_FRAC_HIGH_4(X) (X##_f[3])
41#define _FP_FRAC_LOW_4(X) (X##_f[0])
42#define _FP_FRAC_WORD_4(X,w) (X##_f[w])
43
44#define _FP_FRAC_SLL_4(X,N) \
45 do { \
46 _FP_I_TYPE _up, _down, _skip, _i; \
47 _skip = (N) / _FP_W_TYPE_SIZE; \
48 _up = (N) % _FP_W_TYPE_SIZE; \
49 _down = _FP_W_TYPE_SIZE - _up; \
50 for (_i = 3; _i > _skip; --_i) \
51 X##_f[_i] = X##_f[_i-_skip] << _up | X##_f[_i-_skip-1] >> _down; \
52/* bugfixed: was X##_f[_i] <<= _up; -- PMM 02/1998 */ \
53 X##_f[_i] = X##_f[0] << _up; \
54 for (--_i; _i >= 0; --_i) \
55 X##_f[_i] = 0; \
56 } while (0)
57
58/* This one was broken too */
59#define _FP_FRAC_SRL_4(X,N) \
60 do { \
61 _FP_I_TYPE _up, _down, _skip, _i; \
62 _skip = (N) / _FP_W_TYPE_SIZE; \
63 _down = (N) % _FP_W_TYPE_SIZE; \
64 _up = _FP_W_TYPE_SIZE - _down; \
65 for (_i = 0; _i < 3-_skip; ++_i) \
66 X##_f[_i] = X##_f[_i+_skip] >> _down | X##_f[_i+_skip+1] << _up; \
67 X##_f[_i] = X##_f[3] >> _down; \
68 for (++_i; _i < 4; ++_i) \
69 X##_f[_i] = 0; \
70 } while (0)
71
72
73/* Right shift with sticky-lsb.
74 * What this actually means is that we do a standard right-shift,
75 * but that if any of the bits that fall off the right hand side
76 * were one then we always set the LSbit.
77 */
78#define _FP_FRAC_SRS_4(X,N,size) \
79 do { \
80 _FP_I_TYPE _up, _down, _skip, _i; \
81 _FP_W_TYPE _s; \
82 _skip = (N) / _FP_W_TYPE_SIZE; \
83 _down = (N) % _FP_W_TYPE_SIZE; \
84 _up = _FP_W_TYPE_SIZE - _down; \
85 for (_s = _i = 0; _i < _skip; ++_i) \
86 _s |= X##_f[_i]; \
87 _s |= X##_f[_i] << _up; \
88/* s is now != 0 if we want to set the LSbit */ \
89 for (_i = 0; _i < 3-_skip; ++_i) \
90 X##_f[_i] = X##_f[_i+_skip] >> _down | X##_f[_i+_skip+1] << _up; \
91 X##_f[_i] = X##_f[3] >> _down; \
92 for (++_i; _i < 4; ++_i) \
93 X##_f[_i] = 0; \
94 /* don't fix the LSB until the very end when we're sure f[0] is stable */ \
95 X##_f[0] |= (_s != 0); \
96 } while (0)
97
98#define _FP_FRAC_ADD_4(R,X,Y) \
99 __FP_FRAC_ADD_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
100 X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
101 Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
102
103#define _FP_FRAC_SUB_4(R,X,Y) \
104 __FP_FRAC_SUB_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
105 X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
106 Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
107
108#define _FP_FRAC_ADDI_4(X,I) \
109 __FP_FRAC_ADDI_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], I)
110
111#define _FP_ZEROFRAC_4 0,0,0,0
112#define _FP_MINFRAC_4 0,0,0,1
113
114#define _FP_FRAC_ZEROP_4(X) ((X##_f[0] | X##_f[1] | X##_f[2] | X##_f[3]) == 0)
115#define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE)X##_f[3] < 0)
116#define _FP_FRAC_OVERP_4(fs,X) (X##_f[0] & _FP_OVERFLOW_##fs)
117
118#define _FP_FRAC_EQ_4(X,Y) \
119 (X##_f[0] == Y##_f[0] && X##_f[1] == Y##_f[1] \
120 && X##_f[2] == Y##_f[2] && X##_f[3] == Y##_f[3])
121
122#define _FP_FRAC_GT_4(X,Y) \
123 (X##_f[3] > Y##_f[3] || \
124 (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \
125 (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \
126 (X##_f[1] == Y##_f[1] && X##_f[0] > Y##_f[0]) \
127 )) \
128 )) \
129 )
130
131#define _FP_FRAC_GE_4(X,Y) \
132 (X##_f[3] > Y##_f[3] || \
133 (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \
134 (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \
135 (X##_f[1] == Y##_f[1] && X##_f[0] >= Y##_f[0]) \
136 )) \
137 )) \
138 )
139
140
141#define _FP_FRAC_CLZ_4(R,X) \
142 do { \
143 if (X##_f[3]) \
144 { \
145 __FP_CLZ(R,X##_f[3]); \
146 } \
147 else if (X##_f[2]) \
148 { \
149 __FP_CLZ(R,X##_f[2]); \
150 R += _FP_W_TYPE_SIZE; \
151 } \
152 else if (X##_f[1]) \
153 { \
154 __FP_CLZ(R,X##_f[2]); \
155 R += _FP_W_TYPE_SIZE*2; \
156 } \
157 else \
158 { \
159 __FP_CLZ(R,X##_f[0]); \
160 R += _FP_W_TYPE_SIZE*3; \
161 } \
162 } while(0)
163
164
165#define _FP_UNPACK_RAW_4(fs, X, val) \
166 do { \
167 union _FP_UNION_##fs _flo; _flo.flt = (val); \
168 X##_f[0] = _flo.bits.frac0; \
169 X##_f[1] = _flo.bits.frac1; \
170 X##_f[2] = _flo.bits.frac2; \
171 X##_f[3] = _flo.bits.frac3; \
172 X##_e = _flo.bits.exp; \
173 X##_s = _flo.bits.sign; \
174 } while (0)
175
176#define _FP_PACK_RAW_4(fs, val, X) \
177 do { \
178 union _FP_UNION_##fs _flo; \
179 _flo.bits.frac0 = X##_f[0]; \
180 _flo.bits.frac1 = X##_f[1]; \
181 _flo.bits.frac2 = X##_f[2]; \
182 _flo.bits.frac3 = X##_f[3]; \
183 _flo.bits.exp = X##_e; \
184 _flo.bits.sign = X##_s; \
185 (val) = _flo.flt; \
186 } while (0)
187
188
189/*
190 * Internals
191 */
192
193#define __FP_FRAC_SET_4(X,I3,I2,I1,I0) \
194 (X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)
195
196#ifndef __FP_FRAC_ADD_4
197#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
198 do { \
199 int _c1, _c2, _c3; \
200 r0 = x0 + y0; \
201 _c1 = r0 < x0; \
202 r1 = x1 + y1; \
203 _c2 = r1 < x1; \
204 r1 += _c1; \
205 _c2 |= r1 < _c1; \
206 r2 = x2 + y2; \
207 _c3 = r2 < x2; \
208 r2 += _c2; \
209 _c3 |= r2 < _c2; \
210 r3 = x3 + y3 + _c3; \
211 } while (0)
212#endif
213
214#ifndef __FP_FRAC_SUB_4
215#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
216 do { \
217 int _c1, _c2, _c3; \
218 r0 = x0 - y0; \
219 _c1 = r0 > x0; \
220 r1 = x1 - y1; \
221 _c2 = r1 > x1; \
222 r1 -= _c1; \
223 _c2 |= r1 > _c1; \
224 r2 = x2 - y2; \
225 _c3 = r2 > x2; \
226 r2 -= _c2; \
227 _c3 |= r2 > _c2; \
228 r3 = x3 - y3 - _c3; \
229 } while (0)
230#endif
231
232#ifndef __FP_FRAC_ADDI_4
233/* I always wanted to be a lisp programmer :-> */
234#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \
235 (x3 += ((x2 += ((x1 += ((x0 += i) < x0)) < x1) < x2)))
236#endif
237
238/* Convert FP values between word sizes. This appears to be more
239 * complicated than I'd have expected it to be, so these might be
240 * wrong... These macros are in any case somewhat bogus because they
241 * use information about what various FRAC_n variables look like
242 * internally [eg, that 2 word vars are X_f0 and x_f1]. But so do
243 * the ones in op-2.h and op-1.h.
244 */
245#define _FP_FRAC_CONV_1_4(dfs, sfs, D, S) \
246 do { \
247 _FP_FRAC_SRS_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
248 _FP_WFRACBITS_##sfs); \
249 D##_f = S##_f[0]; \
250 } while (0)
251
252#define _FP_FRAC_CONV_2_4(dfs, sfs, D, S) \
253 do { \
254 _FP_FRAC_SRS_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
255 _FP_WFRACBITS_##sfs); \
256 D##_f0 = S##_f[0]; \
257 D##_f1 = S##_f[1]; \
258 } while (0)
259
260/* Assembly/disassembly for converting to/from integral types.
261 * No shifting or overflow handled here.
262 */
263/* Put the FP value X into r, which is an integer of size rsize. */
264#define _FP_FRAC_ASSEMBLE_4(r, X, rsize) \
265 do { \
266 if (rsize <= _FP_W_TYPE_SIZE) \
267 r = X##_f[0]; \
268 else if (rsize <= 2*_FP_W_TYPE_SIZE) \
269 { \
270 r = X##_f[1]; \
271 r <<= _FP_W_TYPE_SIZE; \
272 r += X##_f[0]; \
273 } \
274 else \
275 { \
276 /* I'm feeling lazy so we deal with int == 3words (implausible)*/ \
277 /* and int == 4words as a single case. */ \
278 r = X##_f[3]; \
279 r <<= _FP_W_TYPE_SIZE; \
280 r += X##_f[2]; \
281 r <<= _FP_W_TYPE_SIZE; \
282 r += X##_f[1]; \
283 r <<= _FP_W_TYPE_SIZE; \
284 r += X##_f[0]; \
285 } \
286 } while (0)
287
288/* "No disassemble Number Five!" */
289/* move an integer of size rsize into X's fractional part. We rely on
290 * the _f[] array consisting of words of size _FP_W_TYPE_SIZE to avoid
291 * having to mask the values we store into it.
292 */
293#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \
294 do { \
295 X##_f[0] = r; \
296 X##_f[1] = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
297 X##_f[2] = (rsize <= 2*_FP_W_TYPE_SIZE ? 0 : r >> 2*_FP_W_TYPE_SIZE); \
298 X##_f[3] = (rsize <= 3*_FP_W_TYPE_SIZE ? 0 : r >> 3*_FP_W_TYPE_SIZE); \
299 } while (0)
300
301#define _FP_FRAC_CONV_4_1(dfs, sfs, D, S) \
302 do { \
303 D##_f[0] = S##_f; \
304 D##_f[1] = D##_f[2] = D##_f[3] = 0; \
305 _FP_FRAC_SLL_4(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
306 } while (0)
307
308#define _FP_FRAC_CONV_4_2(dfs, sfs, D, S) \
309 do { \
310 D##_f[0] = S##_f0; \
311 D##_f[1] = S##_f1; \
312 D##_f[2] = D##_f[3] = 0; \
313 _FP_FRAC_SLL_4(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
314 } while (0)
315
316/* FIXME! This has to be written */
317#define _FP_SQRT_MEAT_4(R, S, T, X, q)
diff --git a/arch/powerpc/math-emu/op-common.h b/arch/powerpc/math-emu/op-common.h
deleted file mode 100644
index afb82b6498ce..000000000000
--- a/arch/powerpc/math-emu/op-common.h
+++ /dev/null
@@ -1,688 +0,0 @@
1#define _FP_DECL(wc, X) \
2 _FP_I_TYPE X##_c, X##_s, X##_e; \
3 _FP_FRAC_DECL_##wc(X)
4
5/*
6 * Finish truely unpacking a native fp value by classifying the kind
7 * of fp value and normalizing both the exponent and the fraction.
8 */
9
10#define _FP_UNPACK_CANONICAL(fs, wc, X) \
11do { \
12 switch (X##_e) \
13 { \
14 default: \
15 _FP_FRAC_HIGH_##wc(X) |= _FP_IMPLBIT_##fs; \
16 _FP_FRAC_SLL_##wc(X, _FP_WORKBITS); \
17 X##_e -= _FP_EXPBIAS_##fs; \
18 X##_c = FP_CLS_NORMAL; \
19 break; \
20 \
21 case 0: \
22 if (_FP_FRAC_ZEROP_##wc(X)) \
23 X##_c = FP_CLS_ZERO; \
24 else \
25 { \
26 /* a denormalized number */ \
27 _FP_I_TYPE _shift; \
28 _FP_FRAC_CLZ_##wc(_shift, X); \
29 _shift -= _FP_FRACXBITS_##fs; \
30 _FP_FRAC_SLL_##wc(X, (_shift+_FP_WORKBITS)); \
31 X##_e -= _FP_EXPBIAS_##fs - 1 + _shift; \
32 X##_c = FP_CLS_NORMAL; \
33 } \
34 break; \
35 \
36 case _FP_EXPMAX_##fs: \
37 if (_FP_FRAC_ZEROP_##wc(X)) \
38 X##_c = FP_CLS_INF; \
39 else \
40 /* we don't differentiate between signaling and quiet nans */ \
41 X##_c = FP_CLS_NAN; \
42 break; \
43 } \
44} while (0)
45
46
47/*
48 * Before packing the bits back into the native fp result, take care
49 * of such mundane things as rounding and overflow. Also, for some
50 * kinds of fp values, the original parts may not have been fully
51 * extracted -- but that is ok, we can regenerate them now.
52 */
53
54#define _FP_PACK_CANONICAL(fs, wc, X) \
55({int __ret = 0; \
56 switch (X##_c) \
57 { \
58 case FP_CLS_NORMAL: \
59 X##_e += _FP_EXPBIAS_##fs; \
60 if (X##_e > 0) \
61 { \
62 __ret |= _FP_ROUND(wc, X); \
63 if (_FP_FRAC_OVERP_##wc(fs, X)) \
64 { \
65 _FP_FRAC_SRL_##wc(X, (_FP_WORKBITS+1)); \
66 X##_e++; \
67 } \
68 else \
69 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
70 if (X##_e >= _FP_EXPMAX_##fs) \
71 { \
72 /* overflow to infinity */ \
73 X##_e = _FP_EXPMAX_##fs; \
74 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
75 __ret |= EFLAG_OVERFLOW; \
76 } \
77 } \
78 else \
79 { \
80 /* we've got a denormalized number */ \
81 X##_e = -X##_e + 1; \
82 if (X##_e <= _FP_WFRACBITS_##fs) \
83 { \
84 _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \
85 _FP_FRAC_SLL_##wc(X, 1); \
86 if (_FP_FRAC_OVERP_##wc(fs, X)) \
87 { \
88 X##_e = 1; \
89 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
90 } \
91 else \
92 { \
93 X##_e = 0; \
94 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS+1); \
95 __ret |= EFLAG_UNDERFLOW; \
96 } \
97 } \
98 else \
99 { \
100 /* underflow to zero */ \
101 X##_e = 0; \
102 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
103 __ret |= EFLAG_UNDERFLOW; \
104 } \
105 } \
106 break; \
107 \
108 case FP_CLS_ZERO: \
109 X##_e = 0; \
110 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
111 break; \
112 \
113 case FP_CLS_INF: \
114 X##_e = _FP_EXPMAX_##fs; \
115 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
116 break; \
117 \
118 case FP_CLS_NAN: \
119 X##_e = _FP_EXPMAX_##fs; \
120 if (!_FP_KEEPNANFRACP) \
121 { \
122 _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
123 X##_s = 0; \
124 } \
125 else \
126 _FP_FRAC_HIGH_##wc(X) |= _FP_QNANBIT_##fs; \
127 break; \
128 } \
129 __ret; \
130})
131
132
133/*
134 * Main addition routine. The input values should be cooked.
135 */
136
137#define _FP_ADD(fs, wc, R, X, Y) \
138do { \
139 switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
140 { \
141 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
142 { \
143 /* shift the smaller number so that its exponent matches the larger */ \
144 _FP_I_TYPE diff = X##_e - Y##_e; \
145 \
146 if (diff < 0) \
147 { \
148 diff = -diff; \
149 if (diff <= _FP_WFRACBITS_##fs) \
150 _FP_FRAC_SRS_##wc(X, diff, _FP_WFRACBITS_##fs); \
151 else if (!_FP_FRAC_ZEROP_##wc(X)) \
152 _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
153 else \
154 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
155 R##_e = Y##_e; \
156 } \
157 else \
158 { \
159 if (diff > 0) \
160 { \
161 if (diff <= _FP_WFRACBITS_##fs) \
162 _FP_FRAC_SRS_##wc(Y, diff, _FP_WFRACBITS_##fs); \
163 else if (!_FP_FRAC_ZEROP_##wc(Y)) \
164 _FP_FRAC_SET_##wc(Y, _FP_MINFRAC_##wc); \
165 else \
166 _FP_FRAC_SET_##wc(Y, _FP_ZEROFRAC_##wc); \
167 } \
168 R##_e = X##_e; \
169 } \
170 \
171 R##_c = FP_CLS_NORMAL; \
172 \
173 if (X##_s == Y##_s) \
174 { \
175 R##_s = X##_s; \
176 _FP_FRAC_ADD_##wc(R, X, Y); \
177 if (_FP_FRAC_OVERP_##wc(fs, R)) \
178 { \
179 _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
180 R##_e++; \
181 } \
182 } \
183 else \
184 { \
185 R##_s = X##_s; \
186 _FP_FRAC_SUB_##wc(R, X, Y); \
187 if (_FP_FRAC_ZEROP_##wc(R)) \
188 { \
189 /* return an exact zero */ \
190 if (FP_ROUNDMODE == FP_RND_MINF) \
191 R##_s |= Y##_s; \
192 else \
193 R##_s &= Y##_s; \
194 R##_c = FP_CLS_ZERO; \
195 } \
196 else \
197 { \
198 if (_FP_FRAC_NEGP_##wc(R)) \
199 { \
200 _FP_FRAC_SUB_##wc(R, Y, X); \
201 R##_s = Y##_s; \
202 } \
203 \
204 /* renormalize after subtraction */ \
205 _FP_FRAC_CLZ_##wc(diff, R); \
206 diff -= _FP_WFRACXBITS_##fs; \
207 if (diff) \
208 { \
209 R##_e -= diff; \
210 _FP_FRAC_SLL_##wc(R, diff); \
211 } \
212 } \
213 } \
214 break; \
215 } \
216 \
217 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
218 _FP_CHOOSENAN(fs, wc, R, X, Y); \
219 break; \
220 \
221 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
222 R##_e = X##_e; \
223 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
224 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
225 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
226 _FP_FRAC_COPY_##wc(R, X); \
227 R##_s = X##_s; \
228 R##_c = X##_c; \
229 break; \
230 \
231 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
232 R##_e = Y##_e; \
233 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
234 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
235 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
236 _FP_FRAC_COPY_##wc(R, Y); \
237 R##_s = Y##_s; \
238 R##_c = Y##_c; \
239 break; \
240 \
241 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
242 if (X##_s != Y##_s) \
243 { \
244 /* +INF + -INF => NAN */ \
245 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
246 R##_s = X##_s ^ Y##_s; \
247 R##_c = FP_CLS_NAN; \
248 break; \
249 } \
250 /* FALLTHRU */ \
251 \
252 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
253 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
254 R##_s = X##_s; \
255 R##_c = FP_CLS_INF; \
256 break; \
257 \
258 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
259 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
260 R##_s = Y##_s; \
261 R##_c = FP_CLS_INF; \
262 break; \
263 \
264 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
265 /* make sure the sign is correct */ \
266 if (FP_ROUNDMODE == FP_RND_MINF) \
267 R##_s = X##_s | Y##_s; \
268 else \
269 R##_s = X##_s & Y##_s; \
270 R##_c = FP_CLS_ZERO; \
271 break; \
272 \
273 default: \
274 abort(); \
275 } \
276} while (0)
277
278
279/*
280 * Main negation routine. FIXME -- when we care about setting exception
281 * bits reliably, this will not do. We should examine all of the fp classes.
282 */
283
284#define _FP_NEG(fs, wc, R, X) \
285 do { \
286 _FP_FRAC_COPY_##wc(R, X); \
287 R##_c = X##_c; \
288 R##_e = X##_e; \
289 R##_s = 1 ^ X##_s; \
290 } while (0)
291
292
293/*
294 * Main multiplication routine. The input values should be cooked.
295 */
296
297#define _FP_MUL(fs, wc, R, X, Y) \
298do { \
299 R##_s = X##_s ^ Y##_s; \
300 switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
301 { \
302 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
303 R##_c = FP_CLS_NORMAL; \
304 R##_e = X##_e + Y##_e + 1; \
305 \
306 _FP_MUL_MEAT_##fs(R,X,Y); \
307 \
308 if (_FP_FRAC_OVERP_##wc(fs, R)) \
309 _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
310 else \
311 R##_e--; \
312 break; \
313 \
314 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
315 _FP_CHOOSENAN(fs, wc, R, X, Y); \
316 break; \
317 \
318 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
319 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
320 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
321 R##_s = X##_s; \
322 \
323 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
324 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
325 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
326 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
327 _FP_FRAC_COPY_##wc(R, X); \
328 R##_c = X##_c; \
329 break; \
330 \
331 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
332 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
333 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
334 R##_s = Y##_s; \
335 \
336 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
337 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
338 _FP_FRAC_COPY_##wc(R, Y); \
339 R##_c = Y##_c; \
340 break; \
341 \
342 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
343 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
344 R##_c = FP_CLS_NAN; \
345 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
346 break; \
347 \
348 default: \
349 abort(); \
350 } \
351} while (0)
352
353
354/*
355 * Main division routine. The input values should be cooked.
356 */
357
358#define _FP_DIV(fs, wc, R, X, Y) \
359do { \
360 R##_s = X##_s ^ Y##_s; \
361 switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
362 { \
363 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
364 R##_c = FP_CLS_NORMAL; \
365 R##_e = X##_e - Y##_e; \
366 \
367 _FP_DIV_MEAT_##fs(R,X,Y); \
368 break; \
369 \
370 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
371 _FP_CHOOSENAN(fs, wc, R, X, Y); \
372 break; \
373 \
374 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
375 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
376 case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
377 R##_s = X##_s; \
378 _FP_FRAC_COPY_##wc(R, X); \
379 R##_c = X##_c; \
380 break; \
381 \
382 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
383 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
384 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
385 R##_s = Y##_s; \
386 _FP_FRAC_COPY_##wc(R, Y); \
387 R##_c = Y##_c; \
388 break; \
389 \
390 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
391 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
392 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
393 R##_c = FP_CLS_ZERO; \
394 break; \
395 \
396 case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
397 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
398 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
399 R##_c = FP_CLS_INF; \
400 break; \
401 \
402 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
403 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
404 R##_c = FP_CLS_NAN; \
405 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
406 break; \
407 \
408 default: \
409 abort(); \
410 } \
411} while (0)
412
413
414/*
415 * Main differential comparison routine. The inputs should be raw not
416 * cooked. The return is -1,0,1 for normal values, 2 otherwise.
417 */
418
419#define _FP_CMP(fs, wc, ret, X, Y, un) \
420 do { \
421 /* NANs are unordered */ \
422 if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
423 || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) \
424 { \
425 ret = un; \
426 } \
427 else \
428 { \
429 int __x_zero = (!X##_e && _FP_FRAC_ZEROP_##wc(X)) ? 1 : 0; \
430 int __y_zero = (!Y##_e && _FP_FRAC_ZEROP_##wc(Y)) ? 1 : 0; \
431 \
432 if (__x_zero && __y_zero) \
433 ret = 0; \
434 else if (__x_zero) \
435 ret = Y##_s ? 1 : -1; \
436 else if (__y_zero) \
437 ret = X##_s ? -1 : 1; \
438 else if (X##_s != Y##_s) \
439 ret = X##_s ? -1 : 1; \
440 else if (X##_e > Y##_e) \
441 ret = X##_s ? -1 : 1; \
442 else if (X##_e < Y##_e) \
443 ret = X##_s ? 1 : -1; \
444 else if (_FP_FRAC_GT_##wc(X, Y)) \
445 ret = X##_s ? -1 : 1; \
446 else if (_FP_FRAC_GT_##wc(Y, X)) \
447 ret = X##_s ? 1 : -1; \
448 else \
449 ret = 0; \
450 } \
451 } while (0)
452
453
454/* Simplification for strict equality. */
455
456#define _FP_CMP_EQ(fs, wc, ret, X, Y) \
457 do { \
458 /* NANs are unordered */ \
459 if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
460 || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) \
461 { \
462 ret = 1; \
463 } \
464 else \
465 { \
466 ret = !(X##_e == Y##_e \
467 && _FP_FRAC_EQ_##wc(X, Y) \
468 && (X##_s == Y##_s || !X##_e && _FP_FRAC_ZEROP_##wc(X))); \
469 } \
470 } while (0)
471
472/*
473 * Main square root routine. The input value should be cooked.
474 */
475
476#define _FP_SQRT(fs, wc, R, X) \
477do { \
478 _FP_FRAC_DECL_##wc(T); _FP_FRAC_DECL_##wc(S); \
479 _FP_W_TYPE q; \
480 switch (X##_c) \
481 { \
482 case FP_CLS_NAN: \
483 R##_s = 0; \
484 R##_c = FP_CLS_NAN; \
485 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
486 break; \
487 case FP_CLS_INF: \
488 if (X##_s) \
489 { \
490 R##_s = 0; \
491 R##_c = FP_CLS_NAN; /* sNAN */ \
492 } \
493 else \
494 { \
495 R##_s = 0; \
496 R##_c = FP_CLS_INF; /* sqrt(+inf) = +inf */ \
497 } \
498 break; \
499 case FP_CLS_ZERO: \
500 R##_s = X##_s; \
501 R##_c = FP_CLS_ZERO; /* sqrt(+-0) = +-0 */ \
502 break; \
503 case FP_CLS_NORMAL: \
504 R##_s = 0; \
505 if (X##_s) \
506 { \
507 R##_c = FP_CLS_NAN; /* sNAN */ \
508 break; \
509 } \
510 R##_c = FP_CLS_NORMAL; \
511 if (X##_e & 1) \
512 _FP_FRAC_SLL_##wc(X, 1); \
513 R##_e = X##_e >> 1; \
514 _FP_FRAC_SET_##wc(S, _FP_ZEROFRAC_##wc); \
515 _FP_FRAC_SET_##wc(R, _FP_ZEROFRAC_##wc); \
516 q = _FP_OVERFLOW_##fs; \
517 _FP_FRAC_SLL_##wc(X, 1); \
518 _FP_SQRT_MEAT_##wc(R, S, T, X, q); \
519 _FP_FRAC_SRL_##wc(R, 1); \
520 } \
521 } while (0)
522
523/*
524 * Convert from FP to integer
525 */
526
527/* "When a NaN, infinity, large positive argument >= 2147483648.0, or
528 * large negative argument <= -2147483649.0 is converted to an integer,
529 * the invalid_current bit...should be set and fp_exception_IEEE_754 should
530 * be raised. If the floating point invalid trap is disabled, no trap occurs
531 * and a numerical result is generated: if the sign bit of the operand
532 * is 0, the result is 2147483647; if the sign bit of the operand is 1,
533 * the result is -2147483648."
534 * Similarly for conversion to extended ints, except that the boundaries
535 * are >= 2^63, <= -(2^63 + 1), and the results are 2^63 + 1 for s=0 and
536 * -2^63 for s=1.
537 * -- SPARC Architecture Manual V9, Appendix B, which specifies how
538 * SPARCs resolve implementation dependencies in the IEEE-754 spec.
539 * I don't believe that the code below follows this. I'm not even sure
540 * it's right!
541 * It doesn't cope with needing to convert to an n bit integer when there
542 * is no n bit integer type. Fortunately gcc provides long long so this
543 * isn't a problem for sparc32.
544 * I have, however, fixed its NaN handling to conform as above.
545 * -- PMM 02/1998
546 * NB: rsigned is not 'is r declared signed?' but 'should the value stored
547 * in r be signed or unsigned?'. r is always(?) declared unsigned.
548 * Comments below are mine, BTW -- PMM
549 */
550#define _FP_TO_INT(fs, wc, r, X, rsize, rsigned) \
551 do { \
552 switch (X##_c) \
553 { \
554 case FP_CLS_NORMAL: \
555 if (X##_e < 0) \
556 { \
557 /* case FP_CLS_NAN: see above! */ \
558 case FP_CLS_ZERO: \
559 r = 0; \
560 } \
561 else if (X##_e >= rsize - (rsigned != 0)) \
562 { /* overflow */ \
563 case FP_CLS_NAN: \
564 case FP_CLS_INF: \
565 if (rsigned) \
566 { \
567 r = 1; \
568 r <<= rsize - 1; \
569 r -= 1 - X##_s; \
570 } \
571 else \
572 { \
573 r = 0; \
574 if (!X##_s) \
575 r = ~r; \
576 } \
577 } \
578 else \
579 { \
580 if (_FP_W_TYPE_SIZE*wc < rsize) \
581 { \
582 _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \
583 r <<= X##_e - _FP_WFRACBITS_##fs; \
584 } \
585 else \
586 { \
587 if (X##_e >= _FP_WFRACBITS_##fs) \
588 _FP_FRAC_SLL_##wc(X, (X##_e - _FP_WFRACBITS_##fs + 1));\
589 else \
590 _FP_FRAC_SRL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1));\
591 _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \
592 } \
593 if (rsigned && X##_s) \
594 r = -r; \
595 } \
596 break; \
597 } \
598 } while (0)
599
600#define _FP_FROM_INT(fs, wc, X, r, rsize, rtype) \
601 do { \
602 if (r) \
603 { \
604 X##_c = FP_CLS_NORMAL; \
605 \
606 if ((X##_s = (r < 0))) \
607 r = -r; \
608 /* Note that `r' is now considered unsigned, so we don't have \
609 to worry about the single signed overflow case. */ \
610 \
611 if (rsize <= _FP_W_TYPE_SIZE) \
612 __FP_CLZ(X##_e, r); \
613 else \
614 __FP_CLZ_2(X##_e, (_FP_W_TYPE)(r >> _FP_W_TYPE_SIZE), \
615 (_FP_W_TYPE)r); \
616 if (rsize < _FP_W_TYPE_SIZE) \
617 X##_e -= (_FP_W_TYPE_SIZE - rsize); \
618 X##_e = rsize - X##_e - 1; \
619 \
620 if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e) \
621 __FP_FRAC_SRS_1(r, (X##_e - _FP_WFRACBITS_##fs), rsize); \
622 r &= ~((_FP_W_TYPE)1 << X##_e); \
623 _FP_FRAC_DISASSEMBLE_##wc(X, ((unsigned rtype)r), rsize); \
624 _FP_FRAC_SLL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1)); \
625 } \
626 else \
627 { \
628 X##_c = FP_CLS_ZERO, X##_s = 0; \
629 } \
630 } while (0)
631
632
633#define FP_CONV(dfs,sfs,dwc,swc,D,S) \
634 do { \
635 _FP_FRAC_CONV_##dwc##_##swc(dfs, sfs, D, S); \
636 D##_e = S##_e; \
637 D##_c = S##_c; \
638 D##_s = S##_s; \
639 } while (0)
640
641/*
642 * Helper primitives.
643 */
644
645/* Count leading zeros in a word. */
646
647#ifndef __FP_CLZ
648#if _FP_W_TYPE_SIZE < 64
649/* this is just to shut the compiler up about shifts > word length -- PMM 02/1998 */
650#define __FP_CLZ(r, x) \
651 do { \
652 _FP_W_TYPE _t = (x); \
653 r = _FP_W_TYPE_SIZE - 1; \
654 if (_t > 0xffff) r -= 16; \
655 if (_t > 0xffff) _t >>= 16; \
656 if (_t > 0xff) r -= 8; \
657 if (_t > 0xff) _t >>= 8; \
658 if (_t & 0xf0) r -= 4; \
659 if (_t & 0xf0) _t >>= 4; \
660 if (_t & 0xc) r -= 2; \
661 if (_t & 0xc) _t >>= 2; \
662 if (_t & 0x2) r -= 1; \
663 } while (0)
664#else /* not _FP_W_TYPE_SIZE < 64 */
665#define __FP_CLZ(r, x) \
666 do { \
667 _FP_W_TYPE _t = (x); \
668 r = _FP_W_TYPE_SIZE - 1; \
669 if (_t > 0xffffffff) r -= 32; \
670 if (_t > 0xffffffff) _t >>= 32; \
671 if (_t > 0xffff) r -= 16; \
672 if (_t > 0xffff) _t >>= 16; \
673 if (_t > 0xff) r -= 8; \
674 if (_t > 0xff) _t >>= 8; \
675 if (_t & 0xf0) r -= 4; \
676 if (_t & 0xf0) _t >>= 4; \
677 if (_t & 0xc) r -= 2; \
678 if (_t & 0xc) _t >>= 2; \
679 if (_t & 0x2) r -= 1; \
680 } while (0)
681#endif /* not _FP_W_TYPE_SIZE < 64 */
682#endif /* ndef __FP_CLZ */
683
684#define _FP_DIV_HELP_imm(q, r, n, d) \
685 do { \
686 q = n / d, r = n % d; \
687 } while (0)
688
diff --git a/arch/powerpc/math-emu/single.h b/arch/powerpc/math-emu/single.h
deleted file mode 100644
index f19d99451815..000000000000
--- a/arch/powerpc/math-emu/single.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * Definitions for IEEE Single Precision
3 */
4
5#if _FP_W_TYPE_SIZE < 32
6#error "Here's a nickel kid. Go buy yourself a real computer."
7#endif
8
9#define _FP_FRACBITS_S 24
10#define _FP_FRACXBITS_S (_FP_W_TYPE_SIZE - _FP_FRACBITS_S)
11#define _FP_WFRACBITS_S (_FP_WORKBITS + _FP_FRACBITS_S)
12#define _FP_WFRACXBITS_S (_FP_W_TYPE_SIZE - _FP_WFRACBITS_S)
13#define _FP_EXPBITS_S 8
14#define _FP_EXPBIAS_S 127
15#define _FP_EXPMAX_S 255
16#define _FP_QNANBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-2))
17#define _FP_IMPLBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-1))
18#define _FP_OVERFLOW_S ((_FP_W_TYPE)1 << (_FP_WFRACBITS_S))
19
20/* The implementation of _FP_MUL_MEAT_S and _FP_DIV_MEAT_S should be
21 chosen by the target machine. */
22
23union _FP_UNION_S
24{
25 float flt;
26 struct {
27#if __BYTE_ORDER == __BIG_ENDIAN
28 unsigned sign : 1;
29 unsigned exp : _FP_EXPBITS_S;
30 unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
31#else
32 unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
33 unsigned exp : _FP_EXPBITS_S;
34 unsigned sign : 1;
35#endif
36 } bits __attribute__((packed));
37};
38
39#define FP_DECL_S(X) _FP_DECL(1,X)
40#define FP_UNPACK_RAW_S(X,val) _FP_UNPACK_RAW_1(S,X,val)
41#define FP_PACK_RAW_S(val,X) _FP_PACK_RAW_1(S,val,X)
42
43#define FP_UNPACK_S(X,val) \
44 do { \
45 _FP_UNPACK_RAW_1(S,X,val); \
46 _FP_UNPACK_CANONICAL(S,1,X); \
47 } while (0)
48
49#define FP_PACK_S(val,X) \
50 do { \
51 _FP_PACK_CANONICAL(S,1,X); \
52 _FP_PACK_RAW_1(S,val,X); \
53 } while (0)
54
55#define FP_NEG_S(R,X) _FP_NEG(S,1,R,X)
56#define FP_ADD_S(R,X,Y) _FP_ADD(S,1,R,X,Y)
57#define FP_SUB_S(R,X,Y) _FP_SUB(S,1,R,X,Y)
58#define FP_MUL_S(R,X,Y) _FP_MUL(S,1,R,X,Y)
59#define FP_DIV_S(R,X,Y) _FP_DIV(S,1,R,X,Y)
60#define FP_SQRT_S(R,X) _FP_SQRT(S,1,R,X)
61
62#define FP_CMP_S(r,X,Y,un) _FP_CMP(S,1,r,X,Y,un)
63#define FP_CMP_EQ_S(r,X,Y) _FP_CMP_EQ(S,1,r,X,Y)
64
65#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
66#define FP_FROM_INT_S(X,r,rs,rt) _FP_FROM_INT(S,1,X,r,rs,rt)
diff --git a/arch/powerpc/math-emu/soft-fp.h b/arch/powerpc/math-emu/soft-fp.h
deleted file mode 100644
index cca39598f873..000000000000
--- a/arch/powerpc/math-emu/soft-fp.h
+++ /dev/null
@@ -1,104 +0,0 @@
1#ifndef SOFT_FP_H
2#define SOFT_FP_H
3
4#include "sfp-machine.h"
5
6#define _FP_WORKBITS 3
7#define _FP_WORK_LSB ((_FP_W_TYPE)1 << 3)
8#define _FP_WORK_ROUND ((_FP_W_TYPE)1 << 2)
9#define _FP_WORK_GUARD ((_FP_W_TYPE)1 << 1)
10#define _FP_WORK_STICKY ((_FP_W_TYPE)1 << 0)
11
12#ifndef FP_RND_NEAREST
13# define FP_RND_NEAREST 0
14# define FP_RND_ZERO 1
15# define FP_RND_PINF 2
16# define FP_RND_MINF 3
17#ifndef FP_ROUNDMODE
18# define FP_ROUNDMODE FP_RND_NEAREST
19#endif
20#endif
21
22#define _FP_ROUND_NEAREST(wc, X) \
23({ int __ret = 0; \
24 int __frac = _FP_FRAC_LOW_##wc(X) & 15; \
25 if (__frac & 7) { \
26 __ret = EFLAG_INEXACT; \
27 if ((__frac & 7) != _FP_WORK_ROUND) \
28 _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \
29 else if (__frac & _FP_WORK_LSB) \
30 _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \
31 } \
32 __ret; \
33})
34
35#define _FP_ROUND_ZERO(wc, X) \
36({ int __ret = 0; \
37 if (_FP_FRAC_LOW_##wc(X) & 7) \
38 __ret = EFLAG_INEXACT; \
39 __ret; \
40})
41
42#define _FP_ROUND_PINF(wc, X) \
43({ int __ret = EFLAG_INEXACT; \
44 if (!X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
45 _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
46 else __ret = 0; \
47 __ret; \
48})
49
50#define _FP_ROUND_MINF(wc, X) \
51({ int __ret = EFLAG_INEXACT; \
52 if (X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
53 _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
54 else __ret = 0; \
55 __ret; \
56})
57
58#define _FP_ROUND(wc, X) \
59({ int __ret = 0; \
60 switch (FP_ROUNDMODE) \
61 { \
62 case FP_RND_NEAREST: \
63 __ret |= _FP_ROUND_NEAREST(wc,X); \
64 break; \
65 case FP_RND_ZERO: \
66 __ret |= _FP_ROUND_ZERO(wc,X); \
67 break; \
68 case FP_RND_PINF: \
69 __ret |= _FP_ROUND_PINF(wc,X); \
70 break; \
71 case FP_RND_MINF: \
72 __ret |= _FP_ROUND_MINF(wc,X); \
73 break; \
74 }; \
75 __ret; \
76})
77
78#define FP_CLS_NORMAL 0
79#define FP_CLS_ZERO 1
80#define FP_CLS_INF 2
81#define FP_CLS_NAN 3
82
83#define _FP_CLS_COMBINE(x,y) (((x) << 2) | (y))
84
85#include "op-1.h"
86#include "op-2.h"
87#include "op-4.h"
88#include "op-common.h"
89
90/* Sigh. Silly things longlong.h needs. */
91#define UWtype _FP_W_TYPE
92#define W_TYPE_SIZE _FP_W_TYPE_SIZE
93
94typedef int SItype __attribute__((mode(SI)));
95typedef int DItype __attribute__((mode(DI)));
96typedef unsigned int USItype __attribute__((mode(SI)));
97typedef unsigned int UDItype __attribute__((mode(DI)));
98#if _FP_W_TYPE_SIZE == 32
99typedef unsigned int UHWtype __attribute__((mode(HI)));
100#elif _FP_W_TYPE_SIZE == 64
101typedef USItype UHWtype;
102#endif
103
104#endif
diff --git a/arch/powerpc/math-emu/stfs.c b/arch/powerpc/math-emu/stfs.c
index 8689aa48ef69..6122147356d1 100644
--- a/arch/powerpc/math-emu/stfs.c
+++ b/arch/powerpc/math-emu/stfs.c
@@ -2,23 +2,24 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include "double.h" 6#include <math-emu/soft-fp.h>
7#include "single.h" 7#include <math-emu/double.h>
8#include <math-emu/single.h>
8 9
9int 10int
10stfs(void *frS, void *ea) 11stfs(void *frS, void *ea)
11{ 12{
12 FP_DECL_D(A); 13 FP_DECL_D(A);
13 FP_DECL_S(R); 14 FP_DECL_S(R);
15 FP_DECL_EX;
14 float f; 16 float f;
15 int err;
16 17
17#ifdef DEBUG 18#ifdef DEBUG
18 printk("%s: S %p, ea %p\n", __func__, frS, ea); 19 printk("%s: S %p, ea %p\n", __func__, frS, ea);
19#endif 20#endif
20 21
21 __FP_UNPACK_D(A, frS); 22 FP_UNPACK_DP(A, frS);
22 23
23#ifdef DEBUG 24#ifdef DEBUG
24 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c); 25 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
@@ -30,12 +31,12 @@ stfs(void *frS, void *ea)
30 printk("R: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c); 31 printk("R: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c);
31#endif 32#endif
32 33
33 err = _FP_PACK_CANONICAL(S, 1, R); 34 _FP_PACK_CANONICAL(S, 1, R);
34 if (!err || !__FPU_TRAP_P(err)) { 35 if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) {
35 __FP_PACK_RAW_1(S, &f, R); 36 _FP_PACK_RAW_1_P(S, &f, R);
36 if (copy_to_user(ea, &f, sizeof(float))) 37 if (copy_to_user(ea, &f, sizeof(float)))
37 return -EFAULT; 38 return -EFAULT;
38 } 39 }
39 40
40 return err; 41 return FP_CUR_EXCEPTIONS;
41} 42}
diff --git a/arch/powerpc/math-emu/types.c b/arch/powerpc/math-emu/types.c
deleted file mode 100644
index e1ed15d829db..000000000000
--- a/arch/powerpc/math-emu/types.c
+++ /dev/null
@@ -1,51 +0,0 @@
1#include "soft-fp.h"
2#include "double.h"
3#include "single.h"
4
5void
6fp_unpack_d(long *_s, unsigned long *_f1, unsigned long *_f0,
7 long *_e, long *_c, void *val)
8{
9 FP_DECL_D(X);
10
11 __FP_UNPACK_RAW_2(D, X, val);
12
13 _FP_UNPACK_CANONICAL(D, 2, X);
14
15 *_s = X_s;
16 *_f1 = X_f1;
17 *_f0 = X_f0;
18 *_e = X_e;
19 *_c = X_c;
20}
21
22int
23fp_pack_d(void *val, long X_s, unsigned long X_f1,
24 unsigned long X_f0, long X_e, long X_c)
25{
26 int exc;
27
28 exc = _FP_PACK_CANONICAL(D, 2, X);
29 if (!exc || !__FPU_TRAP_P(exc))
30 __FP_PACK_RAW_2(D, val, X);
31 return exc;
32}
33
34int
35fp_pack_ds(void *val, long X_s, unsigned long X_f1,
36 unsigned long X_f0, long X_e, long X_c)
37{
38 FP_DECL_S(__X);
39 int exc;
40
41 FP_CONV(S, D, 1, 2, __X, X);
42 exc = _FP_PACK_CANONICAL(S, 1, __X);
43 if (!exc || !__FPU_TRAP_P(exc)) {
44 _FP_UNPACK_CANONICAL(S, 1, __X);
45 FP_CONV(D, S, 2, 1, X, __X);
46 exc |= _FP_PACK_CANONICAL(D, 2, X);
47 if (!exc || !__FPU_TRAP_P(exc))
48 __FP_PACK_RAW_2(D, val, X);
49 }
50 return exc;
51}
diff --git a/arch/powerpc/math-emu/udivmodti4.c b/arch/powerpc/math-emu/udivmodti4.c
index 7e112dc1e2f2..6172044ab003 100644
--- a/arch/powerpc/math-emu/udivmodti4.c
+++ b/arch/powerpc/math-emu/udivmodti4.c
@@ -1,6 +1,6 @@
1/* This has so very few changes over libgcc2's __udivmoddi4 it isn't funny. */ 1/* This has so very few changes over libgcc2's __udivmoddi4 it isn't funny. */
2 2
3#include "soft-fp.h" 3#include <math-emu/soft-fp.h>
4 4
5#undef count_leading_zeros 5#undef count_leading_zeros
6#define count_leading_zeros __FP_CLZ 6#define count_leading_zeros __FP_CLZ
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index ce10e2b1b902..23cee39534fd 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -202,7 +202,7 @@ adjust_total_lowmem(void)
202 cam_max_size = max_lowmem_size; 202 cam_max_size = max_lowmem_size;
203 203
204 /* adjust lowmem size to max_lowmem_size */ 204 /* adjust lowmem size to max_lowmem_size */
205 ram = min(max_lowmem_size, (phys_addr_t)total_lowmem); 205 ram = min(max_lowmem_size, total_lowmem);
206 206
207 /* Calculate CAM values */ 207 /* Calculate CAM values */
208 __cam0 = 1UL << 2 * (__ilog2(ram) / 2); 208 __cam0 = 1UL << 2 * (__ilog2(ram) / 2);
@@ -225,7 +225,8 @@ adjust_total_lowmem(void)
225 printk(KERN_INFO "Memory CAM mapping: CAM0=%ldMb, CAM1=%ldMb," 225 printk(KERN_INFO "Memory CAM mapping: CAM0=%ldMb, CAM1=%ldMb,"
226 " CAM2=%ldMb residual: %ldMb\n", 226 " CAM2=%ldMb residual: %ldMb\n",
227 __cam0 >> 20, __cam1 >> 20, __cam2 >> 20, 227 __cam0 >> 20, __cam1 >> 20, __cam2 >> 20,
228 (total_lowmem - __cam0 - __cam1 - __cam2) >> 20); 228 (long int)((total_lowmem - __cam0 - __cam1 - __cam2)
229 >> 20));
229 __max_low_memory = __cam0 + __cam1 + __cam2; 230 __max_low_memory = __cam0 + __cam1 + __cam2;
230 __initial_memory_limit_addr = memstart_addr + __max_low_memory; 231 __initial_memory_limit_addr = memstart_addr + __max_low_memory;
231} 232}
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
index 9fdf4d6335e4..28a114db3ba0 100644
--- a/arch/powerpc/mm/gup.c
+++ b/arch/powerpc/mm/gup.c
@@ -41,7 +41,7 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
41 page = pte_page(pte); 41 page = pte_page(pte);
42 if (!page_cache_get_speculative(page)) 42 if (!page_cache_get_speculative(page))
43 return 0; 43 return 0;
44 if (unlikely(pte != *ptep)) { 44 if (unlikely(pte_val(pte) != pte_val(*ptep))) {
45 put_page(page); 45 put_page(page);
46 return 0; 46 return 0;
47 } 47 }
@@ -92,7 +92,7 @@ static noinline int gup_huge_pte(pte_t *ptep, struct hstate *hstate,
92 *nr -= refs; 92 *nr -= refs;
93 return 0; 93 return 0;
94 } 94 }
95 if (unlikely(pte != *ptep)) { 95 if (unlikely(pte_val(pte) != pte_val(*ptep))) {
96 /* Could be optimized better */ 96 /* Could be optimized better */
97 while (*nr) { 97 while (*nr) {
98 put_page(page); 98 put_page(page);
@@ -237,7 +237,8 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
237 pgd_t pgd = *pgdp; 237 pgd_t pgd = *pgdp;
238 238
239 VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, addr)].shift); 239 VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, addr)].shift);
240 pr_debug(" %016lx: normal pgd %p\n", addr, (void *)pgd); 240 pr_debug(" %016lx: normal pgd %p\n", addr,
241 (void *)pgd_val(pgd));
241 next = pgd_addr_end(addr, end); 242 next = pgd_addr_end(addr, end);
242 if (pgd_none(pgd)) 243 if (pgd_none(pgd))
243 goto slow; 244 goto slow;
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index b9ba7d930801..7bffb70b9fe2 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -75,7 +75,7 @@ _GLOBAL(hash_page_sync)
75 * Returns to the caller if the access is illegal or there is no 75 * Returns to the caller if the access is illegal or there is no
76 * mapping for the address. Otherwise it places an appropriate PTE 76 * mapping for the address. Otherwise it places an appropriate PTE
77 * in the hash table and returns from the exception. 77 * in the hash table and returns from the exception.
78 * Uses r0, r3 - r8, ctr, lr. 78 * Uses r0, r3 - r8, r10, ctr, lr.
79 */ 79 */
80 .text 80 .text
81_GLOBAL(hash_page) 81_GLOBAL(hash_page)
@@ -106,9 +106,15 @@ _GLOBAL(hash_page)
106 addi r5,r5,swapper_pg_dir@l /* kernel page table */ 106 addi r5,r5,swapper_pg_dir@l /* kernel page table */
107 rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */ 107 rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */
108112: add r5,r5,r7 /* convert to phys addr */ 108112: add r5,r5,r7 /* convert to phys addr */
109#ifndef CONFIG_PTE_64BIT
109 rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */ 110 rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
110 lwz r8,0(r5) /* get pmd entry */ 111 lwz r8,0(r5) /* get pmd entry */
111 rlwinm. r8,r8,0,0,19 /* extract address of pte page */ 112 rlwinm. r8,r8,0,0,19 /* extract address of pte page */
113#else
114 rlwinm r8,r4,13,19,29 /* Compute pgdir/pmd offset */
115 lwzx r8,r8,r5 /* Get L1 entry */
116 rlwinm. r8,r8,0,0,20 /* extract pt base address */
117#endif
112#ifdef CONFIG_SMP 118#ifdef CONFIG_SMP
113 beq- hash_page_out /* return if no mapping */ 119 beq- hash_page_out /* return if no mapping */
114#else 120#else
@@ -118,7 +124,11 @@ _GLOBAL(hash_page)
118 to the address following the rfi. */ 124 to the address following the rfi. */
119 beqlr- 125 beqlr-
120#endif 126#endif
127#ifndef CONFIG_PTE_64BIT
121 rlwimi r8,r4,22,20,29 /* insert next 10 bits of address */ 128 rlwimi r8,r4,22,20,29 /* insert next 10 bits of address */
129#else
130 rlwimi r8,r4,23,20,28 /* compute pte address */
131#endif
122 rlwinm r0,r3,32-3,24,24 /* _PAGE_RW access -> _PAGE_DIRTY */ 132 rlwinm r0,r3,32-3,24,24 /* _PAGE_RW access -> _PAGE_DIRTY */
123 ori r0,r0,_PAGE_ACCESSED|_PAGE_HASHPTE 133 ori r0,r0,_PAGE_ACCESSED|_PAGE_HASHPTE
124 134
@@ -127,9 +137,15 @@ _GLOBAL(hash_page)
127 * because almost always, there won't be a permission violation 137 * because almost always, there won't be a permission violation
128 * and there won't already be an HPTE, and thus we will have 138 * and there won't already be an HPTE, and thus we will have
129 * to update the PTE to set _PAGE_HASHPTE. -- paulus. 139 * to update the PTE to set _PAGE_HASHPTE. -- paulus.
140 *
141 * If PTE_64BIT is set, the low word is the flags word; use that
142 * word for locking since it contains all the interesting bits.
130 */ 143 */
144#if (PTE_FLAGS_OFFSET != 0)
145 addi r8,r8,PTE_FLAGS_OFFSET
146#endif
131retry: 147retry:
132 lwarx r6,0,r8 /* get linux-style pte */ 148 lwarx r6,0,r8 /* get linux-style pte, flag word */
133 andc. r5,r3,r6 /* check access & ~permission */ 149 andc. r5,r3,r6 /* check access & ~permission */
134#ifdef CONFIG_SMP 150#ifdef CONFIG_SMP
135 bne- hash_page_out /* return if access not permitted */ 151 bne- hash_page_out /* return if access not permitted */
@@ -137,6 +153,15 @@ retry:
137 bnelr- 153 bnelr-
138#endif 154#endif
139 or r5,r0,r6 /* set accessed/dirty bits */ 155 or r5,r0,r6 /* set accessed/dirty bits */
156#ifdef CONFIG_PTE_64BIT
157#ifdef CONFIG_SMP
158 subf r10,r6,r8 /* create false data dependency */
159 subi r10,r10,PTE_FLAGS_OFFSET
160 lwzx r10,r6,r10 /* Get upper PTE word */
161#else
162 lwz r10,-PTE_FLAGS_OFFSET(r8)
163#endif /* CONFIG_SMP */
164#endif /* CONFIG_PTE_64BIT */
140 stwcx. r5,0,r8 /* attempt to update PTE */ 165 stwcx. r5,0,r8 /* attempt to update PTE */
141 bne- retry /* retry if someone got there first */ 166 bne- retry /* retry if someone got there first */
142 167
@@ -203,9 +228,9 @@ _GLOBAL(add_hash_page)
203 * we can't take a hash table miss (assuming the code is 228 * we can't take a hash table miss (assuming the code is
204 * covered by a BAT). -- paulus 229 * covered by a BAT). -- paulus
205 */ 230 */
206 mfmsr r10 231 mfmsr r9
207 SYNC 232 SYNC
208 rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */ 233 rlwinm r0,r9,0,17,15 /* clear bit 16 (MSR_EE) */
209 rlwinm r0,r0,0,28,26 /* clear MSR_DR */ 234 rlwinm r0,r0,0,28,26 /* clear MSR_DR */
210 mtmsr r0 235 mtmsr r0
211 SYNC_601 236 SYNC_601
@@ -214,14 +239,14 @@ _GLOBAL(add_hash_page)
214 tophys(r7,0) 239 tophys(r7,0)
215 240
216#ifdef CONFIG_SMP 241#ifdef CONFIG_SMP
217 addis r9,r7,mmu_hash_lock@ha 242 addis r6,r7,mmu_hash_lock@ha
218 addi r9,r9,mmu_hash_lock@l 243 addi r6,r6,mmu_hash_lock@l
21910: lwarx r0,0,r9 /* take the mmu_hash_lock */ 24410: lwarx r0,0,r6 /* take the mmu_hash_lock */
220 cmpi 0,r0,0 245 cmpi 0,r0,0
221 bne- 11f 246 bne- 11f
222 stwcx. r8,0,r9 247 stwcx. r8,0,r6
223 beq+ 12f 248 beq+ 12f
22411: lwz r0,0(r9) 24911: lwz r0,0(r6)
225 cmpi 0,r0,0 250 cmpi 0,r0,0
226 beq 10b 251 beq 10b
227 b 11b 252 b 11b
@@ -234,10 +259,24 @@ _GLOBAL(add_hash_page)
234 * HPTE, so we just unlock and return. 259 * HPTE, so we just unlock and return.
235 */ 260 */
236 mr r8,r5 261 mr r8,r5
262#ifndef CONFIG_PTE_64BIT
237 rlwimi r8,r4,22,20,29 263 rlwimi r8,r4,22,20,29
264#else
265 rlwimi r8,r4,23,20,28
266 addi r8,r8,PTE_FLAGS_OFFSET
267#endif
2381: lwarx r6,0,r8 2681: lwarx r6,0,r8
239 andi. r0,r6,_PAGE_HASHPTE 269 andi. r0,r6,_PAGE_HASHPTE
240 bne 9f /* if HASHPTE already set, done */ 270 bne 9f /* if HASHPTE already set, done */
271#ifdef CONFIG_PTE_64BIT
272#ifdef CONFIG_SMP
273 subf r10,r6,r8 /* create false data dependency */
274 subi r10,r10,PTE_FLAGS_OFFSET
275 lwzx r10,r6,r10 /* Get upper PTE word */
276#else
277 lwz r10,-PTE_FLAGS_OFFSET(r8)
278#endif /* CONFIG_SMP */
279#endif /* CONFIG_PTE_64BIT */
241 ori r5,r6,_PAGE_HASHPTE 280 ori r5,r6,_PAGE_HASHPTE
242 stwcx. r5,0,r8 281 stwcx. r5,0,r8
243 bne- 1b 282 bne- 1b
@@ -246,13 +285,15 @@ _GLOBAL(add_hash_page)
246 285
2479: 2869:
248#ifdef CONFIG_SMP 287#ifdef CONFIG_SMP
288 addis r6,r7,mmu_hash_lock@ha
289 addi r6,r6,mmu_hash_lock@l
249 eieio 290 eieio
250 li r0,0 291 li r0,0
251 stw r0,0(r9) /* clear mmu_hash_lock */ 292 stw r0,0(r6) /* clear mmu_hash_lock */
252#endif 293#endif
253 294
254 /* reenable interrupts and DR */ 295 /* reenable interrupts and DR */
255 mtmsr r10 296 mtmsr r9
256 SYNC_601 297 SYNC_601
257 isync 298 isync
258 299
@@ -267,7 +308,8 @@ _GLOBAL(add_hash_page)
267 * r5 contains the linux PTE, r6 contains the old value of the 308 * r5 contains the linux PTE, r6 contains the old value of the
268 * linux PTE (before setting _PAGE_HASHPTE) and r7 contains the 309 * linux PTE (before setting _PAGE_HASHPTE) and r7 contains the
269 * offset to be added to addresses (0 if the MMU is on, 310 * offset to be added to addresses (0 if the MMU is on,
270 * -KERNELBASE if it is off). 311 * -KERNELBASE if it is off). r10 contains the upper half of
312 * the PTE if CONFIG_PTE_64BIT.
271 * On SMP, the caller should have the mmu_hash_lock held. 313 * On SMP, the caller should have the mmu_hash_lock held.
272 * We assume that the caller has (or will) set the _PAGE_HASHPTE 314 * We assume that the caller has (or will) set the _PAGE_HASHPTE
273 * bit in the linux PTE in memory. The value passed in r6 should 315 * bit in the linux PTE in memory. The value passed in r6 should
@@ -285,7 +327,7 @@ Hash_bits = 12 /* e.g. 256kB hash table */
285Hash_msk = (((1 << Hash_bits) - 1) * 64) 327Hash_msk = (((1 << Hash_bits) - 1) * 64)
286 328
287/* defines for the PTE format for 32-bit PPCs */ 329/* defines for the PTE format for 32-bit PPCs */
288#define PTE_SIZE 8 330#define HPTE_SIZE 8
289#define PTEG_SIZE 64 331#define PTEG_SIZE 64
290#define LG_PTEG_SIZE 6 332#define LG_PTEG_SIZE 6
291#define LDPTEu lwzu 333#define LDPTEu lwzu
@@ -313,6 +355,11 @@ _GLOBAL(create_hpte)
313BEGIN_FTR_SECTION 355BEGIN_FTR_SECTION
314 ori r8,r8,_PAGE_COHERENT /* set M (coherence required) */ 356 ori r8,r8,_PAGE_COHERENT /* set M (coherence required) */
315END_FTR_SECTION_IFSET(CPU_FTR_NEED_COHERENT) 357END_FTR_SECTION_IFSET(CPU_FTR_NEED_COHERENT)
358#ifdef CONFIG_PTE_64BIT
359 /* Put the XPN bits into the PTE */
360 rlwimi r8,r10,8,20,22
361 rlwimi r8,r10,2,29,29
362#endif
316 363
317 /* Construct the high word of the PPC-style PTE (r5) */ 364 /* Construct the high word of the PPC-style PTE (r5) */
318 rlwinm r5,r3,7,1,24 /* put VSID in 0x7fffff80 bits */ 365 rlwinm r5,r3,7,1,24 /* put VSID in 0x7fffff80 bits */
@@ -342,8 +389,8 @@ _GLOBAL(hash_page_patch_A)
342 389
343 /* Search the primary PTEG for a PTE whose 1st (d)word matches r5 */ 390 /* Search the primary PTEG for a PTE whose 1st (d)word matches r5 */
344 mtctr r0 391 mtctr r0
345 addi r4,r3,-PTE_SIZE 392 addi r4,r3,-HPTE_SIZE
3461: LDPTEu r6,PTE_SIZE(r4) /* get next PTE */ 3931: LDPTEu r6,HPTE_SIZE(r4) /* get next PTE */
347 CMPPTE 0,r6,r5 394 CMPPTE 0,r6,r5
348 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */ 395 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */
349 beq+ found_slot 396 beq+ found_slot
@@ -353,9 +400,9 @@ _GLOBAL(hash_page_patch_A)
353_GLOBAL(hash_page_patch_B) 400_GLOBAL(hash_page_patch_B)
354 xoris r4,r3,Hash_msk>>16 /* compute secondary hash */ 401 xoris r4,r3,Hash_msk>>16 /* compute secondary hash */
355 xori r4,r4,(-PTEG_SIZE & 0xffff) 402 xori r4,r4,(-PTEG_SIZE & 0xffff)
356 addi r4,r4,-PTE_SIZE 403 addi r4,r4,-HPTE_SIZE
357 mtctr r0 404 mtctr r0
3582: LDPTEu r6,PTE_SIZE(r4) 4052: LDPTEu r6,HPTE_SIZE(r4)
359 CMPPTE 0,r6,r5 406 CMPPTE 0,r6,r5
360 bdnzf 2,2b 407 bdnzf 2,2b
361 beq+ found_slot 408 beq+ found_slot
@@ -363,8 +410,8 @@ _GLOBAL(hash_page_patch_B)
363 410
364 /* Search the primary PTEG for an empty slot */ 411 /* Search the primary PTEG for an empty slot */
36510: mtctr r0 41210: mtctr r0
366 addi r4,r3,-PTE_SIZE /* search primary PTEG */ 413 addi r4,r3,-HPTE_SIZE /* search primary PTEG */
3671: LDPTEu r6,PTE_SIZE(r4) /* get next PTE */ 4141: LDPTEu r6,HPTE_SIZE(r4) /* get next PTE */
368 TST_V(r6) /* test valid bit */ 415 TST_V(r6) /* test valid bit */
369 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */ 416 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */
370 beq+ found_empty 417 beq+ found_empty
@@ -380,9 +427,9 @@ _GLOBAL(hash_page_patch_B)
380_GLOBAL(hash_page_patch_C) 427_GLOBAL(hash_page_patch_C)
381 xoris r4,r3,Hash_msk>>16 /* compute secondary hash */ 428 xoris r4,r3,Hash_msk>>16 /* compute secondary hash */
382 xori r4,r4,(-PTEG_SIZE & 0xffff) 429 xori r4,r4,(-PTEG_SIZE & 0xffff)
383 addi r4,r4,-PTE_SIZE 430 addi r4,r4,-HPTE_SIZE
384 mtctr r0 431 mtctr r0
3852: LDPTEu r6,PTE_SIZE(r4) 4322: LDPTEu r6,HPTE_SIZE(r4)
386 TST_V(r6) 433 TST_V(r6)
387 bdnzf 2,2b 434 bdnzf 2,2b
388 beq+ found_empty 435 beq+ found_empty
@@ -409,11 +456,11 @@ _GLOBAL(hash_page_patch_C)
409 456
4101: addis r4,r7,next_slot@ha /* get next evict slot */ 4571: addis r4,r7,next_slot@ha /* get next evict slot */
411 lwz r6,next_slot@l(r4) 458 lwz r6,next_slot@l(r4)
412 addi r6,r6,PTE_SIZE /* search for candidate */ 459 addi r6,r6,HPTE_SIZE /* search for candidate */
413 andi. r6,r6,7*PTE_SIZE 460 andi. r6,r6,7*HPTE_SIZE
414 stw r6,next_slot@l(r4) 461 stw r6,next_slot@l(r4)
415 add r4,r3,r6 462 add r4,r3,r6
416 LDPTE r0,PTE_SIZE/2(r4) /* get PTE second word */ 463 LDPTE r0,HPTE_SIZE/2(r4) /* get PTE second word */
417 clrrwi r0,r0,12 464 clrrwi r0,r0,12
418 lis r6,etext@h 465 lis r6,etext@h
419 ori r6,r6,etext@l /* get etext */ 466 ori r6,r6,etext@l /* get etext */
@@ -426,7 +473,7 @@ _GLOBAL(hash_page_patch_C)
426found_empty: 473found_empty:
427 STPTE r5,0(r4) 474 STPTE r5,0(r4)
428found_slot: 475found_slot:
429 STPTE r8,PTE_SIZE/2(r4) 476 STPTE r8,HPTE_SIZE/2(r4)
430 477
431#else /* CONFIG_SMP */ 478#else /* CONFIG_SMP */
432/* 479/*
@@ -452,7 +499,7 @@ found_slot:
452 STPTE r5,0(r4) 499 STPTE r5,0(r4)
453 sync 500 sync
454 TLBSYNC 501 TLBSYNC
455 STPTE r8,PTE_SIZE/2(r4) /* put in correct RPN, WIMG, PP bits */ 502 STPTE r8,HPTE_SIZE/2(r4) /* put in correct RPN, WIMG, PP bits */
456 sync 503 sync
457 SET_V(r5) 504 SET_V(r5)
458 STPTE r5,0(r4) /* finally set V bit in PTE */ 505 STPTE r5,0(r4) /* finally set V bit in PTE */
@@ -499,14 +546,18 @@ _GLOBAL(flush_hash_pages)
499 isync 546 isync
500 547
501 /* First find a PTE in the range that has _PAGE_HASHPTE set */ 548 /* First find a PTE in the range that has _PAGE_HASHPTE set */
549#ifndef CONFIG_PTE_64BIT
502 rlwimi r5,r4,22,20,29 550 rlwimi r5,r4,22,20,29
5031: lwz r0,0(r5) 551#else
552 rlwimi r5,r4,23,20,28
553#endif
5541: lwz r0,PTE_FLAGS_OFFSET(r5)
504 cmpwi cr1,r6,1 555 cmpwi cr1,r6,1
505 andi. r0,r0,_PAGE_HASHPTE 556 andi. r0,r0,_PAGE_HASHPTE
506 bne 2f 557 bne 2f
507 ble cr1,19f 558 ble cr1,19f
508 addi r4,r4,0x1000 559 addi r4,r4,0x1000
509 addi r5,r5,4 560 addi r5,r5,PTE_SIZE
510 addi r6,r6,-1 561 addi r6,r6,-1
511 b 1b 562 b 1b
512 563
@@ -545,7 +596,10 @@ _GLOBAL(flush_hash_pages)
545 * already clear, we're done (for this pte). If not, 596 * already clear, we're done (for this pte). If not,
546 * clear it (atomically) and proceed. -- paulus. 597 * clear it (atomically) and proceed. -- paulus.
547 */ 598 */
54833: lwarx r8,0,r5 /* fetch the pte */ 599#if (PTE_FLAGS_OFFSET != 0)
600 addi r5,r5,PTE_FLAGS_OFFSET
601#endif
60233: lwarx r8,0,r5 /* fetch the pte flags word */
549 andi. r0,r8,_PAGE_HASHPTE 603 andi. r0,r8,_PAGE_HASHPTE
550 beq 8f /* done if HASHPTE is already clear */ 604 beq 8f /* done if HASHPTE is already clear */
551 rlwinm r8,r8,0,31,29 /* clear HASHPTE bit */ 605 rlwinm r8,r8,0,31,29 /* clear HASHPTE bit */
@@ -562,8 +616,8 @@ _GLOBAL(flush_hash_patch_A)
562 /* Search the primary PTEG for a PTE whose 1st (d)word matches r5 */ 616 /* Search the primary PTEG for a PTE whose 1st (d)word matches r5 */
563 li r0,8 /* PTEs/group */ 617 li r0,8 /* PTEs/group */
564 mtctr r0 618 mtctr r0
565 addi r12,r8,-PTE_SIZE 619 addi r12,r8,-HPTE_SIZE
5661: LDPTEu r0,PTE_SIZE(r12) /* get next PTE */ 6201: LDPTEu r0,HPTE_SIZE(r12) /* get next PTE */
567 CMPPTE 0,r0,r11 621 CMPPTE 0,r0,r11
568 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */ 622 bdnzf 2,1b /* loop while ctr != 0 && !cr0.eq */
569 beq+ 3f 623 beq+ 3f
@@ -574,9 +628,9 @@ _GLOBAL(flush_hash_patch_A)
574_GLOBAL(flush_hash_patch_B) 628_GLOBAL(flush_hash_patch_B)
575 xoris r12,r8,Hash_msk>>16 /* compute secondary hash */ 629 xoris r12,r8,Hash_msk>>16 /* compute secondary hash */
576 xori r12,r12,(-PTEG_SIZE & 0xffff) 630 xori r12,r12,(-PTEG_SIZE & 0xffff)
577 addi r12,r12,-PTE_SIZE 631 addi r12,r12,-HPTE_SIZE
578 mtctr r0 632 mtctr r0
5792: LDPTEu r0,PTE_SIZE(r12) 6332: LDPTEu r0,HPTE_SIZE(r12)
580 CMPPTE 0,r0,r11 634 CMPPTE 0,r0,r11
581 bdnzf 2,2b 635 bdnzf 2,2b
582 xori r11,r11,PTE_H /* clear H again */ 636 xori r11,r11,PTE_H /* clear H again */
@@ -590,7 +644,7 @@ _GLOBAL(flush_hash_patch_B)
590 644
5918: ble cr1,9f /* if all ptes checked */ 6458: ble cr1,9f /* if all ptes checked */
59281: addi r6,r6,-1 64681: addi r6,r6,-1
593 addi r5,r5,4 /* advance to next pte */ 647 addi r5,r5,PTE_SIZE
594 addi r4,r4,0x1000 648 addi r4,r4,0x1000
595 lwz r0,0(r5) /* check next pte */ 649 lwz r0,0(r5) /* check next pte */
596 cmpwi cr1,r6,1 650 cmpwi cr1,r6,1
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 8920eea34528..5c64af174752 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -194,7 +194,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
194 unsigned long tprot = prot; 194 unsigned long tprot = prot;
195 195
196 /* Make kernel text executable */ 196 /* Make kernel text executable */
197 if (in_kernel_text(vaddr)) 197 if (overlaps_kernel_text(vaddr, vaddr + step))
198 tprot &= ~HPTE_R_N; 198 tprot &= ~HPTE_R_N;
199 199
200 hash = hpt_hash(va, shift, ssize); 200 hash = hpt_hash(va, shift, ssize);
@@ -348,6 +348,7 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
348 return 0; 348 return 0;
349} 349}
350 350
351#ifdef CONFIG_HUGETLB_PAGE
351/* Scan for 16G memory blocks that have been set aside for huge pages 352/* Scan for 16G memory blocks that have been set aside for huge pages
352 * and reserve those blocks for 16G huge pages. 353 * and reserve those blocks for 16G huge pages.
353 */ 354 */
@@ -385,6 +386,7 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
385 add_gpage(phys_addr, block_size, expected_pages); 386 add_gpage(phys_addr, block_size, expected_pages);
386 return 0; 387 return 0;
387} 388}
389#endif /* CONFIG_HUGETLB_PAGE */
388 390
389static void __init htab_init_page_sizes(void) 391static void __init htab_init_page_sizes(void)
390{ 392{
@@ -539,7 +541,7 @@ static unsigned long __init htab_get_table_size(void)
539void create_section_mapping(unsigned long start, unsigned long end) 541void create_section_mapping(unsigned long start, unsigned long end)
540{ 542{
541 BUG_ON(htab_bolt_mapping(start, end, __pa(start), 543 BUG_ON(htab_bolt_mapping(start, end, __pa(start),
542 PAGE_KERNEL, mmu_linear_psize, 544 pgprot_val(PAGE_KERNEL), mmu_linear_psize,
543 mmu_kernel_ssize)); 545 mmu_kernel_ssize));
544} 546}
545 547
@@ -647,7 +649,7 @@ void __init htab_initialize(void)
647 mtspr(SPRN_SDR1, _SDR1); 649 mtspr(SPRN_SDR1, _SDR1);
648 } 650 }
649 651
650 prot = PAGE_KERNEL; 652 prot = pgprot_val(PAGE_KERNEL);
651 653
652#ifdef CONFIG_DEBUG_PAGEALLOC 654#ifdef CONFIG_DEBUG_PAGEALLOC
653 linear_map_hash_count = lmb_end_of_DRAM() >> PAGE_SHIFT; 655 linear_map_hash_count = lmb_end_of_DRAM() >> PAGE_SHIFT;
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index f1c2d55b4377..a117024ab8cd 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -128,29 +128,37 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
128 return 0; 128 return 0;
129} 129}
130 130
131/* Base page size affects how we walk hugetlb page tables */ 131
132#ifdef CONFIG_PPC_64K_PAGES 132static pud_t *hpud_offset(pgd_t *pgd, unsigned long addr, struct hstate *hstate)
133#define hpmd_offset(pud, addr, h) pmd_offset(pud, addr) 133{
134#define hpmd_alloc(mm, pud, addr, h) pmd_alloc(mm, pud, addr) 134 if (huge_page_shift(hstate) < PUD_SHIFT)
135#else 135 return pud_offset(pgd, addr);
136static inline 136 else
137pmd_t *hpmd_offset(pud_t *pud, unsigned long addr, struct hstate *hstate) 137 return (pud_t *) pgd;
138}
139static pud_t *hpud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long addr,
140 struct hstate *hstate)
138{ 141{
139 if (huge_page_shift(hstate) == PAGE_SHIFT_64K) 142 if (huge_page_shift(hstate) < PUD_SHIFT)
143 return pud_alloc(mm, pgd, addr);
144 else
145 return (pud_t *) pgd;
146}
147static pmd_t *hpmd_offset(pud_t *pud, unsigned long addr, struct hstate *hstate)
148{
149 if (huge_page_shift(hstate) < PMD_SHIFT)
140 return pmd_offset(pud, addr); 150 return pmd_offset(pud, addr);
141 else 151 else
142 return (pmd_t *) pud; 152 return (pmd_t *) pud;
143} 153}
144static inline 154static pmd_t *hpmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long addr,
145pmd_t *hpmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long addr, 155 struct hstate *hstate)
146 struct hstate *hstate)
147{ 156{
148 if (huge_page_shift(hstate) == PAGE_SHIFT_64K) 157 if (huge_page_shift(hstate) < PMD_SHIFT)
149 return pmd_alloc(mm, pud, addr); 158 return pmd_alloc(mm, pud, addr);
150 else 159 else
151 return (pmd_t *) pud; 160 return (pmd_t *) pud;
152} 161}
153#endif
154 162
155/* Build list of addresses of gigantic pages. This function is used in early 163/* Build list of addresses of gigantic pages. This function is used in early
156 * boot before the buddy or bootmem allocator is setup. 164 * boot before the buddy or bootmem allocator is setup.
@@ -204,7 +212,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
204 212
205 pg = pgd_offset(mm, addr); 213 pg = pgd_offset(mm, addr);
206 if (!pgd_none(*pg)) { 214 if (!pgd_none(*pg)) {
207 pu = pud_offset(pg, addr); 215 pu = hpud_offset(pg, addr, hstate);
208 if (!pud_none(*pu)) { 216 if (!pud_none(*pu)) {
209 pm = hpmd_offset(pu, addr, hstate); 217 pm = hpmd_offset(pu, addr, hstate);
210 if (!pmd_none(*pm)) 218 if (!pmd_none(*pm))
@@ -233,7 +241,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
233 addr &= hstate->mask; 241 addr &= hstate->mask;
234 242
235 pg = pgd_offset(mm, addr); 243 pg = pgd_offset(mm, addr);
236 pu = pud_alloc(mm, pg, addr); 244 pu = hpud_alloc(mm, pg, addr, hstate);
237 245
238 if (pu) { 246 if (pu) {
239 pm = hpmd_alloc(mm, pu, addr, hstate); 247 pm = hpmd_alloc(mm, pu, addr, hstate);
@@ -316,13 +324,7 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
316 pud = pud_offset(pgd, addr); 324 pud = pud_offset(pgd, addr);
317 do { 325 do {
318 next = pud_addr_end(addr, end); 326 next = pud_addr_end(addr, end);
319#ifdef CONFIG_PPC_64K_PAGES 327 if (shift < PMD_SHIFT) {
320 if (pud_none_or_clear_bad(pud))
321 continue;
322 hugetlb_free_pmd_range(tlb, pud, addr, next, floor, ceiling,
323 psize);
324#else
325 if (shift == PAGE_SHIFT_64K) {
326 if (pud_none_or_clear_bad(pud)) 328 if (pud_none_or_clear_bad(pud))
327 continue; 329 continue;
328 hugetlb_free_pmd_range(tlb, pud, addr, next, floor, 330 hugetlb_free_pmd_range(tlb, pud, addr, next, floor,
@@ -332,7 +334,6 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
332 continue; 334 continue;
333 free_hugepte_range(tlb, (hugepd_t *)pud, psize); 335 free_hugepte_range(tlb, (hugepd_t *)pud, psize);
334 } 336 }
335#endif
336 } while (pud++, addr = next, addr != end); 337 } while (pud++, addr = next, addr != end);
337 338
338 start &= PGDIR_MASK; 339 start &= PGDIR_MASK;
@@ -422,9 +423,15 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb,
422 psize = get_slice_psize(tlb->mm, addr); 423 psize = get_slice_psize(tlb->mm, addr);
423 BUG_ON(!mmu_huge_psizes[psize]); 424 BUG_ON(!mmu_huge_psizes[psize]);
424 next = pgd_addr_end(addr, end); 425 next = pgd_addr_end(addr, end);
425 if (pgd_none_or_clear_bad(pgd)) 426 if (mmu_psize_to_shift(psize) < PUD_SHIFT) {
426 continue; 427 if (pgd_none_or_clear_bad(pgd))
427 hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling); 428 continue;
429 hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling);
430 } else {
431 if (pgd_none(*pgd))
432 continue;
433 free_hugepte_range(tlb, (hugepd_t *)pgd, psize);
434 }
428 } while (pgd++, addr = next, addr != end); 435 } while (pgd++, addr = next, addr != end);
429} 436}
430 437
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 036fe2f10c77..3e6a6543f53a 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -228,8 +228,8 @@ int __meminit vmemmap_populate(struct page *start_page,
228 start, p, __pa(p)); 228 start, p, __pa(p));
229 229
230 mapped = htab_bolt_mapping(start, start + page_size, __pa(p), 230 mapped = htab_bolt_mapping(start, start + page_size, __pa(p),
231 PAGE_KERNEL, mmu_vmemmap_psize, 231 pgprot_val(PAGE_KERNEL),
232 mmu_kernel_ssize); 232 mmu_vmemmap_psize, mmu_kernel_ssize);
233 BUG_ON(mapped < 0); 233 BUG_ON(mapped < 0);
234 } 234 }
235 235
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 1c93c255873b..98d7bf99533a 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -75,11 +75,10 @@ static inline pte_t *virt_to_kpte(unsigned long vaddr)
75 75
76int page_is_ram(unsigned long pfn) 76int page_is_ram(unsigned long pfn)
77{ 77{
78 unsigned long paddr = (pfn << PAGE_SHIFT);
79
80#ifndef CONFIG_PPC64 /* XXX for now */ 78#ifndef CONFIG_PPC64 /* XXX for now */
81 return paddr < __pa(high_memory); 79 return pfn < max_pfn;
82#else 80#else
81 unsigned long paddr = (pfn << PAGE_SHIFT);
83 int i; 82 int i;
84 for (i=0; i < lmb.memory.cnt; i++) { 83 for (i=0; i < lmb.memory.cnt; i++) {
85 unsigned long base; 84 unsigned long base;
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index d9a181351332..6cf5c71c431f 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -89,6 +89,46 @@ static int __cpuinit fake_numa_create_new_node(unsigned long end_pfn,
89 return 0; 89 return 0;
90} 90}
91 91
92/*
93 * get_active_region_work_fn - A helper function for get_node_active_region
94 * Returns datax set to the start_pfn and end_pfn if they contain
95 * the initial value of datax->start_pfn between them
96 * @start_pfn: start page(inclusive) of region to check
97 * @end_pfn: end page(exclusive) of region to check
98 * @datax: comes in with ->start_pfn set to value to search for and
99 * goes out with active range if it contains it
100 * Returns 1 if search value is in range else 0
101 */
102static int __init get_active_region_work_fn(unsigned long start_pfn,
103 unsigned long end_pfn, void *datax)
104{
105 struct node_active_region *data;
106 data = (struct node_active_region *)datax;
107
108 if (start_pfn <= data->start_pfn && end_pfn > data->start_pfn) {
109 data->start_pfn = start_pfn;
110 data->end_pfn = end_pfn;
111 return 1;
112 }
113 return 0;
114
115}
116
117/*
118 * get_node_active_region - Return active region containing start_pfn
119 * @start_pfn: The page to return the region for.
120 * @node_ar: Returned set to the active region containing start_pfn
121 */
122static void __init get_node_active_region(unsigned long start_pfn,
123 struct node_active_region *node_ar)
124{
125 int nid = early_pfn_to_nid(start_pfn);
126
127 node_ar->nid = nid;
128 node_ar->start_pfn = start_pfn;
129 work_with_active_regions(nid, get_active_region_work_fn, node_ar);
130}
131
92static void __cpuinit map_cpu_to_node(int cpu, int node) 132static void __cpuinit map_cpu_to_node(int cpu, int node)
93{ 133{
94 numa_cpu_lookup_table[cpu] = node; 134 numa_cpu_lookup_table[cpu] = node;
@@ -150,6 +190,21 @@ static const int *of_get_associativity(struct device_node *dev)
150 return of_get_property(dev, "ibm,associativity", NULL); 190 return of_get_property(dev, "ibm,associativity", NULL);
151} 191}
152 192
193/*
194 * Returns the property linux,drconf-usable-memory if
195 * it exists (the property exists only in kexec/kdump kernels,
196 * added by kexec-tools)
197 */
198static const u32 *of_get_usable_memory(struct device_node *memory)
199{
200 const u32 *prop;
201 u32 len;
202 prop = of_get_property(memory, "linux,drconf-usable-memory", &len);
203 if (!prop || len < sizeof(unsigned int))
204 return 0;
205 return prop;
206}
207
153/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa 208/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa
154 * info is found. 209 * info is found.
155 */ 210 */
@@ -487,14 +542,29 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start,
487} 542}
488 543
489/* 544/*
545 * Reads the counter for a given entry in
546 * linux,drconf-usable-memory property
547 */
548static inline int __init read_usm_ranges(const u32 **usm)
549{
550 /*
551 * For each lmb in ibm,dynamic-memory a corresponding
552 * entry in linux,drconf-usable-memory property contains
553 * a counter followed by that many (base, size) duple.
554 * read the counter from linux,drconf-usable-memory
555 */
556 return read_n_cells(n_mem_size_cells, usm);
557}
558
559/*
490 * Extract NUMA information from the ibm,dynamic-reconfiguration-memory 560 * Extract NUMA information from the ibm,dynamic-reconfiguration-memory
491 * node. This assumes n_mem_{addr,size}_cells have been set. 561 * node. This assumes n_mem_{addr,size}_cells have been set.
492 */ 562 */
493static void __init parse_drconf_memory(struct device_node *memory) 563static void __init parse_drconf_memory(struct device_node *memory)
494{ 564{
495 const u32 *dm; 565 const u32 *dm, *usm;
496 unsigned int n, rc; 566 unsigned int n, rc, ranges, is_kexec_kdump = 0;
497 unsigned long lmb_size, size; 567 unsigned long lmb_size, base, size, sz;
498 int nid; 568 int nid;
499 struct assoc_arrays aa; 569 struct assoc_arrays aa;
500 570
@@ -510,6 +580,11 @@ static void __init parse_drconf_memory(struct device_node *memory)
510 if (rc) 580 if (rc)
511 return; 581 return;
512 582
583 /* check if this is a kexec/kdump kernel */
584 usm = of_get_usable_memory(memory);
585 if (usm != NULL)
586 is_kexec_kdump = 1;
587
513 for (; n != 0; --n) { 588 for (; n != 0; --n) {
514 struct of_drconf_cell drmem; 589 struct of_drconf_cell drmem;
515 590
@@ -521,21 +596,31 @@ static void __init parse_drconf_memory(struct device_node *memory)
521 || !(drmem.flags & DRCONF_MEM_ASSIGNED)) 596 || !(drmem.flags & DRCONF_MEM_ASSIGNED))
522 continue; 597 continue;
523 598
524 nid = of_drconf_to_nid_single(&drmem, &aa); 599 base = drmem.base_addr;
600 size = lmb_size;
601 ranges = 1;
525 602
526 fake_numa_create_new_node( 603 if (is_kexec_kdump) {
527 ((drmem.base_addr + lmb_size) >> PAGE_SHIFT), 604 ranges = read_usm_ranges(&usm);
605 if (!ranges) /* there are no (base, size) duple */
606 continue;
607 }
608 do {
609 if (is_kexec_kdump) {
610 base = read_n_cells(n_mem_addr_cells, &usm);
611 size = read_n_cells(n_mem_size_cells, &usm);
612 }
613 nid = of_drconf_to_nid_single(&drmem, &aa);
614 fake_numa_create_new_node(
615 ((base + size) >> PAGE_SHIFT),
528 &nid); 616 &nid);
529 617 node_set_online(nid);
530 node_set_online(nid); 618 sz = numa_enforce_memory_limit(base, size);
531 619 if (sz)
532 size = numa_enforce_memory_limit(drmem.base_addr, lmb_size); 620 add_active_range(nid, base >> PAGE_SHIFT,
533 if (!size) 621 (base >> PAGE_SHIFT)
534 continue; 622 + (sz >> PAGE_SHIFT));
535 623 } while (--ranges);
536 add_active_range(nid, drmem.base_addr >> PAGE_SHIFT,
537 (drmem.base_addr >> PAGE_SHIFT)
538 + (size >> PAGE_SHIFT));
539 } 624 }
540} 625}
541 626
@@ -837,38 +922,50 @@ void __init do_init_bootmem(void)
837 start_pfn, end_pfn); 922 start_pfn, end_pfn);
838 923
839 free_bootmem_with_active_regions(nid, end_pfn); 924 free_bootmem_with_active_regions(nid, end_pfn);
925 }
840 926
841 /* Mark reserved regions on this node */ 927 /* Mark reserved regions */
842 for (i = 0; i < lmb.reserved.cnt; i++) { 928 for (i = 0; i < lmb.reserved.cnt; i++) {
843 unsigned long physbase = lmb.reserved.region[i].base; 929 unsigned long physbase = lmb.reserved.region[i].base;
844 unsigned long size = lmb.reserved.region[i].size; 930 unsigned long size = lmb.reserved.region[i].size;
845 unsigned long start_paddr = start_pfn << PAGE_SHIFT; 931 unsigned long start_pfn = physbase >> PAGE_SHIFT;
846 unsigned long end_paddr = end_pfn << PAGE_SHIFT; 932 unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT);
847 933 struct node_active_region node_ar;
848 if (early_pfn_to_nid(physbase >> PAGE_SHIFT) != nid && 934
849 early_pfn_to_nid((physbase+size-1) >> PAGE_SHIFT) != nid) 935 get_node_active_region(start_pfn, &node_ar);
850 continue; 936 while (start_pfn < end_pfn) {
851 937 /*
852 if (physbase < end_paddr && 938 * if reserved region extends past active region
853 (physbase+size) > start_paddr) { 939 * then trim size to active region
854 /* overlaps */ 940 */
855 if (physbase < start_paddr) { 941 if (end_pfn > node_ar.end_pfn)
856 size -= start_paddr - physbase; 942 size = (node_ar.end_pfn << PAGE_SHIFT)
857 physbase = start_paddr; 943 - (start_pfn << PAGE_SHIFT);
858 } 944 dbg("reserve_bootmem %lx %lx nid=%d\n", physbase, size,
859 945 node_ar.nid);
860 if (size > end_paddr - physbase) 946 reserve_bootmem_node(NODE_DATA(node_ar.nid), physbase,
861 size = end_paddr - physbase; 947 size, BOOTMEM_DEFAULT);
862 948 /*
863 dbg("reserve_bootmem %lx %lx\n", physbase, 949 * if reserved region is contained in the active region
864 size); 950 * then done.
865 reserve_bootmem_node(NODE_DATA(nid), physbase, 951 */
866 size, BOOTMEM_DEFAULT); 952 if (end_pfn <= node_ar.end_pfn)
867 } 953 break;
954
955 /*
956 * reserved region extends past the active region
957 * get next active region that contains this
958 * reserved region
959 */
960 start_pfn = node_ar.end_pfn;
961 physbase = start_pfn << PAGE_SHIFT;
962 get_node_active_region(start_pfn, &node_ar);
868 } 963 }
869 964
870 sparse_memory_present_with_active_regions(nid);
871 } 965 }
966
967 for_each_online_node(nid)
968 sparse_memory_present_with_active_regions(nid);
872} 969}
873 970
874void __init paging_init(void) 971void __init paging_init(void)
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 2001abdb1912..c31d6d26f0b5 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -73,7 +73,7 @@ extern unsigned long p_mapped_by_tlbcam(unsigned long pa);
73#endif /* HAVE_TLBCAM */ 73#endif /* HAVE_TLBCAM */
74 74
75#ifdef CONFIG_PTE_64BIT 75#ifdef CONFIG_PTE_64BIT
76/* 44x uses an 8kB pgdir because it has 8-byte Linux PTEs. */ 76/* Some processors use an 8kB pgdir because they have 8-byte Linux PTEs. */
77#define PGDIR_ORDER 1 77#define PGDIR_ORDER 1
78#else 78#else
79#define PGDIR_ORDER 0 79#define PGDIR_ORDER 0
@@ -288,7 +288,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
288} 288}
289 289
290/* 290/*
291 * Map in all of physical memory starting at KERNELBASE. 291 * Map in a big chunk of physical memory starting at KERNELBASE.
292 */ 292 */
293void __init mapin_ram(void) 293void __init mapin_ram(void)
294{ 294{
diff --git a/arch/powerpc/mm/tlb_32.c b/arch/powerpc/mm/tlb_32.c
index eb4b512d65fa..f9a47fee3927 100644
--- a/arch/powerpc/mm/tlb_32.c
+++ b/arch/powerpc/mm/tlb_32.c
@@ -45,6 +45,7 @@ void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long addr)
45 flush_hash_pages(mm->context.id, addr, ptephys, 1); 45 flush_hash_pages(mm->context.id, addr, ptephys, 1);
46 } 46 }
47} 47}
48EXPORT_SYMBOL(flush_hash_entry);
48 49
49/* 50/*
50 * Called by ptep_set_access_flags, must flush on CPUs for which the 51 * Called by ptep_set_access_flags, must flush on CPUs for which the
diff --git a/arch/powerpc/oprofile/cell/vma_map.c b/arch/powerpc/oprofile/cell/vma_map.c
index fff66662d021..258fa4411e9e 100644
--- a/arch/powerpc/oprofile/cell/vma_map.c
+++ b/arch/powerpc/oprofile/cell/vma_map.c
@@ -229,7 +229,7 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu,
229 */ 229 */
230 overlay_tbl_offset = vma_map_lookup(map, ovly_table_sym, 230 overlay_tbl_offset = vma_map_lookup(map, ovly_table_sym,
231 aSpu, &grd_val); 231 aSpu, &grd_val);
232 if (overlay_tbl_offset < 0) { 232 if (overlay_tbl_offset > 0x10000000) {
233 printk(KERN_ERR "SPU_PROF: " 233 printk(KERN_ERR "SPU_PROF: "
234 "%s, line %d: Error finding SPU overlay table\n", 234 "%s, line %d: Error finding SPU overlay table\n",
235 __func__, __LINE__); 235 __func__, __LINE__);
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 446a8bbb847b..3e3d91f536e0 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -64,7 +64,7 @@ static int power4_reg_setup(struct op_counter_config *ctr,
64 return 0; 64 return 0;
65} 65}
66 66
67extern void ppc64_enable_pmcs(void); 67extern void ppc_enable_pmcs(void);
68 68
69/* 69/*
70 * Older CPUs require the MMCRA sample bit to be always set, but newer 70 * Older CPUs require the MMCRA sample bit to be always set, but newer
@@ -91,7 +91,7 @@ static int power4_cpu_setup(struct op_counter_config *ctr)
91 unsigned int mmcr0 = mmcr0_val; 91 unsigned int mmcr0 = mmcr0_val;
92 unsigned long mmcra = mmcra_val; 92 unsigned long mmcra = mmcra_val;
93 93
94 ppc64_enable_pmcs(); 94 ppc_enable_pmcs();
95 95
96 /* set the freeze bit */ 96 /* set the freeze bit */
97 mmcr0 |= MMCR0_FC; 97 mmcr0 |= MMCR0_FC;
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 249ba01c6674..79c1154f88d4 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -2,6 +2,7 @@ config BAMBOO
2 bool "Bamboo" 2 bool "Bamboo"
3 depends on 44x 3 depends on 44x
4 default n 4 default n
5 select PPC44x_SIMPLE
5 select 440EP 6 select 440EP
6 select PCI 7 select PCI
7 help 8 help
@@ -30,6 +31,7 @@ config SEQUOIA
30 bool "Sequoia" 31 bool "Sequoia"
31 depends on 44x 32 depends on 44x
32 default n 33 default n
34 select PPC44x_SIMPLE
33 select 440EPX 35 select 440EPX
34 help 36 help
35 This option enables support for the AMCC PPC440EPX evaluation board. 37 This option enables support for the AMCC PPC440EPX evaluation board.
@@ -38,6 +40,7 @@ config TAISHAN
38 bool "Taishan" 40 bool "Taishan"
39 depends on 44x 41 depends on 44x
40 default n 42 default n
43 select PPC44x_SIMPLE
41 select 440GX 44 select 440GX
42 select PCI 45 select PCI
43 help 46 help
@@ -48,6 +51,7 @@ config KATMAI
48 bool "Katmai" 51 bool "Katmai"
49 depends on 44x 52 depends on 44x
50 default n 53 default n
54 select PPC44x_SIMPLE
51 select 440SPe 55 select 440SPe
52 select PCI 56 select PCI
53 select PPC4xx_PCI_EXPRESS 57 select PPC4xx_PCI_EXPRESS
@@ -58,6 +62,7 @@ config RAINIER
58 bool "Rainier" 62 bool "Rainier"
59 depends on 44x 63 depends on 44x
60 default n 64 default n
65 select PPC44x_SIMPLE
61 select 440GRX 66 select 440GRX
62 select PCI 67 select PCI
63 help 68 help
@@ -76,20 +81,48 @@ config WARP
76 See http://www.pikatechnologies.com/ and follow the "PIKA for Computer 81 See http://www.pikatechnologies.com/ and follow the "PIKA for Computer
77 Telephony Developers" link for more information. 82 Telephony Developers" link for more information.
78 83
84config ARCHES
85 bool "Arches"
86 depends on 44x
87 default n
88 select PPC44x_SIMPLE
89 select 460EX # Odd since it uses 460GT but the effects are the same
90 select PCI
91 select PPC4xx_PCI_EXPRESS
92 help
93 This option enables support for the AMCC Dual PPC460GT evaluation board.
94
79config CANYONLANDS 95config CANYONLANDS
80 bool "Canyonlands" 96 bool "Canyonlands"
81 depends on 44x 97 depends on 44x
82 default n 98 default n
99 select PPC44x_SIMPLE
83 select 460EX 100 select 460EX
84 select PCI 101 select PCI
85 select PPC4xx_PCI_EXPRESS 102 select PPC4xx_PCI_EXPRESS
103 select IBM_NEW_EMAC_RGMII
104 select IBM_NEW_EMAC_ZMII
86 help 105 help
87 This option enables support for the AMCC PPC460EX evaluation board. 106 This option enables support for the AMCC PPC460EX evaluation board.
88 107
108config GLACIER
109 bool "Glacier"
110 depends on 44x
111 default n
112 select PPC44x_SIMPLE
113 select 460EX # Odd since it uses 460GT but the effects are the same
114 select PCI
115 select PPC4xx_PCI_EXPRESS
116 select IBM_NEW_EMAC_RGMII
117 select IBM_NEW_EMAC_ZMII
118 help
119 This option enables support for the AMCC PPC460GT evaluation board.
120
89config YOSEMITE 121config YOSEMITE
90 bool "Yosemite" 122 bool "Yosemite"
91 depends on 44x 123 depends on 44x
92 default n 124 default n
125 select PPC44x_SIMPLE
93 select 440EP 126 select 440EP
94 select PCI 127 select PCI
95 help 128 help
@@ -127,6 +160,13 @@ config XILINX_VIRTEX440_GENERIC_BOARD
127 Most Virtex 5 designs should use this unless it needs to do some 160 Most Virtex 5 designs should use this unless it needs to do some
128 special configuration at board probe time. 161 special configuration at board probe time.
129 162
163config PPC44x_SIMPLE
164 bool "Simple PowerPC 44x board support"
165 depends on 44x
166 default n
167 help
168 This option enables the simple PowerPC 44x platform support.
169
130# 44x specific CPU modules, selected based on the board above. 170# 44x specific CPU modules, selected based on the board above.
131config 440EP 171config 440EP
132 bool 172 bool
@@ -170,8 +210,6 @@ config 460EX
170 bool 210 bool
171 select PPC_FPU 211 select PPC_FPU
172 select IBM_NEW_EMAC_EMAC4 212 select IBM_NEW_EMAC_EMAC4
173 select IBM_NEW_EMAC_RGMII
174 select IBM_NEW_EMAC_ZMII
175 select IBM_NEW_EMAC_TAH 213 select IBM_NEW_EMAC_TAH
176 214
177# 44x errata/workaround config symbols, selected by the CPU models above 215# 44x errata/workaround config symbols, selected by the CPU models above
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 8d0b1a192d62..698133180aee 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -1,13 +1,7 @@
1obj-$(CONFIG_44x) := misc_44x.o idle.o 1obj-$(CONFIG_44x) := misc_44x.o idle.o
2obj-$(CONFIG_PPC44x_SIMPLE) += ppc44x_simple.o
2obj-$(CONFIG_EBONY) += ebony.o 3obj-$(CONFIG_EBONY) += ebony.o
3obj-$(CONFIG_TAISHAN) += taishan.o
4obj-$(CONFIG_BAMBOO) += bamboo.o
5obj-$(CONFIG_YOSEMITE) += bamboo.o
6obj-$(CONFIG_SAM440EP) += sam440ep.o 4obj-$(CONFIG_SAM440EP) += sam440ep.o
7obj-$(CONFIG_SEQUOIA) += sequoia.o
8obj-$(CONFIG_KATMAI) += katmai.o
9obj-$(CONFIG_RAINIER) += rainier.o
10obj-$(CONFIG_WARP) += warp.o 5obj-$(CONFIG_WARP) += warp.o
11obj-$(CONFIG_WARP) += warp-nand.o 6obj-$(CONFIG_WARP) += warp-nand.o
12obj-$(CONFIG_CANYONLANDS) += canyonlands.o
13obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o 7obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o
diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
deleted file mode 100644
index cef169e95156..000000000000
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Bamboo board specific routines
3 *
4 * Wade Farnsworth <wfarnsworth@mvista.com>
5 * Copyright 2004 MontaVista Software Inc.
6 *
7 * Rewritten and ported to the merged powerpc tree:
8 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
9 * Copyright 2007 IBM Corporation
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#include <linux/init.h>
17#include <linux/of_platform.h>
18
19#include <asm/machdep.h>
20#include <asm/prom.h>
21#include <asm/udbg.h>
22#include <asm/time.h>
23#include <asm/uic.h>
24#include <asm/pci-bridge.h>
25#include <asm/ppc4xx.h>
26
27static __initdata struct of_device_id bamboo_of_bus[] = {
28 { .compatible = "ibm,plb4", },
29 { .compatible = "ibm,opb", },
30 { .compatible = "ibm,ebc", },
31 {},
32};
33
34static int __init bamboo_device_probe(void)
35{
36 of_platform_bus_probe(NULL, bamboo_of_bus, NULL);
37
38 return 0;
39}
40machine_device_initcall(bamboo, bamboo_device_probe);
41
42static int __init bamboo_probe(void)
43{
44 unsigned long root = of_get_flat_dt_root();
45
46 if (!of_flat_dt_is_compatible(root, "amcc,bamboo"))
47 return 0;
48
49 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
50
51 return 1;
52}
53
54define_machine(bamboo) {
55 .name = "Bamboo",
56 .probe = bamboo_probe,
57 .progress = udbg_progress,
58 .init_IRQ = uic_init_tree,
59 .get_irq = uic_get_irq,
60 .restart = ppc4xx_reset_system,
61 .calibrate_decr = generic_calibrate_decr,
62};
diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c
deleted file mode 100644
index 3949289f51df..000000000000
--- a/arch/powerpc/platforms/44x/canyonlands.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Canyonlands board specific routines
3 *
4 * Copyright 2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
5 *
6 * Based on the Katmai code by
7 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
8 * Copyright 2007 IBM Corp.
9 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
10 * Copyright 2007 IBM Corporation
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#include <linux/init.h>
18#include <linux/of_platform.h>
19
20#include <asm/machdep.h>
21#include <asm/prom.h>
22#include <asm/udbg.h>
23#include <asm/time.h>
24#include <asm/uic.h>
25#include <asm/pci-bridge.h>
26#include <asm/ppc4xx.h>
27
28static __initdata struct of_device_id canyonlands_of_bus[] = {
29 { .compatible = "ibm,plb4", },
30 { .compatible = "ibm,opb", },
31 { .compatible = "ibm,ebc", },
32 {},
33};
34
35static int __init canyonlands_device_probe(void)
36{
37 of_platform_bus_probe(NULL, canyonlands_of_bus, NULL);
38
39 return 0;
40}
41machine_device_initcall(canyonlands, canyonlands_device_probe);
42
43static int __init canyonlands_probe(void)
44{
45 unsigned long root = of_get_flat_dt_root();
46
47 if (!of_flat_dt_is_compatible(root, "amcc,canyonlands"))
48 return 0;
49
50 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
51
52 return 1;
53}
54
55define_machine(canyonlands) {
56 .name = "Canyonlands",
57 .probe = canyonlands_probe,
58 .progress = udbg_progress,
59 .init_IRQ = uic_init_tree,
60 .get_irq = uic_get_irq,
61 .restart = ppc4xx_reset_system,
62 .calibrate_decr = generic_calibrate_decr,
63};
diff --git a/arch/powerpc/platforms/44x/katmai.c b/arch/powerpc/platforms/44x/katmai.c
deleted file mode 100644
index 44f4b3a00ced..000000000000
--- a/arch/powerpc/platforms/44x/katmai.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Katmai board specific routines
3 *
4 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 * Copyright 2007 IBM Corp.
6 *
7 * Based on the Bamboo code by
8 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
9 * Copyright 2007 IBM Corporation
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#include <linux/init.h>
17#include <linux/of_platform.h>
18
19#include <asm/machdep.h>
20#include <asm/prom.h>
21#include <asm/udbg.h>
22#include <asm/time.h>
23#include <asm/uic.h>
24#include <asm/pci-bridge.h>
25#include <asm/ppc4xx.h>
26
27static __initdata struct of_device_id katmai_of_bus[] = {
28 { .compatible = "ibm,plb4", },
29 { .compatible = "ibm,opb", },
30 { .compatible = "ibm,ebc", },
31 {},
32};
33
34static int __init katmai_device_probe(void)
35{
36 of_platform_bus_probe(NULL, katmai_of_bus, NULL);
37
38 return 0;
39}
40machine_device_initcall(katmai, katmai_device_probe);
41
42static int __init katmai_probe(void)
43{
44 unsigned long root = of_get_flat_dt_root();
45
46 if (!of_flat_dt_is_compatible(root, "amcc,katmai"))
47 return 0;
48
49 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
50
51 return 1;
52}
53
54define_machine(katmai) {
55 .name = "Katmai",
56 .probe = katmai_probe,
57 .progress = udbg_progress,
58 .init_IRQ = uic_init_tree,
59 .get_irq = uic_get_irq,
60 .restart = ppc4xx_reset_system,
61 .calibrate_decr = generic_calibrate_decr,
62};
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
new file mode 100644
index 000000000000..29671262801f
--- /dev/null
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -0,0 +1,88 @@
1/*
2 * Generic PowerPC 44x platform support
3 *
4 * Copyright 2008 IBM Corporation
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; version 2 of the License.
9 *
10 * This implements simple platform support for PowerPC 44x chips. This is
11 * mostly used for eval boards or other simple and "generic" 44x boards. If
12 * your board has custom functions or hardware, then you will likely want to
13 * implement your own board.c file to accommodate it.
14 */
15
16#include <asm/machdep.h>
17#include <asm/pci-bridge.h>
18#include <asm/ppc4xx.h>
19#include <asm/prom.h>
20#include <asm/time.h>
21#include <asm/udbg.h>
22#include <asm/uic.h>
23
24#include <linux/init.h>
25#include <linux/of_platform.h>
26
27static __initdata struct of_device_id ppc44x_of_bus[] = {
28 { .compatible = "ibm,plb4", },
29 { .compatible = "ibm,opb", },
30 { .compatible = "ibm,ebc", },
31 { .compatible = "simple-bus", },
32 {},
33};
34
35static int __init ppc44x_device_probe(void)
36{
37 of_platform_bus_probe(NULL, ppc44x_of_bus, NULL);
38
39 return 0;
40}
41machine_device_initcall(ppc44x_simple, ppc44x_device_probe);
42
43/* This is the list of boards that can be supported by this simple
44 * platform code. This does _not_ mean the boards are compatible,
45 * as they most certainly are not from a device tree perspective.
46 * However, their differences are handled by the device tree and the
47 * drivers and therefore they don't need custom board support files.
48 *
49 * Again, if your board needs to do things differently then create a
50 * board.c file for it rather than adding it to this list.
51 */
52static char *board[] __initdata = {
53 "amcc,arches",
54 "amcc,bamboo",
55 "amcc,canyonlands",
56 "amcc,glacier",
57 "ibm,ebony",
58 "amcc,katmai",
59 "amcc,rainier",
60 "amcc,sequoia",
61 "amcc,taishan",
62 "amcc,yosemite"
63};
64
65static int __init ppc44x_probe(void)
66{
67 unsigned long root = of_get_flat_dt_root();
68 int i = 0;
69
70 for (i = 0; i < ARRAY_SIZE(board); i++) {
71 if (of_flat_dt_is_compatible(root, board[i])) {
72 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
73 return 1;
74 }
75 }
76
77 return 0;
78}
79
80define_machine(ppc44x_simple) {
81 .name = "PowerPC 44x Platform",
82 .probe = ppc44x_probe,
83 .progress = udbg_progress,
84 .init_IRQ = uic_init_tree,
85 .get_irq = uic_get_irq,
86 .restart = ppc4xx_reset_system,
87 .calibrate_decr = generic_calibrate_decr,
88};
diff --git a/arch/powerpc/platforms/44x/rainier.c b/arch/powerpc/platforms/44x/rainier.c
deleted file mode 100644
index 4f1ff84c4b63..000000000000
--- a/arch/powerpc/platforms/44x/rainier.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Rainier board specific routines
3 *
4 * Valentine Barshak <vbarshak@ru.mvista.com>
5 * Copyright 2007 MontaVista Software Inc.
6 *
7 * Based on the Bamboo code by
8 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
9 * Copyright 2007 IBM Corporation
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#include <linux/init.h>
17#include <linux/of_platform.h>
18
19#include <asm/machdep.h>
20#include <asm/prom.h>
21#include <asm/udbg.h>
22#include <asm/time.h>
23#include <asm/uic.h>
24#include <asm/pci-bridge.h>
25#include <asm/ppc4xx.h>
26
27static __initdata struct of_device_id rainier_of_bus[] = {
28 { .compatible = "ibm,plb4", },
29 { .compatible = "ibm,opb", },
30 { .compatible = "ibm,ebc", },
31 {},
32};
33
34static int __init rainier_device_probe(void)
35{
36 of_platform_bus_probe(NULL, rainier_of_bus, NULL);
37
38 return 0;
39}
40machine_device_initcall(rainier, rainier_device_probe);
41
42static int __init rainier_probe(void)
43{
44 unsigned long root = of_get_flat_dt_root();
45
46 if (!of_flat_dt_is_compatible(root, "amcc,rainier"))
47 return 0;
48
49 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
50
51 return 1;
52}
53
54define_machine(rainier) {
55 .name = "Rainier",
56 .probe = rainier_probe,
57 .progress = udbg_progress,
58 .init_IRQ = uic_init_tree,
59 .get_irq = uic_get_irq,
60 .restart = ppc4xx_reset_system,
61 .calibrate_decr = generic_calibrate_decr,
62};
diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
deleted file mode 100644
index 49eb73daacdf..000000000000
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Sequoia board specific routines
3 *
4 * Valentine Barshak <vbarshak@ru.mvista.com>
5 * Copyright 2007 MontaVista Software Inc.
6 *
7 * Based on the Bamboo code by
8 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
9 * Copyright 2007 IBM Corporation
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#include <linux/init.h>
17#include <linux/of_platform.h>
18
19#include <asm/machdep.h>
20#include <asm/prom.h>
21#include <asm/udbg.h>
22#include <asm/time.h>
23#include <asm/uic.h>
24#include <asm/pci-bridge.h>
25
26#include <asm/ppc4xx.h>
27
28static __initdata struct of_device_id sequoia_of_bus[] = {
29 { .compatible = "ibm,plb4", },
30 { .compatible = "ibm,opb", },
31 { .compatible = "ibm,ebc", },
32 {},
33};
34
35static int __init sequoia_device_probe(void)
36{
37 of_platform_bus_probe(NULL, sequoia_of_bus, NULL);
38
39 return 0;
40}
41machine_device_initcall(sequoia, sequoia_device_probe);
42
43static int __init sequoia_probe(void)
44{
45 unsigned long root = of_get_flat_dt_root();
46
47 if (!of_flat_dt_is_compatible(root, "amcc,sequoia"))
48 return 0;
49
50 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
51
52 return 1;
53}
54
55define_machine(sequoia) {
56 .name = "Sequoia",
57 .probe = sequoia_probe,
58 .progress = udbg_progress,
59 .init_IRQ = uic_init_tree,
60 .get_irq = uic_get_irq,
61 .restart = ppc4xx_reset_system,
62 .calibrate_decr = generic_calibrate_decr,
63};
diff --git a/arch/powerpc/platforms/44x/taishan.c b/arch/powerpc/platforms/44x/taishan.c
deleted file mode 100644
index 49c78b2098b4..000000000000
--- a/arch/powerpc/platforms/44x/taishan.c
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * Taishan board specific routines based off ebony.c code
3 * original copyrights below
4 *
5 * Matt Porter <mporter@kernel.crashing.org>
6 * Copyright 2002-2005 MontaVista Software Inc.
7 *
8 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
9 * Copyright (c) 2003-2005 Zultys Technologies
10 *
11 * Rewritten and ported to the merged powerpc tree:
12 * Copyright 2007 David Gibson <dwg@au1.ibm.com>, IBM Corporation.
13 *
14 * Modified from ebony.c for taishan:
15 * Copyright 2007 Hugh Blemings <hugh@au.ibm.com>, IBM Corporation.
16 *
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2 of the License, or (at your
20 * option) any later version.
21 */
22
23#include <linux/init.h>
24#include <linux/of_platform.h>
25
26#include <asm/machdep.h>
27#include <asm/prom.h>
28#include <asm/udbg.h>
29#include <asm/time.h>
30#include <asm/uic.h>
31#include <asm/pci-bridge.h>
32#include <asm/ppc4xx.h>
33
34static __initdata struct of_device_id taishan_of_bus[] = {
35 { .compatible = "ibm,plb4", },
36 { .compatible = "ibm,opb", },
37 { .compatible = "ibm,ebc", },
38 {},
39};
40
41static int __init taishan_device_probe(void)
42{
43 of_platform_bus_probe(NULL, taishan_of_bus, NULL);
44
45 return 0;
46}
47machine_device_initcall(taishan, taishan_device_probe);
48
49/*
50 * Called very early, MMU is off, device-tree isn't unflattened
51 */
52static int __init taishan_probe(void)
53{
54 unsigned long root = of_get_flat_dt_root();
55
56 if (!of_flat_dt_is_compatible(root, "amcc,taishan"))
57 return 0;
58
59 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
60
61 return 1;
62}
63
64define_machine(taishan) {
65 .name = "Taishan",
66 .probe = taishan_probe,
67 .progress = udbg_progress,
68 .init_IRQ = uic_init_tree,
69 .get_irq = uic_get_irq,
70 .restart = ppc4xx_reset_system,
71 .calibrate_decr = generic_calibrate_decr,
72};
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index c62f893ede19..326852c78b8f 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -3,6 +3,8 @@ config PPC_MPC512x
3 select FSL_SOC 3 select FSL_SOC
4 select IPIC 4 select IPIC
5 select PPC_CLOCK 5 select PPC_CLOCK
6 select PPC_PCI_CHOICE
7 select FSL_PCI if PCI
6 8
7config PPC_MPC5121 9config PPC_MPC5121
8 bool 10 bool
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index 5ebf6939a697..441abc488851 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -22,16 +22,26 @@
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/time.h> 23#include <asm/time.h>
24 24
25#include <sysdev/fsl_pci.h>
26
25#include "mpc512x.h" 27#include "mpc512x.h"
26#include "mpc5121_ads.h" 28#include "mpc5121_ads.h"
27 29
28static void __init mpc5121_ads_setup_arch(void) 30static void __init mpc5121_ads_setup_arch(void)
29{ 31{
32#ifdef CONFIG_PCI
33 struct device_node *np;
34#endif
30 printk(KERN_INFO "MPC5121 ADS board from Freescale Semiconductor\n"); 35 printk(KERN_INFO "MPC5121 ADS board from Freescale Semiconductor\n");
31 /* 36 /*
32 * cpld regs are needed early 37 * cpld regs are needed early
33 */ 38 */
34 mpc5121_ads_cpld_map(); 39 mpc5121_ads_cpld_map();
40
41#ifdef CONFIG_PCI
42 for_each_compatible_node(np, "pci", "fsl,mpc5121-pci")
43 mpc83xx_add_bridge(np);
44#endif
35} 45}
36 46
37static void __init mpc5121_ads_init_IRQ(void) 47static void __init mpc5121_ads_init_IRQ(void)
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 4d5fd1dbd400..044b4e6e8743 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -90,7 +90,7 @@ mpc5200_setup_xlb_arbiter(void)
90 of_node_put(np); 90 of_node_put(np);
91 if (!xlb) { 91 if (!xlb) {
92 printk(KERN_ERR __FILE__ ": " 92 printk(KERN_ERR __FILE__ ": "
93 "Error mapping XLB in mpc52xx_setup_cpu(). " 93 "Error mapping XLB in mpc52xx_setup_cpu(). "
94 "Expect some abnormal behavior\n"); 94 "Expect some abnormal behavior\n");
95 return; 95 return;
96 } 96 }
@@ -216,7 +216,8 @@ mpc52xx_restart(char *cmd)
216 out_be32(&mpc52xx_wdt->count, 0x000000ff); 216 out_be32(&mpc52xx_wdt->count, 0x000000ff);
217 out_be32(&mpc52xx_wdt->mode, 0x00009004); 217 out_be32(&mpc52xx_wdt->mode, 0x00009004);
218 } else 218 } else
219 printk("mpc52xx_restart: Can't access wdt. " 219 printk(KERN_ERR __FILE__ ": "
220 "mpc52xx_restart: Can't access wdt. "
220 "Restart impossible, system halted.\n"); 221 "Restart impossible, system halted.\n");
221 222
222 while (1); 223 while (1);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
index 5a382bb15f62..b49a18527661 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -265,8 +265,11 @@ mpc52xx_pci_setup(struct pci_controller *hose,
265 /* Memory windows */ 265 /* Memory windows */
266 res = &hose->mem_resources[0]; 266 res = &hose->mem_resources[0];
267 if (res->flags) { 267 if (res->flags) {
268 pr_debug("mem_resource[0] = {.start=%x, .end=%x, .flags=%lx}\n", 268 pr_debug("mem_resource[0] = "
269 res->start, res->end, res->flags); 269 "{.start=%llx, .end=%llx, .flags=%llx}\n",
270 (unsigned long long)res->start,
271 (unsigned long long)res->end,
272 (unsigned long long)res->flags);
270 out_be32(&pci_regs->iw0btar, 273 out_be32(&pci_regs->iw0btar,
271 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start, 274 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
272 res->end - res->start + 1)); 275 res->end - res->start + 1));
@@ -297,9 +300,11 @@ mpc52xx_pci_setup(struct pci_controller *hose,
297 printk(KERN_ERR "%s: Didn't find IO resources\n", __FILE__); 300 printk(KERN_ERR "%s: Didn't find IO resources\n", __FILE__);
298 return; 301 return;
299 } 302 }
300 pr_debug(".io_resource={.start=%x,.end=%x,.flags=%lx} " 303 pr_debug(".io_resource={.start=%llx,.end=%llx,.flags=%llx} "
301 ".io_base_phys=0x%p\n", 304 ".io_base_phys=0x%p\n",
302 res->start, res->end, res->flags, (void*)hose->io_base_phys); 305 (unsigned long long)res->start,
306 (unsigned long long)res->end,
307 (unsigned long long)res->flags, (void*)hose->io_base_phys);
303 out_be32(&pci_regs->iw2btar, 308 out_be32(&pci_regs->iw2btar,
304 MPC52xx_PCI_IWBTAR_TRANSLATION(hose->io_base_phys, 309 MPC52xx_PCI_IWBTAR_TRANSLATION(hose->io_base_phys,
305 res->start, 310 res->start,
diff --git a/arch/powerpc/platforms/82xx/Kconfig b/arch/powerpc/platforms/82xx/Kconfig
index 75eb1ede5497..30f008b2f92e 100644
--- a/arch/powerpc/platforms/82xx/Kconfig
+++ b/arch/powerpc/platforms/82xx/Kconfig
@@ -38,6 +38,14 @@ config EP8248E
38 This board is also resold by Freescale as the QUICCStart 38 This board is also resold by Freescale as the QUICCStart
39 MPC8248 Evaluation System and/or the CWH-PPC-8248N-VE. 39 MPC8248 Evaluation System and/or the CWH-PPC-8248N-VE.
40 40
41config MGCOGE
42 bool "Keymile MGCOGE"
43 select 8272
44 select 8260
45 select FSL_SOC
46 help
47 This enables support for the Keymile MGCOGE board.
48
41endif 49endif
42 50
43config PQ2ADS 51config PQ2ADS
diff --git a/arch/powerpc/platforms/82xx/Makefile b/arch/powerpc/platforms/82xx/Makefile
index 6cd5cd59bf2a..d982793f4dbd 100644
--- a/arch/powerpc/platforms/82xx/Makefile
+++ b/arch/powerpc/platforms/82xx/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_CPM2) += pq2.o
6obj-$(CONFIG_PQ2_ADS_PCI_PIC) += pq2ads-pci-pic.o 6obj-$(CONFIG_PQ2_ADS_PCI_PIC) += pq2ads-pci-pic.o
7obj-$(CONFIG_PQ2FADS) += pq2fads.o 7obj-$(CONFIG_PQ2FADS) += pq2fads.o
8obj-$(CONFIG_EP8248E) += ep8248e.o 8obj-$(CONFIG_EP8248E) += ep8248e.o
9obj-$(CONFIG_MGCOGE) += mgcoge.o
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index d5770fdf7f09..0eb6d7f62241 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -137,7 +137,7 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev,
137 bus->irq[i] = -1; 137 bus->irq[i] = -1;
138 138
139 bus->name = "ep8248e-mdio-bitbang"; 139 bus->name = "ep8248e-mdio-bitbang";
140 bus->dev = &ofdev->dev; 140 bus->parent = &ofdev->dev;
141 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start); 141 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
142 142
143 return mdiobus_register(bus); 143 return mdiobus_register(bus);
diff --git a/arch/powerpc/platforms/82xx/mgcoge.c b/arch/powerpc/platforms/82xx/mgcoge.c
new file mode 100644
index 000000000000..c2af169c1d1d
--- /dev/null
+++ b/arch/powerpc/platforms/82xx/mgcoge.c
@@ -0,0 +1,129 @@
1/*
2 * Keymile mgcoge support
3 * Copyright 2008 DENX Software Engineering GmbH
4 * Author: Heiko Schocher <hs@denx.de>
5 *
6 * based on code from:
7 * Copyright 2007 Freescale Semiconductor, Inc.
8 * Author: Scott Wood <scottwood@freescale.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/interrupt.h>
18#include <linux/fsl_devices.h>
19#include <linux/of_platform.h>
20
21#include <asm/io.h>
22#include <asm/cpm2.h>
23#include <asm/udbg.h>
24#include <asm/machdep.h>
25#include <asm/time.h>
26#include <asm/mpc8260.h>
27#include <asm/prom.h>
28
29#include <sysdev/fsl_soc.h>
30#include <sysdev/cpm2_pic.h>
31
32#include "pq2.h"
33
34static void __init mgcoge_pic_init(void)
35{
36 struct device_node *np = of_find_compatible_node(NULL, NULL, "fsl,pq2-pic");
37 if (!np) {
38 printk(KERN_ERR "PIC init: can not find cpm-pic node\n");
39 return;
40 }
41
42 cpm2_pic_init(np);
43 of_node_put(np);
44}
45
46struct cpm_pin {
47 int port, pin, flags;
48};
49
50static __initdata struct cpm_pin mgcoge_pins[] = {
51
52 /* SMC2 */
53 {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
54 {1, 9, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
55
56 /* SCC4 */
57 {3, 25, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
58 {3, 24, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
59 {3, 9, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
60 {3, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
61 {4, 22, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
62 {4, 21, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
63};
64
65static void __init init_ioports(void)
66{
67 int i;
68
69 for (i = 0; i < ARRAY_SIZE(mgcoge_pins); i++) {
70 const struct cpm_pin *pin = &mgcoge_pins[i];
71 cpm2_set_pin(pin->port - 1, pin->pin, pin->flags);
72 }
73
74 cpm2_smc_clk_setup(CPM_CLK_SMC2, CPM_BRG8);
75 cpm2_clk_setup(CPM_CLK_SCC4, CPM_CLK7, CPM_CLK_RX);
76 cpm2_clk_setup(CPM_CLK_SCC4, CPM_CLK8, CPM_CLK_TX);
77}
78
79static void __init mgcoge_setup_arch(void)
80{
81 if (ppc_md.progress)
82 ppc_md.progress("mgcoge_setup_arch()", 0);
83
84 cpm2_reset();
85
86 /* When this is set, snooping CPM DMA from RAM causes
87 * machine checks. See erratum SIU18.
88 */
89 clrbits32(&cpm2_immr->im_siu_conf.siu_82xx.sc_bcr, MPC82XX_BCR_PLDP);
90
91 init_ioports();
92
93 if (ppc_md.progress)
94 ppc_md.progress("mgcoge_setup_arch(), finish", 0);
95}
96
97static __initdata struct of_device_id of_bus_ids[] = {
98 { .compatible = "simple-bus", },
99 {},
100};
101
102static int __init declare_of_platform_devices(void)
103{
104 of_platform_bus_probe(NULL, of_bus_ids, NULL);
105
106 return 0;
107}
108machine_device_initcall(mgcoge, declare_of_platform_devices);
109
110/*
111 * Called very early, device-tree isn't unflattened
112 */
113static int __init mgcoge_probe(void)
114{
115 unsigned long root = of_get_flat_dt_root();
116 return of_flat_dt_is_compatible(root, "keymile,mgcoge");
117}
118
119define_machine(mgcoge)
120{
121 .name = "Keymile MGCOGE",
122 .probe = mgcoge_probe,
123 .setup_arch = mgcoge_setup_arch,
124 .init_IRQ = mgcoge_pic_init,
125 .get_irq = cpm2_get_irq,
126 .calibrate_decr = generic_calibrate_decr,
127 .restart = pq2_restart,
128 .progress = udbg_progress,
129};
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index 6159c5d4e5f1..83c664afc897 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -19,7 +19,6 @@ config MPC831x_RDB
19config MPC832x_MDS 19config MPC832x_MDS
20 bool "Freescale MPC832x MDS" 20 bool "Freescale MPC832x MDS"
21 select DEFAULT_UIMAGE 21 select DEFAULT_UIMAGE
22 select QUICC_ENGINE
23 select PPC_MPC832x 22 select PPC_MPC832x
24 help 23 help
25 This option enables support for the MPC832x MDS evaluation board. 24 This option enables support for the MPC832x MDS evaluation board.
@@ -27,7 +26,6 @@ config MPC832x_MDS
27config MPC832x_RDB 26config MPC832x_RDB
28 bool "Freescale MPC832x RDB" 27 bool "Freescale MPC832x RDB"
29 select DEFAULT_UIMAGE 28 select DEFAULT_UIMAGE
30 select QUICC_ENGINE
31 select PPC_MPC832x 29 select PPC_MPC832x
32 help 30 help
33 This option enables support for the MPC8323 RDB board. 31 This option enables support for the MPC8323 RDB board.
@@ -57,15 +55,12 @@ config MPC834x_ITX
57config MPC836x_MDS 55config MPC836x_MDS
58 bool "Freescale MPC836x MDS" 56 bool "Freescale MPC836x MDS"
59 select DEFAULT_UIMAGE 57 select DEFAULT_UIMAGE
60 select QUICC_ENGINE
61 help 58 help
62 This option enables support for the MPC836x MDS Processor Board. 59 This option enables support for the MPC836x MDS Processor Board.
63 60
64config MPC836x_RDK 61config MPC836x_RDK
65 bool "Freescale/Logic MPC836x RDK" 62 bool "Freescale/Logic MPC836x RDK"
66 select DEFAULT_UIMAGE 63 select DEFAULT_UIMAGE
67 select QUICC_ENGINE
68 select QE_GPIO
69 select FSL_GTM 64 select FSL_GTM
70 select FSL_LBC 65 select FSL_LBC
71 help 66 help
diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c
index be62de23bead..8bb13c807142 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c
@@ -85,8 +85,14 @@ static void __init mpc837x_mds_setup_arch(void)
85 ppc_md.progress("mpc837x_mds_setup_arch()", 0); 85 ppc_md.progress("mpc837x_mds_setup_arch()", 0);
86 86
87#ifdef CONFIG_PCI 87#ifdef CONFIG_PCI
88 for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 88 for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") {
89 if (!of_device_is_available(np)) {
90 pr_warning("%s: disabled by the firmware.\n",
91 np->full_name);
92 continue;
93 }
89 mpc83xx_add_bridge(np); 94 mpc83xx_add_bridge(np);
95 }
90#endif 96#endif
91 mpc837xmds_usb_cfg(); 97 mpc837xmds_usb_cfg();
92} 98}
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 291675b0097a..b79dc710ed34 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -33,7 +33,6 @@ config MPC85xx_CDS
33config MPC85xx_MDS 33config MPC85xx_MDS
34 bool "Freescale MPC85xx MDS" 34 bool "Freescale MPC85xx MDS"
35 select DEFAULT_UIMAGE 35 select DEFAULT_UIMAGE
36 select QUICC_ENGINE
37 select PHYLIB 36 select PHYLIB
38 help 37 help
39 This option enables support for the MPC85xx MDS board 38 This option enables support for the MPC85xx MDS board
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index d17807a6b89a..0293e3d3580f 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -213,7 +213,6 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
213 svid = mfspr(SPRN_SVR); 213 svid = mfspr(SPRN_SVR);
214 214
215 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n"); 215 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
216 seq_printf(m, "Machine\t\t: mpc85xx\n");
217 seq_printf(m, "PVR\t\t: 0x%x\n", pvid); 216 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
218 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 217 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
219 218
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index 6509ade71668..0c9a856f66b6 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -156,7 +156,7 @@ static void __init init_ioports(void)
156 int i; 156 int i;
157 157
158 for (i = 0; i < ARRAY_SIZE(sbc8560_pins); i++) { 158 for (i = 0; i < ARRAY_SIZE(sbc8560_pins); i++) {
159 struct cpm_pin *pin = &sbc8560_pins[i]; 159 const struct cpm_pin *pin = &sbc8560_pins[i];
160 cpm2_set_pin(pin->port, pin->pin, pin->flags); 160 cpm2_set_pin(pin->port, pin->pin, pin->flags);
161 } 161 }
162 162
@@ -200,7 +200,6 @@ static void sbc8560_show_cpuinfo(struct seq_file *m)
200 svid = mfspr(SPRN_SVR); 200 svid = mfspr(SPRN_SVR);
201 201
202 seq_printf(m, "Vendor\t\t: Wind River\n"); 202 seq_printf(m, "Vendor\t\t: Wind River\n");
203 seq_printf(m, "Machine\t\t: SBC8560\n");
204 seq_printf(m, "PVR\t\t: 0x%x\n", pvid); 203 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
205 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 204 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
206 205
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 9355a5269431..77dd797a2580 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -31,6 +31,13 @@ config MPC8610_HPCD
31 help 31 help
32 This option enables support for the MPC8610 HPCD board. 32 This option enables support for the MPC8610 HPCD board.
33 33
34config GEF_SBC610
35 bool "GE Fanuc SBC610"
36 select DEFAULT_UIMAGE
37 select HAS_RAPIDIO
38 help
39 This option enables support for GE Fanuc's SBC610.
40
34endif 41endif
35 42
36config MPC8641 43config MPC8641
@@ -39,7 +46,7 @@ config MPC8641
39 select FSL_PCI if PCI 46 select FSL_PCI if PCI
40 select PPC_UDBG_16550 47 select PPC_UDBG_16550
41 select MPIC 48 select MPIC
42 default y if MPC8641_HPCN || SBC8641D 49 default y if MPC8641_HPCN || SBC8641D || GEF_SBC610
43 50
44config MPC8610 51config MPC8610
45 bool 52 bool
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
index 8fee37dec795..4a56ff619afd 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_SMP) += mpc86xx_smp.o
7obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o 7obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
8obj-$(CONFIG_SBC8641D) += sbc8641d.o 8obj-$(CONFIG_SBC8641D) += sbc8641d.o
9obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o 9obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o
10obj-$(CONFIG_GEF_SBC610) += gef_sbc610.o gef_pic.o
diff --git a/arch/powerpc/platforms/86xx/gef_pic.c b/arch/powerpc/platforms/86xx/gef_pic.c
new file mode 100644
index 000000000000..50d0a2b63809
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/gef_pic.c
@@ -0,0 +1,258 @@
1/*
2 * Interrupt handling for GE Fanuc's FPGA based PIC
3 *
4 * Author: Martyn Welch <martyn.welch@gefanuc.com>
5 *
6 * 2008 (c) GE Fanuc Intelligent Platforms Embedded Systems, Inc.
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/interrupt.h>
18#include <linux/spinlock.h>
19
20#include <asm/byteorder.h>
21#include <asm/io.h>
22#include <asm/prom.h>
23#include <asm/irq.h>
24
25#include "gef_pic.h"
26
27#define DEBUG
28#undef DEBUG
29
30#ifdef DEBUG
31#define DBG(fmt...) do { printk(KERN_DEBUG "gef_pic: " fmt); } while (0)
32#else
33#define DBG(fmt...) do { } while (0)
34#endif
35
36#define GEF_PIC_NUM_IRQS 32
37
38/* Interrupt Controller Interface Registers */
39#define GEF_PIC_INTR_STATUS 0x0000
40
41#define GEF_PIC_INTR_MASK(cpu) (0x0010 + (0x4 * cpu))
42#define GEF_PIC_CPU0_INTR_MASK GEF_PIC_INTR_MASK(0)
43#define GEF_PIC_CPU1_INTR_MASK GEF_PIC_INTR_MASK(1)
44
45#define GEF_PIC_MCP_MASK(cpu) (0x0018 + (0x4 * cpu))
46#define GEF_PIC_CPU0_MCP_MASK GEF_PIC_MCP_MASK(0)
47#define GEF_PIC_CPU1_MCP_MASK GEF_PIC_MCP_MASK(1)
48
49#define gef_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
50
51
52static DEFINE_SPINLOCK(gef_pic_lock);
53
54static void __iomem *gef_pic_irq_reg_base;
55static struct irq_host *gef_pic_irq_host;
56static int gef_pic_cascade_irq;
57
58/*
59 * Interrupt Controller Handling
60 *
61 * The interrupt controller handles interrupts for most on board interrupts,
62 * apart from PCI interrupts. For example on SBC610:
63 *
64 * 17:31 RO Reserved
65 * 16 RO PCI Express Doorbell 3 Status
66 * 15 RO PCI Express Doorbell 2 Status
67 * 14 RO PCI Express Doorbell 1 Status
68 * 13 RO PCI Express Doorbell 0 Status
69 * 12 RO Real Time Clock Interrupt Status
70 * 11 RO Temperature Interrupt Status
71 * 10 RO Temperature Critical Interrupt Status
72 * 9 RO Ethernet PHY1 Interrupt Status
73 * 8 RO Ethernet PHY3 Interrupt Status
74 * 7 RO PEX8548 Interrupt Status
75 * 6 RO Reserved
76 * 5 RO Watchdog 0 Interrupt Status
77 * 4 RO Watchdog 1 Interrupt Status
78 * 3 RO AXIS Message FIFO A Interrupt Status
79 * 2 RO AXIS Message FIFO B Interrupt Status
80 * 1 RO AXIS Message FIFO C Interrupt Status
81 * 0 RO AXIS Message FIFO D Interrupt Status
82 *
83 * Interrupts can be forwarded to one of two output lines. Nothing
84 * clever is done, so if the masks are incorrectly set, a single input
85 * interrupt could generate interrupts on both output lines!
86 *
87 * The dual lines are there to allow the chained interrupts to be easily
88 * passed into two different cores. We currently do not use this functionality
89 * in this driver.
90 *
91 * Controller can also be configured to generate Machine checks (MCP), again on
92 * two lines, to be attached to two different cores. It is suggested that these
93 * should be masked out.
94 */
95
96void gef_pic_cascade(unsigned int irq, struct irq_desc *desc)
97{
98 unsigned int cascade_irq;
99
100 /*
101 * See if we actually have an interrupt, call generic handling code if
102 * we do.
103 */
104 cascade_irq = gef_pic_get_irq();
105
106 if (cascade_irq != NO_IRQ)
107 generic_handle_irq(cascade_irq);
108
109 desc->chip->eoi(irq);
110
111}
112
113static void gef_pic_mask(unsigned int virq)
114{
115 unsigned long flags;
116 unsigned int hwirq;
117 u32 mask;
118
119 hwirq = gef_irq_to_hw(virq);
120
121 spin_lock_irqsave(&gef_pic_lock, flags);
122 mask = in_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_MASK(0));
123 mask &= ~(1 << hwirq);
124 out_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_MASK(0), mask);
125 spin_unlock_irqrestore(&gef_pic_lock, flags);
126}
127
128static void gef_pic_mask_ack(unsigned int virq)
129{
130 /* Don't think we actually have to do anything to ack an interrupt,
131 * we just need to clear down the devices interrupt and it will go away
132 */
133 gef_pic_mask(virq);
134}
135
136static void gef_pic_unmask(unsigned int virq)
137{
138 unsigned long flags;
139 unsigned int hwirq;
140 u32 mask;
141
142 hwirq = gef_irq_to_hw(virq);
143
144 spin_lock_irqsave(&gef_pic_lock, flags);
145 mask = in_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_MASK(0));
146 mask |= (1 << hwirq);
147 out_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_MASK(0), mask);
148 spin_unlock_irqrestore(&gef_pic_lock, flags);
149}
150
151static struct irq_chip gef_pic_chip = {
152 .typename = "gefp",
153 .mask = gef_pic_mask,
154 .mask_ack = gef_pic_mask_ack,
155 .unmask = gef_pic_unmask,
156};
157
158
159/* When an interrupt is being configured, this call allows some flexibilty
160 * in deciding which irq_chip structure is used
161 */
162static int gef_pic_host_map(struct irq_host *h, unsigned int virq,
163 irq_hw_number_t hwirq)
164{
165 /* All interrupts are LEVEL sensitive */
166 get_irq_desc(virq)->status |= IRQ_LEVEL;
167 set_irq_chip_and_handler(virq, &gef_pic_chip, handle_level_irq);
168
169 return 0;
170}
171
172static int gef_pic_host_xlate(struct irq_host *h, struct device_node *ct,
173 u32 *intspec, unsigned int intsize,
174 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
175{
176
177 *out_hwirq = intspec[0];
178 if (intsize > 1)
179 *out_flags = intspec[1];
180 else
181 *out_flags = IRQ_TYPE_LEVEL_HIGH;
182
183 return 0;
184}
185
186static struct irq_host_ops gef_pic_host_ops = {
187 .map = gef_pic_host_map,
188 .xlate = gef_pic_host_xlate,
189};
190
191
192/*
193 * Initialisation of PIC, this should be called in BSP
194 */
195void __init gef_pic_init(struct device_node *np)
196{
197 unsigned long flags;
198
199 /* Map the devices registers into memory */
200 gef_pic_irq_reg_base = of_iomap(np, 0);
201
202 spin_lock_irqsave(&gef_pic_lock, flags);
203
204 /* Initialise everything as masked. */
205 out_be32(gef_pic_irq_reg_base + GEF_PIC_CPU0_INTR_MASK, 0);
206 out_be32(gef_pic_irq_reg_base + GEF_PIC_CPU1_INTR_MASK, 0);
207
208 out_be32(gef_pic_irq_reg_base + GEF_PIC_CPU0_MCP_MASK, 0);
209 out_be32(gef_pic_irq_reg_base + GEF_PIC_CPU1_MCP_MASK, 0);
210
211 spin_unlock_irqrestore(&gef_pic_lock, flags);
212
213 /* Map controller */
214 gef_pic_cascade_irq = irq_of_parse_and_map(np, 0);
215 if (gef_pic_cascade_irq == NO_IRQ) {
216 printk(KERN_ERR "SBC610: failed to map cascade interrupt");
217 return;
218 }
219
220 /* Setup an irq_host structure */
221 gef_pic_irq_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR,
222 GEF_PIC_NUM_IRQS,
223 &gef_pic_host_ops, NO_IRQ);
224 if (gef_pic_irq_host == NULL)
225 return;
226
227 /* Chain with parent controller */
228 set_irq_chained_handler(gef_pic_cascade_irq, gef_pic_cascade);
229}
230
231/*
232 * This is called when we receive an interrupt with apparently comes from this
233 * chip - check, returning the highest interrupt generated or return NO_IRQ
234 */
235unsigned int gef_pic_get_irq(void)
236{
237 u32 cause, mask, active;
238 unsigned int virq = NO_IRQ;
239 int hwirq;
240
241 cause = in_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_STATUS);
242
243 mask = in_be32(gef_pic_irq_reg_base + GEF_PIC_INTR_MASK(0));
244
245 active = cause & mask;
246
247 if (active) {
248 for (hwirq = GEF_PIC_NUM_IRQS - 1; hwirq > -1; hwirq--) {
249 if (active & (0x1 << hwirq))
250 break;
251 }
252 virq = irq_linear_revmap(gef_pic_irq_host,
253 (irq_hw_number_t)hwirq);
254 }
255
256 return virq;
257}
258
diff --git a/arch/powerpc/platforms/86xx/gef_pic.h b/arch/powerpc/platforms/86xx/gef_pic.h
new file mode 100644
index 000000000000..6149916da3f4
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/gef_pic.h
@@ -0,0 +1,11 @@
1#ifndef __GEF_PIC_H__
2#define __GEF_PIC_H__
3
4#include <linux/init.h>
5
6void gef_pic_cascade(unsigned int, struct irq_desc *);
7unsigned int gef_pic_get_irq(void);
8void gef_pic_init(struct device_node *);
9
10#endif /* __GEF_PIC_H__ */
11
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
new file mode 100644
index 000000000000..821c45fac18b
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -0,0 +1,221 @@
1/*
2 * GE Fanuc SBC610 board support
3 *
4 * Author: Martyn Welch <martyn.welch@gefanuc.com>
5 *
6 * Copyright 2008 GE Fanuc Intelligent Platforms Embedded Systems, 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 as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * Based on: mpc86xx_hpcn.c (MPC86xx HPCN board specific routines)
14 * Copyright 2006 Freescale Semiconductor Inc.
15 *
16 * NEC fixup adapted from arch/mips/pci/fixup-lm2e.c
17 */
18
19#include <linux/stddef.h>
20#include <linux/kernel.h>
21#include <linux/pci.h>
22#include <linux/kdev_t.h>
23#include <linux/delay.h>
24#include <linux/seq_file.h>
25#include <linux/of_platform.h>
26
27#include <asm/system.h>
28#include <asm/time.h>
29#include <asm/machdep.h>
30#include <asm/pci-bridge.h>
31#include <asm/mpc86xx.h>
32#include <asm/prom.h>
33#include <mm/mmu_decl.h>
34#include <asm/udbg.h>
35
36#include <asm/mpic.h>
37
38#include <sysdev/fsl_pci.h>
39#include <sysdev/fsl_soc.h>
40
41#include "mpc86xx.h"
42#include "gef_pic.h"
43
44#undef DEBUG
45
46#ifdef DEBUG
47#define DBG (fmt...) do { printk(KERN_ERR "SBC610: " fmt); } while (0)
48#else
49#define DBG (fmt...) do { } while (0)
50#endif
51
52void __iomem *sbc610_regs;
53
54static void __init gef_sbc610_init_irq(void)
55{
56 struct device_node *cascade_node = NULL;
57
58 mpc86xx_init_irq();
59
60 /*
61 * There is a simple interrupt handler in the main FPGA, this needs
62 * to be cascaded into the MPIC
63 */
64 cascade_node = of_find_compatible_node(NULL, NULL, "gef,fpga-pic");
65 if (!cascade_node) {
66 printk(KERN_WARNING "SBC610: No FPGA PIC\n");
67 return;
68 }
69
70 gef_pic_init(cascade_node);
71 of_node_put(cascade_node);
72}
73
74static void __init gef_sbc610_setup_arch(void)
75{
76 struct device_node *regs;
77#ifdef CONFIG_PCI
78 struct device_node *np;
79
80 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
81 fsl_add_bridge(np, 1);
82 }
83#endif
84
85 printk(KERN_INFO "GE Fanuc Intelligent Platforms SBC610 6U VPX SBC\n");
86
87#ifdef CONFIG_SMP
88 mpc86xx_smp_init();
89#endif
90
91 /* Remap basic board registers */
92 regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs");
93 if (regs) {
94 sbc610_regs = of_iomap(regs, 0);
95 if (sbc610_regs == NULL)
96 printk(KERN_WARNING "Unable to map board registers\n");
97 of_node_put(regs);
98 }
99}
100
101/* Return the PCB revision */
102static unsigned int gef_sbc610_get_pcb_rev(void)
103{
104 unsigned int reg;
105
106 reg = ioread32(sbc610_regs);
107 return (reg >> 8) & 0xff;
108}
109
110/* Return the board (software) revision */
111static unsigned int gef_sbc610_get_board_rev(void)
112{
113 unsigned int reg;
114
115 reg = ioread32(sbc610_regs);
116 return (reg >> 16) & 0xff;
117}
118
119/* Return the FPGA revision */
120static unsigned int gef_sbc610_get_fpga_rev(void)
121{
122 unsigned int reg;
123
124 reg = ioread32(sbc610_regs);
125 return (reg >> 24) & 0xf;
126}
127
128static void gef_sbc610_show_cpuinfo(struct seq_file *m)
129{
130 uint memsize = total_memory;
131 uint svid = mfspr(SPRN_SVR);
132
133 seq_printf(m, "Vendor\t\t: GE Fanuc Intelligent Platforms\n");
134
135 seq_printf(m, "Revision\t: %u%c\n", gef_sbc610_get_pcb_rev(),
136 ('A' + gef_sbc610_get_board_rev() - 1));
137 seq_printf(m, "FPGA Revision\t: %u\n", gef_sbc610_get_fpga_rev());
138
139 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
140 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
141}
142
143static void __init gef_sbc610_nec_fixup(struct pci_dev *pdev)
144{
145 unsigned int val;
146
147 printk(KERN_INFO "Running NEC uPD720101 Fixup\n");
148
149 /* Ensure ports 1, 2, 3, 4 & 5 are enabled */
150 pci_read_config_dword(pdev, 0xe0, &val);
151 pci_write_config_dword(pdev, 0xe0, (val & ~7) | 0x5);
152
153 /* System clock is 48-MHz Oscillator and EHCI Enabled. */
154 pci_write_config_dword(pdev, 0xe4, 1 << 5);
155}
156DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
157 gef_sbc610_nec_fixup);
158
159/*
160 * Called very early, device-tree isn't unflattened
161 *
162 * This function is called to determine whether the BSP is compatible with the
163 * supplied device-tree, which is assumed to be the correct one for the actual
164 * board. It is expected thati, in the future, a kernel may support multiple
165 * boards.
166 */
167static int __init gef_sbc610_probe(void)
168{
169 unsigned long root = of_get_flat_dt_root();
170
171 if (of_flat_dt_is_compatible(root, "gef,sbc610"))
172 return 1;
173
174 return 0;
175}
176
177static long __init mpc86xx_time_init(void)
178{
179 unsigned int temp;
180
181 /* Set the time base to zero */
182 mtspr(SPRN_TBWL, 0);
183 mtspr(SPRN_TBWU, 0);
184
185 temp = mfspr(SPRN_HID0);
186 temp |= HID0_TBEN;
187 mtspr(SPRN_HID0, temp);
188 asm volatile("isync");
189
190 return 0;
191}
192
193static __initdata struct of_device_id of_bus_ids[] = {
194 { .compatible = "simple-bus", },
195 {},
196};
197
198static int __init declare_of_platform_devices(void)
199{
200 printk(KERN_DEBUG "Probe platform devices\n");
201 of_platform_bus_probe(NULL, of_bus_ids, NULL);
202
203 return 0;
204}
205machine_device_initcall(gef_sbc610, declare_of_platform_devices);
206
207define_machine(gef_sbc610) {
208 .name = "GE Fanuc SBC610",
209 .probe = gef_sbc610_probe,
210 .setup_arch = gef_sbc610_setup_arch,
211 .init_IRQ = gef_sbc610_init_irq,
212 .show_cpuinfo = gef_sbc610_show_cpuinfo,
213 .get_irq = mpic_get_irq,
214 .restart = fsl_rstcr_restart,
215 .time_init = mpc86xx_time_init,
216 .calibrate_decr = generic_calibrate_decr,
217 .progress = udbg_progress,
218#ifdef CONFIG_PCI
219 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
220#endif
221};
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 5eedb710896e..e8d54ac5292c 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -238,7 +238,6 @@ static void __init mpc86xx_hpcd_setup_arch(void)
238 } 238 }
239#endif 239#endif
240#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 240#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
241 preallocate_diu_videomemory();
242 diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format; 241 diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format;
243 diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table; 242 diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table;
244 diu_ops.set_monitor_port = mpc8610hpcd_set_monitor_port; 243 diu_ops.set_monitor_port = mpc8610hpcd_set_monitor_port;
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index f712d9c0991b..2672829a71dc 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -101,19 +101,11 @@ mpc86xx_hpcn_setup_arch(void)
101static void 101static void
102mpc86xx_hpcn_show_cpuinfo(struct seq_file *m) 102mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
103{ 103{
104 struct device_node *root;
105 uint memsize = total_memory; 104 uint memsize = total_memory;
106 const char *model = "";
107 uint svid = mfspr(SPRN_SVR); 105 uint svid = mfspr(SPRN_SVR);
108 106
109 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n"); 107 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
110 108
111 root = of_find_node_by_path("/");
112 if (root)
113 model = of_get_property(root, "model", NULL);
114 seq_printf(m, "Machine\t\t: %s\n", model);
115 of_node_put(root);
116
117 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 109 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
118 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024)); 110 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
119} 111}
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c
index 00e6fad3b3ca..da677a74e2d1 100644
--- a/arch/powerpc/platforms/86xx/sbc8641d.c
+++ b/arch/powerpc/platforms/86xx/sbc8641d.c
@@ -63,19 +63,11 @@ sbc8641_setup_arch(void)
63static void 63static void
64sbc8641_show_cpuinfo(struct seq_file *m) 64sbc8641_show_cpuinfo(struct seq_file *m)
65{ 65{
66 struct device_node *root;
67 uint memsize = total_memory; 66 uint memsize = total_memory;
68 const char *model = "";
69 uint svid = mfspr(SPRN_SVR); 67 uint svid = mfspr(SPRN_SVR);
70 68
71 seq_printf(m, "Vendor\t\t: Wind River Systems\n"); 69 seq_printf(m, "Vendor\t\t: Wind River Systems\n");
72 70
73 root = of_find_node_by_path("/");
74 if (root)
75 model = of_get_property(root, "model", NULL);
76 seq_printf(m, "Machine\t\t: %s\n", model);
77 of_node_put(root);
78
79 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 71 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
80 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024)); 72 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
81} 73}
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index 71d7562e190b..48a920a98e7b 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -49,6 +49,12 @@ config PPC_ADDER875
49 This enables support for the Analogue & Micro Adder 875 49 This enables support for the Analogue & Micro Adder 875
50 board. 50 board.
51 51
52config PPC_MGSUVD
53 bool "MGSUVD"
54 select CPM1
55 help
56 This enables support for the Keymile MGSUVD board.
57
52endchoice 58endchoice
53 59
54menu "Freescale Ethernet driver platform-specific options" 60menu "Freescale Ethernet driver platform-specific options"
diff --git a/arch/powerpc/platforms/8xx/Makefile b/arch/powerpc/platforms/8xx/Makefile
index 7b71d9c8fb45..bdbfd7496018 100644
--- a/arch/powerpc/platforms/8xx/Makefile
+++ b/arch/powerpc/platforms/8xx/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_MPC885ADS) += mpc885ads_setup.o
6obj-$(CONFIG_MPC86XADS) += mpc86xads_setup.o 6obj-$(CONFIG_MPC86XADS) += mpc86xads_setup.o
7obj-$(CONFIG_PPC_EP88XC) += ep88xc.o 7obj-$(CONFIG_PPC_EP88XC) += ep88xc.o
8obj-$(CONFIG_PPC_ADDER875) += adder875.o 8obj-$(CONFIG_PPC_ADDER875) += adder875.o
9obj-$(CONFIG_PPC_MGSUVD) += mgsuvd.o
diff --git a/arch/powerpc/platforms/8xx/mgsuvd.c b/arch/powerpc/platforms/8xx/mgsuvd.c
new file mode 100644
index 000000000000..ca3cb071772c
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/mgsuvd.c
@@ -0,0 +1,92 @@
1/*
2 *
3 * Platform setup for the Keymile mgsuvd board
4 *
5 * Heiko Schocher <hs@denx.de>
6 *
7 * Copyright 2008 DENX Software Engineering GmbH
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 */
13
14#include <linux/ioport.h>
15#include <linux/of_platform.h>
16
17#include <asm/io.h>
18#include <asm/machdep.h>
19#include <asm/processor.h>
20#include <asm/cpm1.h>
21#include <asm/prom.h>
22#include <asm/fs_pd.h>
23
24#include "mpc8xx.h"
25
26struct cpm_pin {
27 int port, pin, flags;
28};
29
30static __initdata struct cpm_pin mgsuvd_pins[] = {
31 /* SMC1 */
32 {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
33 {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
34
35 /* SCC3 */
36 {CPM_PORTA, 10, CPM_PIN_INPUT},
37 {CPM_PORTA, 11, CPM_PIN_INPUT},
38 {CPM_PORTA, 3, CPM_PIN_INPUT},
39 {CPM_PORTA, 2, CPM_PIN_INPUT},
40 {CPM_PORTC, 13, CPM_PIN_INPUT},
41};
42
43static void __init init_ioports(void)
44{
45 int i;
46
47 for (i = 0; i < ARRAY_SIZE(mgsuvd_pins); i++) {
48 struct cpm_pin *pin = &mgsuvd_pins[i];
49 cpm1_set_pin(pin->port, pin->pin, pin->flags);
50 }
51
52 setbits16(&mpc8xx_immr->im_ioport.iop_pcso, 0x300);
53 cpm1_clk_setup(CPM_CLK_SCC3, CPM_CLK5, CPM_CLK_RX);
54 cpm1_clk_setup(CPM_CLK_SCC3, CPM_CLK6, CPM_CLK_TX);
55 cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
56}
57
58static void __init mgsuvd_setup_arch(void)
59{
60 cpm_reset();
61 init_ioports();
62}
63
64static __initdata struct of_device_id of_bus_ids[] = {
65 { .compatible = "simple-bus" },
66 {},
67};
68
69static int __init declare_of_platform_devices(void)
70{
71 of_platform_bus_probe(NULL, of_bus_ids, NULL);
72 return 0;
73}
74machine_device_initcall(mgsuvd, declare_of_platform_devices);
75
76static int __init mgsuvd_probe(void)
77{
78 unsigned long root = of_get_flat_dt_root();
79 return of_flat_dt_is_compatible(root, "keymile,mgsuvd");
80}
81
82define_machine(mgsuvd) {
83 .name = "MGSUVD",
84 .probe = mgsuvd_probe,
85 .setup_arch = mgsuvd_setup_arch,
86 .init_IRQ = mpc8xx_pics_init,
87 .get_irq = mpc8xx_get_irq,
88 .restart = mpc8xx_restart,
89 .calibrate_decr = mpc8xx_calibrate_decr,
90 .set_rtc_time = mpc8xx_set_rtc_time,
91 .get_rtc_time = mpc8xx_get_rtc_time,
92};
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 4c900efa164e..47e956c871fe 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -239,7 +239,8 @@ config TAU_AVERAGE
239 If in doubt, say N here. 239 If in doubt, say N here.
240 240
241config QUICC_ENGINE 241config QUICC_ENGINE
242 bool 242 bool "Freescale QUICC Engine (QE) Support"
243 depends on FSL_SOC
243 select PPC_LIB_RHEAP 244 select PPC_LIB_RHEAP
244 select CRC32 245 select CRC32
245 help 246 help
@@ -248,6 +249,15 @@ config QUICC_ENGINE
248 Selecting this option means that you wish to build a kernel 249 Selecting this option means that you wish to build a kernel
249 for a machine with a QE coprocessor. 250 for a machine with a QE coprocessor.
250 251
252config QE_GPIO
253 bool "QE GPIO support"
254 depends on QUICC_ENGINE
255 select GENERIC_GPIO
256 select ARCH_REQUIRE_GPIOLIB
257 help
258 Say Y here if you're going to use hardware that connects to the
259 QE GPIOs.
260
251config CPM2 261config CPM2
252 bool "Enable support for the CPM2 (Communications Processor Module)" 262 bool "Enable support for the CPM2 (Communications Processor Module)"
253 depends on MPC85xx || 8260 263 depends on MPC85xx || 8260
@@ -293,4 +303,13 @@ config OF_RTC
293 303
294source "arch/powerpc/sysdev/bestcomm/Kconfig" 304source "arch/powerpc/sysdev/bestcomm/Kconfig"
295 305
306config MPC8xxx_GPIO
307 bool "MPC8xxx GPIO support"
308 depends on PPC_MPC831x || PPC_MPC834x || PPC_MPC837x || PPC_85xx || PPC_86xx
309 select GENERIC_GPIO
310 select ARCH_REQUIRE_GPIOLIB
311 help
312 Say Y here if you're going to use hardware that connects to the
313 MPC831x/834x/837x/8572/8610 GPIOs.
314
296endmenu 315endmenu
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 7f6512733862..548efa55c8fe 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -50,6 +50,7 @@ config 44x
50 select PPC_UDBG_16550 50 select PPC_UDBG_16550
51 select 4xx_SOC 51 select 4xx_SOC
52 select PPC_PCI_CHOICE 52 select PPC_PCI_CHOICE
53 select PHYS_64BIT
53 54
54config E200 55config E200
55 bool "Freescale e200" 56 bool "Freescale e200"
@@ -128,18 +129,19 @@ config FSL_EMB_PERFMON
128 129
129config PTE_64BIT 130config PTE_64BIT
130 bool 131 bool
131 depends on 44x || E500 132 depends on 44x || E500 || PPC_86xx
132 default y if 44x 133 default y if PHYS_64BIT
133 default y if E500 && PHYS_64BIT
134 134
135config PHYS_64BIT 135config PHYS_64BIT
136 bool 'Large physical address support' if E500 136 bool 'Large physical address support' if E500 || PPC_86xx
137 depends on 44x || E500 137 depends on (44x || E500 || PPC_86xx) && !PPC_83xx && !PPC_82xx
138 select RESOURCES_64BIT
139 default y if 44x
140 ---help--- 138 ---help---
141 This option enables kernel support for larger than 32-bit physical 139 This option enables kernel support for larger than 32-bit physical
142 addresses. This features is not be available on all e500 cores. 140 addresses. This feature may not be available on all cores.
141
142 If you have more than 3.5GB of RAM or so, you also need to enable
143 SWIOTLB under Kernel Options for this to work. The actual number
144 is platform-dependent.
143 145
144 If in doubt, say N here. 146 If in doubt, say N here.
145 147
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index e06420af5fe9..ef92e7146215 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -556,11 +556,11 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)
556 * node's iommu. We -might- do something smarter later though it may 556 * node's iommu. We -might- do something smarter later though it may
557 * never be necessary 557 * never be necessary
558 */ 558 */
559 iommu = cell_iommu_for_node(archdata->numa_node); 559 iommu = cell_iommu_for_node(dev_to_node(dev));
560 if (iommu == NULL || list_empty(&iommu->windows)) { 560 if (iommu == NULL || list_empty(&iommu->windows)) {
561 printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n", 561 printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n",
562 archdata->of_node ? archdata->of_node->full_name : "?", 562 archdata->of_node ? archdata->of_node->full_name : "?",
563 archdata->numa_node); 563 dev_to_node(dev));
564 return NULL; 564 return NULL;
565 } 565 }
566 window = list_entry(iommu->windows.next, struct iommu_window, list); 566 window = list_entry(iommu->windows.next, struct iommu_window, list);
@@ -577,7 +577,7 @@ static void *dma_fixed_alloc_coherent(struct device *dev, size_t size,
577 return iommu_alloc_coherent(dev, cell_get_iommu_table(dev), 577 return iommu_alloc_coherent(dev, cell_get_iommu_table(dev),
578 size, dma_handle, 578 size, dma_handle,
579 device_to_mask(dev), flag, 579 device_to_mask(dev), flag,
580 dev->archdata.numa_node); 580 dev_to_node(dev));
581 else 581 else
582 return dma_direct_ops.alloc_coherent(dev, size, dma_handle, 582 return dma_direct_ops.alloc_coherent(dev, size, dma_handle,
583 flag); 583 flag);
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 690ca7b0dcf6..cb85d237e492 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -298,8 +298,8 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
298 298
299 d_instantiate(dentry, inode); 299 d_instantiate(dentry, inode);
300 dget(dentry); 300 dget(dentry);
301 dir->i_nlink++; 301 inc_nlink(dir);
302 dentry->d_inode->i_nlink++; 302 inc_nlink(dentry->d_inode);
303 goto out; 303 goto out;
304 304
305out_free_ctx: 305out_free_ctx:
@@ -496,6 +496,8 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
496 ret = spufs_context_open(dget(dentry), mntget(mnt)); 496 ret = spufs_context_open(dget(dentry), mntget(mnt));
497 if (ret < 0) { 497 if (ret < 0) {
498 WARN_ON(spufs_rmdir(inode, dentry)); 498 WARN_ON(spufs_rmdir(inode, dentry));
499 if (affinity)
500 mutex_unlock(&gang->aff_mutex);
499 mutex_unlock(&inode->i_mutex); 501 mutex_unlock(&inode->i_mutex);
500 spu_forget(SPUFS_I(dentry->d_inode)->i_ctx); 502 spu_forget(SPUFS_I(dentry->d_inode)->i_ctx);
501 goto out; 503 goto out;
@@ -538,8 +540,8 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode)
538 inode->i_fop = &simple_dir_operations; 540 inode->i_fop = &simple_dir_operations;
539 541
540 d_instantiate(dentry, inode); 542 d_instantiate(dentry, inode);
541 dir->i_nlink++; 543 inc_nlink(dir);
542 dentry->d_inode->i_nlink++; 544 inc_nlink(dentry->d_inode);
543 return ret; 545 return ret;
544 546
545out_iput: 547out_iput:
@@ -659,7 +661,7 @@ enum {
659 Opt_uid, Opt_gid, Opt_mode, Opt_debug, Opt_err, 661 Opt_uid, Opt_gid, Opt_mode, Opt_debug, Opt_err,
660}; 662};
661 663
662static match_table_t spufs_tokens = { 664static const match_table_t spufs_tokens = {
663 { Opt_uid, "uid=%d" }, 665 { Opt_uid, "uid=%d" },
664 { Opt_gid, "gid=%d" }, 666 { Opt_gid, "gid=%d" },
665 { Opt_mode, "mode=%o" }, 667 { Opt_mode, "mode=%o" },
@@ -755,6 +757,7 @@ spufs_create_root(struct super_block *sb, void *data)
755 inode->i_op = &simple_dir_inode_operations; 757 inode->i_op = &simple_dir_inode_operations;
756 inode->i_fop = &simple_dir_operations; 758 inode->i_fop = &simple_dir_operations;
757 SPUFS_I(inode)->i_ctx = NULL; 759 SPUFS_I(inode)->i_ctx = NULL;
760 inc_nlink(inode);
758 761
759 ret = -EINVAL; 762 ret = -EINVAL;
760 if (!spufs_parse_options(sb, data, inode)) 763 if (!spufs_parse_options(sb, data, inode))
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 1c1b627ee843..67595bc380dc 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -643,9 +643,10 @@ static struct spu *find_victim(struct spu_context *ctx)
643 !(tmp->flags & SPU_CREATE_NOSCHED) && 643 !(tmp->flags & SPU_CREATE_NOSCHED) &&
644 (!victim || tmp->prio > victim->prio)) { 644 (!victim || tmp->prio > victim->prio)) {
645 victim = spu->ctx; 645 victim = spu->ctx;
646 get_spu_context(victim);
647 } 646 }
648 } 647 }
648 if (victim)
649 get_spu_context(victim);
649 mutex_unlock(&cbe_spu_info[node].list_mutex); 650 mutex_unlock(&cbe_spu_info[node].list_mutex);
650 651
651 if (victim) { 652 if (victim) {
@@ -727,17 +728,33 @@ static void spu_schedule(struct spu *spu, struct spu_context *ctx)
727 /* not a candidate for interruptible because it's called either 728 /* not a candidate for interruptible because it's called either
728 from the scheduler thread or from spu_deactivate */ 729 from the scheduler thread or from spu_deactivate */
729 mutex_lock(&ctx->state_mutex); 730 mutex_lock(&ctx->state_mutex);
730 __spu_schedule(spu, ctx); 731 if (ctx->state == SPU_STATE_SAVED)
732 __spu_schedule(spu, ctx);
731 spu_release(ctx); 733 spu_release(ctx);
732} 734}
733 735
734static void spu_unschedule(struct spu *spu, struct spu_context *ctx) 736/**
737 * spu_unschedule - remove a context from a spu, and possibly release it.
738 * @spu: The SPU to unschedule from
739 * @ctx: The context currently scheduled on the SPU
740 * @free_spu Whether to free the SPU for other contexts
741 *
742 * Unbinds the context @ctx from the SPU @spu. If @free_spu is non-zero, the
743 * SPU is made available for other contexts (ie, may be returned by
744 * spu_get_idle). If this is zero, the caller is expected to schedule another
745 * context to this spu.
746 *
747 * Should be called with ctx->state_mutex held.
748 */
749static void spu_unschedule(struct spu *spu, struct spu_context *ctx,
750 int free_spu)
735{ 751{
736 int node = spu->node; 752 int node = spu->node;
737 753
738 mutex_lock(&cbe_spu_info[node].list_mutex); 754 mutex_lock(&cbe_spu_info[node].list_mutex);
739 cbe_spu_info[node].nr_active--; 755 cbe_spu_info[node].nr_active--;
740 spu->alloc_state = SPU_FREE; 756 if (free_spu)
757 spu->alloc_state = SPU_FREE;
741 spu_unbind_context(spu, ctx); 758 spu_unbind_context(spu, ctx);
742 ctx->stats.invol_ctx_switch++; 759 ctx->stats.invol_ctx_switch++;
743 spu->stats.invol_ctx_switch++; 760 spu->stats.invol_ctx_switch++;
@@ -837,7 +854,7 @@ static int __spu_deactivate(struct spu_context *ctx, int force, int max_prio)
837 if (spu) { 854 if (spu) {
838 new = grab_runnable_context(max_prio, spu->node); 855 new = grab_runnable_context(max_prio, spu->node);
839 if (new || force) { 856 if (new || force) {
840 spu_unschedule(spu, ctx); 857 spu_unschedule(spu, ctx, new == NULL);
841 if (new) { 858 if (new) {
842 if (new->flags & SPU_CREATE_NOSCHED) 859 if (new->flags & SPU_CREATE_NOSCHED)
843 wake_up(&new->stop_wq); 860 wake_up(&new->stop_wq);
@@ -910,7 +927,7 @@ static noinline void spusched_tick(struct spu_context *ctx)
910 927
911 new = grab_runnable_context(ctx->prio + 1, spu->node); 928 new = grab_runnable_context(ctx->prio + 1, spu->node);
912 if (new) { 929 if (new) {
913 spu_unschedule(spu, ctx); 930 spu_unschedule(spu, ctx, 0);
914 if (test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags)) 931 if (test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags))
915 spu_add_to_rq(ctx); 932 spu_add_to_rq(ctx);
916 } else { 933 } else {
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 768c262b9368..d3cde6b9d2df 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -260,13 +260,13 @@ chrp_find_bridges(void)
260 dev->full_name); 260 dev->full_name);
261 continue; 261 continue;
262 } 262 }
263 hose->first_busno = bus_range[0]; 263 hose->first_busno = hose->self_busno = bus_range[0];
264 hose->last_busno = bus_range[1]; 264 hose->last_busno = bus_range[1];
265 265
266 model = of_get_property(dev, "model", NULL); 266 model = of_get_property(dev, "model", NULL);
267 if (model == NULL) 267 if (model == NULL)
268 model = "<none>"; 268 model = "<none>";
269 if (of_device_is_compatible(dev, "IBM,python")) { 269 if (strncmp(model, "IBM, Python", 11) == 0) {
270 setup_python(hose, dev); 270 setup_python(hose, dev);
271 } else if (is_mot 271 } else if (is_mot
272 || strncmp(model, "Motorola, Grackle", 17) == 0) { 272 || strncmp(model, "Motorola, Grackle", 17) == 0) {
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 1ba7ce5aafae..272d79a8d289 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -17,7 +17,6 @@
17#include <linux/ptrace.h> 17#include <linux/ptrace.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/user.h> 19#include <linux/user.h>
20#include <linux/a.out.h>
21#include <linux/tty.h> 20#include <linux/tty.h>
22#include <linux/major.h> 21#include <linux/major.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 96d1e4b3c493..054dfe5b8e77 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -94,12 +94,12 @@ int chrp_set_rtc_time(struct rtc_time *tmarg)
94 chrp_cmos_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); 94 chrp_cmos_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
95 95
96 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 96 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
97 BIN_TO_BCD(tm.tm_sec); 97 tm.tm_sec = bin2bcd(tm.tm_sec);
98 BIN_TO_BCD(tm.tm_min); 98 tm.tm_min = bin2bcd(tm.tm_min);
99 BIN_TO_BCD(tm.tm_hour); 99 tm.tm_hour = bin2bcd(tm.tm_hour);
100 BIN_TO_BCD(tm.tm_mon); 100 tm.tm_mon = bin2bcd(tm.tm_mon);
101 BIN_TO_BCD(tm.tm_mday); 101 tm.tm_mday = bin2bcd(tm.tm_mday);
102 BIN_TO_BCD(tm.tm_year); 102 tm.tm_year = bin2bcd(tm.tm_year);
103 } 103 }
104 chrp_cmos_clock_write(tm.tm_sec,RTC_SECONDS); 104 chrp_cmos_clock_write(tm.tm_sec,RTC_SECONDS);
105 chrp_cmos_clock_write(tm.tm_min,RTC_MINUTES); 105 chrp_cmos_clock_write(tm.tm_min,RTC_MINUTES);
@@ -136,12 +136,12 @@ void chrp_get_rtc_time(struct rtc_time *tm)
136 } while (sec != chrp_cmos_clock_read(RTC_SECONDS)); 136 } while (sec != chrp_cmos_clock_read(RTC_SECONDS));
137 137
138 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 138 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
139 BCD_TO_BIN(sec); 139 sec = bcd2bin(sec);
140 BCD_TO_BIN(min); 140 min = bcd2bin(min);
141 BCD_TO_BIN(hour); 141 hour = bcd2bin(hour);
142 BCD_TO_BIN(day); 142 day = bcd2bin(day);
143 BCD_TO_BIN(mon); 143 mon = bcd2bin(mon);
144 BCD_TO_BIN(year); 144 year = bcd2bin(year);
145 } 145 }
146 if (year < 70) 146 if (year < 70)
147 year += 100; 147 year += 100;
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index 84e2d78b9a62..7a2ba39d7811 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -164,7 +164,6 @@ static void __init mpc7448_hpc2_init_IRQ(void)
164void mpc7448_hpc2_show_cpuinfo(struct seq_file *m) 164void mpc7448_hpc2_show_cpuinfo(struct seq_file *m)
165{ 165{
166 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n"); 166 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n");
167 seq_printf(m, "machine\t\t: MPC7448hpc2\n");
168} 167}
169 168
170void mpc7448_hpc2_restart(char *cmd) 169void mpc7448_hpc2_restart(char *cmd)
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index ef74a0763ec1..8c619963becc 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -219,11 +219,21 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
219 int i; 219 int i;
220 u8 *dummy; 220 u8 *dummy;
221 struct pci_bus *bus = dev->bus; 221 struct pci_bus *bus = dev->bus;
222 resource_size_t end = 0;
223
224 for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) {
225 unsigned long flags = pci_resource_flags(dev, i);
226 if ((flags & (IORESOURCE_MEM|IORESOURCE_PREFETCH)) == IORESOURCE_MEM)
227 end = pci_resource_end(dev, i);
228 }
222 229
223 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { 230 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
224 if ((bus->resource[i]) && 231 if ((bus->resource[i]) &&
225 (bus->resource[i]->flags & IORESOURCE_MEM)) { 232 (bus->resource[i]->flags & IORESOURCE_MEM)) {
226 dummy = ioremap(bus->resource[i]->end - 3, 0x4); 233 if (bus->resource[i]->end == end)
234 dummy = ioremap(bus->resource[i]->start, 0x4);
235 else
236 dummy = ioremap(bus->resource[i]->end - 3, 0x4);
227 if (dummy) { 237 if (dummy) {
228 in_8(dummy); 238 in_8(dummy);
229 iounmap(dummy); 239 iounmap(dummy);
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index 8ff330d026ca..2f581521eb9b 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -38,12 +38,13 @@
38 38
39 .globl system_reset_iSeries 39 .globl system_reset_iSeries
40system_reset_iSeries: 40system_reset_iSeries:
41 bl .relative_toc
41 mfspr r13,SPRN_SPRG3 /* Get alpaca address */ 42 mfspr r13,SPRN_SPRG3 /* Get alpaca address */
42 LOAD_REG_IMMEDIATE(r23, alpaca) 43 LOAD_REG_ADDR(r23, alpaca)
43 li r0,ALPACA_SIZE 44 li r0,ALPACA_SIZE
44 sub r23,r13,r23 45 sub r23,r13,r23
45 divdu r23,r23,r0 /* r23 has cpu number */ 46 divdu r23,r23,r0 /* r23 has cpu number */
46 LOAD_REG_IMMEDIATE(r13, paca) 47 LOAD_REG_ADDR(r13, paca)
47 mulli r0,r23,PACA_SIZE 48 mulli r0,r23,PACA_SIZE
48 add r13,r13,r0 49 add r13,r13,r0
49 mtspr SPRN_SPRG3,r13 /* Save it away for the future */ 50 mtspr SPRN_SPRG3,r13 /* Save it away for the future */
@@ -60,14 +61,14 @@ system_reset_iSeries:
60 mtspr SPRN_CTRLT,r4 61 mtspr SPRN_CTRLT,r4
61 62
62/* Spin on __secondary_hold_spinloop until it is updated by the boot cpu. */ 63/* Spin on __secondary_hold_spinloop until it is updated by the boot cpu. */
63/* In the UP case we'll yeild() later, and we will not access the paca anyway */ 64/* In the UP case we'll yield() later, and we will not access the paca anyway */
64#ifdef CONFIG_SMP 65#ifdef CONFIG_SMP
651: 661:
66 HMT_LOW 67 HMT_LOW
67 LOAD_REG_IMMEDIATE(r23, __secondary_hold_spinloop) 68 LOAD_REG_ADDR(r23, __secondary_hold_spinloop)
68 ld r23,0(r23) 69 ld r23,0(r23)
69 sync 70 sync
70 LOAD_REG_IMMEDIATE(r3,current_set) 71 LOAD_REG_ADDR(r3,current_set)
71 sldi r28,r24,3 /* get current_set[cpu#] */ 72 sldi r28,r24,3 /* get current_set[cpu#] */
72 ldx r3,r3,r28 73 ldx r3,r3,r28
73 addi r1,r3,THREAD_SIZE 74 addi r1,r3,THREAD_SIZE
@@ -90,7 +91,7 @@ system_reset_iSeries:
90 lbz r23,PACAPROCSTART(r13) /* Test if this processor 91 lbz r23,PACAPROCSTART(r13) /* Test if this processor
91 * should start */ 92 * should start */
92 sync 93 sync
93 LOAD_REG_IMMEDIATE(r3,current_set) 94 LOAD_REG_ADDR(r3,current_set)
94 sldi r28,r24,3 /* get current_set[cpu#] */ 95 sldi r28,r24,3 /* get current_set[cpu#] */
95 ldx r3,r3,r28 96 ldx r3,r3,r28
96 addi r1,r3,THREAD_SIZE 97 addi r1,r3,THREAD_SIZE
@@ -255,8 +256,8 @@ hardware_interrupt_iSeries_masked:
255 256
256_INIT_STATIC(__start_initialization_iSeries) 257_INIT_STATIC(__start_initialization_iSeries)
257 /* Clear out the BSS */ 258 /* Clear out the BSS */
258 LOAD_REG_IMMEDIATE(r11,__bss_stop) 259 LOAD_REG_ADDR(r11,__bss_stop)
259 LOAD_REG_IMMEDIATE(r8,__bss_start) 260 LOAD_REG_ADDR(r8,__bss_start)
260 sub r11,r11,r8 /* bss size */ 261 sub r11,r11,r8 /* bss size */
261 addi r11,r11,7 /* round up to an even double word */ 262 addi r11,r11,7 /* round up to an even double word */
262 rldicl. r11,r11,61,3 /* shift right by 3 */ 263 rldicl. r11,r11,61,3 /* shift right by 3 */
@@ -267,15 +268,11 @@ _INIT_STATIC(__start_initialization_iSeries)
2673: stdu r0,8(r8) 2683: stdu r0,8(r8)
268 bdnz 3b 269 bdnz 3b
2694: 2704:
270 LOAD_REG_IMMEDIATE(r1,init_thread_union) 271 LOAD_REG_ADDR(r1,init_thread_union)
271 addi r1,r1,THREAD_SIZE 272 addi r1,r1,THREAD_SIZE
272 li r0,0 273 li r0,0
273 stdu r0,-STACK_FRAME_OVERHEAD(r1) 274 stdu r0,-STACK_FRAME_OVERHEAD(r1)
274 275
275 LOAD_REG_IMMEDIATE(r2,__toc_start)
276 addi r2,r2,0x4000
277 addi r2,r2,0x4000
278
279 bl .iSeries_early_setup 276 bl .iSeries_early_setup
280 bl .early_setup 277 bl .early_setup
281 278
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 731d7b157749..3689c2413d24 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -722,13 +722,13 @@ static int mf_set_rtc(struct rtc_time *tm)
722 day = tm->tm_mday; 722 day = tm->tm_mday;
723 mon = tm->tm_mon + 1; 723 mon = tm->tm_mon + 1;
724 724
725 BIN_TO_BCD(sec); 725 sec = bin2bcd(sec);
726 BIN_TO_BCD(min); 726 min = bin2bcd(min);
727 BIN_TO_BCD(hour); 727 hour = bin2bcd(hour);
728 BIN_TO_BCD(mon); 728 mon = bin2bcd(mon);
729 BIN_TO_BCD(day); 729 day = bin2bcd(day);
730 BIN_TO_BCD(y1); 730 y1 = bin2bcd(y1);
731 BIN_TO_BCD(y2); 731 y2 = bin2bcd(y2);
732 732
733 memset(ce_time, 0, sizeof(ce_time)); 733 memset(ce_time, 0, sizeof(ce_time));
734 ce_time[3] = 0x41; 734 ce_time[3] = 0x41;
@@ -777,12 +777,12 @@ static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm)
777 u8 day = ce_msg[10]; 777 u8 day = ce_msg[10];
778 u8 mon = ce_msg[11]; 778 u8 mon = ce_msg[11];
779 779
780 BCD_TO_BIN(sec); 780 sec = bcd2bin(sec);
781 BCD_TO_BIN(min); 781 min = bcd2bin(min);
782 BCD_TO_BIN(hour); 782 hour = bcd2bin(hour);
783 BCD_TO_BIN(day); 783 day = bcd2bin(day);
784 BCD_TO_BIN(mon); 784 mon = bcd2bin(mon);
785 BCD_TO_BIN(year); 785 year = bcd2bin(year);
786 786
787 if (year <= 69) 787 if (year <= 69)
788 year += 100; 788 year += 100;
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 364714757cf1..d4c61c3c9669 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -23,7 +23,6 @@
23#include <linux/ptrace.h> 23#include <linux/ptrace.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/user.h> 25#include <linux/user.h>
26#include <linux/a.out.h>
27#include <linux/tty.h> 26#include <linux/tty.h>
28#include <linux/string.h> 27#include <linux/string.h>
29#include <linux/delay.h> 28#include <linux/delay.h>
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 53bca132fb48..eac569dee27c 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -68,12 +68,12 @@ void maple_get_rtc_time(struct rtc_time *tm)
68 68
69 if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY) 69 if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY)
70 || RTC_ALWAYS_BCD) { 70 || RTC_ALWAYS_BCD) {
71 BCD_TO_BIN(tm->tm_sec); 71 tm->tm_sec = bcd2bin(tm->tm_sec);
72 BCD_TO_BIN(tm->tm_min); 72 tm->tm_min = bcd2bin(tm->tm_min);
73 BCD_TO_BIN(tm->tm_hour); 73 tm->tm_hour = bcd2bin(tm->tm_hour);
74 BCD_TO_BIN(tm->tm_mday); 74 tm->tm_mday = bcd2bin(tm->tm_mday);
75 BCD_TO_BIN(tm->tm_mon); 75 tm->tm_mon = bcd2bin(tm->tm_mon);
76 BCD_TO_BIN(tm->tm_year); 76 tm->tm_year = bcd2bin(tm->tm_year);
77 } 77 }
78 if ((tm->tm_year + 1900) < 1970) 78 if ((tm->tm_year + 1900) < 1970)
79 tm->tm_year += 100; 79 tm->tm_year += 100;
@@ -104,12 +104,12 @@ int maple_set_rtc_time(struct rtc_time *tm)
104 year = tm->tm_year; 104 year = tm->tm_year;
105 105
106 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 106 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
107 BIN_TO_BCD(sec); 107 sec = bin2bcd(sec);
108 BIN_TO_BCD(min); 108 min = bin2bcd(min);
109 BIN_TO_BCD(hour); 109 hour = bin2bcd(hour);
110 BIN_TO_BCD(mon); 110 mon = bin2bcd(mon);
111 BIN_TO_BCD(mday); 111 mday = bin2bcd(mday);
112 BIN_TO_BCD(year); 112 year = bin2bcd(year);
113 } 113 }
114 maple_clock_write(sec, RTC_SECONDS); 114 maple_clock_write(sec, RTC_SECONDS);
115 maple_clock_write(min, RTC_MINUTES); 115 maple_clock_write(min, RTC_MINUTES);
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index ab6955412ba4..75cc165d5bee 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -230,7 +230,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
230 if (!priv) 230 if (!priv)
231 goto out; 231 goto out;
232 232
233 new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); 233 new_bus = mdiobus_alloc();
234 234
235 if (!new_bus) 235 if (!new_bus)
236 goto out_free_priv; 236 goto out_free_priv;
@@ -272,7 +272,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
272 prop = of_get_property(np, "mdio-pin", NULL); 272 prop = of_get_property(np, "mdio-pin", NULL);
273 priv->mdio_pin = *prop; 273 priv->mdio_pin = *prop;
274 274
275 new_bus->dev = dev; 275 new_bus->parent = dev;
276 dev_set_drvdata(dev, new_bus); 276 dev_set_drvdata(dev, new_bus);
277 277
278 err = mdiobus_register(new_bus); 278 err = mdiobus_register(new_bus);
@@ -306,7 +306,7 @@ static int gpio_mdio_remove(struct of_device *dev)
306 306
307 kfree(bus->priv); 307 kfree(bus->priv);
308 bus->priv = NULL; 308 bus->priv = NULL;
309 kfree(bus); 309 mdiobus_free(bus);
310 310
311 return 0; 311 return 0;
312} 312}
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 5169ecc37123..e6c0040ee797 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -2677,7 +2677,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
2677 macio_chips[i].of_node = node; 2677 macio_chips[i].of_node = node;
2678 macio_chips[i].type = type; 2678 macio_chips[i].type = type;
2679 macio_chips[i].base = base; 2679 macio_chips[i].base = base;
2680 macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; 2680 macio_chips[i].flags = MACIO_FLAG_SCCA_ON | MACIO_FLAG_SCCB_ON;
2681 macio_chips[i].name = macio_names[type]; 2681 macio_chips[i].name = macio_names[type];
2682 revp = of_get_property(node, "revision-id", NULL); 2682 revp = of_get_property(node, "revision-id", NULL);
2683 if (revp) 2683 if (revp)
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 88ccf3a08a9c..82c14d203d8b 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -33,7 +33,6 @@
33#include <linux/ptrace.h> 33#include <linux/ptrace.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/user.h> 35#include <linux/user.h>
36#include <linux/a.out.h>
37#include <linux/tty.h> 36#include <linux/tty.h>
38#include <linux/string.h> 37#include <linux/string.h>
39#include <linux/delay.h> 38#include <linux/delay.h>
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 4ae3d00e0bdd..40f72c2a4699 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -787,7 +787,7 @@ static void __devinit smp_core99_kick_cpu(int nr)
787{ 787{
788 unsigned int save_vector; 788 unsigned int save_vector;
789 unsigned long target, flags; 789 unsigned long target, flags;
790 unsigned int *vector = (unsigned int *)(KERNELBASE+0x100); 790 unsigned int *vector = (unsigned int *)(PAGE_OFFSET+0x100);
791 791
792 if (nr < 0 || nr > 3) 792 if (nr < 0 || nr > 3)
793 return; 793 return;
@@ -801,7 +801,7 @@ static void __devinit smp_core99_kick_cpu(int nr)
801 save_vector = *vector; 801 save_vector = *vector;
802 802
803 /* Setup fake reset vector that does 803 /* Setup fake reset vector that does
804 * b __secondary_start_pmac_0 + nr*8 - KERNELBASE 804 * b __secondary_start_pmac_0 + nr*8
805 */ 805 */
806 target = (unsigned long) __secondary_start_pmac_0 + nr * 8; 806 target = (unsigned long) __secondary_start_pmac_0 + nr * 8;
807 patch_branch(vector, target, BRANCH_SET_LINK); 807 patch_branch(vector, target, BRANCH_SET_LINK);
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index bbbefd64ab59..59eb840d8ce2 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -93,11 +93,14 @@ static void to_rtc_time(unsigned long now, struct rtc_time *tm)
93} 93}
94#endif 94#endif
95 95
96#if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) || \
97 defined(CONFIG_PMAC_SMU)
96static unsigned long from_rtc_time(struct rtc_time *tm) 98static unsigned long from_rtc_time(struct rtc_time *tm)
97{ 99{
98 return mktime(tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, 100 return mktime(tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
99 tm->tm_hour, tm->tm_min, tm->tm_sec); 101 tm->tm_hour, tm->tm_min, tm->tm_sec);
100} 102}
103#endif
101 104
102#ifdef CONFIG_ADB_CUDA 105#ifdef CONFIG_ADB_CUDA
103static unsigned long cuda_get_time(void) 106static unsigned long cuda_get_time(void)
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 280ee88cb0b0..a789bf58ca8b 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -762,7 +762,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
762 }; 762 };
763 763
764 dev->core.archdata.of_node = NULL; 764 dev->core.archdata.of_node = NULL;
765 dev->core.archdata.numa_node = 0; 765 set_dev_node(&dev->core, 0);
766 766
767 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev->core.bus_id); 767 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev->core.bus_id);
768 768
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 38fe32a7cc70..5cd4d2761620 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -121,7 +121,7 @@ static long cmm_alloc_pages(long nr)
121 npa = (struct cmm_page_array *)__get_free_page(GFP_NOIO | __GFP_NOWARN | 121 npa = (struct cmm_page_array *)__get_free_page(GFP_NOIO | __GFP_NOWARN |
122 __GFP_NORETRY | __GFP_NOMEMALLOC); 122 __GFP_NORETRY | __GFP_NOMEMALLOC);
123 if (!npa) { 123 if (!npa) {
124 pr_info("%s: Can not allocate new page list\n", __FUNCTION__); 124 pr_info("%s: Can not allocate new page list\n", __func__);
125 free_page(addr); 125 free_page(addr);
126 break; 126 break;
127 } 127 }
@@ -138,7 +138,7 @@ static long cmm_alloc_pages(long nr)
138 } 138 }
139 139
140 if ((rc = plpar_page_set_loaned(__pa(addr)))) { 140 if ((rc = plpar_page_set_loaned(__pa(addr)))) {
141 pr_err("%s: Can not set page to loaned. rc=%ld\n", __FUNCTION__, rc); 141 pr_err("%s: Can not set page to loaned. rc=%ld\n", __func__, rc);
142 spin_unlock(&cmm_lock); 142 spin_unlock(&cmm_lock);
143 free_page(addr); 143 free_page(addr);
144 break; 144 break;
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 8c1ca477c52c..0ad56ff7b4a0 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -41,7 +41,7 @@ static inline const char * pcid_name (struct pci_dev *pdev)
41 return ""; 41 return "";
42} 42}
43 43
44#ifdef DEBUG 44#if 0
45static void print_device_node_tree(struct pci_dn *pdn, int dent) 45static void print_device_node_tree(struct pci_dn *pdn, int dent)
46{ 46{
47 int i; 47 int i;
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index a1a368dd2d99..140d02a5232a 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -21,7 +21,7 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
21 struct zone *zone; 21 struct zone *zone;
22 int ret; 22 int ret;
23 23
24 start_pfn = base >> PFN_SECTION_SHIFT; 24 start_pfn = base >> PAGE_SHIFT;
25 zone = page_zone(pfn_to_page(start_pfn)); 25 zone = page_zone(pfn_to_page(start_pfn));
26 26
27 /* 27 /*
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 7637bd38c795..c591a25b0b0d 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -466,11 +466,11 @@ static int do_update_property(char *buf, size_t bufsize)
466 else 466 else
467 action = PSERIES_DRCONF_MEM_REMOVE; 467 action = PSERIES_DRCONF_MEM_REMOVE;
468 468
469 blocking_notifier_call_chain(&pSeries_reconfig_chain, 469 rc = blocking_notifier_call_chain(&pSeries_reconfig_chain,
470 action, value); 470 action, value);
471 } 471 }
472 472
473 return 0; 473 return rc;
474} 474}
475 475
476/** 476/**
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index c9ffd8c225f1..f4e55be2eea9 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -295,19 +295,29 @@ static ssize_t rtas_log_read(struct file * file, char __user * buf,
295 if (!tmp) 295 if (!tmp)
296 return -ENOMEM; 296 return -ENOMEM;
297 297
298
299 spin_lock_irqsave(&rtasd_log_lock, s); 298 spin_lock_irqsave(&rtasd_log_lock, s);
300 /* if it's 0, then we know we got the last one (the one in NVRAM) */ 299 /* if it's 0, then we know we got the last one (the one in NVRAM) */
301 if (rtas_log_size == 0 && logging_enabled) 300 while (rtas_log_size == 0) {
302 nvram_clear_error_log(); 301 if (file->f_flags & O_NONBLOCK) {
303 spin_unlock_irqrestore(&rtasd_log_lock, s); 302 spin_unlock_irqrestore(&rtasd_log_lock, s);
303 error = -EAGAIN;
304 goto out;
305 }
304 306
307 if (!logging_enabled) {
308 spin_unlock_irqrestore(&rtasd_log_lock, s);
309 error = -ENODATA;
310 goto out;
311 }
312 nvram_clear_error_log();
305 313
306 error = wait_event_interruptible(rtas_log_wait, rtas_log_size); 314 spin_unlock_irqrestore(&rtasd_log_lock, s);
307 if (error) 315 error = wait_event_interruptible(rtas_log_wait, rtas_log_size);
308 goto out; 316 if (error)
317 goto out;
318 spin_lock_irqsave(&rtasd_log_lock, s);
319 }
309 320
310 spin_lock_irqsave(&rtasd_log_lock, s);
311 offset = rtas_error_log_buffer_max * (rtas_log_start & LOG_NUMBER_MASK); 321 offset = rtas_error_log_buffer_max * (rtas_log_start & LOG_NUMBER_MASK);
312 memcpy(tmp, &rtas_log_buf[offset], count); 322 memcpy(tmp, &rtas_log_buf[offset], count);
313 323
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 7b01d67b4e48..ec341707e41b 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -25,7 +25,6 @@
25#include <linux/unistd.h> 25#include <linux/unistd.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/user.h> 27#include <linux/user.h>
28#include <linux/a.out.h>
29#include <linux/tty.h> 28#include <linux/tty.h>
30#include <linux/major.h> 29#include <linux/major.h>
31#include <linux/interrupt.h> 30#include <linux/interrupt.h>
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 9d8f8c84ab89..e00f96baa381 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -37,7 +37,6 @@
37#include <asm/paca.h> 37#include <asm/paca.h>
38#include <asm/time.h> 38#include <asm/time.h>
39#include <asm/machdep.h> 39#include <asm/machdep.h>
40#include "xics.h"
41#include <asm/cputable.h> 40#include <asm/cputable.h>
42#include <asm/firmware.h> 41#include <asm/firmware.h>
43#include <asm/system.h> 42#include <asm/system.h>
@@ -49,6 +48,7 @@
49 48
50#include "plpar_wrappers.h" 49#include "plpar_wrappers.h"
51#include "pseries.h" 50#include "pseries.h"
51#include "xics.h"
52 52
53 53
54/* 54/*
@@ -105,36 +105,6 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
105} 105}
106 106
107#ifdef CONFIG_XICS 107#ifdef CONFIG_XICS
108static inline void smp_xics_do_message(int cpu, int msg)
109{
110 set_bit(msg, &xics_ipi_message[cpu].value);
111 mb();
112 xics_cause_IPI(cpu);
113}
114
115static void smp_xics_message_pass(int target, int msg)
116{
117 unsigned int i;
118
119 if (target < NR_CPUS) {
120 smp_xics_do_message(target, msg);
121 } else {
122 for_each_online_cpu(i) {
123 if (target == MSG_ALL_BUT_SELF
124 && i == smp_processor_id())
125 continue;
126 smp_xics_do_message(i, msg);
127 }
128 }
129}
130
131static int __init smp_xics_probe(void)
132{
133 xics_request_IPIs();
134
135 return cpus_weight(cpu_possible_map);
136}
137
138static void __devinit smp_xics_setup_cpu(int cpu) 108static void __devinit smp_xics_setup_cpu(int cpu)
139{ 109{
140 if (cpu != boot_cpuid) 110 if (cpu != boot_cpuid)
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 0fc830f576f5..e1904774a70f 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -9,32 +9,30 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12
13#include <linux/types.h> 12#include <linux/types.h>
14#include <linux/threads.h> 13#include <linux/threads.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/irq.h> 15#include <linux/irq.h>
17#include <linux/smp.h> 16#include <linux/smp.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
19#include <linux/signal.h>
20#include <linux/init.h> 18#include <linux/init.h>
21#include <linux/gfp.h>
22#include <linux/radix-tree.h> 19#include <linux/radix-tree.h>
23#include <linux/cpu.h> 20#include <linux/cpu.h>
21#include <linux/of.h>
24 22
25#include <asm/firmware.h> 23#include <asm/firmware.h>
26#include <asm/prom.h>
27#include <asm/io.h> 24#include <asm/io.h>
28#include <asm/pgtable.h> 25#include <asm/pgtable.h>
29#include <asm/smp.h> 26#include <asm/smp.h>
30#include <asm/rtas.h> 27#include <asm/rtas.h>
31#include <asm/hvcall.h> 28#include <asm/hvcall.h>
32#include <asm/machdep.h> 29#include <asm/machdep.h>
33#include <asm/i8259.h>
34 30
35#include "xics.h" 31#include "xics.h"
36#include "plpar_wrappers.h" 32#include "plpar_wrappers.h"
37 33
34static struct irq_host *xics_host;
35
38#define XICS_IPI 2 36#define XICS_IPI 2
39#define XICS_IRQ_SPURIOUS 0 37#define XICS_IRQ_SPURIOUS 0
40 38
@@ -47,6 +45,20 @@
47 */ 45 */
48#define IPI_PRIORITY 4 46#define IPI_PRIORITY 4
49 47
48static unsigned int default_server = 0xFF;
49static unsigned int default_distrib_server = 0;
50static unsigned int interrupt_server_size = 8;
51
52/* RTAS service tokens */
53static int ibm_get_xive;
54static int ibm_set_xive;
55static int ibm_int_on;
56static int ibm_int_off;
57
58
59/* Direct hardware low level accessors */
60
61/* The part of the interrupt presentation layer that we care about */
50struct xics_ipl { 62struct xics_ipl {
51 union { 63 union {
52 u32 word; 64 u32 word;
@@ -65,27 +77,6 @@ struct xics_ipl {
65 77
66static struct xics_ipl __iomem *xics_per_cpu[NR_CPUS]; 78static struct xics_ipl __iomem *xics_per_cpu[NR_CPUS];
67 79
68static unsigned int default_server = 0xFF;
69static unsigned int default_distrib_server = 0;
70static unsigned int interrupt_server_size = 8;
71
72static struct irq_host *xics_host;
73
74/*
75 * XICS only has a single IPI, so encode the messages per CPU
76 */
77struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
78
79/* RTAS service tokens */
80static int ibm_get_xive;
81static int ibm_set_xive;
82static int ibm_int_on;
83static int ibm_int_off;
84
85
86/* Direct HW low level accessors */
87
88
89static inline unsigned int direct_xirr_info_get(void) 80static inline unsigned int direct_xirr_info_get(void)
90{ 81{
91 int cpu = smp_processor_id(); 82 int cpu = smp_processor_id();
@@ -93,7 +84,7 @@ static inline unsigned int direct_xirr_info_get(void)
93 return in_be32(&xics_per_cpu[cpu]->xirr.word); 84 return in_be32(&xics_per_cpu[cpu]->xirr.word);
94} 85}
95 86
96static inline void direct_xirr_info_set(int value) 87static inline void direct_xirr_info_set(unsigned int value)
97{ 88{
98 int cpu = smp_processor_id(); 89 int cpu = smp_processor_id();
99 90
@@ -115,7 +106,6 @@ static inline void direct_qirr_info(int n_cpu, u8 value)
115 106
116/* LPAR low level accessors */ 107/* LPAR low level accessors */
117 108
118
119static inline unsigned int lpar_xirr_info_get(void) 109static inline unsigned int lpar_xirr_info_get(void)
120{ 110{
121 unsigned long lpar_rc; 111 unsigned long lpar_rc;
@@ -127,15 +117,14 @@ static inline unsigned int lpar_xirr_info_get(void)
127 return (unsigned int)return_value; 117 return (unsigned int)return_value;
128} 118}
129 119
130static inline void lpar_xirr_info_set(int value) 120static inline void lpar_xirr_info_set(unsigned int value)
131{ 121{
132 unsigned long lpar_rc; 122 unsigned long lpar_rc;
133 unsigned long val64 = value & 0xffffffff;
134 123
135 lpar_rc = plpar_eoi(val64); 124 lpar_rc = plpar_eoi(value);
136 if (lpar_rc != H_SUCCESS) 125 if (lpar_rc != H_SUCCESS)
137 panic("bad return code EOI - rc = %ld, value=%lx\n", lpar_rc, 126 panic("bad return code EOI - rc = %ld, value=%x\n", lpar_rc,
138 val64); 127 value);
139} 128}
140 129
141static inline void lpar_cppr_info(u8 value) 130static inline void lpar_cppr_info(u8 value)
@@ -157,48 +146,7 @@ static inline void lpar_qirr_info(int n_cpu , u8 value)
157} 146}
158 147
159 148
160/* High level handlers and init code */ 149/* Interface to generic irq subsystem */
161
162static void xics_update_irq_servers(void)
163{
164 int i, j;
165 struct device_node *np;
166 u32 ilen;
167 const u32 *ireg, *isize;
168 u32 hcpuid;
169
170 /* Find the server numbers for the boot cpu. */
171 np = of_get_cpu_node(boot_cpuid, NULL);
172 BUG_ON(!np);
173
174 ireg = of_get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen);
175 if (!ireg) {
176 of_node_put(np);
177 return;
178 }
179
180 i = ilen / sizeof(int);
181 hcpuid = get_hard_smp_processor_id(boot_cpuid);
182
183 /* Global interrupt distribution server is specified in the last
184 * entry of "ibm,ppc-interrupt-gserver#s" property. Get the last
185 * entry fom this property for current boot cpu id and use it as
186 * default distribution server
187 */
188 for (j = 0; j < i; j += 2) {
189 if (ireg[j] == hcpuid) {
190 default_server = hcpuid;
191 default_distrib_server = ireg[j+1];
192
193 isize = of_get_property(np,
194 "ibm,interrupt-server#-size", NULL);
195 if (isize)
196 interrupt_server_size = *isize;
197 }
198 }
199
200 of_node_put(np);
201}
202 150
203#ifdef CONFIG_SMP 151#ifdef CONFIG_SMP
204static int get_irq_server(unsigned int virq, unsigned int strict_check) 152static int get_irq_server(unsigned int virq, unsigned int strict_check)
@@ -208,9 +156,6 @@ static int get_irq_server(unsigned int virq, unsigned int strict_check)
208 cpumask_t cpumask = irq_desc[virq].affinity; 156 cpumask_t cpumask = irq_desc[virq].affinity;
209 cpumask_t tmp = CPU_MASK_NONE; 157 cpumask_t tmp = CPU_MASK_NONE;
210 158
211 if (! cpu_isset(default_server, cpu_online_map))
212 xics_update_irq_servers();
213
214 if (!distribute_irqs) 159 if (!distribute_irqs)
215 return default_server; 160 return default_server;
216 161
@@ -238,7 +183,6 @@ static int get_irq_server(unsigned int virq, unsigned int strict_check)
238} 183}
239#endif 184#endif
240 185
241
242static void xics_unmask_irq(unsigned int virq) 186static void xics_unmask_irq(unsigned int virq)
243{ 187{
244 unsigned int irq; 188 unsigned int irq;
@@ -257,21 +201,28 @@ static void xics_unmask_irq(unsigned int virq)
257 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 201 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server,
258 DEFAULT_PRIORITY); 202 DEFAULT_PRIORITY);
259 if (call_status != 0) { 203 if (call_status != 0) {
260 printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_set_xive " 204 printk(KERN_ERR
261 "returned %d\n", irq, call_status); 205 "%s: ibm_set_xive irq %u server %x returned %d\n",
262 printk("set_xive %x, server %x\n", ibm_set_xive, server); 206 __func__, irq, server, call_status);
263 return; 207 return;
264 } 208 }
265 209
266 /* Now unmask the interrupt (often a no-op) */ 210 /* Now unmask the interrupt (often a no-op) */
267 call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq); 211 call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq);
268 if (call_status != 0) { 212 if (call_status != 0) {
269 printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_int_on " 213 printk(KERN_ERR "%s: ibm_int_on irq=%u returned %d\n",
270 "returned %d\n", irq, call_status); 214 __func__, irq, call_status);
271 return; 215 return;
272 } 216 }
273} 217}
274 218
219static unsigned int xics_startup(unsigned int virq)
220{
221 /* unmask it */
222 xics_unmask_irq(virq);
223 return 0;
224}
225
275static void xics_mask_real_irq(unsigned int irq) 226static void xics_mask_real_irq(unsigned int irq)
276{ 227{
277 int call_status; 228 int call_status;
@@ -281,8 +232,8 @@ static void xics_mask_real_irq(unsigned int irq)
281 232
282 call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq); 233 call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq);
283 if (call_status != 0) { 234 if (call_status != 0) {
284 printk(KERN_ERR "xics_disable_real_irq: irq=%u: " 235 printk(KERN_ERR "%s: ibm_int_off irq=%u returned %d\n",
285 "ibm_int_off returned %d\n", irq, call_status); 236 __func__, irq, call_status);
286 return; 237 return;
287 } 238 }
288 239
@@ -290,8 +241,8 @@ static void xics_mask_real_irq(unsigned int irq)
290 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, 241 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq,
291 default_server, 0xff); 242 default_server, 0xff);
292 if (call_status != 0) { 243 if (call_status != 0) {
293 printk(KERN_ERR "xics_disable_irq: irq=%u: ibm_set_xive(0xff)" 244 printk(KERN_ERR "%s: ibm_set_xive(0xff) irq=%u returned %d\n",
294 " returned %d\n", irq, call_status); 245 __func__, irq, call_status);
295 return; 246 return;
296 } 247 }
297} 248}
@@ -308,132 +259,77 @@ static void xics_mask_irq(unsigned int virq)
308 xics_mask_real_irq(irq); 259 xics_mask_real_irq(irq);
309} 260}
310 261
311static unsigned int xics_startup(unsigned int virq) 262static void xics_mask_unknown_vec(unsigned int vec)
312{
313 unsigned int irq;
314
315 /* force a reverse mapping of the interrupt so it gets in the cache */
316 irq = (unsigned int)irq_map[virq].hwirq;
317 irq_radix_revmap(xics_host, irq);
318
319 /* unmask it */
320 xics_unmask_irq(virq);
321 return 0;
322}
323
324static void xics_eoi_direct(unsigned int virq)
325{ 263{
326 unsigned int irq = (unsigned int)irq_map[virq].hwirq; 264 printk(KERN_ERR "Interrupt %u (real) is invalid, disabling it.\n", vec);
327 265 xics_mask_real_irq(vec);
328 iosync();
329 direct_xirr_info_set((0xff << 24) | irq);
330} 266}
331 267
332 268static inline unsigned int xics_xirr_vector(unsigned int xirr)
333static void xics_eoi_lpar(unsigned int virq)
334{ 269{
335 unsigned int irq = (unsigned int)irq_map[virq].hwirq; 270 /*
336 271 * The top byte is the old cppr, to be restored on EOI.
337 iosync(); 272 * The remaining 24 bits are the vector.
338 lpar_xirr_info_set((0xff << 24) | irq); 273 */
274 return xirr & 0x00ffffff;
339} 275}
340 276
341static inline unsigned int xics_remap_irq(unsigned int vec) 277static unsigned int xics_get_irq_direct(void)
342{ 278{
279 unsigned int xirr = direct_xirr_info_get();
280 unsigned int vec = xics_xirr_vector(xirr);
343 unsigned int irq; 281 unsigned int irq;
344 282
345 vec &= 0x00ffffff;
346
347 if (vec == XICS_IRQ_SPURIOUS) 283 if (vec == XICS_IRQ_SPURIOUS)
348 return NO_IRQ; 284 return NO_IRQ;
349 irq = irq_radix_revmap(xics_host, vec); 285
286 irq = irq_radix_revmap_lookup(xics_host, vec);
350 if (likely(irq != NO_IRQ)) 287 if (likely(irq != NO_IRQ))
351 return irq; 288 return irq;
352 289
353 printk(KERN_ERR "Interrupt %u (real) is invalid," 290 /* We don't have a linux mapping, so have rtas mask it. */
354 " disabling it.\n", vec); 291 xics_mask_unknown_vec(vec);
355 xics_mask_real_irq(vec);
356 return NO_IRQ;
357}
358 292
359static unsigned int xics_get_irq_direct(void) 293 /* We might learn about it later, so EOI it */
360{ 294 direct_xirr_info_set(xirr);
361 return xics_remap_irq(direct_xirr_info_get()); 295 return NO_IRQ;
362} 296}
363 297
364static unsigned int xics_get_irq_lpar(void) 298static unsigned int xics_get_irq_lpar(void)
365{ 299{
366 return xics_remap_irq(lpar_xirr_info_get()); 300 unsigned int xirr = lpar_xirr_info_get();
367} 301 unsigned int vec = xics_xirr_vector(xirr);
368 302 unsigned int irq;
369#ifdef CONFIG_SMP
370
371static irqreturn_t xics_ipi_dispatch(int cpu)
372{
373 WARN_ON(cpu_is_offline(cpu));
374 303
375 while (xics_ipi_message[cpu].value) { 304 if (vec == XICS_IRQ_SPURIOUS)
376 if (test_and_clear_bit(PPC_MSG_CALL_FUNCTION, 305 return NO_IRQ;
377 &xics_ipi_message[cpu].value)) {
378 mb();
379 smp_message_recv(PPC_MSG_CALL_FUNCTION);
380 }
381 if (test_and_clear_bit(PPC_MSG_RESCHEDULE,
382 &xics_ipi_message[cpu].value)) {
383 mb();
384 smp_message_recv(PPC_MSG_RESCHEDULE);
385 }
386 if (test_and_clear_bit(PPC_MSG_CALL_FUNC_SINGLE,
387 &xics_ipi_message[cpu].value)) {
388 mb();
389 smp_message_recv(PPC_MSG_CALL_FUNC_SINGLE);
390 }
391#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
392 if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK,
393 &xics_ipi_message[cpu].value)) {
394 mb();
395 smp_message_recv(PPC_MSG_DEBUGGER_BREAK);
396 }
397#endif
398 }
399 return IRQ_HANDLED;
400}
401 306
402static irqreturn_t xics_ipi_action_direct(int irq, void *dev_id) 307 irq = irq_radix_revmap_lookup(xics_host, vec);
403{ 308 if (likely(irq != NO_IRQ))
404 int cpu = smp_processor_id(); 309 return irq;
405 310
406 direct_qirr_info(cpu, 0xff); 311 /* We don't have a linux mapping, so have RTAS mask it. */
312 xics_mask_unknown_vec(vec);
407 313
408 return xics_ipi_dispatch(cpu); 314 /* We might learn about it later, so EOI it */
315 lpar_xirr_info_set(xirr);
316 return NO_IRQ;
409} 317}
410 318
411static irqreturn_t xics_ipi_action_lpar(int irq, void *dev_id) 319static void xics_eoi_direct(unsigned int virq)
412{ 320{
413 int cpu = smp_processor_id(); 321 unsigned int irq = (unsigned int)irq_map[virq].hwirq;
414
415 lpar_qirr_info(cpu, 0xff);
416 322
417 return xics_ipi_dispatch(cpu); 323 iosync();
324 direct_xirr_info_set((0xff << 24) | irq);
418} 325}
419 326
420void xics_cause_IPI(int cpu) 327static void xics_eoi_lpar(unsigned int virq)
421{ 328{
422 if (firmware_has_feature(FW_FEATURE_LPAR)) 329 unsigned int irq = (unsigned int)irq_map[virq].hwirq;
423 lpar_qirr_info(cpu, IPI_PRIORITY);
424 else
425 direct_qirr_info(cpu, IPI_PRIORITY);
426}
427
428#endif /* CONFIG_SMP */
429 330
430static void xics_set_cpu_priority(unsigned char cppr)
431{
432 if (firmware_has_feature(FW_FEATURE_LPAR))
433 lpar_cppr_info(cppr);
434 else
435 direct_cppr_info(cppr);
436 iosync(); 331 iosync();
332 lpar_xirr_info_set((0xff << 24) | irq);
437} 333}
438 334
439static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) 335static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
@@ -450,8 +346,8 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
450 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); 346 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);
451 347
452 if (status) { 348 if (status) {
453 printk(KERN_ERR "xics_set_affinity: irq=%u ibm,get-xive " 349 printk(KERN_ERR "%s: ibm,get-xive irq=%u returns %d\n",
454 "returns %d\n", irq, status); 350 __func__, irq, status);
455 return; 351 return;
456 } 352 }
457 353
@@ -463,8 +359,9 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
463 if (irq_server == -1) { 359 if (irq_server == -1) {
464 char cpulist[128]; 360 char cpulist[128];
465 cpumask_scnprintf(cpulist, sizeof(cpulist), cpumask); 361 cpumask_scnprintf(cpulist, sizeof(cpulist), cpumask);
466 printk(KERN_WARNING "xics_set_affinity: No online cpus in " 362 printk(KERN_WARNING
467 "the mask %s for irq %d\n", cpulist, virq); 363 "%s: No online cpus in the mask %s for irq %d\n",
364 __func__, cpulist, virq);
468 return; 365 return;
469 } 366 }
470 367
@@ -472,28 +369,12 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
472 irq, irq_server, xics_status[1]); 369 irq, irq_server, xics_status[1]);
473 370
474 if (status) { 371 if (status) {
475 printk(KERN_ERR "xics_set_affinity: irq=%u ibm,set-xive " 372 printk(KERN_ERR "%s: ibm,set-xive irq=%u returns %d\n",
476 "returns %d\n", irq, status); 373 __func__, irq, status);
477 return; 374 return;
478 } 375 }
479} 376}
480 377
481void xics_setup_cpu(void)
482{
483 xics_set_cpu_priority(0xff);
484
485 /*
486 * Put the calling processor into the GIQ. This is really only
487 * necessary from a secondary thread as the OF start-cpu interface
488 * performs this function for us on primary threads.
489 *
490 * XXX: undo of teardown on kexec needs this too, as may hotplug
491 */
492 rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE,
493 (1UL << interrupt_server_size) - 1 - default_distrib_server, 1);
494}
495
496
497static struct irq_chip xics_pic_direct = { 378static struct irq_chip xics_pic_direct = {
498 .typename = " XICS ", 379 .typename = " XICS ",
499 .startup = xics_startup, 380 .startup = xics_startup,
@@ -503,7 +384,6 @@ static struct irq_chip xics_pic_direct = {
503 .set_affinity = xics_set_affinity 384 .set_affinity = xics_set_affinity
504}; 385};
505 386
506
507static struct irq_chip xics_pic_lpar = { 387static struct irq_chip xics_pic_lpar = {
508 .typename = " XICS ", 388 .typename = " XICS ",
509 .startup = xics_startup, 389 .startup = xics_startup,
@@ -513,6 +393,9 @@ static struct irq_chip xics_pic_lpar = {
513 .set_affinity = xics_set_affinity 393 .set_affinity = xics_set_affinity
514}; 394};
515 395
396
397/* Interface to arch irq controller subsystem layer */
398
516/* Points to the irq_chip we're actually using */ 399/* Points to the irq_chip we're actually using */
517static struct irq_chip *xics_irq_chip; 400static struct irq_chip *xics_irq_chip;
518 401
@@ -530,6 +413,9 @@ static int xics_host_map(struct irq_host *h, unsigned int virq,
530{ 413{
531 pr_debug("xics: map virq %d, hwirq 0x%lx\n", virq, hw); 414 pr_debug("xics: map virq %d, hwirq 0x%lx\n", virq, hw);
532 415
416 /* Insert the interrupt mapping into the radix tree for fast lookup */
417 irq_radix_revmap_insert(xics_host, virq, hw);
418
533 get_irq_desc(virq)->status |= IRQ_LEVEL; 419 get_irq_desc(virq)->status |= IRQ_LEVEL;
534 set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq); 420 set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq);
535 return 0; 421 return 0;
@@ -569,10 +455,169 @@ static void __init xics_init_host(void)
569 irq_set_default_host(xics_host); 455 irq_set_default_host(xics_host);
570} 456}
571 457
458
459/* Inter-processor interrupt support */
460
461#ifdef CONFIG_SMP
462/*
463 * XICS only has a single IPI, so encode the messages per CPU
464 */
465struct xics_ipi_struct {
466 unsigned long value;
467 } ____cacheline_aligned;
468
469static struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
470
471static inline void smp_xics_do_message(int cpu, int msg)
472{
473 set_bit(msg, &xics_ipi_message[cpu].value);
474 mb();
475 if (firmware_has_feature(FW_FEATURE_LPAR))
476 lpar_qirr_info(cpu, IPI_PRIORITY);
477 else
478 direct_qirr_info(cpu, IPI_PRIORITY);
479}
480
481void smp_xics_message_pass(int target, int msg)
482{
483 unsigned int i;
484
485 if (target < NR_CPUS) {
486 smp_xics_do_message(target, msg);
487 } else {
488 for_each_online_cpu(i) {
489 if (target == MSG_ALL_BUT_SELF
490 && i == smp_processor_id())
491 continue;
492 smp_xics_do_message(i, msg);
493 }
494 }
495}
496
497static irqreturn_t xics_ipi_dispatch(int cpu)
498{
499 WARN_ON(cpu_is_offline(cpu));
500
501 mb(); /* order mmio clearing qirr */
502 while (xics_ipi_message[cpu].value) {
503 if (test_and_clear_bit(PPC_MSG_CALL_FUNCTION,
504 &xics_ipi_message[cpu].value)) {
505 smp_message_recv(PPC_MSG_CALL_FUNCTION);
506 }
507 if (test_and_clear_bit(PPC_MSG_RESCHEDULE,
508 &xics_ipi_message[cpu].value)) {
509 smp_message_recv(PPC_MSG_RESCHEDULE);
510 }
511 if (test_and_clear_bit(PPC_MSG_CALL_FUNC_SINGLE,
512 &xics_ipi_message[cpu].value)) {
513 smp_message_recv(PPC_MSG_CALL_FUNC_SINGLE);
514 }
515#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
516 if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK,
517 &xics_ipi_message[cpu].value)) {
518 smp_message_recv(PPC_MSG_DEBUGGER_BREAK);
519 }
520#endif
521 }
522 return IRQ_HANDLED;
523}
524
525static irqreturn_t xics_ipi_action_direct(int irq, void *dev_id)
526{
527 int cpu = smp_processor_id();
528
529 direct_qirr_info(cpu, 0xff);
530
531 return xics_ipi_dispatch(cpu);
532}
533
534static irqreturn_t xics_ipi_action_lpar(int irq, void *dev_id)
535{
536 int cpu = smp_processor_id();
537
538 lpar_qirr_info(cpu, 0xff);
539
540 return xics_ipi_dispatch(cpu);
541}
542
543static void xics_request_ipi(void)
544{
545 unsigned int ipi;
546 int rc;
547
548 ipi = irq_create_mapping(xics_host, XICS_IPI);
549 BUG_ON(ipi == NO_IRQ);
550
551 /*
552 * IPIs are marked IRQF_DISABLED as they must run with irqs
553 * disabled
554 */
555 set_irq_handler(ipi, handle_percpu_irq);
556 if (firmware_has_feature(FW_FEATURE_LPAR))
557 rc = request_irq(ipi, xics_ipi_action_lpar,
558 IRQF_DISABLED|IRQF_PERCPU, "IPI", NULL);
559 else
560 rc = request_irq(ipi, xics_ipi_action_direct,
561 IRQF_DISABLED|IRQF_PERCPU, "IPI", NULL);
562 BUG_ON(rc);
563}
564
565int __init smp_xics_probe(void)
566{
567 xics_request_ipi();
568
569 return cpus_weight(cpu_possible_map);
570}
571
572#endif /* CONFIG_SMP */
573
574
575/* Initialization */
576
577static void xics_update_irq_servers(void)
578{
579 int i, j;
580 struct device_node *np;
581 u32 ilen;
582 const u32 *ireg, *isize;
583 u32 hcpuid;
584
585 /* Find the server numbers for the boot cpu. */
586 np = of_get_cpu_node(boot_cpuid, NULL);
587 BUG_ON(!np);
588
589 ireg = of_get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen);
590 if (!ireg) {
591 of_node_put(np);
592 return;
593 }
594
595 i = ilen / sizeof(int);
596 hcpuid = get_hard_smp_processor_id(boot_cpuid);
597
598 /* Global interrupt distribution server is specified in the last
599 * entry of "ibm,ppc-interrupt-gserver#s" property. Get the last
600 * entry fom this property for current boot cpu id and use it as
601 * default distribution server
602 */
603 for (j = 0; j < i; j += 2) {
604 if (ireg[j] == hcpuid) {
605 default_server = hcpuid;
606 default_distrib_server = ireg[j+1];
607 }
608 }
609
610 /* get the bit size of server numbers */
611 isize = of_get_property(np, "ibm,interrupt-server#-size", NULL);
612 if (isize)
613 interrupt_server_size = *isize;
614
615 of_node_put(np);
616}
617
572static void __init xics_map_one_cpu(int hw_id, unsigned long addr, 618static void __init xics_map_one_cpu(int hw_id, unsigned long addr,
573 unsigned long size) 619 unsigned long size)
574{ 620{
575#ifdef CONFIG_SMP
576 int i; 621 int i;
577 622
578 /* This may look gross but it's good enough for now, we don't quite 623 /* This may look gross but it's good enough for now, we don't quite
@@ -586,11 +631,6 @@ static void __init xics_map_one_cpu(int hw_id, unsigned long addr,
586 return; 631 return;
587 } 632 }
588 } 633 }
589#else
590 if (hw_id != 0)
591 return;
592 xics_per_cpu[0] = ioremap(addr, size);
593#endif /* CONFIG_SMP */
594} 634}
595 635
596static void __init xics_init_one_node(struct device_node *np, 636static void __init xics_init_one_node(struct device_node *np,
@@ -652,15 +692,17 @@ void __init xics_init_IRQ(void)
652 692
653 for_each_node_by_type(np, "PowerPC-External-Interrupt-Presentation") { 693 for_each_node_by_type(np, "PowerPC-External-Interrupt-Presentation") {
654 found = 1; 694 found = 1;
655 if (firmware_has_feature(FW_FEATURE_LPAR)) 695 if (firmware_has_feature(FW_FEATURE_LPAR)) {
696 of_node_put(np);
656 break; 697 break;
698 }
657 xics_init_one_node(np, &indx); 699 xics_init_one_node(np, &indx);
658 } 700 }
659 if (found == 0) 701 if (found == 0)
660 return; 702 return;
661 703
662 xics_init_host();
663 xics_update_irq_servers(); 704 xics_update_irq_servers();
705 xics_init_host();
664 706
665 if (firmware_has_feature(FW_FEATURE_LPAR)) 707 if (firmware_has_feature(FW_FEATURE_LPAR))
666 ppc_md.get_irq = xics_get_irq_lpar; 708 ppc_md.get_irq = xics_get_irq_lpar;
@@ -672,30 +714,31 @@ void __init xics_init_IRQ(void)
672 ppc64_boot_msg(0x21, "XICS Done"); 714 ppc64_boot_msg(0x21, "XICS Done");
673} 715}
674 716
717/* Cpu startup, shutdown, and hotplug */
675 718
676#ifdef CONFIG_SMP 719static void xics_set_cpu_priority(unsigned char cppr)
677void xics_request_IPIs(void)
678{ 720{
679 unsigned int ipi;
680 int rc;
681
682 ipi = irq_create_mapping(xics_host, XICS_IPI);
683 BUG_ON(ipi == NO_IRQ);
684
685 /*
686 * IPIs are marked IRQF_DISABLED as they must run with irqs
687 * disabled
688 */
689 set_irq_handler(ipi, handle_percpu_irq);
690 if (firmware_has_feature(FW_FEATURE_LPAR)) 721 if (firmware_has_feature(FW_FEATURE_LPAR))
691 rc = request_irq(ipi, xics_ipi_action_lpar, IRQF_DISABLED, 722 lpar_cppr_info(cppr);
692 "IPI", NULL);
693 else 723 else
694 rc = request_irq(ipi, xics_ipi_action_direct, IRQF_DISABLED, 724 direct_cppr_info(cppr);
695 "IPI", NULL); 725 iosync();
696 BUG_ON(rc); 726}
727
728/* Have the calling processor join or leave the specified global queue */
729static void xics_set_cpu_giq(unsigned int gserver, unsigned int join)
730{
731 int status = rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE,
732 (1UL << interrupt_server_size) - 1 - gserver, join);
733 WARN_ON(status < 0);
734}
735
736void xics_setup_cpu(void)
737{
738 xics_set_cpu_priority(0xff);
739
740 xics_set_cpu_giq(default_distrib_server, 1);
697} 741}
698#endif /* CONFIG_SMP */
699 742
700void xics_teardown_cpu(void) 743void xics_teardown_cpu(void)
701{ 744{
@@ -703,9 +746,7 @@ void xics_teardown_cpu(void)
703 746
704 xics_set_cpu_priority(0); 747 xics_set_cpu_priority(0);
705 748
706 /* 749 /* Clear any pending IPI request */
707 * Clear IPI
708 */
709 if (firmware_has_feature(FW_FEATURE_LPAR)) 750 if (firmware_has_feature(FW_FEATURE_LPAR))
710 lpar_qirr_info(cpu, 0xff); 751 lpar_qirr_info(cpu, 0xff);
711 else 752 else
@@ -714,34 +755,28 @@ void xics_teardown_cpu(void)
714 755
715void xics_kexec_teardown_cpu(int secondary) 756void xics_kexec_teardown_cpu(int secondary)
716{ 757{
717 unsigned int ipi;
718 struct irq_desc *desc;
719
720 xics_teardown_cpu(); 758 xics_teardown_cpu();
721 759
722 /* 760 /*
723 * we need to EOI the IPI 761 * we take the ipi irq but and never return so we
762 * need to EOI the IPI, but want to leave our priority 0
724 * 763 *
725 * probably need to check all the other interrupts too 764 * should we check all the other interrupts too?
726 * should we be flagging idle loop instead? 765 * should we be flagging idle loop instead?
727 * or creating some task to be scheduled? 766 * or creating some task to be scheduled?
728 */ 767 */
729 768
730 ipi = irq_find_mapping(xics_host, XICS_IPI); 769 if (firmware_has_feature(FW_FEATURE_LPAR))
731 if (ipi == XICS_IRQ_SPURIOUS) 770 lpar_xirr_info_set((0x00 << 24) | XICS_IPI);
732 return; 771 else
733 desc = get_irq_desc(ipi); 772 direct_xirr_info_set((0x00 << 24) | XICS_IPI);
734 if (desc->chip && desc->chip->eoi)
735 desc->chip->eoi(ipi);
736 773
737 /* 774 /*
738 * Some machines need to have at least one cpu in the GIQ, 775 * Some machines need to have at least one cpu in the GIQ,
739 * so leave the master cpu in the group. 776 * so leave the master cpu in the group.
740 */ 777 */
741 if (secondary) 778 if (secondary)
742 rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, 779 xics_set_cpu_giq(default_distrib_server, 0);
743 (1UL << interrupt_server_size) - 1 -
744 default_distrib_server, 0);
745} 780}
746 781
747#ifdef CONFIG_HOTPLUG_CPU 782#ifdef CONFIG_HOTPLUG_CPU
@@ -749,17 +784,18 @@ void xics_kexec_teardown_cpu(int secondary)
749/* Interrupts are disabled. */ 784/* Interrupts are disabled. */
750void xics_migrate_irqs_away(void) 785void xics_migrate_irqs_away(void)
751{ 786{
752 int status;
753 int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id(); 787 int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id();
754 unsigned int irq, virq; 788 unsigned int irq, virq;
755 789
790 /* If we used to be the default server, move to the new "boot_cpuid" */
791 if (hw_cpu == default_server)
792 xics_update_irq_servers();
793
756 /* Reject any interrupt that was queued to us... */ 794 /* Reject any interrupt that was queued to us... */
757 xics_set_cpu_priority(0); 795 xics_set_cpu_priority(0);
758 796
759 /* remove ourselves from the global interrupt queue */ 797 /* Remove ourselves from the global interrupt queue */
760 status = rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, 798 xics_set_cpu_giq(default_distrib_server, 0);
761 (1UL << interrupt_server_size) - 1 - default_distrib_server, 0);
762 WARN_ON(status < 0);
763 799
764 /* Allow IPIs again... */ 800 /* Allow IPIs again... */
765 xics_set_cpu_priority(DEFAULT_PRIORITY); 801 xics_set_cpu_priority(DEFAULT_PRIORITY);
@@ -767,6 +803,7 @@ void xics_migrate_irqs_away(void)
767 for_each_irq(virq) { 803 for_each_irq(virq) {
768 struct irq_desc *desc; 804 struct irq_desc *desc;
769 int xics_status[2]; 805 int xics_status[2];
806 int status;
770 unsigned long flags; 807 unsigned long flags;
771 808
772 /* We cant set affinity on ISA interrupts */ 809 /* We cant set affinity on ISA interrupts */
@@ -790,9 +827,8 @@ void xics_migrate_irqs_away(void)
790 827
791 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); 828 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);
792 if (status) { 829 if (status) {
793 printk(KERN_ERR "migrate_irqs_away: irq=%u " 830 printk(KERN_ERR "%s: ibm,get-xive irq=%u returns %d\n",
794 "ibm,get-xive returns %d\n", 831 __func__, irq, status);
795 virq, status);
796 goto unlock; 832 goto unlock;
797 } 833 }
798 834
diff --git a/arch/powerpc/platforms/pseries/xics.h b/arch/powerpc/platforms/pseries/xics.h
index 1c5321ae8f2f..d1d5a83039ae 100644
--- a/arch/powerpc/platforms/pseries/xics.h
+++ b/arch/powerpc/platforms/pseries/xics.h
@@ -12,20 +12,12 @@
12#ifndef _POWERPC_KERNEL_XICS_H 12#ifndef _POWERPC_KERNEL_XICS_H
13#define _POWERPC_KERNEL_XICS_H 13#define _POWERPC_KERNEL_XICS_H
14 14
15#include <linux/cache.h>
16
17extern void xics_init_IRQ(void); 15extern void xics_init_IRQ(void);
18extern void xics_setup_cpu(void); 16extern void xics_setup_cpu(void);
19extern void xics_teardown_cpu(void); 17extern void xics_teardown_cpu(void);
20extern void xics_kexec_teardown_cpu(int secondary); 18extern void xics_kexec_teardown_cpu(int secondary);
21extern void xics_cause_IPI(int cpu);
22extern void xics_request_IPIs(void);
23extern void xics_migrate_irqs_away(void); 19extern void xics_migrate_irqs_away(void);
24 20extern int smp_xics_probe(void);
25struct xics_ipi_struct { 21extern void smp_xics_message_pass(int target, int msg);
26 volatile unsigned long value;
27} ____cacheline_aligned;
28
29extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
30 22
31#endif /* _POWERPC_KERNEL_XICS_H */ 23#endif /* _POWERPC_KERNEL_XICS_H */
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index 72fb35b9ebca..396582835cb5 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -6,3 +6,9 @@ config PPC4xx_PCI_EXPRESS
6 bool 6 bool
7 depends on PCI && 4xx 7 depends on PCI && 4xx
8 default n 8 default n
9
10config PPC_MSI_BITMAP
11 bool
12 depends on PCI_MSI
13 default y if MPIC
14 default y if FSL_PCI
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index a90054b56d5c..a44709a94f97 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -5,6 +5,7 @@ endif
5mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o 5mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o
6obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) 6obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y)
7fsl-msi-obj-$(CONFIG_PCI_MSI) += fsl_msi.o 7fsl-msi-obj-$(CONFIG_PCI_MSI) += fsl_msi.o
8obj-$(CONFIG_PPC_MSI_BITMAP) += msi_bitmap.o
8 9
9obj-$(CONFIG_PPC_MPC106) += grackle.o 10obj-$(CONFIG_PPC_MPC106) += grackle.o
10obj-$(CONFIG_PPC_DCR_NATIVE) += dcr-low.o 11obj-$(CONFIG_PPC_DCR_NATIVE) += dcr-low.o
@@ -15,6 +16,7 @@ obj-$(CONFIG_FSL_SOC) += fsl_soc.o
15obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y) 16obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y)
16obj-$(CONFIG_FSL_LBC) += fsl_lbc.o 17obj-$(CONFIG_FSL_LBC) += fsl_lbc.o
17obj-$(CONFIG_FSL_GTM) += fsl_gtm.o 18obj-$(CONFIG_FSL_GTM) += fsl_gtm.o
19obj-$(CONFIG_MPC8xxx_GPIO) += mpc8xxx_gpio.o
18obj-$(CONFIG_RAPIDIO) += fsl_rio.o 20obj-$(CONFIG_RAPIDIO) += fsl_rio.o
19obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o 21obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o
20obj-$(CONFIG_QUICC_ENGINE) += qe_lib/ 22obj-$(CONFIG_QUICC_ENGINE) += qe_lib/
@@ -36,15 +38,12 @@ ifeq ($(CONFIG_PCI),y)
36obj-$(CONFIG_4xx) += ppc4xx_pci.o 38obj-$(CONFIG_4xx) += ppc4xx_pci.o
37endif 39endif
38 40
39# Temporary hack until we have migrated to asm-powerpc
40ifeq ($(ARCH),powerpc)
41obj-$(CONFIG_CPM) += cpm_common.o 41obj-$(CONFIG_CPM) += cpm_common.o
42obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o 42obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o
43obj-$(CONFIG_QUICC_ENGINE) += cpm_common.o 43obj-$(CONFIG_QUICC_ENGINE) += cpm_common.o
44obj-$(CONFIG_PPC_DCR) += dcr.o 44obj-$(CONFIG_PPC_DCR) += dcr.o
45obj-$(CONFIG_8xx) += mpc8xx_pic.o cpm1.o 45obj-$(CONFIG_8xx) += mpc8xx_pic.o cpm1.o
46obj-$(CONFIG_UCODE_PATCH) += micropatch.o 46obj-$(CONFIG_UCODE_PATCH) += micropatch.o
47endif
48 47
49ifeq ($(CONFIG_SUSPEND),y) 48ifeq ($(CONFIG_SUSPEND),y)
50obj-$(CONFIG_6xx) += 6xx-suspend.o 49obj-$(CONFIG_6xx) += 6xx-suspend.o
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 4a04823e8423..490473ce8103 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -546,15 +546,11 @@ static int cpm1_gpio16_get(struct gpio_chip *gc, unsigned int gpio)
546 return !!(in_be16(&iop->dat) & pin_mask); 546 return !!(in_be16(&iop->dat) & pin_mask);
547} 547}
548 548
549static void cpm1_gpio16_set(struct gpio_chip *gc, unsigned int gpio, int value) 549static void __cpm1_gpio16_set(struct of_mm_gpio_chip *mm_gc, u16 pin_mask,
550 int value)
550{ 551{
551 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
552 struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc); 552 struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
553 struct cpm_ioport16 __iomem *iop = mm_gc->regs; 553 struct cpm_ioport16 __iomem *iop = mm_gc->regs;
554 unsigned long flags;
555 u16 pin_mask = 1 << (15 - gpio);
556
557 spin_lock_irqsave(&cpm1_gc->lock, flags);
558 554
559 if (value) 555 if (value)
560 cpm1_gc->cpdata |= pin_mask; 556 cpm1_gc->cpdata |= pin_mask;
@@ -562,6 +558,18 @@ static void cpm1_gpio16_set(struct gpio_chip *gc, unsigned int gpio, int value)
562 cpm1_gc->cpdata &= ~pin_mask; 558 cpm1_gc->cpdata &= ~pin_mask;
563 559
564 out_be16(&iop->dat, cpm1_gc->cpdata); 560 out_be16(&iop->dat, cpm1_gc->cpdata);
561}
562
563static void cpm1_gpio16_set(struct gpio_chip *gc, unsigned int gpio, int value)
564{
565 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
566 struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
567 unsigned long flags;
568 u16 pin_mask = 1 << (15 - gpio);
569
570 spin_lock_irqsave(&cpm1_gc->lock, flags);
571
572 __cpm1_gpio16_set(mm_gc, pin_mask, value);
565 573
566 spin_unlock_irqrestore(&cpm1_gc->lock, flags); 574 spin_unlock_irqrestore(&cpm1_gc->lock, flags);
567} 575}
@@ -569,14 +577,17 @@ static void cpm1_gpio16_set(struct gpio_chip *gc, unsigned int gpio, int value)
569static int cpm1_gpio16_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) 577static int cpm1_gpio16_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
570{ 578{
571 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 579 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
580 struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
572 struct cpm_ioport16 __iomem *iop = mm_gc->regs; 581 struct cpm_ioport16 __iomem *iop = mm_gc->regs;
573 u16 pin_mask; 582 unsigned long flags;
583 u16 pin_mask = 1 << (15 - gpio);
574 584
575 pin_mask = 1 << (15 - gpio); 585 spin_lock_irqsave(&cpm1_gc->lock, flags);
576 586
577 setbits16(&iop->dir, pin_mask); 587 setbits16(&iop->dir, pin_mask);
588 __cpm1_gpio16_set(mm_gc, pin_mask, val);
578 589
579 cpm1_gpio16_set(gc, gpio, val); 590 spin_unlock_irqrestore(&cpm1_gc->lock, flags);
580 591
581 return 0; 592 return 0;
582} 593}
@@ -584,13 +595,17 @@ static int cpm1_gpio16_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
584static int cpm1_gpio16_dir_in(struct gpio_chip *gc, unsigned int gpio) 595static int cpm1_gpio16_dir_in(struct gpio_chip *gc, unsigned int gpio)
585{ 596{
586 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 597 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
598 struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
587 struct cpm_ioport16 __iomem *iop = mm_gc->regs; 599 struct cpm_ioport16 __iomem *iop = mm_gc->regs;
588 u16 pin_mask; 600 unsigned long flags;
601 u16 pin_mask = 1 << (15 - gpio);
589 602
590 pin_mask = 1 << (15 - gpio); 603 spin_lock_irqsave(&cpm1_gc->lock, flags);
591 604
592 clrbits16(&iop->dir, pin_mask); 605 clrbits16(&iop->dir, pin_mask);
593 606
607 spin_unlock_irqrestore(&cpm1_gc->lock, flags);
608
594 return 0; 609 return 0;
595} 610}
596 611
@@ -655,15 +670,11 @@ static int cpm1_gpio32_get(struct gpio_chip *gc, unsigned int gpio)
655 return !!(in_be32(&iop->dat) & pin_mask); 670 return !!(in_be32(&iop->dat) & pin_mask);
656} 671}
657 672
658static void cpm1_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value) 673static void __cpm1_gpio32_set(struct of_mm_gpio_chip *mm_gc, u32 pin_mask,
674 int value)
659{ 675{
660 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
661 struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc); 676 struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc);
662 struct cpm_ioport32b __iomem *iop = mm_gc->regs; 677 struct cpm_ioport32b __iomem *iop = mm_gc->regs;
663 unsigned long flags;
664 u32 pin_mask = 1 << (31 - gpio);
665
666 spin_lock_irqsave(&cpm1_gc->lock, flags);
667 678
668 if (value) 679 if (value)
669 cpm1_gc->cpdata |= pin_mask; 680 cpm1_gc->cpdata |= pin_mask;
@@ -671,6 +682,18 @@ static void cpm1_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value)
671 cpm1_gc->cpdata &= ~pin_mask; 682 cpm1_gc->cpdata &= ~pin_mask;
672 683
673 out_be32(&iop->dat, cpm1_gc->cpdata); 684 out_be32(&iop->dat, cpm1_gc->cpdata);
685}
686
687static void cpm1_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value)
688{
689 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
690 struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc);
691 unsigned long flags;
692 u32 pin_mask = 1 << (31 - gpio);
693
694 spin_lock_irqsave(&cpm1_gc->lock, flags);
695
696 __cpm1_gpio32_set(mm_gc, pin_mask, value);
674 697
675 spin_unlock_irqrestore(&cpm1_gc->lock, flags); 698 spin_unlock_irqrestore(&cpm1_gc->lock, flags);
676} 699}
@@ -678,14 +701,17 @@ static void cpm1_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value)
678static int cpm1_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) 701static int cpm1_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
679{ 702{
680 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 703 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
704 struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc);
681 struct cpm_ioport32b __iomem *iop = mm_gc->regs; 705 struct cpm_ioport32b __iomem *iop = mm_gc->regs;
682 u32 pin_mask; 706 unsigned long flags;
707 u32 pin_mask = 1 << (31 - gpio);
683 708
684 pin_mask = 1 << (31 - gpio); 709 spin_lock_irqsave(&cpm1_gc->lock, flags);
685 710
686 setbits32(&iop->dir, pin_mask); 711 setbits32(&iop->dir, pin_mask);
712 __cpm1_gpio32_set(mm_gc, pin_mask, val);
687 713
688 cpm1_gpio32_set(gc, gpio, val); 714 spin_unlock_irqrestore(&cpm1_gc->lock, flags);
689 715
690 return 0; 716 return 0;
691} 717}
@@ -693,13 +719,17 @@ static int cpm1_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
693static int cpm1_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio) 719static int cpm1_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio)
694{ 720{
695 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 721 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
722 struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc);
696 struct cpm_ioport32b __iomem *iop = mm_gc->regs; 723 struct cpm_ioport32b __iomem *iop = mm_gc->regs;
697 u32 pin_mask; 724 unsigned long flags;
725 u32 pin_mask = 1 << (31 - gpio);
698 726
699 pin_mask = 1 << (31 - gpio); 727 spin_lock_irqsave(&cpm1_gc->lock, flags);
700 728
701 clrbits32(&iop->dir, pin_mask); 729 clrbits32(&iop->dir, pin_mask);
702 730
731 spin_unlock_irqrestore(&cpm1_gc->lock, flags);
732
703 return 0; 733 return 0;
704} 734}
705 735
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index 422c8faef593..0494ee55920f 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -11,14 +11,19 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#include <linux/init.h>
15#include <linux/module.h>
14#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/compiler.h>
18#include <linux/spinlock.h>
19#include <linux/types.h>
20#include <linux/io.h>
15#include <linux/of.h> 21#include <linux/of.h>
22#include <asm/prom.h>
16#include <asm/fsl_lbc.h> 23#include <asm/fsl_lbc.h>
17 24
18spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock); 25static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock);
19 26static struct fsl_lbc_regs __iomem *fsl_lbc_regs;
20struct fsl_lbc_regs __iomem *fsl_lbc_regs;
21EXPORT_SYMBOL(fsl_lbc_regs);
22 27
23static char __initdata *compat_lbc[] = { 28static char __initdata *compat_lbc[] = {
24 "fsl,pq2-localbus", 29 "fsl,pq2-localbus",
@@ -127,3 +132,43 @@ int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm)
127 return 0; 132 return 0;
128} 133}
129EXPORT_SYMBOL(fsl_upm_find); 134EXPORT_SYMBOL(fsl_upm_find);
135
136/**
137 * fsl_upm_run_pattern - actually run an UPM pattern
138 * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find
139 * @io_base: remapped pointer to where memory access should happen
140 * @mar: MAR register content during pattern execution
141 *
142 * This function triggers dummy write to the memory specified by the io_base,
143 * thus UPM pattern actually executed. Note that mar usage depends on the
144 * pre-programmed AMX bits in the UPM RAM.
145 */
146int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar)
147{
148 int ret = 0;
149 unsigned long flags;
150
151 spin_lock_irqsave(&fsl_lbc_lock, flags);
152
153 out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width));
154
155 switch (upm->width) {
156 case 8:
157 out_8(io_base, 0x0);
158 break;
159 case 16:
160 out_be16(io_base, 0x0);
161 break;
162 case 32:
163 out_be32(io_base, 0x0);
164 break;
165 default:
166 ret = -EINVAL;
167 break;
168 }
169
170 spin_unlock_irqrestore(&fsl_lbc_lock, flags);
171
172 return ret;
173}
174EXPORT_SYMBOL(fsl_upm_run_pattern);
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 2c5187cc8a24..f25ce818d40a 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -14,7 +14,6 @@
14 */ 14 */
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/bootmem.h> 16#include <linux/bootmem.h>
17#include <linux/bitmap.h>
18#include <linux/msi.h> 17#include <linux/msi.h>
19#include <linux/pci.h> 18#include <linux/pci.h>
20#include <linux/of_platform.h> 19#include <linux/of_platform.h>
@@ -67,95 +66,22 @@ static struct irq_host_ops fsl_msi_host_ops = {
67 .map = fsl_msi_host_map, 66 .map = fsl_msi_host_map,
68}; 67};
69 68
70static irq_hw_number_t fsl_msi_alloc_hwirqs(struct fsl_msi *msi, int num)
71{
72 unsigned long flags;
73 int order = get_count_order(num);
74 int offset;
75
76 spin_lock_irqsave(&msi->bitmap_lock, flags);
77
78 offset = bitmap_find_free_region(msi->fsl_msi_bitmap,
79 NR_MSI_IRQS, order);
80
81 spin_unlock_irqrestore(&msi->bitmap_lock, flags);
82
83 pr_debug("%s: allocated 0x%x (2^%d) at offset 0x%x\n",
84 __func__, num, order, offset);
85
86 return offset;
87}
88
89static void fsl_msi_free_hwirqs(struct fsl_msi *msi, int offset, int num)
90{
91 unsigned long flags;
92 int order = get_count_order(num);
93
94 pr_debug("%s: freeing 0x%x (2^%d) at offset 0x%x\n",
95 __func__, num, order, offset);
96
97 spin_lock_irqsave(&msi->bitmap_lock, flags);
98 bitmap_release_region(msi->fsl_msi_bitmap, offset, order);
99 spin_unlock_irqrestore(&msi->bitmap_lock, flags);
100}
101
102static int fsl_msi_free_dt_hwirqs(struct fsl_msi *msi)
103{
104 int i;
105 int len;
106 const u32 *p;
107
108 bitmap_allocate_region(msi->fsl_msi_bitmap, 0,
109 get_count_order(NR_MSI_IRQS));
110
111 p = of_get_property(msi->of_node, "msi-available-ranges", &len);
112
113 if (!p) {
114 /* No msi-available-ranges property,
115 * All the 256 MSI interrupts can be used
116 */
117 fsl_msi_free_hwirqs(msi, 0, 0x100);
118 return 0;
119 }
120
121 if ((len % (2 * sizeof(u32))) != 0) {
122 printk(KERN_WARNING "fsl_msi: Malformed msi-available-ranges "
123 "property on %s\n", msi->of_node->full_name);
124 return -EINVAL;
125 }
126
127 /* Format is: (<u32 start> <u32 count>)+ */
128 len /= 2 * sizeof(u32);
129 for (i = 0; i < len; i++, p += 2)
130 fsl_msi_free_hwirqs(msi, *p, *(p + 1));
131
132 return 0;
133}
134
135static int fsl_msi_init_allocator(struct fsl_msi *msi_data) 69static int fsl_msi_init_allocator(struct fsl_msi *msi_data)
136{ 70{
137 int rc; 71 int rc;
138 int size = BITS_TO_LONGS(NR_MSI_IRQS) * sizeof(u32);
139 72
140 msi_data->fsl_msi_bitmap = kzalloc(size, GFP_KERNEL); 73 rc = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS,
74 msi_data->irqhost->of_node);
75 if (rc)
76 return rc;
141 77
142 if (msi_data->fsl_msi_bitmap == NULL) { 78 rc = msi_bitmap_reserve_dt_hwirqs(&msi_data->bitmap);
143 pr_debug("%s: ENOMEM allocating allocator bitmap!\n", 79 if (rc < 0) {
144 __func__); 80 msi_bitmap_free(&msi_data->bitmap);
145 return -ENOMEM; 81 return rc;
146 } 82 }
147 83
148 rc = fsl_msi_free_dt_hwirqs(msi_data);
149 if (rc)
150 goto out_free;
151
152 return 0; 84 return 0;
153out_free:
154 kfree(msi_data->fsl_msi_bitmap);
155
156 msi_data->fsl_msi_bitmap = NULL;
157 return rc;
158
159} 85}
160 86
161static int fsl_msi_check_device(struct pci_dev *pdev, int nvec, int type) 87static int fsl_msi_check_device(struct pci_dev *pdev, int nvec, int type)
@@ -175,7 +101,8 @@ static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
175 if (entry->irq == NO_IRQ) 101 if (entry->irq == NO_IRQ)
176 continue; 102 continue;
177 set_irq_msi(entry->irq, NULL); 103 set_irq_msi(entry->irq, NULL);
178 fsl_msi_free_hwirqs(msi_data, virq_to_hw(entry->irq), 1); 104 msi_bitmap_free_hwirqs(&msi_data->bitmap,
105 virq_to_hw(entry->irq), 1);
179 irq_dispose_mapping(entry->irq); 106 irq_dispose_mapping(entry->irq);
180 } 107 }
181 108
@@ -197,15 +124,14 @@ static void fsl_compose_msi_msg(struct pci_dev *pdev, int hwirq,
197 124
198static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 125static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
199{ 126{
200 irq_hw_number_t hwirq; 127 int rc, hwirq;
201 int rc;
202 unsigned int virq; 128 unsigned int virq;
203 struct msi_desc *entry; 129 struct msi_desc *entry;
204 struct msi_msg msg; 130 struct msi_msg msg;
205 struct fsl_msi *msi_data = fsl_msi; 131 struct fsl_msi *msi_data = fsl_msi;
206 132
207 list_for_each_entry(entry, &pdev->msi_list, list) { 133 list_for_each_entry(entry, &pdev->msi_list, list) {
208 hwirq = fsl_msi_alloc_hwirqs(msi_data, 1); 134 hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
209 if (hwirq < 0) { 135 if (hwirq < 0) {
210 rc = hwirq; 136 rc = hwirq;
211 pr_debug("%s: fail allocating msi interrupt\n", 137 pr_debug("%s: fail allocating msi interrupt\n",
@@ -216,9 +142,9 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
216 virq = irq_create_mapping(msi_data->irqhost, hwirq); 142 virq = irq_create_mapping(msi_data->irqhost, hwirq);
217 143
218 if (virq == NO_IRQ) { 144 if (virq == NO_IRQ) {
219 pr_debug("%s: fail mapping hwirq 0x%lx\n", 145 pr_debug("%s: fail mapping hwirq 0x%x\n",
220 __func__, hwirq); 146 __func__, hwirq);
221 fsl_msi_free_hwirqs(msi_data, hwirq, 1); 147 msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1);
222 rc = -ENOSPC; 148 rc = -ENOSPC;
223 goto out_free; 149 goto out_free;
224 } 150 }
@@ -317,14 +243,11 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
317 goto error_out; 243 goto error_out;
318 } 244 }
319 245
320 msi->of_node = of_node_get(dev->node); 246 msi->irqhost = irq_alloc_host(dev->node, IRQ_HOST_MAP_LINEAR,
247 NR_MSI_IRQS, &fsl_msi_host_ops, 0);
321 248
322 msi->irqhost = irq_alloc_host(of_node_get(dev->node),
323 IRQ_HOST_MAP_LINEAR,
324 NR_MSI_IRQS, &fsl_msi_host_ops, 0);
325 if (msi->irqhost == NULL) { 249 if (msi->irqhost == NULL) {
326 dev_err(&dev->dev, "No memory for MSI irqhost\n"); 250 dev_err(&dev->dev, "No memory for MSI irqhost\n");
327 of_node_put(dev->node);
328 err = -ENOMEM; 251 err = -ENOMEM;
329 goto error_out; 252 goto error_out;
330 } 253 }
diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h
index a653468521fa..331c7e7025b7 100644
--- a/arch/powerpc/sysdev/fsl_msi.h
+++ b/arch/powerpc/sysdev/fsl_msi.h
@@ -13,6 +13,8 @@
13#ifndef _POWERPC_SYSDEV_FSL_MSI_H 13#ifndef _POWERPC_SYSDEV_FSL_MSI_H
14#define _POWERPC_SYSDEV_FSL_MSI_H 14#define _POWERPC_SYSDEV_FSL_MSI_H
15 15
16#include <asm/msi_bitmap.h>
17
16#define NR_MSI_REG 8 18#define NR_MSI_REG 8
17#define IRQS_PER_MSI_REG 32 19#define IRQS_PER_MSI_REG 32
18#define NR_MSI_IRQS (NR_MSI_REG * IRQS_PER_MSI_REG) 20#define NR_MSI_IRQS (NR_MSI_REG * IRQS_PER_MSI_REG)
@@ -22,9 +24,6 @@
22#define FSL_PIC_IP_IPIC 0x00000002 24#define FSL_PIC_IP_IPIC 0x00000002
23 25
24struct fsl_msi { 26struct fsl_msi {
25 /* Device node of the MSI interrupt*/
26 struct device_node *of_node;
27
28 struct irq_host *irqhost; 27 struct irq_host *irqhost;
29 28
30 unsigned long cascade_irq; 29 unsigned long cascade_irq;
@@ -34,8 +33,7 @@ struct fsl_msi {
34 void __iomem *msi_regs; 33 void __iomem *msi_regs;
35 u32 feature; 34 u32 feature;
36 35
37 unsigned long *fsl_msi_bitmap; 36 struct msi_bitmap bitmap;
38 spinlock_t bitmap_lock;
39}; 37};
40 38
41#endif /* _POWERPC_SYSDEV_FSL_MSI_H */ 39#endif /* _POWERPC_SYSDEV_FSL_MSI_H */
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 61e6d77efa4f..5b264eb4b1f7 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC85xx/86xx PCI/PCIE support routing. 2 * MPC83xx/85xx/86xx PCI/PCIE support routing.
3 * 3 *
4 * Copyright 2007 Freescale Semiconductor, Inc 4 * Copyright 2007,2008 Freescale Semiconductor, Inc
5 * 5 *
6 * Initial author: Xianghua Xiao <x.xiao@freescale.com> 6 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
7 * Recode: ZHANG WEI <wei.zhang@freescale.com> 7 * Recode: ZHANG WEI <wei.zhang@freescale.com>
@@ -251,20 +251,47 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header);
251DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header); 251DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header);
252#endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */ 252#endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */
253 253
254#if defined(CONFIG_PPC_83xx) 254#if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x)
255int __init mpc83xx_add_bridge(struct device_node *dev) 255int __init mpc83xx_add_bridge(struct device_node *dev)
256{ 256{
257 int len; 257 int len;
258 struct pci_controller *hose; 258 struct pci_controller *hose;
259 struct resource rsrc; 259 struct resource rsrc_reg;
260 struct resource rsrc_cfg;
260 const int *bus_range; 261 const int *bus_range;
261 int primary = 1, has_address = 0; 262 int primary;
262 phys_addr_t immr = get_immrbase();
263 263
264 pr_debug("Adding PCI host bridge %s\n", dev->full_name); 264 pr_debug("Adding PCI host bridge %s\n", dev->full_name);
265 265
266 /* Fetch host bridge registers address */ 266 /* Fetch host bridge registers address */
267 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 267 if (of_address_to_resource(dev, 0, &rsrc_reg)) {
268 printk(KERN_WARNING "Can't get pci register base!\n");
269 return -ENOMEM;
270 }
271
272 memset(&rsrc_cfg, 0, sizeof(rsrc_cfg));
273
274 if (of_address_to_resource(dev, 1, &rsrc_cfg)) {
275 printk(KERN_WARNING
276 "No pci config register base in dev tree, "
277 "using default\n");
278 /*
279 * MPC83xx supports up to two host controllers
280 * one at 0x8500 has config space registers at 0x8300
281 * one at 0x8600 has config space registers at 0x8380
282 */
283 if ((rsrc_reg.start & 0xfffff) == 0x8500)
284 rsrc_cfg.start = (rsrc_reg.start & 0xfff00000) + 0x8300;
285 else if ((rsrc_reg.start & 0xfffff) == 0x8600)
286 rsrc_cfg.start = (rsrc_reg.start & 0xfff00000) + 0x8380;
287 }
288 /*
289 * Controller at offset 0x8500 is primary
290 */
291 if ((rsrc_reg.start & 0xfffff) == 0x8500)
292 primary = 1;
293 else
294 primary = 0;
268 295
269 /* Get bus range if any */ 296 /* Get bus range if any */
270 bus_range = of_get_property(dev, "bus-range", &len); 297 bus_range = of_get_property(dev, "bus-range", &len);
@@ -281,22 +308,11 @@ int __init mpc83xx_add_bridge(struct device_node *dev)
281 hose->first_busno = bus_range ? bus_range[0] : 0; 308 hose->first_busno = bus_range ? bus_range[0] : 0;
282 hose->last_busno = bus_range ? bus_range[1] : 0xff; 309 hose->last_busno = bus_range ? bus_range[1] : 0xff;
283 310
284 /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar 311 setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 4, 0);
285 * the other at 0x8600, we consider the 0x8500 the primary controller
286 */
287 /* PCI 1 */
288 if ((rsrc.start & 0xfffff) == 0x8500) {
289 setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0);
290 }
291 /* PCI 2 */
292 if ((rsrc.start & 0xfffff) == 0x8600) {
293 setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0);
294 primary = 0;
295 }
296 312
297 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. " 313 printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx. "
298 "Firmware bus number: %d->%d\n", 314 "Firmware bus number: %d->%d\n",
299 (unsigned long long)rsrc.start, hose->first_busno, 315 (unsigned long long)rsrc_reg.start, hose->first_busno,
300 hose->last_busno); 316 hose->last_busno);
301 317
302 pr_debug(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", 318 pr_debug(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 214388e11807..01b884b25696 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -412,53 +412,6 @@ err:
412 412
413arch_initcall(gfar_of_init); 413arch_initcall(gfar_of_init);
414 414
415
416#ifdef CONFIG_PPC_83xx
417static int __init mpc83xx_wdt_init(void)
418{
419 struct resource r;
420 struct device_node *np;
421 struct platform_device *dev;
422 u32 freq = fsl_get_sys_freq();
423 int ret;
424
425 np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
426
427 if (!np) {
428 ret = -ENODEV;
429 goto nodev;
430 }
431
432 memset(&r, 0, sizeof(r));
433
434 ret = of_address_to_resource(np, 0, &r);
435 if (ret)
436 goto err;
437
438 dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
439 if (IS_ERR(dev)) {
440 ret = PTR_ERR(dev);
441 goto err;
442 }
443
444 ret = platform_device_add_data(dev, &freq, sizeof(freq));
445 if (ret)
446 goto unreg;
447
448 of_node_put(np);
449 return 0;
450
451unreg:
452 platform_device_unregister(dev);
453err:
454 of_node_put(np);
455nodev:
456 return ret;
457}
458
459arch_initcall(mpc83xx_wdt_init);
460#endif
461
462static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type) 415static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
463{ 416{
464 if (!phy_type) 417 if (!phy_type)
@@ -767,42 +720,6 @@ void fsl_rstcr_restart(char *cmd)
767#endif 720#endif
768 721
769#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 722#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
770struct platform_diu_data_ops diu_ops = { 723struct platform_diu_data_ops diu_ops;
771 .diu_size = 1280 * 1024 * 4, /* default one 1280x1024 buffer */
772};
773EXPORT_SYMBOL(diu_ops); 724EXPORT_SYMBOL(diu_ops);
774
775int __init preallocate_diu_videomemory(void)
776{
777 pr_debug("diu_size=%lu\n", diu_ops.diu_size);
778
779 diu_ops.diu_mem = __alloc_bootmem(diu_ops.diu_size, 8, 0);
780 if (!diu_ops.diu_mem) {
781 printk(KERN_ERR "fsl-diu: cannot allocate %lu bytes\n",
782 diu_ops.diu_size);
783 return -ENOMEM;
784 }
785
786 pr_debug("diu_mem=%p\n", diu_ops.diu_mem);
787
788 rh_init(&diu_ops.diu_rh_info, 4096, ARRAY_SIZE(diu_ops.diu_rh_block),
789 diu_ops.diu_rh_block);
790 return rh_attach_region(&diu_ops.diu_rh_info,
791 (unsigned long) diu_ops.diu_mem,
792 diu_ops.diu_size);
793}
794
795static int __init early_parse_diufb(char *p)
796{
797 if (!p)
798 return 1;
799
800 diu_ops.diu_size = _ALIGN_UP(memparse(p, &p), 8);
801
802 pr_debug("diu_size=%lu\n", diu_ops.diu_size);
803
804 return 0;
805}
806early_param("diufb", early_parse_diufb);
807
808#endif 725#endif
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 024299887352..60f7f227327c 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -20,14 +20,7 @@ extern int fsl_spi_init(struct spi_board_info *board_infos,
20extern void fsl_rstcr_restart(char *cmd); 20extern void fsl_rstcr_restart(char *cmd);
21 21
22#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 22#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
23#include <linux/bootmem.h>
24#include <asm/rheap.h>
25struct platform_diu_data_ops { 23struct platform_diu_data_ops {
26 rh_block_t diu_rh_block[16];
27 rh_info_t diu_rh_info;
28 unsigned long diu_size;
29 void *diu_mem;
30
31 unsigned int (*get_pixel_format) (unsigned int bits_per_pixel, 24 unsigned int (*get_pixel_format) (unsigned int bits_per_pixel,
32 int monitor_port); 25 int monitor_port);
33 void (*set_gamma_table) (int monitor_port, char *gamma_table_base); 26 void (*set_gamma_table) (int monitor_port, char *gamma_table_base);
@@ -38,7 +31,6 @@ struct platform_diu_data_ops {
38}; 31};
39 32
40extern struct platform_diu_data_ops diu_ops; 33extern struct platform_diu_data_ops diu_ops;
41int __init preallocate_diu_videomemory(void);
42#endif 34#endif
43 35
44#endif 36#endif
diff --git a/arch/powerpc/sysdev/mpc8xxx_gpio.c b/arch/powerpc/sysdev/mpc8xxx_gpio.c
new file mode 100644
index 000000000000..103eace36194
--- /dev/null
+++ b/arch/powerpc/sysdev/mpc8xxx_gpio.c
@@ -0,0 +1,171 @@
1/*
2 * GPIOs on MPC8349/8572/8610 and compatible
3 *
4 * Copyright (C) 2008 Peter Korsgaard <jacmet@sunsite.dk>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/spinlock.h>
14#include <linux/io.h>
15#include <linux/of.h>
16#include <linux/of_gpio.h>
17#include <linux/gpio.h>
18
19#define MPC8XXX_GPIO_PINS 32
20
21#define GPIO_DIR 0x00
22#define GPIO_ODR 0x04
23#define GPIO_DAT 0x08
24#define GPIO_IER 0x0c
25#define GPIO_IMR 0x10
26#define GPIO_ICR 0x14
27
28struct mpc8xxx_gpio_chip {
29 struct of_mm_gpio_chip mm_gc;
30 spinlock_t lock;
31
32 /*
33 * shadowed data register to be able to clear/set output pins in
34 * open drain mode safely
35 */
36 u32 data;
37};
38
39static inline u32 mpc8xxx_gpio2mask(unsigned int gpio)
40{
41 return 1u << (MPC8XXX_GPIO_PINS - 1 - gpio);
42}
43
44static inline struct mpc8xxx_gpio_chip *
45to_mpc8xxx_gpio_chip(struct of_mm_gpio_chip *mm)
46{
47 return container_of(mm, struct mpc8xxx_gpio_chip, mm_gc);
48}
49
50static void mpc8xxx_gpio_save_regs(struct of_mm_gpio_chip *mm)
51{
52 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
53
54 mpc8xxx_gc->data = in_be32(mm->regs + GPIO_DAT);
55}
56
57static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio)
58{
59 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
60
61 return in_be32(mm->regs + GPIO_DAT) & mpc8xxx_gpio2mask(gpio);
62}
63
64static void mpc8xxx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
65{
66 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
67 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
68 unsigned long flags;
69
70 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
71
72 if (val)
73 mpc8xxx_gc->data |= mpc8xxx_gpio2mask(gpio);
74 else
75 mpc8xxx_gc->data &= ~mpc8xxx_gpio2mask(gpio);
76
77 out_be32(mm->regs + GPIO_DAT, mpc8xxx_gc->data);
78
79 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
80}
81
82static int mpc8xxx_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
83{
84 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
85 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
86 unsigned long flags;
87
88 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
89
90 clrbits32(mm->regs + GPIO_DIR, mpc8xxx_gpio2mask(gpio));
91
92 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
93
94 return 0;
95}
96
97static int mpc8xxx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
98{
99 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
100 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
101 unsigned long flags;
102
103 mpc8xxx_gpio_set(gc, gpio, val);
104
105 spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
106
107 setbits32(mm->regs + GPIO_DIR, mpc8xxx_gpio2mask(gpio));
108
109 spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
110
111 return 0;
112}
113
114static void __init mpc8xxx_add_controller(struct device_node *np)
115{
116 struct mpc8xxx_gpio_chip *mpc8xxx_gc;
117 struct of_mm_gpio_chip *mm_gc;
118 struct of_gpio_chip *of_gc;
119 struct gpio_chip *gc;
120 int ret;
121
122 mpc8xxx_gc = kzalloc(sizeof(*mpc8xxx_gc), GFP_KERNEL);
123 if (!mpc8xxx_gc) {
124 ret = -ENOMEM;
125 goto err;
126 }
127
128 spin_lock_init(&mpc8xxx_gc->lock);
129
130 mm_gc = &mpc8xxx_gc->mm_gc;
131 of_gc = &mm_gc->of_gc;
132 gc = &of_gc->gc;
133
134 mm_gc->save_regs = mpc8xxx_gpio_save_regs;
135 of_gc->gpio_cells = 2;
136 gc->ngpio = MPC8XXX_GPIO_PINS;
137 gc->direction_input = mpc8xxx_gpio_dir_in;
138 gc->direction_output = mpc8xxx_gpio_dir_out;
139 gc->get = mpc8xxx_gpio_get;
140 gc->set = mpc8xxx_gpio_set;
141
142 ret = of_mm_gpiochip_add(np, mm_gc);
143 if (ret)
144 goto err;
145
146 return;
147
148err:
149 pr_err("%s: registration failed with status %d\n",
150 np->full_name, ret);
151 kfree(mpc8xxx_gc);
152
153 return;
154}
155
156static int __init mpc8xxx_add_gpiochips(void)
157{
158 struct device_node *np;
159
160 for_each_compatible_node(np, NULL, "fsl,mpc8349-gpio")
161 mpc8xxx_add_controller(np);
162
163 for_each_compatible_node(np, NULL, "fsl,mpc8572-gpio")
164 mpc8xxx_add_controller(np);
165
166 for_each_compatible_node(np, NULL, "fsl,mpc8610-gpio")
167 mpc8xxx_add_controller(np);
168
169 return 0;
170}
171arch_initcall(mpc8xxx_add_gpiochips);
diff --git a/arch/powerpc/sysdev/mpic.h b/arch/powerpc/sysdev/mpic.h
index fbf8a266941c..6209c62a426d 100644
--- a/arch/powerpc/sysdev/mpic.h
+++ b/arch/powerpc/sysdev/mpic.h
@@ -14,8 +14,6 @@
14#ifdef CONFIG_PCI_MSI 14#ifdef CONFIG_PCI_MSI
15extern void mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq); 15extern void mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq);
16extern int mpic_msi_init_allocator(struct mpic *mpic); 16extern int mpic_msi_init_allocator(struct mpic *mpic);
17extern irq_hw_number_t mpic_msi_alloc_hwirqs(struct mpic *mpic, int num);
18extern void mpic_msi_free_hwirqs(struct mpic *mpic, int offset, int num);
19extern int mpic_u3msi_init(struct mpic *mpic); 17extern int mpic_u3msi_init(struct mpic *mpic);
20extern int mpic_pasemi_msi_init(struct mpic *mpic); 18extern int mpic_pasemi_msi_init(struct mpic *mpic);
21#else 19#else
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index de3e5e8bc324..1d44eee80fa1 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -15,59 +15,17 @@
15#include <asm/prom.h> 15#include <asm/prom.h>
16#include <asm/hw_irq.h> 16#include <asm/hw_irq.h>
17#include <asm/ppc-pci.h> 17#include <asm/ppc-pci.h>
18#include <asm/msi_bitmap.h>
18 19
19#include <sysdev/mpic.h> 20#include <sysdev/mpic.h>
20 21
21static void __mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq)
22{
23 pr_debug("mpic: reserving hwirq 0x%lx\n", hwirq);
24 bitmap_allocate_region(mpic->hwirq_bitmap, hwirq, 0);
25}
26
27void mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq) 22void mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq)
28{ 23{
29 unsigned long flags;
30
31 /* The mpic calls this even when there is no allocator setup */ 24 /* The mpic calls this even when there is no allocator setup */
32 if (!mpic->hwirq_bitmap) 25 if (!mpic->msi_bitmap.bitmap)
33 return; 26 return;
34 27
35 spin_lock_irqsave(&mpic->bitmap_lock, flags); 28 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq);
36 __mpic_msi_reserve_hwirq(mpic, hwirq);
37 spin_unlock_irqrestore(&mpic->bitmap_lock, flags);
38}
39
40irq_hw_number_t mpic_msi_alloc_hwirqs(struct mpic *mpic, int num)
41{
42 unsigned long flags;
43 int offset, order = get_count_order(num);
44
45 spin_lock_irqsave(&mpic->bitmap_lock, flags);
46 /*
47 * This is fast, but stricter than we need. We might want to add
48 * a fallback routine which does a linear search with no alignment.
49 */
50 offset = bitmap_find_free_region(mpic->hwirq_bitmap, mpic->irq_count,
51 order);
52 spin_unlock_irqrestore(&mpic->bitmap_lock, flags);
53
54 pr_debug("mpic: allocated 0x%x (2^%d) at offset 0x%x\n",
55 num, order, offset);
56
57 return offset;
58}
59
60void mpic_msi_free_hwirqs(struct mpic *mpic, int offset, int num)
61{
62 unsigned long flags;
63 int order = get_count_order(num);
64
65 pr_debug("mpic: freeing 0x%x (2^%d) at offset 0x%x\n",
66 num, order, offset);
67
68 spin_lock_irqsave(&mpic->bitmap_lock, flags);
69 bitmap_release_region(mpic->hwirq_bitmap, offset, order);
70 spin_unlock_irqrestore(&mpic->bitmap_lock, flags);
71} 29}
72 30
73#ifdef CONFIG_MPIC_U3_HT_IRQS 31#ifdef CONFIG_MPIC_U3_HT_IRQS
@@ -83,13 +41,13 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
83 41
84 /* Reserve source numbers we know are reserved in the HW */ 42 /* Reserve source numbers we know are reserved in the HW */
85 for (i = 0; i < 8; i++) 43 for (i = 0; i < 8; i++)
86 __mpic_msi_reserve_hwirq(mpic, i); 44 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
87 45
88 for (i = 42; i < 46; i++) 46 for (i = 42; i < 46; i++)
89 __mpic_msi_reserve_hwirq(mpic, i); 47 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
90 48
91 for (i = 100; i < 105; i++) 49 for (i = 100; i < 105; i++)
92 __mpic_msi_reserve_hwirq(mpic, i); 50 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
93 51
94 np = NULL; 52 np = NULL;
95 while ((np = of_find_all_nodes(np))) { 53 while ((np = of_find_all_nodes(np))) {
@@ -99,7 +57,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
99 while (of_irq_map_one(np, index++, &oirq) == 0) { 57 while (of_irq_map_one(np, index++, &oirq) == 0) {
100 ops->xlate(mpic->irqhost, NULL, oirq.specifier, 58 ops->xlate(mpic->irqhost, NULL, oirq.specifier,
101 oirq.size, &hwirq, &flags); 59 oirq.size, &hwirq, &flags);
102 __mpic_msi_reserve_hwirq(mpic, hwirq); 60 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq);
103 } 61 }
104 } 62 }
105 63
@@ -112,70 +70,25 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
112} 70}
113#endif 71#endif
114 72
115static int mpic_msi_reserve_dt_hwirqs(struct mpic *mpic)
116{
117 int i, len;
118 const u32 *p;
119
120 p = of_get_property(mpic->irqhost->of_node,
121 "msi-available-ranges", &len);
122 if (!p) {
123 pr_debug("mpic: no msi-available-ranges property found on %s\n",
124 mpic->irqhost->of_node->full_name);
125 return -ENODEV;
126 }
127
128 if (len % 8 != 0) {
129 printk(KERN_WARNING "mpic: Malformed msi-available-ranges "
130 "property on %s\n", mpic->irqhost->of_node->full_name);
131 return -EINVAL;
132 }
133
134 bitmap_allocate_region(mpic->hwirq_bitmap, 0,
135 get_count_order(mpic->irq_count));
136
137 /* Format is: (<u32 start> <u32 count>)+ */
138 len /= sizeof(u32);
139 for (i = 0; i < len / 2; i++, p += 2)
140 mpic_msi_free_hwirqs(mpic, *p, *(p + 1));
141
142 return 0;
143}
144
145int mpic_msi_init_allocator(struct mpic *mpic) 73int mpic_msi_init_allocator(struct mpic *mpic)
146{ 74{
147 int rc, size; 75 int rc;
148
149 BUG_ON(mpic->hwirq_bitmap);
150 spin_lock_init(&mpic->bitmap_lock);
151 76
152 size = BITS_TO_LONGS(mpic->irq_count) * sizeof(long); 77 rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->irq_count,
153 pr_debug("mpic: allocator bitmap size is 0x%x bytes\n", size); 78 mpic->irqhost->of_node);
79 if (rc)
80 return rc;
154 81
155 mpic->hwirq_bitmap = alloc_maybe_bootmem(size, GFP_KERNEL); 82 rc = msi_bitmap_reserve_dt_hwirqs(&mpic->msi_bitmap);
156 83 if (rc > 0) {
157 if (!mpic->hwirq_bitmap) {
158 pr_debug("mpic: ENOMEM allocating allocator bitmap!\n");
159 return -ENOMEM;
160 }
161
162 memset(mpic->hwirq_bitmap, 0, size);
163
164 rc = mpic_msi_reserve_dt_hwirqs(mpic);
165 if (rc) {
166 if (mpic->flags & MPIC_U3_HT_IRQS) 84 if (mpic->flags & MPIC_U3_HT_IRQS)
167 rc = mpic_msi_reserve_u3_hwirqs(mpic); 85 rc = mpic_msi_reserve_u3_hwirqs(mpic);
168 86
169 if (rc) 87 if (rc) {
170 goto out_free; 88 msi_bitmap_free(&mpic->msi_bitmap);
89 return rc;
90 }
171 } 91 }
172 92
173 return 0; 93 return 0;
174
175 out_free:
176 if (mem_init_done)
177 kfree(mpic->hwirq_bitmap);
178
179 mpic->hwirq_bitmap = NULL;
180 return rc;
181} 94}
diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c
index 68aff6076675..656cb772b691 100644
--- a/arch/powerpc/sysdev/mpic_pasemi_msi.c
+++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c
@@ -22,6 +22,7 @@
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/hw_irq.h> 23#include <asm/hw_irq.h>
24#include <asm/ppc-pci.h> 24#include <asm/ppc-pci.h>
25#include <asm/msi_bitmap.h>
25 26
26#include "mpic.h" 27#include "mpic.h"
27 28
@@ -81,8 +82,8 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
81 continue; 82 continue;
82 83
83 set_irq_msi(entry->irq, NULL); 84 set_irq_msi(entry->irq, NULL);
84 mpic_msi_free_hwirqs(msi_mpic, virq_to_hw(entry->irq), 85 msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap,
85 ALLOC_CHUNK); 86 virq_to_hw(entry->irq), ALLOC_CHUNK);
86 irq_dispose_mapping(entry->irq); 87 irq_dispose_mapping(entry->irq);
87 } 88 }
88 89
@@ -91,11 +92,10 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
91 92
92static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 93static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
93{ 94{
94 irq_hw_number_t hwirq;
95 unsigned int virq; 95 unsigned int virq;
96 struct msi_desc *entry; 96 struct msi_desc *entry;
97 struct msi_msg msg; 97 struct msi_msg msg;
98 int ret; 98 int hwirq;
99 99
100 pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n", 100 pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n",
101 pdev, nvec, type); 101 pdev, nvec, type);
@@ -109,17 +109,19 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
109 * few MSIs for someone, but restrictions will apply to how the 109 * few MSIs for someone, but restrictions will apply to how the
110 * sources can be changed independently. 110 * sources can be changed independently.
111 */ 111 */
112 ret = mpic_msi_alloc_hwirqs(msi_mpic, ALLOC_CHUNK); 112 hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap,
113 hwirq = ret; 113 ALLOC_CHUNK);
114 if (ret < 0) { 114 if (hwirq < 0) {
115 pr_debug("pasemi_msi: failed allocating hwirq\n"); 115 pr_debug("pasemi_msi: failed allocating hwirq\n");
116 return hwirq; 116 return hwirq;
117 } 117 }
118 118
119 virq = irq_create_mapping(msi_mpic->irqhost, hwirq); 119 virq = irq_create_mapping(msi_mpic->irqhost, hwirq);
120 if (virq == NO_IRQ) { 120 if (virq == NO_IRQ) {
121 pr_debug("pasemi_msi: failed mapping hwirq 0x%lx\n", hwirq); 121 pr_debug("pasemi_msi: failed mapping hwirq 0x%x\n",
122 mpic_msi_free_hwirqs(msi_mpic, hwirq, ALLOC_CHUNK); 122 hwirq);
123 msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq,
124 ALLOC_CHUNK);
123 return -ENOSPC; 125 return -ENOSPC;
124 } 126 }
125 127
@@ -133,8 +135,8 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
133 set_irq_chip(virq, &mpic_pasemi_msi_chip); 135 set_irq_chip(virq, &mpic_pasemi_msi_chip);
134 set_irq_type(virq, IRQ_TYPE_EDGE_RISING); 136 set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
135 137
136 pr_debug("pasemi_msi: allocated virq 0x%x (hw 0x%lx) addr 0x%x\n", 138 pr_debug("pasemi_msi: allocated virq 0x%x (hw 0x%x) " \
137 virq, hwirq, msg.address_lo); 139 "addr 0x%x\n", virq, hwirq, msg.address_lo);
138 140
139 /* Likewise, the device writes [0...511] into the target 141 /* Likewise, the device writes [0...511] into the target
140 * register to generate MSI [512...1023] 142 * register to generate MSI [512...1023]
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 6e2f8686fdfc..0a8f5a9e87c9 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -16,6 +16,7 @@
16#include <asm/prom.h> 16#include <asm/prom.h>
17#include <asm/hw_irq.h> 17#include <asm/hw_irq.h>
18#include <asm/ppc-pci.h> 18#include <asm/ppc-pci.h>
19#include <asm/msi_bitmap.h>
19 20
20#include "mpic.h" 21#include "mpic.h"
21 22
@@ -101,7 +102,8 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
101 continue; 102 continue;
102 103
103 set_irq_msi(entry->irq, NULL); 104 set_irq_msi(entry->irq, NULL);
104 mpic_msi_free_hwirqs(msi_mpic, virq_to_hw(entry->irq), 1); 105 msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap,
106 virq_to_hw(entry->irq), 1);
105 irq_dispose_mapping(entry->irq); 107 irq_dispose_mapping(entry->irq);
106 } 108 }
107 109
@@ -110,29 +112,27 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
110 112
111static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 113static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
112{ 114{
113 irq_hw_number_t hwirq;
114 unsigned int virq; 115 unsigned int virq;
115 struct msi_desc *entry; 116 struct msi_desc *entry;
116 struct msi_msg msg; 117 struct msi_msg msg;
117 u64 addr; 118 u64 addr;
118 int ret; 119 int hwirq;
119 120
120 addr = find_ht_magic_addr(pdev); 121 addr = find_ht_magic_addr(pdev);
121 msg.address_lo = addr & 0xFFFFFFFF; 122 msg.address_lo = addr & 0xFFFFFFFF;
122 msg.address_hi = addr >> 32; 123 msg.address_hi = addr >> 32;
123 124
124 list_for_each_entry(entry, &pdev->msi_list, list) { 125 list_for_each_entry(entry, &pdev->msi_list, list) {
125 ret = mpic_msi_alloc_hwirqs(msi_mpic, 1); 126 hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1);
126 if (ret < 0) { 127 if (hwirq < 0) {
127 pr_debug("u3msi: failed allocating hwirq\n"); 128 pr_debug("u3msi: failed allocating hwirq\n");
128 return ret; 129 return hwirq;
129 } 130 }
130 hwirq = ret;
131 131
132 virq = irq_create_mapping(msi_mpic->irqhost, hwirq); 132 virq = irq_create_mapping(msi_mpic->irqhost, hwirq);
133 if (virq == NO_IRQ) { 133 if (virq == NO_IRQ) {
134 pr_debug("u3msi: failed mapping hwirq 0x%lx\n", hwirq); 134 pr_debug("u3msi: failed mapping hwirq 0x%x\n", hwirq);
135 mpic_msi_free_hwirqs(msi_mpic, hwirq, 1); 135 msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq, 1);
136 return -ENOSPC; 136 return -ENOSPC;
137 } 137 }
138 138
@@ -140,8 +140,8 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
140 set_irq_chip(virq, &mpic_u3msi_chip); 140 set_irq_chip(virq, &mpic_u3msi_chip);
141 set_irq_type(virq, IRQ_TYPE_EDGE_RISING); 141 set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
142 142
143 pr_debug("u3msi: allocated virq 0x%x (hw 0x%lx) addr 0x%lx\n", 143 pr_debug("u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n",
144 virq, hwirq, addr); 144 virq, hwirq, (unsigned long)addr);
145 145
146 msg.data = hwirq; 146 msg.data = hwirq;
147 write_msi_msg(virq, &msg); 147 write_msi_msg(virq, &msg);
diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c
new file mode 100644
index 000000000000..f84217b8863a
--- /dev/null
+++ b/arch/powerpc/sysdev/msi_bitmap.c
@@ -0,0 +1,247 @@
1/*
2 * Copyright 2006-2008, Michael Ellerman, IBM Corporation.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; version 2 of the
7 * License.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/bitmap.h>
13#include <asm/msi_bitmap.h>
14
15int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num)
16{
17 unsigned long flags;
18 int offset, order = get_count_order(num);
19
20 spin_lock_irqsave(&bmp->lock, flags);
21 /*
22 * This is fast, but stricter than we need. We might want to add
23 * a fallback routine which does a linear search with no alignment.
24 */
25 offset = bitmap_find_free_region(bmp->bitmap, bmp->irq_count, order);
26 spin_unlock_irqrestore(&bmp->lock, flags);
27
28 pr_debug("msi_bitmap: allocated 0x%x (2^%d) at offset 0x%x\n",
29 num, order, offset);
30
31 return offset;
32}
33
34void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset,
35 unsigned int num)
36{
37 unsigned long flags;
38 int order = get_count_order(num);
39
40 pr_debug("msi_bitmap: freeing 0x%x (2^%d) at offset 0x%x\n",
41 num, order, offset);
42
43 spin_lock_irqsave(&bmp->lock, flags);
44 bitmap_release_region(bmp->bitmap, offset, order);
45 spin_unlock_irqrestore(&bmp->lock, flags);
46}
47
48void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq)
49{
50 unsigned long flags;
51
52 pr_debug("msi_bitmap: reserving hwirq 0x%x\n", hwirq);
53
54 spin_lock_irqsave(&bmp->lock, flags);
55 bitmap_allocate_region(bmp->bitmap, hwirq, 0);
56 spin_unlock_irqrestore(&bmp->lock, flags);
57}
58
59/**
60 * msi_bitmap_reserve_dt_hwirqs - Reserve irqs specified in the device tree.
61 * @bmp: pointer to the MSI bitmap.
62 *
63 * Looks in the device tree to see if there is a property specifying which
64 * irqs can be used for MSI. If found those irqs reserved in the device tree
65 * are reserved in the bitmap.
66 *
67 * Returns 0 for success, < 0 if there was an error, and > 0 if no property
68 * was found in the device tree.
69 **/
70int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp)
71{
72 int i, j, len;
73 const u32 *p;
74
75 if (!bmp->of_node)
76 return 1;
77
78 p = of_get_property(bmp->of_node, "msi-available-ranges", &len);
79 if (!p) {
80 pr_debug("msi_bitmap: no msi-available-ranges property " \
81 "found on %s\n", bmp->of_node->full_name);
82 return 1;
83 }
84
85 if (len % (2 * sizeof(u32)) != 0) {
86 printk(KERN_WARNING "msi_bitmap: Malformed msi-available-ranges"
87 " property on %s\n", bmp->of_node->full_name);
88 return -EINVAL;
89 }
90
91 bitmap_allocate_region(bmp->bitmap, 0, get_count_order(bmp->irq_count));
92
93 spin_lock(&bmp->lock);
94
95 /* Format is: (<u32 start> <u32 count>)+ */
96 len /= 2 * sizeof(u32);
97 for (i = 0; i < len; i++, p += 2) {
98 for (j = 0; j < *(p + 1); j++)
99 bitmap_release_region(bmp->bitmap, *p + j, 0);
100 }
101
102 spin_unlock(&bmp->lock);
103
104 return 0;
105}
106
107int msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
108 struct device_node *of_node)
109{
110 int size;
111
112 if (!irq_count)
113 return -EINVAL;
114
115 size = BITS_TO_LONGS(irq_count) * sizeof(long);
116 pr_debug("msi_bitmap: allocator bitmap size is 0x%x bytes\n", size);
117
118 bmp->bitmap = zalloc_maybe_bootmem(size, GFP_KERNEL);
119 if (!bmp->bitmap) {
120 pr_debug("msi_bitmap: ENOMEM allocating allocator bitmap!\n");
121 return -ENOMEM;
122 }
123
124 /* We zalloc'ed the bitmap, so all irqs are free by default */
125 spin_lock_init(&bmp->lock);
126 bmp->of_node = of_node_get(of_node);
127 bmp->irq_count = irq_count;
128
129 return 0;
130}
131
132void msi_bitmap_free(struct msi_bitmap *bmp)
133{
134 /* we can't free the bitmap we don't know if it's bootmem etc. */
135 of_node_put(bmp->of_node);
136 bmp->bitmap = NULL;
137}
138
139#ifdef CONFIG_MSI_BITMAP_SELFTEST
140
141#define check(x) \
142 if (!(x)) printk("msi_bitmap: test failed at line %d\n", __LINE__);
143
144void test_basics(void)
145{
146 struct msi_bitmap bmp;
147 int i, size = 512;
148
149 /* Can't allocate a bitmap of 0 irqs */
150 check(msi_bitmap_alloc(&bmp, 0, NULL) != 0);
151
152 /* of_node may be NULL */
153 check(0 == msi_bitmap_alloc(&bmp, size, NULL));
154
155 /* Should all be free by default */
156 check(0 == bitmap_find_free_region(bmp.bitmap, size,
157 get_count_order(size)));
158 bitmap_release_region(bmp.bitmap, 0, get_count_order(size));
159
160 /* With no node, there's no msi-available-ranges, so expect > 0 */
161 check(msi_bitmap_reserve_dt_hwirqs(&bmp) > 0);
162
163 /* Should all still be free */
164 check(0 == bitmap_find_free_region(bmp.bitmap, size,
165 get_count_order(size)));
166 bitmap_release_region(bmp.bitmap, 0, get_count_order(size));
167
168 /* Check we can fill it up and then no more */
169 for (i = 0; i < size; i++)
170 check(msi_bitmap_alloc_hwirqs(&bmp, 1) >= 0);
171
172 check(msi_bitmap_alloc_hwirqs(&bmp, 1) < 0);
173
174 /* Should all be allocated */
175 check(bitmap_find_free_region(bmp.bitmap, size, 0) < 0);
176
177 /* And if we free one we can then allocate another */
178 msi_bitmap_free_hwirqs(&bmp, size / 2, 1);
179 check(msi_bitmap_alloc_hwirqs(&bmp, 1) == size / 2);
180
181 msi_bitmap_free(&bmp);
182
183 /* Clients may check bitmap == NULL for "not-allocated" */
184 check(bmp.bitmap == NULL);
185
186 kfree(bmp.bitmap);
187}
188
189void test_of_node(void)
190{
191 u32 prop_data[] = { 10, 10, 25, 3, 40, 1, 100, 100, 200, 20 };
192 const char *expected_str = "0-9,20-24,28-39,41-99,220-255";
193 char *prop_name = "msi-available-ranges";
194 char *node_name = "/fakenode";
195 struct device_node of_node;
196 struct property prop;
197 struct msi_bitmap bmp;
198 int size = 256;
199 DECLARE_BITMAP(expected, size);
200
201 /* There should really be a struct device_node allocator */
202 memset(&of_node, 0, sizeof(of_node));
203 kref_init(&of_node.kref);
204 of_node.full_name = node_name;
205
206 check(0 == msi_bitmap_alloc(&bmp, size, &of_node));
207
208 /* No msi-available-ranges, so expect > 0 */
209 check(msi_bitmap_reserve_dt_hwirqs(&bmp) > 0);
210
211 /* Should all still be free */
212 check(0 == bitmap_find_free_region(bmp.bitmap, size,
213 get_count_order(size)));
214 bitmap_release_region(bmp.bitmap, 0, get_count_order(size));
215
216 /* Now create a fake msi-available-ranges property */
217
218 /* There should really .. oh whatever */
219 memset(&prop, 0, sizeof(prop));
220 prop.name = prop_name;
221 prop.value = &prop_data;
222 prop.length = sizeof(prop_data);
223
224 of_node.properties = &prop;
225
226 /* msi-available-ranges, so expect == 0 */
227 check(msi_bitmap_reserve_dt_hwirqs(&bmp) == 0);
228
229 /* Check we got the expected result */
230 check(0 == bitmap_parselist(expected_str, expected, size));
231 check(bitmap_equal(expected, bmp.bitmap, size));
232
233 msi_bitmap_free(&bmp);
234 kfree(bmp.bitmap);
235}
236
237int msi_bitmap_selftest(void)
238{
239 printk(KERN_DEBUG "Running MSI bitmap self-tests ...\n");
240
241 test_basics();
242 test_of_node();
243
244 return 0;
245}
246late_initcall(msi_bitmap_selftest);
247#endif /* CONFIG_MSI_BITMAP_SELFTEST */
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index 32e0ad0ebea8..b6bd775d2e22 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -293,10 +293,8 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id,
293 return -ENODEV; 293 return -ENODEV;
294 294
295 prop = of_get_property(phy, "reg", NULL); 295 prop = of_get_property(phy, "reg", NULL);
296 if (prop) { 296 if (prop)
297 pdata.force_phy_addr = 1; 297 pdata.phy_addr = MV643XX_ETH_PHY_ADDR(*prop);
298 pdata.phy_addr = *prop;
299 }
300 298
301 of_node_put(phy); 299 of_node_put(phy);
302 300
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index fb368dfde5d4..d3e4d61030b5 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -30,24 +30,19 @@
30#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/dcr.h> 31#include <asm/dcr.h>
32#include <asm/dcr-regs.h> 32#include <asm/dcr-regs.h>
33#include <mm/mmu_decl.h>
33 34
34#include "ppc4xx_pci.h" 35#include "ppc4xx_pci.h"
35 36
36static int dma_offset_set; 37static int dma_offset_set;
37 38
38/* Move that to a useable header */
39extern unsigned long total_memory;
40
41#define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL)) 39#define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL))
42#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32)) 40#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32))
43 41
44#ifdef CONFIG_RESOURCES_64BIT 42#define RES_TO_U32_LOW(val) \
45#define RES_TO_U32_LOW(val) U64_TO_U32_LOW(val) 43 ((sizeof(resource_size_t) > sizeof(u32)) ? U64_TO_U32_LOW(val) : (val))
46#define RES_TO_U32_HIGH(val) U64_TO_U32_HIGH(val) 44#define RES_TO_U32_HIGH(val) \
47#else 45 ((sizeof(resource_size_t) > sizeof(u32)) ? U64_TO_U32_HIGH(val) : (0))
48#define RES_TO_U32_LOW(val) (val)
49#define RES_TO_U32_HIGH(val) (0)
50#endif
51 46
52static inline int ppc440spe_revA(void) 47static inline int ppc440spe_revA(void)
53{ 48{
@@ -105,7 +100,8 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
105 100
106 /* Default */ 101 /* Default */
107 res->start = 0; 102 res->start = 0;
108 res->end = size = 0x80000000; 103 size = 0x80000000;
104 res->end = size - 1;
109 res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; 105 res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
110 106
111 /* Get dma-ranges property */ 107 /* Get dma-ranges property */
@@ -145,12 +141,11 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
145 141
146 /* Use that */ 142 /* Use that */
147 res->start = pci_addr; 143 res->start = pci_addr;
148#ifndef CONFIG_RESOURCES_64BIT
149 /* Beware of 32 bits resources */ 144 /* Beware of 32 bits resources */
150 if ((pci_addr + size) > 0x100000000ull) 145 if (sizeof(resource_size_t) == sizeof(u32) &&
146 (pci_addr + size) > 0x100000000ull)
151 res->end = 0xffffffff; 147 res->end = 0xffffffff;
152 else 148 else
153#endif
154 res->end = res->start + size - 1; 149 res->end = res->start + size - 1;
155 break; 150 break;
156 } 151 }
@@ -167,13 +162,13 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
167 */ 162 */
168 if (size < total_memory) { 163 if (size < total_memory) {
169 printk(KERN_ERR "%s: dma-ranges too small " 164 printk(KERN_ERR "%s: dma-ranges too small "
170 "(size=%llx total_memory=%lx)\n", 165 "(size=%llx total_memory=%llx)\n",
171 hose->dn->full_name, size, total_memory); 166 hose->dn->full_name, size, (u64)total_memory);
172 return -ENXIO; 167 return -ENXIO;
173 } 168 }
174 169
175 /* Check we are a power of 2 size and that base is a multiple of size*/ 170 /* Check we are a power of 2 size and that base is a multiple of size*/
176 if (!is_power_of_2(size) || 171 if ((size & (size - 1)) != 0 ||
177 (res->start & (size - 1)) != 0) { 172 (res->start & (size - 1)) != 0) {
178 printk(KERN_ERR "%s: dma-ranges unaligned\n", 173 printk(KERN_ERR "%s: dma-ranges unaligned\n",
179 hose->dn->full_name); 174 hose->dn->full_name);
@@ -277,9 +272,16 @@ static void __init ppc4xx_probe_pci_bridge(struct device_node *np)
277 const int *bus_range; 272 const int *bus_range;
278 int primary = 0; 273 int primary = 0;
279 274
275 /* Check if device is enabled */
276 if (!of_device_is_available(np)) {
277 printk(KERN_INFO "%s: Port disabled via device-tree\n",
278 np->full_name);
279 return;
280 }
281
280 /* Fetch config space registers address */ 282 /* Fetch config space registers address */
281 if (of_address_to_resource(np, 0, &rsrc_cfg)) { 283 if (of_address_to_resource(np, 0, &rsrc_cfg)) {
282 printk(KERN_ERR "%s:Can't get PCI config register base !", 284 printk(KERN_ERR "%s: Can't get PCI config register base !",
283 np->full_name); 285 np->full_name);
284 return; 286 return;
285 } 287 }
@@ -810,7 +812,7 @@ static int ppc460ex_pciex_init_port_hw(struct ppc4xx_pciex_port *port)
810 switch (port->index) { 812 switch (port->index) {
811 case 0: 813 case 0:
812 mtdcri(SDR0, PESDR0_460EX_L0CDRCTL, 0x00003230); 814 mtdcri(SDR0, PESDR0_460EX_L0CDRCTL, 0x00003230);
813 mtdcri(SDR0, PESDR0_460EX_L0DRV, 0x00000136); 815 mtdcri(SDR0, PESDR0_460EX_L0DRV, 0x00000130);
814 mtdcri(SDR0, PESDR0_460EX_L0CLK, 0x00000006); 816 mtdcri(SDR0, PESDR0_460EX_L0CLK, 0x00000006);
815 817
816 mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST,0x10000000); 818 mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST,0x10000000);
@@ -821,10 +823,10 @@ static int ppc460ex_pciex_init_port_hw(struct ppc4xx_pciex_port *port)
821 mtdcri(SDR0, PESDR1_460EX_L1CDRCTL, 0x00003230); 823 mtdcri(SDR0, PESDR1_460EX_L1CDRCTL, 0x00003230);
822 mtdcri(SDR0, PESDR1_460EX_L2CDRCTL, 0x00003230); 824 mtdcri(SDR0, PESDR1_460EX_L2CDRCTL, 0x00003230);
823 mtdcri(SDR0, PESDR1_460EX_L3CDRCTL, 0x00003230); 825 mtdcri(SDR0, PESDR1_460EX_L3CDRCTL, 0x00003230);
824 mtdcri(SDR0, PESDR1_460EX_L0DRV, 0x00000136); 826 mtdcri(SDR0, PESDR1_460EX_L0DRV, 0x00000130);
825 mtdcri(SDR0, PESDR1_460EX_L1DRV, 0x00000136); 827 mtdcri(SDR0, PESDR1_460EX_L1DRV, 0x00000130);
826 mtdcri(SDR0, PESDR1_460EX_L2DRV, 0x00000136); 828 mtdcri(SDR0, PESDR1_460EX_L2DRV, 0x00000130);
827 mtdcri(SDR0, PESDR1_460EX_L3DRV, 0x00000136); 829 mtdcri(SDR0, PESDR1_460EX_L3DRV, 0x00000130);
828 mtdcri(SDR0, PESDR1_460EX_L0CLK, 0x00000006); 830 mtdcri(SDR0, PESDR1_460EX_L0CLK, 0x00000006);
829 mtdcri(SDR0, PESDR1_460EX_L1CLK, 0x00000006); 831 mtdcri(SDR0, PESDR1_460EX_L1CLK, 0x00000006);
830 mtdcri(SDR0, PESDR1_460EX_L2CLK, 0x00000006); 832 mtdcri(SDR0, PESDR1_460EX_L2CLK, 0x00000006);
diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig b/arch/powerpc/sysdev/qe_lib/Kconfig
index 1ce546462be5..76ffbc48d4b9 100644
--- a/arch/powerpc/sysdev/qe_lib/Kconfig
+++ b/arch/powerpc/sysdev/qe_lib/Kconfig
@@ -24,12 +24,3 @@ config QE_USB
24 bool 24 bool
25 help 25 help
26 QE USB Host Controller support 26 QE USB Host Controller support
27
28config QE_GPIO
29 bool "QE GPIO support"
30 depends on QUICC_ENGINE
31 select GENERIC_GPIO
32 select ARCH_REQUIRE_GPIOLIB
33 help
34 Say Y here if you're going to use hardware that connects to the
35 QE GPIOs.