aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2007-02-10 20:36:29 -0500
committerDave Jones <davej@redhat.com>2007-02-10 20:36:29 -0500
commitbd0561c9d8dcbf21cd9aa46c416bbf6a3a12e4b1 (patch)
tree64fe15d4db42e0840acea00e4cf7e1855bba9e96 /arch
parent348f31ed2bd18391fe5903aa0ad7bfcda6d8ca0b (diff)
parent66efc5a7e3061c3597ac43a8bb1026488d57e66b (diff)
[CPUFREQ] Fix up merge conflicts with recent ACPI changes.
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c4
-rw-r--r--arch/arm/Kconfig29
-rw-r--r--arch/arm/common/sharpsl_pm.c2
-rw-r--r--arch/arm/kernel/Makefile1
-rw-r--r--arch/arm/kernel/apm.c672
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c2
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c2
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c2
-rw-r--r--arch/avr32/boards/atstk1000/Makefile2
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c53
-rw-r--r--arch/avr32/boards/atstk1000/spi.c27
-rw-r--r--arch/avr32/kernel/cpu.c1
-rw-r--r--arch/avr32/kernel/irq.c1
-rw-r--r--arch/avr32/kernel/setup.c4
-rw-r--r--arch/avr32/lib/libgcc.h33
-rw-r--r--arch/avr32/lib/longlong.h98
-rw-r--r--arch/avr32/mach-at32ap/Makefile2
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c60
-rw-r--r--arch/avr32/mach-at32ap/extint.c36
-rw-r--r--arch/avr32/mach-at32ap/pio.c255
-rw-r--r--arch/avr32/mm/cache.c32
-rw-r--r--arch/i386/defconfig3
-rw-r--r--arch/i386/kernel/acpi/boot.c235
-rw-r--r--arch/i386/kernel/acpi/earlyquirk.c4
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c18
-rw-r--r--arch/i386/kernel/efi.c89
-rw-r--r--arch/i386/kernel/hpet.c5
-rw-r--r--arch/i386/kernel/io_apic.c19
-rw-r--r--arch/i386/kernel/mpparse.c4
-rw-r--r--arch/i386/kernel/srat.c84
-rw-r--r--arch/i386/kernel/sysenter.c53
-rw-r--r--arch/i386/mach-es7000/es7000.h9
-rw-r--r--arch/i386/mach-es7000/es7000plat.c53
-rw-r--r--arch/i386/mm/pageattr.c2
-rw-r--r--arch/i386/pci/mmconfig.c24
-rw-r--r--arch/ia64/Kconfig9
-rw-r--r--arch/ia64/hp/common/hwsw_iommu.c4
-rw-r--r--arch/ia64/kernel/acpi.c200
-rw-r--r--arch/ia64/kernel/crash.c18
-rw-r--r--arch/ia64/kernel/crash_dump.c3
-rw-r--r--arch/ia64/kernel/efi.c2
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/iosapic.c5
-rw-r--r--arch/ia64/kernel/machine_kexec.c15
-rw-r--r--arch/ia64/kernel/msi_ia64.c19
-rw-r--r--arch/ia64/kernel/process.c16
-rw-r--r--arch/ia64/kernel/ptrace.c14
-rw-r--r--arch/ia64/kernel/setup.c31
-rw-r--r--arch/ia64/kernel/smp.c4
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S1
-rw-r--r--arch/ia64/mm/contig.c76
-rw-r--r--arch/ia64/mm/discontig.c46
-rw-r--r--arch/ia64/mm/init.c38
-rw-r--r--arch/ia64/sn/kernel/huberror.c16
-rw-r--r--arch/ia64/sn/kernel/io_acpi_init.c314
-rw-r--r--arch/ia64/sn/kernel/io_common.c90
-rw-r--r--arch/ia64/sn/kernel/io_init.c54
-rw-r--r--arch/ia64/sn/kernel/iomv.c5
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c20
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c6
-rw-r--r--arch/m68knommu/kernel/time.c5
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S10
-rw-r--r--arch/m68knommu/platform/5206/config.c2
-rw-r--r--arch/m68knommu/platform/5206e/config.c2
-rw-r--r--arch/m68knommu/platform/520x/config.c3
-rw-r--r--arch/m68knommu/platform/523x/config.c2
-rw-r--r--arch/m68knommu/platform/5249/config.c3
-rw-r--r--arch/m68knommu/platform/5272/config.c2
-rw-r--r--arch/m68knommu/platform/527x/config.c2
-rw-r--r--arch/m68knommu/platform/528x/config.c2
-rw-r--r--arch/m68knommu/platform/5307/config.c2
-rw-r--r--arch/m68knommu/platform/5307/pit.c2
-rw-r--r--arch/m68knommu/platform/5307/timers.c5
-rw-r--r--arch/m68knommu/platform/532x/config.c2
-rw-r--r--arch/m68knommu/platform/5407/config.c2
-rw-r--r--arch/m68knommu/platform/68328/config.c2
-rw-r--r--arch/mips/Kconfig137
-rw-r--r--arch/mips/Kconfig.debug8
-rw-r--r--arch/mips/arc/identify.c2
-rw-r--r--arch/mips/arc/memory.c18
-rw-r--r--arch/mips/au1000/common/irq.c8
-rw-r--r--arch/mips/au1000/common/pci.c18
-rw-r--r--arch/mips/au1000/common/prom.c3
-rw-r--r--arch/mips/au1000/common/setup.c19
-rw-r--r--arch/mips/au1000/pb1100/board_setup.c93
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c32
-rw-r--r--arch/mips/basler/excite/excite_irq.c6
-rw-r--r--arch/mips/cobalt/irq.c2
-rw-r--r--arch/mips/cobalt/setup.c3
-rw-r--r--arch/mips/ddb5xxx/common/prom.c3
-rw-r--r--arch/mips/ddb5xxx/ddb5477/irq.c9
-rw-r--r--arch/mips/ddb5xxx/ddb5477/irq_5477.c2
-rw-r--r--arch/mips/dec/Makefile1
-rw-r--r--arch/mips/dec/ioasic-irq.c4
-rw-r--r--arch/mips/dec/kn02-irq.c2
-rw-r--r--arch/mips/dec/prom/identify.c3
-rw-r--r--arch/mips/dec/prom/memory.c17
-rw-r--r--arch/mips/dec/setup.c14
-rw-r--r--arch/mips/dec/tc.c95
-rw-r--r--arch/mips/emma2rh/common/irq_emma2rh.c2
-rw-r--r--arch/mips/emma2rh/markeins/irq.c2
-rw-r--r--arch/mips/emma2rh/markeins/irq_markeins.c4
-rw-r--r--arch/mips/gt64120/ev64120/irq.c2
-rw-r--r--arch/mips/gt64120/ev64120/setup.c3
-rw-r--r--arch/mips/gt64120/momenco_ocelot/dbg_io.c4
-rw-r--r--arch/mips/gt64120/momenco_ocelot/irq.c4
-rw-r--r--arch/mips/gt64120/momenco_ocelot/prom.c3
-rw-r--r--arch/mips/gt64120/wrppmc/irq.c2
-rw-r--r--arch/mips/gt64120/wrppmc/setup.c3
-rw-r--r--arch/mips/jazz/irq.c2
-rw-r--r--arch/mips/jmr3927/common/prom.c3
-rw-r--r--arch/mips/jmr3927/rbhma3100/irq.c2
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c2
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/apm.c604
-rw-r--r--arch/mips/kernel/asm-offsets.c4
-rw-r--r--arch/mips/kernel/cpu-probe.c2
-rw-r--r--arch/mips/kernel/gdb-stub.c6
-rw-r--r--arch/mips/kernel/head.S25
-rw-r--r--arch/mips/kernel/i8259.c24
-rw-r--r--arch/mips/kernel/irixelf.c331
-rw-r--r--arch/mips/kernel/irq-msc01.c4
-rw-r--r--arch/mips/kernel/irq-mv6434x.c14
-rw-r--r--arch/mips/kernel/irq-rm7000.c13
-rw-r--r--arch/mips/kernel/irq-rm9000.c24
-rw-r--r--arch/mips/kernel/irq_cpu.c21
-rw-r--r--arch/mips/kernel/linux32.c28
-rw-r--r--arch/mips/kernel/mips-mt.c9
-rw-r--r--arch/mips/kernel/proc.c8
-rw-r--r--arch/mips/kernel/process.c6
-rw-r--r--arch/mips/kernel/r4k_fpu.S19
-rw-r--r--arch/mips/kernel/rtlx.c4
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/setup.c47
-rw-r--r--arch/mips/kernel/signal.c6
-rw-r--r--arch/mips/kernel/signal_n32.c4
-rw-r--r--arch/mips/kernel/smp-mt.c9
-rw-r--r--arch/mips/kernel/smtc.c54
-rw-r--r--arch/mips/kernel/sysirix.c4
-rw-r--r--arch/mips/kernel/vpe.c36
-rw-r--r--arch/mips/lasat/interrupt.c2
-rw-r--r--arch/mips/lasat/prom.c3
-rw-r--r--arch/mips/lib-32/Makefile2
-rw-r--r--arch/mips/lib-64/Makefile2
-rw-r--r--arch/mips/lib-64/memset.S142
-rw-r--r--arch/mips/lib/Makefile2
-rw-r--r--arch/mips/lib/memset.S (renamed from arch/mips/lib-32/memset.S)35
-rw-r--r--arch/mips/lib/uncached.c4
-rw-r--r--arch/mips/mips-boards/atlas/atlas_int.c9
-rw-r--r--arch/mips/mips-boards/generic/memory.c18
-rw-r--r--arch/mips/mips-boards/malta/malta_int.c7
-rw-r--r--arch/mips/mips-boards/sead/sead_int.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_int.c6
-rw-r--r--arch/mips/mips-boards/sim/sim_mem.c16
-rw-r--r--arch/mips/mm/init.c50
-rw-r--r--arch/mips/momentum/jaguar_atx/Makefile2
-rw-r--r--arch/mips/momentum/jaguar_atx/irq.c4
-rw-r--r--arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h6
-rw-r--r--arch/mips/momentum/jaguar_atx/platform.c235
-rw-r--r--arch/mips/momentum/jaguar_atx/prom.c58
-rw-r--r--arch/mips/momentum/ocelot_3/irq.c2
-rw-r--r--arch/mips/momentum/ocelot_3/prom.c3
-rw-r--r--arch/mips/momentum/ocelot_c/cpci-irq.c2
-rw-r--r--arch/mips/momentum/ocelot_c/dbg_io.c4
-rw-r--r--arch/mips/momentum/ocelot_c/irq.c2
-rw-r--r--arch/mips/momentum/ocelot_c/prom.c3
-rw-r--r--arch/mips/momentum/ocelot_c/uart-irq.c2
-rw-r--r--arch/mips/momentum/ocelot_g/dbg_io.c4
-rw-r--r--arch/mips/momentum/ocelot_g/irq.c4
-rw-r--r--arch/mips/momentum/ocelot_g/prom.c3
-rw-r--r--arch/mips/oprofile/Kconfig2
-rw-r--r--arch/mips/pci/fixup-vr4133.c16
-rw-r--r--arch/mips/philips/pnx8550/common/int.c2
-rw-r--r--arch/mips/philips/pnx8550/common/prom.c3
-rw-r--r--arch/mips/pmc-sierra/yosemite/dbg_io.c2
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq.c6
-rw-r--r--arch/mips/pmc-sierra/yosemite/prom.c3
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c2
-rw-r--r--arch/mips/qemu/q-mem.c3
-rw-r--r--arch/mips/sgi-ip22/ip22-eisa.c4
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c13
-rw-r--r--arch/mips/sgi-ip22/ip22-mc.c3
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c3
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c2
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c10
-rw-r--r--arch/mips/sgi-ip32/ip32-memory.c3
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c2
-rw-r--r--arch/mips/sibyte/cfe/setup.c3
-rw-r--r--arch/mips/sibyte/sb1250/irq.c2
-rw-r--r--arch/mips/sibyte/sb1250/prom.c3
-rw-r--r--arch/mips/sni/irq.c2
-rw-r--r--arch/mips/sni/sniprom.c3
-rw-r--r--arch/mips/tx4927/common/tx4927_irq.c4
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c12
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c3
-rw-r--r--arch/mips/tx4938/common/irq.c4
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/irq.c2
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/prom.c3
-rw-r--r--arch/mips/vr41xx/common/icu.c31
-rw-r--r--arch/mips/vr41xx/common/init.c3
-rw-r--r--arch/mips/vr41xx/common/irq.c18
-rw-r--r--arch/mips/vr41xx/nec-cmbvr4133/irq.c53
-rw-r--r--arch/powerpc/Kconfig54
-rw-r--r--arch/powerpc/Kconfig.debug18
-rw-r--r--arch/powerpc/boot/Makefile1
-rw-r--r--arch/powerpc/boot/dts/mpc8272ads.dts55
-rw-r--r--arch/powerpc/boot/dts/mpc8323emds.dts345
-rw-r--r--arch/powerpc/boot/dts/mpc8560ads.dts10
-rw-r--r--arch/powerpc/boot/dts/mpc866ads.dts162
-rw-r--r--arch/powerpc/boot/dts/mpc885ads.dts185
-rw-r--r--arch/powerpc/configs/celleb_defconfig1408
-rw-r--r--arch/powerpc/configs/mpc8272_ads_defconfig848
-rw-r--r--arch/powerpc/configs/mpc832xemds_defconfig1083
-rw-r--r--arch/powerpc/configs/mpc834x_itx_defconfig7
-rw-r--r--arch/powerpc/configs/mpc834x_mds_defconfig3
-rw-r--r--arch/powerpc/configs/mpc8360emds_defconfig3
-rw-r--r--arch/powerpc/configs/mpc866_ads_defconfig829
-rw-r--r--arch/powerpc/configs/mpc885_ads_defconfig827
-rw-r--r--arch/powerpc/configs/pasemi_defconfig1722
-rw-r--r--arch/powerpc/configs/ps3_defconfig240
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/cpu_setup_pa6t.S44
-rw-r--r--arch/powerpc/kernel/cputable.c21
-rw-r--r--arch/powerpc/kernel/entry_64.S59
-rw-r--r--arch/powerpc/kernel/head_32.S5
-rw-r--r--arch/powerpc/kernel/head_64.S2
-rw-r--r--arch/powerpc/kernel/iomap.c20
-rw-r--r--arch/powerpc/kernel/irq.c8
-rw-r--r--arch/powerpc/kernel/kprobes.c8
-rw-r--r--arch/powerpc/kernel/lparcfg.c11
-rw-r--r--arch/powerpc/kernel/misc_64.S40
-rw-r--r--arch/powerpc/kernel/module_32.c7
-rw-r--r--arch/powerpc/kernel/pci_32.c1
-rw-r--r--arch/powerpc/kernel/pci_64.c3
-rw-r--r--arch/powerpc/kernel/pmc.c37
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c1
-rw-r--r--arch/powerpc/kernel/prom.c18
-rw-r--r--arch/powerpc/kernel/ptrace.c24
-rw-r--r--arch/powerpc/kernel/setup_32.c1
-rw-r--r--arch/powerpc/kernel/sysfs.c141
-rw-r--r--arch/powerpc/kernel/traps.c111
-rw-r--r--arch/powerpc/kernel/udbg.c4
-rw-r--r--arch/powerpc/kernel/udbg_16550.c24
-rw-r--r--arch/powerpc/kernel/vdso.c104
-rw-r--r--arch/powerpc/kernel/vio.c6
-rw-r--r--arch/powerpc/lib/Makefile4
-rw-r--r--arch/powerpc/lib/dma-noncoherent.c (renamed from arch/ppc/kernel/dma-mapping.c)24
-rw-r--r--arch/powerpc/lib/rheap.c6
-rw-r--r--arch/powerpc/mm/hugetlbpage.c3
-rw-r--r--arch/powerpc/mm/mem.c24
-rw-r--r--arch/powerpc/mm/pgtable_32.c5
-rw-r--r--arch/powerpc/oprofile/common.c2
-rw-r--r--arch/powerpc/oprofile/op_model_7450.c10
-rw-r--r--arch/powerpc/oprofile/op_model_fsl_booke.c81
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c10
-rw-r--r--arch/powerpc/oprofile/op_model_rs64.c10
-rw-r--r--arch/powerpc/platforms/52xx/Makefile1
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c6
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pci.c412
-rw-r--r--arch/powerpc/platforms/82xx/mpc82xx.c2
-rw-r--r--arch/powerpc/platforms/82xx/mpc82xx_ads.c2
-rw-r--r--arch/powerpc/platforms/82xx/pq2ads.h5
-rw-r--r--arch/powerpc/platforms/83xx/misc.c29
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c3
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc8360e_pb.c3
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_smp.c1
-rw-r--r--arch/powerpc/platforms/8xx/Kconfig300
-rw-r--r--arch/powerpc/platforms/8xx/Makefile6
-rw-r--r--arch/powerpc/platforms/8xx/m8xx_setup.c303
-rw-r--r--arch/powerpc/platforms/8xx/mpc86xads.h95
-rw-r--r--arch/powerpc/platforms/8xx/mpc86xads_setup.c301
-rw-r--r--arch/powerpc/platforms/8xx/mpc885ads.h95
-rw-r--r--arch/powerpc/platforms/8xx/mpc885ads_setup.c387
-rw-r--r--arch/powerpc/platforms/Makefile3
-rw-r--r--arch/powerpc/platforms/cell/Makefile7
-rw-r--r--arch/powerpc/platforms/cell/iommu.c5
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c3
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c420
-rw-r--r--arch/powerpc/platforms/cell/spu_priv1_mmio.c422
-rw-r--r--arch/powerpc/platforms/celleb/Makefile9
-rw-r--r--arch/powerpc/platforms/celleb/beat.c163
-rw-r--r--arch/powerpc/platforms/celleb/beat.h40
-rw-r--r--arch/powerpc/platforms/celleb/beat_syscall.h160
-rw-r--r--arch/powerpc/platforms/celleb/beat_wrapper.h220
-rw-r--r--arch/powerpc/platforms/celleb/htab.c311
-rw-r--r--arch/powerpc/platforms/celleb/hvCall.S287
-rw-r--r--arch/powerpc/platforms/celleb/interrupt.c274
-rw-r--r--arch/powerpc/platforms/celleb/interrupt.h33
-rw-r--r--arch/powerpc/platforms/celleb/iommu.c104
-rw-r--r--arch/powerpc/platforms/celleb/pci.c481
-rw-r--r--arch/powerpc/platforms/celleb/pci.h35
-rw-r--r--arch/powerpc/platforms/celleb/scc.h145
-rw-r--r--arch/powerpc/platforms/celleb/scc_epci.c409
-rw-r--r--arch/powerpc/platforms/celleb/scc_sio.c101
-rw-r--r--arch/powerpc/platforms/celleb/scc_uhc.c94
-rw-r--r--arch/powerpc/platforms/celleb/setup.c191
-rw-r--r--arch/powerpc/platforms/celleb/smp.c124
-rw-r--r--arch/powerpc/platforms/celleb/spu_priv1.c208
-rw-r--r--arch/powerpc/platforms/celleb/udbg_beat.c97
-rw-r--r--arch/powerpc/platforms/chrp/setup.c4
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig9
-rw-r--r--arch/powerpc/platforms/maple/pci.c23
-rw-r--r--arch/powerpc/platforms/maple/setup.c3
-rw-r--r--arch/powerpc/platforms/pasemi/Kconfig10
-rw-r--r--arch/powerpc/platforms/pasemi/Makefile3
-rw-r--r--arch/powerpc/platforms/pasemi/idle.c88
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c281
-rw-r--r--arch/powerpc/platforms/pasemi/pasemi.h12
-rw-r--r--arch/powerpc/platforms/pasemi/pci.c13
-rw-r--r--arch/powerpc/platforms/pasemi/powersave.S80
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c105
-rw-r--r--arch/powerpc/platforms/powermac/smp.c1
-rw-r--r--arch/powerpc/platforms/ps3/Makefile1
-rw-r--r--arch/powerpc/platforms/ps3/htab.c1
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c444
-rw-r--r--arch/powerpc/platforms/ps3/mm.c1
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c22
-rw-r--r--arch/powerpc/platforms/ps3/platform.h151
-rw-r--r--arch/powerpc/platforms/ps3/repository.c220
-rw-r--r--arch/powerpc/platforms/ps3/setup.c19
-rw-r--r--arch/powerpc/platforms/ps3/smp.c3
-rw-r--r--arch/powerpc/platforms/ps3/spu.c20
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c384
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c19
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c3
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c1
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c55
-rw-r--r--arch/powerpc/platforms/pseries/pci.c2
-rw-r--r--arch/powerpc/sysdev/Makefile2
-rw-r--r--arch/powerpc/sysdev/commproc.c398
-rw-r--r--arch/powerpc/sysdev/cpm2_pic.c154
-rw-r--r--arch/powerpc/sysdev/cpm2_pic.h2
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c274
-rw-r--r--arch/powerpc/sysdev/grackle.c2
-rw-r--r--arch/powerpc/sysdev/ipic.c17
-rw-r--r--arch/powerpc/sysdev/micropatch.c743
-rw-r--r--arch/powerpc/sysdev/mpc8xx_pic.c197
-rw-r--r--arch/powerpc/sysdev/mpc8xx_pic.h12
-rw-r--r--arch/powerpc/sysdev/mpic.c66
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c6
-rw-r--r--arch/powerpc/xmon/ppc-opc.c7
-rw-r--r--arch/powerpc/xmon/spu-dis.c2
-rw-r--r--arch/powerpc/xmon/spu-opc.c4
-rw-r--r--arch/ppc/8xx_io/cs4218_tdm.c1
-rw-r--r--arch/ppc/Kconfig9
-rw-r--r--arch/ppc/boot/simple/Makefile4
-rw-r--r--arch/ppc/boot/simple/misc.c15
-rw-r--r--arch/ppc/configs/gemini_defconfig618
-rw-r--r--arch/ppc/kernel/Makefile1
-rw-r--r--arch/ppc/kernel/head.S18
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c1
-rw-r--r--arch/ppc/lib/rheap.c3
-rw-r--r--arch/ppc/mm/pgtable.c5
-rw-r--r--arch/ppc/platforms/Makefile1
-rw-r--r--arch/ppc/platforms/gemini.h165
-rw-r--r--arch/ppc/platforms/gemini_pci.c41
-rw-r--r--arch/ppc/platforms/gemini_prom.S90
-rw-r--r--arch/ppc/platforms/gemini_serial.h40
-rw-r--r--arch/ppc/platforms/gemini_setup.c577
-rw-r--r--arch/ppc/platforms/mpc866ads_setup.c2
-rw-r--r--arch/ppc/syslib/Makefile1
-rw-r--r--arch/ppc/syslib/m8260_pci_erratum9.c3
-rw-r--r--arch/ppc/syslib/m8xx_setup.c2
-rw-r--r--arch/ppc/syslib/ppc85xx_rio.c2
-rw-r--r--arch/ppc/xmon/ppc-opc.c7
-rw-r--r--arch/ppc/xmon/start.c5
-rw-r--r--arch/s390/Kconfig29
-rw-r--r--arch/s390/appldata/appldata_base.c2
-rw-r--r--arch/s390/appldata/appldata_mem.c2
-rw-r--r--arch/s390/appldata/appldata_net_sum.c2
-rw-r--r--arch/s390/crypto/Kconfig60
-rw-r--r--arch/s390/crypto/Makefile3
-rw-r--r--arch/s390/crypto/aes_s390.c47
-rw-r--r--arch/s390/crypto/crypt_s390.h281
-rw-r--r--arch/s390/crypto/crypt_s390_query.c129
-rw-r--r--arch/s390/crypto/des_check_key.c6
-rw-r--r--arch/s390/crypto/des_s390.c8
-rw-r--r--arch/s390/crypto/prng.c213
-rw-r--r--arch/s390/crypto/sha1_s390.c83
-rw-r--r--arch/s390/crypto/sha256_s390.c11
-rw-r--r--arch/s390/defconfig15
-rw-r--r--arch/s390/hypfs/Makefile2
-rw-r--r--arch/s390/hypfs/hypfs.h9
-rw-r--r--arch/s390/hypfs/hypfs_diag.h16
-rw-r--r--arch/s390/hypfs/hypfs_vm.c231
-rw-r--r--arch/s390/hypfs/inode.c31
-rw-r--r--arch/s390/kernel/Makefile4
-rw-r--r--arch/s390/kernel/base.S150
-rw-r--r--arch/s390/kernel/binfmt_elf32.c2
-rw-r--r--arch/s390/kernel/compat_exec_domain.c5
-rw-r--r--arch/s390/kernel/compat_linux.c24
-rw-r--r--arch/s390/kernel/compat_linux.h31
-rw-r--r--arch/s390/kernel/compat_signal.c8
-rw-r--r--arch/s390/kernel/cpcmd.c14
-rw-r--r--arch/s390/kernel/crash.c1
-rw-r--r--arch/s390/kernel/debug.c18
-rw-r--r--arch/s390/kernel/early.c306
-rw-r--r--arch/s390/kernel/ebcdic.c1
-rw-r--r--arch/s390/kernel/head31.S194
-rw-r--r--arch/s390/kernel/head64.S193
-rw-r--r--arch/s390/kernel/ipl.c106
-rw-r--r--arch/s390/kernel/irq.c15
-rw-r--r--arch/s390/kernel/kprobes.c32
-rw-r--r--arch/s390/kernel/machine_kexec.c1
-rw-r--r--arch/s390/kernel/module.c5
-rw-r--r--arch/s390/kernel/process.c4
-rw-r--r--arch/s390/kernel/profile.c20
-rw-r--r--arch/s390/kernel/ptrace.c46
-rw-r--r--arch/s390/kernel/reset.S90
-rw-r--r--arch/s390/kernel/s390_ext.c8
-rw-r--r--arch/s390/kernel/setup.c155
-rw-r--r--arch/s390/kernel/signal.c2
-rw-r--r--arch/s390/kernel/smp.c32
-rw-r--r--arch/s390/kernel/stacktrace.c10
-rw-r--r--arch/s390/kernel/time.c1185
-rw-r--r--arch/s390/kernel/traps.c24
-rw-r--r--arch/s390/kernel/vmlinux.lds.S13
-rw-r--r--arch/s390/kernel/vtime.c10
-rw-r--r--arch/s390/lib/Makefile2
-rw-r--r--arch/s390/lib/delay.c48
-rw-r--r--arch/s390/lib/qrnnd.S77
-rw-r--r--arch/s390/lib/uaccess.h23
-rw-r--r--arch/s390/lib/uaccess_mvcos.c78
-rw-r--r--arch/s390/lib/uaccess_pt.c329
-rw-r--r--arch/s390/lib/uaccess_std.c23
-rw-r--r--arch/s390/math-emu/Makefile2
-rw-r--r--arch/s390/math-emu/math.c2
-rw-r--r--arch/s390/math-emu/qrnnd.S77
-rw-r--r--arch/s390/math-emu/sfp-util.h66
-rw-r--r--arch/s390/mm/cmm.c4
-rw-r--r--arch/s390/mm/extmem.c66
-rw-r--r--arch/s390/mm/fault.c93
-rw-r--r--arch/s390/mm/init.c20
-rw-r--r--arch/s390/mm/vmem.c14
-rw-r--r--arch/sh/Kconfig7
-rw-r--r--arch/sh/boards/hp6xx/hp6xx_apm.c68
-rw-r--r--arch/sh/kernel/Makefile1
-rw-r--r--arch/sh/kernel/apm.c538
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.c58
-rw-r--r--arch/x86_64/ia32/syscall32.c59
-rw-r--r--arch/x86_64/kernel/early-quirks.c4
-rw-r--r--arch/x86_64/kernel/genapic.c4
-rw-r--r--arch/x86_64/kernel/io_apic.c17
-rw-r--r--arch/x86_64/kernel/mpparse.c2
-rw-r--r--arch/x86_64/kernel/pci-swiotlb.c2
-rw-r--r--arch/x86_64/kernel/time.c18
-rw-r--r--arch/x86_64/mm/srat.c48
-rw-r--r--arch/x86_64/pci/mmconfig.c29
453 files changed, 23408 insertions, 8403 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 3c10b9a1ddf5..ab642a4f08de 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -575,3 +575,7 @@ void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
575 575
576EXPORT_SYMBOL(pci_iomap); 576EXPORT_SYMBOL(pci_iomap);
577EXPORT_SYMBOL(pci_iounmap); 577EXPORT_SYMBOL(pci_iounmap);
578
579/* FIXME: Some boxes have multiple ISA bridges! */
580struct pci_dev *isa_bridge;
581EXPORT_SYMBOL(isa_bridge);
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6783c2e5512d..1523046e092b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -9,6 +9,7 @@ config ARM
9 bool 9 bool
10 default y 10 default y
11 select RTC_LIB 11 select RTC_LIB
12 select SYS_SUPPORTS_APM_EMULATION
12 help 13 help
13 The ARM series is a line of low-power-consumption RISC chip designs 14 The ARM series is a line of low-power-consumption RISC chip designs
14 licensed by ARM Ltd and targeted at embedded applications and 15 licensed by ARM Ltd and targeted at embedded applications and
@@ -17,6 +18,9 @@ config ARM
17 Europe. There is an ARM Linux project with a web page at 18 Europe. There is an ARM Linux project with a web page at
18 <http://www.arm.linux.org.uk/>. 19 <http://www.arm.linux.org.uk/>.
19 20
21config SYS_SUPPORTS_APM_EMULATION
22 bool
23
20config GENERIC_TIME 24config GENERIC_TIME
21 bool 25 bool
22 default n 26 default n
@@ -856,31 +860,6 @@ menu "Power management options"
856 860
857source "kernel/power/Kconfig" 861source "kernel/power/Kconfig"
858 862
859config APM
860 tristate "Advanced Power Management Emulation"
861 ---help---
862 APM is a BIOS specification for saving power using several different
863 techniques. This is mostly useful for battery powered laptops with
864 APM compliant BIOSes. If you say Y here, the system time will be
865 reset after a RESUME operation, the /proc/apm device will provide
866 battery status information, and user-space programs will receive
867 notification of APM "events" (e.g. battery status change).
868
869 In order to use APM, you will need supporting software. For location
870 and more information, read <file:Documentation/pm.txt> and the
871 Battery Powered Linux mini-HOWTO, available from
872 <http://www.tldp.org/docs.html#howto>.
873
874 This driver does not spin down disk drives (see the hdparm(8)
875 manpage ("man 8 hdparm") for that), and it doesn't turn off
876 VESA-compliant "green" monitors.
877
878 Generally, if you don't have a battery in your machine, there isn't
879 much point in using this driver and you should say N. If you get
880 random kernel OOPSes or reboots that don't seem to be related to
881 anything, try disabling/enabling this option (or disabling/enabling
882 APM in your BIOS).
883
884endmenu 863endmenu
885 864
886source "net/Kconfig" 865source "net/Kconfig"
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index b3599743093b..a3b450f8ef17 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -27,7 +27,7 @@
27#include <asm/hardware.h> 27#include <asm/hardware.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/apm.h> 30#include <asm/apm-emulation.h>
31#include <asm/arch/pm.h> 31#include <asm/arch/pm.h>
32#include <asm/arch/pxa-regs.h> 32#include <asm/arch/pxa-regs.h>
33#include <asm/arch/sharpsl.h> 33#include <asm/arch/sharpsl.h>
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index ab06a86e85d5..1b935fb94b83 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -10,7 +10,6 @@ obj-y := compat.o entry-armv.o entry-common.o irq.o \
10 process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \ 10 process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \
11 time.o traps.o 11 time.o traps.o
12 12
13obj-$(CONFIG_APM) += apm.o
14obj-$(CONFIG_ISA_DMA_API) += dma.o 13obj-$(CONFIG_ISA_DMA_API) += dma.o
15obj-$(CONFIG_ARCH_ACORN) += ecard.o 14obj-$(CONFIG_ARCH_ACORN) += ecard.o
16obj-$(CONFIG_FIQ) += fiq.o 15obj-$(CONFIG_FIQ) += fiq.o
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c
deleted file mode 100644
index 2c37b70b17ab..000000000000
--- a/arch/arm/kernel/apm.c
+++ /dev/null
@@ -1,672 +0,0 @@
1/*
2 * bios-less APM driver for ARM Linux
3 * Jamey Hicks <jamey@crl.dec.com>
4 * adapted from the APM BIOS driver for Linux by Stephen Rothwell (sfr@linuxcare.com)
5 *
6 * APM 1.2 Reference:
7 * Intel Corporation, Microsoft Corporation. Advanced Power Management
8 * (APM) BIOS Interface Specification, Revision 1.2, February 1996.
9 *
10 * [This document is available from Microsoft at:
11 * http://www.microsoft.com/hwdev/busbios/amp_12.htm]
12 */
13#include <linux/module.h>
14#include <linux/poll.h>
15#include <linux/slab.h>
16#include <linux/proc_fs.h>
17#include <linux/miscdevice.h>
18#include <linux/apm_bios.h>
19#include <linux/capability.h>
20#include <linux/sched.h>
21#include <linux/pm.h>
22#include <linux/device.h>
23#include <linux/kernel.h>
24#include <linux/list.h>
25#include <linux/init.h>
26#include <linux/completion.h>
27#include <linux/kthread.h>
28#include <linux/delay.h>
29
30#include <asm/apm.h> /* apm_power_info */
31#include <asm/system.h>
32
33/*
34 * The apm_bios device is one of the misc char devices.
35 * This is its minor number.
36 */
37#define APM_MINOR_DEV 134
38
39/*
40 * See Documentation/Config.help for the configuration options.
41 *
42 * Various options can be changed at boot time as follows:
43 * (We allow underscores for compatibility with the modules code)
44 * apm=on/off enable/disable APM
45 */
46
47/*
48 * Maximum number of events stored
49 */
50#define APM_MAX_EVENTS 16
51
52struct apm_queue {
53 unsigned int event_head;
54 unsigned int event_tail;
55 apm_event_t events[APM_MAX_EVENTS];
56};
57
58/*
59 * The per-file APM data
60 */
61struct apm_user {
62 struct list_head list;
63
64 unsigned int suser: 1;
65 unsigned int writer: 1;
66 unsigned int reader: 1;
67
68 int suspend_result;
69 unsigned int suspend_state;
70#define SUSPEND_NONE 0 /* no suspend pending */
71#define SUSPEND_PENDING 1 /* suspend pending read */
72#define SUSPEND_READ 2 /* suspend read, pending ack */
73#define SUSPEND_ACKED 3 /* suspend acked */
74#define SUSPEND_WAIT 4 /* waiting for suspend */
75#define SUSPEND_DONE 5 /* suspend completed */
76
77 struct apm_queue queue;
78};
79
80/*
81 * Local variables
82 */
83static int suspends_pending;
84static int apm_disabled;
85static struct task_struct *kapmd_tsk;
86
87static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
88static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
89
90/*
91 * This is a list of everyone who has opened /dev/apm_bios
92 */
93static DECLARE_RWSEM(user_list_lock);
94static LIST_HEAD(apm_user_list);
95
96/*
97 * kapmd info. kapmd provides us a process context to handle
98 * "APM" events within - specifically necessary if we're going
99 * to be suspending the system.
100 */
101static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait);
102static DEFINE_SPINLOCK(kapmd_queue_lock);
103static struct apm_queue kapmd_queue;
104
105static DEFINE_MUTEX(state_lock);
106
107static const char driver_version[] = "1.13"; /* no spaces */
108
109
110
111/*
112 * Compatibility cruft until the IPAQ people move over to the new
113 * interface.
114 */
115static void __apm_get_power_status(struct apm_power_info *info)
116{
117}
118
119/*
120 * This allows machines to provide their own "apm get power status" function.
121 */
122void (*apm_get_power_status)(struct apm_power_info *) = __apm_get_power_status;
123EXPORT_SYMBOL(apm_get_power_status);
124
125
126/*
127 * APM event queue management.
128 */
129static inline int queue_empty(struct apm_queue *q)
130{
131 return q->event_head == q->event_tail;
132}
133
134static inline apm_event_t queue_get_event(struct apm_queue *q)
135{
136 q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS;
137 return q->events[q->event_tail];
138}
139
140static void queue_add_event(struct apm_queue *q, apm_event_t event)
141{
142 q->event_head = (q->event_head + 1) % APM_MAX_EVENTS;
143 if (q->event_head == q->event_tail) {
144 static int notified;
145
146 if (notified++ == 0)
147 printk(KERN_ERR "apm: an event queue overflowed\n");
148 q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS;
149 }
150 q->events[q->event_head] = event;
151}
152
153static void queue_event(apm_event_t event)
154{
155 struct apm_user *as;
156
157 down_read(&user_list_lock);
158 list_for_each_entry(as, &apm_user_list, list) {
159 if (as->reader)
160 queue_add_event(&as->queue, event);
161 }
162 up_read(&user_list_lock);
163 wake_up_interruptible(&apm_waitqueue);
164}
165
166/*
167 * queue_suspend_event - queue an APM suspend event.
168 *
169 * Check that we're in a state where we can suspend. If not,
170 * return -EBUSY. Otherwise, queue an event to all "writer"
171 * users. If there are no "writer" users, return '1' to
172 * indicate that we can immediately suspend.
173 */
174static int queue_suspend_event(apm_event_t event, struct apm_user *sender)
175{
176 struct apm_user *as;
177 int ret = 1;
178
179 mutex_lock(&state_lock);
180 down_read(&user_list_lock);
181
182 /*
183 * If a thread is still processing, we can't suspend, so reject
184 * the request.
185 */
186 list_for_each_entry(as, &apm_user_list, list) {
187 if (as != sender && as->reader && as->writer && as->suser &&
188 as->suspend_state != SUSPEND_NONE) {
189 ret = -EBUSY;
190 goto out;
191 }
192 }
193
194 list_for_each_entry(as, &apm_user_list, list) {
195 if (as != sender && as->reader && as->writer && as->suser) {
196 as->suspend_state = SUSPEND_PENDING;
197 suspends_pending++;
198 queue_add_event(&as->queue, event);
199 ret = 0;
200 }
201 }
202 out:
203 up_read(&user_list_lock);
204 mutex_unlock(&state_lock);
205 wake_up_interruptible(&apm_waitqueue);
206 return ret;
207}
208
209static void apm_suspend(void)
210{
211 struct apm_user *as;
212 int err = pm_suspend(PM_SUSPEND_MEM);
213
214 /*
215 * Anyone on the APM queues will think we're still suspended.
216 * Send a message so everyone knows we're now awake again.
217 */
218 queue_event(APM_NORMAL_RESUME);
219
220 /*
221 * Finally, wake up anyone who is sleeping on the suspend.
222 */
223 mutex_lock(&state_lock);
224 down_read(&user_list_lock);
225 list_for_each_entry(as, &apm_user_list, list) {
226 if (as->suspend_state == SUSPEND_WAIT ||
227 as->suspend_state == SUSPEND_ACKED) {
228 as->suspend_result = err;
229 as->suspend_state = SUSPEND_DONE;
230 }
231 }
232 up_read(&user_list_lock);
233 mutex_unlock(&state_lock);
234
235 wake_up(&apm_suspend_waitqueue);
236}
237
238static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos)
239{
240 struct apm_user *as = fp->private_data;
241 apm_event_t event;
242 int i = count, ret = 0;
243
244 if (count < sizeof(apm_event_t))
245 return -EINVAL;
246
247 if (queue_empty(&as->queue) && fp->f_flags & O_NONBLOCK)
248 return -EAGAIN;
249
250 wait_event_interruptible(apm_waitqueue, !queue_empty(&as->queue));
251
252 while ((i >= sizeof(event)) && !queue_empty(&as->queue)) {
253 event = queue_get_event(&as->queue);
254
255 ret = -EFAULT;
256 if (copy_to_user(buf, &event, sizeof(event)))
257 break;
258
259 mutex_lock(&state_lock);
260 if (as->suspend_state == SUSPEND_PENDING &&
261 (event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND))
262 as->suspend_state = SUSPEND_READ;
263 mutex_unlock(&state_lock);
264
265 buf += sizeof(event);
266 i -= sizeof(event);
267 }
268
269 if (i < count)
270 ret = count - i;
271
272 return ret;
273}
274
275static unsigned int apm_poll(struct file *fp, poll_table * wait)
276{
277 struct apm_user *as = fp->private_data;
278
279 poll_wait(fp, &apm_waitqueue, wait);
280 return queue_empty(&as->queue) ? 0 : POLLIN | POLLRDNORM;
281}
282
283/*
284 * apm_ioctl - handle APM ioctl
285 *
286 * APM_IOC_SUSPEND
287 * This IOCTL is overloaded, and performs two functions. It is used to:
288 * - initiate a suspend
289 * - acknowledge a suspend read from /dev/apm_bios.
290 * Only when everyone who has opened /dev/apm_bios with write permission
291 * has acknowledge does the actual suspend happen.
292 */
293static int
294apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
295{
296 struct apm_user *as = filp->private_data;
297 unsigned long flags;
298 int err = -EINVAL;
299
300 if (!as->suser || !as->writer)
301 return -EPERM;
302
303 switch (cmd) {
304 case APM_IOC_SUSPEND:
305 mutex_lock(&state_lock);
306
307 as->suspend_result = -EINTR;
308
309 if (as->suspend_state == SUSPEND_READ) {
310 int pending;
311
312 /*
313 * If we read a suspend command from /dev/apm_bios,
314 * then the corresponding APM_IOC_SUSPEND ioctl is
315 * interpreted as an acknowledge.
316 */
317 as->suspend_state = SUSPEND_ACKED;
318 suspends_pending--;
319 pending = suspends_pending == 0;
320 mutex_unlock(&state_lock);
321
322 /*
323 * If there are no further acknowledges required,
324 * suspend the system.
325 */
326 if (pending)
327 apm_suspend();
328
329 /*
330 * Wait for the suspend/resume to complete. If there
331 * are pending acknowledges, we wait here for them.
332 *
333 * Note: we need to ensure that the PM subsystem does
334 * not kick us out of the wait when it suspends the
335 * threads.
336 */
337 flags = current->flags;
338 current->flags |= PF_NOFREEZE;
339
340 wait_event(apm_suspend_waitqueue,
341 as->suspend_state == SUSPEND_DONE);
342 } else {
343 as->suspend_state = SUSPEND_WAIT;
344 mutex_unlock(&state_lock);
345
346 /*
347 * Otherwise it is a request to suspend the system.
348 * Queue an event for all readers, and expect an
349 * acknowledge from all writers who haven't already
350 * acknowledged.
351 */
352 err = queue_suspend_event(APM_USER_SUSPEND, as);
353 if (err < 0) {
354 /*
355 * Avoid taking the lock here - this
356 * should be fine.
357 */
358 as->suspend_state = SUSPEND_NONE;
359 break;
360 }
361
362 if (err > 0)
363 apm_suspend();
364
365 /*
366 * Wait for the suspend/resume to complete. If there
367 * are pending acknowledges, we wait here for them.
368 *
369 * Note: we need to ensure that the PM subsystem does
370 * not kick us out of the wait when it suspends the
371 * threads.
372 */
373 flags = current->flags;
374 current->flags |= PF_NOFREEZE;
375
376 wait_event_interruptible(apm_suspend_waitqueue,
377 as->suspend_state == SUSPEND_DONE);
378 }
379
380 current->flags = flags;
381
382 mutex_lock(&state_lock);
383 err = as->suspend_result;
384 as->suspend_state = SUSPEND_NONE;
385 mutex_unlock(&state_lock);
386 break;
387 }
388
389 return err;
390}
391
392static int apm_release(struct inode * inode, struct file * filp)
393{
394 struct apm_user *as = filp->private_data;
395 int pending = 0;
396
397 filp->private_data = NULL;
398
399 down_write(&user_list_lock);
400 list_del(&as->list);
401 up_write(&user_list_lock);
402
403 /*
404 * We are now unhooked from the chain. As far as new
405 * events are concerned, we no longer exist. However, we
406 * need to balance suspends_pending, which means the
407 * possibility of sleeping.
408 */
409 mutex_lock(&state_lock);
410 if (as->suspend_state != SUSPEND_NONE) {
411 suspends_pending -= 1;
412 pending = suspends_pending == 0;
413 }
414 mutex_unlock(&state_lock);
415 if (pending)
416 apm_suspend();
417
418 kfree(as);
419 return 0;
420}
421
422static int apm_open(struct inode * inode, struct file * filp)
423{
424 struct apm_user *as;
425
426 as = kzalloc(sizeof(*as), GFP_KERNEL);
427 if (as) {
428 /*
429 * XXX - this is a tiny bit broken, when we consider BSD
430 * process accounting. If the device is opened by root, we
431 * instantly flag that we used superuser privs. Who knows,
432 * we might close the device immediately without doing a
433 * privileged operation -- cevans
434 */
435 as->suser = capable(CAP_SYS_ADMIN);
436 as->writer = (filp->f_mode & FMODE_WRITE) == FMODE_WRITE;
437 as->reader = (filp->f_mode & FMODE_READ) == FMODE_READ;
438
439 down_write(&user_list_lock);
440 list_add(&as->list, &apm_user_list);
441 up_write(&user_list_lock);
442
443 filp->private_data = as;
444 }
445
446 return as ? 0 : -ENOMEM;
447}
448
449static struct file_operations apm_bios_fops = {
450 .owner = THIS_MODULE,
451 .read = apm_read,
452 .poll = apm_poll,
453 .ioctl = apm_ioctl,
454 .open = apm_open,
455 .release = apm_release,
456};
457
458static struct miscdevice apm_device = {
459 .minor = APM_MINOR_DEV,
460 .name = "apm_bios",
461 .fops = &apm_bios_fops
462};
463
464
465#ifdef CONFIG_PROC_FS
466/*
467 * Arguments, with symbols from linux/apm_bios.h.
468 *
469 * 0) Linux driver version (this will change if format changes)
470 * 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
471 * 2) APM flags from APM Installation Check (0x00):
472 * bit 0: APM_16_BIT_SUPPORT
473 * bit 1: APM_32_BIT_SUPPORT
474 * bit 2: APM_IDLE_SLOWS_CLOCK
475 * bit 3: APM_BIOS_DISABLED
476 * bit 4: APM_BIOS_DISENGAGED
477 * 3) AC line status
478 * 0x00: Off-line
479 * 0x01: On-line
480 * 0x02: On backup power (BIOS >= 1.1 only)
481 * 0xff: Unknown
482 * 4) Battery status
483 * 0x00: High
484 * 0x01: Low
485 * 0x02: Critical
486 * 0x03: Charging
487 * 0x04: Selected battery not present (BIOS >= 1.2 only)
488 * 0xff: Unknown
489 * 5) Battery flag
490 * bit 0: High
491 * bit 1: Low
492 * bit 2: Critical
493 * bit 3: Charging
494 * bit 7: No system battery
495 * 0xff: Unknown
496 * 6) Remaining battery life (percentage of charge):
497 * 0-100: valid
498 * -1: Unknown
499 * 7) Remaining battery life (time units):
500 * Number of remaining minutes or seconds
501 * -1: Unknown
502 * 8) min = minutes; sec = seconds
503 */
504static int apm_get_info(char *buf, char **start, off_t fpos, int length)
505{
506 struct apm_power_info info;
507 char *units;
508 int ret;
509
510 info.ac_line_status = 0xff;
511 info.battery_status = 0xff;
512 info.battery_flag = 0xff;
513 info.battery_life = -1;
514 info.time = -1;
515 info.units = -1;
516
517 if (apm_get_power_status)
518 apm_get_power_status(&info);
519
520 switch (info.units) {
521 default: units = "?"; break;
522 case 0: units = "min"; break;
523 case 1: units = "sec"; break;
524 }
525
526 ret = sprintf(buf, "%s 1.2 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
527 driver_version, APM_32_BIT_SUPPORT,
528 info.ac_line_status, info.battery_status,
529 info.battery_flag, info.battery_life,
530 info.time, units);
531
532 return ret;
533}
534#endif
535
536static int kapmd(void *arg)
537{
538 do {
539 apm_event_t event;
540 int ret;
541
542 wait_event_interruptible(kapmd_wait,
543 !queue_empty(&kapmd_queue) || kthread_should_stop());
544
545 if (kthread_should_stop())
546 break;
547
548 spin_lock_irq(&kapmd_queue_lock);
549 event = 0;
550 if (!queue_empty(&kapmd_queue))
551 event = queue_get_event(&kapmd_queue);
552 spin_unlock_irq(&kapmd_queue_lock);
553
554 switch (event) {
555 case 0:
556 break;
557
558 case APM_LOW_BATTERY:
559 case APM_POWER_STATUS_CHANGE:
560 queue_event(event);
561 break;
562
563 case APM_USER_SUSPEND:
564 case APM_SYS_SUSPEND:
565 ret = queue_suspend_event(event, NULL);
566 if (ret < 0) {
567 /*
568 * We were busy. Try again in 50ms.
569 */
570 queue_add_event(&kapmd_queue, event);
571 msleep(50);
572 }
573 if (ret > 0)
574 apm_suspend();
575 break;
576
577 case APM_CRITICAL_SUSPEND:
578 apm_suspend();
579 break;
580 }
581 } while (1);
582
583 return 0;
584}
585
586static int __init apm_init(void)
587{
588 int ret;
589
590 if (apm_disabled) {
591 printk(KERN_NOTICE "apm: disabled on user request.\n");
592 return -ENODEV;
593 }
594
595 kapmd_tsk = kthread_create(kapmd, NULL, "kapmd");
596 if (IS_ERR(kapmd_tsk)) {
597 ret = PTR_ERR(kapmd_tsk);
598 kapmd_tsk = NULL;
599 return ret;
600 }
601 kapmd_tsk->flags |= PF_NOFREEZE;
602 wake_up_process(kapmd_tsk);
603
604#ifdef CONFIG_PROC_FS
605 create_proc_info_entry("apm", 0, NULL, apm_get_info);
606#endif
607
608 ret = misc_register(&apm_device);
609 if (ret != 0) {
610 remove_proc_entry("apm", NULL);
611 kthread_stop(kapmd_tsk);
612 }
613
614 return ret;
615}
616
617static void __exit apm_exit(void)
618{
619 misc_deregister(&apm_device);
620 remove_proc_entry("apm", NULL);
621
622 kthread_stop(kapmd_tsk);
623}
624
625module_init(apm_init);
626module_exit(apm_exit);
627
628MODULE_AUTHOR("Stephen Rothwell");
629MODULE_DESCRIPTION("Advanced Power Management");
630MODULE_LICENSE("GPL");
631
632#ifndef MODULE
633static int __init apm_setup(char *str)
634{
635 while ((str != NULL) && (*str != '\0')) {
636 if (strncmp(str, "off", 3) == 0)
637 apm_disabled = 1;
638 if (strncmp(str, "on", 2) == 0)
639 apm_disabled = 0;
640 str = strchr(str, ',');
641 if (str != NULL)
642 str += strspn(str, ", \t");
643 }
644 return 1;
645}
646
647__setup("apm=", apm_setup);
648#endif
649
650/**
651 * apm_queue_event - queue an APM event for kapmd
652 * @event: APM event
653 *
654 * Queue an APM event for kapmd to process and ultimately take the
655 * appropriate action. Only a subset of events are handled:
656 * %APM_LOW_BATTERY
657 * %APM_POWER_STATUS_CHANGE
658 * %APM_USER_SUSPEND
659 * %APM_SYS_SUSPEND
660 * %APM_CRITICAL_SUSPEND
661 */
662void apm_queue_event(apm_event_t event)
663{
664 unsigned long flags;
665
666 spin_lock_irqsave(&kapmd_queue_lock, flags);
667 queue_add_event(&kapmd_queue, event);
668 spin_unlock_irqrestore(&kapmd_queue_lock, flags);
669
670 wake_up_interruptible(&kapmd_wait);
671}
672EXPORT_SYMBOL(apm_queue_event);
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 4c3de4008a43..165017de8d0d 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -16,7 +16,7 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <asm/apm.h> 19#include <asm/apm-emulation.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/hardware.h> 22#include <asm/hardware.h>
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index db6e8f56a75f..b1d8cfca245a 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -23,7 +23,7 @@
23 23
24#include <asm/hardware.h> 24#include <asm/hardware.h>
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/apm.h> 26#include <asm/apm-emulation.h>
27#include <asm/arch/pm.h> 27#include <asm/arch/pm.h>
28#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
29#include <asm/arch/sharpsl.h> 29#include <asm/arch/sharpsl.h>
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 40be833079c7..b97d543d9364 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -16,7 +16,7 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <asm/apm.h> 19#include <asm/apm-emulation.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/hardware.h> 22#include <asm/hardware.h>
diff --git a/arch/avr32/boards/atstk1000/Makefile b/arch/avr32/boards/atstk1000/Makefile
index df9499480530..8e0992201bb9 100644
--- a/arch/avr32/boards/atstk1000/Makefile
+++ b/arch/avr32/boards/atstk1000/Makefile
@@ -1,2 +1,2 @@
1obj-y += setup.o spi.o flash.o 1obj-y += setup.o flash.o
2obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o 2obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 32b361f31c2c..d47e39f0e971 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -8,17 +8,24 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/device.h>
11#include <linux/etherdevice.h> 12#include <linux/etherdevice.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/spi/spi.h>
17 19
18#include <asm/io.h> 20#include <asm/io.h>
19#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/arch/at32ap7000.h>
20#include <asm/arch/board.h> 23#include <asm/arch/board.h>
21#include <asm/arch/init.h> 24#include <asm/arch/init.h>
25#include <asm/arch/portmux.h>
26
27
28#define SW2_DEFAULT /* MMCI and UART_A available */
22 29
23struct eth_addr { 30struct eth_addr {
24 u8 addr[6]; 31 u8 addr[6];
@@ -29,6 +36,16 @@ static struct eth_addr __initdata hw_addr[2];
29static struct eth_platform_data __initdata eth_data[2]; 36static struct eth_platform_data __initdata eth_data[2];
30extern struct lcdc_platform_data atstk1000_fb0_data; 37extern struct lcdc_platform_data atstk1000_fb0_data;
31 38
39static struct spi_board_info spi_board_info[] __initdata = {
40 {
41 .modalias = "ltv350qv",
42 .controller_data = (void *)GPIO_PIN_PA(4),
43 .max_speed_hz = 16000000,
44 .bus_num = 0,
45 .chip_select = 1,
46 },
47};
48
32/* 49/*
33 * The next two functions should go away as the boot loader is 50 * The next two functions should go away as the boot loader is
34 * supposed to initialize the macb address registers with a valid 51 * supposed to initialize the macb address registers with a valid
@@ -86,23 +103,53 @@ static void __init set_hw_addr(struct platform_device *pdev)
86 103
87void __init setup_board(void) 104void __init setup_board(void)
88{ 105{
89 at32_map_usart(1, 0); /* /dev/ttyS0 */ 106#ifdef SW2_DEFAULT
90 at32_map_usart(2, 1); /* /dev/ttyS1 */ 107 at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
91 at32_map_usart(3, 2); /* /dev/ttyS2 */ 108#else
109 at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
110#endif
111 /* USART 2/unused: expansion connector */
112 at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */
92 113
93 at32_setup_serial_console(0); 114 at32_setup_serial_console(0);
94} 115}
95 116
96static int __init atstk1002_init(void) 117static int __init atstk1002_init(void)
97{ 118{
119 /*
120 * ATSTK1000 uses 32-bit SDRAM interface. Reserve the
121 * SDRAM-specific pins so that nobody messes with them.
122 */
123 at32_reserve_pin(GPIO_PIN_PE(0)); /* DATA[16] */
124 at32_reserve_pin(GPIO_PIN_PE(1)); /* DATA[17] */
125 at32_reserve_pin(GPIO_PIN_PE(2)); /* DATA[18] */
126 at32_reserve_pin(GPIO_PIN_PE(3)); /* DATA[19] */
127 at32_reserve_pin(GPIO_PIN_PE(4)); /* DATA[20] */
128 at32_reserve_pin(GPIO_PIN_PE(5)); /* DATA[21] */
129 at32_reserve_pin(GPIO_PIN_PE(6)); /* DATA[22] */
130 at32_reserve_pin(GPIO_PIN_PE(7)); /* DATA[23] */
131 at32_reserve_pin(GPIO_PIN_PE(8)); /* DATA[24] */
132 at32_reserve_pin(GPIO_PIN_PE(9)); /* DATA[25] */
133 at32_reserve_pin(GPIO_PIN_PE(10)); /* DATA[26] */
134 at32_reserve_pin(GPIO_PIN_PE(11)); /* DATA[27] */
135 at32_reserve_pin(GPIO_PIN_PE(12)); /* DATA[28] */
136 at32_reserve_pin(GPIO_PIN_PE(13)); /* DATA[29] */
137 at32_reserve_pin(GPIO_PIN_PE(14)); /* DATA[30] */
138 at32_reserve_pin(GPIO_PIN_PE(15)); /* DATA[31] */
139 at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */
140
98 at32_add_system_devices(); 141 at32_add_system_devices();
99 142
143#ifdef SW2_DEFAULT
100 at32_add_device_usart(0); 144 at32_add_device_usart(0);
145#else
101 at32_add_device_usart(1); 146 at32_add_device_usart(1);
147#endif
102 at32_add_device_usart(2); 148 at32_add_device_usart(2);
103 149
104 set_hw_addr(at32_add_device_eth(0, &eth_data[0])); 150 set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
105 151
152 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
106 at32_add_device_spi(0); 153 at32_add_device_spi(0);
107 at32_add_device_lcdc(0, &atstk1000_fb0_data); 154 at32_add_device_lcdc(0, &atstk1000_fb0_data);
108 155
diff --git a/arch/avr32/boards/atstk1000/spi.c b/arch/avr32/boards/atstk1000/spi.c
deleted file mode 100644
index 567726c82c6e..000000000000
--- a/arch/avr32/boards/atstk1000/spi.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * ATSTK1000 SPI devices
3 *
4 * Copyright (C) 2005 Atmel Norway
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/device.h>
11#include <linux/spi/spi.h>
12
13static struct spi_board_info spi_board_info[] __initdata = {
14 {
15 .modalias = "ltv350qv",
16 .max_speed_hz = 16000000,
17 .bus_num = 0,
18 .chip_select = 1,
19 },
20};
21
22static int board_init_spi(void)
23{
24 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
25 return 0;
26}
27arch_initcall(board_init_spi);
diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c
index 342452ba2049..2e72fd2699df 100644
--- a/arch/avr32/kernel/cpu.c
+++ b/arch/avr32/kernel/cpu.c
@@ -9,6 +9,7 @@
9#include <linux/sysdev.h> 9#include <linux/sysdev.h>
10#include <linux/seq_file.h> 10#include <linux/seq_file.h>
11#include <linux/cpu.h> 11#include <linux/cpu.h>
12#include <linux/module.h>
12#include <linux/percpu.h> 13#include <linux/percpu.h>
13#include <linux/param.h> 14#include <linux/param.h>
14#include <linux/errno.h> 15#include <linux/errno.h>
diff --git a/arch/avr32/kernel/irq.c b/arch/avr32/kernel/irq.c
index 856f3548e664..fd311248c143 100644
--- a/arch/avr32/kernel/irq.c
+++ b/arch/avr32/kernel/irq.c
@@ -57,6 +57,7 @@ int show_interrupts(struct seq_file *p, void *v)
57 seq_printf(p, "%3d: ", i); 57 seq_printf(p, "%3d: ", i);
58 for_each_online_cpu(cpu) 58 for_each_online_cpu(cpu)
59 seq_printf(p, "%10u ", kstat_cpu(cpu).irqs[i]); 59 seq_printf(p, "%10u ", kstat_cpu(cpu).irqs[i]);
60 seq_printf(p, " %8s", irq_desc[i].chip->name ? : "-");
60 seq_printf(p, " %s", action->name); 61 seq_printf(p, " %s", action->name);
61 for (action = action->next; action; action = action->next) 62 for (action = action->next; action; action = action->next)
62 seq_printf(p, ", %s", action->name); 63 seq_printf(p, ", %s", action->name);
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index a34211601008..c6734aefb559 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/root_dev.h> 17#include <linux/root_dev.h>
18#include <linux/cpu.h> 18#include <linux/cpu.h>
19#include <linux/kernel.h>
19 20
20#include <asm/sections.h> 21#include <asm/sections.h>
21#include <asm/processor.h> 22#include <asm/processor.h>
@@ -174,8 +175,7 @@ static int __init parse_tag_mem_range(struct tag *tag,
174 * Copy the data so the bootmem init code doesn't need to care 175 * Copy the data so the bootmem init code doesn't need to care
175 * about it. 176 * about it.
176 */ 177 */
177 if (mem_range_next_free >= 178 if (mem_range_next_free >= ARRAY_SIZE(mem_range_cache))
178 (sizeof(mem_range_cache) / sizeof(mem_range_cache[0])))
179 panic("Physical memory map too complex!\n"); 179 panic("Physical memory map too complex!\n");
180 180
181 new = &mem_range_cache[mem_range_next_free++]; 181 new = &mem_range_cache[mem_range_next_free++];
diff --git a/arch/avr32/lib/libgcc.h b/arch/avr32/lib/libgcc.h
deleted file mode 100644
index 5a091b5e3618..000000000000
--- a/arch/avr32/lib/libgcc.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* Definitions for various functions 'borrowed' from gcc-3.4.3 */
2
3#define BITS_PER_UNIT 8
4
5typedef int QItype __attribute__ ((mode (QI)));
6typedef unsigned int UQItype __attribute__ ((mode (QI)));
7typedef int HItype __attribute__ ((mode (HI)));
8typedef unsigned int UHItype __attribute__ ((mode (HI)));
9typedef int SItype __attribute__ ((mode (SI)));
10typedef unsigned int USItype __attribute__ ((mode (SI)));
11typedef int DItype __attribute__ ((mode (DI)));
12typedef unsigned int UDItype __attribute__ ((mode (DI)));
13typedef float SFtype __attribute__ ((mode (SF)));
14typedef float DFtype __attribute__ ((mode (DF)));
15typedef int word_type __attribute__ ((mode (__word__)));
16
17#define W_TYPE_SIZE (4 * BITS_PER_UNIT)
18#define Wtype SItype
19#define UWtype USItype
20#define HWtype SItype
21#define UHWtype USItype
22#define DWtype DItype
23#define UDWtype UDItype
24#define __NW(a,b) __ ## a ## si ## b
25#define __NDW(a,b) __ ## a ## di ## b
26
27struct DWstruct {Wtype high, low;};
28
29typedef union
30{
31 struct DWstruct s;
32 DWtype ll;
33} DWunion;
diff --git a/arch/avr32/lib/longlong.h b/arch/avr32/lib/longlong.h
deleted file mode 100644
index cd5e369ac437..000000000000
--- a/arch/avr32/lib/longlong.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
2 Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000
3 Free Software Foundation, Inc.
4
5 This definition file is free software; you can redistribute it
6 and/or modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2, or (at your option) any later version.
9
10 This definition file is distributed in the hope that it will be
11 useful, but WITHOUT ANY WARRANTY; without even the implied
12 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19
20/* Borrowed from gcc-3.4.3 */
21
22#define __BITS4 (W_TYPE_SIZE / 4)
23#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2))
24#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
25#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2))
26
27#define count_leading_zeros(count, x) ((count) = __builtin_clz(x))
28
29#define __udiv_qrnnd_c(q, r, n1, n0, d) \
30 do { \
31 UWtype __d1, __d0, __q1, __q0; \
32 UWtype __r1, __r0, __m; \
33 __d1 = __ll_highpart (d); \
34 __d0 = __ll_lowpart (d); \
35 \
36 __r1 = (n1) % __d1; \
37 __q1 = (n1) / __d1; \
38 __m = (UWtype) __q1 * __d0; \
39 __r1 = __r1 * __ll_B | __ll_highpart (n0); \
40 if (__r1 < __m) \
41 { \
42 __q1--, __r1 += (d); \
43 if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\
44 if (__r1 < __m) \
45 __q1--, __r1 += (d); \
46 } \
47 __r1 -= __m; \
48 \
49 __r0 = __r1 % __d1; \
50 __q0 = __r1 / __d1; \
51 __m = (UWtype) __q0 * __d0; \
52 __r0 = __r0 * __ll_B | __ll_lowpart (n0); \
53 if (__r0 < __m) \
54 { \
55 __q0--, __r0 += (d); \
56 if (__r0 >= (d)) \
57 if (__r0 < __m) \
58 __q0--, __r0 += (d); \
59 } \
60 __r0 -= __m; \
61 \
62 (q) = (UWtype) __q1 * __ll_B | __q0; \
63 (r) = __r0; \
64 } while (0)
65
66#define udiv_qrnnd __udiv_qrnnd_c
67
68#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
69 do { \
70 UWtype __x; \
71 __x = (al) - (bl); \
72 (sh) = (ah) - (bh) - (__x > (al)); \
73 (sl) = __x; \
74 } while (0)
75
76#define umul_ppmm(w1, w0, u, v) \
77 do { \
78 UWtype __x0, __x1, __x2, __x3; \
79 UHWtype __ul, __vl, __uh, __vh; \
80 \
81 __ul = __ll_lowpart (u); \
82 __uh = __ll_highpart (u); \
83 __vl = __ll_lowpart (v); \
84 __vh = __ll_highpart (v); \
85 \
86 __x0 = (UWtype) __ul * __vl; \
87 __x1 = (UWtype) __ul * __vh; \
88 __x2 = (UWtype) __uh * __vl; \
89 __x3 = (UWtype) __uh * __vh; \
90 \
91 __x1 += __ll_highpart (__x0);/* this can't give carry */ \
92 __x1 += __x2; /* but this indeed can */ \
93 if (__x1 < __x2) /* did we get it? */ \
94 __x3 += __ll_B; /* yes, add it in the proper pos. */ \
95 \
96 (w1) = __x3 + __ll_highpart (__x1); \
97 (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \
98 } while (0)
diff --git a/arch/avr32/mach-at32ap/Makefile b/arch/avr32/mach-at32ap/Makefile
index f62eb6915510..b21bea9af8b1 100644
--- a/arch/avr32/mach-at32ap/Makefile
+++ b/arch/avr32/mach-at32ap/Makefile
@@ -1,2 +1,2 @@
1obj-y += at32ap.o clock.o pio.o intc.o extint.o hsmc.o 1obj-y += at32ap.o clock.o intc.o extint.o pio.o hsmc.o
2obj-$(CONFIG_CPU_AT32AP7000) += at32ap7000.o 2obj-$(CONFIG_CPU_AT32AP7000) += at32ap7000.o
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index 48f4ef38c70e..c1e477ec7576 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -496,9 +496,16 @@ static struct resource pio3_resource[] = {
496DEFINE_DEV(pio, 3); 496DEFINE_DEV(pio, 3);
497DEV_CLK(mck, pio3, pba, 13); 497DEV_CLK(mck, pio3, pba, 13);
498 498
499static struct resource pio4_resource[] = {
500 PBMEM(0xffe03800),
501 IRQ(17),
502};
503DEFINE_DEV(pio, 4);
504DEV_CLK(mck, pio4, pba, 14);
505
499void __init at32_add_system_devices(void) 506void __init at32_add_system_devices(void)
500{ 507{
501 system_manager.eim_first_irq = NR_INTERNAL_IRQS; 508 system_manager.eim_first_irq = EIM_IRQ_BASE;
502 509
503 platform_device_register(&at32_sm_device); 510 platform_device_register(&at32_sm_device);
504 platform_device_register(&at32_intc0_device); 511 platform_device_register(&at32_intc0_device);
@@ -509,6 +516,7 @@ void __init at32_add_system_devices(void)
509 platform_device_register(&pio1_device); 516 platform_device_register(&pio1_device);
510 platform_device_register(&pio2_device); 517 platform_device_register(&pio2_device);
511 platform_device_register(&pio3_device); 518 platform_device_register(&pio3_device);
519 platform_device_register(&pio4_device);
512} 520}
513 521
514/* -------------------------------------------------------------------- 522/* --------------------------------------------------------------------
@@ -521,7 +529,7 @@ static struct atmel_uart_data atmel_usart0_data = {
521}; 529};
522static struct resource atmel_usart0_resource[] = { 530static struct resource atmel_usart0_resource[] = {
523 PBMEM(0xffe00c00), 531 PBMEM(0xffe00c00),
524 IRQ(7), 532 IRQ(6),
525}; 533};
526DEFINE_DEV_DATA(atmel_usart, 0); 534DEFINE_DEV_DATA(atmel_usart, 0);
527DEV_CLK(usart, atmel_usart0, pba, 4); 535DEV_CLK(usart, atmel_usart0, pba, 4);
@@ -583,7 +591,7 @@ static inline void configure_usart3_pins(void)
583 select_peripheral(PB(17), PERIPH_B, 0); /* TXD */ 591 select_peripheral(PB(17), PERIPH_B, 0); /* TXD */
584} 592}
585 593
586static struct platform_device *at32_usarts[4]; 594static struct platform_device *__initdata at32_usarts[4];
587 595
588void __init at32_map_usart(unsigned int hw_id, unsigned int line) 596void __init at32_map_usart(unsigned int hw_id, unsigned int line)
589{ 597{
@@ -728,12 +736,19 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
728/* -------------------------------------------------------------------- 736/* --------------------------------------------------------------------
729 * SPI 737 * SPI
730 * -------------------------------------------------------------------- */ 738 * -------------------------------------------------------------------- */
731static struct resource spi0_resource[] = { 739static struct resource atmel_spi0_resource[] = {
732 PBMEM(0xffe00000), 740 PBMEM(0xffe00000),
733 IRQ(3), 741 IRQ(3),
734}; 742};
735DEFINE_DEV(spi, 0); 743DEFINE_DEV(atmel_spi, 0);
736DEV_CLK(mck, spi0, pba, 0); 744DEV_CLK(spi_clk, atmel_spi0, pba, 0);
745
746static struct resource atmel_spi1_resource[] = {
747 PBMEM(0xffe00400),
748 IRQ(4),
749};
750DEFINE_DEV(atmel_spi, 1);
751DEV_CLK(spi_clk, atmel_spi1, pba, 1);
737 752
738struct platform_device *__init at32_add_device_spi(unsigned int id) 753struct platform_device *__init at32_add_device_spi(unsigned int id)
739{ 754{
@@ -741,13 +756,33 @@ struct platform_device *__init at32_add_device_spi(unsigned int id)
741 756
742 switch (id) { 757 switch (id) {
743 case 0: 758 case 0:
744 pdev = &spi0_device; 759 pdev = &atmel_spi0_device;
745 select_peripheral(PA(0), PERIPH_A, 0); /* MISO */ 760 select_peripheral(PA(0), PERIPH_A, 0); /* MISO */
746 select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */ 761 select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */
747 select_peripheral(PA(2), PERIPH_A, 0); /* SCK */ 762 select_peripheral(PA(2), PERIPH_A, 0); /* SCK */
748 select_peripheral(PA(3), PERIPH_A, 0); /* NPCS0 */ 763
749 select_peripheral(PA(4), PERIPH_A, 0); /* NPCS1 */ 764 /* NPCS[2:0] */
750 select_peripheral(PA(5), PERIPH_A, 0); /* NPCS2 */ 765 at32_select_gpio(GPIO_PIN_PA(3),
766 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
767 at32_select_gpio(GPIO_PIN_PA(4),
768 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
769 at32_select_gpio(GPIO_PIN_PA(5),
770 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
771 break;
772
773 case 1:
774 pdev = &atmel_spi1_device;
775 select_peripheral(PB(0), PERIPH_B, 0); /* MISO */
776 select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */
777 select_peripheral(PB(5), PERIPH_B, 0); /* SCK */
778
779 /* NPCS[2:0] */
780 at32_select_gpio(GPIO_PIN_PB(2),
781 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
782 at32_select_gpio(GPIO_PIN_PB(3),
783 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
784 at32_select_gpio(GPIO_PIN_PB(4),
785 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
751 break; 786 break;
752 787
753 default: 788 default:
@@ -860,6 +895,7 @@ struct clk *at32_clock_list[] = {
860 &pio1_mck, 895 &pio1_mck,
861 &pio2_mck, 896 &pio2_mck,
862 &pio3_mck, 897 &pio3_mck,
898 &pio4_mck,
863 &atmel_usart0_usart, 899 &atmel_usart0_usart,
864 &atmel_usart1_usart, 900 &atmel_usart1_usart,
865 &atmel_usart2_usart, 901 &atmel_usart2_usart,
@@ -868,7 +904,8 @@ struct clk *at32_clock_list[] = {
868 &macb0_pclk, 904 &macb0_pclk,
869 &macb1_hclk, 905 &macb1_hclk,
870 &macb1_pclk, 906 &macb1_pclk,
871 &spi0_mck, 907 &atmel_spi0_spi_clk,
908 &atmel_spi1_spi_clk,
872 &lcdc0_hclk, 909 &lcdc0_hclk,
873 &lcdc0_pixclk, 910 &lcdc0_pixclk,
874}; 911};
@@ -880,6 +917,7 @@ void __init at32_portmux_init(void)
880 at32_init_pio(&pio1_device); 917 at32_init_pio(&pio1_device);
881 at32_init_pio(&pio2_device); 918 at32_init_pio(&pio2_device);
882 at32_init_pio(&pio3_device); 919 at32_init_pio(&pio3_device);
920 at32_init_pio(&pio4_device);
883} 921}
884 922
885void __init at32_clock_init(void) 923void __init at32_clock_init(void)
diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c
index b59272e81b9a..4a60eccfebd2 100644
--- a/arch/avr32/mach-at32ap/extint.c
+++ b/arch/avr32/mach-at32ap/extint.c
@@ -55,20 +55,11 @@ static int eim_set_irq_type(unsigned int irq, unsigned int flow_type)
55 unsigned long flags; 55 unsigned long flags;
56 int ret = 0; 56 int ret = 0;
57 57
58 flow_type &= IRQ_TYPE_SENSE_MASK;
58 if (flow_type == IRQ_TYPE_NONE) 59 if (flow_type == IRQ_TYPE_NONE)
59 flow_type = IRQ_TYPE_LEVEL_LOW; 60 flow_type = IRQ_TYPE_LEVEL_LOW;
60 61
61 desc = &irq_desc[irq]; 62 desc = &irq_desc[irq];
62 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
63 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
64
65 if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) {
66 desc->status |= IRQ_LEVEL;
67 set_irq_handler(irq, handle_level_irq);
68 } else {
69 set_irq_handler(irq, handle_edge_irq);
70 }
71
72 spin_lock_irqsave(&sm->lock, flags); 63 spin_lock_irqsave(&sm->lock, flags);
73 64
74 mode = sm_readl(sm, EIM_MODE); 65 mode = sm_readl(sm, EIM_MODE);
@@ -97,9 +88,16 @@ static int eim_set_irq_type(unsigned int irq, unsigned int flow_type)
97 break; 88 break;
98 } 89 }
99 90
100 sm_writel(sm, EIM_MODE, mode); 91 if (ret == 0) {
101 sm_writel(sm, EIM_EDGE, edge); 92 sm_writel(sm, EIM_MODE, mode);
102 sm_writel(sm, EIM_LEVEL, level); 93 sm_writel(sm, EIM_EDGE, edge);
94 sm_writel(sm, EIM_LEVEL, level);
95
96 if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
97 flow_type |= IRQ_LEVEL;
98 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
99 desc->status |= flow_type;
100 }
103 101
104 spin_unlock_irqrestore(&sm->lock, flags); 102 spin_unlock_irqrestore(&sm->lock, flags);
105 103
@@ -122,8 +120,6 @@ static void demux_eim_irq(unsigned int irq, struct irq_desc *desc)
122 unsigned long status, pending; 120 unsigned long status, pending;
123 unsigned int i, ext_irq; 121 unsigned int i, ext_irq;
124 122
125 spin_lock(&sm->lock);
126
127 status = sm_readl(sm, EIM_ISR); 123 status = sm_readl(sm, EIM_ISR);
128 pending = status & sm_readl(sm, EIM_IMR); 124 pending = status & sm_readl(sm, EIM_IMR);
129 125
@@ -133,10 +129,11 @@ static void demux_eim_irq(unsigned int irq, struct irq_desc *desc)
133 129
134 ext_irq = i + sm->eim_first_irq; 130 ext_irq = i + sm->eim_first_irq;
135 ext_desc = irq_desc + ext_irq; 131 ext_desc = irq_desc + ext_irq;
136 ext_desc->handle_irq(ext_irq, ext_desc); 132 if (ext_desc->status & IRQ_LEVEL)
133 handle_level_irq(ext_irq, ext_desc);
134 else
135 handle_edge_irq(ext_irq, ext_desc);
137 } 136 }
138
139 spin_unlock(&sm->lock);
140} 137}
141 138
142static int __init eim_init(void) 139static int __init eim_init(void)
@@ -168,8 +165,9 @@ static int __init eim_init(void)
168 sm->eim_chip = &eim_chip; 165 sm->eim_chip = &eim_chip;
169 166
170 for (i = 0; i < nr_irqs; i++) { 167 for (i = 0; i < nr_irqs; i++) {
168 /* NOTE the handler we set here is ignored by the demux */
171 set_irq_chip_and_handler(sm->eim_first_irq + i, &eim_chip, 169 set_irq_chip_and_handler(sm->eim_first_irq + i, &eim_chip,
172 handle_edge_irq); 170 handle_level_irq);
173 set_irq_chip_data(sm->eim_first_irq + i, sm); 171 set_irq_chip_data(sm->eim_first_irq + i, sm);
174 } 172 }
175 173
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index f1280ed8ed6d..9ba5654cde11 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -12,7 +12,9 @@
12#include <linux/debugfs.h> 12#include <linux/debugfs.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/irq.h>
15 16
17#include <asm/gpio.h>
16#include <asm/io.h> 18#include <asm/io.h>
17 19
18#include <asm/arch/portmux.h> 20#include <asm/arch/portmux.h>
@@ -26,7 +28,8 @@ struct pio_device {
26 const struct platform_device *pdev; 28 const struct platform_device *pdev;
27 struct clk *clk; 29 struct clk *clk;
28 u32 pinmux_mask; 30 u32 pinmux_mask;
29 char name[32]; 31 u32 gpio_mask;
32 char name[8];
30}; 33};
31 34
32static struct pio_device pio_dev[MAX_NR_PIO_DEVICES]; 35static struct pio_device pio_dev[MAX_NR_PIO_DEVICES];
@@ -76,6 +79,9 @@ void __init at32_select_periph(unsigned int pin, unsigned int periph,
76 if (!(flags & AT32_GPIOF_PULLUP)) 79 if (!(flags & AT32_GPIOF_PULLUP))
77 pio_writel(pio, PUDR, mask); 80 pio_writel(pio, PUDR, mask);
78 81
82 /* gpio_request NOT allowed */
83 set_bit(pin_index, &pio->gpio_mask);
84
79 return; 85 return;
80 86
81fail: 87fail:
@@ -99,19 +105,52 @@ void __init at32_select_gpio(unsigned int pin, unsigned long flags)
99 goto fail; 105 goto fail;
100 } 106 }
101 107
102 pio_writel(pio, PUER, mask); 108 if (flags & AT32_GPIOF_OUTPUT) {
103 if (flags & AT32_GPIOF_HIGH) 109 if (flags & AT32_GPIOF_HIGH)
104 pio_writel(pio, SODR, mask); 110 pio_writel(pio, SODR, mask);
105 else 111 else
106 pio_writel(pio, CODR, mask); 112 pio_writel(pio, CODR, mask);
107 if (flags & AT32_GPIOF_OUTPUT) 113 pio_writel(pio, PUDR, mask);
108 pio_writel(pio, OER, mask); 114 pio_writel(pio, OER, mask);
109 else 115 } else {
116 if (flags & AT32_GPIOF_PULLUP)
117 pio_writel(pio, PUER, mask);
118 else
119 pio_writel(pio, PUDR, mask);
120 if (flags & AT32_GPIOF_DEGLITCH)
121 pio_writel(pio, IFER, mask);
122 else
123 pio_writel(pio, IFDR, mask);
110 pio_writel(pio, ODR, mask); 124 pio_writel(pio, ODR, mask);
125 }
111 126
112 pio_writel(pio, PER, mask); 127 pio_writel(pio, PER, mask);
113 if (!(flags & AT32_GPIOF_PULLUP)) 128
114 pio_writel(pio, PUDR, mask); 129 /* gpio_request now allowed */
130 clear_bit(pin_index, &pio->gpio_mask);
131
132 return;
133
134fail:
135 dump_stack();
136}
137
138/* Reserve a pin, preventing anyone else from changing its configuration. */
139void __init at32_reserve_pin(unsigned int pin)
140{
141 struct pio_device *pio;
142 unsigned int pin_index = pin & 0x1f;
143
144 pio = gpio_to_pio(pin);
145 if (unlikely(!pio)) {
146 printk("pio: invalid pin %u\n", pin);
147 goto fail;
148 }
149
150 if (unlikely(test_and_set_bit(pin_index, &pio->pinmux_mask))) {
151 printk("%s: pin %u is busy\n", pio->name, pin_index);
152 goto fail;
153 }
115 154
116 return; 155 return;
117 156
@@ -119,20 +158,197 @@ fail:
119 dump_stack(); 158 dump_stack();
120} 159}
121 160
161/*--------------------------------------------------------------------------*/
162
163/* GPIO API */
164
165int gpio_request(unsigned int gpio, const char *label)
166{
167 struct pio_device *pio;
168 unsigned int pin;
169
170 pio = gpio_to_pio(gpio);
171 if (!pio)
172 return -ENODEV;
173
174 pin = gpio & 0x1f;
175 if (test_and_set_bit(pin, &pio->gpio_mask))
176 return -EBUSY;
177
178 return 0;
179}
180EXPORT_SYMBOL(gpio_request);
181
182void gpio_free(unsigned int gpio)
183{
184 struct pio_device *pio;
185 unsigned int pin;
186
187 pio = gpio_to_pio(gpio);
188 if (!pio) {
189 printk(KERN_ERR
190 "gpio: attempted to free invalid pin %u\n", gpio);
191 return;
192 }
193
194 pin = gpio & 0x1f;
195 if (!test_and_clear_bit(pin, &pio->gpio_mask))
196 printk(KERN_ERR "gpio: freeing free or non-gpio pin %s-%u\n",
197 pio->name, pin);
198}
199EXPORT_SYMBOL(gpio_free);
200
201int gpio_direction_input(unsigned int gpio)
202{
203 struct pio_device *pio;
204 unsigned int pin;
205
206 pio = gpio_to_pio(gpio);
207 if (!pio)
208 return -ENODEV;
209
210 pin = gpio & 0x1f;
211 pio_writel(pio, ODR, 1 << pin);
212
213 return 0;
214}
215EXPORT_SYMBOL(gpio_direction_input);
216
217int gpio_direction_output(unsigned int gpio)
218{
219 struct pio_device *pio;
220 unsigned int pin;
221
222 pio = gpio_to_pio(gpio);
223 if (!pio)
224 return -ENODEV;
225
226 pin = gpio & 0x1f;
227 pio_writel(pio, OER, 1 << pin);
228
229 return 0;
230}
231EXPORT_SYMBOL(gpio_direction_output);
232
233int gpio_get_value(unsigned int gpio)
234{
235 struct pio_device *pio = &pio_dev[gpio >> 5];
236
237 return (pio_readl(pio, PDSR) >> (gpio & 0x1f)) & 1;
238}
239EXPORT_SYMBOL(gpio_get_value);
240
241void gpio_set_value(unsigned int gpio, int value)
242{
243 struct pio_device *pio = &pio_dev[gpio >> 5];
244 u32 mask;
245
246 mask = 1 << (gpio & 0x1f);
247 if (value)
248 pio_writel(pio, SODR, mask);
249 else
250 pio_writel(pio, CODR, mask);
251}
252EXPORT_SYMBOL(gpio_set_value);
253
254/*--------------------------------------------------------------------------*/
255
256/* GPIO IRQ support */
257
258static void gpio_irq_mask(unsigned irq)
259{
260 unsigned gpio = irq_to_gpio(irq);
261 struct pio_device *pio = &pio_dev[gpio >> 5];
262
263 pio_writel(pio, IDR, 1 << (gpio & 0x1f));
264}
265
266static void gpio_irq_unmask(unsigned irq)
267{
268 unsigned gpio = irq_to_gpio(irq);
269 struct pio_device *pio = &pio_dev[gpio >> 5];
270
271 pio_writel(pio, IER, 1 << (gpio & 0x1f));
272}
273
274static int gpio_irq_type(unsigned irq, unsigned type)
275{
276 if (type != IRQ_TYPE_EDGE_BOTH && type != IRQ_TYPE_NONE)
277 return -EINVAL;
278
279 return 0;
280}
281
282static struct irq_chip gpio_irqchip = {
283 .name = "gpio",
284 .mask = gpio_irq_mask,
285 .unmask = gpio_irq_unmask,
286 .set_type = gpio_irq_type,
287};
288
289static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
290{
291 struct pio_device *pio = get_irq_chip_data(irq);
292 unsigned gpio_irq;
293
294 gpio_irq = (unsigned) get_irq_data(irq);
295 for (;;) {
296 u32 isr;
297 struct irq_desc *d;
298
299 /* ack pending GPIO interrupts */
300 isr = pio_readl(pio, ISR) & pio_readl(pio, IMR);
301 if (!isr)
302 break;
303 do {
304 int i;
305
306 i = ffs(isr) - 1;
307 isr &= ~(1 << i);
308
309 i += gpio_irq;
310 d = &irq_desc[i];
311
312 d->handle_irq(i, d);
313 } while (isr);
314 }
315}
316
317static void __init
318gpio_irq_setup(struct pio_device *pio, int irq, int gpio_irq)
319{
320 unsigned i;
321
322 set_irq_chip_data(irq, pio);
323 set_irq_data(irq, (void *) gpio_irq);
324
325 for (i = 0; i < 32; i++, gpio_irq++) {
326 set_irq_chip_data(gpio_irq, pio);
327 set_irq_chip_and_handler(gpio_irq, &gpio_irqchip,
328 handle_simple_irq);
329 }
330
331 set_irq_chained_handler(irq, gpio_irq_handler);
332}
333
334/*--------------------------------------------------------------------------*/
335
122static int __init pio_probe(struct platform_device *pdev) 336static int __init pio_probe(struct platform_device *pdev)
123{ 337{
124 struct pio_device *pio = NULL; 338 struct pio_device *pio = NULL;
339 int irq = platform_get_irq(pdev, 0);
340 int gpio_irq_base = GPIO_IRQ_BASE + pdev->id * 32;
125 341
126 BUG_ON(pdev->id >= MAX_NR_PIO_DEVICES); 342 BUG_ON(pdev->id >= MAX_NR_PIO_DEVICES);
127 pio = &pio_dev[pdev->id]; 343 pio = &pio_dev[pdev->id];
128 BUG_ON(!pio->regs); 344 BUG_ON(!pio->regs);
129 345
130 /* TODO: Interrupts */ 346 gpio_irq_setup(pio, irq, gpio_irq_base);
131 347
132 platform_set_drvdata(pdev, pio); 348 platform_set_drvdata(pdev, pio);
133 349
134 printk(KERN_INFO "%s: Atmel Port Multiplexer at 0x%p (irq %d)\n", 350 printk(KERN_DEBUG "%s: base 0x%p, irq %d chains %d..%d\n",
135 pio->name, pio->regs, platform_get_irq(pdev, 0)); 351 pio->name, pio->regs, irq, gpio_irq_base, gpio_irq_base + 31);
136 352
137 return 0; 353 return 0;
138} 354}
@@ -148,7 +364,7 @@ static int __init pio_init(void)
148{ 364{
149 return platform_driver_register(&pio_driver); 365 return platform_driver_register(&pio_driver);
150} 366}
151subsys_initcall(pio_init); 367postcore_initcall(pio_init);
152 368
153void __init at32_init_pio(struct platform_device *pdev) 369void __init at32_init_pio(struct platform_device *pdev)
154{ 370{
@@ -184,6 +400,13 @@ void __init at32_init_pio(struct platform_device *pdev)
184 pio->pdev = pdev; 400 pio->pdev = pdev;
185 pio->regs = ioremap(regs->start, regs->end - regs->start + 1); 401 pio->regs = ioremap(regs->start, regs->end - regs->start + 1);
186 402
187 pio_writel(pio, ODR, ~0UL); 403 /*
188 pio_writel(pio, PER, ~0UL); 404 * request_gpio() is only valid for pins that have been
405 * explicitly configured as GPIO and not previously requested
406 */
407 pio->gpio_mask = ~0UL;
408
409 /* start with irqs disabled and acked */
410 pio_writel(pio, IDR, ~0UL);
411 (void) pio_readl(pio, ISR);
189} 412}
diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index 450515b245a0..fb13f72e9a02 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -22,18 +22,34 @@
22 22
23void invalidate_dcache_region(void *start, size_t size) 23void invalidate_dcache_region(void *start, size_t size)
24{ 24{
25 unsigned long v, begin, end, linesz; 25 unsigned long v, begin, end, linesz, mask;
26 int flush = 0;
26 27
27 linesz = boot_cpu_data.dcache.linesz; 28 linesz = boot_cpu_data.dcache.linesz;
29 mask = linesz - 1;
30
31 /* when first and/or last cachelines are shared, flush them
32 * instead of invalidating ... never discard valid data!
33 */
34 begin = (unsigned long)start;
35 end = begin + size - 1;
36
37 if (begin & mask) {
38 flush_dcache_line(start);
39 begin += linesz;
40 flush = 1;
41 }
42 if ((end & mask) != mask) {
43 flush_dcache_line((void *)end);
44 end -= linesz;
45 flush = 1;
46 }
28 47
29 //printk("invalidate dcache: %p + %u\n", start, size); 48 /* remaining cachelines only need invalidation */
30 49 for (v = begin; v <= end; v += linesz)
31 /* You asked for it, you got it */
32 begin = (unsigned long)start & ~(linesz - 1);
33 end = ((unsigned long)start + size + linesz - 1) & ~(linesz - 1);
34
35 for (v = begin; v < end; v += linesz)
36 invalidate_dcache_line((void *)v); 50 invalidate_dcache_line((void *)v);
51 if (flush)
52 flush_write_buffer();
37} 53}
38 54
39void clean_dcache_region(void *start, size_t size) 55void clean_dcache_region(void *start, size_t size)
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 5d80edfc61b7..bb0c376b62b3 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -466,7 +466,8 @@ CONFIG_FW_LOADER=y
466# 466#
467# Plug and Play support 467# Plug and Play support
468# 468#
469# CONFIG_PNP is not set 469CONFIG_PNP=y
470CONFIG_PNPACPI=y
470 471
471# 472#
472# Block devices 473# Block devices
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index cbcb2c27f48b..e94aff6888ca 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -66,7 +66,7 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return
66 66
67#define BAD_MADT_ENTRY(entry, end) ( \ 67#define BAD_MADT_ENTRY(entry, end) ( \
68 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ 68 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
69 ((acpi_table_entry_header *)entry)->length < sizeof(*entry)) 69 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
70 70
71#define PREFIX "ACPI: " 71#define PREFIX "ACPI: "
72 72
@@ -79,7 +79,7 @@ int acpi_ioapic;
79int acpi_strict; 79int acpi_strict;
80EXPORT_SYMBOL(acpi_strict); 80EXPORT_SYMBOL(acpi_strict);
81 81
82acpi_interrupt_flags acpi_sci_flags __initdata; 82u8 acpi_sci_flags __initdata;
83int acpi_sci_override_gsi __initdata; 83int acpi_sci_override_gsi __initdata;
84int acpi_skip_timer_override __initdata; 84int acpi_skip_timer_override __initdata;
85int acpi_use_timer_override __initdata; 85int acpi_use_timer_override __initdata;
@@ -92,11 +92,6 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
92#warning ACPI uses CMPXCHG, i486 and later hardware 92#warning ACPI uses CMPXCHG, i486 and later hardware
93#endif 93#endif
94 94
95#define MAX_MADT_ENTRIES 256
96u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
97 {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
98EXPORT_SYMBOL(x86_acpiid_to_apicid);
99
100/* -------------------------------------------------------------------------- 95/* --------------------------------------------------------------------------
101 Boot-time Configuration 96 Boot-time Configuration
102 -------------------------------------------------------------------------- */ 97 -------------------------------------------------------------------------- */
@@ -166,30 +161,26 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
166 161
167#ifdef CONFIG_PCI_MMCONFIG 162#ifdef CONFIG_PCI_MMCONFIG
168/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ 163/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */
169struct acpi_table_mcfg_config *pci_mmcfg_config; 164struct acpi_mcfg_allocation *pci_mmcfg_config;
170int pci_mmcfg_config_num; 165int pci_mmcfg_config_num;
171 166
172int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size) 167int __init acpi_parse_mcfg(struct acpi_table_header *header)
173{ 168{
174 struct acpi_table_mcfg *mcfg; 169 struct acpi_table_mcfg *mcfg;
175 unsigned long i; 170 unsigned long i;
176 int config_size; 171 int config_size;
177 172
178 if (!phys_addr || !size) 173 if (!header)
179 return -EINVAL; 174 return -EINVAL;
180 175
181 mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size); 176 mcfg = (struct acpi_table_mcfg *)header;
182 if (!mcfg) {
183 printk(KERN_WARNING PREFIX "Unable to map MCFG\n");
184 return -ENODEV;
185 }
186 177
187 /* how many config structures do we have */ 178 /* how many config structures do we have */
188 pci_mmcfg_config_num = 0; 179 pci_mmcfg_config_num = 0;
189 i = size - sizeof(struct acpi_table_mcfg); 180 i = header->length - sizeof(struct acpi_table_mcfg);
190 while (i >= sizeof(struct acpi_table_mcfg_config)) { 181 while (i >= sizeof(struct acpi_mcfg_allocation)) {
191 ++pci_mmcfg_config_num; 182 ++pci_mmcfg_config_num;
192 i -= sizeof(struct acpi_table_mcfg_config); 183 i -= sizeof(struct acpi_mcfg_allocation);
193 }; 184 };
194 if (pci_mmcfg_config_num == 0) { 185 if (pci_mmcfg_config_num == 0) {
195 printk(KERN_ERR PREFIX "MMCONFIG has no entries\n"); 186 printk(KERN_ERR PREFIX "MMCONFIG has no entries\n");
@@ -204,9 +195,9 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
204 return -ENOMEM; 195 return -ENOMEM;
205 } 196 }
206 197
207 memcpy(pci_mmcfg_config, &mcfg->config, config_size); 198 memcpy(pci_mmcfg_config, &mcfg[1], config_size);
208 for (i = 0; i < pci_mmcfg_config_num; ++i) { 199 for (i = 0; i < pci_mmcfg_config_num; ++i) {
209 if (mcfg->config[i].base_reserved) { 200 if (pci_mmcfg_config[i].address > 0xFFFFFFFF) {
210 printk(KERN_ERR PREFIX 201 printk(KERN_ERR PREFIX
211 "MMCONFIG not in low 4GB of memory\n"); 202 "MMCONFIG not in low 4GB of memory\n");
212 kfree(pci_mmcfg_config); 203 kfree(pci_mmcfg_config);
@@ -220,24 +211,24 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
220#endif /* CONFIG_PCI_MMCONFIG */ 211#endif /* CONFIG_PCI_MMCONFIG */
221 212
222#ifdef CONFIG_X86_LOCAL_APIC 213#ifdef CONFIG_X86_LOCAL_APIC
223static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) 214static int __init acpi_parse_madt(struct acpi_table_header *table)
224{ 215{
225 struct acpi_table_madt *madt = NULL; 216 struct acpi_table_madt *madt = NULL;
226 217
227 if (!phys_addr || !size || !cpu_has_apic) 218 if (!cpu_has_apic)
228 return -EINVAL; 219 return -EINVAL;
229 220
230 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); 221 madt = (struct acpi_table_madt *)table;
231 if (!madt) { 222 if (!madt) {
232 printk(KERN_WARNING PREFIX "Unable to map MADT\n"); 223 printk(KERN_WARNING PREFIX "Unable to map MADT\n");
233 return -ENODEV; 224 return -ENODEV;
234 } 225 }
235 226
236 if (madt->lapic_address) { 227 if (madt->address) {
237 acpi_lapic_addr = (u64) madt->lapic_address; 228 acpi_lapic_addr = (u64) madt->address;
238 229
239 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n", 230 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
240 madt->lapic_address); 231 madt->address);
241 } 232 }
242 233
243 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); 234 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
@@ -246,21 +237,17 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
246} 237}
247 238
248static int __init 239static int __init
249acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end) 240acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
250{ 241{
251 struct acpi_table_lapic *processor = NULL; 242 struct acpi_madt_local_apic *processor = NULL;
252 243
253 processor = (struct acpi_table_lapic *)header; 244 processor = (struct acpi_madt_local_apic *)header;
254 245
255 if (BAD_MADT_ENTRY(processor, end)) 246 if (BAD_MADT_ENTRY(processor, end))
256 return -EINVAL; 247 return -EINVAL;
257 248
258 acpi_table_print_madt_entry(header); 249 acpi_table_print_madt_entry(header);
259 250
260 /* Record local apic id only when enabled */
261 if (processor->flags.enabled)
262 x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
263
264 /* 251 /*
265 * We need to register disabled CPU as well to permit 252 * We need to register disabled CPU as well to permit
266 * counting disabled CPUs. This allows us to size 253 * counting disabled CPUs. This allows us to size
@@ -269,18 +256,18 @@ acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
269 * when we use CPU hotplug. 256 * when we use CPU hotplug.
270 */ 257 */
271 mp_register_lapic(processor->id, /* APIC ID */ 258 mp_register_lapic(processor->id, /* APIC ID */
272 processor->flags.enabled); /* Enabled? */ 259 processor->lapic_flags & ACPI_MADT_ENABLED); /* Enabled? */
273 260
274 return 0; 261 return 0;
275} 262}
276 263
277static int __init 264static int __init
278acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, 265acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
279 const unsigned long end) 266 const unsigned long end)
280{ 267{
281 struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL; 268 struct acpi_madt_local_apic_override *lapic_addr_ovr = NULL;
282 269
283 lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header; 270 lapic_addr_ovr = (struct acpi_madt_local_apic_override *)header;
284 271
285 if (BAD_MADT_ENTRY(lapic_addr_ovr, end)) 272 if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
286 return -EINVAL; 273 return -EINVAL;
@@ -291,11 +278,11 @@ acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
291} 278}
292 279
293static int __init 280static int __init
294acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) 281acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
295{ 282{
296 struct acpi_table_lapic_nmi *lapic_nmi = NULL; 283 struct acpi_madt_local_apic_nmi *lapic_nmi = NULL;
297 284
298 lapic_nmi = (struct acpi_table_lapic_nmi *)header; 285 lapic_nmi = (struct acpi_madt_local_apic_nmi *)header;
299 286
300 if (BAD_MADT_ENTRY(lapic_nmi, end)) 287 if (BAD_MADT_ENTRY(lapic_nmi, end))
301 return -EINVAL; 288 return -EINVAL;
@@ -313,11 +300,11 @@ acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
313#ifdef CONFIG_X86_IO_APIC 300#ifdef CONFIG_X86_IO_APIC
314 301
315static int __init 302static int __init
316acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end) 303acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
317{ 304{
318 struct acpi_table_ioapic *ioapic = NULL; 305 struct acpi_madt_io_apic *ioapic = NULL;
319 306
320 ioapic = (struct acpi_table_ioapic *)header; 307 ioapic = (struct acpi_madt_io_apic *)header;
321 308
322 if (BAD_MADT_ENTRY(ioapic, end)) 309 if (BAD_MADT_ENTRY(ioapic, end))
323 return -EINVAL; 310 return -EINVAL;
@@ -342,11 +329,11 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
342 polarity = 3; 329 polarity = 3;
343 330
344 /* Command-line over-ride via acpi_sci= */ 331 /* Command-line over-ride via acpi_sci= */
345 if (acpi_sci_flags.trigger) 332 if (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)
346 trigger = acpi_sci_flags.trigger; 333 trigger = (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2;
347 334
348 if (acpi_sci_flags.polarity) 335 if (acpi_sci_flags & ACPI_MADT_POLARITY_MASK)
349 polarity = acpi_sci_flags.polarity; 336 polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
350 337
351 /* 338 /*
352 * mp_config_acpi_legacy_irqs() already setup IRQs < 16 339 * mp_config_acpi_legacy_irqs() already setup IRQs < 16
@@ -357,51 +344,52 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
357 344
358 /* 345 /*
359 * stash over-ride to indicate we've been here 346 * stash over-ride to indicate we've been here
360 * and for later update of acpi_fadt 347 * and for later update of acpi_gbl_FADT
361 */ 348 */
362 acpi_sci_override_gsi = gsi; 349 acpi_sci_override_gsi = gsi;
363 return; 350 return;
364} 351}
365 352
366static int __init 353static int __init
367acpi_parse_int_src_ovr(acpi_table_entry_header * header, 354acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
368 const unsigned long end) 355 const unsigned long end)
369{ 356{
370 struct acpi_table_int_src_ovr *intsrc = NULL; 357 struct acpi_madt_interrupt_override *intsrc = NULL;
371 358
372 intsrc = (struct acpi_table_int_src_ovr *)header; 359 intsrc = (struct acpi_madt_interrupt_override *)header;
373 360
374 if (BAD_MADT_ENTRY(intsrc, end)) 361 if (BAD_MADT_ENTRY(intsrc, end))
375 return -EINVAL; 362 return -EINVAL;
376 363
377 acpi_table_print_madt_entry(header); 364 acpi_table_print_madt_entry(header);
378 365
379 if (intsrc->bus_irq == acpi_fadt.sci_int) { 366 if (intsrc->source_irq == acpi_gbl_FADT.sci_interrupt) {
380 acpi_sci_ioapic_setup(intsrc->global_irq, 367 acpi_sci_ioapic_setup(intsrc->global_irq,
381 intsrc->flags.polarity, 368 intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
382 intsrc->flags.trigger); 369 (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
383 return 0; 370 return 0;
384 } 371 }
385 372
386 if (acpi_skip_timer_override && 373 if (acpi_skip_timer_override &&
387 intsrc->bus_irq == 0 && intsrc->global_irq == 2) { 374 intsrc->source_irq == 0 && intsrc->global_irq == 2) {
388 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); 375 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
389 return 0; 376 return 0;
390 } 377 }
391 378
392 mp_override_legacy_irq(intsrc->bus_irq, 379 mp_override_legacy_irq(intsrc->source_irq,
393 intsrc->flags.polarity, 380 intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
394 intsrc->flags.trigger, intsrc->global_irq); 381 (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2,
382 intsrc->global_irq);
395 383
396 return 0; 384 return 0;
397} 385}
398 386
399static int __init 387static int __init
400acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) 388acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end)
401{ 389{
402 struct acpi_table_nmi_src *nmi_src = NULL; 390 struct acpi_madt_nmi_source *nmi_src = NULL;
403 391
404 nmi_src = (struct acpi_table_nmi_src *)header; 392 nmi_src = (struct acpi_madt_nmi_source *)header;
405 393
406 if (BAD_MADT_ENTRY(nmi_src, end)) 394 if (BAD_MADT_ENTRY(nmi_src, end))
407 return -EINVAL; 395 return -EINVAL;
@@ -417,7 +405,7 @@ acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
417 405
418/* 406/*
419 * acpi_pic_sci_set_trigger() 407 * acpi_pic_sci_set_trigger()
420 * 408 *
421 * use ELCR to set PIC-mode trigger type for SCI 409 * use ELCR to set PIC-mode trigger type for SCI
422 * 410 *
423 * If a PIC-mode SCI is not recognized or gives spurious IRQ7's 411 * If a PIC-mode SCI is not recognized or gives spurious IRQ7's
@@ -511,7 +499,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
511{ 499{
512 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 500 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
513 union acpi_object *obj; 501 union acpi_object *obj;
514 struct acpi_table_lapic *lapic; 502 struct acpi_madt_local_apic *lapic;
515 cpumask_t tmp_map, new_map; 503 cpumask_t tmp_map, new_map;
516 u8 physid; 504 u8 physid;
517 int cpu; 505 int cpu;
@@ -529,10 +517,10 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
529 return -EINVAL; 517 return -EINVAL;
530 } 518 }
531 519
532 lapic = (struct acpi_table_lapic *)obj->buffer.pointer; 520 lapic = (struct acpi_madt_local_apic *)obj->buffer.pointer;
533 521
534 if ((lapic->header.type != ACPI_MADT_LAPIC) || 522 if (lapic->header.type != ACPI_MADT_TYPE_LOCAL_APIC ||
535 (!lapic->flags.enabled)) { 523 !(lapic->lapic_flags & ACPI_MADT_ENABLED)) {
536 kfree(buffer.pointer); 524 kfree(buffer.pointer);
537 return -EINVAL; 525 return -EINVAL;
538 } 526 }
@@ -544,7 +532,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
544 buffer.pointer = NULL; 532 buffer.pointer = NULL;
545 533
546 tmp_map = cpu_present_map; 534 tmp_map = cpu_present_map;
547 mp_register_lapic(physid, lapic->flags.enabled); 535 mp_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
548 536
549 /* 537 /*
550 * If mp_register_lapic successfully generates a new logical cpu 538 * If mp_register_lapic successfully generates a new logical cpu
@@ -566,14 +554,6 @@ EXPORT_SYMBOL(acpi_map_lsapic);
566 554
567int acpi_unmap_lsapic(int cpu) 555int acpi_unmap_lsapic(int cpu)
568{ 556{
569 int i;
570
571 for_each_possible_cpu(i) {
572 if (x86_acpiid_to_apicid[i] == x86_cpu_to_apicid[cpu]) {
573 x86_acpiid_to_apicid[i] = -1;
574 break;
575 }
576 }
577 x86_cpu_to_apicid[cpu] = -1; 557 x86_cpu_to_apicid[cpu] = -1;
578 cpu_clear(cpu, cpu_present_map); 558 cpu_clear(cpu, cpu_present_map);
579 num_processors--; 559 num_processors--;
@@ -619,42 +599,36 @@ acpi_scan_rsdp(unsigned long start, unsigned long length)
619 return 0; 599 return 0;
620} 600}
621 601
622static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size) 602static int __init acpi_parse_sbf(struct acpi_table_header *table)
623{ 603{
624 struct acpi_table_sbf *sb; 604 struct acpi_table_boot *sb;
625
626 if (!phys_addr || !size)
627 return -EINVAL;
628 605
629 sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size); 606 sb = (struct acpi_table_boot *)table;
630 if (!sb) { 607 if (!sb) {
631 printk(KERN_WARNING PREFIX "Unable to map SBF\n"); 608 printk(KERN_WARNING PREFIX "Unable to map SBF\n");
632 return -ENODEV; 609 return -ENODEV;
633 } 610 }
634 611
635 sbf_port = sb->sbf_cmos; /* Save CMOS port */ 612 sbf_port = sb->cmos_index; /* Save CMOS port */
636 613
637 return 0; 614 return 0;
638} 615}
639 616
640#ifdef CONFIG_HPET_TIMER 617#ifdef CONFIG_HPET_TIMER
641 618
642static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) 619static int __init acpi_parse_hpet(struct acpi_table_header *table)
643{ 620{
644 struct acpi_table_hpet *hpet_tbl; 621 struct acpi_table_hpet *hpet_tbl;
645 struct resource *hpet_res; 622 struct resource *hpet_res;
646 resource_size_t res_start; 623 resource_size_t res_start;
647 624
648 if (!phys || !size) 625 hpet_tbl = (struct acpi_table_hpet *)table;
649 return -EINVAL;
650
651 hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
652 if (!hpet_tbl) { 626 if (!hpet_tbl) {
653 printk(KERN_WARNING PREFIX "Unable to map HPET\n"); 627 printk(KERN_WARNING PREFIX "Unable to map HPET\n");
654 return -ENODEV; 628 return -ENODEV;
655 } 629 }
656 630
657 if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) { 631 if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) {
658 printk(KERN_WARNING PREFIX "HPET timers must be located in " 632 printk(KERN_WARNING PREFIX "HPET timers must be located in "
659 "memory.\n"); 633 "memory.\n");
660 return -1; 634 return -1;
@@ -667,29 +641,28 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
667 hpet_res->name = (void *)&hpet_res[1]; 641 hpet_res->name = (void *)&hpet_res[1];
668 hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 642 hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
669 snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, 643 snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE,
670 "HPET %u", hpet_tbl->number); 644 "HPET %u", hpet_tbl->sequence);
671 hpet_res->end = (1 * 1024) - 1; 645 hpet_res->end = (1 * 1024) - 1;
672 } 646 }
673 647
674#ifdef CONFIG_X86_64 648#ifdef CONFIG_X86_64
675 vxtime.hpet_address = hpet_tbl->addr.addrl | 649 vxtime.hpet_address = hpet_tbl->address.address;
676 ((long)hpet_tbl->addr.addrh << 32);
677 650
678 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 651 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
679 hpet_tbl->id, vxtime.hpet_address); 652 hpet_tbl->id, vxtime.hpet_address);
680 653
681 res_start = vxtime.hpet_address; 654 res_start = vxtime.hpet_address;
682#else /* X86 */ 655#else /* X86 */
683 { 656 {
684 extern unsigned long hpet_address; 657 extern unsigned long hpet_address;
685 658
686 hpet_address = hpet_tbl->addr.addrl; 659 hpet_address = hpet_tbl->address.address;
687 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 660 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
688 hpet_tbl->id, hpet_address); 661 hpet_tbl->id, hpet_address);
689 662
690 res_start = hpet_address; 663 res_start = hpet_address;
691 } 664 }
692#endif /* X86 */ 665#endif /* X86 */
693 666
694 if (hpet_res) { 667 if (hpet_res) {
695 hpet_res->start = res_start; 668 hpet_res->start = res_start;
@@ -707,42 +680,28 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
707extern u32 pmtmr_ioport; 680extern u32 pmtmr_ioport;
708#endif 681#endif
709 682
710static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) 683static int __init acpi_parse_fadt(struct acpi_table_header *table)
711{ 684{
712 struct fadt_descriptor *fadt = NULL;
713
714 fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size);
715 if (!fadt) {
716 printk(KERN_WARNING PREFIX "Unable to map FADT\n");
717 return 0;
718 }
719 /* initialize sci_int early for INT_SRC_OVR MADT parsing */
720 acpi_fadt.sci_int = fadt->sci_int;
721
722 /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
723 acpi_fadt.revision = fadt->revision;
724 acpi_fadt.force_apic_physical_destination_mode =
725 fadt->force_apic_physical_destination_mode;
726 685
727#ifdef CONFIG_X86_PM_TIMER 686#ifdef CONFIG_X86_PM_TIMER
728 /* detect the location of the ACPI PM Timer */ 687 /* detect the location of the ACPI PM Timer */
729 if (fadt->revision >= FADT2_REVISION_ID) { 688 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) {
730 /* FADT rev. 2 */ 689 /* FADT rev. 2 */
731 if (fadt->xpm_tmr_blk.address_space_id != 690 if (acpi_gbl_FADT.xpm_timer_block.space_id !=
732 ACPI_ADR_SPACE_SYSTEM_IO) 691 ACPI_ADR_SPACE_SYSTEM_IO)
733 return 0; 692 return 0;
734 693
735 pmtmr_ioport = fadt->xpm_tmr_blk.address; 694 pmtmr_ioport = acpi_gbl_FADT.xpm_timer_block.address;
736 /* 695 /*
737 * "X" fields are optional extensions to the original V1.0 696 * "X" fields are optional extensions to the original V1.0
738 * fields, so we must selectively expand V1.0 fields if the 697 * fields, so we must selectively expand V1.0 fields if the
739 * corresponding X field is zero. 698 * corresponding X field is zero.
740 */ 699 */
741 if (!pmtmr_ioport) 700 if (!pmtmr_ioport)
742 pmtmr_ioport = fadt->V1_pm_tmr_blk; 701 pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
743 } else { 702 } else {
744 /* FADT rev. 1 */ 703 /* FADT rev. 1 */
745 pmtmr_ioport = fadt->V1_pm_tmr_blk; 704 pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
746 } 705 }
747 if (pmtmr_ioport) 706 if (pmtmr_ioport)
748 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", 707 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
@@ -784,13 +743,13 @@ static int __init acpi_parse_madt_lapic_entries(void)
784 if (!cpu_has_apic) 743 if (!cpu_has_apic)
785 return -ENODEV; 744 return -ENODEV;
786 745
787 /* 746 /*
788 * Note that the LAPIC address is obtained from the MADT (32-bit value) 747 * Note that the LAPIC address is obtained from the MADT (32-bit value)
789 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). 748 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
790 */ 749 */
791 750
792 count = 751 count =
793 acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, 752 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
794 acpi_parse_lapic_addr_ovr, 0); 753 acpi_parse_lapic_addr_ovr, 0);
795 if (count < 0) { 754 if (count < 0) {
796 printk(KERN_ERR PREFIX 755 printk(KERN_ERR PREFIX
@@ -800,7 +759,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
800 759
801 mp_register_lapic_address(acpi_lapic_addr); 760 mp_register_lapic_address(acpi_lapic_addr);
802 761
803 count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, 762 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC, acpi_parse_lapic,
804 MAX_APICS); 763 MAX_APICS);
805 if (!count) { 764 if (!count) {
806 printk(KERN_ERR PREFIX "No LAPIC entries present\n"); 765 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
@@ -813,7 +772,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
813 } 772 }
814 773
815 count = 774 count =
816 acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); 775 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0);
817 if (count < 0) { 776 if (count < 0) {
818 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 777 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
819 /* TBD: Cleanup to allow fallback to MPS */ 778 /* TBD: Cleanup to allow fallback to MPS */
@@ -842,7 +801,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
842 return -ENODEV; 801 return -ENODEV;
843 } 802 }
844 803
845 if (!cpu_has_apic) 804 if (!cpu_has_apic)
846 return -ENODEV; 805 return -ENODEV;
847 806
848 /* 807 /*
@@ -855,7 +814,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
855 } 814 }
856 815
857 count = 816 count =
858 acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, 817 acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC, acpi_parse_ioapic,
859 MAX_IO_APICS); 818 MAX_IO_APICS);
860 if (!count) { 819 if (!count) {
861 printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); 820 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
@@ -866,7 +825,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
866 } 825 }
867 826
868 count = 827 count =
869 acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 828 acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr,
870 NR_IRQ_VECTORS); 829 NR_IRQ_VECTORS);
871 if (count < 0) { 830 if (count < 0) {
872 printk(KERN_ERR PREFIX 831 printk(KERN_ERR PREFIX
@@ -880,13 +839,13 @@ static int __init acpi_parse_madt_ioapic_entries(void)
880 * pretend we got one so we can set the SCI flags. 839 * pretend we got one so we can set the SCI flags.
881 */ 840 */
882 if (!acpi_sci_override_gsi) 841 if (!acpi_sci_override_gsi)
883 acpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0); 842 acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0);
884 843
885 /* Fill in identity legacy mapings where no override */ 844 /* Fill in identity legacy mapings where no override */
886 mp_config_acpi_legacy_irqs(); 845 mp_config_acpi_legacy_irqs();
887 846
888 count = 847 count =
889 acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 848 acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src,
890 NR_IRQ_VECTORS); 849 NR_IRQ_VECTORS);
891 if (count < 0) { 850 if (count < 0) {
892 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); 851 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
@@ -908,7 +867,7 @@ static void __init acpi_process_madt(void)
908#ifdef CONFIG_X86_LOCAL_APIC 867#ifdef CONFIG_X86_LOCAL_APIC
909 int count, error; 868 int count, error;
910 869
911 count = acpi_table_parse(ACPI_APIC, acpi_parse_madt); 870 count = acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt);
912 if (count >= 1) { 871 if (count >= 1) {
913 872
914 /* 873 /*
@@ -1195,7 +1154,7 @@ int __init acpi_boot_table_init(void)
1195 if (acpi_disabled && !acpi_ht) 1154 if (acpi_disabled && !acpi_ht)
1196 return 1; 1155 return 1;
1197 1156
1198 /* 1157 /*
1199 * Initialize the ACPI boot-time table parser. 1158 * Initialize the ACPI boot-time table parser.
1200 */ 1159 */
1201 error = acpi_table_init(); 1160 error = acpi_table_init();
@@ -1204,7 +1163,7 @@ int __init acpi_boot_table_init(void)
1204 return error; 1163 return error;
1205 } 1164 }
1206 1165
1207 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf); 1166 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
1208 1167
1209 /* 1168 /*
1210 * blacklist may disable ACPI entirely 1169 * blacklist may disable ACPI entirely
@@ -1232,19 +1191,19 @@ int __init acpi_boot_init(void)
1232 if (acpi_disabled && !acpi_ht) 1191 if (acpi_disabled && !acpi_ht)
1233 return 1; 1192 return 1;
1234 1193
1235 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf); 1194 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
1236 1195
1237 /* 1196 /*
1238 * set sci_int and PM timer address 1197 * set sci_int and PM timer address
1239 */ 1198 */
1240 acpi_table_parse(ACPI_FADT, acpi_parse_fadt); 1199 acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt);
1241 1200
1242 /* 1201 /*
1243 * Process the Multiple APIC Description Table (MADT), if present 1202 * Process the Multiple APIC Description Table (MADT), if present
1244 */ 1203 */
1245 acpi_process_madt(); 1204 acpi_process_madt();
1246 1205
1247 acpi_table_parse(ACPI_HPET, acpi_parse_hpet); 1206 acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
1248 1207
1249 return 0; 1208 return 0;
1250} 1209}
@@ -1315,13 +1274,17 @@ static int __init setup_acpi_sci(char *s)
1315 if (!s) 1274 if (!s)
1316 return -EINVAL; 1275 return -EINVAL;
1317 if (!strcmp(s, "edge")) 1276 if (!strcmp(s, "edge"))
1318 acpi_sci_flags.trigger = 1; 1277 acpi_sci_flags = ACPI_MADT_TRIGGER_EDGE |
1278 (acpi_sci_flags & ~ACPI_MADT_TRIGGER_MASK);
1319 else if (!strcmp(s, "level")) 1279 else if (!strcmp(s, "level"))
1320 acpi_sci_flags.trigger = 3; 1280 acpi_sci_flags = ACPI_MADT_TRIGGER_LEVEL |
1281 (acpi_sci_flags & ~ACPI_MADT_TRIGGER_MASK);
1321 else if (!strcmp(s, "high")) 1282 else if (!strcmp(s, "high"))
1322 acpi_sci_flags.polarity = 1; 1283 acpi_sci_flags = ACPI_MADT_POLARITY_ACTIVE_HIGH |
1284 (acpi_sci_flags & ~ACPI_MADT_POLARITY_MASK);
1323 else if (!strcmp(s, "low")) 1285 else if (!strcmp(s, "low"))
1324 acpi_sci_flags.polarity = 3; 1286 acpi_sci_flags = ACPI_MADT_POLARITY_ACTIVE_LOW |
1287 (acpi_sci_flags & ~ACPI_MADT_POLARITY_MASK);
1325 else 1288 else
1326 return -EINVAL; 1289 return -EINVAL;
1327 return 0; 1290 return 0;
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c
index 4b60af7f91dd..bf86f7662d8b 100644
--- a/arch/i386/kernel/acpi/earlyquirk.c
+++ b/arch/i386/kernel/acpi/earlyquirk.c
@@ -16,7 +16,7 @@
16 16
17static int nvidia_hpet_detected __initdata; 17static int nvidia_hpet_detected __initdata;
18 18
19static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) 19static int __init nvidia_hpet_check(struct acpi_table_header *header)
20{ 20{
21 nvidia_hpet_detected = 1; 21 nvidia_hpet_detected = 1;
22 return 0; 22 return 0;
@@ -30,7 +30,7 @@ static int __init check_bridge(int vendor, int device)
30 is enabled. */ 30 is enabled. */
31 if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) { 31 if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) {
32 nvidia_hpet_detected = 0; 32 nvidia_hpet_detected = 0;
33 acpi_table_parse(ACPI_HPET, nvidia_hpet_check); 33 acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check);
34 if (nvidia_hpet_detected == 0) { 34 if (nvidia_hpet_detected == 0) {
35 acpi_skip_timer_override = 1; 35 acpi_skip_timer_override = 1;
36 printk(KERN_INFO "Nvidia board " 36 printk(KERN_INFO "Nvidia board "
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 8f40cb47720e..fa5cac255c16 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -196,7 +196,7 @@ static void do_powersaver(int cx_address, unsigned int clock_ratio_index)
196 inb(cx_address); 196 inb(cx_address);
197 /* Dummy op - must do something useless after P_LVL3 197 /* Dummy op - must do something useless after P_LVL3
198 * read */ 198 * read */
199 t = inl(acpi_fadt.xpm_tmr_blk.address); 199 t = inl(acpi_gbl_FADT.xpm_timer_block.address);
200 } 200 }
201 longhaul.bits.EnableSoftVID = 0; 201 longhaul.bits.EnableSoftVID = 0;
202 wrmsrl(MSR_VIA_LONGHAUL, longhaul.val); 202 wrmsrl(MSR_VIA_LONGHAUL, longhaul.val);
@@ -214,7 +214,7 @@ static void do_powersaver(int cx_address, unsigned int clock_ratio_index)
214 /* Invoke C3 */ 214 /* Invoke C3 */
215 inb(cx_address); 215 inb(cx_address);
216 /* Dummy op - must do something useless after P_LVL3 read */ 216 /* Dummy op - must do something useless after P_LVL3 read */
217 t = inl(acpi_fadt.xpm_tmr_blk.address); 217 t = inl(acpi_gbl_FADT.xpm_timer_block.address);
218 } 218 }
219 /* Disable bus ratio bit */ 219 /* Disable bus ratio bit */
220 longhaul.bits.EnableSoftBusRatio = 0; 220 longhaul.bits.EnableSoftBusRatio = 0;
@@ -234,7 +234,7 @@ static void do_powersaver(int cx_address, unsigned int clock_ratio_index)
234 inb(cx_address); 234 inb(cx_address);
235 /* Dummy op - must do something useless after P_LVL3 235 /* Dummy op - must do something useless after P_LVL3
236 * read */ 236 * read */
237 t = inl(acpi_fadt.xpm_tmr_blk.address); 237 t = inl(acpi_gbl_FADT.xpm_timer_block.address);
238 } 238 }
239 longhaul.bits.EnableSoftVID = 0; 239 longhaul.bits.EnableSoftVID = 0;
240 wrmsrl(MSR_VIA_LONGHAUL, longhaul.val); 240 wrmsrl(MSR_VIA_LONGHAUL, longhaul.val);
@@ -291,8 +291,7 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
291 outb(3, 0x22); 291 outb(3, 0x22);
292 } else if ((pr != NULL) && pr->flags.bm_control) { 292 } else if ((pr != NULL) && pr->flags.bm_control) {
293 /* Disable bus master arbitration */ 293 /* Disable bus master arbitration */
294 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, 294 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
295 ACPI_MTX_DO_NOT_LOCK);
296 } 295 }
297 switch (longhaul_version) { 296 switch (longhaul_version) {
298 297
@@ -322,8 +321,7 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
322 case TYPE_POWERSAVER: 321 case TYPE_POWERSAVER:
323 if (longhaul_flags & USE_ACPI_C3) { 322 if (longhaul_flags & USE_ACPI_C3) {
324 /* Don't allow wakeup */ 323 /* Don't allow wakeup */
325 acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, 324 acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
326 ACPI_MTX_DO_NOT_LOCK);
327 do_powersaver(cx->address, clock_ratio_index); 325 do_powersaver(cx->address, clock_ratio_index);
328 } else { 326 } else {
329 do_powersaver(0, clock_ratio_index); 327 do_powersaver(0, clock_ratio_index);
@@ -336,8 +334,7 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
336 outb(0, 0x22); 334 outb(0, 0x22);
337 } else if ((pr != NULL) && pr->flags.bm_control) { 335 } else if ((pr != NULL) && pr->flags.bm_control) {
338 /* Enable bus master arbitration */ 336 /* Enable bus master arbitration */
339 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, 337 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
340 ACPI_MTX_DO_NOT_LOCK);
341 } 338 }
342 outb(pic2_mask,0xA1); /* restore mask */ 339 outb(pic2_mask,0xA1); /* restore mask */
343 outb(pic1_mask,0x21); 340 outb(pic1_mask,0x21);
@@ -416,7 +413,7 @@ static int __init longhaul_get_ranges(void)
416 highest_speed = calc_speed(maxmult); 413 highest_speed = calc_speed(maxmult);
417 lowest_speed = calc_speed(minmult); 414 lowest_speed = calc_speed(minmult);
418 dprintk ("FSB:%dMHz Lowest speed: %s Highest speed:%s\n", fsb, 415 dprintk ("FSB:%dMHz Lowest speed: %s Highest speed:%s\n", fsb,
419 print_speed(lowest_speed/1000), 416 print_speed(lowest_speed/1000),
420 print_speed(highest_speed/1000)); 417 print_speed(highest_speed/1000));
421 418
422 if (lowest_speed == highest_speed) { 419 if (lowest_speed == highest_speed) {
@@ -531,6 +528,7 @@ static void __init longhaul_setup_voltagescaling(void)
531 /* Calculate kHz for one voltage step */ 528 /* Calculate kHz for one voltage step */
532 kHz_step = (highest_speed - min_vid_speed) / numvscales; 529 kHz_step = (highest_speed - min_vid_speed) / numvscales;
533 530
531
534 j = 0; 532 j = 0;
535 while (longhaul_table[j].frequency != CPUFREQ_TABLE_END) { 533 while (longhaul_table[j].frequency != CPUFREQ_TABLE_END) {
536 speed = longhaul_table[j].frequency; 534 speed = longhaul_table[j].frequency;
diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c
index b92c7f0a358a..8f9c624ace6f 100644
--- a/arch/i386/kernel/efi.c
+++ b/arch/i386/kernel/efi.c
@@ -473,6 +473,70 @@ static inline void __init check_range_for_systab(efi_memory_desc_t *md)
473} 473}
474 474
475/* 475/*
476 * Wrap all the virtual calls in a way that forces the parameters on the stack.
477 */
478
479#define efi_call_virt(f, args...) \
480 ((efi_##f##_t __attribute__((regparm(0)))*)efi.systab->runtime->f)(args)
481
482static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
483{
484 return efi_call_virt(get_time, tm, tc);
485}
486
487static efi_status_t virt_efi_set_time (efi_time_t *tm)
488{
489 return efi_call_virt(set_time, tm);
490}
491
492static efi_status_t virt_efi_get_wakeup_time (efi_bool_t *enabled,
493 efi_bool_t *pending,
494 efi_time_t *tm)
495{
496 return efi_call_virt(get_wakeup_time, enabled, pending, tm);
497}
498
499static efi_status_t virt_efi_set_wakeup_time (efi_bool_t enabled,
500 efi_time_t *tm)
501{
502 return efi_call_virt(set_wakeup_time, enabled, tm);
503}
504
505static efi_status_t virt_efi_get_variable (efi_char16_t *name,
506 efi_guid_t *vendor, u32 *attr,
507 unsigned long *data_size, void *data)
508{
509 return efi_call_virt(get_variable, name, vendor, attr, data_size, data);
510}
511
512static efi_status_t virt_efi_get_next_variable (unsigned long *name_size,
513 efi_char16_t *name,
514 efi_guid_t *vendor)
515{
516 return efi_call_virt(get_next_variable, name_size, name, vendor);
517}
518
519static efi_status_t virt_efi_set_variable (efi_char16_t *name,
520 efi_guid_t *vendor,
521 unsigned long attr,
522 unsigned long data_size, void *data)
523{
524 return efi_call_virt(set_variable, name, vendor, attr, data_size, data);
525}
526
527static efi_status_t virt_efi_get_next_high_mono_count (u32 *count)
528{
529 return efi_call_virt(get_next_high_mono_count, count);
530}
531
532static void virt_efi_reset_system (int reset_type, efi_status_t status,
533 unsigned long data_size,
534 efi_char16_t *data)
535{
536 efi_call_virt(reset_system, reset_type, status, data_size, data);
537}
538
539/*
476 * This function will switch the EFI runtime services to virtual mode. 540 * This function will switch the EFI runtime services to virtual mode.
477 * Essentially, look through the EFI memmap and map every region that 541 * Essentially, look through the EFI memmap and map every region that
478 * has the runtime attribute bit set in its memory descriptor and update 542 * has the runtime attribute bit set in its memory descriptor and update
@@ -525,22 +589,15 @@ void __init efi_enter_virtual_mode(void)
525 * pointers in the runtime service table to the new virtual addresses. 589 * pointers in the runtime service table to the new virtual addresses.
526 */ 590 */
527 591
528 efi.get_time = (efi_get_time_t *) efi.systab->runtime->get_time; 592 efi.get_time = virt_efi_get_time;
529 efi.set_time = (efi_set_time_t *) efi.systab->runtime->set_time; 593 efi.set_time = virt_efi_set_time;
530 efi.get_wakeup_time = (efi_get_wakeup_time_t *) 594 efi.get_wakeup_time = virt_efi_get_wakeup_time;
531 efi.systab->runtime->get_wakeup_time; 595 efi.set_wakeup_time = virt_efi_set_wakeup_time;
532 efi.set_wakeup_time = (efi_set_wakeup_time_t *) 596 efi.get_variable = virt_efi_get_variable;
533 efi.systab->runtime->set_wakeup_time; 597 efi.get_next_variable = virt_efi_get_next_variable;
534 efi.get_variable = (efi_get_variable_t *) 598 efi.set_variable = virt_efi_set_variable;
535 efi.systab->runtime->get_variable; 599 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count;
536 efi.get_next_variable = (efi_get_next_variable_t *) 600 efi.reset_system = virt_efi_reset_system;
537 efi.systab->runtime->get_next_variable;
538 efi.set_variable = (efi_set_variable_t *)
539 efi.systab->runtime->set_variable;
540 efi.get_next_high_mono_count = (efi_get_next_high_mono_count_t *)
541 efi.systab->runtime->get_next_high_mono_count;
542 efi.reset_system = (efi_reset_system_t *)
543 efi.systab->runtime->reset_system;
544} 601}
545 602
546void __init 603void __init
diff --git a/arch/i386/kernel/hpet.c b/arch/i386/kernel/hpet.c
index 45a8685bb60b..0b29d41322a2 100644
--- a/arch/i386/kernel/hpet.c
+++ b/arch/i386/kernel/hpet.c
@@ -12,7 +12,7 @@
12/* FSEC = 10^-15 NSEC = 10^-9 */ 12/* FSEC = 10^-15 NSEC = 10^-9 */
13#define FSEC_PER_NSEC 1000000 13#define FSEC_PER_NSEC 1000000
14 14
15static void *hpet_ptr; 15static void __iomem *hpet_ptr;
16 16
17static cycle_t read_hpet(void) 17static cycle_t read_hpet(void)
18{ 18{
@@ -40,8 +40,7 @@ static int __init init_hpet_clocksource(void)
40 return -ENODEV; 40 return -ENODEV;
41 41
42 /* calculate the hpet address: */ 42 /* calculate the hpet address: */
43 hpet_base = 43 hpet_base = ioremap_nocache(hpet_address, HPET_MMAP_SIZE);
44 (void __iomem*)ioremap_nocache(hpet_address, HPET_MMAP_SIZE);
45 hpet_ptr = hpet_base + HPET_COUNTER; 44 hpet_ptr = hpet_base + HPET_COUNTER;
46 45
47 /* calculate the frequency: */ 46 /* calculate the frequency: */
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 6a3875f81a0a..ba8d302a0b72 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -126,7 +126,7 @@ static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned i
126 */ 126 */
127static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value) 127static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value)
128{ 128{
129 volatile struct io_apic *io_apic = io_apic_base(apic); 129 volatile struct io_apic __iomem *io_apic = io_apic_base(apic);
130 if (sis_apic_bug) 130 if (sis_apic_bug)
131 writel(reg, &io_apic->index); 131 writel(reg, &io_apic->index);
132 writel(value, &io_apic->data); 132 writel(value, &io_apic->data);
@@ -2606,25 +2606,32 @@ static struct irq_chip msi_chip = {
2606 .retrigger = ioapic_retrigger_irq, 2606 .retrigger = ioapic_retrigger_irq,
2607}; 2607};
2608 2608
2609int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev) 2609int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
2610{ 2610{
2611 struct msi_msg msg; 2611 struct msi_msg msg;
2612 int ret; 2612 int irq, ret;
2613 irq = create_irq();
2614 if (irq < 0)
2615 return irq;
2616
2617 set_irq_msi(irq, desc);
2613 ret = msi_compose_msg(dev, irq, &msg); 2618 ret = msi_compose_msg(dev, irq, &msg);
2614 if (ret < 0) 2619 if (ret < 0) {
2620 destroy_irq(irq);
2615 return ret; 2621 return ret;
2622 }
2616 2623
2617 write_msi_msg(irq, &msg); 2624 write_msi_msg(irq, &msg);
2618 2625
2619 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, 2626 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq,
2620 "edge"); 2627 "edge");
2621 2628
2622 return 0; 2629 return irq;
2623} 2630}
2624 2631
2625void arch_teardown_msi_irq(unsigned int irq) 2632void arch_teardown_msi_irq(unsigned int irq)
2626{ 2633{
2627 return; 2634 destroy_irq(irq);
2628} 2635}
2629 2636
2630#endif /* CONFIG_PCI_MSI */ 2637#endif /* CONFIG_PCI_MSI */
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 49bff3596bff..4f5983c98669 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -1057,7 +1057,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
1057 static int gsi_to_irq[MAX_GSI_NUM]; 1057 static int gsi_to_irq[MAX_GSI_NUM];
1058 1058
1059 /* Don't set up the ACPI SCI because it's already set up */ 1059 /* Don't set up the ACPI SCI because it's already set up */
1060 if (acpi_fadt.sci_int == gsi) 1060 if (acpi_gbl_FADT.sci_interrupt == gsi)
1061 return gsi; 1061 return gsi;
1062 1062
1063 ioapic = mp_find_ioapic(gsi); 1063 ioapic = mp_find_ioapic(gsi);
@@ -1114,7 +1114,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
1114 /* 1114 /*
1115 * Don't assign IRQ used by ACPI SCI 1115 * Don't assign IRQ used by ACPI SCI
1116 */ 1116 */
1117 if (gsi == acpi_fadt.sci_int) 1117 if (gsi == acpi_gbl_FADT.sci_interrupt)
1118 gsi = pci_irq++; 1118 gsi = pci_irq++;
1119 gsi_to_irq[irq] = gsi; 1119 gsi_to_irq[irq] = gsi;
1120 } else { 1120 } else {
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c
index f7e735c077c3..2a8713ec0f9a 100644
--- a/arch/i386/kernel/srat.c
+++ b/arch/i386/kernel/srat.c
@@ -62,19 +62,19 @@ extern void * boot_ioremap(unsigned long, unsigned long);
62/* Identify CPU proximity domains */ 62/* Identify CPU proximity domains */
63static void __init parse_cpu_affinity_structure(char *p) 63static void __init parse_cpu_affinity_structure(char *p)
64{ 64{
65 struct acpi_table_processor_affinity *cpu_affinity = 65 struct acpi_srat_cpu_affinity *cpu_affinity =
66 (struct acpi_table_processor_affinity *) p; 66 (struct acpi_srat_cpu_affinity *) p;
67 67
68 if (!cpu_affinity->flags.enabled) 68 if ((cpu_affinity->flags & ACPI_SRAT_CPU_ENABLED) == 0)
69 return; /* empty entry */ 69 return; /* empty entry */
70 70
71 /* mark this node as "seen" in node bitmap */ 71 /* mark this node as "seen" in node bitmap */
72 BMAP_SET(pxm_bitmap, cpu_affinity->proximity_domain); 72 BMAP_SET(pxm_bitmap, cpu_affinity->proximity_domain_lo);
73 73
74 apicid_to_pxm[cpu_affinity->apic_id] = cpu_affinity->proximity_domain; 74 apicid_to_pxm[cpu_affinity->apic_id] = cpu_affinity->proximity_domain_lo;
75 75
76 printk("CPU 0x%02X in proximity domain 0x%02X\n", 76 printk("CPU 0x%02X in proximity domain 0x%02X\n",
77 cpu_affinity->apic_id, cpu_affinity->proximity_domain); 77 cpu_affinity->apic_id, cpu_affinity->proximity_domain_lo);
78} 78}
79 79
80/* 80/*
@@ -84,28 +84,27 @@ static void __init parse_cpu_affinity_structure(char *p)
84static void __init parse_memory_affinity_structure (char *sratp) 84static void __init parse_memory_affinity_structure (char *sratp)
85{ 85{
86 unsigned long long paddr, size; 86 unsigned long long paddr, size;
87 unsigned long start_pfn, end_pfn; 87 unsigned long start_pfn, end_pfn;
88 u8 pxm; 88 u8 pxm;
89 struct node_memory_chunk_s *p, *q, *pend; 89 struct node_memory_chunk_s *p, *q, *pend;
90 struct acpi_table_memory_affinity *memory_affinity = 90 struct acpi_srat_mem_affinity *memory_affinity =
91 (struct acpi_table_memory_affinity *) sratp; 91 (struct acpi_srat_mem_affinity *) sratp;
92 92
93 if (!memory_affinity->flags.enabled) 93 if ((memory_affinity->flags & ACPI_SRAT_MEM_ENABLED) == 0)
94 return; /* empty entry */ 94 return; /* empty entry */
95 95
96 pxm = memory_affinity->proximity_domain & 0xff;
97
96 /* mark this node as "seen" in node bitmap */ 98 /* mark this node as "seen" in node bitmap */
97 BMAP_SET(pxm_bitmap, memory_affinity->proximity_domain); 99 BMAP_SET(pxm_bitmap, pxm);
98 100
99 /* calculate info for memory chunk structure */ 101 /* calculate info for memory chunk structure */
100 paddr = memory_affinity->base_addr_hi; 102 paddr = memory_affinity->base_address;
101 paddr = (paddr << 32) | memory_affinity->base_addr_lo; 103 size = memory_affinity->length;
102 size = memory_affinity->length_hi; 104
103 size = (size << 32) | memory_affinity->length_lo;
104
105 start_pfn = paddr >> PAGE_SHIFT; 105 start_pfn = paddr >> PAGE_SHIFT;
106 end_pfn = (paddr + size) >> PAGE_SHIFT; 106 end_pfn = (paddr + size) >> PAGE_SHIFT;
107 107
108 pxm = memory_affinity->proximity_domain;
109 108
110 if (num_memory_chunks >= MAXCHUNKS) { 109 if (num_memory_chunks >= MAXCHUNKS) {
111 printk("Too many mem chunks in SRAT. Ignoring %lld MBytes at %llx\n", 110 printk("Too many mem chunks in SRAT. Ignoring %lld MBytes at %llx\n",
@@ -132,8 +131,8 @@ static void __init parse_memory_affinity_structure (char *sratp)
132 printk("Memory range 0x%lX to 0x%lX (type 0x%X) in proximity domain 0x%02X %s\n", 131 printk("Memory range 0x%lX to 0x%lX (type 0x%X) in proximity domain 0x%02X %s\n",
133 start_pfn, end_pfn, 132 start_pfn, end_pfn,
134 memory_affinity->memory_type, 133 memory_affinity->memory_type,
135 memory_affinity->proximity_domain, 134 pxm,
136 (memory_affinity->flags.hot_pluggable ? 135 ((memory_affinity->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) ?
137 "enabled and removable" : "enabled" ) ); 136 "enabled and removable" : "enabled" ) );
138} 137}
139 138
@@ -185,10 +184,10 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
185 num_memory_chunks = 0; 184 num_memory_chunks = 0;
186 while (p < end) { 185 while (p < end) {
187 switch (*p) { 186 switch (*p) {
188 case ACPI_SRAT_PROCESSOR_AFFINITY: 187 case ACPI_SRAT_TYPE_CPU_AFFINITY:
189 parse_cpu_affinity_structure(p); 188 parse_cpu_affinity_structure(p);
190 break; 189 break;
191 case ACPI_SRAT_MEMORY_AFFINITY: 190 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
192 parse_memory_affinity_structure(p); 191 parse_memory_affinity_structure(p);
193 break; 192 break;
194 default: 193 default:
@@ -262,31 +261,30 @@ out_fail:
262 return 0; 261 return 0;
263} 262}
264 263
264struct acpi_static_rsdt {
265 struct acpi_table_rsdt table;
266 u32 padding[7]; /* Allow for 7 more table entries */
267};
268
265int __init get_memcfg_from_srat(void) 269int __init get_memcfg_from_srat(void)
266{ 270{
267 struct acpi_table_header *header = NULL; 271 struct acpi_table_header *header = NULL;
268 struct acpi_table_rsdp *rsdp = NULL; 272 struct acpi_table_rsdp *rsdp = NULL;
269 struct acpi_table_rsdt *rsdt = NULL; 273 struct acpi_table_rsdt *rsdt = NULL;
270 struct acpi_pointer *rsdp_address = NULL; 274 acpi_native_uint rsdp_address = 0;
271 struct acpi_table_rsdt saved_rsdt; 275 struct acpi_static_rsdt saved_rsdt;
272 int tables = 0; 276 int tables = 0;
273 int i = 0; 277 int i = 0;
274 278
275 if (ACPI_FAILURE(acpi_find_root_pointer(ACPI_PHYSICAL_ADDRESSING, 279 rsdp_address = acpi_find_rsdp();
276 rsdp_address))) { 280 if (!rsdp_address) {
277 printk("%s: System description tables not found\n", 281 printk("%s: System description tables not found\n",
278 __FUNCTION__); 282 __FUNCTION__);
279 goto out_err; 283 goto out_err;
280 } 284 }
281 285
282 if (rsdp_address->pointer_type == ACPI_PHYSICAL_POINTER) { 286 printk("%s: assigning address to rsdp\n", __FUNCTION__);
283 printk("%s: assigning address to rsdp\n", __FUNCTION__); 287 rsdp = (struct acpi_table_rsdp *)(u32)rsdp_address;
284 rsdp = (struct acpi_table_rsdp *)
285 (u32)rsdp_address->pointer.physical;
286 } else {
287 printk("%s: rsdp_address is not a physical pointer\n", __FUNCTION__);
288 goto out_err;
289 }
290 if (!rsdp) { 288 if (!rsdp) {
291 printk("%s: Didn't find ACPI root!\n", __FUNCTION__); 289 printk("%s: Didn't find ACPI root!\n", __FUNCTION__);
292 goto out_err; 290 goto out_err;
@@ -295,13 +293,13 @@ int __init get_memcfg_from_srat(void)
295 printk(KERN_INFO "%.8s v%d [%.6s]\n", rsdp->signature, rsdp->revision, 293 printk(KERN_INFO "%.8s v%d [%.6s]\n", rsdp->signature, rsdp->revision,
296 rsdp->oem_id); 294 rsdp->oem_id);
297 295
298 if (strncmp(rsdp->signature, RSDP_SIG,strlen(RSDP_SIG))) { 296 if (strncmp(rsdp->signature, ACPI_SIG_RSDP,strlen(ACPI_SIG_RSDP))) {
299 printk(KERN_WARNING "%s: RSDP table signature incorrect\n", __FUNCTION__); 297 printk(KERN_WARNING "%s: RSDP table signature incorrect\n", __FUNCTION__);
300 goto out_err; 298 goto out_err;
301 } 299 }
302 300
303 rsdt = (struct acpi_table_rsdt *) 301 rsdt = (struct acpi_table_rsdt *)
304 boot_ioremap(rsdp->rsdt_address, sizeof(struct acpi_table_rsdt)); 302 boot_ioremap(rsdp->rsdt_physical_address, sizeof(struct acpi_table_rsdt));
305 303
306 if (!rsdt) { 304 if (!rsdt) {
307 printk(KERN_WARNING 305 printk(KERN_WARNING
@@ -310,9 +308,9 @@ int __init get_memcfg_from_srat(void)
310 goto out_err; 308 goto out_err;
311 } 309 }
312 310
313 header = & rsdt->header; 311 header = &rsdt->header;
314 312
315 if (strncmp(header->signature, RSDT_SIG, strlen(RSDT_SIG))) { 313 if (strncmp(header->signature, ACPI_SIG_RSDT, strlen(ACPI_SIG_RSDT))) {
316 printk(KERN_WARNING "ACPI: RSDT signature incorrect\n"); 314 printk(KERN_WARNING "ACPI: RSDT signature incorrect\n");
317 goto out_err; 315 goto out_err;
318 } 316 }
@@ -330,9 +328,9 @@ int __init get_memcfg_from_srat(void)
330 328
331 memcpy(&saved_rsdt, rsdt, sizeof(saved_rsdt)); 329 memcpy(&saved_rsdt, rsdt, sizeof(saved_rsdt));
332 330
333 if (saved_rsdt.header.length > sizeof(saved_rsdt)) { 331 if (saved_rsdt.table.header.length > sizeof(saved_rsdt)) {
334 printk(KERN_WARNING "ACPI: Too big length in RSDT: %d\n", 332 printk(KERN_WARNING "ACPI: Too big length in RSDT: %d\n",
335 saved_rsdt.header.length); 333 saved_rsdt.table.header.length);
336 goto out_err; 334 goto out_err;
337 } 335 }
338 336
@@ -341,15 +339,15 @@ int __init get_memcfg_from_srat(void)
341 for (i = 0; i < tables; i++) { 339 for (i = 0; i < tables; i++) {
342 /* Map in header, then map in full table length. */ 340 /* Map in header, then map in full table length. */
343 header = (struct acpi_table_header *) 341 header = (struct acpi_table_header *)
344 boot_ioremap(saved_rsdt.entry[i], sizeof(struct acpi_table_header)); 342 boot_ioremap(saved_rsdt.table.table_offset_entry[i], sizeof(struct acpi_table_header));
345 if (!header) 343 if (!header)
346 break; 344 break;
347 header = (struct acpi_table_header *) 345 header = (struct acpi_table_header *)
348 boot_ioremap(saved_rsdt.entry[i], header->length); 346 boot_ioremap(saved_rsdt.table.table_offset_entry[i], header->length);
349 if (!header) 347 if (!header)
350 break; 348 break;
351 349
352 if (strncmp((char *) &header->signature, "SRAT", 4)) 350 if (strncmp((char *) &header->signature, ACPI_SIG_SRAT, 4))
353 continue; 351 continue;
354 352
355 /* we've found the srat table. don't need to look at any more tables */ 353 /* we've found the srat table. don't need to look at any more tables */
diff --git a/arch/i386/kernel/sysenter.c b/arch/i386/kernel/sysenter.c
index 5da744204d10..bc882a2b1db6 100644
--- a/arch/i386/kernel/sysenter.c
+++ b/arch/i386/kernel/sysenter.c
@@ -70,11 +70,12 @@ void enable_sep_cpu(void)
70 */ 70 */
71extern const char vsyscall_int80_start, vsyscall_int80_end; 71extern const char vsyscall_int80_start, vsyscall_int80_end;
72extern const char vsyscall_sysenter_start, vsyscall_sysenter_end; 72extern const char vsyscall_sysenter_start, vsyscall_sysenter_end;
73static void *syscall_page; 73static struct page *syscall_pages[1];
74 74
75int __init sysenter_setup(void) 75int __init sysenter_setup(void)
76{ 76{
77 syscall_page = (void *)get_zeroed_page(GFP_ATOMIC); 77 void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
78 syscall_pages[0] = virt_to_page(syscall_page);
78 79
79#ifdef CONFIG_COMPAT_VDSO 80#ifdef CONFIG_COMPAT_VDSO
80 __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY); 81 __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY);
@@ -96,31 +97,12 @@ int __init sysenter_setup(void)
96} 97}
97 98
98#ifndef CONFIG_COMPAT_VDSO 99#ifndef CONFIG_COMPAT_VDSO
99static struct page *syscall_nopage(struct vm_area_struct *vma,
100 unsigned long adr, int *type)
101{
102 struct page *p = virt_to_page(adr - vma->vm_start + syscall_page);
103 get_page(p);
104 return p;
105}
106
107/* Prevent VMA merging */
108static void syscall_vma_close(struct vm_area_struct *vma)
109{
110}
111
112static struct vm_operations_struct syscall_vm_ops = {
113 .close = syscall_vma_close,
114 .nopage = syscall_nopage,
115};
116
117/* Defined in vsyscall-sysenter.S */ 100/* Defined in vsyscall-sysenter.S */
118extern void SYSENTER_RETURN; 101extern void SYSENTER_RETURN;
119 102
120/* Setup a VMA at program startup for the vsyscall page */ 103/* Setup a VMA at program startup for the vsyscall page */
121int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) 104int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
122{ 105{
123 struct vm_area_struct *vma;
124 struct mm_struct *mm = current->mm; 106 struct mm_struct *mm = current->mm;
125 unsigned long addr; 107 unsigned long addr;
126 int ret; 108 int ret;
@@ -132,38 +114,25 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
132 goto up_fail; 114 goto up_fail;
133 } 115 }
134 116
135 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
136 if (!vma) {
137 ret = -ENOMEM;
138 goto up_fail;
139 }
140
141 vma->vm_start = addr;
142 vma->vm_end = addr + PAGE_SIZE;
143 /* MAYWRITE to allow gdb to COW and set breakpoints */
144 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
145 /* 117 /*
118 * MAYWRITE to allow gdb to COW and set breakpoints
119 *
146 * Make sure the vDSO gets into every core dump. 120 * Make sure the vDSO gets into every core dump.
147 * Dumping its contents makes post-mortem fully interpretable later 121 * Dumping its contents makes post-mortem fully interpretable later
148 * without matching up the same kernel and hardware config to see 122 * without matching up the same kernel and hardware config to see
149 * what PC values meant. 123 * what PC values meant.
150 */ 124 */
151 vma->vm_flags |= VM_ALWAYSDUMP; 125 ret = install_special_mapping(mm, addr, PAGE_SIZE,
152 vma->vm_flags |= mm->def_flags; 126 VM_READ|VM_EXEC|
153 vma->vm_page_prot = protection_map[vma->vm_flags & 7]; 127 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
154 vma->vm_ops = &syscall_vm_ops; 128 VM_ALWAYSDUMP,
155 vma->vm_mm = mm; 129 syscall_pages);
156 130 if (ret)
157 ret = insert_vm_struct(mm, vma);
158 if (unlikely(ret)) {
159 kmem_cache_free(vm_area_cachep, vma);
160 goto up_fail; 131 goto up_fail;
161 }
162 132
163 current->mm->context.vdso = (void *)addr; 133 current->mm->context.vdso = (void *)addr;
164 current_thread_info()->sysenter_return = 134 current_thread_info()->sysenter_return =
165 (void *)VDSO_SYM(&SYSENTER_RETURN); 135 (void *)VDSO_SYM(&SYSENTER_RETURN);
166 mm->total_vm++;
167up_fail: 136up_fail:
168 up_write(&mm->mmap_sem); 137 up_write(&mm->mmap_sem);
169 return ret; 138 return ret;
diff --git a/arch/i386/mach-es7000/es7000.h b/arch/i386/mach-es7000/es7000.h
index 80566ca4a80a..c8d5aa132fa0 100644
--- a/arch/i386/mach-es7000/es7000.h
+++ b/arch/i386/mach-es7000/es7000.h
@@ -84,15 +84,6 @@ struct es7000_oem_table {
84}; 84};
85 85
86#ifdef CONFIG_ACPI 86#ifdef CONFIG_ACPI
87struct acpi_table_sdt {
88 unsigned long pa;
89 unsigned long count;
90 struct {
91 unsigned long pa;
92 enum acpi_table_id id;
93 unsigned long size;
94 } entry[50];
95};
96 87
97struct oem_table { 88struct oem_table {
98 struct acpi_table_header Header; 89 struct acpi_table_header Header;
diff --git a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c
index 3d0fc853516d..9be6ceabf042 100644
--- a/arch/i386/mach-es7000/es7000plat.c
+++ b/arch/i386/mach-es7000/es7000plat.c
@@ -160,51 +160,14 @@ parse_unisys_oem (char *oemptr)
160int __init 160int __init
161find_unisys_acpi_oem_table(unsigned long *oem_addr) 161find_unisys_acpi_oem_table(unsigned long *oem_addr)
162{ 162{
163 struct acpi_table_rsdp *rsdp = NULL; 163 struct acpi_table_header *header = NULL;
164 unsigned long rsdp_phys = 0; 164 int i = 0;
165 struct acpi_table_header *header = NULL; 165 while (ACPI_SUCCESS(acpi_get_table("OEM1", i++, &header))) {
166 int i; 166 if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) {
167 struct acpi_table_sdt sdt; 167 struct oem_table *t = (struct oem_table *)header;
168 168 *oem_addr = (unsigned long)__acpi_map_table(t->OEMTableAddr,
169 rsdp_phys = acpi_find_rsdp(); 169 t->OEMTableSize);
170 rsdp = __va(rsdp_phys); 170 return 0;
171 if (rsdp->rsdt_address) {
172 struct acpi_table_rsdt *mapped_rsdt = NULL;
173 sdt.pa = rsdp->rsdt_address;
174
175 header = (struct acpi_table_header *)
176 __acpi_map_table(sdt.pa, sizeof(struct acpi_table_header));
177 if (!header)
178 return -ENODEV;
179
180 sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 3;
181 mapped_rsdt = (struct acpi_table_rsdt *)
182 __acpi_map_table(sdt.pa, header->length);
183 if (!mapped_rsdt)
184 return -ENODEV;
185
186 header = &mapped_rsdt->header;
187
188 for (i = 0; i < sdt.count; i++)
189 sdt.entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
190 };
191 for (i = 0; i < sdt.count; i++) {
192
193 header = (struct acpi_table_header *)
194 __acpi_map_table(sdt.entry[i].pa,
195 sizeof(struct acpi_table_header));
196 if (!header)
197 continue;
198 if (!strncmp((char *) &header->signature, "OEM1", 4)) {
199 if (!strncmp((char *) &header->oem_id, "UNISYS", 6)) {
200 void *addr;
201 struct oem_table *t;
202 acpi_table_print(header, sdt.entry[i].pa);
203 t = (struct oem_table *) __acpi_map_table(sdt.entry[i].pa, header->length);
204 addr = (void *) __acpi_map_table(t->OEMTableAddr, t->OEMTableSize);
205 *oem_addr = (unsigned long) addr;
206 return 0;
207 }
208 } 171 }
209 } 172 }
210 return -1; 173 return -1;
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
index ad91528bdc14..e223b1d4981c 100644
--- a/arch/i386/mm/pageattr.c
+++ b/arch/i386/mm/pageattr.c
@@ -224,7 +224,7 @@ void global_flush_tlb(void)
224 list_replace_init(&df_list, &l); 224 list_replace_init(&df_list, &l);
225 spin_unlock_irq(&cpa_lock); 225 spin_unlock_irq(&cpa_lock);
226 if (!cpu_has_clflush) 226 if (!cpu_has_clflush)
227 flush_map(0); 227 flush_map(NULL);
228 list_for_each_entry_safe(pg, next, &l, lru) { 228 list_for_each_entry_safe(pg, next, &l, lru) {
229 if (cpu_has_clflush) 229 if (cpu_has_clflush)
230 flush_map(page_address(pg)); 230 flush_map(page_address(pg));
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index e2616a266e13..5700220dcf5f 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -36,7 +36,7 @@ static DECLARE_BITMAP(fallback_slots, MAX_CHECK_BUS*32);
36static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn) 36static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
37{ 37{
38 int cfg_num = -1; 38 int cfg_num = -1;
39 struct acpi_table_mcfg_config *cfg; 39 struct acpi_mcfg_allocation *cfg;
40 40
41 if (seg == 0 && bus < MAX_CHECK_BUS && 41 if (seg == 0 && bus < MAX_CHECK_BUS &&
42 test_bit(PCI_SLOT(devfn) + 32*bus, fallback_slots)) 42 test_bit(PCI_SLOT(devfn) + 32*bus, fallback_slots))
@@ -48,11 +48,11 @@ static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
48 break; 48 break;
49 } 49 }
50 cfg = &pci_mmcfg_config[cfg_num]; 50 cfg = &pci_mmcfg_config[cfg_num];
51 if (cfg->pci_segment_group_number != seg) 51 if (cfg->pci_segment != seg)
52 continue; 52 continue;
53 if ((cfg->start_bus_number <= bus) && 53 if ((cfg->start_bus_number <= bus) &&
54 (cfg->end_bus_number >= bus)) 54 (cfg->end_bus_number >= bus))
55 return cfg->base_address; 55 return cfg->address;
56 } 56 }
57 57
58 /* Handle more broken MCFG tables on Asus etc. 58 /* Handle more broken MCFG tables on Asus etc.
@@ -60,9 +60,9 @@ static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
60 this applies to all busses. */ 60 this applies to all busses. */
61 cfg = &pci_mmcfg_config[0]; 61 cfg = &pci_mmcfg_config[0];
62 if (pci_mmcfg_config_num == 1 && 62 if (pci_mmcfg_config_num == 1 &&
63 cfg->pci_segment_group_number == 0 && 63 cfg->pci_segment == 0 &&
64 (cfg->start_bus_number | cfg->end_bus_number) == 0) 64 (cfg->start_bus_number | cfg->end_bus_number) == 0)
65 return cfg->base_address; 65 return cfg->address;
66 66
67 /* Fall back to type 0 */ 67 /* Fall back to type 0 */
68 return 0; 68 return 0;
@@ -125,7 +125,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
125 unsigned long flags; 125 unsigned long flags;
126 u32 base; 126 u32 base;
127 127
128 if ((bus > 255) || (devfn > 255) || (reg > 4095)) 128 if ((bus > 255) || (devfn > 255) || (reg > 4095))
129 return -EINVAL; 129 return -EINVAL;
130 130
131 base = get_base_addr(seg, bus, devfn); 131 base = get_base_addr(seg, bus, devfn);
@@ -199,19 +199,19 @@ void __init pci_mmcfg_init(int type)
199 if ((pci_probe & PCI_PROBE_MMCONF) == 0) 199 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
200 return; 200 return;
201 201
202 acpi_table_parse(ACPI_MCFG, acpi_parse_mcfg); 202 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
203 if ((pci_mmcfg_config_num == 0) || 203 if ((pci_mmcfg_config_num == 0) ||
204 (pci_mmcfg_config == NULL) || 204 (pci_mmcfg_config == NULL) ||
205 (pci_mmcfg_config[0].base_address == 0)) 205 (pci_mmcfg_config[0].address == 0))
206 return; 206 return;
207 207
208 /* Only do this check when type 1 works. If it doesn't work 208 /* Only do this check when type 1 works. If it doesn't work
209 assume we run on a Mac and always use MCFG */ 209 assume we run on a Mac and always use MCFG */
210 if (type == 1 && !e820_all_mapped(pci_mmcfg_config[0].base_address, 210 if (type == 1 && !e820_all_mapped(pci_mmcfg_config[0].address,
211 pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN, 211 pci_mmcfg_config[0].address + MMCONFIG_APER_MIN,
212 E820_RESERVED)) { 212 E820_RESERVED)) {
213 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n", 213 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %lx is not E820-reserved\n",
214 pci_mmcfg_config[0].base_address); 214 (unsigned long)pci_mmcfg_config[0].address);
215 printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); 215 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
216 return; 216 return;
217 } 217 }
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index fcacfe291b9b..f1d2899e9a62 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -11,6 +11,8 @@ menu "Processor type and features"
11 11
12config IA64 12config IA64
13 bool 13 bool
14 select PCI if (!IA64_HP_SIM)
15 select ACPI if (!IA64_HP_SIM)
14 default y 16 default y
15 help 17 help
16 The Itanium Processor Family is Intel's 64-bit successor to 18 The Itanium Processor Family is Intel's 64-bit successor to
@@ -28,7 +30,6 @@ config MMU
28 30
29config SWIOTLB 31config SWIOTLB
30 bool 32 bool
31 default y
32 33
33config RWSEM_XCHGADD_ALGORITHM 34config RWSEM_XCHGADD_ALGORITHM
34 bool 35 bool
@@ -84,10 +85,9 @@ choice
84 85
85config IA64_GENERIC 86config IA64_GENERIC
86 bool "generic" 87 bool "generic"
87 select ACPI
88 select PCI
89 select NUMA 88 select NUMA
90 select ACPI_NUMA 89 select ACPI_NUMA
90 select SWIOTLB
91 help 91 help
92 This selects the system type of your hardware. A "generic" kernel 92 This selects the system type of your hardware. A "generic" kernel
93 will run on any supported IA-64 system. However, if you configure 93 will run on any supported IA-64 system. However, if you configure
@@ -104,6 +104,7 @@ config IA64_GENERIC
104 104
105config IA64_DIG 105config IA64_DIG
106 bool "DIG-compliant" 106 bool "DIG-compliant"
107 select SWIOTLB
107 108
108config IA64_HP_ZX1 109config IA64_HP_ZX1
109 bool "HP-zx1/sx1000" 110 bool "HP-zx1/sx1000"
@@ -113,6 +114,7 @@ config IA64_HP_ZX1
113 114
114config IA64_HP_ZX1_SWIOTLB 115config IA64_HP_ZX1_SWIOTLB
115 bool "HP-zx1/sx1000 with software I/O TLB" 116 bool "HP-zx1/sx1000 with software I/O TLB"
117 select SWIOTLB
116 help 118 help
117 Build a kernel that runs on HP zx1 and sx1000 systems even when they 119 Build a kernel that runs on HP zx1 and sx1000 systems even when they
118 have broken PCI devices which cannot DMA to full 32 bits. Apart 120 have broken PCI devices which cannot DMA to full 32 bits. Apart
@@ -131,6 +133,7 @@ config IA64_SGI_SN2
131 133
132config IA64_HP_SIM 134config IA64_HP_SIM
133 bool "Ski-simulator" 135 bool "Ski-simulator"
136 select SWIOTLB
134 137
135endchoice 138endchoice
136 139
diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c
index a5a5637507be..2153bcacbe6c 100644
--- a/arch/ia64/hp/common/hwsw_iommu.c
+++ b/arch/ia64/hp/common/hwsw_iommu.c
@@ -192,3 +192,7 @@ EXPORT_SYMBOL(hwsw_unmap_sg);
192EXPORT_SYMBOL(hwsw_dma_supported); 192EXPORT_SYMBOL(hwsw_dma_supported);
193EXPORT_SYMBOL(hwsw_alloc_coherent); 193EXPORT_SYMBOL(hwsw_alloc_coherent);
194EXPORT_SYMBOL(hwsw_free_coherent); 194EXPORT_SYMBOL(hwsw_free_coherent);
195EXPORT_SYMBOL(hwsw_sync_single_for_cpu);
196EXPORT_SYMBOL(hwsw_sync_single_for_device);
197EXPORT_SYMBOL(hwsw_sync_sg_for_cpu);
198EXPORT_SYMBOL(hwsw_sync_sg_for_device);
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 29f05d4b68cd..9197d7b361b3 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -55,7 +55,7 @@
55 55
56#define BAD_MADT_ENTRY(entry, end) ( \ 56#define BAD_MADT_ENTRY(entry, end) ( \
57 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ 57 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
58 ((acpi_table_entry_header *)entry)->length < sizeof(*entry)) 58 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
59 59
60#define PREFIX "ACPI: " 60#define PREFIX "ACPI: "
61 61
@@ -67,16 +67,11 @@ EXPORT_SYMBOL(pm_power_off);
67unsigned int acpi_cpei_override; 67unsigned int acpi_cpei_override;
68unsigned int acpi_cpei_phys_cpuid; 68unsigned int acpi_cpei_phys_cpuid;
69 69
70#define MAX_SAPICS 256
71u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = {[0 ... MAX_SAPICS - 1] = -1 };
72
73EXPORT_SYMBOL(ia64_acpiid_to_sapicid);
74
75const char *acpi_get_sysname(void) 70const char *acpi_get_sysname(void)
76{ 71{
77#ifdef CONFIG_IA64_GENERIC 72#ifdef CONFIG_IA64_GENERIC
78 unsigned long rsdp_phys; 73 unsigned long rsdp_phys;
79 struct acpi20_table_rsdp *rsdp; 74 struct acpi_table_rsdp *rsdp;
80 struct acpi_table_xsdt *xsdt; 75 struct acpi_table_xsdt *xsdt;
81 struct acpi_table_header *hdr; 76 struct acpi_table_header *hdr;
82 77
@@ -87,16 +82,16 @@ const char *acpi_get_sysname(void)
87 return "dig"; 82 return "dig";
88 } 83 }
89 84
90 rsdp = (struct acpi20_table_rsdp *)__va(rsdp_phys); 85 rsdp = (struct acpi_table_rsdp *)__va(rsdp_phys);
91 if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) { 86 if (strncmp(rsdp->signature, ACPI_SIG_RSDP, sizeof(ACPI_SIG_RSDP) - 1)) {
92 printk(KERN_ERR 87 printk(KERN_ERR
93 "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n"); 88 "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
94 return "dig"; 89 return "dig";
95 } 90 }
96 91
97 xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address); 92 xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_physical_address);
98 hdr = &xsdt->header; 93 hdr = &xsdt->header;
99 if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) { 94 if (strncmp(hdr->signature, ACPI_SIG_XSDT, sizeof(ACPI_SIG_XSDT) - 1)) {
100 printk(KERN_ERR 95 printk(KERN_ERR
101 "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n"); 96 "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
102 return "dig"; 97 return "dig";
@@ -169,12 +164,12 @@ struct acpi_table_madt *acpi_madt __initdata;
169static u8 has_8259; 164static u8 has_8259;
170 165
171static int __init 166static int __init
172acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, 167acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
173 const unsigned long end) 168 const unsigned long end)
174{ 169{
175 struct acpi_table_lapic_addr_ovr *lapic; 170 struct acpi_madt_local_apic_override *lapic;
176 171
177 lapic = (struct acpi_table_lapic_addr_ovr *)header; 172 lapic = (struct acpi_madt_local_apic_override *)header;
178 173
179 if (BAD_MADT_ENTRY(lapic, end)) 174 if (BAD_MADT_ENTRY(lapic, end))
180 return -EINVAL; 175 return -EINVAL;
@@ -187,22 +182,19 @@ acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
187} 182}
188 183
189static int __init 184static int __init
190acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end) 185acpi_parse_lsapic(struct acpi_subtable_header * header, const unsigned long end)
191{ 186{
192 struct acpi_table_lsapic *lsapic; 187 struct acpi_madt_local_sapic *lsapic;
193 188
194 lsapic = (struct acpi_table_lsapic *)header; 189 lsapic = (struct acpi_madt_local_sapic *)header;
195 190
196 if (BAD_MADT_ENTRY(lsapic, end)) 191 /*Skip BAD_MADT_ENTRY check, as lsapic size could vary */
197 return -EINVAL;
198 192
199 if (lsapic->flags.enabled) { 193 if (lsapic->lapic_flags & ACPI_MADT_ENABLED) {
200#ifdef CONFIG_SMP 194#ifdef CONFIG_SMP
201 smp_boot_data.cpu_phys_id[available_cpus] = 195 smp_boot_data.cpu_phys_id[available_cpus] =
202 (lsapic->id << 8) | lsapic->eid; 196 (lsapic->id << 8) | lsapic->eid;
203#endif 197#endif
204 ia64_acpiid_to_sapicid[lsapic->acpi_id] =
205 (lsapic->id << 8) | lsapic->eid;
206 ++available_cpus; 198 ++available_cpus;
207 } 199 }
208 200
@@ -211,11 +203,11 @@ acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
211} 203}
212 204
213static int __init 205static int __init
214acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) 206acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
215{ 207{
216 struct acpi_table_lapic_nmi *lacpi_nmi; 208 struct acpi_madt_local_apic_nmi *lacpi_nmi;
217 209
218 lacpi_nmi = (struct acpi_table_lapic_nmi *)header; 210 lacpi_nmi = (struct acpi_madt_local_apic_nmi *)header;
219 211
220 if (BAD_MADT_ENTRY(lacpi_nmi, end)) 212 if (BAD_MADT_ENTRY(lacpi_nmi, end))
221 return -EINVAL; 213 return -EINVAL;
@@ -225,11 +217,11 @@ acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
225} 217}
226 218
227static int __init 219static int __init
228acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end) 220acpi_parse_iosapic(struct acpi_subtable_header * header, const unsigned long end)
229{ 221{
230 struct acpi_table_iosapic *iosapic; 222 struct acpi_madt_io_sapic *iosapic;
231 223
232 iosapic = (struct acpi_table_iosapic *)header; 224 iosapic = (struct acpi_madt_io_sapic *)header;
233 225
234 if (BAD_MADT_ENTRY(iosapic, end)) 226 if (BAD_MADT_ENTRY(iosapic, end))
235 return -EINVAL; 227 return -EINVAL;
@@ -240,13 +232,13 @@ acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
240static unsigned int __initdata acpi_madt_rev; 232static unsigned int __initdata acpi_madt_rev;
241 233
242static int __init 234static int __init
243acpi_parse_plat_int_src(acpi_table_entry_header * header, 235acpi_parse_plat_int_src(struct acpi_subtable_header * header,
244 const unsigned long end) 236 const unsigned long end)
245{ 237{
246 struct acpi_table_plat_int_src *plintsrc; 238 struct acpi_madt_interrupt_source *plintsrc;
247 int vector; 239 int vector;
248 240
249 plintsrc = (struct acpi_table_plat_int_src *)header; 241 plintsrc = (struct acpi_madt_interrupt_source *)header;
250 242
251 if (BAD_MADT_ENTRY(plintsrc, end)) 243 if (BAD_MADT_ENTRY(plintsrc, end))
252 return -EINVAL; 244 return -EINVAL;
@@ -257,19 +249,19 @@ acpi_parse_plat_int_src(acpi_table_entry_header * header,
257 */ 249 */
258 vector = iosapic_register_platform_intr(plintsrc->type, 250 vector = iosapic_register_platform_intr(plintsrc->type,
259 plintsrc->global_irq, 251 plintsrc->global_irq,
260 plintsrc->iosapic_vector, 252 plintsrc->io_sapic_vector,
261 plintsrc->eid, 253 plintsrc->eid,
262 plintsrc->id, 254 plintsrc->id,
263 (plintsrc->flags.polarity == 255 ((plintsrc->inti_flags & ACPI_MADT_POLARITY_MASK) ==
264 1) ? IOSAPIC_POL_HIGH : 256 ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
265 IOSAPIC_POL_LOW, 257 IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
266 (plintsrc->flags.trigger == 258 ((plintsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
267 1) ? IOSAPIC_EDGE : 259 ACPI_MADT_TRIGGER_EDGE) ?
268 IOSAPIC_LEVEL); 260 IOSAPIC_EDGE : IOSAPIC_LEVEL);
269 261
270 platform_intr_list[plintsrc->type] = vector; 262 platform_intr_list[plintsrc->type] = vector;
271 if (acpi_madt_rev > 1) { 263 if (acpi_madt_rev > 1) {
272 acpi_cpei_override = plintsrc->plint_flags.cpei_override_flag; 264 acpi_cpei_override = plintsrc->flags & ACPI_MADT_CPEI_OVERRIDE;
273 } 265 }
274 266
275 /* 267 /*
@@ -324,30 +316,32 @@ unsigned int get_cpei_target_cpu(void)
324} 316}
325 317
326static int __init 318static int __init
327acpi_parse_int_src_ovr(acpi_table_entry_header * header, 319acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
328 const unsigned long end) 320 const unsigned long end)
329{ 321{
330 struct acpi_table_int_src_ovr *p; 322 struct acpi_madt_interrupt_override *p;
331 323
332 p = (struct acpi_table_int_src_ovr *)header; 324 p = (struct acpi_madt_interrupt_override *)header;
333 325
334 if (BAD_MADT_ENTRY(p, end)) 326 if (BAD_MADT_ENTRY(p, end))
335 return -EINVAL; 327 return -EINVAL;
336 328
337 iosapic_override_isa_irq(p->bus_irq, p->global_irq, 329 iosapic_override_isa_irq(p->source_irq, p->global_irq,
338 (p->flags.polarity == 330 ((p->inti_flags & ACPI_MADT_POLARITY_MASK) ==
339 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, 331 ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
340 (p->flags.trigger == 332 IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
341 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); 333 ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
334 ACPI_MADT_TRIGGER_EDGE) ?
335 IOSAPIC_EDGE : IOSAPIC_LEVEL);
342 return 0; 336 return 0;
343} 337}
344 338
345static int __init 339static int __init
346acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) 340acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end)
347{ 341{
348 struct acpi_table_nmi_src *nmi_src; 342 struct acpi_madt_nmi_source *nmi_src;
349 343
350 nmi_src = (struct acpi_table_nmi_src *)header; 344 nmi_src = (struct acpi_madt_nmi_source *)header;
351 345
352 if (BAD_MADT_ENTRY(nmi_src, end)) 346 if (BAD_MADT_ENTRY(nmi_src, end))
353 return -EINVAL; 347 return -EINVAL;
@@ -371,12 +365,12 @@ static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
371 } 365 }
372} 366}
373 367
374static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) 368static int __init acpi_parse_madt(struct acpi_table_header *table)
375{ 369{
376 if (!phys_addr || !size) 370 if (!table)
377 return -EINVAL; 371 return -EINVAL;
378 372
379 acpi_madt = (struct acpi_table_madt *)__va(phys_addr); 373 acpi_madt = (struct acpi_table_madt *)table;
380 374
381 acpi_madt_rev = acpi_madt->header.revision; 375 acpi_madt_rev = acpi_madt->header.revision;
382 376
@@ -384,14 +378,14 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
384#ifdef CONFIG_ITANIUM 378#ifdef CONFIG_ITANIUM
385 has_8259 = 1; /* Firmware on old Itanium systems is broken */ 379 has_8259 = 1; /* Firmware on old Itanium systems is broken */
386#else 380#else
387 has_8259 = acpi_madt->flags.pcat_compat; 381 has_8259 = acpi_madt->flags & ACPI_MADT_PCAT_COMPAT;
388#endif 382#endif
389 iosapic_system_init(has_8259); 383 iosapic_system_init(has_8259);
390 384
391 /* Get base address of IPI Message Block */ 385 /* Get base address of IPI Message Block */
392 386
393 if (acpi_madt->lapic_address) 387 if (acpi_madt->address)
394 ipi_base_addr = ioremap(acpi_madt->lapic_address, 0); 388 ipi_base_addr = ioremap(acpi_madt->address, 0);
395 389
396 printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr); 390 printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
397 391
@@ -413,23 +407,24 @@ static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
413#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) 407#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
414static struct acpi_table_slit __initdata *slit_table; 408static struct acpi_table_slit __initdata *slit_table;
415 409
416static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa) 410static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
417{ 411{
418 int pxm; 412 int pxm;
419 413
420 pxm = pa->proximity_domain; 414 pxm = pa->proximity_domain_lo;
421 if (ia64_platform_is("sn2")) 415 if (ia64_platform_is("sn2"))
422 pxm += pa->reserved[0] << 8; 416 pxm += pa->proximity_domain_hi[0] << 8;
423 return pxm; 417 return pxm;
424} 418}
425 419
426static int get_memory_proximity_domain(struct acpi_table_memory_affinity *ma) 420static int get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
427{ 421{
428 int pxm; 422 int pxm;
429 423
430 pxm = ma->proximity_domain; 424 pxm = ma->proximity_domain;
431 if (ia64_platform_is("sn2")) 425 if (!ia64_platform_is("sn2"))
432 pxm += ma->reserved1[0] << 8; 426 pxm &= 0xff;
427
433 return pxm; 428 return pxm;
434} 429}
435 430
@@ -442,7 +437,7 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
442 u32 len; 437 u32 len;
443 438
444 len = sizeof(struct acpi_table_header) + 8 439 len = sizeof(struct acpi_table_header) + 8
445 + slit->localities * slit->localities; 440 + slit->locality_count * slit->locality_count;
446 if (slit->header.length != len) { 441 if (slit->header.length != len) {
447 printk(KERN_ERR 442 printk(KERN_ERR
448 "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n", 443 "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
@@ -454,11 +449,11 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
454} 449}
455 450
456void __init 451void __init
457acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) 452acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
458{ 453{
459 int pxm; 454 int pxm;
460 455
461 if (!pa->flags.enabled) 456 if (!(pa->flags & ACPI_SRAT_CPU_ENABLED))
462 return; 457 return;
463 458
464 pxm = get_processor_proximity_domain(pa); 459 pxm = get_processor_proximity_domain(pa);
@@ -467,14 +462,14 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
467 pxm_bit_set(pxm); 462 pxm_bit_set(pxm);
468 463
469 node_cpuid[srat_num_cpus].phys_id = 464 node_cpuid[srat_num_cpus].phys_id =
470 (pa->apic_id << 8) | (pa->lsapic_eid); 465 (pa->apic_id << 8) | (pa->local_sapic_eid);
471 /* nid should be overridden as logical node id later */ 466 /* nid should be overridden as logical node id later */
472 node_cpuid[srat_num_cpus].nid = pxm; 467 node_cpuid[srat_num_cpus].nid = pxm;
473 srat_num_cpus++; 468 srat_num_cpus++;
474} 469}
475 470
476void __init 471void __init
477acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) 472acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
478{ 473{
479 unsigned long paddr, size; 474 unsigned long paddr, size;
480 int pxm; 475 int pxm;
@@ -483,13 +478,11 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
483 pxm = get_memory_proximity_domain(ma); 478 pxm = get_memory_proximity_domain(ma);
484 479
485 /* fill node memory chunk structure */ 480 /* fill node memory chunk structure */
486 paddr = ma->base_addr_hi; 481 paddr = ma->base_address;
487 paddr = (paddr << 32) | ma->base_addr_lo; 482 size = ma->length;
488 size = ma->length_hi;
489 size = (size << 32) | ma->length_lo;
490 483
491 /* Ignore disabled entries */ 484 /* Ignore disabled entries */
492 if (!ma->flags.enabled) 485 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
493 return; 486 return;
494 487
495 /* record this node in proximity bitmap */ 488 /* record this node in proximity bitmap */
@@ -560,16 +553,16 @@ void __init acpi_numa_arch_fixup(void)
560 if (!slit_table) 553 if (!slit_table)
561 return; 554 return;
562 memset(numa_slit, -1, sizeof(numa_slit)); 555 memset(numa_slit, -1, sizeof(numa_slit));
563 for (i = 0; i < slit_table->localities; i++) { 556 for (i = 0; i < slit_table->locality_count; i++) {
564 if (!pxm_bit_test(i)) 557 if (!pxm_bit_test(i))
565 continue; 558 continue;
566 node_from = pxm_to_node(i); 559 node_from = pxm_to_node(i);
567 for (j = 0; j < slit_table->localities; j++) { 560 for (j = 0; j < slit_table->locality_count; j++) {
568 if (!pxm_bit_test(j)) 561 if (!pxm_bit_test(j))
569 continue; 562 continue;
570 node_to = pxm_to_node(j); 563 node_to = pxm_to_node(j);
571 node_distance(node_from, node_to) = 564 node_distance(node_from, node_to) =
572 slit_table->entry[i * slit_table->localities + j]; 565 slit_table->entry[i * slit_table->locality_count + j];
573 } 566 }
574 } 567 }
575 568
@@ -617,21 +610,21 @@ void acpi_unregister_gsi(u32 gsi)
617 610
618EXPORT_SYMBOL(acpi_unregister_gsi); 611EXPORT_SYMBOL(acpi_unregister_gsi);
619 612
620static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size) 613static int __init acpi_parse_fadt(struct acpi_table_header *table)
621{ 614{
622 struct acpi_table_header *fadt_header; 615 struct acpi_table_header *fadt_header;
623 struct fadt_descriptor *fadt; 616 struct acpi_table_fadt *fadt;
624 617
625 if (!phys_addr || !size) 618 if (!table)
626 return -EINVAL; 619 return -EINVAL;
627 620
628 fadt_header = (struct acpi_table_header *)__va(phys_addr); 621 fadt_header = (struct acpi_table_header *)table;
629 if (fadt_header->revision != 3) 622 if (fadt_header->revision != 3)
630 return -ENODEV; /* Only deal with ACPI 2.0 FADT */ 623 return -ENODEV; /* Only deal with ACPI 2.0 FADT */
631 624
632 fadt = (struct fadt_descriptor *)fadt_header; 625 fadt = (struct acpi_table_fadt *)fadt_header;
633 626
634 acpi_register_gsi(fadt->sci_int, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); 627 acpi_register_gsi(fadt->sci_interrupt, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
635 return 0; 628 return 0;
636} 629}
637 630
@@ -658,7 +651,7 @@ int __init acpi_boot_init(void)
658 * information -- the successor to MPS tables. 651 * information -- the successor to MPS tables.
659 */ 652 */
660 653
661 if (acpi_table_parse(ACPI_APIC, acpi_parse_madt) < 1) { 654 if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt) < 1) {
662 printk(KERN_ERR PREFIX "Can't find MADT\n"); 655 printk(KERN_ERR PREFIX "Can't find MADT\n");
663 goto skip_madt; 656 goto skip_madt;
664 } 657 }
@@ -666,40 +659,40 @@ int __init acpi_boot_init(void)
666 /* Local APIC */ 659 /* Local APIC */
667 660
668 if (acpi_table_parse_madt 661 if (acpi_table_parse_madt
669 (ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0) 662 (ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, acpi_parse_lapic_addr_ovr, 0) < 0)
670 printk(KERN_ERR PREFIX 663 printk(KERN_ERR PREFIX
671 "Error parsing LAPIC address override entry\n"); 664 "Error parsing LAPIC address override entry\n");
672 665
673 if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) 666 if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC, acpi_parse_lsapic, NR_CPUS)
674 < 1) 667 < 1)
675 printk(KERN_ERR PREFIX 668 printk(KERN_ERR PREFIX
676 "Error parsing MADT - no LAPIC entries\n"); 669 "Error parsing MADT - no LAPIC entries\n");
677 670
678 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) 671 if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0)
679 < 0) 672 < 0)
680 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 673 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
681 674
682 /* I/O APIC */ 675 /* I/O APIC */
683 676
684 if (acpi_table_parse_madt 677 if (acpi_table_parse_madt
685 (ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) 678 (ACPI_MADT_TYPE_IO_SAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
686 printk(KERN_ERR PREFIX 679 printk(KERN_ERR PREFIX
687 "Error parsing MADT - no IOSAPIC entries\n"); 680 "Error parsing MADT - no IOSAPIC entries\n");
688 681
689 /* System-Level Interrupt Routing */ 682 /* System-Level Interrupt Routing */
690 683
691 if (acpi_table_parse_madt 684 if (acpi_table_parse_madt
692 (ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, 685 (ACPI_MADT_TYPE_INTERRUPT_SOURCE, acpi_parse_plat_int_src,
693 ACPI_MAX_PLATFORM_INTERRUPTS) < 0) 686 ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
694 printk(KERN_ERR PREFIX 687 printk(KERN_ERR PREFIX
695 "Error parsing platform interrupt source entry\n"); 688 "Error parsing platform interrupt source entry\n");
696 689
697 if (acpi_table_parse_madt 690 if (acpi_table_parse_madt
698 (ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0) 691 (ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr, 0) < 0)
699 printk(KERN_ERR PREFIX 692 printk(KERN_ERR PREFIX
700 "Error parsing interrupt source overrides entry\n"); 693 "Error parsing interrupt source overrides entry\n");
701 694
702 if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0) 695 if (acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src, 0) < 0)
703 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); 696 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
704 skip_madt: 697 skip_madt:
705 698
@@ -709,7 +702,7 @@ int __init acpi_boot_init(void)
709 * gets interrupts such as power and sleep buttons. If it's not 702 * gets interrupts such as power and sleep buttons. If it's not
710 * on a Legacy interrupt, it needs to be setup. 703 * on a Legacy interrupt, it needs to be setup.
711 */ 704 */
712 if (acpi_table_parse(ACPI_FADT, acpi_parse_fadt) < 1) 705 if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt) < 1)
713 printk(KERN_ERR PREFIX "Can't find FADT\n"); 706 printk(KERN_ERR PREFIX "Can't find FADT\n");
714 707
715#ifdef CONFIG_SMP 708#ifdef CONFIG_SMP
@@ -842,7 +835,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
842{ 835{
843 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 836 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
844 union acpi_object *obj; 837 union acpi_object *obj;
845 struct acpi_table_lsapic *lsapic; 838 struct acpi_madt_local_sapic *lsapic;
846 cpumask_t tmp_map; 839 cpumask_t tmp_map;
847 long physid; 840 long physid;
848 int cpu; 841 int cpu;
@@ -854,16 +847,16 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
854 return -EINVAL; 847 return -EINVAL;
855 848
856 obj = buffer.pointer; 849 obj = buffer.pointer;
857 if (obj->type != ACPI_TYPE_BUFFER || 850 if (obj->type != ACPI_TYPE_BUFFER)
858 obj->buffer.length < sizeof(*lsapic)) { 851 {
859 kfree(buffer.pointer); 852 kfree(buffer.pointer);
860 return -EINVAL; 853 return -EINVAL;
861 } 854 }
862 855
863 lsapic = (struct acpi_table_lsapic *)obj->buffer.pointer; 856 lsapic = (struct acpi_madt_local_sapic *)obj->buffer.pointer;
864 857
865 if ((lsapic->header.type != ACPI_MADT_LSAPIC) || 858 if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
866 (!lsapic->flags.enabled)) { 859 (!lsapic->lapic_flags & ACPI_MADT_ENABLED)) {
867 kfree(buffer.pointer); 860 kfree(buffer.pointer);
868 return -EINVAL; 861 return -EINVAL;
869 } 862 }
@@ -883,7 +876,6 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
883 876
884 cpu_set(cpu, cpu_present_map); 877 cpu_set(cpu, cpu_present_map);
885 ia64_cpu_to_sapicid[cpu] = physid; 878 ia64_cpu_to_sapicid[cpu] = physid;
886 ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu];
887 879
888 *pcpu = cpu; 880 *pcpu = cpu;
889 return (0); 881 return (0);
@@ -893,14 +885,6 @@ EXPORT_SYMBOL(acpi_map_lsapic);
893 885
894int acpi_unmap_lsapic(int cpu) 886int acpi_unmap_lsapic(int cpu)
895{ 887{
896 int i;
897
898 for (i = 0; i < MAX_SAPICS; i++) {
899 if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
900 ia64_acpiid_to_sapicid[i] = -1;
901 break;
902 }
903 }
904 ia64_cpu_to_sapicid[cpu] = -1; 888 ia64_cpu_to_sapicid[cpu] = -1;
905 cpu_clear(cpu, cpu_present_map); 889 cpu_clear(cpu, cpu_present_map);
906 890
@@ -920,7 +904,7 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
920{ 904{
921 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 905 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
922 union acpi_object *obj; 906 union acpi_object *obj;
923 struct acpi_table_iosapic *iosapic; 907 struct acpi_madt_io_sapic *iosapic;
924 unsigned int gsi_base; 908 unsigned int gsi_base;
925 int pxm, node; 909 int pxm, node;
926 910
@@ -938,9 +922,9 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
938 return AE_OK; 922 return AE_OK;
939 } 923 }
940 924
941 iosapic = (struct acpi_table_iosapic *)obj->buffer.pointer; 925 iosapic = (struct acpi_madt_io_sapic *)obj->buffer.pointer;
942 926
943 if (iosapic->header.type != ACPI_MADT_IOSAPIC) { 927 if (iosapic->header.type != ACPI_MADT_TYPE_IO_SAPIC) {
944 kfree(buffer.pointer); 928 kfree(buffer.pointer);
945 return AE_OK; 929 return AE_OK;
946 } 930 }
diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index bc2f64d72244..37bb16f07fc3 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -52,7 +52,7 @@ extern void ia64_dump_cpu_regs(void *);
52static DEFINE_PER_CPU(struct elf_prstatus, elf_prstatus); 52static DEFINE_PER_CPU(struct elf_prstatus, elf_prstatus);
53 53
54void 54void
55crash_save_this_cpu() 55crash_save_this_cpu(void)
56{ 56{
57 void *buf; 57 void *buf;
58 unsigned long cfm, sof, sol; 58 unsigned long cfm, sof, sol;
@@ -79,6 +79,7 @@ crash_save_this_cpu()
79 final_note(buf); 79 final_note(buf);
80} 80}
81 81
82#ifdef CONFIG_SMP
82static int 83static int
83kdump_wait_cpu_freeze(void) 84kdump_wait_cpu_freeze(void)
84{ 85{
@@ -91,6 +92,7 @@ kdump_wait_cpu_freeze(void)
91 } 92 }
92 return 1; 93 return 1;
93} 94}
95#endif
94 96
95void 97void
96machine_crash_shutdown(struct pt_regs *pt) 98machine_crash_shutdown(struct pt_regs *pt)
@@ -116,6 +118,11 @@ machine_crash_shutdown(struct pt_regs *pt)
116static void 118static void
117machine_kdump_on_init(void) 119machine_kdump_on_init(void)
118{ 120{
121 if (!ia64_kimage) {
122 printk(KERN_NOTICE "machine_kdump_on_init(): "
123 "kdump not configured\n");
124 return;
125 }
119 local_irq_disable(); 126 local_irq_disable();
120 kexec_disable_iosapic(); 127 kexec_disable_iosapic();
121 machine_kexec(ia64_kimage); 128 machine_kexec(ia64_kimage);
@@ -132,11 +139,12 @@ kdump_cpu_freeze(struct unw_frame_info *info, void *arg)
132 atomic_inc(&kdump_cpu_freezed); 139 atomic_inc(&kdump_cpu_freezed);
133 kdump_status[cpuid] = 1; 140 kdump_status[cpuid] = 1;
134 mb(); 141 mb();
135 if (cpuid == 0) { 142#ifdef CONFIG_HOTPLUG_CPU
136 for (;;) 143 if (cpuid != 0)
137 cpu_relax();
138 } else
139 ia64_jump_to_sal(&sal_boot_rendez_state[cpuid]); 144 ia64_jump_to_sal(&sal_boot_rendez_state[cpuid]);
145#endif
146 for (;;)
147 cpu_relax();
140} 148}
141 149
142static int 150static int
diff --git a/arch/ia64/kernel/crash_dump.c b/arch/ia64/kernel/crash_dump.c
index 83b8c91c1408..da60e90eeeb1 100644
--- a/arch/ia64/kernel/crash_dump.c
+++ b/arch/ia64/kernel/crash_dump.c
@@ -9,7 +9,8 @@
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/types.h> 10#include <linux/types.h>
11 11
12#include <linux/uaccess.h> 12#include <asm/page.h>
13#include <asm/uaccess.h>
13 14
14/** 15/**
15 * copy_oldmem_page - copy one page from "oldmem" 16 * copy_oldmem_page - copy one page from "oldmem"
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 0b25a7d4e1e4..6c03928544c2 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -380,7 +380,7 @@ efi_get_pal_addr (void)
380#endif 380#endif
381 return __va(md->phys_addr); 381 return __va(md->phys_addr);
382 } 382 }
383 printk(KERN_WARNING "%s: no PAL-code memory-descriptor found", 383 printk(KERN_WARNING "%s: no PAL-code memory-descriptor found\n",
384 __FUNCTION__); 384 __FUNCTION__);
385 return NULL; 385 return NULL;
386} 386}
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 15234ed3a341..e7873eeae448 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1610,5 +1610,7 @@ sys_call_table:
1610 data8 sys_sync_file_range // 1300 1610 data8 sys_sync_file_range // 1300
1611 data8 sys_tee 1611 data8 sys_tee
1612 data8 sys_vmsplice 1612 data8 sys_vmsplice
1613 data8 sys_ni_syscall // reserved for move_pages
1614 data8 sys_getcpu
1613 1615
1614 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1616 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index 0fc5fb7865cf..d6aab40c6416 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -925,6 +925,11 @@ iosapic_unregister_intr (unsigned int gsi)
925 /* Clear the interrupt controller descriptor */ 925 /* Clear the interrupt controller descriptor */
926 idesc->chip = &no_irq_type; 926 idesc->chip = &no_irq_type;
927 927
928#ifdef CONFIG_SMP
929 /* Clear affinity */
930 cpus_setall(idesc->affinity);
931#endif
932
928 /* Clear the interrupt information */ 933 /* Clear the interrupt information */
929 memset(&iosapic_intr_info[vector], 0, 934 memset(&iosapic_intr_info[vector], 0,
930 sizeof(struct iosapic_intr_info)); 935 sizeof(struct iosapic_intr_info));
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
index e2ccc9f660c5..4f0f3b8c1ee2 100644
--- a/arch/ia64/kernel/machine_kexec.c
+++ b/arch/ia64/kernel/machine_kexec.c
@@ -14,6 +14,7 @@
14#include <linux/kexec.h> 14#include <linux/kexec.h>
15#include <linux/cpu.h> 15#include <linux/cpu.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/efi.h>
17#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
18#include <asm/setup.h> 19#include <asm/setup.h>
19#include <asm/delay.h> 20#include <asm/delay.h>
@@ -68,22 +69,10 @@ void machine_kexec_cleanup(struct kimage *image)
68{ 69{
69} 70}
70 71
71void machine_shutdown(void)
72{
73 int cpu;
74
75 for_each_online_cpu(cpu) {
76 if (cpu != smp_processor_id())
77 cpu_down(cpu);
78 }
79 kexec_disable_iosapic();
80}
81
82/* 72/*
83 * Do not allocate memory (or fail in any way) in machine_kexec(). 73 * Do not allocate memory (or fail in any way) in machine_kexec().
84 * We are past the point of no return, committed to rebooting now. 74 * We are past the point of no return, committed to rebooting now.
85 */ 75 */
86extern void *efi_get_pal_addr(void);
87static void ia64_machine_kexec(struct unw_frame_info *info, void *arg) 76static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)
88{ 77{
89 struct kimage *image = arg; 78 struct kimage *image = arg;
@@ -93,6 +82,7 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)
93 unsigned long vector; 82 unsigned long vector;
94 int ii; 83 int ii;
95 84
85 BUG_ON(!image);
96 if (image->type == KEXEC_TYPE_CRASH) { 86 if (image->type == KEXEC_TYPE_CRASH) {
97 crash_save_this_cpu(); 87 crash_save_this_cpu();
98 current->thread.ksp = (__u64)info->sw - 16; 88 current->thread.ksp = (__u64)info->sw - 16;
@@ -131,6 +121,7 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)
131 121
132void machine_kexec(struct kimage *image) 122void machine_kexec(struct kimage *image)
133{ 123{
124 BUG_ON(!image);
134 unw_init_running(ia64_machine_kexec, image); 125 unw_init_running(ia64_machine_kexec, image);
135 for(;;); 126 for(;;);
136} 127}
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 822e59a1b822..0d05450c91c4 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -64,12 +64,17 @@ static void ia64_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask)
64} 64}
65#endif /* CONFIG_SMP */ 65#endif /* CONFIG_SMP */
66 66
67int ia64_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) 67int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
68{ 68{
69 struct msi_msg msg; 69 struct msi_msg msg;
70 unsigned long dest_phys_id; 70 unsigned long dest_phys_id;
71 unsigned int vector; 71 unsigned int irq, vector;
72 72
73 irq = create_irq();
74 if (irq < 0)
75 return irq;
76
77 set_irq_msi(irq, desc);
73 dest_phys_id = cpu_physical_id(first_cpu(cpu_online_map)); 78 dest_phys_id = cpu_physical_id(first_cpu(cpu_online_map));
74 vector = irq; 79 vector = irq;
75 80
@@ -89,12 +94,12 @@ int ia64_setup_msi_irq(unsigned int irq, struct pci_dev *pdev)
89 write_msi_msg(irq, &msg); 94 write_msi_msg(irq, &msg);
90 set_irq_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq); 95 set_irq_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq);
91 96
92 return 0; 97 return irq;
93} 98}
94 99
95void ia64_teardown_msi_irq(unsigned int irq) 100void ia64_teardown_msi_irq(unsigned int irq)
96{ 101{
97 return; /* no-op */ 102 destroy_irq(irq);
98} 103}
99 104
100static void ia64_ack_msi_irq(unsigned int irq) 105static void ia64_ack_msi_irq(unsigned int irq)
@@ -126,12 +131,12 @@ static struct irq_chip ia64_msi_chip = {
126}; 131};
127 132
128 133
129int arch_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) 134int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
130{ 135{
131 if (platform_setup_msi_irq) 136 if (platform_setup_msi_irq)
132 return platform_setup_msi_irq(irq, pdev); 137 return platform_setup_msi_irq(pdev, desc);
133 138
134 return ia64_setup_msi_irq(irq, pdev); 139 return ia64_setup_msi_irq(pdev, desc);
135} 140}
136 141
137void arch_teardown_msi_irq(unsigned int irq) 142void arch_teardown_msi_irq(unsigned int irq)
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 17685abaf496..ae96d4176995 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -34,6 +34,7 @@
34#include <asm/ia32.h> 34#include <asm/ia32.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/kdebug.h> 36#include <asm/kdebug.h>
37#include <asm/kexec.h>
37#include <asm/pgalloc.h> 38#include <asm/pgalloc.h>
38#include <asm/processor.h> 39#include <asm/processor.h>
39#include <asm/sal.h> 40#include <asm/sal.h>
@@ -803,6 +804,21 @@ cpu_halt (void)
803 ia64_pal_halt(min_power_state); 804 ia64_pal_halt(min_power_state);
804} 805}
805 806
807void machine_shutdown(void)
808{
809#ifdef CONFIG_HOTPLUG_CPU
810 int cpu;
811
812 for_each_online_cpu(cpu) {
813 if (cpu != smp_processor_id())
814 cpu_down(cpu);
815 }
816#endif
817#ifdef CONFIG_KEXEC
818 kexec_disable_iosapic();
819#endif
820}
821
806void 822void
807machine_restart (char *restart_cmd) 823machine_restart (char *restart_cmd)
808{ 824{
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index aa705e46b974..3f8918782e0c 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -607,7 +607,7 @@ find_thread_for_addr (struct task_struct *child, unsigned long addr)
607 */ 607 */
608 list_for_each_safe(this, next, &current->children) { 608 list_for_each_safe(this, next, &current->children) {
609 p = list_entry(this, struct task_struct, sibling); 609 p = list_entry(this, struct task_struct, sibling);
610 if (p->mm != mm) 610 if (p->tgid != child->tgid)
611 continue; 611 continue;
612 if (thread_matches(p, addr)) { 612 if (thread_matches(p, addr)) {
613 child = p; 613 child = p;
@@ -1405,6 +1405,7 @@ ptrace_disable (struct task_struct *child)
1405 struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child)); 1405 struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child));
1406 1406
1407 /* make sure the single step/taken-branch trap bits are not set: */ 1407 /* make sure the single step/taken-branch trap bits are not set: */
1408 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
1408 child_psr->ss = 0; 1409 child_psr->ss = 0;
1409 child_psr->tb = 0; 1410 child_psr->tb = 0;
1410} 1411}
@@ -1525,6 +1526,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
1525 * Make sure the single step/taken-branch trap bits 1526 * Make sure the single step/taken-branch trap bits
1526 * are not set: 1527 * are not set:
1527 */ 1528 */
1529 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
1528 ia64_psr(pt)->ss = 0; 1530 ia64_psr(pt)->ss = 0;
1529 ia64_psr(pt)->tb = 0; 1531 ia64_psr(pt)->tb = 0;
1530 1532
@@ -1556,6 +1558,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
1556 goto out_tsk; 1558 goto out_tsk;
1557 1559
1558 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 1560 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
1561 set_tsk_thread_flag(child, TIF_SINGLESTEP);
1559 if (request == PTRACE_SINGLESTEP) { 1562 if (request == PTRACE_SINGLESTEP) {
1560 ia64_psr(pt)->ss = 1; 1563 ia64_psr(pt)->ss = 1;
1561 } else { 1564 } else {
@@ -1595,13 +1598,9 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
1595} 1598}
1596 1599
1597 1600
1598void 1601static void
1599syscall_trace (void) 1602syscall_trace (void)
1600{ 1603{
1601 if (!test_thread_flag(TIF_SYSCALL_TRACE))
1602 return;
1603 if (!(current->ptrace & PT_PTRACED))
1604 return;
1605 /* 1604 /*
1606 * The 0x80 provides a way for the tracing parent to 1605 * The 0x80 provides a way for the tracing parent to
1607 * distinguish between a syscall stop and SIGTRAP delivery. 1606 * distinguish between a syscall stop and SIGTRAP delivery.
@@ -1664,7 +1663,8 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,
1664 audit_syscall_exit(success, result); 1663 audit_syscall_exit(success, result);
1665 } 1664 }
1666 1665
1667 if (test_thread_flag(TIF_SYSCALL_TRACE) 1666 if ((test_thread_flag(TIF_SYSCALL_TRACE)
1667 || test_thread_flag(TIF_SINGLESTEP))
1668 && (current->ptrace & PT_PTRACED)) 1668 && (current->ptrace & PT_PTRACED))
1669 syscall_trace(); 1669 syscall_trace();
1670} 1670}
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index ad567b8d432e..83c2629e1c4c 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -569,34 +569,31 @@ show_cpuinfo (struct seq_file *m, void *v)
569 { 1UL << 1, "spontaneous deferral"}, 569 { 1UL << 1, "spontaneous deferral"},
570 { 1UL << 2, "16-byte atomic ops" } 570 { 1UL << 2, "16-byte atomic ops" }
571 }; 571 };
572 char features[128], *cp, sep; 572 char features[128], *cp, *sep;
573 struct cpuinfo_ia64 *c = v; 573 struct cpuinfo_ia64 *c = v;
574 unsigned long mask; 574 unsigned long mask;
575 unsigned long proc_freq; 575 unsigned long proc_freq;
576 int i; 576 int i, size;
577 577
578 mask = c->features; 578 mask = c->features;
579 579
580 /* build the feature string: */ 580 /* build the feature string: */
581 memcpy(features, " standard", 10); 581 memcpy(features, "standard", 9);
582 cp = features; 582 cp = features;
583 sep = 0; 583 size = sizeof(features);
584 for (i = 0; i < (int) ARRAY_SIZE(feature_bits); ++i) { 584 sep = "";
585 for (i = 0; i < ARRAY_SIZE(feature_bits) && size > 1; ++i) {
585 if (mask & feature_bits[i].mask) { 586 if (mask & feature_bits[i].mask) {
586 if (sep) 587 cp += snprintf(cp, size, "%s%s", sep,
587 *cp++ = sep; 588 feature_bits[i].feature_name),
588 sep = ','; 589 sep = ", ";
589 *cp++ = ' ';
590 strcpy(cp, feature_bits[i].feature_name);
591 cp += strlen(feature_bits[i].feature_name);
592 mask &= ~feature_bits[i].mask; 590 mask &= ~feature_bits[i].mask;
591 size = sizeof(features) - (cp - features);
593 } 592 }
594 } 593 }
595 if (mask) { 594 if (mask && size > 1) {
596 /* print unknown features as a hex value: */ 595 /* print unknown features as a hex value */
597 if (sep) 596 snprintf(cp, size, "%s0x%lx", sep, mask);
598 *cp++ = sep;
599 sprintf(cp, " 0x%lx", mask);
600 } 597 }
601 598
602 proc_freq = cpufreq_quick_get(cpunum); 599 proc_freq = cpufreq_quick_get(cpunum);
@@ -612,7 +609,7 @@ show_cpuinfo (struct seq_file *m, void *v)
612 "model name : %s\n" 609 "model name : %s\n"
613 "revision : %u\n" 610 "revision : %u\n"
614 "archrev : %u\n" 611 "archrev : %u\n"
615 "features :%s\n" /* don't change this---it _is_ right! */ 612 "features : %s\n"
616 "cpu number : %lu\n" 613 "cpu number : %lu\n"
617 "cpu regs : %u\n" 614 "cpu regs : %u\n"
618 "cpu MHz : %lu.%06lu\n" 615 "cpu MHz : %lu.%06lu\n"
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index f4c7f7769cf7..55ddd809b02d 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -221,13 +221,13 @@ send_IPI_self (int op)
221 221
222#ifdef CONFIG_KEXEC 222#ifdef CONFIG_KEXEC
223void 223void
224kdump_smp_send_stop() 224kdump_smp_send_stop(void)
225{ 225{
226 send_IPI_allbutself(IPI_KDUMP_CPU_STOP); 226 send_IPI_allbutself(IPI_KDUMP_CPU_STOP);
227} 227}
228 228
229void 229void
230kdump_smp_send_init() 230kdump_smp_send_init(void)
231{ 231{
232 unsigned int cpu, self_cpu; 232 unsigned int cpu, self_cpu;
233 self_cpu = smp_processor_id(); 233 self_cpu = smp_processor_id();
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index d6083a0936f4..8f3d0066f446 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -157,6 +157,7 @@ SECTIONS
157 } 157 }
158#endif 158#endif
159 159
160 . = ALIGN(8);
160 __con_initcall_start = .; 161 __con_initcall_start = .;
161 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) 162 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET)
162 { *(.con_initcall.init) } 163 { *(.con_initcall.init) }
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 1e79551231b9..63e6d49c5813 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -30,47 +30,69 @@ static unsigned long max_gap;
30#endif 30#endif
31 31
32/** 32/**
33 * show_mem - display a memory statistics summary 33 * show_mem - give short summary of memory stats
34 * 34 *
35 * Just walks the pages in the system and describes where they're allocated. 35 * Shows a simple page count of reserved and used pages in the system.
36 * For discontig machines, it does this on a per-pgdat basis.
36 */ 37 */
37void 38void show_mem(void)
38show_mem (void)
39{ 39{
40 int i, total = 0, reserved = 0; 40 int i, total_reserved = 0;
41 int shared = 0, cached = 0; 41 int total_shared = 0, total_cached = 0;
42 unsigned long total_present = 0;
43 pg_data_t *pgdat;
42 44
43 printk(KERN_INFO "Mem-info:\n"); 45 printk(KERN_INFO "Mem-info:\n");
44 show_free_areas(); 46 show_free_areas();
45
46 printk(KERN_INFO "Free swap: %6ldkB\n", 47 printk(KERN_INFO "Free swap: %6ldkB\n",
47 nr_swap_pages<<(PAGE_SHIFT-10)); 48 nr_swap_pages<<(PAGE_SHIFT-10));
48 i = max_mapnr; 49 printk(KERN_INFO "Node memory in pages:\n");
49 for (i = 0; i < max_mapnr; i++) { 50 for_each_online_pgdat(pgdat) {
50 if (!pfn_valid(i)) { 51 unsigned long present;
52 unsigned long flags;
53 int shared = 0, cached = 0, reserved = 0;
54
55 pgdat_resize_lock(pgdat, &flags);
56 present = pgdat->node_present_pages;
57 for(i = 0; i < pgdat->node_spanned_pages; i++) {
58 struct page *page;
59 if (pfn_valid(pgdat->node_start_pfn + i))
60 page = pfn_to_page(pgdat->node_start_pfn + i);
61 else {
51#ifdef CONFIG_VIRTUAL_MEM_MAP 62#ifdef CONFIG_VIRTUAL_MEM_MAP
52 if (max_gap < LARGE_GAP) 63 if (max_gap < LARGE_GAP)
53 continue; 64 continue;
54 i = vmemmap_find_next_valid_pfn(0, i) - 1;
55#endif 65#endif
56 continue; 66 i = vmemmap_find_next_valid_pfn(pgdat->node_id,
67 i) - 1;
68 continue;
69 }
70 if (PageReserved(page))
71 reserved++;
72 else if (PageSwapCache(page))
73 cached++;
74 else if (page_count(page))
75 shared += page_count(page)-1;
57 } 76 }
58 total++; 77 pgdat_resize_unlock(pgdat, &flags);
59 if (PageReserved(mem_map+i)) 78 total_present += present;
60 reserved++; 79 total_reserved += reserved;
61 else if (PageSwapCache(mem_map+i)) 80 total_cached += cached;
62 cached++; 81 total_shared += shared;
63 else if (page_count(mem_map + i)) 82 printk(KERN_INFO "Node %4d: RAM: %11ld, rsvd: %8d, "
64 shared += page_count(mem_map + i) - 1; 83 "shrd: %10d, swpd: %10d\n", pgdat->node_id,
84 present, reserved, shared, cached);
65 } 85 }
66 printk(KERN_INFO "%d pages of RAM\n", total); 86 printk(KERN_INFO "%ld pages of RAM\n", total_present);
67 printk(KERN_INFO "%d reserved pages\n", reserved); 87 printk(KERN_INFO "%d reserved pages\n", total_reserved);
68 printk(KERN_INFO "%d pages shared\n", shared); 88 printk(KERN_INFO "%d pages shared\n", total_shared);
69 printk(KERN_INFO "%d pages swap cached\n", cached); 89 printk(KERN_INFO "%d pages swap cached\n", total_cached);
70 printk(KERN_INFO "%ld pages in page table cache\n", 90 printk(KERN_INFO "Total of %ld pages in page table cache\n",
71 pgtable_quicklist_total_size()); 91 pgtable_quicklist_total_size());
92 printk(KERN_INFO "%d free buffer pages\n", nr_free_buffer_pages());
72} 93}
73 94
95
74/* physical address where the bootmem map is located */ 96/* physical address where the bootmem map is located */
75unsigned long bootmap_start; 97unsigned long bootmap_start;
76 98
@@ -177,7 +199,7 @@ find_memory (void)
177 199
178#ifdef CONFIG_CRASH_DUMP 200#ifdef CONFIG_CRASH_DUMP
179 /* If we are doing a crash dump, we still need to know the real mem 201 /* If we are doing a crash dump, we still need to know the real mem
180 * size before original memory map is * reset. */ 202 * size before original memory map is reset. */
181 saved_max_pfn = max_pfn; 203 saved_max_pfn = max_pfn;
182#endif 204#endif
183} 205}
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 96722cb1b49d..6eae596c509d 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -412,37 +412,6 @@ static void __init memory_less_nodes(void)
412 return; 412 return;
413} 413}
414 414
415#ifdef CONFIG_SPARSEMEM
416/**
417 * register_sparse_mem - notify SPARSEMEM that this memory range exists.
418 * @start: physical start of range
419 * @end: physical end of range
420 * @arg: unused
421 *
422 * Simply calls SPARSEMEM to register memory section(s).
423 */
424static int __init register_sparse_mem(unsigned long start, unsigned long end,
425 void *arg)
426{
427 int nid;
428
429 start = __pa(start) >> PAGE_SHIFT;
430 end = __pa(end) >> PAGE_SHIFT;
431 nid = early_pfn_to_nid(start);
432 memory_present(nid, start, end);
433
434 return 0;
435}
436
437static void __init arch_sparse_init(void)
438{
439 efi_memmap_walk(register_sparse_mem, NULL);
440 sparse_init();
441}
442#else
443#define arch_sparse_init() do {} while (0)
444#endif
445
446/** 415/**
447 * find_memory - walk the EFI memory map and setup the bootmem allocator 416 * find_memory - walk the EFI memory map and setup the bootmem allocator
448 * 417 *
@@ -473,6 +442,9 @@ void __init find_memory(void)
473 node_clear(node, memory_less_mask); 442 node_clear(node, memory_less_mask);
474 mem_data[node].min_pfn = ~0UL; 443 mem_data[node].min_pfn = ~0UL;
475 } 444 }
445
446 efi_memmap_walk(register_active_ranges, NULL);
447
476 /* 448 /*
477 * Initialize the boot memory maps in reverse order since that's 449 * Initialize the boot memory maps in reverse order since that's
478 * what the bootmem allocator expects 450 * what the bootmem allocator expects
@@ -506,6 +478,12 @@ void __init find_memory(void)
506 max_pfn = max_low_pfn; 478 max_pfn = max_low_pfn;
507 479
508 find_initrd(); 480 find_initrd();
481
482#ifdef CONFIG_CRASH_DUMP
483 /* If we are doing a crash dump, we still need to know the real mem
484 * size before original memory map is reset. */
485 saved_max_pfn = max_pfn;
486#endif
509} 487}
510 488
511#ifdef CONFIG_SMP 489#ifdef CONFIG_SMP
@@ -654,7 +632,6 @@ static __init int count_node_pages(unsigned long start, unsigned long len, int n
654{ 632{
655 unsigned long end = start + len; 633 unsigned long end = start + len;
656 634
657 add_active_range(node, start >> PAGE_SHIFT, end >> PAGE_SHIFT);
658 mem_data[node].num_physpages += len >> PAGE_SHIFT; 635 mem_data[node].num_physpages += len >> PAGE_SHIFT;
659 if (start <= __pa(MAX_DMA_ADDRESS)) 636 if (start <= __pa(MAX_DMA_ADDRESS))
660 mem_data[node].num_dma_physpages += 637 mem_data[node].num_dma_physpages +=
@@ -686,10 +663,11 @@ void __init paging_init(void)
686 663
687 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; 664 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
688 665
689 arch_sparse_init();
690
691 efi_memmap_walk(filter_rsvd_memory, count_node_pages); 666 efi_memmap_walk(filter_rsvd_memory, count_node_pages);
692 667
668 sparse_memory_present_with_active_regions(MAX_NUMNODES);
669 sparse_init();
670
693#ifdef CONFIG_VIRTUAL_MEM_MAP 671#ifdef CONFIG_VIRTUAL_MEM_MAP
694 vmalloc_end -= PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) * 672 vmalloc_end -= PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) *
695 sizeof(struct page)); 673 sizeof(struct page));
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 1373fae7657f..faaca21a3718 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -19,6 +19,7 @@
19#include <linux/swap.h> 19#include <linux/swap.h>
20#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/kexec.h>
22 23
23#include <asm/a.out.h> 24#include <asm/a.out.h>
24#include <asm/dma.h> 25#include <asm/dma.h>
@@ -128,6 +129,25 @@ lazy_mmu_prot_update (pte_t pte)
128 set_bit(PG_arch_1, &page->flags); /* mark page as clean */ 129 set_bit(PG_arch_1, &page->flags); /* mark page as clean */
129} 130}
130 131
132/*
133 * Since DMA is i-cache coherent, any (complete) pages that were written via
134 * DMA can be marked as "clean" so that lazy_mmu_prot_update() doesn't have to
135 * flush them when they get mapped into an executable vm-area.
136 */
137void
138dma_mark_clean(void *addr, size_t size)
139{
140 unsigned long pg_addr, end;
141
142 pg_addr = PAGE_ALIGN((unsigned long) addr);
143 end = (unsigned long) addr + size;
144 while (pg_addr + PAGE_SIZE <= end) {
145 struct page *page = virt_to_page(pg_addr);
146 set_bit(PG_arch_1, &page->flags);
147 pg_addr += PAGE_SIZE;
148 }
149}
150
131inline void 151inline void
132ia64_set_rbs_bot (void) 152ia64_set_rbs_bot (void)
133{ 153{
@@ -595,13 +615,27 @@ find_largest_hole (u64 start, u64 end, void *arg)
595 return 0; 615 return 0;
596} 616}
597 617
618#endif /* CONFIG_VIRTUAL_MEM_MAP */
619
598int __init 620int __init
599register_active_ranges(u64 start, u64 end, void *arg) 621register_active_ranges(u64 start, u64 end, void *arg)
600{ 622{
601 add_active_range(0, __pa(start) >> PAGE_SHIFT, __pa(end) >> PAGE_SHIFT); 623 int nid = paddr_to_nid(__pa(start));
624
625 if (nid < 0)
626 nid = 0;
627#ifdef CONFIG_KEXEC
628 if (start > crashk_res.start && start < crashk_res.end)
629 start = crashk_res.end;
630 if (end > crashk_res.start && end < crashk_res.end)
631 end = crashk_res.start;
632#endif
633
634 if (start < end)
635 add_active_range(nid, __pa(start) >> PAGE_SHIFT,
636 __pa(end) >> PAGE_SHIFT);
602 return 0; 637 return 0;
603} 638}
604#endif /* CONFIG_VIRTUAL_MEM_MAP */
605 639
606static int __init 640static int __init
607count_reserved_pages (u64 start, u64 end, void *arg) 641count_reserved_pages (u64 start, u64 end, void *arg)
diff --git a/arch/ia64/sn/kernel/huberror.c b/arch/ia64/sn/kernel/huberror.c
index abca6bd7962f..fcf7f93c4b61 100644
--- a/arch/ia64/sn/kernel/huberror.c
+++ b/arch/ia64/sn/kernel/huberror.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992 - 1997, 2000,2002-2005 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1992 - 1997, 2000,2002-2007 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
@@ -38,12 +38,20 @@ static irqreturn_t hub_eint_handler(int irq, void *arg)
38 (u64) nasid, 0, 0, 0, 0, 0, 0); 38 (u64) nasid, 0, 0, 0, 0, 0, 0);
39 39
40 if ((int)ret_stuff.v0) 40 if ((int)ret_stuff.v0)
41 panic("hubii_eint_handler(): Fatal TIO Error"); 41 panic("%s: Fatal %s Error", __FUNCTION__,
42 ((nasid & 1) ? "TIO" : "HUBII"));
42 43
43 if (!(nasid & 1)) /* Not a TIO, handle CRB errors */ 44 if (!(nasid & 1)) /* Not a TIO, handle CRB errors */
44 (void)hubiio_crb_error_handler(hubdev_info); 45 (void)hubiio_crb_error_handler(hubdev_info);
45 } else 46 } else
46 bte_error_handler((unsigned long)NODEPDA(nasid_to_cnodeid(nasid))); 47 if (nasid & 1) { /* TIO errors */
48 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_HUB_ERROR_INTERRUPT,
49 (u64) nasid, 0, 0, 0, 0, 0, 0);
50
51 if ((int)ret_stuff.v0)
52 panic("%s: Fatal TIO Error", __FUNCTION__);
53 } else
54 bte_error_handler((unsigned long)NODEPDA(nasid_to_cnodeid(nasid)));
47 55
48 return IRQ_HANDLED; 56 return IRQ_HANDLED;
49} 57}
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index cb96b4ea7df6..8c331ca6e5c9 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -13,6 +13,7 @@
13#include <asm/sn/sn_sal.h> 13#include <asm/sn/sn_sal.h>
14#include "xtalk/hubdev.h" 14#include "xtalk/hubdev.h"
15#include <linux/acpi.h> 15#include <linux/acpi.h>
16#include <acpi/acnamesp.h>
16 17
17 18
18/* 19/*
@@ -31,6 +32,12 @@ struct acpi_vendor_uuid sn_uuid = {
31 0xa2, 0x7c, 0x08, 0x00, 0x69, 0x13, 0xea, 0x51 }, 32 0xa2, 0x7c, 0x08, 0x00, 0x69, 0x13, 0xea, 0x51 },
32}; 33};
33 34
35struct sn_pcidev_match {
36 u8 bus;
37 unsigned int devfn;
38 acpi_handle handle;
39};
40
34/* 41/*
35 * Perform the early IO init in PROM. 42 * Perform the early IO init in PROM.
36 */ 43 */
@@ -119,9 +126,11 @@ sn_get_bussoft_ptr(struct pci_bus *bus)
119 status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, 126 status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
120 &sn_uuid, &buffer); 127 &sn_uuid, &buffer);
121 if (ACPI_FAILURE(status)) { 128 if (ACPI_FAILURE(status)) {
122 printk(KERN_ERR "get_acpi_pcibus_ptr: " 129 printk(KERN_ERR "%s: "
123 "get_acpi_bussoft_info() failed: %d\n", 130 "acpi_get_vendor_resource() failed (0x%x) for: ",
124 status); 131 __FUNCTION__, status);
132 acpi_ns_print_node_pathname(handle, NULL);
133 printk("\n");
125 return NULL; 134 return NULL;
126 } 135 }
127 resource = buffer.pointer; 136 resource = buffer.pointer;
@@ -130,8 +139,8 @@ sn_get_bussoft_ptr(struct pci_bus *bus)
130 if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != 139 if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) !=
131 sizeof(struct pcibus_bussoft *)) { 140 sizeof(struct pcibus_bussoft *)) {
132 printk(KERN_ERR 141 printk(KERN_ERR
133 "get_acpi_bussoft_ptr: Invalid vendor data " 142 "%s: Invalid vendor data length %d\n",
134 "length %d\n", vendor->byte_length); 143 __FUNCTION__, vendor->byte_length);
135 kfree(buffer.pointer); 144 kfree(buffer.pointer);
136 return NULL; 145 return NULL;
137 } 146 }
@@ -143,34 +152,254 @@ sn_get_bussoft_ptr(struct pci_bus *bus)
143} 152}
144 153
145/* 154/*
146 * sn_acpi_bus_fixup 155 * sn_extract_device_info - Extract the pcidev_info and the sn_irq_info
156 * pointers from the vendor resource using the
157 * provided acpi handle, and copy the structures
158 * into the argument buffers.
147 */ 159 */
148void 160static int
149sn_acpi_bus_fixup(struct pci_bus *bus) 161sn_extract_device_info(acpi_handle handle, struct pcidev_info **pcidev_info,
162 struct sn_irq_info **sn_irq_info)
150{ 163{
151 struct pci_dev *pci_dev = NULL; 164 u64 addr;
152 struct pcibus_bussoft *prom_bussoft_ptr; 165 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
153 extern void sn_common_bus_fixup(struct pci_bus *, 166 struct sn_irq_info *irq_info, *irq_info_prom;
154 struct pcibus_bussoft *); 167 struct pcidev_info *pcidev_ptr, *pcidev_prom_ptr;
168 struct acpi_resource *resource;
169 int ret = 0;
170 acpi_status status;
171 struct acpi_resource_vendor_typed *vendor;
155 172
156 if (!bus->parent) { /* If root bus */ 173 /*
157 prom_bussoft_ptr = sn_get_bussoft_ptr(bus); 174 * The pointer to this device's pcidev_info structure in
158 if (prom_bussoft_ptr == NULL) { 175 * the PROM, is in the vendor resource.
176 */
177 status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
178 &sn_uuid, &buffer);
179 if (ACPI_FAILURE(status)) {
180 printk(KERN_ERR
181 "%s: acpi_get_vendor_resource() failed (0x%x) for: ",
182 __FUNCTION__, status);
183 acpi_ns_print_node_pathname(handle, NULL);
184 printk("\n");
185 return 1;
186 }
187
188 resource = buffer.pointer;
189 vendor = &resource->data.vendor_typed;
190 if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) !=
191 sizeof(struct pci_devdev_info *)) {
192 printk(KERN_ERR
193 "%s: Invalid vendor data length: %d for: ",
194 __FUNCTION__, vendor->byte_length);
195 acpi_ns_print_node_pathname(handle, NULL);
196 printk("\n");
197 ret = 1;
198 goto exit;
199 }
200
201 pcidev_ptr = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
202 if (!pcidev_ptr)
203 panic("%s: Unable to alloc memory for pcidev_info", __FUNCTION__);
204
205 memcpy(&addr, vendor->byte_data, sizeof(struct pcidev_info *));
206 pcidev_prom_ptr = __va(addr);
207 memcpy(pcidev_ptr, pcidev_prom_ptr, sizeof(struct pcidev_info));
208
209 /* Get the IRQ info */
210 irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
211 if (!irq_info)
212 panic("%s: Unable to alloc memory for sn_irq_info", __FUNCTION__);
213
214 if (pcidev_ptr->pdi_sn_irq_info) {
215 irq_info_prom = __va(pcidev_ptr->pdi_sn_irq_info);
216 memcpy(irq_info, irq_info_prom, sizeof(struct sn_irq_info));
217 }
218
219 *pcidev_info = pcidev_ptr;
220 *sn_irq_info = irq_info;
221
222exit:
223 kfree(buffer.pointer);
224 return ret;
225}
226
227static unsigned int
228get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle)
229{
230 unsigned long adr;
231 acpi_handle child;
232 unsigned int devfn;
233 int function;
234 acpi_handle parent;
235 int slot;
236 acpi_status status;
237
238 /*
239 * Do an upward search to find the root bus device, and
240 * obtain the host devfn from the previous child device.
241 */
242 child = device_handle;
243 while (child) {
244 status = acpi_get_parent(child, &parent);
245 if (ACPI_FAILURE(status)) {
246 printk(KERN_ERR "%s: acpi_get_parent() failed "
247 "(0x%x) for: ", __FUNCTION__, status);
248 acpi_ns_print_node_pathname(child, NULL);
249 printk("\n");
250 panic("%s: Unable to find host devfn\n", __FUNCTION__);
251 }
252 if (parent == rootbus_handle)
253 break;
254 child = parent;
255 }
256 if (!child) {
257 printk(KERN_ERR "%s: Unable to find root bus for: ",
258 __FUNCTION__);
259 acpi_ns_print_node_pathname(device_handle, NULL);
260 printk("\n");
261 BUG();
262 }
263
264 status = acpi_evaluate_integer(child, METHOD_NAME__ADR, NULL, &adr);
265 if (ACPI_FAILURE(status)) {
266 printk(KERN_ERR "%s: Unable to get _ADR (0x%x) for: ",
267 __FUNCTION__, status);
268 acpi_ns_print_node_pathname(child, NULL);
269 printk("\n");
270 panic("%s: Unable to find host devfn\n", __FUNCTION__);
271 }
272
273 slot = (adr >> 16) & 0xffff;
274 function = adr & 0xffff;
275 devfn = PCI_DEVFN(slot, function);
276 return devfn;
277}
278
279/*
280 * find_matching_device - Callback routine to find the ACPI device
281 * that matches up with our pci_dev device.
282 * Matching is done on bus number and devfn.
283 * To find the bus number for a particular
284 * ACPI device, we must look at the _BBN method
285 * of its parent.
286 */
287static acpi_status
288find_matching_device(acpi_handle handle, u32 lvl, void *context, void **rv)
289{
290 unsigned long bbn = -1;
291 unsigned long adr;
292 acpi_handle parent = NULL;
293 acpi_status status;
294 unsigned int devfn;
295 int function;
296 int slot;
297 struct sn_pcidev_match *info = context;
298
299 status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
300 &adr);
301 if (ACPI_SUCCESS(status)) {
302 status = acpi_get_parent(handle, &parent);
303 if (ACPI_FAILURE(status)) {
159 printk(KERN_ERR 304 printk(KERN_ERR
160 "sn_pci_fixup_bus: 0x%04x:0x%02x Unable to " 305 "%s: acpi_get_parent() failed (0x%x) for: ",
161 "obtain prom_bussoft_ptr\n", 306 __FUNCTION__, status);
162 pci_domain_nr(bus), bus->number); 307 acpi_ns_print_node_pathname(handle, NULL);
163 return; 308 printk("\n");
309 return AE_OK;
310 }
311 status = acpi_evaluate_integer(parent, METHOD_NAME__BBN,
312 NULL, &bbn);
313 if (ACPI_FAILURE(status)) {
314 printk(KERN_ERR
315 "%s: Failed to find _BBN in parent of: ",
316 __FUNCTION__);
317 acpi_ns_print_node_pathname(handle, NULL);
318 printk("\n");
319 return AE_OK;
320 }
321
322 slot = (adr >> 16) & 0xffff;
323 function = adr & 0xffff;
324 devfn = PCI_DEVFN(slot, function);
325 if ((info->devfn == devfn) && (info->bus == bbn)) {
326 /* We have a match! */
327 info->handle = handle;
328 return 1;
164 } 329 }
165 sn_common_bus_fixup(bus, prom_bussoft_ptr);
166 } 330 }
167 list_for_each_entry(pci_dev, &bus->devices, bus_list) { 331 return AE_OK;
168 sn_pci_fixup_slot(pci_dev); 332}
333
334/*
335 * sn_acpi_get_pcidev_info - Search ACPI namespace for the acpi
336 * device matching the specified pci_dev,
337 * and return the pcidev info and irq info.
338 */
339int
340sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
341 struct sn_irq_info **sn_irq_info)
342{
343 unsigned int host_devfn;
344 struct sn_pcidev_match pcidev_match;
345 acpi_handle rootbus_handle;
346 unsigned long segment;
347 acpi_status status;
348
349 rootbus_handle = PCI_CONTROLLER(dev)->acpi_handle;
350 status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL,
351 &segment);
352 if (ACPI_SUCCESS(status)) {
353 if (segment != pci_domain_nr(dev)) {
354 printk(KERN_ERR
355 "%s: Segment number mismatch, 0x%lx vs 0x%x for: ",
356 __FUNCTION__, segment, pci_domain_nr(dev));
357 acpi_ns_print_node_pathname(rootbus_handle, NULL);
358 printk("\n");
359 return 1;
360 }
361 } else {
362 printk(KERN_ERR "%s: Unable to get __SEG from: ",
363 __FUNCTION__);
364 acpi_ns_print_node_pathname(rootbus_handle, NULL);
365 printk("\n");
366 return 1;
367 }
368
369 /*
370 * We want to search all devices in this segment/domain
371 * of the ACPI namespace for the matching ACPI device,
372 * which holds the pcidev_info pointer in its vendor resource.
373 */
374 pcidev_match.bus = dev->bus->number;
375 pcidev_match.devfn = dev->devfn;
376 pcidev_match.handle = NULL;
377
378 acpi_walk_namespace(ACPI_TYPE_DEVICE, rootbus_handle, ACPI_UINT32_MAX,
379 find_matching_device, &pcidev_match, NULL);
380
381 if (!pcidev_match.handle) {
382 printk(KERN_ERR
383 "%s: Could not find matching ACPI device for %s.\n",
384 __FUNCTION__, pci_name(dev));
385 return 1;
169 } 386 }
387
388 if (sn_extract_device_info(pcidev_match.handle, pcidev_info, sn_irq_info))
389 return 1;
390
391 /* Build up the pcidev_info.pdi_slot_host_handle */
392 host_devfn = get_host_devfn(pcidev_match.handle, rootbus_handle);
393 (*pcidev_info)->pdi_slot_host_handle =
394 ((unsigned long) pci_domain_nr(dev) << 40) |
395 /* bus == 0 */
396 host_devfn;
397 return 0;
170} 398}
171 399
172/* 400/*
173 * sn_acpi_slot_fixup - Perform any SN specific slot fixup. 401 * sn_acpi_slot_fixup - Obtain the pcidev_info and sn_irq_info.
402 * Perform any SN specific slot fixup.
174 * At present there does not appear to be 403 * At present there does not appear to be
175 * any generic way to handle a ROM image 404 * any generic way to handle a ROM image
176 * that has been shadowed by the PROM, so 405 * that has been shadowed by the PROM, so
@@ -179,11 +408,18 @@ sn_acpi_bus_fixup(struct pci_bus *bus)
179 */ 408 */
180 409
181void 410void
182sn_acpi_slot_fixup(struct pci_dev *dev, struct pcidev_info *pcidev_info) 411sn_acpi_slot_fixup(struct pci_dev *dev)
183{ 412{
184 void __iomem *addr; 413 void __iomem *addr;
414 struct pcidev_info *pcidev_info = NULL;
415 struct sn_irq_info *sn_irq_info = NULL;
185 size_t size; 416 size_t size;
186 417
418 if (sn_acpi_get_pcidev_info(dev, &pcidev_info, &sn_irq_info)) {
419 panic("%s: Failure obtaining pcidev_info for %s\n",
420 __FUNCTION__, pci_name(dev));
421 }
422
187 if (pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE]) { 423 if (pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE]) {
188 /* 424 /*
189 * A valid ROM image exists and has been shadowed by the 425 * A valid ROM image exists and has been shadowed by the
@@ -200,8 +436,11 @@ sn_acpi_slot_fixup(struct pci_dev *dev, struct pcidev_info *pcidev_info)
200 (unsigned long) addr + size; 436 (unsigned long) addr + size;
201 dev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_BIOS_COPY; 437 dev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_BIOS_COPY;
202 } 438 }
439 sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
203} 440}
204 441
442EXPORT_SYMBOL(sn_acpi_slot_fixup);
443
205static struct acpi_driver acpi_sn_hubdev_driver = { 444static struct acpi_driver acpi_sn_hubdev_driver = {
206 .name = "SGI HUBDEV Driver", 445 .name = "SGI HUBDEV Driver",
207 .ids = "SGIHUB,SGITIO", 446 .ids = "SGIHUB,SGITIO",
@@ -212,6 +451,33 @@ static struct acpi_driver acpi_sn_hubdev_driver = {
212 451
213 452
214/* 453/*
454 * sn_acpi_bus_fixup - Perform SN specific setup of software structs
455 * (pcibus_bussoft, pcidev_info) and hardware
456 * registers, for the specified bus and devices under it.
457 */
458void
459sn_acpi_bus_fixup(struct pci_bus *bus)
460{
461 struct pci_dev *pci_dev = NULL;
462 struct pcibus_bussoft *prom_bussoft_ptr;
463
464 if (!bus->parent) { /* If root bus */
465 prom_bussoft_ptr = sn_get_bussoft_ptr(bus);
466 if (prom_bussoft_ptr == NULL) {
467 printk(KERN_ERR
468 "%s: 0x%04x:0x%02x Unable to "
469 "obtain prom_bussoft_ptr\n",
470 __FUNCTION__, pci_domain_nr(bus), bus->number);
471 return;
472 }
473 sn_common_bus_fixup(bus, prom_bussoft_ptr);
474 }
475 list_for_each_entry(pci_dev, &bus->devices, bus_list) {
476 sn_acpi_slot_fixup(pci_dev);
477 }
478}
479
480/*
215 * sn_io_acpi_init - PROM has ACPI support for IO, defining at a minimum the 481 * sn_io_acpi_init - PROM has ACPI support for IO, defining at a minimum the
216 * nodes and root buses in the DSDT. As a result, bus scanning 482 * nodes and root buses in the DSDT. As a result, bus scanning
217 * will be initiated by the Linux ACPI code. 483 * will be initiated by the Linux ACPI code.
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index d4dd8f4b6b8d..d48bcd83253c 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -26,14 +26,10 @@
26#include <linux/acpi.h> 26#include <linux/acpi.h>
27#include <asm/sn/sn2/sn_hwperf.h> 27#include <asm/sn/sn2/sn_hwperf.h>
28#include <asm/sn/acpi.h> 28#include <asm/sn/acpi.h>
29#include "acpi/acglobal.h"
29 30
30extern void sn_init_cpei_timer(void); 31extern void sn_init_cpei_timer(void);
31extern void register_sn_procfs(void); 32extern void register_sn_procfs(void);
32extern void sn_acpi_bus_fixup(struct pci_bus *);
33extern void sn_bus_fixup(struct pci_bus *);
34extern void sn_acpi_slot_fixup(struct pci_dev *, struct pcidev_info *);
35extern void sn_more_slot_fixup(struct pci_dev *, struct pcidev_info *);
36extern void sn_legacy_pci_window_fixup(struct pci_controller *, u64, u64);
37extern void sn_io_acpi_init(void); 33extern void sn_io_acpi_init(void);
38extern void sn_io_init(void); 34extern void sn_io_init(void);
39 35
@@ -48,6 +44,9 @@ struct sysdata_el {
48 44
49int sn_ioif_inited; /* SN I/O infrastructure initialized? */ 45int sn_ioif_inited; /* SN I/O infrastructure initialized? */
50 46
47int sn_acpi_rev; /* SN ACPI revision */
48EXPORT_SYMBOL_GPL(sn_acpi_rev);
49
51struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */ 50struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */
52 51
53/* 52/*
@@ -99,25 +98,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
99} 98}
100 99
101/* 100/*
102 * Retrieve the pci device information given the bus and device|function number.
103 */
104static inline u64
105sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
106 u64 sn_irq_info)
107{
108 struct ia64_sal_retval ret_stuff;
109 ret_stuff.status = 0;
110 ret_stuff.v0 = 0;
111
112 SAL_CALL_NOLOCK(ret_stuff,
113 (u64) SN_SAL_IOIF_GET_PCIDEV_INFO,
114 (u64) segment, (u64) bus_number, (u64) devfn,
115 (u64) pci_dev,
116 sn_irq_info, 0, 0);
117 return ret_stuff.v0;
118}
119
120/*
121 * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified 101 * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified
122 * device. 102 * device.
123 */ 103 */
@@ -249,50 +229,25 @@ void sn_pci_unfixup_slot(struct pci_dev *dev)
249} 229}
250 230
251/* 231/*
252 * sn_pci_fixup_slot() - This routine sets up a slot's resources consistent 232 * sn_pci_fixup_slot()
253 * with the Linux PCI abstraction layer. Resources
254 * acquired from our PCI provider include PIO maps
255 * to BAR space and interrupt objects.
256 */ 233 */
257void sn_pci_fixup_slot(struct pci_dev *dev) 234void sn_pci_fixup_slot(struct pci_dev *dev, struct pcidev_info *pcidev_info,
235 struct sn_irq_info *sn_irq_info)
258{ 236{
259 int segment = pci_domain_nr(dev->bus); 237 int segment = pci_domain_nr(dev->bus);
260 int status = 0;
261 struct pcibus_bussoft *bs; 238 struct pcibus_bussoft *bs;
262 struct pci_bus *host_pci_bus; 239 struct pci_bus *host_pci_bus;
263 struct pci_dev *host_pci_dev; 240 struct pci_dev *host_pci_dev;
264 struct pcidev_info *pcidev_info; 241 unsigned int bus_no, devfn;
265 struct sn_irq_info *sn_irq_info;
266 unsigned int bus_no, devfn;
267 242
268 pci_dev_get(dev); /* for the sysdata pointer */ 243 pci_dev_get(dev); /* for the sysdata pointer */
269 pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
270 if (!pcidev_info)
271 BUG(); /* Cannot afford to run out of memory */
272
273 sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
274 if (!sn_irq_info)
275 BUG(); /* Cannot afford to run out of memory */
276
277 /* Call to retrieve pci device information needed by kernel. */
278 status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number,
279 dev->devfn,
280 (u64) __pa(pcidev_info),
281 (u64) __pa(sn_irq_info));
282 if (status)
283 BUG(); /* Cannot get platform pci device information */
284 244
285 /* Add pcidev_info to list in pci_controller.platform_data */ 245 /* Add pcidev_info to list in pci_controller.platform_data */
286 list_add_tail(&pcidev_info->pdi_list, 246 list_add_tail(&pcidev_info->pdi_list,
287 &(SN_PLATFORM_DATA(dev->bus)->pcidev_info)); 247 &(SN_PLATFORM_DATA(dev->bus)->pcidev_info));
288
289 if (SN_ACPI_BASE_SUPPORT())
290 sn_acpi_slot_fixup(dev, pcidev_info);
291 else
292 sn_more_slot_fixup(dev, pcidev_info);
293 /* 248 /*
294 * Using the PROMs values for the PCI host bus, get the Linux 249 * Using the PROMs values for the PCI host bus, get the Linux
295 * PCI host_pci_dev struct and set up host bus linkages 250 * PCI host_pci_dev struct and set up host bus linkages
296 */ 251 */
297 252
298 bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff; 253 bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff;
@@ -489,11 +444,6 @@ void sn_generate_path(struct pci_bus *pci_bus, char *address)
489 sprintf(address, "%s^%d", address, geo_slot(geoid)); 444 sprintf(address, "%s^%d", address, geo_slot(geoid));
490} 445}
491 446
492/*
493 * sn_pci_fixup_bus() - Perform SN specific setup of software structs
494 * (pcibus_bussoft, pcidev_info) and hardware
495 * registers, for the specified bus and devices under it.
496 */
497void __devinit 447void __devinit
498sn_pci_fixup_bus(struct pci_bus *bus) 448sn_pci_fixup_bus(struct pci_bus *bus)
499{ 449{
@@ -519,6 +469,15 @@ sn_io_early_init(void)
519 if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) 469 if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
520 return 0; 470 return 0;
521 471
472 /* we set the acpi revision to that of the DSDT table OEM rev. */
473 {
474 struct acpi_table_header *header = NULL;
475
476 acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header);
477 BUG_ON(header == NULL);
478 sn_acpi_rev = header->oem_revision;
479 }
480
522 /* 481 /*
523 * prime sn_pci_provider[]. Individial provider init routines will 482 * prime sn_pci_provider[]. Individial provider init routines will
524 * override their respective default entries. 483 * override their respective default entries.
@@ -544,8 +503,12 @@ sn_io_early_init(void)
544 register_sn_procfs(); 503 register_sn_procfs();
545#endif 504#endif
546 505
547 printk(KERN_INFO "ACPI DSDT OEM Rev 0x%x\n", 506 {
548 acpi_gbl_DSDT->oem_revision); 507 struct acpi_table_header *header;
508 (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header);
509 printk(KERN_INFO "ACPI DSDT OEM Rev 0x%x\n",
510 header->oem_revision);
511 }
549 if (SN_ACPI_BASE_SUPPORT()) 512 if (SN_ACPI_BASE_SUPPORT())
550 sn_io_acpi_init(); 513 sn_io_acpi_init();
551 else 514 else
@@ -605,7 +568,6 @@ sn_io_late_init(void)
605 568
606fs_initcall(sn_io_late_init); 569fs_initcall(sn_io_late_init);
607 570
608EXPORT_SYMBOL(sn_pci_fixup_slot);
609EXPORT_SYMBOL(sn_pci_unfixup_slot); 571EXPORT_SYMBOL(sn_pci_unfixup_slot);
610EXPORT_SYMBOL(sn_bus_store_sysdata); 572EXPORT_SYMBOL(sn_bus_store_sysdata);
611EXPORT_SYMBOL(sn_bus_free_sysdata); 573EXPORT_SYMBOL(sn_bus_free_sysdata);
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 9ad843e0383b..600be3ebae05 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -56,6 +56,25 @@ static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
56 return ret_stuff.v0; 56 return ret_stuff.v0;
57} 57}
58 58
59/*
60 * Retrieve the pci device information given the bus and device|function number.
61 */
62static inline u64
63sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
64 u64 sn_irq_info)
65{
66 struct ia64_sal_retval ret_stuff;
67 ret_stuff.status = 0;
68 ret_stuff.v0 = 0;
69
70 SAL_CALL_NOLOCK(ret_stuff,
71 (u64) SN_SAL_IOIF_GET_PCIDEV_INFO,
72 (u64) segment, (u64) bus_number, (u64) devfn,
73 (u64) pci_dev,
74 sn_irq_info, 0, 0);
75 return ret_stuff.v0;
76}
77
59 78
60/* 79/*
61 * sn_fixup_ionodes() - This routine initializes the HUB data structure for 80 * sn_fixup_ionodes() - This routine initializes the HUB data structure for
@@ -172,18 +191,40 @@ sn_pci_window_fixup(struct pci_dev *dev, unsigned int count,
172} 191}
173 192
174/* 193/*
175 * sn_more_slot_fixup() - We are not running with an ACPI capable PROM, 194 * sn_io_slot_fixup() - We are not running with an ACPI capable PROM,
176 * and need to convert the pci_dev->resource 195 * and need to convert the pci_dev->resource
177 * 'start' and 'end' addresses to mapped addresses, 196 * 'start' and 'end' addresses to mapped addresses,
178 * and setup the pci_controller->window array entries. 197 * and setup the pci_controller->window array entries.
179 */ 198 */
180void 199void
181sn_more_slot_fixup(struct pci_dev *dev, struct pcidev_info *pcidev_info) 200sn_io_slot_fixup(struct pci_dev *dev)
182{ 201{
183 unsigned int count = 0; 202 unsigned int count = 0;
184 int idx; 203 int idx;
185 s64 pci_addrs[PCI_ROM_RESOURCE + 1]; 204 s64 pci_addrs[PCI_ROM_RESOURCE + 1];
186 unsigned long addr, end, size, start; 205 unsigned long addr, end, size, start;
206 struct pcidev_info *pcidev_info;
207 struct sn_irq_info *sn_irq_info;
208 int status;
209
210 pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
211 if (!pcidev_info)
212 panic("%s: Unable to alloc memory for pcidev_info", __FUNCTION__);
213
214 sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
215 if (!sn_irq_info)
216 panic("%s: Unable to alloc memory for sn_irq_info", __FUNCTION__);
217
218 /* Call to retrieve pci device information needed by kernel. */
219 status = sal_get_pcidev_info((u64) pci_domain_nr(dev),
220 (u64) dev->bus->number,
221 dev->devfn,
222 (u64) __pa(pcidev_info),
223 (u64) __pa(sn_irq_info));
224
225 if (status)
226 BUG(); /* Cannot get platform pci device information */
227
187 228
188 /* Copy over PIO Mapped Addresses */ 229 /* Copy over PIO Mapped Addresses */
189 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { 230 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
@@ -219,8 +260,12 @@ sn_more_slot_fixup(struct pci_dev *dev, struct pcidev_info *pcidev_info)
219 */ 260 */
220 if (count > 0) 261 if (count > 0)
221 sn_pci_window_fixup(dev, count, pci_addrs); 262 sn_pci_window_fixup(dev, count, pci_addrs);
263
264 sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
222} 265}
223 266
267EXPORT_SYMBOL(sn_io_slot_fixup);
268
224/* 269/*
225 * sn_pci_controller_fixup() - This routine sets up a bus's resources 270 * sn_pci_controller_fixup() - This routine sets up a bus's resources
226 * consistent with the Linux PCI abstraction layer. 271 * consistent with the Linux PCI abstraction layer.
@@ -272,9 +317,6 @@ sn_bus_fixup(struct pci_bus *bus)
272{ 317{
273 struct pci_dev *pci_dev = NULL; 318 struct pci_dev *pci_dev = NULL;
274 struct pcibus_bussoft *prom_bussoft_ptr; 319 struct pcibus_bussoft *prom_bussoft_ptr;
275 extern void sn_common_bus_fixup(struct pci_bus *,
276 struct pcibus_bussoft *);
277
278 320
279 if (!bus->parent) { /* If root bus */ 321 if (!bus->parent) { /* If root bus */
280 prom_bussoft_ptr = PCI_CONTROLLER(bus)->platform_data; 322 prom_bussoft_ptr = PCI_CONTROLLER(bus)->platform_data;
@@ -291,7 +333,7 @@ sn_bus_fixup(struct pci_bus *bus)
291 prom_bussoft_ptr->bs_legacy_mem); 333 prom_bussoft_ptr->bs_legacy_mem);
292 } 334 }
293 list_for_each_entry(pci_dev, &bus->devices, bus_list) { 335 list_for_each_entry(pci_dev, &bus->devices, bus_list) {
294 sn_pci_fixup_slot(pci_dev); 336 sn_io_slot_fixup(pci_dev);
295 } 337 }
296 338
297} 339}
diff --git a/arch/ia64/sn/kernel/iomv.c b/arch/ia64/sn/kernel/iomv.c
index 4aa4f301d56d..ab7e2fd40798 100644
--- a/arch/ia64/sn/kernel/iomv.c
+++ b/arch/ia64/sn/kernel/iomv.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * This file is subject to the terms and conditions of the GNU General Public 2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
@@ -26,9 +26,10 @@
26 * @port: port to convert 26 * @port: port to convert
27 * 27 *
28 * Legacy in/out instructions are converted to ld/st instructions 28 * Legacy in/out instructions are converted to ld/st instructions
29 * on IA64. This routine will convert a port number into a valid 29 * on IA64. This routine will convert a port number into a valid
30 * SN i/o address. Used by sn_in*() and sn_out*(). 30 * SN i/o address. Used by sn_in*() and sn_out*().
31 */ 31 */
32
32void *sn_io_addr(unsigned long port) 33void *sn_io_addr(unsigned long port)
33{ 34{
34 if (!IS_RUNNING_ON_SIMULATOR()) { 35 if (!IS_RUNNING_ON_SIMULATOR()) {
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index b3a435fd70fb..ea3dc38d73fd 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -59,13 +59,12 @@ void sn_teardown_msi_irq(unsigned int irq)
59 sn_intr_free(nasid, widget, sn_irq_info); 59 sn_intr_free(nasid, widget, sn_irq_info);
60 sn_msi_info[irq].sn_irq_info = NULL; 60 sn_msi_info[irq].sn_irq_info = NULL;
61 61
62 return; 62 destroy_irq(irq);
63} 63}
64 64
65int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev) 65int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry)
66{ 66{
67 struct msi_msg msg; 67 struct msi_msg msg;
68 struct msi_desc *entry;
69 int widget; 68 int widget;
70 int status; 69 int status;
71 nasid_t nasid; 70 nasid_t nasid;
@@ -73,8 +72,8 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev)
73 struct sn_irq_info *sn_irq_info; 72 struct sn_irq_info *sn_irq_info;
74 struct pcibus_bussoft *bussoft = SN_PCIDEV_BUSSOFT(pdev); 73 struct pcibus_bussoft *bussoft = SN_PCIDEV_BUSSOFT(pdev);
75 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 74 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
75 int irq;
76 76
77 entry = get_irq_data(irq);
78 if (!entry->msi_attrib.is_64) 77 if (!entry->msi_attrib.is_64)
79 return -EINVAL; 78 return -EINVAL;
80 79
@@ -84,6 +83,11 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev)
84 if (provider == NULL || provider->dma_map_consistent == NULL) 83 if (provider == NULL || provider->dma_map_consistent == NULL)
85 return -EINVAL; 84 return -EINVAL;
86 85
86 irq = create_irq();
87 if (irq < 0)
88 return irq;
89
90 set_irq_msi(irq, entry);
87 /* 91 /*
88 * Set up the vector plumbing. Let the prom (via sn_intr_alloc) 92 * Set up the vector plumbing. Let the prom (via sn_intr_alloc)
89 * decide which cpu to direct this msi at by default. 93 * decide which cpu to direct this msi at by default.
@@ -95,12 +99,15 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev)
95 SWIN_WIDGETNUM(bussoft->bs_base); 99 SWIN_WIDGETNUM(bussoft->bs_base);
96 100
97 sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL); 101 sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
98 if (! sn_irq_info) 102 if (! sn_irq_info) {
103 destroy_irq(irq);
99 return -ENOMEM; 104 return -ENOMEM;
105 }
100 106
101 status = sn_intr_alloc(nasid, widget, sn_irq_info, irq, -1, -1); 107 status = sn_intr_alloc(nasid, widget, sn_irq_info, irq, -1, -1);
102 if (status) { 108 if (status) {
103 kfree(sn_irq_info); 109 kfree(sn_irq_info);
110 destroy_irq(irq);
104 return -ENOMEM; 111 return -ENOMEM;
105 } 112 }
106 113
@@ -121,6 +128,7 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev)
121 if (! bus_addr) { 128 if (! bus_addr) {
122 sn_intr_free(nasid, widget, sn_irq_info); 129 sn_intr_free(nasid, widget, sn_irq_info);
123 kfree(sn_irq_info); 130 kfree(sn_irq_info);
131 destroy_irq(irq);
124 return -ENOMEM; 132 return -ENOMEM;
125 } 133 }
126 134
@@ -139,7 +147,7 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev)
139 write_msi_msg(irq, &msg); 147 write_msi_msg(irq, &msg);
140 set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq); 148 set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq);
141 149
142 return 0; 150 return irq;
143} 151}
144 152
145#ifdef CONFIG_SMP 153#ifdef CONFIG_SMP
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 6846dc9b432d..04a8256017eb 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -20,7 +20,8 @@
20#include "xtalk/hubdev.h" 20#include "xtalk/hubdev.h"
21 21
22int 22int
23sal_pcibr_slot_enable(struct pcibus_info *soft, int device, void *resp) 23sal_pcibr_slot_enable(struct pcibus_info *soft, int device, void *resp,
24 char **ssdt)
24{ 25{
25 struct ia64_sal_retval ret_stuff; 26 struct ia64_sal_retval ret_stuff;
26 u64 busnum; 27 u64 busnum;
@@ -32,7 +33,8 @@ sal_pcibr_slot_enable(struct pcibus_info *soft, int device, void *resp)
32 segment = soft->pbi_buscommon.bs_persist_segment; 33 segment = soft->pbi_buscommon.bs_persist_segment;
33 busnum = soft->pbi_buscommon.bs_persist_busnum; 34 busnum = soft->pbi_buscommon.bs_persist_busnum;
34 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_ENABLE, segment, 35 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_ENABLE, segment,
35 busnum, (u64) device, (u64) resp, 0, 0, 0); 36 busnum, (u64) device, (u64) resp, (u64)ia64_tpa(ssdt),
37 0, 0);
36 38
37 return (int)ret_stuff.v0; 39 return (int)ret_stuff.v0;
38} 40}
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 9226264abf1a..11ea217ed5cf 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -23,6 +23,7 @@
23 23
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/irq_regs.h>
26 27
27#define TICK_SIZE (tick_nsec / 1000) 28#define TICK_SIZE (tick_nsec / 1000)
28 29
@@ -38,7 +39,7 @@ static inline int set_rtc_mmss(unsigned long nowtime)
38 * timer_interrupt() needs to keep up the real-time clock, 39 * timer_interrupt() needs to keep up the real-time clock,
39 * as well as call the "do_timer()" routine every clocktick 40 * as well as call the "do_timer()" routine every clocktick
40 */ 41 */
41static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs) 42static irqreturn_t timer_interrupt(int irq, void *dummy)
42{ 43{
43 /* last time the cmos clock got updated */ 44 /* last time the cmos clock got updated */
44 static long last_rtc_update=0; 45 static long last_rtc_update=0;
@@ -51,7 +52,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
51 52
52 do_timer(1); 53 do_timer(1);
53#ifndef CONFIG_SMP 54#ifndef CONFIG_SMP
54 update_process_times(user_mode(regs)); 55 update_process_times(user_mode(get_irq_regs()));
55#endif 56#endif
56 if (current->pid) 57 if (current->pid)
57 profile_tick(CPU_PROFILING); 58 profile_tick(CPU_PROFILING);
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 2b2a10da64a4..bfade20a9e5e 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -87,6 +87,16 @@ SECTIONS {
87 *(__ksymtab_gpl) 87 *(__ksymtab_gpl)
88 __stop___ksymtab_gpl = .; 88 __stop___ksymtab_gpl = .;
89 89
90 /* Kernel symbol table: Normal unused symbols */
91 __start___ksymtab_unused = .;
92 *(__ksymtab_unused)
93 __stop___ksymtab_unused = .;
94
95 /* Kernel symbol table: GPL-only unused symbols */
96 __start___ksymtab_unused_gpl = .;
97 *(__ksymtab_unused_gpl)
98 __stop___ksymtab_unused_gpl = .;
99
90 /* Kernel symbol table: GPL-future symbols */ 100 /* Kernel symbol table: GPL-future symbols */
91 __start___ksymtab_gpl_future = .; 101 __start___ksymtab_gpl_future = .;
92 *(__ksymtab_gpl_future) 102 *(__ksymtab_gpl_future)
diff --git a/arch/m68knommu/platform/5206/config.c b/arch/m68knommu/platform/5206/config.c
index 34657f85e702..3343830aad10 100644
--- a/arch/m68knommu/platform/5206/config.c
+++ b/arch/m68knommu/platform/5206/config.c
@@ -26,7 +26,7 @@
26/***************************************************************************/ 26/***************************************************************************/
27 27
28void coldfire_tick(void); 28void coldfire_tick(void);
29void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 29void coldfire_timer_init(irq_handler_t handler);
30unsigned long coldfire_timer_offset(void); 30unsigned long coldfire_timer_offset(void);
31void coldfire_trap_init(void); 31void coldfire_trap_init(void);
32void coldfire_reset(void); 32void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c
index 48e4d6266507..0f67320b4031 100644
--- a/arch/m68knommu/platform/5206e/config.c
+++ b/arch/m68knommu/platform/5206e/config.c
@@ -25,7 +25,7 @@
25/***************************************************************************/ 25/***************************************************************************/
26 26
27void coldfire_tick(void); 27void coldfire_tick(void);
28void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 28void coldfire_timer_init(irq_handler_t handler);
29unsigned long coldfire_timer_offset(void); 29unsigned long coldfire_timer_offset(void);
30void coldfire_trap_init(void); 30void coldfire_trap_init(void);
31void coldfire_reset(void); 31void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/520x/config.c b/arch/m68knommu/platform/520x/config.c
index 823f561f35b0..58b2878deb61 100644
--- a/arch/m68knommu/platform/520x/config.c
+++ b/arch/m68knommu/platform/520x/config.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/param.h> 15#include <linux/param.h>
16#include <linux/interrupt.h>
16#include <asm/machdep.h> 17#include <asm/machdep.h>
17#include <asm/dma.h> 18#include <asm/dma.h>
18 19
@@ -27,7 +28,7 @@ unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
27/***************************************************************************/ 28/***************************************************************************/
28 29
29void coldfire_pit_tick(void); 30void coldfire_pit_tick(void);
30void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 31void coldfire_pit_init(irq_handler_t handler);
31unsigned long coldfire_pit_offset(void); 32unsigned long coldfire_pit_offset(void);
32void coldfire_trap_init(void); 33void coldfire_trap_init(void);
33void coldfire_reset(void); 34void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/523x/config.c b/arch/m68knommu/platform/523x/config.c
index 85de817e9ec5..9b054e6caee2 100644
--- a/arch/m68knommu/platform/523x/config.c
+++ b/arch/m68knommu/platform/523x/config.c
@@ -27,7 +27,7 @@
27/***************************************************************************/ 27/***************************************************************************/
28 28
29void coldfire_pit_tick(void); 29void coldfire_pit_tick(void);
30void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 30void coldfire_pit_init(irq_handler_t handler);
31unsigned long coldfire_pit_offset(void); 31unsigned long coldfire_pit_offset(void);
32void coldfire_trap_init(void); 32void coldfire_trap_init(void);
33void coldfire_reset(void); 33void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/5249/config.c b/arch/m68knommu/platform/5249/config.c
index 9d19d5bdb8af..d6706079d64a 100644
--- a/arch/m68knommu/platform/5249/config.c
+++ b/arch/m68knommu/platform/5249/config.c
@@ -12,6 +12,7 @@
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/param.h> 13#include <linux/param.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/dma.h> 17#include <asm/dma.h>
17#include <asm/traps.h> 18#include <asm/traps.h>
@@ -24,7 +25,7 @@
24/***************************************************************************/ 25/***************************************************************************/
25 26
26void coldfire_tick(void); 27void coldfire_tick(void);
27void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 28void coldfire_timer_init(irq_handler_t handler);
28unsigned long coldfire_timer_offset(void); 29unsigned long coldfire_timer_offset(void);
29void coldfire_trap_init(void); 30void coldfire_trap_init(void);
30void coldfire_reset(void); 31void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c
index d500e27eda57..6b437cc97776 100644
--- a/arch/m68knommu/platform/5272/config.c
+++ b/arch/m68knommu/platform/5272/config.c
@@ -26,7 +26,7 @@
26/***************************************************************************/ 26/***************************************************************************/
27 27
28void coldfire_tick(void); 28void coldfire_tick(void);
29void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 29void coldfire_timer_init(irq_handler_t handler);
30unsigned long coldfire_timer_offset(void); 30unsigned long coldfire_timer_offset(void);
31void coldfire_trap_init(void); 31void coldfire_trap_init(void);
32void coldfire_reset(void); 32void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/527x/config.c b/arch/m68knommu/platform/527x/config.c
index bbae51597457..28e7d964eef1 100644
--- a/arch/m68knommu/platform/527x/config.c
+++ b/arch/m68knommu/platform/527x/config.c
@@ -27,7 +27,7 @@
27/***************************************************************************/ 27/***************************************************************************/
28 28
29void coldfire_pit_tick(void); 29void coldfire_pit_tick(void);
30void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 30void coldfire_pit_init(irq_handler_t handler);
31unsigned long coldfire_pit_offset(void); 31unsigned long coldfire_pit_offset(void);
32void coldfire_trap_init(void); 32void coldfire_trap_init(void);
33void coldfire_reset(void); 33void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c
index 18dad9046144..805b4f74ff19 100644
--- a/arch/m68knommu/platform/528x/config.c
+++ b/arch/m68knommu/platform/528x/config.c
@@ -27,7 +27,7 @@
27/***************************************************************************/ 27/***************************************************************************/
28 28
29void coldfire_pit_tick(void); 29void coldfire_pit_tick(void);
30void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 30void coldfire_pit_init(irq_handler_t handler);
31unsigned long coldfire_pit_offset(void); 31unsigned long coldfire_pit_offset(void);
32void coldfire_trap_init(void); 32void coldfire_trap_init(void);
33void coldfire_reset(void); 33void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/5307/config.c b/arch/m68knommu/platform/5307/config.c
index 8074ac56f479..e04b84deb57d 100644
--- a/arch/m68knommu/platform/5307/config.c
+++ b/arch/m68knommu/platform/5307/config.c
@@ -27,7 +27,7 @@
27/***************************************************************************/ 27/***************************************************************************/
28 28
29void coldfire_tick(void); 29void coldfire_tick(void);
30void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 30void coldfire_timer_init(irq_handler_t handler);
31unsigned long coldfire_timer_offset(void); 31unsigned long coldfire_timer_offset(void);
32void coldfire_trap_init(void); 32void coldfire_trap_init(void);
33void coldfire_reset(void); 33void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/5307/pit.c b/arch/m68knommu/platform/5307/pit.c
index 9dc5688f71b5..aa15beeb36ca 100644
--- a/arch/m68knommu/platform/5307/pit.c
+++ b/arch/m68knommu/platform/5307/pit.c
@@ -43,7 +43,7 @@ void coldfire_pit_tick(void)
43 43
44/***************************************************************************/ 44/***************************************************************************/
45 45
46void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)) 46void coldfire_pit_init(irq_handler_t handler)
47{ 47{
48 volatile unsigned char *icrp; 48 volatile unsigned char *icrp;
49 volatile unsigned long *imrp; 49 volatile unsigned long *imrp;
diff --git a/arch/m68knommu/platform/5307/timers.c b/arch/m68knommu/platform/5307/timers.c
index e5668af19789..87b112b363a6 100644
--- a/arch/m68knommu/platform/5307/timers.c
+++ b/arch/m68knommu/platform/5307/timers.c
@@ -62,7 +62,7 @@ void coldfire_tick(void)
62 62
63/***************************************************************************/ 63/***************************************************************************/
64 64
65void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)) 65void coldfire_timer_init(irq_handler_t handler)
66{ 66{
67 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); 67 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
68 __raw_writetrr(((MCF_BUSCLK / 16) / HZ), TA(MCFTIMER_TRR)); 68 __raw_writetrr(((MCF_BUSCLK / 16) / HZ), TA(MCFTIMER_TRR));
@@ -111,12 +111,13 @@ unsigned long coldfire_timer_offset(void)
111/* 111/*
112 * Use the other timer to provide high accuracy profiling info. 112 * Use the other timer to provide high accuracy profiling info.
113 */ 113 */
114void coldfire_profile_tick(int irq, void *dummy, struct pt_regs *regs) 114irqreturn_t coldfire_profile_tick(int irq, void *dummy)
115{ 115{
116 /* Reset ColdFire timer2 */ 116 /* Reset ColdFire timer2 */
117 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, PA(MCFTIMER_TER)); 117 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, PA(MCFTIMER_TER));
118 if (current->pid) 118 if (current->pid)
119 profile_tick(CPU_PROFILING, regs); 119 profile_tick(CPU_PROFILING, regs);
120 return IRQ_HANDLED;
120} 121}
121 122
122/***************************************************************************/ 123/***************************************************************************/
diff --git a/arch/m68knommu/platform/532x/config.c b/arch/m68knommu/platform/532x/config.c
index c7d6ad513820..664c3a12b0c1 100644
--- a/arch/m68knommu/platform/532x/config.c
+++ b/arch/m68knommu/platform/532x/config.c
@@ -35,7 +35,7 @@
35/***************************************************************************/ 35/***************************************************************************/
36 36
37void coldfire_tick(void); 37void coldfire_tick(void);
38void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 38void coldfire_timer_init(irq_handler_t handler);
39unsigned long coldfire_timer_offset(void); 39unsigned long coldfire_timer_offset(void);
40void coldfire_trap_init(void); 40void coldfire_trap_init(void);
41void coldfire_reset(void); 41void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/5407/config.c b/arch/m68knommu/platform/5407/config.c
index 5aad2645f0f1..036f62876241 100644
--- a/arch/m68knommu/platform/5407/config.c
+++ b/arch/m68knommu/platform/5407/config.c
@@ -26,7 +26,7 @@
26/***************************************************************************/ 26/***************************************************************************/
27 27
28void coldfire_tick(void); 28void coldfire_tick(void);
29void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); 29void coldfire_timer_init(irq_handler_t handler);
30unsigned long coldfire_timer_offset(void); 30unsigned long coldfire_timer_offset(void);
31void coldfire_trap_init(void); 31void coldfire_trap_init(void);
32void coldfire_reset(void); 32void coldfire_reset(void);
diff --git a/arch/m68knommu/platform/68328/config.c b/arch/m68knommu/platform/68328/config.c
index 26ffeba28642..e5c537d14dfb 100644
--- a/arch/m68knommu/platform/68328/config.c
+++ b/arch/m68knommu/platform/68328/config.c
@@ -34,7 +34,7 @@
34 34
35/***************************************************************************/ 35/***************************************************************************/
36 36
37void m68328_timer_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *)); 37void m68328_timer_init(irq_handler_t timer_routine);
38void m68328_timer_tick(void); 38void m68328_timer_tick(void);
39unsigned long m68328_timer_gettimeoffset(void); 39unsigned long m68328_timer_gettimeoffset(void);
40void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); 40void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bbd386f572d9..9d839a9c4b1a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -575,6 +575,7 @@ config SGI_IP27
575 select DMA_IP27 575 select DMA_IP27
576 select EARLY_PRINTK 576 select EARLY_PRINTK
577 select HW_HAS_PCI 577 select HW_HAS_PCI
578 select NR_CPUS_DEFAULT_64
578 select PCI_DOMAINS 579 select PCI_DOMAINS
579 select SYS_HAS_CPU_R10000 580 select SYS_HAS_CPU_R10000
580 select SYS_SUPPORTS_64BIT_KERNEL 581 select SYS_SUPPORTS_64BIT_KERNEL
@@ -612,6 +613,7 @@ config SIBYTE_BIGSUR
612 bool "Sibyte BCM91480B-BigSur" 613 bool "Sibyte BCM91480B-BigSur"
613 select BOOT_ELF32 614 select BOOT_ELF32
614 select DMA_COHERENT 615 select DMA_COHERENT
616 select NR_CPUS_DEFAULT_4
615 select PCI_DOMAINS 617 select PCI_DOMAINS
616 select SIBYTE_BCM1x80 618 select SIBYTE_BCM1x80
617 select SWAP_IO_SPACE 619 select SWAP_IO_SPACE
@@ -623,6 +625,7 @@ config SIBYTE_SWARM
623 bool "Sibyte BCM91250A-SWARM" 625 bool "Sibyte BCM91250A-SWARM"
624 select BOOT_ELF32 626 select BOOT_ELF32
625 select DMA_COHERENT 627 select DMA_COHERENT
628 select NR_CPUS_DEFAULT_2
626 select SIBYTE_SB1250 629 select SIBYTE_SB1250
627 select SWAP_IO_SPACE 630 select SWAP_IO_SPACE
628 select SYS_HAS_CPU_SB1 631 select SYS_HAS_CPU_SB1
@@ -635,6 +638,7 @@ config SIBYTE_SENTOSA
635 depends on EXPERIMENTAL 638 depends on EXPERIMENTAL
636 select BOOT_ELF32 639 select BOOT_ELF32
637 select DMA_COHERENT 640 select DMA_COHERENT
641 select NR_CPUS_DEFAULT_2
638 select SIBYTE_SB1250 642 select SIBYTE_SB1250
639 select SWAP_IO_SPACE 643 select SWAP_IO_SPACE
640 select SYS_HAS_CPU_SB1 644 select SYS_HAS_CPU_SB1
@@ -668,6 +672,7 @@ config SIBYTE_PTSWARM
668 depends on EXPERIMENTAL 672 depends on EXPERIMENTAL
669 select BOOT_ELF32 673 select BOOT_ELF32
670 select DMA_COHERENT 674 select DMA_COHERENT
675 select NR_CPUS_DEFAULT_2
671 select SIBYTE_SB1250 676 select SIBYTE_SB1250
672 select SWAP_IO_SPACE 677 select SWAP_IO_SPACE
673 select SYS_HAS_CPU_SB1 678 select SYS_HAS_CPU_SB1
@@ -680,6 +685,7 @@ config SIBYTE_LITTLESUR
680 depends on EXPERIMENTAL 685 depends on EXPERIMENTAL
681 select BOOT_ELF32 686 select BOOT_ELF32
682 select DMA_COHERENT 687 select DMA_COHERENT
688 select NR_CPUS_DEFAULT_2
683 select SIBYTE_SB1250 689 select SIBYTE_SB1250
684 select SWAP_IO_SPACE 690 select SWAP_IO_SPACE
685 select SYS_HAS_CPU_SB1 691 select SYS_HAS_CPU_SB1
@@ -790,23 +796,6 @@ config TOSHIBA_RBTX4938
790 796
791endchoice 797endchoice
792 798
793config KEXEC
794 bool "Kexec system call (EXPERIMENTAL)"
795 depends on EXPERIMENTAL
796 help
797 kexec is a system call that implements the ability to shutdown your
798 current kernel, and to start another kernel. It is like a reboot
799 but it is indepedent of the system firmware. And like a reboot
800 you can start any kernel with it, not just Linux.
801
802 The name comes from the similiarity to the exec system call.
803
804 It is an ongoing process to be certain the hardware in a machine
805 is properly shutdown, so do not be surprised if this code does not
806 initially work for you. It may help to enable device hotplugging
807 support. As of this writing the exact hardware interface is
808 strongly in flux, so no good recommendation can be made.
809
810source "arch/mips/ddb5xxx/Kconfig" 799source "arch/mips/ddb5xxx/Kconfig"
811source "arch/mips/gt64120/ev64120/Kconfig" 800source "arch/mips/gt64120/ev64120/Kconfig"
812source "arch/mips/jazz/Kconfig" 801source "arch/mips/jazz/Kconfig"
@@ -945,6 +934,9 @@ config CPU_LITTLE_ENDIAN
945 934
946endchoice 935endchoice
947 936
937config SYS_SUPPORTS_APM_EMULATION
938 bool
939
948config SYS_SUPPORTS_BIG_ENDIAN 940config SYS_SUPPORTS_BIG_ENDIAN
949 bool 941 bool
950 942
@@ -1012,6 +1004,7 @@ config SOC_AU1X00
1012 bool 1004 bool
1013 select SYS_HAS_CPU_MIPS32_R1 1005 select SYS_HAS_CPU_MIPS32_R1
1014 select SYS_SUPPORTS_32BIT_KERNEL 1006 select SYS_SUPPORTS_32BIT_KERNEL
1007 select SYS_SUPPORTS_APM_EMULATION
1015 1008
1016config PNX8550 1009config PNX8550
1017 bool 1010 bool
@@ -1541,6 +1534,8 @@ config MIPS_MT_SMTC
1541 select CPU_MIPSR2_IRQ_VI 1534 select CPU_MIPSR2_IRQ_VI
1542 select CPU_MIPSR2_SRS 1535 select CPU_MIPSR2_SRS
1543 select MIPS_MT 1536 select MIPS_MT
1537 select NR_CPUS_DEFAULT_2
1538 select NR_CPUS_DEFAULT_8
1544 select SMP 1539 select SMP
1545 select SYS_SUPPORTS_SMP 1540 select SYS_SUPPORTS_SMP
1546 help 1541 help
@@ -1756,13 +1751,34 @@ config SMP
1756config SYS_SUPPORTS_SMP 1751config SYS_SUPPORTS_SMP
1757 bool 1752 bool
1758 1753
1754config NR_CPUS_DEFAULT_2
1755 bool
1756
1757config NR_CPUS_DEFAULT_4
1758 bool
1759
1760config NR_CPUS_DEFAULT_8
1761 bool
1762
1763config NR_CPUS_DEFAULT_16
1764 bool
1765
1766config NR_CPUS_DEFAULT_32
1767 bool
1768
1769config NR_CPUS_DEFAULT_64
1770 bool
1771
1759config NR_CPUS 1772config NR_CPUS
1760 int "Maximum number of CPUs (2-64)" 1773 int "Maximum number of CPUs (2-64)"
1761 range 2 64 1774 range 2 64
1762 depends on SMP 1775 depends on SMP
1763 default "64" if SGI_IP27 1776 default "2" if NR_CPUS_DEFAULT_2
1764 default "2" 1777 default "4" if NR_CPUS_DEFAULT_4
1765 default "8" if MIPS_MT_SMTC 1778 default "8" if NR_CPUS_DEFAULT_8
1779 default "16" if NR_CPUS_DEFAULT_16
1780 default "32" if NR_CPUS_DEFAULT_32
1781 default "64" if NR_CPUS_DEFAULT_64
1766 help 1782 help
1767 This allows you to specify the maximum number of CPUs which this 1783 This allows you to specify the maximum number of CPUs which this
1768 kernel will support. The maximum supported value is 32 for 32-bit 1784 kernel will support. The maximum supported value is 32 for 32-bit
@@ -1859,6 +1875,40 @@ config MIPS_INSANE_LARGE
1859 This will result in additional memory usage, so it is not 1875 This will result in additional memory usage, so it is not
1860 recommended for normal users. 1876 recommended for normal users.
1861 1877
1878config KEXEC
1879 bool "Kexec system call (EXPERIMENTAL)"
1880 depends on EXPERIMENTAL
1881 help
1882 kexec is a system call that implements the ability to shutdown your
1883 current kernel, and to start another kernel. It is like a reboot
1884 but it is indepedent of the system firmware. And like a reboot
1885 you can start any kernel with it, not just Linux.
1886
1887 The name comes from the similiarity to the exec system call.
1888
1889 It is an ongoing process to be certain the hardware in a machine
1890 is properly shutdown, so do not be surprised if this code does not
1891 initially work for you. It may help to enable device hotplugging
1892 support. As of this writing the exact hardware interface is
1893 strongly in flux, so no good recommendation can be made.
1894
1895config SECCOMP
1896 bool "Enable seccomp to safely compute untrusted bytecode"
1897 depends on PROC_FS && BROKEN
1898 default y
1899 help
1900 This kernel feature is useful for number crunching applications
1901 that may need to compute untrusted bytecode during their
1902 execution. By using pipes or other transports made available to
1903 the process as file descriptors supporting the read/write
1904 syscalls, it's possible to isolate those applications in
1905 their own address space using seccomp. Once seccomp is
1906 enabled via /proc/<pid>/seccomp, it cannot be disabled
1907 and the task is only allowed to execute a few safe syscalls
1908 defined by each seccomp mode.
1909
1910 If unsure, say Y. Only embedded should say N here.
1911
1862endmenu 1912endmenu
1863 1913
1864config RWSEM_GENERIC_SPINLOCK 1914config RWSEM_GENERIC_SPINLOCK
@@ -2025,52 +2075,11 @@ config BINFMT_ELF32
2025 bool 2075 bool
2026 default y if MIPS32_O32 || MIPS32_N32 2076 default y if MIPS32_O32 || MIPS32_N32
2027 2077
2028config SECCOMP 2078endmenu
2029 bool "Enable seccomp to safely compute untrusted bytecode"
2030 depends on PROC_FS && BROKEN
2031 default y
2032 help
2033 This kernel feature is useful for number crunching applications
2034 that may need to compute untrusted bytecode during their
2035 execution. By using pipes or other transports made available to
2036 the process as file descriptors supporting the read/write
2037 syscalls, it's possible to isolate those applications in
2038 their own address space using seccomp. Once seccomp is
2039 enabled via /proc/<pid>/seccomp, it cannot be disabled
2040 and the task is only allowed to execute a few safe syscalls
2041 defined by each seccomp mode.
2042 2079
2043 If unsure, say Y. Only embedded should say N here. 2080menu "Power management options"
2044 2081
2045config PM 2082source "kernel/power/Kconfig"
2046 bool "Power Management support (EXPERIMENTAL)"
2047 depends on EXPERIMENTAL && SOC_AU1X00
2048
2049config APM
2050 tristate "Advanced Power Management Emulation"
2051 depends on PM
2052 ---help---
2053 APM is a BIOS specification for saving power using several different
2054 techniques. This is mostly useful for battery powered systems with
2055 APM compliant BIOSes. If you say Y here, the system time will be
2056 reset after a RESUME operation, the /proc/apm device will provide
2057 battery status information, and user-space programs will receive
2058 notification of APM "events" (e.g. battery status change).
2059
2060 In order to use APM, you will need supporting software. For location
2061 and more information, read <file:Documentation/pm.txt> and the
2062 Battery Powered Linux mini-HOWTO, available from
2063 <http://www.tldp.org/docs.html#howto>.
2064
2065 This driver does not spin down disk drives (see the hdparm(8)
2066 manpage ("man 8 hdparm") for that), and it doesn't turn off
2067 VESA-compliant "green" monitors.
2068
2069 Generally, if you don't have a battery in your machine, there isn't
2070 much point in using this driver and you should say N. If you get
2071 random kernel OOPSes or reboots that don't seem to be related to
2072 anything, try disabling/enabling this option (or disabling/enabling
2073 APM in your BIOS).
2074 2083
2075endmenu 2084endmenu
2076 2085
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 5d6afb52d904..9351f1c04a9d 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -22,10 +22,10 @@ config CMDLINE
22 string "Default kernel command string" 22 string "Default kernel command string"
23 default "" 23 default ""
24 help 24 help
25 On some platforms, there is currently no way for the boot loader to 25 On some platforms, there is currently no way for the boot loader to
26 pass arguments to the kernel. For these platforms, you can supply 26 pass arguments to the kernel. For these platforms, you can supply
27 some command-line options at build time by entering them here. In 27 some command-line options at build time by entering them here. In
28 other cases you can specify kernel args so that you don't have 28 other cases you can specify kernel args so that you don't have
29 to set them up in board prom initialization routines. 29 to set them up in board prom initialization routines.
30 30
31config DEBUG_STACK_USAGE 31config DEBUG_STACK_USAGE
diff --git a/arch/mips/arc/identify.c b/arch/mips/arc/identify.c
index 3ba7c47f9f23..4b907369b0f9 100644
--- a/arch/mips/arc/identify.c
+++ b/arch/mips/arc/identify.c
@@ -77,7 +77,7 @@ static struct smatch * __init string_to_mach(const char *s)
77{ 77{
78 int i; 78 int i;
79 79
80 for (i = 0; i < (sizeof(mach_table) / sizeof (mach_table[0])); i++) { 80 for (i = 0; i < ARRAY_SIZE(mach_table); i++) {
81 if (!strcmp(s, mach_table[i].arcname)) 81 if (!strcmp(s, mach_table[i].arcname))
82 return &mach_table[i]; 82 return &mach_table[i];
83 } 83 }
diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c
index 8a9ef58cc399..456cb81a32d9 100644
--- a/arch/mips/arc/memory.c
+++ b/arch/mips/arc/memory.c
@@ -141,30 +141,20 @@ void __init prom_meminit(void)
141 } 141 }
142} 142}
143 143
144unsigned long __init prom_free_prom_memory(void) 144void __init prom_free_prom_memory(void)
145{ 145{
146 unsigned long freed = 0;
147 unsigned long addr; 146 unsigned long addr;
148 int i; 147 int i;
149 148
150 if (prom_flags & PROM_FLAG_DONT_FREE_TEMP) 149 if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
151 return 0; 150 return;
152 151
153 for (i = 0; i < boot_mem_map.nr_map; i++) { 152 for (i = 0; i < boot_mem_map.nr_map; i++) {
154 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) 153 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
155 continue; 154 continue;
156 155
157 addr = boot_mem_map.map[i].addr; 156 addr = boot_mem_map.map[i].addr;
158 while (addr < boot_mem_map.map[i].addr 157 free_init_pages("prom memory",
159 + boot_mem_map.map[i].size) { 158 addr, addr + boot_mem_map.map[i].size);
160 ClearPageReserved(virt_to_page(__va(addr)));
161 init_page_count(virt_to_page(__va(addr)));
162 free_page((unsigned long)__va(addr));
163 addr += PAGE_SIZE;
164 freed += PAGE_SIZE;
165 }
166 } 159 }
167 printk(KERN_INFO "Freeing prom memory: %ldkb freed\n", freed >> 10);
168
169 return freed;
170} 160}
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index 9cf7b6715836..ea6e99fbe2f7 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -233,7 +233,7 @@ void restore_local_and_enable(int controller, unsigned long mask)
233 233
234 234
235static struct irq_chip rise_edge_irq_type = { 235static struct irq_chip rise_edge_irq_type = {
236 .typename = "Au1000 Rise Edge", 236 .name = "Au1000 Rise Edge",
237 .ack = mask_and_ack_rise_edge_irq, 237 .ack = mask_and_ack_rise_edge_irq,
238 .mask = local_disable_irq, 238 .mask = local_disable_irq,
239 .mask_ack = mask_and_ack_rise_edge_irq, 239 .mask_ack = mask_and_ack_rise_edge_irq,
@@ -242,7 +242,7 @@ static struct irq_chip rise_edge_irq_type = {
242}; 242};
243 243
244static struct irq_chip fall_edge_irq_type = { 244static struct irq_chip fall_edge_irq_type = {
245 .typename = "Au1000 Fall Edge", 245 .name = "Au1000 Fall Edge",
246 .ack = mask_and_ack_fall_edge_irq, 246 .ack = mask_and_ack_fall_edge_irq,
247 .mask = local_disable_irq, 247 .mask = local_disable_irq,
248 .mask_ack = mask_and_ack_fall_edge_irq, 248 .mask_ack = mask_and_ack_fall_edge_irq,
@@ -251,7 +251,7 @@ static struct irq_chip fall_edge_irq_type = {
251}; 251};
252 252
253static struct irq_chip either_edge_irq_type = { 253static struct irq_chip either_edge_irq_type = {
254 .typename = "Au1000 Rise or Fall Edge", 254 .name = "Au1000 Rise or Fall Edge",
255 .ack = mask_and_ack_either_edge_irq, 255 .ack = mask_and_ack_either_edge_irq,
256 .mask = local_disable_irq, 256 .mask = local_disable_irq,
257 .mask_ack = mask_and_ack_either_edge_irq, 257 .mask_ack = mask_and_ack_either_edge_irq,
@@ -260,7 +260,7 @@ static struct irq_chip either_edge_irq_type = {
260}; 260};
261 261
262static struct irq_chip level_irq_type = { 262static struct irq_chip level_irq_type = {
263 .typename = "Au1000 Level", 263 .name = "Au1000 Level",
264 .ack = mask_and_ack_level_irq, 264 .ack = mask_and_ack_level_irq,
265 .mask = local_disable_irq, 265 .mask = local_disable_irq,
266 .mask_ack = mask_and_ack_level_irq, 266 .mask_ack = mask_and_ack_level_irq,
diff --git a/arch/mips/au1000/common/pci.c b/arch/mips/au1000/common/pci.c
index 9f8ce08e173b..6c25e6c09f78 100644
--- a/arch/mips/au1000/common/pci.c
+++ b/arch/mips/au1000/common/pci.c
@@ -76,13 +76,17 @@ static int __init au1x_pci_setup(void)
76 } 76 }
77 77
78#ifdef CONFIG_DMA_NONCOHERENT 78#ifdef CONFIG_DMA_NONCOHERENT
79 /* 79 {
80 * Set the NC bit in controller for Au1500 pre-AC silicon 80 /*
81 */ 81 * Set the NC bit in controller for Au1500 pre-AC silicon
82 u32 prid = read_c0_prid(); 82 */
83 if ( (prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) { 83 u32 prid = read_c0_prid();
84 au_writel( 1<<16 | au_readl(Au1500_PCI_CFG), Au1500_PCI_CFG); 84
85 printk("Non-coherent PCI accesses enabled\n"); 85 if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) {
86 au_writel((1 << 16) | au_readl(Au1500_PCI_CFG),
87 Au1500_PCI_CFG);
88 printk("Non-coherent PCI accesses enabled\n");
89 }
86 } 90 }
87#endif 91#endif
88 92
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index 6fce60af005d..a8637cdb5b4b 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -149,9 +149,8 @@ int get_ethernet_addr(char *ethernet_addr)
149 return 0; 149 return 0;
150} 150}
151 151
152unsigned long __init prom_free_prom_memory(void) 152void __init prom_free_prom_memory(void)
153{ 153{
154 return 0;
155} 154}
156 155
157EXPORT_SYMBOL(prom_getcmdline); 156EXPORT_SYMBOL(prom_getcmdline);
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 919172db560c..13fe187f35d6 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -141,17 +141,20 @@ void __init plat_mem_setup(void)
141/* This routine should be valid for all Au1x based boards */ 141/* This routine should be valid for all Au1x based boards */
142phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size) 142phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
143{ 143{
144 u32 start, end;
145
146 /* Don't fixup 36 bit addresses */ 144 /* Don't fixup 36 bit addresses */
147 if ((phys_addr >> 32) != 0) return phys_addr; 145 if ((phys_addr >> 32) != 0)
146 return phys_addr;
148 147
149#ifdef CONFIG_PCI 148#ifdef CONFIG_PCI
150 start = (u32)Au1500_PCI_MEM_START; 149 {
151 end = (u32)Au1500_PCI_MEM_END; 150 u32 start, end;
152 /* check for pci memory window */ 151
153 if ((phys_addr >= start) && ((phys_addr + size) < end)) { 152 start = (u32)Au1500_PCI_MEM_START;
154 return (phys_t)((phys_addr - start) + Au1500_PCI_MEM_START); 153 end = (u32)Au1500_PCI_MEM_END;
154 /* check for pci memory window */
155 if ((phys_addr >= start) && ((phys_addr + size) < end))
156 return (phys_t)
157 ((phys_addr - start) + Au1500_PCI_MEM_START);
155 } 158 }
156#endif 159#endif
157 160
diff --git a/arch/mips/au1000/pb1100/board_setup.c b/arch/mips/au1000/pb1100/board_setup.c
index 2d1533f116c0..6bc1f8e1b608 100644
--- a/arch/mips/au1000/pb1100/board_setup.c
+++ b/arch/mips/au1000/pb1100/board_setup.c
@@ -47,8 +47,7 @@ void board_reset (void)
47 47
48void __init board_setup(void) 48void __init board_setup(void)
49{ 49{
50 u32 pin_func; 50 volatile void __iomem * base = (volatile void __iomem *) 0xac000000UL;
51 u32 sys_freqctrl, sys_clksrc;
52 51
53 // set AUX clock to 12MHz * 8 = 96 MHz 52 // set AUX clock to 12MHz * 8 = 96 MHz
54 au_writel(8, SYS_AUXPLL); 53 au_writel(8, SYS_AUXPLL);
@@ -56,58 +55,62 @@ void __init board_setup(void)
56 udelay(100); 55 udelay(100);
57 56
58#ifdef CONFIG_USB_OHCI 57#ifdef CONFIG_USB_OHCI
59 // configure pins GPIO[14:9] as GPIO 58 {
60 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80); 59 u32 pin_func, sys_freqctrl, sys_clksrc;
61 60
62 /* zero and disable FREQ2 */ 61 // configure pins GPIO[14:9] as GPIO
63 sys_freqctrl = au_readl(SYS_FREQCTRL0); 62 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80);
64 sys_freqctrl &= ~0xFFF00000; 63
65 au_writel(sys_freqctrl, SYS_FREQCTRL0); 64 /* zero and disable FREQ2 */
66 65 sys_freqctrl = au_readl(SYS_FREQCTRL0);
67 /* zero and disable USBH/USBD/IrDA clock */ 66 sys_freqctrl &= ~0xFFF00000;
68 sys_clksrc = au_readl(SYS_CLKSRC); 67 au_writel(sys_freqctrl, SYS_FREQCTRL0);
69 sys_clksrc &= ~0x0000001F; 68
70 au_writel(sys_clksrc, SYS_CLKSRC); 69 /* zero and disable USBH/USBD/IrDA clock */
71 70 sys_clksrc = au_readl(SYS_CLKSRC);
72 sys_freqctrl = au_readl(SYS_FREQCTRL0); 71 sys_clksrc &= ~0x0000001F;
73 sys_freqctrl &= ~0xFFF00000; 72 au_writel(sys_clksrc, SYS_CLKSRC);
74 73
75 sys_clksrc = au_readl(SYS_CLKSRC); 74 sys_freqctrl = au_readl(SYS_FREQCTRL0);
76 sys_clksrc &= ~0x0000001F; 75 sys_freqctrl &= ~0xFFF00000;
77 76
78 // FREQ2 = aux/2 = 48 MHz 77 sys_clksrc = au_readl(SYS_CLKSRC);
79 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); 78 sys_clksrc &= ~0x0000001F;
80 au_writel(sys_freqctrl, SYS_FREQCTRL0); 79
81 80 // FREQ2 = aux/2 = 48 MHz
82 /* 81 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20));
83 * Route 48MHz FREQ2 into USBH/USBD/IrDA 82 au_writel(sys_freqctrl, SYS_FREQCTRL0);
84 */ 83
85 sys_clksrc |= ((4<<2) | (0<<1) | 0 ); 84 /*
86 au_writel(sys_clksrc, SYS_CLKSRC); 85 * Route 48MHz FREQ2 into USBH/USBD/IrDA
87 86 */
88 /* setup the static bus controller */ 87 sys_clksrc |= ((4<<2) | (0<<1) | 0 );
89 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ 88 au_writel(sys_clksrc, SYS_CLKSRC);
90 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ 89
91 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ 90 /* setup the static bus controller */
92 91 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
93 // get USB Functionality pin state (device vs host drive pins) 92 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
94 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); 93 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
95 // 2nd USB port is USB host 94
96 pin_func |= 0x8000; 95 // get USB Functionality pin state (device vs host drive pins)
97 au_writel(pin_func, SYS_PINFUNC); 96 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000);
97 // 2nd USB port is USB host
98 pin_func |= 0x8000;
99 au_writel(pin_func, SYS_PINFUNC);
100 }
98#endif // defined (CONFIG_USB_OHCI) 101#endif // defined (CONFIG_USB_OHCI)
99 102
100 /* Enable sys bus clock divider when IDLE state or no bus activity. */ 103 /* Enable sys bus clock divider when IDLE state or no bus activity. */
101 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); 104 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
102 105
103 // Enable the RTC if not already enabled 106 // Enable the RTC if not already enabled
104 if (!(readb(0xac000028) & 0x20)) { 107 if (!(readb(base + 0x28) & 0x20)) {
105 writeb(readb(0xac000028) | 0x20, 0xac000028); 108 writeb(readb(base + 0x28) | 0x20, base + 0x28);
106 au_sync(); 109 au_sync();
107 } 110 }
108 // Put the clock in BCD mode 111 // Put the clock in BCD mode
109 if (readb(0xac00002C) & 0x4) { /* reg B */ 112 if (readb(base + 0x2C) & 0x4) { /* reg B */
110 writeb(readb(0xac00002c) & ~0x4, 0xac00002c); 113 writeb(readb(base + 0x2c) & ~0x4, base + 0x2c);
111 au_sync(); 114 au_sync();
112 } 115 }
113} 116}
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index 91983ba407c4..b73b2d18bf56 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -137,33 +137,20 @@ static void pb1200_shutdown_irq( unsigned int irq_nr )
137 return; 137 return;
138} 138}
139 139
140static inline void pb1200_mask_and_ack_irq(unsigned int irq_nr)
141{
142 pb1200_disable_irq( irq_nr );
143}
144
145static void pb1200_end_irq(unsigned int irq_nr)
146{
147 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) {
148 pb1200_enable_irq(irq_nr);
149 }
150}
151
152static struct irq_chip external_irq_type = 140static struct irq_chip external_irq_type =
153{ 141{
154#ifdef CONFIG_MIPS_PB1200 142#ifdef CONFIG_MIPS_PB1200
155 "Pb1200 Ext", 143 .name = "Pb1200 Ext",
156#endif 144#endif
157#ifdef CONFIG_MIPS_DB1200 145#ifdef CONFIG_MIPS_DB1200
158 "Db1200 Ext", 146 .name = "Db1200 Ext",
159#endif 147#endif
160 pb1200_startup_irq, 148 .startup = pb1200_startup_irq,
161 pb1200_shutdown_irq, 149 .shutdown = pb1200_shutdown_irq,
162 pb1200_enable_irq, 150 .ack = pb1200_disable_irq,
163 pb1200_disable_irq, 151 .mask = pb1200_disable_irq,
164 pb1200_mask_and_ack_irq, 152 .mask_ack = pb1200_disable_irq,
165 pb1200_end_irq, 153 .unmask = pb1200_enable_irq,
166 NULL
167}; 154};
168 155
169void _board_init_irq(void) 156void _board_init_irq(void)
@@ -172,7 +159,8 @@ void _board_init_irq(void)
172 159
173 for (irq_nr = PB1200_INT_BEGIN; irq_nr <= PB1200_INT_END; irq_nr++) 160 for (irq_nr = PB1200_INT_BEGIN; irq_nr <= PB1200_INT_END; irq_nr++)
174 { 161 {
175 irq_desc[irq_nr].chip = &external_irq_type; 162 set_irq_chip_and_handler(irq_nr, &external_irq_type,
163 handle_level_irq);
176 pb1200_disable_irq(irq_nr); 164 pb1200_disable_irq(irq_nr);
177 } 165 }
178 166
diff --git a/arch/mips/basler/excite/excite_irq.c b/arch/mips/basler/excite/excite_irq.c
index 2e2061a286c5..1ecab6350421 100644
--- a/arch/mips/basler/excite/excite_irq.c
+++ b/arch/mips/basler/excite/excite_irq.c
@@ -47,9 +47,9 @@ extern asmlinkage void excite_handle_int(void);
47 */ 47 */
48void __init arch_init_irq(void) 48void __init arch_init_irq(void)
49{ 49{
50 mips_cpu_irq_init(0); 50 mips_cpu_irq_init();
51 rm7k_cpu_irq_init(8); 51 rm7k_cpu_irq_init();
52 rm9k_cpu_irq_init(12); 52 rm9k_cpu_irq_init();
53 53
54#ifdef CONFIG_KGDB 54#ifdef CONFIG_KGDB
55 excite_kgdb_init(); 55 excite_kgdb_init();
diff --git a/arch/mips/cobalt/irq.c b/arch/mips/cobalt/irq.c
index 4c46f0e73783..fe93b846923b 100644
--- a/arch/mips/cobalt/irq.c
+++ b/arch/mips/cobalt/irq.c
@@ -104,7 +104,7 @@ void __init arch_init_irq(void)
104 GT_WRITE(GT_INTRMASK_OFS, 0); 104 GT_WRITE(GT_INTRMASK_OFS, 0);
105 105
106 init_i8259_irqs(); /* 0 ... 15 */ 106 init_i8259_irqs(); /* 0 ... 15 */
107 mips_cpu_irq_init(COBALT_CPU_IRQ); /* 16 ... 23 */ 107 mips_cpu_irq_init(); /* 16 ... 23 */
108 108
109 /* 109 /*
110 * Mask all cpu interrupts 110 * Mask all cpu interrupts
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index e8f0f20b852d..a4b69b543bd9 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -204,8 +204,7 @@ void __init prom_init(void)
204 add_memory_region(0x0, memsz, BOOT_MEM_RAM); 204 add_memory_region(0x0, memsz, BOOT_MEM_RAM);
205} 205}
206 206
207unsigned long __init prom_free_prom_memory(void) 207void __init prom_free_prom_memory(void)
208{ 208{
209 /* Nothing to do! */ 209 /* Nothing to do! */
210 return 0;
211} 210}
diff --git a/arch/mips/ddb5xxx/common/prom.c b/arch/mips/ddb5xxx/common/prom.c
index efef0f57ce1e..54a857b5e3ba 100644
--- a/arch/mips/ddb5xxx/common/prom.c
+++ b/arch/mips/ddb5xxx/common/prom.c
@@ -59,9 +59,8 @@ void __init prom_init(void)
59#endif 59#endif
60} 60}
61 61
62unsigned long __init prom_free_prom_memory(void) 62void __init prom_free_prom_memory(void)
63{ 63{
64 return 0;
65} 64}
66 65
67#if defined(CONFIG_DDB5477) 66#if defined(CONFIG_DDB5477)
diff --git a/arch/mips/ddb5xxx/ddb5477/irq.c b/arch/mips/ddb5xxx/ddb5477/irq.c
index a8bd2e66705c..2b23234a5b95 100644
--- a/arch/mips/ddb5xxx/ddb5477/irq.c
+++ b/arch/mips/ddb5xxx/ddb5477/irq.c
@@ -17,6 +17,7 @@
17#include <linux/ptrace.h> 17#include <linux/ptrace.h>
18 18
19#include <asm/i8259.h> 19#include <asm/i8259.h>
20#include <asm/irq_cpu.h>
20#include <asm/system.h> 21#include <asm/system.h>
21#include <asm/mipsregs.h> 22#include <asm/mipsregs.h>
22#include <asm/debug.h> 23#include <asm/debug.h>
@@ -73,7 +74,6 @@ set_pci_int_attr(u32 pci, u32 intn, u32 active, u32 trigger)
73} 74}
74 75
75extern void vrc5477_irq_init(u32 base); 76extern void vrc5477_irq_init(u32 base);
76extern void mips_cpu_irq_init(u32 base);
77static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL }; 77static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
78 78
79void __init arch_init_irq(void) 79void __init arch_init_irq(void)
@@ -125,7 +125,7 @@ void __init arch_init_irq(void)
125 125
126 /* init all controllers */ 126 /* init all controllers */
127 init_i8259_irqs(); 127 init_i8259_irqs();
128 mips_cpu_irq_init(CPU_IRQ_BASE); 128 mips_cpu_irq_init();
129 vrc5477_irq_init(VRC5477_IRQ_BASE); 129 vrc5477_irq_init(VRC5477_IRQ_BASE);
130 130
131 131
@@ -146,8 +146,7 @@ u8 i8259_interrupt_ack(void)
146 irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE); 146 irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE);
147 ddb_out32(DDB_PCIINIT10, reg); 147 ddb_out32(DDB_PCIINIT10, reg);
148 148
149 /* i8259.c set the base vector to be 0x0 */ 149 return irq;
150 return irq + I8259_IRQ_BASE;
151} 150}
152/* 151/*
153 * the first level int-handler will jump here if it is a vrc5477 irq 152 * the first level int-handler will jump here if it is a vrc5477 irq
@@ -177,7 +176,7 @@ static void vrc5477_irq_dispatch(void)
177 /* check for i8259 interrupts */ 176 /* check for i8259 interrupts */
178 if (intStatus & (1 << VRC5477_I8259_CASCADE)) { 177 if (intStatus & (1 << VRC5477_I8259_CASCADE)) {
179 int i8259_irq = i8259_interrupt_ack(); 178 int i8259_irq = i8259_interrupt_ack();
180 do_IRQ(I8259_IRQ_BASE + i8259_irq); 179 do_IRQ(i8259_irq);
181 return; 180 return;
182 } 181 }
183 } 182 }
diff --git a/arch/mips/ddb5xxx/ddb5477/irq_5477.c b/arch/mips/ddb5xxx/ddb5477/irq_5477.c
index 96249aa5df5d..98c3b15eb369 100644
--- a/arch/mips/ddb5xxx/ddb5477/irq_5477.c
+++ b/arch/mips/ddb5xxx/ddb5477/irq_5477.c
@@ -82,7 +82,7 @@ vrc5477_irq_end(unsigned int irq)
82} 82}
83 83
84struct irq_chip vrc5477_irq_controller = { 84struct irq_chip vrc5477_irq_controller = {
85 .typename = "vrc5477_irq", 85 .name = "vrc5477_irq",
86 .ack = vrc5477_irq_ack, 86 .ack = vrc5477_irq_ack,
87 .mask = vrc5477_irq_disable, 87 .mask = vrc5477_irq_disable,
88 .mask_ack = vrc5477_irq_ack, 88 .mask_ack = vrc5477_irq_ack,
diff --git a/arch/mips/dec/Makefile b/arch/mips/dec/Makefile
index ed181fdc3ac9..8b790c2900d5 100644
--- a/arch/mips/dec/Makefile
+++ b/arch/mips/dec/Makefile
@@ -6,6 +6,7 @@ obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn01-berr.o \
6 kn02-irq.o kn02xa-berr.o reset.o setup.o time.o 6 kn02-irq.o kn02xa-berr.o reset.o setup.o time.o
7 7
8obj-$(CONFIG_PROM_CONSOLE) += promcon.o 8obj-$(CONFIG_PROM_CONSOLE) += promcon.o
9obj-$(CONFIG_TC) += tc.o
9obj-$(CONFIG_CPU_HAS_WB) += wbflush.o 10obj-$(CONFIG_CPU_HAS_WB) += wbflush.o
10 11
11EXTRA_AFLAGS := $(CFLAGS) 12EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/dec/ioasic-irq.c b/arch/mips/dec/ioasic-irq.c
index 4c7cb4048d35..3acb133668dc 100644
--- a/arch/mips/dec/ioasic-irq.c
+++ b/arch/mips/dec/ioasic-irq.c
@@ -62,7 +62,7 @@ static inline void end_ioasic_irq(unsigned int irq)
62} 62}
63 63
64static struct irq_chip ioasic_irq_type = { 64static struct irq_chip ioasic_irq_type = {
65 .typename = "IO-ASIC", 65 .name = "IO-ASIC",
66 .ack = ack_ioasic_irq, 66 .ack = ack_ioasic_irq,
67 .mask = mask_ioasic_irq, 67 .mask = mask_ioasic_irq,
68 .mask_ack = ack_ioasic_irq, 68 .mask_ack = ack_ioasic_irq,
@@ -84,7 +84,7 @@ static inline void end_ioasic_dma_irq(unsigned int irq)
84} 84}
85 85
86static struct irq_chip ioasic_dma_irq_type = { 86static struct irq_chip ioasic_dma_irq_type = {
87 .typename = "IO-ASIC-DMA", 87 .name = "IO-ASIC-DMA",
88 .ack = ack_ioasic_dma_irq, 88 .ack = ack_ioasic_dma_irq,
89 .mask = mask_ioasic_dma_irq, 89 .mask = mask_ioasic_dma_irq,
90 .mask_ack = ack_ioasic_dma_irq, 90 .mask_ack = ack_ioasic_dma_irq,
diff --git a/arch/mips/dec/kn02-irq.c b/arch/mips/dec/kn02-irq.c
index 916e46b8ccd8..02439dc0ba83 100644
--- a/arch/mips/dec/kn02-irq.c
+++ b/arch/mips/dec/kn02-irq.c
@@ -58,7 +58,7 @@ static void ack_kn02_irq(unsigned int irq)
58} 58}
59 59
60static struct irq_chip kn02_irq_type = { 60static struct irq_chip kn02_irq_type = {
61 .typename = "KN02-CSR", 61 .name = "KN02-CSR",
62 .ack = ack_kn02_irq, 62 .ack = ack_kn02_irq,
63 .mask = mask_kn02_irq, 63 .mask = mask_kn02_irq,
64 .mask_ack = ack_kn02_irq, 64 .mask_ack = ack_kn02_irq,
diff --git a/arch/mips/dec/prom/identify.c b/arch/mips/dec/prom/identify.c
index 81d5e878ddce..c4e3c1ea0d48 100644
--- a/arch/mips/dec/prom/identify.c
+++ b/arch/mips/dec/prom/identify.c
@@ -88,6 +88,7 @@ static inline void prom_init_kn02(void)
88{ 88{
89 dec_kn_slot_base = KN02_SLOT_BASE; 89 dec_kn_slot_base = KN02_SLOT_BASE;
90 dec_kn_slot_size = KN02_SLOT_SIZE; 90 dec_kn_slot_size = KN02_SLOT_SIZE;
91 dec_tc_bus = 1;
91 92
92 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + KN02_RTC); 93 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + KN02_RTC);
93} 94}
@@ -96,6 +97,7 @@ static inline void prom_init_kn02xa(void)
96{ 97{
97 dec_kn_slot_base = KN02XA_SLOT_BASE; 98 dec_kn_slot_base = KN02XA_SLOT_BASE;
98 dec_kn_slot_size = IOASIC_SLOT_SIZE; 99 dec_kn_slot_size = IOASIC_SLOT_SIZE;
100 dec_tc_bus = 1;
99 101
100 ioasic_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_IOCTL); 102 ioasic_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_IOCTL);
101 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_TOY); 103 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_TOY);
@@ -105,6 +107,7 @@ static inline void prom_init_kn03(void)
105{ 107{
106 dec_kn_slot_base = KN03_SLOT_BASE; 108 dec_kn_slot_base = KN03_SLOT_BASE;
107 dec_kn_slot_size = IOASIC_SLOT_SIZE; 109 dec_kn_slot_size = IOASIC_SLOT_SIZE;
110 dec_tc_bus = 1;
108 111
109 ioasic_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_IOCTL); 112 ioasic_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_IOCTL);
110 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_TOY); 113 dec_rtc_base = (void *)CKSEG1ADDR(dec_kn_slot_base + IOASIC_TOY);
diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c
index 3aa01d268f2d..5a557e268f78 100644
--- a/arch/mips/dec/prom/memory.c
+++ b/arch/mips/dec/prom/memory.c
@@ -92,9 +92,9 @@ void __init prom_meminit(u32 magic)
92 rex_setup_memory_region(); 92 rex_setup_memory_region();
93} 93}
94 94
95unsigned long __init prom_free_prom_memory(void) 95void __init prom_free_prom_memory(void)
96{ 96{
97 unsigned long addr, end; 97 unsigned long end;
98 98
99 /* 99 /*
100 * Free everything below the kernel itself but leave 100 * Free everything below the kernel itself but leave
@@ -114,16 +114,5 @@ unsigned long __init prom_free_prom_memory(void)
114#endif 114#endif
115 end = __pa(&_text); 115 end = __pa(&_text);
116 116
117 addr = PAGE_SIZE; 117 free_init_pages("unused PROM memory", PAGE_SIZE, end);
118 while (addr < end) {
119 ClearPageReserved(virt_to_page(__va(addr)));
120 init_page_count(virt_to_page(__va(addr)));
121 free_page((unsigned long)__va(addr));
122 addr += PAGE_SIZE;
123 }
124
125 printk("Freeing unused PROM memory: %ldkb freed\n",
126 (end - PAGE_SIZE) >> 10);
127
128 return end - PAGE_SIZE;
129} 118}
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
index d34032ac492a..b8a5e75ba0ab 100644
--- a/arch/mips/dec/setup.c
+++ b/arch/mips/dec/setup.c
@@ -53,6 +53,8 @@ unsigned long dec_kn_slot_base, dec_kn_slot_size;
53EXPORT_SYMBOL(dec_kn_slot_base); 53EXPORT_SYMBOL(dec_kn_slot_base);
54EXPORT_SYMBOL(dec_kn_slot_size); 54EXPORT_SYMBOL(dec_kn_slot_size);
55 55
56int dec_tc_bus;
57
56spinlock_t ioasic_ssr_lock; 58spinlock_t ioasic_ssr_lock;
57 59
58volatile u32 *ioasic_base; 60volatile u32 *ioasic_base;
@@ -234,7 +236,7 @@ static void __init dec_init_kn01(void)
234 memcpy(&cpu_mask_nr_tbl, &kn01_cpu_mask_nr_tbl, 236 memcpy(&cpu_mask_nr_tbl, &kn01_cpu_mask_nr_tbl,
235 sizeof(kn01_cpu_mask_nr_tbl)); 237 sizeof(kn01_cpu_mask_nr_tbl));
236 238
237 mips_cpu_irq_init(DEC_CPU_IRQ_BASE); 239 mips_cpu_irq_init();
238 240
239} /* dec_init_kn01 */ 241} /* dec_init_kn01 */
240 242
@@ -309,7 +311,7 @@ static void __init dec_init_kn230(void)
309 memcpy(&cpu_mask_nr_tbl, &kn230_cpu_mask_nr_tbl, 311 memcpy(&cpu_mask_nr_tbl, &kn230_cpu_mask_nr_tbl,
310 sizeof(kn230_cpu_mask_nr_tbl)); 312 sizeof(kn230_cpu_mask_nr_tbl));
311 313
312 mips_cpu_irq_init(DEC_CPU_IRQ_BASE); 314 mips_cpu_irq_init();
313 315
314} /* dec_init_kn230 */ 316} /* dec_init_kn230 */
315 317
@@ -403,7 +405,7 @@ static void __init dec_init_kn02(void)
403 memcpy(&asic_mask_nr_tbl, &kn02_asic_mask_nr_tbl, 405 memcpy(&asic_mask_nr_tbl, &kn02_asic_mask_nr_tbl,
404 sizeof(kn02_asic_mask_nr_tbl)); 406 sizeof(kn02_asic_mask_nr_tbl));
405 407
406 mips_cpu_irq_init(DEC_CPU_IRQ_BASE); 408 mips_cpu_irq_init();
407 init_kn02_irqs(KN02_IRQ_BASE); 409 init_kn02_irqs(KN02_IRQ_BASE);
408 410
409} /* dec_init_kn02 */ 411} /* dec_init_kn02 */
@@ -504,7 +506,7 @@ static void __init dec_init_kn02ba(void)
504 memcpy(&asic_mask_nr_tbl, &kn02ba_asic_mask_nr_tbl, 506 memcpy(&asic_mask_nr_tbl, &kn02ba_asic_mask_nr_tbl,
505 sizeof(kn02ba_asic_mask_nr_tbl)); 507 sizeof(kn02ba_asic_mask_nr_tbl));
506 508
507 mips_cpu_irq_init(DEC_CPU_IRQ_BASE); 509 mips_cpu_irq_init();
508 init_ioasic_irqs(IO_IRQ_BASE); 510 init_ioasic_irqs(IO_IRQ_BASE);
509 511
510} /* dec_init_kn02ba */ 512} /* dec_init_kn02ba */
@@ -601,7 +603,7 @@ static void __init dec_init_kn02ca(void)
601 memcpy(&asic_mask_nr_tbl, &kn02ca_asic_mask_nr_tbl, 603 memcpy(&asic_mask_nr_tbl, &kn02ca_asic_mask_nr_tbl,
602 sizeof(kn02ca_asic_mask_nr_tbl)); 604 sizeof(kn02ca_asic_mask_nr_tbl));
603 605
604 mips_cpu_irq_init(DEC_CPU_IRQ_BASE); 606 mips_cpu_irq_init();
605 init_ioasic_irqs(IO_IRQ_BASE); 607 init_ioasic_irqs(IO_IRQ_BASE);
606 608
607} /* dec_init_kn02ca */ 609} /* dec_init_kn02ca */
@@ -702,7 +704,7 @@ static void __init dec_init_kn03(void)
702 memcpy(&asic_mask_nr_tbl, &kn03_asic_mask_nr_tbl, 704 memcpy(&asic_mask_nr_tbl, &kn03_asic_mask_nr_tbl,
703 sizeof(kn03_asic_mask_nr_tbl)); 705 sizeof(kn03_asic_mask_nr_tbl));
704 706
705 mips_cpu_irq_init(DEC_CPU_IRQ_BASE); 707 mips_cpu_irq_init();
706 init_ioasic_irqs(IO_IRQ_BASE); 708 init_ioasic_irqs(IO_IRQ_BASE);
707 709
708} /* dec_init_kn03 */ 710} /* dec_init_kn03 */
diff --git a/arch/mips/dec/tc.c b/arch/mips/dec/tc.c
new file mode 100644
index 000000000000..732027c79834
--- /dev/null
+++ b/arch/mips/dec/tc.c
@@ -0,0 +1,95 @@
1/*
2 * TURBOchannel architecture calls.
3 *
4 * Copyright (c) Harald Koerfgen, 1998
5 * Copyright (c) 2001, 2003, 2005, 2006 Maciej W. Rozycki
6 * Copyright (c) 2005 James Simmons
7 *
8 * This file is subject to the terms and conditions of the GNU
9 * General Public License. See the file "COPYING" in the main
10 * directory of this archive for more details.
11 */
12#include <linux/compiler.h>
13#include <linux/errno.h>
14#include <linux/init.h>
15#include <linux/string.h>
16#include <linux/tc.h>
17#include <linux/types.h>
18
19#include <asm/addrspace.h>
20#include <asm/bootinfo.h>
21#include <asm/paccess.h>
22
23#include <asm/dec/interrupts.h>
24#include <asm/dec/prom.h>
25#include <asm/dec/system.h>
26
27/*
28 * Protected read byte from TURBOchannel slot space.
29 */
30int tc_preadb(u8 *valp, void __iomem *addr)
31{
32 return get_dbe(*valp, (u8 *)addr);
33}
34
35/*
36 * Get TURBOchannel bus information as specified by the spec, plus
37 * the slot space base address and the number of slots.
38 */
39int __init tc_bus_get_info(struct tc_bus *tbus)
40{
41 if (!dec_tc_bus)
42 return -ENXIO;
43
44 memcpy(&tbus->info, rex_gettcinfo(), sizeof(tbus->info));
45 tbus->slot_base = CPHYSADDR((long)rex_slot_address(0));
46
47 switch (mips_machtype) {
48 case MACH_DS5000_200:
49 tbus->num_tcslots = 7;
50 break;
51 case MACH_DS5000_2X0:
52 case MACH_DS5900:
53 tbus->ext_slot_base = 0x20000000;
54 tbus->ext_slot_size = 0x20000000;
55 /* fall through */
56 case MACH_DS5000_1XX:
57 tbus->num_tcslots = 3;
58 break;
59 case MACH_DS5000_XX:
60 tbus->num_tcslots = 2;
61 default:
62 break;
63 }
64 return 0;
65}
66
67/*
68 * Get the IRQ for the specified slot.
69 */
70void __init tc_device_get_irq(struct tc_dev *tdev)
71{
72 switch (tdev->slot) {
73 case 0:
74 tdev->interrupt = dec_interrupt[DEC_IRQ_TC0];
75 break;
76 case 1:
77 tdev->interrupt = dec_interrupt[DEC_IRQ_TC1];
78 break;
79 case 2:
80 tdev->interrupt = dec_interrupt[DEC_IRQ_TC2];
81 break;
82 /*
83 * Yuck! DS5000/200 onboard devices
84 */
85 case 5:
86 tdev->interrupt = dec_interrupt[DEC_IRQ_TC5];
87 break;
88 case 6:
89 tdev->interrupt = dec_interrupt[DEC_IRQ_TC6];
90 break;
91 default:
92 tdev->interrupt = -1;
93 break;
94 }
95}
diff --git a/arch/mips/emma2rh/common/irq_emma2rh.c b/arch/mips/emma2rh/common/irq_emma2rh.c
index 8d880f0b06ec..96df37b77759 100644
--- a/arch/mips/emma2rh/common/irq_emma2rh.c
+++ b/arch/mips/emma2rh/common/irq_emma2rh.c
@@ -57,7 +57,7 @@ static void emma2rh_irq_disable(unsigned int irq)
57} 57}
58 58
59struct irq_chip emma2rh_irq_controller = { 59struct irq_chip emma2rh_irq_controller = {
60 .typename = "emma2rh_irq", 60 .name = "emma2rh_irq",
61 .ack = emma2rh_irq_disable, 61 .ack = emma2rh_irq_disable,
62 .mask = emma2rh_irq_disable, 62 .mask = emma2rh_irq_disable,
63 .mask_ack = emma2rh_irq_disable, 63 .mask_ack = emma2rh_irq_disable,
diff --git a/arch/mips/emma2rh/markeins/irq.c b/arch/mips/emma2rh/markeins/irq.c
index c93369cb4115..3299b6dfe764 100644
--- a/arch/mips/emma2rh/markeins/irq.c
+++ b/arch/mips/emma2rh/markeins/irq.c
@@ -106,7 +106,7 @@ void __init arch_init_irq(void)
106 emma2rh_irq_init(EMMA2RH_IRQ_BASE); 106 emma2rh_irq_init(EMMA2RH_IRQ_BASE);
107 emma2rh_sw_irq_init(EMMA2RH_SW_IRQ_BASE); 107 emma2rh_sw_irq_init(EMMA2RH_SW_IRQ_BASE);
108 emma2rh_gpio_irq_init(EMMA2RH_GPIO_IRQ_BASE); 108 emma2rh_gpio_irq_init(EMMA2RH_GPIO_IRQ_BASE);
109 mips_cpu_irq_init(CPU_IRQ_BASE); 109 mips_cpu_irq_init();
110 110
111 /* setup cascade interrupts */ 111 /* setup cascade interrupts */
112 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade); 112 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade);
diff --git a/arch/mips/emma2rh/markeins/irq_markeins.c b/arch/mips/emma2rh/markeins/irq_markeins.c
index 2116d9be5fa9..fba5c156f472 100644
--- a/arch/mips/emma2rh/markeins/irq_markeins.c
+++ b/arch/mips/emma2rh/markeins/irq_markeins.c
@@ -49,7 +49,7 @@ static void emma2rh_sw_irq_disable(unsigned int irq)
49} 49}
50 50
51struct irq_chip emma2rh_sw_irq_controller = { 51struct irq_chip emma2rh_sw_irq_controller = {
52 .typename = "emma2rh_sw_irq", 52 .name = "emma2rh_sw_irq",
53 .ack = emma2rh_sw_irq_disable, 53 .ack = emma2rh_sw_irq_disable,
54 .mask = emma2rh_sw_irq_disable, 54 .mask = emma2rh_sw_irq_disable,
55 .mask_ack = emma2rh_sw_irq_disable, 55 .mask_ack = emma2rh_sw_irq_disable,
@@ -115,7 +115,7 @@ static void emma2rh_gpio_irq_end(unsigned int irq)
115} 115}
116 116
117struct irq_chip emma2rh_gpio_irq_controller = { 117struct irq_chip emma2rh_gpio_irq_controller = {
118 .typename = "emma2rh_gpio_irq", 118 .name = "emma2rh_gpio_irq",
119 .ack = emma2rh_gpio_irq_ack, 119 .ack = emma2rh_gpio_irq_ack,
120 .mask = emma2rh_gpio_irq_disable, 120 .mask = emma2rh_gpio_irq_disable,
121 .mask_ack = emma2rh_gpio_irq_ack, 121 .mask_ack = emma2rh_gpio_irq_ack,
diff --git a/arch/mips/gt64120/ev64120/irq.c b/arch/mips/gt64120/ev64120/irq.c
index b3e5796c81d7..04572b9c9642 100644
--- a/arch/mips/gt64120/ev64120/irq.c
+++ b/arch/mips/gt64120/ev64120/irq.c
@@ -88,7 +88,7 @@ static void end_ev64120_irq(unsigned int irq)
88} 88}
89 89
90static struct irq_chip ev64120_irq_type = { 90static struct irq_chip ev64120_irq_type = {
91 .typename = "EV64120", 91 .name = "EV64120",
92 .ack = disable_ev64120_irq, 92 .ack = disable_ev64120_irq,
93 .mask = disable_ev64120_irq, 93 .mask = disable_ev64120_irq,
94 .mask_ack = disable_ev64120_irq, 94 .mask_ack = disable_ev64120_irq,
diff --git a/arch/mips/gt64120/ev64120/setup.c b/arch/mips/gt64120/ev64120/setup.c
index 99c8d42212e2..477848c22a2c 100644
--- a/arch/mips/gt64120/ev64120/setup.c
+++ b/arch/mips/gt64120/ev64120/setup.c
@@ -59,9 +59,8 @@ extern void galileo_machine_power_off(void);
59 */ 59 */
60extern struct pci_ops galileo_pci_ops; 60extern struct pci_ops galileo_pci_ops;
61 61
62unsigned long __init prom_free_prom_memory(void) 62void __init prom_free_prom_memory(void)
63{ 63{
64 return 0;
65} 64}
66 65
67/* 66/*
diff --git a/arch/mips/gt64120/momenco_ocelot/dbg_io.c b/arch/mips/gt64120/momenco_ocelot/dbg_io.c
index 2128684584f5..32d6fb4ee679 100644
--- a/arch/mips/gt64120/momenco_ocelot/dbg_io.c
+++ b/arch/mips/gt64120/momenco_ocelot/dbg_io.c
@@ -1,6 +1,4 @@
1 1
2#ifdef CONFIG_KGDB
3
4#include <asm/serial.h> /* For the serial port location and base baud */ 2#include <asm/serial.h> /* For the serial port location and base baud */
5 3
6/* --- CONFIG --- */ 4/* --- CONFIG --- */
@@ -121,5 +119,3 @@ int putDebugChar(uint8 byte)
121 UART16550_WRITE(OFS_SEND_BUFFER, byte); 119 UART16550_WRITE(OFS_SEND_BUFFER, byte);
122 return 1; 120 return 1;
123} 121}
124
125#endif
diff --git a/arch/mips/gt64120/momenco_ocelot/irq.c b/arch/mips/gt64120/momenco_ocelot/irq.c
index d9294401ccb0..2585d9dbda33 100644
--- a/arch/mips/gt64120/momenco_ocelot/irq.c
+++ b/arch/mips/gt64120/momenco_ocelot/irq.c
@@ -90,6 +90,6 @@ void __init arch_init_irq(void)
90 clear_c0_status(ST0_IM); 90 clear_c0_status(ST0_IM);
91 local_irq_disable(); 91 local_irq_disable();
92 92
93 mips_cpu_irq_init(0); 93 mips_cpu_irq_init();
94 rm7k_cpu_irq_init(8); 94 rm7k_cpu_irq_init();
95} 95}
diff --git a/arch/mips/gt64120/momenco_ocelot/prom.c b/arch/mips/gt64120/momenco_ocelot/prom.c
index 8677b6d3ada7..78f393b2afd9 100644
--- a/arch/mips/gt64120/momenco_ocelot/prom.c
+++ b/arch/mips/gt64120/momenco_ocelot/prom.c
@@ -67,7 +67,6 @@ void __init prom_init(void)
67 add_memory_region(0, 64 << 20, BOOT_MEM_RAM); 67 add_memory_region(0, 64 << 20, BOOT_MEM_RAM);
68} 68}
69 69
70unsigned long __init prom_free_prom_memory(void) 70void __init prom_free_prom_memory(void)
71{ 71{
72 return 0;
73} 72}
diff --git a/arch/mips/gt64120/wrppmc/irq.c b/arch/mips/gt64120/wrppmc/irq.c
index eedfc24e1eae..d3d96591780e 100644
--- a/arch/mips/gt64120/wrppmc/irq.c
+++ b/arch/mips/gt64120/wrppmc/irq.c
@@ -63,7 +63,7 @@ void gt64120_init_pic(void)
63void __init arch_init_irq(void) 63void __init arch_init_irq(void)
64{ 64{
65 /* IRQ 0 - 7 are for MIPS common irq_cpu controller */ 65 /* IRQ 0 - 7 are for MIPS common irq_cpu controller */
66 mips_cpu_irq_init(0); 66 mips_cpu_irq_init();
67 67
68 gt64120_init_pic(); 68 gt64120_init_pic();
69} 69}
diff --git a/arch/mips/gt64120/wrppmc/setup.c b/arch/mips/gt64120/wrppmc/setup.c
index 429afc400cb4..121188d5ec4a 100644
--- a/arch/mips/gt64120/wrppmc/setup.c
+++ b/arch/mips/gt64120/wrppmc/setup.c
@@ -93,9 +93,8 @@ void __init wrppmc_early_printk(const char *fmt, ...)
93} 93}
94#endif /* WRPPMC_EARLY_DEBUG */ 94#endif /* WRPPMC_EARLY_DEBUG */
95 95
96unsigned long __init prom_free_prom_memory(void) 96void __init prom_free_prom_memory(void)
97{ 97{
98 return 0;
99} 98}
100 99
101#ifdef CONFIG_SERIAL_8250 100#ifdef CONFIG_SERIAL_8250
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index f8d417b5c2bb..295892e4ce53 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -40,7 +40,7 @@ void disable_r4030_irq(unsigned int irq)
40} 40}
41 41
42static struct irq_chip r4030_irq_type = { 42static struct irq_chip r4030_irq_type = {
43 .typename = "R4030", 43 .name = "R4030",
44 .ack = disable_r4030_irq, 44 .ack = disable_r4030_irq,
45 .mask = disable_r4030_irq, 45 .mask = disable_r4030_irq,
46 .mask_ack = disable_r4030_irq, 46 .mask_ack = disable_r4030_irq,
diff --git a/arch/mips/jmr3927/common/prom.c b/arch/mips/jmr3927/common/prom.c
index 5d5838f41d23..aa481b774c42 100644
--- a/arch/mips/jmr3927/common/prom.c
+++ b/arch/mips/jmr3927/common/prom.c
@@ -75,7 +75,6 @@ void __init prom_init_cmdline(void)
75 *cp = '\0'; 75 *cp = '\0';
76} 76}
77 77
78unsigned long __init prom_free_prom_memory(void) 78void __init prom_free_prom_memory(void)
79{ 79{
80 return 0;
81} 80}
diff --git a/arch/mips/jmr3927/rbhma3100/irq.c b/arch/mips/jmr3927/rbhma3100/irq.c
index 3da49c5aaf49..7d2c203cb406 100644
--- a/arch/mips/jmr3927/rbhma3100/irq.c
+++ b/arch/mips/jmr3927/rbhma3100/irq.c
@@ -439,7 +439,7 @@ void __init arch_init_irq(void)
439} 439}
440 440
441static struct irq_chip jmr3927_irq_controller = { 441static struct irq_chip jmr3927_irq_controller = {
442 .typename = "jmr3927_irq", 442 .name = "jmr3927_irq",
443 .ack = jmr3927_irq_ack, 443 .ack = jmr3927_irq_ack,
444 .mask = jmr3927_irq_disable, 444 .mask = jmr3927_irq_disable,
445 .mask_ack = jmr3927_irq_ack, 445 .mask_ack = jmr3927_irq_ack,
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 138f25efe38a..7ca3d6d07b34 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -434,7 +434,7 @@ void __init tx3927_setup(void)
434 434
435 /* DMA */ 435 /* DMA */
436 tx3927_dmaptr->mcr = 0; 436 tx3927_dmaptr->mcr = 0;
437 for (i = 0; i < sizeof(tx3927_dmaptr->ch) / sizeof(tx3927_dmaptr->ch[0]); i++) { 437 for (i = 0; i < ARRAY_SIZE(tx3927_dmaptr->ch); i++) {
438 /* reset channel */ 438 /* reset channel */
439 tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST; 439 tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;
440 tx3927_dmaptr->ch[i].ccr = 0; 440 tx3927_dmaptr->ch[i].ccr = 0;
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index bbbb8d7cb89b..1bf2c8448912 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -14,8 +14,6 @@ binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
14obj-$(CONFIG_STACKTRACE) += stacktrace.o 14obj-$(CONFIG_STACKTRACE) += stacktrace.o
15obj-$(CONFIG_MODULES) += mips_ksyms.o module.o 15obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
16 16
17obj-$(CONFIG_APM) += apm.o
18
19obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o 17obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o
20obj-$(CONFIG_CPU_TX39XX) += r2300_fpu.o r2300_switch.o 18obj-$(CONFIG_CPU_TX39XX) += r2300_fpu.o r2300_switch.o
21obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o 19obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
diff --git a/arch/mips/kernel/apm.c b/arch/mips/kernel/apm.c
deleted file mode 100644
index ba16d07588cb..000000000000
--- a/arch/mips/kernel/apm.c
+++ /dev/null
@@ -1,604 +0,0 @@
1/*
2 * bios-less APM driver for MIPS Linux
3 * Jamey Hicks <jamey@crl.dec.com>
4 * adapted from the APM BIOS driver for Linux by Stephen Rothwell (sfr@linuxcare.com)
5 *
6 * APM 1.2 Reference:
7 * Intel Corporation, Microsoft Corporation. Advanced Power Management
8 * (APM) BIOS Interface Specification, Revision 1.2, February 1996.
9 *
10 * [This document is available from Microsoft at:
11 * http://www.microsoft.com/hwdev/busbios/amp_12.htm]
12 */
13#include <linux/module.h>
14#include <linux/poll.h>
15#include <linux/timer.h>
16#include <linux/slab.h>
17#include <linux/proc_fs.h>
18#include <linux/miscdevice.h>
19#include <linux/apm_bios.h>
20#include <linux/capability.h>
21#include <linux/sched.h>
22#include <linux/pm.h>
23#include <linux/device.h>
24#include <linux/kernel.h>
25#include <linux/list.h>
26#include <linux/init.h>
27#include <linux/completion.h>
28
29#include <asm/apm.h> /* apm_power_info */
30#include <asm/system.h>
31
32/*
33 * The apm_bios device is one of the misc char devices.
34 * This is its minor number.
35 */
36#define APM_MINOR_DEV 134
37
38/*
39 * See Documentation/Config.help for the configuration options.
40 *
41 * Various options can be changed at boot time as follows:
42 * (We allow underscores for compatibility with the modules code)
43 * apm=on/off enable/disable APM
44 */
45
46/*
47 * Maximum number of events stored
48 */
49#define APM_MAX_EVENTS 16
50
51struct apm_queue {
52 unsigned int event_head;
53 unsigned int event_tail;
54 apm_event_t events[APM_MAX_EVENTS];
55};
56
57/*
58 * The per-file APM data
59 */
60struct apm_user {
61 struct list_head list;
62
63 unsigned int suser: 1;
64 unsigned int writer: 1;
65 unsigned int reader: 1;
66
67 int suspend_result;
68 unsigned int suspend_state;
69#define SUSPEND_NONE 0 /* no suspend pending */
70#define SUSPEND_PENDING 1 /* suspend pending read */
71#define SUSPEND_READ 2 /* suspend read, pending ack */
72#define SUSPEND_ACKED 3 /* suspend acked */
73#define SUSPEND_DONE 4 /* suspend completed */
74
75 struct apm_queue queue;
76};
77
78/*
79 * Local variables
80 */
81static int suspends_pending;
82static int apm_disabled;
83static int mips_apm_active;
84
85static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
86static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
87
88/*
89 * This is a list of everyone who has opened /dev/apm_bios
90 */
91static DECLARE_RWSEM(user_list_lock);
92static LIST_HEAD(apm_user_list);
93
94/*
95 * kapmd info. kapmd provides us a process context to handle
96 * "APM" events within - specifically necessary if we're going
97 * to be suspending the system.
98 */
99static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait);
100static DECLARE_COMPLETION(kapmd_exit);
101static DEFINE_SPINLOCK(kapmd_queue_lock);
102static struct apm_queue kapmd_queue;
103
104
105static const char driver_version[] = "1.13"; /* no spaces */
106
107
108
109/*
110 * Compatibility cruft until the IPAQ people move over to the new
111 * interface.
112 */
113static void __apm_get_power_status(struct apm_power_info *info)
114{
115}
116
117/*
118 * This allows machines to provide their own "apm get power status" function.
119 */
120void (*apm_get_power_status)(struct apm_power_info *) = __apm_get_power_status;
121EXPORT_SYMBOL(apm_get_power_status);
122
123
124/*
125 * APM event queue management.
126 */
127static inline int queue_empty(struct apm_queue *q)
128{
129 return q->event_head == q->event_tail;
130}
131
132static inline apm_event_t queue_get_event(struct apm_queue *q)
133{
134 q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS;
135 return q->events[q->event_tail];
136}
137
138static void queue_add_event(struct apm_queue *q, apm_event_t event)
139{
140 q->event_head = (q->event_head + 1) % APM_MAX_EVENTS;
141 if (q->event_head == q->event_tail) {
142 static int notified;
143
144 if (notified++ == 0)
145 printk(KERN_ERR "apm: an event queue overflowed\n");
146 q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS;
147 }
148 q->events[q->event_head] = event;
149}
150
151static void queue_event_one_user(struct apm_user *as, apm_event_t event)
152{
153 if (as->suser && as->writer) {
154 switch (event) {
155 case APM_SYS_SUSPEND:
156 case APM_USER_SUSPEND:
157 /*
158 * If this user already has a suspend pending,
159 * don't queue another one.
160 */
161 if (as->suspend_state != SUSPEND_NONE)
162 return;
163
164 as->suspend_state = SUSPEND_PENDING;
165 suspends_pending++;
166 break;
167 }
168 }
169 queue_add_event(&as->queue, event);
170}
171
172static void queue_event(apm_event_t event, struct apm_user *sender)
173{
174 struct apm_user *as;
175
176 down_read(&user_list_lock);
177 list_for_each_entry(as, &apm_user_list, list) {
178 if (as != sender && as->reader)
179 queue_event_one_user(as, event);
180 }
181 up_read(&user_list_lock);
182 wake_up_interruptible(&apm_waitqueue);
183}
184
185static void apm_suspend(void)
186{
187 struct apm_user *as;
188 int err = pm_suspend(PM_SUSPEND_MEM);
189
190 /*
191 * Anyone on the APM queues will think we're still suspended.
192 * Send a message so everyone knows we're now awake again.
193 */
194 queue_event(APM_NORMAL_RESUME, NULL);
195
196 /*
197 * Finally, wake up anyone who is sleeping on the suspend.
198 */
199 down_read(&user_list_lock);
200 list_for_each_entry(as, &apm_user_list, list) {
201 as->suspend_result = err;
202 as->suspend_state = SUSPEND_DONE;
203 }
204 up_read(&user_list_lock);
205
206 wake_up(&apm_suspend_waitqueue);
207}
208
209static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos)
210{
211 struct apm_user *as = fp->private_data;
212 apm_event_t event;
213 int i = count, ret = 0;
214
215 if (count < sizeof(apm_event_t))
216 return -EINVAL;
217
218 if (queue_empty(&as->queue) && fp->f_flags & O_NONBLOCK)
219 return -EAGAIN;
220
221 wait_event_interruptible(apm_waitqueue, !queue_empty(&as->queue));
222
223 while ((i >= sizeof(event)) && !queue_empty(&as->queue)) {
224 event = queue_get_event(&as->queue);
225
226 ret = -EFAULT;
227 if (copy_to_user(buf, &event, sizeof(event)))
228 break;
229
230 if (event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND)
231 as->suspend_state = SUSPEND_READ;
232
233 buf += sizeof(event);
234 i -= sizeof(event);
235 }
236
237 if (i < count)
238 ret = count - i;
239
240 return ret;
241}
242
243static unsigned int apm_poll(struct file *fp, poll_table * wait)
244{
245 struct apm_user *as = fp->private_data;
246
247 poll_wait(fp, &apm_waitqueue, wait);
248 return queue_empty(&as->queue) ? 0 : POLLIN | POLLRDNORM;
249}
250
251/*
252 * apm_ioctl - handle APM ioctl
253 *
254 * APM_IOC_SUSPEND
255 * This IOCTL is overloaded, and performs two functions. It is used to:
256 * - initiate a suspend
257 * - acknowledge a suspend read from /dev/apm_bios.
258 * Only when everyone who has opened /dev/apm_bios with write permission
259 * has acknowledge does the actual suspend happen.
260 */
261static int
262apm_ioctl(struct inode * inode, struct file *filp, unsigned int cmd, unsigned long arg)
263{
264 struct apm_user *as = filp->private_data;
265 unsigned long flags;
266 int err = -EINVAL;
267
268 if (!as->suser || !as->writer)
269 return -EPERM;
270
271 switch (cmd) {
272 case APM_IOC_SUSPEND:
273 as->suspend_result = -EINTR;
274
275 if (as->suspend_state == SUSPEND_READ) {
276 /*
277 * If we read a suspend command from /dev/apm_bios,
278 * then the corresponding APM_IOC_SUSPEND ioctl is
279 * interpreted as an acknowledge.
280 */
281 as->suspend_state = SUSPEND_ACKED;
282 suspends_pending--;
283 } else {
284 /*
285 * Otherwise it is a request to suspend the system.
286 * Queue an event for all readers, and expect an
287 * acknowledge from all writers who haven't already
288 * acknowledged.
289 */
290 queue_event(APM_USER_SUSPEND, as);
291 }
292
293 /*
294 * If there are no further acknowledges required, suspend
295 * the system.
296 */
297 if (suspends_pending == 0)
298 apm_suspend();
299
300 /*
301 * Wait for the suspend/resume to complete. If there are
302 * pending acknowledges, we wait here for them.
303 *
304 * Note that we need to ensure that the PM subsystem does
305 * not kick us out of the wait when it suspends the threads.
306 */
307 flags = current->flags;
308 current->flags |= PF_NOFREEZE;
309
310 /*
311 * Note: do not allow a thread which is acking the suspend
312 * to escape until the resume is complete.
313 */
314 if (as->suspend_state == SUSPEND_ACKED)
315 wait_event(apm_suspend_waitqueue,
316 as->suspend_state == SUSPEND_DONE);
317 else
318 wait_event_interruptible(apm_suspend_waitqueue,
319 as->suspend_state == SUSPEND_DONE);
320
321 current->flags = flags;
322 err = as->suspend_result;
323 as->suspend_state = SUSPEND_NONE;
324 break;
325 }
326
327 return err;
328}
329
330static int apm_release(struct inode * inode, struct file * filp)
331{
332 struct apm_user *as = filp->private_data;
333 filp->private_data = NULL;
334
335 down_write(&user_list_lock);
336 list_del(&as->list);
337 up_write(&user_list_lock);
338
339 /*
340 * We are now unhooked from the chain. As far as new
341 * events are concerned, we no longer exist. However, we
342 * need to balance suspends_pending, which means the
343 * possibility of sleeping.
344 */
345 if (as->suspend_state != SUSPEND_NONE) {
346 suspends_pending -= 1;
347 if (suspends_pending == 0)
348 apm_suspend();
349 }
350
351 kfree(as);
352 return 0;
353}
354
355static int apm_open(struct inode * inode, struct file * filp)
356{
357 struct apm_user *as;
358
359 as = kzalloc(sizeof(*as), GFP_KERNEL);
360 if (as) {
361 /*
362 * XXX - this is a tiny bit broken, when we consider BSD
363 * process accounting. If the device is opened by root, we
364 * instantly flag that we used superuser privs. Who knows,
365 * we might close the device immediately without doing a
366 * privileged operation -- cevans
367 */
368 as->suser = capable(CAP_SYS_ADMIN);
369 as->writer = (filp->f_mode & FMODE_WRITE) == FMODE_WRITE;
370 as->reader = (filp->f_mode & FMODE_READ) == FMODE_READ;
371
372 down_write(&user_list_lock);
373 list_add(&as->list, &apm_user_list);
374 up_write(&user_list_lock);
375
376 filp->private_data = as;
377 }
378
379 return as ? 0 : -ENOMEM;
380}
381
382static struct file_operations apm_bios_fops = {
383 .owner = THIS_MODULE,
384 .read = apm_read,
385 .poll = apm_poll,
386 .ioctl = apm_ioctl,
387 .open = apm_open,
388 .release = apm_release,
389};
390
391static struct miscdevice apm_device = {
392 .minor = APM_MINOR_DEV,
393 .name = "apm_bios",
394 .fops = &apm_bios_fops
395};
396
397
398#ifdef CONFIG_PROC_FS
399/*
400 * Arguments, with symbols from linux/apm_bios.h.
401 *
402 * 0) Linux driver version (this will change if format changes)
403 * 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
404 * 2) APM flags from APM Installation Check (0x00):
405 * bit 0: APM_16_BIT_SUPPORT
406 * bit 1: APM_32_BIT_SUPPORT
407 * bit 2: APM_IDLE_SLOWS_CLOCK
408 * bit 3: APM_BIOS_DISABLED
409 * bit 4: APM_BIOS_DISENGAGED
410 * 3) AC line status
411 * 0x00: Off-line
412 * 0x01: On-line
413 * 0x02: On backup power (BIOS >= 1.1 only)
414 * 0xff: Unknown
415 * 4) Battery status
416 * 0x00: High
417 * 0x01: Low
418 * 0x02: Critical
419 * 0x03: Charging
420 * 0x04: Selected battery not present (BIOS >= 1.2 only)
421 * 0xff: Unknown
422 * 5) Battery flag
423 * bit 0: High
424 * bit 1: Low
425 * bit 2: Critical
426 * bit 3: Charging
427 * bit 7: No system battery
428 * 0xff: Unknown
429 * 6) Remaining battery life (percentage of charge):
430 * 0-100: valid
431 * -1: Unknown
432 * 7) Remaining battery life (time units):
433 * Number of remaining minutes or seconds
434 * -1: Unknown
435 * 8) min = minutes; sec = seconds
436 */
437static int apm_get_info(char *buf, char **start, off_t fpos, int length)
438{
439 struct apm_power_info info;
440 char *units;
441 int ret;
442
443 info.ac_line_status = 0xff;
444 info.battery_status = 0xff;
445 info.battery_flag = 0xff;
446 info.battery_life = -1;
447 info.time = -1;
448 info.units = -1;
449
450 if (apm_get_power_status)
451 apm_get_power_status(&info);
452
453 switch (info.units) {
454 default: units = "?"; break;
455 case 0: units = "min"; break;
456 case 1: units = "sec"; break;
457 }
458
459 ret = sprintf(buf, "%s 1.2 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
460 driver_version, APM_32_BIT_SUPPORT,
461 info.ac_line_status, info.battery_status,
462 info.battery_flag, info.battery_life,
463 info.time, units);
464
465 return ret;
466}
467#endif
468
469static int kapmd(void *arg)
470{
471 daemonize("kapmd");
472 current->flags |= PF_NOFREEZE;
473
474 do {
475 apm_event_t event;
476
477 wait_event_interruptible(kapmd_wait,
478 !queue_empty(&kapmd_queue) || !mips_apm_active);
479
480 if (!mips_apm_active)
481 break;
482
483 spin_lock_irq(&kapmd_queue_lock);
484 event = 0;
485 if (!queue_empty(&kapmd_queue))
486 event = queue_get_event(&kapmd_queue);
487 spin_unlock_irq(&kapmd_queue_lock);
488
489 switch (event) {
490 case 0:
491 break;
492
493 case APM_LOW_BATTERY:
494 case APM_POWER_STATUS_CHANGE:
495 queue_event(event, NULL);
496 break;
497
498 case APM_USER_SUSPEND:
499 case APM_SYS_SUSPEND:
500 queue_event(event, NULL);
501 if (suspends_pending == 0)
502 apm_suspend();
503 break;
504
505 case APM_CRITICAL_SUSPEND:
506 apm_suspend();
507 break;
508 }
509 } while (1);
510
511 complete_and_exit(&kapmd_exit, 0);
512}
513
514static int __init apm_init(void)
515{
516 int ret;
517
518 if (apm_disabled) {
519 printk(KERN_NOTICE "apm: disabled on user request.\n");
520 return -ENODEV;
521 }
522
523 mips_apm_active = 1;
524
525 ret = kernel_thread(kapmd, NULL, CLONE_KERNEL);
526 if (ret < 0) {
527 mips_apm_active = 0;
528 return ret;
529 }
530
531#ifdef CONFIG_PROC_FS
532 create_proc_info_entry("apm", 0, NULL, apm_get_info);
533#endif
534
535 ret = misc_register(&apm_device);
536 if (ret != 0) {
537 remove_proc_entry("apm", NULL);
538
539 mips_apm_active = 0;
540 wake_up(&kapmd_wait);
541 wait_for_completion(&kapmd_exit);
542 }
543
544 return ret;
545}
546
547static void __exit apm_exit(void)
548{
549 misc_deregister(&apm_device);
550 remove_proc_entry("apm", NULL);
551
552 mips_apm_active = 0;
553 wake_up(&kapmd_wait);
554 wait_for_completion(&kapmd_exit);
555}
556
557module_init(apm_init);
558module_exit(apm_exit);
559
560MODULE_AUTHOR("Stephen Rothwell");
561MODULE_DESCRIPTION("Advanced Power Management");
562MODULE_LICENSE("GPL");
563
564#ifndef MODULE
565static int __init apm_setup(char *str)
566{
567 while ((str != NULL) && (*str != '\0')) {
568 if (strncmp(str, "off", 3) == 0)
569 apm_disabled = 1;
570 if (strncmp(str, "on", 2) == 0)
571 apm_disabled = 0;
572 str = strchr(str, ',');
573 if (str != NULL)
574 str += strspn(str, ", \t");
575 }
576 return 1;
577}
578
579__setup("apm=", apm_setup);
580#endif
581
582/**
583 * apm_queue_event - queue an APM event for kapmd
584 * @event: APM event
585 *
586 * Queue an APM event for kapmd to process and ultimately take the
587 * appropriate action. Only a subset of events are handled:
588 * %APM_LOW_BATTERY
589 * %APM_POWER_STATUS_CHANGE
590 * %APM_USER_SUSPEND
591 * %APM_SYS_SUSPEND
592 * %APM_CRITICAL_SUSPEND
593 */
594void apm_queue_event(apm_event_t event)
595{
596 unsigned long flags;
597
598 spin_lock_irqsave(&kapmd_queue_lock, flags);
599 queue_add_event(&kapmd_queue, event);
600 spin_unlock_irqrestore(&kapmd_queue_lock, flags);
601
602 wake_up_interruptible(&kapmd_wait);
603}
604EXPORT_SYMBOL(apm_queue_event);
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index ff88b06f89df..ea7df4b8da33 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -234,10 +234,6 @@ void output_mm_defines(void)
234 constant("#define _PMD_SHIFT ", PMD_SHIFT); 234 constant("#define _PMD_SHIFT ", PMD_SHIFT);
235 constant("#define _PGDIR_SHIFT ", PGDIR_SHIFT); 235 constant("#define _PGDIR_SHIFT ", PGDIR_SHIFT);
236 linefeed; 236 linefeed;
237 constant("#define _PGD_ORDER ", PGD_ORDER);
238 constant("#define _PMD_ORDER ", PMD_ORDER);
239 constant("#define _PTE_ORDER ", PTE_ORDER);
240 linefeed;
241 constant("#define _PTRS_PER_PGD ", PTRS_PER_PGD); 237 constant("#define _PTRS_PER_PGD ", PTRS_PER_PGD);
242 constant("#define _PTRS_PER_PMD ", PTRS_PER_PMD); 238 constant("#define _PTRS_PER_PMD ", PTRS_PER_PMD);
243 constant("#define _PTRS_PER_PTE ", PTRS_PER_PTE); 239 constant("#define _PTRS_PER_PTE ", PTRS_PER_PTE);
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 442839e9578c..f59ef271d247 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -565,7 +565,7 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
565 if (config3 & MIPS_CONF3_VEIC) 565 if (config3 & MIPS_CONF3_VEIC)
566 c->options |= MIPS_CPU_VEIC; 566 c->options |= MIPS_CPU_VEIC;
567 if (config3 & MIPS_CONF3_MT) 567 if (config3 & MIPS_CONF3_MT)
568 c->ases |= MIPS_ASE_MIPSMT; 568 c->ases |= MIPS_ASE_MIPSMT;
569 569
570 return config3 & MIPS_CONF_M; 570 return config3 & MIPS_CONF_M;
571} 571}
diff --git a/arch/mips/kernel/gdb-stub.c b/arch/mips/kernel/gdb-stub.c
index 719d26968cb2..7bc882049269 100644
--- a/arch/mips/kernel/gdb-stub.c
+++ b/arch/mips/kernel/gdb-stub.c
@@ -505,13 +505,13 @@ void show_gdbregs(struct gdb_regs * regs)
505 */ 505 */
506 printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", 506 printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
507 regs->reg0, regs->reg1, regs->reg2, regs->reg3, 507 regs->reg0, regs->reg1, regs->reg2, regs->reg3,
508 regs->reg4, regs->reg5, regs->reg6, regs->reg7); 508 regs->reg4, regs->reg5, regs->reg6, regs->reg7);
509 printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", 509 printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
510 regs->reg8, regs->reg9, regs->reg10, regs->reg11, 510 regs->reg8, regs->reg9, regs->reg10, regs->reg11,
511 regs->reg12, regs->reg13, regs->reg14, regs->reg15); 511 regs->reg12, regs->reg13, regs->reg14, regs->reg15);
512 printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", 512 printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
513 regs->reg16, regs->reg17, regs->reg18, regs->reg19, 513 regs->reg16, regs->reg17, regs->reg18, regs->reg19,
514 regs->reg20, regs->reg21, regs->reg22, regs->reg23); 514 regs->reg20, regs->reg21, regs->reg22, regs->reg23);
515 printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", 515 printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
516 regs->reg24, regs->reg25, regs->reg26, regs->reg27, 516 regs->reg24, regs->reg25, regs->reg26, regs->reg27,
517 regs->reg28, regs->reg29, regs->reg30, regs->reg31); 517 regs->reg28, regs->reg29, regs->reg30, regs->reg31);
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 9a7811d13db2..6f57ca44291f 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -231,28 +231,3 @@ NESTED(smp_bootstrap, 16, sp)
231#endif /* CONFIG_SMP */ 231#endif /* CONFIG_SMP */
232 232
233 __FINIT 233 __FINIT
234
235 .comm kernelsp, NR_CPUS * 8, 8
236 .comm pgd_current, NR_CPUS * 8, 8
237
238 .comm fw_arg0, SZREG, SZREG # firmware arguments
239 .comm fw_arg1, SZREG, SZREG
240 .comm fw_arg2, SZREG, SZREG
241 .comm fw_arg3, SZREG, SZREG
242
243 .macro page name, order
244 .comm \name, (_PAGE_SIZE << \order), (_PAGE_SIZE << \order)
245 .endm
246
247 /*
248 * On 64-bit we've got three-level pagetables with a slightly
249 * different layout ...
250 */
251 page swapper_pg_dir, _PGD_ORDER
252#ifdef CONFIG_64BIT
253#if defined(CONFIG_MODULES) && !defined(CONFIG_BUILD_ELF64)
254 page module_pg_dir, _PGD_ORDER
255#endif
256 page invalid_pmd_table, _PMD_ORDER
257#endif
258 page invalid_pte_table, _PTE_ORDER
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index b59a676c6d0e..b33ba6cd7f5b 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -54,9 +54,11 @@ static unsigned int cached_irq_mask = 0xffff;
54 54
55void disable_8259A_irq(unsigned int irq) 55void disable_8259A_irq(unsigned int irq)
56{ 56{
57 unsigned int mask = 1 << irq; 57 unsigned int mask;
58 unsigned long flags; 58 unsigned long flags;
59 59
60 irq -= I8259A_IRQ_BASE;
61 mask = 1 << irq;
60 spin_lock_irqsave(&i8259A_lock, flags); 62 spin_lock_irqsave(&i8259A_lock, flags);
61 cached_irq_mask |= mask; 63 cached_irq_mask |= mask;
62 if (irq & 8) 64 if (irq & 8)
@@ -68,9 +70,11 @@ void disable_8259A_irq(unsigned int irq)
68 70
69void enable_8259A_irq(unsigned int irq) 71void enable_8259A_irq(unsigned int irq)
70{ 72{
71 unsigned int mask = ~(1 << irq); 73 unsigned int mask;
72 unsigned long flags; 74 unsigned long flags;
73 75
76 irq -= I8259A_IRQ_BASE;
77 mask = ~(1 << irq);
74 spin_lock_irqsave(&i8259A_lock, flags); 78 spin_lock_irqsave(&i8259A_lock, flags);
75 cached_irq_mask &= mask; 79 cached_irq_mask &= mask;
76 if (irq & 8) 80 if (irq & 8)
@@ -82,10 +86,12 @@ void enable_8259A_irq(unsigned int irq)
82 86
83int i8259A_irq_pending(unsigned int irq) 87int i8259A_irq_pending(unsigned int irq)
84{ 88{
85 unsigned int mask = 1 << irq; 89 unsigned int mask;
86 unsigned long flags; 90 unsigned long flags;
87 int ret; 91 int ret;
88 92
93 irq -= I8259A_IRQ_BASE;
94 mask = 1 << irq;
89 spin_lock_irqsave(&i8259A_lock, flags); 95 spin_lock_irqsave(&i8259A_lock, flags);
90 if (irq < 8) 96 if (irq < 8)
91 ret = inb(PIC_MASTER_CMD) & mask; 97 ret = inb(PIC_MASTER_CMD) & mask;
@@ -134,9 +140,11 @@ static inline int i8259A_irq_real(unsigned int irq)
134 */ 140 */
135void mask_and_ack_8259A(unsigned int irq) 141void mask_and_ack_8259A(unsigned int irq)
136{ 142{
137 unsigned int irqmask = 1 << irq; 143 unsigned int irqmask;
138 unsigned long flags; 144 unsigned long flags;
139 145
146 irq -= I8259A_IRQ_BASE;
147 irqmask = 1 << irq;
140 spin_lock_irqsave(&i8259A_lock, flags); 148 spin_lock_irqsave(&i8259A_lock, flags);
141 /* 149 /*
142 * Lightweight spurious IRQ detection. We do not want 150 * Lightweight spurious IRQ detection. We do not want
@@ -169,8 +177,8 @@ handle_real_irq:
169 outb(0x60+irq,PIC_MASTER_CMD); /* 'Specific EOI to master */ 177 outb(0x60+irq,PIC_MASTER_CMD); /* 'Specific EOI to master */
170 } 178 }
171#ifdef CONFIG_MIPS_MT_SMTC 179#ifdef CONFIG_MIPS_MT_SMTC
172 if (irq_hwmask[irq] & ST0_IM) 180 if (irq_hwmask[irq] & ST0_IM)
173 set_c0_status(irq_hwmask[irq] & ST0_IM); 181 set_c0_status(irq_hwmask[irq] & ST0_IM);
174#endif /* CONFIG_MIPS_MT_SMTC */ 182#endif /* CONFIG_MIPS_MT_SMTC */
175 spin_unlock_irqrestore(&i8259A_lock, flags); 183 spin_unlock_irqrestore(&i8259A_lock, flags);
176 return; 184 return;
@@ -322,8 +330,8 @@ void __init init_i8259_irqs (void)
322 330
323 init_8259A(0); 331 init_8259A(0);
324 332
325 for (i = 0; i < 16; i++) 333 for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++)
326 set_irq_chip_and_handler(i, &i8259A_chip, handle_level_irq); 334 set_irq_chip_and_handler(i, &i8259A_chip, handle_level_irq);
327 335
328 setup_irq(PIC_CASCADE_IR, &irq2); 336 setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2);
329} 337}
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index 37cad5de515c..3cc25c05d367 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -10,6 +10,8 @@
10 * Copyright (C) 1996 - 2004 David S. Miller <dm@engr.sgi.com> 10 * Copyright (C) 1996 - 2004 David S. Miller <dm@engr.sgi.com>
11 * Copyright (C) 2004 - 2005 Steven J. Hill <sjhill@realitydiluted.com> 11 * Copyright (C) 2004 - 2005 Steven J. Hill <sjhill@realitydiluted.com>
12 */ 12 */
13#undef DEBUG
14
13#include <linux/module.h> 15#include <linux/module.h>
14#include <linux/fs.h> 16#include <linux/fs.h>
15#include <linux/stat.h> 17#include <linux/stat.h>
@@ -40,8 +42,6 @@
40 42
41#include <linux/elf.h> 43#include <linux/elf.h>
42 44
43#undef DEBUG
44
45static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs); 45static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs);
46static int load_irix_library(struct file *); 46static int load_irix_library(struct file *);
47static int irix_core_dump(long signr, struct pt_regs * regs, 47static int irix_core_dump(long signr, struct pt_regs * regs,
@@ -52,72 +52,102 @@ static struct linux_binfmt irix_format = {
52 irix_core_dump, PAGE_SIZE 52 irix_core_dump, PAGE_SIZE
53}; 53};
54 54
55#ifdef DEBUG
56/* Debugging routines. */ 55/* Debugging routines. */
57static char *get_elf_p_type(Elf32_Word p_type) 56static char *get_elf_p_type(Elf32_Word p_type)
58{ 57{
59 int i = (int) p_type; 58#ifdef DEBUG
60 59 switch (p_type) {
61 switch(i) { 60 case PT_NULL:
62 case PT_NULL: return("PT_NULL"); break; 61 return "PT_NULL";
63 case PT_LOAD: return("PT_LOAD"); break; 62 break;
64 case PT_DYNAMIC: return("PT_DYNAMIC"); break; 63
65 case PT_INTERP: return("PT_INTERP"); break; 64 case PT_LOAD:
66 case PT_NOTE: return("PT_NOTE"); break; 65 return "PT_LOAD";
67 case PT_SHLIB: return("PT_SHLIB"); break; 66 break;
68 case PT_PHDR: return("PT_PHDR"); break; 67
69 case PT_LOPROC: return("PT_LOPROC/REGINFO"); break; 68 case PT_DYNAMIC:
70 case PT_HIPROC: return("PT_HIPROC"); break; 69 return "PT_DYNAMIC";
71 default: return("PT_BOGUS"); break; 70 break;
71
72 case PT_INTERP:
73 return "PT_INTERP";
74 break;
75
76 case PT_NOTE:
77 return "PT_NOTE";
78 break;
79
80 case PT_SHLIB:
81 return "PT_SHLIB";
82 break;
83
84 case PT_PHDR:
85 return "PT_PHDR";
86 break;
87
88 case PT_LOPROC:
89 return "PT_LOPROC/REGINFO";
90 break;
91
92 case PT_HIPROC:
93 return "PT_HIPROC";
94 break;
95
96 default:
97 return "PT_BOGUS";
98 break;
72 } 99 }
100#endif
73} 101}
74 102
75static void print_elfhdr(struct elfhdr *ehp) 103static void print_elfhdr(struct elfhdr *ehp)
76{ 104{
77 int i; 105 int i;
78 106
79 printk("ELFHDR: e_ident<"); 107 pr_debug("ELFHDR: e_ident<");
80 for(i = 0; i < (EI_NIDENT - 1); i++) printk("%x ", ehp->e_ident[i]); 108 for (i = 0; i < (EI_NIDENT - 1); i++)
81 printk("%x>\n", ehp->e_ident[i]); 109 pr_debug("%x ", ehp->e_ident[i]);
82 printk(" e_type[%04x] e_machine[%04x] e_version[%08lx]\n", 110 pr_debug("%x>\n", ehp->e_ident[i]);
83 (unsigned short) ehp->e_type, (unsigned short) ehp->e_machine, 111 pr_debug(" e_type[%04x] e_machine[%04x] e_version[%08lx]\n",
84 (unsigned long) ehp->e_version); 112 (unsigned short) ehp->e_type, (unsigned short) ehp->e_machine,
85 printk(" e_entry[%08lx] e_phoff[%08lx] e_shoff[%08lx] " 113 (unsigned long) ehp->e_version);
86 "e_flags[%08lx]\n", 114 pr_debug(" e_entry[%08lx] e_phoff[%08lx] e_shoff[%08lx] "
87 (unsigned long) ehp->e_entry, (unsigned long) ehp->e_phoff, 115 "e_flags[%08lx]\n",
88 (unsigned long) ehp->e_shoff, (unsigned long) ehp->e_flags); 116 (unsigned long) ehp->e_entry, (unsigned long) ehp->e_phoff,
89 printk(" e_ehsize[%04x] e_phentsize[%04x] e_phnum[%04x]\n", 117 (unsigned long) ehp->e_shoff, (unsigned long) ehp->e_flags);
90 (unsigned short) ehp->e_ehsize, (unsigned short) ehp->e_phentsize, 118 pr_debug(" e_ehsize[%04x] e_phentsize[%04x] e_phnum[%04x]\n",
91 (unsigned short) ehp->e_phnum); 119 (unsigned short) ehp->e_ehsize,
92 printk(" e_shentsize[%04x] e_shnum[%04x] e_shstrndx[%04x]\n", 120 (unsigned short) ehp->e_phentsize,
93 (unsigned short) ehp->e_shentsize, (unsigned short) ehp->e_shnum, 121 (unsigned short) ehp->e_phnum);
94 (unsigned short) ehp->e_shstrndx); 122 pr_debug(" e_shentsize[%04x] e_shnum[%04x] e_shstrndx[%04x]\n",
123 (unsigned short) ehp->e_shentsize,
124 (unsigned short) ehp->e_shnum,
125 (unsigned short) ehp->e_shstrndx);
95} 126}
96 127
97static void print_phdr(int i, struct elf_phdr *ep) 128static void print_phdr(int i, struct elf_phdr *ep)
98{ 129{
99 printk("PHDR[%d]: p_type[%s] p_offset[%08lx] p_vaddr[%08lx] " 130 pr_debug("PHDR[%d]: p_type[%s] p_offset[%08lx] p_vaddr[%08lx] "
100 "p_paddr[%08lx]\n", i, get_elf_p_type(ep->p_type), 131 "p_paddr[%08lx]\n", i, get_elf_p_type(ep->p_type),
101 (unsigned long) ep->p_offset, (unsigned long) ep->p_vaddr, 132 (unsigned long) ep->p_offset, (unsigned long) ep->p_vaddr,
102 (unsigned long) ep->p_paddr); 133 (unsigned long) ep->p_paddr);
103 printk(" p_filesz[%08lx] p_memsz[%08lx] p_flags[%08lx] " 134 pr_debug(" p_filesz[%08lx] p_memsz[%08lx] p_flags[%08lx] "
104 "p_align[%08lx]\n", (unsigned long) ep->p_filesz, 135 "p_align[%08lx]\n", (unsigned long) ep->p_filesz,
105 (unsigned long) ep->p_memsz, (unsigned long) ep->p_flags, 136 (unsigned long) ep->p_memsz, (unsigned long) ep->p_flags,
106 (unsigned long) ep->p_align); 137 (unsigned long) ep->p_align);
107} 138}
108 139
109static void dump_phdrs(struct elf_phdr *ep, int pnum) 140static void dump_phdrs(struct elf_phdr *ep, int pnum)
110{ 141{
111 int i; 142 int i;
112 143
113 for(i = 0; i < pnum; i++, ep++) { 144 for (i = 0; i < pnum; i++, ep++) {
114 if((ep->p_type == PT_LOAD) || 145 if ((ep->p_type == PT_LOAD) ||
115 (ep->p_type == PT_INTERP) || 146 (ep->p_type == PT_INTERP) ||
116 (ep->p_type == PT_PHDR)) 147 (ep->p_type == PT_PHDR))
117 print_phdr(i, ep); 148 print_phdr(i, ep);
118 } 149 }
119} 150}
120#endif /* DEBUG */
121 151
122static void set_brk(unsigned long start, unsigned long end) 152static void set_brk(unsigned long start, unsigned long end)
123{ 153{
@@ -156,11 +186,10 @@ static unsigned long * create_irix_tables(char * p, int argc, int envc,
156 elf_addr_t *envp; 186 elf_addr_t *envp;
157 elf_addr_t *sp, *csp; 187 elf_addr_t *sp, *csp;
158 188
159#ifdef DEBUG 189 pr_debug("create_irix_tables: p[%p] argc[%d] envc[%d] "
160 printk("create_irix_tables: p[%p] argc[%d] envc[%d] " 190 "load_addr[%08x] interp_load_addr[%08x]\n",
161 "load_addr[%08x] interp_load_addr[%08x]\n", 191 p, argc, envc, load_addr, interp_load_addr);
162 p, argc, envc, load_addr, interp_load_addr); 192
163#endif
164 sp = (elf_addr_t *) (~15UL & (unsigned long) p); 193 sp = (elf_addr_t *) (~15UL & (unsigned long) p);
165 csp = sp; 194 csp = sp;
166 csp -= exec ? DLINFO_ITEMS*2 : 2; 195 csp -= exec ? DLINFO_ITEMS*2 : 2;
@@ -181,7 +210,7 @@ static unsigned long * create_irix_tables(char * p, int argc, int envc,
181 sp -= 2; 210 sp -= 2;
182 NEW_AUX_ENT(0, AT_NULL, 0); 211 NEW_AUX_ENT(0, AT_NULL, 0);
183 212
184 if(exec) { 213 if (exec) {
185 sp -= 11*2; 214 sp -= 11*2;
186 215
187 NEW_AUX_ENT (0, AT_PHDR, load_addr + exec->e_phoff); 216 NEW_AUX_ENT (0, AT_PHDR, load_addr + exec->e_phoff);
@@ -245,9 +274,7 @@ static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex,
245 last_bss = 0; 274 last_bss = 0;
246 error = load_addr = 0; 275 error = load_addr = 0;
247 276
248#ifdef DEBUG
249 print_elfhdr(interp_elf_ex); 277 print_elfhdr(interp_elf_ex);
250#endif
251 278
252 /* First of all, some simple consistency checks */ 279 /* First of all, some simple consistency checks */
253 if ((interp_elf_ex->e_type != ET_EXEC && 280 if ((interp_elf_ex->e_type != ET_EXEC &&
@@ -258,7 +285,7 @@ static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex,
258 } 285 }
259 286
260 /* Now read in all of the header information */ 287 /* Now read in all of the header information */
261 if(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > PAGE_SIZE) { 288 if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > PAGE_SIZE) {
262 printk("IRIX interp header bigger than a page (%d)\n", 289 printk("IRIX interp header bigger than a page (%d)\n",
263 (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum)); 290 (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum));
264 return 0xffffffff; 291 return 0xffffffff;
@@ -267,15 +294,15 @@ static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex,
267 elf_phdata = kmalloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum, 294 elf_phdata = kmalloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum,
268 GFP_KERNEL); 295 GFP_KERNEL);
269 296
270 if(!elf_phdata) { 297 if (!elf_phdata) {
271 printk("Cannot kmalloc phdata for IRIX interp.\n"); 298 printk("Cannot kmalloc phdata for IRIX interp.\n");
272 return 0xffffffff; 299 return 0xffffffff;
273 } 300 }
274 301
275 /* If the size of this structure has changed, then punt, since 302 /* If the size of this structure has changed, then punt, since
276 * we will be doing the wrong thing. 303 * we will be doing the wrong thing.
277 */ 304 */
278 if(interp_elf_ex->e_phentsize != 32) { 305 if (interp_elf_ex->e_phentsize != 32) {
279 printk("IRIX interp e_phentsize == %d != 32 ", 306 printk("IRIX interp e_phentsize == %d != 32 ",
280 interp_elf_ex->e_phentsize); 307 interp_elf_ex->e_phentsize);
281 kfree(elf_phdata); 308 kfree(elf_phdata);
@@ -286,61 +313,71 @@ static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex,
286 (char *) elf_phdata, 313 (char *) elf_phdata,
287 sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); 314 sizeof(struct elf_phdr) * interp_elf_ex->e_phnum);
288 315
289#ifdef DEBUG
290 dump_phdrs(elf_phdata, interp_elf_ex->e_phnum); 316 dump_phdrs(elf_phdata, interp_elf_ex->e_phnum);
291#endif
292 317
293 eppnt = elf_phdata; 318 eppnt = elf_phdata;
294 for(i=0; i<interp_elf_ex->e_phnum; i++, eppnt++) { 319 for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) {
295 if(eppnt->p_type == PT_LOAD) { 320 if (eppnt->p_type == PT_LOAD) {
296 int elf_type = MAP_PRIVATE | MAP_DENYWRITE; 321 int elf_type = MAP_PRIVATE | MAP_DENYWRITE;
297 int elf_prot = 0; 322 int elf_prot = 0;
298 unsigned long vaddr = 0; 323 unsigned long vaddr = 0;
299 if (eppnt->p_flags & PF_R) elf_prot = PROT_READ; 324 if (eppnt->p_flags & PF_R)
300 if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; 325 elf_prot = PROT_READ;
301 if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC; 326 if (eppnt->p_flags & PF_W)
302 elf_type |= MAP_FIXED; 327 elf_prot |= PROT_WRITE;
303 vaddr = eppnt->p_vaddr; 328 if (eppnt->p_flags & PF_X)
304 329 elf_prot |= PROT_EXEC;
305 pr_debug("INTERP do_mmap(%p, %08lx, %08lx, %08lx, %08lx, %08lx) ", 330 elf_type |= MAP_FIXED;
306 interpreter, vaddr, 331 vaddr = eppnt->p_vaddr;
307 (unsigned long) (eppnt->p_filesz + (eppnt->p_vaddr & 0xfff)), 332
308 (unsigned long) elf_prot, (unsigned long) elf_type, 333 pr_debug("INTERP do_mmap"
309 (unsigned long) (eppnt->p_offset & 0xfffff000)); 334 "(%p, %08lx, %08lx, %08lx, %08lx, %08lx) ",
310 down_write(&current->mm->mmap_sem); 335 interpreter, vaddr,
311 error = do_mmap(interpreter, vaddr, 336 (unsigned long)
312 eppnt->p_filesz + (eppnt->p_vaddr & 0xfff), 337 (eppnt->p_filesz + (eppnt->p_vaddr & 0xfff)),
313 elf_prot, elf_type, 338 (unsigned long)
314 eppnt->p_offset & 0xfffff000); 339 elf_prot, (unsigned long) elf_type,
315 up_write(&current->mm->mmap_sem); 340 (unsigned long)
316 341 (eppnt->p_offset & 0xfffff000));
317 if(error < 0 && error > -1024) { 342
318 printk("Aieee IRIX interp mmap error=%d\n", error); 343 down_write(&current->mm->mmap_sem);
319 break; /* Real error */ 344 error = do_mmap(interpreter, vaddr,
320 } 345 eppnt->p_filesz + (eppnt->p_vaddr & 0xfff),
321 pr_debug("error=%08lx ", (unsigned long) error); 346 elf_prot, elf_type,
322 if(!load_addr && interp_elf_ex->e_type == ET_DYN) { 347 eppnt->p_offset & 0xfffff000);
323 load_addr = error; 348 up_write(&current->mm->mmap_sem);
324 pr_debug("load_addr = error "); 349
325 } 350 if (error < 0 && error > -1024) {
326 351 printk("Aieee IRIX interp mmap error=%d\n",
327 /* Find the end of the file mapping for this phdr, and keep 352 error);
328 * track of the largest address we see for this. 353 break; /* Real error */
329 */ 354 }
330 k = eppnt->p_vaddr + eppnt->p_filesz; 355 pr_debug("error=%08lx ", (unsigned long) error);
331 if(k > elf_bss) elf_bss = k; 356 if (!load_addr && interp_elf_ex->e_type == ET_DYN) {
332 357 load_addr = error;
333 /* Do the same thing for the memory mapping - between 358 pr_debug("load_addr = error ");
334 * elf_bss and last_bss is the bss section. 359 }
335 */ 360
336 k = eppnt->p_memsz + eppnt->p_vaddr; 361 /*
337 if(k > last_bss) last_bss = k; 362 * Find the end of the file mapping for this phdr, and
338 pr_debug("\n"); 363 * keep track of the largest address we see for this.
339 } 364 */
365 k = eppnt->p_vaddr + eppnt->p_filesz;
366 if (k > elf_bss)
367 elf_bss = k;
368
369 /* Do the same thing for the memory mapping - between
370 * elf_bss and last_bss is the bss section.
371 */
372 k = eppnt->p_memsz + eppnt->p_vaddr;
373 if (k > last_bss)
374 last_bss = k;
375 pr_debug("\n");
376 }
340 } 377 }
341 378
342 /* Now use mmap to map the library into memory. */ 379 /* Now use mmap to map the library into memory. */
343 if(error < 0 && error > -1024) { 380 if (error < 0 && error > -1024) {
344 pr_debug("got error %d\n", error); 381 pr_debug("got error %d\n", error);
345 kfree(elf_phdata); 382 kfree(elf_phdata);
346 return 0xffffffff; 383 return 0xffffffff;
@@ -377,7 +414,7 @@ static int verify_binary(struct elfhdr *ehp, struct linux_binprm *bprm)
377 return -ENOEXEC; 414 return -ENOEXEC;
378 415
379 /* First of all, some simple consistency checks */ 416 /* First of all, some simple consistency checks */
380 if((ehp->e_type != ET_EXEC && ehp->e_type != ET_DYN) || 417 if ((ehp->e_type != ET_EXEC && ehp->e_type != ET_DYN) ||
381 !bprm->file->f_op->mmap) { 418 !bprm->file->f_op->mmap) {
382 return -ENOEXEC; 419 return -ENOEXEC;
383 } 420 }
@@ -388,7 +425,7 @@ static int verify_binary(struct elfhdr *ehp, struct linux_binprm *bprm)
388 * XXX all registers as 64bits on cpu's capable of this at 425 * XXX all registers as 64bits on cpu's capable of this at
389 * XXX exception time plus frob the XTLB exception vector. 426 * XXX exception time plus frob the XTLB exception vector.
390 */ 427 */
391 if((ehp->e_flags & EF_MIPS_ABI2)) 428 if ((ehp->e_flags & EF_MIPS_ABI2))
392 return -ENOEXEC; 429 return -ENOEXEC;
393 430
394 return 0; 431 return 0;
@@ -410,7 +447,7 @@ static inline int look_for_irix_interpreter(char **name,
410 struct file *file = NULL; 447 struct file *file = NULL;
411 448
412 *name = NULL; 449 *name = NULL;
413 for(i = 0; i < pnum; i++, epp++) { 450 for (i = 0; i < pnum; i++, epp++) {
414 if (epp->p_type != PT_INTERP) 451 if (epp->p_type != PT_INTERP)
415 continue; 452 continue;
416 453
@@ -467,8 +504,8 @@ static inline void map_executable(struct file *fp, struct elf_phdr *epp, int pnu
467 unsigned int tmp; 504 unsigned int tmp;
468 int i, prot; 505 int i, prot;
469 506
470 for(i = 0; i < pnum; i++, epp++) { 507 for (i = 0; i < pnum; i++, epp++) {
471 if(epp->p_type != PT_LOAD) 508 if (epp->p_type != PT_LOAD)
472 continue; 509 continue;
473 510
474 /* Map it. */ 511 /* Map it. */
@@ -483,23 +520,23 @@ static inline void map_executable(struct file *fp, struct elf_phdr *epp, int pnu
483 up_write(&current->mm->mmap_sem); 520 up_write(&current->mm->mmap_sem);
484 521
485 /* Fixup location tracking vars. */ 522 /* Fixup location tracking vars. */
486 if((epp->p_vaddr & 0xfffff000) < *estack) 523 if ((epp->p_vaddr & 0xfffff000) < *estack)
487 *estack = (epp->p_vaddr & 0xfffff000); 524 *estack = (epp->p_vaddr & 0xfffff000);
488 if(!*laddr) 525 if (!*laddr)
489 *laddr = epp->p_vaddr - epp->p_offset; 526 *laddr = epp->p_vaddr - epp->p_offset;
490 if(epp->p_vaddr < *scode) 527 if (epp->p_vaddr < *scode)
491 *scode = epp->p_vaddr; 528 *scode = epp->p_vaddr;
492 529
493 tmp = epp->p_vaddr + epp->p_filesz; 530 tmp = epp->p_vaddr + epp->p_filesz;
494 if(tmp > *ebss) 531 if (tmp > *ebss)
495 *ebss = tmp; 532 *ebss = tmp;
496 if((epp->p_flags & PF_X) && *ecode < tmp) 533 if ((epp->p_flags & PF_X) && *ecode < tmp)
497 *ecode = tmp; 534 *ecode = tmp;
498 if(*edata < tmp) 535 if (*edata < tmp)
499 *edata = tmp; 536 *edata = tmp;
500 537
501 tmp = epp->p_vaddr + epp->p_memsz; 538 tmp = epp->p_vaddr + epp->p_memsz;
502 if(tmp > *ebrk) 539 if (tmp > *ebrk)
503 *ebrk = tmp; 540 *ebrk = tmp;
504 } 541 }
505 542
@@ -513,12 +550,12 @@ static inline int map_interpreter(struct elf_phdr *epp, struct elfhdr *ihp,
513 int i; 550 int i;
514 551
515 *eentry = 0xffffffff; 552 *eentry = 0xffffffff;
516 for(i = 0; i < pnum; i++, epp++) { 553 for (i = 0; i < pnum; i++, epp++) {
517 if(epp->p_type != PT_INTERP) 554 if (epp->p_type != PT_INTERP)
518 continue; 555 continue;
519 556
520 /* We should have fielded this error elsewhere... */ 557 /* We should have fielded this error elsewhere... */
521 if(*eentry != 0xffffffff) 558 if (*eentry != 0xffffffff)
522 return -1; 559 return -1;
523 560
524 set_fs(old_fs); 561 set_fs(old_fs);
@@ -604,9 +641,7 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
604 if (elf_ex.e_shnum > 20) 641 if (elf_ex.e_shnum > 20)
605 goto out; 642 goto out;
606 643
607#ifdef DEBUG
608 print_elfhdr(&elf_ex); 644 print_elfhdr(&elf_ex);
609#endif
610 645
611 /* Now read in all of the header information */ 646 /* Now read in all of the header information */
612 size = elf_ex.e_phentsize * elf_ex.e_phnum; 647 size = elf_ex.e_phentsize * elf_ex.e_phnum;
@@ -622,13 +657,11 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
622 if (retval < 0) 657 if (retval < 0)
623 goto out_free_ph; 658 goto out_free_ph;
624 659
625#ifdef DEBUG
626 dump_phdrs(elf_phdata, elf_ex.e_phnum); 660 dump_phdrs(elf_phdata, elf_ex.e_phnum);
627#endif
628 661
629 /* Set some things for later. */ 662 /* Set some things for later. */
630 for(i = 0; i < elf_ex.e_phnum; i++) { 663 for (i = 0; i < elf_ex.e_phnum; i++) {
631 switch(elf_phdata[i].p_type) { 664 switch (elf_phdata[i].p_type) {
632 case PT_INTERP: 665 case PT_INTERP:
633 has_interp = 1; 666 has_interp = 1;
634 elf_ihdr = &elf_phdata[i]; 667 elf_ihdr = &elf_phdata[i];
@@ -667,7 +700,7 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
667 700
668 if (elf_interpreter) { 701 if (elf_interpreter) {
669 retval = verify_irix_interpreter(&interp_elf_ex); 702 retval = verify_irix_interpreter(&interp_elf_ex);
670 if(retval) 703 if (retval)
671 goto out_free_interp; 704 goto out_free_interp;
672 } 705 }
673 706
@@ -706,12 +739,12 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
706 &load_addr, &start_code, &elf_bss, &end_code, 739 &load_addr, &start_code, &elf_bss, &end_code,
707 &end_data, &elf_brk); 740 &end_data, &elf_brk);
708 741
709 if(elf_interpreter) { 742 if (elf_interpreter) {
710 retval = map_interpreter(elf_phdata, &interp_elf_ex, 743 retval = map_interpreter(elf_phdata, &interp_elf_ex,
711 interpreter, &interp_load_addr, 744 interpreter, &interp_load_addr,
712 elf_ex.e_phnum, old_fs, &elf_entry); 745 elf_ex.e_phnum, old_fs, &elf_entry);
713 kfree(elf_interpreter); 746 kfree(elf_interpreter);
714 if(retval) { 747 if (retval) {
715 set_fs(old_fs); 748 set_fs(old_fs);
716 printk("Unable to load IRIX ELF interpreter\n"); 749 printk("Unable to load IRIX ELF interpreter\n");
717 send_sig(SIGSEGV, current, 0); 750 send_sig(SIGSEGV, current, 0);
@@ -809,12 +842,12 @@ static int load_irix_library(struct file *file)
809 return -ENOEXEC; 842 return -ENOEXEC;
810 843
811 /* First of all, some simple consistency checks. */ 844 /* First of all, some simple consistency checks. */
812 if(elf_ex.e_type != ET_EXEC || elf_ex.e_phnum > 2 || 845 if (elf_ex.e_type != ET_EXEC || elf_ex.e_phnum > 2 ||
813 !file->f_op->mmap) 846 !file->f_op->mmap)
814 return -ENOEXEC; 847 return -ENOEXEC;
815 848
816 /* Now read in all of the header information. */ 849 /* Now read in all of the header information. */
817 if(sizeof(struct elf_phdr) * elf_ex.e_phnum > PAGE_SIZE) 850 if (sizeof(struct elf_phdr) * elf_ex.e_phnum > PAGE_SIZE)
818 return -ENOEXEC; 851 return -ENOEXEC;
819 852
820 elf_phdata = kmalloc(sizeof(struct elf_phdr) * elf_ex.e_phnum, GFP_KERNEL); 853 elf_phdata = kmalloc(sizeof(struct elf_phdr) * elf_ex.e_phnum, GFP_KERNEL);
@@ -825,15 +858,15 @@ static int load_irix_library(struct file *file)
825 sizeof(struct elf_phdr) * elf_ex.e_phnum); 858 sizeof(struct elf_phdr) * elf_ex.e_phnum);
826 859
827 j = 0; 860 j = 0;
828 for(i=0; i<elf_ex.e_phnum; i++) 861 for (i=0; i<elf_ex.e_phnum; i++)
829 if((elf_phdata + i)->p_type == PT_LOAD) j++; 862 if ((elf_phdata + i)->p_type == PT_LOAD) j++;
830 863
831 if(j != 1) { 864 if (j != 1) {
832 kfree(elf_phdata); 865 kfree(elf_phdata);
833 return -ENOEXEC; 866 return -ENOEXEC;
834 } 867 }
835 868
836 while(elf_phdata->p_type != PT_LOAD) elf_phdata++; 869 while (elf_phdata->p_type != PT_LOAD) elf_phdata++;
837 870
838 /* Now use mmap to map the library into memory. */ 871 /* Now use mmap to map the library into memory. */
839 down_write(&current->mm->mmap_sem); 872 down_write(&current->mm->mmap_sem);
@@ -889,9 +922,7 @@ unsigned long irix_mapelf(int fd, struct elf_phdr __user *user_phdrp, int cnt)
889 return -EFAULT; 922 return -EFAULT;
890 } 923 }
891 924
892#ifdef DEBUG
893 dump_phdrs(user_phdrp, cnt); 925 dump_phdrs(user_phdrp, cnt);
894#endif
895 926
896 for (i = 0; i < cnt; i++, hp++) { 927 for (i = 0; i < cnt; i++, hp++) {
897 if (__get_user(type, &hp->p_type)) 928 if (__get_user(type, &hp->p_type))
@@ -905,14 +936,14 @@ unsigned long irix_mapelf(int fd, struct elf_phdr __user *user_phdrp, int cnt)
905 filp = fget(fd); 936 filp = fget(fd);
906 if (!filp) 937 if (!filp)
907 return -EACCES; 938 return -EACCES;
908 if(!filp->f_op) { 939 if (!filp->f_op) {
909 printk("irix_mapelf: Bogon filp!\n"); 940 printk("irix_mapelf: Bogon filp!\n");
910 fput(filp); 941 fput(filp);
911 return -EACCES; 942 return -EACCES;
912 } 943 }
913 944
914 hp = user_phdrp; 945 hp = user_phdrp;
915 for(i = 0; i < cnt; i++, hp++) { 946 for (i = 0; i < cnt; i++, hp++) {
916 int prot; 947 int prot;
917 948
918 retval = __get_user(vaddr, &hp->p_vaddr); 949 retval = __get_user(vaddr, &hp->p_vaddr);
@@ -1015,8 +1046,6 @@ static int notesize(struct memelfnote *en)
1015 return sz; 1046 return sz;
1016} 1047}
1017 1048
1018/* #define DEBUG */
1019
1020#define DUMP_WRITE(addr, nr) \ 1049#define DUMP_WRITE(addr, nr) \
1021 if (!dump_write(file, (addr), (nr))) \ 1050 if (!dump_write(file, (addr), (nr))) \
1022 goto end_coredump; 1051 goto end_coredump;
@@ -1093,9 +1122,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
1093 1122
1094 segs++; 1123 segs++;
1095 } 1124 }
1096#ifdef DEBUG 1125 pr_debug("irix_core_dump: %d segs taking %d bytes\n", segs, size);
1097 printk("irix_core_dump: %d segs taking %d bytes\n", segs, size);
1098#endif
1099 1126
1100 /* Set up header. */ 1127 /* Set up header. */
1101 memcpy(elf.e_ident, ELFMAG, SELFMAG); 1128 memcpy(elf.e_ident, ELFMAG, SELFMAG);
@@ -1221,7 +1248,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
1221 struct elf_phdr phdr; 1248 struct elf_phdr phdr;
1222 int sz = 0; 1249 int sz = 0;
1223 1250
1224 for(i = 0; i < numnote; i++) 1251 for (i = 0; i < numnote; i++)
1225 sz += notesize(&notes[i]); 1252 sz += notesize(&notes[i]);
1226 1253
1227 phdr.p_type = PT_NOTE; 1254 phdr.p_type = PT_NOTE;
@@ -1241,7 +1268,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
1241 dataoff = offset = roundup(offset, PAGE_SIZE); 1268 dataoff = offset = roundup(offset, PAGE_SIZE);
1242 1269
1243 /* Write program headers for segments dump. */ 1270 /* Write program headers for segments dump. */
1244 for(vma = current->mm->mmap, i = 0; 1271 for (vma = current->mm->mmap, i = 0;
1245 i < segs && vma != NULL; vma = vma->vm_next) { 1272 i < segs && vma != NULL; vma = vma->vm_next) {
1246 struct elf_phdr phdr; 1273 struct elf_phdr phdr;
1247 size_t sz; 1274 size_t sz;
@@ -1267,7 +1294,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
1267 DUMP_WRITE(&phdr, sizeof(phdr)); 1294 DUMP_WRITE(&phdr, sizeof(phdr));
1268 } 1295 }
1269 1296
1270 for(i = 0; i < numnote; i++) 1297 for (i = 0; i < numnote; i++)
1271 if (!writenote(&notes[i], file)) 1298 if (!writenote(&notes[i], file))
1272 goto end_coredump; 1299 goto end_coredump;
1273 1300
@@ -1275,7 +1302,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
1275 1302
1276 DUMP_SEEK(dataoff); 1303 DUMP_SEEK(dataoff);
1277 1304
1278 for(i = 0, vma = current->mm->mmap; 1305 for (i = 0, vma = current->mm->mmap;
1279 i < segs && vma != NULL; 1306 i < segs && vma != NULL;
1280 vma = vma->vm_next) { 1307 vma = vma->vm_next) {
1281 unsigned long addr = vma->vm_start; 1308 unsigned long addr = vma->vm_start;
@@ -1284,9 +1311,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
1284 if (!maydump(vma)) 1311 if (!maydump(vma))
1285 continue; 1312 continue;
1286 i++; 1313 i++;
1287#ifdef DEBUG 1314 pr_debug("elf_core_dump: writing %08lx %lx\n", addr, len);
1288 printk("elf_core_dump: writing %08lx %lx\n", addr, len);
1289#endif
1290 DUMP_WRITE((void __user *)addr, len); 1315 DUMP_WRITE((void __user *)addr, len);
1291 } 1316 }
1292 1317
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
index bcaad6696082..2967537221e2 100644
--- a/arch/mips/kernel/irq-msc01.c
+++ b/arch/mips/kernel/irq-msc01.c
@@ -112,7 +112,7 @@ msc_bind_eic_interrupt (unsigned int irq, unsigned int set)
112} 112}
113 113
114struct irq_chip msc_levelirq_type = { 114struct irq_chip msc_levelirq_type = {
115 .typename = "SOC-it-Level", 115 .name = "SOC-it-Level",
116 .ack = level_mask_and_ack_msc_irq, 116 .ack = level_mask_and_ack_msc_irq,
117 .mask = mask_msc_irq, 117 .mask = mask_msc_irq,
118 .mask_ack = level_mask_and_ack_msc_irq, 118 .mask_ack = level_mask_and_ack_msc_irq,
@@ -122,7 +122,7 @@ struct irq_chip msc_levelirq_type = {
122}; 122};
123 123
124struct irq_chip msc_edgeirq_type = { 124struct irq_chip msc_edgeirq_type = {
125 .typename = "SOC-it-Edge", 125 .name = "SOC-it-Edge",
126 .ack = edge_mask_and_ack_msc_irq, 126 .ack = edge_mask_and_ack_msc_irq,
127 .mask = mask_msc_irq, 127 .mask = mask_msc_irq,
128 .mask_ack = edge_mask_and_ack_msc_irq, 128 .mask_ack = edge_mask_and_ack_msc_irq,
diff --git a/arch/mips/kernel/irq-mv6434x.c b/arch/mips/kernel/irq-mv6434x.c
index efbd219845b5..3dd561832e4c 100644
--- a/arch/mips/kernel/irq-mv6434x.c
+++ b/arch/mips/kernel/irq-mv6434x.c
@@ -23,13 +23,13 @@ static unsigned int irq_base;
23 23
24static inline int ls1bit32(unsigned int x) 24static inline int ls1bit32(unsigned int x)
25{ 25{
26 int b = 31, s; 26 int b = 31, s;
27 27
28 s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s; 28 s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s;
29 s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s; 29 s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s;
30 s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s; 30 s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s;
31 s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s; 31 s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s;
32 s = 1; if (x << 1 == 0) s = 0; b -= s; 32 s = 1; if (x << 1 == 0) s = 0; b -= s;
33 33
34 return b; 34 return b;
35} 35}
@@ -92,7 +92,7 @@ void ll_mv64340_irq(void)
92} 92}
93 93
94struct irq_chip mv64340_irq_type = { 94struct irq_chip mv64340_irq_type = {
95 .typename = "MV-64340", 95 .name = "MV-64340",
96 .ack = mask_mv64340_irq, 96 .ack = mask_mv64340_irq,
97 .mask = mask_mv64340_irq, 97 .mask = mask_mv64340_irq,
98 .mask_ack = mask_mv64340_irq, 98 .mask_ack = mask_mv64340_irq,
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index 123324ba8c14..250732883488 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -17,28 +17,27 @@
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/system.h> 18#include <asm/system.h>
19 19
20static int irq_base;
21
22static inline void unmask_rm7k_irq(unsigned int irq) 20static inline void unmask_rm7k_irq(unsigned int irq)
23{ 21{
24 set_c0_intcontrol(0x100 << (irq - irq_base)); 22 set_c0_intcontrol(0x100 << (irq - RM7K_CPU_IRQ_BASE));
25} 23}
26 24
27static inline void mask_rm7k_irq(unsigned int irq) 25static inline void mask_rm7k_irq(unsigned int irq)
28{ 26{
29 clear_c0_intcontrol(0x100 << (irq - irq_base)); 27 clear_c0_intcontrol(0x100 << (irq - RM7K_CPU_IRQ_BASE));
30} 28}
31 29
32static struct irq_chip rm7k_irq_controller = { 30static struct irq_chip rm7k_irq_controller = {
33 .typename = "RM7000", 31 .name = "RM7000",
34 .ack = mask_rm7k_irq, 32 .ack = mask_rm7k_irq,
35 .mask = mask_rm7k_irq, 33 .mask = mask_rm7k_irq,
36 .mask_ack = mask_rm7k_irq, 34 .mask_ack = mask_rm7k_irq,
37 .unmask = unmask_rm7k_irq, 35 .unmask = unmask_rm7k_irq,
38}; 36};
39 37
40void __init rm7k_cpu_irq_init(int base) 38void __init rm7k_cpu_irq_init(void)
41{ 39{
40 int base = RM7K_CPU_IRQ_BASE;
42 int i; 41 int i;
43 42
44 clear_c0_intcontrol(0x00000f00); /* Mask all */ 43 clear_c0_intcontrol(0x00000f00); /* Mask all */
@@ -46,6 +45,4 @@ void __init rm7k_cpu_irq_init(int base)
46 for (i = base; i < base + 4; i++) 45 for (i = base; i < base + 4; i++)
47 set_irq_chip_and_handler(i, &rm7k_irq_controller, 46 set_irq_chip_and_handler(i, &rm7k_irq_controller,
48 handle_level_irq); 47 handle_level_irq);
49
50 irq_base = base;
51} 48}
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index 0e6f4c5349d2..ae83d2df6f31 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -18,16 +18,14 @@
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/system.h> 19#include <asm/system.h>
20 20
21static int irq_base;
22
23static inline void unmask_rm9k_irq(unsigned int irq) 21static inline void unmask_rm9k_irq(unsigned int irq)
24{ 22{
25 set_c0_intcontrol(0x1000 << (irq - irq_base)); 23 set_c0_intcontrol(0x1000 << (irq - RM9K_CPU_IRQ_BASE));
26} 24}
27 25
28static inline void mask_rm9k_irq(unsigned int irq) 26static inline void mask_rm9k_irq(unsigned int irq)
29{ 27{
30 clear_c0_intcontrol(0x1000 << (irq - irq_base)); 28 clear_c0_intcontrol(0x1000 << (irq - RM9K_CPU_IRQ_BASE));
31} 29}
32 30
33static inline void rm9k_cpu_irq_enable(unsigned int irq) 31static inline void rm9k_cpu_irq_enable(unsigned int irq)
@@ -39,15 +37,6 @@ static inline void rm9k_cpu_irq_enable(unsigned int irq)
39 local_irq_restore(flags); 37 local_irq_restore(flags);
40} 38}
41 39
42static void rm9k_cpu_irq_disable(unsigned int irq)
43{
44 unsigned long flags;
45
46 local_irq_save(flags);
47 mask_rm9k_irq(irq);
48 local_irq_restore(flags);
49}
50
51/* 40/*
52 * Performance counter interrupts are global on all processors. 41 * Performance counter interrupts are global on all processors.
53 */ 42 */
@@ -81,7 +70,7 @@ static void rm9k_perfcounter_irq_shutdown(unsigned int irq)
81} 70}
82 71
83static struct irq_chip rm9k_irq_controller = { 72static struct irq_chip rm9k_irq_controller = {
84 .typename = "RM9000", 73 .name = "RM9000",
85 .ack = mask_rm9k_irq, 74 .ack = mask_rm9k_irq,
86 .mask = mask_rm9k_irq, 75 .mask = mask_rm9k_irq,
87 .mask_ack = mask_rm9k_irq, 76 .mask_ack = mask_rm9k_irq,
@@ -89,7 +78,7 @@ static struct irq_chip rm9k_irq_controller = {
89}; 78};
90 79
91static struct irq_chip rm9k_perfcounter_irq = { 80static struct irq_chip rm9k_perfcounter_irq = {
92 .typename = "RM9000", 81 .name = "RM9000",
93 .startup = rm9k_perfcounter_irq_startup, 82 .startup = rm9k_perfcounter_irq_startup,
94 .shutdown = rm9k_perfcounter_irq_shutdown, 83 .shutdown = rm9k_perfcounter_irq_shutdown,
95 .ack = mask_rm9k_irq, 84 .ack = mask_rm9k_irq,
@@ -102,8 +91,9 @@ unsigned int rm9000_perfcount_irq;
102 91
103EXPORT_SYMBOL(rm9000_perfcount_irq); 92EXPORT_SYMBOL(rm9000_perfcount_irq);
104 93
105void __init rm9k_cpu_irq_init(int base) 94void __init rm9k_cpu_irq_init(void)
106{ 95{
96 int base = RM9K_CPU_IRQ_BASE;
107 int i; 97 int i;
108 98
109 clear_c0_intcontrol(0x0000f000); /* Mask all */ 99 clear_c0_intcontrol(0x0000f000); /* Mask all */
@@ -115,6 +105,4 @@ void __init rm9k_cpu_irq_init(int base)
115 rm9000_perfcount_irq = base + 1; 105 rm9000_perfcount_irq = base + 1;
116 set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq, 106 set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq,
117 handle_level_irq); 107 handle_level_irq);
118
119 irq_base = base;
120} 108}
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index fcc86b96ccf6..7b66e03b5899 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -25,7 +25,7 @@
25 * Don't even think about using this on SMP. You have been warned. 25 * Don't even think about using this on SMP. You have been warned.
26 * 26 *
27 * This file exports one global function: 27 * This file exports one global function:
28 * void mips_cpu_irq_init(int irq_base); 28 * void mips_cpu_irq_init(void);
29 */ 29 */
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
@@ -36,22 +36,20 @@
36#include <asm/mipsmtregs.h> 36#include <asm/mipsmtregs.h>
37#include <asm/system.h> 37#include <asm/system.h>
38 38
39static int mips_cpu_irq_base;
40
41static inline void unmask_mips_irq(unsigned int irq) 39static inline void unmask_mips_irq(unsigned int irq)
42{ 40{
43 set_c0_status(0x100 << (irq - mips_cpu_irq_base)); 41 set_c0_status(0x100 << (irq - MIPS_CPU_IRQ_BASE));
44 irq_enable_hazard(); 42 irq_enable_hazard();
45} 43}
46 44
47static inline void mask_mips_irq(unsigned int irq) 45static inline void mask_mips_irq(unsigned int irq)
48{ 46{
49 clear_c0_status(0x100 << (irq - mips_cpu_irq_base)); 47 clear_c0_status(0x100 << (irq - MIPS_CPU_IRQ_BASE));
50 irq_disable_hazard(); 48 irq_disable_hazard();
51} 49}
52 50
53static struct irq_chip mips_cpu_irq_controller = { 51static struct irq_chip mips_cpu_irq_controller = {
54 .typename = "MIPS", 52 .name = "MIPS",
55 .ack = mask_mips_irq, 53 .ack = mask_mips_irq,
56 .mask = mask_mips_irq, 54 .mask = mask_mips_irq,
57 .mask_ack = mask_mips_irq, 55 .mask_ack = mask_mips_irq,
@@ -70,7 +68,7 @@ static unsigned int mips_mt_cpu_irq_startup(unsigned int irq)
70{ 68{
71 unsigned int vpflags = dvpe(); 69 unsigned int vpflags = dvpe();
72 70
73 clear_c0_cause(0x100 << (irq - mips_cpu_irq_base)); 71 clear_c0_cause(0x100 << (irq - MIPS_CPU_IRQ_BASE));
74 evpe(vpflags); 72 evpe(vpflags);
75 unmask_mips_mt_irq(irq); 73 unmask_mips_mt_irq(irq);
76 74
@@ -84,13 +82,13 @@ static unsigned int mips_mt_cpu_irq_startup(unsigned int irq)
84static void mips_mt_cpu_irq_ack(unsigned int irq) 82static void mips_mt_cpu_irq_ack(unsigned int irq)
85{ 83{
86 unsigned int vpflags = dvpe(); 84 unsigned int vpflags = dvpe();
87 clear_c0_cause(0x100 << (irq - mips_cpu_irq_base)); 85 clear_c0_cause(0x100 << (irq - MIPS_CPU_IRQ_BASE));
88 evpe(vpflags); 86 evpe(vpflags);
89 mask_mips_mt_irq(irq); 87 mask_mips_mt_irq(irq);
90} 88}
91 89
92static struct irq_chip mips_mt_cpu_irq_controller = { 90static struct irq_chip mips_mt_cpu_irq_controller = {
93 .typename = "MIPS", 91 .name = "MIPS",
94 .startup = mips_mt_cpu_irq_startup, 92 .startup = mips_mt_cpu_irq_startup,
95 .ack = mips_mt_cpu_irq_ack, 93 .ack = mips_mt_cpu_irq_ack,
96 .mask = mask_mips_mt_irq, 94 .mask = mask_mips_mt_irq,
@@ -99,8 +97,9 @@ static struct irq_chip mips_mt_cpu_irq_controller = {
99 .eoi = unmask_mips_mt_irq, 97 .eoi = unmask_mips_mt_irq,
100}; 98};
101 99
102void __init mips_cpu_irq_init(int irq_base) 100void __init mips_cpu_irq_init(void)
103{ 101{
102 int irq_base = MIPS_CPU_IRQ_BASE;
104 int i; 103 int i;
105 104
106 /* Mask interrupts. */ 105 /* Mask interrupts. */
@@ -118,6 +117,4 @@ void __init mips_cpu_irq_init(int irq_base)
118 for (i = irq_base + 2; i < irq_base + 8; i++) 117 for (i = irq_base + 2; i < irq_base + 8; i++)
119 set_irq_chip_and_handler(i, &mips_cpu_irq_controller, 118 set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
120 handle_level_irq); 119 handle_level_irq);
121
122 mips_cpu_irq_base = irq_base;
123} 120}
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index de3fae260ff8..0b8ce59429a8 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -194,15 +194,15 @@ sysn32_waitid(int which, compat_pid_t pid,
194} 194}
195 195
196struct sysinfo32 { 196struct sysinfo32 {
197 s32 uptime; 197 s32 uptime;
198 u32 loads[3]; 198 u32 loads[3];
199 u32 totalram; 199 u32 totalram;
200 u32 freeram; 200 u32 freeram;
201 u32 sharedram; 201 u32 sharedram;
202 u32 bufferram; 202 u32 bufferram;
203 u32 totalswap; 203 u32 totalswap;
204 u32 freeswap; 204 u32 freeswap;
205 u16 procs; 205 u16 procs;
206 u32 totalhigh; 206 u32 totalhigh;
207 u32 freehigh; 207 u32 freehigh;
208 u32 mem_unit; 208 u32 mem_unit;
@@ -558,7 +558,7 @@ extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf);
558asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32) 558asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32)
559{ 559{
560 int err; 560 int err;
561 struct ustat tmp; 561 struct ustat tmp;
562 struct ustat32 tmp32; 562 struct ustat32 tmp32;
563 mm_segment_t old_fs = get_fs(); 563 mm_segment_t old_fs = get_fs();
564 564
@@ -569,11 +569,11 @@ asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32)
569 if (err) 569 if (err)
570 goto out; 570 goto out;
571 571
572 memset(&tmp32,0,sizeof(struct ustat32)); 572 memset(&tmp32,0,sizeof(struct ustat32));
573 tmp32.f_tfree = tmp.f_tfree; 573 tmp32.f_tfree = tmp.f_tfree;
574 tmp32.f_tinode = tmp.f_tinode; 574 tmp32.f_tinode = tmp.f_tinode;
575 575
576 err = copy_to_user(ubuf32,&tmp32,sizeof(struct ustat32)) ? -EFAULT : 0; 576 err = copy_to_user(ubuf32,&tmp32,sizeof(struct ustat32)) ? -EFAULT : 0;
577 577
578out: 578out:
579 return err; 579 return err;
diff --git a/arch/mips/kernel/mips-mt.c b/arch/mips/kernel/mips-mt.c
index c1373a6e668b..a32f6797353a 100644
--- a/arch/mips/kernel/mips-mt.c
+++ b/arch/mips/kernel/mips-mt.c
@@ -96,6 +96,10 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
96 goto out_unlock; 96 goto out_unlock;
97 } 97 }
98 98
99 retval = security_task_setscheduler(p, 0, NULL);
100 if (retval)
101 goto out_unlock;
102
99 /* Record new user-specified CPU set for future reference */ 103 /* Record new user-specified CPU set for future reference */
100 p->thread.user_cpus_allowed = new_mask; 104 p->thread.user_cpus_allowed = new_mask;
101 105
@@ -141,8 +145,9 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
141 p = find_process_by_pid(pid); 145 p = find_process_by_pid(pid);
142 if (!p) 146 if (!p)
143 goto out_unlock; 147 goto out_unlock;
144 148 retval = security_task_getscheduler(p);
145 retval = 0; 149 if (retval)
150 goto out_unlock;
146 151
147 cpus_and(mask, p->thread.user_cpus_allowed, cpu_possible_map); 152 cpus_and(mask, p->thread.user_cpus_allowed, cpu_possible_map);
148 153
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 4ed37ba19731..5ddc2e9deecf 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -31,13 +31,13 @@ static const char *cpu_name[] = {
31 [CPU_R4000PC] = "R4000PC", 31 [CPU_R4000PC] = "R4000PC",
32 [CPU_R4000SC] = "R4000SC", 32 [CPU_R4000SC] = "R4000SC",
33 [CPU_R4000MC] = "R4000MC", 33 [CPU_R4000MC] = "R4000MC",
34 [CPU_R4200] = "R4200", 34 [CPU_R4200] = "R4200",
35 [CPU_R4400PC] = "R4400PC", 35 [CPU_R4400PC] = "R4400PC",
36 [CPU_R4400SC] = "R4400SC", 36 [CPU_R4400SC] = "R4400SC",
37 [CPU_R4400MC] = "R4400MC", 37 [CPU_R4400MC] = "R4400MC",
38 [CPU_R4600] = "R4600", 38 [CPU_R4600] = "R4600",
39 [CPU_R6000] = "R6000", 39 [CPU_R6000] = "R6000",
40 [CPU_R6000A] = "R6000A", 40 [CPU_R6000A] = "R6000A",
41 [CPU_R8000] = "R8000", 41 [CPU_R8000] = "R8000",
42 [CPU_R10000] = "R10000", 42 [CPU_R10000] = "R10000",
43 [CPU_R12000] = "R12000", 43 [CPU_R12000] = "R12000",
@@ -46,14 +46,14 @@ static const char *cpu_name[] = {
46 [CPU_R4650] = "R4650", 46 [CPU_R4650] = "R4650",
47 [CPU_R4700] = "R4700", 47 [CPU_R4700] = "R4700",
48 [CPU_R5000] = "R5000", 48 [CPU_R5000] = "R5000",
49 [CPU_R5000A] = "R5000A", 49 [CPU_R5000A] = "R5000A",
50 [CPU_R4640] = "R4640", 50 [CPU_R4640] = "R4640",
51 [CPU_NEVADA] = "Nevada", 51 [CPU_NEVADA] = "Nevada",
52 [CPU_RM7000] = "RM7000", 52 [CPU_RM7000] = "RM7000",
53 [CPU_RM9000] = "RM9000", 53 [CPU_RM9000] = "RM9000",
54 [CPU_R5432] = "R5432", 54 [CPU_R5432] = "R5432",
55 [CPU_4KC] = "MIPS 4Kc", 55 [CPU_4KC] = "MIPS 4Kc",
56 [CPU_5KC] = "MIPS 5Kc", 56 [CPU_5KC] = "MIPS 5Kc",
57 [CPU_R4310] = "R4310", 57 [CPU_R4310] = "R4310",
58 [CPU_SB1] = "SiByte SB1", 58 [CPU_SB1] = "SiByte SB1",
59 [CPU_SB1A] = "SiByte SB1A", 59 [CPU_SB1A] = "SiByte SB1A",
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index ec8209f3a0c6..04e5b38d327d 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -41,10 +41,6 @@
41#include <asm/isadep.h> 41#include <asm/isadep.h>
42#include <asm/inst.h> 42#include <asm/inst.h>
43#include <asm/stacktrace.h> 43#include <asm/stacktrace.h>
44#ifdef CONFIG_MIPS_MT_SMTC
45#include <asm/mipsmtregs.h>
46extern void smtc_idle_loop_hook(void);
47#endif /* CONFIG_MIPS_MT_SMTC */
48 44
49/* 45/*
50 * The idle thread. There's no useful work to be done, so just try to conserve 46 * The idle thread. There's no useful work to be done, so just try to conserve
@@ -57,6 +53,8 @@ ATTRIB_NORET void cpu_idle(void)
57 while (1) { 53 while (1) {
58 while (!need_resched()) { 54 while (!need_resched()) {
59#ifdef CONFIG_MIPS_MT_SMTC 55#ifdef CONFIG_MIPS_MT_SMTC
56 extern void smtc_idle_loop_hook(void);
57
60 smtc_idle_loop_hook(); 58 smtc_idle_loop_hook();
61#endif /* CONFIG_MIPS_MT_SMTC */ 59#endif /* CONFIG_MIPS_MT_SMTC */
62 if (cpu_wait) 60 if (cpu_wait)
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index 880fa6e841ee..59c1577ecbb3 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -114,6 +114,14 @@ LEAF(_save_fp_context32)
114 */ 114 */
115LEAF(_restore_fp_context) 115LEAF(_restore_fp_context)
116 EX lw t0, SC_FPC_CSR(a0) 116 EX lw t0, SC_FPC_CSR(a0)
117
118 /* Fail if the CSR has exceptions pending */
119 srl t1, t0, 5
120 and t1, t0
121 andi t1, 0x1f << 7
122 bnez t1, fault
123 nop
124
117#ifdef CONFIG_64BIT 125#ifdef CONFIG_64BIT
118 EX ldc1 $f1, SC_FPREGS+8(a0) 126 EX ldc1 $f1, SC_FPREGS+8(a0)
119 EX ldc1 $f3, SC_FPREGS+24(a0) 127 EX ldc1 $f3, SC_FPREGS+24(a0)
@@ -157,6 +165,14 @@ LEAF(_restore_fp_context)
157LEAF(_restore_fp_context32) 165LEAF(_restore_fp_context32)
158 /* Restore an o32 sigcontext. */ 166 /* Restore an o32 sigcontext. */
159 EX lw t0, SC32_FPC_CSR(a0) 167 EX lw t0, SC32_FPC_CSR(a0)
168
169 /* Fail if the CSR has exceptions pending */
170 srl t1, t0, 5
171 and t1, t0
172 andi t1, 0x1f << 7
173 bnez t1, fault
174 nop
175
160 EX ldc1 $f0, SC32_FPREGS+0(a0) 176 EX ldc1 $f0, SC32_FPREGS+0(a0)
161 EX ldc1 $f2, SC32_FPREGS+16(a0) 177 EX ldc1 $f2, SC32_FPREGS+16(a0)
162 EX ldc1 $f4, SC32_FPREGS+32(a0) 178 EX ldc1 $f4, SC32_FPREGS+32(a0)
@@ -177,9 +193,10 @@ LEAF(_restore_fp_context32)
177 jr ra 193 jr ra
178 li v0, 0 # success 194 li v0, 0 # success
179 END(_restore_fp_context32) 195 END(_restore_fp_context32)
180 .set reorder
181#endif 196#endif
182 197
198 .set reorder
199
183 .type fault@function 200 .type fault@function
184 .ent fault 201 .ent fault
185fault: li v0, -EFAULT # failure 202fault: li v0, -EFAULT # failure
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 5a99e3e0c96d..8610f4a925e9 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -63,7 +63,7 @@ extern void *vpe_get_shared(int index);
63 63
64static void rtlx_dispatch(void) 64static void rtlx_dispatch(void)
65{ 65{
66 do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ); 66 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ);
67} 67}
68 68
69 69
@@ -491,7 +491,7 @@ static struct irqaction rtlx_irq = {
491 .name = "RTLX", 491 .name = "RTLX",
492}; 492};
493 493
494static int rtlx_irq_num = MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ; 494static int rtlx_irq_num = MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ;
495 495
496static char register_chrdev_failed[] __initdata = 496static char register_chrdev_failed[] __initdata =
497 KERN_ERR "rtlx_module_init: unable to register device\n"; 497 KERN_ERR "rtlx_module_init: unable to register device\n";
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index a7bff2a54723..39add2341aa2 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -384,7 +384,7 @@ EXPORT(sysn32_call_table)
384 PTR sys_readlinkat 384 PTR sys_readlinkat
385 PTR sys_fchmodat 385 PTR sys_fchmodat
386 PTR sys_faccessat 386 PTR sys_faccessat
387 PTR sys_pselect6 387 PTR compat_sys_pselect6
388 PTR sys_ppoll /* 6265 */ 388 PTR sys_ppoll /* 6265 */
389 PTR sys_unshare 389 PTR sys_unshare
390 PTR sys_splice 390 PTR sys_splice
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index e91379c1be1d..c58b8e0105ea 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -506,7 +506,7 @@ sys_call_table:
506 PTR sys_readlinkat 506 PTR sys_readlinkat
507 PTR sys_fchmodat 507 PTR sys_fchmodat
508 PTR sys_faccessat /* 4300 */ 508 PTR sys_faccessat /* 4300 */
509 PTR sys_pselect6 509 PTR compat_sys_pselect6
510 PTR sys_ppoll 510 PTR sys_ppoll
511 PTR sys_unshare 511 PTR sys_unshare
512 PTR sys_splice 512 PTR sys_splice
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 89440a0d8528..d2e01e7167b8 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -271,8 +271,7 @@ static void __init bootmem_init(void)
271static void __init bootmem_init(void) 271static void __init bootmem_init(void)
272{ 272{
273 unsigned long reserved_end; 273 unsigned long reserved_end;
274 unsigned long highest = 0; 274 unsigned long mapstart = ~0UL;
275 unsigned long mapstart = -1UL;
276 unsigned long bootmap_size; 275 unsigned long bootmap_size;
277 int i; 276 int i;
278 277
@@ -284,6 +283,13 @@ static void __init bootmem_init(void)
284 reserved_end = max(init_initrd(), PFN_UP(__pa_symbol(&_end))); 283 reserved_end = max(init_initrd(), PFN_UP(__pa_symbol(&_end)));
285 284
286 /* 285 /*
286 * max_low_pfn is not a number of pages. The number of pages
287 * of the system is given by 'max_low_pfn - min_low_pfn'.
288 */
289 min_low_pfn = ~0UL;
290 max_low_pfn = 0;
291
292 /*
287 * Find the highest page frame number we have available. 293 * Find the highest page frame number we have available.
288 */ 294 */
289 for (i = 0; i < boot_mem_map.nr_map; i++) { 295 for (i = 0; i < boot_mem_map.nr_map; i++) {
@@ -296,8 +302,10 @@ static void __init bootmem_init(void)
296 end = PFN_DOWN(boot_mem_map.map[i].addr 302 end = PFN_DOWN(boot_mem_map.map[i].addr
297 + boot_mem_map.map[i].size); 303 + boot_mem_map.map[i].size);
298 304
299 if (end > highest) 305 if (end > max_low_pfn)
300 highest = end; 306 max_low_pfn = end;
307 if (start < min_low_pfn)
308 min_low_pfn = start;
301 if (end <= reserved_end) 309 if (end <= reserved_end)
302 continue; 310 continue;
303 if (start >= mapstart) 311 if (start >= mapstart)
@@ -305,22 +313,36 @@ static void __init bootmem_init(void)
305 mapstart = max(reserved_end, start); 313 mapstart = max(reserved_end, start);
306 } 314 }
307 315
316 if (min_low_pfn >= max_low_pfn)
317 panic("Incorrect memory mapping !!!");
318 if (min_low_pfn > ARCH_PFN_OFFSET) {
319 printk(KERN_INFO
320 "Wasting %lu bytes for tracking %lu unused pages\n",
321 (min_low_pfn - ARCH_PFN_OFFSET) * sizeof(struct page),
322 min_low_pfn - ARCH_PFN_OFFSET);
323 } else if (min_low_pfn < ARCH_PFN_OFFSET) {
324 printk(KERN_INFO
325 "%lu free pages won't be used\n",
326 ARCH_PFN_OFFSET - min_low_pfn);
327 }
328 min_low_pfn = ARCH_PFN_OFFSET;
329
308 /* 330 /*
309 * Determine low and high memory ranges 331 * Determine low and high memory ranges
310 */ 332 */
311 if (highest > PFN_DOWN(HIGHMEM_START)) { 333 if (max_low_pfn > PFN_DOWN(HIGHMEM_START)) {
312#ifdef CONFIG_HIGHMEM 334#ifdef CONFIG_HIGHMEM
313 highstart_pfn = PFN_DOWN(HIGHMEM_START); 335 highstart_pfn = PFN_DOWN(HIGHMEM_START);
314 highend_pfn = highest; 336 highend_pfn = max_low_pfn;
315#endif 337#endif
316 highest = PFN_DOWN(HIGHMEM_START); 338 max_low_pfn = PFN_DOWN(HIGHMEM_START);
317 } 339 }
318 340
319 /* 341 /*
320 * Initialize the boot-time allocator with low memory only. 342 * Initialize the boot-time allocator with low memory only.
321 */ 343 */
322 bootmap_size = init_bootmem(mapstart, highest); 344 bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart,
323 345 min_low_pfn, max_low_pfn);
324 /* 346 /*
325 * Register fully available low RAM pages with the bootmem allocator. 347 * Register fully available low RAM pages with the bootmem allocator.
326 */ 348 */
@@ -507,9 +529,9 @@ void __init setup_arch(char **cmdline_p)
507 529
508#if defined(CONFIG_VT) 530#if defined(CONFIG_VT)
509#if defined(CONFIG_VGA_CONSOLE) 531#if defined(CONFIG_VGA_CONSOLE)
510 conswitchp = &vga_con; 532 conswitchp = &vga_con;
511#elif defined(CONFIG_DUMMY_CONSOLE) 533#elif defined(CONFIG_DUMMY_CONSOLE)
512 conswitchp = &dummy_con; 534 conswitchp = &dummy_con;
513#endif 535#endif
514#endif 536#endif
515 537
@@ -541,3 +563,6 @@ int __init dsp_disable(char *s)
541} 563}
542 564
543__setup("nodsp", dsp_disable); 565__setup("nodsp", dsp_disable);
566
567unsigned long kernelsp[NR_CPUS];
568unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index b9d358e05214..9a44053cd9f1 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -89,7 +89,7 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
89 spin_lock_irq(&current->sighand->siglock); 89 spin_lock_irq(&current->sighand->siglock);
90 current->saved_sigmask = current->blocked; 90 current->saved_sigmask = current->blocked;
91 current->blocked = newset; 91 current->blocked = newset;
92 recalc_sigpending(); 92 recalc_sigpending();
93 spin_unlock_irq(&current->sighand->siglock); 93 spin_unlock_irq(&current->sighand->siglock);
94 94
95 current->state = TASK_INTERRUPTIBLE; 95 current->state = TASK_INTERRUPTIBLE;
@@ -124,7 +124,7 @@ asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act,
124 124
125 if (!ret && oact) { 125 if (!ret && oact) {
126 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact))) 126 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
127 return -EFAULT; 127 return -EFAULT;
128 err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 128 err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
129 err |= __put_user(old_ka.sa.sa_handler, &oact->sa_handler); 129 err |= __put_user(old_ka.sa.sa_handler, &oact->sa_handler);
130 err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig); 130 err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
@@ -304,7 +304,7 @@ int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
304 current->comm, current->pid, 304 current->comm, current->pid,
305 frame, regs->cp0_epc, frame->regs[31]); 305 frame, regs->cp0_epc, frame->regs[31]);
306#endif 306#endif
307 return 0; 307 return 0;
308 308
309give_sigsegv: 309give_sigsegv:
310 force_sigsegv(signr, current); 310 force_sigsegv(signr, current);
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index a67c18555ed3..b28646b3ceae 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -105,7 +105,7 @@ _sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
105 spin_lock_irq(&current->sighand->siglock); 105 spin_lock_irq(&current->sighand->siglock);
106 current->saved_sigmask = current->blocked; 106 current->saved_sigmask = current->blocked;
107 current->blocked = newset; 107 current->blocked = newset;
108 recalc_sigpending(); 108 recalc_sigpending();
109 spin_unlock_irq(&current->sighand->siglock); 109 spin_unlock_irq(&current->sighand->siglock);
110 110
111 current->state = TASK_INTERRUPTIBLE; 111 current->state = TASK_INTERRUPTIBLE;
@@ -184,7 +184,7 @@ int setup_rt_frame_n32(struct k_sigaction * ka,
184 /* Create the ucontext. */ 184 /* Create the ucontext. */
185 err |= __put_user(0, &frame->rs_uc.uc_flags); 185 err |= __put_user(0, &frame->rs_uc.uc_flags);
186 err |= __put_user(0, &frame->rs_uc.uc_link); 186 err |= __put_user(0, &frame->rs_uc.uc_link);
187 sp = (int) (long) current->sas_ss_sp; 187 sp = (int) (long) current->sas_ss_sp;
188 err |= __put_user(sp, 188 err |= __put_user(sp,
189 &frame->rs_uc.uc_stack.ss_sp); 189 &frame->rs_uc.uc_stack.ss_sp);
190 err |= __put_user(sas_ss_flags(regs->regs[29]), 190 err |= __put_user(sas_ss_flags(regs->regs[29]),
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 1ee689c0e0c9..64b62bdfb4f6 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -35,7 +35,6 @@
35#include <asm/mipsregs.h> 35#include <asm/mipsregs.h>
36#include <asm/mipsmtregs.h> 36#include <asm/mipsmtregs.h>
37#include <asm/mips_mt.h> 37#include <asm/mips_mt.h>
38#include <asm/mips-boards/maltaint.h> /* This is f*cking wrong */
39 38
40#define MIPS_CPU_IPI_RESCHED_IRQ 0 39#define MIPS_CPU_IPI_RESCHED_IRQ 0
41#define MIPS_CPU_IPI_CALL_IRQ 1 40#define MIPS_CPU_IPI_CALL_IRQ 1
@@ -108,12 +107,12 @@ void __init sanitize_tlb_entries(void)
108 107
109static void ipi_resched_dispatch(void) 108static void ipi_resched_dispatch(void)
110{ 109{
111 do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ); 110 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ);
112} 111}
113 112
114static void ipi_call_dispatch(void) 113static void ipi_call_dispatch(void)
115{ 114{
116 do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ); 115 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ);
117} 116}
118 117
119static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) 118static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
@@ -270,8 +269,8 @@ void __init plat_prepare_cpus(unsigned int max_cpus)
270 set_vi_handler(MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); 269 set_vi_handler(MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch);
271 } 270 }
272 271
273 cpu_ipi_resched_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ; 272 cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ;
274 cpu_ipi_call_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ; 273 cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ;
275 274
276 setup_irq(cpu_ipi_resched_irq, &irq_resched); 275 setup_irq(cpu_ipi_resched_irq, &irq_resched);
277 setup_irq(cpu_ipi_call_irq, &irq_call); 276 setup_irq(cpu_ipi_call_irq, &irq_call);
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 6a857bf030b0..9251ea824937 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -26,16 +26,6 @@
26 * This file should be built into the kernel only if CONFIG_MIPS_MT_SMTC is set. 26 * This file should be built into the kernel only if CONFIG_MIPS_MT_SMTC is set.
27 */ 27 */
28 28
29/*
30 * MIPSCPU_INT_BASE is identically defined in both
31 * asm-mips/mips-boards/maltaint.h and asm-mips/mips-boards/simint.h,
32 * but as yet there's no properly organized include structure that
33 * will ensure that the right *int.h file will be included for a
34 * given platform build.
35 */
36
37#define MIPSCPU_INT_BASE 16
38
39#define MIPS_CPU_IPI_IRQ 1 29#define MIPS_CPU_IPI_IRQ 1
40 30
41#define LOCK_MT_PRA() \ 31#define LOCK_MT_PRA() \
@@ -77,15 +67,15 @@ unsigned int ipi_timer_latch[NR_CPUS];
77 67
78#define IPIBUF_PER_CPU 4 68#define IPIBUF_PER_CPU 4
79 69
80struct smtc_ipi_q IPIQ[NR_CPUS]; 70static struct smtc_ipi_q IPIQ[NR_CPUS];
81struct smtc_ipi_q freeIPIq; 71static struct smtc_ipi_q freeIPIq;
82 72
83 73
84/* Forward declarations */ 74/* Forward declarations */
85 75
86void ipi_decode(struct smtc_ipi *); 76void ipi_decode(struct smtc_ipi *);
87void post_direct_ipi(int cpu, struct smtc_ipi *pipi); 77static void post_direct_ipi(int cpu, struct smtc_ipi *pipi);
88void setup_cross_vpe_interrupts(void); 78static void setup_cross_vpe_interrupts(void);
89void init_smtc_stats(void); 79void init_smtc_stats(void);
90 80
91/* Global SMTC Status */ 81/* Global SMTC Status */
@@ -200,7 +190,7 @@ void __init sanitize_tlb_entries(void)
200 * Configure shared TLB - VPC configuration bit must be set by caller 190 * Configure shared TLB - VPC configuration bit must be set by caller
201 */ 191 */
202 192
203void smtc_configure_tlb(void) 193static void smtc_configure_tlb(void)
204{ 194{
205 int i,tlbsiz,vpes; 195 int i,tlbsiz,vpes;
206 unsigned long mvpconf0; 196 unsigned long mvpconf0;
@@ -648,7 +638,7 @@ int setup_irq_smtc(unsigned int irq, struct irqaction * new,
648 * the VPE. 638 * the VPE.
649 */ 639 */
650 640
651void smtc_ipi_qdump(void) 641static void smtc_ipi_qdump(void)
652{ 642{
653 int i; 643 int i;
654 644
@@ -686,28 +676,6 @@ static __inline__ int atomic_postincrement(unsigned int *pv)
686 return result; 676 return result;
687} 677}
688 678
689/* No longer used in IPI dispatch, but retained for future recycling */
690
691static __inline__ int atomic_postclear(unsigned int *pv)
692{
693 unsigned long result;
694
695 unsigned long temp;
696
697 __asm__ __volatile__(
698 "1: ll %0, %2 \n"
699 " or %1, $0, $0 \n"
700 " sc %1, %2 \n"
701 " beqz %1, 1b \n"
702 " sync \n"
703 : "=&r" (result), "=&r" (temp), "=m" (*pv)
704 : "m" (*pv)
705 : "memory");
706
707 return result;
708}
709
710
711void smtc_send_ipi(int cpu, int type, unsigned int action) 679void smtc_send_ipi(int cpu, int type, unsigned int action)
712{ 680{
713 int tcstatus; 681 int tcstatus;
@@ -781,7 +749,7 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
781/* 749/*
782 * Send IPI message to Halted TC, TargTC/TargVPE already having been set 750 * Send IPI message to Halted TC, TargTC/TargVPE already having been set
783 */ 751 */
784void post_direct_ipi(int cpu, struct smtc_ipi *pipi) 752static void post_direct_ipi(int cpu, struct smtc_ipi *pipi)
785{ 753{
786 struct pt_regs *kstack; 754 struct pt_regs *kstack;
787 unsigned long tcstatus; 755 unsigned long tcstatus;
@@ -921,7 +889,7 @@ void smtc_timer_broadcast(int vpe)
921 * interrupts. 889 * interrupts.
922 */ 890 */
923 891
924static int cpu_ipi_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_IRQ; 892static int cpu_ipi_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_IRQ;
925 893
926static irqreturn_t ipi_interrupt(int irq, void *dev_idm) 894static irqreturn_t ipi_interrupt(int irq, void *dev_idm)
927{ 895{
@@ -1000,7 +968,7 @@ static void ipi_irq_dispatch(void)
1000 968
1001static struct irqaction irq_ipi; 969static struct irqaction irq_ipi;
1002 970
1003void setup_cross_vpe_interrupts(void) 971static void setup_cross_vpe_interrupts(void)
1004{ 972{
1005 if (!cpu_has_vint) 973 if (!cpu_has_vint)
1006 panic("SMTC Kernel requires Vectored Interupt support"); 974 panic("SMTC Kernel requires Vectored Interupt support");
@@ -1191,7 +1159,7 @@ void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
1191 * It would be nice to be able to use a spinlock here, 1159 * It would be nice to be able to use a spinlock here,
1192 * but this is invoked from within TLB flush routines 1160 * but this is invoked from within TLB flush routines
1193 * that protect themselves with DVPE, so if a lock is 1161 * that protect themselves with DVPE, so if a lock is
1194 * held by another TC, it'll never be freed. 1162 * held by another TC, it'll never be freed.
1195 * 1163 *
1196 * DVPE/DMT must not be done with interrupts enabled, 1164 * DVPE/DMT must not be done with interrupts enabled,
1197 * so even so most callers will already have disabled 1165 * so even so most callers will already have disabled
@@ -1296,7 +1264,7 @@ void smtc_flush_tlb_asid(unsigned long asid)
1296 * Support for single-threading cache flush operations. 1264 * Support for single-threading cache flush operations.
1297 */ 1265 */
1298 1266
1299int halt_state_save[NR_CPUS]; 1267static int halt_state_save[NR_CPUS];
1300 1268
1301/* 1269/*
1302 * To really, really be sure that nothing is being done 1270 * To really, really be sure that nothing is being done
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 6c2406a93f2b..93a148486f88 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -669,7 +669,7 @@ asmlinkage int irix_mount(char __user *dev_name, char __user *dir_name,
669 669
670struct irix_statfs { 670struct irix_statfs {
671 short f_type; 671 short f_type;
672 long f_bsize, f_frsize, f_blocks, f_bfree, f_files, f_ffree; 672 long f_bsize, f_frsize, f_blocks, f_bfree, f_files, f_ffree;
673 char f_fname[6], f_fpack[6]; 673 char f_fname[6], f_fpack[6];
674}; 674};
675 675
@@ -959,7 +959,7 @@ static inline loff_t llseek(struct file *file, loff_t offset, int origin)
959 959
960 fn = default_llseek; 960 fn = default_llseek;
961 if (file->f_op && file->f_op->llseek) 961 if (file->f_op && file->f_op->llseek)
962 fn = file->f_op->llseek; 962 fn = file->f_op->llseek;
963 lock_kernel(); 963 lock_kernel();
964 retval = fn(file, offset, origin); 964 retval = fn(file, offset, origin);
965 unlock_kernel(); 965 unlock_kernel();
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 458fccf87c54..459624969c99 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -522,7 +522,7 @@ static int (*reloc_handlers[]) (struct module *me, uint32_t *location,
522}; 522};
523 523
524static char *rstrs[] = { 524static char *rstrs[] = {
525 [R_MIPS_NONE] = "MIPS_NONE", 525 [R_MIPS_NONE] = "MIPS_NONE",
526 [R_MIPS_32] = "MIPS_32", 526 [R_MIPS_32] = "MIPS_32",
527 [R_MIPS_26] = "MIPS_26", 527 [R_MIPS_26] = "MIPS_26",
528 [R_MIPS_HI16] = "MIPS_HI16", 528 [R_MIPS_HI16] = "MIPS_HI16",
@@ -695,7 +695,7 @@ static void dump_tclist(void)
695} 695}
696 696
697/* We are prepared so configure and start the VPE... */ 697/* We are prepared so configure and start the VPE... */
698int vpe_run(struct vpe * v) 698static int vpe_run(struct vpe * v)
699{ 699{
700 struct vpe_notifications *n; 700 struct vpe_notifications *n;
701 unsigned long val, dmt_flag; 701 unsigned long val, dmt_flag;
@@ -713,16 +713,16 @@ int vpe_run(struct vpe * v)
713 dvpe(); 713 dvpe();
714 714
715 if (!list_empty(&v->tc)) { 715 if (!list_empty(&v->tc)) {
716 if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) { 716 if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) {
717 printk(KERN_WARNING "VPE loader: TC %d is already in use.\n", 717 printk(KERN_WARNING "VPE loader: TC %d is already in use.\n",
718 t->index); 718 t->index);
719 return -ENOEXEC; 719 return -ENOEXEC;
720 } 720 }
721 } else { 721 } else {
722 printk(KERN_WARNING "VPE loader: No TC's associated with VPE %d\n", 722 printk(KERN_WARNING "VPE loader: No TC's associated with VPE %d\n",
723 v->minor); 723 v->minor);
724 return -ENOEXEC; 724 return -ENOEXEC;
725 } 725 }
726 726
727 /* Put MVPE's into 'configuration state' */ 727 /* Put MVPE's into 'configuration state' */
728 set_c0_mvpcontrol(MVPCONTROL_VPC); 728 set_c0_mvpcontrol(MVPCONTROL_VPC);
@@ -775,14 +775,14 @@ int vpe_run(struct vpe * v)
775 775
776 back_to_back_c0_hazard(); 776 back_to_back_c0_hazard();
777 777
778 /* Set up the XTC bit in vpeconf0 to point at our tc */ 778 /* Set up the XTC bit in vpeconf0 to point at our tc */
779 write_vpe_c0_vpeconf0( (read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC)) 779 write_vpe_c0_vpeconf0( (read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC))
780 | (t->index << VPECONF0_XTC_SHIFT)); 780 | (t->index << VPECONF0_XTC_SHIFT));
781 781
782 back_to_back_c0_hazard(); 782 back_to_back_c0_hazard();
783 783
784 /* enable this VPE */ 784 /* enable this VPE */
785 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA); 785 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA);
786 786
787 /* clear out any left overs from a previous program */ 787 /* clear out any left overs from a previous program */
788 write_vpe_c0_status(0); 788 write_vpe_c0_status(0);
@@ -832,7 +832,7 @@ static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs,
832 * contents of the program (p)buffer performing relocatations/etc, free's it 832 * contents of the program (p)buffer performing relocatations/etc, free's it
833 * when finished. 833 * when finished.
834 */ 834 */
835int vpe_elfload(struct vpe * v) 835static int vpe_elfload(struct vpe * v)
836{ 836{
837 Elf_Ehdr *hdr; 837 Elf_Ehdr *hdr;
838 Elf_Shdr *sechdrs; 838 Elf_Shdr *sechdrs;
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index 2affa5ff171c..9a622b9a1051 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -45,7 +45,7 @@ void enable_lasat_irq(unsigned int irq_nr)
45} 45}
46 46
47static struct irq_chip lasat_irq_type = { 47static struct irq_chip lasat_irq_type = {
48 .typename = "Lasat", 48 .name = "Lasat",
49 .ack = disable_lasat_irq, 49 .ack = disable_lasat_irq,
50 .mask = disable_lasat_irq, 50 .mask = disable_lasat_irq,
51 .mask_ack = disable_lasat_irq, 51 .mask_ack = disable_lasat_irq,
diff --git a/arch/mips/lasat/prom.c b/arch/mips/lasat/prom.c
index 88c7ab871ec4..d47692f73a26 100644
--- a/arch/mips/lasat/prom.c
+++ b/arch/mips/lasat/prom.c
@@ -132,9 +132,8 @@ void __init prom_init(void)
132 add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM); 132 add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM);
133} 133}
134 134
135unsigned long __init prom_free_prom_memory(void) 135void __init prom_free_prom_memory(void)
136{ 136{
137 return 0;
138} 137}
139 138
140const char *get_system_type(void) 139const char *get_system_type(void)
diff --git a/arch/mips/lib-32/Makefile b/arch/mips/lib-32/Makefile
index dcd4d2ed2ac4..2036cf5e6857 100644
--- a/arch/mips/lib-32/Makefile
+++ b/arch/mips/lib-32/Makefile
@@ -2,7 +2,7 @@
2# Makefile for MIPS-specific library files.. 2# Makefile for MIPS-specific library files..
3# 3#
4 4
5lib-y += memset.o watch.o 5lib-y += watch.o
6 6
7obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o 7obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o
8obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o 8obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o
diff --git a/arch/mips/lib-64/Makefile b/arch/mips/lib-64/Makefile
index dcd4d2ed2ac4..2036cf5e6857 100644
--- a/arch/mips/lib-64/Makefile
+++ b/arch/mips/lib-64/Makefile
@@ -2,7 +2,7 @@
2# Makefile for MIPS-specific library files.. 2# Makefile for MIPS-specific library files..
3# 3#
4 4
5lib-y += memset.o watch.o 5lib-y += watch.o
6 6
7obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o 7obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o
8obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o 8obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o
diff --git a/arch/mips/lib-64/memset.S b/arch/mips/lib-64/memset.S
deleted file mode 100644
index e2c42c85113b..000000000000
--- a/arch/mips/lib-64/memset.S
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#include <asm/asm.h>
10#include <asm/asm-offsets.h>
11#include <asm/regdef.h>
12
13#define EX(insn,reg,addr,handler) \
149: insn reg, addr; \
15 .section __ex_table,"a"; \
16 PTR 9b, handler; \
17 .previous
18
19 .macro f_fill64 dst, offset, val, fixup
20 EX(LONG_S, \val, (\offset + 0 * LONGSIZE)(\dst), \fixup)
21 EX(LONG_S, \val, (\offset + 1 * LONGSIZE)(\dst), \fixup)
22 EX(LONG_S, \val, (\offset + 2 * LONGSIZE)(\dst), \fixup)
23 EX(LONG_S, \val, (\offset + 3 * LONGSIZE)(\dst), \fixup)
24 EX(LONG_S, \val, (\offset + 4 * LONGSIZE)(\dst), \fixup)
25 EX(LONG_S, \val, (\offset + 5 * LONGSIZE)(\dst), \fixup)
26 EX(LONG_S, \val, (\offset + 6 * LONGSIZE)(\dst), \fixup)
27 EX(LONG_S, \val, (\offset + 7 * LONGSIZE)(\dst), \fixup)
28 .endm
29
30/*
31 * memset(void *s, int c, size_t n)
32 *
33 * a0: start of area to clear
34 * a1: char to fill with
35 * a2: size of area to clear
36 */
37 .set noreorder
38 .align 5
39LEAF(memset)
40 beqz a1, 1f
41 move v0, a0 /* result */
42
43 andi a1, 0xff /* spread fillword */
44 dsll t1, a1, 8
45 or a1, t1
46 dsll t1, a1, 16
47 or a1, t1
48 dsll t1, a1, 32
49 or a1, t1
501:
51
52FEXPORT(__bzero)
53 sltiu t0, a2, LONGSIZE /* very small region? */
54 bnez t0, small_memset
55 andi t0, a0, LONGMASK /* aligned? */
56
57 beqz t0, 1f
58 PTR_SUBU t0, LONGSIZE /* alignment in bytes */
59
60#ifdef __MIPSEB__
61 EX(sdl, a1, (a0), first_fixup) /* make dword aligned */
62#endif
63#ifdef __MIPSEL__
64 EX(sdr, a1, (a0), first_fixup) /* make dword aligned */
65#endif
66 PTR_SUBU a0, t0 /* long align ptr */
67 PTR_ADDU a2, t0 /* correct size */
68
691: ori t1, a2, 0x3f /* # of full blocks */
70 xori t1, 0x3f
71 beqz t1, memset_partial /* no block to fill */
72 andi t0, a2, 0x38
73
74 PTR_ADDU t1, a0 /* end address */
75 .set reorder
761: PTR_ADDIU a0, 64
77 f_fill64 a0, -64, a1, fwd_fixup
78 bne t1, a0, 1b
79 .set noreorder
80
81memset_partial:
82 PTR_LA t1, 2f /* where to start */
83 .set noat
84 dsrl AT, t0, 1
85 PTR_SUBU t1, AT
86 .set noat
87 jr t1
88 PTR_ADDU a0, t0 /* dest ptr */
89
90 .set push
91 .set noreorder
92 .set nomacro
93 f_fill64 a0, -64, a1, partial_fixup /* ... but first do longs ... */
942: .set pop
95 andi a2, LONGMASK /* At most one long to go */
96
97 beqz a2, 1f
98 PTR_ADDU a0, a2 /* What's left */
99#ifdef __MIPSEB__
100 EX(sdr, a1, -1(a0), last_fixup)
101#endif
102#ifdef __MIPSEL__
103 EX(sdl, a1, -1(a0), last_fixup)
104#endif
1051: jr ra
106 move a2, zero
107
108small_memset:
109 beqz a2, 2f
110 PTR_ADDU t1, a0, a2
111
1121: PTR_ADDIU a0, 1 /* fill bytewise */
113 bne t1, a0, 1b
114 sb a1, -1(a0)
115
1162: jr ra /* done */
117 move a2, zero
118 END(memset)
119
120first_fixup:
121 jr ra
122 nop
123
124fwd_fixup:
125 PTR_L t0, TI_TASK($28)
126 LONG_L t0, THREAD_BUADDR(t0)
127 andi a2, 0x3f
128 LONG_ADDU a2, t1
129 jr ra
130 LONG_SUBU a2, t0
131
132partial_fixup:
133 PTR_L t0, TI_TASK($28)
134 LONG_L t0, THREAD_BUADDR(t0)
135 andi a2, LONGMASK
136 LONG_ADDU a2, t1
137 jr ra
138 LONG_SUBU a2, t0
139
140last_fixup:
141 jr ra
142 andi v1, a2, LONGMASK
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 989c900b8b14..5ad501b30b43 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -2,7 +2,7 @@
2# Makefile for MIPS-specific library files.. 2# Makefile for MIPS-specific library files..
3# 3#
4 4
5lib-y += csum_partial.o memcpy.o promlib.o \ 5lib-y += csum_partial.o memcpy.o memset.o promlib.o \
6 strlen_user.o strncpy_user.o strnlen_user.o uncached.o 6 strlen_user.o strncpy_user.o strnlen_user.o uncached.o
7 7
8obj-y += iomap.o 8obj-y += iomap.o
diff --git a/arch/mips/lib-32/memset.S b/arch/mips/lib/memset.S
index 1981485bd48b..3f8b8b3d0b23 100644
--- a/arch/mips/lib-32/memset.S
+++ b/arch/mips/lib/memset.S
@@ -10,6 +10,14 @@
10#include <asm/asm-offsets.h> 10#include <asm/asm-offsets.h>
11#include <asm/regdef.h> 11#include <asm/regdef.h>
12 12
13#if LONGSIZE == 4
14#define LONG_S_L swl
15#define LONG_S_R swr
16#else
17#define LONG_S_L sdl
18#define LONG_S_R sdr
19#endif
20
13#define EX(insn,reg,addr,handler) \ 21#define EX(insn,reg,addr,handler) \
149: insn reg, addr; \ 229: insn reg, addr; \
15 .section __ex_table,"a"; \ 23 .section __ex_table,"a"; \
@@ -25,6 +33,7 @@
25 EX(LONG_S, \val, (\offset + 5 * LONGSIZE)(\dst), \fixup) 33 EX(LONG_S, \val, (\offset + 5 * LONGSIZE)(\dst), \fixup)
26 EX(LONG_S, \val, (\offset + 6 * LONGSIZE)(\dst), \fixup) 34 EX(LONG_S, \val, (\offset + 6 * LONGSIZE)(\dst), \fixup)
27 EX(LONG_S, \val, (\offset + 7 * LONGSIZE)(\dst), \fixup) 35 EX(LONG_S, \val, (\offset + 7 * LONGSIZE)(\dst), \fixup)
36#if LONGSIZE == 4
28 EX(LONG_S, \val, (\offset + 8 * LONGSIZE)(\dst), \fixup) 37 EX(LONG_S, \val, (\offset + 8 * LONGSIZE)(\dst), \fixup)
29 EX(LONG_S, \val, (\offset + 9 * LONGSIZE)(\dst), \fixup) 38 EX(LONG_S, \val, (\offset + 9 * LONGSIZE)(\dst), \fixup)
30 EX(LONG_S, \val, (\offset + 10 * LONGSIZE)(\dst), \fixup) 39 EX(LONG_S, \val, (\offset + 10 * LONGSIZE)(\dst), \fixup)
@@ -33,6 +42,7 @@
33 EX(LONG_S, \val, (\offset + 13 * LONGSIZE)(\dst), \fixup) 42 EX(LONG_S, \val, (\offset + 13 * LONGSIZE)(\dst), \fixup)
34 EX(LONG_S, \val, (\offset + 14 * LONGSIZE)(\dst), \fixup) 43 EX(LONG_S, \val, (\offset + 14 * LONGSIZE)(\dst), \fixup)
35 EX(LONG_S, \val, (\offset + 15 * LONGSIZE)(\dst), \fixup) 44 EX(LONG_S, \val, (\offset + 15 * LONGSIZE)(\dst), \fixup)
45#endif
36 .endm 46 .endm
37 47
38/* 48/*
@@ -49,9 +59,13 @@ LEAF(memset)
49 move v0, a0 /* result */ 59 move v0, a0 /* result */
50 60
51 andi a1, 0xff /* spread fillword */ 61 andi a1, 0xff /* spread fillword */
52 sll t1, a1, 8 62 LONG_SLL t1, a1, 8
53 or a1, t1 63 or a1, t1
54 sll t1, a1, 16 64 LONG_SLL t1, a1, 16
65#if LONGSIZE == 8
66 or a1, t1
67 LONG_SLL t1, a1, 32
68#endif
55 or a1, t1 69 or a1, t1
561: 701:
57 71
@@ -64,10 +78,10 @@ FEXPORT(__bzero)
64 PTR_SUBU t0, LONGSIZE /* alignment in bytes */ 78 PTR_SUBU t0, LONGSIZE /* alignment in bytes */
65 79
66#ifdef __MIPSEB__ 80#ifdef __MIPSEB__
67 EX(swl, a1, (a0), first_fixup) /* make word aligned */ 81 EX(LONG_S_L, a1, (a0), first_fixup) /* make word/dword aligned */
68#endif 82#endif
69#ifdef __MIPSEL__ 83#ifdef __MIPSEL__
70 EX(swr, a1, (a0), first_fixup) /* make word aligned */ 84 EX(LONG_S_R, a1, (a0), first_fixup) /* make word/dword aligned */
71#endif 85#endif
72 PTR_SUBU a0, t0 /* long align ptr */ 86 PTR_SUBU a0, t0 /* long align ptr */
73 PTR_ADDU a2, t0 /* correct size */ 87 PTR_ADDU a2, t0 /* correct size */
@@ -75,7 +89,7 @@ FEXPORT(__bzero)
751: ori t1, a2, 0x3f /* # of full blocks */ 891: ori t1, a2, 0x3f /* # of full blocks */
76 xori t1, 0x3f 90 xori t1, 0x3f
77 beqz t1, memset_partial /* no block to fill */ 91 beqz t1, memset_partial /* no block to fill */
78 andi t0, a2, 0x3c 92 andi t0, a2, 0x40-LONGSIZE
79 93
80 PTR_ADDU t1, a0 /* end address */ 94 PTR_ADDU t1, a0 /* end address */
81 .set reorder 95 .set reorder
@@ -86,7 +100,14 @@ FEXPORT(__bzero)
86 100
87memset_partial: 101memset_partial:
88 PTR_LA t1, 2f /* where to start */ 102 PTR_LA t1, 2f /* where to start */
103#if LONGSIZE == 4
89 PTR_SUBU t1, t0 104 PTR_SUBU t1, t0
105#else
106 .set noat
107 LONG_SRL AT, t0, 1
108 PTR_SUBU t1, AT
109 .set noat
110#endif
90 jr t1 111 jr t1
91 PTR_ADDU a0, t0 /* dest ptr */ 112 PTR_ADDU a0, t0 /* dest ptr */
92 113
@@ -100,10 +121,10 @@ memset_partial:
100 beqz a2, 1f 121 beqz a2, 1f
101 PTR_ADDU a0, a2 /* What's left */ 122 PTR_ADDU a0, a2 /* What's left */
102#ifdef __MIPSEB__ 123#ifdef __MIPSEB__
103 EX(swr, a1, -1(a0), last_fixup) 124 EX(LONG_S_R, a1, -1(a0), last_fixup)
104#endif 125#endif
105#ifdef __MIPSEL__ 126#ifdef __MIPSEL__
106 EX(swl, a1, -1(a0), last_fixup) 127 EX(LONG_S_L, a1, -1(a0), last_fixup)
107#endif 128#endif
1081: jr ra 1291: jr ra
109 move a2, zero 130 move a2, zero
diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c
index 98ce89f8068b..2388f7f3ffde 100644
--- a/arch/mips/lib/uncached.c
+++ b/arch/mips/lib/uncached.c
@@ -44,20 +44,24 @@ unsigned long __init run_uncached(void *func)
44 44
45 if (sp >= (long)CKSEG0 && sp < (long)CKSEG2) 45 if (sp >= (long)CKSEG0 && sp < (long)CKSEG2)
46 usp = CKSEG1ADDR(sp); 46 usp = CKSEG1ADDR(sp);
47#ifdef CONFIG_64BIT
47 else if ((long long)sp >= (long long)PHYS_TO_XKPHYS(0LL, 0) && 48 else if ((long long)sp >= (long long)PHYS_TO_XKPHYS(0LL, 0) &&
48 (long long)sp < (long long)PHYS_TO_XKPHYS(8LL, 0)) 49 (long long)sp < (long long)PHYS_TO_XKPHYS(8LL, 0))
49 usp = PHYS_TO_XKPHYS((long long)K_CALG_UNCACHED, 50 usp = PHYS_TO_XKPHYS((long long)K_CALG_UNCACHED,
50 XKPHYS_TO_PHYS((long long)sp)); 51 XKPHYS_TO_PHYS((long long)sp));
52#endif
51 else { 53 else {
52 BUG(); 54 BUG();
53 usp = sp; 55 usp = sp;
54 } 56 }
55 if (lfunc >= (long)CKSEG0 && lfunc < (long)CKSEG2) 57 if (lfunc >= (long)CKSEG0 && lfunc < (long)CKSEG2)
56 ufunc = CKSEG1ADDR(lfunc); 58 ufunc = CKSEG1ADDR(lfunc);
59#ifdef CONFIG_64BIT
57 else if ((long long)lfunc >= (long long)PHYS_TO_XKPHYS(0LL, 0) && 60 else if ((long long)lfunc >= (long long)PHYS_TO_XKPHYS(0LL, 0) &&
58 (long long)lfunc < (long long)PHYS_TO_XKPHYS(8LL, 0)) 61 (long long)lfunc < (long long)PHYS_TO_XKPHYS(8LL, 0))
59 ufunc = PHYS_TO_XKPHYS((long long)K_CALG_UNCACHED, 62 ufunc = PHYS_TO_XKPHYS((long long)K_CALG_UNCACHED,
60 XKPHYS_TO_PHYS((long long)lfunc)); 63 XKPHYS_TO_PHYS((long long)lfunc));
64#endif
61 else { 65 else {
62 BUG(); 66 BUG();
63 ufunc = lfunc; 67 ufunc = lfunc;
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
index 43dba6ce6603..dfa0acbd7fc2 100644
--- a/arch/mips/mips-boards/atlas/atlas_int.c
+++ b/arch/mips/mips-boards/atlas/atlas_int.c
@@ -32,6 +32,7 @@
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/kernel_stat.h> 34#include <linux/kernel_stat.h>
35#include <linux/kernel.h>
35 36
36#include <asm/gdb-stub.h> 37#include <asm/gdb-stub.h>
37#include <asm/io.h> 38#include <asm/io.h>
@@ -69,7 +70,7 @@ static void end_atlas_irq(unsigned int irq)
69} 70}
70 71
71static struct irq_chip atlas_irq_type = { 72static struct irq_chip atlas_irq_type = {
72 .typename = "Atlas", 73 .name = "Atlas",
73 .ack = disable_atlas_irq, 74 .ack = disable_atlas_irq,
74 .mask = disable_atlas_irq, 75 .mask = disable_atlas_irq,
75 .mask_ack = disable_atlas_irq, 76 .mask_ack = disable_atlas_irq,
@@ -220,7 +221,7 @@ msc_irqmap_t __initdata msc_irqmap[] = {
220 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0}, 221 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0},
221 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0}, 222 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0},
222}; 223};
223int __initdata msc_nr_irqs = sizeof(msc_irqmap) / sizeof(*msc_irqmap); 224int __initdata msc_nr_irqs = ARRAY_SIZE(msc_irqmap);
224 225
225msc_irqmap_t __initdata msc_eicirqmap[] = { 226msc_irqmap_t __initdata msc_eicirqmap[] = {
226 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0}, 227 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0},
@@ -231,14 +232,14 @@ msc_irqmap_t __initdata msc_eicirqmap[] = {
231 {MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0}, 232 {MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0},
232 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0} 233 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0}
233}; 234};
234int __initdata msc_nr_eicirqs = sizeof(msc_eicirqmap) / sizeof(*msc_eicirqmap); 235int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap);
235 236
236void __init arch_init_irq(void) 237void __init arch_init_irq(void)
237{ 238{
238 init_atlas_irqs(ATLAS_INT_BASE); 239 init_atlas_irqs(ATLAS_INT_BASE);
239 240
240 if (!cpu_has_veic) 241 if (!cpu_has_veic)
241 mips_cpu_irq_init(MIPSCPU_INT_BASE); 242 mips_cpu_irq_init();
242 243
243 switch(mips_revision_corid) { 244 switch(mips_revision_corid) {
244 case MIPS_REVISION_CORID_CORE_MSC: 245 case MIPS_REVISION_CORID_CORE_MSC:
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index eeed944e0f83..ebf0e16c5a0d 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -166,9 +166,8 @@ void __init prom_meminit(void)
166 } 166 }
167} 167}
168 168
169unsigned long __init prom_free_prom_memory(void) 169void __init prom_free_prom_memory(void)
170{ 170{
171 unsigned long freed = 0;
172 unsigned long addr; 171 unsigned long addr;
173 int i; 172 int i;
174 173
@@ -176,17 +175,8 @@ unsigned long __init prom_free_prom_memory(void)
176 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) 175 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
177 continue; 176 continue;
178 177
179 addr = PAGE_ALIGN(boot_mem_map.map[i].addr); 178 addr = boot_mem_map.map[i].addr;
180 while (addr < boot_mem_map.map[i].addr 179 free_init_pages("prom memory",
181 + boot_mem_map.map[i].size) { 180 addr, addr + boot_mem_map.map[i].size);
182 ClearPageReserved(virt_to_page(__va(addr)));
183 init_page_count(virt_to_page(__va(addr)));
184 free_page((unsigned long)__va(addr));
185 addr += PAGE_SIZE;
186 freed += PAGE_SIZE;
187 }
188 } 181 }
189 printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
190
191 return freed;
192} 182}
diff --git a/arch/mips/mips-boards/malta/malta_int.c b/arch/mips/mips-boards/malta/malta_int.c
index 90ad5bf3e2f1..3c206bb17160 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -27,6 +27,7 @@
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/kernel_stat.h> 29#include <linux/kernel_stat.h>
30#include <linux/kernel.h>
30#include <linux/random.h> 31#include <linux/random.h>
31 32
32#include <asm/i8259.h> 33#include <asm/i8259.h>
@@ -289,7 +290,7 @@ msc_irqmap_t __initdata msc_irqmap[] = {
289 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0}, 290 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0},
290 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0}, 291 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0},
291}; 292};
292int __initdata msc_nr_irqs = sizeof(msc_irqmap)/sizeof(msc_irqmap_t); 293int __initdata msc_nr_irqs = ARRAY_SIZE(msc_irqmap);
293 294
294msc_irqmap_t __initdata msc_eicirqmap[] = { 295msc_irqmap_t __initdata msc_eicirqmap[] = {
295 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0}, 296 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0},
@@ -303,14 +304,14 @@ msc_irqmap_t __initdata msc_eicirqmap[] = {
303 {MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0}, 304 {MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0},
304 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0} 305 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0}
305}; 306};
306int __initdata msc_nr_eicirqs = sizeof(msc_eicirqmap)/sizeof(msc_irqmap_t); 307int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap);
307 308
308void __init arch_init_irq(void) 309void __init arch_init_irq(void)
309{ 310{
310 init_i8259_irqs(); 311 init_i8259_irqs();
311 312
312 if (!cpu_has_veic) 313 if (!cpu_has_veic)
313 mips_cpu_irq_init (MIPSCPU_INT_BASE); 314 mips_cpu_irq_init();
314 315
315 switch(mips_revision_corid) { 316 switch(mips_revision_corid) {
316 case MIPS_REVISION_CORID_CORE_MSC: 317 case MIPS_REVISION_CORID_CORE_MSC:
diff --git a/arch/mips/mips-boards/sead/sead_int.c b/arch/mips/mips-boards/sead/sead_int.c
index 874ccb0066b8..c4b9de3a7f27 100644
--- a/arch/mips/mips-boards/sead/sead_int.c
+++ b/arch/mips/mips-boards/sead/sead_int.c
@@ -113,5 +113,5 @@ asmlinkage void plat_irq_dispatch(void)
113 113
114void __init arch_init_irq(void) 114void __init arch_init_irq(void)
115{ 115{
116 mips_cpu_irq_init(MIPSCPU_INT_BASE); 116 mips_cpu_irq_init();
117} 117}
diff --git a/arch/mips/mips-boards/sim/sim_int.c b/arch/mips/mips-boards/sim/sim_int.c
index 2ce449dce6f2..15ac0655c1ff 100644
--- a/arch/mips/mips-boards/sim/sim_int.c
+++ b/arch/mips/mips-boards/sim/sim_int.c
@@ -21,9 +21,7 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/kernel_stat.h> 22#include <linux/kernel_stat.h>
23#include <asm/mips-boards/simint.h> 23#include <asm/mips-boards/simint.h>
24 24#include <asm/irq_cpu.h>
25
26extern void mips_cpu_irq_init(int);
27 25
28static inline int clz(unsigned long x) 26static inline int clz(unsigned long x)
29{ 27{
@@ -86,5 +84,5 @@ asmlinkage void plat_irq_dispatch(void)
86 84
87void __init arch_init_irq(void) 85void __init arch_init_irq(void)
88{ 86{
89 mips_cpu_irq_init(MIPSCPU_INT_BASE); 87 mips_cpu_irq_init();
90} 88}
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c
index f7ce76983328..46bc16f8b15d 100644
--- a/arch/mips/mips-boards/sim/sim_mem.c
+++ b/arch/mips/mips-boards/sim/sim_mem.c
@@ -99,10 +99,9 @@ void __init prom_meminit(void)
99 } 99 }
100} 100}
101 101
102unsigned long __init prom_free_prom_memory(void) 102void __init prom_free_prom_memory(void)
103{ 103{
104 int i; 104 int i;
105 unsigned long freed = 0;
106 unsigned long addr; 105 unsigned long addr;
107 106
108 for (i = 0; i < boot_mem_map.nr_map; i++) { 107 for (i = 0; i < boot_mem_map.nr_map; i++) {
@@ -110,16 +109,7 @@ unsigned long __init prom_free_prom_memory(void)
110 continue; 109 continue;
111 110
112 addr = boot_mem_map.map[i].addr; 111 addr = boot_mem_map.map[i].addr;
113 while (addr < boot_mem_map.map[i].addr 112 free_init_pages("prom memory",
114 + boot_mem_map.map[i].size) { 113 addr, addr + boot_mem_map.map[i].size);
115 ClearPageReserved(virt_to_page(__va(addr)));
116 init_page_count(virt_to_page(__va(addr)));
117 free_page((unsigned long)__va(addr));
118 addr += PAGE_SIZE;
119 freed += PAGE_SIZE;
120 }
121 } 114 }
122 printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
123
124 return freed;
125} 115}
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 49065c133ebf..125a4a85ec05 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -341,7 +341,6 @@ static int __init page_is_ram(unsigned long pagenr)
341void __init paging_init(void) 341void __init paging_init(void)
342{ 342{
343 unsigned long zones_size[MAX_NR_ZONES] = { 0, }; 343 unsigned long zones_size[MAX_NR_ZONES] = { 0, };
344 unsigned long max_dma, low;
345#ifndef CONFIG_FLATMEM 344#ifndef CONFIG_FLATMEM
346 unsigned long zholes_size[MAX_NR_ZONES] = { 0, }; 345 unsigned long zholes_size[MAX_NR_ZONES] = { 0, };
347 unsigned long i, j, pfn; 346 unsigned long i, j, pfn;
@@ -354,19 +353,19 @@ void __init paging_init(void)
354#endif 353#endif
355 kmap_coherent_init(); 354 kmap_coherent_init();
356 355
357 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
358 low = max_low_pfn;
359
360#ifdef CONFIG_ISA 356#ifdef CONFIG_ISA
361 if (low < max_dma) 357 if (max_low_pfn >= MAX_DMA_PFN)
362 zones_size[ZONE_DMA] = low; 358 if (min_low_pfn >= MAX_DMA_PFN) {
363 else { 359 zones_size[ZONE_DMA] = 0;
364 zones_size[ZONE_DMA] = max_dma; 360 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
365 zones_size[ZONE_NORMAL] = low - max_dma; 361 } else {
366 } 362 zones_size[ZONE_DMA] = MAX_DMA_PFN - min_low_pfn;
367#else 363 zones_size[ZONE_NORMAL] = max_low_pfn - MAX_DMA_PFN;
368 zones_size[ZONE_DMA] = low; 364 }
365 else
369#endif 366#endif
367 zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn;
368
370#ifdef CONFIG_HIGHMEM 369#ifdef CONFIG_HIGHMEM
371 zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn; 370 zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn;
372 371
@@ -467,7 +466,7 @@ void __init mem_init(void)
467} 466}
468#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 467#endif /* !CONFIG_NEED_MULTIPLE_NODES */
469 468
470static void free_init_pages(char *what, unsigned long begin, unsigned long end) 469void free_init_pages(const char *what, unsigned long begin, unsigned long end)
471{ 470{
472 unsigned long pfn; 471 unsigned long pfn;
473 472
@@ -493,18 +492,25 @@ void free_initrd_mem(unsigned long start, unsigned long end)
493} 492}
494#endif 493#endif
495 494
496extern unsigned long prom_free_prom_memory(void);
497
498void free_initmem(void) 495void free_initmem(void)
499{ 496{
500 unsigned long freed; 497 prom_free_prom_memory();
501
502 freed = prom_free_prom_memory();
503 if (freed)
504 printk(KERN_INFO "Freeing firmware memory: %ldkb freed\n",
505 freed >> 10);
506
507 free_init_pages("unused kernel memory", 498 free_init_pages("unused kernel memory",
508 __pa_symbol(&__init_begin), 499 __pa_symbol(&__init_begin),
509 __pa_symbol(&__init_end)); 500 __pa_symbol(&__init_end));
510} 501}
502
503unsigned long pgd_current[NR_CPUS];
504/*
505 * On 64-bit we've got three-level pagetables with a slightly
506 * different layout ...
507 */
508#define __page_aligned(order) __attribute__((__aligned__(PAGE_SIZE<<order)))
509pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned(PGD_ORDER);
510#ifdef CONFIG_64BIT
511#ifdef MODULE_START
512pgd_t module_pg_dir[PTRS_PER_PGD] __page_aligned(PGD_ORDER);
513#endif
514pmd_t invalid_pmd_table[PTRS_PER_PMD] __page_aligned(PMD_ORDER);
515#endif
516pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned(PTE_ORDER);
diff --git a/arch/mips/momentum/jaguar_atx/Makefile b/arch/mips/momentum/jaguar_atx/Makefile
index 67372f3f9654..2e8cebd49bc0 100644
--- a/arch/mips/momentum/jaguar_atx/Makefile
+++ b/arch/mips/momentum/jaguar_atx/Makefile
@@ -6,7 +6,7 @@
6# unless it's something special (ie not a .c file). 6# unless it's something special (ie not a .c file).
7# 7#
8 8
9obj-y += irq.o prom.o reset.o setup.o 9obj-y += irq.o platform.o prom.o reset.o setup.o
10 10
11obj-$(CONFIG_SERIAL_8250_CONSOLE) += ja-console.o 11obj-$(CONFIG_SERIAL_8250_CONSOLE) += ja-console.o
12obj-$(CONFIG_REMOTE_DEBUG) += dbg_io.o 12obj-$(CONFIG_REMOTE_DEBUG) += dbg_io.o
diff --git a/arch/mips/momentum/jaguar_atx/irq.c b/arch/mips/momentum/jaguar_atx/irq.c
index 2efb25aa1aed..f2b432585df2 100644
--- a/arch/mips/momentum/jaguar_atx/irq.c
+++ b/arch/mips/momentum/jaguar_atx/irq.c
@@ -82,8 +82,8 @@ void __init arch_init_irq(void)
82 */ 82 */
83 clear_c0_status(ST0_IM); 83 clear_c0_status(ST0_IM);
84 84
85 mips_cpu_irq_init(0); 85 mips_cpu_irq_init();
86 rm7k_cpu_irq_init(8); 86 rm7k_cpu_irq_init();
87 87
88 /* set up the cascading interrupts */ 88 /* set up the cascading interrupts */
89 setup_irq(8, &cascade_mv64340); 89 setup_irq(8, &cascade_mv64340);
diff --git a/arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h b/arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h
index 6978654c712b..022f6974b76e 100644
--- a/arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h
+++ b/arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h
@@ -46,7 +46,9 @@
46 46
47extern unsigned long ja_fpga_base; 47extern unsigned long ja_fpga_base;
48 48
49#define JAGUAR_FPGA_WRITE(x,y) writeb(x, ja_fpga_base + JAGUAR_ATX_REG_##y) 49#define __FPGA_REG_TO_ADDR(reg) \
50#define JAGUAR_FPGA_READ(x) readb(ja_fpga_base + JAGUAR_ATX_REG_##x) 50 ((void *) ja_fpga_base + JAGUAR_ATX_REG_##reg)
51#define JAGUAR_FPGA_WRITE(x, reg) writeb(x, __FPGA_REG_TO_ADDR(reg))
52#define JAGUAR_FPGA_READ(reg) readb(__FPGA_REG_TO_ADDR(reg))
51 53
52#endif 54#endif
diff --git a/arch/mips/momentum/jaguar_atx/platform.c b/arch/mips/momentum/jaguar_atx/platform.c
new file mode 100644
index 000000000000..035ea5137c71
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/platform.c
@@ -0,0 +1,235 @@
1#include <linux/delay.h>
2#include <linux/if_ether.h>
3#include <linux/ioport.h>
4#include <linux/mv643xx.h>
5#include <linux/platform_device.h>
6
7#include "jaguar_atx_fpga.h"
8
9#if defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE)
10
11static struct resource mv643xx_eth_shared_resources[] = {
12 [0] = {
13 .name = "ethernet shared base",
14 .start = 0xf1000000 + MV643XX_ETH_SHARED_REGS,
15 .end = 0xf1000000 + MV643XX_ETH_SHARED_REGS +
16 MV643XX_ETH_SHARED_REGS_SIZE - 1,
17 .flags = IORESOURCE_MEM,
18 },
19};
20
21static struct platform_device mv643xx_eth_shared_device = {
22 .name = MV643XX_ETH_SHARED_NAME,
23 .id = 0,
24 .num_resources = ARRAY_SIZE(mv643xx_eth_shared_resources),
25 .resource = mv643xx_eth_shared_resources,
26};
27
28#define MV_SRAM_BASE 0xfe000000UL
29#define MV_SRAM_SIZE (256 * 1024)
30
31#define MV_SRAM_RXRING_SIZE (MV_SRAM_SIZE / 4)
32#define MV_SRAM_TXRING_SIZE (MV_SRAM_SIZE / 4)
33
34#define MV_SRAM_BASE_ETH0 MV_SRAM_BASE
35#define MV_SRAM_BASE_ETH1 (MV_SRAM_BASE + (MV_SRAM_SIZE / 2))
36
37#define MV64x60_IRQ_ETH_0 48
38#define MV64x60_IRQ_ETH_1 49
39#define MV64x60_IRQ_ETH_2 50
40
41#ifdef CONFIG_MV643XX_ETH_0
42
43static struct resource mv64x60_eth0_resources[] = {
44 [0] = {
45 .name = "eth0 irq",
46 .start = MV64x60_IRQ_ETH_0,
47 .end = MV64x60_IRQ_ETH_0,
48 .flags = IORESOURCE_IRQ,
49 },
50};
51
52static char eth0_mac_addr[ETH_ALEN];
53
54static struct mv643xx_eth_platform_data eth0_pd = {
55 .mac_addr = eth0_mac_addr,
56
57 .tx_sram_addr = MV_SRAM_BASE_ETH0,
58 .tx_sram_size = MV_SRAM_TXRING_SIZE,
59 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
60
61 .rx_sram_addr = MV_SRAM_BASE_ETH0 + MV_SRAM_TXRING_SIZE,
62 .rx_sram_size = MV_SRAM_RXRING_SIZE,
63 .rx_queue_size = MV_SRAM_RXRING_SIZE / 16,
64};
65
66static struct platform_device eth0_device = {
67 .name = MV643XX_ETH_NAME,
68 .id = 0,
69 .num_resources = ARRAY_SIZE(mv64x60_eth0_resources),
70 .resource = mv64x60_eth0_resources,
71 .dev = {
72 .platform_data = &eth0_pd,
73 },
74};
75#endif /* CONFIG_MV643XX_ETH_0 */
76
77#ifdef CONFIG_MV643XX_ETH_1
78
79static struct resource mv64x60_eth1_resources[] = {
80 [0] = {
81 .name = "eth1 irq",
82 .start = MV64x60_IRQ_ETH_1,
83 .end = MV64x60_IRQ_ETH_1,
84 .flags = IORESOURCE_IRQ,
85 },
86};
87
88static char eth1_mac_addr[ETH_ALEN];
89
90static struct mv643xx_eth_platform_data eth1_pd = {
91 .mac_addr = eth1_mac_addr,
92
93 .tx_sram_addr = MV_SRAM_BASE_ETH1,
94 .tx_sram_size = MV_SRAM_TXRING_SIZE,
95 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
96
97 .rx_sram_addr = MV_SRAM_BASE_ETH1 + MV_SRAM_TXRING_SIZE,
98 .rx_sram_size = MV_SRAM_RXRING_SIZE,
99 .rx_queue_size = MV_SRAM_RXRING_SIZE / 16,
100};
101
102static struct platform_device eth1_device = {
103 .name = MV643XX_ETH_NAME,
104 .id = 1,
105 .num_resources = ARRAY_SIZE(mv64x60_eth1_resources),
106 .resource = mv64x60_eth1_resources,
107 .dev = {
108 .platform_data = &eth1_pd,
109 },
110};
111#endif /* CONFIG_MV643XX_ETH_1 */
112
113#ifdef CONFIG_MV643XX_ETH_2
114
115static struct resource mv64x60_eth2_resources[] = {
116 [0] = {
117 .name = "eth2 irq",
118 .start = MV64x60_IRQ_ETH_2,
119 .end = MV64x60_IRQ_ETH_2,
120 .flags = IORESOURCE_IRQ,
121 },
122};
123
124static char eth2_mac_addr[ETH_ALEN];
125
126static struct mv643xx_eth_platform_data eth2_pd = {
127 .mac_addr = eth2_mac_addr,
128};
129
130static struct platform_device eth2_device = {
131 .name = MV643XX_ETH_NAME,
132 .id = 1,
133 .num_resources = ARRAY_SIZE(mv64x60_eth2_resources),
134 .resource = mv64x60_eth2_resources,
135 .dev = {
136 .platform_data = &eth2_pd,
137 },
138};
139#endif /* CONFIG_MV643XX_ETH_2 */
140
141static struct platform_device *mv643xx_eth_pd_devs[] __initdata = {
142 &mv643xx_eth_shared_device,
143#ifdef CONFIG_MV643XX_ETH_0
144 &eth0_device,
145#endif
146#ifdef CONFIG_MV643XX_ETH_1
147 &eth1_device,
148#endif
149#ifdef CONFIG_MV643XX_ETH_2
150 &eth2_device,
151#endif
152};
153
154static u8 __init exchange_bit(u8 val, u8 cs)
155{
156 /* place the data */
157 JAGUAR_FPGA_WRITE((val << 2) | cs, EEPROM_MODE);
158 udelay(1);
159
160 /* turn the clock on */
161 JAGUAR_FPGA_WRITE((val << 2) | cs | 0x2, EEPROM_MODE);
162 udelay(1);
163
164 /* turn the clock off and read-strobe */
165 JAGUAR_FPGA_WRITE((val << 2) | cs | 0x10, EEPROM_MODE);
166
167 /* return the data */
168 return (JAGUAR_FPGA_READ(EEPROM_MODE) >> 3) & 0x1;
169}
170
171static void __init get_mac(char dest[6])
172{
173 u8 read_opcode[12] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
174 int i,j;
175
176 for (i = 0; i < 12; i++)
177 exchange_bit(read_opcode[i], 1);
178
179 for (j = 0; j < 6; j++) {
180 dest[j] = 0;
181 for (i = 0; i < 8; i++) {
182 dest[j] <<= 1;
183 dest[j] |= exchange_bit(0, 1);
184 }
185 }
186
187 /* turn off CS */
188 exchange_bit(0,0);
189}
190
191/*
192 * Copy and increment ethernet MAC address by a small value.
193 *
194 * This is useful for systems where the only one MAC address is stored in
195 * non-volatile memory for multiple ports.
196 */
197static inline void eth_mac_add(unsigned char *dst, unsigned char *src,
198 unsigned int add)
199{
200 int i;
201
202 BUG_ON(add >= 256);
203
204 for (i = ETH_ALEN; i >= 0; i--) {
205 dst[i] = src[i] + add;
206 add = dst[i] < src[i]; /* compute carry */
207 }
208
209 WARN_ON(add);
210}
211
212static int __init mv643xx_eth_add_pds(void)
213{
214 unsigned char mac[ETH_ALEN];
215 int ret;
216
217 get_mac(mac);
218#ifdef CONFIG_MV643XX_ETH_0
219 eth_mac_add(eth1_mac_addr, mac, 0);
220#endif
221#ifdef CONFIG_MV643XX_ETH_1
222 eth_mac_add(eth1_mac_addr, mac, 1);
223#endif
224#ifdef CONFIG_MV643XX_ETH_2
225 eth_mac_add(eth2_mac_addr, mac, 2);
226#endif
227 ret = platform_add_devices(mv643xx_eth_pd_devs,
228 ARRAY_SIZE(mv643xx_eth_pd_devs));
229
230 return ret;
231}
232
233device_initcall(mv643xx_eth_add_pds);
234
235#endif /* defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE) */
diff --git a/arch/mips/momentum/jaguar_atx/prom.c b/arch/mips/momentum/jaguar_atx/prom.c
index 3d2712929293..5dd154ee58f6 100644
--- a/arch/mips/momentum/jaguar_atx/prom.c
+++ b/arch/mips/momentum/jaguar_atx/prom.c
@@ -39,56 +39,6 @@ const char *get_system_type(void)
39 return "Momentum Jaguar-ATX"; 39 return "Momentum Jaguar-ATX";
40} 40}
41 41
42#ifdef CONFIG_MV643XX_ETH
43extern unsigned char prom_mac_addr_base[6];
44
45static void burn_clocks(void)
46{
47 int i;
48
49 /* this loop should burn at least 1us -- this should be plenty */
50 for (i = 0; i < 0x10000; i++)
51 ;
52}
53
54static u8 exchange_bit(u8 val, u8 cs)
55{
56 /* place the data */
57 JAGUAR_FPGA_WRITE((val << 2) | cs, EEPROM_MODE);
58 burn_clocks();
59
60 /* turn the clock on */
61 JAGUAR_FPGA_WRITE((val << 2) | cs | 0x2, EEPROM_MODE);
62 burn_clocks();
63
64 /* turn the clock off and read-strobe */
65 JAGUAR_FPGA_WRITE((val << 2) | cs | 0x10, EEPROM_MODE);
66
67 /* return the data */
68 return ((JAGUAR_FPGA_READ(EEPROM_MODE) >> 3) & 0x1);
69}
70
71void get_mac(char dest[6])
72{
73 u8 read_opcode[12] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
74 int i,j;
75
76 for (i = 0; i < 12; i++)
77 exchange_bit(read_opcode[i], 1);
78
79 for (j = 0; j < 6; j++) {
80 dest[j] = 0;
81 for (i = 0; i < 8; i++) {
82 dest[j] <<= 1;
83 dest[j] |= exchange_bit(0, 1);
84 }
85 }
86
87 /* turn off CS */
88 exchange_bit(0,0);
89}
90#endif
91
92#ifdef CONFIG_64BIT 42#ifdef CONFIG_64BIT
93 43
94unsigned long signext(unsigned long addr) 44unsigned long signext(unsigned long addr)
@@ -228,16 +178,10 @@ void __init prom_init(void)
228#endif /* CONFIG_64BIT */ 178#endif /* CONFIG_64BIT */
229 mips_machgroup = MACH_GROUP_MOMENCO; 179 mips_machgroup = MACH_GROUP_MOMENCO;
230 mips_machtype = MACH_MOMENCO_JAGUAR_ATX; 180 mips_machtype = MACH_MOMENCO_JAGUAR_ATX;
231
232#ifdef CONFIG_MV643XX_ETH
233 /* get the base MAC address for on-board ethernet ports */
234 get_mac(prom_mac_addr_base);
235#endif
236} 181}
237 182
238unsigned long __init prom_free_prom_memory(void) 183void __init prom_free_prom_memory(void)
239{ 184{
240 return 0;
241} 185}
242 186
243void __init prom_fixup_mem_map(unsigned long start, unsigned long end) 187void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
diff --git a/arch/mips/momentum/ocelot_3/irq.c b/arch/mips/momentum/ocelot_3/irq.c
index cea0e5deb80e..3862d1d1add4 100644
--- a/arch/mips/momentum/ocelot_3/irq.c
+++ b/arch/mips/momentum/ocelot_3/irq.c
@@ -65,7 +65,7 @@ void __init arch_init_irq(void)
65 */ 65 */
66 clear_c0_status(ST0_IM | ST0_BEV); 66 clear_c0_status(ST0_IM | ST0_BEV);
67 67
68 rm7k_cpu_irq_init(8); 68 rm7k_cpu_irq_init();
69 69
70 /* set up the cascading interrupts */ 70 /* set up the cascading interrupts */
71 setup_irq(8, &cascade_mv64340); /* unmask intControl IM8, IRQ 9 */ 71 setup_irq(8, &cascade_mv64340); /* unmask intControl IM8, IRQ 9 */
diff --git a/arch/mips/momentum/ocelot_3/prom.c b/arch/mips/momentum/ocelot_3/prom.c
index 6ce9b7fdb824..8e02df63578a 100644
--- a/arch/mips/momentum/ocelot_3/prom.c
+++ b/arch/mips/momentum/ocelot_3/prom.c
@@ -180,9 +180,8 @@ void __init prom_init(void)
180#endif 180#endif
181} 181}
182 182
183unsigned long __init prom_free_prom_memory(void) 183void __init prom_free_prom_memory(void)
184{ 184{
185 return 0;
186} 185}
187 186
188void __init prom_fixup_mem_map(unsigned long start, unsigned long end) 187void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
diff --git a/arch/mips/momentum/ocelot_c/cpci-irq.c b/arch/mips/momentum/ocelot_c/cpci-irq.c
index bb11fef08472..186a140fd2a9 100644
--- a/arch/mips/momentum/ocelot_c/cpci-irq.c
+++ b/arch/mips/momentum/ocelot_c/cpci-irq.c
@@ -84,7 +84,7 @@ void ll_cpci_irq(void)
84} 84}
85 85
86struct irq_chip cpci_irq_type = { 86struct irq_chip cpci_irq_type = {
87 .typename = "CPCI/FPGA", 87 .name = "CPCI/FPGA",
88 .ack = mask_cpci_irq, 88 .ack = mask_cpci_irq,
89 .mask = mask_cpci_irq, 89 .mask = mask_cpci_irq,
90 .mask_ack = mask_cpci_irq, 90 .mask_ack = mask_cpci_irq,
diff --git a/arch/mips/momentum/ocelot_c/dbg_io.c b/arch/mips/momentum/ocelot_c/dbg_io.c
index 2128684584f5..32d6fb4ee679 100644
--- a/arch/mips/momentum/ocelot_c/dbg_io.c
+++ b/arch/mips/momentum/ocelot_c/dbg_io.c
@@ -1,6 +1,4 @@
1 1
2#ifdef CONFIG_KGDB
3
4#include <asm/serial.h> /* For the serial port location and base baud */ 2#include <asm/serial.h> /* For the serial port location and base baud */
5 3
6/* --- CONFIG --- */ 4/* --- CONFIG --- */
@@ -121,5 +119,3 @@ int putDebugChar(uint8 byte)
121 UART16550_WRITE(OFS_SEND_BUFFER, byte); 119 UART16550_WRITE(OFS_SEND_BUFFER, byte);
122 return 1; 120 return 1;
123} 121}
124
125#endif
diff --git a/arch/mips/momentum/ocelot_c/irq.c b/arch/mips/momentum/ocelot_c/irq.c
index ea65223a6d2c..40472f7944d7 100644
--- a/arch/mips/momentum/ocelot_c/irq.c
+++ b/arch/mips/momentum/ocelot_c/irq.c
@@ -94,7 +94,7 @@ void __init arch_init_irq(void)
94 */ 94 */
95 clear_c0_status(ST0_IM); 95 clear_c0_status(ST0_IM);
96 96
97 mips_cpu_irq_init(0); 97 mips_cpu_irq_init();
98 98
99 /* set up the cascading interrupts */ 99 /* set up the cascading interrupts */
100 setup_irq(3, &cascade_fpga); 100 setup_irq(3, &cascade_fpga);
diff --git a/arch/mips/momentum/ocelot_c/prom.c b/arch/mips/momentum/ocelot_c/prom.c
index d0b77e101d74..b689ceea8cfb 100644
--- a/arch/mips/momentum/ocelot_c/prom.c
+++ b/arch/mips/momentum/ocelot_c/prom.c
@@ -178,7 +178,6 @@ void __init prom_init(void)
178#endif 178#endif
179} 179}
180 180
181unsigned long __init prom_free_prom_memory(void) 181void __init prom_free_prom_memory(void)
182{ 182{
183 return 0;
184} 183}
diff --git a/arch/mips/momentum/ocelot_c/uart-irq.c b/arch/mips/momentum/ocelot_c/uart-irq.c
index a7a80c0da569..de1a31ee52f3 100644
--- a/arch/mips/momentum/ocelot_c/uart-irq.c
+++ b/arch/mips/momentum/ocelot_c/uart-irq.c
@@ -77,7 +77,7 @@ void ll_uart_irq(void)
77} 77}
78 78
79struct irq_chip uart_irq_type = { 79struct irq_chip uart_irq_type = {
80 .typename = "UART/FPGA", 80 .name = "UART/FPGA",
81 .ack = mask_uart_irq, 81 .ack = mask_uart_irq,
82 .mask = mask_uart_irq, 82 .mask = mask_uart_irq,
83 .mask_ack = mask_uart_irq, 83 .mask_ack = mask_uart_irq,
diff --git a/arch/mips/momentum/ocelot_g/dbg_io.c b/arch/mips/momentum/ocelot_g/dbg_io.c
index 2128684584f5..32d6fb4ee679 100644
--- a/arch/mips/momentum/ocelot_g/dbg_io.c
+++ b/arch/mips/momentum/ocelot_g/dbg_io.c
@@ -1,6 +1,4 @@
1 1
2#ifdef CONFIG_KGDB
3
4#include <asm/serial.h> /* For the serial port location and base baud */ 2#include <asm/serial.h> /* For the serial port location and base baud */
5 3
6/* --- CONFIG --- */ 4/* --- CONFIG --- */
@@ -121,5 +119,3 @@ int putDebugChar(uint8 byte)
121 UART16550_WRITE(OFS_SEND_BUFFER, byte); 119 UART16550_WRITE(OFS_SEND_BUFFER, byte);
122 return 1; 120 return 1;
123} 121}
124
125#endif
diff --git a/arch/mips/momentum/ocelot_g/irq.c b/arch/mips/momentum/ocelot_g/irq.c
index da46524e87cb..273541fe7087 100644
--- a/arch/mips/momentum/ocelot_g/irq.c
+++ b/arch/mips/momentum/ocelot_g/irq.c
@@ -94,8 +94,8 @@ void __init arch_init_irq(void)
94 clear_c0_status(ST0_IM); 94 clear_c0_status(ST0_IM);
95 local_irq_disable(); 95 local_irq_disable();
96 96
97 mips_cpu_irq_init(0); 97 mips_cpu_irq_init();
98 rm7k_cpu_irq_init(8); 98 rm7k_cpu_irq_init();
99 99
100 gt64240_irq_init(); 100 gt64240_irq_init();
101} 101}
diff --git a/arch/mips/momentum/ocelot_g/prom.c b/arch/mips/momentum/ocelot_g/prom.c
index 2f75c6b91ec5..836d0830720d 100644
--- a/arch/mips/momentum/ocelot_g/prom.c
+++ b/arch/mips/momentum/ocelot_g/prom.c
@@ -79,7 +79,6 @@ void __init prom_init(void)
79 } 79 }
80} 80}
81 81
82unsigned long __init prom_free_prom_memory(void) 82void __init prom_free_prom_memory(void)
83{ 83{
84 return 0;
85} 84}
diff --git a/arch/mips/oprofile/Kconfig b/arch/mips/oprofile/Kconfig
index 55feaf798596..ca395ef06d4e 100644
--- a/arch/mips/oprofile/Kconfig
+++ b/arch/mips/oprofile/Kconfig
@@ -11,7 +11,7 @@ config PROFILING
11 11
12config OPROFILE 12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)" 13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING && EXPERIMENTAL 14 depends on PROFILING && !!MIPS_MT_SMTC && EXPERIMENTAL
15 help 15 help
16 OProfile is a profiling system capable of profiling the 16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries, 17 whole system, include the kernel, kernel modules, libraries,
diff --git a/arch/mips/pci/fixup-vr4133.c b/arch/mips/pci/fixup-vr4133.c
index 597b89764ba1..a8d9d22b13df 100644
--- a/arch/mips/pci/fixup-vr4133.c
+++ b/arch/mips/pci/fixup-vr4133.c
@@ -17,8 +17,10 @@
17 */ 17 */
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/kernel.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/i8259.h>
22#include <asm/vr41xx/cmbvr4133.h> 24#include <asm/vr41xx/cmbvr4133.h>
23 25
24extern int vr4133_rockhopper; 26extern int vr4133_rockhopper;
@@ -142,7 +144,7 @@ int rockhopper_get_irq(struct pci_dev *dev, u8 pin, u8 slot)
142 if (bus == NULL) 144 if (bus == NULL)
143 return -1; 145 return -1;
144 146
145 for (i = 0; i < sizeof (int_map) / sizeof (int_map[0]); i++) { 147 for (i = 0; i < ARRAY_SIZE(int_map); i++) {
146 if (int_map[i].bus == bus->number && int_map[i].slot == slot) { 148 if (int_map[i].bus == bus->number && int_map[i].slot == slot) {
147 int line; 149 int line;
148 for (line = 0; line < 4; line++) 150 for (line = 0; line < 4; line++)
@@ -160,17 +162,7 @@ int rockhopper_get_irq(struct pci_dev *dev, u8 pin, u8 slot)
160#ifdef CONFIG_ROCKHOPPER 162#ifdef CONFIG_ROCKHOPPER
161void i8259_init(void) 163void i8259_init(void)
162{ 164{
163 outb(0x11, 0x20); /* Master ICW1 */ 165 init_i8259_irqs();
164 outb(I8259_IRQ_BASE, 0x21); /* Master ICW2 */
165 outb(0x04, 0x21); /* Master ICW3 */
166 outb(0x01, 0x21); /* Master ICW4 */
167 outb(0xff, 0x21); /* Master IMW */
168
169 outb(0x11, 0xa0); /* Slave ICW1 */
170 outb(I8259_IRQ_BASE + 8, 0xa1); /* Slave ICW2 */
171 outb(0x02, 0xa1); /* Slave ICW3 */
172 outb(0x01, 0xa1); /* Slave ICW4 */
173 outb(0xff, 0xa1); /* Slave IMW */
174 166
175 outb(0x00, 0x4d0); 167 outb(0x00, 0x4d0);
176 outb(0x02, 0x4d1); /* USB IRQ9 is level */ 168 outb(0x02, 0x4d1); /* USB IRQ9 is level */
diff --git a/arch/mips/philips/pnx8550/common/int.c b/arch/mips/philips/pnx8550/common/int.c
index 2c36c108c4d6..d48665ebd33c 100644
--- a/arch/mips/philips/pnx8550/common/int.c
+++ b/arch/mips/philips/pnx8550/common/int.c
@@ -159,7 +159,7 @@ int pnx8550_set_gic_priority(int irq, int priority)
159} 159}
160 160
161static struct irq_chip level_irq_type = { 161static struct irq_chip level_irq_type = {
162 .typename = "PNX Level IRQ", 162 .name = "PNX Level IRQ",
163 .ack = mask_irq, 163 .ack = mask_irq,
164 .mask = mask_irq, 164 .mask = mask_irq,
165 .mask_ack = mask_irq, 165 .mask_ack = mask_irq,
diff --git a/arch/mips/philips/pnx8550/common/prom.c b/arch/mips/philips/pnx8550/common/prom.c
index eb6ec11fef07..8aeed6c2b8c3 100644
--- a/arch/mips/philips/pnx8550/common/prom.c
+++ b/arch/mips/philips/pnx8550/common/prom.c
@@ -106,9 +106,8 @@ int get_ethernet_addr(char *ethernet_addr)
106 return 0; 106 return 0;
107} 107}
108 108
109unsigned long __init prom_free_prom_memory(void) 109void __init prom_free_prom_memory(void)
110{ 110{
111 return 0;
112} 111}
113 112
114extern int pnx8550_console_port; 113extern int pnx8550_console_port;
diff --git a/arch/mips/pmc-sierra/yosemite/dbg_io.c b/arch/mips/pmc-sierra/yosemite/dbg_io.c
index 0f659c9106ac..6362c702e389 100644
--- a/arch/mips/pmc-sierra/yosemite/dbg_io.c
+++ b/arch/mips/pmc-sierra/yosemite/dbg_io.c
@@ -93,7 +93,7 @@
93 * Functions to READ and WRITE to serial port 1 93 * Functions to READ and WRITE to serial port 1
94 */ 94 */
95#define SERIAL_READ_1(ofs) (*((volatile unsigned char*) \ 95#define SERIAL_READ_1(ofs) (*((volatile unsigned char*) \
96 (TITAN_SERIAL_BASE_1 + ofs) 96 (TITAN_SERIAL_BASE_1 + ofs)))
97 97
98#define SERIAL_WRITE_1(ofs, val) ((*((volatile unsigned char*) \ 98#define SERIAL_WRITE_1(ofs, val) ((*((volatile unsigned char*) \
99 (TITAN_SERIAL_BASE_1 + ofs))) = val) 99 (TITAN_SERIAL_BASE_1 + ofs))) = val)
diff --git a/arch/mips/pmc-sierra/yosemite/irq.c b/arch/mips/pmc-sierra/yosemite/irq.c
index adb048527e76..428d1f45a287 100644
--- a/arch/mips/pmc-sierra/yosemite/irq.c
+++ b/arch/mips/pmc-sierra/yosemite/irq.c
@@ -148,9 +148,9 @@ void __init arch_init_irq(void)
148{ 148{
149 clear_c0_status(ST0_IM); 149 clear_c0_status(ST0_IM);
150 150
151 mips_cpu_irq_init(0); 151 mips_cpu_irq_init();
152 rm7k_cpu_irq_init(8); 152 rm7k_cpu_irq_init();
153 rm9k_cpu_irq_init(12); 153 rm9k_cpu_irq_init();
154 154
155#ifdef CONFIG_KGDB 155#ifdef CONFIG_KGDB
156 /* At this point, initialize the second serial port */ 156 /* At this point, initialize the second serial port */
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c
index 9fe4973377c3..1e1685e415a4 100644
--- a/arch/mips/pmc-sierra/yosemite/prom.c
+++ b/arch/mips/pmc-sierra/yosemite/prom.c
@@ -132,9 +132,8 @@ void __init prom_init(void)
132 prom_grab_secondary(); 132 prom_grab_secondary();
133} 133}
134 134
135unsigned long __init prom_free_prom_memory(void) 135void __init prom_free_prom_memory(void)
136{ 136{
137 return 0;
138} 137}
139 138
140void __init prom_fixup_mem_map(unsigned long start, unsigned long end) 139void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 1b9b0d396d3e..6a6e15e40009 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -171,6 +171,7 @@ static void __init py_map_ocd(void)
171 171
172static void __init py_uart_setup(void) 172static void __init py_uart_setup(void)
173{ 173{
174#ifdef CONFIG_SERIAL_8250
174 struct uart_port up; 175 struct uart_port up;
175 176
176 /* 177 /*
@@ -188,6 +189,7 @@ static void __init py_uart_setup(void)
188 189
189 if (early_serial_setup(&up)) 190 if (early_serial_setup(&up))
190 printk(KERN_ERR "Early serial init of port 0 failed\n"); 191 printk(KERN_ERR "Early serial init of port 0 failed\n");
192#endif /* CONFIG_SERIAL_8250 */
191} 193}
192 194
193static void __init py_rtc_setup(void) 195static void __init py_rtc_setup(void)
diff --git a/arch/mips/qemu/q-mem.c b/arch/mips/qemu/q-mem.c
index d174fac43031..dae39b59de15 100644
--- a/arch/mips/qemu/q-mem.c
+++ b/arch/mips/qemu/q-mem.c
@@ -1,6 +1,5 @@
1#include <linux/init.h> 1#include <linux/init.h>
2 2
3unsigned long __init prom_free_prom_memory(void) 3void __init prom_free_prom_memory(void)
4{ 4{
5 return 0UL;
6} 5}
diff --git a/arch/mips/sgi-ip22/ip22-eisa.c b/arch/mips/sgi-ip22/ip22-eisa.c
index a1a9af6da7bf..6b6e97b90c6e 100644
--- a/arch/mips/sgi-ip22/ip22-eisa.c
+++ b/arch/mips/sgi-ip22/ip22-eisa.c
@@ -139,7 +139,7 @@ static void end_eisa1_irq(unsigned int irq)
139} 139}
140 140
141static struct irq_chip ip22_eisa1_irq_type = { 141static struct irq_chip ip22_eisa1_irq_type = {
142 .typename = "IP22 EISA", 142 .name = "IP22 EISA",
143 .startup = startup_eisa1_irq, 143 .startup = startup_eisa1_irq,
144 .ack = mask_and_ack_eisa1_irq, 144 .ack = mask_and_ack_eisa1_irq,
145 .mask = disable_eisa1_irq, 145 .mask = disable_eisa1_irq,
@@ -194,7 +194,7 @@ static void end_eisa2_irq(unsigned int irq)
194} 194}
195 195
196static struct irq_chip ip22_eisa2_irq_type = { 196static struct irq_chip ip22_eisa2_irq_type = {
197 .typename = "IP22 EISA", 197 .name = "IP22 EISA",
198 .startup = startup_eisa2_irq, 198 .startup = startup_eisa2_irq,
199 .ack = mask_and_ack_eisa2_irq, 199 .ack = mask_and_ack_eisa2_irq,
200 .mask = disable_eisa2_irq, 200 .mask = disable_eisa2_irq,
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index c44f8be0644f..b454924aeb56 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -19,6 +19,7 @@
19 19
20#include <asm/mipsregs.h> 20#include <asm/mipsregs.h>
21#include <asm/addrspace.h> 21#include <asm/addrspace.h>
22#include <asm/irq_cpu.h>
22 23
23#include <asm/sgi/ioc.h> 24#include <asm/sgi/ioc.h>
24#include <asm/sgi/hpc3.h> 25#include <asm/sgi/hpc3.h>
@@ -52,7 +53,7 @@ static void disable_local0_irq(unsigned int irq)
52} 53}
53 54
54static struct irq_chip ip22_local0_irq_type = { 55static struct irq_chip ip22_local0_irq_type = {
55 .typename = "IP22 local 0", 56 .name = "IP22 local 0",
56 .ack = disable_local0_irq, 57 .ack = disable_local0_irq,
57 .mask = disable_local0_irq, 58 .mask = disable_local0_irq,
58 .mask_ack = disable_local0_irq, 59 .mask_ack = disable_local0_irq,
@@ -73,7 +74,7 @@ void disable_local1_irq(unsigned int irq)
73} 74}
74 75
75static struct irq_chip ip22_local1_irq_type = { 76static struct irq_chip ip22_local1_irq_type = {
76 .typename = "IP22 local 1", 77 .name = "IP22 local 1",
77 .ack = disable_local1_irq, 78 .ack = disable_local1_irq,
78 .mask = disable_local1_irq, 79 .mask = disable_local1_irq,
79 .mask_ack = disable_local1_irq, 80 .mask_ack = disable_local1_irq,
@@ -94,7 +95,7 @@ void disable_local2_irq(unsigned int irq)
94} 95}
95 96
96static struct irq_chip ip22_local2_irq_type = { 97static struct irq_chip ip22_local2_irq_type = {
97 .typename = "IP22 local 2", 98 .name = "IP22 local 2",
98 .ack = disable_local2_irq, 99 .ack = disable_local2_irq,
99 .mask = disable_local2_irq, 100 .mask = disable_local2_irq,
100 .mask_ack = disable_local2_irq, 101 .mask_ack = disable_local2_irq,
@@ -115,7 +116,7 @@ void disable_local3_irq(unsigned int irq)
115} 116}
116 117
117static struct irq_chip ip22_local3_irq_type = { 118static struct irq_chip ip22_local3_irq_type = {
118 .typename = "IP22 local 3", 119 .name = "IP22 local 3",
119 .ack = disable_local3_irq, 120 .ack = disable_local3_irq,
120 .mask = disable_local3_irq, 121 .mask = disable_local3_irq,
121 .mask_ack = disable_local3_irq, 122 .mask_ack = disable_local3_irq,
@@ -253,8 +254,6 @@ asmlinkage void plat_irq_dispatch(void)
253 indy_8254timer_irq(); 254 indy_8254timer_irq();
254} 255}
255 256
256extern void mips_cpu_irq_init(unsigned int irq_base);
257
258void __init arch_init_irq(void) 257void __init arch_init_irq(void)
259{ 258{
260 int i; 259 int i;
@@ -316,7 +315,7 @@ void __init arch_init_irq(void)
316 sgint->cmeimask1 = 0; 315 sgint->cmeimask1 = 0;
317 316
318 /* init CPU irqs */ 317 /* init CPU irqs */
319 mips_cpu_irq_init(SGINT_CPU); 318 mips_cpu_irq_init();
320 319
321 for (i = SGINT_LOCAL0; i < SGI_INTERRUPTS; i++) { 320 for (i = SGINT_LOCAL0; i < SGI_INTERRUPTS; i++) {
322 struct irq_chip *handler; 321 struct irq_chip *handler;
diff --git a/arch/mips/sgi-ip22/ip22-mc.c b/arch/mips/sgi-ip22/ip22-mc.c
index b58bd522262b..ddb6506d8341 100644
--- a/arch/mips/sgi-ip22/ip22-mc.c
+++ b/arch/mips/sgi-ip22/ip22-mc.c
@@ -202,7 +202,6 @@ void __init sgimc_init(void)
202} 202}
203 203
204void __init prom_meminit(void) {} 204void __init prom_meminit(void) {}
205unsigned long __init prom_free_prom_memory(void) 205void __init prom_free_prom_memory(void)
206{ 206{
207 return 0;
208} 207}
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 319f8803ef6f..60ade7690e09 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -333,7 +333,7 @@ static inline void disable_bridge_irq(unsigned int irq)
333} 333}
334 334
335static struct irq_chip bridge_irq_type = { 335static struct irq_chip bridge_irq_type = {
336 .typename = "bridge", 336 .name = "bridge",
337 .startup = startup_bridge_irq, 337 .startup = startup_bridge_irq,
338 .shutdown = shutdown_bridge_irq, 338 .shutdown = shutdown_bridge_irq,
339 .ack = disable_bridge_irq, 339 .ack = disable_bridge_irq,
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index 16e5682b01f1..0e3d535e9f43 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -498,10 +498,9 @@ void __init prom_meminit(void)
498 } 498 }
499} 499}
500 500
501unsigned long __init prom_free_prom_memory(void) 501void __init prom_free_prom_memory(void)
502{ 502{
503 /* We got nothing to free here ... */ 503 /* We got nothing to free here ... */
504 return 0;
505} 504}
506 505
507extern void pagetable_init(void); 506extern void pagetable_init(void);
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index c20e9899b34b..9ce513629b14 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -181,7 +181,7 @@ static void disable_rt_irq(unsigned int irq)
181} 181}
182 182
183static struct irq_chip rt_irq_type = { 183static struct irq_chip rt_irq_type = {
184 .typename = "SN HUB RT timer", 184 .name = "SN HUB RT timer",
185 .ack = disable_rt_irq, 185 .ack = disable_rt_irq,
186 .mask = disable_rt_irq, 186 .mask = disable_rt_irq,
187 .mask_ack = disable_rt_irq, 187 .mask_ack = disable_rt_irq,
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index ae063864c026..8c450d9e8696 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -144,7 +144,7 @@ static void end_cpu_irq(unsigned int irq)
144} 144}
145 145
146static struct irq_chip ip32_cpu_interrupt = { 146static struct irq_chip ip32_cpu_interrupt = {
147 .typename = "IP32 CPU", 147 .name = "IP32 CPU",
148 .ack = disable_cpu_irq, 148 .ack = disable_cpu_irq,
149 .mask = disable_cpu_irq, 149 .mask = disable_cpu_irq,
150 .mask_ack = disable_cpu_irq, 150 .mask_ack = disable_cpu_irq,
@@ -193,7 +193,7 @@ static void end_crime_irq(unsigned int irq)
193} 193}
194 194
195static struct irq_chip ip32_crime_interrupt = { 195static struct irq_chip ip32_crime_interrupt = {
196 .typename = "IP32 CRIME", 196 .name = "IP32 CRIME",
197 .ack = mask_and_ack_crime_irq, 197 .ack = mask_and_ack_crime_irq,
198 .mask = disable_crime_irq, 198 .mask = disable_crime_irq,
199 .mask_ack = mask_and_ack_crime_irq, 199 .mask_ack = mask_and_ack_crime_irq,
@@ -234,7 +234,7 @@ static void end_macepci_irq(unsigned int irq)
234} 234}
235 235
236static struct irq_chip ip32_macepci_interrupt = { 236static struct irq_chip ip32_macepci_interrupt = {
237 .typename = "IP32 MACE PCI", 237 .name = "IP32 MACE PCI",
238 .ack = disable_macepci_irq, 238 .ack = disable_macepci_irq,
239 .mask = disable_macepci_irq, 239 .mask = disable_macepci_irq,
240 .mask_ack = disable_macepci_irq, 240 .mask_ack = disable_macepci_irq,
@@ -347,7 +347,7 @@ static void end_maceisa_irq(unsigned irq)
347} 347}
348 348
349static struct irq_chip ip32_maceisa_interrupt = { 349static struct irq_chip ip32_maceisa_interrupt = {
350 .typename = "IP32 MACE ISA", 350 .name = "IP32 MACE ISA",
351 .ack = mask_and_ack_maceisa_irq, 351 .ack = mask_and_ack_maceisa_irq,
352 .mask = disable_maceisa_irq, 352 .mask = disable_maceisa_irq,
353 .mask_ack = mask_and_ack_maceisa_irq, 353 .mask_ack = mask_and_ack_maceisa_irq,
@@ -379,7 +379,7 @@ static void end_mace_irq(unsigned int irq)
379} 379}
380 380
381static struct irq_chip ip32_mace_interrupt = { 381static struct irq_chip ip32_mace_interrupt = {
382 .typename = "IP32 MACE", 382 .name = "IP32 MACE",
383 .ack = disable_mace_irq, 383 .ack = disable_mace_irq,
384 .mask = disable_mace_irq, 384 .mask = disable_mace_irq,
385 .mask_ack = disable_mace_irq, 385 .mask_ack = disable_mace_irq,
diff --git a/arch/mips/sgi-ip32/ip32-memory.c b/arch/mips/sgi-ip32/ip32-memory.c
index d37d40a3cdae..849d392a0013 100644
--- a/arch/mips/sgi-ip32/ip32-memory.c
+++ b/arch/mips/sgi-ip32/ip32-memory.c
@@ -43,7 +43,6 @@ void __init prom_meminit (void)
43} 43}
44 44
45 45
46unsigned long __init prom_free_prom_memory (void) 46void __init prom_free_prom_memory(void)
47{ 47{
48 return 0;
49} 48}
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 2e8f6b2e2420..1dc5d05d8962 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -82,7 +82,7 @@ extern char sb1250_duart_present[];
82#endif 82#endif
83 83
84static struct irq_chip bcm1480_irq_type = { 84static struct irq_chip bcm1480_irq_type = {
85 .typename = "BCM1480-IMR", 85 .name = "BCM1480-IMR",
86 .ack = ack_bcm1480_irq, 86 .ack = ack_bcm1480_irq,
87 .mask = disable_bcm1480_irq, 87 .mask = disable_bcm1480_irq,
88 .mask_ack = ack_bcm1480_irq, 88 .mask_ack = ack_bcm1480_irq,
diff --git a/arch/mips/sibyte/cfe/setup.c b/arch/mips/sibyte/cfe/setup.c
index 6e8952da6e2a..9e6099e69622 100644
--- a/arch/mips/sibyte/cfe/setup.c
+++ b/arch/mips/sibyte/cfe/setup.c
@@ -343,10 +343,9 @@ void __init prom_init(void)
343 prom_meminit(); 343 prom_meminit();
344} 344}
345 345
346unsigned long __init prom_free_prom_memory(void) 346void __init prom_free_prom_memory(void)
347{ 347{
348 /* Not sure what I'm supposed to do here. Nothing, I think */ 348 /* Not sure what I'm supposed to do here. Nothing, I think */
349 return 0;
350} 349}
351 350
352void prom_putchar(char c) 351void prom_putchar(char c)
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 82ce7533053f..148239446e6e 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -67,7 +67,7 @@ extern char sb1250_duart_present[];
67#endif 67#endif
68 68
69static struct irq_chip sb1250_irq_type = { 69static struct irq_chip sb1250_irq_type = {
70 .typename = "SB1250-IMR", 70 .name = "SB1250-IMR",
71 .ack = ack_sb1250_irq, 71 .ack = ack_sb1250_irq,
72 .mask = disable_sb1250_irq, 72 .mask = disable_sb1250_irq,
73 .mask_ack = ack_sb1250_irq, 73 .mask_ack = ack_sb1250_irq,
diff --git a/arch/mips/sibyte/sb1250/prom.c b/arch/mips/sibyte/sb1250/prom.c
index 3c33a4517bc3..257c4e674353 100644
--- a/arch/mips/sibyte/sb1250/prom.c
+++ b/arch/mips/sibyte/sb1250/prom.c
@@ -87,10 +87,9 @@ void __init prom_init(void)
87 prom_meminit(); 87 prom_meminit();
88} 88}
89 89
90unsigned long __init prom_free_prom_memory(void) 90void __init prom_free_prom_memory(void)
91{ 91{
92 /* Not sure what I'm supposed to do here. Nothing, I think */ 92 /* Not sure what I'm supposed to do here. Nothing, I think */
93 return 0;
94} 93}
95 94
96void prom_putchar(char c) 95void prom_putchar(char c)
diff --git a/arch/mips/sni/irq.c b/arch/mips/sni/irq.c
index 8511bcc6d99d..039e8e540508 100644
--- a/arch/mips/sni/irq.c
+++ b/arch/mips/sni/irq.c
@@ -37,7 +37,7 @@ static void end_pciasic_irq(unsigned int irq)
37} 37}
38 38
39static struct irq_chip pciasic_irq_type = { 39static struct irq_chip pciasic_irq_type = {
40 .typename = "ASIC-PCI", 40 .name = "ASIC-PCI",
41 .ack = disable_pciasic_irq, 41 .ack = disable_pciasic_irq,
42 .mask = disable_pciasic_irq, 42 .mask = disable_pciasic_irq,
43 .mask_ack = disable_pciasic_irq, 43 .mask_ack = disable_pciasic_irq,
diff --git a/arch/mips/sni/sniprom.c b/arch/mips/sni/sniprom.c
index d1d0f1f493b4..1213d166f22e 100644
--- a/arch/mips/sni/sniprom.c
+++ b/arch/mips/sni/sniprom.c
@@ -67,9 +67,8 @@ void prom_printf(char *fmt, ...)
67 va_end(args); 67 va_end(args);
68} 68}
69 69
70unsigned long prom_free_prom_memory(void) 70void __init prom_free_prom_memory(void)
71{ 71{
72 return 0;
73} 72}
74 73
75/* 74/*
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
index ed4a19adf361..e7f3e5b84dcf 100644
--- a/arch/mips/tx4927/common/tx4927_irq.c
+++ b/arch/mips/tx4927/common/tx4927_irq.c
@@ -120,7 +120,7 @@ static void tx4927_irq_pic_disable(unsigned int irq);
120 120
121#define TX4927_CP0_NAME "TX4927-CP0" 121#define TX4927_CP0_NAME "TX4927-CP0"
122static struct irq_chip tx4927_irq_cp0_type = { 122static struct irq_chip tx4927_irq_cp0_type = {
123 .typename = TX4927_CP0_NAME, 123 .name = TX4927_CP0_NAME,
124 .ack = tx4927_irq_cp0_disable, 124 .ack = tx4927_irq_cp0_disable,
125 .mask = tx4927_irq_cp0_disable, 125 .mask = tx4927_irq_cp0_disable,
126 .mask_ack = tx4927_irq_cp0_disable, 126 .mask_ack = tx4927_irq_cp0_disable,
@@ -129,7 +129,7 @@ static struct irq_chip tx4927_irq_cp0_type = {
129 129
130#define TX4927_PIC_NAME "TX4927-PIC" 130#define TX4927_PIC_NAME "TX4927-PIC"
131static struct irq_chip tx4927_irq_pic_type = { 131static struct irq_chip tx4927_irq_pic_type = {
132 .typename = TX4927_PIC_NAME, 132 .name = TX4927_PIC_NAME,
133 .ack = tx4927_irq_pic_disable, 133 .ack = tx4927_irq_pic_disable,
134 .mask = tx4927_irq_pic_disable, 134 .mask = tx4927_irq_pic_disable,
135 .mask_ack = tx4927_irq_pic_disable, 135 .mask_ack = tx4927_irq_pic_disable,
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
index b54b529a29f9..dcce88f403c9 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
@@ -228,7 +228,7 @@ static void toshiba_rbtx4927_irq_isa_mask_and_ack(unsigned int irq);
228 228
229#define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC" 229#define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC"
230static struct irq_chip toshiba_rbtx4927_irq_ioc_type = { 230static struct irq_chip toshiba_rbtx4927_irq_ioc_type = {
231 .typename = TOSHIBA_RBTX4927_IOC_NAME, 231 .name = TOSHIBA_RBTX4927_IOC_NAME,
232 .ack = toshiba_rbtx4927_irq_ioc_disable, 232 .ack = toshiba_rbtx4927_irq_ioc_disable,
233 .mask = toshiba_rbtx4927_irq_ioc_disable, 233 .mask = toshiba_rbtx4927_irq_ioc_disable,
234 .mask_ack = toshiba_rbtx4927_irq_ioc_disable, 234 .mask_ack = toshiba_rbtx4927_irq_ioc_disable,
@@ -241,7 +241,7 @@ static struct irq_chip toshiba_rbtx4927_irq_ioc_type = {
241#ifdef CONFIG_TOSHIBA_FPCIB0 241#ifdef CONFIG_TOSHIBA_FPCIB0
242#define TOSHIBA_RBTX4927_ISA_NAME "RBTX4927-ISA" 242#define TOSHIBA_RBTX4927_ISA_NAME "RBTX4927-ISA"
243static struct irq_chip toshiba_rbtx4927_irq_isa_type = { 243static struct irq_chip toshiba_rbtx4927_irq_isa_type = {
244 .typename = TOSHIBA_RBTX4927_ISA_NAME, 244 .name = TOSHIBA_RBTX4927_ISA_NAME,
245 .ack = toshiba_rbtx4927_irq_isa_mask_and_ack, 245 .ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
246 .mask = toshiba_rbtx4927_irq_isa_disable, 246 .mask = toshiba_rbtx4927_irq_isa_disable,
247 .mask_ack = toshiba_rbtx4927_irq_isa_mask_and_ack, 247 .mask_ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
@@ -490,13 +490,13 @@ void toshiba_rbtx4927_irq_dump(char *key)
490 { 490 {
491 u32 i, j = 0; 491 u32 i, j = 0;
492 for (i = 0; i < NR_IRQS; i++) { 492 for (i = 0; i < NR_IRQS; i++) {
493 if (strcmp(irq_desc[i].chip->typename, "none") 493 if (strcmp(irq_desc[i].chip->name, "none")
494 == 0) 494 == 0)
495 continue; 495 continue;
496 496
497 if ((i >= 1) 497 if ((i >= 1)
498 && (irq_desc[i - 1].chip->typename == 498 && (irq_desc[i - 1].chip->name ==
499 irq_desc[i].chip->typename)) { 499 irq_desc[i].chip->name)) {
500 j++; 500 j++;
501 } else { 501 } else {
502 j = 0; 502 j = 0;
@@ -510,7 +510,7 @@ void toshiba_rbtx4927_irq_dump(char *key)
510 (u32) (irq_desc[i].action ? irq_desc[i]. 510 (u32) (irq_desc[i].action ? irq_desc[i].
511 action->handler : 0), 511 action->handler : 0),
512 irq_desc[i].depth, 512 irq_desc[i].depth,
513 irq_desc[i].chip->typename, j); 513 irq_desc[i].chip->name, j);
514 } 514 }
515 } 515 }
516#endif 516#endif
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
index efe50562f0ce..9a3a5babd1fb 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
@@ -80,9 +80,8 @@ void __init prom_init(void)
80 add_memory_region(0, msize << 20, BOOT_MEM_RAM); 80 add_memory_region(0, msize << 20, BOOT_MEM_RAM);
81} 81}
82 82
83unsigned long __init prom_free_prom_memory(void) 83void __init prom_free_prom_memory(void)
84{ 84{
85 return 0;
86} 85}
87 86
88const char *get_system_type(void) 87const char *get_system_type(void)
diff --git a/arch/mips/tx4938/common/irq.c b/arch/mips/tx4938/common/irq.c
index a347b424d91c..3a2dbfc25014 100644
--- a/arch/mips/tx4938/common/irq.c
+++ b/arch/mips/tx4938/common/irq.c
@@ -49,7 +49,7 @@ static void tx4938_irq_pic_disable(unsigned int irq);
49 49
50#define TX4938_CP0_NAME "TX4938-CP0" 50#define TX4938_CP0_NAME "TX4938-CP0"
51static struct irq_chip tx4938_irq_cp0_type = { 51static struct irq_chip tx4938_irq_cp0_type = {
52 .typename = TX4938_CP0_NAME, 52 .name = TX4938_CP0_NAME,
53 .ack = tx4938_irq_cp0_disable, 53 .ack = tx4938_irq_cp0_disable,
54 .mask = tx4938_irq_cp0_disable, 54 .mask = tx4938_irq_cp0_disable,
55 .mask_ack = tx4938_irq_cp0_disable, 55 .mask_ack = tx4938_irq_cp0_disable,
@@ -58,7 +58,7 @@ static struct irq_chip tx4938_irq_cp0_type = {
58 58
59#define TX4938_PIC_NAME "TX4938-PIC" 59#define TX4938_PIC_NAME "TX4938-PIC"
60static struct irq_chip tx4938_irq_pic_type = { 60static struct irq_chip tx4938_irq_pic_type = {
61 .typename = TX4938_PIC_NAME, 61 .name = TX4938_PIC_NAME,
62 .ack = tx4938_irq_pic_disable, 62 .ack = tx4938_irq_pic_disable,
63 .mask = tx4938_irq_pic_disable, 63 .mask = tx4938_irq_pic_disable,
64 .mask_ack = tx4938_irq_pic_disable, 64 .mask_ack = tx4938_irq_pic_disable,
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/irq.c b/arch/mips/tx4938/toshiba_rbtx4938/irq.c
index b6f363d08011..2e96dbb248b1 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/irq.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/irq.c
@@ -92,7 +92,7 @@ static void toshiba_rbtx4938_irq_ioc_disable(unsigned int irq);
92 92
93#define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC" 93#define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC"
94static struct irq_chip toshiba_rbtx4938_irq_ioc_type = { 94static struct irq_chip toshiba_rbtx4938_irq_ioc_type = {
95 .typename = TOSHIBA_RBTX4938_IOC_NAME, 95 .name = TOSHIBA_RBTX4938_IOC_NAME,
96 .ack = toshiba_rbtx4938_irq_ioc_disable, 96 .ack = toshiba_rbtx4938_irq_ioc_disable,
97 .mask = toshiba_rbtx4938_irq_ioc_disable, 97 .mask = toshiba_rbtx4938_irq_ioc_disable,
98 .mask_ack = toshiba_rbtx4938_irq_ioc_disable, 98 .mask_ack = toshiba_rbtx4938_irq_ioc_disable,
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/prom.c b/arch/mips/tx4938/toshiba_rbtx4938/prom.c
index e44daf30a7c1..7dc6a0aae21c 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/prom.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/prom.c
@@ -56,9 +56,8 @@ void __init prom_init(void)
56 return; 56 return;
57} 57}
58 58
59unsigned long __init prom_free_prom_memory(void) 59void __init prom_free_prom_memory(void)
60{ 60{
61 return 0;
62} 61}
63 62
64void __init prom_fixup_mem_map(unsigned long start, unsigned long end) 63void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index c075261976c5..adabc6bad440 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2002 MontaVista Software Inc. 4 * Copyright (C) 2001-2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 6 * Copyright (C) 2003-2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -68,6 +68,7 @@ static unsigned char sysint2_assign[16] = {
68#define MPIUINTREG 0x0e 68#define MPIUINTREG 0x0e
69#define MAIUINTREG 0x10 69#define MAIUINTREG 0x10
70#define MKIUINTREG 0x12 70#define MKIUINTREG 0x12
71#define MMACINTREG 0x12
71#define MGIUINTLREG 0x14 72#define MGIUINTLREG 0x14
72#define MDSIUINTREG 0x16 73#define MDSIUINTREG 0x16
73#define NMIREG 0x18 74#define NMIREG 0x18
@@ -241,6 +242,30 @@ void vr41xx_disable_kiuint(uint16_t mask)
241 242
242EXPORT_SYMBOL(vr41xx_disable_kiuint); 243EXPORT_SYMBOL(vr41xx_disable_kiuint);
243 244
245void vr41xx_enable_macint(uint16_t mask)
246{
247 struct irq_desc *desc = irq_desc + ETHERNET_IRQ;
248 unsigned long flags;
249
250 spin_lock_irqsave(&desc->lock, flags);
251 icu1_set(MMACINTREG, mask);
252 spin_unlock_irqrestore(&desc->lock, flags);
253}
254
255EXPORT_SYMBOL(vr41xx_enable_macint);
256
257void vr41xx_disable_macint(uint16_t mask)
258{
259 struct irq_desc *desc = irq_desc + ETHERNET_IRQ;
260 unsigned long flags;
261
262 spin_lock_irqsave(&desc->lock, flags);
263 icu1_clear(MMACINTREG, mask);
264 spin_unlock_irqrestore(&desc->lock, flags);
265}
266
267EXPORT_SYMBOL(vr41xx_disable_macint);
268
244void vr41xx_enable_dsiuint(uint16_t mask) 269void vr41xx_enable_dsiuint(uint16_t mask)
245{ 270{
246 struct irq_desc *desc = irq_desc + DSIU_IRQ; 271 struct irq_desc *desc = irq_desc + DSIU_IRQ;
@@ -428,7 +453,7 @@ static void enable_sysint1_irq(unsigned int irq)
428} 453}
429 454
430static struct irq_chip sysint1_irq_type = { 455static struct irq_chip sysint1_irq_type = {
431 .typename = "SYSINT1", 456 .name = "SYSINT1",
432 .ack = disable_sysint1_irq, 457 .ack = disable_sysint1_irq,
433 .mask = disable_sysint1_irq, 458 .mask = disable_sysint1_irq,
434 .mask_ack = disable_sysint1_irq, 459 .mask_ack = disable_sysint1_irq,
@@ -446,7 +471,7 @@ static void enable_sysint2_irq(unsigned int irq)
446} 471}
447 472
448static struct irq_chip sysint2_irq_type = { 473static struct irq_chip sysint2_irq_type = {
449 .typename = "SYSINT2", 474 .name = "SYSINT2",
450 .ack = disable_sysint2_irq, 475 .ack = disable_sysint2_irq,
451 .mask = disable_sysint2_irq, 476 .mask = disable_sysint2_irq,
452 .mask_ack = disable_sysint2_irq, 477 .mask_ack = disable_sysint2_irq,
diff --git a/arch/mips/vr41xx/common/init.c b/arch/mips/vr41xx/common/init.c
index a2e285c1d4d5..4f97e0ba9e24 100644
--- a/arch/mips/vr41xx/common/init.c
+++ b/arch/mips/vr41xx/common/init.c
@@ -81,7 +81,6 @@ void __init prom_init(void)
81 } 81 }
82} 82}
83 83
84unsigned long __init prom_free_prom_memory (void) 84void __init prom_free_prom_memory(void)
85{ 85{
86 return 0UL;
87} 86}
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index 16decf4ac2f4..cba36a247e32 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -95,27 +95,27 @@ asmlinkage void plat_irq_dispatch(void)
95 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM; 95 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
96 96
97 if (pending & CAUSEF_IP7) 97 if (pending & CAUSEF_IP7)
98 do_IRQ(7); 98 do_IRQ(TIMER_IRQ);
99 else if (pending & 0x7800) { 99 else if (pending & 0x7800) {
100 if (pending & CAUSEF_IP3) 100 if (pending & CAUSEF_IP3)
101 irq_dispatch(3); 101 irq_dispatch(INT1_IRQ);
102 else if (pending & CAUSEF_IP4) 102 else if (pending & CAUSEF_IP4)
103 irq_dispatch(4); 103 irq_dispatch(INT2_IRQ);
104 else if (pending & CAUSEF_IP5) 104 else if (pending & CAUSEF_IP5)
105 irq_dispatch(5); 105 irq_dispatch(INT3_IRQ);
106 else if (pending & CAUSEF_IP6) 106 else if (pending & CAUSEF_IP6)
107 irq_dispatch(6); 107 irq_dispatch(INT4_IRQ);
108 } else if (pending & CAUSEF_IP2) 108 } else if (pending & CAUSEF_IP2)
109 irq_dispatch(2); 109 irq_dispatch(INT0_IRQ);
110 else if (pending & CAUSEF_IP0) 110 else if (pending & CAUSEF_IP0)
111 do_IRQ(0); 111 do_IRQ(MIPS_SOFTINT0_IRQ);
112 else if (pending & CAUSEF_IP1) 112 else if (pending & CAUSEF_IP1)
113 do_IRQ(1); 113 do_IRQ(MIPS_SOFTINT1_IRQ);
114 else 114 else
115 spurious_interrupt(); 115 spurious_interrupt();
116} 116}
117 117
118void __init arch_init_irq(void) 118void __init arch_init_irq(void)
119{ 119{
120 mips_cpu_irq_init(MIPS_CPU_IRQ_BASE); 120 mips_cpu_irq_init();
121} 121}
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/irq.c b/arch/mips/vr41xx/nec-cmbvr4133/irq.c
index 128ed8d6f111..7d2d076b0f54 100644
--- a/arch/mips/vr41xx/nec-cmbvr4133/irq.c
+++ b/arch/mips/vr41xx/nec-cmbvr4133/irq.c
@@ -21,60 +21,16 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22 22
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/i8259.h>
24#include <asm/vr41xx/cmbvr4133.h> 25#include <asm/vr41xx/cmbvr4133.h>
25 26
26extern void enable_8259A_irq(unsigned int irq);
27extern void disable_8259A_irq(unsigned int irq);
28extern void mask_and_ack_8259A(unsigned int irq);
29extern void init_8259A(int hoge);
30
31extern int vr4133_rockhopper; 27extern int vr4133_rockhopper;
32 28
33static void enable_i8259_irq(unsigned int irq)
34{
35 enable_8259A_irq(irq - I8259_IRQ_BASE);
36}
37
38static void disable_i8259_irq(unsigned int irq)
39{
40 disable_8259A_irq(irq - I8259_IRQ_BASE);
41}
42
43static void ack_i8259_irq(unsigned int irq)
44{
45 mask_and_ack_8259A(irq - I8259_IRQ_BASE);
46}
47
48static struct irq_chip i8259_irq_type = {
49 .typename = "XT-PIC",
50 .ack = ack_i8259_irq,
51 .mask = disable_i8259_irq,
52 .mask_ack = ack_i8259_irq,
53 .unmask = enable_i8259_irq,
54};
55
56static int i8259_get_irq_number(int irq) 29static int i8259_get_irq_number(int irq)
57{ 30{
58 unsigned long isr; 31 return i8259_irq();
59
60 isr = inb(0x20);
61 irq = ffz(~isr);
62 if (irq == 2) {
63 isr = inb(0xa0);
64 irq = 8 + ffz(~isr);
65 }
66
67 if (irq < 0 || irq > 15)
68 return -EINVAL;
69
70 return I8259_IRQ_BASE + irq;
71} 32}
72 33
73static struct irqaction i8259_slave_cascade = {
74 .handler = &no_action,
75 .name = "cascade",
76};
77
78void __init rockhopper_init_irq(void) 34void __init rockhopper_init_irq(void)
79{ 35{
80 int i; 36 int i;
@@ -84,11 +40,6 @@ void __init rockhopper_init_irq(void)
84 return; 40 return;
85 } 41 }
86 42
87 for (i = I8259_IRQ_BASE; i <= I8259_IRQ_LAST; i++)
88 set_irq_chip_and_handler(i, &i8259_irq_type, handle_level_irq);
89
90 setup_irq(I8259_SLAVE_IRQ, &i8259_slave_cascade);
91
92 vr41xx_set_irq_trigger(CMBVR41XX_INTC_PIN, TRIGGER_LEVEL, SIGNAL_THROUGH); 43 vr41xx_set_irq_trigger(CMBVR41XX_INTC_PIN, TRIGGER_LEVEL, SIGNAL_THROUGH);
93 vr41xx_set_irq_level(CMBVR41XX_INTC_PIN, LEVEL_HIGH); 44 vr41xx_set_irq_level(CMBVR41XX_INTC_PIN, LEVEL_HIGH);
94 vr41xx_cascade_irq(CMBVR41XX_INTC_IRQ, i8259_get_irq_number); 45 vr41xx_cascade_irq(CMBVR41XX_INTC_IRQ, i8259_get_irq_number);
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d6abe495c6b0..f08e80a0bf0a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -173,6 +173,11 @@ config PPC_86xx
173 help 173 help
174 The Freescale E600 SoCs have 74xx cores. 174 The Freescale E600 SoCs have 74xx cores.
175 175
176config PPC_8xx
177 bool "Freescale 8xx"
178 select FSL_SOC
179 select 8xx
180
176config 40x 181config 40x
177 bool "AMCC 40x" 182 bool "AMCC 40x"
178 select PPC_DCR_NATIVE 183 select PPC_DCR_NATIVE
@@ -181,8 +186,6 @@ config 44x
181 bool "AMCC 44x" 186 bool "AMCC 44x"
182 select PPC_DCR_NATIVE 187 select PPC_DCR_NATIVE
183 188
184config 8xx
185 bool "Freescale 8xx"
186 189
187config E200 190config E200
188 bool "Freescale e200" 191 bool "Freescale e200"
@@ -211,6 +214,10 @@ config 6xx
211 bool 214 bool
212 215
213# this is temp to handle compat with arch=ppc 216# this is temp to handle compat with arch=ppc
217config 8xx
218 bool
219
220# this is temp to handle compat with arch=ppc
214config 83xx 221config 83xx
215 bool 222 bool
216 223
@@ -429,6 +436,21 @@ config PPC_MPC52xx
429 bool 436 bool
430 default n 437 default n
431 438
439config PPC_MPC5200
440 bool
441 select PPC_MPC52xx
442 default n
443
444config PPC_MPC5200_BUGFIX
445 bool "MPC5200 (L25R) bugfix support"
446 depends on PPC_MPC5200
447 default n
448 help
449 Enable workarounds for original MPC5200 errata. This is not required
450 for MPC5200B based boards.
451
452 It is safe to say 'Y' here
453
432config PPC_EFIKA 454config PPC_EFIKA
433 bool "bPlan Efika 5k2. MPC5200B based computer" 455 bool "bPlan Efika 5k2. MPC5200B based computer"
434 depends on PPC_MULTIPLATFORM && PPC32 456 depends on PPC_MULTIPLATFORM && PPC32
@@ -441,7 +463,7 @@ config PPC_EFIKA
441config PPC_LITE5200 463config PPC_LITE5200
442 bool "Freescale Lite5200 Eval Board" 464 bool "Freescale Lite5200 Eval Board"
443 depends on PPC_MULTIPLATFORM && PPC32 465 depends on PPC_MULTIPLATFORM && PPC32
444 select PPC_MPC52xx 466 select PPC_MPC5200
445 default n 467 default n
446 468
447config PPC_PMAC 469config PPC_PMAC
@@ -484,6 +506,7 @@ config PPC_MAPLE
484 select PPC_970_NAP 506 select PPC_970_NAP
485 select PPC_NATIVE 507 select PPC_NATIVE
486 select PPC_RTAS 508 select PPC_RTAS
509 select MMIO_NVRAM
487 select ATA_NONSTANDARD if ATA 510 select ATA_NONSTANDARD if ATA
488 default n 511 default n
489 help 512 help
@@ -529,6 +552,11 @@ config PPC_PS3
529 bool "Sony PS3 (incomplete)" 552 bool "Sony PS3 (incomplete)"
530 depends on PPC_MULTIPLATFORM && PPC64 553 depends on PPC_MULTIPLATFORM && PPC64
531 select PPC_CELL 554 select PPC_CELL
555 select USB_ARCH_HAS_OHCI
556 select USB_OHCI_LITTLE_ENDIAN
557 select USB_OHCI_BIG_ENDIAN_MMIO
558 select USB_ARCH_HAS_EHCI
559 select USB_EHCI_BIG_ENDIAN_MMIO
532 help 560 help
533 This option enables support for the Sony PS3 game console 561 This option enables support for the Sony PS3 game console
534 and other platforms using the PS3 hypervisor. 562 and other platforms using the PS3 hypervisor.
@@ -536,6 +564,16 @@ config PPC_PS3
536 enabling this will not result in a bootable kernel on a 564 enabling this will not result in a bootable kernel on a
537 PS3 system. 565 PS3 system.
538 566
567config PPC_CELLEB
568 bool "Toshiba's Cell Reference Set 'Celleb' Architecture"
569 depends on PPC_MULTIPLATFORM && PPC64
570 select PPC_CELL
571 select PPC_OF_PLATFORM_PCI
572 select HAS_TXX9_SERIAL
573 select PPC_UDBG_BEAT
574 select USB_OHCI_BIG_ENDIAN_MMIO
575 select USB_EHCI_BIG_ENDIAN_MMIO
576
539config PPC_NATIVE 577config PPC_NATIVE
540 bool 578 bool
541 depends on PPC_MULTIPLATFORM 579 depends on PPC_MULTIPLATFORM
@@ -549,6 +587,11 @@ config UDBG_RTAS_CONSOLE
549 depends on PPC_RTAS 587 depends on PPC_RTAS
550 default n 588 default n
551 589
590config PPC_UDBG_BEAT
591 bool "BEAT based debug console"
592 depends on PPC_CELLEB
593 default n
594
552config XICS 595config XICS
553 depends on PPC_PSERIES 596 depends on PPC_PSERIES
554 bool 597 bool
@@ -702,6 +745,7 @@ source arch/powerpc/platforms/86xx/Kconfig
702source arch/powerpc/platforms/8xx/Kconfig 745source arch/powerpc/platforms/8xx/Kconfig
703source arch/powerpc/platforms/cell/Kconfig 746source arch/powerpc/platforms/cell/Kconfig
704source arch/powerpc/platforms/ps3/Kconfig 747source arch/powerpc/platforms/ps3/Kconfig
748source arch/powerpc/platforms/pasemi/Kconfig
705 749
706menu "Kernel options" 750menu "Kernel options"
707 751
@@ -724,7 +768,7 @@ config FORCE_MAX_ZONEORDER
724 768
725config MATH_EMULATION 769config MATH_EMULATION
726 bool "Math emulation" 770 bool "Math emulation"
727 depends on 4xx || 8xx || E200 || PPC_83xx || E500 771 depends on 4xx || 8xx || E200 || PPC_MPC832x || E500
728 ---help--- 772 ---help---
729 Some PowerPC chips designed for embedded applications do not have 773 Some PowerPC chips designed for embedded applications do not have
730 a floating-point unit and therefore do not implement the 774 a floating-point unit and therefore do not implement the
@@ -1182,7 +1226,7 @@ source "arch/powerpc/oprofile/Kconfig"
1182 1226
1183config KPROBES 1227config KPROBES
1184 bool "Kprobes (EXPERIMENTAL)" 1228 bool "Kprobes (EXPERIMENTAL)"
1185 depends on PPC64 && KALLSYMS && EXPERIMENTAL && MODULES 1229 depends on !BOOKE && !4xx && KALLSYMS && EXPERIMENTAL && MODULES
1186 help 1230 help
1187 Kprobes allows you to trap at almost any kernel address and 1231 Kprobes allows you to trap at almost any kernel address and
1188 execute a callback function. register_kprobe() establishes 1232 execute a callback function. register_kprobe() establishes
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index f0e51edde022..d39d13327e6d 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -4,14 +4,14 @@ source "lib/Kconfig.debug"
4 4
5config DEBUG_STACKOVERFLOW 5config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows" 6 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL && PPC64 7 depends on DEBUG_KERNEL
8 help 8 help
9 This option will cause messages to be printed if free stack space 9 This option will cause messages to be printed if free stack space
10 drops below a certain limit. 10 drops below a certain limit.
11 11
12config DEBUG_STACK_USAGE 12config DEBUG_STACK_USAGE
13 bool "Stack utilization instrumentation" 13 bool "Stack utilization instrumentation"
14 depends on DEBUG_KERNEL && PPC64 14 depends on DEBUG_KERNEL
15 help 15 help
16 Enables the display of the minimum amount of free stack which each 16 Enables the display of the minimum amount of free stack which each
17 task has ever had available in the sysrq-T and sysrq-P debug output. 17 task has ever had available in the sysrq-T and sysrq-P debug output.
@@ -185,6 +185,20 @@ config PPC_EARLY_DEBUG_ISERIES
185 Select this to enable early debugging for legacy iSeries. You need 185 Select this to enable early debugging for legacy iSeries. You need
186 to hit "Ctrl-x Ctrl-x" to see the messages on the console. 186 to hit "Ctrl-x Ctrl-x" to see the messages on the console.
187 187
188config PPC_EARLY_DEBUG_PAS_REALMODE
189 bool "PA Semi real mode"
190 depends on PPC_PASEMI
191 help
192 Select this to enable early debugging for PA Semi.
193 Output will be on UART0.
194
195config PPC_EARLY_DEBUG_BEAT
196 bool "Beat HV Console"
197 depends on PPC_CELLEB
198 select PPC_UDBG_BEAT
199 help
200 Select this to enable early debugging for Celleb with Beat.
201
188endchoice 202endchoice
189 203
190endmenu 204endmenu
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 98392fb5f581..dc779407de14 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -162,6 +162,7 @@ image-$(CONFIG_PPC_PSERIES) += zImage.pseries
162image-$(CONFIG_PPC_MAPLE) += zImage.pseries 162image-$(CONFIG_PPC_MAPLE) += zImage.pseries
163image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries 163image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries
164image-$(CONFIG_PPC_PS3) += zImage.ps3 164image-$(CONFIG_PPC_PS3) += zImage.ps3
165image-$(CONFIG_PPC_CELLEB) += zImage.pseries
165image-$(CONFIG_PPC_CHRP) += zImage.chrp 166image-$(CONFIG_PPC_CHRP) += zImage.chrp
166image-$(CONFIG_PPC_EFIKA) += zImage.chrp 167image-$(CONFIG_PPC_EFIKA) += zImage.chrp
167image-$(CONFIG_PPC_PMAC) += zImage.pmac 168image-$(CONFIG_PPC_PMAC) += zImage.pmac
diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts
index 34efdd028c4f..26b44f7513dc 100644
--- a/arch/powerpc/boot/dts/mpc8272ads.dts
+++ b/arch/powerpc/boot/dts/mpc8272ads.dts
@@ -53,13 +53,20 @@
53 reg = <00000000 4000000 f4500000 00000020>; 53 reg = <00000000 4000000 f4500000 00000020>;
54 }; 54 };
55 55
56 chosen {
57 name = "chosen";
58 linux,platform = <0>;
59 interrupt-controller = <10c00>;
60 linux,phandle = <400>;
61 };
62
56 soc8272@f0000000 { 63 soc8272@f0000000 {
57 #address-cells = <1>; 64 #address-cells = <1>;
58 #size-cells = <1>; 65 #size-cells = <1>;
59 #interrupt-cells = <2>; 66 #interrupt-cells = <2>;
60 device_type = "soc"; 67 device_type = "soc";
61 ranges = < 0 0 2 00000000 f0000000 00053000>; 68 ranges = <00000000 f0000000 00053000>;
62 reg = <f0000000 0>; 69 reg = <f0000000 10000>;
63 70
64 mdio@0 { 71 mdio@0 {
65 device_type = "mdio"; 72 device_type = "mdio";
@@ -71,7 +78,7 @@
71 ethernet-phy@0 { 78 ethernet-phy@0 {
72 linux,phandle = <2452000>; 79 linux,phandle = <2452000>;
73 interrupt-parent = <10c00>; 80 interrupt-parent = <10c00>;
74 interrupts = <19 1>; 81 interrupts = <17 4>;
75 reg = <0>; 82 reg = <0>;
76 bitbang = [ 12 12 13 02 02 01 ]; 83 bitbang = [ 12 12 13 02 02 01 ];
77 device_type = "ethernet-phy"; 84 device_type = "ethernet-phy";
@@ -79,7 +86,7 @@
79 ethernet-phy@1 { 86 ethernet-phy@1 {
80 linux,phandle = <2452001>; 87 linux,phandle = <2452001>;
81 interrupt-parent = <10c00>; 88 interrupt-parent = <10c00>;
82 interrupts = <19 1>; 89 interrupts = <17 4>;
83 bitbang = [ 12 12 13 02 02 01 ]; 90 bitbang = [ 12 12 13 02 02 01 ];
84 reg = <3>; 91 reg = <3>;
85 device_type = "ethernet-phy"; 92 device_type = "ethernet-phy";
@@ -90,7 +97,7 @@
90 #address-cells = <1>; 97 #address-cells = <1>;
91 #size-cells = <0>; 98 #size-cells = <0>;
92 device_type = "network"; 99 device_type = "network";
93 device-id = <2>; 100 device-id = <1>;
94 compatible = "fs_enet"; 101 compatible = "fs_enet";
95 model = "FCC"; 102 model = "FCC";
96 reg = <11300 20 8400 100 11380 30>; 103 reg = <11300 20 8400 100 11380 30>;
@@ -104,7 +111,7 @@
104 111
105 ethernet@25000 { 112 ethernet@25000 {
106 device_type = "network"; 113 device_type = "network";
107 device-id = <3>; 114 device-id = <2>;
108 compatible = "fs_enet"; 115 compatible = "fs_enet";
109 model = "FCC"; 116 model = "FCC";
110 reg = <11320 20 8500 100 113b0 30>; 117 reg = <11320 20 8500 100 113b0 30>;
@@ -123,8 +130,8 @@
123 #interrupt-cells = <2>; 130 #interrupt-cells = <2>;
124 device_type = "cpm"; 131 device_type = "cpm";
125 model = "CPM2"; 132 model = "CPM2";
126 ranges = <00000000 00000000 3ffff>; 133 ranges = <00000000 00000000 20000>;
127 reg = <10d80 3280>; 134 reg = <0 20000>;
128 command-proc = <119c0>; 135 command-proc = <119c0>;
129 brg-frequency = <17D7840>; 136 brg-frequency = <17D7840>;
130 cpm_clk = <BEBC200>; 137 cpm_clk = <BEBC200>;
@@ -133,7 +140,7 @@
133 device_type = "serial"; 140 device_type = "serial";
134 compatible = "cpm_uart"; 141 compatible = "cpm_uart";
135 model = "SCC"; 142 model = "SCC";
136 device-id = <2>; 143 device-id = <1>;
137 reg = <11a00 20 8000 100>; 144 reg = <11a00 20 8000 100>;
138 current-speed = <1c200>; 145 current-speed = <1c200>;
139 interrupts = <28 2>; 146 interrupts = <28 2>;
@@ -147,7 +154,7 @@
147 device_type = "serial"; 154 device_type = "serial";
148 compatible = "cpm_uart"; 155 compatible = "cpm_uart";
149 model = "SCC"; 156 model = "SCC";
150 device-id = <5>; 157 device-id = <4>;
151 reg = <11a60 20 8300 100>; 158 reg = <11a60 20 8300 100>;
152 current-speed = <1c200>; 159 current-speed = <1c200>;
153 interrupts = <2b 2>; 160 interrupts = <2b 2>;
@@ -181,24 +188,24 @@
181 interrupt-map = < 188 interrupt-map = <
182 189
183 /* IDSEL 0x16 */ 190 /* IDSEL 0x16 */
184 b000 0 0 1 f8200000 40 0 191 b000 0 0 1 f8200000 40 8
185 b000 0 0 2 f8200000 41 0 192 b000 0 0 2 f8200000 41 8
186 b000 0 0 3 f8200000 42 0 193 b000 0 0 3 f8200000 42 8
187 b000 0 0 4 f8200000 43 0 194 b000 0 0 4 f8200000 43 8
188 195
189 /* IDSEL 0x17 */ 196 /* IDSEL 0x17 */
190 b800 0 0 1 f8200000 43 0 197 b800 0 0 1 f8200000 43 8
191 b800 0 0 2 f8200000 40 0 198 b800 0 0 2 f8200000 40 8
192 b800 0 0 3 f8200000 41 0 199 b800 0 0 3 f8200000 41 8
193 b800 0 0 4 f8200000 42 0 200 b800 0 0 4 f8200000 42 8
194 201
195 /* IDSEL 0x18 */ 202 /* IDSEL 0x18 */
196 c000 0 0 1 f8200000 42 0 203 c000 0 0 1 f8200000 42 8
197 c000 0 0 2 f8200000 43 0 204 c000 0 0 2 f8200000 43 8
198 c000 0 0 3 f8200000 40 0 205 c000 0 0 3 f8200000 40 8
199 c000 0 0 4 f8200000 41 0>; 206 c000 0 0 4 f8200000 41 8>;
200 interrupt-parent = <10c00>; 207 interrupt-parent = <10c00>;
201 interrupts = <14 3>; 208 interrupts = <14 8>;
202 bus-range = <0 0>; 209 bus-range = <0 0>;
203 ranges = <02000000 0 80000000 80000000 0 40000000 210 ranges = <02000000 0 80000000 80000000 0 40000000
204 01000000 0 00000000 f6000000 0 02000000>; 211 01000000 0 00000000 f6000000 0 02000000>;
@@ -210,7 +217,7 @@
210 model = "SEC2"; 217 model = "SEC2";
211 compatible = "talitos"; 218 compatible = "talitos";
212 reg = <30000 10000>; 219 reg = <30000 10000>;
213 interrupts = <b 0>; 220 interrupts = <b 2>;
214 interrupt-parent = <10c00>; 221 interrupt-parent = <10c00>;
215 num-channels = <4>; 222 num-channels = <4>;
216 channel-fifo-len = <18>; 223 channel-fifo-len = <18>;
diff --git a/arch/powerpc/boot/dts/mpc8323emds.dts b/arch/powerpc/boot/dts/mpc8323emds.dts
new file mode 100644
index 000000000000..fa7ef24d205b
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8323emds.dts
@@ -0,0 +1,345 @@
1/*
2 * MPC8323E EMDS Device Tree Source
3 *
4 * Copyright 2006 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12/ {
13 model = "MPC8323EMDS";
14 compatible = "MPC83xx";
15 #address-cells = <1>;
16 #size-cells = <1>;
17 linux,phandle = <100>;
18
19 cpus {
20 #cpus = <1>;
21 #address-cells = <1>;
22 #size-cells = <0>;
23 linux,phandle = <200>;
24
25 PowerPC,8323@0 {
26 device_type = "cpu";
27 reg = <0>;
28 d-cache-line-size = <20>; // 32 bytes
29 i-cache-line-size = <20>; // 32 bytes
30 d-cache-size = <4000>; // L1, 16K
31 i-cache-size = <4000>; // L1, 16K
32 timebase-frequency = <0>;
33 bus-frequency = <0>;
34 clock-frequency = <0>;
35 32-bit;
36 linux,phandle = <201>;
37 linux,boot-cpu;
38 };
39 };
40
41 memory {
42 device_type = "memory";
43 linux,phandle = <300>;
44 reg = <00000000 08000000>;
45 };
46
47 bcsr@f8000000 {
48 device_type = "board-control";
49 reg = <f8000000 8000>;
50 };
51
52 soc8323@e0000000 {
53 #address-cells = <1>;
54 #size-cells = <1>;
55 #interrupt-cells = <2>;
56 device_type = "soc";
57 ranges = <0 e0000000 00100000>;
58 reg = <e0000000 00000200>;
59 bus-frequency = <7DE2900>;
60
61 wdt@200 {
62 device_type = "watchdog";
63 compatible = "mpc83xx_wdt";
64 reg = <200 100>;
65 };
66
67 i2c@3000 {
68 device_type = "i2c";
69 compatible = "fsl-i2c";
70 reg = <3000 100>;
71 interrupts = <e 8>;
72 interrupt-parent = <700>;
73 dfsrr;
74 };
75
76 serial@4500 {
77 device_type = "serial";
78 compatible = "ns16550";
79 reg = <4500 100>;
80 clock-frequency = <0>;
81 interrupts = <9 8>;
82 interrupt-parent = <700>;
83 };
84
85 serial@4600 {
86 device_type = "serial";
87 compatible = "ns16550";
88 reg = <4600 100>;
89 clock-frequency = <0>;
90 interrupts = <a 8>;
91 interrupt-parent = <700>;
92 };
93
94 crypto@30000 {
95 device_type = "crypto";
96 model = "SEC2";
97 compatible = "talitos";
98 reg = <30000 7000>;
99 interrupts = <b 8>;
100 interrupt-parent = <700>;
101 /* Rev. 2.2 */
102 num-channels = <1>;
103 channel-fifo-len = <18>;
104 exec-units-mask = <0000004c>;
105 descriptor-types-mask = <0122003f>;
106 };
107
108 pci@8500 {
109 linux,phandle = <8500>;
110 interrupt-map-mask = <f800 0 0 7>;
111 interrupt-map = <
112 /* IDSEL 0x11 AD17 */
113 8800 0 0 1 700 14 8
114 8800 0 0 2 700 15 8
115 8800 0 0 3 700 16 8
116 8800 0 0 4 700 17 8
117
118 /* IDSEL 0x12 AD18 */
119 9000 0 0 1 700 16 8
120 9000 0 0 2 700 17 8
121 9000 0 0 3 700 14 8
122 9000 0 0 4 700 15 8
123
124 /* IDSEL 0x13 AD19 */
125 9800 0 0 1 700 17 8
126 9800 0 0 2 700 14 8
127 9800 0 0 3 700 15 8
128 9800 0 0 4 700 16 8
129
130 /* IDSEL 0x15 AD21*/
131 a800 0 0 1 700 14 8
132 a800 0 0 2 700 15 8
133 a800 0 0 3 700 16 8
134 a800 0 0 4 700 17 8
135
136 /* IDSEL 0x16 AD22*/
137 b000 0 0 1 700 17 8
138 b000 0 0 2 700 14 8
139 b000 0 0 3 700 15 8
140 b000 0 0 4 700 16 8
141
142 /* IDSEL 0x17 AD23*/
143 b800 0 0 1 700 16 8
144 b800 0 0 2 700 17 8
145 b800 0 0 3 700 14 8
146 b800 0 0 4 700 15 8
147
148 /* IDSEL 0x18 AD24*/
149 c000 0 0 1 700 15 8
150 c000 0 0 2 700 16 8
151 c000 0 0 3 700 17 8
152 c000 0 0 4 700 14 8>;
153 interrupt-parent = <700>;
154 interrupts = <42 8>;
155 bus-range = <0 0>;
156 ranges = <02000000 0 a0000000 90000000 0 10000000
157 42000000 0 80000000 80000000 0 10000000
158 01000000 0 00000000 d0000000 0 00100000>;
159 clock-frequency = <0>;
160 #interrupt-cells = <1>;
161 #size-cells = <2>;
162 #address-cells = <3>;
163 reg = <8500 100>;
164 compatible = "83xx";
165 device_type = "pci";
166 };
167
168 pic@700 {
169 linux,phandle = <700>;
170 interrupt-controller;
171 #address-cells = <0>;
172 #interrupt-cells = <2>;
173 reg = <700 100>;
174 built-in;
175 device_type = "ipic";
176 };
177
178 par_io@1400 {
179 reg = <1400 100>;
180 device_type = "par_io";
181 num-ports = <7>;
182
183 ucc_pin@03 {
184 linux,phandle = <140003>;
185 pio-map = <
186 /* port pin dir open_drain assignment has_irq */
187 3 4 3 0 2 0 /* MDIO */
188 3 5 1 0 2 0 /* MDC */
189 0 d 2 0 1 0 /* RX_CLK (CLK9) */
190 3 18 2 0 1 0 /* TX_CLK (CLK10) */
191 1 1 1 0 1 0 /* TxD1 */
192 1 0 1 0 1 0 /* TxD0 */
193 1 1 1 0 1 0 /* TxD1 */
194 1 2 1 0 1 0 /* TxD2 */
195 1 3 1 0 1 0 /* TxD3 */
196 1 4 2 0 1 0 /* RxD0 */
197 1 5 2 0 1 0 /* RxD1 */
198 1 6 2 0 1 0 /* RxD2 */
199 1 7 2 0 1 0 /* RxD3 */
200 1 8 2 0 1 0 /* RX_ER */
201 1 9 1 0 1 0 /* TX_ER */
202 1 a 2 0 1 0 /* RX_DV */
203 1 b 2 0 1 0 /* COL */
204 1 c 1 0 1 0 /* TX_EN */
205 1 d 2 0 1 0>;/* CRS */
206 };
207 ucc_pin@04 {
208 linux,phandle = <140004>;
209 pio-map = <
210 /* port pin dir open_drain assignment has_irq */
211 3 1f 2 0 1 0 /* RX_CLK (CLK7) */
212 3 6 2 0 1 0 /* TX_CLK (CLK8) */
213 1 12 1 0 1 0 /* TxD0 */
214 1 13 1 0 1 0 /* TxD1 */
215 1 14 1 0 1 0 /* TxD2 */
216 1 15 1 0 1 0 /* TxD3 */
217 1 16 2 0 1 0 /* RxD0 */
218 1 17 2 0 1 0 /* RxD1 */
219 1 18 2 0 1 0 /* RxD2 */
220 1 19 2 0 1 0 /* RxD3 */
221 1 1a 2 0 1 0 /* RX_ER */
222 1 1b 1 0 1 0 /* TX_ER */
223 1 1c 2 0 1 0 /* RX_DV */
224 1 1d 2 0 1 0 /* COL */
225 1 1e 1 0 1 0 /* TX_EN */
226 1 1f 2 0 1 0>;/* CRS */
227 };
228 };
229 };
230
231 qe@e0100000 {
232 #address-cells = <1>;
233 #size-cells = <1>;
234 device_type = "qe";
235 model = "QE";
236 ranges = <0 e0100000 00100000>;
237 reg = <e0100000 480>;
238 brg-frequency = <0>;
239 bus-frequency = <BCD3D80>;
240
241 muram@10000 {
242 device_type = "muram";
243 ranges = <0 00010000 00004000>;
244
245 data-only@0 {
246 reg = <0 4000>;
247 };
248 };
249
250 spi@4c0 {
251 device_type = "spi";
252 compatible = "fsl_spi";
253 reg = <4c0 40>;
254 interrupts = <2>;
255 interrupt-parent = <80>;
256 mode = "cpu";
257 };
258
259 spi@500 {
260 device_type = "spi";
261 compatible = "fsl_spi";
262 reg = <500 40>;
263 interrupts = <1>;
264 interrupt-parent = <80>;
265 mode = "cpu";
266 };
267
268 usb@6c0 {
269 device_type = "usb";
270 compatible = "qe_udc";
271 reg = <6c0 40 8B00 100>;
272 interrupts = <b>;
273 interrupt-parent = <80>;
274 mode = "slave";
275 };
276
277 ucc@2200 {
278 device_type = "network";
279 compatible = "ucc_geth";
280 model = "UCC";
281 device-id = <3>;
282 reg = <2200 200>;
283 interrupts = <22>;
284 interrupt-parent = <80>;
285 mac-address = [ 00 04 9f 00 23 23 ];
286 rx-clock = <19>;
287 tx-clock = <1a>;
288 phy-handle = <212003>;
289 pio-handle = <140003>;
290 };
291
292 ucc@3200 {
293 device_type = "network";
294 compatible = "ucc_geth";
295 model = "UCC";
296 device-id = <4>;
297 reg = <3000 200>;
298 interrupts = <23>;
299 interrupt-parent = <80>;
300 mac-address = [ 00 11 22 33 44 55 ];
301 rx-clock = <17>;
302 tx-clock = <18>;
303 phy-handle = <212004>;
304 pio-handle = <140004>;
305 };
306
307 mdio@2320 {
308 #address-cells = <1>;
309 #size-cells = <0>;
310 reg = <2320 18>;
311 device_type = "mdio";
312 compatible = "ucc_geth_phy";
313
314 ethernet-phy@03 {
315 linux,phandle = <212003>;
316 interrupt-parent = <700>;
317 interrupts = <11 2>;
318 reg = <3>;
319 device_type = "ethernet-phy";
320 interface = <3>; //ENET_100_MII
321 };
322 ethernet-phy@04 {
323 linux,phandle = <212004>;
324 interrupt-parent = <700>;
325 interrupts = <12 2>;
326 reg = <4>;
327 device_type = "ethernet-phy";
328 interface = <3>;
329 };
330 };
331
332 qeic@80 {
333 linux,phandle = <80>;
334 interrupt-controller;
335 device_type = "qeic";
336 #address-cells = <0>;
337 #interrupt-cells = <1>;
338 reg = <80 80>;
339 built-in;
340 big-endian;
341 interrupts = <20 8 21 8>; //high:32 low:33
342 interrupt-parent = <700>;
343 };
344 };
345};
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index 2b168486aeba..119bd5d3a834 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -200,7 +200,7 @@
200 a800 0 0 4 40000 31 1>; 200 a800 0 0 4 40000 31 1>;
201 201
202 interrupt-parent = <40000>; 202 interrupt-parent = <40000>;
203 interrupts = <42 0>; 203 interrupts = <8 0>;
204 bus-range = <0 0>; 204 bus-range = <0 0>;
205 ranges = <02000000 0 80000000 80000000 0 20000000 205 ranges = <02000000 0 80000000 80000000 0 20000000
206 01000000 0 00000000 e2000000 0 01000000>; 206 01000000 0 00000000 e2000000 0 01000000>;
@@ -250,7 +250,7 @@
250 rx-clock = <1>; 250 rx-clock = <1>;
251 tx-clock = <1>; 251 tx-clock = <1>;
252 current-speed = <1c200>; 252 current-speed = <1c200>;
253 interrupts = <64 1>; 253 interrupts = <28 8>;
254 interrupt-parent = <90c00>; 254 interrupt-parent = <90c00>;
255 }; 255 };
256 256
@@ -264,7 +264,7 @@
264 rx-clock = <2>; 264 rx-clock = <2>;
265 tx-clock = <2>; 265 tx-clock = <2>;
266 current-speed = <1c200>; 266 current-speed = <1c200>;
267 interrupts = <65 1>; 267 interrupts = <29 8>;
268 interrupt-parent = <90c00>; 268 interrupt-parent = <90c00>;
269 }; 269 };
270 270
@@ -278,7 +278,7 @@
278 clock-setup = <ff00ffff 250000>; 278 clock-setup = <ff00ffff 250000>;
279 rx-clock = <15>; 279 rx-clock = <15>;
280 tx-clock = <16>; 280 tx-clock = <16>;
281 interrupts = <5d 1>; 281 interrupts = <21 8>;
282 interrupt-parent = <90c00>; 282 interrupt-parent = <90c00>;
283 phy-handle = <2452002>; 283 phy-handle = <2452002>;
284 }; 284 };
@@ -293,7 +293,7 @@
293 clock-setup = <ffff00ff 3700>; 293 clock-setup = <ffff00ff 3700>;
294 rx-clock = <17>; 294 rx-clock = <17>;
295 tx-clock = <18>; 295 tx-clock = <18>;
296 interrupts = <5e 1>; 296 interrupts = <22 8>;
297 interrupt-parent = <90c00>; 297 interrupt-parent = <90c00>;
298 phy-handle = <2452003>; 298 phy-handle = <2452003>;
299 }; 299 };
diff --git a/arch/powerpc/boot/dts/mpc866ads.dts b/arch/powerpc/boot/dts/mpc866ads.dts
new file mode 100644
index 000000000000..5d4005239b83
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc866ads.dts
@@ -0,0 +1,162 @@
1/*
2 * MPC866 ADS Device Tree Source
3 *
4 * Copyright 2006 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12
13/ {
14 model = "MPC866ADS";
15 compatible = "mpc8xx";
16 #address-cells = <1>;
17 #size-cells = <1>;
18 linux,phandle = <100>;
19
20 cpus {
21 #cpus = <1>;
22 #address-cells = <1>;
23 #size-cells = <0>;
24 linux,phandle = <200>;
25
26 PowerPC,866@0 {
27 device_type = "cpu";
28 reg = <0>;
29 d-cache-line-size = <20>; // 32 bytes
30 i-cache-line-size = <20>; // 32 bytes
31 d-cache-size = <2000>; // L1, 8K
32 i-cache-size = <4000>; // L1, 16K
33 timebase-frequency = <0>;
34 bus-frequency = <0>;
35 clock-frequency = <0>;
36 32-bit;
37 interrupts = <f 2>; // decrementer interrupt
38 interrupt-parent = <ff000000>;
39 linux,phandle = <201>;
40 linux,boot-cpu;
41 };
42 };
43
44 memory {
45 device_type = "memory";
46 linux,phandle = <300>;
47 reg = <00000000 800000>;
48 };
49
50 soc866@ff000000 {
51 #address-cells = <1>;
52 #size-cells = <1>;
53 #interrupt-cells = <2>;
54 device_type = "soc";
55 ranges = <0 ff000000 00100000>;
56 reg = <ff000000 00000200>;
57 bus-frequency = <0>;
58 mdio@e80 {
59 device_type = "mdio";
60 compatible = "fs_enet";
61 reg = <e80 8>;
62 linux,phandle = <e80>;
63 #address-cells = <1>;
64 #size-cells = <0>;
65 ethernet-phy@f {
66 linux,phandle = <e800f>;
67 reg = <f>;
68 device_type = "ethernet-phy";
69 };
70 };
71
72 fec@e00 {
73 device_type = "network";
74 compatible = "fs_enet";
75 model = "FEC";
76 device-id = <1>;
77 reg = <e00 188>;
78 mac-address = [ 00 00 0C 00 01 FD ];
79 interrupts = <3 1>;
80 interrupt-parent = <ff000000>;
81 phy-handle = <e800f>;
82 };
83
84 pic@ff000000 {
85 linux,phandle = <ff000000>;
86 interrupt-controller;
87 #address-cells = <0>;
88 #interrupt-cells = <2>;
89 reg = <0 24>;
90 built-in;
91 device_type = "mpc8xx-pic";
92 compatible = "CPM";
93 };
94
95 cpm@ff000000 {
96 linux,phandle = <ff000000>;
97 #address-cells = <1>;
98 #size-cells = <1>;
99 #interrupt-cells = <2>;
100 device_type = "cpm";
101 model = "CPM";
102 ranges = <0 0 4000>;
103 reg = <860 f0>;
104 command-proc = <9c0>;
105 brg-frequency = <0>;
106 interrupts = <0 2>; // cpm error interrupt
107 interrupt-parent = <930>;
108
109 pic@930 {
110 linux,phandle = <930>;
111 interrupt-controller;
112 #address-cells = <0>;
113 #interrupt-cells = <2>;
114 interrupts = <5 2 0 2>;
115 interrupt-parent = <ff000000>;
116 reg = <930 20>;
117 built-in;
118 device_type = "cpm-pic";
119 compatible = "CPM";
120 };
121
122 smc@a80 {
123 device_type = "serial";
124 compatible = "cpm_uart";
125 model = "SMC";
126 device-id = <1>;
127 reg = <a80 10 3e80 40>;
128 clock-setup = <00ffffff 0>;
129 rx-clock = <1>;
130 tx-clock = <1>;
131 current-speed = <0>;
132 interrupts = <4 3>;
133 interrupt-parent = <930>;
134 };
135
136 smc@a90 {
137 device_type = "serial";
138 compatible = "cpm_uart";
139 model = "SMC";
140 device-id = <2>;
141 reg = <a90 20 3f80 40>;
142 clock-setup = <ff00ffff 90000>;
143 rx-clock = <2>;
144 tx-clock = <2>;
145 current-speed = <0>;
146 interrupts = <3 3>;
147 interrupt-parent = <930>;
148 };
149
150 scc@a00 {
151 device_type = "network";
152 compatible = "fs_enet";
153 model = "SCC";
154 device-id = <1>;
155 reg = <a00 18 3c00 80>;
156 mac-address = [ 00 00 0C 00 03 FD ];
157 interrupts = <1e 3>;
158 interrupt-parent = <930>;
159 };
160 };
161 };
162};
diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts
new file mode 100644
index 000000000000..cf1a19f962c5
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc885ads.dts
@@ -0,0 +1,185 @@
1/*
2 * MPC885 ADS Device Tree Source
3 *
4 * Copyright 2006 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12
13/ {
14 model = "MPC885ADS";
15 compatible = "mpc8xx";
16 #address-cells = <1>;
17 #size-cells = <1>;
18 linux,phandle = <100>;
19
20 cpus {
21 #cpus = <1>;
22 #address-cells = <1>;
23 #size-cells = <0>;
24 linux,phandle = <200>;
25
26 PowerPC,885@0 {
27 device_type = "cpu";
28 reg = <0>;
29 d-cache-line-size = <20>; // 32 bytes
30 i-cache-line-size = <20>; // 32 bytes
31 d-cache-size = <2000>; // L1, 8K
32 i-cache-size = <2000>; // L1, 8K
33 timebase-frequency = <0>;
34 bus-frequency = <0>;
35 clock-frequency = <0>;
36 32-bit;
37 interrupts = <f 2>; // decrementer interrupt
38 interrupt-parent = <ff000000>;
39 linux,phandle = <201>;
40 linux,boot-cpu;
41 };
42 };
43
44 memory {
45 device_type = "memory";
46 linux,phandle = <300>;
47 reg = <00000000 800000>;
48 };
49
50 soc885@ff000000 {
51 #address-cells = <1>;
52 #size-cells = <1>;
53 #interrupt-cells = <2>;
54 device_type = "soc";
55 ranges = <0 ff000000 00100000>;
56 reg = <ff000000 00000200>;
57 bus-frequency = <0>;
58 mdio@e80 {
59 device_type = "mdio";
60 compatible = "fs_enet";
61 reg = <e80 8>;
62 linux,phandle = <e80>;
63 #address-cells = <1>;
64 #size-cells = <0>;
65 ethernet-phy@0 {
66 linux,phandle = <e8000>;
67 reg = <0>;
68 device_type = "ethernet-phy";
69 };
70 ethernet-phy@1 {
71 linux,phandle = <e8001>;
72 reg = <1>;
73 device_type = "ethernet-phy";
74 };
75 ethernet-phy@2 {
76 linux,phandle = <e8002>;
77 reg = <2>;
78 device_type = "ethernet-phy";
79 };
80 };
81
82 fec@e00 {
83 device_type = "network";
84 compatible = "fs_enet";
85 model = "FEC";
86 device-id = <1>;
87 reg = <e00 188>;
88 mac-address = [ 00 00 0C 00 01 FD ];
89 interrupts = <3 1>;
90 interrupt-parent = <ff000000>;
91 phy-handle = <e8000>;
92 };
93
94 fec@1e00 {
95 device_type = "network";
96 compatible = "fs_enet";
97 model = "FEC";
98 device-id = <2>;
99 reg = <1e00 188>;
100 mac-address = [ 00 00 0C 00 02 FD ];
101 interrupts = <7 1>;
102 interrupt-parent = <ff000000>;
103 phy-handle = <e8001>;
104 };
105
106 pic@ff000000 {
107 linux,phandle = <ff000000>;
108 interrupt-controller;
109 #address-cells = <0>;
110 #interrupt-cells = <2>;
111 reg = <0 24>;
112 built-in;
113 device_type = "mpc8xx-pic";
114 compatible = "CPM";
115 };
116
117 cpm@ff000000 {
118 linux,phandle = <ff000000>;
119 #address-cells = <1>;
120 #size-cells = <1>;
121 #interrupt-cells = <2>;
122 device_type = "cpm";
123 model = "CPM";
124 ranges = <0 0 4000>;
125 reg = <860 f0>;
126 command-proc = <9c0>;
127 brg-frequency = <0>;
128 interrupts = <0 2>; // cpm error interrupt
129 interrupt-parent = <930>;
130
131 pic@930 {
132 linux,phandle = <930>;
133 interrupt-controller;
134 #address-cells = <0>;
135 #interrupt-cells = <2>;
136 interrupts = <5 2 0 2>;
137 interrupt-parent = <ff000000>;
138 reg = <930 20>;
139 built-in;
140 device_type = "cpm-pic";
141 compatible = "CPM";
142 };
143
144 smc@a80 {
145 device_type = "serial";
146 compatible = "cpm_uart";
147 model = "SMC";
148 device-id = <1>;
149 reg = <a80 10 3e80 40>;
150 clock-setup = <00ffffff 0>;
151 rx-clock = <1>;
152 tx-clock = <1>;
153 current-speed = <0>;
154 interrupts = <4 3>;
155 interrupt-parent = <930>;
156 };
157
158 smc@a90 {
159 device_type = "serial";
160 compatible = "cpm_uart";
161 model = "SMC";
162 device-id = <2>;
163 reg = <a90 20 3f80 40>;
164 clock-setup = <ff00ffff 90000>;
165 rx-clock = <2>;
166 tx-clock = <2>;
167 current-speed = <0>;
168 interrupts = <3 3>;
169 interrupt-parent = <930>;
170 };
171
172 scc@a40 {
173 device_type = "network";
174 compatible = "fs_enet";
175 model = "SCC";
176 device-id = <3>;
177 reg = <a40 18 3e00 80>;
178 mac-address = [ 00 00 0C 00 03 FD ];
179 interrupts = <1c 3>;
180 interrupt-parent = <930>;
181 phy-handle = <e8002>;
182 };
183 };
184 };
185};
diff --git a/arch/powerpc/configs/celleb_defconfig b/arch/powerpc/configs/celleb_defconfig
new file mode 100644
index 000000000000..a1fe97197ead
--- /dev/null
+++ b/arch/powerpc/configs/celleb_defconfig
@@ -0,0 +1,1408 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc4
4# Thu Jan 11 20:55:33 2007
5#
6CONFIG_PPC64=y
7CONFIG_64BIT=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
13CONFIG_ARCH_HAS_ILOG2_U32=y
14CONFIG_ARCH_HAS_ILOG2_U64=y
15CONFIG_GENERIC_HWEIGHT=y
16CONFIG_GENERIC_CALIBRATE_DELAY=y
17CONFIG_GENERIC_FIND_NEXT_BIT=y
18CONFIG_PPC=y
19CONFIG_EARLY_PRINTK=y
20CONFIG_COMPAT=y
21CONFIG_SYSVIPC_COMPAT=y
22CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
23CONFIG_ARCH_MAY_HAVE_PC_FDC=y
24CONFIG_PPC_OF=y
25# CONFIG_PPC_UDBG_16550 is not set
26# CONFIG_GENERIC_TBSYNC is not set
27CONFIG_AUDIT_ARCH=y
28CONFIG_GENERIC_BUG=y
29# CONFIG_DEFAULT_UIMAGE is not set
30
31#
32# Processor support
33#
34# CONFIG_POWER4_ONLY is not set
35CONFIG_POWER3=y
36CONFIG_POWER4=y
37CONFIG_PPC_FPU=y
38# CONFIG_PPC_DCR_NATIVE is not set
39# CONFIG_PPC_DCR_MMIO is not set
40CONFIG_PPC_OF_PLATFORM_PCI=y
41CONFIG_ALTIVEC=y
42CONFIG_PPC_STD_MMU=y
43CONFIG_VIRT_CPU_ACCOUNTING=y
44CONFIG_SMP=y
45CONFIG_NR_CPUS=4
46CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
47
48#
49# Code maturity level options
50#
51CONFIG_EXPERIMENTAL=y
52CONFIG_LOCK_KERNEL=y
53CONFIG_INIT_ENV_ARG_LIMIT=32
54
55#
56# General setup
57#
58CONFIG_LOCALVERSION=""
59CONFIG_LOCALVERSION_AUTO=y
60CONFIG_SWAP=y
61CONFIG_SYSVIPC=y
62# CONFIG_IPC_NS is not set
63# CONFIG_POSIX_MQUEUE is not set
64# CONFIG_BSD_PROCESS_ACCT is not set
65# CONFIG_TASKSTATS is not set
66# CONFIG_UTS_NS is not set
67# CONFIG_AUDIT is not set
68CONFIG_IKCONFIG=y
69CONFIG_IKCONFIG_PROC=y
70# CONFIG_CPUSETS is not set
71CONFIG_SYSFS_DEPRECATED=y
72# CONFIG_RELAY is not set
73CONFIG_INITRAMFS_SOURCE=""
74CONFIG_CC_OPTIMIZE_FOR_SIZE=y
75CONFIG_SYSCTL=y
76# CONFIG_EMBEDDED is not set
77CONFIG_SYSCTL_SYSCALL=y
78CONFIG_KALLSYMS=y
79# CONFIG_KALLSYMS_ALL is not set
80# CONFIG_KALLSYMS_EXTRA_PASS is not set
81CONFIG_HOTPLUG=y
82CONFIG_PRINTK=y
83CONFIG_BUG=y
84CONFIG_ELF_CORE=y
85CONFIG_BASE_FULL=y
86CONFIG_FUTEX=y
87CONFIG_EPOLL=y
88CONFIG_SHMEM=y
89CONFIG_SLAB=y
90CONFIG_VM_EVENT_COUNTERS=y
91CONFIG_RT_MUTEXES=y
92# CONFIG_TINY_SHMEM is not set
93CONFIG_BASE_SMALL=0
94# CONFIG_SLOB is not set
95
96#
97# Loadable module support
98#
99CONFIG_MODULES=y
100CONFIG_MODULE_UNLOAD=y
101# CONFIG_MODULE_FORCE_UNLOAD is not set
102CONFIG_MODVERSIONS=y
103CONFIG_MODULE_SRCVERSION_ALL=y
104CONFIG_KMOD=y
105CONFIG_STOP_MACHINE=y
106
107#
108# Block layer
109#
110CONFIG_BLOCK=y
111# CONFIG_BLK_DEV_IO_TRACE is not set
112
113#
114# IO Schedulers
115#
116CONFIG_IOSCHED_NOOP=y
117CONFIG_IOSCHED_AS=y
118CONFIG_IOSCHED_DEADLINE=y
119CONFIG_IOSCHED_CFQ=y
120CONFIG_DEFAULT_AS=y
121# CONFIG_DEFAULT_DEADLINE is not set
122# CONFIG_DEFAULT_CFQ is not set
123# CONFIG_DEFAULT_NOOP is not set
124CONFIG_DEFAULT_IOSCHED="anticipatory"
125
126#
127# Platform support
128#
129CONFIG_PPC_MULTIPLATFORM=y
130# CONFIG_EMBEDDED6xx is not set
131# CONFIG_APUS is not set
132# CONFIG_PPC_PSERIES is not set
133# CONFIG_PPC_ISERIES is not set
134# CONFIG_PPC_MPC52xx is not set
135# CONFIG_PPC_PMAC is not set
136# CONFIG_PPC_MAPLE is not set
137# CONFIG_PPC_PASEMI is not set
138CONFIG_PPC_CELL=y
139# CONFIG_PPC_CELL_NATIVE is not set
140# CONFIG_PPC_IBM_CELL_BLADE is not set
141# CONFIG_PPC_PS3 is not set
142CONFIG_PPC_CELLEB=y
143CONFIG_PPC_UDBG_BEAT=y
144# CONFIG_U3_DART is not set
145# CONFIG_PPC_RTAS is not set
146# CONFIG_MMIO_NVRAM is not set
147# CONFIG_PPC_MPC106 is not set
148# CONFIG_PPC_970_NAP is not set
149# CONFIG_PPC_INDIRECT_IO is not set
150# CONFIG_GENERIC_IOMAP is not set
151# CONFIG_CPU_FREQ is not set
152# CONFIG_WANT_EARLY_SERIAL is not set
153# CONFIG_MPIC is not set
154
155#
156# Cell Broadband Engine options
157#
158CONFIG_SPU_FS=y
159CONFIG_SPU_BASE=y
160# CONFIG_CBE_RAS is not set
161
162#
163# Kernel options
164#
165# CONFIG_HZ_100 is not set
166CONFIG_HZ_250=y
167# CONFIG_HZ_300 is not set
168# CONFIG_HZ_1000 is not set
169CONFIG_HZ=250
170CONFIG_PREEMPT_NONE=y
171# CONFIG_PREEMPT_VOLUNTARY is not set
172# CONFIG_PREEMPT is not set
173CONFIG_PREEMPT_BKL=y
174CONFIG_BINFMT_ELF=y
175CONFIG_BINFMT_MISC=m
176CONFIG_FORCE_MAX_ZONEORDER=13
177# CONFIG_IOMMU_VMERGE is not set
178CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
179CONFIG_KEXEC=y
180# CONFIG_CRASH_DUMP is not set
181# CONFIG_IRQ_ALL_CPUS is not set
182CONFIG_NUMA=y
183CONFIG_NODES_SHIFT=4
184CONFIG_ARCH_SELECT_MEMORY_MODEL=y
185CONFIG_ARCH_SPARSEMEM_ENABLE=y
186CONFIG_ARCH_SPARSEMEM_DEFAULT=y
187CONFIG_ARCH_POPULATES_NODE_MAP=y
188CONFIG_SELECT_MEMORY_MODEL=y
189# CONFIG_FLATMEM_MANUAL is not set
190# CONFIG_DISCONTIGMEM_MANUAL is not set
191CONFIG_SPARSEMEM_MANUAL=y
192CONFIG_SPARSEMEM=y
193CONFIG_NEED_MULTIPLE_NODES=y
194CONFIG_HAVE_MEMORY_PRESENT=y
195# CONFIG_SPARSEMEM_STATIC is not set
196CONFIG_SPARSEMEM_EXTREME=y
197CONFIG_MEMORY_HOTPLUG=y
198CONFIG_MEMORY_HOTPLUG_SPARSE=y
199CONFIG_SPLIT_PTLOCK_CPUS=4
200CONFIG_MIGRATION=y
201CONFIG_RESOURCES_64BIT=y
202CONFIG_ARCH_MEMORY_PROBE=y
203CONFIG_NODES_SPAN_OTHER_NODES=y
204# CONFIG_PPC_64K_PAGES is not set
205# CONFIG_SCHED_SMT is not set
206CONFIG_PROC_DEVICETREE=y
207# CONFIG_CMDLINE_BOOL is not set
208# CONFIG_PM is not set
209CONFIG_SECCOMP=y
210CONFIG_ISA_DMA_API=y
211
212#
213# Bus options
214#
215CONFIG_GENERIC_ISA_DMA=y
216# CONFIG_MPIC_WEIRD is not set
217# CONFIG_PPC_I8259 is not set
218# CONFIG_PPC_INDIRECT_PCI is not set
219CONFIG_PCI=y
220CONFIG_PCI_DOMAINS=y
221# CONFIG_PCIEPORTBUS is not set
222# CONFIG_PCI_DEBUG is not set
223
224#
225# PCCARD (PCMCIA/CardBus) support
226#
227# CONFIG_PCCARD is not set
228
229#
230# PCI Hotplug Support
231#
232# CONFIG_HOTPLUG_PCI is not set
233CONFIG_KERNEL_START=0xc000000000000000
234
235#
236# Networking
237#
238CONFIG_NET=y
239
240#
241# Networking options
242#
243# CONFIG_NETDEBUG is not set
244CONFIG_PACKET=y
245# CONFIG_PACKET_MMAP is not set
246CONFIG_UNIX=y
247CONFIG_XFRM=y
248# CONFIG_XFRM_USER is not set
249# CONFIG_XFRM_SUB_POLICY is not set
250# CONFIG_NET_KEY is not set
251CONFIG_INET=y
252CONFIG_IP_MULTICAST=y
253# CONFIG_IP_ADVANCED_ROUTER is not set
254CONFIG_IP_FIB_HASH=y
255# CONFIG_IP_PNP is not set
256# CONFIG_NET_IPIP is not set
257# CONFIG_NET_IPGRE is not set
258# CONFIG_IP_MROUTE is not set
259# CONFIG_ARPD is not set
260CONFIG_SYN_COOKIES=y
261# CONFIG_INET_AH is not set
262# CONFIG_INET_ESP is not set
263# CONFIG_INET_IPCOMP is not set
264# CONFIG_INET_XFRM_TUNNEL is not set
265# CONFIG_INET_TUNNEL is not set
266CONFIG_INET_XFRM_MODE_TRANSPORT=y
267CONFIG_INET_XFRM_MODE_TUNNEL=y
268CONFIG_INET_XFRM_MODE_BEET=y
269CONFIG_INET_DIAG=y
270CONFIG_INET_TCP_DIAG=y
271# CONFIG_TCP_CONG_ADVANCED is not set
272CONFIG_TCP_CONG_CUBIC=y
273CONFIG_DEFAULT_TCP_CONG="cubic"
274# CONFIG_TCP_MD5SIG is not set
275
276#
277# IP: Virtual Server Configuration
278#
279# CONFIG_IP_VS is not set
280CONFIG_IPV6=y
281# CONFIG_IPV6_PRIVACY is not set
282# CONFIG_IPV6_ROUTER_PREF is not set
283CONFIG_INET6_AH=m
284CONFIG_INET6_ESP=m
285CONFIG_INET6_IPCOMP=m
286# CONFIG_IPV6_MIP6 is not set
287CONFIG_INET6_XFRM_TUNNEL=m
288CONFIG_INET6_TUNNEL=m
289CONFIG_INET6_XFRM_MODE_TRANSPORT=y
290CONFIG_INET6_XFRM_MODE_TUNNEL=y
291CONFIG_INET6_XFRM_MODE_BEET=y
292# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
293CONFIG_IPV6_SIT=y
294CONFIG_IPV6_TUNNEL=m
295# CONFIG_IPV6_MULTIPLE_TABLES is not set
296# CONFIG_NETWORK_SECMARK is not set
297CONFIG_NETFILTER=y
298# CONFIG_NETFILTER_DEBUG is not set
299
300#
301# Core Netfilter Configuration
302#
303# CONFIG_NETFILTER_NETLINK is not set
304# CONFIG_NF_CONNTRACK_ENABLED is not set
305# CONFIG_NETFILTER_XTABLES is not set
306
307#
308# IP: Netfilter Configuration
309#
310CONFIG_IP_NF_QUEUE=m
311
312#
313# IPv6: Netfilter Configuration (EXPERIMENTAL)
314#
315# CONFIG_IP6_NF_QUEUE is not set
316
317#
318# DCCP Configuration (EXPERIMENTAL)
319#
320# CONFIG_IP_DCCP is not set
321
322#
323# SCTP Configuration (EXPERIMENTAL)
324#
325# CONFIG_IP_SCTP is not set
326
327#
328# TIPC Configuration (EXPERIMENTAL)
329#
330# CONFIG_TIPC is not set
331# CONFIG_ATM is not set
332# CONFIG_BRIDGE is not set
333# CONFIG_VLAN_8021Q is not set
334# CONFIG_DECNET is not set
335# CONFIG_LLC2 is not set
336# CONFIG_IPX is not set
337# CONFIG_ATALK is not set
338# CONFIG_X25 is not set
339# CONFIG_LAPB is not set
340# CONFIG_ECONET is not set
341# CONFIG_WAN_ROUTER is not set
342
343#
344# QoS and/or fair queueing
345#
346# CONFIG_NET_SCHED is not set
347
348#
349# Network testing
350#
351# CONFIG_NET_PKTGEN is not set
352# CONFIG_HAMRADIO is not set
353# CONFIG_IRDA is not set
354# CONFIG_BT is not set
355# CONFIG_IEEE80211 is not set
356
357#
358# Device Drivers
359#
360
361#
362# Generic Driver Options
363#
364CONFIG_STANDALONE=y
365CONFIG_PREVENT_FIRMWARE_BUILD=y
366CONFIG_FW_LOADER=y
367# CONFIG_DEBUG_DRIVER is not set
368# CONFIG_SYS_HYPERVISOR is not set
369
370#
371# Connector - unified userspace <-> kernelspace linker
372#
373# CONFIG_CONNECTOR is not set
374
375#
376# Memory Technology Devices (MTD)
377#
378# CONFIG_MTD is not set
379
380#
381# Parallel port support
382#
383# CONFIG_PARPORT is not set
384
385#
386# Plug and Play support
387#
388
389#
390# Block devices
391#
392# CONFIG_BLK_DEV_FD is not set
393# CONFIG_BLK_CPQ_DA is not set
394# CONFIG_BLK_CPQ_CISS_DA is not set
395# CONFIG_BLK_DEV_DAC960 is not set
396# CONFIG_BLK_DEV_UMEM is not set
397# CONFIG_BLK_DEV_COW_COMMON is not set
398CONFIG_BLK_DEV_LOOP=y
399# CONFIG_BLK_DEV_CRYPTOLOOP is not set
400# CONFIG_BLK_DEV_NBD is not set
401# CONFIG_BLK_DEV_SX8 is not set
402# CONFIG_BLK_DEV_UB is not set
403CONFIG_BLK_DEV_RAM=y
404CONFIG_BLK_DEV_RAM_COUNT=16
405CONFIG_BLK_DEV_RAM_SIZE=131072
406CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
407CONFIG_BLK_DEV_INITRD=y
408# CONFIG_CDROM_PKTCDVD is not set
409# CONFIG_ATA_OVER_ETH is not set
410
411#
412# Misc devices
413#
414# CONFIG_SGI_IOC4 is not set
415# CONFIG_TIFM_CORE is not set
416
417#
418# ATA/ATAPI/MFM/RLL support
419#
420CONFIG_IDE=y
421CONFIG_BLK_DEV_IDE=y
422
423#
424# Please see Documentation/ide.txt for help/info on IDE drives
425#
426# CONFIG_BLK_DEV_IDE_SATA is not set
427CONFIG_BLK_DEV_IDEDISK=y
428CONFIG_IDEDISK_MULTI_MODE=y
429CONFIG_BLK_DEV_IDECD=m
430# CONFIG_BLK_DEV_IDETAPE is not set
431# CONFIG_BLK_DEV_IDEFLOPPY is not set
432# CONFIG_BLK_DEV_IDESCSI is not set
433# CONFIG_IDE_TASK_IOCTL is not set
434
435#
436# IDE chipset support/bugfixes
437#
438CONFIG_IDE_GENERIC=y
439CONFIG_BLK_DEV_IDEPCI=y
440CONFIG_IDEPCI_SHARE_IRQ=y
441# CONFIG_BLK_DEV_OFFBOARD is not set
442CONFIG_BLK_DEV_GENERIC=y
443# CONFIG_BLK_DEV_OPTI621 is not set
444CONFIG_BLK_DEV_IDEDMA_PCI=y
445# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
446CONFIG_IDEDMA_PCI_AUTO=y
447# CONFIG_IDEDMA_ONLYDISK is not set
448# CONFIG_BLK_DEV_AEC62XX is not set
449# CONFIG_BLK_DEV_ALI15X3 is not set
450# CONFIG_BLK_DEV_AMD74XX is not set
451# CONFIG_BLK_DEV_CMD64X is not set
452# CONFIG_BLK_DEV_TRIFLEX is not set
453# CONFIG_BLK_DEV_CY82C693 is not set
454# CONFIG_BLK_DEV_CS5520 is not set
455# CONFIG_BLK_DEV_CS5530 is not set
456# CONFIG_BLK_DEV_HPT34X is not set
457# CONFIG_BLK_DEV_HPT366 is not set
458# CONFIG_BLK_DEV_JMICRON is not set
459# CONFIG_BLK_DEV_SC1200 is not set
460# CONFIG_BLK_DEV_PIIX is not set
461# CONFIG_BLK_DEV_IT821X is not set
462# CONFIG_BLK_DEV_NS87415 is not set
463# CONFIG_BLK_DEV_PDC202XX_OLD is not set
464# CONFIG_BLK_DEV_PDC202XX_NEW is not set
465# CONFIG_BLK_DEV_SVWKS is not set
466# CONFIG_BLK_DEV_SIIMAGE is not set
467# CONFIG_BLK_DEV_SL82C105 is not set
468# CONFIG_BLK_DEV_SLC90E66 is not set
469# CONFIG_BLK_DEV_TRM290 is not set
470# CONFIG_BLK_DEV_VIA82CXXX is not set
471CONFIG_BLK_DEV_IDE_CELLEB=y
472# CONFIG_IDE_ARM is not set
473CONFIG_BLK_DEV_IDEDMA=y
474# CONFIG_IDEDMA_IVB is not set
475CONFIG_IDEDMA_AUTO=y
476# CONFIG_BLK_DEV_HD is not set
477
478#
479# SCSI device support
480#
481# CONFIG_RAID_ATTRS is not set
482CONFIG_SCSI=m
483# CONFIG_SCSI_TGT is not set
484# CONFIG_SCSI_NETLINK is not set
485# CONFIG_SCSI_PROC_FS is not set
486
487#
488# SCSI support type (disk, tape, CD-ROM)
489#
490CONFIG_BLK_DEV_SD=m
491# CONFIG_CHR_DEV_ST is not set
492# CONFIG_CHR_DEV_OSST is not set
493CONFIG_BLK_DEV_SR=m
494# CONFIG_BLK_DEV_SR_VENDOR is not set
495CONFIG_CHR_DEV_SG=m
496# CONFIG_CHR_DEV_SCH is not set
497
498#
499# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
500#
501CONFIG_SCSI_MULTI_LUN=y
502# CONFIG_SCSI_CONSTANTS is not set
503# CONFIG_SCSI_LOGGING is not set
504# CONFIG_SCSI_SCAN_ASYNC is not set
505
506#
507# SCSI Transports
508#
509# CONFIG_SCSI_SPI_ATTRS is not set
510# CONFIG_SCSI_FC_ATTRS is not set
511# CONFIG_SCSI_ISCSI_ATTRS is not set
512# CONFIG_SCSI_SAS_ATTRS is not set
513# CONFIG_SCSI_SAS_LIBSAS is not set
514
515#
516# SCSI low-level drivers
517#
518# CONFIG_ISCSI_TCP is not set
519# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
520# CONFIG_SCSI_3W_9XXX is not set
521# CONFIG_SCSI_ACARD is not set
522# CONFIG_SCSI_AACRAID is not set
523# CONFIG_SCSI_AIC7XXX is not set
524# CONFIG_SCSI_AIC7XXX_OLD is not set
525# CONFIG_SCSI_AIC79XX is not set
526# CONFIG_SCSI_AIC94XX is not set
527# CONFIG_SCSI_ARCMSR is not set
528# CONFIG_MEGARAID_NEWGEN is not set
529# CONFIG_MEGARAID_LEGACY is not set
530# CONFIG_MEGARAID_SAS is not set
531# CONFIG_SCSI_HPTIOP is not set
532# CONFIG_SCSI_BUSLOGIC is not set
533# CONFIG_SCSI_DMX3191D is not set
534# CONFIG_SCSI_EATA is not set
535# CONFIG_SCSI_FUTURE_DOMAIN is not set
536# CONFIG_SCSI_GDTH is not set
537# CONFIG_SCSI_IPS is not set
538# CONFIG_SCSI_INITIO is not set
539# CONFIG_SCSI_INIA100 is not set
540# CONFIG_SCSI_STEX is not set
541# CONFIG_SCSI_SYM53C8XX_2 is not set
542# CONFIG_SCSI_QLOGIC_1280 is not set
543# CONFIG_SCSI_QLA_FC is not set
544# CONFIG_SCSI_QLA_ISCSI is not set
545# CONFIG_SCSI_LPFC is not set
546# CONFIG_SCSI_DC395x is not set
547# CONFIG_SCSI_DC390T is not set
548# CONFIG_SCSI_DEBUG is not set
549# CONFIG_SCSI_SRP is not set
550
551#
552# Serial ATA (prod) and Parallel ATA (experimental) drivers
553#
554# CONFIG_ATA is not set
555
556#
557# Multi-device support (RAID and LVM)
558#
559CONFIG_MD=y
560CONFIG_BLK_DEV_MD=m
561CONFIG_MD_LINEAR=m
562CONFIG_MD_RAID0=m
563CONFIG_MD_RAID1=m
564# CONFIG_MD_RAID10 is not set
565# CONFIG_MD_RAID456 is not set
566# CONFIG_MD_MULTIPATH is not set
567# CONFIG_MD_FAULTY is not set
568CONFIG_BLK_DEV_DM=m
569# CONFIG_DM_DEBUG is not set
570CONFIG_DM_CRYPT=m
571CONFIG_DM_SNAPSHOT=m
572CONFIG_DM_MIRROR=m
573CONFIG_DM_ZERO=m
574CONFIG_DM_MULTIPATH=m
575# CONFIG_DM_MULTIPATH_EMC is not set
576
577#
578# Fusion MPT device support
579#
580# CONFIG_FUSION is not set
581# CONFIG_FUSION_SPI is not set
582# CONFIG_FUSION_FC is not set
583# CONFIG_FUSION_SAS is not set
584
585#
586# IEEE 1394 (FireWire) support
587#
588# CONFIG_IEEE1394 is not set
589
590#
591# I2O device support
592#
593# CONFIG_I2O is not set
594
595#
596# Macintosh device drivers
597#
598# CONFIG_MAC_EMUMOUSEBTN is not set
599# CONFIG_WINDFARM is not set
600
601#
602# Network device support
603#
604CONFIG_NETDEVICES=y
605# CONFIG_DUMMY is not set
606# CONFIG_BONDING is not set
607# CONFIG_EQUALIZER is not set
608# CONFIG_TUN is not set
609
610#
611# ARCnet devices
612#
613# CONFIG_ARCNET is not set
614
615#
616# PHY device support
617#
618# CONFIG_PHYLIB is not set
619
620#
621# Ethernet (10 or 100Mbit)
622#
623CONFIG_NET_ETHERNET=y
624CONFIG_MII=y
625# CONFIG_HAPPYMEAL is not set
626# CONFIG_SUNGEM is not set
627# CONFIG_CASSINI is not set
628# CONFIG_NET_VENDOR_3COM is not set
629
630#
631# Tulip family network device support
632#
633# CONFIG_NET_TULIP is not set
634# CONFIG_HP100 is not set
635# CONFIG_NET_PCI is not set
636
637#
638# Ethernet (1000 Mbit)
639#
640# CONFIG_ACENIC is not set
641# CONFIG_DL2K is not set
642# CONFIG_E1000 is not set
643# CONFIG_NS83820 is not set
644# CONFIG_HAMACHI is not set
645# CONFIG_YELLOWFIN is not set
646# CONFIG_R8169 is not set
647# CONFIG_SIS190 is not set
648# CONFIG_SKGE is not set
649# CONFIG_SKY2 is not set
650# CONFIG_SK98LIN is not set
651# CONFIG_TIGON3 is not set
652# CONFIG_BNX2 is not set
653CONFIG_SPIDER_NET=y
654# CONFIG_QLA3XXX is not set
655
656#
657# Ethernet (10000 Mbit)
658#
659# CONFIG_CHELSIO_T1 is not set
660# CONFIG_IXGB is not set
661# CONFIG_S2IO is not set
662# CONFIG_MYRI10GE is not set
663# CONFIG_NETXEN_NIC is not set
664
665#
666# Token Ring devices
667#
668# CONFIG_TR is not set
669
670#
671# Wireless LAN (non-hamradio)
672#
673# CONFIG_NET_RADIO is not set
674
675#
676# Wan interfaces
677#
678# CONFIG_WAN is not set
679# CONFIG_FDDI is not set
680# CONFIG_HIPPI is not set
681# CONFIG_PPP is not set
682# CONFIG_SLIP is not set
683# CONFIG_NET_FC is not set
684# CONFIG_SHAPER is not set
685# CONFIG_NETCONSOLE is not set
686# CONFIG_NETPOLL is not set
687# CONFIG_NET_POLL_CONTROLLER is not set
688
689#
690# ISDN subsystem
691#
692# CONFIG_ISDN is not set
693
694#
695# Telephony Support
696#
697# CONFIG_PHONE is not set
698
699#
700# Input device support
701#
702CONFIG_INPUT=y
703# CONFIG_INPUT_FF_MEMLESS is not set
704
705#
706# Userland interfaces
707#
708CONFIG_INPUT_MOUSEDEV=y
709# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
710CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
711CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
712# CONFIG_INPUT_JOYDEV is not set
713# CONFIG_INPUT_TSDEV is not set
714# CONFIG_INPUT_EVDEV is not set
715# CONFIG_INPUT_EVBUG is not set
716
717#
718# Input Device Drivers
719#
720# CONFIG_INPUT_KEYBOARD is not set
721# CONFIG_INPUT_MOUSE is not set
722# CONFIG_INPUT_JOYSTICK is not set
723# CONFIG_INPUT_TOUCHSCREEN is not set
724# CONFIG_INPUT_MISC is not set
725
726#
727# Hardware I/O ports
728#
729CONFIG_SERIO=y
730# CONFIG_SERIO_I8042 is not set
731CONFIG_SERIO_SERPORT=y
732# CONFIG_SERIO_PCIPS2 is not set
733# CONFIG_SERIO_RAW is not set
734# CONFIG_GAMEPORT is not set
735
736#
737# Character devices
738#
739CONFIG_VT=y
740CONFIG_VT_CONSOLE=y
741CONFIG_HW_CONSOLE=y
742# CONFIG_VT_HW_CONSOLE_BINDING is not set
743CONFIG_SERIAL_NONSTANDARD=y
744# CONFIG_COMPUTONE is not set
745# CONFIG_ROCKETPORT is not set
746# CONFIG_CYCLADES is not set
747# CONFIG_DIGIEPCA is not set
748# CONFIG_MOXA_INTELLIO is not set
749# CONFIG_MOXA_SMARTIO is not set
750# CONFIG_MOXA_SMARTIO_NEW is not set
751# CONFIG_ISI is not set
752# CONFIG_SYNCLINK is not set
753# CONFIG_SYNCLINKMP is not set
754# CONFIG_SYNCLINK_GT is not set
755# CONFIG_N_HDLC is not set
756# CONFIG_SPECIALIX is not set
757# CONFIG_SX is not set
758# CONFIG_RIO is not set
759# CONFIG_STALDRV is not set
760
761#
762# Serial drivers
763#
764# CONFIG_SERIAL_8250 is not set
765
766#
767# Non-8250 serial port support
768#
769CONFIG_SERIAL_CORE=y
770CONFIG_SERIAL_CORE_CONSOLE=y
771CONFIG_SERIAL_TXX9=y
772CONFIG_HAS_TXX9_SERIAL=y
773CONFIG_SERIAL_TXX9_CONSOLE=y
774# CONFIG_SERIAL_TXX9_STDSERIAL is not set
775# CONFIG_SERIAL_JSM is not set
776CONFIG_UNIX98_PTYS=y
777# CONFIG_LEGACY_PTYS is not set
778CONFIG_HVC_DRIVER=y
779CONFIG_HVC_BEAT=y
780
781#
782# IPMI
783#
784# CONFIG_IPMI_HANDLER is not set
785
786#
787# Watchdog Cards
788#
789CONFIG_WATCHDOG=y
790# CONFIG_WATCHDOG_NOWAYOUT is not set
791
792#
793# Watchdog Device Drivers
794#
795# CONFIG_SOFT_WATCHDOG is not set
796
797#
798# PCI-based Watchdog Cards
799#
800# CONFIG_PCIPCWATCHDOG is not set
801# CONFIG_WDTPCI is not set
802
803#
804# USB-based Watchdog Cards
805#
806# CONFIG_USBPCWATCHDOG is not set
807# CONFIG_HW_RANDOM is not set
808CONFIG_GEN_RTC=y
809# CONFIG_GEN_RTC_X is not set
810# CONFIG_DTLK is not set
811# CONFIG_R3964 is not set
812# CONFIG_APPLICOM is not set
813# CONFIG_AGP is not set
814# CONFIG_DRM is not set
815# CONFIG_RAW_DRIVER is not set
816# CONFIG_HANGCHECK_TIMER is not set
817
818#
819# TPM devices
820#
821# CONFIG_TCG_TPM is not set
822
823#
824# I2C support
825#
826CONFIG_I2C=y
827# CONFIG_I2C_CHARDEV is not set
828
829#
830# I2C Algorithms
831#
832CONFIG_I2C_ALGOBIT=y
833# CONFIG_I2C_ALGOPCF is not set
834# CONFIG_I2C_ALGOPCA is not set
835
836#
837# I2C Hardware Bus support
838#
839# CONFIG_I2C_ALI1535 is not set
840# CONFIG_I2C_ALI1563 is not set
841# CONFIG_I2C_ALI15X3 is not set
842# CONFIG_I2C_AMD756 is not set
843# CONFIG_I2C_AMD8111 is not set
844# CONFIG_I2C_I801 is not set
845# CONFIG_I2C_I810 is not set
846# CONFIG_I2C_PIIX4 is not set
847# CONFIG_I2C_NFORCE2 is not set
848# CONFIG_I2C_OCORES is not set
849# CONFIG_I2C_PARPORT_LIGHT is not set
850# CONFIG_I2C_PROSAVAGE is not set
851# CONFIG_I2C_SAVAGE4 is not set
852# CONFIG_I2C_SIS5595 is not set
853# CONFIG_I2C_SIS630 is not set
854# CONFIG_I2C_SIS96X is not set
855# CONFIG_I2C_STUB is not set
856# CONFIG_I2C_VIA is not set
857# CONFIG_I2C_VIAPRO is not set
858# CONFIG_I2C_VOODOO3 is not set
859# CONFIG_I2C_PCA_ISA is not set
860
861#
862# Miscellaneous I2C Chip support
863#
864# CONFIG_SENSORS_DS1337 is not set
865# CONFIG_SENSORS_DS1374 is not set
866# CONFIG_SENSORS_EEPROM is not set
867# CONFIG_SENSORS_PCF8574 is not set
868# CONFIG_SENSORS_PCA9539 is not set
869# CONFIG_SENSORS_PCF8591 is not set
870# CONFIG_SENSORS_MAX6875 is not set
871# CONFIG_I2C_DEBUG_CORE is not set
872# CONFIG_I2C_DEBUG_ALGO is not set
873# CONFIG_I2C_DEBUG_BUS is not set
874# CONFIG_I2C_DEBUG_CHIP is not set
875
876#
877# SPI support
878#
879# CONFIG_SPI is not set
880# CONFIG_SPI_MASTER is not set
881
882#
883# Dallas's 1-wire bus
884#
885# CONFIG_W1 is not set
886
887#
888# Hardware Monitoring support
889#
890# CONFIG_HWMON is not set
891# CONFIG_HWMON_VID is not set
892
893#
894# Multimedia devices
895#
896# CONFIG_VIDEO_DEV is not set
897
898#
899# Digital Video Broadcasting Devices
900#
901# CONFIG_DVB is not set
902# CONFIG_USB_DABUSB is not set
903
904#
905# Graphics support
906#
907# CONFIG_FIRMWARE_EDID is not set
908# CONFIG_FB is not set
909# CONFIG_FB_IBM_GXT4500 is not set
910
911#
912# Console display driver support
913#
914# CONFIG_VGA_CONSOLE is not set
915CONFIG_DUMMY_CONSOLE=y
916# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
917
918#
919# Sound
920#
921# CONFIG_SOUND is not set
922
923#
924# HID Devices
925#
926CONFIG_HID=y
927
928#
929# USB support
930#
931CONFIG_USB_ARCH_HAS_HCD=y
932CONFIG_USB_ARCH_HAS_OHCI=y
933CONFIG_USB_ARCH_HAS_EHCI=y
934CONFIG_USB=y
935# CONFIG_USB_DEBUG is not set
936
937#
938# Miscellaneous USB options
939#
940CONFIG_USB_DEVICEFS=y
941# CONFIG_USB_BANDWIDTH is not set
942# CONFIG_USB_DYNAMIC_MINORS is not set
943# CONFIG_USB_MULTITHREAD_PROBE is not set
944# CONFIG_USB_OTG is not set
945
946#
947# USB Host Controller Drivers
948#
949CONFIG_USB_EHCI_HCD=m
950# CONFIG_USB_EHCI_SPLIT_ISO is not set
951# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
952# CONFIG_USB_EHCI_TT_NEWSCHED is not set
953CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y
954# CONFIG_USB_ISP116X_HCD is not set
955CONFIG_USB_OHCI_HCD=m
956# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
957CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
958CONFIG_USB_OHCI_LITTLE_ENDIAN=y
959# CONFIG_USB_UHCI_HCD is not set
960# CONFIG_USB_SL811_HCD is not set
961
962#
963# USB Device Class drivers
964#
965# CONFIG_USB_ACM is not set
966# CONFIG_USB_PRINTER is not set
967
968#
969# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
970#
971
972#
973# may also be needed; see USB_STORAGE Help for more information
974#
975CONFIG_USB_STORAGE=m
976# CONFIG_USB_STORAGE_DEBUG is not set
977# CONFIG_USB_STORAGE_DATAFAB is not set
978# CONFIG_USB_STORAGE_FREECOM is not set
979# CONFIG_USB_STORAGE_ISD200 is not set
980# CONFIG_USB_STORAGE_DPCM is not set
981# CONFIG_USB_STORAGE_USBAT is not set
982# CONFIG_USB_STORAGE_SDDR09 is not set
983# CONFIG_USB_STORAGE_SDDR55 is not set
984# CONFIG_USB_STORAGE_JUMPSHOT is not set
985# CONFIG_USB_STORAGE_ALAUDA is not set
986# CONFIG_USB_STORAGE_KARMA is not set
987# CONFIG_USB_LIBUSUAL is not set
988
989#
990# USB Input Devices
991#
992CONFIG_USB_HID=y
993# CONFIG_USB_HIDINPUT_POWERBOOK is not set
994# CONFIG_HID_FF is not set
995CONFIG_USB_HIDDEV=y
996# CONFIG_USB_AIPTEK is not set
997# CONFIG_USB_WACOM is not set
998# CONFIG_USB_ACECAD is not set
999# CONFIG_USB_KBTAB is not set
1000# CONFIG_USB_POWERMATE is not set
1001# CONFIG_USB_TOUCHSCREEN is not set
1002# CONFIG_USB_YEALINK is not set
1003# CONFIG_USB_XPAD is not set
1004# CONFIG_USB_ATI_REMOTE is not set
1005# CONFIG_USB_ATI_REMOTE2 is not set
1006# CONFIG_USB_KEYSPAN_REMOTE is not set
1007# CONFIG_USB_APPLETOUCH is not set
1008
1009#
1010# USB Imaging devices
1011#
1012# CONFIG_USB_MDC800 is not set
1013# CONFIG_USB_MICROTEK is not set
1014
1015#
1016# USB Network Adapters
1017#
1018# CONFIG_USB_CATC is not set
1019# CONFIG_USB_KAWETH is not set
1020# CONFIG_USB_PEGASUS is not set
1021# CONFIG_USB_RTL8150 is not set
1022# CONFIG_USB_USBNET_MII is not set
1023# CONFIG_USB_USBNET is not set
1024CONFIG_USB_MON=y
1025
1026#
1027# USB port drivers
1028#
1029
1030#
1031# USB Serial Converter support
1032#
1033# CONFIG_USB_SERIAL is not set
1034
1035#
1036# USB Miscellaneous drivers
1037#
1038# CONFIG_USB_EMI62 is not set
1039# CONFIG_USB_EMI26 is not set
1040# CONFIG_USB_ADUTUX is not set
1041# CONFIG_USB_AUERSWALD is not set
1042# CONFIG_USB_RIO500 is not set
1043# CONFIG_USB_LEGOTOWER is not set
1044# CONFIG_USB_LCD is not set
1045# CONFIG_USB_LED is not set
1046# CONFIG_USB_CYPRESS_CY7C63 is not set
1047# CONFIG_USB_CYTHERM is not set
1048# CONFIG_USB_PHIDGET is not set
1049# CONFIG_USB_IDMOUSE is not set
1050# CONFIG_USB_FTDI_ELAN is not set
1051# CONFIG_USB_APPLEDISPLAY is not set
1052# CONFIG_USB_SISUSBVGA is not set
1053# CONFIG_USB_LD is not set
1054# CONFIG_USB_TRANCEVIBRATOR is not set
1055# CONFIG_USB_TEST is not set
1056
1057#
1058# USB DSL modem support
1059#
1060
1061#
1062# USB Gadget Support
1063#
1064# CONFIG_USB_GADGET is not set
1065
1066#
1067# MMC/SD Card support
1068#
1069# CONFIG_MMC is not set
1070
1071#
1072# LED devices
1073#
1074# CONFIG_NEW_LEDS is not set
1075
1076#
1077# LED drivers
1078#
1079
1080#
1081# LED Triggers
1082#
1083
1084#
1085# InfiniBand support
1086#
1087# CONFIG_INFINIBAND is not set
1088
1089#
1090# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1091#
1092
1093#
1094# Real Time Clock
1095#
1096# CONFIG_RTC_CLASS is not set
1097
1098#
1099# DMA Engine support
1100#
1101# CONFIG_DMA_ENGINE is not set
1102
1103#
1104# DMA Clients
1105#
1106
1107#
1108# DMA Devices
1109#
1110
1111#
1112# Virtualization
1113#
1114
1115#
1116# File systems
1117#
1118CONFIG_EXT2_FS=y
1119CONFIG_EXT2_FS_XATTR=y
1120CONFIG_EXT2_FS_POSIX_ACL=y
1121CONFIG_EXT2_FS_SECURITY=y
1122CONFIG_EXT2_FS_XIP=y
1123CONFIG_FS_XIP=y
1124CONFIG_EXT3_FS=y
1125CONFIG_EXT3_FS_XATTR=y
1126CONFIG_EXT3_FS_POSIX_ACL=y
1127CONFIG_EXT3_FS_SECURITY=y
1128# CONFIG_EXT4DEV_FS is not set
1129CONFIG_JBD=y
1130# CONFIG_JBD_DEBUG is not set
1131CONFIG_FS_MBCACHE=y
1132# CONFIG_REISERFS_FS is not set
1133# CONFIG_JFS_FS is not set
1134CONFIG_FS_POSIX_ACL=y
1135# CONFIG_XFS_FS is not set
1136# CONFIG_GFS2_FS is not set
1137# CONFIG_OCFS2_FS is not set
1138# CONFIG_MINIX_FS is not set
1139# CONFIG_ROMFS_FS is not set
1140CONFIG_INOTIFY=y
1141CONFIG_INOTIFY_USER=y
1142# CONFIG_QUOTA is not set
1143CONFIG_DNOTIFY=y
1144# CONFIG_AUTOFS_FS is not set
1145# CONFIG_AUTOFS4_FS is not set
1146# CONFIG_FUSE_FS is not set
1147
1148#
1149# CD-ROM/DVD Filesystems
1150#
1151CONFIG_ISO9660_FS=m
1152CONFIG_JOLIET=y
1153# CONFIG_ZISOFS is not set
1154CONFIG_UDF_FS=m
1155CONFIG_UDF_NLS=y
1156
1157#
1158# DOS/FAT/NT Filesystems
1159#
1160CONFIG_FAT_FS=m
1161CONFIG_MSDOS_FS=m
1162CONFIG_VFAT_FS=m
1163CONFIG_FAT_DEFAULT_CODEPAGE=437
1164CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1165# CONFIG_NTFS_FS is not set
1166
1167#
1168# Pseudo filesystems
1169#
1170CONFIG_PROC_FS=y
1171CONFIG_PROC_KCORE=y
1172CONFIG_PROC_SYSCTL=y
1173CONFIG_SYSFS=y
1174CONFIG_TMPFS=y
1175# CONFIG_TMPFS_POSIX_ACL is not set
1176CONFIG_HUGETLBFS=y
1177CONFIG_HUGETLB_PAGE=y
1178CONFIG_RAMFS=y
1179# CONFIG_CONFIGFS_FS is not set
1180
1181#
1182# Miscellaneous filesystems
1183#
1184# CONFIG_ADFS_FS is not set
1185# CONFIG_AFFS_FS is not set
1186# CONFIG_HFS_FS is not set
1187# CONFIG_HFSPLUS_FS is not set
1188# CONFIG_BEFS_FS is not set
1189# CONFIG_BFS_FS is not set
1190# CONFIG_EFS_FS is not set
1191# CONFIG_CRAMFS is not set
1192# CONFIG_VXFS_FS is not set
1193# CONFIG_HPFS_FS is not set
1194# CONFIG_QNX4FS_FS is not set
1195# CONFIG_SYSV_FS is not set
1196# CONFIG_UFS_FS is not set
1197
1198#
1199# Network File Systems
1200#
1201CONFIG_NFS_FS=m
1202CONFIG_NFS_V3=y
1203CONFIG_NFS_V3_ACL=y
1204# CONFIG_NFS_V4 is not set
1205# CONFIG_NFS_DIRECTIO is not set
1206CONFIG_NFSD=m
1207CONFIG_NFSD_V2_ACL=y
1208CONFIG_NFSD_V3=y
1209CONFIG_NFSD_V3_ACL=y
1210# CONFIG_NFSD_V4 is not set
1211CONFIG_NFSD_TCP=y
1212CONFIG_LOCKD=m
1213CONFIG_LOCKD_V4=y
1214CONFIG_EXPORTFS=m
1215CONFIG_NFS_ACL_SUPPORT=m
1216CONFIG_NFS_COMMON=y
1217CONFIG_SUNRPC=m
1218# CONFIG_RPCSEC_GSS_KRB5 is not set
1219# CONFIG_RPCSEC_GSS_SPKM3 is not set
1220# CONFIG_SMB_FS is not set
1221# CONFIG_CIFS is not set
1222# CONFIG_NCP_FS is not set
1223# CONFIG_CODA_FS is not set
1224# CONFIG_AFS_FS is not set
1225# CONFIG_9P_FS is not set
1226
1227#
1228# Partition Types
1229#
1230CONFIG_PARTITION_ADVANCED=y
1231# CONFIG_ACORN_PARTITION is not set
1232# CONFIG_OSF_PARTITION is not set
1233# CONFIG_AMIGA_PARTITION is not set
1234# CONFIG_ATARI_PARTITION is not set
1235# CONFIG_MAC_PARTITION is not set
1236CONFIG_MSDOS_PARTITION=y
1237# CONFIG_BSD_DISKLABEL is not set
1238# CONFIG_MINIX_SUBPARTITION is not set
1239# CONFIG_SOLARIS_X86_PARTITION is not set
1240# CONFIG_UNIXWARE_DISKLABEL is not set
1241# CONFIG_LDM_PARTITION is not set
1242# CONFIG_SGI_PARTITION is not set
1243# CONFIG_ULTRIX_PARTITION is not set
1244# CONFIG_SUN_PARTITION is not set
1245# CONFIG_KARMA_PARTITION is not set
1246CONFIG_EFI_PARTITION=y
1247
1248#
1249# Native Language Support
1250#
1251CONFIG_NLS=m
1252CONFIG_NLS_DEFAULT="iso8859-1"
1253# CONFIG_NLS_CODEPAGE_437 is not set
1254# CONFIG_NLS_CODEPAGE_737 is not set
1255# CONFIG_NLS_CODEPAGE_775 is not set
1256# CONFIG_NLS_CODEPAGE_850 is not set
1257# CONFIG_NLS_CODEPAGE_852 is not set
1258# CONFIG_NLS_CODEPAGE_855 is not set
1259# CONFIG_NLS_CODEPAGE_857 is not set
1260# CONFIG_NLS_CODEPAGE_860 is not set
1261# CONFIG_NLS_CODEPAGE_861 is not set
1262# CONFIG_NLS_CODEPAGE_862 is not set
1263# CONFIG_NLS_CODEPAGE_863 is not set
1264# CONFIG_NLS_CODEPAGE_864 is not set
1265# CONFIG_NLS_CODEPAGE_865 is not set
1266# CONFIG_NLS_CODEPAGE_866 is not set
1267# CONFIG_NLS_CODEPAGE_869 is not set
1268# CONFIG_NLS_CODEPAGE_936 is not set
1269# CONFIG_NLS_CODEPAGE_950 is not set
1270# CONFIG_NLS_CODEPAGE_932 is not set
1271# CONFIG_NLS_CODEPAGE_949 is not set
1272# CONFIG_NLS_CODEPAGE_874 is not set
1273# CONFIG_NLS_ISO8859_8 is not set
1274# CONFIG_NLS_CODEPAGE_1250 is not set
1275# CONFIG_NLS_CODEPAGE_1251 is not set
1276# CONFIG_NLS_ASCII is not set
1277CONFIG_NLS_ISO8859_1=m
1278CONFIG_NLS_ISO8859_2=m
1279CONFIG_NLS_ISO8859_3=m
1280CONFIG_NLS_ISO8859_4=m
1281CONFIG_NLS_ISO8859_5=m
1282CONFIG_NLS_ISO8859_6=m
1283CONFIG_NLS_ISO8859_7=m
1284CONFIG_NLS_ISO8859_9=m
1285CONFIG_NLS_ISO8859_13=m
1286CONFIG_NLS_ISO8859_14=m
1287CONFIG_NLS_ISO8859_15=m
1288# CONFIG_NLS_KOI8_R is not set
1289# CONFIG_NLS_KOI8_U is not set
1290# CONFIG_NLS_UTF8 is not set
1291
1292#
1293# Distributed Lock Manager
1294#
1295# CONFIG_DLM is not set
1296
1297#
1298# Library routines
1299#
1300CONFIG_BITREVERSE=y
1301# CONFIG_CRC_CCITT is not set
1302# CONFIG_CRC16 is not set
1303CONFIG_CRC32=y
1304CONFIG_LIBCRC32C=m
1305CONFIG_ZLIB_INFLATE=m
1306CONFIG_ZLIB_DEFLATE=m
1307CONFIG_PLIST=y
1308CONFIG_IOMAP_COPY=y
1309
1310#
1311# Instrumentation Support
1312#
1313# CONFIG_PROFILING is not set
1314# CONFIG_KPROBES is not set
1315
1316#
1317# Kernel hacking
1318#
1319# CONFIG_PRINTK_TIME is not set
1320CONFIG_ENABLE_MUST_CHECK=y
1321CONFIG_MAGIC_SYSRQ=y
1322# CONFIG_UNUSED_SYMBOLS is not set
1323CONFIG_DEBUG_FS=y
1324# CONFIG_HEADERS_CHECK is not set
1325CONFIG_DEBUG_KERNEL=y
1326CONFIG_LOG_BUF_SHIFT=15
1327CONFIG_DETECT_SOFTLOCKUP=y
1328# CONFIG_SCHEDSTATS is not set
1329# CONFIG_DEBUG_SLAB is not set
1330# CONFIG_DEBUG_RT_MUTEXES is not set
1331# CONFIG_RT_MUTEX_TESTER is not set
1332# CONFIG_DEBUG_SPINLOCK is not set
1333CONFIG_DEBUG_MUTEXES=y
1334# CONFIG_DEBUG_RWSEMS is not set
1335CONFIG_DEBUG_SPINLOCK_SLEEP=y
1336# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1337# CONFIG_DEBUG_KOBJECT is not set
1338CONFIG_DEBUG_BUGVERBOSE=y
1339# CONFIG_DEBUG_INFO is not set
1340# CONFIG_DEBUG_VM is not set
1341# CONFIG_DEBUG_LIST is not set
1342# CONFIG_FORCED_INLINING is not set
1343# CONFIG_RCU_TORTURE_TEST is not set
1344# CONFIG_DEBUG_STACKOVERFLOW is not set
1345# CONFIG_DEBUG_STACK_USAGE is not set
1346CONFIG_DEBUGGER=y
1347CONFIG_XMON=y
1348CONFIG_XMON_DEFAULT=y
1349CONFIG_XMON_DISASSEMBLY=y
1350CONFIG_IRQSTACKS=y
1351# CONFIG_BOOTX_TEXT is not set
1352CONFIG_PPC_EARLY_DEBUG=y
1353# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
1354# CONFIG_PPC_EARLY_DEBUG_G5 is not set
1355# CONFIG_PPC_EARLY_DEBUG_RTAS_PANEL is not set
1356# CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE is not set
1357# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1358# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1359CONFIG_PPC_EARLY_DEBUG_BEAT=y
1360
1361#
1362# Security options
1363#
1364# CONFIG_KEYS is not set
1365# CONFIG_SECURITY is not set
1366
1367#
1368# Cryptographic options
1369#
1370CONFIG_CRYPTO=y
1371CONFIG_CRYPTO_ALGAPI=y
1372CONFIG_CRYPTO_BLKCIPHER=m
1373CONFIG_CRYPTO_HASH=y
1374CONFIG_CRYPTO_MANAGER=y
1375CONFIG_CRYPTO_HMAC=y
1376# CONFIG_CRYPTO_XCBC is not set
1377CONFIG_CRYPTO_NULL=m
1378CONFIG_CRYPTO_MD4=m
1379CONFIG_CRYPTO_MD5=y
1380CONFIG_CRYPTO_SHA1=m
1381CONFIG_CRYPTO_SHA256=m
1382CONFIG_CRYPTO_SHA512=m
1383CONFIG_CRYPTO_WP512=m
1384CONFIG_CRYPTO_TGR192=m
1385# CONFIG_CRYPTO_GF128MUL is not set
1386CONFIG_CRYPTO_ECB=m
1387CONFIG_CRYPTO_CBC=m
1388# CONFIG_CRYPTO_LRW is not set
1389CONFIG_CRYPTO_DES=m
1390CONFIG_CRYPTO_BLOWFISH=m
1391CONFIG_CRYPTO_TWOFISH=m
1392CONFIG_CRYPTO_TWOFISH_COMMON=m
1393CONFIG_CRYPTO_SERPENT=m
1394CONFIG_CRYPTO_AES=m
1395CONFIG_CRYPTO_CAST5=m
1396CONFIG_CRYPTO_CAST6=m
1397CONFIG_CRYPTO_TEA=m
1398CONFIG_CRYPTO_ARC4=m
1399CONFIG_CRYPTO_KHAZAD=m
1400CONFIG_CRYPTO_ANUBIS=m
1401CONFIG_CRYPTO_DEFLATE=m
1402CONFIG_CRYPTO_MICHAEL_MIC=m
1403CONFIG_CRYPTO_CRC32C=m
1404CONFIG_CRYPTO_TEST=m
1405
1406#
1407# Hardware crypto devices
1408#
diff --git a/arch/powerpc/configs/mpc8272_ads_defconfig b/arch/powerpc/configs/mpc8272_ads_defconfig
new file mode 100644
index 000000000000..2af45025082f
--- /dev/null
+++ b/arch/powerpc/configs/mpc8272_ads_defconfig
@@ -0,0 +1,848 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-rc5
4# Fri Jul 14 20:36:35 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_FIND_NEXT_BIT=y
16CONFIG_PPC=y
17CONFIG_EARLY_PRINTK=y
18CONFIG_GENERIC_NVRAM=y
19CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
20CONFIG_ARCH_MAY_HAVE_PC_FDC=y
21CONFIG_PPC_OF=y
22# CONFIG_PPC_UDBG_16550 is not set
23# CONFIG_GENERIC_TBSYNC is not set
24# CONFIG_DEFAULT_UIMAGE is not set
25
26#
27# Processor support
28#
29# CONFIG_CLASSIC32 is not set
30# CONFIG_PPC_52xx is not set
31CONFIG_PPC_82xx=y
32# CONFIG_PPC_83xx is not set
33# CONFIG_PPC_85xx is not set
34# CONFIG_40x is not set
35# CONFIG_44x is not set
36# CONFIG_8xx is not set
37# CONFIG_E200 is not set
38CONFIG_6xx=y
39CONFIG_PPC_FPU=y
40CONFIG_PPC_STD_MMU=y
41CONFIG_PPC_STD_MMU_32=y
42# CONFIG_SMP is not set
43
44#
45# Code maturity level options
46#
47# CONFIG_EXPERIMENTAL is not set
48CONFIG_BROKEN_ON_SMP=y
49CONFIG_INIT_ENV_ARG_LIMIT=32
50
51#
52# General setup
53#
54CONFIG_LOCALVERSION="powerpc8272"
55CONFIG_LOCALVERSION_AUTO=y
56CONFIG_SWAP=y
57CONFIG_SYSVIPC=y
58# CONFIG_BSD_PROCESS_ACCT is not set
59CONFIG_SYSCTL=y
60# CONFIG_AUDIT is not set
61CONFIG_IKCONFIG=y
62CONFIG_IKCONFIG_PROC=y
63# CONFIG_RELAY is not set
64CONFIG_INITRAMFS_SOURCE=""
65CONFIG_EMBEDDED=y
66CONFIG_KALLSYMS=y
67CONFIG_KALLSYMS_ALL=y
68CONFIG_KALLSYMS_EXTRA_PASS=y
69CONFIG_HOTPLUG=y
70CONFIG_PRINTK=y
71CONFIG_BUG=y
72CONFIG_ELF_CORE=y
73CONFIG_BASE_FULL=y
74CONFIG_FUTEX=y
75CONFIG_EPOLL=y
76CONFIG_SHMEM=y
77CONFIG_SLAB=y
78# CONFIG_TINY_SHMEM is not set
79CONFIG_BASE_SMALL=0
80# CONFIG_SLOB is not set
81
82#
83# Loadable module support
84#
85# CONFIG_MODULES is not set
86
87#
88# Block layer
89#
90# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set
93
94#
95# IO Schedulers
96#
97CONFIG_IOSCHED_NOOP=y
98CONFIG_IOSCHED_AS=y
99CONFIG_IOSCHED_DEADLINE=y
100CONFIG_IOSCHED_CFQ=y
101CONFIG_DEFAULT_AS=y
102# CONFIG_DEFAULT_DEADLINE is not set
103# CONFIG_DEFAULT_CFQ is not set
104# CONFIG_DEFAULT_NOOP is not set
105CONFIG_DEFAULT_IOSCHED="anticipatory"
106CONFIG_PQ2ADS=y
107CONFIG_8260=y
108CONFIG_8272=y
109CONFIG_CPM2=y
110# CONFIG_WANT_EARLY_SERIAL is not set
111CONFIG_EMBEDDEDBOOT=y
112
113#
114# Platform support
115#
116CONFIG_ADS8272=y
117
118#
119# Kernel options
120#
121# CONFIG_HIGHMEM is not set
122# CONFIG_HZ_100 is not set
123CONFIG_HZ_250=y
124# CONFIG_HZ_1000 is not set
125CONFIG_HZ=250
126CONFIG_PREEMPT_NONE=y
127# CONFIG_PREEMPT_VOLUNTARY is not set
128# CONFIG_PREEMPT is not set
129CONFIG_BINFMT_ELF=y
130CONFIG_BINFMT_MISC=y
131# CONFIG_PC_KEYBOARD is not set
132CONFIG_ARCH_FLATMEM_ENABLE=y
133CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4
137CONFIG_PROC_DEVICETREE=y
138# CONFIG_CMDLINE_BOOL is not set
139# CONFIG_PM is not set
140# CONFIG_SOFTWARE_SUSPEND is not set
141CONFIG_SECCOMP=y
142CONFIG_ISA_DMA_API=y
143
144#
145# Bus options
146#
147# CONFIG_PPC_I8259 is not set
148CONFIG_FSL_SOC=y
149# CONFIG_PCI is not set
150# CONFIG_PCI_DOMAINS is not set
151
152#
153# PCCARD (PCMCIA/CardBus) support
154#
155# CONFIG_PCCARD is not set
156
157#
158# PCI Hotplug Support
159#
160
161#
162# Advanced setup
163#
164# CONFIG_ADVANCED_OPTIONS is not set
165
166#
167# Default settings for advanced configuration options are used
168#
169CONFIG_HIGHMEM_START=0xfe000000
170CONFIG_LOWMEM_SIZE=0x30000000
171CONFIG_KERNEL_START=0xc0000000
172CONFIG_TASK_SIZE=0x80000000
173CONFIG_BOOT_LOAD=0x00400000
174
175#
176# Networking
177#
178CONFIG_NET=y
179
180#
181# Networking options
182#
183# CONFIG_NETDEBUG is not set
184CONFIG_PACKET=y
185# CONFIG_PACKET_MMAP is not set
186CONFIG_UNIX=y
187# CONFIG_NET_KEY is not set
188CONFIG_INET=y
189CONFIG_IP_MULTICAST=y
190# CONFIG_IP_ADVANCED_ROUTER is not set
191CONFIG_IP_FIB_HASH=y
192CONFIG_IP_PNP=y
193CONFIG_IP_PNP_DHCP=y
194CONFIG_IP_PNP_BOOTP=y
195# CONFIG_IP_PNP_RARP is not set
196# CONFIG_NET_IPIP is not set
197# CONFIG_NET_IPGRE is not set
198# CONFIG_IP_MROUTE is not set
199CONFIG_SYN_COOKIES=y
200# CONFIG_INET_AH is not set
201# CONFIG_INET_ESP is not set
202# CONFIG_INET_IPCOMP is not set
203# CONFIG_INET_XFRM_TUNNEL is not set
204# CONFIG_INET_TUNNEL is not set
205CONFIG_INET_DIAG=y
206CONFIG_INET_TCP_DIAG=y
207# CONFIG_TCP_CONG_ADVANCED is not set
208CONFIG_TCP_CONG_BIC=y
209
210#
211# IP: Virtual Server Configuration
212#
213# CONFIG_IP_VS is not set
214CONFIG_IPV6=y
215# CONFIG_IPV6_PRIVACY is not set
216# CONFIG_IPV6_ROUTER_PREF is not set
217# CONFIG_INET6_AH is not set
218# CONFIG_INET6_ESP is not set
219# CONFIG_INET6_IPCOMP is not set
220# CONFIG_INET6_XFRM_TUNNEL is not set
221# CONFIG_INET6_TUNNEL is not set
222# CONFIG_IPV6_TUNNEL is not set
223CONFIG_NETFILTER=y
224# CONFIG_NETFILTER_DEBUG is not set
225
226#
227# Core Netfilter Configuration
228#
229# CONFIG_NETFILTER_NETLINK is not set
230# CONFIG_NETFILTER_XTABLES is not set
231
232#
233# IP: Netfilter Configuration
234#
235# CONFIG_IP_NF_CONNTRACK is not set
236# CONFIG_IP_NF_QUEUE is not set
237# CONFIG_BRIDGE is not set
238# CONFIG_VLAN_8021Q is not set
239# CONFIG_DECNET is not set
240# CONFIG_LLC2 is not set
241# CONFIG_IPX is not set
242# CONFIG_ATALK is not set
243
244#
245# QoS and/or fair queueing
246#
247# CONFIG_NET_SCHED is not set
248
249#
250# Network testing
251#
252# CONFIG_NET_PKTGEN is not set
253# CONFIG_HAMRADIO is not set
254# CONFIG_IRDA is not set
255# CONFIG_BT is not set
256# CONFIG_IEEE80211 is not set
257
258#
259# Device Drivers
260#
261
262#
263# Generic Driver Options
264#
265CONFIG_STANDALONE=y
266CONFIG_PREVENT_FIRMWARE_BUILD=y
267# CONFIG_FW_LOADER is not set
268# CONFIG_DEBUG_DRIVER is not set
269
270#
271# Connector - unified userspace <-> kernelspace linker
272#
273# CONFIG_CONNECTOR is not set
274
275#
276# Memory Technology Devices (MTD)
277#
278# CONFIG_MTD is not set
279
280#
281# Parallel port support
282#
283# CONFIG_PARPORT is not set
284
285#
286# Plug and Play support
287#
288
289#
290# Block devices
291#
292# CONFIG_BLK_DEV_FD is not set
293# CONFIG_BLK_DEV_COW_COMMON is not set
294CONFIG_BLK_DEV_LOOP=y
295# CONFIG_BLK_DEV_CRYPTOLOOP is not set
296# CONFIG_BLK_DEV_NBD is not set
297# CONFIG_BLK_DEV_RAM is not set
298# CONFIG_BLK_DEV_INITRD is not set
299# CONFIG_CDROM_PKTCDVD is not set
300# CONFIG_ATA_OVER_ETH is not set
301
302#
303# ATA/ATAPI/MFM/RLL support
304#
305CONFIG_IDE=y
306CONFIG_BLK_DEV_IDE=y
307
308#
309# Please see Documentation/ide.txt for help/info on IDE drives
310#
311# CONFIG_BLK_DEV_IDE_SATA is not set
312CONFIG_BLK_DEV_IDEDISK=y
313# CONFIG_IDEDISK_MULTI_MODE is not set
314# CONFIG_BLK_DEV_IDECD is not set
315# CONFIG_BLK_DEV_IDEFLOPPY is not set
316# CONFIG_IDE_TASK_IOCTL is not set
317
318#
319# IDE chipset support/bugfixes
320#
321# CONFIG_IDE_GENERIC is not set
322# CONFIG_IDE_ARM is not set
323# CONFIG_BLK_DEV_IDEDMA is not set
324# CONFIG_IDEDMA_AUTO is not set
325# CONFIG_BLK_DEV_HD is not set
326
327#
328# SCSI device support
329#
330# CONFIG_RAID_ATTRS is not set
331# CONFIG_SCSI is not set
332
333#
334# Multi-device support (RAID and LVM)
335#
336# CONFIG_MD is not set
337
338#
339# Fusion MPT device support
340#
341# CONFIG_FUSION is not set
342
343#
344# IEEE 1394 (FireWire) support
345#
346
347#
348# I2O device support
349#
350
351#
352# Macintosh device drivers
353#
354# CONFIG_WINDFARM is not set
355
356#
357# Network device support
358#
359CONFIG_NETDEVICES=y
360# CONFIG_DUMMY is not set
361# CONFIG_BONDING is not set
362# CONFIG_EQUALIZER is not set
363CONFIG_TUN=y
364
365#
366# PHY device support
367#
368CONFIG_PHYLIB=y
369
370#
371# MII PHY device drivers
372#
373# CONFIG_MARVELL_PHY is not set
374CONFIG_DAVICOM_PHY=y
375# CONFIG_QSEMI_PHY is not set
376# CONFIG_LXT_PHY is not set
377# CONFIG_CICADA_PHY is not set
378# CONFIG_FIXED_PHY is not set
379
380#
381# Ethernet (10 or 100Mbit)
382#
383CONFIG_NET_ETHERNET=y
384CONFIG_MII=y
385CONFIG_FS_ENET=y
386# CONFIG_FS_ENET_HAS_SCC is not set
387CONFIG_FS_ENET_HAS_FCC=y
388
389#
390# Ethernet (1000 Mbit)
391#
392
393#
394# Ethernet (10000 Mbit)
395#
396
397#
398# Token Ring devices
399#
400
401#
402# Wireless LAN (non-hamradio)
403#
404# CONFIG_NET_RADIO is not set
405
406#
407# Wan interfaces
408#
409# CONFIG_WAN is not set
410CONFIG_PPP=y
411# CONFIG_PPP_FILTER is not set
412CONFIG_PPP_ASYNC=y
413CONFIG_PPP_SYNC_TTY=y
414CONFIG_PPP_DEFLATE=y
415# CONFIG_PPP_BSDCOMP is not set
416# CONFIG_SLIP is not set
417# CONFIG_NETPOLL is not set
418# CONFIG_NET_POLL_CONTROLLER is not set
419
420#
421# ISDN subsystem
422#
423# CONFIG_ISDN is not set
424
425#
426# Telephony Support
427#
428# CONFIG_PHONE is not set
429
430#
431# Input device support
432#
433CONFIG_INPUT=y
434
435#
436# Userland interfaces
437#
438CONFIG_INPUT_MOUSEDEV=y
439CONFIG_INPUT_MOUSEDEV_PSAUX=y
440CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
441CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
442# CONFIG_INPUT_JOYDEV is not set
443# CONFIG_INPUT_TSDEV is not set
444CONFIG_INPUT_EVDEV=y
445# CONFIG_INPUT_EVBUG is not set
446
447#
448# Input Device Drivers
449#
450CONFIG_INPUT_KEYBOARD=y
451CONFIG_KEYBOARD_ATKBD=y
452# CONFIG_KEYBOARD_SUNKBD is not set
453# CONFIG_KEYBOARD_LKKBD is not set
454# CONFIG_KEYBOARD_XTKBD is not set
455# CONFIG_KEYBOARD_NEWTON is not set
456CONFIG_INPUT_MOUSE=y
457CONFIG_MOUSE_PS2=y
458# CONFIG_MOUSE_SERIAL is not set
459# CONFIG_MOUSE_VSXXXAA is not set
460# CONFIG_INPUT_JOYSTICK is not set
461# CONFIG_INPUT_TOUCHSCREEN is not set
462# CONFIG_INPUT_MISC is not set
463
464#
465# Hardware I/O ports
466#
467CONFIG_SERIO=y
468# CONFIG_SERIO_I8042 is not set
469CONFIG_SERIO_SERPORT=y
470CONFIG_SERIO_LIBPS2=y
471# CONFIG_SERIO_RAW is not set
472# CONFIG_GAMEPORT is not set
473
474#
475# Character devices
476#
477# CONFIG_VT is not set
478# CONFIG_SERIAL_NONSTANDARD is not set
479
480#
481# Serial drivers
482#
483# CONFIG_SERIAL_8250 is not set
484
485#
486# Non-8250 serial port support
487#
488CONFIG_SERIAL_CORE=y
489CONFIG_SERIAL_CORE_CONSOLE=y
490CONFIG_SERIAL_CPM=y
491CONFIG_SERIAL_CPM_CONSOLE=y
492CONFIG_SERIAL_CPM_SCC1=y
493# CONFIG_SERIAL_CPM_SCC2 is not set
494# CONFIG_SERIAL_CPM_SCC3 is not set
495CONFIG_SERIAL_CPM_SCC4=y
496# CONFIG_SERIAL_CPM_SMC1 is not set
497# CONFIG_SERIAL_CPM_SMC2 is not set
498CONFIG_UNIX98_PTYS=y
499CONFIG_LEGACY_PTYS=y
500CONFIG_LEGACY_PTY_COUNT=256
501
502#
503# IPMI
504#
505# CONFIG_IPMI_HANDLER is not set
506
507#
508# Watchdog Cards
509#
510# CONFIG_WATCHDOG is not set
511# CONFIG_NVRAM is not set
512# CONFIG_GEN_RTC is not set
513# CONFIG_DTLK is not set
514# CONFIG_R3964 is not set
515
516#
517# Ftape, the floppy tape device driver
518#
519# CONFIG_AGP is not set
520# CONFIG_RAW_DRIVER is not set
521
522#
523# TPM devices
524#
525
526#
527# I2C support
528#
529# CONFIG_I2C is not set
530
531#
532# SPI support
533#
534# CONFIG_SPI is not set
535# CONFIG_SPI_MASTER is not set
536
537#
538# Dallas's 1-wire bus
539#
540# CONFIG_W1 is not set
541
542#
543# Hardware Monitoring support
544#
545# CONFIG_HWMON is not set
546# CONFIG_HWMON_VID is not set
547
548#
549# Misc devices
550#
551
552#
553# Multimedia devices
554#
555# CONFIG_VIDEO_DEV is not set
556CONFIG_VIDEO_V4L2=y
557
558#
559# Digital Video Broadcasting Devices
560#
561# CONFIG_DVB is not set
562
563#
564# Graphics support
565#
566# CONFIG_FB is not set
567
568#
569# Sound
570#
571# CONFIG_SOUND is not set
572
573#
574# USB support
575#
576# CONFIG_USB_ARCH_HAS_HCD is not set
577# CONFIG_USB_ARCH_HAS_OHCI is not set
578# CONFIG_USB_ARCH_HAS_EHCI is not set
579
580#
581# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
582#
583
584#
585# USB Gadget Support
586#
587CONFIG_USB_GADGET=y
588# CONFIG_USB_GADGET_DEBUG_FILES is not set
589# CONFIG_USB_GADGET_NET2280 is not set
590# CONFIG_USB_GADGET_PXA2XX is not set
591# CONFIG_USB_GADGET_GOKU is not set
592# CONFIG_USB_GADGET_LH7A40X is not set
593# CONFIG_USB_GADGET_OMAP is not set
594# CONFIG_USB_GADGET_AT91 is not set
595# CONFIG_USB_GADGET_DUMMY_HCD is not set
596# CONFIG_USB_GADGET_DUALSPEED is not set
597
598#
599# MMC/SD Card support
600#
601# CONFIG_MMC is not set
602
603#
604# LED devices
605#
606# CONFIG_NEW_LEDS is not set
607
608#
609# LED drivers
610#
611
612#
613# LED Triggers
614#
615
616#
617# InfiniBand support
618#
619
620#
621# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
622#
623
624#
625# Real Time Clock
626#
627
628#
629# File systems
630#
631CONFIG_EXT2_FS=y
632# CONFIG_EXT2_FS_XATTR is not set
633# CONFIG_EXT2_FS_XIP is not set
634CONFIG_EXT3_FS=y
635CONFIG_EXT3_FS_XATTR=y
636# CONFIG_EXT3_FS_POSIX_ACL is not set
637# CONFIG_EXT3_FS_SECURITY is not set
638CONFIG_JBD=y
639# CONFIG_JBD_DEBUG is not set
640CONFIG_FS_MBCACHE=y
641# CONFIG_REISERFS_FS is not set
642# CONFIG_JFS_FS is not set
643CONFIG_FS_POSIX_ACL=y
644CONFIG_XFS_FS=y
645# CONFIG_XFS_QUOTA is not set
646# CONFIG_XFS_SECURITY is not set
647# CONFIG_XFS_POSIX_ACL is not set
648# CONFIG_MINIX_FS is not set
649# CONFIG_ROMFS_FS is not set
650CONFIG_INOTIFY=y
651# CONFIG_QUOTA is not set
652CONFIG_DNOTIFY=y
653# CONFIG_AUTOFS_FS is not set
654CONFIG_AUTOFS4_FS=y
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
674CONFIG_PROC_KCORE=y
675CONFIG_SYSFS=y
676CONFIG_TMPFS=y
677# CONFIG_HUGETLB_PAGE is not set
678CONFIG_RAMFS=y
679
680#
681# Miscellaneous filesystems
682#
683# CONFIG_HFSPLUS_FS is not set
684CONFIG_CRAMFS=y
685# CONFIG_VXFS_FS is not set
686# CONFIG_HPFS_FS is not set
687# CONFIG_QNX4FS_FS is not set
688# CONFIG_SYSV_FS is not set
689# CONFIG_UFS_FS is not set
690
691#
692# Network File Systems
693#
694CONFIG_NFS_FS=y
695CONFIG_NFS_V3=y
696CONFIG_NFS_V3_ACL=y
697# CONFIG_NFSD is not set
698CONFIG_ROOT_NFS=y
699CONFIG_LOCKD=y
700CONFIG_LOCKD_V4=y
701CONFIG_NFS_ACL_SUPPORT=y
702CONFIG_NFS_COMMON=y
703CONFIG_SUNRPC=y
704CONFIG_SMB_FS=y
705# CONFIG_SMB_NLS_DEFAULT is not set
706# CONFIG_CIFS is not set
707# CONFIG_NCP_FS is not set
708# CONFIG_CODA_FS is not set
709
710#
711# Partition Types
712#
713CONFIG_PARTITION_ADVANCED=y
714# CONFIG_ACORN_PARTITION is not set
715# CONFIG_OSF_PARTITION is not set
716# CONFIG_AMIGA_PARTITION is not set
717# CONFIG_ATARI_PARTITION is not set
718# CONFIG_MAC_PARTITION is not set
719CONFIG_MSDOS_PARTITION=y
720# CONFIG_BSD_DISKLABEL is not set
721# CONFIG_MINIX_SUBPARTITION is not set
722# CONFIG_SOLARIS_X86_PARTITION is not set
723# CONFIG_UNIXWARE_DISKLABEL is not set
724# CONFIG_LDM_PARTITION is not set
725# CONFIG_SGI_PARTITION is not set
726# CONFIG_ULTRIX_PARTITION is not set
727# CONFIG_SUN_PARTITION is not set
728# CONFIG_KARMA_PARTITION is not set
729# CONFIG_EFI_PARTITION is not set
730
731#
732# Native Language Support
733#
734CONFIG_NLS=y
735CONFIG_NLS_DEFAULT="iso8859-1"
736CONFIG_NLS_CODEPAGE_437=y
737# CONFIG_NLS_CODEPAGE_737 is not set
738# CONFIG_NLS_CODEPAGE_775 is not set
739# CONFIG_NLS_CODEPAGE_850 is not set
740# CONFIG_NLS_CODEPAGE_852 is not set
741# CONFIG_NLS_CODEPAGE_855 is not set
742# CONFIG_NLS_CODEPAGE_857 is not set
743# CONFIG_NLS_CODEPAGE_860 is not set
744# CONFIG_NLS_CODEPAGE_861 is not set
745# CONFIG_NLS_CODEPAGE_862 is not set
746# CONFIG_NLS_CODEPAGE_863 is not set
747# CONFIG_NLS_CODEPAGE_864 is not set
748# CONFIG_NLS_CODEPAGE_865 is not set
749# CONFIG_NLS_CODEPAGE_866 is not set
750# CONFIG_NLS_CODEPAGE_869 is not set
751# CONFIG_NLS_CODEPAGE_936 is not set
752# CONFIG_NLS_CODEPAGE_950 is not set
753# CONFIG_NLS_CODEPAGE_932 is not set
754# CONFIG_NLS_CODEPAGE_949 is not set
755# CONFIG_NLS_CODEPAGE_874 is not set
756# CONFIG_NLS_ISO8859_8 is not set
757# CONFIG_NLS_CODEPAGE_1250 is not set
758# CONFIG_NLS_CODEPAGE_1251 is not set
759CONFIG_NLS_ASCII=y
760CONFIG_NLS_ISO8859_1=y
761# CONFIG_NLS_ISO8859_2 is not set
762# CONFIG_NLS_ISO8859_3 is not set
763# CONFIG_NLS_ISO8859_4 is not set
764# CONFIG_NLS_ISO8859_5 is not set
765# CONFIG_NLS_ISO8859_6 is not set
766# CONFIG_NLS_ISO8859_7 is not set
767# CONFIG_NLS_ISO8859_9 is not set
768# CONFIG_NLS_ISO8859_13 is not set
769# CONFIG_NLS_ISO8859_14 is not set
770# CONFIG_NLS_ISO8859_15 is not set
771# CONFIG_NLS_KOI8_R is not set
772# CONFIG_NLS_KOI8_U is not set
773CONFIG_NLS_UTF8=y
774
775#
776# Library routines
777#
778CONFIG_CRC_CCITT=y
779# CONFIG_CRC16 is not set
780CONFIG_CRC32=y
781# CONFIG_LIBCRC32C is not set
782CONFIG_ZLIB_INFLATE=y
783CONFIG_ZLIB_DEFLATE=y
784
785#
786# Kernel hacking
787#
788# CONFIG_PRINTK_TIME is not set
789# CONFIG_MAGIC_SYSRQ is not set
790CONFIG_DEBUG_KERNEL=y
791CONFIG_LOG_BUF_SHIFT=14
792CONFIG_DETECT_SOFTLOCKUP=y
793# CONFIG_SCHEDSTATS is not set
794# CONFIG_DEBUG_SLAB is not set
795# CONFIG_DEBUG_MUTEXES is not set
796# CONFIG_DEBUG_SPINLOCK is not set
797# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
798# CONFIG_DEBUG_KOBJECT is not set
799CONFIG_DEBUG_INFO=y
800# CONFIG_DEBUG_FS is not set
801# CONFIG_DEBUG_VM is not set
802# CONFIG_UNWIND_INFO is not set
803CONFIG_FORCED_INLINING=y
804# CONFIG_RCU_TORTURE_TEST is not set
805# CONFIG_DEBUGGER is not set
806# CONFIG_KGDB_CONSOLE is not set
807CONFIG_BDI_SWITCH=y
808# CONFIG_BOOTX_TEXT is not set
809# CONFIG_PPC_EARLY_DEBUG is not set
810
811#
812# Security options
813#
814# CONFIG_KEYS is not set
815# CONFIG_SECURITY is not set
816
817#
818# Cryptographic options
819#
820CONFIG_CRYPTO=y
821# CONFIG_CRYPTO_HMAC is not set
822# CONFIG_CRYPTO_NULL is not set
823# CONFIG_CRYPTO_MD4 is not set
824CONFIG_CRYPTO_MD5=y
825# CONFIG_CRYPTO_SHA1 is not set
826# CONFIG_CRYPTO_SHA256 is not set
827# CONFIG_CRYPTO_SHA512 is not set
828# CONFIG_CRYPTO_WP512 is not set
829# CONFIG_CRYPTO_TGR192 is not set
830CONFIG_CRYPTO_DES=y
831# CONFIG_CRYPTO_BLOWFISH is not set
832# CONFIG_CRYPTO_TWOFISH is not set
833# CONFIG_CRYPTO_SERPENT is not set
834# CONFIG_CRYPTO_AES is not set
835# CONFIG_CRYPTO_CAST5 is not set
836# CONFIG_CRYPTO_CAST6 is not set
837# CONFIG_CRYPTO_TEA is not set
838# CONFIG_CRYPTO_ARC4 is not set
839# CONFIG_CRYPTO_KHAZAD is not set
840# CONFIG_CRYPTO_ANUBIS is not set
841# CONFIG_CRYPTO_DEFLATE is not set
842# CONFIG_CRYPTO_MICHAEL_MIC is not set
843# CONFIG_CRYPTO_CRC32C is not set
844# CONFIG_CRYPTO_TEST is not set
845
846#
847# Hardware crypto devices
848#
diff --git a/arch/powerpc/configs/mpc832xemds_defconfig b/arch/powerpc/configs/mpc832xemds_defconfig
new file mode 100644
index 000000000000..e1b36de6b38c
--- /dev/null
+++ b/arch/powerpc/configs/mpc832xemds_defconfig
@@ -0,0 +1,1083 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc5
4# Tue Jan 30 14:27:25 2007
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
13CONFIG_ARCH_HAS_ILOG2_U32=y
14CONFIG_GENERIC_HWEIGHT=y
15CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_FIND_NEXT_BIT=y
17CONFIG_PPC=y
18CONFIG_EARLY_PRINTK=y
19CONFIG_GENERIC_NVRAM=y
20CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
21CONFIG_ARCH_MAY_HAVE_PC_FDC=y
22CONFIG_PPC_OF=y
23CONFIG_PPC_UDBG_16550=y
24# CONFIG_GENERIC_TBSYNC is not set
25CONFIG_AUDIT_ARCH=y
26CONFIG_GENERIC_BUG=y
27CONFIG_DEFAULT_UIMAGE=y
28
29#
30# Processor support
31#
32# CONFIG_CLASSIC32 is not set
33# CONFIG_PPC_82xx is not set
34CONFIG_PPC_83xx=y
35# CONFIG_PPC_85xx is not set
36# CONFIG_PPC_86xx is not set
37# CONFIG_40x is not set
38# CONFIG_44x is not set
39# CONFIG_8xx is not set
40# CONFIG_E200 is not set
41CONFIG_6xx=y
42CONFIG_83xx=y
43CONFIG_PPC_FPU=y
44# CONFIG_PPC_DCR_NATIVE is not set
45# CONFIG_PPC_DCR_MMIO is not set
46CONFIG_PPC_STD_MMU=y
47CONFIG_PPC_STD_MMU_32=y
48# CONFIG_SMP is not set
49CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
50
51#
52# Code maturity level options
53#
54CONFIG_EXPERIMENTAL=y
55CONFIG_BROKEN_ON_SMP=y
56CONFIG_INIT_ENV_ARG_LIMIT=32
57
58#
59# General setup
60#
61CONFIG_LOCALVERSION=""
62CONFIG_LOCALVERSION_AUTO=y
63CONFIG_SWAP=y
64CONFIG_SYSVIPC=y
65# CONFIG_IPC_NS is not set
66# CONFIG_POSIX_MQUEUE is not set
67# CONFIG_BSD_PROCESS_ACCT is not set
68# CONFIG_TASKSTATS is not set
69# CONFIG_UTS_NS is not set
70# CONFIG_AUDIT is not set
71# CONFIG_IKCONFIG is not set
72CONFIG_SYSFS_DEPRECATED=y
73# CONFIG_RELAY is not set
74CONFIG_INITRAMFS_SOURCE=""
75# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
76CONFIG_SYSCTL=y
77CONFIG_EMBEDDED=y
78CONFIG_SYSCTL_SYSCALL=y
79# CONFIG_KALLSYMS is not set
80CONFIG_HOTPLUG=y
81CONFIG_PRINTK=y
82CONFIG_BUG=y
83CONFIG_ELF_CORE=y
84CONFIG_BASE_FULL=y
85CONFIG_FUTEX=y
86# CONFIG_EPOLL is not set
87CONFIG_SHMEM=y
88CONFIG_SLAB=y
89CONFIG_VM_EVENT_COUNTERS=y
90CONFIG_RT_MUTEXES=y
91# CONFIG_TINY_SHMEM is not set
92CONFIG_BASE_SMALL=0
93# CONFIG_SLOB is not set
94
95#
96# Loadable module support
97#
98CONFIG_MODULES=y
99CONFIG_MODULE_UNLOAD=y
100# CONFIG_MODULE_FORCE_UNLOAD is not set
101# CONFIG_MODVERSIONS is not set
102# CONFIG_MODULE_SRCVERSION_ALL is not set
103# CONFIG_KMOD is not set
104
105#
106# Block layer
107#
108CONFIG_BLOCK=y
109# CONFIG_LBD is not set
110# CONFIG_BLK_DEV_IO_TRACE is not set
111# CONFIG_LSF is not set
112
113#
114# IO Schedulers
115#
116CONFIG_IOSCHED_NOOP=y
117CONFIG_IOSCHED_AS=y
118CONFIG_IOSCHED_DEADLINE=y
119CONFIG_IOSCHED_CFQ=y
120CONFIG_DEFAULT_AS=y
121# CONFIG_DEFAULT_DEADLINE is not set
122# CONFIG_DEFAULT_CFQ is not set
123# CONFIG_DEFAULT_NOOP is not set
124CONFIG_DEFAULT_IOSCHED="anticipatory"
125CONFIG_QUICC_ENGINE=y
126CONFIG_PPC_GEN550=y
127# CONFIG_WANT_EARLY_SERIAL is not set
128
129#
130# Platform support
131#
132CONFIG_MPC832x_MDS=y
133# CONFIG_MPC834x_SYS is not set
134# CONFIG_MPC834x_ITX is not set
135# CONFIG_MPC8360E_PB is not set
136CONFIG_PPC_MPC832x=y
137# CONFIG_MPIC is not set
138
139#
140# Kernel options
141#
142# CONFIG_HIGHMEM is not set
143# CONFIG_HZ_100 is not set
144CONFIG_HZ_250=y
145# CONFIG_HZ_300 is not set
146# CONFIG_HZ_1000 is not set
147CONFIG_HZ=250
148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set
151CONFIG_BINFMT_ELF=y
152# CONFIG_BINFMT_MISC is not set
153CONFIG_MATH_EMULATION=y
154CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
155CONFIG_ARCH_FLATMEM_ENABLE=y
156CONFIG_ARCH_POPULATES_NODE_MAP=y
157CONFIG_SELECT_MEMORY_MODEL=y
158CONFIG_FLATMEM_MANUAL=y
159# CONFIG_DISCONTIGMEM_MANUAL is not set
160# CONFIG_SPARSEMEM_MANUAL is not set
161CONFIG_FLATMEM=y
162CONFIG_FLAT_NODE_MEM_MAP=y
163# CONFIG_SPARSEMEM_STATIC is not set
164CONFIG_SPLIT_PTLOCK_CPUS=4
165# CONFIG_RESOURCES_64BIT is not set
166CONFIG_PROC_DEVICETREE=y
167# CONFIG_CMDLINE_BOOL is not set
168# CONFIG_PM is not set
169CONFIG_SECCOMP=y
170CONFIG_ISA_DMA_API=y
171
172#
173# Bus options
174#
175CONFIG_GENERIC_ISA_DMA=y
176# CONFIG_MPIC_WEIRD is not set
177# CONFIG_PPC_I8259 is not set
178CONFIG_PPC_INDIRECT_PCI=y
179CONFIG_FSL_SOC=y
180CONFIG_PCI=y
181CONFIG_PCI_DOMAINS=y
182# CONFIG_PCIEPORTBUS is not set
183
184#
185# PCCARD (PCMCIA/CardBus) support
186#
187# CONFIG_PCCARD is not set
188
189#
190# PCI Hotplug Support
191#
192# CONFIG_HOTPLUG_PCI is not set
193
194#
195# Advanced setup
196#
197# CONFIG_ADVANCED_OPTIONS is not set
198
199#
200# Default settings for advanced configuration options are used
201#
202CONFIG_HIGHMEM_START=0xfe000000
203CONFIG_LOWMEM_SIZE=0x30000000
204CONFIG_KERNEL_START=0xc0000000
205CONFIG_TASK_SIZE=0x80000000
206CONFIG_BOOT_LOAD=0x00800000
207
208#
209# Networking
210#
211CONFIG_NET=y
212
213#
214# Networking options
215#
216# CONFIG_NETDEBUG is not set
217CONFIG_PACKET=y
218# CONFIG_PACKET_MMAP is not set
219CONFIG_UNIX=y
220CONFIG_XFRM=y
221# CONFIG_XFRM_USER is not set
222# CONFIG_XFRM_SUB_POLICY is not set
223# CONFIG_NET_KEY is not set
224CONFIG_INET=y
225CONFIG_IP_MULTICAST=y
226# CONFIG_IP_ADVANCED_ROUTER is not set
227CONFIG_IP_FIB_HASH=y
228CONFIG_IP_PNP=y
229CONFIG_IP_PNP_DHCP=y
230CONFIG_IP_PNP_BOOTP=y
231# CONFIG_IP_PNP_RARP is not set
232# CONFIG_NET_IPIP is not set
233# CONFIG_NET_IPGRE is not set
234# CONFIG_IP_MROUTE is not set
235# CONFIG_ARPD is not set
236CONFIG_SYN_COOKIES=y
237# CONFIG_INET_AH is not set
238# CONFIG_INET_ESP is not set
239# CONFIG_INET_IPCOMP is not set
240# CONFIG_INET_XFRM_TUNNEL is not set
241# CONFIG_INET_TUNNEL is not set
242CONFIG_INET_XFRM_MODE_TRANSPORT=y
243CONFIG_INET_XFRM_MODE_TUNNEL=y
244CONFIG_INET_XFRM_MODE_BEET=y
245CONFIG_INET_DIAG=y
246CONFIG_INET_TCP_DIAG=y
247# CONFIG_TCP_CONG_ADVANCED is not set
248CONFIG_TCP_CONG_CUBIC=y
249CONFIG_DEFAULT_TCP_CONG="cubic"
250# CONFIG_TCP_MD5SIG is not set
251# CONFIG_IPV6 is not set
252# CONFIG_INET6_XFRM_TUNNEL is not set
253# CONFIG_INET6_TUNNEL is not set
254# CONFIG_NETWORK_SECMARK is not set
255# CONFIG_NETFILTER is not set
256
257#
258# DCCP Configuration (EXPERIMENTAL)
259#
260# CONFIG_IP_DCCP is not set
261
262#
263# SCTP Configuration (EXPERIMENTAL)
264#
265# CONFIG_IP_SCTP is not set
266
267#
268# TIPC Configuration (EXPERIMENTAL)
269#
270# CONFIG_TIPC is not set
271# CONFIG_ATM is not set
272# CONFIG_BRIDGE is not set
273# CONFIG_VLAN_8021Q is not set
274# CONFIG_DECNET is not set
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278# CONFIG_X25 is not set
279# CONFIG_LAPB is not set
280# CONFIG_ECONET is not set
281# CONFIG_WAN_ROUTER is not set
282
283#
284# QoS and/or fair queueing
285#
286# CONFIG_NET_SCHED is not set
287
288#
289# Network testing
290#
291# CONFIG_NET_PKTGEN is not set
292# CONFIG_HAMRADIO is not set
293# CONFIG_IRDA is not set
294# CONFIG_BT is not set
295# CONFIG_IEEE80211 is not set
296
297#
298# Device Drivers
299#
300
301#
302# Generic Driver Options
303#
304CONFIG_STANDALONE=y
305CONFIG_PREVENT_FIRMWARE_BUILD=y
306# CONFIG_FW_LOADER is not set
307# CONFIG_SYS_HYPERVISOR is not set
308
309#
310# Connector - unified userspace <-> kernelspace linker
311#
312# CONFIG_CONNECTOR is not set
313
314#
315# Memory Technology Devices (MTD)
316#
317# CONFIG_MTD is not set
318
319#
320# Parallel port support
321#
322# CONFIG_PARPORT is not set
323
324#
325# Plug and Play support
326#
327
328#
329# Block devices
330#
331# CONFIG_BLK_DEV_FD is not set
332# CONFIG_BLK_CPQ_DA is not set
333# CONFIG_BLK_CPQ_CISS_DA is not set
334# CONFIG_BLK_DEV_DAC960 is not set
335# CONFIG_BLK_DEV_UMEM is not set
336# CONFIG_BLK_DEV_COW_COMMON is not set
337CONFIG_BLK_DEV_LOOP=y
338# CONFIG_BLK_DEV_CRYPTOLOOP is not set
339# CONFIG_BLK_DEV_NBD is not set
340# CONFIG_BLK_DEV_SX8 is not set
341CONFIG_BLK_DEV_RAM=y
342CONFIG_BLK_DEV_RAM_COUNT=16
343CONFIG_BLK_DEV_RAM_SIZE=32768
344CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
345CONFIG_BLK_DEV_INITRD=y
346# CONFIG_CDROM_PKTCDVD is not set
347# CONFIG_ATA_OVER_ETH is not set
348
349#
350# Misc devices
351#
352# CONFIG_SGI_IOC4 is not set
353# CONFIG_TIFM_CORE is not set
354
355#
356# ATA/ATAPI/MFM/RLL support
357#
358# CONFIG_IDE is not set
359
360#
361# SCSI device support
362#
363# CONFIG_RAID_ATTRS is not set
364CONFIG_SCSI=y
365# CONFIG_SCSI_TGT is not set
366# CONFIG_SCSI_NETLINK is not set
367CONFIG_SCSI_PROC_FS=y
368
369#
370# SCSI support type (disk, tape, CD-ROM)
371#
372# CONFIG_BLK_DEV_SD is not set
373# CONFIG_CHR_DEV_ST is not set
374# CONFIG_CHR_DEV_OSST is not set
375# CONFIG_BLK_DEV_SR is not set
376# CONFIG_CHR_DEV_SG is not set
377# CONFIG_CHR_DEV_SCH is not set
378
379#
380# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
381#
382# CONFIG_SCSI_MULTI_LUN is not set
383# CONFIG_SCSI_CONSTANTS is not set
384# CONFIG_SCSI_LOGGING is not set
385# CONFIG_SCSI_SCAN_ASYNC is not set
386
387#
388# SCSI Transports
389#
390# CONFIG_SCSI_SPI_ATTRS is not set
391# CONFIG_SCSI_FC_ATTRS is not set
392# CONFIG_SCSI_ISCSI_ATTRS is not set
393# CONFIG_SCSI_SAS_ATTRS is not set
394# CONFIG_SCSI_SAS_LIBSAS is not set
395
396#
397# SCSI low-level drivers
398#
399# CONFIG_ISCSI_TCP is not set
400# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
401# CONFIG_SCSI_3W_9XXX is not set
402# CONFIG_SCSI_ACARD is not set
403# CONFIG_SCSI_AACRAID is not set
404# CONFIG_SCSI_AIC7XXX is not set
405# CONFIG_SCSI_AIC7XXX_OLD is not set
406# CONFIG_SCSI_AIC79XX is not set
407# CONFIG_SCSI_AIC94XX is not set
408# CONFIG_SCSI_DPT_I2O is not set
409# CONFIG_SCSI_ARCMSR is not set
410# CONFIG_MEGARAID_NEWGEN is not set
411# CONFIG_MEGARAID_LEGACY is not set
412# CONFIG_MEGARAID_SAS is not set
413# CONFIG_SCSI_HPTIOP is not set
414# CONFIG_SCSI_BUSLOGIC is not set
415# CONFIG_SCSI_DMX3191D is not set
416# CONFIG_SCSI_EATA is not set
417# CONFIG_SCSI_FUTURE_DOMAIN is not set
418# CONFIG_SCSI_GDTH is not set
419# CONFIG_SCSI_IPS is not set
420# CONFIG_SCSI_INITIO is not set
421# CONFIG_SCSI_INIA100 is not set
422# CONFIG_SCSI_STEX is not set
423# CONFIG_SCSI_SYM53C8XX_2 is not set
424# CONFIG_SCSI_QLOGIC_1280 is not set
425# CONFIG_SCSI_QLA_FC is not set
426# CONFIG_SCSI_QLA_ISCSI is not set
427# CONFIG_SCSI_LPFC is not set
428# CONFIG_SCSI_DC395x is not set
429# CONFIG_SCSI_DC390T is not set
430# CONFIG_SCSI_NSP32 is not set
431# CONFIG_SCSI_DEBUG is not set
432# CONFIG_SCSI_SRP is not set
433
434#
435# Serial ATA (prod) and Parallel ATA (experimental) drivers
436#
437# CONFIG_ATA is not set
438
439#
440# Multi-device support (RAID and LVM)
441#
442# CONFIG_MD is not set
443
444#
445# Fusion MPT device support
446#
447# CONFIG_FUSION is not set
448# CONFIG_FUSION_SPI is not set
449# CONFIG_FUSION_FC is not set
450# CONFIG_FUSION_SAS is not set
451
452#
453# IEEE 1394 (FireWire) support
454#
455# CONFIG_IEEE1394 is not set
456
457#
458# I2O device support
459#
460# CONFIG_I2O is not set
461
462#
463# Macintosh device drivers
464#
465# CONFIG_MAC_EMUMOUSEBTN is not set
466# CONFIG_WINDFARM is not set
467
468#
469# Network device support
470#
471CONFIG_NETDEVICES=y
472# CONFIG_DUMMY is not set
473# CONFIG_BONDING is not set
474# CONFIG_EQUALIZER is not set
475# CONFIG_TUN is not set
476
477#
478# ARCnet devices
479#
480# CONFIG_ARCNET is not set
481
482#
483# PHY device support
484#
485# CONFIG_PHYLIB is not set
486
487#
488# Ethernet (10 or 100Mbit)
489#
490CONFIG_NET_ETHERNET=y
491CONFIG_MII=y
492# CONFIG_HAPPYMEAL is not set
493# CONFIG_SUNGEM is not set
494# CONFIG_CASSINI is not set
495# CONFIG_NET_VENDOR_3COM is not set
496
497#
498# Tulip family network device support
499#
500# CONFIG_NET_TULIP is not set
501# CONFIG_HP100 is not set
502# CONFIG_NET_PCI is not set
503
504#
505# Ethernet (1000 Mbit)
506#
507# CONFIG_ACENIC is not set
508# CONFIG_DL2K is not set
509# CONFIG_E1000 is not set
510# CONFIG_NS83820 is not set
511# CONFIG_HAMACHI is not set
512# CONFIG_YELLOWFIN is not set
513# CONFIG_R8169 is not set
514# CONFIG_SIS190 is not set
515# CONFIG_SKGE is not set
516# CONFIG_SKY2 is not set
517# CONFIG_SK98LIN is not set
518# CONFIG_TIGON3 is not set
519# CONFIG_BNX2 is not set
520# CONFIG_GIANFAR is not set
521CONFIG_UCC_GETH=y
522# CONFIG_UGETH_NAPI is not set
523# CONFIG_UGETH_MAGIC_PACKET is not set
524# CONFIG_UGETH_FILTERING is not set
525# CONFIG_UGETH_TX_ON_DEMOND is not set
526# CONFIG_QLA3XXX is not set
527
528#
529# Ethernet (10000 Mbit)
530#
531# CONFIG_CHELSIO_T1 is not set
532# CONFIG_IXGB is not set
533# CONFIG_S2IO is not set
534# CONFIG_MYRI10GE is not set
535# CONFIG_NETXEN_NIC is not set
536
537#
538# Token Ring devices
539#
540# CONFIG_TR is not set
541
542#
543# Wireless LAN (non-hamradio)
544#
545# CONFIG_NET_RADIO is not set
546
547#
548# Wan interfaces
549#
550# CONFIG_WAN is not set
551# CONFIG_FDDI is not set
552# CONFIG_HIPPI is not set
553# CONFIG_PPP is not set
554# CONFIG_SLIP is not set
555# CONFIG_NET_FC is not set
556# CONFIG_SHAPER is not set
557# CONFIG_NETCONSOLE is not set
558# CONFIG_NETPOLL is not set
559# CONFIG_NET_POLL_CONTROLLER is not set
560
561#
562# ISDN subsystem
563#
564# CONFIG_ISDN is not set
565
566#
567# Telephony Support
568#
569# CONFIG_PHONE is not set
570
571#
572# Input device support
573#
574CONFIG_INPUT=y
575# CONFIG_INPUT_FF_MEMLESS is not set
576
577#
578# Userland interfaces
579#
580# CONFIG_INPUT_MOUSEDEV is not set
581# CONFIG_INPUT_JOYDEV is not set
582# CONFIG_INPUT_TSDEV is not set
583# CONFIG_INPUT_EVDEV is not set
584# CONFIG_INPUT_EVBUG is not set
585
586#
587# Input Device Drivers
588#
589# CONFIG_INPUT_KEYBOARD is not set
590# CONFIG_INPUT_MOUSE is not set
591# CONFIG_INPUT_JOYSTICK is not set
592# CONFIG_INPUT_TOUCHSCREEN is not set
593# CONFIG_INPUT_MISC is not set
594
595#
596# Hardware I/O ports
597#
598# CONFIG_SERIO is not set
599# CONFIG_GAMEPORT is not set
600
601#
602# Character devices
603#
604# CONFIG_VT is not set
605# CONFIG_SERIAL_NONSTANDARD is not set
606
607#
608# Serial drivers
609#
610CONFIG_SERIAL_8250=y
611CONFIG_SERIAL_8250_CONSOLE=y
612CONFIG_SERIAL_8250_PCI=y
613CONFIG_SERIAL_8250_NR_UARTS=4
614CONFIG_SERIAL_8250_RUNTIME_UARTS=4
615# CONFIG_SERIAL_8250_EXTENDED is not set
616
617#
618# Non-8250 serial port support
619#
620# CONFIG_SERIAL_UARTLITE is not set
621CONFIG_SERIAL_CORE=y
622CONFIG_SERIAL_CORE_CONSOLE=y
623# CONFIG_SERIAL_JSM is not set
624CONFIG_UNIX98_PTYS=y
625CONFIG_LEGACY_PTYS=y
626CONFIG_LEGACY_PTY_COUNT=256
627
628#
629# IPMI
630#
631# CONFIG_IPMI_HANDLER is not set
632
633#
634# Watchdog Cards
635#
636CONFIG_WATCHDOG=y
637# CONFIG_WATCHDOG_NOWAYOUT is not set
638
639#
640# Watchdog Device Drivers
641#
642# CONFIG_SOFT_WATCHDOG is not set
643CONFIG_83xx_WDT=y
644
645#
646# PCI-based Watchdog Cards
647#
648# CONFIG_PCIPCWATCHDOG is not set
649# CONFIG_WDTPCI is not set
650CONFIG_HW_RANDOM=y
651# CONFIG_NVRAM is not set
652CONFIG_GEN_RTC=y
653# CONFIG_GEN_RTC_X is not set
654# CONFIG_DTLK is not set
655# CONFIG_R3964 is not set
656# CONFIG_APPLICOM is not set
657# CONFIG_AGP is not set
658# CONFIG_DRM is not set
659# CONFIG_RAW_DRIVER is not set
660
661#
662# TPM devices
663#
664# CONFIG_TCG_TPM is not set
665
666#
667# I2C support
668#
669CONFIG_I2C=y
670CONFIG_I2C_CHARDEV=y
671
672#
673# I2C Algorithms
674#
675# CONFIG_I2C_ALGOBIT is not set
676# CONFIG_I2C_ALGOPCF is not set
677# CONFIG_I2C_ALGOPCA is not set
678
679#
680# I2C Hardware Bus support
681#
682# CONFIG_I2C_ALI1535 is not set
683# CONFIG_I2C_ALI1563 is not set
684# CONFIG_I2C_ALI15X3 is not set
685# CONFIG_I2C_AMD756 is not set
686# CONFIG_I2C_AMD8111 is not set
687# CONFIG_I2C_I801 is not set
688# CONFIG_I2C_I810 is not set
689# CONFIG_I2C_PIIX4 is not set
690CONFIG_I2C_MPC=y
691# CONFIG_I2C_NFORCE2 is not set
692# CONFIG_I2C_OCORES is not set
693# CONFIG_I2C_PARPORT_LIGHT is not set
694# CONFIG_I2C_PROSAVAGE is not set
695# CONFIG_I2C_SAVAGE4 is not set
696# CONFIG_I2C_SIS5595 is not set
697# CONFIG_I2C_SIS630 is not set
698# CONFIG_I2C_SIS96X is not set
699# CONFIG_I2C_STUB is not set
700# CONFIG_I2C_VIA is not set
701# CONFIG_I2C_VIAPRO is not set
702# CONFIG_I2C_VOODOO3 is not set
703# CONFIG_I2C_PCA_ISA is not set
704
705#
706# Miscellaneous I2C Chip support
707#
708# CONFIG_SENSORS_DS1337 is not set
709# CONFIG_SENSORS_DS1374 is not set
710# CONFIG_SENSORS_EEPROM is not set
711# CONFIG_SENSORS_PCF8574 is not set
712# CONFIG_SENSORS_PCA9539 is not set
713# CONFIG_SENSORS_PCF8591 is not set
714# CONFIG_SENSORS_M41T00 is not set
715# CONFIG_SENSORS_MAX6875 is not set
716# CONFIG_I2C_DEBUG_CORE is not set
717# CONFIG_I2C_DEBUG_ALGO is not set
718# CONFIG_I2C_DEBUG_BUS is not set
719# CONFIG_I2C_DEBUG_CHIP is not set
720
721#
722# SPI support
723#
724# CONFIG_SPI is not set
725# CONFIG_SPI_MASTER is not set
726
727#
728# Dallas's 1-wire bus
729#
730# CONFIG_W1 is not set
731
732#
733# Hardware Monitoring support
734#
735CONFIG_HWMON=y
736# CONFIG_HWMON_VID is not set
737# CONFIG_SENSORS_ABITUGURU is not set
738# CONFIG_SENSORS_ADM1021 is not set
739# CONFIG_SENSORS_ADM1025 is not set
740# CONFIG_SENSORS_ADM1026 is not set
741# CONFIG_SENSORS_ADM1031 is not set
742# CONFIG_SENSORS_ADM9240 is not set
743# CONFIG_SENSORS_ASB100 is not set
744# CONFIG_SENSORS_ATXP1 is not set
745# CONFIG_SENSORS_DS1621 is not set
746# CONFIG_SENSORS_F71805F is not set
747# CONFIG_SENSORS_FSCHER is not set
748# CONFIG_SENSORS_FSCPOS is not set
749# CONFIG_SENSORS_GL518SM is not set
750# CONFIG_SENSORS_GL520SM is not set
751# CONFIG_SENSORS_IT87 is not set
752# CONFIG_SENSORS_LM63 is not set
753# CONFIG_SENSORS_LM75 is not set
754# CONFIG_SENSORS_LM77 is not set
755# CONFIG_SENSORS_LM78 is not set
756# CONFIG_SENSORS_LM80 is not set
757# CONFIG_SENSORS_LM83 is not set
758# CONFIG_SENSORS_LM85 is not set
759# CONFIG_SENSORS_LM87 is not set
760# CONFIG_SENSORS_LM90 is not set
761# CONFIG_SENSORS_LM92 is not set
762# CONFIG_SENSORS_MAX1619 is not set
763# CONFIG_SENSORS_PC87360 is not set
764# CONFIG_SENSORS_PC87427 is not set
765# CONFIG_SENSORS_SIS5595 is not set
766# CONFIG_SENSORS_SMSC47M1 is not set
767# CONFIG_SENSORS_SMSC47M192 is not set
768# CONFIG_SENSORS_SMSC47B397 is not set
769# CONFIG_SENSORS_VIA686A is not set
770# CONFIG_SENSORS_VT1211 is not set
771# CONFIG_SENSORS_VT8231 is not set
772# CONFIG_SENSORS_W83781D is not set
773# CONFIG_SENSORS_W83791D is not set
774# CONFIG_SENSORS_W83792D is not set
775# CONFIG_SENSORS_W83793 is not set
776# CONFIG_SENSORS_W83L785TS is not set
777# CONFIG_SENSORS_W83627HF is not set
778# CONFIG_SENSORS_W83627EHF is not set
779# CONFIG_HWMON_DEBUG_CHIP is not set
780
781#
782# Multimedia devices
783#
784# CONFIG_VIDEO_DEV is not set
785
786#
787# Digital Video Broadcasting Devices
788#
789# CONFIG_DVB is not set
790
791#
792# Graphics support
793#
794CONFIG_FIRMWARE_EDID=y
795# CONFIG_FB is not set
796# CONFIG_FB_IBM_GXT4500 is not set
797# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
798
799#
800# Sound
801#
802# CONFIG_SOUND is not set
803
804#
805# HID Devices
806#
807CONFIG_HID=y
808
809#
810# USB support
811#
812CONFIG_USB_ARCH_HAS_HCD=y
813CONFIG_USB_ARCH_HAS_OHCI=y
814CONFIG_USB_ARCH_HAS_EHCI=y
815# CONFIG_USB is not set
816
817#
818# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
819#
820
821#
822# USB Gadget Support
823#
824# CONFIG_USB_GADGET is not set
825
826#
827# MMC/SD Card support
828#
829# CONFIG_MMC is not set
830
831#
832# LED devices
833#
834# CONFIG_NEW_LEDS is not set
835
836#
837# LED drivers
838#
839
840#
841# LED Triggers
842#
843
844#
845# InfiniBand support
846#
847# CONFIG_INFINIBAND is not set
848
849#
850# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
851#
852
853#
854# Real Time Clock
855#
856# CONFIG_RTC_CLASS is not set
857
858#
859# DMA Engine support
860#
861# CONFIG_DMA_ENGINE is not set
862
863#
864# DMA Clients
865#
866
867#
868# DMA Devices
869#
870
871#
872# Virtualization
873#
874
875#
876# File systems
877#
878CONFIG_EXT2_FS=y
879# CONFIG_EXT2_FS_XATTR is not set
880# CONFIG_EXT2_FS_XIP is not set
881CONFIG_EXT3_FS=y
882CONFIG_EXT3_FS_XATTR=y
883# CONFIG_EXT3_FS_POSIX_ACL is not set
884# CONFIG_EXT3_FS_SECURITY is not set
885# CONFIG_EXT4DEV_FS is not set
886CONFIG_JBD=y
887# CONFIG_JBD_DEBUG is not set
888CONFIG_FS_MBCACHE=y
889# CONFIG_REISERFS_FS is not set
890# CONFIG_JFS_FS is not set
891# CONFIG_FS_POSIX_ACL is not set
892# CONFIG_XFS_FS is not set
893# CONFIG_GFS2_FS is not set
894# CONFIG_OCFS2_FS is not set
895# CONFIG_MINIX_FS is not set
896# CONFIG_ROMFS_FS is not set
897CONFIG_INOTIFY=y
898CONFIG_INOTIFY_USER=y
899# CONFIG_QUOTA is not set
900CONFIG_DNOTIFY=y
901# CONFIG_AUTOFS_FS is not set
902# CONFIG_AUTOFS4_FS is not set
903# CONFIG_FUSE_FS is not set
904
905#
906# CD-ROM/DVD Filesystems
907#
908# CONFIG_ISO9660_FS is not set
909# CONFIG_UDF_FS is not set
910
911#
912# DOS/FAT/NT Filesystems
913#
914# CONFIG_MSDOS_FS is not set
915# CONFIG_VFAT_FS is not set
916# CONFIG_NTFS_FS is not set
917
918#
919# Pseudo filesystems
920#
921CONFIG_PROC_FS=y
922CONFIG_PROC_KCORE=y
923CONFIG_PROC_SYSCTL=y
924CONFIG_SYSFS=y
925CONFIG_TMPFS=y
926# CONFIG_TMPFS_POSIX_ACL is not set
927# CONFIG_HUGETLB_PAGE is not set
928CONFIG_RAMFS=y
929# CONFIG_CONFIGFS_FS is not set
930
931#
932# Miscellaneous filesystems
933#
934# CONFIG_ADFS_FS is not set
935# CONFIG_AFFS_FS is not set
936# CONFIG_HFS_FS is not set
937# CONFIG_HFSPLUS_FS is not set
938# CONFIG_BEFS_FS is not set
939# CONFIG_BFS_FS is not set
940# CONFIG_EFS_FS is not set
941# CONFIG_CRAMFS is not set
942# CONFIG_VXFS_FS is not set
943# CONFIG_HPFS_FS is not set
944# CONFIG_QNX4FS_FS is not set
945# CONFIG_SYSV_FS is not set
946# CONFIG_UFS_FS is not set
947
948#
949# Network File Systems
950#
951CONFIG_NFS_FS=y
952CONFIG_NFS_V3=y
953# CONFIG_NFS_V3_ACL is not set
954CONFIG_NFS_V4=y
955# CONFIG_NFS_DIRECTIO is not set
956# CONFIG_NFSD is not set
957CONFIG_ROOT_NFS=y
958CONFIG_LOCKD=y
959CONFIG_LOCKD_V4=y
960CONFIG_NFS_COMMON=y
961CONFIG_SUNRPC=y
962CONFIG_SUNRPC_GSS=y
963CONFIG_RPCSEC_GSS_KRB5=y
964# CONFIG_RPCSEC_GSS_SPKM3 is not set
965# CONFIG_SMB_FS is not set
966# CONFIG_CIFS is not set
967# CONFIG_NCP_FS is not set
968# CONFIG_CODA_FS is not set
969# CONFIG_AFS_FS is not set
970# CONFIG_9P_FS is not set
971
972#
973# Partition Types
974#
975CONFIG_PARTITION_ADVANCED=y
976# CONFIG_ACORN_PARTITION is not set
977# CONFIG_OSF_PARTITION is not set
978# CONFIG_AMIGA_PARTITION is not set
979# CONFIG_ATARI_PARTITION is not set
980# CONFIG_MAC_PARTITION is not set
981# CONFIG_MSDOS_PARTITION is not set
982# CONFIG_LDM_PARTITION is not set
983# CONFIG_SGI_PARTITION is not set
984# CONFIG_ULTRIX_PARTITION is not set
985# CONFIG_SUN_PARTITION is not set
986# CONFIG_KARMA_PARTITION is not set
987# CONFIG_EFI_PARTITION is not set
988
989#
990# Native Language Support
991#
992# CONFIG_NLS is not set
993
994#
995# Distributed Lock Manager
996#
997# CONFIG_DLM is not set
998
999#
1000# QE Options
1001#
1002CONFIG_UCC_SLOW=y
1003CONFIG_UCC_FAST=y
1004CONFIG_UCC=y
1005
1006#
1007# Library routines
1008#
1009CONFIG_BITREVERSE=y
1010# CONFIG_CRC_CCITT is not set
1011# CONFIG_CRC16 is not set
1012CONFIG_CRC32=y
1013# CONFIG_LIBCRC32C is not set
1014CONFIG_PLIST=y
1015CONFIG_IOMAP_COPY=y
1016
1017#
1018# Instrumentation Support
1019#
1020# CONFIG_PROFILING is not set
1021
1022#
1023# Kernel hacking
1024#
1025# CONFIG_PRINTK_TIME is not set
1026CONFIG_ENABLE_MUST_CHECK=y
1027# CONFIG_MAGIC_SYSRQ is not set
1028# CONFIG_UNUSED_SYMBOLS is not set
1029# CONFIG_DEBUG_FS is not set
1030# CONFIG_HEADERS_CHECK is not set
1031# CONFIG_DEBUG_KERNEL is not set
1032CONFIG_LOG_BUF_SHIFT=14
1033# CONFIG_DEBUG_BUGVERBOSE is not set
1034# CONFIG_BOOTX_TEXT is not set
1035# CONFIG_SERIAL_TEXT_DEBUG is not set
1036# CONFIG_PPC_EARLY_DEBUG is not set
1037
1038#
1039# Security options
1040#
1041# CONFIG_KEYS is not set
1042# CONFIG_SECURITY is not set
1043
1044#
1045# Cryptographic options
1046#
1047CONFIG_CRYPTO=y
1048CONFIG_CRYPTO_ALGAPI=y
1049CONFIG_CRYPTO_BLKCIPHER=y
1050CONFIG_CRYPTO_MANAGER=y
1051# CONFIG_CRYPTO_HMAC is not set
1052# CONFIG_CRYPTO_XCBC is not set
1053# CONFIG_CRYPTO_NULL is not set
1054# CONFIG_CRYPTO_MD4 is not set
1055CONFIG_CRYPTO_MD5=y
1056# CONFIG_CRYPTO_SHA1 is not set
1057# CONFIG_CRYPTO_SHA256 is not set
1058# CONFIG_CRYPTO_SHA512 is not set
1059# CONFIG_CRYPTO_WP512 is not set
1060# CONFIG_CRYPTO_TGR192 is not set
1061# CONFIG_CRYPTO_GF128MUL is not set
1062CONFIG_CRYPTO_ECB=m
1063CONFIG_CRYPTO_CBC=y
1064# CONFIG_CRYPTO_LRW is not set
1065CONFIG_CRYPTO_DES=y
1066# CONFIG_CRYPTO_BLOWFISH is not set
1067# CONFIG_CRYPTO_TWOFISH is not set
1068# CONFIG_CRYPTO_SERPENT is not set
1069# CONFIG_CRYPTO_AES is not set
1070# CONFIG_CRYPTO_CAST5 is not set
1071# CONFIG_CRYPTO_CAST6 is not set
1072# CONFIG_CRYPTO_TEA is not set
1073# CONFIG_CRYPTO_ARC4 is not set
1074# CONFIG_CRYPTO_KHAZAD is not set
1075# CONFIG_CRYPTO_ANUBIS is not set
1076# CONFIG_CRYPTO_DEFLATE is not set
1077# CONFIG_CRYPTO_MICHAEL_MIC is not set
1078# CONFIG_CRYPTO_CRC32C is not set
1079# CONFIG_CRYPTO_TEST is not set
1080
1081#
1082# Hardware crypto devices
1083#
diff --git a/arch/powerpc/configs/mpc834x_itx_defconfig b/arch/powerpc/configs/mpc834x_itx_defconfig
index 45757b613702..7902806429f8 100644
--- a/arch/powerpc/configs/mpc834x_itx_defconfig
+++ b/arch/powerpc/configs/mpc834x_itx_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc5 3# Linux kernel version: 2.6.20-rc5
4# Mon Jan 22 22:23:43 2007 4# Fri Jan 26 00:19:02 2007
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y 7CONFIG_PPC32=y
@@ -149,7 +149,6 @@ CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_BINFMT_ELF=y 150CONFIG_BINFMT_ELF=y
151# CONFIG_BINFMT_MISC is not set 151# CONFIG_BINFMT_MISC is not set
152CONFIG_MATH_EMULATION=y
153CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 152CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
154CONFIG_ARCH_FLATMEM_ENABLE=y 153CONFIG_ARCH_FLATMEM_ENABLE=y
155CONFIG_ARCH_POPULATES_NODE_MAP=y 154CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -324,6 +323,7 @@ CONFIG_MTD=y
324# User Modules And Translation Layers 323# User Modules And Translation Layers
325# 324#
326CONFIG_MTD_CHAR=y 325CONFIG_MTD_CHAR=y
326# CONFIG_MTD_BLKDEVS is not set
327# CONFIG_MTD_BLOCK is not set 327# CONFIG_MTD_BLOCK is not set
328# CONFIG_MTD_BLOCK_RO is not set 328# CONFIG_MTD_BLOCK_RO is not set
329# CONFIG_FTL is not set 329# CONFIG_FTL is not set
@@ -366,6 +366,7 @@ CONFIG_MTD_PHYSMAP=y
366CONFIG_MTD_PHYSMAP_START=0xfe000000 366CONFIG_MTD_PHYSMAP_START=0xfe000000
367CONFIG_MTD_PHYSMAP_LEN=0x1000000 367CONFIG_MTD_PHYSMAP_LEN=0x1000000
368CONFIG_MTD_PHYSMAP_BANKWIDTH=2 368CONFIG_MTD_PHYSMAP_BANKWIDTH=2
369# CONFIG_MTD_PHYSMAP_OF is not set
369# CONFIG_MTD_PLATRAM is not set 370# CONFIG_MTD_PLATRAM is not set
370 371
371# 372#
@@ -390,6 +391,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
390# NAND Flash Device Drivers 391# NAND Flash Device Drivers
391# 392#
392# CONFIG_MTD_NAND is not set 393# CONFIG_MTD_NAND is not set
394# CONFIG_MTD_NAND_CAFE is not set
393 395
394# 396#
395# OneNAND Flash Device Drivers 397# OneNAND Flash Device Drivers
@@ -1011,7 +1013,6 @@ CONFIG_USB=y
1011CONFIG_USB_DEVICEFS=y 1013CONFIG_USB_DEVICEFS=y
1012# CONFIG_USB_BANDWIDTH is not set 1014# CONFIG_USB_BANDWIDTH is not set
1013# CONFIG_USB_DYNAMIC_MINORS is not set 1015# CONFIG_USB_DYNAMIC_MINORS is not set
1014# CONFIG_USB_MULTITHREAD_PROBE is not set
1015# CONFIG_USB_OTG is not set 1016# CONFIG_USB_OTG is not set
1016 1017
1017# 1018#
diff --git a/arch/powerpc/configs/mpc834x_mds_defconfig b/arch/powerpc/configs/mpc834x_mds_defconfig
index c24db58be457..9eaed3a36983 100644
--- a/arch/powerpc/configs/mpc834x_mds_defconfig
+++ b/arch/powerpc/configs/mpc834x_mds_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc5 3# Linux kernel version: 2.6.20-rc5
4# Mon Jan 22 22:24:10 2007 4# Fri Jan 26 00:19:27 2007
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y 7CONFIG_PPC32=y
@@ -149,7 +149,6 @@ CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_BINFMT_ELF=y 150CONFIG_BINFMT_ELF=y
151# CONFIG_BINFMT_MISC is not set 151# CONFIG_BINFMT_MISC is not set
152CONFIG_MATH_EMULATION=y
153CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 152CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
154CONFIG_ARCH_FLATMEM_ENABLE=y 153CONFIG_ARCH_FLATMEM_ENABLE=y
155CONFIG_ARCH_POPULATES_NODE_MAP=y 154CONFIG_ARCH_POPULATES_NODE_MAP=y
diff --git a/arch/powerpc/configs/mpc8360emds_defconfig b/arch/powerpc/configs/mpc8360emds_defconfig
index 58e6795dbfe5..bbe38ccc3d86 100644
--- a/arch/powerpc/configs/mpc8360emds_defconfig
+++ b/arch/powerpc/configs/mpc8360emds_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc5 3# Linux kernel version: 2.6.20-rc5
4# Mon Jan 22 22:24:40 2007 4# Fri Jan 26 00:19:45 2007
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y 7CONFIG_PPC32=y
@@ -150,7 +150,6 @@ CONFIG_PREEMPT_NONE=y
150# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
151CONFIG_BINFMT_ELF=y 151CONFIG_BINFMT_ELF=y
152# CONFIG_BINFMT_MISC is not set 152# CONFIG_BINFMT_MISC is not set
153CONFIG_MATH_EMULATION=y
154CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 153CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
155CONFIG_ARCH_FLATMEM_ENABLE=y 154CONFIG_ARCH_FLATMEM_ENABLE=y
156CONFIG_ARCH_POPULATES_NODE_MAP=y 155CONFIG_ARCH_POPULATES_NODE_MAP=y
diff --git a/arch/powerpc/configs/mpc866_ads_defconfig b/arch/powerpc/configs/mpc866_ads_defconfig
new file mode 100644
index 000000000000..539d9e3d3668
--- /dev/null
+++ b/arch/powerpc/configs/mpc866_ads_defconfig
@@ -0,0 +1,829 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19-rc6
4# Fri Nov 24 21:13:55 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_FIND_NEXT_BIT=y
16CONFIG_PPC=y
17CONFIG_EARLY_PRINTK=y
18CONFIG_GENERIC_NVRAM=y
19CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
20CONFIG_ARCH_MAY_HAVE_PC_FDC=y
21CONFIG_PPC_OF=y
22# CONFIG_PPC_UDBG_16550 is not set
23# CONFIG_GENERIC_TBSYNC is not set
24CONFIG_AUDIT_ARCH=y
25# CONFIG_DEFAULT_UIMAGE is not set
26
27#
28# Processor support
29#
30# CONFIG_CLASSIC32 is not set
31# CONFIG_PPC_52xx is not set
32# CONFIG_PPC_82xx is not set
33# CONFIG_PPC_83xx is not set
34# CONFIG_PPC_85xx is not set
35# CONFIG_PPC_86xx is not set
36CONFIG_PPC_8xx=y
37# CONFIG_40x is not set
38# CONFIG_44x is not set
39# CONFIG_E200 is not set
40CONFIG_8xx=y
41# CONFIG_PPC_DCR_NATIVE is not set
42# CONFIG_PPC_DCR_MMIO is not set
43CONFIG_NOT_COHERENT_CACHE=y
44CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
45
46#
47# Code maturity level options
48#
49CONFIG_EXPERIMENTAL=y
50CONFIG_BROKEN_ON_SMP=y
51CONFIG_INIT_ENV_ARG_LIMIT=32
52
53#
54# General setup
55#
56CONFIG_LOCALVERSION=""
57CONFIG_LOCALVERSION_AUTO=y
58# CONFIG_SWAP is not set
59CONFIG_SYSVIPC=y
60# CONFIG_IPC_NS is not set
61# CONFIG_POSIX_MQUEUE is not set
62# CONFIG_BSD_PROCESS_ACCT is not set
63# CONFIG_TASKSTATS is not set
64# CONFIG_UTS_NS is not set
65# CONFIG_AUDIT is not set
66# CONFIG_IKCONFIG is not set
67# CONFIG_RELAY is not set
68CONFIG_INITRAMFS_SOURCE=""
69# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
70CONFIG_SYSCTL=y
71CONFIG_EMBEDDED=y
72# CONFIG_SYSCTL_SYSCALL is not set
73CONFIG_KALLSYMS=y
74# CONFIG_KALLSYMS_EXTRA_PASS is not set
75# CONFIG_HOTPLUG is not set
76CONFIG_PRINTK=y
77# CONFIG_BUG is not set
78CONFIG_ELF_CORE=y
79# CONFIG_BASE_FULL is not set
80CONFIG_FUTEX=y
81# CONFIG_EPOLL is not set
82CONFIG_SHMEM=y
83CONFIG_SLAB=y
84# CONFIG_VM_EVENT_COUNTERS is not set
85CONFIG_RT_MUTEXES=y
86# CONFIG_TINY_SHMEM is not set
87CONFIG_BASE_SMALL=1
88# CONFIG_SLOB is not set
89
90#
91# Loadable module support
92#
93# CONFIG_MODULES is not set
94
95#
96# Block layer
97#
98CONFIG_BLOCK=y
99# CONFIG_LBD is not set
100# CONFIG_BLK_DEV_IO_TRACE is not set
101# CONFIG_LSF is not set
102
103#
104# IO Schedulers
105#
106CONFIG_IOSCHED_NOOP=y
107CONFIG_IOSCHED_AS=y
108CONFIG_IOSCHED_DEADLINE=y
109CONFIG_IOSCHED_CFQ=y
110CONFIG_DEFAULT_AS=y
111# CONFIG_DEFAULT_DEADLINE is not set
112# CONFIG_DEFAULT_CFQ is not set
113# CONFIG_DEFAULT_NOOP is not set
114CONFIG_DEFAULT_IOSCHED="anticipatory"
115# CONFIG_WANT_EARLY_SERIAL is not set
116CONFIG_EMBEDDEDBOOT=y
117# CONFIG_MPIC is not set
118
119#
120# Platform support
121#
122CONFIG_CPM1=y
123# CONFIG_MPC8XXFADS is not set
124CONFIG_MPC86XADS=y
125# CONFIG_MPC885ADS is not set
126
127#
128# MPC8xx CPM Options
129#
130
131#
132# Generic MPC8xx Options
133#
134CONFIG_8xx_COPYBACK=y
135CONFIG_8xx_CPU6=y
136CONFIG_NO_UCODE_PATCH=y
137# CONFIG_USB_SOF_UCODE_PATCH is not set
138# CONFIG_I2C_SPI_UCODE_PATCH is not set
139# CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set
140
141#
142# Kernel options
143#
144# CONFIG_HIGHMEM is not set
145# CONFIG_HZ_100 is not set
146# CONFIG_HZ_250 is not set
147CONFIG_HZ_1000=y
148CONFIG_HZ=1000
149CONFIG_PREEMPT_NONE=y
150# CONFIG_PREEMPT_VOLUNTARY is not set
151# CONFIG_PREEMPT is not set
152CONFIG_BINFMT_ELF=y
153# CONFIG_BINFMT_MISC is not set
154CONFIG_MATH_EMULATION=y
155CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
156CONFIG_ARCH_FLATMEM_ENABLE=y
157CONFIG_ARCH_POPULATES_NODE_MAP=y
158CONFIG_SELECT_MEMORY_MODEL=y
159CONFIG_FLATMEM_MANUAL=y
160# CONFIG_DISCONTIGMEM_MANUAL is not set
161# CONFIG_SPARSEMEM_MANUAL is not set
162CONFIG_FLATMEM=y
163CONFIG_FLAT_NODE_MEM_MAP=y
164# CONFIG_SPARSEMEM_STATIC is not set
165CONFIG_SPLIT_PTLOCK_CPUS=4
166# CONFIG_RESOURCES_64BIT is not set
167# CONFIG_PROC_DEVICETREE is not set
168# CONFIG_CMDLINE_BOOL is not set
169# CONFIG_PM is not set
170# CONFIG_SECCOMP is not set
171CONFIG_ISA_DMA_API=y
172
173#
174# Bus options
175#
176# CONFIG_MPIC_WEIRD is not set
177# CONFIG_PPC_I8259 is not set
178CONFIG_FSL_SOC=y
179# CONFIG_PCI is not set
180# CONFIG_PCI_DOMAINS is not set
181# CONFIG_PCI_QSPAN is not set
182
183#
184# PCCARD (PCMCIA/CardBus) support
185#
186
187#
188# PCI Hotplug Support
189#
190
191#
192# Advanced setup
193#
194# CONFIG_ADVANCED_OPTIONS is not set
195
196#
197# Default settings for advanced configuration options are used
198#
199CONFIG_HIGHMEM_START=0xfe000000
200CONFIG_LOWMEM_SIZE=0x30000000
201CONFIG_KERNEL_START=0xc0000000
202CONFIG_TASK_SIZE=0x80000000
203CONFIG_CONSISTENT_START=0xff100000
204CONFIG_CONSISTENT_SIZE=0x00200000
205CONFIG_BOOT_LOAD=0x00400000
206
207#
208# Networking
209#
210CONFIG_NET=y
211
212#
213# Networking options
214#
215# CONFIG_NETDEBUG is not set
216CONFIG_PACKET=y
217# CONFIG_PACKET_MMAP is not set
218CONFIG_UNIX=y
219CONFIG_XFRM=y
220# CONFIG_XFRM_USER is not set
221# CONFIG_XFRM_SUB_POLICY is not set
222# CONFIG_NET_KEY is not set
223CONFIG_INET=y
224CONFIG_IP_MULTICAST=y
225# CONFIG_IP_ADVANCED_ROUTER is not set
226CONFIG_IP_FIB_HASH=y
227CONFIG_IP_PNP=y
228# CONFIG_IP_PNP_DHCP is not set
229# CONFIG_IP_PNP_BOOTP is not set
230# CONFIG_IP_PNP_RARP is not set
231# CONFIG_NET_IPIP is not set
232# CONFIG_NET_IPGRE is not set
233# CONFIG_IP_MROUTE is not set
234# CONFIG_ARPD is not set
235CONFIG_SYN_COOKIES=y
236# CONFIG_INET_AH is not set
237# CONFIG_INET_ESP is not set
238# CONFIG_INET_IPCOMP is not set
239# CONFIG_INET_XFRM_TUNNEL is not set
240# CONFIG_INET_TUNNEL is not set
241CONFIG_INET_XFRM_MODE_TRANSPORT=y
242CONFIG_INET_XFRM_MODE_TUNNEL=y
243CONFIG_INET_XFRM_MODE_BEET=y
244CONFIG_INET_DIAG=y
245CONFIG_INET_TCP_DIAG=y
246# CONFIG_TCP_CONG_ADVANCED is not set
247CONFIG_TCP_CONG_CUBIC=y
248CONFIG_DEFAULT_TCP_CONG="cubic"
249# CONFIG_IPV6 is not set
250# CONFIG_INET6_XFRM_TUNNEL is not set
251# CONFIG_INET6_TUNNEL is not set
252# CONFIG_NETWORK_SECMARK is not set
253# CONFIG_NETFILTER is not set
254
255#
256# DCCP Configuration (EXPERIMENTAL)
257#
258# CONFIG_IP_DCCP is not set
259
260#
261# SCTP Configuration (EXPERIMENTAL)
262#
263# CONFIG_IP_SCTP is not set
264
265#
266# TIPC Configuration (EXPERIMENTAL)
267#
268# CONFIG_TIPC is not set
269# CONFIG_ATM is not set
270# CONFIG_BRIDGE is not set
271# CONFIG_VLAN_8021Q is not set
272# CONFIG_DECNET is not set
273# CONFIG_LLC2 is not set
274# CONFIG_IPX is not set
275# CONFIG_ATALK is not set
276# CONFIG_X25 is not set
277# CONFIG_LAPB is not set
278# CONFIG_ECONET is not set
279# CONFIG_WAN_ROUTER is not set
280
281#
282# QoS and/or fair queueing
283#
284# CONFIG_NET_SCHED is not set
285
286#
287# Network testing
288#
289# CONFIG_NET_PKTGEN is not set
290# CONFIG_HAMRADIO is not set
291# CONFIG_IRDA is not set
292# CONFIG_BT is not set
293# CONFIG_IEEE80211 is not set
294
295#
296# Device Drivers
297#
298
299#
300# Generic Driver Options
301#
302CONFIG_STANDALONE=y
303CONFIG_PREVENT_FIRMWARE_BUILD=y
304# CONFIG_SYS_HYPERVISOR is not set
305
306#
307# Connector - unified userspace <-> kernelspace linker
308#
309# CONFIG_CONNECTOR is not set
310
311#
312# Memory Technology Devices (MTD)
313#
314# CONFIG_MTD is not set
315
316#
317# Parallel port support
318#
319# CONFIG_PARPORT is not set
320
321#
322# Plug and Play support
323#
324
325#
326# Block devices
327#
328# CONFIG_BLK_DEV_FD is not set
329# CONFIG_BLK_DEV_COW_COMMON is not set
330CONFIG_BLK_DEV_LOOP=y
331# CONFIG_BLK_DEV_CRYPTOLOOP is not set
332# CONFIG_BLK_DEV_NBD is not set
333# CONFIG_BLK_DEV_RAM is not set
334# CONFIG_BLK_DEV_INITRD is not set
335# CONFIG_CDROM_PKTCDVD is not set
336# CONFIG_ATA_OVER_ETH is not set
337
338#
339# Misc devices
340#
341# CONFIG_TIFM_CORE is not set
342
343#
344# ATA/ATAPI/MFM/RLL support
345#
346# CONFIG_IDE is not set
347
348#
349# SCSI device support
350#
351# CONFIG_RAID_ATTRS is not set
352# CONFIG_SCSI is not set
353# CONFIG_SCSI_NETLINK is not set
354
355#
356# Serial ATA (prod) and Parallel ATA (experimental) drivers
357#
358# CONFIG_ATA is not set
359
360#
361# Multi-device support (RAID and LVM)
362#
363# CONFIG_MD is not set
364
365#
366# Fusion MPT device support
367#
368# CONFIG_FUSION is not set
369
370#
371# IEEE 1394 (FireWire) support
372#
373
374#
375# I2O device support
376#
377
378#
379# Macintosh device drivers
380#
381# CONFIG_WINDFARM is not set
382
383#
384# Network device support
385#
386CONFIG_NETDEVICES=y
387# CONFIG_DUMMY is not set
388# CONFIG_BONDING is not set
389# CONFIG_EQUALIZER is not set
390# CONFIG_TUN is not set
391
392#
393# PHY device support
394#
395CONFIG_PHYLIB=y
396
397#
398# MII PHY device drivers
399#
400# CONFIG_MARVELL_PHY is not set
401# CONFIG_DAVICOM_PHY is not set
402# CONFIG_QSEMI_PHY is not set
403# CONFIG_LXT_PHY is not set
404# CONFIG_CICADA_PHY is not set
405# CONFIG_VITESSE_PHY is not set
406# CONFIG_SMSC_PHY is not set
407CONFIG_FIXED_PHY=y
408CONFIG_FIXED_MII_10_FDX=y
409CONFIG_FIXED_MII_100_FDX=y
410
411#
412# Ethernet (10 or 100Mbit)
413#
414CONFIG_NET_ETHERNET=y
415CONFIG_MII=y
416# CONFIG_FEC_8XX is not set
417CONFIG_FS_ENET=y
418CONFIG_FS_ENET_HAS_SCC=y
419CONFIG_FS_ENET_HAS_FEC=y
420
421#
422# Ethernet (1000 Mbit)
423#
424
425#
426# Ethernet (10000 Mbit)
427#
428
429#
430# Token Ring devices
431#
432
433#
434# Wireless LAN (non-hamradio)
435#
436# CONFIG_NET_RADIO is not set
437
438#
439# Wan interfaces
440#
441# CONFIG_WAN is not set
442# CONFIG_PPP is not set
443# CONFIG_SLIP is not set
444# CONFIG_SHAPER is not set
445# CONFIG_NETCONSOLE is not set
446# CONFIG_NETPOLL is not set
447# CONFIG_NET_POLL_CONTROLLER is not set
448
449#
450# ISDN subsystem
451#
452# CONFIG_ISDN is not set
453
454#
455# Telephony Support
456#
457# CONFIG_PHONE is not set
458
459#
460# Input device support
461#
462CONFIG_INPUT=y
463# CONFIG_INPUT_FF_MEMLESS is not set
464
465#
466# Userland interfaces
467#
468CONFIG_INPUT_MOUSEDEV=y
469CONFIG_INPUT_MOUSEDEV_PSAUX=y
470CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
471CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
472# CONFIG_INPUT_JOYDEV is not set
473# CONFIG_INPUT_TSDEV is not set
474# CONFIG_INPUT_EVDEV is not set
475# CONFIG_INPUT_EVBUG is not set
476
477#
478# Input Device Drivers
479#
480CONFIG_INPUT_KEYBOARD=y
481CONFIG_KEYBOARD_ATKBD=y
482# CONFIG_KEYBOARD_SUNKBD is not set
483# CONFIG_KEYBOARD_LKKBD is not set
484# CONFIG_KEYBOARD_XTKBD is not set
485# CONFIG_KEYBOARD_NEWTON is not set
486# CONFIG_KEYBOARD_STOWAWAY is not set
487CONFIG_INPUT_MOUSE=y
488CONFIG_MOUSE_PS2=y
489# CONFIG_MOUSE_SERIAL is not set
490# CONFIG_MOUSE_VSXXXAA is not set
491# CONFIG_INPUT_JOYSTICK is not set
492# CONFIG_INPUT_TOUCHSCREEN is not set
493# CONFIG_INPUT_MISC is not set
494
495#
496# Hardware I/O ports
497#
498CONFIG_SERIO=y
499CONFIG_SERIO_I8042=y
500CONFIG_SERIO_SERPORT=y
501CONFIG_SERIO_LIBPS2=y
502# CONFIG_SERIO_RAW is not set
503# CONFIG_GAMEPORT is not set
504
505#
506# Character devices
507#
508# CONFIG_VT is not set
509# CONFIG_SERIAL_NONSTANDARD is not set
510
511#
512# Serial drivers
513#
514# CONFIG_SERIAL_8250 is not set
515
516#
517# Non-8250 serial port support
518#
519CONFIG_SERIAL_CORE=y
520CONFIG_SERIAL_CORE_CONSOLE=y
521CONFIG_SERIAL_CPM=y
522CONFIG_SERIAL_CPM_CONSOLE=y
523# CONFIG_SERIAL_CPM_SCC1 is not set
524# CONFIG_SERIAL_CPM_SCC2 is not set
525# CONFIG_SERIAL_CPM_SCC3 is not set
526# CONFIG_SERIAL_CPM_SCC4 is not set
527CONFIG_SERIAL_CPM_SMC1=y
528CONFIG_SERIAL_CPM_SMC2=y
529CONFIG_UNIX98_PTYS=y
530# CONFIG_LEGACY_PTYS is not set
531
532#
533# IPMI
534#
535# CONFIG_IPMI_HANDLER is not set
536
537#
538# Watchdog Cards
539#
540# CONFIG_WATCHDOG is not set
541CONFIG_HW_RANDOM=y
542# CONFIG_NVRAM is not set
543CONFIG_GEN_RTC=y
544# CONFIG_GEN_RTC_X is not set
545# CONFIG_DTLK is not set
546# CONFIG_R3964 is not set
547
548#
549# Ftape, the floppy tape device driver
550#
551# CONFIG_RAW_DRIVER is not set
552
553#
554# TPM devices
555#
556# CONFIG_TCG_TPM is not set
557
558#
559# I2C support
560#
561# CONFIG_I2C is not set
562
563#
564# SPI support
565#
566# CONFIG_SPI is not set
567# CONFIG_SPI_MASTER is not set
568
569#
570# Dallas's 1-wire bus
571#
572# CONFIG_W1 is not set
573
574#
575# Hardware Monitoring support
576#
577CONFIG_HWMON=y
578# CONFIG_HWMON_VID is not set
579# CONFIG_SENSORS_ABITUGURU is not set
580# CONFIG_SENSORS_F71805F is not set
581# CONFIG_SENSORS_VT1211 is not set
582# CONFIG_HWMON_DEBUG_CHIP is not set
583
584#
585# Multimedia devices
586#
587# CONFIG_VIDEO_DEV is not set
588
589#
590# Digital Video Broadcasting Devices
591#
592# CONFIG_DVB is not set
593
594#
595# Graphics support
596#
597CONFIG_FIRMWARE_EDID=y
598# CONFIG_FB is not set
599# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
600
601#
602# Sound
603#
604# CONFIG_SOUND is not set
605
606#
607# USB support
608#
609# CONFIG_USB_ARCH_HAS_HCD is not set
610# CONFIG_USB_ARCH_HAS_OHCI is not set
611# CONFIG_USB_ARCH_HAS_EHCI is not set
612
613#
614# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
615#
616
617#
618# USB Gadget Support
619#
620# CONFIG_USB_GADGET is not set
621
622#
623# MMC/SD Card support
624#
625# CONFIG_MMC is not set
626
627#
628# LED devices
629#
630# CONFIG_NEW_LEDS is not set
631
632#
633# LED drivers
634#
635
636#
637# LED Triggers
638#
639
640#
641# InfiniBand support
642#
643
644#
645# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
646#
647
648#
649# Real Time Clock
650#
651# CONFIG_RTC_CLASS is not set
652
653#
654# DMA Engine support
655#
656# CONFIG_DMA_ENGINE is not set
657
658#
659# DMA Clients
660#
661
662#
663# DMA Devices
664#
665
666#
667# File systems
668#
669CONFIG_EXT2_FS=y
670CONFIG_EXT2_FS_XATTR=y
671# CONFIG_EXT2_FS_POSIX_ACL is not set
672# CONFIG_EXT2_FS_SECURITY is not set
673# CONFIG_EXT2_FS_XIP is not set
674CONFIG_EXT3_FS=y
675CONFIG_EXT3_FS_XATTR=y
676# CONFIG_EXT3_FS_POSIX_ACL is not set
677# CONFIG_EXT3_FS_SECURITY is not set
678# CONFIG_EXT4DEV_FS is not set
679CONFIG_JBD=y
680# CONFIG_JBD_DEBUG is not set
681CONFIG_FS_MBCACHE=y
682# CONFIG_REISERFS_FS is not set
683# CONFIG_JFS_FS is not set
684# CONFIG_FS_POSIX_ACL is not set
685# CONFIG_XFS_FS is not set
686# CONFIG_GFS2_FS is not set
687# CONFIG_OCFS2_FS is not set
688# CONFIG_MINIX_FS is not set
689# CONFIG_ROMFS_FS is not set
690CONFIG_INOTIFY=y
691CONFIG_INOTIFY_USER=y
692# CONFIG_QUOTA is not set
693CONFIG_DNOTIFY=y
694# CONFIG_AUTOFS_FS is not set
695# CONFIG_AUTOFS4_FS is not set
696# CONFIG_FUSE_FS is not set
697
698#
699# CD-ROM/DVD Filesystems
700#
701# CONFIG_ISO9660_FS is not set
702# CONFIG_UDF_FS is not set
703
704#
705# DOS/FAT/NT Filesystems
706#
707# CONFIG_MSDOS_FS is not set
708# CONFIG_VFAT_FS is not set
709# CONFIG_NTFS_FS is not set
710
711#
712# Pseudo filesystems
713#
714CONFIG_PROC_FS=y
715# CONFIG_PROC_KCORE is not set
716CONFIG_PROC_SYSCTL=y
717CONFIG_SYSFS=y
718CONFIG_TMPFS=y
719# CONFIG_TMPFS_POSIX_ACL is not set
720# CONFIG_HUGETLB_PAGE is not set
721CONFIG_RAMFS=y
722# CONFIG_CONFIGFS_FS is not set
723
724#
725# Miscellaneous filesystems
726#
727# CONFIG_ADFS_FS is not set
728# CONFIG_AFFS_FS is not set
729# CONFIG_HFS_FS is not set
730# CONFIG_HFSPLUS_FS is not set
731# CONFIG_BEFS_FS is not set
732# CONFIG_BFS_FS is not set
733# CONFIG_EFS_FS is not set
734CONFIG_CRAMFS=y
735# CONFIG_VXFS_FS is not set
736# CONFIG_HPFS_FS is not set
737# CONFIG_QNX4FS_FS is not set
738# CONFIG_SYSV_FS is not set
739# CONFIG_UFS_FS is not set
740
741#
742# Network File Systems
743#
744CONFIG_NFS_FS=y
745CONFIG_NFS_V3=y
746# CONFIG_NFS_V3_ACL is not set
747# CONFIG_NFS_V4 is not set
748# CONFIG_NFS_DIRECTIO is not set
749# CONFIG_NFSD is not set
750CONFIG_ROOT_NFS=y
751CONFIG_LOCKD=y
752CONFIG_LOCKD_V4=y
753CONFIG_NFS_COMMON=y
754CONFIG_SUNRPC=y
755# CONFIG_RPCSEC_GSS_KRB5 is not set
756# CONFIG_RPCSEC_GSS_SPKM3 is not set
757# CONFIG_SMB_FS is not set
758# CONFIG_CIFS is not set
759# CONFIG_NCP_FS is not set
760# CONFIG_CODA_FS is not set
761# CONFIG_AFS_FS is not set
762# CONFIG_9P_FS is not set
763
764#
765# Partition Types
766#
767CONFIG_PARTITION_ADVANCED=y
768# CONFIG_ACORN_PARTITION is not set
769# CONFIG_OSF_PARTITION is not set
770# CONFIG_AMIGA_PARTITION is not set
771# CONFIG_ATARI_PARTITION is not set
772# CONFIG_MAC_PARTITION is not set
773CONFIG_MSDOS_PARTITION=y
774# CONFIG_BSD_DISKLABEL is not set
775# CONFIG_MINIX_SUBPARTITION is not set
776# CONFIG_SOLARIS_X86_PARTITION is not set
777# CONFIG_UNIXWARE_DISKLABEL is not set
778# CONFIG_LDM_PARTITION is not set
779# CONFIG_SGI_PARTITION is not set
780# CONFIG_ULTRIX_PARTITION is not set
781# CONFIG_SUN_PARTITION is not set
782# CONFIG_KARMA_PARTITION is not set
783# CONFIG_EFI_PARTITION is not set
784
785#
786# Native Language Support
787#
788# CONFIG_NLS is not set
789
790#
791# Library routines
792#
793CONFIG_CRC_CCITT=y
794# CONFIG_CRC16 is not set
795CONFIG_CRC32=y
796# CONFIG_LIBCRC32C is not set
797CONFIG_ZLIB_INFLATE=y
798CONFIG_PLIST=y
799
800#
801# Instrumentation Support
802#
803# CONFIG_PROFILING is not set
804
805#
806# Kernel hacking
807#
808# CONFIG_PRINTK_TIME is not set
809CONFIG_ENABLE_MUST_CHECK=y
810# CONFIG_MAGIC_SYSRQ is not set
811# CONFIG_UNUSED_SYMBOLS is not set
812# CONFIG_DEBUG_KERNEL is not set
813CONFIG_LOG_BUF_SHIFT=14
814# CONFIG_DEBUG_FS is not set
815# CONFIG_UNWIND_INFO is not set
816# CONFIG_HEADERS_CHECK is not set
817# CONFIG_BOOTX_TEXT is not set
818# CONFIG_PPC_EARLY_DEBUG is not set
819
820#
821# Security options
822#
823# CONFIG_KEYS is not set
824# CONFIG_SECURITY is not set
825
826#
827# Cryptographic options
828#
829# CONFIG_CRYPTO is not set
diff --git a/arch/powerpc/configs/mpc885_ads_defconfig b/arch/powerpc/configs/mpc885_ads_defconfig
new file mode 100644
index 000000000000..e2c17d8da4fc
--- /dev/null
+++ b/arch/powerpc/configs/mpc885_ads_defconfig
@@ -0,0 +1,827 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19-rc4
4# Fri Nov 10 21:30:40 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_FIND_NEXT_BIT=y
16CONFIG_PPC=y
17CONFIG_EARLY_PRINTK=y
18CONFIG_GENERIC_NVRAM=y
19CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
20CONFIG_ARCH_MAY_HAVE_PC_FDC=y
21CONFIG_PPC_OF=y
22# CONFIG_PPC_UDBG_16550 is not set
23# CONFIG_GENERIC_TBSYNC is not set
24CONFIG_AUDIT_ARCH=y
25# CONFIG_DEFAULT_UIMAGE is not set
26
27#
28# Processor support
29#
30# CONFIG_CLASSIC32 is not set
31# CONFIG_PPC_52xx is not set
32# CONFIG_PPC_82xx is not set
33# CONFIG_PPC_83xx is not set
34# CONFIG_PPC_85xx is not set
35# CONFIG_PPC_86xx is not set
36CONFIG_PPC_8xx=y
37# CONFIG_40x is not set
38# CONFIG_44x is not set
39# CONFIG_E200 is not set
40CONFIG_8xx=y
41CONFIG_NOT_COHERENT_CACHE=y
42CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
43
44#
45# Code maturity level options
46#
47CONFIG_EXPERIMENTAL=y
48CONFIG_BROKEN_ON_SMP=y
49CONFIG_INIT_ENV_ARG_LIMIT=32
50
51#
52# General setup
53#
54CONFIG_LOCALVERSION=""
55CONFIG_LOCALVERSION_AUTO=y
56# CONFIG_SWAP is not set
57CONFIG_SYSVIPC=y
58# CONFIG_IPC_NS is not set
59# CONFIG_POSIX_MQUEUE is not set
60# CONFIG_BSD_PROCESS_ACCT is not set
61# CONFIG_TASKSTATS is not set
62# CONFIG_UTS_NS is not set
63# CONFIG_AUDIT is not set
64# CONFIG_IKCONFIG is not set
65# CONFIG_RELAY is not set
66CONFIG_INITRAMFS_SOURCE=""
67# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
68CONFIG_SYSCTL=y
69CONFIG_EMBEDDED=y
70# CONFIG_SYSCTL_SYSCALL is not set
71CONFIG_KALLSYMS=y
72# CONFIG_KALLSYMS_EXTRA_PASS is not set
73# CONFIG_HOTPLUG is not set
74CONFIG_PRINTK=y
75# CONFIG_BUG is not set
76CONFIG_ELF_CORE=y
77# CONFIG_BASE_FULL is not set
78CONFIG_FUTEX=y
79# CONFIG_EPOLL is not set
80CONFIG_SHMEM=y
81CONFIG_SLAB=y
82# CONFIG_VM_EVENT_COUNTERS is not set
83CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set
85CONFIG_BASE_SMALL=1
86# CONFIG_SLOB is not set
87
88#
89# Loadable module support
90#
91# CONFIG_MODULES is not set
92
93#
94# Block layer
95#
96CONFIG_BLOCK=y
97# CONFIG_LBD is not set
98# CONFIG_BLK_DEV_IO_TRACE is not set
99# CONFIG_LSF is not set
100
101#
102# IO Schedulers
103#
104CONFIG_IOSCHED_NOOP=y
105CONFIG_IOSCHED_AS=y
106CONFIG_IOSCHED_DEADLINE=y
107CONFIG_IOSCHED_CFQ=y
108CONFIG_DEFAULT_AS=y
109# CONFIG_DEFAULT_DEADLINE is not set
110# CONFIG_DEFAULT_CFQ is not set
111# CONFIG_DEFAULT_NOOP is not set
112CONFIG_DEFAULT_IOSCHED="anticipatory"
113# CONFIG_WANT_EARLY_SERIAL is not set
114CONFIG_EMBEDDEDBOOT=y
115# CONFIG_MPIC is not set
116
117#
118# Platform support
119#
120CONFIG_CPM1=y
121# CONFIG_MPC8XXFADS is not set
122# CONFIG_MPC86XADS is not set
123CONFIG_MPC885ADS=y
124
125#
126# MPC8xx CPM Options
127#
128
129#
130# Generic MPC8xx Options
131#
132CONFIG_8xx_COPYBACK=y
133# CONFIG_8xx_CPU6 is not set
134CONFIG_NO_UCODE_PATCH=y
135# CONFIG_USB_SOF_UCODE_PATCH is not set
136# CONFIG_I2C_SPI_UCODE_PATCH is not set
137# CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set
138
139#
140# Kernel options
141#
142# CONFIG_HIGHMEM is not set
143# CONFIG_HZ_100 is not set
144# CONFIG_HZ_250 is not set
145CONFIG_HZ_1000=y
146CONFIG_HZ=1000
147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set
150CONFIG_BINFMT_ELF=y
151# CONFIG_BINFMT_MISC is not set
152CONFIG_MATH_EMULATION=y
153CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
154CONFIG_ARCH_FLATMEM_ENABLE=y
155CONFIG_ARCH_POPULATES_NODE_MAP=y
156CONFIG_SELECT_MEMORY_MODEL=y
157CONFIG_FLATMEM_MANUAL=y
158# CONFIG_DISCONTIGMEM_MANUAL is not set
159# CONFIG_SPARSEMEM_MANUAL is not set
160CONFIG_FLATMEM=y
161CONFIG_FLAT_NODE_MEM_MAP=y
162# CONFIG_SPARSEMEM_STATIC is not set
163CONFIG_SPLIT_PTLOCK_CPUS=4
164# CONFIG_RESOURCES_64BIT is not set
165# CONFIG_PROC_DEVICETREE is not set
166# CONFIG_CMDLINE_BOOL is not set
167# CONFIG_PM is not set
168# CONFIG_SECCOMP is not set
169CONFIG_ISA_DMA_API=y
170
171#
172# Bus options
173#
174# CONFIG_MPIC_WEIRD is not set
175# CONFIG_PPC_I8259 is not set
176CONFIG_FSL_SOC=y
177# CONFIG_PCI is not set
178# CONFIG_PCI_DOMAINS is not set
179# CONFIG_PCI_QSPAN is not set
180
181#
182# PCCARD (PCMCIA/CardBus) support
183#
184
185#
186# PCI Hotplug Support
187#
188
189#
190# Advanced setup
191#
192# CONFIG_ADVANCED_OPTIONS is not set
193
194#
195# Default settings for advanced configuration options are used
196#
197CONFIG_HIGHMEM_START=0xfe000000
198CONFIG_LOWMEM_SIZE=0x30000000
199CONFIG_KERNEL_START=0xc0000000
200CONFIG_TASK_SIZE=0x80000000
201CONFIG_CONSISTENT_START=0xff100000
202CONFIG_CONSISTENT_SIZE=0x00200000
203CONFIG_BOOT_LOAD=0x00400000
204
205#
206# Networking
207#
208CONFIG_NET=y
209
210#
211# Networking options
212#
213# CONFIG_NETDEBUG is not set
214CONFIG_PACKET=y
215# CONFIG_PACKET_MMAP is not set
216CONFIG_UNIX=y
217CONFIG_XFRM=y
218# CONFIG_XFRM_USER is not set
219# CONFIG_XFRM_SUB_POLICY is not set
220# CONFIG_NET_KEY is not set
221CONFIG_INET=y
222CONFIG_IP_MULTICAST=y
223# CONFIG_IP_ADVANCED_ROUTER is not set
224CONFIG_IP_FIB_HASH=y
225CONFIG_IP_PNP=y
226# CONFIG_IP_PNP_DHCP is not set
227# CONFIG_IP_PNP_BOOTP is not set
228# CONFIG_IP_PNP_RARP is not set
229# CONFIG_NET_IPIP is not set
230# CONFIG_NET_IPGRE is not set
231# CONFIG_IP_MROUTE is not set
232# CONFIG_ARPD is not set
233CONFIG_SYN_COOKIES=y
234# CONFIG_INET_AH is not set
235# CONFIG_INET_ESP is not set
236# CONFIG_INET_IPCOMP is not set
237# CONFIG_INET_XFRM_TUNNEL is not set
238# CONFIG_INET_TUNNEL is not set
239CONFIG_INET_XFRM_MODE_TRANSPORT=y
240CONFIG_INET_XFRM_MODE_TUNNEL=y
241CONFIG_INET_XFRM_MODE_BEET=y
242CONFIG_INET_DIAG=y
243CONFIG_INET_TCP_DIAG=y
244# CONFIG_TCP_CONG_ADVANCED is not set
245CONFIG_TCP_CONG_CUBIC=y
246CONFIG_DEFAULT_TCP_CONG="cubic"
247# CONFIG_IPV6 is not set
248# CONFIG_INET6_XFRM_TUNNEL is not set
249# CONFIG_INET6_TUNNEL is not set
250# CONFIG_NETWORK_SECMARK is not set
251# CONFIG_NETFILTER is not set
252
253#
254# DCCP Configuration (EXPERIMENTAL)
255#
256# CONFIG_IP_DCCP is not set
257
258#
259# SCTP Configuration (EXPERIMENTAL)
260#
261# CONFIG_IP_SCTP is not set
262
263#
264# TIPC Configuration (EXPERIMENTAL)
265#
266# CONFIG_TIPC is not set
267# CONFIG_ATM is not set
268# CONFIG_BRIDGE is not set
269# CONFIG_VLAN_8021Q is not set
270# CONFIG_DECNET is not set
271# CONFIG_LLC2 is not set
272# CONFIG_IPX is not set
273# CONFIG_ATALK is not set
274# CONFIG_X25 is not set
275# CONFIG_LAPB is not set
276# CONFIG_ECONET is not set
277# CONFIG_WAN_ROUTER is not set
278
279#
280# QoS and/or fair queueing
281#
282# CONFIG_NET_SCHED is not set
283
284#
285# Network testing
286#
287# CONFIG_NET_PKTGEN is not set
288# CONFIG_HAMRADIO is not set
289# CONFIG_IRDA is not set
290# CONFIG_BT is not set
291# CONFIG_IEEE80211 is not set
292
293#
294# Device Drivers
295#
296
297#
298# Generic Driver Options
299#
300CONFIG_STANDALONE=y
301CONFIG_PREVENT_FIRMWARE_BUILD=y
302# CONFIG_SYS_HYPERVISOR is not set
303
304#
305# Connector - unified userspace <-> kernelspace linker
306#
307# CONFIG_CONNECTOR is not set
308
309#
310# Memory Technology Devices (MTD)
311#
312# CONFIG_MTD is not set
313
314#
315# Parallel port support
316#
317# CONFIG_PARPORT is not set
318
319#
320# Plug and Play support
321#
322
323#
324# Block devices
325#
326# CONFIG_BLK_DEV_FD is not set
327# CONFIG_BLK_DEV_COW_COMMON is not set
328CONFIG_BLK_DEV_LOOP=y
329# CONFIG_BLK_DEV_CRYPTOLOOP is not set
330# CONFIG_BLK_DEV_NBD is not set
331# CONFIG_BLK_DEV_RAM is not set
332# CONFIG_BLK_DEV_INITRD is not set
333# CONFIG_CDROM_PKTCDVD is not set
334# CONFIG_ATA_OVER_ETH is not set
335
336#
337# Misc devices
338#
339# CONFIG_TIFM_CORE is not set
340
341#
342# ATA/ATAPI/MFM/RLL support
343#
344# CONFIG_IDE is not set
345
346#
347# SCSI device support
348#
349# CONFIG_RAID_ATTRS is not set
350# CONFIG_SCSI is not set
351# CONFIG_SCSI_NETLINK is not set
352
353#
354# Serial ATA (prod) and Parallel ATA (experimental) drivers
355#
356# CONFIG_ATA is not set
357
358#
359# Multi-device support (RAID and LVM)
360#
361# CONFIG_MD is not set
362
363#
364# Fusion MPT device support
365#
366# CONFIG_FUSION is not set
367
368#
369# IEEE 1394 (FireWire) support
370#
371
372#
373# I2O device support
374#
375
376#
377# Macintosh device drivers
378#
379# CONFIG_WINDFARM is not set
380
381#
382# Network device support
383#
384CONFIG_NETDEVICES=y
385# CONFIG_DUMMY is not set
386# CONFIG_BONDING is not set
387# CONFIG_EQUALIZER is not set
388# CONFIG_TUN is not set
389
390#
391# PHY device support
392#
393CONFIG_PHYLIB=y
394
395#
396# MII PHY device drivers
397#
398# CONFIG_MARVELL_PHY is not set
399CONFIG_DAVICOM_PHY=y
400# CONFIG_QSEMI_PHY is not set
401# CONFIG_LXT_PHY is not set
402# CONFIG_CICADA_PHY is not set
403# CONFIG_VITESSE_PHY is not set
404# CONFIG_SMSC_PHY is not set
405CONFIG_FIXED_PHY=y
406CONFIG_FIXED_MII_10_FDX=y
407# CONFIG_FIXED_MII_100_FDX is not set
408
409#
410# Ethernet (10 or 100Mbit)
411#
412CONFIG_NET_ETHERNET=y
413CONFIG_MII=y
414# CONFIG_FEC_8XX is not set
415CONFIG_FS_ENET=y
416CONFIG_FS_ENET_HAS_SCC=y
417CONFIG_FS_ENET_HAS_FEC=y
418
419#
420# Ethernet (1000 Mbit)
421#
422
423#
424# Ethernet (10000 Mbit)
425#
426
427#
428# Token Ring devices
429#
430
431#
432# Wireless LAN (non-hamradio)
433#
434# CONFIG_NET_RADIO is not set
435
436#
437# Wan interfaces
438#
439# CONFIG_WAN is not set
440# CONFIG_PPP is not set
441# CONFIG_SLIP is not set
442# CONFIG_SHAPER is not set
443# CONFIG_NETCONSOLE is not set
444# CONFIG_NETPOLL is not set
445# CONFIG_NET_POLL_CONTROLLER is not set
446
447#
448# ISDN subsystem
449#
450# CONFIG_ISDN is not set
451
452#
453# Telephony Support
454#
455# CONFIG_PHONE is not set
456
457#
458# Input device support
459#
460CONFIG_INPUT=y
461# CONFIG_INPUT_FF_MEMLESS is not set
462
463#
464# Userland interfaces
465#
466CONFIG_INPUT_MOUSEDEV=y
467CONFIG_INPUT_MOUSEDEV_PSAUX=y
468CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
469CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
470# CONFIG_INPUT_JOYDEV is not set
471# CONFIG_INPUT_TSDEV is not set
472# CONFIG_INPUT_EVDEV is not set
473# CONFIG_INPUT_EVBUG is not set
474
475#
476# Input Device Drivers
477#
478CONFIG_INPUT_KEYBOARD=y
479CONFIG_KEYBOARD_ATKBD=y
480# CONFIG_KEYBOARD_SUNKBD is not set
481# CONFIG_KEYBOARD_LKKBD is not set
482# CONFIG_KEYBOARD_XTKBD is not set
483# CONFIG_KEYBOARD_NEWTON is not set
484# CONFIG_KEYBOARD_STOWAWAY is not set
485CONFIG_INPUT_MOUSE=y
486CONFIG_MOUSE_PS2=y
487# CONFIG_MOUSE_SERIAL is not set
488# CONFIG_MOUSE_VSXXXAA is not set
489# CONFIG_INPUT_JOYSTICK is not set
490# CONFIG_INPUT_TOUCHSCREEN is not set
491# CONFIG_INPUT_MISC is not set
492
493#
494# Hardware I/O ports
495#
496CONFIG_SERIO=y
497CONFIG_SERIO_I8042=y
498CONFIG_SERIO_SERPORT=y
499CONFIG_SERIO_LIBPS2=y
500# CONFIG_SERIO_RAW is not set
501# CONFIG_GAMEPORT is not set
502
503#
504# Character devices
505#
506# CONFIG_VT is not set
507# CONFIG_SERIAL_NONSTANDARD is not set
508
509#
510# Serial drivers
511#
512# CONFIG_SERIAL_8250 is not set
513
514#
515# Non-8250 serial port support
516#
517CONFIG_SERIAL_CORE=y
518CONFIG_SERIAL_CORE_CONSOLE=y
519CONFIG_SERIAL_CPM=y
520CONFIG_SERIAL_CPM_CONSOLE=y
521# CONFIG_SERIAL_CPM_SCC1 is not set
522# CONFIG_SERIAL_CPM_SCC2 is not set
523# CONFIG_SERIAL_CPM_SCC3 is not set
524# CONFIG_SERIAL_CPM_SCC4 is not set
525CONFIG_SERIAL_CPM_SMC1=y
526CONFIG_SERIAL_CPM_SMC2=y
527CONFIG_UNIX98_PTYS=y
528# CONFIG_LEGACY_PTYS is not set
529
530#
531# IPMI
532#
533# CONFIG_IPMI_HANDLER is not set
534
535#
536# Watchdog Cards
537#
538# CONFIG_WATCHDOG is not set
539CONFIG_HW_RANDOM=y
540# CONFIG_NVRAM is not set
541CONFIG_GEN_RTC=y
542# CONFIG_GEN_RTC_X is not set
543# CONFIG_DTLK is not set
544# CONFIG_R3964 is not set
545
546#
547# Ftape, the floppy tape device driver
548#
549# CONFIG_RAW_DRIVER is not set
550
551#
552# TPM devices
553#
554# CONFIG_TCG_TPM is not set
555
556#
557# I2C support
558#
559# CONFIG_I2C is not set
560
561#
562# SPI support
563#
564# CONFIG_SPI is not set
565# CONFIG_SPI_MASTER is not set
566
567#
568# Dallas's 1-wire bus
569#
570# CONFIG_W1 is not set
571
572#
573# Hardware Monitoring support
574#
575CONFIG_HWMON=y
576# CONFIG_HWMON_VID is not set
577# CONFIG_SENSORS_ABITUGURU is not set
578# CONFIG_SENSORS_F71805F is not set
579# CONFIG_SENSORS_VT1211 is not set
580# CONFIG_HWMON_DEBUG_CHIP is not set
581
582#
583# Multimedia devices
584#
585# CONFIG_VIDEO_DEV is not set
586
587#
588# Digital Video Broadcasting Devices
589#
590# CONFIG_DVB is not set
591
592#
593# Graphics support
594#
595CONFIG_FIRMWARE_EDID=y
596# CONFIG_FB is not set
597# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
598
599#
600# Sound
601#
602# CONFIG_SOUND is not set
603
604#
605# USB support
606#
607# CONFIG_USB_ARCH_HAS_HCD is not set
608# CONFIG_USB_ARCH_HAS_OHCI is not set
609# CONFIG_USB_ARCH_HAS_EHCI is not set
610
611#
612# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
613#
614
615#
616# USB Gadget Support
617#
618# CONFIG_USB_GADGET is not set
619
620#
621# MMC/SD Card support
622#
623# CONFIG_MMC is not set
624
625#
626# LED devices
627#
628# CONFIG_NEW_LEDS is not set
629
630#
631# LED drivers
632#
633
634#
635# LED Triggers
636#
637
638#
639# InfiniBand support
640#
641
642#
643# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
644#
645
646#
647# Real Time Clock
648#
649# CONFIG_RTC_CLASS is not set
650
651#
652# DMA Engine support
653#
654# CONFIG_DMA_ENGINE is not set
655
656#
657# DMA Clients
658#
659
660#
661# DMA Devices
662#
663
664#
665# File systems
666#
667CONFIG_EXT2_FS=y
668CONFIG_EXT2_FS_XATTR=y
669# CONFIG_EXT2_FS_POSIX_ACL is not set
670# CONFIG_EXT2_FS_SECURITY is not set
671# CONFIG_EXT2_FS_XIP is not set
672CONFIG_EXT3_FS=y
673CONFIG_EXT3_FS_XATTR=y
674# CONFIG_EXT3_FS_POSIX_ACL is not set
675# CONFIG_EXT3_FS_SECURITY is not set
676# CONFIG_EXT4DEV_FS is not set
677CONFIG_JBD=y
678# CONFIG_JBD_DEBUG is not set
679CONFIG_FS_MBCACHE=y
680# CONFIG_REISERFS_FS is not set
681# CONFIG_JFS_FS is not set
682# CONFIG_FS_POSIX_ACL is not set
683# CONFIG_XFS_FS is not set
684# CONFIG_GFS2_FS is not set
685# CONFIG_OCFS2_FS is not set
686# CONFIG_MINIX_FS is not set
687# CONFIG_ROMFS_FS is not set
688CONFIG_INOTIFY=y
689CONFIG_INOTIFY_USER=y
690# CONFIG_QUOTA is not set
691CONFIG_DNOTIFY=y
692# CONFIG_AUTOFS_FS is not set
693# CONFIG_AUTOFS4_FS is not set
694# CONFIG_FUSE_FS is not set
695
696#
697# CD-ROM/DVD Filesystems
698#
699# CONFIG_ISO9660_FS is not set
700# CONFIG_UDF_FS is not set
701
702#
703# DOS/FAT/NT Filesystems
704#
705# CONFIG_MSDOS_FS is not set
706# CONFIG_VFAT_FS is not set
707# CONFIG_NTFS_FS is not set
708
709#
710# Pseudo filesystems
711#
712CONFIG_PROC_FS=y
713# CONFIG_PROC_KCORE is not set
714CONFIG_PROC_SYSCTL=y
715CONFIG_SYSFS=y
716CONFIG_TMPFS=y
717# CONFIG_TMPFS_POSIX_ACL is not set
718# CONFIG_HUGETLB_PAGE is not set
719CONFIG_RAMFS=y
720# CONFIG_CONFIGFS_FS is not set
721
722#
723# Miscellaneous filesystems
724#
725# CONFIG_ADFS_FS is not set
726# CONFIG_AFFS_FS is not set
727# CONFIG_HFS_FS is not set
728# CONFIG_HFSPLUS_FS is not set
729# CONFIG_BEFS_FS is not set
730# CONFIG_BFS_FS is not set
731# CONFIG_EFS_FS is not set
732CONFIG_CRAMFS=y
733# CONFIG_VXFS_FS is not set
734# CONFIG_HPFS_FS is not set
735# CONFIG_QNX4FS_FS is not set
736# CONFIG_SYSV_FS is not set
737# CONFIG_UFS_FS is not set
738
739#
740# Network File Systems
741#
742CONFIG_NFS_FS=y
743CONFIG_NFS_V3=y
744# CONFIG_NFS_V3_ACL is not set
745# CONFIG_NFS_V4 is not set
746# CONFIG_NFS_DIRECTIO is not set
747# CONFIG_NFSD is not set
748CONFIG_ROOT_NFS=y
749CONFIG_LOCKD=y
750CONFIG_LOCKD_V4=y
751CONFIG_NFS_COMMON=y
752CONFIG_SUNRPC=y
753# CONFIG_RPCSEC_GSS_KRB5 is not set
754# CONFIG_RPCSEC_GSS_SPKM3 is not set
755# CONFIG_SMB_FS is not set
756# CONFIG_CIFS is not set
757# CONFIG_NCP_FS is not set
758# CONFIG_CODA_FS is not set
759# CONFIG_AFS_FS is not set
760# CONFIG_9P_FS is not set
761
762#
763# Partition Types
764#
765CONFIG_PARTITION_ADVANCED=y
766# CONFIG_ACORN_PARTITION is not set
767# CONFIG_OSF_PARTITION is not set
768# CONFIG_AMIGA_PARTITION is not set
769# CONFIG_ATARI_PARTITION is not set
770# CONFIG_MAC_PARTITION is not set
771CONFIG_MSDOS_PARTITION=y
772# CONFIG_BSD_DISKLABEL is not set
773# CONFIG_MINIX_SUBPARTITION is not set
774# CONFIG_SOLARIS_X86_PARTITION is not set
775# CONFIG_UNIXWARE_DISKLABEL is not set
776# CONFIG_LDM_PARTITION is not set
777# CONFIG_SGI_PARTITION is not set
778# CONFIG_ULTRIX_PARTITION is not set
779# CONFIG_SUN_PARTITION is not set
780# CONFIG_KARMA_PARTITION is not set
781# CONFIG_EFI_PARTITION is not set
782
783#
784# Native Language Support
785#
786# CONFIG_NLS is not set
787
788#
789# Library routines
790#
791CONFIG_CRC_CCITT=y
792# CONFIG_CRC16 is not set
793CONFIG_CRC32=y
794# CONFIG_LIBCRC32C is not set
795CONFIG_ZLIB_INFLATE=y
796CONFIG_PLIST=y
797
798#
799# Instrumentation Support
800#
801# CONFIG_PROFILING is not set
802
803#
804# Kernel hacking
805#
806# CONFIG_PRINTK_TIME is not set
807CONFIG_ENABLE_MUST_CHECK=y
808# CONFIG_MAGIC_SYSRQ is not set
809# CONFIG_UNUSED_SYMBOLS is not set
810# CONFIG_DEBUG_KERNEL is not set
811CONFIG_LOG_BUF_SHIFT=14
812# CONFIG_DEBUG_FS is not set
813# CONFIG_UNWIND_INFO is not set
814# CONFIG_HEADERS_CHECK is not set
815# CONFIG_BOOTX_TEXT is not set
816# CONFIG_PPC_EARLY_DEBUG is not set
817
818#
819# Security options
820#
821# CONFIG_KEYS is not set
822# CONFIG_SECURITY is not set
823
824#
825# Cryptographic options
826#
827# CONFIG_CRYPTO is not set
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig
new file mode 100644
index 000000000000..97a57e996663
--- /dev/null
+++ b/arch/powerpc/configs/pasemi_defconfig
@@ -0,0 +1,1722 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc6
4# Thu Feb 1 22:54:15 2007
5#
6CONFIG_PPC64=y
7CONFIG_64BIT=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
13CONFIG_ARCH_HAS_ILOG2_U32=y
14CONFIG_ARCH_HAS_ILOG2_U64=y
15CONFIG_GENERIC_HWEIGHT=y
16CONFIG_GENERIC_CALIBRATE_DELAY=y
17CONFIG_GENERIC_FIND_NEXT_BIT=y
18CONFIG_PPC=y
19CONFIG_EARLY_PRINTK=y
20CONFIG_COMPAT=y
21CONFIG_SYSVIPC_COMPAT=y
22CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
23CONFIG_ARCH_MAY_HAVE_PC_FDC=y
24CONFIG_PPC_OF=y
25CONFIG_PPC_UDBG_16550=y
26CONFIG_GENERIC_TBSYNC=y
27CONFIG_AUDIT_ARCH=y
28CONFIG_GENERIC_BUG=y
29# CONFIG_DEFAULT_UIMAGE is not set
30
31#
32# Processor support
33#
34CONFIG_POWER4_ONLY=y
35CONFIG_POWER4=y
36CONFIG_PPC_FPU=y
37# CONFIG_PPC_DCR_NATIVE is not set
38# CONFIG_PPC_DCR_MMIO is not set
39# CONFIG_PPC_OF_PLATFORM_PCI is not set
40CONFIG_ALTIVEC=y
41CONFIG_PPC_STD_MMU=y
42# CONFIG_VIRT_CPU_ACCOUNTING is not set
43CONFIG_SMP=y
44CONFIG_NR_CPUS=2
45CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
46
47#
48# Code maturity level options
49#
50CONFIG_EXPERIMENTAL=y
51CONFIG_LOCK_KERNEL=y
52CONFIG_INIT_ENV_ARG_LIMIT=32
53
54#
55# General setup
56#
57CONFIG_LOCALVERSION=""
58CONFIG_LOCALVERSION_AUTO=y
59CONFIG_SWAP=y
60CONFIG_SYSVIPC=y
61# CONFIG_IPC_NS is not set
62# CONFIG_POSIX_MQUEUE is not set
63# CONFIG_BSD_PROCESS_ACCT is not set
64# CONFIG_TASKSTATS is not set
65# CONFIG_UTS_NS is not set
66# CONFIG_AUDIT is not set
67# CONFIG_IKCONFIG is not set
68# CONFIG_CPUSETS is not set
69CONFIG_SYSFS_DEPRECATED=y
70# CONFIG_RELAY is not set
71CONFIG_INITRAMFS_SOURCE=""
72# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
73CONFIG_SYSCTL=y
74# CONFIG_EMBEDDED is not set
75CONFIG_SYSCTL_SYSCALL=y
76CONFIG_KALLSYMS=y
77# CONFIG_KALLSYMS_ALL is not set
78# CONFIG_KALLSYMS_EXTRA_PASS is not set
79CONFIG_HOTPLUG=y
80CONFIG_PRINTK=y
81CONFIG_BUG=y
82CONFIG_ELF_CORE=y
83CONFIG_BASE_FULL=y
84CONFIG_FUTEX=y
85CONFIG_EPOLL=y
86CONFIG_SHMEM=y
87CONFIG_SLAB=y
88CONFIG_VM_EVENT_COUNTERS=y
89CONFIG_RT_MUTEXES=y
90# CONFIG_TINY_SHMEM is not set
91CONFIG_BASE_SMALL=0
92# CONFIG_SLOB is not set
93
94#
95# Loadable module support
96#
97CONFIG_MODULES=y
98CONFIG_MODULE_UNLOAD=y
99# CONFIG_MODULE_FORCE_UNLOAD is not set
100# CONFIG_MODVERSIONS is not set
101# CONFIG_MODULE_SRCVERSION_ALL is not set
102# CONFIG_KMOD is not set
103CONFIG_STOP_MACHINE=y
104
105#
106# Block layer
107#
108CONFIG_BLOCK=y
109# CONFIG_BLK_DEV_IO_TRACE is not set
110
111#
112# IO Schedulers
113#
114CONFIG_IOSCHED_NOOP=y
115CONFIG_IOSCHED_AS=y
116# CONFIG_IOSCHED_DEADLINE is not set
117# CONFIG_IOSCHED_CFQ is not set
118CONFIG_DEFAULT_AS=y
119# CONFIG_DEFAULT_DEADLINE is not set
120# CONFIG_DEFAULT_CFQ is not set
121# CONFIG_DEFAULT_NOOP is not set
122CONFIG_DEFAULT_IOSCHED="anticipatory"
123
124#
125# Platform support
126#
127CONFIG_PPC_MULTIPLATFORM=y
128# CONFIG_EMBEDDED6xx is not set
129# CONFIG_APUS is not set
130CONFIG_PPC_PSERIES=y
131# CONFIG_PPC_ISERIES is not set
132# CONFIG_PPC_MPC52xx is not set
133# CONFIG_PPC_PMAC is not set
134# CONFIG_PPC_MAPLE is not set
135CONFIG_PPC_PASEMI=y
136# CONFIG_PPC_CELL is not set
137# CONFIG_PPC_CELL_NATIVE is not set
138# CONFIG_PPC_IBM_CELL_BLADE is not set
139# CONFIG_PPC_PS3 is not set
140CONFIG_PPC_NATIVE=y
141# CONFIG_UDBG_RTAS_CONSOLE is not set
142CONFIG_XICS=y
143# CONFIG_U3_DART is not set
144CONFIG_PPC_RTAS=y
145CONFIG_RTAS_ERROR_LOGGING=y
146CONFIG_RTAS_PROC=y
147# CONFIG_RTAS_FLASH is not set
148# CONFIG_MMIO_NVRAM is not set
149CONFIG_IBMVIO=y
150# CONFIG_IBMEBUS is not set
151# CONFIG_PPC_MPC106 is not set
152# CONFIG_PPC_970_NAP is not set
153# CONFIG_PPC_INDIRECT_IO is not set
154# CONFIG_GENERIC_IOMAP is not set
155# CONFIG_CPU_FREQ is not set
156# CONFIG_WANT_EARLY_SERIAL is not set
157CONFIG_MPIC=y
158
159#
160# PA Semi PWRficient options
161#
162CONFIG_PPC_PASEMI_IOMMU=y
163
164#
165# Kernel options
166#
167CONFIG_HZ_100=y
168# CONFIG_HZ_250 is not set
169# CONFIG_HZ_300 is not set
170# CONFIG_HZ_1000 is not set
171CONFIG_HZ=100
172CONFIG_PREEMPT_NONE=y
173# CONFIG_PREEMPT_VOLUNTARY is not set
174# CONFIG_PREEMPT is not set
175CONFIG_PREEMPT_BKL=y
176CONFIG_BINFMT_ELF=y
177# CONFIG_BINFMT_MISC is not set
178CONFIG_FORCE_MAX_ZONEORDER=13
179CONFIG_IOMMU_VMERGE=y
180# CONFIG_HOTPLUG_CPU is not set
181CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
182# CONFIG_KEXEC is not set
183# CONFIG_CRASH_DUMP is not set
184# CONFIG_IRQ_ALL_CPUS is not set
185# CONFIG_PPC_SPLPAR is not set
186CONFIG_EEH=y
187# CONFIG_SCANLOG is not set
188# CONFIG_LPARCFG is not set
189# CONFIG_NUMA is not set
190CONFIG_ARCH_SELECT_MEMORY_MODEL=y
191CONFIG_ARCH_FLATMEM_ENABLE=y
192CONFIG_ARCH_SPARSEMEM_ENABLE=y
193CONFIG_ARCH_SPARSEMEM_DEFAULT=y
194CONFIG_ARCH_POPULATES_NODE_MAP=y
195CONFIG_SELECT_MEMORY_MODEL=y
196CONFIG_FLATMEM_MANUAL=y
197# CONFIG_DISCONTIGMEM_MANUAL is not set
198# CONFIG_SPARSEMEM_MANUAL is not set
199CONFIG_FLATMEM=y
200CONFIG_FLAT_NODE_MEM_MAP=y
201# CONFIG_SPARSEMEM_STATIC is not set
202CONFIG_SPLIT_PTLOCK_CPUS=4
203CONFIG_RESOURCES_64BIT=y
204# CONFIG_PPC_64K_PAGES is not set
205# CONFIG_SCHED_SMT is not set
206CONFIG_PROC_DEVICETREE=y
207# CONFIG_CMDLINE_BOOL is not set
208# CONFIG_PM is not set
209# CONFIG_SECCOMP is not set
210CONFIG_ISA_DMA_API=y
211
212#
213# Bus options
214#
215CONFIG_GENERIC_ISA_DMA=y
216# CONFIG_MPIC_WEIRD is not set
217CONFIG_PPC_I8259=y
218# CONFIG_PPC_INDIRECT_PCI is not set
219CONFIG_PCI=y
220CONFIG_PCI_DOMAINS=y
221# CONFIG_PCIEPORTBUS is not set
222# CONFIG_PCI_DEBUG is not set
223
224#
225# PCCARD (PCMCIA/CardBus) support
226#
227CONFIG_PCCARD=y
228CONFIG_PCMCIA_DEBUG=y
229CONFIG_PCMCIA=y
230CONFIG_PCMCIA_LOAD_CIS=y
231CONFIG_PCMCIA_IOCTL=y
232CONFIG_CARDBUS=y
233
234#
235# PC-card bridges
236#
237# CONFIG_YENTA is not set
238# CONFIG_PD6729 is not set
239# CONFIG_I82092 is not set
240
241#
242# PCI Hotplug Support
243#
244# CONFIG_HOTPLUG_PCI is not set
245CONFIG_KERNEL_START=0xc000000000000000
246
247#
248# Networking
249#
250CONFIG_NET=y
251
252#
253# Networking options
254#
255# CONFIG_NETDEBUG is not set
256CONFIG_PACKET=y
257# CONFIG_PACKET_MMAP is not set
258CONFIG_UNIX=y
259CONFIG_XFRM=y
260# CONFIG_XFRM_USER is not set
261# CONFIG_XFRM_SUB_POLICY is not set
262CONFIG_NET_KEY=y
263CONFIG_INET=y
264CONFIG_IP_MULTICAST=y
265# CONFIG_IP_ADVANCED_ROUTER is not set
266CONFIG_IP_FIB_HASH=y
267CONFIG_IP_PNP=y
268CONFIG_IP_PNP_DHCP=y
269CONFIG_IP_PNP_BOOTP=y
270CONFIG_IP_PNP_RARP=y
271CONFIG_NET_IPIP=y
272# CONFIG_NET_IPGRE is not set
273# CONFIG_IP_MROUTE is not set
274# CONFIG_ARPD is not set
275CONFIG_SYN_COOKIES=y
276CONFIG_INET_AH=y
277CONFIG_INET_ESP=y
278# CONFIG_INET_IPCOMP is not set
279# CONFIG_INET_XFRM_TUNNEL is not set
280CONFIG_INET_TUNNEL=y
281CONFIG_INET_XFRM_MODE_TRANSPORT=y
282CONFIG_INET_XFRM_MODE_TUNNEL=y
283CONFIG_INET_XFRM_MODE_BEET=y
284CONFIG_INET_DIAG=y
285CONFIG_INET_TCP_DIAG=y
286# CONFIG_TCP_CONG_ADVANCED is not set
287CONFIG_TCP_CONG_CUBIC=y
288CONFIG_DEFAULT_TCP_CONG="cubic"
289# CONFIG_TCP_MD5SIG is not set
290# CONFIG_IPV6 is not set
291# CONFIG_INET6_XFRM_TUNNEL is not set
292# CONFIG_INET6_TUNNEL is not set
293# CONFIG_NETWORK_SECMARK is not set
294# CONFIG_NETFILTER is not set
295
296#
297# DCCP Configuration (EXPERIMENTAL)
298#
299# CONFIG_IP_DCCP is not set
300
301#
302# SCTP Configuration (EXPERIMENTAL)
303#
304# CONFIG_IP_SCTP is not set
305
306#
307# TIPC Configuration (EXPERIMENTAL)
308#
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
322#
323# QoS and/or fair queueing
324#
325# CONFIG_NET_SCHED is not set
326
327#
328# Network testing
329#
330# CONFIG_NET_PKTGEN is not set
331# CONFIG_HAMRADIO is not set
332# CONFIG_IRDA is not set
333# CONFIG_BT is not set
334# CONFIG_IEEE80211 is not set
335
336#
337# Device Drivers
338#
339
340#
341# Generic Driver Options
342#
343CONFIG_STANDALONE=y
344CONFIG_PREVENT_FIRMWARE_BUILD=y
345CONFIG_FW_LOADER=y
346# CONFIG_DEBUG_DRIVER is not set
347# CONFIG_SYS_HYPERVISOR is not set
348
349#
350# Connector - unified userspace <-> kernelspace linker
351#
352# CONFIG_CONNECTOR is not set
353
354#
355# Memory Technology Devices (MTD)
356#
357CONFIG_MTD=y
358# CONFIG_MTD_DEBUG is not set
359CONFIG_MTD_CONCAT=y
360# CONFIG_MTD_PARTITIONS is not set
361
362#
363# User Modules And Translation Layers
364#
365CONFIG_MTD_CHAR=y
366CONFIG_MTD_BLKDEVS=y
367CONFIG_MTD_BLOCK=y
368# CONFIG_FTL is not set
369# CONFIG_NFTL is not set
370# CONFIG_INFTL is not set
371# CONFIG_RFD_FTL is not set
372# CONFIG_SSFDC is not set
373
374#
375# RAM/ROM/Flash chip drivers
376#
377# CONFIG_MTD_CFI is not set
378# CONFIG_MTD_JEDECPROBE is not set
379CONFIG_MTD_MAP_BANK_WIDTH_1=y
380CONFIG_MTD_MAP_BANK_WIDTH_2=y
381CONFIG_MTD_MAP_BANK_WIDTH_4=y
382# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
383# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
384# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
385CONFIG_MTD_CFI_I1=y
386CONFIG_MTD_CFI_I2=y
387# CONFIG_MTD_CFI_I4 is not set
388# CONFIG_MTD_CFI_I8 is not set
389# CONFIG_MTD_RAM is not set
390# CONFIG_MTD_ROM is not set
391# CONFIG_MTD_ABSENT is not set
392# CONFIG_MTD_OBSOLETE_CHIPS is not set
393
394#
395# Mapping drivers for chip access
396#
397# CONFIG_MTD_COMPLEX_MAPPINGS is not set
398# CONFIG_MTD_PLATRAM is not set
399
400#
401# Self-contained MTD device drivers
402#
403# CONFIG_MTD_PMC551 is not set
404CONFIG_MTD_SLRAM=y
405CONFIG_MTD_PHRAM=y
406# CONFIG_MTD_MTDRAM is not set
407# CONFIG_MTD_BLOCK2MTD is not set
408
409#
410# Disk-On-Chip Device Drivers
411#
412# CONFIG_MTD_DOC2000 is not set
413# CONFIG_MTD_DOC2001 is not set
414# CONFIG_MTD_DOC2001PLUS is not set
415
416#
417# NAND Flash Device Drivers
418#
419# CONFIG_MTD_NAND is not set
420# CONFIG_MTD_NAND_CAFE is not set
421
422#
423# OneNAND Flash Device Drivers
424#
425# CONFIG_MTD_ONENAND is not set
426
427#
428# Parallel port support
429#
430# CONFIG_PARPORT is not set
431
432#
433# Plug and Play support
434#
435
436#
437# Block devices
438#
439# CONFIG_BLK_DEV_FD is not set
440# CONFIG_BLK_CPQ_DA is not set
441# CONFIG_BLK_CPQ_CISS_DA is not set
442# CONFIG_BLK_DEV_DAC960 is not set
443# CONFIG_BLK_DEV_UMEM is not set
444# CONFIG_BLK_DEV_COW_COMMON is not set
445CONFIG_BLK_DEV_LOOP=y
446# CONFIG_BLK_DEV_CRYPTOLOOP is not set
447# CONFIG_BLK_DEV_NBD is not set
448# CONFIG_BLK_DEV_SX8 is not set
449# CONFIG_BLK_DEV_UB is not set
450CONFIG_BLK_DEV_RAM=y
451CONFIG_BLK_DEV_RAM_COUNT=16
452CONFIG_BLK_DEV_RAM_SIZE=16384
453CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
454CONFIG_BLK_DEV_INITRD=y
455# CONFIG_CDROM_PKTCDVD is not set
456# CONFIG_ATA_OVER_ETH is not set
457
458#
459# Misc devices
460#
461# CONFIG_SGI_IOC4 is not set
462# CONFIG_TIFM_CORE is not set
463
464#
465# ATA/ATAPI/MFM/RLL support
466#
467CONFIG_IDE=y
468CONFIG_BLK_DEV_IDE=y
469
470#
471# Please see Documentation/ide.txt for help/info on IDE drives
472#
473# CONFIG_BLK_DEV_IDE_SATA is not set
474CONFIG_BLK_DEV_IDEDISK=y
475CONFIG_IDEDISK_MULTI_MODE=y
476# CONFIG_BLK_DEV_IDECS is not set
477CONFIG_BLK_DEV_IDECD=y
478# CONFIG_BLK_DEV_IDETAPE is not set
479# CONFIG_BLK_DEV_IDEFLOPPY is not set
480CONFIG_BLK_DEV_IDESCSI=y
481CONFIG_IDE_TASK_IOCTL=y
482
483#
484# IDE chipset support/bugfixes
485#
486# CONFIG_IDE_GENERIC is not set
487# CONFIG_BLK_DEV_IDEPCI is not set
488# CONFIG_IDE_ARM is not set
489# CONFIG_BLK_DEV_IDEDMA is not set
490# CONFIG_IDEDMA_AUTO is not set
491# CONFIG_BLK_DEV_HD is not set
492
493#
494# SCSI device support
495#
496# CONFIG_RAID_ATTRS is not set
497CONFIG_SCSI=y
498# CONFIG_SCSI_TGT is not set
499# CONFIG_SCSI_NETLINK is not set
500CONFIG_SCSI_PROC_FS=y
501
502#
503# SCSI support type (disk, tape, CD-ROM)
504#
505CONFIG_BLK_DEV_SD=y
506CONFIG_CHR_DEV_ST=y
507CONFIG_CHR_DEV_OSST=y
508CONFIG_BLK_DEV_SR=y
509CONFIG_BLK_DEV_SR_VENDOR=y
510CONFIG_CHR_DEV_SG=y
511CONFIG_CHR_DEV_SCH=y
512
513#
514# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
515#
516CONFIG_SCSI_MULTI_LUN=y
517CONFIG_SCSI_CONSTANTS=y
518CONFIG_SCSI_LOGGING=y
519# CONFIG_SCSI_SCAN_ASYNC is not set
520
521#
522# SCSI Transports
523#
524# CONFIG_SCSI_SPI_ATTRS is not set
525# CONFIG_SCSI_FC_ATTRS is not set
526# CONFIG_SCSI_ISCSI_ATTRS is not set
527# CONFIG_SCSI_SAS_ATTRS is not set
528# CONFIG_SCSI_SAS_LIBSAS is not set
529
530#
531# SCSI low-level drivers
532#
533# CONFIG_ISCSI_TCP is not set
534CONFIG_BLK_DEV_3W_XXXX_RAID=y
535CONFIG_SCSI_3W_9XXX=y
536# CONFIG_SCSI_ACARD is not set
537# CONFIG_SCSI_AACRAID is not set
538# CONFIG_SCSI_AIC7XXX is not set
539# CONFIG_SCSI_AIC7XXX_OLD is not set
540# CONFIG_SCSI_AIC79XX is not set
541# CONFIG_SCSI_AIC94XX is not set
542# CONFIG_SCSI_ARCMSR is not set
543# CONFIG_MEGARAID_NEWGEN is not set
544# CONFIG_MEGARAID_LEGACY is not set
545# CONFIG_MEGARAID_SAS is not set
546# CONFIG_SCSI_HPTIOP is not set
547# CONFIG_SCSI_BUSLOGIC is not set
548# CONFIG_SCSI_DMX3191D is not set
549# CONFIG_SCSI_EATA is not set
550# CONFIG_SCSI_FUTURE_DOMAIN is not set
551# CONFIG_SCSI_GDTH is not set
552# CONFIG_SCSI_IPS is not set
553# CONFIG_SCSI_IBMVSCSI is not set
554# CONFIG_SCSI_INITIO is not set
555# CONFIG_SCSI_INIA100 is not set
556# CONFIG_SCSI_STEX is not set
557# CONFIG_SCSI_SYM53C8XX_2 is not set
558# CONFIG_SCSI_IPR is not set
559# CONFIG_SCSI_QLOGIC_1280 is not set
560# CONFIG_SCSI_QLA_FC is not set
561# CONFIG_SCSI_QLA_ISCSI is not set
562# CONFIG_SCSI_LPFC is not set
563# CONFIG_SCSI_DC395x is not set
564# CONFIG_SCSI_DC390T is not set
565# CONFIG_SCSI_DEBUG is not set
566# CONFIG_SCSI_SRP is not set
567
568#
569# PCMCIA SCSI adapter support
570#
571# CONFIG_PCMCIA_FDOMAIN is not set
572# CONFIG_PCMCIA_QLOGIC is not set
573# CONFIG_PCMCIA_SYM53C500 is not set
574
575#
576# Serial ATA (prod) and Parallel ATA (experimental) drivers
577#
578CONFIG_ATA=y
579# CONFIG_ATA_NONSTANDARD is not set
580# CONFIG_SATA_AHCI is not set
581CONFIG_SATA_SVW=y
582# CONFIG_ATA_PIIX is not set
583CONFIG_SATA_MV=y
584# CONFIG_SATA_NV is not set
585# CONFIG_PDC_ADMA is not set
586# CONFIG_SATA_QSTOR is not set
587# CONFIG_SATA_PROMISE is not set
588# CONFIG_SATA_SX4 is not set
589CONFIG_SATA_SIL=y
590CONFIG_SATA_SIL24=y
591# CONFIG_SATA_SIS is not set
592# CONFIG_SATA_ULI is not set
593# CONFIG_SATA_VIA is not set
594# CONFIG_SATA_VITESSE is not set
595# CONFIG_PATA_ALI is not set
596# CONFIG_PATA_AMD is not set
597# CONFIG_PATA_ARTOP is not set
598# CONFIG_PATA_ATIIXP is not set
599# CONFIG_PATA_CMD64X is not set
600# CONFIG_PATA_CS5520 is not set
601# CONFIG_PATA_CS5530 is not set
602# CONFIG_PATA_CYPRESS is not set
603# CONFIG_PATA_EFAR is not set
604CONFIG_ATA_GENERIC=y
605# CONFIG_PATA_HPT366 is not set
606# CONFIG_PATA_HPT37X is not set
607# CONFIG_PATA_HPT3X2N is not set
608# CONFIG_PATA_HPT3X3 is not set
609# CONFIG_PATA_IT821X is not set
610# CONFIG_PATA_JMICRON is not set
611# CONFIG_PATA_TRIFLEX is not set
612# CONFIG_PATA_MARVELL is not set
613# CONFIG_PATA_MPIIX is not set
614# CONFIG_PATA_OLDPIIX is not set
615# CONFIG_PATA_NETCELL is not set
616# CONFIG_PATA_NS87410 is not set
617# CONFIG_PATA_OPTI is not set
618# CONFIG_PATA_OPTIDMA is not set
619# CONFIG_PATA_PCMCIA is not set
620# CONFIG_PATA_PDC_OLD is not set
621# CONFIG_PATA_RADISYS is not set
622# CONFIG_PATA_RZ1000 is not set
623# CONFIG_PATA_SC1200 is not set
624# CONFIG_PATA_SERVERWORKS is not set
625# CONFIG_PATA_PDC2027X is not set
626# CONFIG_PATA_SIL680 is not set
627# CONFIG_PATA_SIS is not set
628# CONFIG_PATA_VIA is not set
629# CONFIG_PATA_WINBOND is not set
630
631#
632# Multi-device support (RAID and LVM)
633#
634# CONFIG_MD is not set
635
636#
637# Fusion MPT device support
638#
639# CONFIG_FUSION is not set
640# CONFIG_FUSION_SPI is not set
641# CONFIG_FUSION_FC is not set
642# CONFIG_FUSION_SAS is not set
643
644#
645# IEEE 1394 (FireWire) support
646#
647CONFIG_IEEE1394=y
648
649#
650# Subsystem Options
651#
652# CONFIG_IEEE1394_VERBOSEDEBUG is not set
653# CONFIG_IEEE1394_OUI_DB is not set
654# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set
655# CONFIG_IEEE1394_EXPORT_FULL_API is not set
656
657#
658# Device Drivers
659#
660CONFIG_IEEE1394_PCILYNX=y
661CONFIG_IEEE1394_OHCI1394=y
662
663#
664# Protocol Drivers
665#
666# CONFIG_IEEE1394_VIDEO1394 is not set
667CONFIG_IEEE1394_SBP2=y
668# CONFIG_IEEE1394_ETH1394 is not set
669# CONFIG_IEEE1394_DV1394 is not set
670CONFIG_IEEE1394_RAWIO=y
671
672#
673# I2O device support
674#
675# CONFIG_I2O is not set
676
677#
678# Macintosh device drivers
679#
680# CONFIG_MAC_EMUMOUSEBTN is not set
681# CONFIG_WINDFARM is not set
682
683#
684# Network device support
685#
686CONFIG_NETDEVICES=y
687CONFIG_DUMMY=y
688# CONFIG_BONDING is not set
689# CONFIG_EQUALIZER is not set
690# CONFIG_TUN is not set
691
692#
693# ARCnet devices
694#
695# CONFIG_ARCNET is not set
696
697#
698# PHY device support
699#
700# CONFIG_PHYLIB is not set
701
702#
703# Ethernet (10 or 100Mbit)
704#
705CONFIG_NET_ETHERNET=y
706CONFIG_MII=y
707# CONFIG_HAPPYMEAL is not set
708# CONFIG_SUNGEM is not set
709# CONFIG_CASSINI is not set
710# CONFIG_NET_VENDOR_3COM is not set
711
712#
713# Tulip family network device support
714#
715# CONFIG_NET_TULIP is not set
716# CONFIG_HP100 is not set
717CONFIG_IBMVETH=y
718CONFIG_NET_PCI=y
719# CONFIG_PCNET32 is not set
720# CONFIG_AMD8111_ETH is not set
721# CONFIG_ADAPTEC_STARFIRE is not set
722# CONFIG_B44 is not set
723# CONFIG_FORCEDETH is not set
724# CONFIG_DGRS is not set
725CONFIG_EEPRO100=y
726# CONFIG_E100 is not set
727# CONFIG_FEALNX is not set
728# CONFIG_NATSEMI is not set
729# CONFIG_NE2K_PCI is not set
730# CONFIG_8139CP is not set
731# CONFIG_8139TOO is not set
732# CONFIG_SIS900 is not set
733# CONFIG_EPIC100 is not set
734# CONFIG_SUNDANCE is not set
735# CONFIG_VIA_RHINE is not set
736
737#
738# Ethernet (1000 Mbit)
739#
740# CONFIG_ACENIC is not set
741# CONFIG_DL2K is not set
742CONFIG_E1000=y
743CONFIG_E1000_NAPI=y
744# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
745# CONFIG_NS83820 is not set
746# CONFIG_HAMACHI is not set
747# CONFIG_YELLOWFIN is not set
748# CONFIG_R8169 is not set
749# CONFIG_SIS190 is not set
750# CONFIG_SKGE is not set
751# CONFIG_SKY2 is not set
752# CONFIG_SK98LIN is not set
753# CONFIG_VIA_VELOCITY is not set
754CONFIG_TIGON3=y
755# CONFIG_BNX2 is not set
756# CONFIG_QLA3XXX is not set
757
758#
759# Ethernet (10000 Mbit)
760#
761# CONFIG_CHELSIO_T1 is not set
762# CONFIG_IXGB is not set
763# CONFIG_S2IO is not set
764# CONFIG_MYRI10GE is not set
765# CONFIG_NETXEN_NIC is not set
766
767#
768# Token Ring devices
769#
770# CONFIG_TR is not set
771
772#
773# Wireless LAN (non-hamradio)
774#
775# CONFIG_NET_RADIO is not set
776
777#
778# PCMCIA network device support
779#
780# CONFIG_NET_PCMCIA is not set
781
782#
783# Wan interfaces
784#
785# CONFIG_WAN is not set
786# CONFIG_FDDI is not set
787# CONFIG_HIPPI is not set
788# CONFIG_PPP is not set
789# CONFIG_SLIP is not set
790# CONFIG_NET_FC is not set
791# CONFIG_SHAPER is not set
792# CONFIG_NETCONSOLE is not set
793# CONFIG_NETPOLL is not set
794# CONFIG_NET_POLL_CONTROLLER is not set
795
796#
797# ISDN subsystem
798#
799# CONFIG_ISDN is not set
800
801#
802# Telephony Support
803#
804# CONFIG_PHONE is not set
805
806#
807# Input device support
808#
809CONFIG_INPUT=y
810# CONFIG_INPUT_FF_MEMLESS is not set
811
812#
813# Userland interfaces
814#
815CONFIG_INPUT_MOUSEDEV=y
816CONFIG_INPUT_MOUSEDEV_PSAUX=y
817CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
818CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
819CONFIG_INPUT_JOYDEV=y
820# CONFIG_INPUT_TSDEV is not set
821CONFIG_INPUT_EVDEV=y
822# CONFIG_INPUT_EVBUG is not set
823
824#
825# Input Device Drivers
826#
827CONFIG_INPUT_KEYBOARD=y
828# CONFIG_KEYBOARD_ATKBD is not set
829# CONFIG_KEYBOARD_SUNKBD is not set
830# CONFIG_KEYBOARD_LKKBD is not set
831# CONFIG_KEYBOARD_XTKBD is not set
832# CONFIG_KEYBOARD_NEWTON is not set
833# CONFIG_KEYBOARD_STOWAWAY is not set
834CONFIG_INPUT_MOUSE=y
835# CONFIG_MOUSE_PS2 is not set
836# CONFIG_MOUSE_SERIAL is not set
837# CONFIG_MOUSE_VSXXXAA is not set
838# CONFIG_INPUT_JOYSTICK is not set
839# CONFIG_INPUT_TOUCHSCREEN is not set
840# CONFIG_INPUT_MISC is not set
841
842#
843# Hardware I/O ports
844#
845# CONFIG_SERIO is not set
846# CONFIG_GAMEPORT is not set
847
848#
849# Character devices
850#
851CONFIG_VT=y
852CONFIG_VT_CONSOLE=y
853CONFIG_HW_CONSOLE=y
854# CONFIG_VT_HW_CONSOLE_BINDING is not set
855# CONFIG_SERIAL_NONSTANDARD is not set
856
857#
858# Serial drivers
859#
860CONFIG_SERIAL_8250=y
861CONFIG_SERIAL_8250_CONSOLE=y
862CONFIG_SERIAL_8250_PCI=y
863# CONFIG_SERIAL_8250_CS is not set
864CONFIG_SERIAL_8250_NR_UARTS=4
865CONFIG_SERIAL_8250_RUNTIME_UARTS=4
866# CONFIG_SERIAL_8250_EXTENDED is not set
867
868#
869# Non-8250 serial port support
870#
871CONFIG_SERIAL_CORE=y
872CONFIG_SERIAL_CORE_CONSOLE=y
873# CONFIG_SERIAL_ICOM is not set
874# CONFIG_SERIAL_JSM is not set
875CONFIG_UNIX98_PTYS=y
876CONFIG_LEGACY_PTYS=y
877CONFIG_LEGACY_PTY_COUNT=4
878CONFIG_HVC_DRIVER=y
879CONFIG_HVC_CONSOLE=y
880CONFIG_HVC_RTAS=y
881# CONFIG_HVCS is not set
882
883#
884# IPMI
885#
886# CONFIG_IPMI_HANDLER is not set
887
888#
889# Watchdog Cards
890#
891# CONFIG_WATCHDOG is not set
892CONFIG_HW_RANDOM=y
893CONFIG_GEN_RTC=y
894CONFIG_GEN_RTC_X=y
895# CONFIG_DTLK is not set
896# CONFIG_R3964 is not set
897# CONFIG_APPLICOM is not set
898# CONFIG_AGP is not set
899# CONFIG_DRM is not set
900
901#
902# PCMCIA character devices
903#
904# CONFIG_SYNCLINK_CS is not set
905# CONFIG_CARDMAN_4000 is not set
906# CONFIG_CARDMAN_4040 is not set
907CONFIG_RAW_DRIVER=y
908CONFIG_MAX_RAW_DEVS=256
909# CONFIG_HANGCHECK_TIMER is not set
910
911#
912# TPM devices
913#
914# CONFIG_TCG_TPM is not set
915
916#
917# I2C support
918#
919CONFIG_I2C=y
920CONFIG_I2C_CHARDEV=y
921
922#
923# I2C Algorithms
924#
925CONFIG_I2C_ALGOBIT=y
926CONFIG_I2C_ALGOPCF=y
927CONFIG_I2C_ALGOPCA=y
928
929#
930# I2C Hardware Bus support
931#
932# CONFIG_I2C_ALI1535 is not set
933# CONFIG_I2C_ALI1563 is not set
934# CONFIG_I2C_ALI15X3 is not set
935# CONFIG_I2C_AMD756 is not set
936# CONFIG_I2C_AMD8111 is not set
937# CONFIG_I2C_I801 is not set
938# CONFIG_I2C_I810 is not set
939# CONFIG_I2C_PIIX4 is not set
940# CONFIG_I2C_NFORCE2 is not set
941# CONFIG_I2C_OCORES is not set
942# CONFIG_I2C_PARPORT_LIGHT is not set
943# CONFIG_I2C_PROSAVAGE is not set
944# CONFIG_I2C_SAVAGE4 is not set
945# CONFIG_I2C_SIS5595 is not set
946# CONFIG_I2C_SIS630 is not set
947# CONFIG_I2C_SIS96X is not set
948# CONFIG_I2C_STUB is not set
949# CONFIG_I2C_VIA is not set
950# CONFIG_I2C_VIAPRO is not set
951# CONFIG_I2C_VOODOO3 is not set
952# CONFIG_I2C_PCA_ISA is not set
953
954#
955# Miscellaneous I2C Chip support
956#
957# CONFIG_SENSORS_DS1337 is not set
958# CONFIG_SENSORS_DS1374 is not set
959CONFIG_SENSORS_EEPROM=y
960# CONFIG_SENSORS_PCF8574 is not set
961# CONFIG_SENSORS_PCA9539 is not set
962# CONFIG_SENSORS_PCF8591 is not set
963# CONFIG_SENSORS_MAX6875 is not set
964# CONFIG_I2C_DEBUG_CORE is not set
965# CONFIG_I2C_DEBUG_ALGO is not set
966CONFIG_I2C_DEBUG_BUS=y
967# CONFIG_I2C_DEBUG_CHIP is not set
968
969#
970# SPI support
971#
972# CONFIG_SPI is not set
973# CONFIG_SPI_MASTER is not set
974
975#
976# Dallas's 1-wire bus
977#
978# CONFIG_W1 is not set
979
980#
981# Hardware Monitoring support
982#
983CONFIG_HWMON=y
984CONFIG_HWMON_VID=y
985# CONFIG_SENSORS_ABITUGURU is not set
986# CONFIG_SENSORS_ADM1021 is not set
987# CONFIG_SENSORS_ADM1025 is not set
988# CONFIG_SENSORS_ADM1026 is not set
989# CONFIG_SENSORS_ADM1031 is not set
990# CONFIG_SENSORS_ADM9240 is not set
991# CONFIG_SENSORS_ASB100 is not set
992# CONFIG_SENSORS_ATXP1 is not set
993# CONFIG_SENSORS_DS1621 is not set
994# CONFIG_SENSORS_F71805F is not set
995# CONFIG_SENSORS_FSCHER is not set
996# CONFIG_SENSORS_FSCPOS is not set
997# CONFIG_SENSORS_GL518SM is not set
998# CONFIG_SENSORS_GL520SM is not set
999# CONFIG_SENSORS_IT87 is not set
1000# CONFIG_SENSORS_LM63 is not set
1001# CONFIG_SENSORS_LM75 is not set
1002# CONFIG_SENSORS_LM77 is not set
1003# CONFIG_SENSORS_LM78 is not set
1004# CONFIG_SENSORS_LM80 is not set
1005# CONFIG_SENSORS_LM83 is not set
1006CONFIG_SENSORS_LM85=y
1007# CONFIG_SENSORS_LM87 is not set
1008CONFIG_SENSORS_LM90=y
1009# CONFIG_SENSORS_LM92 is not set
1010# CONFIG_SENSORS_MAX1619 is not set
1011# CONFIG_SENSORS_PC87360 is not set
1012# CONFIG_SENSORS_PC87427 is not set
1013# CONFIG_SENSORS_SIS5595 is not set
1014# CONFIG_SENSORS_SMSC47M1 is not set
1015# CONFIG_SENSORS_SMSC47M192 is not set
1016# CONFIG_SENSORS_SMSC47B397 is not set
1017# CONFIG_SENSORS_VIA686A is not set
1018# CONFIG_SENSORS_VT1211 is not set
1019# CONFIG_SENSORS_VT8231 is not set
1020# CONFIG_SENSORS_W83781D is not set
1021# CONFIG_SENSORS_W83791D is not set
1022# CONFIG_SENSORS_W83792D is not set
1023# CONFIG_SENSORS_W83793 is not set
1024# CONFIG_SENSORS_W83L785TS is not set
1025# CONFIG_SENSORS_W83627HF is not set
1026# CONFIG_SENSORS_W83627EHF is not set
1027# CONFIG_HWMON_DEBUG_CHIP is not set
1028
1029#
1030# Multimedia devices
1031#
1032# CONFIG_VIDEO_DEV is not set
1033
1034#
1035# Digital Video Broadcasting Devices
1036#
1037# CONFIG_DVB is not set
1038# CONFIG_USB_DABUSB is not set
1039
1040#
1041# Graphics support
1042#
1043CONFIG_FIRMWARE_EDID=y
1044CONFIG_FB=y
1045CONFIG_FB_DDC=y
1046CONFIG_FB_CFB_FILLRECT=y
1047CONFIG_FB_CFB_COPYAREA=y
1048CONFIG_FB_CFB_IMAGEBLIT=y
1049CONFIG_FB_MACMODES=y
1050# CONFIG_FB_BACKLIGHT is not set
1051CONFIG_FB_MODE_HELPERS=y
1052CONFIG_FB_TILEBLITTING=y
1053# CONFIG_FB_CIRRUS is not set
1054# CONFIG_FB_PM2 is not set
1055# CONFIG_FB_CYBER2000 is not set
1056# CONFIG_FB_OF is not set
1057# CONFIG_FB_ASILIANT is not set
1058# CONFIG_FB_IMSTT is not set
1059CONFIG_FB_VGA16=y
1060# CONFIG_FB_S1D13XXX is not set
1061CONFIG_FB_NVIDIA=y
1062CONFIG_FB_NVIDIA_I2C=y
1063CONFIG_FB_RIVA=y
1064CONFIG_FB_RIVA_I2C=y
1065# CONFIG_FB_RIVA_DEBUG is not set
1066CONFIG_FB_MATROX=y
1067CONFIG_FB_MATROX_MILLENIUM=y
1068CONFIG_FB_MATROX_MYSTIQUE=y
1069CONFIG_FB_MATROX_G=y
1070CONFIG_FB_MATROX_I2C=y
1071CONFIG_FB_MATROX_MAVEN=y
1072CONFIG_FB_MATROX_MULTIHEAD=y
1073CONFIG_FB_RADEON=y
1074CONFIG_FB_RADEON_I2C=y
1075# CONFIG_FB_RADEON_DEBUG is not set
1076# CONFIG_FB_ATY128 is not set
1077# CONFIG_FB_ATY is not set
1078# CONFIG_FB_SAVAGE is not set
1079# CONFIG_FB_SIS is not set
1080# CONFIG_FB_NEOMAGIC is not set
1081# CONFIG_FB_KYRO is not set
1082# CONFIG_FB_3DFX is not set
1083# CONFIG_FB_VOODOO1 is not set
1084# CONFIG_FB_TRIDENT is not set
1085# CONFIG_FB_IBM_GXT4500 is not set
1086# CONFIG_FB_VIRTUAL is not set
1087
1088#
1089# Console display driver support
1090#
1091CONFIG_VGA_CONSOLE=y
1092CONFIG_VGACON_SOFT_SCROLLBACK=y
1093CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
1094CONFIG_DUMMY_CONSOLE=y
1095CONFIG_FRAMEBUFFER_CONSOLE=y
1096# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1097# CONFIG_FONTS is not set
1098CONFIG_FONT_8x8=y
1099CONFIG_FONT_8x16=y
1100
1101#
1102# Logo configuration
1103#
1104CONFIG_LOGO=y
1105CONFIG_LOGO_LINUX_MONO=y
1106CONFIG_LOGO_LINUX_VGA16=y
1107CONFIG_LOGO_LINUX_CLUT224=y
1108# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1109
1110#
1111# Sound
1112#
1113CONFIG_SOUND=y
1114
1115#
1116# Advanced Linux Sound Architecture
1117#
1118CONFIG_SND=y
1119CONFIG_SND_TIMER=y
1120CONFIG_SND_PCM=y
1121CONFIG_SND_HWDEP=y
1122CONFIG_SND_RAWMIDI=y
1123CONFIG_SND_SEQUENCER=y
1124# CONFIG_SND_SEQ_DUMMY is not set
1125CONFIG_SND_OSSEMUL=y
1126CONFIG_SND_MIXER_OSS=y
1127CONFIG_SND_PCM_OSS=y
1128CONFIG_SND_PCM_OSS_PLUGINS=y
1129CONFIG_SND_SEQUENCER_OSS=y
1130# CONFIG_SND_DYNAMIC_MINORS is not set
1131CONFIG_SND_SUPPORT_OLD_API=y
1132CONFIG_SND_VERBOSE_PROCFS=y
1133# CONFIG_SND_VERBOSE_PRINTK is not set
1134# CONFIG_SND_DEBUG is not set
1135
1136#
1137# Generic devices
1138#
1139# CONFIG_SND_DUMMY is not set
1140# CONFIG_SND_VIRMIDI is not set
1141# CONFIG_SND_MTPAV is not set
1142# CONFIG_SND_SERIAL_U16550 is not set
1143# CONFIG_SND_MPU401 is not set
1144
1145#
1146# PCI devices
1147#
1148# CONFIG_SND_AD1889 is not set
1149# CONFIG_SND_ALS300 is not set
1150# CONFIG_SND_ALS4000 is not set
1151# CONFIG_SND_ALI5451 is not set
1152# CONFIG_SND_ATIIXP is not set
1153# CONFIG_SND_ATIIXP_MODEM is not set
1154# CONFIG_SND_AU8810 is not set
1155# CONFIG_SND_AU8820 is not set
1156# CONFIG_SND_AU8830 is not set
1157# CONFIG_SND_AZT3328 is not set
1158# CONFIG_SND_BT87X is not set
1159# CONFIG_SND_CA0106 is not set
1160# CONFIG_SND_CMIPCI is not set
1161# CONFIG_SND_CS4281 is not set
1162# CONFIG_SND_CS46XX is not set
1163# CONFIG_SND_DARLA20 is not set
1164# CONFIG_SND_GINA20 is not set
1165# CONFIG_SND_LAYLA20 is not set
1166# CONFIG_SND_DARLA24 is not set
1167# CONFIG_SND_GINA24 is not set
1168# CONFIG_SND_LAYLA24 is not set
1169# CONFIG_SND_MONA is not set
1170# CONFIG_SND_MIA is not set
1171# CONFIG_SND_ECHO3G is not set
1172# CONFIG_SND_INDIGO is not set
1173# CONFIG_SND_INDIGOIO is not set
1174# CONFIG_SND_INDIGODJ is not set
1175# CONFIG_SND_EMU10K1 is not set
1176# CONFIG_SND_EMU10K1X is not set
1177# CONFIG_SND_ENS1370 is not set
1178# CONFIG_SND_ENS1371 is not set
1179# CONFIG_SND_ES1938 is not set
1180# CONFIG_SND_ES1968 is not set
1181# CONFIG_SND_FM801 is not set
1182# CONFIG_SND_HDA_INTEL is not set
1183# CONFIG_SND_HDSP is not set
1184# CONFIG_SND_HDSPM is not set
1185# CONFIG_SND_ICE1712 is not set
1186# CONFIG_SND_ICE1724 is not set
1187# CONFIG_SND_INTEL8X0 is not set
1188# CONFIG_SND_INTEL8X0M is not set
1189# CONFIG_SND_KORG1212 is not set
1190# CONFIG_SND_MAESTRO3 is not set
1191# CONFIG_SND_MIXART is not set
1192# CONFIG_SND_NM256 is not set
1193# CONFIG_SND_PCXHR is not set
1194# CONFIG_SND_RIPTIDE is not set
1195# CONFIG_SND_RME32 is not set
1196# CONFIG_SND_RME96 is not set
1197# CONFIG_SND_RME9652 is not set
1198# CONFIG_SND_SONICVIBES is not set
1199# CONFIG_SND_TRIDENT is not set
1200# CONFIG_SND_VIA82XX is not set
1201# CONFIG_SND_VIA82XX_MODEM is not set
1202# CONFIG_SND_VX222 is not set
1203# CONFIG_SND_YMFPCI is not set
1204
1205#
1206# ALSA PowerMac devices
1207#
1208
1209#
1210# USB devices
1211#
1212CONFIG_SND_USB_AUDIO=y
1213CONFIG_SND_USB_USX2Y=y
1214
1215#
1216# PCMCIA devices
1217#
1218# CONFIG_SND_VXPOCKET is not set
1219# CONFIG_SND_PDAUDIOCF is not set
1220
1221#
1222# Open Sound System
1223#
1224# CONFIG_SOUND_PRIME is not set
1225
1226#
1227# HID Devices
1228#
1229CONFIG_HID=y
1230
1231#
1232# USB support
1233#
1234CONFIG_USB_ARCH_HAS_HCD=y
1235CONFIG_USB_ARCH_HAS_OHCI=y
1236CONFIG_USB_ARCH_HAS_EHCI=y
1237CONFIG_USB=y
1238# CONFIG_USB_DEBUG is not set
1239
1240#
1241# Miscellaneous USB options
1242#
1243CONFIG_USB_DEVICEFS=y
1244# CONFIG_USB_BANDWIDTH is not set
1245# CONFIG_USB_DYNAMIC_MINORS is not set
1246# CONFIG_USB_OTG is not set
1247
1248#
1249# USB Host Controller Drivers
1250#
1251CONFIG_USB_EHCI_HCD=y
1252# CONFIG_USB_EHCI_SPLIT_ISO is not set
1253# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1254# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1255# CONFIG_USB_ISP116X_HCD is not set
1256CONFIG_USB_OHCI_HCD=y
1257# CONFIG_USB_OHCI_BIG_ENDIAN is not set
1258CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1259CONFIG_USB_UHCI_HCD=y
1260CONFIG_USB_SL811_HCD=y
1261# CONFIG_USB_SL811_CS is not set
1262
1263#
1264# USB Device Class drivers
1265#
1266# CONFIG_USB_ACM is not set
1267# CONFIG_USB_PRINTER is not set
1268
1269#
1270# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1271#
1272
1273#
1274# may also be needed; see USB_STORAGE Help for more information
1275#
1276CONFIG_USB_STORAGE=y
1277# CONFIG_USB_STORAGE_DEBUG is not set
1278# CONFIG_USB_STORAGE_DATAFAB is not set
1279# CONFIG_USB_STORAGE_FREECOM is not set
1280# CONFIG_USB_STORAGE_ISD200 is not set
1281# CONFIG_USB_STORAGE_DPCM is not set
1282# CONFIG_USB_STORAGE_USBAT is not set
1283# CONFIG_USB_STORAGE_SDDR09 is not set
1284# CONFIG_USB_STORAGE_SDDR55 is not set
1285# CONFIG_USB_STORAGE_JUMPSHOT is not set
1286# CONFIG_USB_STORAGE_ALAUDA is not set
1287# CONFIG_USB_STORAGE_ONETOUCH is not set
1288# CONFIG_USB_STORAGE_KARMA is not set
1289CONFIG_USB_LIBUSUAL=y
1290
1291#
1292# USB Input Devices
1293#
1294CONFIG_USB_HID=y
1295# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1296# CONFIG_HID_FF is not set
1297# CONFIG_USB_HIDDEV is not set
1298# CONFIG_USB_AIPTEK is not set
1299# CONFIG_USB_WACOM is not set
1300# CONFIG_USB_ACECAD is not set
1301# CONFIG_USB_KBTAB is not set
1302# CONFIG_USB_POWERMATE is not set
1303# CONFIG_USB_TOUCHSCREEN is not set
1304# CONFIG_USB_YEALINK is not set
1305# CONFIG_USB_XPAD is not set
1306# CONFIG_USB_ATI_REMOTE is not set
1307# CONFIG_USB_ATI_REMOTE2 is not set
1308# CONFIG_USB_KEYSPAN_REMOTE is not set
1309# CONFIG_USB_APPLETOUCH is not set
1310
1311#
1312# USB Imaging devices
1313#
1314# CONFIG_USB_MDC800 is not set
1315# CONFIG_USB_MICROTEK is not set
1316
1317#
1318# USB Network Adapters
1319#
1320# CONFIG_USB_CATC is not set
1321# CONFIG_USB_KAWETH is not set
1322# CONFIG_USB_PEGASUS is not set
1323# CONFIG_USB_RTL8150 is not set
1324# CONFIG_USB_USBNET_MII is not set
1325# CONFIG_USB_USBNET is not set
1326CONFIG_USB_MON=y
1327
1328#
1329# USB port drivers
1330#
1331
1332#
1333# USB Serial Converter support
1334#
1335# CONFIG_USB_SERIAL is not set
1336
1337#
1338# USB Miscellaneous drivers
1339#
1340# CONFIG_USB_EMI62 is not set
1341# CONFIG_USB_EMI26 is not set
1342# CONFIG_USB_ADUTUX is not set
1343# CONFIG_USB_AUERSWALD is not set
1344# CONFIG_USB_RIO500 is not set
1345# CONFIG_USB_LEGOTOWER is not set
1346# CONFIG_USB_LCD is not set
1347# CONFIG_USB_LED is not set
1348# CONFIG_USB_CYPRESS_CY7C63 is not set
1349# CONFIG_USB_CYTHERM is not set
1350# CONFIG_USB_PHIDGET is not set
1351# CONFIG_USB_IDMOUSE is not set
1352# CONFIG_USB_FTDI_ELAN is not set
1353# CONFIG_USB_APPLEDISPLAY is not set
1354# CONFIG_USB_SISUSBVGA is not set
1355# CONFIG_USB_LD is not set
1356# CONFIG_USB_TRANCEVIBRATOR is not set
1357# CONFIG_USB_TEST is not set
1358
1359#
1360# USB DSL modem support
1361#
1362
1363#
1364# USB Gadget Support
1365#
1366# CONFIG_USB_GADGET is not set
1367
1368#
1369# MMC/SD Card support
1370#
1371# CONFIG_MMC is not set
1372
1373#
1374# LED devices
1375#
1376# CONFIG_NEW_LEDS is not set
1377
1378#
1379# LED drivers
1380#
1381
1382#
1383# LED Triggers
1384#
1385
1386#
1387# InfiniBand support
1388#
1389# CONFIG_INFINIBAND is not set
1390
1391#
1392# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1393#
1394
1395#
1396# Real Time Clock
1397#
1398CONFIG_RTC_LIB=y
1399CONFIG_RTC_CLASS=y
1400CONFIG_RTC_HCTOSYS=y
1401CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1402# CONFIG_RTC_DEBUG is not set
1403
1404#
1405# RTC interfaces
1406#
1407CONFIG_RTC_INTF_SYSFS=y
1408CONFIG_RTC_INTF_PROC=y
1409CONFIG_RTC_INTF_DEV=y
1410# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1411
1412#
1413# RTC drivers
1414#
1415# CONFIG_RTC_DRV_X1205 is not set
1416CONFIG_RTC_DRV_DS1307=y
1417# CONFIG_RTC_DRV_DS1553 is not set
1418# CONFIG_RTC_DRV_ISL1208 is not set
1419# CONFIG_RTC_DRV_DS1672 is not set
1420# CONFIG_RTC_DRV_DS1742 is not set
1421# CONFIG_RTC_DRV_PCF8563 is not set
1422# CONFIG_RTC_DRV_PCF8583 is not set
1423# CONFIG_RTC_DRV_RS5C372 is not set
1424# CONFIG_RTC_DRV_M48T86 is not set
1425# CONFIG_RTC_DRV_TEST is not set
1426# CONFIG_RTC_DRV_V3020 is not set
1427
1428#
1429# DMA Engine support
1430#
1431# CONFIG_DMA_ENGINE is not set
1432
1433#
1434# DMA Clients
1435#
1436
1437#
1438# DMA Devices
1439#
1440
1441#
1442# Virtualization
1443#
1444
1445#
1446# File systems
1447#
1448CONFIG_EXT2_FS=y
1449CONFIG_EXT2_FS_XATTR=y
1450CONFIG_EXT2_FS_POSIX_ACL=y
1451# CONFIG_EXT2_FS_SECURITY is not set
1452# CONFIG_EXT2_FS_XIP is not set
1453CONFIG_EXT3_FS=y
1454CONFIG_EXT3_FS_XATTR=y
1455# CONFIG_EXT3_FS_POSIX_ACL is not set
1456# CONFIG_EXT3_FS_SECURITY is not set
1457# CONFIG_EXT4DEV_FS is not set
1458CONFIG_JBD=y
1459# CONFIG_JBD_DEBUG is not set
1460CONFIG_FS_MBCACHE=y
1461# CONFIG_REISERFS_FS is not set
1462# CONFIG_JFS_FS is not set
1463CONFIG_FS_POSIX_ACL=y
1464# CONFIG_XFS_FS is not set
1465# CONFIG_GFS2_FS is not set
1466# CONFIG_OCFS2_FS is not set
1467# CONFIG_MINIX_FS is not set
1468# CONFIG_ROMFS_FS is not set
1469# CONFIG_INOTIFY is not set
1470# CONFIG_QUOTA is not set
1471CONFIG_DNOTIFY=y
1472CONFIG_AUTOFS_FS=y
1473CONFIG_AUTOFS4_FS=y
1474# CONFIG_FUSE_FS is not set
1475
1476#
1477# CD-ROM/DVD Filesystems
1478#
1479CONFIG_ISO9660_FS=y
1480# CONFIG_JOLIET is not set
1481# CONFIG_ZISOFS is not set
1482CONFIG_UDF_FS=y
1483CONFIG_UDF_NLS=y
1484
1485#
1486# DOS/FAT/NT Filesystems
1487#
1488CONFIG_FAT_FS=y
1489CONFIG_MSDOS_FS=y
1490CONFIG_VFAT_FS=y
1491CONFIG_FAT_DEFAULT_CODEPAGE=437
1492CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1493# CONFIG_NTFS_FS is not set
1494
1495#
1496# Pseudo filesystems
1497#
1498CONFIG_PROC_FS=y
1499CONFIG_PROC_KCORE=y
1500CONFIG_PROC_SYSCTL=y
1501CONFIG_SYSFS=y
1502CONFIG_TMPFS=y
1503# CONFIG_TMPFS_POSIX_ACL is not set
1504CONFIG_HUGETLBFS=y
1505CONFIG_HUGETLB_PAGE=y
1506CONFIG_RAMFS=y
1507CONFIG_CONFIGFS_FS=y
1508
1509#
1510# Miscellaneous filesystems
1511#
1512# CONFIG_ADFS_FS is not set
1513# CONFIG_AFFS_FS is not set
1514# CONFIG_HFS_FS is not set
1515# CONFIG_HFSPLUS_FS is not set
1516# CONFIG_BEFS_FS is not set
1517# CONFIG_BFS_FS is not set
1518# CONFIG_EFS_FS is not set
1519# CONFIG_JFFS2_FS is not set
1520# CONFIG_CRAMFS is not set
1521# CONFIG_VXFS_FS is not set
1522# CONFIG_HPFS_FS is not set
1523# CONFIG_QNX4FS_FS is not set
1524# CONFIG_SYSV_FS is not set
1525# CONFIG_UFS_FS is not set
1526
1527#
1528# Network File Systems
1529#
1530CONFIG_NFS_FS=y
1531CONFIG_NFS_V3=y
1532# CONFIG_NFS_V3_ACL is not set
1533# CONFIG_NFS_V4 is not set
1534# CONFIG_NFS_DIRECTIO is not set
1535# CONFIG_NFSD is not set
1536CONFIG_ROOT_NFS=y
1537CONFIG_LOCKD=y
1538CONFIG_LOCKD_V4=y
1539CONFIG_NFS_COMMON=y
1540CONFIG_SUNRPC=y
1541# CONFIG_RPCSEC_GSS_KRB5 is not set
1542# CONFIG_RPCSEC_GSS_SPKM3 is not set
1543# CONFIG_SMB_FS is not set
1544# CONFIG_CIFS is not set
1545# CONFIG_NCP_FS is not set
1546# CONFIG_CODA_FS is not set
1547# CONFIG_AFS_FS is not set
1548# CONFIG_9P_FS is not set
1549
1550#
1551# Partition Types
1552#
1553CONFIG_PARTITION_ADVANCED=y
1554# CONFIG_ACORN_PARTITION is not set
1555# CONFIG_OSF_PARTITION is not set
1556# CONFIG_AMIGA_PARTITION is not set
1557# CONFIG_ATARI_PARTITION is not set
1558CONFIG_MAC_PARTITION=y
1559CONFIG_MSDOS_PARTITION=y
1560# CONFIG_BSD_DISKLABEL is not set
1561# CONFIG_MINIX_SUBPARTITION is not set
1562# CONFIG_SOLARIS_X86_PARTITION is not set
1563# CONFIG_UNIXWARE_DISKLABEL is not set
1564# CONFIG_LDM_PARTITION is not set
1565# CONFIG_SGI_PARTITION is not set
1566# CONFIG_ULTRIX_PARTITION is not set
1567# CONFIG_SUN_PARTITION is not set
1568# CONFIG_KARMA_PARTITION is not set
1569# CONFIG_EFI_PARTITION is not set
1570
1571#
1572# Native Language Support
1573#
1574CONFIG_NLS=y
1575CONFIG_NLS_DEFAULT="iso8859-1"
1576CONFIG_NLS_CODEPAGE_437=y
1577# CONFIG_NLS_CODEPAGE_737 is not set
1578# CONFIG_NLS_CODEPAGE_775 is not set
1579# CONFIG_NLS_CODEPAGE_850 is not set
1580# CONFIG_NLS_CODEPAGE_852 is not set
1581# CONFIG_NLS_CODEPAGE_855 is not set
1582# CONFIG_NLS_CODEPAGE_857 is not set
1583# CONFIG_NLS_CODEPAGE_860 is not set
1584# CONFIG_NLS_CODEPAGE_861 is not set
1585# CONFIG_NLS_CODEPAGE_862 is not set
1586# CONFIG_NLS_CODEPAGE_863 is not set
1587# CONFIG_NLS_CODEPAGE_864 is not set
1588# CONFIG_NLS_CODEPAGE_865 is not set
1589# CONFIG_NLS_CODEPAGE_866 is not set
1590# CONFIG_NLS_CODEPAGE_869 is not set
1591# CONFIG_NLS_CODEPAGE_936 is not set
1592# CONFIG_NLS_CODEPAGE_950 is not set
1593# CONFIG_NLS_CODEPAGE_932 is not set
1594# CONFIG_NLS_CODEPAGE_949 is not set
1595# CONFIG_NLS_CODEPAGE_874 is not set
1596# CONFIG_NLS_ISO8859_8 is not set
1597# CONFIG_NLS_CODEPAGE_1250 is not set
1598# CONFIG_NLS_CODEPAGE_1251 is not set
1599# CONFIG_NLS_ASCII is not set
1600CONFIG_NLS_ISO8859_1=y
1601# CONFIG_NLS_ISO8859_2 is not set
1602# CONFIG_NLS_ISO8859_3 is not set
1603# CONFIG_NLS_ISO8859_4 is not set
1604# CONFIG_NLS_ISO8859_5 is not set
1605# CONFIG_NLS_ISO8859_6 is not set
1606# CONFIG_NLS_ISO8859_7 is not set
1607# CONFIG_NLS_ISO8859_9 is not set
1608# CONFIG_NLS_ISO8859_13 is not set
1609# CONFIG_NLS_ISO8859_14 is not set
1610# CONFIG_NLS_ISO8859_15 is not set
1611# CONFIG_NLS_KOI8_R is not set
1612# CONFIG_NLS_KOI8_U is not set
1613# CONFIG_NLS_UTF8 is not set
1614
1615#
1616# Distributed Lock Manager
1617#
1618# CONFIG_DLM is not set
1619
1620#
1621# Library routines
1622#
1623CONFIG_BITREVERSE=y
1624CONFIG_CRC_CCITT=y
1625# CONFIG_CRC16 is not set
1626CONFIG_CRC32=y
1627# CONFIG_LIBCRC32C is not set
1628CONFIG_PLIST=y
1629CONFIG_IOMAP_COPY=y
1630
1631#
1632# Instrumentation Support
1633#
1634CONFIG_PROFILING=y
1635CONFIG_OPROFILE=y
1636# CONFIG_KPROBES is not set
1637
1638#
1639# Kernel hacking
1640#
1641# CONFIG_PRINTK_TIME is not set
1642CONFIG_ENABLE_MUST_CHECK=y
1643CONFIG_MAGIC_SYSRQ=y
1644# CONFIG_UNUSED_SYMBOLS is not set
1645# CONFIG_DEBUG_FS is not set
1646# CONFIG_HEADERS_CHECK is not set
1647CONFIG_DEBUG_KERNEL=y
1648CONFIG_LOG_BUF_SHIFT=17
1649CONFIG_DETECT_SOFTLOCKUP=y
1650# CONFIG_SCHEDSTATS is not set
1651# CONFIG_DEBUG_SLAB is not set
1652# CONFIG_DEBUG_RT_MUTEXES is not set
1653# CONFIG_RT_MUTEX_TESTER is not set
1654# CONFIG_DEBUG_SPINLOCK is not set
1655# CONFIG_DEBUG_MUTEXES is not set
1656# CONFIG_DEBUG_RWSEMS is not set
1657# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1658# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1659# CONFIG_DEBUG_KOBJECT is not set
1660CONFIG_DEBUG_BUGVERBOSE=y
1661CONFIG_DEBUG_INFO=y
1662# CONFIG_DEBUG_VM is not set
1663# CONFIG_DEBUG_LIST is not set
1664CONFIG_FORCED_INLINING=y
1665# CONFIG_RCU_TORTURE_TEST is not set
1666# CONFIG_DEBUG_STACKOVERFLOW is not set
1667# CONFIG_DEBUG_STACK_USAGE is not set
1668CONFIG_DEBUGGER=y
1669CONFIG_XMON=y
1670CONFIG_XMON_DEFAULT=y
1671CONFIG_XMON_DISASSEMBLY=y
1672# CONFIG_IRQSTACKS is not set
1673CONFIG_BOOTX_TEXT=y
1674# CONFIG_PPC_EARLY_DEBUG is not set
1675
1676#
1677# Security options
1678#
1679# CONFIG_KEYS is not set
1680# CONFIG_SECURITY is not set
1681
1682#
1683# Cryptographic options
1684#
1685CONFIG_CRYPTO=y
1686CONFIG_CRYPTO_ALGAPI=y
1687CONFIG_CRYPTO_BLKCIPHER=y
1688CONFIG_CRYPTO_HASH=y
1689CONFIG_CRYPTO_MANAGER=y
1690CONFIG_CRYPTO_HMAC=y
1691# CONFIG_CRYPTO_XCBC is not set
1692# CONFIG_CRYPTO_NULL is not set
1693# CONFIG_CRYPTO_MD4 is not set
1694CONFIG_CRYPTO_MD5=y
1695CONFIG_CRYPTO_SHA1=y
1696# CONFIG_CRYPTO_SHA256 is not set
1697# CONFIG_CRYPTO_SHA512 is not set
1698# CONFIG_CRYPTO_WP512 is not set
1699# CONFIG_CRYPTO_TGR192 is not set
1700# CONFIG_CRYPTO_GF128MUL is not set
1701CONFIG_CRYPTO_ECB=m
1702CONFIG_CRYPTO_CBC=y
1703# CONFIG_CRYPTO_LRW is not set
1704CONFIG_CRYPTO_DES=y
1705# CONFIG_CRYPTO_BLOWFISH is not set
1706# CONFIG_CRYPTO_TWOFISH is not set
1707# CONFIG_CRYPTO_SERPENT is not set
1708# CONFIG_CRYPTO_AES is not set
1709# CONFIG_CRYPTO_CAST5 is not set
1710# CONFIG_CRYPTO_CAST6 is not set
1711# CONFIG_CRYPTO_TEA is not set
1712# CONFIG_CRYPTO_ARC4 is not set
1713# CONFIG_CRYPTO_KHAZAD is not set
1714# CONFIG_CRYPTO_ANUBIS is not set
1715# CONFIG_CRYPTO_DEFLATE is not set
1716# CONFIG_CRYPTO_MICHAEL_MIC is not set
1717# CONFIG_CRYPTO_CRC32C is not set
1718# CONFIG_CRYPTO_TEST is not set
1719
1720#
1721# Hardware crypto devices
1722#
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index 32560876c3dc..ec644b34a082 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc5 3# Linux kernel version: 2.6.20-rc6
4# Mon Jan 22 22:29:11 2007 4# Thu Jan 25 13:35:34 2007
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -70,10 +70,10 @@ CONFIG_SYSVIPC=y
70CONFIG_SYSFS_DEPRECATED=y 70CONFIG_SYSFS_DEPRECATED=y
71# CONFIG_RELAY is not set 71# CONFIG_RELAY is not set
72CONFIG_INITRAMFS_SOURCE="" 72CONFIG_INITRAMFS_SOURCE=""
73# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 73CONFIG_CC_OPTIMIZE_FOR_SIZE=y
74CONFIG_SYSCTL=y 74CONFIG_SYSCTL=y
75CONFIG_EMBEDDED=y 75# CONFIG_EMBEDDED is not set
76# CONFIG_SYSCTL_SYSCALL is not set 76CONFIG_SYSCTL_SYSCALL=y
77CONFIG_KALLSYMS=y 77CONFIG_KALLSYMS=y
78CONFIG_KALLSYMS_ALL=y 78CONFIG_KALLSYMS_ALL=y
79CONFIG_KALLSYMS_EXTRA_PASS=y 79CONFIG_KALLSYMS_EXTRA_PASS=y
@@ -160,7 +160,7 @@ CONFIG_SPU_BASE=y
160# PS3 Platform Options 160# PS3 Platform Options
161# 161#
162CONFIG_PS3_HTAB_SIZE=20 162CONFIG_PS3_HTAB_SIZE=20
163CONFIG_PS3_DYNAMIC_DMA=y 163# CONFIG_PS3_DYNAMIC_DMA is not set
164CONFIG_PS3_USE_LPAR_ADDR=y 164CONFIG_PS3_USE_LPAR_ADDR=y
165CONFIG_PS3_VUART=y 165CONFIG_PS3_VUART=y
166 166
@@ -207,7 +207,7 @@ CONFIG_PPC_64K_PAGES=y
207# CONFIG_SCHED_SMT is not set 207# CONFIG_SCHED_SMT is not set
208CONFIG_PROC_DEVICETREE=y 208CONFIG_PROC_DEVICETREE=y
209CONFIG_CMDLINE_BOOL=y 209CONFIG_CMDLINE_BOOL=y
210CONFIG_CMDLINE="root=/dev/nfs rw ip=dhcp" 210CONFIG_CMDLINE="root=/dev/sda1 ip=dhcp"
211# CONFIG_PM is not set 211# CONFIG_PM is not set
212# CONFIG_SECCOMP is not set 212# CONFIG_SECCOMP is not set
213CONFIG_ISA_DMA_API=y 213CONFIG_ISA_DMA_API=y
@@ -240,7 +240,8 @@ CONFIG_NET=y
240# Networking options 240# Networking options
241# 241#
242# CONFIG_NETDEBUG is not set 242# CONFIG_NETDEBUG is not set
243# CONFIG_PACKET is not set 243CONFIG_PACKET=y
244CONFIG_PACKET_MMAP=y
244CONFIG_UNIX=y 245CONFIG_UNIX=y
245# CONFIG_NET_KEY is not set 246# CONFIG_NET_KEY is not set
246CONFIG_INET=y 247CONFIG_INET=y
@@ -353,6 +354,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
353# CONFIG_BLK_DEV_COW_COMMON is not set 354# CONFIG_BLK_DEV_COW_COMMON is not set
354# CONFIG_BLK_DEV_LOOP is not set 355# CONFIG_BLK_DEV_LOOP is not set
355# CONFIG_BLK_DEV_NBD is not set 356# CONFIG_BLK_DEV_NBD is not set
357# CONFIG_BLK_DEV_UB is not set
356# CONFIG_BLK_DEV_RAM is not set 358# CONFIG_BLK_DEV_RAM is not set
357# CONFIG_BLK_DEV_INITRD is not set 359# CONFIG_BLK_DEV_INITRD is not set
358# CONFIG_CDROM_PKTCDVD is not set 360# CONFIG_CDROM_PKTCDVD is not set
@@ -380,10 +382,11 @@ CONFIG_SCSI_PROC_FS=y
380# 382#
381# SCSI support type (disk, tape, CD-ROM) 383# SCSI support type (disk, tape, CD-ROM)
382# 384#
383# CONFIG_BLK_DEV_SD is not set 385CONFIG_BLK_DEV_SD=y
384# CONFIG_CHR_DEV_ST is not set 386# CONFIG_CHR_DEV_ST is not set
385# CONFIG_CHR_DEV_OSST is not set 387# CONFIG_CHR_DEV_OSST is not set
386# CONFIG_BLK_DEV_SR is not set 388CONFIG_BLK_DEV_SR=y
389# CONFIG_BLK_DEV_SR_VENDOR is not set
387# CONFIG_CHR_DEV_SG is not set 390# CONFIG_CHR_DEV_SG is not set
388# CONFIG_CHR_DEV_SCH is not set 391# CONFIG_CHR_DEV_SCH is not set
389 392
@@ -456,6 +459,7 @@ CONFIG_NETDEVICES=y
456# Ethernet (10 or 100Mbit) 459# Ethernet (10 or 100Mbit)
457# 460#
458# CONFIG_NET_ETHERNET is not set 461# CONFIG_NET_ETHERNET is not set
462CONFIG_MII=y
459 463
460# 464#
461# Ethernet (1000 Mbit) 465# Ethernet (1000 Mbit)
@@ -504,10 +508,13 @@ CONFIG_INPUT=y
504# 508#
505# Userland interfaces 509# Userland interfaces
506# 510#
507# CONFIG_INPUT_MOUSEDEV is not set 511CONFIG_INPUT_MOUSEDEV=y
512# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
513CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
514CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
508# CONFIG_INPUT_JOYDEV is not set 515# CONFIG_INPUT_JOYDEV is not set
509# CONFIG_INPUT_TSDEV is not set 516# CONFIG_INPUT_TSDEV is not set
510CONFIG_INPUT_EVDEV=y 517# CONFIG_INPUT_EVDEV is not set
511# CONFIG_INPUT_EVBUG is not set 518# CONFIG_INPUT_EVBUG is not set
512 519
513# 520#
@@ -598,6 +605,7 @@ CONFIG_GEN_RTC=y
598# Digital Video Broadcasting Devices 605# Digital Video Broadcasting Devices
599# 606#
600# CONFIG_DVB is not set 607# CONFIG_DVB is not set
608# CONFIG_USB_DABUSB is not set
601 609
602# 610#
603# Graphics support 611# Graphics support
@@ -626,15 +634,142 @@ CONFIG_HID=y
626# 634#
627# USB support 635# USB support
628# 636#
629# CONFIG_USB_ARCH_HAS_HCD is not set 637CONFIG_USB_ARCH_HAS_HCD=y
630# CONFIG_USB_ARCH_HAS_OHCI is not set 638CONFIG_USB_ARCH_HAS_OHCI=y
631# CONFIG_USB_ARCH_HAS_EHCI is not set 639CONFIG_USB_ARCH_HAS_EHCI=y
640CONFIG_USB=y
641CONFIG_USB_DEBUG=y
642
643#
644# Miscellaneous USB options
645#
646# CONFIG_USB_DEVICEFS is not set
647# CONFIG_USB_BANDWIDTH is not set
648# CONFIG_USB_DYNAMIC_MINORS is not set
649# CONFIG_USB_OTG is not set
650
651#
652# USB Host Controller Drivers
653#
654CONFIG_USB_EHCI_HCD=y
655# CONFIG_USB_EHCI_SPLIT_ISO is not set
656# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
657# CONFIG_USB_EHCI_TT_NEWSCHED is not set
658CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y
659# CONFIG_USB_ISP116X_HCD is not set
660CONFIG_USB_OHCI_HCD=y
661# CONFIG_USB_OHCI_HCD_PPC_OF is not set
662# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
663CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
664CONFIG_USB_OHCI_LITTLE_ENDIAN=y
665# CONFIG_USB_SL811_HCD is not set
666
667#
668# USB Device Class drivers
669#
670# CONFIG_USB_ACM is not set
671# CONFIG_USB_PRINTER is not set
632 672
633# 673#
634# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 674# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
635# 675#
636 676
637# 677#
678# may also be needed; see USB_STORAGE Help for more information
679#
680CONFIG_USB_STORAGE=y
681# CONFIG_USB_STORAGE_DEBUG is not set
682# CONFIG_USB_STORAGE_DATAFAB is not set
683# CONFIG_USB_STORAGE_FREECOM is not set
684# CONFIG_USB_STORAGE_DPCM is not set
685# CONFIG_USB_STORAGE_USBAT is not set
686# CONFIG_USB_STORAGE_SDDR09 is not set
687# CONFIG_USB_STORAGE_SDDR55 is not set
688# CONFIG_USB_STORAGE_JUMPSHOT is not set
689# CONFIG_USB_STORAGE_ALAUDA is not set
690# CONFIG_USB_STORAGE_KARMA is not set
691# CONFIG_USB_LIBUSUAL is not set
692
693#
694# USB Input Devices
695#
696CONFIG_USB_HID=y
697# CONFIG_USB_HIDINPUT_POWERBOOK is not set
698# CONFIG_HID_FF is not set
699# CONFIG_USB_HIDDEV is not set
700# CONFIG_USB_AIPTEK is not set
701# CONFIG_USB_WACOM is not set
702# CONFIG_USB_ACECAD is not set
703# CONFIG_USB_KBTAB is not set
704# CONFIG_USB_POWERMATE is not set
705# CONFIG_USB_TOUCHSCREEN is not set
706# CONFIG_USB_YEALINK is not set
707# CONFIG_USB_XPAD is not set
708# CONFIG_USB_ATI_REMOTE is not set
709# CONFIG_USB_ATI_REMOTE2 is not set
710# CONFIG_USB_KEYSPAN_REMOTE is not set
711# CONFIG_USB_APPLETOUCH is not set
712
713#
714# USB Imaging devices
715#
716# CONFIG_USB_MDC800 is not set
717# CONFIG_USB_MICROTEK is not set
718
719#
720# USB Network Adapters
721#
722# CONFIG_USB_CATC is not set
723# CONFIG_USB_KAWETH is not set
724# CONFIG_USB_PEGASUS is not set
725# CONFIG_USB_RTL8150 is not set
726CONFIG_USB_USBNET_MII=y
727CONFIG_USB_USBNET=y
728CONFIG_USB_NET_CDCETHER=y
729# CONFIG_USB_NET_GL620A is not set
730# CONFIG_USB_NET_NET1080 is not set
731# CONFIG_USB_NET_PLUSB is not set
732CONFIG_USB_NET_MCS7830=y
733# CONFIG_USB_NET_RNDIS_HOST is not set
734# CONFIG_USB_NET_CDC_SUBSET is not set
735# CONFIG_USB_NET_ZAURUS is not set
736CONFIG_USB_MON=y
737
738#
739# USB port drivers
740#
741
742#
743# USB Serial Converter support
744#
745# CONFIG_USB_SERIAL is not set
746
747#
748# USB Miscellaneous drivers
749#
750# CONFIG_USB_EMI62 is not set
751# CONFIG_USB_EMI26 is not set
752# CONFIG_USB_ADUTUX is not set
753# CONFIG_USB_AUERSWALD is not set
754# CONFIG_USB_RIO500 is not set
755# CONFIG_USB_LEGOTOWER is not set
756# CONFIG_USB_LCD is not set
757# CONFIG_USB_LED is not set
758# CONFIG_USB_CYPRESS_CY7C63 is not set
759# CONFIG_USB_CYTHERM is not set
760# CONFIG_USB_PHIDGET is not set
761# CONFIG_USB_IDMOUSE is not set
762# CONFIG_USB_FTDI_ELAN is not set
763# CONFIG_USB_APPLEDISPLAY is not set
764# CONFIG_USB_SISUSBVGA is not set
765# CONFIG_USB_LD is not set
766# CONFIG_USB_TRANCEVIBRATOR is not set
767
768#
769# USB DSL modem support
770#
771
772#
638# USB Gadget Support 773# USB Gadget Support
639# 774#
640# CONFIG_USB_GADGET is not set 775# CONFIG_USB_GADGET is not set
@@ -691,8 +826,14 @@ CONFIG_HID=y
691# File systems 826# File systems
692# 827#
693# CONFIG_EXT2_FS is not set 828# CONFIG_EXT2_FS is not set
694# CONFIG_EXT3_FS is not set 829CONFIG_EXT3_FS=y
830CONFIG_EXT3_FS_XATTR=y
831# CONFIG_EXT3_FS_POSIX_ACL is not set
832# CONFIG_EXT3_FS_SECURITY is not set
695# CONFIG_EXT4DEV_FS is not set 833# CONFIG_EXT4DEV_FS is not set
834CONFIG_JBD=y
835# CONFIG_JBD_DEBUG is not set
836CONFIG_FS_MBCACHE=y
696# CONFIG_REISERFS_FS is not set 837# CONFIG_REISERFS_FS is not set
697# CONFIG_JFS_FS is not set 838# CONFIG_JFS_FS is not set
698# CONFIG_FS_POSIX_ACL is not set 839# CONFIG_FS_POSIX_ACL is not set
@@ -712,14 +853,20 @@ CONFIG_DNOTIFY=y
712# 853#
713# CD-ROM/DVD Filesystems 854# CD-ROM/DVD Filesystems
714# 855#
715# CONFIG_ISO9660_FS is not set 856CONFIG_ISO9660_FS=y
716# CONFIG_UDF_FS is not set 857CONFIG_JOLIET=y
858# CONFIG_ZISOFS is not set
859CONFIG_UDF_FS=y
860CONFIG_UDF_NLS=y
717 861
718# 862#
719# DOS/FAT/NT Filesystems 863# DOS/FAT/NT Filesystems
720# 864#
865CONFIG_FAT_FS=y
721# CONFIG_MSDOS_FS is not set 866# CONFIG_MSDOS_FS is not set
722# CONFIG_VFAT_FS is not set 867CONFIG_VFAT_FS=y
868CONFIG_FAT_DEFAULT_CODEPAGE=437
869CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
723# CONFIG_NTFS_FS is not set 870# CONFIG_NTFS_FS is not set
724 871
725# 872#
@@ -785,7 +932,46 @@ CONFIG_MSDOS_PARTITION=y
785# 932#
786# Native Language Support 933# Native Language Support
787# 934#
788# CONFIG_NLS is not set 935CONFIG_NLS=y
936CONFIG_NLS_DEFAULT="iso8859-1"
937CONFIG_NLS_CODEPAGE_437=y
938# CONFIG_NLS_CODEPAGE_737 is not set
939# CONFIG_NLS_CODEPAGE_775 is not set
940# CONFIG_NLS_CODEPAGE_850 is not set
941# CONFIG_NLS_CODEPAGE_852 is not set
942# CONFIG_NLS_CODEPAGE_855 is not set
943# CONFIG_NLS_CODEPAGE_857 is not set
944# CONFIG_NLS_CODEPAGE_860 is not set
945# CONFIG_NLS_CODEPAGE_861 is not set
946# CONFIG_NLS_CODEPAGE_862 is not set
947# CONFIG_NLS_CODEPAGE_863 is not set
948# CONFIG_NLS_CODEPAGE_864 is not set
949# CONFIG_NLS_CODEPAGE_865 is not set
950# CONFIG_NLS_CODEPAGE_866 is not set
951# CONFIG_NLS_CODEPAGE_869 is not set
952# CONFIG_NLS_CODEPAGE_936 is not set
953# CONFIG_NLS_CODEPAGE_950 is not set
954# CONFIG_NLS_CODEPAGE_932 is not set
955# CONFIG_NLS_CODEPAGE_949 is not set
956# CONFIG_NLS_CODEPAGE_874 is not set
957# CONFIG_NLS_ISO8859_8 is not set
958# CONFIG_NLS_CODEPAGE_1250 is not set
959# CONFIG_NLS_CODEPAGE_1251 is not set
960# CONFIG_NLS_ASCII is not set
961CONFIG_NLS_ISO8859_1=y
962# CONFIG_NLS_ISO8859_2 is not set
963# CONFIG_NLS_ISO8859_3 is not set
964# CONFIG_NLS_ISO8859_4 is not set
965# CONFIG_NLS_ISO8859_5 is not set
966# CONFIG_NLS_ISO8859_6 is not set
967# CONFIG_NLS_ISO8859_7 is not set
968# CONFIG_NLS_ISO8859_9 is not set
969# CONFIG_NLS_ISO8859_13 is not set
970# CONFIG_NLS_ISO8859_14 is not set
971# CONFIG_NLS_ISO8859_15 is not set
972# CONFIG_NLS_KOI8_R is not set
973# CONFIG_NLS_KOI8_U is not set
974# CONFIG_NLS_UTF8 is not set
789 975
790# 976#
791# Distributed Lock Manager 977# Distributed Lock Manager
@@ -795,9 +981,10 @@ CONFIG_MSDOS_PARTITION=y
795# 981#
796# Library routines 982# Library routines
797# 983#
984CONFIG_BITREVERSE=y
798# CONFIG_CRC_CCITT is not set 985# CONFIG_CRC_CCITT is not set
799# CONFIG_CRC16 is not set 986# CONFIG_CRC16 is not set
800# CONFIG_CRC32 is not set 987CONFIG_CRC32=y
801# CONFIG_LIBCRC32C is not set 988# CONFIG_LIBCRC32C is not set
802CONFIG_PLIST=y 989CONFIG_PLIST=y
803CONFIG_IOMAP_COPY=y 990CONFIG_IOMAP_COPY=y
@@ -821,22 +1008,23 @@ CONFIG_DEBUG_KERNEL=y
821CONFIG_LOG_BUF_SHIFT=17 1008CONFIG_LOG_BUF_SHIFT=17
822CONFIG_DETECT_SOFTLOCKUP=y 1009CONFIG_DETECT_SOFTLOCKUP=y
823# CONFIG_SCHEDSTATS is not set 1010# CONFIG_SCHEDSTATS is not set
824# CONFIG_DEBUG_SLAB is not set 1011CONFIG_DEBUG_SLAB=y
1012# CONFIG_DEBUG_SLAB_LEAK is not set
825# CONFIG_DEBUG_RT_MUTEXES is not set 1013# CONFIG_DEBUG_RT_MUTEXES is not set
826# CONFIG_RT_MUTEX_TESTER is not set 1014# CONFIG_RT_MUTEX_TESTER is not set
827CONFIG_DEBUG_SPINLOCK=y 1015CONFIG_DEBUG_SPINLOCK=y
828# CONFIG_DEBUG_MUTEXES is not set 1016CONFIG_DEBUG_MUTEXES=y
829# CONFIG_DEBUG_RWSEMS is not set 1017CONFIG_DEBUG_RWSEMS=y
830CONFIG_DEBUG_SPINLOCK_SLEEP=y 1018CONFIG_DEBUG_SPINLOCK_SLEEP=y
831# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1019# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
832# CONFIG_DEBUG_KOBJECT is not set 1020# CONFIG_DEBUG_KOBJECT is not set
833# CONFIG_DEBUG_BUGVERBOSE is not set 1021CONFIG_DEBUG_BUGVERBOSE=y
834CONFIG_DEBUG_INFO=y 1022CONFIG_DEBUG_INFO=y
835# CONFIG_DEBUG_VM is not set 1023# CONFIG_DEBUG_VM is not set
836CONFIG_DEBUG_LIST=y 1024CONFIG_DEBUG_LIST=y
837CONFIG_FORCED_INLINING=y 1025CONFIG_FORCED_INLINING=y
838# CONFIG_RCU_TORTURE_TEST is not set 1026# CONFIG_RCU_TORTURE_TEST is not set
839# CONFIG_DEBUG_STACKOVERFLOW is not set 1027CONFIG_DEBUG_STACKOVERFLOW=y
840# CONFIG_DEBUG_STACK_USAGE is not set 1028# CONFIG_DEBUG_STACK_USAGE is not set
841# CONFIG_DEBUGGER is not set 1029# CONFIG_DEBUGGER is not set
842CONFIG_IRQSTACKS=y 1030CONFIG_IRQSTACKS=y
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index d2ded19e4064..8120d428ebfd 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -17,6 +17,7 @@ obj-y += vdso32/
17obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ 17obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
18 signal_64.o ptrace32.o \ 18 signal_64.o ptrace32.o \
19 paca.o cpu_setup_ppc970.o \ 19 paca.o cpu_setup_ppc970.o \
20 cpu_setup_pa6t.o \
20 firmware.o sysfs.o nvram_64.o 21 firmware.o sysfs.o nvram_64.o
21obj-$(CONFIG_PPC64) += vdso64/ 22obj-$(CONFIG_PPC64) += vdso64/
22obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o 23obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
diff --git a/arch/powerpc/kernel/cpu_setup_pa6t.S b/arch/powerpc/kernel/cpu_setup_pa6t.S
new file mode 100644
index 000000000000..4047be25c4d2
--- /dev/null
+++ b/arch/powerpc/kernel/cpu_setup_pa6t.S
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2006-2007 PA Semi, Inc
3 *
4 * Maintained by: Olof Johansson <olof@lixom.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21#include <asm/processor.h>
22#include <asm/page.h>
23#include <asm/cputable.h>
24#include <asm/ppc_asm.h>
25#include <asm/asm-offsets.h>
26#include <asm/cache.h>
27
28/* Right now, restore and setup are the same thing */
29_GLOBAL(__restore_cpu_pa6t)
30_GLOBAL(__setup_cpu_pa6t)
31 /* Do nothing if not running in HV mode */
32 mfmsr r0
33 rldicl. r0,r0,4,63
34 beqlr
35
36 mfspr r0,SPRN_HID5
37 ori r0,r0,0x30
38 mtspr SPRN_HID5,r0
39
40 mfspr r0,SPRN_LPCR
41 ori r0,r0,0x7000
42 mtspr SPRN_LPCR,r0
43
44 blr
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index b742013bb9da..dd17dffbf058 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -43,6 +43,8 @@ extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
43#ifdef CONFIG_PPC64 43#ifdef CONFIG_PPC64
44extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); 44extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
45extern void __setup_cpu_ppc970MP(unsigned long offset, struct cpu_spec* spec); 45extern void __setup_cpu_ppc970MP(unsigned long offset, struct cpu_spec* spec);
46extern void __setup_cpu_pa6t(unsigned long offset, struct cpu_spec* spec);
47extern void __restore_cpu_pa6t(unsigned long offset, struct cpu_spec* spec);
46extern void __restore_cpu_ppc970(void); 48extern void __restore_cpu_ppc970(void);
47#endif /* CONFIG_PPC64 */ 49#endif /* CONFIG_PPC64 */
48 50
@@ -86,6 +88,7 @@ static struct cpu_spec cpu_specs[] = {
86 .icache_bsize = 128, 88 .icache_bsize = 128,
87 .dcache_bsize = 128, 89 .dcache_bsize = 128,
88 .num_pmcs = 8, 90 .num_pmcs = 8,
91 .pmc_type = PPC_PMC_IBM,
89 .oprofile_cpu_type = "ppc64/power3", 92 .oprofile_cpu_type = "ppc64/power3",
90 .oprofile_type = PPC_OPROFILE_RS64, 93 .oprofile_type = PPC_OPROFILE_RS64,
91 .platform = "power3", 94 .platform = "power3",
@@ -99,6 +102,7 @@ static struct cpu_spec cpu_specs[] = {
99 .icache_bsize = 128, 102 .icache_bsize = 128,
100 .dcache_bsize = 128, 103 .dcache_bsize = 128,
101 .num_pmcs = 8, 104 .num_pmcs = 8,
105 .pmc_type = PPC_PMC_IBM,
102 .oprofile_cpu_type = "ppc64/power3", 106 .oprofile_cpu_type = "ppc64/power3",
103 .oprofile_type = PPC_OPROFILE_RS64, 107 .oprofile_type = PPC_OPROFILE_RS64,
104 .platform = "power3", 108 .platform = "power3",
@@ -112,6 +116,7 @@ static struct cpu_spec cpu_specs[] = {
112 .icache_bsize = 128, 116 .icache_bsize = 128,
113 .dcache_bsize = 128, 117 .dcache_bsize = 128,
114 .num_pmcs = 8, 118 .num_pmcs = 8,
119 .pmc_type = PPC_PMC_IBM,
115 .oprofile_cpu_type = "ppc64/rs64", 120 .oprofile_cpu_type = "ppc64/rs64",
116 .oprofile_type = PPC_OPROFILE_RS64, 121 .oprofile_type = PPC_OPROFILE_RS64,
117 .platform = "rs64", 122 .platform = "rs64",
@@ -125,6 +130,7 @@ static struct cpu_spec cpu_specs[] = {
125 .icache_bsize = 128, 130 .icache_bsize = 128,
126 .dcache_bsize = 128, 131 .dcache_bsize = 128,
127 .num_pmcs = 8, 132 .num_pmcs = 8,
133 .pmc_type = PPC_PMC_IBM,
128 .oprofile_cpu_type = "ppc64/rs64", 134 .oprofile_cpu_type = "ppc64/rs64",
129 .oprofile_type = PPC_OPROFILE_RS64, 135 .oprofile_type = PPC_OPROFILE_RS64,
130 .platform = "rs64", 136 .platform = "rs64",
@@ -138,6 +144,7 @@ static struct cpu_spec cpu_specs[] = {
138 .icache_bsize = 128, 144 .icache_bsize = 128,
139 .dcache_bsize = 128, 145 .dcache_bsize = 128,
140 .num_pmcs = 8, 146 .num_pmcs = 8,
147 .pmc_type = PPC_PMC_IBM,
141 .oprofile_cpu_type = "ppc64/rs64", 148 .oprofile_cpu_type = "ppc64/rs64",
142 .oprofile_type = PPC_OPROFILE_RS64, 149 .oprofile_type = PPC_OPROFILE_RS64,
143 .platform = "rs64", 150 .platform = "rs64",
@@ -151,6 +158,7 @@ static struct cpu_spec cpu_specs[] = {
151 .icache_bsize = 128, 158 .icache_bsize = 128,
152 .dcache_bsize = 128, 159 .dcache_bsize = 128,
153 .num_pmcs = 8, 160 .num_pmcs = 8,
161 .pmc_type = PPC_PMC_IBM,
154 .oprofile_cpu_type = "ppc64/rs64", 162 .oprofile_cpu_type = "ppc64/rs64",
155 .oprofile_type = PPC_OPROFILE_RS64, 163 .oprofile_type = PPC_OPROFILE_RS64,
156 .platform = "rs64", 164 .platform = "rs64",
@@ -164,6 +172,7 @@ static struct cpu_spec cpu_specs[] = {
164 .icache_bsize = 128, 172 .icache_bsize = 128,
165 .dcache_bsize = 128, 173 .dcache_bsize = 128,
166 .num_pmcs = 8, 174 .num_pmcs = 8,
175 .pmc_type = PPC_PMC_IBM,
167 .oprofile_cpu_type = "ppc64/power4", 176 .oprofile_cpu_type = "ppc64/power4",
168 .oprofile_type = PPC_OPROFILE_POWER4, 177 .oprofile_type = PPC_OPROFILE_POWER4,
169 .platform = "power4", 178 .platform = "power4",
@@ -177,6 +186,7 @@ static struct cpu_spec cpu_specs[] = {
177 .icache_bsize = 128, 186 .icache_bsize = 128,
178 .dcache_bsize = 128, 187 .dcache_bsize = 128,
179 .num_pmcs = 8, 188 .num_pmcs = 8,
189 .pmc_type = PPC_PMC_IBM,
180 .oprofile_cpu_type = "ppc64/power4", 190 .oprofile_cpu_type = "ppc64/power4",
181 .oprofile_type = PPC_OPROFILE_POWER4, 191 .oprofile_type = PPC_OPROFILE_POWER4,
182 .platform = "power4", 192 .platform = "power4",
@@ -191,6 +201,7 @@ static struct cpu_spec cpu_specs[] = {
191 .icache_bsize = 128, 201 .icache_bsize = 128,
192 .dcache_bsize = 128, 202 .dcache_bsize = 128,
193 .num_pmcs = 8, 203 .num_pmcs = 8,
204 .pmc_type = PPC_PMC_IBM,
194 .cpu_setup = __setup_cpu_ppc970, 205 .cpu_setup = __setup_cpu_ppc970,
195 .cpu_restore = __restore_cpu_ppc970, 206 .cpu_restore = __restore_cpu_ppc970,
196 .oprofile_cpu_type = "ppc64/970", 207 .oprofile_cpu_type = "ppc64/970",
@@ -207,6 +218,7 @@ static struct cpu_spec cpu_specs[] = {
207 .icache_bsize = 128, 218 .icache_bsize = 128,
208 .dcache_bsize = 128, 219 .dcache_bsize = 128,
209 .num_pmcs = 8, 220 .num_pmcs = 8,
221 .pmc_type = PPC_PMC_IBM,
210 .cpu_setup = __setup_cpu_ppc970, 222 .cpu_setup = __setup_cpu_ppc970,
211 .cpu_restore = __restore_cpu_ppc970, 223 .cpu_restore = __restore_cpu_ppc970,
212 .oprofile_cpu_type = "ppc64/970", 224 .oprofile_cpu_type = "ppc64/970",
@@ -239,6 +251,7 @@ static struct cpu_spec cpu_specs[] = {
239 .icache_bsize = 128, 251 .icache_bsize = 128,
240 .dcache_bsize = 128, 252 .dcache_bsize = 128,
241 .num_pmcs = 8, 253 .num_pmcs = 8,
254 .pmc_type = PPC_PMC_IBM,
242 .cpu_setup = __setup_cpu_ppc970, 255 .cpu_setup = __setup_cpu_ppc970,
243 .oprofile_cpu_type = "ppc64/970", 256 .oprofile_cpu_type = "ppc64/970",
244 .oprofile_type = PPC_OPROFILE_POWER4, 257 .oprofile_type = PPC_OPROFILE_POWER4,
@@ -253,6 +266,7 @@ static struct cpu_spec cpu_specs[] = {
253 .icache_bsize = 128, 266 .icache_bsize = 128,
254 .dcache_bsize = 128, 267 .dcache_bsize = 128,
255 .num_pmcs = 6, 268 .num_pmcs = 6,
269 .pmc_type = PPC_PMC_IBM,
256 .oprofile_cpu_type = "ppc64/power5", 270 .oprofile_cpu_type = "ppc64/power5",
257 .oprofile_type = PPC_OPROFILE_POWER4, 271 .oprofile_type = PPC_OPROFILE_POWER4,
258 /* SIHV / SIPR bits are implemented on POWER4+ (GQ) 272 /* SIHV / SIPR bits are implemented on POWER4+ (GQ)
@@ -271,6 +285,7 @@ static struct cpu_spec cpu_specs[] = {
271 .icache_bsize = 128, 285 .icache_bsize = 128,
272 .dcache_bsize = 128, 286 .dcache_bsize = 128,
273 .num_pmcs = 6, 287 .num_pmcs = 6,
288 .pmc_type = PPC_PMC_IBM,
274 .oprofile_cpu_type = "ppc64/power5+", 289 .oprofile_cpu_type = "ppc64/power5+",
275 .oprofile_type = PPC_OPROFILE_POWER4, 290 .oprofile_type = PPC_OPROFILE_POWER4,
276 .oprofile_mmcra_sihv = MMCRA_SIHV, 291 .oprofile_mmcra_sihv = MMCRA_SIHV,
@@ -321,6 +336,7 @@ static struct cpu_spec cpu_specs[] = {
321 .icache_bsize = 128, 336 .icache_bsize = 128,
322 .dcache_bsize = 128, 337 .dcache_bsize = 128,
323 .num_pmcs = 6, 338 .num_pmcs = 6,
339 .pmc_type = PPC_PMC_IBM,
324 .oprofile_cpu_type = "ppc64/power6", 340 .oprofile_cpu_type = "ppc64/power6",
325 .oprofile_type = PPC_OPROFILE_POWER4, 341 .oprofile_type = PPC_OPROFILE_POWER4,
326 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV, 342 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
@@ -340,6 +356,7 @@ static struct cpu_spec cpu_specs[] = {
340 .icache_bsize = 128, 356 .icache_bsize = 128,
341 .dcache_bsize = 128, 357 .dcache_bsize = 128,
342 .num_pmcs = 4, 358 .num_pmcs = 4,
359 .pmc_type = PPC_PMC_IBM,
343 .oprofile_cpu_type = "ppc64/cell-be", 360 .oprofile_cpu_type = "ppc64/cell-be",
344 .oprofile_type = PPC_OPROFILE_CELL, 361 .oprofile_type = PPC_OPROFILE_CELL,
345 .platform = "ppc-cell-be", 362 .platform = "ppc-cell-be",
@@ -353,6 +370,9 @@ static struct cpu_spec cpu_specs[] = {
353 .icache_bsize = 64, 370 .icache_bsize = 64,
354 .dcache_bsize = 64, 371 .dcache_bsize = 64,
355 .num_pmcs = 6, 372 .num_pmcs = 6,
373 .pmc_type = PPC_PMC_PA6T,
374 .cpu_setup = __setup_cpu_pa6t,
375 .cpu_restore = __restore_cpu_pa6t,
356 .platform = "pa6t", 376 .platform = "pa6t",
357 }, 377 },
358 { /* default match */ 378 { /* default match */
@@ -364,6 +384,7 @@ static struct cpu_spec cpu_specs[] = {
364 .icache_bsize = 128, 384 .icache_bsize = 128,
365 .dcache_bsize = 128, 385 .dcache_bsize = 128,
366 .num_pmcs = 6, 386 .num_pmcs = 6,
387 .pmc_type = PPC_PMC_IBM,
367 .platform = "power4", 388 .platform = "power4",
368 } 389 }
369#endif /* CONFIG_PPC64 */ 390#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 2551c0884afc..2b66d53dcc55 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -172,13 +172,18 @@ syscall_error_cont:
172 stdcx. r0,0,r1 /* to clear the reservation */ 172 stdcx. r0,0,r1 /* to clear the reservation */
173 andi. r6,r8,MSR_PR 173 andi. r6,r8,MSR_PR
174 ld r4,_LINK(r1) 174 ld r4,_LINK(r1)
175 /*
176 * Clear RI before restoring r13. If we are returning to
177 * userspace and we take an exception after restoring r13,
178 * we end up corrupting the userspace r13 value.
179 */
180 li r12,MSR_RI
181 andc r11,r10,r12
182 mtmsrd r11,1 /* clear MSR.RI */
175 beq- 1f 183 beq- 1f
176 ACCOUNT_CPU_USER_EXIT(r11, r12) 184 ACCOUNT_CPU_USER_EXIT(r11, r12)
177 ld r13,GPR13(r1) /* only restore r13 if returning to usermode */ 185 ld r13,GPR13(r1) /* only restore r13 if returning to usermode */
1781: ld r2,GPR2(r1) 1861: ld r2,GPR2(r1)
179 li r12,MSR_RI
180 andc r11,r10,r12
181 mtmsrd r11,1 /* clear MSR.RI */
182 ld r1,GPR1(r1) 187 ld r1,GPR1(r1)
183 mtlr r4 188 mtlr r4
184 mtcr r5 189 mtcr r5
@@ -488,42 +493,44 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
488#endif 493#endif
489 stb r5,PACASOFTIRQEN(r13) 494 stb r5,PACASOFTIRQEN(r13)
490 495
496 /* extract EE bit and use it to restore paca->hard_enabled */
491 ld r3,_MSR(r1) 497 ld r3,_MSR(r1)
498 rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */
499 stb r4,PACAHARDIRQEN(r13)
500
501 ld r4,_CTR(r1)
502 ld r0,_LINK(r1)
503 mtctr r4
504 mtlr r0
505 ld r4,_XER(r1)
506 mtspr SPRN_XER,r4
507
508 REST_8GPRS(5, r1)
509
492 andi. r0,r3,MSR_RI 510 andi. r0,r3,MSR_RI
493 beq- unrecov_restore 511 beq- unrecov_restore
494 512
495 /* extract EE bit and use it to restore paca->hard_enabled */ 513 stdcx. r0,0,r1 /* to clear the reservation */
496 rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */
497 stb r4,PACAHARDIRQEN(r13)
498 514
499 andi. r0,r3,MSR_PR 515 /*
516 * Clear RI before restoring r13. If we are returning to
517 * userspace and we take an exception after restoring r13,
518 * we end up corrupting the userspace r13 value.
519 */
520 mfmsr r4
521 andc r4,r4,r0 /* r0 contains MSR_RI here */
522 mtmsrd r4,1
500 523
501 /* 524 /*
502 * r13 is our per cpu area, only restore it if we are returning to 525 * r13 is our per cpu area, only restore it if we are returning to
503 * userspace 526 * userspace
504 */ 527 */
528 andi. r0,r3,MSR_PR
505 beq 1f 529 beq 1f
506 ACCOUNT_CPU_USER_EXIT(r3, r4) 530 ACCOUNT_CPU_USER_EXIT(r2, r4)
507 REST_GPR(13, r1) 531 REST_GPR(13, r1)
5081: 5321:
509 ld r3,_CTR(r1) 533 mtspr SPRN_SRR1,r3
510 ld r0,_LINK(r1)
511 mtctr r3
512 mtlr r0
513 ld r3,_XER(r1)
514 mtspr SPRN_XER,r3
515
516 REST_8GPRS(5, r1)
517
518 stdcx. r0,0,r1 /* to clear the reservation */
519
520 mfmsr r0
521 li r2, MSR_RI
522 andc r0,r0,r2
523 mtmsrd r0,1
524
525 ld r0,_MSR(r1)
526 mtspr SPRN_SRR1,r0
527 534
528 ld r2,_CCR(r1) 535 ld r2,_CCR(r1)
529 mtcrf 0xFF,r2 536 mtcrf 0xFF,r2
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 9417cf5b4b7e..c897203198b1 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -344,12 +344,7 @@ i##n: \
344/* System reset */ 344/* System reset */
345/* core99 pmac starts the seconary here by changing the vector, and 345/* core99 pmac starts the seconary here by changing the vector, and
346 putting it back to what it was (unknown_exception) when done. */ 346 putting it back to what it was (unknown_exception) when done. */
347#if defined(CONFIG_GEMINI) && defined(CONFIG_SMP)
348 . = 0x100
349 b __secondary_start_gemini
350#else
351 EXCEPTION(0x100, Reset, unknown_exception, EXC_XFER_STD) 347 EXCEPTION(0x100, Reset, unknown_exception, EXC_XFER_STD)
352#endif
353 348
354/* Machine check */ 349/* Machine check */
355/* 350/*
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 71b1fe58e9e4..97cedcd6c9b4 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -613,7 +613,7 @@ system_call_pSeries:
613/*** pSeries interrupt support ***/ 613/*** pSeries interrupt support ***/
614 614
615 /* moved from 0xf00 */ 615 /* moved from 0xf00 */
616 MASKABLE_EXCEPTION_PSERIES(., performance_monitor) 616 STD_EXCEPTION_PSERIES(., performance_monitor)
617 617
618/* 618/*
619 * An interrupt came in while soft-disabled; clear EE in SRR1, 619 * An interrupt came in while soft-disabled; clear EE in SRR1,
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index c68113371050..601ef79a5916 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -12,23 +12,23 @@
12 * Here comes the ppc64 implementation of the IOMAP 12 * Here comes the ppc64 implementation of the IOMAP
13 * interfaces. 13 * interfaces.
14 */ 14 */
15unsigned int fastcall ioread8(void __iomem *addr) 15unsigned int ioread8(void __iomem *addr)
16{ 16{
17 return readb(addr); 17 return readb(addr);
18} 18}
19unsigned int fastcall ioread16(void __iomem *addr) 19unsigned int ioread16(void __iomem *addr)
20{ 20{
21 return readw(addr); 21 return readw(addr);
22} 22}
23unsigned int fastcall ioread16be(void __iomem *addr) 23unsigned int ioread16be(void __iomem *addr)
24{ 24{
25 return in_be16(addr); 25 return in_be16(addr);
26} 26}
27unsigned int fastcall ioread32(void __iomem *addr) 27unsigned int ioread32(void __iomem *addr)
28{ 28{
29 return readl(addr); 29 return readl(addr);
30} 30}
31unsigned int fastcall ioread32be(void __iomem *addr) 31unsigned int ioread32be(void __iomem *addr)
32{ 32{
33 return in_be32(addr); 33 return in_be32(addr);
34} 34}
@@ -38,23 +38,23 @@ EXPORT_SYMBOL(ioread16be);
38EXPORT_SYMBOL(ioread32); 38EXPORT_SYMBOL(ioread32);
39EXPORT_SYMBOL(ioread32be); 39EXPORT_SYMBOL(ioread32be);
40 40
41void fastcall iowrite8(u8 val, void __iomem *addr) 41void iowrite8(u8 val, void __iomem *addr)
42{ 42{
43 writeb(val, addr); 43 writeb(val, addr);
44} 44}
45void fastcall iowrite16(u16 val, void __iomem *addr) 45void iowrite16(u16 val, void __iomem *addr)
46{ 46{
47 writew(val, addr); 47 writew(val, addr);
48} 48}
49void fastcall iowrite16be(u16 val, void __iomem *addr) 49void iowrite16be(u16 val, void __iomem *addr)
50{ 50{
51 out_be16(addr, val); 51 out_be16(addr, val);
52} 52}
53void fastcall iowrite32(u32 val, void __iomem *addr) 53void iowrite32(u32 val, void __iomem *addr)
54{ 54{
55 writel(val, addr); 55 writel(val, addr);
56} 56}
57void fastcall iowrite32be(u32 val, void __iomem *addr) 57void iowrite32be(u32 val, void __iomem *addr)
58{ 58{
59 out_be32(addr, val); 59 out_be32(addr, val);
60} 60}
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 0bd8c7665834..919fbf568495 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -281,10 +281,10 @@ void do_IRQ(struct pt_regs *regs)
281 281
282 /* 282 /*
283 * Every platform is required to implement ppc_md.get_irq. 283 * Every platform is required to implement ppc_md.get_irq.
284 * This function will either return an irq number or -1 to 284 * This function will either return an irq number or NO_IRQ to
285 * indicate there are no more pending. 285 * indicate there are no more pending.
286 * The value -2 is for buggy hardware and means that this IRQ 286 * The value NO_IRQ_IGNORE is for buggy hardware and means that this
287 * has already been handled. -- Tom 287 * IRQ has already been handled. -- Tom
288 */ 288 */
289 irq = ppc_md.get_irq(); 289 irq = ppc_md.get_irq();
290 290
@@ -604,6 +604,8 @@ unsigned int irq_create_mapping(struct irq_host *host,
604 */ 604 */
605 virq = irq_find_mapping(host, hwirq); 605 virq = irq_find_mapping(host, hwirq);
606 if (virq != IRQ_NONE) { 606 if (virq != IRQ_NONE) {
607 if (host->ops->remap)
608 host->ops->remap(host, virq, hwirq);
607 pr_debug("irq: -> existing mapping on virq %d\n", virq); 609 pr_debug("irq: -> existing mapping on virq %d\n", virq);
608 return virq; 610 return virq;
609 } 611 }
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 4657563f8813..dd2886f97e98 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -46,8 +46,8 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
46 if ((unsigned long)p->addr & 0x03) { 46 if ((unsigned long)p->addr & 0x03) {
47 printk("Attempt to register kprobe at an unaligned address\n"); 47 printk("Attempt to register kprobe at an unaligned address\n");
48 ret = -EINVAL; 48 ret = -EINVAL;
49 } else if (IS_MTMSRD(insn) || IS_RFID(insn)) { 49 } else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) {
50 printk("Cannot register a kprobe on rfid or mtmsrd\n"); 50 printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n");
51 ret = -EINVAL; 51 ret = -EINVAL;
52 } 52 }
53 53
@@ -483,8 +483,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
483 memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs)); 483 memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs));
484 484
485 /* setup return addr to the jprobe handler routine */ 485 /* setup return addr to the jprobe handler routine */
486#ifdef CONFIG_PPC64
486 regs->nip = (unsigned long)(((func_descr_t *)jp->entry)->entry); 487 regs->nip = (unsigned long)(((func_descr_t *)jp->entry)->entry);
487 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); 488 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc);
489#else
490 regs->nip = (unsigned long)jp->entry;
491#endif
488 492
489 return 1; 493 return 1;
490} 494}
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 41c05dcd68f4..0de5a08cf9b0 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -439,6 +439,10 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
439 439
440 ssize_t retval = -ENOMEM; 440 ssize_t retval = -ENOMEM;
441 441
442 if (!firmware_has_feature(FW_FEATURE_SPLPAR) ||
443 firmware_has_feature(FW_FEATURE_ISERIES))
444 return -EINVAL;
445
442 kbuf = kmalloc(count, GFP_KERNEL); 446 kbuf = kmalloc(count, GFP_KERNEL);
443 if (!kbuf) 447 if (!kbuf)
444 goto out; 448 goto out;
@@ -517,7 +521,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
517static ssize_t lparcfg_write(struct file *file, const char __user * buf, 521static ssize_t lparcfg_write(struct file *file, const char __user * buf,
518 size_t count, loff_t * off) 522 size_t count, loff_t * off)
519{ 523{
520 return count; 524 return -EINVAL;
521} 525}
522 526
523#endif /* CONFIG_PPC_PSERIES */ 527#endif /* CONFIG_PPC_PSERIES */
@@ -570,6 +574,7 @@ static int lparcfg_open(struct inode *inode, struct file *file)
570struct file_operations lparcfg_fops = { 574struct file_operations lparcfg_fops = {
571 .owner = THIS_MODULE, 575 .owner = THIS_MODULE,
572 .read = seq_read, 576 .read = seq_read,
577 .write = lparcfg_write,
573 .open = lparcfg_open, 578 .open = lparcfg_open,
574 .release = single_release, 579 .release = single_release,
575}; 580};
@@ -581,10 +586,8 @@ int __init lparcfg_init(void)
581 586
582 /* Allow writing if we have FW_FEATURE_SPLPAR */ 587 /* Allow writing if we have FW_FEATURE_SPLPAR */
583 if (firmware_has_feature(FW_FEATURE_SPLPAR) && 588 if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
584 !firmware_has_feature(FW_FEATURE_ISERIES)) { 589 !firmware_has_feature(FW_FEATURE_ISERIES))
585 lparcfg_fops.write = lparcfg_write;
586 mode |= S_IWUSR; 590 mode |= S_IWUSR;
587 }
588 591
589 ent = create_proc_entry("ppc64/lparcfg", mode, NULL); 592 ent = create_proc_entry("ppc64/lparcfg", mode, NULL);
590 if (ent) { 593 if (ent) {
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 21fd2c662a99..519861da0423 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -311,6 +311,46 @@ _GLOBAL(real_writeb)
311 blr 311 blr
312#endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */ 312#endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */
313 313
314#ifdef CONFIG_PPC_PASEMI
315
316/* No support in all binutils for these yet, so use defines */
317#define LBZCIX(RT,RA,RB) .long (0x7c0006aa|(RT<<21)|(RA<<16)|(RB << 11))
318#define STBCIX(RS,RA,RB) .long (0x7c0007aa|(RS<<21)|(RA<<16)|(RB << 11))
319
320
321_GLOBAL(real_205_readb)
322 mfmsr r7
323 ori r0,r7,MSR_DR
324 xori r0,r0,MSR_DR
325 sync
326 mtmsrd r0
327 sync
328 isync
329 LBZCIX(r3,0,r3)
330 isync
331 mtmsrd r7
332 sync
333 isync
334 blr
335
336_GLOBAL(real_205_writeb)
337 mfmsr r7
338 ori r0,r7,MSR_DR
339 xori r0,r0,MSR_DR
340 sync
341 mtmsrd r0
342 sync
343 isync
344 STBCIX(r3,0,r4)
345 isync
346 mtmsrd r7
347 sync
348 isync
349 blr
350
351#endif /* CONFIG_PPC_PASEMI */
352
353
314#ifdef CONFIG_CPU_FREQ_PMAC64 354#ifdef CONFIG_CPU_FREQ_PMAC64
315/* 355/*
316 * SCOM access functions for 970 (FX only for now) 356 * SCOM access functions for 970 (FX only for now)
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
index 8339fd609de0..07a89a398639 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -224,7 +224,12 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
224 /* Low half of the symbol */ 224 /* Low half of the symbol */
225 *(uint16_t *)location = value; 225 *(uint16_t *)location = value;
226 break; 226 break;
227 227
228 case R_PPC_ADDR16_HI:
229 /* Higher half of the symbol */
230 *(uint16_t *)location = (value >> 16);
231 break;
232
228 case R_PPC_ADDR16_HA: 233 case R_PPC_ADDR16_HA:
229 /* Sign-adjusted lower 16 bits: PPC ELF ABI says: 234 /* Sign-adjusted lower 16 bits: PPC ELF ABI says:
230 (((x >> 16) + ((x & 0x8000) ? 1 : 0))) & 0xFFFF. 235 (((x >> 16) + ((x & 0x8000) ? 1 : 0))) & 0xFFFF.
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index c54f3639c5ad..d8ef2e100505 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -1450,7 +1450,6 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
1450 return -1; 1450 return -1;
1451 } 1451 }
1452 pci_dev->irq = virq; 1452 pci_dev->irq = virq;
1453 pci_write_config_byte(pci_dev, PCI_INTERRUPT_LINE, virq);
1454 1453
1455 return 0; 1454 return 0;
1456} 1455}
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 01f18c683407..7e97d71a5f8f 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -381,8 +381,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
381 381
382 pci_device_add(dev, bus); 382 pci_device_add(dev, bus);
383 383
384 /* XXX pci_scan_msi_device(dev); */
385
386 return dev; 384 return dev;
387} 385}
388EXPORT_SYMBOL(of_create_pci_dev); 386EXPORT_SYMBOL(of_create_pci_dev);
@@ -1325,7 +1323,6 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
1325 DBG(" -> mapped to linux irq %d\n", virq); 1323 DBG(" -> mapped to linux irq %d\n", virq);
1326 1324
1327 pci_dev->irq = virq; 1325 pci_dev->irq = virq;
1328 pci_write_config_byte(pci_dev, PCI_INTERRUPT_LINE, virq);
1329 1326
1330 return 0; 1327 return 0;
1331} 1328}
diff --git a/arch/powerpc/kernel/pmc.c b/arch/powerpc/kernel/pmc.c
index 3d8f6f44641e..24d7b7c99bb9 100644
--- a/arch/powerpc/kernel/pmc.c
+++ b/arch/powerpc/kernel/pmc.c
@@ -17,40 +17,25 @@
17#include <linux/module.h> 17#include <linux/module.h>
18 18
19#include <asm/processor.h> 19#include <asm/processor.h>
20#include <asm/cputable.h>
20#include <asm/pmc.h> 21#include <asm/pmc.h>
21 22
22#if defined(CONFIG_FSL_BOOKE) && !defined(CONFIG_E200) 23#ifndef MMCR0_PMA0
23static void dummy_perf(struct pt_regs *regs) 24#define MMCR0_PMA0 0
24{
25 unsigned int pmgc0 = mfpmr(PMRN_PMGC0);
26
27 pmgc0 &= ~PMGC0_PMIE;
28 mtpmr(PMRN_PMGC0, pmgc0);
29}
30#elif defined(CONFIG_PPC64) || defined(CONFIG_6xx)
31
32#ifndef MMCR0_PMAO
33#define MMCR0_PMAO 0
34#endif 25#endif
35 26
36/* Ensure exceptions are disabled */
37static void dummy_perf(struct pt_regs *regs) 27static void dummy_perf(struct pt_regs *regs)
38{ 28{
39 unsigned int mmcr0 = mfspr(SPRN_MMCR0); 29#if defined(CONFIG_FSL_BOOKE) && !defined(CONFIG_E200)
40 30 mtpmr(PMRN_PMGC0, mfpmr(PMRN_PMGC0) & ~PMGC0_PMIE);
41 mmcr0 &= ~(MMCR0_PMXE|MMCR0_PMAO); 31#elif defined(CONFIG_PPC64) || defined(CONFIG_6xx)
42 mtspr(SPRN_MMCR0, mmcr0); 32 if (cur_cpu_spec->pmc_type == PPC_PMC_IBM)
43} 33 mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) & ~(MMCR0_PMXE|MMCR0_PMA0));
44#else 34#else
45/* Ensure exceptions are disabled */ 35 mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) & ~MMCR0_PMXE);
46static void dummy_perf(struct pt_regs *regs)
47{
48 unsigned int mmcr0 = mfspr(SPRN_MMCR0);
49
50 mmcr0 &= ~(MMCR0_PMXE);
51 mtspr(SPRN_MMCR0, mmcr0);
52}
53#endif 36#endif
37}
38
54 39
55static DEFINE_SPINLOCK(pmc_owner_lock); 40static DEFINE_SPINLOCK(pmc_owner_lock);
56static void *pmc_owner_caller; /* mostly for debugging */ 41static void *pmc_owner_caller; /* mostly for debugging */
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 95776b6af4e2..ecee596d28f6 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -44,6 +44,7 @@
44#include <asm/btext.h> 44#include <asm/btext.h>
45#include <asm/div64.h> 45#include <asm/div64.h>
46#include <asm/signal.h> 46#include <asm/signal.h>
47#include <asm/dcr.h>
47 48
48#ifdef CONFIG_8xx 49#ifdef CONFIG_8xx
49#include <asm/commproc.h> 50#include <asm/commproc.h>
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1fc732a552db..3be52d693eca 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1221,8 +1221,7 @@ struct device_node *of_find_node_by_name(struct device_node *from,
1221 if (np->name != NULL && strcasecmp(np->name, name) == 0 1221 if (np->name != NULL && strcasecmp(np->name, name) == 0
1222 && of_node_get(np)) 1222 && of_node_get(np))
1223 break; 1223 break;
1224 if (from) 1224 of_node_put(from);
1225 of_node_put(from);
1226 read_unlock(&devtree_lock); 1225 read_unlock(&devtree_lock);
1227 return np; 1226 return np;
1228} 1227}
@@ -1250,8 +1249,7 @@ struct device_node *of_find_node_by_type(struct device_node *from,
1250 if (np->type != 0 && strcasecmp(np->type, type) == 0 1249 if (np->type != 0 && strcasecmp(np->type, type) == 0
1251 && of_node_get(np)) 1250 && of_node_get(np))
1252 break; 1251 break;
1253 if (from) 1252 of_node_put(from);
1254 of_node_put(from);
1255 read_unlock(&devtree_lock); 1253 read_unlock(&devtree_lock);
1256 return np; 1254 return np;
1257} 1255}
@@ -1285,8 +1283,7 @@ struct device_node *of_find_compatible_node(struct device_node *from,
1285 if (device_is_compatible(np, compatible) && of_node_get(np)) 1283 if (device_is_compatible(np, compatible) && of_node_get(np))
1286 break; 1284 break;
1287 } 1285 }
1288 if (from) 1286 of_node_put(from);
1289 of_node_put(from);
1290 read_unlock(&devtree_lock); 1287 read_unlock(&devtree_lock);
1291 return np; 1288 return np;
1292} 1289}
@@ -1329,8 +1326,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
1329 for (np = allnodes; np != 0; np = np->allnext) 1326 for (np = allnodes; np != 0; np = np->allnext)
1330 if (np->linux_phandle == handle) 1327 if (np->linux_phandle == handle)
1331 break; 1328 break;
1332 if (np) 1329 of_node_get(np);
1333 of_node_get(np);
1334 read_unlock(&devtree_lock); 1330 read_unlock(&devtree_lock);
1335 return np; 1331 return np;
1336} 1332}
@@ -1353,8 +1349,7 @@ struct device_node *of_find_all_nodes(struct device_node *prev)
1353 for (; np != 0; np = np->allnext) 1349 for (; np != 0; np = np->allnext)
1354 if (of_node_get(np)) 1350 if (of_node_get(np))
1355 break; 1351 break;
1356 if (prev) 1352 of_node_put(prev);
1357 of_node_put(prev);
1358 read_unlock(&devtree_lock); 1353 read_unlock(&devtree_lock);
1359 return np; 1354 return np;
1360} 1355}
@@ -1399,8 +1394,7 @@ struct device_node *of_get_next_child(const struct device_node *node,
1399 for (; next != 0; next = next->sibling) 1394 for (; next != 0; next = next->sibling)
1400 if (of_node_get(next)) 1395 if (of_node_get(next))
1401 break; 1396 break;
1402 if (prev) 1397 of_node_put(prev);
1403 of_node_put(prev);
1404 read_unlock(&devtree_lock); 1398 read_unlock(&devtree_lock);
1405 return next; 1399 return next;
1406} 1400}
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 975102a020d9..cc44c7b975aa 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -532,16 +532,22 @@ void do_syscall_trace_enter(struct pt_regs *regs)
532 && (current->ptrace & PT_PTRACED)) 532 && (current->ptrace & PT_PTRACED))
533 do_syscall_trace(); 533 do_syscall_trace();
534 534
535 if (unlikely(current->audit_context)) 535 if (unlikely(current->audit_context)) {
536 audit_syscall_entry( 536#ifdef CONFIG_PPC64
537#ifdef CONFIG_PPC32 537 if (!test_thread_flag(TIF_32BIT))
538 AUDIT_ARCH_PPC, 538 audit_syscall_entry(AUDIT_ARCH_PPC64,
539#else 539 regs->gpr[0],
540 test_thread_flag(TIF_32BIT)?AUDIT_ARCH_PPC:AUDIT_ARCH_PPC64, 540 regs->gpr[3], regs->gpr[4],
541 regs->gpr[5], regs->gpr[6]);
542 else
541#endif 543#endif
542 regs->gpr[0], 544 audit_syscall_entry(AUDIT_ARCH_PPC,
543 regs->gpr[3], regs->gpr[4], 545 regs->gpr[0],
544 regs->gpr[5], regs->gpr[6]); 546 regs->gpr[3] & 0xffffffff,
547 regs->gpr[4] & 0xffffffff,
548 regs->gpr[5] & 0xffffffff,
549 regs->gpr[6] & 0xffffffff);
550 }
545} 551}
546 552
547void do_syscall_trace_leave(struct pt_regs *regs) 553void do_syscall_trace_leave(struct pt_regs *regs)
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 61c65d19ef06..6a19fa40dcee 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -65,6 +65,7 @@ int have_of = 1;
65 65
66#ifdef CONFIG_VGA_CONSOLE 66#ifdef CONFIG_VGA_CONSOLE
67unsigned long vgacon_remap_base; 67unsigned long vgacon_remap_base;
68EXPORT_SYMBOL(vgacon_remap_base);
68#endif 69#endif
69 70
70/* 71/*
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 400ab2b946e7..d57818aea081 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -169,6 +169,11 @@ static ssize_t __attribute_used__ \
169 return count; \ 169 return count; \
170} 170}
171 171
172
173/* Let's define all possible registers, we'll only hook up the ones
174 * that are implemented on the current processor
175 */
176
172SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0); 177SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0);
173SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1); 178SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1);
174SYSFS_PMCSETUP(mmcra, SPRN_MMCRA); 179SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
@@ -184,55 +189,87 @@ SYSFS_PMCSETUP(purr, SPRN_PURR);
184SYSFS_PMCSETUP(spurr, SPRN_SPURR); 189SYSFS_PMCSETUP(spurr, SPRN_SPURR);
185SYSFS_PMCSETUP(dscr, SPRN_DSCR); 190SYSFS_PMCSETUP(dscr, SPRN_DSCR);
186 191
187static SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0); 192SYSFS_PMCSETUP(pa6t_pmc0, PA6T_SPRN_PMC0);
188static SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1); 193SYSFS_PMCSETUP(pa6t_pmc1, PA6T_SPRN_PMC1);
194SYSFS_PMCSETUP(pa6t_pmc2, PA6T_SPRN_PMC2);
195SYSFS_PMCSETUP(pa6t_pmc3, PA6T_SPRN_PMC3);
196SYSFS_PMCSETUP(pa6t_pmc4, PA6T_SPRN_PMC4);
197SYSFS_PMCSETUP(pa6t_pmc5, PA6T_SPRN_PMC5);
198
199
189static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 200static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
190static SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1);
191static SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2);
192static SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3);
193static SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4);
194static SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5);
195static SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6);
196static SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7);
197static SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8);
198static SYSDEV_ATTR(purr, 0600, show_purr, NULL);
199static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); 201static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL);
200static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); 202static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr);
203static SYSDEV_ATTR(purr, 0600, show_purr, store_purr);
204
205static struct sysdev_attribute ibm_common_attrs[] = {
206 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
207 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
208};
209
210static struct sysdev_attribute ibm_pmc_attrs[] = {
211 _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1),
212 _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2),
213 _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3),
214 _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4),
215 _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5),
216 _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6),
217 _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7),
218 _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8),
219};
220
221static struct sysdev_attribute pa6t_attrs[] = {
222 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
223 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
224 _SYSDEV_ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0),
225 _SYSDEV_ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1),
226 _SYSDEV_ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2),
227 _SYSDEV_ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3),
228 _SYSDEV_ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4),
229 _SYSDEV_ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5),
230};
231
201 232
202static void register_cpu_online(unsigned int cpu) 233static void register_cpu_online(unsigned int cpu)
203{ 234{
204 struct cpu *c = &per_cpu(cpu_devices, cpu); 235 struct cpu *c = &per_cpu(cpu_devices, cpu);
205 struct sys_device *s = &c->sysdev; 236 struct sys_device *s = &c->sysdev;
237 struct sysdev_attribute *attrs, *pmc_attrs;
238 int i, nattrs;
206 239
207 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 240 if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
208 cpu_has_feature(CPU_FTR_SMT)) 241 cpu_has_feature(CPU_FTR_SMT))
209 sysdev_create_file(s, &attr_smt_snooze_delay); 242 sysdev_create_file(s, &attr_smt_snooze_delay);
210 243
211 /* PMC stuff */ 244 /* PMC stuff */
245 switch (cur_cpu_spec->pmc_type) {
246 case PPC_PMC_IBM:
247 attrs = ibm_common_attrs;
248 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute);
249 pmc_attrs = ibm_pmc_attrs;
250 break;
251 case PPC_PMC_PA6T:
252 /* PA Semi starts counting at PMC0 */
253 attrs = pa6t_attrs;
254 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute);
255 pmc_attrs = NULL;
256 break;
257 default:
258 attrs = NULL;
259 nattrs = 0;
260 pmc_attrs = NULL;
261 }
262
263 for (i = 0; i < nattrs; i++)
264 sysdev_create_file(s, &attrs[i]);
212 265
213 sysdev_create_file(s, &attr_mmcr0); 266 if (pmc_attrs)
214 sysdev_create_file(s, &attr_mmcr1); 267 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
268 sysdev_create_file(s, &pmc_attrs[i]);
215 269
216 if (cpu_has_feature(CPU_FTR_MMCRA)) 270 if (cpu_has_feature(CPU_FTR_MMCRA))
217 sysdev_create_file(s, &attr_mmcra); 271 sysdev_create_file(s, &attr_mmcra);
218 272
219 if (cur_cpu_spec->num_pmcs >= 1)
220 sysdev_create_file(s, &attr_pmc1);
221 if (cur_cpu_spec->num_pmcs >= 2)
222 sysdev_create_file(s, &attr_pmc2);
223 if (cur_cpu_spec->num_pmcs >= 3)
224 sysdev_create_file(s, &attr_pmc3);
225 if (cur_cpu_spec->num_pmcs >= 4)
226 sysdev_create_file(s, &attr_pmc4);
227 if (cur_cpu_spec->num_pmcs >= 5)
228 sysdev_create_file(s, &attr_pmc5);
229 if (cur_cpu_spec->num_pmcs >= 6)
230 sysdev_create_file(s, &attr_pmc6);
231 if (cur_cpu_spec->num_pmcs >= 7)
232 sysdev_create_file(s, &attr_pmc7);
233 if (cur_cpu_spec->num_pmcs >= 8)
234 sysdev_create_file(s, &attr_pmc8);
235
236 if (cpu_has_feature(CPU_FTR_PURR)) 273 if (cpu_has_feature(CPU_FTR_PURR))
237 sysdev_create_file(s, &attr_purr); 274 sysdev_create_file(s, &attr_purr);
238 275
@@ -248,6 +285,8 @@ static void unregister_cpu_online(unsigned int cpu)
248{ 285{
249 struct cpu *c = &per_cpu(cpu_devices, cpu); 286 struct cpu *c = &per_cpu(cpu_devices, cpu);
250 struct sys_device *s = &c->sysdev; 287 struct sys_device *s = &c->sysdev;
288 struct sysdev_attribute *attrs, *pmc_attrs;
289 int i, nattrs;
251 290
252 BUG_ON(!c->hotpluggable); 291 BUG_ON(!c->hotpluggable);
253 292
@@ -256,30 +295,34 @@ static void unregister_cpu_online(unsigned int cpu)
256 sysdev_remove_file(s, &attr_smt_snooze_delay); 295 sysdev_remove_file(s, &attr_smt_snooze_delay);
257 296
258 /* PMC stuff */ 297 /* PMC stuff */
298 switch (cur_cpu_spec->pmc_type) {
299 case PPC_PMC_IBM:
300 attrs = ibm_common_attrs;
301 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute);
302 pmc_attrs = ibm_pmc_attrs;
303 break;
304 case PPC_PMC_PA6T:
305 /* PA Semi starts counting at PMC0 */
306 attrs = pa6t_attrs;
307 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute);
308 pmc_attrs = NULL;
309 break;
310 default:
311 attrs = NULL;
312 nattrs = 0;
313 pmc_attrs = NULL;
314 }
259 315
260 sysdev_remove_file(s, &attr_mmcr0); 316 for (i = 0; i < nattrs; i++)
261 sysdev_remove_file(s, &attr_mmcr1); 317 sysdev_remove_file(s, &attrs[i]);
318
319 if (pmc_attrs)
320 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
321 sysdev_remove_file(s, &pmc_attrs[i]);
262 322
263 if (cpu_has_feature(CPU_FTR_MMCRA)) 323 if (cpu_has_feature(CPU_FTR_MMCRA))
264 sysdev_remove_file(s, &attr_mmcra); 324 sysdev_remove_file(s, &attr_mmcra);
265 325
266 if (cur_cpu_spec->num_pmcs >= 1)
267 sysdev_remove_file(s, &attr_pmc1);
268 if (cur_cpu_spec->num_pmcs >= 2)
269 sysdev_remove_file(s, &attr_pmc2);
270 if (cur_cpu_spec->num_pmcs >= 3)
271 sysdev_remove_file(s, &attr_pmc3);
272 if (cur_cpu_spec->num_pmcs >= 4)
273 sysdev_remove_file(s, &attr_pmc4);
274 if (cur_cpu_spec->num_pmcs >= 5)
275 sysdev_remove_file(s, &attr_pmc5);
276 if (cur_cpu_spec->num_pmcs >= 6)
277 sysdev_remove_file(s, &attr_pmc6);
278 if (cur_cpu_spec->num_pmcs >= 7)
279 sysdev_remove_file(s, &attr_pmc7);
280 if (cur_cpu_spec->num_pmcs >= 8)
281 sysdev_remove_file(s, &attr_pmc8);
282
283 if (cpu_has_feature(CPU_FTR_PURR)) 326 if (cpu_has_feature(CPU_FTR_PURR))
284 sysdev_remove_file(s, &attr_purr); 327 sysdev_remove_file(s, &attr_purr);
285 328
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 535f50665647..dcc6f159fd94 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -174,7 +174,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
174 * generate the same exception over and over again and we get 174 * generate the same exception over and over again and we get
175 * nowhere. Better to kill it and let the kernel panic. 175 * nowhere. Better to kill it and let the kernel panic.
176 */ 176 */
177 if (current->pid == 1) { 177 if (is_init(current)) {
178 __sighandler_t handler; 178 __sighandler_t handler;
179 179
180 spin_lock_irq(&current->sighand->siglock); 180 spin_lock_irq(&current->sighand->siglock);
@@ -535,34 +535,40 @@ static void emulate_single_step(struct pt_regs *regs)
535 } 535 }
536} 536}
537 537
538static void parse_fpe(struct pt_regs *regs) 538static inline int __parse_fpscr(unsigned long fpscr)
539{ 539{
540 int code = 0; 540 int ret = 0;
541 unsigned long fpscr;
542
543 flush_fp_to_thread(current);
544
545 fpscr = current->thread.fpscr.val;
546 541
547 /* Invalid operation */ 542 /* Invalid operation */
548 if ((fpscr & FPSCR_VE) && (fpscr & FPSCR_VX)) 543 if ((fpscr & FPSCR_VE) && (fpscr & FPSCR_VX))
549 code = FPE_FLTINV; 544 ret = FPE_FLTINV;
550 545
551 /* Overflow */ 546 /* Overflow */
552 else if ((fpscr & FPSCR_OE) && (fpscr & FPSCR_OX)) 547 else if ((fpscr & FPSCR_OE) && (fpscr & FPSCR_OX))
553 code = FPE_FLTOVF; 548 ret = FPE_FLTOVF;
554 549
555 /* Underflow */ 550 /* Underflow */
556 else if ((fpscr & FPSCR_UE) && (fpscr & FPSCR_UX)) 551 else if ((fpscr & FPSCR_UE) && (fpscr & FPSCR_UX))
557 code = FPE_FLTUND; 552 ret = FPE_FLTUND;
558 553
559 /* Divide by zero */ 554 /* Divide by zero */
560 else if ((fpscr & FPSCR_ZE) && (fpscr & FPSCR_ZX)) 555 else if ((fpscr & FPSCR_ZE) && (fpscr & FPSCR_ZX))
561 code = FPE_FLTDIV; 556 ret = FPE_FLTDIV;
562 557
563 /* Inexact result */ 558 /* Inexact result */
564 else if ((fpscr & FPSCR_XE) && (fpscr & FPSCR_XX)) 559 else if ((fpscr & FPSCR_XE) && (fpscr & FPSCR_XX))
565 code = FPE_FLTRES; 560 ret = FPE_FLTRES;
561
562 return ret;
563}
564
565static void parse_fpe(struct pt_regs *regs)
566{
567 int code = 0;
568
569 flush_fp_to_thread(current);
570
571 code = __parse_fpscr(current->thread.fpscr.val);
566 572
567 _exception(SIGFPE, regs, code, regs->nip); 573 _exception(SIGFPE, regs, code, regs->nip);
568} 574}
@@ -739,20 +745,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
739 extern int do_mathemu(struct pt_regs *regs); 745 extern int do_mathemu(struct pt_regs *regs);
740 746
741 /* We can now get here via a FP Unavailable exception if the core 747 /* We can now get here via a FP Unavailable exception if the core
742 * has no FPU, in that case no reason flags will be set */ 748 * has no FPU, in that case the reason flags will be 0 */
743#ifdef CONFIG_MATH_EMULATION
744 /* (reason & REASON_ILLEGAL) would be the obvious thing here,
745 * but there seems to be a hardware bug on the 405GP (RevD)
746 * that means ESR is sometimes set incorrectly - either to
747 * ESR_DST (!?) or 0. In the process of chasing this with the
748 * hardware people - not sure if it can happen on any illegal
749 * instruction or only on FP instructions, whether there is a
750 * pattern to occurences etc. -dgibson 31/Mar/2003 */
751 if (!(reason & REASON_TRAP) && do_mathemu(regs) == 0) {
752 emulate_single_step(regs);
753 return;
754 }
755#endif /* CONFIG_MATH_EMULATION */
756 749
757 if (reason & REASON_FP) { 750 if (reason & REASON_FP) {
758 /* IEEE FP exception */ 751 /* IEEE FP exception */
@@ -778,6 +771,31 @@ void __kprobes program_check_exception(struct pt_regs *regs)
778 771
779 local_irq_enable(); 772 local_irq_enable();
780 773
774#ifdef CONFIG_MATH_EMULATION
775 /* (reason & REASON_ILLEGAL) would be the obvious thing here,
776 * but there seems to be a hardware bug on the 405GP (RevD)
777 * that means ESR is sometimes set incorrectly - either to
778 * ESR_DST (!?) or 0. In the process of chasing this with the
779 * hardware people - not sure if it can happen on any illegal
780 * instruction or only on FP instructions, whether there is a
781 * pattern to occurences etc. -dgibson 31/Mar/2003 */
782 switch (do_mathemu(regs)) {
783 case 0:
784 emulate_single_step(regs);
785 return;
786 case 1: {
787 int code = 0;
788 code = __parse_fpscr(current->thread.fpscr.val);
789 _exception(SIGFPE, regs, code, regs->nip);
790 return;
791 }
792 case -EFAULT:
793 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
794 return;
795 }
796 /* fall through on any other errors */
797#endif /* CONFIG_MATH_EMULATION */
798
781 /* Try to emulate it if we should. */ 799 /* Try to emulate it if we should. */
782 if (reason & (REASON_ILLEGAL | REASON_PRIVILEGED)) { 800 if (reason & (REASON_ILLEGAL | REASON_PRIVILEGED)) {
783 switch (emulate_instruction(regs)) { 801 switch (emulate_instruction(regs)) {
@@ -891,18 +909,39 @@ void SoftwareEmulation(struct pt_regs *regs)
891 909
892#ifdef CONFIG_MATH_EMULATION 910#ifdef CONFIG_MATH_EMULATION
893 errcode = do_mathemu(regs); 911 errcode = do_mathemu(regs);
912
913 switch (errcode) {
914 case 0:
915 emulate_single_step(regs);
916 return;
917 case 1: {
918 int code = 0;
919 code = __parse_fpscr(current->thread.fpscr.val);
920 _exception(SIGFPE, regs, code, regs->nip);
921 return;
922 }
923 case -EFAULT:
924 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
925 return;
926 default:
927 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
928 return;
929 }
930
894#else 931#else
895 errcode = Soft_emulate_8xx(regs); 932 errcode = Soft_emulate_8xx(regs);
896#endif 933 switch (errcode) {
897 if (errcode) { 934 case 0:
898 if (errcode > 0)
899 _exception(SIGFPE, regs, 0, 0);
900 else if (errcode == -EFAULT)
901 _exception(SIGSEGV, regs, 0, 0);
902 else
903 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
904 } else
905 emulate_single_step(regs); 935 emulate_single_step(regs);
936 return;
937 case 1:
938 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
939 return;
940 case -EFAULT:
941 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
942 return;
943 }
944#endif
906} 945}
907#endif /* CONFIG_8xx */ 946#endif /* CONFIG_8xx */
908 947
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 5730906b23d5..8f5afdbad0d5 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -45,6 +45,10 @@ void __init udbg_early_init(void)
45#elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES) 45#elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES)
46 /* For iSeries - hit Ctrl-x Ctrl-x to see the output */ 46 /* For iSeries - hit Ctrl-x Ctrl-x to see the output */
47 udbg_init_iseries(); 47 udbg_init_iseries();
48#elif defined(CONFIG_PPC_EARLY_DEBUG_BEAT)
49 udbg_init_debug_beat();
50#elif defined(CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE)
51 udbg_init_pas_realmode();
48#endif 52#endif
49} 53}
50 54
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 2d17f2b8eda7..e738f93b42fe 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -14,6 +14,8 @@
14 14
15extern u8 real_readb(volatile u8 __iomem *addr); 15extern u8 real_readb(volatile u8 __iomem *addr);
16extern void real_writeb(u8 data, volatile u8 __iomem *addr); 16extern void real_writeb(u8 data, volatile u8 __iomem *addr);
17extern u8 real_205_readb(volatile u8 __iomem *addr);
18extern void real_205_writeb(u8 data, volatile u8 __iomem *addr);
17 19
18struct NS16550 { 20struct NS16550 {
19 /* this struct must be packed */ 21 /* this struct must be packed */
@@ -167,3 +169,25 @@ void __init udbg_init_maple_realmode(void)
167 udbg_getc_poll = NULL; 169 udbg_getc_poll = NULL;
168} 170}
169#endif /* CONFIG_PPC_MAPLE */ 171#endif /* CONFIG_PPC_MAPLE */
172
173#ifdef CONFIG_PPC_PASEMI
174void udbg_pas_real_putc(char c)
175{
176 if (udbg_comport) {
177 while ((real_205_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
178 /* wait for idle */;
179 real_205_writeb(c, &udbg_comport->thr); eieio();
180 if (c == '\n')
181 udbg_pas_real_putc('\r');
182 }
183}
184
185void udbg_init_pas_realmode(void)
186{
187 udbg_comport = (volatile struct NS16550 __iomem *)0xfcff03f8;
188
189 udbg_putc = udbg_pas_real_putc;
190 udbg_getc = NULL;
191 udbg_getc_poll = NULL;
192}
193#endif /* CONFIG_PPC_MAPLE */
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index ae0ede19879d..50149ec6efa4 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -49,9 +49,13 @@
49/* Max supported size for symbol names */ 49/* Max supported size for symbol names */
50#define MAX_SYMNAME 64 50#define MAX_SYMNAME 64
51 51
52#define VDSO32_MAXPAGES (((0x3000 + PAGE_MASK) >> PAGE_SHIFT) + 2)
53#define VDSO64_MAXPAGES (((0x3000 + PAGE_MASK) >> PAGE_SHIFT) + 2)
54
52extern char vdso32_start, vdso32_end; 55extern char vdso32_start, vdso32_end;
53static void *vdso32_kbase = &vdso32_start; 56static void *vdso32_kbase = &vdso32_start;
54unsigned int vdso32_pages; 57unsigned int vdso32_pages;
58static struct page *vdso32_pagelist[VDSO32_MAXPAGES];
55unsigned long vdso32_sigtramp; 59unsigned long vdso32_sigtramp;
56unsigned long vdso32_rt_sigtramp; 60unsigned long vdso32_rt_sigtramp;
57 61
@@ -59,6 +63,7 @@ unsigned long vdso32_rt_sigtramp;
59extern char vdso64_start, vdso64_end; 63extern char vdso64_start, vdso64_end;
60static void *vdso64_kbase = &vdso64_start; 64static void *vdso64_kbase = &vdso64_start;
61unsigned int vdso64_pages; 65unsigned int vdso64_pages;
66static struct page *vdso64_pagelist[VDSO64_MAXPAGES];
62unsigned long vdso64_rt_sigtramp; 67unsigned long vdso64_rt_sigtramp;
63#endif /* CONFIG_PPC64 */ 68#endif /* CONFIG_PPC64 */
64 69
@@ -165,55 +170,6 @@ static void dump_vdso_pages(struct vm_area_struct * vma)
165#endif /* DEBUG */ 170#endif /* DEBUG */
166 171
167/* 172/*
168 * Keep a dummy vma_close for now, it will prevent VMA merging.
169 */
170static void vdso_vma_close(struct vm_area_struct * vma)
171{
172}
173
174/*
175 * Our nopage() function, maps in the actual vDSO kernel pages, they will
176 * be mapped read-only by do_no_page(), and eventually COW'ed, either
177 * right away for an initial write access, or by do_wp_page().
178 */
179static struct page * vdso_vma_nopage(struct vm_area_struct * vma,
180 unsigned long address, int *type)
181{
182 unsigned long offset = address - vma->vm_start;
183 struct page *pg;
184#ifdef CONFIG_PPC64
185 void *vbase = (vma->vm_mm->task_size > TASK_SIZE_USER32) ?
186 vdso64_kbase : vdso32_kbase;
187#else
188 void *vbase = vdso32_kbase;
189#endif
190
191 DBG("vdso_vma_nopage(current: %s, address: %016lx, off: %lx)\n",
192 current->comm, address, offset);
193
194 if (address < vma->vm_start || address > vma->vm_end)
195 return NOPAGE_SIGBUS;
196
197 /*
198 * Last page is systemcfg.
199 */
200 if ((vma->vm_end - address) <= PAGE_SIZE)
201 pg = virt_to_page(vdso_data);
202 else
203 pg = virt_to_page(vbase + offset);
204
205 get_page(pg);
206 DBG(" ->page count: %d\n", page_count(pg));
207
208 return pg;
209}
210
211static struct vm_operations_struct vdso_vmops = {
212 .close = vdso_vma_close,
213 .nopage = vdso_vma_nopage,
214};
215
216/*
217 * This is called from binfmt_elf, we create the special vma for the 173 * This is called from binfmt_elf, we create the special vma for the
218 * vDSO and insert it into the mm struct tree 174 * vDSO and insert it into the mm struct tree
219 */ 175 */
@@ -221,20 +177,23 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
221 int executable_stack) 177 int executable_stack)
222{ 178{
223 struct mm_struct *mm = current->mm; 179 struct mm_struct *mm = current->mm;
224 struct vm_area_struct *vma; 180 struct page **vdso_pagelist;
225 unsigned long vdso_pages; 181 unsigned long vdso_pages;
226 unsigned long vdso_base; 182 unsigned long vdso_base;
227 int rc; 183 int rc;
228 184
229#ifdef CONFIG_PPC64 185#ifdef CONFIG_PPC64
230 if (test_thread_flag(TIF_32BIT)) { 186 if (test_thread_flag(TIF_32BIT)) {
187 vdso_pagelist = vdso32_pagelist;
231 vdso_pages = vdso32_pages; 188 vdso_pages = vdso32_pages;
232 vdso_base = VDSO32_MBASE; 189 vdso_base = VDSO32_MBASE;
233 } else { 190 } else {
191 vdso_pagelist = vdso64_pagelist;
234 vdso_pages = vdso64_pages; 192 vdso_pages = vdso64_pages;
235 vdso_base = VDSO64_MBASE; 193 vdso_base = VDSO64_MBASE;
236 } 194 }
237#else 195#else
196 vdso_pagelist = vdso32_pagelist;
238 vdso_pages = vdso32_pages; 197 vdso_pages = vdso32_pages;
239 vdso_base = VDSO32_MBASE; 198 vdso_base = VDSO32_MBASE;
240#endif 199#endif
@@ -262,17 +221,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
262 goto fail_mmapsem; 221 goto fail_mmapsem;
263 } 222 }
264 223
265
266 /* Allocate a VMA structure and fill it up */
267 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
268 if (vma == NULL) {
269 rc = -ENOMEM;
270 goto fail_mmapsem;
271 }
272 vma->vm_mm = mm;
273 vma->vm_start = vdso_base;
274 vma->vm_end = vma->vm_start + (vdso_pages << PAGE_SHIFT);
275
276 /* 224 /*
277 * our vma flags don't have VM_WRITE so by default, the process isn't 225 * our vma flags don't have VM_WRITE so by default, the process isn't
278 * allowed to write those pages. 226 * allowed to write those pages.
@@ -282,32 +230,26 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
282 * and your nice userland gettimeofday will be totally dead. 230 * and your nice userland gettimeofday will be totally dead.
283 * It's fine to use that for setting breakpoints in the vDSO code 231 * It's fine to use that for setting breakpoints in the vDSO code
284 * pages though 232 * pages though
285 */ 233 *
286 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC;
287 /*
288 * Make sure the vDSO gets into every core dump. 234 * Make sure the vDSO gets into every core dump.
289 * Dumping its contents makes post-mortem fully interpretable later 235 * Dumping its contents makes post-mortem fully interpretable later
290 * without matching up the same kernel and hardware config to see 236 * without matching up the same kernel and hardware config to see
291 * what PC values meant. 237 * what PC values meant.
292 */ 238 */
293 vma->vm_flags |= VM_ALWAYSDUMP; 239 rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
294 vma->vm_flags |= mm->def_flags; 240 VM_READ|VM_EXEC|
295 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7]; 241 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
296 vma->vm_ops = &vdso_vmops; 242 VM_ALWAYSDUMP,
297 243 vdso_pagelist);
298 /* Insert new VMA */
299 rc = insert_vm_struct(mm, vma);
300 if (rc) 244 if (rc)
301 goto fail_vma; 245 goto fail_mmapsem;
302 246
303 /* Put vDSO base into mm struct and account for memory usage */ 247 /* Put vDSO base into mm struct */
304 current->mm->context.vdso_base = vdso_base; 248 current->mm->context.vdso_base = vdso_base;
305 mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 249
306 up_write(&mm->mmap_sem); 250 up_write(&mm->mmap_sem);
307 return 0; 251 return 0;
308 252
309 fail_vma:
310 kmem_cache_free(vm_area_cachep, vma);
311 fail_mmapsem: 253 fail_mmapsem:
312 up_write(&mm->mmap_sem); 254 up_write(&mm->mmap_sem);
313 return rc; 255 return rc;
@@ -778,18 +720,26 @@ void __init vdso_init(void)
778 } 720 }
779 721
780 /* Make sure pages are in the correct state */ 722 /* Make sure pages are in the correct state */
723 BUG_ON(vdso32_pages + 2 > VDSO32_MAXPAGES);
781 for (i = 0; i < vdso32_pages; i++) { 724 for (i = 0; i < vdso32_pages; i++) {
782 struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE); 725 struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE);
783 ClearPageReserved(pg); 726 ClearPageReserved(pg);
784 get_page(pg); 727 get_page(pg);
785 728 vdso32_pagelist[i] = pg;
786 } 729 }
730 vdso32_pagelist[i++] = virt_to_page(vdso_data);
731 vdso32_pagelist[i] = NULL;
732
787#ifdef CONFIG_PPC64 733#ifdef CONFIG_PPC64
734 BUG_ON(vdso64_pages + 2 > VDSO64_MAXPAGES);
788 for (i = 0; i < vdso64_pages; i++) { 735 for (i = 0; i < vdso64_pages; i++) {
789 struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE); 736 struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE);
790 ClearPageReserved(pg); 737 ClearPageReserved(pg);
791 get_page(pg); 738 get_page(pg);
739 vdso64_pagelist[i] = pg;
792 } 740 }
741 vdso64_pagelist[i++] = virt_to_page(vdso_data);
742 vdso64_pagelist[i] = NULL;
793#endif /* CONFIG_PPC64 */ 743#endif /* CONFIG_PPC64 */
794 744
795 get_page(virt_to_page(vdso_data)); 745 get_page(virt_to_page(vdso_data));
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index a80f8f1d2e5d..2968ffeafdb6 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -199,10 +199,8 @@ EXPORT_SYMBOL(vio_unregister_driver);
199/* vio_dev refcount hit 0 */ 199/* vio_dev refcount hit 0 */
200static void __devinit vio_dev_release(struct device *dev) 200static void __devinit vio_dev_release(struct device *dev)
201{ 201{
202 if (dev->archdata.of_node) { 202 /* XXX should free TCE table */
203 /* XXX should free TCE table */ 203 of_node_put(dev->archdata.of_node);
204 of_node_put(dev->archdata.of_node);
205 }
206 kfree(to_vio_dev(dev)); 204 kfree(to_vio_dev(dev));
207} 205}
208 206
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index a0360ae10d0c..4b1ba49fbd9e 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -16,13 +16,15 @@ obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \
16 strcase.o 16 strcase.o
17obj-$(CONFIG_QUICC_ENGINE) += rheap.o 17obj-$(CONFIG_QUICC_ENGINE) += rheap.o
18obj-$(CONFIG_XMON) += sstep.o 18obj-$(CONFIG_XMON) += sstep.o
19obj-$(CONFIG_KPROBES) += sstep.o
20obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
19 21
20ifeq ($(CONFIG_PPC64),y) 22ifeq ($(CONFIG_PPC64),y)
21obj-$(CONFIG_SMP) += locks.o 23obj-$(CONFIG_SMP) += locks.o
22obj-$(CONFIG_DEBUG_KERNEL) += sstep.o
23endif 24endif
24 25
25# Temporary hack until we have migrated to asm-powerpc 26# Temporary hack until we have migrated to asm-powerpc
26ifeq ($(CONFIG_PPC_MERGE),y) 27ifeq ($(CONFIG_PPC_MERGE),y)
28obj-$(CONFIG_8xx) += rheap.o
27obj-$(CONFIG_CPM2) += rheap.o 29obj-$(CONFIG_CPM2) += rheap.o
28endif 30endif
diff --git a/arch/ppc/kernel/dma-mapping.c b/arch/powerpc/lib/dma-noncoherent.c
index 10fec7363962..48f3d13a3de5 100644
--- a/arch/ppc/kernel/dma-mapping.c
+++ b/arch/powerpc/lib/dma-noncoherent.c
@@ -22,37 +22,13 @@
22 * published by the Free Software Foundation. 22 * published by the Free Software Foundation.
23 */ 23 */
24 24
25#include <linux/module.h>
26#include <linux/signal.h>
27#include <linux/sched.h> 25#include <linux/sched.h>
28#include <linux/kernel.h> 26#include <linux/kernel.h>
29#include <linux/errno.h> 27#include <linux/errno.h>
30#include <linux/string.h> 28#include <linux/string.h>
31#include <linux/types.h> 29#include <linux/types.h>
32#include <linux/ptrace.h>
33#include <linux/mman.h>
34#include <linux/mm.h>
35#include <linux/swap.h>
36#include <linux/stddef.h>
37#include <linux/vmalloc.h>
38#include <linux/init.h>
39#include <linux/delay.h>
40#include <linux/bootmem.h>
41#include <linux/highmem.h> 30#include <linux/highmem.h>
42#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
43#include <linux/hardirq.h>
44
45#include <asm/pgalloc.h>
46#include <asm/prom.h>
47#include <asm/io.h>
48#include <asm/mmu_context.h>
49#include <asm/pgtable.h>
50#include <asm/mmu.h>
51#include <asm/uaccess.h>
52#include <asm/smp.h>
53#include <asm/machdep.h>
54
55int map_page(unsigned long va, phys_addr_t pa, int flags);
56 32
57#include <asm/tlbflush.h> 33#include <asm/tlbflush.h>
58 34
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index 57bf991ccd6e..6c5c5dd183ee 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -14,6 +14,7 @@
14 */ 14 */
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/kernel.h>
17#include <linux/mm.h> 18#include <linux/mm.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19 20
@@ -85,7 +86,8 @@ static int grow(rh_info_t * info, int max_blocks)
85 info->flags &= ~RHIF_STATIC_BLOCK; 86 info->flags &= ~RHIF_STATIC_BLOCK;
86 87
87 /* add all new blocks to the free list */ 88 /* add all new blocks to the free list */
88 for (i = 0, blk = block + info->max_blocks; i < new_blocks; i++, blk++) 89 blk = block + info->max_blocks - new_blocks;
90 for (i = 0; i < new_blocks; i++, blk++)
89 list_add(&blk->list, &info->empty_list); 91 list_add(&blk->list, &info->empty_list);
90 92
91 return 0; 93 return 0;
@@ -670,7 +672,7 @@ void rh_dump(rh_info_t * info)
670 int maxnr; 672 int maxnr;
671 int i, nr; 673 int i, nr;
672 674
673 maxnr = sizeof(st) / sizeof(st[0]); 675 maxnr = ARRAY_SIZE(st);
674 676
675 printk(KERN_INFO 677 printk(KERN_INFO
676 "info @0x%p (%d slots empty / %d max)\n", 678 "info @0x%p (%d slots empty / %d max)\n",
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 1bb20d841080..8c77c791f87e 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -1014,7 +1014,6 @@ repeat:
1014 1014
1015 /* Primary is full, try the secondary */ 1015 /* Primary is full, try the secondary */
1016 if (unlikely(slot == -1)) { 1016 if (unlikely(slot == -1)) {
1017 new_pte |= _PAGE_F_SECOND;
1018 hpte_group = ((~hash & htab_hash_mask) * 1017 hpte_group = ((~hash & htab_hash_mask) *
1019 HPTES_PER_GROUP) & ~0x7UL; 1018 HPTES_PER_GROUP) & ~0x7UL;
1020 slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 1019 slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags,
@@ -1033,7 +1032,7 @@ repeat:
1033 if (unlikely(slot == -2)) 1032 if (unlikely(slot == -2))
1034 panic("hash_huge_page: pte_insert failed\n"); 1033 panic("hash_huge_page: pte_insert failed\n");
1035 1034
1036 new_pte |= (slot << 12) & _PAGE_F_GIX; 1035 new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
1037 } 1036 }
1038 1037
1039 /* 1038 /*
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index d1c0758c5611..77b4637097e9 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -61,10 +61,6 @@ unsigned long memory_limit;
61extern void hash_preload(struct mm_struct *mm, unsigned long ea, 61extern void hash_preload(struct mm_struct *mm, unsigned long ea,
62 unsigned long access, unsigned long trap); 62 unsigned long access, unsigned long trap);
63 63
64/*
65 * This is called by /dev/mem to know if a given address has to
66 * be mapped non-cacheable or not
67 */
68int page_is_ram(unsigned long pfn) 64int page_is_ram(unsigned long pfn)
69{ 65{
70 unsigned long paddr = (pfn << PAGE_SHIFT); 66 unsigned long paddr = (pfn << PAGE_SHIFT);
@@ -490,19 +486,19 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
490 !cpu_has_feature(CPU_FTR_NOEXECUTE) && 486 !cpu_has_feature(CPU_FTR_NOEXECUTE) &&
491 pfn_valid(pfn)) { 487 pfn_valid(pfn)) {
492 struct page *page = pfn_to_page(pfn); 488 struct page *page = pfn_to_page(pfn);
489#ifdef CONFIG_8xx
490 /* On 8xx, cache control instructions (particularly
491 * "dcbst" from flush_dcache_icache) fault as write
492 * operation if there is an unpopulated TLB entry
493 * for the address in question. To workaround that,
494 * we invalidate the TLB here, thus avoiding dcbst
495 * misbehaviour.
496 */
497 _tlbie(address);
498#endif
493 if (!PageReserved(page) 499 if (!PageReserved(page)
494 && !test_bit(PG_arch_1, &page->flags)) { 500 && !test_bit(PG_arch_1, &page->flags)) {
495 if (vma->vm_mm == current->active_mm) { 501 if (vma->vm_mm == current->active_mm) {
496#ifdef CONFIG_8xx
497 /* On 8xx, cache control instructions (particularly
498 * "dcbst" from flush_dcache_icache) fault as write
499 * operation if there is an unpopulated TLB entry
500 * for the address in question. To workaround that,
501 * we invalidate the TLB here, thus avoiding dcbst
502 * misbehaviour.
503 */
504 _tlbie(address);
505#endif
506 __flush_dcache_icache((void *) address); 502 __flush_dcache_icache((void *) address);
507 } else 503 } else
508 flush_dcache_icache_page(page); 504 flush_dcache_icache_page(page);
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 1891dbeeb8e9..bd02272bcb0f 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -294,11 +294,8 @@ void __init mapin_ram(void)
294 } 294 }
295} 295}
296 296
297/* is x a power of 2? */
298#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
299
300/* is x a power of 4? */ 297/* is x a power of 4? */
301#define is_power_of_4(x) ((x) != 0 && (((x) & (x-1)) == 0) && (ffs(x) & 1)) 298#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1))
302 299
303/* 300/*
304 * Set up a mapping for a block of I/O. 301 * Set up a mapping for a block of I/O.
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index b6d82390b6a6..fbd62eacfdf4 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -149,6 +149,8 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
149#ifdef CONFIG_PPC64 149#ifdef CONFIG_PPC64
150#ifdef CONFIG_PPC_CELL_NATIVE 150#ifdef CONFIG_PPC_CELL_NATIVE
151 case PPC_OPROFILE_CELL: 151 case PPC_OPROFILE_CELL:
152 if (firmware_has_feature(FW_FEATURE_LPAR))
153 return -ENODEV;
152 model = &op_model_cell; 154 model = &op_model_cell;
153 break; 155 break;
154#endif 156#endif
diff --git a/arch/powerpc/oprofile/op_model_7450.c b/arch/powerpc/oprofile/op_model_7450.c
index f481c0ed5e67..5d1bbaf35ccb 100644
--- a/arch/powerpc/oprofile/op_model_7450.c
+++ b/arch/powerpc/oprofile/op_model_7450.c
@@ -137,9 +137,9 @@ static void fsl7450_start(struct op_counter_config *ctr)
137 137
138 for (i = 0; i < NUM_CTRS; ++i) { 138 for (i = 0; i < NUM_CTRS; ++i) {
139 if (ctr[i].enabled) 139 if (ctr[i].enabled)
140 ctr_write(i, reset_value[i]); 140 classic_ctr_write(i, reset_value[i]);
141 else 141 else
142 ctr_write(i, 0); 142 classic_ctr_write(i, 0);
143 } 143 }
144 144
145 /* Clear the freeze bit, and enable the interrupt. 145 /* Clear the freeze bit, and enable the interrupt.
@@ -179,13 +179,13 @@ static void fsl7450_handle_interrupt(struct pt_regs *regs,
179 is_kernel = is_kernel_addr(pc); 179 is_kernel = is_kernel_addr(pc);
180 180
181 for (i = 0; i < NUM_CTRS; ++i) { 181 for (i = 0; i < NUM_CTRS; ++i) {
182 val = ctr_read(i); 182 val = classic_ctr_read(i);
183 if (val < 0) { 183 if (val < 0) {
184 if (oprofile_running && ctr[i].enabled) { 184 if (oprofile_running && ctr[i].enabled) {
185 oprofile_add_ext_sample(pc, regs, i, is_kernel); 185 oprofile_add_ext_sample(pc, regs, i, is_kernel);
186 ctr_write(i, reset_value[i]); 186 classic_ctr_write(i, reset_value[i]);
187 } else { 187 } else {
188 ctr_write(i, 0); 188 classic_ctr_write(i, 0);
189 } 189 }
190 } 190 }
191 } 191 }
diff --git a/arch/powerpc/oprofile/op_model_fsl_booke.c b/arch/powerpc/oprofile/op_model_fsl_booke.c
index 0b3c31f5209e..2267eb8c661b 100644
--- a/arch/powerpc/oprofile/op_model_fsl_booke.c
+++ b/arch/powerpc/oprofile/op_model_fsl_booke.c
@@ -32,6 +32,87 @@ static unsigned long reset_value[OP_MAX_COUNTER];
32static int num_counters; 32static int num_counters;
33static int oprofile_running; 33static int oprofile_running;
34 34
35static inline u32 get_pmlca(int ctr)
36{
37 u32 pmlca;
38
39 switch (ctr) {
40 case 0:
41 pmlca = mfpmr(PMRN_PMLCA0);
42 break;
43 case 1:
44 pmlca = mfpmr(PMRN_PMLCA1);
45 break;
46 case 2:
47 pmlca = mfpmr(PMRN_PMLCA2);
48 break;
49 case 3:
50 pmlca = mfpmr(PMRN_PMLCA3);
51 break;
52 default:
53 panic("Bad ctr number\n");
54 }
55
56 return pmlca;
57}
58
59static inline void set_pmlca(int ctr, u32 pmlca)
60{
61 switch (ctr) {
62 case 0:
63 mtpmr(PMRN_PMLCA0, pmlca);
64 break;
65 case 1:
66 mtpmr(PMRN_PMLCA1, pmlca);
67 break;
68 case 2:
69 mtpmr(PMRN_PMLCA2, pmlca);
70 break;
71 case 3:
72 mtpmr(PMRN_PMLCA3, pmlca);
73 break;
74 default:
75 panic("Bad ctr number\n");
76 }
77}
78
79static inline unsigned int ctr_read(unsigned int i)
80{
81 switch(i) {
82 case 0:
83 return mfpmr(PMRN_PMC0);
84 case 1:
85 return mfpmr(PMRN_PMC1);
86 case 2:
87 return mfpmr(PMRN_PMC2);
88 case 3:
89 return mfpmr(PMRN_PMC3);
90 default:
91 return 0;
92 }
93}
94
95static inline void ctr_write(unsigned int i, unsigned int val)
96{
97 switch(i) {
98 case 0:
99 mtpmr(PMRN_PMC0, val);
100 break;
101 case 1:
102 mtpmr(PMRN_PMC1, val);
103 break;
104 case 2:
105 mtpmr(PMRN_PMC2, val);
106 break;
107 case 3:
108 mtpmr(PMRN_PMC3, val);
109 break;
110 default:
111 break;
112 }
113}
114
115
35static void init_pmc_stop(int ctr) 116static void init_pmc_stop(int ctr)
36{ 117{
37 u32 pmlca = (PMLCA_FC | PMLCA_FCS | PMLCA_FCU | 118 u32 pmlca = (PMLCA_FC | PMLCA_FCS | PMLCA_FCU |
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 356709d515b9..fe597a154d4f 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -121,9 +121,9 @@ static void power4_start(struct op_counter_config *ctr)
121 121
122 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) { 122 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
123 if (ctr[i].enabled) { 123 if (ctr[i].enabled) {
124 ctr_write(i, reset_value[i]); 124 classic_ctr_write(i, reset_value[i]);
125 } else { 125 } else {
126 ctr_write(i, 0); 126 classic_ctr_write(i, 0);
127 } 127 }
128 } 128 }
129 129
@@ -254,13 +254,13 @@ static void power4_handle_interrupt(struct pt_regs *regs,
254 mtmsrd(mfmsr() | MSR_PMM); 254 mtmsrd(mfmsr() | MSR_PMM);
255 255
256 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) { 256 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
257 val = ctr_read(i); 257 val = classic_ctr_read(i);
258 if (val < 0) { 258 if (val < 0) {
259 if (oprofile_running && ctr[i].enabled) { 259 if (oprofile_running && ctr[i].enabled) {
260 oprofile_add_ext_sample(pc, regs, i, is_kernel); 260 oprofile_add_ext_sample(pc, regs, i, is_kernel);
261 ctr_write(i, reset_value[i]); 261 classic_ctr_write(i, reset_value[i]);
262 } else { 262 } else {
263 ctr_write(i, 0); 263 classic_ctr_write(i, 0);
264 } 264 }
265 } 265 }
266 } 266 }
diff --git a/arch/powerpc/oprofile/op_model_rs64.c b/arch/powerpc/oprofile/op_model_rs64.c
index 19c5ee089bc9..c731acbfb2a5 100644
--- a/arch/powerpc/oprofile/op_model_rs64.c
+++ b/arch/powerpc/oprofile/op_model_rs64.c
@@ -137,10 +137,10 @@ static void rs64_start(struct op_counter_config *ctr)
137 137
138 for (i = 0; i < num_counters; ++i) { 138 for (i = 0; i < num_counters; ++i) {
139 if (ctr[i].enabled) { 139 if (ctr[i].enabled) {
140 ctr_write(i, reset_value[i]); 140 classic_ctr_write(i, reset_value[i]);
141 ctrl_write(i, ctr[i].event); 141 ctrl_write(i, ctr[i].event);
142 } else { 142 } else {
143 ctr_write(i, 0); 143 classic_ctr_write(i, 0);
144 } 144 }
145 } 145 }
146 146
@@ -186,13 +186,13 @@ static void rs64_handle_interrupt(struct pt_regs *regs,
186 mtmsrd(mfmsr() | MSR_PMM); 186 mtmsrd(mfmsr() | MSR_PMM);
187 187
188 for (i = 0; i < num_counters; ++i) { 188 for (i = 0; i < num_counters; ++i) {
189 val = ctr_read(i); 189 val = classic_ctr_read(i);
190 if (val < 0) { 190 if (val < 0) {
191 if (ctr[i].enabled) { 191 if (ctr[i].enabled) {
192 oprofile_add_ext_sample(pc, regs, i, is_kernel); 192 oprofile_add_ext_sample(pc, regs, i, is_kernel);
193 ctr_write(i, reset_value[i]); 193 classic_ctr_write(i, reset_value[i]);
194 } else { 194 } else {
195 ctr_write(i, 0); 195 classic_ctr_write(i, 0);
196 } 196 }
197 } 197 }
198 } 198 }
diff --git a/arch/powerpc/platforms/52xx/Makefile b/arch/powerpc/platforms/52xx/Makefile
index a46184a0c750..795b713ec9ee 100644
--- a/arch/powerpc/platforms/52xx/Makefile
+++ b/arch/powerpc/platforms/52xx/Makefile
@@ -3,6 +3,7 @@
3# 3#
4ifeq ($(CONFIG_PPC_MERGE),y) 4ifeq ($(CONFIG_PPC_MERGE),y)
5obj-y += mpc52xx_pic.o mpc52xx_common.o 5obj-y += mpc52xx_pic.o mpc52xx_common.o
6obj-$(CONFIG_PCI) += mpc52xx_pci.o
6endif 7endif
7 8
8obj-$(CONFIG_PPC_EFIKA) += efika-setup.o efika-pci.o 9obj-$(CONFIG_PPC_EFIKA) += efika-setup.o efika-pci.o
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 0f21bab33f6c..cdb16bfa6ca6 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -107,6 +107,12 @@ static void __init lite52xx_setup_arch(void)
107 mpc52xx_setup_cpu(); /* Generic */ 107 mpc52xx_setup_cpu(); /* Generic */
108 lite52xx_setup_cpu(); /* Platorm specific */ 108 lite52xx_setup_cpu(); /* Platorm specific */
109 109
110#ifdef CONFIG_PCI
111 np = of_find_node_by_type(np, "pci");
112 if (np)
113 mpc52xx_add_bridge(np);
114#endif
115
110#ifdef CONFIG_BLK_DEV_INITRD 116#ifdef CONFIG_BLK_DEV_INITRD
111 if (initrd_start) 117 if (initrd_start)
112 ROOT_DEV = Root_RAM0; 118 ROOT_DEV = Root_RAM0;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
new file mode 100644
index 000000000000..faf161bdbc1c
--- /dev/null
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -0,0 +1,412 @@
1/*
2 * PCI code for the Freescale MPC52xx embedded CPU.
3 *
4 * Copyright (C) 2006 Secret Lab Technologies Ltd.
5 * Grant Likely <grant.likely@secretlab.ca>
6 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
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#undef DEBUG
14
15#include <asm/pci.h>
16#include <asm/mpc52xx.h>
17#include <asm/delay.h>
18#include <asm/machdep.h>
19#include <linux/kernel.h>
20
21
22/* ======================================================================== */
23/* PCI windows config */
24/* ======================================================================== */
25
26#define MPC52xx_PCI_TARGET_IO 0xf0000000
27#define MPC52xx_PCI_TARGET_MEM 0x00000000
28
29
30/* ======================================================================== */
31/* Structures mapping & Defines for PCI Unit */
32/* ======================================================================== */
33
34#define MPC52xx_PCI_GSCR_BM 0x40000000
35#define MPC52xx_PCI_GSCR_PE 0x20000000
36#define MPC52xx_PCI_GSCR_SE 0x10000000
37#define MPC52xx_PCI_GSCR_XLB2PCI_MASK 0x07000000
38#define MPC52xx_PCI_GSCR_XLB2PCI_SHIFT 24
39#define MPC52xx_PCI_GSCR_IPG2PCI_MASK 0x00070000
40#define MPC52xx_PCI_GSCR_IPG2PCI_SHIFT 16
41#define MPC52xx_PCI_GSCR_BME 0x00004000
42#define MPC52xx_PCI_GSCR_PEE 0x00002000
43#define MPC52xx_PCI_GSCR_SEE 0x00001000
44#define MPC52xx_PCI_GSCR_PR 0x00000001
45
46
47#define MPC52xx_PCI_IWBTAR_TRANSLATION(proc_ad,pci_ad,size) \
48 ( ( (proc_ad) & 0xff000000 ) | \
49 ( (((size) - 1) >> 8) & 0x00ff0000 ) | \
50 ( ((pci_ad) >> 16) & 0x0000ff00 ) )
51
52#define MPC52xx_PCI_IWCR_PACK(win0,win1,win2) (((win0) << 24) | \
53 ((win1) << 16) | \
54 ((win2) << 8))
55
56#define MPC52xx_PCI_IWCR_DISABLE 0x0
57#define MPC52xx_PCI_IWCR_ENABLE 0x1
58#define MPC52xx_PCI_IWCR_READ 0x0
59#define MPC52xx_PCI_IWCR_READ_LINE 0x2
60#define MPC52xx_PCI_IWCR_READ_MULTI 0x4
61#define MPC52xx_PCI_IWCR_MEM 0x0
62#define MPC52xx_PCI_IWCR_IO 0x8
63
64#define MPC52xx_PCI_TCR_P 0x01000000
65#define MPC52xx_PCI_TCR_LD 0x00010000
66
67#define MPC52xx_PCI_TBATR_DISABLE 0x0
68#define MPC52xx_PCI_TBATR_ENABLE 0x1
69
70struct mpc52xx_pci {
71 u32 idr; /* PCI + 0x00 */
72 u32 scr; /* PCI + 0x04 */
73 u32 ccrir; /* PCI + 0x08 */
74 u32 cr1; /* PCI + 0x0C */
75 u32 bar0; /* PCI + 0x10 */
76 u32 bar1; /* PCI + 0x14 */
77 u8 reserved1[16]; /* PCI + 0x18 */
78 u32 ccpr; /* PCI + 0x28 */
79 u32 sid; /* PCI + 0x2C */
80 u32 erbar; /* PCI + 0x30 */
81 u32 cpr; /* PCI + 0x34 */
82 u8 reserved2[4]; /* PCI + 0x38 */
83 u32 cr2; /* PCI + 0x3C */
84 u8 reserved3[32]; /* PCI + 0x40 */
85 u32 gscr; /* PCI + 0x60 */
86 u32 tbatr0; /* PCI + 0x64 */
87 u32 tbatr1; /* PCI + 0x68 */
88 u32 tcr; /* PCI + 0x6C */
89 u32 iw0btar; /* PCI + 0x70 */
90 u32 iw1btar; /* PCI + 0x74 */
91 u32 iw2btar; /* PCI + 0x78 */
92 u8 reserved4[4]; /* PCI + 0x7C */
93 u32 iwcr; /* PCI + 0x80 */
94 u32 icr; /* PCI + 0x84 */
95 u32 isr; /* PCI + 0x88 */
96 u32 arb; /* PCI + 0x8C */
97 u8 reserved5[104]; /* PCI + 0x90 */
98 u32 car; /* PCI + 0xF8 */
99 u8 reserved6[4]; /* PCI + 0xFC */
100};
101
102
103/* ======================================================================== */
104/* PCI configuration acess */
105/* ======================================================================== */
106
107static int
108mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
109 int offset, int len, u32 *val)
110{
111 struct pci_controller *hose = bus->sysdata;
112 u32 value;
113
114 if (ppc_md.pci_exclude_device)
115 if (ppc_md.pci_exclude_device(bus->number, devfn))
116 return PCIBIOS_DEVICE_NOT_FOUND;
117
118 out_be32(hose->cfg_addr,
119 (1 << 31) |
120 ((bus->number - hose->bus_offset) << 16) |
121 (devfn << 8) |
122 (offset & 0xfc));
123 mb();
124
125#if defined(CONFIG_PPC_MPC5200_BUGFIX)
126 if (bus->number != hose->bus_offset) {
127 /* workaround for the bug 435 of the MPC5200 (L25R);
128 * Don't do 32 bits config access during type-1 cycles */
129 switch (len) {
130 case 1:
131 value = in_8(((u8 __iomem *)hose->cfg_data) +
132 (offset & 3));
133 break;
134 case 2:
135 value = in_le16(((u16 __iomem *)hose->cfg_data) +
136 ((offset>>1) & 1));
137 break;
138
139 default:
140 value = in_le16((u16 __iomem *)hose->cfg_data) |
141 (in_le16(((u16 __iomem *)hose->cfg_data) + 1) << 16);
142 break;
143 }
144 }
145 else
146#endif
147 {
148 value = in_le32(hose->cfg_data);
149
150 if (len != 4) {
151 value >>= ((offset & 0x3) << 3);
152 value &= 0xffffffff >> (32 - (len << 3));
153 }
154 }
155
156 *val = value;
157
158 out_be32(hose->cfg_addr, 0);
159 mb();
160
161 return PCIBIOS_SUCCESSFUL;
162}
163
164static int
165mpc52xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
166 int offset, int len, u32 val)
167{
168 struct pci_controller *hose = bus->sysdata;
169 u32 value, mask;
170
171 if (ppc_md.pci_exclude_device)
172 if (ppc_md.pci_exclude_device(bus->number, devfn))
173 return PCIBIOS_DEVICE_NOT_FOUND;
174
175 out_be32(hose->cfg_addr,
176 (1 << 31) |
177 ((bus->number - hose->bus_offset) << 16) |
178 (devfn << 8) |
179 (offset & 0xfc));
180 mb();
181
182#if defined(CONFIG_PPC_MPC5200_BUGFIX)
183 if (bus->number != hose->bus_offset) {
184 /* workaround for the bug 435 of the MPC5200 (L25R);
185 * Don't do 32 bits config access during type-1 cycles */
186 switch (len) {
187 case 1:
188 out_8(((u8 __iomem *)hose->cfg_data) +
189 (offset & 3), val);
190 break;
191 case 2:
192 out_le16(((u16 __iomem *)hose->cfg_data) +
193 ((offset>>1) & 1), val);
194 break;
195
196 default:
197 out_le16((u16 __iomem *)hose->cfg_data,
198 (u16)val);
199 out_le16(((u16 __iomem *)hose->cfg_data) + 1,
200 (u16)(val>>16));
201 break;
202 }
203 }
204 else
205#endif
206 {
207 if (len != 4) {
208 value = in_le32(hose->cfg_data);
209
210 offset = (offset & 0x3) << 3;
211 mask = (0xffffffff >> (32 - (len << 3)));
212 mask <<= offset;
213
214 value &= ~mask;
215 val = value | ((val << offset) & mask);
216 }
217
218 out_le32(hose->cfg_data, val);
219 }
220 mb();
221
222 out_be32(hose->cfg_addr, 0);
223 mb();
224
225 return PCIBIOS_SUCCESSFUL;
226}
227
228static struct pci_ops mpc52xx_pci_ops = {
229 .read = mpc52xx_pci_read_config,
230 .write = mpc52xx_pci_write_config
231};
232
233
234/* ======================================================================== */
235/* PCI setup */
236/* ======================================================================== */
237
238static void __init
239mpc52xx_pci_setup(struct pci_controller *hose,
240 struct mpc52xx_pci __iomem *pci_regs)
241{
242 struct resource *res;
243 u32 tmp;
244 int iwcr0 = 0, iwcr1 = 0, iwcr2 = 0;
245
246 pr_debug("mpc52xx_pci_setup(hose=%p, pci_regs=%p)\n", hose, pci_regs);
247
248 /* pci_process_bridge_OF_ranges() found all our addresses for us;
249 * now store them in the right places */
250 hose->cfg_addr = &pci_regs->car;
251 hose->cfg_data = hose->io_base_virt;
252
253 /* Control regs */
254 tmp = in_be32(&pci_regs->scr);
255 tmp |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
256 out_be32(&pci_regs->scr, tmp);
257
258 /* Memory windows */
259 res = &hose->mem_resources[0];
260 if (res->flags) {
261 pr_debug("mem_resource[0] = {.start=%x, .end=%x, .flags=%lx}\n",
262 res->start, res->end, res->flags);
263 out_be32(&pci_regs->iw0btar,
264 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
265 res->end - res->start + 1));
266 iwcr0 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM;
267 if (res->flags & IORESOURCE_PREFETCH)
268 iwcr0 |= MPC52xx_PCI_IWCR_READ_MULTI;
269 else
270 iwcr0 |= MPC52xx_PCI_IWCR_READ;
271 }
272
273 res = &hose->mem_resources[1];
274 if (res->flags) {
275 pr_debug("mem_resource[1] = {.start=%x, .end=%x, .flags=%lx}\n",
276 res->start, res->end, res->flags);
277 out_be32(&pci_regs->iw1btar,
278 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
279 res->end - res->start + 1));
280 iwcr1 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM;
281 if (res->flags & IORESOURCE_PREFETCH)
282 iwcr1 |= MPC52xx_PCI_IWCR_READ_MULTI;
283 else
284 iwcr1 |= MPC52xx_PCI_IWCR_READ;
285 }
286
287 /* IO resources */
288 res = &hose->io_resource;
289 if (!res) {
290 printk(KERN_ERR "%s: Didn't find IO resources\n", __FILE__);
291 return;
292 }
293 pr_debug(".io_resource={.start=%x,.end=%x,.flags=%lx} "
294 ".io_base_phys=0x%p\n",
295 res->start, res->end, res->flags, (void*)hose->io_base_phys);
296 out_be32(&pci_regs->iw2btar,
297 MPC52xx_PCI_IWBTAR_TRANSLATION(hose->io_base_phys,
298 res->start,
299 res->end - res->start + 1));
300 iwcr2 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_IO;
301
302 /* Set all the IWCR fields at once; they're in the same reg */
303 out_be32(&pci_regs->iwcr, MPC52xx_PCI_IWCR_PACK(iwcr0, iwcr1, iwcr2));
304
305 out_be32(&pci_regs->tbatr0,
306 MPC52xx_PCI_TBATR_ENABLE | MPC52xx_PCI_TARGET_IO );
307 out_be32(&pci_regs->tbatr1,
308 MPC52xx_PCI_TBATR_ENABLE | MPC52xx_PCI_TARGET_MEM );
309
310 out_be32(&pci_regs->tcr, MPC52xx_PCI_TCR_LD);
311
312 tmp = in_be32(&pci_regs->gscr);
313#if 0
314 /* Reset the exteral bus ( internal PCI controller is NOT resetted ) */
315 /* Not necessary and can be a bad thing if for example the bootloader
316 is displaying a splash screen or ... Just left here for
317 documentation purpose if anyone need it */
318 out_be32(&pci_regs->gscr, tmp | MPC52xx_PCI_GSCR_PR);
319 udelay(50);
320#endif
321
322 /* Make sure the PCI bridge is out of reset */
323 out_be32(&pci_regs->gscr, tmp & ~MPC52xx_PCI_GSCR_PR);
324}
325
326static void
327mpc52xx_pci_fixup_resources(struct pci_dev *dev)
328{
329 int i;
330
331 pr_debug("mpc52xx_pci_fixup_resources() %.4x:%.4x\n",
332 dev->vendor, dev->device);
333
334 /* We don't rely on boot loader for PCI and resets all
335 devices */
336 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
337 struct resource *res = &dev->resource[i];
338 if (res->end > res->start) { /* Only valid resources */
339 res->end -= res->start;
340 res->start = 0;
341 res->flags |= IORESOURCE_UNSET;
342 }
343 }
344
345 /* The PCI Host bridge of MPC52xx has a prefetch memory resource
346 fixed to 1Gb. Doesn't fit in the resource system so we remove it */
347 if ( (dev->vendor == PCI_VENDOR_ID_MOTOROLA) &&
348 ( dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200
349 || dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200B) ) {
350 struct resource *res = &dev->resource[1];
351 res->start = res->end = res->flags = 0;
352 }
353}
354
355int __init
356mpc52xx_add_bridge(struct device_node *node)
357{
358 int len;
359 struct mpc52xx_pci __iomem *pci_regs;
360 struct pci_controller *hose;
361 const int *bus_range;
362 struct resource rsrc;
363
364 pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name);
365
366 pci_assign_all_buses = 1;
367
368 if (of_address_to_resource(node, 0, &rsrc) != 0) {
369 printk(KERN_ERR "Can't get %s resources\n", node->full_name);
370 return -EINVAL;
371 }
372
373 bus_range = get_property(node, "bus-range", &len);
374 if (bus_range == NULL || len < 2 * sizeof(int)) {
375 printk(KERN_WARNING "Can't get %s bus-range, assume bus 0\n",
376 node->full_name);
377 bus_range = NULL;
378 }
379
380 /* There are some PCI quirks on the 52xx, register the hook to
381 * fix them. */
382 ppc_md.pcibios_fixup_resources = mpc52xx_pci_fixup_resources;
383
384 /* Alloc and initialize the pci controller. Values in the device
385 * tree are needed to configure the 52xx PCI controller. Rather
386 * than parse the tree here, let pci_process_bridge_OF_ranges()
387 * do it for us and extract the values after the fact */
388 hose = pcibios_alloc_controller();
389 if (!hose)
390 return -ENOMEM;
391
392 hose->arch_data = node;
393 hose->set_cfg_type = 1;
394
395 hose->first_busno = bus_range ? bus_range[0] : 0;
396 hose->last_busno = bus_range ? bus_range[1] : 0xff;
397
398 hose->bus_offset = 0;
399 hose->ops = &mpc52xx_pci_ops;
400
401 pci_regs = ioremap(rsrc.start, rsrc.end - rsrc.start + 1);
402 if (!pci_regs)
403 return -ENOMEM;
404
405 pci_process_bridge_OF_ranges(hose, node, 1);
406
407 /* Finish setting up PCI using values obtained by
408 * pci_proces_bridge_OF_ranges */
409 mpc52xx_pci_setup(hose, pci_regs);
410
411 return 0;
412}
diff --git a/arch/powerpc/platforms/82xx/mpc82xx.c b/arch/powerpc/platforms/82xx/mpc82xx.c
index 0f5b30dc60da..74e7892cdfcf 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx.c
@@ -50,7 +50,7 @@
50#include <sysdev/fsl_soc.h> 50#include <sysdev/fsl_soc.h>
51#include <sysdev/cpm2_pic.h> 51#include <sysdev/cpm2_pic.h>
52 52
53#include "pq2ads_pd.h" 53#include "pq2ads.h"
54 54
55static int __init get_freq(char *name, unsigned long *val) 55static int __init get_freq(char *name, unsigned long *val)
56{ 56{
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
index ea880f1f0dcd..7334c1a15b90 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
@@ -51,7 +51,7 @@
51#include <sysdev/fsl_soc.h> 51#include <sysdev/fsl_soc.h>
52#include <../sysdev/cpm2_pic.h> 52#include <../sysdev/cpm2_pic.h>
53 53
54#include "pq2ads_pd.h" 54#include "pq2ads.h"
55 55
56#ifdef CONFIG_PCI 56#ifdef CONFIG_PCI
57static uint pci_clk_frq; 57static uint pci_clk_frq;
diff --git a/arch/powerpc/platforms/82xx/pq2ads.h b/arch/powerpc/platforms/82xx/pq2ads.h
index fb2f92bcd770..5b5cca6c8c88 100644
--- a/arch/powerpc/platforms/82xx/pq2ads.h
+++ b/arch/powerpc/platforms/82xx/pq2ads.h
@@ -22,6 +22,7 @@
22#ifndef __MACH_ADS8260_DEFS 22#ifndef __MACH_ADS8260_DEFS
23#define __MACH_ADS8260_DEFS 23#define __MACH_ADS8260_DEFS
24 24
25#include <linux/seq_file.h>
25#include <asm/ppcboot.h> 26#include <asm/ppcboot.h>
26 27
27/* For our show_cpuinfo hooks. */ 28/* For our show_cpuinfo hooks. */
@@ -46,12 +47,12 @@
46#define BCSR1_RS232_EN1 ((uint)0x02000000) /* 0 ==enable */ 47#define BCSR1_RS232_EN1 ((uint)0x02000000) /* 0 ==enable */
47#define BCSR1_RS232_EN2 ((uint)0x01000000) /* 0 ==enable */ 48#define BCSR1_RS232_EN2 ((uint)0x01000000) /* 0 ==enable */
48#define BCSR3_FETHIEN2 ((uint)0x10000000) /* 0 == enable*/ 49#define BCSR3_FETHIEN2 ((uint)0x10000000) /* 0 == enable*/
49#define BCSR3_FETH2_RS ((uint)0x80000000) /* 0 == reset */ 50#define BCSR3_FETH2_RST ((uint)0x80000000) /* 0 == reset */
50 51
51/* cpm serial driver works with constants below */ 52/* cpm serial driver works with constants below */
52 53
53#define SIU_INT_SMC1 ((uint)0x04+CPM_IRQ_OFFSET) 54#define SIU_INT_SMC1 ((uint)0x04+CPM_IRQ_OFFSET)
54#define SIU_INT_SMC2i ((uint)0x05+CPM_IRQ_OFFSET) 55#define SIU_INT_SMC2 ((uint)0x05+CPM_IRQ_OFFSET)
55#define SIU_INT_SCC1 ((uint)0x28+CPM_IRQ_OFFSET) 56#define SIU_INT_SCC1 ((uint)0x28+CPM_IRQ_OFFSET)
56#define SIU_INT_SCC2 ((uint)0x29+CPM_IRQ_OFFSET) 57#define SIU_INT_SCC2 ((uint)0x29+CPM_IRQ_OFFSET)
57#define SIU_INT_SCC3 ((uint)0x2a+CPM_IRQ_OFFSET) 58#define SIU_INT_SCC3 ((uint)0x2a+CPM_IRQ_OFFSET)
diff --git a/arch/powerpc/platforms/83xx/misc.c b/arch/powerpc/platforms/83xx/misc.c
index f0c6df61faa9..f01806c940e1 100644
--- a/arch/powerpc/platforms/83xx/misc.c
+++ b/arch/powerpc/platforms/83xx/misc.c
@@ -18,23 +18,36 @@
18 18
19#include "mpc83xx.h" 19#include "mpc83xx.h"
20 20
21static __be32 __iomem *restart_reg_base;
22
23static int __init mpc83xx_restart_init(void)
24{
25 /* map reset restart_reg_baseister space */
26 restart_reg_base = ioremap(get_immrbase() + 0x900, 0xff);
27
28 return 0;
29}
30
31arch_initcall(mpc83xx_restart_init);
32
21void mpc83xx_restart(char *cmd) 33void mpc83xx_restart(char *cmd)
22{ 34{
23#define RST_OFFSET 0x00000900 35#define RST_OFFSET 0x00000900
24#define RST_PROT_REG 0x00000018 36#define RST_PROT_REG 0x00000018
25#define RST_CTRL_REG 0x0000001c 37#define RST_CTRL_REG 0x0000001c
26 __be32 __iomem *reg;
27
28 /* map reset register space */
29 reg = ioremap(get_immrbase() + 0x900, 0xff);
30 38
31 local_irq_disable(); 39 local_irq_disable();
32 40
33 /* enable software reset "RSTE" */ 41 if (restart_reg_base) {
34 out_be32(reg + (RST_PROT_REG >> 2), 0x52535445); 42 /* enable software reset "RSTE" */
43 out_be32(restart_reg_base + (RST_PROT_REG >> 2), 0x52535445);
44
45 /* set software hard reset */
46 out_be32(restart_reg_base + (RST_CTRL_REG >> 2), 0x2);
47 } else {
48 printk (KERN_EMERG "Error: Restart registers not mapped, spinning!\n");
49 }
35 50
36 /* set software hard reset */
37 out_be32(reg + (RST_CTRL_REG >> 2), 0x2);
38 for (;;) ; 51 for (;;) ;
39} 52}
40 53
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 4d471190be8d..3ecb55f8a6e2 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -25,6 +25,7 @@
25#include <linux/initrd.h> 25#include <linux/initrd.h>
26 26
27#include <asm/of_device.h> 27#include <asm/of_device.h>
28#include <asm/of_platform.h>
28#include <asm/system.h> 29#include <asm/system.h>
29#include <asm/atomic.h> 30#include <asm/atomic.h>
30#include <asm/time.h> 31#include <asm/time.h>
@@ -153,7 +154,7 @@ static int __init mpc832x_declare_of_platform_devices(void)
153} 154}
154device_initcall(mpc832x_declare_of_platform_devices); 155device_initcall(mpc832x_declare_of_platform_devices);
155 156
156void __init mpc832x_sys_init_IRQ(void) 157static void __init mpc832x_sys_init_IRQ(void)
157{ 158{
158 159
159 struct device_node *np; 160 struct device_node *np;
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 314c42ac6048..2446dea9407e 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -81,7 +81,7 @@ static void __init mpc834x_itx_setup_arch(void)
81#endif 81#endif
82} 82}
83 83
84void __init mpc834x_itx_init_IRQ(void) 84static void __init mpc834x_itx_init_IRQ(void)
85{ 85{
86 struct device_node *np; 86 struct device_node *np;
87 87
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
index 80b735a414d9..f30393f0b832 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -79,7 +79,7 @@ static void __init mpc834x_sys_setup_arch(void)
79#endif 79#endif
80} 80}
81 81
82void __init mpc834x_sys_init_IRQ(void) 82static void __init mpc834x_sys_init_IRQ(void)
83{ 83{
84 struct device_node *np; 84 struct device_node *np;
85 85
diff --git a/arch/powerpc/platforms/83xx/mpc8360e_pb.c b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
index 53b92a904e8e..ccce2f9f283d 100644
--- a/arch/powerpc/platforms/83xx/mpc8360e_pb.c
+++ b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
@@ -31,6 +31,7 @@
31#include <linux/initrd.h> 31#include <linux/initrd.h>
32 32
33#include <asm/of_device.h> 33#include <asm/of_device.h>
34#include <asm/of_platform.h>
34#include <asm/system.h> 35#include <asm/system.h>
35#include <asm/atomic.h> 36#include <asm/atomic.h>
36#include <asm/time.h> 37#include <asm/time.h>
@@ -158,7 +159,7 @@ static int __init mpc8360_declare_of_platform_devices(void)
158} 159}
159device_initcall(mpc8360_declare_of_platform_devices); 160device_initcall(mpc8360_declare_of_platform_devices);
160 161
161void __init mpc8360_sys_init_IRQ(void) 162static void __init mpc8360_sys_init_IRQ(void)
162{ 163{
163 164
164 struct device_node *np; 165 struct device_node *np;
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index d1ecc0f9ab58..0c70944d0e37 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -8,6 +8,7 @@ choice
8config MPC8641_HPCN 8config MPC8641_HPCN
9 bool "Freescale MPC8641 HPCN" 9 bool "Freescale MPC8641 HPCN"
10 select PPC_I8259 10 select PPC_I8259
11 select DEFAULT_UIMAGE
11 help 12 help
12 This option enables support for the MPC8641 HPCN board. 13 This option enables support for the MPC8641 HPCN board.
13 14
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
index bb7fb41933ad..7ef0c6854799 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
@@ -65,7 +65,6 @@ smp_86xx_kick_cpu(int nr)
65 pr_debug("smp_86xx_kick_cpu: kick CPU #%d\n", nr); 65 pr_debug("smp_86xx_kick_cpu: kick CPU #%d\n", nr);
66 66
67 local_irq_save(flags); 67 local_irq_save(flags);
68 local_irq_disable();
69 68
70 /* Save reset vector */ 69 /* Save reset vector */
71 save_vector = *vector; 70 save_vector = *vector;
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index c8c0ba3cf8e8..beea6834bb7e 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -1,105 +1,16 @@
1menu "Platform support"
2 depends on PPC_8xx
3
1config FADS 4config FADS
2 bool 5 bool
3 6
7config CPM1
8 bool
9
4choice 10choice
5 prompt "8xx Machine Type" 11 prompt "8xx Machine Type"
6 depends on 8xx 12 depends on 8xx
7 default RPXLITE 13 default MPC885ADS
8
9config RPXLITE
10 bool "RPX-Lite"
11 ---help---
12 Single-board computers based around the PowerPC MPC8xx chips and
13 intended for embedded applications. The following types are
14 supported:
15
16 RPX-Lite:
17 Embedded Planet RPX Lite. PC104 form-factor SBC based on the MPC823.
18
19 RPX-Classic:
20 Embedded Planet RPX Classic Low-fat. Credit-card-size SBC based on
21 the MPC 860
22
23 BSE-IP:
24 Bright Star Engineering ip-Engine.
25
26 TQM823L:
27 TQM850L:
28 TQM855L:
29 TQM860L:
30 MPC8xx based family of mini modules, half credit card size,
31 up to 64 MB of RAM, 8 MB Flash, (Fast) Ethernet, 2 x serial ports,
32 2 x CAN bus interface, ...
33 Manufacturer: TQ Components, www.tq-group.de
34 Date of Release: October (?) 1999
35 End of Life: not yet :-)
36 URL:
37 - module: <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>
38 - starter kit: <http://www.denx.de/PDF/STK8xxLHWM201.pdf>
39 - images: <http://www.denx.de/embedded-ppc-en.html>
40
41 FPS850L:
42 FingerPrint Sensor System (based on TQM850L)
43 Manufacturer: IKENDI AG, <http://www.ikendi.com/>
44 Date of Release: November 1999
45 End of life: end 2000 ?
46 URL: see TQM850L
47
48 IVMS8:
49 MPC860 based board used in the "Integrated Voice Mail System",
50 Small Version (8 voice channels)
51 Manufacturer: Speech Design, <http://www.speech-design.de/>
52 Date of Release: December 2000 (?)
53 End of life: -
54 URL: <http://www.speech-design.de/>
55
56 IVML24:
57 MPC860 based board used in the "Integrated Voice Mail System",
58 Large Version (24 voice channels)
59 Manufacturer: Speech Design, <http://www.speech-design.de/>
60 Date of Release: March 2001 (?)
61 End of life: -
62 URL: <http://www.speech-design.de/>
63
64 HERMES:
65 Hermes-Pro ISDN/LAN router with integrated 8 x hub
66 Manufacturer: Multidata Gesellschaft fur Datentechnik und Informatik
67 <http://www.multidata.de/>
68 Date of Release: 2000 (?)
69 End of life: -
70 URL: <http://www.multidata.de/english/products/hpro.htm>
71
72 IP860:
73 VMEBus IP (Industry Pack) carrier board with MPC860
74 Manufacturer: MicroSys GmbH, <http://www.microsys.de/>
75 Date of Release: ?
76 End of life: -
77 URL: <http://www.microsys.de/html/ip860.html>
78
79 PCU_E:
80 PCU = Peripheral Controller Unit, Extended
81 Manufacturer: Siemens AG, ICN (Information and Communication Networks)
82 <http://www.siemens.de/page/1,3771,224315-1-999_2_226207-0,00.html>
83 Date of Release: April 2001
84 End of life: August 2001
85 URL: n. a.
86
87config RPXCLASSIC
88 bool "RPX-Classic"
89 help
90 The RPX-Classic is a single-board computer based on the Motorola
91 MPC860. It features 16MB of DRAM and a variable amount of flash,
92 I2C EEPROM, thermal monitoring, a PCMCIA slot, a DIP switch and two
93 LEDs. Variants with Ethernet ports exist. Say Y here to support it
94 directly.
95
96config BSEIP
97 bool "BSE-IP"
98 help
99 Say Y here to support the Bright Star Engineering ipEngine SBC.
100 This is a credit-card-sized device featuring a MPC823 processor,
101 26MB DRAM, 4MB flash, Ethernet, a 16K-gate FPGA, USB, an LCD/video
102 controller, and two RS232 ports.
103 14
104config MPC8XXFADS 15config MPC8XXFADS
105 bool "FADS" 16 bool "FADS"
@@ -107,110 +18,58 @@ config MPC8XXFADS
107 18
108config MPC86XADS 19config MPC86XADS
109 bool "MPC86XADS" 20 bool "MPC86XADS"
21 select CPM1
110 help 22 help
111 MPC86x Application Development System by Freescale Semiconductor. 23 MPC86x Application Development System by Freescale Semiconductor.
112 The MPC86xADS is meant to serve as a platform for s/w and h/w 24 The MPC86xADS is meant to serve as a platform for s/w and h/w
113 development around the MPC86X processor families. 25 development around the MPC86X processor families.
114 select FADS
115 26
116config MPC885ADS 27config MPC885ADS
117 bool "MPC885ADS" 28 bool "MPC885ADS"
29 select CPM1
118 help 30 help
119 Freescale Semiconductor MPC885 Application Development System (ADS). 31 Freescale Semiconductor MPC885 Application Development System (ADS).
120 Also known as DUET. 32 Also known as DUET.
121 The MPC885ADS is meant to serve as a platform for s/w and h/w 33 The MPC885ADS is meant to serve as a platform for s/w and h/w
122 development around the MPC885 processor family. 34 development around the MPC885 processor family.
123 35
124config TQM823L 36endchoice
125 bool "TQM823L"
126 help
127 Say Y here to support the TQM823L, one of an MPC8xx-based family of
128 mini SBCs (half credit-card size) from TQ Components first released
129 in late 1999. Technical references are at
130 <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>, and
131 <http://www.denx.de/PDF/STK8xxLHWM201.pdf>, and an image at
132 <http://www.denx.de/embedded-ppc-en.html>.
133
134config TQM850L
135 bool "TQM850L"
136 help
137 Say Y here to support the TQM850L, one of an MPC8xx-based family of
138 mini SBCs (half credit-card size) from TQ Components first released
139 in late 1999. Technical references are at
140 <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>, and
141 <http://www.denx.de/PDF/STK8xxLHWM201.pdf>, and an image at
142 <http://www.denx.de/embedded-ppc-en.html>.
143
144config TQM855L
145 bool "TQM855L"
146 help
147 Say Y here to support the TQM855L, one of an MPC8xx-based family of
148 mini SBCs (half credit-card size) from TQ Components first released
149 in late 1999. Technical references are at
150 <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>, and
151 <http://www.denx.de/PDF/STK8xxLHWM201.pdf>, and an image at
152 <http://www.denx.de/embedded-ppc-en.html>.
153
154config TQM860L
155 bool "TQM860L"
156 help
157 Say Y here to support the TQM860L, one of an MPC8xx-based family of
158 mini SBCs (half credit-card size) from TQ Components first released
159 in late 1999. Technical references are at
160 <http://www.denx.de/PDF/TQM8xxLHWM201.pdf>, and
161 <http://www.denx.de/PDF/STK8xxLHWM201.pdf>, and an image at
162 <http://www.denx.de/embedded-ppc-en.html>.
163
164config FPS850L
165 bool "FPS850L"
166
167config IVMS8
168 bool "IVMS8"
169 help
170 Say Y here to support the Integrated Voice-Mail Small 8-channel SBC
171 from Speech Design, released March 2001. The manufacturer's website
172 is at <http://www.speech-design.de/>.
173
174config IVML24
175 bool "IVML24"
176 help
177 Say Y here to support the Integrated Voice-Mail Large 24-channel SBC
178 from Speech Design, released March 2001. The manufacturer's website
179 is at <http://www.speech-design.de/>.
180
181config HERMES_PRO
182 bool "HERMES"
183
184config IP860
185 bool "IP860"
186
187config LWMON
188 bool "LWMON"
189
190config PCU_E
191 bool "PCU_E"
192
193config CCM
194 bool "CCM"
195
196config LANTEC
197 bool "LANTEC"
198 37
199config MBX 38menu "Freescale Ethernet driver platform-specific options"
200 bool "MBX" 39 depends on (FS_ENET && MPC885ADS)
201 help 40
202 MBX is a line of Motorola single-board computer based around the 41 config MPC8xx_SECOND_ETH
203 MPC821 and MPC860 processors, and intended for embedded-controller 42 bool "Second Ethernet channel"
204 applications. Say Y here to support these boards directly. 43 depends on MPC885ADS
44 default y
45 help
46 This enables support for second Ethernet on MPC885ADS and MPC86xADS boards.
47 The latter will use SCC1, for 885ADS you can select it below.
48
49 choice
50 prompt "Second Ethernet channel"
51 depends on MPC8xx_SECOND_ETH
52 default MPC8xx_SECOND_ETH_FEC2
53
54 config MPC8xx_SECOND_ETH_FEC2
55 bool "FEC2"
56 depends on MPC885ADS
57 help
58 Enable FEC2 to serve as 2-nd Ethernet channel. Note that SMC2
59 (often 2-nd UART) will not work if this is enabled.
60
61 config MPC8xx_SECOND_ETH_SCC3
62 bool "SCC3"
63 depends on MPC885ADS
64 help
65 Enable SCC3 to serve as 2-nd Ethernet channel. Note that SMC1
66 (often 1-nd UART) will not work if this is enabled.
67
68 endchoice
205 69
206config WINCEPT 70endmenu
207 bool "WinCept"
208 help
209 The Wincept 100/110 is a Motorola single-board computer based on the
210 MPC821 PowerPC, introduced in 1998 and designed to be used in
211 thin-client machines. Say Y to support it directly.
212 71
213endchoice 72endmenu
214 73
215# 74#
216# MPC8xx Communication options 75# MPC8xx Communication options
@@ -219,79 +78,6 @@ endchoice
219menu "MPC8xx CPM Options" 78menu "MPC8xx CPM Options"
220 depends on 8xx 79 depends on 8xx
221 80
222config SCC_ENET
223 bool "CPM SCC Ethernet"
224 depends on NET_ETHERNET
225 help
226 Enable Ethernet support via the Motorola MPC8xx serial
227 communications controller.
228
229choice
230 prompt "SCC used for Ethernet"
231 depends on SCC_ENET
232 default SCC1_ENET
233
234config SCC1_ENET
235 bool "SCC1"
236 help
237 Use MPC8xx serial communications controller 1 to drive Ethernet
238 (default).
239
240config SCC2_ENET
241 bool "SCC2"
242 help
243 Use MPC8xx serial communications controller 2 to drive Ethernet.
244
245config SCC3_ENET
246 bool "SCC3"
247 help
248 Use MPC8xx serial communications controller 3 to drive Ethernet.
249
250endchoice
251
252config FEC_ENET
253 bool "860T FEC Ethernet"
254 depends on NET_ETHERNET
255 help
256 Enable Ethernet support via the Fast Ethernet Controller (FCC) on
257 the Motorola MPC8260.
258
259config USE_MDIO
260 bool "Use MDIO for PHY configuration"
261 depends on FEC_ENET
262 help
263 On some boards the hardware configuration of the ethernet PHY can be
264 used without any software interaction over the MDIO interface, so
265 all MII code can be omitted. Say N here if unsure or if you don't
266 need link status reports.
267
268config FEC_AM79C874
269 bool "Support AMD79C874 PHY"
270 depends on USE_MDIO
271
272config FEC_LXT970
273 bool "Support LXT970 PHY"
274 depends on USE_MDIO
275
276config FEC_LXT971
277 bool "Support LXT971 PHY"
278 depends on USE_MDIO
279
280config FEC_QS6612
281 bool "Support QS6612 PHY"
282 depends on USE_MDIO
283
284config ENET_BIG_BUFFERS
285 bool "Use Big CPM Ethernet Buffers"
286 depends on SCC_ENET || FEC_ENET
287 help
288 Allocate large buffers for MPC8xx Ethernet. Increases throughput
289 and decreases the likelihood of dropped packets, but costs memory.
290
291config HTDMSOUND
292 bool "Embedded Planet HIOX Audio"
293 depends on SOUND=y
294
295# This doesn't really belong here, but it is convenient to ask 81# This doesn't really belong here, but it is convenient to ask
296# 8xx specific questions. 82# 8xx specific questions.
297comment "Generic MPC8xx Options" 83comment "Generic MPC8xx Options"
diff --git a/arch/powerpc/platforms/8xx/Makefile b/arch/powerpc/platforms/8xx/Makefile
new file mode 100644
index 000000000000..5e2dae3afd2f
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for the PowerPC 8xx linux kernel.
3#
4obj-$(CONFIG_PPC_8xx) += m8xx_setup.o
5obj-$(CONFIG_MPC885ADS) += mpc885ads_setup.o
6obj-$(CONFIG_MPC86XADS) += mpc86xads_setup.o
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c
new file mode 100644
index 000000000000..9ed7125f0150
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -0,0 +1,303 @@
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 * Adapted from 'alpha' version by Gary Thomas
4 * Modified by Cort Dougan (cort@cs.nmt.edu)
5 * Modified for MBX using prep/chrp/pmac functions by Dan (dmalek@jlc.net)
6 * Further modified for generic 8xx by Dan.
7 */
8
9/*
10 * bootup setup stuff..
11 */
12
13#include <linux/errno.h>
14#include <linux/sched.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17#include <linux/stddef.h>
18#include <linux/unistd.h>
19#include <linux/ptrace.h>
20#include <linux/slab.h>
21#include <linux/user.h>
22#include <linux/a.out.h>
23#include <linux/tty.h>
24#include <linux/major.h>
25#include <linux/interrupt.h>
26#include <linux/reboot.h>
27#include <linux/init.h>
28#include <linux/initrd.h>
29#include <linux/ioport.h>
30#include <linux/bootmem.h>
31#include <linux/seq_file.h>
32#include <linux/root_dev.h>
33#include <linux/time.h>
34#include <linux/rtc.h>
35
36#include <asm/mmu.h>
37#include <asm/reg.h>
38#include <asm/residual.h>
39#include <asm/io.h>
40#include <asm/pgtable.h>
41#include <asm/mpc8xx.h>
42#include <asm/8xx_immap.h>
43#include <asm/machdep.h>
44#include <asm/bootinfo.h>
45#include <asm/time.h>
46#include <asm/prom.h>
47#include <asm/fs_pd.h>
48#include <mm/mmu_decl.h>
49
50#include "sysdev/mpc8xx_pic.h"
51
52void m8xx_calibrate_decr(void);
53extern void m8xx_wdt_handler_install(bd_t *bp);
54extern int cpm_pic_init(void);
55extern int cpm_get_irq(void);
56
57/* A place holder for time base interrupts, if they are ever enabled. */
58irqreturn_t timebase_interrupt(int irq, void * dev)
59{
60 printk ("timebase_interrupt()\n");
61
62 return IRQ_HANDLED;
63}
64
65static struct irqaction tbint_irqaction = {
66 .handler = timebase_interrupt,
67 .mask = CPU_MASK_NONE,
68 .name = "tbint",
69};
70
71/* per-board overridable init_internal_rtc() function. */
72void __init __attribute__ ((weak))
73init_internal_rtc(void)
74{
75 sit8xx_t *sys_tmr = (sit8xx_t *) immr_map(im_sit);
76
77 /* Disable the RTC one second and alarm interrupts. */
78 clrbits16(&sys_tmr->sit_rtcsc, (RTCSC_SIE | RTCSC_ALE));
79
80 /* Enable the RTC */
81 setbits16(&sys_tmr->sit_rtcsc, (RTCSC_RTF | RTCSC_RTE));
82 immr_unmap(sys_tmr);
83}
84
85static int __init get_freq(char *name, unsigned long *val)
86{
87 struct device_node *cpu;
88 unsigned int *fp;
89 int found = 0;
90
91 /* The cpu node should have timebase and clock frequency properties */
92 cpu = of_find_node_by_type(NULL, "cpu");
93
94 if (cpu) {
95 fp = (unsigned int *)get_property(cpu, name, NULL);
96 if (fp) {
97 found = 1;
98 *val = *fp++;
99 }
100
101 of_node_put(cpu);
102 }
103
104 return found;
105}
106
107/* The decrementer counts at the system (internal) clock frequency divided by
108 * sixteen, or external oscillator divided by four. We force the processor
109 * to use system clock divided by sixteen.
110 */
111void __init mpc8xx_calibrate_decr(void)
112{
113 struct device_node *cpu;
114 cark8xx_t *clk_r1;
115 car8xx_t *clk_r2;
116 sitk8xx_t *sys_tmr1;
117 sit8xx_t *sys_tmr2;
118 int irq, virq;
119
120 clk_r1 = (cark8xx_t *) immr_map(im_clkrstk);
121
122 /* Unlock the SCCR. */
123 out_be32(&clk_r1->cark_sccrk, ~KAPWR_KEY);
124 out_be32(&clk_r1->cark_sccrk, KAPWR_KEY);
125 immr_unmap(clk_r1);
126
127 /* Force all 8xx processors to use divide by 16 processor clock. */
128 clk_r2 = (car8xx_t *) immr_map(im_clkrst);
129 setbits32(&clk_r2->car_sccr, 0x02000000);
130 immr_unmap(clk_r2);
131
132 /* Processor frequency is MHz.
133 */
134 ppc_tb_freq = 50000000;
135 if (!get_freq("bus-frequency", &ppc_tb_freq)) {
136 printk(KERN_ERR "WARNING: Estimating decrementer frequency "
137 "(not found)\n");
138 }
139 ppc_tb_freq /= 16;
140 ppc_proc_freq = 50000000;
141 if (!get_freq("clock-frequency", &ppc_proc_freq))
142 printk(KERN_ERR "WARNING: Estimating processor frequency"
143 "(not found)\n");
144
145 printk("Decrementer Frequency = 0x%lx\n", ppc_tb_freq);
146
147 /* Perform some more timer/timebase initialization. This used
148 * to be done elsewhere, but other changes caused it to get
149 * called more than once....that is a bad thing.
150 *
151 * First, unlock all of the registers we are going to modify.
152 * To protect them from corruption during power down, registers
153 * that are maintained by keep alive power are "locked". To
154 * modify these registers we have to write the key value to
155 * the key location associated with the register.
156 * Some boards power up with these unlocked, while others
157 * are locked. Writing anything (including the unlock code?)
158 * to the unlocked registers will lock them again. So, here
159 * we guarantee the registers are locked, then we unlock them
160 * for our use.
161 */
162 sys_tmr1 = (sitk8xx_t *) immr_map(im_sitk);
163 out_be32(&sys_tmr1->sitk_tbscrk, ~KAPWR_KEY);
164 out_be32(&sys_tmr1->sitk_rtcsck, ~KAPWR_KEY);
165 out_be32(&sys_tmr1->sitk_tbk, ~KAPWR_KEY);
166 out_be32(&sys_tmr1->sitk_tbscrk, KAPWR_KEY);
167 out_be32(&sys_tmr1->sitk_rtcsck, KAPWR_KEY);
168 out_be32(&sys_tmr1->sitk_tbk, KAPWR_KEY);
169 immr_unmap(sys_tmr1);
170
171 init_internal_rtc();
172
173 /* Enabling the decrementer also enables the timebase interrupts
174 * (or from the other point of view, to get decrementer interrupts
175 * we have to enable the timebase). The decrementer interrupt
176 * is wired into the vector table, nothing to do here for that.
177 */
178 cpu = of_find_node_by_type(NULL, "cpu");
179 virq= irq_of_parse_and_map(cpu, 0);
180 irq = irq_map[virq].hwirq;
181
182 sys_tmr2 = (sit8xx_t *) immr_map(im_sit);
183 out_be16(&sys_tmr2->sit_tbscr, ((1 << (7 - (irq/2))) << 8) |
184 (TBSCR_TBF | TBSCR_TBE));
185 immr_unmap(sys_tmr2);
186
187 if (setup_irq(virq, &tbint_irqaction))
188 panic("Could not allocate timer IRQ!");
189
190#ifdef CONFIG_8xx_WDT
191 /* Install watchdog timer handler early because it might be
192 * already enabled by the bootloader
193 */
194 m8xx_wdt_handler_install(binfo);
195#endif
196}
197
198/* The RTC on the MPC8xx is an internal register.
199 * We want to protect this during power down, so we need to unlock,
200 * modify, and re-lock.
201 */
202
203int mpc8xx_set_rtc_time(struct rtc_time *tm)
204{
205 sitk8xx_t *sys_tmr1;
206 sit8xx_t *sys_tmr2;
207 int time;
208
209 sys_tmr1 = (sitk8xx_t *) immr_map(im_sitk);
210 sys_tmr2 = (sit8xx_t *) immr_map(im_sit);
211 time = mktime(tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
212 tm->tm_hour, tm->tm_min, tm->tm_sec);
213
214 out_be32(&sys_tmr1->sitk_rtck, KAPWR_KEY);
215 out_be32(&sys_tmr2->sit_rtc, time);
216 out_be32(&sys_tmr1->sitk_rtck, ~KAPWR_KEY);
217
218 immr_unmap(sys_tmr2);
219 immr_unmap(sys_tmr1);
220 return 0;
221}
222
223void mpc8xx_get_rtc_time(struct rtc_time *tm)
224{
225 unsigned long data;
226 sit8xx_t *sys_tmr = (sit8xx_t *) immr_map(im_sit);
227
228 /* Get time from the RTC. */
229 data = in_be32(&sys_tmr->sit_rtc);
230 to_tm(data, tm);
231 tm->tm_year -= 1900;
232 tm->tm_mon -= 1;
233 immr_unmap(sys_tmr);
234 return;
235}
236
237void mpc8xx_restart(char *cmd)
238{
239 __volatile__ unsigned char dummy;
240 car8xx_t * clk_r = (car8xx_t *) immr_map(im_clkrst);
241
242
243 local_irq_disable();
244
245 setbits32(&clk_r->car_plprcr, 0x00000080);
246 /* Clear the ME bit in MSR to cause checkstop on machine check
247 */
248 mtmsr(mfmsr() & ~0x1000);
249
250 dummy = in_8(&clk_r->res[0]);
251 printk("Restart failed\n");
252 while(1);
253}
254
255void mpc8xx_show_cpuinfo(struct seq_file *m)
256{
257 struct device_node *root;
258 uint memsize = total_memory;
259 const char *model = "";
260
261 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
262
263 root = of_find_node_by_path("/");
264 if (root)
265 model = get_property(root, "model", NULL);
266 seq_printf(m, "Machine\t\t: %s\n", model);
267 of_node_put(root);
268
269 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
270}
271
272static void cpm_cascade(unsigned int irq, struct irq_desc *desc)
273{
274 int cascade_irq;
275
276 if ((cascade_irq = cpm_get_irq()) >= 0) {
277 struct irq_desc *cdesc = irq_desc + cascade_irq;
278
279 generic_handle_irq(cascade_irq);
280 cdesc->chip->eoi(cascade_irq);
281 }
282 desc->chip->eoi(irq);
283}
284
285/* Initialize the internal interrupt controller. The number of
286 * interrupts supported can vary with the processor type, and the
287 * 82xx family can have up to 64.
288 * External interrupts can be either edge or level triggered, and
289 * need to be initialized by the appropriate driver.
290 */
291void __init m8xx_pic_init(void)
292{
293 int irq;
294
295 if (mpc8xx_pic_init()) {
296 printk(KERN_ERR "Failed interrupt 8xx controller initialization\n");
297 return;
298 }
299
300 irq = cpm_pic_init();
301 if (irq != NO_IRQ)
302 set_irq_chained_handler(irq, cpm_cascade);
303}
diff --git a/arch/powerpc/platforms/8xx/mpc86xads.h b/arch/powerpc/platforms/8xx/mpc86xads.h
new file mode 100644
index 000000000000..b5d19dd0619c
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/mpc86xads.h
@@ -0,0 +1,95 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Freescale MPC86xADS board.
4 * Copied from the FADS stuff.
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * 2005 (c) MontaVista Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_MPC86XADS_H__
16#define __ASM_MPC86XADS_H__
17
18#include <asm/ppcboot.h>
19#include <sysdev/fsl_soc.h>
20
21/* U-Boot maps BCSR to 0xff080000 */
22#define BCSR_ADDR ((uint)0xff080000)
23#define BCSR_SIZE ((uint)32)
24#define BCSR0 ((uint)(BCSR_ADDR + 0x00))
25#define BCSR1 ((uint)(BCSR_ADDR + 0x04))
26#define BCSR2 ((uint)(BCSR_ADDR + 0x08))
27#define BCSR3 ((uint)(BCSR_ADDR + 0x0c))
28#define BCSR4 ((uint)(BCSR_ADDR + 0x10))
29
30#define CFG_PHYDEV_ADDR ((uint)0xff0a0000)
31#define BCSR5 ((uint)(CFG_PHYDEV_ADDR + 0x300))
32
33#define IMAP_ADDR (get_immrbase())
34#define IMAP_SIZE ((uint)(64 * 1024))
35
36#define MPC8xx_CPM_OFFSET (0x9c0)
37#define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET)
38#define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver
39
40#define PCMCIA_MEM_ADDR (uint)0xff020000)
41#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
42
43/* Bits of interest in the BCSRs.
44 */
45#define BCSR1_ETHEN ((uint)0x20000000)
46#define BCSR1_IRDAEN ((uint)0x10000000)
47#define BCSR1_RS232EN_1 ((uint)0x01000000)
48#define BCSR1_PCCEN ((uint)0x00800000)
49#define BCSR1_PCCVCC0 ((uint)0x00400000)
50#define BCSR1_PCCVPP0 ((uint)0x00200000)
51#define BCSR1_PCCVPP1 ((uint)0x00100000)
52#define BCSR1_PCCVPP_MASK (BCSR1_PCCVPP0 | BCSR1_PCCVPP1)
53#define BCSR1_RS232EN_2 ((uint)0x00040000)
54#define BCSR1_PCCVCC1 ((uint)0x00010000)
55#define BCSR1_PCCVCC_MASK (BCSR1_PCCVCC0 | BCSR1_PCCVCC1)
56
57#define BCSR4_ETH10_RST ((uint)0x80000000) /* 10Base-T PHY reset*/
58#define BCSR4_USB_LO_SPD ((uint)0x04000000)
59#define BCSR4_USB_VCC ((uint)0x02000000)
60#define BCSR4_USB_FULL_SPD ((uint)0x00040000)
61#define BCSR4_USB_EN ((uint)0x00020000)
62
63#define BCSR5_MII2_EN 0x40
64#define BCSR5_MII2_RST 0x20
65#define BCSR5_T1_RST 0x10
66#define BCSR5_ATM155_RST 0x08
67#define BCSR5_ATM25_RST 0x04
68#define BCSR5_MII1_EN 0x02
69#define BCSR5_MII1_RST 0x01
70
71/* Interrupt level assignments */
72#define PHY_INTERRUPT SIU_IRQ7 /* PHY link change interrupt */
73#define SIU_INT_FEC1 SIU_LEVEL1 /* FEC1 interrupt */
74#define FEC_INTERRUPT SIU_INT_FEC1 /* FEC interrupt */
75
76/* We don't use the 8259 */
77#define NR_8259_INTS 0
78
79/* CPM Ethernet through SCC1 */
80#define PA_ENET_RXD ((ushort)0x0001)
81#define PA_ENET_TXD ((ushort)0x0002)
82#define PA_ENET_TCLK ((ushort)0x0100)
83#define PA_ENET_RCLK ((ushort)0x0200)
84#define PB_ENET_TENA ((uint)0x00001000)
85#define PC_ENET_CLSN ((ushort)0x0010)
86#define PC_ENET_RENA ((ushort)0x0020)
87
88/* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to
89 * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
90 */
91#define SICR_ENET_MASK ((uint)0x000000ff)
92#define SICR_ENET_CLKRT ((uint)0x0000002c)
93
94#endif /* __ASM_MPC86XADS_H__ */
95#endif /* __KERNEL__ */
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
new file mode 100644
index 000000000000..ef52ce701b0e
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
@@ -0,0 +1,301 @@
1/*arch/ppc/platforms/mpc86xads-setup.c
2 *
3 * Platform setup for the Freescale mpc86xads board
4 *
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * Copyright 2005 MontaVista Software Inc.
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/init.h>
15#include <linux/module.h>
16#include <linux/param.h>
17#include <linux/string.h>
18#include <linux/ioport.h>
19#include <linux/device.h>
20#include <linux/delay.h>
21#include <linux/root_dev.h>
22
23#include <linux/fs_enet_pd.h>
24#include <linux/fs_uart_pd.h>
25#include <linux/mii.h>
26
27#include <asm/delay.h>
28#include <asm/io.h>
29#include <asm/machdep.h>
30#include <asm/page.h>
31#include <asm/processor.h>
32#include <asm/system.h>
33#include <asm/time.h>
34#include <asm/ppcboot.h>
35#include <asm/mpc8xx.h>
36#include <asm/8xx_immap.h>
37#include <asm/commproc.h>
38#include <asm/fs_pd.h>
39#include <asm/prom.h>
40
41extern void cpm_reset(void);
42extern void mpc8xx_show_cpuinfo(struct seq_file*);
43extern void mpc8xx_restart(char *cmd);
44extern void mpc8xx_calibrate_decr(void);
45extern int mpc8xx_set_rtc_time(struct rtc_time *tm);
46extern void mpc8xx_get_rtc_time(struct rtc_time *tm);
47extern void m8xx_pic_init(void);
48extern unsigned int mpc8xx_get_irq(void);
49
50static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi);
51static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi);
52static void init_scc1_ioports(struct fs_platform_info* ptr);
53
54void __init mpc86xads_board_setup(void)
55{
56 cpm8xx_t *cp;
57 unsigned int *bcsr_io;
58 u8 tmpval8;
59
60 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
61 cp = (cpm8xx_t *)immr_map(im_cpm);
62
63 if (bcsr_io == NULL) {
64 printk(KERN_CRIT "Could not remap BCSR\n");
65 return;
66 }
67#ifdef CONFIG_SERIAL_CPM_SMC1
68 clrbits32(bcsr_io, BCSR1_RS232EN_1);
69 clrbits32(&cp->cp_simode, 0xe0000000 >> 17); /* brg1 */
70 tmpval8 = in_8(&(cp->cp_smc[0].smc_smcm)) | (SMCM_RX | SMCM_TX);
71 out_8(&(cp->cp_smc[0].smc_smcm), tmpval8);
72 clrbits16(&cp->cp_smc[0].smc_smcmr, SMCMR_REN | SMCMR_TEN);
73#else
74 setbits32(bcsr_io,BCSR1_RS232EN_1);
75 out_be16(&cp->cp_smc[0].smc_smcmr, 0);
76 out_8(&cp->cp_smc[0].smc_smce, 0);
77#endif
78
79#ifdef CONFIG_SERIAL_CPM_SMC2
80 clrbits32(bcsr_io,BCSR1_RS232EN_2);
81 clrbits32(&cp->cp_simode, 0xe0000000 >> 1);
82 setbits32(&cp->cp_simode, 0x20000000 >> 1); /* brg2 */
83 tmpval8 = in_8(&(cp->cp_smc[1].smc_smcm)) | (SMCM_RX | SMCM_TX);
84 out_8(&(cp->cp_smc[1].smc_smcm), tmpval8);
85 clrbits16(&cp->cp_smc[1].smc_smcmr, SMCMR_REN | SMCMR_TEN);
86
87 init_smc2_uart_ioports(0);
88#else
89 setbits32(bcsr_io,BCSR1_RS232EN_2);
90 out_be16(&cp->cp_smc[1].smc_smcmr, 0);
91 out_8(&cp->cp_smc[1].smc_smce, 0);
92#endif
93 immr_unmap(cp);
94 iounmap(bcsr_io);
95}
96
97
98static void init_fec1_ioports(struct fs_platform_info* ptr)
99{
100 iop8xx_t *io_port = (iop8xx_t *)immr_map(im_ioport);
101
102 /* configure FEC1 pins */
103
104 setbits16(&io_port->iop_pdpar, 0x1fff);
105 setbits16(&io_port->iop_pddir, 0x1fff);
106
107 immr_unmap(io_port);
108}
109
110void init_fec_ioports(struct fs_platform_info *fpi)
111{
112 int fec_no = fs_get_fec_index(fpi->fs_no);
113
114 switch (fec_no) {
115 case 0:
116 init_fec1_ioports(fpi);
117 break;
118 default:
119 printk(KERN_ERR "init_fec_ioports: invalid FEC number\n");
120 return;
121 }
122}
123
124static void init_scc1_ioports(struct fs_platform_info* fpi)
125{
126 unsigned *bcsr_io;
127 iop8xx_t *io_port;
128 cpm8xx_t *cp;
129
130 bcsr_io = ioremap(BCSR_ADDR, BCSR_SIZE);
131 io_port = (iop8xx_t *)immr_map(im_ioport);
132 cp = (cpm8xx_t *)immr_map(im_cpm);
133
134 if (bcsr_io == NULL) {
135 printk(KERN_CRIT "Could not remap BCSR\n");
136 return;
137 }
138
139 /* Configure port A pins for Txd and Rxd.
140 */
141 setbits16(&io_port->iop_papar, PA_ENET_RXD | PA_ENET_TXD);
142 clrbits16(&io_port->iop_padir, PA_ENET_RXD | PA_ENET_TXD);
143 clrbits16(&io_port->iop_paodr, PA_ENET_TXD);
144
145 /* Configure port C pins to enable CLSN and RENA.
146 */
147 clrbits16(&io_port->iop_pcpar, PC_ENET_CLSN | PC_ENET_RENA);
148 clrbits16(&io_port->iop_pcdir, PC_ENET_CLSN | PC_ENET_RENA);
149 setbits16(&io_port->iop_pcso, PC_ENET_CLSN | PC_ENET_RENA);
150
151 /* Configure port A for TCLK and RCLK.
152 */
153 setbits16(&io_port->iop_papar, PA_ENET_TCLK | PA_ENET_RCLK);
154 clrbits16(&io_port->iop_padir, PA_ENET_TCLK | PA_ENET_RCLK);
155 clrbits32(&cp->cp_pbpar, PB_ENET_TENA);
156 clrbits32(&cp->cp_pbdir, PB_ENET_TENA);
157
158 /* Configure Serial Interface clock routing.
159 * First, clear all SCC bits to zero, then set the ones we want.
160 */
161 clrbits32(&cp->cp_sicr, SICR_ENET_MASK);
162 setbits32(&cp->cp_sicr, SICR_ENET_CLKRT);
163
164 /* In the original SCC enet driver the following code is placed at
165 the end of the initialization */
166 setbits32(&cp->cp_pbpar, PB_ENET_TENA);
167 setbits32(&cp->cp_pbdir, PB_ENET_TENA);
168
169 clrbits32(bcsr_io+1, BCSR1_ETHEN);
170 iounmap(bcsr_io);
171 immr_unmap(cp);
172 immr_unmap(io_port);
173}
174
175void init_scc_ioports(struct fs_platform_info *fpi)
176{
177 int scc_no = fs_get_scc_index(fpi->fs_no);
178
179 switch (scc_no) {
180 case 0:
181 init_scc1_ioports(fpi);
182 break;
183 default:
184 printk(KERN_ERR "init_scc_ioports: invalid SCC number\n");
185 return;
186 }
187}
188
189
190
191static void init_smc1_uart_ioports(struct fs_uart_platform_info* ptr)
192{
193 unsigned *bcsr_io;
194 cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm);
195
196 setbits32(&cp->cp_pbpar, 0x000000c0);
197 clrbits32(&cp->cp_pbdir, 0x000000c0);
198 clrbits16(&cp->cp_pbodr, 0x00c0);
199 immr_unmap(cp);
200
201 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
202
203 if (bcsr_io == NULL) {
204 printk(KERN_CRIT "Could not remap BCSR1\n");
205 return;
206 }
207 clrbits32(bcsr_io,BCSR1_RS232EN_1);
208 iounmap(bcsr_io);
209}
210
211static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi)
212{
213 unsigned *bcsr_io;
214 cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm);
215
216 setbits32(&cp->cp_pbpar, 0x00000c00);
217 clrbits32(&cp->cp_pbdir, 0x00000c00);
218 clrbits16(&cp->cp_pbodr, 0x0c00);
219 immr_unmap(cp);
220
221 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
222
223 if (bcsr_io == NULL) {
224 printk(KERN_CRIT "Could not remap BCSR1\n");
225 return;
226 }
227 clrbits32(bcsr_io,BCSR1_RS232EN_2);
228 iounmap(bcsr_io);
229}
230
231void init_smc_ioports(struct fs_uart_platform_info *data)
232{
233 int smc_no = fs_uart_id_fsid2smc(data->fs_no);
234
235 switch (smc_no) {
236 case 0:
237 init_smc1_uart_ioports(data);
238 data->brg = data->clk_rx;
239 break;
240 case 1:
241 init_smc2_uart_ioports(data);
242 data->brg = data->clk_rx;
243 break;
244 default:
245 printk(KERN_ERR "init_scc_ioports: invalid SCC number\n");
246 return;
247 }
248}
249
250int platform_device_skip(char *model, int id)
251{
252 return 0;
253}
254
255static void __init mpc86xads_setup_arch(void)
256{
257 struct device_node *cpu;
258
259 cpu = of_find_node_by_type(NULL, "cpu");
260 if (cpu != 0) {
261 const unsigned int *fp;
262
263 fp = get_property(cpu, "clock-frequency", NULL);
264 if (fp != 0)
265 loops_per_jiffy = *fp / HZ;
266 else
267 loops_per_jiffy = 50000000 / HZ;
268 of_node_put(cpu);
269 }
270
271 cpm_reset();
272
273 mpc86xads_board_setup();
274
275 ROOT_DEV = Root_NFS;
276}
277
278static int __init mpc86xads_probe(void)
279{
280 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
281 "model", NULL);
282 if (model == NULL)
283 return 0;
284 if (strcmp(model, "MPC866ADS"))
285 return 0;
286
287 return 1;
288}
289
290define_machine(mpc86x_ads) {
291 .name = "MPC86x ADS",
292 .probe = mpc86xads_probe,
293 .setup_arch = mpc86xads_setup_arch,
294 .init_IRQ = m8xx_pic_init,
295 .show_cpuinfo = mpc8xx_show_cpuinfo,
296 .get_irq = mpc8xx_get_irq,
297 .restart = mpc8xx_restart,
298 .calibrate_decr = mpc8xx_calibrate_decr,
299 .set_rtc_time = mpc8xx_set_rtc_time,
300 .get_rtc_time = mpc8xx_get_rtc_time,
301};
diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h
new file mode 100644
index 000000000000..30cbebfe84c5
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/mpc885ads.h
@@ -0,0 +1,95 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Freescale MPC885ADS board.
4 * Copied from the FADS stuff.
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * 2005 (c) MontaVista Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_MPC885ADS_H__
16#define __ASM_MPC885ADS_H__
17
18#include <asm/ppcboot.h>
19#include <sysdev/fsl_soc.h>
20
21/* U-Boot maps BCSR to 0xff080000 */
22#define BCSR_ADDR ((uint)0xff080000)
23#define BCSR_SIZE ((uint)32)
24#define BCSR0 ((uint)(BCSR_ADDR + 0x00))
25#define BCSR1 ((uint)(BCSR_ADDR + 0x04))
26#define BCSR2 ((uint)(BCSR_ADDR + 0x08))
27#define BCSR3 ((uint)(BCSR_ADDR + 0x0c))
28#define BCSR4 ((uint)(BCSR_ADDR + 0x10))
29
30#define CFG_PHYDEV_ADDR ((uint)0xff0a0000)
31#define BCSR5 ((uint)(CFG_PHYDEV_ADDR + 0x300))
32
33#define IMAP_ADDR (get_immrbase())
34#define IMAP_SIZE ((uint)(64 * 1024))
35
36#define MPC8xx_CPM_OFFSET (0x9c0)
37#define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET)
38#define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver
39
40#define PCMCIA_MEM_ADDR (uint)0xff020000)
41#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
42
43/* Bits of interest in the BCSRs.
44 */
45#define BCSR1_ETHEN ((uint)0x20000000)
46#define BCSR1_IRDAEN ((uint)0x10000000)
47#define BCSR1_RS232EN_1 ((uint)0x01000000)
48#define BCSR1_PCCEN ((uint)0x00800000)
49#define BCSR1_PCCVCC0 ((uint)0x00400000)
50#define BCSR1_PCCVPP0 ((uint)0x00200000)
51#define BCSR1_PCCVPP1 ((uint)0x00100000)
52#define BCSR1_PCCVPP_MASK (BCSR1_PCCVPP0 | BCSR1_PCCVPP1)
53#define BCSR1_RS232EN_2 ((uint)0x00040000)
54#define BCSR1_PCCVCC1 ((uint)0x00010000)
55#define BCSR1_PCCVCC_MASK (BCSR1_PCCVCC0 | BCSR1_PCCVCC1)
56
57#define BCSR4_ETH10_RST ((uint)0x80000000) /* 10Base-T PHY reset*/
58#define BCSR4_USB_LO_SPD ((uint)0x04000000)
59#define BCSR4_USB_VCC ((uint)0x02000000)
60#define BCSR4_USB_FULL_SPD ((uint)0x00040000)
61#define BCSR4_USB_EN ((uint)0x00020000)
62
63#define BCSR5_MII2_EN 0x40
64#define BCSR5_MII2_RST 0x20
65#define BCSR5_T1_RST 0x10
66#define BCSR5_ATM155_RST 0x08
67#define BCSR5_ATM25_RST 0x04
68#define BCSR5_MII1_EN 0x02
69#define BCSR5_MII1_RST 0x01
70
71/* Interrupt level assignments */
72#define PHY_INTERRUPT SIU_IRQ7 /* PHY link change interrupt */
73#define SIU_INT_FEC1 SIU_LEVEL1 /* FEC1 interrupt */
74#define SIU_INT_FEC2 SIU_LEVEL3 /* FEC2 interrupt */
75#define FEC_INTERRUPT SIU_INT_FEC1 /* FEC interrupt */
76
77/* We don't use the 8259 */
78#define NR_8259_INTS 0
79
80/* CPM Ethernet through SCC3 */
81#define PA_ENET_RXD ((ushort)0x0040)
82#define PA_ENET_TXD ((ushort)0x0080)
83#define PE_ENET_TCLK ((uint)0x00004000)
84#define PE_ENET_RCLK ((uint)0x00008000)
85#define PE_ENET_TENA ((uint)0x00000010)
86#define PC_ENET_CLSN ((ushort)0x0400)
87#define PC_ENET_RENA ((ushort)0x0800)
88
89/* Control bits in the SICR to route TCLK (CLK5) and RCLK (CLK6) to
90 * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero */
91#define SICR_ENET_MASK ((uint)0x00ff0000)
92#define SICR_ENET_CLKRT ((uint)0x002c0000)
93
94#endif /* __ASM_MPC885ADS_H__ */
95#endif /* __KERNEL__ */
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
new file mode 100644
index 000000000000..c5fefdf66c0a
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -0,0 +1,387 @@
1/*arch/ppc/platforms/mpc885ads-setup.c
2 *
3 * Platform setup for the Freescale mpc885ads board
4 *
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * Copyright 2005 MontaVista Software Inc.
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/init.h>
15#include <linux/module.h>
16#include <linux/param.h>
17#include <linux/string.h>
18#include <linux/ioport.h>
19#include <linux/device.h>
20#include <linux/delay.h>
21#include <linux/root_dev.h>
22
23#include <linux/fs_enet_pd.h>
24#include <linux/fs_uart_pd.h>
25#include <linux/mii.h>
26
27#include <asm/delay.h>
28#include <asm/io.h>
29#include <asm/machdep.h>
30#include <asm/page.h>
31#include <asm/processor.h>
32#include <asm/system.h>
33#include <asm/time.h>
34#include <asm/ppcboot.h>
35#include <asm/mpc8xx.h>
36#include <asm/8xx_immap.h>
37#include <asm/commproc.h>
38#include <asm/fs_pd.h>
39#include <asm/prom.h>
40
41extern void cpm_reset(void);
42extern void mpc8xx_show_cpuinfo(struct seq_file*);
43extern void mpc8xx_restart(char *cmd);
44extern void mpc8xx_calibrate_decr(void);
45extern int mpc8xx_set_rtc_time(struct rtc_time *tm);
46extern void mpc8xx_get_rtc_time(struct rtc_time *tm);
47extern void m8xx_pic_init(void);
48extern unsigned int mpc8xx_get_irq(void);
49
50static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi);
51static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi);
52static void init_scc3_ioports(struct fs_platform_info* ptr);
53
54void __init mpc885ads_board_setup(void)
55{
56 cpm8xx_t *cp;
57 unsigned int *bcsr_io;
58 u8 tmpval8;
59
60#ifdef CONFIG_FS_ENET
61 iop8xx_t *io_port;
62#endif
63
64 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
65 cp = (cpm8xx_t *)immr_map(im_cpm);
66
67 if (bcsr_io == NULL) {
68 printk(KERN_CRIT "Could not remap BCSR\n");
69 return;
70 }
71#ifdef CONFIG_SERIAL_CPM_SMC1
72 clrbits32(bcsr_io, BCSR1_RS232EN_1);
73 clrbits32(&cp->cp_simode, 0xe0000000 >> 17); /* brg1 */
74 tmpval8 = in_8(&(cp->cp_smc[0].smc_smcm)) | (SMCM_RX | SMCM_TX);
75 out_8(&(cp->cp_smc[0].smc_smcm), tmpval8);
76 clrbits16(&cp->cp_smc[0].smc_smcmr, SMCMR_REN | SMCMR_TEN); /* brg1 */
77#else
78 setbits32(bcsr_io,BCSR1_RS232EN_1);
79 out_be16(&cp->cp_smc[0].smc_smcmr, 0);
80 out_8(&cp->cp_smc[0].smc_smce, 0);
81#endif
82
83#ifdef CONFIG_SERIAL_CPM_SMC2
84 clrbits32(bcsr_io,BCSR1_RS232EN_2);
85 clrbits32(&cp->cp_simode, 0xe0000000 >> 1);
86 setbits32(&cp->cp_simode, 0x20000000 >> 1); /* brg2 */
87 tmpval8 = in_8(&(cp->cp_smc[1].smc_smcm)) | (SMCM_RX | SMCM_TX);
88 out_8(&(cp->cp_smc[1].smc_smcm), tmpval8);
89 clrbits16(&cp->cp_smc[1].smc_smcmr, SMCMR_REN | SMCMR_TEN);
90
91 init_smc2_uart_ioports(0);
92#else
93 setbits32(bcsr_io,BCSR1_RS232EN_2);
94 out_be16(&cp->cp_smc[1].smc_smcmr, 0);
95 out_8(&cp->cp_smc[1].smc_smce, 0);
96#endif
97 immr_unmap(cp);
98 iounmap(bcsr_io);
99
100#ifdef CONFIG_FS_ENET
101 /* use MDC for MII (common) */
102 io_port = (iop8xx_t*)immr_map(im_ioport);
103 setbits16(&io_port->iop_pdpar, 0x0080);
104 clrbits16(&io_port->iop_pddir, 0x0080);
105
106 bcsr_io = ioremap(BCSR5, sizeof(unsigned long));
107 clrbits32(bcsr_io,BCSR5_MII1_EN);
108 clrbits32(bcsr_io,BCSR5_MII1_RST);
109#ifndef CONFIG_FC_ENET_HAS_SCC
110 clrbits32(bcsr_io,BCSR5_MII2_EN);
111 clrbits32(bcsr_io,BCSR5_MII2_RST);
112
113#endif
114 iounmap(bcsr_io);
115 immr_unmap(io_port);
116
117#endif
118}
119
120
121static void init_fec1_ioports(struct fs_platform_info* ptr)
122{
123 cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm);
124 iop8xx_t *io_port = (iop8xx_t *)immr_map(im_ioport);
125
126 /* configure FEC1 pins */
127 setbits16(&io_port->iop_papar, 0xf830);
128 setbits16(&io_port->iop_padir, 0x0830);
129 clrbits16(&io_port->iop_padir, 0xf000);
130
131 setbits32(&cp->cp_pbpar, 0x00001001);
132 clrbits32(&cp->cp_pbdir, 0x00001001);
133
134 setbits16(&io_port->iop_pcpar, 0x000c);
135 clrbits16(&io_port->iop_pcdir, 0x000c);
136
137 setbits32(&cp->cp_pepar, 0x00000003);
138 setbits32(&cp->cp_pedir, 0x00000003);
139 clrbits32(&cp->cp_peso, 0x00000003);
140 clrbits32(&cp->cp_cptr, 0x00000100);
141
142 immr_unmap(io_port);
143 immr_unmap(cp);
144}
145
146
147static void init_fec2_ioports(struct fs_platform_info* ptr)
148{
149 cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm);
150 iop8xx_t *io_port = (iop8xx_t *)immr_map(im_ioport);
151
152 /* configure FEC2 pins */
153 setbits32(&cp->cp_pepar, 0x0003fffc);
154 setbits32(&cp->cp_pedir, 0x0003fffc);
155 clrbits32(&cp->cp_peso, 0x000087fc);
156 setbits32(&cp->cp_peso, 0x00037800);
157 clrbits32(&cp->cp_cptr, 0x00000080);
158
159 immr_unmap(io_port);
160 immr_unmap(cp);
161}
162
163void init_fec_ioports(struct fs_platform_info *fpi)
164{
165 int fec_no = fs_get_fec_index(fpi->fs_no);
166
167 switch (fec_no) {
168 case 0:
169 init_fec1_ioports(fpi);
170 break;
171 case 1:
172 init_fec2_ioports(fpi);
173 break;
174 default:
175 printk(KERN_ERR "init_fec_ioports: invalid FEC number\n");
176 return;
177 }
178}
179
180static void init_scc3_ioports(struct fs_platform_info* fpi)
181{
182 unsigned *bcsr_io;
183 iop8xx_t *io_port;
184 cpm8xx_t *cp;
185
186 bcsr_io = ioremap(BCSR_ADDR, BCSR_SIZE);
187 io_port = (iop8xx_t *)immr_map(im_ioport);
188 cp = (cpm8xx_t *)immr_map(im_cpm);
189
190 if (bcsr_io == NULL) {
191 printk(KERN_CRIT "Could not remap BCSR\n");
192 return;
193 }
194
195 /* Enable the PHY.
196 */
197 clrbits32(bcsr_io+4, BCSR4_ETH10_RST);
198 udelay(1000);
199 setbits32(bcsr_io+4, BCSR4_ETH10_RST);
200 /* Configure port A pins for Txd and Rxd.
201 */
202 setbits16(&io_port->iop_papar, PA_ENET_RXD | PA_ENET_TXD);
203 clrbits16(&io_port->iop_padir, PA_ENET_RXD | PA_ENET_TXD);
204
205 /* Configure port C pins to enable CLSN and RENA.
206 */
207 clrbits16(&io_port->iop_pcpar, PC_ENET_CLSN | PC_ENET_RENA);
208 clrbits16(&io_port->iop_pcdir, PC_ENET_CLSN | PC_ENET_RENA);
209 setbits16(&io_port->iop_pcso, PC_ENET_CLSN | PC_ENET_RENA);
210
211 /* Configure port E for TCLK and RCLK.
212 */
213 setbits32(&cp->cp_pepar, PE_ENET_TCLK | PE_ENET_RCLK);
214 clrbits32(&cp->cp_pepar, PE_ENET_TENA);
215 clrbits32(&cp->cp_pedir,
216 PE_ENET_TCLK | PE_ENET_RCLK | PE_ENET_TENA);
217 clrbits32(&cp->cp_peso, PE_ENET_TCLK | PE_ENET_RCLK);
218 setbits32(&cp->cp_peso, PE_ENET_TENA);
219
220 /* Configure Serial Interface clock routing.
221 * First, clear all SCC bits to zero, then set the ones we want.
222 */
223 clrbits32(&cp->cp_sicr, SICR_ENET_MASK);
224 setbits32(&cp->cp_sicr, SICR_ENET_CLKRT);
225
226 /* Disable Rx and Tx. SMC1 sshould be stopped if SCC3 eternet are used.
227 */
228 clrbits16(&cp->cp_smc[0].smc_smcmr, SMCMR_REN | SMCMR_TEN);
229 /* On the MPC885ADS SCC ethernet PHY is initialized in the full duplex mode
230 * by H/W setting after reset. SCC ethernet controller support only half duplex.
231 * This discrepancy of modes causes a lot of carrier lost errors.
232 */
233
234 /* In the original SCC enet driver the following code is placed at
235 the end of the initialization */
236 setbits32(&cp->cp_pepar, PE_ENET_TENA);
237 clrbits32(&cp->cp_pedir, PE_ENET_TENA);
238 setbits32(&cp->cp_peso, PE_ENET_TENA);
239
240 setbits32(bcsr_io+4, BCSR1_ETHEN);
241 iounmap(bcsr_io);
242 immr_unmap(io_port);
243 immr_unmap(cp);
244}
245
246void init_scc_ioports(struct fs_platform_info *fpi)
247{
248 int scc_no = fs_get_scc_index(fpi->fs_no);
249
250 switch (scc_no) {
251 case 2:
252 init_scc3_ioports(fpi);
253 break;
254 default:
255 printk(KERN_ERR "init_scc_ioports: invalid SCC number\n");
256 return;
257 }
258}
259
260
261
262static void init_smc1_uart_ioports(struct fs_uart_platform_info* ptr)
263{
264 unsigned *bcsr_io;
265 cpm8xx_t *cp;
266
267 cp = (cpm8xx_t *)immr_map(im_cpm);
268 setbits32(&cp->cp_pepar, 0x000000c0);
269 clrbits32(&cp->cp_pedir, 0x000000c0);
270 clrbits32(&cp->cp_peso, 0x00000040);
271 setbits32(&cp->cp_peso, 0x00000080);
272 immr_unmap(cp);
273
274 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
275
276 if (bcsr_io == NULL) {
277 printk(KERN_CRIT "Could not remap BCSR1\n");
278 return;
279 }
280 clrbits32(bcsr_io,BCSR1_RS232EN_1);
281 iounmap(bcsr_io);
282}
283
284static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi)
285{
286 unsigned *bcsr_io;
287 cpm8xx_t *cp;
288
289 cp = (cpm8xx_t *)immr_map(im_cpm);
290 setbits32(&cp->cp_pepar, 0x00000c00);
291 clrbits32(&cp->cp_pedir, 0x00000c00);
292 clrbits32(&cp->cp_peso, 0x00000400);
293 setbits32(&cp->cp_peso, 0x00000800);
294 immr_unmap(cp);
295
296 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
297
298 if (bcsr_io == NULL) {
299 printk(KERN_CRIT "Could not remap BCSR1\n");
300 return;
301 }
302 clrbits32(bcsr_io,BCSR1_RS232EN_2);
303 iounmap(bcsr_io);
304}
305
306void init_smc_ioports(struct fs_uart_platform_info *data)
307{
308 int smc_no = fs_uart_id_fsid2smc(data->fs_no);
309
310 switch (smc_no) {
311 case 0:
312 init_smc1_uart_ioports(data);
313 data->brg = data->clk_rx;
314 break;
315 case 1:
316 init_smc2_uart_ioports(data);
317 data->brg = data->clk_rx;
318 break;
319 default:
320 printk(KERN_ERR "init_scc_ioports: invalid SCC number\n");
321 return;
322 }
323}
324
325int platform_device_skip(char *model, int id)
326{
327#ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3
328 const char *dev = "FEC";
329 int n = 2;
330#else
331 const char *dev = "SCC";
332 int n = 3;
333#endif
334
335 if (!strcmp(model, dev) && n == id)
336 return 1;
337
338 return 0;
339}
340
341static void __init mpc885ads_setup_arch(void)
342{
343 struct device_node *cpu;
344
345 cpu = of_find_node_by_type(NULL, "cpu");
346 if (cpu != 0) {
347 const unsigned int *fp;
348
349 fp = get_property(cpu, "clock-frequency", NULL);
350 if (fp != 0)
351 loops_per_jiffy = *fp / HZ;
352 else
353 loops_per_jiffy = 50000000 / HZ;
354 of_node_put(cpu);
355 }
356
357 cpm_reset();
358
359 mpc885ads_board_setup();
360
361 ROOT_DEV = Root_NFS;
362}
363
364static int __init mpc885ads_probe(void)
365{
366 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
367 "model", NULL);
368 if (model == NULL)
369 return 0;
370 if (strcmp(model, "MPC885ADS"))
371 return 0;
372
373 return 1;
374}
375
376define_machine(mpc885_ads) {
377 .name = "MPC885 ADS",
378 .probe = mpc885ads_probe,
379 .setup_arch = mpc885ads_setup_arch,
380 .init_IRQ = m8xx_pic_init,
381 .show_cpuinfo = mpc8xx_show_cpuinfo,
382 .get_irq = mpc8xx_get_irq,
383 .restart = mpc8xx_restart,
384 .calibrate_decr = mpc8xx_calibrate_decr,
385 .set_rtc_time = mpc8xx_set_rtc_time,
386 .get_rtc_time = mpc8xx_get_rtc_time,
387};
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 507d1b98f270..65e612315b9b 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -8,6 +8,8 @@ endif
8obj-$(CONFIG_PPC_MPC52xx) += 52xx/ 8obj-$(CONFIG_PPC_MPC52xx) += 52xx/
9obj-$(CONFIG_PPC_CHRP) += chrp/ 9obj-$(CONFIG_PPC_CHRP) += chrp/
10obj-$(CONFIG_4xx) += 4xx/ 10obj-$(CONFIG_4xx) += 4xx/
11obj-$(CONFIG_PPC_8xx) += 8xx/
12obj-$(CONFIG_PPC_82xx) += 82xx/
11obj-$(CONFIG_PPC_83xx) += 83xx/ 13obj-$(CONFIG_PPC_83xx) += 83xx/
12obj-$(CONFIG_PPC_85xx) += 85xx/ 14obj-$(CONFIG_PPC_85xx) += 85xx/
13obj-$(CONFIG_PPC_86xx) += 86xx/ 15obj-$(CONFIG_PPC_86xx) += 86xx/
@@ -17,4 +19,5 @@ obj-$(CONFIG_PPC_MAPLE) += maple/
17obj-$(CONFIG_PPC_PASEMI) += pasemi/ 19obj-$(CONFIG_PPC_PASEMI) += pasemi/
18obj-$(CONFIG_PPC_CELL) += cell/ 20obj-$(CONFIG_PPC_CELL) += cell/
19obj-$(CONFIG_PPC_PS3) += ps3/ 21obj-$(CONFIG_PPC_PS3) += ps3/
22obj-$(CONFIG_PPC_CELLEB) += celleb/
20obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/ 23obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index f90e8337796c..869af89df6ff 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -14,7 +14,12 @@ endif
14spufs-modular-$(CONFIG_SPU_FS) += spu_syscalls.o 14spufs-modular-$(CONFIG_SPU_FS) += spu_syscalls.o
15spu-priv1-$(CONFIG_PPC_CELL_NATIVE) += spu_priv1_mmio.o 15spu-priv1-$(CONFIG_PPC_CELL_NATIVE) += spu_priv1_mmio.o
16 16
17spu-manage-$(CONFIG_PPC_CELLEB) += spu_manage.o
18spu-manage-$(CONFIG_PPC_CELL_NATIVE) += spu_manage.o
19
17obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \ 20obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
18 spu_coredump.o \ 21 spu_coredump.o \
19 $(spufs-modular-m) \ 22 $(spufs-modular-m) \
20 $(spu-priv1-y) spufs/ 23 $(spu-priv1-y) \
24 $(spu-manage-y) \
25 spufs/
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index b43466ba8096..67d617b60a23 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -149,7 +149,8 @@ static int cbe_nr_iommus;
149static void invalidate_tce_cache(struct cbe_iommu *iommu, unsigned long *pte, 149static void invalidate_tce_cache(struct cbe_iommu *iommu, unsigned long *pte,
150 long n_ptes) 150 long n_ptes)
151{ 151{
152 unsigned long *reg, val; 152 unsigned long __iomem *reg;
153 unsigned long val;
153 long n; 154 long n;
154 155
155 reg = iommu->xlate_regs + IOC_IOPT_CacheInvd; 156 reg = iommu->xlate_regs + IOC_IOPT_CacheInvd;
@@ -592,7 +593,7 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off
592 /* Init base fields */ 593 /* Init base fields */
593 i = cbe_nr_iommus++; 594 i = cbe_nr_iommus++;
594 iommu = &iommus[i]; 595 iommu = &iommus[i];
595 iommu->stab = 0; 596 iommu->stab = NULL;
596 iommu->nid = nid; 597 iommu->nid = nid;
597 snprintf(iommu->name, sizeof(iommu->name), "iommu%d", i); 598 snprintf(iommu->name, sizeof(iommu->name), "iommu%d", i);
598 INIT_LIST_HEAD(&iommu->windows); 599 INIT_LIST_HEAD(&iommu->windows);
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index bd7bffc3ddd0..c43999a10deb 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -170,9 +170,11 @@ int
170spu_irq_class_0_bottom(struct spu *spu) 170spu_irq_class_0_bottom(struct spu *spu)
171{ 171{
172 unsigned long stat, mask; 172 unsigned long stat, mask;
173 unsigned long flags;
173 174
174 spu->class_0_pending = 0; 175 spu->class_0_pending = 0;
175 176
177 spin_lock_irqsave(&spu->register_lock, flags);
176 mask = spu_int_mask_get(spu, 0); 178 mask = spu_int_mask_get(spu, 0);
177 stat = spu_int_stat_get(spu, 0); 179 stat = spu_int_stat_get(spu, 0);
178 180
@@ -188,6 +190,7 @@ spu_irq_class_0_bottom(struct spu *spu)
188 __spu_trap_error(spu); 190 __spu_trap_error(spu);
189 191
190 spu_int_stat_clear(spu, 0, stat); 192 spu_int_stat_clear(spu, 0, stat);
193 spin_unlock_irqrestore(&spu->register_lock, flags);
191 194
192 return (stat & 0x7) ? -EIO : 0; 195 return (stat & 0x7) ? -EIO : 0;
193} 196}
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
new file mode 100644
index 000000000000..d8b39fe39cdd
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -0,0 +1,420 @@
1/*
2 * spu management operations for of based platforms
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 * Copyright 2006 Sony Corp.
6 * (C) Copyright 2007 TOSHIBA CORPORATION
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22#include <linux/interrupt.h>
23#include <linux/list.h>
24#include <linux/module.h>
25#include <linux/ptrace.h>
26#include <linux/slab.h>
27#include <linux/wait.h>
28#include <linux/mm.h>
29#include <linux/io.h>
30#include <linux/mutex.h>
31#include <linux/device.h>
32
33#include <asm/spu.h>
34#include <asm/spu_priv1.h>
35#include <asm/firmware.h>
36#include <asm/prom.h>
37
38#include "interrupt.h"
39
40struct device_node *spu_devnode(struct spu *spu)
41{
42 return spu->devnode;
43}
44
45EXPORT_SYMBOL_GPL(spu_devnode);
46
47static u64 __init find_spu_unit_number(struct device_node *spe)
48{
49 const unsigned int *prop;
50 int proplen;
51 prop = get_property(spe, "unit-id", &proplen);
52 if (proplen == 4)
53 return (u64)*prop;
54
55 prop = get_property(spe, "reg", &proplen);
56 if (proplen == 4)
57 return (u64)*prop;
58
59 return 0;
60}
61
62static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
63 const char *prop)
64{
65 const struct address_prop {
66 unsigned long address;
67 unsigned int len;
68 } __attribute__((packed)) *p;
69 int proplen;
70
71 unsigned long start_pfn, nr_pages;
72 struct pglist_data *pgdata;
73 struct zone *zone;
74 int ret;
75
76 p = get_property(spe, prop, &proplen);
77 WARN_ON(proplen != sizeof (*p));
78
79 start_pfn = p->address >> PAGE_SHIFT;
80 nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT;
81
82 pgdata = NODE_DATA(spu->node);
83 zone = pgdata->node_zones;
84
85 ret = __add_pages(zone, start_pfn, nr_pages);
86
87 return ret;
88}
89
90static void __iomem * __init map_spe_prop(struct spu *spu,
91 struct device_node *n, const char *name)
92{
93 const struct address_prop {
94 unsigned long address;
95 unsigned int len;
96 } __attribute__((packed)) *prop;
97
98 const void *p;
99 int proplen;
100 void __iomem *ret = NULL;
101 int err = 0;
102
103 p = get_property(n, name, &proplen);
104 if (proplen != sizeof (struct address_prop))
105 return NULL;
106
107 prop = p;
108
109 err = cell_spuprop_present(spu, n, name);
110 if (err && (err != -EEXIST))
111 goto out;
112
113 ret = ioremap(prop->address, prop->len);
114
115 out:
116 return ret;
117}
118
119static void spu_unmap(struct spu *spu)
120{
121 if (!firmware_has_feature(FW_FEATURE_LPAR))
122 iounmap(spu->priv1);
123 iounmap(spu->priv2);
124 iounmap(spu->problem);
125 iounmap((__force u8 __iomem *)spu->local_store);
126}
127
128static int __init spu_map_interrupts_old(struct spu *spu,
129 struct device_node *np)
130{
131 unsigned int isrc;
132 const u32 *tmp;
133 int nid;
134
135 /* Get the interrupt source unit from the device-tree */
136 tmp = get_property(np, "isrc", NULL);
137 if (!tmp)
138 return -ENODEV;
139 isrc = tmp[0];
140
141 tmp = get_property(np->parent->parent, "node-id", NULL);
142 if (!tmp) {
143 printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__);
144 nid = spu->node;
145 } else
146 nid = tmp[0];
147
148 /* Add the node number */
149 isrc |= nid << IIC_IRQ_NODE_SHIFT;
150
151 /* Now map interrupts of all 3 classes */
152 spu->irqs[0] = irq_create_mapping(NULL, IIC_IRQ_CLASS_0 | isrc);
153 spu->irqs[1] = irq_create_mapping(NULL, IIC_IRQ_CLASS_1 | isrc);
154 spu->irqs[2] = irq_create_mapping(NULL, IIC_IRQ_CLASS_2 | isrc);
155
156 /* Right now, we only fail if class 2 failed */
157 return spu->irqs[2] == NO_IRQ ? -EINVAL : 0;
158}
159
160static int __init spu_map_device_old(struct spu *spu)
161{
162 struct device_node *node = spu->devnode;
163 const char *prop;
164 int ret;
165
166 ret = -ENODEV;
167 spu->name = get_property(node, "name", NULL);
168 if (!spu->name)
169 goto out;
170
171 prop = get_property(node, "local-store", NULL);
172 if (!prop)
173 goto out;
174 spu->local_store_phys = *(unsigned long *)prop;
175
176 /* we use local store as ram, not io memory */
177 spu->local_store = (void __force *)
178 map_spe_prop(spu, node, "local-store");
179 if (!spu->local_store)
180 goto out;
181
182 prop = get_property(node, "problem", NULL);
183 if (!prop)
184 goto out_unmap;
185 spu->problem_phys = *(unsigned long *)prop;
186
187 spu->problem = map_spe_prop(spu, node, "problem");
188 if (!spu->problem)
189 goto out_unmap;
190
191 spu->priv2 = map_spe_prop(spu, node, "priv2");
192 if (!spu->priv2)
193 goto out_unmap;
194
195 if (!firmware_has_feature(FW_FEATURE_LPAR)) {
196 spu->priv1 = map_spe_prop(spu, node, "priv1");
197 if (!spu->priv1)
198 goto out_unmap;
199 }
200
201 ret = 0;
202 goto out;
203
204out_unmap:
205 spu_unmap(spu);
206out:
207 return ret;
208}
209
210static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
211{
212 struct of_irq oirq;
213 int ret;
214 int i;
215
216 for (i=0; i < 3; i++) {
217 ret = of_irq_map_one(np, i, &oirq);
218 if (ret) {
219 pr_debug("spu_new: failed to get irq %d\n", i);
220 goto err;
221 }
222 ret = -EINVAL;
223 pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0],
224 oirq.controller->full_name);
225 spu->irqs[i] = irq_create_of_mapping(oirq.controller,
226 oirq.specifier, oirq.size);
227 if (spu->irqs[i] == NO_IRQ) {
228 pr_debug("spu_new: failed to map it !\n");
229 goto err;
230 }
231 }
232 return 0;
233
234err:
235 pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier,
236 spu->name);
237 for (; i >= 0; i--) {
238 if (spu->irqs[i] != NO_IRQ)
239 irq_dispose_mapping(spu->irqs[i]);
240 }
241 return ret;
242}
243
244static int spu_map_resource(struct spu *spu, int nr,
245 void __iomem** virt, unsigned long *phys)
246{
247 struct device_node *np = spu->devnode;
248 unsigned long start_pfn, nr_pages;
249 struct pglist_data *pgdata;
250 struct zone *zone;
251 struct resource resource = { };
252 unsigned long len;
253 int ret;
254
255 ret = of_address_to_resource(np, nr, &resource);
256 if (ret)
257 goto out;
258
259 if (phys)
260 *phys = resource.start;
261 len = resource.end - resource.start + 1;
262 *virt = ioremap(resource.start, len);
263 if (!*virt)
264 ret = -EINVAL;
265
266 start_pfn = resource.start >> PAGE_SHIFT;
267 nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
268
269 pgdata = NODE_DATA(spu->node);
270 zone = pgdata->node_zones;
271
272 ret = __add_pages(zone, start_pfn, nr_pages);
273
274out:
275 return ret;
276}
277
278static int __init spu_map_device(struct spu *spu)
279{
280 struct device_node *np = spu->devnode;
281 int ret = -ENODEV;
282
283 spu->name = get_property(np, "name", NULL);
284 if (!spu->name)
285 goto out;
286
287 ret = spu_map_resource(spu, 0, (void __iomem**)&spu->local_store,
288 &spu->local_store_phys);
289 if (ret) {
290 pr_debug("spu_new: failed to map %s resource 0\n",
291 np->full_name);
292 goto out;
293 }
294 ret = spu_map_resource(spu, 1, (void __iomem**)&spu->problem,
295 &spu->problem_phys);
296 if (ret) {
297 pr_debug("spu_new: failed to map %s resource 1\n",
298 np->full_name);
299 goto out_unmap;
300 }
301 ret = spu_map_resource(spu, 2, (void __iomem**)&spu->priv2, NULL);
302 if (ret) {
303 pr_debug("spu_new: failed to map %s resource 2\n",
304 np->full_name);
305 goto out_unmap;
306 }
307 if (!firmware_has_feature(FW_FEATURE_LPAR))
308 ret = spu_map_resource(spu, 3,
309 (void __iomem**)&spu->priv1, NULL);
310 if (ret) {
311 pr_debug("spu_new: failed to map %s resource 3\n",
312 np->full_name);
313 goto out_unmap;
314 }
315 pr_debug("spu_new: %s maps:\n", np->full_name);
316 pr_debug(" local store : 0x%016lx -> 0x%p\n",
317 spu->local_store_phys, spu->local_store);
318 pr_debug(" problem state : 0x%016lx -> 0x%p\n",
319 spu->problem_phys, spu->problem);
320 pr_debug(" priv2 : 0x%p\n", spu->priv2);
321 pr_debug(" priv1 : 0x%p\n", spu->priv1);
322
323 return 0;
324
325out_unmap:
326 spu_unmap(spu);
327out:
328 pr_debug("failed to map spe %s: %d\n", spu->name, ret);
329 return ret;
330}
331
332static int __init of_enumerate_spus(int (*fn)(void *data))
333{
334 int ret;
335 struct device_node *node;
336
337 ret = -ENODEV;
338 for (node = of_find_node_by_type(NULL, "spe");
339 node; node = of_find_node_by_type(node, "spe")) {
340 ret = fn(node);
341 if (ret) {
342 printk(KERN_WARNING "%s: Error initializing %s\n",
343 __FUNCTION__, node->name);
344 break;
345 }
346 }
347 return ret;
348}
349
350static int __init of_create_spu(struct spu *spu, void *data)
351{
352 int ret;
353 struct device_node *spe = (struct device_node *)data;
354 static int legacy_map = 0, legacy_irq = 0;
355
356 spu->devnode = of_node_get(spe);
357 spu->spe_id = find_spu_unit_number(spe);
358
359 spu->node = of_node_to_nid(spe);
360 if (spu->node >= MAX_NUMNODES) {
361 printk(KERN_WARNING "SPE %s on node %d ignored,"
362 " node number too big\n", spe->full_name, spu->node);
363 printk(KERN_WARNING "Check if CONFIG_NUMA is enabled.\n");
364 ret = -ENODEV;
365 goto out;
366 }
367
368 ret = spu_map_device(spu);
369 if (ret) {
370 if (!legacy_map) {
371 legacy_map = 1;
372 printk(KERN_WARNING "%s: Legacy device tree found, "
373 "trying to map old style\n", __FUNCTION__);
374 }
375 ret = spu_map_device_old(spu);
376 if (ret) {
377 printk(KERN_ERR "Unable to map %s\n",
378 spu->name);
379 goto out;
380 }
381 }
382
383 ret = spu_map_interrupts(spu, spe);
384 if (ret) {
385 if (!legacy_irq) {
386 legacy_irq = 1;
387 printk(KERN_WARNING "%s: Legacy device tree found, "
388 "trying old style irq\n", __FUNCTION__);
389 }
390 ret = spu_map_interrupts_old(spu, spe);
391 if (ret) {
392 printk(KERN_ERR "%s: could not map interrupts",
393 spu->name);
394 goto out_unmap;
395 }
396 }
397
398 pr_debug("Using SPE %s %p %p %p %p %d\n", spu->name,
399 spu->local_store, spu->problem, spu->priv1,
400 spu->priv2, spu->number);
401 goto out;
402
403out_unmap:
404 spu_unmap(spu);
405out:
406 return ret;
407}
408
409static int of_destroy_spu(struct spu *spu)
410{
411 spu_unmap(spu);
412 of_node_put(spu->devnode);
413 return 0;
414}
415
416const struct spu_management_ops spu_management_of_ops = {
417 .enumerate_spus = of_enumerate_spus,
418 .create_spu = of_create_spu,
419 .destroy_spu = of_destroy_spu,
420};
diff --git a/arch/powerpc/platforms/cell/spu_priv1_mmio.c b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
index 910a926b61a2..67fa7247b80a 100644
--- a/arch/powerpc/platforms/cell/spu_priv1_mmio.c
+++ b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
@@ -37,490 +37,112 @@
37#include "interrupt.h" 37#include "interrupt.h"
38#include "spu_priv1_mmio.h" 38#include "spu_priv1_mmio.h"
39 39
40static DEFINE_MUTEX(add_spumem_mutex);
41
42struct spu_pdata {
43 struct device_node *devnode;
44 struct spu_priv1 __iomem *priv1;
45};
46
47static struct spu_pdata *spu_get_pdata(struct spu *spu)
48{
49 BUG_ON(!spu->pdata);
50 return spu->pdata;
51}
52
53struct device_node *spu_devnode(struct spu *spu)
54{
55 return spu_get_pdata(spu)->devnode;
56}
57
58EXPORT_SYMBOL_GPL(spu_devnode);
59
60static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
61 const char *prop)
62{
63 const struct address_prop {
64 unsigned long address;
65 unsigned int len;
66 } __attribute__((packed)) *p;
67 int proplen;
68
69 unsigned long start_pfn, nr_pages;
70 struct pglist_data *pgdata;
71 struct zone *zone;
72 int ret;
73
74 p = get_property(spe, prop, &proplen);
75 WARN_ON(proplen != sizeof (*p));
76
77 start_pfn = p->address >> PAGE_SHIFT;
78 nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT;
79
80 pgdata = NODE_DATA(spu->node);
81 zone = pgdata->node_zones;
82
83 /* XXX rethink locking here */
84 mutex_lock(&add_spumem_mutex);
85 ret = __add_pages(zone, start_pfn, nr_pages);
86 mutex_unlock(&add_spumem_mutex);
87
88 return ret;
89}
90
91static void __iomem * __init map_spe_prop(struct spu *spu,
92 struct device_node *n, const char *name)
93{
94 const struct address_prop {
95 unsigned long address;
96 unsigned int len;
97 } __attribute__((packed)) *prop;
98
99 const void *p;
100 int proplen;
101 void __iomem *ret = NULL;
102 int err = 0;
103
104 p = get_property(n, name, &proplen);
105 if (proplen != sizeof (struct address_prop))
106 return NULL;
107
108 prop = p;
109
110 err = cell_spuprop_present(spu, n, name);
111 if (err && (err != -EEXIST))
112 goto out;
113
114 ret = ioremap(prop->address, prop->len);
115
116 out:
117 return ret;
118}
119
120static void spu_unmap(struct spu *spu)
121{
122 iounmap(spu->priv2);
123 iounmap(spu_get_pdata(spu)->priv1);
124 iounmap(spu->problem);
125 iounmap((__force u8 __iomem *)spu->local_store);
126}
127
128static int __init spu_map_interrupts_old(struct spu *spu,
129 struct device_node *np)
130{
131 unsigned int isrc;
132 const u32 *tmp;
133 int nid;
134
135 /* Get the interrupt source unit from the device-tree */
136 tmp = get_property(np, "isrc", NULL);
137 if (!tmp)
138 return -ENODEV;
139 isrc = tmp[0];
140
141 tmp = get_property(np->parent->parent, "node-id", NULL);
142 if (!tmp) {
143 printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__);
144 nid = spu->node;
145 } else
146 nid = tmp[0];
147
148 /* Add the node number */
149 isrc |= nid << IIC_IRQ_NODE_SHIFT;
150
151 /* Now map interrupts of all 3 classes */
152 spu->irqs[0] = irq_create_mapping(NULL, IIC_IRQ_CLASS_0 | isrc);
153 spu->irqs[1] = irq_create_mapping(NULL, IIC_IRQ_CLASS_1 | isrc);
154 spu->irqs[2] = irq_create_mapping(NULL, IIC_IRQ_CLASS_2 | isrc);
155
156 /* Right now, we only fail if class 2 failed */
157 return spu->irqs[2] == NO_IRQ ? -EINVAL : 0;
158}
159
160static int __init spu_map_device_old(struct spu *spu, struct device_node *node)
161{
162 const char *prop;
163 int ret;
164
165 ret = -ENODEV;
166 spu->name = get_property(node, "name", NULL);
167 if (!spu->name)
168 goto out;
169
170 prop = get_property(node, "local-store", NULL);
171 if (!prop)
172 goto out;
173 spu->local_store_phys = *(unsigned long *)prop;
174
175 /* we use local store as ram, not io memory */
176 spu->local_store = (void __force *)
177 map_spe_prop(spu, node, "local-store");
178 if (!spu->local_store)
179 goto out;
180
181 prop = get_property(node, "problem", NULL);
182 if (!prop)
183 goto out_unmap;
184 spu->problem_phys = *(unsigned long *)prop;
185
186 spu->problem= map_spe_prop(spu, node, "problem");
187 if (!spu->problem)
188 goto out_unmap;
189
190 spu_get_pdata(spu)->priv1= map_spe_prop(spu, node, "priv1");
191
192 spu->priv2= map_spe_prop(spu, node, "priv2");
193 if (!spu->priv2)
194 goto out_unmap;
195 ret = 0;
196 goto out;
197
198out_unmap:
199 spu_unmap(spu);
200out:
201 return ret;
202}
203
204static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
205{
206 struct of_irq oirq;
207 int ret;
208 int i;
209
210 for (i=0; i < 3; i++) {
211 ret = of_irq_map_one(np, i, &oirq);
212 if (ret) {
213 pr_debug("spu_new: failed to get irq %d\n", i);
214 goto err;
215 }
216 ret = -EINVAL;
217 pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0],
218 oirq.controller->full_name);
219 spu->irqs[i] = irq_create_of_mapping(oirq.controller,
220 oirq.specifier, oirq.size);
221 if (spu->irqs[i] == NO_IRQ) {
222 pr_debug("spu_new: failed to map it !\n");
223 goto err;
224 }
225 }
226 return 0;
227
228err:
229 pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier,
230 spu->name);
231 for (; i >= 0; i--) {
232 if (spu->irqs[i] != NO_IRQ)
233 irq_dispose_mapping(spu->irqs[i]);
234 }
235 return ret;
236}
237
238static int spu_map_resource(struct spu *spu, int nr,
239 void __iomem** virt, unsigned long *phys)
240{
241 struct device_node *np = spu_get_pdata(spu)->devnode;
242 unsigned long start_pfn, nr_pages;
243 struct pglist_data *pgdata;
244 struct zone *zone;
245 struct resource resource = { };
246 unsigned long len;
247 int ret;
248
249 ret = of_address_to_resource(np, nr, &resource);
250 if (ret)
251 goto out;
252
253 if (phys)
254 *phys = resource.start;
255 len = resource.end - resource.start + 1;
256 *virt = ioremap(resource.start, len);
257 if (!*virt)
258 ret = -EINVAL;
259
260 start_pfn = resource.start >> PAGE_SHIFT;
261 nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
262
263 pgdata = NODE_DATA(spu->node);
264 zone = pgdata->node_zones;
265
266 /* XXX rethink locking here */
267 mutex_lock(&add_spumem_mutex);
268 ret = __add_pages(zone, start_pfn, nr_pages);
269 mutex_unlock(&add_spumem_mutex);
270
271out:
272 return ret;
273}
274
275static int __init spu_map_device(struct spu *spu)
276{
277 struct device_node *np = spu_get_pdata(spu)->devnode;
278 int ret = -ENODEV;
279
280 spu->name = get_property(np, "name", NULL);
281 if (!spu->name)
282 goto out;
283
284 ret = spu_map_resource(spu, 0, (void __iomem**)&spu->local_store,
285 &spu->local_store_phys);
286 if (ret) {
287 pr_debug("spu_new: failed to map %s resource 0\n",
288 np->full_name);
289 goto out;
290 }
291 ret = spu_map_resource(spu, 1, (void __iomem**)&spu->problem,
292 &spu->problem_phys);
293 if (ret) {
294 pr_debug("spu_new: failed to map %s resource 1\n",
295 np->full_name);
296 goto out_unmap;
297 }
298 ret = spu_map_resource(spu, 2, (void __iomem**)&spu->priv2, NULL);
299 if (ret) {
300 pr_debug("spu_new: failed to map %s resource 2\n",
301 np->full_name);
302 goto out_unmap;
303 }
304 if (!firmware_has_feature(FW_FEATURE_LPAR))
305 ret = spu_map_resource(spu, 3,
306 (void __iomem**)&spu_get_pdata(spu)->priv1, NULL);
307 if (ret) {
308 pr_debug("spu_new: failed to map %s resource 3\n",
309 np->full_name);
310 goto out_unmap;
311 }
312 pr_debug("spu_new: %s maps:\n", np->full_name);
313 pr_debug(" local store : 0x%016lx -> 0x%p\n",
314 spu->local_store_phys, spu->local_store);
315 pr_debug(" problem state : 0x%016lx -> 0x%p\n",
316 spu->problem_phys, spu->problem);
317 pr_debug(" priv2 : 0x%p\n", spu->priv2);
318 pr_debug(" priv1 : 0x%p\n",
319 spu_get_pdata(spu)->priv1);
320
321 return 0;
322
323out_unmap:
324 spu_unmap(spu);
325out:
326 pr_debug("failed to map spe %s: %d\n", spu->name, ret);
327 return ret;
328}
329
330static int __init of_enumerate_spus(int (*fn)(void *data))
331{
332 int ret;
333 struct device_node *node;
334
335 ret = -ENODEV;
336 for (node = of_find_node_by_type(NULL, "spe");
337 node; node = of_find_node_by_type(node, "spe")) {
338 ret = fn(node);
339 if (ret) {
340 printk(KERN_WARNING "%s: Error initializing %s\n",
341 __FUNCTION__, node->name);
342 break;
343 }
344 }
345 return ret;
346}
347
348static int __init of_create_spu(struct spu *spu, void *data)
349{
350 int ret;
351 struct device_node *spe = (struct device_node *)data;
352
353 spu->pdata = kzalloc(sizeof(struct spu_pdata),
354 GFP_KERNEL);
355 if (!spu->pdata) {
356 ret = -ENOMEM;
357 goto out;
358 }
359 spu_get_pdata(spu)->devnode = of_node_get(spe);
360
361 spu->node = of_node_to_nid(spe);
362 if (spu->node >= MAX_NUMNODES) {
363 printk(KERN_WARNING "SPE %s on node %d ignored,"
364 " node number too big\n", spe->full_name, spu->node);
365 printk(KERN_WARNING "Check if CONFIG_NUMA is enabled.\n");
366 ret = -ENODEV;
367 goto out_free;
368 }
369
370 ret = spu_map_device(spu);
371 /* try old method */
372 if (ret)
373 ret = spu_map_device_old(spu, spe);
374 if (ret)
375 goto out_free;
376
377 ret = spu_map_interrupts(spu, spe);
378 if (ret)
379 ret = spu_map_interrupts_old(spu, spe);
380 if (ret)
381 goto out_unmap;
382
383 pr_debug(KERN_DEBUG "Using SPE %s %p %p %p %p %d\n", spu->name,
384 spu->local_store, spu->problem, spu_get_pdata(spu)->priv1,
385 spu->priv2, spu->number);
386 goto out;
387
388out_unmap:
389 spu_unmap(spu);
390out_free:
391 kfree(spu->pdata);
392 spu->pdata = NULL;
393out:
394 return ret;
395}
396
397static int of_destroy_spu(struct spu *spu)
398{
399 spu_unmap(spu);
400 of_node_put(spu_get_pdata(spu)->devnode);
401 kfree(spu->pdata);
402 spu->pdata = NULL;
403 return 0;
404}
405
406const struct spu_management_ops spu_management_of_ops = {
407 .enumerate_spus = of_enumerate_spus,
408 .create_spu = of_create_spu,
409 .destroy_spu = of_destroy_spu,
410};
411
412static void int_mask_and(struct spu *spu, int class, u64 mask) 40static void int_mask_and(struct spu *spu, int class, u64 mask)
413{ 41{
414 u64 old_mask; 42 u64 old_mask;
415 43
416 old_mask = in_be64(&spu_get_pdata(spu)->priv1->int_mask_RW[class]); 44 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
417 out_be64(&spu_get_pdata(spu)->priv1->int_mask_RW[class], 45 out_be64(&spu->priv1->int_mask_RW[class], old_mask & mask);
418 old_mask & mask);
419} 46}
420 47
421static void int_mask_or(struct spu *spu, int class, u64 mask) 48static void int_mask_or(struct spu *spu, int class, u64 mask)
422{ 49{
423 u64 old_mask; 50 u64 old_mask;
424 51
425 old_mask = in_be64(&spu_get_pdata(spu)->priv1->int_mask_RW[class]); 52 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
426 out_be64(&spu_get_pdata(spu)->priv1->int_mask_RW[class], 53 out_be64(&spu->priv1->int_mask_RW[class], old_mask | mask);
427 old_mask | mask);
428} 54}
429 55
430static void int_mask_set(struct spu *spu, int class, u64 mask) 56static void int_mask_set(struct spu *spu, int class, u64 mask)
431{ 57{
432 out_be64(&spu_get_pdata(spu)->priv1->int_mask_RW[class], mask); 58 out_be64(&spu->priv1->int_mask_RW[class], mask);
433} 59}
434 60
435static u64 int_mask_get(struct spu *spu, int class) 61static u64 int_mask_get(struct spu *spu, int class)
436{ 62{
437 return in_be64(&spu_get_pdata(spu)->priv1->int_mask_RW[class]); 63 return in_be64(&spu->priv1->int_mask_RW[class]);
438} 64}
439 65
440static void int_stat_clear(struct spu *spu, int class, u64 stat) 66static void int_stat_clear(struct spu *spu, int class, u64 stat)
441{ 67{
442 out_be64(&spu_get_pdata(spu)->priv1->int_stat_RW[class], stat); 68 out_be64(&spu->priv1->int_stat_RW[class], stat);
443} 69}
444 70
445static u64 int_stat_get(struct spu *spu, int class) 71static u64 int_stat_get(struct spu *spu, int class)
446{ 72{
447 return in_be64(&spu_get_pdata(spu)->priv1->int_stat_RW[class]); 73 return in_be64(&spu->priv1->int_stat_RW[class]);
448} 74}
449 75
450static void cpu_affinity_set(struct spu *spu, int cpu) 76static void cpu_affinity_set(struct spu *spu, int cpu)
451{ 77{
452 u64 target = iic_get_target_id(cpu); 78 u64 target = iic_get_target_id(cpu);
453 u64 route = target << 48 | target << 32 | target << 16; 79 u64 route = target << 48 | target << 32 | target << 16;
454 out_be64(&spu_get_pdata(spu)->priv1->int_route_RW, route); 80 out_be64(&spu->priv1->int_route_RW, route);
455} 81}
456 82
457static u64 mfc_dar_get(struct spu *spu) 83static u64 mfc_dar_get(struct spu *spu)
458{ 84{
459 return in_be64(&spu_get_pdata(spu)->priv1->mfc_dar_RW); 85 return in_be64(&spu->priv1->mfc_dar_RW);
460} 86}
461 87
462static u64 mfc_dsisr_get(struct spu *spu) 88static u64 mfc_dsisr_get(struct spu *spu)
463{ 89{
464 return in_be64(&spu_get_pdata(spu)->priv1->mfc_dsisr_RW); 90 return in_be64(&spu->priv1->mfc_dsisr_RW);
465} 91}
466 92
467static void mfc_dsisr_set(struct spu *spu, u64 dsisr) 93static void mfc_dsisr_set(struct spu *spu, u64 dsisr)
468{ 94{
469 out_be64(&spu_get_pdata(spu)->priv1->mfc_dsisr_RW, dsisr); 95 out_be64(&spu->priv1->mfc_dsisr_RW, dsisr);
470} 96}
471 97
472static void mfc_sdr_setup(struct spu *spu) 98static void mfc_sdr_setup(struct spu *spu)
473{ 99{
474 out_be64(&spu_get_pdata(spu)->priv1->mfc_sdr_RW, mfspr(SPRN_SDR1)); 100 out_be64(&spu->priv1->mfc_sdr_RW, mfspr(SPRN_SDR1));
475} 101}
476 102
477static void mfc_sr1_set(struct spu *spu, u64 sr1) 103static void mfc_sr1_set(struct spu *spu, u64 sr1)
478{ 104{
479 out_be64(&spu_get_pdata(spu)->priv1->mfc_sr1_RW, sr1); 105 out_be64(&spu->priv1->mfc_sr1_RW, sr1);
480} 106}
481 107
482static u64 mfc_sr1_get(struct spu *spu) 108static u64 mfc_sr1_get(struct spu *spu)
483{ 109{
484 return in_be64(&spu_get_pdata(spu)->priv1->mfc_sr1_RW); 110 return in_be64(&spu->priv1->mfc_sr1_RW);
485} 111}
486 112
487static void mfc_tclass_id_set(struct spu *spu, u64 tclass_id) 113static void mfc_tclass_id_set(struct spu *spu, u64 tclass_id)
488{ 114{
489 out_be64(&spu_get_pdata(spu)->priv1->mfc_tclass_id_RW, tclass_id); 115 out_be64(&spu->priv1->mfc_tclass_id_RW, tclass_id);
490} 116}
491 117
492static u64 mfc_tclass_id_get(struct spu *spu) 118static u64 mfc_tclass_id_get(struct spu *spu)
493{ 119{
494 return in_be64(&spu_get_pdata(spu)->priv1->mfc_tclass_id_RW); 120 return in_be64(&spu->priv1->mfc_tclass_id_RW);
495} 121}
496 122
497static void tlb_invalidate(struct spu *spu) 123static void tlb_invalidate(struct spu *spu)
498{ 124{
499 out_be64(&spu_get_pdata(spu)->priv1->tlb_invalidate_entry_W, 0ul); 125 out_be64(&spu->priv1->tlb_invalidate_entry_W, 0ul);
500} 126}
501 127
502static void resource_allocation_groupID_set(struct spu *spu, u64 id) 128static void resource_allocation_groupID_set(struct spu *spu, u64 id)
503{ 129{
504 out_be64(&spu_get_pdata(spu)->priv1->resource_allocation_groupID_RW, 130 out_be64(&spu->priv1->resource_allocation_groupID_RW, id);
505 id);
506} 131}
507 132
508static u64 resource_allocation_groupID_get(struct spu *spu) 133static u64 resource_allocation_groupID_get(struct spu *spu)
509{ 134{
510 return in_be64( 135 return in_be64(&spu->priv1->resource_allocation_groupID_RW);
511 &spu_get_pdata(spu)->priv1->resource_allocation_groupID_RW);
512} 136}
513 137
514static void resource_allocation_enable_set(struct spu *spu, u64 enable) 138static void resource_allocation_enable_set(struct spu *spu, u64 enable)
515{ 139{
516 out_be64(&spu_get_pdata(spu)->priv1->resource_allocation_enable_RW, 140 out_be64(&spu->priv1->resource_allocation_enable_RW, enable);
517 enable);
518} 141}
519 142
520static u64 resource_allocation_enable_get(struct spu *spu) 143static u64 resource_allocation_enable_get(struct spu *spu)
521{ 144{
522 return in_be64( 145 return in_be64(&spu->priv1->resource_allocation_enable_RW);
523 &spu_get_pdata(spu)->priv1->resource_allocation_enable_RW);
524} 146}
525 147
526const struct spu_priv1_ops spu_priv1_mmio_ops = 148const struct spu_priv1_ops spu_priv1_mmio_ops =
diff --git a/arch/powerpc/platforms/celleb/Makefile b/arch/powerpc/platforms/celleb/Makefile
new file mode 100644
index 000000000000..3baf658ac543
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/Makefile
@@ -0,0 +1,9 @@
1obj-y += interrupt.o iommu.o setup.o \
2 htab.o beat.o pci.o \
3 scc_epci.o hvCall.o
4
5obj-$(CONFIG_SMP) += smp.o
6obj-$(CONFIG_PPC_UDBG_BEAT) += udbg_beat.o
7obj-$(CONFIG_USB) += scc_uhc.o
8obj-$(CONFIG_HAS_TXX9_SERIAL) += scc_sio.o
9obj-$(CONFIG_SPU_BASE) += spu_priv1.o
diff --git a/arch/powerpc/platforms/celleb/beat.c b/arch/powerpc/platforms/celleb/beat.c
new file mode 100644
index 000000000000..99341ce8a697
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/beat.c
@@ -0,0 +1,163 @@
1/*
2 * Simple routines for Celleb/Beat
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/module.h>
22#include <linux/init.h>
23#include <linux/err.h>
24#include <linux/rtc.h>
25
26#include <asm/hvconsole.h>
27#include <asm/time.h>
28
29#include "beat_wrapper.h"
30#include "beat.h"
31
32void beat_restart(char *cmd)
33{
34 beat_shutdown_logical_partition(1);
35}
36
37void beat_power_off(void)
38{
39 beat_shutdown_logical_partition(0);
40}
41
42u64 beat_halt_code = 0x1000000000000000UL;
43
44void beat_halt(void)
45{
46 beat_shutdown_logical_partition(beat_halt_code);
47}
48
49int beat_set_rtc_time(struct rtc_time *rtc_time)
50{
51 u64 tim;
52 tim = mktime(rtc_time->tm_year+1900,
53 rtc_time->tm_mon+1, rtc_time->tm_mday,
54 rtc_time->tm_hour, rtc_time->tm_min, rtc_time->tm_sec);
55 if (beat_rtc_write(tim))
56 return -1;
57 return 0;
58}
59
60void beat_get_rtc_time(struct rtc_time *rtc_time)
61{
62 u64 tim;
63
64 if (beat_rtc_read(&tim))
65 tim = 0;
66 to_tm(tim, rtc_time);
67 rtc_time->tm_year -= 1900;
68 rtc_time->tm_mon -= 1;
69}
70
71#define BEAT_NVRAM_SIZE 4096
72
73ssize_t beat_nvram_read(char *buf, size_t count, loff_t *index)
74{
75 unsigned int i;
76 unsigned long len;
77 char *p = buf;
78
79 if (*index >= BEAT_NVRAM_SIZE)
80 return -ENODEV;
81 i = *index;
82 if (i + count > BEAT_NVRAM_SIZE)
83 count = BEAT_NVRAM_SIZE - i;
84
85 for (; count != 0; count -= len) {
86 len = count;
87 if (len > BEAT_NVRW_CNT)
88 len = BEAT_NVRW_CNT;
89 if (beat_eeprom_read(i, len, p)) {
90 return -EIO;
91 }
92
93 p += len;
94 i += len;
95 }
96 *index = i;
97 return p - buf;
98}
99
100ssize_t beat_nvram_write(char *buf, size_t count, loff_t *index)
101{
102 unsigned int i;
103 unsigned long len;
104 char *p = buf;
105
106 if (*index >= BEAT_NVRAM_SIZE)
107 return -ENODEV;
108 i = *index;
109 if (i + count > BEAT_NVRAM_SIZE)
110 count = BEAT_NVRAM_SIZE - i;
111
112 for (; count != 0; count -= len) {
113 len = count;
114 if (len > BEAT_NVRW_CNT)
115 len = BEAT_NVRW_CNT;
116 if (beat_eeprom_write(i, len, p)) {
117 return -EIO;
118 }
119
120 p += len;
121 i += len;
122 }
123 *index = i;
124 return p - buf;
125}
126
127ssize_t beat_nvram_get_size(void)
128{
129 return BEAT_NVRAM_SIZE;
130}
131
132int beat_set_xdabr(unsigned long dabr)
133{
134 if (beat_set_dabr(dabr, DABRX_KERNEL | DABRX_USER))
135 return -1;
136 return 0;
137}
138
139int64_t beat_get_term_char(u64 vterm, u64 *len, u64 *t1, u64 *t2)
140{
141 u64 db[2];
142 s64 ret;
143
144 ret = beat_get_characters_from_console(vterm, len, (u8*)db);
145 if (ret == 0) {
146 *t1 = db[0];
147 *t2 = db[1];
148 }
149 return ret;
150}
151
152int64_t beat_put_term_char(u64 vterm, u64 len, u64 t1, u64 t2)
153{
154 u64 db[2];
155
156 db[0] = t1;
157 db[1] = t2;
158 return beat_put_characters_to_console(vterm, len, (u8*)db);
159}
160
161EXPORT_SYMBOL(beat_get_term_char);
162EXPORT_SYMBOL(beat_put_term_char);
163EXPORT_SYMBOL(beat_halt_code);
diff --git a/arch/powerpc/platforms/celleb/beat.h b/arch/powerpc/platforms/celleb/beat.h
new file mode 100644
index 000000000000..2b16bf3bee89
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/beat.h
@@ -0,0 +1,40 @@
1/*
2 * Guest OS Interfaces.
3 *
4 * (C) Copyright 2006 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef _CELLEB_BEAT_H
22#define _CELLEB_BEAT_H
23
24#define DABRX_KERNEL (1UL<<1)
25#define DABRX_USER (1UL<<0)
26
27int64_t beat_get_term_char(uint64_t,uint64_t*,uint64_t*,uint64_t*);
28int64_t beat_put_term_char(uint64_t,uint64_t,uint64_t,uint64_t);
29int64_t beat_repository_encode(int, const char *, uint64_t[4]);
30void beat_restart(char *);
31void beat_power_off(void);
32void beat_halt(void);
33int beat_set_rtc_time(struct rtc_time *);
34void beat_get_rtc_time(struct rtc_time *);
35ssize_t beat_nvram_get_size(void);
36ssize_t beat_nvram_read(char *, size_t, loff_t *);
37ssize_t beat_nvram_write(char *, size_t, loff_t *);
38int beat_set_xdabr(unsigned long);
39
40#endif /* _CELLEB_BEAT_H */
diff --git a/arch/powerpc/platforms/celleb/beat_syscall.h b/arch/powerpc/platforms/celleb/beat_syscall.h
new file mode 100644
index 000000000000..14e16974773f
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/beat_syscall.h
@@ -0,0 +1,160 @@
1/*
2 * Beat hypervisor call numbers
3 *
4 * (C) Copyright 2004-2007 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef BEAT_BEAT_syscall_H
22#define BEAT_BEAT_syscall_H
23
24#ifdef __ASSEMBLY__
25#define __BEAT_ADD_VENDOR_ID(__x, __v) ((__v)<<60|(__x))
26#else
27#define __BEAT_ADD_VENDOR_ID(__x, __v) ((u64)(__v)<<60|(__x))
28#endif
29#define HV_allocate_memory __BEAT_ADD_VENDOR_ID(0, 0)
30#define HV_construct_virtual_address_space __BEAT_ADD_VENDOR_ID(2, 0)
31#define HV_destruct_virtual_address_space __BEAT_ADD_VENDOR_ID(10, 0)
32#define HV_get_virtual_address_space_id_of_ppe __BEAT_ADD_VENDOR_ID(4, 0)
33#define HV_query_logical_partition_address_region_info \
34 __BEAT_ADD_VENDOR_ID(6, 0)
35#define HV_release_memory __BEAT_ADD_VENDOR_ID(13, 0)
36#define HV_select_virtual_address_space __BEAT_ADD_VENDOR_ID(7, 0)
37#define HV_load_range_registers __BEAT_ADD_VENDOR_ID(68, 0)
38#define HV_set_ppe_l2cache_rmt_entry __BEAT_ADD_VENDOR_ID(70, 0)
39#define HV_set_ppe_tlb_rmt_entry __BEAT_ADD_VENDOR_ID(71, 0)
40#define HV_set_spe_tlb_rmt_entry __BEAT_ADD_VENDOR_ID(72, 0)
41#define HV_get_io_address_translation_fault_info __BEAT_ADD_VENDOR_ID(14, 0)
42#define HV_get_iopte __BEAT_ADD_VENDOR_ID(16, 0)
43#define HV_preload_iopt_cache __BEAT_ADD_VENDOR_ID(17, 0)
44#define HV_put_iopte __BEAT_ADD_VENDOR_ID(15, 0)
45#define HV_connect_event_ports __BEAT_ADD_VENDOR_ID(21, 0)
46#define HV_construct_event_receive_port __BEAT_ADD_VENDOR_ID(18, 0)
47#define HV_destruct_event_receive_port __BEAT_ADD_VENDOR_ID(19, 0)
48#define HV_destruct_event_send_port __BEAT_ADD_VENDOR_ID(22, 0)
49#define HV_get_state_of_event_send_port __BEAT_ADD_VENDOR_ID(25, 0)
50#define HV_request_to_connect_event_ports __BEAT_ADD_VENDOR_ID(20, 0)
51#define HV_send_event_externally __BEAT_ADD_VENDOR_ID(23, 0)
52#define HV_send_event_locally __BEAT_ADD_VENDOR_ID(24, 0)
53#define HV_construct_and_connect_irq_plug __BEAT_ADD_VENDOR_ID(28, 0)
54#define HV_destruct_irq_plug __BEAT_ADD_VENDOR_ID(29, 0)
55#define HV_detect_pending_interrupts __BEAT_ADD_VENDOR_ID(26, 0)
56#define HV_end_of_interrupt __BEAT_ADD_VENDOR_ID(27, 0)
57#define HV_assign_control_signal_notification_port __BEAT_ADD_VENDOR_ID(45, 0)
58#define HV_end_of_control_signal_processing __BEAT_ADD_VENDOR_ID(48, 0)
59#define HV_get_control_signal __BEAT_ADD_VENDOR_ID(46, 0)
60#define HV_set_irq_mask_for_spe __BEAT_ADD_VENDOR_ID(61, 0)
61#define HV_shutdown_logical_partition __BEAT_ADD_VENDOR_ID(44, 0)
62#define HV_connect_message_ports __BEAT_ADD_VENDOR_ID(35, 0)
63#define HV_destruct_message_port __BEAT_ADD_VENDOR_ID(36, 0)
64#define HV_receive_message __BEAT_ADD_VENDOR_ID(37, 0)
65#define HV_get_message_port_info __BEAT_ADD_VENDOR_ID(34, 0)
66#define HV_request_to_connect_message_ports __BEAT_ADD_VENDOR_ID(33, 0)
67#define HV_send_message __BEAT_ADD_VENDOR_ID(32, 0)
68#define HV_get_logical_ppe_id __BEAT_ADD_VENDOR_ID(69, 0)
69#define HV_pause __BEAT_ADD_VENDOR_ID(9, 0)
70#define HV_destruct_shared_memory_handle __BEAT_ADD_VENDOR_ID(51, 0)
71#define HV_get_shared_memory_info __BEAT_ADD_VENDOR_ID(52, 0)
72#define HV_permit_sharing_memory __BEAT_ADD_VENDOR_ID(50, 0)
73#define HV_request_to_attach_shared_memory __BEAT_ADD_VENDOR_ID(49, 0)
74#define HV_enable_logical_spe_execution __BEAT_ADD_VENDOR_ID(55, 0)
75#define HV_construct_logical_spe __BEAT_ADD_VENDOR_ID(53, 0)
76#define HV_disable_logical_spe_execution __BEAT_ADD_VENDOR_ID(56, 0)
77#define HV_destruct_logical_spe __BEAT_ADD_VENDOR_ID(54, 0)
78#define HV_sense_spe_execution_status __BEAT_ADD_VENDOR_ID(58, 0)
79#define HV_insert_htab_entry __BEAT_ADD_VENDOR_ID(101, 0)
80#define HV_read_htab_entries __BEAT_ADD_VENDOR_ID(95, 0)
81#define HV_write_htab_entry __BEAT_ADD_VENDOR_ID(94, 0)
82#define HV_assign_io_address_translation_fault_port \
83 __BEAT_ADD_VENDOR_ID(100, 0)
84#define HV_set_interrupt_mask __BEAT_ADD_VENDOR_ID(73, 0)
85#define HV_get_logical_partition_id __BEAT_ADD_VENDOR_ID(74, 0)
86#define HV_create_repository_node2 __BEAT_ADD_VENDOR_ID(90, 0)
87#define HV_create_repository_node __BEAT_ADD_VENDOR_ID(90, 0) /* alias */
88#define HV_get_repository_node_value2 __BEAT_ADD_VENDOR_ID(91, 0)
89#define HV_get_repository_node_value __BEAT_ADD_VENDOR_ID(91, 0) /* alias */
90#define HV_modify_repository_node_value2 __BEAT_ADD_VENDOR_ID(92, 0)
91#define HV_modify_repository_node_value __BEAT_ADD_VENDOR_ID(92, 0) /* alias */
92#define HV_remove_repository_node2 __BEAT_ADD_VENDOR_ID(93, 0)
93#define HV_remove_repository_node __BEAT_ADD_VENDOR_ID(93, 0) /* alias */
94#define HV_cancel_shared_memory __BEAT_ADD_VENDOR_ID(104, 0)
95#define HV_clear_interrupt_status_of_spe __BEAT_ADD_VENDOR_ID(206, 0)
96#define HV_construct_spe_irq_outlet __BEAT_ADD_VENDOR_ID(80, 0)
97#define HV_destruct_spe_irq_outlet __BEAT_ADD_VENDOR_ID(81, 0)
98#define HV_disconnect_ipspc_service __BEAT_ADD_VENDOR_ID(88, 0)
99#define HV_execute_ipspc_command __BEAT_ADD_VENDOR_ID(86, 0)
100#define HV_get_interrupt_status_of_spe __BEAT_ADD_VENDOR_ID(205, 0)
101#define HV_get_spe_privileged_state_1_registers __BEAT_ADD_VENDOR_ID(208, 0)
102#define HV_permit_use_of_ipspc_service __BEAT_ADD_VENDOR_ID(85, 0)
103#define HV_reinitialize_logical_spe __BEAT_ADD_VENDOR_ID(82, 0)
104#define HV_request_ipspc_service __BEAT_ADD_VENDOR_ID(84, 0)
105#define HV_stop_ipspc_command __BEAT_ADD_VENDOR_ID(87, 0)
106#define HV_set_spe_privileged_state_1_registers __BEAT_ADD_VENDOR_ID(204, 0)
107#define HV_get_status_of_ipspc_service __BEAT_ADD_VENDOR_ID(203, 0)
108#define HV_put_characters_to_console __BEAT_ADD_VENDOR_ID(0x101, 1)
109#define HV_get_characters_from_console __BEAT_ADD_VENDOR_ID(0x102, 1)
110#define HV_get_base_clock __BEAT_ADD_VENDOR_ID(0x111, 1)
111#define HV_set_base_clock __BEAT_ADD_VENDOR_ID(0x112, 1)
112#define HV_get_frame_cycle __BEAT_ADD_VENDOR_ID(0x114, 1)
113#define HV_disable_console __BEAT_ADD_VENDOR_ID(0x115, 1)
114#define HV_disable_all_console __BEAT_ADD_VENDOR_ID(0x116, 1)
115#define HV_oneshot_timer __BEAT_ADD_VENDOR_ID(0x117, 1)
116#define HV_set_dabr __BEAT_ADD_VENDOR_ID(0x118, 1)
117#define HV_get_dabr __BEAT_ADD_VENDOR_ID(0x119, 1)
118#define HV_start_hv_stats __BEAT_ADD_VENDOR_ID(0x21c, 1)
119#define HV_stop_hv_stats __BEAT_ADD_VENDOR_ID(0x21d, 1)
120#define HV_get_hv_stats __BEAT_ADD_VENDOR_ID(0x21e, 1)
121#define HV_get_hv_error_stats __BEAT_ADD_VENDOR_ID(0x221, 1)
122#define HV_get_stats __BEAT_ADD_VENDOR_ID(0x224, 1)
123#define HV_get_heap_stats __BEAT_ADD_VENDOR_ID(0x225, 1)
124#define HV_get_memory_stats __BEAT_ADD_VENDOR_ID(0x227, 1)
125#define HV_get_memory_detail __BEAT_ADD_VENDOR_ID(0x228, 1)
126#define HV_set_priority_of_irq_outlet __BEAT_ADD_VENDOR_ID(0x122, 1)
127#define HV_get_physical_spe_by_reservation_id __BEAT_ADD_VENDOR_ID(0x128, 1)
128#define HV_get_spe_context __BEAT_ADD_VENDOR_ID(0x129, 1)
129#define HV_set_spe_context __BEAT_ADD_VENDOR_ID(0x12a, 1)
130#define HV_downcount_of_interrupt __BEAT_ADD_VENDOR_ID(0x12e, 1)
131#define HV_peek_spe_context __BEAT_ADD_VENDOR_ID(0x12f, 1)
132#define HV_read_bpa_register __BEAT_ADD_VENDOR_ID(0x131, 1)
133#define HV_write_bpa_register __BEAT_ADD_VENDOR_ID(0x132, 1)
134#define HV_map_context_table_of_spe __BEAT_ADD_VENDOR_ID(0x137, 1)
135#define HV_get_slb_for_logical_spe __BEAT_ADD_VENDOR_ID(0x138, 1)
136#define HV_set_slb_for_logical_spe __BEAT_ADD_VENDOR_ID(0x139, 1)
137#define HV_init_pm __BEAT_ADD_VENDOR_ID(0x150, 1)
138#define HV_set_pm_signal __BEAT_ADD_VENDOR_ID(0x151, 1)
139#define HV_get_pm_signal __BEAT_ADD_VENDOR_ID(0x152, 1)
140#define HV_set_pm_config __BEAT_ADD_VENDOR_ID(0x153, 1)
141#define HV_get_pm_config __BEAT_ADD_VENDOR_ID(0x154, 1)
142#define HV_get_inner_trace_data __BEAT_ADD_VENDOR_ID(0x155, 1)
143#define HV_set_ext_trace_buffer __BEAT_ADD_VENDOR_ID(0x156, 1)
144#define HV_get_ext_trace_buffer __BEAT_ADD_VENDOR_ID(0x157, 1)
145#define HV_set_pm_interrupt __BEAT_ADD_VENDOR_ID(0x158, 1)
146#define HV_get_pm_interrupt __BEAT_ADD_VENDOR_ID(0x159, 1)
147#define HV_kick_pm __BEAT_ADD_VENDOR_ID(0x160, 1)
148#define HV_construct_pm_context __BEAT_ADD_VENDOR_ID(0x164, 1)
149#define HV_destruct_pm_context __BEAT_ADD_VENDOR_ID(0x165, 1)
150#define HV_be_slow __BEAT_ADD_VENDOR_ID(0x170, 1)
151#define HV_assign_ipspc_server_connection_status_notification_port \
152 __BEAT_ADD_VENDOR_ID(0x173, 1)
153#define HV_get_raid_of_physical_spe __BEAT_ADD_VENDOR_ID(0x174, 1)
154#define HV_set_physical_spe_to_rag __BEAT_ADD_VENDOR_ID(0x175, 1)
155#define HV_release_physical_spe_from_rag __BEAT_ADD_VENDOR_ID(0x176, 1)
156#define HV_rtc_read __BEAT_ADD_VENDOR_ID(0x190, 1)
157#define HV_rtc_write __BEAT_ADD_VENDOR_ID(0x191, 1)
158#define HV_eeprom_read __BEAT_ADD_VENDOR_ID(0x192, 1)
159#define HV_eeprom_write __BEAT_ADD_VENDOR_ID(0x193, 1)
160#endif
diff --git a/arch/powerpc/platforms/celleb/beat_wrapper.h b/arch/powerpc/platforms/celleb/beat_wrapper.h
new file mode 100644
index 000000000000..76ea0a6a9011
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/beat_wrapper.h
@@ -0,0 +1,220 @@
1/*
2 * Beat hypervisor call I/F
3 *
4 * (C) Copyright 2007 TOSHIBA CORPORATION
5 *
6 * This code is based on arch/powerpc/platforms/pseries/plpar_wrapper.h.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22#ifndef BEAT_HCALL
23#include "beat_syscall.h"
24
25/* defined in hvCall.S */
26extern s64 beat_hcall_norets(u64 opcode, ...);
27extern s64 beat_hcall_norets8(u64 opcode, u64 arg1, u64 arg2, u64 arg3,
28 u64 arg4, u64 arg5, u64 arg6, u64 arg7, u64 arg8);
29extern s64 beat_hcall1(u64 opcode, u64 retbuf[1], ...);
30extern s64 beat_hcall2(u64 opcode, u64 retbuf[2], ...);
31extern s64 beat_hcall3(u64 opcode, u64 retbuf[3], ...);
32extern s64 beat_hcall4(u64 opcode, u64 retbuf[4], ...);
33extern s64 beat_hcall5(u64 opcode, u64 retbuf[5], ...);
34extern s64 beat_hcall6(u64 opcode, u64 retbuf[6], ...);
35
36static inline s64 beat_downcount_of_interrupt(u64 plug_id)
37{
38 return beat_hcall_norets(HV_downcount_of_interrupt, plug_id);
39}
40
41static inline s64 beat_set_interrupt_mask(u64 index,
42 u64 val0, u64 val1, u64 val2, u64 val3)
43{
44 return beat_hcall_norets(HV_set_interrupt_mask, index,
45 val0, val1, val2, val3);
46}
47
48static inline s64 beat_destruct_irq_plug(u64 plug_id)
49{
50 return beat_hcall_norets(HV_destruct_irq_plug, plug_id);
51}
52
53static inline s64 beat_construct_and_connect_irq_plug(u64 plug_id,
54 u64 outlet_id)
55{
56 return beat_hcall_norets(HV_construct_and_connect_irq_plug, plug_id,
57 outlet_id);
58}
59
60static inline s64 beat_detect_pending_interrupts(u64 index, u64 *retbuf)
61{
62 return beat_hcall4(HV_detect_pending_interrupts, retbuf, index);
63}
64
65static inline s64 beat_pause(u64 style)
66{
67 return beat_hcall_norets(HV_pause, style);
68}
69
70static inline s64 beat_read_htab_entries(u64 htab_id, u64 index, u64 *retbuf)
71{
72 return beat_hcall5(HV_read_htab_entries, retbuf, htab_id, index);
73}
74
75static inline s64 beat_insert_htab_entry(u64 htab_id, u64 group,
76 u64 bitmask, u64 hpte_v, u64 hpte_r, u64 *slot)
77{
78 u64 dummy[3];
79 s64 ret;
80
81 ret = beat_hcall3(HV_insert_htab_entry, dummy, htab_id, group,
82 bitmask, hpte_v, hpte_r);
83 *slot = dummy[0];
84 return ret;
85}
86
87static inline s64 beat_write_htab_entry(u64 htab_id, u64 slot,
88 u64 hpte_v, u64 hpte_r, u64 mask_v, u64 mask_r,
89 u64 *ret_v, u64 *ret_r)
90{
91 u64 dummy[2];
92 s64 ret;
93
94 ret = beat_hcall2(HV_write_htab_entry, dummy, htab_id, slot,
95 hpte_v, hpte_r, mask_v, mask_r);
96 *ret_v = dummy[0];
97 *ret_r = dummy[1];
98 return ret;
99}
100
101static inline void beat_shutdown_logical_partition(u64 code)
102{
103 (void)beat_hcall_norets(HV_shutdown_logical_partition, code);
104}
105
106static inline s64 beat_rtc_write(u64 time_from_epoch)
107{
108 return beat_hcall_norets(HV_rtc_write, time_from_epoch);
109}
110
111static inline s64 beat_rtc_read(u64 *time_from_epoch)
112{
113 u64 dummy[1];
114 s64 ret;
115
116 ret = beat_hcall1(HV_rtc_read, dummy);
117 *time_from_epoch = dummy[0];
118 return ret;
119}
120
121#define BEAT_NVRW_CNT (sizeof(u64) * 6)
122
123static inline s64 beat_eeprom_write(u64 index, u64 length, u8 *buffer)
124{
125 u64 b[6];
126
127 if (length > BEAT_NVRW_CNT)
128 return -1;
129 memcpy(b, buffer, sizeof(b));
130 return beat_hcall_norets8(HV_eeprom_write, index, length,
131 b[0], b[1], b[2], b[3], b[4], b[5]);
132}
133
134static inline s64 beat_eeprom_read(u64 index, u64 length, u8 *buffer)
135{
136 u64 b[6];
137 s64 ret;
138
139 if (length > BEAT_NVRW_CNT)
140 return -1;
141 ret = beat_hcall6(HV_eeprom_read, b, index, length);
142 memcpy(buffer, b, length);
143 return ret;
144}
145
146static inline s64 beat_set_dabr(u64 value, u64 style)
147{
148 return beat_hcall_norets(HV_set_dabr, value, style);
149}
150
151static inline s64 beat_get_characters_from_console(u64 termno, u64 *len,
152 u8 *buffer)
153{
154 u64 dummy[3];
155 s64 ret;
156
157 ret = beat_hcall3(HV_get_characters_from_console, dummy, termno, len);
158 *len = dummy[0];
159 memcpy(buffer, dummy + 1, *len);
160 return ret;
161}
162
163static inline s64 beat_put_characters_to_console(u64 termno, u64 len,
164 u8 *buffer)
165{
166 u64 b[2];
167
168 memcpy(b, buffer, len);
169 return beat_hcall_norets(HV_put_characters_to_console, termno, len, b[0], b[1]);
170}
171
172static inline s64 beat_get_spe_privileged_state_1_registers(
173 u64 id, u64 offsetof, u64 *value)
174{
175 u64 dummy[1];
176 s64 ret;
177
178 ret = beat_hcall1(HV_get_spe_privileged_state_1_registers, dummy, id,
179 offsetof);
180 *value = dummy[0];
181 return ret;
182}
183
184static inline s64 beat_set_irq_mask_for_spe(u64 id, u64 class, u64 mask)
185{
186 return beat_hcall_norets(HV_set_irq_mask_for_spe, id, class, mask);
187}
188
189static inline s64 beat_clear_interrupt_status_of_spe(u64 id, u64 class,
190 u64 mask)
191{
192 return beat_hcall_norets(HV_clear_interrupt_status_of_spe,
193 id, class, mask);
194}
195
196static inline s64 beat_set_spe_privileged_state_1_registers(
197 u64 id, u64 offsetof, u64 value)
198{
199 return beat_hcall_norets(HV_set_spe_privileged_state_1_registers,
200 id, offsetof, value);
201}
202
203static inline s64 beat_get_interrupt_status_of_spe(u64 id, u64 class, u64 *val)
204{
205 u64 dummy[1];
206 s64 ret;
207
208 ret = beat_hcall1(HV_get_interrupt_status_of_spe, dummy, id, class);
209 *val = dummy[0];
210 return ret;
211}
212
213static inline s64 beat_put_iopte(u64 ioas_id, u64 io_addr, u64 real_addr,
214 u64 ioid, u64 flags)
215{
216 return beat_hcall_norets(HV_put_iopte, ioas_id, io_addr, real_addr,
217 ioid, flags);
218}
219
220#endif
diff --git a/arch/powerpc/platforms/celleb/htab.c b/arch/powerpc/platforms/celleb/htab.c
new file mode 100644
index 000000000000..ffa7c2c2030d
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/htab.c
@@ -0,0 +1,311 @@
1/*
2 * "Cell Reference Set" HTAB support.
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This code is based on arch/powerpc/platforms/pseries/lpar.c:
7 * Copyright (C) 2001 Todd Inglett, IBM Corporation
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24#undef DEBUG_LOW
25
26#include <linux/kernel.h>
27#include <linux/spinlock.h>
28
29#include <asm/mmu.h>
30#include <asm/page.h>
31#include <asm/pgtable.h>
32#include <asm/machdep.h>
33#include <asm/udbg.h>
34
35#include "beat_wrapper.h"
36
37#ifdef DEBUG_LOW
38#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while(0)
39#else
40#define DBG_LOW(fmt...) do { } while(0)
41#endif
42
43static DEFINE_SPINLOCK(beat_htab_lock);
44
45static inline unsigned int beat_read_mask(unsigned hpte_group)
46{
47 unsigned long hpte_v[5];
48 unsigned long rmask = 0;
49
50 beat_read_htab_entries(0, hpte_group + 0, hpte_v);
51 if (!(hpte_v[0] & HPTE_V_BOLTED))
52 rmask |= 0x8000;
53 if (!(hpte_v[1] & HPTE_V_BOLTED))
54 rmask |= 0x4000;
55 if (!(hpte_v[2] & HPTE_V_BOLTED))
56 rmask |= 0x2000;
57 if (!(hpte_v[3] & HPTE_V_BOLTED))
58 rmask |= 0x1000;
59 beat_read_htab_entries(0, hpte_group + 4, hpte_v);
60 if (!(hpte_v[0] & HPTE_V_BOLTED))
61 rmask |= 0x0800;
62 if (!(hpte_v[1] & HPTE_V_BOLTED))
63 rmask |= 0x0400;
64 if (!(hpte_v[2] & HPTE_V_BOLTED))
65 rmask |= 0x0200;
66 if (!(hpte_v[3] & HPTE_V_BOLTED))
67 rmask |= 0x0100;
68 hpte_group = ~hpte_group & (htab_hash_mask * HPTES_PER_GROUP);
69 beat_read_htab_entries(0, hpte_group + 0, hpte_v);
70 if (!(hpte_v[0] & HPTE_V_BOLTED))
71 rmask |= 0x80;
72 if (!(hpte_v[1] & HPTE_V_BOLTED))
73 rmask |= 0x40;
74 if (!(hpte_v[2] & HPTE_V_BOLTED))
75 rmask |= 0x20;
76 if (!(hpte_v[3] & HPTE_V_BOLTED))
77 rmask |= 0x10;
78 beat_read_htab_entries(0, hpte_group + 4, hpte_v);
79 if (!(hpte_v[0] & HPTE_V_BOLTED))
80 rmask |= 0x08;
81 if (!(hpte_v[1] & HPTE_V_BOLTED))
82 rmask |= 0x04;
83 if (!(hpte_v[2] & HPTE_V_BOLTED))
84 rmask |= 0x02;
85 if (!(hpte_v[3] & HPTE_V_BOLTED))
86 rmask |= 0x01;
87 return rmask;
88}
89
90static long beat_lpar_hpte_insert(unsigned long hpte_group,
91 unsigned long va, unsigned long pa,
92 unsigned long rflags, unsigned long vflags,
93 int psize)
94{
95 unsigned long lpar_rc;
96 unsigned long slot;
97 unsigned long hpte_v, hpte_r;
98 unsigned long flags;
99
100 /* same as iseries */
101 if (vflags & HPTE_V_SECONDARY)
102 return -1;
103
104 if (!(vflags & HPTE_V_BOLTED))
105 DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, "
106 "rflags=%lx, vflags=%lx, psize=%d)\n",
107 hpte_group, va, pa, rflags, vflags, psize);
108
109 hpte_v = hpte_encode_v(va, psize) | vflags | HPTE_V_VALID;
110 hpte_r = hpte_encode_r(pa, psize) | rflags;
111
112 if (!(vflags & HPTE_V_BOLTED))
113 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
114
115 if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE))
116 hpte_r &= ~_PAGE_COHERENT;
117
118 spin_lock_irqsave(&beat_htab_lock, flags);
119 if ((lpar_rc = beat_read_mask(hpte_group)) == 0) {
120 if (!(vflags & HPTE_V_BOLTED))
121 DBG_LOW(" full\n");
122 spin_unlock_irqrestore(&beat_htab_lock, flags);
123 return -1;
124 }
125
126 lpar_rc = beat_insert_htab_entry(0, hpte_group, lpar_rc << 48,
127 hpte_v, hpte_r, &slot);
128 spin_unlock_irqrestore(&beat_htab_lock, flags);
129
130 /*
131 * Since we try and ioremap PHBs we don't own, the pte insert
132 * will fail. However we must catch the failure in hash_page
133 * or we will loop forever, so return -2 in this case.
134 */
135 if (unlikely(lpar_rc != 0)) {
136 if (!(vflags & HPTE_V_BOLTED))
137 DBG_LOW(" lpar err %lx\n", lpar_rc);
138 return -2;
139 }
140 if (!(vflags & HPTE_V_BOLTED))
141 DBG_LOW(" -> slot: %lx\n", slot);
142
143 /* We have to pass down the secondary bucket bit here as well */
144 return (slot ^ hpte_group) & 15;
145}
146
147static long beat_lpar_hpte_remove(unsigned long hpte_group)
148{
149 DBG_LOW("hpte_remove(group=%lx)\n", hpte_group);
150 return -1;
151}
152
153static unsigned long beat_lpar_hpte_getword0(unsigned long slot)
154{
155 unsigned long dword0, dword[5];
156 unsigned long lpar_rc;
157
158 lpar_rc = beat_read_htab_entries(0, slot & ~3UL, dword);
159
160 dword0 = dword[slot&3];
161
162 BUG_ON(lpar_rc != 0);
163
164 return dword0;
165}
166
167static void beat_lpar_hptab_clear(void)
168{
169 unsigned long size_bytes = 1UL << ppc64_pft_size;
170 unsigned long hpte_count = size_bytes >> 4;
171 int i;
172 unsigned long dummy0, dummy1;
173
174 /* TODO: Use bulk call */
175 for (i = 0; i < hpte_count; i++)
176 beat_write_htab_entry(0, i, 0, 0, -1UL, -1UL, &dummy0, &dummy1);
177}
178
179/*
180 * NOTE: for updatepp ops we are fortunate that the linux "newpp" bits and
181 * the low 3 bits of flags happen to line up. So no transform is needed.
182 * We can probably optimize here and assume the high bits of newpp are
183 * already zero. For now I am paranoid.
184 */
185static long beat_lpar_hpte_updatepp(unsigned long slot,
186 unsigned long newpp,
187 unsigned long va,
188 int psize, int local)
189{
190 unsigned long lpar_rc;
191 unsigned long dummy0, dummy1, want_v;
192 unsigned long flags;
193
194 want_v = hpte_encode_v(va, psize);
195
196 DBG_LOW(" update: "
197 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ",
198 want_v & HPTE_V_AVPN, slot, psize, newpp);
199
200 spin_lock_irqsave(&beat_htab_lock, flags);
201 dummy0 = beat_lpar_hpte_getword0(slot);
202 if ((dummy0 & ~0x7FUL) != (want_v & ~0x7FUL)) {
203 DBG_LOW("not found !\n");
204 spin_unlock_irqrestore(&beat_htab_lock, flags);
205 return -1;
206 }
207
208 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, &dummy0,
209 &dummy1);
210 spin_unlock_irqrestore(&beat_htab_lock, flags);
211 if (lpar_rc != 0 || dummy0 == 0) {
212 DBG_LOW("not found !\n");
213 return -1;
214 }
215
216 DBG_LOW("ok %lx %lx\n", dummy0, dummy1);
217
218 BUG_ON(lpar_rc != 0);
219
220 return 0;
221}
222
223static long beat_lpar_hpte_find(unsigned long va, int psize)
224{
225 unsigned long hash;
226 unsigned long i, j;
227 long slot;
228 unsigned long want_v, hpte_v;
229
230 hash = hpt_hash(va, mmu_psize_defs[psize].shift);
231 want_v = hpte_encode_v(va, psize);
232
233 for (j = 0; j < 2; j++) {
234 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
235 for (i = 0; i < HPTES_PER_GROUP; i++) {
236 hpte_v = beat_lpar_hpte_getword0(slot);
237
238 if (HPTE_V_COMPARE(hpte_v, want_v)
239 && (hpte_v & HPTE_V_VALID)
240 && (!!(hpte_v & HPTE_V_SECONDARY) == j)) {
241 /* HPTE matches */
242 if (j)
243 slot = -slot;
244 return slot;
245 }
246 ++slot;
247 }
248 hash = ~hash;
249 }
250
251 return -1;
252}
253
254static void beat_lpar_hpte_updateboltedpp(unsigned long newpp,
255 unsigned long ea,
256 int psize)
257{
258 unsigned long lpar_rc, slot, vsid, va, dummy0, dummy1;
259 unsigned long flags;
260
261 vsid = get_kernel_vsid(ea);
262 va = (vsid << 28) | (ea & 0x0fffffff);
263
264 spin_lock_irqsave(&beat_htab_lock, flags);
265 slot = beat_lpar_hpte_find(va, psize);
266 BUG_ON(slot == -1);
267
268 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7,
269 &dummy0, &dummy1);
270 spin_unlock_irqrestore(&beat_htab_lock, flags);
271
272 BUG_ON(lpar_rc != 0);
273}
274
275static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
276 int psize, int local)
277{
278 unsigned long want_v;
279 unsigned long lpar_rc;
280 unsigned long dummy1, dummy2;
281 unsigned long flags;
282
283 DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n",
284 slot, va, psize, local);
285 want_v = hpte_encode_v(va, psize);
286
287 spin_lock_irqsave(&beat_htab_lock, flags);
288 dummy1 = beat_lpar_hpte_getword0(slot);
289
290 if ((dummy1 & ~0x7FUL) != (want_v & ~0x7FUL)) {
291 DBG_LOW("not found !\n");
292 spin_unlock_irqrestore(&beat_htab_lock, flags);
293 return;
294 }
295
296 lpar_rc = beat_write_htab_entry(0, slot, 0, 0, HPTE_V_VALID, 0,
297 &dummy1, &dummy2);
298 spin_unlock_irqrestore(&beat_htab_lock, flags);
299
300 BUG_ON(lpar_rc != 0);
301}
302
303void __init hpte_init_beat(void)
304{
305 ppc_md.hpte_invalidate = beat_lpar_hpte_invalidate;
306 ppc_md.hpte_updatepp = beat_lpar_hpte_updatepp;
307 ppc_md.hpte_updateboltedpp = beat_lpar_hpte_updateboltedpp;
308 ppc_md.hpte_insert = beat_lpar_hpte_insert;
309 ppc_md.hpte_remove = beat_lpar_hpte_remove;
310 ppc_md.hpte_clear_all = beat_lpar_hptab_clear;
311}
diff --git a/arch/powerpc/platforms/celleb/hvCall.S b/arch/powerpc/platforms/celleb/hvCall.S
new file mode 100644
index 000000000000..74c817448948
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/hvCall.S
@@ -0,0 +1,287 @@
1/*
2 * Beat hypervisor call I/F
3 *
4 * (C) Copyright 2007 TOSHIBA CORPORATION
5 *
6 * This code is based on arch/powerpc/platforms/pseries/hvCall.S.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include <asm/ppc_asm.h>
24
25#define STK_PARM(i) (48 + ((i)-3)*8)
26
27/* Not implemented on Beat, now */
28#define HCALL_INST_PRECALL
29#define HCALL_INST_POSTCALL
30
31 .text
32
33#define HVSC .long 0x44000022
34
35/* Note: takes only 7 input parameters at maximum */
36_GLOBAL(beat_hcall_norets)
37 HMT_MEDIUM
38
39 mfcr r0
40 stw r0,8(r1)
41
42 HCALL_INST_PRECALL
43
44 mr r11,r3
45 mr r3,r4
46 mr r4,r5
47 mr r5,r6
48 mr r6,r7
49 mr r7,r8
50 mr r8,r9
51
52 HVSC /* invoke the hypervisor */
53
54 HCALL_INST_POSTCALL
55
56 lwz r0,8(r1)
57 mtcrf 0xff,r0
58
59 blr /* return r3 = status */
60
61/* Note: takes 8 input parameters at maximum */
62_GLOBAL(beat_hcall_norets8)
63 HMT_MEDIUM
64
65 mfcr r0
66 stw r0,8(r1)
67
68 HCALL_INST_PRECALL
69
70 mr r11,r3
71 mr r3,r4
72 mr r4,r5
73 mr r5,r6
74 mr r6,r7
75 mr r7,r8
76 mr r8,r9
77 ld r10,STK_PARM(r10)(r1)
78
79 HVSC /* invoke the hypervisor */
80
81 HCALL_INST_POSTCALL
82
83 lwz r0,8(r1)
84 mtcrf 0xff,r0
85
86 blr /* return r3 = status */
87
88/* Note: takes only 6 input parameters, 1 output parameters at maximum */
89_GLOBAL(beat_hcall1)
90 HMT_MEDIUM
91
92 mfcr r0
93 stw r0,8(r1)
94
95 HCALL_INST_PRECALL
96
97 std r4,STK_PARM(r4)(r1) /* save ret buffer */
98
99 mr r11,r3
100 mr r3,r5
101 mr r4,r6
102 mr r5,r7
103 mr r6,r8
104 mr r7,r9
105 mr r8,r10
106
107 HVSC /* invoke the hypervisor */
108
109 HCALL_INST_POSTCALL
110
111 ld r12,STK_PARM(r4)(r1)
112 std r4, 0(r12)
113
114 lwz r0,8(r1)
115 mtcrf 0xff,r0
116
117 blr /* return r3 = status */
118
119/* Note: takes only 6 input parameters, 2 output parameters at maximum */
120_GLOBAL(beat_hcall2)
121 HMT_MEDIUM
122
123 mfcr r0
124 stw r0,8(r1)
125
126 HCALL_INST_PRECALL
127
128 std r4,STK_PARM(r4)(r1) /* save ret buffer */
129
130 mr r11,r3
131 mr r3,r5
132 mr r4,r6
133 mr r5,r7
134 mr r6,r8
135 mr r7,r9
136 mr r8,r10
137
138 HVSC /* invoke the hypervisor */
139
140 HCALL_INST_POSTCALL
141
142 ld r12,STK_PARM(r4)(r1)
143 std r4, 0(r12)
144 std r5, 8(r12)
145
146 lwz r0,8(r1)
147 mtcrf 0xff,r0
148
149 blr /* return r3 = status */
150
151/* Note: takes only 6 input parameters, 3 output parameters at maximum */
152_GLOBAL(beat_hcall3)
153 HMT_MEDIUM
154
155 mfcr r0
156 stw r0,8(r1)
157
158 HCALL_INST_PRECALL
159
160 std r4,STK_PARM(r4)(r1) /* save ret buffer */
161
162 mr r11,r3
163 mr r3,r5
164 mr r4,r6
165 mr r5,r7
166 mr r6,r8
167 mr r7,r9
168 mr r8,r10
169
170 HVSC /* invoke the hypervisor */
171
172 HCALL_INST_POSTCALL
173
174 ld r12,STK_PARM(r4)(r1)
175 std r4, 0(r12)
176 std r5, 8(r12)
177 std r6, 16(r12)
178
179 lwz r0,8(r1)
180 mtcrf 0xff,r0
181
182 blr /* return r3 = status */
183
184/* Note: takes only 6 input parameters, 4 output parameters at maximum */
185_GLOBAL(beat_hcall4)
186 HMT_MEDIUM
187
188 mfcr r0
189 stw r0,8(r1)
190
191 HCALL_INST_PRECALL
192
193 std r4,STK_PARM(r4)(r1) /* save ret buffer */
194
195 mr r11,r3
196 mr r3,r5
197 mr r4,r6
198 mr r5,r7
199 mr r6,r8
200 mr r7,r9
201 mr r8,r10
202
203 HVSC /* invoke the hypervisor */
204
205 HCALL_INST_POSTCALL
206
207 ld r12,STK_PARM(r4)(r1)
208 std r4, 0(r12)
209 std r5, 8(r12)
210 std r6, 16(r12)
211 std r7, 24(r12)
212
213 lwz r0,8(r1)
214 mtcrf 0xff,r0
215
216 blr /* return r3 = status */
217
218/* Note: takes only 6 input parameters, 5 output parameters at maximum */
219_GLOBAL(beat_hcall5)
220 HMT_MEDIUM
221
222 mfcr r0
223 stw r0,8(r1)
224
225 HCALL_INST_PRECALL
226
227 std r4,STK_PARM(r4)(r1) /* save ret buffer */
228
229 mr r11,r3
230 mr r3,r5
231 mr r4,r6
232 mr r5,r7
233 mr r6,r8
234 mr r7,r9
235 mr r8,r10
236
237 HVSC /* invoke the hypervisor */
238
239 HCALL_INST_POSTCALL
240
241 ld r12,STK_PARM(r4)(r1)
242 std r4, 0(r12)
243 std r5, 8(r12)
244 std r6, 16(r12)
245 std r7, 24(r12)
246 std r8, 32(r12)
247
248 lwz r0,8(r1)
249 mtcrf 0xff,r0
250
251 blr /* return r3 = status */
252
253/* Note: takes only 6 input parameters, 6 output parameters at maximum */
254_GLOBAL(beat_hcall6)
255 HMT_MEDIUM
256
257 mfcr r0
258 stw r0,8(r1)
259
260 HCALL_INST_PRECALL
261
262 std r4,STK_PARM(r4)(r1) /* save ret buffer */
263
264 mr r11,r3
265 mr r3,r5
266 mr r4,r6
267 mr r5,r7
268 mr r6,r8
269 mr r7,r9
270 mr r8,r10
271
272 HVSC /* invoke the hypervisor */
273
274 HCALL_INST_POSTCALL
275
276 ld r12,STK_PARM(r4)(r1)
277 std r4, 0(r12)
278 std r5, 8(r12)
279 std r6, 16(r12)
280 std r7, 24(r12)
281 std r8, 32(r12)
282 std r9, 40(r12)
283
284 lwz r0,8(r1)
285 mtcrf 0xff,r0
286
287 blr /* return r3 = status */
diff --git a/arch/powerpc/platforms/celleb/interrupt.c b/arch/powerpc/platforms/celleb/interrupt.c
new file mode 100644
index 000000000000..98e6665681d3
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/interrupt.c
@@ -0,0 +1,274 @@
1/*
2 * Celleb/Beat Interrupt controller
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/percpu.h>
25#include <linux/types.h>
26
27#include <asm/machdep.h>
28
29#include "interrupt.h"
30#include "beat_wrapper.h"
31
32#define MAX_IRQS NR_IRQS
33static DEFINE_SPINLOCK(beatic_irq_mask_lock);
34static uint64_t beatic_irq_mask_enable[(MAX_IRQS+255)/64];
35static uint64_t beatic_irq_mask_ack[(MAX_IRQS+255)/64];
36
37static struct irq_host *beatic_host = NULL;
38
39/*
40 * In this implementation, "virq" == "IRQ plug number",
41 * "(irq_hw_number_t)hwirq" == "IRQ outlet number".
42 */
43
44/* assumption: locked */
45static inline void beatic_update_irq_mask(unsigned int irq_plug)
46{
47 int off;
48 unsigned long masks[4];
49
50 off = (irq_plug / 256) * 4;
51 masks[0] = beatic_irq_mask_enable[off + 0]
52 & beatic_irq_mask_ack[off + 0];
53 masks[1] = beatic_irq_mask_enable[off + 1]
54 & beatic_irq_mask_ack[off + 1];
55 masks[2] = beatic_irq_mask_enable[off + 2]
56 & beatic_irq_mask_ack[off + 2];
57 masks[3] = beatic_irq_mask_enable[off + 3]
58 & beatic_irq_mask_ack[off + 3];
59 if (beat_set_interrupt_mask(irq_plug&~255UL,
60 masks[0], masks[1], masks[2], masks[3]) != 0)
61 panic("Failed to set mask IRQ!");
62}
63
64static void beatic_mask_irq(unsigned int irq_plug)
65{
66 unsigned long flags;
67
68 spin_lock_irqsave(&beatic_irq_mask_lock, flags);
69 beatic_irq_mask_enable[irq_plug/64] &= ~(1UL << (63 - (irq_plug%64)));
70 beatic_update_irq_mask(irq_plug);
71 spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
72}
73
74static void beatic_unmask_irq(unsigned int irq_plug)
75{
76 unsigned long flags;
77
78 spin_lock_irqsave(&beatic_irq_mask_lock, flags);
79 beatic_irq_mask_enable[irq_plug/64] |= 1UL << (63 - (irq_plug%64));
80 beatic_update_irq_mask(irq_plug);
81 spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
82}
83
84static void beatic_ack_irq(unsigned int irq_plug)
85{
86 unsigned long flags;
87
88 spin_lock_irqsave(&beatic_irq_mask_lock, flags);
89 beatic_irq_mask_ack[irq_plug/64] &= ~(1UL << (63 - (irq_plug%64)));
90 beatic_update_irq_mask(irq_plug);
91 spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
92}
93
94static void beatic_end_irq(unsigned int irq_plug)
95{
96 s64 err;
97 unsigned long flags;
98
99 if ((err = beat_downcount_of_interrupt(irq_plug)) != 0) {
100 if ((err & 0xFFFFFFFF) != 0xFFFFFFF5) /* -11: wrong state */
101 panic("Failed to downcount IRQ! Error = %16lx", err);
102
103 printk(KERN_ERR "IRQ over-downcounted, plug %d\n", irq_plug);
104 }
105 spin_lock_irqsave(&beatic_irq_mask_lock, flags);
106 beatic_irq_mask_ack[irq_plug/64] |= 1UL << (63 - (irq_plug%64));
107 beatic_update_irq_mask(irq_plug);
108 spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
109}
110
111static struct irq_chip beatic_pic = {
112 .typename = " CELL-BEAT ",
113 .unmask = beatic_unmask_irq,
114 .mask = beatic_mask_irq,
115 .eoi = beatic_end_irq,
116};
117
118/*
119 * Dispose binding hardware IRQ number (hw) and Virtuql IRQ number (virq),
120 * update flags.
121 *
122 * Note that the number (virq) is already assigned at upper layer.
123 */
124static void beatic_pic_host_unmap(struct irq_host *h, unsigned int virq)
125{
126 beat_destruct_irq_plug(virq);
127}
128
129/*
130 * Create or update binding hardware IRQ number (hw) and Virtuql
131 * IRQ number (virq). This is called only once for a given mapping.
132 *
133 * Note that the number (virq) is already assigned at upper layer.
134 */
135static int beatic_pic_host_map(struct irq_host *h, unsigned int virq,
136 irq_hw_number_t hw)
137{
138 struct irq_desc *desc = get_irq_desc(virq);
139 int64_t err;
140
141 if ((err = beat_construct_and_connect_irq_plug(virq, hw)) < 0)
142 return -EIO;
143
144 desc->status |= IRQ_LEVEL;
145 set_irq_chip_and_handler(virq, &beatic_pic, handle_fasteoi_irq);
146 return 0;
147}
148
149/*
150 * Update binding hardware IRQ number (hw) and Virtuql
151 * IRQ number (virq). This is called only once for a given mapping.
152 */
153static void beatic_pic_host_remap(struct irq_host *h, unsigned int virq,
154 irq_hw_number_t hw)
155{
156 beat_construct_and_connect_irq_plug(virq, hw);
157}
158
159/*
160 * Translate device-tree interrupt spec to irq_hw_number_t style (ulong),
161 * to pass away to irq_create_mapping().
162 *
163 * Called from irq_create_of_mapping() only.
164 * Note: We have only 1 entry to translate.
165 */
166static int beatic_pic_host_xlate(struct irq_host *h, struct device_node *ct,
167 u32 *intspec, unsigned int intsize,
168 irq_hw_number_t *out_hwirq,
169 unsigned int *out_flags)
170{
171 u64 *intspec2 = (u64 *)intspec;
172
173 *out_hwirq = *intspec2;
174 *out_flags |= IRQ_TYPE_LEVEL_LOW;
175 return 0;
176}
177
178static struct irq_host_ops beatic_pic_host_ops = {
179 .map = beatic_pic_host_map,
180 .remap = beatic_pic_host_remap,
181 .unmap = beatic_pic_host_unmap,
182 .xlate = beatic_pic_host_xlate,
183};
184
185/*
186 * Get an IRQ number
187 * Note: returns VIRQ
188 */
189static inline unsigned int beatic_get_irq_plug(void)
190{
191 int i;
192 uint64_t pending[4], ub;
193
194 for (i = 0; i < MAX_IRQS; i += 256) {
195 beat_detect_pending_interrupts(i, pending);
196 __asm__ ("cntlzd %0,%1":"=r"(ub):
197 "r"(pending[0] & beatic_irq_mask_enable[i/64+0]
198 & beatic_irq_mask_ack[i/64+0]));
199 if (ub != 64)
200 return i + ub + 0;
201 __asm__ ("cntlzd %0,%1":"=r"(ub):
202 "r"(pending[1] & beatic_irq_mask_enable[i/64+1]
203 & beatic_irq_mask_ack[i/64+1]));
204 if (ub != 64)
205 return i + ub + 64;
206 __asm__ ("cntlzd %0,%1":"=r"(ub):
207 "r"(pending[2] & beatic_irq_mask_enable[i/64+2]
208 & beatic_irq_mask_ack[i/64+2]));
209 if (ub != 64)
210 return i + ub + 128;
211 __asm__ ("cntlzd %0,%1":"=r"(ub):
212 "r"(pending[3] & beatic_irq_mask_enable[i/64+3]
213 & beatic_irq_mask_ack[i/64+3]));
214 if (ub != 64)
215 return i + ub + 192;
216 }
217
218 return NO_IRQ;
219}
220unsigned int beatic_get_irq(void)
221{
222 unsigned int ret;
223
224 ret = beatic_get_irq_plug();
225 if (ret != NO_IRQ)
226 beatic_ack_irq(ret);
227 return ret;
228}
229
230/*
231 */
232void __init beatic_init_IRQ(void)
233{
234 int i;
235
236 memset(beatic_irq_mask_enable, 0, sizeof(beatic_irq_mask_enable));
237 memset(beatic_irq_mask_ack, 255, sizeof(beatic_irq_mask_ack));
238 for (i = 0; i < MAX_IRQS; i += 256)
239 beat_set_interrupt_mask(i, 0L, 0L, 0L, 0L);
240
241 /* Set out get_irq function */
242 ppc_md.get_irq = beatic_get_irq;
243
244 /* Allocate an irq host */
245 beatic_host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0,
246 &beatic_pic_host_ops,
247 0);
248 BUG_ON(beatic_host == NULL);
249 irq_set_default_host(beatic_host);
250}
251
252#ifdef CONFIG_SMP
253
254/* Nullified to compile with SMP mode */
255void beatic_setup_cpu(int cpu)
256{
257}
258
259void beatic_cause_IPI(int cpu, int mesg)
260{
261}
262
263void beatic_request_IPIs(void)
264{
265}
266#endif /* CONFIG_SMP */
267
268void beatic_deinit_IRQ(void)
269{
270 int i;
271
272 for (i = 1; i < NR_IRQS; i++)
273 beat_destruct_irq_plug(i);
274}
diff --git a/arch/powerpc/platforms/celleb/interrupt.h b/arch/powerpc/platforms/celleb/interrupt.h
new file mode 100644
index 000000000000..b470fd0051f1
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/interrupt.h
@@ -0,0 +1,33 @@
1/*
2 * Celleb/Beat Interrupt controller
3 *
4 * (C) Copyright 2006 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef ASM_BEAT_PIC_H
22#define ASM_BEAT_PIC_H
23#ifdef __KERNEL__
24
25extern void beatic_init_IRQ(void);
26extern unsigned int beatic_get_irq(void);
27extern void beatic_cause_IPI(int cpu, int mesg);
28extern void beatic_request_IPIs(void);
29extern void beatic_setup_cpu(int);
30extern void beatic_deinit_IRQ(void);
31
32#endif
33#endif /* ASM_BEAT_PIC_H */
diff --git a/arch/powerpc/platforms/celleb/iommu.c b/arch/powerpc/platforms/celleb/iommu.c
new file mode 100644
index 000000000000..f63b94c65353
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/iommu.c
@@ -0,0 +1,104 @@
1/*
2 * Support for IOMMU on Celleb platform.
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/dma-mapping.h>
24#include <linux/pci.h>
25
26#include <asm/of_platform.h>
27
28#include "beat_wrapper.h"
29
30#define DMA_FLAGS 0xf800000000000000UL /* r/w permitted, coherency required,
31 strongest order */
32
33static int __init find_dma_window(u64 *io_space_id, u64 *ioid,
34 u64 *base, u64 *size, u64 *io_page_size)
35{
36 struct device_node *dn;
37 const unsigned long *dma_window;
38
39 for_each_node_by_type(dn, "ioif") {
40 dma_window = get_property(dn, "toshiba,dma-window", NULL);
41 if (dma_window) {
42 *io_space_id = (dma_window[0] >> 32) & 0xffffffffUL;
43 *ioid = dma_window[0] & 0x7ffUL;
44 *base = dma_window[1];
45 *size = dma_window[2];
46 *io_page_size = 1 << dma_window[3];
47 of_node_put(dn);
48 return 1;
49 }
50 }
51 return 0;
52}
53
54static void __init celleb_init_direct_mapping(void)
55{
56 u64 lpar_addr, io_addr;
57 u64 io_space_id, ioid, dma_base, dma_size, io_page_size;
58
59 if (!find_dma_window(&io_space_id, &ioid, &dma_base, &dma_size,
60 &io_page_size)) {
61 pr_info("No dma window found !\n");
62 return;
63 }
64
65 for (lpar_addr = 0; lpar_addr < dma_size; lpar_addr += io_page_size) {
66 io_addr = lpar_addr + dma_base;
67 (void)beat_put_iopte(io_space_id, io_addr, lpar_addr,
68 ioid, DMA_FLAGS);
69 }
70
71 dma_direct_offset = dma_base;
72}
73
74static int celleb_of_bus_notify(struct notifier_block *nb,
75 unsigned long action, void *data)
76{
77 struct device *dev = data;
78
79 /* We are only intereted in device addition */
80 if (action != BUS_NOTIFY_ADD_DEVICE)
81 return 0;
82
83 dev->archdata.dma_ops = pci_dma_ops;
84
85 return 0;
86}
87
88static struct notifier_block celleb_of_bus_notifier = {
89 .notifier_call = celleb_of_bus_notify
90};
91
92static int __init celleb_init_iommu(void)
93{
94 if (!machine_is(celleb))
95 return -ENODEV;
96
97 celleb_init_direct_mapping();
98 pci_dma_ops = &dma_direct_ops;
99 bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier);
100
101 return 0;
102}
103
104arch_initcall(celleb_init_iommu);
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c
new file mode 100644
index 000000000000..98de836dfed3
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/pci.c
@@ -0,0 +1,481 @@
1/*
2 * Support for PCI on Celleb platform.
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This code is based on arch/powerpc/kernel/rtas_pci.c:
7 * Copyright (C) 2001 Dave Engebretsen, IBM Corporation
8 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 */
24
25#undef DEBUG
26
27#include <linux/kernel.h>
28#include <linux/threads.h>
29#include <linux/pci.h>
30#include <linux/string.h>
31#include <linux/init.h>
32#include <linux/bootmem.h>
33#include <linux/pci_regs.h>
34
35#include <asm/io.h>
36#include <asm/irq.h>
37#include <asm/prom.h>
38#include <asm/machdep.h>
39#include <asm/pci-bridge.h>
40#include <asm/ppc-pci.h>
41
42#include "pci.h"
43#include "interrupt.h"
44
45#define MAX_PCI_DEVICES 32
46#define MAX_PCI_FUNCTIONS 8
47#define MAX_PCI_BASE_ADDRS 3 /* use 64 bit address */
48
49/* definition for fake pci configuration area for GbE, .... ,and etc. */
50
51struct celleb_pci_resource {
52 struct resource r[MAX_PCI_BASE_ADDRS];
53};
54
55struct celleb_pci_private {
56 unsigned char *fake_config[MAX_PCI_DEVICES][MAX_PCI_FUNCTIONS];
57 struct celleb_pci_resource *res[MAX_PCI_DEVICES][MAX_PCI_FUNCTIONS];
58};
59
60static inline u8 celleb_fake_config_readb(void *addr)
61{
62 u8 *p = addr;
63 return *p;
64}
65
66static inline u16 celleb_fake_config_readw(void *addr)
67{
68 __le16 *p = addr;
69 return le16_to_cpu(*p);
70}
71
72static inline u32 celleb_fake_config_readl(void *addr)
73{
74 __le32 *p = addr;
75 return le32_to_cpu(*p);
76}
77
78static inline void celleb_fake_config_writeb(u32 val, void *addr)
79{
80 u8 *p = addr;
81 *p = val;
82}
83
84static inline void celleb_fake_config_writew(u32 val, void *addr)
85{
86 __le16 val16;
87 __le16 *p = addr;
88 val16 = cpu_to_le16(val);
89 *p = val16;
90}
91
92static inline void celleb_fake_config_writel(u32 val, void *addr)
93{
94 __le32 val32;
95 __le32 *p = addr;
96 val32 = cpu_to_le32(val);
97 *p = val32;
98}
99
100static unsigned char *get_fake_config_start(struct pci_controller *hose,
101 int devno, int fn)
102{
103 struct celleb_pci_private *private = hose->private_data;
104
105 if (private == NULL)
106 return NULL;
107
108 return private->fake_config[devno][fn];
109}
110
111static struct celleb_pci_resource *get_resource_start(
112 struct pci_controller *hose,
113 int devno, int fn)
114{
115 struct celleb_pci_private *private = hose->private_data;
116
117 if (private == NULL)
118 return NULL;
119
120 return private->res[devno][fn];
121}
122
123
124static void celleb_config_read_fake(unsigned char *config, int where,
125 int size, u32 *val)
126{
127 char *p = config + where;
128
129 switch (size) {
130 case 1:
131 *val = celleb_fake_config_readb(p);
132 break;
133 case 2:
134 *val = celleb_fake_config_readw(p);
135 break;
136 case 4:
137 *val = celleb_fake_config_readl(p);
138 break;
139 }
140
141 return;
142}
143
144static void celleb_config_write_fake(unsigned char *config, int where,
145 int size, u32 val)
146{
147 char *p = config + where;
148
149 switch (size) {
150 case 1:
151 celleb_fake_config_writeb(val, p);
152 break;
153 case 2:
154 celleb_fake_config_writew(val, p);
155 break;
156 case 4:
157 celleb_fake_config_writel(val, p);
158 break;
159 }
160 return;
161}
162
163static int celleb_fake_pci_read_config(struct pci_bus *bus,
164 unsigned int devfn, int where, int size, u32 *val)
165{
166 char *config;
167 struct device_node *node;
168 struct pci_controller *hose;
169 unsigned int devno = devfn >> 3;
170 unsigned int fn = devfn & 0x7;
171
172 /* allignment check */
173 BUG_ON(where % size);
174
175 pr_debug(" fake read: bus=0x%x, ", bus->number);
176 node = (struct device_node *)bus->sysdata;
177 hose = pci_find_hose_for_OF_device(node);
178 config = get_fake_config_start(hose, devno, fn);
179
180 pr_debug("devno=0x%x, where=0x%x, size=0x%x, ", devno, where, size);
181 if (!config) {
182 pr_debug("failed\n");
183 return PCIBIOS_DEVICE_NOT_FOUND;
184 }
185
186 celleb_config_read_fake(config, where, size, val);
187 pr_debug("val=0x%x\n", *val);
188
189 return PCIBIOS_SUCCESSFUL;
190}
191
192
193static int celleb_fake_pci_write_config(struct pci_bus *bus,
194 unsigned int devfn, int where, int size, u32 val)
195{
196 char *config;
197 struct device_node *node;
198 struct pci_controller *hose;
199 struct celleb_pci_resource *res;
200 unsigned int devno = devfn >> 3;
201 unsigned int fn = devfn & 0x7;
202
203 /* allignment check */
204 BUG_ON(where % size);
205
206 node = (struct device_node *)bus->sysdata;
207 hose = pci_find_hose_for_OF_device(node);
208 config = get_fake_config_start(hose, devno, fn);
209
210 if (!config)
211 return PCIBIOS_DEVICE_NOT_FOUND;
212
213 if (val == ~0) {
214 int i = (where - PCI_BASE_ADDRESS_0) >> 3;
215
216 switch (where) {
217 case PCI_BASE_ADDRESS_0:
218 case PCI_BASE_ADDRESS_2:
219 if (size != 4)
220 return PCIBIOS_DEVICE_NOT_FOUND;
221 res = get_resource_start(hose, devno, fn);
222 if (!res)
223 return PCIBIOS_DEVICE_NOT_FOUND;
224 celleb_config_write_fake(config, where, size,
225 (res->r[i].end - res->r[i].start));
226 return PCIBIOS_SUCCESSFUL;
227 case PCI_BASE_ADDRESS_1:
228 case PCI_BASE_ADDRESS_3:
229 case PCI_BASE_ADDRESS_4:
230 case PCI_BASE_ADDRESS_5:
231 break;
232 default:
233 break;
234 }
235 }
236
237 celleb_config_write_fake(config, where, size, val);
238 pr_debug(" fake write: where=%x, size=%d, val=%x\n",
239 where, size, val);
240
241 return PCIBIOS_SUCCESSFUL;
242}
243
244static struct pci_ops celleb_fake_pci_ops = {
245 celleb_fake_pci_read_config,
246 celleb_fake_pci_write_config
247};
248
249static inline void celleb_setup_pci_base_addrs(struct pci_controller *hose,
250 unsigned int devno, unsigned int fn,
251 unsigned int num_base_addr)
252{
253 u32 val;
254 unsigned char *config;
255 struct celleb_pci_resource *res;
256
257 config = get_fake_config_start(hose, devno, fn);
258 res = get_resource_start(hose, devno, fn);
259
260 if (!config || !res)
261 return;
262
263 switch (num_base_addr) {
264 case 3:
265 val = (res->r[2].start & 0xfffffff0)
266 | PCI_BASE_ADDRESS_MEM_TYPE_64;
267 celleb_config_write_fake(config, PCI_BASE_ADDRESS_4, 4, val);
268 val = res->r[2].start >> 32;
269 celleb_config_write_fake(config, PCI_BASE_ADDRESS_5, 4, val);
270 /* FALLTHROUGH */
271 case 2:
272 val = (res->r[1].start & 0xfffffff0)
273 | PCI_BASE_ADDRESS_MEM_TYPE_64;
274 celleb_config_write_fake(config, PCI_BASE_ADDRESS_2, 4, val);
275 val = res->r[1].start >> 32;
276 celleb_config_write_fake(config, PCI_BASE_ADDRESS_3, 4, val);
277 /* FALLTHROUGH */
278 case 1:
279 val = (res->r[0].start & 0xfffffff0)
280 | PCI_BASE_ADDRESS_MEM_TYPE_64;
281 celleb_config_write_fake(config, PCI_BASE_ADDRESS_0, 4, val);
282 val = res->r[0].start >> 32;
283 celleb_config_write_fake(config, PCI_BASE_ADDRESS_1, 4, val);
284 break;
285 }
286
287 val = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
288 celleb_config_write_fake(config, PCI_COMMAND, 2, val);
289}
290
291static int __devinit celleb_setup_fake_pci_device(struct device_node *node,
292 struct pci_controller *hose)
293{
294 unsigned int rlen;
295 int num_base_addr = 0;
296 u32 val;
297 const u32 *wi0, *wi1, *wi2, *wi3, *wi4;
298 unsigned int devno, fn;
299 struct celleb_pci_private *private = hose->private_data;
300 unsigned char **config = NULL;
301 struct celleb_pci_resource **res = NULL;
302 const char *name;
303 const unsigned long *li;
304 int size, result;
305
306 if (private == NULL) {
307 printk(KERN_ERR "PCI: "
308 "memory space for pci controller is not assigned\n");
309 goto error;
310 }
311
312 name = get_property(node, "model", &rlen);
313 if (!name) {
314 printk(KERN_ERR "PCI: model property not found.\n");
315 goto error;
316 }
317
318 wi4 = get_property(node, "reg", &rlen);
319 if (wi4 == NULL)
320 goto error;
321
322 devno = ((wi4[0] >> 8) & 0xff) >> 3;
323 fn = (wi4[0] >> 8) & 0x7;
324
325 pr_debug("PCI: celleb_setup_fake_pci() %s devno=%x fn=%x\n", name,
326 devno, fn);
327
328 size = 256;
329 config = &private->fake_config[devno][fn];
330 if (mem_init_done)
331 *config = kzalloc(size, GFP_KERNEL);
332 else
333 *config = alloc_bootmem(size);
334 if (*config == NULL) {
335 printk(KERN_ERR "PCI: "
336 "not enough memory for fake configuration space\n");
337 goto error;
338 }
339 pr_debug("PCI: fake config area assigned 0x%016lx\n",
340 (unsigned long)*config);
341
342 size = sizeof(struct celleb_pci_resource);
343 res = &private->res[devno][fn];
344 if (mem_init_done)
345 *res = kzalloc(size, GFP_KERNEL);
346 else
347 *res = alloc_bootmem(size);
348 if (*res == NULL) {
349 printk(KERN_ERR
350 "PCI: not enough memory for resource data space\n");
351 goto error;
352 }
353 pr_debug("PCI: res assigned 0x%016lx\n", (unsigned long)*res);
354
355 wi0 = get_property(node, "device-id", NULL);
356 wi1 = get_property(node, "vendor-id", NULL);
357 wi2 = get_property(node, "class-code", NULL);
358 wi3 = get_property(node, "revision-id", NULL);
359
360 celleb_config_write_fake(*config, PCI_DEVICE_ID, 2, wi0[0] & 0xffff);
361 celleb_config_write_fake(*config, PCI_VENDOR_ID, 2, wi1[0] & 0xffff);
362 pr_debug("class-code = 0x%08x\n", wi2[0]);
363
364 celleb_config_write_fake(*config, PCI_CLASS_PROG, 1, wi2[0] & 0xff);
365 celleb_config_write_fake(*config, PCI_CLASS_DEVICE, 2,
366 (wi2[0] >> 8) & 0xffff);
367 celleb_config_write_fake(*config, PCI_REVISION_ID, 1, wi3[0]);
368
369 while (num_base_addr < MAX_PCI_BASE_ADDRS) {
370 result = of_address_to_resource(node,
371 num_base_addr, &(*res)->r[num_base_addr]);
372 if (result)
373 break;
374 num_base_addr++;
375 }
376
377 celleb_setup_pci_base_addrs(hose, devno, fn, num_base_addr);
378
379 li = get_property(node, "interrupts", &rlen);
380 val = li[0];
381 celleb_config_write_fake(*config, PCI_INTERRUPT_PIN, 1, 1);
382 celleb_config_write_fake(*config, PCI_INTERRUPT_LINE, 1, val);
383
384#ifdef DEBUG
385 pr_debug("PCI: %s irq=%ld\n", name, li[0]);
386 for (i = 0; i < 6; i++) {
387 celleb_config_read_fake(*config,
388 PCI_BASE_ADDRESS_0 + 0x4 * i, 4,
389 &val);
390 pr_debug("PCI: %s fn=%d base_address_%d=0x%x\n",
391 name, fn, i, val);
392 }
393#endif
394
395 celleb_config_write_fake(*config, PCI_HEADER_TYPE, 1,
396 PCI_HEADER_TYPE_NORMAL);
397
398 return 0;
399
400error:
401 if (mem_init_done) {
402 if (config && *config)
403 kfree(*config);
404 if (res && *res)
405 kfree(*res);
406
407 } else {
408 if (config && *config) {
409 size = 256;
410 free_bootmem((unsigned long)(*config), size);
411 }
412 if (res && *res) {
413 size = sizeof(struct celleb_pci_resource);
414 free_bootmem((unsigned long)(*res), size);
415 }
416 }
417
418 return 1;
419}
420
421static int __devinit phb_set_bus_ranges(struct device_node *dev,
422 struct pci_controller *phb)
423{
424 const int *bus_range;
425 unsigned int len;
426
427 bus_range = get_property(dev, "bus-range", &len);
428 if (bus_range == NULL || len < 2 * sizeof(int))
429 return 1;
430
431 phb->first_busno = bus_range[0];
432 phb->last_busno = bus_range[1];
433
434 return 0;
435}
436
437static void __devinit celleb_alloc_private_mem(struct pci_controller *hose)
438{
439 if (mem_init_done)
440 hose->private_data =
441 kzalloc(sizeof(struct celleb_pci_private), GFP_KERNEL);
442 else
443 hose->private_data =
444 alloc_bootmem(sizeof(struct celleb_pci_private));
445}
446
447int __devinit celleb_setup_phb(struct pci_controller *phb)
448{
449 const char *name;
450 struct device_node *dev = phb->arch_data;
451 struct device_node *node;
452 unsigned int rlen;
453
454 name = get_property(dev, "name", &rlen);
455 if (!name)
456 return 1;
457
458 pr_debug("PCI: celleb_setup_phb() %s\n", name);
459 phb_set_bus_ranges(dev, phb);
460
461 if (strcmp(name, "epci") == 0) {
462 phb->ops = &celleb_epci_ops;
463 return celleb_setup_epci(dev, phb);
464
465 } else if (strcmp(name, "pci-pseudo") == 0) {
466 phb->ops = &celleb_fake_pci_ops;
467 celleb_alloc_private_mem(phb);
468 for (node = of_get_next_child(dev, NULL);
469 node != NULL; node = of_get_next_child(dev, node))
470 celleb_setup_fake_pci_device(node, phb);
471
472 } else
473 return 1;
474
475 return 0;
476}
477
478int celleb_pci_probe_mode(struct pci_bus *bus)
479{
480 return PCI_PROBE_DEVTREE;
481}
diff --git a/arch/powerpc/platforms/celleb/pci.h b/arch/powerpc/platforms/celleb/pci.h
new file mode 100644
index 000000000000..5340e348e297
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/pci.h
@@ -0,0 +1,35 @@
1/*
2 * pci prototypes for Celleb platform
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef _CELLEB_PCI_H
22#define _CELLEB_PCI_H
23
24#include <linux/pci.h>
25
26#include <asm/pci-bridge.h>
27#include <asm/prom.h>
28
29extern int celleb_setup_phb(struct pci_controller *);
30extern int celleb_pci_probe_mode(struct pci_bus *);
31
32extern struct pci_ops celleb_epci_ops;
33extern int celleb_setup_epci(struct device_node *, struct pci_controller *);
34
35#endif /* _CELLEB_PCI_H */
diff --git a/arch/powerpc/platforms/celleb/scc.h b/arch/powerpc/platforms/celleb/scc.h
new file mode 100644
index 000000000000..e9ce8a7c1882
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/scc.h
@@ -0,0 +1,145 @@
1/*
2 * SCC (Super Companion Chip) definitions
3 *
4 * (C) Copyright 2004-2006 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef _CELLEB_SCC_H
22#define _CELLEB_SCC_H
23
24#define PCI_VENDOR_ID_TOSHIBA_2 0x102f
25#define PCI_DEVICE_ID_TOSHIBA_SCC_PCIEXC_BRIDGE 0x01b0
26#define PCI_DEVICE_ID_TOSHIBA_SCC_EPCI_BRIDGE 0x01b1
27#define PCI_DEVICE_ID_TOSHIBA_SCC_BRIDGE 0x01b2
28#define PCI_DEVICE_ID_TOSHIBA_SCC_GBE 0x01b3
29#define PCI_DEVICE_ID_TOSHIBA_SCC_ATA 0x01b4
30#define PCI_DEVICE_ID_TOSHIBA_SCC_USB2 0x01b5
31#define PCI_DEVICE_ID_TOSHIBA_SCC_USB 0x01b6
32#define PCI_DEVICE_ID_TOSHIBA_SCC_ENCDEC 0x01b7
33
34#define SCC_EPCI_REG 0x0000d000
35
36/* EPCI registers */
37#define SCC_EPCI_CNF10_REG 0x010
38#define SCC_EPCI_CNF14_REG 0x014
39#define SCC_EPCI_CNF18_REG 0x018
40#define SCC_EPCI_PVBAT 0x100
41#define SCC_EPCI_VPMBAT 0x104
42#define SCC_EPCI_VPIBAT 0x108
43#define SCC_EPCI_VCSR 0x110
44#define SCC_EPCI_VIENAB 0x114
45#define SCC_EPCI_VISTAT 0x118
46#define SCC_EPCI_VRDCOUNT 0x124
47#define SCC_EPCI_BAM0 0x12c
48#define SCC_EPCI_BAM1 0x134
49#define SCC_EPCI_BAM2 0x13c
50#define SCC_EPCI_IADR 0x164
51#define SCC_EPCI_CLKRST 0x800
52#define SCC_EPCI_INTSET 0x804
53#define SCC_EPCI_STATUS 0x808
54#define SCC_EPCI_ABTSET 0x80c
55#define SCC_EPCI_WATRP 0x810
56#define SCC_EPCI_DUMMYRADR 0x814
57#define SCC_EPCI_SWRESP 0x818
58#define SCC_EPCI_CNTOPT 0x81c
59#define SCC_EPCI_ECMODE 0xf00
60#define SCC_EPCI_IOM_AC_NUM 5
61#define SCC_EPCI_IOM_ACTE(n) (0xf10 + (n) * 4)
62#define SCC_EPCI_IOT_AC_NUM 4
63#define SCC_EPCI_IOT_ACTE(n) (0xf30 + (n) * 4)
64#define SCC_EPCI_MAEA 0xf50
65#define SCC_EPCI_MAEC 0xf54
66#define SCC_EPCI_CKCTRL 0xff0
67
68/* bits for SCC_EPCI_VCSR */
69#define SCC_EPCI_VCSR_FRE 0x00020000
70#define SCC_EPCI_VCSR_FWE 0x00010000
71#define SCC_EPCI_VCSR_DR 0x00000400
72#define SCC_EPCI_VCSR_SR 0x00000008
73#define SCC_EPCI_VCSR_AT 0x00000004
74
75/* bits for SCC_EPCI_VIENAB/SCC_EPCI_VISTAT */
76#define SCC_EPCI_VISTAT_PMPE 0x00000008
77#define SCC_EPCI_VISTAT_PMFE 0x00000004
78#define SCC_EPCI_VISTAT_PRA 0x00000002
79#define SCC_EPCI_VISTAT_PRD 0x00000001
80#define SCC_EPCI_VISTAT_ALL 0x0000000f
81
82#define SCC_EPCI_VIENAB_PMPEE 0x00000008
83#define SCC_EPCI_VIENAB_PMFEE 0x00000004
84#define SCC_EPCI_VIENAB_PRA 0x00000002
85#define SCC_EPCI_VIENAB_PRD 0x00000001
86#define SCC_EPCI_VIENAB_ALL 0x0000000f
87
88/* bits for SCC_EPCI_CLKRST */
89#define SCC_EPCI_CLKRST_CKS_MASK 0x00030000
90#define SCC_EPCI_CLKRST_CKS_2 0x00000000
91#define SCC_EPCI_CLKRST_CKS_4 0x00010000
92#define SCC_EPCI_CLKRST_CKS_8 0x00020000
93#define SCC_EPCI_CLKRST_PCICRST 0x00000400
94#define SCC_EPCI_CLKRST_BC 0x00000200
95#define SCC_EPCI_CLKRST_PCIRST 0x00000100
96#define SCC_EPCI_CLKRST_PCKEN 0x00000001
97
98/* bits for SCC_EPCI_INTSET/SCC_EPCI_STATUS */
99#define SCC_EPCI_INT_2M 0x01000000
100#define SCC_EPCI_INT_RERR 0x00200000
101#define SCC_EPCI_INT_SERR 0x00100000
102#define SCC_EPCI_INT_PRTER 0x00080000
103#define SCC_EPCI_INT_SER 0x00040000
104#define SCC_EPCI_INT_PER 0x00020000
105#define SCC_EPCI_INT_PAI 0x00010000
106#define SCC_EPCI_INT_1M 0x00000100
107#define SCC_EPCI_INT_PME 0x00000010
108#define SCC_EPCI_INT_INTD 0x00000008
109#define SCC_EPCI_INT_INTC 0x00000004
110#define SCC_EPCI_INT_INTB 0x00000002
111#define SCC_EPCI_INT_INTA 0x00000001
112#define SCC_EPCI_INT_DEVINT 0x0000000f
113#define SCC_EPCI_INT_ALL 0x003f001f
114#define SCC_EPCI_INT_ALLERR 0x003f0000
115
116/* bits for SCC_EPCI_CKCTRL */
117#define SCC_EPCI_CKCTRL_CRST0 0x00010000
118#define SCC_EPCI_CKCTRL_CRST1 0x00020000
119#define SCC_EPCI_CKCTRL_OCLKEN 0x00000100
120#define SCC_EPCI_CKCTRL_LCLKEN 0x00000001
121
122#define SCC_EPCI_IDSEL_AD_TO_SLOT(ad) ((ad) - 10)
123#define SCC_EPCI_MAX_DEVNU SCC_EPCI_IDSEL_AD_TO_SLOT(32)
124
125/* bits for SCC_EPCI_CNTOPT */
126#define SCC_EPCI_CNTOPT_O2PMB 0x00000002
127
128/* UHC registers */
129#define SCC_UHC_CKRCTRL 0xff0
130#define SCC_UHC_ECMODE 0xf00
131
132/* bits for SCC_UHC_CKRCTRL */
133#define SCC_UHC_F48MCKLEN 0x00000001
134#define SCC_UHC_P_SUSPEND 0x00000002
135#define SCC_UHC_PHY_SUSPEND_SEL 0x00000004
136#define SCC_UHC_HCLKEN 0x00000100
137#define SCC_UHC_USBEN 0x00010000
138#define SCC_UHC_USBCEN 0x00020000
139#define SCC_UHC_PHYEN 0x00040000
140
141/* bits for SCC_UHC_ECMODE */
142#define SCC_UHC_ECMODE_BY_BYTE 0x00000555
143#define SCC_UHC_ECMODE_BY_WORD 0x00000aaa
144
145#endif /* _CELLEB_SCC_H */
diff --git a/arch/powerpc/platforms/celleb/scc_epci.c b/arch/powerpc/platforms/celleb/scc_epci.c
new file mode 100644
index 000000000000..c11b39c3776a
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/scc_epci.c
@@ -0,0 +1,409 @@
1/*
2 * Support for SCC external PCI
3 *
4 * (C) Copyright 2004-2007 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#undef DEBUG
22
23#include <linux/kernel.h>
24#include <linux/threads.h>
25#include <linux/pci.h>
26#include <linux/init.h>
27#include <linux/pci_regs.h>
28#include <linux/bootmem.h>
29
30#include <asm/io.h>
31#include <asm/irq.h>
32#include <asm/prom.h>
33#include <asm/machdep.h>
34#include <asm/pci-bridge.h>
35#include <asm/ppc-pci.h>
36
37#include "scc.h"
38#include "pci.h"
39#include "interrupt.h"
40
41#define MAX_PCI_DEVICES 32
42#define MAX_PCI_FUNCTIONS 8
43
44#define iob() __asm__ __volatile__("eieio; sync":::"memory")
45
46
47#if 0 /* test code for epci dummy read */
48static void celleb_epci_dummy_read(struct pci_dev *dev)
49{
50 void __iomem *epci_base;
51 struct device_node *node;
52 struct pci_controller *hose;
53 u32 val;
54
55 node = (struct device_node *)dev->bus->sysdata;
56 hose = pci_find_hose_for_OF_device(node);
57
58 if (!hose)
59 return;
60
61 epci_base = hose->cfg_addr;
62
63 val = in_be32(epci_base + SCC_EPCI_WATRP);
64 iosync();
65
66 return;
67}
68#endif
69
70static inline void clear_and_disable_master_abort_interrupt(
71 struct pci_controller *hose)
72{
73 void __iomem *addr;
74 addr = hose->cfg_addr + PCI_COMMAND;
75 out_be32(addr, in_be32(addr) | (PCI_STATUS_REC_MASTER_ABORT << 16));
76}
77
78static int celleb_epci_check_abort(struct pci_controller *hose,
79 void __iomem *addr)
80{
81 void __iomem *reg, *epci_base;
82 u32 val;
83
84 iob();
85 epci_base = hose->cfg_addr;
86
87 reg = epci_base + PCI_COMMAND;
88 val = in_be32(reg);
89
90 if (val & (PCI_STATUS_REC_MASTER_ABORT << 16)) {
91 out_be32(reg,
92 (val & 0xffff) | (PCI_STATUS_REC_MASTER_ABORT << 16));
93
94 /* clear PCI Controller error, FRE, PMFE */
95 reg = epci_base + SCC_EPCI_STATUS;
96 out_be32(reg, SCC_EPCI_INT_PAI);
97
98 reg = epci_base + SCC_EPCI_VCSR;
99 val = in_be32(reg) & 0xffff;
100 val |= SCC_EPCI_VCSR_FRE;
101 out_be32(reg, val);
102
103 reg = epci_base + SCC_EPCI_VISTAT;
104 out_be32(reg, SCC_EPCI_VISTAT_PMFE);
105 return PCIBIOS_DEVICE_NOT_FOUND;
106 }
107
108 return PCIBIOS_SUCCESSFUL;
109}
110
111static void __iomem *celleb_epci_make_config_addr(struct pci_controller *hose,
112 unsigned int devfn, int where)
113{
114 void __iomem *addr;
115 struct pci_bus *bus = hose->bus;
116
117 if (bus->self)
118 addr = hose->cfg_data +
119 (((bus->number & 0xff) << 16)
120 | ((devfn & 0xff) << 8)
121 | (where & 0xff)
122 | 0x01000000);
123 else
124 addr = hose->cfg_data +
125 (((devfn & 0xff) << 8) | (where & 0xff));
126
127 pr_debug("EPCI: config_addr = 0x%p\n", addr);
128
129 return addr;
130}
131
132static int celleb_epci_read_config(struct pci_bus *bus,
133 unsigned int devfn, int where, int size, u32 * val)
134{
135 void __iomem *addr;
136 struct device_node *node;
137 struct pci_controller *hose;
138
139 /* allignment check */
140 BUG_ON(where % size);
141
142 node = (struct device_node *)bus->sysdata;
143 hose = pci_find_hose_for_OF_device(node);
144
145 if (!hose->cfg_data)
146 return PCIBIOS_DEVICE_NOT_FOUND;
147
148 if (bus->number == hose->first_busno && devfn == 0) {
149 /* EPCI controller self */
150
151 addr = hose->cfg_addr + where;
152
153 switch (size) {
154 case 1:
155 *val = in_8(addr);
156 break;
157 case 2:
158 *val = in_be16(addr);
159 break;
160 case 4:
161 *val = in_be32(addr);
162 break;
163 default:
164 return PCIBIOS_DEVICE_NOT_FOUND;
165 }
166
167 } else {
168
169 clear_and_disable_master_abort_interrupt(hose);
170 addr = celleb_epci_make_config_addr(hose, devfn, where);
171
172 switch (size) {
173 case 1:
174 *val = in_8(addr);
175 break;
176 case 2:
177 *val = in_le16(addr);
178 break;
179 case 4:
180 *val = in_le32(addr);
181 break;
182 default:
183 return PCIBIOS_DEVICE_NOT_FOUND;
184 }
185 }
186
187 pr_debug("EPCI: "
188 "addr=0x%lx, devfn=0x%x, where=0x%x, size=0x%x, val=0x%x\n",
189 addr, devfn, where, size, *val);
190
191 return celleb_epci_check_abort(hose, NULL);
192}
193
194static int celleb_epci_write_config(struct pci_bus *bus,
195 unsigned int devfn, int where, int size, u32 val)
196{
197 void __iomem *addr;
198 struct device_node *node;
199 struct pci_controller *hose;
200
201 /* allignment check */
202 BUG_ON(where % size);
203
204 node = (struct device_node *)bus->sysdata;
205 hose = pci_find_hose_for_OF_device(node);
206
207 if (!hose->cfg_data)
208 return PCIBIOS_DEVICE_NOT_FOUND;
209
210 if (bus->number == hose->first_busno && devfn == 0) {
211 /* EPCI controller self */
212
213 addr = hose->cfg_addr + where;
214
215 switch (size) {
216 case 1:
217 out_8(addr, val);
218 break;
219 case 2:
220 out_be16(addr, val);
221 break;
222 case 4:
223 out_be32(addr, val);
224 break;
225 default:
226 return PCIBIOS_DEVICE_NOT_FOUND;
227 }
228
229 } else {
230
231 clear_and_disable_master_abort_interrupt(hose);
232 addr = celleb_epci_make_config_addr(hose, devfn, where);
233
234 switch (size) {
235 case 1:
236 out_8(addr, val);
237 break;
238 case 2:
239 out_le16(addr, val);
240 break;
241 case 4:
242 out_le32(addr, val);
243 break;
244 default:
245 return PCIBIOS_DEVICE_NOT_FOUND;
246 }
247 }
248
249 return celleb_epci_check_abort(hose, addr);
250}
251
252struct pci_ops celleb_epci_ops = {
253 celleb_epci_read_config,
254 celleb_epci_write_config,
255};
256
257/* to be moved in FW */
258static int __devinit celleb_epci_init(struct pci_controller *hose)
259{
260 u32 val;
261 void __iomem *reg, *epci_base;
262 int hwres = 0;
263
264 epci_base = hose->cfg_addr;
265
266 /* PCI core reset(Internal bus and PCI clock) */
267 reg = epci_base + SCC_EPCI_CKCTRL;
268 val = in_be32(reg);
269 if (val == 0x00030101)
270 hwres = 1;
271 else {
272 val &= ~(SCC_EPCI_CKCTRL_CRST0 | SCC_EPCI_CKCTRL_CRST1);
273 out_be32(reg, val);
274
275 /* set PCI core clock */
276 val = in_be32(reg);
277 val |= (SCC_EPCI_CKCTRL_OCLKEN | SCC_EPCI_CKCTRL_LCLKEN);
278 out_be32(reg, val);
279
280 /* release PCI core reset (internal bus) */
281 val = in_be32(reg);
282 val |= SCC_EPCI_CKCTRL_CRST0;
283 out_be32(reg, val);
284
285 /* set PCI clock select */
286 reg = epci_base + SCC_EPCI_CLKRST;
287 val = in_be32(reg);
288 val &= ~SCC_EPCI_CLKRST_CKS_MASK;
289 val |= SCC_EPCI_CLKRST_CKS_2;
290 out_be32(reg, val);
291
292 /* set arbiter */
293 reg = epci_base + SCC_EPCI_ABTSET;
294 out_be32(reg, 0x0f1f001f); /* temporary value */
295
296 /* buffer on */
297 reg = epci_base + SCC_EPCI_CLKRST;
298 val = in_be32(reg);
299 val |= SCC_EPCI_CLKRST_BC;
300 out_be32(reg, val);
301
302 /* PCI clock enable */
303 val = in_be32(reg);
304 val |= SCC_EPCI_CLKRST_PCKEN;
305 out_be32(reg, val);
306
307 /* release PCI core reset (all) */
308 reg = epci_base + SCC_EPCI_CKCTRL;
309 val = in_be32(reg);
310 val |= (SCC_EPCI_CKCTRL_CRST0 | SCC_EPCI_CKCTRL_CRST1);
311 out_be32(reg, val);
312
313 /* set base translation registers. (already set by Beat) */
314
315 /* set base address masks. (already set by Beat) */
316 }
317
318 /* release interrupt masks and clear all interrupts */
319 reg = epci_base + SCC_EPCI_INTSET;
320 out_be32(reg, 0x013f011f); /* all interrupts enable */
321 reg = epci_base + SCC_EPCI_VIENAB;
322 val = SCC_EPCI_VIENAB_PMPEE | SCC_EPCI_VIENAB_PMFEE;
323 out_be32(reg, val);
324 reg = epci_base + SCC_EPCI_STATUS;
325 out_be32(reg, 0xffffffff);
326 reg = epci_base + SCC_EPCI_VISTAT;
327 out_be32(reg, 0xffffffff);
328
329 /* disable PCI->IB address translation */
330 reg = epci_base + SCC_EPCI_VCSR;
331 val = in_be32(reg);
332 val &= ~(SCC_EPCI_VCSR_DR | SCC_EPCI_VCSR_AT);
333 out_be32(reg, val);
334
335 /* set base addresses. (no need to set?) */
336
337 /* memory space, bus master enable */
338 reg = epci_base + PCI_COMMAND;
339 val = PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
340 out_be32(reg, val);
341
342 /* endian mode setup */
343 reg = epci_base + SCC_EPCI_ECMODE;
344 val = 0x00550155;
345 out_be32(reg, val);
346
347 /* set control option */
348 reg = epci_base + SCC_EPCI_CNTOPT;
349 val = in_be32(reg);
350 val |= SCC_EPCI_CNTOPT_O2PMB;
351 out_be32(reg, val);
352
353 /* XXX: temporay: set registers for address conversion setup */
354 reg = epci_base + SCC_EPCI_CNF10_REG;
355 out_be32(reg, 0x80000008);
356 reg = epci_base + SCC_EPCI_CNF14_REG;
357 out_be32(reg, 0x40000008);
358
359 reg = epci_base + SCC_EPCI_BAM0;
360 out_be32(reg, 0x80000000);
361 reg = epci_base + SCC_EPCI_BAM1;
362 out_be32(reg, 0xe0000000);
363
364 reg = epci_base + SCC_EPCI_PVBAT;
365 out_be32(reg, 0x80000000);
366
367 if (!hwres) {
368 /* release external PCI reset */
369 reg = epci_base + SCC_EPCI_CLKRST;
370 val = in_be32(reg);
371 val |= SCC_EPCI_CLKRST_PCIRST;
372 out_be32(reg, val);
373 }
374
375 return 0;
376}
377
378int __devinit celleb_setup_epci(struct device_node *node,
379 struct pci_controller *hose)
380{
381 struct resource r;
382
383 pr_debug("PCI: celleb_setup_epci()\n");
384
385 if (of_address_to_resource(node, 0, &r))
386 goto error;
387 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1));
388 if (!hose->cfg_addr)
389 goto error;
390 pr_debug("EPCI: cfg_addr map 0x%016lx->0x%016lx + 0x%016lx\n",
391 r.start, (unsigned long)hose->cfg_addr,
392 (r.end - r.start + 1));
393
394 if (of_address_to_resource(node, 2, &r))
395 goto error;
396 hose->cfg_data = ioremap(r.start, (r.end - r.start + 1));
397 if (!hose->cfg_data)
398 goto error;
399 pr_debug("EPCI: cfg_data map 0x%016lx->0x%016lx + 0x%016lx\n",
400 r.start, (unsigned long)hose->cfg_data,
401 (r.end - r.start + 1));
402
403 celleb_epci_init(hose);
404
405 return 0;
406
407error:
408 return 1;
409}
diff --git a/arch/powerpc/platforms/celleb/scc_sio.c b/arch/powerpc/platforms/celleb/scc_sio.c
new file mode 100644
index 000000000000..bcd25f54d986
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/scc_sio.c
@@ -0,0 +1,101 @@
1/*
2 * setup serial port in SCC
3 *
4 * (C) Copyright 2006 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/tty.h>
22#include <linux/serial.h>
23#include <linux/serial_core.h>
24#include <linux/console.h>
25
26#include <asm/io.h>
27#include <asm/prom.h>
28
29/* sio irq0=0xb00010022 irq0=0xb00010023 irq2=0xb00010024
30 mmio=0xfff000-0x1000,0xff2000-0x1000 */
31static int txx9_serial_bitmap = 0;
32
33static struct {
34 uint32_t offset;
35 uint32_t index;
36} txx9_scc_tab[3] = {
37 { 0x300, 0 }, /* 0xFFF300 */
38 { 0x400, 0 }, /* 0xFFF400 */
39 { 0x800, 1 } /* 0xFF2800 */
40};
41
42static int txx9_serial_init(void)
43{
44 extern int early_serial_txx9_setup(struct uart_port *port);
45 struct device_node *node;
46 int i;
47 struct uart_port req;
48 struct of_irq irq;
49 struct resource res;
50
51 node = of_find_node_by_path("/ioif1/sio");
52 if (!node)
53 return 0;
54
55 for(i = 0; i < sizeof(txx9_scc_tab)/sizeof(txx9_scc_tab[0]); i++) {
56 if (!(txx9_serial_bitmap & (1<<i)))
57 continue;
58
59 if (of_irq_map_one(node, i, &irq))
60 continue;
61 if (of_address_to_resource(node, txx9_scc_tab[i].index, &res))
62 continue;
63
64 memset(&req, 0, sizeof(req));
65 req.line = i;
66 req.iotype = UPIO_MEM;
67 req.mapbase = res.start + txx9_scc_tab[i].offset;
68#ifdef CONFIG_SERIAL_TXX9_CONSOLE
69 req.membase = ioremap(req.mapbase, 0x24);
70#endif
71 req.irq = irq_create_of_mapping(irq.controller,
72 irq.specifier, irq.size);
73 req.flags |= UPF_IOREMAP | UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
74 req.uartclk = 83300000;
75 early_serial_txx9_setup(&req);
76 }
77
78 of_node_put(node);
79 return 0;
80}
81
82static int txx9_serial_config(char *ptr)
83{
84 int i;
85
86 for (;;) {
87 switch(get_option(&ptr, &i)) {
88 default:
89 return 0;
90 case 2:
91 txx9_serial_bitmap |= 1 << i;
92 break;
93 case 1:
94 txx9_serial_bitmap |= 1 << i;
95 return 0;
96 }
97 }
98}
99__setup("txx9_serial=", txx9_serial_config);
100
101console_initcall(txx9_serial_init);
diff --git a/arch/powerpc/platforms/celleb/scc_uhc.c b/arch/powerpc/platforms/celleb/scc_uhc.c
new file mode 100644
index 000000000000..a7c548bde2e3
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/scc_uhc.c
@@ -0,0 +1,94 @@
1/*
2 * SCC (Super Companion Chip) UHC setup
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/kernel.h>
22#include <linux/pci.h>
23
24#include <asm/delay.h>
25#include <asm/io.h>
26#include <asm/machdep.h>
27
28#include "scc.h"
29
30#define UHC_RESET_WAIT_MAX 10000
31
32static inline int uhc_clkctrl_ready(u32 val)
33{
34 const u32 mask = SCC_UHC_USBCEN | SCC_UHC_USBCEN;
35 return((val & mask) == mask);
36}
37
38/*
39 * UHC(usb host controler) enable function.
40 * affect to both of OHCI and EHCI core module.
41 */
42static void enable_scc_uhc(struct pci_dev *dev)
43{
44 void __iomem *uhc_base;
45 u32 __iomem *uhc_clkctrl;
46 u32 __iomem *uhc_ecmode;
47 u32 val = 0;
48 int i;
49
50 if (!machine_is(celleb))
51 return;
52
53 uhc_base = ioremap(pci_resource_start(dev, 0),
54 pci_resource_len(dev, 0));
55 if (!uhc_base) {
56 printk(KERN_ERR "failed to map UHC register base.\n");
57 return;
58 }
59 uhc_clkctrl = uhc_base + SCC_UHC_CKRCTRL;
60 uhc_ecmode = uhc_base + SCC_UHC_ECMODE;
61
62 /* setup for normal mode */
63 val |= SCC_UHC_F48MCKLEN;
64 out_be32(uhc_clkctrl, val);
65 val |= SCC_UHC_PHY_SUSPEND_SEL;
66 out_be32(uhc_clkctrl, val);
67 udelay(10);
68 val |= SCC_UHC_PHYEN;
69 out_be32(uhc_clkctrl, val);
70 udelay(50);
71
72 /* disable reset */
73 val |= SCC_UHC_HCLKEN;
74 out_be32(uhc_clkctrl, val);
75 val |= (SCC_UHC_USBCEN | SCC_UHC_USBEN);
76 out_be32(uhc_clkctrl, val);
77 i = 0;
78 while (!uhc_clkctrl_ready(in_be32(uhc_clkctrl))) {
79 udelay(10);
80 if (i++ > UHC_RESET_WAIT_MAX) {
81 printk(KERN_ERR "Failed to disable UHC reset %x\n",
82 in_be32(uhc_clkctrl));
83 break;
84 }
85 }
86
87 /* Endian Conversion Mode for Master ALL area */
88 out_be32(uhc_ecmode, SCC_UHC_ECMODE_BY_BYTE);
89
90 iounmap(uhc_base);
91}
92
93DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA_2,
94 PCI_DEVICE_ID_TOSHIBA_SCC_USB, enable_scc_uhc);
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
new file mode 100644
index 000000000000..1de63acfda87
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -0,0 +1,191 @@
1/*
2 * Celleb setup code
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This code is based on arch/powerpc/platforms/cell/setup.c:
7 * Copyright (C) 1995 Linus Torvalds
8 * Adapted from 'alpha' version by Gary Thomas
9 * Modified by Cort Dougan (cort@cs.nmt.edu)
10 * Modified by PPC64 Team, IBM Corp
11 * Modified by Cell Team, IBM Deutschland Entwicklung GmbH
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27
28#undef DEBUG
29
30#include <linux/cpu.h>
31#include <linux/sched.h>
32#include <linux/kernel.h>
33#include <linux/mm.h>
34#include <linux/stddef.h>
35#include <linux/unistd.h>
36#include <linux/reboot.h>
37#include <linux/init.h>
38#include <linux/delay.h>
39#include <linux/irq.h>
40#include <linux/seq_file.h>
41#include <linux/root_dev.h>
42#include <linux/console.h>
43
44#include <asm/mmu.h>
45#include <asm/processor.h>
46#include <asm/io.h>
47#include <asm/kexec.h>
48#include <asm/prom.h>
49#include <asm/machdep.h>
50#include <asm/cputable.h>
51#include <asm/irq.h>
52#include <asm/spu_priv1.h>
53#include <asm/firmware.h>
54#include <asm/of_platform.h>
55
56#include "interrupt.h"
57#include "beat_wrapper.h"
58#include "beat.h"
59#include "pci.h"
60
61static char celleb_machine_type[128] = "Celleb";
62
63static void celleb_show_cpuinfo(struct seq_file *m)
64{
65 struct device_node *root;
66 const char *model = "";
67
68 root = of_find_node_by_path("/");
69 if (root)
70 model = get_property(root, "model", NULL);
71 /* using "CHRP" is to trick anaconda into installing FCx into Celleb */
72 seq_printf(m, "machine\t\t: %s %s\n", celleb_machine_type, model);
73 of_node_put(root);
74}
75
76static int celleb_machine_type_hack(char *ptr)
77{
78 strncpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
79 celleb_machine_type[sizeof(celleb_machine_type)-1] = 0;
80 return 0;
81}
82
83__setup("celleb_machine_type_hack", celleb_machine_type_hack);
84
85static void celleb_progress(char *s, unsigned short hex)
86{
87 printk("*** %04x : %s\n", hex, s ? s : "");
88}
89
90static void __init celleb_setup_arch(void)
91{
92#ifdef CONFIG_SPU_BASE
93 spu_priv1_ops = &spu_priv1_beat_ops;
94 spu_management_ops = &spu_management_of_ops;
95#endif
96
97#ifdef CONFIG_SMP
98 smp_init_celleb();
99#endif
100
101 /* init to some ~sane value until calibrate_delay() runs */
102 loops_per_jiffy = 50000000;
103
104 if (ROOT_DEV == 0) {
105 printk("No ramdisk, default root is /dev/hda2\n");
106 ROOT_DEV = Root_HDA2;
107 }
108
109#ifdef CONFIG_DUMMY_CONSOLE
110 conswitchp = &dummy_con;
111#endif
112}
113
114static void beat_power_save(void)
115{
116 beat_pause(0);
117}
118
119static int __init celleb_probe(void)
120{
121 unsigned long root = of_get_flat_dt_root();
122
123 if (!of_flat_dt_is_compatible(root, "Beat"))
124 return 0;
125
126 powerpc_firmware_features |= FW_FEATURE_CELLEB_POSSIBLE;
127 hpte_init_beat();
128 return 1;
129}
130
131/*
132 * Cell has no legacy IO; anything calling this function has to
133 * fail or bad things will happen
134 */
135static int celleb_check_legacy_ioport(unsigned int baseport)
136{
137 return -ENODEV;
138}
139
140static void celleb_kexec_cpu_down(int crash, int secondary)
141{
142 beatic_deinit_IRQ();
143}
144
145static struct of_device_id celleb_bus_ids[] = {
146 { .type = "scc", },
147 { .type = "ioif", }, /* old style */
148 {},
149};
150
151static int __init celleb_publish_devices(void)
152{
153 if (!machine_is(celleb))
154 return 0;
155
156 /* Publish OF platform devices for southbridge IOs */
157 of_platform_bus_probe(NULL, celleb_bus_ids, NULL);
158
159 return 0;
160}
161device_initcall(celleb_publish_devices);
162
163define_machine(celleb) {
164 .name = "Cell Reference Set",
165 .probe = celleb_probe,
166 .setup_arch = celleb_setup_arch,
167 .show_cpuinfo = celleb_show_cpuinfo,
168 .restart = beat_restart,
169 .power_off = beat_power_off,
170 .halt = beat_halt,
171 .get_rtc_time = beat_get_rtc_time,
172 .set_rtc_time = beat_set_rtc_time,
173 .calibrate_decr = generic_calibrate_decr,
174 .check_legacy_ioport = celleb_check_legacy_ioport,
175 .progress = celleb_progress,
176 .power_save = beat_power_save,
177 .nvram_size = beat_nvram_get_size,
178 .nvram_read = beat_nvram_read,
179 .nvram_write = beat_nvram_write,
180 .set_dabr = beat_set_xdabr,
181 .init_IRQ = beatic_init_IRQ,
182 .get_irq = beatic_get_irq,
183 .pci_probe_mode = celleb_pci_probe_mode,
184 .pci_setup_phb = celleb_setup_phb,
185#ifdef CONFIG_KEXEC
186 .kexec_cpu_down = celleb_kexec_cpu_down,
187 .machine_kexec = default_machine_kexec,
188 .machine_kexec_prepare = default_machine_kexec_prepare,
189 .machine_crash_shutdown = default_machine_crash_shutdown,
190#endif
191};
diff --git a/arch/powerpc/platforms/celleb/smp.c b/arch/powerpc/platforms/celleb/smp.c
new file mode 100644
index 000000000000..a7631250aeb4
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/smp.c
@@ -0,0 +1,124 @@
1/*
2 * SMP support for Celleb platform. (Incomplete)
3 *
4 * (C) Copyright 2006 TOSHIBA CORPORATION
5 *
6 * This code is based on arch/powerpc/platforms/cell/smp.c:
7 * Dave Engebretsen, Peter Bergner, and
8 * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
9 * Plus various changes from other IBM teams...
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 */
25
26#undef DEBUG
27
28#include <linux/kernel.h>
29#include <linux/smp.h>
30#include <linux/interrupt.h>
31#include <linux/init.h>
32#include <linux/threads.h>
33#include <linux/cpu.h>
34
35#include <asm/irq.h>
36#include <asm/smp.h>
37#include <asm/machdep.h>
38#include <asm/udbg.h>
39
40#include "interrupt.h"
41
42#ifdef DEBUG
43#define DBG(fmt...) udbg_printf(fmt)
44#else
45#define DBG(fmt...)
46#endif
47
48/*
49 * The primary thread of each non-boot processor is recorded here before
50 * smp init.
51 */
52/* static cpumask_t of_spin_map; */
53
54/**
55 * smp_startup_cpu() - start the given cpu
56 *
57 * At boot time, there is nothing to do for primary threads which were
58 * started from Open Firmware. For anything else, call RTAS with the
59 * appropriate start location.
60 *
61 * Returns:
62 * 0 - failure
63 * 1 - success
64 */
65static inline int __devinit smp_startup_cpu(unsigned int lcpu)
66{
67 return 0;
68}
69
70static void smp_beatic_message_pass(int target, int msg)
71{
72 unsigned int i;
73
74 if (target < NR_CPUS) {
75 beatic_cause_IPI(target, msg);
76 } else {
77 for_each_online_cpu(i) {
78 if (target == MSG_ALL_BUT_SELF
79 && i == smp_processor_id())
80 continue;
81 beatic_cause_IPI(i, msg);
82 }
83 }
84}
85
86static int __init smp_beatic_probe(void)
87{
88 return cpus_weight(cpu_possible_map);
89}
90
91static void __devinit smp_beatic_setup_cpu(int cpu)
92{
93 beatic_setup_cpu(cpu);
94}
95
96static void __devinit smp_celleb_kick_cpu(int nr)
97{
98 BUG_ON(nr < 0 || nr >= NR_CPUS);
99
100 if (!smp_startup_cpu(nr))
101 return;
102}
103
104static int smp_celleb_cpu_bootable(unsigned int nr)
105{
106 return 1;
107}
108static struct smp_ops_t bpa_beatic_smp_ops = {
109 .message_pass = smp_beatic_message_pass,
110 .probe = smp_beatic_probe,
111 .kick_cpu = smp_celleb_kick_cpu,
112 .setup_cpu = smp_beatic_setup_cpu,
113 .cpu_bootable = smp_celleb_cpu_bootable,
114};
115
116/* This is called very early */
117void __init smp_init_celleb(void)
118{
119 DBG(" -> smp_init_celleb()\n");
120
121 smp_ops = &bpa_beatic_smp_ops;
122
123 DBG(" <- smp_init_celleb()\n");
124}
diff --git a/arch/powerpc/platforms/celleb/spu_priv1.c b/arch/powerpc/platforms/celleb/spu_priv1.c
new file mode 100644
index 000000000000..2bf6700f747a
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/spu_priv1.c
@@ -0,0 +1,208 @@
1/*
2 * spu hypervisor abstraction for Beat
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/module.h>
22
23#include <asm/types.h>
24#include <asm/spu.h>
25#include <asm/spu_priv1.h>
26
27#include "beat_wrapper.h"
28
29static inline void _int_mask_set(struct spu *spu, int class, u64 mask)
30{
31 spu->shadow_int_mask_RW[class] = mask;
32 beat_set_irq_mask_for_spe(spu->spe_id, class, mask);
33}
34
35static inline u64 _int_mask_get(struct spu *spu, int class)
36{
37 return spu->shadow_int_mask_RW[class];
38}
39
40static void int_mask_set(struct spu *spu, int class, u64 mask)
41{
42 _int_mask_set(spu, class, mask);
43}
44
45static u64 int_mask_get(struct spu *spu, int class)
46{
47 return _int_mask_get(spu, class);
48}
49
50static void int_mask_and(struct spu *spu, int class, u64 mask)
51{
52 u64 old_mask;
53 old_mask = _int_mask_get(spu, class);
54 _int_mask_set(spu, class, old_mask & mask);
55}
56
57static void int_mask_or(struct spu *spu, int class, u64 mask)
58{
59 u64 old_mask;
60 old_mask = _int_mask_get(spu, class);
61 _int_mask_set(spu, class, old_mask | mask);
62}
63
64static void int_stat_clear(struct spu *spu, int class, u64 stat)
65{
66 beat_clear_interrupt_status_of_spe(spu->spe_id, class, stat);
67}
68
69static u64 int_stat_get(struct spu *spu, int class)
70{
71 u64 int_stat;
72 beat_get_interrupt_status_of_spe(spu->spe_id, class, &int_stat);
73 return int_stat;
74}
75
76static void cpu_affinity_set(struct spu *spu, int cpu)
77{
78 return;
79}
80
81static u64 mfc_dar_get(struct spu *spu)
82{
83 u64 dar;
84 beat_get_spe_privileged_state_1_registers(
85 spu->spe_id,
86 offsetof(struct spu_priv1, mfc_dar_RW), &dar);
87 return dar;
88}
89
90static u64 mfc_dsisr_get(struct spu *spu)
91{
92 u64 dsisr;
93 beat_get_spe_privileged_state_1_registers(
94 spu->spe_id,
95 offsetof(struct spu_priv1, mfc_dsisr_RW), &dsisr);
96 return dsisr;
97}
98
99static void mfc_dsisr_set(struct spu *spu, u64 dsisr)
100{
101 beat_set_spe_privileged_state_1_registers(
102 spu->spe_id,
103 offsetof(struct spu_priv1, mfc_dsisr_RW), dsisr);
104}
105
106static void mfc_sdr_setup(struct spu *spu)
107{
108 return;
109}
110
111static void mfc_sr1_set(struct spu *spu, u64 sr1)
112{
113 beat_set_spe_privileged_state_1_registers(
114 spu->spe_id,
115 offsetof(struct spu_priv1, mfc_sr1_RW), sr1);
116}
117
118static u64 mfc_sr1_get(struct spu *spu)
119{
120 u64 sr1;
121 beat_get_spe_privileged_state_1_registers(
122 spu->spe_id,
123 offsetof(struct spu_priv1, mfc_sr1_RW), &sr1);
124 return sr1;
125}
126
127static void mfc_tclass_id_set(struct spu *spu, u64 tclass_id)
128{
129 beat_set_spe_privileged_state_1_registers(
130 spu->spe_id,
131 offsetof(struct spu_priv1, mfc_tclass_id_RW), tclass_id);
132}
133
134static u64 mfc_tclass_id_get(struct spu *spu)
135{
136 u64 tclass_id;
137 beat_get_spe_privileged_state_1_registers(
138 spu->spe_id,
139 offsetof(struct spu_priv1, mfc_tclass_id_RW), &tclass_id);
140 return tclass_id;
141}
142
143static void tlb_invalidate(struct spu *spu)
144{
145 beat_set_spe_privileged_state_1_registers(
146 spu->spe_id,
147 offsetof(struct spu_priv1, tlb_invalidate_entry_W), 0ul);
148}
149
150static void resource_allocation_groupID_set(struct spu *spu, u64 id)
151{
152 beat_set_spe_privileged_state_1_registers(
153 spu->spe_id,
154 offsetof(struct spu_priv1, resource_allocation_groupID_RW),
155 id);
156}
157
158static u64 resource_allocation_groupID_get(struct spu *spu)
159{
160 u64 id;
161 beat_get_spe_privileged_state_1_registers(
162 spu->spe_id,
163 offsetof(struct spu_priv1, resource_allocation_groupID_RW),
164 &id);
165 return id;
166}
167
168static void resource_allocation_enable_set(struct spu *spu, u64 enable)
169{
170 beat_set_spe_privileged_state_1_registers(
171 spu->spe_id,
172 offsetof(struct spu_priv1, resource_allocation_enable_RW),
173 enable);
174}
175
176static u64 resource_allocation_enable_get(struct spu *spu)
177{
178 u64 enable;
179 beat_get_spe_privileged_state_1_registers(
180 spu->spe_id,
181 offsetof(struct spu_priv1, resource_allocation_enable_RW),
182 &enable);
183 return enable;
184}
185
186const struct spu_priv1_ops spu_priv1_beat_ops =
187{
188 .int_mask_and = int_mask_and,
189 .int_mask_or = int_mask_or,
190 .int_mask_set = int_mask_set,
191 .int_mask_get = int_mask_get,
192 .int_stat_clear = int_stat_clear,
193 .int_stat_get = int_stat_get,
194 .cpu_affinity_set = cpu_affinity_set,
195 .mfc_dar_get = mfc_dar_get,
196 .mfc_dsisr_get = mfc_dsisr_get,
197 .mfc_dsisr_set = mfc_dsisr_set,
198 .mfc_sdr_setup = mfc_sdr_setup,
199 .mfc_sr1_set = mfc_sr1_set,
200 .mfc_sr1_get = mfc_sr1_get,
201 .mfc_tclass_id_set = mfc_tclass_id_set,
202 .mfc_tclass_id_get = mfc_tclass_id_get,
203 .tlb_invalidate = tlb_invalidate,
204 .resource_allocation_groupID_set = resource_allocation_groupID_set,
205 .resource_allocation_groupID_get = resource_allocation_groupID_get,
206 .resource_allocation_enable_set = resource_allocation_enable_set,
207 .resource_allocation_enable_get = resource_allocation_enable_get,
208};
diff --git a/arch/powerpc/platforms/celleb/udbg_beat.c b/arch/powerpc/platforms/celleb/udbg_beat.c
new file mode 100644
index 000000000000..d888c4674c62
--- /dev/null
+++ b/arch/powerpc/platforms/celleb/udbg_beat.c
@@ -0,0 +1,97 @@
1/*
2 * udbg function for Beat
3 *
4 * (C) Copyright 2006 TOSHIBA CORPORATION
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/kernel.h>
22#include <linux/console.h>
23
24#include <asm/machdep.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27
28#include "beat.h"
29
30#define celleb_vtermno 0
31
32static void udbg_putc_beat(char c)
33{
34 unsigned long rc;
35
36 if (c == '\n')
37 udbg_putc_beat('\r');
38
39 rc = beat_put_term_char(celleb_vtermno, 1, (uint64_t)c << 56, 0);
40}
41
42/* Buffered chars getc */
43static long inbuflen;
44static long inbuf[2]; /* must be 2 longs */
45
46static int udbg_getc_poll_beat(void)
47{
48 /* The interface is tricky because it may return up to 16 chars.
49 * We save them statically for future calls to udbg_getc().
50 */
51 char ch, *buf = (char *)inbuf;
52 int i;
53 long rc;
54 if (inbuflen == 0) {
55 /* get some more chars. */
56 inbuflen = 0;
57 rc = beat_get_term_char(celleb_vtermno, &inbuflen, inbuf+0, inbuf+1);
58 if (rc != 0)
59 inbuflen = 0; /* otherwise inbuflen is garbage */
60 }
61 if (inbuflen <= 0 || inbuflen > 16) {
62 /* Catch error case as well as other oddities (corruption) */
63 inbuflen = 0;
64 return -1;
65 }
66 ch = buf[0];
67 for (i = 1; i < inbuflen; i++) /* shuffle them down. */
68 buf[i-1] = buf[i];
69 inbuflen--;
70 return ch;
71}
72
73static int udbg_getc_beat(void)
74{
75 int ch;
76 for (;;) {
77 ch = udbg_getc_poll_beat();
78 if (ch == -1) {
79 /* This shouldn't be needed...but... */
80 volatile unsigned long delay;
81 for (delay=0; delay < 2000000; delay++)
82 ;
83 } else {
84 return ch;
85 }
86 }
87}
88
89/* call this from early_init() for a working debug console on
90 * vterm capable LPAR machines
91 */
92void __init udbg_init_debug_beat(void)
93{
94 udbg_putc = udbg_putc_beat;
95 udbg_getc = udbg_getc_beat;
96 udbg_getc_poll = udbg_getc_poll_beat;
97}
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index e1f51d455984..117c9a0055bd 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -75,7 +75,7 @@ extern irqreturn_t xmon_irq(int, void *);
75extern unsigned long loops_per_jiffy; 75extern unsigned long loops_per_jiffy;
76 76
77/* To be replaced by RTAS when available */ 77/* To be replaced by RTAS when available */
78static unsigned int *briq_SPOR; 78static unsigned int __iomem *briq_SPOR;
79 79
80#ifdef CONFIG_SMP 80#ifdef CONFIG_SMP
81extern struct smp_ops_t chrp_smp_ops; 81extern struct smp_ops_t chrp_smp_ops;
@@ -267,7 +267,7 @@ void __init chrp_setup_arch(void)
267 } else if (machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0) { 267 } else if (machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0) {
268 _chrp_type = _CHRP_briq; 268 _chrp_type = _CHRP_briq;
269 /* Map the SPOR register on briq and change the restart hook */ 269 /* Map the SPOR register on briq and change the restart hook */
270 briq_SPOR = (unsigned int *)ioremap(0xff0000e8, 4); 270 briq_SPOR = ioremap(0xff0000e8, 4);
271 ppc_md.restart = briq_restart; 271 ppc_md.restart = briq_restart;
272 } else { 272 } else {
273 /* Let's assume it is an IBM chrp if all else fails */ 273 /* Let's assume it is an IBM chrp if all else fails */
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index b3c2ce4cb7a8..886c522d78e9 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -104,15 +104,6 @@ config RADSTONE_PPC7D
104config PAL4 104config PAL4
105 bool "SBS-Palomar4" 105 bool "SBS-Palomar4"
106 106
107config GEMINI
108 bool "Synergy-Gemini"
109 select PPC_INDIRECT_PCI
110 depends on BROKEN
111 help
112 Select Gemini if configuring for a Synergy Microsystems' Gemini
113 series Single Board Computer. More information is available at:
114 <http://www.synergymicro.com/PressRel/97_10_15.html>.
115
116config EST8260 107config EST8260
117 bool "EST8260" 108 bool "EST8260"
118 ---help--- 109 ---help---
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 3f6a69f67195..73c59904697f 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -425,14 +425,6 @@ static void __init setup_u4_pcie(struct pci_controller* hose)
425 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000); 425 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000);
426 hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000); 426 hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000);
427 427
428 /* The bus contains a bridge from root -> device, we need to
429 * make it visible on bus 0 so that we pick the right type
430 * of config cycles. If we didn't, we would have to force all
431 * config cycles to be type 1. So we override the "bus-range"
432 * property here
433 */
434 hose->first_busno = 0x00;
435 hose->last_busno = 0xff;
436 u4_pcie = hose; 428 u4_pcie = hose;
437} 429}
438 430
@@ -560,13 +552,16 @@ void __init maple_pci_init(void)
560 return; 552 return;
561 } 553 }
562 for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) { 554 for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) {
563 if (np->name == NULL) 555 if (!np->type)
564 continue; 556 continue;
565 if (!strcmp(np->name, "pci") || !strcmp(np->name, "pcie")) { 557 if (strcmp(np->type, "pci") && strcmp(np->type, "ht"))
566 if (add_bridge(np) == 0) 558 continue;
567 of_node_get(np); 559 if ((device_is_compatible(np, "u4-pcie") ||
568 } 560 device_is_compatible(np, "u3-agp")) &&
569 if (strcmp(np->name, "ht") == 0) { 561 add_bridge(np) == 0)
562 of_node_get(np);
563
564 if (device_is_compatible(np, "u3-ht")) {
570 of_node_get(np); 565 of_node_get(np);
571 ht = np; 566 ht = np;
572 } 567 }
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 50855d4fd5a0..82d3f9e28d7c 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -62,6 +62,7 @@
62#include <asm/mpic.h> 62#include <asm/mpic.h>
63#include <asm/rtas.h> 63#include <asm/rtas.h>
64#include <asm/udbg.h> 64#include <asm/udbg.h>
65#include <asm/nvram.h>
65 66
66#include "maple.h" 67#include "maple.h"
67 68
@@ -195,6 +196,8 @@ void __init maple_setup_arch(void)
195 maple_use_rtas_reboot_and_halt_if_present(); 196 maple_use_rtas_reboot_and_halt_if_present();
196 197
197 printk(KERN_DEBUG "Using native/NAP idle loop\n"); 198 printk(KERN_DEBUG "Using native/NAP idle loop\n");
199
200 mmio_nvram_init();
198} 201}
199 202
200/* 203/*
diff --git a/arch/powerpc/platforms/pasemi/Kconfig b/arch/powerpc/platforms/pasemi/Kconfig
new file mode 100644
index 000000000000..68dc529dfd2f
--- /dev/null
+++ b/arch/powerpc/platforms/pasemi/Kconfig
@@ -0,0 +1,10 @@
1menu "PA Semi PWRficient options"
2 depends on PPC_PASEMI
3
4config PPC_PASEMI_IOMMU
5 bool "PA Semi IOMMU support"
6 depends on PPC_PASEMI
7 help
8 IOMMU support for PA6T-1682M
9
10endmenu
diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile
index 1be1a993c5f5..e657ccae90a9 100644
--- a/arch/powerpc/platforms/pasemi/Makefile
+++ b/arch/powerpc/platforms/pasemi/Makefile
@@ -1 +1,2 @@
1obj-y += setup.o pci.o time.o 1obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o
2
diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
new file mode 100644
index 000000000000..1ca3ff381591
--- /dev/null
+++ b/arch/powerpc/platforms/pasemi/idle.c
@@ -0,0 +1,88 @@
1/*
2 * Copyright (C) 2006-2007 PA Semi, Inc
3 *
4 * Maintained by: Olof Johansson <olof@lixom.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21#undef DEBUG
22
23#include <linux/kernel.h>
24#include <linux/string.h>
25
26#include <asm/machdep.h>
27#include <asm/reg.h>
28
29#include "pasemi.h"
30
31struct sleep_mode {
32 char *name;
33 void (*entry)(void);
34};
35
36static struct sleep_mode modes[] = {
37 { .name = "spin", .entry = &idle_spin },
38 { .name = "doze", .entry = &idle_doze },
39};
40
41static int current_mode = 0;
42
43static int pasemi_system_reset_exception(struct pt_regs *regs)
44{
45 /* If we were woken up from power savings, we need to return
46 * to the calling function, since nip is not saved across
47 * all modes.
48 */
49
50 if (regs->msr & SRR1_WAKEMASK)
51 regs->nip = regs->link;
52
53 switch (regs->msr & SRR1_WAKEMASK) {
54 case SRR1_WAKEEE:
55 do_IRQ(regs);
56 break;
57 case SRR1_WAKEDEC:
58 timer_interrupt(regs);
59 break;
60 default:
61 /* do system reset */
62 return 0;
63 }
64 /* everything handled */
65 regs->msr |= MSR_RI;
66 return 1;
67}
68
69void __init pasemi_idle_init(void)
70{
71 ppc_md.system_reset_exception = pasemi_system_reset_exception;
72 ppc_md.power_save = modes[current_mode].entry;
73 printk(KERN_INFO "Using PA6T idle loop (%s)\n", modes[current_mode].name);
74}
75
76static int __init idle_param(char *p)
77{
78 int i;
79 for (i = 0; i < sizeof(modes)/sizeof(struct sleep_mode); i++) {
80 if (!strcmp(modes[i].name, p)) {
81 current_mode = i;
82 break;
83 }
84 }
85 return 0;
86}
87
88early_param("idle", idle_param);
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
new file mode 100644
index 000000000000..459a53b7d24d
--- /dev/null
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -0,0 +1,281 @@
1/*
2 * Copyright (C) 2005-2007, PA Semi, Inc
3 *
4 * Maintained by: Olof Johansson <olof@lixom.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#undef DEBUG
21
22#include <linux/types.h>
23#include <linux/spinlock.h>
24#include <linux/pci.h>
25#include <asm/iommu.h>
26#include <asm/machdep.h>
27#include <asm/abs_addr.h>
28
29
30#define IOBMAP_PAGE_SHIFT 12
31#define IOBMAP_PAGE_SIZE (1 << IOBMAP_PAGE_SHIFT)
32#define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1)
33
34#define IOBMAP_PAGE_FACTOR (PAGE_SHIFT - IOBMAP_PAGE_SHIFT)
35
36#define IOB_BASE 0xe0000000
37#define IOB_SIZE 0x3000
38/* Configuration registers */
39#define IOBCAP_REG 0x10
40#define IOBCOM_REG 0x40
41/* Enable IOB address translation */
42#define IOBCOM_ATEN 0x00000100
43
44/* Address decode configuration register */
45#define IOB_AD_REG 0x53
46/* IOBCOM_AD_REG fields */
47#define IOB_AD_VGPRT 0x00000e00
48#define IOB_AD_VGAEN 0x00000100
49/* Direct mapping settings */
50#define IOB_AD_MPSEL_MASK 0x00000030
51#define IOB_AD_MPSEL_B38 0x00000000
52#define IOB_AD_MPSEL_B40 0x00000010
53#define IOB_AD_MPSEL_B42 0x00000020
54/* Translation window size / enable */
55#define IOB_AD_TRNG_MASK 0x00000003
56#define IOB_AD_TRNG_256M 0x00000000
57#define IOB_AD_TRNG_2G 0x00000001
58#define IOB_AD_TRNG_128G 0x00000003
59
60#define IOB_TABLEBASE_REG 0x55
61
62/* Base of the 64 4-byte L1 registers */
63#define IOB_XLT_L1_REGBASE 0xac0
64
65/* Register to invalidate TLB entries */
66#define IOB_AT_INVAL_TLB_REG 0xb40
67
68/* The top two bits of the level 1 entry contains valid and type flags */
69#define IOBMAP_L1E_V 0x40000000
70#define IOBMAP_L1E_V_B 0x80000000
71
72/* For big page entries, the bottom two bits contains flags */
73#define IOBMAP_L1E_BIG_CACHED 0x00000002
74#define IOBMAP_L1E_BIG_PRIORITY 0x00000001
75
76/* For regular level 2 entries, top 2 bits contain valid and cache flags */
77#define IOBMAP_L2E_V 0x80000000
78#define IOBMAP_L2E_V_CACHED 0xc0000000
79
80static u32 *iob;
81static u32 iob_l1_emptyval;
82static u32 iob_l2_emptyval;
83static u32 *iob_l2_base;
84
85static struct iommu_table iommu_table_iobmap;
86static int iommu_table_iobmap_inited;
87
88static void iobmap_build(struct iommu_table *tbl, long index,
89 long npages, unsigned long uaddr,
90 enum dma_data_direction direction)
91{
92 u32 *ip;
93 u32 rpn;
94 unsigned long bus_addr;
95
96 pr_debug("iobmap: build at: %lx, %lx, addr: %lx\n", index, npages, uaddr);
97
98 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
99
100 npages <<= IOBMAP_PAGE_FACTOR;
101 index <<= IOBMAP_PAGE_FACTOR;
102
103 ip = ((u32 *)tbl->it_base) + index;
104
105 while (npages--) {
106 rpn = virt_to_abs(uaddr) >> IOBMAP_PAGE_SHIFT;
107
108 *(ip++) = IOBMAP_L2E_V | rpn;
109 /* invalidate tlb, can be optimized more */
110 out_le32(iob+IOB_AT_INVAL_TLB_REG, bus_addr >> 14);
111
112 uaddr += IOBMAP_PAGE_SIZE;
113 bus_addr += IOBMAP_PAGE_SIZE;
114 }
115}
116
117
118static void iobmap_free(struct iommu_table *tbl, long index,
119 long npages)
120{
121 u32 *ip;
122 unsigned long bus_addr;
123
124 pr_debug("iobmap: free at: %lx, %lx\n", index, npages);
125
126 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
127
128 npages <<= IOBMAP_PAGE_FACTOR;
129 index <<= IOBMAP_PAGE_FACTOR;
130
131 ip = ((u32 *)tbl->it_base) + index;
132
133 while (npages--) {
134 *(ip++) = iob_l2_emptyval;
135 /* invalidate tlb, can be optimized more */
136 out_le32(iob+IOB_AT_INVAL_TLB_REG, bus_addr >> 14);
137 bus_addr += IOBMAP_PAGE_SIZE;
138 }
139}
140
141
142static void iommu_table_iobmap_setup(void)
143{
144 pr_debug(" -> %s\n", __func__);
145 iommu_table_iobmap.it_busno = 0;
146 iommu_table_iobmap.it_offset = 0;
147 /* it_size is in number of entries */
148 iommu_table_iobmap.it_size = 0x80000000 >> PAGE_SHIFT;
149
150 /* Initialize the common IOMMU code */
151 iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
152 iommu_table_iobmap.it_index = 0;
153 /* XXXOJN tune this to avoid IOB cache invals.
154 * Should probably be 8 (64 bytes)
155 */
156 iommu_table_iobmap.it_blocksize = 4;
157 iommu_init_table(&iommu_table_iobmap, 0);
158 pr_debug(" <- %s\n", __func__);
159}
160
161
162
163static void pci_dma_bus_setup_pasemi(struct pci_bus *bus)
164{
165 struct device_node *dn;
166
167 pr_debug("pci_dma_bus_setup, bus %p, bus->self %p\n", bus, bus->self);
168
169 if (!iommu_table_iobmap_inited) {
170 iommu_table_iobmap_inited = 1;
171 iommu_table_iobmap_setup();
172 }
173
174 dn = pci_bus_to_OF_node(bus);
175
176 if (dn)
177 PCI_DN(dn)->iommu_table = &iommu_table_iobmap;
178
179}
180
181
182static void pci_dma_dev_setup_pasemi(struct pci_dev *dev)
183{
184 pr_debug("pci_dma_dev_setup, dev %p (%s)\n", dev, pci_name(dev));
185
186 /* DMA device is untranslated, but all other PCI-e goes through
187 * the IOMMU
188 */
189 if (dev->vendor == 0x1959 && dev->device == 0xa007)
190 dev->dev.archdata.dma_ops = &dma_direct_ops;
191 else
192 dev->dev.archdata.dma_data = &iommu_table_iobmap;
193}
194
195static void pci_dma_bus_setup_null(struct pci_bus *b) { }
196static void pci_dma_dev_setup_null(struct pci_dev *d) { }
197
198int iob_init(struct device_node *dn)
199{
200 unsigned long tmp;
201 u32 regword;
202 int i;
203
204 pr_debug(" -> %s\n", __func__);
205
206 /* Allocate a spare page to map all invalid IOTLB pages. */
207 tmp = lmb_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE);
208 if (!tmp)
209 panic("IOBMAP: Cannot allocate spare page!");
210 /* Empty l1 is marked invalid */
211 iob_l1_emptyval = 0;
212 /* Empty l2 is mapped to dummy page */
213 iob_l2_emptyval = IOBMAP_L2E_V | (tmp >> IOBMAP_PAGE_SHIFT);
214
215 iob = ioremap(IOB_BASE, IOB_SIZE);
216 if (!iob)
217 panic("IOBMAP: Cannot map registers!");
218
219 /* setup direct mapping of the L1 entries */
220 for (i = 0; i < 64; i++) {
221 /* Each L1 covers 32MB, i.e. 8K entries = 32K of ram */
222 regword = IOBMAP_L1E_V | (__pa(iob_l2_base + i*0x2000) >> 12);
223 out_le32(iob+IOB_XLT_L1_REGBASE+i, regword);
224 }
225
226 /* set 2GB translation window, based at 0 */
227 regword = in_le32(iob+IOB_AD_REG);
228 regword &= ~IOB_AD_TRNG_MASK;
229 regword |= IOB_AD_TRNG_2G;
230 out_le32(iob+IOB_AD_REG, regword);
231
232 /* Enable translation */
233 regword = in_le32(iob+IOBCOM_REG);
234 regword |= IOBCOM_ATEN;
235 out_le32(iob+IOBCOM_REG, regword);
236
237 pr_debug(" <- %s\n", __func__);
238
239 return 0;
240}
241
242
243/* These are called very early. */
244void iommu_init_early_pasemi(void)
245{
246 int iommu_off;
247
248#ifndef CONFIG_PPC_PASEMI_IOMMU
249 iommu_off = 1;
250#else
251 iommu_off = of_chosen &&
252 get_property(of_chosen, "linux,iommu-off", NULL);
253#endif
254 if (iommu_off) {
255 /* Direct I/O, IOMMU off */
256 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null;
257 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null;
258 pci_dma_ops = &dma_direct_ops;
259
260 return;
261 }
262
263 iob_init(NULL);
264
265 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pasemi;
266 ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi;
267 ppc_md.tce_build = iobmap_build;
268 ppc_md.tce_free = iobmap_free;
269 pci_dma_ops = &dma_iommu_ops;
270}
271
272void __init alloc_iobmap_l2(void)
273{
274#ifndef CONFIG_PPC_PASEMI_IOMMU
275 return;
276#endif
277 /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */
278 iob_l2_base = (u32 *)abs_to_virt(lmb_alloc_base(1UL<<21, 1UL<<21, 0x80000000));
279
280 printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base);
281}
diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h
index 51c2a2397ecf..2d3927e6edb0 100644
--- a/arch/powerpc/platforms/pasemi/pasemi.h
+++ b/arch/powerpc/platforms/pasemi/pasemi.h
@@ -3,5 +3,17 @@
3 3
4extern unsigned long pas_get_boot_time(void); 4extern unsigned long pas_get_boot_time(void);
5extern void pas_pci_init(void); 5extern void pas_pci_init(void);
6extern void __devinit pas_pci_irq_fixup(struct pci_dev *dev);
7extern void __devinit pas_pci_dma_dev_setup(struct pci_dev *dev);
8
9extern void __init alloc_iobmap_l2(void);
10
11extern void __init pasemi_idle_init(void);
12
13/* Power savings modes, implemented in asm */
14extern void idle_spin(void);
15extern void idle_doze(void);
16
17
6 18
7#endif /* _PASEMI_PASEMI_H */ 19#endif /* _PASEMI_PASEMI_H */
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index faa618e04047..7ecb2ba24db9 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -163,6 +163,19 @@ static void __init pas_fixup_phb_resources(void)
163} 163}
164 164
165 165
166void __devinit pas_pci_irq_fixup(struct pci_dev *dev)
167{
168 /* DMA is special, 84 interrupts (128 -> 211), all but 128
169 * need to be mapped by hand here.
170 */
171 if (dev->vendor == 0x1959 && dev->device == 0xa007) {
172 int i;
173 for (i = 129; i < 212; i++)
174 irq_create_mapping(NULL, i);
175 }
176}
177
178
166void __init pas_pci_init(void) 179void __init pas_pci_init(void)
167{ 180{
168 struct device_node *np, *root; 181 struct device_node *np, *root;
diff --git a/arch/powerpc/platforms/pasemi/powersave.S b/arch/powerpc/platforms/pasemi/powersave.S
new file mode 100644
index 000000000000..6d0fba6aab17
--- /dev/null
+++ b/arch/powerpc/platforms/pasemi/powersave.S
@@ -0,0 +1,80 @@
1/*
2 * Copyright (C) 2006-2007 PA Semi, Inc
3 *
4 * Maintained by: Olof Johansson <olof@lixom.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21#include <asm/processor.h>
22#include <asm/page.h>
23#include <asm/ppc_asm.h>
24#include <asm/cputable.h>
25#include <asm/cache.h>
26#include <asm/thread_info.h>
27#include <asm/asm-offsets.h>
28
29/* Power savings opcodes since not all binutils have them at this time */
30#define DOZE .long 0x4c000324
31#define NAP .long 0x4c000364
32#define SLEEP .long 0x4c0003a4
33#define RVW .long 0x4c0003e4
34
35/* Common sequence to do before going to any of the
36 * powersavings modes.
37 */
38
39#define PRE_SLEEP_SEQUENCE \
40 std r3,8(r1); \
41 ptesync ; \
42 ld r3,8(r1); \
431: cmpd r3,r3; \
44 bne 1b
45
46_doze:
47 PRE_SLEEP_SEQUENCE
48 DOZE
49 b .
50
51
52_GLOBAL(idle_spin)
53 blr
54
55_GLOBAL(idle_doze)
56 LOAD_REG_ADDR(r3, _doze)
57 b sleep_common
58
59/* Add more modes here later */
60
61sleep_common:
62 mflr r0
63 std r0, 16(r1)
64 stdu r1,-64(r1)
65
66 LOAD_REG_IMMEDIATE(r6,MSR_DR|MSR_IR|MSR_ME|MSR_EE)
67 mfmsr r4
68 andc r5,r4,r6
69 mtmsrd r5,0
70
71 mtctr r3
72 bctrl
73
74 mtmsrd r4,0
75
76 addi r1,r1,64
77 ld r0,16(r1)
78 mtlr r0
79 blr
80
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index bea7d1bb1a3b..449cf1a08291 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 PA Semi, Inc 2 * Copyright (C) 2006-2007 PA Semi, Inc
3 * 3 *
4 * Authors: Kip Walker, PA Semi 4 * Authors: Kip Walker, PA Semi
5 * Olof Johansson, PA Semi 5 * Olof Johansson, PA Semi
@@ -38,31 +38,46 @@
38 38
39#include "pasemi.h" 39#include "pasemi.h"
40 40
41static void __iomem *reset_reg;
42
41static void pas_restart(char *cmd) 43static void pas_restart(char *cmd)
42{ 44{
43 printk("restart unimplemented, looping...\n"); 45 printk("Restarting...\n");
44 for (;;) ; 46 while (1)
47 out_le32(reset_reg, 0x6000000);
45} 48}
46 49
47static void pas_power_off(void) 50#ifdef CONFIG_SMP
51static DEFINE_SPINLOCK(timebase_lock);
52
53static void __devinit pas_give_timebase(void)
48{ 54{
49 printk("power off unimplemented, looping...\n"); 55 unsigned long tb;
50 for (;;) ; 56
57 spin_lock(&timebase_lock);
58 mtspr(SPRN_TBCTL, TBCTL_FREEZE);
59 tb = mftb();
60 mtspr(SPRN_TBCTL, TBCTL_UPDATE_LOWER | (tb & 0xffffffff));
61 mtspr(SPRN_TBCTL, TBCTL_UPDATE_UPPER | (tb >> 32));
62 mtspr(SPRN_TBCTL, TBCTL_RESTART);
63 spin_unlock(&timebase_lock);
64 pr_debug("pas_give_timebase: cpu %d gave tb %lx\n",
65 smp_processor_id(), tb);
51} 66}
52 67
53static void pas_halt(void) 68static void __devinit pas_take_timebase(void)
54{ 69{
55 pas_power_off(); 70 pr_debug("pas_take_timebase: cpu %d has tb %lx\n",
71 smp_processor_id(), mftb());
56} 72}
57 73
58#ifdef CONFIG_SMP
59struct smp_ops_t pas_smp_ops = { 74struct smp_ops_t pas_smp_ops = {
60 .probe = smp_mpic_probe, 75 .probe = smp_mpic_probe,
61 .message_pass = smp_mpic_message_pass, 76 .message_pass = smp_mpic_message_pass,
62 .kick_cpu = smp_generic_kick_cpu, 77 .kick_cpu = smp_generic_kick_cpu,
63 .setup_cpu = smp_mpic_setup_cpu, 78 .setup_cpu = smp_mpic_setup_cpu,
64 .give_timebase = smp_generic_give_timebase, 79 .give_timebase = pas_give_timebase,
65 .take_timebase = smp_generic_take_timebase, 80 .take_timebase = pas_take_timebase,
66}; 81};
67#endif /* CONFIG_SMP */ 82#endif /* CONFIG_SMP */
68 83
@@ -72,9 +87,6 @@ void __init pas_setup_arch(void)
72 /* Setup SMP callback */ 87 /* Setup SMP callback */
73 smp_ops = &pas_smp_ops; 88 smp_ops = &pas_smp_ops;
74#endif 89#endif
75 /* no iommu yet */
76 pci_dma_ops = &dma_direct_ops;
77
78 /* Lookup PCI hosts */ 90 /* Lookup PCI hosts */
79 pas_pci_init(); 91 pas_pci_init();
80 92
@@ -82,7 +94,11 @@ void __init pas_setup_arch(void)
82 conswitchp = &dummy_con; 94 conswitchp = &dummy_con;
83#endif 95#endif
84 96
85 printk(KERN_DEBUG "Using default idle loop\n"); 97 /* Remap SDC register for doing reset */
98 /* XXXOJN This should maybe come out of the device tree */
99 reset_reg = ioremap(0xfc101100, 4);
100
101 pasemi_idle_init();
86} 102}
87 103
88/* No legacy IO on our parts */ 104/* No legacy IO on our parts */
@@ -130,8 +146,9 @@ static __init void pas_init_IRQ(void)
130 openpic_addr = of_read_number(opprop, naddr); 146 openpic_addr = of_read_number(opprop, naddr);
131 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 147 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
132 148
133 mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0, 149 mpic = mpic_alloc(mpic_node, openpic_addr,
134 " PAS-OPIC "); 150 MPIC_PRIMARY|MPIC_LARGE_VECTORS,
151 0, 0, " PAS-OPIC ");
135 BUG_ON(!mpic); 152 BUG_ON(!mpic);
136 153
137 mpic_assign_isu(mpic, 0, openpic_addr + 0x10000); 154 mpic_assign_isu(mpic, 0, openpic_addr + 0x10000);
@@ -146,6 +163,53 @@ static void __init pas_progress(char *s, unsigned short hex)
146} 163}
147 164
148 165
166static int pas_machine_check_handler(struct pt_regs *regs)
167{
168 int cpu = smp_processor_id();
169 unsigned long srr0, srr1, dsisr;
170
171 srr0 = regs->nip;
172 srr1 = regs->msr;
173 dsisr = mfspr(SPRN_DSISR);
174 printk(KERN_ERR "Machine Check on CPU %d\n", cpu);
175 printk(KERN_ERR "SRR0 0x%016lx SRR1 0x%016lx\n", srr0, srr1);
176 printk(KERN_ERR "DSISR 0x%016lx DAR 0x%016lx\n", dsisr, regs->dar);
177 printk(KERN_ERR "Cause:\n");
178
179 if (srr1 & 0x200000)
180 printk(KERN_ERR "Signalled by SDC\n");
181 if (srr1 & 0x100000) {
182 printk(KERN_ERR "Load/Store detected error:\n");
183 if (dsisr & 0x8000)
184 printk(KERN_ERR "D-cache ECC double-bit error or bus error\n");
185 if (dsisr & 0x4000)
186 printk(KERN_ERR "LSU snoop response error\n");
187 if (dsisr & 0x2000)
188 printk(KERN_ERR "MMU SLB multi-hit or invalid B field\n");
189 if (dsisr & 0x1000)
190 printk(KERN_ERR "Recoverable Duptags\n");
191 if (dsisr & 0x800)
192 printk(KERN_ERR "Recoverable D-cache parity error count overflow\n");
193 if (dsisr & 0x400)
194 printk(KERN_ERR "TLB parity error count overflow\n");
195 }
196 if (srr1 & 0x80000)
197 printk(KERN_ERR "Bus Error\n");
198 if (srr1 & 0x40000)
199 printk(KERN_ERR "I-side SLB multiple hit\n");
200 if (srr1 & 0x20000)
201 printk(KERN_ERR "I-cache parity error hit\n");
202
203 /* SRR1[62] is from MSR[62] if recoverable, so pass that back */
204 return !!(srr1 & 0x2);
205}
206
207static void __init pas_init_early(void)
208{
209 iommu_init_early_pasemi();
210}
211
212
149/* 213/*
150 * Called very early, MMU is off, device-tree isn't unflattened 214 * Called very early, MMU is off, device-tree isn't unflattened
151 */ 215 */
@@ -158,6 +222,8 @@ static int __init pas_probe(void)
158 222
159 hpte_init_native(); 223 hpte_init_native();
160 224
225 alloc_iobmap_l2();
226
161 return 1; 227 return 1;
162} 228}
163 229
@@ -165,13 +231,14 @@ define_machine(pas) {
165 .name = "PA Semi PA6T-1682M", 231 .name = "PA Semi PA6T-1682M",
166 .probe = pas_probe, 232 .probe = pas_probe,
167 .setup_arch = pas_setup_arch, 233 .setup_arch = pas_setup_arch,
234 .init_early = pas_init_early,
168 .init_IRQ = pas_init_IRQ, 235 .init_IRQ = pas_init_IRQ,
169 .get_irq = mpic_get_irq, 236 .get_irq = mpic_get_irq,
170 .restart = pas_restart, 237 .restart = pas_restart,
171 .power_off = pas_power_off,
172 .halt = pas_halt,
173 .get_boot_time = pas_get_boot_time, 238 .get_boot_time = pas_get_boot_time,
174 .calibrate_decr = generic_calibrate_decr, 239 .calibrate_decr = generic_calibrate_decr,
175 .check_legacy_ioport = pas_check_legacy_ioport, 240 .check_legacy_ioport = pas_check_legacy_ioport,
176 .progress = pas_progress, 241 .progress = pas_progress,
242 .machine_check_exception = pas_machine_check_handler,
243 .pci_irq_fixup = pas_pci_irq_fixup,
177}; 244};
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index eeb2ae5ffc58..d73fb73802bb 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -795,7 +795,6 @@ static void __devinit smp_core99_kick_cpu(int nr)
795 ppc_md.progress("smp_core99_kick_cpu", 0x346); 795 ppc_md.progress("smp_core99_kick_cpu", 0x346);
796 796
797 local_irq_save(flags); 797 local_irq_save(flags);
798 local_irq_disable();
799 798
800 /* Save reset vector */ 799 /* Save reset vector */
801 save_vector = *vector; 800 save_vector = *vector;
diff --git a/arch/powerpc/platforms/ps3/Makefile b/arch/powerpc/platforms/ps3/Makefile
index 1994904f580f..a0048fcf0866 100644
--- a/arch/powerpc/platforms/ps3/Makefile
+++ b/arch/powerpc/platforms/ps3/Makefile
@@ -1,5 +1,6 @@
1obj-y += setup.o mm.o time.o hvcall.o htab.o repository.o 1obj-y += setup.o mm.o time.o hvcall.o htab.o repository.o
2obj-y += interrupt.o exports.o os-area.o 2obj-y += interrupt.o exports.o os-area.o
3obj-y += system-bus.o
3 4
4obj-$(CONFIG_SMP) += smp.o 5obj-$(CONFIG_SMP) += smp.o
5obj-$(CONFIG_SPU_BASE) += spu.o 6obj-$(CONFIG_SPU_BASE) += spu.o
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 8fe1769655a3..a4b5a1bc60f4 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -23,7 +23,6 @@
23#include <asm/machdep.h> 23#include <asm/machdep.h>
24#include <asm/lmb.h> 24#include <asm/lmb.h>
25#include <asm/udbg.h> 25#include <asm/udbg.h>
26#include <asm/ps3.h>
27#include <asm/lv1call.h> 26#include <asm/lv1call.h>
28 27
29#include "platform.h" 28#include "platform.h"
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 6f5de438b980..631c30095617 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -24,7 +24,6 @@
24 24
25#include <asm/machdep.h> 25#include <asm/machdep.h>
26#include <asm/udbg.h> 26#include <asm/udbg.h>
27#include <asm/ps3.h>
28#include <asm/lv1call.h> 27#include <asm/lv1call.h>
29 28
30#include "platform.h" 29#include "platform.h"
@@ -36,15 +35,148 @@
36#endif 35#endif
37 36
38/** 37/**
38 * struct ps3_bmp - a per cpu irq status and mask bitmap structure
39 * @status: 256 bit status bitmap indexed by plug
40 * @unused_1:
41 * @mask: 256 bit mask bitmap indexed by plug
42 * @unused_2:
43 * @lock:
44 * @ipi_debug_brk_mask:
45 *
46 * The HV mantains per SMT thread mappings of HV outlet to HV plug on
47 * behalf of the guest. These mappings are implemented as 256 bit guest
48 * supplied bitmaps indexed by plug number. The addresses of the bitmaps
49 * are registered with the HV through lv1_configure_irq_state_bitmap().
50 * The HV requires that the 512 bits of status + mask not cross a page
51 * boundary. PS3_BMP_MINALIGN is used to define this minimal 64 byte
52 * alignment.
53 *
54 * The HV supports 256 plugs per thread, assigned as {0..255}, for a total
55 * of 512 plugs supported on a processor. To simplify the logic this
56 * implementation equates HV plug value to Linux virq value, constrains each
57 * interrupt to have a system wide unique plug number, and limits the range
58 * of the plug values to map into the first dword of the bitmaps. This
59 * gives a usable range of plug values of {NUM_ISA_INTERRUPTS..63}. Note
60 * that there is no constraint on how many in this set an individual thread
61 * can acquire.
62 */
63
64#define PS3_BMP_MINALIGN 64
65
66struct ps3_bmp {
67 struct {
68 u64 status;
69 u64 unused_1[3];
70 u64 mask;
71 u64 unused_2[3];
72 };
73 u64 ipi_debug_brk_mask;
74 spinlock_t lock;
75};
76
77/**
78 * struct ps3_private - a per cpu data structure
79 * @bmp: ps3_bmp structure
80 * @node: HV logical_ppe_id
81 * @cpu: HV thread_id
82 */
83
84struct ps3_private {
85 struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN)));
86 u64 node;
87 unsigned int cpu;
88};
89
90static DEFINE_PER_CPU(struct ps3_private, ps3_private);
91
92int ps3_alloc_irq(enum ps3_cpu_binding cpu, unsigned long outlet,
93 unsigned int *virq)
94{
95 int result;
96 struct ps3_private *pd;
97
98 /* This defines the default interrupt distribution policy. */
99
100 if (cpu == PS3_BINDING_CPU_ANY)
101 cpu = 0;
102
103 pd = &per_cpu(ps3_private, cpu);
104
105 *virq = irq_create_mapping(NULL, outlet);
106
107 if (*virq == NO_IRQ) {
108 pr_debug("%s:%d: irq_create_mapping failed: outlet %lu\n",
109 __func__, __LINE__, outlet);
110 result = -ENOMEM;
111 goto fail_create;
112 }
113
114 /* Binds outlet to cpu + virq. */
115
116 result = lv1_connect_irq_plug_ext(pd->node, pd->cpu, *virq, outlet, 0);
117
118 if (result) {
119 pr_info("%s:%d: lv1_connect_irq_plug_ext failed: %s\n",
120 __func__, __LINE__, ps3_result(result));
121 result = -EPERM;
122 goto fail_connect;
123 }
124
125 pr_debug("%s:%d: outlet %lu => cpu %u, virq %u\n", __func__, __LINE__,
126 outlet, cpu, *virq);
127
128 result = set_irq_chip_data(*virq, pd);
129
130 if (result) {
131 pr_debug("%s:%d: set_irq_chip_data failed\n",
132 __func__, __LINE__);
133 goto fail_set;
134 }
135
136 return result;
137
138fail_set:
139 lv1_disconnect_irq_plug_ext(pd->node, pd->cpu, *virq);
140fail_connect:
141 irq_dispose_mapping(*virq);
142fail_create:
143 return result;
144}
145EXPORT_SYMBOL_GPL(ps3_alloc_irq);
146
147int ps3_free_irq(unsigned int virq)
148{
149 int result;
150 const struct ps3_private *pd = get_irq_chip_data(virq);
151
152 pr_debug("%s:%d: node %lu, cpu %d, virq %u\n", __func__, __LINE__,
153 pd->node, pd->cpu, virq);
154
155 result = lv1_disconnect_irq_plug_ext(pd->node, pd->cpu, virq);
156
157 if (result)
158 pr_info("%s:%d: lv1_disconnect_irq_plug_ext failed: %s\n",
159 __func__, __LINE__, ps3_result(result));
160
161 set_irq_chip_data(virq, NULL);
162 irq_dispose_mapping(virq);
163 return result;
164}
165EXPORT_SYMBOL_GPL(ps3_free_irq);
166
167/**
39 * ps3_alloc_io_irq - Assign a virq to a system bus device. 168 * ps3_alloc_io_irq - Assign a virq to a system bus device.
40 * interrupt_id: The device interrupt id read from the system repository. 169 * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be
170 * serviced on.
171 * @interrupt_id: The device interrupt id read from the system repository.
41 * @virq: The assigned Linux virq. 172 * @virq: The assigned Linux virq.
42 * 173 *
43 * An io irq represents a non-virtualized device interrupt. interrupt_id 174 * An io irq represents a non-virtualized device interrupt. interrupt_id
44 * coresponds to the interrupt number of the interrupt controller. 175 * coresponds to the interrupt number of the interrupt controller.
45 */ 176 */
46 177
47int ps3_alloc_io_irq(unsigned int interrupt_id, unsigned int *virq) 178int ps3_alloc_io_irq(enum ps3_cpu_binding cpu, unsigned int interrupt_id,
179 unsigned int *virq)
48{ 180{
49 int result; 181 int result;
50 unsigned long outlet; 182 unsigned long outlet;
@@ -57,13 +189,12 @@ int ps3_alloc_io_irq(unsigned int interrupt_id, unsigned int *virq)
57 return result; 189 return result;
58 } 190 }
59 191
60 *virq = irq_create_mapping(NULL, outlet); 192 result = ps3_alloc_irq(cpu, outlet, virq);
61 193 BUG_ON(result);
62 pr_debug("%s:%d: interrupt_id %u => outlet %lu, virq %u\n",
63 __func__, __LINE__, interrupt_id, outlet, *virq);
64 194
65 return 0; 195 return result;
66} 196}
197EXPORT_SYMBOL_GPL(ps3_alloc_io_irq);
67 198
68int ps3_free_io_irq(unsigned int virq) 199int ps3_free_io_irq(unsigned int virq)
69{ 200{
@@ -75,13 +206,16 @@ int ps3_free_io_irq(unsigned int virq)
75 pr_debug("%s:%d: lv1_destruct_io_irq_outlet failed: %s\n", 206 pr_debug("%s:%d: lv1_destruct_io_irq_outlet failed: %s\n",
76 __func__, __LINE__, ps3_result(result)); 207 __func__, __LINE__, ps3_result(result));
77 208
78 irq_dispose_mapping(virq); 209 ps3_free_irq(virq);
79 210
80 return result; 211 return result;
81} 212}
213EXPORT_SYMBOL_GPL(ps3_free_io_irq);
82 214
83/** 215/**
84 * ps3_alloc_event_irq - Allocate a virq for use with a system event. 216 * ps3_alloc_event_irq - Allocate a virq for use with a system event.
217 * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be
218 * serviced on.
85 * @virq: The assigned Linux virq. 219 * @virq: The assigned Linux virq.
86 * 220 *
87 * The virq can be used with lv1_connect_interrupt_event_receive_port() to 221 * The virq can be used with lv1_connect_interrupt_event_receive_port() to
@@ -89,7 +223,7 @@ int ps3_free_io_irq(unsigned int virq)
89 * events. 223 * events.
90 */ 224 */
91 225
92int ps3_alloc_event_irq(unsigned int *virq) 226int ps3_alloc_event_irq(enum ps3_cpu_binding cpu, unsigned int *virq)
93{ 227{
94 int result; 228 int result;
95 unsigned long outlet; 229 unsigned long outlet;
@@ -103,12 +237,10 @@ int ps3_alloc_event_irq(unsigned int *virq)
103 return result; 237 return result;
104 } 238 }
105 239
106 *virq = irq_create_mapping(NULL, outlet); 240 result = ps3_alloc_irq(cpu, outlet, virq);
107 241 BUG_ON(result);
108 pr_debug("%s:%d: outlet %lu, virq %u\n", __func__, __LINE__, outlet,
109 *virq);
110 242
111 return 0; 243 return result;
112} 244}
113 245
114int ps3_free_event_irq(unsigned int virq) 246int ps3_free_event_irq(unsigned int virq)
@@ -123,7 +255,7 @@ int ps3_free_event_irq(unsigned int virq)
123 pr_debug("%s:%d: lv1_destruct_event_receive_port failed: %s\n", 255 pr_debug("%s:%d: lv1_destruct_event_receive_port failed: %s\n",
124 __func__, __LINE__, ps3_result(result)); 256 __func__, __LINE__, ps3_result(result));
125 257
126 irq_dispose_mapping(virq); 258 ps3_free_irq(virq);
127 259
128 pr_debug(" <- %s:%d\n", __func__, __LINE__); 260 pr_debug(" <- %s:%d\n", __func__, __LINE__);
129 return result; 261 return result;
@@ -136,6 +268,8 @@ int ps3_send_event_locally(unsigned int virq)
136 268
137/** 269/**
138 * ps3_connect_event_irq - Assign a virq to a system bus device. 270 * ps3_connect_event_irq - Assign a virq to a system bus device.
271 * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be
272 * serviced on.
139 * @did: The HV device identifier read from the system repository. 273 * @did: The HV device identifier read from the system repository.
140 * @interrupt_id: The device interrupt id read from the system repository. 274 * @interrupt_id: The device interrupt id read from the system repository.
141 * @virq: The assigned Linux virq. 275 * @virq: The assigned Linux virq.
@@ -144,12 +278,13 @@ int ps3_send_event_locally(unsigned int virq)
144 * coresponds to the software interrupt number. 278 * coresponds to the software interrupt number.
145 */ 279 */
146 280
147int ps3_connect_event_irq(const struct ps3_device_id *did, 281int ps3_connect_event_irq(enum ps3_cpu_binding cpu,
148 unsigned int interrupt_id, unsigned int *virq) 282 const struct ps3_device_id *did, unsigned int interrupt_id,
283 unsigned int *virq)
149{ 284{
150 int result; 285 int result;
151 286
152 result = ps3_alloc_event_irq(virq); 287 result = ps3_alloc_event_irq(cpu, virq);
153 288
154 if (result) 289 if (result)
155 return result; 290 return result;
@@ -196,6 +331,8 @@ int ps3_disconnect_event_irq(const struct ps3_device_id *did,
196 331
197/** 332/**
198 * ps3_alloc_vuart_irq - Configure the system virtual uart virq. 333 * ps3_alloc_vuart_irq - Configure the system virtual uart virq.
334 * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be
335 * serviced on.
199 * @virt_addr_bmp: The caller supplied virtual uart interrupt bitmap. 336 * @virt_addr_bmp: The caller supplied virtual uart interrupt bitmap.
200 * @virq: The assigned Linux virq. 337 * @virq: The assigned Linux virq.
201 * 338 *
@@ -203,13 +340,14 @@ int ps3_disconnect_event_irq(const struct ps3_device_id *did,
203 * freeing the interrupt will return a wrong state error. 340 * freeing the interrupt will return a wrong state error.
204 */ 341 */
205 342
206int ps3_alloc_vuart_irq(void* virt_addr_bmp, unsigned int *virq) 343int ps3_alloc_vuart_irq(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
344 unsigned int *virq)
207{ 345{
208 int result; 346 int result;
209 unsigned long outlet; 347 unsigned long outlet;
210 unsigned long lpar_addr; 348 u64 lpar_addr;
211 349
212 BUG_ON(!is_kernel_addr((unsigned long)virt_addr_bmp)); 350 BUG_ON(!is_kernel_addr((u64)virt_addr_bmp));
213 351
214 lpar_addr = ps3_mm_phys_to_lpar(__pa(virt_addr_bmp)); 352 lpar_addr = ps3_mm_phys_to_lpar(__pa(virt_addr_bmp));
215 353
@@ -221,12 +359,10 @@ int ps3_alloc_vuart_irq(void* virt_addr_bmp, unsigned int *virq)
221 return result; 359 return result;
222 } 360 }
223 361
224 *virq = irq_create_mapping(NULL, outlet); 362 result = ps3_alloc_irq(cpu, outlet, virq);
225 363 BUG_ON(result);
226 pr_debug("%s:%d: outlet %lu, virq %u\n", __func__, __LINE__,
227 outlet, *virq);
228 364
229 return 0; 365 return result;
230} 366}
231 367
232int ps3_free_vuart_irq(unsigned int virq) 368int ps3_free_vuart_irq(unsigned int virq)
@@ -241,21 +377,23 @@ int ps3_free_vuart_irq(unsigned int virq)
241 return result; 377 return result;
242 } 378 }
243 379
244 irq_dispose_mapping(virq); 380 ps3_free_irq(virq);
245 381
246 return result; 382 return result;
247} 383}
248 384
249/** 385/**
250 * ps3_alloc_spe_irq - Configure an spe virq. 386 * ps3_alloc_spe_irq - Configure an spe virq.
387 * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be
388 * serviced on.
251 * @spe_id: The spe_id returned from lv1_construct_logical_spe(). 389 * @spe_id: The spe_id returned from lv1_construct_logical_spe().
252 * @class: The spe interrupt class {0,1,2}. 390 * @class: The spe interrupt class {0,1,2}.
253 * @virq: The assigned Linux virq. 391 * @virq: The assigned Linux virq.
254 * 392 *
255 */ 393 */
256 394
257int ps3_alloc_spe_irq(unsigned long spe_id, unsigned int class, 395int ps3_alloc_spe_irq(enum ps3_cpu_binding cpu, unsigned long spe_id,
258 unsigned int *virq) 396 unsigned int class, unsigned int *virq)
259{ 397{
260 int result; 398 int result;
261 unsigned long outlet; 399 unsigned long outlet;
@@ -270,73 +408,24 @@ int ps3_alloc_spe_irq(unsigned long spe_id, unsigned int class,
270 return result; 408 return result;
271 } 409 }
272 410
273 *virq = irq_create_mapping(NULL, outlet); 411 result = ps3_alloc_irq(cpu, outlet, virq);
274 412 BUG_ON(result);
275 pr_debug("%s:%d: spe_id %lu, class %u, outlet %lu, virq %u\n",
276 __func__, __LINE__, spe_id, class, outlet, *virq);
277 413
278 return 0; 414 return result;
279} 415}
280 416
281int ps3_free_spe_irq(unsigned int virq) 417int ps3_free_spe_irq(unsigned int virq)
282{ 418{
283 irq_dispose_mapping(virq); 419 ps3_free_irq(virq);
284 return 0; 420 return 0;
285} 421}
286 422
423
287#define PS3_INVALID_OUTLET ((irq_hw_number_t)-1) 424#define PS3_INVALID_OUTLET ((irq_hw_number_t)-1)
288#define PS3_PLUG_MAX 63 425#define PS3_PLUG_MAX 63
289 426
290/**
291 * struct bmp - a per cpu irq status and mask bitmap structure
292 * @status: 256 bit status bitmap indexed by plug
293 * @unused_1:
294 * @mask: 256 bit mask bitmap indexed by plug
295 * @unused_2:
296 * @lock:
297 * @ipi_debug_brk_mask:
298 *
299 * The HV mantains per SMT thread mappings of HV outlet to HV plug on
300 * behalf of the guest. These mappings are implemented as 256 bit guest
301 * supplied bitmaps indexed by plug number. The address of the bitmaps are
302 * registered with the HV through lv1_configure_irq_state_bitmap().
303 *
304 * The HV supports 256 plugs per thread, assigned as {0..255}, for a total
305 * of 512 plugs supported on a processor. To simplify the logic this
306 * implementation equates HV plug value to linux virq value, constrains each
307 * interrupt to have a system wide unique plug number, and limits the range
308 * of the plug values to map into the first dword of the bitmaps. This
309 * gives a usable range of plug values of {NUM_ISA_INTERRUPTS..63}. Note
310 * that there is no constraint on how many in this set an individual thread
311 * can aquire.
312 */
313
314struct bmp {
315 struct {
316 unsigned long status;
317 unsigned long unused_1[3];
318 unsigned long mask;
319 unsigned long unused_2[3];
320 } __attribute__ ((packed));
321 spinlock_t lock;
322 unsigned long ipi_debug_brk_mask;
323};
324
325/**
326 * struct private - a per cpu data structure
327 * @node: HV node id
328 * @cpu: HV thread id
329 * @bmp: an HV bmp structure
330 */
331
332struct private {
333 unsigned long node;
334 unsigned int cpu;
335 struct bmp bmp;
336};
337
338#if defined(DEBUG) 427#if defined(DEBUG)
339static void _dump_64_bmp(const char *header, const unsigned long *p, unsigned cpu, 428static void _dump_64_bmp(const char *header, const u64 *p, unsigned cpu,
340 const char* func, int line) 429 const char* func, int line)
341{ 430{
342 pr_debug("%s:%d: %s %u {%04lx_%04lx_%04lx_%04lx}\n", 431 pr_debug("%s:%d: %s %u {%04lx_%04lx_%04lx_%04lx}\n",
@@ -346,14 +435,14 @@ static void _dump_64_bmp(const char *header, const unsigned long *p, unsigned cp
346} 435}
347 436
348static void __attribute__ ((unused)) _dump_256_bmp(const char *header, 437static void __attribute__ ((unused)) _dump_256_bmp(const char *header,
349 const unsigned long *p, unsigned cpu, const char* func, int line) 438 const u64 *p, unsigned cpu, const char* func, int line)
350{ 439{
351 pr_debug("%s:%d: %s %u {%016lx:%016lx:%016lx:%016lx}\n", 440 pr_debug("%s:%d: %s %u {%016lx:%016lx:%016lx:%016lx}\n",
352 func, line, header, cpu, p[0], p[1], p[2], p[3]); 441 func, line, header, cpu, p[0], p[1], p[2], p[3]);
353} 442}
354 443
355#define dump_bmp(_x) _dump_bmp(_x, __func__, __LINE__) 444#define dump_bmp(_x) _dump_bmp(_x, __func__, __LINE__)
356static void _dump_bmp(struct private* pd, const char* func, int line) 445static void _dump_bmp(struct ps3_private* pd, const char* func, int line)
357{ 446{
358 unsigned long flags; 447 unsigned long flags;
359 448
@@ -364,7 +453,7 @@ static void _dump_bmp(struct private* pd, const char* func, int line)
364} 453}
365 454
366#define dump_mask(_x) _dump_mask(_x, __func__, __LINE__) 455#define dump_mask(_x) _dump_mask(_x, __func__, __LINE__)
367static void __attribute__ ((unused)) _dump_mask(struct private* pd, 456static void __attribute__ ((unused)) _dump_mask(struct ps3_private* pd,
368 const char* func, int line) 457 const char* func, int line)
369{ 458{
370 unsigned long flags; 459 unsigned long flags;
@@ -374,109 +463,94 @@ static void __attribute__ ((unused)) _dump_mask(struct private* pd,
374 spin_unlock_irqrestore(&pd->bmp.lock, flags); 463 spin_unlock_irqrestore(&pd->bmp.lock, flags);
375} 464}
376#else 465#else
377static void dump_bmp(struct private* pd) {}; 466static void dump_bmp(struct ps3_private* pd) {};
378#endif /* defined(DEBUG) */ 467#endif /* defined(DEBUG) */
379 468
380static void chip_mask(unsigned int virq) 469static void ps3_chip_mask(unsigned int virq)
381{ 470{
471 struct ps3_private *pd = get_irq_chip_data(virq);
472 u64 bit = 0x8000000000000000UL >> virq;
473 u64 *p = &pd->bmp.mask;
474 u64 old;
382 unsigned long flags; 475 unsigned long flags;
383 struct private *pd = get_irq_chip_data(virq);
384 476
385 pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq); 477 pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
386 478
387 BUG_ON(virq < NUM_ISA_INTERRUPTS); 479 local_irq_save(flags);
388 BUG_ON(virq > PS3_PLUG_MAX); 480 asm volatile(
389 481 "1: ldarx %0,0,%3\n"
390 spin_lock_irqsave(&pd->bmp.lock, flags); 482 "andc %0,%0,%2\n"
391 pd->bmp.mask &= ~(0x8000000000000000UL >> virq); 483 "stdcx. %0,0,%3\n"
392 spin_unlock_irqrestore(&pd->bmp.lock, flags); 484 "bne- 1b"
485 : "=&r" (old), "+m" (*p)
486 : "r" (bit), "r" (p)
487 : "cc" );
393 488
394 lv1_did_update_interrupt_mask(pd->node, pd->cpu); 489 lv1_did_update_interrupt_mask(pd->node, pd->cpu);
490 local_irq_restore(flags);
395} 491}
396 492
397static void chip_unmask(unsigned int virq) 493static void ps3_chip_unmask(unsigned int virq)
398{ 494{
495 struct ps3_private *pd = get_irq_chip_data(virq);
496 u64 bit = 0x8000000000000000UL >> virq;
497 u64 *p = &pd->bmp.mask;
498 u64 old;
399 unsigned long flags; 499 unsigned long flags;
400 struct private *pd = get_irq_chip_data(virq);
401 500
402 pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq); 501 pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
403 502
404 BUG_ON(virq < NUM_ISA_INTERRUPTS); 503 local_irq_save(flags);
405 BUG_ON(virq > PS3_PLUG_MAX); 504 asm volatile(
406 505 "1: ldarx %0,0,%3\n"
407 spin_lock_irqsave(&pd->bmp.lock, flags); 506 "or %0,%0,%2\n"
408 pd->bmp.mask |= (0x8000000000000000UL >> virq); 507 "stdcx. %0,0,%3\n"
409 spin_unlock_irqrestore(&pd->bmp.lock, flags); 508 "bne- 1b"
509 : "=&r" (old), "+m" (*p)
510 : "r" (bit), "r" (p)
511 : "cc" );
410 512
411 lv1_did_update_interrupt_mask(pd->node, pd->cpu); 513 lv1_did_update_interrupt_mask(pd->node, pd->cpu);
514 local_irq_restore(flags);
412} 515}
413 516
414static void chip_eoi(unsigned int virq) 517static void ps3_chip_eoi(unsigned int virq)
415{ 518{
416 lv1_end_of_interrupt(virq); 519 const struct ps3_private *pd = get_irq_chip_data(virq);
520 lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq);
417} 521}
418 522
419static struct irq_chip irq_chip = { 523static struct irq_chip irq_chip = {
420 .typename = "ps3", 524 .typename = "ps3",
421 .mask = chip_mask, 525 .mask = ps3_chip_mask,
422 .unmask = chip_unmask, 526 .unmask = ps3_chip_unmask,
423 .eoi = chip_eoi, 527 .eoi = ps3_chip_eoi,
424}; 528};
425 529
426static void host_unmap(struct irq_host *h, unsigned int virq) 530static void ps3_host_unmap(struct irq_host *h, unsigned int virq)
427{ 531{
428 int result; 532 set_irq_chip_data(virq, NULL);
429
430 pr_debug("%s:%d: virq %d\n", __func__, __LINE__, virq);
431
432 lv1_disconnect_irq_plug(virq);
433
434 result = set_irq_chip_data(virq, NULL);
435 BUG_ON(result);
436} 533}
437 534
438static DEFINE_PER_CPU(struct private, private); 535static int ps3_host_map(struct irq_host *h, unsigned int virq,
439
440static int host_map(struct irq_host *h, unsigned int virq,
441 irq_hw_number_t hwirq) 536 irq_hw_number_t hwirq)
442{ 537{
443 int result; 538 pr_debug("%s:%d: hwirq %lu, virq %u\n", __func__, __LINE__, hwirq,
444 unsigned int cpu;
445
446 pr_debug(" -> %s:%d\n", __func__, __LINE__);
447 pr_debug("%s:%d: hwirq %lu => virq %u\n", __func__, __LINE__, hwirq,
448 virq); 539 virq);
449 540
450 /* bind this virq to a cpu */
451
452 preempt_disable();
453 cpu = smp_processor_id();
454 result = lv1_connect_irq_plug(virq, hwirq);
455 preempt_enable();
456
457 if (result) {
458 pr_info("%s:%d: lv1_connect_irq_plug failed:"
459 " %s\n", __func__, __LINE__, ps3_result(result));
460 return -EPERM;
461 }
462
463 result = set_irq_chip_data(virq, &per_cpu(private, cpu));
464 BUG_ON(result);
465
466 set_irq_chip_and_handler(virq, &irq_chip, handle_fasteoi_irq); 541 set_irq_chip_and_handler(virq, &irq_chip, handle_fasteoi_irq);
467 542
468 pr_debug(" <- %s:%d\n", __func__, __LINE__); 543 return 0;
469 return result;
470} 544}
471 545
472static struct irq_host_ops host_ops = { 546static struct irq_host_ops ps3_host_ops = {
473 .map = host_map, 547 .map = ps3_host_map,
474 .unmap = host_unmap, 548 .unmap = ps3_host_unmap,
475}; 549};
476 550
477void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq) 551void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq)
478{ 552{
479 struct private *pd = &per_cpu(private, cpu); 553 struct ps3_private *pd = &per_cpu(ps3_private, cpu);
480 554
481 pd->bmp.ipi_debug_brk_mask = 0x8000000000000000UL >> virq; 555 pd->bmp.ipi_debug_brk_mask = 0x8000000000000000UL >> virq;
482 556
@@ -484,57 +558,32 @@ void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq)
484 cpu, virq, pd->bmp.ipi_debug_brk_mask); 558 cpu, virq, pd->bmp.ipi_debug_brk_mask);
485} 559}
486 560
487static int bmp_get_and_clear_status_bit(struct bmp *m) 561unsigned int ps3_get_irq(void)
488{ 562{
489 unsigned long flags; 563 struct ps3_private *pd = &__get_cpu_var(ps3_private);
490 unsigned int bit; 564 u64 x = (pd->bmp.status & pd->bmp.mask);
491 unsigned long x; 565 unsigned int plug;
492
493 spin_lock_irqsave(&m->lock, flags);
494 566
495 /* check for ipi break first to stop this cpu ASAP */ 567 /* check for ipi break first to stop this cpu ASAP */
496 568
497 if (m->status & m->ipi_debug_brk_mask) { 569 if (x & pd->bmp.ipi_debug_brk_mask)
498 m->status &= ~m->ipi_debug_brk_mask; 570 x &= pd->bmp.ipi_debug_brk_mask;
499 spin_unlock_irqrestore(&m->lock, flags);
500 return __ilog2(m->ipi_debug_brk_mask);
501 }
502
503 x = (m->status & m->mask);
504 571
505 for (bit = NUM_ISA_INTERRUPTS, x <<= bit; x; bit++, x <<= 1) 572 asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x));
506 if (x & 0x8000000000000000UL) { 573 plug &= 0x3f;
507 m->status &= ~(0x8000000000000000UL >> bit);
508 spin_unlock_irqrestore(&m->lock, flags);
509 return bit;
510 }
511 574
512 spin_unlock_irqrestore(&m->lock, flags); 575 if (unlikely(plug) == NO_IRQ) {
513
514 pr_debug("%s:%d: not found\n", __func__, __LINE__);
515 return -1;
516}
517
518unsigned int ps3_get_irq(void)
519{
520 int plug;
521
522 struct private *pd = &__get_cpu_var(private);
523
524 plug = bmp_get_and_clear_status_bit(&pd->bmp);
525
526 if (plug < 1) {
527 pr_debug("%s:%d: no plug found: cpu %u\n", __func__, __LINE__, 576 pr_debug("%s:%d: no plug found: cpu %u\n", __func__, __LINE__,
528 pd->cpu); 577 pd->cpu);
529 dump_bmp(&per_cpu(private, 0)); 578 dump_bmp(&per_cpu(ps3_private, 0));
530 dump_bmp(&per_cpu(private, 1)); 579 dump_bmp(&per_cpu(ps3_private, 1));
531 return NO_IRQ; 580 return NO_IRQ;
532 } 581 }
533 582
534#if defined(DEBUG) 583#if defined(DEBUG)
535 if (plug < NUM_ISA_INTERRUPTS || plug > PS3_PLUG_MAX) { 584 if (unlikely(plug < NUM_ISA_INTERRUPTS || plug > PS3_PLUG_MAX)) {
536 dump_bmp(&per_cpu(private, 0)); 585 dump_bmp(&per_cpu(ps3_private, 0));
537 dump_bmp(&per_cpu(private, 1)); 586 dump_bmp(&per_cpu(ps3_private, 1));
538 BUG(); 587 BUG();
539 } 588 }
540#endif 589#endif
@@ -544,26 +593,27 @@ unsigned int ps3_get_irq(void)
544void __init ps3_init_IRQ(void) 593void __init ps3_init_IRQ(void)
545{ 594{
546 int result; 595 int result;
547 unsigned long node;
548 unsigned cpu; 596 unsigned cpu;
549 struct irq_host *host; 597 struct irq_host *host;
550 598
551 lv1_get_logical_ppe_id(&node); 599 host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0, &ps3_host_ops,
552
553 host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0, &host_ops,
554 PS3_INVALID_OUTLET); 600 PS3_INVALID_OUTLET);
555 irq_set_default_host(host); 601 irq_set_default_host(host);
556 irq_set_virq_count(PS3_PLUG_MAX + 1); 602 irq_set_virq_count(PS3_PLUG_MAX + 1);
557 603
558 for_each_possible_cpu(cpu) { 604 for_each_possible_cpu(cpu) {
559 struct private *pd = &per_cpu(private, cpu); 605 struct ps3_private *pd = &per_cpu(ps3_private, cpu);
560 606
561 pd->node = node; 607 lv1_get_logical_ppe_id(&pd->node);
562 pd->cpu = cpu; 608 pd->cpu = get_hard_smp_processor_id(cpu);
563 spin_lock_init(&pd->bmp.lock); 609 spin_lock_init(&pd->bmp.lock);
564 610
565 result = lv1_configure_irq_state_bitmap(node, cpu, 611 pr_debug("%s:%d: node %lu, cpu %d, bmp %lxh\n", __func__,
566 ps3_mm_phys_to_lpar(__pa(&pd->bmp.status))); 612 __LINE__, pd->node, pd->cpu,
613 ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
614
615 result = lv1_configure_irq_state_bitmap(pd->node, pd->cpu,
616 ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
567 617
568 if (result) 618 if (result)
569 pr_debug("%s:%d: lv1_configure_irq_state_bitmap failed:" 619 pr_debug("%s:%d: lv1_configure_irq_state_bitmap failed:"
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 49c0d010d491..42354de3f557 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -25,7 +25,6 @@
25#include <asm/firmware.h> 25#include <asm/firmware.h>
26#include <asm/lmb.h> 26#include <asm/lmb.h>
27#include <asm/udbg.h> 27#include <asm/udbg.h>
28#include <asm/ps3.h>
29#include <asm/lv1call.h> 28#include <asm/lv1call.h>
30 29
31#include "platform.h" 30#include "platform.h"
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index 58358305dc10..5c3da08bc0c4 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -22,7 +22,6 @@
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <asm/lmb.h> 24#include <asm/lmb.h>
25#include <asm/ps3.h>
26 25
27#include "platform.h" 26#include "platform.h"
28 27
@@ -59,7 +58,7 @@ struct os_area_header {
59 u32 ldr_format; 58 u32 ldr_format;
60 u32 ldr_size; 59 u32 ldr_size;
61 u32 _reserved_2[6]; 60 u32 _reserved_2[6];
62} __attribute__ ((packed)); 61};
63 62
64enum { 63enum {
65 PARAM_BOOT_FLAG_GAME_OS = 0, 64 PARAM_BOOT_FLAG_GAME_OS = 0,
@@ -67,13 +66,6 @@ enum {
67}; 66};
68 67
69enum { 68enum {
70 PARAM_AV_MULTI_OUT_NTSC = 0,
71 PARAM_AV_MULTI_OUT_PAL_RGB = 1,
72 PARAM_AV_MULTI_OUT_PAL_YCBCR = 2,
73 PARAM_AV_MULTI_OUT_SECAM = 3,
74};
75
76enum {
77 PARAM_CTRL_BUTTON_O_IS_YES = 0, 69 PARAM_CTRL_BUTTON_O_IS_YES = 0,
78 PARAM_CTRL_BUTTON_X_IS_YES = 1, 70 PARAM_CTRL_BUTTON_X_IS_YES = 1,
79}; 71};
@@ -114,7 +106,7 @@ struct os_area_params {
114 u8 dns_primary[4]; 106 u8 dns_primary[4];
115 u8 dns_secondary[4]; 107 u8 dns_secondary[4];
116 u8 _reserved_5[8]; 108 u8 _reserved_5[8];
117} __attribute__ ((packed)); 109};
118 110
119/** 111/**
120 * struct saved_params - Static working copies of data from the 'Other OS' area. 112 * struct saved_params - Static working copies of data from the 'Other OS' area.
@@ -257,3 +249,13 @@ u64 ps3_os_area_rtc_diff(void)
257{ 249{
258 return saved_params.rtc_diff ? saved_params.rtc_diff : 946684800UL; 250 return saved_params.rtc_diff ? saved_params.rtc_diff : 946684800UL;
259} 251}
252
253/**
254 * ps3_os_area_get_av_multi_out - Returns the default video mode.
255 */
256
257enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void)
258{
259 return saved_params.av_multi_out;
260}
261EXPORT_SYMBOL_GPL(ps3_os_area_get_av_multi_out);
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
index 23b111bea9d0..ca04f03305c7 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -22,6 +22,9 @@
22#define _PS3_PLATFORM_H 22#define _PS3_PLATFORM_H
23 23
24#include <linux/rtc.h> 24#include <linux/rtc.h>
25#include <scsi/scsi.h>
26
27#include <asm/ps3.h>
25 28
26/* htab */ 29/* htab */
27 30
@@ -65,4 +68,152 @@ void ps3_spu_set_platform (void);
65static inline void ps3_spu_set_platform (void) {} 68static inline void ps3_spu_set_platform (void) {}
66#endif 69#endif
67 70
71/* repository bus info */
72
73enum ps3_bus_type {
74 PS3_BUS_TYPE_SB = 4,
75 PS3_BUS_TYPE_STORAGE = 5,
76};
77
78enum ps3_dev_type {
79 PS3_DEV_TYPE_STOR_DISK = TYPE_DISK, /* 0 */
80 PS3_DEV_TYPE_SB_GELIC = 3,
81 PS3_DEV_TYPE_SB_USB = 4,
82 PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */
83 PS3_DEV_TYPE_SB_GPIO = 6,
84 PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */
85};
86
87int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str,
88 u64 *value);
89int ps3_repository_read_bus_id(unsigned int bus_index, unsigned int *bus_id);
90int ps3_repository_read_bus_type(unsigned int bus_index,
91 enum ps3_bus_type *bus_type);
92int ps3_repository_read_bus_num_dev(unsigned int bus_index,
93 unsigned int *num_dev);
94
95/* repository bus device info */
96
97enum ps3_interrupt_type {
98 PS3_INTERRUPT_TYPE_EVENT_PORT = 2,
99 PS3_INTERRUPT_TYPE_SB_OHCI = 3,
100 PS3_INTERRUPT_TYPE_SB_EHCI = 4,
101 PS3_INTERRUPT_TYPE_OTHER = 5,
102};
103
104enum ps3_reg_type {
105 PS3_REG_TYPE_SB_OHCI = 3,
106 PS3_REG_TYPE_SB_EHCI = 4,
107 PS3_REG_TYPE_SB_GPIO = 5,
108};
109
110int ps3_repository_read_dev_str(unsigned int bus_index,
111 unsigned int dev_index, const char *dev_str, u64 *value);
112int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index,
113 unsigned int *dev_id);
114int ps3_repository_read_dev_type(unsigned int bus_index,
115 unsigned int dev_index, enum ps3_dev_type *dev_type);
116int ps3_repository_read_dev_intr(unsigned int bus_index,
117 unsigned int dev_index, unsigned int intr_index,
118 enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id);
119int ps3_repository_read_dev_reg_type(unsigned int bus_index,
120 unsigned int dev_index, unsigned int reg_index,
121 enum ps3_reg_type *reg_type);
122int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
123 unsigned int dev_index, unsigned int reg_index, u64 *bus_addr,
124 u64 *len);
125int ps3_repository_read_dev_reg(unsigned int bus_index,
126 unsigned int dev_index, unsigned int reg_index,
127 enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len);
128
129/* repository bus enumerators */
130
131struct ps3_repository_device {
132 unsigned int bus_index;
133 unsigned int dev_index;
134 struct ps3_device_id did;
135};
136
137int ps3_repository_find_device(enum ps3_bus_type bus_type,
138 enum ps3_dev_type dev_type,
139 const struct ps3_repository_device *start_dev,
140 struct ps3_repository_device *dev);
141static inline int ps3_repository_find_first_device(
142 enum ps3_bus_type bus_type, enum ps3_dev_type dev_type,
143 struct ps3_repository_device *dev)
144{
145 return ps3_repository_find_device(bus_type, dev_type, NULL, dev);
146}
147int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
148 enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);
149int ps3_repository_find_reg(const struct ps3_repository_device *dev,
150 enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len);
151
152/* repository block device info */
153
154int ps3_repository_read_stor_dev_port(unsigned int bus_index,
155 unsigned int dev_index, u64 *port);
156int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index,
157 unsigned int dev_index, u64 *blk_size);
158int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index,
159 unsigned int dev_index, u64 *num_blocks);
160int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index,
161 unsigned int dev_index, unsigned int *num_regions);
162int ps3_repository_read_stor_dev_region_id(unsigned int bus_index,
163 unsigned int dev_index, unsigned int region_index,
164 unsigned int *region_id);
165int ps3_repository_read_stor_dev_region_size(unsigned int bus_index,
166 unsigned int dev_index, unsigned int region_index, u64 *region_size);
167int ps3_repository_read_stor_dev_region_start(unsigned int bus_index,
168 unsigned int dev_index, unsigned int region_index, u64 *region_start);
169int ps3_repository_read_stor_dev_info(unsigned int bus_index,
170 unsigned int dev_index, u64 *port, u64 *blk_size,
171 u64 *num_blocks, unsigned int *num_regions);
172int ps3_repository_read_stor_dev_region(unsigned int bus_index,
173 unsigned int dev_index, unsigned int region_index,
174 unsigned int *region_id, u64 *region_start, u64 *region_size);
175
176/* repository pu and memory info */
177
178int ps3_repository_read_num_pu(unsigned int *num_pu);
179int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id);
180int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base);
181int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size);
182int ps3_repository_read_region_total(u64 *region_total);
183int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size,
184 u64 *region_total);
185
186/* repository pme info */
187
188int ps3_repository_read_num_be(unsigned int *num_be);
189int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id);
190int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq);
191int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq);
192
193/* repository 'Other OS' area */
194
195int ps3_repository_read_boot_dat_addr(u64 *lpar_addr);
196int ps3_repository_read_boot_dat_size(unsigned int *size);
197int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size);
198
199/* repository spu info */
200
201/**
202 * enum spu_resource_type - Type of spu resource.
203 * @spu_resource_type_shared: Logical spu is shared with other partions.
204 * @spu_resource_type_exclusive: Logical spu is not shared with other partions.
205 *
206 * Returned by ps3_repository_read_spu_resource_id().
207 */
208
209enum ps3_spu_resource_type {
210 PS3_SPU_RESOURCE_TYPE_SHARED = 0,
211 PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL,
212};
213
214int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved);
215int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id);
216int ps3_repository_read_spu_resource_id(unsigned int res_index,
217 enum ps3_spu_resource_type* resource_type, unsigned int *resource_id);
218
68#endif 219#endif
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index 273a0d621bdd..ae586a0e5d3f 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -18,9 +18,10 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#include <asm/ps3.h>
22#include <asm/lv1call.h> 21#include <asm/lv1call.h>
23 22
23#include "platform.h"
24
24enum ps3_vendor_id { 25enum ps3_vendor_id {
25 PS3_VENDOR_ID_NONE = 0, 26 PS3_VENDOR_ID_NONE = 0,
26 PS3_VENDOR_ID_SONY = 0x8000000000000000UL, 27 PS3_VENDOR_ID_SONY = 0x8000000000000000UL,
@@ -257,7 +258,7 @@ int ps3_repository_read_dev_type(unsigned int bus_index,
257 258
258int ps3_repository_read_dev_intr(unsigned int bus_index, 259int ps3_repository_read_dev_intr(unsigned int bus_index,
259 unsigned int dev_index, unsigned int intr_index, 260 unsigned int dev_index, unsigned int intr_index,
260 unsigned int *intr_type, unsigned int* interrupt_id) 261 enum ps3_interrupt_type *intr_type, unsigned int* interrupt_id)
261{ 262{
262 int result; 263 int result;
263 u64 v1; 264 u64 v1;
@@ -275,7 +276,8 @@ int ps3_repository_read_dev_intr(unsigned int bus_index,
275} 276}
276 277
277int ps3_repository_read_dev_reg_type(unsigned int bus_index, 278int ps3_repository_read_dev_reg_type(unsigned int bus_index,
278 unsigned int dev_index, unsigned int reg_index, unsigned int *reg_type) 279 unsigned int dev_index, unsigned int reg_index,
280 enum ps3_reg_type *reg_type)
279{ 281{
280 int result; 282 int result;
281 u64 v1; 283 u64 v1;
@@ -302,8 +304,8 @@ int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
302} 304}
303 305
304int ps3_repository_read_dev_reg(unsigned int bus_index, 306int ps3_repository_read_dev_reg(unsigned int bus_index,
305 unsigned int dev_index, unsigned int reg_index, unsigned int *reg_type, 307 unsigned int dev_index, unsigned int reg_index,
306 u64 *bus_addr, u64 *len) 308 enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len)
307{ 309{
308 int result = ps3_repository_read_dev_reg_type(bus_index, dev_index, 310 int result = ps3_repository_read_dev_reg_type(bus_index, dev_index,
309 reg_index, reg_type); 311 reg_index, reg_type);
@@ -343,7 +345,7 @@ int ps3_repository_dump_resource_info(unsigned int bus_index,
343 } 345 }
344 346
345 for (res_index = 0; res_index < 10; res_index++) { 347 for (res_index = 0; res_index < 10; res_index++) {
346 enum ps3_region_type reg_type; 348 enum ps3_reg_type reg_type;
347 u64 bus_addr; 349 u64 bus_addr;
348 u64 len; 350 u64 len;
349 351
@@ -367,7 +369,55 @@ int ps3_repository_dump_resource_info(unsigned int bus_index,
367 return result; 369 return result;
368} 370}
369 371
370static int dump_device_info(unsigned int bus_index, unsigned int num_dev) 372static int dump_stor_dev_info(unsigned int bus_index, unsigned int dev_index)
373{
374 int result = 0;
375 unsigned int num_regions, region_index;
376 u64 port, blk_size, num_blocks;
377
378 pr_debug(" -> %s:%d: (%u:%u)\n", __func__, __LINE__,
379 bus_index, dev_index);
380
381 result = ps3_repository_read_stor_dev_info(bus_index, dev_index, &port,
382 &blk_size, &num_blocks, &num_regions);
383 if (result) {
384 pr_debug("%s:%d ps3_repository_read_stor_dev_info"
385 " (%u:%u) failed\n", __func__, __LINE__,
386 bus_index, dev_index);
387 goto out;
388 }
389
390 pr_debug("%s:%d (%u:%u): port %lu, blk_size %lu, num_blocks "
391 "%lu, num_regions %u\n",
392 __func__, __LINE__, bus_index, dev_index, port,
393 blk_size, num_blocks, num_regions);
394
395 for (region_index = 0; region_index < num_regions; region_index++) {
396 unsigned int region_id;
397 u64 region_start, region_size;
398
399 result = ps3_repository_read_stor_dev_region(bus_index,
400 dev_index, region_index, &region_id, &region_start,
401 &region_size);
402 if (result) {
403 pr_debug("%s:%d ps3_repository_read_stor_dev_region"
404 " (%u:%u) failed\n", __func__, __LINE__,
405 bus_index, dev_index);
406 break;
407 }
408
409 pr_debug("%s:%d (%u:%u) region_id %u, start %lxh, size %lxh\n",
410 __func__, __LINE__, bus_index, dev_index, region_id,
411 region_start, region_size);
412 }
413
414out:
415 pr_debug(" <- %s:%d\n", __func__, __LINE__);
416 return result;
417}
418
419static int dump_device_info(unsigned int bus_index, enum ps3_bus_type bus_type,
420 unsigned int num_dev)
371{ 421{
372 int result = 0; 422 int result = 0;
373 unsigned int dev_index; 423 unsigned int dev_index;
@@ -402,6 +452,9 @@ static int dump_device_info(unsigned int bus_index, unsigned int num_dev)
402 __LINE__, bus_index, dev_index, dev_type, dev_id); 452 __LINE__, bus_index, dev_index, dev_type, dev_id);
403 453
404 ps3_repository_dump_resource_info(bus_index, dev_index); 454 ps3_repository_dump_resource_info(bus_index, dev_index);
455
456 if (bus_type == PS3_BUS_TYPE_STORAGE)
457 dump_stor_dev_info(bus_index, dev_index);
405 } 458 }
406 459
407 pr_debug(" <- %s:%d\n", __func__, __LINE__); 460 pr_debug(" <- %s:%d\n", __func__, __LINE__);
@@ -452,7 +505,7 @@ int ps3_repository_dump_bus_info(void)
452 __func__, __LINE__, bus_index, bus_type, bus_id, 505 __func__, __LINE__, bus_index, bus_type, bus_id,
453 num_dev); 506 num_dev);
454 507
455 dump_device_info(bus_index, num_dev); 508 dump_device_info(bus_index, bus_type, num_dev);
456 } 509 }
457 510
458 pr_debug(" <- %s:%d\n", __func__, __LINE__); 511 pr_debug(" <- %s:%d\n", __func__, __LINE__);
@@ -487,7 +540,8 @@ static int find_device(unsigned int bus_index, unsigned int num_dev,
487 break; 540 break;
488 } 541 }
489 542
490 BUG_ON(dev_index == num_dev); 543 if (dev_index == num_dev)
544 return -1;
491 545
492 pr_debug("%s:%d: found dev_type %u at dev_index %u\n", 546 pr_debug("%s:%d: found dev_type %u at dev_index %u\n",
493 __func__, __LINE__, dev_type, dev_index); 547 __func__, __LINE__, dev_type, dev_index);
@@ -521,7 +575,7 @@ int ps3_repository_find_device (enum ps3_bus_type bus_type,
521 pr_debug("%s:%d: find bus_type %u, dev_type %u\n", __func__, __LINE__, 575 pr_debug("%s:%d: find bus_type %u, dev_type %u\n", __func__, __LINE__,
522 bus_type, dev_type); 576 bus_type, dev_type);
523 577
524 dev->bus_index = UINT_MAX; 578 BUG_ON(start_dev && start_dev->bus_index > 10);
525 579
526 for (bus_index = start_dev ? start_dev->bus_index : 0; bus_index < 10; 580 for (bus_index = start_dev ? start_dev->bus_index : 0; bus_index < 10;
527 bus_index++) { 581 bus_index++) {
@@ -532,13 +586,15 @@ int ps3_repository_find_device (enum ps3_bus_type bus_type,
532 if (result) { 586 if (result) {
533 pr_debug("%s:%d read_bus_type failed\n", 587 pr_debug("%s:%d read_bus_type failed\n",
534 __func__, __LINE__); 588 __func__, __LINE__);
589 dev->bus_index = UINT_MAX;
535 return result; 590 return result;
536 } 591 }
537 if (x == bus_type) 592 if (x == bus_type)
538 break; 593 break;
539 } 594 }
540 595
541 BUG_ON(bus_index == 10); 596 if (bus_index >= 10)
597 return -ENODEV;
542 598
543 pr_debug("%s:%d: found bus_type %u at bus_index %u\n", 599 pr_debug("%s:%d: found bus_type %u at bus_index %u\n",
544 __func__, __LINE__, bus_type, bus_index); 600 __func__, __LINE__, bus_type, bus_index);
@@ -604,7 +660,8 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
604 } 660 }
605 } 661 }
606 662
607 BUG_ON(res_index == 10); 663 if (res_index == 10)
664 return -ENODEV;
608 665
609 pr_debug("%s:%d: found intr_type %u at res_index %u\n", 666 pr_debug("%s:%d: found intr_type %u at res_index %u\n",
610 __func__, __LINE__, intr_type, res_index); 667 __func__, __LINE__, intr_type, res_index);
@@ -612,8 +669,8 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
612 return result; 669 return result;
613} 670}
614 671
615int ps3_repository_find_region(const struct ps3_repository_device *dev, 672int ps3_repository_find_reg(const struct ps3_repository_device *dev,
616 enum ps3_region_type reg_type, u64 *bus_addr, u64 *len) 673 enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len)
617{ 674{
618 int result = 0; 675 int result = 0;
619 unsigned int res_index; 676 unsigned int res_index;
@@ -623,7 +680,7 @@ int ps3_repository_find_region(const struct ps3_repository_device *dev,
623 *bus_addr = *len = 0; 680 *bus_addr = *len = 0;
624 681
625 for (res_index = 0; res_index < 10; res_index++) { 682 for (res_index = 0; res_index < 10; res_index++) {
626 enum ps3_region_type t; 683 enum ps3_reg_type t;
627 u64 a; 684 u64 a;
628 u64 l; 685 u64 l;
629 686
@@ -643,7 +700,8 @@ int ps3_repository_find_region(const struct ps3_repository_device *dev,
643 } 700 }
644 } 701 }
645 702
646 BUG_ON(res_index == 10); 703 if (res_index == 10)
704 return -ENODEV;
647 705
648 pr_debug("%s:%d: found reg_type %u at res_index %u\n", 706 pr_debug("%s:%d: found reg_type %u at res_index %u\n",
649 __func__, __LINE__, reg_type, res_index); 707 __func__, __LINE__, reg_type, res_index);
@@ -651,6 +709,136 @@ int ps3_repository_find_region(const struct ps3_repository_device *dev,
651 return result; 709 return result;
652} 710}
653 711
712int ps3_repository_read_stor_dev_port(unsigned int bus_index,
713 unsigned int dev_index, u64 *port)
714{
715 return read_node(PS3_LPAR_ID_PME,
716 make_first_field("bus", bus_index),
717 make_field("dev", dev_index),
718 make_field("port", 0),
719 0, port, 0);
720}
721
722int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index,
723 unsigned int dev_index, u64 *blk_size)
724{
725 return read_node(PS3_LPAR_ID_PME,
726 make_first_field("bus", bus_index),
727 make_field("dev", dev_index),
728 make_field("blk_size", 0),
729 0, blk_size, 0);
730}
731
732int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index,
733 unsigned int dev_index, u64 *num_blocks)
734{
735 return read_node(PS3_LPAR_ID_PME,
736 make_first_field("bus", bus_index),
737 make_field("dev", dev_index),
738 make_field("n_blocks", 0),
739 0, num_blocks, 0);
740}
741
742int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index,
743 unsigned int dev_index, unsigned int *num_regions)
744{
745 int result;
746 u64 v1;
747
748 result = read_node(PS3_LPAR_ID_PME,
749 make_first_field("bus", bus_index),
750 make_field("dev", dev_index),
751 make_field("n_regs", 0),
752 0, &v1, 0);
753 *num_regions = v1;
754 return result;
755}
756
757int ps3_repository_read_stor_dev_region_id(unsigned int bus_index,
758 unsigned int dev_index, unsigned int region_index,
759 unsigned int *region_id)
760{
761 int result;
762 u64 v1;
763
764 result = read_node(PS3_LPAR_ID_PME,
765 make_first_field("bus", bus_index),
766 make_field("dev", dev_index),
767 make_field("region", region_index),
768 make_field("id", 0),
769 &v1, 0);
770 *region_id = v1;
771 return result;
772}
773
774int ps3_repository_read_stor_dev_region_size(unsigned int bus_index,
775 unsigned int dev_index, unsigned int region_index, u64 *region_size)
776{
777 return read_node(PS3_LPAR_ID_PME,
778 make_first_field("bus", bus_index),
779 make_field("dev", dev_index),
780 make_field("region", region_index),
781 make_field("size", 0),
782 region_size, 0);
783}
784
785int ps3_repository_read_stor_dev_region_start(unsigned int bus_index,
786 unsigned int dev_index, unsigned int region_index, u64 *region_start)
787{
788 return read_node(PS3_LPAR_ID_PME,
789 make_first_field("bus", bus_index),
790 make_field("dev", dev_index),
791 make_field("region", region_index),
792 make_field("start", 0),
793 region_start, 0);
794}
795
796int ps3_repository_read_stor_dev_info(unsigned int bus_index,
797 unsigned int dev_index, u64 *port, u64 *blk_size,
798 u64 *num_blocks, unsigned int *num_regions)
799{
800 int result;
801
802 result = ps3_repository_read_stor_dev_port(bus_index, dev_index, port);
803 if (result)
804 return result;
805
806 result = ps3_repository_read_stor_dev_blk_size(bus_index, dev_index,
807 blk_size);
808 if (result)
809 return result;
810
811 result = ps3_repository_read_stor_dev_num_blocks(bus_index, dev_index,
812 num_blocks);
813 if (result)
814 return result;
815
816 result = ps3_repository_read_stor_dev_num_regions(bus_index, dev_index,
817 num_regions);
818 return result;
819}
820
821int ps3_repository_read_stor_dev_region(unsigned int bus_index,
822 unsigned int dev_index, unsigned int region_index,
823 unsigned int *region_id, u64 *region_start, u64 *region_size)
824{
825 int result;
826
827 result = ps3_repository_read_stor_dev_region_id(bus_index, dev_index,
828 region_index, region_id);
829 if (result)
830 return result;
831
832 result = ps3_repository_read_stor_dev_region_start(bus_index, dev_index,
833 region_index, region_start);
834 if (result)
835 return result;
836
837 result = ps3_repository_read_stor_dev_region_size(bus_index, dev_index,
838 region_index, region_size);
839 return result;
840}
841
654int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size) 842int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size)
655{ 843{
656 return read_node(PS3_LPAR_ID_CURRENT, 844 return read_node(PS3_LPAR_ID_CURRENT,
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index d8b5cadbe80e..e62505e18813 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -41,10 +41,18 @@
41#define DBG(fmt...) do{if(0)printk(fmt);}while(0) 41#define DBG(fmt...) do{if(0)printk(fmt);}while(0)
42#endif 42#endif
43 43
44static void ps3_show_cpuinfo(struct seq_file *m) 44int ps3_get_firmware_version(union ps3_firmware_version *v)
45{ 45{
46 seq_printf(m, "machine\t\t: %s\n", ppc_md.name); 46 int result = lv1_get_version_info(&v->raw);
47
48 if (result) {
49 v->raw = 0;
50 return -1;
51 }
52
53 return result;
47} 54}
55EXPORT_SYMBOL_GPL(ps3_get_firmware_version);
48 56
49static void ps3_power_save(void) 57static void ps3_power_save(void)
50{ 58{
@@ -74,8 +82,14 @@ static void ps3_panic(char *str)
74 82
75static void __init ps3_setup_arch(void) 83static void __init ps3_setup_arch(void)
76{ 84{
85 union ps3_firmware_version v;
86
77 DBG(" -> %s:%d\n", __func__, __LINE__); 87 DBG(" -> %s:%d\n", __func__, __LINE__);
78 88
89 ps3_get_firmware_version(&v);
90 printk(KERN_INFO "PS3 firmware version %u.%u.%u\n", v.major, v.minor,
91 v.rev);
92
79 ps3_spu_set_platform(); 93 ps3_spu_set_platform();
80 ps3_map_htab(); 94 ps3_map_htab();
81 95
@@ -156,7 +170,6 @@ define_machine(ps3) {
156 .name = "PS3", 170 .name = "PS3",
157 .probe = ps3_probe, 171 .probe = ps3_probe,
158 .setup_arch = ps3_setup_arch, 172 .setup_arch = ps3_setup_arch,
159 .show_cpuinfo = ps3_show_cpuinfo,
160 .init_IRQ = ps3_init_IRQ, 173 .init_IRQ = ps3_init_IRQ,
161 .panic = ps3_panic, 174 .panic = ps3_panic,
162 .get_boot_time = ps3_get_boot_time, 175 .get_boot_time = ps3_get_boot_time,
diff --git a/arch/powerpc/platforms/ps3/smp.c b/arch/powerpc/platforms/ps3/smp.c
index 11d2080607ed..6fb887961a6d 100644
--- a/arch/powerpc/platforms/ps3/smp.c
+++ b/arch/powerpc/platforms/ps3/smp.c
@@ -23,7 +23,6 @@
23 23
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25#include <asm/udbg.h> 25#include <asm/udbg.h>
26#include <asm/ps3.h>
27 26
28#include "platform.h" 27#include "platform.h"
29 28
@@ -111,7 +110,7 @@ static void __init ps3_smp_setup_cpu(int cpu)
111 BUILD_BUG_ON(PPC_MSG_DEBUGGER_BREAK != 3); 110 BUILD_BUG_ON(PPC_MSG_DEBUGGER_BREAK != 3);
112 111
113 for (i = 0; i < MSG_COUNT; i++) { 112 for (i = 0; i < MSG_COUNT; i++) {
114 result = ps3_alloc_event_irq(&virqs[i]); 113 result = ps3_alloc_event_irq(cpu, &virqs[i]);
115 114
116 if (result) 115 if (result)
117 continue; 116 continue;
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index 644532c3b7c4..d1929721b0e4 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -26,9 +26,10 @@
26 26
27#include <asm/spu.h> 27#include <asm/spu.h>
28#include <asm/spu_priv1.h> 28#include <asm/spu_priv1.h>
29#include <asm/ps3.h>
30#include <asm/lv1call.h> 29#include <asm/lv1call.h>
31 30
31#include "platform.h"
32
32/* spu_management_ops */ 33/* spu_management_ops */
33 34
34/** 35/**
@@ -50,7 +51,7 @@ enum spe_type {
50 */ 51 */
51 52
52struct spe_shadow { 53struct spe_shadow {
53 u8 padding_0000[0x0140]; 54 u8 padding_0140[0x0140];
54 u64 int_status_class0_RW; /* 0x0140 */ 55 u64 int_status_class0_RW; /* 0x0140 */
55 u64 int_status_class1_RW; /* 0x0148 */ 56 u64 int_status_class1_RW; /* 0x0148 */
56 u64 int_status_class2_RW; /* 0x0150 */ 57 u64 int_status_class2_RW; /* 0x0150 */
@@ -67,8 +68,7 @@ struct spe_shadow {
67 u8 padding_0c08[0x0f00-0x0c08]; 68 u8 padding_0c08[0x0f00-0x0c08];
68 u64 spe_execution_status; /* 0x0f00 */ 69 u64 spe_execution_status; /* 0x0f00 */
69 u8 padding_0f08[0x1000-0x0f08]; 70 u8 padding_0f08[0x1000-0x0f08];
70} __attribute__ ((packed)); 71};
71
72 72
73/** 73/**
74 * enum spe_ex_state - Logical spe execution state. 74 * enum spe_ex_state - Logical spe execution state.
@@ -268,20 +268,20 @@ static int __init setup_interrupts(struct spu *spu)
268{ 268{
269 int result; 269 int result;
270 270
271 result = ps3_alloc_spe_irq(spu_pdata(spu)->spe_id, 0, 271 result = ps3_alloc_spe_irq(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id,
272 &spu->irqs[0]); 272 0, &spu->irqs[0]);
273 273
274 if (result) 274 if (result)
275 goto fail_alloc_0; 275 goto fail_alloc_0;
276 276
277 result = ps3_alloc_spe_irq(spu_pdata(spu)->spe_id, 1, 277 result = ps3_alloc_spe_irq(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id,
278 &spu->irqs[1]); 278 1, &spu->irqs[1]);
279 279
280 if (result) 280 if (result)
281 goto fail_alloc_1; 281 goto fail_alloc_1;
282 282
283 result = ps3_alloc_spe_irq(spu_pdata(spu)->spe_id, 2, 283 result = ps3_alloc_spe_irq(PS3_BINDING_CPU_ANY, spu_pdata(spu)->spe_id,
284 &spu->irqs[2]); 284 2, &spu->irqs[2]);
285 285
286 if (result) 286 if (result)
287 goto fail_alloc_2; 287 goto fail_alloc_2;
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
new file mode 100644
index 000000000000..a9f7e4a39a2a
--- /dev/null
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -0,0 +1,384 @@
1/*
2 * PS3 system bus driver.
3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/dma-mapping.h>
25#include <linux/err.h>
26
27#include <asm/udbg.h>
28#include <asm/lv1call.h>
29#include <asm/firmware.h>
30
31#include "platform.h"
32
33#define dump_mmio_region(_a) _dump_mmio_region(_a, __func__, __LINE__)
34static void _dump_mmio_region(const struct ps3_mmio_region* r,
35 const char* func, int line)
36{
37 pr_debug("%s:%d: dev %u:%u\n", func, line, r->did.bus_id,
38 r->did.dev_id);
39 pr_debug("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr);
40 pr_debug("%s:%d: len %lxh\n", func, line, r->len);
41 pr_debug("%s:%d: lpar_addr %lxh\n", func, line, r->lpar_addr);
42}
43
44int ps3_mmio_region_create(struct ps3_mmio_region *r)
45{
46 int result;
47
48 result = lv1_map_device_mmio_region(r->did.bus_id, r->did.dev_id,
49 r->bus_addr, r->len, r->page_size, &r->lpar_addr);
50
51 if (result) {
52 pr_debug("%s:%d: lv1_map_device_mmio_region failed: %s\n",
53 __func__, __LINE__, ps3_result(result));
54 r->lpar_addr = 0;
55 }
56
57 dump_mmio_region(r);
58 return result;
59}
60EXPORT_SYMBOL_GPL(ps3_mmio_region_create);
61
62int ps3_free_mmio_region(struct ps3_mmio_region *r)
63{
64 int result;
65
66 result = lv1_unmap_device_mmio_region(r->did.bus_id, r->did.dev_id,
67 r->lpar_addr);
68
69 if (result)
70 pr_debug("%s:%d: lv1_unmap_device_mmio_region failed: %s\n",
71 __func__, __LINE__, ps3_result(result));
72
73 r->lpar_addr = 0;
74 return result;
75}
76EXPORT_SYMBOL_GPL(ps3_free_mmio_region);
77
78static int ps3_system_bus_match(struct device *_dev,
79 struct device_driver *_drv)
80{
81 int result;
82 struct ps3_system_bus_driver *drv = to_ps3_system_bus_driver(_drv);
83 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
84
85 result = dev->match_id == drv->match_id;
86
87 pr_info("%s:%d: dev=%u(%s), drv=%u(%s): %s\n", __func__, __LINE__,
88 dev->match_id, dev->core.bus_id, drv->match_id, drv->core.name,
89 (result ? "match" : "miss"));
90 return result;
91}
92
93static int ps3_system_bus_probe(struct device *_dev)
94{
95 int result;
96 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
97 struct ps3_system_bus_driver *drv =
98 to_ps3_system_bus_driver(_dev->driver);
99
100 result = lv1_open_device(dev->did.bus_id, dev->did.dev_id, 0);
101
102 if (result) {
103 pr_debug("%s:%d: lv1_open_device failed (%d)\n",
104 __func__, __LINE__, result);
105 result = -EACCES;
106 goto clean_none;
107 }
108
109 if (dev->d_region->did.bus_id) {
110 result = ps3_dma_region_create(dev->d_region);
111
112 if (result) {
113 pr_debug("%s:%d: ps3_dma_region_create failed (%d)\n",
114 __func__, __LINE__, result);
115 BUG_ON("check region type");
116 result = -EINVAL;
117 goto clean_device;
118 }
119 }
120
121 BUG_ON(!drv);
122
123 if (drv->probe)
124 result = drv->probe(dev);
125 else
126 pr_info("%s:%d: %s no probe method\n", __func__, __LINE__,
127 dev->core.bus_id);
128
129 if (result) {
130 pr_debug("%s:%d: drv->probe failed\n", __func__, __LINE__);
131 goto clean_dma;
132 }
133
134 return result;
135
136clean_dma:
137 ps3_dma_region_free(dev->d_region);
138clean_device:
139 lv1_close_device(dev->did.bus_id, dev->did.dev_id);
140clean_none:
141 return result;
142}
143
144static int ps3_system_bus_remove(struct device *_dev)
145{
146 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
147 struct ps3_system_bus_driver *drv =
148 to_ps3_system_bus_driver(_dev->driver);
149
150 if (drv->remove)
151 drv->remove(dev);
152 else
153 pr_info("%s:%d: %s no remove method\n", __func__, __LINE__,
154 dev->core.bus_id);
155
156 ps3_dma_region_free(dev->d_region);
157 ps3_free_mmio_region(dev->m_region);
158 lv1_close_device(dev->did.bus_id, dev->did.dev_id);
159
160 return 0;
161}
162
163struct bus_type ps3_system_bus_type = {
164 .name = "ps3_system_bus",
165 .match = ps3_system_bus_match,
166 .probe = ps3_system_bus_probe,
167 .remove = ps3_system_bus_remove,
168};
169
170int __init ps3_system_bus_init(void)
171{
172 int result;
173
174 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
175 return 0;
176
177 result = bus_register(&ps3_system_bus_type);
178 BUG_ON(result);
179 return result;
180}
181
182core_initcall(ps3_system_bus_init);
183
184/* Allocates a contiguous real buffer and creates mappings over it.
185 * Returns the virtual address of the buffer and sets dma_handle
186 * to the dma address (mapping) of the first page.
187 */
188
189static void * ps3_alloc_coherent(struct device *_dev, size_t size,
190 dma_addr_t *dma_handle, gfp_t flag)
191{
192 int result;
193 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
194 unsigned long virt_addr;
195
196 BUG_ON(!dev->d_region->bus_addr);
197
198 flag &= ~(__GFP_DMA | __GFP_HIGHMEM);
199 flag |= __GFP_ZERO;
200
201 virt_addr = __get_free_pages(flag, get_order(size));
202
203 if (!virt_addr) {
204 pr_debug("%s:%d: get_free_pages failed\n", __func__, __LINE__);
205 goto clean_none;
206 }
207
208 result = ps3_dma_map(dev->d_region, virt_addr, size, dma_handle);
209
210 if (result) {
211 pr_debug("%s:%d: ps3_dma_map failed (%d)\n",
212 __func__, __LINE__, result);
213 BUG_ON("check region type");
214 goto clean_alloc;
215 }
216
217 return (void*)virt_addr;
218
219clean_alloc:
220 free_pages(virt_addr, get_order(size));
221clean_none:
222 dma_handle = NULL;
223 return NULL;
224}
225
226static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr,
227 dma_addr_t dma_handle)
228{
229 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
230
231 ps3_dma_unmap(dev->d_region, dma_handle, size);
232 free_pages((unsigned long)vaddr, get_order(size));
233}
234
235/* Creates TCEs for a user provided buffer. The user buffer must be
236 * contiguous real kernel storage (not vmalloc). The address of the buffer
237 * passed here is the kernel (virtual) address of the buffer. The buffer
238 * need not be page aligned, the dma_addr_t returned will point to the same
239 * byte within the page as vaddr.
240 */
241
242static dma_addr_t ps3_map_single(struct device *_dev, void *ptr, size_t size,
243 enum dma_data_direction direction)
244{
245 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
246 int result;
247 unsigned long bus_addr;
248
249 result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size,
250 &bus_addr);
251
252 if (result) {
253 pr_debug("%s:%d: ps3_dma_map failed (%d)\n",
254 __func__, __LINE__, result);
255 }
256
257 return bus_addr;
258}
259
260static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr,
261 size_t size, enum dma_data_direction direction)
262{
263 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
264 int result;
265
266 result = ps3_dma_unmap(dev->d_region, dma_addr, size);
267
268 if (result) {
269 pr_debug("%s:%d: ps3_dma_unmap failed (%d)\n",
270 __func__, __LINE__, result);
271 }
272}
273
274static int ps3_map_sg(struct device *_dev, struct scatterlist *sg, int nents,
275 enum dma_data_direction direction)
276{
277 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
278 int i;
279
280#if defined(CONFIG_PS3_DYNAMIC_DMA)
281 BUG_ON("do");
282 return -EPERM;
283#else
284 for (i = 0; i < nents; i++, sg++) {
285 int result = ps3_dma_map(dev->d_region,
286 page_to_phys(sg->page) + sg->offset, sg->length,
287 &sg->dma_address);
288
289 if (result) {
290 pr_debug("%s:%d: ps3_dma_map failed (%d)\n",
291 __func__, __LINE__, result);
292 return -EINVAL;
293 }
294
295 sg->dma_length = sg->length;
296 }
297
298 return nents;
299#endif
300}
301
302static void ps3_unmap_sg(struct device *_dev, struct scatterlist *sg,
303 int nents, enum dma_data_direction direction)
304{
305#if defined(CONFIG_PS3_DYNAMIC_DMA)
306 BUG_ON("do");
307#endif
308}
309
310static int ps3_dma_supported(struct device *_dev, u64 mask)
311{
312 return mask >= DMA_32BIT_MASK;
313}
314
315static struct dma_mapping_ops ps3_dma_ops = {
316 .alloc_coherent = ps3_alloc_coherent,
317 .free_coherent = ps3_free_coherent,
318 .map_single = ps3_map_single,
319 .unmap_single = ps3_unmap_single,
320 .map_sg = ps3_map_sg,
321 .unmap_sg = ps3_unmap_sg,
322 .dma_supported = ps3_dma_supported
323};
324
325/**
326 * ps3_system_bus_release_device - remove a device from the system bus
327 */
328
329static void ps3_system_bus_release_device(struct device *_dev)
330{
331 struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev);
332 kfree(dev);
333}
334
335/**
336 * ps3_system_bus_device_register - add a device to the system bus
337 *
338 * ps3_system_bus_device_register() expects the dev object to be allocated
339 * dynamically by the caller. The system bus takes ownership of the dev
340 * object and frees the object in ps3_system_bus_release_device().
341 */
342
343int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
344{
345 int result;
346 static unsigned int dev_count = 1;
347
348 dev->core.parent = NULL;
349 dev->core.bus = &ps3_system_bus_type;
350 dev->core.release = ps3_system_bus_release_device;
351
352 dev->core.archdata.of_node = NULL;
353 dev->core.archdata.dma_ops = &ps3_dma_ops;
354 dev->core.archdata.numa_node = 0;
355
356 snprintf(dev->core.bus_id, sizeof(dev->core.bus_id), "sb_%02x",
357 dev_count++);
358
359 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev->core.bus_id);
360
361 result = device_register(&dev->core);
362 return result;
363}
364
365EXPORT_SYMBOL_GPL(ps3_system_bus_device_register);
366
367int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv)
368{
369 int result;
370
371 drv->core.bus = &ps3_system_bus_type;
372
373 result = driver_register(&drv->core);
374 return result;
375}
376
377EXPORT_SYMBOL_GPL(ps3_system_bus_driver_register);
378
379void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv)
380{
381 driver_unregister(&drv->core);
382}
383
384EXPORT_SYMBOL_GPL(ps3_system_bus_driver_unregister);
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index da6e5362e7cd..9437f48cc9e7 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -747,6 +747,7 @@ struct eeh_early_enable_info {
747/* Enable eeh for the given device node. */ 747/* Enable eeh for the given device node. */
748static void *early_enable_eeh(struct device_node *dn, void *data) 748static void *early_enable_eeh(struct device_node *dn, void *data)
749{ 749{
750 unsigned int rets[3];
750 struct eeh_early_enable_info *info = data; 751 struct eeh_early_enable_info *info = data;
751 int ret; 752 int ret;
752 const char *status = get_property(dn, "status", NULL); 753 const char *status = get_property(dn, "status", NULL);
@@ -803,16 +804,14 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
803 regs[0], info->buid_hi, info->buid_lo, 804 regs[0], info->buid_hi, info->buid_lo,
804 EEH_ENABLE); 805 EEH_ENABLE);
805 806
807 enable = 0;
806 if (ret == 0) { 808 if (ret == 0) {
807 eeh_subsystem_enabled = 1;
808 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
809 pdn->eeh_config_addr = regs[0]; 809 pdn->eeh_config_addr = regs[0];
810 810
811 /* If the newer, better, ibm,get-config-addr-info is supported, 811 /* If the newer, better, ibm,get-config-addr-info is supported,
812 * then use that instead. */ 812 * then use that instead. */
813 pdn->eeh_pe_config_addr = 0; 813 pdn->eeh_pe_config_addr = 0;
814 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) { 814 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) {
815 unsigned int rets[2];
816 ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets, 815 ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets,
817 pdn->eeh_config_addr, 816 pdn->eeh_config_addr,
818 info->buid_hi, info->buid_lo, 817 info->buid_hi, info->buid_lo,
@@ -820,6 +819,20 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
820 if (ret == 0) 819 if (ret == 0)
821 pdn->eeh_pe_config_addr = rets[0]; 820 pdn->eeh_pe_config_addr = rets[0];
822 } 821 }
822
823 /* Some older systems (Power4) allow the
824 * ibm,set-eeh-option call to succeed even on nodes
825 * where EEH is not supported. Verify support
826 * explicitly. */
827 ret = read_slot_reset_state(pdn, rets);
828 if ((ret == 0) && (rets[1] == 1))
829 enable = 1;
830 }
831
832 if (enable) {
833 eeh_subsystem_enabled = 1;
834 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
835
823#ifdef DEBUG 836#ifdef DEBUG
824 printk(KERN_DEBUG "EEH: %s: eeh enabled, config=%x pe_config=%x\n", 837 printk(KERN_DEBUG "EEH: %s: eeh enabled, config=%x pe_config=%x\n",
825 dn->full_name, pdn->eeh_config_addr, pdn->eeh_pe_config_addr); 838 dn->full_name, pdn->eeh_config_addr, pdn->eeh_pe_config_addr);
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index cbd6b0711ab4..a4c0bf84ef2e 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -446,7 +446,8 @@ excess_failures:
446 */ 446 */
447 printk(KERN_ERR 447 printk(KERN_ERR
448 "EEH: PCI device at location=%s driver=%s pci addr=%s \n" 448 "EEH: PCI device at location=%s driver=%s pci addr=%s \n"
449 "has failed %d times and has been permanently disabled. \n" 449 "has failed %d times in the last hour "
450 "and has been permanently disabled. \n"
450 "Please try reseating this device or replacing it.\n", 451 "Please try reseating this device or replacing it.\n",
451 location, drv_str, pci_str, frozen_pdn->eeh_freeze_count); 452 location, drv_str, pci_str, frozen_pdn->eeh_freeze_count);
452 goto perm_error; 453 goto perm_error;
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 1c7b2baa5f73..90522e3c9d46 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -59,6 +59,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
59 {FW_FEATURE_XDABR, "hcall-xdabr"}, 59 {FW_FEATURE_XDABR, "hcall-xdabr"},
60 {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, 60 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
61 {FW_FEATURE_SPLPAR, "hcall-splpar"}, 61 {FW_FEATURE_SPLPAR, "hcall-splpar"},
62 {FW_FEATURE_BULK_REMOVE, "hcall-bulk"},
62}; 63};
63 64
64/* Build up the firmware features bitmask using the contents of 65/* Build up the firmware features bitmask using the contents of
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 721436db3ef0..7496005566ef 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -502,23 +502,70 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
502 BUG_ON(lpar_rc != H_SUCCESS); 502 BUG_ON(lpar_rc != H_SUCCESS);
503} 503}
504 504
505/* Flag bits for H_BULK_REMOVE */
506#define HBR_REQUEST 0x4000000000000000UL
507#define HBR_RESPONSE 0x8000000000000000UL
508#define HBR_END 0xc000000000000000UL
509#define HBR_AVPN 0x0200000000000000UL
510#define HBR_ANDCOND 0x0100000000000000UL
511
505/* 512/*
506 * Take a spinlock around flushes to avoid bouncing the hypervisor tlbie 513 * Take a spinlock around flushes to avoid bouncing the hypervisor tlbie
507 * lock. 514 * lock.
508 */ 515 */
509static void pSeries_lpar_flush_hash_range(unsigned long number, int local) 516static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
510{ 517{
511 int i; 518 unsigned long i, pix, rc;
512 unsigned long flags = 0; 519 unsigned long flags = 0;
513 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 520 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
514 int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE); 521 int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
522 unsigned long param[9];
523 unsigned long va;
524 unsigned long hash, index, shift, hidx, slot;
525 real_pte_t pte;
526 int psize;
515 527
516 if (lock_tlbie) 528 if (lock_tlbie)
517 spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags); 529 spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
518 530
519 for (i = 0; i < number; i++) 531 psize = batch->psize;
520 flush_hash_page(batch->vaddr[i], batch->pte[i], 532 pix = 0;
521 batch->psize, local); 533 for (i = 0; i < number; i++) {
534 va = batch->vaddr[i];
535 pte = batch->pte[i];
536 pte_iterate_hashed_subpages(pte, psize, va, index, shift) {
537 hash = hpt_hash(va, shift);
538 hidx = __rpte_to_hidx(pte, index);
539 if (hidx & _PTEIDX_SECONDARY)
540 hash = ~hash;
541 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
542 slot += hidx & _PTEIDX_GROUP_IX;
543 if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) {
544 pSeries_lpar_hpte_invalidate(slot, va, psize,
545 local);
546 } else {
547 param[pix] = HBR_REQUEST | HBR_AVPN | slot;
548 param[pix+1] = hpte_encode_v(va, psize) &
549 HPTE_V_AVPN;
550 pix += 2;
551 if (pix == 8) {
552 rc = plpar_hcall9(H_BULK_REMOVE, param,
553 param[0], param[1], param[2],
554 param[3], param[4], param[5],
555 param[6], param[7]);
556 BUG_ON(rc != H_SUCCESS);
557 pix = 0;
558 }
559 }
560 } pte_iterate_hashed_end();
561 }
562 if (pix) {
563 param[pix] = HBR_END;
564 rc = plpar_hcall9(H_BULK_REMOVE, param, param[0], param[1],
565 param[2], param[3], param[4], param[5],
566 param[6], param[7]);
567 BUG_ON(rc != H_SUCCESS);
568 }
522 569
523 if (lock_tlbie) 570 if (lock_tlbie)
524 spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags); 571 spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags);
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 715db5c89908..c69bd15ced9c 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -77,7 +77,7 @@ void __init pSeries_final_fixup(void)
77 77
78/* 78/*
79 * Assume the winbond 82c105 is the IDE controller on a 79 * Assume the winbond 82c105 is the IDE controller on a
80 * p610. We should probably be more careful in case 80 * p610/p615/p630. We should probably be more careful in case
81 * someone tries to plug in a similar adapter. 81 * someone tries to plug in a similar adapter.
82 */ 82 */
83static void fixup_winbond_82c105(struct pci_dev* dev) 83static void fixup_winbond_82c105(struct pci_dev* dev)
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 2621a7e72d2d..85dcdf178415 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -22,4 +22,6 @@ endif
22ifeq ($(ARCH),powerpc) 22ifeq ($(ARCH),powerpc)
23obj-$(CONFIG_MTD) += rom.o 23obj-$(CONFIG_MTD) += rom.o
24obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o 24obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o
25obj-$(CONFIG_8xx) += mpc8xx_pic.o commproc.o
26obj-$(CONFIG_UCODE_PATCH) += micropatch.o
25endif 27endif
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
new file mode 100644
index 000000000000..9b4fafd9a840
--- /dev/null
+++ b/arch/powerpc/sysdev/commproc.c
@@ -0,0 +1,398 @@
1/*
2 * General Purpose functions for the global management of the
3 * Communication Processor Module.
4 * Copyright (c) 1997 Dan error_act (dmalek@jlc.net)
5 *
6 * In addition to the individual control of the communication
7 * channels, there are a few functions that globally affect the
8 * communication processor.
9 *
10 * Buffer descriptors must be allocated from the dual ported memory
11 * space. The allocator for that is here. When the communication
12 * process is reset, we reclaim the memory available. There is
13 * currently no deallocator for this memory.
14 * The amount of space available is platform dependent. On the
15 * MBX, the EPPC software loads additional microcode into the
16 * communication processor, and uses some of the DP ram for this
17 * purpose. Current, the first 512 bytes and the last 256 bytes of
18 * memory are used. Right now I am conservative and only use the
19 * memory that can never be used for microcode. If there are
20 * applications that require more DP ram, we can expand the boundaries
21 * but then we have to be careful of any downloaded microcode.
22 */
23#include <linux/errno.h>
24#include <linux/sched.h>
25#include <linux/kernel.h>
26#include <linux/dma-mapping.h>
27#include <linux/param.h>
28#include <linux/string.h>
29#include <linux/mm.h>
30#include <linux/interrupt.h>
31#include <linux/irq.h>
32#include <linux/module.h>
33#include <asm/mpc8xx.h>
34#include <asm/page.h>
35#include <asm/pgtable.h>
36#include <asm/8xx_immap.h>
37#include <asm/commproc.h>
38#include <asm/io.h>
39#include <asm/tlbflush.h>
40#include <asm/rheap.h>
41#include <asm/prom.h>
42
43#include <asm/fs_pd.h>
44
45#define CPM_MAP_SIZE (0x4000)
46
47static void m8xx_cpm_dpinit(void);
48static uint host_buffer; /* One page of host buffer */
49static uint host_end; /* end + 1 */
50cpm8xx_t *cpmp; /* Pointer to comm processor space */
51cpic8xx_t *cpic_reg;
52
53static struct device_node *cpm_pic_node;
54static struct irq_host *cpm_pic_host;
55
56static void cpm_mask_irq(unsigned int irq)
57{
58 unsigned int cpm_vec = (unsigned int)irq_map[irq].hwirq;
59
60 clrbits32(&cpic_reg->cpic_cimr, (1 << cpm_vec));
61}
62
63static void cpm_unmask_irq(unsigned int irq)
64{
65 unsigned int cpm_vec = (unsigned int)irq_map[irq].hwirq;
66
67 setbits32(&cpic_reg->cpic_cimr, (1 << cpm_vec));
68}
69
70static void cpm_end_irq(unsigned int irq)
71{
72 unsigned int cpm_vec = (unsigned int)irq_map[irq].hwirq;
73
74 out_be32(&cpic_reg->cpic_cisr, (1 << cpm_vec));
75}
76
77static struct irq_chip cpm_pic = {
78 .typename = " CPM PIC ",
79 .mask = cpm_mask_irq,
80 .unmask = cpm_unmask_irq,
81 .eoi = cpm_end_irq,
82};
83
84int cpm_get_irq(void)
85{
86 int cpm_vec;
87
88 /* Get the vector by setting the ACK bit and then reading
89 * the register.
90 */
91 out_be16(&cpic_reg->cpic_civr, 1);
92 cpm_vec = in_be16(&cpic_reg->cpic_civr);
93 cpm_vec >>= 11;
94
95 return irq_linear_revmap(cpm_pic_host, cpm_vec);
96}
97
98static int cpm_pic_host_match(struct irq_host *h, struct device_node *node)
99{
100 return cpm_pic_node == node;
101}
102
103static int cpm_pic_host_map(struct irq_host *h, unsigned int virq,
104 irq_hw_number_t hw)
105{
106 pr_debug("cpm_pic_host_map(%d, 0x%lx)\n", virq, hw);
107
108 get_irq_desc(virq)->status |= IRQ_LEVEL;
109 set_irq_chip_and_handler(virq, &cpm_pic, handle_fasteoi_irq);
110 return 0;
111}
112
113/* The CPM can generate the error interrupt when there is a race condition
114 * between generating and masking interrupts. All we have to do is ACK it
115 * and return. This is a no-op function so we don't need any special
116 * tests in the interrupt handler.
117 */
118static irqreturn_t cpm_error_interrupt(int irq, void *dev)
119{
120 return IRQ_HANDLED;
121}
122
123static struct irqaction cpm_error_irqaction = {
124 .handler = cpm_error_interrupt,
125 .mask = CPU_MASK_NONE,
126 .name = "error",
127};
128
129static struct irq_host_ops cpm_pic_host_ops = {
130 .match = cpm_pic_host_match,
131 .map = cpm_pic_host_map,
132};
133
134unsigned int cpm_pic_init(void)
135{
136 struct device_node *np = NULL;
137 struct resource res;
138 unsigned int sirq = NO_IRQ, hwirq, eirq;
139 int ret;
140
141 pr_debug("cpm_pic_init\n");
142
143 np = of_find_compatible_node(NULL, "cpm-pic", "CPM");
144 if (np == NULL) {
145 printk(KERN_ERR "CPM PIC init: can not find cpm-pic node\n");
146 return sirq;
147 }
148 ret = of_address_to_resource(np, 0, &res);
149 if (ret)
150 goto end;
151
152 cpic_reg = (void *)ioremap(res.start, res.end - res.start + 1);
153 if (cpic_reg == NULL)
154 goto end;
155
156 sirq = irq_of_parse_and_map(np, 0);
157 if (sirq == NO_IRQ)
158 goto end;
159
160 /* Initialize the CPM interrupt controller. */
161 hwirq = (unsigned int)irq_map[sirq].hwirq;
162 out_be32(&cpic_reg->cpic_cicr,
163 (CICR_SCD_SCC4 | CICR_SCC_SCC3 | CICR_SCB_SCC2 | CICR_SCA_SCC1) |
164 ((hwirq/2) << 13) | CICR_HP_MASK);
165
166 out_be32(&cpic_reg->cpic_cimr, 0);
167
168 cpm_pic_node = of_node_get(np);
169
170 cpm_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &cpm_pic_host_ops, 64);
171 if (cpm_pic_host == NULL) {
172 printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n");
173 sirq = NO_IRQ;
174 goto end;
175 }
176 of_node_put(np);
177
178 /* Install our own error handler. */
179 np = of_find_node_by_type(NULL, "cpm");
180 if (np == NULL) {
181 printk(KERN_ERR "CPM PIC init: can not find cpm node\n");
182 goto end;
183 }
184 eirq= irq_of_parse_and_map(np, 0);
185 if (eirq == NO_IRQ)
186 goto end;
187
188 if (setup_irq(eirq, &cpm_error_irqaction))
189 printk(KERN_ERR "Could not allocate CPM error IRQ!");
190
191 setbits32(&cpic_reg->cpic_cicr, CICR_IEN);
192
193end:
194 of_node_put(np);
195 return sirq;
196}
197
198void cpm_reset(void)
199{
200 cpm8xx_t *commproc;
201 sysconf8xx_t *siu_conf;
202
203 commproc = (cpm8xx_t *)ioremap(CPM_MAP_ADDR, CPM_MAP_SIZE);
204
205#ifdef CONFIG_UCODE_PATCH
206 /* Perform a reset.
207 */
208 out_be16(&commproc->cp_cpcr, CPM_CR_RST | CPM_CR_FLG);
209
210 /* Wait for it.
211 */
212 while (in_be16(&commproc->cp_cpcr) & CPM_CR_FLG);
213
214 cpm_load_patch(commproc);
215#endif
216
217 /* Set SDMA Bus Request priority 5.
218 * On 860T, this also enables FEC priority 6. I am not sure
219 * this is what we realy want for some applications, but the
220 * manual recommends it.
221 * Bit 25, FAM can also be set to use FEC aggressive mode (860T).
222 */
223 siu_conf = (sysconf8xx_t*)immr_map(im_siu_conf);
224 out_be32(&siu_conf->sc_sdcr, 1);
225 immr_unmap(siu_conf);
226
227 /* Reclaim the DP memory for our use. */
228 m8xx_cpm_dpinit();
229
230 /* Tell everyone where the comm processor resides.
231 */
232 cpmp = commproc;
233}
234
235/* We used to do this earlier, but have to postpone as long as possible
236 * to ensure the kernel VM is now running.
237 */
238static void
239alloc_host_memory(void)
240{
241 dma_addr_t physaddr;
242
243 /* Set the host page for allocation.
244 */
245 host_buffer = (uint)dma_alloc_coherent(NULL, PAGE_SIZE, &physaddr,
246 GFP_KERNEL);
247 host_end = host_buffer + PAGE_SIZE;
248}
249
250/* We also own one page of host buffer space for the allocation of
251 * UART "fifos" and the like.
252 */
253uint
254m8xx_cpm_hostalloc(uint size)
255{
256 uint retloc;
257
258 if (host_buffer == 0)
259 alloc_host_memory();
260
261 if ((host_buffer + size) >= host_end)
262 return(0);
263
264 retloc = host_buffer;
265 host_buffer += size;
266
267 return(retloc);
268}
269
270/* Set a baud rate generator. This needs lots of work. There are
271 * four BRGs, any of which can be wired to any channel.
272 * The internal baud rate clock is the system clock divided by 16.
273 * This assumes the baudrate is 16x oversampled by the uart.
274 */
275#define BRG_INT_CLK (get_brgfreq())
276#define BRG_UART_CLK (BRG_INT_CLK/16)
277#define BRG_UART_CLK_DIV16 (BRG_UART_CLK/16)
278
279void
280cpm_setbrg(uint brg, uint rate)
281{
282 volatile uint *bp;
283
284 /* This is good enough to get SMCs running.....
285 */
286 bp = (uint *)&cpmp->cp_brgc1;
287 bp += brg;
288 /* The BRG has a 12-bit counter. For really slow baud rates (or
289 * really fast processors), we may have to further divide by 16.
290 */
291 if (((BRG_UART_CLK / rate) - 1) < 4096)
292 *bp = (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN;
293 else
294 *bp = (((BRG_UART_CLK_DIV16 / rate) - 1) << 1) |
295 CPM_BRG_EN | CPM_BRG_DIV16;
296}
297
298/*
299 * dpalloc / dpfree bits.
300 */
301static spinlock_t cpm_dpmem_lock;
302/*
303 * 16 blocks should be enough to satisfy all requests
304 * until the memory subsystem goes up...
305 */
306static rh_block_t cpm_boot_dpmem_rh_block[16];
307static rh_info_t cpm_dpmem_info;
308
309#define CPM_DPMEM_ALIGNMENT 8
310static u8* dpram_vbase;
311static uint dpram_pbase;
312
313void m8xx_cpm_dpinit(void)
314{
315 spin_lock_init(&cpm_dpmem_lock);
316
317 dpram_vbase = immr_map_size(im_cpm.cp_dpmem, CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE);
318 dpram_pbase = (uint)&((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem;
319
320 /* Initialize the info header */
321 rh_init(&cpm_dpmem_info, CPM_DPMEM_ALIGNMENT,
322 sizeof(cpm_boot_dpmem_rh_block) /
323 sizeof(cpm_boot_dpmem_rh_block[0]),
324 cpm_boot_dpmem_rh_block);
325
326 /*
327 * Attach the usable dpmem area.
328 * XXX: This is actually crap. CPM_DATAONLY_BASE and
329 * CPM_DATAONLY_SIZE are a subset of the available dparm. It varies
330 * with the processor and the microcode patches applied / activated.
331 * But the following should be at least safe.
332 */
333 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
334}
335
336/*
337 * Allocate the requested size worth of DP memory.
338 * This function returns an offset into the DPRAM area.
339 * Use cpm_dpram_addr() to get the virtual address of the area.
340 */
341uint cpm_dpalloc(uint size, uint align)
342{
343 void *start;
344 unsigned long flags;
345
346 spin_lock_irqsave(&cpm_dpmem_lock, flags);
347 cpm_dpmem_info.alignment = align;
348 start = rh_alloc(&cpm_dpmem_info, size, "commproc");
349 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
350
351 return (uint)start;
352}
353EXPORT_SYMBOL(cpm_dpalloc);
354
355int cpm_dpfree(uint offset)
356{
357 int ret;
358 unsigned long flags;
359
360 spin_lock_irqsave(&cpm_dpmem_lock, flags);
361 ret = rh_free(&cpm_dpmem_info, (void *)offset);
362 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
363
364 return ret;
365}
366EXPORT_SYMBOL(cpm_dpfree);
367
368uint cpm_dpalloc_fixed(uint offset, uint size, uint align)
369{
370 void *start;
371 unsigned long flags;
372
373 spin_lock_irqsave(&cpm_dpmem_lock, flags);
374 cpm_dpmem_info.alignment = align;
375 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc");
376 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
377
378 return (uint)start;
379}
380EXPORT_SYMBOL(cpm_dpalloc_fixed);
381
382void cpm_dpdump(void)
383{
384 rh_dump(&cpm_dpmem_info);
385}
386EXPORT_SYMBOL(cpm_dpdump);
387
388void *cpm_dpram_addr(uint offset)
389{
390 return (void *)(dpram_vbase + offset);
391}
392EXPORT_SYMBOL(cpm_dpram_addr);
393
394uint cpm_dpram_phys(u8* addr)
395{
396 return (dpram_pbase + (uint)(addr - dpram_vbase));
397}
398EXPORT_SYMBOL(cpm_dpram_addr);
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index 767ee6651adc..eabfe06fe05c 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -36,9 +36,20 @@
36#include <asm/mpc8260.h> 36#include <asm/mpc8260.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/prom.h> 38#include <asm/prom.h>
39#include <asm/fs_pd.h>
39 40
40#include "cpm2_pic.h" 41#include "cpm2_pic.h"
41 42
43/* External IRQS */
44#define CPM2_IRQ_EXT1 19
45#define CPM2_IRQ_EXT7 25
46
47/* Port C IRQS */
48#define CPM2_IRQ_PORTC15 48
49#define CPM2_IRQ_PORTC0 63
50
51static intctl_cpm2_t *cpm2_intctl;
52
42static struct device_node *cpm2_pic_node; 53static struct device_node *cpm2_pic_node;
43static struct irq_host *cpm2_pic_host; 54static struct irq_host *cpm2_pic_host;
44#define NR_MASK_WORDS ((NR_IRQS + 31) / 32) 55#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
@@ -68,68 +79,55 @@ static const u_char irq_to_siubit[] = {
68 24, 25, 26, 27, 28, 29, 30, 31, 79 24, 25, 26, 27, 28, 29, 30, 31,
69}; 80};
70 81
71static void cpm2_mask_irq(unsigned int irq_nr) 82static void cpm2_mask_irq(unsigned int virq)
72{ 83{
73 int bit, word; 84 int bit, word;
74 volatile uint *simr; 85 unsigned int irq_nr = virq_to_hw(virq);
75
76 irq_nr -= CPM_IRQ_OFFSET;
77 86
78 bit = irq_to_siubit[irq_nr]; 87 bit = irq_to_siubit[irq_nr];
79 word = irq_to_siureg[irq_nr]; 88 word = irq_to_siureg[irq_nr];
80 89
81 simr = &(cpm2_intctl->ic_simrh);
82 ppc_cached_irq_mask[word] &= ~(1 << bit); 90 ppc_cached_irq_mask[word] &= ~(1 << bit);
83 simr[word] = ppc_cached_irq_mask[word]; 91 out_be32(&cpm2_intctl->ic_simrh + word, ppc_cached_irq_mask[word]);
84} 92}
85 93
86static void cpm2_unmask_irq(unsigned int irq_nr) 94static void cpm2_unmask_irq(unsigned int virq)
87{ 95{
88 int bit, word; 96 int bit, word;
89 volatile uint *simr; 97 unsigned int irq_nr = virq_to_hw(virq);
90
91 irq_nr -= CPM_IRQ_OFFSET;
92 98
93 bit = irq_to_siubit[irq_nr]; 99 bit = irq_to_siubit[irq_nr];
94 word = irq_to_siureg[irq_nr]; 100 word = irq_to_siureg[irq_nr];
95 101
96 simr = &(cpm2_intctl->ic_simrh);
97 ppc_cached_irq_mask[word] |= 1 << bit; 102 ppc_cached_irq_mask[word] |= 1 << bit;
98 simr[word] = ppc_cached_irq_mask[word]; 103 out_be32(&cpm2_intctl->ic_simrh + word, ppc_cached_irq_mask[word]);
99} 104}
100 105
101static void cpm2_mask_and_ack(unsigned int irq_nr) 106static void cpm2_ack(unsigned int virq)
102{ 107{
103 int bit, word; 108 int bit, word;
104 volatile uint *simr, *sipnr; 109 unsigned int irq_nr = virq_to_hw(virq);
105
106 irq_nr -= CPM_IRQ_OFFSET;
107 110
108 bit = irq_to_siubit[irq_nr]; 111 bit = irq_to_siubit[irq_nr];
109 word = irq_to_siureg[irq_nr]; 112 word = irq_to_siureg[irq_nr];
110 113
111 simr = &(cpm2_intctl->ic_simrh); 114 out_be32(&cpm2_intctl->ic_sipnrh + word, 1 << bit);
112 sipnr = &(cpm2_intctl->ic_sipnrh);
113 ppc_cached_irq_mask[word] &= ~(1 << bit);
114 simr[word] = ppc_cached_irq_mask[word];
115 sipnr[word] = 1 << bit;
116} 115}
117 116
118static void cpm2_end_irq(unsigned int irq_nr) 117static void cpm2_end_irq(unsigned int virq)
119{ 118{
120 int bit, word; 119 int bit, word;
121 volatile uint *simr; 120 unsigned int irq_nr = virq_to_hw(virq);
122 121
123 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS)) 122 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
124 && irq_desc[irq_nr].action) { 123 && irq_desc[irq_nr].action) {
125 124
126 irq_nr -= CPM_IRQ_OFFSET;
127 bit = irq_to_siubit[irq_nr]; 125 bit = irq_to_siubit[irq_nr];
128 word = irq_to_siureg[irq_nr]; 126 word = irq_to_siureg[irq_nr];
129 127
130 simr = &(cpm2_intctl->ic_simrh);
131 ppc_cached_irq_mask[word] |= 1 << bit; 128 ppc_cached_irq_mask[word] |= 1 << bit;
132 simr[word] = ppc_cached_irq_mask[word]; 129 out_be32(&cpm2_intctl->ic_simrh + word, ppc_cached_irq_mask[word]);
130
133 /* 131 /*
134 * Work around large numbers of spurious IRQs on PowerPC 82xx 132 * Work around large numbers of spurious IRQs on PowerPC 82xx
135 * systems. 133 * systems.
@@ -138,13 +136,59 @@ static void cpm2_end_irq(unsigned int irq_nr)
138 } 136 }
139} 137}
140 138
139static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
140{
141 unsigned int src = virq_to_hw(virq);
142 struct irq_desc *desc = get_irq_desc(virq);
143 unsigned int vold, vnew, edibit;
144
145 if (flow_type == IRQ_TYPE_NONE)
146 flow_type = IRQ_TYPE_LEVEL_LOW;
147
148 if (flow_type & IRQ_TYPE_EDGE_RISING) {
149 printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n",
150 flow_type);
151 return -EINVAL;
152 }
153
154 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
155 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
156 if (flow_type & IRQ_TYPE_LEVEL_LOW) {
157 desc->status |= IRQ_LEVEL;
158 desc->handle_irq = handle_level_irq;
159 } else
160 desc->handle_irq = handle_edge_irq;
161
162 /* internal IRQ senses are LEVEL_LOW
163 * EXT IRQ and Port C IRQ senses are programmable
164 */
165 if (src >= CPM2_IRQ_EXT1 && src <= CPM2_IRQ_EXT7)
166 edibit = (14 - (src - CPM2_IRQ_EXT1));
167 else
168 if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0)
169 edibit = (31 - (src - CPM2_IRQ_PORTC15));
170 else
171 return (flow_type & IRQ_TYPE_LEVEL_LOW) ? 0 : -EINVAL;
172
173 vold = in_be32(&cpm2_intctl->ic_siexr);
174
175 if ((flow_type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_FALLING)
176 vnew = vold | (1 << edibit);
177 else
178 vnew = vold & ~(1 << edibit);
179
180 if (vold != vnew)
181 out_be32(&cpm2_intctl->ic_siexr, vnew);
182 return 0;
183}
184
141static struct irq_chip cpm2_pic = { 185static struct irq_chip cpm2_pic = {
142 .typename = " CPM2 SIU ", 186 .typename = " CPM2 SIU ",
143 .enable = cpm2_unmask_irq, 187 .mask = cpm2_mask_irq,
144 .disable = cpm2_mask_irq,
145 .unmask = cpm2_unmask_irq, 188 .unmask = cpm2_unmask_irq,
146 .mask_ack = cpm2_mask_and_ack, 189 .ack = cpm2_ack,
147 .end = cpm2_end_irq, 190 .eoi = cpm2_end_irq,
191 .set_type = cpm2_set_irq_type,
148}; 192};
149 193
150unsigned int cpm2_get_irq(void) 194unsigned int cpm2_get_irq(void)
@@ -154,17 +198,17 @@ unsigned int cpm2_get_irq(void)
154 198
155 /* For CPM2, read the SIVEC register and shift the bits down 199 /* For CPM2, read the SIVEC register and shift the bits down
156 * to get the irq number. */ 200 * to get the irq number. */
157 bits = cpm2_intctl->ic_sivec; 201 bits = in_be32(&cpm2_intctl->ic_sivec);
158 irq = bits >> 26; 202 irq = bits >> 26;
159 203
160 if (irq == 0) 204 if (irq == 0)
161 return(-1); 205 return(-1);
162 return irq+CPM_IRQ_OFFSET; 206 return irq_linear_revmap(cpm2_pic_host, irq);
163} 207}
164 208
165static int cpm2_pic_host_match(struct irq_host *h, struct device_node *node) 209static int cpm2_pic_host_match(struct irq_host *h, struct device_node *node)
166{ 210{
167 return cpm2_pic_node == NULL || cpm2_pic_node == node; 211 return cpm2_pic_node == node;
168} 212}
169 213
170static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq, 214static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq,
@@ -177,39 +221,21 @@ static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq,
177 return 0; 221 return 0;
178} 222}
179 223
180static void cpm2_host_unmap(struct irq_host *h, unsigned int virq)
181{
182 /* Make sure irq is masked in hardware */
183 cpm2_mask_irq(virq);
184
185 /* remove chip and handler */
186 set_irq_chip_and_handler(virq, NULL, NULL);
187}
188
189static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct, 224static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct,
190 u32 *intspec, unsigned int intsize, 225 u32 *intspec, unsigned int intsize,
191 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 226 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
192{ 227{
193 static const unsigned char map_cpm2_senses[4] = {
194 IRQ_TYPE_LEVEL_LOW,
195 IRQ_TYPE_LEVEL_HIGH,
196 IRQ_TYPE_EDGE_FALLING,
197 IRQ_TYPE_EDGE_RISING,
198 };
199
200 *out_hwirq = intspec[0]; 228 *out_hwirq = intspec[0];
201 if (intsize > 1 && intspec[1] < 4) 229 if (intsize > 1)
202 *out_flags = map_cpm2_senses[intspec[1]]; 230 *out_flags = intspec[1];
203 else 231 else
204 *out_flags = IRQ_TYPE_NONE; 232 *out_flags = IRQ_TYPE_NONE;
205
206 return 0; 233 return 0;
207} 234}
208 235
209static struct irq_host_ops cpm2_pic_host_ops = { 236static struct irq_host_ops cpm2_pic_host_ops = {
210 .match = cpm2_pic_host_match, 237 .match = cpm2_pic_host_match,
211 .map = cpm2_pic_host_map, 238 .map = cpm2_pic_host_map,
212 .unmap = cpm2_host_unmap,
213 .xlate = cpm2_pic_host_xlate, 239 .xlate = cpm2_pic_host_xlate,
214}; 240};
215 241
@@ -217,37 +243,37 @@ void cpm2_pic_init(struct device_node *node)
217{ 243{
218 int i; 244 int i;
219 245
246 cpm2_intctl = cpm2_map(im_intctl);
247
220 /* Clear the CPM IRQ controller, in case it has any bits set 248 /* Clear the CPM IRQ controller, in case it has any bits set
221 * from the bootloader 249 * from the bootloader
222 */ 250 */
223 251
224 /* Mask out everything */ 252 /* Mask out everything */
225 253
226 cpm2_intctl->ic_simrh = 0x00000000; 254 out_be32(&cpm2_intctl->ic_simrh, 0x00000000);
227 cpm2_intctl->ic_simrl = 0x00000000; 255 out_be32(&cpm2_intctl->ic_simrl, 0x00000000);
228 256
229 wmb(); 257 wmb();
230 258
231 /* Ack everything */ 259 /* Ack everything */
232 cpm2_intctl->ic_sipnrh = 0xffffffff; 260 out_be32(&cpm2_intctl->ic_sipnrh, 0xffffffff);
233 cpm2_intctl->ic_sipnrl = 0xffffffff; 261 out_be32(&cpm2_intctl->ic_sipnrl, 0xffffffff);
234 wmb(); 262 wmb();
235 263
236 /* Dummy read of the vector */ 264 /* Dummy read of the vector */
237 i = cpm2_intctl->ic_sivec; 265 i = in_be32(&cpm2_intctl->ic_sivec);
238 rmb(); 266 rmb();
239 267
240 /* Initialize the default interrupt mapping priorities, 268 /* Initialize the default interrupt mapping priorities,
241 * in case the boot rom changed something on us. 269 * in case the boot rom changed something on us.
242 */ 270 */
243 cpm2_intctl->ic_sicr = 0; 271 out_be16(&cpm2_intctl->ic_sicr, 0);
244 cpm2_intctl->ic_scprrh = 0x05309770; 272 out_be32(&cpm2_intctl->ic_scprrh, 0x05309770);
245 cpm2_intctl->ic_scprrl = 0x05309770; 273 out_be32(&cpm2_intctl->ic_scprrl, 0x05309770);
246 274
247 /* create a legacy host */ 275 /* create a legacy host */
248 if (node) 276 cpm2_pic_node = of_node_get(node);
249 cpm2_pic_node = of_node_get(node);
250
251 cpm2_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &cpm2_pic_host_ops, 64); 277 cpm2_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &cpm2_pic_host_ops, 64);
252 if (cpm2_pic_host == NULL) { 278 if (cpm2_pic_host == NULL) {
253 printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n"); 279 printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n");
diff --git a/arch/powerpc/sysdev/cpm2_pic.h b/arch/powerpc/sysdev/cpm2_pic.h
index 2840616529e4..30e5828a2781 100644
--- a/arch/powerpc/sysdev/cpm2_pic.h
+++ b/arch/powerpc/sysdev/cpm2_pic.h
@@ -1,8 +1,6 @@
1#ifndef _PPC_KERNEL_CPM2_H 1#ifndef _PPC_KERNEL_CPM2_H
2#define _PPC_KERNEL_CPM2_H 2#define _PPC_KERNEL_CPM2_H
3 3
4extern intctl_cpm2_t *cpm2_intctl;
5
6extern unsigned int cpm2_get_irq(void); 4extern unsigned int cpm2_get_irq(void);
7 5
8extern void cpm2_pic_init(struct device_node*); 6extern void cpm2_pic_init(struct device_node*);
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index ad31e56e892b..9f2a9a444bfb 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -38,7 +38,8 @@
38#include <asm/cpm2.h> 38#include <asm/cpm2.h>
39 39
40extern void init_fcc_ioports(struct fs_platform_info*); 40extern void init_fcc_ioports(struct fs_platform_info*);
41extern void init_scc_ioports(struct fs_uart_platform_info*); 41extern void init_fec_ioports(struct fs_platform_info*);
42extern void init_smc_ioports(struct fs_uart_platform_info*);
42static phys_addr_t immrbase = -1; 43static phys_addr_t immrbase = -1;
43 44
44phys_addr_t get_immrbase(void) 45phys_addr_t get_immrbase(void)
@@ -63,7 +64,7 @@ phys_addr_t get_immrbase(void)
63 64
64EXPORT_SYMBOL(get_immrbase); 65EXPORT_SYMBOL(get_immrbase);
65 66
66#ifdef CONFIG_CPM2 67#if defined(CONFIG_CPM2) || defined(CONFIG_8xx)
67 68
68static u32 brgfreq = -1; 69static u32 brgfreq = -1;
69 70
@@ -544,6 +545,8 @@ arch_initcall(fsl_usb_of_init);
544 545
545#ifdef CONFIG_CPM2 546#ifdef CONFIG_CPM2
546 547
548extern void init_scc_ioports(struct fs_uart_platform_info*);
549
547static const char fcc_regs[] = "fcc_regs"; 550static const char fcc_regs[] = "fcc_regs";
548static const char fcc_regs_c[] = "fcc_regs_c"; 551static const char fcc_regs_c[] = "fcc_regs_c";
549static const char fcc_pram[] = "fcc_pram"; 552static const char fcc_pram[] = "fcc_pram";
@@ -792,3 +795,270 @@ err:
792 795
793arch_initcall(cpm_uart_of_init); 796arch_initcall(cpm_uart_of_init);
794#endif /* CONFIG_CPM2 */ 797#endif /* CONFIG_CPM2 */
798
799#ifdef CONFIG_8xx
800
801extern void init_scc_ioports(struct fs_platform_info*);
802extern int platform_device_skip(char *model, int id);
803
804static int __init fs_enet_mdio_of_init(void)
805{
806 struct device_node *np;
807 unsigned int i;
808 struct platform_device *mdio_dev;
809 struct resource res;
810 int ret;
811
812 for (np = NULL, i = 0;
813 (np = of_find_compatible_node(np, "mdio", "fs_enet")) != NULL;
814 i++) {
815 struct fs_mii_fec_platform_info mdio_data;
816
817 memset(&res, 0, sizeof(res));
818 memset(&mdio_data, 0, sizeof(mdio_data));
819
820 ret = of_address_to_resource(np, 0, &res);
821 if (ret)
822 goto err;
823
824 mdio_dev =
825 platform_device_register_simple("fsl-cpm-fec-mdio",
826 res.start, &res, 1);
827 if (IS_ERR(mdio_dev)) {
828 ret = PTR_ERR(mdio_dev);
829 goto err;
830 }
831
832 mdio_data.mii_speed = ((((ppc_proc_freq + 4999999) / 2500000) / 2) & 0x3F) << 1;
833
834 ret =
835 platform_device_add_data(mdio_dev, &mdio_data,
836 sizeof(struct fs_mii_fec_platform_info));
837 if (ret)
838 goto unreg;
839 }
840 return 0;
841
842unreg:
843 platform_device_unregister(mdio_dev);
844err:
845 return ret;
846}
847
848arch_initcall(fs_enet_mdio_of_init);
849
850static const char *enet_regs = "regs";
851static const char *enet_pram = "pram";
852static const char *enet_irq = "interrupt";
853static char bus_id[9][BUS_ID_SIZE];
854
855static int __init fs_enet_of_init(void)
856{
857 struct device_node *np;
858 unsigned int i;
859 struct platform_device *fs_enet_dev = NULL;
860 struct resource res;
861 int ret;
862
863 for (np = NULL, i = 0;
864 (np = of_find_compatible_node(np, "network", "fs_enet")) != NULL;
865 i++) {
866 struct resource r[4];
867 struct device_node *phy = NULL, *mdio = NULL;
868 struct fs_platform_info fs_enet_data;
869 unsigned int *id, *phy_addr;
870 void *mac_addr;
871 phandle *ph;
872 char *model;
873
874 memset(r, 0, sizeof(r));
875 memset(&fs_enet_data, 0, sizeof(fs_enet_data));
876
877 model = (char *)get_property(np, "model", NULL);
878 if (model == NULL) {
879 ret = -ENODEV;
880 goto unreg;
881 }
882
883 id = (u32 *) get_property(np, "device-id", NULL);
884 fs_enet_data.fs_no = *id;
885
886 if (platform_device_skip(model, *id))
887 continue;
888
889 ret = of_address_to_resource(np, 0, &r[0]);
890 if (ret)
891 goto err;
892 r[0].name = enet_regs;
893
894 mac_addr = (void *)get_property(np, "mac-address", NULL);
895 memcpy(fs_enet_data.macaddr, mac_addr, 6);
896
897 ph = (phandle *) get_property(np, "phy-handle", NULL);
898 if (ph != NULL)
899 phy = of_find_node_by_phandle(*ph);
900
901 if (phy != NULL) {
902 phy_addr = (u32 *) get_property(phy, "reg", NULL);
903 fs_enet_data.phy_addr = *phy_addr;
904 fs_enet_data.has_phy = 1;
905
906 mdio = of_get_parent(phy);
907 ret = of_address_to_resource(mdio, 0, &res);
908 if (ret) {
909 of_node_put(phy);
910 of_node_put(mdio);
911 goto unreg;
912 }
913 }
914
915 model = (char*)get_property(np, "model", NULL);
916 strcpy(fs_enet_data.fs_type, model);
917
918 if (strstr(model, "FEC")) {
919 r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
920 r[1].flags = IORESOURCE_IRQ;
921 r[1].name = enet_irq;
922
923 fs_enet_dev =
924 platform_device_register_simple("fsl-cpm-fec", i, &r[0], 2);
925
926 if (IS_ERR(fs_enet_dev)) {
927 ret = PTR_ERR(fs_enet_dev);
928 goto err;
929 }
930
931 fs_enet_data.rx_ring = 128;
932 fs_enet_data.tx_ring = 16;
933 fs_enet_data.rx_copybreak = 240;
934 fs_enet_data.use_napi = 1;
935 fs_enet_data.napi_weight = 17;
936
937 snprintf((char*)&bus_id[i], BUS_ID_SIZE, "%x:%02x",
938 (u32)res.start, fs_enet_data.phy_addr);
939 fs_enet_data.bus_id = (char*)&bus_id[i];
940 fs_enet_data.init_ioports = init_fec_ioports;
941 }
942 if (strstr(model, "SCC")) {
943 ret = of_address_to_resource(np, 1, &r[1]);
944 if (ret)
945 goto err;
946 r[1].name = enet_pram;
947
948 r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
949 r[2].flags = IORESOURCE_IRQ;
950 r[2].name = enet_irq;
951
952 fs_enet_dev =
953 platform_device_register_simple("fsl-cpm-scc", i, &r[0], 3);
954
955 if (IS_ERR(fs_enet_dev)) {
956 ret = PTR_ERR(fs_enet_dev);
957 goto err;
958 }
959
960 fs_enet_data.rx_ring = 64;
961 fs_enet_data.tx_ring = 8;
962 fs_enet_data.rx_copybreak = 240;
963 fs_enet_data.use_napi = 1;
964 fs_enet_data.napi_weight = 17;
965
966 snprintf((char*)&bus_id[i], BUS_ID_SIZE, "%s", "fixed@10:1");
967 fs_enet_data.bus_id = (char*)&bus_id[i];
968 fs_enet_data.init_ioports = init_scc_ioports;
969 }
970
971 of_node_put(phy);
972 of_node_put(mdio);
973
974 ret = platform_device_add_data(fs_enet_dev, &fs_enet_data,
975 sizeof(struct
976 fs_platform_info));
977 if (ret)
978 goto unreg;
979 }
980 return 0;
981
982unreg:
983 platform_device_unregister(fs_enet_dev);
984err:
985 return ret;
986}
987
988arch_initcall(fs_enet_of_init);
989
990
991static const char *smc_regs = "regs";
992static const char *smc_pram = "pram";
993
994static int __init cpm_smc_uart_of_init(void)
995{
996 struct device_node *np;
997 unsigned int i;
998 struct platform_device *cpm_uart_dev;
999 int ret;
1000
1001 for (np = NULL, i = 0;
1002 (np = of_find_compatible_node(np, "serial", "cpm_uart")) != NULL;
1003 i++) {
1004 struct resource r[3];
1005 struct fs_uart_platform_info cpm_uart_data;
1006 int *id;
1007 char *model;
1008
1009 memset(r, 0, sizeof(r));
1010 memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
1011
1012 ret = of_address_to_resource(np, 0, &r[0]);
1013 if (ret)
1014 goto err;
1015
1016 r[0].name = smc_regs;
1017
1018 ret = of_address_to_resource(np, 1, &r[1]);
1019 if (ret)
1020 goto err;
1021 r[1].name = smc_pram;
1022
1023 r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
1024 r[2].flags = IORESOURCE_IRQ;
1025
1026 cpm_uart_dev =
1027 platform_device_register_simple("fsl-cpm-smc:uart", i, &r[0], 3);
1028
1029 if (IS_ERR(cpm_uart_dev)) {
1030 ret = PTR_ERR(cpm_uart_dev);
1031 goto err;
1032 }
1033
1034 model = (char*)get_property(np, "model", NULL);
1035 strcpy(cpm_uart_data.fs_type, model);
1036
1037 id = (int*)get_property(np, "device-id", NULL);
1038 cpm_uart_data.fs_no = *id;
1039 cpm_uart_data.uart_clk = ppc_proc_freq;
1040
1041 cpm_uart_data.tx_num_fifo = 4;
1042 cpm_uart_data.tx_buf_size = 32;
1043 cpm_uart_data.rx_num_fifo = 4;
1044 cpm_uart_data.rx_buf_size = 32;
1045
1046 ret =
1047 platform_device_add_data(cpm_uart_dev, &cpm_uart_data,
1048 sizeof(struct
1049 fs_uart_platform_info));
1050 if (ret)
1051 goto unreg;
1052 }
1053
1054 return 0;
1055
1056unreg:
1057 platform_device_unregister(cpm_uart_dev);
1058err:
1059 return ret;
1060}
1061
1062arch_initcall(cpm_smc_uart_of_init);
1063
1064#endif /* CONFIG_8xx */
diff --git a/arch/powerpc/sysdev/grackle.c b/arch/powerpc/sysdev/grackle.c
index b6ec793a23be..42053625f498 100644
--- a/arch/powerpc/sysdev/grackle.c
+++ b/arch/powerpc/sysdev/grackle.c
@@ -56,6 +56,8 @@ static inline void grackle_set_loop_snoop(struct pci_controller *bp, int enable)
56void __init setup_grackle(struct pci_controller *hose) 56void __init setup_grackle(struct pci_controller *hose)
57{ 57{
58 setup_indirect_pci(hose, 0xfec00000, 0xfee00000); 58 setup_indirect_pci(hose, 0xfec00000, 0xfee00000);
59 if (machine_is_compatible("PowerMac1,1"))
60 pci_assign_all_buses = 1;
59 if (machine_is_compatible("AAPL,PowerBook1998")) 61 if (machine_is_compatible("AAPL,PowerBook1998"))
60 grackle_set_loop_snoop(hose, 1); 62 grackle_set_loop_snoop(hose, 1);
61#if 0 /* Disabled for now, HW problems ??? */ 63#if 0 /* Disabled for now, HW problems ??? */
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index 746f78c15375..473c415e9e25 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -557,8 +557,7 @@ static struct irq_host_ops ipic_host_ops = {
557 .xlate = ipic_host_xlate, 557 .xlate = ipic_host_xlate,
558}; 558};
559 559
560void __init ipic_init(struct device_node *node, 560struct ipic * __init ipic_init(struct device_node *node, unsigned int flags)
561 unsigned int flags)
562{ 561{
563 struct ipic *ipic; 562 struct ipic *ipic;
564 struct resource res; 563 struct resource res;
@@ -566,22 +565,24 @@ void __init ipic_init(struct device_node *node,
566 565
567 ipic = alloc_bootmem(sizeof(struct ipic)); 566 ipic = alloc_bootmem(sizeof(struct ipic));
568 if (ipic == NULL) 567 if (ipic == NULL)
569 return; 568 return NULL;
570 569
571 memset(ipic, 0, sizeof(struct ipic)); 570 memset(ipic, 0, sizeof(struct ipic));
572 ipic->of_node = node ? of_node_get(node) : NULL; 571 ipic->of_node = of_node_get(node);
573 572
574 ipic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 573 ipic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR,
575 NR_IPIC_INTS, 574 NR_IPIC_INTS,
576 &ipic_host_ops, 0); 575 &ipic_host_ops, 0);
577 if (ipic->irqhost == NULL) { 576 if (ipic->irqhost == NULL) {
578 of_node_put(node); 577 of_node_put(node);
579 return; 578 return NULL;
580 } 579 }
581 580
582 ret = of_address_to_resource(node, 0, &res); 581 ret = of_address_to_resource(node, 0, &res);
583 if (ret) 582 if (ret) {
584 return; 583 of_node_put(node);
584 return NULL;
585 }
585 586
586 ipic->regs = ioremap(res.start, res.end - res.start + 1); 587 ipic->regs = ioremap(res.start, res.end - res.start + 1);
587 588
@@ -625,6 +626,8 @@ void __init ipic_init(struct device_node *node,
625 626
626 printk ("IPIC (%d IRQ sources) at %p\n", NR_IPIC_INTS, 627 printk ("IPIC (%d IRQ sources) at %p\n", NR_IPIC_INTS,
627 primary_ipic->regs); 628 primary_ipic->regs);
629
630 return ipic;
628} 631}
629 632
630int ipic_set_priority(unsigned int virq, unsigned int priority) 633int ipic_set_priority(unsigned int virq, unsigned int priority)
diff --git a/arch/powerpc/sysdev/micropatch.c b/arch/powerpc/sysdev/micropatch.c
new file mode 100644
index 000000000000..712b10a55f87
--- /dev/null
+++ b/arch/powerpc/sysdev/micropatch.c
@@ -0,0 +1,743 @@
1
2/* Microcode patches for the CPM as supplied by Motorola.
3 * This is the one for IIC/SPI. There is a newer one that
4 * also relocates SMC2, but this would require additional changes
5 * to uart.c, so I am holding off on that for a moment.
6 */
7#include <linux/errno.h>
8#include <linux/sched.h>
9#include <linux/kernel.h>
10#include <linux/param.h>
11#include <linux/string.h>
12#include <linux/mm.h>
13#include <linux/interrupt.h>
14#include <asm/irq.h>
15#include <asm/mpc8xx.h>
16#include <asm/page.h>
17#include <asm/pgtable.h>
18#include <asm/8xx_immap.h>
19#include <asm/commproc.h>
20
21/*
22 * I2C/SPI relocation patch arrays.
23 */
24
25#ifdef CONFIG_I2C_SPI_UCODE_PATCH
26
27uint patch_2000[] = {
28 0x7FFFEFD9,
29 0x3FFD0000,
30 0x7FFB49F7,
31 0x7FF90000,
32 0x5FEFADF7,
33 0x5F89ADF7,
34 0x5FEFAFF7,
35 0x5F89AFF7,
36 0x3A9CFBC8,
37 0xE7C0EDF0,
38 0x77C1E1BB,
39 0xF4DC7F1D,
40 0xABAD932F,
41 0x4E08FDCF,
42 0x6E0FAFF8,
43 0x7CCF76CF,
44 0xFD1FF9CF,
45 0xABF88DC6,
46 0xAB5679F7,
47 0xB0937383,
48 0xDFCE79F7,
49 0xB091E6BB,
50 0xE5BBE74F,
51 0xB3FA6F0F,
52 0x6FFB76CE,
53 0xEE0DF9CF,
54 0x2BFBEFEF,
55 0xCFEEF9CF,
56 0x76CEAD24,
57 0x90B2DF9A,
58 0x7FDDD0BF,
59 0x4BF847FD,
60 0x7CCF76CE,
61 0xCFEF7E1F,
62 0x7F1D7DFD,
63 0xF0B6EF71,
64 0x7FC177C1,
65 0xFBC86079,
66 0xE722FBC8,
67 0x5FFFDFFF,
68 0x5FB2FFFB,
69 0xFBC8F3C8,
70 0x94A67F01,
71 0x7F1D5F39,
72 0xAFE85F5E,
73 0xFFDFDF96,
74 0xCB9FAF7D,
75 0x5FC1AFED,
76 0x8C1C5FC1,
77 0xAFDD5FC3,
78 0xDF9A7EFD,
79 0xB0B25FB2,
80 0xFFFEABAD,
81 0x5FB2FFFE,
82 0x5FCE600B,
83 0xE6BB600B,
84 0x5FCEDFC6,
85 0x27FBEFDF,
86 0x5FC8CFDE,
87 0x3A9CE7C0,
88 0xEDF0F3C8,
89 0x7F0154CD,
90 0x7F1D2D3D,
91 0x363A7570,
92 0x7E0AF1CE,
93 0x37EF2E68,
94 0x7FEE10EC,
95 0xADF8EFDE,
96 0xCFEAE52F,
97 0x7D0FE12B,
98 0xF1CE5F65,
99 0x7E0A4DF8,
100 0xCFEA5F72,
101 0x7D0BEFEE,
102 0xCFEA5F74,
103 0xE522EFDE,
104 0x5F74CFDA,
105 0x0B627385,
106 0xDF627E0A,
107 0x30D8145B,
108 0xBFFFF3C8,
109 0x5FFFDFFF,
110 0xA7F85F5E,
111 0xBFFE7F7D,
112 0x10D31450,
113 0x5F36BFFF,
114 0xAF785F5E,
115 0xBFFDA7F8,
116 0x5F36BFFE,
117 0x77FD30C0,
118 0x4E08FDCF,
119 0xE5FF6E0F,
120 0xAFF87E1F,
121 0x7E0FFD1F,
122 0xF1CF5F1B,
123 0xABF80D5E,
124 0x5F5EFFEF,
125 0x79F730A2,
126 0xAFDD5F34,
127 0x47F85F34,
128 0xAFED7FDD,
129 0x50B24978,
130 0x47FD7F1D,
131 0x7DFD70AD,
132 0xEF717EC1,
133 0x6BA47F01,
134 0x2D267EFD,
135 0x30DE5F5E,
136 0xFFFD5F5E,
137 0xFFEF5F5E,
138 0xFFDF0CA0,
139 0xAFED0A9E,
140 0xAFDD0C3A,
141 0x5F3AAFBD,
142 0x7FBDB082,
143 0x5F8247F8
144};
145
146uint patch_2f00[] = {
147 0x3E303430,
148 0x34343737,
149 0xABF7BF9B,
150 0x994B4FBD,
151 0xBD599493,
152 0x349FFF37,
153 0xFB9B177D,
154 0xD9936956,
155 0xBBFDD697,
156 0xBDD2FD11,
157 0x31DB9BB3,
158 0x63139637,
159 0x93733693,
160 0x193137F7,
161 0x331737AF,
162 0x7BB9B999,
163 0xBB197957,
164 0x7FDFD3D5,
165 0x73B773F7,
166 0x37933B99,
167 0x1D115316,
168 0x99315315,
169 0x31694BF4,
170 0xFBDBD359,
171 0x31497353,
172 0x76956D69,
173 0x7B9D9693,
174 0x13131979,
175 0x79376935
176};
177#endif
178
179/*
180 * I2C/SPI/SMC1 relocation patch arrays.
181 */
182
183#ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
184
185uint patch_2000[] = {
186 0x3fff0000,
187 0x3ffd0000,
188 0x3ffb0000,
189 0x3ff90000,
190 0x5f13eff8,
191 0x5eb5eff8,
192 0x5f88adf7,
193 0x5fefadf7,
194 0x3a9cfbc8,
195 0x77cae1bb,
196 0xf4de7fad,
197 0xabae9330,
198 0x4e08fdcf,
199 0x6e0faff8,
200 0x7ccf76cf,
201 0xfdaff9cf,
202 0xabf88dc8,
203 0xab5879f7,
204 0xb0925d8d,
205 0xdfd079f7,
206 0xb090e6bb,
207 0xe5bbe74f,
208 0x9e046f0f,
209 0x6ffb76ce,
210 0xee0cf9cf,
211 0x2bfbefef,
212 0xcfeef9cf,
213 0x76cead23,
214 0x90b3df99,
215 0x7fddd0c1,
216 0x4bf847fd,
217 0x7ccf76ce,
218 0xcfef77ca,
219 0x7eaf7fad,
220 0x7dfdf0b7,
221 0xef7a7fca,
222 0x77cafbc8,
223 0x6079e722,
224 0xfbc85fff,
225 0xdfff5fb3,
226 0xfffbfbc8,
227 0xf3c894a5,
228 0xe7c9edf9,
229 0x7f9a7fad,
230 0x5f36afe8,
231 0x5f5bffdf,
232 0xdf95cb9e,
233 0xaf7d5fc3,
234 0xafed8c1b,
235 0x5fc3afdd,
236 0x5fc5df99,
237 0x7efdb0b3,
238 0x5fb3fffe,
239 0xabae5fb3,
240 0xfffe5fd0,
241 0x600be6bb,
242 0x600b5fd0,
243 0xdfc827fb,
244 0xefdf5fca,
245 0xcfde3a9c,
246 0xe7c9edf9,
247 0xf3c87f9e,
248 0x54ca7fed,
249 0x2d3a3637,
250 0x756f7e9a,
251 0xf1ce37ef,
252 0x2e677fee,
253 0x10ebadf8,
254 0xefdecfea,
255 0xe52f7d9f,
256 0xe12bf1ce,
257 0x5f647e9a,
258 0x4df8cfea,
259 0x5f717d9b,
260 0xefeecfea,
261 0x5f73e522,
262 0xefde5f73,
263 0xcfda0b61,
264 0x5d8fdf61,
265 0xe7c9edf9,
266 0x7e9a30d5,
267 0x1458bfff,
268 0xf3c85fff,
269 0xdfffa7f8,
270 0x5f5bbffe,
271 0x7f7d10d0,
272 0x144d5f33,
273 0xbfffaf78,
274 0x5f5bbffd,
275 0xa7f85f33,
276 0xbffe77fd,
277 0x30bd4e08,
278 0xfdcfe5ff,
279 0x6e0faff8,
280 0x7eef7e9f,
281 0xfdeff1cf,
282 0x5f17abf8,
283 0x0d5b5f5b,
284 0xffef79f7,
285 0x309eafdd,
286 0x5f3147f8,
287 0x5f31afed,
288 0x7fdd50af,
289 0x497847fd,
290 0x7f9e7fed,
291 0x7dfd70a9,
292 0xef7e7ece,
293 0x6ba07f9e,
294 0x2d227efd,
295 0x30db5f5b,
296 0xfffd5f5b,
297 0xffef5f5b,
298 0xffdf0c9c,
299 0xafed0a9a,
300 0xafdd0c37,
301 0x5f37afbd,
302 0x7fbdb081,
303 0x5f8147f8,
304 0x3a11e710,
305 0xedf0ccdd,
306 0xf3186d0a,
307 0x7f0e5f06,
308 0x7fedbb38,
309 0x3afe7468,
310 0x7fedf4fc,
311 0x8ffbb951,
312 0xb85f77fd,
313 0xb0df5ddd,
314 0xdefe7fed,
315 0x90e1e74d,
316 0x6f0dcbf7,
317 0xe7decfed,
318 0xcb74cfed,
319 0xcfeddf6d,
320 0x91714f74,
321 0x5dd2deef,
322 0x9e04e7df,
323 0xefbb6ffb,
324 0xe7ef7f0e,
325 0x9e097fed,
326 0xebdbeffa,
327 0xeb54affb,
328 0x7fea90d7,
329 0x7e0cf0c3,
330 0xbffff318,
331 0x5fffdfff,
332 0xac59efea,
333 0x7fce1ee5,
334 0xe2ff5ee1,
335 0xaffbe2ff,
336 0x5ee3affb,
337 0xf9cc7d0f,
338 0xaef8770f,
339 0x7d0fb0c6,
340 0xeffbbfff,
341 0xcfef5ede,
342 0x7d0fbfff,
343 0x5ede4cf8,
344 0x7fddd0bf,
345 0x49f847fd,
346 0x7efdf0bb,
347 0x7fedfffd,
348 0x7dfdf0b7,
349 0xef7e7e1e,
350 0x5ede7f0e,
351 0x3a11e710,
352 0xedf0ccab,
353 0xfb18ad2e,
354 0x1ea9bbb8,
355 0x74283b7e,
356 0x73c2e4bb,
357 0x2ada4fb8,
358 0xdc21e4bb,
359 0xb2a1ffbf,
360 0x5e2c43f8,
361 0xfc87e1bb,
362 0xe74ffd91,
363 0x6f0f4fe8,
364 0xc7ba32e2,
365 0xf396efeb,
366 0x600b4f78,
367 0xe5bb760b,
368 0x53acaef8,
369 0x4ef88b0e,
370 0xcfef9e09,
371 0xabf8751f,
372 0xefef5bac,
373 0x741f4fe8,
374 0x751e760d,
375 0x7fdbf081,
376 0x741cafce,
377 0xefcc7fce,
378 0x751e70ac,
379 0x741ce7bb,
380 0x3372cfed,
381 0xafdbefeb,
382 0xe5bb760b,
383 0x53f2aef8,
384 0xafe8e7eb,
385 0x4bf8771e,
386 0x7e247fed,
387 0x4fcbe2cc,
388 0x7fbc30a9,
389 0x7b0f7a0f,
390 0x34d577fd,
391 0x308b5db7,
392 0xde553e5f,
393 0xaf78741f,
394 0x741f30f0,
395 0xcfef5e2c,
396 0x741f3eac,
397 0xafb8771e,
398 0x5e677fed,
399 0x0bd3e2cc,
400 0x741ccfec,
401 0xe5ca53cd,
402 0x6fcb4f74,
403 0x5dadde4b,
404 0x2ab63d38,
405 0x4bb3de30,
406 0x751f741c,
407 0x6c42effa,
408 0xefea7fce,
409 0x6ffc30be,
410 0xefec3fca,
411 0x30b3de2e,
412 0xadf85d9e,
413 0xaf7daefd,
414 0x5d9ede2e,
415 0x5d9eafdd,
416 0x761f10ac,
417 0x1da07efd,
418 0x30adfffe,
419 0x4908fb18,
420 0x5fffdfff,
421 0xafbb709b,
422 0x4ef85e67,
423 0xadf814ad,
424 0x7a0f70ad,
425 0xcfef50ad,
426 0x7a0fde30,
427 0x5da0afed,
428 0x3c12780f,
429 0xefef780f,
430 0xefef790f,
431 0xa7f85e0f,
432 0xffef790f,
433 0xefef790f,
434 0x14adde2e,
435 0x5d9eadfd,
436 0x5e2dfffb,
437 0xe79addfd,
438 0xeff96079,
439 0x607ae79a,
440 0xddfceff9,
441 0x60795dff,
442 0x607acfef,
443 0xefefefdf,
444 0xefbfef7f,
445 0xeeffedff,
446 0xebffe7ff,
447 0xafefafdf,
448 0xafbfaf7f,
449 0xaeffadff,
450 0xabffa7ff,
451 0x6fef6fdf,
452 0x6fbf6f7f,
453 0x6eff6dff,
454 0x6bff67ff,
455 0x2fef2fdf,
456 0x2fbf2f7f,
457 0x2eff2dff,
458 0x2bff27ff,
459 0x4e08fd1f,
460 0xe5ff6e0f,
461 0xaff87eef,
462 0x7e0ffdef,
463 0xf11f6079,
464 0xabf8f542,
465 0x7e0af11c,
466 0x37cfae3a,
467 0x7fec90be,
468 0xadf8efdc,
469 0xcfeae52f,
470 0x7d0fe12b,
471 0xf11c6079,
472 0x7e0a4df8,
473 0xcfea5dc4,
474 0x7d0befec,
475 0xcfea5dc6,
476 0xe522efdc,
477 0x5dc6cfda,
478 0x4e08fd1f,
479 0x6e0faff8,
480 0x7c1f761f,
481 0xfdeff91f,
482 0x6079abf8,
483 0x761cee24,
484 0xf91f2bfb,
485 0xefefcfec,
486 0xf91f6079,
487 0x761c27fb,
488 0xefdf5da7,
489 0xcfdc7fdd,
490 0xd09c4bf8,
491 0x47fd7c1f,
492 0x761ccfcf,
493 0x7eef7fed,
494 0x7dfdf093,
495 0xef7e7f1e,
496 0x771efb18,
497 0x6079e722,
498 0xe6bbe5bb,
499 0xae0ae5bb,
500 0x600bae85,
501 0xe2bbe2bb,
502 0xe2bbe2bb,
503 0xaf02e2bb,
504 0xe2bb2ff9,
505 0x6079e2bb
506};
507
508uint patch_2f00[] = {
509 0x30303030,
510 0x3e3e3434,
511 0xabbf9b99,
512 0x4b4fbdbd,
513 0x59949334,
514 0x9fff37fb,
515 0x9b177dd9,
516 0x936956bb,
517 0xfbdd697b,
518 0xdd2fd113,
519 0x1db9f7bb,
520 0x36313963,
521 0x79373369,
522 0x3193137f,
523 0x7331737a,
524 0xf7bb9b99,
525 0x9bb19795,
526 0x77fdfd3d,
527 0x573b773f,
528 0x737933f7,
529 0xb991d115,
530 0x31699315,
531 0x31531694,
532 0xbf4fbdbd,
533 0x35931497,
534 0x35376956,
535 0xbd697b9d,
536 0x96931313,
537 0x19797937,
538 0x6935af78,
539 0xb9b3baa3,
540 0xb8788683,
541 0x368f78f7,
542 0x87778733,
543 0x3ffffb3b,
544 0x8e8f78b8,
545 0x1d118e13,
546 0xf3ff3f8b,
547 0x6bd8e173,
548 0xd1366856,
549 0x68d1687b,
550 0x3daf78b8,
551 0x3a3a3f87,
552 0x8f81378f,
553 0xf876f887,
554 0x77fd8778,
555 0x737de8d6,
556 0xbbf8bfff,
557 0xd8df87f7,
558 0xfd876f7b,
559 0x8bfff8bd,
560 0x8683387d,
561 0xb873d87b,
562 0x3b8fd7f8,
563 0xf7338883,
564 0xbb8ee1f8,
565 0xef837377,
566 0x3337b836,
567 0x817d11f8,
568 0x7378b878,
569 0xd3368b7d,
570 0xed731b7d,
571 0x833731f3,
572 0xf22f3f23
573};
574
575uint patch_2e00[] = {
576 0x27eeeeee,
577 0xeeeeeeee,
578 0xeeeeeeee,
579 0xeeeeeeee,
580 0xee4bf4fb,
581 0xdbd259bb,
582 0x1979577f,
583 0xdfd2d573,
584 0xb773f737,
585 0x4b4fbdbd,
586 0x25b9b177,
587 0xd2d17376,
588 0x956bbfdd,
589 0x697bdd2f,
590 0xff9f79ff,
591 0xff9ff22f
592};
593#endif
594
595/*
596 * USB SOF patch arrays.
597 */
598
599#ifdef CONFIG_USB_SOF_UCODE_PATCH
600
601uint patch_2000[] = {
602 0x7fff0000,
603 0x7ffd0000,
604 0x7ffb0000,
605 0x49f7ba5b,
606 0xba383ffb,
607 0xf9b8b46d,
608 0xe5ab4e07,
609 0xaf77bffe,
610 0x3f7bbf79,
611 0xba5bba38,
612 0xe7676076,
613 0x60750000
614};
615
616uint patch_2f00[] = {
617 0x3030304c,
618 0xcab9e441,
619 0xa1aaf220
620};
621#endif
622
623void
624cpm_load_patch(cpm8xx_t *cp)
625{
626 volatile uint *dp; /* Dual-ported RAM. */
627 volatile cpm8xx_t *commproc;
628 volatile iic_t *iip;
629 volatile spi_t *spp;
630 volatile smc_uart_t *smp;
631 int i;
632
633 commproc = cp;
634
635#ifdef CONFIG_USB_SOF_UCODE_PATCH
636 commproc->cp_rccr = 0;
637
638 dp = (uint *)(commproc->cp_dpmem);
639 for (i=0; i<(sizeof(patch_2000)/4); i++)
640 *dp++ = patch_2000[i];
641
642 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
643 for (i=0; i<(sizeof(patch_2f00)/4); i++)
644 *dp++ = patch_2f00[i];
645
646 commproc->cp_rccr = 0x0009;
647
648 printk("USB SOF microcode patch installed\n");
649#endif /* CONFIG_USB_SOF_UCODE_PATCH */
650
651#if defined(CONFIG_I2C_SPI_UCODE_PATCH) || \
652 defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
653
654 commproc->cp_rccr = 0;
655
656 dp = (uint *)(commproc->cp_dpmem);
657 for (i=0; i<(sizeof(patch_2000)/4); i++)
658 *dp++ = patch_2000[i];
659
660 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
661 for (i=0; i<(sizeof(patch_2f00)/4); i++)
662 *dp++ = patch_2f00[i];
663
664 iip = (iic_t *)&commproc->cp_dparam[PROFF_IIC];
665# define RPBASE 0x0500
666 iip->iic_rpbase = RPBASE;
667
668 /* Put SPI above the IIC, also 32-byte aligned.
669 */
670 i = (RPBASE + sizeof(iic_t) + 31) & ~31;
671 spp = (spi_t *)&commproc->cp_dparam[PROFF_SPI];
672 spp->spi_rpbase = i;
673
674# if defined(CONFIG_I2C_SPI_UCODE_PATCH)
675 commproc->cp_cpmcr1 = 0x802a;
676 commproc->cp_cpmcr2 = 0x8028;
677 commproc->cp_cpmcr3 = 0x802e;
678 commproc->cp_cpmcr4 = 0x802c;
679 commproc->cp_rccr = 1;
680
681 printk("I2C/SPI microcode patch installed.\n");
682# endif /* CONFIG_I2C_SPI_UCODE_PATCH */
683
684# if defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
685
686 dp = (uint *)&(commproc->cp_dpmem[0x0e00]);
687 for (i=0; i<(sizeof(patch_2e00)/4); i++)
688 *dp++ = patch_2e00[i];
689
690 commproc->cp_cpmcr1 = 0x8080;
691 commproc->cp_cpmcr2 = 0x808a;
692 commproc->cp_cpmcr3 = 0x8028;
693 commproc->cp_cpmcr4 = 0x802a;
694 commproc->cp_rccr = 3;
695
696 smp = (smc_uart_t *)&commproc->cp_dparam[PROFF_SMC1];
697 smp->smc_rpbase = 0x1FC0;
698
699 printk("I2C/SPI/SMC1 microcode patch installed.\n");
700# endif /* CONFIG_I2C_SPI_SMC1_UCODE_PATCH) */
701
702#endif /* some variation of the I2C/SPI patch was selected */
703}
704
705/*
706 * Take this entire routine out, since no one calls it and its
707 * logic is suspect.
708 */
709
710#if 0
711void
712verify_patch(volatile immap_t *immr)
713{
714 volatile uint *dp;
715 volatile cpm8xx_t *commproc;
716 int i;
717
718 commproc = (cpm8xx_t *)&immr->im_cpm;
719
720 printk("cp_rccr %x\n", commproc->cp_rccr);
721 commproc->cp_rccr = 0;
722
723 dp = (uint *)(commproc->cp_dpmem);
724 for (i=0; i<(sizeof(patch_2000)/4); i++)
725 if (*dp++ != patch_2000[i]) {
726 printk("patch_2000 bad at %d\n", i);
727 dp--;
728 printk("found 0x%X, wanted 0x%X\n", *dp, patch_2000[i]);
729 break;
730 }
731
732 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
733 for (i=0; i<(sizeof(patch_2f00)/4); i++)
734 if (*dp++ != patch_2f00[i]) {
735 printk("patch_2f00 bad at %d\n", i);
736 dp--;
737 printk("found 0x%X, wanted 0x%X\n", *dp, patch_2f00[i]);
738 break;
739 }
740
741 commproc->cp_rccr = 0x0009;
742}
743#endif
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c
new file mode 100644
index 000000000000..2fc2bcd79b5e
--- /dev/null
+++ b/arch/powerpc/sysdev/mpc8xx_pic.c
@@ -0,0 +1,197 @@
1#include <linux/kernel.h>
2#include <linux/module.h>
3#include <linux/stddef.h>
4#include <linux/init.h>
5#include <linux/sched.h>
6#include <linux/signal.h>
7#include <linux/irq.h>
8#include <linux/dma-mapping.h>
9#include <asm/prom.h>
10#include <asm/irq.h>
11#include <asm/io.h>
12#include <asm/8xx_immap.h>
13#include <asm/mpc8xx.h>
14
15#include "mpc8xx_pic.h"
16
17
18#define PIC_VEC_SPURRIOUS 15
19
20extern int cpm_get_irq(struct pt_regs *regs);
21
22static struct device_node *mpc8xx_pic_node;
23static struct irq_host *mpc8xx_pic_host;
24#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
25static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
26static sysconf8xx_t *siu_reg;
27
28int cpm_get_irq(struct pt_regs *regs);
29
30static void mpc8xx_unmask_irq(unsigned int virq)
31{
32 int bit, word;
33 unsigned int irq_nr = (unsigned int)irq_map[virq].hwirq;
34
35 bit = irq_nr & 0x1f;
36 word = irq_nr >> 5;
37
38 ppc_cached_irq_mask[word] |= (1 << (31-bit));
39 out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]);
40}
41
42static void mpc8xx_mask_irq(unsigned int virq)
43{
44 int bit, word;
45 unsigned int irq_nr = (unsigned int)irq_map[virq].hwirq;
46
47 bit = irq_nr & 0x1f;
48 word = irq_nr >> 5;
49
50 ppc_cached_irq_mask[word] &= ~(1 << (31-bit));
51 out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]);
52}
53
54static void mpc8xx_ack(unsigned int virq)
55{
56 int bit;
57 unsigned int irq_nr = (unsigned int)irq_map[virq].hwirq;
58
59 bit = irq_nr & 0x1f;
60 out_be32(&siu_reg->sc_sipend, 1 << (31-bit));
61}
62
63static void mpc8xx_end_irq(unsigned int virq)
64{
65 int bit, word;
66 unsigned int irq_nr = (unsigned int)irq_map[virq].hwirq;
67
68 bit = irq_nr & 0x1f;
69 word = irq_nr >> 5;
70
71 ppc_cached_irq_mask[word] |= (1 << (31-bit));
72 out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]);
73}
74
75static int mpc8xx_set_irq_type(unsigned int virq, unsigned int flow_type)
76{
77 struct irq_desc *desc = get_irq_desc(virq);
78
79 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
80 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
81 if (flow_type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW))
82 desc->status |= IRQ_LEVEL;
83
84 if (flow_type & IRQ_TYPE_EDGE_FALLING) {
85 irq_hw_number_t hw = (unsigned int)irq_map[virq].hwirq;
86 unsigned int siel = in_be32(&siu_reg->sc_siel);
87
88 /* only external IRQ senses are programmable */
89 if ((hw & 1) == 0) {
90 siel |= (0x80000000 >> hw);
91 out_be32(&siu_reg->sc_siel, siel);
92 desc->handle_irq = handle_edge_irq;
93 }
94 }
95 return 0;
96}
97
98static struct irq_chip mpc8xx_pic = {
99 .typename = " MPC8XX SIU ",
100 .unmask = mpc8xx_unmask_irq,
101 .mask = mpc8xx_mask_irq,
102 .ack = mpc8xx_ack,
103 .eoi = mpc8xx_end_irq,
104 .set_type = mpc8xx_set_irq_type,
105};
106
107unsigned int mpc8xx_get_irq(void)
108{
109 int irq;
110
111 /* For MPC8xx, read the SIVEC register and shift the bits down
112 * to get the irq number.
113 */
114 irq = in_be32(&siu_reg->sc_sivec) >> 26;
115
116 if (irq == PIC_VEC_SPURRIOUS)
117 irq = NO_IRQ;
118
119 return irq_linear_revmap(mpc8xx_pic_host, irq);
120
121}
122
123static int mpc8xx_pic_host_match(struct irq_host *h, struct device_node *node)
124{
125 return mpc8xx_pic_node == node;
126}
127
128static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq,
129 irq_hw_number_t hw)
130{
131 pr_debug("mpc8xx_pic_host_map(%d, 0x%lx)\n", virq, hw);
132
133 /* Set default irq handle */
134 set_irq_chip_and_handler(virq, &mpc8xx_pic, handle_level_irq);
135 return 0;
136}
137
138
139static int mpc8xx_pic_host_xlate(struct irq_host *h, struct device_node *ct,
140 u32 *intspec, unsigned int intsize,
141 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
142{
143 static unsigned char map_pic_senses[4] = {
144 IRQ_TYPE_EDGE_RISING,
145 IRQ_TYPE_LEVEL_LOW,
146 IRQ_TYPE_LEVEL_HIGH,
147 IRQ_TYPE_EDGE_FALLING,
148 };
149
150 *out_hwirq = intspec[0];
151 if (intsize > 1 && intspec[1] < 4)
152 *out_flags = map_pic_senses[intspec[1]];
153 else
154 *out_flags = IRQ_TYPE_NONE;
155
156 return 0;
157}
158
159
160static struct irq_host_ops mpc8xx_pic_host_ops = {
161 .match = mpc8xx_pic_host_match,
162 .map = mpc8xx_pic_host_map,
163 .xlate = mpc8xx_pic_host_xlate,
164};
165
166int mpc8xx_pic_init(void)
167{
168 struct resource res;
169 struct device_node *np = NULL;
170 int ret;
171
172 np = of_find_node_by_type(np, "mpc8xx-pic");
173
174 if (np == NULL) {
175 printk(KERN_ERR "Could not find open-pic node\n");
176 return -ENOMEM;
177 }
178
179 mpc8xx_pic_node = of_node_get(np);
180
181 ret = of_address_to_resource(np, 0, &res);
182 of_node_put(np);
183 if (ret)
184 return ret;
185
186 siu_reg = (void *)ioremap(res.start, res.end - res.start + 1);
187 if (siu_reg == NULL)
188 return -EINVAL;
189
190 mpc8xx_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &mpc8xx_pic_host_ops, 64);
191 if (mpc8xx_pic_host == NULL) {
192 printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n");
193 ret = -ENOMEM;
194 }
195
196 return ret;
197}
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.h b/arch/powerpc/sysdev/mpc8xx_pic.h
new file mode 100644
index 000000000000..afa2ee6717c1
--- /dev/null
+++ b/arch/powerpc/sysdev/mpc8xx_pic.h
@@ -0,0 +1,12 @@
1#ifndef _PPC_KERNEL_MPC8xx_H
2#define _PPC_KERNEL_MPC8xx_H
3
4#include <linux/irq.h>
5#include <linux/interrupt.h>
6
7extern struct hw_interrupt_type mpc8xx_pic;
8
9int mpc8xx_pic_init(void);
10unsigned int mpc8xx_get_irq(void);
11
12#endif /* _PPC_KERNEL_PPC8xx_H */
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index d01ced11694d..aa701cc27ecc 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -496,13 +496,18 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
496static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi) 496static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi)
497{ 497{
498 unsigned int src = mpic_irq_to_hw(irq); 498 unsigned int src = mpic_irq_to_hw(irq);
499 struct mpic *mpic;
499 500
500 if (irq < NUM_ISA_INTERRUPTS) 501 if (irq < NUM_ISA_INTERRUPTS)
501 return NULL; 502 return NULL;
503
504 mpic = irq_desc[irq].chip_data;
505
502 if (is_ipi) 506 if (is_ipi)
503 *is_ipi = (src >= MPIC_VEC_IPI_0 && src <= MPIC_VEC_IPI_3); 507 *is_ipi = (src >= mpic->ipi_vecs[0] &&
508 src <= mpic->ipi_vecs[3]);
504 509
505 return irq_desc[irq].chip_data; 510 return mpic;
506} 511}
507 512
508/* Convert a cpu mask from logical to physical cpu numbers. */ 513/* Convert a cpu mask from logical to physical cpu numbers. */
@@ -540,7 +545,11 @@ static inline void mpic_eoi(struct mpic *mpic)
540#ifdef CONFIG_SMP 545#ifdef CONFIG_SMP
541static irqreturn_t mpic_ipi_action(int irq, void *dev_id) 546static irqreturn_t mpic_ipi_action(int irq, void *dev_id)
542{ 547{
543 smp_message_recv(mpic_irq_to_hw(irq) - MPIC_VEC_IPI_0); 548 struct mpic *mpic;
549
550 mpic = mpic_find(irq, NULL);
551 smp_message_recv(mpic_irq_to_hw(irq) - mpic->ipi_vecs[0]);
552
544 return IRQ_HANDLED; 553 return IRQ_HANDLED;
545} 554}
546#endif /* CONFIG_SMP */ 555#endif /* CONFIG_SMP */
@@ -663,7 +672,7 @@ static void mpic_end_ht_irq(unsigned int irq)
663static void mpic_unmask_ipi(unsigned int irq) 672static void mpic_unmask_ipi(unsigned int irq)
664{ 673{
665 struct mpic *mpic = mpic_from_ipi(irq); 674 struct mpic *mpic = mpic_from_ipi(irq);
666 unsigned int src = mpic_irq_to_hw(irq) - MPIC_VEC_IPI_0; 675 unsigned int src = mpic_irq_to_hw(irq) - mpic->ipi_vecs[0];
667 676
668 DBG("%s: enable_ipi: %d (ipi %d)\n", mpic->name, irq, src); 677 DBG("%s: enable_ipi: %d (ipi %d)\n", mpic->name, irq, src);
669 mpic_ipi_write(src, mpic_ipi_read(src) & ~MPIC_VECPRI_MASK); 678 mpic_ipi_write(src, mpic_ipi_read(src) & ~MPIC_VECPRI_MASK);
@@ -807,11 +816,11 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,
807 816
808 DBG("mpic: map virq %d, hwirq 0x%lx\n", virq, hw); 817 DBG("mpic: map virq %d, hwirq 0x%lx\n", virq, hw);
809 818
810 if (hw == MPIC_VEC_SPURRIOUS) 819 if (hw == mpic->spurious_vec)
811 return -EINVAL; 820 return -EINVAL;
812 821
813#ifdef CONFIG_SMP 822#ifdef CONFIG_SMP
814 else if (hw >= MPIC_VEC_IPI_0) { 823 else if (hw >= mpic->ipi_vecs[0]) {
815 WARN_ON(!(mpic->flags & MPIC_PRIMARY)); 824 WARN_ON(!(mpic->flags & MPIC_PRIMARY));
816 825
817 DBG("mpic: mapping as IPI\n"); 826 DBG("mpic: mapping as IPI\n");
@@ -904,6 +913,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
904 u32 reg; 913 u32 reg;
905 const char *vers; 914 const char *vers;
906 int i; 915 int i;
916 int intvec_top;
907 u64 paddr = phys_addr; 917 u64 paddr = phys_addr;
908 918
909 mpic = alloc_bootmem(sizeof(struct mpic)); 919 mpic = alloc_bootmem(sizeof(struct mpic));
@@ -912,11 +922,11 @@ struct mpic * __init mpic_alloc(struct device_node *node,
912 922
913 memset(mpic, 0, sizeof(struct mpic)); 923 memset(mpic, 0, sizeof(struct mpic));
914 mpic->name = name; 924 mpic->name = name;
915 mpic->of_node = node ? of_node_get(node) : NULL; 925 mpic->of_node = of_node_get(node);
916 926
917 mpic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 256, 927 mpic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, isu_size,
918 &mpic_host_ops, 928 &mpic_host_ops,
919 MPIC_VEC_SPURRIOUS); 929 flags & MPIC_LARGE_VECTORS ? 2048 : 256);
920 if (mpic->irqhost == NULL) { 930 if (mpic->irqhost == NULL) {
921 of_node_put(node); 931 of_node_put(node);
922 return NULL; 932 return NULL;
@@ -944,6 +954,21 @@ struct mpic * __init mpic_alloc(struct device_node *node,
944 mpic->irq_count = irq_count; 954 mpic->irq_count = irq_count;
945 mpic->num_sources = 0; /* so far */ 955 mpic->num_sources = 0; /* so far */
946 956
957 if (flags & MPIC_LARGE_VECTORS)
958 intvec_top = 2047;
959 else
960 intvec_top = 255;
961
962 mpic->timer_vecs[0] = intvec_top - 8;
963 mpic->timer_vecs[1] = intvec_top - 7;
964 mpic->timer_vecs[2] = intvec_top - 6;
965 mpic->timer_vecs[3] = intvec_top - 5;
966 mpic->ipi_vecs[0] = intvec_top - 4;
967 mpic->ipi_vecs[1] = intvec_top - 3;
968 mpic->ipi_vecs[2] = intvec_top - 2;
969 mpic->ipi_vecs[3] = intvec_top - 1;
970 mpic->spurious_vec = intvec_top;
971
947 /* Check for "big-endian" in device-tree */ 972 /* Check for "big-endian" in device-tree */
948 if (node && get_property(node, "big-endian", NULL) != NULL) 973 if (node && get_property(node, "big-endian", NULL) != NULL)
949 mpic->flags |= MPIC_BIG_ENDIAN; 974 mpic->flags |= MPIC_BIG_ENDIAN;
@@ -1084,11 +1109,6 @@ void __init mpic_init(struct mpic *mpic)
1084 int i; 1109 int i;
1085 1110
1086 BUG_ON(mpic->num_sources == 0); 1111 BUG_ON(mpic->num_sources == 0);
1087 WARN_ON(mpic->num_sources > MPIC_VEC_IPI_0);
1088
1089 /* Sanitize source count */
1090 if (mpic->num_sources > MPIC_VEC_IPI_0)
1091 mpic->num_sources = MPIC_VEC_IPI_0;
1092 1112
1093 printk(KERN_INFO "mpic: Initializing for %d sources\n", mpic->num_sources); 1113 printk(KERN_INFO "mpic: Initializing for %d sources\n", mpic->num_sources);
1094 1114
@@ -1104,7 +1124,7 @@ void __init mpic_init(struct mpic *mpic)
1104 i * MPIC_INFO(TIMER_STRIDE) + 1124 i * MPIC_INFO(TIMER_STRIDE) +
1105 MPIC_INFO(TIMER_VECTOR_PRI), 1125 MPIC_INFO(TIMER_VECTOR_PRI),
1106 MPIC_VECPRI_MASK | 1126 MPIC_VECPRI_MASK |
1107 (MPIC_VEC_TIMER_0 + i)); 1127 (mpic->timer_vecs[0] + i));
1108 } 1128 }
1109 1129
1110 /* Initialize IPIs to our reserved vectors and mark them disabled for now */ 1130 /* Initialize IPIs to our reserved vectors and mark them disabled for now */
@@ -1113,7 +1133,7 @@ void __init mpic_init(struct mpic *mpic)
1113 mpic_ipi_write(i, 1133 mpic_ipi_write(i,
1114 MPIC_VECPRI_MASK | 1134 MPIC_VECPRI_MASK |
1115 (10 << MPIC_VECPRI_PRIORITY_SHIFT) | 1135 (10 << MPIC_VECPRI_PRIORITY_SHIFT) |
1116 (MPIC_VEC_IPI_0 + i)); 1136 (mpic->ipi_vecs[0] + i));
1117 } 1137 }
1118 1138
1119 /* Initialize interrupt sources */ 1139 /* Initialize interrupt sources */
@@ -1136,8 +1156,8 @@ void __init mpic_init(struct mpic *mpic)
1136 1 << hard_smp_processor_id()); 1156 1 << hard_smp_processor_id());
1137 } 1157 }
1138 1158
1139 /* Init spurrious vector */ 1159 /* Init spurious vector */
1140 mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), MPIC_VEC_SPURRIOUS); 1160 mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec);
1141 1161
1142 /* Disable 8259 passthrough, if supported */ 1162 /* Disable 8259 passthrough, if supported */
1143 if (!(mpic->flags & MPIC_NO_PTHROU_DIS)) 1163 if (!(mpic->flags & MPIC_NO_PTHROU_DIS))
@@ -1184,9 +1204,9 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1184 1204
1185 spin_lock_irqsave(&mpic_lock, flags); 1205 spin_lock_irqsave(&mpic_lock, flags);
1186 if (is_ipi) { 1206 if (is_ipi) {
1187 reg = mpic_ipi_read(src - MPIC_VEC_IPI_0) & 1207 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
1188 ~MPIC_VECPRI_PRIORITY_MASK; 1208 ~MPIC_VECPRI_PRIORITY_MASK;
1189 mpic_ipi_write(src - MPIC_VEC_IPI_0, 1209 mpic_ipi_write(src - mpic->ipi_vecs[0],
1190 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); 1210 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
1191 } else { 1211 } else {
1192 reg = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) 1212 reg = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI))
@@ -1207,7 +1227,7 @@ unsigned int mpic_irq_get_priority(unsigned int irq)
1207 1227
1208 spin_lock_irqsave(&mpic_lock, flags); 1228 spin_lock_irqsave(&mpic_lock, flags);
1209 if (is_ipi) 1229 if (is_ipi)
1210 reg = mpic_ipi_read(src = MPIC_VEC_IPI_0); 1230 reg = mpic_ipi_read(src = mpic->ipi_vecs[0]);
1211 else 1231 else
1212 reg = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)); 1232 reg = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
1213 spin_unlock_irqrestore(&mpic_lock, flags); 1233 spin_unlock_irqrestore(&mpic_lock, flags);
@@ -1313,7 +1333,7 @@ unsigned int mpic_get_one_irq(struct mpic *mpic)
1313#ifdef DEBUG_LOW 1333#ifdef DEBUG_LOW
1314 DBG("%s: get_one_irq(): %d\n", mpic->name, src); 1334 DBG("%s: get_one_irq(): %d\n", mpic->name, src);
1315#endif 1335#endif
1316 if (unlikely(src == MPIC_VEC_SPURRIOUS)) 1336 if (unlikely(src == mpic->spurious_vec))
1317 return NO_IRQ; 1337 return NO_IRQ;
1318 return irq_linear_revmap(mpic->irqhost, src); 1338 return irq_linear_revmap(mpic->irqhost, src);
1319} 1339}
@@ -1345,7 +1365,7 @@ void mpic_request_ipis(void)
1345 1365
1346 for (i = 0; i < 4; i++) { 1366 for (i = 0; i < 4; i++) {
1347 unsigned int vipi = irq_create_mapping(mpic->irqhost, 1367 unsigned int vipi = irq_create_mapping(mpic->irqhost,
1348 MPIC_VEC_IPI_0 + i); 1368 mpic->ipi_vecs[0] + i);
1349 if (vipi == NO_IRQ) { 1369 if (vipi == NO_IRQ) {
1350 printk(KERN_ERR "Failed to map IPI %d\n", i); 1370 printk(KERN_ERR "Failed to map IPI %d\n", i);
1351 break; 1371 break;
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 74e48d94f27c..4d1dcb45963d 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -323,7 +323,7 @@ unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic)
323 return irq_linear_revmap(qe_ic->irqhost, irq); 323 return irq_linear_revmap(qe_ic->irqhost, irq);
324} 324}
325 325
326void fastcall qe_ic_cascade_low(unsigned int irq, struct irq_desc *desc) 326void qe_ic_cascade_low(unsigned int irq, struct irq_desc *desc)
327{ 327{
328 struct qe_ic *qe_ic = desc->handler_data; 328 struct qe_ic *qe_ic = desc->handler_data;
329 unsigned int cascade_irq = qe_ic_get_low_irq(qe_ic); 329 unsigned int cascade_irq = qe_ic_get_low_irq(qe_ic);
@@ -332,7 +332,7 @@ void fastcall qe_ic_cascade_low(unsigned int irq, struct irq_desc *desc)
332 generic_handle_irq(cascade_irq); 332 generic_handle_irq(cascade_irq);
333} 333}
334 334
335void fastcall qe_ic_cascade_high(unsigned int irq, struct irq_desc *desc) 335void qe_ic_cascade_high(unsigned int irq, struct irq_desc *desc)
336{ 336{
337 struct qe_ic *qe_ic = desc->handler_data; 337 struct qe_ic *qe_ic = desc->handler_data;
338 unsigned int cascade_irq = qe_ic_get_high_irq(qe_ic); 338 unsigned int cascade_irq = qe_ic_get_high_irq(qe_ic);
@@ -352,7 +352,7 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags)
352 return; 352 return;
353 353
354 memset(qe_ic, 0, sizeof(struct qe_ic)); 354 memset(qe_ic, 0, sizeof(struct qe_ic));
355 qe_ic->of_node = node ? of_node_get(node) : NULL; 355 qe_ic->of_node = of_node_get(node);
356 356
357 qe_ic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 357 qe_ic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR,
358 NR_QE_IC_INTS, &qe_ic_host_ops, 0); 358 NR_QE_IC_INTS, &qe_ic_host_ops, 0);
diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c
index 5d841f4b3530..af3780e52e76 100644
--- a/arch/powerpc/xmon/ppc-opc.c
+++ b/arch/powerpc/xmon/ppc-opc.c
@@ -21,6 +21,7 @@
21 02110-1301, USA. */ 21 02110-1301, USA. */
22 22
23#include <linux/stddef.h> 23#include <linux/stddef.h>
24#include <linux/kernel.h>
24#include "nonstdio.h" 25#include "nonstdio.h"
25#include "ppc.h" 26#include "ppc.h"
26 27
@@ -4932,8 +4933,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
4932 4933
4933}; 4934};
4934 4935
4935const int powerpc_num_opcodes = 4936const int powerpc_num_opcodes = ARRAY_SIZE(powerpc_opcodes);
4936 sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]);
4937 4937
4938/* The macro table. This is only used by the assembler. */ 4938/* The macro table. This is only used by the assembler. */
4939 4939
@@ -4989,5 +4989,4 @@ const struct powerpc_macro powerpc_macros[] = {
4989{ "clrlslwi.",4, PPCCOM, "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" }, 4989{ "clrlslwi.",4, PPCCOM, "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" },
4990}; 4990};
4991 4991
4992const int powerpc_num_macros = 4992const int powerpc_num_macros = ARRAY_SIZE(powerpc_macros);
4993 sizeof (powerpc_macros) / sizeof (powerpc_macros[0]);
diff --git a/arch/powerpc/xmon/spu-dis.c b/arch/powerpc/xmon/spu-dis.c
index ee929c641bf3..e5f89837c82e 100644
--- a/arch/powerpc/xmon/spu-dis.c
+++ b/arch/powerpc/xmon/spu-dis.c
@@ -85,7 +85,7 @@ get_index_for_opcode (unsigned int insn)
85 if ((index = spu_disassemble_table[opcode & 0x7ff]) != 0) 85 if ((index = spu_disassemble_table[opcode & 0x7ff]) != 0)
86 return index; 86 return index;
87 87
88 return 0; 88 return NULL;
89} 89}
90 90
91/* Print a Spu instruction. */ 91/* Print a Spu instruction. */
diff --git a/arch/powerpc/xmon/spu-opc.c b/arch/powerpc/xmon/spu-opc.c
index efffde9edc6e..530df3d6d7b2 100644
--- a/arch/powerpc/xmon/spu-opc.c
+++ b/arch/powerpc/xmon/spu-opc.c
@@ -18,6 +18,7 @@
18 with this program; if not, write to the Free Software Foundation, Inc., 18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 19 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
20 20
21#include <linux/kernel.h>
21#include "spu.h" 22#include "spu.h"
22 23
23/* This file holds the Spu opcode table */ 24/* This file holds the Spu opcode table */
@@ -40,5 +41,4 @@ const struct spu_opcode spu_opcodes[] = {
40#undef APUOPFB 41#undef APUOPFB
41}; 42};
42 43
43const int spu_num_opcodes = 44const int spu_num_opcodes = ARRAY_SIZE(spu_opcodes);
44 sizeof (spu_opcodes) / sizeof (spu_opcodes[0]);
diff --git a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c
index b7bb5f0b3c5f..684ed04eb8b8 100644
--- a/arch/ppc/8xx_io/cs4218_tdm.c
+++ b/arch/ppc/8xx_io/cs4218_tdm.c
@@ -1379,7 +1379,6 @@ static void cs_nosound(unsigned long xx)
1379} 1379}
1380 1380
1381static DEFINE_TIMER(beep_timer, cs_nosound, 0, 0); 1381static DEFINE_TIMER(beep_timer, cs_nosound, 0, 0);
1382};
1383 1382
1384static void cs_mksound(unsigned int hz, unsigned int ticks) 1383static void cs_mksound(unsigned int hz, unsigned int ticks)
1385{ 1384{
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 8eb82efe05a1..c22e60619d9b 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -670,15 +670,6 @@ config RADSTONE_PPC7D
670config PAL4 670config PAL4
671 bool "SBS-Palomar4" 671 bool "SBS-Palomar4"
672 672
673config GEMINI
674 bool "Synergy-Gemini"
675 depends on BROKEN
676 select PPC_INDIRECT_PCI
677 help
678 Select Gemini if configuring for a Synergy Microsystems' Gemini
679 series Single Board Computer. More information is available at:
680 <http://www.synergymicro.com/PressRel/97_10_15.html>.
681
682config EST8260 673config EST8260
683 bool "EST8260" 674 bool "EST8260"
684 ---help--- 675 ---help---
diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
index 28be01b99c44..bcfb6cde70c4 100644
--- a/arch/ppc/boot/simple/Makefile
+++ b/arch/ppc/boot/simple/Makefile
@@ -116,10 +116,6 @@ zimageinitrd-$(CONFIG_WALNUT) := zImage.initrd-TREE
116 extra.o-$(CONFIG_CHESTNUT) := misc-chestnut.o 116 extra.o-$(CONFIG_CHESTNUT) := misc-chestnut.o
117 end-$(CONFIG_CHESTNUT) := chestnut 117 end-$(CONFIG_CHESTNUT) := chestnut
118 118
119 zimage-$(CONFIG_GEMINI) := zImage-STRIPELF
120zimageinitrd-$(CONFIG_GEMINI) := zImage.initrd-STRIPELF
121 end-$(CONFIG_GEMINI) := gemini
122
123 extra.o-$(CONFIG_KATANA) := misc-katana.o 119 extra.o-$(CONFIG_KATANA) := misc-katana.o
124 end-$(CONFIG_KATANA) := katana 120 end-$(CONFIG_KATANA) := katana
125 cacheflag-$(CONFIG_KATANA) := -include $(clear_L2_L3) 121 cacheflag-$(CONFIG_KATANA) := -include $(clear_L2_L3)
diff --git a/arch/ppc/boot/simple/misc.c b/arch/ppc/boot/simple/misc.c
index a5df08963695..c3d3305eb5ca 100644
--- a/arch/ppc/boot/simple/misc.c
+++ b/arch/ppc/boot/simple/misc.c
@@ -42,14 +42,11 @@
42#endif 42#endif
43 43
44/* Will / Can the user give input? 44/* Will / Can the user give input?
45 * Val Henson has requested that Gemini doesn't wait for the
46 * user to edit the cmdline or not.
47 */ 45 */
48#if (defined(CONFIG_SERIAL_8250_CONSOLE) \ 46#if (defined(CONFIG_SERIAL_8250_CONSOLE) \
49 || defined(CONFIG_VGA_CONSOLE) \ 47 || defined(CONFIG_VGA_CONSOLE) \
50 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \ 48 || defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
51 || defined(CONFIG_SERIAL_MPSC_CONSOLE)) \ 49 || defined(CONFIG_SERIAL_MPSC_CONSOLE))
52 && !defined(CONFIG_GEMINI)
53#define INTERACTIVE_CONSOLE 1 50#define INTERACTIVE_CONSOLE 1
54#endif 51#endif
55 52
@@ -178,16 +175,6 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
178 175
179 if (keyb_present) 176 if (keyb_present)
180 CRT_tstc(); /* Forces keyboard to be initialized */ 177 CRT_tstc(); /* Forces keyboard to be initialized */
181#ifdef CONFIG_GEMINI
182 /*
183 * If cmd_line is empty and cmd_preset is not, copy cmd_preset
184 * to cmd_line. This way we can override cmd_preset with the
185 * command line from Smon.
186 */
187
188 if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
189 memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
190#endif
191 178
192 /* Display standard Linux/PPC boot prompt for kernel args */ 179 /* Display standard Linux/PPC boot prompt for kernel args */
193 puts("\nLinux/PPC load: "); 180 puts("\nLinux/PPC load: ");
diff --git a/arch/ppc/configs/gemini_defconfig b/arch/ppc/configs/gemini_defconfig
deleted file mode 100644
index ebcd17b097f1..000000000000
--- a/arch/ppc/configs/gemini_defconfig
+++ /dev/null
@@ -1,618 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12
13#
14# General setup
15#
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18# CONFIG_BSD_PROCESS_ACCT is not set
19CONFIG_SYSCTL=y
20CONFIG_LOG_BUF_SHIFT=14
21# CONFIG_EMBEDDED is not set
22CONFIG_FUTEX=y
23CONFIG_EPOLL=y
24
25#
26# Loadable module support
27#
28CONFIG_MODULES=y
29CONFIG_MODULE_UNLOAD=y
30# CONFIG_MODULE_FORCE_UNLOAD is not set
31CONFIG_OBSOLETE_MODPARM=y
32# CONFIG_MODVERSIONS is not set
33CONFIG_KMOD=y
34
35#
36# Platform support
37#
38CONFIG_PPC=y
39CONFIG_PPC32=y
40CONFIG_6xx=y
41# CONFIG_40x is not set
42# CONFIG_POWER3 is not set
43# CONFIG_8xx is not set
44
45#
46# IBM 4xx options
47#
48# CONFIG_8260 is not set
49CONFIG_GENERIC_ISA_DMA=y
50CONFIG_PPC_STD_MMU=y
51# CONFIG_PPC_MULTIPLATFORM is not set
52# CONFIG_APUS is not set
53# CONFIG_WILLOW_2 is not set
54# CONFIG_PCORE is not set
55# CONFIG_POWERPMC250 is not set
56# CONFIG_EV64260 is not set
57# CONFIG_SPRUCE is not set
58# CONFIG_LOPEC is not set
59# CONFIG_MCPN765 is not set
60# CONFIG_MVME5100 is not set
61# CONFIG_PPLUS is not set
62# CONFIG_PRPMC750 is not set
63# CONFIG_PRPMC800 is not set
64# CONFIG_SANDPOINT is not set
65# CONFIG_ADIR is not set
66# CONFIG_K2 is not set
67# CONFIG_PAL4 is not set
68CONFIG_GEMINI=y
69# CONFIG_SMP is not set
70# CONFIG_PREEMPT is not set
71CONFIG_ALTIVEC=y
72CONFIG_TAU=y
73# CONFIG_TAU_INT is not set
74# CONFIG_TAU_AVERAGE is not set
75# CONFIG_CPU_FREQ is not set
76
77#
78# General setup
79#
80# CONFIG_HIGHMEM is not set
81CONFIG_PCI=y
82CONFIG_PCI_DOMAINS=y
83CONFIG_KCORE_ELF=y
84CONFIG_BINFMT_ELF=y
85CONFIG_KERNEL_ELF=y
86# CONFIG_BINFMT_MISC is not set
87CONFIG_PCI_LEGACY_PROC=y
88CONFIG_PCI_NAMES=y
89# CONFIG_HOTPLUG is not set
90
91#
92# Parallel port support
93#
94# CONFIG_PARPORT is not set
95# CONFIG_PPC601_SYNC_FIX is not set
96# CONFIG_CMDLINE_BOOL is not set
97
98#
99# Advanced setup
100#
101# CONFIG_ADVANCED_OPTIONS is not set
102
103#
104# Default settings for advanced configuration options are used
105#
106CONFIG_HIGHMEM_START=0xfe000000
107CONFIG_LOWMEM_SIZE=0x30000000
108CONFIG_KERNEL_START=0xc0000000
109CONFIG_TASK_SIZE=0x80000000
110CONFIG_BOOT_LOAD=0x00800000
111
112#
113# Memory Technology Devices (MTD)
114#
115# CONFIG_MTD is not set
116
117#
118# Plug and Play support
119#
120# CONFIG_PNP is not set
121
122#
123# Block devices
124#
125# CONFIG_BLK_DEV_FD is not set
126# CONFIG_BLK_CPQ_DA is not set
127# CONFIG_BLK_CPQ_CISS_DA is not set
128# CONFIG_BLK_DEV_DAC960 is not set
129# CONFIG_BLK_DEV_UMEM is not set
130# CONFIG_BLK_DEV_LOOP is not set
131# CONFIG_BLK_DEV_NBD is not set
132CONFIG_BLK_DEV_RAM=y
133CONFIG_BLK_DEV_RAM_SIZE=4096
134CONFIG_BLK_DEV_INITRD=y
135
136#
137# Multi-device support (RAID and LVM)
138#
139# CONFIG_MD is not set
140
141#
142# ATA/IDE/MFM/RLL support
143#
144# CONFIG_IDE is not set
145
146#
147# SCSI support
148#
149CONFIG_SCSI=y
150
151#
152# SCSI support type (disk, tape, CD-ROM)
153#
154CONFIG_BLK_DEV_SD=y
155# CONFIG_CHR_DEV_ST is not set
156# CONFIG_CHR_DEV_OSST is not set
157CONFIG_BLK_DEV_SR=y
158CONFIG_BLK_DEV_SR_VENDOR=y
159CONFIG_CHR_DEV_SG=y
160
161#
162# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
163#
164# CONFIG_SCSI_MULTI_LUN is not set
165# CONFIG_SCSI_REPORT_LUNS is not set
166CONFIG_SCSI_CONSTANTS=y
167# CONFIG_SCSI_LOGGING is not set
168
169#
170# SCSI low-level drivers
171#
172# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
173# CONFIG_SCSI_ACARD is not set
174# CONFIG_SCSI_AACRAID is not set
175# CONFIG_SCSI_AIC7XXX is not set
176# CONFIG_SCSI_AIC7XXX_OLD is not set
177# CONFIG_SCSI_AIC79XX is not set
178# CONFIG_SCSI_DPT_I2O is not set
179# CONFIG_SCSI_ADVANSYS is not set
180# CONFIG_SCSI_IN2000 is not set
181# CONFIG_SCSI_AM53C974 is not set
182# CONFIG_SCSI_MEGARAID is not set
183# CONFIG_SCSI_BUSLOGIC is not set
184# CONFIG_SCSI_CPQFCTS is not set
185# CONFIG_SCSI_DMX3191D is not set
186# CONFIG_SCSI_EATA is not set
187# CONFIG_SCSI_EATA_PIO is not set
188# CONFIG_SCSI_FUTURE_DOMAIN is not set
189# CONFIG_SCSI_GDTH is not set
190# CONFIG_SCSI_GENERIC_NCR5380 is not set
191# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
192# CONFIG_SCSI_INITIO is not set
193# CONFIG_SCSI_INIA100 is not set
194# CONFIG_SCSI_NCR53C7xx is not set
195CONFIG_SCSI_SYM53C8XX_2=y
196CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
197CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
198CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
199# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
200# CONFIG_SCSI_PCI2000 is not set
201# CONFIG_SCSI_PCI2220I is not set
202# CONFIG_SCSI_QLOGIC_ISP is not set
203# CONFIG_SCSI_QLOGIC_FC is not set
204# CONFIG_SCSI_QLOGIC_1280 is not set
205# CONFIG_SCSI_DC395x is not set
206# CONFIG_SCSI_DC390T is not set
207# CONFIG_SCSI_U14_34F is not set
208# CONFIG_SCSI_NSP32 is not set
209# CONFIG_SCSI_DEBUG is not set
210
211#
212# Fusion MPT device support
213#
214# CONFIG_FUSION is not set
215
216#
217# IEEE 1394 (FireWire) support (EXPERIMENTAL)
218#
219# CONFIG_IEEE1394 is not set
220
221#
222# I2O device support
223#
224# CONFIG_I2O is not set
225
226#
227# Networking support
228#
229CONFIG_NET=y
230
231#
232# Networking options
233#
234CONFIG_PACKET=y
235# CONFIG_PACKET_MMAP is not set
236# CONFIG_NETLINK_DEV is not set
237CONFIG_NETFILTER=y
238# CONFIG_NETFILTER_DEBUG is not set
239CONFIG_UNIX=y
240# CONFIG_NET_KEY is not set
241CONFIG_INET=y
242# CONFIG_IP_MULTICAST is not set
243# CONFIG_IP_ADVANCED_ROUTER is not set
244# CONFIG_IP_PNP is not set
245# CONFIG_NET_IPIP is not set
246# CONFIG_NET_IPGRE is not set
247# CONFIG_ARPD is not set
248# CONFIG_INET_ECN is not set
249# CONFIG_SYN_COOKIES is not set
250# CONFIG_INET_AH is not set
251# CONFIG_INET_ESP is not set
252# CONFIG_INET_IPCOMP is not set
253
254#
255# IP: Netfilter Configuration
256#
257# CONFIG_IP_NF_CONNTRACK is not set
258# CONFIG_IP_NF_QUEUE is not set
259# CONFIG_IP_NF_IPTABLES is not set
260# CONFIG_IP_NF_ARPTABLES is not set
261# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
262# CONFIG_IP_NF_COMPAT_IPFWADM is not set
263# CONFIG_IPV6 is not set
264# CONFIG_XFRM_USER is not set
265
266#
267# SCTP Configuration (EXPERIMENTAL)
268#
269CONFIG_IPV6_SCTP__=y
270# CONFIG_IP_SCTP is not set
271# CONFIG_ATM is not set
272# CONFIG_VLAN_8021Q is not set
273# CONFIG_LLC is not set
274# CONFIG_DECNET is not set
275# CONFIG_BRIDGE is not set
276# CONFIG_X25 is not set
277# CONFIG_LAPB is not set
278# CONFIG_NET_DIVERT is not set
279# CONFIG_ECONET is not set
280# CONFIG_WAN_ROUTER is not set
281# CONFIG_NET_HW_FLOWCONTROL is not set
282
283#
284# QoS and/or fair queueing
285#
286# CONFIG_NET_SCHED is not set
287
288#
289# Network testing
290#
291# CONFIG_NET_PKTGEN is not set
292CONFIG_NETDEVICES=y
293
294#
295# ARCnet devices
296#
297# CONFIG_ARCNET is not set
298# CONFIG_DUMMY is not set
299# CONFIG_BONDING is not set
300# CONFIG_EQUALIZER is not set
301# CONFIG_TUN is not set
302# CONFIG_ETHERTAP is not set
303
304#
305# Ethernet (10 or 100Mbit)
306#
307CONFIG_NET_ETHERNET=y
308# CONFIG_MII is not set
309# CONFIG_OAKNET is not set
310# CONFIG_HAPPYMEAL is not set
311# CONFIG_SUNGEM is not set
312# CONFIG_NET_VENDOR_3COM is not set
313
314#
315# Tulip family network device support
316#
317# CONFIG_NET_TULIP is not set
318# CONFIG_HP100 is not set
319# CONFIG_NET_PCI is not set
320
321#
322# Ethernet (1000 Mbit)
323#
324# CONFIG_ACENIC is not set
325# CONFIG_DL2K is not set
326# CONFIG_E1000 is not set
327# CONFIG_NS83820 is not set
328# CONFIG_HAMACHI is not set
329# CONFIG_YELLOWFIN is not set
330# CONFIG_R8169 is not set
331# CONFIG_SK98LIN is not set
332# CONFIG_TIGON3 is not set
333
334#
335# Ethernet (10000 Mbit)
336#
337# CONFIG_IXGB is not set
338# CONFIG_FDDI is not set
339# CONFIG_HIPPI is not set
340# CONFIG_PPP is not set
341# CONFIG_SLIP is not set
342
343#
344# Wireless LAN (non-hamradio)
345#
346# CONFIG_NET_RADIO is not set
347
348#
349# Token Ring devices (depends on LLC=y)
350#
351# CONFIG_NET_FC is not set
352# CONFIG_RCPCI is not set
353# CONFIG_SHAPER is not set
354
355#
356# Wan interfaces
357#
358# CONFIG_WAN is not set
359
360#
361# Amateur Radio support
362#
363# CONFIG_HAMRADIO is not set
364
365#
366# IrDA (infrared) support
367#
368# CONFIG_IRDA is not set
369
370#
371# ISDN subsystem
372#
373# CONFIG_ISDN_BOOL is not set
374
375#
376# Graphics support
377#
378# CONFIG_FB is not set
379
380#
381# Old CD-ROM drivers (not SCSI, not IDE)
382#
383# CONFIG_CD_NO_IDESCSI is not set
384
385#
386# Input device support
387#
388# CONFIG_INPUT is not set
389
390#
391# Userland interfaces
392#
393
394#
395# Input I/O drivers
396#
397# CONFIG_GAMEPORT is not set
398CONFIG_SOUND_GAMEPORT=y
399# CONFIG_SERIO is not set
400
401#
402# Input Device Drivers
403#
404
405#
406# Macintosh device drivers
407#
408
409#
410# Character devices
411#
412# CONFIG_SERIAL_NONSTANDARD is not set
413
414#
415# Serial drivers
416#
417CONFIG_SERIAL_8250=y
418CONFIG_SERIAL_8250_CONSOLE=y
419# CONFIG_SERIAL_8250_EXTENDED is not set
420
421#
422# Non-8250 serial port support
423#
424CONFIG_SERIAL_CORE=y
425CONFIG_SERIAL_CORE_CONSOLE=y
426CONFIG_UNIX98_PTYS=y
427CONFIG_UNIX98_PTY_COUNT=256
428
429#
430# I2C support
431#
432# CONFIG_I2C is not set
433
434#
435# I2C Hardware Sensors Mainboard support
436#
437
438#
439# I2C Hardware Sensors Chip support
440#
441# CONFIG_I2C_SENSOR is not set
442
443#
444# Mice
445#
446# CONFIG_BUSMOUSE is not set
447# CONFIG_QIC02_TAPE is not set
448
449#
450# IPMI
451#
452# CONFIG_IPMI_HANDLER is not set
453
454#
455# Watchdog Cards
456#
457# CONFIG_WATCHDOG is not set
458# CONFIG_NVRAM is not set
459CONFIG_GEN_RTC=y
460# CONFIG_GEN_RTC_X is not set
461# CONFIG_DTLK is not set
462# CONFIG_R3964 is not set
463# CONFIG_APPLICOM is not set
464
465#
466# Ftape, the floppy tape device driver
467#
468# CONFIG_FTAPE is not set
469# CONFIG_AGP is not set
470# CONFIG_DRM is not set
471# CONFIG_RAW_DRIVER is not set
472# CONFIG_HANGCHECK_TIMER is not set
473
474#
475# Multimedia devices
476#
477# CONFIG_VIDEO_DEV is not set
478
479#
480# Digital Video Broadcasting Devices
481#
482# CONFIG_DVB is not set
483
484#
485# File systems
486#
487CONFIG_EXT2_FS=y
488# CONFIG_EXT2_FS_XATTR is not set
489# CONFIG_EXT3_FS is not set
490# CONFIG_JBD is not set
491# CONFIG_REISERFS_FS is not set
492# CONFIG_JFS_FS is not set
493# CONFIG_XFS_FS is not set
494# CONFIG_MINIX_FS is not set
495# CONFIG_ROMFS_FS is not set
496# CONFIG_QUOTA is not set
497# CONFIG_AUTOFS_FS is not set
498# CONFIG_AUTOFS4_FS is not set
499
500#
501# CD-ROM/DVD Filesystems
502#
503CONFIG_ISO9660_FS=y
504# CONFIG_JOLIET is not set
505# CONFIG_ZISOFS is not set
506# CONFIG_UDF_FS is not set
507
508#
509# DOS/FAT/NT Filesystems
510#
511# CONFIG_FAT_FS is not set
512# CONFIG_NTFS_FS is not set
513
514#
515# Pseudo filesystems
516#
517CONFIG_PROC_FS=y
518CONFIG_DEVFS_FS=y
519# CONFIG_DEVFS_MOUNT is not set
520# CONFIG_DEVFS_DEBUG is not set
521CONFIG_DEVPTS_FS=y
522# CONFIG_DEVPTS_FS_XATTR is not set
523CONFIG_TMPFS=y
524CONFIG_RAMFS=y
525
526#
527# Miscellaneous filesystems
528#
529# CONFIG_ADFS_FS is not set
530# CONFIG_AFFS_FS is not set
531# CONFIG_HFS_FS is not set
532# CONFIG_BEFS_FS is not set
533# CONFIG_BFS_FS is not set
534# CONFIG_EFS_FS is not set
535# CONFIG_CRAMFS is not set
536# CONFIG_VXFS_FS is not set
537# CONFIG_HPFS_FS is not set
538# CONFIG_QNX4FS_FS is not set
539# CONFIG_SYSV_FS is not set
540# CONFIG_UFS_FS is not set
541
542#
543# Network File Systems
544#
545CONFIG_NFS_FS=y
546# CONFIG_NFS_V3 is not set
547# CONFIG_NFS_V4 is not set
548CONFIG_NFSD=y
549# CONFIG_NFSD_V3 is not set
550# CONFIG_NFSD_TCP is not set
551CONFIG_LOCKD=y
552CONFIG_EXPORTFS=y
553CONFIG_SUNRPC=y
554# CONFIG_SUNRPC_GSS is not set
555# CONFIG_SMB_FS is not set
556# CONFIG_CIFS is not set
557# CONFIG_NCP_FS is not set
558# CONFIG_CODA_FS is not set
559# CONFIG_INTERMEZZO_FS is not set
560# CONFIG_AFS_FS is not set
561
562#
563# Partition Types
564#
565CONFIG_PARTITION_ADVANCED=y
566# CONFIG_ACORN_PARTITION is not set
567# CONFIG_OSF_PARTITION is not set
568# CONFIG_AMIGA_PARTITION is not set
569# CONFIG_ATARI_PARTITION is not set
570# CONFIG_MAC_PARTITION is not set
571CONFIG_MSDOS_PARTITION=y
572# CONFIG_BSD_DISKLABEL is not set
573# CONFIG_MINIX_SUBPARTITION is not set
574CONFIG_SOLARIS_X86_PARTITION=y
575# CONFIG_UNIXWARE_DISKLABEL is not set
576# CONFIG_LDM_PARTITION is not set
577# CONFIG_NEC98_PARTITION is not set
578# CONFIG_SGI_PARTITION is not set
579# CONFIG_ULTRIX_PARTITION is not set
580# CONFIG_SUN_PARTITION is not set
581# CONFIG_EFI_PARTITION is not set
582
583#
584# Sound
585#
586# CONFIG_SOUND is not set
587
588#
589# USB support
590#
591# CONFIG_USB is not set
592# CONFIG_USB_GADGET is not set
593
594#
595# Bluetooth support
596#
597# CONFIG_BT is not set
598
599#
600# Library routines
601#
602# CONFIG_CRC32 is not set
603
604#
605# Kernel hacking
606#
607# CONFIG_DEBUG_KERNEL is not set
608# CONFIG_KALLSYMS is not set
609
610#
611# Security options
612#
613# CONFIG_SECURITY is not set
614
615#
616# Cryptographic options
617#
618# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
index 466437f4bcbb..6b4f022111e7 100644
--- a/arch/ppc/kernel/Makefile
+++ b/arch/ppc/kernel/Makefile
@@ -12,7 +12,6 @@ obj-y := entry.o traps.o time.o misc.o \
12 setup.o \ 12 setup.o \
13 ppc_htab.o 13 ppc_htab.o
14obj-$(CONFIG_MODULES) += ppc_ksyms.o 14obj-$(CONFIG_MODULES) += ppc_ksyms.o
15obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o
16obj-$(CONFIG_PCI) += pci.o 15obj-$(CONFIG_PCI) += pci.o
17obj-$(CONFIG_RAPIDIO) += rio.o 16obj-$(CONFIG_RAPIDIO) += rio.o
18obj-$(CONFIG_KGDB) += ppc-stub.o 17obj-$(CONFIG_KGDB) += ppc-stub.o
diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
index 100052aaea9a..c7cb9d5f24a3 100644
--- a/arch/ppc/kernel/head.S
+++ b/arch/ppc/kernel/head.S
@@ -310,12 +310,7 @@ i##n: \
310/* System reset */ 310/* System reset */
311/* core99 pmac starts the seconary here by changing the vector, and 311/* core99 pmac starts the seconary here by changing the vector, and
312 putting it back to what it was (unknown_exception) when done. */ 312 putting it back to what it was (unknown_exception) when done. */
313#if defined(CONFIG_GEMINI) && defined(CONFIG_SMP)
314 . = 0x100
315 b __secondary_start_gemini
316#else
317 EXCEPTION(0x100, Reset, unknown_exception, EXC_XFER_STD) 313 EXCEPTION(0x100, Reset, unknown_exception, EXC_XFER_STD)
318#endif
319 314
320/* Machine check */ 315/* Machine check */
321 . = 0x200 316 . = 0x200
@@ -897,19 +892,6 @@ fix_mem_constants:
897#endif /* CONFIG_APUS */ 892#endif /* CONFIG_APUS */
898 893
899#ifdef CONFIG_SMP 894#ifdef CONFIG_SMP
900#ifdef CONFIG_GEMINI
901 .globl __secondary_start_gemini
902__secondary_start_gemini:
903 mfspr r4,SPRN_HID0
904 ori r4,r4,HID0_ICFI
905 li r3,0
906 ori r3,r3,HID0_ICE
907 andc r4,r4,r3
908 mtspr SPRN_HID0,r4
909 sync
910 b __secondary_start
911#endif /* CONFIG_GEMINI */
912
913 .globl __secondary_start_pmac_0 895 .globl __secondary_start_pmac_0
914__secondary_start_pmac_0: 896__secondary_start_pmac_0:
915 /* NB the entries for cpus 0, 1, 2 must each occupy 8 bytes. */ 897 /* NB the entries for cpus 0, 1, 2 must each occupy 8 bytes. */
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index c8b65ca8a350..1f49503317cb 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -43,6 +43,7 @@
43#include <asm/div64.h> 43#include <asm/div64.h>
44#include <asm/xmon.h> 44#include <asm/xmon.h>
45#include <asm/signal.h> 45#include <asm/signal.h>
46#include <asm/dcr.h>
46 47
47#ifdef CONFIG_8xx 48#ifdef CONFIG_8xx
48#include <asm/commproc.h> 49#include <asm/commproc.h>
diff --git a/arch/ppc/lib/rheap.c b/arch/ppc/lib/rheap.c
index 31e511856dc5..d40700795a9c 100644
--- a/arch/ppc/lib/rheap.c
+++ b/arch/ppc/lib/rheap.c
@@ -14,6 +14,7 @@
14 */ 14 */
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/kernel.h>
17#include <linux/mm.h> 18#include <linux/mm.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19 20
@@ -654,7 +655,7 @@ void rh_dump(rh_info_t * info)
654 int maxnr; 655 int maxnr;
655 int i, nr; 656 int i, nr;
656 657
657 maxnr = sizeof(st) / sizeof(st[0]); 658 maxnr = ARRAY_SIZE(st);
658 659
659 printk(KERN_INFO 660 printk(KERN_INFO
660 "info @0x%p (%d slots empty / %d max)\n", 661 "info @0x%p (%d slots empty / %d max)\n",
diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c
index 354a9408f024..82b06a1ef95d 100644
--- a/arch/ppc/mm/pgtable.c
+++ b/arch/ppc/mm/pgtable.c
@@ -313,11 +313,8 @@ void __init mapin_ram(void)
313 } 313 }
314} 314}
315 315
316/* is x a power of 2? */
317#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
318
319/* is x a power of 4? */ 316/* is x a power of 4? */
320#define is_power_of_4(x) ((x) != 0 && (((x) & (x-1)) == 0) && (ffs(x) & 1)) 317#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1))
321 318
322/* 319/*
323 * Set up a mapping for a block of I/O. 320 * Set up a mapping for a block of I/O.
diff --git a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile
index 90c622294423..e17fad470621 100644
--- a/arch/ppc/platforms/Makefile
+++ b/arch/ppc/platforms/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_TQM8260) += tqm8260_setup.o
13obj-$(CONFIG_CPCI690) += cpci690.o 13obj-$(CONFIG_CPCI690) += cpci690.o
14obj-$(CONFIG_EV64260) += ev64260.o 14obj-$(CONFIG_EV64260) += ev64260.o
15obj-$(CONFIG_CHESTNUT) += chestnut.o 15obj-$(CONFIG_CHESTNUT) += chestnut.o
16obj-$(CONFIG_GEMINI) += gemini_pci.o gemini_setup.o gemini_prom.o
17obj-$(CONFIG_LOPEC) += lopec.o 16obj-$(CONFIG_LOPEC) += lopec.o
18obj-$(CONFIG_KATANA) += katana.o 17obj-$(CONFIG_KATANA) += katana.o
19obj-$(CONFIG_HDPU) += hdpu.o 18obj-$(CONFIG_HDPU) += hdpu.o
diff --git a/arch/ppc/platforms/gemini.h b/arch/ppc/platforms/gemini.h
deleted file mode 100644
index 5528fd0a1216..000000000000
--- a/arch/ppc/platforms/gemini.h
+++ /dev/null
@@ -1,165 +0,0 @@
1/*
2 * Onboard registers and descriptions for Synergy Microsystems'
3 * "Gemini" boards.
4 *
5 */
6#ifdef __KERNEL__
7#ifndef __PPC_GEMINI_H
8#define __PPC_GEMINI_H
9
10/* Registers */
11
12#define GEMINI_SERIAL_B (0xffeffb00)
13#define GEMINI_SERIAL_A (0xffeffb08)
14#define GEMINI_USWITCH (0xffeffd00)
15#define GEMINI_BREV (0xffeffe00)
16#define GEMINI_BECO (0xffeffe08)
17#define GEMINI_FEAT (0xffeffe10)
18#define GEMINI_BSTAT (0xffeffe18)
19#define GEMINI_CPUSTAT (0xffeffe20)
20#define GEMINI_L2CFG (0xffeffe30)
21#define GEMINI_MEMCFG (0xffeffe38)
22#define GEMINI_FLROM (0xffeffe40)
23#define GEMINI_P0PCI (0xffeffe48)
24#define GEMINI_FLWIN (0xffeffe50)
25#define GEMINI_P0INTMASK (0xffeffe60)
26#define GEMINI_P0INTAP (0xffeffe68)
27#define GEMINI_PCIERR (0xffeffe70)
28#define GEMINI_LEDBASE (0xffeffe80)
29#define GEMINI_RTC (0xffe9fff8)
30#define GEMINI_LEDS 8
31#define GEMINI_SWITCHES 8
32
33
34/* Flash ROM bit definitions */
35#define GEMINI_FLS_WEN (1<<0)
36#define GEMINI_FLS_JMP (1<<6)
37#define GEMINI_FLS_BOOT (1<<7)
38
39/* Memory bit definitions */
40#define GEMINI_MEM_TYPE_MASK 0xc0
41#define GEMINI_MEM_SIZE_MASK 0x38
42#define GEMINI_MEM_BANK_MASK 0x07
43
44/* L2 cache bit definitions */
45#define GEMINI_L2_SIZE_MASK 0xc0
46#define GEMINI_L2_RATIO_MASK 0x03
47
48/* Timebase register bit definitons */
49#define GEMINI_TIMEB0_EN (1<<0)
50#define GEMINI_TIMEB1_EN (1<<1)
51#define GEMINI_TIMEB2_EN (1<<2)
52#define GEMINI_TIMEB3_EN (1<<3)
53
54/* CPU status bit definitions */
55#define GEMINI_CPU_ID_MASK 0x03
56#define GEMINI_CPU_COUNT_MASK 0x0c
57#define GEMINI_CPU0_HALTED (1<<4)
58#define GEMINI_CPU1_HALTED (1<<5)
59#define GEMINI_CPU2_HALTED (1<<6)
60#define GEMINI_CPU3_HALTED (1<<7)
61
62/* Board status bit definitions */
63#define GEMINI_BRD_FAIL (1<<0) /* FAIL led is lit */
64#define GEMINI_BRD_BUS_MASK 0x0c /* PowerPC bus speed */
65
66/* Board family/feature bit descriptions */
67#define GEMINI_FEAT_HAS_FLASH (1<<0)
68#define GEMINI_FEAT_HAS_ETH (1<<1)
69#define GEMINI_FEAT_HAS_SCSI (1<<2)
70#define GEMINI_FEAT_HAS_P0 (1<<3)
71#define GEMINI_FEAT_FAM_MASK 0xf0
72
73/* Mod/ECO bit definitions */
74#define GEMINI_ECO_LEVEL_MASK 0x0f
75#define GEMINI_MOD_MASK 0xf0
76
77/* Type/revision bit definitions */
78#define GEMINI_REV_MASK 0x0f
79#define GEMINI_TYPE_MASK 0xf0
80
81/* User switch definitions */
82#define GEMINI_SWITCH_VERBOSE 1 /* adds "debug" to boot cmd line */
83#define GEMINI_SWITCH_SINGLE_USER 7 /* boots into "single-user" mode */
84
85#define SGS_RTC_CONTROL 0
86#define SGS_RTC_SECONDS 1
87#define SGS_RTC_MINUTES 2
88#define SGS_RTC_HOURS 3
89#define SGS_RTC_DAY 4
90#define SGS_RTC_DAY_OF_MONTH 5
91#define SGS_RTC_MONTH 6
92#define SGS_RTC_YEAR 7
93
94#define SGS_RTC_SET 0x80
95#define SGS_RTC_IS_STOPPED 0x80
96
97#define GRACKLE_CONFIG_ADDR_ADDR (0xfec00000)
98#define GRACKLE_CONFIG_DATA_ADDR (0xfee00000)
99
100#define GEMINI_BOOT_INIT (0xfff00100)
101
102#ifndef __ASSEMBLY__
103
104static inline void grackle_write( unsigned long addr, unsigned long data )
105{
106 __asm__ __volatile__(
107 " stwbrx %1, 0, %0\n \
108 sync\n \
109 stwbrx %3, 0, %2\n \
110 sync "
111 : /* no output */
112 : "r" (GRACKLE_CONFIG_ADDR_ADDR), "r" (addr),
113 "r" (GRACKLE_CONFIG_DATA_ADDR), "r" (data));
114}
115
116static inline unsigned long grackle_read( unsigned long addr )
117{
118 unsigned long val;
119
120 __asm__ __volatile__(
121 " stwbrx %1, 0, %2\n \
122 sync\n \
123 lwbrx %0, 0, %3\n \
124 sync "
125 : "=r" (val)
126 : "r" (addr), "r" (GRACKLE_CONFIG_ADDR_ADDR),
127 "r" (GRACKLE_CONFIG_DATA_ADDR));
128
129 return val;
130}
131
132static inline void gemini_led_on( int led )
133{
134 if (led >= 0 && led < GEMINI_LEDS)
135 *(unsigned char *)(GEMINI_LEDBASE + (led<<3)) = 1;
136}
137
138static inline void gemini_led_off(int led)
139{
140 if (led >= 0 && led < GEMINI_LEDS)
141 *(unsigned char *)(GEMINI_LEDBASE + (led<<3)) = 0;
142}
143
144static inline int gemini_led_val(int led)
145{
146 int val = 0;
147 if (led >= 0 && led < GEMINI_LEDS)
148 val = *(unsigned char *)(GEMINI_LEDBASE + (led<<3));
149 return (val & 0x1);
150}
151
152/* returns processor id from the board */
153static inline int gemini_processor(void)
154{
155 unsigned char cpu = *(unsigned char *)(GEMINI_CPUSTAT);
156 return (int) ((cpu == 0) ? 4 : (cpu & GEMINI_CPU_ID_MASK));
157}
158
159
160extern void _gemini_reboot(void);
161extern void gemini_prom_init(void);
162extern void gemini_init_l2(void);
163#endif /* __ASSEMBLY__ */
164#endif
165#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/gemini_pci.c b/arch/ppc/platforms/gemini_pci.c
deleted file mode 100644
index 95656091ba2b..000000000000
--- a/arch/ppc/platforms/gemini_pci.c
+++ /dev/null
@@ -1,41 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/pci.h>
4#include <linux/slab.h>
5
6#include <asm/machdep.h>
7#include <platforms/gemini.h>
8#include <asm/byteorder.h>
9#include <asm/io.h>
10#include <asm/uaccess.h>
11#include <asm/pci-bridge.h>
12
13void __init gemini_pcibios_fixup(void)
14{
15 int i;
16 struct pci_dev *dev = NULL;
17
18 for_each_pci_dev(dev) {
19 for(i = 0; i < 6; i++) {
20 if (dev->resource[i].flags & IORESOURCE_IO) {
21 dev->resource[i].start |= (0xfe << 24);
22 dev->resource[i].end |= (0xfe << 24);
23 }
24 }
25 }
26}
27
28
29/* The "bootloader" for Synergy boards does none of this for us, so we need to
30 lay it all out ourselves... --Dan */
31void __init gemini_find_bridges(void)
32{
33 struct pci_controller* hose;
34
35 ppc_md.pcibios_fixup = gemini_pcibios_fixup;
36
37 hose = pcibios_alloc_controller();
38 if (!hose)
39 return;
40 setup_indirect_pci(hose, 0xfec00000, 0xfee00000);
41}
diff --git a/arch/ppc/platforms/gemini_prom.S b/arch/ppc/platforms/gemini_prom.S
deleted file mode 100644
index e8c84d24f01f..000000000000
--- a/arch/ppc/platforms/gemini_prom.S
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Not really prom support code (yet), but sort of anti-prom code. The current
3 * bootloader does a number of things it shouldn't and doesn't do things that it
4 * should. The stuff in here is mainly a hodge-podge collection of setup code
5 * to get the board up and running.
6 * ---Dan
7 */
8
9#include <asm/reg.h>
10#include <asm/page.h>
11#include <platforms/gemini.h>
12#include <asm/ppc_asm.h>
13
14/*
15 * On 750's the MMU is on when Linux is booted, so we need to clear out the
16 * bootloader's BAT settings, make sure we're in supervisor state (gotcha!),
17 * and turn off the MMU.
18 *
19 */
20
21_GLOBAL(gemini_prom_init)
22#ifdef CONFIG_SMP
23 /* Since the MMU's on, get stuff in rom space that we'll need */
24 lis r4,GEMINI_CPUSTAT@h
25 ori r4,r4,GEMINI_CPUSTAT@l
26 lbz r5,0(r4)
27 andi. r5,r5,3
28 mr r24,r5 /* cpu # used later on */
29#endif
30 mfmsr r4
31 li r3,MSR_PR /* ensure supervisor! */
32 ori r3,r3,MSR_IR|MSR_DR
33 andc r4,r4,r3
34 mtmsr r4
35 isync
36#if 0
37 /* zero out the bats now that the MMU is off */
38prom_no_mmu:
39 li r3,0
40 mtspr SPRN_IBAT0U,r3
41 mtspr SPRN_IBAT0L,r3
42 mtspr SPRN_IBAT1U,r3
43 mtspr SPRN_IBAT1L,r3
44 mtspr SPRN_IBAT2U,r3
45 mtspr SPRN_IBAT2L,r3
46 mtspr SPRN_IBAT3U,r3
47 mtspr SPRN_IBAT3L,r3
48
49 mtspr SPRN_DBAT0U,r3
50 mtspr SPRN_DBAT0L,r3
51 mtspr SPRN_DBAT1U,r3
52 mtspr SPRN_DBAT1L,r3
53 mtspr SPRN_DBAT2U,r3
54 mtspr SPRN_DBAT2L,r3
55 mtspr SPRN_DBAT3U,r3
56 mtspr SPRN_DBAT3L,r3
57#endif
58
59 /* the bootloader (as far as I'm currently aware) doesn't mess with page
60 tables, but since we're already here, might as well zap these, too */
61 li r4,0
62 mtspr SPRN_SDR1,r4
63
64 li r4,16
65 mtctr r4
66 li r3,0
67 li r4,0
683: mtsrin r3,r4
69 addi r3,r3,1
70 bdnz 3b
71
72#ifdef CONFIG_SMP
73 /* The 750 book (and Mot/IBM support) says that this will "assist" snooping
74 when in SMP. Not sure yet whether this should stay or leave... */
75 mfspr r4,SPRN_HID0
76 ori r4,r4,HID0_ABE
77 mtspr SPRN_HID0,r4
78 sync
79#endif /* CONFIG_SMP */
80 blr
81
82/* apparently, SMon doesn't pay attention to HID0[SRST]. Disable the MMU and
83 branch to 0xfff00100 */
84_GLOBAL(_gemini_reboot)
85 lis r5,GEMINI_BOOT_INIT@h
86 ori r5,r5,GEMINI_BOOT_INIT@l
87 li r6,MSR_IP
88 mtspr SPRN_SRR0,r5
89 mtspr SPRN_SRR1,r6
90 rfi
diff --git a/arch/ppc/platforms/gemini_serial.h b/arch/ppc/platforms/gemini_serial.h
deleted file mode 100644
index b915eff79fdb..000000000000
--- a/arch/ppc/platforms/gemini_serial.h
+++ /dev/null
@@ -1,40 +0,0 @@
1#ifdef __KERNEL__
2#ifndef __ASMPPC_GEMINI_SERIAL_H
3#define __ASMPPC_GEMINI_SERIAL_H
4
5#include <platforms/gemini.h>
6
7#ifdef CONFIG_SERIAL_MANY_PORTS
8#define RS_TABLE_SIZE 64
9#else
10#define RS_TABLE_SIZE 4
11#endif
12
13/* Rate for the 24.576 Mhz clock for the onboard serial chip */
14#define BASE_BAUD (24576000 / 16)
15
16#ifdef CONFIG_SERIAL_DETECT_IRQ
17#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
18#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
19#else
20#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
21#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF)
22#endif
23
24#define STD_SERIAL_PORT_DEFNS \
25 { 0, BASE_BAUD, GEMINI_SERIAL_A, 15, STD_COM_FLAGS }, /* ttyS0 */ \
26 { 0, BASE_BAUD, GEMINI_SERIAL_B, 14, STD_COM_FLAGS }, /* ttyS1 */ \
27
28#ifdef CONFIG_GEMINI_PU32
29#define PU32_SERIAL_PORT_DEFNS \
30 { 0, BASE_BAUD, NULL, 0, STD_COM_FLAGS },
31#else
32#define PU32_SERIAL_PORT_DEFNS
33#endif
34
35#define SERIAL_PORT_DFNS \
36 STD_SERIAL_PORT_DEFNS \
37 PU32_SERIAL_PORT_DEFNS
38
39#endif
40#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/gemini_setup.c b/arch/ppc/platforms/gemini_setup.c
deleted file mode 100644
index f48048f362a8..000000000000
--- a/arch/ppc/platforms/gemini_setup.c
+++ /dev/null
@@ -1,577 +0,0 @@
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 * Adapted from 'alpha' version by Gary Thomas
4 * Modified by Cort Dougan (cort@cs.nmt.edu)
5 * Synergy Microsystems board support by Dan Cox (dan@synergymicro.com)
6 *
7 */
8
9#include <linux/stddef.h>
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/errno.h>
13#include <linux/reboot.h>
14#include <linux/pci.h>
15#include <linux/time.h>
16#include <linux/kdev_t.h>
17#include <linux/types.h>
18#include <linux/major.h>
19#include <linux/initrd.h>
20#include <linux/console.h>
21#include <linux/seq_file.h>
22#include <linux/root_dev.h>
23#include <linux/bcd.h>
24
25#include <asm/system.h>
26#include <asm/pgtable.h>
27#include <asm/page.h>
28#include <asm/dma.h>
29#include <asm/io.h>
30#include <asm/m48t35.h>
31#include <platforms/gemini.h>
32#include <asm/time.h>
33#include <asm/open_pic.h>
34#include <asm/bootinfo.h>
35#include <asm/machdep.h>
36
37void gemini_find_bridges(void);
38static int gemini_get_clock_speed(void);
39extern void gemini_pcibios_fixup(void);
40
41static char *gemini_board_families[] = {
42 "VGM", "VSS", "KGM", "VGR", "VCM", "VCS", "KCM", "VCR"
43};
44static int gemini_board_count = sizeof(gemini_board_families) /
45 sizeof(gemini_board_families[0]);
46
47static unsigned int cpu_7xx[16] = {
48 0, 15, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
49};
50static unsigned int cpu_6xx[16] = {
51 0, 0, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 0, 12, 7, 0
52};
53
54/*
55 * prom_init is the Gemini version of prom.c:prom_init. We only need
56 * the BSS clearing code, so I copied that out of prom.c. This is a
57 * lot simpler than hacking prom.c so it will build with Gemini. -VAL
58 */
59
60#define PTRRELOC(x) ((typeof(x))((unsigned long)(x) + offset))
61
62unsigned long
63prom_init(void)
64{
65 unsigned long offset = reloc_offset();
66 unsigned long phys;
67 extern char __bss_start, _end;
68
69 /* First zero the BSS -- use memset, some arches don't have
70 * caches on yet */
71 memset_io(PTRRELOC(&__bss_start),0 , &_end - &__bss_start);
72
73 /* Default */
74 phys = offset + KERNELBASE;
75
76 gemini_prom_init();
77
78 return phys;
79}
80
81int
82gemini_show_cpuinfo(struct seq_file *m)
83{
84 unsigned char reg, rev;
85 char *family;
86 unsigned int type;
87
88 reg = readb(GEMINI_FEAT);
89 family = gemini_board_families[((reg>>4) & 0xf)];
90 if (((reg>>4) & 0xf) > gemini_board_count)
91 printk(KERN_ERR "cpuinfo(): unable to determine board family\n");
92
93 reg = readb(GEMINI_BREV);
94 type = (reg>>4) & 0xf;
95 rev = reg & 0xf;
96
97 reg = readb(GEMINI_BECO);
98
99 seq_printf(m, "machine\t\t: Gemini %s%d, rev %c, eco %d\n",
100 family, type, (rev + 'A'), (reg & 0xf));
101
102 seq_printf(m, "board\t\t: Gemini %s", family);
103 if (type > 9)
104 seq_printf(m, "%c", (type - 10) + 'A');
105 else
106 seq_printf(m, "%d", type);
107
108 seq_printf(m, ", rev %c, eco %d\n", (rev + 'A'), (reg & 0xf));
109
110 seq_printf(m, "clock\t\t: %dMhz\n", gemini_get_clock_speed());
111
112 return 0;
113}
114
115static u_char gemini_openpic_initsenses[] = {
116 1,
117 1,
118 1,
119 1,
120 0,
121 0,
122 1, /* remainder are level-triggered */
123};
124
125#define GEMINI_MPIC_ADDR (0xfcfc0000)
126#define GEMINI_MPIC_PCI_CFG (0x80005800)
127
128void __init gemini_openpic_init(void)
129{
130
131 OpenPIC_Addr = (volatile struct OpenPIC *)
132 grackle_read(GEMINI_MPIC_PCI_CFG + 0x10);
133 OpenPIC_InitSenses = gemini_openpic_initsenses;
134 OpenPIC_NumInitSenses = sizeof( gemini_openpic_initsenses );
135
136 ioremap( GEMINI_MPIC_ADDR, OPENPIC_SIZE);
137}
138
139
140extern unsigned long loops_per_jiffy;
141extern int root_mountflags;
142extern char cmd_line[];
143
144void
145gemini_heartbeat(void)
146{
147 static unsigned long led = GEMINI_LEDBASE+(4*8);
148 static char direction = 8;
149
150
151 /* We only want to do this on 1 CPU */
152 if (smp_processor_id())
153 return;
154 *(char *)led = 0;
155 if ( (led + direction) > (GEMINI_LEDBASE+(7*8)) ||
156 (led + direction) < (GEMINI_LEDBASE+(4*8)) )
157 direction *= -1;
158 led += direction;
159 *(char *)led = 0xff;
160 ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
161}
162
163void __init gemini_setup_arch(void)
164{
165 extern char cmd_line[];
166
167
168 loops_per_jiffy = 50000000/HZ;
169
170#ifdef CONFIG_BLK_DEV_INITRD
171 /* bootable off CDROM */
172 if (initrd_start)
173 ROOT_DEV = Root_SR0;
174 else
175#endif
176 ROOT_DEV = Root_SDA1;
177
178 /* nothing but serial consoles... */
179 sprintf(cmd_line, "%s console=ttyS0", cmd_line);
180
181 printk("Boot arguments: %s\n", cmd_line);
182
183 ppc_md.heartbeat = gemini_heartbeat;
184 ppc_md.heartbeat_reset = HZ/8;
185 ppc_md.heartbeat_count = 1;
186
187 /* Lookup PCI hosts */
188 gemini_find_bridges();
189 /* take special pains to map the MPIC, since it isn't mapped yet */
190 gemini_openpic_init();
191 /* start the L2 */
192 gemini_init_l2();
193}
194
195
196int
197gemini_get_clock_speed(void)
198{
199 unsigned long hid1, pvr;
200 int clock;
201
202 pvr = mfspr(SPRN_PVR);
203 hid1 = (mfspr(SPRN_HID1) >> 28) & 0xf;
204 if (PVR_VER(pvr) == 8 ||
205 PVR_VER(pvr) == 12)
206 hid1 = cpu_7xx[hid1];
207 else
208 hid1 = cpu_6xx[hid1];
209
210 switch((readb(GEMINI_BSTAT) & 0xc) >> 2) {
211
212 case 0:
213 default:
214 clock = (hid1*100)/3;
215 break;
216
217 case 1:
218 clock = (hid1*125)/3;
219 break;
220
221 case 2:
222 clock = (hid1*50);
223 break;
224 }
225
226 return clock;
227}
228
229void __init gemini_init_l2(void)
230{
231 unsigned char reg, brev, fam, creg;
232 unsigned long cache;
233 unsigned long pvr;
234
235 reg = readb(GEMINI_L2CFG);
236 brev = readb(GEMINI_BREV);
237 fam = readb(GEMINI_FEAT);
238 pvr = mfspr(SPRN_PVR);
239
240 switch(PVR_VER(pvr)) {
241
242 case 8:
243 if (reg & 0xc0)
244 cache = (((reg >> 6) & 0x3) << 28);
245 else
246 cache = 0x3 << 28;
247
248#ifdef CONFIG_SMP
249 /* Pre-3.0 processor revs had snooping errata. Leave
250 their L2's disabled with SMP. -- Dan */
251 if (PVR_CFG(pvr) < 3) {
252 printk("Pre-3.0 750; L2 left disabled!\n");
253 return;
254 }
255#endif /* CONFIG_SMP */
256
257 /* Special case: VGM5-B's came before L2 ratios were set on
258 the board. Processor speed shouldn't be too high, so
259 set L2 ratio to 1:1.5. */
260 if ((brev == 0x51) && ((fam & 0xa0) >> 4) == 0)
261 reg |= 1;
262
263 /* determine best cache ratio based upon what the board
264 tells us (which sometimes _may_ not be true) and
265 the processor speed. */
266 else {
267 if (gemini_get_clock_speed() > 250)
268 reg = 2;
269 }
270 break;
271 case 12:
272 {
273 static unsigned long l2_size_val = 0;
274
275 if (!l2_size_val)
276 l2_size_val = _get_L2CR();
277 cache = l2_size_val;
278 break;
279 }
280 case 4:
281 case 9:
282 creg = readb(GEMINI_CPUSTAT);
283 if (((creg & 0xc) >> 2) != 1)
284 printk("Dual-604 boards don't support the use of L2\n");
285 else
286 writeb(1, GEMINI_L2CFG);
287 return;
288 default:
289 printk("Unknown processor; L2 left disabled\n");
290 return;
291 }
292
293 cache |= ((1<<reg) << 25);
294 cache |= (L2CR_L2RAM_MASK|L2CR_L2CTL|L2CR_L2DO);
295 _set_L2CR(0);
296 _set_L2CR(cache | L2CR_L2E);
297
298}
299
300void
301gemini_restart(char *cmd)
302{
303 local_irq_disable();
304 /* make a clean restart, not via the MPIC */
305 _gemini_reboot();
306 for(;;);
307}
308
309void
310gemini_power_off(void)
311{
312 for(;;);
313}
314
315void
316gemini_halt(void)
317{
318 gemini_restart(NULL);
319}
320
321void __init gemini_init_IRQ(void)
322{
323 /* gemini has no 8259 */
324 openpic_init(1, 0, 0, -1);
325}
326
327#define gemini_rtc_read(x) (readb(GEMINI_RTC+(x)))
328#define gemini_rtc_write(val,x) (writeb((val),(GEMINI_RTC+(x))))
329
330/* ensure that the RTC is up and running */
331long __init gemini_time_init(void)
332{
333 unsigned char reg;
334
335 reg = gemini_rtc_read(M48T35_RTC_CONTROL);
336
337 if ( reg & M48T35_RTC_STOPPED ) {
338 printk(KERN_INFO "M48T35 real-time-clock was stopped. Now starting...\n");
339 gemini_rtc_write((reg & ~(M48T35_RTC_STOPPED)), M48T35_RTC_CONTROL);
340 gemini_rtc_write((reg | M48T35_RTC_SET), M48T35_RTC_CONTROL);
341 }
342 return 0;
343}
344
345#undef DEBUG_RTC
346
347unsigned long
348gemini_get_rtc_time(void)
349{
350 unsigned int year, mon, day, hour, min, sec;
351 unsigned char reg;
352
353 reg = gemini_rtc_read(M48T35_RTC_CONTROL);
354 gemini_rtc_write((reg|M48T35_RTC_READ), M48T35_RTC_CONTROL);
355#ifdef DEBUG_RTC
356 printk("get rtc: reg = %x\n", reg);
357#endif
358
359 do {
360 sec = gemini_rtc_read(M48T35_RTC_SECONDS);
361 min = gemini_rtc_read(M48T35_RTC_MINUTES);
362 hour = gemini_rtc_read(M48T35_RTC_HOURS);
363 day = gemini_rtc_read(M48T35_RTC_DOM);
364 mon = gemini_rtc_read(M48T35_RTC_MONTH);
365 year = gemini_rtc_read(M48T35_RTC_YEAR);
366 } while( sec != gemini_rtc_read(M48T35_RTC_SECONDS));
367#ifdef DEBUG_RTC
368 printk("get rtc: sec=%x, min=%x, hour=%x, day=%x, mon=%x, year=%x\n",
369 sec, min, hour, day, mon, year);
370#endif
371
372 gemini_rtc_write(reg, M48T35_RTC_CONTROL);
373
374 BCD_TO_BIN(sec);
375 BCD_TO_BIN(min);
376 BCD_TO_BIN(hour);
377 BCD_TO_BIN(day);
378 BCD_TO_BIN(mon);
379 BCD_TO_BIN(year);
380
381 if ((year += 1900) < 1970)
382 year += 100;
383#ifdef DEBUG_RTC
384 printk("get rtc: sec=%x, min=%x, hour=%x, day=%x, mon=%x, year=%x\n",
385 sec, min, hour, day, mon, year);
386#endif
387
388 return mktime( year, mon, day, hour, min, sec );
389}
390
391
392int
393gemini_set_rtc_time( unsigned long now )
394{
395 unsigned char reg;
396 struct rtc_time tm;
397
398 to_tm( now, &tm );
399
400 reg = gemini_rtc_read(M48T35_RTC_CONTROL);
401#ifdef DEBUG_RTC
402 printk("set rtc: reg = %x\n", reg);
403#endif
404
405 gemini_rtc_write((reg|M48T35_RTC_SET), M48T35_RTC_CONTROL);
406#ifdef DEBUG_RTC
407 printk("set rtc: tm vals - sec=%x, min=%x, hour=%x, mon=%x, mday=%x, year=%x\n",
408 tm.tm_sec, tm.tm_min, tm.tm_hour, tm.tm_mon, tm.tm_mday, tm.tm_year);
409#endif
410
411 tm.tm_year -= 1900;
412 BIN_TO_BCD(tm.tm_sec);
413 BIN_TO_BCD(tm.tm_min);
414 BIN_TO_BCD(tm.tm_hour);
415 BIN_TO_BCD(tm.tm_mon);
416 BIN_TO_BCD(tm.tm_mday);
417 BIN_TO_BCD(tm.tm_year);
418#ifdef DEBUG_RTC
419 printk("set rtc: tm vals - sec=%x, min=%x, hour=%x, mon=%x, mday=%x, year=%x\n",
420 tm.tm_sec, tm.tm_min, tm.tm_hour, tm.tm_mon, tm.tm_mday, tm.tm_year);
421#endif
422
423 gemini_rtc_write(tm.tm_sec, M48T35_RTC_SECONDS);
424 gemini_rtc_write(tm.tm_min, M48T35_RTC_MINUTES);
425 gemini_rtc_write(tm.tm_hour, M48T35_RTC_HOURS);
426 gemini_rtc_write(tm.tm_mday, M48T35_RTC_DOM);
427 gemini_rtc_write(tm.tm_mon, M48T35_RTC_MONTH);
428 gemini_rtc_write(tm.tm_year, M48T35_RTC_YEAR);
429
430 /* done writing */
431 gemini_rtc_write(reg, M48T35_RTC_CONTROL);
432
433 return 0;
434}
435
436/* use the RTC to determine the decrementer count */
437void __init gemini_calibrate_decr(void)
438{
439 int freq, divisor;
440 unsigned char reg;
441
442 /* determine processor bus speed */
443 reg = readb(GEMINI_BSTAT);
444
445 switch(((reg & 0x0c)>>2)&0x3) {
446 case 0:
447 default:
448 freq = 66667;
449 break;
450 case 1:
451 freq = 83000;
452 break;
453 case 2:
454 freq = 100000;
455 break;
456 }
457
458 freq *= 1000;
459 divisor = 4;
460 tb_ticks_per_jiffy = freq / HZ / divisor;
461 tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000);
462}
463
464unsigned long __init gemini_find_end_of_memory(void)
465{
466 unsigned long total;
467 unsigned char reg;
468
469 reg = readb(GEMINI_MEMCFG);
470 total = ((1<<((reg & 0x7) - 1)) *
471 (8<<((reg >> 3) & 0x7)));
472 total *= (1024*1024);
473 return total;
474}
475
476static void __init
477gemini_map_io(void)
478{
479 io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO);
480 io_block_mapping(0x80000000, 0x80000000, 0x10000000, _PAGE_IO);
481}
482
483#ifdef CONFIG_SMP
484static int
485smp_gemini_probe(void)
486{
487 int i, nr;
488
489 nr = (readb(GEMINI_CPUSTAT) & GEMINI_CPU_COUNT_MASK) >> 2;
490 if (nr == 0)
491 nr = 4;
492
493 if (nr > 1) {
494 openpic_request_IPIs();
495 for (i = 1; i < nr; ++i)
496 smp_hw_index[i] = i;
497 }
498
499 return nr;
500}
501
502static void
503smp_gemini_kick_cpu(int nr)
504{
505 openpic_reset_processor_phys(1 << nr);
506 openpic_reset_processor_phys(0);
507}
508
509static void
510smp_gemini_setup_cpu(int cpu_nr)
511{
512 if (OpenPIC_Addr)
513 do_openpic_setup_cpu();
514 if (cpu_nr > 0)
515 gemini_init_l2();
516}
517
518static struct smp_ops_t gemini_smp_ops = {
519 smp_openpic_message_pass,
520 smp_gemini_probe,
521 smp_gemini_kick_cpu,
522 smp_gemini_setup_cpu,
523 .give_timebase = smp_generic_give_timebase,
524 .take_timebase = smp_generic_take_timebase,
525};
526#endif /* CONFIG_SMP */
527
528void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
529 unsigned long r6, unsigned long r7)
530{
531 int i;
532
533 /* Restore BATs for now */
534 mtspr(SPRN_DBAT3U, 0xf0001fff);
535 mtspr(SPRN_DBAT3L, 0xf000002a);
536
537 parse_bootinfo(find_bootinfo());
538
539 for(i = 0; i < GEMINI_LEDS; i++)
540 gemini_led_off(i);
541
542 ISA_DMA_THRESHOLD = 0;
543 DMA_MODE_READ = 0;
544 DMA_MODE_WRITE = 0;
545
546#ifdef CONFIG_BLK_DEV_INITRD
547 if ( r4 )
548 {
549 initrd_start = r4 + KERNELBASE;
550 initrd_end = r5 + KERNELBASE;
551 }
552#endif
553
554 ppc_md.setup_arch = gemini_setup_arch;
555 ppc_md.show_cpuinfo = gemini_show_cpuinfo;
556 ppc_md.init_IRQ = gemini_init_IRQ;
557 ppc_md.get_irq = openpic_get_irq;
558 ppc_md.init = NULL;
559
560 ppc_md.restart = gemini_restart;
561 ppc_md.power_off = gemini_power_off;
562 ppc_md.halt = gemini_halt;
563
564 ppc_md.time_init = gemini_time_init;
565 ppc_md.set_rtc_time = gemini_set_rtc_time;
566 ppc_md.get_rtc_time = gemini_get_rtc_time;
567 ppc_md.calibrate_decr = gemini_calibrate_decr;
568
569 ppc_md.find_end_of_memory = gemini_find_end_of_memory;
570 ppc_md.setup_io_mappings = gemini_map_io;
571
572 ppc_md.pcibios_fixup_bus = gemini_pcibios_fixup;
573
574#ifdef CONFIG_SMP
575 smp_ops = &gemini_smp_ops;
576#endif /* CONFIG_SMP */
577}
diff --git a/arch/ppc/platforms/mpc866ads_setup.c b/arch/ppc/platforms/mpc866ads_setup.c
index 8a0c07eb4449..5b05d4bd0df7 100644
--- a/arch/ppc/platforms/mpc866ads_setup.c
+++ b/arch/ppc/platforms/mpc866ads_setup.c
@@ -369,7 +369,7 @@ int __init mpc866ads_init(void)
369 ppc_sys_device_setfunc(MPC8xx_CPM_SMC1, PPC_SYS_FUNC_UART); 369 ppc_sys_device_setfunc(MPC8xx_CPM_SMC1, PPC_SYS_FUNC_UART);
370#endif 370#endif
371 371
372#ifdef CONFIG_SERIAL_CPM_SMC 372#ifdef CONFIG_SERIAL_CPM_SMC2
373 ppc_sys_device_enable(MPC8xx_CPM_SMC2); 373 ppc_sys_device_enable(MPC8xx_CPM_SMC2);
374 ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART); 374 ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART);
375#endif 375#endif
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
index dca23f2ef851..d84f04666972 100644
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_EBONY) += pci_auto.o todc_time.o
45obj-$(CONFIG_EV64260) += todc_time.o pci_auto.o 45obj-$(CONFIG_EV64260) += todc_time.o pci_auto.o
46obj-$(CONFIG_EV64360) += todc_time.o 46obj-$(CONFIG_EV64360) += todc_time.o
47obj-$(CONFIG_CHESTNUT) += mv64360_pic.o pci_auto.o 47obj-$(CONFIG_CHESTNUT) += mv64360_pic.o pci_auto.o
48obj-$(CONFIG_GEMINI) += open_pic.o
49obj-$(CONFIG_GT64260) += gt64260_pic.o 48obj-$(CONFIG_GT64260) += gt64260_pic.o
50obj-$(CONFIG_LOPEC) += pci_auto.o todc_time.o 49obj-$(CONFIG_LOPEC) += pci_auto.o todc_time.o
51obj-$(CONFIG_HDPU) += pci_auto.o 50obj-$(CONFIG_HDPU) += pci_auto.o
diff --git a/arch/ppc/syslib/m8260_pci_erratum9.c b/arch/ppc/syslib/m8260_pci_erratum9.c
index 5475709ce07b..ebb8c8f8f30c 100644
--- a/arch/ppc/syslib/m8260_pci_erratum9.c
+++ b/arch/ppc/syslib/m8260_pci_erratum9.c
@@ -105,7 +105,8 @@ void idma_pci9_init(void)
105 idma_reg[IDMA_CHAN].idmr = 0; /* mask all IDMA interrupts */ 105 idma_reg[IDMA_CHAN].idmr = 0; /* mask all IDMA interrupts */
106 idma_reg[IDMA_CHAN].idsr = 0xff; /* clear all event flags */ 106 idma_reg[IDMA_CHAN].idsr = 0xff; /* clear all event flags */
107 107
108 printk("<4>Using IDMA%d for MPC8260 device erratum PCI 9 workaround\n", 108 printk(KERN_WARNING
109 "Using IDMA%d for MPC8260 device erratum PCI 9 workaround\n",
109 IDMA_CHAN + 1); 110 IDMA_CHAN + 1);
110 111
111 return; 112 return;
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
index d8d299bd1a12..01e48d88f22d 100644
--- a/arch/ppc/syslib/m8xx_setup.c
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -77,7 +77,7 @@ static struct mtd_partition mpc8xxads_partitions[] = {
77 } 77 }
78}; 78};
79 79
80#define mpc8xxads_part_num (sizeof (mpc8xxads_partitions) / sizeof (mpc8xxads_partitions[0])) 80#define mpc8xxads_part_num ARRAY_SIZE(mpc8xxads_partitions)
81 81
82#endif 82#endif
83 83
diff --git a/arch/ppc/syslib/ppc85xx_rio.c b/arch/ppc/syslib/ppc85xx_rio.c
index 05b0e9415085..2b097800cdd9 100644
--- a/arch/ppc/syslib/ppc85xx_rio.c
+++ b/arch/ppc/syslib/ppc85xx_rio.c
@@ -59,8 +59,6 @@
59#define DBELL_TID(x) (*(u8 *)(x + DOORBELL_TID_OFFSET)) 59#define DBELL_TID(x) (*(u8 *)(x + DOORBELL_TID_OFFSET))
60#define DBELL_INF(x) (*(u16 *)(x + DOORBELL_INFO_OFFSET)) 60#define DBELL_INF(x) (*(u16 *)(x + DOORBELL_INFO_OFFSET))
61 61
62#define is_power_of_2(x) (((x) & ((x) - 1)) == 0)
63
64struct rio_atmu_regs { 62struct rio_atmu_regs {
65 u32 rowtar; 63 u32 rowtar;
66 u32 pad1; 64 u32 pad1;
diff --git a/arch/ppc/xmon/ppc-opc.c b/arch/ppc/xmon/ppc-opc.c
index 533a6c9973d4..034313cef6e7 100644
--- a/arch/ppc/xmon/ppc-opc.c
+++ b/arch/ppc/xmon/ppc-opc.c
@@ -19,6 +19,7 @@ along with this file; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 20
21#include <linux/posix_types.h> 21#include <linux/posix_types.h>
22#include <linux/kernel.h>
22#include "ansidecl.h" 23#include "ansidecl.h"
23#include "ppc.h" 24#include "ppc.h"
24 25
@@ -2669,8 +2670,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2669 2670
2670}; 2671};
2671 2672
2672const int powerpc_num_opcodes = 2673const int powerpc_num_opcodes = ARRAY_SIZE(powerpc_opcodes);
2673 sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]);
2674 2674
2675/* The macro table. This is only used by the assembler. */ 2675/* The macro table. This is only used by the assembler. */
2676 2676
@@ -2717,5 +2717,4 @@ const struct powerpc_macro powerpc_macros[] = {
2717 2717
2718}; 2718};
2719 2719
2720const int powerpc_num_macros = 2720const int powerpc_num_macros = ARRAY_SIZE(powerpc_macros);
2721 sizeof (powerpc_macros) / sizeof (powerpc_macros[0]);
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
index d74a883e5bde..8f0b953179fa 100644
--- a/arch/ppc/xmon/start.c
+++ b/arch/ppc/xmon/start.c
@@ -58,10 +58,7 @@ static struct sysrq_key_op sysrq_xmon_op =
58void 58void
59xmon_map_scc(void) 59xmon_map_scc(void)
60{ 60{
61#if defined(CONFIG_GEMINI) 61#if defined(CONFIG_405GP)
62 /* should already be mapped by the kernel boot */
63 sccd = (volatile unsigned char *) 0xffeffb08;
64#elif defined(CONFIG_405GP)
65 sccd = (volatile unsigned char *)0xef600300; 62 sccd = (volatile unsigned char *)0xef600300;
66#elif defined(CONFIG_440EP) 63#elif defined(CONFIG_440EP)
67 sccd = (volatile unsigned char *) ioremap(PPC440EP_UART0_ADDR, 8); 64 sccd = (volatile unsigned char *) ioremap(PPC440EP_UART0_ADDR, 8);
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 12272361c018..eaed402ad346 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -34,10 +34,6 @@ config GENERIC_HWEIGHT
34 bool 34 bool
35 default y 35 default y
36 36
37config GENERIC_CALIBRATE_DELAY
38 bool
39 default y
40
41config GENERIC_TIME 37config GENERIC_TIME
42 def_bool y 38 def_bool y
43 39
@@ -134,6 +130,31 @@ config AUDIT_ARCH
134 bool 130 bool
135 default y 131 default y
136 132
133config S390_SWITCH_AMODE
134 bool "Switch kernel/user addressing modes"
135 help
136 This option allows to switch the addressing modes of kernel and user
137 space. The kernel parameter switch_amode=on will enable this feature,
138 default is disabled. Enabling this (via kernel parameter) on machines
139 earlier than IBM System z9-109 EC/BC will reduce system performance.
140
141 Note that this option will also be selected by selecting the execute
142 protection option below. Enabling the execute protection via the
143 noexec kernel parameter will also switch the addressing modes,
144 independent of the switch_amode kernel parameter.
145
146
147config S390_EXEC_PROTECT
148 bool "Data execute protection"
149 select S390_SWITCH_AMODE
150 help
151 This option allows to enable a buffer overflow protection for user
152 space programs and it also selects the addressing mode option above.
153 The kernel parameter noexec=on will enable this feature and also
154 switch the addressing modes, default is disabled. Enabling this (via
155 kernel parameter) on machines earlier than IBM System z9-109 EC/BC
156 will reduce system performance.
157
137comment "Code generation options" 158comment "Code generation options"
138 159
139choice 160choice
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index b8c237290263..c9da7d16145e 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -81,7 +81,7 @@ static struct ctl_table appldata_dir_table[] = {
81/* 81/*
82 * Timer 82 * Timer
83 */ 83 */
84DEFINE_PER_CPU(struct vtimer_list, appldata_timer); 84static DEFINE_PER_CPU(struct vtimer_list, appldata_timer);
85static atomic_t appldata_expire_count = ATOMIC_INIT(0); 85static atomic_t appldata_expire_count = ATOMIC_INIT(0);
86 86
87static DEFINE_SPINLOCK(appldata_timer_lock); 87static DEFINE_SPINLOCK(appldata_timer_lock);
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index 8aea3698a77b..4ca615788702 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -36,7 +36,7 @@
36 * book: 36 * book:
37 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml 37 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml
38 */ 38 */
39struct appldata_mem_data { 39static struct appldata_mem_data {
40 u64 timestamp; 40 u64 timestamp;
41 u32 sync_count_1; /* after VM collected the record data, */ 41 u32 sync_count_1; /* after VM collected the record data, */
42 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the 42 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 075e619bf37d..f64b8c867ae2 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -34,7 +34,7 @@
34 * book: 34 * book:
35 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml 35 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml
36 */ 36 */
37struct appldata_net_sum_data { 37static struct appldata_net_sum_data {
38 u64 timestamp; 38 u64 timestamp;
39 u32 sync_count_1; /* after VM collected the record data, */ 39 u32 sync_count_1; /* after VM collected the record data, */
40 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the 40 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the
diff --git a/arch/s390/crypto/Kconfig b/arch/s390/crypto/Kconfig
new file mode 100644
index 000000000000..99ff9f08e4d7
--- /dev/null
+++ b/arch/s390/crypto/Kconfig
@@ -0,0 +1,60 @@
1config CRYPTO_SHA1_S390
2 tristate "SHA1 digest algorithm"
3 depends on S390
4 select CRYPTO_ALGAPI
5 help
6 This is the s390 hardware accelerated implementation of the
7 SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2).
8
9config CRYPTO_SHA256_S390
10 tristate "SHA256 digest algorithm"
11 depends on S390
12 select CRYPTO_ALGAPI
13 help
14 This is the s390 hardware accelerated implementation of the
15 SHA256 secure hash standard (DFIPS 180-2).
16
17 This version of SHA implements a 256 bit hash with 128 bits of
18 security against collision attacks.
19
20config CRYPTO_DES_S390
21 tristate "DES and Triple DES cipher algorithms"
22 depends on S390
23 select CRYPTO_ALGAPI
24 select CRYPTO_BLKCIPHER
25 help
26 This us the s390 hardware accelerated implementation of the
27 DES cipher algorithm (FIPS 46-2), and Triple DES EDE (FIPS 46-3).
28
29config CRYPTO_AES_S390
30 tristate "AES cipher algorithms"
31 depends on S390
32 select CRYPTO_ALGAPI
33 select CRYPTO_BLKCIPHER
34 help
35 This is the s390 hardware accelerated implementation of the
36 AES cipher algorithms (FIPS-197). AES uses the Rijndael
37 algorithm.
38
39 Rijndael appears to be consistently a very good performer in
40 both hardware and software across a wide range of computing
41 environments regardless of its use in feedback or non-feedback
42 modes. Its key setup time is excellent, and its key agility is
43 good. Rijndael's very low memory requirements make it very well
44 suited for restricted-space environments, in which it also
45 demonstrates excellent performance. Rijndael's operations are
46 among the easiest to defend against power and timing attacks.
47
48 On s390 the System z9-109 currently only supports the key size
49 of 128 bit.
50
51config S390_PRNG
52 tristate "Pseudo random number generator device driver"
53 depends on S390
54 default "m"
55 help
56 Select this option if you want to use the s390 pseudo random number
57 generator. The PRNG is part of the cryptograhic processor functions
58 and uses triple-DES to generate secure random numbers like the
59 ANSI X9.17 standard. The PRNG is usable via the char device
60 /dev/prandom.
diff --git a/arch/s390/crypto/Makefile b/arch/s390/crypto/Makefile
index bfe2541dc5cf..14e552c5cc43 100644
--- a/arch/s390/crypto/Makefile
+++ b/arch/s390/crypto/Makefile
@@ -6,5 +6,4 @@ obj-$(CONFIG_CRYPTO_SHA1_S390) += sha1_s390.o
6obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o 6obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o
7obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o des_check_key.o 7obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o des_check_key.o
8obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o 8obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o
9 9obj-$(CONFIG_S390_PRNG) += prng.o
10obj-$(CONFIG_CRYPTO_TEST) += crypt_s390_query.o
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 15c9eec02928..91636353f6f0 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -4,7 +4,7 @@
4 * s390 implementation of the AES Cipher Algorithm. 4 * s390 implementation of the AES Cipher Algorithm.
5 * 5 *
6 * s390 Version: 6 * s390 Version:
7 * Copyright (C) 2005 IBM Deutschland GmbH, IBM Corporation 7 * Copyright IBM Corp. 2005,2007
8 * Author(s): Jan Glauber (jang@de.ibm.com) 8 * Author(s): Jan Glauber (jang@de.ibm.com)
9 * 9 *
10 * Derived from "crypto/aes.c" 10 * Derived from "crypto/aes.c"
@@ -27,9 +27,11 @@
27/* data block size for all key lengths */ 27/* data block size for all key lengths */
28#define AES_BLOCK_SIZE 16 28#define AES_BLOCK_SIZE 16
29 29
30int has_aes_128 = 0; 30#define AES_KEYLEN_128 1
31int has_aes_192 = 0; 31#define AES_KEYLEN_192 2
32int has_aes_256 = 0; 32#define AES_KEYLEN_256 4
33
34static char keylen_flag = 0;
33 35
34struct s390_aes_ctx { 36struct s390_aes_ctx {
35 u8 iv[AES_BLOCK_SIZE]; 37 u8 iv[AES_BLOCK_SIZE];
@@ -47,20 +49,19 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
47 49
48 switch (key_len) { 50 switch (key_len) {
49 case 16: 51 case 16:
50 if (!has_aes_128) 52 if (!(keylen_flag & AES_KEYLEN_128))
51 goto fail; 53 goto fail;
52 break; 54 break;
53 case 24: 55 case 24:
54 if (!has_aes_192) 56 if (!(keylen_flag & AES_KEYLEN_192))
55 goto fail; 57 goto fail;
56 58
57 break; 59 break;
58 case 32: 60 case 32:
59 if (!has_aes_256) 61 if (!(keylen_flag & AES_KEYLEN_256))
60 goto fail; 62 goto fail;
61 break; 63 break;
62 default: 64 default:
63 /* invalid key length */
64 goto fail; 65 goto fail;
65 break; 66 break;
66 } 67 }
@@ -322,34 +323,32 @@ static int __init aes_init(void)
322 int ret; 323 int ret;
323 324
324 if (crypt_s390_func_available(KM_AES_128_ENCRYPT)) 325 if (crypt_s390_func_available(KM_AES_128_ENCRYPT))
325 has_aes_128 = 1; 326 keylen_flag |= AES_KEYLEN_128;
326 if (crypt_s390_func_available(KM_AES_192_ENCRYPT)) 327 if (crypt_s390_func_available(KM_AES_192_ENCRYPT))
327 has_aes_192 = 1; 328 keylen_flag |= AES_KEYLEN_192;
328 if (crypt_s390_func_available(KM_AES_256_ENCRYPT)) 329 if (crypt_s390_func_available(KM_AES_256_ENCRYPT))
329 has_aes_256 = 1; 330 keylen_flag |= AES_KEYLEN_256;
331
332 if (!keylen_flag)
333 return -EOPNOTSUPP;
330 334
331 if (!has_aes_128 && !has_aes_192 && !has_aes_256) 335 /* z9 109 and z9 BC/EC only support 128 bit key length */
332 return -ENOSYS; 336 if (keylen_flag == AES_KEYLEN_128)
337 printk(KERN_INFO
338 "aes_s390: hardware acceleration only available for"
339 "128 bit keys\n");
333 340
334 ret = crypto_register_alg(&aes_alg); 341 ret = crypto_register_alg(&aes_alg);
335 if (ret != 0) { 342 if (ret)
336 printk(KERN_INFO "crypt_s390: aes-s390 couldn't be loaded.\n");
337 goto aes_err; 343 goto aes_err;
338 }
339 344
340 ret = crypto_register_alg(&ecb_aes_alg); 345 ret = crypto_register_alg(&ecb_aes_alg);
341 if (ret != 0) { 346 if (ret)
342 printk(KERN_INFO
343 "crypt_s390: ecb-aes-s390 couldn't be loaded.\n");
344 goto ecb_aes_err; 347 goto ecb_aes_err;
345 }
346 348
347 ret = crypto_register_alg(&cbc_aes_alg); 349 ret = crypto_register_alg(&cbc_aes_alg);
348 if (ret != 0) { 350 if (ret)
349 printk(KERN_INFO
350 "crypt_s390: cbc-aes-s390 couldn't be loaded.\n");
351 goto cbc_aes_err; 351 goto cbc_aes_err;
352 }
353 352
354out: 353out:
355 return ret; 354 return ret;
diff --git a/arch/s390/crypto/crypt_s390.h b/arch/s390/crypto/crypt_s390.h
index 2b137089f625..2775d2618332 100644
--- a/arch/s390/crypto/crypt_s390.h
+++ b/arch/s390/crypto/crypt_s390.h
@@ -3,8 +3,9 @@
3 * 3 *
4 * Support for s390 cryptographic instructions. 4 * Support for s390 cryptographic instructions.
5 * 5 *
6 * Copyright (C) 2003 IBM Deutschland GmbH, IBM Corporation 6 * Copyright IBM Corp. 2003,2007
7 * Author(s): Thomas Spatzier (tspat@de.ibm.com) 7 * Author(s): Thomas Spatzier
8 * Jan Glauber (jan.glauber@de.ibm.com)
8 * 9 *
9 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free 11 * under the terms of the GNU General Public License as published by the Free
@@ -32,7 +33,8 @@ enum crypt_s390_operations {
32 CRYPT_S390_KMAC = 0x0500 33 CRYPT_S390_KMAC = 0x0500
33}; 34};
34 35
35/* function codes for KM (CIPHER MESSAGE) instruction 36/*
37 * function codes for KM (CIPHER MESSAGE) instruction
36 * 0x80 is the decipher modifier bit 38 * 0x80 is the decipher modifier bit
37 */ 39 */
38enum crypt_s390_km_func { 40enum crypt_s390_km_func {
@@ -51,7 +53,8 @@ enum crypt_s390_km_func {
51 KM_AES_256_DECRYPT = CRYPT_S390_KM | 0x14 | 0x80, 53 KM_AES_256_DECRYPT = CRYPT_S390_KM | 0x14 | 0x80,
52}; 54};
53 55
54/* function codes for KMC (CIPHER MESSAGE WITH CHAINING) 56/*
57 * function codes for KMC (CIPHER MESSAGE WITH CHAINING)
55 * instruction 58 * instruction
56 */ 59 */
57enum crypt_s390_kmc_func { 60enum crypt_s390_kmc_func {
@@ -68,9 +71,11 @@ enum crypt_s390_kmc_func {
68 KMC_AES_192_DECRYPT = CRYPT_S390_KMC | 0x13 | 0x80, 71 KMC_AES_192_DECRYPT = CRYPT_S390_KMC | 0x13 | 0x80,
69 KMC_AES_256_ENCRYPT = CRYPT_S390_KMC | 0x14, 72 KMC_AES_256_ENCRYPT = CRYPT_S390_KMC | 0x14,
70 KMC_AES_256_DECRYPT = CRYPT_S390_KMC | 0x14 | 0x80, 73 KMC_AES_256_DECRYPT = CRYPT_S390_KMC | 0x14 | 0x80,
74 KMC_PRNG = CRYPT_S390_KMC | 0x43,
71}; 75};
72 76
73/* function codes for KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST) 77/*
78 * function codes for KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST)
74 * instruction 79 * instruction
75 */ 80 */
76enum crypt_s390_kimd_func { 81enum crypt_s390_kimd_func {
@@ -79,7 +84,8 @@ enum crypt_s390_kimd_func {
79 KIMD_SHA_256 = CRYPT_S390_KIMD | 2, 84 KIMD_SHA_256 = CRYPT_S390_KIMD | 2,
80}; 85};
81 86
82/* function codes for KLMD (COMPUTE LAST MESSAGE DIGEST) 87/*
88 * function codes for KLMD (COMPUTE LAST MESSAGE DIGEST)
83 * instruction 89 * instruction
84 */ 90 */
85enum crypt_s390_klmd_func { 91enum crypt_s390_klmd_func {
@@ -88,7 +94,8 @@ enum crypt_s390_klmd_func {
88 KLMD_SHA_256 = CRYPT_S390_KLMD | 2, 94 KLMD_SHA_256 = CRYPT_S390_KLMD | 2,
89}; 95};
90 96
91/* function codes for KMAC (COMPUTE MESSAGE AUTHENTICATION CODE) 97/*
98 * function codes for KMAC (COMPUTE MESSAGE AUTHENTICATION CODE)
92 * instruction 99 * instruction
93 */ 100 */
94enum crypt_s390_kmac_func { 101enum crypt_s390_kmac_func {
@@ -98,229 +105,219 @@ enum crypt_s390_kmac_func {
98 KMAC_TDEA_192 = CRYPT_S390_KMAC | 3 105 KMAC_TDEA_192 = CRYPT_S390_KMAC | 3
99}; 106};
100 107
101/* status word for s390 crypto instructions' QUERY functions */ 108/**
102struct crypt_s390_query_status { 109 * crypt_s390_km:
103 u64 high; 110 * @func: the function code passed to KM; see crypt_s390_km_func
104 u64 low; 111 * @param: address of parameter block; see POP for details on each func
105}; 112 * @dest: address of destination memory area
106 113 * @src: address of source memory area
107/* 114 * @src_len: length of src operand in bytes
115 *
108 * Executes the KM (CIPHER MESSAGE) operation of the CPU. 116 * Executes the KM (CIPHER MESSAGE) operation of the CPU.
109 * @param func: the function code passed to KM; see crypt_s390_km_func 117 *
110 * @param param: address of parameter block; see POP for details on each func 118 * Returns -1 for failure, 0 for the query func, number of processed
111 * @param dest: address of destination memory area 119 * bytes for encryption/decryption funcs
112 * @param src: address of source memory area
113 * @param src_len: length of src operand in bytes
114 * @returns < zero for failure, 0 for the query func, number of processed bytes
115 * for encryption/decryption funcs
116 */ 120 */
117static inline int 121static inline int crypt_s390_km(long func, void *param,
118crypt_s390_km(long func, void* param, u8* dest, const u8* src, long src_len) 122 u8 *dest, const u8 *src, long src_len)
119{ 123{
120 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK; 124 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
121 register void* __param asm("1") = param; 125 register void *__param asm("1") = param;
122 register const u8* __src asm("2") = src; 126 register const u8 *__src asm("2") = src;
123 register long __src_len asm("3") = src_len; 127 register long __src_len asm("3") = src_len;
124 register u8* __dest asm("4") = dest; 128 register u8 *__dest asm("4") = dest;
125 int ret; 129 int ret;
126 130
127 asm volatile( 131 asm volatile(
128 "0: .insn rre,0xb92e0000,%3,%1 \n" /* KM opcode */ 132 "0: .insn rre,0xb92e0000,%3,%1 \n" /* KM opcode */
129 "1: brc 1,0b \n" /* handle partial completion */ 133 "1: brc 1,0b \n" /* handle partial completion */
130 " ahi %0,%h7\n" 134 " la %0,0\n"
131 "2: ahi %0,%h8\n" 135 "2:\n"
132 "3:\n" 136 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
133 EX_TABLE(0b,3b) EX_TABLE(1b,2b)
134 : "=d" (ret), "+a" (__src), "+d" (__src_len), "+a" (__dest) 137 : "=d" (ret), "+a" (__src), "+d" (__src_len), "+a" (__dest)
135 : "d" (__func), "a" (__param), "0" (-EFAULT), 138 : "d" (__func), "a" (__param), "0" (-1) : "cc", "memory");
136 "K" (ENOSYS), "K" (-ENOSYS + EFAULT) : "cc", "memory");
137 if (ret < 0) 139 if (ret < 0)
138 return ret; 140 return ret;
139 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len; 141 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len;
140} 142}
141 143
142/* 144/**
145 * crypt_s390_kmc:
146 * @func: the function code passed to KM; see crypt_s390_kmc_func
147 * @param: address of parameter block; see POP for details on each func
148 * @dest: address of destination memory area
149 * @src: address of source memory area
150 * @src_len: length of src operand in bytes
151 *
143 * Executes the KMC (CIPHER MESSAGE WITH CHAINING) operation of the CPU. 152 * Executes the KMC (CIPHER MESSAGE WITH CHAINING) operation of the CPU.
144 * @param func: the function code passed to KM; see crypt_s390_kmc_func 153 *
145 * @param param: address of parameter block; see POP for details on each func 154 * Returns -1 for failure, 0 for the query func, number of processed
146 * @param dest: address of destination memory area 155 * bytes for encryption/decryption funcs
147 * @param src: address of source memory area
148 * @param src_len: length of src operand in bytes
149 * @returns < zero for failure, 0 for the query func, number of processed bytes
150 * for encryption/decryption funcs
151 */ 156 */
152static inline int 157static inline int crypt_s390_kmc(long func, void *param,
153crypt_s390_kmc(long func, void* param, u8* dest, const u8* src, long src_len) 158 u8 *dest, const u8 *src, long src_len)
154{ 159{
155 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK; 160 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
156 register void* __param asm("1") = param; 161 register void *__param asm("1") = param;
157 register const u8* __src asm("2") = src; 162 register const u8 *__src asm("2") = src;
158 register long __src_len asm("3") = src_len; 163 register long __src_len asm("3") = src_len;
159 register u8* __dest asm("4") = dest; 164 register u8 *__dest asm("4") = dest;
160 int ret; 165 int ret;
161 166
162 asm volatile( 167 asm volatile(
163 "0: .insn rre,0xb92f0000,%3,%1 \n" /* KMC opcode */ 168 "0: .insn rre,0xb92f0000,%3,%1 \n" /* KMC opcode */
164 "1: brc 1,0b \n" /* handle partial completion */ 169 "1: brc 1,0b \n" /* handle partial completion */
165 " ahi %0,%h7\n" 170 " la %0,0\n"
166 "2: ahi %0,%h8\n" 171 "2:\n"
167 "3:\n" 172 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
168 EX_TABLE(0b,3b) EX_TABLE(1b,2b)
169 : "=d" (ret), "+a" (__src), "+d" (__src_len), "+a" (__dest) 173 : "=d" (ret), "+a" (__src), "+d" (__src_len), "+a" (__dest)
170 : "d" (__func), "a" (__param), "0" (-EFAULT), 174 : "d" (__func), "a" (__param), "0" (-1) : "cc", "memory");
171 "K" (ENOSYS), "K" (-ENOSYS + EFAULT) : "cc", "memory");
172 if (ret < 0) 175 if (ret < 0)
173 return ret; 176 return ret;
174 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len; 177 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len;
175} 178}
176 179
177/* 180/**
181 * crypt_s390_kimd:
182 * @func: the function code passed to KM; see crypt_s390_kimd_func
183 * @param: address of parameter block; see POP for details on each func
184 * @src: address of source memory area
185 * @src_len: length of src operand in bytes
186 *
178 * Executes the KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST) operation 187 * Executes the KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST) operation
179 * of the CPU. 188 * of the CPU.
180 * @param func: the function code passed to KM; see crypt_s390_kimd_func 189 *
181 * @param param: address of parameter block; see POP for details on each func 190 * Returns -1 for failure, 0 for the query func, number of processed
182 * @param src: address of source memory area 191 * bytes for digest funcs
183 * @param src_len: length of src operand in bytes
184 * @returns < zero for failure, 0 for the query func, number of processed bytes
185 * for digest funcs
186 */ 192 */
187static inline int 193static inline int crypt_s390_kimd(long func, void *param,
188crypt_s390_kimd(long func, void* param, const u8* src, long src_len) 194 const u8 *src, long src_len)
189{ 195{
190 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK; 196 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
191 register void* __param asm("1") = param; 197 register void *__param asm("1") = param;
192 register const u8* __src asm("2") = src; 198 register const u8 *__src asm("2") = src;
193 register long __src_len asm("3") = src_len; 199 register long __src_len asm("3") = src_len;
194 int ret; 200 int ret;
195 201
196 asm volatile( 202 asm volatile(
197 "0: .insn rre,0xb93e0000,%1,%1 \n" /* KIMD opcode */ 203 "0: .insn rre,0xb93e0000,%1,%1 \n" /* KIMD opcode */
198 "1: brc 1,0b \n" /* handle partial completion */ 204 "1: brc 1,0b \n" /* handle partial completion */
199 " ahi %0,%h6\n" 205 " la %0,0\n"
200 "2: ahi %0,%h7\n" 206 "2:\n"
201 "3:\n" 207 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
202 EX_TABLE(0b,3b) EX_TABLE(1b,2b)
203 : "=d" (ret), "+a" (__src), "+d" (__src_len) 208 : "=d" (ret), "+a" (__src), "+d" (__src_len)
204 : "d" (__func), "a" (__param), "0" (-EFAULT), 209 : "d" (__func), "a" (__param), "0" (-1) : "cc", "memory");
205 "K" (ENOSYS), "K" (-ENOSYS + EFAULT) : "cc", "memory");
206 if (ret < 0) 210 if (ret < 0)
207 return ret; 211 return ret;
208 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len; 212 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len;
209} 213}
210 214
211/* 215/**
216 * crypt_s390_klmd:
217 * @func: the function code passed to KM; see crypt_s390_klmd_func
218 * @param: address of parameter block; see POP for details on each func
219 * @src: address of source memory area
220 * @src_len: length of src operand in bytes
221 *
212 * Executes the KLMD (COMPUTE LAST MESSAGE DIGEST) operation of the CPU. 222 * Executes the KLMD (COMPUTE LAST MESSAGE DIGEST) operation of the CPU.
213 * @param func: the function code passed to KM; see crypt_s390_klmd_func 223 *
214 * @param param: address of parameter block; see POP for details on each func 224 * Returns -1 for failure, 0 for the query func, number of processed
215 * @param src: address of source memory area 225 * bytes for digest funcs
216 * @param src_len: length of src operand in bytes
217 * @returns < zero for failure, 0 for the query func, number of processed bytes
218 * for digest funcs
219 */ 226 */
220static inline int 227static inline int crypt_s390_klmd(long func, void *param,
221crypt_s390_klmd(long func, void* param, const u8* src, long src_len) 228 const u8 *src, long src_len)
222{ 229{
223 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK; 230 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
224 register void* __param asm("1") = param; 231 register void *__param asm("1") = param;
225 register const u8* __src asm("2") = src; 232 register const u8 *__src asm("2") = src;
226 register long __src_len asm("3") = src_len; 233 register long __src_len asm("3") = src_len;
227 int ret; 234 int ret;
228 235
229 asm volatile( 236 asm volatile(
230 "0: .insn rre,0xb93f0000,%1,%1 \n" /* KLMD opcode */ 237 "0: .insn rre,0xb93f0000,%1,%1 \n" /* KLMD opcode */
231 "1: brc 1,0b \n" /* handle partial completion */ 238 "1: brc 1,0b \n" /* handle partial completion */
232 " ahi %0,%h6\n" 239 " la %0,0\n"
233 "2: ahi %0,%h7\n" 240 "2:\n"
234 "3:\n" 241 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
235 EX_TABLE(0b,3b) EX_TABLE(1b,2b)
236 : "=d" (ret), "+a" (__src), "+d" (__src_len) 242 : "=d" (ret), "+a" (__src), "+d" (__src_len)
237 : "d" (__func), "a" (__param), "0" (-EFAULT), 243 : "d" (__func), "a" (__param), "0" (-1) : "cc", "memory");
238 "K" (ENOSYS), "K" (-ENOSYS + EFAULT) : "cc", "memory");
239 if (ret < 0) 244 if (ret < 0)
240 return ret; 245 return ret;
241 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len; 246 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len;
242} 247}
243 248
244/* 249/**
250 * crypt_s390_kmac:
251 * @func: the function code passed to KM; see crypt_s390_klmd_func
252 * @param: address of parameter block; see POP for details on each func
253 * @src: address of source memory area
254 * @src_len: length of src operand in bytes
255 *
245 * Executes the KMAC (COMPUTE MESSAGE AUTHENTICATION CODE) operation 256 * Executes the KMAC (COMPUTE MESSAGE AUTHENTICATION CODE) operation
246 * of the CPU. 257 * of the CPU.
247 * @param func: the function code passed to KM; see crypt_s390_klmd_func 258 *
248 * @param param: address of parameter block; see POP for details on each func 259 * Returns -1 for failure, 0 for the query func, number of processed
249 * @param src: address of source memory area 260 * bytes for digest funcs
250 * @param src_len: length of src operand in bytes
251 * @returns < zero for failure, 0 for the query func, number of processed bytes
252 * for digest funcs
253 */ 261 */
254static inline int 262static inline int crypt_s390_kmac(long func, void *param,
255crypt_s390_kmac(long func, void* param, const u8* src, long src_len) 263 const u8 *src, long src_len)
256{ 264{
257 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK; 265 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
258 register void* __param asm("1") = param; 266 register void *__param asm("1") = param;
259 register const u8* __src asm("2") = src; 267 register const u8 *__src asm("2") = src;
260 register long __src_len asm("3") = src_len; 268 register long __src_len asm("3") = src_len;
261 int ret; 269 int ret;
262 270
263 asm volatile( 271 asm volatile(
264 "0: .insn rre,0xb91e0000,%1,%1 \n" /* KLAC opcode */ 272 "0: .insn rre,0xb91e0000,%1,%1 \n" /* KLAC opcode */
265 "1: brc 1,0b \n" /* handle partial completion */ 273 "1: brc 1,0b \n" /* handle partial completion */
266 " ahi %0,%h6\n" 274 " la %0,0\n"
267 "2: ahi %0,%h7\n" 275 "2:\n"
268 "3:\n" 276 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
269 EX_TABLE(0b,3b) EX_TABLE(1b,2b)
270 : "=d" (ret), "+a" (__src), "+d" (__src_len) 277 : "=d" (ret), "+a" (__src), "+d" (__src_len)
271 : "d" (__func), "a" (__param), "0" (-EFAULT), 278 : "d" (__func), "a" (__param), "0" (-1) : "cc", "memory");
272 "K" (ENOSYS), "K" (-ENOSYS + EFAULT) : "cc", "memory");
273 if (ret < 0) 279 if (ret < 0)
274 return ret; 280 return ret;
275 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len; 281 return (func & CRYPT_S390_FUNC_MASK) ? src_len - __src_len : __src_len;
276} 282}
277 283
278/** 284/**
285 * crypt_s390_func_available:
286 * @func: the function code of the specific function; 0 if op in general
287 *
279 * Tests if a specific crypto function is implemented on the machine. 288 * Tests if a specific crypto function is implemented on the machine.
280 * @param func: the function code of the specific function; 0 if op in general 289 *
281 * @return 1 if func available; 0 if func or op in general not available 290 * Returns 1 if func available; 0 if func or op in general not available
282 */ 291 */
283static inline int 292static inline int crypt_s390_func_available(int func)
284crypt_s390_func_available(int func)
285{ 293{
294 unsigned char status[16];
286 int ret; 295 int ret;
287 296
288 struct crypt_s390_query_status status = { 297 switch (func & CRYPT_S390_OP_MASK) {
289 .high = 0, 298 case CRYPT_S390_KM:
290 .low = 0 299 ret = crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0);
291 }; 300 break;
292 switch (func & CRYPT_S390_OP_MASK){ 301 case CRYPT_S390_KMC:
293 case CRYPT_S390_KM: 302 ret = crypt_s390_kmc(KMC_QUERY, &status, NULL, NULL, 0);
294 ret = crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0); 303 break;
295 break; 304 case CRYPT_S390_KIMD:
296 case CRYPT_S390_KMC: 305 ret = crypt_s390_kimd(KIMD_QUERY, &status, NULL, 0);
297 ret = crypt_s390_kmc(KMC_QUERY, &status, NULL, NULL, 0); 306 break;
298 break; 307 case CRYPT_S390_KLMD:
299 case CRYPT_S390_KIMD: 308 ret = crypt_s390_klmd(KLMD_QUERY, &status, NULL, 0);
300 ret = crypt_s390_kimd(KIMD_QUERY, &status, NULL, 0); 309 break;
301 break; 310 case CRYPT_S390_KMAC:
302 case CRYPT_S390_KLMD: 311 ret = crypt_s390_kmac(KMAC_QUERY, &status, NULL, 0);
303 ret = crypt_s390_klmd(KLMD_QUERY, &status, NULL, 0); 312 break;
304 break; 313 default:
305 case CRYPT_S390_KMAC: 314 return 0;
306 ret = crypt_s390_kmac(KMAC_QUERY, &status, NULL, 0);
307 break;
308 default:
309 ret = 0;
310 return ret;
311 }
312 if (ret >= 0){
313 func &= CRYPT_S390_FUNC_MASK;
314 func &= 0x7f; //mask modifier bit
315 if (func < 64){
316 ret = (status.high >> (64 - func - 1)) & 0x1;
317 } else {
318 ret = (status.low >> (128 - func - 1)) & 0x1;
319 }
320 } else {
321 ret = 0;
322 } 315 }
323 return ret; 316 if (ret < 0)
317 return 0;
318 func &= CRYPT_S390_FUNC_MASK;
319 func &= 0x7f; /* mask modifier bit */
320 return (status[func >> 3] & (0x80 >> (func & 7))) != 0;
324} 321}
325 322
326#endif // _CRYPTO_ARCH_S390_CRYPT_S390_H 323#endif /* _CRYPTO_ARCH_S390_CRYPT_S390_H */
diff --git a/arch/s390/crypto/crypt_s390_query.c b/arch/s390/crypto/crypt_s390_query.c
deleted file mode 100644
index 54fb11d7fadd..000000000000
--- a/arch/s390/crypto/crypt_s390_query.c
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 * Cryptographic API.
3 *
4 * Support for s390 cryptographic instructions.
5 * Testing module for querying processor crypto capabilities.
6 *
7 * Copyright (c) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
8 * Author(s): Thomas Spatzier (tspat@de.ibm.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 Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 *
15 */
16#include <linux/module.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <asm/errno.h>
20#include "crypt_s390.h"
21
22static void query_available_functions(void)
23{
24 printk(KERN_INFO "#####################\n");
25
26 /* query available KM functions */
27 printk(KERN_INFO "KM_QUERY: %d\n",
28 crypt_s390_func_available(KM_QUERY));
29 printk(KERN_INFO "KM_DEA: %d\n",
30 crypt_s390_func_available(KM_DEA_ENCRYPT));
31 printk(KERN_INFO "KM_TDEA_128: %d\n",
32 crypt_s390_func_available(KM_TDEA_128_ENCRYPT));
33 printk(KERN_INFO "KM_TDEA_192: %d\n",
34 crypt_s390_func_available(KM_TDEA_192_ENCRYPT));
35 printk(KERN_INFO "KM_AES_128: %d\n",
36 crypt_s390_func_available(KM_AES_128_ENCRYPT));
37 printk(KERN_INFO "KM_AES_192: %d\n",
38 crypt_s390_func_available(KM_AES_192_ENCRYPT));
39 printk(KERN_INFO "KM_AES_256: %d\n",
40 crypt_s390_func_available(KM_AES_256_ENCRYPT));
41
42 /* query available KMC functions */
43 printk(KERN_INFO "KMC_QUERY: %d\n",
44 crypt_s390_func_available(KMC_QUERY));
45 printk(KERN_INFO "KMC_DEA: %d\n",
46 crypt_s390_func_available(KMC_DEA_ENCRYPT));
47 printk(KERN_INFO "KMC_TDEA_128: %d\n",
48 crypt_s390_func_available(KMC_TDEA_128_ENCRYPT));
49 printk(KERN_INFO "KMC_TDEA_192: %d\n",
50 crypt_s390_func_available(KMC_TDEA_192_ENCRYPT));
51 printk(KERN_INFO "KMC_AES_128: %d\n",
52 crypt_s390_func_available(KMC_AES_128_ENCRYPT));
53 printk(KERN_INFO "KMC_AES_192: %d\n",
54 crypt_s390_func_available(KMC_AES_192_ENCRYPT));
55 printk(KERN_INFO "KMC_AES_256: %d\n",
56 crypt_s390_func_available(KMC_AES_256_ENCRYPT));
57
58 /* query available KIMD functions */
59 printk(KERN_INFO "KIMD_QUERY: %d\n",
60 crypt_s390_func_available(KIMD_QUERY));
61 printk(KERN_INFO "KIMD_SHA_1: %d\n",
62 crypt_s390_func_available(KIMD_SHA_1));
63 printk(KERN_INFO "KIMD_SHA_256: %d\n",
64 crypt_s390_func_available(KIMD_SHA_256));
65
66 /* query available KLMD functions */
67 printk(KERN_INFO "KLMD_QUERY: %d\n",
68 crypt_s390_func_available(KLMD_QUERY));
69 printk(KERN_INFO "KLMD_SHA_1: %d\n",
70 crypt_s390_func_available(KLMD_SHA_1));
71 printk(KERN_INFO "KLMD_SHA_256: %d\n",
72 crypt_s390_func_available(KLMD_SHA_256));
73
74 /* query available KMAC functions */
75 printk(KERN_INFO "KMAC_QUERY: %d\n",
76 crypt_s390_func_available(KMAC_QUERY));
77 printk(KERN_INFO "KMAC_DEA: %d\n",
78 crypt_s390_func_available(KMAC_DEA));
79 printk(KERN_INFO "KMAC_TDEA_128: %d\n",
80 crypt_s390_func_available(KMAC_TDEA_128));
81 printk(KERN_INFO "KMAC_TDEA_192: %d\n",
82 crypt_s390_func_available(KMAC_TDEA_192));
83}
84
85static int init(void)
86{
87 struct crypt_s390_query_status status = {
88 .high = 0,
89 .low = 0
90 };
91
92 printk(KERN_INFO "crypt_s390: querying available crypto functions\n");
93 crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0);
94 printk(KERN_INFO "KM:\t%016llx %016llx\n",
95 (unsigned long long) status.high,
96 (unsigned long long) status.low);
97 status.high = status.low = 0;
98 crypt_s390_kmc(KMC_QUERY, &status, NULL, NULL, 0);
99 printk(KERN_INFO "KMC:\t%016llx %016llx\n",
100 (unsigned long long) status.high,
101 (unsigned long long) status.low);
102 status.high = status.low = 0;
103 crypt_s390_kimd(KIMD_QUERY, &status, NULL, 0);
104 printk(KERN_INFO "KIMD:\t%016llx %016llx\n",
105 (unsigned long long) status.high,
106 (unsigned long long) status.low);
107 status.high = status.low = 0;
108 crypt_s390_klmd(KLMD_QUERY, &status, NULL, 0);
109 printk(KERN_INFO "KLMD:\t%016llx %016llx\n",
110 (unsigned long long) status.high,
111 (unsigned long long) status.low);
112 status.high = status.low = 0;
113 crypt_s390_kmac(KMAC_QUERY, &status, NULL, 0);
114 printk(KERN_INFO "KMAC:\t%016llx %016llx\n",
115 (unsigned long long) status.high,
116 (unsigned long long) status.low);
117
118 query_available_functions();
119 return -ECANCELED;
120}
121
122static void __exit cleanup(void)
123{
124}
125
126module_init(init);
127module_exit(cleanup);
128
129MODULE_LICENSE("GPL");
diff --git a/arch/s390/crypto/des_check_key.c b/arch/s390/crypto/des_check_key.c
index e3f5c5f238fe..5706af266442 100644
--- a/arch/s390/crypto/des_check_key.c
+++ b/arch/s390/crypto/des_check_key.c
@@ -10,8 +10,9 @@
10 * scatterlist interface. Changed LGPL to GPL per section 3 of the LGPL. 10 * scatterlist interface. Changed LGPL to GPL per section 3 of the LGPL.
11 * 11 *
12 * s390 Version: 12 * s390 Version:
13 * Copyright (C) 2003 IBM Deutschland GmbH, IBM Corporation 13 * Copyright IBM Corp. 2003
14 * Author(s): Thomas Spatzier (tspat@de.ibm.com) 14 * Author(s): Thomas Spatzier
15 * Jan Glauber (jan.glauber@de.ibm.com)
15 * 16 *
16 * Derived from "crypto/des.c" 17 * Derived from "crypto/des.c"
17 * Copyright (c) 1992 Dana L. How. 18 * Copyright (c) 1992 Dana L. How.
@@ -30,6 +31,7 @@
30#include <linux/module.h> 31#include <linux/module.h>
31#include <linux/errno.h> 32#include <linux/errno.h>
32#include <linux/crypto.h> 33#include <linux/crypto.h>
34#include "crypto_des.h"
33 35
34#define ROR(d,c,o) ((d) = (d) >> (c) | (d) << (o)) 36#define ROR(d,c,o) ((d) = (d) >> (c) | (d) << (o))
35 37
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index 2aba04852fe3..ea22707f435f 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -3,9 +3,9 @@
3 * 3 *
4 * s390 implementation of the DES Cipher Algorithm. 4 * s390 implementation of the DES Cipher Algorithm.
5 * 5 *
6 * Copyright (c) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation 6 * Copyright IBM Corp. 2003,2007
7 * Author(s): Thomas Spatzier (tspat@de.ibm.com) 7 * Author(s): Thomas Spatzier
8 * 8 * Jan Glauber (jan.glauber@de.ibm.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -557,7 +557,7 @@ static int init(void)
557 if (!crypt_s390_func_available(KM_DEA_ENCRYPT) || 557 if (!crypt_s390_func_available(KM_DEA_ENCRYPT) ||
558 !crypt_s390_func_available(KM_TDEA_128_ENCRYPT) || 558 !crypt_s390_func_available(KM_TDEA_128_ENCRYPT) ||
559 !crypt_s390_func_available(KM_TDEA_192_ENCRYPT)) 559 !crypt_s390_func_available(KM_TDEA_192_ENCRYPT))
560 return -ENOSYS; 560 return -EOPNOTSUPP;
561 561
562 ret = crypto_register_alg(&des_alg); 562 ret = crypto_register_alg(&des_alg);
563 if (ret) 563 if (ret)
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
new file mode 100644
index 000000000000..8eb3a1aedc22
--- /dev/null
+++ b/arch/s390/crypto/prng.c
@@ -0,0 +1,213 @@
1/*
2 * Copyright IBM Corp. 2006,2007
3 * Author(s): Jan Glauber <jan.glauber@de.ibm.com>
4 * Driver for the s390 pseudo random number generator
5 */
6#include <linux/fs.h>
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/miscdevice.h>
10#include <linux/module.h>
11#include <linux/moduleparam.h>
12#include <linux/random.h>
13#include <asm/debug.h>
14#include <asm/uaccess.h>
15
16#include "crypt_s390.h"
17
18MODULE_LICENSE("GPL");
19MODULE_AUTHOR("Jan Glauber <jan.glauber@de.ibm.com>");
20MODULE_DESCRIPTION("s390 PRNG interface");
21
22static int prng_chunk_size = 256;
23module_param(prng_chunk_size, int, S_IRUSR | S_IRGRP | S_IROTH);
24MODULE_PARM_DESC(prng_chunk_size, "PRNG read chunk size in bytes");
25
26static int prng_entropy_limit = 4096;
27module_param(prng_entropy_limit, int, S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR);
28MODULE_PARM_DESC(prng_entropy_limit,
29 "PRNG add entropy after that much bytes were produced");
30
31/*
32 * Any one who considers arithmetical methods of producing random digits is,
33 * of course, in a state of sin. -- John von Neumann
34 */
35
36struct s390_prng_data {
37 unsigned long count; /* how many bytes were produced */
38 char *buf;
39};
40
41static struct s390_prng_data *p;
42
43/* copied from libica, use a non-zero initial parameter block */
44static unsigned char parm_block[32] = {
450x0F,0x2B,0x8E,0x63,0x8C,0x8E,0xD2,0x52,0x64,0xB7,0xA0,0x7B,0x75,0x28,0xB8,0xF4,
460x75,0x5F,0xD2,0xA6,0x8D,0x97,0x11,0xFF,0x49,0xD8,0x23,0xF3,0x7E,0x21,0xEC,0xA0,
47};
48
49static int prng_open(struct inode *inode, struct file *file)
50{
51 return nonseekable_open(inode, file);
52}
53
54static void prng_add_entropy(void)
55{
56 __u64 entropy[4];
57 unsigned int i;
58 int ret;
59
60 for (i = 0; i < 16; i++) {
61 ret = crypt_s390_kmc(KMC_PRNG, parm_block, (char *)entropy,
62 (char *)entropy, sizeof(entropy));
63 BUG_ON(ret < 0 || ret != sizeof(entropy));
64 memcpy(parm_block, entropy, sizeof(entropy));
65 }
66}
67
68static void prng_seed(int nbytes)
69{
70 char buf[16];
71 int i = 0;
72
73 BUG_ON(nbytes > 16);
74 get_random_bytes(buf, nbytes);
75
76 /* Add the entropy */
77 while (nbytes >= 8) {
78 *((__u64 *)parm_block) ^= *((__u64 *)buf+i*8);
79 prng_add_entropy();
80 i += 8;
81 nbytes -= 8;
82 }
83 prng_add_entropy();
84}
85
86static ssize_t prng_read(struct file *file, char __user *ubuf, size_t nbytes,
87 loff_t *ppos)
88{
89 int chunk, n;
90 int ret = 0;
91 int tmp;
92
93 /* nbytes can be arbitrary long, we spilt it into chunks */
94 while (nbytes) {
95 /* same as in extract_entropy_user in random.c */
96 if (need_resched()) {
97 if (signal_pending(current)) {
98 if (ret == 0)
99 ret = -ERESTARTSYS;
100 break;
101 }
102 schedule();
103 }
104
105 /*
106 * we lose some random bytes if an attacker issues
107 * reads < 8 bytes, but we don't care
108 */
109 chunk = min_t(int, nbytes, prng_chunk_size);
110
111 /* PRNG only likes multiples of 8 bytes */
112 n = (chunk + 7) & -8;
113
114 if (p->count > prng_entropy_limit)
115 prng_seed(8);
116
117 /* if the CPU supports PRNG stckf is present too */
118 asm volatile(".insn s,0xb27c0000,%0"
119 : "=m" (*((unsigned long long *)p->buf)) : : "cc");
120
121 /*
122 * Beside the STCKF the input for the TDES-EDE is the output
123 * of the last operation. We differ here from X9.17 since we
124 * only store one timestamp into the buffer. Padding the whole
125 * buffer with timestamps does not improve security, since
126 * successive stckf have nearly constant offsets.
127 * If an attacker knows the first timestamp it would be
128 * trivial to guess the additional values. One timestamp
129 * is therefore enough and still guarantees unique input values.
130 *
131 * Note: you can still get strict X9.17 conformity by setting
132 * prng_chunk_size to 8 bytes.
133 */
134 tmp = crypt_s390_kmc(KMC_PRNG, parm_block, p->buf, p->buf, n);
135 BUG_ON((tmp < 0) || (tmp != n));
136
137 p->count += n;
138
139 if (copy_to_user(ubuf, p->buf, chunk))
140 return -EFAULT;
141
142 nbytes -= chunk;
143 ret += chunk;
144 ubuf += chunk;
145 }
146 return ret;
147}
148
149static struct file_operations prng_fops = {
150 .owner = THIS_MODULE,
151 .open = &prng_open,
152 .release = NULL,
153 .read = &prng_read,
154};
155
156static struct miscdevice prng_dev = {
157 .name = "prandom",
158 .minor = MISC_DYNAMIC_MINOR,
159 .fops = &prng_fops,
160};
161
162static int __init prng_init(void)
163{
164 int ret;
165
166 /* check if the CPU has a PRNG */
167 if (!crypt_s390_func_available(KMC_PRNG))
168 return -EOPNOTSUPP;
169
170 if (prng_chunk_size < 8)
171 return -EINVAL;
172
173 p = kmalloc(sizeof(struct s390_prng_data), GFP_KERNEL);
174 if (!p)
175 return -ENOMEM;
176 p->count = 0;
177
178 p->buf = kmalloc(prng_chunk_size, GFP_KERNEL);
179 if (!p->buf) {
180 ret = -ENOMEM;
181 goto out_free;
182 }
183
184 /* initialize the PRNG, add 128 bits of entropy */
185 prng_seed(16);
186
187 ret = misc_register(&prng_dev);
188 if (ret) {
189 printk(KERN_WARNING
190 "Could not register misc device for PRNG.\n");
191 goto out_buf;
192 }
193 return 0;
194
195out_buf:
196 kfree(p->buf);
197out_free:
198 kfree(p);
199 return ret;
200}
201
202static void __exit prng_exit(void)
203{
204 /* wipe me */
205 memset(p->buf, 0, prng_chunk_size);
206 kfree(p->buf);
207 kfree(p);
208
209 misc_deregister(&prng_dev);
210}
211
212module_init(prng_init);
213module_exit(prng_exit);
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c
index 49ca8690ee39..969639f31977 100644
--- a/arch/s390/crypto/sha1_s390.c
+++ b/arch/s390/crypto/sha1_s390.c
@@ -8,8 +8,9 @@
8 * implementation written by Steve Reid. 8 * implementation written by Steve Reid.
9 * 9 *
10 * s390 Version: 10 * s390 Version:
11 * Copyright (C) 2003 IBM Deutschland GmbH, IBM Corporation 11 * Copyright IBM Corp. 2003,2007
12 * Author(s): Thomas Spatzier (tspat@de.ibm.com) 12 * Author(s): Thomas Spatzier
13 * Jan Glauber (jan.glauber@de.ibm.com)
13 * 14 *
14 * Derived from "crypto/sha1.c" 15 * Derived from "crypto/sha1.c"
15 * Copyright (c) Alan Smithee. 16 * Copyright (c) Alan Smithee.
@@ -43,16 +44,14 @@ struct crypt_s390_sha1_ctx {
43static void sha1_init(struct crypto_tfm *tfm) 44static void sha1_init(struct crypto_tfm *tfm)
44{ 45{
45 struct crypt_s390_sha1_ctx *ctx = crypto_tfm_ctx(tfm); 46 struct crypt_s390_sha1_ctx *ctx = crypto_tfm_ctx(tfm);
46 static const u32 initstate[5] = { 47
47 0x67452301, 48 ctx->state[0] = 0x67452301;
48 0xEFCDAB89, 49 ctx->state[1] = 0xEFCDAB89;
49 0x98BADCFE, 50 ctx->state[2] = 0x98BADCFE;
50 0x10325476, 51 ctx->state[3] = 0x10325476;
51 0xC3D2E1F0 52 ctx->state[4] = 0xC3D2E1F0;
52 };
53 53
54 ctx->count = 0; 54 ctx->count = 0;
55 memcpy(ctx->state, &initstate, sizeof(initstate));
56 ctx->buf_len = 0; 55 ctx->buf_len = 0;
57} 56}
58 57
@@ -63,13 +62,13 @@ static void sha1_update(struct crypto_tfm *tfm, const u8 *data,
63 long imd_len; 62 long imd_len;
64 63
65 sctx = crypto_tfm_ctx(tfm); 64 sctx = crypto_tfm_ctx(tfm);
66 sctx->count += len * 8; //message bit length 65 sctx->count += len * 8; /* message bit length */
67 66
68 //anything in buffer yet? -> must be completed 67 /* anything in buffer yet? -> must be completed */
69 if (sctx->buf_len && (sctx->buf_len + len) >= SHA1_BLOCK_SIZE) { 68 if (sctx->buf_len && (sctx->buf_len + len) >= SHA1_BLOCK_SIZE) {
70 //complete full block and hash 69 /* complete full block and hash */
71 memcpy(sctx->buffer + sctx->buf_len, data, 70 memcpy(sctx->buffer + sctx->buf_len, data,
72 SHA1_BLOCK_SIZE - sctx->buf_len); 71 SHA1_BLOCK_SIZE - sctx->buf_len);
73 crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buffer, 72 crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buffer,
74 SHA1_BLOCK_SIZE); 73 SHA1_BLOCK_SIZE);
75 data += SHA1_BLOCK_SIZE - sctx->buf_len; 74 data += SHA1_BLOCK_SIZE - sctx->buf_len;
@@ -77,37 +76,36 @@ static void sha1_update(struct crypto_tfm *tfm, const u8 *data,
77 sctx->buf_len = 0; 76 sctx->buf_len = 0;
78 } 77 }
79 78
80 //rest of data contains full blocks? 79 /* rest of data contains full blocks? */
81 imd_len = len & ~0x3ful; 80 imd_len = len & ~0x3ful;
82 if (imd_len){ 81 if (imd_len) {
83 crypt_s390_kimd(KIMD_SHA_1, sctx->state, data, imd_len); 82 crypt_s390_kimd(KIMD_SHA_1, sctx->state, data, imd_len);
84 data += imd_len; 83 data += imd_len;
85 len -= imd_len; 84 len -= imd_len;
86 } 85 }
87 //anything left? store in buffer 86 /* anything left? store in buffer */
88 if (len){ 87 if (len) {
89 memcpy(sctx->buffer + sctx->buf_len , data, len); 88 memcpy(sctx->buffer + sctx->buf_len , data, len);
90 sctx->buf_len += len; 89 sctx->buf_len += len;
91 } 90 }
92} 91}
93 92
94 93
95static void 94static void pad_message(struct crypt_s390_sha1_ctx* sctx)
96pad_message(struct crypt_s390_sha1_ctx* sctx)
97{ 95{
98 int index; 96 int index;
99 97
100 index = sctx->buf_len; 98 index = sctx->buf_len;
101 sctx->buf_len = (sctx->buf_len < 56)? 99 sctx->buf_len = (sctx->buf_len < 56) ?
102 SHA1_BLOCK_SIZE:2 * SHA1_BLOCK_SIZE; 100 SHA1_BLOCK_SIZE:2 * SHA1_BLOCK_SIZE;
103 //start pad with 1 101 /* start pad with 1 */
104 sctx->buffer[index] = 0x80; 102 sctx->buffer[index] = 0x80;
105 //pad with zeros 103 /* pad with zeros */
106 index++; 104 index++;
107 memset(sctx->buffer + index, 0x00, sctx->buf_len - index); 105 memset(sctx->buffer + index, 0x00, sctx->buf_len - index);
108 //append length 106 /* append length */
109 memcpy(sctx->buffer + sctx->buf_len - 8, &sctx->count, 107 memcpy(sctx->buffer + sctx->buf_len - 8, &sctx->count,
110 sizeof sctx->count); 108 sizeof sctx->count);
111} 109}
112 110
113/* Add padding and return the message digest. */ 111/* Add padding and return the message digest. */
@@ -115,47 +113,40 @@ static void sha1_final(struct crypto_tfm *tfm, u8 *out)
115{ 113{
116 struct crypt_s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm); 114 struct crypt_s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm);
117 115
118 //must perform manual padding 116 /* must perform manual padding */
119 pad_message(sctx); 117 pad_message(sctx);
120 crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buffer, sctx->buf_len); 118 crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buffer, sctx->buf_len);
121 //copy digest to out 119 /* copy digest to out */
122 memcpy(out, sctx->state, SHA1_DIGEST_SIZE); 120 memcpy(out, sctx->state, SHA1_DIGEST_SIZE);
123 /* Wipe context */ 121 /* wipe context */
124 memset(sctx, 0, sizeof *sctx); 122 memset(sctx, 0, sizeof *sctx);
125} 123}
126 124
127static struct crypto_alg alg = { 125static struct crypto_alg alg = {
128 .cra_name = "sha1", 126 .cra_name = "sha1",
129 .cra_driver_name = "sha1-s390", 127 .cra_driver_name= "sha1-s390",
130 .cra_priority = CRYPT_S390_PRIORITY, 128 .cra_priority = CRYPT_S390_PRIORITY,
131 .cra_flags = CRYPTO_ALG_TYPE_DIGEST, 129 .cra_flags = CRYPTO_ALG_TYPE_DIGEST,
132 .cra_blocksize = SHA1_BLOCK_SIZE, 130 .cra_blocksize = SHA1_BLOCK_SIZE,
133 .cra_ctxsize = sizeof(struct crypt_s390_sha1_ctx), 131 .cra_ctxsize = sizeof(struct crypt_s390_sha1_ctx),
134 .cra_module = THIS_MODULE, 132 .cra_module = THIS_MODULE,
135 .cra_list = LIST_HEAD_INIT(alg.cra_list), 133 .cra_list = LIST_HEAD_INIT(alg.cra_list),
136 .cra_u = { .digest = { 134 .cra_u = { .digest = {
137 .dia_digestsize = SHA1_DIGEST_SIZE, 135 .dia_digestsize = SHA1_DIGEST_SIZE,
138 .dia_init = sha1_init, 136 .dia_init = sha1_init,
139 .dia_update = sha1_update, 137 .dia_update = sha1_update,
140 .dia_final = sha1_final } } 138 .dia_final = sha1_final } }
141}; 139};
142 140
143static int 141static int __init init(void)
144init(void)
145{ 142{
146 int ret = -ENOSYS; 143 if (!crypt_s390_func_available(KIMD_SHA_1))
144 return -EOPNOTSUPP;
147 145
148 if (crypt_s390_func_available(KIMD_SHA_1)){ 146 return crypto_register_alg(&alg);
149 ret = crypto_register_alg(&alg);
150 if (ret == 0){
151 printk(KERN_INFO "crypt_s390: sha1_s390 loaded.\n");
152 }
153 }
154 return ret;
155} 147}
156 148
157static void __exit 149static void __exit fini(void)
158fini(void)
159{ 150{
160 crypto_unregister_alg(&alg); 151 crypto_unregister_alg(&alg);
161} 152}
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c
index 8e4e67503fe7..78436c696d37 100644
--- a/arch/s390/crypto/sha256_s390.c
+++ b/arch/s390/crypto/sha256_s390.c
@@ -4,7 +4,7 @@
4 * s390 implementation of the SHA256 Secure Hash Algorithm. 4 * s390 implementation of the SHA256 Secure Hash Algorithm.
5 * 5 *
6 * s390 Version: 6 * s390 Version:
7 * Copyright (C) 2005 IBM Deutschland GmbH, IBM Corporation 7 * Copyright IBM Corp. 2005,2007
8 * Author(s): Jan Glauber (jang@de.ibm.com) 8 * Author(s): Jan Glauber (jang@de.ibm.com)
9 * 9 *
10 * Derived from "crypto/sha256.c" 10 * Derived from "crypto/sha256.c"
@@ -143,15 +143,10 @@ static struct crypto_alg alg = {
143 143
144static int init(void) 144static int init(void)
145{ 145{
146 int ret;
147
148 if (!crypt_s390_func_available(KIMD_SHA_256)) 146 if (!crypt_s390_func_available(KIMD_SHA_256))
149 return -ENOSYS; 147 return -EOPNOTSUPP;
150 148
151 ret = crypto_register_alg(&alg); 149 return crypto_register_alg(&alg);
152 if (ret != 0)
153 printk(KERN_INFO "crypt_s390: sha256_s390 couldn't be loaded.");
154 return ret;
155} 150}
156 151
157static void __exit fini(void) 152static void __exit fini(void)
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 5368cf4a350e..1406400bf3ea 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -108,6 +108,8 @@ CONFIG_DEFAULT_MIGRATION_COST=1000000
108CONFIG_COMPAT=y 108CONFIG_COMPAT=y
109CONFIG_SYSVIPC_COMPAT=y 109CONFIG_SYSVIPC_COMPAT=y
110CONFIG_AUDIT_ARCH=y 110CONFIG_AUDIT_ARCH=y
111CONFIG_S390_SWITCH_AMODE=y
112CONFIG_S390_EXEC_PROTECT=y
111 113
112# 114#
113# Code generation options 115# Code generation options
@@ -177,6 +179,8 @@ CONFIG_XFRM=y
177# CONFIG_XFRM_USER is not set 179# CONFIG_XFRM_USER is not set
178# CONFIG_XFRM_SUB_POLICY is not set 180# CONFIG_XFRM_SUB_POLICY is not set
179CONFIG_NET_KEY=y 181CONFIG_NET_KEY=y
182CONFIG_IUCV=m
183CONFIG_AFIUCV=m
180CONFIG_INET=y 184CONFIG_INET=y
181CONFIG_IP_MULTICAST=y 185CONFIG_IP_MULTICAST=y
182# CONFIG_IP_ADVANCED_ROUTER is not set 186# CONFIG_IP_ADVANCED_ROUTER is not set
@@ -431,7 +435,6 @@ CONFIG_TN3270_CONSOLE=y
431CONFIG_TN3215=y 435CONFIG_TN3215=y
432CONFIG_TN3215_CONSOLE=y 436CONFIG_TN3215_CONSOLE=y
433CONFIG_CCW_CONSOLE=y 437CONFIG_CCW_CONSOLE=y
434CONFIG_SCLP=y
435CONFIG_SCLP_TTY=y 438CONFIG_SCLP_TTY=y
436CONFIG_SCLP_CONSOLE=y 439CONFIG_SCLP_CONSOLE=y
437CONFIG_SCLP_VT220_TTY=y 440CONFIG_SCLP_VT220_TTY=y
@@ -507,7 +510,6 @@ CONFIG_NET_ETHERNET=y
507# 510#
508CONFIG_LCS=m 511CONFIG_LCS=m
509CONFIG_CTC=m 512CONFIG_CTC=m
510CONFIG_IUCV=m
511# CONFIG_NETIUCV is not set 513# CONFIG_NETIUCV is not set
512# CONFIG_SMSGIUCV is not set 514# CONFIG_SMSGIUCV is not set
513# CONFIG_CLAW is not set 515# CONFIG_CLAW is not set
@@ -724,9 +726,7 @@ CONFIG_CRYPTO_MANAGER=y
724# CONFIG_CRYPTO_MD4 is not set 726# CONFIG_CRYPTO_MD4 is not set
725# CONFIG_CRYPTO_MD5 is not set 727# CONFIG_CRYPTO_MD5 is not set
726# CONFIG_CRYPTO_SHA1 is not set 728# CONFIG_CRYPTO_SHA1 is not set
727# CONFIG_CRYPTO_SHA1_S390 is not set
728# CONFIG_CRYPTO_SHA256 is not set 729# CONFIG_CRYPTO_SHA256 is not set
729# CONFIG_CRYPTO_SHA256_S390 is not set
730# CONFIG_CRYPTO_SHA512 is not set 730# CONFIG_CRYPTO_SHA512 is not set
731# CONFIG_CRYPTO_WP512 is not set 731# CONFIG_CRYPTO_WP512 is not set
732# CONFIG_CRYPTO_TGR192 is not set 732# CONFIG_CRYPTO_TGR192 is not set
@@ -735,12 +735,10 @@ CONFIG_CRYPTO_ECB=m
735CONFIG_CRYPTO_CBC=y 735CONFIG_CRYPTO_CBC=y
736# CONFIG_CRYPTO_LRW is not set 736# CONFIG_CRYPTO_LRW is not set
737# CONFIG_CRYPTO_DES is not set 737# CONFIG_CRYPTO_DES is not set
738# CONFIG_CRYPTO_DES_S390 is not set
739# CONFIG_CRYPTO_BLOWFISH is not set 738# CONFIG_CRYPTO_BLOWFISH is not set
740# CONFIG_CRYPTO_TWOFISH is not set 739# CONFIG_CRYPTO_TWOFISH is not set
741# CONFIG_CRYPTO_SERPENT is not set 740# CONFIG_CRYPTO_SERPENT is not set
742# CONFIG_CRYPTO_AES is not set 741# CONFIG_CRYPTO_AES is not set
743# CONFIG_CRYPTO_AES_S390 is not set
744# CONFIG_CRYPTO_CAST5 is not set 742# CONFIG_CRYPTO_CAST5 is not set
745# CONFIG_CRYPTO_CAST6 is not set 743# CONFIG_CRYPTO_CAST6 is not set
746# CONFIG_CRYPTO_TEA is not set 744# CONFIG_CRYPTO_TEA is not set
@@ -755,6 +753,11 @@ CONFIG_CRYPTO_CBC=y
755# 753#
756# Hardware crypto devices 754# Hardware crypto devices
757# 755#
756# CONFIG_CRYPTO_SHA1_S390 is not set
757# CONFIG_CRYPTO_SHA256_S390 is not set
758# CONFIG_CRYPTO_DES_S390 is not set
759# CONFIG_CRYPTO_AES_S390 is not set
760CONFIG_S390_PRNG=m
758 761
759# 762#
760# Library routines 763# Library routines
diff --git a/arch/s390/hypfs/Makefile b/arch/s390/hypfs/Makefile
index f4b00cd81f7c..b08d2abf6178 100644
--- a/arch/s390/hypfs/Makefile
+++ b/arch/s390/hypfs/Makefile
@@ -4,4 +4,4 @@
4 4
5obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o 5obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o
6 6
7s390_hypfs-objs := inode.o hypfs_diag.o 7s390_hypfs-objs := inode.o hypfs_diag.o hypfs_vm.o
diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h
index f3dbd91965c6..aea572009d60 100644
--- a/arch/s390/hypfs/hypfs.h
+++ b/arch/s390/hypfs/hypfs.h
@@ -27,4 +27,13 @@ extern struct dentry *hypfs_create_str(struct super_block *sb,
27 struct dentry *dir, const char *name, 27 struct dentry *dir, const char *name,
28 char *string); 28 char *string);
29 29
30/* LPAR Hypervisor */
31extern int hypfs_diag_init(void);
32extern void hypfs_diag_exit(void);
33extern int hypfs_diag_create_files(struct super_block *sb, struct dentry *root);
34
35/* VM Hypervisor */
36extern int hypfs_vm_init(void);
37extern int hypfs_vm_create_files(struct super_block *sb, struct dentry *root);
38
30#endif /* _HYPFS_H_ */ 39#endif /* _HYPFS_H_ */
diff --git a/arch/s390/hypfs/hypfs_diag.h b/arch/s390/hypfs/hypfs_diag.h
deleted file mode 100644
index 256b384aebe1..000000000000
--- a/arch/s390/hypfs/hypfs_diag.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * arch/s390/hypfs_diag.h
3 * Hypervisor filesystem for Linux on s390.
4 *
5 * Copyright (C) IBM Corp. 2006
6 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
7 */
8
9#ifndef _HYPFS_DIAG_H_
10#define _HYPFS_DIAG_H_
11
12extern int hypfs_diag_init(void);
13extern void hypfs_diag_exit(void);
14extern int hypfs_diag_create_files(struct super_block *sb, struct dentry *root);
15
16#endif /* _HYPFS_DIAG_H_ */
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
new file mode 100644
index 000000000000..d01fc8f799f0
--- /dev/null
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -0,0 +1,231 @@
1/*
2 * Hypervisor filesystem for Linux on s390. z/VM implementation.
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */
7
8#include <linux/types.h>
9#include <linux/errno.h>
10#include <linux/string.h>
11#include <linux/vmalloc.h>
12#include <asm/ebcdic.h>
13#include "hypfs.h"
14
15#define NAME_LEN 8
16
17static char local_guest[] = " ";
18static char all_guests[] = "* ";
19static char *guest_query;
20
21struct diag2fc_data {
22 __u32 version;
23 __u32 flags;
24 __u64 used_cpu;
25 __u64 el_time;
26 __u64 mem_min_kb;
27 __u64 mem_max_kb;
28 __u64 mem_share_kb;
29 __u64 mem_used_kb;
30 __u32 pcpus;
31 __u32 lcpus;
32 __u32 vcpus;
33 __u32 cpu_min;
34 __u32 cpu_max;
35 __u32 cpu_shares;
36 __u32 cpu_use_samp;
37 __u32 cpu_delay_samp;
38 __u32 page_wait_samp;
39 __u32 idle_samp;
40 __u32 other_samp;
41 __u32 total_samp;
42 char guest_name[NAME_LEN];
43};
44
45struct diag2fc_parm_list {
46 char userid[NAME_LEN];
47 char aci_grp[NAME_LEN];
48 __u64 addr;
49 __u32 size;
50 __u32 fmt;
51};
52
53static int diag2fc(int size, char* query, void *addr)
54{
55 unsigned long residual_cnt;
56 unsigned long rc;
57 struct diag2fc_parm_list parm_list;
58
59 memcpy(parm_list.userid, query, NAME_LEN);
60 ASCEBC(parm_list.userid, NAME_LEN);
61 parm_list.addr = (unsigned long) addr ;
62 parm_list.size = size;
63 parm_list.fmt = 0x02;
64 memset(parm_list.aci_grp, 0x40, NAME_LEN);
65 rc = -1;
66
67 asm volatile(
68 " diag %0,%1,0x2fc\n"
69 "0:\n"
70 EX_TABLE(0b,0b)
71 : "=d" (residual_cnt), "+d" (rc) : "0" (&parm_list) : "memory");
72
73 if ((rc != 0 ) && (rc != -2))
74 return rc;
75 else
76 return -residual_cnt;
77}
78
79static struct diag2fc_data *diag2fc_store(char *query, int *count)
80{
81 int size;
82 struct diag2fc_data *data;
83
84 do {
85 size = diag2fc(0, query, NULL);
86 if (size < 0)
87 return ERR_PTR(-EACCES);
88 data = vmalloc(size);
89 if (!data)
90 return ERR_PTR(-ENOMEM);
91 if (diag2fc(size, query, data) == 0)
92 break;
93 vfree(data);
94 } while (1);
95 *count = (size / sizeof(*data));
96
97 return data;
98}
99
100static void diag2fc_free(void *data)
101{
102 vfree(data);
103}
104
105#define ATTRIBUTE(sb, dir, name, member) \
106do { \
107 void *rc; \
108 rc = hypfs_create_u64(sb, dir, name, member); \
109 if (IS_ERR(rc)) \
110 return PTR_ERR(rc); \
111} while(0)
112
113static int hpyfs_vm_create_guest(struct super_block *sb,
114 struct dentry *systems_dir,
115 struct diag2fc_data *data)
116{
117 char guest_name[NAME_LEN + 1] = {};
118 struct dentry *guest_dir, *cpus_dir, *samples_dir, *mem_dir;
119 int dedicated_flag, capped_value;
120
121 capped_value = (data->flags & 0x00000006) >> 1;
122 dedicated_flag = (data->flags & 0x00000008) >> 3;
123
124 /* guest dir */
125 memcpy(guest_name, data->guest_name, NAME_LEN);
126 EBCASC(guest_name, NAME_LEN);
127 strstrip(guest_name);
128 guest_dir = hypfs_mkdir(sb, systems_dir, guest_name);
129 if (IS_ERR(guest_dir))
130 return PTR_ERR(guest_dir);
131 ATTRIBUTE(sb, guest_dir, "onlinetime_us", data->el_time);
132
133 /* logical cpu information */
134 cpus_dir = hypfs_mkdir(sb, guest_dir, "cpus");
135 if (IS_ERR(cpus_dir))
136 return PTR_ERR(cpus_dir);
137 ATTRIBUTE(sb, cpus_dir, "cputime_us", data->used_cpu);
138 ATTRIBUTE(sb, cpus_dir, "capped", capped_value);
139 ATTRIBUTE(sb, cpus_dir, "dedicated", dedicated_flag);
140 ATTRIBUTE(sb, cpus_dir, "count", data->vcpus);
141 ATTRIBUTE(sb, cpus_dir, "weight_min", data->cpu_min);
142 ATTRIBUTE(sb, cpus_dir, "weight_max", data->cpu_max);
143 ATTRIBUTE(sb, cpus_dir, "weight_cur", data->cpu_shares);
144
145 /* memory information */
146 mem_dir = hypfs_mkdir(sb, guest_dir, "mem");
147 if (IS_ERR(mem_dir))
148 return PTR_ERR(mem_dir);
149 ATTRIBUTE(sb, mem_dir, "min_KiB", data->mem_min_kb);
150 ATTRIBUTE(sb, mem_dir, "max_KiB", data->mem_max_kb);
151 ATTRIBUTE(sb, mem_dir, "used_KiB", data->mem_used_kb);
152 ATTRIBUTE(sb, mem_dir, "share_KiB", data->mem_share_kb);
153
154 /* samples */
155 samples_dir = hypfs_mkdir(sb, guest_dir, "samples");
156 if (IS_ERR(samples_dir))
157 return PTR_ERR(samples_dir);
158 ATTRIBUTE(sb, samples_dir, "cpu_using", data->cpu_use_samp);
159 ATTRIBUTE(sb, samples_dir, "cpu_delay", data->cpu_delay_samp);
160 ATTRIBUTE(sb, samples_dir, "mem_delay", data->page_wait_samp);
161 ATTRIBUTE(sb, samples_dir, "idle", data->idle_samp);
162 ATTRIBUTE(sb, samples_dir, "other", data->other_samp);
163 ATTRIBUTE(sb, samples_dir, "total", data->total_samp);
164 return 0;
165}
166
167int hypfs_vm_create_files(struct super_block *sb, struct dentry *root)
168{
169 struct dentry *dir, *file;
170 struct diag2fc_data *data;
171 int rc, i, count = 0;
172
173 data = diag2fc_store(guest_query, &count);
174 if (IS_ERR(data))
175 return PTR_ERR(data);
176
177 /* Hpervisor Info */
178 dir = hypfs_mkdir(sb, root, "hyp");
179 if (IS_ERR(dir)) {
180 rc = PTR_ERR(dir);
181 goto failed;
182 }
183 file = hypfs_create_str(sb, dir, "type", "z/VM Hypervisor");
184 if (IS_ERR(file)) {
185 rc = PTR_ERR(file);
186 goto failed;
187 }
188
189 /* physical cpus */
190 dir = hypfs_mkdir(sb, root, "cpus");
191 if (IS_ERR(dir)) {
192 rc = PTR_ERR(dir);
193 goto failed;
194 }
195 file = hypfs_create_u64(sb, dir, "count", data->lcpus);
196 if (IS_ERR(file)) {
197 rc = PTR_ERR(file);
198 goto failed;
199 }
200
201 /* guests */
202 dir = hypfs_mkdir(sb, root, "systems");
203 if (IS_ERR(dir)) {
204 rc = PTR_ERR(dir);
205 goto failed;
206 }
207
208 for (i = 0; i < count; i++) {
209 rc = hpyfs_vm_create_guest(sb, dir, &(data[i]));
210 if (rc)
211 goto failed;
212 }
213 diag2fc_free(data);
214 return 0;
215
216failed:
217 diag2fc_free(data);
218 return rc;
219}
220
221int hypfs_vm_init(void)
222{
223 if (diag2fc(0, all_guests, NULL) > 0)
224 guest_query = all_guests;
225 else if (diag2fc(0, local_guest, NULL) > 0)
226 guest_query = local_guest;
227 else
228 return -EACCES;
229
230 return 0;
231}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index b6716c4b9934..a4fda7b53640 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -19,7 +19,6 @@
19#include <linux/module.h> 19#include <linux/module.h>
20#include <asm/ebcdic.h> 20#include <asm/ebcdic.h>
21#include "hypfs.h" 21#include "hypfs.h"
22#include "hypfs_diag.h"
23 22
24#define HYPFS_MAGIC 0x687970 /* ASCII 'hyp' */ 23#define HYPFS_MAGIC 0x687970 /* ASCII 'hyp' */
25#define TMP_SIZE 64 /* size of temporary buffers */ 24#define TMP_SIZE 64 /* size of temporary buffers */
@@ -192,7 +191,10 @@ static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
192 goto out; 191 goto out;
193 } 192 }
194 hypfs_delete_tree(sb->s_root); 193 hypfs_delete_tree(sb->s_root);
195 rc = hypfs_diag_create_files(sb, sb->s_root); 194 if (MACHINE_IS_VM)
195 rc = hypfs_vm_create_files(sb, sb->s_root);
196 else
197 rc = hypfs_diag_create_files(sb, sb->s_root);
196 if (rc) { 198 if (rc) {
197 printk(KERN_ERR "hypfs: Update failed\n"); 199 printk(KERN_ERR "hypfs: Update failed\n");
198 hypfs_delete_tree(sb->s_root); 200 hypfs_delete_tree(sb->s_root);
@@ -289,7 +291,10 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
289 rc = -ENOMEM; 291 rc = -ENOMEM;
290 goto err_alloc; 292 goto err_alloc;
291 } 293 }
292 rc = hypfs_diag_create_files(sb, root_dentry); 294 if (MACHINE_IS_VM)
295 rc = hypfs_vm_create_files(sb, root_dentry);
296 else
297 rc = hypfs_diag_create_files(sb, root_dentry);
293 if (rc) 298 if (rc)
294 goto err_tree; 299 goto err_tree;
295 sbi->update_file = hypfs_create_update_file(sb, root_dentry); 300 sbi->update_file = hypfs_create_update_file(sb, root_dentry);
@@ -462,11 +467,15 @@ static int __init hypfs_init(void)
462{ 467{
463 int rc; 468 int rc;
464 469
465 if (MACHINE_IS_VM) 470 if (MACHINE_IS_VM) {
466 return -ENODATA; 471 if (hypfs_vm_init())
467 if (hypfs_diag_init()) { 472 /* no diag 2fc, just exit */
468 rc = -ENODATA; 473 return -ENODATA;
469 goto fail_diag; 474 } else {
475 if (hypfs_diag_init()) {
476 rc = -ENODATA;
477 goto fail_diag;
478 }
470 } 479 }
471 kset_set_kset_s(&s390_subsys, hypervisor_subsys); 480 kset_set_kset_s(&s390_subsys, hypervisor_subsys);
472 rc = subsystem_register(&s390_subsys); 481 rc = subsystem_register(&s390_subsys);
@@ -480,7 +489,8 @@ static int __init hypfs_init(void)
480fail_filesystem: 489fail_filesystem:
481 subsystem_unregister(&s390_subsys); 490 subsystem_unregister(&s390_subsys);
482fail_sysfs: 491fail_sysfs:
483 hypfs_diag_exit(); 492 if (!MACHINE_IS_VM)
493 hypfs_diag_exit();
484fail_diag: 494fail_diag:
485 printk(KERN_ERR "hypfs: Initialization failed with rc = %i.\n", rc); 495 printk(KERN_ERR "hypfs: Initialization failed with rc = %i.\n", rc);
486 return rc; 496 return rc;
@@ -488,7 +498,8 @@ fail_diag:
488 498
489static void __exit hypfs_exit(void) 499static void __exit hypfs_exit(void)
490{ 500{
491 hypfs_diag_exit(); 501 if (!MACHINE_IS_VM)
502 hypfs_diag_exit();
492 unregister_filesystem(&hypfs_type); 503 unregister_filesystem(&hypfs_type);
493 subsystem_unregister(&s390_subsys); 504 subsystem_unregister(&s390_subsys);
494} 505}
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index a81881c9b297..5492d25d7d69 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -4,9 +4,9 @@
4 4
5EXTRA_AFLAGS := -traditional 5EXTRA_AFLAGS := -traditional
6 6
7obj-y := bitmap.o traps.o time.o process.o reset.o \ 7obj-y := bitmap.o traps.o time.o process.o base.o early.o \
8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ 8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
9 semaphore.o s390_ext.o debug.o profile.o irq.o ipl.o 9 semaphore.o s390_ext.o debug.o irq.o ipl.o
10 10
11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
diff --git a/arch/s390/kernel/base.S b/arch/s390/kernel/base.S
new file mode 100644
index 000000000000..dc7e5259770f
--- /dev/null
+++ b/arch/s390/kernel/base.S
@@ -0,0 +1,150 @@
1/*
2 * arch/s390/kernel/base.S
3 *
4 * Copyright IBM Corp. 2006,2007
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 * Michael Holzheu <holzheu@de.ibm.com>
7 */
8
9#include <asm/ptrace.h>
10#include <asm/lowcore.h>
11
12#ifdef CONFIG_64BIT
13
14 .globl s390_base_mcck_handler
15s390_base_mcck_handler:
16 basr %r13,0
170: lg %r15,__LC_PANIC_STACK # load panic stack
18 aghi %r15,-STACK_FRAME_OVERHEAD
19 larl %r1,s390_base_mcck_handler_fn
20 lg %r1,0(%r1)
21 ltgr %r1,%r1
22 jz 1f
23 basr %r14,%r1
241: la %r1,4095
25 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)
26 lpswe __LC_MCK_OLD_PSW
27
28 .section .bss
29 .globl s390_base_mcck_handler_fn
30s390_base_mcck_handler_fn:
31 .quad 0
32 .previous
33
34 .globl s390_base_ext_handler
35s390_base_ext_handler:
36 stmg %r0,%r15,__LC_SAVE_AREA
37 basr %r13,0
380: aghi %r15,-STACK_FRAME_OVERHEAD
39 larl %r1,s390_base_ext_handler_fn
40 lg %r1,0(%r1)
41 ltgr %r1,%r1
42 jz 1f
43 basr %r14,%r1
441: lmg %r0,%r15,__LC_SAVE_AREA
45 ni __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
46 lpswe __LC_EXT_OLD_PSW
47
48 .section .bss
49 .globl s390_base_ext_handler_fn
50s390_base_ext_handler_fn:
51 .quad 0
52 .previous
53
54 .globl s390_base_pgm_handler
55s390_base_pgm_handler:
56 stmg %r0,%r15,__LC_SAVE_AREA
57 basr %r13,0
580: aghi %r15,-STACK_FRAME_OVERHEAD
59 larl %r1,s390_base_pgm_handler_fn
60 lg %r1,0(%r1)
61 ltgr %r1,%r1
62 jz 1f
63 basr %r14,%r1
64 lmg %r0,%r15,__LC_SAVE_AREA
65 lpswe __LC_PGM_OLD_PSW
661: lpswe disabled_wait_psw-0b(%r13)
67
68 .align 8
69disabled_wait_psw:
70 .quad 0x0002000180000000,0x0000000000000000 + s390_base_pgm_handler
71
72 .section .bss
73 .globl s390_base_pgm_handler_fn
74s390_base_pgm_handler_fn:
75 .quad 0
76 .previous
77
78#else /* CONFIG_64BIT */
79
80 .globl s390_base_mcck_handler
81s390_base_mcck_handler:
82 basr %r13,0
830: l %r15,__LC_PANIC_STACK # load panic stack
84 ahi %r15,-STACK_FRAME_OVERHEAD
85 l %r1,2f-0b(%r13)
86 l %r1,0(%r1)
87 ltr %r1,%r1
88 jz 1f
89 basr %r14,%r1
901: lm %r0,%r15,__LC_GPREGS_SAVE_AREA
91 lpsw __LC_MCK_OLD_PSW
92
932: .long s390_base_mcck_handler_fn
94
95 .section .bss
96 .globl s390_base_mcck_handler_fn
97s390_base_mcck_handler_fn:
98 .long 0
99 .previous
100
101 .globl s390_base_ext_handler
102s390_base_ext_handler:
103 stm %r0,%r15,__LC_SAVE_AREA
104 basr %r13,0
1050: ahi %r15,-STACK_FRAME_OVERHEAD
106 l %r1,2f-0b(%r13)
107 l %r1,0(%r1)
108 ltr %r1,%r1
109 jz 1f
110 basr %r14,%r1
1111: lm %r0,%r15,__LC_SAVE_AREA
112 ni __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
113 lpsw __LC_EXT_OLD_PSW
114
1152: .long s390_base_ext_handler_fn
116
117 .section .bss
118 .globl s390_base_ext_handler_fn
119s390_base_ext_handler_fn:
120 .long 0
121 .previous
122
123 .globl s390_base_pgm_handler
124s390_base_pgm_handler:
125 stm %r0,%r15,__LC_SAVE_AREA
126 basr %r13,0
1270: ahi %r15,-STACK_FRAME_OVERHEAD
128 l %r1,2f-0b(%r13)
129 l %r1,0(%r1)
130 ltr %r1,%r1
131 jz 1f
132 basr %r14,%r1
133 lm %r0,%r15,__LC_SAVE_AREA
134 lpsw __LC_PGM_OLD_PSW
135
1361: lpsw disabled_wait_psw-0b(%r13)
137
1382: .long s390_base_pgm_handler_fn
139
140disabled_wait_psw:
141 .align 8
142 .long 0x000a0000,0x00000000 + s390_base_pgm_handler
143
144 .section .bss
145 .globl s390_base_pgm_handler_fn
146s390_base_pgm_handler_fn:
147 .long 0
148 .previous
149
150#endif /* CONFIG_64BIT */
diff --git a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c
index 5c46054195cb..f1e40ca00d8d 100644
--- a/arch/s390/kernel/binfmt_elf32.c
+++ b/arch/s390/kernel/binfmt_elf32.c
@@ -192,7 +192,7 @@ MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>");
192 192
193#undef cputime_to_timeval 193#undef cputime_to_timeval
194#define cputime_to_timeval cputime_to_compat_timeval 194#define cputime_to_timeval cputime_to_compat_timeval
195static __inline__ void 195static inline void
196cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value) 196cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
197{ 197{
198 value->tv_usec = cputime % 1000000; 198 value->tv_usec = cputime % 1000000;
diff --git a/arch/s390/kernel/compat_exec_domain.c b/arch/s390/kernel/compat_exec_domain.c
index 71d27c493568..914d49444f92 100644
--- a/arch/s390/kernel/compat_exec_domain.c
+++ b/arch/s390/kernel/compat_exec_domain.c
@@ -12,10 +12,9 @@
12#include <linux/personality.h> 12#include <linux/personality.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14 14
15struct exec_domain s390_exec_domain; 15static struct exec_domain s390_exec_domain;
16 16
17static int __init 17static int __init s390_init (void)
18s390_init (void)
19{ 18{
20 s390_exec_domain.name = "Linux/s390"; 19 s390_exec_domain.name = "Linux/s390";
21 s390_exec_domain.handler = NULL; 20 s390_exec_domain.handler = NULL;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 5b33f823863a..666bb6daa148 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -69,6 +69,12 @@
69 69
70#include "compat_linux.h" 70#include "compat_linux.h"
71 71
72long psw_user32_bits = (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME |
73 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK |
74 PSW_MASK_PSTATE | PSW_DEFAULT_KEY);
75long psw32_user_bits = (PSW32_BASE_BITS | PSW32_MASK_DAT | PSW32_ASC_HOME |
76 PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK |
77 PSW32_MASK_PSTATE);
72 78
73/* For this source file, we want overflow handling. */ 79/* For this source file, we want overflow handling. */
74 80
@@ -416,7 +422,7 @@ asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
416 mm_segment_t old_fs = get_fs (); 422 mm_segment_t old_fs = get_fs ();
417 423
418 set_fs (KERNEL_DS); 424 set_fs (KERNEL_DS);
419 ret = sys_sysinfo((struct sysinfo __user *) &s); 425 ret = sys_sysinfo((struct sysinfo __force __user *) &s);
420 set_fs (old_fs); 426 set_fs (old_fs);
421 err = put_user (s.uptime, &info->uptime); 427 err = put_user (s.uptime, &info->uptime);
422 err |= __put_user (s.loads[0], &info->loads[0]); 428 err |= __put_user (s.loads[0], &info->loads[0]);
@@ -445,7 +451,8 @@ asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid,
445 mm_segment_t old_fs = get_fs (); 451 mm_segment_t old_fs = get_fs ();
446 452
447 set_fs (KERNEL_DS); 453 set_fs (KERNEL_DS);
448 ret = sys_sched_rr_get_interval(pid, (struct timespec __user *) &t); 454 ret = sys_sched_rr_get_interval(pid,
455 (struct timespec __force __user *) &t);
449 set_fs (old_fs); 456 set_fs (old_fs);
450 if (put_compat_timespec(&t, interval)) 457 if (put_compat_timespec(&t, interval))
451 return -EFAULT; 458 return -EFAULT;
@@ -472,8 +479,8 @@ asmlinkage long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
472 } 479 }
473 set_fs (KERNEL_DS); 480 set_fs (KERNEL_DS);
474 ret = sys_rt_sigprocmask(how, 481 ret = sys_rt_sigprocmask(how,
475 set ? (sigset_t __user *) &s : NULL, 482 set ? (sigset_t __force __user *) &s : NULL,
476 oset ? (sigset_t __user *) &s : NULL, 483 oset ? (sigset_t __force __user *) &s : NULL,
477 sigsetsize); 484 sigsetsize);
478 set_fs (old_fs); 485 set_fs (old_fs);
479 if (ret) return ret; 486 if (ret) return ret;
@@ -499,7 +506,7 @@ asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
499 mm_segment_t old_fs = get_fs(); 506 mm_segment_t old_fs = get_fs();
500 507
501 set_fs (KERNEL_DS); 508 set_fs (KERNEL_DS);
502 ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize); 509 ret = sys_rt_sigpending((sigset_t __force __user *) &s, sigsetsize);
503 set_fs (old_fs); 510 set_fs (old_fs);
504 if (!ret) { 511 if (!ret) {
505 switch (_NSIG_WORDS) { 512 switch (_NSIG_WORDS) {
@@ -524,7 +531,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
524 if (copy_siginfo_from_user32(&info, uinfo)) 531 if (copy_siginfo_from_user32(&info, uinfo))
525 return -EFAULT; 532 return -EFAULT;
526 set_fs (KERNEL_DS); 533 set_fs (KERNEL_DS);
527 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info); 534 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __force __user *) &info);
528 set_fs (old_fs); 535 set_fs (old_fs);
529 return ret; 536 return ret;
530} 537}
@@ -682,7 +689,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offse
682 689
683 set_fs(KERNEL_DS); 690 set_fs(KERNEL_DS);
684 ret = sys_sendfile(out_fd, in_fd, 691 ret = sys_sendfile(out_fd, in_fd,
685 offset ? (off_t __user *) &of : NULL, count); 692 offset ? (off_t __force __user *) &of : NULL, count);
686 set_fs(old_fs); 693 set_fs(old_fs);
687 694
688 if (offset && put_user(of, offset)) 695 if (offset && put_user(of, offset))
@@ -703,7 +710,8 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
703 710
704 set_fs(KERNEL_DS); 711 set_fs(KERNEL_DS);
705 ret = sys_sendfile64(out_fd, in_fd, 712 ret = sys_sendfile64(out_fd, in_fd,
706 offset ? (loff_t __user *) &lof : NULL, count); 713 offset ? (loff_t __force __user *) &lof : NULL,
714 count);
707 set_fs(old_fs); 715 set_fs(old_fs);
708 716
709 if (offset && put_user(lof, offset)) 717 if (offset && put_user(lof, offset))
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 1a18e29668ef..e89f8c0c42a0 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -115,37 +115,6 @@ typedef struct
115 __u32 addr; 115 __u32 addr;
116} _psw_t32 __attribute__ ((aligned(8))); 116} _psw_t32 __attribute__ ((aligned(8)));
117 117
118#define PSW32_MASK_PER 0x40000000UL
119#define PSW32_MASK_DAT 0x04000000UL
120#define PSW32_MASK_IO 0x02000000UL
121#define PSW32_MASK_EXT 0x01000000UL
122#define PSW32_MASK_KEY 0x00F00000UL
123#define PSW32_MASK_MCHECK 0x00040000UL
124#define PSW32_MASK_WAIT 0x00020000UL
125#define PSW32_MASK_PSTATE 0x00010000UL
126#define PSW32_MASK_ASC 0x0000C000UL
127#define PSW32_MASK_CC 0x00003000UL
128#define PSW32_MASK_PM 0x00000f00UL
129
130#define PSW32_ADDR_AMODE31 0x80000000UL
131#define PSW32_ADDR_INSN 0x7FFFFFFFUL
132
133#define PSW32_BASE_BITS 0x00080000UL
134
135#define PSW32_ASC_PRIMARY 0x00000000UL
136#define PSW32_ASC_ACCREG 0x00004000UL
137#define PSW32_ASC_SECONDARY 0x00008000UL
138#define PSW32_ASC_HOME 0x0000C000UL
139
140#define PSW32_USER_BITS (PSW32_BASE_BITS | PSW32_MASK_DAT | PSW32_ASC_HOME | \
141 PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK | \
142 PSW32_MASK_PSTATE)
143
144#define PSW32_MASK_MERGE(CURRENT,NEW) \
145 (((CURRENT) & ~(PSW32_MASK_CC|PSW32_MASK_PM)) | \
146 ((NEW) & (PSW32_MASK_CC|PSW32_MASK_PM)))
147
148
149typedef struct 118typedef struct
150{ 119{
151 _psw_t32 psw; 120 _psw_t32 psw;
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 861888ab8c13..887a9881d0d0 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -275,8 +275,8 @@ sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss,
275 } 275 }
276 276
277 set_fs (KERNEL_DS); 277 set_fs (KERNEL_DS);
278 ret = do_sigaltstack((stack_t __user *) (uss ? &kss : NULL), 278 ret = do_sigaltstack((stack_t __force __user *) (uss ? &kss : NULL),
279 (stack_t __user *) (uoss ? &koss : NULL), 279 (stack_t __force __user *) (uoss ? &koss : NULL),
280 regs->gprs[15]); 280 regs->gprs[15]);
281 set_fs (old_fs); 281 set_fs (old_fs);
282 282
@@ -298,7 +298,7 @@ static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
298 _s390_regs_common32 regs32; 298 _s390_regs_common32 regs32;
299 int err, i; 299 int err, i;
300 300
301 regs32.psw.mask = PSW32_MASK_MERGE(PSW32_USER_BITS, 301 regs32.psw.mask = PSW32_MASK_MERGE(psw32_user_bits,
302 (__u32)(regs->psw.mask >> 32)); 302 (__u32)(regs->psw.mask >> 32));
303 regs32.psw.addr = PSW32_ADDR_AMODE31 | (__u32) regs->psw.addr; 303 regs32.psw.addr = PSW32_ADDR_AMODE31 | (__u32) regs->psw.addr;
304 for (i = 0; i < NUM_GPRS; i++) 304 for (i = 0; i < NUM_GPRS; i++)
@@ -401,7 +401,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
401 goto badframe; 401 goto badframe;
402 402
403 set_fs (KERNEL_DS); 403 set_fs (KERNEL_DS);
404 do_sigaltstack((stack_t __user *)&st, NULL, regs->gprs[15]); 404 do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]);
405 set_fs (old_fs); 405 set_fs (old_fs);
406 406
407 return regs->gprs[2]; 407 return regs->gprs[2];
diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
index a5972f1541fe..6c89f30c8e31 100644
--- a/arch/s390/kernel/cpcmd.c
+++ b/arch/s390/kernel/cpcmd.c
@@ -16,6 +16,7 @@
16#include <asm/ebcdic.h> 16#include <asm/ebcdic.h>
17#include <asm/cpcmd.h> 17#include <asm/cpcmd.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/io.h>
19 20
20static DEFINE_SPINLOCK(cpcmd_lock); 21static DEFINE_SPINLOCK(cpcmd_lock);
21static char cpcmd_buf[241]; 22static char cpcmd_buf[241];
@@ -88,13 +89,8 @@ int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
88 int len; 89 int len;
89 unsigned long flags; 90 unsigned long flags;
90 91
91 if ((rlen == 0) || (response == NULL) 92 if ((virt_to_phys(response) != (unsigned long) response) ||
92 || !((unsigned long)response >> 31)) { 93 (((unsigned long)response + rlen) >> 31)) {
93 spin_lock_irqsave(&cpcmd_lock, flags);
94 len = __cpcmd(cmd, response, rlen, response_code);
95 spin_unlock_irqrestore(&cpcmd_lock, flags);
96 }
97 else {
98 lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA); 94 lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA);
99 if (!lowbuf) { 95 if (!lowbuf) {
100 printk(KERN_WARNING 96 printk(KERN_WARNING
@@ -106,6 +102,10 @@ int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
106 spin_unlock_irqrestore(&cpcmd_lock, flags); 102 spin_unlock_irqrestore(&cpcmd_lock, flags);
107 memcpy(response, lowbuf, rlen); 103 memcpy(response, lowbuf, rlen);
108 kfree(lowbuf); 104 kfree(lowbuf);
105 } else {
106 spin_lock_irqsave(&cpcmd_lock, flags);
107 len = __cpcmd(cmd, response, rlen, response_code);
108 spin_unlock_irqrestore(&cpcmd_lock, flags);
109 } 109 }
110 return len; 110 return len;
111} 111}
diff --git a/arch/s390/kernel/crash.c b/arch/s390/kernel/crash.c
index 926cceeae0fa..8cc7c9fa64f5 100644
--- a/arch/s390/kernel/crash.c
+++ b/arch/s390/kernel/crash.c
@@ -9,6 +9,7 @@
9 9
10#include <linux/threads.h> 10#include <linux/threads.h>
11#include <linux/kexec.h> 11#include <linux/kexec.h>
12#include <linux/reboot.h>
12 13
13void machine_crash_shutdown(struct pt_regs *regs) 14void machine_crash_shutdown(struct pt_regs *regs)
14{ 15{
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index bb57bc0e3fc8..f4b62df02aa2 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -120,7 +120,7 @@ struct debug_view debug_hex_ascii_view = {
120 NULL 120 NULL
121}; 121};
122 122
123struct debug_view debug_level_view = { 123static struct debug_view debug_level_view = {
124 "level", 124 "level",
125 &debug_prolog_level_fn, 125 &debug_prolog_level_fn,
126 NULL, 126 NULL,
@@ -129,7 +129,7 @@ struct debug_view debug_level_view = {
129 NULL 129 NULL
130}; 130};
131 131
132struct debug_view debug_pages_view = { 132static struct debug_view debug_pages_view = {
133 "pages", 133 "pages",
134 &debug_prolog_pages_fn, 134 &debug_prolog_pages_fn,
135 NULL, 135 NULL,
@@ -138,7 +138,7 @@ struct debug_view debug_pages_view = {
138 NULL 138 NULL
139}; 139};
140 140
141struct debug_view debug_flush_view = { 141static struct debug_view debug_flush_view = {
142 "flush", 142 "flush",
143 NULL, 143 NULL,
144 NULL, 144 NULL,
@@ -156,14 +156,14 @@ struct debug_view debug_sprintf_view = {
156 NULL 156 NULL
157}; 157};
158 158
159 159/* used by dump analysis tools to determine version of debug feature */
160unsigned int debug_feature_version = __DEBUG_FEATURE_VERSION; 160unsigned int debug_feature_version = __DEBUG_FEATURE_VERSION;
161 161
162/* static globals */ 162/* static globals */
163 163
164static debug_info_t *debug_area_first = NULL; 164static debug_info_t *debug_area_first = NULL;
165static debug_info_t *debug_area_last = NULL; 165static debug_info_t *debug_area_last = NULL;
166DECLARE_MUTEX(debug_lock); 166static DECLARE_MUTEX(debug_lock);
167 167
168static int initialized; 168static int initialized;
169 169
@@ -905,7 +905,7 @@ static struct ctl_table s390dbf_dir_table[] = {
905 { .ctl_name = 0 } 905 { .ctl_name = 0 }
906}; 906};
907 907
908struct ctl_table_header *s390dbf_sysctl_header; 908static struct ctl_table_header *s390dbf_sysctl_header;
909 909
910void 910void
911debug_stop_all(void) 911debug_stop_all(void)
@@ -1300,8 +1300,7 @@ out:
1300 * flushes debug areas 1300 * flushes debug areas
1301 */ 1301 */
1302 1302
1303void 1303static void debug_flush(debug_info_t* id, int area)
1304debug_flush(debug_info_t* id, int area)
1305{ 1304{
1306 unsigned long flags; 1305 unsigned long flags;
1307 int i,j; 1306 int i,j;
@@ -1511,8 +1510,7 @@ out:
1511/* 1510/*
1512 * clean up module 1511 * clean up module
1513 */ 1512 */
1514void 1513static void __exit debug_exit(void)
1515__exit debug_exit(void)
1516{ 1514{
1517 debugfs_remove(debug_debugfs_root_entry); 1515 debugfs_remove(debug_debugfs_root_entry);
1518 unregister_sysctl_table(s390dbf_sysctl_header); 1516 unregister_sysctl_table(s390dbf_sysctl_header);
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
new file mode 100644
index 000000000000..e518dd53eff5
--- /dev/null
+++ b/arch/s390/kernel/early.c
@@ -0,0 +1,306 @@
1/*
2 * arch/s390/kernel/early.c
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Hongjie Yang <hongjie@us.ibm.com>,
6 * Heiko Carstens <heiko.carstens@de.ibm.com>
7 */
8
9#include <linux/init.h>
10#include <linux/errno.h>
11#include <linux/string.h>
12#include <linux/ctype.h>
13#include <linux/lockdep.h>
14#include <linux/module.h>
15#include <linux/pfn.h>
16#include <linux/uaccess.h>
17#include <asm/lowcore.h>
18#include <asm/processor.h>
19#include <asm/sections.h>
20#include <asm/setup.h>
21#include <asm/cpcmd.h>
22#include <asm/sclp.h>
23
24/*
25 * Create a Kernel NSS if the SAVESYS= parameter is defined
26 */
27#define DEFSYS_CMD_SIZE 96
28#define SAVESYS_CMD_SIZE 32
29
30char kernel_nss_name[NSS_NAME_SIZE + 1];
31
32#ifdef CONFIG_SHARED_KERNEL
33static noinline __init void create_kernel_nss(void)
34{
35 unsigned int i, stext_pfn, eshared_pfn, end_pfn, min_size;
36#ifdef CONFIG_BLK_DEV_INITRD
37 unsigned int sinitrd_pfn, einitrd_pfn;
38#endif
39 int response;
40 char *savesys_ptr;
41 char upper_command_line[COMMAND_LINE_SIZE];
42 char defsys_cmd[DEFSYS_CMD_SIZE];
43 char savesys_cmd[SAVESYS_CMD_SIZE];
44
45 /* Do nothing if we are not running under VM */
46 if (!MACHINE_IS_VM)
47 return;
48
49 /* Convert COMMAND_LINE to upper case */
50 for (i = 0; i < strlen(COMMAND_LINE); i++)
51 upper_command_line[i] = toupper(COMMAND_LINE[i]);
52
53 savesys_ptr = strstr(upper_command_line, "SAVESYS=");
54
55 if (!savesys_ptr)
56 return;
57
58 savesys_ptr += 8; /* Point to the beginning of the NSS name */
59 for (i = 0; i < NSS_NAME_SIZE; i++) {
60 if (savesys_ptr[i] == ' ' || savesys_ptr[i] == '\0')
61 break;
62 kernel_nss_name[i] = savesys_ptr[i];
63 }
64
65 stext_pfn = PFN_DOWN(__pa(&_stext));
66 eshared_pfn = PFN_DOWN(__pa(&_eshared));
67 end_pfn = PFN_UP(__pa(&_end));
68 min_size = end_pfn << 2;
69
70 sprintf(defsys_cmd, "DEFSYS %s 00000-%.5X EW %.5X-%.5X SR %.5X-%.5X",
71 kernel_nss_name, stext_pfn - 1, stext_pfn, eshared_pfn - 1,
72 eshared_pfn, end_pfn);
73
74#ifdef CONFIG_BLK_DEV_INITRD
75 if (INITRD_START && INITRD_SIZE) {
76 sinitrd_pfn = PFN_DOWN(__pa(INITRD_START));
77 einitrd_pfn = PFN_UP(__pa(INITRD_START + INITRD_SIZE));
78 min_size = einitrd_pfn << 2;
79 sprintf(defsys_cmd, "%s EW %.5X-%.5X", defsys_cmd,
80 sinitrd_pfn, einitrd_pfn);
81 }
82#endif
83
84 sprintf(defsys_cmd, "%s EW MINSIZE=%.7iK", defsys_cmd, min_size);
85 sprintf(savesys_cmd, "SAVESYS %s \n IPL %s",
86 kernel_nss_name, kernel_nss_name);
87
88 __cpcmd(defsys_cmd, NULL, 0, &response);
89
90 if (response != 0)
91 return;
92
93 __cpcmd(savesys_cmd, NULL, 0, &response);
94
95 if (response != strlen(savesys_cmd))
96 return;
97
98 ipl_flags = IPL_NSS_VALID;
99}
100
101#else /* CONFIG_SHARED_KERNEL */
102
103static inline void create_kernel_nss(void) { }
104
105#endif /* CONFIG_SHARED_KERNEL */
106
107/*
108 * Clear bss memory
109 */
110static noinline __init void clear_bss_section(void)
111{
112 memset(__bss_start, 0, _end - __bss_start);
113}
114
115/*
116 * Initialize storage key for kernel pages
117 */
118static noinline __init void init_kernel_storage_key(void)
119{
120 unsigned long end_pfn, init_pfn;
121
122 end_pfn = PFN_UP(__pa(&_end));
123
124 for (init_pfn = 0 ; init_pfn < end_pfn; init_pfn++)
125 page_set_storage_key(init_pfn << PAGE_SHIFT, PAGE_DEFAULT_KEY);
126}
127
128static noinline __init void detect_machine_type(void)
129{
130 struct cpuinfo_S390 *cpuinfo = &S390_lowcore.cpu_data;
131
132 asm volatile("stidp %0" : "=m" (S390_lowcore.cpu_data.cpu_id));
133
134 /* Running under z/VM ? */
135 if (cpuinfo->cpu_id.version == 0xff)
136 machine_flags |= 1;
137
138 /* Running on a P/390 ? */
139 if (cpuinfo->cpu_id.machine == 0x7490)
140 machine_flags |= 4;
141}
142
143static noinline __init int memory_fast_detect(void)
144{
145
146 unsigned long val0 = 0;
147 unsigned long val1 = 0xc;
148 int ret = -ENOSYS;
149
150 if (ipl_flags & IPL_NSS_VALID)
151 return -ENOSYS;
152
153 asm volatile(
154 " diag %1,%2,0x260\n"
155 "0: lhi %0,0\n"
156 "1:\n"
157 EX_TABLE(0b,1b)
158 : "+d" (ret), "+d" (val0), "+d" (val1) : : "cc");
159
160 if (ret || val0 != val1)
161 return -ENOSYS;
162
163 memory_chunk[0].size = val0;
164 return 0;
165}
166
167#define ADDR2G (1UL << 31)
168
169static noinline __init unsigned long sclp_memory_detect(void)
170{
171 struct sclp_readinfo_sccb *sccb;
172 unsigned long long memsize;
173
174 sccb = &s390_readinfo_sccb;
175
176 if (sccb->header.response_code != 0x10)
177 return 0;
178
179 if (sccb->rnsize)
180 memsize = sccb->rnsize << 20;
181 else
182 memsize = sccb->rnsize2 << 20;
183 if (sccb->rnmax)
184 memsize *= sccb->rnmax;
185 else
186 memsize *= sccb->rnmax2;
187#ifndef CONFIG_64BIT
188 /*
189 * Can't deal with more than 2G in 31 bit addressing mode, so
190 * limit the value in order to avoid strange side effects.
191 */
192 if (memsize > ADDR2G)
193 memsize = ADDR2G;
194#endif
195 return (unsigned long) memsize;
196}
197
198static inline __init unsigned long __tprot(unsigned long addr)
199{
200 int cc = -1;
201
202 asm volatile(
203 " tprot 0(%1),0\n"
204 "0: ipm %0\n"
205 " srl %0,28\n"
206 "1:\n"
207 EX_TABLE(0b,1b)
208 : "+d" (cc) : "a" (addr) : "cc");
209 return (unsigned long)cc;
210}
211
212/* Checking memory in 128KB increments. */
213#define CHUNK_INCR (1UL << 17)
214
215static noinline __init void find_memory_chunks(unsigned long memsize)
216{
217 unsigned long addr = 0, old_addr = 0;
218 unsigned long old_cc = CHUNK_READ_WRITE;
219 unsigned long cc;
220 int chunk = 0;
221
222 while (chunk < MEMORY_CHUNKS) {
223 cc = __tprot(addr);
224 while (cc == old_cc) {
225 addr += CHUNK_INCR;
226 cc = __tprot(addr);
227#ifndef CONFIG_64BIT
228 if (addr == ADDR2G)
229 break;
230#endif
231 }
232
233 if (old_addr != addr &&
234 (old_cc == CHUNK_READ_WRITE || old_cc == CHUNK_READ_ONLY)) {
235 memory_chunk[chunk].addr = old_addr;
236 memory_chunk[chunk].size = addr - old_addr;
237 memory_chunk[chunk].type = old_cc;
238 chunk++;
239 }
240
241 old_addr = addr;
242 old_cc = cc;
243
244#ifndef CONFIG_64BIT
245 if (addr == ADDR2G)
246 break;
247#endif
248 /*
249 * Finish memory detection at the first hole, unless
250 * - we reached the hsa -> skip it.
251 * - we know there must be more.
252 */
253 if (cc == -1UL && !memsize && old_addr != ADDR2G)
254 break;
255 if (memsize && addr >= memsize)
256 break;
257 }
258}
259
260static __init void early_pgm_check_handler(void)
261{
262 unsigned long addr;
263 const struct exception_table_entry *fixup;
264
265 addr = S390_lowcore.program_old_psw.addr;
266 fixup = search_exception_tables(addr & PSW_ADDR_INSN);
267 if (!fixup)
268 disabled_wait(0);
269 S390_lowcore.program_old_psw.addr = fixup->fixup | PSW_ADDR_AMODE;
270}
271
272static noinline __init void setup_lowcore_early(void)
273{
274 psw_t psw;
275
276 psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
277 psw.addr = PSW_ADDR_AMODE | (unsigned long) s390_base_ext_handler;
278 S390_lowcore.external_new_psw = psw;
279 psw.addr = PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler;
280 S390_lowcore.program_new_psw = psw;
281 s390_base_pgm_handler_fn = early_pgm_check_handler;
282}
283
284/*
285 * Save ipl parameters, clear bss memory, initialize storage keys
286 * and create a kernel NSS at startup if the SAVESYS= parm is defined
287 */
288void __init startup_init(void)
289{
290 unsigned long memsize;
291
292 ipl_save_parameters();
293 clear_bss_section();
294 init_kernel_storage_key();
295 lockdep_init();
296 lockdep_off();
297 detect_machine_type();
298 create_kernel_nss();
299 sort_main_extable();
300 setup_lowcore_early();
301 sclp_readinfo_early();
302 memsize = sclp_memory_detect();
303 if (memory_fast_detect() < 0)
304 find_memory_chunks(memsize);
305 lockdep_on();
306}
diff --git a/arch/s390/kernel/ebcdic.c b/arch/s390/kernel/ebcdic.c
index bb0f973137f0..cc0dc609d738 100644
--- a/arch/s390/kernel/ebcdic.c
+++ b/arch/s390/kernel/ebcdic.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <asm/types.h> 13#include <asm/types.h>
14#include <asm/ebcdic.h>
14 15
15/* 16/*
16 * ASCII (IBM PC 437) -> EBCDIC 037 17 * ASCII (IBM PC 437) -> EBCDIC 037
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index eca507050e47..453fd3b4edea 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -51,176 +51,15 @@ startup_continue:
51 st %r15,__LC_KERNEL_STACK # set end of kernel stack 51 st %r15,__LC_KERNEL_STACK # set end of kernel stack
52 ahi %r15,-96 52 ahi %r15,-96
53 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # clear backchain 53 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # clear backchain
54
55 l %r14,.Lipl_save_parameters-.LPG1(%r13)
56 basr %r14,%r14
57# 54#
58# clear bss memory 55# Save ipl parameters, clear bss memory, initialize storage key for kernel pages,
56# and create a kernel NSS if the SAVESYS= parm is defined
59# 57#
60 l %r2,.Lbss_bgn-.LPG1(%r13) # start of bss 58 l %r14,.Lstartup_init-.LPG1(%r13)
61 l %r3,.Lbss_end-.LPG1(%r13) # end of bss 59 basr %r14,%r14
62 sr %r3,%r2 # length of bss
63 sr %r4,%r4
64 sr %r5,%r5 # set src,length and pad to zero
65 sr %r0,%r0
66 mvcle %r2,%r4,0 # clear mem
67 jo .-4 # branch back, if not finish
68
69 l %r2,.Lrcp-.LPG1(%r13) # Read SCP forced command word
70.Lservicecall:
71 stosm .Lpmask-.LPG1(%r13),0x01 # authorize ext interrupts
72
73 stctl %r0, %r0,.Lcr-.LPG1(%r13) # get cr0
74 la %r1,0x200 # set bit 22
75 o %r1,.Lcr-.LPG1(%r13) # or old cr0 with r1
76 st %r1,.Lcr-.LPG1(%r13)
77 lctl %r0, %r0,.Lcr-.LPG1(%r13) # load modified cr0
78
79 mvc __LC_EXT_NEW_PSW(8),.Lpcext-.LPG1(%r13) # set postcall psw
80 la %r1, .Lsclph-.LPG1(%r13)
81 a %r1,__LC_EXT_NEW_PSW+4 # set handler
82 st %r1,__LC_EXT_NEW_PSW+4
83
84 l %r4,.Lsccbaddr-.LPG1(%r13) # %r4 is our index for sccb stuff
85 lr %r1,%r4 # our sccb
86 .insn rre,0xb2200000,%r2,%r1 # service call
87 ipm %r1
88 srl %r1,28 # get cc code
89 xr %r3, %r3
90 chi %r1,3
91 be .Lfchunk-.LPG1(%r13) # leave
92 chi %r1,2
93 be .Lservicecall-.LPG1(%r13)
94 lpsw .Lwaitsclp-.LPG1(%r13)
95.Lsclph:
96 lh %r1,.Lsccbr-.Lsccb(%r4)
97 chi %r1,0x10 # 0x0010 is the sucess code
98 je .Lprocsccb # let's process the sccb
99 chi %r1,0x1f0
100 bne .Lfchunk-.LPG1(%r13) # unhandled error code
101 c %r2, .Lrcp-.LPG1(%r13) # Did we try Read SCP forced
102 bne .Lfchunk-.LPG1(%r13) # if no, give up
103 l %r2, .Lrcp2-.LPG1(%r13) # try with Read SCP
104 b .Lservicecall-.LPG1(%r13)
105.Lprocsccb:
106 lhi %r1,0
107 icm %r1,3,.Lscpincr1-.Lsccb(%r4) # use this one if != 0
108 jnz .Lscnd
109 lhi %r1,0x800 # otherwise report 2GB
110.Lscnd:
111 lhi %r3,0x800 # limit reported memory size to 2GB
112 cr %r1,%r3
113 jl .Lno2gb
114 lr %r1,%r3
115.Lno2gb:
116 xr %r3,%r3 # same logic
117 ic %r3,.Lscpa1-.Lsccb(%r4)
118 chi %r3,0x00
119 jne .Lcompmem
120 l %r3,.Lscpa2-.Lsccb(%r4)
121.Lcompmem:
122 mr %r2,%r1 # mem in MB on 128-bit
123 l %r1,.Lonemb-.LPG1(%r13)
124 mr %r2,%r1 # mem size in bytes in %r3
125 b .Lfchunk-.LPG1(%r13)
126
127 .align 4
128.Lipl_save_parameters:
129 .long ipl_save_parameters
130.Linittu:
131 .long init_thread_union
132.Lpmask:
133 .byte 0
134 .align 8
135.Lpcext:.long 0x00080000,0x80000000
136.Lcr:
137 .long 0x00 # place holder for cr0
138 .align 8
139.Lwaitsclp:
140 .long 0x010a0000,0x80000000 + .Lsclph
141.Lrcp:
142 .int 0x00120001 # Read SCP forced code
143.Lrcp2:
144 .int 0x00020001 # Read SCP code
145.Lonemb:
146 .int 0x100000
147.Lfchunk:
148 60
149#
150# find memory chunks.
151#
152 lr %r9,%r3 # end of mem
153 mvc __LC_PGM_NEW_PSW(8),.Lpcmem-.LPG1(%r13)
154 la %r1,1 # test in increments of 128KB
155 sll %r1,17
156 l %r3,.Lmchunk-.LPG1(%r13) # get pointer to memory_chunk array
157 slr %r4,%r4 # set start of chunk to zero
158 slr %r5,%r5 # set end of chunk to zero
159 slr %r6,%r6 # set access code to zero
160 la %r10,MEMORY_CHUNKS # number of chunks
161.Lloop:
162 tprot 0(%r5),0 # test protection of first byte
163 ipm %r7
164 srl %r7,28
165 clr %r6,%r7 # compare cc with last access code
166 be .Lsame-.LPG1(%r13)
167 lhi %r8,0 # no program checks
168 b .Lsavchk-.LPG1(%r13)
169.Lsame:
170 ar %r5,%r1 # add 128KB to end of chunk
171 bno .Lloop-.LPG1(%r13) # r1 < 0x80000000 -> loop
172.Lchkmem: # > 2GB or tprot got a program check
173 lhi %r8,1 # set program check flag
174.Lsavchk:
175 clr %r4,%r5 # chunk size > 0?
176 be .Lchkloop-.LPG1(%r13)
177 st %r4,0(%r3) # store start address of chunk
178 lr %r0,%r5
179 slr %r0,%r4
180 st %r0,4(%r3) # store size of chunk
181 st %r6,8(%r3) # store type of chunk
182 la %r3,12(%r3)
183 ahi %r10,-1 # update chunk number
184.Lchkloop:
185 lr %r6,%r7 # set access code to last cc
186 # we got an exception or we're starting a new
187 # chunk , we must check if we should
188 # still try to find valid memory (if we detected
189 # the amount of available storage), and if we
190 # have chunks left
191 xr %r0,%r0
192 clr %r0,%r9 # did we detect memory?
193 je .Ldonemem # if not, leave
194 chi %r10,0 # do we have chunks left?
195 je .Ldonemem
196 chi %r8,1 # program check ?
197 je .Lpgmchk
198 lr %r4,%r5 # potential new chunk
199 alr %r5,%r1 # add 128KB to end of chunk
200 j .Llpcnt
201.Lpgmchk:
202 alr %r5,%r1 # add 128KB to end of chunk
203 lr %r4,%r5 # potential new chunk
204.Llpcnt:
205 clr %r5,%r9 # should we go on?
206 jl .Lloop
207.Ldonemem:
208 l %r12,.Lmflags-.LPG1(%r13) # get address of machine_flags 61 l %r12,.Lmflags-.LPG1(%r13) # get address of machine_flags
209# 62#
210# find out if we are running under VM
211#
212 stidp __LC_CPUID # store cpuid
213 tm __LC_CPUID,0xff # running under VM ?
214 bno .Lnovm-.LPG1(%r13)
215 oi 3(%r12),1 # set VM flag
216.Lnovm:
217 lh %r0,__LC_CPUID+4 # get cpu version
218 chi %r0,0x7490 # running on a P/390 ?
219 bne .Lnop390-.LPG1(%r13)
220 oi 3(%r12),4 # set P/390 flag
221.Lnop390:
222
223#
224# find out if we have an IEEE fpu 63# find out if we have an IEEE fpu
225# 64#
226 mvc __LC_PGM_NEW_PSW(8),.Lpcfpu-.LPG1(%r13) 65 mvc __LC_PGM_NEW_PSW(8),.Lpcfpu-.LPG1(%r13)
@@ -295,7 +134,6 @@ startup_continue:
295 .long 0 # cr15: linkage stack operations 134 .long 0 # cr15: linkage stack operations
296.Lduct: .long 0,0,0,0,0,0,0,0 135.Lduct: .long 0,0,0,0,0,0,0,0
297 .long 0,0,0,0,0,0,0,0 136 .long 0,0,0,0,0,0,0,0
298.Lpcmem:.long 0x00080000,0x80000000 + .Lchkmem
299.Lpcfpu:.long 0x00080000,0x80000000 + .Lchkfpu 137.Lpcfpu:.long 0x00080000,0x80000000 + .Lchkfpu
300.Lpccsp:.long 0x00080000,0x80000000 + .Lchkcsp 138.Lpccsp:.long 0x00080000,0x80000000 + .Lchkcsp
301.Lpcmvpg:.long 0x00080000,0x80000000 + .Lchkmvpg 139.Lpcmvpg:.long 0x00080000,0x80000000 + .Lchkmvpg
@@ -306,7 +144,9 @@ startup_continue:
306.Lbss_bgn: .long __bss_start 144.Lbss_bgn: .long __bss_start
307.Lbss_end: .long _end 145.Lbss_end: .long _end
308.Lparmaddr: .long PARMAREA 146.Lparmaddr: .long PARMAREA
309.Lsccbaddr: .long .Lsccb 147.Linittu: .long init_thread_union
148.Lstartup_init:
149 .long startup_init
310 150
311 .globl ipl_schib 151 .globl ipl_schib
312ipl_schib: 152ipl_schib:
@@ -322,26 +162,6 @@ ipl_devno:
322 .word 0 162 .word 0
323 163
324 .org 0x12000 164 .org 0x12000
325.globl s390_readinfo_sccb
326s390_readinfo_sccb:
327.Lsccb:
328 .hword 0x1000 # length, one page
329 .byte 0x00,0x00,0x00
330 .byte 0x80 # variable response bit set
331.Lsccbr:
332 .hword 0x00 # response code
333.Lscpincr1:
334 .hword 0x00
335.Lscpa1:
336 .byte 0x00
337 .fill 89,1,0
338.Lscpa2:
339 .int 0x00
340.Lscpincr2:
341 .quad 0x00
342 .fill 3984,1,0
343 .org 0x13000
344
345#ifdef CONFIG_SHARED_KERNEL 165#ifdef CONFIG_SHARED_KERNEL
346 .org 0x100000 166 .org 0x100000
347#endif 167#endif
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 6ba3f4512dd1..b8fec4e5c5d4 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -58,183 +58,15 @@ startup_continue:
58 stg %r15,__LC_KERNEL_STACK # set end of kernel stack 58 stg %r15,__LC_KERNEL_STACK # set end of kernel stack
59 aghi %r15,-160 59 aghi %r15,-160
60 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # clear backchain 60 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # clear backchain
61
62 brasl %r14,ipl_save_parameters
63# 61#
64# clear bss memory 62# Save ipl parameters, clear bss memory, initialize storage key for kernel pages,
63# and create a kernel NSS if the SAVESYS= parm is defined
65# 64#
66 larl %r2,__bss_start # start of bss segment 65 brasl %r14,startup_init
67 larl %r3,_end # end of bss segment
68 sgr %r3,%r2 # length of bss
69 sgr %r4,%r4 #
70 sgr %r5,%r5 # set src,length and pad to zero
71 mvcle %r2,%r4,0 # clear mem
72 jo .-4 # branch back, if not finish
73 # set program check new psw mask 66 # set program check new psw mask
74 mvc __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13) 67 mvc __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13)
75 larl %r1,.Lslowmemdetect # set program check address
76 stg %r1,__LC_PGM_NEW_PSW+8
77 lghi %r1,0xc
78 diag %r0,%r1,0x260 # get memory size of virtual machine
79 cgr %r0,%r1 # different? -> old detection routine
80 jne .Lslowmemdetect
81 aghi %r1,1 # size is one more than end
82 larl %r2,memory_chunk
83 stg %r1,8(%r2) # store size of chunk
84 j .Ldonemem
85
86.Lslowmemdetect:
87 l %r2,.Lrcp-.LPG1(%r13) # Read SCP forced command word
88.Lservicecall:
89 stosm .Lpmask-.LPG1(%r13),0x01 # authorize ext interrupts
90
91 stctg %r0,%r0,.Lcr-.LPG1(%r13) # get cr0
92 la %r1,0x200 # set bit 22
93 og %r1,.Lcr-.LPG1(%r13) # or old cr0 with r1
94 stg %r1,.Lcr-.LPG1(%r13)
95 lctlg %r0,%r0,.Lcr-.LPG1(%r13) # load modified cr0
96
97 mvc __LC_EXT_NEW_PSW(8),.Lpcmsk-.LPG1(%r13) # set postcall psw
98 larl %r1,.Lsclph
99 stg %r1,__LC_EXT_NEW_PSW+8 # set handler
100
101 larl %r4,.Lsccb # %r4 is our index for sccb stuff
102 lgr %r1,%r4 # our sccb
103 .insn rre,0xb2200000,%r2,%r1 # service call
104 ipm %r1
105 srl %r1,28 # get cc code
106 xr %r3,%r3
107 chi %r1,3
108 be .Lfchunk-.LPG1(%r13) # leave
109 chi %r1,2
110 be .Lservicecall-.LPG1(%r13)
111 lpswe .Lwaitsclp-.LPG1(%r13)
112.Lsclph:
113 lh %r1,.Lsccbr-.Lsccb(%r4)
114 chi %r1,0x10 # 0x0010 is the sucess code
115 je .Lprocsccb # let's process the sccb
116 chi %r1,0x1f0
117 bne .Lfchunk-.LPG1(%r13) # unhandled error code
118 c %r2,.Lrcp-.LPG1(%r13) # Did we try Read SCP forced
119 bne .Lfchunk-.LPG1(%r13) # if no, give up
120 l %r2,.Lrcp2-.LPG1(%r13) # try with Read SCP
121 b .Lservicecall-.LPG1(%r13)
122.Lprocsccb:
123 lghi %r1,0
124 icm %r1,3,.Lscpincr1-.Lsccb(%r4) # use this one if != 0
125 jnz .Lscnd
126 lg %r1,.Lscpincr2-.Lsccb(%r4) # otherwise use this one
127.Lscnd:
128 xr %r3,%r3 # same logic
129 ic %r3,.Lscpa1-.Lsccb(%r4)
130 chi %r3,0x00
131 jne .Lcompmem
132 l %r3,.Lscpa2-.Lsccb(%r4)
133.Lcompmem:
134 mlgr %r2,%r1 # mem in MB on 128-bit
135 l %r1,.Lonemb-.LPG1(%r13)
136 mlgr %r2,%r1 # mem size in bytes in %r3
137 b .Lfchunk-.LPG1(%r13)
138
139 .align 4
140.Lpmask:
141 .byte 0
142 .align 8
143.Lcr:
144 .quad 0x00 # place holder for cr0
145.Lwaitsclp:
146 .quad 0x0102000180000000,.Lsclph
147.Lrcp:
148 .int 0x00120001 # Read SCP forced code
149.Lrcp2:
150 .int 0x00020001 # Read SCP code
151.Lonemb:
152 .int 0x100000
153
154.Lfchunk:
155
156#
157# find memory chunks.
158#
159 lgr %r9,%r3 # end of mem
160 larl %r1,.Lchkmem # set program check address
161 stg %r1,__LC_PGM_NEW_PSW+8
162 la %r1,1 # test in increments of 128KB
163 sllg %r1,%r1,17
164 larl %r3,memory_chunk
165 slgr %r4,%r4 # set start of chunk to zero
166 slgr %r5,%r5 # set end of chunk to zero
167 slr %r6,%r6 # set access code to zero
168 la %r10,MEMORY_CHUNKS # number of chunks
169.Lloop:
170 tprot 0(%r5),0 # test protection of first byte
171 ipm %r7
172 srl %r7,28
173 clr %r6,%r7 # compare cc with last access code
174 je .Lsame
175 lghi %r8,0 # no program checks
176 j .Lsavchk
177.Lsame:
178 algr %r5,%r1 # add 128KB to end of chunk
179 # no need to check here,
180 brc 12,.Lloop # this is the same chunk
181.Lchkmem: # > 16EB or tprot got a program check
182 lghi %r8,1 # set program check flag
183.Lsavchk:
184 clgr %r4,%r5 # chunk size > 0?
185 je .Lchkloop
186 stg %r4,0(%r3) # store start address of chunk
187 lgr %r0,%r5
188 slgr %r0,%r4
189 stg %r0,8(%r3) # store size of chunk
190 st %r6,20(%r3) # store type of chunk
191 la %r3,24(%r3)
192 ahi %r10,-1 # update chunk number
193.Lchkloop:
194 lr %r6,%r7 # set access code to last cc
195 # we got an exception or we're starting a new
196 # chunk , we must check if we should
197 # still try to find valid memory (if we detected
198 # the amount of available storage), and if we
199 # have chunks left
200 lghi %r4,1
201 sllg %r4,%r4,31
202 clgr %r5,%r4
203 je .Lhsaskip
204 xr %r0, %r0
205 clgr %r0, %r9 # did we detect memory?
206 je .Ldonemem # if not, leave
207 chi %r10, 0 # do we have chunks left?
208 je .Ldonemem
209.Lhsaskip:
210 chi %r8,1 # program check ?
211 je .Lpgmchk
212 lgr %r4,%r5 # potential new chunk
213 algr %r5,%r1 # add 128KB to end of chunk
214 j .Llpcnt
215.Lpgmchk:
216 algr %r5,%r1 # add 128KB to end of chunk
217 lgr %r4,%r5 # potential new chunk
218.Llpcnt:
219 clgr %r5,%r9 # should we go on?
220 jl .Lloop
221.Ldonemem:
222
223 larl %r12,machine_flags 68 larl %r12,machine_flags
224# 69#
225# find out if we are running under VM
226#
227 stidp __LC_CPUID # store cpuid
228 tm __LC_CPUID,0xff # running under VM ?
229 bno 0f-.LPG1(%r13)
230 oi 7(%r12),1 # set VM flag
2310: lh %r0,__LC_CPUID+4 # get cpu version
232 chi %r0,0x7490 # running on a P/390 ?
233 bne 1f-.LPG1(%r13)
234 oi 7(%r12),4 # set P/390 flag
2351:
236
237#
238# find out if we have the MVPG instruction 70# find out if we have the MVPG instruction
239# 71#
240 la %r1,0f-.LPG1(%r13) # set program check address 72 la %r1,0f-.LPG1(%r13) # set program check address
@@ -336,25 +168,6 @@ ipl_devno:
336 .word 0 168 .word 0
337 169
338 .org 0x12000 170 .org 0x12000
339.globl s390_readinfo_sccb
340s390_readinfo_sccb:
341.Lsccb:
342 .hword 0x1000 # length, one page
343 .byte 0x00,0x00,0x00
344 .byte 0x80 # variable response bit set
345.Lsccbr:
346 .hword 0x00 # response code
347.Lscpincr1:
348 .hword 0x00
349.Lscpa1:
350 .byte 0x00
351 .fill 89,1,0
352.Lscpa2:
353 .int 0x00
354.Lscpincr2:
355 .quad 0x00
356 .fill 3984,1,0
357 .org 0x13000
358 171
359#ifdef CONFIG_SHARED_KERNEL 172#ifdef CONFIG_SHARED_KERNEL
360 .org 0x100000 173 .org 0x100000
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 9e9972e8a52b..052259530651 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -20,26 +20,27 @@
20#include <asm/cio.h> 20#include <asm/cio.h>
21#include <asm/ebcdic.h> 21#include <asm/ebcdic.h>
22#include <asm/reset.h> 22#include <asm/reset.h>
23#include <asm/sclp.h>
23 24
24#define IPL_PARM_BLOCK_VERSION 0 25#define IPL_PARM_BLOCK_VERSION 0
25#define LOADPARM_LEN 8
26 26
27extern char s390_readinfo_sccb[]; 27#define SCCB_VALID (s390_readinfo_sccb.header.response_code == 0x10)
28#define SCCB_VALID (*((__u16*)&s390_readinfo_sccb[6]) == 0x0010) 28#define SCCB_LOADPARM (&s390_readinfo_sccb.loadparm)
29#define SCCB_LOADPARM (&s390_readinfo_sccb[24]) 29#define SCCB_FLAG (s390_readinfo_sccb.flags)
30#define SCCB_FLAG (s390_readinfo_sccb[91])
31 30
32enum ipl_type { 31enum ipl_type {
33 IPL_TYPE_NONE = 1, 32 IPL_TYPE_NONE = 1,
34 IPL_TYPE_UNKNOWN = 2, 33 IPL_TYPE_UNKNOWN = 2,
35 IPL_TYPE_CCW = 4, 34 IPL_TYPE_CCW = 4,
36 IPL_TYPE_FCP = 8, 35 IPL_TYPE_FCP = 8,
36 IPL_TYPE_NSS = 16,
37}; 37};
38 38
39#define IPL_NONE_STR "none" 39#define IPL_NONE_STR "none"
40#define IPL_UNKNOWN_STR "unknown" 40#define IPL_UNKNOWN_STR "unknown"
41#define IPL_CCW_STR "ccw" 41#define IPL_CCW_STR "ccw"
42#define IPL_FCP_STR "fcp" 42#define IPL_FCP_STR "fcp"
43#define IPL_NSS_STR "nss"
43 44
44static char *ipl_type_str(enum ipl_type type) 45static char *ipl_type_str(enum ipl_type type)
45{ 46{
@@ -50,6 +51,8 @@ static char *ipl_type_str(enum ipl_type type)
50 return IPL_CCW_STR; 51 return IPL_CCW_STR;
51 case IPL_TYPE_FCP: 52 case IPL_TYPE_FCP:
52 return IPL_FCP_STR; 53 return IPL_FCP_STR;
54 case IPL_TYPE_NSS:
55 return IPL_NSS_STR;
53 case IPL_TYPE_UNKNOWN: 56 case IPL_TYPE_UNKNOWN:
54 default: 57 default:
55 return IPL_UNKNOWN_STR; 58 return IPL_UNKNOWN_STR;
@@ -64,6 +67,7 @@ enum ipl_method {
64 IPL_METHOD_FCP_RO_DIAG, 67 IPL_METHOD_FCP_RO_DIAG,
65 IPL_METHOD_FCP_RW_DIAG, 68 IPL_METHOD_FCP_RW_DIAG,
66 IPL_METHOD_FCP_RO_VM, 69 IPL_METHOD_FCP_RO_VM,
70 IPL_METHOD_NSS,
67}; 71};
68 72
69enum shutdown_action { 73enum shutdown_action {
@@ -114,11 +118,14 @@ enum diag308_rc {
114static int diag308_set_works = 0; 118static int diag308_set_works = 0;
115 119
116static int reipl_capabilities = IPL_TYPE_UNKNOWN; 120static int reipl_capabilities = IPL_TYPE_UNKNOWN;
121
117static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN; 122static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN;
118static enum ipl_method reipl_method = IPL_METHOD_NONE; 123static enum ipl_method reipl_method = IPL_METHOD_NONE;
119static struct ipl_parameter_block *reipl_block_fcp; 124static struct ipl_parameter_block *reipl_block_fcp;
120static struct ipl_parameter_block *reipl_block_ccw; 125static struct ipl_parameter_block *reipl_block_ccw;
121 126
127static char reipl_nss_name[NSS_NAME_SIZE + 1];
128
122static int dump_capabilities = IPL_TYPE_NONE; 129static int dump_capabilities = IPL_TYPE_NONE;
123static enum ipl_type dump_type = IPL_TYPE_NONE; 130static enum ipl_type dump_type = IPL_TYPE_NONE;
124static enum ipl_method dump_method = IPL_METHOD_NONE; 131static enum ipl_method dump_method = IPL_METHOD_NONE;
@@ -173,6 +180,24 @@ static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
173 sys_##_prefix##_##_name##_show, \ 180 sys_##_prefix##_##_name##_show, \
174 sys_##_prefix##_##_name##_store); 181 sys_##_prefix##_##_name##_store);
175 182
183#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\
184static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \
185 char *page) \
186{ \
187 return sprintf(page, _fmt_out, _value); \
188} \
189static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\
190 const char *buf, size_t len) \
191{ \
192 if (sscanf(buf, _fmt_in, _value) != 1) \
193 return -EINVAL; \
194 return len; \
195} \
196static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
197 __ATTR(_name,(S_IRUGO | S_IWUSR), \
198 sys_##_prefix##_##_name##_show, \
199 sys_##_prefix##_##_name##_store);
200
176static void make_attrs_ro(struct attribute **attrs) 201static void make_attrs_ro(struct attribute **attrs)
177{ 202{
178 while (*attrs) { 203 while (*attrs) {
@@ -189,6 +214,8 @@ static enum ipl_type ipl_get_type(void)
189{ 214{
190 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; 215 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
191 216
217 if (ipl_flags & IPL_NSS_VALID)
218 return IPL_TYPE_NSS;
192 if (!(ipl_flags & IPL_DEVNO_VALID)) 219 if (!(ipl_flags & IPL_DEVNO_VALID))
193 return IPL_TYPE_UNKNOWN; 220 return IPL_TYPE_UNKNOWN;
194 if (!(ipl_flags & IPL_PARMBLOCK_VALID)) 221 if (!(ipl_flags & IPL_PARMBLOCK_VALID))
@@ -324,6 +351,20 @@ static struct attribute_group ipl_ccw_attr_group = {
324 .attrs = ipl_ccw_attrs, 351 .attrs = ipl_ccw_attrs,
325}; 352};
326 353
354/* NSS ipl device attributes */
355
356DEFINE_IPL_ATTR_RO(ipl_nss, name, "%s\n", kernel_nss_name);
357
358static struct attribute *ipl_nss_attrs[] = {
359 &sys_ipl_type_attr.attr,
360 &sys_ipl_nss_name_attr.attr,
361 NULL,
362};
363
364static struct attribute_group ipl_nss_attr_group = {
365 .attrs = ipl_nss_attrs,
366};
367
327/* UNKNOWN ipl device attributes */ 368/* UNKNOWN ipl device attributes */
328 369
329static struct attribute *ipl_unknown_attrs[] = { 370static struct attribute *ipl_unknown_attrs[] = {
@@ -432,6 +473,21 @@ static struct attribute_group reipl_ccw_attr_group = {
432 .attrs = reipl_ccw_attrs, 473 .attrs = reipl_ccw_attrs,
433}; 474};
434 475
476
477/* NSS reipl device attributes */
478
479DEFINE_IPL_ATTR_STR_RW(reipl_nss, name, "%s\n", "%s\n", reipl_nss_name);
480
481static struct attribute *reipl_nss_attrs[] = {
482 &sys_reipl_nss_name_attr.attr,
483 NULL,
484};
485
486static struct attribute_group reipl_nss_attr_group = {
487 .name = IPL_NSS_STR,
488 .attrs = reipl_nss_attrs,
489};
490
435/* reipl type */ 491/* reipl type */
436 492
437static int reipl_set_type(enum ipl_type type) 493static int reipl_set_type(enum ipl_type type)
@@ -454,6 +510,9 @@ static int reipl_set_type(enum ipl_type type)
454 else 510 else
455 reipl_method = IPL_METHOD_FCP_RO_DIAG; 511 reipl_method = IPL_METHOD_FCP_RO_DIAG;
456 break; 512 break;
513 case IPL_TYPE_NSS:
514 reipl_method = IPL_METHOD_NSS;
515 break;
457 default: 516 default:
458 reipl_method = IPL_METHOD_NONE; 517 reipl_method = IPL_METHOD_NONE;
459 } 518 }
@@ -475,6 +534,8 @@ static ssize_t reipl_type_store(struct subsystem *subsys, const char *buf,
475 rc = reipl_set_type(IPL_TYPE_CCW); 534 rc = reipl_set_type(IPL_TYPE_CCW);
476 else if (strncmp(buf, IPL_FCP_STR, strlen(IPL_FCP_STR)) == 0) 535 else if (strncmp(buf, IPL_FCP_STR, strlen(IPL_FCP_STR)) == 0)
477 rc = reipl_set_type(IPL_TYPE_FCP); 536 rc = reipl_set_type(IPL_TYPE_FCP);
537 else if (strncmp(buf, IPL_NSS_STR, strlen(IPL_NSS_STR)) == 0)
538 rc = reipl_set_type(IPL_TYPE_NSS);
478 return (rc != 0) ? rc : len; 539 return (rc != 0) ? rc : len;
479} 540}
480 541
@@ -647,6 +708,10 @@ void do_reipl(void)
647 case IPL_METHOD_FCP_RO_VM: 708 case IPL_METHOD_FCP_RO_VM:
648 __cpcmd("IPL", NULL, 0, NULL); 709 __cpcmd("IPL", NULL, 0, NULL);
649 break; 710 break;
711 case IPL_METHOD_NSS:
712 sprintf(buf, "IPL %s", reipl_nss_name);
713 __cpcmd(buf, NULL, 0, NULL);
714 break;
650 case IPL_METHOD_NONE: 715 case IPL_METHOD_NONE:
651 default: 716 default:
652 if (MACHINE_IS_VM) 717 if (MACHINE_IS_VM)
@@ -733,6 +798,10 @@ static int __init ipl_init(void)
733 case IPL_TYPE_FCP: 798 case IPL_TYPE_FCP:
734 rc = ipl_register_fcp_files(); 799 rc = ipl_register_fcp_files();
735 break; 800 break;
801 case IPL_TYPE_NSS:
802 rc = sysfs_create_group(&ipl_subsys.kset.kobj,
803 &ipl_nss_attr_group);
804 break;
736 default: 805 default:
737 rc = sysfs_create_group(&ipl_subsys.kset.kobj, 806 rc = sysfs_create_group(&ipl_subsys.kset.kobj,
738 &ipl_unknown_attr_group); 807 &ipl_unknown_attr_group);
@@ -755,6 +824,20 @@ static void __init reipl_probe(void)
755 free_page((unsigned long)buffer); 824 free_page((unsigned long)buffer);
756} 825}
757 826
827static int __init reipl_nss_init(void)
828{
829 int rc;
830
831 if (!MACHINE_IS_VM)
832 return 0;
833 rc = sysfs_create_group(&reipl_subsys.kset.kobj, &reipl_nss_attr_group);
834 if (rc)
835 return rc;
836 strncpy(reipl_nss_name, kernel_nss_name, NSS_NAME_SIZE + 1);
837 reipl_capabilities |= IPL_TYPE_NSS;
838 return 0;
839}
840
758static int __init reipl_ccw_init(void) 841static int __init reipl_ccw_init(void)
759{ 842{
760 int rc; 843 int rc;
@@ -837,6 +920,9 @@ static int __init reipl_init(void)
837 rc = reipl_fcp_init(); 920 rc = reipl_fcp_init();
838 if (rc) 921 if (rc)
839 return rc; 922 return rc;
923 rc = reipl_nss_init();
924 if (rc)
925 return rc;
840 rc = reipl_set_type(ipl_get_type()); 926 rc = reipl_set_type(ipl_get_type());
841 if (rc) 927 if (rc)
842 return rc; 928 return rc;
@@ -993,8 +1079,6 @@ static void do_reset_calls(void)
993 reset->fn(); 1079 reset->fn();
994} 1080}
995 1081
996extern void reset_mcck_handler(void);
997extern void reset_pgm_handler(void);
998extern __u32 dump_prefix_page; 1082extern __u32 dump_prefix_page;
999 1083
1000void s390_reset_system(void) 1084void s390_reset_system(void)
@@ -1016,14 +1100,14 @@ void s390_reset_system(void)
1016 __ctl_clear_bit(0,28); 1100 __ctl_clear_bit(0,28);
1017 1101
1018 /* Set new machine check handler */ 1102 /* Set new machine check handler */
1019 S390_lowcore.mcck_new_psw.mask = PSW_KERNEL_BITS & ~PSW_MASK_MCHECK; 1103 S390_lowcore.mcck_new_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK;
1020 S390_lowcore.mcck_new_psw.addr = 1104 S390_lowcore.mcck_new_psw.addr =
1021 PSW_ADDR_AMODE | (unsigned long) &reset_mcck_handler; 1105 PSW_ADDR_AMODE | (unsigned long) s390_base_mcck_handler;
1022 1106
1023 /* Set new program check handler */ 1107 /* Set new program check handler */
1024 S390_lowcore.program_new_psw.mask = PSW_KERNEL_BITS & ~PSW_MASK_MCHECK; 1108 S390_lowcore.program_new_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK;
1025 S390_lowcore.program_new_psw.addr = 1109 S390_lowcore.program_new_psw.addr =
1026 PSW_ADDR_AMODE | (unsigned long) &reset_pgm_handler; 1110 PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler;
1027 1111
1028 do_reset_calls(); 1112 do_reset_calls();
1029} 1113}
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 1eef50918615..8f0cbca31203 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * arch/s390/kernel/irq.c 2 * arch/s390/kernel/irq.c
3 * 3 *
4 * S390 version 4 * Copyright IBM Corp. 2004,2007
5 * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
6 * Thomas Spatzier (tspat@de.ibm.com)
7 * 7 *
8 * This file contains interrupt related functions. 8 * This file contains interrupt related functions.
9 */ 9 */
@@ -14,6 +14,8 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/seq_file.h> 15#include <linux/seq_file.h>
16#include <linux/cpu.h> 16#include <linux/cpu.h>
17#include <linux/proc_fs.h>
18#include <linux/profile.h>
17 19
18/* 20/*
19 * show_interrupts is needed by /proc/interrupts. 21 * show_interrupts is needed by /proc/interrupts.
@@ -93,5 +95,12 @@ asmlinkage void do_softirq(void)
93 95
94 local_irq_restore(flags); 96 local_irq_restore(flags);
95} 97}
96
97EXPORT_SYMBOL(do_softirq); 98EXPORT_SYMBOL(do_softirq);
99
100void init_irq_proc(void)
101{
102 struct proc_dir_entry *root_irq_dir;
103
104 root_irq_dir = proc_mkdir("irq", NULL);
105 create_prof_cpu_mask(root_irq_dir);
106}
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 576368c4f605..a466bab6677e 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -155,15 +155,34 @@ void __kprobes get_instruction_type(struct arch_specific_insn *ainsn)
155static int __kprobes swap_instruction(void *aref) 155static int __kprobes swap_instruction(void *aref)
156{ 156{
157 struct ins_replace_args *args = aref; 157 struct ins_replace_args *args = aref;
158 u32 *addr;
159 u32 instr;
158 int err = -EFAULT; 160 int err = -EFAULT;
159 161
162 /*
163 * Text segment is read-only, hence we use stura to bypass dynamic
164 * address translation to exchange the instruction. Since stura
165 * always operates on four bytes, but we only want to exchange two
166 * bytes do some calculations to get things right. In addition we
167 * shall not cross any page boundaries (vmalloc area!) when writing
168 * the new instruction.
169 */
170 addr = (u32 *)ALIGN((unsigned long)args->ptr, 4);
171 if ((unsigned long)args->ptr & 2)
172 instr = ((*addr) & 0xffff0000) | args->new;
173 else
174 instr = ((*addr) & 0x0000ffff) | args->new << 16;
175
160 asm volatile( 176 asm volatile(
161 "0: mvc 0(2,%2),0(%3)\n" 177 " lra %1,0(%1)\n"
162 "1: la %0,0\n" 178 "0: stura %2,%1\n"
179 "1: la %0,0\n"
163 "2:\n" 180 "2:\n"
164 EX_TABLE(0b,2b) 181 EX_TABLE(0b,2b)
165 : "+d" (err), "=m" (*args->ptr) 182 : "+d" (err)
166 : "a" (args->ptr), "a" (&args->new), "m" (args->new)); 183 : "a" (addr), "d" (instr)
184 : "memory", "cc");
185
167 return err; 186 return err;
168} 187}
169 188
@@ -356,7 +375,7 @@ no_kprobe:
356 * - When the probed function returns, this probe 375 * - When the probed function returns, this probe
357 * causes the handlers to fire 376 * causes the handlers to fire
358 */ 377 */
359void __kprobes kretprobe_trampoline_holder(void) 378void kretprobe_trampoline_holder(void)
360{ 379{
361 asm volatile(".global kretprobe_trampoline\n" 380 asm volatile(".global kretprobe_trampoline\n"
362 "kretprobe_trampoline: bcr 0,0\n"); 381 "kretprobe_trampoline: bcr 0,0\n");
@@ -365,7 +384,8 @@ void __kprobes kretprobe_trampoline_holder(void)
365/* 384/*
366 * Called when the probe at kretprobe trampoline is hit 385 * Called when the probe at kretprobe trampoline is hit
367 */ 386 */
368int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 387static int __kprobes trampoline_probe_handler(struct kprobe *p,
388 struct pt_regs *regs)
369{ 389{
370 struct kretprobe_instance *ri = NULL; 390 struct kretprobe_instance *ri = NULL;
371 struct hlist_head *head, empty_rp; 391 struct hlist_head *head, empty_rp;
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index f6d9bcc0f75b..52f57af252b4 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -11,6 +11,7 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/kexec.h> 12#include <linux/kexec.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/reboot.h>
14#include <asm/cio.h> 15#include <asm/cio.h>
15#include <asm/setup.h> 16#include <asm/setup.h>
16#include <asm/pgtable.h> 17#include <asm/pgtable.h>
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index d989ed45a7aa..39d1dd752529 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -30,6 +30,7 @@
30#include <linux/fs.h> 30#include <linux/fs.h>
31#include <linux/string.h> 31#include <linux/string.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/moduleloader.h>
33 34
34#if 0 35#if 0
35#define DEBUGP printk 36#define DEBUGP printk
@@ -58,7 +59,7 @@ void module_free(struct module *mod, void *module_region)
58 table entries. */ 59 table entries. */
59} 60}
60 61
61static inline void 62static void
62check_rela(Elf_Rela *rela, struct module *me) 63check_rela(Elf_Rela *rela, struct module *me)
63{ 64{
64 struct mod_arch_syminfo *info; 65 struct mod_arch_syminfo *info;
@@ -181,7 +182,7 @@ apply_relocate(Elf_Shdr *sechdrs, const char *strtab, unsigned int symindex,
181 return -ENOEXEC; 182 return -ENOEXEC;
182} 183}
183 184
184static inline int 185static int
185apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, 186apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
186 struct module *me) 187 struct module *me)
187{ 188{
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 6603fbb41d07..5acfac654f9d 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -144,7 +144,7 @@ static void default_idle(void)
144 144
145 trace_hardirqs_on(); 145 trace_hardirqs_on();
146 /* Wait for external, I/O or machine check interrupt. */ 146 /* Wait for external, I/O or machine check interrupt. */
147 __load_psw_mask(PSW_KERNEL_BITS | PSW_MASK_WAIT | 147 __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
148 PSW_MASK_IO | PSW_MASK_EXT); 148 PSW_MASK_IO | PSW_MASK_EXT);
149} 149}
150 150
@@ -190,7 +190,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
190 struct pt_regs regs; 190 struct pt_regs regs;
191 191
192 memset(&regs, 0, sizeof(regs)); 192 memset(&regs, 0, sizeof(regs));
193 regs.psw.mask = PSW_KERNEL_BITS | PSW_MASK_IO | PSW_MASK_EXT; 193 regs.psw.mask = psw_kernel_bits | PSW_MASK_IO | PSW_MASK_EXT;
194 regs.psw.addr = (unsigned long) kernel_thread_starter | PSW_ADDR_AMODE; 194 regs.psw.addr = (unsigned long) kernel_thread_starter | PSW_ADDR_AMODE;
195 regs.gprs[9] = (unsigned long) fn; 195 regs.gprs[9] = (unsigned long) fn;
196 regs.gprs[10] = (unsigned long) arg; 196 regs.gprs[10] = (unsigned long) arg;
diff --git a/arch/s390/kernel/profile.c b/arch/s390/kernel/profile.c
deleted file mode 100644
index b81aa1f569ca..000000000000
--- a/arch/s390/kernel/profile.c
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * arch/s390/kernel/profile.c
3 *
4 * Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Thomas Spatzier (tspat@de.ibm.com)
6 *
7 */
8#include <linux/proc_fs.h>
9#include <linux/profile.h>
10
11static struct proc_dir_entry * root_irq_dir;
12
13void init_irq_proc(void)
14{
15 /* create /proc/irq */
16 root_irq_dir = proc_mkdir("irq", NULL);
17
18 /* create /proc/irq/prof_cpu_mask */
19 create_prof_cpu_mask(root_irq_dir);
20}
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 8f36504075ed..2a8f0872ea8b 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -86,15 +86,13 @@ FixPerRegisters(struct task_struct *task)
86 per_info->control_regs.bits.storage_alt_space_ctl = 0; 86 per_info->control_regs.bits.storage_alt_space_ctl = 0;
87} 87}
88 88
89void 89static void set_single_step(struct task_struct *task)
90set_single_step(struct task_struct *task)
91{ 90{
92 task->thread.per_info.single_step = 1; 91 task->thread.per_info.single_step = 1;
93 FixPerRegisters(task); 92 FixPerRegisters(task);
94} 93}
95 94
96void 95static void clear_single_step(struct task_struct *task)
97clear_single_step(struct task_struct *task)
98{ 96{
99 task->thread.per_info.single_step = 0; 97 task->thread.per_info.single_step = 0;
100 FixPerRegisters(task); 98 FixPerRegisters(task);
@@ -232,9 +230,9 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
232 */ 230 */
233 if (addr == (addr_t) &dummy->regs.psw.mask && 231 if (addr == (addr_t) &dummy->regs.psw.mask &&
234#ifdef CONFIG_COMPAT 232#ifdef CONFIG_COMPAT
235 data != PSW_MASK_MERGE(PSW_USER32_BITS, data) && 233 data != PSW_MASK_MERGE(psw_user32_bits, data) &&
236#endif 234#endif
237 data != PSW_MASK_MERGE(PSW_USER_BITS, data)) 235 data != PSW_MASK_MERGE(psw_user_bits, data))
238 /* Invalid psw mask. */ 236 /* Invalid psw mask. */
239 return -EINVAL; 237 return -EINVAL;
240#ifndef CONFIG_64BIT 238#ifndef CONFIG_64BIT
@@ -309,7 +307,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
309 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); 307 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
310 if (copied != sizeof(tmp)) 308 if (copied != sizeof(tmp))
311 return -EIO; 309 return -EIO;
312 return put_user(tmp, (unsigned long __user *) data); 310 return put_user(tmp, (unsigned long __force __user *) data);
313 311
314 case PTRACE_PEEKUSR: 312 case PTRACE_PEEKUSR:
315 /* read the word at location addr in the USER area. */ 313 /* read the word at location addr in the USER area. */
@@ -331,7 +329,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
331 329
332 case PTRACE_PEEKUSR_AREA: 330 case PTRACE_PEEKUSR_AREA:
333 case PTRACE_POKEUSR_AREA: 331 case PTRACE_POKEUSR_AREA:
334 if (copy_from_user(&parea, (void __user *) addr, 332 if (copy_from_user(&parea, (void __force __user *) addr,
335 sizeof(parea))) 333 sizeof(parea)))
336 return -EFAULT; 334 return -EFAULT;
337 addr = parea.kernel_addr; 335 addr = parea.kernel_addr;
@@ -341,10 +339,11 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
341 if (request == PTRACE_PEEKUSR_AREA) 339 if (request == PTRACE_PEEKUSR_AREA)
342 ret = peek_user(child, addr, data); 340 ret = peek_user(child, addr, data);
343 else { 341 else {
344 addr_t tmp; 342 addr_t utmp;
345 if (get_user (tmp, (addr_t __user *) data)) 343 if (get_user(utmp,
344 (addr_t __force __user *) data))
346 return -EFAULT; 345 return -EFAULT;
347 ret = poke_user(child, addr, tmp); 346 ret = poke_user(child, addr, utmp);
348 } 347 }
349 if (ret) 348 if (ret)
350 return ret; 349 return ret;
@@ -394,7 +393,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
394 if (addr == (addr_t) &dummy32->regs.psw.mask) { 393 if (addr == (addr_t) &dummy32->regs.psw.mask) {
395 /* Fake a 31 bit psw mask. */ 394 /* Fake a 31 bit psw mask. */
396 tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32); 395 tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32);
397 tmp = PSW32_MASK_MERGE(PSW32_USER_BITS, tmp); 396 tmp = PSW32_MASK_MERGE(psw32_user_bits, tmp);
398 } else if (addr == (addr_t) &dummy32->regs.psw.addr) { 397 } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
399 /* Fake a 31 bit psw address. */ 398 /* Fake a 31 bit psw address. */
400 tmp = (__u32) task_pt_regs(child)->psw.addr | 399 tmp = (__u32) task_pt_regs(child)->psw.addr |
@@ -469,11 +468,11 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
469 */ 468 */
470 if (addr == (addr_t) &dummy32->regs.psw.mask) { 469 if (addr == (addr_t) &dummy32->regs.psw.mask) {
471 /* Build a 64 bit psw mask from 31 bit mask. */ 470 /* Build a 64 bit psw mask from 31 bit mask. */
472 if (tmp != PSW32_MASK_MERGE(PSW32_USER_BITS, tmp)) 471 if (tmp != PSW32_MASK_MERGE(psw32_user_bits, tmp))
473 /* Invalid psw mask. */ 472 /* Invalid psw mask. */
474 return -EINVAL; 473 return -EINVAL;
475 task_pt_regs(child)->psw.mask = 474 task_pt_regs(child)->psw.mask =
476 PSW_MASK_MERGE(PSW_USER32_BITS, (__u64) tmp << 32); 475 PSW_MASK_MERGE(psw_user32_bits, (__u64) tmp << 32);
477 } else if (addr == (addr_t) &dummy32->regs.psw.addr) { 476 } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
478 /* Build a 64 bit psw address from 31 bit address. */ 477 /* Build a 64 bit psw address from 31 bit address. */
479 task_pt_regs(child)->psw.addr = 478 task_pt_regs(child)->psw.addr =
@@ -550,7 +549,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
550 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); 549 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
551 if (copied != sizeof(tmp)) 550 if (copied != sizeof(tmp))
552 return -EIO; 551 return -EIO;
553 return put_user(tmp, (unsigned int __user *) data); 552 return put_user(tmp, (unsigned int __force __user *) data);
554 553
555 case PTRACE_PEEKUSR: 554 case PTRACE_PEEKUSR:
556 /* read the word at location addr in the USER area. */ 555 /* read the word at location addr in the USER area. */
@@ -571,7 +570,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
571 570
572 case PTRACE_PEEKUSR_AREA: 571 case PTRACE_PEEKUSR_AREA:
573 case PTRACE_POKEUSR_AREA: 572 case PTRACE_POKEUSR_AREA:
574 if (copy_from_user(&parea, (void __user *) addr, 573 if (copy_from_user(&parea, (void __force __user *) addr,
575 sizeof(parea))) 574 sizeof(parea)))
576 return -EFAULT; 575 return -EFAULT;
577 addr = parea.kernel_addr; 576 addr = parea.kernel_addr;
@@ -581,10 +580,11 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
581 if (request == PTRACE_PEEKUSR_AREA) 580 if (request == PTRACE_PEEKUSR_AREA)
582 ret = peek_user_emu31(child, addr, data); 581 ret = peek_user_emu31(child, addr, data);
583 else { 582 else {
584 __u32 tmp; 583 __u32 utmp;
585 if (get_user (tmp, (__u32 __user *) data)) 584 if (get_user(utmp,
585 (__u32 __force __user *) data))
586 return -EFAULT; 586 return -EFAULT;
587 ret = poke_user_emu31(child, addr, tmp); 587 ret = poke_user_emu31(child, addr, utmp);
588 } 588 }
589 if (ret) 589 if (ret)
590 return ret; 590 return ret;
@@ -595,17 +595,19 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
595 return 0; 595 return 0;
596 case PTRACE_GETEVENTMSG: 596 case PTRACE_GETEVENTMSG:
597 return put_user((__u32) child->ptrace_message, 597 return put_user((__u32) child->ptrace_message,
598 (unsigned int __user *) data); 598 (unsigned int __force __user *) data);
599 case PTRACE_GETSIGINFO: 599 case PTRACE_GETSIGINFO:
600 if (child->last_siginfo == NULL) 600 if (child->last_siginfo == NULL)
601 return -EINVAL; 601 return -EINVAL;
602 return copy_siginfo_to_user32((compat_siginfo_t __user *) data, 602 return copy_siginfo_to_user32((compat_siginfo_t
603 __force __user *) data,
603 child->last_siginfo); 604 child->last_siginfo);
604 case PTRACE_SETSIGINFO: 605 case PTRACE_SETSIGINFO:
605 if (child->last_siginfo == NULL) 606 if (child->last_siginfo == NULL)
606 return -EINVAL; 607 return -EINVAL;
607 return copy_siginfo_from_user32(child->last_siginfo, 608 return copy_siginfo_from_user32(child->last_siginfo,
608 (compat_siginfo_t __user *) data); 609 (compat_siginfo_t
610 __force __user *) data);
609 } 611 }
610 return ptrace_request(child, request, addr, data); 612 return ptrace_request(child, request, addr, data);
611} 613}
diff --git a/arch/s390/kernel/reset.S b/arch/s390/kernel/reset.S
deleted file mode 100644
index 8a87355161fa..000000000000
--- a/arch/s390/kernel/reset.S
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * arch/s390/kernel/reset.S
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 * Michael Holzheu <holzheu@de.ibm.com>
7 */
8
9#include <asm/ptrace.h>
10#include <asm/lowcore.h>
11
12#ifdef CONFIG_64BIT
13
14 .globl reset_mcck_handler
15reset_mcck_handler:
16 basr %r13,0
170: lg %r15,__LC_PANIC_STACK # load panic stack
18 aghi %r15,-STACK_FRAME_OVERHEAD
19 lg %r1,s390_reset_mcck_handler-0b(%r13)
20 ltgr %r1,%r1
21 jz 1f
22 basr %r14,%r1
231: la %r1,4095
24 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)
25 lpswe __LC_MCK_OLD_PSW
26
27 .globl s390_reset_mcck_handler
28s390_reset_mcck_handler:
29 .quad 0
30
31 .globl reset_pgm_handler
32reset_pgm_handler:
33 stmg %r0,%r15,__LC_SAVE_AREA
34 basr %r13,0
350: lg %r15,__LC_PANIC_STACK # load panic stack
36 aghi %r15,-STACK_FRAME_OVERHEAD
37 lg %r1,s390_reset_pgm_handler-0b(%r13)
38 ltgr %r1,%r1
39 jz 1f
40 basr %r14,%r1
41 lmg %r0,%r15,__LC_SAVE_AREA
42 lpswe __LC_PGM_OLD_PSW
431: lpswe disabled_wait_psw-0b(%r13)
44 .globl s390_reset_pgm_handler
45s390_reset_pgm_handler:
46 .quad 0
47 .align 8
48disabled_wait_psw:
49 .quad 0x0002000180000000,0x0000000000000000 + reset_pgm_handler
50
51#else /* CONFIG_64BIT */
52
53 .globl reset_mcck_handler
54reset_mcck_handler:
55 basr %r13,0
560: l %r15,__LC_PANIC_STACK # load panic stack
57 ahi %r15,-STACK_FRAME_OVERHEAD
58 l %r1,s390_reset_mcck_handler-0b(%r13)
59 ltr %r1,%r1
60 jz 1f
61 basr %r14,%r1
621: lm %r0,%r15,__LC_GPREGS_SAVE_AREA
63 lpsw __LC_MCK_OLD_PSW
64
65 .globl s390_reset_mcck_handler
66s390_reset_mcck_handler:
67 .long 0
68
69 .globl reset_pgm_handler
70reset_pgm_handler:
71 stm %r0,%r15,__LC_SAVE_AREA
72 basr %r13,0
730: l %r15,__LC_PANIC_STACK # load panic stack
74 ahi %r15,-STACK_FRAME_OVERHEAD
75 l %r1,s390_reset_pgm_handler-0b(%r13)
76 ltr %r1,%r1
77 jz 1f
78 basr %r14,%r1
79 lm %r0,%r15,__LC_SAVE_AREA
80 lpsw __LC_PGM_OLD_PSW
81
821: lpsw disabled_wait_psw-0b(%r13)
83 .globl s390_reset_pgm_handler
84s390_reset_pgm_handler:
85 .long 0
86disabled_wait_psw:
87 .align 8
88 .long 0x000a0000,0x00000000 + reset_pgm_handler
89
90#endif /* CONFIG_64BIT */
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index bc5beaa8f98e..acf93dba7727 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -125,14 +125,12 @@ void do_extint(struct pt_regs *regs, unsigned short code)
125 * Make sure that the i/o interrupt did not "overtake" 125 * Make sure that the i/o interrupt did not "overtake"
126 * the last HZ timer interrupt. 126 * the last HZ timer interrupt.
127 */ 127 */
128 account_ticks(); 128 account_ticks(S390_lowcore.int_clock);
129 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 129 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
130 index = ext_hash(code); 130 index = ext_hash(code);
131 for (p = ext_int_hash[index]; p; p = p->next) { 131 for (p = ext_int_hash[index]; p; p = p->next) {
132 if (likely(p->code == code)) { 132 if (likely(p->code == code))
133 if (likely(p->handler)) 133 p->handler(code);
134 p->handler(code);
135 }
136 } 134 }
137 irq_exit(); 135 irq_exit();
138 set_irq_regs(old_regs); 136 set_irq_regs(old_regs);
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 5d8ee3baac14..03739813d3bf 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -38,6 +38,8 @@
38#include <linux/device.h> 38#include <linux/device.h>
39#include <linux/notifier.h> 39#include <linux/notifier.h>
40#include <linux/pfn.h> 40#include <linux/pfn.h>
41#include <linux/ctype.h>
42#include <linux/reboot.h>
41 43
42#include <asm/uaccess.h> 44#include <asm/uaccess.h>
43#include <asm/system.h> 45#include <asm/system.h>
@@ -49,6 +51,14 @@
49#include <asm/page.h> 51#include <asm/page.h>
50#include <asm/ptrace.h> 52#include <asm/ptrace.h>
51#include <asm/sections.h> 53#include <asm/sections.h>
54#include <asm/ebcdic.h>
55#include <asm/compat.h>
56
57long psw_kernel_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY |
58 PSW_MASK_MCHECK | PSW_DEFAULT_KEY);
59long psw_user_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME |
60 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK |
61 PSW_MASK_PSTATE | PSW_DEFAULT_KEY);
52 62
53/* 63/*
54 * User copy operations. 64 * User copy operations.
@@ -117,9 +127,9 @@ void __devinit cpu_init (void)
117 */ 127 */
118char vmhalt_cmd[128] = ""; 128char vmhalt_cmd[128] = "";
119char vmpoff_cmd[128] = ""; 129char vmpoff_cmd[128] = "";
120char vmpanic_cmd[128] = ""; 130static char vmpanic_cmd[128] = "";
121 131
122static inline void strncpy_skip_quote(char *dst, char *src, int n) 132static void strncpy_skip_quote(char *dst, char *src, int n)
123{ 133{
124 int sx, dx; 134 int sx, dx;
125 135
@@ -275,10 +285,6 @@ static void __init conmode_default(void)
275} 285}
276 286
277#ifdef CONFIG_SMP 287#ifdef CONFIG_SMP
278extern void machine_restart_smp(char *);
279extern void machine_halt_smp(void);
280extern void machine_power_off_smp(void);
281
282void (*_machine_restart)(char *command) = machine_restart_smp; 288void (*_machine_restart)(char *command) = machine_restart_smp;
283void (*_machine_halt)(void) = machine_halt_smp; 289void (*_machine_halt)(void) = machine_halt_smp;
284void (*_machine_power_off)(void) = machine_power_off_smp; 290void (*_machine_power_off)(void) = machine_power_off_smp;
@@ -386,6 +392,84 @@ static int __init early_parse_ipldelay(char *p)
386} 392}
387early_param("ipldelay", early_parse_ipldelay); 393early_param("ipldelay", early_parse_ipldelay);
388 394
395#ifdef CONFIG_S390_SWITCH_AMODE
396unsigned int switch_amode = 0;
397EXPORT_SYMBOL_GPL(switch_amode);
398
399static void set_amode_and_uaccess(unsigned long user_amode,
400 unsigned long user32_amode)
401{
402 psw_user_bits = PSW_BASE_BITS | PSW_MASK_DAT | user_amode |
403 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK |
404 PSW_MASK_PSTATE | PSW_DEFAULT_KEY;
405#ifdef CONFIG_COMPAT
406 psw_user32_bits = PSW_BASE32_BITS | PSW_MASK_DAT | user_amode |
407 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK |
408 PSW_MASK_PSTATE | PSW_DEFAULT_KEY;
409 psw32_user_bits = PSW32_BASE_BITS | PSW32_MASK_DAT | user32_amode |
410 PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK |
411 PSW32_MASK_PSTATE;
412#endif
413 psw_kernel_bits = PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME |
414 PSW_MASK_MCHECK | PSW_DEFAULT_KEY;
415
416 if (MACHINE_HAS_MVCOS) {
417 printk("mvcos available.\n");
418 memcpy(&uaccess, &uaccess_mvcos_switch, sizeof(uaccess));
419 } else {
420 printk("mvcos not available.\n");
421 memcpy(&uaccess, &uaccess_pt, sizeof(uaccess));
422 }
423}
424
425/*
426 * Switch kernel/user addressing modes?
427 */
428static int __init early_parse_switch_amode(char *p)
429{
430 switch_amode = 1;
431 return 0;
432}
433early_param("switch_amode", early_parse_switch_amode);
434
435#else /* CONFIG_S390_SWITCH_AMODE */
436static inline void set_amode_and_uaccess(unsigned long user_amode,
437 unsigned long user32_amode)
438{
439}
440#endif /* CONFIG_S390_SWITCH_AMODE */
441
442#ifdef CONFIG_S390_EXEC_PROTECT
443unsigned int s390_noexec = 0;
444EXPORT_SYMBOL_GPL(s390_noexec);
445
446/*
447 * Enable execute protection?
448 */
449static int __init early_parse_noexec(char *p)
450{
451 if (!strncmp(p, "off", 3))
452 return 0;
453 switch_amode = 1;
454 s390_noexec = 1;
455 return 0;
456}
457early_param("noexec", early_parse_noexec);
458#endif /* CONFIG_S390_EXEC_PROTECT */
459
460static void setup_addressing_mode(void)
461{
462 if (s390_noexec) {
463 printk("S390 execute protection active, ");
464 set_amode_and_uaccess(PSW_ASC_SECONDARY, PSW32_ASC_SECONDARY);
465 return;
466 }
467 if (switch_amode) {
468 printk("S390 address spaces switched, ");
469 set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY);
470 }
471}
472
389static void __init 473static void __init
390setup_lowcore(void) 474setup_lowcore(void)
391{ 475{
@@ -402,19 +486,21 @@ setup_lowcore(void)
402 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 486 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
403 lc->restart_psw.addr = 487 lc->restart_psw.addr =
404 PSW_ADDR_AMODE | (unsigned long) restart_int_handler; 488 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
405 lc->external_new_psw.mask = PSW_KERNEL_BITS; 489 if (switch_amode)
490 lc->restart_psw.mask |= PSW_ASC_HOME;
491 lc->external_new_psw.mask = psw_kernel_bits;
406 lc->external_new_psw.addr = 492 lc->external_new_psw.addr =
407 PSW_ADDR_AMODE | (unsigned long) ext_int_handler; 493 PSW_ADDR_AMODE | (unsigned long) ext_int_handler;
408 lc->svc_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_IO | PSW_MASK_EXT; 494 lc->svc_new_psw.mask = psw_kernel_bits | PSW_MASK_IO | PSW_MASK_EXT;
409 lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call; 495 lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call;
410 lc->program_new_psw.mask = PSW_KERNEL_BITS; 496 lc->program_new_psw.mask = psw_kernel_bits;
411 lc->program_new_psw.addr = 497 lc->program_new_psw.addr =
412 PSW_ADDR_AMODE | (unsigned long)pgm_check_handler; 498 PSW_ADDR_AMODE | (unsigned long)pgm_check_handler;
413 lc->mcck_new_psw.mask = 499 lc->mcck_new_psw.mask =
414 PSW_KERNEL_BITS & ~PSW_MASK_MCHECK & ~PSW_MASK_DAT; 500 psw_kernel_bits & ~PSW_MASK_MCHECK & ~PSW_MASK_DAT;
415 lc->mcck_new_psw.addr = 501 lc->mcck_new_psw.addr =
416 PSW_ADDR_AMODE | (unsigned long) mcck_int_handler; 502 PSW_ADDR_AMODE | (unsigned long) mcck_int_handler;
417 lc->io_new_psw.mask = PSW_KERNEL_BITS; 503 lc->io_new_psw.mask = psw_kernel_bits;
418 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler; 504 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler;
419 lc->ipl_device = S390_lowcore.ipl_device; 505 lc->ipl_device = S390_lowcore.ipl_device;
420 lc->jiffy_timer = -1LL; 506 lc->jiffy_timer = -1LL;
@@ -439,7 +525,7 @@ setup_lowcore(void)
439static void __init 525static void __init
440setup_resources(void) 526setup_resources(void)
441{ 527{
442 struct resource *res; 528 struct resource *res, *sub_res;
443 int i; 529 int i;
444 530
445 code_resource.start = (unsigned long) &_text; 531 code_resource.start = (unsigned long) &_text;
@@ -464,8 +550,38 @@ setup_resources(void)
464 res->start = memory_chunk[i].addr; 550 res->start = memory_chunk[i].addr;
465 res->end = memory_chunk[i].addr + memory_chunk[i].size - 1; 551 res->end = memory_chunk[i].addr + memory_chunk[i].size - 1;
466 request_resource(&iomem_resource, res); 552 request_resource(&iomem_resource, res);
467 request_resource(res, &code_resource); 553
468 request_resource(res, &data_resource); 554 if (code_resource.start >= res->start &&
555 code_resource.start <= res->end &&
556 code_resource.end > res->end) {
557 sub_res = alloc_bootmem_low(sizeof(struct resource));
558 memcpy(sub_res, &code_resource,
559 sizeof(struct resource));
560 sub_res->end = res->end;
561 code_resource.start = res->end + 1;
562 request_resource(res, sub_res);
563 }
564
565 if (code_resource.start >= res->start &&
566 code_resource.start <= res->end &&
567 code_resource.end <= res->end)
568 request_resource(res, &code_resource);
569
570 if (data_resource.start >= res->start &&
571 data_resource.start <= res->end &&
572 data_resource.end > res->end) {
573 sub_res = alloc_bootmem_low(sizeof(struct resource));
574 memcpy(sub_res, &data_resource,
575 sizeof(struct resource));
576 sub_res->end = res->end;
577 data_resource.start = res->end + 1;
578 request_resource(res, sub_res);
579 }
580
581 if (data_resource.start >= res->start &&
582 data_resource.start <= res->end &&
583 data_resource.end <= res->end)
584 request_resource(res, &data_resource);
469 } 585 }
470} 586}
471 587
@@ -495,16 +611,13 @@ static void __init setup_memory_end(void)
495 } 611 }
496 if (!memory_end) 612 if (!memory_end)
497 memory_end = memory_size; 613 memory_end = memory_size;
498 if (real_size > memory_end)
499 printk("More memory detected than supported. Unused: %luk\n",
500 (real_size - memory_end) >> 10);
501} 614}
502 615
503static void __init 616static void __init
504setup_memory(void) 617setup_memory(void)
505{ 618{
506 unsigned long bootmap_size; 619 unsigned long bootmap_size;
507 unsigned long start_pfn, end_pfn, init_pfn; 620 unsigned long start_pfn, end_pfn;
508 int i; 621 int i;
509 622
510 /* 623 /*
@@ -514,10 +627,6 @@ setup_memory(void)
514 start_pfn = PFN_UP(__pa(&_end)); 627 start_pfn = PFN_UP(__pa(&_end));
515 end_pfn = max_pfn = PFN_DOWN(memory_end); 628 end_pfn = max_pfn = PFN_DOWN(memory_end);
516 629
517 /* Initialize storage key for kernel pages */
518 for (init_pfn = 0 ; init_pfn < start_pfn; init_pfn++)
519 page_set_storage_key(init_pfn << PAGE_SHIFT, PAGE_DEFAULT_KEY);
520
521#ifdef CONFIG_BLK_DEV_INITRD 630#ifdef CONFIG_BLK_DEV_INITRD
522 /* 631 /*
523 * Move the initrd in case the bitmap of the bootmem allocater 632 * Move the initrd in case the bitmap of the bootmem allocater
@@ -651,6 +760,7 @@ setup_arch(char **cmdline_p)
651 parse_early_param(); 760 parse_early_param();
652 761
653 setup_memory_end(); 762 setup_memory_end();
763 setup_addressing_mode();
654 setup_memory(); 764 setup_memory();
655 setup_resources(); 765 setup_resources();
656 setup_lowcore(); 766 setup_lowcore();
@@ -694,6 +804,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
694 struct cpuinfo_S390 *cpuinfo; 804 struct cpuinfo_S390 *cpuinfo;
695 unsigned long n = (unsigned long) v - 1; 805 unsigned long n = (unsigned long) v - 1;
696 806
807 s390_adjust_jiffies();
697 preempt_disable(); 808 preempt_disable();
698 if (!n) { 809 if (!n) {
699 seq_printf(m, "vendor_id : IBM/S390\n" 810 seq_printf(m, "vendor_id : IBM/S390\n"
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 4c8a7954ef48..554f9cf7499c 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -119,7 +119,7 @@ static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
119 119
120 /* Copy a 'clean' PSW mask to the user to avoid leaking 120 /* Copy a 'clean' PSW mask to the user to avoid leaking
121 information about whether PER is currently on. */ 121 information about whether PER is currently on. */
122 user_sregs.regs.psw.mask = PSW_MASK_MERGE(PSW_USER_BITS, regs->psw.mask); 122 user_sregs.regs.psw.mask = PSW_MASK_MERGE(psw_user_bits, regs->psw.mask);
123 user_sregs.regs.psw.addr = regs->psw.addr; 123 user_sregs.regs.psw.addr = regs->psw.addr;
124 memcpy(&user_sregs.regs.gprs, &regs->gprs, sizeof(sregs->regs.gprs)); 124 memcpy(&user_sregs.regs.gprs, &regs->gprs, sizeof(sregs->regs.gprs));
125 memcpy(&user_sregs.regs.acrs, current->thread.acrs, 125 memcpy(&user_sregs.regs.acrs, current->thread.acrs,
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index c0cd255fddbd..65b52320d145 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -22,23 +22,23 @@
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/init.h> 24#include <linux/init.h>
25
26#include <linux/mm.h> 25#include <linux/mm.h>
27#include <linux/spinlock.h> 26#include <linux/spinlock.h>
28#include <linux/kernel_stat.h> 27#include <linux/kernel_stat.h>
29#include <linux/smp_lock.h> 28#include <linux/smp_lock.h>
30
31#include <linux/delay.h> 29#include <linux/delay.h>
32#include <linux/cache.h> 30#include <linux/cache.h>
33#include <linux/interrupt.h> 31#include <linux/interrupt.h>
34#include <linux/cpu.h> 32#include <linux/cpu.h>
35 33#include <linux/timex.h>
34#include <asm/setup.h>
36#include <asm/sigp.h> 35#include <asm/sigp.h>
37#include <asm/pgalloc.h> 36#include <asm/pgalloc.h>
38#include <asm/irq.h> 37#include <asm/irq.h>
39#include <asm/s390_ext.h> 38#include <asm/s390_ext.h>
40#include <asm/cpcmd.h> 39#include <asm/cpcmd.h>
41#include <asm/tlbflush.h> 40#include <asm/tlbflush.h>
41#include <asm/timer.h>
42 42
43extern volatile int __cpu_logical_map[]; 43extern volatile int __cpu_logical_map[];
44 44
@@ -53,12 +53,6 @@ cpumask_t cpu_possible_map = CPU_MASK_NONE;
53 53
54static struct task_struct *current_set[NR_CPUS]; 54static struct task_struct *current_set[NR_CPUS];
55 55
56/*
57 * Reboot, halt and power_off routines for SMP.
58 */
59extern char vmhalt_cmd[];
60extern char vmpoff_cmd[];
61
62static void smp_ext_bitcall(int, ec_bit_sig); 56static void smp_ext_bitcall(int, ec_bit_sig);
63static void smp_ext_bitcall_others(ec_bit_sig); 57static void smp_ext_bitcall_others(ec_bit_sig);
64 58
@@ -200,7 +194,7 @@ int smp_call_function_on(void (*func) (void *info), void *info,
200} 194}
201EXPORT_SYMBOL(smp_call_function_on); 195EXPORT_SYMBOL(smp_call_function_on);
202 196
203static inline void do_send_stop(void) 197static void do_send_stop(void)
204{ 198{
205 int cpu, rc; 199 int cpu, rc;
206 200
@@ -214,7 +208,7 @@ static inline void do_send_stop(void)
214 } 208 }
215} 209}
216 210
217static inline void do_store_status(void) 211static void do_store_status(void)
218{ 212{
219 int cpu, rc; 213 int cpu, rc;
220 214
@@ -230,7 +224,7 @@ static inline void do_store_status(void)
230 } 224 }
231} 225}
232 226
233static inline void do_wait_for_stop(void) 227static void do_wait_for_stop(void)
234{ 228{
235 int cpu; 229 int cpu;
236 230
@@ -250,7 +244,7 @@ static inline void do_wait_for_stop(void)
250void smp_send_stop(void) 244void smp_send_stop(void)
251{ 245{
252 /* Disable all interrupts/machine checks */ 246 /* Disable all interrupts/machine checks */
253 __load_psw_mask(PSW_KERNEL_BITS & ~PSW_MASK_MCHECK); 247 __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
254 248
255 /* write magic number to zero page (absolute 0) */ 249 /* write magic number to zero page (absolute 0) */
256 lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC; 250 lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC;
@@ -298,7 +292,7 @@ void machine_power_off_smp(void)
298 * cpus are handled. 292 * cpus are handled.
299 */ 293 */
300 294
301void do_ext_call_interrupt(__u16 code) 295static void do_ext_call_interrupt(__u16 code)
302{ 296{
303 unsigned long bits; 297 unsigned long bits;
304 298
@@ -385,7 +379,7 @@ struct ec_creg_mask_parms {
385/* 379/*
386 * callback for setting/clearing control bits 380 * callback for setting/clearing control bits
387 */ 381 */
388void smp_ctl_bit_callback(void *info) { 382static void smp_ctl_bit_callback(void *info) {
389 struct ec_creg_mask_parms *pp = info; 383 struct ec_creg_mask_parms *pp = info;
390 unsigned long cregs[16]; 384 unsigned long cregs[16];
391 int i; 385 int i;
@@ -458,17 +452,15 @@ __init smp_count_cpus(void)
458/* 452/*
459 * Activate a secondary processor. 453 * Activate a secondary processor.
460 */ 454 */
461extern void init_cpu_timer(void);
462extern void init_cpu_vtimer(void);
463
464int __devinit start_secondary(void *cpuvoid) 455int __devinit start_secondary(void *cpuvoid)
465{ 456{
466 /* Setup the cpu */ 457 /* Setup the cpu */
467 cpu_init(); 458 cpu_init();
468 preempt_disable(); 459 preempt_disable();
469 /* init per CPU timer */ 460 /* Enable TOD clock interrupts on the secondary cpu. */
470 init_cpu_timer(); 461 init_cpu_timer();
471#ifdef CONFIG_VIRT_TIMER 462#ifdef CONFIG_VIRT_TIMER
463 /* Enable cpu timer interrupts on the secondary cpu. */
472 init_cpu_vtimer(); 464 init_cpu_vtimer();
473#endif 465#endif
474 /* Enable pfault pseudo page faults on this cpu. */ 466 /* Enable pfault pseudo page faults on this cpu. */
@@ -542,7 +534,7 @@ smp_put_cpu(int cpu)
542 spin_unlock_irqrestore(&smp_reserve_lock, flags); 534 spin_unlock_irqrestore(&smp_reserve_lock, flags);
543} 535}
544 536
545static inline int 537static int
546cpu_stopped(int cpu) 538cpu_stopped(int cpu)
547{ 539{
548 __u32 status; 540 __u32 status;
diff --git a/arch/s390/kernel/stacktrace.c b/arch/s390/kernel/stacktrace.c
index 0d14a4789bf2..2e5c65a1863e 100644
--- a/arch/s390/kernel/stacktrace.c
+++ b/arch/s390/kernel/stacktrace.c
@@ -11,11 +11,11 @@
11#include <linux/stacktrace.h> 11#include <linux/stacktrace.h>
12#include <linux/kallsyms.h> 12#include <linux/kallsyms.h>
13 13
14static inline unsigned long save_context_stack(struct stack_trace *trace, 14static unsigned long save_context_stack(struct stack_trace *trace,
15 unsigned int *skip, 15 unsigned int *skip,
16 unsigned long sp, 16 unsigned long sp,
17 unsigned long low, 17 unsigned long low,
18 unsigned long high) 18 unsigned long high)
19{ 19{
20 struct stack_frame *sf; 20 struct stack_frame *sf;
21 struct pt_regs *regs; 21 struct pt_regs *regs;
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 6cceed4df73e..3b91f27ab202 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -37,11 +37,15 @@
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/irq_regs.h> 38#include <asm/irq_regs.h>
39#include <asm/timer.h> 39#include <asm/timer.h>
40#include <asm/etr.h>
40 41
41/* change this if you have some constant time drift */ 42/* change this if you have some constant time drift */
42#define USECS_PER_JIFFY ((unsigned long) 1000000/HZ) 43#define USECS_PER_JIFFY ((unsigned long) 1000000/HZ)
43#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12) 44#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12)
44 45
46/* The value of the TOD clock for 1.1.1970. */
47#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL
48
45/* 49/*
46 * Create a small time difference between the timer interrupts 50 * Create a small time difference between the timer interrupts
47 * on the different cpus to avoid lock contention. 51 * on the different cpus to avoid lock contention.
@@ -51,6 +55,7 @@
51#define TICK_SIZE tick 55#define TICK_SIZE tick
52 56
53static ext_int_info_t ext_int_info_cc; 57static ext_int_info_t ext_int_info_cc;
58static ext_int_info_t ext_int_etr_cc;
54static u64 init_timer_cc; 59static u64 init_timer_cc;
55static u64 jiffies_timer_cc; 60static u64 jiffies_timer_cc;
56static u64 xtime_cc; 61static u64 xtime_cc;
@@ -89,29 +94,21 @@ void tod_to_timeval(__u64 todval, struct timespec *xtime)
89#define s390_do_profile() do { ; } while(0) 94#define s390_do_profile() do { ; } while(0)
90#endif /* CONFIG_PROFILING */ 95#endif /* CONFIG_PROFILING */
91 96
92
93/* 97/*
94 * timer_interrupt() needs to keep up the real-time clock, 98 * Advance the per cpu tick counter up to the time given with the
95 * as well as call the "do_timer()" routine every clocktick 99 * "time" argument. The per cpu update consists of accounting
100 * the virtual cpu time, calling update_process_times and calling
101 * the profiling hook. If xtime is before time it is advanced as well.
96 */ 102 */
97void account_ticks(void) 103void account_ticks(u64 time)
98{ 104{
99 __u64 tmp;
100 __u32 ticks; 105 __u32 ticks;
106 __u64 tmp;
101 107
102 /* Calculate how many ticks have passed. */ 108 /* Calculate how many ticks have passed. */
103 if (S390_lowcore.int_clock < S390_lowcore.jiffy_timer) { 109 if (time < S390_lowcore.jiffy_timer)
104 /*
105 * We have to program the clock comparator even if
106 * no tick has passed. That happens if e.g. an i/o
107 * interrupt wakes up an idle processor that has
108 * switched off its hz timer.
109 */
110 tmp = S390_lowcore.jiffy_timer + CPU_DEVIATION;
111 asm volatile ("SCKC %0" : : "m" (tmp));
112 return; 110 return;
113 } 111 tmp = time - S390_lowcore.jiffy_timer;
114 tmp = S390_lowcore.int_clock - S390_lowcore.jiffy_timer;
115 if (tmp >= 2*CLK_TICKS_PER_JIFFY) { /* more than two ticks ? */ 112 if (tmp >= 2*CLK_TICKS_PER_JIFFY) { /* more than two ticks ? */
116 ticks = __div(tmp, CLK_TICKS_PER_JIFFY) + 1; 113 ticks = __div(tmp, CLK_TICKS_PER_JIFFY) + 1;
117 S390_lowcore.jiffy_timer += 114 S390_lowcore.jiffy_timer +=
@@ -124,10 +121,6 @@ void account_ticks(void)
124 S390_lowcore.jiffy_timer += CLK_TICKS_PER_JIFFY; 121 S390_lowcore.jiffy_timer += CLK_TICKS_PER_JIFFY;
125 } 122 }
126 123
127 /* set clock comparator for next tick */
128 tmp = S390_lowcore.jiffy_timer + CPU_DEVIATION;
129 asm volatile ("SCKC %0" : : "m" (tmp));
130
131#ifdef CONFIG_SMP 124#ifdef CONFIG_SMP
132 /* 125 /*
133 * Do not rely on the boot cpu to do the calls to do_timer. 126 * Do not rely on the boot cpu to do the calls to do_timer.
@@ -173,7 +166,7 @@ int sysctl_hz_timer = 1;
173 * Stop the HZ tick on the current CPU. 166 * Stop the HZ tick on the current CPU.
174 * Only cpu_idle may call this function. 167 * Only cpu_idle may call this function.
175 */ 168 */
176static inline void stop_hz_timer(void) 169static void stop_hz_timer(void)
177{ 170{
178 unsigned long flags; 171 unsigned long flags;
179 unsigned long seq, next; 172 unsigned long seq, next;
@@ -210,20 +203,21 @@ static inline void stop_hz_timer(void)
210 if (timer >= jiffies_timer_cc) 203 if (timer >= jiffies_timer_cc)
211 todval = timer; 204 todval = timer;
212 } 205 }
213 asm volatile ("SCKC %0" : : "m" (todval)); 206 set_clock_comparator(todval);
214} 207}
215 208
216/* 209/*
217 * Start the HZ tick on the current CPU. 210 * Start the HZ tick on the current CPU.
218 * Only cpu_idle may call this function. 211 * Only cpu_idle may call this function.
219 */ 212 */
220static inline void start_hz_timer(void) 213static void start_hz_timer(void)
221{ 214{
222 BUG_ON(!in_interrupt()); 215 BUG_ON(!in_interrupt());
223 216
224 if (!cpu_isset(smp_processor_id(), nohz_cpu_mask)) 217 if (!cpu_isset(smp_processor_id(), nohz_cpu_mask))
225 return; 218 return;
226 account_ticks(); 219 account_ticks(get_clock());
220 set_clock_comparator(S390_lowcore.jiffy_timer + CPU_DEVIATION);
227 cpu_clear(smp_processor_id(), nohz_cpu_mask); 221 cpu_clear(smp_processor_id(), nohz_cpu_mask);
228} 222}
229 223
@@ -245,7 +239,7 @@ static struct notifier_block nohz_idle_nb = {
245 .notifier_call = nohz_idle_notify, 239 .notifier_call = nohz_idle_notify,
246}; 240};
247 241
248void __init nohz_init(void) 242static void __init nohz_init(void)
249{ 243{
250 if (register_idle_notifier(&nohz_idle_nb)) 244 if (register_idle_notifier(&nohz_idle_nb))
251 panic("Couldn't register idle notifier"); 245 panic("Couldn't register idle notifier");
@@ -254,24 +248,57 @@ void __init nohz_init(void)
254#endif 248#endif
255 249
256/* 250/*
257 * Start the clock comparator on the current CPU. 251 * Set up per cpu jiffy timer and set the clock comparator.
252 */
253static void setup_jiffy_timer(void)
254{
255 /* Set up clock comparator to next jiffy. */
256 S390_lowcore.jiffy_timer =
257 jiffies_timer_cc + (jiffies_64 + 1) * CLK_TICKS_PER_JIFFY;
258 set_clock_comparator(S390_lowcore.jiffy_timer + CPU_DEVIATION);
259}
260
261/*
262 * Set up lowcore and control register of the current cpu to
263 * enable TOD clock and clock comparator interrupts.
258 */ 264 */
259void init_cpu_timer(void) 265void init_cpu_timer(void)
260{ 266{
261 unsigned long cr0; 267 setup_jiffy_timer();
262 __u64 timer;
263 268
264 timer = jiffies_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY; 269 /* Enable clock comparator timer interrupt. */
265 S390_lowcore.jiffy_timer = timer + CLK_TICKS_PER_JIFFY; 270 __ctl_set_bit(0,11);
266 timer += CLK_TICKS_PER_JIFFY + CPU_DEVIATION; 271
267 asm volatile ("SCKC %0" : : "m" (timer)); 272 /* Always allow ETR external interrupts, even without an ETR. */
268 /* allow clock comparator timer interrupt */ 273 __ctl_set_bit(0, 4);
269 __ctl_store(cr0, 0, 0);
270 cr0 |= 0x800;
271 __ctl_load(cr0, 0, 0);
272} 274}
273 275
274extern void vtime_init(void); 276static void clock_comparator_interrupt(__u16 code)
277{
278 /* set clock comparator for next tick */
279 set_clock_comparator(S390_lowcore.jiffy_timer + CPU_DEVIATION);
280}
281
282static void etr_reset(void);
283static void etr_init(void);
284static void etr_ext_handler(__u16);
285
286/*
287 * Get the TOD clock running.
288 */
289static u64 __init reset_tod_clock(void)
290{
291 u64 time;
292
293 etr_reset();
294 if (store_clock(&time) == 0)
295 return time;
296 /* TOD clock not running. Set the clock to Unix Epoch. */
297 if (set_clock(TOD_UNIX_EPOCH) != 0 || store_clock(&time) != 0)
298 panic("TOD clock not operational.");
299
300 return TOD_UNIX_EPOCH;
301}
275 302
276static cycle_t read_tod_clock(void) 303static cycle_t read_tod_clock(void)
277{ 304{
@@ -295,48 +322,31 @@ static struct clocksource clocksource_tod = {
295 */ 322 */
296void __init time_init(void) 323void __init time_init(void)
297{ 324{
298 __u64 set_time_cc; 325 init_timer_cc = reset_tod_clock();
299 int cc; 326 xtime_cc = init_timer_cc + CLK_TICKS_PER_JIFFY;
300
301 /* kick the TOD clock */
302 asm volatile(
303 " stck 0(%2)\n"
304 " ipm %0\n"
305 " srl %0,28"
306 : "=d" (cc), "=m" (init_timer_cc)
307 : "a" (&init_timer_cc) : "cc");
308 switch (cc) {
309 case 0: /* clock in set state: all is fine */
310 break;
311 case 1: /* clock in non-set state: FIXME */
312 printk("time_init: TOD clock in non-set state\n");
313 break;
314 case 2: /* clock in error state: FIXME */
315 printk("time_init: TOD clock in error state\n");
316 break;
317 case 3: /* clock in stopped or not-operational state: FIXME */
318 printk("time_init: TOD clock stopped/non-operational\n");
319 break;
320 }
321 jiffies_timer_cc = init_timer_cc - jiffies_64 * CLK_TICKS_PER_JIFFY; 327 jiffies_timer_cc = init_timer_cc - jiffies_64 * CLK_TICKS_PER_JIFFY;
322 328
323 /* set xtime */ 329 /* set xtime */
324 xtime_cc = init_timer_cc + CLK_TICKS_PER_JIFFY; 330 tod_to_timeval(init_timer_cc - TOD_UNIX_EPOCH, &xtime);
325 set_time_cc = init_timer_cc - 0x8126d60e46000000LL +
326 (0x3c26700LL*1000000*4096);
327 tod_to_timeval(set_time_cc, &xtime);
328 set_normalized_timespec(&wall_to_monotonic, 331 set_normalized_timespec(&wall_to_monotonic,
329 -xtime.tv_sec, -xtime.tv_nsec); 332 -xtime.tv_sec, -xtime.tv_nsec);
330 333
331 /* request the clock comparator external interrupt */ 334 /* request the clock comparator external interrupt */
332 if (register_early_external_interrupt(0x1004, NULL, 335 if (register_early_external_interrupt(0x1004,
336 clock_comparator_interrupt,
333 &ext_int_info_cc) != 0) 337 &ext_int_info_cc) != 0)
334 panic("Couldn't request external interrupt 0x1004"); 338 panic("Couldn't request external interrupt 0x1004");
335 339
336 if (clocksource_register(&clocksource_tod) != 0) 340 if (clocksource_register(&clocksource_tod) != 0)
337 panic("Could not register TOD clock source"); 341 panic("Could not register TOD clock source");
338 342
339 init_cpu_timer(); 343 /* request the etr external interrupt */
344 if (register_early_external_interrupt(0x1406, etr_ext_handler,
345 &ext_int_etr_cc) != 0)
346 panic("Couldn't request external interrupt 0x1406");
347
348 /* Enable TOD clock interrupts on the boot cpu. */
349 init_cpu_timer();
340 350
341#ifdef CONFIG_NO_IDLE_HZ 351#ifdef CONFIG_NO_IDLE_HZ
342 nohz_init(); 352 nohz_init();
@@ -345,5 +355,1048 @@ void __init time_init(void)
345#ifdef CONFIG_VIRT_TIMER 355#ifdef CONFIG_VIRT_TIMER
346 vtime_init(); 356 vtime_init();
347#endif 357#endif
358 etr_init();
359}
360
361/*
362 * External Time Reference (ETR) code.
363 */
364static int etr_port0_online;
365static int etr_port1_online;
366
367static int __init early_parse_etr(char *p)
368{
369 if (strncmp(p, "off", 3) == 0)
370 etr_port0_online = etr_port1_online = 0;
371 else if (strncmp(p, "port0", 5) == 0)
372 etr_port0_online = 1;
373 else if (strncmp(p, "port1", 5) == 0)
374 etr_port1_online = 1;
375 else if (strncmp(p, "on", 2) == 0)
376 etr_port0_online = etr_port1_online = 1;
377 return 0;
378}
379early_param("etr", early_parse_etr);
380
381enum etr_event {
382 ETR_EVENT_PORT0_CHANGE,
383 ETR_EVENT_PORT1_CHANGE,
384 ETR_EVENT_PORT_ALERT,
385 ETR_EVENT_SYNC_CHECK,
386 ETR_EVENT_SWITCH_LOCAL,
387 ETR_EVENT_UPDATE,
388};
389
390enum etr_flags {
391 ETR_FLAG_ENOSYS,
392 ETR_FLAG_EACCES,
393 ETR_FLAG_STEAI,
394};
395
396/*
397 * Valid bit combinations of the eacr register are (x = don't care):
398 * e0 e1 dp p0 p1 ea es sl
399 * 0 0 x 0 0 0 0 0 initial, disabled state
400 * 0 0 x 0 1 1 0 0 port 1 online
401 * 0 0 x 1 0 1 0 0 port 0 online
402 * 0 0 x 1 1 1 0 0 both ports online
403 * 0 1 x 0 1 1 0 0 port 1 online and usable, ETR or PPS mode
404 * 0 1 x 0 1 1 0 1 port 1 online, usable and ETR mode
405 * 0 1 x 0 1 1 1 0 port 1 online, usable, PPS mode, in-sync
406 * 0 1 x 0 1 1 1 1 port 1 online, usable, ETR mode, in-sync
407 * 0 1 x 1 1 1 0 0 both ports online, port 1 usable
408 * 0 1 x 1 1 1 1 0 both ports online, port 1 usable, PPS mode, in-sync
409 * 0 1 x 1 1 1 1 1 both ports online, port 1 usable, ETR mode, in-sync
410 * 1 0 x 1 0 1 0 0 port 0 online and usable, ETR or PPS mode
411 * 1 0 x 1 0 1 0 1 port 0 online, usable and ETR mode
412 * 1 0 x 1 0 1 1 0 port 0 online, usable, PPS mode, in-sync
413 * 1 0 x 1 0 1 1 1 port 0 online, usable, ETR mode, in-sync
414 * 1 0 x 1 1 1 0 0 both ports online, port 0 usable
415 * 1 0 x 1 1 1 1 0 both ports online, port 0 usable, PPS mode, in-sync
416 * 1 0 x 1 1 1 1 1 both ports online, port 0 usable, ETR mode, in-sync
417 * 1 1 x 1 1 1 1 0 both ports online & usable, ETR, in-sync
418 * 1 1 x 1 1 1 1 1 both ports online & usable, ETR, in-sync
419 */
420static struct etr_eacr etr_eacr;
421static u64 etr_tolec; /* time of last eacr update */
422static unsigned long etr_flags;
423static struct etr_aib etr_port0;
424static int etr_port0_uptodate;
425static struct etr_aib etr_port1;
426static int etr_port1_uptodate;
427static unsigned long etr_events;
428static struct timer_list etr_timer;
429static struct tasklet_struct etr_tasklet;
430static DEFINE_PER_CPU(atomic_t, etr_sync_word);
431
432static void etr_timeout(unsigned long dummy);
433static void etr_tasklet_fn(unsigned long dummy);
434
435/*
436 * The etr get_clock function. It will write the current clock value
437 * to the clock pointer and return 0 if the clock is in sync with the
438 * external time source. If the clock mode is local it will return
439 * -ENOSYS and -EAGAIN if the clock is not in sync with the external
440 * reference. This function is what ETR is all about..
441 */
442int get_sync_clock(unsigned long long *clock)
443{
444 atomic_t *sw_ptr;
445 unsigned int sw0, sw1;
446
447 sw_ptr = &get_cpu_var(etr_sync_word);
448 sw0 = atomic_read(sw_ptr);
449 *clock = get_clock();
450 sw1 = atomic_read(sw_ptr);
451 put_cpu_var(etr_sync_sync);
452 if (sw0 == sw1 && (sw0 & 0x80000000U))
453 /* Success: time is in sync. */
454 return 0;
455 if (test_bit(ETR_FLAG_ENOSYS, &etr_flags))
456 return -ENOSYS;
457 if (test_bit(ETR_FLAG_EACCES, &etr_flags))
458 return -EACCES;
459 return -EAGAIN;
460}
461EXPORT_SYMBOL(get_sync_clock);
462
463/*
464 * Make get_sync_clock return -EAGAIN.
465 */
466static void etr_disable_sync_clock(void *dummy)
467{
468 atomic_t *sw_ptr = &__get_cpu_var(etr_sync_word);
469 /*
470 * Clear the in-sync bit 2^31. All get_sync_clock calls will
471 * fail until the sync bit is turned back on. In addition
472 * increase the "sequence" counter to avoid the race of an
473 * etr event and the complete recovery against get_sync_clock.
474 */
475 atomic_clear_mask(0x80000000, sw_ptr);
476 atomic_inc(sw_ptr);
477}
478
479/*
480 * Make get_sync_clock return 0 again.
481 * Needs to be called from a context disabled for preemption.
482 */
483static void etr_enable_sync_clock(void)
484{
485 atomic_t *sw_ptr = &__get_cpu_var(etr_sync_word);
486 atomic_set_mask(0x80000000, sw_ptr);
487}
488
489/*
490 * Reset ETR attachment.
491 */
492static void etr_reset(void)
493{
494 etr_eacr = (struct etr_eacr) {
495 .e0 = 0, .e1 = 0, ._pad0 = 4, .dp = 0,
496 .p0 = 0, .p1 = 0, ._pad1 = 0, .ea = 0,
497 .es = 0, .sl = 0 };
498 if (etr_setr(&etr_eacr) == 0)
499 etr_tolec = get_clock();
500 else {
501 set_bit(ETR_FLAG_ENOSYS, &etr_flags);
502 if (etr_port0_online || etr_port1_online) {
503 printk(KERN_WARNING "Running on non ETR capable "
504 "machine, only local mode available.\n");
505 etr_port0_online = etr_port1_online = 0;
506 }
507 }
508}
509
510static void etr_init(void)
511{
512 struct etr_aib aib;
513
514 if (test_bit(ETR_FLAG_ENOSYS, &etr_flags))
515 return;
516 /* Check if this machine has the steai instruction. */
517 if (etr_steai(&aib, ETR_STEAI_STEPPING_PORT) == 0)
518 set_bit(ETR_FLAG_STEAI, &etr_flags);
519 setup_timer(&etr_timer, etr_timeout, 0UL);
520 tasklet_init(&etr_tasklet, etr_tasklet_fn, 0);
521 if (!etr_port0_online && !etr_port1_online)
522 set_bit(ETR_FLAG_EACCES, &etr_flags);
523 if (etr_port0_online) {
524 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
525 tasklet_hi_schedule(&etr_tasklet);
526 }
527 if (etr_port1_online) {
528 set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events);
529 tasklet_hi_schedule(&etr_tasklet);
530 }
531}
532
533/*
534 * Two sorts of ETR machine checks. The architecture reads:
535 * "When a machine-check niterruption occurs and if a switch-to-local or
536 * ETR-sync-check interrupt request is pending but disabled, this pending
537 * disabled interruption request is indicated and is cleared".
538 * Which means that we can get etr_switch_to_local events from the machine
539 * check handler although the interruption condition is disabled. Lovely..
540 */
541
542/*
543 * Switch to local machine check. This is called when the last usable
544 * ETR port goes inactive. After switch to local the clock is not in sync.
545 */
546void etr_switch_to_local(void)
547{
548 if (!etr_eacr.sl)
549 return;
550 etr_disable_sync_clock(NULL);
551 set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events);
552 tasklet_hi_schedule(&etr_tasklet);
553}
554
555/*
556 * ETR sync check machine check. This is called when the ETR OTE and the
557 * local clock OTE are farther apart than the ETR sync check tolerance.
558 * After a ETR sync check the clock is not in sync. The machine check
559 * is broadcasted to all cpus at the same time.
560 */
561void etr_sync_check(void)
562{
563 if (!etr_eacr.es)
564 return;
565 etr_disable_sync_clock(NULL);
566 set_bit(ETR_EVENT_SYNC_CHECK, &etr_events);
567 tasklet_hi_schedule(&etr_tasklet);
568}
569
570/*
571 * ETR external interrupt. There are two causes:
572 * 1) port state change, check the usability of the port
573 * 2) port alert, one of the ETR-data-validity bits (v1-v2 bits of the
574 * sldr-status word) or ETR-data word 1 (edf1) or ETR-data word 3 (edf3)
575 * or ETR-data word 4 (edf4) has changed.
576 */
577static void etr_ext_handler(__u16 code)
578{
579 struct etr_interruption_parameter *intparm =
580 (struct etr_interruption_parameter *) &S390_lowcore.ext_params;
581
582 if (intparm->pc0)
583 /* ETR port 0 state change. */
584 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
585 if (intparm->pc1)
586 /* ETR port 1 state change. */
587 set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events);
588 if (intparm->eai)
589 /*
590 * ETR port alert on either port 0, 1 or both.
591 * Both ports are not up-to-date now.
592 */
593 set_bit(ETR_EVENT_PORT_ALERT, &etr_events);
594 tasklet_hi_schedule(&etr_tasklet);
595}
596
597static void etr_timeout(unsigned long dummy)
598{
599 set_bit(ETR_EVENT_UPDATE, &etr_events);
600 tasklet_hi_schedule(&etr_tasklet);
601}
602
603/*
604 * Check if the etr mode is pss.
605 */
606static inline int etr_mode_is_pps(struct etr_eacr eacr)
607{
608 return eacr.es && !eacr.sl;
609}
610
611/*
612 * Check if the etr mode is etr.
613 */
614static inline int etr_mode_is_etr(struct etr_eacr eacr)
615{
616 return eacr.es && eacr.sl;
617}
618
619/*
620 * Check if the port can be used for TOD synchronization.
621 * For PPS mode the port has to receive OTEs. For ETR mode
622 * the port has to receive OTEs, the ETR stepping bit has to
623 * be zero and the validity bits for data frame 1, 2, and 3
624 * have to be 1.
625 */
626static int etr_port_valid(struct etr_aib *aib, int port)
627{
628 unsigned int psc;
629
630 /* Check that this port is receiving OTEs. */
631 if (aib->tsp == 0)
632 return 0;
633
634 psc = port ? aib->esw.psc1 : aib->esw.psc0;
635 if (psc == etr_lpsc_pps_mode)
636 return 1;
637 if (psc == etr_lpsc_operational_step)
638 return !aib->esw.y && aib->slsw.v1 &&
639 aib->slsw.v2 && aib->slsw.v3;
640 return 0;
641}
642
643/*
644 * Check if two ports are on the same network.
645 */
646static int etr_compare_network(struct etr_aib *aib1, struct etr_aib *aib2)
647{
648 // FIXME: any other fields we have to compare?
649 return aib1->edf1.net_id == aib2->edf1.net_id;
650}
651
652/*
653 * Wrapper for etr_stei that converts physical port states
654 * to logical port states to be consistent with the output
655 * of stetr (see etr_psc vs. etr_lpsc).
656 */
657static void etr_steai_cv(struct etr_aib *aib, unsigned int func)
658{
659 BUG_ON(etr_steai(aib, func) != 0);
660 /* Convert port state to logical port state. */
661 if (aib->esw.psc0 == 1)
662 aib->esw.psc0 = 2;
663 else if (aib->esw.psc0 == 0 && aib->esw.p == 0)
664 aib->esw.psc0 = 1;
665 if (aib->esw.psc1 == 1)
666 aib->esw.psc1 = 2;
667 else if (aib->esw.psc1 == 0 && aib->esw.p == 1)
668 aib->esw.psc1 = 1;
669}
670
671/*
672 * Check if the aib a2 is still connected to the same attachment as
673 * aib a1, the etv values differ by one and a2 is valid.
674 */
675static int etr_aib_follows(struct etr_aib *a1, struct etr_aib *a2, int p)
676{
677 int state_a1, state_a2;
678
679 /* Paranoia check: e0/e1 should better be the same. */
680 if (a1->esw.eacr.e0 != a2->esw.eacr.e0 ||
681 a1->esw.eacr.e1 != a2->esw.eacr.e1)
682 return 0;
683
684 /* Still connected to the same etr ? */
685 state_a1 = p ? a1->esw.psc1 : a1->esw.psc0;
686 state_a2 = p ? a2->esw.psc1 : a2->esw.psc0;
687 if (state_a1 == etr_lpsc_operational_step) {
688 if (state_a2 != etr_lpsc_operational_step ||
689 a1->edf1.net_id != a2->edf1.net_id ||
690 a1->edf1.etr_id != a2->edf1.etr_id ||
691 a1->edf1.etr_pn != a2->edf1.etr_pn)
692 return 0;
693 } else if (state_a2 != etr_lpsc_pps_mode)
694 return 0;
695
696 /* The ETV value of a2 needs to be ETV of a1 + 1. */
697 if (a1->edf2.etv + 1 != a2->edf2.etv)
698 return 0;
699
700 if (!etr_port_valid(a2, p))
701 return 0;
702
703 return 1;
704}
705
706/*
707 * The time is "clock". xtime is what we think the time is.
708 * Adjust the value by a multiple of jiffies and add the delta to ntp.
709 * "delay" is an approximation how long the synchronization took. If
710 * the time correction is positive, then "delay" is subtracted from
711 * the time difference and only the remaining part is passed to ntp.
712 */
713static void etr_adjust_time(unsigned long long clock, unsigned long long delay)
714{
715 unsigned long long delta, ticks;
716 struct timex adjust;
717
718 /*
719 * We don't have to take the xtime lock because the cpu
720 * executing etr_adjust_time is running disabled in
721 * tasklet context and all other cpus are looping in
722 * etr_sync_cpu_start.
723 */
724 if (clock > xtime_cc) {
725 /* It is later than we thought. */
726 delta = ticks = clock - xtime_cc;
727 delta = ticks = (delta < delay) ? 0 : delta - delay;
728 delta -= do_div(ticks, CLK_TICKS_PER_JIFFY);
729 init_timer_cc = init_timer_cc + delta;
730 jiffies_timer_cc = jiffies_timer_cc + delta;
731 xtime_cc = xtime_cc + delta;
732 adjust.offset = ticks * (1000000 / HZ);
733 } else {
734 /* It is earlier than we thought. */
735 delta = ticks = xtime_cc - clock;
736 delta -= do_div(ticks, CLK_TICKS_PER_JIFFY);
737 init_timer_cc = init_timer_cc - delta;
738 jiffies_timer_cc = jiffies_timer_cc - delta;
739 xtime_cc = xtime_cc - delta;
740 adjust.offset = -ticks * (1000000 / HZ);
741 }
742 if (adjust.offset != 0) {
743 printk(KERN_NOTICE "etr: time adjusted by %li micro-seconds\n",
744 adjust.offset);
745 adjust.modes = ADJ_OFFSET_SINGLESHOT;
746 do_adjtimex(&adjust);
747 }
748}
749
750static void etr_sync_cpu_start(void *dummy)
751{
752 int *in_sync = dummy;
753
754 etr_enable_sync_clock();
755 /*
756 * This looks like a busy wait loop but it isn't. etr_sync_cpus
757 * is called on all other cpus while the TOD clocks is stopped.
758 * __udelay will stop the cpu on an enabled wait psw until the
759 * TOD is running again.
760 */
761 while (*in_sync == 0)
762 __udelay(1);
763 if (*in_sync != 1)
764 /* Didn't work. Clear per-cpu in sync bit again. */
765 etr_disable_sync_clock(NULL);
766 /*
767 * This round of TOD syncing is done. Set the clock comparator
768 * to the next tick and let the processor continue.
769 */
770 setup_jiffy_timer();
771}
772
773static void etr_sync_cpu_end(void *dummy)
774{
775}
776
777/*
778 * Sync the TOD clock using the port refered to by aibp. This port
779 * has to be enabled and the other port has to be disabled. The
780 * last eacr update has to be more than 1.6 seconds in the past.
781 */
782static int etr_sync_clock(struct etr_aib *aib, int port)
783{
784 struct etr_aib *sync_port;
785 unsigned long long clock, delay;
786 int in_sync, follows;
787 int rc;
788
789 /* Check if the current aib is adjacent to the sync port aib. */
790 sync_port = (port == 0) ? &etr_port0 : &etr_port1;
791 follows = etr_aib_follows(sync_port, aib, port);
792 memcpy(sync_port, aib, sizeof(*aib));
793 if (!follows)
794 return -EAGAIN;
795
796 /*
797 * Catch all other cpus and make them wait until we have
798 * successfully synced the clock. smp_call_function will
799 * return after all other cpus are in etr_sync_cpu_start.
800 */
801 in_sync = 0;
802 preempt_disable();
803 smp_call_function(etr_sync_cpu_start,&in_sync,0,0);
804 local_irq_disable();
805 etr_enable_sync_clock();
806
807 /* Set clock to next OTE. */
808 __ctl_set_bit(14, 21);
809 __ctl_set_bit(0, 29);
810 clock = ((unsigned long long) (aib->edf2.etv + 1)) << 32;
811 if (set_clock(clock) == 0) {
812 __udelay(1); /* Wait for the clock to start. */
813 __ctl_clear_bit(0, 29);
814 __ctl_clear_bit(14, 21);
815 etr_stetr(aib);
816 /* Adjust Linux timing variables. */
817 delay = (unsigned long long)
818 (aib->edf2.etv - sync_port->edf2.etv) << 32;
819 etr_adjust_time(clock, delay);
820 setup_jiffy_timer();
821 /* Verify that the clock is properly set. */
822 if (!etr_aib_follows(sync_port, aib, port)) {
823 /* Didn't work. */
824 etr_disable_sync_clock(NULL);
825 in_sync = -EAGAIN;
826 rc = -EAGAIN;
827 } else {
828 in_sync = 1;
829 rc = 0;
830 }
831 } else {
832 /* Could not set the clock ?!? */
833 __ctl_clear_bit(0, 29);
834 __ctl_clear_bit(14, 21);
835 etr_disable_sync_clock(NULL);
836 in_sync = -EAGAIN;
837 rc = -EAGAIN;
838 }
839 local_irq_enable();
840 smp_call_function(etr_sync_cpu_end,NULL,0,0);
841 preempt_enable();
842 return rc;
843}
844
845/*
846 * Handle the immediate effects of the different events.
847 * The port change event is used for online/offline changes.
848 */
849static struct etr_eacr etr_handle_events(struct etr_eacr eacr)
850{
851 if (test_and_clear_bit(ETR_EVENT_SYNC_CHECK, &etr_events))
852 eacr.es = 0;
853 if (test_and_clear_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events))
854 eacr.es = eacr.sl = 0;
855 if (test_and_clear_bit(ETR_EVENT_PORT_ALERT, &etr_events))
856 etr_port0_uptodate = etr_port1_uptodate = 0;
857
858 if (test_and_clear_bit(ETR_EVENT_PORT0_CHANGE, &etr_events)) {
859 if (eacr.e0)
860 /*
861 * Port change of an enabled port. We have to
862 * assume that this can have caused an stepping
863 * port switch.
864 */
865 etr_tolec = get_clock();
866 eacr.p0 = etr_port0_online;
867 if (!eacr.p0)
868 eacr.e0 = 0;
869 etr_port0_uptodate = 0;
870 }
871 if (test_and_clear_bit(ETR_EVENT_PORT1_CHANGE, &etr_events)) {
872 if (eacr.e1)
873 /*
874 * Port change of an enabled port. We have to
875 * assume that this can have caused an stepping
876 * port switch.
877 */
878 etr_tolec = get_clock();
879 eacr.p1 = etr_port1_online;
880 if (!eacr.p1)
881 eacr.e1 = 0;
882 etr_port1_uptodate = 0;
883 }
884 clear_bit(ETR_EVENT_UPDATE, &etr_events);
885 return eacr;
886}
887
888/*
889 * Set up a timer that expires after the etr_tolec + 1.6 seconds if
890 * one of the ports needs an update.
891 */
892static void etr_set_tolec_timeout(unsigned long long now)
893{
894 unsigned long micros;
895
896 if ((!etr_eacr.p0 || etr_port0_uptodate) &&
897 (!etr_eacr.p1 || etr_port1_uptodate))
898 return;
899 micros = (now > etr_tolec) ? ((now - etr_tolec) >> 12) : 0;
900 micros = (micros > 1600000) ? 0 : 1600000 - micros;
901 mod_timer(&etr_timer, jiffies + (micros * HZ) / 1000000 + 1);
902}
903
904/*
905 * Set up a time that expires after 1/2 second.
906 */
907static void etr_set_sync_timeout(void)
908{
909 mod_timer(&etr_timer, jiffies + HZ/2);
910}
911
912/*
913 * Update the aib information for one or both ports.
914 */
915static struct etr_eacr etr_handle_update(struct etr_aib *aib,
916 struct etr_eacr eacr)
917{
918 /* With both ports disabled the aib information is useless. */
919 if (!eacr.e0 && !eacr.e1)
920 return eacr;
921
922 /* Update port0 or port1 with aib stored in etr_tasklet_fn. */
923 if (aib->esw.q == 0) {
924 /* Information for port 0 stored. */
925 if (eacr.p0 && !etr_port0_uptodate) {
926 etr_port0 = *aib;
927 if (etr_port0_online)
928 etr_port0_uptodate = 1;
929 }
930 } else {
931 /* Information for port 1 stored. */
932 if (eacr.p1 && !etr_port1_uptodate) {
933 etr_port1 = *aib;
934 if (etr_port0_online)
935 etr_port1_uptodate = 1;
936 }
937 }
938
939 /*
940 * Do not try to get the alternate port aib if the clock
941 * is not in sync yet.
942 */
943 if (!eacr.es)
944 return eacr;
945
946 /*
947 * If steai is available we can get the information about
948 * the other port immediately. If only stetr is available the
949 * data-port bit toggle has to be used.
950 */
951 if (test_bit(ETR_FLAG_STEAI, &etr_flags)) {
952 if (eacr.p0 && !etr_port0_uptodate) {
953 etr_steai_cv(&etr_port0, ETR_STEAI_PORT_0);
954 etr_port0_uptodate = 1;
955 }
956 if (eacr.p1 && !etr_port1_uptodate) {
957 etr_steai_cv(&etr_port1, ETR_STEAI_PORT_1);
958 etr_port1_uptodate = 1;
959 }
960 } else {
961 /*
962 * One port was updated above, if the other
963 * port is not uptodate toggle dp bit.
964 */
965 if ((eacr.p0 && !etr_port0_uptodate) ||
966 (eacr.p1 && !etr_port1_uptodate))
967 eacr.dp ^= 1;
968 else
969 eacr.dp = 0;
970 }
971 return eacr;
972}
973
974/*
975 * Write new etr control register if it differs from the current one.
976 * Return 1 if etr_tolec has been updated as well.
977 */
978static void etr_update_eacr(struct etr_eacr eacr)
979{
980 int dp_changed;
981
982 if (memcmp(&etr_eacr, &eacr, sizeof(eacr)) == 0)
983 /* No change, return. */
984 return;
985 /*
986 * The disable of an active port of the change of the data port
987 * bit can/will cause a change in the data port.
988 */
989 dp_changed = etr_eacr.e0 > eacr.e0 || etr_eacr.e1 > eacr.e1 ||
990 (etr_eacr.dp ^ eacr.dp) != 0;
991 etr_eacr = eacr;
992 etr_setr(&etr_eacr);
993 if (dp_changed)
994 etr_tolec = get_clock();
995}
996
997/*
998 * ETR tasklet. In this function you'll find the main logic. In
999 * particular this is the only function that calls etr_update_eacr(),
1000 * it "controls" the etr control register.
1001 */
1002static void etr_tasklet_fn(unsigned long dummy)
1003{
1004 unsigned long long now;
1005 struct etr_eacr eacr;
1006 struct etr_aib aib;
1007 int sync_port;
1008
1009 /* Create working copy of etr_eacr. */
1010 eacr = etr_eacr;
1011
1012 /* Check for the different events and their immediate effects. */
1013 eacr = etr_handle_events(eacr);
1014
1015 /* Check if ETR is supposed to be active. */
1016 eacr.ea = eacr.p0 || eacr.p1;
1017 if (!eacr.ea) {
1018 /* Both ports offline. Reset everything. */
1019 eacr.dp = eacr.es = eacr.sl = 0;
1020 on_each_cpu(etr_disable_sync_clock, NULL, 0, 1);
1021 del_timer_sync(&etr_timer);
1022 etr_update_eacr(eacr);
1023 set_bit(ETR_FLAG_EACCES, &etr_flags);
1024 return;
1025 }
1026
1027 /* Store aib to get the current ETR status word. */
1028 BUG_ON(etr_stetr(&aib) != 0);
1029 etr_port0.esw = etr_port1.esw = aib.esw; /* Copy status word. */
1030 now = get_clock();
1031
1032 /*
1033 * Update the port information if the last stepping port change
1034 * or data port change is older than 1.6 seconds.
1035 */
1036 if (now >= etr_tolec + (1600000 << 12))
1037 eacr = etr_handle_update(&aib, eacr);
1038
1039 /*
1040 * Select ports to enable. The prefered synchronization mode is PPS.
1041 * If a port can be enabled depends on a number of things:
1042 * 1) The port needs to be online and uptodate. A port is not
1043 * disabled just because it is not uptodate, but it is only
1044 * enabled if it is uptodate.
1045 * 2) The port needs to have the same mode (pps / etr).
1046 * 3) The port needs to be usable -> etr_port_valid() == 1
1047 * 4) To enable the second port the clock needs to be in sync.
1048 * 5) If both ports are useable and are ETR ports, the network id
1049 * has to be the same.
1050 * The eacr.sl bit is used to indicate etr mode vs. pps mode.
1051 */
1052 if (eacr.p0 && aib.esw.psc0 == etr_lpsc_pps_mode) {
1053 eacr.sl = 0;
1054 eacr.e0 = 1;
1055 if (!etr_mode_is_pps(etr_eacr))
1056 eacr.es = 0;
1057 if (!eacr.es || !eacr.p1 || aib.esw.psc1 != etr_lpsc_pps_mode)
1058 eacr.e1 = 0;
1059 // FIXME: uptodate checks ?
1060 else if (etr_port0_uptodate && etr_port1_uptodate)
1061 eacr.e1 = 1;
1062 sync_port = (etr_port0_uptodate &&
1063 etr_port_valid(&etr_port0, 0)) ? 0 : -1;
1064 clear_bit(ETR_FLAG_EACCES, &etr_flags);
1065 } else if (eacr.p1 && aib.esw.psc1 == etr_lpsc_pps_mode) {
1066 eacr.sl = 0;
1067 eacr.e0 = 0;
1068 eacr.e1 = 1;
1069 if (!etr_mode_is_pps(etr_eacr))
1070 eacr.es = 0;
1071 sync_port = (etr_port1_uptodate &&
1072 etr_port_valid(&etr_port1, 1)) ? 1 : -1;
1073 clear_bit(ETR_FLAG_EACCES, &etr_flags);
1074 } else if (eacr.p0 && aib.esw.psc0 == etr_lpsc_operational_step) {
1075 eacr.sl = 1;
1076 eacr.e0 = 1;
1077 if (!etr_mode_is_etr(etr_eacr))
1078 eacr.es = 0;
1079 if (!eacr.es || !eacr.p1 ||
1080 aib.esw.psc1 != etr_lpsc_operational_alt)
1081 eacr.e1 = 0;
1082 else if (etr_port0_uptodate && etr_port1_uptodate &&
1083 etr_compare_network(&etr_port0, &etr_port1))
1084 eacr.e1 = 1;
1085 sync_port = (etr_port0_uptodate &&
1086 etr_port_valid(&etr_port0, 0)) ? 0 : -1;
1087 clear_bit(ETR_FLAG_EACCES, &etr_flags);
1088 } else if (eacr.p1 && aib.esw.psc1 == etr_lpsc_operational_step) {
1089 eacr.sl = 1;
1090 eacr.e0 = 0;
1091 eacr.e1 = 1;
1092 if (!etr_mode_is_etr(etr_eacr))
1093 eacr.es = 0;
1094 sync_port = (etr_port1_uptodate &&
1095 etr_port_valid(&etr_port1, 1)) ? 1 : -1;
1096 clear_bit(ETR_FLAG_EACCES, &etr_flags);
1097 } else {
1098 /* Both ports not usable. */
1099 eacr.es = eacr.sl = 0;
1100 sync_port = -1;
1101 set_bit(ETR_FLAG_EACCES, &etr_flags);
1102 }
1103
1104 /*
1105 * If the clock is in sync just update the eacr and return.
1106 * If there is no valid sync port wait for a port update.
1107 */
1108 if (eacr.es || sync_port < 0) {
1109 etr_update_eacr(eacr);
1110 etr_set_tolec_timeout(now);
1111 return;
1112 }
1113
1114 /*
1115 * Prepare control register for clock syncing
1116 * (reset data port bit, set sync check control.
1117 */
1118 eacr.dp = 0;
1119 eacr.es = 1;
1120
1121 /*
1122 * Update eacr and try to synchronize the clock. If the update
1123 * of eacr caused a stepping port switch (or if we have to
1124 * assume that a stepping port switch has occured) or the
1125 * clock syncing failed, reset the sync check control bit
1126 * and set up a timer to try again after 0.5 seconds
1127 */
1128 etr_update_eacr(eacr);
1129 if (now < etr_tolec + (1600000 << 12) ||
1130 etr_sync_clock(&aib, sync_port) != 0) {
1131 /* Sync failed. Try again in 1/2 second. */
1132 eacr.es = 0;
1133 etr_update_eacr(eacr);
1134 etr_set_sync_timeout();
1135 } else
1136 etr_set_tolec_timeout(now);
1137}
1138
1139/*
1140 * Sysfs interface functions
1141 */
1142static struct sysdev_class etr_sysclass = {
1143 set_kset_name("etr")
1144};
1145
1146static struct sys_device etr_port0_dev = {
1147 .id = 0,
1148 .cls = &etr_sysclass,
1149};
1150
1151static struct sys_device etr_port1_dev = {
1152 .id = 1,
1153 .cls = &etr_sysclass,
1154};
1155
1156/*
1157 * ETR class attributes
1158 */
1159static ssize_t etr_stepping_port_show(struct sysdev_class *class, char *buf)
1160{
1161 return sprintf(buf, "%i\n", etr_port0.esw.p);
1162}
1163
1164static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL);
1165
1166static ssize_t etr_stepping_mode_show(struct sysdev_class *class, char *buf)
1167{
1168 char *mode_str;
1169
1170 if (etr_mode_is_pps(etr_eacr))
1171 mode_str = "pps";
1172 else if (etr_mode_is_etr(etr_eacr))
1173 mode_str = "etr";
1174 else
1175 mode_str = "local";
1176 return sprintf(buf, "%s\n", mode_str);
1177}
1178
1179static SYSDEV_CLASS_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL);
1180
1181/*
1182 * ETR port attributes
1183 */
1184static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev)
1185{
1186 if (dev == &etr_port0_dev)
1187 return etr_port0_online ? &etr_port0 : NULL;
1188 else
1189 return etr_port1_online ? &etr_port1 : NULL;
1190}
1191
1192static ssize_t etr_online_show(struct sys_device *dev, char *buf)
1193{
1194 unsigned int online;
1195
1196 online = (dev == &etr_port0_dev) ? etr_port0_online : etr_port1_online;
1197 return sprintf(buf, "%i\n", online);
1198}
1199
1200static ssize_t etr_online_store(struct sys_device *dev,
1201 const char *buf, size_t count)
1202{
1203 unsigned int value;
1204
1205 value = simple_strtoul(buf, NULL, 0);
1206 if (value != 0 && value != 1)
1207 return -EINVAL;
1208 if (test_bit(ETR_FLAG_ENOSYS, &etr_flags))
1209 return -ENOSYS;
1210 if (dev == &etr_port0_dev) {
1211 if (etr_port0_online == value)
1212 return count; /* Nothing to do. */
1213 etr_port0_online = value;
1214 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
1215 tasklet_hi_schedule(&etr_tasklet);
1216 } else {
1217 if (etr_port1_online == value)
1218 return count; /* Nothing to do. */
1219 etr_port1_online = value;
1220 set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events);
1221 tasklet_hi_schedule(&etr_tasklet);
1222 }
1223 return count;
1224}
1225
1226static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store);
1227
1228static ssize_t etr_stepping_control_show(struct sys_device *dev, char *buf)
1229{
1230 return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ?
1231 etr_eacr.e0 : etr_eacr.e1);
1232}
1233
1234static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL);
1235
1236static ssize_t etr_mode_code_show(struct sys_device *dev, char *buf)
1237{
1238 if (!etr_port0_online && !etr_port1_online)
1239 /* Status word is not uptodate if both ports are offline. */
1240 return -ENODATA;
1241 return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ?
1242 etr_port0.esw.psc0 : etr_port0.esw.psc1);
1243}
1244
1245static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL);
1246
1247static ssize_t etr_untuned_show(struct sys_device *dev, char *buf)
1248{
1249 struct etr_aib *aib = etr_aib_from_dev(dev);
1250
1251 if (!aib || !aib->slsw.v1)
1252 return -ENODATA;
1253 return sprintf(buf, "%i\n", aib->edf1.u);
1254}
1255
1256static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL);
1257
1258static ssize_t etr_network_id_show(struct sys_device *dev, char *buf)
1259{
1260 struct etr_aib *aib = etr_aib_from_dev(dev);
1261
1262 if (!aib || !aib->slsw.v1)
1263 return -ENODATA;
1264 return sprintf(buf, "%i\n", aib->edf1.net_id);
1265}
1266
1267static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL);
1268
1269static ssize_t etr_id_show(struct sys_device *dev, char *buf)
1270{
1271 struct etr_aib *aib = etr_aib_from_dev(dev);
1272
1273 if (!aib || !aib->slsw.v1)
1274 return -ENODATA;
1275 return sprintf(buf, "%i\n", aib->edf1.etr_id);
1276}
1277
1278static SYSDEV_ATTR(id, 0400, etr_id_show, NULL);
1279
1280static ssize_t etr_port_number_show(struct sys_device *dev, char *buf)
1281{
1282 struct etr_aib *aib = etr_aib_from_dev(dev);
1283
1284 if (!aib || !aib->slsw.v1)
1285 return -ENODATA;
1286 return sprintf(buf, "%i\n", aib->edf1.etr_pn);
1287}
1288
1289static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL);
1290
1291static ssize_t etr_coupled_show(struct sys_device *dev, char *buf)
1292{
1293 struct etr_aib *aib = etr_aib_from_dev(dev);
1294
1295 if (!aib || !aib->slsw.v3)
1296 return -ENODATA;
1297 return sprintf(buf, "%i\n", aib->edf3.c);
1298}
1299
1300static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL);
1301
1302static ssize_t etr_local_time_show(struct sys_device *dev, char *buf)
1303{
1304 struct etr_aib *aib = etr_aib_from_dev(dev);
1305
1306 if (!aib || !aib->slsw.v3)
1307 return -ENODATA;
1308 return sprintf(buf, "%i\n", aib->edf3.blto);
1309}
1310
1311static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL);
1312
1313static ssize_t etr_utc_offset_show(struct sys_device *dev, char *buf)
1314{
1315 struct etr_aib *aib = etr_aib_from_dev(dev);
1316
1317 if (!aib || !aib->slsw.v3)
1318 return -ENODATA;
1319 return sprintf(buf, "%i\n", aib->edf3.buo);
1320}
1321
1322static SYSDEV_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL);
1323
1324static struct sysdev_attribute *etr_port_attributes[] = {
1325 &attr_online,
1326 &attr_stepping_control,
1327 &attr_state_code,
1328 &attr_untuned,
1329 &attr_network,
1330 &attr_id,
1331 &attr_port,
1332 &attr_coupled,
1333 &attr_local_time,
1334 &attr_utc_offset,
1335 NULL
1336};
1337
1338static int __init etr_register_port(struct sys_device *dev)
1339{
1340 struct sysdev_attribute **attr;
1341 int rc;
1342
1343 rc = sysdev_register(dev);
1344 if (rc)
1345 goto out;
1346 for (attr = etr_port_attributes; *attr; attr++) {
1347 rc = sysdev_create_file(dev, *attr);
1348 if (rc)
1349 goto out_unreg;
1350 }
1351 return 0;
1352out_unreg:
1353 for (; attr >= etr_port_attributes; attr--)
1354 sysdev_remove_file(dev, *attr);
1355 sysdev_unregister(dev);
1356out:
1357 return rc;
1358}
1359
1360static void __init etr_unregister_port(struct sys_device *dev)
1361{
1362 struct sysdev_attribute **attr;
1363
1364 for (attr = etr_port_attributes; *attr; attr++)
1365 sysdev_remove_file(dev, *attr);
1366 sysdev_unregister(dev);
1367}
1368
1369static int __init etr_init_sysfs(void)
1370{
1371 int rc;
1372
1373 rc = sysdev_class_register(&etr_sysclass);
1374 if (rc)
1375 goto out;
1376 rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_port);
1377 if (rc)
1378 goto out_unreg_class;
1379 rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_mode);
1380 if (rc)
1381 goto out_remove_stepping_port;
1382 rc = etr_register_port(&etr_port0_dev);
1383 if (rc)
1384 goto out_remove_stepping_mode;
1385 rc = etr_register_port(&etr_port1_dev);
1386 if (rc)
1387 goto out_remove_port0;
1388 return 0;
1389
1390out_remove_port0:
1391 etr_unregister_port(&etr_port0_dev);
1392out_remove_stepping_mode:
1393 sysdev_class_remove_file(&etr_sysclass, &attr_stepping_mode);
1394out_remove_stepping_port:
1395 sysdev_class_remove_file(&etr_sysclass, &attr_stepping_port);
1396out_unreg_class:
1397 sysdev_class_unregister(&etr_sysclass);
1398out:
1399 return rc;
348} 1400}
349 1401
1402device_initcall(etr_init_sysfs);
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 3cbb0dcf1f1d..f0e5a320e2ec 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -283,7 +283,7 @@ char *task_show_regs(struct task_struct *task, char *buffer)
283 return buffer; 283 return buffer;
284} 284}
285 285
286DEFINE_SPINLOCK(die_lock); 286static DEFINE_SPINLOCK(die_lock);
287 287
288void die(const char * str, struct pt_regs * regs, long err) 288void die(const char * str, struct pt_regs * regs, long err)
289{ 289{
@@ -364,8 +364,7 @@ void __kprobes do_single_step(struct pt_regs *regs)
364 force_sig(SIGTRAP, current); 364 force_sig(SIGTRAP, current);
365} 365}
366 366
367asmlinkage void 367static void default_trap_handler(struct pt_regs * regs, long interruption_code)
368default_trap_handler(struct pt_regs * regs, long interruption_code)
369{ 368{
370 if (regs->psw.mask & PSW_MASK_PSTATE) { 369 if (regs->psw.mask & PSW_MASK_PSTATE) {
371 local_irq_enable(); 370 local_irq_enable();
@@ -376,7 +375,7 @@ default_trap_handler(struct pt_regs * regs, long interruption_code)
376} 375}
377 376
378#define DO_ERROR_INFO(signr, str, name, sicode, siaddr) \ 377#define DO_ERROR_INFO(signr, str, name, sicode, siaddr) \
379asmlinkage void name(struct pt_regs * regs, long interruption_code) \ 378static void name(struct pt_regs * regs, long interruption_code) \
380{ \ 379{ \
381 siginfo_t info; \ 380 siginfo_t info; \
382 info.si_signo = signr; \ 381 info.si_signo = signr; \
@@ -442,7 +441,7 @@ do_fp_trap(struct pt_regs *regs, void __user *location,
442 "floating point exception", regs, &si); 441 "floating point exception", regs, &si);
443} 442}
444 443
445asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code) 444static void illegal_op(struct pt_regs * regs, long interruption_code)
446{ 445{
447 siginfo_t info; 446 siginfo_t info;
448 __u8 opcode[6]; 447 __u8 opcode[6];
@@ -491,8 +490,15 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
491#endif 490#endif
492 } else 491 } else
493 signal = SIGILL; 492 signal = SIGILL;
494 } else 493 } else {
495 signal = SIGILL; 494 /*
495 * If we get an illegal op in kernel mode, send it through the
496 * kprobes notifier. If kprobes doesn't pick it up, SIGILL
497 */
498 if (notify_die(DIE_BPT, "bpt", regs, interruption_code,
499 3, SIGTRAP) != NOTIFY_STOP)
500 signal = SIGILL;
501 }
496 502
497#ifdef CONFIG_MATHEMU 503#ifdef CONFIG_MATHEMU
498 if (signal == SIGFPE) 504 if (signal == SIGFPE)
@@ -585,7 +591,7 @@ DO_ERROR_INFO(SIGILL, "specification exception", specification_exception,
585 ILL_ILLOPN, get_check_address(regs)); 591 ILL_ILLOPN, get_check_address(regs));
586#endif 592#endif
587 593
588asmlinkage void data_exception(struct pt_regs * regs, long interruption_code) 594static void data_exception(struct pt_regs * regs, long interruption_code)
589{ 595{
590 __u16 __user *location; 596 __u16 __user *location;
591 int signal = 0; 597 int signal = 0;
@@ -675,7 +681,7 @@ asmlinkage void data_exception(struct pt_regs * regs, long interruption_code)
675 } 681 }
676} 682}
677 683
678asmlinkage void space_switch_exception(struct pt_regs * regs, long int_code) 684static void space_switch_exception(struct pt_regs * regs, long int_code)
679{ 685{
680 siginfo_t info; 686 siginfo_t info;
681 687
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index fe0f2e97ba7b..a48907392522 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -31,18 +31,19 @@ SECTIONS
31 31
32 _etext = .; /* End of text section */ 32 _etext = .; /* End of text section */
33 33
34 . = ALIGN(16); /* Exception table */
35 __start___ex_table = .;
36 __ex_table : { *(__ex_table) }
37 __stop___ex_table = .;
38
39 RODATA 34 RODATA
40 35
41#ifdef CONFIG_SHARED_KERNEL 36#ifdef CONFIG_SHARED_KERNEL
42 . = ALIGN(1048576); /* VM shared segments are 1MB aligned */ 37 . = ALIGN(1048576); /* VM shared segments are 1MB aligned */
38#endif
43 39
40 . = ALIGN(4096);
44 _eshared = .; /* End of shareable data */ 41 _eshared = .; /* End of shareable data */
45#endif 42
43 . = ALIGN(16); /* Exception table */
44 __start___ex_table = .;
45 __ex_table : { *(__ex_table) }
46 __stop___ex_table = .;
46 47
47 .data : { /* Data */ 48 .data : { /* Data */
48 *(.data) 49 *(.data)
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 21baaf5496d6..9d5b02801b46 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -25,7 +25,7 @@
25#include <asm/irq_regs.h> 25#include <asm/irq_regs.h>
26 26
27static ext_int_info_t ext_int_info_timer; 27static ext_int_info_t ext_int_info_timer;
28DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); 28static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
29 29
30#ifdef CONFIG_VIRT_CPU_ACCOUNTING 30#ifdef CONFIG_VIRT_CPU_ACCOUNTING
31/* 31/*
@@ -524,16 +524,15 @@ EXPORT_SYMBOL(del_virt_timer);
524void init_cpu_vtimer(void) 524void init_cpu_vtimer(void)
525{ 525{
526 struct vtimer_queue *vt_list; 526 struct vtimer_queue *vt_list;
527 unsigned long cr0;
528 527
529 /* kick the virtual timer */ 528 /* kick the virtual timer */
530 S390_lowcore.exit_timer = VTIMER_MAX_SLICE; 529 S390_lowcore.exit_timer = VTIMER_MAX_SLICE;
531 S390_lowcore.last_update_timer = VTIMER_MAX_SLICE; 530 S390_lowcore.last_update_timer = VTIMER_MAX_SLICE;
532 asm volatile ("SPT %0" : : "m" (S390_lowcore.last_update_timer)); 531 asm volatile ("SPT %0" : : "m" (S390_lowcore.last_update_timer));
533 asm volatile ("STCK %0" : "=m" (S390_lowcore.last_update_clock)); 532 asm volatile ("STCK %0" : "=m" (S390_lowcore.last_update_clock));
534 __ctl_store(cr0, 0, 0); 533
535 cr0 |= 0x400; 534 /* enable cpu timer interrupts */
536 __ctl_load(cr0, 0, 0); 535 __ctl_set_bit(0,10);
537 536
538 vt_list = &per_cpu(virt_cpu_timer, smp_processor_id()); 537 vt_list = &per_cpu(virt_cpu_timer, smp_processor_id());
539 INIT_LIST_HEAD(&vt_list->list); 538 INIT_LIST_HEAD(&vt_list->list);
@@ -572,6 +571,7 @@ void __init vtime_init(void)
572 if (register_idle_notifier(&vtimer_idle_nb)) 571 if (register_idle_notifier(&vtimer_idle_nb))
573 panic("Couldn't register idle notifier"); 572 panic("Couldn't register idle notifier");
574 573
574 /* Enable cpu timer interrupts on the boot cpu. */
575 init_cpu_vtimer(); 575 init_cpu_vtimer();
576} 576}
577 577
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index b5f94cf3bde8..7a44fed21b35 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -4,7 +4,7 @@
4 4
5EXTRA_AFLAGS := -traditional 5EXTRA_AFLAGS := -traditional
6 6
7lib-y += delay.o string.o uaccess_std.o uaccess_pt.o 7lib-y += delay.o string.o uaccess_std.o uaccess_pt.o qrnnd.o
8lib-$(CONFIG_32BIT) += div64.o 8lib-$(CONFIG_32BIT) += div64.o
9lib-$(CONFIG_64BIT) += uaccess_mvcos.o 9lib-$(CONFIG_64BIT) += uaccess_mvcos.o
10lib-$(CONFIG_SMP) += spinlock.o 10lib-$(CONFIG_SMP) += spinlock.o
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index 027c4742a001..02854449b74b 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/delay.c 2 * arch/s390/lib/delay.c
3 * Precise Delay Loops for S390 3 * Precise Delay Loops for S390
4 * 4 *
5 * S390 version 5 * S390 version
@@ -13,10 +13,8 @@
13 13
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16 16#include <linux/timex.h>
17#ifdef CONFIG_SMP 17#include <linux/irqflags.h>
18#include <asm/smp.h>
19#endif
20 18
21void __delay(unsigned long loops) 19void __delay(unsigned long loops)
22{ 20{
@@ -31,17 +29,39 @@ void __delay(unsigned long loops)
31} 29}
32 30
33/* 31/*
34 * Waits for 'usecs' microseconds using the tod clock, giving up the time slice 32 * Waits for 'usecs' microseconds using the TOD clock comparator.
35 * of the virtual PU inbetween to avoid congestion.
36 */ 33 */
37void __udelay(unsigned long usecs) 34void __udelay(unsigned long usecs)
38{ 35{
39 uint64_t start_cc; 36 u64 end, time, jiffy_timer = 0;
37 unsigned long flags, cr0, mask, dummy;
38
39 local_irq_save(flags);
40 if (raw_irqs_disabled_flags(flags)) {
41 jiffy_timer = S390_lowcore.jiffy_timer;
42 S390_lowcore.jiffy_timer = -1ULL - (4096 << 12);
43 __ctl_store(cr0, 0, 0);
44 dummy = (cr0 & 0xffff00e0) | 0x00000800;
45 __ctl_load(dummy , 0, 0);
46 mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT;
47 } else
48 mask = psw_kernel_bits | PSW_MASK_WAIT |
49 PSW_MASK_EXT | PSW_MASK_IO;
50
51 end = get_clock() + ((u64) usecs << 12);
52 do {
53 time = end < S390_lowcore.jiffy_timer ?
54 end : S390_lowcore.jiffy_timer;
55 set_clock_comparator(time);
56 trace_hardirqs_on();
57 __load_psw_mask(mask);
58 local_irq_disable();
59 } while (get_clock() < end);
40 60
41 if (usecs == 0) 61 if (raw_irqs_disabled_flags(flags)) {
42 return; 62 __ctl_load(cr0, 0, 0);
43 start_cc = get_clock(); 63 S390_lowcore.jiffy_timer = jiffy_timer;
44 do { 64 }
45 cpu_relax(); 65 set_clock_comparator(S390_lowcore.jiffy_timer);
46 } while (((get_clock() - start_cc)/4096) < usecs); 66 local_irq_restore(flags);
47} 67}
diff --git a/arch/s390/lib/qrnnd.S b/arch/s390/lib/qrnnd.S
new file mode 100644
index 000000000000..eb1df632e749
--- /dev/null
+++ b/arch/s390/lib/qrnnd.S
@@ -0,0 +1,77 @@
1# S/390 __udiv_qrnnd
2
3# r2 : &__r
4# r3 : upper half of 64 bit word n
5# r4 : lower half of 64 bit word n
6# r5 : divisor d
7# the reminder r of the division is to be stored to &__r and
8# the quotient q is to be returned
9
10 .text
11 .globl __udiv_qrnnd
12__udiv_qrnnd:
13 st %r2,24(%r15) # store pointer to reminder for later
14 lr %r0,%r3 # reload n
15 lr %r1,%r4
16 ltr %r2,%r5 # reload and test divisor
17 jp 5f
18 # divisor >= 0x80000000
19 srdl %r0,2 # n/4
20 srl %r2,1 # d/2
21 slr %r1,%r2 # special case if last bit of d is set
22 brc 3,0f # (n/4) div (n/2) can overflow by 1
23 ahi %r0,-1 # trick: subtract n/2, then divide
240: dr %r0,%r2 # signed division
25 ahi %r1,1 # trick part 2: add 1 to the quotient
26 # now (n >> 2) = (d >> 1) * %r1 + %r0
27 lhi %r3,1
28 nr %r3,%r1 # test last bit of q
29 jz 1f
30 alr %r0,%r2 # add (d>>1) to r
311: srl %r1,1 # q >>= 1
32 # now (n >> 2) = (d&-2) * %r1 + %r0
33 lhi %r3,1
34 nr %r3,%r5 # test last bit of d
35 jz 2f
36 slr %r0,%r1 # r -= q
37 brc 3,2f # borrow ?
38 alr %r0,%r5 # r += d
39 ahi %r1,-1
402: # now (n >> 2) = d * %r1 + %r0
41 alr %r1,%r1 # q <<= 1
42 alr %r0,%r0 # r <<= 1
43 brc 12,3f # overflow on r ?
44 slr %r0,%r5 # r -= d
45 ahi %r1,1 # q += 1
463: lhi %r3,2
47 nr %r3,%r4 # test next to last bit of n
48 jz 4f
49 ahi %r0,1 # r += 1
504: clr %r0,%r5 # r >= d ?
51 jl 6f
52 slr %r0,%r5 # r -= d
53 ahi %r1,1 # q += 1
54 # now (n >> 1) = d * %r1 + %r0
55 j 6f
565: # divisor < 0x80000000
57 srdl %r0,1
58 dr %r0,%r2 # signed division
59 # now (n >> 1) = d * %r1 + %r0
606: alr %r1,%r1 # q <<= 1
61 alr %r0,%r0 # r <<= 1
62 brc 12,7f # overflow on r ?
63 slr %r0,%r5 # r -= d
64 ahi %r1,1 # q += 1
657: lhi %r3,1
66 nr %r3,%r4 # isolate last bit of n
67 alr %r0,%r3 # r += (n & 1)
68 clr %r0,%r5 # r >= d ?
69 jl 8f
70 slr %r0,%r5 # r -= d
71 ahi %r1,1 # q += 1
728: # now n = d * %r1 + %r0
73 l %r2,24(%r15)
74 st %r0,0(%r2)
75 lr %r2,%r1
76 br %r14
77 .end __udiv_qrnnd
diff --git a/arch/s390/lib/uaccess.h b/arch/s390/lib/uaccess.h
new file mode 100644
index 000000000000..126011df14f1
--- /dev/null
+++ b/arch/s390/lib/uaccess.h
@@ -0,0 +1,23 @@
1/*
2 * arch/s390/uaccess.h
3 *
4 * Copyright IBM Corp. 2007
5 *
6 */
7
8#ifndef __ARCH_S390_LIB_UACCESS_H
9#define __ARCH_S390_LIB_UACCESS_H
10
11extern size_t copy_from_user_std(size_t, const void __user *, void *);
12extern size_t copy_to_user_std(size_t, void __user *, const void *);
13extern size_t strnlen_user_std(size_t, const char __user *);
14extern size_t strncpy_from_user_std(size_t, const char __user *, char *);
15extern int futex_atomic_cmpxchg_std(int __user *, int, int);
16extern int futex_atomic_op_std(int, int __user *, int, int *);
17
18extern size_t copy_from_user_pt(size_t, const void __user *, void *);
19extern size_t copy_to_user_pt(size_t, void __user *, const void *);
20extern int futex_atomic_op_pt(int, int __user *, int, int *);
21extern int futex_atomic_cmpxchg_pt(int __user *, int, int);
22
23#endif /* __ARCH_S390_LIB_UACCESS_H */
diff --git a/arch/s390/lib/uaccess_mvcos.c b/arch/s390/lib/uaccess_mvcos.c
index f9a23d57eb79..6d8772339d76 100644
--- a/arch/s390/lib/uaccess_mvcos.c
+++ b/arch/s390/lib/uaccess_mvcos.c
@@ -12,6 +12,7 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/futex.h> 14#include <asm/futex.h>
15#include "uaccess.h"
15 16
16#ifndef __s390x__ 17#ifndef __s390x__
17#define AHI "ahi" 18#define AHI "ahi"
@@ -27,10 +28,7 @@
27#define SLR "slgr" 28#define SLR "slgr"
28#endif 29#endif
29 30
30extern size_t copy_from_user_std(size_t, const void __user *, void *); 31static size_t copy_from_user_mvcos(size_t size, const void __user *ptr, void *x)
31extern size_t copy_to_user_std(size_t, void __user *, const void *);
32
33size_t copy_from_user_mvcos(size_t size, const void __user *ptr, void *x)
34{ 32{
35 register unsigned long reg0 asm("0") = 0x81UL; 33 register unsigned long reg0 asm("0") = 0x81UL;
36 unsigned long tmp1, tmp2; 34 unsigned long tmp1, tmp2;
@@ -69,14 +67,14 @@ size_t copy_from_user_mvcos(size_t size, const void __user *ptr, void *x)
69 return size; 67 return size;
70} 68}
71 69
72size_t copy_from_user_mvcos_check(size_t size, const void __user *ptr, void *x) 70static size_t copy_from_user_mvcos_check(size_t size, const void __user *ptr, void *x)
73{ 71{
74 if (size <= 256) 72 if (size <= 256)
75 return copy_from_user_std(size, ptr, x); 73 return copy_from_user_std(size, ptr, x);
76 return copy_from_user_mvcos(size, ptr, x); 74 return copy_from_user_mvcos(size, ptr, x);
77} 75}
78 76
79size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x) 77static size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x)
80{ 78{
81 register unsigned long reg0 asm("0") = 0x810000UL; 79 register unsigned long reg0 asm("0") = 0x810000UL;
82 unsigned long tmp1, tmp2; 80 unsigned long tmp1, tmp2;
@@ -105,14 +103,16 @@ size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x)
105 return size; 103 return size;
106} 104}
107 105
108size_t copy_to_user_mvcos_check(size_t size, void __user *ptr, const void *x) 106static size_t copy_to_user_mvcos_check(size_t size, void __user *ptr,
107 const void *x)
109{ 108{
110 if (size <= 256) 109 if (size <= 256)
111 return copy_to_user_std(size, ptr, x); 110 return copy_to_user_std(size, ptr, x);
112 return copy_to_user_mvcos(size, ptr, x); 111 return copy_to_user_mvcos(size, ptr, x);
113} 112}
114 113
115size_t copy_in_user_mvcos(size_t size, void __user *to, const void __user *from) 114static size_t copy_in_user_mvcos(size_t size, void __user *to,
115 const void __user *from)
116{ 116{
117 register unsigned long reg0 asm("0") = 0x810081UL; 117 register unsigned long reg0 asm("0") = 0x810081UL;
118 unsigned long tmp1, tmp2; 118 unsigned long tmp1, tmp2;
@@ -134,7 +134,7 @@ size_t copy_in_user_mvcos(size_t size, void __user *to, const void __user *from)
134 return size; 134 return size;
135} 135}
136 136
137size_t clear_user_mvcos(size_t size, void __user *to) 137static size_t clear_user_mvcos(size_t size, void __user *to)
138{ 138{
139 register unsigned long reg0 asm("0") = 0x810000UL; 139 register unsigned long reg0 asm("0") = 0x810000UL;
140 unsigned long tmp1, tmp2; 140 unsigned long tmp1, tmp2;
@@ -162,10 +162,43 @@ size_t clear_user_mvcos(size_t size, void __user *to)
162 return size; 162 return size;
163} 163}
164 164
165extern size_t strnlen_user_std(size_t, const char __user *); 165static size_t strnlen_user_mvcos(size_t count, const char __user *src)
166extern size_t strncpy_from_user_std(size_t, const char __user *, char *); 166{
167extern int futex_atomic_op(int, int __user *, int, int *); 167 char buf[256];
168extern int futex_atomic_cmpxchg(int __user *, int, int); 168 int rc;
169 size_t done, len, len_str;
170
171 done = 0;
172 do {
173 len = min(count - done, (size_t) 256);
174 rc = uaccess.copy_from_user(len, src + done, buf);
175 if (unlikely(rc == len))
176 return 0;
177 len -= rc;
178 len_str = strnlen(buf, len);
179 done += len_str;
180 } while ((len_str == len) && (done < count));
181 return done + 1;
182}
183
184static size_t strncpy_from_user_mvcos(size_t count, const char __user *src,
185 char *dst)
186{
187 int rc;
188 size_t done, len, len_str;
189
190 done = 0;
191 do {
192 len = min(count - done, (size_t) 4096);
193 rc = uaccess.copy_from_user(len, src + done, dst);
194 if (unlikely(rc == len))
195 return -EFAULT;
196 len -= rc;
197 len_str = strnlen(dst, len);
198 done += len_str;
199 } while ((len_str == len) && (done < count));
200 return done;
201}
169 202
170struct uaccess_ops uaccess_mvcos = { 203struct uaccess_ops uaccess_mvcos = {
171 .copy_from_user = copy_from_user_mvcos_check, 204 .copy_from_user = copy_from_user_mvcos_check,
@@ -176,6 +209,21 @@ struct uaccess_ops uaccess_mvcos = {
176 .clear_user = clear_user_mvcos, 209 .clear_user = clear_user_mvcos,
177 .strnlen_user = strnlen_user_std, 210 .strnlen_user = strnlen_user_std,
178 .strncpy_from_user = strncpy_from_user_std, 211 .strncpy_from_user = strncpy_from_user_std,
179 .futex_atomic_op = futex_atomic_op, 212 .futex_atomic_op = futex_atomic_op_std,
180 .futex_atomic_cmpxchg = futex_atomic_cmpxchg, 213 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_std,
214};
215
216#ifdef CONFIG_S390_SWITCH_AMODE
217struct uaccess_ops uaccess_mvcos_switch = {
218 .copy_from_user = copy_from_user_mvcos,
219 .copy_from_user_small = copy_from_user_mvcos,
220 .copy_to_user = copy_to_user_mvcos,
221 .copy_to_user_small = copy_to_user_mvcos,
222 .copy_in_user = copy_in_user_mvcos,
223 .clear_user = clear_user_mvcos,
224 .strnlen_user = strnlen_user_mvcos,
225 .strncpy_from_user = strncpy_from_user_mvcos,
226 .futex_atomic_op = futex_atomic_op_pt,
227 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_pt,
181}; 228};
229#endif
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index 49c3e46b4065..63181671e3e3 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * arch/s390/lib/uaccess_pt.c 2 * arch/s390/lib/uaccess_pt.c
3 * 3 *
4 * User access functions based on page table walks. 4 * User access functions based on page table walks for enhanced
5 * system layout without hardware support.
5 * 6 *
6 * Copyright IBM Corp. 2006 7 * Copyright IBM Corp. 2006
7 * Author(s): Gerald Schaefer (gerald.schaefer@de.ibm.com) 8 * Author(s): Gerald Schaefer (gerald.schaefer@de.ibm.com)
@@ -12,9 +13,10 @@
12#include <linux/mm.h> 13#include <linux/mm.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14#include <asm/futex.h> 15#include <asm/futex.h>
16#include "uaccess.h"
15 17
16static inline int __handle_fault(struct mm_struct *mm, unsigned long address, 18static int __handle_fault(struct mm_struct *mm, unsigned long address,
17 int write_access) 19 int write_access)
18{ 20{
19 struct vm_area_struct *vma; 21 struct vm_area_struct *vma;
20 int ret = -EFAULT; 22 int ret = -EFAULT;
@@ -79,8 +81,8 @@ out_sigbus:
79 return ret; 81 return ret;
80} 82}
81 83
82static inline size_t __user_copy_pt(unsigned long uaddr, void *kptr, 84static size_t __user_copy_pt(unsigned long uaddr, void *kptr,
83 size_t n, int write_user) 85 size_t n, int write_user)
84{ 86{
85 struct mm_struct *mm = current->mm; 87 struct mm_struct *mm = current->mm;
86 unsigned long offset, pfn, done, size; 88 unsigned long offset, pfn, done, size;
@@ -133,6 +135,49 @@ fault:
133 goto retry; 135 goto retry;
134} 136}
135 137
138/*
139 * Do DAT for user address by page table walk, return kernel address.
140 * This function needs to be called with current->mm->page_table_lock held.
141 */
142static unsigned long __dat_user_addr(unsigned long uaddr)
143{
144 struct mm_struct *mm = current->mm;
145 unsigned long pfn, ret;
146 pgd_t *pgd;
147 pmd_t *pmd;
148 pte_t *pte;
149 int rc;
150
151 ret = 0;
152retry:
153 pgd = pgd_offset(mm, uaddr);
154 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
155 goto fault;
156
157 pmd = pmd_offset(pgd, uaddr);
158 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
159 goto fault;
160
161 pte = pte_offset_map(pmd, uaddr);
162 if (!pte || !pte_present(*pte))
163 goto fault;
164
165 pfn = pte_pfn(*pte);
166 if (!pfn_valid(pfn))
167 goto out;
168
169 ret = (pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE - 1));
170out:
171 return ret;
172fault:
173 spin_unlock(&mm->page_table_lock);
174 rc = __handle_fault(mm, uaddr, 0);
175 spin_lock(&mm->page_table_lock);
176 if (rc)
177 goto out;
178 goto retry;
179}
180
136size_t copy_from_user_pt(size_t n, const void __user *from, void *to) 181size_t copy_from_user_pt(size_t n, const void __user *from, void *to)
137{ 182{
138 size_t rc; 183 size_t rc;
@@ -155,3 +200,277 @@ size_t copy_to_user_pt(size_t n, void __user *to, const void *from)
155 } 200 }
156 return __user_copy_pt((unsigned long) to, (void *) from, n, 1); 201 return __user_copy_pt((unsigned long) to, (void *) from, n, 1);
157} 202}
203
204static size_t clear_user_pt(size_t n, void __user *to)
205{
206 long done, size, ret;
207
208 if (segment_eq(get_fs(), KERNEL_DS)) {
209 memset((void __kernel __force *) to, 0, n);
210 return 0;
211 }
212 done = 0;
213 do {
214 if (n - done > PAGE_SIZE)
215 size = PAGE_SIZE;
216 else
217 size = n - done;
218 ret = __user_copy_pt((unsigned long) to + done,
219 &empty_zero_page, size, 1);
220 done += size;
221 if (ret)
222 return ret + n - done;
223 } while (done < n);
224 return 0;
225}
226
227static size_t strnlen_user_pt(size_t count, const char __user *src)
228{
229 char *addr;
230 unsigned long uaddr = (unsigned long) src;
231 struct mm_struct *mm = current->mm;
232 unsigned long offset, pfn, done, len;
233 pgd_t *pgd;
234 pmd_t *pmd;
235 pte_t *pte;
236 size_t len_str;
237
238 if (segment_eq(get_fs(), KERNEL_DS))
239 return strnlen((const char __kernel __force *) src, count) + 1;
240 done = 0;
241retry:
242 spin_lock(&mm->page_table_lock);
243 do {
244 pgd = pgd_offset(mm, uaddr);
245 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
246 goto fault;
247
248 pmd = pmd_offset(pgd, uaddr);
249 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
250 goto fault;
251
252 pte = pte_offset_map(pmd, uaddr);
253 if (!pte || !pte_present(*pte))
254 goto fault;
255
256 pfn = pte_pfn(*pte);
257 if (!pfn_valid(pfn)) {
258 done = -1;
259 goto out;
260 }
261
262 offset = uaddr & (PAGE_SIZE-1);
263 addr = (char *)(pfn << PAGE_SHIFT) + offset;
264 len = min(count - done, PAGE_SIZE - offset);
265 len_str = strnlen(addr, len);
266 done += len_str;
267 uaddr += len_str;
268 } while ((len_str == len) && (done < count));
269out:
270 spin_unlock(&mm->page_table_lock);
271 return done + 1;
272fault:
273 spin_unlock(&mm->page_table_lock);
274 if (__handle_fault(mm, uaddr, 0)) {
275 return 0;
276 }
277 goto retry;
278}
279
280static size_t strncpy_from_user_pt(size_t count, const char __user *src,
281 char *dst)
282{
283 size_t n = strnlen_user_pt(count, src);
284
285 if (!n)
286 return -EFAULT;
287 if (n > count)
288 n = count;
289 if (segment_eq(get_fs(), KERNEL_DS)) {
290 memcpy(dst, (const char __kernel __force *) src, n);
291 if (dst[n-1] == '\0')
292 return n-1;
293 else
294 return n;
295 }
296 if (__user_copy_pt((unsigned long) src, dst, n, 0))
297 return -EFAULT;
298 if (dst[n-1] == '\0')
299 return n-1;
300 else
301 return n;
302}
303
304static size_t copy_in_user_pt(size_t n, void __user *to,
305 const void __user *from)
306{
307 struct mm_struct *mm = current->mm;
308 unsigned long offset_from, offset_to, offset_max, pfn_from, pfn_to,
309 uaddr, done, size;
310 unsigned long uaddr_from = (unsigned long) from;
311 unsigned long uaddr_to = (unsigned long) to;
312 pgd_t *pgd_from, *pgd_to;
313 pmd_t *pmd_from, *pmd_to;
314 pte_t *pte_from, *pte_to;
315 int write_user;
316
317 done = 0;
318retry:
319 spin_lock(&mm->page_table_lock);
320 do {
321 pgd_from = pgd_offset(mm, uaddr_from);
322 if (pgd_none(*pgd_from) || unlikely(pgd_bad(*pgd_from))) {
323 uaddr = uaddr_from;
324 write_user = 0;
325 goto fault;
326 }
327 pgd_to = pgd_offset(mm, uaddr_to);
328 if (pgd_none(*pgd_to) || unlikely(pgd_bad(*pgd_to))) {
329 uaddr = uaddr_to;
330 write_user = 1;
331 goto fault;
332 }
333
334 pmd_from = pmd_offset(pgd_from, uaddr_from);
335 if (pmd_none(*pmd_from) || unlikely(pmd_bad(*pmd_from))) {
336 uaddr = uaddr_from;
337 write_user = 0;
338 goto fault;
339 }
340 pmd_to = pmd_offset(pgd_to, uaddr_to);
341 if (pmd_none(*pmd_to) || unlikely(pmd_bad(*pmd_to))) {
342 uaddr = uaddr_to;
343 write_user = 1;
344 goto fault;
345 }
346
347 pte_from = pte_offset_map(pmd_from, uaddr_from);
348 if (!pte_from || !pte_present(*pte_from)) {
349 uaddr = uaddr_from;
350 write_user = 0;
351 goto fault;
352 }
353 pte_to = pte_offset_map(pmd_to, uaddr_to);
354 if (!pte_to || !pte_present(*pte_to) || !pte_write(*pte_to)) {
355 uaddr = uaddr_to;
356 write_user = 1;
357 goto fault;
358 }
359
360 pfn_from = pte_pfn(*pte_from);
361 if (!pfn_valid(pfn_from))
362 goto out;
363 pfn_to = pte_pfn(*pte_to);
364 if (!pfn_valid(pfn_to))
365 goto out;
366
367 offset_from = uaddr_from & (PAGE_SIZE-1);
368 offset_to = uaddr_from & (PAGE_SIZE-1);
369 offset_max = max(offset_from, offset_to);
370 size = min(n - done, PAGE_SIZE - offset_max);
371
372 memcpy((void *)(pfn_to << PAGE_SHIFT) + offset_to,
373 (void *)(pfn_from << PAGE_SHIFT) + offset_from, size);
374 done += size;
375 uaddr_from += size;
376 uaddr_to += size;
377 } while (done < n);
378out:
379 spin_unlock(&mm->page_table_lock);
380 return n - done;
381fault:
382 spin_unlock(&mm->page_table_lock);
383 if (__handle_fault(mm, uaddr, write_user))
384 return n - done;
385 goto retry;
386}
387
388#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
389 asm volatile("0: l %1,0(%6)\n" \
390 "1: " insn \
391 "2: cs %1,%2,0(%6)\n" \
392 "3: jl 1b\n" \
393 " lhi %0,0\n" \
394 "4:\n" \
395 EX_TABLE(0b,4b) EX_TABLE(2b,4b) EX_TABLE(3b,4b) \
396 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
397 "=m" (*uaddr) \
398 : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \
399 "m" (*uaddr) : "cc" );
400
401int futex_atomic_op_pt(int op, int __user *uaddr, int oparg, int *old)
402{
403 int oldval = 0, newval, ret;
404
405 spin_lock(&current->mm->page_table_lock);
406 uaddr = (int __user *) __dat_user_addr((unsigned long) uaddr);
407 if (!uaddr) {
408 spin_unlock(&current->mm->page_table_lock);
409 return -EFAULT;
410 }
411 get_page(virt_to_page(uaddr));
412 spin_unlock(&current->mm->page_table_lock);
413 switch (op) {
414 case FUTEX_OP_SET:
415 __futex_atomic_op("lr %2,%5\n",
416 ret, oldval, newval, uaddr, oparg);
417 break;
418 case FUTEX_OP_ADD:
419 __futex_atomic_op("lr %2,%1\nar %2,%5\n",
420 ret, oldval, newval, uaddr, oparg);
421 break;
422 case FUTEX_OP_OR:
423 __futex_atomic_op("lr %2,%1\nor %2,%5\n",
424 ret, oldval, newval, uaddr, oparg);
425 break;
426 case FUTEX_OP_ANDN:
427 __futex_atomic_op("lr %2,%1\nnr %2,%5\n",
428 ret, oldval, newval, uaddr, oparg);
429 break;
430 case FUTEX_OP_XOR:
431 __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
432 ret, oldval, newval, uaddr, oparg);
433 break;
434 default:
435 ret = -ENOSYS;
436 }
437 put_page(virt_to_page(uaddr));
438 *old = oldval;
439 return ret;
440}
441
442int futex_atomic_cmpxchg_pt(int __user *uaddr, int oldval, int newval)
443{
444 int ret;
445
446 spin_lock(&current->mm->page_table_lock);
447 uaddr = (int __user *) __dat_user_addr((unsigned long) uaddr);
448 if (!uaddr) {
449 spin_unlock(&current->mm->page_table_lock);
450 return -EFAULT;
451 }
452 get_page(virt_to_page(uaddr));
453 spin_unlock(&current->mm->page_table_lock);
454 asm volatile(" cs %1,%4,0(%5)\n"
455 "0: lr %0,%1\n"
456 "1:\n"
457 EX_TABLE(0b,1b)
458 : "=d" (ret), "+d" (oldval), "=m" (*uaddr)
459 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr)
460 : "cc", "memory" );
461 put_page(virt_to_page(uaddr));
462 return ret;
463}
464
465struct uaccess_ops uaccess_pt = {
466 .copy_from_user = copy_from_user_pt,
467 .copy_from_user_small = copy_from_user_pt,
468 .copy_to_user = copy_to_user_pt,
469 .copy_to_user_small = copy_to_user_pt,
470 .copy_in_user = copy_in_user_pt,
471 .clear_user = clear_user_pt,
472 .strnlen_user = strnlen_user_pt,
473 .strncpy_from_user = strncpy_from_user_pt,
474 .futex_atomic_op = futex_atomic_op_pt,
475 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_pt,
476};
diff --git a/arch/s390/lib/uaccess_std.c b/arch/s390/lib/uaccess_std.c
index 56a0214e9928..28c4500a58d0 100644
--- a/arch/s390/lib/uaccess_std.c
+++ b/arch/s390/lib/uaccess_std.c
@@ -13,6 +13,7 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/uaccess.h> 14#include <linux/uaccess.h>
15#include <asm/futex.h> 15#include <asm/futex.h>
16#include "uaccess.h"
16 17
17#ifndef __s390x__ 18#ifndef __s390x__
18#define AHI "ahi" 19#define AHI "ahi"
@@ -28,9 +29,6 @@
28#define SLR "slgr" 29#define SLR "slgr"
29#endif 30#endif
30 31
31extern size_t copy_from_user_pt(size_t n, const void __user *from, void *to);
32extern size_t copy_to_user_pt(size_t n, void __user *to, const void *from);
33
34size_t copy_from_user_std(size_t size, const void __user *ptr, void *x) 32size_t copy_from_user_std(size_t size, const void __user *ptr, void *x)
35{ 33{
36 unsigned long tmp1, tmp2; 34 unsigned long tmp1, tmp2;
@@ -72,7 +70,8 @@ size_t copy_from_user_std(size_t size, const void __user *ptr, void *x)
72 return size; 70 return size;
73} 71}
74 72
75size_t copy_from_user_std_check(size_t size, const void __user *ptr, void *x) 73static size_t copy_from_user_std_check(size_t size, const void __user *ptr,
74 void *x)
76{ 75{
77 if (size <= 1024) 76 if (size <= 1024)
78 return copy_from_user_std(size, ptr, x); 77 return copy_from_user_std(size, ptr, x);
@@ -110,14 +109,16 @@ size_t copy_to_user_std(size_t size, void __user *ptr, const void *x)
110 return size; 109 return size;
111} 110}
112 111
113size_t copy_to_user_std_check(size_t size, void __user *ptr, const void *x) 112static size_t copy_to_user_std_check(size_t size, void __user *ptr,
113 const void *x)
114{ 114{
115 if (size <= 1024) 115 if (size <= 1024)
116 return copy_to_user_std(size, ptr, x); 116 return copy_to_user_std(size, ptr, x);
117 return copy_to_user_pt(size, ptr, x); 117 return copy_to_user_pt(size, ptr, x);
118} 118}
119 119
120size_t copy_in_user_std(size_t size, void __user *to, const void __user *from) 120static size_t copy_in_user_std(size_t size, void __user *to,
121 const void __user *from)
121{ 122{
122 unsigned long tmp1; 123 unsigned long tmp1;
123 124
@@ -148,7 +149,7 @@ size_t copy_in_user_std(size_t size, void __user *to, const void __user *from)
148 return size; 149 return size;
149} 150}
150 151
151size_t clear_user_std(size_t size, void __user *to) 152static size_t clear_user_std(size_t size, void __user *to)
152{ 153{
153 unsigned long tmp1, tmp2; 154 unsigned long tmp1, tmp2;
154 155
@@ -254,7 +255,7 @@ size_t strncpy_from_user_std(size_t size, const char __user *src, char *dst)
254 : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \ 255 : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \
255 "m" (*uaddr) : "cc"); 256 "m" (*uaddr) : "cc");
256 257
257int futex_atomic_op(int op, int __user *uaddr, int oparg, int *old) 258int futex_atomic_op_std(int op, int __user *uaddr, int oparg, int *old)
258{ 259{
259 int oldval = 0, newval, ret; 260 int oldval = 0, newval, ret;
260 261
@@ -286,7 +287,7 @@ int futex_atomic_op(int op, int __user *uaddr, int oparg, int *old)
286 return ret; 287 return ret;
287} 288}
288 289
289int futex_atomic_cmpxchg(int __user *uaddr, int oldval, int newval) 290int futex_atomic_cmpxchg_std(int __user *uaddr, int oldval, int newval)
290{ 291{
291 int ret; 292 int ret;
292 293
@@ -311,6 +312,6 @@ struct uaccess_ops uaccess_std = {
311 .clear_user = clear_user_std, 312 .clear_user = clear_user_std,
312 .strnlen_user = strnlen_user_std, 313 .strnlen_user = strnlen_user_std,
313 .strncpy_from_user = strncpy_from_user_std, 314 .strncpy_from_user = strncpy_from_user_std,
314 .futex_atomic_op = futex_atomic_op, 315 .futex_atomic_op = futex_atomic_op_std,
315 .futex_atomic_cmpxchg = futex_atomic_cmpxchg, 316 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_std,
316}; 317};
diff --git a/arch/s390/math-emu/Makefile b/arch/s390/math-emu/Makefile
index c10df144f2ab..73b3e72efc46 100644
--- a/arch/s390/math-emu/Makefile
+++ b/arch/s390/math-emu/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the FPU instruction emulation. 2# Makefile for the FPU instruction emulation.
3# 3#
4 4
5obj-$(CONFIG_MATHEMU) := math.o qrnnd.o 5obj-$(CONFIG_MATHEMU) := math.o
6 6
7EXTRA_CFLAGS := -I$(src) -Iinclude/math-emu -w 7EXTRA_CFLAGS := -I$(src) -Iinclude/math-emu -w
8EXTRA_AFLAGS := -traditional 8EXTRA_AFLAGS := -traditional
diff --git a/arch/s390/math-emu/math.c b/arch/s390/math-emu/math.c
index 6b9aec5a2c18..3ee78ccb617d 100644
--- a/arch/s390/math-emu/math.c
+++ b/arch/s390/math-emu/math.c
@@ -15,7 +15,7 @@
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/lowcore.h> 16#include <asm/lowcore.h>
17 17
18#include "sfp-util.h" 18#include <asm/sfp-util.h>
19#include <math-emu/soft-fp.h> 19#include <math-emu/soft-fp.h>
20#include <math-emu/single.h> 20#include <math-emu/single.h>
21#include <math-emu/double.h> 21#include <math-emu/double.h>
diff --git a/arch/s390/math-emu/qrnnd.S b/arch/s390/math-emu/qrnnd.S
deleted file mode 100644
index b01c2b648e22..000000000000
--- a/arch/s390/math-emu/qrnnd.S
+++ /dev/null
@@ -1,77 +0,0 @@
1# S/390 __udiv_qrnnd
2
3# r2 : &__r
4# r3 : upper half of 64 bit word n
5# r4 : lower half of 64 bit word n
6# r5 : divisor d
7# the reminder r of the division is to be stored to &__r and
8# the quotient q is to be returned
9
10 .text
11 .globl __udiv_qrnnd
12__udiv_qrnnd:
13 st %r2,24(%r15) # store pointer to reminder for later
14 lr %r0,%r3 # reload n
15 lr %r1,%r4
16 ltr %r2,%r5 # reload and test divisor
17 jp 5f
18 # divisor >= 0x80000000
19 srdl %r0,2 # n/4
20 srl %r2,1 # d/2
21 slr %r1,%r2 # special case if last bit of d is set
22 brc 3,0f # (n/4) div (n/2) can overflow by 1
23 ahi %r0,-1 # trick: subtract n/2, then divide
240: dr %r0,%r2 # signed division
25 ahi %r1,1 # trick part 2: add 1 to the quotient
26 # now (n >> 2) = (d >> 1) * %r1 + %r0
27 lhi %r3,1
28 nr %r3,%r1 # test last bit of q
29 jz 1f
30 alr %r0,%r2 # add (d>>1) to r
311: srl %r1,1 # q >>= 1
32 # now (n >> 2) = (d&-2) * %r1 + %r0
33 lhi %r3,1
34 nr %r3,%r5 # test last bit of d
35 jz 2f
36 slr %r0,%r1 # r -= q
37 brc 3,2f # borrow ?
38 alr %r0,%r5 # r += d
39 ahi %r1,-1
402: # now (n >> 2) = d * %r1 + %r0
41 alr %r1,%r1 # q <<= 1
42 alr %r0,%r0 # r <<= 1
43 brc 12,3f # overflow on r ?
44 slr %r0,%r5 # r -= d
45 ahi %r1,1 # q += 1
463: lhi %r3,2
47 nr %r3,%r4 # test next to last bit of n
48 jz 4f
49 ahi %r0,1 # r += 1
504: clr %r0,%r5 # r >= d ?
51 jl 6f
52 slr %r0,%r5 # r -= d
53 ahi %r1,1 # q += 1
54 # now (n >> 1) = d * %r1 + %r0
55 j 6f
565: # divisor < 0x80000000
57 srdl %r0,1
58 dr %r0,%r2 # signed division
59 # now (n >> 1) = d * %r1 + %r0
606: alr %r1,%r1 # q <<= 1
61 alr %r0,%r0 # r <<= 1
62 brc 12,7f # overflow on r ?
63 slr %r0,%r5 # r -= d
64 ahi %r1,1 # q += 1
657: lhi %r3,1
66 nr %r3,%r4 # isolate last bit of n
67 alr %r0,%r3 # r += (n & 1)
68 clr %r0,%r5 # r >= d ?
69 jl 8f
70 slr %r0,%r5 # r -= d
71 ahi %r1,1 # q += 1
728: # now n = d * %r1 + %r0
73 l %r2,24(%r15)
74 st %r0,0(%r2)
75 lr %r2,%r1
76 br %r14
77 .end __udiv_qrnnd
diff --git a/arch/s390/math-emu/sfp-util.h b/arch/s390/math-emu/sfp-util.h
deleted file mode 100644
index 5b6ca4570ea4..000000000000
--- a/arch/s390/math-emu/sfp-util.h
+++ /dev/null
@@ -1,66 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/sched.h>
3#include <linux/types.h>
4#include <asm/byteorder.h>
5
6#define add_ssaaaa(sh, sl, ah, al, bh, bl) ({ \
7 unsigned int __sh = (ah); \
8 unsigned int __sl = (al); \
9 asm volatile( \
10 " alr %1,%3\n" \
11 " brc 12,0f\n" \
12 " ahi %0,1\n" \
13 "0: alr %0,%2" \
14 : "+&d" (__sh), "+d" (__sl) \
15 : "d" (bh), "d" (bl) : "cc"); \
16 (sh) = __sh; \
17 (sl) = __sl; \
18})
19
20#define sub_ddmmss(sh, sl, ah, al, bh, bl) ({ \
21 unsigned int __sh = (ah); \
22 unsigned int __sl = (al); \
23 asm volatile( \
24 " slr %1,%3\n" \
25 " brc 3,0f\n" \
26 " ahi %0,-1\n" \
27 "0: slr %0,%2" \
28 : "+&d" (__sh), "+d" (__sl) \
29 : "d" (bh), "d" (bl) : "cc"); \
30 (sh) = __sh; \
31 (sl) = __sl; \
32})
33
34/* a umul b = a mul b + (a>=2<<31) ? b<<32:0 + (b>=2<<31) ? a<<32:0 */
35#define umul_ppmm(wh, wl, u, v) ({ \
36 unsigned int __wh = u; \
37 unsigned int __wl = v; \
38 asm volatile( \
39 " ltr 1,%0\n" \
40 " mr 0,%1\n" \
41 " jnm 0f\n" \
42 " alr 0,%1\n" \
43 "0: ltr %1,%1\n" \
44 " jnm 1f\n" \
45 " alr 0,%0\n" \
46 "1: lr %0,0\n" \
47 " lr %1,1\n" \
48 : "+d" (__wh), "+d" (__wl) \
49 : : "0", "1", "cc"); \
50 wh = __wh; \
51 wl = __wl; \
52})
53
54#define udiv_qrnnd(q, r, n1, n0, d) \
55 do { unsigned long __r; \
56 (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
57 (r) = __r; \
58 } while (0)
59extern unsigned long __udiv_qrnnd (unsigned long *, unsigned long,
60 unsigned long , unsigned long);
61
62#define UDIV_NEEDS_NORMALIZATION 0
63
64#define abort() return 0
65
66#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 607f50ead1fd..f93a056869bc 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -245,7 +245,7 @@ cmm_set_timeout(long nr, long seconds)
245 cmm_set_timer(); 245 cmm_set_timer();
246} 246}
247 247
248static inline int 248static int
249cmm_skip_blanks(char *cp, char **endp) 249cmm_skip_blanks(char *cp, char **endp)
250{ 250{
251 char *str; 251 char *str;
@@ -414,7 +414,7 @@ cmm_smsg_target(char *from, char *msg)
414} 414}
415#endif 415#endif
416 416
417struct ctl_table_header *cmm_sysctl_header; 417static struct ctl_table_header *cmm_sysctl_header;
418 418
419static int 419static int
420cmm_init (void) 420cmm_init (void)
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index 775bf19e742b..394980b05e6f 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/bootmem.h> 16#include <linux/bootmem.h>
17#include <linux/ctype.h> 17#include <linux/ctype.h>
18#include <linux/ioport.h>
18#include <asm/page.h> 19#include <asm/page.h>
19#include <asm/pgtable.h> 20#include <asm/pgtable.h>
20#include <asm/ebcdic.h> 21#include <asm/ebcdic.h>
@@ -70,6 +71,7 @@ struct qin64 {
70struct dcss_segment { 71struct dcss_segment {
71 struct list_head list; 72 struct list_head list;
72 char dcss_name[8]; 73 char dcss_name[8];
74 char res_name[15];
73 unsigned long start_addr; 75 unsigned long start_addr;
74 unsigned long end; 76 unsigned long end;
75 atomic_t ref_count; 77 atomic_t ref_count;
@@ -77,6 +79,7 @@ struct dcss_segment {
77 unsigned int vm_segtype; 79 unsigned int vm_segtype;
78 struct qrange range[6]; 80 struct qrange range[6];
79 int segcnt; 81 int segcnt;
82 struct resource *res;
80}; 83};
81 84
82static DEFINE_MUTEX(dcss_lock); 85static DEFINE_MUTEX(dcss_lock);
@@ -88,7 +91,7 @@ static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC",
88 * Create the 8 bytes, ebcdic VM segment name from 91 * Create the 8 bytes, ebcdic VM segment name from
89 * an ascii name. 92 * an ascii name.
90 */ 93 */
91static void inline 94static void
92dcss_mkname(char *name, char *dcss_name) 95dcss_mkname(char *name, char *dcss_name)
93{ 96{
94 int i; 97 int i;
@@ -303,6 +306,29 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
303 goto out_free; 306 goto out_free;
304 } 307 }
305 308
309 seg->res = kzalloc(sizeof(struct resource), GFP_KERNEL);
310 if (seg->res == NULL) {
311 rc = -ENOMEM;
312 goto out_shared;
313 }
314 seg->res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
315 seg->res->start = seg->start_addr;
316 seg->res->end = seg->end;
317 memcpy(&seg->res_name, seg->dcss_name, 8);
318 EBCASC(seg->res_name, 8);
319 seg->res_name[8] = '\0';
320 strncat(seg->res_name, " (DCSS)", 7);
321 seg->res->name = seg->res_name;
322 rc = seg->vm_segtype;
323 if (rc == SEG_TYPE_SC ||
324 ((rc == SEG_TYPE_SR || rc == SEG_TYPE_ER) && !do_nonshared))
325 seg->res->flags |= IORESOURCE_READONLY;
326 if (request_resource(&iomem_resource, seg->res)) {
327 rc = -EBUSY;
328 kfree(seg->res);
329 goto out_shared;
330 }
331
306 if (do_nonshared) 332 if (do_nonshared)
307 dcss_command = DCSS_LOADNSR; 333 dcss_command = DCSS_LOADNSR;
308 else 334 else
@@ -316,12 +342,11 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
316 rc = dcss_diag_translate_rc (seg->end); 342 rc = dcss_diag_translate_rc (seg->end);
317 dcss_diag(DCSS_PURGESEG, seg->dcss_name, 343 dcss_diag(DCSS_PURGESEG, seg->dcss_name,
318 &seg->start_addr, &seg->end); 344 &seg->start_addr, &seg->end);
319 goto out_shared; 345 goto out_resource;
320 } 346 }
321 seg->do_nonshared = do_nonshared; 347 seg->do_nonshared = do_nonshared;
322 atomic_set(&seg->ref_count, 1); 348 atomic_set(&seg->ref_count, 1);
323 list_add(&seg->list, &dcss_list); 349 list_add(&seg->list, &dcss_list);
324 rc = seg->vm_segtype;
325 *addr = seg->start_addr; 350 *addr = seg->start_addr;
326 *end = seg->end; 351 *end = seg->end;
327 if (do_nonshared) 352 if (do_nonshared)
@@ -329,12 +354,16 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
329 "type %s in non-shared mode\n", name, 354 "type %s in non-shared mode\n", name,
330 (void*)seg->start_addr, (void*)seg->end, 355 (void*)seg->start_addr, (void*)seg->end,
331 segtype_string[seg->vm_segtype]); 356 segtype_string[seg->vm_segtype]);
332 else 357 else {
333 PRINT_INFO ("segment_load: loaded segment %s range %p .. %p " 358 PRINT_INFO ("segment_load: loaded segment %s range %p .. %p "
334 "type %s in shared mode\n", name, 359 "type %s in shared mode\n", name,
335 (void*)seg->start_addr, (void*)seg->end, 360 (void*)seg->start_addr, (void*)seg->end,
336 segtype_string[seg->vm_segtype]); 361 segtype_string[seg->vm_segtype]);
362 }
337 goto out; 363 goto out;
364 out_resource:
365 release_resource(seg->res);
366 kfree(seg->res);
338 out_shared: 367 out_shared:
339 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 368 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1);
340 out_free: 369 out_free:
@@ -401,6 +430,7 @@ segment_load (char *name, int do_nonshared, unsigned long *addr,
401 * -ENOENT : no such segment (segment gone!) 430 * -ENOENT : no such segment (segment gone!)
402 * -EAGAIN : segment is in use by other exploiters, try later 431 * -EAGAIN : segment is in use by other exploiters, try later
403 * -EINVAL : no segment with the given name is currently loaded - name invalid 432 * -EINVAL : no segment with the given name is currently loaded - name invalid
433 * -EBUSY : segment can temporarily not be used (overlaps with dcss)
404 * 0 : operation succeeded 434 * 0 : operation succeeded
405 */ 435 */
406int 436int
@@ -428,12 +458,24 @@ segment_modify_shared (char *name, int do_nonshared)
428 rc = -EAGAIN; 458 rc = -EAGAIN;
429 goto out_unlock; 459 goto out_unlock;
430 } 460 }
431 dcss_diag(DCSS_PURGESEG, seg->dcss_name, 461 release_resource(seg->res);
432 &dummy, &dummy); 462 if (do_nonshared) {
433 if (do_nonshared)
434 dcss_command = DCSS_LOADNSR; 463 dcss_command = DCSS_LOADNSR;
435 else 464 seg->res->flags &= ~IORESOURCE_READONLY;
436 dcss_command = DCSS_LOADNOLY; 465 } else {
466 dcss_command = DCSS_LOADNOLY;
467 if (seg->vm_segtype == SEG_TYPE_SR ||
468 seg->vm_segtype == SEG_TYPE_ER)
469 seg->res->flags |= IORESOURCE_READONLY;
470 }
471 if (request_resource(&iomem_resource, seg->res)) {
472 PRINT_WARN("segment_modify_shared: could not reload segment %s"
473 " - overlapping resources\n", name);
474 rc = -EBUSY;
475 kfree(seg->res);
476 goto out_del;
477 }
478 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy);
437 diag_cc = dcss_diag(dcss_command, seg->dcss_name, 479 diag_cc = dcss_diag(dcss_command, seg->dcss_name,
438 &seg->start_addr, &seg->end); 480 &seg->start_addr, &seg->end);
439 if (diag_cc > 1) { 481 if (diag_cc > 1) {
@@ -446,9 +488,9 @@ segment_modify_shared (char *name, int do_nonshared)
446 rc = 0; 488 rc = 0;
447 goto out_unlock; 489 goto out_unlock;
448 out_del: 490 out_del:
491 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1);
449 list_del(&seg->list); 492 list_del(&seg->list);
450 dcss_diag(DCSS_PURGESEG, seg->dcss_name, 493 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy);
451 &dummy, &dummy);
452 kfree(seg); 494 kfree(seg);
453 out_unlock: 495 out_unlock:
454 mutex_unlock(&dcss_lock); 496 mutex_unlock(&dcss_lock);
@@ -478,6 +520,8 @@ segment_unload(char *name)
478 } 520 }
479 if (atomic_dec_return(&seg->ref_count) != 0) 521 if (atomic_dec_return(&seg->ref_count) != 0)
480 goto out_unlock; 522 goto out_unlock;
523 release_resource(seg->res);
524 kfree(seg->res);
481 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 525 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1);
482 list_del(&seg->list); 526 list_del(&seg->list);
483 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy); 527 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy);
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index cd85e34d8703..9ff143e87746 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -52,7 +52,7 @@ extern int sysctl_userprocess_debug;
52extern void die(const char *,struct pt_regs *,long); 52extern void die(const char *,struct pt_regs *,long);
53 53
54#ifdef CONFIG_KPROBES 54#ifdef CONFIG_KPROBES
55ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 55static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
56int register_page_fault_notifier(struct notifier_block *nb) 56int register_page_fault_notifier(struct notifier_block *nb)
57{ 57{
58 return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 58 return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
@@ -137,7 +137,9 @@ static int __check_access_register(struct pt_regs *regs, int error_code)
137 137
138/* 138/*
139 * Check which address space the address belongs to. 139 * Check which address space the address belongs to.
140 * Returns 1 for user space and 0 for kernel space. 140 * May return 1 or 2 for user space and 0 for kernel space.
141 * Returns 2 for user space in primary addressing mode with
142 * CONFIG_S390_EXEC_PROTECT on and kernel parameter noexec=on.
141 */ 143 */
142static inline int check_user_space(struct pt_regs *regs, int error_code) 144static inline int check_user_space(struct pt_regs *regs, int error_code)
143{ 145{
@@ -154,7 +156,7 @@ static inline int check_user_space(struct pt_regs *regs, int error_code)
154 return __check_access_register(regs, error_code); 156 return __check_access_register(regs, error_code);
155 if (descriptor == 2) 157 if (descriptor == 2)
156 return current->thread.mm_segment.ar4; 158 return current->thread.mm_segment.ar4;
157 return descriptor != 0; 159 return ((descriptor != 0) ^ (switch_amode)) << s390_noexec;
158} 160}
159 161
160/* 162/*
@@ -183,6 +185,77 @@ static void do_sigsegv(struct pt_regs *regs, unsigned long error_code,
183 force_sig_info(SIGSEGV, &si, current); 185 force_sig_info(SIGSEGV, &si, current);
184} 186}
185 187
188#ifdef CONFIG_S390_EXEC_PROTECT
189extern long sys_sigreturn(struct pt_regs *regs);
190extern long sys_rt_sigreturn(struct pt_regs *regs);
191extern long sys32_sigreturn(struct pt_regs *regs);
192extern long sys32_rt_sigreturn(struct pt_regs *regs);
193
194static inline void do_sigreturn(struct mm_struct *mm, struct pt_regs *regs,
195 int rt)
196{
197 up_read(&mm->mmap_sem);
198 clear_tsk_thread_flag(current, TIF_SINGLE_STEP);
199#ifdef CONFIG_COMPAT
200 if (test_tsk_thread_flag(current, TIF_31BIT)) {
201 if (rt)
202 sys32_rt_sigreturn(regs);
203 else
204 sys32_sigreturn(regs);
205 return;
206 }
207#endif /* CONFIG_COMPAT */
208 if (rt)
209 sys_rt_sigreturn(regs);
210 else
211 sys_sigreturn(regs);
212 return;
213}
214
215static int signal_return(struct mm_struct *mm, struct pt_regs *regs,
216 unsigned long address, unsigned long error_code)
217{
218 pgd_t *pgd;
219 pmd_t *pmd;
220 pte_t *pte;
221 u16 *instruction;
222 unsigned long pfn, uaddr = regs->psw.addr;
223
224 spin_lock(&mm->page_table_lock);
225 pgd = pgd_offset(mm, uaddr);
226 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
227 goto out_fault;
228 pmd = pmd_offset(pgd, uaddr);
229 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
230 goto out_fault;
231 pte = pte_offset_map(pmd_offset(pgd_offset(mm, uaddr), uaddr), uaddr);
232 if (!pte || !pte_present(*pte))
233 goto out_fault;
234 pfn = pte_pfn(*pte);
235 if (!pfn_valid(pfn))
236 goto out_fault;
237 spin_unlock(&mm->page_table_lock);
238
239 instruction = (u16 *) ((pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE-1)));
240 if (*instruction == 0x0a77)
241 do_sigreturn(mm, regs, 0);
242 else if (*instruction == 0x0aad)
243 do_sigreturn(mm, regs, 1);
244 else {
245 printk("- XXX - do_exception: task = %s, primary, NO EXEC "
246 "-> SIGSEGV\n", current->comm);
247 up_read(&mm->mmap_sem);
248 current->thread.prot_addr = address;
249 current->thread.trap_no = error_code;
250 do_sigsegv(regs, error_code, SEGV_MAPERR, address);
251 }
252 return 0;
253out_fault:
254 spin_unlock(&mm->page_table_lock);
255 return -EFAULT;
256}
257#endif /* CONFIG_S390_EXEC_PROTECT */
258
186/* 259/*
187 * This routine handles page faults. It determines the address, 260 * This routine handles page faults. It determines the address,
188 * and the problem, and then passes it off to one of the appropriate 261 * and the problem, and then passes it off to one of the appropriate
@@ -260,6 +333,17 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int is_protection)
260 vma = find_vma(mm, address); 333 vma = find_vma(mm, address);
261 if (!vma) 334 if (!vma)
262 goto bad_area; 335 goto bad_area;
336
337#ifdef CONFIG_S390_EXEC_PROTECT
338 if (unlikely((user_address == 2) && !(vma->vm_flags & VM_EXEC)))
339 if (!signal_return(mm, regs, address, error_code))
340 /*
341 * signal_return() has done an up_read(&mm->mmap_sem)
342 * if it returns 0.
343 */
344 return;
345#endif
346
263 if (vma->vm_start <= address) 347 if (vma->vm_start <= address)
264 goto good_area; 348 goto good_area;
265 if (!(vma->vm_flags & VM_GROWSDOWN)) 349 if (!(vma->vm_flags & VM_GROWSDOWN))
@@ -452,8 +536,7 @@ void pfault_fini(void)
452 : : "a" (&refbk), "m" (refbk) : "cc"); 536 : : "a" (&refbk), "m" (refbk) : "cc");
453} 537}
454 538
455asmlinkage void 539static void pfault_interrupt(__u16 error_code)
456pfault_interrupt(__u16 error_code)
457{ 540{
458 struct task_struct *tsk; 541 struct task_struct *tsk;
459 __u16 subcode; 542 __u16 subcode;
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 4bb21be3b007..b3e7c45efb63 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -25,7 +25,7 @@
25#include <linux/bootmem.h> 25#include <linux/bootmem.h>
26#include <linux/pfn.h> 26#include <linux/pfn.h>
27#include <linux/poison.h> 27#include <linux/poison.h>
28 28#include <linux/initrd.h>
29#include <asm/processor.h> 29#include <asm/processor.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
@@ -95,20 +95,18 @@ static void __init setup_ro_region(void)
95 pte_t new_pte; 95 pte_t new_pte;
96 unsigned long address, end; 96 unsigned long address, end;
97 97
98 address = ((unsigned long)&__start_rodata) & PAGE_MASK; 98 address = ((unsigned long)&_stext) & PAGE_MASK;
99 end = PFN_ALIGN((unsigned long)&__end_rodata); 99 end = PFN_ALIGN((unsigned long)&_eshared);
100 100
101 for (; address < end; address += PAGE_SIZE) { 101 for (; address < end; address += PAGE_SIZE) {
102 pgd = pgd_offset_k(address); 102 pgd = pgd_offset_k(address);
103 pmd = pmd_offset(pgd, address); 103 pmd = pmd_offset(pgd, address);
104 pte = pte_offset_kernel(pmd, address); 104 pte = pte_offset_kernel(pmd, address);
105 new_pte = mk_pte_phys(address, __pgprot(_PAGE_RO)); 105 new_pte = mk_pte_phys(address, __pgprot(_PAGE_RO));
106 set_pte(pte, new_pte); 106 *pte = new_pte;
107 } 107 }
108} 108}
109 109
110extern void vmem_map_init(void);
111
112/* 110/*
113 * paging_init() sets up the page tables 111 * paging_init() sets up the page tables
114 */ 112 */
@@ -125,11 +123,11 @@ void __init paging_init(void)
125#ifdef CONFIG_64BIT 123#ifdef CONFIG_64BIT
126 pgdir_k = (__pa(swapper_pg_dir) & PAGE_MASK) | _KERN_REGION_TABLE; 124 pgdir_k = (__pa(swapper_pg_dir) & PAGE_MASK) | _KERN_REGION_TABLE;
127 for (i = 0; i < PTRS_PER_PGD; i++) 125 for (i = 0; i < PTRS_PER_PGD; i++)
128 pgd_clear(pg_dir + i); 126 pgd_clear_kernel(pg_dir + i);
129#else 127#else
130 pgdir_k = (__pa(swapper_pg_dir) & PAGE_MASK) | _KERNSEG_TABLE; 128 pgdir_k = (__pa(swapper_pg_dir) & PAGE_MASK) | _KERNSEG_TABLE;
131 for (i = 0; i < PTRS_PER_PGD; i++) 129 for (i = 0; i < PTRS_PER_PGD; i++)
132 pmd_clear((pmd_t *)(pg_dir + i)); 130 pmd_clear_kernel((pmd_t *)(pg_dir + i));
133#endif 131#endif
134 vmem_map_init(); 132 vmem_map_init();
135 setup_ro_region(); 133 setup_ro_region();
@@ -174,10 +172,8 @@ void __init mem_init(void)
174 datasize >>10, 172 datasize >>10,
175 initsize >> 10); 173 initsize >> 10);
176 printk("Write protected kernel read-only data: %#lx - %#lx\n", 174 printk("Write protected kernel read-only data: %#lx - %#lx\n",
177 (unsigned long)&__start_rodata, 175 (unsigned long)&_stext,
178 PFN_ALIGN((unsigned long)&__end_rodata) - 1); 176 PFN_ALIGN((unsigned long)&_eshared) - 1);
179 printk("Virtual memmap size: %ldk\n",
180 (max_pfn * sizeof(struct page)) >> 10);
181} 177}
182 178
183void free_initmem(void) 179void free_initmem(void)
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index cd3d93e8c211..92a565190028 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -82,7 +82,7 @@ static inline pmd_t *vmem_pmd_alloc(void)
82 if (!pmd) 82 if (!pmd)
83 return NULL; 83 return NULL;
84 for (i = 0; i < PTRS_PER_PMD; i++) 84 for (i = 0; i < PTRS_PER_PMD; i++)
85 pmd_clear(pmd + i); 85 pmd_clear_kernel(pmd + i);
86 return pmd; 86 return pmd;
87} 87}
88 88
@@ -97,7 +97,7 @@ static inline pte_t *vmem_pte_alloc(void)
97 return NULL; 97 return NULL;
98 pte_val(empty_pte) = _PAGE_TYPE_EMPTY; 98 pte_val(empty_pte) = _PAGE_TYPE_EMPTY;
99 for (i = 0; i < PTRS_PER_PTE; i++) 99 for (i = 0; i < PTRS_PER_PTE; i++)
100 set_pte(pte + i, empty_pte); 100 pte[i] = empty_pte;
101 return pte; 101 return pte;
102} 102}
103 103
@@ -119,7 +119,7 @@ static int vmem_add_range(unsigned long start, unsigned long size)
119 pm_dir = vmem_pmd_alloc(); 119 pm_dir = vmem_pmd_alloc();
120 if (!pm_dir) 120 if (!pm_dir)
121 goto out; 121 goto out;
122 pgd_populate(&init_mm, pg_dir, pm_dir); 122 pgd_populate_kernel(&init_mm, pg_dir, pm_dir);
123 } 123 }
124 124
125 pm_dir = pmd_offset(pg_dir, address); 125 pm_dir = pmd_offset(pg_dir, address);
@@ -132,7 +132,7 @@ static int vmem_add_range(unsigned long start, unsigned long size)
132 132
133 pt_dir = pte_offset_kernel(pm_dir, address); 133 pt_dir = pte_offset_kernel(pm_dir, address);
134 pte = pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL); 134 pte = pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL);
135 set_pte(pt_dir, pte); 135 *pt_dir = pte;
136 } 136 }
137 ret = 0; 137 ret = 0;
138out: 138out:
@@ -161,7 +161,7 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
161 if (pmd_none(*pm_dir)) 161 if (pmd_none(*pm_dir))
162 continue; 162 continue;
163 pt_dir = pte_offset_kernel(pm_dir, address); 163 pt_dir = pte_offset_kernel(pm_dir, address);
164 set_pte(pt_dir, pte); 164 *pt_dir = pte;
165 } 165 }
166 flush_tlb_kernel_range(start, start + size); 166 flush_tlb_kernel_range(start, start + size);
167} 167}
@@ -191,7 +191,7 @@ static int vmem_add_mem_map(unsigned long start, unsigned long size)
191 pm_dir = vmem_pmd_alloc(); 191 pm_dir = vmem_pmd_alloc();
192 if (!pm_dir) 192 if (!pm_dir)
193 goto out; 193 goto out;
194 pgd_populate(&init_mm, pg_dir, pm_dir); 194 pgd_populate_kernel(&init_mm, pg_dir, pm_dir);
195 } 195 }
196 196
197 pm_dir = pmd_offset(pg_dir, address); 197 pm_dir = pmd_offset(pg_dir, address);
@@ -210,7 +210,7 @@ static int vmem_add_mem_map(unsigned long start, unsigned long size)
210 if (!new_page) 210 if (!new_page)
211 goto out; 211 goto out;
212 pte = pfn_pte(new_page >> PAGE_SHIFT, PAGE_KERNEL); 212 pte = pfn_pte(new_page >> PAGE_SHIFT, PAGE_KERNEL);
213 set_pte(pt_dir, pte); 213 *pt_dir = pte;
214 } 214 }
215 } 215 }
216 ret = 0; 216 ret = 0;
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 3aa3b885ab36..4f3891215b87 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -48,6 +48,9 @@ config GENERIC_IOMAP
48config GENERIC_TIME 48config GENERIC_TIME
49 def_bool n 49 def_bool n
50 50
51config SYS_SUPPORTS_APM_EMULATION
52 bool
53
51config ARCH_MAY_HAVE_PC_FDC 54config ARCH_MAY_HAVE_PC_FDC
52 bool 55 bool
53 56
@@ -126,6 +129,7 @@ config SH_7751_SYSTEMH
126 129
127config SH_HP6XX 130config SH_HP6XX
128 bool "HP6XX" 131 bool "HP6XX"
132 select SYS_SUPPORTS_APM_EMULATION
129 help 133 help
130 Select HP6XX if configuring for a HP jornada HP6xx. 134 Select HP6XX if configuring for a HP jornada HP6xx.
131 More information (hardware only) at 135 More information (hardware only) at
@@ -694,9 +698,6 @@ depends on EXPERIMENTAL
694 698
695source kernel/power/Kconfig 699source kernel/power/Kconfig
696 700
697config APM
698 bool "Advanced Power Management Emulation"
699 depends on PM
700endmenu 701endmenu
701 702
702source "net/Kconfig" 703source "net/Kconfig"
diff --git a/arch/sh/boards/hp6xx/hp6xx_apm.c b/arch/sh/boards/hp6xx/hp6xx_apm.c
index d146cdaa0b8b..d1c1460c8a06 100644
--- a/arch/sh/boards/hp6xx/hp6xx_apm.c
+++ b/arch/sh/boards/hp6xx/hp6xx_apm.c
@@ -7,12 +7,11 @@
7 * modify it under the terms of the GNU General Public License. 7 * modify it under the terms of the GNU General Public License.
8 */ 8 */
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/apm_bios.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
12#include <linux/init.h> 11#include <linux/init.h>
13#include <linux/interrupt.h> 12#include <linux/interrupt.h>
14#include <asm/io.h> 13#include <linux/apm-emulation.h>
15#include <asm/apm.h> 14#include <linux/io.h>
16#include <asm/adc.h> 15#include <asm/adc.h>
17#include <asm/hp6xx.h> 16#include <asm/hp6xx.h>
18 17
@@ -27,60 +26,41 @@
27 26
28#define MODNAME "hp6x0_apm" 27#define MODNAME "hp6x0_apm"
29 28
30static int hp6x0_apm_get_info(char *buf, char **start, off_t fpos, int length) 29static void hp6x0_apm_get_power_status(struct apm_power_info *info)
31{ 30{
31 int battery, backup, charging, percentage;
32 u8 pgdr; 32 u8 pgdr;
33 char *p;
34 int battery_status;
35 int battery_flag;
36 int ac_line_status;
37 int time_units = APM_BATTERY_LIFE_UNKNOWN;
38 33
39 int battery = adc_single(ADC_CHANNEL_BATTERY); 34 battery = adc_single(ADC_CHANNEL_BATTERY);
40 int backup = adc_single(ADC_CHANNEL_BACKUP); 35 backup = adc_single(ADC_CHANNEL_BACKUP);
41 int charging = adc_single(ADC_CHANNEL_CHARGE); 36 charging = adc_single(ADC_CHANNEL_CHARGE);
42 int percentage;
43 37
44 percentage = 100 * (battery - HP680_BATTERY_MIN) / 38 percentage = 100 * (battery - HP680_BATTERY_MIN) /
45 (HP680_BATTERY_MAX - HP680_BATTERY_MIN); 39 (HP680_BATTERY_MAX - HP680_BATTERY_MIN);
46 40
47 ac_line_status = (battery > HP680_BATTERY_AC_ON) ? 41 info->ac_line_status = (battery > HP680_BATTERY_AC_ON) ?
48 APM_AC_ONLINE : APM_AC_OFFLINE; 42 APM_AC_ONLINE : APM_AC_OFFLINE;
49 43
50 p = buf;
51
52 pgdr = ctrl_inb(SH7709_PGDR); 44 pgdr = ctrl_inb(SH7709_PGDR);
53 if (pgdr & PGDR_MAIN_BATTERY_OUT) { 45 if (pgdr & PGDR_MAIN_BATTERY_OUT) {
54 battery_status = APM_BATTERY_STATUS_NOT_PRESENT; 46 info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT;
55 battery_flag = 0x80; 47 info->battery_flag = 0x80;
56 percentage = -1; 48 } else if (charging < 8) {
57 } else if (charging < 8 ) { 49 info->battery_status = APM_BATTERY_STATUS_CHARGING;
58 battery_status = APM_BATTERY_STATUS_CHARGING; 50 info->battery_flag = 0x08;
59 battery_flag = 0x08; 51 info->ac_line_status = 0xff;
60 ac_line_status = 0xff;
61 } else if (percentage <= APM_CRITICAL) { 52 } else if (percentage <= APM_CRITICAL) {
62 battery_status = APM_BATTERY_STATUS_CRITICAL; 53 info->battery_status = APM_BATTERY_STATUS_CRITICAL;
63 battery_flag = 0x04; 54 info->battery_flag = 0x04;
64 } else if (percentage <= APM_LOW) { 55 } else if (percentage <= APM_LOW) {
65 battery_status = APM_BATTERY_STATUS_LOW; 56 info->battery_status = APM_BATTERY_STATUS_LOW;
66 battery_flag = 0x02; 57 info->battery_flag = 0x02;
67 } else { 58 } else {
68 battery_status = APM_BATTERY_STATUS_HIGH; 59 info->battery_status = APM_BATTERY_STATUS_HIGH;
69 battery_flag = 0x01; 60 info->battery_flag = 0x01;
70 } 61 }
71 62
72 p += sprintf(p, "1.0 1.2 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n", 63 info->units = 0;
73 APM_32_BIT_SUPPORT,
74 ac_line_status,
75 battery_status,
76 battery_flag,
77 percentage,
78 time_units,
79 "min");
80 p += sprintf(p, "bat=%d backup=%d charge=%d\n",
81 battery, backup, charging);
82
83 return p - buf;
84} 64}
85 65
86static irqreturn_t hp6x0_apm_interrupt(int irq, void *dev) 66static irqreturn_t hp6x0_apm_interrupt(int irq, void *dev)
@@ -96,14 +76,14 @@ static int __init hp6x0_apm_init(void)
96 int ret; 76 int ret;
97 77
98 ret = request_irq(HP680_BTN_IRQ, hp6x0_apm_interrupt, 78 ret = request_irq(HP680_BTN_IRQ, hp6x0_apm_interrupt,
99 IRQF_DISABLED, MODNAME, 0); 79 IRQF_DISABLED, MODNAME, NULL);
100 if (unlikely(ret < 0)) { 80 if (unlikely(ret < 0)) {
101 printk(KERN_ERR MODNAME ": IRQ %d request failed\n", 81 printk(KERN_ERR MODNAME ": IRQ %d request failed\n",
102 HP680_BTN_IRQ); 82 HP680_BTN_IRQ);
103 return ret; 83 return ret;
104 } 84 }
105 85
106 apm_get_info = hp6x0_apm_get_info; 86 apm_get_power_status = hp6x0_apm_get_power_status;
107 87
108 return ret; 88 return ret;
109} 89}
@@ -111,7 +91,7 @@ static int __init hp6x0_apm_init(void)
111static void __exit hp6x0_apm_exit(void) 91static void __exit hp6x0_apm_exit(void)
112{ 92{
113 free_irq(HP680_BTN_IRQ, 0); 93 free_irq(HP680_BTN_IRQ, 0);
114 apm_get_info = 0; 94 apm_get_info = NULL;
115} 95}
116 96
117module_init(hp6x0_apm_init); 97module_init(hp6x0_apm_init);
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 99c7e5249f7a..2f6d2bcb1c93 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -19,6 +19,5 @@ obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
19obj-$(CONFIG_MODULES) += module.o 19obj-$(CONFIG_MODULES) += module.o
20obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 20obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
21obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 21obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
22obj-$(CONFIG_APM) += apm.o
23obj-$(CONFIG_PM) += pm.o 22obj-$(CONFIG_PM) += pm.o
24obj-$(CONFIG_STACKTRACE) += stacktrace.o 23obj-$(CONFIG_STACKTRACE) += stacktrace.o
diff --git a/arch/sh/kernel/apm.c b/arch/sh/kernel/apm.c
deleted file mode 100644
index 4f66f91b1006..000000000000
--- a/arch/sh/kernel/apm.c
+++ /dev/null
@@ -1,538 +0,0 @@
1/*
2 * bios-less APM driver for hp680
3 *
4 * Copyright 2005 (c) Andriy Skulysh <askulysh@gmail.com>
5 *
6 * based on ARM APM driver by
7 * Jamey Hicks <jamey@crl.dec.com>
8 *
9 * adapted from the APM BIOS driver for Linux by
10 * Stephen Rothwell (sfr@linuxcare.com)
11 *
12 * APM 1.2 Reference:
13 * Intel Corporation, Microsoft Corporation. Advanced Power Management
14 * (APM) BIOS Interface Specification, Revision 1.2, February 1996.
15 *
16 * [This document is available from Microsoft at:
17 * http://www.microsoft.com/hwdev/busbios/amp_12.htm]
18 */
19#include <linux/module.h>
20#include <linux/poll.h>
21#include <linux/timer.h>
22#include <linux/slab.h>
23#include <linux/proc_fs.h>
24#include <linux/miscdevice.h>
25#include <linux/apm_bios.h>
26#include <linux/pm.h>
27#include <linux/pm_legacy.h>
28#include <asm/apm.h>
29
30#define MODNAME "apm"
31
32/*
33 * The apm_bios device is one of the misc char devices.
34 * This is its minor number.
35 */
36#define APM_MINOR_DEV 134
37
38/*
39 * Maximum number of events stored
40 */
41#define APM_MAX_EVENTS 16
42
43struct apm_queue {
44 unsigned int event_head;
45 unsigned int event_tail;
46 apm_event_t events[APM_MAX_EVENTS];
47};
48
49/*
50 * The per-file APM data
51 */
52struct apm_user {
53 struct list_head list;
54
55 unsigned int suser: 1;
56 unsigned int writer: 1;
57 unsigned int reader: 1;
58
59 int suspend_result;
60 unsigned int suspend_state;
61#define SUSPEND_NONE 0 /* no suspend pending */
62#define SUSPEND_PENDING 1 /* suspend pending read */
63#define SUSPEND_READ 2 /* suspend read, pending ack */
64#define SUSPEND_ACKED 3 /* suspend acked */
65#define SUSPEND_DONE 4 /* suspend completed */
66
67 struct apm_queue queue;
68};
69
70/*
71 * Local variables
72 */
73static int suspends_pending;
74
75static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
76static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
77
78/*
79 * This is a list of everyone who has opened /dev/apm_bios
80 */
81static DECLARE_RWSEM(user_list_lock);
82static LIST_HEAD(apm_user_list);
83
84/*
85 * kapmd info. kapmd provides us a process context to handle
86 * "APM" events within - specifically necessary if we're going
87 * to be suspending the system.
88 */
89static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait);
90static DECLARE_COMPLETION(kapmd_exit);
91static DEFINE_SPINLOCK(kapmd_queue_lock);
92static struct apm_queue kapmd_queue;
93
94int apm_suspended;
95EXPORT_SYMBOL(apm_suspended);
96
97/* Platform-specific apm_read_proc(). */
98int (*apm_get_info)(char *buf, char **start, off_t fpos, int length);
99EXPORT_SYMBOL(apm_get_info);
100
101/*
102 * APM event queue management.
103 */
104static inline int queue_empty(struct apm_queue *q)
105{
106 return q->event_head == q->event_tail;
107}
108
109static inline apm_event_t queue_get_event(struct apm_queue *q)
110{
111 q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS;
112 return q->events[q->event_tail];
113}
114
115static void queue_add_event(struct apm_queue *q, apm_event_t event)
116{
117 q->event_head = (q->event_head + 1) % APM_MAX_EVENTS;
118 if (q->event_head == q->event_tail) {
119 static int notified;
120
121 if (notified++ == 0)
122 printk(KERN_ERR "apm: an event queue overflowed\n");
123
124 q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS;
125 }
126 q->events[q->event_head] = event;
127}
128
129static void queue_event_one_user(struct apm_user *as, apm_event_t event)
130{
131 if (as->suser && as->writer) {
132 switch (event) {
133 case APM_SYS_SUSPEND:
134 case APM_USER_SUSPEND:
135 /*
136 * If this user already has a suspend pending,
137 * don't queue another one.
138 */
139 if (as->suspend_state != SUSPEND_NONE)
140 return;
141
142 as->suspend_state = SUSPEND_PENDING;
143 suspends_pending++;
144 break;
145 }
146 }
147 queue_add_event(&as->queue, event);
148}
149
150static void queue_event(apm_event_t event, struct apm_user *sender)
151{
152 struct apm_user *as;
153
154 down_read(&user_list_lock);
155
156 list_for_each_entry(as, &apm_user_list, list)
157 if (as != sender && as->reader)
158 queue_event_one_user(as, event);
159
160 up_read(&user_list_lock);
161 wake_up_interruptible(&apm_waitqueue);
162}
163
164/**
165 * apm_queue_event - queue an APM event for kapmd
166 * @event: APM event
167 *
168 * Queue an APM event for kapmd to process and ultimately take the
169 * appropriate action. Only a subset of events are handled:
170 * %APM_LOW_BATTERY
171 * %APM_POWER_STATUS_CHANGE
172 * %APM_USER_SUSPEND
173 * %APM_SYS_SUSPEND
174 * %APM_CRITICAL_SUSPEND
175 */
176void apm_queue_event(apm_event_t event)
177{
178 spin_lock_irq(&kapmd_queue_lock);
179 queue_add_event(&kapmd_queue, event);
180 spin_unlock_irq(&kapmd_queue_lock);
181
182 wake_up_interruptible(&kapmd_wait);
183}
184EXPORT_SYMBOL(apm_queue_event);
185
186static void apm_suspend(void)
187{
188 struct apm_user *as;
189 int err;
190
191 apm_suspended = 1;
192 err = pm_suspend(PM_SUSPEND_MEM);
193
194 /*
195 * Anyone on the APM queues will think we're still suspended.
196 * Send a message so everyone knows we're now awake again.
197 */
198 queue_event(APM_NORMAL_RESUME, NULL);
199
200 /*
201 * Finally, wake up anyone who is sleeping on the suspend.
202 */
203 down_read(&user_list_lock);
204 list_for_each_entry(as, &apm_user_list, list) {
205 as->suspend_result = err;
206 as->suspend_state = SUSPEND_DONE;
207 }
208 up_read(&user_list_lock);
209
210 wake_up(&apm_suspend_waitqueue);
211 apm_suspended = 0;
212}
213
214static ssize_t apm_read(struct file *fp, char __user *buf,
215 size_t count, loff_t *ppos)
216{
217 struct apm_user *as = fp->private_data;
218 apm_event_t event;
219 int i = count, ret = 0;
220
221 if (count < sizeof(apm_event_t))
222 return -EINVAL;
223
224 if (queue_empty(&as->queue) && fp->f_flags & O_NONBLOCK)
225 return -EAGAIN;
226
227 wait_event_interruptible(apm_waitqueue, !queue_empty(&as->queue));
228
229 while ((i >= sizeof(event)) && !queue_empty(&as->queue)) {
230 event = queue_get_event(&as->queue);
231
232 ret = -EFAULT;
233 if (copy_to_user(buf, &event, sizeof(event)))
234 break;
235
236 if (event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND)
237 as->suspend_state = SUSPEND_READ;
238
239 buf += sizeof(event);
240 i -= sizeof(event);
241 }
242
243 if (i < count)
244 ret = count - i;
245
246 return ret;
247}
248
249static unsigned int apm_poll(struct file *fp, poll_table * wait)
250{
251 struct apm_user *as = fp->private_data;
252
253 poll_wait(fp, &apm_waitqueue, wait);
254 return queue_empty(&as->queue) ? 0 : POLLIN | POLLRDNORM;
255}
256
257/*
258 * apm_ioctl - handle APM ioctl
259 *
260 * APM_IOC_SUSPEND
261 * This IOCTL is overloaded, and performs two functions. It is used to:
262 * - initiate a suspend
263 * - acknowledge a suspend read from /dev/apm_bios.
264 * Only when everyone who has opened /dev/apm_bios with write permission
265 * has acknowledge does the actual suspend happen.
266 */
267static int
268apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
269{
270 struct apm_user *as = filp->private_data;
271 unsigned long flags;
272 int err = -EINVAL;
273
274 if (!as->suser || !as->writer)
275 return -EPERM;
276
277 switch (cmd) {
278 case APM_IOC_SUSPEND:
279 as->suspend_result = -EINTR;
280
281 if (as->suspend_state == SUSPEND_READ) {
282 /*
283 * If we read a suspend command from /dev/apm_bios,
284 * then the corresponding APM_IOC_SUSPEND ioctl is
285 * interpreted as an acknowledge.
286 */
287 as->suspend_state = SUSPEND_ACKED;
288 suspends_pending--;
289 } else {
290 /*
291 * Otherwise it is a request to suspend the system.
292 * Queue an event for all readers, and expect an
293 * acknowledge from all writers who haven't already
294 * acknowledged.
295 */
296 queue_event(APM_USER_SUSPEND, as);
297 }
298
299 /*
300 * If there are no further acknowledges required, suspend
301 * the system.
302 */
303 if (suspends_pending == 0)
304 apm_suspend();
305
306 /*
307 * Wait for the suspend/resume to complete. If there are
308 * pending acknowledges, we wait here for them.
309 *
310 * Note that we need to ensure that the PM subsystem does
311 * not kick us out of the wait when it suspends the threads.
312 */
313 flags = current->flags;
314 current->flags |= PF_NOFREEZE;
315
316 /*
317 * Note: do not allow a thread which is acking the suspend
318 * to escape until the resume is complete.
319 */
320 if (as->suspend_state == SUSPEND_ACKED)
321 wait_event(apm_suspend_waitqueue,
322 as->suspend_state == SUSPEND_DONE);
323 else
324 wait_event_interruptible(apm_suspend_waitqueue,
325 as->suspend_state == SUSPEND_DONE);
326
327 current->flags = flags;
328 err = as->suspend_result;
329 as->suspend_state = SUSPEND_NONE;
330 break;
331 }
332
333 return err;
334}
335
336static int apm_release(struct inode * inode, struct file * filp)
337{
338 struct apm_user *as = filp->private_data;
339 filp->private_data = NULL;
340
341 down_write(&user_list_lock);
342 list_del(&as->list);
343 up_write(&user_list_lock);
344
345 /*
346 * We are now unhooked from the chain. As far as new
347 * events are concerned, we no longer exist. However, we
348 * need to balance suspends_pending, which means the
349 * possibility of sleeping.
350 */
351 if (as->suspend_state != SUSPEND_NONE) {
352 suspends_pending -= 1;
353 if (suspends_pending == 0)
354 apm_suspend();
355 }
356
357 kfree(as);
358 return 0;
359}
360
361static int apm_open(struct inode * inode, struct file * filp)
362{
363 struct apm_user *as;
364
365 as = kzalloc(sizeof(*as), GFP_KERNEL);
366 if (as) {
367 /*
368 * XXX - this is a tiny bit broken, when we consider BSD
369 * process accounting. If the device is opened by root, we
370 * instantly flag that we used superuser privs. Who knows,
371 * we might close the device immediately without doing a
372 * privileged operation -- cevans
373 */
374 as->suser = capable(CAP_SYS_ADMIN);
375 as->writer = (filp->f_mode & FMODE_WRITE) == FMODE_WRITE;
376 as->reader = (filp->f_mode & FMODE_READ) == FMODE_READ;
377
378 down_write(&user_list_lock);
379 list_add(&as->list, &apm_user_list);
380 up_write(&user_list_lock);
381
382 filp->private_data = as;
383 }
384
385 return as ? 0 : -ENOMEM;
386}
387
388static struct file_operations apm_bios_fops = {
389 .owner = THIS_MODULE,
390 .read = apm_read,
391 .poll = apm_poll,
392 .ioctl = apm_ioctl,
393 .open = apm_open,
394 .release = apm_release,
395};
396
397static struct miscdevice apm_device = {
398 .minor = APM_MINOR_DEV,
399 .name = "apm_bios",
400 .fops = &apm_bios_fops
401};
402
403
404#ifdef CONFIG_PROC_FS
405/*
406 * Arguments, with symbols from linux/apm_bios.h.
407 *
408 * 0) Linux driver version (this will change if format changes)
409 * 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
410 * 2) APM flags from APM Installation Check (0x00):
411 * bit 0: APM_16_BIT_SUPPORT
412 * bit 1: APM_32_BIT_SUPPORT
413 * bit 2: APM_IDLE_SLOWS_CLOCK
414 * bit 3: APM_BIOS_DISABLED
415 * bit 4: APM_BIOS_DISENGAGED
416 * 3) AC line status
417 * 0x00: Off-line
418 * 0x01: On-line
419 * 0x02: On backup power (BIOS >= 1.1 only)
420 * 0xff: Unknown
421 * 4) Battery status
422 * 0x00: High
423 * 0x01: Low
424 * 0x02: Critical
425 * 0x03: Charging
426 * 0x04: Selected battery not present (BIOS >= 1.2 only)
427 * 0xff: Unknown
428 * 5) Battery flag
429 * bit 0: High
430 * bit 1: Low
431 * bit 2: Critical
432 * bit 3: Charging
433 * bit 7: No system battery
434 * 0xff: Unknown
435 * 6) Remaining battery life (percentage of charge):
436 * 0-100: valid
437 * -1: Unknown
438 * 7) Remaining battery life (time units):
439 * Number of remaining minutes or seconds
440 * -1: Unknown
441 * 8) min = minutes; sec = seconds
442 */
443static int apm_read_proc(char *buf, char **start, off_t fpos, int length)
444{
445 if (likely(apm_get_info))
446 return apm_get_info(buf, start, fpos, length);
447
448 return -EINVAL;
449}
450#endif
451
452static int kapmd(void *arg)
453{
454 daemonize("kapmd");
455 current->flags |= PF_NOFREEZE;
456
457 do {
458 apm_event_t event;
459
460 wait_event_interruptible(kapmd_wait,
461 !queue_empty(&kapmd_queue) || !pm_active);
462
463 if (!pm_active)
464 break;
465
466 spin_lock_irq(&kapmd_queue_lock);
467 event = 0;
468 if (!queue_empty(&kapmd_queue))
469 event = queue_get_event(&kapmd_queue);
470 spin_unlock_irq(&kapmd_queue_lock);
471
472 switch (event) {
473 case 0:
474 break;
475
476 case APM_LOW_BATTERY:
477 case APM_POWER_STATUS_CHANGE:
478 queue_event(event, NULL);
479 break;
480
481 case APM_USER_SUSPEND:
482 case APM_SYS_SUSPEND:
483 queue_event(event, NULL);
484 if (suspends_pending == 0)
485 apm_suspend();
486 break;
487
488 case APM_CRITICAL_SUSPEND:
489 apm_suspend();
490 break;
491 }
492 } while (1);
493
494 complete_and_exit(&kapmd_exit, 0);
495}
496
497static int __init apm_init(void)
498{
499 int ret;
500
501 pm_active = 1;
502
503 ret = kernel_thread(kapmd, NULL, CLONE_KERNEL);
504 if (unlikely(ret < 0)) {
505 pm_active = 0;
506 return ret;
507 }
508
509 create_proc_info_entry("apm", 0, NULL, apm_read_proc);
510
511 ret = misc_register(&apm_device);
512 if (unlikely(ret != 0)) {
513 remove_proc_entry("apm", NULL);
514
515 pm_active = 0;
516 wake_up(&kapmd_wait);
517 wait_for_completion(&kapmd_exit);
518 }
519
520 return ret;
521}
522
523static void __exit apm_exit(void)
524{
525 misc_deregister(&apm_device);
526 remove_proc_entry("apm", NULL);
527
528 pm_active = 0;
529 wake_up(&kapmd_wait);
530 wait_for_completion(&kapmd_exit);
531}
532
533module_init(apm_init);
534module_exit(apm_exit);
535
536MODULE_AUTHOR("Stephen Rothwell, Andriy Skulysh");
537MODULE_DESCRIPTION("Advanced Power Management");
538MODULE_LICENSE("GPL");
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index deb46941f315..7b0f66f03319 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -37,11 +37,12 @@ __setup("vdso=", vdso_setup);
37 * of the ELF DSO images included therein. 37 * of the ELF DSO images included therein.
38 */ 38 */
39extern const char vsyscall_trapa_start, vsyscall_trapa_end; 39extern const char vsyscall_trapa_start, vsyscall_trapa_end;
40static void *syscall_page; 40static struct page *syscall_pages[1];
41 41
42int __init vsyscall_init(void) 42int __init vsyscall_init(void)
43{ 43{
44 syscall_page = (void *)get_zeroed_page(GFP_ATOMIC); 44 void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
45 syscall_pages[0] = virt_to_page(syscall_page);
45 46
46 /* 47 /*
47 * XXX: Map this page to a fixmap entry if we get around 48 * XXX: Map this page to a fixmap entry if we get around
@@ -55,37 +56,10 @@ int __init vsyscall_init(void)
55 return 0; 56 return 0;
56} 57}
57 58
58static struct page *syscall_vma_nopage(struct vm_area_struct *vma,
59 unsigned long address, int *type)
60{
61 unsigned long offset = address - vma->vm_start;
62 struct page *page;
63
64 if (address < vma->vm_start || address > vma->vm_end)
65 return NOPAGE_SIGBUS;
66
67 page = virt_to_page(syscall_page + offset);
68
69 get_page(page);
70
71 return page;
72}
73
74/* Prevent VMA merging */
75static void syscall_vma_close(struct vm_area_struct *vma)
76{
77}
78
79static struct vm_operations_struct syscall_vm_ops = {
80 .nopage = syscall_vma_nopage,
81 .close = syscall_vma_close,
82};
83
84/* Setup a VMA at program startup for the vsyscall page */ 59/* Setup a VMA at program startup for the vsyscall page */
85int arch_setup_additional_pages(struct linux_binprm *bprm, 60int arch_setup_additional_pages(struct linux_binprm *bprm,
86 int executable_stack) 61 int executable_stack)
87{ 62{
88 struct vm_area_struct *vma;
89 struct mm_struct *mm = current->mm; 63 struct mm_struct *mm = current->mm;
90 unsigned long addr; 64 unsigned long addr;
91 int ret; 65 int ret;
@@ -97,30 +71,16 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
97 goto up_fail; 71 goto up_fail;
98 } 72 }
99 73
100 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); 74 ret = install_special_mapping(mm, addr, PAGE_SIZE,
101 if (!vma) { 75 VM_READ | VM_EXEC |
102 ret = -ENOMEM; 76 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |
77 VM_ALWAYSDUMP,
78 syscall_pages);
79 if (unlikely(ret))
103 goto up_fail; 80 goto up_fail;
104 }
105
106 vma->vm_start = addr;
107 vma->vm_end = addr + PAGE_SIZE;
108 /* MAYWRITE to allow gdb to COW and set breakpoints */
109 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
110 vma->vm_flags |= mm->def_flags;
111 vma->vm_page_prot = protection_map[vma->vm_flags & 7];
112 vma->vm_ops = &syscall_vm_ops;
113 vma->vm_mm = mm;
114
115 ret = insert_vm_struct(mm, vma);
116 if (unlikely(ret)) {
117 kmem_cache_free(vm_area_cachep, vma);
118 goto up_fail;
119 }
120 81
121 current->mm->context.vdso = (void *)addr; 82 current->mm->context.vdso = (void *)addr;
122 83
123 mm->total_vm++;
124up_fail: 84up_fail:
125 up_write(&mm->mmap_sem); 85 up_write(&mm->mmap_sem);
126 return ret; 86 return ret;
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
index 59f1fa155915..568ff0df89e7 100644
--- a/arch/x86_64/ia32/syscall32.c
+++ b/arch/x86_64/ia32/syscall32.c
@@ -18,68 +18,34 @@ extern unsigned char syscall32_syscall[], syscall32_syscall_end[];
18extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[]; 18extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[];
19extern int sysctl_vsyscall32; 19extern int sysctl_vsyscall32;
20 20
21char *syscall32_page; 21static struct page *syscall32_pages[1];
22static int use_sysenter = -1; 22static int use_sysenter = -1;
23 23
24static struct page *
25syscall32_nopage(struct vm_area_struct *vma, unsigned long adr, int *type)
26{
27 struct page *p = virt_to_page(adr - vma->vm_start + syscall32_page);
28 get_page(p);
29 return p;
30}
31
32/* Prevent VMA merging */
33static void syscall32_vma_close(struct vm_area_struct *vma)
34{
35}
36
37static struct vm_operations_struct syscall32_vm_ops = {
38 .close = syscall32_vma_close,
39 .nopage = syscall32_nopage,
40};
41
42struct linux_binprm; 24struct linux_binprm;
43 25
44/* Setup a VMA at program startup for the vsyscall page */ 26/* Setup a VMA at program startup for the vsyscall page */
45int syscall32_setup_pages(struct linux_binprm *bprm, int exstack) 27int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
46{ 28{
47 int npages = (VSYSCALL32_END - VSYSCALL32_BASE) >> PAGE_SHIFT;
48 struct vm_area_struct *vma;
49 struct mm_struct *mm = current->mm; 29 struct mm_struct *mm = current->mm;
50 int ret; 30 int ret;
51 31
52 vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 32 down_write(&mm->mmap_sem);
53 if (!vma)
54 return -ENOMEM;
55
56 memset(vma, 0, sizeof(struct vm_area_struct));
57 /* Could randomize here */
58 vma->vm_start = VSYSCALL32_BASE;
59 vma->vm_end = VSYSCALL32_END;
60 /* MAYWRITE to allow gdb to COW and set breakpoints */
61 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
62 /* 33 /*
34 * MAYWRITE to allow gdb to COW and set breakpoints
35 *
63 * Make sure the vDSO gets into every core dump. 36 * Make sure the vDSO gets into every core dump.
64 * Dumping its contents makes post-mortem fully interpretable later 37 * Dumping its contents makes post-mortem fully interpretable later
65 * without matching up the same kernel and hardware config to see 38 * without matching up the same kernel and hardware config to see
66 * what PC values meant. 39 * what PC values meant.
67 */ 40 */
68 vma->vm_flags |= VM_ALWAYSDUMP; 41 /* Could randomize here */
69 vma->vm_flags |= mm->def_flags; 42 ret = install_special_mapping(mm, VSYSCALL32_BASE, PAGE_SIZE,
70 vma->vm_page_prot = protection_map[vma->vm_flags & 7]; 43 VM_READ|VM_EXEC|
71 vma->vm_ops = &syscall32_vm_ops; 44 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
72 vma->vm_mm = mm; 45 VM_ALWAYSDUMP,
73 46 syscall32_pages);
74 down_write(&mm->mmap_sem);
75 if ((ret = insert_vm_struct(mm, vma))) {
76 up_write(&mm->mmap_sem);
77 kmem_cache_free(vm_area_cachep, vma);
78 return ret;
79 }
80 mm->total_vm += npages;
81 up_write(&mm->mmap_sem); 47 up_write(&mm->mmap_sem);
82 return 0; 48 return ret;
83} 49}
84 50
85const char *arch_vma_name(struct vm_area_struct *vma) 51const char *arch_vma_name(struct vm_area_struct *vma)
@@ -92,9 +58,10 @@ const char *arch_vma_name(struct vm_area_struct *vma)
92 58
93static int __init init_syscall32(void) 59static int __init init_syscall32(void)
94{ 60{
95 syscall32_page = (void *)get_zeroed_page(GFP_KERNEL); 61 char *syscall32_page = (void *)get_zeroed_page(GFP_KERNEL);
96 if (!syscall32_page) 62 if (!syscall32_page)
97 panic("Cannot allocate syscall32 page"); 63 panic("Cannot allocate syscall32 page");
64 syscall32_pages[0] = virt_to_page(syscall32_page);
98 if (use_sysenter > 0) { 65 if (use_sysenter > 0) {
99 memcpy(syscall32_page, syscall32_sysenter, 66 memcpy(syscall32_page, syscall32_sysenter,
100 syscall32_sysenter_end - syscall32_sysenter); 67 syscall32_sysenter_end - syscall32_sysenter);
diff --git a/arch/x86_64/kernel/early-quirks.c b/arch/x86_64/kernel/early-quirks.c
index 49802f1bee94..bd30d138113f 100644
--- a/arch/x86_64/kernel/early-quirks.c
+++ b/arch/x86_64/kernel/early-quirks.c
@@ -32,7 +32,7 @@ static void via_bugs(void)
32 32
33static int nvidia_hpet_detected __initdata; 33static int nvidia_hpet_detected __initdata;
34 34
35static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) 35static int __init nvidia_hpet_check(struct acpi_table_header *header)
36{ 36{
37 nvidia_hpet_detected = 1; 37 nvidia_hpet_detected = 1;
38 return 0; 38 return 0;
@@ -53,7 +53,7 @@ static void nvidia_bugs(void)
53 return; 53 return;
54 54
55 nvidia_hpet_detected = 0; 55 nvidia_hpet_detected = 0;
56 acpi_table_parse(ACPI_HPET, nvidia_hpet_check); 56 acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check);
57 if (nvidia_hpet_detected == 0) { 57 if (nvidia_hpet_detected == 0) {
58 acpi_skip_timer_override = 1; 58 acpi_skip_timer_override = 1;
59 printk(KERN_INFO "Nvidia board " 59 printk(KERN_INFO "Nvidia board "
diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c
index b007433f96bb..0b3603adf56d 100644
--- a/arch/x86_64/kernel/genapic.c
+++ b/arch/x86_64/kernel/genapic.c
@@ -58,8 +58,8 @@ void __init clustered_apic_check(void)
58 * Some x86_64 machines use physical APIC mode regardless of how many 58 * Some x86_64 machines use physical APIC mode regardless of how many
59 * procs/clusters are present (x86_64 ES7000 is an example). 59 * procs/clusters are present (x86_64 ES7000 is an example).
60 */ 60 */
61 if (acpi_fadt.revision > FADT2_REVISION_ID) 61 if (acpi_gbl_FADT.header.revision > FADT2_REVISION_ID)
62 if (acpi_fadt.force_apic_physical_destination_mode) { 62 if (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL) {
63 genapic = &apic_cluster; 63 genapic = &apic_cluster;
64 goto print; 64 goto print;
65 } 65 }
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index d7bad90a5ad8..6be6730acb5c 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -1956,24 +1956,31 @@ static struct irq_chip msi_chip = {
1956 .retrigger = ioapic_retrigger_irq, 1956 .retrigger = ioapic_retrigger_irq,
1957}; 1957};
1958 1958
1959int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev) 1959int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
1960{ 1960{
1961 struct msi_msg msg; 1961 struct msi_msg msg;
1962 int ret; 1962 int irq, ret;
1963 irq = create_irq();
1964 if (irq < 0)
1965 return irq;
1966
1967 set_irq_msi(irq, desc);
1963 ret = msi_compose_msg(dev, irq, &msg); 1968 ret = msi_compose_msg(dev, irq, &msg);
1964 if (ret < 0) 1969 if (ret < 0) {
1970 destroy_irq(irq);
1965 return ret; 1971 return ret;
1972 }
1966 1973
1967 write_msi_msg(irq, &msg); 1974 write_msi_msg(irq, &msg);
1968 1975
1969 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); 1976 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge");
1970 1977
1971 return 0; 1978 return irq;
1972} 1979}
1973 1980
1974void arch_teardown_msi_irq(unsigned int irq) 1981void arch_teardown_msi_irq(unsigned int irq)
1975{ 1982{
1976 return; 1983 destroy_irq(irq);
1977} 1984}
1978 1985
1979#endif /* CONFIG_PCI_MSI */ 1986#endif /* CONFIG_PCI_MSI */
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 08072568847d..50dd8bef850e 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -798,7 +798,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
798 return gsi; 798 return gsi;
799 799
800 /* Don't set up the ACPI SCI because it's already set up */ 800 /* Don't set up the ACPI SCI because it's already set up */
801 if (acpi_fadt.sci_int == gsi) 801 if (acpi_gbl_FADT.sci_interrupt == gsi)
802 return gsi; 802 return gsi;
803 803
804 ioapic = mp_find_ioapic(gsi); 804 ioapic = mp_find_ioapic(gsi);
diff --git a/arch/x86_64/kernel/pci-swiotlb.c b/arch/x86_64/kernel/pci-swiotlb.c
index 697f0aa794b9..eb18be5a6569 100644
--- a/arch/x86_64/kernel/pci-swiotlb.c
+++ b/arch/x86_64/kernel/pci-swiotlb.c
@@ -29,7 +29,7 @@ struct dma_mapping_ops swiotlb_dma_ops = {
29 .dma_supported = NULL, 29 .dma_supported = NULL,
30}; 30};
31 31
32void pci_swiotlb_init(void) 32void __init pci_swiotlb_init(void)
33{ 33{
34 /* don't initialize swiotlb if iommu=off (no_iommu=1) */ 34 /* don't initialize swiotlb if iommu=off (no_iommu=1) */
35 if (!iommu_detected && !no_iommu && end_pfn > MAX_DMA32_PFN) 35 if (!iommu_detected && !no_iommu && end_pfn > MAX_DMA32_PFN)
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 5cc76d0d331f..335cc91c49b7 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -498,7 +498,7 @@ static unsigned long get_cmos_time(void)
498{ 498{
499 unsigned int year, mon, day, hour, min, sec; 499 unsigned int year, mon, day, hour, min, sec;
500 unsigned long flags; 500 unsigned long flags;
501 unsigned extyear = 0; 501 unsigned century = 0;
502 502
503 spin_lock_irqsave(&rtc_lock, flags); 503 spin_lock_irqsave(&rtc_lock, flags);
504 504
@@ -510,9 +510,9 @@ static unsigned long get_cmos_time(void)
510 mon = CMOS_READ(RTC_MONTH); 510 mon = CMOS_READ(RTC_MONTH);
511 year = CMOS_READ(RTC_YEAR); 511 year = CMOS_READ(RTC_YEAR);
512#ifdef CONFIG_ACPI 512#ifdef CONFIG_ACPI
513 if (acpi_fadt.revision >= FADT2_REVISION_ID && 513 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
514 acpi_fadt.century) 514 acpi_gbl_FADT.century)
515 extyear = CMOS_READ(acpi_fadt.century); 515 century = CMOS_READ(acpi_gbl_FADT.century);
516#endif 516#endif
517 } while (sec != CMOS_READ(RTC_SECONDS)); 517 } while (sec != CMOS_READ(RTC_SECONDS));
518 518
@@ -530,10 +530,10 @@ static unsigned long get_cmos_time(void)
530 BCD_TO_BIN(mon); 530 BCD_TO_BIN(mon);
531 BCD_TO_BIN(year); 531 BCD_TO_BIN(year);
532 532
533 if (extyear) { 533 if (century) {
534 BCD_TO_BIN(extyear); 534 BCD_TO_BIN(century);
535 year += extyear; 535 year += century * 100;
536 printk(KERN_INFO "Extended CMOS year: %d\n", extyear); 536 printk(KERN_INFO "Extended CMOS year: %d\n", century * 100);
537 } else { 537 } else {
538 /* 538 /*
539 * x86-64 systems only exists since 2002. 539 * x86-64 systems only exists since 2002.
@@ -954,7 +954,7 @@ __cpuinit int unsynchronized_tsc(void)
954 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) { 954 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
955#ifdef CONFIG_ACPI 955#ifdef CONFIG_ACPI
956 /* But TSC doesn't tick in C3 so don't use it there */ 956 /* But TSC doesn't tick in C3 so don't use it there */
957 if (acpi_fadt.length > 0 && acpi_fadt.plvl3_lat < 1000) 957 if (acpi_gbl_FADT.header.length > 0 && acpi_gbl_FADT.C3latency < 1000)
958 return 1; 958 return 1;
959#endif 959#endif
960 return 0; 960 return 0;
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 1087e150a218..2efe215fc76a 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -101,7 +101,7 @@ static __init inline int srat_disabled(void)
101static __init int slit_valid(struct acpi_table_slit *slit) 101static __init int slit_valid(struct acpi_table_slit *slit)
102{ 102{
103 int i, j; 103 int i, j;
104 int d = slit->localities; 104 int d = slit->locality_count;
105 for (i = 0; i < d; i++) { 105 for (i = 0; i < d; i++) {
106 for (j = 0; j < d; j++) { 106 for (j = 0; j < d; j++) {
107 u8 val = slit->entry[d*i + j]; 107 u8 val = slit->entry[d*i + j];
@@ -127,18 +127,18 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
127 127
128/* Callback for Proximity Domain -> LAPIC mapping */ 128/* Callback for Proximity Domain -> LAPIC mapping */
129void __init 129void __init
130acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) 130acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
131{ 131{
132 int pxm, node; 132 int pxm, node;
133 if (srat_disabled()) 133 if (srat_disabled())
134 return; 134 return;
135 if (pa->header.length != sizeof(struct acpi_table_processor_affinity)) { 135 if (pa->header.length != sizeof(struct acpi_srat_cpu_affinity)) {
136 bad_srat(); 136 bad_srat();
137 return; 137 return;
138 } 138 }
139 if (pa->flags.enabled == 0) 139 if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
140 return; 140 return;
141 pxm = pa->proximity_domain; 141 pxm = pa->proximity_domain_lo;
142 node = setup_node(pxm); 142 node = setup_node(pxm);
143 if (node < 0) { 143 if (node < 0) {
144 printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm); 144 printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
@@ -254,21 +254,21 @@ static int reserve_hotadd(int node, unsigned long start, unsigned long end)
254 /* Looks good */ 254 /* Looks good */
255 255
256 if (nd->start == nd->end) { 256 if (nd->start == nd->end) {
257 nd->start = start; 257 nd->start = start;
258 nd->end = end; 258 nd->end = end;
259 changed = 1; 259 changed = 1;
260 } else { 260 } else {
261 if (nd->start == end) { 261 if (nd->start == end) {
262 nd->start = start; 262 nd->start = start;
263 changed = 1; 263 changed = 1;
264 } 264 }
265 if (nd->end == start) { 265 if (nd->end == start) {
266 nd->end = end; 266 nd->end = end;
267 changed = 1; 267 changed = 1;
268 } 268 }
269 if (!changed) 269 if (!changed)
270 printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n"); 270 printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n");
271 } 271 }
272 272
273 ret = update_end_of_memory(nd->end); 273 ret = update_end_of_memory(nd->end);
274 274
@@ -279,7 +279,7 @@ static int reserve_hotadd(int node, unsigned long start, unsigned long end)
279 279
280/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ 280/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
281void __init 281void __init
282acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) 282acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
283{ 283{
284 struct bootnode *nd, oldnode; 284 struct bootnode *nd, oldnode;
285 unsigned long start, end; 285 unsigned long start, end;
@@ -288,16 +288,17 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
288 288
289 if (srat_disabled()) 289 if (srat_disabled())
290 return; 290 return;
291 if (ma->header.length != sizeof(struct acpi_table_memory_affinity)) { 291 if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) {
292 bad_srat(); 292 bad_srat();
293 return; 293 return;
294 } 294 }
295 if (ma->flags.enabled == 0) 295 if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
296 return; 296 return;
297 if (ma->flags.hot_pluggable && !save_add_info()) 297
298 if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && !save_add_info())
298 return; 299 return;
299 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32); 300 start = ma->base_address;
300 end = start + (ma->length_lo | ((u64)ma->length_hi << 32)); 301 end = start + ma->length;
301 pxm = ma->proximity_domain; 302 pxm = ma->proximity_domain;
302 node = setup_node(pxm); 303 node = setup_node(pxm);
303 if (node < 0) { 304 if (node < 0) {
@@ -337,7 +338,8 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
337 push_node_boundaries(node, nd->start >> PAGE_SHIFT, 338 push_node_boundaries(node, nd->start >> PAGE_SHIFT,
338 nd->end >> PAGE_SHIFT); 339 nd->end >> PAGE_SHIFT);
339 340
340 if (ma->flags.hot_pluggable && (reserve_hotadd(node, start, end) < 0)) { 341 if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) &&
342 (reserve_hotadd(node, start, end) < 0)) {
341 /* Ignore hotadd region. Undo damage */ 343 /* Ignore hotadd region. Undo damage */
342 printk(KERN_NOTICE "SRAT: Hotplug region ignored\n"); 344 printk(KERN_NOTICE "SRAT: Hotplug region ignored\n");
343 *nd = oldnode; 345 *nd = oldnode;
@@ -394,7 +396,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
394 396
395 /* First clean up the node list */ 397 /* First clean up the node list */
396 for (i = 0; i < MAX_NUMNODES; i++) { 398 for (i = 0; i < MAX_NUMNODES; i++) {
397 cutoff_node(i, start, end); 399 cutoff_node(i, start, end);
398 if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) { 400 if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) {
399 unparse_node(i); 401 unparse_node(i);
400 node_set_offline(i); 402 node_set_offline(i);
@@ -426,7 +428,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
426 if (!node_online(i)) 428 if (!node_online(i))
427 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 429 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
428 430
429 for (i = 0; i < NR_CPUS; i++) { 431 for (i = 0; i < NR_CPUS; i++) {
430 if (cpu_to_node[i] == NUMA_NO_NODE) 432 if (cpu_to_node[i] == NUMA_NO_NODE)
431 continue; 433 continue;
432 if (!node_isset(cpu_to_node[i], nodes_parsed)) 434 if (!node_isset(cpu_to_node[i], nodes_parsed))
@@ -461,7 +463,7 @@ int __node_distance(int a, int b)
461 463
462 if (!acpi_slit) 464 if (!acpi_slit)
463 return a == b ? 10 : 20; 465 return a == b ? 10 : 20;
464 index = acpi_slit->localities * node_to_pxm(a); 466 index = acpi_slit->locality_count * node_to_pxm(a);
465 return acpi_slit->entry[index + node_to_pxm(b)]; 467 return acpi_slit->entry[index + node_to_pxm(b)];
466} 468}
467 469
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index f8b6b2800a62..faabb6e87f12 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * mmconfig.c - Low-level direct PCI config space access via MMCONFIG 2 * mmconfig.c - Low-level direct PCI config space access via MMCONFIG
3 * 3 *
4 * This is an 64bit optimized version that always keeps the full mmconfig 4 * This is an 64bit optimized version that always keeps the full mmconfig
5 * space mapped. This allows lockless config space operation. 5 * space mapped. This allows lockless config space operation.
6 */ 6 */
@@ -25,7 +25,7 @@ static DECLARE_BITMAP(fallback_slots, 32*MAX_CHECK_BUS);
25 25
26/* Static virtual mapping of the MMCONFIG aperture */ 26/* Static virtual mapping of the MMCONFIG aperture */
27struct mmcfg_virt { 27struct mmcfg_virt {
28 struct acpi_table_mcfg_config *cfg; 28 struct acpi_mcfg_allocation *cfg;
29 char __iomem *virt; 29 char __iomem *virt;
30}; 30};
31static struct mmcfg_virt *pci_mmcfg_virt; 31static struct mmcfg_virt *pci_mmcfg_virt;
@@ -33,14 +33,14 @@ static struct mmcfg_virt *pci_mmcfg_virt;
33static char __iomem *get_virt(unsigned int seg, unsigned bus) 33static char __iomem *get_virt(unsigned int seg, unsigned bus)
34{ 34{
35 int cfg_num = -1; 35 int cfg_num = -1;
36 struct acpi_table_mcfg_config *cfg; 36 struct acpi_mcfg_allocation *cfg;
37 37
38 while (1) { 38 while (1) {
39 ++cfg_num; 39 ++cfg_num;
40 if (cfg_num >= pci_mmcfg_config_num) 40 if (cfg_num >= pci_mmcfg_config_num)
41 break; 41 break;
42 cfg = pci_mmcfg_virt[cfg_num].cfg; 42 cfg = pci_mmcfg_virt[cfg_num].cfg;
43 if (cfg->pci_segment_group_number != seg) 43 if (cfg->pci_segment != seg)
44 continue; 44 continue;
45 if ((cfg->start_bus_number <= bus) && 45 if ((cfg->start_bus_number <= bus) &&
46 (cfg->end_bus_number >= bus)) 46 (cfg->end_bus_number >= bus))
@@ -52,7 +52,7 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus)
52 this applies to all busses. */ 52 this applies to all busses. */
53 cfg = &pci_mmcfg_config[0]; 53 cfg = &pci_mmcfg_config[0];
54 if (pci_mmcfg_config_num == 1 && 54 if (pci_mmcfg_config_num == 1 &&
55 cfg->pci_segment_group_number == 0 && 55 cfg->pci_segment == 0 &&
56 (cfg->start_bus_number | cfg->end_bus_number) == 0) 56 (cfg->start_bus_number | cfg->end_bus_number) == 0)
57 return pci_mmcfg_virt[0].virt; 57 return pci_mmcfg_virt[0].virt;
58 58
@@ -170,19 +170,19 @@ void __init pci_mmcfg_init(int type)
170 if ((pci_probe & PCI_PROBE_MMCONF) == 0) 170 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
171 return; 171 return;
172 172
173 acpi_table_parse(ACPI_MCFG, acpi_parse_mcfg); 173 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
174 if ((pci_mmcfg_config_num == 0) || 174 if ((pci_mmcfg_config_num == 0) ||
175 (pci_mmcfg_config == NULL) || 175 (pci_mmcfg_config == NULL) ||
176 (pci_mmcfg_config[0].base_address == 0)) 176 (pci_mmcfg_config[0].address == 0))
177 return; 177 return;
178 178
179 /* Only do this check when type 1 works. If it doesn't work 179 /* Only do this check when type 1 works. If it doesn't work
180 assume we run on a Mac and always use MCFG */ 180 assume we run on a Mac and always use MCFG */
181 if (type == 1 && !e820_all_mapped(pci_mmcfg_config[0].base_address, 181 if (type == 1 && !e820_all_mapped(pci_mmcfg_config[0].address,
182 pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN, 182 pci_mmcfg_config[0].address + MMCONFIG_APER_MIN,
183 E820_RESERVED)) { 183 E820_RESERVED)) {
184 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n", 184 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %lx is not E820-reserved\n",
185 pci_mmcfg_config[0].base_address); 185 (unsigned long)pci_mmcfg_config[0].address);
186 printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); 186 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
187 return; 187 return;
188 } 188 }
@@ -194,15 +194,16 @@ void __init pci_mmcfg_init(int type)
194 } 194 }
195 for (i = 0; i < pci_mmcfg_config_num; ++i) { 195 for (i = 0; i < pci_mmcfg_config_num; ++i) {
196 pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i]; 196 pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i];
197 pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address, 197 pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].address,
198 MMCONFIG_APER_MAX); 198 MMCONFIG_APER_MAX);
199 if (!pci_mmcfg_virt[i].virt) { 199 if (!pci_mmcfg_virt[i].virt) {
200 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " 200 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for "
201 "segment %d\n", 201 "segment %d\n",
202 pci_mmcfg_config[i].pci_segment_group_number); 202 pci_mmcfg_config[i].pci_segment);
203 return; 203 return;
204 } 204 }
205 printk(KERN_INFO "PCI: Using MMCONFIG at %x\n", pci_mmcfg_config[i].base_address); 205 printk(KERN_INFO "PCI: Using MMCONFIG at %lx\n",
206 (unsigned long)pci_mmcfg_config[i].address);
206 } 207 }
207 208
208 unreachable_devices(); 209 unreachable_devices();