aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/alpha_ksyms.c12
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/alpha/kernel/signal.c2
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/dmabounce.c67
-rw-r--r--arch/arm/common/uengine.c58
-rw-r--r--arch/arm/configs/lpd270_defconfig963
-rw-r--r--arch/arm/kernel/entry-armv.S24
-rw-r--r--arch/arm/kernel/irq.c4
-rw-r--r--arch/arm/kernel/iwmmxt.S2
-rw-r--r--arch/arm/kernel/process.c24
-rw-r--r--arch/arm/kernel/signal.c21
-rw-r--r--arch/arm/mach-ep93xx/core.c5
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c24
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c23
-rw-r--r--arch/arm/mach-imx/dma.c65
-rw-r--r--arch/arm/mach-ixp2000/core.c3
-rw-r--r--arch/arm/mach-ixp23xx/core.c5
-rw-r--r--arch/arm/mach-ixp23xx/espresso.c22
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c22
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c22
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c41
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c48
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c11
-rw-r--r--arch/arm/mach-pnx4008/clock.c129
-rw-r--r--arch/arm/mach-pnx4008/serial.c2
-rw-r--r--arch/arm/mach-s3c2410/Kconfig8
-rw-r--r--arch/arm/mach-s3c2410/Makefile4
-rw-r--r--arch/arm/mach-s3c2410/clock.c228
-rw-r--r--arch/arm/mach-s3c2410/clock.h11
-rw-r--r--arch/arm/mach-s3c2410/cpu.h1
-rw-r--r--arch/arm/mach-s3c2410/s3c2410-clock.c263
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c25
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.h2
-rw-r--r--arch/arm/mach-s3c2410/s3c2440-clock.c4
-rw-r--r--arch/arm/mach-s3c2410/s3c2442-clock.c2
-rw-r--r--arch/arm/mach-s3c2410/s3c244x.c2
-rw-r--r--arch/arm/nwfpe/fpmodule.c25
-rw-r--r--arch/arm/plat-omap/timer32k.c3
-rw-r--r--arch/arm/vfp/Makefile5
-rw-r--r--arch/arm/vfp/vfphw.S4
-rw-r--r--arch/arm/vfp/vfpmodule.c71
-rw-r--r--arch/frv/kernel/entry.S2
-rw-r--r--arch/frv/kernel/frv_ksyms.c18
-rw-r--r--arch/frv/kernel/irq-routing.c8
-rw-r--r--arch/frv/kernel/irq.c6
-rw-r--r--arch/frv/kernel/pm.c40
-rw-r--r--arch/frv/kernel/process.c2
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/frv/kernel/signal.c22
-rw-r--r--arch/frv/kernel/sys_frv.c2
-rw-r--r--arch/frv/kernel/sysctl.c4
-rw-r--r--arch/frv/kernel/uaccess.c6
-rw-r--r--arch/frv/mb93090-mb00/pci-irq.c10
-rw-r--r--arch/frv/mm/kmap.c6
-rw-r--r--arch/h8300/kernel/signal.c2
-rw-r--r--arch/i386/Kconfig7
-rw-r--r--arch/i386/kernel/acpi/boot.c10
-rw-r--r--arch/i386/kernel/acpi/processor.c2
-rw-r--r--arch/i386/kernel/acpi/sleep.c19
-rw-r--r--arch/i386/kernel/acpi/wakeup.S11
-rw-r--r--arch/i386/kernel/apic.c4
-rw-r--r--arch/i386/kernel/apm.c39
-rw-r--r--arch/i386/kernel/cpu/common.c2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c291
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c30
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h4
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c266
-rw-r--r--arch/i386/kernel/cpu/cyrix.c9
-rw-r--r--arch/i386/kernel/cpu/proc.c2
-rw-r--r--arch/i386/kernel/i387.c2
-rw-r--r--arch/i386/kernel/i8259.c4
-rw-r--r--arch/i386/kernel/io_apic.c31
-rw-r--r--arch/i386/kernel/irq.c4
-rw-r--r--arch/i386/kernel/kprobes.c2
-rw-r--r--arch/i386/kernel/microcode.c73
-rw-r--r--arch/i386/kernel/setup.c106
-rw-r--r--arch/i386/kernel/srat.c19
-rw-r--r--arch/i386/kernel/syscall_table.S1
-rw-r--r--arch/i386/kernel/traps.c11
-rw-r--r--arch/i386/lib/usercopy.c137
-rw-r--r--arch/i386/mm/fault.c21
-rw-r--r--arch/i386/mm/init.c3
-rw-r--r--arch/i386/mm/pageattr.c8
-rw-r--r--arch/i386/pci/common.c1
-rw-r--r--arch/i386/pci/i386.c9
-rw-r--r--arch/i386/pci/irq.c15
-rw-r--r--arch/i386/pci/mmconfig.c9
-rw-r--r--arch/i386/pci/pci.h1
-rw-r--r--arch/i386/power/cpu.c2
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/hp/common/sba_iommu.c4
-rw-r--r--arch/ia64/kernel/acpi.c28
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/irq_ia64.c19
-rw-r--r--arch/ia64/kernel/perfmon.c10
-rw-r--r--arch/ia64/kernel/uncached.c200
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/pci/pci.c2
-rw-r--r--arch/ia64/sn/kernel/io_init.c9
-rw-r--r--arch/ia64/sn/kernel/irq.c142
-rw-r--r--arch/ia64/sn/kernel/setup.c4
-rw-r--r--arch/ia64/sn/kernel/sn2/cache.c15
-rw-r--r--arch/ia64/sn/pci/pci_dma.c10
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c62
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c8
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c65
-rw-r--r--arch/m68k/kernel/entry.S4
-rw-r--r--arch/m68k/kernel/ints.c6
-rw-r--r--arch/m68k/kernel/signal.c2
-rw-r--r--arch/m68k/kernel/traps.c8
-rw-r--r--arch/m68k/lib/Makefile4
-rw-r--r--arch/m68k/lib/uaccess.c222
-rw-r--r--arch/m68k/mac/config.c13
-rw-r--r--arch/m68k/mac/macints.c1
-rw-r--r--arch/m68k/mac/via.c17
-rw-r--r--arch/m68k/mm/motorola.c12
-rw-r--r--arch/m68k/mm/sun3mmu.c5
-rw-r--r--arch/m68knommu/kernel/signal.c2
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/sysirix.c12
-rw-r--r--arch/parisc/hpux/sys_hpux.c10
-rw-r--r--arch/parisc/kernel/signal.c2
-rw-r--r--arch/powerpc/Kconfig53
-rw-r--r--arch/powerpc/Kconfig.debug13
-rw-r--r--arch/powerpc/Makefile1
-rw-r--r--arch/powerpc/boot/Makefile4
-rw-r--r--arch/powerpc/boot/main.c27
-rw-r--r--arch/powerpc/boot/prom.h7
-rw-r--r--arch/powerpc/configs/cell_defconfig34
-rw-r--r--arch/powerpc/configs/mpc85xx_cds_defconfig846
-rw-r--r--arch/powerpc/configs/mpc8641_hpcn_defconfig921
-rw-r--r--arch/powerpc/configs/pmac32_defconfig204
-rw-r--r--arch/powerpc/configs/pseries_defconfig75
-rw-r--r--arch/powerpc/kernel/align.c189
-rw-r--r--arch/powerpc/kernel/asm-offsets.c5
-rw-r--r--arch/powerpc/kernel/cpu_setup_6xx.S2
-rw-r--r--arch/powerpc/kernel/cpu_setup_power4.S17
-rw-r--r--arch/powerpc/kernel/cputable.c137
-rw-r--r--arch/powerpc/kernel/crash.c13
-rw-r--r--arch/powerpc/kernel/crash_dump.c11
-rw-r--r--arch/powerpc/kernel/entry_64.S2
-rw-r--r--arch/powerpc/kernel/fpu.S6
-rw-r--r--arch/powerpc/kernel/head_32.S14
-rw-r--r--arch/powerpc/kernel/head_64.S29
-rw-r--r--arch/powerpc/kernel/iomap.c2
-rw-r--r--arch/powerpc/kernel/iommu.c23
-rw-r--r--arch/powerpc/kernel/irq.c29
-rw-r--r--arch/powerpc/kernel/lparcfg.c4
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c99
-rw-r--r--arch/powerpc/kernel/misc_32.S2
-rw-r--r--arch/powerpc/kernel/misc_64.S5
-rw-r--r--arch/powerpc/kernel/nvram_64.c2
-rw-r--r--arch/powerpc/kernel/pci_32.c7
-rw-r--r--arch/powerpc/kernel/pci_64.c62
-rw-r--r--arch/powerpc/kernel/pci_direct_iommu.c18
-rw-r--r--arch/powerpc/kernel/pci_dn.c6
-rw-r--r--arch/powerpc/kernel/pci_iommu.c41
-rw-r--r--arch/powerpc/kernel/proc_ppc64.c2
-rw-r--r--arch/powerpc/kernel/process.c55
-rw-r--r--arch/powerpc/kernel/prom.c145
-rw-r--r--arch/powerpc/kernel/prom_init.c120
-rw-r--r--arch/powerpc/kernel/prom_parse.c25
-rw-r--r--arch/powerpc/kernel/ptrace.c2
-rw-r--r--arch/powerpc/kernel/rtas-rtc.c30
-rw-r--r--arch/powerpc/kernel/rtas.c108
-rw-r--r--arch/powerpc/kernel/rtas_flash.c25
-rw-r--r--arch/powerpc/kernel/rtas_pci.c4
-rw-r--r--arch/powerpc/kernel/setup-common.c20
-rw-r--r--arch/powerpc/kernel/setup.h3
-rw-r--r--arch/powerpc/kernel/setup_32.c18
-rw-r--r--arch/powerpc/kernel/setup_64.c31
-rw-r--r--arch/powerpc/kernel/signal_32.c23
-rw-r--r--arch/powerpc/kernel/signal_64.c16
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kernel/systbl.S311
-rw-r--r--arch/powerpc/kernel/time.c67
-rw-r--r--arch/powerpc/kernel/traps.c8
-rw-r--r--arch/powerpc/kernel/udbg.c7
-rw-r--r--arch/powerpc/kernel/vdso.c57
-rw-r--r--arch/powerpc/kernel/vector.S4
-rw-r--r--arch/powerpc/kernel/vio.c344
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S5
-rw-r--r--arch/powerpc/lib/Makefile5
-rw-r--r--arch/powerpc/lib/bitops.c150
-rw-r--r--arch/powerpc/mm/hash_low_32.S34
-rw-r--r--arch/powerpc/mm/hash_low_64.S31
-rw-r--r--arch/powerpc/mm/hash_native_64.c2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c84
-rw-r--r--arch/powerpc/mm/lmb.c43
-rw-r--r--arch/powerpc/mm/mem.c6
-rw-r--r--arch/powerpc/mm/mmu_context_32.c2
-rw-r--r--arch/powerpc/mm/mmu_context_64.c3
-rw-r--r--arch/powerpc/mm/numa.c8
-rw-r--r--arch/powerpc/mm/ppc_mmu_32.c16
-rw-r--r--arch/powerpc/mm/slb.c32
-rw-r--r--arch/powerpc/mm/slb_low.S17
-rw-r--r--arch/powerpc/mm/stab.c4
-rw-r--r--arch/powerpc/mm/tlb_32.c6
-rw-r--r--arch/powerpc/mm/tlb_64.c5
-rw-r--r--arch/powerpc/oprofile/Kconfig1
-rw-r--r--arch/powerpc/oprofile/Makefile4
-rw-r--r--arch/powerpc/oprofile/common.c6
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c37
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig9
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c359
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.h43
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig36
-rw-r--r--arch/powerpc/platforms/86xx/Makefile10
-rw-r--r--arch/powerpc/platforms/86xx/mpc8641_hpcn.h54
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx.h28
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c326
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_pcie.c173
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_smp.c117
-rw-r--r--arch/powerpc/platforms/86xx/pci.c325
-rw-r--r--arch/powerpc/platforms/Makefile1
-rw-r--r--arch/powerpc/platforms/cell/Kconfig9
-rw-r--r--arch/powerpc/platforms/cell/Makefile23
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.c128
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.h129
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c40
-rw-r--r--arch/powerpc/platforms/cell/iommu.c18
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c104
-rw-r--r--arch/powerpc/platforms/cell/pervasive.h37
-rw-r--r--arch/powerpc/platforms/cell/ras.c112
-rw-r--r--arch/powerpc/platforms/cell/ras.h9
-rw-r--r--arch/powerpc/platforms/cell/setup.c14
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c179
-rw-r--r--arch/powerpc/platforms/cell/spu_callbacks.c314
-rw-r--r--arch/powerpc/platforms/cell/spu_priv1.c133
-rw-r--r--arch/powerpc/platforms/cell/spu_priv1_mmio.c159
-rw-r--r--arch/powerpc/platforms/cell/spufs/Makefile14
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c12
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c67
-rw-r--r--arch/powerpc/platforms/cell/spufs/hw_ops.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c36
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c3
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped1122
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped922
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c48
-rw-r--r--arch/powerpc/platforms/iseries/Makefile6
-rw-r--r--arch/powerpc/platforms/iseries/call_pci.h19
-rw-r--r--arch/powerpc/platforms/iseries/dt.c615
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c46
-rw-r--r--arch/powerpc/platforms/iseries/iommu.h35
-rw-r--r--arch/powerpc/platforms/iseries/irq.c7
-rw-r--r--arch/powerpc/platforms/iseries/irq.h2
-rw-r--r--arch/powerpc/platforms/iseries/mf.c9
-rw-r--r--arch/powerpc/platforms/iseries/pci.c347
-rw-r--r--arch/powerpc/platforms/iseries/setup.c271
-rw-r--r--arch/powerpc/platforms/iseries/setup.h2
-rw-r--r--arch/powerpc/platforms/iseries/vio.c131
-rw-r--r--arch/powerpc/platforms/maple/pci.c3
-rw-r--r--arch/powerpc/platforms/maple/setup.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c2
-rw-r--r--arch/powerpc/platforms/powermac/feature.c2
-rw-r--r--arch/powerpc/platforms/powermac/pci.c3
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_core.c14
-rw-r--r--arch/powerpc/platforms/powermac/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/Makefile5
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c55
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c50
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c182
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c6
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c6
-rw-r--r--arch/powerpc/platforms/pseries/setup.c6
-rw-r--r--arch/powerpc/platforms/pseries/vio.c274
-rw-r--r--arch/powerpc/platforms/pseries/xics.c25
-rw-r--r--arch/powerpc/sysdev/Makefile4
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c2
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c66
-rw-r--r--arch/powerpc/sysdev/mpic.c20
-rw-r--r--arch/ppc/Kconfig4
-rw-r--r--arch/ppc/boot/lib/Makefile2
-rw-r--r--arch/ppc/mm/init.c2
-rw-r--r--arch/ppc/mm/mmu_context.c2
-rw-r--r--arch/ppc/mm/tlb.c6
-rw-r--r--arch/ppc/platforms/4xx/Kconfig2
-rw-r--r--arch/ppc/platforms/4xx/cpci405.c139
-rw-r--r--arch/ppc/platforms/4xx/cpci405.h30
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c9
-rw-r--r--arch/ppc/syslib/mpc83xx_devices.c6
-rw-r--r--arch/s390/Kconfig8
-rw-r--r--arch/s390/Makefile2
-rw-r--r--arch/s390/hypfs/Makefile7
-rw-r--r--arch/s390/hypfs/hypfs.h30
-rw-r--r--arch/s390/hypfs/hypfs_diag.c696
-rw-r--r--arch/s390/hypfs/hypfs_diag.h16
-rw-r--r--arch/s390/hypfs/inode.c491
-rw-r--r--arch/sh64/kernel/signal.c2
-rw-r--r--arch/sparc/kernel/setup.c2
-rw-r--r--arch/sparc64/solaris/fs.c4
-rw-r--r--arch/um/Kconfig.debug1
-rw-r--r--arch/um/kernel/time_kern.c2
-rw-r--r--arch/um/sys-ppc/misc.S6
-rw-r--r--arch/v850/kernel/signal.c2
-rw-r--r--arch/x86_64/Kconfig6
-rw-r--r--arch/x86_64/ia32/ia32entry.S1
-rw-r--r--arch/x86_64/kernel/acpi/Makefile1
-rw-r--r--arch/x86_64/kernel/acpi/processor.c72
-rw-r--r--arch/x86_64/kernel/acpi/sleep.c7
-rw-r--r--arch/x86_64/kernel/apic.c2
-rw-r--r--arch/x86_64/kernel/i387.c2
-rw-r--r--arch/x86_64/kernel/setup.c95
-rw-r--r--arch/x86_64/mm/srat.c33
-rw-r--r--arch/x86_64/pci/mmconfig.c13
-rw-r--r--arch/xtensa/Kconfig4
-rw-r--r--arch/xtensa/boot/lib/Makefile2
-rw-r--r--arch/xtensa/kernel/entry.S2
-rw-r--r--arch/xtensa/kernel/signal.c12
313 files changed, 13214 insertions, 5136 deletions
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
index 2b245ad731ee..d3848c5b0d2b 100644
--- a/arch/alpha/kernel/alpha_ksyms.c
+++ b/arch/alpha/kernel/alpha_ksyms.c
@@ -53,10 +53,6 @@ extern void __divqu (void);
53extern void __remqu (void); 53extern void __remqu (void);
54 54
55EXPORT_SYMBOL(alpha_mv); 55EXPORT_SYMBOL(alpha_mv);
56EXPORT_SYMBOL(enable_irq);
57EXPORT_SYMBOL(disable_irq);
58EXPORT_SYMBOL(disable_irq_nosync);
59EXPORT_SYMBOL(probe_irq_mask);
60EXPORT_SYMBOL(screen_info); 56EXPORT_SYMBOL(screen_info);
61EXPORT_SYMBOL(perf_irq); 57EXPORT_SYMBOL(perf_irq);
62EXPORT_SYMBOL(callback_getenv); 58EXPORT_SYMBOL(callback_getenv);
@@ -68,19 +64,13 @@ EXPORT_SYMBOL(alpha_using_srm);
68 64
69/* platform dependent support */ 65/* platform dependent support */
70EXPORT_SYMBOL(strcat); 66EXPORT_SYMBOL(strcat);
71EXPORT_SYMBOL(strcmp);
72EXPORT_SYMBOL(strcpy); 67EXPORT_SYMBOL(strcpy);
73EXPORT_SYMBOL(strlen); 68EXPORT_SYMBOL(strlen);
74EXPORT_SYMBOL(strncmp);
75EXPORT_SYMBOL(strncpy); 69EXPORT_SYMBOL(strncpy);
76EXPORT_SYMBOL(strnlen);
77EXPORT_SYMBOL(strncat); 70EXPORT_SYMBOL(strncat);
78EXPORT_SYMBOL(strstr);
79EXPORT_SYMBOL(strchr); 71EXPORT_SYMBOL(strchr);
80EXPORT_SYMBOL(strrchr); 72EXPORT_SYMBOL(strrchr);
81EXPORT_SYMBOL(memcmp);
82EXPORT_SYMBOL(memmove); 73EXPORT_SYMBOL(memmove);
83EXPORT_SYMBOL(memscan);
84EXPORT_SYMBOL(__memcpy); 74EXPORT_SYMBOL(__memcpy);
85EXPORT_SYMBOL(__memset); 75EXPORT_SYMBOL(__memset);
86EXPORT_SYMBOL(__memsetw); 76EXPORT_SYMBOL(__memsetw);
@@ -122,11 +112,9 @@ EXPORT_SYMBOL(alpha_write_fp_reg_s);
122 112
123/* In-kernel system calls. */ 113/* In-kernel system calls. */
124EXPORT_SYMBOL(kernel_thread); 114EXPORT_SYMBOL(kernel_thread);
125EXPORT_SYMBOL(sys_open);
126EXPORT_SYMBOL(sys_dup); 115EXPORT_SYMBOL(sys_dup);
127EXPORT_SYMBOL(sys_exit); 116EXPORT_SYMBOL(sys_exit);
128EXPORT_SYMBOL(sys_write); 117EXPORT_SYMBOL(sys_write);
129EXPORT_SYMBOL(sys_read);
130EXPORT_SYMBOL(sys_lseek); 118EXPORT_SYMBOL(sys_lseek);
131EXPORT_SYMBOL(execve); 119EXPORT_SYMBOL(execve);
132EXPORT_SYMBOL(sys_setsid); 120EXPORT_SYMBOL(sys_setsid);
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 31afe3d91ac6..e15dcf4f3dcd 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -244,7 +244,7 @@ do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
244 unsigned long bufsiz) 244 unsigned long bufsiz)
245{ 245{
246 struct kstatfs linux_stat; 246 struct kstatfs linux_stat;
247 int error = vfs_statfs(dentry->d_inode->i_sb, &linux_stat); 247 int error = vfs_statfs(dentry, &linux_stat);
248 if (!error) 248 if (!error)
249 error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); 249 error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz);
250 return error; 250 return error;
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
index 2e45e8604e32..741da0945dc4 100644
--- a/arch/alpha/kernel/signal.c
+++ b/arch/alpha/kernel/signal.c
@@ -375,7 +375,7 @@ give_sigsegv:
375static inline void __user * 375static inline void __user *
376get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) 376get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
377{ 377{
378 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) 378 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
379 sp = current->sas_ss_sp + current->sas_ss_size; 379 sp = current->sas_ss_sp + current->sas_ss_size;
380 380
381 return (void __user *)((sp - frame_size) & -32ul); 381 return (void __user *)((sp - frame_size) & -32ul);
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 847e3e6356c6..e1289a256ce5 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
16obj-$(CONFIG_SHARPSL_PM) += sharpsl_pm.o 16obj-$(CONFIG_SHARPSL_PM) += sharpsl_pm.o
17obj-$(CONFIG_SHARP_SCOOP) += scoop.o 17obj-$(CONFIG_SHARP_SCOOP) += scoop.o
18obj-$(CONFIG_ARCH_IXP2000) += uengine.o 18obj-$(CONFIG_ARCH_IXP2000) += uengine.o
19obj-$(CONFIG_ARCH_IXP23XX) += uengine.o
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index 7971d0dc6892..5b7c26395b44 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -77,6 +77,8 @@ struct dmabounce_device_info {
77#endif 77#endif
78 struct dmabounce_pool small; 78 struct dmabounce_pool small;
79 struct dmabounce_pool large; 79 struct dmabounce_pool large;
80
81 rwlock_t lock;
80}; 82};
81 83
82static LIST_HEAD(dmabounce_devs); 84static LIST_HEAD(dmabounce_devs);
@@ -116,6 +118,7 @@ alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr,
116 struct safe_buffer *buf; 118 struct safe_buffer *buf;
117 struct dmabounce_pool *pool; 119 struct dmabounce_pool *pool;
118 struct device *dev = device_info->dev; 120 struct device *dev = device_info->dev;
121 unsigned long flags;
119 122
120 dev_dbg(dev, "%s(ptr=%p, size=%d, dir=%d)\n", 123 dev_dbg(dev, "%s(ptr=%p, size=%d, dir=%d)\n",
121 __func__, ptr, size, dir); 124 __func__, ptr, size, dir);
@@ -163,8 +166,12 @@ alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr,
163 print_alloc_stats(device_info); 166 print_alloc_stats(device_info);
164#endif 167#endif
165 168
169 write_lock_irqsave(&device_info->lock, flags);
170
166 list_add(&buf->node, &device_info->safe_buffers); 171 list_add(&buf->node, &device_info->safe_buffers);
167 172
173 write_unlock_irqrestore(&device_info->lock, flags);
174
168 return buf; 175 return buf;
169} 176}
170 177
@@ -172,22 +179,32 @@ alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr,
172static inline struct safe_buffer * 179static inline struct safe_buffer *
173find_safe_buffer(struct dmabounce_device_info *device_info, dma_addr_t safe_dma_addr) 180find_safe_buffer(struct dmabounce_device_info *device_info, dma_addr_t safe_dma_addr)
174{ 181{
175 struct safe_buffer *b; 182 struct safe_buffer *b = NULL;
183 unsigned long flags;
184
185 read_lock_irqsave(&device_info->lock, flags);
176 186
177 list_for_each_entry(b, &device_info->safe_buffers, node) 187 list_for_each_entry(b, &device_info->safe_buffers, node)
178 if (b->safe_dma_addr == safe_dma_addr) 188 if (b->safe_dma_addr == safe_dma_addr)
179 return b; 189 break;
180 190
181 return NULL; 191 read_unlock_irqrestore(&device_info->lock, flags);
192 return b;
182} 193}
183 194
184static inline void 195static inline void
185free_safe_buffer(struct dmabounce_device_info *device_info, struct safe_buffer *buf) 196free_safe_buffer(struct dmabounce_device_info *device_info, struct safe_buffer *buf)
186{ 197{
198 unsigned long flags;
199
187 dev_dbg(device_info->dev, "%s(buf=%p)\n", __func__, buf); 200 dev_dbg(device_info->dev, "%s(buf=%p)\n", __func__, buf);
188 201
202 write_lock_irqsave(&device_info->lock, flags);
203
189 list_del(&buf->node); 204 list_del(&buf->node);
190 205
206 write_unlock_irqrestore(&device_info->lock, flags);
207
191 if (buf->pool) 208 if (buf->pool)
192 dma_pool_free(buf->pool->pool, buf->safe, buf->safe_dma_addr); 209 dma_pool_free(buf->pool->pool, buf->safe, buf->safe_dma_addr);
193 else 210 else
@@ -396,7 +413,6 @@ dma_addr_t
396dma_map_single(struct device *dev, void *ptr, size_t size, 413dma_map_single(struct device *dev, void *ptr, size_t size,
397 enum dma_data_direction dir) 414 enum dma_data_direction dir)
398{ 415{
399 unsigned long flags;
400 dma_addr_t dma_addr; 416 dma_addr_t dma_addr;
401 417
402 dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", 418 dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n",
@@ -404,12 +420,8 @@ dma_map_single(struct device *dev, void *ptr, size_t size,
404 420
405 BUG_ON(dir == DMA_NONE); 421 BUG_ON(dir == DMA_NONE);
406 422
407 local_irq_save(flags);
408
409 dma_addr = map_single(dev, ptr, size, dir); 423 dma_addr = map_single(dev, ptr, size, dir);
410 424
411 local_irq_restore(flags);
412
413 return dma_addr; 425 return dma_addr;
414} 426}
415 427
@@ -424,25 +436,18 @@ void
424dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 436dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
425 enum dma_data_direction dir) 437 enum dma_data_direction dir)
426{ 438{
427 unsigned long flags;
428
429 dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", 439 dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n",
430 __func__, (void *) dma_addr, size, dir); 440 __func__, (void *) dma_addr, size, dir);
431 441
432 BUG_ON(dir == DMA_NONE); 442 BUG_ON(dir == DMA_NONE);
433 443
434 local_irq_save(flags);
435
436 unmap_single(dev, dma_addr, size, dir); 444 unmap_single(dev, dma_addr, size, dir);
437
438 local_irq_restore(flags);
439} 445}
440 446
441int 447int
442dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 448dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
443 enum dma_data_direction dir) 449 enum dma_data_direction dir)
444{ 450{
445 unsigned long flags;
446 int i; 451 int i;
447 452
448 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n", 453 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
@@ -450,8 +455,6 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
450 455
451 BUG_ON(dir == DMA_NONE); 456 BUG_ON(dir == DMA_NONE);
452 457
453 local_irq_save(flags);
454
455 for (i = 0; i < nents; i++, sg++) { 458 for (i = 0; i < nents; i++, sg++) {
456 struct page *page = sg->page; 459 struct page *page = sg->page;
457 unsigned int offset = sg->offset; 460 unsigned int offset = sg->offset;
@@ -462,8 +465,6 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
462 map_single(dev, ptr, length, dir); 465 map_single(dev, ptr, length, dir);
463 } 466 }
464 467
465 local_irq_restore(flags);
466
467 return nents; 468 return nents;
468} 469}
469 470
@@ -471,7 +472,6 @@ void
471dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, 472dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
472 enum dma_data_direction dir) 473 enum dma_data_direction dir)
473{ 474{
474 unsigned long flags;
475 int i; 475 int i;
476 476
477 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n", 477 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
@@ -479,55 +479,38 @@ dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
479 479
480 BUG_ON(dir == DMA_NONE); 480 BUG_ON(dir == DMA_NONE);
481 481
482 local_irq_save(flags);
483
484 for (i = 0; i < nents; i++, sg++) { 482 for (i = 0; i < nents; i++, sg++) {
485 dma_addr_t dma_addr = sg->dma_address; 483 dma_addr_t dma_addr = sg->dma_address;
486 unsigned int length = sg->length; 484 unsigned int length = sg->length;
487 485
488 unmap_single(dev, dma_addr, length, dir); 486 unmap_single(dev, dma_addr, length, dir);
489 } 487 }
490
491 local_irq_restore(flags);
492} 488}
493 489
494void 490void
495dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_addr, size_t size, 491dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_addr, size_t size,
496 enum dma_data_direction dir) 492 enum dma_data_direction dir)
497{ 493{
498 unsigned long flags;
499
500 dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", 494 dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n",
501 __func__, (void *) dma_addr, size, dir); 495 __func__, (void *) dma_addr, size, dir);
502 496
503 local_irq_save(flags);
504
505 sync_single(dev, dma_addr, size, dir); 497 sync_single(dev, dma_addr, size, dir);
506
507 local_irq_restore(flags);
508} 498}
509 499
510void 500void
511dma_sync_single_for_device(struct device *dev, dma_addr_t dma_addr, size_t size, 501dma_sync_single_for_device(struct device *dev, dma_addr_t dma_addr, size_t size,
512 enum dma_data_direction dir) 502 enum dma_data_direction dir)
513{ 503{
514 unsigned long flags;
515
516 dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", 504 dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n",
517 __func__, (void *) dma_addr, size, dir); 505 __func__, (void *) dma_addr, size, dir);
518 506
519 local_irq_save(flags);
520
521 sync_single(dev, dma_addr, size, dir); 507 sync_single(dev, dma_addr, size, dir);
522
523 local_irq_restore(flags);
524} 508}
525 509
526void 510void
527dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents, 511dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
528 enum dma_data_direction dir) 512 enum dma_data_direction dir)
529{ 513{
530 unsigned long flags;
531 int i; 514 int i;
532 515
533 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n", 516 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
@@ -535,23 +518,18 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
535 518
536 BUG_ON(dir == DMA_NONE); 519 BUG_ON(dir == DMA_NONE);
537 520
538 local_irq_save(flags);
539
540 for (i = 0; i < nents; i++, sg++) { 521 for (i = 0; i < nents; i++, sg++) {
541 dma_addr_t dma_addr = sg->dma_address; 522 dma_addr_t dma_addr = sg->dma_address;
542 unsigned int length = sg->length; 523 unsigned int length = sg->length;
543 524
544 sync_single(dev, dma_addr, length, dir); 525 sync_single(dev, dma_addr, length, dir);
545 } 526 }
546
547 local_irq_restore(flags);
548} 527}
549 528
550void 529void
551dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents, 530dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
552 enum dma_data_direction dir) 531 enum dma_data_direction dir)
553{ 532{
554 unsigned long flags;
555 int i; 533 int i;
556 534
557 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n", 535 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
@@ -559,16 +537,12 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
559 537
560 BUG_ON(dir == DMA_NONE); 538 BUG_ON(dir == DMA_NONE);
561 539
562 local_irq_save(flags);
563
564 for (i = 0; i < nents; i++, sg++) { 540 for (i = 0; i < nents; i++, sg++) {
565 dma_addr_t dma_addr = sg->dma_address; 541 dma_addr_t dma_addr = sg->dma_address;
566 unsigned int length = sg->length; 542 unsigned int length = sg->length;
567 543
568 sync_single(dev, dma_addr, length, dir); 544 sync_single(dev, dma_addr, length, dir);
569 } 545 }
570
571 local_irq_restore(flags);
572} 546}
573 547
574static int 548static int
@@ -622,6 +596,7 @@ dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size,
622 596
623 device_info->dev = dev; 597 device_info->dev = dev;
624 INIT_LIST_HEAD(&device_info->safe_buffers); 598 INIT_LIST_HEAD(&device_info->safe_buffers);
599 rwlock_init(&device_info->lock);
625 600
626#ifdef STATS 601#ifdef STATS
627 device_info->total_allocs = 0; 602 device_info->total_allocs = 0;
diff --git a/arch/arm/common/uengine.c b/arch/arm/common/uengine.c
index a1310b71004e..dfca596a9a27 100644
--- a/arch/arm/common/uengine.c
+++ b/arch/arm/common/uengine.c
@@ -18,10 +18,26 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <asm/hardware.h> 20#include <asm/hardware.h>
21#include <asm/arch/ixp2000-regs.h> 21#include <asm/arch/hardware.h>
22#include <asm/hardware/uengine.h> 22#include <asm/hardware/uengine.h>
23#include <asm/io.h> 23#include <asm/io.h>
24 24
25#if defined(CONFIG_ARCH_IXP2000)
26#define IXP_UENGINE_CSR_VIRT_BASE IXP2000_UENGINE_CSR_VIRT_BASE
27#define IXP_PRODUCT_ID IXP2000_PRODUCT_ID
28#define IXP_MISC_CONTROL IXP2000_MISC_CONTROL
29#define IXP_RESET1 IXP2000_RESET1
30#else
31#if defined(CONFIG_ARCH_IXP23XX)
32#define IXP_UENGINE_CSR_VIRT_BASE IXP23XX_UENGINE_CSR_VIRT_BASE
33#define IXP_PRODUCT_ID IXP23XX_PRODUCT_ID
34#define IXP_MISC_CONTROL IXP23XX_MISC_CONTROL
35#define IXP_RESET1 IXP23XX_RESET1
36#else
37#error unknown platform
38#endif
39#endif
40
25#define USTORE_ADDRESS 0x000 41#define USTORE_ADDRESS 0x000
26#define USTORE_DATA_LOWER 0x004 42#define USTORE_DATA_LOWER 0x004
27#define USTORE_DATA_UPPER 0x008 43#define USTORE_DATA_UPPER 0x008
@@ -43,7 +59,7 @@ u32 ixp2000_uengine_mask;
43 59
44static void *ixp2000_uengine_csr_area(int uengine) 60static void *ixp2000_uengine_csr_area(int uengine)
45{ 61{
46 return ((void *)IXP2000_UENGINE_CSR_VIRT_BASE) + (uengine << 10); 62 return ((void *)IXP_UENGINE_CSR_VIRT_BASE) + (uengine << 10);
47} 63}
48 64
49/* 65/*
@@ -91,8 +107,13 @@ EXPORT_SYMBOL(ixp2000_uengine_csr_write);
91 107
92void ixp2000_uengine_reset(u32 uengine_mask) 108void ixp2000_uengine_reset(u32 uengine_mask)
93{ 109{
94 ixp2000_reg_wrb(IXP2000_RESET1, uengine_mask & ixp2000_uengine_mask); 110 u32 value;
95 ixp2000_reg_wrb(IXP2000_RESET1, 0); 111
112 value = ixp2000_reg_read(IXP_RESET1) & ~ixp2000_uengine_mask;
113
114 uengine_mask &= ixp2000_uengine_mask;
115 ixp2000_reg_wrb(IXP_RESET1, value | uengine_mask);
116 ixp2000_reg_wrb(IXP_RESET1, value);
96} 117}
97EXPORT_SYMBOL(ixp2000_uengine_reset); 118EXPORT_SYMBOL(ixp2000_uengine_reset);
98 119
@@ -235,11 +256,12 @@ static int check_ixp_type(struct ixp2000_uengine_code *c)
235 u32 product_id; 256 u32 product_id;
236 u32 rev; 257 u32 rev;
237 258
238 product_id = ixp2000_reg_read(IXP2000_PRODUCT_ID); 259 product_id = ixp2000_reg_read(IXP_PRODUCT_ID);
239 if (((product_id >> 16) & 0x1f) != 0) 260 if (((product_id >> 16) & 0x1f) != 0)
240 return 0; 261 return 0;
241 262
242 switch ((product_id >> 8) & 0xff) { 263 switch ((product_id >> 8) & 0xff) {
264#ifdef CONFIG_ARCH_IXP2000
243 case 0: /* IXP2800 */ 265 case 0: /* IXP2800 */
244 if (!(c->cpu_model_bitmask & 4)) 266 if (!(c->cpu_model_bitmask & 4))
245 return 0; 267 return 0;
@@ -254,6 +276,14 @@ static int check_ixp_type(struct ixp2000_uengine_code *c)
254 if (!(c->cpu_model_bitmask & 2)) 276 if (!(c->cpu_model_bitmask & 2))
255 return 0; 277 return 0;
256 break; 278 break;
279#endif
280
281#ifdef CONFIG_ARCH_IXP23XX
282 case 4: /* IXP23xx */
283 if (!(c->cpu_model_bitmask & 0x3f0))
284 return 0;
285 break;
286#endif
257 287
258 default: 288 default:
259 return 0; 289 return 0;
@@ -432,7 +462,8 @@ static int __init ixp2000_uengine_init(void)
432 /* 462 /*
433 * Determine number of microengines present. 463 * Determine number of microengines present.
434 */ 464 */
435 switch ((ixp2000_reg_read(IXP2000_PRODUCT_ID) >> 8) & 0x1fff) { 465 switch ((ixp2000_reg_read(IXP_PRODUCT_ID) >> 8) & 0x1fff) {
466#ifdef CONFIG_ARCH_IXP2000
436 case 0: /* IXP2800 */ 467 case 0: /* IXP2800 */
437 case 1: /* IXP2850 */ 468 case 1: /* IXP2850 */
438 ixp2000_uengine_mask = 0x00ff00ff; 469 ixp2000_uengine_mask = 0x00ff00ff;
@@ -441,10 +472,17 @@ static int __init ixp2000_uengine_init(void)
441 case 2: /* IXP2400 */ 472 case 2: /* IXP2400 */
442 ixp2000_uengine_mask = 0x000f000f; 473 ixp2000_uengine_mask = 0x000f000f;
443 break; 474 break;
475#endif
476
477#ifdef CONFIG_ARCH_IXP23XX
478 case 4: /* IXP23xx */
479 ixp2000_uengine_mask = (*IXP23XX_EXP_CFG_FUSE >> 8) & 0xf;
480 break;
481#endif
444 482
445 default: 483 default:
446 printk(KERN_INFO "Detected unknown IXP2000 model (%.8x)\n", 484 printk(KERN_INFO "Detected unknown IXP2000 model (%.8x)\n",
447 (unsigned int)ixp2000_reg_read(IXP2000_PRODUCT_ID)); 485 (unsigned int)ixp2000_reg_read(IXP_PRODUCT_ID));
448 ixp2000_uengine_mask = 0x00000000; 486 ixp2000_uengine_mask = 0x00000000;
449 break; 487 break;
450 } 488 }
@@ -457,15 +495,15 @@ static int __init ixp2000_uengine_init(void)
457 /* 495 /*
458 * Synchronise timestamp counters across all microengines. 496 * Synchronise timestamp counters across all microengines.
459 */ 497 */
460 value = ixp2000_reg_read(IXP2000_MISC_CONTROL); 498 value = ixp2000_reg_read(IXP_MISC_CONTROL);
461 ixp2000_reg_wrb(IXP2000_MISC_CONTROL, value & ~0x80); 499 ixp2000_reg_wrb(IXP_MISC_CONTROL, value & ~0x80);
462 for (uengine = 0; uengine < 32; uengine++) { 500 for (uengine = 0; uengine < 32; uengine++) {
463 if (ixp2000_uengine_mask & (1 << uengine)) { 501 if (ixp2000_uengine_mask & (1 << uengine)) {
464 ixp2000_uengine_csr_write(uengine, TIMESTAMP_LOW, 0); 502 ixp2000_uengine_csr_write(uengine, TIMESTAMP_LOW, 0);
465 ixp2000_uengine_csr_write(uengine, TIMESTAMP_HIGH, 0); 503 ixp2000_uengine_csr_write(uengine, TIMESTAMP_HIGH, 0);
466 } 504 }
467 } 505 }
468 ixp2000_reg_wrb(IXP2000_MISC_CONTROL, value | 0x80); 506 ixp2000_reg_wrb(IXP_MISC_CONTROL, value | 0x80);
469 507
470 return 0; 508 return 0;
471} 509}
diff --git a/arch/arm/configs/lpd270_defconfig b/arch/arm/configs/lpd270_defconfig
new file mode 100644
index 000000000000..d08bbe59483a
--- /dev/null
+++ b/arch/arm/configs/lpd270_defconfig
@@ -0,0 +1,963 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-git2
4# Wed Jun 21 22:20:18 2006
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_ARCH_MTD_XIP=y
12CONFIG_VECTORS_BASE=0xffff0000
13
14#
15# Code maturity level options
16#
17CONFIG_EXPERIMENTAL=y
18CONFIG_BROKEN_ON_SMP=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_LOCALVERSION_AUTO=y
26CONFIG_SWAP=y
27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y
31# CONFIG_AUDIT is not set
32# CONFIG_IKCONFIG is not set
33# CONFIG_RELAY is not set
34CONFIG_INITRAMFS_SOURCE=""
35CONFIG_UID16=y
36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
37# CONFIG_EMBEDDED is not set
38CONFIG_KALLSYMS=y
39# CONFIG_KALLSYMS_ALL is not set
40# CONFIG_KALLSYMS_EXTRA_PASS is not set
41CONFIG_HOTPLUG=y
42CONFIG_PRINTK=y
43CONFIG_BUG=y
44CONFIG_ELF_CORE=y
45CONFIG_BASE_FULL=y
46CONFIG_FUTEX=y
47CONFIG_EPOLL=y
48CONFIG_SHMEM=y
49CONFIG_SLAB=y
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52# CONFIG_SLOB is not set
53
54#
55# Loadable module support
56#
57CONFIG_MODULES=y
58# CONFIG_MODULE_UNLOAD is not set
59# CONFIG_MODVERSIONS is not set
60# CONFIG_MODULE_SRCVERSION_ALL is not set
61# CONFIG_KMOD is not set
62
63#
64# Block layer
65#
66# CONFIG_BLK_DEV_IO_TRACE is not set
67
68#
69# IO Schedulers
70#
71CONFIG_IOSCHED_NOOP=y
72CONFIG_IOSCHED_AS=y
73CONFIG_IOSCHED_DEADLINE=y
74CONFIG_IOSCHED_CFQ=y
75CONFIG_DEFAULT_AS=y
76# CONFIG_DEFAULT_DEADLINE is not set
77# CONFIG_DEFAULT_CFQ is not set
78# CONFIG_DEFAULT_NOOP is not set
79CONFIG_DEFAULT_IOSCHED="anticipatory"
80
81#
82# System Type
83#
84# CONFIG_ARCH_AAEC2000 is not set
85# CONFIG_ARCH_INTEGRATOR is not set
86# CONFIG_ARCH_REALVIEW is not set
87# CONFIG_ARCH_VERSATILE is not set
88# CONFIG_ARCH_AT91RM9200 is not set
89# CONFIG_ARCH_CLPS7500 is not set
90# CONFIG_ARCH_CLPS711X is not set
91# CONFIG_ARCH_CO285 is not set
92# CONFIG_ARCH_EBSA110 is not set
93# CONFIG_ARCH_EP93XX is not set
94# CONFIG_ARCH_FOOTBRIDGE is not set
95# CONFIG_ARCH_NETX is not set
96# CONFIG_ARCH_H720X is not set
97# CONFIG_ARCH_IMX is not set
98# CONFIG_ARCH_IOP3XX is not set
99# CONFIG_ARCH_IXP4XX is not set
100# CONFIG_ARCH_IXP2000 is not set
101# CONFIG_ARCH_IXP23XX is not set
102# CONFIG_ARCH_L7200 is not set
103# CONFIG_ARCH_PNX4008 is not set
104CONFIG_ARCH_PXA=y
105# CONFIG_ARCH_RPC is not set
106# CONFIG_ARCH_SA1100 is not set
107# CONFIG_ARCH_S3C2410 is not set
108# CONFIG_ARCH_SHARK is not set
109# CONFIG_ARCH_LH7A40X is not set
110# CONFIG_ARCH_OMAP is not set
111
112#
113# Intel PXA2xx Implementations
114#
115# CONFIG_ARCH_LUBBOCK is not set
116CONFIG_MACH_LOGICPD_PXA270=y
117# CONFIG_MACH_MAINSTONE is not set
118# CONFIG_ARCH_PXA_IDP is not set
119# CONFIG_PXA_SHARPSL is not set
120CONFIG_PXA27x=y
121CONFIG_IWMMXT=y
122
123#
124# Processor Type
125#
126CONFIG_CPU_32=y
127CONFIG_CPU_XSCALE=y
128CONFIG_CPU_32v5=y
129CONFIG_CPU_ABRT_EV5T=y
130CONFIG_CPU_CACHE_VIVT=y
131CONFIG_CPU_TLB_V4WBI=y
132
133#
134# Processor Features
135#
136# CONFIG_ARM_THUMB is not set
137CONFIG_XSCALE_PMU=y
138
139#
140# Bus support
141#
142
143#
144# PCCARD (PCMCIA/CardBus) support
145#
146# CONFIG_PCCARD is not set
147
148#
149# Kernel Features
150#
151# CONFIG_PREEMPT is not set
152# CONFIG_NO_IDLE_HZ is not set
153CONFIG_HZ=100
154# CONFIG_AEABI is not set
155# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
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=4096
164CONFIG_ALIGNMENT_TRAP=y
165
166#
167# Boot options
168#
169CONFIG_ZBOOT_ROM_TEXT=0x0
170CONFIG_ZBOOT_ROM_BSS=0x0
171CONFIG_CMDLINE="root=/dev/nfs ip=bootp console=ttyS0,115200 mem=64M"
172# CONFIG_XIP_KERNEL is not set
173
174#
175# Floating point emulation
176#
177
178#
179# At least one emulation must be selected
180#
181CONFIG_FPE_NWFPE=y
182# CONFIG_FPE_NWFPE_XP is not set
183# CONFIG_FPE_FASTFPE is not set
184
185#
186# Userspace binary formats
187#
188CONFIG_BINFMT_ELF=y
189# CONFIG_BINFMT_AOUT is not set
190# CONFIG_BINFMT_MISC is not set
191# CONFIG_ARTHUR is not set
192
193#
194# Power management options
195#
196# CONFIG_PM is not set
197# CONFIG_PM_LEGACY is not set
198# CONFIG_PM_DEBUG is not set
199# CONFIG_APM is not set
200
201#
202# Networking
203#
204CONFIG_NET=y
205
206#
207# Networking options
208#
209# CONFIG_NETDEBUG is not set
210# CONFIG_PACKET is not set
211CONFIG_UNIX=y
212CONFIG_XFRM=y
213# CONFIG_XFRM_USER is not set
214# CONFIG_NET_KEY is not set
215CONFIG_INET=y
216# CONFIG_IP_MULTICAST is not set
217# CONFIG_IP_ADVANCED_ROUTER is not set
218CONFIG_IP_FIB_HASH=y
219CONFIG_IP_PNP=y
220# CONFIG_IP_PNP_DHCP is not set
221CONFIG_IP_PNP_BOOTP=y
222# CONFIG_IP_PNP_RARP is not set
223# CONFIG_NET_IPIP is not set
224# CONFIG_NET_IPGRE is not set
225# CONFIG_ARPD is not set
226# CONFIG_SYN_COOKIES is not set
227# CONFIG_INET_AH is not set
228# CONFIG_INET_ESP is not set
229# CONFIG_INET_IPCOMP is not set
230# CONFIG_INET_XFRM_TUNNEL is not set
231# CONFIG_INET_TUNNEL is not set
232CONFIG_INET_XFRM_MODE_TRANSPORT=y
233CONFIG_INET_XFRM_MODE_TUNNEL=y
234CONFIG_INET_DIAG=y
235CONFIG_INET_TCP_DIAG=y
236# CONFIG_TCP_CONG_ADVANCED is not set
237CONFIG_TCP_CONG_BIC=y
238# CONFIG_IPV6 is not set
239# CONFIG_INET6_XFRM_TUNNEL is not set
240# CONFIG_INET6_TUNNEL is not set
241# CONFIG_NETWORK_SECMARK is not set
242# CONFIG_NETFILTER is not set
243
244#
245# DCCP Configuration (EXPERIMENTAL)
246#
247# CONFIG_IP_DCCP is not set
248
249#
250# SCTP Configuration (EXPERIMENTAL)
251#
252# CONFIG_IP_SCTP is not set
253
254#
255# TIPC Configuration (EXPERIMENTAL)
256#
257# CONFIG_TIPC is not set
258# CONFIG_ATM is not set
259# CONFIG_BRIDGE is not set
260# CONFIG_VLAN_8021Q is not set
261# CONFIG_DECNET is not set
262# CONFIG_LLC2 is not set
263# CONFIG_IPX is not set
264# CONFIG_ATALK is not set
265# CONFIG_X25 is not set
266# CONFIG_LAPB is not set
267# CONFIG_NET_DIVERT is not set
268# CONFIG_ECONET is not set
269# CONFIG_WAN_ROUTER is not set
270
271#
272# QoS and/or fair queueing
273#
274# CONFIG_NET_SCHED is not set
275
276#
277# Network testing
278#
279# CONFIG_NET_PKTGEN is not set
280# CONFIG_HAMRADIO is not set
281# CONFIG_IRDA is not set
282# CONFIG_BT is not set
283# CONFIG_IEEE80211 is not set
284
285#
286# Device Drivers
287#
288
289#
290# Generic Driver Options
291#
292CONFIG_STANDALONE=y
293CONFIG_PREVENT_FIRMWARE_BUILD=y
294# CONFIG_FW_LOADER is not set
295# CONFIG_DEBUG_DRIVER is not set
296
297#
298# Connector - unified userspace <-> kernelspace linker
299#
300# CONFIG_CONNECTOR is not set
301
302#
303# Memory Technology Devices (MTD)
304#
305CONFIG_MTD=y
306# CONFIG_MTD_DEBUG is not set
307# CONFIG_MTD_CONCAT is not set
308CONFIG_MTD_PARTITIONS=y
309CONFIG_MTD_REDBOOT_PARTS=y
310CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
311# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
312# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
313# CONFIG_MTD_CMDLINE_PARTS is not set
314# CONFIG_MTD_AFS_PARTS is not set
315
316#
317# User Modules And Translation Layers
318#
319CONFIG_MTD_CHAR=y
320CONFIG_MTD_BLOCK=y
321# CONFIG_FTL is not set
322# CONFIG_NFTL is not set
323# CONFIG_INFTL is not set
324# CONFIG_RFD_FTL is not set
325
326#
327# RAM/ROM/Flash chip drivers
328#
329CONFIG_MTD_CFI=y
330# CONFIG_MTD_JEDECPROBE is not set
331CONFIG_MTD_GEN_PROBE=y
332CONFIG_MTD_CFI_ADV_OPTIONS=y
333CONFIG_MTD_CFI_NOSWAP=y
334# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
335# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
336CONFIG_MTD_CFI_GEOMETRY=y
337CONFIG_MTD_MAP_BANK_WIDTH_1=y
338CONFIG_MTD_MAP_BANK_WIDTH_2=y
339CONFIG_MTD_MAP_BANK_WIDTH_4=y
340# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
341# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
342# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
343# CONFIG_MTD_CFI_I1 is not set
344CONFIG_MTD_CFI_I2=y
345# CONFIG_MTD_CFI_I4 is not set
346# CONFIG_MTD_CFI_I8 is not set
347# CONFIG_MTD_OTP is not set
348CONFIG_MTD_CFI_INTELEXT=y
349# CONFIG_MTD_CFI_AMDSTD is not set
350# CONFIG_MTD_CFI_STAA is not set
351CONFIG_MTD_CFI_UTIL=y
352# CONFIG_MTD_RAM is not set
353# CONFIG_MTD_ROM is not set
354# CONFIG_MTD_ABSENT is not set
355# CONFIG_MTD_OBSOLETE_CHIPS is not set
356# CONFIG_MTD_XIP is not set
357
358#
359# Mapping drivers for chip access
360#
361# CONFIG_MTD_COMPLEX_MAPPINGS is not set
362# CONFIG_MTD_PHYSMAP is not set
363# CONFIG_MTD_ARM_INTEGRATOR is not set
364# CONFIG_MTD_SHARP_SL is not set
365# CONFIG_MTD_PLATRAM is not set
366
367#
368# Self-contained MTD device drivers
369#
370# CONFIG_MTD_SLRAM is not set
371# CONFIG_MTD_PHRAM is not set
372# CONFIG_MTD_MTDRAM is not set
373# CONFIG_MTD_BLOCK2MTD is not set
374
375#
376# Disk-On-Chip Device Drivers
377#
378# CONFIG_MTD_DOC2000 is not set
379# CONFIG_MTD_DOC2001 is not set
380# CONFIG_MTD_DOC2001PLUS is not set
381
382#
383# NAND Flash Device Drivers
384#
385# CONFIG_MTD_NAND is not set
386
387#
388# OneNAND Flash Device Drivers
389#
390# CONFIG_MTD_ONENAND is not set
391
392#
393# Parallel port support
394#
395# CONFIG_PARPORT is not set
396
397#
398# Plug and Play support
399#
400
401#
402# Block devices
403#
404# CONFIG_BLK_DEV_COW_COMMON is not set
405# CONFIG_BLK_DEV_LOOP is not set
406# CONFIG_BLK_DEV_NBD is not set
407# CONFIG_BLK_DEV_RAM is not set
408# CONFIG_BLK_DEV_INITRD is not set
409# CONFIG_CDROM_PKTCDVD is not set
410# CONFIG_ATA_OVER_ETH is not set
411
412#
413# ATA/ATAPI/MFM/RLL support
414#
415CONFIG_IDE=y
416CONFIG_BLK_DEV_IDE=y
417
418#
419# Please see Documentation/ide.txt for help/info on IDE drives
420#
421# CONFIG_BLK_DEV_IDE_SATA is not set
422CONFIG_BLK_DEV_IDEDISK=y
423# CONFIG_IDEDISK_MULTI_MODE is not set
424# CONFIG_BLK_DEV_IDECD is not set
425# CONFIG_BLK_DEV_IDETAPE is not set
426# CONFIG_BLK_DEV_IDEFLOPPY is not set
427# CONFIG_IDE_TASK_IOCTL is not set
428
429#
430# IDE chipset support/bugfixes
431#
432# CONFIG_IDE_GENERIC is not set
433# CONFIG_IDE_ARM is not set
434# CONFIG_BLK_DEV_IDEDMA is not set
435# CONFIG_IDEDMA_AUTO is not set
436# CONFIG_BLK_DEV_HD is not set
437
438#
439# SCSI device support
440#
441# CONFIG_RAID_ATTRS is not set
442# CONFIG_SCSI is not set
443
444#
445# Multi-device support (RAID and LVM)
446#
447# CONFIG_MD is not set
448
449#
450# Fusion MPT device support
451#
452# CONFIG_FUSION is not set
453
454#
455# IEEE 1394 (FireWire) support
456#
457
458#
459# I2O device support
460#
461
462#
463# Network device support
464#
465CONFIG_NETDEVICES=y
466# CONFIG_DUMMY is not set
467# CONFIG_BONDING is not set
468# CONFIG_EQUALIZER is not set
469# CONFIG_TUN is not set
470
471#
472# PHY device support
473#
474# CONFIG_PHYLIB is not set
475
476#
477# Ethernet (10 or 100Mbit)
478#
479CONFIG_NET_ETHERNET=y
480CONFIG_MII=y
481CONFIG_SMC91X=y
482# CONFIG_DM9000 is not set
483# CONFIG_SMC911X is not set
484
485#
486# Ethernet (1000 Mbit)
487#
488
489#
490# Ethernet (10000 Mbit)
491#
492
493#
494# Token Ring devices
495#
496
497#
498# Wireless LAN (non-hamradio)
499#
500# CONFIG_NET_RADIO is not set
501
502#
503# Wan interfaces
504#
505# CONFIG_WAN is not set
506# CONFIG_PPP is not set
507# CONFIG_SLIP is not set
508# CONFIG_SHAPER is not set
509# CONFIG_NETCONSOLE is not set
510# CONFIG_NETPOLL is not set
511# CONFIG_NET_POLL_CONTROLLER is not set
512
513#
514# ISDN subsystem
515#
516# CONFIG_ISDN is not set
517
518#
519# Input device support
520#
521CONFIG_INPUT=y
522
523#
524# Userland interfaces
525#
526CONFIG_INPUT_MOUSEDEV=y
527CONFIG_INPUT_MOUSEDEV_PSAUX=y
528CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
529CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
530# CONFIG_INPUT_JOYDEV is not set
531# CONFIG_INPUT_TSDEV is not set
532CONFIG_INPUT_EVDEV=y
533# CONFIG_INPUT_EVBUG is not set
534
535#
536# Input Device Drivers
537#
538CONFIG_INPUT_KEYBOARD=y
539CONFIG_KEYBOARD_ATKBD=y
540# CONFIG_KEYBOARD_SUNKBD is not set
541# CONFIG_KEYBOARD_LKKBD is not set
542# CONFIG_KEYBOARD_XTKBD is not set
543# CONFIG_KEYBOARD_NEWTON is not set
544# CONFIG_INPUT_MOUSE is not set
545# CONFIG_INPUT_JOYSTICK is not set
546# CONFIG_INPUT_TOUCHSCREEN is not set
547# CONFIG_INPUT_MISC is not set
548
549#
550# Hardware I/O ports
551#
552CONFIG_SERIO=y
553# CONFIG_SERIO_SERPORT is not set
554CONFIG_SERIO_LIBPS2=y
555# CONFIG_SERIO_RAW is not set
556# CONFIG_GAMEPORT is not set
557
558#
559# Character devices
560#
561CONFIG_VT=y
562CONFIG_VT_CONSOLE=y
563CONFIG_HW_CONSOLE=y
564# CONFIG_SERIAL_NONSTANDARD is not set
565
566#
567# Serial drivers
568#
569# CONFIG_SERIAL_8250 is not set
570
571#
572# Non-8250 serial port support
573#
574CONFIG_SERIAL_PXA=y
575CONFIG_SERIAL_PXA_CONSOLE=y
576CONFIG_SERIAL_CORE=y
577CONFIG_SERIAL_CORE_CONSOLE=y
578CONFIG_UNIX98_PTYS=y
579CONFIG_LEGACY_PTYS=y
580CONFIG_LEGACY_PTY_COUNT=256
581
582#
583# IPMI
584#
585# CONFIG_IPMI_HANDLER is not set
586
587#
588# Watchdog Cards
589#
590# CONFIG_WATCHDOG is not set
591# CONFIG_NVRAM is not set
592# CONFIG_DTLK is not set
593# CONFIG_R3964 is not set
594
595#
596# Ftape, the floppy tape device driver
597#
598# CONFIG_RAW_DRIVER is not set
599
600#
601# TPM devices
602#
603# CONFIG_TCG_TPM is not set
604# CONFIG_TELCLOCK is not set
605
606#
607# I2C support
608#
609# CONFIG_I2C is not set
610
611#
612# SPI support
613#
614# CONFIG_SPI is not set
615# CONFIG_SPI_MASTER is not set
616
617#
618# Dallas's 1-wire bus
619#
620# CONFIG_W1 is not set
621
622#
623# Hardware Monitoring support
624#
625CONFIG_HWMON=y
626# CONFIG_HWMON_VID is not set
627# CONFIG_SENSORS_F71805F is not set
628# CONFIG_HWMON_DEBUG_CHIP is not set
629
630#
631# Misc devices
632#
633
634#
635# LED devices
636#
637# CONFIG_NEW_LEDS is not set
638
639#
640# LED drivers
641#
642
643#
644# LED Triggers
645#
646
647#
648# Multimedia devices
649#
650# CONFIG_VIDEO_DEV is not set
651CONFIG_VIDEO_V4L2=y
652
653#
654# Digital Video Broadcasting Devices
655#
656# CONFIG_DVB is not set
657
658#
659# Graphics support
660#
661CONFIG_FB=y
662CONFIG_FB_CFB_FILLRECT=y
663CONFIG_FB_CFB_COPYAREA=y
664CONFIG_FB_CFB_IMAGEBLIT=y
665# CONFIG_FB_MACMODES is not set
666CONFIG_FB_FIRMWARE_EDID=y
667# CONFIG_FB_MODE_HELPERS is not set
668# CONFIG_FB_TILEBLITTING is not set
669# CONFIG_FB_S1D13XXX is not set
670CONFIG_FB_PXA=y
671# CONFIG_FB_PXA_PARAMETERS is not set
672# CONFIG_FB_VIRTUAL is not set
673
674#
675# Console display driver support
676#
677# CONFIG_VGA_CONSOLE is not set
678CONFIG_DUMMY_CONSOLE=y
679CONFIG_FRAMEBUFFER_CONSOLE=y
680# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
681# CONFIG_FONTS is not set
682CONFIG_FONT_8x8=y
683CONFIG_FONT_8x16=y
684
685#
686# Logo configuration
687#
688CONFIG_LOGO=y
689CONFIG_LOGO_LINUX_MONO=y
690CONFIG_LOGO_LINUX_VGA16=y
691CONFIG_LOGO_LINUX_CLUT224=y
692# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
693
694#
695# Sound
696#
697CONFIG_SOUND=y
698
699#
700# Advanced Linux Sound Architecture
701#
702CONFIG_SND=y
703CONFIG_SND_TIMER=y
704CONFIG_SND_PCM=y
705# CONFIG_SND_SEQUENCER is not set
706# CONFIG_SND_MIXER_OSS is not set
707# CONFIG_SND_PCM_OSS is not set
708# CONFIG_SND_DYNAMIC_MINORS is not set
709# CONFIG_SND_SUPPORT_OLD_API is not set
710CONFIG_SND_VERBOSE_PROCFS=y
711# CONFIG_SND_VERBOSE_PRINTK is not set
712# CONFIG_SND_DEBUG is not set
713
714#
715# Generic devices
716#
717CONFIG_SND_AC97_CODEC=y
718CONFIG_SND_AC97_BUS=y
719# CONFIG_SND_DUMMY is not set
720# CONFIG_SND_MTPAV is not set
721# CONFIG_SND_SERIAL_U16550 is not set
722# CONFIG_SND_MPU401 is not set
723
724#
725# ALSA ARM devices
726#
727CONFIG_SND_PXA2XX_PCM=y
728CONFIG_SND_PXA2XX_AC97=y
729
730#
731# Open Sound System
732#
733# CONFIG_SOUND_PRIME is not set
734
735#
736# USB support
737#
738CONFIG_USB_ARCH_HAS_HCD=y
739CONFIG_USB_ARCH_HAS_OHCI=y
740# CONFIG_USB_ARCH_HAS_EHCI is not set
741# CONFIG_USB is not set
742
743#
744# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
745#
746
747#
748# USB Gadget Support
749#
750# CONFIG_USB_GADGET is not set
751
752#
753# MMC/SD Card support
754#
755# CONFIG_MMC is not set
756
757#
758# Real Time Clock
759#
760CONFIG_RTC_LIB=y
761# CONFIG_RTC_CLASS is not set
762
763#
764# File systems
765#
766CONFIG_EXT2_FS=y
767# CONFIG_EXT2_FS_XATTR is not set
768# CONFIG_EXT2_FS_XIP is not set
769# CONFIG_EXT3_FS is not set
770# CONFIG_REISERFS_FS is not set
771# CONFIG_JFS_FS is not set
772# CONFIG_FS_POSIX_ACL is not set
773# CONFIG_XFS_FS is not set
774# CONFIG_OCFS2_FS is not set
775# CONFIG_MINIX_FS is not set
776# CONFIG_ROMFS_FS is not set
777CONFIG_INOTIFY=y
778CONFIG_INOTIFY_USER=y
779# CONFIG_QUOTA is not set
780CONFIG_DNOTIFY=y
781# CONFIG_AUTOFS_FS is not set
782# CONFIG_AUTOFS4_FS is not set
783# CONFIG_FUSE_FS is not set
784
785#
786# CD-ROM/DVD Filesystems
787#
788# CONFIG_ISO9660_FS is not set
789# CONFIG_UDF_FS is not set
790
791#
792# DOS/FAT/NT Filesystems
793#
794CONFIG_FAT_FS=y
795CONFIG_MSDOS_FS=y
796# CONFIG_VFAT_FS is not set
797CONFIG_FAT_DEFAULT_CODEPAGE=437
798# CONFIG_NTFS_FS is not set
799
800#
801# Pseudo filesystems
802#
803CONFIG_PROC_FS=y
804CONFIG_SYSFS=y
805# CONFIG_TMPFS is not set
806# CONFIG_HUGETLB_PAGE is not set
807CONFIG_RAMFS=y
808# CONFIG_CONFIGFS_FS is not set
809
810#
811# Miscellaneous filesystems
812#
813# CONFIG_ADFS_FS is not set
814# CONFIG_AFFS_FS is not set
815# CONFIG_HFS_FS is not set
816# CONFIG_HFSPLUS_FS is not set
817# CONFIG_BEFS_FS is not set
818# CONFIG_BFS_FS is not set
819# CONFIG_EFS_FS is not set
820# CONFIG_JFFS_FS is not set
821CONFIG_JFFS2_FS=y
822CONFIG_JFFS2_FS_DEBUG=0
823CONFIG_JFFS2_FS_WRITEBUFFER=y
824# CONFIG_JFFS2_SUMMARY is not set
825# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
826CONFIG_JFFS2_ZLIB=y
827CONFIG_JFFS2_RTIME=y
828# CONFIG_JFFS2_RUBIN is not set
829# CONFIG_CRAMFS is not set
830# CONFIG_VXFS_FS is not set
831# CONFIG_HPFS_FS is not set
832# CONFIG_QNX4FS_FS is not set
833# CONFIG_SYSV_FS is not set
834# CONFIG_UFS_FS is not set
835
836#
837# Network File Systems
838#
839CONFIG_NFS_FS=y
840# CONFIG_NFS_V3 is not set
841# CONFIG_NFS_V4 is not set
842# CONFIG_NFS_DIRECTIO is not set
843# CONFIG_NFSD is not set
844CONFIG_ROOT_NFS=y
845CONFIG_LOCKD=y
846CONFIG_NFS_COMMON=y
847CONFIG_SUNRPC=y
848# CONFIG_RPCSEC_GSS_KRB5 is not set
849# CONFIG_RPCSEC_GSS_SPKM3 is not set
850# CONFIG_SMB_FS is not set
851# CONFIG_CIFS is not set
852# CONFIG_NCP_FS is not set
853# CONFIG_CODA_FS is not set
854# CONFIG_AFS_FS is not set
855# CONFIG_9P_FS is not set
856
857#
858# Partition Types
859#
860# CONFIG_PARTITION_ADVANCED is not set
861CONFIG_MSDOS_PARTITION=y
862
863#
864# Native Language Support
865#
866CONFIG_NLS=y
867CONFIG_NLS_DEFAULT="iso8859-1"
868# CONFIG_NLS_CODEPAGE_437 is not set
869# CONFIG_NLS_CODEPAGE_737 is not set
870# CONFIG_NLS_CODEPAGE_775 is not set
871# CONFIG_NLS_CODEPAGE_850 is not set
872# CONFIG_NLS_CODEPAGE_852 is not set
873# CONFIG_NLS_CODEPAGE_855 is not set
874# CONFIG_NLS_CODEPAGE_857 is not set
875# CONFIG_NLS_CODEPAGE_860 is not set
876# CONFIG_NLS_CODEPAGE_861 is not set
877# CONFIG_NLS_CODEPAGE_862 is not set
878# CONFIG_NLS_CODEPAGE_863 is not set
879# CONFIG_NLS_CODEPAGE_864 is not set
880# CONFIG_NLS_CODEPAGE_865 is not set
881# CONFIG_NLS_CODEPAGE_866 is not set
882# CONFIG_NLS_CODEPAGE_869 is not set
883# CONFIG_NLS_CODEPAGE_936 is not set
884# CONFIG_NLS_CODEPAGE_950 is not set
885# CONFIG_NLS_CODEPAGE_932 is not set
886# CONFIG_NLS_CODEPAGE_949 is not set
887# CONFIG_NLS_CODEPAGE_874 is not set
888# CONFIG_NLS_ISO8859_8 is not set
889# CONFIG_NLS_CODEPAGE_1250 is not set
890# CONFIG_NLS_CODEPAGE_1251 is not set
891# CONFIG_NLS_ASCII is not set
892CONFIG_NLS_ISO8859_1=y
893# CONFIG_NLS_ISO8859_2 is not set
894# CONFIG_NLS_ISO8859_3 is not set
895# CONFIG_NLS_ISO8859_4 is not set
896# CONFIG_NLS_ISO8859_5 is not set
897# CONFIG_NLS_ISO8859_6 is not set
898# CONFIG_NLS_ISO8859_7 is not set
899# CONFIG_NLS_ISO8859_9 is not set
900# CONFIG_NLS_ISO8859_13 is not set
901# CONFIG_NLS_ISO8859_14 is not set
902# CONFIG_NLS_ISO8859_15 is not set
903# CONFIG_NLS_KOI8_R is not set
904# CONFIG_NLS_KOI8_U is not set
905# CONFIG_NLS_UTF8 is not set
906
907#
908# Profiling support
909#
910# CONFIG_PROFILING is not set
911
912#
913# Kernel hacking
914#
915# CONFIG_PRINTK_TIME is not set
916CONFIG_MAGIC_SYSRQ=y
917CONFIG_DEBUG_KERNEL=y
918CONFIG_LOG_BUF_SHIFT=14
919CONFIG_DETECT_SOFTLOCKUP=y
920# CONFIG_SCHEDSTATS is not set
921# CONFIG_DEBUG_SLAB is not set
922# CONFIG_DEBUG_MUTEXES is not set
923# CONFIG_DEBUG_SPINLOCK is not set
924# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
925# CONFIG_DEBUG_KOBJECT is not set
926CONFIG_DEBUG_BUGVERBOSE=y
927CONFIG_DEBUG_INFO=y
928# CONFIG_DEBUG_FS is not set
929# CONFIG_DEBUG_VM is not set
930CONFIG_FRAME_POINTER=y
931# CONFIG_UNWIND_INFO is not set
932CONFIG_FORCED_INLINING=y
933# CONFIG_RCU_TORTURE_TEST is not set
934CONFIG_DEBUG_USER=y
935# CONFIG_DEBUG_WAITQ is not set
936CONFIG_DEBUG_ERRORS=y
937CONFIG_DEBUG_LL=y
938# CONFIG_DEBUG_ICEDCC is not set
939
940#
941# Security options
942#
943# CONFIG_KEYS is not set
944# CONFIG_SECURITY is not set
945
946#
947# Cryptographic options
948#
949# CONFIG_CRYPTO is not set
950
951#
952# Hardware crypto devices
953#
954
955#
956# Library routines
957#
958# CONFIG_CRC_CCITT is not set
959# CONFIG_CRC16 is not set
960CONFIG_CRC32=y
961# CONFIG_LIBCRC32C is not set
962CONFIG_ZLIB_INFLATE=y
963CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index ab8e600c18c8..86c92523a346 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -20,6 +20,7 @@
20#include <asm/glue.h> 20#include <asm/glue.h>
21#include <asm/vfpmacros.h> 21#include <asm/vfpmacros.h>
22#include <asm/arch/entry-macro.S> 22#include <asm/arch/entry-macro.S>
23#include <asm/thread_notify.h>
23 24
24#include "entry-header.S" 25#include "entry-header.S"
25 26
@@ -560,10 +561,8 @@ ENTRY(__switch_to)
560 add ip, r1, #TI_CPU_SAVE 561 add ip, r1, #TI_CPU_SAVE
561 ldr r3, [r2, #TI_TP_VALUE] 562 ldr r3, [r2, #TI_TP_VALUE]
562 stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack 563 stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack
563#ifndef CONFIG_MMU 564#ifdef CONFIG_MMU
564 add r2, r2, #TI_CPU_DOMAIN 565 ldr r6, [r2, #TI_CPU_DOMAIN]
565#else
566 ldr r6, [r2, #TI_CPU_DOMAIN]!
567#endif 566#endif
568#if __LINUX_ARM_ARCH__ >= 6 567#if __LINUX_ARM_ARCH__ >= 6
569#ifdef CONFIG_CPU_32v6K 568#ifdef CONFIG_CPU_32v6K
@@ -585,21 +584,20 @@ ENTRY(__switch_to)
585#ifdef CONFIG_MMU 584#ifdef CONFIG_MMU
586 mcr p15, 0, r6, c3, c0, 0 @ Set domain register 585 mcr p15, 0, r6, c3, c0, 0 @ Set domain register
587#endif 586#endif
588#ifdef CONFIG_VFP
589 @ Always disable VFP so we can lazily save/restore the old
590 @ state. This occurs in the context of the previous thread.
591 VFPFMRX r4, FPEXC
592 bic r4, r4, #FPEXC_ENABLE
593 VFPFMXR FPEXC, r4
594#endif
595#if defined(CONFIG_IWMMXT) 587#if defined(CONFIG_IWMMXT)
596 bl iwmmxt_task_switch 588 bl iwmmxt_task_switch
597#elif defined(CONFIG_CPU_XSCALE) 589#elif defined(CONFIG_CPU_XSCALE)
598 add r4, r2, #40 @ cpu_context_save->extra 590 add r4, r2, #TI_CPU_DOMAIN + 40 @ cpu_context_save->extra
599 ldmib r4, {r4, r5} 591 ldmib r4, {r4, r5}
600 mar acc0, r4, r5 592 mar acc0, r4, r5
601#endif 593#endif
602 ldmib r2, {r4 - sl, fp, sp, pc} @ Load all regs saved previously 594 mov r5, r0
595 add r4, r2, #TI_CPU_SAVE
596 ldr r0, =thread_notify_head
597 mov r1, #THREAD_NOTIFY_SWITCH
598 bl atomic_notifier_call_chain
599 mov r0, r5
600 ldmia r4, {r4 - sl, fp, sp, pc} @ Load all regs saved previously
603 601
604 __INIT 602 __INIT
605 603
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index bcc19fbb32df..ec20f8935e8b 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -52,7 +52,7 @@
52 */ 52 */
53#define MAX_IRQ_CNT 100000 53#define MAX_IRQ_CNT 100000
54 54
55static int noirqdebug; 55static int noirqdebug __read_mostly;
56static volatile unsigned long irq_err_count; 56static volatile unsigned long irq_err_count;
57static DEFINE_SPINLOCK(irq_controller_lock); 57static DEFINE_SPINLOCK(irq_controller_lock);
58static LIST_HEAD(irq_pending); 58static LIST_HEAD(irq_pending);
@@ -81,7 +81,7 @@ irqreturn_t no_action(int irq, void *dev_id, struct pt_regs *regs)
81 81
82void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) 82void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
83{ 83{
84 irq_err_count += 1; 84 irq_err_count++;
85 printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq); 85 printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq);
86} 86}
87 87
diff --git a/arch/arm/kernel/iwmmxt.S b/arch/arm/kernel/iwmmxt.S
index 24c7b0477a09..af9e0ae952d5 100644
--- a/arch/arm/kernel/iwmmxt.S
+++ b/arch/arm/kernel/iwmmxt.S
@@ -285,7 +285,7 @@ ENTRY(iwmmxt_task_switch)
285 bne 1f @ yes: block them for next task 285 bne 1f @ yes: block them for next task
286 286
287 ldr r5, =concan_owner 287 ldr r5, =concan_owner
288 add r6, r2, #(TI_IWMMXT_STATE - TI_CPU_DOMAIN) @ get next task Concan save area 288 add r6, r2, #TI_IWMMXT_STATE @ get next task Concan save area
289 ldr r5, [r5] @ get current Concan owner 289 ldr r5, [r5] @ get current Concan owner
290 teq r5, r6 @ next task owns it? 290 teq r5, r6 @ next task owns it?
291 movne pc, lr @ no: leave Concan disabled 291 movne pc, lr @ no: leave Concan disabled
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 17c38dbf2f3c..e1c77ee885a7 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -33,6 +33,7 @@
33#include <asm/leds.h> 33#include <asm/leds.h>
34#include <asm/processor.h> 34#include <asm/processor.h>
35#include <asm/system.h> 35#include <asm/system.h>
36#include <asm/thread_notify.h>
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
37#include <asm/mach/time.h> 38#include <asm/mach/time.h>
38 39
@@ -338,13 +339,9 @@ void exit_thread(void)
338{ 339{
339} 340}
340 341
341static void default_fp_init(union fp_state *fp) 342ATOMIC_NOTIFIER_HEAD(thread_notify_head);
342{
343 memset(fp, 0, sizeof(union fp_state));
344}
345 343
346void (*fp_init)(union fp_state *) = default_fp_init; 344EXPORT_SYMBOL_GPL(thread_notify_head);
347EXPORT_SYMBOL(fp_init);
348 345
349void flush_thread(void) 346void flush_thread(void)
350{ 347{
@@ -353,22 +350,21 @@ void flush_thread(void)
353 350
354 memset(thread->used_cp, 0, sizeof(thread->used_cp)); 351 memset(thread->used_cp, 0, sizeof(thread->used_cp));
355 memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); 352 memset(&tsk->thread.debug, 0, sizeof(struct debug_info));
353 memset(&thread->fpstate, 0, sizeof(union fp_state));
354
355 thread_notify(THREAD_NOTIFY_FLUSH, thread);
356#if defined(CONFIG_IWMMXT) 356#if defined(CONFIG_IWMMXT)
357 iwmmxt_task_release(thread); 357 iwmmxt_task_release(thread);
358#endif 358#endif
359 fp_init(&thread->fpstate);
360#if defined(CONFIG_VFP)
361 vfp_flush_thread(&thread->vfpstate);
362#endif
363} 359}
364 360
365void release_thread(struct task_struct *dead_task) 361void release_thread(struct task_struct *dead_task)
366{ 362{
367#if defined(CONFIG_VFP) 363 struct thread_info *thread = task_thread_info(dead_task);
368 vfp_release_thread(&task_thread_info(dead_task)->vfpstate); 364
369#endif 365 thread_notify(THREAD_NOTIFY_RELEASE, thread);
370#if defined(CONFIG_IWMMXT) 366#if defined(CONFIG_IWMMXT)
371 iwmmxt_task_release(task_thread_info(dead_task)); 367 iwmmxt_task_release(thread);
372#endif 368#endif
373} 369}
374 370
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index a0cd0a90a10d..f094277485c8 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -665,17 +665,33 @@ static int do_signal(sigset_t *oldset, struct pt_regs *regs, int syscall)
665 if (syscall) { 665 if (syscall) {
666 if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) { 666 if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) {
667 if (thumb_mode(regs)) { 667 if (thumb_mode(regs)) {
668 regs->ARM_r7 = __NR_restart_syscall; 668 regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE;
669 regs->ARM_pc -= 2; 669 regs->ARM_pc -= 2;
670 } else { 670 } else {
671#if defined(CONFIG_AEABI) && !defined(CONFIG_OABI_COMPAT)
672 regs->ARM_r7 = __NR_restart_syscall;
673 regs->ARM_pc -= 4;
674#else
671 u32 __user *usp; 675 u32 __user *usp;
676 u32 swival = __NR_restart_syscall;
672 677
673 regs->ARM_sp -= 12; 678 regs->ARM_sp -= 12;
674 usp = (u32 __user *)regs->ARM_sp; 679 usp = (u32 __user *)regs->ARM_sp;
675 680
681 /*
682 * Either we supports OABI only, or we have
683 * EABI with the OABI compat layer enabled.
684 * In the later case we don't know if user
685 * space is EABI or not, and if not we must
686 * not clobber r7. Always using the OABI
687 * syscall solves that issue and works for
688 * all those cases.
689 */
690 swival = swival - __NR_SYSCALL_BASE + __NR_OABI_SYSCALL_BASE;
691
676 put_user(regs->ARM_pc, &usp[0]); 692 put_user(regs->ARM_pc, &usp[0]);
677 /* swi __NR_restart_syscall */ 693 /* swi __NR_restart_syscall */
678 put_user(0xef000000 | __NR_restart_syscall, &usp[1]); 694 put_user(0xef000000 | swival, &usp[1]);
679 /* ldr pc, [sp], #12 */ 695 /* ldr pc, [sp], #12 */
680 put_user(0xe49df00c, &usp[2]); 696 put_user(0xe49df00c, &usp[2]);
681 697
@@ -683,6 +699,7 @@ static int do_signal(sigset_t *oldset, struct pt_regs *regs, int syscall)
683 (unsigned long)(usp + 3)); 699 (unsigned long)(usp + 3));
684 700
685 regs->ARM_pc = regs->ARM_sp + 4; 701 regs->ARM_pc = regs->ARM_sp + 4;
702#endif
686 } 703 }
687 } 704 }
688 if (regs->ARM_r0 == -ERESTARTNOHAND || 705 if (regs->ARM_r0 == -ERESTARTNOHAND ||
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index dcd417625389..bf6bd71bdd08 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -103,7 +103,8 @@ static int ep93xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
103 write_seqlock(&xtime_lock); 103 write_seqlock(&xtime_lock);
104 104
105 __raw_writel(1, EP93XX_TIMER1_CLEAR); 105 __raw_writel(1, EP93XX_TIMER1_CLEAR);
106 while (__raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time 106 while ((signed long)
107 (__raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time)
107 >= TIMER4_TICKS_PER_JIFFY) { 108 >= TIMER4_TICKS_PER_JIFFY) {
108 last_jiffy_time += TIMER4_TICKS_PER_JIFFY; 109 last_jiffy_time += TIMER4_TICKS_PER_JIFFY;
109 timer_tick(regs); 110 timer_tick(regs);
@@ -124,7 +125,7 @@ static void __init ep93xx_timer_init(void)
124{ 125{
125 /* Enable periodic HZ timer. */ 126 /* Enable periodic HZ timer. */
126 __raw_writel(0x48, EP93XX_TIMER1_CONTROL); 127 __raw_writel(0x48, EP93XX_TIMER1_CONTROL);
127 __raw_writel((508000 / HZ) - 1, EP93XX_TIMER1_LOAD); 128 __raw_writel((508469 / HZ) - 1, EP93XX_TIMER1_LOAD);
128 __raw_writel(0xc8, EP93XX_TIMER1_CONTROL); 129 __raw_writel(0xc8, EP93XX_TIMER1_CONTROL);
129 130
130 /* Enable lost jiffy timer. */ 131 /* Enable lost jiffy timer. */
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index d18fcb1a2f1b..47cc6c8b7c79 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -16,16 +16,38 @@
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/ioport.h>
19#include <linux/mtd/physmap.h> 20#include <linux/mtd/physmap.h>
21#include <linux/platform_device.h>
20#include <asm/io.h> 22#include <asm/io.h>
21#include <asm/hardware.h> 23#include <asm/hardware.h>
22#include <asm/mach-types.h> 24#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
24 26
27static struct physmap_flash_data gesbc9312_flash_data = {
28 .width = 4,
29};
30
31static struct resource gesbc9312_flash_resource = {
32 .start = 0x60000000,
33 .end = 0x60800000,
34 .flags = IORESOURCE_MEM,
35};
36
37static struct platform_device gesbc9312_flash = {
38 .name = "physmap-flash",
39 .id = 0,
40 .dev = {
41 .platform_data = &gesbc9312_flash_data,
42 },
43 .num_resources = 1,
44 .resource = &gesbc9312_flash_resource,
45};
46
25static void __init gesbc9312_init_machine(void) 47static void __init gesbc9312_init_machine(void)
26{ 48{
27 ep93xx_init_devices(); 49 ep93xx_init_devices();
28 physmap_configure(0x60000000, 0x00800000, 4, NULL); 50 platform_device_register(&gesbc9312_flash);
29} 51}
30 52
31MACHINE_START(GESBC9312, "Glomation GESBC-9312-sx") 53MACHINE_START(GESBC9312, "Glomation GESBC-9312-sx")
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index e24566b88a78..6e5a56cd5ae8 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -16,6 +16,7 @@
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/ioport.h>
19#include <linux/mtd/physmap.h> 20#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/m48t86.h> 22#include <linux/m48t86.h>
@@ -111,6 +112,26 @@ static void __init ts72xx_map_io(void)
111 } 112 }
112} 113}
113 114
115static struct physmap_flash_data ts72xx_flash_data = {
116 .width = 1,
117};
118
119static struct resource ts72xx_flash_resource = {
120 .start = TS72XX_NOR_PHYS_BASE,
121 .end = TS72XX_NOR_PHYS_BASE + 0x01000000,
122 .flags = IORESOURCE_MEM,
123};
124
125static struct platform_device ts72xx_flash = {
126 .name = "physmap-flash",
127 .id = 0,
128 .dev = {
129 .platform_data = &ts72xx_flash_data,
130 },
131 .num_resources = 1,
132 .resource = &ts72xx_flash_resource,
133};
134
114static unsigned char ts72xx_rtc_readbyte(unsigned long addr) 135static unsigned char ts72xx_rtc_readbyte(unsigned long addr)
115{ 136{
116 __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); 137 __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE);
@@ -141,7 +162,7 @@ static void __init ts72xx_init_machine(void)
141{ 162{
142 ep93xx_init_devices(); 163 ep93xx_init_devices();
143 if (board_is_ts7200()) 164 if (board_is_ts7200())
144 physmap_configure(TS72XX_NOR_PHYS_BASE, 0x01000000, 1, NULL); 165 platform_device_register(&ts72xx_flash);
145 platform_device_register(&ts72xx_rtc_device); 166 platform_device_register(&ts72xx_rtc_device);
146} 167}
147 168
diff --git a/arch/arm/mach-imx/dma.c b/arch/arm/mach-imx/dma.c
index 4ca51dcf13ac..36578871ecc8 100644
--- a/arch/arm/mach-imx/dma.c
+++ b/arch/arm/mach-imx/dma.c
@@ -15,6 +15,9 @@
15 * Changed to support scatter gather DMA 15 * Changed to support scatter gather DMA
16 * by taking Russell's code from RiscPC 16 * by taking Russell's code from RiscPC
17 * 17 *
18 * 2006-05-31 Pavel Pisa <pisa@cmp.felk.cvut.cz>
19 * Corrected error handling code.
20 *
18 */ 21 */
19 22
20#undef DEBUG 23#undef DEBUG
@@ -277,7 +280,7 @@ imx_dma_setup_sg(imx_dmach_t dma_ch,
277int 280int
278imx_dma_setup_handlers(imx_dmach_t dma_ch, 281imx_dma_setup_handlers(imx_dmach_t dma_ch,
279 void (*irq_handler) (int, void *, struct pt_regs *), 282 void (*irq_handler) (int, void *, struct pt_regs *),
280 void (*err_handler) (int, void *, struct pt_regs *), 283 void (*err_handler) (int, void *, struct pt_regs *, int),
281 void *data) 284 void *data)
282{ 285{
283 struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch]; 286 struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
@@ -463,43 +466,53 @@ static irqreturn_t dma_err_handler(int irq, void *dev_id, struct pt_regs *regs)
463 int i, disr = DISR; 466 int i, disr = DISR;
464 struct imx_dma_channel *channel; 467 struct imx_dma_channel *channel;
465 unsigned int err_mask = DBTOSR | DRTOSR | DSESR | DBOSR; 468 unsigned int err_mask = DBTOSR | DRTOSR | DSESR | DBOSR;
469 int errcode;
466 470
467 DISR = disr; 471 DISR = disr & err_mask;
468 for (i = 0; i < IMX_DMA_CHANNELS; i++) { 472 for (i = 0; i < IMX_DMA_CHANNELS; i++) {
469 channel = &imx_dma_channels[i]; 473 if(!(err_mask & (1 << i)))
470
471 if ((err_mask & 1 << i) && channel->name
472 && channel->err_handler) {
473 channel->err_handler(i, channel->data, regs);
474 continue; 474 continue;
475 } 475 channel = &imx_dma_channels[i];
476 476 errcode = 0;
477 imx_dma_channels[i].sg = NULL;
478 477
479 if (DBTOSR & (1 << i)) { 478 if (DBTOSR & (1 << i)) {
480 printk(KERN_WARNING 479 DBTOSR = (1 << i);
481 "Burst timeout on channel %d (%s)\n", 480 errcode |= IMX_DMA_ERR_BURST;
482 i, channel->name);
483 DBTOSR |= (1 << i);
484 } 481 }
485 if (DRTOSR & (1 << i)) { 482 if (DRTOSR & (1 << i)) {
486 printk(KERN_WARNING 483 DRTOSR = (1 << i);
487 "Request timeout on channel %d (%s)\n", 484 errcode |= IMX_DMA_ERR_REQUEST;
488 i, channel->name);
489 DRTOSR |= (1 << i);
490 } 485 }
491 if (DSESR & (1 << i)) { 486 if (DSESR & (1 << i)) {
492 printk(KERN_WARNING 487 DSESR = (1 << i);
493 "Transfer timeout on channel %d (%s)\n", 488 errcode |= IMX_DMA_ERR_TRANSFER;
494 i, channel->name);
495 DSESR |= (1 << i);
496 } 489 }
497 if (DBOSR & (1 << i)) { 490 if (DBOSR & (1 << i)) {
498 printk(KERN_WARNING 491 DBOSR = (1 << i);
499 "Buffer overflow timeout on channel %d (%s)\n", 492 errcode |= IMX_DMA_ERR_BUFFER;
500 i, channel->name);
501 DBOSR |= (1 << i);
502 } 493 }
494
495 /*
496 * The cleaning of @sg field would be questionable
497 * there, because its value can help to compute
498 * remaining/transfered bytes count in the handler
499 */
500 /*imx_dma_channels[i].sg = NULL;*/
501
502 if (channel->name && channel->err_handler) {
503 channel->err_handler(i, channel->data, regs, errcode);
504 continue;
505 }
506
507 imx_dma_channels[i].sg = NULL;
508
509 printk(KERN_WARNING
510 "DMA timeout on channel %d (%s) -%s%s%s%s\n",
511 i, channel->name,
512 errcode&IMX_DMA_ERR_BURST? " burst":"",
513 errcode&IMX_DMA_ERR_REQUEST? " request":"",
514 errcode&IMX_DMA_ERR_TRANSFER? " transfer":"",
515 errcode&IMX_DMA_ERR_BUFFER? " buffer":"");
503 } 516 }
504 return IRQ_HANDLED; 517 return IRQ_HANDLED;
505} 518}
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 6e8d504aca55..186f632035b8 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -211,7 +211,8 @@ static int ixp2000_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
211 /* clear timer 1 */ 211 /* clear timer 1 */
212 ixp2000_reg_wrb(IXP2000_T1_CLR, 1); 212 ixp2000_reg_wrb(IXP2000_T1_CLR, 1);
213 213
214 while ((next_jiffy_time - *missing_jiffy_timer_csr) > ticks_per_jiffy) { 214 while ((signed long)(next_jiffy_time - *missing_jiffy_timer_csr)
215 >= ticks_per_jiffy) {
215 timer_tick(regs); 216 timer_tick(regs);
216 next_jiffy_time -= ticks_per_jiffy; 217 next_jiffy_time -= ticks_per_jiffy;
217 } 218 }
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index affd1d5d7440..051e3d70026e 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -334,7 +334,7 @@ void __init ixp23xx_init_irq(void)
334/************************************************************************* 334/*************************************************************************
335 * Timer-tick functions for IXP23xx 335 * Timer-tick functions for IXP23xx
336 *************************************************************************/ 336 *************************************************************************/
337#define CLOCK_TICKS_PER_USEC CLOCK_TICK_RATE / (USEC_PER_SEC) 337#define CLOCK_TICKS_PER_USEC (CLOCK_TICK_RATE / USEC_PER_SEC)
338 338
339static unsigned long next_jiffy_time; 339static unsigned long next_jiffy_time;
340 340
@@ -353,7 +353,7 @@ ixp23xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
353{ 353{
354 /* Clear Pending Interrupt by writing '1' to it */ 354 /* Clear Pending Interrupt by writing '1' to it */
355 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND; 355 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND;
356 while ((*IXP23XX_TIMER_CONT - next_jiffy_time) > LATCH) { 356 while ((signed long)(*IXP23XX_TIMER_CONT - next_jiffy_time) >= LATCH) {
357 timer_tick(regs); 357 timer_tick(regs);
358 next_jiffy_time += LATCH; 358 next_jiffy_time += LATCH;
359 } 359 }
@@ -439,5 +439,6 @@ static struct platform_device *ixp23xx_devices[] __initdata = {
439 439
440void __init ixp23xx_sys_init(void) 440void __init ixp23xx_sys_init(void)
441{ 441{
442 *IXP23XX_EXP_UNIT_FUSE |= 0xf;
442 platform_add_devices(ixp23xx_devices, ARRAY_SIZE(ixp23xx_devices)); 443 platform_add_devices(ixp23xx_devices, ARRAY_SIZE(ixp23xx_devices));
443} 444}
diff --git a/arch/arm/mach-ixp23xx/espresso.c b/arch/arm/mach-ixp23xx/espresso.c
index bf688c128630..dc5e489c70bc 100644
--- a/arch/arm/mach-ixp23xx/espresso.c
+++ b/arch/arm/mach-ixp23xx/espresso.c
@@ -53,9 +53,29 @@ static int __init espresso_pci_init(void)
53}; 53};
54subsys_initcall(espresso_pci_init); 54subsys_initcall(espresso_pci_init);
55 55
56static struct physmap_flash_data espresso_flash_data = {
57 .width = 2,
58};
59
60static struct resource espresso_flash_resource = {
61 .start = 0x90000000,
62 .end = 0x92000000,
63 .flags = IORESOURCE_MEM,
64};
65
66static struct platform_device espresso_flash = {
67 .name = "physmap-flash",
68 .id = 0,
69 .dev = {
70 .platform_data = &espresso_flash_data,
71 },
72 .num_resources = 1,
73 .resource = &espresso_flash_resource,
74};
75
56static void __init espresso_init(void) 76static void __init espresso_init(void)
57{ 77{
58 physmap_configure(0x90000000, 0x02000000, 2, NULL); 78 platform_device_register(&espresso_flash);
59 79
60 /* 80 /*
61 * Mark flash as writeable. 81 * Mark flash as writeable.
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
index 00146c35daac..535b334ee045 100644
--- a/arch/arm/mach-ixp23xx/ixdp2351.c
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -298,9 +298,29 @@ static void __init ixdp2351_map_io(void)
298 iotable_init(ixdp2351_io_desc, ARRAY_SIZE(ixdp2351_io_desc)); 298 iotable_init(ixdp2351_io_desc, ARRAY_SIZE(ixdp2351_io_desc));
299} 299}
300 300
301static struct physmap_flash_data ixdp2351_flash_data = {
302 .width = 1,
303};
304
305static struct resource ixdp2351_flash_resource = {
306 .start = 0x90000000,
307 .end = 0x94000000,
308 .flags = IORESOURCE_MEM,
309};
310
311static struct platform_device ixdp2351_flash = {
312 .name = "physmap-flash",
313 .id = 0,
314 .dev = {
315 .platform_data = &ixdp2351_flash_data,
316 },
317 .num_resources = 1,
318 .resource = &ixdp2351_flash_resource,
319};
320
301static void __init ixdp2351_init(void) 321static void __init ixdp2351_init(void)
302{ 322{
303 physmap_configure(0x90000000, 0x04000000, 1, NULL); 323 platform_device_register(&ixdp2351_flash);
304 324
305 /* 325 /*
306 * Mark flash as writeable 326 * Mark flash as writeable
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
index 43c14e740794..b9f5d13fcfe1 100644
--- a/arch/arm/mach-ixp23xx/roadrunner.c
+++ b/arch/arm/mach-ixp23xx/roadrunner.c
@@ -137,9 +137,29 @@ static int __init roadrunner_pci_init(void)
137 137
138subsys_initcall(roadrunner_pci_init); 138subsys_initcall(roadrunner_pci_init);
139 139
140static struct physmap_flash_data roadrunner_flash_data = {
141 .width = 2,
142};
143
144static struct resource roadrunner_flash_resource = {
145 .start = 0x90000000,
146 .end = 0x94000000,
147 .flags = IORESOURCE_MEM,
148};
149
150static struct platform_device roadrunner_flash = {
151 .name = "physmap-flash",
152 .id = 0,
153 .dev = {
154 .platform_data = &roadrunner_flash_data,
155 },
156 .num_resources = 1,
157 .resource = &roadrunner_flash_resource,
158};
159
140static void __init roadrunner_init(void) 160static void __init roadrunner_init(void)
141{ 161{
142 physmap_configure(0x90000000, 0x04000000, 2, NULL); 162 platform_device_register(&roadrunner_flash);
143 163
144 /* 164 /*
145 * Mark flash as writeable 165 * Mark flash as writeable
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 00b761ff0f9c..bf25a76e9bdf 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -276,7 +276,7 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id, struct pt_regs
276 /* 276 /*
277 * Catch up with the real idea of time 277 * Catch up with the real idea of time
278 */ 278 */
279 while ((*IXP4XX_OSTS - last_jiffy_time) > LATCH) { 279 while ((signed long)(*IXP4XX_OSTS - last_jiffy_time) >= LATCH) {
280 timer_tick(regs); 280 timer_tick(regs);
281 last_jiffy_time += LATCH; 281 last_jiffy_time += LATCH;
282 } 282 }
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index a3b4c6ac5708..9a31444d9214 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/serial.h> 16#include <linux/serial.h>
17#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
18#include <linux/leds.h>
18 19
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
@@ -37,6 +38,36 @@ static struct platform_device nas100d_flash = {
37 .resource = &nas100d_flash_resource, 38 .resource = &nas100d_flash_resource,
38}; 39};
39 40
41#ifdef CONFIG_LEDS_IXP4XX
42static struct resource nas100d_led_resources[] = {
43 {
44 .name = "wlan", /* green led */
45 .start = 0,
46 .end = 0,
47 .flags = IXP4XX_GPIO_LOW,
48 },
49 {
50 .name = "ready", /* blue power led (off is flashing!) */
51 .start = 15,
52 .end = 15,
53 .flags = IXP4XX_GPIO_LOW,
54 },
55 {
56 .name = "disk", /* yellow led */
57 .start = 3,
58 .end = 3,
59 .flags = IXP4XX_GPIO_LOW,
60 },
61};
62
63static struct platform_device nas100d_leds = {
64 .name = "IXP4XX-GPIO-LED",
65 .id = -1,
66 .num_resources = ARRAY_SIZE(nas100d_led_resources),
67 .resource = nas100d_led_resources,
68};
69#endif
70
40static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = { 71static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
41 .sda_pin = NAS100D_SDA_PIN, 72 .sda_pin = NAS100D_SDA_PIN,
42 .scl_pin = NAS100D_SCL_PIN, 73 .scl_pin = NAS100D_SCL_PIN,
@@ -95,7 +126,9 @@ static struct platform_device nas100d_uart = {
95static struct platform_device *nas100d_devices[] __initdata = { 126static struct platform_device *nas100d_devices[] __initdata = {
96 &nas100d_i2c_controller, 127 &nas100d_i2c_controller,
97 &nas100d_flash, 128 &nas100d_flash,
98 &nas100d_uart, 129#ifdef CONFIG_LEDS_IXP4XX
130 &nas100d_leds,
131#endif
99}; 132};
100 133
101static void nas100d_power_off(void) 134static void nas100d_power_off(void)
@@ -122,6 +155,12 @@ static void __init nas100d_init(void)
122 155
123 pm_power_off = nas100d_power_off; 156 pm_power_off = nas100d_power_off;
124 157
158 /* This is only useful on a modified machine, but it is valuable
159 * to have it first in order to see debug messages, and so that
160 * it does *not* get removed if platform_add_devices fails!
161 */
162 (void)platform_device_register(&nas100d_uart);
163
125 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); 164 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
126} 165}
127 166
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 55411f21d838..749a337494d3 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -7,6 +7,7 @@
7 * Copyright (C) 2003-2004 MontaVista Software, Inc. 7 * Copyright (C) 2003-2004 MontaVista Software, Inc.
8 * 8 *
9 * Author: Mark Rakes <mrakes at mac.com> 9 * Author: Mark Rakes <mrakes at mac.com>
10 * Author: Rod Whitby <rod@whitby.id.au>
10 * Maintainers: http://www.nslu2-linux.org/ 11 * Maintainers: http://www.nslu2-linux.org/
11 * 12 *
12 * Fixed missing init_time in MACHINE_START kas11 10/22/04 13 * Fixed missing init_time in MACHINE_START kas11 10/22/04
@@ -16,6 +17,7 @@
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/serial.h> 18#include <linux/serial.h>
18#include <linux/serial_8250.h> 19#include <linux/serial_8250.h>
20#include <linux/leds.h>
19 21
20#include <asm/mach-types.h> 22#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
@@ -43,6 +45,42 @@ static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = {
43 .scl_pin = NSLU2_SCL_PIN, 45 .scl_pin = NSLU2_SCL_PIN,
44}; 46};
45 47
48#ifdef CONFIG_LEDS_IXP4XX
49static struct resource nslu2_led_resources[] = {
50 {
51 .name = "ready", /* green led */
52 .start = NSLU2_LED_GRN,
53 .end = NSLU2_LED_GRN,
54 .flags = IXP4XX_GPIO_HIGH,
55 },
56 {
57 .name = "status", /* red led */
58 .start = NSLU2_LED_RED,
59 .end = NSLU2_LED_RED,
60 .flags = IXP4XX_GPIO_HIGH,
61 },
62 {
63 .name = "disk-1",
64 .start = NSLU2_LED_DISK1,
65 .end = NSLU2_LED_DISK1,
66 .flags = IXP4XX_GPIO_LOW,
67 },
68 {
69 .name = "disk-2",
70 .start = NSLU2_LED_DISK2,
71 .end = NSLU2_LED_DISK2,
72 .flags = IXP4XX_GPIO_LOW,
73 },
74};
75
76static struct platform_device nslu2_leds = {
77 .name = "IXP4XX-GPIO-LED",
78 .id = -1,
79 .num_resources = ARRAY_SIZE(nslu2_led_resources),
80 .resource = nslu2_led_resources,
81};
82#endif
83
46static struct platform_device nslu2_i2c_controller = { 84static struct platform_device nslu2_i2c_controller = {
47 .name = "IXP4XX-I2C", 85 .name = "IXP4XX-I2C",
48 .id = 0, 86 .id = 0,
@@ -102,8 +140,10 @@ static struct platform_device nslu2_uart = {
102static struct platform_device *nslu2_devices[] __initdata = { 140static struct platform_device *nslu2_devices[] __initdata = {
103 &nslu2_i2c_controller, 141 &nslu2_i2c_controller,
104 &nslu2_flash, 142 &nslu2_flash,
105 &nslu2_uart,
106 &nslu2_beeper, 143 &nslu2_beeper,
144#ifdef CONFIG_LEDS_IXP4XX
145 &nslu2_leds,
146#endif
107}; 147};
108 148
109static void nslu2_power_off(void) 149static void nslu2_power_off(void)
@@ -127,6 +167,12 @@ static void __init nslu2_init(void)
127 167
128 pm_power_off = nslu2_power_off; 168 pm_power_off = nslu2_power_off;
129 169
170 /* This is only useful on a modified machine, but it is valuable
171 * to have it first in order to see debug messages, and so that
172 * it does *not* get removed if platform_add_devices fails!
173 */
174 (void)platform_device_register(&nslu2_uart);
175
130 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); 176 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
131} 177}
132 178
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 6178f046f128..73df32aac4c4 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -84,6 +84,15 @@ static struct omap_board_config_kernel ams_delta_config[] = {
84 { OMAP_TAG_UART, &ams_delta_uart_config }, 84 { OMAP_TAG_UART, &ams_delta_uart_config },
85}; 85};
86 86
87static struct platform_device ams_delta_led_device = {
88 .name = "ams-delta-led",
89 .id = -1
90};
91
92static struct platform_device *ams_delta_devices[] __initdata = {
93 &ams_delta_led_device,
94};
95
87static void __init ams_delta_init(void) 96static void __init ams_delta_init(void)
88{ 97{
89 iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc)); 98 iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
@@ -94,6 +103,8 @@ static void __init ams_delta_init(void)
94 103
95 /* Clear latch2 (NAND, LCD, modem enable) */ 104 /* Clear latch2 (NAND, LCD, modem enable) */
96 ams_delta_latch2_write(~0, 0); 105 ams_delta_latch2_write(~0, 0);
106
107 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
97} 108}
98 109
99static void __init ams_delta_map_io(void) 110static void __init ams_delta_map_io(void)
diff --git a/arch/arm/mach-pnx4008/clock.c b/arch/arm/mach-pnx4008/clock.c
index 285b22f631e9..f582ed2ec43c 100644
--- a/arch/arm/mach-pnx4008/clock.c
+++ b/arch/arm/mach-pnx4008/clock.c
@@ -767,6 +767,54 @@ static struct clk *onchip_clks[] = {
767 &uart6_ck, 767 &uart6_ck,
768}; 768};
769 769
770static int local_clk_enable(struct clk *clk)
771{
772 int ret = 0;
773
774 if (!(clk->flags & FIXED_RATE) && !clk->rate && clk->set_rate
775 && clk->user_rate)
776 ret = clk->set_rate(clk, clk->user_rate);
777 return ret;
778}
779
780static void local_clk_disable(struct clk *clk)
781{
782 if (!(clk->flags & FIXED_RATE) && clk->rate && clk->set_rate)
783 clk->set_rate(clk, 0);
784}
785
786static void local_clk_unuse(struct clk *clk)
787{
788 if (clk->usecount > 0 && !(--clk->usecount)) {
789 local_clk_disable(clk);
790 if (clk->parent)
791 local_clk_unuse(clk->parent);
792 }
793}
794
795static int local_clk_use(struct clk *clk)
796{
797 int ret = 0;
798 if (clk->usecount++ == 0) {
799 if (clk->parent)
800 ret = local_clk_use(clk->parent);
801
802 if (ret != 0) {
803 clk->usecount--;
804 goto out;
805 }
806
807 ret = local_clk_enable(clk);
808
809 if (ret != 0 && clk->parent) {
810 local_clk_unuse(clk->parent);
811 clk->usecount--;
812 }
813 }
814out:
815 return ret;
816}
817
770static int local_set_rate(struct clk *clk, u32 rate) 818static int local_set_rate(struct clk *clk, u32 rate)
771{ 819{
772 int ret = -EINVAL; 820 int ret = -EINVAL;
@@ -847,28 +895,12 @@ unsigned long clk_get_rate(struct clk *clk)
847} 895}
848EXPORT_SYMBOL(clk_get_rate); 896EXPORT_SYMBOL(clk_get_rate);
849 897
850static int local_clk_enable(struct clk *clk)
851{
852 int ret = 0;
853
854 if (!(clk->flags & FIXED_RATE) && !clk->rate && clk->set_rate
855 && clk->user_rate)
856 ret = clk->set_rate(clk, clk->user_rate);
857 return ret;
858}
859
860static void local_clk_disable(struct clk *clk)
861{
862 if (!(clk->flags & FIXED_RATE) && clk->rate && clk->set_rate)
863 clk->set_rate(clk, 0);
864}
865
866int clk_enable(struct clk *clk) 898int clk_enable(struct clk *clk)
867{ 899{
868 int ret = 0; 900 int ret = 0;
869 901
870 clock_lock(); 902 clock_lock();
871 ret = local_clk_enable(clk); 903 ret = local_clk_use(clk);
872 clock_unlock(); 904 clock_unlock();
873 return ret; 905 return ret;
874} 906}
@@ -878,70 +910,11 @@ EXPORT_SYMBOL(clk_enable);
878void clk_disable(struct clk *clk) 910void clk_disable(struct clk *clk)
879{ 911{
880 clock_lock(); 912 clock_lock();
881 local_clk_disable(clk);
882 clock_unlock();
883}
884
885EXPORT_SYMBOL(clk_disable);
886
887static void local_clk_unuse(struct clk *clk)
888{
889 if (clk->usecount > 0 && !(--clk->usecount)) {
890 local_clk_disable(clk);
891 if (clk->parent)
892 local_clk_unuse(clk->parent);
893 }
894}
895
896static int local_clk_use(struct clk *clk)
897{
898 int ret = 0;
899 if (clk->usecount++ == 0) {
900 if (clk->parent)
901 ret = local_clk_use(clk->parent);
902
903 if (ret != 0) {
904 clk->usecount--;
905 goto out;
906 }
907
908 ret = local_clk_enable(clk);
909
910 if (ret != 0 && clk->parent) {
911 local_clk_unuse(clk->parent);
912 clk->usecount--;
913 }
914 }
915out:
916 return ret;
917}
918
919/* The main purpose of clk_use ans clk_unuse functions
920 * is to control switching 13MHz oscillator and PLL1 (13'MHz),
921 * so that they are disabled whenever none of PLL2-5 is using them.
922 * Although in theory these functions should work with any clock,
923 * please use them only on PLL2 - PLL5 to avoid confusion.
924 */
925int clk_use(struct clk *clk)
926{
927 int ret = 0;
928
929 clock_lock();
930 ret = local_clk_use(clk);
931 clock_unlock();
932 return ret;
933}
934EXPORT_SYMBOL(clk_use);
935
936void clk_unuse(struct clk *clk)
937{
938
939 clock_lock();
940 local_clk_unuse(clk); 913 local_clk_unuse(clk);
941 clock_unlock(); 914 clock_unlock();
942} 915}
943 916
944EXPORT_SYMBOL(clk_unuse); 917EXPORT_SYMBOL(clk_disable);
945 918
946long clk_round_rate(struct clk *clk, unsigned long rate) 919long clk_round_rate(struct clk *clk, unsigned long rate)
947{ 920{
@@ -995,7 +968,7 @@ static int __init clk_init(void)
995 __FUNCTION__, (*clkp)->name, (*clkp)->rate); 968 __FUNCTION__, (*clkp)->name, (*clkp)->rate);
996 } 969 }
997 970
998 clk_use(&ck_pll4); 971 local_clk_use(&ck_pll4);
999 972
1000 /* if ck_13MHz is not used, disable it. */ 973 /* if ck_13MHz is not used, disable it. */
1001 if (ck_13MHz.usecount == 0) 974 if (ck_13MHz.usecount == 0)
diff --git a/arch/arm/mach-pnx4008/serial.c b/arch/arm/mach-pnx4008/serial.c
index 10322384e45d..95a1b3f964a2 100644
--- a/arch/arm/mach-pnx4008/serial.c
+++ b/arch/arm/mach-pnx4008/serial.c
@@ -20,7 +20,7 @@
20 20
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/serial_reg.h> 22#include <linux/serial_reg.h>
23#include <asm/arch/pm.h> 23#include <asm/arch/gpio.h>
24 24
25#include <asm/arch/clock.h> 25#include <asm/arch/clock.h>
26 26
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index 0c334136db7c..7b786d725636 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -114,9 +114,15 @@ config MACH_NEXCODER_2440
114 114
115endmenu 115endmenu
116 116
117config S3C2410_CLOCK
118 bool
119 help
120 Clock code for the S3C2410, and similar processors
121
117config CPU_S3C2410 122config CPU_S3C2410
118 bool 123 bool
119 depends on ARCH_S3C2410 124 depends on ARCH_S3C2410
125 select S3C2410_CLOCK
120 help 126 help
121 Support for S3C2410 and S3C2410A family from the S3C24XX line 127 Support for S3C2410 and S3C2410A family from the S3C24XX line
122 of Samsung Mobile CPUs. 128 of Samsung Mobile CPUs.
@@ -130,6 +136,7 @@ config CPU_S3C244X
130config CPU_S3C2440 136config CPU_S3C2440
131 bool 137 bool
132 depends on ARCH_S3C2410 138 depends on ARCH_S3C2410
139 select S3C2410_CLOCK
133 select CPU_S3C244X 140 select CPU_S3C244X
134 help 141 help
135 Support for S3C2440 Samsung Mobile CPU based systems. 142 Support for S3C2440 Samsung Mobile CPU based systems.
@@ -137,6 +144,7 @@ config CPU_S3C2440
137config CPU_S3C2442 144config CPU_S3C2442
138 bool 145 bool
139 depends on ARCH_S3C2420 146 depends on ARCH_S3C2420
147 select S3C2410_CLOCK
140 select CPU_S3C244X 148 select CPU_S3C244X
141 help 149 help
142 Support for S3C2442 Samsung Mobile CPU based systems. 150 Support for S3C2442 Samsung Mobile CPU based systems.
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index 5e09355cd4f4..372dbcea1434 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -29,6 +29,10 @@ obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
29obj-$(CONFIG_CPU_S3C244X) += s3c244x.o 29obj-$(CONFIG_CPU_S3C244X) += s3c244x.o
30obj-$(CONFIG_CPU_S3C244X) += s3c244x-irq.o 30obj-$(CONFIG_CPU_S3C244X) += s3c244x-irq.o
31 31
32# Clock control
33
34obj-$(CONFIG_S3C2410_CLOCK) += s3c2410-clock.o
35
32# S3C2440 support 36# S3C2440 support
33 37
34obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o 38obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index 99d174612b53..c5c93c333ac6 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -3,7 +3,7 @@
3 * Copyright (c) 2004-2005 Simtec Electronics 3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * S3C2410 Clock control support 6 * S3C24XX Core clock control support
7 * 7 *
8 * Based on, and code from linux/arch/arm/mach-versatile/clock.c 8 * Based on, and code from linux/arch/arm/mach-versatile/clock.c
9 ** 9 **
@@ -56,25 +56,6 @@ static LIST_HEAD(clocks);
56 56
57DEFINE_MUTEX(clocks_mutex); 57DEFINE_MUTEX(clocks_mutex);
58 58
59/* old functions */
60
61void inline s3c24xx_clk_enable(unsigned int clocks, unsigned int enable)
62{
63 unsigned long clkcon;
64
65 clkcon = __raw_readl(S3C2410_CLKCON);
66
67 if (enable)
68 clkcon |= clocks;
69 else
70 clkcon &= ~clocks;
71
72 /* ensure none of the special function bits set */
73 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER | 3);
74
75 __raw_writel(clkcon, S3C2410_CLKCON);
76}
77
78/* enable and disable calls for use with the clk struct */ 59/* enable and disable calls for use with the clk struct */
79 60
80static int clk_null_enable(struct clk *clk, int enable) 61static int clk_null_enable(struct clk *clk, int enable)
@@ -82,12 +63,6 @@ static int clk_null_enable(struct clk *clk, int enable)
82 return 0; 63 return 0;
83} 64}
84 65
85int s3c24xx_clkcon_enable(struct clk *clk, int enable)
86{
87 s3c24xx_clk_enable(clk->ctrlbit, enable);
88 return 0;
89}
90
91/* Clock API calls */ 66/* Clock API calls */
92 67
93struct clk *clk_get(struct device *dev, const char *id) 68struct clk *clk_get(struct device *dev, const char *id)
@@ -173,8 +148,11 @@ unsigned long clk_get_rate(struct clk *clk)
173 if (clk->rate != 0) 148 if (clk->rate != 0)
174 return clk->rate; 149 return clk->rate;
175 150
176 while (clk->parent != NULL && clk->rate == 0) 151 if (clk->get_rate != NULL)
177 clk = clk->parent; 152 return (clk->get_rate)(clk);
153
154 if (clk->parent != NULL)
155 return clk_get_rate(clk->parent);
178 156
179 return clk->rate; 157 return clk->rate;
180} 158}
@@ -233,28 +211,6 @@ EXPORT_SYMBOL(clk_set_rate);
233EXPORT_SYMBOL(clk_get_parent); 211EXPORT_SYMBOL(clk_get_parent);
234EXPORT_SYMBOL(clk_set_parent); 212EXPORT_SYMBOL(clk_set_parent);
235 213
236/* base clock enable */
237
238static int s3c24xx_upll_enable(struct clk *clk, int enable)
239{
240 unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
241 unsigned long orig = clkslow;
242
243 if (enable)
244 clkslow &= ~S3C2410_CLKSLOW_UCLK_OFF;
245 else
246 clkslow |= S3C2410_CLKSLOW_UCLK_OFF;
247
248 __raw_writel(clkslow, S3C2410_CLKSLOW);
249
250 /* if we started the UPLL, then allow to settle */
251
252 if (enable && (orig & S3C2410_CLKSLOW_UCLK_OFF))
253 udelay(200);
254
255 return 0;
256}
257
258/* base clocks */ 214/* base clocks */
259 215
260static struct clk clk_xtal = { 216static struct clk clk_xtal = {
@@ -265,15 +221,14 @@ static struct clk clk_xtal = {
265 .ctrlbit = 0, 221 .ctrlbit = 0,
266}; 222};
267 223
268static struct clk clk_upll = { 224struct clk clk_upll = {
269 .name = "upll", 225 .name = "upll",
270 .id = -1, 226 .id = -1,
271 .parent = NULL, 227 .parent = NULL,
272 .enable = s3c24xx_upll_enable,
273 .ctrlbit = 0, 228 .ctrlbit = 0,
274}; 229};
275 230
276static struct clk clk_f = { 231struct clk clk_f = {
277 .name = "fclk", 232 .name = "fclk",
278 .id = -1, 233 .id = -1,
279 .rate = 0, 234 .rate = 0,
@@ -281,7 +236,7 @@ static struct clk clk_f = {
281 .ctrlbit = 0, 236 .ctrlbit = 0,
282}; 237};
283 238
284static struct clk clk_h = { 239struct clk clk_h = {
285 .name = "hclk", 240 .name = "hclk",
286 .id = -1, 241 .id = -1,
287 .rate = 0, 242 .rate = 0,
@@ -289,7 +244,7 @@ static struct clk clk_h = {
289 .ctrlbit = 0, 244 .ctrlbit = 0,
290}; 245};
291 246
292static struct clk clk_p = { 247struct clk clk_p = {
293 .name = "pclk", 248 .name = "pclk",
294 .id = -1, 249 .id = -1,
295 .rate = 0, 250 .rate = 0,
@@ -426,108 +381,6 @@ struct clk s3c24xx_uclk = {
426 .id = -1, 381 .id = -1,
427}; 382};
428 383
429
430/* standard clock definitions */
431
432static struct clk init_clocks[] = {
433 {
434 .name = "nand",
435 .id = -1,
436 .parent = &clk_h,
437 .enable = s3c24xx_clkcon_enable,
438 .ctrlbit = S3C2410_CLKCON_NAND,
439 }, {
440 .name = "lcd",
441 .id = -1,
442 .parent = &clk_h,
443 .enable = s3c24xx_clkcon_enable,
444 .ctrlbit = S3C2410_CLKCON_LCDC,
445 }, {
446 .name = "usb-host",
447 .id = -1,
448 .parent = &clk_h,
449 .enable = s3c24xx_clkcon_enable,
450 .ctrlbit = S3C2410_CLKCON_USBH,
451 }, {
452 .name = "usb-device",
453 .id = -1,
454 .parent = &clk_h,
455 .enable = s3c24xx_clkcon_enable,
456 .ctrlbit = S3C2410_CLKCON_USBD,
457 }, {
458 .name = "timers",
459 .id = -1,
460 .parent = &clk_p,
461 .enable = s3c24xx_clkcon_enable,
462 .ctrlbit = S3C2410_CLKCON_PWMT,
463 }, {
464 .name = "sdi",
465 .id = -1,
466 .parent = &clk_p,
467 .enable = s3c24xx_clkcon_enable,
468 .ctrlbit = S3C2410_CLKCON_SDI,
469 }, {
470 .name = "uart",
471 .id = 0,
472 .parent = &clk_p,
473 .enable = s3c24xx_clkcon_enable,
474 .ctrlbit = S3C2410_CLKCON_UART0,
475 }, {
476 .name = "uart",
477 .id = 1,
478 .parent = &clk_p,
479 .enable = s3c24xx_clkcon_enable,
480 .ctrlbit = S3C2410_CLKCON_UART1,
481 }, {
482 .name = "uart",
483 .id = 2,
484 .parent = &clk_p,
485 .enable = s3c24xx_clkcon_enable,
486 .ctrlbit = S3C2410_CLKCON_UART2,
487 }, {
488 .name = "gpio",
489 .id = -1,
490 .parent = &clk_p,
491 .enable = s3c24xx_clkcon_enable,
492 .ctrlbit = S3C2410_CLKCON_GPIO,
493 }, {
494 .name = "rtc",
495 .id = -1,
496 .parent = &clk_p,
497 .enable = s3c24xx_clkcon_enable,
498 .ctrlbit = S3C2410_CLKCON_RTC,
499 }, {
500 .name = "adc",
501 .id = -1,
502 .parent = &clk_p,
503 .enable = s3c24xx_clkcon_enable,
504 .ctrlbit = S3C2410_CLKCON_ADC,
505 }, {
506 .name = "i2c",
507 .id = -1,
508 .parent = &clk_p,
509 .enable = s3c24xx_clkcon_enable,
510 .ctrlbit = S3C2410_CLKCON_IIC,
511 }, {
512 .name = "iis",
513 .id = -1,
514 .parent = &clk_p,
515 .enable = s3c24xx_clkcon_enable,
516 .ctrlbit = S3C2410_CLKCON_IIS,
517 }, {
518 .name = "spi",
519 .id = -1,
520 .parent = &clk_p,
521 .enable = s3c24xx_clkcon_enable,
522 .ctrlbit = S3C2410_CLKCON_SPI,
523 }, {
524 .name = "watchdog",
525 .id = -1,
526 .parent = &clk_p,
527 .ctrlbit = 0,
528 }
529};
530
531/* initialise the clock system */ 384/* initialise the clock system */
532 385
533int s3c24xx_register_clock(struct clk *clk) 386int s3c24xx_register_clock(struct clk *clk)
@@ -537,14 +390,6 @@ int s3c24xx_register_clock(struct clk *clk)
537 if (clk->enable == NULL) 390 if (clk->enable == NULL)
538 clk->enable = clk_null_enable; 391 clk->enable = clk_null_enable;
539 392
540 /* if this is a standard clock, set the usage state */
541
542 if (clk->ctrlbit && clk->enable == s3c24xx_clkcon_enable) {
543 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
544
545 clk->usage = (clkcon & clk->ctrlbit) ? 1 : 0;
546 }
547
548 /* add to the list of available clocks */ 393 /* add to the list of available clocks */
549 394
550 mutex_lock(&clocks_mutex); 395 mutex_lock(&clocks_mutex);
@@ -561,44 +406,17 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
561 unsigned long hclk, 406 unsigned long hclk,
562 unsigned long pclk) 407 unsigned long pclk)
563{ 408{
564 unsigned long upllcon = __raw_readl(S3C2410_UPLLCON); 409 printk(KERN_INFO "S3C24XX Clocks, (c) 2004 Simtec Electronics\n");
565 unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
566 struct clk *clkp = init_clocks;
567 int ptr;
568 int ret;
569
570 printk(KERN_INFO "S3C2410 Clocks, (c) 2004 Simtec Electronics\n");
571 410
572 /* initialise the main system clocks */ 411 /* initialise the main system clocks */
573 412
574 clk_xtal.rate = xtal; 413 clk_xtal.rate = xtal;
575 clk_upll.rate = s3c2410_get_pll(upllcon, xtal); 414 clk_upll.rate = s3c2410_get_pll(__raw_readl(S3C2410_UPLLCON), xtal);
576 415
577 clk_h.rate = hclk; 416 clk_h.rate = hclk;
578 clk_p.rate = pclk; 417 clk_p.rate = pclk;
579 clk_f.rate = fclk; 418 clk_f.rate = fclk;
580 419
581 /* We must be careful disabling the clocks we are not intending to
582 * be using at boot time, as subsytems such as the LCD which do
583 * their own DMA requests to the bus can cause the system to lockup
584 * if they where in the middle of requesting bus access.
585 *
586 * Disabling the LCD clock if the LCD is active is very dangerous,
587 * and therefore the bootloader should be careful to not enable
588 * the LCD clock if it is not needed.
589 */
590
591 mutex_lock(&clocks_mutex);
592
593 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0);
594 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0);
595 s3c24xx_clk_enable(S3C2410_CLKCON_USBD, 0);
596 s3c24xx_clk_enable(S3C2410_CLKCON_ADC, 0);
597 s3c24xx_clk_enable(S3C2410_CLKCON_IIC, 0);
598 s3c24xx_clk_enable(S3C2410_CLKCON_SPI, 0);
599
600 mutex_unlock(&clocks_mutex);
601
602 /* assume uart clocks are correctly setup */ 420 /* assume uart clocks are correctly setup */
603 421
604 /* register our clocks */ 422 /* register our clocks */
@@ -618,27 +436,5 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
618 if (s3c24xx_register_clock(&clk_p) < 0) 436 if (s3c24xx_register_clock(&clk_p) < 0)
619 printk(KERN_ERR "failed to register cpu pclk\n"); 437 printk(KERN_ERR "failed to register cpu pclk\n");
620 438
621
622 if (s3c24xx_register_clock(&clk_usb_bus) < 0)
623 printk(KERN_ERR "failed to register usb bus clock\n");
624
625 /* register clocks from clock array */
626
627 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
628 ret = s3c24xx_register_clock(clkp);
629 if (ret < 0) {
630 printk(KERN_ERR "Failed to register clock %s (%d)\n",
631 clkp->name, ret);
632 }
633 }
634
635 /* show the clock-slow value */
636
637 printk("CLOCK: Slow mode (%ld.%ld MHz), %s, MPLL %s, UPLL %s\n",
638 print_mhz(xtal / ( 2 * S3C2410_CLKSLOW_GET_SLOWVAL(clkslow))),
639 (clkslow & S3C2410_CLKSLOW_SLOW) ? "slow" : "fast",
640 (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on",
641 (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on");
642
643 return 0; 439 return 0;
644} 440}
diff --git a/arch/arm/mach-s3c2410/clock.h b/arch/arm/mach-s3c2410/clock.h
index 01bb458bf8eb..9456c81eb5d3 100644
--- a/arch/arm/mach-s3c2410/clock.h
+++ b/arch/arm/mach-s3c2410/clock.h
@@ -22,6 +22,7 @@ struct clk {
22 22
23 int (*enable)(struct clk *, int enable); 23 int (*enable)(struct clk *, int enable);
24 int (*set_rate)(struct clk *c, unsigned long rate); 24 int (*set_rate)(struct clk *c, unsigned long rate);
25 unsigned long (*get_rate)(struct clk *c);
25 unsigned long (*round_rate)(struct clk *c, unsigned long rate); 26 unsigned long (*round_rate)(struct clk *c, unsigned long rate);
26 int (*set_parent)(struct clk *c, struct clk *parent); 27 int (*set_parent)(struct clk *c, struct clk *parent);
27}; 28};
@@ -36,6 +37,13 @@ extern struct clk s3c24xx_uclk;
36 37
37extern struct clk clk_usb_bus; 38extern struct clk clk_usb_bus;
38 39
40/* core clock support */
41
42extern struct clk clk_f;
43extern struct clk clk_h;
44extern struct clk clk_p;
45extern struct clk clk_upll;
46
39/* exports for arch/arm/mach-s3c2410 47/* exports for arch/arm/mach-s3c2410
40 * 48 *
41 * Please DO NOT use these outside of arch/arm/mach-s3c2410 49 * Please DO NOT use these outside of arch/arm/mach-s3c2410
@@ -43,7 +51,8 @@ extern struct clk clk_usb_bus;
43 51
44extern struct mutex clocks_mutex; 52extern struct mutex clocks_mutex;
45 53
46extern int s3c24xx_clkcon_enable(struct clk *clk, int enable); 54extern int s3c2410_clkcon_enable(struct clk *clk, int enable);
55
47extern int s3c24xx_register_clock(struct clk *clk); 56extern int s3c24xx_register_clock(struct clk *clk);
48 57
49extern int s3c24xx_setup_clocks(unsigned long xtal, 58extern int s3c24xx_setup_clocks(unsigned long xtal,
diff --git a/arch/arm/mach-s3c2410/cpu.h b/arch/arm/mach-s3c2410/cpu.h
index 40862899b2f1..21c62dc29bb2 100644
--- a/arch/arm/mach-s3c2410/cpu.h
+++ b/arch/arm/mach-s3c2410/cpu.h
@@ -73,5 +73,6 @@ extern struct sys_timer s3c24xx_timer;
73 73
74/* system device classes */ 74/* system device classes */
75 75
76extern struct sysdev_class s3c2410_sysclass;
76extern struct sysdev_class s3c2440_sysclass; 77extern struct sysdev_class s3c2440_sysclass;
77extern struct sysdev_class s3c2442_sysclass; 78extern struct sysdev_class s3c2442_sysclass;
diff --git a/arch/arm/mach-s3c2410/s3c2410-clock.c b/arch/arm/mach-s3c2410/s3c2410-clock.c
new file mode 100644
index 000000000000..fd17c60e1132
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2410-clock.c
@@ -0,0 +1,263 @@
1/* linux/arch/arm/mach-s3c2410/clock.c
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410,S3C2440,S3C2442 Clock control support
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
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/kernel.h>
26#include <linux/list.h>
27#include <linux/errno.h>
28#include <linux/err.h>
29#include <linux/sysdev.h>
30#include <linux/clk.h>
31#include <linux/mutex.h>
32#include <linux/delay.h>
33
34#include <asm/hardware.h>
35#include <asm/io.h>
36
37#include <asm/arch/regs-clock.h>
38#include <asm/arch/regs-gpio.h>
39
40#include "clock.h"
41#include "cpu.h"
42
43int s3c2410_clkcon_enable(struct clk *clk, int enable)
44{
45 unsigned int clocks = clk->ctrlbit;
46 unsigned long clkcon;
47
48 clkcon = __raw_readl(S3C2410_CLKCON);
49
50 if (enable)
51 clkcon |= clocks;
52 else
53 clkcon &= ~clocks;
54
55 /* ensure none of the special function bits set */
56 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER);
57
58 __raw_writel(clkcon, S3C2410_CLKCON);
59
60 return 0;
61}
62
63static int s3c2410_upll_enable(struct clk *clk, int enable)
64{
65 unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
66 unsigned long orig = clkslow;
67
68 if (enable)
69 clkslow &= ~S3C2410_CLKSLOW_UCLK_OFF;
70 else
71 clkslow |= S3C2410_CLKSLOW_UCLK_OFF;
72
73 __raw_writel(clkslow, S3C2410_CLKSLOW);
74
75 /* if we started the UPLL, then allow to settle */
76
77 if (enable && (orig & S3C2410_CLKSLOW_UCLK_OFF))
78 udelay(200);
79
80 return 0;
81}
82
83/* standard clock definitions */
84
85static struct clk init_clocks_disable[] = {
86 {
87 .name = "nand",
88 .id = -1,
89 .parent = &clk_h,
90 .enable = s3c2410_clkcon_enable,
91 .ctrlbit = S3C2410_CLKCON_NAND,
92 }, {
93 .name = "sdi",
94 .id = -1,
95 .parent = &clk_p,
96 .enable = s3c2410_clkcon_enable,
97 .ctrlbit = S3C2410_CLKCON_SDI,
98 }, {
99 .name = "adc",
100 .id = -1,
101 .parent = &clk_p,
102 .enable = s3c2410_clkcon_enable,
103 .ctrlbit = S3C2410_CLKCON_ADC,
104 }, {
105 .name = "i2c",
106 .id = -1,
107 .parent = &clk_p,
108 .enable = s3c2410_clkcon_enable,
109 .ctrlbit = S3C2410_CLKCON_IIC,
110 }, {
111 .name = "iis",
112 .id = -1,
113 .parent = &clk_p,
114 .enable = s3c2410_clkcon_enable,
115 .ctrlbit = S3C2410_CLKCON_IIS,
116 }, {
117 .name = "spi",
118 .id = -1,
119 .parent = &clk_p,
120 .enable = s3c2410_clkcon_enable,
121 .ctrlbit = S3C2410_CLKCON_SPI,
122 }
123};
124
125static struct clk init_clocks[] = {
126 {
127 .name = "lcd",
128 .id = -1,
129 .parent = &clk_h,
130 .enable = s3c2410_clkcon_enable,
131 .ctrlbit = S3C2410_CLKCON_LCDC,
132 }, {
133 .name = "gpio",
134 .id = -1,
135 .parent = &clk_p,
136 .enable = s3c2410_clkcon_enable,
137 .ctrlbit = S3C2410_CLKCON_GPIO,
138 }, {
139 .name = "usb-host",
140 .id = -1,
141 .parent = &clk_h,
142 .enable = s3c2410_clkcon_enable,
143 .ctrlbit = S3C2410_CLKCON_USBH,
144 }, {
145 .name = "usb-device",
146 .id = -1,
147 .parent = &clk_h,
148 .enable = s3c2410_clkcon_enable,
149 .ctrlbit = S3C2410_CLKCON_USBD,
150 }, {
151 .name = "timers",
152 .id = -1,
153 .parent = &clk_p,
154 .enable = s3c2410_clkcon_enable,
155 .ctrlbit = S3C2410_CLKCON_PWMT,
156 }, {
157 .name = "uart",
158 .id = 0,
159 .parent = &clk_p,
160 .enable = s3c2410_clkcon_enable,
161 .ctrlbit = S3C2410_CLKCON_UART0,
162 }, {
163 .name = "uart",
164 .id = 1,
165 .parent = &clk_p,
166 .enable = s3c2410_clkcon_enable,
167 .ctrlbit = S3C2410_CLKCON_UART1,
168 }, {
169 .name = "uart",
170 .id = 2,
171 .parent = &clk_p,
172 .enable = s3c2410_clkcon_enable,
173 .ctrlbit = S3C2410_CLKCON_UART2,
174 }, {
175 .name = "rtc",
176 .id = -1,
177 .parent = &clk_p,
178 .enable = s3c2410_clkcon_enable,
179 .ctrlbit = S3C2410_CLKCON_RTC,
180 }, {
181 .name = "watchdog",
182 .id = -1,
183 .parent = &clk_p,
184 .ctrlbit = 0,
185 }
186};
187
188/* s3c2410_baseclk_add()
189 *
190 * Add all the clocks used by the s3c2410 or compatible CPUs
191 * such as the S3C2440 and S3C2442.
192 *
193 * We cannot use a system device as we are needed before any
194 * of the init-calls that initialise the devices are actually
195 * done.
196*/
197
198int __init s3c2410_baseclk_add(void)
199{
200 unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
201 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
202 struct clk *clkp;
203 struct clk *xtal;
204 int ret;
205 int ptr;
206
207 clk_upll.enable = s3c2410_upll_enable;
208
209 if (s3c24xx_register_clock(&clk_usb_bus) < 0)
210 printk(KERN_ERR "failed to register usb bus clock\n");
211
212 /* register clocks from clock array */
213
214 clkp = init_clocks;
215 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
216 /* ensure that we note the clock state */
217
218 clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0;
219
220 ret = s3c24xx_register_clock(clkp);
221 if (ret < 0) {
222 printk(KERN_ERR "Failed to register clock %s (%d)\n",
223 clkp->name, ret);
224 }
225 }
226
227 /* We must be careful disabling the clocks we are not intending to
228 * be using at boot time, as subsytems such as the LCD which do
229 * their own DMA requests to the bus can cause the system to lockup
230 * if they where in the middle of requesting bus access.
231 *
232 * Disabling the LCD clock if the LCD is active is very dangerous,
233 * and therefore the bootloader should be careful to not enable
234 * the LCD clock if it is not needed.
235 */
236
237 /* install (and disable) the clocks we do not need immediately */
238
239 clkp = init_clocks_disable;
240 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
241
242 ret = s3c24xx_register_clock(clkp);
243 if (ret < 0) {
244 printk(KERN_ERR "Failed to register clock %s (%d)\n",
245 clkp->name, ret);
246 }
247
248 s3c2410_clkcon_enable(clkp, 0);
249 }
250
251 /* show the clock-slow value */
252
253 xtal = clk_get(NULL, "xtal");
254
255 printk("CLOCK: Slow mode (%ld.%ld MHz), %s, MPLL %s, UPLL %s\n",
256 print_mhz(clk_get_rate(xtal) /
257 ( 2 * S3C2410_CLKSLOW_GET_SLOWVAL(clkslow))),
258 (clkslow & S3C2410_CLKSLOW_SLOW) ? "slow" : "fast",
259 (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on",
260 (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on");
261
262 return 0;
263}
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index 0852e87a79c4..a110cff9cf6b 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -27,6 +27,7 @@
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/timer.h> 28#include <linux/timer.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/sysdev.h>
30#include <linux/platform_device.h> 31#include <linux/platform_device.h>
31 32
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
@@ -108,11 +109,33 @@ void __init s3c2410_init_clocks(int xtal)
108 */ 109 */
109 110
110 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 111 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk);
112 s3c2410_baseclk_add();
111} 113}
112 114
115struct sysdev_class s3c2410_sysclass = {
116 set_kset_name("s3c2410-core"),
117};
118
119static struct sys_device s3c2410_sysdev = {
120 .cls = &s3c2410_sysclass,
121};
122
123/* need to register class before we actually register the device, and
124 * we also need to ensure that it has been initialised before any of the
125 * drivers even try to use it (even if not on an s3c2440 based system)
126 * as a driver which may support both 2410 and 2440 may try and use it.
127*/
128
129static int __init s3c2410_core_init(void)
130{
131 return sysdev_class_register(&s3c2410_sysclass);
132}
133
134core_initcall(s3c2410_core_init);
135
113int __init s3c2410_init(void) 136int __init s3c2410_init(void)
114{ 137{
115 printk("S3C2410: Initialising architecture\n"); 138 printk("S3C2410: Initialising architecture\n");
116 139
117 return 0; 140 return sysdev_register(&s3c2410_sysdev);
118} 141}
diff --git a/arch/arm/mach-s3c2410/s3c2410.h b/arch/arm/mach-s3c2410/s3c2410.h
index 4d5312a48209..73f1a2474a61 100644
--- a/arch/arm/mach-s3c2410/s3c2410.h
+++ b/arch/arm/mach-s3c2410/s3c2410.h
@@ -29,6 +29,8 @@ extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
29 29
30extern void s3c2410_init_clocks(int xtal); 30extern void s3c2410_init_clocks(int xtal);
31 31
32extern int s3c2410_baseclk_add(void);
33
32#else 34#else
33#define s3c2410_init_clocks NULL 35#define s3c2410_init_clocks NULL
34#define s3c2410_init_uarts NULL 36#define s3c2410_init_uarts NULL
diff --git a/arch/arm/mach-s3c2410/s3c2440-clock.c b/arch/arm/mach-s3c2410/s3c2440-clock.c
index d7a30ed6c327..15796864d010 100644
--- a/arch/arm/mach-s3c2410/s3c2440-clock.c
+++ b/arch/arm/mach-s3c2410/s3c2440-clock.c
@@ -91,7 +91,7 @@ static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate)
91static struct clk s3c2440_clk_cam = { 91static struct clk s3c2440_clk_cam = {
92 .name = "camif", 92 .name = "camif",
93 .id = -1, 93 .id = -1,
94 .enable = s3c24xx_clkcon_enable, 94 .enable = s3c2410_clkcon_enable,
95 .ctrlbit = S3C2440_CLKCON_CAMERA, 95 .ctrlbit = S3C2440_CLKCON_CAMERA,
96}; 96};
97 97
@@ -105,7 +105,7 @@ static struct clk s3c2440_clk_cam_upll = {
105static struct clk s3c2440_clk_ac97 = { 105static struct clk s3c2440_clk_ac97 = {
106 .name = "ac97", 106 .name = "ac97",
107 .id = -1, 107 .id = -1,
108 .enable = s3c24xx_clkcon_enable, 108 .enable = s3c2410_clkcon_enable,
109 .ctrlbit = S3C2440_CLKCON_CAMERA, 109 .ctrlbit = S3C2440_CLKCON_CAMERA,
110}; 110};
111 111
diff --git a/arch/arm/mach-s3c2410/s3c2442-clock.c b/arch/arm/mach-s3c2410/s3c2442-clock.c
index 5b7b301eb522..d9f54b5cab7f 100644
--- a/arch/arm/mach-s3c2410/s3c2442-clock.c
+++ b/arch/arm/mach-s3c2410/s3c2442-clock.c
@@ -102,7 +102,7 @@ static int s3c2442_camif_upll_setrate(struct clk *clk, unsigned long rate)
102static struct clk s3c2442_clk_cam = { 102static struct clk s3c2442_clk_cam = {
103 .name = "camif", 103 .name = "camif",
104 .id = -1, 104 .id = -1,
105 .enable = s3c24xx_clkcon_enable, 105 .enable = s3c2410_clkcon_enable,
106 .ctrlbit = S3C2440_CLKCON_CAMERA, 106 .ctrlbit = S3C2440_CLKCON_CAMERA,
107}; 107};
108 108
diff --git a/arch/arm/mach-s3c2410/s3c244x.c b/arch/arm/mach-s3c2410/s3c244x.c
index 96852a7000db..838bc525e836 100644
--- a/arch/arm/mach-s3c2410/s3c244x.c
+++ b/arch/arm/mach-s3c2410/s3c244x.c
@@ -34,6 +34,7 @@
34#include <asm/arch/regs-gpioj.h> 34#include <asm/arch/regs-gpioj.h>
35#include <asm/arch/regs-dsc.h> 35#include <asm/arch/regs-dsc.h>
36 36
37#include "s3c2410.h"
37#include "s3c2440.h" 38#include "s3c2440.h"
38#include "s3c244x.h" 39#include "s3c244x.h"
39#include "clock.h" 40#include "clock.h"
@@ -118,6 +119,7 @@ void __init s3c244x_init_clocks(int xtal)
118 */ 119 */
119 120
120 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 121 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk);
122 s3c2410_baseclk_add();
121} 123}
122 124
123#ifdef CONFIG_PM 125#ifdef CONFIG_PM
diff --git a/arch/arm/nwfpe/fpmodule.c b/arch/arm/nwfpe/fpmodule.c
index 2dfe1ac42ee8..7d977d23f026 100644
--- a/arch/arm/nwfpe/fpmodule.c
+++ b/arch/arm/nwfpe/fpmodule.c
@@ -33,7 +33,8 @@
33#include <linux/signal.h> 33#include <linux/signal.h>
34#include <linux/sched.h> 34#include <linux/sched.h>
35#include <linux/init.h> 35#include <linux/init.h>
36/* XXX */ 36
37#include <asm/thread_notify.h>
37 38
38#include "softfloat.h" 39#include "softfloat.h"
39#include "fpopcode.h" 40#include "fpopcode.h"
@@ -56,16 +57,28 @@ void fp_send_sig(unsigned long sig, struct task_struct *p, int priv);
56extern char fpe_type[]; 57extern char fpe_type[];
57#endif 58#endif
58 59
60static int nwfpe_notify(struct notifier_block *self, unsigned long cmd, void *v)
61{
62 struct thread_info *thread = v;
63
64 if (cmd == THREAD_NOTIFY_FLUSH)
65 nwfpe_init_fpa(&thread->fpstate);
66
67 return NOTIFY_DONE;
68}
69
70static struct notifier_block nwfpe_notifier_block = {
71 .notifier_call = nwfpe_notify,
72};
73
59/* kernel function prototypes required */ 74/* kernel function prototypes required */
60void fp_setup(void); 75void fp_setup(void);
61 76
62/* external declarations for saved kernel symbols */ 77/* external declarations for saved kernel symbols */
63extern void (*kern_fp_enter)(void); 78extern void (*kern_fp_enter)(void);
64extern void (*fp_init)(union fp_state *);
65 79
66/* Original value of fp_enter from kernel before patched by fpe_init. */ 80/* Original value of fp_enter from kernel before patched by fpe_init. */
67static void (*orig_fp_enter)(void); 81static void (*orig_fp_enter)(void);
68static void (*orig_fp_init)(union fp_state *);
69 82
70/* forward declarations */ 83/* forward declarations */
71extern void nwfpe_enter(void); 84extern void nwfpe_enter(void);
@@ -88,20 +101,20 @@ static int __init fpe_init(void)
88 printk(KERN_WARNING "NetWinder Floating Point Emulator V0.97 (" 101 printk(KERN_WARNING "NetWinder Floating Point Emulator V0.97 ("
89 NWFPE_BITS " precision)\n"); 102 NWFPE_BITS " precision)\n");
90 103
104 thread_register_notifier(&nwfpe_notifier_block);
105
91 /* Save pointer to the old FP handler and then patch ourselves in */ 106 /* Save pointer to the old FP handler and then patch ourselves in */
92 orig_fp_enter = kern_fp_enter; 107 orig_fp_enter = kern_fp_enter;
93 orig_fp_init = fp_init;
94 kern_fp_enter = nwfpe_enter; 108 kern_fp_enter = nwfpe_enter;
95 fp_init = nwfpe_init_fpa;
96 109
97 return 0; 110 return 0;
98} 111}
99 112
100static void __exit fpe_exit(void) 113static void __exit fpe_exit(void)
101{ 114{
115 thread_unregister_notifier(&nwfpe_notifier_block);
102 /* Restore the values we saved earlier. */ 116 /* Restore the values we saved earlier. */
103 kern_fp_enter = orig_fp_enter; 117 kern_fp_enter = orig_fp_enter;
104 fp_init = orig_fp_init;
105} 118}
106 119
107/* 120/*
diff --git a/arch/arm/plat-omap/timer32k.c b/arch/arm/plat-omap/timer32k.c
index b2a943bf11ef..3461a6c9665c 100644
--- a/arch/arm/plat-omap/timer32k.c
+++ b/arch/arm/plat-omap/timer32k.c
@@ -210,7 +210,8 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
210 210
211 now = omap_32k_sync_timer_read(); 211 now = omap_32k_sync_timer_read();
212 212
213 while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) { 213 while ((signed long)(now - omap_32k_last_tick)
214 >= OMAP_32K_TICKS_PER_HZ) {
214 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ; 215 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
215 timer_tick(regs); 216 timer_tick(regs);
216 } 217 }
diff --git a/arch/arm/vfp/Makefile b/arch/arm/vfp/Makefile
index afabac31dd1d..7e136e77971a 100644
--- a/arch/arm/vfp/Makefile
+++ b/arch/arm/vfp/Makefile
@@ -7,6 +7,9 @@
7# EXTRA_CFLAGS := -DDEBUG 7# EXTRA_CFLAGS := -DDEBUG
8# EXTRA_AFLAGS := -DDEBUG 8# EXTRA_AFLAGS := -DDEBUG
9 9
10AFLAGS :=$(AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp)
11LDFLAGS +=--no-warn-mismatch
12
10obj-y += vfp.o 13obj-y += vfp.o
11 14
12vfp-$(CONFIG_VFP) += entry.o vfpmodule.o vfphw.o vfpsingle.o vfpdouble.o 15vfp-$(CONFIG_VFP) += vfpmodule.o entry.o vfphw.o vfpsingle.o vfpdouble.o
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index a3f65b47aea9..eb683cd77163 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -192,7 +192,7 @@ vfp_get_double:
192 add pc, pc, r0, lsl #3 192 add pc, pc, r0, lsl #3
193 mov r0, r0 193 mov r0, r0
194 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 194 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
195 mrrc p11, 1, r0, r1, c\dr @ fmrrd r0, r1, d\dr 195 fmrrd r0, r1, d\dr
196 mov pc, lr 196 mov pc, lr
197 .endr 197 .endr
198 198
@@ -206,6 +206,6 @@ vfp_put_double:
206 add pc, pc, r0, lsl #3 206 add pc, pc, r0, lsl #3
207 mov r0, r0 207 mov r0, r0
208 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 208 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
209 mcrr p11, 1, r1, r2, c\dr @ fmdrr r1, r2, d\dr 209 fmdrr d\dr, r1, r2
210 mov pc, lr 210 mov pc, lr
211 .endr 211 .endr
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 03486be04193..2476f4c2e760 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -15,6 +15,8 @@
15#include <linux/signal.h> 15#include <linux/signal.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/init.h> 17#include <linux/init.h>
18
19#include <asm/thread_notify.h>
18#include <asm/vfp.h> 20#include <asm/vfp.h>
19 21
20#include "vfpinstr.h" 22#include "vfpinstr.h"
@@ -36,38 +38,55 @@ union vfp_state *last_VFP_context;
36 */ 38 */
37unsigned int VFP_arch; 39unsigned int VFP_arch;
38 40
39/* 41static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
40 * Per-thread VFP initialisation.
41 */
42void vfp_flush_thread(union vfp_state *vfp)
43{ 42{
44 memset(vfp, 0, sizeof(union vfp_state)); 43 struct thread_info *thread = v;
44 union vfp_state *vfp = &thread->vfpstate;
45 45
46 vfp->hard.fpexc = FPEXC_ENABLE; 46 switch (cmd) {
47 vfp->hard.fpscr = FPSCR_ROUND_NEAREST; 47 case THREAD_NOTIFY_FLUSH:
48 /*
49 * Per-thread VFP initialisation.
50 */
51 memset(vfp, 0, sizeof(union vfp_state));
48 52
49 /* 53 vfp->hard.fpexc = FPEXC_ENABLE;
50 * Disable VFP to ensure we initialise it first. 54 vfp->hard.fpscr = FPSCR_ROUND_NEAREST;
51 */
52 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
53 55
54 /* 56 /*
55 * Ensure we don't try to overwrite our newly initialised 57 * Disable VFP to ensure we initialise it first.
56 * state information on the first fault. 58 */
57 */ 59 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
58 if (last_VFP_context == vfp)
59 last_VFP_context = NULL;
60}
61 60
62/* 61 /*
63 * Per-thread VFP cleanup. 62 * FALLTHROUGH: Ensure we don't try to overwrite our newly
64 */ 63 * initialised state information on the first fault.
65void vfp_release_thread(union vfp_state *vfp) 64 */
66{ 65
67 if (last_VFP_context == vfp) 66 case THREAD_NOTIFY_RELEASE:
68 last_VFP_context = NULL; 67 /*
68 * Per-thread VFP cleanup.
69 */
70 if (last_VFP_context == vfp)
71 last_VFP_context = NULL;
72 break;
73
74 case THREAD_NOTIFY_SWITCH:
75 /*
76 * Always disable VFP so we can lazily save/restore the
77 * old state.
78 */
79 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
80 break;
81 }
82
83 return NOTIFY_DONE;
69} 84}
70 85
86static struct notifier_block vfp_notifier_block = {
87 .notifier_call = vfp_notifier,
88};
89
71/* 90/*
72 * Raise a SIGFPE for the current process. 91 * Raise a SIGFPE for the current process.
73 * sicode describes the signal being raised. 92 * sicode describes the signal being raised.
@@ -281,6 +300,8 @@ static int __init vfp_init(void)
281 (vfpsid & FPSID_VARIANT_MASK) >> FPSID_VARIANT_BIT, 300 (vfpsid & FPSID_VARIANT_MASK) >> FPSID_VARIANT_BIT,
282 (vfpsid & FPSID_REV_MASK) >> FPSID_REV_BIT); 301 (vfpsid & FPSID_REV_MASK) >> FPSID_REV_BIT);
283 vfp_vector = vfp_support_entry; 302 vfp_vector = vfp_support_entry;
303
304 thread_register_notifier(&vfp_notifier_block);
284 } 305 }
285 return 0; 306 return 0;
286} 307}
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index a9b59527a741..81d94e41a189 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -1474,7 +1474,7 @@ sys_call_table:
1474 .long sys_mknodat 1474 .long sys_mknodat
1475 .long sys_fchownat 1475 .long sys_fchownat
1476 .long sys_futimesat 1476 .long sys_futimesat
1477 .long sys_newfstatat /* 300 */ 1477 .long sys_fstatat64 /* 300 */
1478 .long sys_unlinkat 1478 .long sys_unlinkat
1479 .long sys_renameat 1479 .long sys_renameat
1480 .long sys_linkat 1480 .long sys_linkat
diff --git a/arch/frv/kernel/frv_ksyms.c b/arch/frv/kernel/frv_ksyms.c
index 0f273a7aca5a..dee637fffda5 100644
--- a/arch/frv/kernel/frv_ksyms.c
+++ b/arch/frv/kernel/frv_ksyms.c
@@ -26,16 +26,6 @@ extern long __memset_user(void *dst, const void *src, size_t count);
26EXPORT_SYMBOL(__ioremap); 26EXPORT_SYMBOL(__ioremap);
27EXPORT_SYMBOL(iounmap); 27EXPORT_SYMBOL(iounmap);
28 28
29EXPORT_SYMBOL(strnlen);
30EXPORT_SYMBOL(strrchr);
31EXPORT_SYMBOL(strstr);
32EXPORT_SYMBOL(strchr);
33EXPORT_SYMBOL(strcat);
34EXPORT_SYMBOL(strlen);
35EXPORT_SYMBOL(strcmp);
36EXPORT_SYMBOL(strncmp);
37EXPORT_SYMBOL(strncpy);
38
39EXPORT_SYMBOL(ip_fast_csum); 29EXPORT_SYMBOL(ip_fast_csum);
40 30
41#if 0 31#if 0
@@ -44,8 +34,6 @@ EXPORT_SYMBOL(local_bh_count);
44#endif 34#endif
45EXPORT_SYMBOL(kernel_thread); 35EXPORT_SYMBOL(kernel_thread);
46 36
47EXPORT_SYMBOL(enable_irq);
48EXPORT_SYMBOL(disable_irq);
49EXPORT_SYMBOL(__res_bus_clock_speed_HZ); 37EXPORT_SYMBOL(__res_bus_clock_speed_HZ);
50EXPORT_SYMBOL(__page_offset); 38EXPORT_SYMBOL(__page_offset);
51EXPORT_SYMBOL(__memcpy_user); 39EXPORT_SYMBOL(__memcpy_user);
@@ -62,18 +50,12 @@ EXPORT_SYMBOL(memory_end);
62 50
63EXPORT_SYMBOL(__debug_bug_trap); 51EXPORT_SYMBOL(__debug_bug_trap);
64 52
65/* Networking helper routines. */
66EXPORT_SYMBOL(csum_partial_copy);
67
68/* The following are special because they're not called 53/* The following are special because they're not called
69 explicitly (the C compiler generates them). Fortunately, 54 explicitly (the C compiler generates them). Fortunately,
70 their interface isn't gonna change any time soon now, so 55 their interface isn't gonna change any time soon now, so
71 it's OK to leave it out of version control. */ 56 it's OK to leave it out of version control. */
72EXPORT_SYMBOL(memcpy); 57EXPORT_SYMBOL(memcpy);
73EXPORT_SYMBOL(memset); 58EXPORT_SYMBOL(memset);
74EXPORT_SYMBOL(memcmp);
75EXPORT_SYMBOL(memscan);
76EXPORT_SYMBOL(memmove);
77 59
78EXPORT_SYMBOL(__outsl_ns); 60EXPORT_SYMBOL(__outsl_ns);
79EXPORT_SYMBOL(__insl_ns); 61EXPORT_SYMBOL(__insl_ns);
diff --git a/arch/frv/kernel/irq-routing.c b/arch/frv/kernel/irq-routing.c
index d4776d1f4e82..b90b70a761d1 100644
--- a/arch/frv/kernel/irq-routing.c
+++ b/arch/frv/kernel/irq-routing.c
@@ -112,7 +112,7 @@ struct irq_source frv_cpuuart[2] = {
112#define __CPUUART(X, A) \ 112#define __CPUUART(X, A) \
113 [X] = { \ 113 [X] = { \
114 .muxname = "uart", \ 114 .muxname = "uart", \
115 .muxdata = (volatile void __iomem *) A, \ 115 .muxdata = (volatile void __iomem *)(unsigned long)A,\
116 .irqmask = 1 << IRQ_CPU_UART##X, \ 116 .irqmask = 1 << IRQ_CPU_UART##X, \
117 .doirq = frv_cpuuart_doirq, \ 117 .doirq = frv_cpuuart_doirq, \
118 } 118 }
@@ -136,7 +136,7 @@ struct irq_source frv_cpudma[8] = {
136#define __CPUDMA(X, A) \ 136#define __CPUDMA(X, A) \
137 [X] = { \ 137 [X] = { \
138 .muxname = "dma", \ 138 .muxname = "dma", \
139 .muxdata = (volatile void __iomem *) A, \ 139 .muxdata = (volatile void __iomem *)(unsigned long)A,\
140 .irqmask = 1 << IRQ_CPU_DMA##X, \ 140 .irqmask = 1 << IRQ_CPU_DMA##X, \
141 .doirq = frv_cpudma_doirq, \ 141 .doirq = frv_cpudma_doirq, \
142 } 142 }
@@ -164,7 +164,7 @@ struct irq_source frv_cputimer[3] = {
164#define __CPUTIMER(X) \ 164#define __CPUTIMER(X) \
165 [X] = { \ 165 [X] = { \
166 .muxname = "timer", \ 166 .muxname = "timer", \
167 .muxdata = 0, \ 167 .muxdata = NULL, \
168 .irqmask = 1 << IRQ_CPU_TIMER##X, \ 168 .irqmask = 1 << IRQ_CPU_TIMER##X, \
169 .doirq = frv_cputimer_doirq, \ 169 .doirq = frv_cputimer_doirq, \
170 } 170 }
@@ -187,7 +187,7 @@ struct irq_source frv_cpuexternal[8] = {
187#define __CPUEXTERNAL(X) \ 187#define __CPUEXTERNAL(X) \
188 [X] = { \ 188 [X] = { \
189 .muxname = "ext", \ 189 .muxname = "ext", \
190 .muxdata = 0, \ 190 .muxdata = NULL, \
191 .irqmask = 1 << IRQ_CPU_EXTERNAL##X, \ 191 .irqmask = 1 << IRQ_CPU_EXTERNAL##X, \
192 .doirq = frv_cpuexternal_doirq, \ 192 .doirq = frv_cpuexternal_doirq, \
193 } 193 }
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index 11fa326a8f62..8b112b361914 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -625,7 +625,7 @@ static struct proc_dir_entry * irq_dir [NR_IRQS];
625 625
626#define HEX_DIGITS 8 626#define HEX_DIGITS 8
627 627
628static unsigned int parse_hex_value (const char *buffer, 628static unsigned int parse_hex_value (const char __user *buffer,
629 unsigned long count, unsigned long *ret) 629 unsigned long count, unsigned long *ret)
630{ 630{
631 unsigned char hexnum [HEX_DIGITS]; 631 unsigned char hexnum [HEX_DIGITS];
@@ -672,7 +672,7 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
672 return sprintf (page, "%08lx\n", *mask); 672 return sprintf (page, "%08lx\n", *mask);
673} 673}
674 674
675static int prof_cpu_mask_write_proc (struct file *file, const char *buffer, 675static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer,
676 unsigned long count, void *data) 676 unsigned long count, void *data)
677{ 677{
678 unsigned long *mask = (unsigned long *) data, full_count = count, err; 678 unsigned long *mask = (unsigned long *) data, full_count = count, err;
@@ -711,7 +711,7 @@ void init_irq_proc (void)
711 int i; 711 int i;
712 712
713 /* create /proc/irq */ 713 /* create /proc/irq */
714 root_irq_dir = proc_mkdir("irq", 0); 714 root_irq_dir = proc_mkdir("irq", NULL);
715 715
716 /* create /proc/irq/prof_cpu_mask */ 716 /* create /proc/irq/prof_cpu_mask */
717 entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir); 717 entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index f0b8fff3e733..43ce28a13a5d 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -137,7 +137,7 @@ unsigned long sleep_phys_sp(void *sp)
137#define CTL_PM_P0 4 137#define CTL_PM_P0 4
138#define CTL_PM_CM 5 138#define CTL_PM_CM 5
139 139
140static int user_atoi(char *ubuf, size_t len) 140static int user_atoi(char __user *ubuf, size_t len)
141{ 141{
142 char buf[16]; 142 char buf[16];
143 unsigned long ret; 143 unsigned long ret;
@@ -159,7 +159,7 @@ static int user_atoi(char *ubuf, size_t len)
159 * Send us to sleep. 159 * Send us to sleep.
160 */ 160 */
161static int sysctl_pm_do_suspend(ctl_table *ctl, int write, struct file *filp, 161static int sysctl_pm_do_suspend(ctl_table *ctl, int write, struct file *filp,
162 void *buffer, size_t *lenp, loff_t *fpos) 162 void __user *buffer, size_t *lenp, loff_t *fpos)
163{ 163{
164 int retval, mode; 164 int retval, mode;
165 165
@@ -215,7 +215,7 @@ static int try_set_cmode(int new_cmode)
215 215
216 216
217static int cmode_procctl(ctl_table *ctl, int write, struct file *filp, 217static int cmode_procctl(ctl_table *ctl, int write, struct file *filp,
218 void *buffer, size_t *lenp, loff_t *fpos) 218 void __user *buffer, size_t *lenp, loff_t *fpos)
219{ 219{
220 int new_cmode; 220 int new_cmode;
221 221
@@ -227,9 +227,9 @@ static int cmode_procctl(ctl_table *ctl, int write, struct file *filp,
227 return try_set_cmode(new_cmode)?:*lenp; 227 return try_set_cmode(new_cmode)?:*lenp;
228} 228}
229 229
230static int cmode_sysctl(ctl_table *table, int *name, int nlen, 230static int cmode_sysctl(ctl_table *table, int __user *name, int nlen,
231 void *oldval, size_t *oldlenp, 231 void __user *oldval, size_t __user *oldlenp,
232 void *newval, size_t newlen, void **context) 232 void __user *newval, size_t newlen, void **context)
233{ 233{
234 if (oldval && oldlenp) { 234 if (oldval && oldlenp) {
235 size_t oldlen; 235 size_t oldlen;
@@ -240,7 +240,7 @@ static int cmode_sysctl(ctl_table *table, int *name, int nlen,
240 if (oldlen != sizeof(int)) 240 if (oldlen != sizeof(int))
241 return -EINVAL; 241 return -EINVAL;
242 242
243 if (put_user(clock_cmode_current, (unsigned int *)oldval) || 243 if (put_user(clock_cmode_current, (unsigned __user *)oldval) ||
244 put_user(sizeof(int), oldlenp)) 244 put_user(sizeof(int), oldlenp))
245 return -EFAULT; 245 return -EFAULT;
246 } 246 }
@@ -250,7 +250,7 @@ static int cmode_sysctl(ctl_table *table, int *name, int nlen,
250 if (newlen != sizeof(int)) 250 if (newlen != sizeof(int))
251 return -EINVAL; 251 return -EINVAL;
252 252
253 if (get_user(new_cmode, (int *)newval)) 253 if (get_user(new_cmode, (int __user *)newval))
254 return -EFAULT; 254 return -EFAULT;
255 255
256 return try_set_cmode(new_cmode)?:1; 256 return try_set_cmode(new_cmode)?:1;
@@ -318,7 +318,7 @@ static int try_set_cm(int new_cm)
318} 318}
319 319
320static int p0_procctl(ctl_table *ctl, int write, struct file *filp, 320static int p0_procctl(ctl_table *ctl, int write, struct file *filp,
321 void *buffer, size_t *lenp, loff_t *fpos) 321 void __user *buffer, size_t *lenp, loff_t *fpos)
322{ 322{
323 int new_p0; 323 int new_p0;
324 324
@@ -330,9 +330,9 @@ static int p0_procctl(ctl_table *ctl, int write, struct file *filp,
330 return try_set_p0(new_p0)?:*lenp; 330 return try_set_p0(new_p0)?:*lenp;
331} 331}
332 332
333static int p0_sysctl(ctl_table *table, int *name, int nlen, 333static int p0_sysctl(ctl_table *table, int __user *name, int nlen,
334 void *oldval, size_t *oldlenp, 334 void __user *oldval, size_t __user *oldlenp,
335 void *newval, size_t newlen, void **context) 335 void __user *newval, size_t newlen, void **context)
336{ 336{
337 if (oldval && oldlenp) { 337 if (oldval && oldlenp) {
338 size_t oldlen; 338 size_t oldlen;
@@ -343,7 +343,7 @@ static int p0_sysctl(ctl_table *table, int *name, int nlen,
343 if (oldlen != sizeof(int)) 343 if (oldlen != sizeof(int))
344 return -EINVAL; 344 return -EINVAL;
345 345
346 if (put_user(clock_p0_current, (unsigned int *)oldval) || 346 if (put_user(clock_p0_current, (unsigned __user *)oldval) ||
347 put_user(sizeof(int), oldlenp)) 347 put_user(sizeof(int), oldlenp))
348 return -EFAULT; 348 return -EFAULT;
349 } 349 }
@@ -353,7 +353,7 @@ static int p0_sysctl(ctl_table *table, int *name, int nlen,
353 if (newlen != sizeof(int)) 353 if (newlen != sizeof(int))
354 return -EINVAL; 354 return -EINVAL;
355 355
356 if (get_user(new_p0, (int *)newval)) 356 if (get_user(new_p0, (int __user *)newval))
357 return -EFAULT; 357 return -EFAULT;
358 358
359 return try_set_p0(new_p0)?:1; 359 return try_set_p0(new_p0)?:1;
@@ -362,7 +362,7 @@ static int p0_sysctl(ctl_table *table, int *name, int nlen,
362} 362}
363 363
364static int cm_procctl(ctl_table *ctl, int write, struct file *filp, 364static int cm_procctl(ctl_table *ctl, int write, struct file *filp,
365 void *buffer, size_t *lenp, loff_t *fpos) 365 void __user *buffer, size_t *lenp, loff_t *fpos)
366{ 366{
367 int new_cm; 367 int new_cm;
368 368
@@ -374,9 +374,9 @@ static int cm_procctl(ctl_table *ctl, int write, struct file *filp,
374 return try_set_cm(new_cm)?:*lenp; 374 return try_set_cm(new_cm)?:*lenp;
375} 375}
376 376
377static int cm_sysctl(ctl_table *table, int *name, int nlen, 377static int cm_sysctl(ctl_table *table, int __user *name, int nlen,
378 void *oldval, size_t *oldlenp, 378 void __user *oldval, size_t __user *oldlenp,
379 void *newval, size_t newlen, void **context) 379 void __user *newval, size_t newlen, void **context)
380{ 380{
381 if (oldval && oldlenp) { 381 if (oldval && oldlenp) {
382 size_t oldlen; 382 size_t oldlen;
@@ -387,7 +387,7 @@ static int cm_sysctl(ctl_table *table, int *name, int nlen,
387 if (oldlen != sizeof(int)) 387 if (oldlen != sizeof(int))
388 return -EINVAL; 388 return -EINVAL;
389 389
390 if (put_user(clock_cm_current, (unsigned int *)oldval) || 390 if (put_user(clock_cm_current, (unsigned __user *)oldval) ||
391 put_user(sizeof(int), oldlenp)) 391 put_user(sizeof(int), oldlenp))
392 return -EFAULT; 392 return -EFAULT;
393 } 393 }
@@ -397,7 +397,7 @@ static int cm_sysctl(ctl_table *table, int *name, int nlen,
397 if (newlen != sizeof(int)) 397 if (newlen != sizeof(int))
398 return -EINVAL; 398 return -EINVAL;
399 399
400 if (get_user(new_cm, (int *)newval)) 400 if (get_user(new_cm, (int __user *)newval))
401 return -EFAULT; 401 return -EFAULT;
402 402
403 return try_set_cm(new_cm)?:1; 403 return try_set_cm(new_cm)?:1;
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 0fff8a61ef2a..489e6c489cbe 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -246,7 +246,7 @@ int copy_thread(int nr, unsigned long clone_flags,
246/* 246/*
247 * sys_execve() executes a new program. 247 * sys_execve() executes a new program.
248 */ 248 */
249asmlinkage int sys_execve(char *name, char **argv, char **envp) 249asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp)
250{ 250{
251 int error; 251 int error;
252 char * filename; 252 char * filename;
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 5908deae9607..1f7d65f29e78 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -814,7 +814,7 @@ void __init setup_arch(char **cmdline_p)
814 * - by now the stack is part of the init task */ 814 * - by now the stack is part of the init task */
815 printk("Memory %08lx-%08lx\n", memory_start, memory_end); 815 printk("Memory %08lx-%08lx\n", memory_start, memory_end);
816 816
817 if (memory_start == memory_end) BUG(); 817 BUG_ON(memory_start == memory_end);
818 818
819 init_mm.start_code = (unsigned long) &_stext; 819 init_mm.start_code = (unsigned long) &_stext;
820 init_mm.end_code = (unsigned long) &_etext; 820 init_mm.end_code = (unsigned long) &_etext;
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index 679c1d5cc958..b8a5882b8625 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -98,7 +98,7 @@ int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
98 98
99struct sigframe 99struct sigframe
100{ 100{
101 void (*pretcode)(void); 101 __sigrestore_t pretcode;
102 int sig; 102 int sig;
103 struct sigcontext sc; 103 struct sigcontext sc;
104 unsigned long extramask[_NSIG_WORDS-1]; 104 unsigned long extramask[_NSIG_WORDS-1];
@@ -107,10 +107,10 @@ struct sigframe
107 107
108struct rt_sigframe 108struct rt_sigframe
109{ 109{
110 void (*pretcode)(void); 110 __sigrestore_t pretcode;
111 int sig; 111 int sig;
112 struct siginfo *pinfo; 112 struct siginfo __user *pinfo;
113 void *puc; 113 void __user *puc;
114 struct siginfo info; 114 struct siginfo info;
115 struct ucontext uc; 115 struct ucontext uc;
116 uint32_t retcode[2]; 116 uint32_t retcode[2];
@@ -233,7 +233,7 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
233 233
234 /* This is the X/Open sanctioned signal stack switching. */ 234 /* This is the X/Open sanctioned signal stack switching. */
235 if (ka->sa.sa_flags & SA_ONSTACK) { 235 if (ka->sa.sa_flags & SA_ONSTACK) {
236 if (! on_sig_stack(sp)) 236 if (! sas_ss_flags(sp))
237 sp = current->sas_ss_sp + current->sas_ss_size; 237 sp = current->sas_ss_sp + current->sas_ss_size;
238 } 238 }
239 239
@@ -284,7 +284,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
284 * setlos #__NR_sigreturn,gr7 284 * setlos #__NR_sigreturn,gr7
285 * tira gr0,0 285 * tira gr0,0
286 */ 286 */
287 if (__put_user((void (*)(void))frame->retcode, &frame->pretcode) || 287 if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) ||
288 __put_user(0x8efc0000|__NR_sigreturn, &frame->retcode[0]) || 288 __put_user(0x8efc0000|__NR_sigreturn, &frame->retcode[0]) ||
289 __put_user(0xc0700000, &frame->retcode[1])) 289 __put_user(0xc0700000, &frame->retcode[1]))
290 goto give_sigsegv; 290 goto give_sigsegv;
@@ -300,7 +300,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
300 300
301 if (get_personality & FDPIC_FUNCPTRS) { 301 if (get_personality & FDPIC_FUNCPTRS) {
302 struct fdpic_func_descriptor __user *funcptr = 302 struct fdpic_func_descriptor __user *funcptr =
303 (struct fdpic_func_descriptor *) ka->sa.sa_handler; 303 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler;
304 __get_user(__frame->pc, &funcptr->text); 304 __get_user(__frame->pc, &funcptr->text);
305 __get_user(__frame->gr15, &funcptr->GOT); 305 __get_user(__frame->gr15, &funcptr->GOT);
306 } else { 306 } else {
@@ -359,8 +359,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
359 359
360 /* Create the ucontext. */ 360 /* Create the ucontext. */
361 if (__put_user(0, &frame->uc.uc_flags) || 361 if (__put_user(0, &frame->uc.uc_flags) ||
362 __put_user(0, &frame->uc.uc_link) || 362 __put_user(NULL, &frame->uc.uc_link) ||
363 __put_user((void*)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) || 363 __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) ||
364 __put_user(sas_ss_flags(__frame->sp), &frame->uc.uc_stack.ss_flags) || 364 __put_user(sas_ss_flags(__frame->sp), &frame->uc.uc_stack.ss_flags) ||
365 __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size)) 365 __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size))
366 goto give_sigsegv; 366 goto give_sigsegv;
@@ -382,7 +382,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
382 * setlos #__NR_sigreturn,gr7 382 * setlos #__NR_sigreturn,gr7
383 * tira gr0,0 383 * tira gr0,0
384 */ 384 */
385 if (__put_user((void (*)(void))frame->retcode, &frame->pretcode) || 385 if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) ||
386 __put_user(0x8efc0000|__NR_rt_sigreturn, &frame->retcode[0]) || 386 __put_user(0x8efc0000|__NR_rt_sigreturn, &frame->retcode[0]) ||
387 __put_user(0xc0700000, &frame->retcode[1])) 387 __put_user(0xc0700000, &frame->retcode[1]))
388 goto give_sigsegv; 388 goto give_sigsegv;
@@ -398,7 +398,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
398 __frame->gr9 = (unsigned long) &frame->info; 398 __frame->gr9 = (unsigned long) &frame->info;
399 399
400 if (get_personality & FDPIC_FUNCPTRS) { 400 if (get_personality & FDPIC_FUNCPTRS) {
401 struct fdpic_func_descriptor *funcptr = 401 struct fdpic_func_descriptor __user *funcptr =
402 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; 402 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler;
403 __get_user(__frame->pc, &funcptr->text); 403 __get_user(__frame->pc, &funcptr->text);
404 __get_user(__frame->gr15, &funcptr->GOT); 404 __get_user(__frame->gr15, &funcptr->GOT);
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
index 931aa6d895e3..c4d4348c9e8e 100644
--- a/arch/frv/kernel/sys_frv.c
+++ b/arch/frv/kernel/sys_frv.c
@@ -32,7 +32,7 @@
32 * sys_pipe() is the normal C calling standard for creating 32 * sys_pipe() is the normal C calling standard for creating
33 * a pipe. It's not the way unix traditionally does this, though. 33 * a pipe. It's not the way unix traditionally does this, though.
34 */ 34 */
35asmlinkage long sys_pipe(unsigned long * fildes) 35asmlinkage long sys_pipe(unsigned long __user * fildes)
36{ 36{
37 int fd[2]; 37 int fd[2];
38 int error; 38 int error;
diff --git a/arch/frv/kernel/sysctl.c b/arch/frv/kernel/sysctl.c
index 408b0f382b42..b908863d6593 100644
--- a/arch/frv/kernel/sysctl.c
+++ b/arch/frv/kernel/sysctl.c
@@ -49,7 +49,7 @@ static void frv_change_dcache_mode(unsigned long newmode)
49 * handle requests to dynamically switch the write caching mode delivered by /proc 49 * handle requests to dynamically switch the write caching mode delivered by /proc
50 */ 50 */
51static int procctl_frv_cachemode(ctl_table *table, int write, struct file *filp, 51static int procctl_frv_cachemode(ctl_table *table, int write, struct file *filp,
52 void *buffer, size_t *lenp, loff_t *ppos) 52 void __user *buffer, size_t *lenp, loff_t *ppos)
53{ 53{
54 unsigned long hsr0; 54 unsigned long hsr0;
55 char buff[8]; 55 char buff[8];
@@ -123,7 +123,7 @@ static int procctl_frv_cachemode(ctl_table *table, int write, struct file *filp,
123 */ 123 */
124#ifdef CONFIG_MMU 124#ifdef CONFIG_MMU
125static int procctl_frv_pin_cxnr(ctl_table *table, int write, struct file *filp, 125static int procctl_frv_pin_cxnr(ctl_table *table, int write, struct file *filp,
126 void *buffer, size_t *lenp, loff_t *ppos) 126 void __user *buffer, size_t *lenp, loff_t *ppos)
127{ 127{
128 pid_t pid; 128 pid_t pid;
129 char buff[16], *p; 129 char buff[16], *p;
diff --git a/arch/frv/kernel/uaccess.c b/arch/frv/kernel/uaccess.c
index 9b751c0f0e84..9fb771a20df3 100644
--- a/arch/frv/kernel/uaccess.c
+++ b/arch/frv/kernel/uaccess.c
@@ -17,7 +17,7 @@
17/* 17/*
18 * copy a null terminated string from userspace 18 * copy a null terminated string from userspace
19 */ 19 */
20long strncpy_from_user(char *dst, const char *src, long count) 20long strncpy_from_user(char *dst, const char __user *src, long count)
21{ 21{
22 unsigned long max; 22 unsigned long max;
23 char *p, ch; 23 char *p, ch;
@@ -70,9 +70,9 @@ EXPORT_SYMBOL(strncpy_from_user);
70 * 70 *
71 * Return 0 on exception, a value greater than N if too long 71 * Return 0 on exception, a value greater than N if too long
72 */ 72 */
73long strnlen_user(const char *src, long count) 73long strnlen_user(const char __user *src, long count)
74{ 74{
75 const char *p; 75 const char __user *p;
76 long err = 0; 76 long err = 0;
77 char ch; 77 char ch;
78 78
diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c
index c4a1144c98b0..45ae39d84b69 100644
--- a/arch/frv/mb93090-mb00/pci-irq.c
+++ b/arch/frv/mb93090-mb00/pci-irq.c
@@ -32,11 +32,11 @@
32 */ 32 */
33 33
34static const uint8_t __initdata pci_bus0_irq_routing[32][4] = { 34static const uint8_t __initdata pci_bus0_irq_routing[32][4] = {
35 [0 ] { IRQ_FPGA_MB86943_PCI_INTA }, 35 [0 ] = { IRQ_FPGA_MB86943_PCI_INTA },
36 [16] { IRQ_FPGA_RTL8029_INTA }, 36 [16] = { IRQ_FPGA_RTL8029_INTA },
37 [17] { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB }, 37 [17] = { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB },
38 [18] { IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA }, 38 [18] = { IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA },
39 [19] { IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD }, 39 [19] = { IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD },
40}; 40};
41 41
42void __init pcibios_irq_init(void) 42void __init pcibios_irq_init(void)
diff --git a/arch/frv/mm/kmap.c b/arch/frv/mm/kmap.c
index c54f18e65ea6..40b62c5c2951 100644
--- a/arch/frv/mm/kmap.c
+++ b/arch/frv/mm/kmap.c
@@ -31,15 +31,15 @@
31 * Map some physical address range into the kernel address space. 31 * Map some physical address range into the kernel address space.
32 */ 32 */
33 33
34void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) 34void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
35{ 35{
36 return (void *)physaddr; 36 return (void __iomem *)physaddr;
37} 37}
38 38
39/* 39/*
40 * Unmap a ioremap()ed region again 40 * Unmap a ioremap()ed region again
41 */ 41 */
42void iounmap(void *addr) 42void iounmap(void volatile __iomem *addr)
43{ 43{
44} 44}
45 45
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
index f13d5e82d4b9..7787f70a05bb 100644
--- a/arch/h8300/kernel/signal.c
+++ b/arch/h8300/kernel/signal.c
@@ -307,7 +307,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
307 307
308 /* This is the X/Open sanctioned signal stack switching. */ 308 /* This is the X/Open sanctioned signal stack switching. */
309 if (ka->sa.sa_flags & SA_ONSTACK) { 309 if (ka->sa.sa_flags & SA_ONSTACK) {
310 if (!on_sig_stack(usp)) 310 if (!sas_ss_flags(usp))
311 usp = current->sas_ss_sp + current->sas_ss_size; 311 usp = current->sas_ss_sp + current->sas_ss_size;
312 } 312 }
313 return (void *)((usp - frame_size) & -8UL); 313 return (void *)((usp - frame_size) & -8UL);
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 8dfa3054f10f..1596101cfaf8 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -173,6 +173,12 @@ config ACPI_SRAT
173 bool 173 bool
174 default y 174 default y
175 depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) 175 depends on NUMA && (X86_SUMMIT || X86_GENERICARCH)
176 select ACPI_NUMA
177
178config HAVE_ARCH_PARSE_SRAT
179 bool
180 default y
181 depends on ACPI_SRAT
176 182
177config X86_SUMMIT_NUMA 183config X86_SUMMIT_NUMA
178 bool 184 bool
@@ -224,7 +230,6 @@ config NR_CPUS
224config SCHED_SMT 230config SCHED_SMT
225 bool "SMT (Hyperthreading) scheduler support" 231 bool "SMT (Hyperthreading) scheduler support"
226 depends on SMP 232 depends on SMP
227 default off
228 help 233 help
229 SMT scheduler support improves the CPU scheduler's decision making 234 SMT scheduler support improves the CPU scheduler's decision making
230 when dealing with Intel Pentium 4 chips with HyperThreading at a 235 when dealing with Intel Pentium 4 chips with HyperThreading at a
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 40e5aba3ad3d..97ca17189af5 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -202,6 +202,8 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
202 if (mcfg->config[i].base_reserved) { 202 if (mcfg->config[i].base_reserved) {
203 printk(KERN_ERR PREFIX 203 printk(KERN_ERR PREFIX
204 "MMCONFIG not in low 4GB of memory\n"); 204 "MMCONFIG not in low 4GB of memory\n");
205 kfree(pci_mmcfg_config);
206 pci_mmcfg_config_num = 0;
205 return -ENODEV; 207 return -ENODEV;
206 } 208 }
207 } 209 }
@@ -215,7 +217,7 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
215{ 217{
216 struct acpi_table_madt *madt = NULL; 218 struct acpi_table_madt *madt = NULL;
217 219
218 if (!phys_addr || !size) 220 if (!phys_addr || !size || !cpu_has_apic)
219 return -EINVAL; 221 return -EINVAL;
220 222
221 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); 223 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
@@ -621,9 +623,9 @@ extern u32 pmtmr_ioport;
621 623
622static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) 624static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
623{ 625{
624 struct fadt_descriptor_rev2 *fadt = NULL; 626 struct fadt_descriptor *fadt = NULL;
625 627
626 fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size); 628 fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size);
627 if (!fadt) { 629 if (!fadt) {
628 printk(KERN_WARNING PREFIX "Unable to map FADT\n"); 630 printk(KERN_WARNING PREFIX "Unable to map FADT\n");
629 return 0; 631 return 0;
@@ -754,7 +756,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
754 return -ENODEV; 756 return -ENODEV;
755 } 757 }
756 758
757 if (!cpu_has_apic) 759 if (!cpu_has_apic)
758 return -ENODEV; 760 return -ENODEV;
759 761
760 /* 762 /*
diff --git a/arch/i386/kernel/acpi/processor.c b/arch/i386/kernel/acpi/processor.c
index 9f4cc02717ec..b54fded49834 100644
--- a/arch/i386/kernel/acpi/processor.c
+++ b/arch/i386/kernel/acpi/processor.c
@@ -47,7 +47,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
47 buf[2] = ACPI_PDC_C_CAPABILITY_SMP; 47 buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
48 48
49 if (cpu_has(c, X86_FEATURE_EST)) 49 if (cpu_has(c, X86_FEATURE_EST))
50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; 50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
51 51
52 obj->type = ACPI_TYPE_BUFFER; 52 obj->type = ACPI_TYPE_BUFFER;
53 obj->buffer.length = 12; 53 obj->buffer.length = 12;
diff --git a/arch/i386/kernel/acpi/sleep.c b/arch/i386/kernel/acpi/sleep.c
index 1cb2b186a3af..4ee83577bf61 100644
--- a/arch/i386/kernel/acpi/sleep.c
+++ b/arch/i386/kernel/acpi/sleep.c
@@ -8,30 +8,17 @@
8#include <linux/acpi.h> 8#include <linux/acpi.h>
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/dmi.h> 10#include <linux/dmi.h>
11#include <linux/cpumask.h>
12
11#include <asm/smp.h> 13#include <asm/smp.h>
12#include <asm/tlbflush.h>
13 14
14/* address in low memory of the wakeup routine. */ 15/* address in low memory of the wakeup routine. */
15unsigned long acpi_wakeup_address = 0; 16unsigned long acpi_wakeup_address = 0;
16unsigned long acpi_video_flags; 17unsigned long acpi_video_flags;
17extern char wakeup_start, wakeup_end; 18extern char wakeup_start, wakeup_end;
18 19
19extern void zap_low_mappings(void);
20
21extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); 20extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
22 21
23static void init_low_mapping(pgd_t * pgd, int pgd_limit)
24{
25 int pgd_ofs = 0;
26
27 while ((pgd_ofs < pgd_limit)
28 && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
29 set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
30 pgd_ofs++, pgd++;
31 }
32 flush_tlb_all();
33}
34
35/** 22/**
36 * acpi_save_state_mem - save kernel state 23 * acpi_save_state_mem - save kernel state
37 * 24 *
@@ -42,7 +29,6 @@ int acpi_save_state_mem(void)
42{ 29{
43 if (!acpi_wakeup_address) 30 if (!acpi_wakeup_address)
44 return 1; 31 return 1;
45 init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
46 memcpy((void *)acpi_wakeup_address, &wakeup_start, 32 memcpy((void *)acpi_wakeup_address, &wakeup_start,
47 &wakeup_end - &wakeup_start); 33 &wakeup_end - &wakeup_start);
48 acpi_copy_wakeup_routine(acpi_wakeup_address); 34 acpi_copy_wakeup_routine(acpi_wakeup_address);
@@ -55,7 +41,6 @@ int acpi_save_state_mem(void)
55 */ 41 */
56void acpi_restore_state_mem(void) 42void acpi_restore_state_mem(void)
57{ 43{
58 zap_low_mappings();
59} 44}
60 45
61/** 46/**
diff --git a/arch/i386/kernel/acpi/wakeup.S b/arch/i386/kernel/acpi/wakeup.S
index 7c74fe0dc93c..9f408eee4e6f 100644
--- a/arch/i386/kernel/acpi/wakeup.S
+++ b/arch/i386/kernel/acpi/wakeup.S
@@ -56,7 +56,7 @@ wakeup_code:
561: 561:
57 57
58 # set up page table 58 # set up page table
59 movl $swapper_pg_dir-__PAGE_OFFSET, %eax 59 movl $swsusp_pg_dir-__PAGE_OFFSET, %eax
60 movl %eax, %cr3 60 movl %eax, %cr3
61 61
62 testl $1, real_efer_save_restore - wakeup_code 62 testl $1, real_efer_save_restore - wakeup_code
@@ -265,11 +265,6 @@ ENTRY(acpi_copy_wakeup_routine)
265 movl $0x12345678, saved_magic 265 movl $0x12345678, saved_magic
266 ret 266 ret
267 267
268.data
269ALIGN
270ENTRY(saved_magic) .long 0
271ENTRY(saved_eip) .long 0
272
273save_registers: 268save_registers:
274 leal 4(%esp), %eax 269 leal 4(%esp), %eax
275 movl %eax, saved_context_esp 270 movl %eax, saved_context_esp
@@ -304,7 +299,11 @@ ret_point:
304 call restore_processor_state 299 call restore_processor_state
305 ret 300 ret
306 301
302.data
307ALIGN 303ALIGN
304ENTRY(saved_magic) .long 0
305ENTRY(saved_eip) .long 0
306
308# saved registers 307# saved registers
309saved_gdt: .long 0,0 308saved_gdt: .long 0,0
310saved_idt: .long 0,0 309saved_idt: .long 0,0
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 3d4b2f3d116a..5ab59c12335b 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -62,7 +62,7 @@ int apic_verbosity;
62 62
63static void apic_pm_activate(void); 63static void apic_pm_activate(void);
64 64
65int modern_apic(void) 65static int modern_apic(void)
66{ 66{
67 unsigned int lvr, version; 67 unsigned int lvr, version;
68 /* AMD systems use old APIC versions, so check the CPU */ 68 /* AMD systems use old APIC versions, so check the CPU */
@@ -113,7 +113,7 @@ void __init apic_intr_init(void)
113} 113}
114 114
115/* Using APIC to generate smp_local_timer_interrupt? */ 115/* Using APIC to generate smp_local_timer_interrupt? */
116int using_apic_timer = 0; 116int using_apic_timer __read_mostly = 0;
117 117
118static int enabled_via_apicbase; 118static int enabled_via_apicbase;
119 119
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index df0e1745f189..9e819eb68229 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -374,14 +374,14 @@ static struct {
374 unsigned short segment; 374 unsigned short segment;
375} apm_bios_entry; 375} apm_bios_entry;
376static int clock_slowed; 376static int clock_slowed;
377static int idle_threshold = DEFAULT_IDLE_THRESHOLD; 377static int idle_threshold __read_mostly = DEFAULT_IDLE_THRESHOLD;
378static int idle_period = DEFAULT_IDLE_PERIOD; 378static int idle_period __read_mostly = DEFAULT_IDLE_PERIOD;
379static int set_pm_idle; 379static int set_pm_idle;
380static int suspends_pending; 380static int suspends_pending;
381static int standbys_pending; 381static int standbys_pending;
382static int ignore_sys_suspend; 382static int ignore_sys_suspend;
383static int ignore_normal_resume; 383static int ignore_normal_resume;
384static int bounce_interval = DEFAULT_BOUNCE_INTERVAL; 384static int bounce_interval __read_mostly = DEFAULT_BOUNCE_INTERVAL;
385 385
386#ifdef CONFIG_APM_RTC_IS_GMT 386#ifdef CONFIG_APM_RTC_IS_GMT
387# define clock_cmos_diff 0 387# define clock_cmos_diff 0
@@ -390,8 +390,8 @@ static int bounce_interval = DEFAULT_BOUNCE_INTERVAL;
390static long clock_cmos_diff; 390static long clock_cmos_diff;
391static int got_clock_diff; 391static int got_clock_diff;
392#endif 392#endif
393static int debug; 393static int debug __read_mostly;
394static int smp; 394static int smp __read_mostly;
395static int apm_disabled = -1; 395static int apm_disabled = -1;
396#ifdef CONFIG_SMP 396#ifdef CONFIG_SMP
397static int power_off; 397static int power_off;
@@ -403,8 +403,8 @@ static int realmode_power_off = 1;
403#else 403#else
404static int realmode_power_off; 404static int realmode_power_off;
405#endif 405#endif
406static int exit_kapmd; 406static int exit_kapmd __read_mostly;
407static int kapmd_running; 407static int kapmd_running __read_mostly;
408#ifdef CONFIG_APM_ALLOW_INTS 408#ifdef CONFIG_APM_ALLOW_INTS
409static int allow_ints = 1; 409static int allow_ints = 1;
410#else 410#else
@@ -416,15 +416,15 @@ static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
416static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); 416static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
417static struct apm_user * user_list; 417static struct apm_user * user_list;
418static DEFINE_SPINLOCK(user_list_lock); 418static DEFINE_SPINLOCK(user_list_lock);
419static struct desc_struct bad_bios_desc = { 0, 0x00409200 }; 419static const struct desc_struct bad_bios_desc = { 0, 0x00409200 };
420 420
421static char driver_version[] = "1.16ac"; /* no spaces */ 421static const char driver_version[] = "1.16ac"; /* no spaces */
422 422
423/* 423/*
424 * APM event names taken from the APM 1.2 specification. These are 424 * APM event names taken from the APM 1.2 specification. These are
425 * the message codes that the BIOS uses to tell us about events 425 * the message codes that the BIOS uses to tell us about events
426 */ 426 */
427static char * apm_event_name[] = { 427static const char * const apm_event_name[] = {
428 "system standby", 428 "system standby",
429 "system suspend", 429 "system suspend",
430 "normal resume", 430 "normal resume",
@@ -616,7 +616,7 @@ static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in,
616 * @ecx_in: ECX register value for BIOS call 616 * @ecx_in: ECX register value for BIOS call
617 * @eax: EAX register on return from the BIOS call 617 * @eax: EAX register on return from the BIOS call
618 * 618 *
619 * Make a BIOS call that does only returns one value, or just status. 619 * Make a BIOS call that returns one value only, or just status.
620 * If there is an error, then the error code is returned in AH 620 * If there is an error, then the error code is returned in AH
621 * (bits 8-15 of eax) and this function returns non-zero. This is 621 * (bits 8-15 of eax) and this function returns non-zero. This is
622 * used for simpler BIOS operations. This call may hold interrupts 622 * used for simpler BIOS operations. This call may hold interrupts
@@ -822,7 +822,7 @@ static void apm_do_busy(void)
822#define IDLE_CALC_LIMIT (HZ * 100) 822#define IDLE_CALC_LIMIT (HZ * 100)
823#define IDLE_LEAKY_MAX 16 823#define IDLE_LEAKY_MAX 16
824 824
825static void (*original_pm_idle)(void); 825static void (*original_pm_idle)(void) __read_mostly;
826 826
827/** 827/**
828 * apm_cpu_idle - cpu idling for APM capable Linux 828 * apm_cpu_idle - cpu idling for APM capable Linux
@@ -1063,7 +1063,8 @@ static int apm_engage_power_management(u_short device, int enable)
1063 1063
1064static int apm_console_blank(int blank) 1064static int apm_console_blank(int blank)
1065{ 1065{
1066 int error, i; 1066 int error = APM_NOT_ENGAGED; /* silence gcc */
1067 int i;
1067 u_short state; 1068 u_short state;
1068 static const u_short dev[3] = { 0x100, 0x1FF, 0x101 }; 1069 static const u_short dev[3] = { 0x100, 0x1FF, 0x101 };
1069 1070
@@ -1104,7 +1105,8 @@ static int queue_empty(struct apm_user *as)
1104 1105
1105static apm_event_t get_queued_event(struct apm_user *as) 1106static apm_event_t get_queued_event(struct apm_user *as)
1106{ 1107{
1107 as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; 1108 if (++as->event_tail >= APM_MAX_EVENTS)
1109 as->event_tail = 0;
1108 return as->events[as->event_tail]; 1110 return as->events[as->event_tail];
1109} 1111}
1110 1112
@@ -1118,13 +1120,16 @@ static void queue_event(apm_event_t event, struct apm_user *sender)
1118 for (as = user_list; as != NULL; as = as->next) { 1120 for (as = user_list; as != NULL; as = as->next) {
1119 if ((as == sender) || (!as->reader)) 1121 if ((as == sender) || (!as->reader))
1120 continue; 1122 continue;
1121 as->event_head = (as->event_head + 1) % APM_MAX_EVENTS; 1123 if (++as->event_head >= APM_MAX_EVENTS)
1124 as->event_head = 0;
1125
1122 if (as->event_head == as->event_tail) { 1126 if (as->event_head == as->event_tail) {
1123 static int notified; 1127 static int notified;
1124 1128
1125 if (notified++ == 0) 1129 if (notified++ == 0)
1126 printk(KERN_ERR "apm: an event queue overflowed\n"); 1130 printk(KERN_ERR "apm: an event queue overflowed\n");
1127 as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; 1131 if (++as->event_tail >= APM_MAX_EVENTS)
1132 as->event_tail = 0;
1128 } 1133 }
1129 as->events[as->event_head] = event; 1134 as->events[as->event_head] = event;
1130 if ((!as->suser) || (!as->writer)) 1135 if ((!as->suser) || (!as->writer))
@@ -1282,7 +1287,7 @@ static void standby(void)
1282static apm_event_t get_event(void) 1287static apm_event_t get_event(void)
1283{ 1288{
1284 int error; 1289 int error;
1285 apm_event_t event; 1290 apm_event_t event = APM_NO_EVENTS; /* silence gcc */
1286 apm_eventinfo_t info; 1291 apm_eventinfo_t info;
1287 1292
1288 static int notified; 1293 static int notified;
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index a06a49075f10..44f2c5f2dda1 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -11,6 +11,8 @@
11#include <asm/msr.h> 11#include <asm/msr.h>
12#include <asm/io.h> 12#include <asm/io.h>
13#include <asm/mmu_context.h> 13#include <asm/mmu_context.h>
14#include <asm/mtrr.h>
15#include <asm/mce.h>
14#ifdef CONFIG_X86_LOCAL_APIC 16#ifdef CONFIG_X86_LOCAL_APIC
15#include <asm/mpspec.h> 17#include <asm/mpspec.h>
16#include <asm/apic.h> 18#include <asm/apic.h>
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 1a7bdcef1926..05668e3598c0 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -48,12 +48,13 @@ MODULE_LICENSE("GPL");
48 48
49 49
50struct cpufreq_acpi_io { 50struct cpufreq_acpi_io {
51 struct acpi_processor_performance acpi_data; 51 struct acpi_processor_performance *acpi_data;
52 struct cpufreq_frequency_table *freq_table; 52 struct cpufreq_frequency_table *freq_table;
53 unsigned int resume; 53 unsigned int resume;
54}; 54};
55 55
56static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; 56static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS];
57static struct acpi_processor_performance *acpi_perf_data[NR_CPUS];
57 58
58static struct cpufreq_driver acpi_cpufreq_driver; 59static struct cpufreq_driver acpi_cpufreq_driver;
59 60
@@ -104,64 +105,43 @@ acpi_processor_set_performance (
104{ 105{
105 u16 port = 0; 106 u16 port = 0;
106 u8 bit_width = 0; 107 u8 bit_width = 0;
107 int ret;
108 u32 value = 0;
109 int i = 0; 108 int i = 0;
110 struct cpufreq_freqs cpufreq_freqs; 109 int ret = 0;
111 cpumask_t saved_mask; 110 u32 value = 0;
112 int retval; 111 int retval;
112 struct acpi_processor_performance *perf;
113 113
114 dprintk("acpi_processor_set_performance\n"); 114 dprintk("acpi_processor_set_performance\n");
115 115
116 /* 116 retval = 0;
117 * TBD: Use something other than set_cpus_allowed. 117 perf = data->acpi_data;
118 * As set_cpus_allowed is a bit racy, 118 if (state == perf->state) {
119 * with any other set_cpus_allowed for this process.
120 */
121 saved_mask = current->cpus_allowed;
122 set_cpus_allowed(current, cpumask_of_cpu(cpu));
123 if (smp_processor_id() != cpu) {
124 return (-EAGAIN);
125 }
126
127 if (state == data->acpi_data.state) {
128 if (unlikely(data->resume)) { 119 if (unlikely(data->resume)) {
129 dprintk("Called after resume, resetting to P%d\n", state); 120 dprintk("Called after resume, resetting to P%d\n", state);
130 data->resume = 0; 121 data->resume = 0;
131 } else { 122 } else {
132 dprintk("Already at target state (P%d)\n", state); 123 dprintk("Already at target state (P%d)\n", state);
133 retval = 0; 124 return (retval);
134 goto migrate_end;
135 } 125 }
136 } 126 }
137 127
138 dprintk("Transitioning from P%d to P%d\n", 128 dprintk("Transitioning from P%d to P%d\n", perf->state, state);
139 data->acpi_data.state, state);
140
141 /* cpufreq frequency struct */
142 cpufreq_freqs.cpu = cpu;
143 cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency;
144 cpufreq_freqs.new = data->freq_table[state].frequency;
145
146 /* notify cpufreq */
147 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);
148 129
149 /* 130 /*
150 * First we write the target state's 'control' value to the 131 * First we write the target state's 'control' value to the
151 * control_register. 132 * control_register.
152 */ 133 */
153 134
154 port = data->acpi_data.control_register.address; 135 port = perf->control_register.address;
155 bit_width = data->acpi_data.control_register.bit_width; 136 bit_width = perf->control_register.bit_width;
156 value = (u32) data->acpi_data.states[state].control; 137 value = (u32) perf->states[state].control;
157 138
158 dprintk("Writing 0x%08x to port 0x%04x\n", value, port); 139 dprintk("Writing 0x%08x to port 0x%04x\n", value, port);
159 140
160 ret = acpi_processor_write_port(port, bit_width, value); 141 ret = acpi_processor_write_port(port, bit_width, value);
161 if (ret) { 142 if (ret) {
162 dprintk("Invalid port width 0x%04x\n", bit_width); 143 dprintk("Invalid port width 0x%04x\n", bit_width);
163 retval = ret; 144 return (ret);
164 goto migrate_end;
165 } 145 }
166 146
167 /* 147 /*
@@ -177,48 +157,35 @@ acpi_processor_set_performance (
177 * before giving up. 157 * before giving up.
178 */ 158 */
179 159
180 port = data->acpi_data.status_register.address; 160 port = perf->status_register.address;
181 bit_width = data->acpi_data.status_register.bit_width; 161 bit_width = perf->status_register.bit_width;
182 162
183 dprintk("Looking for 0x%08x from port 0x%04x\n", 163 dprintk("Looking for 0x%08x from port 0x%04x\n",
184 (u32) data->acpi_data.states[state].status, port); 164 (u32) perf->states[state].status, port);
185 165
186 for (i=0; i<100; i++) { 166 for (i = 0; i < 100; i++) {
187 ret = acpi_processor_read_port(port, bit_width, &value); 167 ret = acpi_processor_read_port(port, bit_width, &value);
188 if (ret) { 168 if (ret) {
189 dprintk("Invalid port width 0x%04x\n", bit_width); 169 dprintk("Invalid port width 0x%04x\n", bit_width);
190 retval = ret; 170 return (ret);
191 goto migrate_end;
192 } 171 }
193 if (value == (u32) data->acpi_data.states[state].status) 172 if (value == (u32) perf->states[state].status)
194 break; 173 break;
195 udelay(10); 174 udelay(10);
196 } 175 }
197 } else { 176 } else {
198 value = (u32) data->acpi_data.states[state].status; 177 value = (u32) perf->states[state].status;
199 } 178 }
200 179
201 /* notify cpufreq */ 180 if (unlikely(value != (u32) perf->states[state].status)) {
202 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
203
204 if (unlikely(value != (u32) data->acpi_data.states[state].status)) {
205 unsigned int tmp = cpufreq_freqs.new;
206 cpufreq_freqs.new = cpufreq_freqs.old;
207 cpufreq_freqs.old = tmp;
208 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);
209 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
210 printk(KERN_WARNING "acpi-cpufreq: Transition failed\n"); 181 printk(KERN_WARNING "acpi-cpufreq: Transition failed\n");
211 retval = -ENODEV; 182 retval = -ENODEV;
212 goto migrate_end; 183 return (retval);
213 } 184 }
214 185
215 dprintk("Transition successful after %d microseconds\n", i * 10); 186 dprintk("Transition successful after %d microseconds\n", i * 10);
216 187
217 data->acpi_data.state = state; 188 perf->state = state;
218
219 retval = 0;
220migrate_end:
221 set_cpus_allowed(current, saved_mask);
222 return (retval); 189 return (retval);
223} 190}
224 191
@@ -230,8 +197,17 @@ acpi_cpufreq_target (
230 unsigned int relation) 197 unsigned int relation)
231{ 198{
232 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; 199 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu];
200 struct acpi_processor_performance *perf;
201 struct cpufreq_freqs freqs;
202 cpumask_t online_policy_cpus;
203 cpumask_t saved_mask;
204 cpumask_t set_mask;
205 cpumask_t covered_cpus;
206 unsigned int cur_state = 0;
233 unsigned int next_state = 0; 207 unsigned int next_state = 0;
234 unsigned int result = 0; 208 unsigned int result = 0;
209 unsigned int j;
210 unsigned int tmp;
235 211
236 dprintk("acpi_cpufreq_setpolicy\n"); 212 dprintk("acpi_cpufreq_setpolicy\n");
237 213
@@ -240,11 +216,95 @@ acpi_cpufreq_target (
240 target_freq, 216 target_freq,
241 relation, 217 relation,
242 &next_state); 218 &next_state);
243 if (result) 219 if (unlikely(result))
244 return (result); 220 return (result);
245 221
246 result = acpi_processor_set_performance (data, policy->cpu, next_state); 222 perf = data->acpi_data;
223 cur_state = perf->state;
224 freqs.old = data->freq_table[cur_state].frequency;
225 freqs.new = data->freq_table[next_state].frequency;
226
227#ifdef CONFIG_HOTPLUG_CPU
228 /* cpufreq holds the hotplug lock, so we are safe from here on */
229 cpus_and(online_policy_cpus, cpu_online_map, policy->cpus);
230#else
231 online_policy_cpus = policy->cpus;
232#endif
233
234 for_each_cpu_mask(j, online_policy_cpus) {
235 freqs.cpu = j;
236 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
237 }
238
239 /*
240 * We need to call driver->target() on all or any CPU in
241 * policy->cpus, depending on policy->shared_type.
242 */
243 saved_mask = current->cpus_allowed;
244 cpus_clear(covered_cpus);
245 for_each_cpu_mask(j, online_policy_cpus) {
246 /*
247 * Support for SMP systems.
248 * Make sure we are running on CPU that wants to change freq
249 */
250 cpus_clear(set_mask);
251 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
252 cpus_or(set_mask, set_mask, online_policy_cpus);
253 else
254 cpu_set(j, set_mask);
255
256 set_cpus_allowed(current, set_mask);
257 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
258 dprintk("couldn't limit to CPUs in this domain\n");
259 result = -EAGAIN;
260 break;
261 }
262
263 result = acpi_processor_set_performance (data, j, next_state);
264 if (result) {
265 result = -EAGAIN;
266 break;
267 }
268
269 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
270 break;
271
272 cpu_set(j, covered_cpus);
273 }
274
275 for_each_cpu_mask(j, online_policy_cpus) {
276 freqs.cpu = j;
277 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
278 }
247 279
280 if (unlikely(result)) {
281 /*
282 * We have failed halfway through the frequency change.
283 * We have sent callbacks to online_policy_cpus and
284 * acpi_processor_set_performance() has been called on
285 * coverd_cpus. Best effort undo..
286 */
287
288 if (!cpus_empty(covered_cpus)) {
289 for_each_cpu_mask(j, covered_cpus) {
290 policy->cpu = j;
291 acpi_processor_set_performance (data,
292 j,
293 cur_state);
294 }
295 }
296
297 tmp = freqs.new;
298 freqs.new = freqs.old;
299 freqs.old = tmp;
300 for_each_cpu_mask(j, online_policy_cpus) {
301 freqs.cpu = j;
302 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
303 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
304 }
305 }
306
307 set_cpus_allowed(current, saved_mask);
248 return (result); 308 return (result);
249} 309}
250 310
@@ -270,30 +330,65 @@ acpi_cpufreq_guess_freq (
270 struct cpufreq_acpi_io *data, 330 struct cpufreq_acpi_io *data,
271 unsigned int cpu) 331 unsigned int cpu)
272{ 332{
333 struct acpi_processor_performance *perf = data->acpi_data;
334
273 if (cpu_khz) { 335 if (cpu_khz) {
274 /* search the closest match to cpu_khz */ 336 /* search the closest match to cpu_khz */
275 unsigned int i; 337 unsigned int i;
276 unsigned long freq; 338 unsigned long freq;
277 unsigned long freqn = data->acpi_data.states[0].core_frequency * 1000; 339 unsigned long freqn = perf->states[0].core_frequency * 1000;
278 340
279 for (i=0; i < (data->acpi_data.state_count - 1); i++) { 341 for (i = 0; i < (perf->state_count - 1); i++) {
280 freq = freqn; 342 freq = freqn;
281 freqn = data->acpi_data.states[i+1].core_frequency * 1000; 343 freqn = perf->states[i+1].core_frequency * 1000;
282 if ((2 * cpu_khz) > (freqn + freq)) { 344 if ((2 * cpu_khz) > (freqn + freq)) {
283 data->acpi_data.state = i; 345 perf->state = i;
284 return (freq); 346 return (freq);
285 } 347 }
286 } 348 }
287 data->acpi_data.state = data->acpi_data.state_count - 1; 349 perf->state = perf->state_count - 1;
288 return (freqn); 350 return (freqn);
289 } else 351 } else {
290 /* assume CPU is at P0... */ 352 /* assume CPU is at P0... */
291 data->acpi_data.state = 0; 353 perf->state = 0;
292 return data->acpi_data.states[0].core_frequency * 1000; 354 return perf->states[0].core_frequency * 1000;
293 355 }
294} 356}
295 357
296 358
359/*
360 * acpi_cpufreq_early_init - initialize ACPI P-States library
361 *
362 * Initialize the ACPI P-States library (drivers/acpi/processor_perflib.c)
363 * in order to determine correct frequency and voltage pairings. We can
364 * do _PDC and _PSD and find out the processor dependency for the
365 * actual init that will happen later...
366 */
367static int acpi_cpufreq_early_init_acpi(void)
368{
369 struct acpi_processor_performance *data;
370 unsigned int i, j;
371
372 dprintk("acpi_cpufreq_early_init\n");
373
374 for_each_cpu(i) {
375 data = kzalloc(sizeof(struct acpi_processor_performance),
376 GFP_KERNEL);
377 if (!data) {
378 for_each_cpu(j) {
379 kfree(acpi_perf_data[j]);
380 acpi_perf_data[j] = NULL;
381 }
382 return (-ENOMEM);
383 }
384 acpi_perf_data[i] = data;
385 }
386
387 /* Do initialization in ACPI core */
388 acpi_processor_preregister_performance(acpi_perf_data);
389 return 0;
390}
391
297static int 392static int
298acpi_cpufreq_cpu_init ( 393acpi_cpufreq_cpu_init (
299 struct cpufreq_policy *policy) 394 struct cpufreq_policy *policy)
@@ -303,41 +398,51 @@ acpi_cpufreq_cpu_init (
303 struct cpufreq_acpi_io *data; 398 struct cpufreq_acpi_io *data;
304 unsigned int result = 0; 399 unsigned int result = 0;
305 struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; 400 struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
401 struct acpi_processor_performance *perf;
306 402
307 dprintk("acpi_cpufreq_cpu_init\n"); 403 dprintk("acpi_cpufreq_cpu_init\n");
308 404
405 if (!acpi_perf_data[cpu])
406 return (-ENODEV);
407
309 data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); 408 data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
310 if (!data) 409 if (!data)
311 return (-ENOMEM); 410 return (-ENOMEM);
312 411
412 data->acpi_data = acpi_perf_data[cpu];
313 acpi_io_data[cpu] = data; 413 acpi_io_data[cpu] = data;
314 414
315 result = acpi_processor_register_performance(&data->acpi_data, cpu); 415 result = acpi_processor_register_performance(data->acpi_data, cpu);
316 416
317 if (result) 417 if (result)
318 goto err_free; 418 goto err_free;
319 419
420 perf = data->acpi_data;
421 policy->cpus = perf->shared_cpu_map;
422 policy->shared_type = perf->shared_type;
423
320 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { 424 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
321 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; 425 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
322 } 426 }
323 427
324 /* capability check */ 428 /* capability check */
325 if (data->acpi_data.state_count <= 1) { 429 if (perf->state_count <= 1) {
326 dprintk("No P-States\n"); 430 dprintk("No P-States\n");
327 result = -ENODEV; 431 result = -ENODEV;
328 goto err_unreg; 432 goto err_unreg;
329 } 433 }
330 if ((data->acpi_data.control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || 434
331 (data->acpi_data.status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { 435 if ((perf->control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) ||
436 (perf->status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
332 dprintk("Unsupported address space [%d, %d]\n", 437 dprintk("Unsupported address space [%d, %d]\n",
333 (u32) (data->acpi_data.control_register.space_id), 438 (u32) (perf->control_register.space_id),
334 (u32) (data->acpi_data.status_register.space_id)); 439 (u32) (perf->status_register.space_id));
335 result = -ENODEV; 440 result = -ENODEV;
336 goto err_unreg; 441 goto err_unreg;
337 } 442 }
338 443
339 /* alloc freq_table */ 444 /* alloc freq_table */
340 data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (data->acpi_data.state_count + 1), GFP_KERNEL); 445 data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count + 1), GFP_KERNEL);
341 if (!data->freq_table) { 446 if (!data->freq_table) {
342 result = -ENOMEM; 447 result = -ENOMEM;
343 goto err_unreg; 448 goto err_unreg;
@@ -345,9 +450,9 @@ acpi_cpufreq_cpu_init (
345 450
346 /* detect transition latency */ 451 /* detect transition latency */
347 policy->cpuinfo.transition_latency = 0; 452 policy->cpuinfo.transition_latency = 0;
348 for (i=0; i<data->acpi_data.state_count; i++) { 453 for (i=0; i<perf->state_count; i++) {
349 if ((data->acpi_data.states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) 454 if ((perf->states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency)
350 policy->cpuinfo.transition_latency = data->acpi_data.states[i].transition_latency * 1000; 455 policy->cpuinfo.transition_latency = perf->states[i].transition_latency * 1000;
351 } 456 }
352 policy->governor = CPUFREQ_DEFAULT_GOVERNOR; 457 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
353 458
@@ -355,11 +460,11 @@ acpi_cpufreq_cpu_init (
355 policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); 460 policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
356 461
357 /* table init */ 462 /* table init */
358 for (i=0; i<=data->acpi_data.state_count; i++) 463 for (i=0; i<=perf->state_count; i++)
359 { 464 {
360 data->freq_table[i].index = i; 465 data->freq_table[i].index = i;
361 if (i<data->acpi_data.state_count) 466 if (i<perf->state_count)
362 data->freq_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000; 467 data->freq_table[i].frequency = perf->states[i].core_frequency * 1000;
363 else 468 else
364 data->freq_table[i].frequency = CPUFREQ_TABLE_END; 469 data->freq_table[i].frequency = CPUFREQ_TABLE_END;
365 } 470 }
@@ -374,12 +479,12 @@ acpi_cpufreq_cpu_init (
374 479
375 printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n", 480 printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n",
376 cpu); 481 cpu);
377 for (i = 0; i < data->acpi_data.state_count; i++) 482 for (i = 0; i < perf->state_count; i++)
378 dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", 483 dprintk(" %cP%d: %d MHz, %d mW, %d uS\n",
379 (i == data->acpi_data.state?'*':' '), i, 484 (i == perf->state?'*':' '), i,
380 (u32) data->acpi_data.states[i].core_frequency, 485 (u32) perf->states[i].core_frequency,
381 (u32) data->acpi_data.states[i].power, 486 (u32) perf->states[i].power,
382 (u32) data->acpi_data.states[i].transition_latency); 487 (u32) perf->states[i].transition_latency);
383 488
384 cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); 489 cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu);
385 490
@@ -394,7 +499,7 @@ acpi_cpufreq_cpu_init (
394 err_freqfree: 499 err_freqfree:
395 kfree(data->freq_table); 500 kfree(data->freq_table);
396 err_unreg: 501 err_unreg:
397 acpi_processor_unregister_performance(&data->acpi_data, cpu); 502 acpi_processor_unregister_performance(perf, cpu);
398 err_free: 503 err_free:
399 kfree(data); 504 kfree(data);
400 acpi_io_data[cpu] = NULL; 505 acpi_io_data[cpu] = NULL;
@@ -415,7 +520,7 @@ acpi_cpufreq_cpu_exit (
415 if (data) { 520 if (data) {
416 cpufreq_frequency_table_put_attr(policy->cpu); 521 cpufreq_frequency_table_put_attr(policy->cpu);
417 acpi_io_data[policy->cpu] = NULL; 522 acpi_io_data[policy->cpu] = NULL;
418 acpi_processor_unregister_performance(&data->acpi_data, policy->cpu); 523 acpi_processor_unregister_performance(data->acpi_data, policy->cpu);
419 kfree(data); 524 kfree(data);
420 } 525 }
421 526
@@ -462,7 +567,10 @@ acpi_cpufreq_init (void)
462 567
463 dprintk("acpi_cpufreq_init\n"); 568 dprintk("acpi_cpufreq_init\n");
464 569
465 result = cpufreq_register_driver(&acpi_cpufreq_driver); 570 result = acpi_cpufreq_early_init_acpi();
571
572 if (!result)
573 result = cpufreq_register_driver(&acpi_cpufreq_driver);
466 574
467 return (result); 575 return (result);
468} 576}
@@ -471,10 +579,15 @@ acpi_cpufreq_init (void)
471static void __exit 579static void __exit
472acpi_cpufreq_exit (void) 580acpi_cpufreq_exit (void)
473{ 581{
582 unsigned int i;
474 dprintk("acpi_cpufreq_exit\n"); 583 dprintk("acpi_cpufreq_exit\n");
475 584
476 cpufreq_unregister_driver(&acpi_cpufreq_driver); 585 cpufreq_unregister_driver(&acpi_cpufreq_driver);
477 586
587 for_each_cpu(i) {
588 kfree(acpi_perf_data[i]);
589 acpi_perf_data[i] = NULL;
590 }
478 return; 591 return;
479} 592}
480 593
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index b4277f58f40c..2d6491672559 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -120,7 +120,7 @@ static int pending_bit_stuck(void)
120{ 120{
121 u32 lo, hi; 121 u32 lo, hi;
122 122
123 if (cpu_family) 123 if (cpu_family == CPU_HW_PSTATE)
124 return 0; 124 return 0;
125 125
126 rdmsr(MSR_FIDVID_STATUS, lo, hi); 126 rdmsr(MSR_FIDVID_STATUS, lo, hi);
@@ -136,7 +136,7 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
136 u32 lo, hi; 136 u32 lo, hi;
137 u32 i = 0; 137 u32 i = 0;
138 138
139 if (cpu_family) { 139 if (cpu_family == CPU_HW_PSTATE) {
140 rdmsr(MSR_PSTATE_STATUS, lo, hi); 140 rdmsr(MSR_PSTATE_STATUS, lo, hi);
141 i = lo & HW_PSTATE_MASK; 141 i = lo & HW_PSTATE_MASK;
142 rdmsr(MSR_PSTATE_DEF_BASE + i, lo, hi); 142 rdmsr(MSR_PSTATE_DEF_BASE + i, lo, hi);
@@ -598,7 +598,7 @@ static void print_basics(struct powernow_k8_data *data)
598 int j; 598 int j;
599 for (j = 0; j < data->numps; j++) { 599 for (j = 0; j < data->numps; j++) {
600 if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) { 600 if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) {
601 if (cpu_family) { 601 if (cpu_family == CPU_HW_PSTATE) {
602 printk(KERN_INFO PFX " %d : fid 0x%x gid 0x%x (%d MHz)\n", j, (data->powernow_table[j].index & 0xff00) >> 8, 602 printk(KERN_INFO PFX " %d : fid 0x%x gid 0x%x (%d MHz)\n", j, (data->powernow_table[j].index & 0xff00) >> 8,
603 (data->powernow_table[j].index & 0xff0000) >> 16, 603 (data->powernow_table[j].index & 0xff0000) >> 16,
604 data->powernow_table[j].frequency/1000); 604 data->powernow_table[j].frequency/1000);
@@ -758,7 +758,7 @@ static int find_psb_table(struct powernow_k8_data *data)
758#ifdef CONFIG_X86_POWERNOW_K8_ACPI 758#ifdef CONFIG_X86_POWERNOW_K8_ACPI
759static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) 759static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index)
760{ 760{
761 if (!data->acpi_data.state_count || cpu_family) 761 if (!data->acpi_data.state_count || (cpu_family == CPU_HW_PSTATE))
762 return; 762 return;
763 763
764 data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK; 764 data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK;
@@ -801,7 +801,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
801 goto err_out; 801 goto err_out;
802 } 802 }
803 803
804 if (cpu_family) 804 if (cpu_family == CPU_HW_PSTATE)
805 ret_val = fill_powernow_table_pstate(data, powernow_table); 805 ret_val = fill_powernow_table_pstate(data, powernow_table);
806 else 806 else
807 ret_val = fill_powernow_table_fidvid(data, powernow_table); 807 ret_val = fill_powernow_table_fidvid(data, powernow_table);
@@ -885,8 +885,8 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpuf
885 u32 vid; 885 u32 vid;
886 886
887 if (data->exttype) { 887 if (data->exttype) {
888 fid = data->acpi_data.states[i].status & FID_MASK; 888 fid = data->acpi_data.states[i].status & EXT_FID_MASK;
889 vid = (data->acpi_data.states[i].status >> VID_SHIFT) & VID_MASK; 889 vid = (data->acpi_data.states[i].status >> VID_SHIFT) & EXT_VID_MASK;
890 } else { 890 } else {
891 fid = data->acpi_data.states[i].control & FID_MASK; 891 fid = data->acpi_data.states[i].control & FID_MASK;
892 vid = (data->acpi_data.states[i].control >> VID_SHIFT) & VID_MASK; 892 vid = (data->acpi_data.states[i].control >> VID_SHIFT) & VID_MASK;
@@ -1082,7 +1082,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1082 if (query_current_values_with_pending_wait(data)) 1082 if (query_current_values_with_pending_wait(data))
1083 goto err_out; 1083 goto err_out;
1084 1084
1085 if (cpu_family) 1085 if (cpu_family == CPU_HW_PSTATE)
1086 dprintk("targ: curr fid 0x%x, did 0x%x\n", 1086 dprintk("targ: curr fid 0x%x, did 0x%x\n",
1087 data->currfid, data->currvid); 1087 data->currfid, data->currvid);
1088 else { 1088 else {
@@ -1103,7 +1103,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1103 1103
1104 powernow_k8_acpi_pst_values(data, newstate); 1104 powernow_k8_acpi_pst_values(data, newstate);
1105 1105
1106 if (cpu_family) 1106 if (cpu_family == CPU_HW_PSTATE)
1107 ret = transition_frequency_pstate(data, newstate); 1107 ret = transition_frequency_pstate(data, newstate);
1108 else 1108 else
1109 ret = transition_frequency_fidvid(data, newstate); 1109 ret = transition_frequency_fidvid(data, newstate);
@@ -1115,7 +1115,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1115 } 1115 }
1116 mutex_unlock(&fidvid_mutex); 1116 mutex_unlock(&fidvid_mutex);
1117 1117
1118 if (cpu_family) 1118 if (cpu_family == CPU_HW_PSTATE)
1119 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1119 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1120 else 1120 else
1121 pol->cur = find_khz_freq_from_fid(data->currfid); 1121 pol->cur = find_khz_freq_from_fid(data->currfid);
@@ -1163,7 +1163,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1163 * Use the PSB BIOS structure. This is only availabe on 1163 * Use the PSB BIOS structure. This is only availabe on
1164 * an UP version, and is deprecated by AMD. 1164 * an UP version, and is deprecated by AMD.
1165 */ 1165 */
1166 if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) { 1166 if (num_online_cpus() != 1) {
1167 printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n"); 1167 printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n");
1168 kfree(data); 1168 kfree(data);
1169 return -ENODEV; 1169 return -ENODEV;
@@ -1197,14 +1197,14 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1197 if (query_current_values_with_pending_wait(data)) 1197 if (query_current_values_with_pending_wait(data))
1198 goto err_out; 1198 goto err_out;
1199 1199
1200 if (!cpu_family) 1200 if (cpu_family == CPU_OPTERON)
1201 fidvid_msr_init(); 1201 fidvid_msr_init();
1202 1202
1203 /* run on any CPU again */ 1203 /* run on any CPU again */
1204 set_cpus_allowed(current, oldmask); 1204 set_cpus_allowed(current, oldmask);
1205 1205
1206 pol->governor = CPUFREQ_DEFAULT_GOVERNOR; 1206 pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
1207 if (cpu_family) 1207 if (cpu_family == CPU_HW_PSTATE)
1208 pol->cpus = cpumask_of_cpu(pol->cpu); 1208 pol->cpus = cpumask_of_cpu(pol->cpu);
1209 else 1209 else
1210 pol->cpus = cpu_core_map[pol->cpu]; 1210 pol->cpus = cpu_core_map[pol->cpu];
@@ -1215,7 +1215,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1215 pol->cpuinfo.transition_latency = (((data->rvo + 8) * data->vstable * VST_UNITS_20US) 1215 pol->cpuinfo.transition_latency = (((data->rvo + 8) * data->vstable * VST_UNITS_20US)
1216 + (3 * (1 << data->irt) * 10)) * 1000; 1216 + (3 * (1 << data->irt) * 10)) * 1000;
1217 1217
1218 if (cpu_family) 1218 if (cpu_family == CPU_HW_PSTATE)
1219 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1219 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1220 else 1220 else
1221 pol->cur = find_khz_freq_from_fid(data->currfid); 1221 pol->cur = find_khz_freq_from_fid(data->currfid);
@@ -1232,7 +1232,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1232 1232
1233 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); 1233 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu);
1234 1234
1235 if (cpu_family) 1235 if (cpu_family == CPU_HW_PSTATE)
1236 dprintk("cpu_init done, current fid 0x%x, did 0x%x\n", 1236 dprintk("cpu_init done, current fid 0x%x, did 0x%x\n",
1237 data->currfid, data->currdid); 1237 data->currfid, data->currdid);
1238 else 1238 else
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index bf8ad9e43da3..0fb2a3001ba5 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -169,7 +169,9 @@ struct powernow_k8_data {
169#define MVS_MASK 3 169#define MVS_MASK 3
170#define VST_MASK 0x7f 170#define VST_MASK 0x7f
171#define VID_MASK 0x1f 171#define VID_MASK 0x1f
172#define FID_MASK 0x3f 172#define FID_MASK 0x1f
173#define EXT_VID_MASK 0x3f
174#define EXT_FID_MASK 0x3f
173 175
174 176
175/* 177/*
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index ce54ff12c15d..31c3a5baaa7f 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -2,19 +2,15 @@
2 * cpufreq driver for Enhanced SpeedStep, as found in Intel's Pentium 2 * cpufreq driver for Enhanced SpeedStep, as found in Intel's Pentium
3 * M (part of the Centrino chipset). 3 * M (part of the Centrino chipset).
4 * 4 *
5 * Since the original Pentium M, most new Intel CPUs support Enhanced
6 * SpeedStep.
7 *
5 * Despite the "SpeedStep" in the name, this is almost entirely unlike 8 * Despite the "SpeedStep" in the name, this is almost entirely unlike
6 * traditional SpeedStep. 9 * traditional SpeedStep.
7 * 10 *
8 * Modelled on speedstep.c 11 * Modelled on speedstep.c
9 * 12 *
10 * Copyright (C) 2003 Jeremy Fitzhardinge <jeremy@goop.org> 13 * Copyright (C) 2003 Jeremy Fitzhardinge <jeremy@goop.org>
11 *
12 * WARNING WARNING WARNING
13 *
14 * This driver manipulates the PERF_CTL MSR, which is only somewhat
15 * documented. While it seems to work on my laptop, it has not been
16 * tested anywhere else, and it may not work for you, do strange
17 * things or simply crash.
18 */ 14 */
19 15
20#include <linux/kernel.h> 16#include <linux/kernel.h>
@@ -36,7 +32,7 @@
36#include <asm/cpufeature.h> 32#include <asm/cpufeature.h>
37 33
38#define PFX "speedstep-centrino: " 34#define PFX "speedstep-centrino: "
39#define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>" 35#define MAINTAINER "cpufreq@lists.linux.org.uk"
40 36
41#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg) 37#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg)
42 38
@@ -351,7 +347,36 @@ static unsigned int get_cur_freq(unsigned int cpu)
351 347
352#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI 348#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
353 349
354static struct acpi_processor_performance p; 350static struct acpi_processor_performance *acpi_perf_data[NR_CPUS];
351
352/*
353 * centrino_cpu_early_init_acpi - Do the preregistering with ACPI P-States
354 * library
355 *
356 * Before doing the actual init, we need to do _PSD related setup whenever
357 * supported by the BIOS. These are handled by this early_init routine.
358 */
359static int centrino_cpu_early_init_acpi(void)
360{
361 unsigned int i, j;
362 struct acpi_processor_performance *data;
363
364 for_each_cpu(i) {
365 data = kzalloc(sizeof(struct acpi_processor_performance),
366 GFP_KERNEL);
367 if (!data) {
368 for_each_cpu(j) {
369 kfree(acpi_perf_data[j]);
370 acpi_perf_data[j] = NULL;
371 }
372 return (-ENOMEM);
373 }
374 acpi_perf_data[i] = data;
375 }
376
377 acpi_processor_preregister_performance(acpi_perf_data);
378 return 0;
379}
355 380
356/* 381/*
357 * centrino_cpu_init_acpi - register with ACPI P-States library 382 * centrino_cpu_init_acpi - register with ACPI P-States library
@@ -365,46 +390,51 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
365 unsigned long cur_freq; 390 unsigned long cur_freq;
366 int result = 0, i; 391 int result = 0, i;
367 unsigned int cpu = policy->cpu; 392 unsigned int cpu = policy->cpu;
393 struct acpi_processor_performance *p;
394
395 p = acpi_perf_data[cpu];
368 396
369 /* register with ACPI core */ 397 /* register with ACPI core */
370 if (acpi_processor_register_performance(&p, cpu)) { 398 if (acpi_processor_register_performance(p, cpu)) {
371 dprintk("obtaining ACPI data failed\n"); 399 dprintk(PFX "obtaining ACPI data failed\n");
372 return -EIO; 400 return -EIO;
373 } 401 }
402 policy->cpus = p->shared_cpu_map;
403 policy->shared_type = p->shared_type;
374 404
375 /* verify the acpi_data */ 405 /* verify the acpi_data */
376 if (p.state_count <= 1) { 406 if (p->state_count <= 1) {
377 dprintk("No P-States\n"); 407 dprintk("No P-States\n");
378 result = -ENODEV; 408 result = -ENODEV;
379 goto err_unreg; 409 goto err_unreg;
380 } 410 }
381 411
382 if ((p.control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || 412 if ((p->control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) ||
383 (p.status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { 413 (p->status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) {
384 dprintk("Invalid control/status registers (%x - %x)\n", 414 dprintk("Invalid control/status registers (%x - %x)\n",
385 p.control_register.space_id, p.status_register.space_id); 415 p->control_register.space_id, p->status_register.space_id);
386 result = -EIO; 416 result = -EIO;
387 goto err_unreg; 417 goto err_unreg;
388 } 418 }
389 419
390 for (i=0; i<p.state_count; i++) { 420 for (i=0; i<p->state_count; i++) {
391 if (p.states[i].control != p.states[i].status) { 421 if (p->states[i].control != p->states[i].status) {
392 dprintk("Different control (%llu) and status values (%llu)\n", 422 dprintk("Different control (%llu) and status values (%llu)\n",
393 p.states[i].control, p.states[i].status); 423 p->states[i].control, p->states[i].status);
394 result = -EINVAL; 424 result = -EINVAL;
395 goto err_unreg; 425 goto err_unreg;
396 } 426 }
397 427
398 if (!p.states[i].core_frequency) { 428 if (!p->states[i].core_frequency) {
399 dprintk("Zero core frequency for state %u\n", i); 429 dprintk("Zero core frequency for state %u\n", i);
400 result = -EINVAL; 430 result = -EINVAL;
401 goto err_unreg; 431 goto err_unreg;
402 } 432 }
403 433
404 if (p.states[i].core_frequency > p.states[0].core_frequency) { 434 if (p->states[i].core_frequency > p->states[0].core_frequency) {
405 dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i, 435 dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i,
406 p.states[i].core_frequency, p.states[0].core_frequency); 436 p->states[i].core_frequency, p->states[0].core_frequency);
407 p.states[i].core_frequency = 0; 437 p->states[i].core_frequency = 0;
408 continue; 438 continue;
409 } 439 }
410 } 440 }
@@ -416,26 +446,26 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
416 } 446 }
417 447
418 centrino_model[cpu]->model_name=NULL; 448 centrino_model[cpu]->model_name=NULL;
419 centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000; 449 centrino_model[cpu]->max_freq = p->states[0].core_frequency * 1000;
420 centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) * 450 centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) *
421 (p.state_count + 1), GFP_KERNEL); 451 (p->state_count + 1), GFP_KERNEL);
422 if (!centrino_model[cpu]->op_points) { 452 if (!centrino_model[cpu]->op_points) {
423 result = -ENOMEM; 453 result = -ENOMEM;
424 goto err_kfree; 454 goto err_kfree;
425 } 455 }
426 456
427 for (i=0; i<p.state_count; i++) { 457 for (i=0; i<p->state_count; i++) {
428 centrino_model[cpu]->op_points[i].index = p.states[i].control; 458 centrino_model[cpu]->op_points[i].index = p->states[i].control;
429 centrino_model[cpu]->op_points[i].frequency = p.states[i].core_frequency * 1000; 459 centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000;
430 dprintk("adding state %i with frequency %u and control value %04x\n", 460 dprintk("adding state %i with frequency %u and control value %04x\n",
431 i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); 461 i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index);
432 } 462 }
433 centrino_model[cpu]->op_points[p.state_count].frequency = CPUFREQ_TABLE_END; 463 centrino_model[cpu]->op_points[p->state_count].frequency = CPUFREQ_TABLE_END;
434 464
435 cur_freq = get_cur_freq(cpu); 465 cur_freq = get_cur_freq(cpu);
436 466
437 for (i=0; i<p.state_count; i++) { 467 for (i=0; i<p->state_count; i++) {
438 if (!p.states[i].core_frequency) { 468 if (!p->states[i].core_frequency) {
439 dprintk("skipping state %u\n", i); 469 dprintk("skipping state %u\n", i);
440 centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID; 470 centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID;
441 continue; 471 continue;
@@ -451,7 +481,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
451 } 481 }
452 482
453 if (cur_freq == centrino_model[cpu]->op_points[i].frequency) 483 if (cur_freq == centrino_model[cpu]->op_points[i].frequency)
454 p.state = i; 484 p->state = i;
455 } 485 }
456 486
457 /* notify BIOS that we exist */ 487 /* notify BIOS that we exist */
@@ -464,12 +494,13 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
464 err_kfree: 494 err_kfree:
465 kfree(centrino_model[cpu]); 495 kfree(centrino_model[cpu]);
466 err_unreg: 496 err_unreg:
467 acpi_processor_unregister_performance(&p, cpu); 497 acpi_processor_unregister_performance(p, cpu);
468 dprintk("invalid ACPI data\n"); 498 dprintk(PFX "invalid ACPI data\n");
469 return (result); 499 return (result);
470} 500}
471#else 501#else
472static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; } 502static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; }
503static inline int centrino_cpu_early_init_acpi(void) { return 0; }
473#endif 504#endif
474 505
475static int centrino_cpu_init(struct cpufreq_policy *policy) 506static int centrino_cpu_init(struct cpufreq_policy *policy)
@@ -555,10 +586,15 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy)
555 586
556#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI 587#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
557 if (!centrino_model[cpu]->model_name) { 588 if (!centrino_model[cpu]->model_name) {
558 dprintk("unregistering and freeing ACPI data\n"); 589 static struct acpi_processor_performance *p;
559 acpi_processor_unregister_performance(&p, cpu); 590
560 kfree(centrino_model[cpu]->op_points); 591 if (acpi_perf_data[cpu]) {
561 kfree(centrino_model[cpu]); 592 p = acpi_perf_data[cpu];
593 dprintk("unregistering and freeing ACPI data\n");
594 acpi_processor_unregister_performance(p, cpu);
595 kfree(centrino_model[cpu]->op_points);
596 kfree(centrino_model[cpu]);
597 }
562 } 598 }
563#endif 599#endif
564 600
@@ -592,63 +628,128 @@ static int centrino_target (struct cpufreq_policy *policy,
592 unsigned int relation) 628 unsigned int relation)
593{ 629{
594 unsigned int newstate = 0; 630 unsigned int newstate = 0;
595 unsigned int msr, oldmsr, h, cpu = policy->cpu; 631 unsigned int msr, oldmsr = 0, h = 0, cpu = policy->cpu;
596 struct cpufreq_freqs freqs; 632 struct cpufreq_freqs freqs;
633 cpumask_t online_policy_cpus;
597 cpumask_t saved_mask; 634 cpumask_t saved_mask;
598 int retval; 635 cpumask_t set_mask;
636 cpumask_t covered_cpus;
637 int retval = 0;
638 unsigned int j, k, first_cpu, tmp;
599 639
600 if (centrino_model[cpu] == NULL) 640 if (unlikely(centrino_model[cpu] == NULL))
601 return -ENODEV; 641 return -ENODEV;
602 642
603 /* 643 if (unlikely(cpufreq_frequency_table_target(policy,
604 * Support for SMP systems. 644 centrino_model[cpu]->op_points,
605 * Make sure we are running on the CPU that wants to change frequency 645 target_freq,
606 */ 646 relation,
607 saved_mask = current->cpus_allowed; 647 &newstate))) {
608 set_cpus_allowed(current, policy->cpus); 648 return -EINVAL;
609 if (!cpu_isset(smp_processor_id(), policy->cpus)) {
610 dprintk("couldn't limit to CPUs in this domain\n");
611 return(-EAGAIN);
612 } 649 }
613 650
614 if (cpufreq_frequency_table_target(policy, centrino_model[cpu]->op_points, target_freq, 651#ifdef CONFIG_HOTPLUG_CPU
615 relation, &newstate)) { 652 /* cpufreq holds the hotplug lock, so we are safe from here on */
616 retval = -EINVAL; 653 cpus_and(online_policy_cpus, cpu_online_map, policy->cpus);
617 goto migrate_end; 654#else
618 } 655 online_policy_cpus = policy->cpus;
656#endif
619 657
620 msr = centrino_model[cpu]->op_points[newstate].index; 658 saved_mask = current->cpus_allowed;
621 rdmsr(MSR_IA32_PERF_CTL, oldmsr, h); 659 first_cpu = 1;
660 cpus_clear(covered_cpus);
661 for_each_cpu_mask(j, online_policy_cpus) {
662 /*
663 * Support for SMP systems.
664 * Make sure we are running on CPU that wants to change freq
665 */
666 cpus_clear(set_mask);
667 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
668 cpus_or(set_mask, set_mask, online_policy_cpus);
669 else
670 cpu_set(j, set_mask);
671
672 set_cpus_allowed(current, set_mask);
673 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
674 dprintk("couldn't limit to CPUs in this domain\n");
675 retval = -EAGAIN;
676 if (first_cpu) {
677 /* We haven't started the transition yet. */
678 goto migrate_end;
679 }
680 break;
681 }
622 682
623 if (msr == (oldmsr & 0xffff)) { 683 msr = centrino_model[cpu]->op_points[newstate].index;
624 retval = 0; 684
625 dprintk("no change needed - msr was and needs to be %x\n", oldmsr); 685 if (first_cpu) {
626 goto migrate_end; 686 rdmsr(MSR_IA32_PERF_CTL, oldmsr, h);
627 } 687 if (msr == (oldmsr & 0xffff)) {
688 dprintk("no change needed - msr was and needs "
689 "to be %x\n", oldmsr);
690 retval = 0;
691 goto migrate_end;
692 }
693
694 freqs.old = extract_clock(oldmsr, cpu, 0);
695 freqs.new = extract_clock(msr, cpu, 0);
696
697 dprintk("target=%dkHz old=%d new=%d msr=%04x\n",
698 target_freq, freqs.old, freqs.new, msr);
699
700 for_each_cpu_mask(k, online_policy_cpus) {
701 freqs.cpu = k;
702 cpufreq_notify_transition(&freqs,
703 CPUFREQ_PRECHANGE);
704 }
705
706 first_cpu = 0;
707 /* all but 16 LSB are reserved, treat them with care */
708 oldmsr &= ~0xffff;
709 msr &= 0xffff;
710 oldmsr |= msr;
711 }
628 712
629 freqs.cpu = cpu; 713 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
630 freqs.old = extract_clock(oldmsr, cpu, 0); 714 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
631 freqs.new = extract_clock(msr, cpu, 0); 715 break;
632 716
633 dprintk("target=%dkHz old=%d new=%d msr=%04x\n", 717 cpu_set(j, covered_cpus);
634 target_freq, freqs.old, freqs.new, msr); 718 }
635 719
636 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 720 for_each_cpu_mask(k, online_policy_cpus) {
721 freqs.cpu = k;
722 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
723 }
637 724
638 /* all but 16 LSB are "reserved", so treat them with 725 if (unlikely(retval)) {
639 care */ 726 /*
640 oldmsr &= ~0xffff; 727 * We have failed halfway through the frequency change.
641 msr &= 0xffff; 728 * We have sent callbacks to policy->cpus and
642 oldmsr |= msr; 729 * MSRs have already been written on coverd_cpus.
730 * Best effort undo..
731 */
643 732
644 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); 733 if (!cpus_empty(covered_cpus)) {
734 for_each_cpu_mask(j, covered_cpus) {
735 set_cpus_allowed(current, cpumask_of_cpu(j));
736 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
737 }
738 }
645 739
646 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 740 tmp = freqs.new;
741 freqs.new = freqs.old;
742 freqs.old = tmp;
743 for_each_cpu_mask(j, online_policy_cpus) {
744 freqs.cpu = j;
745 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
746 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
747 }
748 }
647 749
648 retval = 0;
649migrate_end: 750migrate_end:
650 set_cpus_allowed(current, saved_mask); 751 set_cpus_allowed(current, saved_mask);
651 return (retval); 752 return 0;
652} 753}
653 754
654static struct freq_attr* centrino_attr[] = { 755static struct freq_attr* centrino_attr[] = {
@@ -690,12 +791,25 @@ static int __init centrino_init(void)
690 if (!cpu_has(cpu, X86_FEATURE_EST)) 791 if (!cpu_has(cpu, X86_FEATURE_EST))
691 return -ENODEV; 792 return -ENODEV;
692 793
794 centrino_cpu_early_init_acpi();
795
693 return cpufreq_register_driver(&centrino_driver); 796 return cpufreq_register_driver(&centrino_driver);
694} 797}
695 798
696static void __exit centrino_exit(void) 799static void __exit centrino_exit(void)
697{ 800{
801#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
802 unsigned int j;
803#endif
804
698 cpufreq_unregister_driver(&centrino_driver); 805 cpufreq_unregister_driver(&centrino_driver);
806
807#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
808 for_each_cpu(j) {
809 kfree(acpi_perf_data[j]);
810 acpi_perf_data[j] = NULL;
811 }
812#endif
699} 813}
700 814
701MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>"); 815MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>");
diff --git a/arch/i386/kernel/cpu/cyrix.c b/arch/i386/kernel/cpu/cyrix.c
index 00f2e058797c..fc32c8028e24 100644
--- a/arch/i386/kernel/cpu/cyrix.c
+++ b/arch/i386/kernel/cpu/cyrix.c
@@ -184,7 +184,7 @@ static void __init geode_configure(void)
184 184
185 185
186#ifdef CONFIG_PCI 186#ifdef CONFIG_PCI
187static struct pci_device_id cyrix_55x0[] = { 187static struct pci_device_id __initdata cyrix_55x0[] = {
188 { PCI_DEVICE(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5510) }, 188 { PCI_DEVICE(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5510) },
189 { PCI_DEVICE(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520) }, 189 { PCI_DEVICE(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520) },
190 { }, 190 { },
@@ -272,14 +272,15 @@ static void __init init_cyrix(struct cpuinfo_x86 *c)
272 272
273 printk(KERN_INFO "Working around Cyrix MediaGX virtual DMA bugs.\n"); 273 printk(KERN_INFO "Working around Cyrix MediaGX virtual DMA bugs.\n");
274 isa_dma_bridge_buggy = 2; 274 isa_dma_bridge_buggy = 2;
275#endif 275
276 c->x86_cache_size=16; /* Yep 16K integrated cache thats it */ 276
277
278 /* 277 /*
279 * The 5510/5520 companion chips have a funky PIT. 278 * The 5510/5520 companion chips have a funky PIT.
280 */ 279 */
281 if (pci_dev_present(cyrix_55x0)) 280 if (pci_dev_present(cyrix_55x0))
282 pit_latch_buggy = 1; 281 pit_latch_buggy = 1;
282#endif
283 c->x86_cache_size=16; /* Yep 16K integrated cache thats it */
283 284
284 /* GXm supports extended cpuid levels 'ala' AMD */ 285 /* GXm supports extended cpuid levels 'ala' AMD */
285 if (c->cpuid_level == 2) { 286 if (c->cpuid_level == 2) {
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c
index f94cdb7aca50..a19fcb262dbb 100644
--- a/arch/i386/kernel/cpu/proc.c
+++ b/arch/i386/kernel/cpu/proc.c
@@ -52,7 +52,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
52 52
53 /* VIA/Cyrix/Centaur-defined */ 53 /* VIA/Cyrix/Centaur-defined */
54 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", 54 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
55 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 55 "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL,
56 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 56 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
57 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 57 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
58 58
diff --git a/arch/i386/kernel/i387.c b/arch/i386/kernel/i387.c
index d75524758daf..c4351972d9af 100644
--- a/arch/i386/kernel/i387.c
+++ b/arch/i386/kernel/i387.c
@@ -25,7 +25,7 @@
25#define HAVE_HWFP 1 25#define HAVE_HWFP 1
26#endif 26#endif
27 27
28static unsigned long mxcsr_feature_mask = 0xffffffff; 28static unsigned long mxcsr_feature_mask __read_mostly = 0xffffffff;
29 29
30void mxcsr_feature_mask_init(void) 30void mxcsr_feature_mask_init(void)
31{ 31{
diff --git a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c
index 323ef8ab3244..b7636b96e104 100644
--- a/arch/i386/kernel/i8259.c
+++ b/arch/i386/kernel/i8259.c
@@ -271,8 +271,8 @@ static int i8259A_shutdown(struct sys_device *dev)
271 * the kernel initialization code can get it 271 * the kernel initialization code can get it
272 * out of. 272 * out of.
273 */ 273 */
274 outb(0xff, 0x21); /* mask all of 8259A-1 */ 274 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
275 outb(0xff, 0xA1); /* mask all of 8259A-1 */ 275 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-1 */
276 return 0; 276 return 0;
277} 277}
278 278
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index d70f2ade5cde..a62df3e764c5 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -267,7 +267,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
267# include <linux/slab.h> /* kmalloc() */ 267# include <linux/slab.h> /* kmalloc() */
268# include <linux/timer.h> /* time_after() */ 268# include <linux/timer.h> /* time_after() */
269 269
270# ifdef CONFIG_BALANCED_IRQ_DEBUG 270#ifdef CONFIG_BALANCED_IRQ_DEBUG
271# define TDprintk(x...) do { printk("<%ld:%s:%d>: ", jiffies, __FILE__, __LINE__); printk(x); } while (0) 271# define TDprintk(x...) do { printk("<%ld:%s:%d>: ", jiffies, __FILE__, __LINE__); printk(x); } while (0)
272# define Dprintk(x...) do { TDprintk(x); } while (0) 272# define Dprintk(x...) do { TDprintk(x); } while (0)
273# else 273# else
@@ -275,10 +275,15 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
275# define Dprintk(x...) 275# define Dprintk(x...)
276# endif 276# endif
277 277
278
279#define IRQBALANCE_CHECK_ARCH -999 278#define IRQBALANCE_CHECK_ARCH -999
280static int irqbalance_disabled = IRQBALANCE_CHECK_ARCH; 279#define MAX_BALANCED_IRQ_INTERVAL (5*HZ)
281static int physical_balance = 0; 280#define MIN_BALANCED_IRQ_INTERVAL (HZ/2)
281#define BALANCED_IRQ_MORE_DELTA (HZ/10)
282#define BALANCED_IRQ_LESS_DELTA (HZ)
283
284static int irqbalance_disabled __read_mostly = IRQBALANCE_CHECK_ARCH;
285static int physical_balance __read_mostly;
286static long balanced_irq_interval __read_mostly = MAX_BALANCED_IRQ_INTERVAL;
282 287
283static struct irq_cpu_info { 288static struct irq_cpu_info {
284 unsigned long * last_irq; 289 unsigned long * last_irq;
@@ -297,12 +302,14 @@ static struct irq_cpu_info {
297 302
298#define CPU_TO_PACKAGEINDEX(i) (first_cpu(cpu_sibling_map[i])) 303#define CPU_TO_PACKAGEINDEX(i) (first_cpu(cpu_sibling_map[i]))
299 304
300#define MAX_BALANCED_IRQ_INTERVAL (5*HZ) 305static cpumask_t balance_irq_affinity[NR_IRQS] = {
301#define MIN_BALANCED_IRQ_INTERVAL (HZ/2) 306 [0 ... NR_IRQS-1] = CPU_MASK_ALL
302#define BALANCED_IRQ_MORE_DELTA (HZ/10) 307};
303#define BALANCED_IRQ_LESS_DELTA (HZ)
304 308
305static long balanced_irq_interval = MAX_BALANCED_IRQ_INTERVAL; 309void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
310{
311 balance_irq_affinity[irq] = mask;
312}
306 313
307static unsigned long move(int curr_cpu, cpumask_t allowed_mask, 314static unsigned long move(int curr_cpu, cpumask_t allowed_mask,
308 unsigned long now, int direction) 315 unsigned long now, int direction)
@@ -340,7 +347,7 @@ static inline void balance_irq(int cpu, int irq)
340 if (irqbalance_disabled) 347 if (irqbalance_disabled)
341 return; 348 return;
342 349
343 cpus_and(allowed_mask, cpu_online_map, irq_affinity[irq]); 350 cpus_and(allowed_mask, cpu_online_map, balance_irq_affinity[irq]);
344 new_cpu = move(cpu, allowed_mask, now, 1); 351 new_cpu = move(cpu, allowed_mask, now, 1);
345 if (cpu != new_cpu) { 352 if (cpu != new_cpu) {
346 set_pending_irq(irq, cpumask_of_cpu(new_cpu)); 353 set_pending_irq(irq, cpumask_of_cpu(new_cpu));
@@ -529,7 +536,9 @@ tryanotherirq:
529 } 536 }
530 } 537 }
531 538
532 cpus_and(allowed_mask, cpu_online_map, irq_affinity[selected_irq]); 539 cpus_and(allowed_mask,
540 cpu_online_map,
541 balance_irq_affinity[selected_irq]);
533 target_cpu_mask = cpumask_of_cpu(min_loaded); 542 target_cpu_mask = cpumask_of_cpu(min_loaded);
534 cpus_and(tmp, target_cpu_mask, allowed_mask); 543 cpus_and(tmp, target_cpu_mask, allowed_mask);
535 544
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
index f3a9c78c4a24..248e922ee13a 100644
--- a/arch/i386/kernel/irq.c
+++ b/arch/i386/kernel/irq.c
@@ -42,8 +42,8 @@ union irq_ctx {
42 u32 stack[THREAD_SIZE/sizeof(u32)]; 42 u32 stack[THREAD_SIZE/sizeof(u32)];
43}; 43};
44 44
45static union irq_ctx *hardirq_ctx[NR_CPUS]; 45static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
46static union irq_ctx *softirq_ctx[NR_CPUS]; 46static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
47#endif 47#endif
48 48
49/* 49/*
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index 38806f427849..395a9a6dff88 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -607,7 +607,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
607 struct die_args *args = (struct die_args *)data; 607 struct die_args *args = (struct die_args *)data;
608 int ret = NOTIFY_DONE; 608 int ret = NOTIFY_DONE;
609 609
610 if (args->regs && user_mode(args->regs)) 610 if (args->regs && user_mode_vm(args->regs))
611 return ret; 611 return ret;
612 612
613 switch (val) { 613 switch (val) {
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index e7c138f66c5a..0a865889b2a9 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -91,7 +91,10 @@ MODULE_DESCRIPTION("Intel CPU (IA-32) Microcode Update Driver");
91MODULE_AUTHOR("Tigran Aivazian <tigran@veritas.com>"); 91MODULE_AUTHOR("Tigran Aivazian <tigran@veritas.com>");
92MODULE_LICENSE("GPL"); 92MODULE_LICENSE("GPL");
93 93
94#define MICROCODE_VERSION "1.14" 94static int verbose;
95module_param(verbose, int, 0644);
96
97#define MICROCODE_VERSION "1.14a"
95 98
96#define DEFAULT_UCODE_DATASIZE (2000) /* 2000 bytes */ 99#define DEFAULT_UCODE_DATASIZE (2000) /* 2000 bytes */
97#define MC_HEADER_SIZE (sizeof (microcode_header_t)) /* 48 bytes */ 100#define MC_HEADER_SIZE (sizeof (microcode_header_t)) /* 48 bytes */
@@ -122,14 +125,15 @@ static unsigned int user_buffer_size; /* it's size */
122 125
123typedef enum mc_error_code { 126typedef enum mc_error_code {
124 MC_SUCCESS = 0, 127 MC_SUCCESS = 0,
125 MC_NOTFOUND = 1, 128 MC_IGNORED = 1,
126 MC_MARKED = 2, 129 MC_NOTFOUND = 2,
127 MC_ALLOCATED = 3, 130 MC_MARKED = 3,
131 MC_ALLOCATED = 4,
128} mc_error_code_t; 132} mc_error_code_t;
129 133
130static struct ucode_cpu_info { 134static struct ucode_cpu_info {
131 unsigned int sig; 135 unsigned int sig;
132 unsigned int pf; 136 unsigned int pf, orig_pf;
133 unsigned int rev; 137 unsigned int rev;
134 unsigned int cksum; 138 unsigned int cksum;
135 mc_error_code_t err; 139 mc_error_code_t err;
@@ -164,6 +168,7 @@ static void collect_cpu_info (void *unused)
164 rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]); 168 rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
165 uci->pf = 1 << ((val[1] >> 18) & 7); 169 uci->pf = 1 << ((val[1] >> 18) & 7);
166 } 170 }
171 uci->orig_pf = uci->pf;
167 } 172 }
168 173
169 wrmsr(MSR_IA32_UCODE_REV, 0, 0); 174 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
@@ -197,21 +202,34 @@ static inline void mark_microcode_update (int cpu_num, microcode_header_t *mc_he
197 pr_debug(" Checksum 0x%x\n", cksum); 202 pr_debug(" Checksum 0x%x\n", cksum);
198 203
199 if (mc_header->rev < uci->rev) { 204 if (mc_header->rev < uci->rev) {
200 printk(KERN_ERR "microcode: CPU%d not 'upgrading' to earlier revision" 205 if (uci->err == MC_NOTFOUND) {
201 " 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev); 206 uci->err = MC_IGNORED;
202 goto out; 207 uci->cksum = mc_header->rev;
208 } else if (uci->err == MC_IGNORED && uci->cksum < mc_header->rev)
209 uci->cksum = mc_header->rev;
203 } else if (mc_header->rev == uci->rev) { 210 } else if (mc_header->rev == uci->rev) {
204 /* notify the caller of success on this cpu */ 211 if (uci->err < MC_MARKED) {
205 uci->err = MC_SUCCESS; 212 /* notify the caller of success on this cpu */
206 goto out; 213 uci->err = MC_SUCCESS;
214 }
215 } else if (uci->err != MC_ALLOCATED || mc_header->rev > uci->mc->hdr.rev) {
216 pr_debug("microcode: CPU%d found a matching microcode update with "
217 " revision 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev);
218 uci->cksum = cksum;
219 uci->pf = pf; /* keep the original mc pf for cksum calculation */
220 uci->err = MC_MARKED; /* found the match */
221 for_each_online_cpu(cpu_num) {
222 if (ucode_cpu_info + cpu_num != uci
223 && ucode_cpu_info[cpu_num].mc == uci->mc) {
224 uci->mc = NULL;
225 break;
226 }
227 }
228 if (uci->mc != NULL) {
229 vfree(uci->mc);
230 uci->mc = NULL;
231 }
207 } 232 }
208
209 pr_debug("microcode: CPU%d found a matching microcode update with "
210 " revision 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev);
211 uci->cksum = cksum;
212 uci->pf = pf; /* keep the original mc pf for cksum calculation */
213 uci->err = MC_MARKED; /* found the match */
214out:
215 return; 233 return;
216} 234}
217 235
@@ -253,10 +271,8 @@ static int find_matching_ucodes (void)
253 271
254 for_each_online_cpu(cpu_num) { 272 for_each_online_cpu(cpu_num) {
255 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 273 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
256 if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/
257 continue;
258 274
259 if (sigmatch(mc_header.sig, uci->sig, mc_header.pf, uci->pf)) 275 if (sigmatch(mc_header.sig, uci->sig, mc_header.pf, uci->orig_pf))
260 mark_microcode_update(cpu_num, &mc_header, mc_header.sig, mc_header.pf, mc_header.cksum); 276 mark_microcode_update(cpu_num, &mc_header, mc_header.sig, mc_header.pf, mc_header.cksum);
261 } 277 }
262 278
@@ -295,9 +311,8 @@ static int find_matching_ucodes (void)
295 } 311 }
296 for_each_online_cpu(cpu_num) { 312 for_each_online_cpu(cpu_num) {
297 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 313 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
298 if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/ 314
299 continue; 315 if (sigmatch(ext_sig.sig, uci->sig, ext_sig.pf, uci->orig_pf)) {
300 if (sigmatch(ext_sig.sig, uci->sig, ext_sig.pf, uci->pf)) {
301 mark_microcode_update(cpu_num, &mc_header, ext_sig.sig, ext_sig.pf, ext_sig.cksum); 316 mark_microcode_update(cpu_num, &mc_header, ext_sig.sig, ext_sig.pf, ext_sig.cksum);
302 } 317 }
303 } 318 }
@@ -368,6 +383,13 @@ static void do_update_one (void * unused)
368 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 383 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
369 384
370 if (uci->mc == NULL) { 385 if (uci->mc == NULL) {
386 if (verbose) {
387 if (uci->err == MC_SUCCESS)
388 printk(KERN_INFO "microcode: CPU%d already at revision 0x%x\n",
389 cpu_num, uci->rev);
390 else
391 printk(KERN_INFO "microcode: No new microcode data for CPU%d\n", cpu_num);
392 }
371 return; 393 return;
372 } 394 }
373 395
@@ -426,6 +448,9 @@ out_free:
426 ucode_cpu_info[j].mc = NULL; 448 ucode_cpu_info[j].mc = NULL;
427 } 449 }
428 } 450 }
451 if (ucode_cpu_info[i].err == MC_IGNORED && verbose)
452 printk(KERN_WARNING "microcode: CPU%d not 'upgrading' to earlier revision"
453 " 0x%x (current=0x%x)\n", i, ucode_cpu_info[i].cksum, ucode_cpu_info[i].rev);
429 } 454 }
430out: 455out:
431 return error; 456 return error;
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index dd6b0e3386ce..e6023970aa40 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -48,6 +48,7 @@
48#include <linux/crash_dump.h> 48#include <linux/crash_dump.h>
49#include <linux/dmi.h> 49#include <linux/dmi.h>
50#include <linux/pfn.h> 50#include <linux/pfn.h>
51#include <linux/suspend.h>
51 52
52#include <video/edid.h> 53#include <video/edid.h>
53 54
@@ -1434,6 +1435,111 @@ static void set_mca_bus(int x)
1434static void set_mca_bus(int x) { } 1435static void set_mca_bus(int x) { }
1435#endif 1436#endif
1436 1437
1438#ifdef CONFIG_SOFTWARE_SUSPEND
1439static void __init mark_nosave_page_range(unsigned long start, unsigned long end)
1440{
1441 struct page *page;
1442 while (start <= end) {
1443 page = pfn_to_page(start);
1444 SetPageNosave(page);
1445 start++;
1446 }
1447}
1448
1449static void __init e820_nosave_reserved_pages(void)
1450{
1451 int i;
1452 unsigned long r_start = 0, r_end = 0;
1453
1454 /* Assume e820 map is sorted */
1455 for (i = 0; i < e820.nr_map; i++) {
1456 struct e820entry *ei = &e820.map[i];
1457 unsigned long start, end;
1458
1459 start = PFN_DOWN(ei->addr);
1460 end = PFN_UP(ei->addr + ei->size);
1461 if (start >= end)
1462 continue;
1463 if (ei->type == E820_RESERVED)
1464 continue;
1465 r_end = start;
1466 /*
1467 * Highmem 'Reserved' pages are marked as reserved, swsusp
1468 * will not save/restore them, so we ignore these pages here.
1469 */
1470 if (r_end > max_low_pfn)
1471 r_end = max_low_pfn;
1472 if (r_end > r_start)
1473 mark_nosave_page_range(r_start, r_end-1);
1474 if (r_end >= max_low_pfn)
1475 break;
1476 r_start = end;
1477 }
1478}
1479
1480static void __init e820_save_acpi_pages(void)
1481{
1482 int i;
1483
1484 /* Assume e820 map is sorted */
1485 for (i = 0; i < e820.nr_map; i++) {
1486 struct e820entry *ei = &e820.map[i];
1487 unsigned long start, end;
1488
1489 start = ei->addr;
1490 end = ei->addr + ei->size;
1491 if (start >= end)
1492 continue;
1493 if (ei->type != E820_ACPI && ei->type != E820_NVS)
1494 continue;
1495 /*
1496 * If the region is below max_low_pfn, it will be
1497 * saved/restored by swsusp follow 'RAM' type.
1498 */
1499 if (start < (max_low_pfn << PAGE_SHIFT))
1500 start = max_low_pfn << PAGE_SHIFT;
1501 /*
1502 * Highmem pages (ACPI NVS/Data) are reserved, but swsusp
1503 * highmem save/restore will not save/restore them. We marked
1504 * them as arch saveable pages here
1505 */
1506 if (end > start)
1507 swsusp_add_arch_pages(start, end);
1508 }
1509}
1510
1511extern char __start_rodata, __end_rodata;
1512/*
1513 * BIOS reserved region/hole - no save/restore
1514 * ACPI NVS - save/restore
1515 * ACPI Data - this is a little tricky, the mem could be used by OS after OS
1516 * reads tables from the region, but anyway save/restore the memory hasn't any
1517 * side effect and Linux runtime module load/unload might use it.
1518 * kernel rodata - no save/restore (kernel rodata isn't changed)
1519 */
1520static int __init mark_nosave_pages(void)
1521{
1522 unsigned long pfn_start, pfn_end;
1523
1524 /* FIXME: provide a version for efi BIOS */
1525 if (efi_enabled)
1526 return 0;
1527 /* BIOS reserved regions & holes */
1528 e820_nosave_reserved_pages();
1529
1530 /* kernel rodata */
1531 pfn_start = PFN_UP(virt_to_phys(&__start_rodata));
1532 pfn_end = PFN_DOWN(virt_to_phys(&__end_rodata));
1533 mark_nosave_page_range(pfn_start, pfn_end-1);
1534
1535 /* record ACPI Data/NVS as saveable */
1536 e820_save_acpi_pages();
1537
1538 return 0;
1539}
1540core_initcall(mark_nosave_pages);
1541#endif
1542
1437/* 1543/*
1438 * Determine if we were loaded by an EFI loader. If so, then we have also been 1544 * Determine if we were loaded by an EFI loader. If so, then we have also been
1439 * passed the efi memmap, systab, etc., so we should use these data structures 1545 * passed the efi memmap, systab, etc., so we should use these data structures
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c
index 52b3ed5d2cb5..989c85255dbe 100644
--- a/arch/i386/kernel/srat.c
+++ b/arch/i386/kernel/srat.c
@@ -39,7 +39,6 @@
39#define NODE_ARRAY_OFFSET(x) ((x) % 8) /* 8 bits/char */ 39#define NODE_ARRAY_OFFSET(x) ((x) % 8) /* 8 bits/char */
40#define BMAP_SET(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit)) 40#define BMAP_SET(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit))
41#define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit))) 41#define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit)))
42#define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */
43/* bitmap length; _PXM is at most 255 */ 42/* bitmap length; _PXM is at most 255 */
44#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) 43#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8)
45static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */ 44static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */
@@ -213,19 +212,11 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c
213 node_end_pfn[nid] = memory_chunk->end_pfn; 212 node_end_pfn[nid] = memory_chunk->end_pfn;
214} 213}
215 214
216static u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */
217
218int pxm_to_node(int pxm)
219{
220 return pxm_to_nid_map[pxm];
221}
222
223/* Parse the ACPI Static Resource Affinity Table */ 215/* Parse the ACPI Static Resource Affinity Table */
224static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) 216static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
225{ 217{
226 u8 *start, *end, *p; 218 u8 *start, *end, *p;
227 int i, j, nid; 219 int i, j, nid;
228 u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */
229 220
230 start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ 221 start = (u8 *)(&(sratp->reserved) + 1); /* skip header */
231 p = start; 222 p = start;
@@ -235,10 +226,6 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
235 memset(node_memory_chunk, 0, sizeof(node_memory_chunk)); 226 memset(node_memory_chunk, 0, sizeof(node_memory_chunk));
236 memset(zholes_size, 0, sizeof(zholes_size)); 227 memset(zholes_size, 0, sizeof(zholes_size));
237 228
238 /* -1 in these maps means not available */
239 memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
240 memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
241
242 num_memory_chunks = 0; 229 num_memory_chunks = 0;
243 while (p < end) { 230 while (p < end) {
244 switch (*p) { 231 switch (*p) {
@@ -278,9 +265,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
278 nodes_clear(node_online_map); 265 nodes_clear(node_online_map);
279 for (i = 0; i < MAX_PXM_DOMAINS; i++) { 266 for (i = 0; i < MAX_PXM_DOMAINS; i++) {
280 if (BMAP_TEST(pxm_bitmap, i)) { 267 if (BMAP_TEST(pxm_bitmap, i)) {
281 nid = num_online_nodes(); 268 int nid = acpi_map_pxm_to_node(i);
282 pxm_to_nid_map[i] = nid;
283 nid_to_pxm_map[nid] = i;
284 node_set_online(nid); 269 node_set_online(nid);
285 } 270 }
286 } 271 }
@@ -288,7 +273,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
288 273
289 /* set cnode id in memory chunk structure */ 274 /* set cnode id in memory chunk structure */
290 for (i = 0; i < num_memory_chunks; i++) 275 for (i = 0; i < num_memory_chunks; i++)
291 node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm]; 276 node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm);
292 277
293 printk("pxm bitmap: "); 278 printk("pxm bitmap: ");
294 for (i = 0; i < sizeof(pxm_bitmap); i++) { 279 for (i = 0; i < sizeof(pxm_bitmap); i++) {
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index af56987f69b0..dd63d4775398 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -316,3 +316,4 @@ ENTRY(sys_call_table)
316 .long sys_sync_file_range 316 .long sys_sync_file_range
317 .long sys_tee /* 315 */ 317 .long sys_tee /* 315 */
318 .long sys_vmsplice 318 .long sys_vmsplice
319 .long sys_move_pages
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 0e498369f35e..dcc14477af1f 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -149,6 +149,12 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo,
149 while (valid_stack_ptr(tinfo, (void *)ebp)) { 149 while (valid_stack_ptr(tinfo, (void *)ebp)) {
150 addr = *(unsigned long *)(ebp + 4); 150 addr = *(unsigned long *)(ebp + 4);
151 printed = print_addr_and_symbol(addr, log_lvl, printed); 151 printed = print_addr_and_symbol(addr, log_lvl, printed);
152 /*
153 * break out of recursive entries (such as
154 * end_of_stack_stop_unwind_function):
155 */
156 if (ebp == *(unsigned long *)ebp)
157 break;
152 ebp = *(unsigned long *)ebp; 158 ebp = *(unsigned long *)ebp;
153 } 159 }
154#else 160#else
@@ -268,8 +274,9 @@ void show_registers(struct pt_regs *regs)
268 regs->esi, regs->edi, regs->ebp, esp); 274 regs->esi, regs->edi, regs->ebp, esp);
269 printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n", 275 printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n",
270 regs->xds & 0xffff, regs->xes & 0xffff, ss); 276 regs->xds & 0xffff, regs->xes & 0xffff, ss);
271 printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)", 277 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)",
272 current->comm, current->pid, current_thread_info(), current); 278 TASK_COMM_LEN, current->comm, current->pid,
279 current_thread_info(), current, current->thread_info);
273 /* 280 /*
274 * When in-kernel, we also print out the stack and code at the 281 * When in-kernel, we also print out the stack and code at the
275 * time of the fault.. 282 * time of the fault..
diff --git a/arch/i386/lib/usercopy.c b/arch/i386/lib/usercopy.c
index 4cf981d70f45..6979297ce278 100644
--- a/arch/i386/lib/usercopy.c
+++ b/arch/i386/lib/usercopy.c
@@ -425,15 +425,121 @@ __copy_user_zeroing_intel(void *to, const void __user *from, unsigned long size)
425 : "eax", "edx", "memory"); 425 : "eax", "edx", "memory");
426 return size; 426 return size;
427} 427}
428
429/*
430 * Non Temporal Hint version of __copy_user_zeroing_intel. It is cache aware.
431 * hyoshiok@miraclelinux.com
432 */
433
434static unsigned long __copy_user_zeroing_intel_nocache(void *to,
435 const void __user *from, unsigned long size)
436{
437 int d0, d1;
438
439 __asm__ __volatile__(
440 " .align 2,0x90\n"
441 "0: movl 32(%4), %%eax\n"
442 " cmpl $67, %0\n"
443 " jbe 2f\n"
444 "1: movl 64(%4), %%eax\n"
445 " .align 2,0x90\n"
446 "2: movl 0(%4), %%eax\n"
447 "21: movl 4(%4), %%edx\n"
448 " movnti %%eax, 0(%3)\n"
449 " movnti %%edx, 4(%3)\n"
450 "3: movl 8(%4), %%eax\n"
451 "31: movl 12(%4),%%edx\n"
452 " movnti %%eax, 8(%3)\n"
453 " movnti %%edx, 12(%3)\n"
454 "4: movl 16(%4), %%eax\n"
455 "41: movl 20(%4), %%edx\n"
456 " movnti %%eax, 16(%3)\n"
457 " movnti %%edx, 20(%3)\n"
458 "10: movl 24(%4), %%eax\n"
459 "51: movl 28(%4), %%edx\n"
460 " movnti %%eax, 24(%3)\n"
461 " movnti %%edx, 28(%3)\n"
462 "11: movl 32(%4), %%eax\n"
463 "61: movl 36(%4), %%edx\n"
464 " movnti %%eax, 32(%3)\n"
465 " movnti %%edx, 36(%3)\n"
466 "12: movl 40(%4), %%eax\n"
467 "71: movl 44(%4), %%edx\n"
468 " movnti %%eax, 40(%3)\n"
469 " movnti %%edx, 44(%3)\n"
470 "13: movl 48(%4), %%eax\n"
471 "81: movl 52(%4), %%edx\n"
472 " movnti %%eax, 48(%3)\n"
473 " movnti %%edx, 52(%3)\n"
474 "14: movl 56(%4), %%eax\n"
475 "91: movl 60(%4), %%edx\n"
476 " movnti %%eax, 56(%3)\n"
477 " movnti %%edx, 60(%3)\n"
478 " addl $-64, %0\n"
479 " addl $64, %4\n"
480 " addl $64, %3\n"
481 " cmpl $63, %0\n"
482 " ja 0b\n"
483 " sfence \n"
484 "5: movl %0, %%eax\n"
485 " shrl $2, %0\n"
486 " andl $3, %%eax\n"
487 " cld\n"
488 "6: rep; movsl\n"
489 " movl %%eax,%0\n"
490 "7: rep; movsb\n"
491 "8:\n"
492 ".section .fixup,\"ax\"\n"
493 "9: lea 0(%%eax,%0,4),%0\n"
494 "16: pushl %0\n"
495 " pushl %%eax\n"
496 " xorl %%eax,%%eax\n"
497 " rep; stosb\n"
498 " popl %%eax\n"
499 " popl %0\n"
500 " jmp 8b\n"
501 ".previous\n"
502 ".section __ex_table,\"a\"\n"
503 " .align 4\n"
504 " .long 0b,16b\n"
505 " .long 1b,16b\n"
506 " .long 2b,16b\n"
507 " .long 21b,16b\n"
508 " .long 3b,16b\n"
509 " .long 31b,16b\n"
510 " .long 4b,16b\n"
511 " .long 41b,16b\n"
512 " .long 10b,16b\n"
513 " .long 51b,16b\n"
514 " .long 11b,16b\n"
515 " .long 61b,16b\n"
516 " .long 12b,16b\n"
517 " .long 71b,16b\n"
518 " .long 13b,16b\n"
519 " .long 81b,16b\n"
520 " .long 14b,16b\n"
521 " .long 91b,16b\n"
522 " .long 6b,9b\n"
523 " .long 7b,16b\n"
524 ".previous"
525 : "=&c"(size), "=&D" (d0), "=&S" (d1)
526 : "1"(to), "2"(from), "0"(size)
527 : "eax", "edx", "memory");
528 return size;
529}
530
428#else 531#else
532
429/* 533/*
430 * Leave these declared but undefined. They should not be any references to 534 * Leave these declared but undefined. They should not be any references to
431 * them 535 * them
432 */ 536 */
433unsigned long 537unsigned long __copy_user_zeroing_intel(void *to, const void __user *from,
434__copy_user_zeroing_intel(void *to, const void __user *from, unsigned long size); 538 unsigned long size);
435unsigned long 539unsigned long __copy_user_intel(void __user *to, const void *from,
436__copy_user_intel(void __user *to, const void *from, unsigned long size); 540 unsigned long size);
541unsigned long __copy_user_zeroing_intel_nocache(void *to,
542 const void __user *from, unsigned long size);
437#endif /* CONFIG_X86_INTEL_USERCOPY */ 543#endif /* CONFIG_X86_INTEL_USERCOPY */
438 544
439/* Generic arbitrary sized copy. */ 545/* Generic arbitrary sized copy. */
@@ -515,8 +621,8 @@ do { \
515 : "memory"); \ 621 : "memory"); \
516} while (0) 622} while (0)
517 623
518 624unsigned long __copy_to_user_ll(void __user *to, const void *from,
519unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long n) 625 unsigned long n)
520{ 626{
521 BUG_ON((long) n < 0); 627 BUG_ON((long) n < 0);
522#ifndef CONFIG_X86_WP_WORKS_OK 628#ifndef CONFIG_X86_WP_WORKS_OK
@@ -576,8 +682,8 @@ survive:
576} 682}
577EXPORT_SYMBOL(__copy_to_user_ll); 683EXPORT_SYMBOL(__copy_to_user_ll);
578 684
579unsigned long 685unsigned long __copy_from_user_ll(void *to, const void __user *from,
580__copy_from_user_ll(void *to, const void __user *from, unsigned long n) 686 unsigned long n)
581{ 687{
582 BUG_ON((long)n < 0); 688 BUG_ON((long)n < 0);
583 if (movsl_is_ok(to, from, n)) 689 if (movsl_is_ok(to, from, n))
@@ -588,6 +694,21 @@ __copy_from_user_ll(void *to, const void __user *from, unsigned long n)
588} 694}
589EXPORT_SYMBOL(__copy_from_user_ll); 695EXPORT_SYMBOL(__copy_from_user_ll);
590 696
697unsigned long __copy_from_user_ll_nocache(void *to, const void __user *from,
698 unsigned long n)
699{
700 BUG_ON((long)n < 0);
701#ifdef CONFIG_X86_INTEL_USERCOPY
702 if ( n > 64 && cpu_has_xmm2)
703 n = __copy_user_zeroing_intel_nocache(to, from, n);
704 else
705 __copy_user_zeroing(to, from, n);
706#else
707 __copy_user_zeroing(to, from, n);
708#endif
709 return n;
710}
711
591/** 712/**
592 * copy_to_user: - Copy a block of data into user space. 713 * copy_to_user: - Copy a block of data into user space.
593 * @to: Destination address, in user space. 714 * @to: Destination address, in user space.
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index 7f0fcf219a26..bd6fe96cc16d 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -77,12 +77,15 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs,
77 unsigned seg = regs->xcs & 0xffff; 77 unsigned seg = regs->xcs & 0xffff;
78 u32 seg_ar, seg_limit, base, *desc; 78 u32 seg_ar, seg_limit, base, *desc;
79 79
80 /* Unlikely, but must come before segment checks. */
81 if (unlikely(regs->eflags & VM_MASK)) {
82 base = seg << 4;
83 *eip_limit = base + 0xffff;
84 return base + (eip & 0xffff);
85 }
86
80 /* The standard kernel/user address space limit. */ 87 /* The standard kernel/user address space limit. */
81 *eip_limit = (seg & 3) ? USER_DS.seg : KERNEL_DS.seg; 88 *eip_limit = (seg & 3) ? USER_DS.seg : KERNEL_DS.seg;
82
83 /* Unlikely, but must come before segment checks. */
84 if (unlikely((regs->eflags & VM_MASK) != 0))
85 return eip + (seg << 4);
86 89
87 /* By far the most common cases. */ 90 /* By far the most common cases. */
88 if (likely(seg == __USER_CS || seg == __KERNEL_CS)) 91 if (likely(seg == __USER_CS || seg == __KERNEL_CS))
@@ -380,12 +383,12 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
380 goto bad_area; 383 goto bad_area;
381 if (error_code & 4) { 384 if (error_code & 4) {
382 /* 385 /*
383 * accessing the stack below %esp is always a bug. 386 * Accessing the stack below %esp is always a bug.
384 * The "+ 32" is there due to some instructions (like 387 * The large cushion allows instructions like enter
385 * pusha) doing post-decrement on the stack and that 388 * and pusha to work. ("enter $65535,$31" pushes
386 * doesn't show up until later.. 389 * 32 pointers and then decrements %esp by 65535.)
387 */ 390 */
388 if (address + 32 < regs->esp) 391 if (address + 65536 + 32 * sizeof(unsigned long) < regs->esp)
389 goto bad_area; 392 goto bad_area;
390 } 393 }
391 if (expand_stack(vma, address)) 394 if (expand_stack(vma, address))
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 3df1371d4520..bf19513f0cea 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -29,6 +29,7 @@
29#include <linux/efi.h> 29#include <linux/efi.h>
30#include <linux/memory_hotplug.h> 30#include <linux/memory_hotplug.h>
31#include <linux/initrd.h> 31#include <linux/initrd.h>
32#include <linux/cpumask.h>
32 33
33#include <asm/processor.h> 34#include <asm/processor.h>
34#include <asm/system.h> 35#include <asm/system.h>
@@ -384,7 +385,7 @@ static void __init pagetable_init (void)
384#endif 385#endif
385} 386}
386 387
387#ifdef CONFIG_SOFTWARE_SUSPEND 388#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP)
388/* 389/*
389 * Swap suspend & friends need this for resume because things like the intel-agp 390 * Swap suspend & friends need this for resume because things like the intel-agp
390 * driver might have split up a kernel 4MB mapping. 391 * driver might have split up a kernel 4MB mapping.
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
index 92c3d9f0e731..0887b34bc59b 100644
--- a/arch/i386/mm/pageattr.c
+++ b/arch/i386/mm/pageattr.c
@@ -209,19 +209,19 @@ int change_page_attr(struct page *page, int numpages, pgprot_t prot)
209} 209}
210 210
211void global_flush_tlb(void) 211void global_flush_tlb(void)
212{ 212{
213 LIST_HEAD(l); 213 struct list_head l;
214 struct page *pg, *next; 214 struct page *pg, *next;
215 215
216 BUG_ON(irqs_disabled()); 216 BUG_ON(irqs_disabled());
217 217
218 spin_lock_irq(&cpa_lock); 218 spin_lock_irq(&cpa_lock);
219 list_splice_init(&df_list, &l); 219 list_replace_init(&df_list, &l);
220 spin_unlock_irq(&cpa_lock); 220 spin_unlock_irq(&cpa_lock);
221 flush_map(); 221 flush_map();
222 list_for_each_entry_safe(pg, next, &l, lru) 222 list_for_each_entry_safe(pg, next, &l, lru)
223 __free_page(pg); 223 __free_page(pg);
224} 224}
225 225
226#ifdef CONFIG_DEBUG_PAGEALLOC 226#ifdef CONFIG_DEBUG_PAGEALLOC
227void kernel_map_pages(struct page *page, int numpages, int enable) 227void kernel_map_pages(struct page *page, int numpages, int enable)
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index dbece776c5b2..c624b61e1104 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -288,6 +288,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
288 288
289void pcibios_disable_device (struct pci_dev *dev) 289void pcibios_disable_device (struct pci_dev *dev)
290{ 290{
291 pcibios_disable_resources(dev);
291 if (pcibios_disable_irq) 292 if (pcibios_disable_irq)
292 pcibios_disable_irq(dev); 293 pcibios_disable_irq(dev);
293} 294}
diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
index ed2c8c899bd3..7852827a599b 100644
--- a/arch/i386/pci/i386.c
+++ b/arch/i386/pci/i386.c
@@ -242,6 +242,15 @@ int pcibios_enable_resources(struct pci_dev *dev, int mask)
242 return 0; 242 return 0;
243} 243}
244 244
245void pcibios_disable_resources(struct pci_dev *dev)
246{
247 u16 cmd;
248
249 pci_read_config_word(dev, PCI_COMMAND, &cmd);
250 cmd &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
251 pci_write_config_word(dev, PCI_COMMAND, cmd);
252}
253
245/* 254/*
246 * If we set up a device for bus mastering, we need to check the latency 255 * If we set up a device for bus mastering, we need to check the latency
247 * timer as certain crappy BIOSes forget to set it properly. 256 * timer as certain crappy BIOSes forget to set it properly.
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 06dab00aaadc..8ce69508f3c7 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -198,14 +198,14 @@ static void write_config_nybble(struct pci_dev *router, unsigned offset, unsigne
198 */ 198 */
199static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq) 199static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
200{ 200{
201 static unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 }; 201 static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 };
202 202
203 return irqmap[read_config_nybble(router, 0x48, pirq-1)]; 203 return irqmap[read_config_nybble(router, 0x48, pirq-1)];
204} 204}
205 205
206static int pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) 206static int pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
207{ 207{
208 static unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 }; 208 static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 };
209 unsigned int val = irqmap[irq]; 209 unsigned int val = irqmap[irq];
210 210
211 if (val) { 211 if (val) {
@@ -256,13 +256,13 @@ static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i
256 */ 256 */
257static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq) 257static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
258{ 258{
259 static unsigned int pirqmap[4] = { 3, 2, 5, 1 }; 259 static const unsigned int pirqmap[4] = { 3, 2, 5, 1 };
260 return read_config_nybble(router, 0x55, pirqmap[pirq-1]); 260 return read_config_nybble(router, 0x55, pirqmap[pirq-1]);
261} 261}
262 262
263static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) 263static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
264{ 264{
265 static unsigned int pirqmap[4] = { 3, 2, 5, 1 }; 265 static const unsigned int pirqmap[4] = { 3, 2, 5, 1 };
266 write_config_nybble(router, 0x55, pirqmap[pirq-1], irq); 266 write_config_nybble(router, 0x55, pirqmap[pirq-1], irq);
267 return 1; 267 return 1;
268} 268}
@@ -274,13 +274,13 @@ static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq
274 */ 274 */
275static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq) 275static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
276{ 276{
277 static unsigned char pirqmap[4] = { 1, 0, 2, 3 }; 277 static const unsigned char pirqmap[4] = { 1, 0, 2, 3 };
278 return read_config_nybble(router,0x43, pirqmap[pirq-1]); 278 return read_config_nybble(router,0x43, pirqmap[pirq-1]);
279} 279}
280 280
281static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) 281static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
282{ 282{
283 static unsigned char pirqmap[4] = { 1, 0, 2, 3 }; 283 static const unsigned char pirqmap[4] = { 1, 0, 2, 3 };
284 write_config_nybble(router, 0x43, pirqmap[pirq-1], irq); 284 write_config_nybble(router, 0x43, pirqmap[pirq-1], irq);
285 return 1; 285 return 1;
286} 286}
@@ -505,7 +505,7 @@ static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
505 505
506static __init int intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 506static __init int intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
507{ 507{
508 static struct pci_device_id pirq_440gx[] = { 508 static struct pci_device_id __initdata pirq_440gx[] = {
509 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0) }, 509 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0) },
510 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_2) }, 510 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_2) },
511 { }, 511 { },
@@ -880,6 +880,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
880 ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask)) ) { 880 ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask)) ) {
881 DBG(" -> got IRQ %d\n", irq); 881 DBG(" -> got IRQ %d\n", irq);
882 msg = "Found"; 882 msg = "Found";
883 eisa_set_level_irq(irq);
883 } else if (newirq && r->set && (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) { 884 } else if (newirq && r->set && (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
884 DBG(" -> assigning IRQ %d", newirq); 885 DBG(" -> assigning IRQ %d", newirq);
885 if (r->set(pirq_router_dev, dev, pirq, newirq)) { 886 if (r->set(pirq_router_dev, dev, pirq, newirq)) {
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index 6b1ea0c9a570..e545b0992c48 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -15,7 +15,9 @@
15#include <asm/e820.h> 15#include <asm/e820.h>
16#include "pci.h" 16#include "pci.h"
17 17
18#define MMCONFIG_APER_SIZE (256*1024*1024) 18/* aperture is up to 256MB but BIOS may reserve less */
19#define MMCONFIG_APER_MIN (2 * 1024*1024)
20#define MMCONFIG_APER_MAX (256 * 1024*1024)
19 21
20/* Assume systems with more busses have correct MCFG */ 22/* Assume systems with more busses have correct MCFG */
21#define MAX_CHECK_BUS 16 23#define MAX_CHECK_BUS 16
@@ -197,9 +199,10 @@ void __init pci_mmcfg_init(void)
197 return; 199 return;
198 200
199 if (!e820_all_mapped(pci_mmcfg_config[0].base_address, 201 if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
200 pci_mmcfg_config[0].base_address + MMCONFIG_APER_SIZE, 202 pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN,
201 E820_RESERVED)) { 203 E820_RESERVED)) {
202 printk(KERN_ERR "PCI: BIOS Bug: MCFG area is not E820-reserved\n"); 204 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n",
205 pci_mmcfg_config[0].base_address);
203 printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); 206 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
204 return; 207 return;
205 } 208 }
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h
index 12035e29108b..12bf3d8dda29 100644
--- a/arch/i386/pci/pci.h
+++ b/arch/i386/pci/pci.h
@@ -35,6 +35,7 @@ extern unsigned int pcibios_max_latency;
35 35
36void pcibios_resource_survey(void); 36void pcibios_resource_survey(void);
37int pcibios_enable_resources(struct pci_dev *, int); 37int pcibios_enable_resources(struct pci_dev *, int);
38void pcibios_disable_resources(struct pci_dev *);
38 39
39/* pci-pc.c */ 40/* pci-pc.c */
40 41
diff --git a/arch/i386/power/cpu.c b/arch/i386/power/cpu.c
index 79b2370c7fac..e6517915fe3e 100644
--- a/arch/i386/power/cpu.c
+++ b/arch/i386/power/cpu.c
@@ -10,6 +10,8 @@
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <asm/mtrr.h>
14#include <asm/mce.h>
13 15
14static struct saved_context saved_context; 16static struct saved_context saved_context;
15 17
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index cd2051f5c9ce..18318749884b 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -77,6 +77,7 @@ choice
77config IA64_GENERIC 77config IA64_GENERIC
78 bool "generic" 78 bool "generic"
79 select ACPI 79 select ACPI
80 select PCI
80 select NUMA 81 select NUMA
81 select ACPI_NUMA 82 select ACPI_NUMA
82 help 83 help
@@ -273,7 +274,6 @@ config HOTPLUG_CPU
273config SCHED_SMT 274config SCHED_SMT
274 bool "SMT scheduler support" 275 bool "SMT scheduler support"
275 depends on SMP 276 depends on SMP
276 default off
277 help 277 help
278 Improves the CPU scheduler's decision making when dealing with 278 Improves the CPU scheduler's decision making when dealing with
279 Intel IA64 chips with MultiThreading at a cost of slightly increased 279 Intel IA64 chips with MultiThreading at a cost of slightly increased
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index bdccd0b1eb60..5825ddee58d6 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1958,7 +1958,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
1958 if (pxm < 0) 1958 if (pxm < 0)
1959 return; 1959 return;
1960 1960
1961 node = pxm_to_nid_map[pxm]; 1961 node = pxm_to_node(pxm);
1962 1962
1963 if (node >= MAX_NUMNODES || !node_online(node)) 1963 if (node >= MAX_NUMNODES || !node_online(node))
1964 return; 1964 return;
@@ -1999,7 +1999,7 @@ acpi_sba_ioc_add(struct acpi_device *device)
1999 if (!iovp_shift) 1999 if (!iovp_shift)
2000 iovp_shift = min(PAGE_SHIFT, 16); 2000 iovp_shift = min(PAGE_SHIFT, 16);
2001 } 2001 }
2002 ACPI_MEM_FREE(dev_info); 2002 kfree(dev_info);
2003 2003
2004 /* 2004 /*
2005 * default anything not caught above or specified on cmdline to 4k 2005 * default anything not caught above or specified on cmdline to 4k
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 58c93a30348c..6ea642beaaee 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -68,8 +68,6 @@ EXPORT_SYMBOL(pm_power_off);
68unsigned char acpi_kbd_controller_present = 1; 68unsigned char acpi_kbd_controller_present = 1;
69unsigned char acpi_legacy_devices; 69unsigned char acpi_legacy_devices;
70 70
71static unsigned int __initdata acpi_madt_rev;
72
73unsigned int acpi_cpei_override; 71unsigned int acpi_cpei_override;
74unsigned int acpi_cpei_phys_cpuid; 72unsigned int acpi_cpei_phys_cpuid;
75 73
@@ -243,6 +241,8 @@ acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
243 return iosapic_init(iosapic->address, iosapic->global_irq_base); 241 return iosapic_init(iosapic->address, iosapic->global_irq_base);
244} 242}
245 243
244static unsigned int __initdata acpi_madt_rev;
245
246static int __init 246static int __init
247acpi_parse_plat_int_src(acpi_table_entry_header * header, 247acpi_parse_plat_int_src(acpi_table_entry_header * header,
248 const unsigned long end) 248 const unsigned long end)
@@ -415,9 +415,6 @@ static int __initdata srat_num_cpus; /* number of cpus */
415static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; 415static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
416#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) 416#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
417#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) 417#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
418/* maps to convert between proximity domain and logical node ID */
419int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
420int __initdata nid_to_pxm_map[MAX_NUMNODES];
421static struct acpi_table_slit __initdata *slit_table; 418static struct acpi_table_slit __initdata *slit_table;
422 419
423static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa) 420static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa)
@@ -533,22 +530,17 @@ void __init acpi_numa_arch_fixup(void)
533 * MCD - This can probably be dropped now. No need for pxm ID to node ID 530 * MCD - This can probably be dropped now. No need for pxm ID to node ID
534 * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES. 531 * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
535 */ 532 */
536 /* calculate total number of nodes in system from PXM bitmap */
537 memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
538 memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
539 nodes_clear(node_online_map); 533 nodes_clear(node_online_map);
540 for (i = 0; i < MAX_PXM_DOMAINS; i++) { 534 for (i = 0; i < MAX_PXM_DOMAINS; i++) {
541 if (pxm_bit_test(i)) { 535 if (pxm_bit_test(i)) {
542 int nid = num_online_nodes(); 536 int nid = acpi_map_pxm_to_node(i);
543 pxm_to_nid_map[i] = nid;
544 nid_to_pxm_map[nid] = i;
545 node_set_online(nid); 537 node_set_online(nid);
546 } 538 }
547 } 539 }
548 540
549 /* set logical node id in memory chunk structure */ 541 /* set logical node id in memory chunk structure */
550 for (i = 0; i < num_node_memblks; i++) 542 for (i = 0; i < num_node_memblks; i++)
551 node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid]; 543 node_memblk[i].nid = pxm_to_node(node_memblk[i].nid);
552 544
553 /* assign memory bank numbers for each chunk on each node */ 545 /* assign memory bank numbers for each chunk on each node */
554 for_each_online_node(i) { 546 for_each_online_node(i) {
@@ -562,7 +554,7 @@ void __init acpi_numa_arch_fixup(void)
562 554
563 /* set logical node id in cpu structure */ 555 /* set logical node id in cpu structure */
564 for (i = 0; i < srat_num_cpus; i++) 556 for (i = 0; i < srat_num_cpus; i++)
565 node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid]; 557 node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
566 558
567 printk(KERN_INFO "Number of logical nodes in system = %d\n", 559 printk(KERN_INFO "Number of logical nodes in system = %d\n",
568 num_online_nodes()); 560 num_online_nodes());
@@ -575,11 +567,11 @@ void __init acpi_numa_arch_fixup(void)
575 for (i = 0; i < slit_table->localities; i++) { 567 for (i = 0; i < slit_table->localities; i++) {
576 if (!pxm_bit_test(i)) 568 if (!pxm_bit_test(i))
577 continue; 569 continue;
578 node_from = pxm_to_nid_map[i]; 570 node_from = pxm_to_node(i);
579 for (j = 0; j < slit_table->localities; j++) { 571 for (j = 0; j < slit_table->localities; j++) {
580 if (!pxm_bit_test(j)) 572 if (!pxm_bit_test(j))
581 continue; 573 continue;
582 node_to = pxm_to_nid_map[j]; 574 node_to = pxm_to_node(j);
583 node_distance(node_from, node_to) = 575 node_distance(node_from, node_to) =
584 slit_table->entry[i * slit_table->localities + j]; 576 slit_table->entry[i * slit_table->localities + j];
585 } 577 }
@@ -785,9 +777,9 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
785 777
786 /* 778 /*
787 * Assuming that the container driver would have set the proximity 779 * Assuming that the container driver would have set the proximity
788 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag 780 * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag
789 */ 781 */
790 node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id]; 782 node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id);
791 783
792 node_cpuid[cpu].phys_id = physid; 784 node_cpuid[cpu].phys_id = physid;
793#endif 785#endif
@@ -966,7 +958,7 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
966 if (pxm < 0) 958 if (pxm < 0)
967 return AE_OK; 959 return AE_OK;
968 960
969 node = pxm_to_nid_map[pxm]; 961 node = pxm_to_node(pxm);
970 962
971 if (node >= MAX_NUMNODES || !node_online(node) || 963 if (node >= MAX_NUMNODES || !node_online(node) ||
972 cpus_empty(node_to_cpumask(node))) 964 cpus_empty(node_to_cpumask(node)))
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index bcb80ca5cf40..32c999f58d12 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1584,7 +1584,7 @@ sys_call_table:
1584 data8 sys_keyctl 1584 data8 sys_keyctl
1585 data8 sys_ioprio_set 1585 data8 sys_ioprio_set
1586 data8 sys_ioprio_get // 1275 1586 data8 sys_ioprio_get // 1275
1587 data8 sys_ni_syscall 1587 data8 sys_move_pages
1588 data8 sys_inotify_init 1588 data8 sys_inotify_init
1589 data8 sys_inotify_add_watch 1589 data8 sys_inotify_add_watch
1590 data8 sys_inotify_rm_watch 1590 data8 sys_inotify_rm_watch
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 6c4d59fd0364..ef9a2b49307a 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -46,6 +46,10 @@
46 46
47#define IRQ_DEBUG 0 47#define IRQ_DEBUG 0
48 48
49/* These can be overridden in platform_irq_init */
50int ia64_first_device_vector = IA64_DEF_FIRST_DEVICE_VECTOR;
51int ia64_last_device_vector = IA64_DEF_LAST_DEVICE_VECTOR;
52
49/* default base addr of IPI table */ 53/* default base addr of IPI table */
50void __iomem *ipi_base_addr = ((void __iomem *) 54void __iomem *ipi_base_addr = ((void __iomem *)
51 (__IA64_UNCACHED_OFFSET | IA64_IPI_DEFAULT_BASE_ADDR)); 55 (__IA64_UNCACHED_OFFSET | IA64_IPI_DEFAULT_BASE_ADDR));
@@ -60,7 +64,7 @@ __u8 isa_irq_to_vector_map[16] = {
60}; 64};
61EXPORT_SYMBOL(isa_irq_to_vector_map); 65EXPORT_SYMBOL(isa_irq_to_vector_map);
62 66
63static unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)]; 67static unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_MAX_DEVICE_VECTORS)];
64 68
65int 69int
66assign_irq_vector (int irq) 70assign_irq_vector (int irq)
@@ -89,6 +93,19 @@ free_irq_vector (int vector)
89 printk(KERN_WARNING "%s: double free!\n", __FUNCTION__); 93 printk(KERN_WARNING "%s: double free!\n", __FUNCTION__);
90} 94}
91 95
96int
97reserve_irq_vector (int vector)
98{
99 int pos;
100
101 if (vector < IA64_FIRST_DEVICE_VECTOR ||
102 vector > IA64_LAST_DEVICE_VECTOR)
103 return -EINVAL;
104
105 pos = vector - IA64_FIRST_DEVICE_VECTOR;
106 return test_and_set_bit(pos, ia64_vector_mask);
107}
108
92#ifdef CONFIG_SMP 109#ifdef CONFIG_SMP
93# define IS_RESCHEDULE(vec) (vec == IA64_IPI_RESCHEDULE) 110# define IS_RESCHEDULE(vec) (vec == IA64_IPI_RESCHEDULE)
94#else 111#else
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 077f21216b65..6d7bc8ff7b3a 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -532,7 +532,6 @@ static ctl_table pfm_sysctl_root[] = {
532static struct ctl_table_header *pfm_sysctl_header; 532static struct ctl_table_header *pfm_sysctl_header;
533 533
534static int pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs); 534static int pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
535static int pfm_flush(struct file *filp);
536 535
537#define pfm_get_cpu_var(v) __ia64_per_cpu_var(v) 536#define pfm_get_cpu_var(v) __ia64_per_cpu_var(v)
538#define pfm_get_cpu_data(a,b) per_cpu(a, b) 537#define pfm_get_cpu_data(a,b) per_cpu(a, b)
@@ -595,10 +594,11 @@ pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
595} 594}
596 595
597 596
598static struct super_block * 597static int
599pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) 598pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data,
599 struct vfsmount *mnt)
600{ 600{
601 return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC); 601 return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC, mnt);
602} 602}
603 603
604static struct file_system_type pfm_fs_type = { 604static struct file_system_type pfm_fs_type = {
@@ -1773,7 +1773,7 @@ pfm_syswide_cleanup_other_cpu(pfm_context_t *ctx)
1773 * When caller is self-monitoring, the context is unloaded. 1773 * When caller is self-monitoring, the context is unloaded.
1774 */ 1774 */
1775static int 1775static int
1776pfm_flush(struct file *filp) 1776pfm_flush(struct file *filp, fl_owner_t id)
1777{ 1777{
1778 pfm_context_t *ctx; 1778 pfm_context_t *ctx;
1779 struct task_struct *task; 1779 struct task_struct *task;
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index fcd2bad0286f..5f03b9e524dd 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2001-2005 Silicon Graphics, Inc. All rights reserved. 2 * Copyright (C) 2001-2006 Silicon Graphics, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License 5 * under the terms of version 2 of the GNU General Public License
@@ -29,15 +29,8 @@
29#include <asm/tlbflush.h> 29#include <asm/tlbflush.h>
30#include <asm/sn/arch.h> 30#include <asm/sn/arch.h>
31 31
32#define DEBUG 0
33 32
34#if DEBUG 33extern void __init efi_memmap_walk_uc(efi_freemem_callback_t, void *);
35#define dprintk printk
36#else
37#define dprintk(x...) do { } while (0)
38#endif
39
40void __init efi_memmap_walk_uc (efi_freemem_callback_t callback);
41 34
42#define MAX_UNCACHED_GRANULES 5 35#define MAX_UNCACHED_GRANULES 5
43static int allocated_granules; 36static int allocated_granules;
@@ -60,6 +53,7 @@ static void uncached_ipi_visibility(void *data)
60static void uncached_ipi_mc_drain(void *data) 53static void uncached_ipi_mc_drain(void *data)
61{ 54{
62 int status; 55 int status;
56
63 status = ia64_pal_mc_drain(); 57 status = ia64_pal_mc_drain();
64 if (status) 58 if (status)
65 printk(KERN_WARNING "ia64_pal_mc_drain() failed with %i on " 59 printk(KERN_WARNING "ia64_pal_mc_drain() failed with %i on "
@@ -67,30 +61,35 @@ static void uncached_ipi_mc_drain(void *data)
67} 61}
68 62
69 63
70static unsigned long 64/*
71uncached_get_new_chunk(struct gen_pool *poolp) 65 * Add a new chunk of uncached memory pages to the specified pool.
66 *
67 * @pool: pool to add new chunk of uncached memory to
68 * @nid: node id of node to allocate memory from, or -1
69 *
70 * This is accomplished by first allocating a granule of cached memory pages
71 * and then converting them to uncached memory pages.
72 */
73static int uncached_add_chunk(struct gen_pool *pool, int nid)
72{ 74{
73 struct page *page; 75 struct page *page;
74 void *tmp;
75 int status, i; 76 int status, i;
76 unsigned long addr, node; 77 unsigned long c_addr, uc_addr;
77 78
78 if (allocated_granules >= MAX_UNCACHED_GRANULES) 79 if (allocated_granules >= MAX_UNCACHED_GRANULES)
79 return 0; 80 return -1;
81
82 /* attempt to allocate a granule's worth of cached memory pages */
80 83
81 node = poolp->private; 84 page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO,
82 page = alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO,
83 IA64_GRANULE_SHIFT-PAGE_SHIFT); 85 IA64_GRANULE_SHIFT-PAGE_SHIFT);
86 if (!page)
87 return -1;
84 88
85 dprintk(KERN_INFO "get_new_chunk page %p, addr %lx\n", 89 /* convert the memory pages from cached to uncached */
86 page, (unsigned long)(page-vmem_map) << PAGE_SHIFT);
87 90
88 /* 91 c_addr = (unsigned long)page_address(page);
89 * Do magic if no mem on local node! XXX 92 uc_addr = c_addr - PAGE_OFFSET + __IA64_UNCACHED_OFFSET;
90 */
91 if (!page)
92 return 0;
93 tmp = page_address(page);
94 93
95 /* 94 /*
96 * There's a small race here where it's possible for someone to 95 * There's a small race here where it's possible for someone to
@@ -100,76 +99,90 @@ uncached_get_new_chunk(struct gen_pool *poolp)
100 for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++) 99 for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++)
101 SetPageUncached(&page[i]); 100 SetPageUncached(&page[i]);
102 101
103 flush_tlb_kernel_range(tmp, tmp + IA64_GRANULE_SIZE); 102 flush_tlb_kernel_range(uc_addr, uc_adddr + IA64_GRANULE_SIZE);
104 103
105 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); 104 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
106
107 dprintk(KERN_INFO "pal_prefetch_visibility() returns %i on cpu %i\n",
108 status, raw_smp_processor_id());
109
110 if (!status) { 105 if (!status) {
111 status = smp_call_function(uncached_ipi_visibility, NULL, 0, 1); 106 status = smp_call_function(uncached_ipi_visibility, NULL, 0, 1);
112 if (status) 107 if (status)
113 printk(KERN_WARNING "smp_call_function failed for " 108 goto failed;
114 "uncached_ipi_visibility! (%i)\n", status);
115 } 109 }
116 110
111 preempt_disable();
112
117 if (ia64_platform_is("sn2")) 113 if (ia64_platform_is("sn2"))
118 sn_flush_all_caches((unsigned long)tmp, IA64_GRANULE_SIZE); 114 sn_flush_all_caches(uc_addr, IA64_GRANULE_SIZE);
119 else 115 else
120 flush_icache_range((unsigned long)tmp, 116 flush_icache_range(uc_addr, uc_addr + IA64_GRANULE_SIZE);
121 (unsigned long)tmp+IA64_GRANULE_SIZE); 117
118 /* flush the just introduced uncached translation from the TLB */
119 local_flush_tlb_all();
120
121 preempt_enable();
122 122
123 ia64_pal_mc_drain(); 123 ia64_pal_mc_drain();
124 status = smp_call_function(uncached_ipi_mc_drain, NULL, 0, 1); 124 status = smp_call_function(uncached_ipi_mc_drain, NULL, 0, 1);
125 if (status) 125 if (status)
126 printk(KERN_WARNING "smp_call_function failed for " 126 goto failed;
127 "uncached_ipi_mc_drain! (%i)\n", status);
128 127
129 addr = (unsigned long)tmp - PAGE_OFFSET + __IA64_UNCACHED_OFFSET; 128 /*
129 * The chunk of memory pages has been converted to uncached so now we
130 * can add it to the pool.
131 */
132 status = gen_pool_add(pool, uc_addr, IA64_GRANULE_SIZE, nid);
133 if (status)
134 goto failed;
130 135
131 allocated_granules++; 136 allocated_granules++;
132 return addr; 137 return 0;
138
139 /* failed to convert or add the chunk so give it back to the kernel */
140failed:
141 for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++)
142 ClearPageUncached(&page[i]);
143
144 free_pages(c_addr, IA64_GRANULE_SHIFT-PAGE_SHIFT);
145 return -1;
133} 146}
134 147
135 148
136/* 149/*
137 * uncached_alloc_page 150 * uncached_alloc_page
138 * 151 *
152 * @starting_nid: node id of node to start with, or -1
153 *
139 * Allocate 1 uncached page. Allocates on the requested node. If no 154 * Allocate 1 uncached page. Allocates on the requested node. If no
140 * uncached pages are available on the requested node, roundrobin starting 155 * uncached pages are available on the requested node, roundrobin starting
141 * with higher nodes. 156 * with the next higher node.
142 */ 157 */
143unsigned long 158unsigned long uncached_alloc_page(int starting_nid)
144uncached_alloc_page(int nid)
145{ 159{
146 unsigned long maddr; 160 unsigned long uc_addr;
161 struct gen_pool *pool;
162 int nid;
147 163
148 maddr = gen_pool_alloc(uncached_pool[nid], PAGE_SIZE); 164 if (unlikely(starting_nid >= MAX_NUMNODES))
165 return 0;
149 166
150 dprintk(KERN_DEBUG "uncached_alloc_page returns %lx on node %i\n", 167 if (starting_nid < 0)
151 maddr, nid); 168 starting_nid = numa_node_id();
169 nid = starting_nid;
152 170
153 /* 171 do {
154 * If no memory is availble on our local node, try the 172 if (!node_online(nid))
155 * remaining nodes in the system. 173 continue;
156 */ 174 pool = uncached_pool[nid];
157 if (!maddr) { 175 if (pool == NULL)
158 int i; 176 continue;
159 177 do {
160 for (i = MAX_NUMNODES - 1; i >= 0; i--) { 178 uc_addr = gen_pool_alloc(pool, PAGE_SIZE);
161 if (i == nid || !node_online(i)) 179 if (uc_addr != 0)
162 continue; 180 return uc_addr;
163 maddr = gen_pool_alloc(uncached_pool[i], PAGE_SIZE); 181 } while (uncached_add_chunk(pool, nid) == 0);
164 dprintk(KERN_DEBUG "uncached_alloc_page alternate search " 182
165 "returns %lx on node %i\n", maddr, i); 183 } while ((nid = (nid + 1) % MAX_NUMNODES) != starting_nid);
166 if (maddr) {
167 break;
168 }
169 }
170 }
171 184
172 return maddr; 185 return 0;
173} 186}
174EXPORT_SYMBOL(uncached_alloc_page); 187EXPORT_SYMBOL(uncached_alloc_page);
175 188
@@ -177,21 +190,22 @@ EXPORT_SYMBOL(uncached_alloc_page);
177/* 190/*
178 * uncached_free_page 191 * uncached_free_page
179 * 192 *
193 * @uc_addr: uncached address of page to free
194 *
180 * Free a single uncached page. 195 * Free a single uncached page.
181 */ 196 */
182void 197void uncached_free_page(unsigned long uc_addr)
183uncached_free_page(unsigned long maddr)
184{ 198{
185 int node; 199 int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET);
186 200 struct gen_pool *pool = uncached_pool[nid];
187 node = paddr_to_nid(maddr - __IA64_UNCACHED_OFFSET);
188 201
189 dprintk(KERN_DEBUG "uncached_free_page(%lx) on node %i\n", maddr, node); 202 if (unlikely(pool == NULL))
203 return;
190 204
191 if ((maddr & (0XFUL << 60)) != __IA64_UNCACHED_OFFSET) 205 if ((uc_addr & (0XFUL << 60)) != __IA64_UNCACHED_OFFSET)
192 panic("uncached_free_page invalid address %lx\n", maddr); 206 panic("uncached_free_page invalid address %lx\n", uc_addr);
193 207
194 gen_pool_free(uncached_pool[node], maddr, PAGE_SIZE); 208 gen_pool_free(pool, uc_addr, PAGE_SIZE);
195} 209}
196EXPORT_SYMBOL(uncached_free_page); 210EXPORT_SYMBOL(uncached_free_page);
197 211
@@ -199,43 +213,39 @@ EXPORT_SYMBOL(uncached_free_page);
199/* 213/*
200 * uncached_build_memmap, 214 * uncached_build_memmap,
201 * 215 *
216 * @uc_start: uncached starting address of a chunk of uncached memory
217 * @uc_end: uncached ending address of a chunk of uncached memory
218 * @arg: ignored, (NULL argument passed in on call to efi_memmap_walk_uc())
219 *
202 * Called at boot time to build a map of pages that can be used for 220 * Called at boot time to build a map of pages that can be used for
203 * memory special operations. 221 * memory special operations.
204 */ 222 */
205static int __init 223static int __init uncached_build_memmap(unsigned long uc_start,
206uncached_build_memmap(unsigned long start, unsigned long end, void *arg) 224 unsigned long uc_end, void *arg)
207{ 225{
208 long length = end - start; 226 int nid = paddr_to_nid(uc_start - __IA64_UNCACHED_OFFSET);
209 int node; 227 struct gen_pool *pool = uncached_pool[nid];
210 228 size_t size = uc_end - uc_start;
211 dprintk(KERN_ERR "uncached_build_memmap(%lx %lx)\n", start, end);
212 229
213 touch_softlockup_watchdog(); 230 touch_softlockup_watchdog();
214 memset((char *)start, 0, length);
215 231
216 node = paddr_to_nid(start - __IA64_UNCACHED_OFFSET); 232 if (pool != NULL) {
217 233 memset((char *)uc_start, 0, size);
218 for (; start < end ; start += PAGE_SIZE) { 234 (void) gen_pool_add(pool, uc_start, size, nid);
219 dprintk(KERN_INFO "sticking %lx into the pool!\n", start);
220 gen_pool_free(uncached_pool[node], start, PAGE_SIZE);
221 } 235 }
222
223 return 0; 236 return 0;
224} 237}
225 238
226 239
227static int __init uncached_init(void) { 240static int __init uncached_init(void)
228 int i; 241{
242 int nid;
229 243
230 for (i = 0; i < MAX_NUMNODES; i++) { 244 for_each_online_node(nid) {
231 if (!node_online(i)) 245 uncached_pool[nid] = gen_pool_create(PAGE_SHIFT, nid);
232 continue;
233 uncached_pool[i] = gen_pool_create(0, IA64_GRANULE_SHIFT,
234 &uncached_get_new_chunk, i);
235 } 246 }
236 247
237 efi_memmap_walk_uc(uncached_build_memmap); 248 efi_memmap_walk_uc(uncached_build_memmap, NULL);
238
239 return 0; 249 return 0;
240} 250}
241 251
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index cafa8776a53d..11f08001f8c2 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -671,9 +671,11 @@ int add_memory(u64 start, u64 size)
671 671
672 return ret; 672 return ret;
673} 673}
674EXPORT_SYMBOL_GPL(add_memory);
674 675
675int remove_memory(u64 start, u64 size) 676int remove_memory(u64 start, u64 size)
676{ 677{
677 return -EINVAL; 678 return -EINVAL;
678} 679}
680EXPORT_SYMBOL_GPL(remove_memory);
679#endif 681#endif
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 30d148f34042..61dd8608da4f 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -352,7 +352,7 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
352 pxm = acpi_get_pxm(controller->acpi_handle); 352 pxm = acpi_get_pxm(controller->acpi_handle);
353#ifdef CONFIG_NUMA 353#ifdef CONFIG_NUMA
354 if (pxm >= 0) 354 if (pxm >= 0)
355 controller->node = pxm_to_nid_map[pxm]; 355 controller->node = pxm_to_node(pxm);
356#endif 356#endif
357 357
358 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, 358 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 5101ac462643..dc09a6a28a37 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -58,7 +58,7 @@ static int max_pcibus_number = 255; /* Default highest pci bus number */
58 */ 58 */
59 59
60static dma_addr_t 60static dma_addr_t
61sn_default_pci_map(struct pci_dev *pdev, unsigned long paddr, size_t size) 61sn_default_pci_map(struct pci_dev *pdev, unsigned long paddr, size_t size, int type)
62{ 62{
63 return 0; 63 return 0;
64} 64}
@@ -457,13 +457,6 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
457 pcidev_info->pdi_sn_irq_info = NULL; 457 pcidev_info->pdi_sn_irq_info = NULL;
458 kfree(sn_irq_info); 458 kfree(sn_irq_info);
459 } 459 }
460
461 /*
462 * MSI currently not supported on altix. Remove this when
463 * the MSI abstraction patches are integrated into the kernel
464 * (sometime after 2.6.16 releases)
465 */
466 dev->no_msi = 1;
467} 460}
468 461
469/* 462/*
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index c265e02f5036..dc8e2b696713 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -26,11 +26,11 @@ static void unregister_intr_pda(struct sn_irq_info *sn_irq_info);
26 26
27int sn_force_interrupt_flag = 1; 27int sn_force_interrupt_flag = 1;
28extern int sn_ioif_inited; 28extern int sn_ioif_inited;
29static struct list_head **sn_irq_lh; 29struct list_head **sn_irq_lh;
30static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */ 30static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */
31 31
32static inline u64 sn_intr_alloc(nasid_t local_nasid, int local_widget, 32u64 sn_intr_alloc(nasid_t local_nasid, int local_widget,
33 u64 sn_irq_info, 33 struct sn_irq_info *sn_irq_info,
34 int req_irq, nasid_t req_nasid, 34 int req_irq, nasid_t req_nasid,
35 int req_slice) 35 int req_slice)
36{ 36{
@@ -40,12 +40,13 @@ static inline u64 sn_intr_alloc(nasid_t local_nasid, int local_widget,
40 40
41 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_INTERRUPT, 41 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_INTERRUPT,
42 (u64) SAL_INTR_ALLOC, (u64) local_nasid, 42 (u64) SAL_INTR_ALLOC, (u64) local_nasid,
43 (u64) local_widget, (u64) sn_irq_info, (u64) req_irq, 43 (u64) local_widget, __pa(sn_irq_info), (u64) req_irq,
44 (u64) req_nasid, (u64) req_slice); 44 (u64) req_nasid, (u64) req_slice);
45
45 return ret_stuff.status; 46 return ret_stuff.status;
46} 47}
47 48
48static inline void sn_intr_free(nasid_t local_nasid, int local_widget, 49void sn_intr_free(nasid_t local_nasid, int local_widget,
49 struct sn_irq_info *sn_irq_info) 50 struct sn_irq_info *sn_irq_info)
50{ 51{
51 struct ia64_sal_retval ret_stuff; 52 struct ia64_sal_retval ret_stuff;
@@ -112,73 +113,91 @@ static void sn_end_irq(unsigned int irq)
112 113
113static void sn_irq_info_free(struct rcu_head *head); 114static void sn_irq_info_free(struct rcu_head *head);
114 115
115static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask) 116struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
117 nasid_t nasid, int slice)
116{ 118{
117 struct sn_irq_info *sn_irq_info, *sn_irq_info_safe; 119 int vector;
118 int cpuid, cpuphys; 120 int cpuphys;
121 int64_t bridge;
122 int local_widget, status;
123 nasid_t local_nasid;
124 struct sn_irq_info *new_irq_info;
125 struct sn_pcibus_provider *pci_provider;
119 126
120 cpuid = first_cpu(mask); 127 new_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_ATOMIC);
121 cpuphys = cpu_physical_id(cpuid); 128 if (new_irq_info == NULL)
129 return NULL;
122 130
123 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe, 131 memcpy(new_irq_info, sn_irq_info, sizeof(struct sn_irq_info));
124 sn_irq_lh[irq], list) { 132
125 u64 bridge; 133 bridge = (u64) new_irq_info->irq_bridge;
126 int local_widget, status; 134 if (!bridge) {
127 nasid_t local_nasid; 135 kfree(new_irq_info);
128 struct sn_irq_info *new_irq_info; 136 return NULL; /* irq is not a device interrupt */
129 struct sn_pcibus_provider *pci_provider; 137 }
130
131 new_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_ATOMIC);
132 if (new_irq_info == NULL)
133 break;
134 memcpy(new_irq_info, sn_irq_info, sizeof(struct sn_irq_info));
135
136 bridge = (u64) new_irq_info->irq_bridge;
137 if (!bridge) {
138 kfree(new_irq_info);
139 break; /* irq is not a device interrupt */
140 }
141 138
142 local_nasid = NASID_GET(bridge); 139 local_nasid = NASID_GET(bridge);
143 140
144 if (local_nasid & 1) 141 if (local_nasid & 1)
145 local_widget = TIO_SWIN_WIDGETNUM(bridge); 142 local_widget = TIO_SWIN_WIDGETNUM(bridge);
146 else 143 else
147 local_widget = SWIN_WIDGETNUM(bridge); 144 local_widget = SWIN_WIDGETNUM(bridge);
148 145
149 /* Free the old PROM new_irq_info structure */ 146 vector = sn_irq_info->irq_irq;
150 sn_intr_free(local_nasid, local_widget, new_irq_info); 147 /* Free the old PROM new_irq_info structure */
151 /* Update kernels new_irq_info with new target info */ 148 sn_intr_free(local_nasid, local_widget, new_irq_info);
152 unregister_intr_pda(new_irq_info); 149 /* Update kernels new_irq_info with new target info */
150 unregister_intr_pda(new_irq_info);
153 151
154 /* allocate a new PROM new_irq_info struct */ 152 /* allocate a new PROM new_irq_info struct */
155 status = sn_intr_alloc(local_nasid, local_widget, 153 status = sn_intr_alloc(local_nasid, local_widget,
156 __pa(new_irq_info), irq, 154 new_irq_info, vector,
157 cpuid_to_nasid(cpuid), 155 nasid, slice);
158 cpuid_to_slice(cpuid));
159 156
160 /* SAL call failed */ 157 /* SAL call failed */
161 if (status) { 158 if (status) {
162 kfree(new_irq_info); 159 kfree(new_irq_info);
163 break; 160 return NULL;
164 } 161 }
165 162
166 new_irq_info->irq_cpuid = cpuid; 163 cpuphys = nasid_slice_to_cpuid(nasid, slice);
167 register_intr_pda(new_irq_info); 164 new_irq_info->irq_cpuid = cpuphys;
165 register_intr_pda(new_irq_info);
168 166
169 pci_provider = sn_pci_provider[new_irq_info->irq_bridge_type]; 167 pci_provider = sn_pci_provider[new_irq_info->irq_bridge_type];
170 if (pci_provider && pci_provider->target_interrupt)
171 (pci_provider->target_interrupt)(new_irq_info);
172 168
173 spin_lock(&sn_irq_info_lock); 169 /*
174 list_replace_rcu(&sn_irq_info->list, &new_irq_info->list); 170 * If this represents a line interrupt, target it. If it's
175 spin_unlock(&sn_irq_info_lock); 171 * an msi (irq_int_bit < 0), it's already targeted.
176 call_rcu(&sn_irq_info->rcu, sn_irq_info_free); 172 */
173 if (new_irq_info->irq_int_bit >= 0 &&
174 pci_provider && pci_provider->target_interrupt)
175 (pci_provider->target_interrupt)(new_irq_info);
176
177 spin_lock(&sn_irq_info_lock);
178 list_replace_rcu(&sn_irq_info->list, &new_irq_info->list);
179 spin_unlock(&sn_irq_info_lock);
180 call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
177 181
178#ifdef CONFIG_SMP 182#ifdef CONFIG_SMP
179 set_irq_affinity_info((irq & 0xff), cpuphys, 0); 183 set_irq_affinity_info((vector & 0xff), cpuphys, 0);
180#endif 184#endif
181 } 185
186 return new_irq_info;
187}
188
189static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
190{
191 struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;
192 nasid_t nasid;
193 int slice;
194
195 nasid = cpuid_to_nasid(first_cpu(mask));
196 slice = cpuid_to_slice(first_cpu(mask));
197
198 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe,
199 sn_irq_lh[irq], list)
200 (void)sn_retarget_vector(sn_irq_info, nasid, slice);
182} 201}
183 202
184struct hw_interrupt_type irq_type_sn = { 203struct hw_interrupt_type irq_type_sn = {
@@ -202,6 +221,9 @@ void sn_irq_init(void)
202 int i; 221 int i;
203 irq_desc_t *base_desc = irq_desc; 222 irq_desc_t *base_desc = irq_desc;
204 223
224 ia64_first_device_vector = IA64_SN2_FIRST_DEVICE_VECTOR;
225 ia64_last_device_vector = IA64_SN2_LAST_DEVICE_VECTOR;
226
205 for (i = 0; i < NR_IRQS; i++) { 227 for (i = 0; i < NR_IRQS; i++) {
206 if (base_desc[i].handler == &no_irq_type) { 228 if (base_desc[i].handler == &no_irq_type) {
207 base_desc[i].handler = &irq_type_sn; 229 base_desc[i].handler = &irq_type_sn;
@@ -285,6 +307,7 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
285 /* link it into the sn_irq[irq] list */ 307 /* link it into the sn_irq[irq] list */
286 spin_lock(&sn_irq_info_lock); 308 spin_lock(&sn_irq_info_lock);
287 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]); 309 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]);
310 reserve_irq_vector(sn_irq_info->irq_irq);
288 spin_unlock(&sn_irq_info_lock); 311 spin_unlock(&sn_irq_info_lock);
289 312
290 register_intr_pda(sn_irq_info); 313 register_intr_pda(sn_irq_info);
@@ -310,8 +333,11 @@ void sn_irq_unfixup(struct pci_dev *pci_dev)
310 spin_lock(&sn_irq_info_lock); 333 spin_lock(&sn_irq_info_lock);
311 list_del_rcu(&sn_irq_info->list); 334 list_del_rcu(&sn_irq_info->list);
312 spin_unlock(&sn_irq_info_lock); 335 spin_unlock(&sn_irq_info_lock);
336 if (list_empty(sn_irq_lh[sn_irq_info->irq_irq]))
337 free_irq_vector(sn_irq_info->irq_irq);
313 call_rcu(&sn_irq_info->rcu, sn_irq_info_free); 338 call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
314 pci_dev_put(pci_dev); 339 pci_dev_put(pci_dev);
340
315} 341}
316 342
317static inline void 343static inline void
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 30988dfbddff..93577abae36d 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -139,7 +139,7 @@ static int __init pxm_to_nasid(int pxm)
139 int i; 139 int i;
140 int nid; 140 int nid;
141 141
142 nid = pxm_to_nid_map[pxm]; 142 nid = pxm_to_node(pxm);
143 for (i = 0; i < num_node_memblks; i++) { 143 for (i = 0; i < num_node_memblks; i++) {
144 if (node_memblk[i].nid == nid) { 144 if (node_memblk[i].nid == nid) {
145 return NASID_GET(node_memblk[i].start_paddr); 145 return NASID_GET(node_memblk[i].start_paddr);
@@ -704,7 +704,7 @@ void __init build_cnode_tables(void)
704 * cnode == node for all C & M bricks. 704 * cnode == node for all C & M bricks.
705 */ 705 */
706 for_each_online_node(node) { 706 for_each_online_node(node) {
707 nasid = pxm_to_nasid(nid_to_pxm_map[node]); 707 nasid = pxm_to_nasid(node_to_pxm(node));
708 sn_cnodeid_to_nasid[node] = nasid; 708 sn_cnodeid_to_nasid[node] = nasid;
709 physical_node_map[nasid] = node; 709 physical_node_map[nasid] = node;
710 } 710 }
diff --git a/arch/ia64/sn/kernel/sn2/cache.c b/arch/ia64/sn/kernel/sn2/cache.c
index bc3cfa17cd0f..2862cb33026d 100644
--- a/arch/ia64/sn/kernel/sn2/cache.c
+++ b/arch/ia64/sn/kernel/sn2/cache.c
@@ -3,11 +3,12 @@
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) 2001-2003 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2001-2003, 2006 Silicon Graphics, Inc. All rights reserved.
7 * 7 *
8 */ 8 */
9#include <linux/module.h> 9#include <linux/module.h>
10#include <asm/pgalloc.h> 10#include <asm/pgalloc.h>
11#include <asm/sn/arch.h>
11 12
12/** 13/**
13 * sn_flush_all_caches - flush a range of address from all caches (incl. L4) 14 * sn_flush_all_caches - flush a range of address from all caches (incl. L4)
@@ -17,18 +18,24 @@
17 * Flush a range of addresses from all caches including L4. 18 * Flush a range of addresses from all caches including L4.
18 * All addresses fully or partially contained within 19 * All addresses fully or partially contained within
19 * @flush_addr to @flush_addr + @bytes are flushed 20 * @flush_addr to @flush_addr + @bytes are flushed
20 * from the all caches. 21 * from all caches.
21 */ 22 */
22void 23void
23sn_flush_all_caches(long flush_addr, long bytes) 24sn_flush_all_caches(long flush_addr, long bytes)
24{ 25{
25 flush_icache_range(flush_addr, flush_addr+bytes); 26 unsigned long addr = flush_addr;
27
28 /* SHub1 requires a cached address */
29 if (is_shub1() && (addr & RGN_BITS) == RGN_BASE(RGN_UNCACHED))
30 addr = (addr - RGN_BASE(RGN_UNCACHED)) + RGN_BASE(RGN_KERNEL);
31
32 flush_icache_range(addr, addr + bytes);
26 /* 33 /*
27 * The last call may have returned before the caches 34 * The last call may have returned before the caches
28 * were actually flushed, so we call it again to make 35 * were actually flushed, so we call it again to make
29 * sure. 36 * sure.
30 */ 37 */
31 flush_icache_range(flush_addr, flush_addr+bytes); 38 flush_icache_range(addr, addr + bytes);
32 mb(); 39 mb();
33} 40}
34EXPORT_SYMBOL(sn_flush_all_caches); 41EXPORT_SYMBOL(sn_flush_all_caches);
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index b4b84c269210..7a291a271511 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -11,7 +11,7 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <asm/dma.h> 13#include <asm/dma.h>
14#include <asm/sn/pcibr_provider.h> 14#include <asm/sn/intr.h>
15#include <asm/sn/pcibus_provider_defs.h> 15#include <asm/sn/pcibus_provider_defs.h>
16#include <asm/sn/pcidev.h> 16#include <asm/sn/pcidev.h>
17#include <asm/sn/sn_sal.h> 17#include <asm/sn/sn_sal.h>
@@ -113,7 +113,8 @@ void *sn_dma_alloc_coherent(struct device *dev, size_t size,
113 * resources. 113 * resources.
114 */ 114 */
115 115
116 *dma_handle = provider->dma_map_consistent(pdev, phys_addr, size); 116 *dma_handle = provider->dma_map_consistent(pdev, phys_addr, size,
117 SN_DMA_ADDR_PHYS);
117 if (!*dma_handle) { 118 if (!*dma_handle) {
118 printk(KERN_ERR "%s: out of ATEs\n", __FUNCTION__); 119 printk(KERN_ERR "%s: out of ATEs\n", __FUNCTION__);
119 free_pages((unsigned long)cpuaddr, get_order(size)); 120 free_pages((unsigned long)cpuaddr, get_order(size));
@@ -176,7 +177,7 @@ dma_addr_t sn_dma_map_single(struct device *dev, void *cpu_addr, size_t size,
176 BUG_ON(dev->bus != &pci_bus_type); 177 BUG_ON(dev->bus != &pci_bus_type);
177 178
178 phys_addr = __pa(cpu_addr); 179 phys_addr = __pa(cpu_addr);
179 dma_addr = provider->dma_map(pdev, phys_addr, size); 180 dma_addr = provider->dma_map(pdev, phys_addr, size, SN_DMA_ADDR_PHYS);
180 if (!dma_addr) { 181 if (!dma_addr) {
181 printk(KERN_ERR "%s: out of ATEs\n", __FUNCTION__); 182 printk(KERN_ERR "%s: out of ATEs\n", __FUNCTION__);
182 return 0; 183 return 0;
@@ -260,7 +261,8 @@ int sn_dma_map_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
260 for (i = 0; i < nhwentries; i++, sg++) { 261 for (i = 0; i < nhwentries; i++, sg++) {
261 phys_addr = SG_ENT_PHYS_ADDRESS(sg); 262 phys_addr = SG_ENT_PHYS_ADDRESS(sg);
262 sg->dma_address = provider->dma_map(pdev, 263 sg->dma_address = provider->dma_map(pdev,
263 phys_addr, sg->length); 264 phys_addr, sg->length,
265 SN_DMA_ADDR_PHYS);
264 266
265 if (!sg->dma_address) { 267 if (!sg->dma_address) {
266 printk(KERN_ERR "%s: out of ATEs\n", __FUNCTION__); 268 printk(KERN_ERR "%s: out of ATEs\n", __FUNCTION__);
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 9f86bb6519aa..a86c7b945962 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -41,7 +41,7 @@ extern int sn_ioif_inited;
41 41
42static dma_addr_t 42static dma_addr_t
43pcibr_dmamap_ate32(struct pcidev_info *info, 43pcibr_dmamap_ate32(struct pcidev_info *info,
44 u64 paddr, size_t req_size, u64 flags) 44 u64 paddr, size_t req_size, u64 flags, int dma_flags)
45{ 45{
46 46
47 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info; 47 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info;
@@ -81,9 +81,12 @@ pcibr_dmamap_ate32(struct pcidev_info *info,
81 if (IS_PCIX(pcibus_info)) 81 if (IS_PCIX(pcibus_info))
82 ate_flags &= ~(PCI32_ATE_PREF); 82 ate_flags &= ~(PCI32_ATE_PREF);
83 83
84 xio_addr = 84 if (SN_DMA_ADDRTYPE(dma_flags == SN_DMA_ADDR_PHYS))
85 IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) : 85 xio_addr = IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) :
86 PHYS_TO_TIODMA(paddr); 86 PHYS_TO_TIODMA(paddr);
87 else
88 xio_addr = paddr;
89
87 offset = IOPGOFF(xio_addr); 90 offset = IOPGOFF(xio_addr);
88 ate = ate_flags | (xio_addr - offset); 91 ate = ate_flags | (xio_addr - offset);
89 92
@@ -91,6 +94,13 @@ pcibr_dmamap_ate32(struct pcidev_info *info,
91 if (IS_PIC_SOFT(pcibus_info)) { 94 if (IS_PIC_SOFT(pcibus_info)) {
92 ate |= (pcibus_info->pbi_hub_xid << PIC_ATE_TARGETID_SHFT); 95 ate |= (pcibus_info->pbi_hub_xid << PIC_ATE_TARGETID_SHFT);
93 } 96 }
97
98 /*
99 * If we're mapping for MSI, set the MSI bit in the ATE
100 */
101 if (dma_flags & SN_DMA_MSI)
102 ate |= PCI32_ATE_MSI;
103
94 ate_write(pcibus_info, ate_index, ate_count, ate); 104 ate_write(pcibus_info, ate_index, ate_count, ate);
95 105
96 /* 106 /*
@@ -105,20 +115,27 @@ pcibr_dmamap_ate32(struct pcidev_info *info,
105 if (pcibus_info->pbi_devreg[internal_device] & PCIBR_DEV_SWAP_DIR) 115 if (pcibus_info->pbi_devreg[internal_device] & PCIBR_DEV_SWAP_DIR)
106 ATE_SWAP_ON(pci_addr); 116 ATE_SWAP_ON(pci_addr);
107 117
118
108 return pci_addr; 119 return pci_addr;
109} 120}
110 121
111static dma_addr_t 122static dma_addr_t
112pcibr_dmatrans_direct64(struct pcidev_info * info, u64 paddr, 123pcibr_dmatrans_direct64(struct pcidev_info * info, u64 paddr,
113 u64 dma_attributes) 124 u64 dma_attributes, int dma_flags)
114{ 125{
115 struct pcibus_info *pcibus_info = (struct pcibus_info *) 126 struct pcibus_info *pcibus_info = (struct pcibus_info *)
116 ((info->pdi_host_pcidev_info)->pdi_pcibus_info); 127 ((info->pdi_host_pcidev_info)->pdi_pcibus_info);
117 u64 pci_addr; 128 u64 pci_addr;
118 129
119 /* Translate to Crosstalk View of Physical Address */ 130 /* Translate to Crosstalk View of Physical Address */
120 pci_addr = (IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) : 131 if (SN_DMA_ADDRTYPE(dma_flags) == SN_DMA_ADDR_PHYS)
121 PHYS_TO_TIODMA(paddr)) | dma_attributes; 132 pci_addr = IS_PIC_SOFT(pcibus_info) ?
133 PHYS_TO_DMA(paddr) :
134 PHYS_TO_TIODMA(paddr) | dma_attributes;
135 else
136 pci_addr = IS_PIC_SOFT(pcibus_info) ?
137 paddr :
138 paddr | dma_attributes;
122 139
123 /* Handle Bus mode */ 140 /* Handle Bus mode */
124 if (IS_PCIX(pcibus_info)) 141 if (IS_PCIX(pcibus_info))
@@ -130,7 +147,9 @@ pcibr_dmatrans_direct64(struct pcidev_info * info, u64 paddr,
130 ((u64) pcibus_info-> 147 ((u64) pcibus_info->
131 pbi_hub_xid << PIC_PCI64_ATTR_TARG_SHFT); 148 pbi_hub_xid << PIC_PCI64_ATTR_TARG_SHFT);
132 } else 149 } else
133 pci_addr |= TIOCP_PCI64_CMDTYPE_MEM; 150 pci_addr |= (dma_flags & SN_DMA_MSI) ?
151 TIOCP_PCI64_CMDTYPE_MSI :
152 TIOCP_PCI64_CMDTYPE_MEM;
134 153
135 /* If PCI mode, func zero uses VCHAN0, every other func uses VCHAN1 */ 154 /* If PCI mode, func zero uses VCHAN0, every other func uses VCHAN1 */
136 if (!IS_PCIX(pcibus_info) && PCI_FUNC(info->pdi_linux_pcidev->devfn)) 155 if (!IS_PCIX(pcibus_info) && PCI_FUNC(info->pdi_linux_pcidev->devfn))
@@ -141,7 +160,7 @@ pcibr_dmatrans_direct64(struct pcidev_info * info, u64 paddr,
141 160
142static dma_addr_t 161static dma_addr_t
143pcibr_dmatrans_direct32(struct pcidev_info * info, 162pcibr_dmatrans_direct32(struct pcidev_info * info,
144 u64 paddr, size_t req_size, u64 flags) 163 u64 paddr, size_t req_size, u64 flags, int dma_flags)
145{ 164{
146 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info; 165 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info;
147 struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info-> 166 struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info->
@@ -156,8 +175,14 @@ pcibr_dmatrans_direct32(struct pcidev_info * info,
156 return 0; 175 return 0;
157 } 176 }
158 177
159 xio_addr = IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) : 178 if (dma_flags & SN_DMA_MSI)
160 PHYS_TO_TIODMA(paddr); 179 return 0;
180
181 if (SN_DMA_ADDRTYPE(dma_flags) == SN_DMA_ADDR_PHYS)
182 xio_addr = IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) :
183 PHYS_TO_TIODMA(paddr);
184 else
185 xio_addr = paddr;
161 186
162 xio_base = pcibus_info->pbi_dir_xbase; 187 xio_base = pcibus_info->pbi_dir_xbase;
163 offset = xio_addr - xio_base; 188 offset = xio_addr - xio_base;
@@ -327,7 +352,7 @@ void sn_dma_flush(u64 addr)
327 */ 352 */
328 353
329dma_addr_t 354dma_addr_t
330pcibr_dma_map(struct pci_dev * hwdev, unsigned long phys_addr, size_t size) 355pcibr_dma_map(struct pci_dev * hwdev, unsigned long phys_addr, size_t size, int dma_flags)
331{ 356{
332 dma_addr_t dma_handle; 357 dma_addr_t dma_handle;
333 struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(hwdev); 358 struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(hwdev);
@@ -344,11 +369,11 @@ pcibr_dma_map(struct pci_dev * hwdev, unsigned long phys_addr, size_t size)
344 */ 369 */
345 370
346 dma_handle = pcibr_dmatrans_direct64(pcidev_info, phys_addr, 371 dma_handle = pcibr_dmatrans_direct64(pcidev_info, phys_addr,
347 PCI64_ATTR_PREF); 372 PCI64_ATTR_PREF, dma_flags);
348 } else { 373 } else {
349 /* Handle 32-63 bit cards via direct mapping */ 374 /* Handle 32-63 bit cards via direct mapping */
350 dma_handle = pcibr_dmatrans_direct32(pcidev_info, phys_addr, 375 dma_handle = pcibr_dmatrans_direct32(pcidev_info, phys_addr,
351 size, 0); 376 size, 0, dma_flags);
352 if (!dma_handle) { 377 if (!dma_handle) {
353 /* 378 /*
354 * It is a 32 bit card and we cannot do direct mapping, 379 * It is a 32 bit card and we cannot do direct mapping,
@@ -356,7 +381,8 @@ pcibr_dma_map(struct pci_dev * hwdev, unsigned long phys_addr, size_t size)
356 */ 381 */
357 382
358 dma_handle = pcibr_dmamap_ate32(pcidev_info, phys_addr, 383 dma_handle = pcibr_dmamap_ate32(pcidev_info, phys_addr,
359 size, PCI32_ATE_PREF); 384 size, PCI32_ATE_PREF,
385 dma_flags);
360 } 386 }
361 } 387 }
362 388
@@ -365,18 +391,18 @@ pcibr_dma_map(struct pci_dev * hwdev, unsigned long phys_addr, size_t size)
365 391
366dma_addr_t 392dma_addr_t
367pcibr_dma_map_consistent(struct pci_dev * hwdev, unsigned long phys_addr, 393pcibr_dma_map_consistent(struct pci_dev * hwdev, unsigned long phys_addr,
368 size_t size) 394 size_t size, int dma_flags)
369{ 395{
370 dma_addr_t dma_handle; 396 dma_addr_t dma_handle;
371 struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(hwdev); 397 struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(hwdev);
372 398
373 if (hwdev->dev.coherent_dma_mask == ~0UL) { 399 if (hwdev->dev.coherent_dma_mask == ~0UL) {
374 dma_handle = pcibr_dmatrans_direct64(pcidev_info, phys_addr, 400 dma_handle = pcibr_dmatrans_direct64(pcidev_info, phys_addr,
375 PCI64_ATTR_BAR); 401 PCI64_ATTR_BAR, dma_flags);
376 } else { 402 } else {
377 dma_handle = (dma_addr_t) pcibr_dmamap_ate32(pcidev_info, 403 dma_handle = (dma_addr_t) pcibr_dmamap_ate32(pcidev_info,
378 phys_addr, size, 404 phys_addr, size,
379 PCI32_ATE_BAR); 405 PCI32_ATE_BAR, dma_flags);
380 } 406 }
381 407
382 return dma_handle; 408 return dma_handle;
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index be0176912968..20de72791b97 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -515,11 +515,17 @@ tioca_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
515 * use the GART mapped mode. 515 * use the GART mapped mode.
516 */ 516 */
517static u64 517static u64
518tioca_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count) 518tioca_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
519{ 519{
520 u64 mapaddr; 520 u64 mapaddr;
521 521
522 /* 522 /*
523 * Not supported for now ...
524 */
525 if (dma_flags & SN_DMA_MSI)
526 return 0;
527
528 /*
523 * If card is 64 or 48 bit addresable, use a direct mapping. 32 529 * If card is 64 or 48 bit addresable, use a direct mapping. 32
524 * bit direct is so restrictive w.r.t. where the memory resides that 530 * bit direct is so restrictive w.r.t. where the memory resides that
525 * we don't use it even though CA has some support. 531 * we don't use it even though CA has some support.
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index 85f3b3d4c606..2d7948567ebc 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -170,7 +170,8 @@ tioce_mmr_war_post(struct tioce_kernel *kern, void *mmr_addr)
170 (ATE_PAGE((start)+(len)-1, pagesize) - ATE_PAGE(start, pagesize) + 1) 170 (ATE_PAGE((start)+(len)-1, pagesize) - ATE_PAGE(start, pagesize) + 1)
171 171
172#define ATE_VALID(ate) ((ate) & (1UL << 63)) 172#define ATE_VALID(ate) ((ate) & (1UL << 63))
173#define ATE_MAKE(addr, ps) (((addr) & ~ATE_PAGEMASK(ps)) | (1UL << 63)) 173#define ATE_MAKE(addr, ps, msi) \
174 (((addr) & ~ATE_PAGEMASK(ps)) | (1UL << 63) | ((msi)?(1UL << 62):0))
174 175
175/* 176/*
176 * Flavors of ate-based mapping supported by tioce_alloc_map() 177 * Flavors of ate-based mapping supported by tioce_alloc_map()
@@ -196,15 +197,17 @@ tioce_mmr_war_post(struct tioce_kernel *kern, void *mmr_addr)
196 * 197 *
197 * 63 - must be 1 to indicate d64 mode to CE hardware 198 * 63 - must be 1 to indicate d64 mode to CE hardware
198 * 62 - barrier bit ... controlled with tioce_dma_barrier() 199 * 62 - barrier bit ... controlled with tioce_dma_barrier()
199 * 61 - 0 since this is not an MSI transaction 200 * 61 - msi bit ... specified through dma_flags
200 * 60:54 - reserved, MBZ 201 * 60:54 - reserved, MBZ
201 */ 202 */
202static u64 203static u64
203tioce_dma_d64(unsigned long ct_addr) 204tioce_dma_d64(unsigned long ct_addr, int dma_flags)
204{ 205{
205 u64 bus_addr; 206 u64 bus_addr;
206 207
207 bus_addr = ct_addr | (1UL << 63); 208 bus_addr = ct_addr | (1UL << 63);
209 if (dma_flags & SN_DMA_MSI)
210 bus_addr |= (1UL << 61);
208 211
209 return bus_addr; 212 return bus_addr;
210} 213}
@@ -261,7 +264,7 @@ pcidev_to_tioce(struct pci_dev *pdev, struct tioce **base,
261 */ 264 */
262static u64 265static u64
263tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port, 266tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
264 u64 ct_addr, int len) 267 u64 ct_addr, int len, int dma_flags)
265{ 268{
266 int i; 269 int i;
267 int j; 270 int j;
@@ -270,6 +273,7 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
270 int entries; 273 int entries;
271 int nates; 274 int nates;
272 u64 pagesize; 275 u64 pagesize;
276 int msi_capable, msi_wanted;
273 u64 *ate_shadow; 277 u64 *ate_shadow;
274 u64 *ate_reg; 278 u64 *ate_reg;
275 u64 addr; 279 u64 addr;
@@ -291,6 +295,7 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
291 ate_reg = ce_mmr->ce_ure_ate3240; 295 ate_reg = ce_mmr->ce_ure_ate3240;
292 pagesize = ce_kern->ce_ate3240_pagesize; 296 pagesize = ce_kern->ce_ate3240_pagesize;
293 bus_base = TIOCE_M32_MIN; 297 bus_base = TIOCE_M32_MIN;
298 msi_capable = 1;
294 break; 299 break;
295 case TIOCE_ATE_M40: 300 case TIOCE_ATE_M40:
296 first = 0; 301 first = 0;
@@ -299,6 +304,7 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
299 ate_reg = ce_mmr->ce_ure_ate40; 304 ate_reg = ce_mmr->ce_ure_ate40;
300 pagesize = MB(64); 305 pagesize = MB(64);
301 bus_base = TIOCE_M40_MIN; 306 bus_base = TIOCE_M40_MIN;
307 msi_capable = 0;
302 break; 308 break;
303 case TIOCE_ATE_M40S: 309 case TIOCE_ATE_M40S:
304 /* 310 /*
@@ -311,11 +317,16 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
311 ate_reg = ce_mmr->ce_ure_ate3240; 317 ate_reg = ce_mmr->ce_ure_ate3240;
312 pagesize = GB(16); 318 pagesize = GB(16);
313 bus_base = TIOCE_M40S_MIN; 319 bus_base = TIOCE_M40S_MIN;
320 msi_capable = 0;
314 break; 321 break;
315 default: 322 default:
316 return 0; 323 return 0;
317 } 324 }
318 325
326 msi_wanted = dma_flags & SN_DMA_MSI;
327 if (msi_wanted && !msi_capable)
328 return 0;
329
319 nates = ATE_NPAGES(ct_addr, len, pagesize); 330 nates = ATE_NPAGES(ct_addr, len, pagesize);
320 if (nates > entries) 331 if (nates > entries)
321 return 0; 332 return 0;
@@ -344,7 +355,7 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
344 for (j = 0; j < nates; j++) { 355 for (j = 0; j < nates; j++) {
345 u64 ate; 356 u64 ate;
346 357
347 ate = ATE_MAKE(addr, pagesize); 358 ate = ATE_MAKE(addr, pagesize, msi_wanted);
348 ate_shadow[i + j] = ate; 359 ate_shadow[i + j] = ate;
349 tioce_mmr_storei(ce_kern, &ate_reg[i + j], ate); 360 tioce_mmr_storei(ce_kern, &ate_reg[i + j], ate);
350 addr += pagesize; 361 addr += pagesize;
@@ -371,7 +382,7 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
371 * Map @paddr into 32-bit bus space of the CE associated with @pcidev_info. 382 * Map @paddr into 32-bit bus space of the CE associated with @pcidev_info.
372 */ 383 */
373static u64 384static u64
374tioce_dma_d32(struct pci_dev *pdev, u64 ct_addr) 385tioce_dma_d32(struct pci_dev *pdev, u64 ct_addr, int dma_flags)
375{ 386{
376 int dma_ok; 387 int dma_ok;
377 int port; 388 int port;
@@ -381,6 +392,9 @@ tioce_dma_d32(struct pci_dev *pdev, u64 ct_addr)
381 u64 ct_lower; 392 u64 ct_lower;
382 dma_addr_t bus_addr; 393 dma_addr_t bus_addr;
383 394
395 if (dma_flags & SN_DMA_MSI)
396 return 0;
397
384 ct_upper = ct_addr & ~0x3fffffffUL; 398 ct_upper = ct_addr & ~0x3fffffffUL;
385 ct_lower = ct_addr & 0x3fffffffUL; 399 ct_lower = ct_addr & 0x3fffffffUL;
386 400
@@ -507,7 +521,7 @@ tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
507 */ 521 */
508static u64 522static u64
509tioce_do_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count, 523tioce_do_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count,
510 int barrier) 524 int barrier, int dma_flags)
511{ 525{
512 unsigned long flags; 526 unsigned long flags;
513 u64 ct_addr; 527 u64 ct_addr;
@@ -523,15 +537,18 @@ tioce_do_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count,
523 if (dma_mask < 0x7fffffffUL) 537 if (dma_mask < 0x7fffffffUL)
524 return 0; 538 return 0;
525 539
526 ct_addr = PHYS_TO_TIODMA(paddr); 540 if (SN_DMA_ADDRTYPE(dma_flags) == SN_DMA_ADDR_PHYS)
541 ct_addr = PHYS_TO_TIODMA(paddr);
542 else
543 ct_addr = paddr;
527 544
528 /* 545 /*
529 * If the device can generate 64 bit addresses, create a D64 map. 546 * If the device can generate 64 bit addresses, create a D64 map.
530 * Since this should never fail, bypass the rest of the checks.
531 */ 547 */
532 if (dma_mask == ~0UL) { 548 if (dma_mask == ~0UL) {
533 mapaddr = tioce_dma_d64(ct_addr); 549 mapaddr = tioce_dma_d64(ct_addr, dma_flags);
534 goto dma_map_done; 550 if (mapaddr)
551 goto dma_map_done;
535 } 552 }
536 553
537 pcidev_to_tioce(pdev, NULL, &ce_kern, &port); 554 pcidev_to_tioce(pdev, NULL, &ce_kern, &port);
@@ -574,18 +591,22 @@ tioce_do_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count,
574 591
575 if (byte_count > MB(64)) { 592 if (byte_count > MB(64)) {
576 mapaddr = tioce_alloc_map(ce_kern, TIOCE_ATE_M40S, 593 mapaddr = tioce_alloc_map(ce_kern, TIOCE_ATE_M40S,
577 port, ct_addr, byte_count); 594 port, ct_addr, byte_count,
595 dma_flags);
578 if (!mapaddr) 596 if (!mapaddr)
579 mapaddr = 597 mapaddr =
580 tioce_alloc_map(ce_kern, TIOCE_ATE_M40, -1, 598 tioce_alloc_map(ce_kern, TIOCE_ATE_M40, -1,
581 ct_addr, byte_count); 599 ct_addr, byte_count,
600 dma_flags);
582 } else { 601 } else {
583 mapaddr = tioce_alloc_map(ce_kern, TIOCE_ATE_M40, -1, 602 mapaddr = tioce_alloc_map(ce_kern, TIOCE_ATE_M40, -1,
584 ct_addr, byte_count); 603 ct_addr, byte_count,
604 dma_flags);
585 if (!mapaddr) 605 if (!mapaddr)
586 mapaddr = 606 mapaddr =
587 tioce_alloc_map(ce_kern, TIOCE_ATE_M40S, 607 tioce_alloc_map(ce_kern, TIOCE_ATE_M40S,
588 port, ct_addr, byte_count); 608 port, ct_addr, byte_count,
609 dma_flags);
589 } 610 }
590 } 611 }
591 612
@@ -593,7 +614,7 @@ tioce_do_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count,
593 * 32-bit direct is the next mode to try 614 * 32-bit direct is the next mode to try
594 */ 615 */
595 if (!mapaddr && dma_mask >= 0xffffffffUL) 616 if (!mapaddr && dma_mask >= 0xffffffffUL)
596 mapaddr = tioce_dma_d32(pdev, ct_addr); 617 mapaddr = tioce_dma_d32(pdev, ct_addr, dma_flags);
597 618
598 /* 619 /*
599 * Last resort, try 32-bit ATE-based map. 620 * Last resort, try 32-bit ATE-based map.
@@ -601,7 +622,7 @@ tioce_do_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count,
601 if (!mapaddr) 622 if (!mapaddr)
602 mapaddr = 623 mapaddr =
603 tioce_alloc_map(ce_kern, TIOCE_ATE_M32, -1, ct_addr, 624 tioce_alloc_map(ce_kern, TIOCE_ATE_M32, -1, ct_addr,
604 byte_count); 625 byte_count, dma_flags);
605 626
606 spin_unlock_irqrestore(&ce_kern->ce_lock, flags); 627 spin_unlock_irqrestore(&ce_kern->ce_lock, flags);
607 628
@@ -622,9 +643,9 @@ dma_map_done:
622 * in the address. 643 * in the address.
623 */ 644 */
624static u64 645static u64
625tioce_dma(struct pci_dev *pdev, u64 paddr, size_t byte_count) 646tioce_dma(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
626{ 647{
627 return tioce_do_dma_map(pdev, paddr, byte_count, 0); 648 return tioce_do_dma_map(pdev, paddr, byte_count, 0, dma_flags);
628} 649}
629 650
630/** 651/**
@@ -636,9 +657,9 @@ tioce_dma(struct pci_dev *pdev, u64 paddr, size_t byte_count)
636 * Simply call tioce_do_dma_map() to create a map with the barrier bit set 657 * Simply call tioce_do_dma_map() to create a map with the barrier bit set
637 * in the address. 658 * in the address.
638 */ static u64 659 */ static u64
639tioce_dma_consistent(struct pci_dev *pdev, u64 paddr, size_t byte_count) 660tioce_dma_consistent(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
640{ 661{
641 return tioce_do_dma_map(pdev, paddr, byte_count, 1); 662 return tioce_do_dma_map(pdev, paddr, byte_count, 1, dma_flags);
642} 663}
643 664
644/** 665/**
@@ -696,7 +717,7 @@ tioce_reserve_m32(struct tioce_kernel *ce_kern, u64 base, u64 limit)
696 while (ate_index <= last_ate) { 717 while (ate_index <= last_ate) {
697 u64 ate; 718 u64 ate;
698 719
699 ate = ATE_MAKE(0xdeadbeef, ps); 720 ate = ATE_MAKE(0xdeadbeef, ps, 0);
700 ce_kern->ce_ate3240_shadow[ate_index] = ate; 721 ce_kern->ce_ate3240_shadow[ate_index] = ate;
701 tioce_mmr_storei(ce_kern, &ce_mmr->ce_ure_ate3240[ate_index], 722 tioce_mmr_storei(ce_kern, &ce_mmr->ce_ure_ate3240[ate_index],
702 ate); 723 ate);
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 320fde05dc63..522079f8c2ba 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -226,7 +226,7 @@ ENTRY(nmi_handler)
226inthandler: 226inthandler:
227 SAVE_ALL_INT 227 SAVE_ALL_INT
228 GET_CURRENT(%d0) 228 GET_CURRENT(%d0)
229 addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+2) 229 addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
230 | put exception # in d0 230 | put exception # in d0
231 bfextu %sp@(PT_VECTOR){#4,#10},%d0 231 bfextu %sp@(PT_VECTOR){#4,#10},%d0
232 232
@@ -245,7 +245,7 @@ inthandler:
2453: addql #8,%sp | pop parameters off stack 2453: addql #8,%sp | pop parameters off stack
246 246
247ret_from_interrupt: 247ret_from_interrupt:
248 subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+2) 248 subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
249 jeq 1f 249 jeq 1f
2502: 2502:
251 RESTORE_ALL 251 RESTORE_ALL
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index 514d323ad536..4b85514792e7 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -95,6 +95,12 @@ void __init init_IRQ(void)
95{ 95{
96 int i; 96 int i;
97 97
98 /* assembly irq entry code relies on this... */
99 if (HARDIRQ_MASK != 0x00ff0000) {
100 extern void hardirq_mask_is_broken(void);
101 hardirq_mask_is_broken();
102 }
103
98 for (i = 0; i < SYS_IRQS; i++) { 104 for (i = 0; i < SYS_IRQS; i++) {
99 if (mach_default_handler) 105 if (mach_default_handler)
100 irq_list[i].handler = (*mach_default_handler)[i]; 106 irq_list[i].handler = (*mach_default_handler)[i];
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 866917bfa028..f9af893cd289 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -763,7 +763,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
763 763
764 /* This is the X/Open sanctioned signal stack switching. */ 764 /* This is the X/Open sanctioned signal stack switching. */
765 if (ka->sa.sa_flags & SA_ONSTACK) { 765 if (ka->sa.sa_flags & SA_ONSTACK) {
766 if (!on_sig_stack(usp)) 766 if (!sas_ss_flags(usp))
767 usp = current->sas_ss_sp + current->sas_ss_size; 767 usp = current->sas_ss_sp + current->sas_ss_size;
768 } 768 }
769 return (void __user *)((usp - frame_size) & -8UL); 769 return (void __user *)((usp - frame_size) & -8UL);
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index cdf58fbb3e73..837a88709902 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -114,7 +114,7 @@ void __init base_trap_init(void)
114 if(MACH_IS_SUN3X) { 114 if(MACH_IS_SUN3X) {
115 extern e_vector *sun3x_prom_vbr; 115 extern e_vector *sun3x_prom_vbr;
116 116
117 __asm__ volatile ("movec %%vbr, %0" : "=r" ((void*)sun3x_prom_vbr)); 117 __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr));
118 } 118 }
119 119
120 /* setup the exception vector table */ 120 /* setup the exception vector table */
@@ -992,6 +992,7 @@ void show_registers(struct pt_regs *regs)
992 992
993void show_stack(struct task_struct *task, unsigned long *stack) 993void show_stack(struct task_struct *task, unsigned long *stack)
994{ 994{
995 unsigned long *p;
995 unsigned long *endstack; 996 unsigned long *endstack;
996 int i; 997 int i;
997 998
@@ -1004,12 +1005,13 @@ void show_stack(struct task_struct *task, unsigned long *stack)
1004 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE); 1005 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
1005 1006
1006 printk("Stack from %08lx:", (unsigned long)stack); 1007 printk("Stack from %08lx:", (unsigned long)stack);
1008 p = stack;
1007 for (i = 0; i < kstack_depth_to_print; i++) { 1009 for (i = 0; i < kstack_depth_to_print; i++) {
1008 if (stack + 1 > endstack) 1010 if (p + 1 > endstack)
1009 break; 1011 break;
1010 if (i % 8 == 0) 1012 if (i % 8 == 0)
1011 printk("\n "); 1013 printk("\n ");
1012 printk(" %08lx", *stack++); 1014 printk(" %08lx", *p++);
1013 } 1015 }
1014 printk("\n"); 1016 printk("\n");
1015 show_trace(stack); 1017 show_trace(stack);
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index ebe51a513817..6bbf19f96007 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -4,5 +4,5 @@
4 4
5EXTRA_AFLAGS := -traditional 5EXTRA_AFLAGS := -traditional
6 6
7lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 7lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
8 checksum.o string.o semaphore.o 8 checksum.o string.o semaphore.o uaccess.o
diff --git a/arch/m68k/lib/uaccess.c b/arch/m68k/lib/uaccess.c
new file mode 100644
index 000000000000..1bc188c0d983
--- /dev/null
+++ b/arch/m68k/lib/uaccess.c
@@ -0,0 +1,222 @@
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
7#include <linux/module.h>
8#include <asm/uaccess.h>
9
10unsigned long __generic_copy_from_user(void *to, const void __user *from,
11 unsigned long n)
12{
13 unsigned long tmp, res;
14
15 asm volatile ("\n"
16 " tst.l %0\n"
17 " jeq 2f\n"
18 "1: moves.l (%1)+,%3\n"
19 " move.l %3,(%2)+\n"
20 " subq.l #1,%0\n"
21 " jne 1b\n"
22 "2: btst #1,%5\n"
23 " jeq 4f\n"
24 "3: moves.w (%1)+,%3\n"
25 " move.w %3,(%2)+\n"
26 "4: btst #0,%5\n"
27 " jeq 6f\n"
28 "5: moves.b (%1)+,%3\n"
29 " move.b %3,(%2)+\n"
30 "6:\n"
31 " .section .fixup,\"ax\"\n"
32 " .even\n"
33 "10: move.l %0,%3\n"
34 "7: clr.l (%2)+\n"
35 " subq.l #1,%3\n"
36 " jne 7b\n"
37 " lsl.l #2,%0\n"
38 " btst #1,%5\n"
39 " jeq 8f\n"
40 "30: clr.w (%2)+\n"
41 " addq.l #2,%0\n"
42 "8: btst #0,%5\n"
43 " jeq 6b\n"
44 "50: clr.b (%2)+\n"
45 " addq.l #1,%0\n"
46 " jra 6b\n"
47 " .previous\n"
48 "\n"
49 " .section __ex_table,\"a\"\n"
50 " .align 4\n"
51 " .long 1b,10b\n"
52 " .long 3b,30b\n"
53 " .long 5b,50b\n"
54 " .previous"
55 : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp)
56 : "0" (n / 4), "d" (n & 3));
57
58 return res;
59}
60EXPORT_SYMBOL(__generic_copy_from_user);
61
62unsigned long __generic_copy_to_user(void __user *to, const void *from,
63 unsigned long n)
64{
65 unsigned long tmp, res;
66
67 asm volatile ("\n"
68 " tst.l %0\n"
69 " jeq 4f\n"
70 "1: move.l (%1)+,%3\n"
71 "2: moves.l %3,(%2)+\n"
72 "3: subq.l #1,%0\n"
73 " jne 1b\n"
74 "4: btst #1,%5\n"
75 " jeq 6f\n"
76 " move.w (%1)+,%3\n"
77 "5: moves.w %3,(%2)+\n"
78 "6: btst #0,%5\n"
79 " jeq 8f\n"
80 " move.b (%1)+,%3\n"
81 "7: moves.b %3,(%2)+\n"
82 "8:\n"
83 " .section .fixup,\"ax\"\n"
84 " .even\n"
85 "20: lsl.l #2,%0\n"
86 "50: add.l %5,%0\n"
87 " jra 7b\n"
88 " .previous\n"
89 "\n"
90 " .section __ex_table,\"a\"\n"
91 " .align 4\n"
92 " .long 2b,20b\n"
93 " .long 3b,20b\n"
94 " .long 5b,50b\n"
95 " .long 6b,50b\n"
96 " .long 7b,50b\n"
97 " .long 8b,50b\n"
98 " .previous"
99 : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp)
100 : "0" (n / 4), "d" (n & 3));
101
102 return res;
103}
104EXPORT_SYMBOL(__generic_copy_to_user);
105
106/*
107 * Copy a null terminated string from userspace.
108 */
109long strncpy_from_user(char *dst, const char __user *src, long count)
110{
111 long res;
112 char c;
113
114 if (count <= 0)
115 return count;
116
117 asm volatile ("\n"
118 "1: moves.b (%2)+,%4\n"
119 " move.b %4,(%1)+\n"
120 " jeq 2f\n"
121 " subq.l #1,%3\n"
122 " jne 1b\n"
123 "2: sub.l %3,%0\n"
124 "3:\n"
125 " .section .fixup,\"ax\"\n"
126 " .even\n"
127 "10: move.l %5,%0\n"
128 " jra 3b\n"
129 " .previous\n"
130 "\n"
131 " .section __ex_table,\"a\"\n"
132 " .align 4\n"
133 " .long 1b,10b\n"
134 " .previous"
135 : "=d" (res), "+a" (dst), "+a" (src), "+r" (count), "=&d" (c)
136 : "i" (-EFAULT), "0" (count));
137
138 return res;
139}
140EXPORT_SYMBOL(strncpy_from_user);
141
142/*
143 * Return the size of a string (including the ending 0)
144 *
145 * Return 0 on exception, a value greater than N if too long
146 */
147long strnlen_user(const char __user *src, long n)
148{
149 char c;
150 long res;
151
152 asm volatile ("\n"
153 "1: subq.l #1,%1\n"
154 " jmi 3f\n"
155 "2: moves.b (%0)+,%2\n"
156 " tst.b %2\n"
157 " jne 1b\n"
158 " jra 4f\n"
159 "\n"
160 "3: addq.l #1,%0\n"
161 "4: sub.l %4,%0\n"
162 "5:\n"
163 " .section .fixup,\"ax\"\n"
164 " .even\n"
165 "20: sub.l %0,%0\n"
166 " jra 5b\n"
167 " .previous\n"
168 "\n"
169 " .section __ex_table,\"a\"\n"
170 " .align 4\n"
171 " .long 2b,20b\n"
172 " .previous\n"
173 : "=&a" (res), "+d" (n), "=&d" (c)
174 : "0" (src), "r" (src));
175
176 return res;
177}
178EXPORT_SYMBOL(strnlen_user);
179
180/*
181 * Zero Userspace
182 */
183
184unsigned long clear_user(void __user *to, unsigned long n)
185{
186 unsigned long res;
187
188 asm volatile ("\n"
189 " tst.l %0\n"
190 " jeq 3f\n"
191 "1: moves.l %2,(%1)+\n"
192 "2: subq.l #1,%0\n"
193 " jne 1b\n"
194 "3: btst #1,%4\n"
195 " jeq 5f\n"
196 "4: moves.w %2,(%1)+\n"
197 "5: btst #0,%4\n"
198 " jeq 7f\n"
199 "6: moves.b %2,(%1)\n"
200 "7:\n"
201 " .section .fixup,\"ax\"\n"
202 " .even\n"
203 "10: lsl.l #2,%0\n"
204 "40: add.l %4,%0\n"
205 " jra 7b\n"
206 " .previous\n"
207 "\n"
208 " .section __ex_table,\"a\"\n"
209 " .align 4\n"
210 " .long 1b,10b\n"
211 " .long 2b,10b\n"
212 " .long 4b,40b\n"
213 " .long 5b,40b\n"
214 " .long 6b,40b\n"
215 " .long 7b,40b\n"
216 " .previous"
217 : "=d" (res), "+a" (to)
218 : "r" (0), "0" (n / 4), "d" (n & 3));
219
220 return res;
221}
222EXPORT_SYMBOL(clear_user);
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 14f8d3f4e195..19dce75711b1 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -89,24 +89,11 @@ extern void mac_debugging_long(int, long);
89 89
90static void mac_get_model(char *str); 90static void mac_get_model(char *str);
91 91
92void mac_bang(int irq, void *vector, struct pt_regs *p)
93{
94 printk(KERN_INFO "Resetting ...\n");
95 mac_reset();
96}
97
98static void mac_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs *)) 92static void mac_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs *))
99{ 93{
100 via_init_clock(vector); 94 via_init_clock(vector);
101} 95}
102 96
103#if 0
104void mac_waitbut (void)
105{
106 ;
107}
108#endif
109
110extern irqreturn_t mac_default_handler(int, void *, struct pt_regs *); 97extern irqreturn_t mac_default_handler(int, void *, struct pt_regs *);
111 98
112irqreturn_t (*mac_handlers[8])(int, void *, struct pt_regs *)= 99irqreturn_t (*mac_handlers[8])(int, void *, struct pt_regs *)=
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index 1809601ad903..7a1600bd195d 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -216,7 +216,6 @@ static void scc_irq_disable(int);
216 * console_loglevel determines NMI handler function 216 * console_loglevel determines NMI handler function
217 */ 217 */
218 218
219extern irqreturn_t mac_bang(int, void *, struct pt_regs *);
220irqreturn_t mac_nmi_handler(int, void *, struct pt_regs *); 219irqreturn_t mac_nmi_handler(int, void *, struct pt_regs *);
221irqreturn_t mac_debug_handler(int, void *, struct pt_regs *); 220irqreturn_t mac_debug_handler(int, void *, struct pt_regs *);
222 221
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index cd528bf7b43f..a6e3814c8666 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -25,7 +25,6 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/ide.h> 26#include <linux/ide.h>
27 27
28#include <asm/traps.h>
29#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
30#include <asm/macintosh.h> 29#include <asm/macintosh.h>
31#include <asm/macints.h> 30#include <asm/macints.h>
@@ -71,7 +70,6 @@ void via_irq_enable(int irq);
71void via_irq_disable(int irq); 70void via_irq_disable(int irq);
72void via_irq_clear(int irq); 71void via_irq_clear(int irq);
73 72
74extern irqreturn_t mac_bang(int, void *, struct pt_regs *);
75extern irqreturn_t mac_scc_dispatch(int, void *, struct pt_regs *); 73extern irqreturn_t mac_scc_dispatch(int, void *, struct pt_regs *);
76extern int oss_present; 74extern int oss_present;
77 75
@@ -212,11 +210,6 @@ void __init via_init(void)
212 break; 210 break;
213 } 211 }
214#else 212#else
215 /* The alernate IRQ mapping seems to just not work. Anyone with a */
216 /* supported machine is welcome to take a stab at fixing it. It */
217 /* _should_ work on the following Quadras: 610,650,700,800,900,950 */
218 /* - 1999-06-12 (jmt) */
219
220 via_alt_mapping = 0; 213 via_alt_mapping = 0;
221#endif 214#endif
222 215
@@ -270,12 +263,6 @@ void __init via_register_interrupts(void)
270 cpu_request_irq(IRQ_AUTO_1, via1_irq, 263 cpu_request_irq(IRQ_AUTO_1, via1_irq,
271 IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1", 264 IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1",
272 (void *) via1); 265 (void *) via1);
273#if 0 /* interferes with serial on some machines */
274 if (!psc_present) {
275 cpu_request_irq(IRQ_AUTO_6, mac_bang, IRQ_FLG_LOCK,
276 "Off Switch", mac_bang);
277 }
278#endif
279 } 266 }
280 cpu_request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, 267 cpu_request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
281 "via2", (void *) via2); 268 "via2", (void *) via2);
@@ -471,8 +458,8 @@ irqreturn_t via2_irq(int irq, void *dev_id, struct pt_regs *regs)
471 for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) 458 for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1)
472 if (events & irq_bit) { 459 if (events & irq_bit) {
473 via2[gIER] = irq_bit; 460 via2[gIER] = irq_bit;
474 mac_do_irq_list(VIA2_SOURCE_BASE + i, regs);
475 via2[gIFR] = irq_bit | rbv_clear; 461 via2[gIFR] = irq_bit | rbv_clear;
462 mac_do_irq_list(VIA2_SOURCE_BASE + i, regs);
476 via2[gIER] = irq_bit | 0x80; 463 via2[gIER] = irq_bit | 0x80;
477 } 464 }
478 return IRQ_HANDLED; 465 return IRQ_HANDLED;
@@ -529,6 +516,7 @@ void via_irq_enable(int irq) {
529 } 516 }
530 via2[gIER] = irq_bit | 0x80; 517 via2[gIER] = irq_bit | 0x80;
531 } else if (irq_src == 7) { 518 } else if (irq_src == 7) {
519 nubus_active |= irq_bit;
532 if (rbv_present) { 520 if (rbv_present) {
533 /* enable the slot interrupt. SIER works like IER. */ 521 /* enable the slot interrupt. SIER works like IER. */
534 via2[rSIER] = IER_SET_BIT(irq_idx); 522 via2[rSIER] = IER_SET_BIT(irq_idx);
@@ -550,7 +538,6 @@ void via_irq_enable(int irq) {
550 } 538 }
551 } 539 }
552 } 540 }
553 nubus_active |= irq_bit;
554 } 541 }
555} 542}
556 543
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index afb57eeafdcb..bdb11103694b 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -203,7 +203,7 @@ void __init paging_init(void)
203{ 203{
204 int chunk; 204 int chunk;
205 unsigned long mem_avail = 0; 205 unsigned long mem_avail = 0;
206 unsigned long zones_size[3] = { 0, }; 206 unsigned long zones_size[MAX_NR_ZONES] = { 0, };
207 207
208#ifdef DEBUG 208#ifdef DEBUG
209 { 209 {
@@ -257,12 +257,12 @@ void __init paging_init(void)
257#ifdef DEBUG 257#ifdef DEBUG
258 printk ("before free_area_init\n"); 258 printk ("before free_area_init\n");
259#endif 259#endif
260 zones_size[0] = (mach_max_dma_address < (unsigned long)high_memory ? 260 zones_size[ZONE_DMA] = (mach_max_dma_address < (unsigned long)high_memory ?
261 (mach_max_dma_address+1) : (unsigned long)high_memory); 261 (mach_max_dma_address+1) : (unsigned long)high_memory);
262 zones_size[1] = (unsigned long)high_memory - zones_size[0]; 262 zones_size[ZONE_NORMAL] = (unsigned long)high_memory - zones_size[0];
263 263
264 zones_size[0] = (zones_size[0] - PAGE_OFFSET) >> PAGE_SHIFT; 264 zones_size[ZONE_DMA] = (zones_size[ZONE_DMA] - PAGE_OFFSET) >> PAGE_SHIFT;
265 zones_size[1] >>= PAGE_SHIFT; 265 zones_size[ZONE_NORMAL] >>= PAGE_SHIFT;
266 266
267 free_area_init(zones_size); 267 free_area_init(zones_size);
268} 268}
diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
index a47be196a47c..ac6640ade0b1 100644
--- a/arch/m68k/mm/sun3mmu.c
+++ b/arch/m68k/mm/sun3mmu.c
@@ -46,7 +46,7 @@ void __init paging_init(void)
46 unsigned long address; 46 unsigned long address;
47 unsigned long next_pgtable; 47 unsigned long next_pgtable;
48 unsigned long bootmem_end; 48 unsigned long bootmem_end;
49 unsigned long zones_size[3] = {0, 0, 0}; 49 unsigned long zones_size[MAX_NR_ZONES] = { 0, };
50 unsigned long size; 50 unsigned long size;
51 51
52 52
@@ -92,8 +92,7 @@ void __init paging_init(void)
92 current->mm = NULL; 92 current->mm = NULL;
93 93
94 /* memory sizing is a hack stolen from motorola.c.. hope it works for us */ 94 /* memory sizing is a hack stolen from motorola.c.. hope it works for us */
95 zones_size[0] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT; 95 zones_size[ZONE_DMA] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
96 zones_size[1] = 0;
97 96
98 free_area_init(zones_size); 97 free_area_init(zones_size);
99 98
diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
index e1b3aa39e270..8e2c5a88efa7 100644
--- a/arch/m68knommu/kernel/signal.c
+++ b/arch/m68knommu/kernel/signal.c
@@ -553,7 +553,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
553 553
554 /* This is the X/Open sanctioned signal stack switching. */ 554 /* This is the X/Open sanctioned signal stack switching. */
555 if (ka->sa.sa_flags & SA_ONSTACK) { 555 if (ka->sa.sa_flags & SA_ONSTACK) {
556 if (!on_sig_stack(usp)) 556 if (!sas_ss_flags(usp))
557 usp = current->sas_ss_sp + current->sas_ss_size; 557 usp = current->sas_ss_sp + current->sas_ss_size;
558 } 558 }
559 return (void *)((usp - frame_size) & -8UL); 559 return (void *)((usp - frame_size) & -8UL);
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index a0ac0e5f61ad..2d2fdf77e308 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -497,7 +497,7 @@ einval: li v0, -EINVAL
497 sys sys_sched_get_priority_min 1 497 sys sys_sched_get_priority_min 1
498 sys sys_sched_rr_get_interval 2 /* 4165 */ 498 sys sys_sched_rr_get_interval 2 /* 4165 */
499 sys sys_nanosleep, 2 499 sys sys_nanosleep, 2
500 sys sys_mremap, 4 500 sys sys_mremap, 5
501 sys sys_accept 3 501 sys sys_accept 3
502 sys sys_bind 3 502 sys sys_bind 3
503 sys sys_connect 3 /* 4170 */ 503 sys sys_connect 3 /* 4170 */
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 5407b784cd01..19e1ef43eb4b 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __user *path,
694 if (error) 694 if (error)
695 goto out; 695 goto out;
696 696
697 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); 697 error = vfs_statfs(nd.dentry, &kbuf);
698 if (error) 698 if (error)
699 goto dput_and_out; 699 goto dput_and_out;
700 700
@@ -732,7 +732,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs __user *buf)
732 goto out; 732 goto out;
733 } 733 }
734 734
735 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); 735 error = vfs_statfs(file->f_dentry, &kbuf);
736 if (error) 736 if (error)
737 goto out_f; 737 goto out_f;
738 738
@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
1360 error = user_path_walk(fname, &nd); 1360 error = user_path_walk(fname, &nd);
1361 if (error) 1361 if (error)
1362 goto out; 1362 goto out;
1363 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); 1363 error = vfs_statfs(nd.dentry, &kbuf);
1364 if (error) 1364 if (error)
1365 goto dput_and_out; 1365 goto dput_and_out;
1366 1366
@@ -1406,7 +1406,7 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs __user *buf)
1406 error = -EBADF; 1406 error = -EBADF;
1407 goto out; 1407 goto out;
1408 } 1408 }
1409 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); 1409 error = vfs_statfs(file->f_dentry, &kbuf);
1410 if (error) 1410 if (error)
1411 goto out_f; 1411 goto out_f;
1412 1412
@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
1611 error = user_path_walk(fname, &nd); 1611 error = user_path_walk(fname, &nd);
1612 if (error) 1612 if (error)
1613 goto out; 1613 goto out;
1614 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); 1614 error = vfs_statfs(nd.dentry, &kbuf);
1615 if (error) 1615 if (error)
1616 goto dput_and_out; 1616 goto dput_and_out;
1617 1617
@@ -1658,7 +1658,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs __user *buf)
1658 error = -EBADF; 1658 error = -EBADF;
1659 goto out; 1659 goto out;
1660 } 1660 }
1661 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); 1661 error = vfs_statfs(file->f_dentry, &kbuf);
1662 if (error) 1662 if (error)
1663 goto out_f; 1663 goto out_f;
1664 1664
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index 05273ccced0e..cb69727027ae 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -145,7 +145,7 @@ static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf)
145 s = user_get_super(dev); 145 s = user_get_super(dev);
146 if (s == NULL) 146 if (s == NULL)
147 goto out; 147 goto out;
148 err = vfs_statfs(s, &sbuf); 148 err = vfs_statfs(s->s_root, &sbuf);
149 drop_super(s); 149 drop_super(s);
150 if (err) 150 if (err)
151 goto out; 151 goto out;
@@ -186,12 +186,12 @@ struct hpux_statfs {
186 int16_t f_pad; 186 int16_t f_pad;
187}; 187};
188 188
189static int vfs_statfs_hpux(struct super_block *sb, struct hpux_statfs *buf) 189static int vfs_statfs_hpux(struct dentry *dentry, struct hpux_statfs *buf)
190{ 190{
191 struct kstatfs st; 191 struct kstatfs st;
192 int retval; 192 int retval;
193 193
194 retval = vfs_statfs(sb, &st); 194 retval = vfs_statfs(dentry, &st);
195 if (retval) 195 if (retval)
196 return retval; 196 return retval;
197 197
@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *path,
219 error = user_path_walk(path, &nd); 219 error = user_path_walk(path, &nd);
220 if (!error) { 220 if (!error) {
221 struct hpux_statfs tmp; 221 struct hpux_statfs tmp;
222 error = vfs_statfs_hpux(nd.dentry->d_inode->i_sb, &tmp); 222 error = vfs_statfs_hpux(nd.dentry, &tmp);
223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
224 error = -EFAULT; 224 error = -EFAULT;
225 path_release(&nd); 225 path_release(&nd);
@@ -237,7 +237,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
237 file = fget(fd); 237 file = fget(fd);
238 if (!file) 238 if (!file)
239 goto out; 239 goto out;
240 error = vfs_statfs_hpux(file->f_dentry->d_inode->i_sb, &tmp); 240 error = vfs_statfs_hpux(file->f_dentry, &tmp);
241 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 241 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
242 error = -EFAULT; 242 error = -EFAULT;
243 fput(file); 243 fput(file);
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 05767e83cf2d..cc38edfd90c5 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -248,7 +248,7 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
248 DBG(1,"get_sigframe: ka = %#lx, sp = %#lx, frame_size = %#lx\n", 248 DBG(1,"get_sigframe: ka = %#lx, sp = %#lx, frame_size = %#lx\n",
249 (unsigned long)ka, sp, frame_size); 249 (unsigned long)ka, sp, frame_size);
250 250
251 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) 251 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
252 sp = current->sas_ss_sp; /* Stacks grow up! */ 252 sp = current->sas_ss_sp; /* Stacks grow up! */
253 253
254 DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp); 254 DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp);
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6729c98b66f9..e922a88b2bad 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -45,6 +45,10 @@ config GENERIC_CALIBRATE_DELAY
45 bool 45 bool
46 default y 46 default y
47 47
48config GENERIC_FIND_NEXT_BIT
49 bool
50 default y
51
48config PPC 52config PPC
49 bool 53 bool
50 default y 54 default y
@@ -137,6 +141,15 @@ config PPC_85xx
137 select FSL_SOC 141 select FSL_SOC
138 select 85xx 142 select 85xx
139 143
144config PPC_86xx
145 bool "Freescale 86xx"
146 select 6xx
147 select FSL_SOC
148 select PPC_FPU
149 select ALTIVEC
150 help
151 The Freescale E600 SoCs have 74xx cores.
152
140config 40x 153config 40x
141 bool "AMCC 40x" 154 bool "AMCC 40x"
142 155
@@ -336,7 +349,7 @@ endchoice
336 349
337config PPC_PSERIES 350config PPC_PSERIES
338 depends on PPC_MULTIPLATFORM && PPC64 351 depends on PPC_MULTIPLATFORM && PPC64
339 bool " IBM pSeries & new (POWER5-based) iSeries" 352 bool "IBM pSeries & new (POWER5-based) iSeries"
340 select PPC_I8259 353 select PPC_I8259
341 select PPC_RTAS 354 select PPC_RTAS
342 select RTAS_ERROR_LOGGING 355 select RTAS_ERROR_LOGGING
@@ -344,7 +357,7 @@ config PPC_PSERIES
344 default y 357 default y
345 358
346config PPC_CHRP 359config PPC_CHRP
347 bool " Common Hardware Reference Platform (CHRP) based machines" 360 bool "Common Hardware Reference Platform (CHRP) based machines"
348 depends on PPC_MULTIPLATFORM && PPC32 361 depends on PPC_MULTIPLATFORM && PPC32
349 select PPC_I8259 362 select PPC_I8259
350 select PPC_INDIRECT_PCI 363 select PPC_INDIRECT_PCI
@@ -354,7 +367,7 @@ config PPC_CHRP
354 default y 367 default y
355 368
356config PPC_PMAC 369config PPC_PMAC
357 bool " Apple PowerMac based machines" 370 bool "Apple PowerMac based machines"
358 depends on PPC_MULTIPLATFORM 371 depends on PPC_MULTIPLATFORM
359 select PPC_INDIRECT_PCI if PPC32 372 select PPC_INDIRECT_PCI if PPC32
360 select PPC_MPC106 if PPC32 373 select PPC_MPC106 if PPC32
@@ -370,7 +383,7 @@ config PPC_PMAC64
370 default y 383 default y
371 384
372config PPC_PREP 385config PPC_PREP
373 bool " PowerPC Reference Platform (PReP) based machines" 386 bool "PowerPC Reference Platform (PReP) based machines"
374 depends on PPC_MULTIPLATFORM && PPC32 && BROKEN 387 depends on PPC_MULTIPLATFORM && PPC32 && BROKEN
375 select PPC_I8259 388 select PPC_I8259
376 select PPC_INDIRECT_PCI 389 select PPC_INDIRECT_PCI
@@ -379,7 +392,7 @@ config PPC_PREP
379 392
380config PPC_MAPLE 393config PPC_MAPLE
381 depends on PPC_MULTIPLATFORM && PPC64 394 depends on PPC_MULTIPLATFORM && PPC64
382 bool " Maple 970FX Evaluation Board" 395 bool "Maple 970FX Evaluation Board"
383 select U3_DART 396 select U3_DART
384 select MPIC_BROKEN_U3 397 select MPIC_BROKEN_U3
385 select GENERIC_TBSYNC 398 select GENERIC_TBSYNC
@@ -391,8 +404,18 @@ config PPC_MAPLE
391 For more informations, refer to <http://www.970eval.com> 404 For more informations, refer to <http://www.970eval.com>
392 405
393config PPC_CELL 406config PPC_CELL
394 bool " Cell Broadband Processor Architecture" 407 bool
408 default n
409
410config PPC_CELL_NATIVE
411 bool
412 select PPC_CELL
413 default n
414
415config PPC_IBM_CELL_BLADE
416 bool " IBM Cell Blade"
395 depends on PPC_MULTIPLATFORM && PPC64 417 depends on PPC_MULTIPLATFORM && PPC64
418 select PPC_CELL_NATIVE
396 select PPC_RTAS 419 select PPC_RTAS
397 select MMIO_NVRAM 420 select MMIO_NVRAM
398 select PPC_UDBG_16550 421 select PPC_UDBG_16550
@@ -439,11 +462,6 @@ config MPIC_BROKEN_U3
439 depends on PPC_MAPLE 462 depends on PPC_MAPLE
440 default y 463 default y
441 464
442config CELL_IIC
443 depends on PPC_CELL
444 bool
445 default y
446
447config IBMVIO 465config IBMVIO
448 depends on PPC_PSERIES || PPC_ISERIES 466 depends on PPC_PSERIES || PPC_ISERIES
449 bool 467 bool
@@ -545,6 +563,7 @@ source arch/powerpc/platforms/embedded6xx/Kconfig
545source arch/powerpc/platforms/4xx/Kconfig 563source arch/powerpc/platforms/4xx/Kconfig
546source arch/powerpc/platforms/83xx/Kconfig 564source arch/powerpc/platforms/83xx/Kconfig
547source arch/powerpc/platforms/85xx/Kconfig 565source arch/powerpc/platforms/85xx/Kconfig
566source arch/powerpc/platforms/86xx/Kconfig
548source arch/powerpc/platforms/8xx/Kconfig 567source arch/powerpc/platforms/8xx/Kconfig
549source arch/powerpc/platforms/cell/Kconfig 568source arch/powerpc/platforms/cell/Kconfig
550 569
@@ -699,7 +718,6 @@ config PPC_64K_PAGES
699config SCHED_SMT 718config SCHED_SMT
700 bool "SMT (Hyperthreading) scheduler support" 719 bool "SMT (Hyperthreading) scheduler support"
701 depends on PPC64 && SMP 720 depends on PPC64 && SMP
702 default off
703 help 721 help
704 SMT scheduler support improves the CPU scheduler's decision making 722 SMT scheduler support improves the CPU scheduler's decision making
705 when dealing with POWER5 cpus at a cost of slightly increased 723 when dealing with POWER5 cpus at a cost of slightly increased
@@ -776,6 +794,7 @@ config GENERIC_ISA_DMA
776 794
777config PPC_I8259 795config PPC_I8259
778 bool 796 bool
797 default y if MPC8641_HPCN
779 default n 798 default n
780 799
781config PPC_INDIRECT_PCI 800config PPC_INDIRECT_PCI
@@ -798,8 +817,8 @@ config MCA
798 bool 817 bool
799 818
800config PCI 819config PCI
801 bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) 820 bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES)
802 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !PPC_85xx 821 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !PPC_85xx && !PPC_86xx
803 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS 822 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS
804 default PCI_QSPAN if !4xx && !CPM2 && 8xx 823 default PCI_QSPAN if !4xx && !CPM2 && 8xx
805 help 824 help
@@ -827,12 +846,12 @@ config PCI_8260
827 default y 846 default y
828 847
829config 8260_PCI9 848config 8260_PCI9
830 bool " Enable workaround for MPC826x erratum PCI 9" 849 bool "Enable workaround for MPC826x erratum PCI 9"
831 depends on PCI_8260 && !ADS8272 850 depends on PCI_8260 && !ADS8272
832 default y 851 default y
833 852
834choice 853choice
835 prompt " IDMA channel for PCI 9 workaround" 854 prompt "IDMA channel for PCI 9 workaround"
836 depends on 8260_PCI9 855 depends on 8260_PCI9
837 856
838config 8260_PCI9_IDMA1 857config 8260_PCI9_IDMA1
@@ -849,6 +868,8 @@ config 8260_PCI9_IDMA4
849 868
850endchoice 869endchoice
851 870
871source "drivers/pci/pcie/Kconfig"
872
852source "drivers/pci/Kconfig" 873source "drivers/pci/Kconfig"
853 874
854source "drivers/pcmcia/Kconfig" 875source "drivers/pcmcia/Kconfig"
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 8d48e9e7162a..c69006ae8246 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -110,13 +110,16 @@ config SERIAL_TEXT_DEBUG
110 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \ 110 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \
111 PPC_GEN550 || PPC_MPC52xx 111 PPC_GEN550 || PPC_MPC52xx
112 112
113config PPC_EARLY_DEBUG
114 bool "Early debugging (dangerous)"
115
113choice 116choice
114 prompt "Early debugging (dangerous)" 117 prompt "Early debugging console"
115 bool 118 depends on PPC_EARLY_DEBUG
116 optional
117 help 119 help
118 Enable early debugging. Careful, if you enable debugging for the 120 Use the selected console for early debugging. Careful, if you
119 wrong type of machine your kernel _will not boot_. 121 enable debugging for the wrong type of machine your kernel
122 _will not boot_.
120 123
121config PPC_EARLY_DEBUG_LPAR 124config PPC_EARLY_DEBUG_LPAR
122 bool "LPAR HV Console" 125 bool "LPAR HV Console"
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index ed5b26aa8be3..01667d1d571d 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -108,7 +108,6 @@ ifeq ($(CONFIG_6xx),y)
108CFLAGS += -mcpu=powerpc 108CFLAGS += -mcpu=powerpc
109endif 109endif
110 110
111cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
112cpu-as-$(CONFIG_4xx) += -Wa,-m405 111cpu-as-$(CONFIG_4xx) += -Wa,-m405
113cpu-as-$(CONFIG_6xx) += -Wa,-maltivec 112cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
114cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec 113cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 840ae595a617..d961bfeed05f 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -29,8 +29,8 @@ OBJCOPYFLAGS := contents,alloc,load,readonly,data
29OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000 29OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000
30OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment 30OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
31 31
32zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c 32zlib := inffast.c inflate.c inftrees.c
33zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h 33zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
34zliblinuxheader := zlib.h zconf.h zutil.h 34zliblinuxheader := zlib.h zconf.h zutil.h
35 35
36$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 36$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 816446f0e497..b66634c9ea34 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -33,6 +33,14 @@ extern char _vmlinux_end[];
33extern char _initrd_start[]; 33extern char _initrd_start[];
34extern char _initrd_end[]; 34extern char _initrd_end[];
35 35
36/* A buffer that may be edited by tools operating on a zImage binary so as to
37 * edit the command line passed to vmlinux (by setting /chosen/bootargs).
38 * The buffer is put in it's own section so that tools may locate it easier.
39 */
40static char builtin_cmdline[512]
41 __attribute__((section("__builtin_cmdline")));
42
43
36struct addr_range { 44struct addr_range {
37 unsigned long addr; 45 unsigned long addr;
38 unsigned long size; 46 unsigned long size;
@@ -204,6 +212,23 @@ static int is_elf32(void *hdr)
204 return 1; 212 return 1;
205} 213}
206 214
215void export_cmdline(void* chosen_handle)
216{
217 int len;
218 char cmdline[2] = { 0, 0 };
219
220 if (builtin_cmdline[0] == 0)
221 return;
222
223 len = getprop(chosen_handle, "bootargs", cmdline, sizeof(cmdline));
224 if (len > 0 && cmdline[0] != 0)
225 return;
226
227 setprop(chosen_handle, "bootargs", builtin_cmdline,
228 strlen(builtin_cmdline) + 1);
229}
230
231
207void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) 232void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
208{ 233{
209 int len; 234 int len;
@@ -289,6 +314,8 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
289 memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size); 314 memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size);
290 } 315 }
291 316
317 export_cmdline(chosen_handle);
318
292 /* Skip over the ELF header */ 319 /* Skip over the ELF header */
293#ifdef DEBUG 320#ifdef DEBUG
294 printf("... skipping 0x%lx bytes of ELF header\n\r", 321 printf("... skipping 0x%lx bytes of ELF header\n\r",
diff --git a/arch/powerpc/boot/prom.h b/arch/powerpc/boot/prom.h
index 3e2ddd4a5a81..a57b184c564f 100644
--- a/arch/powerpc/boot/prom.h
+++ b/arch/powerpc/boot/prom.h
@@ -31,4 +31,11 @@ static inline int getprop(void *phandle, const char *name,
31 return call_prom("getprop", 4, 1, phandle, name, buf, buflen); 31 return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
32} 32}
33 33
34
35static inline int setprop(void *phandle, const char *name,
36 void *buf, int buflen)
37{
38 return call_prom("setprop", 4, 1, phandle, name, buf, buflen);
39}
40
34#endif /* _PPC_BOOT_PROM_H_ */ 41#endif /* _PPC_BOOT_PROM_H_ */
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index dbe421dc3c11..b8b8d4675dc0 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16 3# Linux kernel version: 2.6.17
4# Thu Mar 23 20:48:09 2006 4# Mon Jun 19 17:23:03 2006
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -11,6 +11,7 @@ CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y 11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_PPC=y 15CONFIG_PPC=y
15CONFIG_EARLY_PRINTK=y 16CONFIG_EARLY_PRINTK=y
16CONFIG_COMPAT=y 17CONFIG_COMPAT=y
@@ -55,7 +56,7 @@ CONFIG_SYSCTL=y
55# CONFIG_AUDIT is not set 56# CONFIG_AUDIT is not set
56CONFIG_IKCONFIG=y 57CONFIG_IKCONFIG=y
57CONFIG_IKCONFIG_PROC=y 58CONFIG_IKCONFIG_PROC=y
58# CONFIG_CPUSETS is not set 59CONFIG_CPUSETS=y
59# CONFIG_RELAY is not set 60# CONFIG_RELAY is not set
60CONFIG_INITRAMFS_SOURCE="" 61CONFIG_INITRAMFS_SOURCE=""
61CONFIG_CC_OPTIMIZE_FOR_SIZE=y 62CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -116,13 +117,15 @@ CONFIG_PPC_MULTIPLATFORM=y
116# CONFIG_PPC_PMAC is not set 117# CONFIG_PPC_PMAC is not set
117# CONFIG_PPC_MAPLE is not set 118# CONFIG_PPC_MAPLE is not set
118CONFIG_PPC_CELL=y 119CONFIG_PPC_CELL=y
120CONFIG_PPC_CELL_NATIVE=y
121CONFIG_PPC_IBM_CELL_BLADE=y
122CONFIG_PPC_SYSTEMSIM=y
119# CONFIG_U3_DART is not set 123# CONFIG_U3_DART is not set
120CONFIG_PPC_RTAS=y 124CONFIG_PPC_RTAS=y
121# CONFIG_RTAS_ERROR_LOGGING is not set 125# CONFIG_RTAS_ERROR_LOGGING is not set
122CONFIG_RTAS_PROC=y 126CONFIG_RTAS_PROC=y
123CONFIG_RTAS_FLASH=y 127CONFIG_RTAS_FLASH=y
124CONFIG_MMIO_NVRAM=y 128CONFIG_MMIO_NVRAM=y
125CONFIG_CELL_IIC=y
126# CONFIG_PPC_MPC106 is not set 129# CONFIG_PPC_MPC106 is not set
127# CONFIG_PPC_970_NAP is not set 130# CONFIG_PPC_970_NAP is not set
128# CONFIG_CPU_FREQ is not set 131# CONFIG_CPU_FREQ is not set
@@ -132,7 +135,9 @@ CONFIG_CELL_IIC=y
132# Cell Broadband Engine options 135# Cell Broadband Engine options
133# 136#
134CONFIG_SPU_FS=m 137CONFIG_SPU_FS=m
138CONFIG_SPU_BASE=y
135CONFIG_SPUFS_MMAP=y 139CONFIG_SPUFS_MMAP=y
140CONFIG_CBE_RAS=y
136 141
137# 142#
138# Kernel options 143# Kernel options
@@ -152,20 +157,24 @@ CONFIG_FORCE_MAX_ZONEORDER=13
152CONFIG_KEXEC=y 157CONFIG_KEXEC=y
153# CONFIG_CRASH_DUMP is not set 158# CONFIG_CRASH_DUMP is not set
154CONFIG_IRQ_ALL_CPUS=y 159CONFIG_IRQ_ALL_CPUS=y
155# CONFIG_NUMA is not set 160CONFIG_NUMA=y
161CONFIG_NODES_SHIFT=4
156CONFIG_ARCH_SELECT_MEMORY_MODEL=y 162CONFIG_ARCH_SELECT_MEMORY_MODEL=y
157CONFIG_ARCH_FLATMEM_ENABLE=y
158CONFIG_ARCH_SPARSEMEM_ENABLE=y 163CONFIG_ARCH_SPARSEMEM_ENABLE=y
159CONFIG_SELECT_MEMORY_MODEL=y 164CONFIG_SELECT_MEMORY_MODEL=y
160# CONFIG_FLATMEM_MANUAL is not set 165# CONFIG_FLATMEM_MANUAL is not set
161# CONFIG_DISCONTIGMEM_MANUAL is not set 166# CONFIG_DISCONTIGMEM_MANUAL is not set
162CONFIG_SPARSEMEM_MANUAL=y 167CONFIG_SPARSEMEM_MANUAL=y
163CONFIG_SPARSEMEM=y 168CONFIG_SPARSEMEM=y
169CONFIG_NEED_MULTIPLE_NODES=y
164CONFIG_HAVE_MEMORY_PRESENT=y 170CONFIG_HAVE_MEMORY_PRESENT=y
165# CONFIG_SPARSEMEM_STATIC is not set 171# CONFIG_SPARSEMEM_STATIC is not set
166CONFIG_SPARSEMEM_EXTREME=y 172CONFIG_SPARSEMEM_EXTREME=y
167# CONFIG_MEMORY_HOTPLUG is not set 173CONFIG_MEMORY_HOTPLUG=y
168CONFIG_SPLIT_PTLOCK_CPUS=4 174CONFIG_SPLIT_PTLOCK_CPUS=4
175CONFIG_MIGRATION=y
176CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
177CONFIG_ARCH_MEMORY_PROBE=y
169# CONFIG_PPC_64K_PAGES is not set 178# CONFIG_PPC_64K_PAGES is not set
170CONFIG_SCHED_SMT=y 179CONFIG_SCHED_SMT=y
171CONFIG_PROC_DEVICETREE=y 180CONFIG_PROC_DEVICETREE=y
@@ -182,6 +191,7 @@ CONFIG_GENERIC_ISA_DMA=y
182# CONFIG_PPC_INDIRECT_PCI is not set 191# CONFIG_PPC_INDIRECT_PCI is not set
183CONFIG_PCI=y 192CONFIG_PCI=y
184CONFIG_PCI_DOMAINS=y 193CONFIG_PCI_DOMAINS=y
194CONFIG_PCIEPORTBUS=y
185# CONFIG_PCI_DEBUG is not set 195# CONFIG_PCI_DEBUG is not set
186 196
187# 197#
@@ -476,7 +486,7 @@ CONFIG_DM_MULTIPATH=m
476# 486#
477CONFIG_NETDEVICES=y 487CONFIG_NETDEVICES=y
478# CONFIG_DUMMY is not set 488# CONFIG_DUMMY is not set
479# CONFIG_BONDING is not set 489CONFIG_BONDING=y
480# CONFIG_EQUALIZER is not set 490# CONFIG_EQUALIZER is not set
481# CONFIG_TUN is not set 491# CONFIG_TUN is not set
482 492
@@ -624,6 +634,7 @@ CONFIG_SERIAL_NONSTANDARD=y
624# CONFIG_N_HDLC is not set 634# CONFIG_N_HDLC is not set
625# CONFIG_SPECIALIX is not set 635# CONFIG_SPECIALIX is not set
626# CONFIG_SX is not set 636# CONFIG_SX is not set
637# CONFIG_RIO is not set
627# CONFIG_STALDRV is not set 638# CONFIG_STALDRV is not set
628 639
629# 640#
@@ -766,6 +777,7 @@ CONFIG_I2C_ALGOBIT=y
766# Multimedia devices 777# Multimedia devices
767# 778#
768# CONFIG_VIDEO_DEV is not set 779# CONFIG_VIDEO_DEV is not set
780CONFIG_VIDEO_V4L2=y
769 781
770# 782#
771# Digital Video Broadcasting Devices 783# Digital Video Broadcasting Devices
@@ -1054,11 +1066,7 @@ CONFIG_DEBUGGER=y
1054# CONFIG_XMON is not set 1066# CONFIG_XMON is not set
1055CONFIG_IRQSTACKS=y 1067CONFIG_IRQSTACKS=y
1056# CONFIG_BOOTX_TEXT is not set 1068# CONFIG_BOOTX_TEXT is not set
1057# CONFIG_PPC_EARLY_DEBUG_LPAR is not set 1069# CONFIG_PPC_EARLY_DEBUG is not set
1058# CONFIG_PPC_EARLY_DEBUG_G5 is not set
1059# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
1060# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1061# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1062 1070
1063# 1071#
1064# Security options 1072# Security options
diff --git a/arch/powerpc/configs/mpc85xx_cds_defconfig b/arch/powerpc/configs/mpc85xx_cds_defconfig
new file mode 100644
index 000000000000..9bb022a523fe
--- /dev/null
+++ b/arch/powerpc/configs/mpc85xx_cds_defconfig
@@ -0,0 +1,846 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16
4# Sun Apr 2 11:23:42 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_PPC=y
15CONFIG_EARLY_PRINTK=y
16CONFIG_GENERIC_NVRAM=y
17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_PPC_OF=y
20CONFIG_PPC_UDBG_16550=y
21# CONFIG_GENERIC_TBSYNC is not set
22# CONFIG_DEFAULT_UIMAGE is not set
23
24#
25# Processor support
26#
27# CONFIG_CLASSIC32 is not set
28# CONFIG_PPC_52xx is not set
29# CONFIG_PPC_82xx is not set
30# CONFIG_PPC_83xx is not set
31CONFIG_PPC_85xx=y
32# CONFIG_40x is not set
33# CONFIG_44x is not set
34# CONFIG_8xx is not set
35# CONFIG_E200 is not set
36CONFIG_85xx=y
37CONFIG_E500=y
38CONFIG_BOOKE=y
39CONFIG_FSL_BOOKE=y
40# CONFIG_PHYS_64BIT is not set
41CONFIG_SPE=y
42
43#
44# Code maturity level options
45#
46CONFIG_EXPERIMENTAL=y
47CONFIG_BROKEN_ON_SMP=y
48CONFIG_INIT_ENV_ARG_LIMIT=32
49
50#
51# General setup
52#
53CONFIG_LOCALVERSION=""
54CONFIG_LOCALVERSION_AUTO=y
55CONFIG_SWAP=y
56CONFIG_SYSVIPC=y
57# CONFIG_POSIX_MQUEUE is not set
58# CONFIG_BSD_PROCESS_ACCT is not set
59CONFIG_SYSCTL=y
60# CONFIG_AUDIT is not set
61# CONFIG_IKCONFIG is not set
62# CONFIG_RELAY is not set
63CONFIG_INITRAMFS_SOURCE=""
64# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
65CONFIG_EMBEDDED=y
66CONFIG_KALLSYMS=y
67# CONFIG_KALLSYMS_ALL is not set
68# CONFIG_KALLSYMS_EXTRA_PASS is not set
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_MPIC=y
107# CONFIG_WANT_EARLY_SERIAL is not set
108
109#
110# Platform support
111#
112# CONFIG_MPC8540_ADS is not set
113CONFIG_MPC85xx_CDS=y
114CONFIG_MPC8540=y
115CONFIG_PPC_INDIRECT_PCI_BE=y
116
117#
118# Kernel options
119#
120# CONFIG_HIGHMEM is not set
121# CONFIG_HZ_100 is not set
122CONFIG_HZ_250=y
123# CONFIG_HZ_1000 is not set
124CONFIG_HZ=250
125CONFIG_PREEMPT_NONE=y
126# CONFIG_PREEMPT_VOLUNTARY is not set
127# CONFIG_PREEMPT is not set
128CONFIG_BINFMT_ELF=y
129CONFIG_BINFMT_MISC=y
130CONFIG_MATH_EMULATION=y
131CONFIG_ARCH_FLATMEM_ENABLE=y
132CONFIG_SELECT_MEMORY_MODEL=y
133CONFIG_FLATMEM_MANUAL=y
134# CONFIG_DISCONTIGMEM_MANUAL is not set
135# CONFIG_SPARSEMEM_MANUAL is not set
136CONFIG_FLATMEM=y
137CONFIG_FLAT_NODE_MEM_MAP=y
138# CONFIG_SPARSEMEM_STATIC is not set
139CONFIG_SPLIT_PTLOCK_CPUS=4
140CONFIG_PROC_DEVICETREE=y
141# CONFIG_CMDLINE_BOOL is not set
142# CONFIG_PM is not set
143# CONFIG_SOFTWARE_SUSPEND is not set
144# CONFIG_SECCOMP is not set
145CONFIG_ISA_DMA_API=y
146
147#
148# Bus options
149#
150CONFIG_PPC_I8259=y
151CONFIG_PPC_INDIRECT_PCI=y
152CONFIG_FSL_SOC=y
153CONFIG_PCI=y
154CONFIG_PCI_DOMAINS=y
155# CONFIG_PCI_DEBUG is not set
156
157#
158# PCCARD (PCMCIA/CardBus) support
159#
160# CONFIG_PCCARD is not set
161
162#
163# PCI Hotplug Support
164#
165# CONFIG_HOTPLUG_PCI is not set
166
167#
168# Advanced setup
169#
170# CONFIG_ADVANCED_OPTIONS is not set
171
172#
173# Default settings for advanced configuration options are used
174#
175CONFIG_HIGHMEM_START=0xfe000000
176CONFIG_LOWMEM_SIZE=0x30000000
177CONFIG_KERNEL_START=0xc0000000
178CONFIG_TASK_SIZE=0x80000000
179CONFIG_BOOT_LOAD=0x00800000
180
181#
182# Networking
183#
184CONFIG_NET=y
185
186#
187# Networking options
188#
189# CONFIG_NETDEBUG is not set
190CONFIG_PACKET=y
191# CONFIG_PACKET_MMAP is not set
192CONFIG_UNIX=y
193# CONFIG_NET_KEY is not set
194CONFIG_INET=y
195CONFIG_IP_MULTICAST=y
196# CONFIG_IP_ADVANCED_ROUTER is not set
197CONFIG_IP_FIB_HASH=y
198CONFIG_IP_PNP=y
199CONFIG_IP_PNP_DHCP=y
200CONFIG_IP_PNP_BOOTP=y
201# CONFIG_IP_PNP_RARP is not set
202# CONFIG_NET_IPIP is not set
203# CONFIG_NET_IPGRE is not set
204# CONFIG_IP_MROUTE is not set
205# CONFIG_ARPD is not set
206CONFIG_SYN_COOKIES=y
207# CONFIG_INET_AH is not set
208# CONFIG_INET_ESP is not set
209# CONFIG_INET_IPCOMP is not set
210# CONFIG_INET_XFRM_TUNNEL is not set
211# CONFIG_INET_TUNNEL is not set
212CONFIG_INET_DIAG=y
213CONFIG_INET_TCP_DIAG=y
214# CONFIG_TCP_CONG_ADVANCED is not set
215CONFIG_TCP_CONG_BIC=y
216# CONFIG_IPV6 is not set
217# CONFIG_INET6_XFRM_TUNNEL is not set
218# CONFIG_INET6_TUNNEL is not set
219# CONFIG_NETFILTER is not set
220
221#
222# DCCP Configuration (EXPERIMENTAL)
223#
224# CONFIG_IP_DCCP is not set
225
226#
227# SCTP Configuration (EXPERIMENTAL)
228#
229# CONFIG_IP_SCTP is not set
230
231#
232# TIPC Configuration (EXPERIMENTAL)
233#
234# CONFIG_TIPC is not set
235# CONFIG_ATM is not set
236# CONFIG_BRIDGE is not set
237# CONFIG_VLAN_8021Q is not set
238# CONFIG_DECNET is not set
239# CONFIG_LLC2 is not set
240# CONFIG_IPX is not set
241# CONFIG_ATALK is not set
242# CONFIG_X25 is not set
243# CONFIG_LAPB is not set
244# CONFIG_NET_DIVERT is not set
245# CONFIG_ECONET is not set
246# CONFIG_WAN_ROUTER is not set
247
248#
249# QoS and/or fair queueing
250#
251# CONFIG_NET_SCHED is not set
252
253#
254# Network testing
255#
256# CONFIG_NET_PKTGEN is not set
257# CONFIG_HAMRADIO is not set
258# CONFIG_IRDA is not set
259# CONFIG_BT is not set
260# CONFIG_IEEE80211 is not set
261
262#
263# Device Drivers
264#
265
266#
267# Generic Driver Options
268#
269CONFIG_STANDALONE=y
270CONFIG_PREVENT_FIRMWARE_BUILD=y
271# CONFIG_FW_LOADER is not set
272# CONFIG_DEBUG_DRIVER is not set
273
274#
275# Connector - unified userspace <-> kernelspace linker
276#
277# CONFIG_CONNECTOR is not set
278
279#
280# Memory Technology Devices (MTD)
281#
282# CONFIG_MTD is not set
283
284#
285# Parallel port support
286#
287# CONFIG_PARPORT is not set
288
289#
290# Plug and Play support
291#
292
293#
294# Block devices
295#
296# CONFIG_BLK_DEV_FD is not set
297# CONFIG_BLK_CPQ_DA is not set
298# CONFIG_BLK_CPQ_CISS_DA is not set
299# CONFIG_BLK_DEV_DAC960 is not set
300# CONFIG_BLK_DEV_UMEM is not set
301# CONFIG_BLK_DEV_COW_COMMON is not set
302CONFIG_BLK_DEV_LOOP=y
303# CONFIG_BLK_DEV_CRYPTOLOOP is not set
304# CONFIG_BLK_DEV_NBD is not set
305# CONFIG_BLK_DEV_SX8 is not set
306CONFIG_BLK_DEV_RAM=y
307CONFIG_BLK_DEV_RAM_COUNT=16
308CONFIG_BLK_DEV_RAM_SIZE=32768
309CONFIG_BLK_DEV_INITRD=y
310# CONFIG_CDROM_PKTCDVD is not set
311# CONFIG_ATA_OVER_ETH is not set
312
313#
314# ATA/ATAPI/MFM/RLL support
315#
316CONFIG_IDE=y
317CONFIG_BLK_DEV_IDE=y
318
319#
320# Please see Documentation/ide.txt for help/info on IDE drives
321#
322# CONFIG_BLK_DEV_IDE_SATA is not set
323# CONFIG_BLK_DEV_IDEDISK is not set
324# CONFIG_IDEDISK_MULTI_MODE is not set
325# CONFIG_BLK_DEV_IDECD is not set
326# CONFIG_BLK_DEV_IDETAPE is not set
327# CONFIG_BLK_DEV_IDEFLOPPY is not set
328# CONFIG_IDE_TASK_IOCTL is not set
329
330#
331# IDE chipset support/bugfixes
332#
333CONFIG_IDE_GENERIC=y
334CONFIG_BLK_DEV_IDEPCI=y
335CONFIG_IDEPCI_SHARE_IRQ=y
336# CONFIG_BLK_DEV_OFFBOARD is not set
337CONFIG_BLK_DEV_GENERIC=y
338# CONFIG_BLK_DEV_OPTI621 is not set
339# CONFIG_BLK_DEV_SL82C105 is not set
340CONFIG_BLK_DEV_IDEDMA_PCI=y
341# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
342# CONFIG_IDEDMA_PCI_AUTO is not set
343# CONFIG_BLK_DEV_AEC62XX is not set
344# CONFIG_BLK_DEV_ALI15X3 is not set
345# CONFIG_BLK_DEV_AMD74XX is not set
346# CONFIG_BLK_DEV_CMD64X is not set
347# CONFIG_BLK_DEV_TRIFLEX is not set
348# CONFIG_BLK_DEV_CY82C693 is not set
349# CONFIG_BLK_DEV_CS5520 is not set
350# CONFIG_BLK_DEV_CS5530 is not set
351# CONFIG_BLK_DEV_HPT34X is not set
352# CONFIG_BLK_DEV_HPT366 is not set
353# CONFIG_BLK_DEV_SC1200 is not set
354# CONFIG_BLK_DEV_PIIX is not set
355# CONFIG_BLK_DEV_IT821X is not set
356# CONFIG_BLK_DEV_NS87415 is not set
357# CONFIG_BLK_DEV_PDC202XX_OLD is not set
358# CONFIG_BLK_DEV_PDC202XX_NEW is not set
359# CONFIG_BLK_DEV_SVWKS is not set
360# CONFIG_BLK_DEV_SIIMAGE is not set
361# CONFIG_BLK_DEV_SLC90E66 is not set
362# CONFIG_BLK_DEV_TRM290 is not set
363CONFIG_BLK_DEV_VIA82CXXX=y
364# CONFIG_IDE_ARM is not set
365CONFIG_BLK_DEV_IDEDMA=y
366# CONFIG_IDEDMA_IVB is not set
367# CONFIG_IDEDMA_AUTO is not set
368# CONFIG_BLK_DEV_HD is not set
369
370#
371# SCSI device support
372#
373# CONFIG_RAID_ATTRS is not set
374# CONFIG_SCSI is not set
375
376#
377# Multi-device support (RAID and LVM)
378#
379# CONFIG_MD is not set
380
381#
382# Fusion MPT device support
383#
384# CONFIG_FUSION is not set
385
386#
387# IEEE 1394 (FireWire) support
388#
389# CONFIG_IEEE1394 is not set
390
391#
392# I2O device support
393#
394# CONFIG_I2O is not set
395
396#
397# Macintosh device drivers
398#
399# CONFIG_WINDFARM is not set
400
401#
402# Network device support
403#
404CONFIG_NETDEVICES=y
405# CONFIG_DUMMY is not set
406# CONFIG_BONDING is not set
407# CONFIG_EQUALIZER is not set
408# CONFIG_TUN is not set
409
410#
411# ARCnet devices
412#
413# CONFIG_ARCNET is not set
414
415#
416# PHY device support
417#
418CONFIG_PHYLIB=y
419
420#
421# MII PHY device drivers
422#
423# CONFIG_MARVELL_PHY is not set
424# CONFIG_DAVICOM_PHY is not set
425# CONFIG_QSEMI_PHY is not set
426# CONFIG_LXT_PHY is not set
427# CONFIG_CICADA_PHY is not set
428
429#
430# Ethernet (10 or 100Mbit)
431#
432CONFIG_NET_ETHERNET=y
433CONFIG_MII=y
434# CONFIG_HAPPYMEAL is not set
435# CONFIG_SUNGEM is not set
436# CONFIG_CASSINI is not set
437# CONFIG_NET_VENDOR_3COM is not set
438
439#
440# Tulip family network device support
441#
442# CONFIG_NET_TULIP is not set
443# CONFIG_HP100 is not set
444# CONFIG_NET_PCI is not set
445
446#
447# Ethernet (1000 Mbit)
448#
449# CONFIG_ACENIC is not set
450# CONFIG_DL2K is not set
451CONFIG_E1000=y
452CONFIG_E1000_NAPI=y
453# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
454# CONFIG_NS83820 is not set
455# CONFIG_HAMACHI is not set
456# CONFIG_YELLOWFIN is not set
457# CONFIG_R8169 is not set
458# CONFIG_SIS190 is not set
459# CONFIG_SKGE is not set
460# CONFIG_SKY2 is not set
461# CONFIG_SK98LIN is not set
462# CONFIG_TIGON3 is not set
463# CONFIG_BNX2 is not set
464CONFIG_GIANFAR=y
465CONFIG_GFAR_NAPI=y
466
467#
468# Ethernet (10000 Mbit)
469#
470# CONFIG_CHELSIO_T1 is not set
471# CONFIG_IXGB is not set
472# CONFIG_S2IO is not set
473
474#
475# Token Ring devices
476#
477# CONFIG_TR is not set
478
479#
480# Wireless LAN (non-hamradio)
481#
482# CONFIG_NET_RADIO is not set
483
484#
485# Wan interfaces
486#
487# CONFIG_WAN is not set
488# CONFIG_FDDI is not set
489# CONFIG_HIPPI is not set
490# CONFIG_PPP is not set
491# CONFIG_SLIP is not set
492# CONFIG_SHAPER is not set
493# CONFIG_NETCONSOLE is not set
494# CONFIG_NETPOLL is not set
495# CONFIG_NET_POLL_CONTROLLER is not set
496
497#
498# ISDN subsystem
499#
500# CONFIG_ISDN is not set
501
502#
503# Telephony Support
504#
505# CONFIG_PHONE is not set
506
507#
508# Input device support
509#
510CONFIG_INPUT=y
511
512#
513# Userland interfaces
514#
515# CONFIG_INPUT_MOUSEDEV is not set
516# CONFIG_INPUT_JOYDEV is not set
517# CONFIG_INPUT_TSDEV is not set
518# CONFIG_INPUT_EVDEV is not set
519# CONFIG_INPUT_EVBUG is not set
520
521#
522# Input Device Drivers
523#
524# CONFIG_INPUT_KEYBOARD is not set
525# CONFIG_INPUT_MOUSE is not set
526# CONFIG_INPUT_JOYSTICK is not set
527# CONFIG_INPUT_TOUCHSCREEN is not set
528# CONFIG_INPUT_MISC is not set
529
530#
531# Hardware I/O ports
532#
533# CONFIG_SERIO is not set
534# CONFIG_GAMEPORT is not set
535
536#
537# Character devices
538#
539# CONFIG_VT is not set
540# CONFIG_SERIAL_NONSTANDARD is not set
541
542#
543# Serial drivers
544#
545CONFIG_SERIAL_8250=y
546CONFIG_SERIAL_8250_CONSOLE=y
547CONFIG_SERIAL_8250_PCI=y
548CONFIG_SERIAL_8250_NR_UARTS=4
549CONFIG_SERIAL_8250_RUNTIME_UARTS=4
550# CONFIG_SERIAL_8250_EXTENDED is not set
551
552#
553# Non-8250 serial port support
554#
555CONFIG_SERIAL_CORE=y
556CONFIG_SERIAL_CORE_CONSOLE=y
557# CONFIG_SERIAL_JSM is not set
558CONFIG_UNIX98_PTYS=y
559CONFIG_LEGACY_PTYS=y
560CONFIG_LEGACY_PTY_COUNT=256
561
562#
563# IPMI
564#
565# CONFIG_IPMI_HANDLER is not set
566
567#
568# Watchdog Cards
569#
570# CONFIG_WATCHDOG is not set
571# CONFIG_NVRAM is not set
572CONFIG_GEN_RTC=y
573# CONFIG_GEN_RTC_X is not set
574# CONFIG_DTLK is not set
575# CONFIG_R3964 is not set
576# CONFIG_APPLICOM is not set
577
578#
579# Ftape, the floppy tape device driver
580#
581# CONFIG_AGP is not set
582# CONFIG_DRM is not set
583# CONFIG_RAW_DRIVER is not set
584
585#
586# TPM devices
587#
588# CONFIG_TCG_TPM is not set
589# CONFIG_TELCLOCK is not set
590
591#
592# I2C support
593#
594# CONFIG_I2C is not set
595
596#
597# SPI support
598#
599# CONFIG_SPI is not set
600# CONFIG_SPI_MASTER is not set
601
602#
603# Dallas's 1-wire bus
604#
605# CONFIG_W1 is not set
606
607#
608# Hardware Monitoring support
609#
610CONFIG_HWMON=y
611# CONFIG_HWMON_VID is not set
612# CONFIG_SENSORS_F71805F is not set
613# CONFIG_HWMON_DEBUG_CHIP is not set
614
615#
616# Misc devices
617#
618
619#
620# Multimedia devices
621#
622# CONFIG_VIDEO_DEV is not set
623
624#
625# Digital Video Broadcasting Devices
626#
627# CONFIG_DVB is not set
628
629#
630# Graphics support
631#
632# CONFIG_FB is not set
633
634#
635# Sound
636#
637# CONFIG_SOUND is not set
638
639#
640# USB support
641#
642CONFIG_USB_ARCH_HAS_HCD=y
643CONFIG_USB_ARCH_HAS_OHCI=y
644CONFIG_USB_ARCH_HAS_EHCI=y
645# CONFIG_USB is not set
646
647#
648# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
649#
650
651#
652# USB Gadget Support
653#
654# CONFIG_USB_GADGET is not set
655
656#
657# MMC/SD Card support
658#
659# CONFIG_MMC is not set
660
661#
662# LED devices
663#
664# CONFIG_NEW_LEDS is not set
665
666#
667# InfiniBand support
668#
669# CONFIG_INFINIBAND is not set
670
671#
672# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
673#
674
675#
676# Real Time Clock
677#
678# CONFIG_RTC_CLASS is not set
679
680#
681# File systems
682#
683CONFIG_EXT2_FS=y
684# CONFIG_EXT2_FS_XATTR is not set
685# CONFIG_EXT2_FS_XIP is not set
686CONFIG_EXT3_FS=y
687CONFIG_EXT3_FS_XATTR=y
688# CONFIG_EXT3_FS_POSIX_ACL is not set
689# CONFIG_EXT3_FS_SECURITY is not set
690CONFIG_JBD=y
691# CONFIG_JBD_DEBUG is not set
692CONFIG_FS_MBCACHE=y
693# CONFIG_REISERFS_FS is not set
694# CONFIG_JFS_FS is not set
695# CONFIG_FS_POSIX_ACL is not set
696# CONFIG_XFS_FS is not set
697# CONFIG_OCFS2_FS is not set
698# CONFIG_MINIX_FS is not set
699# CONFIG_ROMFS_FS is not set
700CONFIG_INOTIFY=y
701# CONFIG_QUOTA is not set
702CONFIG_DNOTIFY=y
703# CONFIG_AUTOFS_FS is not set
704# CONFIG_AUTOFS4_FS is not set
705# CONFIG_FUSE_FS is not set
706
707#
708# CD-ROM/DVD Filesystems
709#
710# CONFIG_ISO9660_FS is not set
711# CONFIG_UDF_FS is not set
712
713#
714# DOS/FAT/NT Filesystems
715#
716# CONFIG_MSDOS_FS is not set
717# CONFIG_VFAT_FS is not set
718# CONFIG_NTFS_FS is not set
719
720#
721# Pseudo filesystems
722#
723CONFIG_PROC_FS=y
724CONFIG_PROC_KCORE=y
725CONFIG_SYSFS=y
726CONFIG_TMPFS=y
727# CONFIG_HUGETLB_PAGE is not set
728CONFIG_RAMFS=y
729# CONFIG_CONFIGFS_FS is not set
730
731#
732# Miscellaneous filesystems
733#
734# CONFIG_ADFS_FS is not set
735# CONFIG_AFFS_FS is not set
736# CONFIG_HFS_FS is not set
737# CONFIG_HFSPLUS_FS is not set
738# CONFIG_BEFS_FS is not set
739# CONFIG_BFS_FS is not set
740# CONFIG_EFS_FS is not set
741# CONFIG_CRAMFS is not set
742# CONFIG_VXFS_FS is not set
743# CONFIG_HPFS_FS is not set
744# CONFIG_QNX4FS_FS is not set
745# CONFIG_SYSV_FS is not set
746# CONFIG_UFS_FS is not set
747
748#
749# Network File Systems
750#
751CONFIG_NFS_FS=y
752# CONFIG_NFS_V3 is not set
753# CONFIG_NFS_V4 is not set
754# CONFIG_NFS_DIRECTIO is not set
755# CONFIG_NFSD is not set
756CONFIG_ROOT_NFS=y
757CONFIG_LOCKD=y
758CONFIG_NFS_COMMON=y
759CONFIG_SUNRPC=y
760# CONFIG_RPCSEC_GSS_KRB5 is not set
761# CONFIG_RPCSEC_GSS_SPKM3 is not set
762# CONFIG_SMB_FS is not set
763# CONFIG_CIFS is not set
764# CONFIG_NCP_FS is not set
765# CONFIG_CODA_FS is not set
766# CONFIG_AFS_FS is not set
767# CONFIG_9P_FS is not set
768
769#
770# Partition Types
771#
772CONFIG_PARTITION_ADVANCED=y
773# CONFIG_ACORN_PARTITION is not set
774# CONFIG_OSF_PARTITION is not set
775# CONFIG_AMIGA_PARTITION is not set
776# CONFIG_ATARI_PARTITION is not set
777# CONFIG_MAC_PARTITION is not set
778# CONFIG_MSDOS_PARTITION is not set
779# CONFIG_LDM_PARTITION is not set
780# CONFIG_SGI_PARTITION is not set
781# CONFIG_ULTRIX_PARTITION is not set
782# CONFIG_SUN_PARTITION is not set
783# CONFIG_KARMA_PARTITION is not set
784# CONFIG_EFI_PARTITION is not set
785
786#
787# Native Language Support
788#
789# CONFIG_NLS is not set
790
791#
792# Library routines
793#
794# CONFIG_CRC_CCITT is not set
795# CONFIG_CRC16 is not set
796CONFIG_CRC32=y
797# CONFIG_LIBCRC32C is not set
798
799#
800# Instrumentation Support
801#
802# CONFIG_PROFILING is not set
803
804#
805# Kernel hacking
806#
807# CONFIG_PRINTK_TIME is not set
808# CONFIG_MAGIC_SYSRQ is not set
809CONFIG_DEBUG_KERNEL=y
810CONFIG_LOG_BUF_SHIFT=14
811CONFIG_DETECT_SOFTLOCKUP=y
812# CONFIG_SCHEDSTATS is not set
813# CONFIG_DEBUG_SLAB is not set
814CONFIG_DEBUG_MUTEXES=y
815# CONFIG_DEBUG_SPINLOCK is not set
816# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
817# CONFIG_DEBUG_KOBJECT is not set
818# CONFIG_DEBUG_INFO is not set
819# CONFIG_DEBUG_FS is not set
820# CONFIG_DEBUG_VM is not set
821# CONFIG_UNWIND_INFO is not set
822CONFIG_FORCED_INLINING=y
823# CONFIG_RCU_TORTURE_TEST is not set
824# CONFIG_DEBUGGER is not set
825# CONFIG_BDI_SWITCH is not set
826# CONFIG_BOOTX_TEXT is not set
827# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
828# CONFIG_PPC_EARLY_DEBUG_G5 is not set
829# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
830# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
831# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
832
833#
834# Security options
835#
836# CONFIG_KEYS is not set
837# CONFIG_SECURITY is not set
838
839#
840# Cryptographic options
841#
842# CONFIG_CRYPTO is not set
843
844#
845# Hardware crypto devices
846#
diff --git a/arch/powerpc/configs/mpc8641_hpcn_defconfig b/arch/powerpc/configs/mpc8641_hpcn_defconfig
new file mode 100644
index 000000000000..d7a30f9bc535
--- /dev/null
+++ b/arch/powerpc/configs/mpc8641_hpcn_defconfig
@@ -0,0 +1,921 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-rc3
4# Fri Jun 16 10:47:09 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_PPC=y
15CONFIG_EARLY_PRINTK=y
16CONFIG_GENERIC_NVRAM=y
17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_PPC_OF=y
20CONFIG_PPC_UDBG_16550=y
21CONFIG_GENERIC_TBSYNC=y
22# CONFIG_DEFAULT_UIMAGE is not set
23
24#
25# Processor support
26#
27# CONFIG_CLASSIC32 is not set
28# CONFIG_PPC_52xx is not set
29# CONFIG_PPC_82xx is not set
30# CONFIG_PPC_83xx is not set
31# CONFIG_PPC_85xx is not set
32CONFIG_PPC_86xx=y
33# CONFIG_40x is not set
34# CONFIG_44x is not set
35# CONFIG_8xx is not set
36# CONFIG_E200 is not set
37CONFIG_6xx=y
38CONFIG_PPC_FPU=y
39CONFIG_ALTIVEC=y
40CONFIG_PPC_STD_MMU=y
41CONFIG_PPC_STD_MMU_32=y
42CONFIG_SMP=y
43CONFIG_NR_CPUS=2
44
45#
46# Code maturity level options
47#
48CONFIG_EXPERIMENTAL=y
49CONFIG_LOCK_KERNEL=y
50CONFIG_INIT_ENV_ARG_LIMIT=32
51
52#
53# General setup
54#
55CONFIG_LOCALVERSION=""
56# CONFIG_LOCALVERSION_AUTO is not set
57# CONFIG_SWAP is not set
58# CONFIG_SYSVIPC is not set
59# CONFIG_POSIX_MQUEUE is not set
60# CONFIG_BSD_PROCESS_ACCT is not set
61CONFIG_SYSCTL=y
62# CONFIG_AUDIT is not set
63CONFIG_IKCONFIG=y
64CONFIG_IKCONFIG_PROC=y
65# CONFIG_CPUSETS is not set
66# CONFIG_RELAY is not set
67CONFIG_INITRAMFS_SOURCE=""
68# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
69CONFIG_EMBEDDED=y
70CONFIG_KALLSYMS=y
71# CONFIG_KALLSYMS_ALL is not set
72CONFIG_KALLSYMS_EXTRA_PASS=y
73CONFIG_HOTPLUG=y
74CONFIG_PRINTK=y
75CONFIG_BUG=y
76# CONFIG_ELF_CORE is not set
77CONFIG_BASE_FULL=y
78CONFIG_FUTEX=y
79CONFIG_EPOLL=y
80CONFIG_SHMEM=y
81# CONFIG_SLAB is not set
82# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0
84CONFIG_SLOB=y
85
86#
87# Loadable module support
88#
89# CONFIG_MODULES is not set
90
91#
92# Block layer
93#
94# CONFIG_LBD is not set
95# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set
97
98#
99# IO Schedulers
100#
101CONFIG_IOSCHED_NOOP=y
102# CONFIG_IOSCHED_AS is not set
103CONFIG_IOSCHED_DEADLINE=y
104# CONFIG_IOSCHED_CFQ is not set
105# CONFIG_DEFAULT_AS is not set
106CONFIG_DEFAULT_DEADLINE=y
107# CONFIG_DEFAULT_CFQ is not set
108# CONFIG_DEFAULT_NOOP is not set
109CONFIG_DEFAULT_IOSCHED="deadline"
110CONFIG_MPIC=y
111# CONFIG_WANT_EARLY_SERIAL is not set
112CONFIG_PPC_INDIRECT_PCI_BE=y
113
114#
115# Platform Support
116#
117CONFIG_MPC8641_HPCN=y
118CONFIG_MPC8641=y
119
120#
121# Kernel options
122#
123CONFIG_HIGHMEM=y
124# CONFIG_HZ_100 is not set
125# CONFIG_HZ_250 is not set
126CONFIG_HZ_1000=y
127CONFIG_HZ=1000
128CONFIG_PREEMPT_NONE=y
129# CONFIG_PREEMPT_VOLUNTARY is not set
130# CONFIG_PREEMPT is not set
131CONFIG_PREEMPT_BKL=y
132CONFIG_BINFMT_ELF=y
133# CONFIG_BINFMT_MISC is not set
134# CONFIG_IRQ_ALL_CPUS is not set
135CONFIG_ARCH_FLATMEM_ENABLE=y
136CONFIG_SELECT_MEMORY_MODEL=y
137CONFIG_FLATMEM_MANUAL=y
138# CONFIG_DISCONTIGMEM_MANUAL is not set
139# CONFIG_SPARSEMEM_MANUAL is not set
140CONFIG_FLATMEM=y
141CONFIG_FLAT_NODE_MEM_MAP=y
142# CONFIG_SPARSEMEM_STATIC is not set
143CONFIG_SPLIT_PTLOCK_CPUS=4
144CONFIG_PROC_DEVICETREE=y
145# CONFIG_CMDLINE_BOOL is not set
146# CONFIG_PM is not set
147# CONFIG_SECCOMP is not set
148CONFIG_ISA_DMA_API=y
149
150#
151# Bus options
152#
153CONFIG_GENERIC_ISA_DMA=y
154CONFIG_PPC_I8259=y
155CONFIG_PPC_INDIRECT_PCI=y
156CONFIG_FSL_SOC=y
157CONFIG_PCI=y
158CONFIG_PCI_DOMAINS=y
159# CONFIG_PCI_DEBUG is not set
160
161#
162# PCCARD (PCMCIA/CardBus) support
163#
164# CONFIG_PCCARD is not set
165
166#
167# PCI Hotplug Support
168#
169# CONFIG_HOTPLUG_PCI is not set
170
171#
172# Advanced setup
173#
174# CONFIG_ADVANCED_OPTIONS is not set
175
176#
177# Default settings for advanced configuration options are used
178#
179CONFIG_HIGHMEM_START=0xfe000000
180CONFIG_LOWMEM_SIZE=0x30000000
181CONFIG_KERNEL_START=0xc0000000
182CONFIG_TASK_SIZE=0x80000000
183CONFIG_BOOT_LOAD=0x00800000
184
185#
186# Networking
187#
188CONFIG_NET=y
189
190#
191# Networking options
192#
193# CONFIG_NETDEBUG is not set
194CONFIG_PACKET=y
195# CONFIG_PACKET_MMAP is not set
196CONFIG_UNIX=y
197# CONFIG_NET_KEY is not set
198CONFIG_INET=y
199# CONFIG_IP_MULTICAST is not set
200# CONFIG_IP_ADVANCED_ROUTER is not set
201CONFIG_IP_FIB_HASH=y
202CONFIG_IP_PNP=y
203CONFIG_IP_PNP_DHCP=y
204CONFIG_IP_PNP_BOOTP=y
205CONFIG_IP_PNP_RARP=y
206# CONFIG_NET_IPIP is not set
207# CONFIG_NET_IPGRE is not set
208# CONFIG_ARPD is not set
209# CONFIG_SYN_COOKIES is not set
210# CONFIG_INET_AH is not set
211# CONFIG_INET_ESP is not set
212# CONFIG_INET_IPCOMP is not set
213# CONFIG_INET_XFRM_TUNNEL is not set
214# CONFIG_INET_TUNNEL is not set
215CONFIG_INET_DIAG=y
216CONFIG_INET_TCP_DIAG=y
217# CONFIG_TCP_CONG_ADVANCED is not set
218CONFIG_TCP_CONG_BIC=y
219CONFIG_IPV6=y
220# CONFIG_IPV6_PRIVACY is not set
221# CONFIG_IPV6_ROUTER_PREF is not set
222# CONFIG_INET6_AH is not set
223# CONFIG_INET6_ESP is not set
224# CONFIG_INET6_IPCOMP is not set
225# CONFIG_INET6_XFRM_TUNNEL is not set
226# CONFIG_INET6_TUNNEL is not set
227# CONFIG_IPV6_TUNNEL is not set
228# CONFIG_NETFILTER is not set
229
230#
231# DCCP Configuration (EXPERIMENTAL)
232#
233# CONFIG_IP_DCCP is not set
234
235#
236# SCTP Configuration (EXPERIMENTAL)
237#
238# CONFIG_IP_SCTP is not set
239
240#
241# TIPC Configuration (EXPERIMENTAL)
242#
243# CONFIG_TIPC is not set
244# CONFIG_ATM is not set
245# CONFIG_BRIDGE is not set
246# CONFIG_VLAN_8021Q is not set
247# CONFIG_DECNET is not set
248# CONFIG_LLC2 is not set
249# CONFIG_IPX is not set
250# CONFIG_ATALK is not set
251# CONFIG_X25 is not set
252# CONFIG_LAPB is not set
253# CONFIG_NET_DIVERT is not set
254# CONFIG_ECONET is not set
255# CONFIG_WAN_ROUTER is not set
256
257#
258# QoS and/or fair queueing
259#
260# CONFIG_NET_SCHED is not set
261
262#
263# Network testing
264#
265# CONFIG_NET_PKTGEN is not set
266# CONFIG_HAMRADIO is not set
267# CONFIG_IRDA is not set
268# CONFIG_BT is not set
269# CONFIG_IEEE80211 is not set
270
271#
272# Device Drivers
273#
274
275#
276# Generic Driver Options
277#
278CONFIG_STANDALONE=y
279CONFIG_PREVENT_FIRMWARE_BUILD=y
280CONFIG_FW_LOADER=y
281# CONFIG_DEBUG_DRIVER is not set
282
283#
284# Connector - unified userspace <-> kernelspace linker
285#
286# CONFIG_CONNECTOR is not set
287
288#
289# Memory Technology Devices (MTD)
290#
291# CONFIG_MTD is not set
292
293#
294# Parallel port support
295#
296# CONFIG_PARPORT is not set
297
298#
299# Plug and Play support
300#
301
302#
303# Block devices
304#
305# CONFIG_BLK_DEV_FD is not set
306# CONFIG_BLK_CPQ_DA is not set
307# CONFIG_BLK_CPQ_CISS_DA is not set
308# CONFIG_BLK_DEV_DAC960 is not set
309# CONFIG_BLK_DEV_UMEM is not set
310# CONFIG_BLK_DEV_COW_COMMON is not set
311CONFIG_BLK_DEV_LOOP=y
312# CONFIG_BLK_DEV_CRYPTOLOOP is not set
313# CONFIG_BLK_DEV_NBD is not set
314# CONFIG_BLK_DEV_SX8 is not set
315CONFIG_BLK_DEV_RAM=y
316CONFIG_BLK_DEV_RAM_COUNT=16
317CONFIG_BLK_DEV_RAM_SIZE=131072
318CONFIG_BLK_DEV_INITRD=y
319# CONFIG_CDROM_PKTCDVD is not set
320# CONFIG_ATA_OVER_ETH is not set
321
322#
323# ATA/ATAPI/MFM/RLL support
324#
325# CONFIG_IDE 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# CONFIG_IEEE1394 is not set
347
348#
349# I2O device support
350#
351# CONFIG_I2O is not set
352
353#
354# Macintosh device drivers
355#
356# CONFIG_WINDFARM is not set
357
358#
359# Network device support
360#
361CONFIG_NETDEVICES=y
362CONFIG_DUMMY=y
363# CONFIG_BONDING is not set
364# CONFIG_EQUALIZER is not set
365# CONFIG_TUN is not set
366
367#
368# ARCnet devices
369#
370# CONFIG_ARCNET is not set
371
372#
373# PHY device support
374#
375CONFIG_PHYLIB=y
376
377#
378# MII PHY device drivers
379#
380# CONFIG_MARVELL_PHY is not set
381# CONFIG_DAVICOM_PHY is not set
382# CONFIG_QSEMI_PHY is not set
383# CONFIG_LXT_PHY is not set
384# CONFIG_CICADA_PHY is not set
385CONFIG_VITESSE_PHY=y
386
387#
388# Ethernet (10 or 100Mbit)
389#
390CONFIG_NET_ETHERNET=y
391CONFIG_MII=y
392# CONFIG_HAPPYMEAL is not set
393# CONFIG_SUNGEM is not set
394# CONFIG_CASSINI is not set
395# CONFIG_NET_VENDOR_3COM is not set
396
397#
398# Tulip family network device support
399#
400# CONFIG_NET_TULIP is not set
401# CONFIG_HP100 is not set
402# CONFIG_NET_PCI is not set
403
404#
405# Ethernet (1000 Mbit)
406#
407# CONFIG_ACENIC is not set
408# CONFIG_DL2K is not set
409# CONFIG_E1000 is not set
410# CONFIG_NS83820 is not set
411# CONFIG_HAMACHI is not set
412# CONFIG_YELLOWFIN is not set
413# CONFIG_R8169 is not set
414# CONFIG_SIS190 is not set
415# CONFIG_SKGE is not set
416# CONFIG_SKY2 is not set
417# CONFIG_SK98LIN is not set
418# CONFIG_TIGON3 is not set
419# CONFIG_BNX2 is not set
420CONFIG_GIANFAR=y
421# CONFIG_GFAR_NAPI is not set
422
423#
424# Ethernet (10000 Mbit)
425#
426# CONFIG_CHELSIO_T1 is not set
427# CONFIG_IXGB is not set
428# CONFIG_S2IO is not set
429
430#
431# Token Ring devices
432#
433# CONFIG_TR is not set
434
435#
436# Wireless LAN (non-hamradio)
437#
438# CONFIG_NET_RADIO is not set
439
440#
441# Wan interfaces
442#
443# CONFIG_WAN is not set
444# CONFIG_FDDI is not set
445# CONFIG_HIPPI is not set
446# CONFIG_PPP is not set
447# CONFIG_SLIP is not set
448# CONFIG_SHAPER is not set
449# CONFIG_NETCONSOLE is not set
450# CONFIG_NETPOLL is not set
451# CONFIG_NET_POLL_CONTROLLER is not set
452
453#
454# ISDN subsystem
455#
456# CONFIG_ISDN is not set
457
458#
459# Telephony Support
460#
461# CONFIG_PHONE is not set
462
463#
464# Input device support
465#
466CONFIG_INPUT=y
467
468#
469# Userland interfaces
470#
471# CONFIG_INPUT_MOUSEDEV is not set
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#
480# CONFIG_INPUT_KEYBOARD is not set
481# CONFIG_INPUT_MOUSE is not set
482# CONFIG_INPUT_JOYSTICK is not set
483# CONFIG_INPUT_TOUCHSCREEN is not set
484# CONFIG_INPUT_MISC is not set
485
486#
487# Hardware I/O ports
488#
489CONFIG_SERIO=y
490CONFIG_SERIO_I8042=y
491CONFIG_SERIO_SERPORT=y
492# CONFIG_SERIO_PCIPS2 is not set
493CONFIG_SERIO_LIBPS2=y
494# CONFIG_SERIO_RAW is not set
495# CONFIG_GAMEPORT is not set
496
497#
498# Character devices
499#
500CONFIG_VT=y
501CONFIG_VT_CONSOLE=y
502CONFIG_HW_CONSOLE=y
503# CONFIG_SERIAL_NONSTANDARD is not set
504
505#
506# Serial drivers
507#
508CONFIG_SERIAL_8250=y
509CONFIG_SERIAL_8250_CONSOLE=y
510CONFIG_SERIAL_8250_PCI=y
511CONFIG_SERIAL_8250_NR_UARTS=2
512CONFIG_SERIAL_8250_RUNTIME_UARTS=2
513CONFIG_SERIAL_8250_EXTENDED=y
514CONFIG_SERIAL_8250_MANY_PORTS=y
515CONFIG_SERIAL_8250_SHARE_IRQ=y
516CONFIG_SERIAL_8250_DETECT_IRQ=y
517CONFIG_SERIAL_8250_RSA=y
518
519#
520# Non-8250 serial port support
521#
522CONFIG_SERIAL_CORE=y
523CONFIG_SERIAL_CORE_CONSOLE=y
524# CONFIG_SERIAL_JSM is not set
525CONFIG_UNIX98_PTYS=y
526# CONFIG_LEGACY_PTYS is not set
527
528#
529# IPMI
530#
531# CONFIG_IPMI_HANDLER is not set
532
533#
534# Watchdog Cards
535#
536# CONFIG_WATCHDOG is not set
537# CONFIG_NVRAM is not set
538# CONFIG_GEN_RTC is not set
539# CONFIG_DTLK is not set
540# CONFIG_R3964 is not set
541# CONFIG_APPLICOM is not set
542
543#
544# Ftape, the floppy tape device driver
545#
546# CONFIG_AGP is not set
547# CONFIG_DRM is not set
548# CONFIG_RAW_DRIVER is not set
549
550#
551# TPM devices
552#
553# CONFIG_TCG_TPM is not set
554# CONFIG_TELCLOCK is not set
555
556#
557# I2C support
558#
559CONFIG_I2C=y
560# CONFIG_I2C_CHARDEV is not set
561
562#
563# I2C Algorithms
564#
565# CONFIG_I2C_ALGOBIT is not set
566# CONFIG_I2C_ALGOPCF is not set
567# CONFIG_I2C_ALGOPCA is not set
568
569#
570# I2C Hardware Bus support
571#
572# CONFIG_I2C_ALI1535 is not set
573# CONFIG_I2C_ALI1563 is not set
574# CONFIG_I2C_ALI15X3 is not set
575# CONFIG_I2C_AMD756 is not set
576# CONFIG_I2C_AMD8111 is not set
577# CONFIG_I2C_I801 is not set
578# CONFIG_I2C_I810 is not set
579# CONFIG_I2C_PIIX4 is not set
580CONFIG_I2C_MPC=y
581# CONFIG_I2C_NFORCE2 is not set
582# CONFIG_I2C_PARPORT_LIGHT is not set
583# CONFIG_I2C_PROSAVAGE is not set
584# CONFIG_I2C_SAVAGE4 is not set
585# CONFIG_I2C_SIS5595 is not set
586# CONFIG_I2C_SIS630 is not set
587# CONFIG_I2C_SIS96X is not set
588# CONFIG_I2C_VIA is not set
589# CONFIG_I2C_VIAPRO is not set
590# CONFIG_I2C_VOODOO3 is not set
591# CONFIG_I2C_PCA_ISA is not set
592
593#
594# Miscellaneous I2C Chip support
595#
596# CONFIG_SENSORS_DS1337 is not set
597# CONFIG_SENSORS_DS1374 is not set
598CONFIG_SENSORS_EEPROM=y
599# CONFIG_SENSORS_PCF8574 is not set
600# CONFIG_SENSORS_PCA9539 is not set
601# CONFIG_SENSORS_PCF8591 is not set
602# CONFIG_SENSORS_M41T00 is not set
603# CONFIG_SENSORS_MAX6875 is not set
604# CONFIG_I2C_DEBUG_CORE is not set
605# CONFIG_I2C_DEBUG_ALGO is not set
606# CONFIG_I2C_DEBUG_BUS is not set
607# CONFIG_I2C_DEBUG_CHIP is not set
608
609#
610# SPI support
611#
612# CONFIG_SPI is not set
613# CONFIG_SPI_MASTER is not set
614
615#
616# Dallas's 1-wire bus
617#
618# CONFIG_W1 is not set
619
620#
621# Hardware Monitoring support
622#
623# CONFIG_HWMON is not set
624# CONFIG_HWMON_VID is not set
625
626#
627# Misc devices
628#
629
630#
631# Multimedia devices
632#
633# CONFIG_VIDEO_DEV is not set
634
635#
636# Digital Video Broadcasting Devices
637#
638# CONFIG_DVB is not set
639
640#
641# Graphics support
642#
643# CONFIG_FB is not set
644
645#
646# Console display driver support
647#
648CONFIG_VGA_CONSOLE=y
649# CONFIG_VGACON_SOFT_SCROLLBACK is not set
650CONFIG_DUMMY_CONSOLE=y
651
652#
653# Sound
654#
655# CONFIG_SOUND is not set
656
657#
658# USB support
659#
660CONFIG_USB_ARCH_HAS_HCD=y
661CONFIG_USB_ARCH_HAS_OHCI=y
662CONFIG_USB_ARCH_HAS_EHCI=y
663# CONFIG_USB is not set
664
665#
666# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
667#
668
669#
670# USB Gadget Support
671#
672# CONFIG_USB_GADGET is not set
673
674#
675# MMC/SD Card support
676#
677# CONFIG_MMC is not set
678
679#
680# LED devices
681#
682# CONFIG_NEW_LEDS is not set
683
684#
685# LED drivers
686#
687
688#
689# LED Triggers
690#
691
692#
693# InfiniBand support
694#
695# CONFIG_INFINIBAND is not set
696
697#
698# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
699#
700
701#
702# Real Time Clock
703#
704# CONFIG_RTC_CLASS is not set
705
706#
707# File systems
708#
709CONFIG_EXT2_FS=y
710# CONFIG_EXT2_FS_XATTR is not set
711# CONFIG_EXT2_FS_XIP is not set
712CONFIG_EXT3_FS=y
713CONFIG_EXT3_FS_XATTR=y
714# CONFIG_EXT3_FS_POSIX_ACL is not set
715# CONFIG_EXT3_FS_SECURITY is not set
716CONFIG_JBD=y
717# CONFIG_JBD_DEBUG is not set
718CONFIG_FS_MBCACHE=y
719# CONFIG_REISERFS_FS is not set
720# CONFIG_JFS_FS is not set
721# CONFIG_FS_POSIX_ACL is not set
722# CONFIG_XFS_FS is not set
723# CONFIG_OCFS2_FS is not set
724# CONFIG_MINIX_FS is not set
725# CONFIG_ROMFS_FS is not set
726# CONFIG_INOTIFY is not set
727# CONFIG_QUOTA is not set
728# CONFIG_DNOTIFY is not set
729# CONFIG_AUTOFS_FS is not set
730# CONFIG_AUTOFS4_FS is not set
731# CONFIG_FUSE_FS is not set
732
733#
734# CD-ROM/DVD Filesystems
735#
736# CONFIG_ISO9660_FS is not set
737# CONFIG_UDF_FS is not set
738
739#
740# DOS/FAT/NT Filesystems
741#
742# CONFIG_MSDOS_FS is not set
743# CONFIG_VFAT_FS is not set
744# CONFIG_NTFS_FS is not set
745
746#
747# Pseudo filesystems
748#
749CONFIG_PROC_FS=y
750CONFIG_PROC_KCORE=y
751CONFIG_SYSFS=y
752CONFIG_TMPFS=y
753# CONFIG_HUGETLB_PAGE is not set
754CONFIG_RAMFS=y
755# CONFIG_CONFIGFS_FS is not set
756
757#
758# Miscellaneous filesystems
759#
760# CONFIG_ADFS_FS is not set
761# CONFIG_AFFS_FS is not set
762# CONFIG_HFS_FS is not set
763# CONFIG_HFSPLUS_FS is not set
764# CONFIG_BEFS_FS is not set
765# CONFIG_BFS_FS is not set
766# CONFIG_EFS_FS is not set
767# CONFIG_CRAMFS is not set
768# CONFIG_VXFS_FS is not set
769# CONFIG_HPFS_FS is not set
770# CONFIG_QNX4FS_FS is not set
771# CONFIG_SYSV_FS is not set
772# CONFIG_UFS_FS is not set
773
774#
775# Network File Systems
776#
777CONFIG_NFS_FS=y
778CONFIG_NFS_V3=y
779# CONFIG_NFS_V3_ACL is not set
780# CONFIG_NFS_V4 is not set
781# CONFIG_NFS_DIRECTIO is not set
782CONFIG_NFSD=y
783# CONFIG_NFSD_V3 is not set
784CONFIG_NFSD_TCP=y
785CONFIG_ROOT_NFS=y
786CONFIG_LOCKD=y
787CONFIG_LOCKD_V4=y
788CONFIG_EXPORTFS=y
789CONFIG_NFS_COMMON=y
790CONFIG_SUNRPC=y
791# CONFIG_RPCSEC_GSS_KRB5 is not set
792# CONFIG_RPCSEC_GSS_SPKM3 is not set
793# CONFIG_SMB_FS is not set
794# CONFIG_CIFS is not set
795# CONFIG_NCP_FS is not set
796# CONFIG_CODA_FS is not set
797# CONFIG_AFS_FS is not set
798# CONFIG_9P_FS is not set
799
800#
801# Partition Types
802#
803CONFIG_PARTITION_ADVANCED=y
804# CONFIG_ACORN_PARTITION is not set
805# CONFIG_OSF_PARTITION is not set
806# CONFIG_AMIGA_PARTITION is not set
807# CONFIG_ATARI_PARTITION is not set
808# CONFIG_MAC_PARTITION is not set
809CONFIG_MSDOS_PARTITION=y
810# CONFIG_BSD_DISKLABEL is not set
811# CONFIG_MINIX_SUBPARTITION is not set
812# CONFIG_SOLARIS_X86_PARTITION is not set
813# CONFIG_UNIXWARE_DISKLABEL is not set
814CONFIG_LDM_PARTITION=y
815# CONFIG_LDM_DEBUG is not set
816# CONFIG_SGI_PARTITION is not set
817# CONFIG_ULTRIX_PARTITION is not set
818# CONFIG_SUN_PARTITION is not set
819# CONFIG_KARMA_PARTITION is not set
820# CONFIG_EFI_PARTITION is not set
821
822#
823# Native Language Support
824#
825CONFIG_NLS=y
826CONFIG_NLS_DEFAULT="iso8859-1"
827# CONFIG_NLS_CODEPAGE_437 is not set
828# CONFIG_NLS_CODEPAGE_737 is not set
829# CONFIG_NLS_CODEPAGE_775 is not set
830# CONFIG_NLS_CODEPAGE_850 is not set
831# CONFIG_NLS_CODEPAGE_852 is not set
832# CONFIG_NLS_CODEPAGE_855 is not set
833# CONFIG_NLS_CODEPAGE_857 is not set
834# CONFIG_NLS_CODEPAGE_860 is not set
835# CONFIG_NLS_CODEPAGE_861 is not set
836# CONFIG_NLS_CODEPAGE_862 is not set
837# CONFIG_NLS_CODEPAGE_863 is not set
838# CONFIG_NLS_CODEPAGE_864 is not set
839# CONFIG_NLS_CODEPAGE_865 is not set
840# CONFIG_NLS_CODEPAGE_866 is not set
841# CONFIG_NLS_CODEPAGE_869 is not set
842# CONFIG_NLS_CODEPAGE_936 is not set
843# CONFIG_NLS_CODEPAGE_950 is not set
844# CONFIG_NLS_CODEPAGE_932 is not set
845# CONFIG_NLS_CODEPAGE_949 is not set
846# CONFIG_NLS_CODEPAGE_874 is not set
847# CONFIG_NLS_ISO8859_8 is not set
848# CONFIG_NLS_CODEPAGE_1250 is not set
849# CONFIG_NLS_CODEPAGE_1251 is not set
850# CONFIG_NLS_ASCII is not set
851# CONFIG_NLS_ISO8859_1 is not set
852# CONFIG_NLS_ISO8859_2 is not set
853# CONFIG_NLS_ISO8859_3 is not set
854# CONFIG_NLS_ISO8859_4 is not set
855# CONFIG_NLS_ISO8859_5 is not set
856# CONFIG_NLS_ISO8859_6 is not set
857# CONFIG_NLS_ISO8859_7 is not set
858# CONFIG_NLS_ISO8859_9 is not set
859# CONFIG_NLS_ISO8859_13 is not set
860# CONFIG_NLS_ISO8859_14 is not set
861# CONFIG_NLS_ISO8859_15 is not set
862# CONFIG_NLS_KOI8_R is not set
863# CONFIG_NLS_KOI8_U is not set
864# CONFIG_NLS_UTF8 is not set
865
866#
867# Library routines
868#
869# CONFIG_CRC_CCITT is not set
870# CONFIG_CRC16 is not set
871CONFIG_CRC32=y
872# CONFIG_LIBCRC32C is not set
873
874#
875# Instrumentation Support
876#
877# CONFIG_PROFILING is not set
878
879#
880# Kernel hacking
881#
882# CONFIG_PRINTK_TIME is not set
883# CONFIG_MAGIC_SYSRQ is not set
884CONFIG_DEBUG_KERNEL=y
885CONFIG_LOG_BUF_SHIFT=14
886CONFIG_DETECT_SOFTLOCKUP=y
887# CONFIG_SCHEDSTATS is not set
888# CONFIG_DEBUG_MUTEXES is not set
889# CONFIG_DEBUG_SPINLOCK is not set
890# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
891# CONFIG_DEBUG_KOBJECT is not set
892# CONFIG_DEBUG_HIGHMEM is not set
893# CONFIG_DEBUG_INFO is not set
894# CONFIG_DEBUG_FS is not set
895# CONFIG_DEBUG_VM is not set
896# CONFIG_UNWIND_INFO is not set
897CONFIG_FORCED_INLINING=y
898# CONFIG_RCU_TORTURE_TEST is not set
899# CONFIG_DEBUGGER is not set
900# CONFIG_BDI_SWITCH is not set
901# CONFIG_BOOTX_TEXT is not set
902# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
903# CONFIG_PPC_EARLY_DEBUG_G5 is not set
904# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
905# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
906# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
907
908#
909# Security options
910#
911# CONFIG_KEYS is not set
912# CONFIG_SECURITY is not set
913
914#
915# Cryptographic options
916#
917# CONFIG_CRYPTO is not set
918
919#
920# Hardware crypto devices
921#
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
index 57a027971d67..addc79381c3b 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_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.16-rc6 3# Linux kernel version: 2.6.17-rc5
4# Wed Mar 15 16:21:32 2006 4# Mon May 29 14:47:49 2006
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y 7CONFIG_PPC32=y
@@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y
9CONFIG_MMU=y 9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y 10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y 11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_PPC=y 14CONFIG_PPC=y
14CONFIG_EARLY_PRINTK=y 15CONFIG_EARLY_PRINTK=y
@@ -27,11 +28,11 @@ CONFIG_CLASSIC32=y
27# CONFIG_PPC_52xx is not set 28# CONFIG_PPC_52xx is not set
28# CONFIG_PPC_82xx is not set 29# CONFIG_PPC_82xx is not set
29# CONFIG_PPC_83xx is not set 30# CONFIG_PPC_83xx is not set
31# CONFIG_PPC_85xx is not set
30# CONFIG_40x is not set 32# CONFIG_40x is not set
31# CONFIG_44x is not set 33# CONFIG_44x is not set
32# CONFIG_8xx is not set 34# CONFIG_8xx is not set
33# CONFIG_E200 is not set 35# CONFIG_E200 is not set
34# CONFIG_E500 is not set
35CONFIG_6xx=y 36CONFIG_6xx=y
36CONFIG_PPC_FPU=y 37CONFIG_PPC_FPU=y
37CONFIG_ALTIVEC=y 38CONFIG_ALTIVEC=y
@@ -59,6 +60,7 @@ CONFIG_SYSCTL=y
59# CONFIG_AUDIT is not set 60# CONFIG_AUDIT is not set
60CONFIG_IKCONFIG=y 61CONFIG_IKCONFIG=y
61CONFIG_IKCONFIG_PROC=y 62CONFIG_IKCONFIG_PROC=y
63# CONFIG_RELAY is not set
62CONFIG_INITRAMFS_SOURCE="" 64CONFIG_INITRAMFS_SOURCE=""
63# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 65# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
64# CONFIG_EMBEDDED is not set 66# CONFIG_EMBEDDED is not set
@@ -73,10 +75,6 @@ CONFIG_BASE_FULL=y
73CONFIG_FUTEX=y 75CONFIG_FUTEX=y
74CONFIG_EPOLL=y 76CONFIG_EPOLL=y
75CONFIG_SHMEM=y 77CONFIG_SHMEM=y
76CONFIG_CC_ALIGN_FUNCTIONS=0
77CONFIG_CC_ALIGN_LABELS=0
78CONFIG_CC_ALIGN_LOOPS=0
79CONFIG_CC_ALIGN_JUMPS=0
80CONFIG_SLAB=y 78CONFIG_SLAB=y
81# CONFIG_TINY_SHMEM is not set 79# CONFIG_TINY_SHMEM is not set
82CONFIG_BASE_SMALL=0 80CONFIG_BASE_SMALL=0
@@ -88,7 +86,6 @@ CONFIG_BASE_SMALL=0
88CONFIG_MODULES=y 86CONFIG_MODULES=y
89CONFIG_MODULE_UNLOAD=y 87CONFIG_MODULE_UNLOAD=y
90CONFIG_MODULE_FORCE_UNLOAD=y 88CONFIG_MODULE_FORCE_UNLOAD=y
91CONFIG_OBSOLETE_MODPARM=y
92# CONFIG_MODVERSIONS is not set 89# CONFIG_MODVERSIONS is not set
93# CONFIG_MODULE_SRCVERSION_ALL is not set 90# CONFIG_MODULE_SRCVERSION_ALL is not set
94CONFIG_KMOD=y 91CONFIG_KMOD=y
@@ -97,6 +94,8 @@ CONFIG_KMOD=y
97# Block layer 94# Block layer
98# 95#
99CONFIG_LBD=y 96CONFIG_LBD=y
97# CONFIG_BLK_DEV_IO_TRACE is not set
98CONFIG_LSF=y
100 99
101# 100#
102# IO Schedulers 101# IO Schedulers
@@ -124,6 +123,7 @@ CONFIG_MPIC=y
124# CONFIG_PPC_RTAS is not set 123# CONFIG_PPC_RTAS is not set
125# CONFIG_MMIO_NVRAM is not set 124# CONFIG_MMIO_NVRAM is not set
126CONFIG_PPC_MPC106=y 125CONFIG_PPC_MPC106=y
126# CONFIG_PPC_970_NAP is not set
127CONFIG_CPU_FREQ=y 127CONFIG_CPU_FREQ=y
128CONFIG_CPU_FREQ_TABLE=y 128CONFIG_CPU_FREQ_TABLE=y
129# CONFIG_CPU_FREQ_DEBUG is not set 129# CONFIG_CPU_FREQ_DEBUG is not set
@@ -182,7 +182,6 @@ CONFIG_GENERIC_ISA_DMA=y
182CONFIG_PPC_INDIRECT_PCI=y 182CONFIG_PPC_INDIRECT_PCI=y
183CONFIG_PCI=y 183CONFIG_PCI=y
184CONFIG_PCI_DOMAINS=y 184CONFIG_PCI_DOMAINS=y
185CONFIG_PCI_LEGACY_PROC=y
186# CONFIG_PCI_DEBUG is not set 185# CONFIG_PCI_DEBUG is not set
187 186
188# 187#
@@ -239,7 +238,9 @@ CONFIG_NET=y
239CONFIG_PACKET=y 238CONFIG_PACKET=y
240# CONFIG_PACKET_MMAP is not set 239# CONFIG_PACKET_MMAP is not set
241CONFIG_UNIX=y 240CONFIG_UNIX=y
242# CONFIG_NET_KEY is not set 241CONFIG_XFRM=y
242CONFIG_XFRM_USER=y
243CONFIG_NET_KEY=y
243CONFIG_INET=y 244CONFIG_INET=y
244CONFIG_IP_MULTICAST=y 245CONFIG_IP_MULTICAST=y
245# CONFIG_IP_ADVANCED_ROUTER is not set 246# CONFIG_IP_ADVANCED_ROUTER is not set
@@ -250,9 +251,10 @@ CONFIG_IP_FIB_HASH=y
250# CONFIG_IP_MROUTE is not set 251# CONFIG_IP_MROUTE is not set
251# CONFIG_ARPD is not set 252# CONFIG_ARPD is not set
252CONFIG_SYN_COOKIES=y 253CONFIG_SYN_COOKIES=y
253# CONFIG_INET_AH is not set 254CONFIG_INET_AH=y
254# CONFIG_INET_ESP is not set 255CONFIG_INET_ESP=y
255# CONFIG_INET_IPCOMP is not set 256# CONFIG_INET_IPCOMP is not set
257# CONFIG_INET_XFRM_TUNNEL is not set
256# CONFIG_INET_TUNNEL is not set 258# CONFIG_INET_TUNNEL is not set
257CONFIG_INET_DIAG=y 259CONFIG_INET_DIAG=y
258CONFIG_INET_TCP_DIAG=y 260CONFIG_INET_TCP_DIAG=y
@@ -264,6 +266,8 @@ CONFIG_TCP_CONG_BIC=y
264# 266#
265# CONFIG_IP_VS is not set 267# CONFIG_IP_VS is not set
266# CONFIG_IPV6 is not set 268# CONFIG_IPV6 is not set
269# CONFIG_INET6_XFRM_TUNNEL is not set
270# CONFIG_INET6_TUNNEL is not set
267CONFIG_NETFILTER=y 271CONFIG_NETFILTER=y
268# CONFIG_NETFILTER_DEBUG is not set 272# CONFIG_NETFILTER_DEBUG is not set
269 273
@@ -278,12 +282,15 @@ CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
278CONFIG_NETFILTER_XT_TARGET_NOTRACK=m 282CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
279CONFIG_NETFILTER_XT_MATCH_COMMENT=m 283CONFIG_NETFILTER_XT_MATCH_COMMENT=m
280CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m 284CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
281# CONFIG_NETFILTER_XT_MATCH_DCCP is not set 285CONFIG_NETFILTER_XT_MATCH_DCCP=m
286CONFIG_NETFILTER_XT_MATCH_ESP=m
282CONFIG_NETFILTER_XT_MATCH_HELPER=m 287CONFIG_NETFILTER_XT_MATCH_HELPER=m
283CONFIG_NETFILTER_XT_MATCH_LENGTH=m 288CONFIG_NETFILTER_XT_MATCH_LENGTH=m
284CONFIG_NETFILTER_XT_MATCH_LIMIT=m 289CONFIG_NETFILTER_XT_MATCH_LIMIT=m
285CONFIG_NETFILTER_XT_MATCH_MAC=m 290CONFIG_NETFILTER_XT_MATCH_MAC=m
286CONFIG_NETFILTER_XT_MATCH_MARK=m 291CONFIG_NETFILTER_XT_MATCH_MARK=m
292CONFIG_NETFILTER_XT_MATCH_POLICY=m
293CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
287CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m 294CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
288CONFIG_NETFILTER_XT_MATCH_REALM=m 295CONFIG_NETFILTER_XT_MATCH_REALM=m
289CONFIG_NETFILTER_XT_MATCH_SCTP=m 296CONFIG_NETFILTER_XT_MATCH_SCTP=m
@@ -305,15 +312,15 @@ CONFIG_IP_NF_NETBIOS_NS=m
305CONFIG_IP_NF_TFTP=m 312CONFIG_IP_NF_TFTP=m
306CONFIG_IP_NF_AMANDA=m 313CONFIG_IP_NF_AMANDA=m
307CONFIG_IP_NF_PPTP=m 314CONFIG_IP_NF_PPTP=m
315CONFIG_IP_NF_H323=m
308# CONFIG_IP_NF_QUEUE is not set 316# CONFIG_IP_NF_QUEUE is not set
309CONFIG_IP_NF_IPTABLES=m 317CONFIG_IP_NF_IPTABLES=m
310CONFIG_IP_NF_MATCH_IPRANGE=m 318CONFIG_IP_NF_MATCH_IPRANGE=m
311CONFIG_IP_NF_MATCH_MULTIPORT=m
312CONFIG_IP_NF_MATCH_TOS=m 319CONFIG_IP_NF_MATCH_TOS=m
313CONFIG_IP_NF_MATCH_RECENT=m 320CONFIG_IP_NF_MATCH_RECENT=m
314CONFIG_IP_NF_MATCH_ECN=m 321CONFIG_IP_NF_MATCH_ECN=m
315CONFIG_IP_NF_MATCH_DSCP=m 322CONFIG_IP_NF_MATCH_DSCP=m
316CONFIG_IP_NF_MATCH_AH_ESP=m 323CONFIG_IP_NF_MATCH_AH=m
317CONFIG_IP_NF_MATCH_TTL=m 324CONFIG_IP_NF_MATCH_TTL=m
318CONFIG_IP_NF_MATCH_OWNER=m 325CONFIG_IP_NF_MATCH_OWNER=m
319CONFIG_IP_NF_MATCH_ADDRTYPE=m 326CONFIG_IP_NF_MATCH_ADDRTYPE=m
@@ -335,6 +342,7 @@ CONFIG_IP_NF_NAT_FTP=m
335CONFIG_IP_NF_NAT_TFTP=m 342CONFIG_IP_NF_NAT_TFTP=m
336CONFIG_IP_NF_NAT_AMANDA=m 343CONFIG_IP_NF_NAT_AMANDA=m
337CONFIG_IP_NF_NAT_PPTP=m 344CONFIG_IP_NF_NAT_PPTP=m
345CONFIG_IP_NF_NAT_H323=m
338CONFIG_IP_NF_MANGLE=m 346CONFIG_IP_NF_MANGLE=m
339CONFIG_IP_NF_TARGET_TOS=m 347CONFIG_IP_NF_TARGET_TOS=m
340CONFIG_IP_NF_TARGET_ECN=m 348CONFIG_IP_NF_TARGET_ECN=m
@@ -350,10 +358,12 @@ CONFIG_IP_NF_ARP_MANGLE=m
350# 358#
351CONFIG_IP_DCCP=m 359CONFIG_IP_DCCP=m
352CONFIG_INET_DCCP_DIAG=m 360CONFIG_INET_DCCP_DIAG=m
361CONFIG_IP_DCCP_ACKVEC=y
353 362
354# 363#
355# DCCP CCIDs Configuration (EXPERIMENTAL) 364# DCCP CCIDs Configuration (EXPERIMENTAL)
356# 365#
366CONFIG_IP_DCCP_CCID2=m
357CONFIG_IP_DCCP_CCID3=m 367CONFIG_IP_DCCP_CCID3=m
358CONFIG_IP_DCCP_TFRC_LIB=m 368CONFIG_IP_DCCP_TFRC_LIB=m
359 369
@@ -361,7 +371,6 @@ CONFIG_IP_DCCP_TFRC_LIB=m
361# DCCP Kernel Hacking 371# DCCP Kernel Hacking
362# 372#
363# CONFIG_IP_DCCP_DEBUG is not set 373# CONFIG_IP_DCCP_DEBUG is not set
364# CONFIG_IP_DCCP_UNLOAD_HACK is not set
365 374
366# 375#
367# SCTP Configuration (EXPERIMENTAL) 376# SCTP Configuration (EXPERIMENTAL)
@@ -477,6 +486,8 @@ CONFIG_IEEE80211=m
477CONFIG_IEEE80211_CRYPT_WEP=m 486CONFIG_IEEE80211_CRYPT_WEP=m
478CONFIG_IEEE80211_CRYPT_CCMP=m 487CONFIG_IEEE80211_CRYPT_CCMP=m
479CONFIG_IEEE80211_CRYPT_TKIP=m 488CONFIG_IEEE80211_CRYPT_TKIP=m
489# CONFIG_IEEE80211_SOFTMAC is not set
490CONFIG_WIRELESS_EXT=y
480 491
481# 492#
482# Device Drivers 493# Device Drivers
@@ -662,9 +673,8 @@ CONFIG_SCSI_SYM53C8XX_2=y
662CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 673CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
663CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 674CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
664CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 675CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
665# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 676CONFIG_SCSI_SYM53C8XX_MMIO=y
666# CONFIG_SCSI_IPR is not set 677# CONFIG_SCSI_IPR is not set
667# CONFIG_SCSI_QLOGIC_FC is not set
668# CONFIG_SCSI_QLOGIC_1280 is not set 678# CONFIG_SCSI_QLOGIC_1280 is not set
669# CONFIG_SCSI_QLA_FC is not set 679# CONFIG_SCSI_QLA_FC is not set
670# CONFIG_SCSI_LPFC is not set 680# CONFIG_SCSI_LPFC is not set
@@ -694,16 +704,17 @@ CONFIG_BLK_DEV_MD=m
694CONFIG_MD_LINEAR=m 704CONFIG_MD_LINEAR=m
695CONFIG_MD_RAID0=m 705CONFIG_MD_RAID0=m
696CONFIG_MD_RAID1=m 706CONFIG_MD_RAID1=m
697# CONFIG_MD_RAID10 is not set 707CONFIG_MD_RAID10=m
698CONFIG_MD_RAID5=m 708CONFIG_MD_RAID5=m
709CONFIG_MD_RAID5_RESHAPE=y
699CONFIG_MD_RAID6=m 710CONFIG_MD_RAID6=m
700CONFIG_MD_MULTIPATH=m 711CONFIG_MD_MULTIPATH=m
701CONFIG_MD_FAULTY=m 712CONFIG_MD_FAULTY=m
702CONFIG_BLK_DEV_DM=m 713CONFIG_BLK_DEV_DM=m
703CONFIG_DM_CRYPT=m 714CONFIG_DM_CRYPT=m
704# CONFIG_DM_SNAPSHOT is not set 715CONFIG_DM_SNAPSHOT=m
705# CONFIG_DM_MIRROR is not set 716CONFIG_DM_MIRROR=m
706# CONFIG_DM_ZERO is not set 717CONFIG_DM_ZERO=m
707# CONFIG_DM_MULTIPATH is not set 718# CONFIG_DM_MULTIPATH is not set
708 719
709# 720#
@@ -740,7 +751,7 @@ CONFIG_IEEE1394_OHCI1394=m
740CONFIG_IEEE1394_VIDEO1394=m 751CONFIG_IEEE1394_VIDEO1394=m
741CONFIG_IEEE1394_SBP2=m 752CONFIG_IEEE1394_SBP2=m
742# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set 753# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
743CONFIG_IEEE1394_ETH1394=m 754# CONFIG_IEEE1394_ETH1394 is not set
744CONFIG_IEEE1394_DV1394=m 755CONFIG_IEEE1394_DV1394=m
745CONFIG_IEEE1394_RAWIO=m 756CONFIG_IEEE1394_RAWIO=m
746 757
@@ -769,10 +780,10 @@ CONFIG_THERM_ADT746X=m
769# Network device support 780# Network device support
770# 781#
771CONFIG_NETDEVICES=y 782CONFIG_NETDEVICES=y
772# CONFIG_DUMMY is not set 783CONFIG_DUMMY=m
773# CONFIG_BONDING is not set 784# CONFIG_BONDING is not set
774# CONFIG_EQUALIZER is not set 785# CONFIG_EQUALIZER is not set
775# CONFIG_TUN is not set 786CONFIG_TUN=m
776 787
777# 788#
778# ARCnet devices 789# ARCnet devices
@@ -857,6 +868,7 @@ CONFIG_PCNET32=y
857# Wireless LAN (non-hamradio) 868# Wireless LAN (non-hamradio)
858# 869#
859CONFIG_NET_RADIO=y 870CONFIG_NET_RADIO=y
871# CONFIG_NET_WIRELESS_RTNETLINK is not set
860 872
861# 873#
862# Obsolete Wireless cards support (pre-802.11) 874# Obsolete Wireless cards support (pre-802.11)
@@ -992,6 +1004,7 @@ CONFIG_HW_CONSOLE=y
992# Serial drivers 1004# Serial drivers
993# 1005#
994CONFIG_SERIAL_8250=m 1006CONFIG_SERIAL_8250=m
1007CONFIG_SERIAL_8250_PCI=m
995# CONFIG_SERIAL_8250_CS is not set 1008# CONFIG_SERIAL_8250_CS is not set
996CONFIG_SERIAL_8250_NR_UARTS=4 1009CONFIG_SERIAL_8250_NR_UARTS=4
997CONFIG_SERIAL_8250_RUNTIME_UARTS=4 1010CONFIG_SERIAL_8250_RUNTIME_UARTS=4
@@ -1027,6 +1040,7 @@ CONFIG_GEN_RTC=y
1027# Ftape, the floppy tape device driver 1040# Ftape, the floppy tape device driver
1028# 1041#
1029CONFIG_AGP=m 1042CONFIG_AGP=m
1043# CONFIG_AGP_VIA is not set
1030CONFIG_AGP_UNINORTH=m 1044CONFIG_AGP_UNINORTH=m
1031CONFIG_DRM=m 1045CONFIG_DRM=m
1032# CONFIG_DRM_TDFX is not set 1046# CONFIG_DRM_TDFX is not set
@@ -1081,7 +1095,6 @@ CONFIG_I2C_POWERMAC=y
1081# CONFIG_I2C_PARPORT_LIGHT is not set 1095# CONFIG_I2C_PARPORT_LIGHT is not set
1082# CONFIG_I2C_PROSAVAGE is not set 1096# CONFIG_I2C_PROSAVAGE is not set
1083# CONFIG_I2C_SAVAGE4 is not set 1097# CONFIG_I2C_SAVAGE4 is not set
1084# CONFIG_SCx200_ACB is not set
1085# CONFIG_I2C_SIS5595 is not set 1098# CONFIG_I2C_SIS5595 is not set
1086# CONFIG_I2C_SIS630 is not set 1099# CONFIG_I2C_SIS630 is not set
1087# CONFIG_I2C_SIS96X is not set 1100# CONFIG_I2C_SIS96X is not set
@@ -1100,10 +1113,8 @@ CONFIG_I2C_POWERMAC=y
1100# CONFIG_SENSORS_PCF8574 is not set 1113# CONFIG_SENSORS_PCF8574 is not set
1101# CONFIG_SENSORS_PCA9539 is not set 1114# CONFIG_SENSORS_PCA9539 is not set
1102# CONFIG_SENSORS_PCF8591 is not set 1115# CONFIG_SENSORS_PCF8591 is not set
1103# CONFIG_SENSORS_RTC8564 is not set
1104# CONFIG_SENSORS_M41T00 is not set 1116# CONFIG_SENSORS_M41T00 is not set
1105# CONFIG_SENSORS_MAX6875 is not set 1117# CONFIG_SENSORS_MAX6875 is not set
1106# CONFIG_RTC_X1205_I2C is not set
1107# CONFIG_I2C_DEBUG_CORE is not set 1118# CONFIG_I2C_DEBUG_CORE is not set
1108# CONFIG_I2C_DEBUG_ALGO is not set 1119# CONFIG_I2C_DEBUG_ALGO is not set
1109# CONFIG_I2C_DEBUG_BUS is not set 1120# CONFIG_I2C_DEBUG_BUS is not set
@@ -1131,18 +1142,16 @@ CONFIG_I2C_POWERMAC=y
1131# 1142#
1132 1143
1133# 1144#
1134# Multimedia Capabilities Port drivers
1135#
1136
1137#
1138# Multimedia devices 1145# Multimedia devices
1139# 1146#
1140# CONFIG_VIDEO_DEV is not set 1147# CONFIG_VIDEO_DEV is not set
1148CONFIG_VIDEO_V4L2=y
1141 1149
1142# 1150#
1143# Digital Video Broadcasting Devices 1151# Digital Video Broadcasting Devices
1144# 1152#
1145# CONFIG_DVB is not set 1153# CONFIG_DVB is not set
1154# CONFIG_USB_DABUSB is not set
1146 1155
1147# 1156#
1148# Graphics support 1157# Graphics support
@@ -1152,6 +1161,7 @@ CONFIG_FB_CFB_FILLRECT=y
1152CONFIG_FB_CFB_COPYAREA=y 1161CONFIG_FB_CFB_COPYAREA=y
1153CONFIG_FB_CFB_IMAGEBLIT=y 1162CONFIG_FB_CFB_IMAGEBLIT=y
1154CONFIG_FB_MACMODES=y 1163CONFIG_FB_MACMODES=y
1164CONFIG_FB_FIRMWARE_EDID=y
1155CONFIG_FB_MODE_HELPERS=y 1165CONFIG_FB_MODE_HELPERS=y
1156CONFIG_FB_TILEBLITTING=y 1166CONFIG_FB_TILEBLITTING=y
1157# CONFIG_FB_CIRRUS is not set 1167# CONFIG_FB_CIRRUS is not set
@@ -1175,7 +1185,6 @@ CONFIG_FB_MATROX_MYSTIQUE=y
1175# CONFIG_FB_MATROX_G is not set 1185# CONFIG_FB_MATROX_G is not set
1176# CONFIG_FB_MATROX_I2C is not set 1186# CONFIG_FB_MATROX_I2C is not set
1177# CONFIG_FB_MATROX_MULTIHEAD is not set 1187# CONFIG_FB_MATROX_MULTIHEAD is not set
1178# CONFIG_FB_RADEON_OLD is not set
1179CONFIG_FB_RADEON=y 1188CONFIG_FB_RADEON=y
1180CONFIG_FB_RADEON_I2C=y 1189CONFIG_FB_RADEON_I2C=y
1181# CONFIG_FB_RADEON_DEBUG is not set 1190# CONFIG_FB_RADEON_DEBUG is not set
@@ -1234,9 +1243,11 @@ CONFIG_SND_SEQ_DUMMY=m
1234CONFIG_SND_OSSEMUL=y 1243CONFIG_SND_OSSEMUL=y
1235CONFIG_SND_MIXER_OSS=m 1244CONFIG_SND_MIXER_OSS=m
1236CONFIG_SND_PCM_OSS=m 1245CONFIG_SND_PCM_OSS=m
1246CONFIG_SND_PCM_OSS_PLUGINS=y
1237CONFIG_SND_SEQUENCER_OSS=y 1247CONFIG_SND_SEQUENCER_OSS=y
1238# CONFIG_SND_DYNAMIC_MINORS is not set 1248# CONFIG_SND_DYNAMIC_MINORS is not set
1239CONFIG_SND_SUPPORT_OLD_API=y 1249CONFIG_SND_SUPPORT_OLD_API=y
1250CONFIG_SND_VERBOSE_PROCFS=y
1240# CONFIG_SND_VERBOSE_PRINTK is not set 1251# CONFIG_SND_VERBOSE_PRINTK is not set
1241# CONFIG_SND_DEBUG is not set 1252# CONFIG_SND_DEBUG is not set
1242 1253
@@ -1253,6 +1264,7 @@ CONFIG_SND_DUMMY=m
1253# PCI devices 1264# PCI devices
1254# 1265#
1255# CONFIG_SND_AD1889 is not set 1266# CONFIG_SND_AD1889 is not set
1267# CONFIG_SND_ALS300 is not set
1256# CONFIG_SND_ALS4000 is not set 1268# CONFIG_SND_ALS4000 is not set
1257# CONFIG_SND_ALI5451 is not set 1269# CONFIG_SND_ALI5451 is not set
1258# CONFIG_SND_ATIIXP is not set 1270# CONFIG_SND_ATIIXP is not set
@@ -1285,6 +1297,7 @@ CONFIG_SND_DUMMY=m
1285# CONFIG_SND_MIXART is not set 1297# CONFIG_SND_MIXART is not set
1286# CONFIG_SND_NM256 is not set 1298# CONFIG_SND_NM256 is not set
1287# CONFIG_SND_PCXHR is not set 1299# CONFIG_SND_PCXHR is not set
1300# CONFIG_SND_RIPTIDE is not set
1288# CONFIG_SND_RME32 is not set 1301# CONFIG_SND_RME32 is not set
1289# CONFIG_SND_RME96 is not set 1302# CONFIG_SND_RME96 is not set
1290# CONFIG_SND_RME9652 is not set 1303# CONFIG_SND_RME9652 is not set
@@ -1310,6 +1323,8 @@ CONFIG_SND_USB_AUDIO=m
1310# 1323#
1311# PCMCIA devices 1324# PCMCIA devices
1312# 1325#
1326# CONFIG_SND_VXPOCKET is not set
1327# CONFIG_SND_PDAUDIOCF is not set
1313 1328
1314# 1329#
1315# Open Sound System 1330# Open Sound System
@@ -1321,6 +1336,7 @@ CONFIG_SND_USB_AUDIO=m
1321# 1336#
1322CONFIG_USB_ARCH_HAS_HCD=y 1337CONFIG_USB_ARCH_HAS_HCD=y
1323CONFIG_USB_ARCH_HAS_OHCI=y 1338CONFIG_USB_ARCH_HAS_OHCI=y
1339CONFIG_USB_ARCH_HAS_EHCI=y
1324CONFIG_USB=y 1340CONFIG_USB=y
1325# CONFIG_USB_DEBUG is not set 1341# CONFIG_USB_DEBUG is not set
1326 1342
@@ -1336,7 +1352,9 @@ CONFIG_USB_DYNAMIC_MINORS=y
1336# 1352#
1337# USB Host Controller Drivers 1353# USB Host Controller Drivers
1338# 1354#
1339# CONFIG_USB_EHCI_HCD is not set 1355CONFIG_USB_EHCI_HCD=m
1356CONFIG_USB_EHCI_SPLIT_ISO=y
1357CONFIG_USB_EHCI_ROOT_HUB_TT=y
1340# CONFIG_USB_ISP116X_HCD is not set 1358# CONFIG_USB_ISP116X_HCD is not set
1341CONFIG_USB_OHCI_HCD=y 1359CONFIG_USB_OHCI_HCD=y
1342# CONFIG_USB_OHCI_BIG_ENDIAN is not set 1360# CONFIG_USB_OHCI_BIG_ENDIAN is not set
@@ -1347,7 +1365,6 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1347# 1365#
1348# USB Device Class drivers 1366# USB Device Class drivers
1349# 1367#
1350# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
1351CONFIG_USB_ACM=m 1368CONFIG_USB_ACM=m
1352CONFIG_USB_PRINTER=m 1369CONFIG_USB_PRINTER=m
1353 1370
@@ -1358,7 +1375,17 @@ CONFIG_USB_PRINTER=m
1358# 1375#
1359# may also be needed; see USB_STORAGE Help for more information 1376# may also be needed; see USB_STORAGE Help for more information
1360# 1377#
1361# CONFIG_USB_STORAGE is not set 1378CONFIG_USB_STORAGE=m
1379# CONFIG_USB_STORAGE_DEBUG is not set
1380# CONFIG_USB_STORAGE_DATAFAB is not set
1381# CONFIG_USB_STORAGE_FREECOM is not set
1382# CONFIG_USB_STORAGE_ISD200 is not set
1383# CONFIG_USB_STORAGE_DPCM is not set
1384# CONFIG_USB_STORAGE_USBAT is not set
1385# CONFIG_USB_STORAGE_SDDR09 is not set
1386# CONFIG_USB_STORAGE_SDDR55 is not set
1387# CONFIG_USB_STORAGE_JUMPSHOT is not set
1388# CONFIG_USB_STORAGE_ALAUDA is not set
1362# CONFIG_USB_LIBUSUAL is not set 1389# CONFIG_USB_LIBUSUAL is not set
1363 1390
1364# 1391#
@@ -1374,9 +1401,7 @@ CONFIG_USB_HIDINPUT_POWERBOOK=y
1374# CONFIG_USB_ACECAD is not set 1401# CONFIG_USB_ACECAD is not set
1375# CONFIG_USB_KBTAB is not set 1402# CONFIG_USB_KBTAB is not set
1376# CONFIG_USB_POWERMATE is not set 1403# CONFIG_USB_POWERMATE is not set
1377# CONFIG_USB_MTOUCH is not set 1404# CONFIG_USB_TOUCHSCREEN is not set
1378# CONFIG_USB_ITMTOUCH is not set
1379# CONFIG_USB_EGALAX is not set
1380# CONFIG_USB_YEALINK is not set 1405# CONFIG_USB_YEALINK is not set
1381# CONFIG_USB_XPAD is not set 1406# CONFIG_USB_XPAD is not set
1382# CONFIG_USB_ATI_REMOTE is not set 1407# CONFIG_USB_ATI_REMOTE is not set
@@ -1391,15 +1416,6 @@ CONFIG_USB_APPLETOUCH=y
1391# CONFIG_USB_MICROTEK is not set 1416# CONFIG_USB_MICROTEK is not set
1392 1417
1393# 1418#
1394# USB Multimedia devices
1395#
1396# CONFIG_USB_DABUSB is not set
1397
1398#
1399# Video4Linux support is needed for USB Multimedia device support
1400#
1401
1402#
1403# USB Network Adapters 1419# USB Network Adapters
1404# 1420#
1405# CONFIG_USB_CATC is not set 1421# CONFIG_USB_CATC is not set
@@ -1429,6 +1445,7 @@ CONFIG_USB_SERIAL=m
1429# CONFIG_USB_SERIAL_GENERIC is not set 1445# CONFIG_USB_SERIAL_GENERIC is not set
1430# CONFIG_USB_SERIAL_AIRPRIME is not set 1446# CONFIG_USB_SERIAL_AIRPRIME is not set
1431# CONFIG_USB_SERIAL_ANYDATA is not set 1447# CONFIG_USB_SERIAL_ANYDATA is not set
1448# CONFIG_USB_SERIAL_ARK3116 is not set
1432# CONFIG_USB_SERIAL_BELKIN is not set 1449# CONFIG_USB_SERIAL_BELKIN is not set
1433# CONFIG_USB_SERIAL_WHITEHEAT is not set 1450# CONFIG_USB_SERIAL_WHITEHEAT is not set
1434# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set 1451# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
@@ -1436,6 +1453,7 @@ CONFIG_USB_SERIAL=m
1436# CONFIG_USB_SERIAL_CYPRESS_M8 is not set 1453# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1437# CONFIG_USB_SERIAL_EMPEG is not set 1454# CONFIG_USB_SERIAL_EMPEG is not set
1438# CONFIG_USB_SERIAL_FTDI_SIO is not set 1455# CONFIG_USB_SERIAL_FTDI_SIO is not set
1456# CONFIG_USB_SERIAL_FUNSOFT is not set
1439CONFIG_USB_SERIAL_VISOR=m 1457CONFIG_USB_SERIAL_VISOR=m
1440CONFIG_USB_SERIAL_IPAQ=m 1458CONFIG_USB_SERIAL_IPAQ=m
1441# CONFIG_USB_SERIAL_IR is not set 1459# CONFIG_USB_SERIAL_IR is not set
@@ -1460,6 +1478,7 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1460# CONFIG_USB_SERIAL_KLSI is not set 1478# CONFIG_USB_SERIAL_KLSI is not set
1461# CONFIG_USB_SERIAL_KOBIL_SCT is not set 1479# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1462# CONFIG_USB_SERIAL_MCT_U232 is not set 1480# CONFIG_USB_SERIAL_MCT_U232 is not set
1481# CONFIG_USB_SERIAL_NAVMAN is not set
1463# CONFIG_USB_SERIAL_PL2303 is not set 1482# CONFIG_USB_SERIAL_PL2303 is not set
1464# CONFIG_USB_SERIAL_HP4X is not set 1483# CONFIG_USB_SERIAL_HP4X is not set
1465# CONFIG_USB_SERIAL_SAFE is not set 1484# CONFIG_USB_SERIAL_SAFE is not set
@@ -1484,6 +1503,7 @@ CONFIG_USB_EZUSB=y
1484# CONFIG_USB_PHIDGETKIT is not set 1503# CONFIG_USB_PHIDGETKIT is not set
1485# CONFIG_USB_PHIDGETSERVO is not set 1504# CONFIG_USB_PHIDGETSERVO is not set
1486# CONFIG_USB_IDMOUSE is not set 1505# CONFIG_USB_IDMOUSE is not set
1506# CONFIG_USB_SISUSBVGA is not set
1487# CONFIG_USB_LD is not set 1507# CONFIG_USB_LD is not set
1488# CONFIG_USB_TEST is not set 1508# CONFIG_USB_TEST is not set
1489 1509
@@ -1502,6 +1522,19 @@ CONFIG_USB_EZUSB=y
1502# CONFIG_MMC is not set 1522# CONFIG_MMC is not set
1503 1523
1504# 1524#
1525# LED devices
1526#
1527# CONFIG_NEW_LEDS is not set
1528
1529#
1530# LED drivers
1531#
1532
1533#
1534# LED Triggers
1535#
1536
1537#
1505# InfiniBand support 1538# InfiniBand support
1506# 1539#
1507# CONFIG_INFINIBAND is not set 1540# CONFIG_INFINIBAND is not set
@@ -1511,6 +1544,11 @@ CONFIG_USB_EZUSB=y
1511# 1544#
1512 1545
1513# 1546#
1547# Real Time Clock
1548#
1549# CONFIG_RTC_CLASS is not set
1550
1551#
1514# File systems 1552# File systems
1515# 1553#
1516CONFIG_EXT2_FS=y 1554CONFIG_EXT2_FS=y
@@ -1518,14 +1556,14 @@ CONFIG_EXT2_FS=y
1518# CONFIG_EXT2_FS_XIP is not set 1556# CONFIG_EXT2_FS_XIP is not set
1519CONFIG_EXT3_FS=y 1557CONFIG_EXT3_FS=y
1520CONFIG_EXT3_FS_XATTR=y 1558CONFIG_EXT3_FS_XATTR=y
1521# CONFIG_EXT3_FS_POSIX_ACL is not set 1559CONFIG_EXT3_FS_POSIX_ACL=y
1522# CONFIG_EXT3_FS_SECURITY is not set 1560# CONFIG_EXT3_FS_SECURITY is not set
1523CONFIG_JBD=y 1561CONFIG_JBD=y
1524# CONFIG_JBD_DEBUG is not set 1562# CONFIG_JBD_DEBUG is not set
1525CONFIG_FS_MBCACHE=y 1563CONFIG_FS_MBCACHE=y
1526# CONFIG_REISERFS_FS is not set 1564# CONFIG_REISERFS_FS is not set
1527# CONFIG_JFS_FS is not set 1565# CONFIG_JFS_FS is not set
1528# CONFIG_FS_POSIX_ACL is not set 1566CONFIG_FS_POSIX_ACL=y
1529# CONFIG_XFS_FS is not set 1567# CONFIG_XFS_FS is not set
1530# CONFIG_OCFS2_FS is not set 1568# CONFIG_OCFS2_FS is not set
1531# CONFIG_MINIX_FS is not set 1569# CONFIG_MINIX_FS is not set
@@ -1534,7 +1572,7 @@ CONFIG_INOTIFY=y
1534# CONFIG_QUOTA is not set 1572# CONFIG_QUOTA is not set
1535CONFIG_DNOTIFY=y 1573CONFIG_DNOTIFY=y
1536# CONFIG_AUTOFS_FS is not set 1574# CONFIG_AUTOFS_FS is not set
1537# CONFIG_AUTOFS4_FS is not set 1575CONFIG_AUTOFS4_FS=m
1538CONFIG_FUSE_FS=m 1576CONFIG_FUSE_FS=m
1539 1577
1540# 1578#
@@ -1566,7 +1604,6 @@ CONFIG_SYSFS=y
1566CONFIG_TMPFS=y 1604CONFIG_TMPFS=y
1567# CONFIG_HUGETLB_PAGE is not set 1605# CONFIG_HUGETLB_PAGE is not set
1568CONFIG_RAMFS=y 1606CONFIG_RAMFS=y
1569CONFIG_RELAYFS_FS=m
1570# CONFIG_CONFIGFS_FS is not set 1607# CONFIG_CONFIGFS_FS is not set
1571 1608
1572# 1609#
@@ -1590,17 +1627,24 @@ CONFIG_HFSPLUS_FS=m
1590# Network File Systems 1627# Network File Systems
1591# 1628#
1592CONFIG_NFS_FS=y 1629CONFIG_NFS_FS=y
1593# CONFIG_NFS_V3 is not set 1630CONFIG_NFS_V3=y
1594# CONFIG_NFS_V4 is not set 1631CONFIG_NFS_V3_ACL=y
1632CONFIG_NFS_V4=y
1595# CONFIG_NFS_DIRECTIO is not set 1633# CONFIG_NFS_DIRECTIO is not set
1596CONFIG_NFSD=y 1634CONFIG_NFSD=m
1597# CONFIG_NFSD_V3 is not set 1635CONFIG_NFSD_V2_ACL=y
1598# CONFIG_NFSD_TCP is not set 1636CONFIG_NFSD_V3=y
1637CONFIG_NFSD_V3_ACL=y
1638CONFIG_NFSD_V4=y
1639CONFIG_NFSD_TCP=y
1599CONFIG_LOCKD=y 1640CONFIG_LOCKD=y
1600CONFIG_EXPORTFS=y 1641CONFIG_LOCKD_V4=y
1642CONFIG_EXPORTFS=m
1643CONFIG_NFS_ACL_SUPPORT=y
1601CONFIG_NFS_COMMON=y 1644CONFIG_NFS_COMMON=y
1602CONFIG_SUNRPC=y 1645CONFIG_SUNRPC=y
1603# CONFIG_RPCSEC_GSS_KRB5 is not set 1646CONFIG_SUNRPC_GSS=y
1647CONFIG_RPCSEC_GSS_KRB5=y
1604# CONFIG_RPCSEC_GSS_SPKM3 is not set 1648# CONFIG_RPCSEC_GSS_SPKM3 is not set
1605CONFIG_SMB_FS=m 1649CONFIG_SMB_FS=m
1606# CONFIG_SMB_NLS_DEFAULT is not set 1650# CONFIG_SMB_NLS_DEFAULT is not set
@@ -1681,7 +1725,7 @@ CONFIG_NLS_UTF8=m
1681CONFIG_CRC_CCITT=y 1725CONFIG_CRC_CCITT=y
1682CONFIG_CRC16=y 1726CONFIG_CRC16=y
1683CONFIG_CRC32=y 1727CONFIG_CRC32=y
1684# CONFIG_LIBCRC32C is not set 1728CONFIG_LIBCRC32C=m
1685CONFIG_ZLIB_INFLATE=y 1729CONFIG_ZLIB_INFLATE=y
1686CONFIG_ZLIB_DEFLATE=y 1730CONFIG_ZLIB_DEFLATE=y
1687CONFIG_TEXTSEARCH=y 1731CONFIG_TEXTSEARCH=y
@@ -1735,29 +1779,29 @@ CONFIG_BOOTX_TEXT=y
1735# Cryptographic options 1779# Cryptographic options
1736# 1780#
1737CONFIG_CRYPTO=y 1781CONFIG_CRYPTO=y
1738# CONFIG_CRYPTO_HMAC is not set 1782CONFIG_CRYPTO_HMAC=y
1739# CONFIG_CRYPTO_NULL is not set 1783CONFIG_CRYPTO_NULL=m
1740# CONFIG_CRYPTO_MD4 is not set 1784CONFIG_CRYPTO_MD4=m
1741# CONFIG_CRYPTO_MD5 is not set 1785CONFIG_CRYPTO_MD5=y
1742# CONFIG_CRYPTO_SHA1 is not set 1786CONFIG_CRYPTO_SHA1=y
1743# CONFIG_CRYPTO_SHA256 is not set 1787CONFIG_CRYPTO_SHA256=m
1744# CONFIG_CRYPTO_SHA512 is not set 1788CONFIG_CRYPTO_SHA512=m
1745# CONFIG_CRYPTO_WP512 is not set 1789CONFIG_CRYPTO_WP512=m
1746# CONFIG_CRYPTO_TGR192 is not set 1790CONFIG_CRYPTO_TGR192=m
1747# CONFIG_CRYPTO_DES is not set 1791CONFIG_CRYPTO_DES=y
1748# CONFIG_CRYPTO_BLOWFISH is not set 1792CONFIG_CRYPTO_BLOWFISH=m
1749# CONFIG_CRYPTO_TWOFISH is not set 1793CONFIG_CRYPTO_TWOFISH=m
1750# CONFIG_CRYPTO_SERPENT is not set 1794CONFIG_CRYPTO_SERPENT=m
1751CONFIG_CRYPTO_AES=m 1795CONFIG_CRYPTO_AES=m
1752# CONFIG_CRYPTO_CAST5 is not set 1796CONFIG_CRYPTO_CAST5=m
1753# CONFIG_CRYPTO_CAST6 is not set 1797CONFIG_CRYPTO_CAST6=m
1754# CONFIG_CRYPTO_TEA is not set 1798CONFIG_CRYPTO_TEA=m
1755CONFIG_CRYPTO_ARC4=m 1799CONFIG_CRYPTO_ARC4=m
1756# CONFIG_CRYPTO_KHAZAD is not set 1800CONFIG_CRYPTO_KHAZAD=m
1757# CONFIG_CRYPTO_ANUBIS is not set 1801CONFIG_CRYPTO_ANUBIS=m
1758# CONFIG_CRYPTO_DEFLATE is not set 1802CONFIG_CRYPTO_DEFLATE=m
1759CONFIG_CRYPTO_MICHAEL_MIC=m 1803CONFIG_CRYPTO_MICHAEL_MIC=m
1760# CONFIG_CRYPTO_CRC32C is not set 1804CONFIG_CRYPTO_CRC32C=m
1761# CONFIG_CRYPTO_TEST is not set 1805# CONFIG_CRYPTO_TEST is not set
1762 1806
1763# 1807#
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 58e68ce09b0f..31708ad4574e 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_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.17-rc1 3# Linux kernel version: 2.6.17-rc4
4# Wed Apr 19 11:48:00 2006 4# Sun May 28 07:26:56 2006
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -11,6 +11,7 @@ CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y 11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_PPC=y 15CONFIG_PPC=y
15CONFIG_EARLY_PRINTK=y 16CONFIG_EARLY_PRINTK=y
16CONFIG_COMPAT=y 17CONFIG_COMPAT=y
@@ -126,8 +127,9 @@ CONFIG_RTAS_PROC=y
126CONFIG_RTAS_FLASH=m 127CONFIG_RTAS_FLASH=m
127# CONFIG_MMIO_NVRAM is not set 128# CONFIG_MMIO_NVRAM is not set
128CONFIG_IBMVIO=y 129CONFIG_IBMVIO=y
129# CONFIG_IBMEBUS is not set 130CONFIG_IBMEBUS=y
130# CONFIG_PPC_MPC106 is not set 131# CONFIG_PPC_MPC106 is not set
132# CONFIG_PPC_970_NAP is not set
131# CONFIG_CPU_FREQ is not set 133# CONFIG_CPU_FREQ is not set
132# CONFIG_WANT_EARLY_SERIAL is not set 134# CONFIG_WANT_EARLY_SERIAL is not set
133 135
@@ -143,7 +145,7 @@ CONFIG_PREEMPT_NONE=y
143# CONFIG_PREEMPT is not set 145# CONFIG_PREEMPT is not set
144# CONFIG_PREEMPT_BKL is not set 146# CONFIG_PREEMPT_BKL is not set
145CONFIG_BINFMT_ELF=y 147CONFIG_BINFMT_ELF=y
146# CONFIG_BINFMT_MISC is not set 148CONFIG_BINFMT_MISC=m
147CONFIG_FORCE_MAX_ZONEORDER=13 149CONFIG_FORCE_MAX_ZONEORDER=13
148CONFIG_IOMMU_VMERGE=y 150CONFIG_IOMMU_VMERGE=y
149CONFIG_HOTPLUG_CPU=y 151CONFIG_HOTPLUG_CPU=y
@@ -155,6 +157,7 @@ CONFIG_EEH=y
155CONFIG_SCANLOG=m 157CONFIG_SCANLOG=m
156CONFIG_LPARCFG=y 158CONFIG_LPARCFG=y
157CONFIG_NUMA=y 159CONFIG_NUMA=y
160CONFIG_NODES_SHIFT=4
158CONFIG_ARCH_SELECT_MEMORY_MODEL=y 161CONFIG_ARCH_SELECT_MEMORY_MODEL=y
159CONFIG_ARCH_SPARSEMEM_ENABLE=y 162CONFIG_ARCH_SPARSEMEM_ENABLE=y
160CONFIG_ARCH_SPARSEMEM_DEFAULT=y 163CONFIG_ARCH_SPARSEMEM_DEFAULT=y
@@ -467,7 +470,7 @@ CONFIG_SCSI_CONSTANTS=y
467CONFIG_SCSI_SPI_ATTRS=y 470CONFIG_SCSI_SPI_ATTRS=y
468CONFIG_SCSI_FC_ATTRS=y 471CONFIG_SCSI_FC_ATTRS=y
469CONFIG_SCSI_ISCSI_ATTRS=m 472CONFIG_SCSI_ISCSI_ATTRS=m
470# CONFIG_SCSI_SAS_ATTRS is not set 473CONFIG_SCSI_SAS_ATTRS=m
471 474
472# 475#
473# SCSI low-level drivers 476# SCSI low-level drivers
@@ -499,13 +502,18 @@ CONFIG_SCSI_SYM53C8XX_2=y
499CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 502CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
500CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 503CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
501CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 504CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
502# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 505CONFIG_SCSI_SYM53C8XX_MMIO=y
503CONFIG_SCSI_IPR=y 506CONFIG_SCSI_IPR=y
504CONFIG_SCSI_IPR_TRACE=y 507CONFIG_SCSI_IPR_TRACE=y
505CONFIG_SCSI_IPR_DUMP=y 508CONFIG_SCSI_IPR_DUMP=y
506# CONFIG_SCSI_QLOGIC_FC is not set
507# CONFIG_SCSI_QLOGIC_1280 is not set 509# CONFIG_SCSI_QLOGIC_1280 is not set
508# CONFIG_SCSI_QLA_FC is not set 510CONFIG_SCSI_QLA_FC=m
511CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE=y
512CONFIG_SCSI_QLA21XX=m
513CONFIG_SCSI_QLA22XX=m
514CONFIG_SCSI_QLA2300=m
515CONFIG_SCSI_QLA2322=m
516CONFIG_SCSI_QLA24XX=m
509CONFIG_SCSI_LPFC=m 517CONFIG_SCSI_LPFC=m
510# CONFIG_SCSI_DC395x is not set 518# CONFIG_SCSI_DC395x is not set
511# CONFIG_SCSI_DC390T is not set 519# CONFIG_SCSI_DC390T is not set
@@ -521,7 +529,7 @@ CONFIG_MD_RAID0=y
521CONFIG_MD_RAID1=y 529CONFIG_MD_RAID1=y
522CONFIG_MD_RAID10=m 530CONFIG_MD_RAID10=m
523CONFIG_MD_RAID5=y 531CONFIG_MD_RAID5=y
524# CONFIG_MD_RAID5_RESHAPE is not set 532CONFIG_MD_RAID5_RESHAPE=y
525CONFIG_MD_RAID6=m 533CONFIG_MD_RAID6=m
526CONFIG_MD_MULTIPATH=m 534CONFIG_MD_MULTIPATH=m
527CONFIG_MD_FAULTY=m 535CONFIG_MD_FAULTY=m
@@ -764,7 +772,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
764CONFIG_SERIAL_CORE=y 772CONFIG_SERIAL_CORE=y
765CONFIG_SERIAL_CORE_CONSOLE=y 773CONFIG_SERIAL_CORE_CONSOLE=y
766CONFIG_SERIAL_ICOM=m 774CONFIG_SERIAL_ICOM=m
767# CONFIG_SERIAL_JSM is not set 775CONFIG_SERIAL_JSM=m
768CONFIG_UNIX98_PTYS=y 776CONFIG_UNIX98_PTYS=y
769CONFIG_LEGACY_PTYS=y 777CONFIG_LEGACY_PTYS=y
770CONFIG_LEGACY_PTY_COUNT=256 778CONFIG_LEGACY_PTY_COUNT=256
@@ -773,7 +781,7 @@ CONFIG_LEGACY_PTY_COUNT=256
773# CONFIG_TIPAR is not set 781# CONFIG_TIPAR is not set
774CONFIG_HVC_DRIVER=y 782CONFIG_HVC_DRIVER=y
775CONFIG_HVC_CONSOLE=y 783CONFIG_HVC_CONSOLE=y
776# CONFIG_HVC_RTAS is not set 784CONFIG_HVC_RTAS=y
777CONFIG_HVCS=m 785CONFIG_HVCS=m
778 786
779# 787#
@@ -1031,9 +1039,7 @@ CONFIG_USB_HIDDEV=y
1031# CONFIG_USB_ACECAD is not set 1039# CONFIG_USB_ACECAD is not set
1032# CONFIG_USB_KBTAB is not set 1040# CONFIG_USB_KBTAB is not set
1033# CONFIG_USB_POWERMATE is not set 1041# CONFIG_USB_POWERMATE is not set
1034# CONFIG_USB_MTOUCH is not set 1042# CONFIG_USB_TOUCHSCREEN is not set
1035# CONFIG_USB_ITMTOUCH is not set
1036# CONFIG_USB_EGALAX is not set
1037# CONFIG_USB_YEALINK is not set 1043# CONFIG_USB_YEALINK is not set
1038# CONFIG_USB_XPAD is not set 1044# CONFIG_USB_XPAD is not set
1039# CONFIG_USB_ATI_REMOTE is not set 1045# CONFIG_USB_ATI_REMOTE is not set
@@ -1105,16 +1111,25 @@ CONFIG_USB_MON=y
1105# CONFIG_NEW_LEDS is not set 1111# CONFIG_NEW_LEDS is not set
1106 1112
1107# 1113#
1114# LED drivers
1115#
1116
1117#
1118# LED Triggers
1119#
1120
1121#
1108# InfiniBand support 1122# InfiniBand support
1109# 1123#
1110CONFIG_INFINIBAND=m 1124CONFIG_INFINIBAND=m
1111# CONFIG_INFINIBAND_USER_MAD is not set 1125CONFIG_INFINIBAND_USER_MAD=m
1112# CONFIG_INFINIBAND_USER_ACCESS is not set 1126CONFIG_INFINIBAND_USER_ACCESS=m
1113CONFIG_INFINIBAND_MTHCA=m 1127CONFIG_INFINIBAND_MTHCA=m
1114# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 1128CONFIG_INFINIBAND_MTHCA_DEBUG=y
1115CONFIG_INFINIBAND_IPOIB=m 1129CONFIG_INFINIBAND_IPOIB=m
1116# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 1130CONFIG_INFINIBAND_IPOIB_DEBUG=y
1117# CONFIG_INFINIBAND_SRP is not set 1131# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
1132CONFIG_INFINIBAND_SRP=m
1118 1133
1119# 1134#
1120# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 1135# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
@@ -1159,15 +1174,15 @@ CONFIG_XFS_EXPORT=y
1159CONFIG_XFS_SECURITY=y 1174CONFIG_XFS_SECURITY=y
1160CONFIG_XFS_POSIX_ACL=y 1175CONFIG_XFS_POSIX_ACL=y
1161# CONFIG_XFS_RT is not set 1176# CONFIG_XFS_RT is not set
1162# CONFIG_OCFS2_FS is not set 1177CONFIG_OCFS2_FS=m
1163# CONFIG_MINIX_FS is not set 1178# CONFIG_MINIX_FS is not set
1164# CONFIG_ROMFS_FS is not set 1179# CONFIG_ROMFS_FS is not set
1165CONFIG_INOTIFY=y 1180CONFIG_INOTIFY=y
1166# CONFIG_QUOTA is not set 1181# CONFIG_QUOTA is not set
1167CONFIG_DNOTIFY=y 1182CONFIG_DNOTIFY=y
1168CONFIG_AUTOFS_FS=m 1183# CONFIG_AUTOFS_FS is not set
1169# CONFIG_AUTOFS4_FS is not set 1184CONFIG_AUTOFS4_FS=m
1170# CONFIG_FUSE_FS is not set 1185CONFIG_FUSE_FS=m
1171 1186
1172# 1187#
1173# CD-ROM/DVD Filesystems 1188# CD-ROM/DVD Filesystems
@@ -1199,7 +1214,7 @@ CONFIG_TMPFS=y
1199CONFIG_HUGETLBFS=y 1214CONFIG_HUGETLBFS=y
1200CONFIG_HUGETLB_PAGE=y 1215CONFIG_HUGETLB_PAGE=y
1201CONFIG_RAMFS=y 1216CONFIG_RAMFS=y
1202# CONFIG_CONFIGFS_FS is not set 1217CONFIG_CONFIGFS_FS=m
1203 1218
1204# 1219#
1205# Miscellaneous filesystems 1220# Miscellaneous filesystems
@@ -1317,7 +1332,7 @@ CONFIG_ZLIB_DEFLATE=m
1317# 1332#
1318CONFIG_PROFILING=y 1333CONFIG_PROFILING=y
1319CONFIG_OPROFILE=y 1334CONFIG_OPROFILE=y
1320# CONFIG_KPROBES is not set 1335CONFIG_KPROBES=y
1321 1336
1322# 1337#
1323# Kernel hacking 1338# Kernel hacking
@@ -1329,7 +1344,7 @@ CONFIG_LOG_BUF_SHIFT=17
1329CONFIG_DETECT_SOFTLOCKUP=y 1344CONFIG_DETECT_SOFTLOCKUP=y
1330# CONFIG_SCHEDSTATS is not set 1345# CONFIG_SCHEDSTATS is not set
1331# CONFIG_DEBUG_SLAB is not set 1346# CONFIG_DEBUG_SLAB is not set
1332CONFIG_DEBUG_MUTEXES=y 1347# CONFIG_DEBUG_MUTEXES is not set
1333# CONFIG_DEBUG_SPINLOCK is not set 1348# CONFIG_DEBUG_SPINLOCK is not set
1334# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1349# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1335# CONFIG_DEBUG_KOBJECT is not set 1350# CONFIG_DEBUG_KOBJECT is not set
@@ -1339,17 +1354,13 @@ CONFIG_DEBUG_FS=y
1339CONFIG_FORCED_INLINING=y 1354CONFIG_FORCED_INLINING=y
1340# CONFIG_RCU_TORTURE_TEST is not set 1355# CONFIG_RCU_TORTURE_TEST is not set
1341CONFIG_DEBUG_STACKOVERFLOW=y 1356CONFIG_DEBUG_STACKOVERFLOW=y
1342CONFIG_DEBUG_STACK_USAGE=y 1357# CONFIG_DEBUG_STACK_USAGE is not set
1343CONFIG_DEBUGGER=y 1358CONFIG_DEBUGGER=y
1344CONFIG_XMON=y 1359CONFIG_XMON=y
1345CONFIG_XMON_DEFAULT=y 1360CONFIG_XMON_DEFAULT=y
1346CONFIG_IRQSTACKS=y 1361CONFIG_IRQSTACKS=y
1347# CONFIG_BOOTX_TEXT is not set 1362# CONFIG_BOOTX_TEXT is not set
1348# CONFIG_PPC_EARLY_DEBUG_LPAR is not set 1363# CONFIG_PPC_EARLY_DEBUG is not set
1349# CONFIG_PPC_EARLY_DEBUG_G5 is not set
1350# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
1351# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1352# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1353 1364
1354# 1365#
1355# Security options 1366# Security options
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index faaec9c6f78f..4734b5de599d 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -35,17 +35,19 @@ struct aligninfo {
35 35
36#define INVALID { 0, 0 } 36#define INVALID { 0, 0 }
37 37
38#define LD 1 /* load */ 38/* Bits in the flags field */
39#define ST 2 /* store */ 39#define LD 0 /* load */
40#define SE 4 /* sign-extend value */ 40#define ST 1 /* store */
41#define F 8 /* to/from fp regs */ 41#define SE 2 /* sign-extend value */
42#define U 0x10 /* update index register */ 42#define F 4 /* to/from fp regs */
43#define M 0x20 /* multiple load/store */ 43#define U 8 /* update index register */
44#define SW 0x40 /* byte swap int or ... */ 44#define M 0x10 /* multiple load/store */
45#define S 0x40 /* ... single-precision fp */ 45#define SW 0x20 /* byte swap */
46#define SX 0x40 /* byte count in XER */ 46#define S 0x40 /* single-precision fp or... */
47#define SX 0x40 /* ... byte count in XER */
47#define HARD 0x80 /* string, stwcx. */ 48#define HARD 0x80 /* string, stwcx. */
48 49
50/* DSISR bits reported for a DCBZ instruction: */
49#define DCBZ 0x5f /* 8xx/82xx dcbz faults when cache not enabled */ 51#define DCBZ 0x5f /* 8xx/82xx dcbz faults when cache not enabled */
50 52
51#define SWAP(a, b) (t = (a), (a) = (b), (b) = t) 53#define SWAP(a, b) (t = (a), (a) = (b), (b) = t)
@@ -256,12 +258,16 @@ static int emulate_dcbz(struct pt_regs *regs, unsigned char __user *addr)
256#define REG_BYTE(rp, i) *((u8 *)(rp) + (i)) 258#define REG_BYTE(rp, i) *((u8 *)(rp) + (i))
257#endif 259#endif
258 260
261#define SWIZ_PTR(p) ((unsigned char __user *)((p) ^ swiz))
262
259static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr, 263static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
260 unsigned int reg, unsigned int nb, 264 unsigned int reg, unsigned int nb,
261 unsigned int flags, unsigned int instr) 265 unsigned int flags, unsigned int instr,
266 unsigned long swiz)
262{ 267{
263 unsigned long *rptr; 268 unsigned long *rptr;
264 unsigned int nb0, i; 269 unsigned int nb0, i, bswiz;
270 unsigned long p;
265 271
266 /* 272 /*
267 * We do not try to emulate 8 bytes multiple as they aren't really 273 * We do not try to emulate 8 bytes multiple as they aren't really
@@ -280,9 +286,12 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
280 if (nb == 0) 286 if (nb == 0)
281 return 1; 287 return 1;
282 } else { 288 } else {
283 if (__get_user(instr, 289 unsigned long pc = regs->nip ^ (swiz & 4);
284 (unsigned int __user *)regs->nip)) 290
291 if (__get_user(instr, (unsigned int __user *)pc))
285 return -EFAULT; 292 return -EFAULT;
293 if (swiz == 0 && (flags & SW))
294 instr = cpu_to_le32(instr);
286 nb = (instr >> 11) & 0x1f; 295 nb = (instr >> 11) & 0x1f;
287 if (nb == 0) 296 if (nb == 0)
288 nb = 32; 297 nb = 32;
@@ -300,7 +309,10 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
300 return -EFAULT; /* bad address */ 309 return -EFAULT; /* bad address */
301 310
302 rptr = &regs->gpr[reg]; 311 rptr = &regs->gpr[reg];
303 if (flags & LD) { 312 p = (unsigned long) addr;
313 bswiz = (flags & SW)? 3: 0;
314
315 if (!(flags & ST)) {
304 /* 316 /*
305 * This zeroes the top 4 bytes of the affected registers 317 * This zeroes the top 4 bytes of the affected registers
306 * in 64-bit mode, and also zeroes out any remaining 318 * in 64-bit mode, and also zeroes out any remaining
@@ -311,26 +323,28 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
311 memset(&regs->gpr[0], 0, 323 memset(&regs->gpr[0], 0,
312 ((nb0 + 3) / 4) * sizeof(unsigned long)); 324 ((nb0 + 3) / 4) * sizeof(unsigned long));
313 325
314 for (i = 0; i < nb; ++i) 326 for (i = 0; i < nb; ++i, ++p)
315 if (__get_user(REG_BYTE(rptr, i), addr + i)) 327 if (__get_user(REG_BYTE(rptr, i ^ bswiz), SWIZ_PTR(p)))
316 return -EFAULT; 328 return -EFAULT;
317 if (nb0 > 0) { 329 if (nb0 > 0) {
318 rptr = &regs->gpr[0]; 330 rptr = &regs->gpr[0];
319 addr += nb; 331 addr += nb;
320 for (i = 0; i < nb0; ++i) 332 for (i = 0; i < nb0; ++i, ++p)
321 if (__get_user(REG_BYTE(rptr, i), addr + i)) 333 if (__get_user(REG_BYTE(rptr, i ^ bswiz),
334 SWIZ_PTR(p)))
322 return -EFAULT; 335 return -EFAULT;
323 } 336 }
324 337
325 } else { 338 } else {
326 for (i = 0; i < nb; ++i) 339 for (i = 0; i < nb; ++i, ++p)
327 if (__put_user(REG_BYTE(rptr, i), addr + i)) 340 if (__put_user(REG_BYTE(rptr, i ^ bswiz), SWIZ_PTR(p)))
328 return -EFAULT; 341 return -EFAULT;
329 if (nb0 > 0) { 342 if (nb0 > 0) {
330 rptr = &regs->gpr[0]; 343 rptr = &regs->gpr[0];
331 addr += nb; 344 addr += nb;
332 for (i = 0; i < nb0; ++i) 345 for (i = 0; i < nb0; ++i, ++p)
333 if (__put_user(REG_BYTE(rptr, i), addr + i)) 346 if (__put_user(REG_BYTE(rptr, i ^ bswiz),
347 SWIZ_PTR(p)))
334 return -EFAULT; 348 return -EFAULT;
335 } 349 }
336 } 350 }
@@ -352,7 +366,7 @@ int fix_alignment(struct pt_regs *regs)
352 unsigned int reg, areg; 366 unsigned int reg, areg;
353 unsigned int dsisr; 367 unsigned int dsisr;
354 unsigned char __user *addr; 368 unsigned char __user *addr;
355 unsigned char __user *p; 369 unsigned long p, swiz;
356 int ret, t; 370 int ret, t;
357 union { 371 union {
358 u64 ll; 372 u64 ll;
@@ -380,11 +394,15 @@ int fix_alignment(struct pt_regs *regs)
380 * let's make one up from the instruction 394 * let's make one up from the instruction
381 */ 395 */
382 if (cpu_has_feature(CPU_FTR_NODSISRALIGN)) { 396 if (cpu_has_feature(CPU_FTR_NODSISRALIGN)) {
383 unsigned int real_instr; 397 unsigned long pc = regs->nip;
384 if (unlikely(__get_user(real_instr, 398
385 (unsigned int __user *)regs->nip))) 399 if (cpu_has_feature(CPU_FTR_PPC_LE) && (regs->msr & MSR_LE))
400 pc ^= 4;
401 if (unlikely(__get_user(instr, (unsigned int __user *)pc)))
386 return -EFAULT; 402 return -EFAULT;
387 dsisr = make_dsisr(real_instr); 403 if (cpu_has_feature(CPU_FTR_REAL_LE) && (regs->msr & MSR_LE))
404 instr = cpu_to_le32(instr);
405 dsisr = make_dsisr(instr);
388 } 406 }
389 407
390 /* extract the operation and registers from the dsisr */ 408 /* extract the operation and registers from the dsisr */
@@ -397,6 +415,24 @@ int fix_alignment(struct pt_regs *regs)
397 nb = aligninfo[instr].len; 415 nb = aligninfo[instr].len;
398 flags = aligninfo[instr].flags; 416 flags = aligninfo[instr].flags;
399 417
418 /* Byteswap little endian loads and stores */
419 swiz = 0;
420 if (regs->msr & MSR_LE) {
421 flags ^= SW;
422 /*
423 * So-called "PowerPC little endian" mode works by
424 * swizzling addresses rather than by actually doing
425 * any byte-swapping. To emulate this, we XOR each
426 * byte address with 7. We also byte-swap, because
427 * the processor's address swizzling depends on the
428 * operand size (it xors the address with 7 for bytes,
429 * 6 for halfwords, 4 for words, 0 for doublewords) but
430 * we will xor with 7 and load/store each byte separately.
431 */
432 if (cpu_has_feature(CPU_FTR_PPC_LE))
433 swiz = 7;
434 }
435
400 /* DAR has the operand effective address */ 436 /* DAR has the operand effective address */
401 addr = (unsigned char __user *)regs->dar; 437 addr = (unsigned char __user *)regs->dar;
402 438
@@ -412,7 +448,8 @@ int fix_alignment(struct pt_regs *regs)
412 * function 448 * function
413 */ 449 */
414 if (flags & M) 450 if (flags & M)
415 return emulate_multiple(regs, addr, reg, nb, flags, instr); 451 return emulate_multiple(regs, addr, reg, nb,
452 flags, instr, swiz);
416 453
417 /* Verify the address of the operand */ 454 /* Verify the address of the operand */
418 if (unlikely(user_mode(regs) && 455 if (unlikely(user_mode(regs) &&
@@ -431,51 +468,71 @@ int fix_alignment(struct pt_regs *regs)
431 /* If we are loading, get the data from user space, else 468 /* If we are loading, get the data from user space, else
432 * get it from register values 469 * get it from register values
433 */ 470 */
434 if (flags & LD) { 471 if (!(flags & ST)) {
435 data.ll = 0; 472 data.ll = 0;
436 ret = 0; 473 ret = 0;
437 p = addr; 474 p = (unsigned long) addr;
438 switch (nb) { 475 switch (nb) {
439 case 8: 476 case 8:
440 ret |= __get_user(data.v[0], p++); 477 ret |= __get_user(data.v[0], SWIZ_PTR(p++));
441 ret |= __get_user(data.v[1], p++); 478 ret |= __get_user(data.v[1], SWIZ_PTR(p++));
442 ret |= __get_user(data.v[2], p++); 479 ret |= __get_user(data.v[2], SWIZ_PTR(p++));
443 ret |= __get_user(data.v[3], p++); 480 ret |= __get_user(data.v[3], SWIZ_PTR(p++));
444 case 4: 481 case 4:
445 ret |= __get_user(data.v[4], p++); 482 ret |= __get_user(data.v[4], SWIZ_PTR(p++));
446 ret |= __get_user(data.v[5], p++); 483 ret |= __get_user(data.v[5], SWIZ_PTR(p++));
447 case 2: 484 case 2:
448 ret |= __get_user(data.v[6], p++); 485 ret |= __get_user(data.v[6], SWIZ_PTR(p++));
449 ret |= __get_user(data.v[7], p++); 486 ret |= __get_user(data.v[7], SWIZ_PTR(p++));
450 if (unlikely(ret)) 487 if (unlikely(ret))
451 return -EFAULT; 488 return -EFAULT;
452 } 489 }
453 } else if (flags & F) 490 } else if (flags & F) {
454 data.dd = current->thread.fpr[reg]; 491 data.dd = current->thread.fpr[reg];
455 else 492 if (flags & S) {
493 /* Single-precision FP store requires conversion... */
494#ifdef CONFIG_PPC_FPU
495 preempt_disable();
496 enable_kernel_fp();
497 cvt_df(&data.dd, (float *)&data.v[4], &current->thread);
498 preempt_enable();
499#else
500 return 0;
501#endif
502 }
503 } else
456 data.ll = regs->gpr[reg]; 504 data.ll = regs->gpr[reg];
457 505
458 /* Perform other misc operations like sign extension, byteswap, 506 if (flags & SW) {
507 switch (nb) {
508 case 8:
509 SWAP(data.v[0], data.v[7]);
510 SWAP(data.v[1], data.v[6]);
511 SWAP(data.v[2], data.v[5]);
512 SWAP(data.v[3], data.v[4]);
513 break;
514 case 4:
515 SWAP(data.v[4], data.v[7]);
516 SWAP(data.v[5], data.v[6]);
517 break;
518 case 2:
519 SWAP(data.v[6], data.v[7]);
520 break;
521 }
522 }
523
524 /* Perform other misc operations like sign extension
459 * or floating point single precision conversion 525 * or floating point single precision conversion
460 */ 526 */
461 switch (flags & ~U) { 527 switch (flags & ~(U|SW)) {
462 case LD+SE: /* sign extend */ 528 case LD+SE: /* sign extend */
463 if ( nb == 2 ) 529 if ( nb == 2 )
464 data.ll = data.x16.low16; 530 data.ll = data.x16.low16;
465 else /* nb must be 4 */ 531 else /* nb must be 4 */
466 data.ll = data.x32.low32; 532 data.ll = data.x32.low32;
467 break; 533 break;
468 case LD+S: /* byte-swap */
469 case ST+S:
470 if (nb == 2) {
471 SWAP(data.v[6], data.v[7]);
472 } else {
473 SWAP(data.v[4], data.v[7]);
474 SWAP(data.v[5], data.v[6]);
475 }
476 break;
477 534
478 /* Single-precision FP load and store require conversions... */ 535 /* Single-precision FP load requires conversion... */
479 case LD+F+S: 536 case LD+F+S:
480#ifdef CONFIG_PPC_FPU 537#ifdef CONFIG_PPC_FPU
481 preempt_disable(); 538 preempt_disable();
@@ -486,34 +543,24 @@ int fix_alignment(struct pt_regs *regs)
486 return 0; 543 return 0;
487#endif 544#endif
488 break; 545 break;
489 case ST+F+S:
490#ifdef CONFIG_PPC_FPU
491 preempt_disable();
492 enable_kernel_fp();
493 cvt_df(&data.dd, (float *)&data.v[4], &current->thread);
494 preempt_enable();
495#else
496 return 0;
497#endif
498 break;
499 } 546 }
500 547
501 /* Store result to memory or update registers */ 548 /* Store result to memory or update registers */
502 if (flags & ST) { 549 if (flags & ST) {
503 ret = 0; 550 ret = 0;
504 p = addr; 551 p = (unsigned long) addr;
505 switch (nb) { 552 switch (nb) {
506 case 8: 553 case 8:
507 ret |= __put_user(data.v[0], p++); 554 ret |= __put_user(data.v[0], SWIZ_PTR(p++));
508 ret |= __put_user(data.v[1], p++); 555 ret |= __put_user(data.v[1], SWIZ_PTR(p++));
509 ret |= __put_user(data.v[2], p++); 556 ret |= __put_user(data.v[2], SWIZ_PTR(p++));
510 ret |= __put_user(data.v[3], p++); 557 ret |= __put_user(data.v[3], SWIZ_PTR(p++));
511 case 4: 558 case 4:
512 ret |= __put_user(data.v[4], p++); 559 ret |= __put_user(data.v[4], SWIZ_PTR(p++));
513 ret |= __put_user(data.v[5], p++); 560 ret |= __put_user(data.v[5], SWIZ_PTR(p++));
514 case 2: 561 case 2:
515 ret |= __put_user(data.v[6], p++); 562 ret |= __put_user(data.v[6], SWIZ_PTR(p++));
516 ret |= __put_user(data.v[7], p++); 563 ret |= __put_user(data.v[7], SWIZ_PTR(p++));
517 } 564 }
518 if (unlikely(ret)) 565 if (unlikely(ret))
519 return -EFAULT; 566 return -EFAULT;
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 8f85c5e8a55a..ff2940548929 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -122,9 +122,8 @@ int main(void)
122 DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache)); 122 DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache));
123 DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr)); 123 DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr));
124 DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); 124 DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
125#ifdef CONFIG_PPC_64K_PAGES 125 DEFINE(PACACONTEXTSLLP, offsetof(struct paca_struct, context.sllp));
126 DEFINE(PACAPGDIR, offsetof(struct paca_struct, pgdir)); 126 DEFINE(PACAVMALLOCSLLP, offsetof(struct paca_struct, vmalloc_sllp));
127#endif
128#ifdef CONFIG_HUGETLB_PAGE 127#ifdef CONFIG_HUGETLB_PAGE
129 DEFINE(PACALOWHTLBAREAS, offsetof(struct paca_struct, context.low_htlb_areas)); 128 DEFINE(PACALOWHTLBAREAS, offsetof(struct paca_struct, context.low_htlb_areas));
130 DEFINE(PACAHIGHHTLBAREAS, offsetof(struct paca_struct, context.high_htlb_areas)); 129 DEFINE(PACAHIGHHTLBAREAS, offsetof(struct paca_struct, context.high_htlb_areas));
diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S
index 55ed7716636f..365381fcb27c 100644
--- a/arch/powerpc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
@@ -210,9 +210,11 @@ setup_745x_specifics:
210 * the firmware. If any, we disable NAP capability as 210 * the firmware. If any, we disable NAP capability as
211 * it's known to be bogus on rev 2.1 and earlier 211 * it's known to be bogus on rev 2.1 and earlier
212 */ 212 */
213BEGIN_FTR_SECTION
213 mfspr r11,SPRN_L3CR 214 mfspr r11,SPRN_L3CR
214 andis. r11,r11,L3CR_L3E@h 215 andis. r11,r11,L3CR_L3E@h
215 beq 1f 216 beq 1f
217END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
216 lwz r6,CPU_SPEC_FEATURES(r5) 218 lwz r6,CPU_SPEC_FEATURES(r5)
217 andi. r0,r6,CPU_FTR_L3_DISABLE_NAP 219 andi. r0,r6,CPU_FTR_L3_DISABLE_NAP
218 beq 1f 220 beq 1f
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_power4.S
index b61d86e7ceb6..271418308d53 100644
--- a/arch/powerpc/kernel/cpu_setup_power4.S
+++ b/arch/powerpc/kernel/cpu_setup_power4.S
@@ -73,23 +73,6 @@ _GLOBAL(__970_cpu_preinit)
73 isync 73 isync
74 blr 74 blr
75 75
76_GLOBAL(__setup_cpu_power4)
77 blr
78
79_GLOBAL(__setup_cpu_be)
80 /* Set large page sizes LP=0: 16MB, LP=1: 64KB */
81 addi r3, 0, 0
82 ori r3, r3, HID6_LB
83 sldi r3, r3, 32
84 nor r3, r3, r3
85 mfspr r4, SPRN_HID6
86 and r4, r4, r3
87 addi r3, 0, 0x02000
88 sldi r3, r3, 32
89 or r4, r4, r3
90 mtspr SPRN_HID6, r4
91 blr
92
93_GLOBAL(__setup_cpu_ppc970) 76_GLOBAL(__setup_cpu_ppc970)
94 mfspr r0,SPRN_HID0 77 mfspr r0,SPRN_HID0
95 li r11,5 /* clear DOZE and SLEEP */ 78 li r11,5 /* clear DOZE and SLEEP */
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 3f7182db9ed5..1c114880dc05 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -30,11 +30,7 @@ EXPORT_SYMBOL(cur_cpu_spec);
30 * part of the cputable though. That has to be fixed for both ppc32 30 * part of the cputable though. That has to be fixed for both ppc32
31 * and ppc64 31 * and ppc64
32 */ 32 */
33#ifdef CONFIG_PPC64 33#ifdef CONFIG_PPC32
34extern void __setup_cpu_power3(unsigned long offset, struct cpu_spec* spec);
35extern void __setup_cpu_power4(unsigned long offset, struct cpu_spec* spec);
36extern void __setup_cpu_be(unsigned long offset, struct cpu_spec* spec);
37#else
38extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec); 34extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
39extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec); 35extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
40extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec); 36extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
@@ -58,7 +54,8 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
58#define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\ 54#define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\
59 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) 55 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
60#define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\ 56#define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\
61 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) 57 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
58 PPC_FEATURE_TRUE_LE)
62#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ 59#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
63 PPC_FEATURE_BOOKE) 60 PPC_FEATURE_BOOKE)
64 61
@@ -78,11 +75,10 @@ struct cpu_spec cpu_specs[] = {
78 .pvr_value = 0x00400000, 75 .pvr_value = 0x00400000,
79 .cpu_name = "POWER3 (630)", 76 .cpu_name = "POWER3 (630)",
80 .cpu_features = CPU_FTRS_POWER3, 77 .cpu_features = CPU_FTRS_POWER3,
81 .cpu_user_features = COMMON_USER_PPC64, 78 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
82 .icache_bsize = 128, 79 .icache_bsize = 128,
83 .dcache_bsize = 128, 80 .dcache_bsize = 128,
84 .num_pmcs = 8, 81 .num_pmcs = 8,
85 .cpu_setup = __setup_cpu_power3,
86 .oprofile_cpu_type = "ppc64/power3", 82 .oprofile_cpu_type = "ppc64/power3",
87 .oprofile_type = PPC_OPROFILE_RS64, 83 .oprofile_type = PPC_OPROFILE_RS64,
88 .platform = "power3", 84 .platform = "power3",
@@ -92,11 +88,10 @@ struct cpu_spec cpu_specs[] = {
92 .pvr_value = 0x00410000, 88 .pvr_value = 0x00410000,
93 .cpu_name = "POWER3 (630+)", 89 .cpu_name = "POWER3 (630+)",
94 .cpu_features = CPU_FTRS_POWER3, 90 .cpu_features = CPU_FTRS_POWER3,
95 .cpu_user_features = COMMON_USER_PPC64, 91 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
96 .icache_bsize = 128, 92 .icache_bsize = 128,
97 .dcache_bsize = 128, 93 .dcache_bsize = 128,
98 .num_pmcs = 8, 94 .num_pmcs = 8,
99 .cpu_setup = __setup_cpu_power3,
100 .oprofile_cpu_type = "ppc64/power3", 95 .oprofile_cpu_type = "ppc64/power3",
101 .oprofile_type = PPC_OPROFILE_RS64, 96 .oprofile_type = PPC_OPROFILE_RS64,
102 .platform = "power3", 97 .platform = "power3",
@@ -110,7 +105,6 @@ struct cpu_spec cpu_specs[] = {
110 .icache_bsize = 128, 105 .icache_bsize = 128,
111 .dcache_bsize = 128, 106 .dcache_bsize = 128,
112 .num_pmcs = 8, 107 .num_pmcs = 8,
113 .cpu_setup = __setup_cpu_power3,
114 .oprofile_cpu_type = "ppc64/rs64", 108 .oprofile_cpu_type = "ppc64/rs64",
115 .oprofile_type = PPC_OPROFILE_RS64, 109 .oprofile_type = PPC_OPROFILE_RS64,
116 .platform = "rs64", 110 .platform = "rs64",
@@ -124,7 +118,6 @@ struct cpu_spec cpu_specs[] = {
124 .icache_bsize = 128, 118 .icache_bsize = 128,
125 .dcache_bsize = 128, 119 .dcache_bsize = 128,
126 .num_pmcs = 8, 120 .num_pmcs = 8,
127 .cpu_setup = __setup_cpu_power3,
128 .oprofile_cpu_type = "ppc64/rs64", 121 .oprofile_cpu_type = "ppc64/rs64",
129 .oprofile_type = PPC_OPROFILE_RS64, 122 .oprofile_type = PPC_OPROFILE_RS64,
130 .platform = "rs64", 123 .platform = "rs64",
@@ -138,7 +131,6 @@ struct cpu_spec cpu_specs[] = {
138 .icache_bsize = 128, 131 .icache_bsize = 128,
139 .dcache_bsize = 128, 132 .dcache_bsize = 128,
140 .num_pmcs = 8, 133 .num_pmcs = 8,
141 .cpu_setup = __setup_cpu_power3,
142 .oprofile_cpu_type = "ppc64/rs64", 134 .oprofile_cpu_type = "ppc64/rs64",
143 .oprofile_type = PPC_OPROFILE_RS64, 135 .oprofile_type = PPC_OPROFILE_RS64,
144 .platform = "rs64", 136 .platform = "rs64",
@@ -152,7 +144,6 @@ struct cpu_spec cpu_specs[] = {
152 .icache_bsize = 128, 144 .icache_bsize = 128,
153 .dcache_bsize = 128, 145 .dcache_bsize = 128,
154 .num_pmcs = 8, 146 .num_pmcs = 8,
155 .cpu_setup = __setup_cpu_power3,
156 .oprofile_cpu_type = "ppc64/rs64", 147 .oprofile_cpu_type = "ppc64/rs64",
157 .oprofile_type = PPC_OPROFILE_RS64, 148 .oprofile_type = PPC_OPROFILE_RS64,
158 .platform = "rs64", 149 .platform = "rs64",
@@ -166,7 +157,6 @@ struct cpu_spec cpu_specs[] = {
166 .icache_bsize = 128, 157 .icache_bsize = 128,
167 .dcache_bsize = 128, 158 .dcache_bsize = 128,
168 .num_pmcs = 8, 159 .num_pmcs = 8,
169 .cpu_setup = __setup_cpu_power4,
170 .oprofile_cpu_type = "ppc64/power4", 160 .oprofile_cpu_type = "ppc64/power4",
171 .oprofile_type = PPC_OPROFILE_POWER4, 161 .oprofile_type = PPC_OPROFILE_POWER4,
172 .platform = "power4", 162 .platform = "power4",
@@ -180,7 +170,6 @@ struct cpu_spec cpu_specs[] = {
180 .icache_bsize = 128, 170 .icache_bsize = 128,
181 .dcache_bsize = 128, 171 .dcache_bsize = 128,
182 .num_pmcs = 8, 172 .num_pmcs = 8,
183 .cpu_setup = __setup_cpu_power4,
184 .oprofile_cpu_type = "ppc64/power4", 173 .oprofile_cpu_type = "ppc64/power4",
185 .oprofile_type = PPC_OPROFILE_POWER4, 174 .oprofile_type = PPC_OPROFILE_POWER4,
186 .platform = "power4", 175 .platform = "power4",
@@ -200,17 +189,11 @@ struct cpu_spec cpu_specs[] = {
200 .oprofile_type = PPC_OPROFILE_POWER4, 189 .oprofile_type = PPC_OPROFILE_POWER4,
201 .platform = "ppc970", 190 .platform = "ppc970",
202 }, 191 },
203#endif /* CONFIG_PPC64 */
204#if defined(CONFIG_PPC64) || defined(CONFIG_POWER4)
205 { /* PPC970FX */ 192 { /* PPC970FX */
206 .pvr_mask = 0xffff0000, 193 .pvr_mask = 0xffff0000,
207 .pvr_value = 0x003c0000, 194 .pvr_value = 0x003c0000,
208 .cpu_name = "PPC970FX", 195 .cpu_name = "PPC970FX",
209#ifdef CONFIG_PPC32
210 .cpu_features = CPU_FTRS_970_32,
211#else
212 .cpu_features = CPU_FTRS_PPC970, 196 .cpu_features = CPU_FTRS_PPC970,
213#endif
214 .cpu_user_features = COMMON_USER_POWER4 | 197 .cpu_user_features = COMMON_USER_POWER4 |
215 PPC_FEATURE_HAS_ALTIVEC_COMP, 198 PPC_FEATURE_HAS_ALTIVEC_COMP,
216 .icache_bsize = 128, 199 .icache_bsize = 128,
@@ -221,8 +204,6 @@ struct cpu_spec cpu_specs[] = {
221 .oprofile_type = PPC_OPROFILE_POWER4, 204 .oprofile_type = PPC_OPROFILE_POWER4,
222 .platform = "ppc970", 205 .platform = "ppc970",
223 }, 206 },
224#endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */
225#ifdef CONFIG_PPC64
226 { /* PPC970MP */ 207 { /* PPC970MP */
227 .pvr_mask = 0xffff0000, 208 .pvr_mask = 0xffff0000,
228 .pvr_value = 0x00440000, 209 .pvr_value = 0x00440000,
@@ -232,6 +213,7 @@ struct cpu_spec cpu_specs[] = {
232 PPC_FEATURE_HAS_ALTIVEC_COMP, 213 PPC_FEATURE_HAS_ALTIVEC_COMP,
233 .icache_bsize = 128, 214 .icache_bsize = 128,
234 .dcache_bsize = 128, 215 .dcache_bsize = 128,
216 .num_pmcs = 8,
235 .cpu_setup = __setup_cpu_ppc970, 217 .cpu_setup = __setup_cpu_ppc970,
236 .oprofile_cpu_type = "ppc64/970", 218 .oprofile_cpu_type = "ppc64/970",
237 .oprofile_type = PPC_OPROFILE_POWER4, 219 .oprofile_type = PPC_OPROFILE_POWER4,
@@ -246,9 +228,13 @@ struct cpu_spec cpu_specs[] = {
246 .icache_bsize = 128, 228 .icache_bsize = 128,
247 .dcache_bsize = 128, 229 .dcache_bsize = 128,
248 .num_pmcs = 6, 230 .num_pmcs = 6,
249 .cpu_setup = __setup_cpu_power4,
250 .oprofile_cpu_type = "ppc64/power5", 231 .oprofile_cpu_type = "ppc64/power5",
251 .oprofile_type = PPC_OPROFILE_POWER4, 232 .oprofile_type = PPC_OPROFILE_POWER4,
233 /* SIHV / SIPR bits are implemented on POWER4+ (GQ)
234 * and above but only works on POWER5 and above
235 */
236 .oprofile_mmcra_sihv = MMCRA_SIHV,
237 .oprofile_mmcra_sipr = MMCRA_SIPR,
252 .platform = "power5", 238 .platform = "power5",
253 }, 239 },
254 { /* Power5 GS */ 240 { /* Power5 GS */
@@ -260,9 +246,10 @@ struct cpu_spec cpu_specs[] = {
260 .icache_bsize = 128, 246 .icache_bsize = 128,
261 .dcache_bsize = 128, 247 .dcache_bsize = 128,
262 .num_pmcs = 6, 248 .num_pmcs = 6,
263 .cpu_setup = __setup_cpu_power4,
264 .oprofile_cpu_type = "ppc64/power5+", 249 .oprofile_cpu_type = "ppc64/power5+",
265 .oprofile_type = PPC_OPROFILE_POWER4, 250 .oprofile_type = PPC_OPROFILE_POWER4,
251 .oprofile_mmcra_sihv = MMCRA_SIHV,
252 .oprofile_mmcra_sipr = MMCRA_SIPR,
266 .platform = "power5+", 253 .platform = "power5+",
267 }, 254 },
268 { /* Power6 */ 255 { /* Power6 */
@@ -273,10 +260,13 @@ struct cpu_spec cpu_specs[] = {
273 .cpu_user_features = COMMON_USER_POWER6, 260 .cpu_user_features = COMMON_USER_POWER6,
274 .icache_bsize = 128, 261 .icache_bsize = 128,
275 .dcache_bsize = 128, 262 .dcache_bsize = 128,
276 .num_pmcs = 6, 263 .num_pmcs = 8,
277 .cpu_setup = __setup_cpu_power4,
278 .oprofile_cpu_type = "ppc64/power6", 264 .oprofile_cpu_type = "ppc64/power6",
279 .oprofile_type = PPC_OPROFILE_POWER4, 265 .oprofile_type = PPC_OPROFILE_POWER4,
266 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
267 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
268 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
269 POWER6_MMCRA_OTHER,
280 .platform = "power6", 270 .platform = "power6",
281 }, 271 },
282 { /* Cell Broadband Engine */ 272 { /* Cell Broadband Engine */
@@ -289,7 +279,6 @@ struct cpu_spec cpu_specs[] = {
289 PPC_FEATURE_SMT, 279 PPC_FEATURE_SMT,
290 .icache_bsize = 128, 280 .icache_bsize = 128,
291 .dcache_bsize = 128, 281 .dcache_bsize = 128,
292 .cpu_setup = __setup_cpu_be,
293 .platform = "ppc-cell-be", 282 .platform = "ppc-cell-be",
294 }, 283 },
295 { /* default match */ 284 { /* default match */
@@ -301,7 +290,6 @@ struct cpu_spec cpu_specs[] = {
301 .icache_bsize = 128, 290 .icache_bsize = 128,
302 .dcache_bsize = 128, 291 .dcache_bsize = 128,
303 .num_pmcs = 6, 292 .num_pmcs = 6,
304 .cpu_setup = __setup_cpu_power4,
305 .platform = "power4", 293 .platform = "power4",
306 } 294 }
307#endif /* CONFIG_PPC64 */ 295#endif /* CONFIG_PPC64 */
@@ -323,7 +311,7 @@ struct cpu_spec cpu_specs[] = {
323 .pvr_value = 0x00030000, 311 .pvr_value = 0x00030000,
324 .cpu_name = "603", 312 .cpu_name = "603",
325 .cpu_features = CPU_FTRS_603, 313 .cpu_features = CPU_FTRS_603,
326 .cpu_user_features = COMMON_USER, 314 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
327 .icache_bsize = 32, 315 .icache_bsize = 32,
328 .dcache_bsize = 32, 316 .dcache_bsize = 32,
329 .cpu_setup = __setup_cpu_603, 317 .cpu_setup = __setup_cpu_603,
@@ -334,7 +322,7 @@ struct cpu_spec cpu_specs[] = {
334 .pvr_value = 0x00060000, 322 .pvr_value = 0x00060000,
335 .cpu_name = "603e", 323 .cpu_name = "603e",
336 .cpu_features = CPU_FTRS_603, 324 .cpu_features = CPU_FTRS_603,
337 .cpu_user_features = COMMON_USER, 325 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
338 .icache_bsize = 32, 326 .icache_bsize = 32,
339 .dcache_bsize = 32, 327 .dcache_bsize = 32,
340 .cpu_setup = __setup_cpu_603, 328 .cpu_setup = __setup_cpu_603,
@@ -345,7 +333,7 @@ struct cpu_spec cpu_specs[] = {
345 .pvr_value = 0x00070000, 333 .pvr_value = 0x00070000,
346 .cpu_name = "603ev", 334 .cpu_name = "603ev",
347 .cpu_features = CPU_FTRS_603, 335 .cpu_features = CPU_FTRS_603,
348 .cpu_user_features = COMMON_USER, 336 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
349 .icache_bsize = 32, 337 .icache_bsize = 32,
350 .dcache_bsize = 32, 338 .dcache_bsize = 32,
351 .cpu_setup = __setup_cpu_603, 339 .cpu_setup = __setup_cpu_603,
@@ -356,7 +344,7 @@ struct cpu_spec cpu_specs[] = {
356 .pvr_value = 0x00040000, 344 .pvr_value = 0x00040000,
357 .cpu_name = "604", 345 .cpu_name = "604",
358 .cpu_features = CPU_FTRS_604, 346 .cpu_features = CPU_FTRS_604,
359 .cpu_user_features = COMMON_USER, 347 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
360 .icache_bsize = 32, 348 .icache_bsize = 32,
361 .dcache_bsize = 32, 349 .dcache_bsize = 32,
362 .num_pmcs = 2, 350 .num_pmcs = 2,
@@ -368,7 +356,7 @@ struct cpu_spec cpu_specs[] = {
368 .pvr_value = 0x00090000, 356 .pvr_value = 0x00090000,
369 .cpu_name = "604e", 357 .cpu_name = "604e",
370 .cpu_features = CPU_FTRS_604, 358 .cpu_features = CPU_FTRS_604,
371 .cpu_user_features = COMMON_USER, 359 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
372 .icache_bsize = 32, 360 .icache_bsize = 32,
373 .dcache_bsize = 32, 361 .dcache_bsize = 32,
374 .num_pmcs = 4, 362 .num_pmcs = 4,
@@ -380,7 +368,7 @@ struct cpu_spec cpu_specs[] = {
380 .pvr_value = 0x00090000, 368 .pvr_value = 0x00090000,
381 .cpu_name = "604r", 369 .cpu_name = "604r",
382 .cpu_features = CPU_FTRS_604, 370 .cpu_features = CPU_FTRS_604,
383 .cpu_user_features = COMMON_USER, 371 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
384 .icache_bsize = 32, 372 .icache_bsize = 32,
385 .dcache_bsize = 32, 373 .dcache_bsize = 32,
386 .num_pmcs = 4, 374 .num_pmcs = 4,
@@ -392,7 +380,7 @@ struct cpu_spec cpu_specs[] = {
392 .pvr_value = 0x000a0000, 380 .pvr_value = 0x000a0000,
393 .cpu_name = "604ev", 381 .cpu_name = "604ev",
394 .cpu_features = CPU_FTRS_604, 382 .cpu_features = CPU_FTRS_604,
395 .cpu_user_features = COMMON_USER, 383 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
396 .icache_bsize = 32, 384 .icache_bsize = 32,
397 .dcache_bsize = 32, 385 .dcache_bsize = 32,
398 .num_pmcs = 4, 386 .num_pmcs = 4,
@@ -404,7 +392,7 @@ struct cpu_spec cpu_specs[] = {
404 .pvr_value = 0x00084202, 392 .pvr_value = 0x00084202,
405 .cpu_name = "740/750", 393 .cpu_name = "740/750",
406 .cpu_features = CPU_FTRS_740_NOTAU, 394 .cpu_features = CPU_FTRS_740_NOTAU,
407 .cpu_user_features = COMMON_USER, 395 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
408 .icache_bsize = 32, 396 .icache_bsize = 32,
409 .dcache_bsize = 32, 397 .dcache_bsize = 32,
410 .num_pmcs = 4, 398 .num_pmcs = 4,
@@ -416,7 +404,7 @@ struct cpu_spec cpu_specs[] = {
416 .pvr_value = 0x00080100, 404 .pvr_value = 0x00080100,
417 .cpu_name = "750CX", 405 .cpu_name = "750CX",
418 .cpu_features = CPU_FTRS_750, 406 .cpu_features = CPU_FTRS_750,
419 .cpu_user_features = COMMON_USER, 407 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
420 .icache_bsize = 32, 408 .icache_bsize = 32,
421 .dcache_bsize = 32, 409 .dcache_bsize = 32,
422 .num_pmcs = 4, 410 .num_pmcs = 4,
@@ -428,7 +416,7 @@ struct cpu_spec cpu_specs[] = {
428 .pvr_value = 0x00082200, 416 .pvr_value = 0x00082200,
429 .cpu_name = "750CX", 417 .cpu_name = "750CX",
430 .cpu_features = CPU_FTRS_750, 418 .cpu_features = CPU_FTRS_750,
431 .cpu_user_features = COMMON_USER, 419 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
432 .icache_bsize = 32, 420 .icache_bsize = 32,
433 .dcache_bsize = 32, 421 .dcache_bsize = 32,
434 .num_pmcs = 4, 422 .num_pmcs = 4,
@@ -440,7 +428,7 @@ struct cpu_spec cpu_specs[] = {
440 .pvr_value = 0x00082210, 428 .pvr_value = 0x00082210,
441 .cpu_name = "750CXe", 429 .cpu_name = "750CXe",
442 .cpu_features = CPU_FTRS_750, 430 .cpu_features = CPU_FTRS_750,
443 .cpu_user_features = COMMON_USER, 431 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
444 .icache_bsize = 32, 432 .icache_bsize = 32,
445 .dcache_bsize = 32, 433 .dcache_bsize = 32,
446 .num_pmcs = 4, 434 .num_pmcs = 4,
@@ -452,7 +440,7 @@ struct cpu_spec cpu_specs[] = {
452 .pvr_value = 0x00083214, 440 .pvr_value = 0x00083214,
453 .cpu_name = "750CXe", 441 .cpu_name = "750CXe",
454 .cpu_features = CPU_FTRS_750, 442 .cpu_features = CPU_FTRS_750,
455 .cpu_user_features = COMMON_USER, 443 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
456 .icache_bsize = 32, 444 .icache_bsize = 32,
457 .dcache_bsize = 32, 445 .dcache_bsize = 32,
458 .num_pmcs = 4, 446 .num_pmcs = 4,
@@ -464,7 +452,7 @@ struct cpu_spec cpu_specs[] = {
464 .pvr_value = 0x00083000, 452 .pvr_value = 0x00083000,
465 .cpu_name = "745/755", 453 .cpu_name = "745/755",
466 .cpu_features = CPU_FTRS_750, 454 .cpu_features = CPU_FTRS_750,
467 .cpu_user_features = COMMON_USER, 455 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
468 .icache_bsize = 32, 456 .icache_bsize = 32,
469 .dcache_bsize = 32, 457 .dcache_bsize = 32,
470 .num_pmcs = 4, 458 .num_pmcs = 4,
@@ -476,7 +464,7 @@ struct cpu_spec cpu_specs[] = {
476 .pvr_value = 0x70000100, 464 .pvr_value = 0x70000100,
477 .cpu_name = "750FX", 465 .cpu_name = "750FX",
478 .cpu_features = CPU_FTRS_750FX1, 466 .cpu_features = CPU_FTRS_750FX1,
479 .cpu_user_features = COMMON_USER, 467 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
480 .icache_bsize = 32, 468 .icache_bsize = 32,
481 .dcache_bsize = 32, 469 .dcache_bsize = 32,
482 .num_pmcs = 4, 470 .num_pmcs = 4,
@@ -488,7 +476,7 @@ struct cpu_spec cpu_specs[] = {
488 .pvr_value = 0x70000200, 476 .pvr_value = 0x70000200,
489 .cpu_name = "750FX", 477 .cpu_name = "750FX",
490 .cpu_features = CPU_FTRS_750FX2, 478 .cpu_features = CPU_FTRS_750FX2,
491 .cpu_user_features = COMMON_USER, 479 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
492 .icache_bsize = 32, 480 .icache_bsize = 32,
493 .dcache_bsize = 32, 481 .dcache_bsize = 32,
494 .num_pmcs = 4, 482 .num_pmcs = 4,
@@ -500,7 +488,7 @@ struct cpu_spec cpu_specs[] = {
500 .pvr_value = 0x70000000, 488 .pvr_value = 0x70000000,
501 .cpu_name = "750FX", 489 .cpu_name = "750FX",
502 .cpu_features = CPU_FTRS_750FX, 490 .cpu_features = CPU_FTRS_750FX,
503 .cpu_user_features = COMMON_USER, 491 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
504 .icache_bsize = 32, 492 .icache_bsize = 32,
505 .dcache_bsize = 32, 493 .dcache_bsize = 32,
506 .num_pmcs = 4, 494 .num_pmcs = 4,
@@ -512,7 +500,7 @@ struct cpu_spec cpu_specs[] = {
512 .pvr_value = 0x70020000, 500 .pvr_value = 0x70020000,
513 .cpu_name = "750GX", 501 .cpu_name = "750GX",
514 .cpu_features = CPU_FTRS_750GX, 502 .cpu_features = CPU_FTRS_750GX,
515 .cpu_user_features = COMMON_USER, 503 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
516 .icache_bsize = 32, 504 .icache_bsize = 32,
517 .dcache_bsize = 32, 505 .dcache_bsize = 32,
518 .num_pmcs = 4, 506 .num_pmcs = 4,
@@ -524,7 +512,7 @@ struct cpu_spec cpu_specs[] = {
524 .pvr_value = 0x00080000, 512 .pvr_value = 0x00080000,
525 .cpu_name = "740/750", 513 .cpu_name = "740/750",
526 .cpu_features = CPU_FTRS_740, 514 .cpu_features = CPU_FTRS_740,
527 .cpu_user_features = COMMON_USER, 515 .cpu_user_features = COMMON_USER | PPC_FEATURE_PPC_LE,
528 .icache_bsize = 32, 516 .icache_bsize = 32,
529 .dcache_bsize = 32, 517 .dcache_bsize = 32,
530 .num_pmcs = 4, 518 .num_pmcs = 4,
@@ -536,7 +524,8 @@ struct cpu_spec cpu_specs[] = {
536 .pvr_value = 0x000c1101, 524 .pvr_value = 0x000c1101,
537 .cpu_name = "7400 (1.1)", 525 .cpu_name = "7400 (1.1)",
538 .cpu_features = CPU_FTRS_7400_NOTAU, 526 .cpu_features = CPU_FTRS_7400_NOTAU,
539 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 527 .cpu_user_features = COMMON_USER |
528 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
540 .icache_bsize = 32, 529 .icache_bsize = 32,
541 .dcache_bsize = 32, 530 .dcache_bsize = 32,
542 .num_pmcs = 4, 531 .num_pmcs = 4,
@@ -548,7 +537,8 @@ struct cpu_spec cpu_specs[] = {
548 .pvr_value = 0x000c0000, 537 .pvr_value = 0x000c0000,
549 .cpu_name = "7400", 538 .cpu_name = "7400",
550 .cpu_features = CPU_FTRS_7400, 539 .cpu_features = CPU_FTRS_7400,
551 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 540 .cpu_user_features = COMMON_USER |
541 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
552 .icache_bsize = 32, 542 .icache_bsize = 32,
553 .dcache_bsize = 32, 543 .dcache_bsize = 32,
554 .num_pmcs = 4, 544 .num_pmcs = 4,
@@ -560,7 +550,8 @@ struct cpu_spec cpu_specs[] = {
560 .pvr_value = 0x800c0000, 550 .pvr_value = 0x800c0000,
561 .cpu_name = "7410", 551 .cpu_name = "7410",
562 .cpu_features = CPU_FTRS_7400, 552 .cpu_features = CPU_FTRS_7400,
563 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 553 .cpu_user_features = COMMON_USER |
554 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
564 .icache_bsize = 32, 555 .icache_bsize = 32,
565 .dcache_bsize = 32, 556 .dcache_bsize = 32,
566 .num_pmcs = 4, 557 .num_pmcs = 4,
@@ -572,7 +563,8 @@ struct cpu_spec cpu_specs[] = {
572 .pvr_value = 0x80000200, 563 .pvr_value = 0x80000200,
573 .cpu_name = "7450", 564 .cpu_name = "7450",
574 .cpu_features = CPU_FTRS_7450_20, 565 .cpu_features = CPU_FTRS_7450_20,
575 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 566 .cpu_user_features = COMMON_USER |
567 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
576 .icache_bsize = 32, 568 .icache_bsize = 32,
577 .dcache_bsize = 32, 569 .dcache_bsize = 32,
578 .num_pmcs = 6, 570 .num_pmcs = 6,
@@ -586,7 +578,8 @@ struct cpu_spec cpu_specs[] = {
586 .pvr_value = 0x80000201, 578 .pvr_value = 0x80000201,
587 .cpu_name = "7450", 579 .cpu_name = "7450",
588 .cpu_features = CPU_FTRS_7450_21, 580 .cpu_features = CPU_FTRS_7450_21,
589 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 581 .cpu_user_features = COMMON_USER |
582 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
590 .icache_bsize = 32, 583 .icache_bsize = 32,
591 .dcache_bsize = 32, 584 .dcache_bsize = 32,
592 .num_pmcs = 6, 585 .num_pmcs = 6,
@@ -600,7 +593,8 @@ struct cpu_spec cpu_specs[] = {
600 .pvr_value = 0x80000000, 593 .pvr_value = 0x80000000,
601 .cpu_name = "7450", 594 .cpu_name = "7450",
602 .cpu_features = CPU_FTRS_7450_23, 595 .cpu_features = CPU_FTRS_7450_23,
603 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 596 .cpu_user_features = COMMON_USER |
597 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
604 .icache_bsize = 32, 598 .icache_bsize = 32,
605 .dcache_bsize = 32, 599 .dcache_bsize = 32,
606 .num_pmcs = 6, 600 .num_pmcs = 6,
@@ -614,7 +608,8 @@ struct cpu_spec cpu_specs[] = {
614 .pvr_value = 0x80010100, 608 .pvr_value = 0x80010100,
615 .cpu_name = "7455", 609 .cpu_name = "7455",
616 .cpu_features = CPU_FTRS_7455_1, 610 .cpu_features = CPU_FTRS_7455_1,
617 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 611 .cpu_user_features = COMMON_USER |
612 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
618 .icache_bsize = 32, 613 .icache_bsize = 32,
619 .dcache_bsize = 32, 614 .dcache_bsize = 32,
620 .num_pmcs = 6, 615 .num_pmcs = 6,
@@ -628,7 +623,8 @@ struct cpu_spec cpu_specs[] = {
628 .pvr_value = 0x80010200, 623 .pvr_value = 0x80010200,
629 .cpu_name = "7455", 624 .cpu_name = "7455",
630 .cpu_features = CPU_FTRS_7455_20, 625 .cpu_features = CPU_FTRS_7455_20,
631 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 626 .cpu_user_features = COMMON_USER |
627 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
632 .icache_bsize = 32, 628 .icache_bsize = 32,
633 .dcache_bsize = 32, 629 .dcache_bsize = 32,
634 .num_pmcs = 6, 630 .num_pmcs = 6,
@@ -642,7 +638,8 @@ struct cpu_spec cpu_specs[] = {
642 .pvr_value = 0x80010000, 638 .pvr_value = 0x80010000,
643 .cpu_name = "7455", 639 .cpu_name = "7455",
644 .cpu_features = CPU_FTRS_7455, 640 .cpu_features = CPU_FTRS_7455,
645 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 641 .cpu_user_features = COMMON_USER |
642 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
646 .icache_bsize = 32, 643 .icache_bsize = 32,
647 .dcache_bsize = 32, 644 .dcache_bsize = 32,
648 .num_pmcs = 6, 645 .num_pmcs = 6,
@@ -656,7 +653,8 @@ struct cpu_spec cpu_specs[] = {
656 .pvr_value = 0x80020100, 653 .pvr_value = 0x80020100,
657 .cpu_name = "7447/7457", 654 .cpu_name = "7447/7457",
658 .cpu_features = CPU_FTRS_7447_10, 655 .cpu_features = CPU_FTRS_7447_10,
659 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 656 .cpu_user_features = COMMON_USER |
657 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
660 .icache_bsize = 32, 658 .icache_bsize = 32,
661 .dcache_bsize = 32, 659 .dcache_bsize = 32,
662 .num_pmcs = 6, 660 .num_pmcs = 6,
@@ -670,7 +668,8 @@ struct cpu_spec cpu_specs[] = {
670 .pvr_value = 0x80020101, 668 .pvr_value = 0x80020101,
671 .cpu_name = "7447/7457", 669 .cpu_name = "7447/7457",
672 .cpu_features = CPU_FTRS_7447_10, 670 .cpu_features = CPU_FTRS_7447_10,
673 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 671 .cpu_user_features = COMMON_USER |
672 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
674 .icache_bsize = 32, 673 .icache_bsize = 32,
675 .dcache_bsize = 32, 674 .dcache_bsize = 32,
676 .num_pmcs = 6, 675 .num_pmcs = 6,
@@ -684,7 +683,7 @@ struct cpu_spec cpu_specs[] = {
684 .pvr_value = 0x80020000, 683 .pvr_value = 0x80020000,
685 .cpu_name = "7447/7457", 684 .cpu_name = "7447/7457",
686 .cpu_features = CPU_FTRS_7447, 685 .cpu_features = CPU_FTRS_7447,
687 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 686 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
688 .icache_bsize = 32, 687 .icache_bsize = 32,
689 .dcache_bsize = 32, 688 .dcache_bsize = 32,
690 .num_pmcs = 6, 689 .num_pmcs = 6,
@@ -698,7 +697,8 @@ struct cpu_spec cpu_specs[] = {
698 .pvr_value = 0x80030000, 697 .pvr_value = 0x80030000,
699 .cpu_name = "7447A", 698 .cpu_name = "7447A",
700 .cpu_features = CPU_FTRS_7447A, 699 .cpu_features = CPU_FTRS_7447A,
701 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 700 .cpu_user_features = COMMON_USER |
701 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
702 .icache_bsize = 32, 702 .icache_bsize = 32,
703 .dcache_bsize = 32, 703 .dcache_bsize = 32,
704 .num_pmcs = 6, 704 .num_pmcs = 6,
@@ -712,7 +712,8 @@ struct cpu_spec cpu_specs[] = {
712 .pvr_value = 0x80040000, 712 .pvr_value = 0x80040000,
713 .cpu_name = "7448", 713 .cpu_name = "7448",
714 .cpu_features = CPU_FTRS_7447A, 714 .cpu_features = CPU_FTRS_7447A,
715 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP, 715 .cpu_user_features = COMMON_USER |
716 PPC_FEATURE_HAS_ALTIVEC_COMP | PPC_FEATURE_PPC_LE,
716 .icache_bsize = 32, 717 .icache_bsize = 32,
717 .dcache_bsize = 32, 718 .dcache_bsize = 32,
718 .num_pmcs = 6, 719 .num_pmcs = 6,
@@ -721,6 +722,18 @@ struct cpu_spec cpu_specs[] = {
721 .oprofile_type = PPC_OPROFILE_G4, 722 .oprofile_type = PPC_OPROFILE_G4,
722 .platform = "ppc7450", 723 .platform = "ppc7450",
723 }, 724 },
725 { /* 8641 */
726 .pvr_mask = 0xffffffff,
727 .pvr_value = 0x80040010,
728 .cpu_name = "8641",
729 .cpu_features = CPU_FTRS_7447A,
730 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP,
731 .icache_bsize = 32,
732 .dcache_bsize = 32,
733 .num_pmcs = 6,
734 .cpu_setup = __setup_cpu_745x
735 },
736
724 { /* 82xx (8240, 8245, 8260 are all 603e cores) */ 737 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
725 .pvr_mask = 0x7fff0000, 738 .pvr_mask = 0x7fff0000,
726 .pvr_value = 0x00810000, 739 .pvr_value = 0x00810000,
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 778f22fd85d2..dbcb85994f46 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -22,6 +22,7 @@
22#include <linux/elf.h> 22#include <linux/elf.h>
23#include <linux/elfcore.h> 23#include <linux/elfcore.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/irq.h>
25#include <linux/types.h> 26#include <linux/types.h>
26 27
27#include <asm/processor.h> 28#include <asm/processor.h>
@@ -174,6 +175,8 @@ static void crash_kexec_prepare_cpus(void)
174 175
175void default_machine_crash_shutdown(struct pt_regs *regs) 176void default_machine_crash_shutdown(struct pt_regs *regs)
176{ 177{
178 unsigned int irq;
179
177 /* 180 /*
178 * This function is only called after the system 181 * This function is only called after the system
179 * has paniced or is otherwise in a critical state. 182 * has paniced or is otherwise in a critical state.
@@ -186,6 +189,16 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
186 */ 189 */
187 local_irq_disable(); 190 local_irq_disable();
188 191
192 for_each_irq(irq) {
193 struct irq_desc *desc = irq_descp(irq);
194
195 if (desc->status & IRQ_INPROGRESS)
196 desc->handler->end(irq);
197
198 if (!(desc->status & IRQ_DISABLED))
199 desc->handler->disable(irq);
200 }
201
189 if (ppc_md.kexec_cpu_down) 202 if (ppc_md.kexec_cpu_down)
190 ppc_md.kexec_cpu_down(1, 0); 203 ppc_md.kexec_cpu_down(1, 0);
191 204
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 764d07329716..371973be8d71 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -25,6 +25,11 @@
25#define DBG(fmt...) 25#define DBG(fmt...)
26#endif 26#endif
27 27
28void reserve_kdump_trampoline(void)
29{
30 lmb_reserve(0, KDUMP_RESERVE_LIMIT);
31}
32
28static void __init create_trampoline(unsigned long addr) 33static void __init create_trampoline(unsigned long addr)
29{ 34{
30 /* The maximum range of a single instruction branch, is the current 35 /* The maximum range of a single instruction branch, is the current
@@ -39,11 +44,11 @@ static void __init create_trampoline(unsigned long addr)
39 create_branch(addr + 4, addr + PHYSICAL_START, 0); 44 create_branch(addr + 4, addr + PHYSICAL_START, 0);
40} 45}
41 46
42void __init kdump_setup(void) 47void __init setup_kdump_trampoline(void)
43{ 48{
44 unsigned long i; 49 unsigned long i;
45 50
46 DBG(" -> kdump_setup()\n"); 51 DBG(" -> setup_kdump_trampoline()\n");
47 52
48 for (i = KDUMP_TRAMPOLINE_START; i < KDUMP_TRAMPOLINE_END; i += 8) { 53 for (i = KDUMP_TRAMPOLINE_START; i < KDUMP_TRAMPOLINE_END; i += 8) {
49 create_trampoline(i); 54 create_trampoline(i);
@@ -52,7 +57,7 @@ void __init kdump_setup(void)
52 create_trampoline(__pa(system_reset_fwnmi) - PHYSICAL_START); 57 create_trampoline(__pa(system_reset_fwnmi) - PHYSICAL_START);
53 create_trampoline(__pa(machine_check_fwnmi) - PHYSICAL_START); 58 create_trampoline(__pa(machine_check_fwnmi) - PHYSICAL_START);
54 59
55 DBG(" <- kdump_setup()\n"); 60 DBG(" <- setup_kdump_trampoline()\n");
56} 61}
57 62
58#ifdef CONFIG_PROC_VMCORE 63#ifdef CONFIG_PROC_VMCORE
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 19ad5c6b1818..221062c960c9 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -57,6 +57,7 @@ system_call_common:
57 beq- 1f 57 beq- 1f
58 ld r1,PACAKSAVE(r13) 58 ld r1,PACAKSAVE(r13)
591: std r10,0(r1) 591: std r10,0(r1)
60 crclr so
60 std r11,_NIP(r1) 61 std r11,_NIP(r1)
61 std r12,_MSR(r1) 62 std r12,_MSR(r1)
62 std r0,GPR0(r1) 63 std r0,GPR0(r1)
@@ -75,7 +76,6 @@ system_call_common:
75 std r11,GPR11(r1) 76 std r11,GPR11(r1)
76 std r11,GPR12(r1) 77 std r11,GPR12(r1)
77 std r9,GPR13(r1) 78 std r9,GPR13(r1)
78 crclr so
79 mfcr r9 79 mfcr r9
80 mflr r10 80 mflr r10
81 li r11,0xc01 81 li r11,0xc01
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index 340730fb8c91..01f71200c603 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -72,7 +72,7 @@ _GLOBAL(load_up_fpu)
72 std r12,_MSR(r1) 72 std r12,_MSR(r1)
73#endif 73#endif
74 lfd fr0,THREAD_FPSCR(r5) 74 lfd fr0,THREAD_FPSCR(r5)
75 mtfsf 0xff,fr0 75 MTFSF_L(fr0)
76 REST_32FPRS(0, r5) 76 REST_32FPRS(0, r5)
77#ifndef CONFIG_SMP 77#ifndef CONFIG_SMP
78 subi r4,r5,THREAD 78 subi r4,r5,THREAD
@@ -127,7 +127,7 @@ _GLOBAL(giveup_fpu)
127 127
128_GLOBAL(cvt_fd) 128_GLOBAL(cvt_fd)
129 lfd 0,THREAD_FPSCR(r5) /* load up fpscr value */ 129 lfd 0,THREAD_FPSCR(r5) /* load up fpscr value */
130 mtfsf 0xff,0 130 MTFSF_L(0)
131 lfs 0,0(r3) 131 lfs 0,0(r3)
132 stfd 0,0(r4) 132 stfd 0,0(r4)
133 mffs 0 133 mffs 0
@@ -136,7 +136,7 @@ _GLOBAL(cvt_fd)
136 136
137_GLOBAL(cvt_df) 137_GLOBAL(cvt_df)
138 lfd 0,THREAD_FPSCR(r5) /* load up fpscr value */ 138 lfd 0,THREAD_FPSCR(r5) /* load up fpscr value */
139 mtfsf 0xff,0 139 MTFSF_L(0)
140 lfd 0,0(r3) 140 lfd 0,0(r3)
141 stfs 0,0(r4) 141 stfs 0,0(r4)
142 mffs 0 142 mffs 0
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index a0579e859b21..b25b25902d15 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -973,6 +973,13 @@ __secondary_start_gemini:
973 b __secondary_start 973 b __secondary_start
974#endif /* CONFIG_GEMINI */ 974#endif /* CONFIG_GEMINI */
975 975
976 .globl __secondary_start_mpc86xx
977__secondary_start_mpc86xx:
978 mfspr r3, SPRN_PIR
979 stw r3, __secondary_hold_acknowledge@l(0)
980 mr r24, r3 /* cpu # */
981 b __secondary_start
982
976 .globl __secondary_start_pmac_0 983 .globl __secondary_start_pmac_0
977__secondary_start_pmac_0: 984__secondary_start_pmac_0:
978 /* NB the entries for cpus 0, 1, 2 must each occupy 8 bytes. */ 985 /* NB the entries for cpus 0, 1, 2 must each occupy 8 bytes. */
@@ -1088,7 +1095,12 @@ load_up_mmu:
1088 LOAD_BAT(1,r3,r4,r5) 1095 LOAD_BAT(1,r3,r4,r5)
1089 LOAD_BAT(2,r3,r4,r5) 1096 LOAD_BAT(2,r3,r4,r5)
1090 LOAD_BAT(3,r3,r4,r5) 1097 LOAD_BAT(3,r3,r4,r5)
1091 1098BEGIN_FTR_SECTION
1099 LOAD_BAT(4,r3,r4,r5)
1100 LOAD_BAT(5,r3,r4,r5)
1101 LOAD_BAT(6,r3,r4,r5)
1102 LOAD_BAT(7,r3,r4,r5)
1103END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS)
1092 blr 1104 blr
1093 1105
1094/* 1106/*
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index b7d140430a41..831acbdf2592 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -316,6 +316,21 @@ label##_pSeries: \
316 mtspr SPRN_SPRG1,r13; /* save r13 */ \ 316 mtspr SPRN_SPRG1,r13; /* save r13 */ \
317 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) 317 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
318 318
319#define HSTD_EXCEPTION_PSERIES(n, label) \
320 . = n; \
321 .globl label##_pSeries; \
322label##_pSeries: \
323 HMT_MEDIUM; \
324 mtspr SPRN_SPRG1,r20; /* save r20 */ \
325 mfspr r20,SPRN_HSRR0; /* copy HSRR0 to SRR0 */ \
326 mtspr SPRN_SRR0,r20; \
327 mfspr r20,SPRN_HSRR1; /* copy HSRR0 to SRR0 */ \
328 mtspr SPRN_SRR1,r20; \
329 mfspr r20,SPRN_SPRG1; /* restore r20 */ \
330 mtspr SPRN_SPRG1,r13; /* save r13 */ \
331 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
332
333
319#define STD_EXCEPTION_ISERIES(n, label, area) \ 334#define STD_EXCEPTION_ISERIES(n, label, area) \
320 .globl label##_iSeries; \ 335 .globl label##_iSeries; \
321label##_iSeries: \ 336label##_iSeries: \
@@ -544,8 +559,17 @@ system_call_pSeries:
544 559
545 STD_EXCEPTION_PSERIES(0xf20, altivec_unavailable) 560 STD_EXCEPTION_PSERIES(0xf20, altivec_unavailable)
546 561
562#ifdef CONFIG_CBE_RAS
563 HSTD_EXCEPTION_PSERIES(0x1200, cbe_system_error)
564#endif /* CONFIG_CBE_RAS */
547 STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint) 565 STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint)
566#ifdef CONFIG_CBE_RAS
567 HSTD_EXCEPTION_PSERIES(0x1600, cbe_maintenance)
568#endif /* CONFIG_CBE_RAS */
548 STD_EXCEPTION_PSERIES(0x1700, altivec_assist) 569 STD_EXCEPTION_PSERIES(0x1700, altivec_assist)
570#ifdef CONFIG_CBE_RAS
571 HSTD_EXCEPTION_PSERIES(0x1800, cbe_thermal)
572#endif /* CONFIG_CBE_RAS */
549 573
550 . = 0x3000 574 . = 0x3000
551 575
@@ -827,6 +851,11 @@ machine_check_common:
827#else 851#else
828 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .unknown_exception) 852 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .unknown_exception)
829#endif 853#endif
854#ifdef CONFIG_CBE_RAS
855 STD_EXCEPTION_COMMON(0x1200, cbe_system_error, .cbe_system_error_exception)
856 STD_EXCEPTION_COMMON(0x1600, cbe_maintenance, .cbe_maintenance_exception)
857 STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception)
858#endif /* CONFIG_CBE_RAS */
830 859
831/* 860/*
832 * Here we have detected that the kernel stack pointer is bad. 861 * Here we have detected that the kernel stack pointer is bad.
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index fd8214caedee..a13a93dfc655 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -106,8 +106,6 @@ EXPORT_SYMBOL(iowrite32_rep);
106 106
107void __iomem *ioport_map(unsigned long port, unsigned int len) 107void __iomem *ioport_map(unsigned long port, unsigned int len)
108{ 108{
109 if (!_IO_IS_VALID(port))
110 return NULL;
111 return (void __iomem *) (port+pci_io_base); 109 return (void __iomem *) (port+pci_io_base);
112} 110}
113 111
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 4eba60a32890..7cb77c20fc5d 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -418,10 +418,11 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
418 * Build a iommu_table structure. This contains a bit map which 418 * Build a iommu_table structure. This contains a bit map which
419 * is used to manage allocation of the tce space. 419 * is used to manage allocation of the tce space.
420 */ 420 */
421struct iommu_table *iommu_init_table(struct iommu_table *tbl) 421struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
422{ 422{
423 unsigned long sz; 423 unsigned long sz;
424 static int welcomed = 0; 424 static int welcomed = 0;
425 struct page *page;
425 426
426 /* Set aside 1/4 of the table for large allocations. */ 427 /* Set aside 1/4 of the table for large allocations. */
427 tbl->it_halfpoint = tbl->it_size * 3 / 4; 428 tbl->it_halfpoint = tbl->it_size * 3 / 4;
@@ -429,10 +430,10 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl)
429 /* number of bytes needed for the bitmap */ 430 /* number of bytes needed for the bitmap */
430 sz = (tbl->it_size + 7) >> 3; 431 sz = (tbl->it_size + 7) >> 3;
431 432
432 tbl->it_map = (unsigned long *)__get_free_pages(GFP_ATOMIC, get_order(sz)); 433 page = alloc_pages_node(nid, GFP_ATOMIC, get_order(sz));
433 if (!tbl->it_map) 434 if (!page)
434 panic("iommu_init_table: Can't allocate %ld bytes\n", sz); 435 panic("iommu_init_table: Can't allocate %ld bytes\n", sz);
435 436 tbl->it_map = page_address(page);
436 memset(tbl->it_map, 0, sz); 437 memset(tbl->it_map, 0, sz);
437 438
438 tbl->it_hint = 0; 439 tbl->it_hint = 0;
@@ -536,11 +537,12 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
536 * to the dma address (mapping) of the first page. 537 * to the dma address (mapping) of the first page.
537 */ 538 */
538void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, 539void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
539 dma_addr_t *dma_handle, unsigned long mask, gfp_t flag) 540 dma_addr_t *dma_handle, unsigned long mask, gfp_t flag, int node)
540{ 541{
541 void *ret = NULL; 542 void *ret = NULL;
542 dma_addr_t mapping; 543 dma_addr_t mapping;
543 unsigned int npages, order; 544 unsigned int npages, order;
545 struct page *page;
544 546
545 size = PAGE_ALIGN(size); 547 size = PAGE_ALIGN(size);
546 npages = size >> PAGE_SHIFT; 548 npages = size >> PAGE_SHIFT;
@@ -560,9 +562,10 @@ void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
560 return NULL; 562 return NULL;
561 563
562 /* Alloc enough pages (and possibly more) */ 564 /* Alloc enough pages (and possibly more) */
563 ret = (void *)__get_free_pages(flag, order); 565 page = alloc_pages_node(node, flag, order);
564 if (!ret) 566 if (!page)
565 return NULL; 567 return NULL;
568 ret = page_address(page);
566 memset(ret, 0, size); 569 memset(ret, 0, size);
567 570
568 /* Set up tces to cover the allocated range */ 571 /* Set up tces to cover the allocated range */
@@ -570,9 +573,9 @@ void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
570 mask >> PAGE_SHIFT, order); 573 mask >> PAGE_SHIFT, order);
571 if (mapping == DMA_ERROR_CODE) { 574 if (mapping == DMA_ERROR_CODE) {
572 free_pages((unsigned long)ret, order); 575 free_pages((unsigned long)ret, order);
573 ret = NULL; 576 return NULL;
574 } else 577 }
575 *dma_handle = mapping; 578 *dma_handle = mapping;
576 return ret; 579 return ret;
577} 580}
578 581
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 57d560c68897..40d4c14fde8f 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -47,6 +47,7 @@
47#include <linux/cpumask.h> 47#include <linux/cpumask.h>
48#include <linux/profile.h> 48#include <linux/profile.h>
49#include <linux/bitops.h> 49#include <linux/bitops.h>
50#include <linux/pci.h>
50 51
51#include <asm/uaccess.h> 52#include <asm/uaccess.h>
52#include <asm/system.h> 53#include <asm/system.h>
@@ -379,8 +380,8 @@ unsigned int real_irq_to_virt_slowpath(unsigned int real_irq)
379#endif /* CONFIG_PPC64 */ 380#endif /* CONFIG_PPC64 */
380 381
381#ifdef CONFIG_IRQSTACKS 382#ifdef CONFIG_IRQSTACKS
382struct thread_info *softirq_ctx[NR_CPUS]; 383struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
383struct thread_info *hardirq_ctx[NR_CPUS]; 384struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly;
384 385
385void irq_ctx_init(void) 386void irq_ctx_init(void)
386{ 387{
@@ -436,6 +437,30 @@ void do_softirq(void)
436} 437}
437EXPORT_SYMBOL(do_softirq); 438EXPORT_SYMBOL(do_softirq);
438 439
440#ifdef CONFIG_PCI_MSI
441int pci_enable_msi(struct pci_dev * pdev)
442{
443 if (ppc_md.enable_msi)
444 return ppc_md.enable_msi(pdev);
445 else
446 return -1;
447}
448
449void pci_disable_msi(struct pci_dev * pdev)
450{
451 if (ppc_md.disable_msi)
452 ppc_md.disable_msi(pdev);
453}
454
455void pci_scan_msi_device(struct pci_dev *dev) {}
456int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) {return -1;}
457void pci_disable_msix(struct pci_dev *dev) {}
458void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
459void disable_msi_mode(struct pci_dev *dev, int pos, int type) {}
460void pci_no_msi(void) {}
461
462#endif
463
439#ifdef CONFIG_PPC64 464#ifdef CONFIG_PPC64
440static int __init setup_noirqdistrib(char *str) 465static int __init setup_noirqdistrib(char *str)
441{ 466{
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 2cbde865d4f5..c02deaab26c7 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -521,10 +521,10 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
521 521
522 current_weight = (resource >> 5 * 8) & 0xFF; 522 current_weight = (resource >> 5 * 8) & 0xFF;
523 523
524 pr_debug("%s: current_entitled = %lu, current_weight = %lu\n", 524 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
525 __FUNCTION__, current_entitled, current_weight); 525 __FUNCTION__, current_entitled, current_weight);
526 526
527 pr_debug("%s: new_entitled = %lu, new_weight = %lu\n", 527 pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
528 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr); 528 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
529 529
530 retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr, 530 retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index ee166c586642..a8fa04ef27cd 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -21,6 +21,7 @@
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/paca.h> 23#include <asm/paca.h>
24#include <asm/lmb.h>
24#include <asm/mmu.h> 25#include <asm/mmu.h>
25#include <asm/sections.h> /* _end */ 26#include <asm/sections.h> /* _end */
26#include <asm/prom.h> 27#include <asm/prom.h>
@@ -335,7 +336,105 @@ static void __init export_htab_values(void)
335 of_node_put(node); 336 of_node_put(node);
336} 337}
337 338
339static struct property crashk_base_prop = {
340 .name = "linux,crashkernel-base",
341 .length = sizeof(unsigned long),
342 .value = (unsigned char *)&crashk_res.start,
343};
344
345static unsigned long crashk_size;
346
347static struct property crashk_size_prop = {
348 .name = "linux,crashkernel-size",
349 .length = sizeof(unsigned long),
350 .value = (unsigned char *)&crashk_size,
351};
352
353static void __init export_crashk_values(void)
354{
355 struct device_node *node;
356 struct property *prop;
357
358 node = of_find_node_by_path("/chosen");
359 if (!node)
360 return;
361
362 /* There might be existing crash kernel properties, but we can't
363 * be sure what's in them, so remove them. */
364 prop = of_find_property(node, "linux,crashkernel-base", NULL);
365 if (prop)
366 prom_remove_property(node, prop);
367
368 prop = of_find_property(node, "linux,crashkernel-size", NULL);
369 if (prop)
370 prom_remove_property(node, prop);
371
372 if (crashk_res.start != 0) {
373 prom_add_property(node, &crashk_base_prop);
374 crashk_size = crashk_res.end - crashk_res.start + 1;
375 prom_add_property(node, &crashk_size_prop);
376 }
377
378 of_node_put(node);
379}
380
338void __init kexec_setup(void) 381void __init kexec_setup(void)
339{ 382{
340 export_htab_values(); 383 export_htab_values();
384 export_crashk_values();
385}
386
387static int __init early_parse_crashk(char *p)
388{
389 unsigned long size;
390
391 if (!p)
392 return 1;
393
394 size = memparse(p, &p);
395
396 if (*p == '@')
397 crashk_res.start = memparse(p + 1, &p);
398 else
399 crashk_res.start = KDUMP_KERNELBASE;
400
401 crashk_res.end = crashk_res.start + size - 1;
402
403 return 0;
404}
405early_param("crashkernel", early_parse_crashk);
406
407void __init reserve_crashkernel(void)
408{
409 unsigned long size;
410
411 if (crashk_res.start == 0)
412 return;
413
414 /* We might have got these values via the command line or the
415 * device tree, either way sanitise them now. */
416
417 size = crashk_res.end - crashk_res.start + 1;
418
419 if (crashk_res.start != KDUMP_KERNELBASE)
420 printk("Crash kernel location must be 0x%x\n",
421 KDUMP_KERNELBASE);
422
423 crashk_res.start = KDUMP_KERNELBASE;
424 size = PAGE_ALIGN(size);
425 crashk_res.end = crashk_res.start + size - 1;
426
427 /* Crash kernel trumps memory limit */
428 if (memory_limit && memory_limit <= crashk_res.end) {
429 memory_limit = crashk_res.end + 1;
430 printk("Adjusted memory limit for crashkernel, now 0x%lx\n",
431 memory_limit);
432 }
433
434 lmb_reserve(crashk_res.start, size);
435}
436
437int overlaps_crashkernel(unsigned long start, unsigned long size)
438{
439 return (start + size) > crashk_res.start && start <= crashk_res.end;
341} 440}
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index be982023409e..01d3916c4cb1 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -216,7 +216,7 @@ _GLOBAL(call_setup_cpu)
216 lwz r4,0(r4) 216 lwz r4,0(r4)
217 add r4,r4,r3 217 add r4,r4,r3
218 lwz r5,CPU_SPEC_SETUP(r4) 218 lwz r5,CPU_SPEC_SETUP(r4)
219 cmpi 0,r5,0 219 cmpwi 0,r5,0
220 add r5,r5,r3 220 add r5,r5,r3
221 beqlr 221 beqlr
222 mtctr r5 222 mtctr r5
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 2778cce058e2..e8883d42c43c 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -482,7 +482,9 @@ _GLOBAL(identify_cpu)
482 sub r0,r3,r5 482 sub r0,r3,r5
483 std r0,0(r4) 483 std r0,0(r4)
484 ld r4,CPU_SPEC_SETUP(r3) 484 ld r4,CPU_SPEC_SETUP(r3)
485 cmpdi 0,r4,0
485 add r4,r4,r5 486 add r4,r4,r5
487 beqlr
486 ld r4,0(r4) 488 ld r4,0(r4)
487 add r4,r4,r5 489 add r4,r4,r5
488 mtctr r4 490 mtctr r4
@@ -768,9 +770,6 @@ _GLOBAL(giveup_altivec)
768 770
769#endif /* CONFIG_ALTIVEC */ 771#endif /* CONFIG_ALTIVEC */
770 772
771_GLOBAL(__setup_cpu_power3)
772 blr
773
774_GLOBAL(execve) 773_GLOBAL(execve)
775 li r0,__NR_execve 774 li r0,__NR_execve
776 sc 775 sc
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index ada50aa5b600..6960f090991e 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -204,7 +204,7 @@ static void nvram_print_partitions(char * label)
204 printk(KERN_WARNING "indx\t\tsig\tchks\tlen\tname\n"); 204 printk(KERN_WARNING "indx\t\tsig\tchks\tlen\tname\n");
205 list_for_each(p, &nvram_part->partition) { 205 list_for_each(p, &nvram_part->partition) {
206 tmp_part = list_entry(p, struct nvram_partition, partition); 206 tmp_part = list_entry(p, struct nvram_partition, partition);
207 printk(KERN_WARNING "%d \t%02x\t%02x\t%d\t%s\n", 207 printk(KERN_WARNING "%4d \t%02x\t%02x\t%d\t%s\n",
208 tmp_part->index, tmp_part->header.signature, 208 tmp_part->index, tmp_part->header.signature,
209 tmp_part->header.checksum, tmp_part->header.length, 209 tmp_part->header.checksum, tmp_part->header.length,
210 tmp_part->header.name); 210 tmp_part->header.name);
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index b129d2e4b759..c858eb4bef17 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -1113,9 +1113,10 @@ check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga)
1113 int i; 1113 int i;
1114 int rc = 0; 1114 int rc = 0;
1115 1115
1116#define push_end(res, size) do { unsigned long __sz = (size) ; \ 1116#define push_end(res, mask) do { \
1117 res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \ 1117 BUG_ON((mask+1) & mask); \
1118 } while (0) 1118 res->end = (res->end + mask) | mask; \
1119} while (0)
1119 1120
1120 list_for_each_entry(dev, &bus->devices, bus_list) { 1121 list_for_each_entry(dev, &bus->devices, bus_list) {
1121 u16 class = dev->class >> 8; 1122 u16 class = dev->class >> 8;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 4c4449be81ce..5ad87c426bed 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -42,14 +42,6 @@
42unsigned long pci_probe_only = 1; 42unsigned long pci_probe_only = 1;
43int pci_assign_all_buses = 0; 43int pci_assign_all_buses = 0;
44 44
45/*
46 * legal IO pages under MAX_ISA_PORT. This is to ensure we don't touch
47 * devices we don't have access to.
48 */
49unsigned long io_page_mask;
50
51EXPORT_SYMBOL(io_page_mask);
52
53#ifdef CONFIG_PPC_MULTIPLATFORM 45#ifdef CONFIG_PPC_MULTIPLATFORM
54static void fixup_resource(struct resource *res, struct pci_dev *dev); 46static void fixup_resource(struct resource *res, struct pci_dev *dev);
55static void do_bus_setup(struct pci_bus *bus); 47static void do_bus_setup(struct pci_bus *bus);
@@ -235,8 +227,10 @@ struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
235 pci_setup_pci_controller(phb); 227 pci_setup_pci_controller(phb);
236 phb->arch_data = dev; 228 phb->arch_data = dev;
237 phb->is_dynamic = mem_init_done; 229 phb->is_dynamic = mem_init_done;
238 if (dev) 230 if (dev) {
231 PHB_SET_NODE(phb, of_node_to_nid(dev));
239 add_linux_pci_domain(dev, phb); 232 add_linux_pci_domain(dev, phb);
233 }
240 return phb; 234 return phb;
241} 235}
242 236
@@ -396,7 +390,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
396 390
397 dev->current_state = 4; /* unknown power state */ 391 dev->current_state = 4; /* unknown power state */
398 392
399 if (!strcmp(type, "pci")) { 393 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
400 /* a PCI-PCI bridge */ 394 /* a PCI-PCI bridge */
401 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; 395 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
402 dev->rom_base_reg = PCI_ROM_ADDRESS1; 396 dev->rom_base_reg = PCI_ROM_ADDRESS1;
@@ -605,7 +599,7 @@ static int __init pcibios_init(void)
605 iSeries_pcibios_init(); 599 iSeries_pcibios_init();
606#endif 600#endif
607 601
608 printk("PCI: Probing PCI hardware\n"); 602 printk(KERN_DEBUG "PCI: Probing PCI hardware\n");
609 603
610 /* Scan all of the recorded PCI controllers. */ 604 /* Scan all of the recorded PCI controllers. */
611 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 605 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
@@ -630,14 +624,14 @@ static int __init pcibios_init(void)
630 /* Cache the location of the ISA bridge (if we have one) */ 624 /* Cache the location of the ISA bridge (if we have one) */
631 ppc64_isabridge_dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); 625 ppc64_isabridge_dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
632 if (ppc64_isabridge_dev != NULL) 626 if (ppc64_isabridge_dev != NULL)
633 printk("ISA bridge at %s\n", pci_name(ppc64_isabridge_dev)); 627 printk(KERN_DEBUG "ISA bridge at %s\n", pci_name(ppc64_isabridge_dev));
634 628
635#ifdef CONFIG_PPC_MULTIPLATFORM 629#ifdef CONFIG_PPC_MULTIPLATFORM
636 /* map in PCI I/O space */ 630 /* map in PCI I/O space */
637 phbs_remap_io(); 631 phbs_remap_io();
638#endif 632#endif
639 633
640 printk("PCI: Probing PCI hardware done\n"); 634 printk(KERN_DEBUG "PCI: Probing PCI hardware done\n");
641 635
642 return 0; 636 return 0;
643} 637}
@@ -804,7 +798,7 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
804 else 798 else
805 prot |= _PAGE_GUARDED; 799 prot |= _PAGE_GUARDED;
806 800
807 printk("PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start, 801 printk(KERN_DEBUG "PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start,
808 prot); 802 prot);
809 803
810 return __pgprot(prot); 804 return __pgprot(prot);
@@ -894,8 +888,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
894 return ret; 888 return ret;
895} 889}
896 890
897#ifdef CONFIG_PPC_MULTIPLATFORM 891static ssize_t pci_show_devspec(struct device *dev,
898static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) 892 struct device_attribute *attr, char *buf)
899{ 893{
900 struct pci_dev *pdev; 894 struct pci_dev *pdev;
901 struct device_node *np; 895 struct device_node *np;
@@ -907,13 +901,10 @@ static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *att
907 return sprintf(buf, "%s", np->full_name); 901 return sprintf(buf, "%s", np->full_name);
908} 902}
909static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL); 903static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
910#endif /* CONFIG_PPC_MULTIPLATFORM */
911 904
912void pcibios_add_platform_entries(struct pci_dev *pdev) 905void pcibios_add_platform_entries(struct pci_dev *pdev)
913{ 906{
914#ifdef CONFIG_PPC_MULTIPLATFORM
915 device_create_file(&pdev->dev, &dev_attr_devspec); 907 device_create_file(&pdev->dev, &dev_attr_devspec);
916#endif /* CONFIG_PPC_MULTIPLATFORM */
917} 908}
918 909
919#ifdef CONFIG_PPC_MULTIPLATFORM 910#ifdef CONFIG_PPC_MULTIPLATFORM
@@ -1104,8 +1095,6 @@ void __init pci_setup_phb_io(struct pci_controller *hose, int primary)
1104 pci_process_ISA_OF_ranges(isa_dn, hose->io_base_phys, 1095 pci_process_ISA_OF_ranges(isa_dn, hose->io_base_phys,
1105 hose->io_base_virt); 1096 hose->io_base_virt);
1106 of_node_put(isa_dn); 1097 of_node_put(isa_dn);
1107 /* Allow all IO */
1108 io_page_mask = -1;
1109 } 1098 }
1110 } 1099 }
1111 1100
@@ -1212,7 +1201,7 @@ int remap_bus_range(struct pci_bus *bus)
1212 return 1; 1201 return 1;
1213 if (start_phys == 0) 1202 if (start_phys == 0)
1214 return 1; 1203 return 1;
1215 printk("mapping IO %lx -> %lx, size: %lx\n", start_phys, start_virt, size); 1204 printk(KERN_DEBUG "mapping IO %lx -> %lx, size: %lx\n", start_phys, start_virt, size);
1216 if (__ioremap_explicit(start_phys, start_virt, size, 1205 if (__ioremap_explicit(start_phys, start_virt, size,
1217 _PAGE_NO_CACHE | _PAGE_GUARDED)) 1206 _PAGE_NO_CACHE | _PAGE_GUARDED))
1218 return 1; 1207 return 1;
@@ -1232,27 +1221,13 @@ static void phbs_remap_io(void)
1232static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev) 1221static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
1233{ 1222{
1234 struct pci_controller *hose = pci_bus_to_host(dev->bus); 1223 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1235 unsigned long start, end, mask, offset; 1224 unsigned long offset;
1236 1225
1237 if (res->flags & IORESOURCE_IO) { 1226 if (res->flags & IORESOURCE_IO) {
1238 offset = (unsigned long)hose->io_base_virt - pci_io_base; 1227 offset = (unsigned long)hose->io_base_virt - pci_io_base;
1239 1228
1240 start = res->start += offset; 1229 res->start += offset;
1241 end = res->end += offset; 1230 res->end += offset;
1242
1243 /* Need to allow IO access to pages that are in the
1244 ISA range */
1245 if (start < MAX_ISA_PORT) {
1246 if (end > MAX_ISA_PORT)
1247 end = MAX_ISA_PORT;
1248
1249 start >>= PAGE_SHIFT;
1250 end >>= PAGE_SHIFT;
1251
1252 /* get the range of pages for the map */
1253 mask = ((1 << (end+1)) - 1) ^ ((1 << start) - 1);
1254 io_page_mask |= mask;
1255 }
1256 } else if (res->flags & IORESOURCE_MEM) { 1231 } else if (res->flags & IORESOURCE_MEM) {
1257 res->start += hose->pci_mem_offset; 1232 res->start += hose->pci_mem_offset;
1258 res->end += hose->pci_mem_offset; 1233 res->end += hose->pci_mem_offset;
@@ -1442,3 +1417,12 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
1442 1417
1443 return -EOPNOTSUPP; 1418 return -EOPNOTSUPP;
1444} 1419}
1420
1421#ifdef CONFIG_NUMA
1422int pcibus_to_node(struct pci_bus *bus)
1423{
1424 struct pci_controller *phb = pci_bus_to_host(bus);
1425 return phb->node;
1426}
1427EXPORT_SYMBOL(pcibus_to_node);
1428#endif
diff --git a/arch/powerpc/kernel/pci_direct_iommu.c b/arch/powerpc/kernel/pci_direct_iommu.c
index e1a32f802c0b..72ce082ce738 100644
--- a/arch/powerpc/kernel/pci_direct_iommu.c
+++ b/arch/powerpc/kernel/pci_direct_iommu.c
@@ -82,13 +82,17 @@ static int pci_direct_dma_supported(struct device *dev, u64 mask)
82 return mask < 0x100000000ull; 82 return mask < 0x100000000ull;
83} 83}
84 84
85static struct dma_mapping_ops pci_direct_ops = {
86 .alloc_coherent = pci_direct_alloc_coherent,
87 .free_coherent = pci_direct_free_coherent,
88 .map_single = pci_direct_map_single,
89 .unmap_single = pci_direct_unmap_single,
90 .map_sg = pci_direct_map_sg,
91 .unmap_sg = pci_direct_unmap_sg,
92 .dma_supported = pci_direct_dma_supported,
93};
94
85void __init pci_direct_iommu_init(void) 95void __init pci_direct_iommu_init(void)
86{ 96{
87 pci_dma_ops.alloc_coherent = pci_direct_alloc_coherent; 97 pci_dma_ops = pci_direct_ops;
88 pci_dma_ops.free_coherent = pci_direct_free_coherent;
89 pci_dma_ops.map_single = pci_direct_map_single;
90 pci_dma_ops.unmap_single = pci_direct_unmap_single;
91 pci_dma_ops.map_sg = pci_direct_map_sg;
92 pci_dma_ops.unmap_sg = pci_direct_unmap_sg;
93 pci_dma_ops.dma_supported = pci_direct_dma_supported;
94} 98}
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 12c4c9e9bbc7..1c18953514c3 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -31,6 +31,7 @@
31#include <asm/pci-bridge.h> 31#include <asm/pci-bridge.h>
32#include <asm/pSeries_reconfig.h> 32#include <asm/pSeries_reconfig.h>
33#include <asm/ppc-pci.h> 33#include <asm/ppc-pci.h>
34#include <asm/firmware.h>
34 35
35/* 36/*
36 * Traverse_func that inits the PCI fields of the device node. 37 * Traverse_func that inits the PCI fields of the device node.
@@ -59,6 +60,11 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
59 pdn->busno = (regs[0] >> 16) & 0xff; 60 pdn->busno = (regs[0] >> 16) & 0xff;
60 pdn->devfn = (regs[0] >> 8) & 0xff; 61 pdn->devfn = (regs[0] >> 8) & 0xff;
61 } 62 }
63 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
64 u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL);
65 if (busp)
66 pdn->bussubno = *busp;
67 }
62 68
63 pdn->pci_ext_config_space = (type && *type == 1); 69 pdn->pci_ext_config_space = (type && *type == 1);
64 return NULL; 70 return NULL;
diff --git a/arch/powerpc/kernel/pci_iommu.c b/arch/powerpc/kernel/pci_iommu.c
index c1d95e14bbed..0688b2534acb 100644
--- a/arch/powerpc/kernel/pci_iommu.c
+++ b/arch/powerpc/kernel/pci_iommu.c
@@ -44,16 +44,16 @@
44 */ 44 */
45#define PCI_GET_DN(dev) ((struct device_node *)((dev)->sysdata)) 45#define PCI_GET_DN(dev) ((struct device_node *)((dev)->sysdata))
46 46
47static inline struct iommu_table *devnode_table(struct device *dev) 47static inline struct iommu_table *device_to_table(struct device *hwdev)
48{ 48{
49 struct pci_dev *pdev; 49 struct pci_dev *pdev;
50 50
51 if (!dev) { 51 if (!hwdev) {
52 pdev = ppc64_isabridge_dev; 52 pdev = ppc64_isabridge_dev;
53 if (!pdev) 53 if (!pdev)
54 return NULL; 54 return NULL;
55 } else 55 } else
56 pdev = to_pci_dev(dev); 56 pdev = to_pci_dev(hwdev);
57 57
58 return PCI_DN(PCI_GET_DN(pdev))->iommu_table; 58 return PCI_DN(PCI_GET_DN(pdev))->iommu_table;
59} 59}
@@ -85,14 +85,15 @@ static inline unsigned long device_to_mask(struct device *hwdev)
85static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size, 85static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size,
86 dma_addr_t *dma_handle, gfp_t flag) 86 dma_addr_t *dma_handle, gfp_t flag)
87{ 87{
88 return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle, 88 return iommu_alloc_coherent(device_to_table(hwdev), size, dma_handle,
89 device_to_mask(hwdev), flag); 89 device_to_mask(hwdev), flag,
90 pcibus_to_node(to_pci_dev(hwdev)->bus));
90} 91}
91 92
92static void pci_iommu_free_coherent(struct device *hwdev, size_t size, 93static void pci_iommu_free_coherent(struct device *hwdev, size_t size,
93 void *vaddr, dma_addr_t dma_handle) 94 void *vaddr, dma_addr_t dma_handle)
94{ 95{
95 iommu_free_coherent(devnode_table(hwdev), size, vaddr, dma_handle); 96 iommu_free_coherent(device_to_table(hwdev), size, vaddr, dma_handle);
96} 97}
97 98
98/* Creates TCEs for a user provided buffer. The user buffer must be 99/* Creates TCEs for a user provided buffer. The user buffer must be
@@ -104,7 +105,7 @@ static void pci_iommu_free_coherent(struct device *hwdev, size_t size,
104static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr, 105static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr,
105 size_t size, enum dma_data_direction direction) 106 size_t size, enum dma_data_direction direction)
106{ 107{
107 return iommu_map_single(devnode_table(hwdev), vaddr, size, 108 return iommu_map_single(device_to_table(hwdev), vaddr, size,
108 device_to_mask(hwdev), direction); 109 device_to_mask(hwdev), direction);
109} 110}
110 111
@@ -112,27 +113,27 @@ static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr,
112static void pci_iommu_unmap_single(struct device *hwdev, dma_addr_t dma_handle, 113static void pci_iommu_unmap_single(struct device *hwdev, dma_addr_t dma_handle,
113 size_t size, enum dma_data_direction direction) 114 size_t size, enum dma_data_direction direction)
114{ 115{
115 iommu_unmap_single(devnode_table(hwdev), dma_handle, size, direction); 116 iommu_unmap_single(device_to_table(hwdev), dma_handle, size, direction);
116} 117}
117 118
118 119
119static int pci_iommu_map_sg(struct device *pdev, struct scatterlist *sglist, 120static int pci_iommu_map_sg(struct device *pdev, struct scatterlist *sglist,
120 int nelems, enum dma_data_direction direction) 121 int nelems, enum dma_data_direction direction)
121{ 122{
122 return iommu_map_sg(pdev, devnode_table(pdev), sglist, 123 return iommu_map_sg(pdev, device_to_table(pdev), sglist,
123 nelems, device_to_mask(pdev), direction); 124 nelems, device_to_mask(pdev), direction);
124} 125}
125 126
126static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist, 127static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist,
127 int nelems, enum dma_data_direction direction) 128 int nelems, enum dma_data_direction direction)
128{ 129{
129 iommu_unmap_sg(devnode_table(pdev), sglist, nelems, direction); 130 iommu_unmap_sg(device_to_table(pdev), sglist, nelems, direction);
130} 131}
131 132
132/* We support DMA to/from any memory page via the iommu */ 133/* We support DMA to/from any memory page via the iommu */
133static int pci_iommu_dma_supported(struct device *dev, u64 mask) 134static int pci_iommu_dma_supported(struct device *dev, u64 mask)
134{ 135{
135 struct iommu_table *tbl = devnode_table(dev); 136 struct iommu_table *tbl = device_to_table(dev);
136 137
137 if (!tbl || tbl->it_offset > mask) { 138 if (!tbl || tbl->it_offset > mask) {
138 printk(KERN_INFO "Warning: IOMMU table offset too big for device mask\n"); 139 printk(KERN_INFO "Warning: IOMMU table offset too big for device mask\n");
@@ -147,13 +148,17 @@ static int pci_iommu_dma_supported(struct device *dev, u64 mask)
147 return 1; 148 return 1;
148} 149}
149 150
151struct dma_mapping_ops pci_iommu_ops = {
152 .alloc_coherent = pci_iommu_alloc_coherent,
153 .free_coherent = pci_iommu_free_coherent,
154 .map_single = pci_iommu_map_single,
155 .unmap_single = pci_iommu_unmap_single,
156 .map_sg = pci_iommu_map_sg,
157 .unmap_sg = pci_iommu_unmap_sg,
158 .dma_supported = pci_iommu_dma_supported,
159};
160
150void pci_iommu_init(void) 161void pci_iommu_init(void)
151{ 162{
152 pci_dma_ops.alloc_coherent = pci_iommu_alloc_coherent; 163 pci_dma_ops = pci_iommu_ops;
153 pci_dma_ops.free_coherent = pci_iommu_free_coherent;
154 pci_dma_ops.map_single = pci_iommu_map_single;
155 pci_dma_ops.unmap_single = pci_iommu_unmap_single;
156 pci_dma_ops.map_sg = pci_iommu_map_sg;
157 pci_dma_ops.unmap_sg = pci_iommu_unmap_sg;
158 pci_dma_ops.dma_supported = pci_iommu_dma_supported;
159} 164}
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_ppc64.c
index 3c2cf661f6d9..2b87f82df135 100644
--- a/arch/powerpc/kernel/proc_ppc64.c
+++ b/arch/powerpc/kernel/proc_ppc64.c
@@ -52,7 +52,7 @@ static int __init proc_ppc64_create(void)
52 if (!root) 52 if (!root)
53 return 1; 53 return 1;
54 54
55 if (!machine_is(pseries) && !machine_is(cell)) 55 if (!of_find_node_by_path("/rtas"))
56 return 0; 56 return 0;
57 57
58 if (!proc_mkdir("rtas", root)) 58 if (!proc_mkdir("rtas", root))
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 2dd47d2dd998..e4732459c485 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -708,6 +708,61 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
708 return put_user(val, (unsigned int __user *) adr); 708 return put_user(val, (unsigned int __user *) adr);
709} 709}
710 710
711int set_endian(struct task_struct *tsk, unsigned int val)
712{
713 struct pt_regs *regs = tsk->thread.regs;
714
715 if ((val == PR_ENDIAN_LITTLE && !cpu_has_feature(CPU_FTR_REAL_LE)) ||
716 (val == PR_ENDIAN_PPC_LITTLE && !cpu_has_feature(CPU_FTR_PPC_LE)))
717 return -EINVAL;
718
719 if (regs == NULL)
720 return -EINVAL;
721
722 if (val == PR_ENDIAN_BIG)
723 regs->msr &= ~MSR_LE;
724 else if (val == PR_ENDIAN_LITTLE || val == PR_ENDIAN_PPC_LITTLE)
725 regs->msr |= MSR_LE;
726 else
727 return -EINVAL;
728
729 return 0;
730}
731
732int get_endian(struct task_struct *tsk, unsigned long adr)
733{
734 struct pt_regs *regs = tsk->thread.regs;
735 unsigned int val;
736
737 if (!cpu_has_feature(CPU_FTR_PPC_LE) &&
738 !cpu_has_feature(CPU_FTR_REAL_LE))
739 return -EINVAL;
740
741 if (regs == NULL)
742 return -EINVAL;
743
744 if (regs->msr & MSR_LE) {
745 if (cpu_has_feature(CPU_FTR_REAL_LE))
746 val = PR_ENDIAN_LITTLE;
747 else
748 val = PR_ENDIAN_PPC_LITTLE;
749 } else
750 val = PR_ENDIAN_BIG;
751
752 return put_user(val, (unsigned int __user *)adr);
753}
754
755int set_unalign_ctl(struct task_struct *tsk, unsigned int val)
756{
757 tsk->thread.align_ctl = val;
758 return 0;
759}
760
761int get_unalign_ctl(struct task_struct *tsk, unsigned long adr)
762{
763 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr);
764}
765
711#define TRUNC_PTR(x) ((typeof(x))(((unsigned long)(x)) & 0xffffffff)) 766#define TRUNC_PTR(x) ((typeof(x))(((unsigned long)(x)) & 0xffffffff))
712 767
713int sys_clone(unsigned long clone_flags, unsigned long usp, 768int sys_clone(unsigned long clone_flags, unsigned long usp,
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 9a07f97f0712..483455c5bb02 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -50,6 +50,7 @@
50#include <asm/machdep.h> 50#include <asm/machdep.h>
51#include <asm/pSeries_reconfig.h> 51#include <asm/pSeries_reconfig.h>
52#include <asm/pci-bridge.h> 52#include <asm/pci-bridge.h>
53#include <asm/kexec.h>
53 54
54#ifdef DEBUG 55#ifdef DEBUG
55#define DBG(fmt...) printk(KERN_ERR fmt) 56#define DBG(fmt...) printk(KERN_ERR fmt)
@@ -836,6 +837,42 @@ static unsigned long __init unflatten_dt_node(unsigned long mem,
836 return mem; 837 return mem;
837} 838}
838 839
840static int __init early_parse_mem(char *p)
841{
842 if (!p)
843 return 1;
844
845 memory_limit = PAGE_ALIGN(memparse(p, &p));
846 DBG("memory limit = 0x%lx\n", memory_limit);
847
848 return 0;
849}
850early_param("mem", early_parse_mem);
851
852/*
853 * The device tree may be allocated below our memory limit, or inside the
854 * crash kernel region for kdump. If so, move it out now.
855 */
856static void move_device_tree(void)
857{
858 unsigned long start, size;
859 void *p;
860
861 DBG("-> move_device_tree\n");
862
863 start = __pa(initial_boot_params);
864 size = initial_boot_params->totalsize;
865
866 if ((memory_limit && (start + size) > memory_limit) ||
867 overlaps_crashkernel(start, size)) {
868 p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
869 memcpy(p, initial_boot_params, size);
870 initial_boot_params = (struct boot_param_header *)p;
871 DBG("Moved device tree to 0x%p\n", p);
872 }
873
874 DBG("<- move_device_tree\n");
875}
839 876
840/** 877/**
841 * unflattens the device-tree passed by the firmware, creating the 878 * unflattens the device-tree passed by the firmware, creating the
@@ -911,7 +948,10 @@ static struct ibm_pa_feature {
911 {CPU_FTR_CTRL, 0, 0, 3, 0}, 948 {CPU_FTR_CTRL, 0, 0, 3, 0},
912 {CPU_FTR_NOEXECUTE, 0, 0, 6, 0}, 949 {CPU_FTR_NOEXECUTE, 0, 0, 6, 0},
913 {CPU_FTR_NODSISRALIGN, 0, 1, 1, 1}, 950 {CPU_FTR_NODSISRALIGN, 0, 1, 1, 1},
951#if 0
952 /* put this back once we know how to test if firmware does 64k IO */
914 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, 953 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0},
954#endif
915}; 955};
916 956
917static void __init check_cpu_pa_features(unsigned long node) 957static void __init check_cpu_pa_features(unsigned long node)
@@ -1070,6 +1110,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1070 iommu_force_on = 1; 1110 iommu_force_on = 1;
1071#endif 1111#endif
1072 1112
1113 /* mem=x on the command line is the preferred mechanism */
1073 lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL); 1114 lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
1074 if (lprop) 1115 if (lprop)
1075 memory_limit = *lprop; 1116 memory_limit = *lprop;
@@ -1123,17 +1164,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1123 1164
1124 DBG("Command line is: %s\n", cmd_line); 1165 DBG("Command line is: %s\n", cmd_line);
1125 1166
1126 if (strstr(cmd_line, "mem=")) {
1127 char *p, *q;
1128
1129 for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
1130 q = p + 4;
1131 if (p > cmd_line && p[-1] != ' ')
1132 continue;
1133 memory_limit = memparse(q, &q);
1134 }
1135 }
1136
1137 /* break now */ 1167 /* break now */
1138 return 1; 1168 return 1;
1139} 1169}
@@ -1237,9 +1267,17 @@ static void __init early_reserve_mem(void)
1237{ 1267{
1238 u64 base, size; 1268 u64 base, size;
1239 u64 *reserve_map; 1269 u64 *reserve_map;
1270 unsigned long self_base;
1271 unsigned long self_size;
1240 1272
1241 reserve_map = (u64 *)(((unsigned long)initial_boot_params) + 1273 reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
1242 initial_boot_params->off_mem_rsvmap); 1274 initial_boot_params->off_mem_rsvmap);
1275
1276 /* before we do anything, lets reserve the dt blob */
1277 self_base = __pa((unsigned long)initial_boot_params);
1278 self_size = initial_boot_params->totalsize;
1279 lmb_reserve(self_base, self_size);
1280
1243#ifdef CONFIG_PPC32 1281#ifdef CONFIG_PPC32
1244 /* 1282 /*
1245 * Handle the case where we might be booting from an old kexec 1283 * Handle the case where we might be booting from an old kexec
@@ -1254,6 +1292,9 @@ static void __init early_reserve_mem(void)
1254 size_32 = *(reserve_map_32++); 1292 size_32 = *(reserve_map_32++);
1255 if (size_32 == 0) 1293 if (size_32 == 0)
1256 break; 1294 break;
1295 /* skip if the reservation is for the blob */
1296 if (base_32 == self_base && size_32 == self_size)
1297 continue;
1257 DBG("reserving: %x -> %x\n", base_32, size_32); 1298 DBG("reserving: %x -> %x\n", base_32, size_32);
1258 lmb_reserve(base_32, size_32); 1299 lmb_reserve(base_32, size_32);
1259 } 1300 }
@@ -1265,6 +1306,9 @@ static void __init early_reserve_mem(void)
1265 size = *(reserve_map++); 1306 size = *(reserve_map++);
1266 if (size == 0) 1307 if (size == 0)
1267 break; 1308 break;
1309 /* skip if the reservation is for the blob */
1310 if (base == self_base && size == self_size)
1311 continue;
1268 DBG("reserving: %llx -> %llx\n", base, size); 1312 DBG("reserving: %llx -> %llx\n", base, size);
1269 lmb_reserve(base, size); 1313 lmb_reserve(base, size);
1270 } 1314 }
@@ -1292,18 +1336,26 @@ void __init early_init_devtree(void *params)
1292 lmb_init(); 1336 lmb_init();
1293 of_scan_flat_dt(early_init_dt_scan_root, NULL); 1337 of_scan_flat_dt(early_init_dt_scan_root, NULL);
1294 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 1338 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
1295 lmb_enforce_memory_limit(memory_limit);
1296 lmb_analyze();
1297 1339
1298 DBG("Phys. mem: %lx\n", lmb_phys_mem_size()); 1340 /* Save command line for /proc/cmdline and then parse parameters */
1341 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
1342 parse_early_param();
1299 1343
1300 /* Reserve LMB regions used by kernel, initrd, dt, etc... */ 1344 /* Reserve LMB regions used by kernel, initrd, dt, etc... */
1301 lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START); 1345 lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
1302#ifdef CONFIG_CRASH_DUMP 1346 reserve_kdump_trampoline();
1303 lmb_reserve(0, KDUMP_RESERVE_LIMIT); 1347 reserve_crashkernel();
1304#endif
1305 early_reserve_mem(); 1348 early_reserve_mem();
1306 1349
1350 lmb_enforce_memory_limit(memory_limit);
1351 lmb_analyze();
1352
1353 DBG("Phys. mem: %lx\n", lmb_phys_mem_size());
1354
1355 /* We may need to relocate the flat tree, do it now.
1356 * FIXME .. and the initrd too? */
1357 move_device_tree();
1358
1307 DBG("Scanning CPUs ...\n"); 1359 DBG("Scanning CPUs ...\n");
1308 1360
1309 /* Retreive CPU related informations from the flat tree 1361 /* Retreive CPU related informations from the flat tree
@@ -2053,29 +2105,46 @@ int prom_update_property(struct device_node *np,
2053 return 0; 2105 return 0;
2054} 2106}
2055 2107
2056#ifdef CONFIG_KEXEC
2057/* We may have allocated the flat device tree inside the crash kernel region
2058 * in prom_init. If so we need to move it out into regular memory. */
2059void kdump_move_device_tree(void)
2060{
2061 unsigned long start, end;
2062 struct boot_param_header *new;
2063
2064 start = __pa((unsigned long)initial_boot_params);
2065 end = start + initial_boot_params->totalsize;
2066
2067 if (end < crashk_res.start || start > crashk_res.end)
2068 return;
2069 2108
2070 new = (struct boot_param_header*) 2109/* Find the device node for a given logical cpu number, also returns the cpu
2071 __va(lmb_alloc(initial_boot_params->totalsize, PAGE_SIZE)); 2110 * local thread number (index in ibm,interrupt-server#s) if relevant and
2072 2111 * asked for (non NULL)
2073 memcpy(new, initial_boot_params, initial_boot_params->totalsize); 2112 */
2113struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
2114{
2115 int hardid;
2116 struct device_node *np;
2074 2117
2075 initial_boot_params = new; 2118 hardid = get_hard_smp_processor_id(cpu);
2076 2119
2077 DBG("Flat device tree blob moved to %p\n", initial_boot_params); 2120 for_each_node_by_type(np, "cpu") {
2121 u32 *intserv;
2122 unsigned int plen, t;
2078 2123
2079 /* XXX should we unreserve the old DT? */ 2124 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
2125 * fallback to "reg" property and assume no threads
2126 */
2127 intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s",
2128 &plen);
2129 if (intserv == NULL) {
2130 u32 *reg = (u32 *)get_property(np, "reg", NULL);
2131 if (reg == NULL)
2132 continue;
2133 if (*reg == hardid) {
2134 if (thread)
2135 *thread = 0;
2136 return np;
2137 }
2138 } else {
2139 plen /= sizeof(u32);
2140 for (t = 0; t < plen; t++) {
2141 if (hardid == intserv[t]) {
2142 if (thread)
2143 *thread = t;
2144 return np;
2145 }
2146 }
2147 }
2148 }
2149 return NULL;
2080} 2150}
2081#endif /* CONFIG_KEXEC */
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index f70bd090dacd..8c28eb0cbdac 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -194,19 +194,12 @@ static int __initdata of_platform;
194 194
195static char __initdata prom_cmd_line[COMMAND_LINE_SIZE]; 195static char __initdata prom_cmd_line[COMMAND_LINE_SIZE];
196 196
197static unsigned long __initdata prom_memory_limit;
198
199static unsigned long __initdata alloc_top; 197static unsigned long __initdata alloc_top;
200static unsigned long __initdata alloc_top_high; 198static unsigned long __initdata alloc_top_high;
201static unsigned long __initdata alloc_bottom; 199static unsigned long __initdata alloc_bottom;
202static unsigned long __initdata rmo_top; 200static unsigned long __initdata rmo_top;
203static unsigned long __initdata ram_top; 201static unsigned long __initdata ram_top;
204 202
205#ifdef CONFIG_KEXEC
206static unsigned long __initdata prom_crashk_base;
207static unsigned long __initdata prom_crashk_size;
208#endif
209
210static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE]; 203static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE];
211static int __initdata mem_reserve_cnt; 204static int __initdata mem_reserve_cnt;
212 205
@@ -574,7 +567,7 @@ static void __init early_cmdline_parse(void)
574 if ((long)_prom->chosen > 0) 567 if ((long)_prom->chosen > 0)
575 l = prom_getprop(_prom->chosen, "bootargs", p, COMMAND_LINE_SIZE-1); 568 l = prom_getprop(_prom->chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
576#ifdef CONFIG_CMDLINE 569#ifdef CONFIG_CMDLINE
577 if (l == 0) /* dbl check */ 570 if (l <= 0 || p[0] == '\0') /* dbl check */
578 strlcpy(RELOC(prom_cmd_line), 571 strlcpy(RELOC(prom_cmd_line),
579 RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line)); 572 RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line));
580#endif /* CONFIG_CMDLINE */ 573#endif /* CONFIG_CMDLINE */
@@ -593,45 +586,6 @@ static void __init early_cmdline_parse(void)
593 RELOC(iommu_force_on) = 1; 586 RELOC(iommu_force_on) = 1;
594 } 587 }
595#endif 588#endif
596
597 opt = strstr(RELOC(prom_cmd_line), RELOC("mem="));
598 if (opt) {
599 opt += 4;
600 RELOC(prom_memory_limit) = prom_memparse(opt, (const char **)&opt);
601#ifdef CONFIG_PPC64
602 /* Align to 16 MB == size of ppc64 large page */
603 RELOC(prom_memory_limit) = ALIGN(RELOC(prom_memory_limit), 0x1000000);
604#endif
605 }
606
607#ifdef CONFIG_KEXEC
608 /*
609 * crashkernel=size@addr specifies the location to reserve for
610 * crash kernel.
611 */
612 opt = strstr(RELOC(prom_cmd_line), RELOC("crashkernel="));
613 if (opt) {
614 opt += 12;
615 RELOC(prom_crashk_size) =
616 prom_memparse(opt, (const char **)&opt);
617
618 if (ALIGN(RELOC(prom_crashk_size), 0x1000000) !=
619 RELOC(prom_crashk_size)) {
620 prom_printf("Warning: crashkernel size is not "
621 "aligned to 16MB\n");
622 }
623
624 /*
625 * At present, the crash kernel always run at 32MB.
626 * Just ignore whatever user passed.
627 */
628 RELOC(prom_crashk_base) = 0x2000000;
629 if (*opt == '@') {
630 prom_printf("Warning: PPC64 kdump kernel always runs "
631 "at 32 MB\n");
632 }
633 }
634#endif
635} 589}
636 590
637#ifdef CONFIG_PPC_PSERIES 591#ifdef CONFIG_PPC_PSERIES
@@ -1116,29 +1070,6 @@ static void __init prom_init_mem(void)
1116 } 1070 }
1117 1071
1118 /* 1072 /*
1119 * If prom_memory_limit is set we reduce the upper limits *except* for
1120 * alloc_top_high. This must be the real top of RAM so we can put
1121 * TCE's up there.
1122 */
1123
1124 RELOC(alloc_top_high) = RELOC(ram_top);
1125
1126 if (RELOC(prom_memory_limit)) {
1127 if (RELOC(prom_memory_limit) <= RELOC(alloc_bottom)) {
1128 prom_printf("Ignoring mem=%x <= alloc_bottom.\n",
1129 RELOC(prom_memory_limit));
1130 RELOC(prom_memory_limit) = 0;
1131 } else if (RELOC(prom_memory_limit) >= RELOC(ram_top)) {
1132 prom_printf("Ignoring mem=%x >= ram_top.\n",
1133 RELOC(prom_memory_limit));
1134 RELOC(prom_memory_limit) = 0;
1135 } else {
1136 RELOC(ram_top) = RELOC(prom_memory_limit);
1137 RELOC(rmo_top) = min(RELOC(rmo_top), RELOC(prom_memory_limit));
1138 }
1139 }
1140
1141 /*
1142 * Setup our top alloc point, that is top of RMO or top of 1073 * Setup our top alloc point, that is top of RMO or top of
1143 * segment 0 when running non-LPAR. 1074 * segment 0 when running non-LPAR.
1144 * Some RS64 machines have buggy firmware where claims up at 1075 * Some RS64 machines have buggy firmware where claims up at
@@ -1150,20 +1081,14 @@ static void __init prom_init_mem(void)
1150 RELOC(rmo_top) = RELOC(ram_top); 1081 RELOC(rmo_top) = RELOC(ram_top);
1151 RELOC(rmo_top) = min(0x30000000ul, RELOC(rmo_top)); 1082 RELOC(rmo_top) = min(0x30000000ul, RELOC(rmo_top));
1152 RELOC(alloc_top) = RELOC(rmo_top); 1083 RELOC(alloc_top) = RELOC(rmo_top);
1084 RELOC(alloc_top_high) = RELOC(ram_top);
1153 1085
1154 prom_printf("memory layout at init:\n"); 1086 prom_printf("memory layout at init:\n");
1155 prom_printf(" memory_limit : %x (16 MB aligned)\n", RELOC(prom_memory_limit));
1156 prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom)); 1087 prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom));
1157 prom_printf(" alloc_top : %x\n", RELOC(alloc_top)); 1088 prom_printf(" alloc_top : %x\n", RELOC(alloc_top));
1158 prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); 1089 prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high));
1159 prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); 1090 prom_printf(" rmo_top : %x\n", RELOC(rmo_top));
1160 prom_printf(" ram_top : %x\n", RELOC(ram_top)); 1091 prom_printf(" ram_top : %x\n", RELOC(ram_top));
1161#ifdef CONFIG_KEXEC
1162 if (RELOC(prom_crashk_base)) {
1163 prom_printf(" crashk_base : %x\n", RELOC(prom_crashk_base));
1164 prom_printf(" crashk_size : %x\n", RELOC(prom_crashk_size));
1165 }
1166#endif
1167} 1092}
1168 1093
1169 1094
@@ -1349,16 +1274,10 @@ static void __init prom_initialize_tce_table(void)
1349 1274
1350 reserve_mem(local_alloc_bottom, local_alloc_top - local_alloc_bottom); 1275 reserve_mem(local_alloc_bottom, local_alloc_top - local_alloc_bottom);
1351 1276
1352 if (RELOC(prom_memory_limit)) { 1277 /* These are only really needed if there is a memory limit in
1353 /* 1278 * effect, but we don't know so export them always. */
1354 * We align the start to a 16MB boundary so we can map 1279 RELOC(prom_tce_alloc_start) = local_alloc_bottom;
1355 * the TCE area using large pages if possible. 1280 RELOC(prom_tce_alloc_end) = local_alloc_top;
1356 * The end should be the top of RAM so no need to align it.
1357 */
1358 RELOC(prom_tce_alloc_start) = _ALIGN_DOWN(local_alloc_bottom,
1359 0x1000000);
1360 RELOC(prom_tce_alloc_end) = local_alloc_top;
1361 }
1362 1281
1363 /* Flag the first invalid entry */ 1282 /* Flag the first invalid entry */
1364 prom_debug("ending prom_initialize_tce_table\n"); 1283 prom_debug("ending prom_initialize_tce_table\n");
@@ -2041,11 +1960,7 @@ static void __init flatten_device_tree(void)
2041 /* Version 16 is not backward compatible */ 1960 /* Version 16 is not backward compatible */
2042 hdr->last_comp_version = 0x10; 1961 hdr->last_comp_version = 0x10;
2043 1962
2044 /* Reserve the whole thing and copy the reserve map in, we 1963 /* Copy the reserve map in */
2045 * also bump mem_reserve_cnt to cause further reservations to
2046 * fail since it's too late.
2047 */
2048 reserve_mem(RELOC(dt_header_start), hdr->totalsize);
2049 memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map)); 1964 memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map));
2050 1965
2051#ifdef DEBUG_PROM 1966#ifdef DEBUG_PROM
@@ -2058,6 +1973,9 @@ static void __init flatten_device_tree(void)
2058 RELOC(mem_reserve_map)[i].size); 1973 RELOC(mem_reserve_map)[i].size);
2059 } 1974 }
2060#endif 1975#endif
1976 /* Bump mem_reserve_cnt to cause further reservations to fail
1977 * since it's too late.
1978 */
2061 RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE; 1979 RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE;
2062 1980
2063 prom_printf("Device tree strings 0x%x -> 0x%x\n", 1981 prom_printf("Device tree strings 0x%x -> 0x%x\n",
@@ -2280,10 +2198,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2280 */ 2198 */
2281 prom_init_mem(); 2199 prom_init_mem();
2282 2200
2283#ifdef CONFIG_KEXEC
2284 if (RELOC(prom_crashk_base))
2285 reserve_mem(RELOC(prom_crashk_base), RELOC(prom_crashk_size));
2286#endif
2287 /* 2201 /*
2288 * Determine which cpu is actually running right _now_ 2202 * Determine which cpu is actually running right _now_
2289 */ 2203 */
@@ -2317,10 +2231,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2317 /* 2231 /*
2318 * Fill in some infos for use by the kernel later on 2232 * Fill in some infos for use by the kernel later on
2319 */ 2233 */
2320 if (RELOC(prom_memory_limit))
2321 prom_setprop(_prom->chosen, "/chosen", "linux,memory-limit",
2322 &RELOC(prom_memory_limit),
2323 sizeof(prom_memory_limit));
2324#ifdef CONFIG_PPC64 2234#ifdef CONFIG_PPC64
2325 if (RELOC(ppc64_iommu_off)) 2235 if (RELOC(ppc64_iommu_off))
2326 prom_setprop(_prom->chosen, "/chosen", "linux,iommu-off", 2236 prom_setprop(_prom->chosen, "/chosen", "linux,iommu-off",
@@ -2340,16 +2250,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2340 } 2250 }
2341#endif 2251#endif
2342 2252
2343#ifdef CONFIG_KEXEC
2344 if (RELOC(prom_crashk_base)) {
2345 prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-base",
2346 PTRRELOC(&prom_crashk_base),
2347 sizeof(RELOC(prom_crashk_base)));
2348 prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-size",
2349 PTRRELOC(&prom_crashk_size),
2350 sizeof(RELOC(prom_crashk_size)));
2351 }
2352#endif
2353 /* 2253 /*
2354 * Fixup any known bugs in the device-tree 2254 * Fixup any known bugs in the device-tree
2355 */ 2255 */
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 3934c227549b..45df420383cc 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -548,3 +548,28 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
548 return __of_address_to_resource(dev, addrp, size, flags, r); 548 return __of_address_to_resource(dev, addrp, size, flags, r);
549} 549}
550EXPORT_SYMBOL_GPL(of_pci_address_to_resource); 550EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
551
552void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop,
553 unsigned long *busno, unsigned long *phys, unsigned long *size)
554{
555 u32 *dma_window, cells;
556 unsigned char *prop;
557
558 dma_window = (u32 *)dma_window_prop;
559
560 /* busno is always one cell */
561 *busno = *(dma_window++);
562
563 prop = get_property(dn, "ibm,#dma-address-cells", NULL);
564 if (!prop)
565 prop = get_property(dn, "#address-cells", NULL);
566
567 cells = prop ? *(u32 *)prop : prom_n_addr_cells(dn);
568 *phys = of_read_addr(dma_window, cells);
569
570 dma_window += cells;
571
572 prop = get_property(dn, "ibm,#dma-size-cells", NULL);
573 cells = prop ? *(u32 *)prop : prom_n_size_cells(dn);
574 *size = of_read_addr(dma_window, cells);
575}
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 4a677d1bd4ef..5563e2e7d89c 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -404,7 +404,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
404 ret = ptrace_detach(child, data); 404 ret = ptrace_detach(child, data);
405 break; 405 break;
406 406
407#ifdef CONFIG_PPC64
408 case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */ 407 case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */
409 int i; 408 int i;
410 unsigned long *reg = &((unsigned long *)child->thread.regs)[0]; 409 unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
@@ -468,7 +467,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
468 } 467 }
469 break; 468 break;
470 } 469 }
471#endif /* CONFIG_PPC64 */
472 470
473#ifdef CONFIG_ALTIVEC 471#ifdef CONFIG_ALTIVEC
474 case PTRACE_GETVRREGS: 472 case PTRACE_GETVRREGS:
diff --git a/arch/powerpc/kernel/rtas-rtc.c b/arch/powerpc/kernel/rtas-rtc.c
index 34d073fb6091..77578c093dda 100644
--- a/arch/powerpc/kernel/rtas-rtc.c
+++ b/arch/powerpc/kernel/rtas-rtc.c
@@ -14,19 +14,20 @@
14unsigned long __init rtas_get_boot_time(void) 14unsigned long __init rtas_get_boot_time(void)
15{ 15{
16 int ret[8]; 16 int ret[8];
17 int error, wait_time; 17 int error;
18 unsigned int wait_time;
18 u64 max_wait_tb; 19 u64 max_wait_tb;
19 20
20 max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; 21 max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
21 do { 22 do {
22 error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret); 23 error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
23 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) { 24
24 wait_time = rtas_extended_busy_delay_time(error); 25 wait_time = rtas_busy_delay_time(error);
26 if (wait_time) {
25 /* This is boot time so we spin. */ 27 /* This is boot time so we spin. */
26 udelay(wait_time*1000); 28 udelay(wait_time*1000);
27 error = RTAS_CLOCK_BUSY;
28 } 29 }
29 } while (error == RTAS_CLOCK_BUSY && (get_tb() < max_wait_tb)); 30 } while (wait_time && (get_tb() < max_wait_tb));
30 31
31 if (error != 0 && printk_ratelimit()) { 32 if (error != 0 && printk_ratelimit()) {
32 printk(KERN_WARNING "error: reading the clock failed (%d)\n", 33 printk(KERN_WARNING "error: reading the clock failed (%d)\n",
@@ -44,24 +45,25 @@ unsigned long __init rtas_get_boot_time(void)
44void rtas_get_rtc_time(struct rtc_time *rtc_tm) 45void rtas_get_rtc_time(struct rtc_time *rtc_tm)
45{ 46{
46 int ret[8]; 47 int ret[8];
47 int error, wait_time; 48 int error;
49 unsigned int wait_time;
48 u64 max_wait_tb; 50 u64 max_wait_tb;
49 51
50 max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; 52 max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
51 do { 53 do {
52 error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret); 54 error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
53 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) { 55
56 wait_time = rtas_busy_delay_time(error);
57 if (wait_time) {
54 if (in_interrupt() && printk_ratelimit()) { 58 if (in_interrupt() && printk_ratelimit()) {
55 memset(rtc_tm, 0, sizeof(struct rtc_time)); 59 memset(rtc_tm, 0, sizeof(struct rtc_time));
56 printk(KERN_WARNING "error: reading clock" 60 printk(KERN_WARNING "error: reading clock"
57 " would delay interrupt\n"); 61 " would delay interrupt\n");
58 return; /* delay not allowed */ 62 return; /* delay not allowed */
59 } 63 }
60 wait_time = rtas_extended_busy_delay_time(error);
61 msleep(wait_time); 64 msleep(wait_time);
62 error = RTAS_CLOCK_BUSY;
63 } 65 }
64 } while (error == RTAS_CLOCK_BUSY && (get_tb() < max_wait_tb)); 66 } while (wait_time && (get_tb() < max_wait_tb));
65 67
66 if (error != 0 && printk_ratelimit()) { 68 if (error != 0 && printk_ratelimit()) {
67 printk(KERN_WARNING "error: reading the clock failed (%d)\n", 69 printk(KERN_WARNING "error: reading the clock failed (%d)\n",
@@ -88,14 +90,14 @@ int rtas_set_rtc_time(struct rtc_time *tm)
88 tm->tm_year + 1900, tm->tm_mon + 1, 90 tm->tm_year + 1900, tm->tm_mon + 1,
89 tm->tm_mday, tm->tm_hour, tm->tm_min, 91 tm->tm_mday, tm->tm_hour, tm->tm_min,
90 tm->tm_sec, 0); 92 tm->tm_sec, 0);
91 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) { 93
94 wait_time = rtas_busy_delay_time(error);
95 if (wait_time) {
92 if (in_interrupt()) 96 if (in_interrupt())
93 return 1; /* probably decrementer */ 97 return 1; /* probably decrementer */
94 wait_time = rtas_extended_busy_delay_time(error);
95 msleep(wait_time); 98 msleep(wait_time);
96 error = RTAS_CLOCK_BUSY;
97 } 99 }
98 } while (error == RTAS_CLOCK_BUSY && (get_tb() < max_wait_tb)); 100 } while (wait_time && (get_tb() < max_wait_tb));
99 101
100 if (error != 0 && printk_ratelimit()) 102 if (error != 0 && printk_ratelimit())
101 printk(KERN_WARNING "error: setting the clock failed (%d)\n", 103 printk(KERN_WARNING "error: setting the clock failed (%d)\n",
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 0112318213ab..17dc79198515 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -370,24 +370,36 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
370 return ret; 370 return ret;
371} 371}
372 372
373/* Given an RTAS status code of 990n compute the hinted delay of 10^n 373/* For RTAS_BUSY (-2), delay for 1 millisecond. For an extended busy status
374 * (last digit) milliseconds. For now we bound at n=5 (100 sec). 374 * code of 990n, perform the hinted delay of 10^n (last digit) milliseconds.
375 */ 375 */
376unsigned int rtas_extended_busy_delay_time(int status) 376unsigned int rtas_busy_delay_time(int status)
377{ 377{
378 int order = status - 9900; 378 int order;
379 unsigned long ms; 379 unsigned int ms = 0;
380
381 if (status == RTAS_BUSY) {
382 ms = 1;
383 } else if (status >= 9900 && status <= 9905) {
384 order = status - 9900;
385 for (ms = 1; order > 0; order--)
386 ms *= 10;
387 }
380 388
381 if (order < 0) 389 return ms;
382 order = 0; /* RTC depends on this for -2 clock busy */ 390}
383 else if (order > 5)
384 order = 5; /* bound */
385 391
386 /* Use microseconds for reasonable accuracy */ 392/* For an RTAS busy status code, perform the hinted delay. */
387 for (ms = 1; order > 0; order--) 393unsigned int rtas_busy_delay(int status)
388 ms *= 10; 394{
395 unsigned int ms;
389 396
390 return ms; 397 might_sleep();
398 ms = rtas_busy_delay_time(status);
399 if (ms)
400 msleep(ms);
401
402 return ms;
391} 403}
392 404
393int rtas_error_rc(int rtas_rc) 405int rtas_error_rc(int rtas_rc)
@@ -438,22 +450,14 @@ int rtas_get_power_level(int powerdomain, int *level)
438int rtas_set_power_level(int powerdomain, int level, int *setlevel) 450int rtas_set_power_level(int powerdomain, int level, int *setlevel)
439{ 451{
440 int token = rtas_token("set-power-level"); 452 int token = rtas_token("set-power-level");
441 unsigned int wait_time;
442 int rc; 453 int rc;
443 454
444 if (token == RTAS_UNKNOWN_SERVICE) 455 if (token == RTAS_UNKNOWN_SERVICE)
445 return -ENOENT; 456 return -ENOENT;
446 457
447 while (1) { 458 do {
448 rc = rtas_call(token, 2, 2, setlevel, powerdomain, level); 459 rc = rtas_call(token, 2, 2, setlevel, powerdomain, level);
449 if (rc == RTAS_BUSY) 460 } while (rtas_busy_delay(rc));
450 udelay(1);
451 else if (rtas_is_extended_busy(rc)) {
452 wait_time = rtas_extended_busy_delay_time(rc);
453 udelay(wait_time * 1000);
454 } else
455 break;
456 }
457 461
458 if (rc < 0) 462 if (rc < 0)
459 return rtas_error_rc(rc); 463 return rtas_error_rc(rc);
@@ -463,22 +467,14 @@ int rtas_set_power_level(int powerdomain, int level, int *setlevel)
463int rtas_get_sensor(int sensor, int index, int *state) 467int rtas_get_sensor(int sensor, int index, int *state)
464{ 468{
465 int token = rtas_token("get-sensor-state"); 469 int token = rtas_token("get-sensor-state");
466 unsigned int wait_time;
467 int rc; 470 int rc;
468 471
469 if (token == RTAS_UNKNOWN_SERVICE) 472 if (token == RTAS_UNKNOWN_SERVICE)
470 return -ENOENT; 473 return -ENOENT;
471 474
472 while (1) { 475 do {
473 rc = rtas_call(token, 2, 2, state, sensor, index); 476 rc = rtas_call(token, 2, 2, state, sensor, index);
474 if (rc == RTAS_BUSY) 477 } while (rtas_busy_delay(rc));
475 udelay(1);
476 else if (rtas_is_extended_busy(rc)) {
477 wait_time = rtas_extended_busy_delay_time(rc);
478 udelay(wait_time * 1000);
479 } else
480 break;
481 }
482 478
483 if (rc < 0) 479 if (rc < 0)
484 return rtas_error_rc(rc); 480 return rtas_error_rc(rc);
@@ -488,23 +484,14 @@ int rtas_get_sensor(int sensor, int index, int *state)
488int rtas_set_indicator(int indicator, int index, int new_value) 484int rtas_set_indicator(int indicator, int index, int new_value)
489{ 485{
490 int token = rtas_token("set-indicator"); 486 int token = rtas_token("set-indicator");
491 unsigned int wait_time;
492 int rc; 487 int rc;
493 488
494 if (token == RTAS_UNKNOWN_SERVICE) 489 if (token == RTAS_UNKNOWN_SERVICE)
495 return -ENOENT; 490 return -ENOENT;
496 491
497 while (1) { 492 do {
498 rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value); 493 rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
499 if (rc == RTAS_BUSY) 494 } while (rtas_busy_delay(rc));
500 udelay(1);
501 else if (rtas_is_extended_busy(rc)) {
502 wait_time = rtas_extended_busy_delay_time(rc);
503 udelay(wait_time * 1000);
504 }
505 else
506 break;
507 }
508 495
509 if (rc < 0) 496 if (rc < 0)
510 return rtas_error_rc(rc); 497 return rtas_error_rc(rc);
@@ -555,13 +542,11 @@ void rtas_os_term(char *str)
555 do { 542 do {
556 status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL, 543 status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL,
557 __pa(rtas_os_term_buf)); 544 __pa(rtas_os_term_buf));
545 } while (rtas_busy_delay(status));
558 546
559 if (status == RTAS_BUSY) 547 if (status != 0)
560 udelay(1); 548 printk(KERN_EMERG "ibm,os-term call failed %d\n",
561 else if (status != 0)
562 printk(KERN_EMERG "ibm,os-term call failed %d\n",
563 status); 549 status);
564 } while (status == RTAS_BUSY);
565} 550}
566 551
567static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE; 552static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
@@ -608,9 +593,31 @@ out:
608static int rtas_ibm_suspend_me(struct rtas_args *args) 593static int rtas_ibm_suspend_me(struct rtas_args *args)
609{ 594{
610 int i; 595 int i;
596 long state;
597 long rc;
598 unsigned long dummy;
611 599
612 struct rtas_suspend_me_data data; 600 struct rtas_suspend_me_data data;
613 601
602 /* Make sure the state is valid */
603 rc = plpar_hcall(H_VASI_STATE,
604 ((u64)args->args[0] << 32) | args->args[1],
605 0, 0, 0,
606 &state, &dummy, &dummy);
607
608 if (rc) {
609 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc);
610 return rc;
611 } else if (state == H_VASI_ENABLED) {
612 args->args[args->nargs] = RTAS_NOT_SUSPENDABLE;
613 return 0;
614 } else if (state != H_VASI_SUSPENDING) {
615 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned state %ld\n",
616 state);
617 args->args[args->nargs] = -1;
618 return 0;
619 }
620
614 data.waiting = 1; 621 data.waiting = 1;
615 data.args = args; 622 data.args = args;
616 623
@@ -789,7 +796,8 @@ EXPORT_SYMBOL(rtas_token);
789EXPORT_SYMBOL(rtas_call); 796EXPORT_SYMBOL(rtas_call);
790EXPORT_SYMBOL(rtas_data_buf); 797EXPORT_SYMBOL(rtas_data_buf);
791EXPORT_SYMBOL(rtas_data_buf_lock); 798EXPORT_SYMBOL(rtas_data_buf_lock);
792EXPORT_SYMBOL(rtas_extended_busy_delay_time); 799EXPORT_SYMBOL(rtas_busy_delay_time);
800EXPORT_SYMBOL(rtas_busy_delay);
793EXPORT_SYMBOL(rtas_get_sensor); 801EXPORT_SYMBOL(rtas_get_sensor);
794EXPORT_SYMBOL(rtas_get_power_level); 802EXPORT_SYMBOL(rtas_get_power_level);
795EXPORT_SYMBOL(rtas_set_power_level); 803EXPORT_SYMBOL(rtas_set_power_level);
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index aaf384c3f04a..1442b63a75da 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -365,20 +365,12 @@ static int rtas_excl_release(struct inode *inode, struct file *file)
365 365
366static void manage_flash(struct rtas_manage_flash_t *args_buf) 366static void manage_flash(struct rtas_manage_flash_t *args_buf)
367{ 367{
368 unsigned int wait_time;
369 s32 rc; 368 s32 rc;
370 369
371 while (1) { 370 do {
372 rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1, 371 rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1,
373 1, NULL, args_buf->op); 372 1, NULL, args_buf->op);
374 if (rc == RTAS_RC_BUSY) 373 } while (rtas_busy_delay(rc));
375 udelay(1);
376 else if (rtas_is_extended_busy(rc)) {
377 wait_time = rtas_extended_busy_delay_time(rc);
378 udelay(wait_time * 1000);
379 } else
380 break;
381 }
382 374
383 args_buf->status = rc; 375 args_buf->status = rc;
384} 376}
@@ -451,27 +443,18 @@ static ssize_t manage_flash_write(struct file *file, const char __user *buf,
451static void validate_flash(struct rtas_validate_flash_t *args_buf) 443static void validate_flash(struct rtas_validate_flash_t *args_buf)
452{ 444{
453 int token = rtas_token("ibm,validate-flash-image"); 445 int token = rtas_token("ibm,validate-flash-image");
454 unsigned int wait_time;
455 int update_results; 446 int update_results;
456 s32 rc; 447 s32 rc;
457 448
458 rc = 0; 449 rc = 0;
459 while(1) { 450 do {
460 spin_lock(&rtas_data_buf_lock); 451 spin_lock(&rtas_data_buf_lock);
461 memcpy(rtas_data_buf, args_buf->buf, VALIDATE_BUF_SIZE); 452 memcpy(rtas_data_buf, args_buf->buf, VALIDATE_BUF_SIZE);
462 rc = rtas_call(token, 2, 2, &update_results, 453 rc = rtas_call(token, 2, 2, &update_results,
463 (u32) __pa(rtas_data_buf), args_buf->buf_size); 454 (u32) __pa(rtas_data_buf), args_buf->buf_size);
464 memcpy(args_buf->buf, rtas_data_buf, VALIDATE_BUF_SIZE); 455 memcpy(args_buf->buf, rtas_data_buf, VALIDATE_BUF_SIZE);
465 spin_unlock(&rtas_data_buf_lock); 456 spin_unlock(&rtas_data_buf_lock);
466 457 } while (rtas_busy_delay(rc));
467 if (rc == RTAS_RC_BUSY)
468 udelay(1);
469 else if (rtas_is_extended_busy(rc)) {
470 wait_time = rtas_extended_busy_delay_time(rc);
471 udelay(wait_time * 1000);
472 } else
473 break;
474 }
475 458
476 args_buf->status = rc; 459 args_buf->status = rc;
477 args_buf->update_results = update_results; 460 args_buf->update_results = update_results;
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 57b539a03fa9..6eb7e49b394a 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -313,7 +313,9 @@ unsigned long __init find_and_init_phbs(void)
313 for (node = of_get_next_child(root, NULL); 313 for (node = of_get_next_child(root, NULL);
314 node != NULL; 314 node != NULL;
315 node = of_get_next_child(root, node)) { 315 node = of_get_next_child(root, node)) {
316 if (node->type == NULL || strcmp(node->type, "pci") != 0) 316
317 if (node->type == NULL || (strcmp(node->type, "pci") != 0 &&
318 strcmp(node->type, "pciex") != 0))
317 continue; 319 continue;
318 320
319 phb = pcibios_alloc_controller(node); 321 phb = pcibios_alloc_controller(node);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 684ab1d49c65..bd328123af75 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -443,6 +443,7 @@ void __init smp_setup_cpu_maps(void)
443} 443}
444#endif /* CONFIG_SMP */ 444#endif /* CONFIG_SMP */
445 445
446int __initdata do_early_xmon;
446#ifdef CONFIG_XMON 447#ifdef CONFIG_XMON
447static int __init early_xmon(char *p) 448static int __init early_xmon(char *p)
448{ 449{
@@ -456,7 +457,7 @@ static int __init early_xmon(char *p)
456 return 0; 457 return 0;
457 } 458 }
458 xmon_init(1); 459 xmon_init(1);
459 debugger(NULL); 460 do_early_xmon = 1;
460 461
461 return 0; 462 return 0;
462} 463}
@@ -524,3 +525,20 @@ int check_legacy_ioport(unsigned long base_port)
524 return ppc_md.check_legacy_ioport(base_port); 525 return ppc_md.check_legacy_ioport(base_port);
525} 526}
526EXPORT_SYMBOL(check_legacy_ioport); 527EXPORT_SYMBOL(check_legacy_ioport);
528
529static int ppc_panic_event(struct notifier_block *this,
530 unsigned long event, void *ptr)
531{
532 ppc_md.panic(ptr); /* May not return */
533 return NOTIFY_DONE;
534}
535
536static struct notifier_block ppc_panic_block = {
537 .notifier_call = ppc_panic_event,
538 .priority = INT_MIN /* may not return; must be done last */
539};
540
541void __init setup_panic(void)
542{
543 atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
544}
diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h
index 2ebba755272e..4c67ad7fae08 100644
--- a/arch/powerpc/kernel/setup.h
+++ b/arch/powerpc/kernel/setup.h
@@ -2,5 +2,8 @@
2#define _POWERPC_KERNEL_SETUP_H 2#define _POWERPC_KERNEL_SETUP_H
3 3
4void check_for_initrd(void); 4void check_for_initrd(void);
5void do_init_bootmem(void);
6void setup_panic(void);
7extern int do_early_xmon;
5 8
6#endif /* _POWERPC_KERNEL_SETUP_H */ 9#endif /* _POWERPC_KERNEL_SETUP_H */
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 69ac25701344..e5a44812441a 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -131,12 +131,6 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys)
131 /* Do some early initialization based on the flat device tree */ 131 /* Do some early initialization based on the flat device tree */
132 early_init_devtree(__va(dt_ptr)); 132 early_init_devtree(__va(dt_ptr));
133 133
134 /* Check default command line */
135#ifdef CONFIG_CMDLINE
136 if (cmd_line[0] == 0)
137 strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
138#endif /* CONFIG_CMDLINE */
139
140 probe_machine(); 134 probe_machine();
141 135
142#ifdef CONFIG_6xx 136#ifdef CONFIG_6xx
@@ -235,7 +229,7 @@ arch_initcall(ppc_init);
235/* Warning, IO base is not yet inited */ 229/* Warning, IO base is not yet inited */
236void __init setup_arch(char **cmdline_p) 230void __init setup_arch(char **cmdline_p)
237{ 231{
238 extern void do_init_bootmem(void); 232 *cmdline_p = cmd_line;
239 233
240 /* so udelay does something sensible, assume <= 1000 bogomips */ 234 /* so udelay does something sensible, assume <= 1000 bogomips */
241 loops_per_jiffy = 500000000 / HZ; 235 loops_per_jiffy = 500000000 / HZ;
@@ -285,16 +279,16 @@ void __init setup_arch(char **cmdline_p)
285 /* reboot on panic */ 279 /* reboot on panic */
286 panic_timeout = 180; 280 panic_timeout = 180;
287 281
282 if (ppc_md.panic)
283 setup_panic();
284
288 init_mm.start_code = PAGE_OFFSET; 285 init_mm.start_code = PAGE_OFFSET;
289 init_mm.end_code = (unsigned long) _etext; 286 init_mm.end_code = (unsigned long) _etext;
290 init_mm.end_data = (unsigned long) _edata; 287 init_mm.end_data = (unsigned long) _edata;
291 init_mm.brk = klimit; 288 init_mm.brk = klimit;
292 289
293 /* Save unparsed command line copy for /proc/cmdline */ 290 if (do_early_xmon)
294 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); 291 debugger(NULL);
295 *cmdline_p = cmd_line;
296
297 parse_early_param();
298 292
299 /* set up the bootmem stuff with available memory */ 293 /* set up the bootmem stuff with available memory */
300 do_init_bootmem(); 294 do_init_bootmem();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 4467c49903b6..78f3a5fd43f6 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -100,12 +100,6 @@ unsigned long SYSRQ_KEY;
100#endif /* CONFIG_MAGIC_SYSRQ */ 100#endif /* CONFIG_MAGIC_SYSRQ */
101 101
102 102
103static int ppc64_panic_event(struct notifier_block *, unsigned long, void *);
104static struct notifier_block ppc64_panic_block = {
105 .notifier_call = ppc64_panic_event,
106 .priority = INT_MIN /* may not return; must be done last */
107};
108
109#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
110 104
111static int smt_enabled_cmdline; 105static int smt_enabled_cmdline;
@@ -199,9 +193,7 @@ void __init early_setup(unsigned long dt_ptr)
199 /* Probe the machine type */ 193 /* Probe the machine type */
200 probe_machine(); 194 probe_machine();
201 195
202#ifdef CONFIG_CRASH_DUMP 196 setup_kdump_trampoline();
203 kdump_setup();
204#endif
205 197
206 DBG("Found, Initializing memory management...\n"); 198 DBG("Found, Initializing memory management...\n");
207 199
@@ -353,9 +345,6 @@ void __init setup_system(void)
353{ 345{
354 DBG(" -> setup_system()\n"); 346 DBG(" -> setup_system()\n");
355 347
356#ifdef CONFIG_KEXEC
357 kdump_move_device_tree();
358#endif
359 /* 348 /*
360 * Unflatten the device-tree passed by prom_init or kexec 349 * Unflatten the device-tree passed by prom_init or kexec
361 */ 350 */
@@ -420,10 +409,8 @@ void __init setup_system(void)
420 */ 409 */
421 register_early_udbg_console(); 410 register_early_udbg_console();
422 411
423 /* Save unparsed command line copy for /proc/cmdline */ 412 if (do_early_xmon)
424 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); 413 debugger(NULL);
425
426 parse_early_param();
427 414
428 check_smt_enabled(); 415 check_smt_enabled();
429 smp_setup_cpu_maps(); 416 smp_setup_cpu_maps();
@@ -456,13 +443,6 @@ void __init setup_system(void)
456 DBG(" <- setup_system()\n"); 443 DBG(" <- setup_system()\n");
457} 444}
458 445
459static int ppc64_panic_event(struct notifier_block *this,
460 unsigned long event, void *ptr)
461{
462 ppc_md.panic((char *)ptr); /* May not return */
463 return NOTIFY_DONE;
464}
465
466#ifdef CONFIG_IRQSTACKS 446#ifdef CONFIG_IRQSTACKS
467static void __init irqstack_early_init(void) 447static void __init irqstack_early_init(void)
468{ 448{
@@ -517,8 +497,6 @@ static void __init emergency_stack_init(void)
517 */ 497 */
518void __init setup_arch(char **cmdline_p) 498void __init setup_arch(char **cmdline_p)
519{ 499{
520 extern void do_init_bootmem(void);
521
522 ppc64_boot_msg(0x12, "Setup Arch"); 500 ppc64_boot_msg(0x12, "Setup Arch");
523 501
524 *cmdline_p = cmd_line; 502 *cmdline_p = cmd_line;
@@ -535,8 +513,7 @@ void __init setup_arch(char **cmdline_p)
535 panic_timeout = 180; 513 panic_timeout = 180;
536 514
537 if (ppc_md.panic) 515 if (ppc_md.panic)
538 atomic_notifier_chain_register(&panic_notifier_list, 516 setup_panic();
539 &ppc64_panic_block);
540 517
541 init_mm.start_code = PAGE_OFFSET; 518 init_mm.start_code = PAGE_OFFSET;
542 init_mm.end_code = (unsigned long) _etext; 519 init_mm.end_code = (unsigned long) _etext;
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 8fdeca2d4597..d73b25e22fca 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -419,9 +419,7 @@ static long restore_user_regs(struct pt_regs *regs,
419{ 419{
420 long err; 420 long err;
421 unsigned int save_r2 = 0; 421 unsigned int save_r2 = 0;
422#if defined(CONFIG_ALTIVEC) || defined(CONFIG_SPE)
423 unsigned long msr; 422 unsigned long msr;
424#endif
425 423
426 /* 424 /*
427 * restore general registers but not including MSR or SOFTE. Also 425 * restore general registers but not including MSR or SOFTE. Also
@@ -430,11 +428,16 @@ static long restore_user_regs(struct pt_regs *regs,
430 if (!sig) 428 if (!sig)
431 save_r2 = (unsigned int)regs->gpr[2]; 429 save_r2 = (unsigned int)regs->gpr[2];
432 err = restore_general_regs(regs, sr); 430 err = restore_general_regs(regs, sr);
431 err |= __get_user(msr, &sr->mc_gregs[PT_MSR]);
433 if (!sig) 432 if (!sig)
434 regs->gpr[2] = (unsigned long) save_r2; 433 regs->gpr[2] = (unsigned long) save_r2;
435 if (err) 434 if (err)
436 return 1; 435 return 1;
437 436
437 /* if doing signal return, restore the previous little-endian mode */
438 if (sig)
439 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);
440
438 /* 441 /*
439 * Do this before updating the thread state in 442 * Do this before updating the thread state in
440 * current->thread.fpr/vr/evr. That way, if we get preempted 443 * current->thread.fpr/vr/evr. That way, if we get preempted
@@ -455,7 +458,7 @@ static long restore_user_regs(struct pt_regs *regs,
455 /* force the process to reload the altivec registers from 458 /* force the process to reload the altivec registers from
456 current->thread when it next does altivec instructions */ 459 current->thread when it next does altivec instructions */
457 regs->msr &= ~MSR_VEC; 460 regs->msr &= ~MSR_VEC;
458 if (!__get_user(msr, &sr->mc_gregs[PT_MSR]) && (msr & MSR_VEC) != 0) { 461 if (msr & MSR_VEC) {
459 /* restore altivec registers from the stack */ 462 /* restore altivec registers from the stack */
460 if (__copy_from_user(current->thread.vr, &sr->mc_vregs, 463 if (__copy_from_user(current->thread.vr, &sr->mc_vregs,
461 sizeof(sr->mc_vregs))) 464 sizeof(sr->mc_vregs)))
@@ -472,7 +475,7 @@ static long restore_user_regs(struct pt_regs *regs,
472 /* force the process to reload the spe registers from 475 /* force the process to reload the spe registers from
473 current->thread when it next does spe instructions */ 476 current->thread when it next does spe instructions */
474 regs->msr &= ~MSR_SPE; 477 regs->msr &= ~MSR_SPE;
475 if (!__get_user(msr, &sr->mc_gregs[PT_MSR]) && (msr & MSR_SPE) != 0) { 478 if (msr & MSR_SPE) {
476 /* restore spe registers from the stack */ 479 /* restore spe registers from the stack */
477 if (__copy_from_user(current->thread.evr, &sr->mc_vregs, 480 if (__copy_from_user(current->thread.evr, &sr->mc_vregs,
478 ELF_NEVRREG * sizeof(u32))) 481 ELF_NEVRREG * sizeof(u32)))
@@ -757,10 +760,10 @@ static int handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
757 760
758 /* Save user registers on the stack */ 761 /* Save user registers on the stack */
759 frame = &rt_sf->uc.uc_mcontext; 762 frame = &rt_sf->uc.uc_mcontext;
760 if (vdso32_rt_sigtramp && current->thread.vdso_base) { 763 if (vdso32_rt_sigtramp && current->mm->context.vdso_base) {
761 if (save_user_regs(regs, frame, 0)) 764 if (save_user_regs(regs, frame, 0))
762 goto badframe; 765 goto badframe;
763 regs->link = current->thread.vdso_base + vdso32_rt_sigtramp; 766 regs->link = current->mm->context.vdso_base + vdso32_rt_sigtramp;
764 } else { 767 } else {
765 if (save_user_regs(regs, frame, __NR_rt_sigreturn)) 768 if (save_user_regs(regs, frame, __NR_rt_sigreturn))
766 goto badframe; 769 goto badframe;
@@ -777,6 +780,8 @@ static int handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
777 regs->gpr[5] = (unsigned long) &rt_sf->uc; 780 regs->gpr[5] = (unsigned long) &rt_sf->uc;
778 regs->gpr[6] = (unsigned long) rt_sf; 781 regs->gpr[6] = (unsigned long) rt_sf;
779 regs->nip = (unsigned long) ka->sa.sa_handler; 782 regs->nip = (unsigned long) ka->sa.sa_handler;
783 /* enter the signal handler in big-endian mode */
784 regs->msr &= ~MSR_LE;
780 regs->trap = 0; 785 regs->trap = 0;
781 return 1; 786 return 1;
782 787
@@ -1038,10 +1043,10 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka,
1038 || __put_user(sig, &sc->signal)) 1043 || __put_user(sig, &sc->signal))
1039 goto badframe; 1044 goto badframe;
1040 1045
1041 if (vdso32_sigtramp && current->thread.vdso_base) { 1046 if (vdso32_sigtramp && current->mm->context.vdso_base) {
1042 if (save_user_regs(regs, &frame->mctx, 0)) 1047 if (save_user_regs(regs, &frame->mctx, 0))
1043 goto badframe; 1048 goto badframe;
1044 regs->link = current->thread.vdso_base + vdso32_sigtramp; 1049 regs->link = current->mm->context.vdso_base + vdso32_sigtramp;
1045 } else { 1050 } else {
1046 if (save_user_regs(regs, &frame->mctx, __NR_sigreturn)) 1051 if (save_user_regs(regs, &frame->mctx, __NR_sigreturn))
1047 goto badframe; 1052 goto badframe;
@@ -1056,6 +1061,8 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka,
1056 regs->gpr[3] = sig; 1061 regs->gpr[3] = sig;
1057 regs->gpr[4] = (unsigned long) sc; 1062 regs->gpr[4] = (unsigned long) sc;
1058 regs->nip = (unsigned long) ka->sa.sa_handler; 1063 regs->nip = (unsigned long) ka->sa.sa_handler;
1064 /* enter the signal handler in big-endian mode */
1065 regs->msr &= ~MSR_LE;
1059 regs->trap = 0; 1066 regs->trap = 0;
1060 1067
1061 return 1; 1068 return 1;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index c2db642f4cdd..6e75d7ab6d4d 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -141,9 +141,7 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
141 unsigned long err = 0; 141 unsigned long err = 0;
142 unsigned long save_r13 = 0; 142 unsigned long save_r13 = 0;
143 elf_greg_t *gregs = (elf_greg_t *)regs; 143 elf_greg_t *gregs = (elf_greg_t *)regs;
144#ifdef CONFIG_ALTIVEC
145 unsigned long msr; 144 unsigned long msr;
146#endif
147 int i; 145 int i;
148 146
149 /* If this is not a signal return, we preserve the TLS in r13 */ 147 /* If this is not a signal return, we preserve the TLS in r13 */
@@ -154,7 +152,12 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
154 err |= __copy_from_user(regs, &sc->gp_regs, 152 err |= __copy_from_user(regs, &sc->gp_regs,
155 PT_MSR*sizeof(unsigned long)); 153 PT_MSR*sizeof(unsigned long));
156 154
157 /* skip MSR and SOFTE */ 155 /* get MSR separately, transfer the LE bit if doing signal return */
156 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
157 if (sig)
158 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);
159
160 /* skip SOFTE */
158 for (i = PT_MSR+1; i <= PT_RESULT; i++) { 161 for (i = PT_MSR+1; i <= PT_RESULT; i++) {
159 if (i == PT_SOFTE) 162 if (i == PT_SOFTE)
160 continue; 163 continue;
@@ -179,7 +182,6 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
179 182
180#ifdef CONFIG_ALTIVEC 183#ifdef CONFIG_ALTIVEC
181 err |= __get_user(v_regs, &sc->v_regs); 184 err |= __get_user(v_regs, &sc->v_regs);
182 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
183 if (err) 185 if (err)
184 return err; 186 return err;
185 if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128))) 187 if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128)))
@@ -396,8 +398,8 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
396 current->thread.fpscr.val = 0; 398 current->thread.fpscr.val = 0;
397 399
398 /* Set up to return from userspace. */ 400 /* Set up to return from userspace. */
399 if (vdso64_rt_sigtramp && current->thread.vdso_base) { 401 if (vdso64_rt_sigtramp && current->mm->context.vdso_base) {
400 regs->link = current->thread.vdso_base + vdso64_rt_sigtramp; 402 regs->link = current->mm->context.vdso_base + vdso64_rt_sigtramp;
401 } else { 403 } else {
402 err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]); 404 err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
403 if (err) 405 if (err)
@@ -412,6 +414,8 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
412 414
413 /* Set up "regs" so we "return" to the signal handler. */ 415 /* Set up "regs" so we "return" to the signal handler. */
414 err |= get_user(regs->nip, &funct_desc_ptr->entry); 416 err |= get_user(regs->nip, &funct_desc_ptr->entry);
417 /* enter the signal handler in big-endian mode */
418 regs->msr &= ~MSR_LE;
415 regs->gpr[1] = newsp; 419 regs->gpr[1] = newsp;
416 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc); 420 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
417 regs->gpr[3] = signr; 421 regs->gpr[3] = signr;
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 530f7dba0bd2..c5d179d4f818 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -492,7 +492,7 @@ int __devinit __cpu_up(unsigned int cpu)
492 * -- Cort 492 * -- Cort
493 */ 493 */
494 if (system_state < SYSTEM_RUNNING) 494 if (system_state < SYSTEM_RUNNING)
495 for (c = 5000; c && !cpu_callin_map[cpu]; c--) 495 for (c = 50000; c && !cpu_callin_map[cpu]; c--)
496 udelay(100); 496 udelay(100);
497#ifdef CONFIG_HOTPLUG_CPU 497#ifdef CONFIG_HOTPLUG_CPU
498 else 498 else
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index 26ed1f5ef16e..ee75ccf1a802 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -32,6 +32,10 @@
32#define SYS32ONLY(func) .long sys_##func 32#define SYS32ONLY(func) .long sys_##func
33#define SYSX(f, f3264, f32) .long f32 33#define SYSX(f, f3264, f32) .long f32
34#endif 34#endif
35#define SYSCALL_SPU(func) SYSCALL(func)
36#define COMPAT_SYS_SPU(func) COMPAT_SYS(func)
37#define PPC_SYS_SPU(func) PPC_SYS(func)
38#define SYSX_SPU(f, f3264, f32) SYSX(f, f3264, f32)
35 39
36#ifdef CONFIG_PPC64 40#ifdef CONFIG_PPC64
37#define sys_sigpending sys_ni_syscall 41#define sys_sigpending sys_ni_syscall
@@ -39,309 +43,4 @@
39#endif 43#endif
40 44
41_GLOBAL(sys_call_table) 45_GLOBAL(sys_call_table)
42SYSCALL(restart_syscall) 46#include <asm/systbl.h>
43SYSCALL(exit)
44PPC_SYS(fork)
45SYSCALL(read)
46SYSCALL(write)
47COMPAT_SYS(open)
48SYSCALL(close)
49COMPAT_SYS(waitpid)
50COMPAT_SYS(creat)
51SYSCALL(link)
52SYSCALL(unlink)
53COMPAT_SYS(execve)
54SYSCALL(chdir)
55COMPAT_SYS(time)
56SYSCALL(mknod)
57SYSCALL(chmod)
58SYSCALL(lchown)
59SYSCALL(ni_syscall)
60OLDSYS(stat)
61SYSX(sys_lseek,ppc32_lseek,sys_lseek)
62SYSCALL(getpid)
63COMPAT_SYS(mount)
64SYSX(sys_ni_syscall,sys_oldumount,sys_oldumount)
65SYSCALL(setuid)
66SYSCALL(getuid)
67COMPAT_SYS(stime)
68COMPAT_SYS(ptrace)
69SYSCALL(alarm)
70OLDSYS(fstat)
71COMPAT_SYS(pause)
72COMPAT_SYS(utime)
73SYSCALL(ni_syscall)
74SYSCALL(ni_syscall)
75COMPAT_SYS(access)
76COMPAT_SYS(nice)
77SYSCALL(ni_syscall)
78SYSCALL(sync)
79COMPAT_SYS(kill)
80SYSCALL(rename)
81COMPAT_SYS(mkdir)
82SYSCALL(rmdir)
83SYSCALL(dup)
84SYSCALL(pipe)
85COMPAT_SYS(times)
86SYSCALL(ni_syscall)
87SYSCALL(brk)
88SYSCALL(setgid)
89SYSCALL(getgid)
90SYSCALL(signal)
91SYSCALL(geteuid)
92SYSCALL(getegid)
93SYSCALL(acct)
94SYSCALL(umount)
95SYSCALL(ni_syscall)
96COMPAT_SYS(ioctl)
97COMPAT_SYS(fcntl)
98SYSCALL(ni_syscall)
99COMPAT_SYS(setpgid)
100SYSCALL(ni_syscall)
101SYSX(sys_ni_syscall,sys_olduname, sys_olduname)
102COMPAT_SYS(umask)
103SYSCALL(chroot)
104SYSCALL(ustat)
105SYSCALL(dup2)
106SYSCALL(getppid)
107SYSCALL(getpgrp)
108SYSCALL(setsid)
109SYS32ONLY(sigaction)
110SYSCALL(sgetmask)
111COMPAT_SYS(ssetmask)
112SYSCALL(setreuid)
113SYSCALL(setregid)
114SYS32ONLY(sigsuspend)
115COMPAT_SYS(sigpending)
116COMPAT_SYS(sethostname)
117COMPAT_SYS(setrlimit)
118COMPAT_SYS(old_getrlimit)
119COMPAT_SYS(getrusage)
120COMPAT_SYS(gettimeofday)
121COMPAT_SYS(settimeofday)
122COMPAT_SYS(getgroups)
123COMPAT_SYS(setgroups)
124SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select)
125SYSCALL(symlink)
126OLDSYS(lstat)
127COMPAT_SYS(readlink)
128SYSCALL(uselib)
129SYSCALL(swapon)
130SYSCALL(reboot)
131SYSX(sys_ni_syscall,old32_readdir,old_readdir)
132SYSCALL(mmap)
133SYSCALL(munmap)
134SYSCALL(truncate)
135SYSCALL(ftruncate)
136SYSCALL(fchmod)
137SYSCALL(fchown)
138COMPAT_SYS(getpriority)
139COMPAT_SYS(setpriority)
140SYSCALL(ni_syscall)
141COMPAT_SYS(statfs)
142COMPAT_SYS(fstatfs)
143SYSCALL(ni_syscall)
144COMPAT_SYS(socketcall)
145COMPAT_SYS(syslog)
146COMPAT_SYS(setitimer)
147COMPAT_SYS(getitimer)
148COMPAT_SYS(newstat)
149COMPAT_SYS(newlstat)
150COMPAT_SYS(newfstat)
151SYSX(sys_ni_syscall,sys_uname,sys_uname)
152SYSCALL(ni_syscall)
153SYSCALL(vhangup)
154SYSCALL(ni_syscall)
155SYSCALL(ni_syscall)
156COMPAT_SYS(wait4)
157SYSCALL(swapoff)
158COMPAT_SYS(sysinfo)
159COMPAT_SYS(ipc)
160SYSCALL(fsync)
161SYS32ONLY(sigreturn)
162PPC_SYS(clone)
163COMPAT_SYS(setdomainname)
164PPC_SYS(newuname)
165SYSCALL(ni_syscall)
166COMPAT_SYS(adjtimex)
167SYSCALL(mprotect)
168SYSX(sys_ni_syscall,compat_sys_sigprocmask,sys_sigprocmask)
169SYSCALL(ni_syscall)
170SYSCALL(init_module)
171SYSCALL(delete_module)
172SYSCALL(ni_syscall)
173SYSCALL(quotactl)
174COMPAT_SYS(getpgid)
175SYSCALL(fchdir)
176SYSCALL(bdflush)
177COMPAT_SYS(sysfs)
178SYSX(ppc64_personality,ppc64_personality,sys_personality)
179SYSCALL(ni_syscall)
180SYSCALL(setfsuid)
181SYSCALL(setfsgid)
182SYSCALL(llseek)
183COMPAT_SYS(getdents)
184SYSX(sys_select,ppc32_select,ppc_select)
185SYSCALL(flock)
186SYSCALL(msync)
187COMPAT_SYS(readv)
188COMPAT_SYS(writev)
189COMPAT_SYS(getsid)
190SYSCALL(fdatasync)
191COMPAT_SYS(sysctl)
192SYSCALL(mlock)
193SYSCALL(munlock)
194SYSCALL(mlockall)
195SYSCALL(munlockall)
196COMPAT_SYS(sched_setparam)
197COMPAT_SYS(sched_getparam)
198COMPAT_SYS(sched_setscheduler)
199COMPAT_SYS(sched_getscheduler)
200SYSCALL(sched_yield)
201COMPAT_SYS(sched_get_priority_max)
202COMPAT_SYS(sched_get_priority_min)
203COMPAT_SYS(sched_rr_get_interval)
204COMPAT_SYS(nanosleep)
205SYSCALL(mremap)
206SYSCALL(setresuid)
207SYSCALL(getresuid)
208SYSCALL(ni_syscall)
209SYSCALL(poll)
210COMPAT_SYS(nfsservctl)
211SYSCALL(setresgid)
212SYSCALL(getresgid)
213COMPAT_SYS(prctl)
214COMPAT_SYS(rt_sigreturn)
215COMPAT_SYS(rt_sigaction)
216COMPAT_SYS(rt_sigprocmask)
217COMPAT_SYS(rt_sigpending)
218COMPAT_SYS(rt_sigtimedwait)
219COMPAT_SYS(rt_sigqueueinfo)
220COMPAT_SYS(rt_sigsuspend)
221COMPAT_SYS(pread64)
222COMPAT_SYS(pwrite64)
223SYSCALL(chown)
224SYSCALL(getcwd)
225SYSCALL(capget)
226SYSCALL(capset)
227COMPAT_SYS(sigaltstack)
228SYSX(sys_sendfile64,compat_sys_sendfile,sys_sendfile)
229SYSCALL(ni_syscall)
230SYSCALL(ni_syscall)
231PPC_SYS(vfork)
232COMPAT_SYS(getrlimit)
233COMPAT_SYS(readahead)
234SYS32ONLY(mmap2)
235SYS32ONLY(truncate64)
236SYS32ONLY(ftruncate64)
237SYSX(sys_ni_syscall,sys_stat64,sys_stat64)
238SYSX(sys_ni_syscall,sys_lstat64,sys_lstat64)
239SYSX(sys_ni_syscall,sys_fstat64,sys_fstat64)
240SYSCALL(pciconfig_read)
241SYSCALL(pciconfig_write)
242SYSCALL(pciconfig_iobase)
243SYSCALL(ni_syscall)
244SYSCALL(getdents64)
245SYSCALL(pivot_root)
246SYSX(sys_ni_syscall,compat_sys_fcntl64,sys_fcntl64)
247SYSCALL(madvise)
248SYSCALL(mincore)
249SYSCALL(gettid)
250SYSCALL(tkill)
251SYSCALL(setxattr)
252SYSCALL(lsetxattr)
253SYSCALL(fsetxattr)
254SYSCALL(getxattr)
255SYSCALL(lgetxattr)
256SYSCALL(fgetxattr)
257SYSCALL(listxattr)
258SYSCALL(llistxattr)
259SYSCALL(flistxattr)
260SYSCALL(removexattr)
261SYSCALL(lremovexattr)
262SYSCALL(fremovexattr)
263COMPAT_SYS(futex)
264COMPAT_SYS(sched_setaffinity)
265COMPAT_SYS(sched_getaffinity)
266SYSCALL(ni_syscall)
267SYSCALL(ni_syscall)
268SYS32ONLY(sendfile64)
269COMPAT_SYS(io_setup)
270SYSCALL(io_destroy)
271COMPAT_SYS(io_getevents)
272COMPAT_SYS(io_submit)
273SYSCALL(io_cancel)
274SYSCALL(set_tid_address)
275SYSX(sys_fadvise64,ppc32_fadvise64,sys_fadvise64)
276SYSCALL(exit_group)
277SYSX(sys_lookup_dcookie,ppc32_lookup_dcookie,sys_lookup_dcookie)
278SYSCALL(epoll_create)
279SYSCALL(epoll_ctl)
280SYSCALL(epoll_wait)
281SYSCALL(remap_file_pages)
282SYSX(sys_timer_create,compat_sys_timer_create,sys_timer_create)
283COMPAT_SYS(timer_settime)
284COMPAT_SYS(timer_gettime)
285SYSCALL(timer_getoverrun)
286SYSCALL(timer_delete)
287COMPAT_SYS(clock_settime)
288COMPAT_SYS(clock_gettime)
289COMPAT_SYS(clock_getres)
290COMPAT_SYS(clock_nanosleep)
291SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext)
292COMPAT_SYS(tgkill)
293COMPAT_SYS(utimes)
294COMPAT_SYS(statfs64)
295COMPAT_SYS(fstatfs64)
296SYSX(sys_ni_syscall, ppc_fadvise64_64, ppc_fadvise64_64)
297PPC_SYS(rtas)
298OLDSYS(debug_setcontext)
299SYSCALL(ni_syscall)
300SYSCALL(ni_syscall)
301COMPAT_SYS(mbind)
302COMPAT_SYS(get_mempolicy)
303COMPAT_SYS(set_mempolicy)
304COMPAT_SYS(mq_open)
305SYSCALL(mq_unlink)
306COMPAT_SYS(mq_timedsend)
307COMPAT_SYS(mq_timedreceive)
308COMPAT_SYS(mq_notify)
309COMPAT_SYS(mq_getsetattr)
310COMPAT_SYS(kexec_load)
311COMPAT_SYS(add_key)
312COMPAT_SYS(request_key)
313COMPAT_SYS(keyctl)
314COMPAT_SYS(waitid)
315COMPAT_SYS(ioprio_set)
316COMPAT_SYS(ioprio_get)
317SYSCALL(inotify_init)
318SYSCALL(inotify_add_watch)
319SYSCALL(inotify_rm_watch)
320SYSCALL(spu_run)
321SYSCALL(spu_create)
322COMPAT_SYS(pselect6)
323COMPAT_SYS(ppoll)
324SYSCALL(unshare)
325SYSCALL(splice)
326SYSCALL(tee)
327SYSCALL(vmsplice)
328COMPAT_SYS(openat)
329SYSCALL(mkdirat)
330SYSCALL(mknodat)
331SYSCALL(fchownat)
332COMPAT_SYS(futimesat)
333SYSX(sys_newfstatat, sys_fstatat64, sys_fstatat64)
334SYSCALL(unlinkat)
335SYSCALL(renameat)
336SYSCALL(linkat)
337SYSCALL(symlinkat)
338SYSCALL(readlinkat)
339SYSCALL(fchmodat)
340SYSCALL(faccessat)
341COMPAT_SYS(get_robust_list)
342COMPAT_SYS(set_robust_list)
343
344/*
345 * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
346 * as well when appropriate.
347 */
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 24e3ad756de0..d20907561f46 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -76,7 +76,6 @@
76 76
77/* keep track of when we need to update the rtc */ 77/* keep track of when we need to update the rtc */
78time_t last_rtc_update; 78time_t last_rtc_update;
79extern int piranha_simulator;
80#ifdef CONFIG_PPC_ISERIES 79#ifdef CONFIG_PPC_ISERIES
81unsigned long iSeries_recal_titan = 0; 80unsigned long iSeries_recal_titan = 0;
82unsigned long iSeries_recal_tb = 0; 81unsigned long iSeries_recal_tb = 0;
@@ -858,42 +857,50 @@ int do_settimeofday(struct timespec *tv)
858 857
859EXPORT_SYMBOL(do_settimeofday); 858EXPORT_SYMBOL(do_settimeofday);
860 859
861void __init generic_calibrate_decr(void) 860static int __init get_freq(char *name, int cells, unsigned long *val)
862{ 861{
863 struct device_node *cpu; 862 struct device_node *cpu;
864 unsigned int *fp; 863 unsigned int *fp;
865 int node_found; 864 int found = 0;
866 865
867 /* 866 /* The cpu node should have timebase and clock frequency properties */
868 * The cpu node should have a timebase-frequency property
869 * to tell us the rate at which the decrementer counts.
870 */
871 cpu = of_find_node_by_type(NULL, "cpu"); 867 cpu = of_find_node_by_type(NULL, "cpu");
872 868
873 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
874 node_found = 0;
875 if (cpu) { 869 if (cpu) {
876 fp = (unsigned int *)get_property(cpu, "timebase-frequency", 870 fp = (unsigned int *)get_property(cpu, name, NULL);
877 NULL);
878 if (fp) { 871 if (fp) {
879 node_found = 1; 872 found = 1;
880 ppc_tb_freq = *fp; 873 *val = 0;
874 while (cells--)
875 *val = (*val << 32) | *fp++;
881 } 876 }
877
878 of_node_put(cpu);
882 } 879 }
883 if (!node_found) 880
881 return found;
882}
883
884void __init generic_calibrate_decr(void)
885{
886 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
887
888 if (!get_freq("ibm,extended-timebase-frequency", 2, &ppc_tb_freq) &&
889 !get_freq("timebase-frequency", 1, &ppc_tb_freq)) {
890
884 printk(KERN_ERR "WARNING: Estimating decrementer frequency " 891 printk(KERN_ERR "WARNING: Estimating decrementer frequency "
885 "(not found)\n"); 892 "(not found)\n");
893 }
886 894
887 ppc_proc_freq = DEFAULT_PROC_FREQ; 895 ppc_proc_freq = DEFAULT_PROC_FREQ; /* hardcoded default */
888 node_found = 0; 896
889 if (cpu) { 897 if (!get_freq("ibm,extended-clock-frequency", 2, &ppc_proc_freq) &&
890 fp = (unsigned int *)get_property(cpu, "clock-frequency", 898 !get_freq("clock-frequency", 1, &ppc_proc_freq)) {
891 NULL); 899
892 if (fp) { 900 printk(KERN_ERR "WARNING: Estimating processor frequency "
893 node_found = 1; 901 "(not found)\n");
894 ppc_proc_freq = *fp;
895 }
896 } 902 }
903
897#ifdef CONFIG_BOOKE 904#ifdef CONFIG_BOOKE
898 /* Set the time base to zero */ 905 /* Set the time base to zero */
899 mtspr(SPRN_TBWL, 0); 906 mtspr(SPRN_TBWL, 0);
@@ -905,11 +912,6 @@ void __init generic_calibrate_decr(void)
905 /* Enable decrementer interrupt */ 912 /* Enable decrementer interrupt */
906 mtspr(SPRN_TCR, TCR_DIE); 913 mtspr(SPRN_TCR, TCR_DIE);
907#endif 914#endif
908 if (!node_found)
909 printk(KERN_ERR "WARNING: Estimating processor frequency "
910 "(not found)\n");
911
912 of_node_put(cpu);
913} 915}
914 916
915unsigned long get_boot_time(void) 917unsigned long get_boot_time(void)
@@ -945,9 +947,9 @@ void __init time_init(void)
945 } else { 947 } else {
946 /* Normal PowerPC with timebase register */ 948 /* Normal PowerPC with timebase register */
947 ppc_md.calibrate_decr(); 949 ppc_md.calibrate_decr();
948 printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n", 950 printk(KERN_DEBUG "time_init: decrementer frequency = %lu.%.6lu MHz\n",
949 ppc_tb_freq / 1000000, ppc_tb_freq % 1000000); 951 ppc_tb_freq / 1000000, ppc_tb_freq % 1000000);
950 printk(KERN_INFO "time_init: processor frequency = %lu.%.6lu MHz\n", 952 printk(KERN_DEBUG "time_init: processor frequency = %lu.%.6lu MHz\n",
951 ppc_proc_freq / 1000000, ppc_proc_freq % 1000000); 953 ppc_proc_freq / 1000000, ppc_proc_freq % 1000000);
952 tb_last_stamp = tb_last_jiffy = get_tb(); 954 tb_last_stamp = tb_last_jiffy = get_tb();
953 } 955 }
@@ -1010,10 +1012,7 @@ void __init time_init(void)
1010 tb_to_ns_scale = scale; 1012 tb_to_ns_scale = scale;
1011 tb_to_ns_shift = shift; 1013 tb_to_ns_shift = shift;
1012 1014
1013#ifdef CONFIG_PPC_ISERIES 1015 tm = get_boot_time();
1014 if (!piranha_simulator)
1015#endif
1016 tm = get_boot_time();
1017 1016
1018 write_seqlock_irqsave(&xtime_lock, flags); 1017 write_seqlock_irqsave(&xtime_lock, flags);
1019 1018
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 064a52564692..91a6e04d9741 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -658,7 +658,7 @@ static int emulate_instruction(struct pt_regs *regs)
658 u32 instword; 658 u32 instword;
659 u32 rd; 659 u32 rd;
660 660
661 if (!user_mode(regs)) 661 if (!user_mode(regs) || (regs->msr & MSR_LE))
662 return -EINVAL; 662 return -EINVAL;
663 CHECK_FULL_REGS(regs); 663 CHECK_FULL_REGS(regs);
664 664
@@ -805,9 +805,11 @@ void __kprobes program_check_exception(struct pt_regs *regs)
805 805
806void alignment_exception(struct pt_regs *regs) 806void alignment_exception(struct pt_regs *regs)
807{ 807{
808 int fixed; 808 int fixed = 0;
809 809
810 fixed = fix_alignment(regs); 810 /* we don't implement logging of alignment exceptions */
811 if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS))
812 fixed = fix_alignment(regs);
811 813
812 if (fixed == 1) { 814 if (fixed == 1) {
813 regs->nip += 4; /* skip over emulated instruction */ 815 regs->nip += 4; /* skip over emulated instruction */
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 3774e80094f5..67d9fd9ae2b5 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -14,6 +14,7 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/console.h> 16#include <linux/console.h>
17#include <linux/init.h>
17#include <asm/processor.h> 18#include <asm/processor.h>
18#include <asm/udbg.h> 19#include <asm/udbg.h>
19 20
@@ -141,12 +142,14 @@ static int early_console_initialized;
141 142
142void __init disable_early_printk(void) 143void __init disable_early_printk(void)
143{ 144{
144#if 1
145 if (!early_console_initialized) 145 if (!early_console_initialized)
146 return; 146 return;
147 if (strstr(saved_command_line, "udbg-immortal")) {
148 printk(KERN_INFO "early console immortal !\n");
149 return;
150 }
147 unregister_console(&udbg_console); 151 unregister_console(&udbg_console);
148 early_console_initialized = 0; 152 early_console_initialized = 0;
149#endif
150} 153}
151 154
152/* called by setup_system */ 155/* called by setup_system */
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 573afb68d69e..bc3e15be3087 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -223,6 +223,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
223 struct vm_area_struct *vma; 223 struct vm_area_struct *vma;
224 unsigned long vdso_pages; 224 unsigned long vdso_pages;
225 unsigned long vdso_base; 225 unsigned long vdso_base;
226 int rc;
226 227
227#ifdef CONFIG_PPC64 228#ifdef CONFIG_PPC64
228 if (test_thread_flag(TIF_32BIT)) { 229 if (test_thread_flag(TIF_32BIT)) {
@@ -237,20 +238,13 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
237 vdso_base = VDSO32_MBASE; 238 vdso_base = VDSO32_MBASE;
238#endif 239#endif
239 240
240 current->thread.vdso_base = 0; 241 current->mm->context.vdso_base = 0;
241 242
242 /* vDSO has a problem and was disabled, just don't "enable" it for the 243 /* vDSO has a problem and was disabled, just don't "enable" it for the
243 * process 244 * process
244 */ 245 */
245 if (vdso_pages == 0) 246 if (vdso_pages == 0)
246 return 0; 247 return 0;
247
248 vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
249 if (vma == NULL)
250 return -ENOMEM;
251
252 memset(vma, 0, sizeof(*vma));
253
254 /* Add a page to the vdso size for the data page */ 248 /* Add a page to the vdso size for the data page */
255 vdso_pages ++; 249 vdso_pages ++;
256 250
@@ -259,17 +253,23 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
259 * at vdso_base which is the "natural" base for it, but we might fail 253 * at vdso_base which is the "natural" base for it, but we might fail
260 * and end up putting it elsewhere. 254 * and end up putting it elsewhere.
261 */ 255 */
256 down_write(&mm->mmap_sem);
262 vdso_base = get_unmapped_area(NULL, vdso_base, 257 vdso_base = get_unmapped_area(NULL, vdso_base,
263 vdso_pages << PAGE_SHIFT, 0, 0); 258 vdso_pages << PAGE_SHIFT, 0, 0);
264 if (vdso_base & ~PAGE_MASK) { 259 if (IS_ERR_VALUE(vdso_base)) {
265 kmem_cache_free(vm_area_cachep, vma); 260 rc = vdso_base;
266 return (int)vdso_base; 261 goto fail_mmapsem;
267 } 262 }
268 263
269 current->thread.vdso_base = vdso_base;
270 264
265 /* Allocate a VMA structure and fill it up */
266 vma = kmem_cache_zalloc(vm_area_cachep, SLAB_KERNEL);
267 if (vma == NULL) {
268 rc = -ENOMEM;
269 goto fail_mmapsem;
270 }
271 vma->vm_mm = mm; 271 vma->vm_mm = mm;
272 vma->vm_start = current->thread.vdso_base; 272 vma->vm_start = vdso_base;
273 vma->vm_end = vma->vm_start + (vdso_pages << PAGE_SHIFT); 273 vma->vm_end = vma->vm_start + (vdso_pages << PAGE_SHIFT);
274 274
275 /* 275 /*
@@ -282,23 +282,38 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
282 * It's fine to use that for setting breakpoints in the vDSO code 282 * It's fine to use that for setting breakpoints in the vDSO code
283 * pages though 283 * pages though
284 */ 284 */
285 vma->vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC; 285 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC;
286 vma->vm_flags |= mm->def_flags; 286 vma->vm_flags |= mm->def_flags;
287 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7]; 287 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
288 vma->vm_ops = &vdso_vmops; 288 vma->vm_ops = &vdso_vmops;
289 289
290 down_write(&mm->mmap_sem); 290 /* Insert new VMA */
291 if (insert_vm_struct(mm, vma)) { 291 rc = insert_vm_struct(mm, vma);
292 up_write(&mm->mmap_sem); 292 if (rc)
293 kmem_cache_free(vm_area_cachep, vma); 293 goto fail_vma;
294 return -ENOMEM; 294
295 } 295 /* Put vDSO base into mm struct and account for memory usage */
296 current->mm->context.vdso_base = vdso_base;
296 mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 297 mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
297 up_write(&mm->mmap_sem); 298 up_write(&mm->mmap_sem);
298
299 return 0; 299 return 0;
300
301 fail_vma:
302 kmem_cache_free(vm_area_cachep, vma);
303 fail_mmapsem:
304 up_write(&mm->mmap_sem);
305 return rc;
306}
307
308const char *arch_vma_name(struct vm_area_struct *vma)
309{
310 if (vma->vm_mm && vma->vm_start == vma->vm_mm->context.vdso_base)
311 return "[vdso]";
312 return NULL;
300} 313}
301 314
315
316
302static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname, 317static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname,
303 unsigned long *size) 318 unsigned long *size)
304{ 319{
diff --git a/arch/powerpc/kernel/vector.S b/arch/powerpc/kernel/vector.S
index 66b3d03c5fa5..9416b4ab92ec 100644
--- a/arch/powerpc/kernel/vector.S
+++ b/arch/powerpc/kernel/vector.S
@@ -53,12 +53,12 @@ fpenable:
53 stfd fr31,8(r1) 53 stfd fr31,8(r1)
54 LDCONST(fr1, fpzero) 54 LDCONST(fr1, fpzero)
55 mffs fr31 55 mffs fr31
56 mtfsf 0xff,fr1 56 MTFSF_L(fr1)
57 blr 57 blr
58 58
59fpdisable: 59fpdisable:
60 mtlr r12 60 mtlr r12
61 mtfsf 0xff,fr31 61 MTFSF_L(fr31)
62 lfd fr31,8(r1) 62 lfd fr31,8(r1)
63 lfd fr1,16(r1) 63 lfd fr1,16(r1)
64 lfd fr0,24(r1) 64 lfd fr0,24(r1)
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 971020cf3f7d..cdf5867838a6 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -13,27 +13,116 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#include <linux/types.h>
17#include <linux/device.h>
16#include <linux/init.h> 18#include <linux/init.h>
17#include <linux/console.h> 19#include <linux/console.h>
18#include <linux/module.h> 20#include <linux/module.h>
19#include <linux/mm.h> 21#include <linux/mm.h>
20#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/kobject.h>
24
21#include <asm/iommu.h> 25#include <asm/iommu.h>
22#include <asm/dma.h> 26#include <asm/dma.h>
23#include <asm/vio.h> 27#include <asm/vio.h>
24#include <asm/prom.h> 28#include <asm/prom.h>
25 29#include <asm/firmware.h>
26static const struct vio_device_id *vio_match_device( 30#include <asm/tce.h>
27 const struct vio_device_id *, const struct vio_dev *); 31#include <asm/abs_addr.h>
28 32#include <asm/page.h>
29struct vio_dev vio_bus_device = { /* fake "parent" device */ 33#include <asm/hvcall.h>
34#include <asm/iseries/vio.h>
35#include <asm/iseries/hv_types.h>
36#include <asm/iseries/hv_lp_config.h>
37#include <asm/iseries/hv_call_xm.h>
38#include <asm/iseries/iommu.h>
39
40extern struct subsystem devices_subsys; /* needed for vio_find_name() */
41
42static struct vio_dev vio_bus_device = { /* fake "parent" device */
30 .name = vio_bus_device.dev.bus_id, 43 .name = vio_bus_device.dev.bus_id,
31 .type = "", 44 .type = "",
32 .dev.bus_id = "vio", 45 .dev.bus_id = "vio",
33 .dev.bus = &vio_bus_type, 46 .dev.bus = &vio_bus_type,
34}; 47};
35 48
36static struct vio_bus_ops vio_bus_ops; 49#ifdef CONFIG_PPC_ISERIES
50struct device *iSeries_vio_dev = &vio_bus_device.dev;
51EXPORT_SYMBOL(iSeries_vio_dev);
52
53static struct iommu_table veth_iommu_table;
54static struct iommu_table vio_iommu_table;
55
56static void __init iommu_vio_init(void)
57{
58 iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
59 veth_iommu_table.it_size /= 2;
60 vio_iommu_table = veth_iommu_table;
61 vio_iommu_table.it_offset += veth_iommu_table.it_size;
62
63 if (!iommu_init_table(&veth_iommu_table, -1))
64 printk("Virtual Bus VETH TCE table failed.\n");
65 if (!iommu_init_table(&vio_iommu_table, -1))
66 printk("Virtual Bus VIO TCE table failed.\n");
67}
68#endif
69
70static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
71{
72#ifdef CONFIG_PPC_ISERIES
73 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
74 if (strcmp(dev->type, "network") == 0)
75 return &veth_iommu_table;
76 return &vio_iommu_table;
77 } else
78#endif
79 {
80 unsigned char *dma_window;
81 struct iommu_table *tbl;
82 unsigned long offset, size;
83
84 dma_window = get_property(dev->dev.platform_data,
85 "ibm,my-dma-window", NULL);
86 if (!dma_window)
87 return NULL;
88
89 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
90
91 of_parse_dma_window(dev->dev.platform_data, dma_window,
92 &tbl->it_index, &offset, &size);
93
94 /* TCE table size - measured in tce entries */
95 tbl->it_size = size >> PAGE_SHIFT;
96 /* offset for VIO should always be 0 */
97 tbl->it_offset = offset >> PAGE_SHIFT;
98 tbl->it_busno = 0;
99 tbl->it_type = TCE_VB;
100
101 return iommu_init_table(tbl, -1);
102 }
103}
104
105/**
106 * vio_match_device: - Tell if a VIO device has a matching
107 * VIO device id structure.
108 * @ids: array of VIO device id structures to search in
109 * @dev: the VIO device structure to match against
110 *
111 * Used by a driver to check whether a VIO device present in the
112 * system is in its list of supported devices. Returns the matching
113 * vio_device_id structure or NULL if there is no match.
114 */
115static const struct vio_device_id *vio_match_device(
116 const struct vio_device_id *ids, const struct vio_dev *dev)
117{
118 while (ids->type[0] != '\0') {
119 if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) &&
120 device_is_compatible(dev->dev.platform_data, ids->compat))
121 return ids;
122 ids++;
123 }
124 return NULL;
125}
37 126
38/* 127/*
39 * Convert from struct device to struct vio_dev and pass to driver. 128 * Convert from struct device to struct vio_dev and pass to driver.
@@ -106,35 +195,110 @@ void vio_unregister_driver(struct vio_driver *viodrv)
106} 195}
107EXPORT_SYMBOL(vio_unregister_driver); 196EXPORT_SYMBOL(vio_unregister_driver);
108 197
198/* vio_dev refcount hit 0 */
199static void __devinit vio_dev_release(struct device *dev)
200{
201 if (dev->platform_data) {
202 /* XXX free TCE table */
203 of_node_put(dev->platform_data);
204 }
205 kfree(to_vio_dev(dev));
206}
207
109/** 208/**
110 * vio_match_device: - Tell if a VIO device has a matching 209 * vio_register_device_node: - Register a new vio device.
111 * VIO device id structure. 210 * @of_node: The OF node for this device.
112 * @ids: array of VIO device id structures to search in
113 * @dev: the VIO device structure to match against
114 * 211 *
115 * Used by a driver to check whether a VIO device present in the 212 * Creates and initializes a vio_dev structure from the data in
116 * system is in its list of supported devices. Returns the matching 213 * of_node (dev.platform_data) and adds it to the list of virtual devices.
117 * vio_device_id structure or NULL if there is no match. 214 * Returns a pointer to the created vio_dev or NULL if node has
215 * NULL device_type or compatible fields.
118 */ 216 */
119static const struct vio_device_id *vio_match_device( 217struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
120 const struct vio_device_id *ids, const struct vio_dev *dev)
121{ 218{
122 while (ids->type[0] != '\0') { 219 struct vio_dev *viodev;
123 if (vio_bus_ops.match(ids, dev)) 220 unsigned int *unit_address;
124 return ids; 221 unsigned int *irq_p;
125 ids++; 222
223 /* we need the 'device_type' property, in order to match with drivers */
224 if (of_node->type == NULL) {
225 printk(KERN_WARNING "%s: node %s missing 'device_type'\n",
226 __FUNCTION__,
227 of_node->name ? of_node->name : "<unknown>");
228 return NULL;
126 } 229 }
127 return NULL; 230
231 unit_address = (unsigned int *)get_property(of_node, "reg", NULL);
232 if (unit_address == NULL) {
233 printk(KERN_WARNING "%s: node %s missing 'reg'\n",
234 __FUNCTION__,
235 of_node->name ? of_node->name : "<unknown>");
236 return NULL;
237 }
238
239 /* allocate a vio_dev for this node */
240 viodev = kzalloc(sizeof(struct vio_dev), GFP_KERNEL);
241 if (viodev == NULL)
242 return NULL;
243
244 viodev->dev.platform_data = of_node_get(of_node);
245
246 viodev->irq = NO_IRQ;
247 irq_p = (unsigned int *)get_property(of_node, "interrupts", NULL);
248 if (irq_p) {
249 int virq = virt_irq_create_mapping(*irq_p);
250 if (virq == NO_IRQ) {
251 printk(KERN_ERR "Unable to allocate interrupt "
252 "number for %s\n", of_node->full_name);
253 } else
254 viodev->irq = irq_offset_up(virq);
255 }
256
257 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address);
258 viodev->name = of_node->name;
259 viodev->type = of_node->type;
260 viodev->unit_address = *unit_address;
261 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
262 unit_address = (unsigned int *)get_property(of_node,
263 "linux,unit_address", NULL);
264 if (unit_address != NULL)
265 viodev->unit_address = *unit_address;
266 }
267 viodev->iommu_table = vio_build_iommu_table(viodev);
268
269 /* init generic 'struct device' fields: */
270 viodev->dev.parent = &vio_bus_device.dev;
271 viodev->dev.bus = &vio_bus_type;
272 viodev->dev.release = vio_dev_release;
273
274 /* register with generic device framework */
275 if (device_register(&viodev->dev)) {
276 printk(KERN_ERR "%s: failed to register device %s\n",
277 __FUNCTION__, viodev->dev.bus_id);
278 /* XXX free TCE table */
279 kfree(viodev);
280 return NULL;
281 }
282
283 return viodev;
128} 284}
285EXPORT_SYMBOL(vio_register_device_node);
129 286
130/** 287/**
131 * vio_bus_init: - Initialize the virtual IO bus 288 * vio_bus_init: - Initialize the virtual IO bus
132 */ 289 */
133int __init vio_bus_init(struct vio_bus_ops *ops) 290static int __init vio_bus_init(void)
134{ 291{
135 int err; 292 int err;
293 struct device_node *node_vroot;
136 294
137 vio_bus_ops = *ops; 295#ifdef CONFIG_PPC_ISERIES
296 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
297 iommu_vio_init();
298 vio_bus_device.iommu_table = &vio_iommu_table;
299 iSeries_vio_dev = &vio_bus_device.dev;
300 }
301#endif
138 302
139 err = bus_register(&vio_bus_type); 303 err = bus_register(&vio_bus_type);
140 if (err) { 304 if (err) {
@@ -153,47 +317,48 @@ int __init vio_bus_init(struct vio_bus_ops *ops)
153 return err; 317 return err;
154 } 318 }
155 319
156 return 0; 320 node_vroot = find_devices("vdevice");
157} 321 if (node_vroot) {
322 struct device_node *of_node;
323
324 /*
325 * Create struct vio_devices for each virtual device in
326 * the device tree. Drivers will associate with them later.
327 */
328 for (of_node = node_vroot->child; of_node != NULL;
329 of_node = of_node->sibling) {
330 printk(KERN_DEBUG "%s: processing %p\n",
331 __FUNCTION__, of_node);
332 vio_register_device_node(of_node);
333 }
334 }
158 335
159/* vio_dev refcount hit 0 */ 336 return 0;
160static void __devinit vio_dev_release(struct device *dev)
161{
162 if (vio_bus_ops.release_device)
163 vio_bus_ops.release_device(dev);
164 kfree(to_vio_dev(dev));
165} 337}
338__initcall(vio_bus_init);
166 339
167static ssize_t viodev_show_name(struct device *dev, 340static ssize_t name_show(struct device *dev,
168 struct device_attribute *attr, char *buf) 341 struct device_attribute *attr, char *buf)
169{ 342{
170 return sprintf(buf, "%s\n", to_vio_dev(dev)->name); 343 return sprintf(buf, "%s\n", to_vio_dev(dev)->name);
171} 344}
172DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_name, NULL);
173 345
174struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev) 346static ssize_t devspec_show(struct device *dev,
347 struct device_attribute *attr, char *buf)
175{ 348{
176 /* init generic 'struct device' fields: */ 349 struct device_node *of_node = dev->platform_data;
177 viodev->dev.parent = &vio_bus_device.dev;
178 viodev->dev.bus = &vio_bus_type;
179 viodev->dev.release = vio_dev_release;
180
181 /* register with generic device framework */
182 if (device_register(&viodev->dev)) {
183 printk(KERN_ERR "%s: failed to register device %s\n",
184 __FUNCTION__, viodev->dev.bus_id);
185 return NULL;
186 }
187 device_create_file(&viodev->dev, &dev_attr_name);
188 350
189 return viodev; 351 return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
190} 352}
191 353
354static struct device_attribute vio_dev_attrs[] = {
355 __ATTR_RO(name),
356 __ATTR_RO(devspec),
357 __ATTR_NULL
358};
359
192void __devinit vio_unregister_device(struct vio_dev *viodev) 360void __devinit vio_unregister_device(struct vio_dev *viodev)
193{ 361{
194 if (vio_bus_ops.unregister_device)
195 vio_bus_ops.unregister_device(viodev);
196 device_remove_file(&viodev->dev, &dev_attr_name);
197 device_unregister(&viodev->dev); 362 device_unregister(&viodev->dev);
198} 363}
199EXPORT_SYMBOL(vio_unregister_device); 364EXPORT_SYMBOL(vio_unregister_device);
@@ -229,7 +394,7 @@ static void *vio_alloc_coherent(struct device *dev, size_t size,
229 dma_addr_t *dma_handle, gfp_t flag) 394 dma_addr_t *dma_handle, gfp_t flag)
230{ 395{
231 return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size, 396 return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size,
232 dma_handle, ~0ul, flag); 397 dma_handle, ~0ul, flag, -1);
233} 398}
234 399
235static void vio_free_coherent(struct device *dev, size_t size, 400static void vio_free_coherent(struct device *dev, size_t size,
@@ -267,22 +432,23 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
267 char *buffer, int buffer_size) 432 char *buffer, int buffer_size)
268{ 433{
269 const struct vio_dev *vio_dev = to_vio_dev(dev); 434 const struct vio_dev *vio_dev = to_vio_dev(dev);
435 struct device_node *dn = dev->platform_data;
270 char *cp; 436 char *cp;
271 int length; 437 int length;
272 438
273 if (!num_envp) 439 if (!num_envp)
274 return -ENOMEM; 440 return -ENOMEM;
275 441
276 if (!vio_dev->dev.platform_data) 442 if (!dn)
277 return -ENODEV; 443 return -ENODEV;
278 cp = (char *)get_property(vio_dev->dev.platform_data, "compatible", &length); 444 cp = (char *)get_property(dn, "compatible", &length);
279 if (!cp) 445 if (!cp)
280 return -ENODEV; 446 return -ENODEV;
281 447
282 envp[0] = buffer; 448 envp[0] = buffer;
283 length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s", 449 length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s",
284 vio_dev->type, cp); 450 vio_dev->type, cp);
285 if (buffer_size - length <= 0) 451 if ((buffer_size - length) <= 0)
286 return -ENOMEM; 452 return -ENOMEM;
287 envp[1] = NULL; 453 envp[1] = NULL;
288 return 0; 454 return 0;
@@ -290,9 +456,81 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
290 456
291struct bus_type vio_bus_type = { 457struct bus_type vio_bus_type = {
292 .name = "vio", 458 .name = "vio",
459 .dev_attrs = vio_dev_attrs,
293 .uevent = vio_hotplug, 460 .uevent = vio_hotplug,
294 .match = vio_bus_match, 461 .match = vio_bus_match,
295 .probe = vio_bus_probe, 462 .probe = vio_bus_probe,
296 .remove = vio_bus_remove, 463 .remove = vio_bus_remove,
297 .shutdown = vio_bus_shutdown, 464 .shutdown = vio_bus_shutdown,
298}; 465};
466
467/**
468 * vio_get_attribute: - get attribute for virtual device
469 * @vdev: The vio device to get property.
470 * @which: The property/attribute to be extracted.
471 * @length: Pointer to length of returned data size (unused if NULL).
472 *
473 * Calls prom.c's get_property() to return the value of the
474 * attribute specified by @which
475*/
476const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length)
477{
478 return get_property(vdev->dev.platform_data, which, length);
479}
480EXPORT_SYMBOL(vio_get_attribute);
481
482#ifdef CONFIG_PPC_PSERIES
483/* vio_find_name() - internal because only vio.c knows how we formatted the
484 * kobject name
485 * XXX once vio_bus_type.devices is actually used as a kset in
486 * drivers/base/bus.c, this function should be removed in favor of
487 * "device_find(kobj_name, &vio_bus_type)"
488 */
489static struct vio_dev *vio_find_name(const char *kobj_name)
490{
491 struct kobject *found;
492
493 found = kset_find_obj(&devices_subsys.kset, kobj_name);
494 if (!found)
495 return NULL;
496
497 return to_vio_dev(container_of(found, struct device, kobj));
498}
499
500/**
501 * vio_find_node - find an already-registered vio_dev
502 * @vnode: device_node of the virtual device we're looking for
503 */
504struct vio_dev *vio_find_node(struct device_node *vnode)
505{
506 uint32_t *unit_address;
507 char kobj_name[BUS_ID_SIZE];
508
509 /* construct the kobject name from the device node */
510 unit_address = (uint32_t *)get_property(vnode, "reg", NULL);
511 if (!unit_address)
512 return NULL;
513 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
514
515 return vio_find_name(kobj_name);
516}
517EXPORT_SYMBOL(vio_find_node);
518
519int vio_enable_interrupts(struct vio_dev *dev)
520{
521 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_ENABLE);
522 if (rc != H_SUCCESS)
523 printk(KERN_ERR "vio: Error 0x%x enabling interrupts\n", rc);
524 return rc;
525}
526EXPORT_SYMBOL(vio_enable_interrupts);
527
528int vio_disable_interrupts(struct vio_dev *dev)
529{
530 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_DISABLE);
531 if (rc != H_SUCCESS)
532 printk(KERN_ERR "vio: Error 0x%x disabling interrupts\n", rc);
533 return rc;
534}
535EXPORT_SYMBOL(vio_disable_interrupts);
536#endif /* CONFIG_PPC_PSERIES */
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index fe79c2584cb0..8b25953dc4f0 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -93,6 +93,11 @@ SECTIONS
93 __ptov_table_begin = .; 93 __ptov_table_begin = .;
94 *(.ptov_fixup); 94 *(.ptov_fixup);
95 __ptov_table_end = .; 95 __ptov_table_end = .;
96#ifdef CONFIG_PPC_ISERIES
97 __dt_strings_start = .;
98 *(.dt_strings);
99 __dt_strings_end = .;
100#endif
96 } 101 }
97 102
98 . = ALIGN(16); 103 . = ALIGN(16);
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 34f5c2e074c9..ff7096458249 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -2,12 +2,15 @@
2# Makefile for ppc-specific library files.. 2# Makefile for ppc-specific library files..
3# 3#
4 4
5ifeq ($(CONFIG_PPC64),y)
6EXTRA_CFLAGS += -mno-minimal-toc
7endif
8
5ifeq ($(CONFIG_PPC_MERGE),y) 9ifeq ($(CONFIG_PPC_MERGE),y)
6obj-y := string.o strcase.o 10obj-y := string.o strcase.o
7obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o 11obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o
8endif 12endif
9 13
10obj-y += bitops.o
11obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \ 14obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \
12 memcpy_64.o usercopy_64.o mem_64.o string.o \ 15 memcpy_64.o usercopy_64.o mem_64.o string.o \
13 strcase.o 16 strcase.o
diff --git a/arch/powerpc/lib/bitops.c b/arch/powerpc/lib/bitops.c
deleted file mode 100644
index f68ad71a0187..000000000000
--- a/arch/powerpc/lib/bitops.c
+++ /dev/null
@@ -1,150 +0,0 @@
1#include <linux/types.h>
2#include <linux/module.h>
3#include <asm/byteorder.h>
4#include <asm/bitops.h>
5
6/**
7 * find_next_bit - find the next set bit in a memory region
8 * @addr: The address to base the search on
9 * @offset: The bitnumber to start searching at
10 * @size: The maximum size to search
11 */
12unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
13 unsigned long offset)
14{
15 const unsigned long *p = addr + BITOP_WORD(offset);
16 unsigned long result = offset & ~(BITS_PER_LONG-1);
17 unsigned long tmp;
18
19 if (offset >= size)
20 return size;
21 size -= result;
22 offset %= BITS_PER_LONG;
23 if (offset) {
24 tmp = *(p++);
25 tmp &= (~0UL << offset);
26 if (size < BITS_PER_LONG)
27 goto found_first;
28 if (tmp)
29 goto found_middle;
30 size -= BITS_PER_LONG;
31 result += BITS_PER_LONG;
32 }
33 while (size & ~(BITS_PER_LONG-1)) {
34 if ((tmp = *(p++)))
35 goto found_middle;
36 result += BITS_PER_LONG;
37 size -= BITS_PER_LONG;
38 }
39 if (!size)
40 return result;
41 tmp = *p;
42
43found_first:
44 tmp &= (~0UL >> (BITS_PER_LONG - size));
45 if (tmp == 0UL) /* Are any bits set? */
46 return result + size; /* Nope. */
47found_middle:
48 return result + __ffs(tmp);
49}
50EXPORT_SYMBOL(find_next_bit);
51
52/*
53 * This implementation of find_{first,next}_zero_bit was stolen from
54 * Linus' asm-alpha/bitops.h.
55 */
56unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
57 unsigned long offset)
58{
59 const unsigned long *p = addr + BITOP_WORD(offset);
60 unsigned long result = offset & ~(BITS_PER_LONG-1);
61 unsigned long tmp;
62
63 if (offset >= size)
64 return size;
65 size -= result;
66 offset %= BITS_PER_LONG;
67 if (offset) {
68 tmp = *(p++);
69 tmp |= ~0UL >> (BITS_PER_LONG - offset);
70 if (size < BITS_PER_LONG)
71 goto found_first;
72 if (~tmp)
73 goto found_middle;
74 size -= BITS_PER_LONG;
75 result += BITS_PER_LONG;
76 }
77 while (size & ~(BITS_PER_LONG-1)) {
78 if (~(tmp = *(p++)))
79 goto found_middle;
80 result += BITS_PER_LONG;
81 size -= BITS_PER_LONG;
82 }
83 if (!size)
84 return result;
85 tmp = *p;
86
87found_first:
88 tmp |= ~0UL << size;
89 if (tmp == ~0UL) /* Are any bits zero? */
90 return result + size; /* Nope. */
91found_middle:
92 return result + ffz(tmp);
93}
94EXPORT_SYMBOL(find_next_zero_bit);
95
96static inline unsigned int ext2_ilog2(unsigned int x)
97{
98 int lz;
99
100 asm("cntlzw %0,%1": "=r"(lz):"r"(x));
101 return 31 - lz;
102}
103
104static inline unsigned int ext2_ffz(unsigned int x)
105{
106 u32 rc;
107 if ((x = ~x) == 0)
108 return 32;
109 rc = ext2_ilog2(x & -x);
110 return rc;
111}
112
113unsigned long find_next_zero_le_bit(const unsigned long *addr,
114 unsigned long size, unsigned long offset)
115{
116 const unsigned int *p = ((const unsigned int *)addr) + (offset >> 5);
117 unsigned int result = offset & ~31;
118 unsigned int tmp;
119
120 if (offset >= size)
121 return size;
122 size -= result;
123 offset &= 31;
124 if (offset) {
125 tmp = cpu_to_le32p(p++);
126 tmp |= ~0U >> (32 - offset); /* bug or feature ? */
127 if (size < 32)
128 goto found_first;
129 if (tmp != ~0)
130 goto found_middle;
131 size -= 32;
132 result += 32;
133 }
134 while (size >= 32) {
135 if ((tmp = cpu_to_le32p(p++)) != ~0)
136 goto found_middle;
137 result += 32;
138 size -= 32;
139 }
140 if (!size)
141 return result;
142 tmp = cpu_to_le32p(p);
143found_first:
144 tmp |= ~0 << size;
145 if (tmp == ~0) /* Are any bits zero? */
146 return result + size; /* Nope. */
147found_middle:
148 return result + ext2_ffz(tmp);
149}
150EXPORT_SYMBOL(find_next_zero_le_bit);
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index ea469eefa146..94255beeecd3 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -74,12 +74,6 @@ _GLOBAL(hash_page_sync)
74 */ 74 */
75 .text 75 .text
76_GLOBAL(hash_page) 76_GLOBAL(hash_page)
77#ifdef CONFIG_PPC64BRIDGE
78 mfmsr r0
79 clrldi r0,r0,1 /* make sure it's in 32-bit mode */
80 MTMSRD(r0)
81 isync
82#endif
83 tophys(r7,0) /* gets -KERNELBASE into r7 */ 77 tophys(r7,0) /* gets -KERNELBASE into r7 */
84#ifdef CONFIG_SMP 78#ifdef CONFIG_SMP
85 addis r8,r7,mmu_hash_lock@h 79 addis r8,r7,mmu_hash_lock@h
@@ -285,7 +279,6 @@ Hash_base = 0xc0180000
285Hash_bits = 12 /* e.g. 256kB hash table */ 279Hash_bits = 12 /* e.g. 256kB hash table */
286Hash_msk = (((1 << Hash_bits) - 1) * 64) 280Hash_msk = (((1 << Hash_bits) - 1) * 64)
287 281
288#ifndef CONFIG_PPC64BRIDGE
289/* defines for the PTE format for 32-bit PPCs */ 282/* defines for the PTE format for 32-bit PPCs */
290#define PTE_SIZE 8 283#define PTE_SIZE 8
291#define PTEG_SIZE 64 284#define PTEG_SIZE 64
@@ -299,21 +292,6 @@ Hash_msk = (((1 << Hash_bits) - 1) * 64)
299#define SET_V(r) oris r,r,PTE_V@h 292#define SET_V(r) oris r,r,PTE_V@h
300#define CLR_V(r,t) rlwinm r,r,0,1,31 293#define CLR_V(r,t) rlwinm r,r,0,1,31
301 294
302#else
303/* defines for the PTE format for 64-bit PPCs */
304#define PTE_SIZE 16
305#define PTEG_SIZE 128
306#define LG_PTEG_SIZE 7
307#define LDPTEu ldu
308#define STPTE std
309#define CMPPTE cmpd
310#define PTE_H 2
311#define PTE_V 1
312#define TST_V(r) andi. r,r,PTE_V
313#define SET_V(r) ori r,r,PTE_V
314#define CLR_V(r,t) li t,PTE_V; andc r,r,t
315#endif /* CONFIG_PPC64BRIDGE */
316
317#define HASH_LEFT 31-(LG_PTEG_SIZE+Hash_bits-1) 295#define HASH_LEFT 31-(LG_PTEG_SIZE+Hash_bits-1)
318#define HASH_RIGHT 31-LG_PTEG_SIZE 296#define HASH_RIGHT 31-LG_PTEG_SIZE
319 297
@@ -331,14 +309,8 @@ BEGIN_FTR_SECTION
331END_FTR_SECTION_IFSET(CPU_FTR_NEED_COHERENT) 309END_FTR_SECTION_IFSET(CPU_FTR_NEED_COHERENT)
332 310
333 /* Construct the high word of the PPC-style PTE (r5) */ 311 /* Construct the high word of the PPC-style PTE (r5) */
334#ifndef CONFIG_PPC64BRIDGE
335 rlwinm r5,r3,7,1,24 /* put VSID in 0x7fffff80 bits */ 312 rlwinm r5,r3,7,1,24 /* put VSID in 0x7fffff80 bits */
336 rlwimi r5,r4,10,26,31 /* put in API (abbrev page index) */ 313 rlwimi r5,r4,10,26,31 /* put in API (abbrev page index) */
337#else /* CONFIG_PPC64BRIDGE */
338 clrlwi r3,r3,8 /* reduce vsid to 24 bits */
339 sldi r5,r3,12 /* shift vsid into position */
340 rlwimi r5,r4,16,20,24 /* put in API (abbrev page index) */
341#endif /* CONFIG_PPC64BRIDGE */
342 SET_V(r5) /* set V (valid) bit */ 314 SET_V(r5) /* set V (valid) bit */
343 315
344 /* Get the address of the primary PTE group in the hash table (r3) */ 316 /* Get the address of the primary PTE group in the hash table (r3) */
@@ -516,14 +488,8 @@ _GLOBAL(flush_hash_pages)
516 add r3,r3,r0 /* note code below trims to 24 bits */ 488 add r3,r3,r0 /* note code below trims to 24 bits */
517 489
518 /* Construct the high word of the PPC-style PTE (r11) */ 490 /* Construct the high word of the PPC-style PTE (r11) */
519#ifndef CONFIG_PPC64BRIDGE
520 rlwinm r11,r3,7,1,24 /* put VSID in 0x7fffff80 bits */ 491 rlwinm r11,r3,7,1,24 /* put VSID in 0x7fffff80 bits */
521 rlwimi r11,r4,10,26,31 /* put in API (abbrev page index) */ 492 rlwimi r11,r4,10,26,31 /* put in API (abbrev page index) */
522#else /* CONFIG_PPC64BRIDGE */
523 clrlwi r3,r3,8 /* reduce vsid to 24 bits */
524 sldi r11,r3,12 /* shift vsid into position */
525 rlwimi r11,r4,16,20,24 /* put in API (abbrev page index) */
526#endif /* CONFIG_PPC64BRIDGE */
527 SET_V(r11) /* set V (valid) bit */ 493 SET_V(r11) /* set V (valid) bit */
528 494
529#ifdef CONFIG_SMP 495#ifdef CONFIG_SMP
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index e0d02c4a2615..52e914238959 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -136,6 +136,7 @@ _GLOBAL(__hash_page_4K)
136 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/ 136 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
137 andc r0,r30,r0 /* r0 = pte & ~r0 */ 137 andc r0,r30,r0 /* r0 = pte & ~r0 */
138 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */ 138 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
139 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */
139 140
140 /* We eventually do the icache sync here (maybe inline that 141 /* We eventually do the icache sync here (maybe inline that
141 * code rather than call a C function...) 142 * code rather than call a C function...)
@@ -368,6 +369,7 @@ _GLOBAL(__hash_page_4K)
368 rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */ 369 rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */
369 or r30,r30,r31 370 or r30,r30,r31
370 ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED | _PAGE_HASHPTE 371 ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED | _PAGE_HASHPTE
372 oris r30,r30,_PAGE_COMBO@h
371 /* Write the linux PTE atomically (setting busy) */ 373 /* Write the linux PTE atomically (setting busy) */
372 stdcx. r30,0,r6 374 stdcx. r30,0,r6
373 bne- 1b 375 bne- 1b
@@ -400,6 +402,7 @@ _GLOBAL(__hash_page_4K)
400 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/ 402 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
401 andc r0,r30,r0 /* r0 = pte & ~r0 */ 403 andc r0,r30,r0 /* r0 = pte & ~r0 */
402 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */ 404 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
405 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */
403 406
404 /* We eventually do the icache sync here (maybe inline that 407 /* We eventually do the icache sync here (maybe inline that
405 * code rather than call a C function...) 408 * code rather than call a C function...)
@@ -426,6 +429,14 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
426 andi. r0,r31,_PAGE_HASHPTE 429 andi. r0,r31,_PAGE_HASHPTE
427 li r26,0 /* Default hidx */ 430 li r26,0 /* Default hidx */
428 beq htab_insert_pte 431 beq htab_insert_pte
432
433 /*
434 * Check if the pte was already inserted into the hash table
435 * as a 64k HW page, and invalidate the 64k HPTE if so.
436 */
437 andis. r0,r31,_PAGE_COMBO@h
438 beq htab_inval_old_hpte
439
429 ld r6,STK_PARM(r6)(r1) 440 ld r6,STK_PARM(r6)(r1)
430 ori r26,r6,0x8000 /* Load the hidx mask */ 441 ori r26,r6,0x8000 /* Load the hidx mask */
431 ld r26,0(r26) 442 ld r26,0(r26)
@@ -496,6 +507,19 @@ _GLOBAL(htab_call_hpte_remove)
496 /* Try all again */ 507 /* Try all again */
497 b htab_insert_pte 508 b htab_insert_pte
498 509
510 /*
511 * Call out to C code to invalidate an 64k HW HPTE that is
512 * useless now that the segment has been switched to 4k pages.
513 */
514htab_inval_old_hpte:
515 mr r3,r29 /* virtual addr */
516 mr r4,r31 /* PTE.pte */
517 li r5,0 /* PTE.hidx */
518 li r6,MMU_PAGE_64K /* psize */
519 ld r7,STK_PARM(r8)(r1) /* local */
520 bl .flush_hash_page
521 b htab_insert_pte
522
499htab_bail_ok: 523htab_bail_ok:
500 li r3,0 524 li r3,0
501 b htab_bail 525 b htab_bail
@@ -636,6 +660,12 @@ _GLOBAL(__hash_page_64K)
636 * is changing this PTE anyway and might hash it. 660 * is changing this PTE anyway and might hash it.
637 */ 661 */
638 bne- ht64_bail_ok 662 bne- ht64_bail_ok
663BEGIN_FTR_SECTION
664 /* Check if PTE has the cache-inhibit bit set */
665 andi. r0,r31,_PAGE_NO_CACHE
666 /* If so, bail out and refault as a 4k page */
667 bne- ht64_bail_ok
668END_FTR_SECTION_IFCLR(CPU_FTR_CI_LARGE_PAGE)
639 /* Prepare new PTE value (turn access RW into DIRTY, then 669 /* Prepare new PTE value (turn access RW into DIRTY, then
640 * add BUSY,HASHPTE and ACCESSED) 670 * add BUSY,HASHPTE and ACCESSED)
641 */ 671 */
@@ -671,6 +701,7 @@ _GLOBAL(__hash_page_64K)
671 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/ 701 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
672 andc r0,r30,r0 /* r0 = pte & ~r0 */ 702 andc r0,r30,r0 /* r0 = pte & ~r0 */
673 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */ 703 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
704 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */
674 705
675 /* We eventually do the icache sync here (maybe inline that 706 /* We eventually do the icache sync here (maybe inline that
676 * code rather than call a C function...) 707 * code rather than call a C function...)
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 994856e55b7c..a0f3cbd00d39 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -238,7 +238,7 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
238 DBG_LOW(" -> hit\n"); 238 DBG_LOW(" -> hit\n");
239 /* Update the HPTE */ 239 /* Update the HPTE */
240 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) | 240 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) |
241 (newpp & (HPTE_R_PP | HPTE_R_N)); 241 (newpp & (HPTE_R_PP | HPTE_R_N | HPTE_R_C));
242 native_unlock_hpte(hptep); 242 native_unlock_hpte(hptep);
243 } 243 }
244 244
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index c006d9039633..d03fd2b4445e 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -92,10 +92,15 @@ unsigned long htab_size_bytes;
92unsigned long htab_hash_mask; 92unsigned long htab_hash_mask;
93int mmu_linear_psize = MMU_PAGE_4K; 93int mmu_linear_psize = MMU_PAGE_4K;
94int mmu_virtual_psize = MMU_PAGE_4K; 94int mmu_virtual_psize = MMU_PAGE_4K;
95int mmu_vmalloc_psize = MMU_PAGE_4K;
96int mmu_io_psize = MMU_PAGE_4K;
95#ifdef CONFIG_HUGETLB_PAGE 97#ifdef CONFIG_HUGETLB_PAGE
96int mmu_huge_psize = MMU_PAGE_16M; 98int mmu_huge_psize = MMU_PAGE_16M;
97unsigned int HPAGE_SHIFT; 99unsigned int HPAGE_SHIFT;
98#endif 100#endif
101#ifdef CONFIG_PPC_64K_PAGES
102int mmu_ci_restrictions;
103#endif
99 104
100/* There are definitions of page sizes arrays to be used when none 105/* There are definitions of page sizes arrays to be used when none
101 * is provided by the firmware. 106 * is provided by the firmware.
@@ -308,20 +313,31 @@ static void __init htab_init_page_sizes(void)
308 else if (mmu_psize_defs[MMU_PAGE_1M].shift) 313 else if (mmu_psize_defs[MMU_PAGE_1M].shift)
309 mmu_linear_psize = MMU_PAGE_1M; 314 mmu_linear_psize = MMU_PAGE_1M;
310 315
316#ifdef CONFIG_PPC_64K_PAGES
311 /* 317 /*
312 * Pick a size for the ordinary pages. Default is 4K, we support 318 * Pick a size for the ordinary pages. Default is 4K, we support
313 * 64K if cache inhibited large pages are supported by the 319 * 64K for user mappings and vmalloc if supported by the processor.
314 * processor 320 * We only use 64k for ioremap if the processor
321 * (and firmware) support cache-inhibited large pages.
322 * If not, we use 4k and set mmu_ci_restrictions so that
323 * hash_page knows to switch processes that use cache-inhibited
324 * mappings to 4k pages.
315 */ 325 */
316#ifdef CONFIG_PPC_64K_PAGES 326 if (mmu_psize_defs[MMU_PAGE_64K].shift) {
317 if (mmu_psize_defs[MMU_PAGE_64K].shift &&
318 cpu_has_feature(CPU_FTR_CI_LARGE_PAGE))
319 mmu_virtual_psize = MMU_PAGE_64K; 327 mmu_virtual_psize = MMU_PAGE_64K;
328 mmu_vmalloc_psize = MMU_PAGE_64K;
329 if (cpu_has_feature(CPU_FTR_CI_LARGE_PAGE))
330 mmu_io_psize = MMU_PAGE_64K;
331 else
332 mmu_ci_restrictions = 1;
333 }
320#endif 334#endif
321 335
322 printk(KERN_INFO "Page orders: linear mapping = %d, others = %d\n", 336 printk(KERN_DEBUG "Page orders: linear mapping = %d, "
337 "virtual = %d, io = %d\n",
323 mmu_psize_defs[mmu_linear_psize].shift, 338 mmu_psize_defs[mmu_linear_psize].shift,
324 mmu_psize_defs[mmu_virtual_psize].shift); 339 mmu_psize_defs[mmu_virtual_psize].shift,
340 mmu_psize_defs[mmu_io_psize].shift);
325 341
326#ifdef CONFIG_HUGETLB_PAGE 342#ifdef CONFIG_HUGETLB_PAGE
327 /* Init large page size. Currently, we pick 16M or 1M depending 343 /* Init large page size. Currently, we pick 16M or 1M depending
@@ -556,6 +572,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
556 pte_t *ptep; 572 pte_t *ptep;
557 cpumask_t tmp; 573 cpumask_t tmp;
558 int rc, user_region = 0, local = 0; 574 int rc, user_region = 0, local = 0;
575 int psize;
559 576
560 DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n", 577 DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n",
561 ea, access, trap); 578 ea, access, trap);
@@ -575,10 +592,15 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
575 return 1; 592 return 1;
576 } 593 }
577 vsid = get_vsid(mm->context.id, ea); 594 vsid = get_vsid(mm->context.id, ea);
595 psize = mm->context.user_psize;
578 break; 596 break;
579 case VMALLOC_REGION_ID: 597 case VMALLOC_REGION_ID:
580 mm = &init_mm; 598 mm = &init_mm;
581 vsid = get_kernel_vsid(ea); 599 vsid = get_kernel_vsid(ea);
600 if (ea < VMALLOC_END)
601 psize = mmu_vmalloc_psize;
602 else
603 psize = mmu_io_psize;
582 break; 604 break;
583 default: 605 default:
584 /* Not a valid range 606 /* Not a valid range
@@ -629,7 +651,40 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
629#ifndef CONFIG_PPC_64K_PAGES 651#ifndef CONFIG_PPC_64K_PAGES
630 rc = __hash_page_4K(ea, access, vsid, ptep, trap, local); 652 rc = __hash_page_4K(ea, access, vsid, ptep, trap, local);
631#else 653#else
632 if (mmu_virtual_psize == MMU_PAGE_64K) 654 if (mmu_ci_restrictions) {
655 /* If this PTE is non-cacheable, switch to 4k */
656 if (psize == MMU_PAGE_64K &&
657 (pte_val(*ptep) & _PAGE_NO_CACHE)) {
658 if (user_region) {
659 psize = MMU_PAGE_4K;
660 mm->context.user_psize = MMU_PAGE_4K;
661 mm->context.sllp = SLB_VSID_USER |
662 mmu_psize_defs[MMU_PAGE_4K].sllp;
663 } else if (ea < VMALLOC_END) {
664 /*
665 * some driver did a non-cacheable mapping
666 * in vmalloc space, so switch vmalloc
667 * to 4k pages
668 */
669 printk(KERN_ALERT "Reducing vmalloc segment "
670 "to 4kB pages because of "
671 "non-cacheable mapping\n");
672 psize = mmu_vmalloc_psize = MMU_PAGE_4K;
673 }
674 }
675 if (user_region) {
676 if (psize != get_paca()->context.user_psize) {
677 get_paca()->context = mm->context;
678 slb_flush_and_rebolt();
679 }
680 } else if (get_paca()->vmalloc_sllp !=
681 mmu_psize_defs[mmu_vmalloc_psize].sllp) {
682 get_paca()->vmalloc_sllp =
683 mmu_psize_defs[mmu_vmalloc_psize].sllp;
684 slb_flush_and_rebolt();
685 }
686 }
687 if (psize == MMU_PAGE_64K)
633 rc = __hash_page_64K(ea, access, vsid, ptep, trap, local); 688 rc = __hash_page_64K(ea, access, vsid, ptep, trap, local);
634 else 689 else
635 rc = __hash_page_4K(ea, access, vsid, ptep, trap, local); 690 rc = __hash_page_4K(ea, access, vsid, ptep, trap, local);
@@ -681,7 +736,18 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
681#ifndef CONFIG_PPC_64K_PAGES 736#ifndef CONFIG_PPC_64K_PAGES
682 __hash_page_4K(ea, access, vsid, ptep, trap, local); 737 __hash_page_4K(ea, access, vsid, ptep, trap, local);
683#else 738#else
684 if (mmu_virtual_psize == MMU_PAGE_64K) 739 if (mmu_ci_restrictions) {
740 /* If this PTE is non-cacheable, switch to 4k */
741 if (mm->context.user_psize == MMU_PAGE_64K &&
742 (pte_val(*ptep) & _PAGE_NO_CACHE)) {
743 mm->context.user_psize = MMU_PAGE_4K;
744 mm->context.sllp = SLB_VSID_USER |
745 mmu_psize_defs[MMU_PAGE_4K].sllp;
746 get_paca()->context = mm->context;
747 slb_flush_and_rebolt();
748 }
749 }
750 if (mm->context.user_psize == MMU_PAGE_64K)
685 __hash_page_64K(ea, access, vsid, ptep, trap, local); 751 __hash_page_64K(ea, access, vsid, ptep, trap, local);
686 else 752 else
687 __hash_page_4K(ea, access, vsid, ptep, trap, local); 753 __hash_page_4K(ea, access, vsid, ptep, trap, local);
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 417d58518558..8b6f522655a6 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -89,20 +89,25 @@ static long __init lmb_regions_adjacent(struct lmb_region *rgn,
89 return lmb_addrs_adjacent(base1, size1, base2, size2); 89 return lmb_addrs_adjacent(base1, size1, base2, size2);
90} 90}
91 91
92/* Assumption: base addr of region 1 < base addr of region 2 */ 92static void __init lmb_remove_region(struct lmb_region *rgn, unsigned long r)
93static void __init lmb_coalesce_regions(struct lmb_region *rgn,
94 unsigned long r1, unsigned long r2)
95{ 93{
96 unsigned long i; 94 unsigned long i;
97 95
98 rgn->region[r1].size += rgn->region[r2].size; 96 for (i = r; i < rgn->cnt - 1; i++) {
99 for (i=r2; i < rgn->cnt-1; i++) { 97 rgn->region[i].base = rgn->region[i + 1].base;
100 rgn->region[i].base = rgn->region[i+1].base; 98 rgn->region[i].size = rgn->region[i + 1].size;
101 rgn->region[i].size = rgn->region[i+1].size;
102 } 99 }
103 rgn->cnt--; 100 rgn->cnt--;
104} 101}
105 102
103/* Assumption: base addr of region 1 < base addr of region 2 */
104static void __init lmb_coalesce_regions(struct lmb_region *rgn,
105 unsigned long r1, unsigned long r2)
106{
107 rgn->region[r1].size += rgn->region[r2].size;
108 lmb_remove_region(rgn, r2);
109}
110
106/* This routine called with relocation disabled. */ 111/* This routine called with relocation disabled. */
107void __init lmb_init(void) 112void __init lmb_init(void)
108{ 113{
@@ -294,17 +299,16 @@ unsigned long __init lmb_end_of_DRAM(void)
294 return (lmb.memory.region[idx].base + lmb.memory.region[idx].size); 299 return (lmb.memory.region[idx].base + lmb.memory.region[idx].size);
295} 300}
296 301
297/* 302/* You must call lmb_analyze() after this. */
298 * Truncate the lmb list to memory_limit if it's set
299 * You must call lmb_analyze() after this.
300 */
301void __init lmb_enforce_memory_limit(unsigned long memory_limit) 303void __init lmb_enforce_memory_limit(unsigned long memory_limit)
302{ 304{
303 unsigned long i, limit; 305 unsigned long i, limit;
306 struct lmb_property *p;
304 307
305 if (! memory_limit) 308 if (! memory_limit)
306 return; 309 return;
307 310
311 /* Truncate the lmb regions to satisfy the memory limit. */
308 limit = memory_limit; 312 limit = memory_limit;
309 for (i = 0; i < lmb.memory.cnt; i++) { 313 for (i = 0; i < lmb.memory.cnt; i++) {
310 if (limit > lmb.memory.region[i].size) { 314 if (limit > lmb.memory.region[i].size) {
@@ -316,4 +320,21 @@ void __init lmb_enforce_memory_limit(unsigned long memory_limit)
316 lmb.memory.cnt = i + 1; 320 lmb.memory.cnt = i + 1;
317 break; 321 break;
318 } 322 }
323
324 lmb.rmo_size = lmb.memory.region[0].size;
325
326 /* And truncate any reserves above the limit also. */
327 for (i = 0; i < lmb.reserved.cnt; i++) {
328 p = &lmb.reserved.region[i];
329
330 if (p->base > memory_limit)
331 p->size = 0;
332 else if ((p->base + p->size) > memory_limit)
333 p->size = memory_limit - p->base;
334
335 if (p->size == 0) {
336 lmb_remove_region(&lmb.reserved, i);
337 i--;
338 }
339 }
319} 340}
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 741dd8802d49..69f3b9a20beb 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -299,9 +299,9 @@ void __init paging_init(void)
299 kmap_prot = PAGE_KERNEL; 299 kmap_prot = PAGE_KERNEL;
300#endif /* CONFIG_HIGHMEM */ 300#endif /* CONFIG_HIGHMEM */
301 301
302 printk(KERN_INFO "Top of RAM: 0x%lx, Total RAM: 0x%lx\n", 302 printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
303 top_of_ram, total_ram); 303 top_of_ram, total_ram);
304 printk(KERN_INFO "Memory hole size: %ldMB\n", 304 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
305 (top_of_ram - total_ram) >> 20); 305 (top_of_ram - total_ram) >> 20);
306 /* 306 /*
307 * All pages are DMA-able so we put them all in the DMA zone. 307 * All pages are DMA-able so we put them all in the DMA zone.
@@ -380,7 +380,7 @@ void __init mem_init(void)
380 totalhigh_pages++; 380 totalhigh_pages++;
381 } 381 }
382 totalram_pages += totalhigh_pages; 382 totalram_pages += totalhigh_pages;
383 printk(KERN_INFO "High memory: %luk\n", 383 printk(KERN_DEBUG "High memory: %luk\n",
384 totalhigh_pages << (PAGE_SHIFT-10)); 384 totalhigh_pages << (PAGE_SHIFT-10));
385 } 385 }
386#endif /* CONFIG_HIGHMEM */ 386#endif /* CONFIG_HIGHMEM */
diff --git a/arch/powerpc/mm/mmu_context_32.c b/arch/powerpc/mm/mmu_context_32.c
index a8816e0f6a86..e326e4249e1a 100644
--- a/arch/powerpc/mm/mmu_context_32.c
+++ b/arch/powerpc/mm/mmu_context_32.c
@@ -30,7 +30,7 @@
30#include <asm/mmu_context.h> 30#include <asm/mmu_context.h>
31#include <asm/tlbflush.h> 31#include <asm/tlbflush.h>
32 32
33mm_context_t next_mmu_context; 33unsigned long next_mmu_context;
34unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1]; 34unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
35#ifdef FEW_CONTEXTS 35#ifdef FEW_CONTEXTS
36atomic_t nr_free_contexts; 36atomic_t nr_free_contexts;
diff --git a/arch/powerpc/mm/mmu_context_64.c b/arch/powerpc/mm/mmu_context_64.c
index 714a84dd8d5d..65d18dca266f 100644
--- a/arch/powerpc/mm/mmu_context_64.c
+++ b/arch/powerpc/mm/mmu_context_64.c
@@ -49,6 +49,9 @@ again:
49 } 49 }
50 50
51 mm->context.id = index; 51 mm->context.id = index;
52 mm->context.user_psize = mmu_virtual_psize;
53 mm->context.sllp = SLB_VSID_USER |
54 mmu_psize_defs[mmu_virtual_psize].sllp;
52 55
53 return 0; 56 return 0;
54} 57}
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 092355f37399..aa98cb3b59d8 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -487,9 +487,9 @@ static void __init setup_nonnuma(void)
487 unsigned long total_ram = lmb_phys_mem_size(); 487 unsigned long total_ram = lmb_phys_mem_size();
488 unsigned int i; 488 unsigned int i;
489 489
490 printk(KERN_INFO "Top of RAM: 0x%lx, Total RAM: 0x%lx\n", 490 printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
491 top_of_ram, total_ram); 491 top_of_ram, total_ram);
492 printk(KERN_INFO "Memory hole size: %ldMB\n", 492 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
493 (top_of_ram - total_ram) >> 20); 493 (top_of_ram - total_ram) >> 20);
494 494
495 for (i = 0; i < lmb.memory.cnt; ++i) 495 for (i = 0; i < lmb.memory.cnt; ++i)
@@ -507,7 +507,7 @@ void __init dump_numa_cpu_topology(void)
507 return; 507 return;
508 508
509 for_each_online_node(node) { 509 for_each_online_node(node) {
510 printk(KERN_INFO "Node %d CPUs:", node); 510 printk(KERN_DEBUG "Node %d CPUs:", node);
511 511
512 count = 0; 512 count = 0;
513 /* 513 /*
@@ -543,7 +543,7 @@ static void __init dump_numa_memory_topology(void)
543 for_each_online_node(node) { 543 for_each_online_node(node) {
544 unsigned long i; 544 unsigned long i;
545 545
546 printk(KERN_INFO "Node %d Memory:", node); 546 printk(KERN_DEBUG "Node %d Memory:", node);
547 547
548 count = 0; 548 count = 0;
549 549
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index ed7fcfe5fd37..2ed43a493b31 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -42,18 +42,14 @@ unsigned long _SDR1;
42 42
43union ubat { /* BAT register values to be loaded */ 43union ubat { /* BAT register values to be loaded */
44 BAT bat; 44 BAT bat;
45#ifdef CONFIG_PPC64BRIDGE
46 u64 word[2];
47#else
48 u32 word[2]; 45 u32 word[2];
49#endif 46} BATS[8][2]; /* 8 pairs of IBAT, DBAT */
50} BATS[4][2]; /* 4 pairs of IBAT, DBAT */
51 47
52struct batrange { /* stores address ranges mapped by BATs */ 48struct batrange { /* stores address ranges mapped by BATs */
53 unsigned long start; 49 unsigned long start;
54 unsigned long limit; 50 unsigned long limit;
55 unsigned long phys; 51 unsigned long phys;
56} bat_addrs[4]; 52} bat_addrs[8];
57 53
58/* 54/*
59 * Return PA for this VA if it is mapped by a BAT, or 0 55 * Return PA for this VA if it is mapped by a BAT, or 0
@@ -190,7 +186,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
190 return; 186 return;
191 pmd = pmd_offset(pgd_offset(mm, ea), ea); 187 pmd = pmd_offset(pgd_offset(mm, ea), ea);
192 if (!pmd_none(*pmd)) 188 if (!pmd_none(*pmd))
193 add_hash_page(mm->context, ea, pmd_val(*pmd)); 189 add_hash_page(mm->context.id, ea, pmd_val(*pmd));
194} 190}
195 191
196/* 192/*
@@ -220,15 +216,9 @@ void __init MMU_init_hw(void)
220 216
221 if ( ppc_md.progress ) ppc_md.progress("hash:enter", 0x105); 217 if ( ppc_md.progress ) ppc_md.progress("hash:enter", 0x105);
222 218
223#ifdef CONFIG_PPC64BRIDGE
224#define LG_HPTEG_SIZE 7 /* 128 bytes per HPTEG */
225#define SDR1_LOW_BITS (lg_n_hpteg - 11)
226#define MIN_N_HPTEG 2048 /* min 256kB hash table */
227#else
228#define LG_HPTEG_SIZE 6 /* 64 bytes per HPTEG */ 219#define LG_HPTEG_SIZE 6 /* 64 bytes per HPTEG */
229#define SDR1_LOW_BITS ((n_hpteg - 1) >> 10) 220#define SDR1_LOW_BITS ((n_hpteg - 1) >> 10)
230#define MIN_N_HPTEG 1024 /* min 64kB hash table */ 221#define MIN_N_HPTEG 1024 /* min 64kB hash table */
231#endif
232 222
233 /* 223 /*
234 * Allow 1 HPTE (1/8 HPTEG) for each page of memory. 224 * Allow 1 HPTE (1/8 HPTEG) for each page of memory.
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index ffc8ed4de62d..6a8bf6c6000e 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -60,19 +60,19 @@ static inline void create_slbe(unsigned long ea, unsigned long flags,
60 : "memory" ); 60 : "memory" );
61} 61}
62 62
63static void slb_flush_and_rebolt(void) 63void slb_flush_and_rebolt(void)
64{ 64{
65 /* If you change this make sure you change SLB_NUM_BOLTED 65 /* If you change this make sure you change SLB_NUM_BOLTED
66 * appropriately too. */ 66 * appropriately too. */
67 unsigned long linear_llp, virtual_llp, lflags, vflags; 67 unsigned long linear_llp, vmalloc_llp, lflags, vflags;
68 unsigned long ksp_esid_data; 68 unsigned long ksp_esid_data;
69 69
70 WARN_ON(!irqs_disabled()); 70 WARN_ON(!irqs_disabled());
71 71
72 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp; 72 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp;
73 virtual_llp = mmu_psize_defs[mmu_virtual_psize].sllp; 73 vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp;
74 lflags = SLB_VSID_KERNEL | linear_llp; 74 lflags = SLB_VSID_KERNEL | linear_llp;
75 vflags = SLB_VSID_KERNEL | virtual_llp; 75 vflags = SLB_VSID_KERNEL | vmalloc_llp;
76 76
77 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2); 77 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2);
78 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) 78 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET)
@@ -122,9 +122,6 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
122 122
123 get_paca()->slb_cache_ptr = 0; 123 get_paca()->slb_cache_ptr = 0;
124 get_paca()->context = mm->context; 124 get_paca()->context = mm->context;
125#ifdef CONFIG_PPC_64K_PAGES
126 get_paca()->pgdir = mm->pgd;
127#endif /* CONFIG_PPC_64K_PAGES */
128 125
129 /* 126 /*
130 * preload some userspace segments into the SLB. 127 * preload some userspace segments into the SLB.
@@ -167,11 +164,10 @@ static inline void patch_slb_encoding(unsigned int *insn_addr,
167 164
168void slb_initialize(void) 165void slb_initialize(void)
169{ 166{
170 unsigned long linear_llp, virtual_llp; 167 unsigned long linear_llp, vmalloc_llp, io_llp;
171 static int slb_encoding_inited; 168 static int slb_encoding_inited;
172 extern unsigned int *slb_miss_kernel_load_linear; 169 extern unsigned int *slb_miss_kernel_load_linear;
173 extern unsigned int *slb_miss_kernel_load_virtual; 170 extern unsigned int *slb_miss_kernel_load_io;
174 extern unsigned int *slb_miss_user_load_normal;
175#ifdef CONFIG_HUGETLB_PAGE 171#ifdef CONFIG_HUGETLB_PAGE
176 extern unsigned int *slb_miss_user_load_huge; 172 extern unsigned int *slb_miss_user_load_huge;
177 unsigned long huge_llp; 173 unsigned long huge_llp;
@@ -181,18 +177,19 @@ void slb_initialize(void)
181 177
182 /* Prepare our SLB miss handler based on our page size */ 178 /* Prepare our SLB miss handler based on our page size */
183 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp; 179 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp;
184 virtual_llp = mmu_psize_defs[mmu_virtual_psize].sllp; 180 io_llp = mmu_psize_defs[mmu_io_psize].sllp;
181 vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp;
182 get_paca()->vmalloc_sllp = SLB_VSID_KERNEL | vmalloc_llp;
183
185 if (!slb_encoding_inited) { 184 if (!slb_encoding_inited) {
186 slb_encoding_inited = 1; 185 slb_encoding_inited = 1;
187 patch_slb_encoding(slb_miss_kernel_load_linear, 186 patch_slb_encoding(slb_miss_kernel_load_linear,
188 SLB_VSID_KERNEL | linear_llp); 187 SLB_VSID_KERNEL | linear_llp);
189 patch_slb_encoding(slb_miss_kernel_load_virtual, 188 patch_slb_encoding(slb_miss_kernel_load_io,
190 SLB_VSID_KERNEL | virtual_llp); 189 SLB_VSID_KERNEL | io_llp);
191 patch_slb_encoding(slb_miss_user_load_normal,
192 SLB_VSID_USER | virtual_llp);
193 190
194 DBG("SLB: linear LLP = %04x\n", linear_llp); 191 DBG("SLB: linear LLP = %04x\n", linear_llp);
195 DBG("SLB: virtual LLP = %04x\n", virtual_llp); 192 DBG("SLB: io LLP = %04x\n", io_llp);
196#ifdef CONFIG_HUGETLB_PAGE 193#ifdef CONFIG_HUGETLB_PAGE
197 patch_slb_encoding(slb_miss_user_load_huge, 194 patch_slb_encoding(slb_miss_user_load_huge,
198 SLB_VSID_USER | huge_llp); 195 SLB_VSID_USER | huge_llp);
@@ -207,7 +204,7 @@ void slb_initialize(void)
207 unsigned long lflags, vflags; 204 unsigned long lflags, vflags;
208 205
209 lflags = SLB_VSID_KERNEL | linear_llp; 206 lflags = SLB_VSID_KERNEL | linear_llp;
210 vflags = SLB_VSID_KERNEL | virtual_llp; 207 vflags = SLB_VSID_KERNEL | vmalloc_llp;
211 208
212 /* Invalidate the entire SLB (even slot 0) & all the ERATS */ 209 /* Invalidate the entire SLB (even slot 0) & all the ERATS */
213 asm volatile("isync":::"memory"); 210 asm volatile("isync":::"memory");
@@ -215,7 +212,6 @@ void slb_initialize(void)
215 asm volatile("isync; slbia; isync":::"memory"); 212 asm volatile("isync; slbia; isync":::"memory");
216 create_slbe(PAGE_OFFSET, lflags, 0); 213 create_slbe(PAGE_OFFSET, lflags, 0);
217 214
218 /* VMALLOC space has 4K pages always for now */
219 create_slbe(VMALLOC_START, vflags, 1); 215 create_slbe(VMALLOC_START, vflags, 1);
220 216
221 /* We don't bolt the stack for the time being - we're in boot, 217 /* We don't bolt the stack for the time being - we're in boot,
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index abfaabf667bf..8548dcf8ef8b 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -59,10 +59,19 @@ _GLOBAL(slb_miss_kernel_load_linear)
59 li r11,0 59 li r11,0
60 b slb_finish_load 60 b slb_finish_load
61 61
621: /* vmalloc/ioremap mapping encoding bits, the "li" instruction below 621: /* vmalloc/ioremap mapping encoding bits, the "li" instructions below
63 * will be patched by the kernel at boot 63 * will be patched by the kernel at boot
64 */ 64 */
65_GLOBAL(slb_miss_kernel_load_virtual) 65BEGIN_FTR_SECTION
66 /* check whether this is in vmalloc or ioremap space */
67 clrldi r11,r10,48
68 cmpldi r11,(VMALLOC_SIZE >> 28) - 1
69 bgt 5f
70 lhz r11,PACAVMALLOCSLLP(r13)
71 b slb_finish_load
725:
73END_FTR_SECTION_IFCLR(CPU_FTR_CI_LARGE_PAGE)
74_GLOBAL(slb_miss_kernel_load_io)
66 li r11,0 75 li r11,0
67 b slb_finish_load 76 b slb_finish_load
68 77
@@ -96,9 +105,7 @@ _GLOBAL(slb_miss_user_load_huge)
961: 1051:
97#endif /* CONFIG_HUGETLB_PAGE */ 106#endif /* CONFIG_HUGETLB_PAGE */
98 107
99_GLOBAL(slb_miss_user_load_normal) 108 lhz r11,PACACONTEXTSLLP(r13)
100 li r11,0
101
1022: 1092:
103 ld r9,PACACONTEXTID(r13) 110 ld r9,PACACONTEXTID(r13)
104 rldimi r10,r9,USER_ESID_BITS,0 111 rldimi r10,r9,USER_ESID_BITS,0
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 4a9291d9fef8..691320c90b78 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -200,10 +200,6 @@ void switch_stab(struct task_struct *tsk, struct mm_struct *mm)
200 200
201 __get_cpu_var(stab_cache_ptr) = 0; 201 __get_cpu_var(stab_cache_ptr) = 0;
202 202
203#ifdef CONFIG_PPC_64K_PAGES
204 get_paca()->pgdir = mm->pgd;
205#endif /* CONFIG_PPC_64K_PAGES */
206
207 /* Now preload some entries for the new task */ 203 /* Now preload some entries for the new task */
208 if (test_tsk_thread_flag(tsk, TIF_32BIT)) 204 if (test_tsk_thread_flag(tsk, TIF_32BIT))
209 unmapped_base = TASK_UNMAPPED_BASE_USER32; 205 unmapped_base = TASK_UNMAPPED_BASE_USER32;
diff --git a/arch/powerpc/mm/tlb_32.c b/arch/powerpc/mm/tlb_32.c
index ad580f3742e5..02eb23e036d5 100644
--- a/arch/powerpc/mm/tlb_32.c
+++ b/arch/powerpc/mm/tlb_32.c
@@ -42,7 +42,7 @@ void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long addr)
42 42
43 if (Hash != 0) { 43 if (Hash != 0) {
44 ptephys = __pa(ptep) & PAGE_MASK; 44 ptephys = __pa(ptep) & PAGE_MASK;
45 flush_hash_pages(mm->context, addr, ptephys, 1); 45 flush_hash_pages(mm->context.id, addr, ptephys, 1);
46 } 46 }
47} 47}
48 48
@@ -102,7 +102,7 @@ static void flush_range(struct mm_struct *mm, unsigned long start,
102 pmd_t *pmd; 102 pmd_t *pmd;
103 unsigned long pmd_end; 103 unsigned long pmd_end;
104 int count; 104 int count;
105 unsigned int ctx = mm->context; 105 unsigned int ctx = mm->context.id;
106 106
107 if (Hash == 0) { 107 if (Hash == 0) {
108 _tlbia(); 108 _tlbia();
@@ -172,7 +172,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
172 mm = (vmaddr < TASK_SIZE)? vma->vm_mm: &init_mm; 172 mm = (vmaddr < TASK_SIZE)? vma->vm_mm: &init_mm;
173 pmd = pmd_offset(pgd_offset(mm, vmaddr), vmaddr); 173 pmd = pmd_offset(pgd_offset(mm, vmaddr), vmaddr);
174 if (!pmd_none(*pmd)) 174 if (!pmd_none(*pmd))
175 flush_hash_pages(mm->context, vmaddr, pmd_val(*pmd), 1); 175 flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1);
176 FINISH_FLUSH; 176 FINISH_FLUSH;
177} 177}
178 178
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index f734b11566c2..e7449b068c82 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -131,7 +131,7 @@ void hpte_update(struct mm_struct *mm, unsigned long addr,
131{ 131{
132 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 132 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
133 unsigned long vsid; 133 unsigned long vsid;
134 unsigned int psize = mmu_virtual_psize; 134 unsigned int psize;
135 int i; 135 int i;
136 136
137 i = batch->index; 137 i = batch->index;
@@ -148,7 +148,8 @@ void hpte_update(struct mm_struct *mm, unsigned long addr,
148#else 148#else
149 BUG(); 149 BUG();
150#endif 150#endif
151 } 151 } else
152 psize = pte_pagesize_index(pte);
152 153
153 /* 154 /*
154 * This can happen when we are in the middle of a TLB batch and 155 * This can happen when we are in the middle of a TLB batch and
diff --git a/arch/powerpc/oprofile/Kconfig b/arch/powerpc/oprofile/Kconfig
index d03c0e5ca870..eb2dece76a54 100644
--- a/arch/powerpc/oprofile/Kconfig
+++ b/arch/powerpc/oprofile/Kconfig
@@ -1,5 +1,4 @@
1config PROFILING 1config PROFILING
2 depends on !PPC_ISERIES
3 bool "Profiling support (EXPERIMENTAL)" 2 bool "Profiling support (EXPERIMENTAL)"
4 help 3 help
5 Say Y here to enable the extended profiling support mechanisms used 4 Say Y here to enable the extended profiling support mechanisms used
diff --git a/arch/powerpc/oprofile/Makefile b/arch/powerpc/oprofile/Makefile
index f5f9859a8338..3145d610b5b0 100644
--- a/arch/powerpc/oprofile/Makefile
+++ b/arch/powerpc/oprofile/Makefile
@@ -1,3 +1,7 @@
1ifeq ($(CONFIG_PPC64),y)
2EXTRA_CFLAGS += -mno-minimal-toc
3endif
4
1obj-$(CONFIG_OPROFILE) += oprofile.o 5obj-$(CONFIG_OPROFILE) += oprofile.o
2 6
3DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \ 7DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index 5b1de7e8041e..27ad56bd227e 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -22,6 +22,7 @@
22#include <asm/pmc.h> 22#include <asm/pmc.h>
23#include <asm/cputable.h> 23#include <asm/cputable.h>
24#include <asm/oprofile_impl.h> 24#include <asm/oprofile_impl.h>
25#include <asm/firmware.h>
25 26
26static struct op_powerpc_model *model; 27static struct op_powerpc_model *model;
27 28
@@ -130,6 +131,9 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
130 if (!cur_cpu_spec->oprofile_cpu_type) 131 if (!cur_cpu_spec->oprofile_cpu_type)
131 return -ENODEV; 132 return -ENODEV;
132 133
134 if (firmware_has_feature(FW_FEATURE_ISERIES))
135 return -ENODEV;
136
133 switch (cur_cpu_spec->oprofile_type) { 137 switch (cur_cpu_spec->oprofile_type) {
134#ifdef CONFIG_PPC64 138#ifdef CONFIG_PPC64
135 case PPC_OPROFILE_RS64: 139 case PPC_OPROFILE_RS64:
@@ -162,7 +166,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
162 ops->stop = op_powerpc_stop; 166 ops->stop = op_powerpc_stop;
163 ops->backtrace = op_powerpc_backtrace; 167 ops->backtrace = op_powerpc_backtrace;
164 168
165 printk(KERN_INFO "oprofile: using %s performance monitoring.\n", 169 printk(KERN_DEBUG "oprofile: using %s performance monitoring.\n",
166 ops->cpu_type); 170 ops->cpu_type);
167 171
168 return 0; 172 return 0;
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 4c2beab1fdc1..506f6b79f893 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -24,10 +24,6 @@
24static unsigned long reset_value[OP_MAX_COUNTER]; 24static unsigned long reset_value[OP_MAX_COUNTER];
25 25
26static int oprofile_running; 26static int oprofile_running;
27static int mmcra_has_sihv;
28/* Unfortunately these bits vary between CPUs */
29static unsigned long mmcra_sihv = MMCRA_SIHV;
30static unsigned long mmcra_sipr = MMCRA_SIPR;
31 27
32/* mmcr values are set in power4_reg_setup, used in power4_cpu_setup */ 28/* mmcr values are set in power4_reg_setup, used in power4_cpu_setup */
33static u32 mmcr0_val; 29static u32 mmcr0_val;
@@ -41,16 +37,6 @@ static void power4_reg_setup(struct op_counter_config *ctr,
41 int i; 37 int i;
42 38
43 /* 39 /*
44 * SIHV / SIPR bits are only implemented on POWER4+ (GQ) and above.
45 * However we disable it on all POWER4 until we verify it works
46 * (I was seeing some strange behaviour last time I tried).
47 *
48 * It has been verified to work on POWER5 so we enable it there.
49 */
50 if (cpu_has_feature(CPU_FTR_MMCRA_SIHV))
51 mmcra_has_sihv = 1;
52
53 /*
54 * The performance counter event settings are given in the mmcr0, 40 * The performance counter event settings are given in the mmcr0,
55 * mmcr1 and mmcra values passed from the user in the 41 * mmcr1 and mmcra values passed from the user in the
56 * op_system_config structure (sys variable). 42 * op_system_config structure (sys variable).
@@ -202,18 +188,19 @@ static unsigned long get_pc(struct pt_regs *regs)
202 unsigned long mmcra; 188 unsigned long mmcra;
203 189
204 /* Cant do much about it */ 190 /* Cant do much about it */
205 if (!mmcra_has_sihv) 191 if (!cur_cpu_spec->oprofile_mmcra_sihv)
206 return pc; 192 return pc;
207 193
208 mmcra = mfspr(SPRN_MMCRA); 194 mmcra = mfspr(SPRN_MMCRA);
209 195
210 /* Were we in the hypervisor? */ 196 /* Were we in the hypervisor? */
211 if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & mmcra_sihv)) 197 if (firmware_has_feature(FW_FEATURE_LPAR) &&
198 (mmcra & cur_cpu_spec->oprofile_mmcra_sihv))
212 /* function descriptor madness */ 199 /* function descriptor madness */
213 return *((unsigned long *)hypervisor_bucket); 200 return *((unsigned long *)hypervisor_bucket);
214 201
215 /* We were in userspace, nothing to do */ 202 /* We were in userspace, nothing to do */
216 if (mmcra & mmcra_sipr) 203 if (mmcra & cur_cpu_spec->oprofile_mmcra_sipr)
217 return pc; 204 return pc;
218 205
219#ifdef CONFIG_PPC_RTAS 206#ifdef CONFIG_PPC_RTAS
@@ -235,15 +222,14 @@ static unsigned long get_pc(struct pt_regs *regs)
235 return pc; 222 return pc;
236} 223}
237 224
238static int get_kernel(unsigned long pc) 225static int get_kernel(unsigned long pc, unsigned long mmcra)
239{ 226{
240 int is_kernel; 227 int is_kernel;
241 228
242 if (!mmcra_has_sihv) { 229 if (!cur_cpu_spec->oprofile_mmcra_sihv) {
243 is_kernel = is_kernel_addr(pc); 230 is_kernel = is_kernel_addr(pc);
244 } else { 231 } else {
245 unsigned long mmcra = mfspr(SPRN_MMCRA); 232 is_kernel = ((mmcra & cur_cpu_spec->oprofile_mmcra_sipr) == 0);
246 is_kernel = ((mmcra & mmcra_sipr) == 0);
247 } 233 }
248 234
249 return is_kernel; 235 return is_kernel;
@@ -257,9 +243,12 @@ static void power4_handle_interrupt(struct pt_regs *regs,
257 int val; 243 int val;
258 int i; 244 int i;
259 unsigned int mmcr0; 245 unsigned int mmcr0;
246 unsigned long mmcra;
247
248 mmcra = mfspr(SPRN_MMCRA);
260 249
261 pc = get_pc(regs); 250 pc = get_pc(regs);
262 is_kernel = get_kernel(pc); 251 is_kernel = get_kernel(pc, mmcra);
263 252
264 /* set the PMM bit (see comment below) */ 253 /* set the PMM bit (see comment below) */
265 mtmsrd(mfmsr() | MSR_PMM); 254 mtmsrd(mfmsr() | MSR_PMM);
@@ -287,6 +276,10 @@ static void power4_handle_interrupt(struct pt_regs *regs,
287 */ 276 */
288 mmcr0 &= ~MMCR0_PMAO; 277 mmcr0 &= ~MMCR0_PMAO;
289 278
279 /* Clear the appropriate bits in the MMCRA */
280 mmcra &= ~cur_cpu_spec->oprofile_mmcra_clear;
281 mtspr(SPRN_MMCRA, mmcra);
282
290 /* 283 /*
291 * now clear the freeze bit, counting will not start until we 284 * now clear the freeze bit, counting will not start until we
292 * rfid from this exception, because only at that point will 285 * rfid from this exception, because only at that point will
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 06e371282f57..454fc53289ab 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -11,13 +11,20 @@ config MPC8540_ADS
11 help 11 help
12 This option enables support for the MPC 8540 ADS board 12 This option enables support for the MPC 8540 ADS board
13 13
14config MPC85xx_CDS
15 bool "Freescale MPC85xx CDS"
16 select DEFAULT_UIMAGE
17 select PPC_I8259 if PCI
18 help
19 This option enables support for the MPC85xx CDS board
20
14endchoice 21endchoice
15 22
16config MPC8540 23config MPC8540
17 bool 24 bool
18 select PPC_UDBG_16550 25 select PPC_UDBG_16550
19 select PPC_INDIRECT_PCI 26 select PPC_INDIRECT_PCI
20 default y if MPC8540_ADS 27 default y if MPC8540_ADS || MPC85xx_CDS
21 28
22config PPC_INDIRECT_PCI_BE 29config PPC_INDIRECT_PCI_BE
23 bool 30 bool
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index ffc4139cb214..7615aa59c78b 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -3,3 +3,4 @@
3# 3#
4obj-$(CONFIG_PPC_85xx) += misc.o pci.o 4obj-$(CONFIG_PPC_85xx) += misc.o pci.o
5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o 5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
6obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
new file mode 100644
index 000000000000..18e6e11f7020
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -0,0 +1,359 @@
1/*
2 * MPC85xx setup and early boot code plus other random bits.
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2005 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/pci.h>
21#include <linux/kdev_t.h>
22#include <linux/major.h>
23#include <linux/console.h>
24#include <linux/delay.h>
25#include <linux/seq_file.h>
26#include <linux/root_dev.h>
27#include <linux/initrd.h>
28#include <linux/module.h>
29#include <linux/fsl_devices.h>
30
31#include <asm/system.h>
32#include <asm/pgtable.h>
33#include <asm/page.h>
34#include <asm/atomic.h>
35#include <asm/time.h>
36#include <asm/io.h>
37#include <asm/machdep.h>
38#include <asm/ipic.h>
39#include <asm/bootinfo.h>
40#include <asm/pci-bridge.h>
41#include <asm/mpc85xx.h>
42#include <asm/irq.h>
43#include <mm/mmu_decl.h>
44#include <asm/prom.h>
45#include <asm/udbg.h>
46#include <asm/mpic.h>
47#include <asm/i8259.h>
48
49#include <sysdev/fsl_soc.h>
50#include "mpc85xx.h"
51
52#ifndef CONFIG_PCI
53unsigned long isa_io_base = 0;
54unsigned long isa_mem_base = 0;
55#endif
56
57static int cds_pci_slot = 2;
58static volatile u8 *cadmus;
59
60/*
61 * Internal interrupts are all Level Sensitive, and Positive Polarity
62 *
63 * Note: Likely, this table and the following function should be
64 * obtained and derived from the OF Device Tree.
65 */
66static u_char mpc85xx_cds_openpic_initsenses[] __initdata = {
67 MPC85XX_INTERNAL_IRQ_SENSES,
68#if defined(CONFIG_PCI)
69 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Ext 0: PCI slot 0 */
70 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 1: PCI slot 1 */
71 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 2: PCI slot 2 */
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 3: PCI slot 3 */
73#else
74 0x0, /* External 0: */
75 0x0, /* External 1: */
76 0x0, /* External 2: */
77 0x0, /* External 3: */
78#endif
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PHY */
80 0x0, /* External 6: */
81 0x0, /* External 7: */
82 0x0, /* External 8: */
83 0x0, /* External 9: */
84 0x0, /* External 10: */
85#ifdef CONFIG_PCI
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 11: PCI2 slot 0 */
87#else
88 0x0, /* External 11: */
89#endif
90};
91
92
93#ifdef CONFIG_PCI
94/*
95 * interrupt routing
96 */
97int
98mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
99{
100 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
101
102 if (!hose->index)
103 {
104 /* Handle PCI1 interrupts */
105 char pci_irq_table[][4] =
106 /*
107 * PCI IDSEL/INTPIN->INTLINE
108 * A B C D
109 */
110
111 /* Note IRQ assignment for slots is based on which slot the elysium is
112 * in -- in this setup elysium is in slot #2 (this PIRQA as first
113 * interrupt on slot */
114 {
115 { 0, 1, 2, 3 }, /* 16 - PMC */
116 { 0, 1, 2, 3 }, /* 17 P2P (Tsi320) */
117 { 0, 1, 2, 3 }, /* 18 - Slot 1 */
118 { 1, 2, 3, 0 }, /* 19 - Slot 2 */
119 { 2, 3, 0, 1 }, /* 20 - Slot 3 */
120 { 3, 0, 1, 2 }, /* 21 - Slot 4 */
121 };
122
123 const long min_idsel = 16, max_idsel = 21, irqs_per_slot = 4;
124 int i, j;
125
126 for (i = 0; i < 6; i++)
127 for (j = 0; j < 4; j++)
128 pci_irq_table[i][j] =
129 ((pci_irq_table[i][j] + 5 -
130 cds_pci_slot) & 0x3) + PIRQ0A;
131
132 return PCI_IRQ_TABLE_LOOKUP;
133 } else {
134 /* Handle PCI2 interrupts (if we have one) */
135 char pci_irq_table[][4] =
136 {
137 /*
138 * We only have one slot and one interrupt
139 * going to PIRQA - PIRQD */
140 { PIRQ1A, PIRQ1A, PIRQ1A, PIRQ1A }, /* 21 - slot 0 */
141 };
142
143 const long min_idsel = 21, max_idsel = 21, irqs_per_slot = 4;
144
145 return PCI_IRQ_TABLE_LOOKUP;
146 }
147}
148
149#define ARCADIA_HOST_BRIDGE_IDSEL 17
150#define ARCADIA_2ND_BRIDGE_IDSEL 3
151
152extern int mpc85xx_pci2_busno;
153
154int
155mpc85xx_exclude_device(u_char bus, u_char devfn)
156{
157 if (bus == 0 && PCI_SLOT(devfn) == 0)
158 return PCIBIOS_DEVICE_NOT_FOUND;
159 if (mpc85xx_pci2_busno)
160 if (bus == (mpc85xx_pci2_busno) && PCI_SLOT(devfn) == 0)
161 return PCIBIOS_DEVICE_NOT_FOUND;
162 /* We explicitly do not go past the Tundra 320 Bridge */
163 if ((bus == 1) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
164 return PCIBIOS_DEVICE_NOT_FOUND;
165 if ((bus == 0) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
166 return PCIBIOS_DEVICE_NOT_FOUND;
167 else
168 return PCIBIOS_SUCCESSFUL;
169}
170
171void __init
172mpc85xx_cds_pcibios_fixup(void)
173{
174 struct pci_dev *dev;
175 u_char c;
176
177 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
178 PCI_DEVICE_ID_VIA_82C586_1, NULL))) {
179 /*
180 * U-Boot does not set the enable bits
181 * for the IDE device. Force them on here.
182 */
183 pci_read_config_byte(dev, 0x40, &c);
184 c |= 0x03; /* IDE: Chip Enable Bits */
185 pci_write_config_byte(dev, 0x40, c);
186
187 /*
188 * Since only primary interface works, force the
189 * IDE function to standard primary IDE interrupt
190 * w/ 8259 offset
191 */
192 dev->irq = 14;
193 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
194 pci_dev_put(dev);
195 }
196
197 /*
198 * Force legacy USB interrupt routing
199 */
200 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
201 PCI_DEVICE_ID_VIA_82C586_2, NULL))) {
202 dev->irq = 10;
203 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10);
204 pci_dev_put(dev);
205 }
206
207 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
208 PCI_DEVICE_ID_VIA_82C586_2, dev))) {
209 dev->irq = 11;
210 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11);
211 pci_dev_put(dev);
212 }
213}
214#endif /* CONFIG_PCI */
215
216void __init mpc85xx_cds_pic_init(void)
217{
218 struct mpic *mpic1;
219 phys_addr_t OpenPIC_PAddr;
220
221 /* Determine the Physical Address of the OpenPIC regs */
222 OpenPIC_PAddr = get_immrbase() + MPC85xx_OPENPIC_OFFSET;
223
224 mpic1 = mpic_alloc(OpenPIC_PAddr,
225 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
226 4, MPC85xx_OPENPIC_IRQ_OFFSET, 0, 250,
227 mpc85xx_cds_openpic_initsenses,
228 sizeof(mpc85xx_cds_openpic_initsenses), " OpenPIC ");
229 BUG_ON(mpic1 == NULL);
230 mpic_assign_isu(mpic1, 0, OpenPIC_PAddr + 0x10200);
231 mpic_assign_isu(mpic1, 1, OpenPIC_PAddr + 0x10280);
232 mpic_assign_isu(mpic1, 2, OpenPIC_PAddr + 0x10300);
233 mpic_assign_isu(mpic1, 3, OpenPIC_PAddr + 0x10380);
234 mpic_assign_isu(mpic1, 4, OpenPIC_PAddr + 0x10400);
235 mpic_assign_isu(mpic1, 5, OpenPIC_PAddr + 0x10480);
236 mpic_assign_isu(mpic1, 6, OpenPIC_PAddr + 0x10500);
237 mpic_assign_isu(mpic1, 7, OpenPIC_PAddr + 0x10580);
238
239 /* dummy mappings to get to 48 */
240 mpic_assign_isu(mpic1, 8, OpenPIC_PAddr + 0x10600);
241 mpic_assign_isu(mpic1, 9, OpenPIC_PAddr + 0x10680);
242 mpic_assign_isu(mpic1, 10, OpenPIC_PAddr + 0x10700);
243 mpic_assign_isu(mpic1, 11, OpenPIC_PAddr + 0x10780);
244
245 /* External ints */
246 mpic_assign_isu(mpic1, 12, OpenPIC_PAddr + 0x10000);
247 mpic_assign_isu(mpic1, 13, OpenPIC_PAddr + 0x10080);
248 mpic_assign_isu(mpic1, 14, OpenPIC_PAddr + 0x10100);
249
250 mpic_init(mpic1);
251
252#ifdef CONFIG_PCI
253 mpic_setup_cascade(PIRQ0A, i8259_irq_cascade, NULL);
254
255 i8259_init(0,0);
256#endif
257}
258
259
260/*
261 * Setup the architecture
262 */
263static void __init
264mpc85xx_cds_setup_arch(void)
265{
266 struct device_node *cpu;
267#ifdef CONFIG_PCI
268 struct device_node *np;
269#endif
270
271 if (ppc_md.progress)
272 ppc_md.progress("mpc85xx_cds_setup_arch()", 0);
273
274 cpu = of_find_node_by_type(NULL, "cpu");
275 if (cpu != 0) {
276 unsigned int *fp;
277
278 fp = (int *)get_property(cpu, "clock-frequency", NULL);
279 if (fp != 0)
280 loops_per_jiffy = *fp / HZ;
281 else
282 loops_per_jiffy = 500000000 / HZ;
283 of_node_put(cpu);
284 }
285
286 cadmus = ioremap(CADMUS_BASE, CADMUS_SIZE);
287 cds_pci_slot = ((cadmus[CM_CSR] >> 6) & 0x3) + 1;
288
289 if (ppc_md.progress) {
290 char buf[40];
291 snprintf(buf, 40, "CDS Version = 0x%x in slot %d\n",
292 cadmus[CM_VER], cds_pci_slot);
293 ppc_md.progress(buf, 0);
294 }
295
296#ifdef CONFIG_PCI
297 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
298 add_bridge(np);
299
300 ppc_md.pcibios_fixup = mpc85xx_cds_pcibios_fixup;
301 ppc_md.pci_swizzle = common_swizzle;
302 ppc_md.pci_map_irq = mpc85xx_map_irq;
303 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
304#endif
305
306#ifdef CONFIG_ROOT_NFS
307 ROOT_DEV = Root_NFS;
308#else
309 ROOT_DEV = Root_HDA1;
310#endif
311}
312
313
314void
315mpc85xx_cds_show_cpuinfo(struct seq_file *m)
316{
317 uint pvid, svid, phid1;
318 uint memsize = total_memory;
319
320 pvid = mfspr(SPRN_PVR);
321 svid = mfspr(SPRN_SVR);
322
323 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
324 seq_printf(m, "Machine\t\t: MPC85xx CDS (0x%x)\n", cadmus[CM_VER]);
325 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
326 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
327
328 /* Display cpu Pll setting */
329 phid1 = mfspr(SPRN_HID1);
330 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
331
332 /* Display the amount of memory */
333 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
334}
335
336
337/*
338 * Called very early, device-tree isn't unflattened
339 */
340static int __init mpc85xx_cds_probe(void)
341{
342 /* We always match for now, eventually we should look at
343 * the flat dev tree to ensure this is the board we are
344 * supposed to run on
345 */
346 return 1;
347}
348
349define_machine(mpc85xx_cds) {
350 .name = "MPC85xx CDS",
351 .probe = mpc85xx_cds_probe,
352 .setup_arch = mpc85xx_cds_setup_arch,
353 .init_IRQ = mpc85xx_cds_pic_init,
354 .show_cpuinfo = mpc85xx_cds_show_cpuinfo,
355 .get_irq = mpic_get_irq,
356 .restart = mpc85xx_restart,
357 .calibrate_decr = generic_calibrate_decr,
358 .progress = udbg_progress,
359};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.h b/arch/powerpc/platforms/85xx/mpc85xx_cds.h
new file mode 100644
index 000000000000..671f54ff185a
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.h
@@ -0,0 +1,43 @@
1/*
2 * arch/ppc/platforms/85xx/mpc85xx_cds_common.h
3 *
4 * MPC85xx CDS board definitions
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * Copyright 2004 Freescale Semiconductor, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MACH_MPC85XX_CDS_H__
18#define __MACH_MPC85XX_CDS_H__
19
20/* CADMUS info */
21#define CADMUS_BASE (0xf8004000)
22#define CADMUS_SIZE (256)
23#define CM_VER (0)
24#define CM_CSR (1)
25#define CM_RST (2)
26
27/* CDS NVRAM/RTC */
28#define CDS_RTC_ADDR (0xf8000000)
29#define CDS_RTC_SIZE (8 * 1024)
30
31/* PCI interrupt controller */
32#define PIRQ0A MPC85xx_IRQ_EXT0
33#define PIRQ0B MPC85xx_IRQ_EXT1
34#define PIRQ0C MPC85xx_IRQ_EXT2
35#define PIRQ0D MPC85xx_IRQ_EXT3
36#define PIRQ1A MPC85xx_IRQ_EXT11
37
38#define NR_8259_INTS 16
39#define CPM_IRQ_OFFSET NR_8259_INTS
40
41#define MPC85xx_OPENPIC_IRQ_OFFSET 80
42
43#endif /* __MACH_MPC85XX_CDS_H__ */
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
new file mode 100644
index 000000000000..3a87863d2876
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -0,0 +1,36 @@
1menu "Platform Support"
2 depends on PPC_86xx
3
4choice
5 prompt "Machine Type"
6 default MPC8641_HPCN
7
8config MPC8641_HPCN
9 bool "Freescale MPC8641 HPCN"
10 help
11 This option enables support for the MPC8641 HPCN board.
12
13endchoice
14
15
16config MPC8641
17 bool
18 select PPC_INDIRECT_PCI
19 select PPC_UDBG_16550
20 default y if MPC8641_HPCN
21
22config MPIC
23 bool
24 default y
25
26config PPC_INDIRECT_PCI_BE
27 bool
28 depends on PPC_86xx
29 default y
30
31config PPC_STD_MMU
32 bool
33 depends on PPC_86xx
34 default y
35
36endmenu
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
new file mode 100644
index 000000000000..7be796c5d5c9
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for the PowerPC 86xx linux kernel.
3#
4
5
6ifeq ($(CONFIG_PPC_86xx),y)
7obj-$(CONFIG_SMP) += mpc86xx_smp.o
8endif
9obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
10obj-$(CONFIG_PCI) += pci.o mpc86xx_pcie.o
diff --git a/arch/powerpc/platforms/86xx/mpc8641_hpcn.h b/arch/powerpc/platforms/86xx/mpc8641_hpcn.h
new file mode 100644
index 000000000000..5042253758b7
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/mpc8641_hpcn.h
@@ -0,0 +1,54 @@
1/*
2 * MPC8641 HPCN board definitions
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 * Author: Xianghua Xiao <x.xiao@freescale.com>
12 */
13
14#ifndef __MPC8641_HPCN_H__
15#define __MPC8641_HPCN_H__
16
17#include <linux/config.h>
18#include <linux/init.h>
19
20/* PCI interrupt controller */
21#define PIRQA 3
22#define PIRQB 4
23#define PIRQC 5
24#define PIRQD 6
25#define PIRQ7 7
26#define PIRQE 9
27#define PIRQF 10
28#define PIRQG 11
29#define PIRQH 12
30
31/* PCI-Express memory map */
32#define MPC86XX_PCIE_LOWER_IO 0x00000000
33#define MPC86XX_PCIE_UPPER_IO 0x00ffffff
34
35#define MPC86XX_PCIE_LOWER_MEM 0x80000000
36#define MPC86XX_PCIE_UPPER_MEM 0x9fffffff
37
38#define MPC86XX_PCIE_IO_BASE 0xe2000000
39#define MPC86XX_PCIE_MEM_OFFSET 0x00000000
40
41#define MPC86XX_PCIE_IO_SIZE 0x01000000
42
43#define PCIE1_CFG_ADDR_OFFSET (0x8000)
44#define PCIE1_CFG_DATA_OFFSET (0x8004)
45
46#define PCIE2_CFG_ADDR_OFFSET (0x9000)
47#define PCIE2_CFG_DATA_OFFSET (0x9004)
48
49#define MPC86xx_PCIE_OFFSET PCIE1_CFG_ADDR_OFFSET
50#define MPC86xx_PCIE_SIZE (0x1000)
51
52#define MPC86XX_RSTCR_OFFSET (0xe00b0) /* Reset Control Register */
53
54#endif /* __MPC8641_HPCN_H__ */
diff --git a/arch/powerpc/platforms/86xx/mpc86xx.h b/arch/powerpc/platforms/86xx/mpc86xx.h
new file mode 100644
index 000000000000..e3c9e4f417d3
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/mpc86xx.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright 2006 Freescale Semiconductor Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __MPC86XX_H__
11#define __MPC86XX_H__
12
13/*
14 * Declaration for the various functions exported by the
15 * mpc86xx_* files. Mostly for use by mpc86xx_setup().
16 */
17
18extern int __init add_bridge(struct device_node *dev);
19
20extern void __init setup_indirect_pcie(struct pci_controller *hose,
21 u32 cfg_addr, u32 cfg_data);
22extern void __init setup_indirect_pcie_nomap(struct pci_controller *hose,
23 void __iomem *cfg_addr,
24 void __iomem *cfg_data);
25
26extern void __init mpc86xx_smp_init(void);
27
28#endif /* __MPC86XX_H__ */
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
new file mode 100644
index 000000000000..483c21df181e
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -0,0 +1,326 @@
1/*
2 * MPC86xx HPCN board specific routines
3 *
4 * Recode: ZHANG WEI <wei.zhang@freescale.com>
5 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
6 *
7 * Copyright 2006 Freescale Semiconductor Inc.
8 *
9 * 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
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/config.h>
16#include <linux/stddef.h>
17#include <linux/kernel.h>
18#include <linux/pci.h>
19#include <linux/kdev_t.h>
20#include <linux/delay.h>
21#include <linux/seq_file.h>
22#include <linux/root_dev.h>
23
24#include <asm/system.h>
25#include <asm/time.h>
26#include <asm/machdep.h>
27#include <asm/pci-bridge.h>
28#include <asm/mpc86xx.h>
29#include <asm/prom.h>
30#include <mm/mmu_decl.h>
31#include <asm/udbg.h>
32#include <asm/i8259.h>
33
34#include <asm/mpic.h>
35
36#include <sysdev/fsl_soc.h>
37
38#include "mpc86xx.h"
39
40#ifndef CONFIG_PCI
41unsigned long isa_io_base = 0;
42unsigned long isa_mem_base = 0;
43unsigned long pci_dram_offset = 0;
44#endif
45
46
47/*
48 * Internal interrupts are all Level Sensitive, and Positive Polarity
49 */
50
51static u_char mpc86xx_hpcn_openpic_initsenses[] __initdata = {
52 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: Reserved */
53 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1: MCM */
54 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2: DDR DRAM */
55 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3: LBIU */
56 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4: DMA 0 */
57 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5: DMA 1 */
58 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6: DMA 2 */
59 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7: DMA 3 */
60 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8: PCIE1 */
61 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9: PCIE2 */
62 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10: Reserved */
63 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11: Reserved */
64 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12: DUART2 */
65 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13: TSEC 1 Transmit */
66 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14: TSEC 1 Receive */
67 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15: TSEC 3 transmit */
68 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16: TSEC 3 receive */
69 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17: TSEC 3 error */
70 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18: TSEC 1 Receive/Transmit Error */
71 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19: TSEC 2 Transmit */
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20: TSEC 2 Receive */
73 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21: TSEC 4 transmit */
74 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22: TSEC 4 receive */
75 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23: TSEC 4 error */
76 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24: TSEC 2 Receive/Transmit Error */
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25: Unused */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26: DUART1 */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27: I2C */
80 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28: Performance Monitor */
81 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29: Unused */
82 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30: Unused */
83 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31: Unused */
84 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 32: SRIO error/write-port unit */
85 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 33: SRIO outbound doorbell */
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 34: SRIO inbound doorbell */
87 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 35: Unused */
88 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 36: Unused */
89 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 37: SRIO outbound message unit 1 */
90 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 38: SRIO inbound message unit 1 */
91 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 39: SRIO outbound message unit 2 */
92 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 40: SRIO inbound message unit 2 */
93 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 41: Unused */
94 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 42: Unused */
95 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 43: Unused */
96 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 44: Unused */
97 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 45: Unused */
98 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 46: Unused */
99 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 47: Unused */
100 0x0, /* External 0: */
101 0x0, /* External 1: */
102 0x0, /* External 2: */
103 0x0, /* External 3: */
104 0x0, /* External 4: */
105 0x0, /* External 5: */
106 0x0, /* External 6: */
107 0x0, /* External 7: */
108 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 8: Pixis FPGA */
109 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* External 9: ULI 8259 INTR Cascade */
110 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 10: Quad ETH PHY */
111 0x0, /* External 11: */
112 0x0,
113 0x0,
114 0x0,
115 0x0,
116};
117
118
119void __init
120mpc86xx_hpcn_init_irq(void)
121{
122 struct mpic *mpic1;
123 phys_addr_t openpic_paddr;
124
125 /* Determine the Physical Address of the OpenPIC regs */
126 openpic_paddr = get_immrbase() + MPC86xx_OPENPIC_OFFSET;
127
128 /* Alloc mpic structure and per isu has 16 INT entries. */
129 mpic1 = mpic_alloc(openpic_paddr,
130 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
131 16, MPC86xx_OPENPIC_IRQ_OFFSET, 0, 250,
132 mpc86xx_hpcn_openpic_initsenses,
133 sizeof(mpc86xx_hpcn_openpic_initsenses),
134 " MPIC ");
135 BUG_ON(mpic1 == NULL);
136
137 /* 48 Internal Interrupts */
138 mpic_assign_isu(mpic1, 0, openpic_paddr + 0x10200);
139 mpic_assign_isu(mpic1, 1, openpic_paddr + 0x10400);
140 mpic_assign_isu(mpic1, 2, openpic_paddr + 0x10600);
141
142 /* 16 External interrupts */
143 mpic_assign_isu(mpic1, 3, openpic_paddr + 0x10000);
144
145 mpic_init(mpic1);
146
147#ifdef CONFIG_PCI
148 mpic_setup_cascade(MPC86xx_IRQ_EXT9, i8259_irq_cascade, NULL);
149 i8259_init(0, I8259_OFFSET);
150#endif
151}
152
153
154
155#ifdef CONFIG_PCI
156/*
157 * interrupt routing
158 */
159
160int
161mpc86xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
162{
163 static char pci_irq_table[][4] = {
164 /*
165 * PCI IDSEL/INTPIN->INTLINE
166 * A B C D
167 */
168 {PIRQA, PIRQB, PIRQC, PIRQD}, /* IDSEL 17 -- PCI Slot 1 */
169 {PIRQB, PIRQC, PIRQD, PIRQA}, /* IDSEL 18 -- PCI Slot 2 */
170 {0, 0, 0, 0}, /* IDSEL 19 */
171 {0, 0, 0, 0}, /* IDSEL 20 */
172 {0, 0, 0, 0}, /* IDSEL 21 */
173 {0, 0, 0, 0}, /* IDSEL 22 */
174 {0, 0, 0, 0}, /* IDSEL 23 */
175 {0, 0, 0, 0}, /* IDSEL 24 */
176 {0, 0, 0, 0}, /* IDSEL 25 */
177 {PIRQD, PIRQA, PIRQB, PIRQC}, /* IDSEL 26 -- PCI Bridge*/
178 {PIRQC, 0, 0, 0}, /* IDSEL 27 -- LAN */
179 {PIRQE, PIRQF, PIRQH, PIRQ7}, /* IDSEL 28 -- USB 1.1 */
180 {PIRQE, PIRQF, PIRQG, 0}, /* IDSEL 29 -- Audio & Modem */
181 {PIRQH, 0, 0, 0}, /* IDSEL 30 -- LPC & PMU*/
182 {PIRQD, 0, 0, 0}, /* IDSEL 31 -- ATA */
183 };
184
185 const long min_idsel = 17, max_idsel = 31, irqs_per_slot = 4;
186 return PCI_IRQ_TABLE_LOOKUP + I8259_OFFSET;
187}
188
189
190int
191mpc86xx_exclude_device(u_char bus, u_char devfn)
192{
193#if !defined(CONFIG_PCI)
194 if (bus == 0 && PCI_SLOT(devfn) == 0)
195 return PCIBIOS_DEVICE_NOT_FOUND;
196#endif
197
198 return PCIBIOS_SUCCESSFUL;
199}
200#endif /* CONFIG_PCI */
201
202
203static void __init
204mpc86xx_hpcn_setup_arch(void)
205{
206 struct device_node *np;
207
208 if (ppc_md.progress)
209 ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
210
211 np = of_find_node_by_type(NULL, "cpu");
212 if (np != 0) {
213 unsigned int *fp;
214
215 fp = (int *)get_property(np, "clock-frequency", NULL);
216 if (fp != 0)
217 loops_per_jiffy = *fp / HZ;
218 else
219 loops_per_jiffy = 50000000 / HZ;
220 of_node_put(np);
221 }
222
223#ifdef CONFIG_PCI
224 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
225 add_bridge(np);
226
227 ppc_md.pci_swizzle = common_swizzle;
228 ppc_md.pci_map_irq = mpc86xx_map_irq;
229 ppc_md.pci_exclude_device = mpc86xx_exclude_device;
230#endif
231
232 printk("MPC86xx HPCN board from Freescale Semiconductor\n");
233
234#ifdef CONFIG_ROOT_NFS
235 ROOT_DEV = Root_NFS;
236#else
237 ROOT_DEV = Root_HDA1;
238#endif
239
240#ifdef CONFIG_SMP
241 mpc86xx_smp_init();
242#endif
243}
244
245
246void
247mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
248{
249 struct device_node *root;
250 uint memsize = total_memory;
251 const char *model = "";
252 uint svid = mfspr(SPRN_SVR);
253
254 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
255
256 root = of_find_node_by_path("/");
257 if (root)
258 model = get_property(root, "model", NULL);
259 seq_printf(m, "Machine\t\t: %s\n", model);
260 of_node_put(root);
261
262 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
263 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
264}
265
266
267/*
268 * Called very early, device-tree isn't unflattened
269 */
270static int __init mpc86xx_hpcn_probe(void)
271{
272 unsigned long root = of_get_flat_dt_root();
273
274 if (of_flat_dt_is_compatible(root, "mpc86xx"))
275 return 1; /* Looks good */
276
277 return 0;
278}
279
280
281void
282mpc86xx_restart(char *cmd)
283{
284 void __iomem *rstcr;
285
286 rstcr = ioremap(get_immrbase() + MPC86XX_RSTCR_OFFSET, 0x100);
287
288 local_irq_disable();
289
290 /* Assert reset request to Reset Control Register */
291 out_be32(rstcr, 0x2);
292
293 /* not reached */
294}
295
296
297long __init
298mpc86xx_time_init(void)
299{
300 unsigned int temp;
301
302 /* Set the time base to zero */
303 mtspr(SPRN_TBWL, 0);
304 mtspr(SPRN_TBWU, 0);
305
306 temp = mfspr(SPRN_HID0);
307 temp |= HID0_TBEN;
308 mtspr(SPRN_HID0, temp);
309 asm volatile("isync");
310
311 return 0;
312}
313
314
315define_machine(mpc86xx_hpcn) {
316 .name = "MPC86xx HPCN",
317 .probe = mpc86xx_hpcn_probe,
318 .setup_arch = mpc86xx_hpcn_setup_arch,
319 .init_IRQ = mpc86xx_hpcn_init_irq,
320 .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo,
321 .get_irq = mpic_get_irq,
322 .restart = mpc86xx_restart,
323 .time_init = mpc86xx_time_init,
324 .calibrate_decr = generic_calibrate_decr,
325 .progress = udbg_progress,
326};
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_pcie.c b/arch/powerpc/platforms/86xx/mpc86xx_pcie.c
new file mode 100644
index 000000000000..a2f4f730213e
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/mpc86xx_pcie.c
@@ -0,0 +1,173 @@
1/*
2 * Support for indirect PCI bridges.
3 *
4 * Copyright (C) 1998 Gabriel Paubert.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * "Temporary" MPC8548 Errata file -
12 * The standard indirect_pci code should work with future silicon versions.
13 */
14
15#include <linux/kernel.h>
16#include <linux/pci.h>
17#include <linux/delay.h>
18#include <linux/string.h>
19#include <linux/init.h>
20#include <linux/bootmem.h>
21
22#include <asm/io.h>
23#include <asm/prom.h>
24#include <asm/pci-bridge.h>
25#include <asm/machdep.h>
26
27#include "mpc86xx.h"
28
29#define PCI_CFG_OUT out_be32
30
31/* ERRATA PCI-Ex 14 PCIE Controller timeout */
32#define PCIE_FIX out_be32(hose->cfg_addr+0x4, 0x0400ffff)
33
34
35static int
36indirect_read_config_pcie(struct pci_bus *bus, unsigned int devfn, int offset,
37 int len, u32 *val)
38{
39 struct pci_controller *hose = bus->sysdata;
40 volatile void __iomem *cfg_data;
41 u32 temp;
42
43 if (ppc_md.pci_exclude_device)
44 if (ppc_md.pci_exclude_device(bus->number, devfn))
45 return PCIBIOS_DEVICE_NOT_FOUND;
46
47 /* Possible artifact of CDCpp50937 needs further investigation */
48 if (devfn != 0x0 && bus->number == 0xff)
49 return PCIBIOS_DEVICE_NOT_FOUND;
50
51 PCIE_FIX;
52 if (bus->number == 0xff) {
53 PCI_CFG_OUT(hose->cfg_addr,
54 (0x80000000 | ((offset & 0xf00) << 16) |
55 ((bus->number - hose->bus_offset) << 16)
56 | (devfn << 8) | ((offset & 0xfc) )));
57 } else {
58 PCI_CFG_OUT(hose->cfg_addr,
59 (0x80000001 | ((offset & 0xf00) << 16) |
60 ((bus->number - hose->bus_offset) << 16)
61 | (devfn << 8) | ((offset & 0xfc) )));
62 }
63
64 /*
65 * Note: the caller has already checked that offset is
66 * suitably aligned and that len is 1, 2 or 4.
67 */
68 /* ERRATA PCI-Ex 12 - Configuration Address/Data Alignment */
69 cfg_data = hose->cfg_data;
70 PCIE_FIX;
71 temp = in_le32(cfg_data);
72 switch (len) {
73 case 1:
74 *val = (temp >> (((offset & 3))*8)) & 0xff;
75 break;
76 case 2:
77 *val = (temp >> (((offset & 3))*8)) & 0xffff;
78 break;
79 default:
80 *val = temp;
81 break;
82 }
83 return PCIBIOS_SUCCESSFUL;
84}
85
86static int
87indirect_write_config_pcie(struct pci_bus *bus, unsigned int devfn, int offset,
88 int len, u32 val)
89{
90 struct pci_controller *hose = bus->sysdata;
91 volatile void __iomem *cfg_data;
92 u32 temp;
93
94 if (ppc_md.pci_exclude_device)
95 if (ppc_md.pci_exclude_device(bus->number, devfn))
96 return PCIBIOS_DEVICE_NOT_FOUND;
97
98 /* Possible artifact of CDCpp50937 needs further investigation */
99 if (devfn != 0x0 && bus->number == 0xff)
100 return PCIBIOS_DEVICE_NOT_FOUND;
101
102 PCIE_FIX;
103 if (bus->number == 0xff) {
104 PCI_CFG_OUT(hose->cfg_addr,
105 (0x80000000 | ((offset & 0xf00) << 16) |
106 ((bus->number - hose->bus_offset) << 16)
107 | (devfn << 8) | ((offset & 0xfc) )));
108 } else {
109 PCI_CFG_OUT(hose->cfg_addr,
110 (0x80000001 | ((offset & 0xf00) << 16) |
111 ((bus->number - hose->bus_offset) << 16)
112 | (devfn << 8) | ((offset & 0xfc) )));
113 }
114
115 /*
116 * Note: the caller has already checked that offset is
117 * suitably aligned and that len is 1, 2 or 4.
118 */
119 /* ERRATA PCI-Ex 12 - Configuration Address/Data Alignment */
120 cfg_data = hose->cfg_data;
121 switch (len) {
122 case 1:
123 PCIE_FIX;
124 temp = in_le32(cfg_data);
125 temp = (temp & ~(0xff << ((offset & 3) * 8))) |
126 (val << ((offset & 3) * 8));
127 PCIE_FIX;
128 out_le32(cfg_data, temp);
129 break;
130 case 2:
131 PCIE_FIX;
132 temp = in_le32(cfg_data);
133 temp = (temp & ~(0xffff << ((offset & 3) * 8)));
134 temp |= (val << ((offset & 3) * 8)) ;
135 PCIE_FIX;
136 out_le32(cfg_data, temp);
137 break;
138 default:
139 PCIE_FIX;
140 out_le32(cfg_data, val);
141 break;
142 }
143 PCIE_FIX;
144 return PCIBIOS_SUCCESSFUL;
145}
146
147static struct pci_ops indirect_pcie_ops = {
148 indirect_read_config_pcie,
149 indirect_write_config_pcie
150};
151
152void __init
153setup_indirect_pcie_nomap(struct pci_controller* hose, void __iomem * cfg_addr,
154 void __iomem * cfg_data)
155{
156 hose->cfg_addr = cfg_addr;
157 hose->cfg_data = cfg_data;
158 hose->ops = &indirect_pcie_ops;
159}
160
161void __init
162setup_indirect_pcie(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
163{
164 unsigned long base = cfg_addr & PAGE_MASK;
165 void __iomem *mbase, *addr, *data;
166
167 mbase = ioremap(base, PAGE_SIZE);
168 addr = mbase + (cfg_addr & ~PAGE_MASK);
169 if ((cfg_data & PAGE_MASK) != base)
170 mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE);
171 data = mbase + (cfg_data & ~PAGE_MASK);
172 setup_indirect_pcie_nomap(hose, addr, data);
173}
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
new file mode 100644
index 000000000000..944ec4b71416
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
@@ -0,0 +1,117 @@
1/*
2 * Author: Xianghua Xiao <x.xiao@freescale.com>
3 * Zhang Wei <wei.zhang@freescale.com>
4 *
5 * Copyright 2006 Freescale Semiconductor Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/config.h>
14#include <linux/stddef.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/delay.h>
18
19#include <asm/pgtable.h>
20#include <asm/page.h>
21#include <asm/pci-bridge.h>
22#include <asm-powerpc/mpic.h>
23#include <asm/mpc86xx.h>
24#include <asm/cacheflush.h>
25
26#include <sysdev/fsl_soc.h>
27
28#include "mpc86xx.h"
29
30extern void __secondary_start_mpc86xx(void);
31extern unsigned long __secondary_hold_acknowledge;
32
33
34static void __init
35smp_86xx_release_core(int nr)
36{
37 void *mcm_vaddr;
38 unsigned long vaddr, pcr;
39
40 if (nr < 0 || nr >= NR_CPUS)
41 return;
42
43 /*
44 * Startup Core #nr.
45 */
46 mcm_vaddr = ioremap(get_immrbase() + MPC86xx_MCM_OFFSET,
47 MPC86xx_MCM_SIZE);
48 vaddr = (unsigned long)mcm_vaddr + MCM_PORT_CONFIG_OFFSET;
49 pcr = in_be32((volatile unsigned *)vaddr);
50 pcr |= 1 << (nr + 24);
51 out_be32((volatile unsigned *)vaddr, pcr);
52}
53
54
55static void __init
56smp_86xx_kick_cpu(int nr)
57{
58 unsigned int save_vector;
59 unsigned long target, flags;
60 int n = 0;
61 volatile unsigned int *vector
62 = (volatile unsigned int *)(KERNELBASE + 0x100);
63
64 if (nr < 0 || nr >= NR_CPUS)
65 return;
66
67 pr_debug("smp_86xx_kick_cpu: kick CPU #%d\n", nr);
68
69 local_irq_save(flags);
70 local_irq_disable();
71
72 /* Save reset vector */
73 save_vector = *vector;
74
75 /* Setup fake reset vector to call __secondary_start_mpc86xx. */
76 target = (unsigned long) __secondary_start_mpc86xx;
77 create_branch((unsigned long)vector, target, BRANCH_SET_LINK);
78
79 /* Kick that CPU */
80 smp_86xx_release_core(nr);
81
82 /* Wait a bit for the CPU to take the exception. */
83 while ((__secondary_hold_acknowledge != nr) && (n++, n < 1000))
84 mdelay(1);
85
86 /* Restore the exception vector */
87 *vector = save_vector;
88 flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
89
90 local_irq_restore(flags);
91
92 pr_debug("wait CPU #%d for %d msecs.\n", nr, n);
93}
94
95
96static void __init
97smp_86xx_setup_cpu(int cpu_nr)
98{
99 mpic_setup_this_cpu();
100}
101
102
103struct smp_ops_t smp_86xx_ops = {
104 .message_pass = smp_mpic_message_pass,
105 .probe = smp_mpic_probe,
106 .kick_cpu = smp_86xx_kick_cpu,
107 .setup_cpu = smp_86xx_setup_cpu,
108 .take_timebase = smp_generic_take_timebase,
109 .give_timebase = smp_generic_give_timebase,
110};
111
112
113void __init
114mpc86xx_smp_init(void)
115{
116 smp_ops = &smp_86xx_ops;
117}
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c
new file mode 100644
index 000000000000..5180df7c75bc
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/pci.c
@@ -0,0 +1,325 @@
1/*
2 * MPC86XX pci setup code
3 *
4 * Recode: ZHANG WEI <wei.zhang@freescale.com>
5 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
6 *
7 * Copyright 2006 Freescale Semiconductor Inc.
8 *
9 * 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
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/config.h>
16#include <linux/types.h>
17#include <linux/module.h>
18#include <linux/init.h>
19#include <linux/pci.h>
20#include <linux/serial.h>
21
22#include <asm/system.h>
23#include <asm/atomic.h>
24#include <asm/io.h>
25#include <asm/prom.h>
26#include <asm/immap_86xx.h>
27#include <asm/pci-bridge.h>
28#include <sysdev/fsl_soc.h>
29
30#include "mpc86xx.h"
31
32#undef DEBUG
33
34#ifdef DEBUG
35#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
36#else
37#define DBG(fmt, args...)
38#endif
39
40struct pcie_outbound_window_regs {
41 uint pexotar; /* 0x.0 - PCI Express outbound translation address register */
42 uint pexotear; /* 0x.4 - PCI Express outbound translation extended address register */
43 uint pexowbar; /* 0x.8 - PCI Express outbound window base address register */
44 char res1[4];
45 uint pexowar; /* 0x.10 - PCI Express outbound window attributes register */
46 char res2[12];
47};
48
49struct pcie_inbound_window_regs {
50 uint pexitar; /* 0x.0 - PCI Express inbound translation address register */
51 char res1[4];
52 uint pexiwbar; /* 0x.8 - PCI Express inbound window base address register */
53 uint pexiwbear; /* 0x.c - PCI Express inbound window base extended address register */
54 uint pexiwar; /* 0x.10 - PCI Express inbound window attributes register */
55 char res2[12];
56};
57
58static void __init setup_pcie_atmu(struct pci_controller *hose, struct resource *rsrc)
59{
60 volatile struct ccsr_pex *pcie;
61 volatile struct pcie_outbound_window_regs *pcieow;
62 volatile struct pcie_inbound_window_regs *pcieiw;
63 int i = 0;
64
65 DBG("PCIE memory map start 0x%x, size 0x%x\n", rsrc->start,
66 rsrc->end - rsrc->start + 1);
67 pcie = ioremap(rsrc->start, rsrc->end - rsrc->start + 1);
68
69 /* Disable all windows (except pexowar0 since its ignored) */
70 pcie->pexowar1 = 0;
71 pcie->pexowar2 = 0;
72 pcie->pexowar3 = 0;
73 pcie->pexowar4 = 0;
74 pcie->pexiwar1 = 0;
75 pcie->pexiwar2 = 0;
76 pcie->pexiwar3 = 0;
77
78 pcieow = (struct pcie_outbound_window_regs *)&pcie->pexotar1;
79 pcieiw = (struct pcie_inbound_window_regs *)&pcie->pexitar1;
80
81 /* Setup outbound MEM window */
82 for(i = 0; i < 3; i++)
83 if (hose->mem_resources[i].flags & IORESOURCE_MEM){
84 DBG("PCIE MEM resource start 0x%08x, size 0x%08x.\n",
85 hose->mem_resources[i].start,
86 hose->mem_resources[i].end
87 - hose->mem_resources[i].start + 1);
88 pcieow->pexotar = (hose->mem_resources[i].start) >> 12
89 & 0x000fffff;
90 pcieow->pexotear = 0;
91 pcieow->pexowbar = (hose->mem_resources[i].start) >> 12
92 & 0x000fffff;
93 /* Enable, Mem R/W */
94 pcieow->pexowar = 0x80044000 |
95 (__ilog2(hose->mem_resources[i].end
96 - hose->mem_resources[i].start + 1)
97 - 1);
98 pcieow++;
99 }
100
101 /* Setup outbound IO window */
102 if (hose->io_resource.flags & IORESOURCE_IO){
103 DBG("PCIE IO resource start 0x%08x, size 0x%08x, phy base 0x%08x.\n",
104 hose->io_resource.start,
105 hose->io_resource.end - hose->io_resource.start + 1,
106 hose->io_base_phys);
107 pcieow->pexotar = (hose->io_resource.start) >> 12 & 0x000fffff;
108 pcieow->pexotear = 0;
109 pcieow->pexowbar = (hose->io_base_phys) >> 12 & 0x000fffff;
110 /* Enable, IO R/W */
111 pcieow->pexowar = 0x80088000 | (__ilog2(hose->io_resource.end
112 - hose->io_resource.start + 1) - 1);
113 }
114
115 /* Setup 2G inbound Memory Window @ 0 */
116 pcieiw->pexitar = 0x00000000;
117 pcieiw->pexiwbar = 0x00000000;
118 /* Enable, Prefetch, Local Mem, Snoop R/W, 2G */
119 pcieiw->pexiwar = 0xa0f5501e;
120}
121
122static void __init
123mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
124{
125 volatile struct ccsr_pex *pcie;
126 u16 cmd;
127 unsigned int temps;
128
129 DBG("PCIE host controller register offset 0x%08x, size 0x%08x.\n",
130 pcie_offset, pcie_size);
131
132 pcie = ioremap(pcie_offset, pcie_size);
133
134 early_read_config_word(hose, 0, 0, PCI_COMMAND, &cmd);
135 cmd |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY
136 | PCI_COMMAND_IO;
137 early_write_config_word(hose, 0, 0, PCI_COMMAND, cmd);
138
139 early_write_config_byte(hose, 0, 0, PCI_LATENCY_TIMER, 0x80);
140
141 /* PCIE Bus, Fix the MPC8641D host bridge's location to bus 0xFF. */
142 early_read_config_dword(hose, 0, 0, PCI_PRIMARY_BUS, &temps);
143 temps = (temps & 0xff000000) | (0xff) | (0x0 << 8) | (0xfe << 16);
144 early_write_config_dword(hose, 0, 0, PCI_PRIMARY_BUS, temps);
145}
146
147int __init add_bridge(struct device_node *dev)
148{
149 int len;
150 struct pci_controller *hose;
151 struct resource rsrc;
152 int *bus_range;
153 int has_address = 0;
154 int primary = 0;
155
156 DBG("Adding PCIE host bridge %s\n", dev->full_name);
157
158 /* Fetch host bridge registers address */
159 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
160
161 /* Get bus range if any */
162 bus_range = (int *) get_property(dev, "bus-range", &len);
163 if (bus_range == NULL || len < 2 * sizeof(int))
164 printk(KERN_WARNING "Can't get bus-range for %s, assume"
165 " bus 0\n", dev->full_name);
166
167 hose = pcibios_alloc_controller();
168 if (!hose)
169 return -ENOMEM;
170 hose->arch_data = dev;
171 hose->set_cfg_type = 1;
172
173 /* last_busno = 0xfe cause by MPC8641 PCIE bug */
174 hose->first_busno = bus_range ? bus_range[0] : 0x0;
175 hose->last_busno = bus_range ? bus_range[1] : 0xfe;
176
177 setup_indirect_pcie(hose, rsrc.start, rsrc.start + 0x4);
178
179 /* Setup the PCIE host controller. */
180 mpc86xx_setup_pcie(hose, rsrc.start, rsrc.end - rsrc.start + 1);
181
182 if ((rsrc.start & 0xfffff) == 0x8000)
183 primary = 1;
184
185 printk(KERN_INFO "Found MPC86xx PCIE host bridge at 0x%08lx. "
186 "Firmware bus number: %d->%d\n",
187 rsrc.start, hose->first_busno, hose->last_busno);
188
189 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
190 hose, hose->cfg_addr, hose->cfg_data);
191
192 /* Interpret the "ranges" property */
193 /* This also maps the I/O region and sets isa_io/mem_base */
194 pci_process_bridge_OF_ranges(hose, dev, primary);
195
196 /* Setup PEX window registers */
197 setup_pcie_atmu(hose, &rsrc);
198
199 return 0;
200}
201
202static void __devinit quirk_ali1575(struct pci_dev *dev)
203{
204 unsigned short temp;
205
206 /*
207 * ALI1575 interrupts route table setup:
208 *
209 * IRQ pin IRQ#
210 * PIRQA ---- 3
211 * PIRQB ---- 4
212 * PIRQC ---- 5
213 * PIRQD ---- 6
214 * PIRQE ---- 9
215 * PIRQF ---- 10
216 * PIRQG ---- 11
217 * PIRQH ---- 12
218 *
219 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
220 * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
221 */
222 pci_write_config_dword(dev, 0x48, 0xb9317542);
223
224 /* USB 1.1 OHCI controller 1, interrupt: PIRQE */
225 pci_write_config_byte(dev, 0x86, 0x0c);
226
227 /* USB 1.1 OHCI controller 2, interrupt: PIRQF */
228 pci_write_config_byte(dev, 0x87, 0x0d);
229
230 /* USB 1.1 OHCI controller 3, interrupt: PIRQH */
231 pci_write_config_byte(dev, 0x88, 0x0f);
232
233 /* USB 2.0 controller, interrupt: PIRQ7 */
234 pci_write_config_byte(dev, 0x74, 0x06);
235
236 /* Audio controller, interrupt: PIRQE */
237 pci_write_config_byte(dev, 0x8a, 0x0c);
238
239 /* Modem controller, interrupt: PIRQF */
240 pci_write_config_byte(dev, 0x8b, 0x0d);
241
242 /* HD audio controller, interrupt: PIRQG */
243 pci_write_config_byte(dev, 0x8c, 0x0e);
244
245 /* Serial ATA interrupt: PIRQD */
246 pci_write_config_byte(dev, 0x8d, 0x0b);
247
248 /* SMB interrupt: PIRQH */
249 pci_write_config_byte(dev, 0x8e, 0x0f);
250
251 /* PMU ACPI SCI interrupt: PIRQH */
252 pci_write_config_byte(dev, 0x8f, 0x0f);
253
254 /* Primary PATA IDE IRQ: 14
255 * Secondary PATA IDE IRQ: 15
256 */
257 pci_write_config_byte(dev, 0x44, 0x3d);
258 pci_write_config_byte(dev, 0x75, 0x0f);
259
260 /* Set IRQ14 and IRQ15 to legacy IRQs */
261 pci_read_config_word(dev, 0x46, &temp);
262 temp |= 0xc000;
263 pci_write_config_word(dev, 0x46, temp);
264
265 /* Set i8259 interrupt trigger
266 * IRQ 3: Level
267 * IRQ 4: Level
268 * IRQ 5: Level
269 * IRQ 6: Level
270 * IRQ 7: Level
271 * IRQ 9: Level
272 * IRQ 10: Level
273 * IRQ 11: Level
274 * IRQ 12: Level
275 * IRQ 14: Edge
276 * IRQ 15: Edge
277 */
278 outb(0xfa, 0x4d0);
279 outb(0x1e, 0x4d1);
280}
281
282static void __devinit quirk_uli5288(struct pci_dev *dev)
283{
284 unsigned char c;
285
286 pci_read_config_byte(dev,0x83,&c);
287 c |= 0x80;
288 pci_write_config_byte(dev, 0x83, c);
289
290 pci_write_config_byte(dev, 0x09, 0x01);
291 pci_write_config_byte(dev, 0x0a, 0x06);
292
293 pci_read_config_byte(dev,0x83,&c);
294 c &= 0x7f;
295 pci_write_config_byte(dev, 0x83, c);
296
297 pci_read_config_byte(dev,0x84,&c);
298 c |= 0x01;
299 pci_write_config_byte(dev, 0x84, c);
300}
301
302static void __devinit quirk_uli5229(struct pci_dev *dev)
303{
304 unsigned short temp;
305 pci_write_config_word(dev, 0x04, 0x0405);
306 pci_read_config_word(dev, 0x4a, &temp);
307 temp |= 0x1000;
308 pci_write_config_word(dev, 0x4a, temp);
309}
310
311static void __devinit early_uli5249(struct pci_dev *dev)
312{
313 unsigned char temp;
314 pci_write_config_word(dev, 0x04, 0x0007);
315 pci_read_config_byte(dev, 0x7c, &temp);
316 pci_write_config_byte(dev, 0x7c, 0x80);
317 pci_write_config_byte(dev, 0x09, 0x01);
318 pci_write_config_byte(dev, 0x7c, temp);
319 dev->class |= 0x1;
320}
321
322DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575);
323DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
324DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
325DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index c4f6b0d2d140..292863694562 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_PPC_CHRP) += chrp/
9obj-$(CONFIG_4xx) += 4xx/ 9obj-$(CONFIG_4xx) += 4xx/
10obj-$(CONFIG_PPC_83xx) += 83xx/ 10obj-$(CONFIG_PPC_83xx) += 83xx/
11obj-$(CONFIG_PPC_85xx) += 85xx/ 11obj-$(CONFIG_PPC_85xx) += 85xx/
12obj-$(CONFIG_PPC_86xx) += 86xx/
12obj-$(CONFIG_PPC_PSERIES) += pseries/ 13obj-$(CONFIG_PPC_PSERIES) += pseries/
13obj-$(CONFIG_PPC_ISERIES) += iseries/ 14obj-$(CONFIG_PPC_ISERIES) += iseries/
14obj-$(CONFIG_PPC_MAPLE) += maple/ 15obj-$(CONFIG_PPC_MAPLE) += maple/
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 6a02d51086c8..352bbbacde9a 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -5,15 +5,24 @@ config SPU_FS
5 tristate "SPU file system" 5 tristate "SPU file system"
6 default m 6 default m
7 depends on PPC_CELL 7 depends on PPC_CELL
8 select SPU_BASE
8 help 9 help
9 The SPU file system is used to access Synergistic Processing 10 The SPU file system is used to access Synergistic Processing
10 Units on machines implementing the Broadband Processor 11 Units on machines implementing the Broadband Processor
11 Architecture. 12 Architecture.
12 13
14config SPU_BASE
15 bool
16 default n
17
13config SPUFS_MMAP 18config SPUFS_MMAP
14 bool 19 bool
15 depends on SPU_FS && SPARSEMEM 20 depends on SPU_FS && SPARSEMEM
16 select MEMORY_HOTPLUG 21 select MEMORY_HOTPLUG
17 default y 22 default y
18 23
24config CBE_RAS
25 bool "RAS features for bare metal Cell BE"
26 default y
27
19endmenu 28endmenu
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index e570bad06394..c89cdd67383b 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -1,16 +1,15 @@
1obj-y += interrupt.o iommu.o setup.o spider-pic.o 1obj-$(CONFIG_PPC_CELL_NATIVE) += interrupt.o iommu.o setup.o \
2obj-y += pervasive.o 2 cbe_regs.o spider-pic.o pervasive.o
3obj-$(CONFIG_CBE_RAS) += ras.o
3 4
4obj-$(CONFIG_SMP) += smp.o 5ifeq ($(CONFIG_SMP),y)
5obj-$(CONFIG_SPU_FS) += spu-base.o spufs/ 6obj-$(CONFIG_PPC_CELL_NATIVE) += smp.o
6 7endif
7spu-base-y += spu_base.o spu_priv1.o
8 8
9# needed only when building loadable spufs.ko 9# needed only when building loadable spufs.ko
10spufs-modular-$(CONFIG_SPU_FS) += spu_syscalls.o 10spufs-modular-$(CONFIG_SPU_FS) += spu_syscalls.o
11obj-y += $(spufs-modular-m) 11spu-priv1-$(CONFIG_PPC_CELL_NATIVE) += spu_priv1_mmio.o
12
13# always needed in kernel
14spufs-builtin-$(CONFIG_SPU_FS) += spu_callbacks.o
15obj-y += $(spufs-builtin-y) $(spufs-builtin-m)
16 12
13obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
14 $(spufs-modular-m) \
15 $(spu-priv1-y) spufs/
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platforms/cell/cbe_regs.c
new file mode 100644
index 000000000000..2dfde61c8412
--- /dev/null
+++ b/arch/powerpc/platforms/cell/cbe_regs.c
@@ -0,0 +1,128 @@
1/*
2 * cbe_regs.c
3 *
4 * Accessor routines for the various MMIO register blocks of the CBE
5 *
6 * (c) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
7 */
8
9
10#include <linux/config.h>
11#include <linux/percpu.h>
12#include <linux/types.h>
13
14#include <asm/io.h>
15#include <asm/pgtable.h>
16#include <asm/prom.h>
17#include <asm/ptrace.h>
18
19#include "cbe_regs.h"
20
21#define MAX_CBE 2
22
23/*
24 * Current implementation uses "cpu" nodes. We build our own mapping
25 * array of cpu numbers to cpu nodes locally for now to allow interrupt
26 * time code to have a fast path rather than call of_get_cpu_node(). If
27 * we implement cpu hotplug, we'll have to install an appropriate norifier
28 * in order to release references to the cpu going away
29 */
30static struct cbe_regs_map
31{
32 struct device_node *cpu_node;
33 struct cbe_pmd_regs __iomem *pmd_regs;
34 struct cbe_iic_regs __iomem *iic_regs;
35} cbe_regs_maps[MAX_CBE];
36static int cbe_regs_map_count;
37
38static struct cbe_thread_map
39{
40 struct device_node *cpu_node;
41 struct cbe_regs_map *regs;
42} cbe_thread_map[NR_CPUS];
43
44static struct cbe_regs_map *cbe_find_map(struct device_node *np)
45{
46 int i;
47
48 for (i = 0; i < cbe_regs_map_count; i++)
49 if (cbe_regs_maps[i].cpu_node == np)
50 return &cbe_regs_maps[i];
51 return NULL;
52}
53
54struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np)
55{
56 struct cbe_regs_map *map = cbe_find_map(np);
57 if (map == NULL)
58 return NULL;
59 return map->pmd_regs;
60}
61
62struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu)
63{
64 struct cbe_regs_map *map = cbe_thread_map[cpu].regs;
65 if (map == NULL)
66 return NULL;
67 return map->pmd_regs;
68}
69
70
71struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np)
72{
73 struct cbe_regs_map *map = cbe_find_map(np);
74 if (map == NULL)
75 return NULL;
76 return map->iic_regs;
77}
78struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu)
79{
80 struct cbe_regs_map *map = cbe_thread_map[cpu].regs;
81 if (map == NULL)
82 return NULL;
83 return map->iic_regs;
84}
85
86void __init cbe_regs_init(void)
87{
88 int i;
89 struct device_node *cpu;
90
91 /* Build local fast map of CPUs */
92 for_each_cpu(i)
93 cbe_thread_map[i].cpu_node = of_get_cpu_node(i, NULL);
94
95 /* Find maps for each device tree CPU */
96 for_each_node_by_type(cpu, "cpu") {
97 struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++];
98
99 /* That hack must die die die ! */
100 struct address_prop {
101 unsigned long address;
102 unsigned int len;
103 } __attribute__((packed)) *prop;
104
105
106 if (cbe_regs_map_count > MAX_CBE) {
107 printk(KERN_ERR "cbe_regs: More BE chips than supported"
108 "!\n");
109 cbe_regs_map_count--;
110 return;
111 }
112 map->cpu_node = cpu;
113 for_each_cpu(i)
114 if (cbe_thread_map[i].cpu_node == cpu)
115 cbe_thread_map[i].regs = map;
116
117 prop = (struct address_prop *)get_property(cpu, "pervasive",
118 NULL);
119 if (prop != NULL)
120 map->pmd_regs = ioremap(prop->address, prop->len);
121
122 prop = (struct address_prop *)get_property(cpu, "iic",
123 NULL);
124 if (prop != NULL)
125 map->iic_regs = ioremap(prop->address, prop->len);
126 }
127}
128
diff --git a/arch/powerpc/platforms/cell/cbe_regs.h b/arch/powerpc/platforms/cell/cbe_regs.h
new file mode 100644
index 000000000000..e76e4a6af5bc
--- /dev/null
+++ b/arch/powerpc/platforms/cell/cbe_regs.h
@@ -0,0 +1,129 @@
1/*
2 * cbe_regs.h
3 *
4 * This file is intended to hold the various register definitions for CBE
5 * on-chip system devices (memory controller, IO controller, etc...)
6 *
7 * (c) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
8 */
9
10#ifndef CBE_REGS_H
11#define CBE_REGS_H
12
13/*
14 *
15 * Some HID register definitions
16 *
17 */
18
19/* CBE specific HID0 bits */
20#define HID0_CBE_THERM_WAKEUP 0x0000020000000000ul
21#define HID0_CBE_SYSERR_WAKEUP 0x0000008000000000ul
22#define HID0_CBE_THERM_INT_EN 0x0000000400000000ul
23#define HID0_CBE_SYSERR_INT_EN 0x0000000200000000ul
24
25
26/*
27 *
28 * Pervasive unit register definitions
29 *
30 */
31
32struct cbe_pmd_regs {
33 u8 pad_0x0000_0x0800[0x0800 - 0x0000]; /* 0x0000 */
34
35 /* Thermal Sensor Registers */
36 u64 ts_ctsr1; /* 0x0800 */
37 u64 ts_ctsr2; /* 0x0808 */
38 u64 ts_mtsr1; /* 0x0810 */
39 u64 ts_mtsr2; /* 0x0818 */
40 u64 ts_itr1; /* 0x0820 */
41 u64 ts_itr2; /* 0x0828 */
42 u64 ts_gitr; /* 0x0830 */
43 u64 ts_isr; /* 0x0838 */
44 u64 ts_imr; /* 0x0840 */
45 u64 tm_cr1; /* 0x0848 */
46 u64 tm_cr2; /* 0x0850 */
47 u64 tm_simr; /* 0x0858 */
48 u64 tm_tpr; /* 0x0860 */
49 u64 tm_str1; /* 0x0868 */
50 u64 tm_str2; /* 0x0870 */
51 u64 tm_tsr; /* 0x0878 */
52
53 /* Power Management */
54 u64 pm_control; /* 0x0880 */
55#define CBE_PMD_PAUSE_ZERO_CONTROL 0x10000
56 u64 pm_status; /* 0x0888 */
57
58 /* Time Base Register */
59 u64 tbr; /* 0x0890 */
60
61 u8 pad_0x0898_0x0c00 [0x0c00 - 0x0898]; /* 0x0898 */
62
63 /* Fault Isolation Registers */
64 u64 checkstop_fir; /* 0x0c00 */
65 u64 recoverable_fir;
66 u64 spec_att_mchk_fir;
67 u64 fir_mode_reg;
68 u64 fir_enable_mask;
69
70 u8 pad_0x0c28_0x1000 [0x1000 - 0x0c28]; /* 0x0c28 */
71};
72
73extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np);
74extern struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu);
75
76/*
77 *
78 * IIC unit register definitions
79 *
80 */
81
82struct cbe_iic_pending_bits {
83 u32 data;
84 u8 flags;
85 u8 class;
86 u8 source;
87 u8 prio;
88};
89
90#define CBE_IIC_IRQ_VALID 0x80
91#define CBE_IIC_IRQ_IPI 0x40
92
93struct cbe_iic_thread_regs {
94 struct cbe_iic_pending_bits pending;
95 struct cbe_iic_pending_bits pending_destr;
96 u64 generate;
97 u64 prio;
98};
99
100struct cbe_iic_regs {
101 u8 pad_0x0000_0x0400[0x0400 - 0x0000]; /* 0x0000 */
102
103 /* IIC interrupt registers */
104 struct cbe_iic_thread_regs thread[2]; /* 0x0400 */
105 u64 iic_ir; /* 0x0440 */
106 u64 iic_is; /* 0x0448 */
107
108 u8 pad_0x0450_0x0500[0x0500 - 0x0450]; /* 0x0450 */
109
110 /* IOC FIR */
111 u64 ioc_fir_reset; /* 0x0500 */
112 u64 ioc_fir_set;
113 u64 ioc_checkstop_enable;
114 u64 ioc_fir_error_mask;
115 u64 ioc_syserr_enable;
116 u64 ioc_fir;
117
118 u8 pad_0x0530_0x1000[0x1000 - 0x0530]; /* 0x0530 */
119};
120
121extern struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np);
122extern struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu);
123
124
125/* Init this module early */
126extern void cbe_regs_init(void);
127
128
129#endif /* CBE_REGS_H */
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 978be1c30c1b..f4e2d8805c9e 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -33,29 +33,10 @@
33#include <asm/ptrace.h> 33#include <asm/ptrace.h>
34 34
35#include "interrupt.h" 35#include "interrupt.h"
36 36#include "cbe_regs.h"
37struct iic_pending_bits {
38 u32 data;
39 u8 flags;
40 u8 class;
41 u8 source;
42 u8 prio;
43};
44
45enum iic_pending_flags {
46 IIC_VALID = 0x80,
47 IIC_IPI = 0x40,
48};
49
50struct iic_regs {
51 struct iic_pending_bits pending;
52 struct iic_pending_bits pending_destr;
53 u64 generate;
54 u64 prio;
55};
56 37
57struct iic { 38struct iic {
58 struct iic_regs __iomem *regs; 39 struct cbe_iic_thread_regs __iomem *regs;
59 u8 target_id; 40 u8 target_id;
60}; 41};
61 42
@@ -115,7 +96,7 @@ static struct hw_interrupt_type iic_pic = {
115 .end = iic_end, 96 .end = iic_end,
116}; 97};
117 98
118static int iic_external_get_irq(struct iic_pending_bits pending) 99static int iic_external_get_irq(struct cbe_iic_pending_bits pending)
119{ 100{
120 int irq; 101 int irq;
121 unsigned char node, unit; 102 unsigned char node, unit;
@@ -136,8 +117,7 @@ static int iic_external_get_irq(struct iic_pending_bits pending)
136 * One of these units can be connected 117 * One of these units can be connected
137 * to an external interrupt controller. 118 * to an external interrupt controller.
138 */ 119 */
139 if (pending.prio > 0x3f || 120 if (pending.class != 2)
140 pending.class != 2)
141 break; 121 break;
142 irq = IIC_EXT_OFFSET 122 irq = IIC_EXT_OFFSET
143 + spider_get_irq(node) 123 + spider_get_irq(node)
@@ -168,15 +148,15 @@ int iic_get_irq(struct pt_regs *regs)
168{ 148{
169 struct iic *iic; 149 struct iic *iic;
170 int irq; 150 int irq;
171 struct iic_pending_bits pending; 151 struct cbe_iic_pending_bits pending;
172 152
173 iic = &__get_cpu_var(iic); 153 iic = &__get_cpu_var(iic);
174 *(unsigned long *) &pending = 154 *(unsigned long *) &pending =
175 in_be64((unsigned long __iomem *) &iic->regs->pending_destr); 155 in_be64((unsigned long __iomem *) &iic->regs->pending_destr);
176 156
177 irq = -1; 157 irq = -1;
178 if (pending.flags & IIC_VALID) { 158 if (pending.flags & CBE_IIC_IRQ_VALID) {
179 if (pending.flags & IIC_IPI) { 159 if (pending.flags & CBE_IIC_IRQ_IPI) {
180 irq = IIC_IPI_OFFSET + (pending.prio >> 4); 160 irq = IIC_IPI_OFFSET + (pending.prio >> 4);
181/* 161/*
182 if (irq > 0x80) 162 if (irq > 0x80)
@@ -226,7 +206,7 @@ static int setup_iic_hardcoded(void)
226 regs += 0x20; 206 regs += 0x20;
227 207
228 printk(KERN_INFO "IIC for CPU %d at %lx\n", cpu, regs); 208 printk(KERN_INFO "IIC for CPU %d at %lx\n", cpu, regs);
229 iic->regs = ioremap(regs, sizeof(struct iic_regs)); 209 iic->regs = ioremap(regs, sizeof(struct cbe_iic_thread_regs));
230 iic->target_id = (nodeid << 4) + ((cpu & 1) ? 0xf : 0xe); 210 iic->target_id = (nodeid << 4) + ((cpu & 1) ? 0xf : 0xe);
231 } 211 }
232 212
@@ -267,12 +247,12 @@ static int setup_iic(void)
267 } 247 }
268 248
269 iic = &per_cpu(iic, np[0]); 249 iic = &per_cpu(iic, np[0]);
270 iic->regs = ioremap(regs[0], sizeof(struct iic_regs)); 250 iic->regs = ioremap(regs[0], sizeof(struct cbe_iic_thread_regs));
271 iic->target_id = ((np[0] & 2) << 3) + ((np[0] & 1) ? 0xf : 0xe); 251 iic->target_id = ((np[0] & 2) << 3) + ((np[0] & 1) ? 0xf : 0xe);
272 printk("IIC for CPU %d at %lx mapped to %p\n", np[0], regs[0], iic->regs); 252 printk("IIC for CPU %d at %lx mapped to %p\n", np[0], regs[0], iic->regs);
273 253
274 iic = &per_cpu(iic, np[1]); 254 iic = &per_cpu(iic, np[1]);
275 iic->regs = ioremap(regs[2], sizeof(struct iic_regs)); 255 iic->regs = ioremap(regs[2], sizeof(struct cbe_iic_thread_regs));
276 iic->target_id = ((np[1] & 2) << 3) + ((np[1] & 1) ? 0xf : 0xe); 256 iic->target_id = ((np[1] & 2) << 3) + ((np[1] & 1) ? 0xf : 0xe);
277 printk("IIC for CPU %d at %lx mapped to %p\n", np[1], regs[2], iic->regs); 257 printk("IIC for CPU %d at %lx mapped to %p\n", np[1], regs[2], iic->regs);
278 258
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index a49ceb799a8e..a35004e14c69 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -473,6 +473,16 @@ static int cell_dma_supported(struct device *dev, u64 mask)
473 return mask < 0x100000000ull; 473 return mask < 0x100000000ull;
474} 474}
475 475
476static struct dma_mapping_ops cell_iommu_ops = {
477 .alloc_coherent = cell_alloc_coherent,
478 .free_coherent = cell_free_coherent,
479 .map_single = cell_map_single,
480 .unmap_single = cell_unmap_single,
481 .map_sg = cell_map_sg,
482 .unmap_sg = cell_unmap_sg,
483 .dma_supported = cell_dma_supported,
484};
485
476void cell_init_iommu(void) 486void cell_init_iommu(void)
477{ 487{
478 int setup_bus = 0; 488 int setup_bus = 0;
@@ -498,11 +508,5 @@ void cell_init_iommu(void)
498 } 508 }
499 } 509 }
500 510
501 pci_dma_ops.alloc_coherent = cell_alloc_coherent; 511 pci_dma_ops = cell_iommu_ops;
502 pci_dma_ops.free_coherent = cell_free_coherent;
503 pci_dma_ops.map_single = cell_map_single;
504 pci_dma_ops.unmap_single = cell_unmap_single;
505 pci_dma_ops.map_sg = cell_map_sg;
506 pci_dma_ops.unmap_sg = cell_unmap_sg;
507 pci_dma_ops.dma_supported = cell_dma_supported;
508} 512}
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index 7eed8c624517..695ac4e1617e 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -37,36 +37,28 @@
37#include <asm/reg.h> 37#include <asm/reg.h>
38 38
39#include "pervasive.h" 39#include "pervasive.h"
40#include "cbe_regs.h"
40 41
41static DEFINE_SPINLOCK(cbe_pervasive_lock); 42static DEFINE_SPINLOCK(cbe_pervasive_lock);
42struct cbe_pervasive {
43 struct pmd_regs __iomem *regs;
44 unsigned int thread;
45};
46
47/* can't use per_cpu from setup_arch */
48static struct cbe_pervasive cbe_pervasive[NR_CPUS];
49 43
50static void __init cbe_enable_pause_zero(void) 44static void __init cbe_enable_pause_zero(void)
51{ 45{
52 unsigned long thread_switch_control; 46 unsigned long thread_switch_control;
53 unsigned long temp_register; 47 unsigned long temp_register;
54 struct cbe_pervasive *p; 48 struct cbe_pmd_regs __iomem *pregs;
55 int thread;
56 49
57 spin_lock_irq(&cbe_pervasive_lock); 50 spin_lock_irq(&cbe_pervasive_lock);
58 p = &cbe_pervasive[smp_processor_id()]; 51 pregs = cbe_get_cpu_pmd_regs(smp_processor_id());
59 52 if (pregs == NULL)
60 if (!cbe_pervasive->regs)
61 goto out; 53 goto out;
62 54
63 pr_debug("Power Management: CPU %d\n", smp_processor_id()); 55 pr_debug("Power Management: CPU %d\n", smp_processor_id());
64 56
65 /* Enable Pause(0) control bit */ 57 /* Enable Pause(0) control bit */
66 temp_register = in_be64(&p->regs->pm_control); 58 temp_register = in_be64(&pregs->pm_control);
67 59
68 out_be64(&p->regs->pm_control, 60 out_be64(&pregs->pm_control,
69 temp_register|PMD_PAUSE_ZERO_CONTROL); 61 temp_register | CBE_PMD_PAUSE_ZERO_CONTROL);
70 62
71 /* Enable DEC and EE interrupt request */ 63 /* Enable DEC and EE interrupt request */
72 thread_switch_control = mfspr(SPRN_TSC_CELL); 64 thread_switch_control = mfspr(SPRN_TSC_CELL);
@@ -75,25 +67,16 @@ static void __init cbe_enable_pause_zero(void)
75 switch ((mfspr(SPRN_CTRLF) & CTRL_CT)) { 67 switch ((mfspr(SPRN_CTRLF) & CTRL_CT)) {
76 case CTRL_CT0: 68 case CTRL_CT0:
77 thread_switch_control |= TSC_CELL_DEC_ENABLE_0; 69 thread_switch_control |= TSC_CELL_DEC_ENABLE_0;
78 thread = 0;
79 break; 70 break;
80 case CTRL_CT1: 71 case CTRL_CT1:
81 thread_switch_control |= TSC_CELL_DEC_ENABLE_1; 72 thread_switch_control |= TSC_CELL_DEC_ENABLE_1;
82 thread = 1;
83 break; 73 break;
84 default: 74 default:
85 printk(KERN_WARNING "%s: unknown configuration\n", 75 printk(KERN_WARNING "%s: unknown configuration\n",
86 __FUNCTION__); 76 __FUNCTION__);
87 thread = -1;
88 break; 77 break;
89 } 78 }
90 79
91 if (p->thread != thread)
92 printk(KERN_WARNING "%s: device tree inconsistant, "
93 "cpu %i: %d/%d\n", __FUNCTION__,
94 smp_processor_id(),
95 p->thread, thread);
96
97 mtspr(SPRN_TSC_CELL, thread_switch_control); 80 mtspr(SPRN_TSC_CELL, thread_switch_control);
98 81
99out: 82out:
@@ -104,6 +87,11 @@ static void cbe_idle(void)
104{ 87{
105 unsigned long ctrl; 88 unsigned long ctrl;
106 89
90 /* Why do we do that on every idle ? Couldn't that be done once for
91 * all or do we lose the state some way ? Also, the pm_control
92 * register setting, that can't be set once at boot ? We really want
93 * to move that away in order to implement a simple powersave
94 */
107 cbe_enable_pause_zero(); 95 cbe_enable_pause_zero();
108 96
109 while (1) { 97 while (1) {
@@ -152,8 +140,15 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
152 timer_interrupt(regs); 140 timer_interrupt(regs);
153 break; 141 break;
154 case SRR1_WAKEMT: 142 case SRR1_WAKEMT:
155 /* no action required */
156 break; 143 break;
144#ifdef CONFIG_CBE_RAS
145 case SRR1_WAKESYSERR:
146 cbe_system_error_exception(regs);
147 break;
148 case SRR1_WAKETHERM:
149 cbe_thermal_exception(regs);
150 break;
151#endif /* CONFIG_CBE_RAS */
157 default: 152 default:
158 /* do system reset */ 153 /* do system reset */
159 return 0; 154 return 0;
@@ -162,68 +157,11 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
162 return 1; 157 return 1;
163} 158}
164 159
165static int __init cbe_find_pmd_mmio(int cpu, struct cbe_pervasive *p) 160void __init cbe_pervasive_init(void)
166{
167 struct device_node *node;
168 unsigned int *int_servers;
169 char *addr;
170 unsigned long real_address;
171 unsigned int size;
172
173 struct pmd_regs __iomem *pmd_mmio_area;
174 int hardid, thread;
175 int proplen;
176
177 pmd_mmio_area = NULL;
178 hardid = get_hard_smp_processor_id(cpu);
179 for (node = NULL; (node = of_find_node_by_type(node, "cpu"));) {
180 int_servers = (void *) get_property(node,
181 "ibm,ppc-interrupt-server#s", &proplen);
182 if (!int_servers) {
183 printk(KERN_WARNING "%s misses "
184 "ibm,ppc-interrupt-server#s property",
185 node->full_name);
186 continue;
187 }
188 for (thread = 0; thread < proplen / sizeof (int); thread++) {
189 if (hardid == int_servers[thread]) {
190 addr = get_property(node, "pervasive", NULL);
191 goto found;
192 }
193 }
194 }
195
196 printk(KERN_WARNING "%s: CPU %d not found\n", __FUNCTION__, cpu);
197 return -EINVAL;
198
199found:
200 real_address = *(unsigned long*) addr;
201 addr += sizeof (unsigned long);
202 size = *(unsigned int*) addr;
203
204 pr_debug("pervasive area for CPU %d at %lx, size %x\n",
205 cpu, real_address, size);
206 p->regs = ioremap(real_address, size);
207 p->thread = thread;
208 return 0;
209}
210
211void __init cell_pervasive_init(void)
212{ 161{
213 struct cbe_pervasive *p;
214 int cpu;
215 int ret;
216
217 if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO)) 162 if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO))
218 return; 163 return;
219 164
220 for_each_possible_cpu(cpu) {
221 p = &cbe_pervasive[cpu];
222 ret = cbe_find_pmd_mmio(cpu, p);
223 if (ret)
224 return;
225 }
226
227 ppc_md.idle_loop = cbe_idle; 165 ppc_md.idle_loop = cbe_idle;
228 ppc_md.system_reset_exception = cbe_system_reset_exception; 166 ppc_md.system_reset_exception = cbe_system_reset_exception;
229} 167}
diff --git a/arch/powerpc/platforms/cell/pervasive.h b/arch/powerpc/platforms/cell/pervasive.h
index da1fb85ca3e8..7b50947f8044 100644
--- a/arch/powerpc/platforms/cell/pervasive.h
+++ b/arch/powerpc/platforms/cell/pervasive.h
@@ -25,38 +25,9 @@
25#ifndef PERVASIVE_H 25#ifndef PERVASIVE_H
26#define PERVASIVE_H 26#define PERVASIVE_H
27 27
28struct pmd_regs { 28extern void cbe_pervasive_init(void);
29 u8 pad_0x0000_0x0800[0x0800 - 0x0000]; /* 0x0000 */ 29extern void cbe_system_error_exception(struct pt_regs *regs);
30 30extern void cbe_maintenance_exception(struct pt_regs *regs);
31 /* Thermal Sensor Registers */ 31extern void cbe_thermal_exception(struct pt_regs *regs);
32 u64 ts_ctsr1; /* 0x0800 */
33 u64 ts_ctsr2; /* 0x0808 */
34 u64 ts_mtsr1; /* 0x0810 */
35 u64 ts_mtsr2; /* 0x0818 */
36 u64 ts_itr1; /* 0x0820 */
37 u64 ts_itr2; /* 0x0828 */
38 u64 ts_gitr; /* 0x0830 */
39 u64 ts_isr; /* 0x0838 */
40 u64 ts_imr; /* 0x0840 */
41 u64 tm_cr1; /* 0x0848 */
42 u64 tm_cr2; /* 0x0850 */
43 u64 tm_simr; /* 0x0858 */
44 u64 tm_tpr; /* 0x0860 */
45 u64 tm_str1; /* 0x0868 */
46 u64 tm_str2; /* 0x0870 */
47 u64 tm_tsr; /* 0x0878 */
48
49 /* Power Management */
50 u64 pm_control; /* 0x0880 */
51#define PMD_PAUSE_ZERO_CONTROL 0x10000
52 u64 pm_status; /* 0x0888 */
53
54 /* Time Base Register */
55 u64 tbr; /* 0x0890 */
56
57 u8 pad_0x0898_0x1000 [0x1000 - 0x0898]; /* 0x0898 */
58};
59
60void __init cell_pervasive_init(void);
61 32
62#endif 33#endif
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
new file mode 100644
index 000000000000..033ad6e2827b
--- /dev/null
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -0,0 +1,112 @@
1#define DEBUG
2
3#include <linux/config.h>
4#include <linux/types.h>
5#include <linux/kernel.h>
6#include <linux/smp.h>
7
8#include <asm/reg.h>
9#include <asm/io.h>
10#include <asm/prom.h>
11#include <asm/machdep.h>
12
13#include "ras.h"
14#include "cbe_regs.h"
15
16
17static void dump_fir(int cpu)
18{
19 struct cbe_pmd_regs __iomem *pregs = cbe_get_cpu_pmd_regs(cpu);
20 struct cbe_iic_regs __iomem *iregs = cbe_get_cpu_iic_regs(cpu);
21
22 if (pregs == NULL)
23 return;
24
25 /* Todo: do some nicer parsing of bits and based on them go down
26 * to other sub-units FIRs and not only IIC
27 */
28 printk(KERN_ERR "Global Checkstop FIR : 0x%016lx\n",
29 in_be64(&pregs->checkstop_fir));
30 printk(KERN_ERR "Global Recoverable FIR : 0x%016lx\n",
31 in_be64(&pregs->checkstop_fir));
32 printk(KERN_ERR "Global MachineCheck FIR : 0x%016lx\n",
33 in_be64(&pregs->spec_att_mchk_fir));
34
35 if (iregs == NULL)
36 return;
37 printk(KERN_ERR "IOC FIR : 0x%016lx\n",
38 in_be64(&iregs->ioc_fir));
39
40}
41
42void cbe_system_error_exception(struct pt_regs *regs)
43{
44 int cpu = smp_processor_id();
45
46 printk(KERN_ERR "System Error Interrupt on CPU %d !\n", cpu);
47 dump_fir(cpu);
48 dump_stack();
49}
50
51void cbe_maintenance_exception(struct pt_regs *regs)
52{
53 int cpu = smp_processor_id();
54
55 /*
56 * Nothing implemented for the maintenance interrupt at this point
57 */
58
59 printk(KERN_ERR "Unhandled Maintenance interrupt on CPU %d !\n", cpu);
60 dump_stack();
61}
62
63void cbe_thermal_exception(struct pt_regs *regs)
64{
65 int cpu = smp_processor_id();
66
67 /*
68 * Nothing implemented for the thermal interrupt at this point
69 */
70
71 printk(KERN_ERR "Unhandled Thermal interrupt on CPU %d !\n", cpu);
72 dump_stack();
73}
74
75static int cbe_machine_check_handler(struct pt_regs *regs)
76{
77 int cpu = smp_processor_id();
78
79 printk(KERN_ERR "Machine Check Interrupt on CPU %d !\n", cpu);
80 dump_fir(cpu);
81
82 /* No recovery from this code now, lets continue */
83 return 0;
84}
85
86void __init cbe_ras_init(void)
87{
88 unsigned long hid0;
89
90 /*
91 * Enable System Error & thermal interrupts and wakeup conditions
92 */
93
94 hid0 = mfspr(SPRN_HID0);
95 hid0 |= HID0_CBE_THERM_INT_EN | HID0_CBE_THERM_WAKEUP |
96 HID0_CBE_SYSERR_INT_EN | HID0_CBE_SYSERR_WAKEUP;
97 mtspr(SPRN_HID0, hid0);
98 mb();
99
100 /*
101 * Install machine check handler. Leave setting of precise mode to
102 * what the firmware did for now
103 */
104 ppc_md.machine_check_exception = cbe_machine_check_handler;
105 mb();
106
107 /*
108 * For now, we assume that IOC_FIR is already set to forward some
109 * error conditions to the System Error handler. If that is not true
110 * then it will have to be fixed up here.
111 */
112}
diff --git a/arch/powerpc/platforms/cell/ras.h b/arch/powerpc/platforms/cell/ras.h
new file mode 100644
index 000000000000..eb7ee54c82a0
--- /dev/null
+++ b/arch/powerpc/platforms/cell/ras.h
@@ -0,0 +1,9 @@
1#ifndef RAS_H
2#define RAS_H
3
4extern void cbe_system_error_exception(struct pt_regs *regs);
5extern void cbe_maintenance_exception(struct pt_regs *regs);
6extern void cbe_thermal_exception(struct pt_regs *regs);
7extern void cbe_ras_init(void);
8
9#endif /* RAS_H */
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index fd3e5609e3e0..3d1831d331e5 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -49,10 +49,13 @@
49#include <asm/ppc-pci.h> 49#include <asm/ppc-pci.h>
50#include <asm/irq.h> 50#include <asm/irq.h>
51#include <asm/spu.h> 51#include <asm/spu.h>
52#include <asm/spu_priv1.h>
52 53
53#include "interrupt.h" 54#include "interrupt.h"
54#include "iommu.h" 55#include "iommu.h"
56#include "cbe_regs.h"
55#include "pervasive.h" 57#include "pervasive.h"
58#include "ras.h"
56 59
57#ifdef DEBUG 60#ifdef DEBUG
58#define DBG(fmt...) udbg_printf(fmt) 61#define DBG(fmt...) udbg_printf(fmt)
@@ -81,6 +84,15 @@ static void __init cell_setup_arch(void)
81{ 84{
82 ppc_md.init_IRQ = iic_init_IRQ; 85 ppc_md.init_IRQ = iic_init_IRQ;
83 ppc_md.get_irq = iic_get_irq; 86 ppc_md.get_irq = iic_get_irq;
87#ifdef CONFIG_SPU_BASE
88 spu_priv1_ops = &spu_priv1_mmio_ops;
89#endif
90
91 cbe_regs_init();
92
93#ifdef CONFIG_CBE_RAS
94 cbe_ras_init();
95#endif
84 96
85#ifdef CONFIG_SMP 97#ifdef CONFIG_SMP
86 smp_init_cell(); 98 smp_init_cell();
@@ -98,7 +110,7 @@ static void __init cell_setup_arch(void)
98 init_pci_config_tokens(); 110 init_pci_config_tokens();
99 find_and_init_phbs(); 111 find_and_init_phbs();
100 spider_init_IRQ(); 112 spider_init_IRQ();
101 cell_pervasive_init(); 113 cbe_pervasive_init();
102#ifdef CONFIG_DUMMY_CONSOLE 114#ifdef CONFIG_DUMMY_CONSOLE
103 conswitchp = &dummy_con; 115 conswitchp = &dummy_con;
104#endif 116#endif
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index ad141fe8d52d..db82f503ba2c 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -34,10 +34,15 @@
34#include <asm/prom.h> 34#include <asm/prom.h>
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36#include <asm/spu.h> 36#include <asm/spu.h>
37#include <asm/spu_priv1.h>
37#include <asm/mmu_context.h> 38#include <asm/mmu_context.h>
38 39
39#include "interrupt.h" 40#include "interrupt.h"
40 41
42const struct spu_priv1_ops *spu_priv1_ops;
43
44EXPORT_SYMBOL_GPL(spu_priv1_ops);
45
41static int __spu_trap_invalid_dma(struct spu *spu) 46static int __spu_trap_invalid_dma(struct spu *spu)
42{ 47{
43 pr_debug("%s\n", __FUNCTION__); 48 pr_debug("%s\n", __FUNCTION__);
@@ -71,7 +76,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
71{ 76{
72 struct spu_priv2 __iomem *priv2 = spu->priv2; 77 struct spu_priv2 __iomem *priv2 = spu->priv2;
73 struct mm_struct *mm = spu->mm; 78 struct mm_struct *mm = spu->mm;
74 u64 esid, vsid; 79 u64 esid, vsid, llp;
75 80
76 pr_debug("%s\n", __FUNCTION__); 81 pr_debug("%s\n", __FUNCTION__);
77 82
@@ -91,9 +96,14 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
91 } 96 }
92 97
93 esid = (ea & ESID_MASK) | SLB_ESID_V; 98 esid = (ea & ESID_MASK) | SLB_ESID_V;
94 vsid = (get_vsid(mm->context.id, ea) << SLB_VSID_SHIFT) | SLB_VSID_USER; 99#ifdef CONFIG_HUGETLB_PAGE
95 if (in_hugepage_area(mm->context, ea)) 100 if (in_hugepage_area(mm->context, ea))
96 vsid |= SLB_VSID_L; 101 llp = mmu_psize_defs[mmu_huge_psize].sllp;
102 else
103#endif
104 llp = mmu_psize_defs[mmu_virtual_psize].sllp;
105 vsid = (get_vsid(mm->context.id, ea) << SLB_VSID_SHIFT) |
106 SLB_VSID_USER | llp;
97 107
98 out_be64(&priv2->slb_index_W, spu->slb_replace); 108 out_be64(&priv2->slb_index_W, spu->slb_replace);
99 out_be64(&priv2->slb_vsid_RW, vsid); 109 out_be64(&priv2->slb_vsid_RW, vsid);
@@ -130,57 +140,7 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
130 spu->dar = ea; 140 spu->dar = ea;
131 spu->dsisr = dsisr; 141 spu->dsisr = dsisr;
132 mb(); 142 mb();
133 if (spu->stop_callback) 143 spu->stop_callback(spu);
134 spu->stop_callback(spu);
135 return 0;
136}
137
138static int __spu_trap_mailbox(struct spu *spu)
139{
140 if (spu->ibox_callback)
141 spu->ibox_callback(spu);
142
143 /* atomically disable SPU mailbox interrupts */
144 spin_lock(&spu->register_lock);
145 spu_int_mask_and(spu, 2, ~0x1);
146 spin_unlock(&spu->register_lock);
147 return 0;
148}
149
150static int __spu_trap_stop(struct spu *spu)
151{
152 pr_debug("%s\n", __FUNCTION__);
153 spu->stop_code = in_be32(&spu->problem->spu_status_R);
154 if (spu->stop_callback)
155 spu->stop_callback(spu);
156 return 0;
157}
158
159static int __spu_trap_halt(struct spu *spu)
160{
161 pr_debug("%s\n", __FUNCTION__);
162 spu->stop_code = in_be32(&spu->problem->spu_status_R);
163 if (spu->stop_callback)
164 spu->stop_callback(spu);
165 return 0;
166}
167
168static int __spu_trap_tag_group(struct spu *spu)
169{
170 pr_debug("%s\n", __FUNCTION__);
171 spu->mfc_callback(spu);
172 return 0;
173}
174
175static int __spu_trap_spubox(struct spu *spu)
176{
177 if (spu->wbox_callback)
178 spu->wbox_callback(spu);
179
180 /* atomically disable SPU mailbox interrupts */
181 spin_lock(&spu->register_lock);
182 spu_int_mask_and(spu, 2, ~0x10);
183 spin_unlock(&spu->register_lock);
184 return 0; 144 return 0;
185} 145}
186 146
@@ -191,8 +151,7 @@ spu_irq_class_0(int irq, void *data, struct pt_regs *regs)
191 151
192 spu = data; 152 spu = data;
193 spu->class_0_pending = 1; 153 spu->class_0_pending = 1;
194 if (spu->stop_callback) 154 spu->stop_callback(spu);
195 spu->stop_callback(spu);
196 155
197 return IRQ_HANDLED; 156 return IRQ_HANDLED;
198} 157}
@@ -270,29 +229,38 @@ spu_irq_class_2(int irq, void *data, struct pt_regs *regs)
270 unsigned long mask; 229 unsigned long mask;
271 230
272 spu = data; 231 spu = data;
232 spin_lock(&spu->register_lock);
273 stat = spu_int_stat_get(spu, 2); 233 stat = spu_int_stat_get(spu, 2);
274 mask = spu_int_mask_get(spu, 2); 234 mask = spu_int_mask_get(spu, 2);
235 /* ignore interrupts we're not waiting for */
236 stat &= mask;
237 /*
238 * mailbox interrupts (0x1 and 0x10) are level triggered.
239 * mask them now before acknowledging.
240 */
241 if (stat & 0x11)
242 spu_int_mask_and(spu, 2, ~(stat & 0x11));
243 /* acknowledge all interrupts before the callbacks */
244 spu_int_stat_clear(spu, 2, stat);
245 spin_unlock(&spu->register_lock);
275 246
276 pr_debug("class 2 interrupt %d, %lx, %lx\n", irq, stat, mask); 247 pr_debug("class 2 interrupt %d, %lx, %lx\n", irq, stat, mask);
277 248
278 stat &= mask;
279
280 if (stat & 1) /* PPC core mailbox */ 249 if (stat & 1) /* PPC core mailbox */
281 __spu_trap_mailbox(spu); 250 spu->ibox_callback(spu);
282 251
283 if (stat & 2) /* SPU stop-and-signal */ 252 if (stat & 2) /* SPU stop-and-signal */
284 __spu_trap_stop(spu); 253 spu->stop_callback(spu);
285 254
286 if (stat & 4) /* SPU halted */ 255 if (stat & 4) /* SPU halted */
287 __spu_trap_halt(spu); 256 spu->stop_callback(spu);
288 257
289 if (stat & 8) /* DMA tag group complete */ 258 if (stat & 8) /* DMA tag group complete */
290 __spu_trap_tag_group(spu); 259 spu->mfc_callback(spu);
291 260
292 if (stat & 0x10) /* SPU mailbox threshold */ 261 if (stat & 0x10) /* SPU mailbox threshold */
293 __spu_trap_spubox(spu); 262 spu->wbox_callback(spu);
294 263
295 spu_int_stat_clear(spu, 2, stat);
296 return stat ? IRQ_HANDLED : IRQ_NONE; 264 return stat ? IRQ_HANDLED : IRQ_NONE;
297} 265}
298 266
@@ -512,14 +480,6 @@ int spu_irq_class_1_bottom(struct spu *spu)
512 return ret; 480 return ret;
513} 481}
514 482
515void spu_irq_setaffinity(struct spu *spu, int cpu)
516{
517 u64 target = iic_get_target_id(cpu);
518 u64 route = target << 48 | target << 32 | target << 16;
519 spu_int_route_set(spu, route);
520}
521EXPORT_SYMBOL_GPL(spu_irq_setaffinity);
522
523static int __init find_spu_node_id(struct device_node *spe) 483static int __init find_spu_node_id(struct device_node *spe)
524{ 484{
525 unsigned int *id; 485 unsigned int *id;
@@ -649,6 +609,46 @@ out:
649 return ret; 609 return ret;
650} 610}
651 611
612struct sysdev_class spu_sysdev_class = {
613 set_kset_name("spu")
614};
615
616static ssize_t spu_show_isrc(struct sys_device *sysdev, char *buf)
617{
618 struct spu *spu = container_of(sysdev, struct spu, sysdev);
619 return sprintf(buf, "%d\n", spu->isrc);
620
621}
622static SYSDEV_ATTR(isrc, 0400, spu_show_isrc, NULL);
623
624extern int attach_sysdev_to_node(struct sys_device *dev, int nid);
625
626static int spu_create_sysdev(struct spu *spu)
627{
628 int ret;
629
630 spu->sysdev.id = spu->number;
631 spu->sysdev.cls = &spu_sysdev_class;
632 ret = sysdev_register(&spu->sysdev);
633 if (ret) {
634 printk(KERN_ERR "Can't register SPU %d with sysfs\n",
635 spu->number);
636 return ret;
637 }
638
639 sysdev_create_file(&spu->sysdev, &attr_isrc);
640 sysfs_add_device_to_node(&spu->sysdev, spu->nid);
641
642 return 0;
643}
644
645static void spu_destroy_sysdev(struct spu *spu)
646{
647 sysdev_remove_file(&spu->sysdev, &attr_isrc);
648 sysfs_remove_device_from_node(&spu->sysdev, spu->nid);
649 sysdev_unregister(&spu->sysdev);
650}
651
652static int __init create_spu(struct device_node *spe) 652static int __init create_spu(struct device_node *spe)
653{ 653{
654 struct spu *spu; 654 struct spu *spu;
@@ -656,7 +656,7 @@ static int __init create_spu(struct device_node *spe)
656 static int number; 656 static int number;
657 657
658 ret = -ENOMEM; 658 ret = -ENOMEM;
659 spu = kmalloc(sizeof (*spu), GFP_KERNEL); 659 spu = kzalloc(sizeof (*spu), GFP_KERNEL);
660 if (!spu) 660 if (!spu)
661 goto out; 661 goto out;
662 662
@@ -668,33 +668,20 @@ static int __init create_spu(struct device_node *spe)
668 spu->nid = of_node_to_nid(spe); 668 spu->nid = of_node_to_nid(spe);
669 if (spu->nid == -1) 669 if (spu->nid == -1)
670 spu->nid = 0; 670 spu->nid = 0;
671
672 spu->stop_code = 0;
673 spu->slb_replace = 0;
674 spu->mm = NULL;
675 spu->ctx = NULL;
676 spu->rq = NULL;
677 spu->pid = 0;
678 spu->class_0_pending = 0;
679 spu->flags = 0UL;
680 spu->dar = 0UL;
681 spu->dsisr = 0UL;
682 spin_lock_init(&spu->register_lock); 671 spin_lock_init(&spu->register_lock);
683
684 spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1)); 672 spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1));
685 spu_mfc_sr1_set(spu, 0x33); 673 spu_mfc_sr1_set(spu, 0x33);
686
687 spu->ibox_callback = NULL;
688 spu->wbox_callback = NULL;
689 spu->stop_callback = NULL;
690 spu->mfc_callback = NULL;
691
692 mutex_lock(&spu_mutex); 674 mutex_lock(&spu_mutex);
675
693 spu->number = number++; 676 spu->number = number++;
694 ret = spu_request_irqs(spu); 677 ret = spu_request_irqs(spu);
695 if (ret) 678 if (ret)
696 goto out_unmap; 679 goto out_unmap;
697 680
681 ret = spu_create_sysdev(spu);
682 if (ret)
683 goto out_free_irqs;
684
698 list_add(&spu->list, &spu_list); 685 list_add(&spu->list, &spu_list);
699 mutex_unlock(&spu_mutex); 686 mutex_unlock(&spu_mutex);
700 687
@@ -703,6 +690,9 @@ static int __init create_spu(struct device_node *spe)
703 spu->problem, spu->priv1, spu->priv2, spu->number); 690 spu->problem, spu->priv1, spu->priv2, spu->number);
704 goto out; 691 goto out;
705 692
693out_free_irqs:
694 spu_free_irqs(spu);
695
706out_unmap: 696out_unmap:
707 mutex_unlock(&spu_mutex); 697 mutex_unlock(&spu_mutex);
708 spu_unmap(spu); 698 spu_unmap(spu);
@@ -716,6 +706,7 @@ static void destroy_spu(struct spu *spu)
716{ 706{
717 list_del_init(&spu->list); 707 list_del_init(&spu->list);
718 708
709 spu_destroy_sysdev(spu);
719 spu_free_irqs(spu); 710 spu_free_irqs(spu);
720 spu_unmap(spu); 711 spu_unmap(spu);
721 kfree(spu); 712 kfree(spu);
@@ -728,6 +719,7 @@ static void cleanup_spu_base(void)
728 list_for_each_entry_safe(spu, tmp, &spu_list, list) 719 list_for_each_entry_safe(spu, tmp, &spu_list, list)
729 destroy_spu(spu); 720 destroy_spu(spu);
730 mutex_unlock(&spu_mutex); 721 mutex_unlock(&spu_mutex);
722 sysdev_class_unregister(&spu_sysdev_class);
731} 723}
732module_exit(cleanup_spu_base); 724module_exit(cleanup_spu_base);
733 725
@@ -736,6 +728,11 @@ static int __init init_spu_base(void)
736 struct device_node *node; 728 struct device_node *node;
737 int ret; 729 int ret;
738 730
731 /* create sysdev class for spus */
732 ret = sysdev_class_register(&spu_sysdev_class);
733 if (ret)
734 return ret;
735
739 ret = -ENODEV; 736 ret = -ENODEV;
740 for (node = of_find_node_by_type(NULL, "spe"); 737 for (node = of_find_node_by_type(NULL, "spe");
741 node; node = of_find_node_by_type(node, "spe")) { 738 node; node = of_find_node_by_type(node, "spe")) {
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c
index b47fcc5ddb78..47ec3be3edcd 100644
--- a/arch/powerpc/platforms/cell/spu_callbacks.c
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -34,307 +34,19 @@
34 */ 34 */
35 35
36void *spu_syscall_table[] = { 36void *spu_syscall_table[] = {
37 [__NR_restart_syscall] sys_ni_syscall, /* sys_restart_syscall */ 37#define SYSCALL(func) sys_ni_syscall,
38 [__NR_exit] sys_ni_syscall, /* sys_exit */ 38#define COMPAT_SYS(func) sys_ni_syscall,
39 [__NR_fork] sys_ni_syscall, /* ppc_fork */ 39#define PPC_SYS(func) sys_ni_syscall,
40 [__NR_read] sys_read, 40#define OLDSYS(func) sys_ni_syscall,
41 [__NR_write] sys_write, 41#define SYS32ONLY(func) sys_ni_syscall,
42 [__NR_open] sys_open, 42#define SYSX(f, f3264, f32) sys_ni_syscall,
43 [__NR_close] sys_close, 43
44 [__NR_waitpid] sys_waitpid, 44#define SYSCALL_SPU(func) sys_##func,
45 [__NR_creat] sys_creat, 45#define COMPAT_SYS_SPU(func) sys_##func,
46 [__NR_link] sys_link, 46#define PPC_SYS_SPU(func) ppc_##func,
47 [__NR_unlink] sys_unlink, 47#define SYSX_SPU(f, f3264, f32) f,
48 [__NR_execve] sys_ni_syscall, /* sys_execve */ 48
49 [__NR_chdir] sys_chdir, 49#include <asm/systbl.h>
50 [__NR_time] sys_time,
51 [__NR_mknod] sys_mknod,
52 [__NR_chmod] sys_chmod,
53 [__NR_lchown] sys_lchown,
54 [__NR_break] sys_ni_syscall,
55 [__NR_oldstat] sys_ni_syscall,
56 [__NR_lseek] sys_lseek,
57 [__NR_getpid] sys_getpid,
58 [__NR_mount] sys_ni_syscall, /* sys_mount */
59 [__NR_umount] sys_ni_syscall,
60 [__NR_setuid] sys_setuid,
61 [__NR_getuid] sys_getuid,
62 [__NR_stime] sys_stime,
63 [__NR_ptrace] sys_ni_syscall, /* sys_ptrace */
64 [__NR_alarm] sys_alarm,
65 [__NR_oldfstat] sys_ni_syscall,
66 [__NR_pause] sys_ni_syscall, /* sys_pause */
67 [__NR_utime] sys_ni_syscall, /* sys_utime */
68 [__NR_stty] sys_ni_syscall,
69 [__NR_gtty] sys_ni_syscall,
70 [__NR_access] sys_access,
71 [__NR_nice] sys_nice,
72 [__NR_ftime] sys_ni_syscall,
73 [__NR_sync] sys_sync,
74 [__NR_kill] sys_kill,
75 [__NR_rename] sys_rename,
76 [__NR_mkdir] sys_mkdir,
77 [__NR_rmdir] sys_rmdir,
78 [__NR_dup] sys_dup,
79 [__NR_pipe] sys_pipe,
80 [__NR_times] sys_times,
81 [__NR_prof] sys_ni_syscall,
82 [__NR_brk] sys_brk,
83 [__NR_setgid] sys_setgid,
84 [__NR_getgid] sys_getgid,
85 [__NR_signal] sys_ni_syscall, /* sys_signal */
86 [__NR_geteuid] sys_geteuid,
87 [__NR_getegid] sys_getegid,
88 [__NR_acct] sys_ni_syscall, /* sys_acct */
89 [__NR_umount2] sys_ni_syscall, /* sys_umount */
90 [__NR_lock] sys_ni_syscall,
91 [__NR_ioctl] sys_ioctl,
92 [__NR_fcntl] sys_fcntl,
93 [__NR_mpx] sys_ni_syscall,
94 [__NR_setpgid] sys_setpgid,
95 [__NR_ulimit] sys_ni_syscall,
96 [__NR_oldolduname] sys_ni_syscall,
97 [__NR_umask] sys_umask,
98 [__NR_chroot] sys_chroot,
99 [__NR_ustat] sys_ni_syscall, /* sys_ustat */
100 [__NR_dup2] sys_dup2,
101 [__NR_getppid] sys_getppid,
102 [__NR_getpgrp] sys_getpgrp,
103 [__NR_setsid] sys_setsid,
104 [__NR_sigaction] sys_ni_syscall,
105 [__NR_sgetmask] sys_sgetmask,
106 [__NR_ssetmask] sys_ssetmask,
107 [__NR_setreuid] sys_setreuid,
108 [__NR_setregid] sys_setregid,
109 [__NR_sigsuspend] sys_ni_syscall,
110 [__NR_sigpending] sys_ni_syscall,
111 [__NR_sethostname] sys_sethostname,
112 [__NR_setrlimit] sys_setrlimit,
113 [__NR_getrlimit] sys_ni_syscall,
114 [__NR_getrusage] sys_getrusage,
115 [__NR_gettimeofday] sys_gettimeofday,
116 [__NR_settimeofday] sys_settimeofday,
117 [__NR_getgroups] sys_getgroups,
118 [__NR_setgroups] sys_setgroups,
119 [__NR_select] sys_ni_syscall,
120 [__NR_symlink] sys_symlink,
121 [__NR_oldlstat] sys_ni_syscall,
122 [__NR_readlink] sys_readlink,
123 [__NR_uselib] sys_ni_syscall, /* sys_uselib */
124 [__NR_swapon] sys_ni_syscall, /* sys_swapon */
125 [__NR_reboot] sys_ni_syscall, /* sys_reboot */
126 [__NR_readdir] sys_ni_syscall,
127 [__NR_mmap] sys_mmap,
128 [__NR_munmap] sys_munmap,
129 [__NR_truncate] sys_truncate,
130 [__NR_ftruncate] sys_ftruncate,
131 [__NR_fchmod] sys_fchmod,
132 [__NR_fchown] sys_fchown,
133 [__NR_getpriority] sys_getpriority,
134 [__NR_setpriority] sys_setpriority,
135 [__NR_profil] sys_ni_syscall,
136 [__NR_statfs] sys_ni_syscall, /* sys_statfs */
137 [__NR_fstatfs] sys_ni_syscall, /* sys_fstatfs */
138 [__NR_ioperm] sys_ni_syscall,
139 [__NR_socketcall] sys_socketcall,
140 [__NR_syslog] sys_syslog,
141 [__NR_setitimer] sys_setitimer,
142 [__NR_getitimer] sys_getitimer,
143 [__NR_stat] sys_newstat,
144 [__NR_lstat] sys_newlstat,
145 [__NR_fstat] sys_newfstat,
146 [__NR_olduname] sys_ni_syscall,
147 [__NR_iopl] sys_ni_syscall,
148 [__NR_vhangup] sys_vhangup,
149 [__NR_idle] sys_ni_syscall,
150 [__NR_vm86] sys_ni_syscall,
151 [__NR_wait4] sys_wait4,
152 [__NR_swapoff] sys_ni_syscall, /* sys_swapoff */
153 [__NR_sysinfo] sys_sysinfo,
154 [__NR_ipc] sys_ni_syscall, /* sys_ipc */
155 [__NR_fsync] sys_fsync,
156 [__NR_sigreturn] sys_ni_syscall,
157 [__NR_clone] sys_ni_syscall, /* ppc_clone */
158 [__NR_setdomainname] sys_setdomainname,
159 [__NR_uname] ppc_newuname,
160 [__NR_modify_ldt] sys_ni_syscall,
161 [__NR_adjtimex] sys_adjtimex,
162 [__NR_mprotect] sys_mprotect,
163 [__NR_sigprocmask] sys_ni_syscall,
164 [__NR_create_module] sys_ni_syscall,
165 [__NR_init_module] sys_ni_syscall, /* sys_init_module */
166 [__NR_delete_module] sys_ni_syscall, /* sys_delete_module */
167 [__NR_get_kernel_syms] sys_ni_syscall,
168 [__NR_quotactl] sys_ni_syscall, /* sys_quotactl */
169 [__NR_getpgid] sys_getpgid,
170 [__NR_fchdir] sys_fchdir,
171 [__NR_bdflush] sys_bdflush,
172 [__NR_sysfs] sys_ni_syscall, /* sys_sysfs */
173 [__NR_personality] ppc64_personality,
174 [__NR_afs_syscall] sys_ni_syscall,
175 [__NR_setfsuid] sys_setfsuid,
176 [__NR_setfsgid] sys_setfsgid,
177 [__NR__llseek] sys_llseek,
178 [__NR_getdents] sys_getdents,
179 [__NR__newselect] sys_select,
180 [__NR_flock] sys_flock,
181 [__NR_msync] sys_msync,
182 [__NR_readv] sys_readv,
183 [__NR_writev] sys_writev,
184 [__NR_getsid] sys_getsid,
185 [__NR_fdatasync] sys_fdatasync,
186 [__NR__sysctl] sys_ni_syscall, /* sys_sysctl */
187 [__NR_mlock] sys_mlock,
188 [__NR_munlock] sys_munlock,
189 [__NR_mlockall] sys_mlockall,
190 [__NR_munlockall] sys_munlockall,
191 [__NR_sched_setparam] sys_sched_setparam,
192 [__NR_sched_getparam] sys_sched_getparam,
193 [__NR_sched_setscheduler] sys_sched_setscheduler,
194 [__NR_sched_getscheduler] sys_sched_getscheduler,
195 [__NR_sched_yield] sys_sched_yield,
196 [__NR_sched_get_priority_max] sys_sched_get_priority_max,
197 [__NR_sched_get_priority_min] sys_sched_get_priority_min,
198 [__NR_sched_rr_get_interval] sys_sched_rr_get_interval,
199 [__NR_nanosleep] sys_nanosleep,
200 [__NR_mremap] sys_mremap,
201 [__NR_setresuid] sys_setresuid,
202 [__NR_getresuid] sys_getresuid,
203 [__NR_query_module] sys_ni_syscall,
204 [__NR_poll] sys_poll,
205 [__NR_nfsservctl] sys_ni_syscall, /* sys_nfsservctl */
206 [__NR_setresgid] sys_setresgid,
207 [__NR_getresgid] sys_getresgid,
208 [__NR_prctl] sys_prctl,
209 [__NR_rt_sigreturn] sys_ni_syscall, /* ppc64_rt_sigreturn */
210 [__NR_rt_sigaction] sys_ni_syscall, /* sys_rt_sigaction */
211 [__NR_rt_sigprocmask] sys_ni_syscall, /* sys_rt_sigprocmask */
212 [__NR_rt_sigpending] sys_ni_syscall, /* sys_rt_sigpending */
213 [__NR_rt_sigtimedwait] sys_ni_syscall, /* sys_rt_sigtimedwait */
214 [__NR_rt_sigqueueinfo] sys_ni_syscall, /* sys_rt_sigqueueinfo */
215 [__NR_rt_sigsuspend] sys_ni_syscall, /* sys_rt_sigsuspend */
216 [__NR_pread64] sys_pread64,
217 [__NR_pwrite64] sys_pwrite64,
218 [__NR_chown] sys_chown,
219 [__NR_getcwd] sys_getcwd,
220 [__NR_capget] sys_capget,
221 [__NR_capset] sys_capset,
222 [__NR_sigaltstack] sys_ni_syscall, /* sys_sigaltstack */
223 [__NR_sendfile] sys_sendfile64,
224 [__NR_getpmsg] sys_ni_syscall,
225 [__NR_putpmsg] sys_ni_syscall,
226 [__NR_vfork] sys_ni_syscall, /* ppc_vfork */
227 [__NR_ugetrlimit] sys_getrlimit,
228 [__NR_readahead] sys_readahead,
229 [192] sys_ni_syscall,
230 [193] sys_ni_syscall,
231 [194] sys_ni_syscall,
232 [195] sys_ni_syscall,
233 [196] sys_ni_syscall,
234 [197] sys_ni_syscall,
235 [__NR_pciconfig_read] sys_ni_syscall, /* sys_pciconfig_read */
236 [__NR_pciconfig_write] sys_ni_syscall, /* sys_pciconfig_write */
237 [__NR_pciconfig_iobase] sys_ni_syscall, /* sys_pciconfig_iobase */
238 [__NR_multiplexer] sys_ni_syscall,
239 [__NR_getdents64] sys_getdents64,
240 [__NR_pivot_root] sys_pivot_root,
241 [204] sys_ni_syscall,
242 [__NR_madvise] sys_madvise,
243 [__NR_mincore] sys_mincore,
244 [__NR_gettid] sys_gettid,
245 [__NR_tkill] sys_tkill,
246 [__NR_setxattr] sys_setxattr,
247 [__NR_lsetxattr] sys_lsetxattr,
248 [__NR_fsetxattr] sys_fsetxattr,
249 [__NR_getxattr] sys_getxattr,
250 [__NR_lgetxattr] sys_lgetxattr,
251 [__NR_fgetxattr] sys_fgetxattr,
252 [__NR_listxattr] sys_listxattr,
253 [__NR_llistxattr] sys_llistxattr,
254 [__NR_flistxattr] sys_flistxattr,
255 [__NR_removexattr] sys_removexattr,
256 [__NR_lremovexattr] sys_lremovexattr,
257 [__NR_fremovexattr] sys_fremovexattr,
258 [__NR_futex] sys_futex,
259 [__NR_sched_setaffinity] sys_sched_setaffinity,
260 [__NR_sched_getaffinity] sys_sched_getaffinity,
261 [224] sys_ni_syscall,
262 [__NR_tuxcall] sys_ni_syscall,
263 [226] sys_ni_syscall,
264 [__NR_io_setup] sys_io_setup,
265 [__NR_io_destroy] sys_io_destroy,
266 [__NR_io_getevents] sys_io_getevents,
267 [__NR_io_submit] sys_io_submit,
268 [__NR_io_cancel] sys_io_cancel,
269 [__NR_set_tid_address] sys_ni_syscall, /* sys_set_tid_address */
270 [__NR_fadvise64] sys_fadvise64,
271 [__NR_exit_group] sys_ni_syscall, /* sys_exit_group */
272 [__NR_lookup_dcookie] sys_ni_syscall, /* sys_lookup_dcookie */
273 [__NR_epoll_create] sys_epoll_create,
274 [__NR_epoll_ctl] sys_epoll_ctl,
275 [__NR_epoll_wait] sys_epoll_wait,
276 [__NR_remap_file_pages] sys_remap_file_pages,
277 [__NR_timer_create] sys_timer_create,
278 [__NR_timer_settime] sys_timer_settime,
279 [__NR_timer_gettime] sys_timer_gettime,
280 [__NR_timer_getoverrun] sys_timer_getoverrun,
281 [__NR_timer_delete] sys_timer_delete,
282 [__NR_clock_settime] sys_clock_settime,
283 [__NR_clock_gettime] sys_clock_gettime,
284 [__NR_clock_getres] sys_clock_getres,
285 [__NR_clock_nanosleep] sys_clock_nanosleep,
286 [__NR_swapcontext] sys_ni_syscall, /* ppc64_swapcontext */
287 [__NR_tgkill] sys_tgkill,
288 [__NR_utimes] sys_utimes,
289 [__NR_statfs64] sys_statfs64,
290 [__NR_fstatfs64] sys_fstatfs64,
291 [254] sys_ni_syscall,
292 [__NR_rtas] ppc_rtas,
293 [256] sys_ni_syscall,
294 [257] sys_ni_syscall,
295 [258] sys_ni_syscall,
296 [__NR_mbind] sys_ni_syscall, /* sys_mbind */
297 [__NR_get_mempolicy] sys_ni_syscall, /* sys_get_mempolicy */
298 [__NR_set_mempolicy] sys_ni_syscall, /* sys_set_mempolicy */
299 [__NR_mq_open] sys_ni_syscall, /* sys_mq_open */
300 [__NR_mq_unlink] sys_ni_syscall, /* sys_mq_unlink */
301 [__NR_mq_timedsend] sys_ni_syscall, /* sys_mq_timedsend */
302 [__NR_mq_timedreceive] sys_ni_syscall, /* sys_mq_timedreceive */
303 [__NR_mq_notify] sys_ni_syscall, /* sys_mq_notify */
304 [__NR_mq_getsetattr] sys_ni_syscall, /* sys_mq_getsetattr */
305 [__NR_kexec_load] sys_ni_syscall, /* sys_kexec_load */
306 [__NR_add_key] sys_ni_syscall, /* sys_add_key */
307 [__NR_request_key] sys_ni_syscall, /* sys_request_key */
308 [__NR_keyctl] sys_ni_syscall, /* sys_keyctl */
309 [__NR_waitid] sys_ni_syscall, /* sys_waitid */
310 [__NR_ioprio_set] sys_ni_syscall, /* sys_ioprio_set */
311 [__NR_ioprio_get] sys_ni_syscall, /* sys_ioprio_get */
312 [__NR_inotify_init] sys_ni_syscall, /* sys_inotify_init */
313 [__NR_inotify_add_watch] sys_ni_syscall, /* sys_inotify_add_watch */
314 [__NR_inotify_rm_watch] sys_ni_syscall, /* sys_inotify_rm_watch */
315 [__NR_spu_run] sys_ni_syscall, /* sys_spu_run */
316 [__NR_spu_create] sys_ni_syscall, /* sys_spu_create */
317 [__NR_pselect6] sys_ni_syscall, /* sys_pselect */
318 [__NR_ppoll] sys_ni_syscall, /* sys_ppoll */
319 [__NR_unshare] sys_unshare,
320 [__NR_splice] sys_splice,
321 [__NR_tee] sys_tee,
322 [__NR_vmsplice] sys_vmsplice,
323 [__NR_openat] sys_openat,
324 [__NR_mkdirat] sys_mkdirat,
325 [__NR_mknodat] sys_mknodat,
326 [__NR_fchownat] sys_fchownat,
327 [__NR_futimesat] sys_futimesat,
328 [__NR_newfstatat] sys_newfstatat,
329 [__NR_unlinkat] sys_unlinkat,
330 [__NR_renameat] sys_renameat,
331 [__NR_linkat] sys_linkat,
332 [__NR_symlinkat] sys_symlinkat,
333 [__NR_readlinkat] sys_readlinkat,
334 [__NR_fchmodat] sys_fchmodat,
335 [__NR_faccessat] sys_faccessat,
336 [__NR_get_robust_list] sys_get_robust_list,
337 [__NR_set_robust_list] sys_set_robust_list,
338}; 50};
339 51
340long spu_sys_callback(struct spu_syscall_block *s) 52long spu_sys_callback(struct spu_syscall_block *s)
diff --git a/arch/powerpc/platforms/cell/spu_priv1.c b/arch/powerpc/platforms/cell/spu_priv1.c
deleted file mode 100644
index b2656421c7b5..000000000000
--- a/arch/powerpc/platforms/cell/spu_priv1.c
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2 * access to SPU privileged registers
3 */
4#include <linux/module.h>
5
6#include <asm/io.h>
7#include <asm/spu.h>
8
9void spu_int_mask_and(struct spu *spu, int class, u64 mask)
10{
11 u64 old_mask;
12
13 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
14 out_be64(&spu->priv1->int_mask_RW[class], old_mask & mask);
15}
16EXPORT_SYMBOL_GPL(spu_int_mask_and);
17
18void spu_int_mask_or(struct spu *spu, int class, u64 mask)
19{
20 u64 old_mask;
21
22 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
23 out_be64(&spu->priv1->int_mask_RW[class], old_mask | mask);
24}
25EXPORT_SYMBOL_GPL(spu_int_mask_or);
26
27void spu_int_mask_set(struct spu *spu, int class, u64 mask)
28{
29 out_be64(&spu->priv1->int_mask_RW[class], mask);
30}
31EXPORT_SYMBOL_GPL(spu_int_mask_set);
32
33u64 spu_int_mask_get(struct spu *spu, int class)
34{
35 return in_be64(&spu->priv1->int_mask_RW[class]);
36}
37EXPORT_SYMBOL_GPL(spu_int_mask_get);
38
39void spu_int_stat_clear(struct spu *spu, int class, u64 stat)
40{
41 out_be64(&spu->priv1->int_stat_RW[class], stat);
42}
43EXPORT_SYMBOL_GPL(spu_int_stat_clear);
44
45u64 spu_int_stat_get(struct spu *spu, int class)
46{
47 return in_be64(&spu->priv1->int_stat_RW[class]);
48}
49EXPORT_SYMBOL_GPL(spu_int_stat_get);
50
51void spu_int_route_set(struct spu *spu, u64 route)
52{
53 out_be64(&spu->priv1->int_route_RW, route);
54}
55EXPORT_SYMBOL_GPL(spu_int_route_set);
56
57u64 spu_mfc_dar_get(struct spu *spu)
58{
59 return in_be64(&spu->priv1->mfc_dar_RW);
60}
61EXPORT_SYMBOL_GPL(spu_mfc_dar_get);
62
63u64 spu_mfc_dsisr_get(struct spu *spu)
64{
65 return in_be64(&spu->priv1->mfc_dsisr_RW);
66}
67EXPORT_SYMBOL_GPL(spu_mfc_dsisr_get);
68
69void spu_mfc_dsisr_set(struct spu *spu, u64 dsisr)
70{
71 out_be64(&spu->priv1->mfc_dsisr_RW, dsisr);
72}
73EXPORT_SYMBOL_GPL(spu_mfc_dsisr_set);
74
75void spu_mfc_sdr_set(struct spu *spu, u64 sdr)
76{
77 out_be64(&spu->priv1->mfc_sdr_RW, sdr);
78}
79EXPORT_SYMBOL_GPL(spu_mfc_sdr_set);
80
81void spu_mfc_sr1_set(struct spu *spu, u64 sr1)
82{
83 out_be64(&spu->priv1->mfc_sr1_RW, sr1);
84}
85EXPORT_SYMBOL_GPL(spu_mfc_sr1_set);
86
87u64 spu_mfc_sr1_get(struct spu *spu)
88{
89 return in_be64(&spu->priv1->mfc_sr1_RW);
90}
91EXPORT_SYMBOL_GPL(spu_mfc_sr1_get);
92
93void spu_mfc_tclass_id_set(struct spu *spu, u64 tclass_id)
94{
95 out_be64(&spu->priv1->mfc_tclass_id_RW, tclass_id);
96}
97EXPORT_SYMBOL_GPL(spu_mfc_tclass_id_set);
98
99u64 spu_mfc_tclass_id_get(struct spu *spu)
100{
101 return in_be64(&spu->priv1->mfc_tclass_id_RW);
102}
103EXPORT_SYMBOL_GPL(spu_mfc_tclass_id_get);
104
105void spu_tlb_invalidate(struct spu *spu)
106{
107 out_be64(&spu->priv1->tlb_invalidate_entry_W, 0ul);
108}
109EXPORT_SYMBOL_GPL(spu_tlb_invalidate);
110
111void spu_resource_allocation_groupID_set(struct spu *spu, u64 id)
112{
113 out_be64(&spu->priv1->resource_allocation_groupID_RW, id);
114}
115EXPORT_SYMBOL_GPL(spu_resource_allocation_groupID_set);
116
117u64 spu_resource_allocation_groupID_get(struct spu *spu)
118{
119 return in_be64(&spu->priv1->resource_allocation_groupID_RW);
120}
121EXPORT_SYMBOL_GPL(spu_resource_allocation_groupID_get);
122
123void spu_resource_allocation_enable_set(struct spu *spu, u64 enable)
124{
125 out_be64(&spu->priv1->resource_allocation_enable_RW, enable);
126}
127EXPORT_SYMBOL_GPL(spu_resource_allocation_enable_set);
128
129u64 spu_resource_allocation_enable_get(struct spu *spu)
130{
131 return in_be64(&spu->priv1->resource_allocation_enable_RW);
132}
133EXPORT_SYMBOL_GPL(spu_resource_allocation_enable_get);
diff --git a/arch/powerpc/platforms/cell/spu_priv1_mmio.c b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
new file mode 100644
index 000000000000..71b69f0a1a48
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
@@ -0,0 +1,159 @@
1/*
2 * spu hypervisor abstraction for direct hardware access.
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
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/module.h>
22
23#include <asm/io.h>
24#include <asm/spu.h>
25#include <asm/spu_priv1.h>
26
27#include "interrupt.h"
28
29static void int_mask_and(struct spu *spu, int class, u64 mask)
30{
31 u64 old_mask;
32
33 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
34 out_be64(&spu->priv1->int_mask_RW[class], old_mask & mask);
35}
36
37static void int_mask_or(struct spu *spu, int class, u64 mask)
38{
39 u64 old_mask;
40
41 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
42 out_be64(&spu->priv1->int_mask_RW[class], old_mask | mask);
43}
44
45static void int_mask_set(struct spu *spu, int class, u64 mask)
46{
47 out_be64(&spu->priv1->int_mask_RW[class], mask);
48}
49
50static u64 int_mask_get(struct spu *spu, int class)
51{
52 return in_be64(&spu->priv1->int_mask_RW[class]);
53}
54
55static void int_stat_clear(struct spu *spu, int class, u64 stat)
56{
57 out_be64(&spu->priv1->int_stat_RW[class], stat);
58}
59
60static u64 int_stat_get(struct spu *spu, int class)
61{
62 return in_be64(&spu->priv1->int_stat_RW[class]);
63}
64
65static void cpu_affinity_set(struct spu *spu, int cpu)
66{
67 u64 target = iic_get_target_id(cpu);
68 u64 route = target << 48 | target << 32 | target << 16;
69 out_be64(&spu->priv1->int_route_RW, route);
70}
71
72static u64 mfc_dar_get(struct spu *spu)
73{
74 return in_be64(&spu->priv1->mfc_dar_RW);
75}
76
77static u64 mfc_dsisr_get(struct spu *spu)
78{
79 return in_be64(&spu->priv1->mfc_dsisr_RW);
80}
81
82static void mfc_dsisr_set(struct spu *spu, u64 dsisr)
83{
84 out_be64(&spu->priv1->mfc_dsisr_RW, dsisr);
85}
86
87static void mfc_sdr_set(struct spu *spu, u64 sdr)
88{
89 out_be64(&spu->priv1->mfc_sdr_RW, sdr);
90}
91
92static void mfc_sr1_set(struct spu *spu, u64 sr1)
93{
94 out_be64(&spu->priv1->mfc_sr1_RW, sr1);
95}
96
97static u64 mfc_sr1_get(struct spu *spu)
98{
99 return in_be64(&spu->priv1->mfc_sr1_RW);
100}
101
102static void mfc_tclass_id_set(struct spu *spu, u64 tclass_id)
103{
104 out_be64(&spu->priv1->mfc_tclass_id_RW, tclass_id);
105}
106
107static u64 mfc_tclass_id_get(struct spu *spu)
108{
109 return in_be64(&spu->priv1->mfc_tclass_id_RW);
110}
111
112static void tlb_invalidate(struct spu *spu)
113{
114 out_be64(&spu->priv1->tlb_invalidate_entry_W, 0ul);
115}
116
117static void resource_allocation_groupID_set(struct spu *spu, u64 id)
118{
119 out_be64(&spu->priv1->resource_allocation_groupID_RW, id);
120}
121
122static u64 resource_allocation_groupID_get(struct spu *spu)
123{
124 return in_be64(&spu->priv1->resource_allocation_groupID_RW);
125}
126
127static void resource_allocation_enable_set(struct spu *spu, u64 enable)
128{
129 out_be64(&spu->priv1->resource_allocation_enable_RW, enable);
130}
131
132static u64 resource_allocation_enable_get(struct spu *spu)
133{
134 return in_be64(&spu->priv1->resource_allocation_enable_RW);
135}
136
137const struct spu_priv1_ops spu_priv1_mmio_ops =
138{
139 .int_mask_and = int_mask_and,
140 .int_mask_or = int_mask_or,
141 .int_mask_set = int_mask_set,
142 .int_mask_get = int_mask_get,
143 .int_stat_clear = int_stat_clear,
144 .int_stat_get = int_stat_get,
145 .cpu_affinity_set = cpu_affinity_set,
146 .mfc_dar_get = mfc_dar_get,
147 .mfc_dsisr_get = mfc_dsisr_get,
148 .mfc_dsisr_set = mfc_dsisr_set,
149 .mfc_sdr_set = mfc_sdr_set,
150 .mfc_sr1_set = mfc_sr1_set,
151 .mfc_sr1_get = mfc_sr1_get,
152 .mfc_tclass_id_set = mfc_tclass_id_set,
153 .mfc_tclass_id_get = mfc_tclass_id_get,
154 .tlb_invalidate = tlb_invalidate,
155 .resource_allocation_groupID_set = resource_allocation_groupID_set,
156 .resource_allocation_groupID_get = resource_allocation_groupID_get,
157 .resource_allocation_enable_set = resource_allocation_enable_set,
158 .resource_allocation_enable_get = resource_allocation_enable_get,
159};
diff --git a/arch/powerpc/platforms/cell/spufs/Makefile b/arch/powerpc/platforms/cell/spufs/Makefile
index a7cddf40e3d9..bb5dc634272c 100644
--- a/arch/powerpc/platforms/cell/spufs/Makefile
+++ b/arch/powerpc/platforms/cell/spufs/Makefile
@@ -1,5 +1,7 @@
1obj-y += switch.o
2
1obj-$(CONFIG_SPU_FS) += spufs.o 3obj-$(CONFIG_SPU_FS) += spufs.o
2spufs-y += inode.o file.o context.o switch.o syscalls.o 4spufs-y += inode.o file.o context.o syscalls.o
3spufs-y += sched.o backing_ops.o hw_ops.o run.o 5spufs-y += sched.o backing_ops.o hw_ops.o run.o
4 6
5# Rules to build switch.o with the help of SPU tool chain 7# Rules to build switch.o with the help of SPU tool chain
@@ -8,11 +10,14 @@ SPU_CC := $(SPU_CROSS)gcc
8SPU_AS := $(SPU_CROSS)gcc 10SPU_AS := $(SPU_CROSS)gcc
9SPU_LD := $(SPU_CROSS)ld 11SPU_LD := $(SPU_CROSS)ld
10SPU_OBJCOPY := $(SPU_CROSS)objcopy 12SPU_OBJCOPY := $(SPU_CROSS)objcopy
11SPU_CFLAGS := -O2 -Wall -I$(srctree)/include -I$(objtree)/include2 13SPU_CFLAGS := -O2 -Wall -I$(srctree)/include \
12SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include -I$(objtree)/include2 14 -I$(objtree)/include2 -D__KERNEL__
15SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include \
16 -I$(objtree)/include2 -D__KERNEL__
13SPU_LDFLAGS := -N -Ttext=0x0 17SPU_LDFLAGS := -N -Ttext=0x0
14 18
15$(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h 19$(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h
20clean-files := spu_save_dump.h spu_restore_dump.h
16 21
17# Compile SPU files 22# Compile SPU files
18 cmd_spu_cc = $(SPU_CC) $(SPU_CFLAGS) -c -o $@ $< 23 cmd_spu_cc = $(SPU_CC) $(SPU_CFLAGS) -c -o $@ $<
@@ -45,7 +50,8 @@ cmd_hexdump = ( \
45 echo " * Hex-dump auto generated from $*.c." ; \ 50 echo " * Hex-dump auto generated from $*.c." ; \
46 echo " * Do not edit!" ; \ 51 echo " * Do not edit!" ; \
47 echo " */" ; \ 52 echo " */" ; \
48 echo "static unsigned int $*_code[] __page_aligned = {" ; \ 53 echo "static unsigned int $*_code[] " \
54 "__attribute__((__aligned__(128))) = {" ; \
49 hexdump -v -e '"0x" 4/1 "%02x" "," "\n"' $< ; \ 55 hexdump -v -e '"0x" 4/1 "%02x" "," "\n"' $< ; \
50 echo "};" ; \ 56 echo "};" ; \
51 ) > $@ 57 ) > $@
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 8bb33abfad17..36439c5e9f2d 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -30,7 +30,7 @@
30struct spu_context *alloc_spu_context(void) 30struct spu_context *alloc_spu_context(void)
31{ 31{
32 struct spu_context *ctx; 32 struct spu_context *ctx;
33 ctx = kmalloc(sizeof *ctx, GFP_KERNEL); 33 ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
34 if (!ctx) 34 if (!ctx)
35 goto out; 35 goto out;
36 /* Binding to physical processor deferred 36 /* Binding to physical processor deferred
@@ -48,17 +48,7 @@ struct spu_context *alloc_spu_context(void)
48 init_waitqueue_head(&ctx->wbox_wq); 48 init_waitqueue_head(&ctx->wbox_wq);
49 init_waitqueue_head(&ctx->stop_wq); 49 init_waitqueue_head(&ctx->stop_wq);
50 init_waitqueue_head(&ctx->mfc_wq); 50 init_waitqueue_head(&ctx->mfc_wq);
51 ctx->ibox_fasync = NULL;
52 ctx->wbox_fasync = NULL;
53 ctx->mfc_fasync = NULL;
54 ctx->mfc = NULL;
55 ctx->tagwait = 0;
56 ctx->state = SPU_STATE_SAVED; 51 ctx->state = SPU_STATE_SAVED;
57 ctx->local_store = NULL;
58 ctx->cntl = NULL;
59 ctx->signal1 = NULL;
60 ctx->signal2 = NULL;
61 ctx->spu = NULL;
62 ctx->ops = &spu_backing_ops; 52 ctx->ops = &spu_backing_ops;
63 ctx->owner = get_task_mm(current); 53 ctx->owner = get_task_mm(current);
64 goto out; 54 goto out;
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 366185e92667..80c02660e617 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -825,6 +825,55 @@ DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
825 spufs_signal2_type_set, "%llu"); 825 spufs_signal2_type_set, "%llu");
826 826
827#ifdef CONFIG_SPUFS_MMAP 827#ifdef CONFIG_SPUFS_MMAP
828static struct page *spufs_mss_mmap_nopage(struct vm_area_struct *vma,
829 unsigned long address, int *type)
830{
831 return spufs_ps_nopage(vma, address, type, 0x0000);
832}
833
834static struct vm_operations_struct spufs_mss_mmap_vmops = {
835 .nopage = spufs_mss_mmap_nopage,
836};
837
838/*
839 * mmap support for problem state MFC DMA area [0x0000 - 0x0fff].
840 * Mapping this area requires that the application have CAP_SYS_RAWIO,
841 * as these registers require special care when read/writing.
842 */
843static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma)
844{
845 if (!(vma->vm_flags & VM_SHARED))
846 return -EINVAL;
847
848 if (!capable(CAP_SYS_RAWIO))
849 return -EPERM;
850
851 vma->vm_flags |= VM_RESERVED;
852 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
853 | _PAGE_NO_CACHE);
854
855 vma->vm_ops = &spufs_mss_mmap_vmops;
856 return 0;
857}
858#endif
859
860static int spufs_mss_open(struct inode *inode, struct file *file)
861{
862 struct spufs_inode_info *i = SPUFS_I(inode);
863
864 file->private_data = i->i_ctx;
865 return nonseekable_open(inode, file);
866}
867
868static struct file_operations spufs_mss_fops = {
869 .open = spufs_mss_open,
870#ifdef CONFIG_SPUFS_MMAP
871 .mmap = spufs_mss_mmap,
872#endif
873};
874
875
876#ifdef CONFIG_SPUFS_MMAP
828static struct page *spufs_mfc_mmap_nopage(struct vm_area_struct *vma, 877static struct page *spufs_mfc_mmap_nopage(struct vm_area_struct *vma,
829 unsigned long address, int *type) 878 unsigned long address, int *type)
830{ 879{
@@ -1279,6 +1328,22 @@ static u64 spufs_srr0_get(void *data)
1279DEFINE_SIMPLE_ATTRIBUTE(spufs_srr0_ops, spufs_srr0_get, spufs_srr0_set, 1328DEFINE_SIMPLE_ATTRIBUTE(spufs_srr0_ops, spufs_srr0_get, spufs_srr0_set,
1280 "%llx\n") 1329 "%llx\n")
1281 1330
1331static u64 spufs_id_get(void *data)
1332{
1333 struct spu_context *ctx = data;
1334 u64 num;
1335
1336 spu_acquire(ctx);
1337 if (ctx->state == SPU_STATE_RUNNABLE)
1338 num = ctx->spu->number;
1339 else
1340 num = (unsigned int)-1;
1341 spu_release(ctx);
1342
1343 return num;
1344}
1345DEFINE_SIMPLE_ATTRIBUTE(spufs_id_ops, spufs_id_get, 0, "0x%llx\n")
1346
1282struct tree_descr spufs_dir_contents[] = { 1347struct tree_descr spufs_dir_contents[] = {
1283 { "mem", &spufs_mem_fops, 0666, }, 1348 { "mem", &spufs_mem_fops, 0666, },
1284 { "regs", &spufs_regs_fops, 0666, }, 1349 { "regs", &spufs_regs_fops, 0666, },
@@ -1292,6 +1357,7 @@ struct tree_descr spufs_dir_contents[] = {
1292 { "signal2", &spufs_signal2_fops, 0666, }, 1357 { "signal2", &spufs_signal2_fops, 0666, },
1293 { "signal1_type", &spufs_signal1_type, 0666, }, 1358 { "signal1_type", &spufs_signal1_type, 0666, },
1294 { "signal2_type", &spufs_signal2_type, 0666, }, 1359 { "signal2_type", &spufs_signal2_type, 0666, },
1360 { "mss", &spufs_mss_fops, 0666, },
1295 { "mfc", &spufs_mfc_fops, 0666, }, 1361 { "mfc", &spufs_mfc_fops, 0666, },
1296 { "cntl", &spufs_cntl_fops, 0666, }, 1362 { "cntl", &spufs_cntl_fops, 0666, },
1297 { "npc", &spufs_npc_ops, 0666, }, 1363 { "npc", &spufs_npc_ops, 0666, },
@@ -1301,5 +1367,6 @@ struct tree_descr spufs_dir_contents[] = {
1301 { "spu_tag_mask", &spufs_spu_tag_mask_ops, 0666, }, 1367 { "spu_tag_mask", &spufs_spu_tag_mask_ops, 0666, },
1302 { "event_mask", &spufs_event_mask_ops, 0666, }, 1368 { "event_mask", &spufs_event_mask_ops, 0666, },
1303 { "srr0", &spufs_srr0_ops, 0666, }, 1369 { "srr0", &spufs_srr0_ops, 0666, },
1370 { "phys-id", &spufs_id_ops, 0666, },
1304 {}, 1371 {},
1305}; 1372};
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c
index a13a8b5a014d..ede2cac46b6d 100644
--- a/arch/powerpc/platforms/cell/spufs/hw_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c
@@ -32,6 +32,7 @@
32 32
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/spu.h> 34#include <asm/spu.h>
35#include <asm/spu_priv1.h>
35#include <asm/spu_csa.h> 36#include <asm/spu_csa.h>
36#include <asm/mmu_context.h> 37#include <asm/mmu_context.h>
37#include "spufs.h" 38#include "spufs.h"
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index d9554199afa7..7b4572805db9 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -157,20 +157,12 @@ static void spufs_prune_dir(struct dentry *dir)
157 mutex_unlock(&dir->d_inode->i_mutex); 157 mutex_unlock(&dir->d_inode->i_mutex);
158} 158}
159 159
160/* Caller must hold root->i_mutex */
160static int spufs_rmdir(struct inode *root, struct dentry *dir_dentry) 161static int spufs_rmdir(struct inode *root, struct dentry *dir_dentry)
161{ 162{
162 struct spu_context *ctx;
163
164 /* remove all entries */ 163 /* remove all entries */
165 mutex_lock(&root->i_mutex);
166 spufs_prune_dir(dir_dentry); 164 spufs_prune_dir(dir_dentry);
167 mutex_unlock(&root->i_mutex);
168
169 /* We have to give up the mm_struct */
170 ctx = SPUFS_I(dir_dentry->d_inode)->i_ctx;
171 spu_forget(ctx);
172 165
173 /* XXX Do we need to hold i_mutex here ? */
174 return simple_rmdir(root, dir_dentry); 166 return simple_rmdir(root, dir_dentry);
175} 167}
176 168
@@ -199,16 +191,23 @@ out:
199 191
200static int spufs_dir_close(struct inode *inode, struct file *file) 192static int spufs_dir_close(struct inode *inode, struct file *file)
201{ 193{
194 struct spu_context *ctx;
202 struct inode *dir; 195 struct inode *dir;
203 struct dentry *dentry; 196 struct dentry *dentry;
204 int ret; 197 int ret;
205 198
206 dentry = file->f_dentry; 199 dentry = file->f_dentry;
207 dir = dentry->d_parent->d_inode; 200 dir = dentry->d_parent->d_inode;
201 ctx = SPUFS_I(dentry->d_inode)->i_ctx;
208 202
203 mutex_lock(&dir->i_mutex);
209 ret = spufs_rmdir(dir, dentry); 204 ret = spufs_rmdir(dir, dentry);
205 mutex_unlock(&dir->i_mutex);
210 WARN_ON(ret); 206 WARN_ON(ret);
211 207
208 /* We have to give up the mm_struct */
209 spu_forget(ctx);
210
212 return dcache_dir_close(inode, file); 211 return dcache_dir_close(inode, file);
213} 212}
214 213
@@ -305,6 +304,10 @@ long spufs_create_thread(struct nameidata *nd,
305 nd->dentry != nd->dentry->d_sb->s_root) 304 nd->dentry != nd->dentry->d_sb->s_root)
306 goto out; 305 goto out;
307 306
307 /* all flags are reserved */
308 if (flags)
309 goto out;
310
308 dentry = lookup_create(nd, 1); 311 dentry = lookup_create(nd, 1);
309 ret = PTR_ERR(dentry); 312 ret = PTR_ERR(dentry);
310 if (IS_ERR(dentry)) 313 if (IS_ERR(dentry))
@@ -324,8 +327,13 @@ long spufs_create_thread(struct nameidata *nd,
324 * in error path of *_open(). 327 * in error path of *_open().
325 */ 328 */
326 ret = spufs_context_open(dget(dentry), mntget(nd->mnt)); 329 ret = spufs_context_open(dget(dentry), mntget(nd->mnt));
327 if (ret < 0) 330 if (ret < 0) {
328 spufs_rmdir(nd->dentry->d_inode, dentry); 331 WARN_ON(spufs_rmdir(nd->dentry->d_inode, dentry));
332 mutex_unlock(&nd->dentry->d_inode->i_mutex);
333 spu_forget(SPUFS_I(dentry->d_inode)->i_ctx);
334 dput(dentry);
335 goto out;
336 }
329 337
330out_dput: 338out_dput:
331 dput(dentry); 339 dput(dentry);
@@ -428,11 +436,11 @@ spufs_fill_super(struct super_block *sb, void *data, int silent)
428 return spufs_create_root(sb, data); 436 return spufs_create_root(sb, data);
429} 437}
430 438
431static struct super_block * 439static int
432spufs_get_sb(struct file_system_type *fstype, int flags, 440spufs_get_sb(struct file_system_type *fstype, int flags,
433 const char *name, void *data) 441 const char *name, void *data, struct vfsmount *mnt)
434{ 442{
435 return get_sb_single(fstype, flags, data, spufs_fill_super); 443 return get_sb_single(fstype, flags, data, spufs_fill_super, mnt);
436} 444}
437 445
438static struct file_system_type spufs_type = { 446static struct file_system_type spufs_type = {
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index bf652cd77000..3dcc5d8d66b9 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -43,6 +43,7 @@
43#include <asm/mmu_context.h> 43#include <asm/mmu_context.h>
44#include <asm/spu.h> 44#include <asm/spu.h>
45#include <asm/spu_csa.h> 45#include <asm/spu_csa.h>
46#include <asm/spu_priv1.h>
46#include "spufs.h" 47#include "spufs.h"
47 48
48#define SPU_MIN_TIMESLICE (100 * HZ / 1000) 49#define SPU_MIN_TIMESLICE (100 * HZ / 1000)
@@ -363,7 +364,7 @@ int spu_activate(struct spu_context *ctx, u64 flags)
363 * We're likely to wait for interrupts on the same 364 * We're likely to wait for interrupts on the same
364 * CPU that we are now on, so send them here. 365 * CPU that we are now on, so send them here.
365 */ 366 */
366 spu_irq_setaffinity(spu, raw_smp_processor_id()); 367 spu_cpu_affinity_set(spu, raw_smp_processor_id());
367 put_active_spu(spu); 368 put_active_spu(spu);
368 return 0; 369 return 0;
369} 370}
diff --git a/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped b/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
index 1b2355ff7036..15183d209b58 100644
--- a/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
+++ b/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
@@ -3,229 +3,901 @@
3 * Hex-dump auto generated from spu_restore.c. 3 * Hex-dump auto generated from spu_restore.c.
4 * Do not edit! 4 * Do not edit!
5 */ 5 */
6static unsigned int spu_restore_code[] __page_aligned = { 6static unsigned int spu_restore_code[] __attribute__((__aligned__(128))) = {
70x40800000, 0x409ff801, 0x24000080, 0x24fd8081, 70x40800000,
80x1cd80081, 0x33001180, 0x42030003, 0x33800284, 80x409ff801,
90x1c010204, 0x40200000, 0x40200000, 0x40200000, 90x24000080,
100x34000190, 0x34004191, 0x34008192, 0x3400c193, 100x24fd8081,
110x141fc205, 0x23fffd84, 0x1c100183, 0x217ffa85, 110x1cd80081,
120x3080a000, 0x3080a201, 0x3080a402, 0x3080a603, 120x33001180,
130x3080a804, 0x3080aa05, 0x3080ac06, 0x3080ae07, 130x42030003,
140x3080b008, 0x3080b209, 0x3080b40a, 0x3080b60b, 140x33800284,
150x3080b80c, 0x3080ba0d, 0x3080bc0e, 0x3080be0f, 150x1c010204,
160x00003ffc, 0x00000000, 0x00000000, 0x00000000, 160x40200000,
170x01a00182, 0x3ec00083, 0xb0a14103, 0x01a00204, 170x40200000,
180x3ec10082, 0x4202800e, 0x04000703, 0xb0a14202, 180x40200000,
190x21a00803, 0x3fbf028d, 0x3f20068d, 0x3fbe0682, 190x34000190,
200x3fe30102, 0x21a00882, 0x3f82028f, 0x3fe3078f, 200x34004191,
210x3fbf0784, 0x3f200204, 0x3fbe0204, 0x3fe30204, 210x34008192,
220x04000203, 0x21a00903, 0x40848002, 0x21a00982, 220x3400c193,
230x40800003, 0x21a00a03, 0x40802002, 0x21a00a82, 230x141fc205,
240x21a00083, 0x40800082, 0x21a00b02, 0x10002818, 240x23fffd84,
250x40a80002, 0x32800007, 0x4207000c, 0x18008208, 250x1c100183,
260x40a0000b, 0x4080020a, 0x40800709, 0x00200000, 260x217ffa85,
270x42070002, 0x3ac30384, 0x1cffc489, 0x00200000, 270x3080a000,
280x18008383, 0x38830382, 0x4cffc486, 0x3ac28185, 280x3080a201,
290xb0408584, 0x28830382, 0x1c020387, 0x38828182, 290x3080a402,
300xb0408405, 0x1802c408, 0x28828182, 0x217ff886, 300x3080a603,
310x04000583, 0x21a00803, 0x3fbe0682, 0x3fe30102, 310x3080a804,
320x04000106, 0x21a00886, 0x04000603, 0x21a00903, 320x3080aa05,
330x40803c02, 0x21a00982, 0x40800003, 0x04000184, 330x3080ac06,
340x21a00a04, 0x40802202, 0x21a00a82, 0x42028005, 340x3080ae07,
350x34208702, 0x21002282, 0x21a00804, 0x21a00886, 350x3080b008,
360x3fbf0782, 0x3f200102, 0x3fbe0102, 0x3fe30102, 360x3080b209,
370x21a00902, 0x40804003, 0x21a00983, 0x21a00a04, 370x3080b40a,
380x40805a02, 0x21a00a82, 0x40800083, 0x21a00b83, 380x3080b60b,
390x01a00c02, 0x01a00d83, 0x3420c282, 0x21a00e02, 390x3080b80c,
400x34210283, 0x21a00f03, 0x34200284, 0x77400200, 400x3080ba0d,
410x3421c282, 0x21a00702, 0x34218283, 0x21a00083, 410x3080bc0e,
420x34214282, 0x21a00b02, 0x4200480c, 0x00200000, 420x3080be0f,
430x1c010286, 0x34220284, 0x34220302, 0x0f608203, 430x00003ffc,
440x5c024204, 0x3b81810b, 0x42013c02, 0x00200000, 440x00000000,
450x18008185, 0x38808183, 0x3b814182, 0x21004e84, 450x00000000,
460x4020007f, 0x35000100, 0x000004e0, 0x000002a0, 460x00000000,
470x000002e8, 0x00000428, 0x00000360, 0x000002e8, 470x01a00182,
480x000004a0, 0x00000468, 0x000003c8, 0x00000360, 480x3ec00083,
490x409ffe02, 0x30801203, 0x40800204, 0x3ec40085, 490xb0a14103,
500x10009c09, 0x3ac10606, 0xb060c105, 0x4020007f, 500x01a00204,
510x4020007f, 0x20801203, 0x38810602, 0xb0408586, 510x3ec10082,
520x28810602, 0x32004180, 0x34204702, 0x21a00382, 520x4202800e,
530x4020007f, 0x327fdc80, 0x409ffe02, 0x30801203, 530x04000703,
540x40800204, 0x3ec40087, 0x40800405, 0x00200000, 540xb0a14202,
550x40800606, 0x3ac10608, 0x3ac14609, 0x3ac1860a, 550x21a00803,
560xb060c107, 0x20801203, 0x41004003, 0x38810602, 560x3fbf028d,
570x4020007f, 0xb0408188, 0x4020007f, 0x28810602, 570x3f20068d,
580x41201002, 0x38814603, 0x10009c09, 0xb060c109, 580x3fbe0682,
590x4020007f, 0x28814603, 0x41193f83, 0x38818602, 590x3fe30102,
600x60ffc003, 0xb040818a, 0x28818602, 0x32003080, 600x21a00882,
610x409ffe02, 0x30801203, 0x40800204, 0x3ec40087, 610x3f82028f,
620x41201008, 0x10009c14, 0x40800405, 0x3ac10609, 620x3fe3078f,
630x40800606, 0x3ac1460a, 0xb060c107, 0x3ac1860b, 630x3fbf0784,
640x20801203, 0x38810602, 0xb0408409, 0x28810602, 640x3f200204,
650x38814603, 0xb060c40a, 0x4020007f, 0x28814603, 650x3fbe0204,
660x41193f83, 0x38818602, 0x60ffc003, 0xb040818b, 660x3fe30204,
670x28818602, 0x32002380, 0x409ffe02, 0x30801204, 670x04000203,
680x40800205, 0x3ec40083, 0x40800406, 0x3ac14607, 680x21a00903,
690x3ac18608, 0xb0810103, 0x41004002, 0x20801204, 690x40848002,
700x4020007f, 0x38814603, 0x10009c0b, 0xb060c107, 700x21a00982,
710x4020007f, 0x4020007f, 0x28814603, 0x38818602, 710x40800003,
720x4020007f, 0x4020007f, 0xb0408588, 0x28818602, 720x21a00a03,
730x4020007f, 0x32001780, 0x409ffe02, 0x1000640e, 730x40802002,
740x40800204, 0x30801203, 0x40800405, 0x3ec40087, 740x21a00a82,
750x40800606, 0x3ac10608, 0x3ac14609, 0x3ac1860a, 750x21a00083,
760xb060c107, 0x20801203, 0x413d8003, 0x38810602, 760x40800082,
770x4020007f, 0x327fd780, 0x409ffe02, 0x10007f0c, 770x21a00b02,
780x40800205, 0x30801204, 0x40800406, 0x3ec40083, 780x10002818,
790x3ac14607, 0x3ac18608, 0xb0810103, 0x413d8002, 790x42a00002,
800x20801204, 0x38814603, 0x4020007f, 0x327feb80, 800x32800007,
810x409ffe02, 0x30801203, 0x40800204, 0x3ec40087, 810x4207000c,
820x40800405, 0x1000650a, 0x40800606, 0x3ac10608, 820x18008208,
830x3ac14609, 0x3ac1860a, 0xb060c107, 0x20801203, 830x40a0000b,
840x38810602, 0xb0408588, 0x4020007f, 0x327fc980, 840x4080020a,
850x00400000, 0x40800003, 0x4020007f, 0x35000000, 850x40800709,
860x00000000, 0x00000000, 0x00000000, 0x00000000, 860x00200000,
870x00000000, 0x00000000, 0x00000000, 0x00000000, 870x42070002,
880x00000000, 0x00000000, 0x00000000, 0x00000000, 880x3ac30384,
890x00000000, 0x00000000, 0x00000000, 0x00000000, 890x1cffc489,
900x00000000, 0x00000000, 0x00000000, 0x00000000, 900x00200000,
910x00000000, 0x00000000, 0x00000000, 0x00000000, 910x18008383,
920x00000000, 0x00000000, 0x00000000, 0x00000000, 920x38830382,
930x00000000, 0x00000000, 0x00000000, 0x00000000, 930x4cffc486,
940x00000000, 0x00000000, 0x00000000, 0x00000000, 940x3ac28185,
950x00000000, 0x00000000, 0x00000000, 0x00000000, 950xb0408584,
960x00000000, 0x00000000, 0x00000000, 0x00000000, 960x28830382,
970x00000000, 0x00000000, 0x00000000, 0x00000000, 970x1c020387,
980x00000000, 0x00000000, 0x00000000, 0x00000000, 980x38828182,
990x00000000, 0x00000000, 0x00000000, 0x00000000, 990xb0408405,
1000x00000000, 0x00000000, 0x00000000, 0x00000000, 1000x1802c408,
1010x00000000, 0x00000000, 0x00000000, 0x00000000, 1010x28828182,
1020x00000000, 0x00000000, 0x00000000, 0x00000000, 1020x217ff886,
1030x00000000, 0x00000000, 0x00000000, 0x00000000, 1030x04000583,
1040x00000000, 0x00000000, 0x00000000, 0x00000000, 1040x21a00803,
1050x00000000, 0x00000000, 0x00000000, 0x00000000, 1050x3fbe0682,
1060x00000000, 0x00000000, 0x00000000, 0x00000000, 1060x3fe30102,
1070x00000000, 0x00000000, 0x00000000, 0x00000000, 1070x04000106,
1080x00000000, 0x00000000, 0x00000000, 0x00000000, 1080x21a00886,
1090x00000000, 0x00000000, 0x00000000, 0x00000000, 1090x04000603,
1100x00000000, 0x00000000, 0x00000000, 0x00000000, 1100x21a00903,
1110x00000000, 0x00000000, 0x00000000, 0x00000000, 1110x40803c02,
1120x00000000, 0x00000000, 0x00000000, 0x00000000, 1120x21a00982,
1130x00000000, 0x00000000, 0x00000000, 0x00000000, 1130x40800003,
1140x00000000, 0x00000000, 0x00000000, 0x00000000, 1140x04000184,
1150x00000000, 0x00000000, 0x00000000, 0x00000000, 1150x21a00a04,
1160x00000000, 0x00000000, 0x00000000, 0x00000000, 1160x40802202,
1170x00000000, 0x00000000, 0x00000000, 0x00000000, 1170x21a00a82,
1180x00000000, 0x00000000, 0x00000000, 0x00000000, 1180x42028005,
1190x00000000, 0x00000000, 0x00000000, 0x00000000, 1190x34208702,
1200x00000000, 0x00000000, 0x00000000, 0x00000000, 1200x21002282,
1210x00000000, 0x00000000, 0x00000000, 0x00000000, 1210x21a00804,
1220x00000000, 0x00000000, 0x00000000, 0x00000000, 1220x21a00886,
1230x00000000, 0x00000000, 0x00000000, 0x00000000, 1230x3fbf0782,
1240x00000000, 0x00000000, 0x00000000, 0x00000000, 1240x3f200102,
1250x00000000, 0x00000000, 0x00000000, 0x00000000, 1250x3fbe0102,
1260x00000000, 0x00000000, 0x00000000, 0x00000000, 1260x3fe30102,
1270x00000000, 0x00000000, 0x00000000, 0x00000000, 1270x21a00902,
1280x00000000, 0x00000000, 0x00000000, 0x00000000, 1280x40804003,
1290x00000000, 0x00000000, 0x00000000, 0x00000000, 1290x21a00983,
1300x00000000, 0x00000000, 0x00000000, 0x00000000, 1300x21a00a04,
1310x00000000, 0x00000000, 0x00000000, 0x00000000, 1310x40805a02,
1320x00000000, 0x00000000, 0x00000000, 0x00000000, 1320x21a00a82,
1330x00000000, 0x00000000, 0x00000000, 0x00000000, 1330x40800083,
1340x00000000, 0x00000000, 0x00000000, 0x00000000, 1340x21a00b83,
1350x00000000, 0x00000000, 0x00000000, 0x00000000, 1350x01a00c02,
1360x00000000, 0x00000000, 0x00000000, 0x00000000, 1360x01a00d83,
1370x00000000, 0x00000000, 0x00000000, 0x00000000, 1370x3420c282,
1380x00000000, 0x00000000, 0x00000000, 0x00000000, 1380x21a00e02,
1390x00000000, 0x00000000, 0x00000000, 0x00000000, 1390x34210283,
1400x00000000, 0x00000000, 0x00000000, 0x00000000, 1400x21a00f03,
1410x00000000, 0x00000000, 0x00000000, 0x00000000, 1410x34200284,
1420x00000000, 0x00000000, 0x00000000, 0x00000000, 1420x77400200,
1430x00000000, 0x00000000, 0x00000000, 0x00000000, 1430x3421c282,
1440x00000000, 0x00000000, 0x00000000, 0x00000000, 1440x21a00702,
1450x00000000, 0x00000000, 0x00000000, 0x00000000, 1450x34218283,
1460x00000000, 0x00000000, 0x00000000, 0x00000000, 1460x21a00083,
1470x00000000, 0x00000000, 0x00000000, 0x00000000, 1470x34214282,
1480x00000000, 0x00000000, 0x00000000, 0x00000000, 1480x21a00b02,
1490x00000000, 0x00000000, 0x00000000, 0x00000000, 1490x4200480c,
1500x00000000, 0x00000000, 0x00000000, 0x00000000, 1500x00200000,
1510x00000000, 0x00000000, 0x00000000, 0x00000000, 1510x1c010286,
1520x00000000, 0x00000000, 0x00000000, 0x00000000, 1520x34220284,
1530x00000000, 0x00000000, 0x00000000, 0x00000000, 1530x34220302,
1540x00000000, 0x00000000, 0x00000000, 0x00000000, 1540x0f608203,
1550x00000000, 0x00000000, 0x00000000, 0x00000000, 1550x5c024204,
1560x00000000, 0x00000000, 0x00000000, 0x00000000, 1560x3b81810b,
1570x00000000, 0x00000000, 0x00000000, 0x00000000, 1570x42013c02,
1580x00000000, 0x00000000, 0x00000000, 0x00000000, 1580x00200000,
1590x00000000, 0x00000000, 0x00000000, 0x00000000, 1590x18008185,
1600x00000000, 0x00000000, 0x00000000, 0x00000000, 1600x38808183,
1610x00000000, 0x00000000, 0x00000000, 0x00000000, 1610x3b814182,
1620x00000000, 0x00000000, 0x00000000, 0x00000000, 1620x21004e84,
1630x00000000, 0x00000000, 0x00000000, 0x00000000, 1630x4020007f,
1640x00000000, 0x00000000, 0x00000000, 0x00000000, 1640x35000100,
1650x00000000, 0x00000000, 0x00000000, 0x00000000, 1650x000004e0,
1660x00000000, 0x00000000, 0x00000000, 0x00000000, 1660x000002a0,
1670x00000000, 0x00000000, 0x00000000, 0x00000000, 1670x000002e8,
1680x00000000, 0x00000000, 0x00000000, 0x00000000, 1680x00000428,
1690x00000000, 0x00000000, 0x00000000, 0x00000000, 1690x00000360,
1700x00000000, 0x00000000, 0x00000000, 0x00000000, 1700x000002e8,
1710x00000000, 0x00000000, 0x00000000, 0x00000000, 1710x000004a0,
1720x00000000, 0x00000000, 0x00000000, 0x00000000, 1720x00000468,
1730x00000000, 0x00000000, 0x00000000, 0x00000000, 1730x000003c8,
1740x00000000, 0x00000000, 0x00000000, 0x00000000, 1740x00000360,
1750x00000000, 0x00000000, 0x00000000, 0x00000000, 1750x409ffe02,
1760x00000000, 0x00000000, 0x00000000, 0x00000000, 1760x30801203,
1770x00000000, 0x00000000, 0x00000000, 0x00000000, 1770x40800204,
1780x00000000, 0x00000000, 0x00000000, 0x00000000, 1780x3ec40085,
1790x00000000, 0x00000000, 0x00000000, 0x00000000, 1790x10009c09,
1800x00000000, 0x00000000, 0x00000000, 0x00000000, 1800x3ac10606,
1810x00000000, 0x00000000, 0x00000000, 0x00000000, 1810xb060c105,
1820x00000000, 0x00000000, 0x00000000, 0x00000000, 1820x4020007f,
1830x00000000, 0x00000000, 0x00000000, 0x00000000, 1830x4020007f,
1840x00000000, 0x00000000, 0x00000000, 0x00000000, 1840x20801203,
1850x00000000, 0x00000000, 0x00000000, 0x00000000, 1850x38810602,
1860x00000000, 0x00000000, 0x00000000, 0x00000000, 1860xb0408586,
1870x00000000, 0x00000000, 0x00000000, 0x00000000, 1870x28810602,
1880x00000000, 0x00000000, 0x00000000, 0x00000000, 1880x32004180,
1890x00000000, 0x00000000, 0x00000000, 0x00000000, 1890x34204702,
1900x00000000, 0x00000000, 0x00000000, 0x00000000, 1900x21a00382,
1910x00000000, 0x00000000, 0x00000000, 0x00000000, 1910x4020007f,
1920x00000000, 0x00000000, 0x00000000, 0x00000000, 1920x327fdc80,
1930x00000000, 0x00000000, 0x00000000, 0x00000000, 1930x409ffe02,
1940x00000000, 0x00000000, 0x00000000, 0x00000000, 1940x30801203,
1950x00000000, 0x00000000, 0x00000000, 0x00000000, 1950x40800204,
1960x00000000, 0x00000000, 0x00000000, 0x00000000, 1960x3ec40087,
1970x00000000, 0x00000000, 0x00000000, 0x00000000, 1970x40800405,
1980x00000000, 0x00000000, 0x00000000, 0x00000000, 1980x00200000,
1990x00000000, 0x00000000, 0x00000000, 0x00000000, 1990x40800606,
2000x00000000, 0x00000000, 0x00000000, 0x00000000, 2000x3ac10608,
2010x00000000, 0x00000000, 0x00000000, 0x00000000, 2010x3ac14609,
2020x00000000, 0x00000000, 0x00000000, 0x00000000, 2020x3ac1860a,
2030x00000000, 0x00000000, 0x00000000, 0x00000000, 2030xb060c107,
2040x00000000, 0x00000000, 0x00000000, 0x00000000, 2040x20801203,
2050x00000000, 0x00000000, 0x00000000, 0x00000000, 2050x41004003,
2060x00000000, 0x00000000, 0x00000000, 0x00000000, 2060x38810602,
2070x00000000, 0x00000000, 0x00000000, 0x00000000, 2070x4020007f,
2080x00000000, 0x00000000, 0x00000000, 0x00000000, 2080xb0408188,
2090x00000000, 0x00000000, 0x00000000, 0x00000000, 2090x4020007f,
2100x00000000, 0x00000000, 0x00000000, 0x00000000, 2100x28810602,
2110x00000000, 0x00000000, 0x00000000, 0x00000000, 2110x41201002,
2120x00000000, 0x00000000, 0x00000000, 0x00000000, 2120x38814603,
2130x00000000, 0x00000000, 0x00000000, 0x00000000, 2130x10009c09,
2140x00000000, 0x00000000, 0x00000000, 0x00000000, 2140xb060c109,
2150x00000000, 0x00000000, 0x00000000, 0x00000000, 2150x4020007f,
2160x00000000, 0x00000000, 0x00000000, 0x00000000, 2160x28814603,
2170x00000000, 0x00000000, 0x00000000, 0x00000000, 2170x41193f83,
2180x00000000, 0x00000000, 0x00000000, 0x00000000, 2180x38818602,
2190x00000000, 0x00000000, 0x00000000, 0x00000000, 2190x60ffc003,
2200x00000000, 0x00000000, 0x00000000, 0x00000000, 2200xb040818a,
2210x00000000, 0x00000000, 0x00000000, 0x00000000, 2210x28818602,
2220x00000000, 0x00000000, 0x00000000, 0x00000000, 2220x32003080,
2230x00000000, 0x00000000, 0x00000000, 0x00000000, 2230x409ffe02,
2240x00000000, 0x00000000, 0x00000000, 0x00000000, 2240x30801203,
2250x00000000, 0x00000000, 0x00000000, 0x00000000, 2250x40800204,
2260x00000000, 0x00000000, 0x00000000, 0x00000000, 2260x3ec40087,
2270x00000000, 0x00000000, 0x00000000, 0x00000000, 2270x41201008,
2280x00000000, 0x00000000, 0x00000000, 0x00000000, 2280x10009c14,
2290x00000000, 0x00000000, 0x00000000, 0x00000000, 2290x40800405,
2300x00000000, 0x00000000, 0x00000000, 0x00000000, 2300x3ac10609,
2310x40800606,
2320x3ac1460a,
2330xb060c107,
2340x3ac1860b,
2350x20801203,
2360x38810602,
2370xb0408409,
2380x28810602,
2390x38814603,
2400xb060c40a,
2410x4020007f,
2420x28814603,
2430x41193f83,
2440x38818602,
2450x60ffc003,
2460xb040818b,
2470x28818602,
2480x32002380,
2490x409ffe02,
2500x30801204,
2510x40800205,
2520x3ec40083,
2530x40800406,
2540x3ac14607,
2550x3ac18608,
2560xb0810103,
2570x41004002,
2580x20801204,
2590x4020007f,
2600x38814603,
2610x10009c0b,
2620xb060c107,
2630x4020007f,
2640x4020007f,
2650x28814603,
2660x38818602,
2670x4020007f,
2680x4020007f,
2690xb0408588,
2700x28818602,
2710x4020007f,
2720x32001780,
2730x409ffe02,
2740x1000640e,
2750x40800204,
2760x30801203,
2770x40800405,
2780x3ec40087,
2790x40800606,
2800x3ac10608,
2810x3ac14609,
2820x3ac1860a,
2830xb060c107,
2840x20801203,
2850x413d8003,
2860x38810602,
2870x4020007f,
2880x327fd780,
2890x409ffe02,
2900x10007f0c,
2910x40800205,
2920x30801204,
2930x40800406,
2940x3ec40083,
2950x3ac14607,
2960x3ac18608,
2970xb0810103,
2980x413d8002,
2990x20801204,
3000x38814603,
3010x4020007f,
3020x327feb80,
3030x409ffe02,
3040x30801203,
3050x40800204,
3060x3ec40087,
3070x40800405,
3080x1000650a,
3090x40800606,
3100x3ac10608,
3110x3ac14609,
3120x3ac1860a,
3130xb060c107,
3140x20801203,
3150x38810602,
3160xb0408588,
3170x4020007f,
3180x327fc980,
3190x00400000,
3200x40800003,
3210x4020007f,
3220x35000000,
3230x00000000,
3240x00000000,
3250x00000000,
3260x00000000,
3270x00000000,
3280x00000000,
3290x00000000,
3300x00000000,
3310x00000000,
3320x00000000,
3330x00000000,
3340x00000000,
3350x00000000,
3360x00000000,
3370x00000000,
3380x00000000,
3390x00000000,
3400x00000000,
3410x00000000,
3420x00000000,
3430x00000000,
3440x00000000,
3450x00000000,
3460x00000000,
3470x00000000,
3480x00000000,
3490x00000000,
3500x00000000,
3510x00000000,
3520x00000000,
3530x00000000,
3540x00000000,
3550x00000000,
3560x00000000,
3570x00000000,
3580x00000000,
3590x00000000,
3600x00000000,
3610x00000000,
3620x00000000,
3630x00000000,
3640x00000000,
3650x00000000,
3660x00000000,
3670x00000000,
3680x00000000,
3690x00000000,
3700x00000000,
3710x00000000,
3720x00000000,
3730x00000000,
3740x00000000,
3750x00000000,
3760x00000000,
3770x00000000,
3780x00000000,
3790x00000000,
3800x00000000,
3810x00000000,
3820x00000000,
3830x00000000,
3840x00000000,
3850x00000000,
3860x00000000,
3870x00000000,
3880x00000000,
3890x00000000,
3900x00000000,
3910x00000000,
3920x00000000,
3930x00000000,
3940x00000000,
3950x00000000,
3960x00000000,
3970x00000000,
3980x00000000,
3990x00000000,
4000x00000000,
4010x00000000,
4020x00000000,
4030x00000000,
4040x00000000,
4050x00000000,
4060x00000000,
4070x00000000,
4080x00000000,
4090x00000000,
4100x00000000,
4110x00000000,
4120x00000000,
4130x00000000,
4140x00000000,
4150x00000000,
4160x00000000,
4170x00000000,
4180x00000000,
4190x00000000,
4200x00000000,
4210x00000000,
4220x00000000,
4230x00000000,
4240x00000000,
4250x00000000,
4260x00000000,
4270x00000000,
4280x00000000,
4290x00000000,
4300x00000000,
4310x00000000,
4320x00000000,
4330x00000000,
4340x00000000,
4350x00000000,
4360x00000000,
4370x00000000,
4380x00000000,
4390x00000000,
4400x00000000,
4410x00000000,
4420x00000000,
4430x00000000,
4440x00000000,
4450x00000000,
4460x00000000,
4470x00000000,
4480x00000000,
4490x00000000,
4500x00000000,
4510x00000000,
4520x00000000,
4530x00000000,
4540x00000000,
4550x00000000,
4560x00000000,
4570x00000000,
4580x00000000,
4590x00000000,
4600x00000000,
4610x00000000,
4620x00000000,
4630x00000000,
4640x00000000,
4650x00000000,
4660x00000000,
4670x00000000,
4680x00000000,
4690x00000000,
4700x00000000,
4710x00000000,
4720x00000000,
4730x00000000,
4740x00000000,
4750x00000000,
4760x00000000,
4770x00000000,
4780x00000000,
4790x00000000,
4800x00000000,
4810x00000000,
4820x00000000,
4830x00000000,
4840x00000000,
4850x00000000,
4860x00000000,
4870x00000000,
4880x00000000,
4890x00000000,
4900x00000000,
4910x00000000,
4920x00000000,
4930x00000000,
4940x00000000,
4950x00000000,
4960x00000000,
4970x00000000,
4980x00000000,
4990x00000000,
5000x00000000,
5010x00000000,
5020x00000000,
5030x00000000,
5040x00000000,
5050x00000000,
5060x00000000,
5070x00000000,
5080x00000000,
5090x00000000,
5100x00000000,
5110x00000000,
5120x00000000,
5130x00000000,
5140x00000000,
5150x00000000,
5160x00000000,
5170x00000000,
5180x00000000,
5190x00000000,
5200x00000000,
5210x00000000,
5220x00000000,
5230x00000000,
5240x00000000,
5250x00000000,
5260x00000000,
5270x00000000,
5280x00000000,
5290x00000000,
5300x00000000,
5310x00000000,
5320x00000000,
5330x00000000,
5340x00000000,
5350x00000000,
5360x00000000,
5370x00000000,
5380x00000000,
5390x00000000,
5400x00000000,
5410x00000000,
5420x00000000,
5430x00000000,
5440x00000000,
5450x00000000,
5460x00000000,
5470x00000000,
5480x00000000,
5490x00000000,
5500x00000000,
5510x00000000,
5520x00000000,
5530x00000000,
5540x00000000,
5550x00000000,
5560x00000000,
5570x00000000,
5580x00000000,
5590x00000000,
5600x00000000,
5610x00000000,
5620x00000000,
5630x00000000,
5640x00000000,
5650x00000000,
5660x00000000,
5670x00000000,
5680x00000000,
5690x00000000,
5700x00000000,
5710x00000000,
5720x00000000,
5730x00000000,
5740x00000000,
5750x00000000,
5760x00000000,
5770x00000000,
5780x00000000,
5790x00000000,
5800x00000000,
5810x00000000,
5820x00000000,
5830x00000000,
5840x00000000,
5850x00000000,
5860x00000000,
5870x00000000,
5880x00000000,
5890x00000000,
5900x00000000,
5910x00000000,
5920x00000000,
5930x00000000,
5940x00000000,
5950x00000000,
5960x00000000,
5970x00000000,
5980x00000000,
5990x00000000,
6000x00000000,
6010x00000000,
6020x00000000,
6030x00000000,
6040x00000000,
6050x00000000,
6060x00000000,
6070x00000000,
6080x00000000,
6090x00000000,
6100x00000000,
6110x00000000,
6120x00000000,
6130x00000000,
6140x00000000,
6150x00000000,
6160x00000000,
6170x00000000,
6180x00000000,
6190x00000000,
6200x00000000,
6210x00000000,
6220x00000000,
6230x00000000,
6240x00000000,
6250x00000000,
6260x00000000,
6270x00000000,
6280x00000000,
6290x00000000,
6300x00000000,
6310x00000000,
6320x00000000,
6330x00000000,
6340x00000000,
6350x00000000,
6360x00000000,
6370x00000000,
6380x00000000,
6390x00000000,
6400x00000000,
6410x00000000,
6420x00000000,
6430x00000000,
6440x00000000,
6450x00000000,
6460x00000000,
6470x00000000,
6480x00000000,
6490x00000000,
6500x00000000,
6510x00000000,
6520x00000000,
6530x00000000,
6540x00000000,
6550x00000000,
6560x00000000,
6570x00000000,
6580x00000000,
6590x00000000,
6600x00000000,
6610x00000000,
6620x00000000,
6630x00000000,
6640x00000000,
6650x00000000,
6660x00000000,
6670x00000000,
6680x00000000,
6690x00000000,
6700x00000000,
6710x00000000,
6720x00000000,
6730x00000000,
6740x00000000,
6750x00000000,
6760x00000000,
6770x00000000,
6780x00000000,
6790x00000000,
6800x00000000,
6810x00000000,
6820x00000000,
6830x00000000,
6840x00000000,
6850x00000000,
6860x00000000,
6870x00000000,
6880x00000000,
6890x00000000,
6900x00000000,
6910x00000000,
6920x00000000,
6930x00000000,
6940x00000000,
6950x00000000,
6960x00000000,
6970x00000000,
6980x00000000,
6990x00000000,
7000x00000000,
7010x00000000,
7020x00000000,
7030x00000000,
7040x00000000,
7050x00000000,
7060x00000000,
7070x00000000,
7080x00000000,
7090x00000000,
7100x00000000,
7110x00000000,
7120x00000000,
7130x00000000,
7140x00000000,
7150x00000000,
7160x00000000,
7170x00000000,
7180x00000000,
7190x00000000,
7200x00000000,
7210x00000000,
7220x00000000,
7230x00000000,
7240x00000000,
7250x00000000,
7260x00000000,
7270x00000000,
7280x00000000,
7290x00000000,
7300x00000000,
7310x00000000,
7320x00000000,
7330x00000000,
7340x00000000,
7350x00000000,
7360x00000000,
7370x00000000,
7380x00000000,
7390x00000000,
7400x00000000,
7410x00000000,
7420x00000000,
7430x00000000,
7440x00000000,
7450x00000000,
7460x00000000,
7470x00000000,
7480x00000000,
7490x00000000,
7500x00000000,
7510x00000000,
7520x00000000,
7530x00000000,
7540x00000000,
7550x00000000,
7560x00000000,
7570x00000000,
7580x00000000,
7590x00000000,
7600x00000000,
7610x00000000,
7620x00000000,
7630x00000000,
7640x00000000,
7650x00000000,
7660x00000000,
7670x00000000,
7680x00000000,
7690x00000000,
7700x00000000,
7710x00000000,
7720x00000000,
7730x00000000,
7740x00000000,
7750x00000000,
7760x00000000,
7770x00000000,
7780x00000000,
7790x00000000,
7800x00000000,
7810x00000000,
7820x00000000,
7830x00000000,
7840x00000000,
7850x00000000,
7860x00000000,
7870x00000000,
7880x00000000,
7890x00000000,
7900x00000000,
7910x00000000,
7920x00000000,
7930x00000000,
7940x00000000,
7950x00000000,
7960x00000000,
7970x00000000,
7980x00000000,
7990x00000000,
8000x00000000,
8010x00000000,
8020x00000000,
8030x00000000,
8040x00000000,
8050x00000000,
8060x00000000,
8070x00000000,
8080x00000000,
8090x00000000,
8100x00000000,
8110x00000000,
8120x00000000,
8130x00000000,
8140x00000000,
8150x00000000,
8160x00000000,
8170x00000000,
8180x00000000,
8190x00000000,
8200x00000000,
8210x00000000,
8220x00000000,
8230x00000000,
8240x00000000,
8250x00000000,
8260x00000000,
8270x00000000,
8280x00000000,
8290x00000000,
8300x00000000,
8310x00000000,
8320x00000000,
8330x00000000,
8340x00000000,
8350x00000000,
8360x00000000,
8370x00000000,
8380x00000000,
8390x00000000,
8400x00000000,
8410x00000000,
8420x00000000,
8430x00000000,
8440x00000000,
8450x00000000,
8460x00000000,
8470x00000000,
8480x00000000,
8490x00000000,
8500x00000000,
8510x00000000,
8520x00000000,
8530x00000000,
8540x00000000,
8550x00000000,
8560x00000000,
8570x00000000,
8580x00000000,
8590x00000000,
8600x00000000,
8610x00000000,
8620x00000000,
8630x00000000,
8640x00000000,
8650x00000000,
8660x00000000,
8670x00000000,
8680x00000000,
8690x00000000,
8700x00000000,
8710x00000000,
8720x00000000,
8730x00000000,
8740x00000000,
8750x00000000,
8760x00000000,
8770x00000000,
8780x00000000,
8790x00000000,
8800x00000000,
8810x00000000,
8820x00000000,
8830x00000000,
8840x00000000,
8850x00000000,
8860x00000000,
8870x00000000,
8880x00000000,
8890x00000000,
8900x00000000,
8910x00000000,
8920x00000000,
8930x00000000,
8940x00000000,
8950x00000000,
8960x00000000,
8970x00000000,
8980x00000000,
8990x00000000,
9000x00000000,
9010x00000000,
9020x00000000,
231}; 903};
diff --git a/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped b/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
index 39e54003f1df..b9f81ac8a632 100644
--- a/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
+++ b/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
@@ -3,189 +3,741 @@
3 * Hex-dump auto generated from spu_save.c. 3 * Hex-dump auto generated from spu_save.c.
4 * Do not edit! 4 * Do not edit!
5 */ 5 */
6static unsigned int spu_save_code[] __page_aligned = { 6static unsigned int spu_save_code[] __attribute__((__aligned__(128))) = {
70x20805000, 0x20805201, 0x20805402, 0x20805603, 70x20805000,
80x20805804, 0x20805a05, 0x20805c06, 0x20805e07, 80x20805201,
90x20806008, 0x20806209, 0x2080640a, 0x2080660b, 90x20805402,
100x2080680c, 0x20806a0d, 0x20806c0e, 0x20806e0f, 100x20805603,
110x4201c003, 0x33800184, 0x1c010204, 0x40200000, 110x20805804,
120x24000190, 0x24004191, 0x24008192, 0x2400c193, 120x20805a05,
130x141fc205, 0x23fffd84, 0x1c100183, 0x217ffb85, 130x20805c06,
140x40800000, 0x409ff801, 0x24000080, 0x24fd8081, 140x20805e07,
150x1cd80081, 0x33000180, 0x00000000, 0x00000000, 150x20806008,
160x01a00182, 0x3ec00083, 0xb1c38103, 0x01a00204, 160x20806209,
170x3ec10082, 0x4201400d, 0xb1c38202, 0x01a00583, 170x2080640a,
180x34218682, 0x3ed80684, 0xb0408184, 0x24218682, 180x2080660b,
190x01a00603, 0x00200000, 0x34214682, 0x3ed40684, 190x2080680c,
200xb0408184, 0x40800003, 0x24214682, 0x21a00083, 200x20806a0d,
210x40800082, 0x21a00b02, 0x4020007f, 0x1000251e, 210x20806c0e,
220x40a80002, 0x32800008, 0x4205c00c, 0x00200000, 220x20806e0f,
230x40a0000b, 0x3f82070f, 0x4080020a, 0x40800709, 230x4201c003,
240x3fe3078f, 0x3fbf0783, 0x3f200183, 0x3fbe0183, 240x33800184,
250x3fe30187, 0x18008387, 0x4205c002, 0x3ac30404, 250x1c010204,
260x1cffc489, 0x00200000, 0x18008403, 0x38830402, 260x40200000,
270x4cffc486, 0x3ac28185, 0xb0408584, 0x28830402, 270x24000190,
280x1c020408, 0x38828182, 0xb0408385, 0x1802c387, 280x24004191,
290x28828182, 0x217ff886, 0x04000582, 0x32800007, 290x24008192,
300x21a00802, 0x3fbf0705, 0x3f200285, 0x3fbe0285, 300x2400c193,
310x3fe30285, 0x21a00885, 0x04000603, 0x21a00903, 310x141fc205,
320x40803c02, 0x21a00982, 0x04000386, 0x21a00a06, 320x23fffd84,
330x40801202, 0x21a00a82, 0x73000003, 0x24200683, 330x1c100183,
340x01a00404, 0x00200000, 0x34204682, 0x3ec40683, 340x217ffb85,
350xb0408203, 0x24204682, 0x01a00783, 0x00200000, 350x40800000,
360x3421c682, 0x3edc0684, 0xb0408184, 0x2421c682, 360x409ff801,
370x21a00806, 0x21a00885, 0x3fbf0784, 0x3f200204, 370x24000080,
380x3fbe0204, 0x3fe30204, 0x21a00904, 0x40804002, 380x24fd8081,
390x21a00982, 0x21a00a06, 0x40805a02, 0x21a00a82, 390x1cd80081,
400x04000683, 0x21a00803, 0x21a00885, 0x21a00904, 400x33000180,
410x40848002, 0x21a00982, 0x21a00a06, 0x40801002, 410x00000000,
420x21a00a82, 0x21a00a06, 0x40806602, 0x00200000, 420x00000000,
430x35800009, 0x21a00a82, 0x40800083, 0x21a00b83, 430x01a00182,
440x01a00c02, 0x01a00d83, 0x00003ffb, 0x40800003, 440x3ec00083,
450x4020007f, 0x35000000, 0x00000000, 0x00000000, 450xb1c38103,
460x00000000, 0x00000000, 0x00000000, 0x00000000, 460x01a00204,
470x00000000, 0x00000000, 0x00000000, 0x00000000, 470x3ec10082,
480x00000000, 0x00000000, 0x00000000, 0x00000000, 480x4201400d,
490x00000000, 0x00000000, 0x00000000, 0x00000000, 490xb1c38202,
500x00000000, 0x00000000, 0x00000000, 0x00000000, 500x01a00583,
510x00000000, 0x00000000, 0x00000000, 0x00000000, 510x34218682,
520x00000000, 0x00000000, 0x00000000, 0x00000000, 520x3ed80684,
530x00000000, 0x00000000, 0x00000000, 0x00000000, 530xb0408184,
540x00000000, 0x00000000, 0x00000000, 0x00000000, 540x24218682,
550x00000000, 0x00000000, 0x00000000, 0x00000000, 550x01a00603,
560x00000000, 0x00000000, 0x00000000, 0x00000000, 560x00200000,
570x00000000, 0x00000000, 0x00000000, 0x00000000, 570x34214682,
580x00000000, 0x00000000, 0x00000000, 0x00000000, 580x3ed40684,
590x00000000, 0x00000000, 0x00000000, 0x00000000, 590xb0408184,
600x00000000, 0x00000000, 0x00000000, 0x00000000, 600x40800003,
610x00000000, 0x00000000, 0x00000000, 0x00000000, 610x24214682,
620x00000000, 0x00000000, 0x00000000, 0x00000000, 620x21a00083,
630x00000000, 0x00000000, 0x00000000, 0x00000000, 630x40800082,
640x00000000, 0x00000000, 0x00000000, 0x00000000, 640x21a00b02,
650x00000000, 0x00000000, 0x00000000, 0x00000000, 650x4020007f,
660x00000000, 0x00000000, 0x00000000, 0x00000000, 660x1000251e,
670x00000000, 0x00000000, 0x00000000, 0x00000000, 670x42a00002,
680x00000000, 0x00000000, 0x00000000, 0x00000000, 680x32800008,
690x00000000, 0x00000000, 0x00000000, 0x00000000, 690x4205c00c,
700x00000000, 0x00000000, 0x00000000, 0x00000000, 700x00200000,
710x00000000, 0x00000000, 0x00000000, 0x00000000, 710x40a0000b,
720x00000000, 0x00000000, 0x00000000, 0x00000000, 720x3f82070f,
730x00000000, 0x00000000, 0x00000000, 0x00000000, 730x4080020a,
740x00000000, 0x00000000, 0x00000000, 0x00000000, 740x40800709,
750x00000000, 0x00000000, 0x00000000, 0x00000000, 750x3fe3078f,
760x00000000, 0x00000000, 0x00000000, 0x00000000, 760x3fbf0783,
770x00000000, 0x00000000, 0x00000000, 0x00000000, 770x3f200183,
780x00000000, 0x00000000, 0x00000000, 0x00000000, 780x3fbe0183,
790x00000000, 0x00000000, 0x00000000, 0x00000000, 790x3fe30187,
800x00000000, 0x00000000, 0x00000000, 0x00000000, 800x18008387,
810x00000000, 0x00000000, 0x00000000, 0x00000000, 810x4205c002,
820x00000000, 0x00000000, 0x00000000, 0x00000000, 820x3ac30404,
830x00000000, 0x00000000, 0x00000000, 0x00000000, 830x1cffc489,
840x00000000, 0x00000000, 0x00000000, 0x00000000, 840x00200000,
850x00000000, 0x00000000, 0x00000000, 0x00000000, 850x18008403,
860x00000000, 0x00000000, 0x00000000, 0x00000000, 860x38830402,
870x00000000, 0x00000000, 0x00000000, 0x00000000, 870x4cffc486,
880x00000000, 0x00000000, 0x00000000, 0x00000000, 880x3ac28185,
890x00000000, 0x00000000, 0x00000000, 0x00000000, 890xb0408584,
900x00000000, 0x00000000, 0x00000000, 0x00000000, 900x28830402,
910x00000000, 0x00000000, 0x00000000, 0x00000000, 910x1c020408,
920x00000000, 0x00000000, 0x00000000, 0x00000000, 920x38828182,
930x00000000, 0x00000000, 0x00000000, 0x00000000, 930xb0408385,
940x00000000, 0x00000000, 0x00000000, 0x00000000, 940x1802c387,
950x00000000, 0x00000000, 0x00000000, 0x00000000, 950x28828182,
960x00000000, 0x00000000, 0x00000000, 0x00000000, 960x217ff886,
970x00000000, 0x00000000, 0x00000000, 0x00000000, 970x04000582,
980x00000000, 0x00000000, 0x00000000, 0x00000000, 980x32800007,
990x00000000, 0x00000000, 0x00000000, 0x00000000, 990x21a00802,
1000x00000000, 0x00000000, 0x00000000, 0x00000000, 1000x3fbf0705,
1010x00000000, 0x00000000, 0x00000000, 0x00000000, 1010x3f200285,
1020x00000000, 0x00000000, 0x00000000, 0x00000000, 1020x3fbe0285,
1030x00000000, 0x00000000, 0x00000000, 0x00000000, 1030x3fe30285,
1040x00000000, 0x00000000, 0x00000000, 0x00000000, 1040x21a00885,
1050x00000000, 0x00000000, 0x00000000, 0x00000000, 1050x04000603,
1060x00000000, 0x00000000, 0x00000000, 0x00000000, 1060x21a00903,
1070x00000000, 0x00000000, 0x00000000, 0x00000000, 1070x40803c02,
1080x00000000, 0x00000000, 0x00000000, 0x00000000, 1080x21a00982,
1090x00000000, 0x00000000, 0x00000000, 0x00000000, 1090x04000386,
1100x00000000, 0x00000000, 0x00000000, 0x00000000, 1100x21a00a06,
1110x00000000, 0x00000000, 0x00000000, 0x00000000, 1110x40801202,
1120x00000000, 0x00000000, 0x00000000, 0x00000000, 1120x21a00a82,
1130x00000000, 0x00000000, 0x00000000, 0x00000000, 1130x73000003,
1140x00000000, 0x00000000, 0x00000000, 0x00000000, 1140x24200683,
1150x00000000, 0x00000000, 0x00000000, 0x00000000, 1150x01a00404,
1160x00000000, 0x00000000, 0x00000000, 0x00000000, 1160x00200000,
1170x00000000, 0x00000000, 0x00000000, 0x00000000, 1170x34204682,
1180x00000000, 0x00000000, 0x00000000, 0x00000000, 1180x3ec40683,
1190x00000000, 0x00000000, 0x00000000, 0x00000000, 1190xb0408203,
1200x00000000, 0x00000000, 0x00000000, 0x00000000, 1200x24204682,
1210x00000000, 0x00000000, 0x00000000, 0x00000000, 1210x01a00783,
1220x00000000, 0x00000000, 0x00000000, 0x00000000, 1220x00200000,
1230x00000000, 0x00000000, 0x00000000, 0x00000000, 1230x3421c682,
1240x00000000, 0x00000000, 0x00000000, 0x00000000, 1240x3edc0684,
1250x00000000, 0x00000000, 0x00000000, 0x00000000, 1250xb0408184,
1260x00000000, 0x00000000, 0x00000000, 0x00000000, 1260x2421c682,
1270x00000000, 0x00000000, 0x00000000, 0x00000000, 1270x21a00806,
1280x00000000, 0x00000000, 0x00000000, 0x00000000, 1280x21a00885,
1290x00000000, 0x00000000, 0x00000000, 0x00000000, 1290x3fbf0784,
1300x00000000, 0x00000000, 0x00000000, 0x00000000, 1300x3f200204,
1310x00000000, 0x00000000, 0x00000000, 0x00000000, 1310x3fbe0204,
1320x00000000, 0x00000000, 0x00000000, 0x00000000, 1320x3fe30204,
1330x00000000, 0x00000000, 0x00000000, 0x00000000, 1330x21a00904,
1340x00000000, 0x00000000, 0x00000000, 0x00000000, 1340x40804002,
1350x00000000, 0x00000000, 0x00000000, 0x00000000, 1350x21a00982,
1360x00000000, 0x00000000, 0x00000000, 0x00000000, 1360x21a00a06,
1370x00000000, 0x00000000, 0x00000000, 0x00000000, 1370x40805a02,
1380x00000000, 0x00000000, 0x00000000, 0x00000000, 1380x21a00a82,
1390x00000000, 0x00000000, 0x00000000, 0x00000000, 1390x04000683,
1400x00000000, 0x00000000, 0x00000000, 0x00000000, 1400x21a00803,
1410x00000000, 0x00000000, 0x00000000, 0x00000000, 1410x21a00885,
1420x00000000, 0x00000000, 0x00000000, 0x00000000, 1420x21a00904,
1430x00000000, 0x00000000, 0x00000000, 0x00000000, 1430x40848002,
1440x00000000, 0x00000000, 0x00000000, 0x00000000, 1440x21a00982,
1450x00000000, 0x00000000, 0x00000000, 0x00000000, 1450x21a00a06,
1460x00000000, 0x00000000, 0x00000000, 0x00000000, 1460x40801002,
1470x00000000, 0x00000000, 0x00000000, 0x00000000, 1470x21a00a82,
1480x00000000, 0x00000000, 0x00000000, 0x00000000, 1480x21a00a06,
1490x00000000, 0x00000000, 0x00000000, 0x00000000, 1490x40806602,
1500x00000000, 0x00000000, 0x00000000, 0x00000000, 1500x00200000,
1510x00000000, 0x00000000, 0x00000000, 0x00000000, 1510x35800009,
1520x00000000, 0x00000000, 0x00000000, 0x00000000, 1520x21a00a82,
1530x00000000, 0x00000000, 0x00000000, 0x00000000, 1530x40800083,
1540x00000000, 0x00000000, 0x00000000, 0x00000000, 1540x21a00b83,
1550x00000000, 0x00000000, 0x00000000, 0x00000000, 1550x01a00c02,
1560x00000000, 0x00000000, 0x00000000, 0x00000000, 1560x01a00d83,
1570x00000000, 0x00000000, 0x00000000, 0x00000000, 1570x00003ffb,
1580x00000000, 0x00000000, 0x00000000, 0x00000000, 1580x40800003,
1590x00000000, 0x00000000, 0x00000000, 0x00000000, 1590x4020007f,
1600x00000000, 0x00000000, 0x00000000, 0x00000000, 1600x35000000,
1610x00000000, 0x00000000, 0x00000000, 0x00000000, 1610x00000000,
1620x00000000, 0x00000000, 0x00000000, 0x00000000, 1620x00000000,
1630x00000000, 0x00000000, 0x00000000, 0x00000000, 1630x00000000,
1640x00000000, 0x00000000, 0x00000000, 0x00000000, 1640x00000000,
1650x00000000, 0x00000000, 0x00000000, 0x00000000, 1650x00000000,
1660x00000000, 0x00000000, 0x00000000, 0x00000000, 1660x00000000,
1670x00000000, 0x00000000, 0x00000000, 0x00000000, 1670x00000000,
1680x00000000, 0x00000000, 0x00000000, 0x00000000, 1680x00000000,
1690x00000000, 0x00000000, 0x00000000, 0x00000000, 1690x00000000,
1700x00000000, 0x00000000, 0x00000000, 0x00000000, 1700x00000000,
1710x00000000, 0x00000000, 0x00000000, 0x00000000, 1710x00000000,
1720x00000000, 0x00000000, 0x00000000, 0x00000000, 1720x00000000,
1730x00000000, 0x00000000, 0x00000000, 0x00000000, 1730x00000000,
1740x00000000, 0x00000000, 0x00000000, 0x00000000, 1740x00000000,
1750x00000000, 0x00000000, 0x00000000, 0x00000000, 1750x00000000,
1760x00000000, 0x00000000, 0x00000000, 0x00000000, 1760x00000000,
1770x00000000, 0x00000000, 0x00000000, 0x00000000, 1770x00000000,
1780x00000000, 0x00000000, 0x00000000, 0x00000000, 1780x00000000,
1790x00000000, 0x00000000, 0x00000000, 0x00000000, 1790x00000000,
1800x00000000, 0x00000000, 0x00000000, 0x00000000, 1800x00000000,
1810x00000000, 0x00000000, 0x00000000, 0x00000000, 1810x00000000,
1820x00000000, 0x00000000, 0x00000000, 0x00000000, 1820x00000000,
1830x00000000, 0x00000000, 0x00000000, 0x00000000, 1830x00000000,
1840x00000000, 0x00000000, 0x00000000, 0x00000000, 1840x00000000,
1850x00000000, 0x00000000, 0x00000000, 0x00000000, 1850x00000000,
1860x00000000, 0x00000000, 0x00000000, 0x00000000, 1860x00000000,
1870x00000000, 0x00000000, 0x00000000, 0x00000000, 1870x00000000,
1880x00000000, 0x00000000, 0x00000000, 0x00000000, 1880x00000000,
1890x00000000, 0x00000000, 0x00000000, 0x00000000, 1890x00000000,
1900x00000000, 0x00000000, 0x00000000, 0x00000000, 1900x00000000,
1910x00000000,
1920x00000000,
1930x00000000,
1940x00000000,
1950x00000000,
1960x00000000,
1970x00000000,
1980x00000000,
1990x00000000,
2000x00000000,
2010x00000000,
2020x00000000,
2030x00000000,
2040x00000000,
2050x00000000,
2060x00000000,
2070x00000000,
2080x00000000,
2090x00000000,
2100x00000000,
2110x00000000,
2120x00000000,
2130x00000000,
2140x00000000,
2150x00000000,
2160x00000000,
2170x00000000,
2180x00000000,
2190x00000000,
2200x00000000,
2210x00000000,
2220x00000000,
2230x00000000,
2240x00000000,
2250x00000000,
2260x00000000,
2270x00000000,
2280x00000000,
2290x00000000,
2300x00000000,
2310x00000000,
2320x00000000,
2330x00000000,
2340x00000000,
2350x00000000,
2360x00000000,
2370x00000000,
2380x00000000,
2390x00000000,
2400x00000000,
2410x00000000,
2420x00000000,
2430x00000000,
2440x00000000,
2450x00000000,
2460x00000000,
2470x00000000,
2480x00000000,
2490x00000000,
2500x00000000,
2510x00000000,
2520x00000000,
2530x00000000,
2540x00000000,
2550x00000000,
2560x00000000,
2570x00000000,
2580x00000000,
2590x00000000,
2600x00000000,
2610x00000000,
2620x00000000,
2630x00000000,
2640x00000000,
2650x00000000,
2660x00000000,
2670x00000000,
2680x00000000,
2690x00000000,
2700x00000000,
2710x00000000,
2720x00000000,
2730x00000000,
2740x00000000,
2750x00000000,
2760x00000000,
2770x00000000,
2780x00000000,
2790x00000000,
2800x00000000,
2810x00000000,
2820x00000000,
2830x00000000,
2840x00000000,
2850x00000000,
2860x00000000,
2870x00000000,
2880x00000000,
2890x00000000,
2900x00000000,
2910x00000000,
2920x00000000,
2930x00000000,
2940x00000000,
2950x00000000,
2960x00000000,
2970x00000000,
2980x00000000,
2990x00000000,
3000x00000000,
3010x00000000,
3020x00000000,
3030x00000000,
3040x00000000,
3050x00000000,
3060x00000000,
3070x00000000,
3080x00000000,
3090x00000000,
3100x00000000,
3110x00000000,
3120x00000000,
3130x00000000,
3140x00000000,
3150x00000000,
3160x00000000,
3170x00000000,
3180x00000000,
3190x00000000,
3200x00000000,
3210x00000000,
3220x00000000,
3230x00000000,
3240x00000000,
3250x00000000,
3260x00000000,
3270x00000000,
3280x00000000,
3290x00000000,
3300x00000000,
3310x00000000,
3320x00000000,
3330x00000000,
3340x00000000,
3350x00000000,
3360x00000000,
3370x00000000,
3380x00000000,
3390x00000000,
3400x00000000,
3410x00000000,
3420x00000000,
3430x00000000,
3440x00000000,
3450x00000000,
3460x00000000,
3470x00000000,
3480x00000000,
3490x00000000,
3500x00000000,
3510x00000000,
3520x00000000,
3530x00000000,
3540x00000000,
3550x00000000,
3560x00000000,
3570x00000000,
3580x00000000,
3590x00000000,
3600x00000000,
3610x00000000,
3620x00000000,
3630x00000000,
3640x00000000,
3650x00000000,
3660x00000000,
3670x00000000,
3680x00000000,
3690x00000000,
3700x00000000,
3710x00000000,
3720x00000000,
3730x00000000,
3740x00000000,
3750x00000000,
3760x00000000,
3770x00000000,
3780x00000000,
3790x00000000,
3800x00000000,
3810x00000000,
3820x00000000,
3830x00000000,
3840x00000000,
3850x00000000,
3860x00000000,
3870x00000000,
3880x00000000,
3890x00000000,
3900x00000000,
3910x00000000,
3920x00000000,
3930x00000000,
3940x00000000,
3950x00000000,
3960x00000000,
3970x00000000,
3980x00000000,
3990x00000000,
4000x00000000,
4010x00000000,
4020x00000000,
4030x00000000,
4040x00000000,
4050x00000000,
4060x00000000,
4070x00000000,
4080x00000000,
4090x00000000,
4100x00000000,
4110x00000000,
4120x00000000,
4130x00000000,
4140x00000000,
4150x00000000,
4160x00000000,
4170x00000000,
4180x00000000,
4190x00000000,
4200x00000000,
4210x00000000,
4220x00000000,
4230x00000000,
4240x00000000,
4250x00000000,
4260x00000000,
4270x00000000,
4280x00000000,
4290x00000000,
4300x00000000,
4310x00000000,
4320x00000000,
4330x00000000,
4340x00000000,
4350x00000000,
4360x00000000,
4370x00000000,
4380x00000000,
4390x00000000,
4400x00000000,
4410x00000000,
4420x00000000,
4430x00000000,
4440x00000000,
4450x00000000,
4460x00000000,
4470x00000000,
4480x00000000,
4490x00000000,
4500x00000000,
4510x00000000,
4520x00000000,
4530x00000000,
4540x00000000,
4550x00000000,
4560x00000000,
4570x00000000,
4580x00000000,
4590x00000000,
4600x00000000,
4610x00000000,
4620x00000000,
4630x00000000,
4640x00000000,
4650x00000000,
4660x00000000,
4670x00000000,
4680x00000000,
4690x00000000,
4700x00000000,
4710x00000000,
4720x00000000,
4730x00000000,
4740x00000000,
4750x00000000,
4760x00000000,
4770x00000000,
4780x00000000,
4790x00000000,
4800x00000000,
4810x00000000,
4820x00000000,
4830x00000000,
4840x00000000,
4850x00000000,
4860x00000000,
4870x00000000,
4880x00000000,
4890x00000000,
4900x00000000,
4910x00000000,
4920x00000000,
4930x00000000,
4940x00000000,
4950x00000000,
4960x00000000,
4970x00000000,
4980x00000000,
4990x00000000,
5000x00000000,
5010x00000000,
5020x00000000,
5030x00000000,
5040x00000000,
5050x00000000,
5060x00000000,
5070x00000000,
5080x00000000,
5090x00000000,
5100x00000000,
5110x00000000,
5120x00000000,
5130x00000000,
5140x00000000,
5150x00000000,
5160x00000000,
5170x00000000,
5180x00000000,
5190x00000000,
5200x00000000,
5210x00000000,
5220x00000000,
5230x00000000,
5240x00000000,
5250x00000000,
5260x00000000,
5270x00000000,
5280x00000000,
5290x00000000,
5300x00000000,
5310x00000000,
5320x00000000,
5330x00000000,
5340x00000000,
5350x00000000,
5360x00000000,
5370x00000000,
5380x00000000,
5390x00000000,
5400x00000000,
5410x00000000,
5420x00000000,
5430x00000000,
5440x00000000,
5450x00000000,
5460x00000000,
5470x00000000,
5480x00000000,
5490x00000000,
5500x00000000,
5510x00000000,
5520x00000000,
5530x00000000,
5540x00000000,
5550x00000000,
5560x00000000,
5570x00000000,
5580x00000000,
5590x00000000,
5600x00000000,
5610x00000000,
5620x00000000,
5630x00000000,
5640x00000000,
5650x00000000,
5660x00000000,
5670x00000000,
5680x00000000,
5690x00000000,
5700x00000000,
5710x00000000,
5720x00000000,
5730x00000000,
5740x00000000,
5750x00000000,
5760x00000000,
5770x00000000,
5780x00000000,
5790x00000000,
5800x00000000,
5810x00000000,
5820x00000000,
5830x00000000,
5840x00000000,
5850x00000000,
5860x00000000,
5870x00000000,
5880x00000000,
5890x00000000,
5900x00000000,
5910x00000000,
5920x00000000,
5930x00000000,
5940x00000000,
5950x00000000,
5960x00000000,
5970x00000000,
5980x00000000,
5990x00000000,
6000x00000000,
6010x00000000,
6020x00000000,
6030x00000000,
6040x00000000,
6050x00000000,
6060x00000000,
6070x00000000,
6080x00000000,
6090x00000000,
6100x00000000,
6110x00000000,
6120x00000000,
6130x00000000,
6140x00000000,
6150x00000000,
6160x00000000,
6170x00000000,
6180x00000000,
6190x00000000,
6200x00000000,
6210x00000000,
6220x00000000,
6230x00000000,
6240x00000000,
6250x00000000,
6260x00000000,
6270x00000000,
6280x00000000,
6290x00000000,
6300x00000000,
6310x00000000,
6320x00000000,
6330x00000000,
6340x00000000,
6350x00000000,
6360x00000000,
6370x00000000,
6380x00000000,
6390x00000000,
6400x00000000,
6410x00000000,
6420x00000000,
6430x00000000,
6440x00000000,
6450x00000000,
6460x00000000,
6470x00000000,
6480x00000000,
6490x00000000,
6500x00000000,
6510x00000000,
6520x00000000,
6530x00000000,
6540x00000000,
6550x00000000,
6560x00000000,
6570x00000000,
6580x00000000,
6590x00000000,
6600x00000000,
6610x00000000,
6620x00000000,
6630x00000000,
6640x00000000,
6650x00000000,
6660x00000000,
6670x00000000,
6680x00000000,
6690x00000000,
6700x00000000,
6710x00000000,
6720x00000000,
6730x00000000,
6740x00000000,
6750x00000000,
6760x00000000,
6770x00000000,
6780x00000000,
6790x00000000,
6800x00000000,
6810x00000000,
6820x00000000,
6830x00000000,
6840x00000000,
6850x00000000,
6860x00000000,
6870x00000000,
6880x00000000,
6890x00000000,
6900x00000000,
6910x00000000,
6920x00000000,
6930x00000000,
6940x00000000,
6950x00000000,
6960x00000000,
6970x00000000,
6980x00000000,
6990x00000000,
7000x00000000,
7010x00000000,
7020x00000000,
7030x00000000,
7040x00000000,
7050x00000000,
7060x00000000,
7070x00000000,
7080x00000000,
7090x00000000,
7100x00000000,
7110x00000000,
7120x00000000,
7130x00000000,
7140x00000000,
7150x00000000,
7160x00000000,
7170x00000000,
7180x00000000,
7190x00000000,
7200x00000000,
7210x00000000,
7220x00000000,
7230x00000000,
7240x00000000,
7250x00000000,
7260x00000000,
7270x00000000,
7280x00000000,
7290x00000000,
7300x00000000,
7310x00000000,
7320x00000000,
7330x00000000,
7340x00000000,
7350x00000000,
7360x00000000,
7370x00000000,
7380x00000000,
7390x00000000,
7400x00000000,
7410x00000000,
7420x00000000,
191}; 743};
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 1726bfe38ee0..b30e55dab832 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -46,6 +46,7 @@
46 46
47#include <asm/io.h> 47#include <asm/io.h>
48#include <asm/spu.h> 48#include <asm/spu.h>
49#include <asm/spu_priv1.h>
49#include <asm/spu_csa.h> 50#include <asm/spu_csa.h>
50#include <asm/mmu_context.h> 51#include <asm/mmu_context.h>
51 52
@@ -622,12 +623,17 @@ static inline void save_ppuint_mb(struct spu_state *csa, struct spu *spu)
622static inline void save_ch_part1(struct spu_state *csa, struct spu *spu) 623static inline void save_ch_part1(struct spu_state *csa, struct spu *spu)
623{ 624{
624 struct spu_priv2 __iomem *priv2 = spu->priv2; 625 struct spu_priv2 __iomem *priv2 = spu->priv2;
625 u64 idx, ch_indices[7] = { 0UL, 1UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 626 u64 idx, ch_indices[7] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL };
626 int i; 627 int i;
627 628
628 /* Save, Step 42: 629 /* Save, Step 42:
629 * Save the following CH: [0,1,3,4,24,25,27]
630 */ 630 */
631
632 /* Save CH 1, without channel count */
633 out_be64(&priv2->spu_chnlcntptr_RW, 1);
634 csa->spu_chnldata_RW[1] = in_be64(&priv2->spu_chnldata_RW);
635
636 /* Save the following CH: [0,3,4,24,25,27] */
631 for (i = 0; i < 7; i++) { 637 for (i = 0; i < 7; i++) {
632 idx = ch_indices[i]; 638 idx = ch_indices[i];
633 out_be64(&priv2->spu_chnlcntptr_RW, idx); 639 out_be64(&priv2->spu_chnlcntptr_RW, idx);
@@ -718,13 +724,15 @@ static inline void invalidate_slbs(struct spu_state *csa, struct spu *spu)
718 724
719static inline void get_kernel_slb(u64 ea, u64 slb[2]) 725static inline void get_kernel_slb(u64 ea, u64 slb[2])
720{ 726{
721 slb[0] = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | SLB_VSID_KERNEL; 727 u64 llp;
722 slb[1] = (ea & ESID_MASK) | SLB_ESID_V;
723 728
724 /* Large pages are used for kernel text/data, but not vmalloc. */ 729 if (REGION_ID(ea) == KERNEL_REGION_ID)
725 if (cpu_has_feature(CPU_FTR_16M_PAGE) 730 llp = mmu_psize_defs[mmu_linear_psize].sllp;
726 && REGION_ID(ea) == KERNEL_REGION_ID) 731 else
727 slb[0] |= SLB_VSID_L; 732 llp = mmu_psize_defs[mmu_virtual_psize].sllp;
733 slb[0] = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) |
734 SLB_VSID_KERNEL | llp;
735 slb[1] = (ea & ESID_MASK) | SLB_ESID_V;
728} 736}
729 737
730static inline void load_mfc_slb(struct spu *spu, u64 slb[2], int slbe) 738static inline void load_mfc_slb(struct spu *spu, u64 slb[2], int slbe)
@@ -1103,13 +1111,18 @@ static inline void clear_spu_status(struct spu_state *csa, struct spu *spu)
1103static inline void reset_ch_part1(struct spu_state *csa, struct spu *spu) 1111static inline void reset_ch_part1(struct spu_state *csa, struct spu *spu)
1104{ 1112{
1105 struct spu_priv2 __iomem *priv2 = spu->priv2; 1113 struct spu_priv2 __iomem *priv2 = spu->priv2;
1106 u64 ch_indices[7] = { 0UL, 1UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 1114 u64 ch_indices[7] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL };
1107 u64 idx; 1115 u64 idx;
1108 int i; 1116 int i;
1109 1117
1110 /* Restore, Step 20: 1118 /* Restore, Step 20:
1111 * Reset the following CH: [0,1,3,4,24,25,27]
1112 */ 1119 */
1120
1121 /* Reset CH 1 */
1122 out_be64(&priv2->spu_chnlcntptr_RW, 1);
1123 out_be64(&priv2->spu_chnldata_RW, 0UL);
1124
1125 /* Reset the following CH: [0,3,4,24,25,27] */
1113 for (i = 0; i < 7; i++) { 1126 for (i = 0; i < 7; i++) {
1114 idx = ch_indices[i]; 1127 idx = ch_indices[i];
1115 out_be64(&priv2->spu_chnlcntptr_RW, idx); 1128 out_be64(&priv2->spu_chnlcntptr_RW, idx);
@@ -1570,12 +1583,17 @@ static inline void restore_decr_wrapped(struct spu_state *csa, struct spu *spu)
1570static inline void restore_ch_part1(struct spu_state *csa, struct spu *spu) 1583static inline void restore_ch_part1(struct spu_state *csa, struct spu *spu)
1571{ 1584{
1572 struct spu_priv2 __iomem *priv2 = spu->priv2; 1585 struct spu_priv2 __iomem *priv2 = spu->priv2;
1573 u64 idx, ch_indices[7] = { 0UL, 1UL, 3UL, 4UL, 24UL, 25UL, 27UL }; 1586 u64 idx, ch_indices[7] = { 0UL, 3UL, 4UL, 24UL, 25UL, 27UL };
1574 int i; 1587 int i;
1575 1588
1576 /* Restore, Step 59: 1589 /* Restore, Step 59:
1577 * Restore the following CH: [0,1,3,4,24,25,27]
1578 */ 1590 */
1591
1592 /* Restore CH 1 without count */
1593 out_be64(&priv2->spu_chnlcntptr_RW, 1);
1594 out_be64(&priv2->spu_chnldata_RW, csa->spu_chnldata_RW[1]);
1595
1596 /* Restore the following CH: [0,3,4,24,25,27] */
1579 for (i = 0; i < 7; i++) { 1597 for (i = 0; i < 7; i++) {
1580 idx = ch_indices[i]; 1598 idx = ch_indices[i];
1581 out_be64(&priv2->spu_chnlcntptr_RW, idx); 1599 out_be64(&priv2->spu_chnlcntptr_RW, idx);
@@ -2074,6 +2092,7 @@ int spu_save(struct spu_state *prev, struct spu *spu)
2074 } 2092 }
2075 return rc; 2093 return rc;
2076} 2094}
2095EXPORT_SYMBOL_GPL(spu_save);
2077 2096
2078/** 2097/**
2079 * spu_restore - SPU context restore, with harvest and locking. 2098 * spu_restore - SPU context restore, with harvest and locking.
@@ -2090,7 +2109,6 @@ int spu_restore(struct spu_state *new, struct spu *spu)
2090 2109
2091 acquire_spu_lock(spu); 2110 acquire_spu_lock(spu);
2092 harvest(NULL, spu); 2111 harvest(NULL, spu);
2093 spu->stop_code = 0;
2094 spu->dar = 0; 2112 spu->dar = 0;
2095 spu->dsisr = 0; 2113 spu->dsisr = 0;
2096 spu->slb_replace = 0; 2114 spu->slb_replace = 0;
@@ -2103,6 +2121,7 @@ int spu_restore(struct spu_state *new, struct spu *spu)
2103 } 2121 }
2104 return rc; 2122 return rc;
2105} 2123}
2124EXPORT_SYMBOL_GPL(spu_restore);
2106 2125
2107/** 2126/**
2108 * spu_harvest - SPU harvest (reset) operation 2127 * spu_harvest - SPU harvest (reset) operation
@@ -2125,6 +2144,7 @@ static void init_prob(struct spu_state *csa)
2125 csa->spu_chnlcnt_RW[28] = 1; 2144 csa->spu_chnlcnt_RW[28] = 1;
2126 csa->spu_chnlcnt_RW[30] = 1; 2145 csa->spu_chnlcnt_RW[30] = 1;
2127 csa->prob.spu_runcntl_RW = SPU_RUNCNTL_STOP; 2146 csa->prob.spu_runcntl_RW = SPU_RUNCNTL_STOP;
2147 csa->prob.mb_stat_R = 0x000400;
2128} 2148}
2129 2149
2130static void init_priv1(struct spu_state *csa) 2150static void init_priv1(struct spu_state *csa)
@@ -2193,6 +2213,7 @@ void spu_init_csa(struct spu_state *csa)
2193 init_priv1(csa); 2213 init_priv1(csa);
2194 init_priv2(csa); 2214 init_priv2(csa);
2195} 2215}
2216EXPORT_SYMBOL_GPL(spu_init_csa);
2196 2217
2197void spu_fini_csa(struct spu_state *csa) 2218void spu_fini_csa(struct spu_state *csa)
2198{ 2219{
@@ -2203,3 +2224,4 @@ void spu_fini_csa(struct spu_state *csa)
2203 2224
2204 vfree(csa->lscsa); 2225 vfree(csa->lscsa);
2205} 2226}
2227EXPORT_SYMBOL_GPL(spu_fini_csa);
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index ce8c0b943fa0..dee4eb4d8bec 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -1,9 +1,11 @@
1EXTRA_CFLAGS += -mno-minimal-toc 1EXTRA_CFLAGS += -mno-minimal-toc
2 2
3obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \ 3obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \
4 hvcall.o proc.o htab.o iommu.o misc.o irq.o 4 hvcall.o proc.o htab.o iommu.o misc.o irq.o
5obj-$(CONFIG_PCI) += pci.o vpdinfo.o 5obj-$(CONFIG_PCI) += pci.o vpdinfo.o
6obj-$(CONFIG_IBMVIO) += vio.o
7obj-$(CONFIG_SMP) += smp.o 6obj-$(CONFIG_SMP) += smp.o
8obj-$(CONFIG_VIOPATH) += viopath.o 7obj-$(CONFIG_VIOPATH) += viopath.o
9obj-$(CONFIG_MODULES) += ksyms.o 8obj-$(CONFIG_MODULES) += ksyms.o
9
10$(obj)/dt_mod.o: $(obj)/dt.o
11 @$(OBJCOPY) --rename-section .rodata.str1.8=.dt_strings $(obj)/dt.o $(obj)/dt_mod.o
diff --git a/arch/powerpc/platforms/iseries/call_pci.h b/arch/powerpc/platforms/iseries/call_pci.h
index 59d4e0ad5cf3..dbdf69850ed9 100644
--- a/arch/powerpc/platforms/iseries/call_pci.h
+++ b/arch/powerpc/platforms/iseries/call_pci.h
@@ -145,6 +145,25 @@ static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
145 return retVal.rc; 145 return retVal.rc;
146} 146}
147 147
148static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber,
149 u8 deviceId, u32 offset, u32 *value)
150{
151 struct HvCallPci_DsaAddr dsa;
152 struct HvCallPci_LoadReturn retVal;
153
154 *((u64*)&dsa) = 0;
155
156 dsa.busNumber = busNumber;
157 dsa.subBusNumber = subBusNumber;
158 dsa.deviceId = deviceId;
159
160 HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0);
161
162 *value = retVal.value;
163
164 return retVal.rc;
165}
166
148static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber, 167static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
149 u8 deviceId, u32 offset, u8 value) 168 u8 deviceId, u32 offset, u8 value)
150{ 169{
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
new file mode 100644
index 000000000000..d3444aabe76e
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -0,0 +1,615 @@
1/*
2 * Copyright (c) 2005-2006 Michael Ellerman, IBM Corporation
3 *
4 * Description:
5 * This file contains all the routines to build a flattened device
6 * tree for a legacy iSeries machine.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#undef DEBUG
15
16#include <linux/types.h>
17#include <linux/init.h>
18#include <linux/pci.h>
19#include <linux/pci_regs.h>
20#include <linux/pci_ids.h>
21#include <linux/threads.h>
22#include <linux/bitops.h>
23#include <linux/string.h>
24#include <linux/kernel.h>
25#include <linux/if_ether.h> /* ETH_ALEN */
26
27#include <asm/machdep.h>
28#include <asm/prom.h>
29#include <asm/lppaca.h>
30#include <asm/cputable.h>
31#include <asm/abs_addr.h>
32#include <asm/system.h>
33#include <asm/iseries/hv_types.h>
34#include <asm/iseries/hv_lp_config.h>
35#include <asm/iseries/hv_call_xm.h>
36#include <asm/iseries/it_exp_vpd_panel.h>
37#include <asm/udbg.h>
38
39#include "processor_vpd.h"
40#include "call_hpt.h"
41#include "call_pci.h"
42#include "pci.h"
43
44#ifdef DEBUG
45#define DBG(fmt...) udbg_printf(fmt)
46#else
47#define DBG(fmt...)
48#endif
49
50/*
51 * These are created by the linker script at the start and end
52 * of the section containing all the strings from this file.
53 */
54extern char __dt_strings_start[];
55extern char __dt_strings_end[];
56
57struct iseries_flat_dt {
58 struct boot_param_header header;
59 u64 reserve_map[2];
60};
61
62static void * __initdata dt_data;
63
64/*
65 * Putting these strings here keeps them out of the section
66 * that we rename to .dt_strings using objcopy and capture
67 * for the strings blob of the flattened device tree.
68 */
69static char __initdata device_type_cpu[] = "cpu";
70static char __initdata device_type_memory[] = "memory";
71static char __initdata device_type_serial[] = "serial";
72static char __initdata device_type_network[] = "network";
73static char __initdata device_type_block[] = "block";
74static char __initdata device_type_byte[] = "byte";
75static char __initdata device_type_pci[] = "pci";
76static char __initdata device_type_vdevice[] = "vdevice";
77static char __initdata device_type_vscsi[] = "vscsi";
78
79static struct iseries_flat_dt * __init dt_init(void)
80{
81 struct iseries_flat_dt *dt;
82 unsigned long str_len;
83
84 str_len = __dt_strings_end - __dt_strings_start;
85 dt = (struct iseries_flat_dt *)ALIGN(klimit, 8);
86 dt->header.off_mem_rsvmap =
87 offsetof(struct iseries_flat_dt, reserve_map);
88 dt->header.off_dt_strings = ALIGN(sizeof(*dt), 8);
89 dt->header.off_dt_struct = dt->header.off_dt_strings
90 + ALIGN(str_len, 8);
91 dt_data = (void *)((unsigned long)dt + dt->header.off_dt_struct);
92 dt->header.dt_strings_size = str_len;
93
94 /* There is no notion of hardware cpu id on iSeries */
95 dt->header.boot_cpuid_phys = smp_processor_id();
96
97 memcpy((char *)dt + dt->header.off_dt_strings, __dt_strings_start,
98 str_len);
99
100 dt->header.magic = OF_DT_HEADER;
101 dt->header.version = 0x10;
102 dt->header.last_comp_version = 0x10;
103
104 dt->reserve_map[0] = 0;
105 dt->reserve_map[1] = 0;
106
107 return dt;
108}
109
110static void __init dt_push_u32(struct iseries_flat_dt *dt, u32 value)
111{
112 *((u32 *)dt_data) = value;
113 dt_data += sizeof(u32);
114}
115
116#ifdef notyet
117static void __init dt_push_u64(struct iseries_flat_dt *dt, u64 value)
118{
119 *((u64 *)dt_data) = value;
120 dt_data += sizeof(u64);
121}
122#endif
123
124static void __init dt_push_bytes(struct iseries_flat_dt *dt, const char *data,
125 int len)
126{
127 memcpy(dt_data, data, len);
128 dt_data += ALIGN(len, 4);
129}
130
131static void __init dt_start_node(struct iseries_flat_dt *dt, const char *name)
132{
133 dt_push_u32(dt, OF_DT_BEGIN_NODE);
134 dt_push_bytes(dt, name, strlen(name) + 1);
135}
136
137#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
138
139static void __init dt_prop(struct iseries_flat_dt *dt, const char *name,
140 const void *data, int len)
141{
142 unsigned long offset;
143
144 dt_push_u32(dt, OF_DT_PROP);
145
146 /* Length of the data */
147 dt_push_u32(dt, len);
148
149 offset = name - __dt_strings_start;
150
151 /* The offset of the properties name in the string blob. */
152 dt_push_u32(dt, (u32)offset);
153
154 /* The actual data. */
155 dt_push_bytes(dt, data, len);
156}
157
158static void __init dt_prop_str(struct iseries_flat_dt *dt, const char *name,
159 const char *data)
160{
161 dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */
162}
163
164static void __init dt_prop_u32(struct iseries_flat_dt *dt, const char *name,
165 u32 data)
166{
167 dt_prop(dt, name, &data, sizeof(u32));
168}
169
170#ifdef notyet
171static void __init dt_prop_u64(struct iseries_flat_dt *dt, const char *name,
172 u64 data)
173{
174 dt_prop(dt, name, &data, sizeof(u64));
175}
176#endif
177
178static void __init dt_prop_u64_list(struct iseries_flat_dt *dt,
179 const char *name, u64 *data, int n)
180{
181 dt_prop(dt, name, data, sizeof(u64) * n);
182}
183
184static void __init dt_prop_u32_list(struct iseries_flat_dt *dt,
185 const char *name, u32 *data, int n)
186{
187 dt_prop(dt, name, data, sizeof(u32) * n);
188}
189
190#ifdef notyet
191static void __init dt_prop_empty(struct iseries_flat_dt *dt, const char *name)
192{
193 dt_prop(dt, name, NULL, 0);
194}
195#endif
196
197static void __init dt_cpus(struct iseries_flat_dt *dt)
198{
199 unsigned char buf[32];
200 unsigned char *p;
201 unsigned int i, index;
202 struct IoHriProcessorVpd *d;
203 u32 pft_size[2];
204
205 /* yuck */
206 snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name);
207 p = strchr(buf, ' ');
208 if (!p) p = buf + strlen(buf);
209
210 dt_start_node(dt, "cpus");
211 dt_prop_u32(dt, "#address-cells", 1);
212 dt_prop_u32(dt, "#size-cells", 0);
213
214 pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */
215 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
216
217 for (i = 0; i < NR_CPUS; i++) {
218 if (lppaca[i].dyn_proc_status >= 2)
219 continue;
220
221 snprintf(p, 32 - (p - buf), "@%d", i);
222 dt_start_node(dt, buf);
223
224 dt_prop_str(dt, "device_type", device_type_cpu);
225
226 index = lppaca[i].dyn_hv_phys_proc_index;
227 d = &xIoHriProcessorVpd[index];
228
229 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
230 dt_prop_u32(dt, "i-cache-line-size", d->xInstCacheOperandSize);
231
232 dt_prop_u32(dt, "d-cache-size", d->xDataL1CacheSizeKB * 1024);
233 dt_prop_u32(dt, "d-cache-line-size", d->xDataCacheOperandSize);
234
235 /* magic conversions to Hz copied from old code */
236 dt_prop_u32(dt, "clock-frequency",
237 ((1UL << 34) * 1000000) / d->xProcFreq);
238 dt_prop_u32(dt, "timebase-frequency",
239 ((1UL << 32) * 1000000) / d->xTimeBaseFreq);
240
241 dt_prop_u32(dt, "reg", i);
242
243 dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2);
244
245 dt_end_node(dt);
246 }
247
248 dt_end_node(dt);
249}
250
251static void __init dt_model(struct iseries_flat_dt *dt)
252{
253 char buf[16] = "IBM,";
254
255 /* "IBM," + mfgId[2:3] + systemSerial[1:5] */
256 strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
257 strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
258 buf[11] = '\0';
259 dt_prop_str(dt, "system-id", buf);
260
261 /* "IBM," + machineType[0:4] */
262 strne2a(buf + 4, xItExtVpdPanel.machineType, 4);
263 buf[8] = '\0';
264 dt_prop_str(dt, "model", buf);
265
266 dt_prop_str(dt, "compatible", "IBM,iSeries");
267}
268
269static void __init dt_do_vdevice(struct iseries_flat_dt *dt,
270 const char *name, u32 reg, int unit,
271 const char *type, const char *compat, int end)
272{
273 char buf[32];
274
275 snprintf(buf, 32, "%s@%08x", name, reg + ((unit >= 0) ? unit : 0));
276 dt_start_node(dt, buf);
277 dt_prop_str(dt, "device_type", type);
278 if (compat)
279 dt_prop_str(dt, "compatible", compat);
280 dt_prop_u32(dt, "reg", reg + ((unit >= 0) ? unit : 0));
281 if (unit >= 0)
282 dt_prop_u32(dt, "linux,unit_address", unit);
283 if (end)
284 dt_end_node(dt);
285}
286
287static void __init dt_vdevices(struct iseries_flat_dt *dt)
288{
289 u32 reg = 0;
290 HvLpIndexMap vlan_map;
291 int i;
292
293 dt_start_node(dt, "vdevice");
294 dt_prop_str(dt, "device_type", device_type_vdevice);
295 dt_prop_str(dt, "compatible", "IBM,iSeries-vdevice");
296 dt_prop_u32(dt, "#address-cells", 1);
297 dt_prop_u32(dt, "#size-cells", 0);
298
299 dt_do_vdevice(dt, "vty", reg, -1, device_type_serial, NULL, 1);
300 reg++;
301
302 dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi,
303 "IBM,v-scsi", 1);
304 reg++;
305
306 vlan_map = HvLpConfig_getVirtualLanIndexMap();
307 for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) {
308 unsigned char mac_addr[ETH_ALEN];
309
310 if ((vlan_map & (0x8000 >> i)) == 0)
311 continue;
312 dt_do_vdevice(dt, "l-lan", reg, i, device_type_network,
313 "IBM,iSeries-l-lan", 0);
314 mac_addr[0] = 0x02;
315 mac_addr[1] = 0x01;
316 mac_addr[2] = 0xff;
317 mac_addr[3] = i;
318 mac_addr[4] = 0xff;
319 mac_addr[5] = HvLpConfig_getLpIndex_outline();
320 dt_prop(dt, "local-mac-address", (char *)mac_addr, ETH_ALEN);
321 dt_prop(dt, "mac-address", (char *)mac_addr, ETH_ALEN);
322 dt_prop_u32(dt, "max-frame-size", 9000);
323 dt_prop_u32(dt, "address-bits", 48);
324
325 dt_end_node(dt);
326 }
327 reg += HVMAXARCHITECTEDVIRTUALLANS;
328
329 for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++)
330 dt_do_vdevice(dt, "viodasd", reg, i, device_type_block,
331 "IBM,iSeries-viodasd", 1);
332 reg += HVMAXARCHITECTEDVIRTUALDISKS;
333
334 for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++)
335 dt_do_vdevice(dt, "viocd", reg, i, device_type_block,
336 "IBM,iSeries-viocd", 1);
337 reg += HVMAXARCHITECTEDVIRTUALCDROMS;
338
339 for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++)
340 dt_do_vdevice(dt, "viotape", reg, i, device_type_byte,
341 "IBM,iSeries-viotape", 1);
342
343 dt_end_node(dt);
344}
345
346struct pci_class_name {
347 u16 code;
348 const char *name;
349 const char *type;
350};
351
352static struct pci_class_name __initdata pci_class_name[] = {
353 { PCI_CLASS_NETWORK_ETHERNET, "ethernet", device_type_network },
354};
355
356static struct pci_class_name * __init dt_find_pci_class_name(u16 class_code)
357{
358 struct pci_class_name *cp;
359
360 for (cp = pci_class_name;
361 cp < &pci_class_name[ARRAY_SIZE(pci_class_name)]; cp++)
362 if (cp->code == class_code)
363 return cp;
364 return NULL;
365}
366
367/*
368 * This assumes that the node slot is always on the primary bus!
369 */
370static void __init scan_bridge_slot(struct iseries_flat_dt *dt,
371 HvBusNumber bus, struct HvCallPci_BridgeInfo *bridge_info)
372{
373 HvSubBusNumber sub_bus = bridge_info->subBusNumber;
374 u16 vendor_id;
375 u16 device_id;
376 u32 class_id;
377 int err;
378 char buf[32];
379 u32 reg[5];
380 int id_sel = ISERIES_GET_DEVICE_FROM_SUBBUS(sub_bus);
381 int function = ISERIES_GET_FUNCTION_FROM_SUBBUS(sub_bus);
382 HvAgentId eads_id_sel = ISERIES_PCI_AGENTID(id_sel, function);
383 u8 devfn;
384 struct pci_class_name *cp;
385
386 /*
387 * Connect all functions of any device found.
388 */
389 for (id_sel = 1; id_sel <= bridge_info->maxAgents; id_sel++) {
390 for (function = 0; function < 8; function++) {
391 HvAgentId agent_id = ISERIES_PCI_AGENTID(id_sel,
392 function);
393 err = HvCallXm_connectBusUnit(bus, sub_bus,
394 agent_id, 0);
395 if (err) {
396 if (err != 0x302)
397 DBG("connectBusUnit(%x, %x, %x) %x\n",
398 bus, sub_bus, agent_id, err);
399 continue;
400 }
401
402 err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
403 PCI_VENDOR_ID, &vendor_id);
404 if (err) {
405 DBG("ReadVendor(%x, %x, %x) %x\n",
406 bus, sub_bus, agent_id, err);
407 continue;
408 }
409 err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
410 PCI_DEVICE_ID, &device_id);
411 if (err) {
412 DBG("ReadDevice(%x, %x, %x) %x\n",
413 bus, sub_bus, agent_id, err);
414 continue;
415 }
416 err = HvCallPci_configLoad32(bus, sub_bus, agent_id,
417 PCI_CLASS_REVISION , &class_id);
418 if (err) {
419 DBG("ReadClass(%x, %x, %x) %x\n",
420 bus, sub_bus, agent_id, err);
421 continue;
422 }
423
424 devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(eads_id_sel),
425 function);
426 cp = dt_find_pci_class_name(class_id >> 16);
427 if (cp && cp->name)
428 strncpy(buf, cp->name, sizeof(buf) - 1);
429 else
430 snprintf(buf, sizeof(buf), "pci%x,%x",
431 vendor_id, device_id);
432 buf[sizeof(buf) - 1] = '\0';
433 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
434 "@%x", PCI_SLOT(devfn));
435 buf[sizeof(buf) - 1] = '\0';
436 if (function != 0)
437 snprintf(buf + strlen(buf),
438 sizeof(buf) - strlen(buf),
439 ",%x", function);
440 dt_start_node(dt, buf);
441 reg[0] = (bus << 16) | (devfn << 8);
442 reg[1] = 0;
443 reg[2] = 0;
444 reg[3] = 0;
445 reg[4] = 0;
446 dt_prop_u32_list(dt, "reg", reg, 5);
447 if (cp && (cp->type || cp->name))
448 dt_prop_str(dt, "device_type",
449 cp->type ? cp->type : cp->name);
450 dt_prop_u32(dt, "vendor-id", vendor_id);
451 dt_prop_u32(dt, "device-id", device_id);
452 dt_prop_u32(dt, "class-code", class_id >> 8);
453 dt_prop_u32(dt, "revision-id", class_id & 0xff);
454 dt_prop_u32(dt, "linux,subbus", sub_bus);
455 dt_prop_u32(dt, "linux,agent-id", agent_id);
456 dt_prop_u32(dt, "linux,logical-slot-number",
457 bridge_info->logicalSlotNumber);
458 dt_end_node(dt);
459
460 }
461 }
462}
463
464static void __init scan_bridge(struct iseries_flat_dt *dt, HvBusNumber bus,
465 HvSubBusNumber sub_bus, int id_sel)
466{
467 struct HvCallPci_BridgeInfo bridge_info;
468 HvAgentId agent_id;
469 int function;
470 int ret;
471
472 /* Note: hvSubBus and irq is always be 0 at this level! */
473 for (function = 0; function < 8; ++function) {
474 agent_id = ISERIES_PCI_AGENTID(id_sel, function);
475 ret = HvCallXm_connectBusUnit(bus, sub_bus, agent_id, 0);
476 if (ret != 0) {
477 if (ret != 0xb)
478 DBG("connectBusUnit(%x, %x, %x) %x\n",
479 bus, sub_bus, agent_id, ret);
480 continue;
481 }
482 DBG("found device at bus %d idsel %d func %d (AgentId %x)\n",
483 bus, id_sel, function, agent_id);
484 ret = HvCallPci_getBusUnitInfo(bus, sub_bus, agent_id,
485 iseries_hv_addr(&bridge_info),
486 sizeof(struct HvCallPci_BridgeInfo));
487 if (ret != 0)
488 continue;
489 DBG("bridge info: type %x subbus %x "
490 "maxAgents %x maxsubbus %x logslot %x\n",
491 bridge_info.busUnitInfo.deviceType,
492 bridge_info.subBusNumber,
493 bridge_info.maxAgents,
494 bridge_info.maxSubBusNumber,
495 bridge_info.logicalSlotNumber);
496 if (bridge_info.busUnitInfo.deviceType ==
497 HvCallPci_BridgeDevice)
498 scan_bridge_slot(dt, bus, &bridge_info);
499 else
500 DBG("PCI: Invalid Bridge Configuration(0x%02X)",
501 bridge_info.busUnitInfo.deviceType);
502 }
503}
504
505static void __init scan_phb(struct iseries_flat_dt *dt, HvBusNumber bus)
506{
507 struct HvCallPci_DeviceInfo dev_info;
508 const HvSubBusNumber sub_bus = 0; /* EADs is always 0. */
509 int err;
510 int id_sel;
511 const int max_agents = 8;
512
513 /*
514 * Probe for EADs Bridges
515 */
516 for (id_sel = 1; id_sel < max_agents; ++id_sel) {
517 err = HvCallPci_getDeviceInfo(bus, sub_bus, id_sel,
518 iseries_hv_addr(&dev_info),
519 sizeof(struct HvCallPci_DeviceInfo));
520 if (err) {
521 if (err != 0x302)
522 DBG("getDeviceInfo(%x, %x, %x) %x\n",
523 bus, sub_bus, id_sel, err);
524 continue;
525 }
526 if (dev_info.deviceType != HvCallPci_NodeDevice) {
527 DBG("PCI: Invalid System Configuration"
528 "(0x%02X) for bus 0x%02x id 0x%02x.\n",
529 dev_info.deviceType, bus, id_sel);
530 continue;
531 }
532 scan_bridge(dt, bus, sub_bus, id_sel);
533 }
534}
535
536static void __init dt_pci_devices(struct iseries_flat_dt *dt)
537{
538 HvBusNumber bus;
539 char buf[32];
540 u32 buses[2];
541 int phb_num = 0;
542
543 /* Check all possible buses. */
544 for (bus = 0; bus < 256; bus++) {
545 int err = HvCallXm_testBus(bus);
546
547 if (err) {
548 /*
549 * Check for Unexpected Return code, a clue that
550 * something has gone wrong.
551 */
552 if (err != 0x0301)
553 DBG("Unexpected Return on Probe(0x%02X) "
554 "0x%04X\n", bus, err);
555 continue;
556 }
557 DBG("bus %d appears to exist\n", bus);
558 snprintf(buf, 32, "pci@%d", phb_num);
559 dt_start_node(dt, buf);
560 dt_prop_str(dt, "device_type", device_type_pci);
561 dt_prop_str(dt, "compatible", "IBM,iSeries-Logical-PHB");
562 dt_prop_u32(dt, "#address-cells", 3);
563 dt_prop_u32(dt, "#size-cells", 2);
564 buses[0] = buses[1] = bus;
565 dt_prop_u32_list(dt, "bus-range", buses, 2);
566 scan_phb(dt, bus);
567 dt_end_node(dt);
568 phb_num++;
569 }
570}
571
572static void dt_finish(struct iseries_flat_dt *dt)
573{
574 dt_push_u32(dt, OF_DT_END);
575 dt->header.totalsize = (unsigned long)dt_data - (unsigned long)dt;
576 klimit = ALIGN((unsigned long)dt_data, 8);
577}
578
579void * __init build_flat_dt(unsigned long phys_mem_size)
580{
581 struct iseries_flat_dt *iseries_dt;
582 u64 tmp[2];
583
584 iseries_dt = dt_init();
585
586 dt_start_node(iseries_dt, "");
587
588 dt_prop_u32(iseries_dt, "#address-cells", 2);
589 dt_prop_u32(iseries_dt, "#size-cells", 2);
590 dt_model(iseries_dt);
591
592 /* /memory */
593 dt_start_node(iseries_dt, "memory@0");
594 dt_prop_str(iseries_dt, "device_type", device_type_memory);
595 tmp[0] = 0;
596 tmp[1] = phys_mem_size;
597 dt_prop_u64_list(iseries_dt, "reg", tmp, 2);
598 dt_end_node(iseries_dt);
599
600 /* /chosen */
601 dt_start_node(iseries_dt, "chosen");
602 dt_prop_str(iseries_dt, "bootargs", cmd_line);
603 dt_end_node(iseries_dt);
604
605 dt_cpus(iseries_dt);
606
607 dt_vdevices(iseries_dt);
608 dt_pci_devices(iseries_dt);
609
610 dt_end_node(iseries_dt);
611
612 dt_finish(iseries_dt);
613
614 return iseries_dt;
615}
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index bea0b703f409..e3bd2015f2c9 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -4,6 +4,7 @@
4 * Rewrite, cleanup: 4 * Rewrite, cleanup:
5 * 5 *
6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
7 * Copyright (C) 2006 Olof Johansson <olof@lixom.net>
7 * 8 *
8 * Dynamic DMA mapping support, iSeries-specific parts. 9 * Dynamic DMA mapping support, iSeries-specific parts.
9 * 10 *
@@ -31,42 +32,37 @@
31#include <asm/tce.h> 32#include <asm/tce.h>
32#include <asm/machdep.h> 33#include <asm/machdep.h>
33#include <asm/abs_addr.h> 34#include <asm/abs_addr.h>
35#include <asm/prom.h>
34#include <asm/pci-bridge.h> 36#include <asm/pci-bridge.h>
35#include <asm/iseries/hv_call_xm.h> 37#include <asm/iseries/hv_call_xm.h>
36 38#include <asm/iseries/iommu.h>
37#include "iommu.h"
38
39extern struct list_head iSeries_Global_Device_List;
40
41 39
42static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages, 40static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
43 unsigned long uaddr, enum dma_data_direction direction) 41 unsigned long uaddr, enum dma_data_direction direction)
44{ 42{
45 u64 rc; 43 u64 rc;
46 union tce_entry tce; 44 u64 tce, rpn;
47 45
48 index <<= TCE_PAGE_FACTOR; 46 index <<= TCE_PAGE_FACTOR;
49 npages <<= TCE_PAGE_FACTOR; 47 npages <<= TCE_PAGE_FACTOR;
50 48
51 while (npages--) { 49 while (npages--) {
52 tce.te_word = 0; 50 rpn = virt_to_abs(uaddr) >> TCE_SHIFT;
53 tce.te_bits.tb_rpn = virt_to_abs(uaddr) >> TCE_SHIFT; 51 tce = (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
54 52
55 if (tbl->it_type == TCE_VB) { 53 if (tbl->it_type == TCE_VB) {
56 /* Virtual Bus */ 54 /* Virtual Bus */
57 tce.te_bits.tb_valid = 1; 55 tce |= TCE_VALID|TCE_ALLIO;
58 tce.te_bits.tb_allio = 1;
59 if (direction != DMA_TO_DEVICE) 56 if (direction != DMA_TO_DEVICE)
60 tce.te_bits.tb_rdwr = 1; 57 tce |= TCE_VB_WRITE;
61 } else { 58 } else {
62 /* PCI Bus */ 59 /* PCI Bus */
63 tce.te_bits.tb_rdwr = 1; /* Read allowed */ 60 tce |= TCE_PCI_READ; /* Read allowed */
64 if (direction != DMA_TO_DEVICE) 61 if (direction != DMA_TO_DEVICE)
65 tce.te_bits.tb_pciwr = 1; 62 tce |= TCE_PCI_WRITE;
66 } 63 }
67 64
68 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, 65 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, tce);
69 tce.te_word);
70 if (rc) 66 if (rc)
71 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%lx\n", 67 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%lx\n",
72 rc); 68 rc);
@@ -124,7 +120,7 @@ void iommu_table_getparms_iSeries(unsigned long busno,
124 120
125 /* itc_size is in pages worth of table, it_size is in # of entries */ 121 /* itc_size is in pages worth of table, it_size is in # of entries */
126 tbl->it_size = ((parms->itc_size * TCE_PAGE_SIZE) / 122 tbl->it_size = ((parms->itc_size * TCE_PAGE_SIZE) /
127 sizeof(union tce_entry)) >> TCE_PAGE_FACTOR; 123 TCE_ENTRY_SIZE) >> TCE_PAGE_FACTOR;
128 tbl->it_busno = parms->itc_busno; 124 tbl->it_busno = parms->itc_busno;
129 tbl->it_offset = parms->itc_offset >> TCE_PAGE_FACTOR; 125 tbl->it_offset = parms->itc_offset >> TCE_PAGE_FACTOR;
130 tbl->it_index = parms->itc_index; 126 tbl->it_index = parms->itc_index;
@@ -142,10 +138,15 @@ void iommu_table_getparms_iSeries(unsigned long busno,
142 */ 138 */
143static struct iommu_table *iommu_table_find(struct iommu_table * tbl) 139static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
144{ 140{
145 struct pci_dn *pdn; 141 struct device_node *node;
146 142
147 list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) { 143 for (node = NULL; (node = of_find_all_nodes(node)); ) {
148 struct iommu_table *it = pdn->iommu_table; 144 struct pci_dn *pdn = PCI_DN(node);
145 struct iommu_table *it;
146
147 if (pdn == NULL)
148 continue;
149 it = pdn->iommu_table;
149 if ((it != NULL) && 150 if ((it != NULL) &&
150 (it->it_type == TCE_PCI) && 151 (it->it_type == TCE_PCI) &&
151 (it->it_offset == tbl->it_offset) && 152 (it->it_offset == tbl->it_offset) &&
@@ -161,15 +162,18 @@ void iommu_devnode_init_iSeries(struct device_node *dn)
161{ 162{
162 struct iommu_table *tbl; 163 struct iommu_table *tbl;
163 struct pci_dn *pdn = PCI_DN(dn); 164 struct pci_dn *pdn = PCI_DN(dn);
165 u32 *lsn = (u32 *)get_property(dn, "linux,logical-slot-number", NULL);
166
167 BUG_ON(lsn == NULL);
164 168
165 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 169 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
166 170
167 iommu_table_getparms_iSeries(pdn->busno, pdn->LogicalSlot, 0, tbl); 171 iommu_table_getparms_iSeries(pdn->busno, *lsn, 0, tbl);
168 172
169 /* Look for existing tce table */ 173 /* Look for existing tce table */
170 pdn->iommu_table = iommu_table_find(tbl); 174 pdn->iommu_table = iommu_table_find(tbl);
171 if (pdn->iommu_table == NULL) 175 if (pdn->iommu_table == NULL)
172 pdn->iommu_table = iommu_init_table(tbl); 176 pdn->iommu_table = iommu_init_table(tbl, -1);
173 else 177 else
174 kfree(tbl); 178 kfree(tbl);
175} 179}
diff --git a/arch/powerpc/platforms/iseries/iommu.h b/arch/powerpc/platforms/iseries/iommu.h
deleted file mode 100644
index cb5658fbe657..000000000000
--- a/arch/powerpc/platforms/iseries/iommu.h
+++ /dev/null
@@ -1,35 +0,0 @@
1#ifndef _PLATFORMS_ISERIES_IOMMU_H
2#define _PLATFORMS_ISERIES_IOMMU_H
3
4/*
5 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
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; either version 2 of the License, or
10 * (at your option) any later version.
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
18 * along with this program; if not, write to the:
19 * Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
22 */
23
24struct device_node;
25struct iommu_table;
26
27/* Creates table for an individual device node */
28extern void iommu_devnode_init_iSeries(struct device_node *dn);
29
30/* Get table parameters from HV */
31extern void iommu_table_getparms_iSeries(unsigned long busno,
32 unsigned char slotno, unsigned char virtbus,
33 struct iommu_table *tbl);
34
35#endif /* _PLATFORMS_ISERIES_IOMMU_H */
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index be3fbfc24e6c..62bbbcf5ded3 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -42,6 +42,7 @@
42#include <asm/iseries/it_lp_queue.h> 42#include <asm/iseries/it_lp_queue.h>
43 43
44#include "irq.h" 44#include "irq.h"
45#include "pci.h"
45#include "call_pci.h" 46#include "call_pci.h"
46 47
47#if defined(CONFIG_SMP) 48#if defined(CONFIG_SMP)
@@ -312,12 +313,12 @@ static hw_irq_controller iSeries_IRQ_handler = {
312 * Note that sub_bus is always 0 (at the moment at least). 313 * Note that sub_bus is always 0 (at the moment at least).
313 */ 314 */
314int __init iSeries_allocate_IRQ(HvBusNumber bus, 315int __init iSeries_allocate_IRQ(HvBusNumber bus,
315 HvSubBusNumber sub_bus, HvAgentId dev_id) 316 HvSubBusNumber sub_bus, u32 bsubbus)
316{ 317{
317 int virtirq; 318 int virtirq;
318 unsigned int realirq; 319 unsigned int realirq;
319 u8 idsel = (dev_id >> 4); 320 u8 idsel = ISERIES_GET_DEVICE_FROM_SUBBUS(bsubbus);
320 u8 function = dev_id & 7; 321 u8 function = ISERIES_GET_FUNCTION_FROM_SUBBUS(bsubbus);
321 322
322 realirq = (((((sub_bus << 8) + (bus - 1)) << 3) + (idsel - 1)) << 3) 323 realirq = (((((sub_bus << 8) + (bus - 1)) << 3) + (idsel - 1)) << 3)
323 + function; 324 + function;
diff --git a/arch/powerpc/platforms/iseries/irq.h b/arch/powerpc/platforms/iseries/irq.h
index b9c801ba5a47..188aa808abd7 100644
--- a/arch/powerpc/platforms/iseries/irq.h
+++ b/arch/powerpc/platforms/iseries/irq.h
@@ -2,7 +2,7 @@
2#define _ISERIES_IRQ_H 2#define _ISERIES_IRQ_H
3 3
4extern void iSeries_init_IRQ(void); 4extern void iSeries_init_IRQ(void);
5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId); 5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, u32);
6extern void iSeries_activate_IRQs(void); 6extern void iSeries_activate_IRQs(void);
7extern int iSeries_get_irq(struct pt_regs *); 7extern int iSeries_get_irq(struct pt_regs *);
8 8
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index d771b8ee857d..1a2c2a50f922 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -45,7 +45,6 @@
45 45
46#include "setup.h" 46#include "setup.h"
47 47
48extern int piranha_simulator;
49static int mf_initialized; 48static int mf_initialized;
50 49
51/* 50/*
@@ -658,7 +657,7 @@ static void mf_clear_src(void)
658 657
659void __init mf_display_progress(u16 value) 658void __init mf_display_progress(u16 value)
660{ 659{
661 if (piranha_simulator || !mf_initialized) 660 if (!mf_initialized)
662 return; 661 return;
663 662
664 if (0xFFFF == value) 663 if (0xFFFF == value)
@@ -1295,9 +1294,6 @@ __initcall(mf_proc_init);
1295 */ 1294 */
1296void iSeries_get_rtc_time(struct rtc_time *rtc_tm) 1295void iSeries_get_rtc_time(struct rtc_time *rtc_tm)
1297{ 1296{
1298 if (piranha_simulator)
1299 return;
1300
1301 mf_get_rtc(rtc_tm); 1297 mf_get_rtc(rtc_tm);
1302 rtc_tm->tm_mon--; 1298 rtc_tm->tm_mon--;
1303} 1299}
@@ -1316,9 +1312,6 @@ unsigned long iSeries_get_boot_time(void)
1316{ 1312{
1317 struct rtc_time tm; 1313 struct rtc_time tm;
1318 1314
1319 if (piranha_simulator)
1320 return 0;
1321
1322 mf_get_boot_rtc(&tm); 1315 mf_get_boot_rtc(&tm);
1323 return mktime(tm.tm_year + 1900, tm.tm_mon, tm.tm_mday, 1316 return mktime(tm.tm_year + 1900, tm.tm_mon, tm.tm_mday,
1324 tm.tm_hour, tm.tm_min, tm.tm_sec); 1317 tm.tm_hour, tm.tm_min, tm.tm_sec);
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index a19833b880e4..35bcc98111f5 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -37,36 +37,18 @@
37 37
38#include <asm/iseries/hv_call_xm.h> 38#include <asm/iseries/hv_call_xm.h>
39#include <asm/iseries/mf.h> 39#include <asm/iseries/mf.h>
40#include <asm/iseries/iommu.h>
40 41
41#include <asm/ppc-pci.h> 42#include <asm/ppc-pci.h>
42 43
43#include "irq.h" 44#include "irq.h"
44#include "pci.h" 45#include "pci.h"
45#include "call_pci.h" 46#include "call_pci.h"
46#include "iommu.h"
47
48extern unsigned long io_page_mask;
49 47
50/* 48/*
51 * Forward declares of prototypes. 49 * Forward declares of prototypes.
52 */ 50 */
53static struct device_node *find_Device_Node(int bus, int devfn); 51static struct device_node *find_Device_Node(int bus, int devfn);
54static void scan_PHB_slots(struct pci_controller *Phb);
55static void scan_EADS_bridge(HvBusNumber Bus, HvSubBusNumber SubBus, int IdSel);
56static int scan_bridge_slot(HvBusNumber Bus, struct HvCallPci_BridgeInfo *Info);
57
58LIST_HEAD(iSeries_Global_Device_List);
59
60static int DeviceCount;
61
62/* Counters and control flags. */
63static long Pci_Io_Read_Count;
64static long Pci_Io_Write_Count;
65#if 0
66static long Pci_Cfg_Read_Count;
67static long Pci_Cfg_Write_Count;
68#endif
69static long Pci_Error_Count;
70 52
71static int Pci_Retry_Max = 3; /* Only retry 3 times */ 53static int Pci_Retry_Max = 3; /* Only retry 3 times */
72static int Pci_Error_Flag = 1; /* Set Retry Error on. */ 54static int Pci_Error_Flag = 1; /* Set Retry Error on. */
@@ -81,41 +63,19 @@ static struct pci_ops iSeries_pci_ops;
81#define IOMM_TABLE_ENTRY_SIZE 0x0000000000400000UL 63#define IOMM_TABLE_ENTRY_SIZE 0x0000000000400000UL
82#define BASE_IO_MEMORY 0xE000000000000000UL 64#define BASE_IO_MEMORY 0xE000000000000000UL
83 65
84static unsigned long max_io_memory = 0xE000000000000000UL; 66static unsigned long max_io_memory = BASE_IO_MEMORY;
85static long current_iomm_table_entry; 67static long current_iomm_table_entry;
86 68
87/* 69/*
88 * Lookup Tables. 70 * Lookup Tables.
89 */ 71 */
90static struct device_node **iomm_table; 72static struct device_node *iomm_table[IOMM_TABLE_MAX_ENTRIES];
91static u8 *iobar_table; 73static u8 iobar_table[IOMM_TABLE_MAX_ENTRIES];
92 74
93/* 75static const char pci_io_text[] = "iSeries PCI I/O";
94 * Static and Global variables
95 */
96static char *pci_io_text = "iSeries PCI I/O";
97static DEFINE_SPINLOCK(iomm_table_lock); 76static DEFINE_SPINLOCK(iomm_table_lock);
98 77
99/* 78/*
100 * iomm_table_initialize
101 *
102 * Allocates and initalizes the Address Translation Table and Bar
103 * Tables to get them ready for use. Must be called before any
104 * I/O space is handed out to the device BARs.
105 */
106static void iomm_table_initialize(void)
107{
108 spin_lock(&iomm_table_lock);
109 iomm_table = kmalloc(sizeof(*iomm_table) * IOMM_TABLE_MAX_ENTRIES,
110 GFP_KERNEL);
111 iobar_table = kmalloc(sizeof(*iobar_table) * IOMM_TABLE_MAX_ENTRIES,
112 GFP_KERNEL);
113 spin_unlock(&iomm_table_lock);
114 if ((iomm_table == NULL) || (iobar_table == NULL))
115 panic("PCI: I/O tables allocation failed.\n");
116}
117
118/*
119 * iomm_table_allocate_entry 79 * iomm_table_allocate_entry
120 * 80 *
121 * Adds pci_dev entry in address translation table 81 * Adds pci_dev entry in address translation table
@@ -142,9 +102,8 @@ static void iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
142 */ 102 */
143 spin_lock(&iomm_table_lock); 103 spin_lock(&iomm_table_lock);
144 bar_res->name = pci_io_text; 104 bar_res->name = pci_io_text;
145 bar_res->start = 105 bar_res->start = BASE_IO_MEMORY +
146 IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry; 106 IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
147 bar_res->start += BASE_IO_MEMORY;
148 bar_res->end = bar_res->start + bar_size - 1; 107 bar_res->end = bar_res->start + bar_size - 1;
149 /* 108 /*
150 * Allocate the number of table entries needed for BAR. 109 * Allocate the number of table entries needed for BAR.
@@ -156,7 +115,7 @@ static void iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
156 ++current_iomm_table_entry; 115 ++current_iomm_table_entry;
157 } 116 }
158 max_io_memory = BASE_IO_MEMORY + 117 max_io_memory = BASE_IO_MEMORY +
159 (IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry); 118 IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
160 spin_unlock(&iomm_table_lock); 119 spin_unlock(&iomm_table_lock);
161} 120}
162 121
@@ -173,13 +132,10 @@ static void iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
173 */ 132 */
174static void allocate_device_bars(struct pci_dev *dev) 133static void allocate_device_bars(struct pci_dev *dev)
175{ 134{
176 struct resource *bar_res;
177 int bar_num; 135 int bar_num;
178 136
179 for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num) { 137 for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num)
180 bar_res = &dev->resource[bar_num];
181 iomm_table_allocate_entry(dev, bar_num); 138 iomm_table_allocate_entry(dev, bar_num);
182 }
183} 139}
184 140
185/* 141/*
@@ -199,34 +155,7 @@ static void pci_Log_Error(char *Error_Text, int Bus, int SubBus,
199} 155}
200 156
201/* 157/*
202 * build_device_node(u16 Bus, int SubBus, u8 DevFn) 158 * iSeries_pcibios_init
203 */
204static struct device_node *build_device_node(HvBusNumber Bus,
205 HvSubBusNumber SubBus, int AgentId, int Function)
206{
207 struct device_node *node;
208 struct pci_dn *pdn;
209
210 node = kmalloc(sizeof(struct device_node), GFP_KERNEL);
211 if (node == NULL)
212 return NULL;
213 memset(node, 0, sizeof(struct device_node));
214 pdn = kzalloc(sizeof(*pdn), GFP_KERNEL);
215 if (pdn == NULL) {
216 kfree(node);
217 return NULL;
218 }
219 node->data = pdn;
220 pdn->node = node;
221 list_add_tail(&pdn->Device_List, &iSeries_Global_Device_List);
222 pdn->busno = Bus;
223 pdn->bussubno = SubBus;
224 pdn->devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function);
225 return node;
226}
227
228/*
229 * unsigned long __init find_and_init_phbs(void)
230 * 159 *
231 * Description: 160 * Description:
232 * This function checks for all possible system PCI host bridges that connect 161 * This function checks for all possible system PCI host bridges that connect
@@ -234,50 +163,42 @@ static struct device_node *build_device_node(HvBusNumber Bus,
234 * ownership status. A pci_controller is built for any bus which is partially 163 * ownership status. A pci_controller is built for any bus which is partially
235 * owned or fully owned by this guest partition. 164 * owned or fully owned by this guest partition.
236 */ 165 */
237unsigned long __init find_and_init_phbs(void) 166void iSeries_pcibios_init(void)
238{ 167{
239 struct pci_controller *phb; 168 struct pci_controller *phb;
240 HvBusNumber bus; 169 struct device_node *root = of_find_node_by_path("/");
241 170 struct device_node *node = NULL;
242 /* Check all possible buses. */
243 for (bus = 0; bus < 256; bus++) {
244 int ret = HvCallXm_testBus(bus);
245 if (ret == 0) {
246 printk("bus %d appears to exist\n", bus);
247 171
248 phb = pcibios_alloc_controller(NULL); 172 if (root == NULL) {
249 if (phb == NULL) 173 printk(KERN_CRIT "iSeries_pcibios_init: can't find root "
250 return -ENOMEM; 174 "of device tree\n");
251 175 return;
252 phb->pci_mem_offset = phb->local_number = bus; 176 }
253 phb->first_busno = bus; 177 while ((node = of_get_next_child(root, node)) != NULL) {
254 phb->last_busno = bus; 178 HvBusNumber bus;
255 phb->ops = &iSeries_pci_ops; 179 u32 *busp;
256 180
257 /* Find and connect the devices. */ 181 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
258 scan_PHB_slots(phb); 182 continue;
259 } 183
260 /* 184 busp = (u32 *)get_property(node, "bus-range", NULL);
261 * Check for Unexpected Return code, a clue that something 185 if (busp == NULL)
262 * has gone wrong. 186 continue;
263 */ 187 bus = *busp;
264 else if (ret != 0x0301) 188 printk("bus %d appears to exist\n", bus);
265 printk(KERN_ERR "Unexpected Return on Probe(0x%04X): 0x%04X", 189 phb = pcibios_alloc_controller(node);
266 bus, ret); 190 if (phb == NULL)
191 continue;
192
193 phb->pci_mem_offset = phb->local_number = bus;
194 phb->first_busno = bus;
195 phb->last_busno = bus;
196 phb->ops = &iSeries_pci_ops;
267 } 197 }
268 return 0;
269}
270 198
271/* 199 of_node_put(root);
272 * iSeries_pcibios_init 200
273 * 201 pci_devs_phb_init();
274 * Chance to initialize and structures or variable before PCI Bus walk.
275 */
276void iSeries_pcibios_init(void)
277{
278 iomm_table_initialize();
279 find_and_init_phbs();
280 io_page_mask = -1;
281} 202}
282 203
283/* 204/*
@@ -299,6 +220,34 @@ void __init iSeries_pci_final_fixup(void)
299 pdev->bus->number, pdev->devfn, node); 220 pdev->bus->number, pdev->devfn, node);
300 221
301 if (node != NULL) { 222 if (node != NULL) {
223 struct pci_dn *pdn = PCI_DN(node);
224 u32 *agent;
225
226 agent = (u32 *)get_property(node, "linux,agent-id",
227 NULL);
228 if ((pdn != NULL) && (agent != NULL)) {
229 u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
230 pdn->bussubno);
231 int err;
232
233 err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
234 *agent, irq);
235 if (err)
236 pci_Log_Error("Connect Bus Unit",
237 pdn->busno, pdn->bussubno, *agent, err);
238 else {
239 err = HvCallPci_configStore8(pdn->busno, pdn->bussubno,
240 *agent,
241 PCI_INTERRUPT_LINE,
242 irq);
243 if (err)
244 pci_Log_Error("PciCfgStore Irq Failed!",
245 pdn->busno, pdn->bussubno, *agent, err);
246 }
247 if (!err)
248 pdev->irq = irq;
249 }
250
302 ++DeviceCount; 251 ++DeviceCount;
303 pdev->sysdata = (void *)node; 252 pdev->sysdata = (void *)node;
304 PCI_DN(node)->pcidev = pdev; 253 PCI_DN(node)->pcidev = pdev;
@@ -308,7 +257,6 @@ void __init iSeries_pci_final_fixup(void)
308 } else 257 } else
309 printk("PCI: Device Tree not found for 0x%016lX\n", 258 printk("PCI: Device Tree not found for 0x%016lX\n",
310 (unsigned long)pdev); 259 (unsigned long)pdev);
311 pdev->irq = PCI_DN(node)->Irq;
312 } 260 }
313 iSeries_activate_IRQs(); 261 iSeries_activate_IRQs();
314 mf_display_src(0xC9000200); 262 mf_display_src(0xC9000200);
@@ -323,148 +271,6 @@ void pcibios_fixup_resources(struct pci_dev *pdev)
323} 271}
324 272
325/* 273/*
326 * Loop through each node function to find usable EADs bridges.
327 */
328static void scan_PHB_slots(struct pci_controller *Phb)
329{
330 struct HvCallPci_DeviceInfo *DevInfo;
331 HvBusNumber bus = Phb->local_number; /* System Bus */
332 const HvSubBusNumber SubBus = 0; /* EADs is always 0. */
333 int HvRc = 0;
334 int IdSel;
335 const int MaxAgents = 8;
336
337 DevInfo = (struct HvCallPci_DeviceInfo*)
338 kmalloc(sizeof(struct HvCallPci_DeviceInfo), GFP_KERNEL);
339 if (DevInfo == NULL)
340 return;
341
342 /*
343 * Probe for EADs Bridges
344 */
345 for (IdSel = 1; IdSel < MaxAgents; ++IdSel) {
346 HvRc = HvCallPci_getDeviceInfo(bus, SubBus, IdSel,
347 iseries_hv_addr(DevInfo),
348 sizeof(struct HvCallPci_DeviceInfo));
349 if (HvRc == 0) {
350 if (DevInfo->deviceType == HvCallPci_NodeDevice)
351 scan_EADS_bridge(bus, SubBus, IdSel);
352 else
353 printk("PCI: Invalid System Configuration(0x%02X)"
354 " for bus 0x%02x id 0x%02x.\n",
355 DevInfo->deviceType, bus, IdSel);
356 }
357 else
358 pci_Log_Error("getDeviceInfo", bus, SubBus, IdSel, HvRc);
359 }
360 kfree(DevInfo);
361}
362
363static void scan_EADS_bridge(HvBusNumber bus, HvSubBusNumber SubBus,
364 int IdSel)
365{
366 struct HvCallPci_BridgeInfo *BridgeInfo;
367 HvAgentId AgentId;
368 int Function;
369 int HvRc;
370
371 BridgeInfo = (struct HvCallPci_BridgeInfo *)
372 kmalloc(sizeof(struct HvCallPci_BridgeInfo), GFP_KERNEL);
373 if (BridgeInfo == NULL)
374 return;
375
376 /* Note: hvSubBus and irq is always be 0 at this level! */
377 for (Function = 0; Function < 8; ++Function) {
378 AgentId = ISERIES_PCI_AGENTID(IdSel, Function);
379 HvRc = HvCallXm_connectBusUnit(bus, SubBus, AgentId, 0);
380 if (HvRc == 0) {
381 printk("found device at bus %d idsel %d func %d (AgentId %x)\n",
382 bus, IdSel, Function, AgentId);
383 /* Connect EADs: 0x18.00.12 = 0x00 */
384 HvRc = HvCallPci_getBusUnitInfo(bus, SubBus, AgentId,
385 iseries_hv_addr(BridgeInfo),
386 sizeof(struct HvCallPci_BridgeInfo));
387 if (HvRc == 0) {
388 printk("bridge info: type %x subbus %x maxAgents %x maxsubbus %x logslot %x\n",
389 BridgeInfo->busUnitInfo.deviceType,
390 BridgeInfo->subBusNumber,
391 BridgeInfo->maxAgents,
392 BridgeInfo->maxSubBusNumber,
393 BridgeInfo->logicalSlotNumber);
394 if (BridgeInfo->busUnitInfo.deviceType ==
395 HvCallPci_BridgeDevice) {
396 /* Scan_Bridge_Slot...: 0x18.00.12 */
397 scan_bridge_slot(bus, BridgeInfo);
398 } else
399 printk("PCI: Invalid Bridge Configuration(0x%02X)",
400 BridgeInfo->busUnitInfo.deviceType);
401 }
402 } else if (HvRc != 0x000B)
403 pci_Log_Error("EADs Connect",
404 bus, SubBus, AgentId, HvRc);
405 }
406 kfree(BridgeInfo);
407}
408
409/*
410 * This assumes that the node slot is always on the primary bus!
411 */
412static int scan_bridge_slot(HvBusNumber Bus,
413 struct HvCallPci_BridgeInfo *BridgeInfo)
414{
415 struct device_node *node;
416 HvSubBusNumber SubBus = BridgeInfo->subBusNumber;
417 u16 VendorId = 0;
418 int HvRc = 0;
419 u8 Irq = 0;
420 int IdSel = ISERIES_GET_DEVICE_FROM_SUBBUS(SubBus);
421 int Function = ISERIES_GET_FUNCTION_FROM_SUBBUS(SubBus);
422 HvAgentId EADsIdSel = ISERIES_PCI_AGENTID(IdSel, Function);
423
424 /* iSeries_allocate_IRQ.: 0x18.00.12(0xA3) */
425 Irq = iSeries_allocate_IRQ(Bus, 0, EADsIdSel);
426
427 /*
428 * Connect all functions of any device found.
429 */
430 for (IdSel = 1; IdSel <= BridgeInfo->maxAgents; ++IdSel) {
431 for (Function = 0; Function < 8; ++Function) {
432 HvAgentId AgentId = ISERIES_PCI_AGENTID(IdSel, Function);
433 HvRc = HvCallXm_connectBusUnit(Bus, SubBus,
434 AgentId, Irq);
435 if (HvRc != 0) {
436 pci_Log_Error("Connect Bus Unit",
437 Bus, SubBus, AgentId, HvRc);
438 continue;
439 }
440
441 HvRc = HvCallPci_configLoad16(Bus, SubBus, AgentId,
442 PCI_VENDOR_ID, &VendorId);
443 if (HvRc != 0) {
444 pci_Log_Error("Read Vendor",
445 Bus, SubBus, AgentId, HvRc);
446 continue;
447 }
448 printk("read vendor ID: %x\n", VendorId);
449
450 /* FoundDevice: 0x18.28.10 = 0x12AE */
451 HvRc = HvCallPci_configStore8(Bus, SubBus, AgentId,
452 PCI_INTERRUPT_LINE, Irq);
453 if (HvRc != 0)
454 pci_Log_Error("PciCfgStore Irq Failed!",
455 Bus, SubBus, AgentId, HvRc);
456
457 ++DeviceCount;
458 node = build_device_node(Bus, SubBus, EADsIdSel, Function);
459 PCI_DN(node)->Irq = Irq;
460 PCI_DN(node)->LogicalSlot = BridgeInfo->logicalSlotNumber;
461
462 } /* for (Function = 0; Function < 8; ++Function) */
463 } /* for (IdSel = 1; IdSel <= MaxAgents; ++IdSel) */
464 return HvRc;
465}
466
467/*
468 * I/0 Memory copy MUST use mmio commands on iSeries 274 * I/0 Memory copy MUST use mmio commands on iSeries
469 * To do; For performance, include the hv call directly 275 * To do; For performance, include the hv call directly
470 */ 276 */
@@ -509,11 +315,13 @@ EXPORT_SYMBOL(iSeries_memcpy_fromio);
509 */ 315 */
510static struct device_node *find_Device_Node(int bus, int devfn) 316static struct device_node *find_Device_Node(int bus, int devfn)
511{ 317{
512 struct pci_dn *pdn; 318 struct device_node *node;
319
320 for (node = NULL; (node = of_find_all_nodes(node)); ) {
321 struct pci_dn *pdn = PCI_DN(node);
513 322
514 list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) { 323 if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
515 if ((bus == pdn->busno) && (devfn == pdn->devfn)) 324 return node;
516 return pdn->node;
517 } 325 }
518 return NULL; 326 return NULL;
519} 327}
@@ -625,7 +433,6 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
625 if (ret != 0) { 433 if (ret != 0) {
626 struct pci_dn *pdn = PCI_DN(DevNode); 434 struct pci_dn *pdn = PCI_DN(DevNode);
627 435
628 ++Pci_Error_Count;
629 (*retry)++; 436 (*retry)++;
630 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n", 437 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n",
631 TextHdr, pdn->busno, pdn->devfn, 438 TextHdr, pdn->busno, pdn->devfn,
@@ -707,7 +514,6 @@ u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
707 return 0xff; 514 return 0xff;
708 } 515 }
709 do { 516 do {
710 ++Pci_Io_Read_Count;
711 HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, BarOffset, 0); 517 HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, BarOffset, 0);
712 } while (CheckReturnCode("RDB", DevNode, &retry, ret.rc) != 0); 518 } while (CheckReturnCode("RDB", DevNode, &retry, ret.rc) != 0);
713 519
@@ -737,7 +543,6 @@ u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
737 return 0xffff; 543 return 0xffff;
738 } 544 }
739 do { 545 do {
740 ++Pci_Io_Read_Count;
741 HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa, 546 HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
742 BarOffset, 0); 547 BarOffset, 0);
743 } while (CheckReturnCode("RDW", DevNode, &retry, ret.rc) != 0); 548 } while (CheckReturnCode("RDW", DevNode, &retry, ret.rc) != 0);
@@ -768,7 +573,6 @@ u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
768 return 0xffffffff; 573 return 0xffffffff;
769 } 574 }
770 do { 575 do {
771 ++Pci_Io_Read_Count;
772 HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa, 576 HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
773 BarOffset, 0); 577 BarOffset, 0);
774 } while (CheckReturnCode("RDL", DevNode, &retry, ret.rc) != 0); 578 } while (CheckReturnCode("RDL", DevNode, &retry, ret.rc) != 0);
@@ -806,7 +610,6 @@ void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
806 return; 610 return;
807 } 611 }
808 do { 612 do {
809 ++Pci_Io_Write_Count;
810 rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0); 613 rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0);
811 } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0); 614 } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0);
812} 615}
@@ -834,7 +637,6 @@ void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
834 return; 637 return;
835 } 638 }
836 do { 639 do {
837 ++Pci_Io_Write_Count;
838 rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0); 640 rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0);
839 } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0); 641 } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0);
840} 642}
@@ -862,7 +664,6 @@ void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
862 return; 664 return;
863 } 665 }
864 do { 666 do {
865 ++Pci_Io_Write_Count;
866 rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0); 667 rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0);
867 } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0); 668 } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0);
868} 669}
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index a6fd9bedb074..617c724c4590 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -50,7 +50,6 @@
50#include <asm/iseries/hv_call_xm.h> 50#include <asm/iseries/hv_call_xm.h>
51#include <asm/iseries/it_lp_queue.h> 51#include <asm/iseries/it_lp_queue.h>
52#include <asm/iseries/mf.h> 52#include <asm/iseries/mf.h>
53#include <asm/iseries/it_exp_vpd_panel.h>
54#include <asm/iseries/hv_lp_event.h> 53#include <asm/iseries/hv_lp_event.h>
55#include <asm/iseries/lpar_map.h> 54#include <asm/iseries/lpar_map.h>
56#include <asm/udbg.h> 55#include <asm/udbg.h>
@@ -81,9 +80,6 @@ extern void iSeries_pci_final_fixup(void);
81static void iSeries_pci_final_fixup(void) { } 80static void iSeries_pci_final_fixup(void) { }
82#endif 81#endif
83 82
84/* Global Variables */
85int piranha_simulator;
86
87extern int rd_size; /* Defined in drivers/block/rd.c */ 83extern int rd_size; /* Defined in drivers/block/rd.c */
88extern unsigned long embedded_sysmap_start; 84extern unsigned long embedded_sysmap_start;
89extern unsigned long embedded_sysmap_end; 85extern unsigned long embedded_sysmap_end;
@@ -91,8 +87,6 @@ extern unsigned long embedded_sysmap_end;
91extern unsigned long iSeries_recal_tb; 87extern unsigned long iSeries_recal_tb;
92extern unsigned long iSeries_recal_titan; 88extern unsigned long iSeries_recal_titan;
93 89
94static unsigned long cmd_mem_limit;
95
96struct MemoryBlock { 90struct MemoryBlock {
97 unsigned long absStart; 91 unsigned long absStart;
98 unsigned long absEnd; 92 unsigned long absEnd;
@@ -340,8 +334,6 @@ static void __init iSeries_init_early(void)
340#ifdef CONFIG_SMP 334#ifdef CONFIG_SMP
341 smp_init_iSeries(); 335 smp_init_iSeries();
342#endif 336#endif
343 if (itLpNaca.xPirEnvironMode == 0)
344 piranha_simulator = 1;
345 337
346 /* Associate Lp Event Queue 0 with processor 0 */ 338 /* Associate Lp Event Queue 0 with processor 0 */
347 HvCallEvent_setLpEventQueueInterruptProc(0, 0); 339 HvCallEvent_setLpEventQueueInterruptProc(0, 0);
@@ -536,10 +528,10 @@ static void __init iSeries_setup_arch(void)
536{ 528{
537 if (get_lppaca()->shared_proc) { 529 if (get_lppaca()->shared_proc) {
538 ppc_md.idle_loop = iseries_shared_idle; 530 ppc_md.idle_loop = iseries_shared_idle;
539 printk(KERN_INFO "Using shared processor idle loop\n"); 531 printk(KERN_DEBUG "Using shared processor idle loop\n");
540 } else { 532 } else {
541 ppc_md.idle_loop = iseries_dedicated_idle; 533 ppc_md.idle_loop = iseries_dedicated_idle;
542 printk(KERN_INFO "Using dedicated idle loop\n"); 534 printk(KERN_DEBUG "Using dedicated idle loop\n");
543 } 535 }
544 536
545 /* Setup the Lp Event Queue */ 537 /* Setup the Lp Event Queue */
@@ -714,243 +706,6 @@ define_machine(iseries) {
714 /* XXX Implement enable_pmcs for iSeries */ 706 /* XXX Implement enable_pmcs for iSeries */
715}; 707};
716 708
717struct blob {
718 unsigned char data[PAGE_SIZE];
719 unsigned long next;
720};
721
722struct iseries_flat_dt {
723 struct boot_param_header header;
724 u64 reserve_map[2];
725 struct blob dt;
726 struct blob strings;
727};
728
729struct iseries_flat_dt iseries_dt;
730
731void dt_init(struct iseries_flat_dt *dt)
732{
733 dt->header.off_mem_rsvmap =
734 offsetof(struct iseries_flat_dt, reserve_map);
735 dt->header.off_dt_struct = offsetof(struct iseries_flat_dt, dt);
736 dt->header.off_dt_strings = offsetof(struct iseries_flat_dt, strings);
737 dt->header.totalsize = sizeof(struct iseries_flat_dt);
738 dt->header.dt_strings_size = sizeof(struct blob);
739
740 /* There is no notion of hardware cpu id on iSeries */
741 dt->header.boot_cpuid_phys = smp_processor_id();
742
743 dt->dt.next = (unsigned long)&dt->dt.data;
744 dt->strings.next = (unsigned long)&dt->strings.data;
745
746 dt->header.magic = OF_DT_HEADER;
747 dt->header.version = 0x10;
748 dt->header.last_comp_version = 0x10;
749
750 dt->reserve_map[0] = 0;
751 dt->reserve_map[1] = 0;
752}
753
754void dt_check_blob(struct blob *b)
755{
756 if (b->next >= (unsigned long)&b->next) {
757 DBG("Ran out of space in flat device tree blob!\n");
758 BUG();
759 }
760}
761
762void dt_push_u32(struct iseries_flat_dt *dt, u32 value)
763{
764 *((u32*)dt->dt.next) = value;
765 dt->dt.next += sizeof(u32);
766
767 dt_check_blob(&dt->dt);
768}
769
770void dt_push_u64(struct iseries_flat_dt *dt, u64 value)
771{
772 *((u64*)dt->dt.next) = value;
773 dt->dt.next += sizeof(u64);
774
775 dt_check_blob(&dt->dt);
776}
777
778unsigned long dt_push_bytes(struct blob *blob, char *data, int len)
779{
780 unsigned long start = blob->next - (unsigned long)blob->data;
781
782 memcpy((char *)blob->next, data, len);
783 blob->next = _ALIGN(blob->next + len, 4);
784
785 dt_check_blob(blob);
786
787 return start;
788}
789
790void dt_start_node(struct iseries_flat_dt *dt, char *name)
791{
792 dt_push_u32(dt, OF_DT_BEGIN_NODE);
793 dt_push_bytes(&dt->dt, name, strlen(name) + 1);
794}
795
796#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
797
798void dt_prop(struct iseries_flat_dt *dt, char *name, char *data, int len)
799{
800 unsigned long offset;
801
802 dt_push_u32(dt, OF_DT_PROP);
803
804 /* Length of the data */
805 dt_push_u32(dt, len);
806
807 /* Put the property name in the string blob. */
808 offset = dt_push_bytes(&dt->strings, name, strlen(name) + 1);
809
810 /* The offset of the properties name in the string blob. */
811 dt_push_u32(dt, (u32)offset);
812
813 /* The actual data. */
814 dt_push_bytes(&dt->dt, data, len);
815}
816
817void dt_prop_str(struct iseries_flat_dt *dt, char *name, char *data)
818{
819 dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */
820}
821
822void dt_prop_u32(struct iseries_flat_dt *dt, char *name, u32 data)
823{
824 dt_prop(dt, name, (char *)&data, sizeof(u32));
825}
826
827void dt_prop_u64(struct iseries_flat_dt *dt, char *name, u64 data)
828{
829 dt_prop(dt, name, (char *)&data, sizeof(u64));
830}
831
832void dt_prop_u64_list(struct iseries_flat_dt *dt, char *name, u64 *data, int n)
833{
834 dt_prop(dt, name, (char *)data, sizeof(u64) * n);
835}
836
837void dt_prop_u32_list(struct iseries_flat_dt *dt, char *name, u32 *data, int n)
838{
839 dt_prop(dt, name, (char *)data, sizeof(u32) * n);
840}
841
842void dt_prop_empty(struct iseries_flat_dt *dt, char *name)
843{
844 dt_prop(dt, name, NULL, 0);
845}
846
847void dt_cpus(struct iseries_flat_dt *dt)
848{
849 unsigned char buf[32];
850 unsigned char *p;
851 unsigned int i, index;
852 struct IoHriProcessorVpd *d;
853 u32 pft_size[2];
854
855 /* yuck */
856 snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name);
857 p = strchr(buf, ' ');
858 if (!p) p = buf + strlen(buf);
859
860 dt_start_node(dt, "cpus");
861 dt_prop_u32(dt, "#address-cells", 1);
862 dt_prop_u32(dt, "#size-cells", 0);
863
864 pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */
865 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
866
867 for (i = 0; i < NR_CPUS; i++) {
868 if (lppaca[i].dyn_proc_status >= 2)
869 continue;
870
871 snprintf(p, 32 - (p - buf), "@%d", i);
872 dt_start_node(dt, buf);
873
874 dt_prop_str(dt, "device_type", "cpu");
875
876 index = lppaca[i].dyn_hv_phys_proc_index;
877 d = &xIoHriProcessorVpd[index];
878
879 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
880 dt_prop_u32(dt, "i-cache-line-size", d->xInstCacheOperandSize);
881
882 dt_prop_u32(dt, "d-cache-size", d->xDataL1CacheSizeKB * 1024);
883 dt_prop_u32(dt, "d-cache-line-size", d->xDataCacheOperandSize);
884
885 /* magic conversions to Hz copied from old code */
886 dt_prop_u32(dt, "clock-frequency",
887 ((1UL << 34) * 1000000) / d->xProcFreq);
888 dt_prop_u32(dt, "timebase-frequency",
889 ((1UL << 32) * 1000000) / d->xTimeBaseFreq);
890
891 dt_prop_u32(dt, "reg", i);
892
893 dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2);
894
895 dt_end_node(dt);
896 }
897
898 dt_end_node(dt);
899}
900
901void dt_model(struct iseries_flat_dt *dt)
902{
903 char buf[16] = "IBM,";
904
905 /* "IBM," + mfgId[2:3] + systemSerial[1:5] */
906 strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
907 strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
908 buf[11] = '\0';
909 dt_prop_str(dt, "system-id", buf);
910
911 /* "IBM," + machineType[0:4] */
912 strne2a(buf + 4, xItExtVpdPanel.machineType, 4);
913 buf[8] = '\0';
914 dt_prop_str(dt, "model", buf);
915
916 dt_prop_str(dt, "compatible", "IBM,iSeries");
917}
918
919void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
920{
921 u64 tmp[2];
922
923 dt_init(dt);
924
925 dt_start_node(dt, "");
926
927 dt_prop_u32(dt, "#address-cells", 2);
928 dt_prop_u32(dt, "#size-cells", 2);
929 dt_model(dt);
930
931 /* /memory */
932 dt_start_node(dt, "memory@0");
933 dt_prop_str(dt, "name", "memory");
934 dt_prop_str(dt, "device_type", "memory");
935 tmp[0] = 0;
936 tmp[1] = phys_mem_size;
937 dt_prop_u64_list(dt, "reg", tmp, 2);
938 dt_end_node(dt);
939
940 /* /chosen */
941 dt_start_node(dt, "chosen");
942 dt_prop_str(dt, "bootargs", cmd_line);
943 if (cmd_mem_limit)
944 dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit);
945 dt_end_node(dt);
946
947 dt_cpus(dt);
948
949 dt_end_node(dt);
950
951 dt_push_u32(dt, OF_DT_END);
952}
953
954void * __init iSeries_early_setup(void) 709void * __init iSeries_early_setup(void)
955{ 710{
956 unsigned long phys_mem_size; 711 unsigned long phys_mem_size;
@@ -965,28 +720,8 @@ void * __init iSeries_early_setup(void)
965 720
966 iSeries_get_cmdline(); 721 iSeries_get_cmdline();
967 722
968 /* Save unparsed command line copy for /proc/cmdline */ 723 return (void *) __pa(build_flat_dt(phys_mem_size));
969 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
970
971 /* Parse early parameters, in particular mem=x */
972 parse_early_param();
973
974 build_flat_dt(&iseries_dt, phys_mem_size);
975
976 return (void *) __pa(&iseries_dt);
977}
978
979/*
980 * On iSeries we just parse the mem=X option from the command line.
981 * On pSeries it's a bit more complicated, see prom_init_mem()
982 */
983static int __init early_parsemem(char *p)
984{
985 if (p)
986 cmd_mem_limit = ALIGN(memparse(p, &p), PAGE_SIZE);
987 return 0;
988} 724}
989early_param("mem", early_parsemem);
990 725
991static void hvputc(char c) 726static void hvputc(char c)
992{ 727{
diff --git a/arch/powerpc/platforms/iseries/setup.h b/arch/powerpc/platforms/iseries/setup.h
index 5213044ec411..0a47ac53c959 100644
--- a/arch/powerpc/platforms/iseries/setup.h
+++ b/arch/powerpc/platforms/iseries/setup.h
@@ -21,4 +21,6 @@ extern unsigned long iSeries_get_boot_time(void);
21extern int iSeries_set_rtc_time(struct rtc_time *tm); 21extern int iSeries_set_rtc_time(struct rtc_time *tm);
22extern void iSeries_get_rtc_time(struct rtc_time *tm); 22extern void iSeries_get_rtc_time(struct rtc_time *tm);
23 23
24extern void *build_flat_dt(unsigned long phys_mem_size);
25
24#endif /* __ISERIES_SETUP_H__ */ 26#endif /* __ISERIES_SETUP_H__ */
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
deleted file mode 100644
index ad36ab0639f0..000000000000
--- a/arch/powerpc/platforms/iseries/vio.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * IBM PowerPC iSeries Virtual I/O Infrastructure Support.
3 *
4 * Copyright (c) 2005 Stephen Rothwell, IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/types.h>
12#include <linux/device.h>
13#include <linux/init.h>
14
15#include <asm/vio.h>
16#include <asm/iommu.h>
17#include <asm/tce.h>
18#include <asm/abs_addr.h>
19#include <asm/page.h>
20#include <asm/iseries/vio.h>
21#include <asm/iseries/hv_types.h>
22#include <asm/iseries/hv_lp_config.h>
23#include <asm/iseries/hv_call_xm.h>
24
25#include "iommu.h"
26
27struct device *iSeries_vio_dev = &vio_bus_device.dev;
28EXPORT_SYMBOL(iSeries_vio_dev);
29
30static struct iommu_table veth_iommu_table;
31static struct iommu_table vio_iommu_table;
32
33static void __init iommu_vio_init(void)
34{
35 iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
36 veth_iommu_table.it_size /= 2;
37 vio_iommu_table = veth_iommu_table;
38 vio_iommu_table.it_offset += veth_iommu_table.it_size;
39
40 if (!iommu_init_table(&veth_iommu_table))
41 printk("Virtual Bus VETH TCE table failed.\n");
42 if (!iommu_init_table(&vio_iommu_table))
43 printk("Virtual Bus VIO TCE table failed.\n");
44}
45
46/**
47 * vio_register_device_iseries: - Register a new iSeries vio device.
48 * @voidev: The device to register.
49 */
50static struct vio_dev *__init vio_register_device_iseries(char *type,
51 uint32_t unit_num)
52{
53 struct vio_dev *viodev;
54
55 /* allocate a vio_dev for this device */
56 viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL);
57 if (!viodev)
58 return NULL;
59 memset(viodev, 0, sizeof(struct vio_dev));
60
61 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s%d", type, unit_num);
62
63 viodev->name = viodev->dev.bus_id;
64 viodev->type = type;
65 viodev->unit_address = unit_num;
66 viodev->iommu_table = &vio_iommu_table;
67 if (vio_register_device(viodev) == NULL) {
68 kfree(viodev);
69 return NULL;
70 }
71 return viodev;
72}
73
74void __init probe_bus_iseries(void)
75{
76 HvLpIndexMap vlan_map;
77 struct vio_dev *viodev;
78 int i;
79
80 /* there is only one of each of these */
81 vio_register_device_iseries("viocons", 0);
82 vio_register_device_iseries("vscsi", 0);
83
84 vlan_map = HvLpConfig_getVirtualLanIndexMap();
85 for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) {
86 if ((vlan_map & (0x8000 >> i)) == 0)
87 continue;
88 viodev = vio_register_device_iseries("vlan", i);
89 /* veth is special and has it own iommu_table */
90 viodev->iommu_table = &veth_iommu_table;
91 }
92 for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++)
93 vio_register_device_iseries("viodasd", i);
94 for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++)
95 vio_register_device_iseries("viocd", i);
96 for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++)
97 vio_register_device_iseries("viotape", i);
98}
99
100/**
101 * vio_match_device_iseries: - Tell if a iSeries VIO device matches a
102 * vio_device_id
103 */
104static int vio_match_device_iseries(const struct vio_device_id *id,
105 const struct vio_dev *dev)
106{
107 return strncmp(dev->type, id->type, strlen(id->type)) == 0;
108}
109
110static struct vio_bus_ops vio_bus_ops_iseries = {
111 .match = vio_match_device_iseries,
112};
113
114/**
115 * vio_bus_init_iseries: - Initialize the iSeries virtual IO bus
116 */
117static int __init vio_bus_init_iseries(void)
118{
119 int err;
120
121 err = vio_bus_init(&vio_bus_ops_iseries);
122 if (err == 0) {
123 iommu_vio_init();
124 vio_bus_device.iommu_table = &vio_iommu_table;
125 iSeries_vio_dev = &vio_bus_device.dev;
126 probe_bus_iseries();
127 }
128 return err;
129}
130
131__initcall(vio_bus_init_iseries);
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 85d6c93659cc..9a4efc0c3b29 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -437,9 +437,6 @@ void __init maple_pci_init(void)
437 437
438 /* Tell pci.c to not change any resource allocations. */ 438 /* Tell pci.c to not change any resource allocations. */
439 pci_probe_only = 1; 439 pci_probe_only = 1;
440
441 /* Allow all IO */
442 io_page_mask = -1;
443} 440}
444 441
445int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel) 442int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 24c0aef4ea39..a0505ea48a86 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -189,7 +189,7 @@ void __init maple_setup_arch(void)
189 conswitchp = &dummy_con; 189 conswitchp = &dummy_con;
190#endif 190#endif
191 191
192 printk(KERN_INFO "Using native/NAP idle loop\n"); 192 printk(KERN_DEBUG "Using native/NAP idle loop\n");
193} 193}
194 194
195/* 195/*
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index cfd6527a0d7e..af2a8f9f1222 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -314,7 +314,7 @@ static int pmu_set_cpu_speed(int low_speed)
314 _set_L3CR(save_l3cr); 314 _set_L3CR(save_l3cr);
315 315
316 /* Restore userland MMU context */ 316 /* Restore userland MMU context */
317 set_context(current->active_mm->context, current->active_mm->pgd); 317 set_context(current->active_mm->context.id, current->active_mm->pgd);
318 318
319#ifdef DEBUG_FREQ 319#ifdef DEBUG_FREQ
320 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1)); 320 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index a5063cd675c5..85e00cb0006e 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -2510,7 +2510,7 @@ found:
2510 if (get_property(np, "flush-on-lock", NULL)) 2510 if (get_property(np, "flush-on-lock", NULL))
2511 break; 2511 break;
2512 powersave_nap = 1; 2512 powersave_nap = 1;
2513 printk(KERN_INFO "Processor NAP mode on idle enabled.\n"); 2513 printk(KERN_DEBUG "Processor NAP mode on idle enabled.\n");
2514 break; 2514 break;
2515 } 2515 }
2516 2516
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index ea179afea632..80035853467b 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1068,9 +1068,6 @@ void __init pmac_pci_init(void)
1068 /* Tell pci.c to not use the common resource allocation mechanism */ 1068 /* Tell pci.c to not use the common resource allocation mechanism */
1069 pci_probe_only = 1; 1069 pci_probe_only = 1;
1070 1070
1071 /* Allow all IO */
1072 io_page_mask = -1;
1073
1074#else /* CONFIG_PPC64 */ 1071#else /* CONFIG_PPC64 */
1075 init_p2pbridge(); 1072 init_p2pbridge();
1076 fixup_nec_usb2(); 1073 fixup_nec_usb2();
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
index f08173b0f065..047f954a89eb 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -871,10 +871,17 @@ int pmf_register_irq_client(struct device_node *target,
871 spin_unlock_irqrestore(&pmf_lock, flags); 871 spin_unlock_irqrestore(&pmf_lock, flags);
872 if (func == NULL) 872 if (func == NULL)
873 return -ENODEV; 873 return -ENODEV;
874
875 /* guard against manipulations of list */
874 mutex_lock(&pmf_irq_mutex); 876 mutex_lock(&pmf_irq_mutex);
875 if (list_empty(&func->irq_clients)) 877 if (list_empty(&func->irq_clients))
876 func->dev->handlers->irq_enable(func); 878 func->dev->handlers->irq_enable(func);
879
880 /* guard against pmf_do_irq while changing list */
881 spin_lock_irqsave(&pmf_lock, flags);
877 list_add(&client->link, &func->irq_clients); 882 list_add(&client->link, &func->irq_clients);
883 spin_unlock_irqrestore(&pmf_lock, flags);
884
878 client->func = func; 885 client->func = func;
879 mutex_unlock(&pmf_irq_mutex); 886 mutex_unlock(&pmf_irq_mutex);
880 887
@@ -885,12 +892,19 @@ EXPORT_SYMBOL_GPL(pmf_register_irq_client);
885void pmf_unregister_irq_client(struct pmf_irq_client *client) 892void pmf_unregister_irq_client(struct pmf_irq_client *client)
886{ 893{
887 struct pmf_function *func = client->func; 894 struct pmf_function *func = client->func;
895 unsigned long flags;
888 896
889 BUG_ON(func == NULL); 897 BUG_ON(func == NULL);
890 898
899 /* guard against manipulations of list */
891 mutex_lock(&pmf_irq_mutex); 900 mutex_lock(&pmf_irq_mutex);
892 client->func = NULL; 901 client->func = NULL;
902
903 /* guard against pmf_do_irq while changing list */
904 spin_lock_irqsave(&pmf_lock, flags);
893 list_del(&client->link); 905 list_del(&client->link);
906 spin_unlock_irqrestore(&pmf_lock, flags);
907
894 if (list_empty(&func->irq_clients)) 908 if (list_empty(&func->irq_clients))
895 func->dev->handlers->irq_disable(func); 909 func->dev->handlers->irq_disable(func);
896 mutex_unlock(&pmf_irq_mutex); 910 mutex_unlock(&pmf_irq_mutex);
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index b9200fb07815..9cc7db7a8bdc 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -458,7 +458,7 @@ static int pmac_pm_finish(suspend_state_t state)
458 printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state); 458 printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
459 459
460 /* Restore userland MMU context */ 460 /* Restore userland MMU context */
461 set_context(current->active_mm->context, current->active_mm->pgd); 461 set_context(current->active_mm->context.id, current->active_mm->pgd);
462 462
463 return 0; 463 return 0;
464} 464}
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 930898635c9f..e5e0ff466904 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -1,8 +1,11 @@
1ifeq ($(CONFIG_PPC64),y)
2EXTRA_CFLAGS += -mno-minimal-toc
3endif
4
1obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ 5obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \
2 setup.o iommu.o ras.o rtasd.o pci_dlpar.o \ 6 setup.o iommu.o ras.o rtasd.o pci_dlpar.o \
3 firmware.o 7 firmware.o
4obj-$(CONFIG_SMP) += smp.o 8obj-$(CONFIG_SMP) += smp.o
5obj-$(CONFIG_IBMVIO) += vio.o
6obj-$(CONFIG_XICS) += xics.o 9obj-$(CONFIG_XICS) += xics.o
7obj-$(CONFIG_SCANLOG) += scanlog.o 10obj-$(CONFIG_SCANLOG) += scanlog.o
8obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o 11obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index d4a402c5866c..98c23aec85be 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -304,6 +304,8 @@ void __init pci_addr_cache_build(void)
304 pci_addr_cache_insert_device(dev); 304 pci_addr_cache_insert_device(dev);
305 305
306 dn = pci_device_to_OF_node(dev); 306 dn = pci_device_to_OF_node(dev);
307 if (!dn)
308 continue;
307 pci_dev_get (dev); /* matching put is in eeh_remove_device() */ 309 pci_dev_get (dev); /* matching put is in eeh_remove_device() */
308 PCI_DN(dn)->pcidev = dev; 310 PCI_DN(dn)->pcidev = dev;
309 } 311 }
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 1fba695e32e8..0ec9a5445b95 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -23,9 +23,8 @@
23 * 23 *
24 */ 24 */
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/irq.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/notifier.h> 27#include <linux/irq.h>
29#include <linux/pci.h> 28#include <linux/pci.h>
30#include <asm/eeh.h> 29#include <asm/eeh.h>
31#include <asm/eeh_event.h> 30#include <asm/eeh_event.h>
@@ -202,7 +201,11 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata)
202 201
203static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) 202static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
204{ 203{
205 int rc; 204 int cnt, rc;
205
206 /* pcibios will clear the counter; save the value */
207 cnt = pe_dn->eeh_freeze_count;
208
206 if (bus) 209 if (bus)
207 pcibios_remove_pci_devices(bus); 210 pcibios_remove_pci_devices(bus);
208 211
@@ -241,6 +244,7 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
241 ssleep (5); 244 ssleep (5);
242 pcibios_add_pci_devices(bus); 245 pcibios_add_pci_devices(bus);
243 } 246 }
247 pe_dn->eeh_freeze_count = cnt;
244 248
245 return 0; 249 return 0;
246} 250}
@@ -250,23 +254,29 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
250 */ 254 */
251#define MAX_WAIT_FOR_RECOVERY 15 255#define MAX_WAIT_FOR_RECOVERY 15
252 256
253void handle_eeh_events (struct eeh_event *event) 257struct pci_dn * handle_eeh_events (struct eeh_event *event)
254{ 258{
255 struct device_node *frozen_dn; 259 struct device_node *frozen_dn;
256 struct pci_dn *frozen_pdn; 260 struct pci_dn *frozen_pdn;
257 struct pci_bus *frozen_bus; 261 struct pci_bus *frozen_bus;
258 int rc = 0; 262 int rc = 0;
259 enum pci_ers_result result = PCI_ERS_RESULT_NONE; 263 enum pci_ers_result result = PCI_ERS_RESULT_NONE;
260 const char *pci_str, *drv_str; 264 const char *location, *pci_str, *drv_str;
261 265
262 frozen_dn = find_device_pe(event->dn); 266 frozen_dn = find_device_pe(event->dn);
263 frozen_bus = pcibios_find_pci_bus(frozen_dn); 267 frozen_bus = pcibios_find_pci_bus(frozen_dn);
264 268
265 if (!frozen_dn) { 269 if (!frozen_dn) {
266 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint for %s\n", 270
267 pci_name(event->dev)); 271 location = (char *) get_property(event->dn, "ibm,loc-code", NULL);
268 return; 272 location = location ? location : "unknown";
273 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
274 "for location=%s pci addr=%s\n",
275 location, pci_name(event->dev));
276 return NULL;
269 } 277 }
278 location = (char *) get_property(frozen_dn, "ibm,loc-code", NULL);
279 location = location ? location : "unknown";
270 280
271 /* There are two different styles for coming up with the PE. 281 /* There are two different styles for coming up with the PE.
272 * In the old style, it was the highest EEH-capable device 282 * In the old style, it was the highest EEH-capable device
@@ -278,9 +288,10 @@ void handle_eeh_events (struct eeh_event *event)
278 frozen_bus = pcibios_find_pci_bus (frozen_dn->parent); 288 frozen_bus = pcibios_find_pci_bus (frozen_dn->parent);
279 289
280 if (!frozen_bus) { 290 if (!frozen_bus) {
281 printk(KERN_ERR "EEH: Cannot find PCI bus for %s\n", 291 printk(KERN_ERR "EEH: Cannot find PCI bus "
282 frozen_dn->full_name); 292 "for location=%s dn=%s\n",
283 return; 293 location, frozen_dn->full_name);
294 return NULL;
284 } 295 }
285 296
286#if 0 297#if 0
@@ -314,8 +325,9 @@ void handle_eeh_events (struct eeh_event *event)
314 325
315 eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */); 326 eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */);
316 printk(KERN_WARNING 327 printk(KERN_WARNING
317 "EEH: This PCI device has failed %d times since last reboot: %s - %s\n", 328 "EEH: This PCI device has failed %d times since last reboot: "
318 frozen_pdn->eeh_freeze_count, drv_str, pci_str); 329 "location=%s driver=%s pci addr=%s\n",
330 frozen_pdn->eeh_freeze_count, location, drv_str, pci_str);
319 331
320 /* Walk the various device drivers attached to this slot through 332 /* Walk the various device drivers attached to this slot through
321 * a reset sequence, giving each an opportunity to do what it needs 333 * a reset sequence, giving each an opportunity to do what it needs
@@ -355,7 +367,7 @@ void handle_eeh_events (struct eeh_event *event)
355 /* Tell all device drivers that they can resume operations */ 367 /* Tell all device drivers that they can resume operations */
356 pci_walk_bus(frozen_bus, eeh_report_resume, NULL); 368 pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
357 369
358 return; 370 return frozen_pdn;
359 371
360excess_failures: 372excess_failures:
361 /* 373 /*
@@ -364,17 +376,18 @@ excess_failures:
364 * due to actual, failed cards. 376 * due to actual, failed cards.
365 */ 377 */
366 printk(KERN_ERR 378 printk(KERN_ERR
367 "EEH: PCI device %s - %s has failed %d times \n" 379 "EEH: PCI device at location=%s driver=%s pci addr=%s \n"
368 "and has been permanently disabled. Please try reseating\n" 380 "has failed %d times and has been permanently disabled. \n"
369 "this device or replacing it.\n", 381 "Please try reseating this device or replacing it.\n",
370 drv_str, pci_str, frozen_pdn->eeh_freeze_count); 382 location, drv_str, pci_str, frozen_pdn->eeh_freeze_count);
371 goto perm_error; 383 goto perm_error;
372 384
373hard_fail: 385hard_fail:
374 printk(KERN_ERR 386 printk(KERN_ERR
375 "EEH: Unable to recover from failure of PCI device %s - %s\n" 387 "EEH: Unable to recover from failure of PCI device "
388 "at location=%s driver=%s pci addr=%s \n"
376 "Please try reseating this device or replacing it.\n", 389 "Please try reseating this device or replacing it.\n",
377 drv_str, pci_str); 390 location, drv_str, pci_str);
378 391
379perm_error: 392perm_error:
380 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */); 393 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */);
@@ -384,6 +397,8 @@ perm_error:
384 397
385 /* Shut down the device drivers for good. */ 398 /* Shut down the device drivers for good. */
386 pcibios_remove_pci_devices(frozen_bus); 399 pcibios_remove_pci_devices(frozen_bus);
400
401 return NULL;
387} 402}
388 403
389/* ---------- end of file ---------- */ 404/* ---------- end of file ---------- */
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index 40020c65c89e..8f2d12935b99 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -18,6 +18,7 @@
18 * Copyright (c) 2005 Linas Vepstas <linas@linas.org> 18 * Copyright (c) 2005 Linas Vepstas <linas@linas.org>
19 */ 19 */
20 20
21#include <linux/delay.h>
21#include <linux/list.h> 22#include <linux/list.h>
22#include <linux/mutex.h> 23#include <linux/mutex.h>
23#include <linux/pci.h> 24#include <linux/pci.h>
@@ -56,38 +57,43 @@ static int eeh_event_handler(void * dummy)
56{ 57{
57 unsigned long flags; 58 unsigned long flags;
58 struct eeh_event *event; 59 struct eeh_event *event;
60 struct pci_dn *pdn;
59 61
60 daemonize ("eehd"); 62 daemonize ("eehd");
63 set_current_state(TASK_INTERRUPTIBLE);
61 64
62 while (1) { 65 spin_lock_irqsave(&eeh_eventlist_lock, flags);
63 set_current_state(TASK_INTERRUPTIBLE); 66 event = NULL;
64 67
65 spin_lock_irqsave(&eeh_eventlist_lock, flags); 68 /* Unqueue the event, get ready to process. */
66 event = NULL; 69 if (!list_empty(&eeh_eventlist)) {
70 event = list_entry(eeh_eventlist.next, struct eeh_event, list);
71 list_del(&event->list);
72 }
73 spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
67 74
68 /* Unqueue the event, get ready to process. */ 75 if (event == NULL)
69 if (!list_empty(&eeh_eventlist)) { 76 return 0;
70 event = list_entry(eeh_eventlist.next, struct eeh_event, list);
71 list_del(&event->list);
72 }
73 spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
74 77
75 if (event == NULL) 78 /* Serialize processing of EEH events */
76 break; 79 mutex_lock(&eeh_event_mutex);
80 eeh_mark_slot(event->dn, EEH_MODE_RECOVERING);
77 81
78 /* Serialize processing of EEH events */ 82 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n",
79 mutex_lock(&eeh_event_mutex); 83 pci_name(event->dev));
80 eeh_mark_slot(event->dn, EEH_MODE_RECOVERING);
81 84
82 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", 85 pdn = handle_eeh_events(event);
83 pci_name(event->dev));
84 86
85 handle_eeh_events(event); 87 eeh_clear_slot(event->dn, EEH_MODE_RECOVERING);
88 pci_dev_put(event->dev);
89 kfree(event);
90 mutex_unlock(&eeh_event_mutex);
86 91
87 eeh_clear_slot(event->dn, EEH_MODE_RECOVERING); 92 /* If there are no new errors after an hour, clear the counter. */
88 pci_dev_put(event->dev); 93 if (pdn && pdn->eeh_freeze_count>0) {
89 kfree(event); 94 msleep_interruptible (3600*1000);
90 mutex_unlock(&eeh_event_mutex); 95 if (pdn->eeh_freeze_count>0)
96 pdn->eeh_freeze_count--;
91 } 97 }
92 98
93 return 0; 99 return 0;
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 2643078433f0..d03a8b078f9d 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -1,23 +1,24 @@
1/* 1/*
2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
3 * 3 *
4 * Rewrite, cleanup: 4 * Rewrite, cleanup:
5 * 5 *
6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
7 * Copyright (C) 2006 Olof Johansson <olof@lixom.net>
7 * 8 *
8 * Dynamic DMA mapping support, pSeries-specific parts, both SMP and LPAR. 9 * Dynamic DMA mapping support, pSeries-specific parts, both SMP and LPAR.
9 * 10 *
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify 12 * 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 * 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 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version. 15 * (at your option) any later version.
15 * 16 *
16 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details. 20 * GNU General Public License for more details.
20 * 21 *
21 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software 23 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -49,52 +50,46 @@
49 50
50#define DBG(fmt...) 51#define DBG(fmt...)
51 52
52static void tce_build_pSeries(struct iommu_table *tbl, long index, 53static void tce_build_pSeries(struct iommu_table *tbl, long index,
53 long npages, unsigned long uaddr, 54 long npages, unsigned long uaddr,
54 enum dma_data_direction direction) 55 enum dma_data_direction direction)
55{ 56{
56 union tce_entry t; 57 u64 proto_tce;
57 union tce_entry *tp; 58 u64 *tcep;
59 u64 rpn;
58 60
59 index <<= TCE_PAGE_FACTOR; 61 index <<= TCE_PAGE_FACTOR;
60 npages <<= TCE_PAGE_FACTOR; 62 npages <<= TCE_PAGE_FACTOR;
61 63
62 t.te_word = 0; 64 proto_tce = TCE_PCI_READ; // Read allowed
63 t.te_rdwr = 1; // Read allowed
64 65
65 if (direction != DMA_TO_DEVICE) 66 if (direction != DMA_TO_DEVICE)
66 t.te_pciwr = 1; 67 proto_tce |= TCE_PCI_WRITE;
67 68
68 tp = ((union tce_entry *)tbl->it_base) + index; 69 tcep = ((u64 *)tbl->it_base) + index;
69 70
70 while (npages--) { 71 while (npages--) {
71 /* can't move this out since we might cross LMB boundary */ 72 /* can't move this out since we might cross LMB boundary */
72 t.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 73 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
73 74 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
74 tp->te_word = t.te_word;
75 75
76 uaddr += TCE_PAGE_SIZE; 76 uaddr += TCE_PAGE_SIZE;
77 tp++; 77 tcep++;
78 } 78 }
79} 79}
80 80
81 81
82static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages) 82static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
83{ 83{
84 union tce_entry t; 84 u64 *tcep;
85 union tce_entry *tp;
86 85
87 npages <<= TCE_PAGE_FACTOR; 86 npages <<= TCE_PAGE_FACTOR;
88 index <<= TCE_PAGE_FACTOR; 87 index <<= TCE_PAGE_FACTOR;
89 88
90 t.te_word = 0; 89 tcep = ((u64 *)tbl->it_base) + index;
91 tp = ((union tce_entry *)tbl->it_base) + index; 90
92 91 while (npages--)
93 while (npages--) { 92 *(tcep++) = 0;
94 tp->te_word = t.te_word;
95
96 tp++;
97 }
98} 93}
99 94
100 95
@@ -103,43 +98,44 @@ static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
103 enum dma_data_direction direction) 98 enum dma_data_direction direction)
104{ 99{
105 u64 rc; 100 u64 rc;
106 union tce_entry tce; 101 u64 proto_tce, tce;
102 u64 rpn;
107 103
108 tcenum <<= TCE_PAGE_FACTOR; 104 tcenum <<= TCE_PAGE_FACTOR;
109 npages <<= TCE_PAGE_FACTOR; 105 npages <<= TCE_PAGE_FACTOR;
110 106
111 tce.te_word = 0; 107 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
112 tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 108 proto_tce = TCE_PCI_READ;
113 tce.te_rdwr = 1;
114 if (direction != DMA_TO_DEVICE) 109 if (direction != DMA_TO_DEVICE)
115 tce.te_pciwr = 1; 110 proto_tce |= TCE_PCI_WRITE;
116 111
117 while (npages--) { 112 while (npages--) {
118 rc = plpar_tce_put((u64)tbl->it_index, 113 tce = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
119 (u64)tcenum << 12, 114 rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, tce);
120 tce.te_word ); 115
121
122 if (rc && printk_ratelimit()) { 116 if (rc && printk_ratelimit()) {
123 printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 117 printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
124 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 118 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
125 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 119 printk("\ttcenum = 0x%lx\n", (u64)tcenum);
126 printk("\ttce val = 0x%lx\n", tce.te_word ); 120 printk("\ttce val = 0x%lx\n", tce );
127 show_stack(current, (unsigned long *)__get_SP()); 121 show_stack(current, (unsigned long *)__get_SP());
128 } 122 }
129 123
130 tcenum++; 124 tcenum++;
131 tce.te_rpn++; 125 rpn++;
132 } 126 }
133} 127}
134 128
135static DEFINE_PER_CPU(void *, tce_page) = NULL; 129static DEFINE_PER_CPU(u64 *, tce_page) = NULL;
136 130
137static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, 131static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
138 long npages, unsigned long uaddr, 132 long npages, unsigned long uaddr,
139 enum dma_data_direction direction) 133 enum dma_data_direction direction)
140{ 134{
141 u64 rc; 135 u64 rc;
142 union tce_entry tce, *tcep; 136 u64 proto_tce;
137 u64 *tcep;
138 u64 rpn;
143 long l, limit; 139 long l, limit;
144 140
145 if (TCE_PAGE_FACTOR == 0 && npages == 1) 141 if (TCE_PAGE_FACTOR == 0 && npages == 1)
@@ -152,7 +148,7 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
152 * from iommu_alloc{,_sg}() 148 * from iommu_alloc{,_sg}()
153 */ 149 */
154 if (!tcep) { 150 if (!tcep) {
155 tcep = (void *)__get_free_page(GFP_ATOMIC); 151 tcep = (u64 *)__get_free_page(GFP_ATOMIC);
156 /* If allocation fails, fall back to the loop implementation */ 152 /* If allocation fails, fall back to the loop implementation */
157 if (!tcep) 153 if (!tcep)
158 return tce_build_pSeriesLP(tbl, tcenum, npages, 154 return tce_build_pSeriesLP(tbl, tcenum, npages,
@@ -163,11 +159,10 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
163 tcenum <<= TCE_PAGE_FACTOR; 159 tcenum <<= TCE_PAGE_FACTOR;
164 npages <<= TCE_PAGE_FACTOR; 160 npages <<= TCE_PAGE_FACTOR;
165 161
166 tce.te_word = 0; 162 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
167 tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 163 proto_tce = TCE_PCI_READ;
168 tce.te_rdwr = 1;
169 if (direction != DMA_TO_DEVICE) 164 if (direction != DMA_TO_DEVICE)
170 tce.te_pciwr = 1; 165 proto_tce |= TCE_PCI_WRITE;
171 166
172 /* We can map max one pageful of TCEs at a time */ 167 /* We can map max one pageful of TCEs at a time */
173 do { 168 do {
@@ -175,11 +170,11 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
175 * Set up the page with TCE data, looping through and setting 170 * Set up the page with TCE data, looping through and setting
176 * the values. 171 * the values.
177 */ 172 */
178 limit = min_t(long, npages, 4096/sizeof(union tce_entry)); 173 limit = min_t(long, npages, 4096/TCE_ENTRY_SIZE);
179 174
180 for (l = 0; l < limit; l++) { 175 for (l = 0; l < limit; l++) {
181 tcep[l] = tce; 176 tcep[l] = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
182 tce.te_rpn++; 177 rpn++;
183 } 178 }
184 179
185 rc = plpar_tce_put_indirect((u64)tbl->it_index, 180 rc = plpar_tce_put_indirect((u64)tbl->it_index,
@@ -195,7 +190,7 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
195 printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 190 printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
196 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 191 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
197 printk("\tnpages = 0x%lx\n", (u64)npages); 192 printk("\tnpages = 0x%lx\n", (u64)npages);
198 printk("\ttce[0] val = 0x%lx\n", tcep[0].te_word); 193 printk("\ttce[0] val = 0x%lx\n", tcep[0]);
199 show_stack(current, (unsigned long *)__get_SP()); 194 show_stack(current, (unsigned long *)__get_SP());
200 } 195 }
201} 196}
@@ -203,23 +198,17 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
203static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages) 198static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
204{ 199{
205 u64 rc; 200 u64 rc;
206 union tce_entry tce;
207 201
208 tcenum <<= TCE_PAGE_FACTOR; 202 tcenum <<= TCE_PAGE_FACTOR;
209 npages <<= TCE_PAGE_FACTOR; 203 npages <<= TCE_PAGE_FACTOR;
210 204
211 tce.te_word = 0;
212
213 while (npages--) { 205 while (npages--) {
214 rc = plpar_tce_put((u64)tbl->it_index, 206 rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, 0);
215 (u64)tcenum << 12,
216 tce.te_word);
217 207
218 if (rc && printk_ratelimit()) { 208 if (rc && printk_ratelimit()) {
219 printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 209 printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
220 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 210 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
221 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 211 printk("\ttcenum = 0x%lx\n", (u64)tcenum);
222 printk("\ttce val = 0x%lx\n", tce.te_word );
223 show_stack(current, (unsigned long *)__get_SP()); 212 show_stack(current, (unsigned long *)__get_SP());
224 } 213 }
225 214
@@ -231,31 +220,24 @@ static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages
231static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages) 220static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
232{ 221{
233 u64 rc; 222 u64 rc;
234 union tce_entry tce;
235 223
236 tcenum <<= TCE_PAGE_FACTOR; 224 tcenum <<= TCE_PAGE_FACTOR;
237 npages <<= TCE_PAGE_FACTOR; 225 npages <<= TCE_PAGE_FACTOR;
238 226
239 tce.te_word = 0; 227 rc = plpar_tce_stuff((u64)tbl->it_index, (u64)tcenum << 12, 0, npages);
240
241 rc = plpar_tce_stuff((u64)tbl->it_index,
242 (u64)tcenum << 12,
243 tce.te_word,
244 npages);
245 228
246 if (rc && printk_ratelimit()) { 229 if (rc && printk_ratelimit()) {
247 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n"); 230 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n");
248 printk("\trc = %ld\n", rc); 231 printk("\trc = %ld\n", rc);
249 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 232 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
250 printk("\tnpages = 0x%lx\n", (u64)npages); 233 printk("\tnpages = 0x%lx\n", (u64)npages);
251 printk("\ttce val = 0x%lx\n", tce.te_word );
252 show_stack(current, (unsigned long *)__get_SP()); 234 show_stack(current, (unsigned long *)__get_SP());
253 } 235 }
254} 236}
255 237
256static void iommu_table_setparms(struct pci_controller *phb, 238static void iommu_table_setparms(struct pci_controller *phb,
257 struct device_node *dn, 239 struct device_node *dn,
258 struct iommu_table *tbl) 240 struct iommu_table *tbl)
259{ 241{
260 struct device_node *node; 242 struct device_node *node;
261 unsigned long *basep; 243 unsigned long *basep;
@@ -275,16 +257,16 @@ static void iommu_table_setparms(struct pci_controller *phb,
275 memset((void *)tbl->it_base, 0, *sizep); 257 memset((void *)tbl->it_base, 0, *sizep);
276 258
277 tbl->it_busno = phb->bus->number; 259 tbl->it_busno = phb->bus->number;
278 260
279 /* Units of tce entries */ 261 /* Units of tce entries */
280 tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT; 262 tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT;
281 263
282 /* Test if we are going over 2GB of DMA space */ 264 /* Test if we are going over 2GB of DMA space */
283 if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) { 265 if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) {
284 udbg_printf("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); 266 udbg_printf("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
285 panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); 267 panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
286 } 268 }
287 269
288 phb->dma_window_base_cur += phb->dma_window_size; 270 phb->dma_window_base_cur += phb->dma_window_size;
289 271
290 /* Set the tce table size - measured in entries */ 272 /* Set the tce table size - measured in entries */
@@ -299,30 +281,22 @@ static void iommu_table_setparms(struct pci_controller *phb,
299 * iommu_table_setparms_lpar 281 * iommu_table_setparms_lpar
300 * 282 *
301 * Function: On pSeries LPAR systems, return TCE table info, given a pci bus. 283 * Function: On pSeries LPAR systems, return TCE table info, given a pci bus.
302 *
303 * ToDo: properly interpret the ibm,dma-window property. The definition is:
304 * logical-bus-number (1 word)
305 * phys-address (#address-cells words)
306 * size (#cell-size words)
307 *
308 * Currently we hard code these sizes (more or less).
309 */ 284 */
310static void iommu_table_setparms_lpar(struct pci_controller *phb, 285static void iommu_table_setparms_lpar(struct pci_controller *phb,
311 struct device_node *dn, 286 struct device_node *dn,
312 struct iommu_table *tbl, 287 struct iommu_table *tbl,
313 unsigned int *dma_window) 288 unsigned char *dma_window)
314{ 289{
290 unsigned long offset, size;
291
315 tbl->it_busno = PCI_DN(dn)->bussubno; 292 tbl->it_busno = PCI_DN(dn)->bussubno;
293 of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size);
316 294
317 /* TODO: Parse field size properties properly. */
318 tbl->it_size = (((unsigned long)dma_window[4] << 32) |
319 (unsigned long)dma_window[5]) >> PAGE_SHIFT;
320 tbl->it_offset = (((unsigned long)dma_window[2] << 32) |
321 (unsigned long)dma_window[3]) >> PAGE_SHIFT;
322 tbl->it_base = 0; 295 tbl->it_base = 0;
323 tbl->it_index = dma_window[0];
324 tbl->it_blocksize = 16; 296 tbl->it_blocksize = 16;
325 tbl->it_type = TCE_PCI; 297 tbl->it_type = TCE_PCI;
298 tbl->it_offset = offset >> PAGE_SHIFT;
299 tbl->it_size = size >> PAGE_SHIFT;
326} 300}
327 301
328static void iommu_bus_setup_pSeries(struct pci_bus *bus) 302static void iommu_bus_setup_pSeries(struct pci_bus *bus)
@@ -357,13 +331,9 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
357 if (isa_dn_orig) 331 if (isa_dn_orig)
358 of_node_put(isa_dn_orig); 332 of_node_put(isa_dn_orig);
359 333
360 /* Count number of direct PCI children of the PHB. 334 /* Count number of direct PCI children of the PHB. */
361 * All PCI device nodes have class-code property, so it's
362 * an easy way to find them.
363 */
364 for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling) 335 for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
365 if (get_property(tmp, "class-code", NULL)) 336 children++;
366 children++;
367 337
368 DBG("Children: %d\n", children); 338 DBG("Children: %d\n", children);
369 339
@@ -394,10 +364,11 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
394 pci->phb->dma_window_size = 0x8000000ul; 364 pci->phb->dma_window_size = 0x8000000ul;
395 pci->phb->dma_window_base_cur = 0x8000000ul; 365 pci->phb->dma_window_base_cur = 0x8000000ul;
396 366
397 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 367 tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
368 pci->phb->node);
398 369
399 iommu_table_setparms(pci->phb, dn, tbl); 370 iommu_table_setparms(pci->phb, dn, tbl);
400 pci->iommu_table = iommu_init_table(tbl); 371 pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
401 372
402 /* Divide the rest (1.75GB) among the children */ 373 /* Divide the rest (1.75GB) among the children */
403 pci->phb->dma_window_size = 0x80000000ul; 374 pci->phb->dma_window_size = 0x80000000ul;
@@ -414,7 +385,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
414 struct iommu_table *tbl; 385 struct iommu_table *tbl;
415 struct device_node *dn, *pdn; 386 struct device_node *dn, *pdn;
416 struct pci_dn *ppci; 387 struct pci_dn *ppci;
417 unsigned int *dma_window = NULL; 388 unsigned char *dma_window = NULL;
418 389
419 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); 390 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self);
420 391
@@ -422,7 +393,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
422 393
423 /* Find nearest ibm,dma-window, walking up the device tree */ 394 /* Find nearest ibm,dma-window, walking up the device tree */
424 for (pdn = dn; pdn != NULL; pdn = pdn->parent) { 395 for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
425 dma_window = (unsigned int *)get_property(pdn, "ibm,dma-window", NULL); 396 dma_window = get_property(pdn, "ibm,dma-window", NULL);
426 if (dma_window != NULL) 397 if (dma_window != NULL)
427 break; 398 break;
428 } 399 }
@@ -440,12 +411,12 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
440 411
441 ppci->bussubno = bus->number; 412 ppci->bussubno = bus->number;
442 413
443 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table), 414 tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
444 GFP_KERNEL); 415 ppci->phb->node);
445 416
446 iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window); 417 iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window);
447 418
448 ppci->iommu_table = iommu_init_table(tbl); 419 ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node);
449 } 420 }
450 421
451 if (pdn != dn) 422 if (pdn != dn)
@@ -468,9 +439,11 @@ static void iommu_dev_setup_pSeries(struct pci_dev *dev)
468 */ 439 */
469 if (!dev->bus->self) { 440 if (!dev->bus->self) {
470 DBG(" --> first child, no bridge. Allocating iommu table.\n"); 441 DBG(" --> first child, no bridge. Allocating iommu table.\n");
471 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 442 tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
443 PCI_DN(dn)->phb->node);
472 iommu_table_setparms(PCI_DN(dn)->phb, dn, tbl); 444 iommu_table_setparms(PCI_DN(dn)->phb, dn, tbl);
473 PCI_DN(mydn)->iommu_table = iommu_init_table(tbl); 445 PCI_DN(dn)->iommu_table = iommu_init_table(tbl,
446 PCI_DN(dn)->phb->node);
474 447
475 return; 448 return;
476 } 449 }
@@ -516,7 +489,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
516{ 489{
517 struct device_node *pdn, *dn; 490 struct device_node *pdn, *dn;
518 struct iommu_table *tbl; 491 struct iommu_table *tbl;
519 int *dma_window = NULL; 492 unsigned char *dma_window = NULL;
520 struct pci_dn *pci; 493 struct pci_dn *pci;
521 494
522 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev)); 495 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));
@@ -531,8 +504,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
531 504
532 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table; 505 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
533 pdn = pdn->parent) { 506 pdn = pdn->parent) {
534 dma_window = (unsigned int *) 507 dma_window = get_property(pdn, "ibm,dma-window", NULL);
535 get_property(pdn, "ibm,dma-window", NULL);
536 if (dma_window) 508 if (dma_window)
537 break; 509 break;
538 } 510 }
@@ -553,12 +525,12 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
553 /* iommu_table_setparms_lpar needs bussubno. */ 525 /* iommu_table_setparms_lpar needs bussubno. */
554 pci->bussubno = pci->phb->bus->number; 526 pci->bussubno = pci->phb->bus->number;
555 527
556 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table), 528 tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
557 GFP_KERNEL); 529 pci->phb->node);
558 530
559 iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window); 531 iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window);
560 532
561 pci->iommu_table = iommu_init_table(tbl); 533 pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
562 } 534 }
563 535
564 if (pdn != dn) 536 if (pdn != dn)
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index e0000ce769e5..2e4e04042d85 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -348,7 +348,7 @@ static int enable_surveillance(int timeout)
348 return 0; 348 return 0;
349 349
350 if (error == -EINVAL) { 350 if (error == -EINVAL) {
351 printk(KERN_INFO "rtasd: surveillance not supported\n"); 351 printk(KERN_DEBUG "rtasd: surveillance not supported\n");
352 return 0; 352 return 0;
353 } 353 }
354 354
@@ -440,7 +440,7 @@ static int rtasd(void *unused)
440 goto error; 440 goto error;
441 } 441 }
442 442
443 printk(KERN_INFO "RTAS daemon started\n"); 443 printk(KERN_DEBUG "RTAS daemon started\n");
444 444
445 DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate)); 445 DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate));
446 446
@@ -487,7 +487,7 @@ static int __init rtas_init(void)
487 487
488 /* No RTAS */ 488 /* No RTAS */
489 if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) { 489 if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) {
490 printk(KERN_INFO "rtasd: no event-scan on system\n"); 490 printk(KERN_DEBUG "rtasd: no event-scan on system\n");
491 return -ENODEV; 491 return -ENODEV;
492 } 492 }
493 493
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index 50643496eb63..77a5bb1d9c30 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -107,9 +107,9 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
107 /* Break to sleep default time */ 107 /* Break to sleep default time */
108 break; 108 break;
109 default: 109 default:
110 if (status > 9900 && status <= 9905) { 110 /* Assume extended busy */
111 wait_time = rtas_extended_busy_delay_time(status); 111 wait_time = rtas_busy_delay_time(status);
112 } else { 112 if (!wait_time) {
113 printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status); 113 printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status);
114 return -EIO; 114 return -EIO;
115 } 115 }
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 3ba87835757e..1e28518c6121 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -235,14 +235,14 @@ static void __init pSeries_setup_arch(void)
235 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 235 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
236 vpa_init(boot_cpuid); 236 vpa_init(boot_cpuid);
237 if (get_lppaca()->shared_proc) { 237 if (get_lppaca()->shared_proc) {
238 printk(KERN_INFO "Using shared processor idle loop\n"); 238 printk(KERN_DEBUG "Using shared processor idle loop\n");
239 ppc_md.power_save = pseries_shared_idle_sleep; 239 ppc_md.power_save = pseries_shared_idle_sleep;
240 } else { 240 } else {
241 printk(KERN_INFO "Using dedicated idle loop\n"); 241 printk(KERN_DEBUG "Using dedicated idle loop\n");
242 ppc_md.power_save = pseries_dedicated_idle_sleep; 242 ppc_md.power_save = pseries_dedicated_idle_sleep;
243 } 243 }
244 } else { 244 } else {
245 printk(KERN_INFO "Using default idle loop\n"); 245 printk(KERN_DEBUG "Using default idle loop\n");
246 } 246 }
247 247
248 if (firmware_has_feature(FW_FEATURE_LPAR)) 248 if (firmware_has_feature(FW_FEATURE_LPAR))
diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
deleted file mode 100644
index 8e53e04ada8b..000000000000
--- a/arch/powerpc/platforms/pseries/vio.c
+++ /dev/null
@@ -1,274 +0,0 @@
1/*
2 * IBM PowerPC pSeries Virtual I/O Infrastructure Support.
3 *
4 * Copyright (c) 2003-2005 IBM Corp.
5 * Dave Engebretsen engebret@us.ibm.com
6 * Santiago Leon santil@us.ibm.com
7 * Hollis Blanchard <hollisb@us.ibm.com>
8 * Stephen Rothwell
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/mm.h>
19#include <linux/kobject.h>
20#include <asm/iommu.h>
21#include <asm/dma.h>
22#include <asm/prom.h>
23#include <asm/vio.h>
24#include <asm/hvcall.h>
25#include <asm/tce.h>
26
27extern struct subsystem devices_subsys; /* needed for vio_find_name() */
28
29static void probe_bus_pseries(void)
30{
31 struct device_node *node_vroot, *of_node;
32
33 node_vroot = find_devices("vdevice");
34 if ((node_vroot == NULL) || (node_vroot->child == NULL))
35 /* this machine doesn't do virtual IO, and that's ok */
36 return;
37
38 /*
39 * Create struct vio_devices for each virtual device in the device tree.
40 * Drivers will associate with them later.
41 */
42 for (of_node = node_vroot->child; of_node != NULL;
43 of_node = of_node->sibling) {
44 printk(KERN_DEBUG "%s: processing %p\n", __FUNCTION__, of_node);
45 vio_register_device_node(of_node);
46 }
47}
48
49/**
50 * vio_match_device_pseries: - Tell if a pSeries VIO device matches a
51 * vio_device_id
52 */
53static int vio_match_device_pseries(const struct vio_device_id *id,
54 const struct vio_dev *dev)
55{
56 return (strncmp(dev->type, id->type, strlen(id->type)) == 0) &&
57 device_is_compatible(dev->dev.platform_data, id->compat);
58}
59
60static void vio_release_device_pseries(struct device *dev)
61{
62 /* XXX free TCE table */
63 of_node_put(dev->platform_data);
64}
65
66static ssize_t viodev_show_devspec(struct device *dev,
67 struct device_attribute *attr, char *buf)
68{
69 struct device_node *of_node = dev->platform_data;
70
71 return sprintf(buf, "%s\n", of_node->full_name);
72}
73DEVICE_ATTR(devspec, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_devspec, NULL);
74
75static void vio_unregister_device_pseries(struct vio_dev *viodev)
76{
77 device_remove_file(&viodev->dev, &dev_attr_devspec);
78}
79
80static struct vio_bus_ops vio_bus_ops_pseries = {
81 .match = vio_match_device_pseries,
82 .unregister_device = vio_unregister_device_pseries,
83 .release_device = vio_release_device_pseries,
84};
85
86/**
87 * vio_bus_init_pseries: - Initialize the pSeries virtual IO bus
88 */
89static int __init vio_bus_init_pseries(void)
90{
91 int err;
92
93 err = vio_bus_init(&vio_bus_ops_pseries);
94 if (err == 0)
95 probe_bus_pseries();
96 return err;
97}
98
99__initcall(vio_bus_init_pseries);
100
101/**
102 * vio_build_iommu_table: - gets the dma information from OF and
103 * builds the TCE tree.
104 * @dev: the virtual device.
105 *
106 * Returns a pointer to the built tce tree, or NULL if it can't
107 * find property.
108*/
109static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
110{
111 unsigned int *dma_window;
112 struct iommu_table *newTceTable;
113 unsigned long offset;
114 int dma_window_property_size;
115
116 dma_window = (unsigned int *) get_property(dev->dev.platform_data, "ibm,my-dma-window", &dma_window_property_size);
117 if(!dma_window) {
118 return NULL;
119 }
120
121 newTceTable = (struct iommu_table *) kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
122
123 /* There should be some code to extract the phys-encoded offset
124 using prom_n_addr_cells(). However, according to a comment
125 on earlier versions, it's always zero, so we don't bother */
126 offset = dma_window[1] >> PAGE_SHIFT;
127
128 /* TCE table size - measured in tce entries */
129 newTceTable->it_size = dma_window[4] >> PAGE_SHIFT;
130 /* offset for VIO should always be 0 */
131 newTceTable->it_offset = offset;
132 newTceTable->it_busno = 0;
133 newTceTable->it_index = (unsigned long)dma_window[0];
134 newTceTable->it_type = TCE_VB;
135
136 return iommu_init_table(newTceTable);
137}
138
139/**
140 * vio_register_device_node: - Register a new vio device.
141 * @of_node: The OF node for this device.
142 *
143 * Creates and initializes a vio_dev structure from the data in
144 * of_node (dev.platform_data) and adds it to the list of virtual devices.
145 * Returns a pointer to the created vio_dev or NULL if node has
146 * NULL device_type or compatible fields.
147 */
148struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
149{
150 struct vio_dev *viodev;
151 unsigned int *unit_address;
152 unsigned int *irq_p;
153
154 /* we need the 'device_type' property, in order to match with drivers */
155 if ((NULL == of_node->type)) {
156 printk(KERN_WARNING
157 "%s: node %s missing 'device_type'\n", __FUNCTION__,
158 of_node->name ? of_node->name : "<unknown>");
159 return NULL;
160 }
161
162 unit_address = (unsigned int *)get_property(of_node, "reg", NULL);
163 if (!unit_address) {
164 printk(KERN_WARNING "%s: node %s missing 'reg'\n", __FUNCTION__,
165 of_node->name ? of_node->name : "<unknown>");
166 return NULL;
167 }
168
169 /* allocate a vio_dev for this node */
170 viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL);
171 if (!viodev) {
172 return NULL;
173 }
174 memset(viodev, 0, sizeof(struct vio_dev));
175
176 viodev->dev.platform_data = of_node_get(of_node);
177
178 viodev->irq = NO_IRQ;
179 irq_p = (unsigned int *)get_property(of_node, "interrupts", NULL);
180 if (irq_p) {
181 int virq = virt_irq_create_mapping(*irq_p);
182 if (virq == NO_IRQ) {
183 printk(KERN_ERR "Unable to allocate interrupt "
184 "number for %s\n", of_node->full_name);
185 } else
186 viodev->irq = irq_offset_up(virq);
187 }
188
189 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address);
190 viodev->name = of_node->name;
191 viodev->type = of_node->type;
192 viodev->unit_address = *unit_address;
193 viodev->iommu_table = vio_build_iommu_table(viodev);
194
195 /* register with generic device framework */
196 if (vio_register_device(viodev) == NULL) {
197 /* XXX free TCE table */
198 kfree(viodev);
199 return NULL;
200 }
201 device_create_file(&viodev->dev, &dev_attr_devspec);
202
203 return viodev;
204}
205EXPORT_SYMBOL(vio_register_device_node);
206
207/**
208 * vio_get_attribute: - get attribute for virtual device
209 * @vdev: The vio device to get property.
210 * @which: The property/attribute to be extracted.
211 * @length: Pointer to length of returned data size (unused if NULL).
212 *
213 * Calls prom.c's get_property() to return the value of the
214 * attribute specified by the preprocessor constant @which
215*/
216const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length)
217{
218 return get_property(vdev->dev.platform_data, (char*)which, length);
219}
220EXPORT_SYMBOL(vio_get_attribute);
221
222/* vio_find_name() - internal because only vio.c knows how we formatted the
223 * kobject name
224 * XXX once vio_bus_type.devices is actually used as a kset in
225 * drivers/base/bus.c, this function should be removed in favor of
226 * "device_find(kobj_name, &vio_bus_type)"
227 */
228static struct vio_dev *vio_find_name(const char *kobj_name)
229{
230 struct kobject *found;
231
232 found = kset_find_obj(&devices_subsys.kset, kobj_name);
233 if (!found)
234 return NULL;
235
236 return to_vio_dev(container_of(found, struct device, kobj));
237}
238
239/**
240 * vio_find_node - find an already-registered vio_dev
241 * @vnode: device_node of the virtual device we're looking for
242 */
243struct vio_dev *vio_find_node(struct device_node *vnode)
244{
245 uint32_t *unit_address;
246 char kobj_name[BUS_ID_SIZE];
247
248 /* construct the kobject name from the device node */
249 unit_address = (uint32_t *)get_property(vnode, "reg", NULL);
250 if (!unit_address)
251 return NULL;
252 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
253
254 return vio_find_name(kobj_name);
255}
256EXPORT_SYMBOL(vio_find_node);
257
258int vio_enable_interrupts(struct vio_dev *dev)
259{
260 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_ENABLE);
261 if (rc != H_SUCCESS)
262 printk(KERN_ERR "vio: Error 0x%x enabling interrupts\n", rc);
263 return rc;
264}
265EXPORT_SYMBOL(vio_enable_interrupts);
266
267int vio_disable_interrupts(struct vio_dev *dev)
268{
269 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_DISABLE);
270 if (rc != H_SUCCESS)
271 printk(KERN_ERR "vio: Error 0x%x disabling interrupts\n", rc);
272 return rc;
273}
274EXPORT_SYMBOL(vio_disable_interrupts);
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 2d60ea30fed6..b14f9b5c114e 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -522,7 +522,7 @@ nextnode:
522 522
523 np = of_find_node_by_type(NULL, "interrupt-controller"); 523 np = of_find_node_by_type(NULL, "interrupt-controller");
524 if (!np) { 524 if (!np) {
525 printk(KERN_WARNING "xics: no ISA interrupt controller\n"); 525 printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
526 xics_irq_8259_cascade_real = -1; 526 xics_irq_8259_cascade_real = -1;
527 xics_irq_8259_cascade = -1; 527 xics_irq_8259_cascade = -1;
528 } else { 528 } else {
@@ -641,23 +641,26 @@ void xics_teardown_cpu(int secondary)
641 ops->cppr_info(cpu, 0x00); 641 ops->cppr_info(cpu, 0x00);
642 iosync(); 642 iosync();
643 643
644 /* Clear IPI */
645 ops->qirr_info(cpu, 0xff);
646
647 /*
648 * we need to EOI the IPI if we got here from kexec down IPI
649 *
650 * probably need to check all the other interrupts too
651 * should we be flagging idle loop instead?
652 * or creating some task to be scheduled?
653 */
654 ops->xirr_info_set(cpu, XICS_IPI);
655
644 /* 656 /*
645 * Some machines need to have at least one cpu in the GIQ, 657 * Some machines need to have at least one cpu in the GIQ,
646 * so leave the master cpu in the group. 658 * so leave the master cpu in the group.
647 */ 659 */
648 if (secondary) { 660 if (secondary)
649 /*
650 * we need to EOI the IPI if we got here from kexec down IPI
651 *
652 * probably need to check all the other interrupts too
653 * should we be flagging idle loop instead?
654 * or creating some task to be scheduled?
655 */
656 ops->xirr_info_set(cpu, XICS_IPI);
657 rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, 661 rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
658 (1UL << interrupt_server_size) - 1 - 662 (1UL << interrupt_server_size) - 1 -
659 default_distrib_server, 0); 663 default_distrib_server, 0);
660 }
661} 664}
662 665
663#ifdef CONFIG_HOTPLUG_CPU 666#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 4c2b356774ea..cef95b023730 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -1,3 +1,7 @@
1ifeq ($(CONFIG_PPC64),y)
2EXTRA_CFLAGS += -mno-minimal-toc
3endif
4
1obj-$(CONFIG_MPIC) += mpic.o 5obj-$(CONFIG_MPIC) += mpic.o
2obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o 6obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
3obj-$(CONFIG_PPC_I8259) += i8259.o 7obj-$(CONFIG_PPC_I8259) += i8259.o
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 38087bd6e3cf..6232091cc72b 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -246,7 +246,7 @@ static void iommu_table_dart_setup(void)
246 iommu_table_dart.it_base = (unsigned long)dart_vbase; 246 iommu_table_dart.it_base = (unsigned long)dart_vbase;
247 iommu_table_dart.it_index = 0; 247 iommu_table_dart.it_index = 0;
248 iommu_table_dart.it_blocksize = 1; 248 iommu_table_dart.it_blocksize = 1;
249 iommu_init_table(&iommu_table_dart); 249 iommu_init_table(&iommu_table_dart, -1);
250 250
251 /* Reserve the last page of the DART to avoid possible prefetch 251 /* Reserve the last page of the DART to avoid possible prefetch
252 * past the DART mapped area 252 * past the DART mapped area
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index ceb584682fa3..71a3275935ec 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -372,7 +372,7 @@ static int __init fsl_usb_of_init(void)
372{ 372{
373 struct device_node *np; 373 struct device_node *np;
374 unsigned int i; 374 unsigned int i;
375 struct platform_device *usb_dev; 375 struct platform_device *usb_dev_mph = NULL, *usb_dev_dr = NULL;
376 int ret; 376 int ret;
377 377
378 for (np = NULL, i = 0; 378 for (np = NULL, i = 0;
@@ -393,15 +393,15 @@ static int __init fsl_usb_of_init(void)
393 r[1].end = np->intrs[0].line; 393 r[1].end = np->intrs[0].line;
394 r[1].flags = IORESOURCE_IRQ; 394 r[1].flags = IORESOURCE_IRQ;
395 395
396 usb_dev = 396 usb_dev_mph =
397 platform_device_register_simple("fsl-usb2-mph", i, r, 2); 397 platform_device_register_simple("fsl-ehci", i, r, 2);
398 if (IS_ERR(usb_dev)) { 398 if (IS_ERR(usb_dev_mph)) {
399 ret = PTR_ERR(usb_dev); 399 ret = PTR_ERR(usb_dev_mph);
400 goto err; 400 goto err;
401 } 401 }
402 402
403 usb_dev->dev.coherent_dma_mask = 0xffffffffUL; 403 usb_dev_mph->dev.coherent_dma_mask = 0xffffffffUL;
404 usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask; 404 usb_dev_mph->dev.dma_mask = &usb_dev_mph->dev.coherent_dma_mask;
405 405
406 usb_data.operating_mode = FSL_USB2_MPH_HOST; 406 usb_data.operating_mode = FSL_USB2_MPH_HOST;
407 407
@@ -417,31 +417,14 @@ static int __init fsl_usb_of_init(void)
417 usb_data.phy_mode = determine_usb_phy(prop); 417 usb_data.phy_mode = determine_usb_phy(prop);
418 418
419 ret = 419 ret =
420 platform_device_add_data(usb_dev, &usb_data, 420 platform_device_add_data(usb_dev_mph, &usb_data,
421 sizeof(struct 421 sizeof(struct
422 fsl_usb2_platform_data)); 422 fsl_usb2_platform_data));
423 if (ret) 423 if (ret)
424 goto unreg; 424 goto unreg_mph;
425 } 425 }
426 426
427 return 0; 427 for (np = NULL;
428
429unreg:
430 platform_device_unregister(usb_dev);
431err:
432 return ret;
433}
434
435arch_initcall(fsl_usb_of_init);
436
437static int __init fsl_usb_dr_of_init(void)
438{
439 struct device_node *np;
440 unsigned int i;
441 struct platform_device *usb_dev;
442 int ret;
443
444 for (np = NULL, i = 0;
445 (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL; 428 (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL;
446 i++) { 429 i++) {
447 struct resource r[2]; 430 struct resource r[2];
@@ -453,21 +436,21 @@ static int __init fsl_usb_dr_of_init(void)
453 436
454 ret = of_address_to_resource(np, 0, &r[0]); 437 ret = of_address_to_resource(np, 0, &r[0]);
455 if (ret) 438 if (ret)
456 goto err; 439 goto unreg_mph;
457 440
458 r[1].start = np->intrs[0].line; 441 r[1].start = np->intrs[0].line;
459 r[1].end = np->intrs[0].line; 442 r[1].end = np->intrs[0].line;
460 r[1].flags = IORESOURCE_IRQ; 443 r[1].flags = IORESOURCE_IRQ;
461 444
462 usb_dev = 445 usb_dev_dr =
463 platform_device_register_simple("fsl-usb2-dr", i, r, 2); 446 platform_device_register_simple("fsl-ehci", i, r, 2);
464 if (IS_ERR(usb_dev)) { 447 if (IS_ERR(usb_dev_dr)) {
465 ret = PTR_ERR(usb_dev); 448 ret = PTR_ERR(usb_dev_dr);
466 goto err; 449 goto err;
467 } 450 }
468 451
469 usb_dev->dev.coherent_dma_mask = 0xffffffffUL; 452 usb_dev_dr->dev.coherent_dma_mask = 0xffffffffUL;
470 usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask; 453 usb_dev_dr->dev.dma_mask = &usb_dev_dr->dev.coherent_dma_mask;
471 454
472 usb_data.operating_mode = FSL_USB2_DR_HOST; 455 usb_data.operating_mode = FSL_USB2_DR_HOST;
473 456
@@ -475,19 +458,22 @@ static int __init fsl_usb_dr_of_init(void)
475 usb_data.phy_mode = determine_usb_phy(prop); 458 usb_data.phy_mode = determine_usb_phy(prop);
476 459
477 ret = 460 ret =
478 platform_device_add_data(usb_dev, &usb_data, 461 platform_device_add_data(usb_dev_dr, &usb_data,
479 sizeof(struct 462 sizeof(struct
480 fsl_usb2_platform_data)); 463 fsl_usb2_platform_data));
481 if (ret) 464 if (ret)
482 goto unreg; 465 goto unreg_dr;
483 } 466 }
484
485 return 0; 467 return 0;
486 468
487unreg: 469unreg_dr:
488 platform_device_unregister(usb_dev); 470 if (usb_dev_dr)
471 platform_device_unregister(usb_dev_dr);
472unreg_mph:
473 if (usb_dev_mph)
474 platform_device_unregister(usb_dev_mph);
489err: 475err:
490 return ret; 476 return ret;
491} 477}
492 478
493arch_initcall(fsl_usb_dr_of_init); 479arch_initcall(fsl_usb_of_init);
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 7dcdfcb3c984..bffe50d02c99 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -829,7 +829,27 @@ void __init mpic_init(struct mpic *mpic)
829 mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0); 829 mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0);
830} 830}
831 831
832void __init mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio)
833{
834 u32 v;
835
836 v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1);
837 v &= ~MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK;
838 v |= MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(clock_ratio);
839 mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v);
840}
832 841
842void __init mpic_set_serial_int(struct mpic *mpic, int enable)
843{
844 u32 v;
845
846 v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1);
847 if (enable)
848 v |= MPIC_GREG_GLOBAL_CONF_1_SIE;
849 else
850 v &= ~MPIC_GREG_GLOBAL_CONF_1_SIE;
851 mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v);
852}
833 853
834void mpic_irq_set_priority(unsigned int irq, unsigned int pri) 854void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
835{ 855{
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index e9a8f5d1dfcd..b55de4f42aec 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -40,6 +40,10 @@ config GENERIC_NVRAM
40 bool 40 bool
41 default y 41 default y
42 42
43config GENERIC_FIND_NEXT_BIT
44 bool
45 default y
46
43config SCHED_NO_NO_OMIT_FRAME_POINTER 47config SCHED_NO_NO_OMIT_FRAME_POINTER
44 bool 48 bool
45 default y 49 default y
diff --git a/arch/ppc/boot/lib/Makefile b/arch/ppc/boot/lib/Makefile
index 80c84d562fa4..2f995f712ec5 100644
--- a/arch/ppc/boot/lib/Makefile
+++ b/arch/ppc/boot/lib/Makefile
@@ -5,7 +5,7 @@
5CFLAGS_kbd.o := -Idrivers/char 5CFLAGS_kbd.o := -Idrivers/char
6CFLAGS_vreset.o := -Iarch/ppc/boot/include 6CFLAGS_vreset.o := -Iarch/ppc/boot/include
7 7
8zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c 8zlib := inffast.c inflate.c inftrees.c
9 9
10lib-y += $(zlib:.c=.o) div64.o 10lib-y += $(zlib:.c=.o) div64.o
11lib-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o 11lib-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
index 386e000bcb73..c9bd184a295a 100644
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -583,7 +583,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
583 mm = (address < TASK_SIZE)? vma->vm_mm: &init_mm; 583 mm = (address < TASK_SIZE)? vma->vm_mm: &init_mm;
584 pmd = pmd_offset(pgd_offset(mm, address), address); 584 pmd = pmd_offset(pgd_offset(mm, address), address);
585 if (!pmd_none(*pmd)) 585 if (!pmd_none(*pmd))
586 add_hash_page(mm->context, address, pmd_val(*pmd)); 586 add_hash_page(mm->context.id, address, pmd_val(*pmd));
587 } 587 }
588#endif 588#endif
589} 589}
diff --git a/arch/ppc/mm/mmu_context.c b/arch/ppc/mm/mmu_context.c
index b4a4b3f02a1c..8784f3715032 100644
--- a/arch/ppc/mm/mmu_context.c
+++ b/arch/ppc/mm/mmu_context.c
@@ -30,7 +30,7 @@
30#include <asm/mmu_context.h> 30#include <asm/mmu_context.h>
31#include <asm/tlbflush.h> 31#include <asm/tlbflush.h>
32 32
33mm_context_t next_mmu_context; 33unsigned long next_mmu_context;
34unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1]; 34unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
35#ifdef FEW_CONTEXTS 35#ifdef FEW_CONTEXTS
36atomic_t nr_free_contexts; 36atomic_t nr_free_contexts;
diff --git a/arch/ppc/mm/tlb.c b/arch/ppc/mm/tlb.c
index 6c3dc3c44c86..606b023196a2 100644
--- a/arch/ppc/mm/tlb.c
+++ b/arch/ppc/mm/tlb.c
@@ -42,7 +42,7 @@ void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long addr)
42 42
43 if (Hash != 0) { 43 if (Hash != 0) {
44 ptephys = __pa(ptep) & PAGE_MASK; 44 ptephys = __pa(ptep) & PAGE_MASK;
45 flush_hash_pages(mm->context, addr, ptephys, 1); 45 flush_hash_pages(mm->context.id, addr, ptephys, 1);
46 } 46 }
47} 47}
48 48
@@ -102,7 +102,7 @@ static void flush_range(struct mm_struct *mm, unsigned long start,
102 pmd_t *pmd; 102 pmd_t *pmd;
103 unsigned long pmd_end; 103 unsigned long pmd_end;
104 int count; 104 int count;
105 unsigned int ctx = mm->context; 105 unsigned int ctx = mm->context.id;
106 106
107 if (Hash == 0) { 107 if (Hash == 0) {
108 _tlbia(); 108 _tlbia();
@@ -166,7 +166,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
166 mm = (vmaddr < TASK_SIZE)? vma->vm_mm: &init_mm; 166 mm = (vmaddr < TASK_SIZE)? vma->vm_mm: &init_mm;
167 pmd = pmd_offset(pgd_offset(mm, vmaddr), vmaddr); 167 pmd = pmd_offset(pgd_offset(mm, vmaddr), vmaddr);
168 if (!pmd_none(*pmd)) 168 if (!pmd_none(*pmd))
169 flush_hash_pages(mm->context, vmaddr, pmd_val(*pmd), 1); 169 flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1);
170 FINISH_FLUSH; 170 FINISH_FLUSH;
171} 171}
172 172
diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
index 174ddbc9758b..293bd489e7d9 100644
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -183,7 +183,7 @@ config IBM_EMAC4
183 183
184config BIOS_FIXUP 184config BIOS_FIXUP
185 bool 185 bool
186 depends on BUBINGA || EP405 || SYCAMORE || WALNUT 186 depends on BUBINGA || EP405 || SYCAMORE || WALNUT || CPCI405
187 default y 187 default y
188 188
189# OAK doesn't exist but wanted to keep this around for any future 403GCX boards 189# OAK doesn't exist but wanted to keep this around for any future 403GCX boards
diff --git a/arch/ppc/platforms/4xx/cpci405.c b/arch/ppc/platforms/4xx/cpci405.c
index 6571e39fbe48..970b69831e6f 100644
--- a/arch/ppc/platforms/4xx/cpci405.c
+++ b/arch/ppc/platforms/4xx/cpci405.c
@@ -1,10 +1,12 @@
1/* 1/*
2 * Board setup routines for the esd CPCI-405 cPCI Board. 2 * Board setup routines for the esd CPCI-405 cPCI Board.
3 * 3 *
4 * Author: Stefan Roese 4 * Copyright 2001-2006 esd electronic system design - hannover germany
5 * stefan.roese@esd-electronics.com
6 * 5 *
7 * Copyright 2001 esd electronic system design - hannover germany 6 * Authors: Matthias Fuchs
7 * matthias.fuchs@esd-electronics.com
8 * Stefan Roese
9 * stefan.roese@esd-electronics.com
8 * 10 *
9 * This program is free software; you can redistribute it and/or modify it 11 * 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 12 * under the terms of the GNU General Public License as published by the
@@ -20,9 +22,17 @@
20#include <asm/pci-bridge.h> 22#include <asm/pci-bridge.h>
21#include <asm/machdep.h> 23#include <asm/machdep.h>
22#include <asm/todc.h> 24#include <asm/todc.h>
25#include <linux/serial.h>
26#include <linux/serial_core.h>
23#include <asm/ocp.h> 27#include <asm/ocp.h>
28#include <asm/ibm_ocp_pci.h>
29#include <platforms/4xx/ibm405gp.h>
24 30
31#ifdef CONFIG_GEN_RTC
25void *cpci405_nvram; 32void *cpci405_nvram;
33#endif
34
35extern bd_t __res;
26 36
27/* 37/*
28 * Some IRQs unique to CPCI-405. 38 * Some IRQs unique to CPCI-405.
@@ -36,18 +46,69 @@ ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
36 * A B C D 46 * A B C D
37 */ 47 */
38 { 48 {
39 {28, 28, 28, 28}, /* IDSEL 15 - cPCI slot 8 */ 49 {28, 29, 30, 27}, /* IDSEL 15 - cPCI slot 8 */
40 {29, 29, 29, 29}, /* IDSEL 16 - cPCI slot 7 */ 50 {29, 30, 27, 28}, /* IDSEL 16 - cPCI slot 7 */
41 {30, 30, 30, 30}, /* IDSEL 17 - cPCI slot 6 */ 51 {30, 27, 28, 29}, /* IDSEL 17 - cPCI slot 6 */
42 {27, 27, 27, 27}, /* IDSEL 18 - cPCI slot 5 */ 52 {27, 28, 29, 30}, /* IDSEL 18 - cPCI slot 5 */
43 {28, 28, 28, 28}, /* IDSEL 19 - cPCI slot 4 */ 53 {28, 29, 30, 27}, /* IDSEL 19 - cPCI slot 4 */
44 {29, 29, 29, 29}, /* IDSEL 20 - cPCI slot 3 */ 54 {29, 30, 27, 28}, /* IDSEL 20 - cPCI slot 3 */
45 {30, 30, 30, 30}, /* IDSEL 21 - cPCI slot 2 */ 55 {30, 27, 28, 29}, /* IDSEL 21 - cPCI slot 2 */
46 }; 56 };
47 const long min_idsel = 15, max_idsel = 21, irqs_per_slot = 4; 57 const long min_idsel = 15, max_idsel = 21, irqs_per_slot = 4;
48 return PCI_IRQ_TABLE_LOOKUP; 58 return PCI_IRQ_TABLE_LOOKUP;
49}; 59};
50 60
61/* The serial clock for the chip is an internal clock determined by
62 * different clock speeds/dividers.
63 * Calculate the proper input baud rate and setup the serial driver.
64 */
65static void __init
66cpci405_early_serial_map(void)
67{
68 u32 uart_div;
69 int uart_clock;
70 struct uart_port port;
71
72 /* Calculate the serial clock input frequency
73 *
74 * The uart clock is the cpu frequency (provided in the board info
75 * structure) divided by the external UART Divisor.
76 */
77 uart_div = ((mfdcr(DCRN_CHCR_BASE) & CHR0_UDIV) >> 1) + 1;
78 uart_clock = __res.bi_procfreq / uart_div;
79
80 /* Setup serial port access */
81 memset(&port, 0, sizeof(port));
82#if defined(CONFIG_UART0_TTYS0)
83 port.membase = (void*)UART0_IO_BASE;
84 port.irq = UART0_INT;
85#else
86 port.membase = (void*)UART1_IO_BASE;
87 port.irq = UART1_INT;
88#endif
89 port.uartclk = uart_clock;
90 port.regshift = 0;
91 port.iotype = UPIO_MEM;
92 port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
93 port.line = 0;
94
95 if (early_serial_setup(&port) != 0) {
96 printk("Early serial init of port 0 failed\n");
97 }
98#if defined(CONFIG_UART0_TTYS0)
99 port.membase = (void*)UART1_IO_BASE;
100 port.irq = UART1_INT;
101#else
102 port.membase = (void*)UART0_IO_BASE;
103 port.irq = UART0_INT;
104#endif
105 port.line = 1;
106
107 if (early_serial_setup(&port) != 0) {
108 printk("Early serial init of port 1 failed\n");
109 }
110}
111
51void __init 112void __init
52cpci405_setup_arch(void) 113cpci405_setup_arch(void)
53{ 114{
@@ -55,14 +116,68 @@ cpci405_setup_arch(void)
55 116
56 ibm_ocp_set_emac(0, 0); 117 ibm_ocp_set_emac(0, 0);
57 118
58 TODC_INIT(TODC_TYPE_MK48T35, cpci405_nvram, cpci405_nvram, cpci405_nvram, 8); 119 cpci405_early_serial_map();
120
121#ifdef CONFIG_GEN_RTC
122 TODC_INIT(TODC_TYPE_MK48T35,
123 cpci405_nvram, cpci405_nvram, cpci405_nvram, 8);
124#endif
125}
126
127void __init
128bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
129{
130 unsigned int bar_response, bar;
131
132 /* Disable region first */
133 out_le32((void *) &(pcip->pmm[0].ma), 0x00000000);
134 /* PLB starting addr, PCI: 0x80000000 */
135 out_le32((void *) &(pcip->pmm[0].la), 0x80000000);
136 /* PCI start addr, 0x80000000 */
137 out_le32((void *) &(pcip->pmm[0].pcila), PPC405_PCI_MEM_BASE);
138 /* 512MB range of PLB to PCI */
139 out_le32((void *) &(pcip->pmm[0].pciha), 0x00000000);
140 /* Enable no pre-fetch, enable region */
141 out_le32((void *) &(pcip->pmm[0].ma), ((0xffffffff -
142 (PPC405_PCI_UPPER_MEM -
143 PPC405_PCI_MEM_BASE)) | 0x01));
144
145 /* Disable region one */
146 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
147 out_le32((void *) &(pcip->pmm[1].la), 0x00000000);
148 out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000);
149 out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000);
150 out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
151 out_le32((void *) &(pcip->ptm1ms), 0x00000001);
152
153 /* Disable region two */
154 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
155 out_le32((void *) &(pcip->pmm[2].la), 0x00000000);
156 out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000);
157 out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000);
158 out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
159 out_le32((void *) &(pcip->ptm2ms), 0x00000000);
160 out_le32((void *) &(pcip->ptm2la), 0x00000000);
161
162 /* Zero config bars */
163 for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
164 early_write_config_dword(hose, hose->first_busno,
165 PCI_FUNC(hose->first_busno), bar,
166 0x00000000);
167 early_read_config_dword(hose, hose->first_busno,
168 PCI_FUNC(hose->first_busno), bar,
169 &bar_response);
170 }
59} 171}
60 172
61void __init 173void __init
62cpci405_map_io(void) 174cpci405_map_io(void)
63{ 175{
64 ppc4xx_map_io(); 176 ppc4xx_map_io();
177
178#ifdef CONFIG_GEN_RTC
65 cpci405_nvram = ioremap(CPCI405_NVRAM_PADDR, CPCI405_NVRAM_SIZE); 179 cpci405_nvram = ioremap(CPCI405_NVRAM_PADDR, CPCI405_NVRAM_SIZE);
180#endif
66} 181}
67 182
68void __init 183void __init
@@ -74,9 +189,11 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
74 ppc_md.setup_arch = cpci405_setup_arch; 189 ppc_md.setup_arch = cpci405_setup_arch;
75 ppc_md.setup_io_mappings = cpci405_map_io; 190 ppc_md.setup_io_mappings = cpci405_map_io;
76 191
192#ifdef CONFIG_GEN_RTC
77 ppc_md.time_init = todc_time_init; 193 ppc_md.time_init = todc_time_init;
78 ppc_md.set_rtc_time = todc_set_rtc_time; 194 ppc_md.set_rtc_time = todc_set_rtc_time;
79 ppc_md.get_rtc_time = todc_get_rtc_time; 195 ppc_md.get_rtc_time = todc_get_rtc_time;
80 ppc_md.nvram_read_val = todc_direct_read_val; 196 ppc_md.nvram_read_val = todc_direct_read_val;
81 ppc_md.nvram_write_val = todc_direct_write_val; 197 ppc_md.nvram_write_val = todc_direct_write_val;
198#endif
82} 199}
diff --git a/arch/ppc/platforms/4xx/cpci405.h b/arch/ppc/platforms/4xx/cpci405.h
index e27f7cb650d8..f5a5c0cd062d 100644
--- a/arch/ppc/platforms/4xx/cpci405.h
+++ b/arch/ppc/platforms/4xx/cpci405.h
@@ -1,37 +1,29 @@
1/* 1/*
2 * CPCI-405 board specific definitions 2 * CPCI-405 board specific definitions
3 * 3 *
4 * Copyright (c) 2001 Stefan Roese (stefan.roese@esd-electronics.com) 4 * Copyright 2001-2006 esd electronic system design - hannover germany
5 *
6 * Authors: Matthias Fuchs
7 * matthias.fuchs@esd-electronics.com
8 * Stefan Roese
9 * stefan.roese@esd-electronics.com
5 */ 10 */
6 11
7#ifdef __KERNEL__ 12#ifdef __KERNEL__
8#ifndef __ASM_CPCI405_H__ 13#ifndef __CPCI405_H__
9#define __ASM_CPCI405_H__ 14#define __CPCI405_H__
10 15
11#include <linux/config.h> 16#include <linux/config.h>
12
13/* We have a 405GP core */
14#include <platforms/4xx/ibm405gp.h> 17#include <platforms/4xx/ibm405gp.h>
15
16#include <asm/ppcboot.h> 18#include <asm/ppcboot.h>
17 19
18#ifndef __ASSEMBLY__
19/* Some 4xx parts use a different timebase frequency from the internal clock.
20*/
21#define bi_tbfreq bi_intfreq
22
23/* Map for the NVRAM space */ 20/* Map for the NVRAM space */
24#define CPCI405_NVRAM_PADDR ((uint)0xf0200000) 21#define CPCI405_NVRAM_PADDR ((uint)0xf0200000)
25#define CPCI405_NVRAM_SIZE ((uint)32*1024) 22#define CPCI405_NVRAM_SIZE ((uint)32*1024)
26 23
27#ifdef CONFIG_PPC405GP_INTERNAL_CLOCK 24#define BASE_BAUD 0
28#define BASE_BAUD 201600
29#else
30#define BASE_BAUD 691200
31#endif
32 25
33#define PPC4xx_MACHINE_NAME "esd CPCI-405" 26#define PPC4xx_MACHINE_NAME "esd CPCI-405"
34 27
35#endif /* !__ASSEMBLY__ */ 28#endif /* __CPCI405_H__ */
36#endif /* __ASM_CPCI405_H__ */
37#endif /* __KERNEL__ */ 29#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index c9e0aeeca3d8..4368dc3f3c30 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -379,13 +379,12 @@ mpc85xx_cds_pcibios_fixup(void)
379 PCI_DEVICE_ID_VIA_82C586_2, NULL))) { 379 PCI_DEVICE_ID_VIA_82C586_2, NULL))) {
380 dev->irq = 10; 380 dev->irq = 10;
381 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10); 381 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10);
382 pci_dev_put(dev);
383 }
384 382
385 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA, 383 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
386 PCI_DEVICE_ID_VIA_82C586_2, dev))) { 384 PCI_DEVICE_ID_VIA_82C586_2, dev))) {
387 dev->irq = 11; 385 dev->irq = 11;
388 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11); 386 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11);
387 }
389 pci_dev_put(dev); 388 pci_dev_put(dev);
390 } 389 }
391} 390}
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c
index 1af2c000fcfa..5c4932ca8e9b 100644
--- a/arch/ppc/syslib/mpc83xx_devices.c
+++ b/arch/ppc/syslib/mpc83xx_devices.c
@@ -186,7 +186,7 @@ struct platform_device ppc_sys_platform_devices[] = {
186 }, 186 },
187 }, 187 },
188 [MPC83xx_USB2_DR] = { 188 [MPC83xx_USB2_DR] = {
189 .name = "fsl-usb2-dr", 189 .name = "fsl-ehci",
190 .id = 1, 190 .id = 1,
191 .num_resources = 2, 191 .num_resources = 2,
192 .resource = (struct resource[]) { 192 .resource = (struct resource[]) {
@@ -203,8 +203,8 @@ struct platform_device ppc_sys_platform_devices[] = {
203 }, 203 },
204 }, 204 },
205 [MPC83xx_USB2_MPH] = { 205 [MPC83xx_USB2_MPH] = {
206 .name = "fsl-usb2-mph", 206 .name = "fsl-ehci",
207 .id = 1, 207 .id = 2,
208 .num_resources = 2, 208 .num_resources = 2,
209 .resource = (struct resource[]) { 209 .resource = (struct resource[]) {
210 { 210 {
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 01c5c082f970..821a141889de 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -446,6 +446,14 @@ config NO_IDLE_HZ_INIT
446 The HZ timer is switched off in idle by default. That means the 446 The HZ timer is switched off in idle by default. That means the
447 HZ timer is already disabled at boot time. 447 HZ timer is already disabled at boot time.
448 448
449config S390_HYPFS_FS
450 bool "s390 hypervisor file system support"
451 select SYS_HYPERVISOR
452 default y
453 help
454 This is a virtual file system intended to provide accounting
455 information in an s390 hypervisor environment.
456
449config KEXEC 457config KEXEC
450 bool "kexec system call (EXPERIMENTAL)" 458 bool "kexec system call (EXPERIMENTAL)"
451 depends on EXPERIMENTAL 459 depends on EXPERIMENTAL
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 7bb16fb97d4f..b3791fb094a8 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -76,7 +76,7 @@ LDFLAGS_vmlinux := -e start
76head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o 76head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
77 77
78core-y += arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/ arch/$(ARCH)/crypto/ \ 78core-y += arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/ arch/$(ARCH)/crypto/ \
79 arch/$(ARCH)/appldata/ 79 arch/$(ARCH)/appldata/ arch/$(ARCH)/hypfs/
80libs-y += arch/$(ARCH)/lib/ 80libs-y += arch/$(ARCH)/lib/
81drivers-y += drivers/s390/ 81drivers-y += drivers/s390/
82drivers-$(CONFIG_MATHEMU) += arch/$(ARCH)/math-emu/ 82drivers-$(CONFIG_MATHEMU) += arch/$(ARCH)/math-emu/
diff --git a/arch/s390/hypfs/Makefile b/arch/s390/hypfs/Makefile
new file mode 100644
index 000000000000..f4b00cd81f7c
--- /dev/null
+++ b/arch/s390/hypfs/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for the linux hypfs filesystem routines.
3#
4
5obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o
6
7s390_hypfs-objs := inode.o hypfs_diag.o
diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h
new file mode 100644
index 000000000000..ea5567be00fc
--- /dev/null
+++ b/arch/s390/hypfs/hypfs.h
@@ -0,0 +1,30 @@
1/*
2 * fs/hypfs/hypfs.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_H_
10#define _HYPFS_H_
11
12#include <linux/fs.h>
13#include <linux/types.h>
14
15#define REG_FILE_MODE 0440
16#define UPDATE_FILE_MODE 0220
17#define DIR_MODE 0550
18
19extern struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent,
20 const char *name);
21
22extern struct dentry *hypfs_create_u64(struct super_block *sb,
23 struct dentry *dir, const char *name,
24 __u64 value);
25
26extern struct dentry *hypfs_create_str(struct super_block *sb,
27 struct dentry *dir, const char *name,
28 char *string);
29
30#endif /* _HYPFS_H_ */
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
new file mode 100644
index 000000000000..efa74af7f04a
--- /dev/null
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -0,0 +1,696 @@
1/*
2 * fs/hypfs/hypfs_diag.c
3 * Hypervisor filesystem for Linux on s390. Diag 204 and 224
4 * implementation.
5 *
6 * Copyright (C) IBM Corp. 2006
7 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
8 */
9
10#include <linux/types.h>
11#include <linux/errno.h>
12#include <linux/string.h>
13#include <linux/vmalloc.h>
14#include <asm/ebcdic.h>
15#include "hypfs.h"
16
17#define LPAR_NAME_LEN 8 /* lpar name len in diag 204 data */
18#define CPU_NAME_LEN 16 /* type name len of cpus in diag224 name table */
19#define TMP_SIZE 64 /* size of temporary buffers */
20
21/* diag 204 subcodes */
22enum diag204_sc {
23 SUBC_STIB4 = 4,
24 SUBC_RSI = 5,
25 SUBC_STIB6 = 6,
26 SUBC_STIB7 = 7
27};
28
29/* The two available diag 204 data formats */
30enum diag204_format {
31 INFO_SIMPLE = 0,
32 INFO_EXT = 0x00010000
33};
34
35/* bit is set in flags, when physical cpu info is included in diag 204 data */
36#define LPAR_PHYS_FLG 0x80
37
38static char *diag224_cpu_names; /* diag 224 name table */
39static enum diag204_sc diag204_store_sc; /* used subcode for store */
40static enum diag204_format diag204_info_type; /* used diag 204 data format */
41
42static void *diag204_buf; /* 4K aligned buffer for diag204 data */
43static void *diag204_buf_vmalloc; /* vmalloc pointer for diag204 data */
44static int diag204_buf_pages; /* number of pages for diag204 data */
45
46/*
47 * DIAG 204 data structures and member access functions.
48 *
49 * Since we have two different diag 204 data formats for old and new s390
50 * machines, we do not access the structs directly, but use getter functions for
51 * each struct member instead. This should make the code more readable.
52 */
53
54/* Time information block */
55
56struct info_blk_hdr {
57 __u8 npar;
58 __u8 flags;
59 __u16 tslice;
60 __u16 phys_cpus;
61 __u16 this_part;
62 __u64 curtod;
63} __attribute__ ((packed));
64
65struct x_info_blk_hdr {
66 __u8 npar;
67 __u8 flags;
68 __u16 tslice;
69 __u16 phys_cpus;
70 __u16 this_part;
71 __u64 curtod1;
72 __u64 curtod2;
73 char reserved[40];
74} __attribute__ ((packed));
75
76static inline int info_blk_hdr__size(enum diag204_format type)
77{
78 if (type == INFO_SIMPLE)
79 return sizeof(struct info_blk_hdr);
80 else /* INFO_EXT */
81 return sizeof(struct x_info_blk_hdr);
82}
83
84static inline __u8 info_blk_hdr__npar(enum diag204_format type, void *hdr)
85{
86 if (type == INFO_SIMPLE)
87 return ((struct info_blk_hdr *)hdr)->npar;
88 else /* INFO_EXT */
89 return ((struct x_info_blk_hdr *)hdr)->npar;
90}
91
92static inline __u8 info_blk_hdr__flags(enum diag204_format type, void *hdr)
93{
94 if (type == INFO_SIMPLE)
95 return ((struct info_blk_hdr *)hdr)->flags;
96 else /* INFO_EXT */
97 return ((struct x_info_blk_hdr *)hdr)->flags;
98}
99
100static inline __u16 info_blk_hdr__pcpus(enum diag204_format type, void *hdr)
101{
102 if (type == INFO_SIMPLE)
103 return ((struct info_blk_hdr *)hdr)->phys_cpus;
104 else /* INFO_EXT */
105 return ((struct x_info_blk_hdr *)hdr)->phys_cpus;
106}
107
108/* Partition header */
109
110struct part_hdr {
111 __u8 pn;
112 __u8 cpus;
113 char reserved[6];
114 char part_name[LPAR_NAME_LEN];
115} __attribute__ ((packed));
116
117struct x_part_hdr {
118 __u8 pn;
119 __u8 cpus;
120 __u8 rcpus;
121 __u8 pflag;
122 __u32 mlu;
123 char part_name[LPAR_NAME_LEN];
124 char lpc_name[8];
125 char os_name[8];
126 __u64 online_cs;
127 __u64 online_es;
128 __u8 upid;
129 char reserved1[3];
130 __u32 group_mlu;
131 char group_name[8];
132 char reserved2[32];
133} __attribute__ ((packed));
134
135static inline int part_hdr__size(enum diag204_format type)
136{
137 if (type == INFO_SIMPLE)
138 return sizeof(struct part_hdr);
139 else /* INFO_EXT */
140 return sizeof(struct x_part_hdr);
141}
142
143static inline __u8 part_hdr__rcpus(enum diag204_format type, void *hdr)
144{
145 if (type == INFO_SIMPLE)
146 return ((struct part_hdr *)hdr)->cpus;
147 else /* INFO_EXT */
148 return ((struct x_part_hdr *)hdr)->rcpus;
149}
150
151static inline void part_hdr__part_name(enum diag204_format type, void *hdr,
152 char *name)
153{
154 if (type == INFO_SIMPLE)
155 memcpy(name, ((struct part_hdr *)hdr)->part_name,
156 LPAR_NAME_LEN);
157 else /* INFO_EXT */
158 memcpy(name, ((struct x_part_hdr *)hdr)->part_name,
159 LPAR_NAME_LEN);
160 EBCASC(name, LPAR_NAME_LEN);
161 name[LPAR_NAME_LEN] = 0;
162 strstrip(name);
163}
164
165struct cpu_info {
166 __u16 cpu_addr;
167 char reserved1[2];
168 __u8 ctidx;
169 __u8 cflag;
170 __u16 weight;
171 __u64 acc_time;
172 __u64 lp_time;
173} __attribute__ ((packed));
174
175struct x_cpu_info {
176 __u16 cpu_addr;
177 char reserved1[2];
178 __u8 ctidx;
179 __u8 cflag;
180 __u16 weight;
181 __u64 acc_time;
182 __u64 lp_time;
183 __u16 min_weight;
184 __u16 cur_weight;
185 __u16 max_weight;
186 char reseved2[2];
187 __u64 online_time;
188 __u64 wait_time;
189 __u32 pma_weight;
190 __u32 polar_weight;
191 char reserved3[40];
192} __attribute__ ((packed));
193
194/* CPU info block */
195
196static inline int cpu_info__size(enum diag204_format type)
197{
198 if (type == INFO_SIMPLE)
199 return sizeof(struct cpu_info);
200 else /* INFO_EXT */
201 return sizeof(struct x_cpu_info);
202}
203
204static inline __u8 cpu_info__ctidx(enum diag204_format type, void *hdr)
205{
206 if (type == INFO_SIMPLE)
207 return ((struct cpu_info *)hdr)->ctidx;
208 else /* INFO_EXT */
209 return ((struct x_cpu_info *)hdr)->ctidx;
210}
211
212static inline __u16 cpu_info__cpu_addr(enum diag204_format type, void *hdr)
213{
214 if (type == INFO_SIMPLE)
215 return ((struct cpu_info *)hdr)->cpu_addr;
216 else /* INFO_EXT */
217 return ((struct x_cpu_info *)hdr)->cpu_addr;
218}
219
220static inline __u64 cpu_info__acc_time(enum diag204_format type, void *hdr)
221{
222 if (type == INFO_SIMPLE)
223 return ((struct cpu_info *)hdr)->acc_time;
224 else /* INFO_EXT */
225 return ((struct x_cpu_info *)hdr)->acc_time;
226}
227
228static inline __u64 cpu_info__lp_time(enum diag204_format type, void *hdr)
229{
230 if (type == INFO_SIMPLE)
231 return ((struct cpu_info *)hdr)->lp_time;
232 else /* INFO_EXT */
233 return ((struct x_cpu_info *)hdr)->lp_time;
234}
235
236static inline __u64 cpu_info__online_time(enum diag204_format type, void *hdr)
237{
238 if (type == INFO_SIMPLE)
239 return 0; /* online_time not available in simple info */
240 else /* INFO_EXT */
241 return ((struct x_cpu_info *)hdr)->online_time;
242}
243
244/* Physical header */
245
246struct phys_hdr {
247 char reserved1[1];
248 __u8 cpus;
249 char reserved2[6];
250 char mgm_name[8];
251} __attribute__ ((packed));
252
253struct x_phys_hdr {
254 char reserved1[1];
255 __u8 cpus;
256 char reserved2[6];
257 char mgm_name[8];
258 char reserved3[80];
259} __attribute__ ((packed));
260
261static inline int phys_hdr__size(enum diag204_format type)
262{
263 if (type == INFO_SIMPLE)
264 return sizeof(struct phys_hdr);
265 else /* INFO_EXT */
266 return sizeof(struct x_phys_hdr);
267}
268
269static inline __u8 phys_hdr__cpus(enum diag204_format type, void *hdr)
270{
271 if (type == INFO_SIMPLE)
272 return ((struct phys_hdr *)hdr)->cpus;
273 else /* INFO_EXT */
274 return ((struct x_phys_hdr *)hdr)->cpus;
275}
276
277/* Physical CPU info block */
278
279struct phys_cpu {
280 __u16 cpu_addr;
281 char reserved1[2];
282 __u8 ctidx;
283 char reserved2[3];
284 __u64 mgm_time;
285 char reserved3[8];
286} __attribute__ ((packed));
287
288struct x_phys_cpu {
289 __u16 cpu_addr;
290 char reserved1[2];
291 __u8 ctidx;
292 char reserved2[3];
293 __u64 mgm_time;
294 char reserved3[80];
295} __attribute__ ((packed));
296
297static inline int phys_cpu__size(enum diag204_format type)
298{
299 if (type == INFO_SIMPLE)
300 return sizeof(struct phys_cpu);
301 else /* INFO_EXT */
302 return sizeof(struct x_phys_cpu);
303}
304
305static inline __u16 phys_cpu__cpu_addr(enum diag204_format type, void *hdr)
306{
307 if (type == INFO_SIMPLE)
308 return ((struct phys_cpu *)hdr)->cpu_addr;
309 else /* INFO_EXT */
310 return ((struct x_phys_cpu *)hdr)->cpu_addr;
311}
312
313static inline __u64 phys_cpu__mgm_time(enum diag204_format type, void *hdr)
314{
315 if (type == INFO_SIMPLE)
316 return ((struct phys_cpu *)hdr)->mgm_time;
317 else /* INFO_EXT */
318 return ((struct x_phys_cpu *)hdr)->mgm_time;
319}
320
321static inline __u64 phys_cpu__ctidx(enum diag204_format type, void *hdr)
322{
323 if (type == INFO_SIMPLE)
324 return ((struct phys_cpu *)hdr)->ctidx;
325 else /* INFO_EXT */
326 return ((struct x_phys_cpu *)hdr)->ctidx;
327}
328
329/* Diagnose 204 functions */
330
331static int diag204(unsigned long subcode, unsigned long size, void *addr)
332{
333 register unsigned long _subcode asm("0") = subcode;
334 register unsigned long _size asm("1") = size;
335
336 asm volatile (" diag %2,%0,0x204\n"
337 "0: \n" ".section __ex_table,\"a\"\n"
338#ifndef __s390x__
339 " .align 4\n"
340 " .long 0b,0b\n"
341#else
342 " .align 8\n"
343 " .quad 0b,0b\n"
344#endif
345 ".previous":"+d" (_subcode), "+d"(_size)
346 :"d"(addr)
347 :"memory");
348 if (_subcode)
349 return -1;
350 else
351 return _size;
352}
353
354/*
355 * For the old diag subcode 4 with simple data format we have to use real
356 * memory. If we use subcode 6 or 7 with extended data format, we can (and
357 * should) use vmalloc, since we need a lot of memory in that case. Currently
358 * up to 93 pages!
359 */
360
361static void diag204_free_buffer(void)
362{
363 if (!diag204_buf)
364 return;
365 if (diag204_buf_vmalloc) {
366 vfree(diag204_buf_vmalloc);
367 diag204_buf_vmalloc = NULL;
368 } else {
369 free_pages((unsigned long) diag204_buf, 0);
370 }
371 diag204_buf_pages = 0;
372 diag204_buf = NULL;
373}
374
375static void *diag204_alloc_vbuf(int pages)
376{
377 /* The buffer has to be page aligned! */
378 diag204_buf_vmalloc = vmalloc(PAGE_SIZE * (pages + 1));
379 if (!diag204_buf_vmalloc)
380 return ERR_PTR(-ENOMEM);
381 diag204_buf = (void*)((unsigned long)diag204_buf_vmalloc
382 & ~0xfffUL) + 0x1000;
383 diag204_buf_pages = pages;
384 return diag204_buf;
385}
386
387static void *diag204_alloc_rbuf(void)
388{
389 diag204_buf = (void*)__get_free_pages(GFP_KERNEL,0);
390 if (diag204_buf)
391 return ERR_PTR(-ENOMEM);
392 diag204_buf_pages = 1;
393 return diag204_buf;
394}
395
396static void *diag204_get_buffer(enum diag204_format fmt, int *pages)
397{
398 if (diag204_buf) {
399 *pages = diag204_buf_pages;
400 return diag204_buf;
401 }
402 if (fmt == INFO_SIMPLE) {
403 *pages = 1;
404 return diag204_alloc_rbuf();
405 } else {/* INFO_EXT */
406 *pages = diag204(SUBC_RSI | INFO_EXT, 0, 0);
407 if (*pages <= 0)
408 return ERR_PTR(-ENOSYS);
409 else
410 return diag204_alloc_vbuf(*pages);
411 }
412}
413
414/*
415 * diag204_probe() has to find out, which type of diagnose 204 implementation
416 * we have on our machine. Currently there are three possible scanarios:
417 * - subcode 4 + simple data format (only one page)
418 * - subcode 4-6 + extended data format
419 * - subcode 4-7 + extended data format
420 *
421 * Subcode 5 is used to retrieve the size of the data, provided by subcodes
422 * 6 and 7. Subcode 7 basically has the same function as subcode 6. In addition
423 * to subcode 6 it provides also information about secondary cpus.
424 * In order to get as much information as possible, we first try
425 * subcode 7, then 6 and if both fail, we use subcode 4.
426 */
427
428static int diag204_probe(void)
429{
430 void *buf;
431 int pages, rc;
432
433 buf = diag204_get_buffer(INFO_EXT, &pages);
434 if (!IS_ERR(buf)) {
435 if (diag204(SUBC_STIB7 | INFO_EXT, pages, buf) >= 0) {
436 diag204_store_sc = SUBC_STIB7;
437 diag204_info_type = INFO_EXT;
438 goto out;
439 }
440 if (diag204(SUBC_STIB6 | INFO_EXT, pages, buf) >= 0) {
441 diag204_store_sc = SUBC_STIB7;
442 diag204_info_type = INFO_EXT;
443 goto out;
444 }
445 diag204_free_buffer();
446 }
447
448 /* subcodes 6 and 7 failed, now try subcode 4 */
449
450 buf = diag204_get_buffer(INFO_SIMPLE, &pages);
451 if (IS_ERR(buf)) {
452 rc = PTR_ERR(buf);
453 goto fail_alloc;
454 }
455 if (diag204(SUBC_STIB4 | INFO_SIMPLE, pages, buf) >= 0) {
456 diag204_store_sc = SUBC_STIB4;
457 diag204_info_type = INFO_SIMPLE;
458 goto out;
459 } else {
460 rc = -ENOSYS;
461 goto fail_store;
462 }
463out:
464 rc = 0;
465fail_store:
466 diag204_free_buffer();
467fail_alloc:
468 return rc;
469}
470
471static void *diag204_store(void)
472{
473 void *buf;
474 int pages;
475
476 buf = diag204_get_buffer(diag204_info_type, &pages);
477 if (IS_ERR(buf))
478 goto out;
479 if (diag204(diag204_store_sc | diag204_info_type, pages, buf) < 0)
480 return ERR_PTR(-ENOSYS);
481out:
482 return buf;
483}
484
485/* Diagnose 224 functions */
486
487static void diag224(void *ptr)
488{
489 asm volatile(" diag %0,%1,0x224\n"
490 : :"d" (0), "d"(ptr) : "memory");
491}
492
493static int diag224_get_name_table(void)
494{
495 /* memory must be below 2GB */
496 diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
497 if (!diag224_cpu_names)
498 return -ENOMEM;
499 diag224(diag224_cpu_names);
500 EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16);
501 return 0;
502}
503
504static void diag224_delete_name_table(void)
505{
506 kfree(diag224_cpu_names);
507}
508
509static int diag224_idx2name(int index, char *name)
510{
511 memcpy(name, diag224_cpu_names + ((index + 1) * CPU_NAME_LEN),
512 CPU_NAME_LEN);
513 name[CPU_NAME_LEN] = 0;
514 strstrip(name);
515 return 0;
516}
517
518__init int hypfs_diag_init(void)
519{
520 int rc;
521
522 if (diag204_probe()) {
523 printk(KERN_ERR "hypfs: diag 204 not working.");
524 return -ENODATA;
525 }
526 rc = diag224_get_name_table();
527 if (rc) {
528 diag224_delete_name_table();
529 printk(KERN_ERR "hypfs: could not get name table.\n");
530 }
531 return rc;
532}
533
534__exit void hypfs_diag_exit(void)
535{
536 diag224_delete_name_table();
537 diag204_free_buffer();
538}
539
540/*
541 * Functions to create the directory structure
542 * *******************************************
543 */
544
545static int hypfs_create_cpu_files(struct super_block *sb,
546 struct dentry *cpus_dir, void *cpu_info)
547{
548 struct dentry *cpu_dir;
549 char buffer[TMP_SIZE];
550 void *rc;
551
552 snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_info_type,
553 cpu_info));
554 cpu_dir = hypfs_mkdir(sb, cpus_dir, buffer);
555 rc = hypfs_create_u64(sb, cpu_dir, "mgmtime",
556 cpu_info__acc_time(diag204_info_type, cpu_info) -
557 cpu_info__lp_time(diag204_info_type, cpu_info));
558 if (IS_ERR(rc))
559 return PTR_ERR(rc);
560 rc = hypfs_create_u64(sb, cpu_dir, "cputime",
561 cpu_info__lp_time(diag204_info_type, cpu_info));
562 if (IS_ERR(rc))
563 return PTR_ERR(rc);
564 if (diag204_info_type == INFO_EXT) {
565 rc = hypfs_create_u64(sb, cpu_dir, "onlinetime",
566 cpu_info__online_time(diag204_info_type,
567 cpu_info));
568 if (IS_ERR(rc))
569 return PTR_ERR(rc);
570 }
571 diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer);
572 rc = hypfs_create_str(sb, cpu_dir, "type", buffer);
573 if (IS_ERR(rc))
574 return PTR_ERR(rc);
575 return 0;
576}
577
578static void *hypfs_create_lpar_files(struct super_block *sb,
579 struct dentry *systems_dir, void *part_hdr)
580{
581 struct dentry *cpus_dir;
582 struct dentry *lpar_dir;
583 char lpar_name[LPAR_NAME_LEN + 1];
584 void *cpu_info;
585 int i;
586
587 part_hdr__part_name(diag204_info_type, part_hdr, lpar_name);
588 lpar_name[LPAR_NAME_LEN] = 0;
589 lpar_dir = hypfs_mkdir(sb, systems_dir, lpar_name);
590 if (IS_ERR(lpar_dir))
591 return lpar_dir;
592 cpus_dir = hypfs_mkdir(sb, lpar_dir, "cpus");
593 if (IS_ERR(cpus_dir))
594 return cpus_dir;
595 cpu_info = part_hdr + part_hdr__size(diag204_info_type);
596 for (i = 0; i < part_hdr__rcpus(diag204_info_type, part_hdr); i++) {
597 int rc;
598 rc = hypfs_create_cpu_files(sb, cpus_dir, cpu_info);
599 if (rc)
600 return ERR_PTR(rc);
601 cpu_info += cpu_info__size(diag204_info_type);
602 }
603 return cpu_info;
604}
605
606static int hypfs_create_phys_cpu_files(struct super_block *sb,
607 struct dentry *cpus_dir, void *cpu_info)
608{
609 struct dentry *cpu_dir;
610 char buffer[TMP_SIZE];
611 void *rc;
612
613 snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_info_type,
614 cpu_info));
615 cpu_dir = hypfs_mkdir(sb, cpus_dir, buffer);
616 if (IS_ERR(cpu_dir))
617 return PTR_ERR(cpu_dir);
618 rc = hypfs_create_u64(sb, cpu_dir, "mgmtime",
619 phys_cpu__mgm_time(diag204_info_type, cpu_info));
620 if (IS_ERR(rc))
621 return PTR_ERR(rc);
622 diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer);
623 rc = hypfs_create_str(sb, cpu_dir, "type", buffer);
624 if (IS_ERR(rc))
625 return PTR_ERR(rc);
626 return 0;
627}
628
629static void *hypfs_create_phys_files(struct super_block *sb,
630 struct dentry *parent_dir, void *phys_hdr)
631{
632 int i;
633 void *cpu_info;
634 struct dentry *cpus_dir;
635
636 cpus_dir = hypfs_mkdir(sb, parent_dir, "cpus");
637 if (IS_ERR(cpus_dir))
638 return cpus_dir;
639 cpu_info = phys_hdr + phys_hdr__size(diag204_info_type);
640 for (i = 0; i < phys_hdr__cpus(diag204_info_type, phys_hdr); i++) {
641 int rc;
642 rc = hypfs_create_phys_cpu_files(sb, cpus_dir, cpu_info);
643 if (rc)
644 return ERR_PTR(rc);
645 cpu_info += phys_cpu__size(diag204_info_type);
646 }
647 return cpu_info;
648}
649
650int hypfs_diag_create_files(struct super_block *sb, struct dentry *root)
651{
652 struct dentry *systems_dir, *hyp_dir;
653 void *time_hdr, *part_hdr;
654 int i, rc;
655 void *buffer, *ptr;
656
657 buffer = diag204_store();
658 if (IS_ERR(buffer))
659 return PTR_ERR(buffer);
660
661 systems_dir = hypfs_mkdir(sb, root, "systems");
662 if (IS_ERR(systems_dir)) {
663 rc = PTR_ERR(systems_dir);
664 goto err_out;
665 }
666 time_hdr = (struct x_info_blk_hdr *)buffer;
667 part_hdr = time_hdr + info_blk_hdr__size(diag204_info_type);
668 for (i = 0; i < info_blk_hdr__npar(diag204_info_type, time_hdr); i++) {
669 part_hdr = hypfs_create_lpar_files(sb, systems_dir, part_hdr);
670 if (IS_ERR(part_hdr)) {
671 rc = PTR_ERR(part_hdr);
672 goto err_out;
673 }
674 }
675 if (info_blk_hdr__flags(diag204_info_type, time_hdr) & LPAR_PHYS_FLG) {
676 ptr = hypfs_create_phys_files(sb, root, part_hdr);
677 if (IS_ERR(ptr)) {
678 rc = PTR_ERR(ptr);
679 goto err_out;
680 }
681 }
682 hyp_dir = hypfs_mkdir(sb, root, "hyp");
683 if (IS_ERR(hyp_dir)) {
684 rc = PTR_ERR(hyp_dir);
685 goto err_out;
686 }
687 ptr = hypfs_create_str(sb, hyp_dir, "type", "LPAR Hypervisor");
688 if (IS_ERR(ptr)) {
689 rc = PTR_ERR(ptr);
690 goto err_out;
691 }
692 rc = 0;
693
694err_out:
695 return rc;
696}
diff --git a/arch/s390/hypfs/hypfs_diag.h b/arch/s390/hypfs/hypfs_diag.h
new file mode 100644
index 000000000000..793dea6b9bb6
--- /dev/null
+++ b/arch/s390/hypfs/hypfs_diag.h
@@ -0,0 +1,16 @@
1/*
2 * fs/hypfs/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/inode.c b/arch/s390/hypfs/inode.c
new file mode 100644
index 000000000000..18c091925ea5
--- /dev/null
+++ b/arch/s390/hypfs/inode.c
@@ -0,0 +1,491 @@
1/*
2 * fs/hypfs/inode.c
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#include <linux/types.h>
10#include <linux/errno.h>
11#include <linux/fs.h>
12#include <linux/namei.h>
13#include <linux/vfs.h>
14#include <linux/pagemap.h>
15#include <linux/gfp.h>
16#include <linux/time.h>
17#include <linux/parser.h>
18#include <linux/sysfs.h>
19#include <linux/module.h>
20#include <asm/ebcdic.h>
21#include "hypfs.h"
22#include "hypfs_diag.h"
23
24#define HYPFS_MAGIC 0x687970 /* ASCII 'hyp' */
25#define TMP_SIZE 64 /* size of temporary buffers */
26
27static struct dentry *hypfs_create_update_file(struct super_block *sb,
28 struct dentry *dir);
29
30struct hypfs_sb_info {
31 uid_t uid; /* uid used for files and dirs */
32 gid_t gid; /* gid used for files and dirs */
33 struct dentry *update_file; /* file to trigger update */
34 time_t last_update; /* last update time in secs since 1970 */
35 struct mutex lock; /* lock to protect update process */
36};
37
38static struct file_operations hypfs_file_ops;
39static struct file_system_type hypfs_type;
40static struct super_operations hypfs_s_ops;
41
42/* start of list of all dentries, which have to be deleted on update */
43static struct dentry *hypfs_last_dentry;
44
45static void hypfs_update_update(struct super_block *sb)
46{
47 struct hypfs_sb_info *sb_info = sb->s_fs_info;
48 struct inode *inode = sb_info->update_file->d_inode;
49
50 sb_info->last_update = get_seconds();
51 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
52}
53
54/* directory tree removal functions */
55
56static void hypfs_add_dentry(struct dentry *dentry)
57{
58 dentry->d_fsdata = hypfs_last_dentry;
59 hypfs_last_dentry = dentry;
60}
61
62static void hypfs_remove(struct dentry *dentry)
63{
64 struct dentry *parent;
65
66 parent = dentry->d_parent;
67 if (S_ISDIR(dentry->d_inode->i_mode))
68 simple_rmdir(parent->d_inode, dentry);
69 else
70 simple_unlink(parent->d_inode, dentry);
71 d_delete(dentry);
72 dput(dentry);
73}
74
75static void hypfs_delete_tree(struct dentry *root)
76{
77 while (hypfs_last_dentry) {
78 struct dentry *next_dentry;
79 next_dentry = hypfs_last_dentry->d_fsdata;
80 hypfs_remove(hypfs_last_dentry);
81 hypfs_last_dentry = next_dentry;
82 }
83}
84
85static struct inode *hypfs_make_inode(struct super_block *sb, int mode)
86{
87 struct inode *ret = new_inode(sb);
88
89 if (ret) {
90 struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
91 ret->i_mode = mode;
92 ret->i_uid = hypfs_info->uid;
93 ret->i_gid = hypfs_info->gid;
94 ret->i_blksize = PAGE_CACHE_SIZE;
95 ret->i_blocks = 0;
96 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
97 if (mode & S_IFDIR)
98 ret->i_nlink = 2;
99 else
100 ret->i_nlink = 1;
101 }
102 return ret;
103}
104
105static void hypfs_drop_inode(struct inode *inode)
106{
107 kfree(inode->u.generic_ip);
108 generic_delete_inode(inode);
109}
110
111static int hypfs_open(struct inode *inode, struct file *filp)
112{
113 char *data = filp->f_dentry->d_inode->u.generic_ip;
114 struct hypfs_sb_info *fs_info;
115
116 if (filp->f_mode & FMODE_WRITE) {
117 if (!(inode->i_mode & S_IWUGO))
118 return -EACCES;
119 }
120 if (filp->f_mode & FMODE_READ) {
121 if (!(inode->i_mode & S_IRUGO))
122 return -EACCES;
123 }
124
125 fs_info = inode->i_sb->s_fs_info;
126 if(data) {
127 mutex_lock(&fs_info->lock);
128 filp->private_data = kstrdup(data, GFP_KERNEL);
129 if (!filp->private_data) {
130 mutex_unlock(&fs_info->lock);
131 return -ENOMEM;
132 }
133 mutex_unlock(&fs_info->lock);
134 }
135 return 0;
136}
137
138static ssize_t hypfs_aio_read(struct kiocb *iocb, __user char *buf,
139 size_t count, loff_t offset)
140{
141 char *data;
142 size_t len;
143 struct file *filp = iocb->ki_filp;
144
145 data = filp->private_data;
146 len = strlen(data);
147 if (offset > len) {
148 count = 0;
149 goto out;
150 }
151 if (count > len - offset)
152 count = len - offset;
153 if (copy_to_user(buf, data + offset, count)) {
154 count = -EFAULT;
155 goto out;
156 }
157 iocb->ki_pos += count;
158 file_accessed(filp);
159out:
160 return count;
161}
162static ssize_t hypfs_aio_write(struct kiocb *iocb, const char __user *buf,
163 size_t count, loff_t pos)
164{
165 int rc;
166 struct super_block *sb;
167 struct hypfs_sb_info *fs_info;
168
169 sb = iocb->ki_filp->f_dentry->d_inode->i_sb;
170 fs_info = sb->s_fs_info;
171 /*
172 * Currently we only allow one update per second for two reasons:
173 * 1. diag 204 is VERY expensive
174 * 2. If several processes do updates in parallel and then read the
175 * hypfs data, the likelihood of collisions is reduced, if we restrict
176 * the minimum update interval. A collision occurs, if during the
177 * data gathering of one process another process triggers an update
178 * If the first process wants to ensure consistent data, it has
179 * to restart data collection in this case.
180 */
181 mutex_lock(&fs_info->lock);
182 if (fs_info->last_update == get_seconds()) {
183 rc = -EBUSY;
184 goto out;
185 }
186 hypfs_delete_tree(sb->s_root);
187 rc = hypfs_diag_create_files(sb, sb->s_root);
188 if (rc) {
189 printk(KERN_ERR "hypfs: Update failed\n");
190 hypfs_delete_tree(sb->s_root);
191 goto out;
192 }
193 hypfs_update_update(sb);
194 rc = count;
195out:
196 mutex_unlock(&fs_info->lock);
197 return rc;
198}
199
200static int hypfs_release(struct inode *inode, struct file *filp)
201{
202 kfree(filp->private_data);
203 return 0;
204}
205
206enum { opt_uid, opt_gid, opt_err };
207
208static match_table_t hypfs_tokens = {
209 {opt_uid, "uid=%u"},
210 {opt_gid, "gid=%u"},
211 {opt_err, NULL}
212};
213
214static int hypfs_parse_options(char *options, struct super_block *sb)
215{
216 char *str;
217 substring_t args[MAX_OPT_ARGS];
218
219 if (!options)
220 return 0;
221 while ((str = strsep(&options, ",")) != NULL) {
222 int token, option;
223 struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
224
225 if (!*str)
226 continue;
227 token = match_token(str, hypfs_tokens, args);
228 switch (token) {
229 case opt_uid:
230 if (match_int(&args[0], &option))
231 return -EINVAL;
232 hypfs_info->uid = option;
233 break;
234 case opt_gid:
235 if (match_int(&args[0], &option))
236 return -EINVAL;
237 hypfs_info->gid = option;
238 break;
239 case opt_err:
240 default:
241 printk(KERN_ERR "hypfs: Unrecognized mount option "
242 "\"%s\" or missing value\n", str);
243 return -EINVAL;
244 }
245 }
246 return 0;
247}
248
249static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
250{
251 struct inode *root_inode;
252 struct dentry *root_dentry;
253 int rc = 0;
254 struct hypfs_sb_info *sbi;
255
256 sbi = kzalloc(sizeof(struct hypfs_sb_info), GFP_KERNEL);
257 if (!sbi)
258 return -ENOMEM;
259 mutex_init(&sbi->lock);
260 sbi->uid = current->uid;
261 sbi->gid = current->gid;
262 sb->s_fs_info = sbi;
263 sb->s_blocksize = PAGE_CACHE_SIZE;
264 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
265 sb->s_magic = HYPFS_MAGIC;
266 sb->s_op = &hypfs_s_ops;
267 if (hypfs_parse_options(data, sb)) {
268 rc = -EINVAL;
269 goto err_alloc;
270 }
271 root_inode = hypfs_make_inode(sb, S_IFDIR | 0755);
272 if (!root_inode) {
273 rc = -ENOMEM;
274 goto err_alloc;
275 }
276 root_inode->i_op = &simple_dir_inode_operations;
277 root_inode->i_fop = &simple_dir_operations;
278 root_dentry = d_alloc_root(root_inode);
279 if (!root_dentry) {
280 iput(root_inode);
281 rc = -ENOMEM;
282 goto err_alloc;
283 }
284 rc = hypfs_diag_create_files(sb, root_dentry);
285 if (rc)
286 goto err_tree;
287 sbi->update_file = hypfs_create_update_file(sb, root_dentry);
288 if (IS_ERR(sbi->update_file)) {
289 rc = PTR_ERR(sbi->update_file);
290 goto err_tree;
291 }
292 hypfs_update_update(sb);
293 sb->s_root = root_dentry;
294 return 0;
295
296err_tree:
297 hypfs_delete_tree(root_dentry);
298 d_genocide(root_dentry);
299 dput(root_dentry);
300err_alloc:
301 kfree(sbi);
302 return rc;
303}
304
305static int hypfs_get_super(struct file_system_type *fst, int flags,
306 const char *devname, void *data, struct vfsmount *mnt)
307{
308 return get_sb_single(fst, flags, data, hypfs_fill_super, mnt);
309}
310
311static void hypfs_kill_super(struct super_block *sb)
312{
313 struct hypfs_sb_info *sb_info = sb->s_fs_info;
314
315 hypfs_delete_tree(sb->s_root);
316 hypfs_remove(sb_info->update_file);
317 kfree(sb->s_fs_info);
318 sb->s_fs_info = NULL;
319 kill_litter_super(sb);
320}
321
322static struct dentry *hypfs_create_file(struct super_block *sb,
323 struct dentry *parent, const char *name,
324 char *data, mode_t mode)
325{
326 struct dentry *dentry;
327 struct inode *inode;
328 struct qstr qname;
329
330 qname.name = name;
331 qname.len = strlen(name);
332 qname.hash = full_name_hash(name, qname.len);
333 dentry = lookup_one_len(name, parent, strlen(name));
334 if (IS_ERR(dentry))
335 return ERR_PTR(-ENOMEM);
336 inode = hypfs_make_inode(sb, mode);
337 if (!inode) {
338 dput(dentry);
339 return ERR_PTR(-ENOMEM);
340 }
341 if (mode & S_IFREG) {
342 inode->i_fop = &hypfs_file_ops;
343 if (data)
344 inode->i_size = strlen(data);
345 else
346 inode->i_size = 0;
347 } else if (mode & S_IFDIR) {
348 inode->i_op = &simple_dir_inode_operations;
349 inode->i_fop = &simple_dir_operations;
350 parent->d_inode->i_nlink++;
351 } else
352 BUG();
353 inode->u.generic_ip = data;
354 d_instantiate(dentry, inode);
355 dget(dentry);
356 return dentry;
357}
358
359struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent,
360 const char *name)
361{
362 struct dentry *dentry;
363
364 dentry = hypfs_create_file(sb, parent, name, NULL, S_IFDIR | DIR_MODE);
365 if (IS_ERR(dentry))
366 return dentry;
367 hypfs_add_dentry(dentry);
368 parent->d_inode->i_nlink++;
369 return dentry;
370}
371
372static struct dentry *hypfs_create_update_file(struct super_block *sb,
373 struct dentry *dir)
374{
375 struct dentry *dentry;
376
377 dentry = hypfs_create_file(sb, dir, "update", NULL,
378 S_IFREG | UPDATE_FILE_MODE);
379 /*
380 * We do not put the update file on the 'delete' list with
381 * hypfs_add_dentry(), since it should not be removed when the tree
382 * is updated.
383 */
384 return dentry;
385}
386
387struct dentry *hypfs_create_u64(struct super_block *sb, struct dentry *dir,
388 const char *name, __u64 value)
389{
390 char *buffer;
391 char tmp[TMP_SIZE];
392 struct dentry *dentry;
393
394 snprintf(tmp, TMP_SIZE, "%lld\n", (unsigned long long int)value);
395 buffer = kstrdup(tmp, GFP_KERNEL);
396 if (!buffer)
397 return ERR_PTR(-ENOMEM);
398 dentry =
399 hypfs_create_file(sb, dir, name, buffer, S_IFREG | REG_FILE_MODE);
400 if (IS_ERR(dentry)) {
401 kfree(buffer);
402 return ERR_PTR(-ENOMEM);
403 }
404 hypfs_add_dentry(dentry);
405 return dentry;
406}
407
408struct dentry *hypfs_create_str(struct super_block *sb, struct dentry *dir,
409 const char *name, char *string)
410{
411 char *buffer;
412 struct dentry *dentry;
413
414 buffer = kmalloc(strlen(string) + 2, GFP_KERNEL);
415 if (!buffer)
416 return ERR_PTR(-ENOMEM);
417 sprintf(buffer, "%s\n", string);
418 dentry =
419 hypfs_create_file(sb, dir, name, buffer, S_IFREG | REG_FILE_MODE);
420 if (IS_ERR(dentry)) {
421 kfree(buffer);
422 return ERR_PTR(-ENOMEM);
423 }
424 hypfs_add_dentry(dentry);
425 return dentry;
426}
427
428static struct file_operations hypfs_file_ops = {
429 .open = hypfs_open,
430 .release = hypfs_release,
431 .read = do_sync_read,
432 .write = do_sync_write,
433 .aio_read = hypfs_aio_read,
434 .aio_write = hypfs_aio_write,
435};
436
437static struct file_system_type hypfs_type = {
438 .owner = THIS_MODULE,
439 .name = "s390_hypfs",
440 .get_sb = hypfs_get_super,
441 .kill_sb = hypfs_kill_super
442};
443
444static struct super_operations hypfs_s_ops = {
445 .statfs = simple_statfs,
446 .drop_inode = hypfs_drop_inode,
447};
448
449static decl_subsys(s390, NULL, NULL);
450
451static int __init hypfs_init(void)
452{
453 int rc;
454
455 if (MACHINE_IS_VM)
456 return -ENODATA;
457 if (hypfs_diag_init()) {
458 rc = -ENODATA;
459 goto fail_diag;
460 }
461 kset_set_kset_s(&s390_subsys, hypervisor_subsys);
462 rc = subsystem_register(&s390_subsys);
463 if (rc)
464 goto fail_sysfs;
465 rc = register_filesystem(&hypfs_type);
466 if (rc)
467 goto fail_filesystem;
468 return 0;
469
470fail_filesystem:
471 subsystem_unregister(&s390_subsys);
472fail_sysfs:
473 hypfs_diag_exit();
474fail_diag:
475 printk(KERN_ERR "hypfs: Initialization failed with rc = %i.\n", rc);
476 return rc;
477}
478
479static void __exit hypfs_exit(void)
480{
481 hypfs_diag_exit();
482 unregister_filesystem(&hypfs_type);
483 subsystem_unregister(&s390_subsys);
484}
485
486module_init(hypfs_init)
487module_exit(hypfs_exit)
488
489MODULE_LICENSE("GPL");
490MODULE_AUTHOR("Michael Holzheu <holzheu@de.ibm.com>");
491MODULE_DESCRIPTION("s390 Hypervisor Filesystem");
diff --git a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
index 3ea8929e483b..9e2ffc45c0e0 100644
--- a/arch/sh64/kernel/signal.c
+++ b/arch/sh64/kernel/signal.c
@@ -407,7 +407,7 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
407static inline void __user * 407static inline void __user *
408get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) 408get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
409{ 409{
410 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) 410 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
411 sp = current->sas_ss_sp + current->sas_ss_size; 411 sp = current->sas_ss_sp + current->sas_ss_size;
412 412
413 return (void __user *)((sp - frame_size) & -8ul); 413 return (void __user *)((sp - frame_size) & -8ul);
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 2cbf282f0d00..a893a9cc9534 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -332,7 +332,7 @@ void __init setup_arch(char **cmdline_p)
332 if (!root_flags) 332 if (!root_flags)
333 root_mountflags &= ~MS_RDONLY; 333 root_mountflags &= ~MS_RDONLY;
334 ROOT_DEV = old_decode_dev(root_dev); 334 ROOT_DEV = old_decode_dev(root_dev);
335#ifdef CONFIG_BLK_DEV_INITRD 335#ifdef CONFIG_BLK_DEV_RAM
336 rd_image_start = ram_flags & RAMDISK_IMAGE_START_MASK; 336 rd_image_start = ram_flags & RAMDISK_IMAGE_START_MASK;
337 rd_prompt = ((ram_flags & RAMDISK_PROMPT_FLAG) != 0); 337 rd_prompt = ((ram_flags & RAMDISK_PROMPT_FLAG) != 0);
338 rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0); 338 rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0);
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index 4885ca6cbc77..0f0eb6aa1c40 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -356,7 +356,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf)
356 int error; 356 int error;
357 struct sol_statvfs __user *ss = A(buf); 357 struct sol_statvfs __user *ss = A(buf);
358 358
359 error = vfs_statfs(mnt->mnt_sb, &s); 359 error = vfs_statfs(mnt->mnt_root, &s);
360 if (!error) { 360 if (!error) {
361 const char *p = mnt->mnt_sb->s_type->name; 361 const char *p = mnt->mnt_sb->s_type->name;
362 int i = 0; 362 int i = 0;
@@ -392,7 +392,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf)
392 int error; 392 int error;
393 struct sol_statvfs64 __user *ss = A(buf); 393 struct sol_statvfs64 __user *ss = A(buf);
394 394
395 error = vfs_statfs(mnt->mnt_sb, &s); 395 error = vfs_statfs(mnt->mnt_root, &s);
396 if (!error) { 396 if (!error) {
397 const char *p = mnt->mnt_sb->s_type->name; 397 const char *p = mnt->mnt_sb->s_type->name;
398 int i = 0; 398 int i = 0;
diff --git a/arch/um/Kconfig.debug b/arch/um/Kconfig.debug
index 5681a8bd370b..bab51d619173 100644
--- a/arch/um/Kconfig.debug
+++ b/arch/um/Kconfig.debug
@@ -49,7 +49,6 @@ config GCOV
49 49
50config SYSCALL_DEBUG 50config SYSCALL_DEBUG
51 bool "Enable system call debugging" 51 bool "Enable system call debugging"
52 default N
53 depends on DEBUG_INFO 52 depends on DEBUG_INFO
54 help 53 help
55 This adds some system debugging to UML, including keeping a ring buffer 54 This adds some system debugging to UML, including keeping a ring buffer
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index 86f51d04c98d..87cdbc560d36 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -87,7 +87,7 @@ void timer_irq(union uml_pt_regs *regs)
87 87
88void time_init_kern(void) 88void time_init_kern(void)
89{ 89{
90 unsigned long long nsecs; 90 long long nsecs;
91 91
92 nsecs = os_nsecs(); 92 nsecs = os_nsecs();
93 set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION, 93 set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
diff --git a/arch/um/sys-ppc/misc.S b/arch/um/sys-ppc/misc.S
index 11b7bd768cfd..f0c971db47e4 100644
--- a/arch/um/sys-ppc/misc.S
+++ b/arch/um/sys-ppc/misc.S
@@ -23,14 +23,10 @@
23#define CACHE_LINE_SIZE 16 23#define CACHE_LINE_SIZE 16
24#define LG_CACHE_LINE_SIZE 4 24#define LG_CACHE_LINE_SIZE 4
25#define MAX_COPY_PREFETCH 1 25#define MAX_COPY_PREFETCH 1
26#elif !defined(CONFIG_PPC64BRIDGE) 26#else
27#define CACHE_LINE_SIZE 32 27#define CACHE_LINE_SIZE 32
28#define LG_CACHE_LINE_SIZE 5 28#define LG_CACHE_LINE_SIZE 5
29#define MAX_COPY_PREFETCH 4 29#define MAX_COPY_PREFETCH 4
30#else
31#define CACHE_LINE_SIZE 128
32#define LG_CACHE_LINE_SIZE 7
33#define MAX_COPY_PREFETCH 1
34#endif /* CONFIG_4xx || CONFIG_8xx */ 30#endif /* CONFIG_4xx || CONFIG_8xx */
35 31
36 .text 32 .text
diff --git a/arch/v850/kernel/signal.c b/arch/v850/kernel/signal.c
index 633e4e1b825f..17c2d4359b04 100644
--- a/arch/v850/kernel/signal.c
+++ b/arch/v850/kernel/signal.c
@@ -274,7 +274,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
274 /* Default to using normal stack */ 274 /* Default to using normal stack */
275 unsigned long sp = regs->gpr[GPR_SP]; 275 unsigned long sp = regs->gpr[GPR_SP];
276 276
277 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) 277 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
278 sp = current->sas_ss_sp + current->sas_ss_size; 278 sp = current->sas_ss_sp + current->sas_ss_size;
279 279
280 return (void *)((sp - frame_size) & -8UL); 280 return (void *)((sp - frame_size) & -8UL);
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 408d44a59756..af44130f0d65 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -299,6 +299,7 @@ config X86_64_ACPI_NUMA
299 bool "ACPI NUMA detection" 299 bool "ACPI NUMA detection"
300 depends on NUMA 300 depends on NUMA
301 select ACPI 301 select ACPI
302 select PCI
302 select ACPI_NUMA 303 select ACPI_NUMA
303 default y 304 default y
304 help 305 help
@@ -389,6 +390,7 @@ config GART_IOMMU
389 bool "K8 GART IOMMU support" 390 bool "K8 GART IOMMU support"
390 default y 391 default y
391 select SWIOTLB 392 select SWIOTLB
393 select AGP
392 depends on PCI 394 depends on PCI
393 help 395 help
394 Support for hardware IOMMU in AMD's Opteron/Athlon64 Processors 396 Support for hardware IOMMU in AMD's Opteron/Athlon64 Processors
@@ -401,11 +403,9 @@ config GART_IOMMU
401 northbridge and a software emulation used on other systems without 403 northbridge and a software emulation used on other systems without
402 hardware IOMMU. If unsure, say Y. 404 hardware IOMMU. If unsure, say Y.
403 405
404# need this always enabled with GART_IOMMU for the VIA workaround 406# need this always selected by GART_IOMMU for the VIA workaround
405config SWIOTLB 407config SWIOTLB
406 bool 408 bool
407 default y
408 depends on GART_IOMMU
409 409
410config X86_MCE 410config X86_MCE
411 bool "Machine check support" if EMBEDDED 411 bool "Machine check support" if EMBEDDED
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 5a92fed2d1d5..4ec594ab1a98 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -696,4 +696,5 @@ ia32_sys_call_table:
696 .quad sys_sync_file_range 696 .quad sys_sync_file_range
697 .quad sys_tee 697 .quad sys_tee
698 .quad compat_sys_vmsplice 698 .quad compat_sys_vmsplice
699 .quad compat_sys_move_pages
699ia32_syscall_end: 700ia32_syscall_end:
diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile
index 4fe97071f297..080b9963f1bc 100644
--- a/arch/x86_64/kernel/acpi/Makefile
+++ b/arch/x86_64/kernel/acpi/Makefile
@@ -4,5 +4,6 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
4 4
5ifneq ($(CONFIG_ACPI_PROCESSOR),) 5ifneq ($(CONFIG_ACPI_PROCESSOR),)
6obj-y += processor.o 6obj-y += processor.o
7processor-y := ../../../i386/kernel/acpi/processor.o ../../../i386/kernel/acpi/cstate.o
7endif 8endif
8 9
diff --git a/arch/x86_64/kernel/acpi/processor.c b/arch/x86_64/kernel/acpi/processor.c
deleted file mode 100644
index 3bdc2baa5bb1..000000000000
--- a/arch/x86_64/kernel/acpi/processor.c
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * arch/x86_64/kernel/acpi/processor.c
3 *
4 * Copyright (C) 2005 Intel Corporation
5 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
6 * - Added _PDC for platforms with Intel CPUs
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/acpi.h>
13
14#include <acpi/processor.h>
15#include <asm/acpi.h>
16
17static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
18{
19 struct acpi_object_list *obj_list;
20 union acpi_object *obj;
21 u32 *buf;
22
23 /* allocate and initialize pdc. It will be used later. */
24 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
25 if (!obj_list) {
26 printk(KERN_ERR "Memory allocation error\n");
27 return;
28 }
29
30 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
31 if (!obj) {
32 printk(KERN_ERR "Memory allocation error\n");
33 kfree(obj_list);
34 return;
35 }
36
37 buf = kmalloc(12, GFP_KERNEL);
38 if (!buf) {
39 printk(KERN_ERR "Memory allocation error\n");
40 kfree(obj);
41 kfree(obj_list);
42 return;
43 }
44
45 buf[0] = ACPI_PDC_REVISION_ID;
46 buf[1] = 1;
47 buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
48
49 obj->type = ACPI_TYPE_BUFFER;
50 obj->buffer.length = 12;
51 obj->buffer.pointer = (u8 *) buf;
52 obj_list->count = 1;
53 obj_list->pointer = obj;
54 pr->pdc = obj_list;
55
56 return;
57}
58
59/* Initialize _PDC data based on the CPU vendor */
60void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
61{
62 unsigned int cpu = pr->id;
63 struct cpuinfo_x86 *c = cpu_data + cpu;
64
65 pr->pdc = NULL;
66 if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST))
67 init_intel_pdc(pr, c);
68
69 return;
70}
71
72EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c
index 867a0ebee177..091bc79c888f 100644
--- a/arch/x86_64/kernel/acpi/sleep.c
+++ b/arch/x86_64/kernel/acpi/sleep.c
@@ -35,6 +35,8 @@
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/bootmem.h> 36#include <linux/bootmem.h>
37#include <linux/acpi.h> 37#include <linux/acpi.h>
38#include <linux/cpumask.h>
39
38#include <asm/mpspec.h> 40#include <asm/mpspec.h>
39#include <asm/io.h> 41#include <asm/io.h>
40#include <asm/apic.h> 42#include <asm/apic.h>
@@ -66,7 +68,8 @@ static void init_low_mapping(void)
66 pgd_t *slot0 = pgd_offset(current->mm, 0UL); 68 pgd_t *slot0 = pgd_offset(current->mm, 0UL);
67 low_ptr = *slot0; 69 low_ptr = *slot0;
68 set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET)); 70 set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET));
69 flush_tlb_all(); 71 WARN_ON(num_online_cpus() != 1);
72 local_flush_tlb();
70} 73}
71 74
72/** 75/**
@@ -92,7 +95,7 @@ int acpi_save_state_mem(void)
92void acpi_restore_state_mem(void) 95void acpi_restore_state_mem(void)
93{ 96{
94 set_pgd(pgd_offset(current->mm, 0UL), low_ptr); 97 set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
95 flush_tlb_all(); 98 local_flush_tlb();
96} 99}
97 100
98/** 101/**
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 100a30c40044..29ef99001e05 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -51,7 +51,7 @@ int disable_apic_timer __initdata;
51static cpumask_t timer_interrupt_broadcast_ipi_mask; 51static cpumask_t timer_interrupt_broadcast_ipi_mask;
52 52
53/* Using APIC to generate smp_local_timer_interrupt? */ 53/* Using APIC to generate smp_local_timer_interrupt? */
54int using_apic_timer = 0; 54int using_apic_timer __read_mostly = 0;
55 55
56static void apic_pm_activate(void); 56static void apic_pm_activate(void);
57 57
diff --git a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c
index a5d7e16b928e..44ddb1ec808d 100644
--- a/arch/x86_64/kernel/i387.c
+++ b/arch/x86_64/kernel/i387.c
@@ -24,7 +24,7 @@
24#include <asm/ptrace.h> 24#include <asm/ptrace.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26 26
27unsigned int mxcsr_feature_mask = 0xffffffff; 27unsigned int mxcsr_feature_mask __read_mostly = 0xffffffff;
28 28
29void mxcsr_feature_mask_init(void) 29void mxcsr_feature_mask_init(void)
30{ 30{
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 655b9192eeb3..b8d5116d7371 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -47,6 +47,7 @@
47#include <linux/dmi.h> 47#include <linux/dmi.h>
48#include <linux/dma-mapping.h> 48#include <linux/dma-mapping.h>
49#include <linux/ctype.h> 49#include <linux/ctype.h>
50#include <linux/suspend.h>
50 51
51#include <asm/mtrr.h> 52#include <asm/mtrr.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
@@ -595,6 +596,100 @@ static void discover_ebda(void)
595 ebda_size = 64*1024; 596 ebda_size = 64*1024;
596} 597}
597 598
599#ifdef CONFIG_SOFTWARE_SUSPEND
600static void __init mark_nosave_page_range(unsigned long start, unsigned long end)
601{
602 struct page *page;
603 while (start <= end) {
604 page = pfn_to_page(start);
605 SetPageNosave(page);
606 start++;
607 }
608}
609
610static void __init e820_nosave_reserved_pages(void)
611{
612 int i;
613 unsigned long r_start = 0, r_end = 0;
614
615 /* Assume e820 map is sorted */
616 for (i = 0; i < e820.nr_map; i++) {
617 struct e820entry *ei = &e820.map[i];
618 unsigned long start, end;
619
620 start = round_down(ei->addr, PAGE_SIZE);
621 end = round_up(ei->addr + ei->size, PAGE_SIZE);
622 if (start >= end)
623 continue;
624 if (ei->type == E820_RESERVED)
625 continue;
626 r_end = start>>PAGE_SHIFT;
627 /* swsusp ignores invalid pfn, ignore these pages here */
628 if (r_end > end_pfn)
629 r_end = end_pfn;
630 if (r_end > r_start)
631 mark_nosave_page_range(r_start, r_end-1);
632 if (r_end >= end_pfn)
633 break;
634 r_start = end>>PAGE_SHIFT;
635 }
636}
637
638static void __init e820_save_acpi_pages(void)
639{
640 int i;
641
642 /* Assume e820 map is sorted */
643 for (i = 0; i < e820.nr_map; i++) {
644 struct e820entry *ei = &e820.map[i];
645 unsigned long start, end;
646
647 start = ei->addr, PAGE_SIZE;
648 end = ei->addr + ei->size;
649 if (start >= end)
650 continue;
651 if (ei->type != E820_ACPI && ei->type != E820_NVS)
652 continue;
653 /*
654 * If the region is below end_pfn, it will be
655 * saved/restored by swsusp follow 'RAM' type.
656 */
657 if (start < (end_pfn << PAGE_SHIFT))
658 start = end_pfn << PAGE_SHIFT;
659 if (end > start)
660 swsusp_add_arch_pages(start, end);
661 }
662}
663
664extern char __start_rodata, __end_rodata;
665/*
666 * BIOS reserved region/hole - no save/restore
667 * ACPI NVS - save/restore
668 * ACPI Data - this is a little tricky, the mem could be used by OS after OS
669 * reads tables from the region, but anyway save/restore the memory hasn't any
670 * side effect and Linux runtime module load/unload might use it.
671 * kernel rodata - no save/restore (kernel rodata isn't changed)
672 */
673static int __init mark_nosave_pages(void)
674{
675 unsigned long pfn_start, pfn_end;
676
677 /* BIOS reserved regions & holes */
678 e820_nosave_reserved_pages();
679
680 /* kernel rodata */
681 pfn_start = round_up(__pa_symbol(&__start_rodata), PAGE_SIZE) >> PAGE_SHIFT;
682 pfn_end = round_down(__pa_symbol(&__end_rodata), PAGE_SIZE) >> PAGE_SHIFT;
683 mark_nosave_page_range(pfn_start, pfn_end-1);
684
685 /* record ACPI Data/NVS as saveable */
686 e820_save_acpi_pages();
687
688 return 0;
689}
690core_initcall(mark_nosave_pages);
691#endif
692
598void __init setup_arch(char **cmdline_p) 693void __init setup_arch(char **cmdline_p)
599{ 694{
600 unsigned long kernel_end; 695 unsigned long kernel_end;
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 474df22c6ed2..502fce65e96a 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -30,7 +30,6 @@
30static struct acpi_table_slit *acpi_slit; 30static struct acpi_table_slit *acpi_slit;
31 31
32static nodemask_t nodes_parsed __initdata; 32static nodemask_t nodes_parsed __initdata;
33static nodemask_t nodes_found __initdata;
34static struct bootnode nodes[MAX_NUMNODES] __initdata; 33static struct bootnode nodes[MAX_NUMNODES] __initdata;
35static struct bootnode nodes_add[MAX_NUMNODES] __initdata; 34static struct bootnode nodes_add[MAX_NUMNODES] __initdata;
36static int found_add_area __initdata; 35static int found_add_area __initdata;
@@ -38,33 +37,14 @@ int hotadd_percent __initdata = 0;
38#ifndef RESERVE_HOTADD 37#ifndef RESERVE_HOTADD
39#define hotadd_percent 0 /* Ignore all settings */ 38#define hotadd_percent 0 /* Ignore all settings */
40#endif 39#endif
41static u8 pxm2node[256] = { [0 ... 255] = 0xff };
42 40
43/* Too small nodes confuse the VM badly. Usually they result 41/* Too small nodes confuse the VM badly. Usually they result
44 from BIOS bugs. */ 42 from BIOS bugs. */
45#define NODE_MIN_SIZE (4*1024*1024) 43#define NODE_MIN_SIZE (4*1024*1024)
46 44
47static int node_to_pxm(int n);
48
49int pxm_to_node(int pxm)
50{
51 if ((unsigned)pxm >= 256)
52 return -1;
53 /* Extend 0xff to (int)-1 */
54 return (signed char)pxm2node[pxm];
55}
56
57static __init int setup_node(int pxm) 45static __init int setup_node(int pxm)
58{ 46{
59 unsigned node = pxm2node[pxm]; 47 return acpi_map_pxm_to_node(pxm);
60 if (node == 0xff) {
61 if (nodes_weight(nodes_found) >= MAX_NUMNODES)
62 return -1;
63 node = first_unset_node(nodes_found);
64 node_set(node, nodes_found);
65 pxm2node[pxm] = node;
66 }
67 return pxm2node[pxm];
68} 48}
69 49
70static __init int conflicting_nodes(unsigned long start, unsigned long end) 50static __init int conflicting_nodes(unsigned long start, unsigned long end)
@@ -440,17 +420,6 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
440 return 0; 420 return 0;
441} 421}
442 422
443static int node_to_pxm(int n)
444{
445 int i;
446 if (pxm2node[n] == n)
447 return n;
448 for (i = 0; i < 256; i++)
449 if (pxm2node[i] == n)
450 return i;
451 return 0;
452}
453
454void __init srat_reserve_add_area(int nodeid) 423void __init srat_reserve_add_area(int nodeid)
455{ 424{
456 if (found_add_area && nodes_add[nodeid].end) { 425 if (found_add_area && nodes_add[nodeid].end) {
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index a2060e4d5de6..3c55c76c6fd5 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -13,7 +13,10 @@
13 13
14#include "pci.h" 14#include "pci.h"
15 15
16#define MMCONFIG_APER_SIZE (256*1024*1024) 16/* aperture is up to 256MB but BIOS may reserve less */
17#define MMCONFIG_APER_MIN (2 * 1024*1024)
18#define MMCONFIG_APER_MAX (256 * 1024*1024)
19
17/* Verify the first 16 busses. We assume that systems with more busses 20/* Verify the first 16 busses. We assume that systems with more busses
18 get MCFG right. */ 21 get MCFG right. */
19#define MAX_CHECK_BUS 16 22#define MAX_CHECK_BUS 16
@@ -175,9 +178,10 @@ void __init pci_mmcfg_init(void)
175 return; 178 return;
176 179
177 if (!e820_all_mapped(pci_mmcfg_config[0].base_address, 180 if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
178 pci_mmcfg_config[0].base_address + MMCONFIG_APER_SIZE, 181 pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN,
179 E820_RESERVED)) { 182 E820_RESERVED)) {
180 printk(KERN_ERR "PCI: BIOS Bug: MCFG area is not E820-reserved\n"); 183 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n",
184 pci_mmcfg_config[0].base_address);
181 printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); 185 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
182 return; 186 return;
183 } 187 }
@@ -190,7 +194,8 @@ void __init pci_mmcfg_init(void)
190 } 194 }
191 for (i = 0; i < pci_mmcfg_config_num; ++i) { 195 for (i = 0; i < pci_mmcfg_config_num; ++i) {
192 pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i]; 196 pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i];
193 pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address, MMCONFIG_APER_SIZE); 197 pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address,
198 MMCONFIG_APER_MAX);
194 if (!pci_mmcfg_virt[i].virt) { 199 if (!pci_mmcfg_virt[i].virt) {
195 printk("PCI: Cannot map mmconfig aperture for segment %d\n", 200 printk("PCI: Cannot map mmconfig aperture for segment %d\n",
196 pci_mmcfg_config[i].pci_segment_group_number); 201 pci_mmcfg_config[i].pci_segment_group_number);
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index dbeb3504c3c8..848f173db257 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -34,10 +34,6 @@ config GENERIC_HARDIRQS
34 bool 34 bool
35 default y 35 default y
36 36
37config RWSEM_GENERIC_SPINLOCK
38 bool
39 default y
40
41source "init/Kconfig" 37source "init/Kconfig"
42 38
43menu "Processor type and features" 39menu "Processor type and features"
diff --git a/arch/xtensa/boot/lib/Makefile b/arch/xtensa/boot/lib/Makefile
index 9e73bb8aeb7a..d3d2aa2d883a 100644
--- a/arch/xtensa/boot/lib/Makefile
+++ b/arch/xtensa/boot/lib/Makefile
@@ -2,7 +2,7 @@
2# Makefile for some libs needed by zImage. 2# Makefile for some libs needed by zImage.
3# 3#
4 4
5zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c 5zlib := inffast.c inflate.c inftrees.c
6 6
7lib-y += $(zlib:.c=.o) zmem.o 7lib-y += $(zlib:.c=.o) zmem.o
8 8
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 5c018c503dfa..89e409e9e0de 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -1102,7 +1102,7 @@ ENTRY(fast_syscall_sysxtensa)
1102 s32i a7, a2, PT_AREG7 1102 s32i a7, a2, PT_AREG7
1103 1103
1104 movi a7, 4 # sizeof(unsigned int) 1104 movi a7, 4 # sizeof(unsigned int)
1105 verify_area a3, a7, a0, a2, .Leac 1105 access_ok a0, a3, a7, a2, .Leac
1106 1106
1107 _beqi a6, SYSXTENSA_ATOMIC_SET, .Lset 1107 _beqi a6, SYSXTENSA_ATOMIC_SET, .Lset
1108 _beqi a6, SYSXTENSA_ATOMIC_EXG_ADD, .Lexg 1108 _beqi a6, SYSXTENSA_ATOMIC_EXG_ADD, .Lexg
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index e252b61e45a5..c494f0826fc5 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -104,7 +104,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
104 104
105 if (act) { 105 if (act) {
106 old_sigset_t mask; 106 old_sigset_t mask;
107 if (verify_area(VERIFY_READ, act, sizeof(*act)) || 107 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
108 __get_user(new_ka.sa.sa_handler, &act->sa_handler) || 108 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
109 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) 109 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
110 return -EFAULT; 110 return -EFAULT;
@@ -116,7 +116,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
116 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 116 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
117 117
118 if (!ret && oact) { 118 if (!ret && oact) {
119 if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || 119 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
120 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || 120 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
121 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) 121 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
122 return -EFAULT; 122 return -EFAULT;
@@ -236,7 +236,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
236 err |= __copy_from_user (regs->areg, sc->sc_areg, XCHAL_NUM_AREGS*4); 236 err |= __copy_from_user (regs->areg, sc->sc_areg, XCHAL_NUM_AREGS*4);
237 err |= __get_user(buf, &sc->sc_cpstate); 237 err |= __get_user(buf, &sc->sc_cpstate);
238 if (buf) { 238 if (buf) {
239 if (verify_area(VERIFY_READ, buf, sizeof(*buf))) 239 if (!access_ok(VERIFY_READ, buf, sizeof(*buf)))
240 goto badframe; 240 goto badframe;
241 err |= restore_cpextra(buf); 241 err |= restore_cpextra(buf);
242 } 242 }
@@ -357,7 +357,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
357 if (regs->depc > 64) 357 if (regs->depc > 64)
358 panic ("Double exception sys_sigreturn\n"); 358 panic ("Double exception sys_sigreturn\n");
359 359
360 if (verify_area(VERIFY_READ, frame, sizeof(*frame))) 360 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
361 goto badframe; 361 goto badframe;
362 362
363 if (__get_user(set.sig[0], &frame->sc.oldmask) 363 if (__get_user(set.sig[0], &frame->sc.oldmask)
@@ -394,7 +394,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
394 return 0; 394 return 0;
395 } 395 }
396 396
397 if (verify_area(VERIFY_READ, frame, sizeof(*frame))) 397 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
398 goto badframe; 398 goto badframe;
399 399
400 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 400 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
@@ -433,7 +433,7 @@ badframe:
433static inline void * 433static inline void *
434get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) 434get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
435{ 435{
436 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) 436 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
437 sp = current->sas_ss_sp + current->sas_ss_size; 437 sp = current->sas_ss_sp + current->sas_ss_size;
438 438
439 return (void *)((sp - frame_size) & -16ul); 439 return (void *)((sp - frame_size) & -16ul);