aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-09-14 08:12:20 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-14 08:12:20 -0400
commit165415f700b0c77fa1f8db6198f48582639adf78 (patch)
tree088e305b0b5b0c6753072e13be1177824c3ed59d /arch
parentc324b44c34050cf2a9b58830e11c974806bd85d8 (diff)
parent2f4ba45a75d6383b4a1201169a808ffea416ffa0 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Makefile11
-rw-r--r--arch/alpha/kernel/alpha_ksyms.c9
-rw-r--r--arch/alpha/kernel/entry.S2
-rw-r--r--arch/alpha/kernel/head.S2
-rw-r--r--arch/alpha/kernel/module.c8
-rw-r--r--arch/alpha/kernel/osf_sys.c7
-rw-r--r--arch/alpha/kernel/smp.c172
-rw-r--r--arch/alpha/kernel/sys_marvel.c5
-rw-r--r--arch/alpha/lib/dbg_stackcheck.S2
-rw-r--r--arch/alpha/lib/dbg_stackkill.S2
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm/Kconfig.debug2
-rw-r--r--arch/arm/Makefile11
-rw-r--r--arch/arm/common/locomo.c101
-rw-r--r--arch/arm/common/scoop.c2
-rw-r--r--arch/arm/configs/s3c2410_defconfig218
-rw-r--r--arch/arm/kernel/calls.S5
-rw-r--r--arch/arm/kernel/entry-common.S4
-rw-r--r--arch/arm/kernel/entry-header.S2
-rw-r--r--arch/arm/kernel/head.S2
-rw-r--r--arch/arm/kernel/iwmmxt.S2
-rw-r--r--arch/arm/lib/copy_page.S2
-rw-r--r--arch/arm/lib/csumpartialcopyuser.S2
-rw-r--r--arch/arm/lib/getuser.S2
-rw-r--r--arch/arm/lib/putuser.S2
-rw-r--r--arch/arm/mach-clps7500/core.c2
-rw-r--r--arch/arm/mach-ebsa110/core.c2
-rw-r--r--arch/arm/mach-epxa10db/arch.c2
-rw-r--r--arch/arm/mach-footbridge/isa.c2
-rw-r--r--arch/arm/mach-h720x/cpu-h7202.c2
-rw-r--r--arch/arm/mach-ixp2000/core.c2
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c2
-rw-r--r--arch/arm/mach-omap1/Kconfig8
-rw-r--r--arch/arm/mach-omap1/Makefile3
-rw-r--r--arch/arm/mach-omap1/board-generic.c38
-rw-r--r--arch/arm/mach-omap1/board-h2.c27
-rw-r--r--arch/arm/mach-omap1/board-h3.c17
-rw-r--r--arch/arm/mach-omap1/board-innovator.c13
-rw-r--r--arch/arm/mach-omap1/board-netstar.c9
-rw-r--r--arch/arm/mach-omap1/board-osk.c124
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c5
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c64
-rw-r--r--arch/arm/mach-omap1/devices.c351
-rw-r--r--arch/arm/mach-omap1/fpga.c4
-rw-r--r--arch/arm/mach-omap1/io.c30
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c3
-rw-r--r--arch/arm/mach-omap1/leds-innovator.c2
-rw-r--r--arch/arm/mach-omap1/leds-osk.c8
-rw-r--r--arch/arm/mach-omap1/leds.c12
-rw-r--r--arch/arm/mach-omap1/serial.c86
-rw-r--r--arch/arm/mach-omap1/time.c40
-rw-r--r--arch/arm/mach-pxa/corgi.c28
-rw-r--r--arch/arm/mach-pxa/corgi_ssp.c2
-rw-r--r--arch/arm/mach-rpc/riscpc.c2
-rw-r--r--arch/arm/mach-s3c2410/devs.c11
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c51
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c2
-rw-r--r--arch/arm/mach-shark/core.c2
-rw-r--r--arch/arm/mm/copypage-v3.S2
-rw-r--r--arch/arm/mm/copypage-v4wb.S2
-rw-r--r--arch/arm/mm/copypage-v4wt.S2
-rw-r--r--arch/arm/mm/flush.c52
-rw-r--r--arch/arm/mm/proc-arm1020.S2
-rw-r--r--arch/arm/mm/proc-arm1020e.S2
-rw-r--r--arch/arm/mm/proc-arm1022.S2
-rw-r--r--arch/arm/mm/proc-arm1026.S2
-rw-r--r--arch/arm/mm/proc-arm6_7.S2
-rw-r--r--arch/arm/mm/proc-arm720.S2
-rw-r--r--arch/arm/mm/proc-macros.S2
-rw-r--r--arch/arm/mm/proc-sa110.S2
-rw-r--r--arch/arm/mm/proc-sa1100.S2
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/arm/mm/tlb-v3.S2
-rw-r--r--arch/arm/mm/tlb-v4.S2
-rw-r--r--arch/arm/mm/tlb-v4wb.S2
-rw-r--r--arch/arm/mm/tlb-v4wbi.S2
-rw-r--r--arch/arm/mm/tlb-v6.S2
-rw-r--r--arch/arm/nwfpe/entry26.S2
-rw-r--r--arch/arm/vfp/entry.S2
-rw-r--r--arch/arm26/Makefile10
-rw-r--r--arch/arm26/kernel/entry.S2
-rw-r--r--arch/arm26/lib/copy_page.S2
-rw-r--r--arch/arm26/lib/csumpartialcopyuser.S2
-rw-r--r--arch/arm26/lib/getuser.S2
-rw-r--r--arch/arm26/lib/putuser.S2
-rw-r--r--arch/arm26/mm/proc-funcs.S2
-rw-r--r--arch/arm26/nwfpe/entry.S2
-rw-r--r--arch/cris/Makefile10
-rw-r--r--arch/cris/arch-v10/kernel/entry.S2
-rw-r--r--arch/cris/arch-v32/kernel/entry.S2
-rw-r--r--arch/frv/kernel/asm-offsets.c1
-rw-r--r--arch/h8300/Makefile8
-rw-r--r--arch/i386/Kconfig1
-rw-r--r--arch/i386/Makefile9
-rw-r--r--arch/i386/boot/video.S7
-rw-r--r--arch/i386/defconfig4
-rw-r--r--arch/i386/kernel/Makefile2
-rw-r--r--arch/i386/kernel/acpi/Makefile2
-rw-r--r--arch/i386/kernel/acpi/boot.c557
-rw-r--r--arch/i386/kernel/acpi/earlyquirk.c50
-rw-r--r--arch/i386/kernel/acpi/sleep.c35
-rw-r--r--arch/i386/kernel/acpi/wakeup.S6
-rw-r--r--arch/i386/kernel/cpu/common.c2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c57
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c4
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c20
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-smi.c2
-rw-r--r--arch/i386/kernel/entry.S4
-rw-r--r--arch/i386/kernel/head.S2
-rw-r--r--arch/i386/kernel/io_apic.c15
-rw-r--r--arch/i386/kernel/mpparse.c38
-rw-r--r--arch/i386/kernel/ptrace.c22
-rw-r--r--arch/i386/kernel/setup.c32
-rw-r--r--arch/i386/kernel/sigframe.h8
-rw-r--r--arch/i386/kernel/smpboot.c3
-rw-r--r--arch/i386/kernel/srat.c8
-rw-r--r--arch/i386/kernel/time.c3
-rw-r--r--arch/i386/kernel/vmlinux.lds.S11
-rw-r--r--arch/i386/kernel/vsyscall-sigreturn.S2
-rw-r--r--arch/i386/kernel/vsyscall.lds.S2
-rw-r--r--arch/i386/mach-es7000/es7000plat.c4
-rw-r--r--arch/i386/pci/Makefile2
-rw-r--r--arch/i386/pci/acpi.c17
-rw-r--r--arch/i386/pci/i386.c6
-rw-r--r--arch/i386/pci/irq.c2
-rw-r--r--arch/i386/pci/mmconfig.c7
-rw-r--r--arch/i386/power/swsusp.S2
-rw-r--r--arch/ia64/Kconfig36
-rw-r--r--arch/ia64/Makefile21
-rw-r--r--arch/ia64/configs/bigsur_defconfig6
-rw-r--r--arch/ia64/configs/sn2_defconfig8
-rw-r--r--arch/ia64/configs/tiger_defconfig8
-rw-r--r--arch/ia64/configs/zx1_defconfig8
-rw-r--r--arch/ia64/defconfig9
-rw-r--r--arch/ia64/hp/sim/boot/boot_head.S31
-rw-r--r--arch/ia64/ia32/ia32_entry.S2
-rw-r--r--arch/ia64/ia32/sys_ia32.c2
-rw-r--r--arch/ia64/kernel/acpi-ext.c37
-rw-r--r--arch/ia64/kernel/acpi.c328
-rw-r--r--arch/ia64/kernel/asm-offsets.c40
-rw-r--r--arch/ia64/kernel/entry.S31
-rw-r--r--arch/ia64/kernel/fsys.S2
-rw-r--r--arch/ia64/kernel/gate.S2
-rw-r--r--arch/ia64/kernel/head.S2
-rw-r--r--arch/ia64/kernel/iosapic.c24
-rw-r--r--arch/ia64/kernel/ivt.S3
-rw-r--r--arch/ia64/kernel/mca.c830
-rw-r--r--arch/ia64/kernel/mca_asm.S1358
-rw-r--r--arch/ia64/kernel/mca_drv.c37
-rw-r--r--arch/ia64/kernel/minstate.h88
-rw-r--r--arch/ia64/kernel/palinfo.c115
-rw-r--r--arch/ia64/kernel/perfmon.c9
-rw-r--r--arch/ia64/kernel/salinfo.c62
-rw-r--r--arch/ia64/kernel/setup.c4
-rw-r--r--arch/ia64/kernel/topology.c2
-rw-r--r--arch/ia64/kernel/unwind.c22
-rw-r--r--arch/ia64/lib/memcpy_mck.S3
-rw-r--r--arch/ia64/mm/fault.c6
-rw-r--r--arch/ia64/mm/init.c15
-rw-r--r--arch/ia64/pci/pci.c2
-rw-r--r--arch/ia64/sn/kernel/irq.c2
-rw-r--r--arch/ia64/sn/kernel/setup.c32
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c2
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c4
-rw-r--r--arch/ia64/sn/kernel/xpnet.c6
-rw-r--r--arch/m32r/Kconfig4
-rw-r--r--arch/m32r/kernel/asm-offsets.c1
-rw-r--r--arch/m32r/kernel/smp.c48
-rw-r--r--arch/m68k/Makefile9
-rw-r--r--arch/m68k/amiga/amisound.c2
-rw-r--r--arch/m68k/fpsp040/skeleton.S2
-rw-r--r--arch/m68k/ifpsp060/iskeleton.S2
-rw-r--r--arch/m68k/kernel/entry.S2
-rw-r--r--arch/m68k/kernel/head.S2
-rw-r--r--arch/m68k/mac/macboing.c3
-rw-r--r--arch/m68k/math-emu/fp_emu.h2
-rw-r--r--arch/m68knommu/Makefile10
-rw-r--r--arch/m68knommu/platform/523x/Makefile19
-rw-r--r--arch/m68knommu/platform/5272/config.c6
-rw-r--r--arch/m68knommu/platform/5307/Makefile1
-rw-r--r--arch/m68knommu/platform/68328/config.c94
-rw-r--r--arch/m68knommu/platform/68328/head-de2.S135
-rw-r--r--arch/m68knommu/platform/68328/timers.c106
-rw-r--r--arch/m68knommu/platform/68360/head-ram.S408
-rw-r--r--arch/m68knommu/platform/68360/head-rom.S420
-rw-r--r--arch/m68knommu/platform/68EZ328/config.c80
-rw-r--r--arch/m68knommu/platform/68VZ328/config.c (renamed from arch/m68knommu/platform/68VZ328/de2/config.c)141
-rw-r--r--arch/m68knommu/platform/68VZ328/ucdimm/config.c117
-rw-r--r--arch/mips/Kconfig7
-rw-r--r--arch/mips/Makefile35
-rw-r--r--arch/mips/configs/tb0287_defconfig1041
-rw-r--r--arch/mips/kernel/asm-offsets.c (renamed from arch/mips/kernel/offset.c)0
-rw-r--r--arch/mips/kernel/genrtc.c2
-rw-r--r--arch/mips/kernel/i8259.c2
-rw-r--r--arch/mips/kernel/irixioctl.c5
-rw-r--r--arch/mips/kernel/irixsig.c17
-rw-r--r--arch/mips/kernel/r2300_fpu.S2
-rw-r--r--arch/mips/kernel/r2300_switch.S2
-rw-r--r--arch/mips/kernel/r4k_fpu.S2
-rw-r--r--arch/mips/kernel/r4k_switch.S2
-rw-r--r--arch/mips/kernel/r6000_fpu.S2
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/syscall.c2
-rw-r--r--arch/mips/kernel/sysirix.c3
-rw-r--r--arch/mips/lib-32/memset.S2
-rw-r--r--arch/mips/lib-64/memset.S2
-rw-r--r--arch/mips/lib/dec_and_lock.c8
-rw-r--r--arch/mips/lib/memcpy.S2
-rw-r--r--arch/mips/lib/strlen_user.S2
-rw-r--r--arch/mips/lib/strncpy_user.S2
-rw-r--r--arch/mips/lib/strnlen_user.S2
-rw-r--r--arch/mips/pci/Makefile1
-rw-r--r--arch/mips/pci/fixup-tb0287.c65
-rw-r--r--arch/parisc/Makefile10
-rw-r--r--arch/parisc/hpux/gate.S2
-rw-r--r--arch/parisc/hpux/wrappers.S2
-rw-r--r--arch/parisc/kernel/entry.S2
-rw-r--r--arch/parisc/kernel/head.S2
-rw-r--r--arch/parisc/kernel/process.c2
-rw-r--r--arch/parisc/kernel/ptrace.c2
-rw-r--r--arch/parisc/kernel/signal.c2
-rw-r--r--arch/parisc/kernel/syscall.S2
-rw-r--r--arch/parisc/lib/Makefile2
-rw-r--r--arch/parisc/lib/bitops.c4
-rw-r--r--arch/parisc/lib/debuglocks.c277
-rw-r--r--arch/parisc/lib/fixup.S2
-rw-r--r--arch/ppc/8xx_io/cs4218_tdm.c2
-rw-r--r--arch/ppc/Kconfig19
-rw-r--r--arch/ppc/Makefile28
-rw-r--r--arch/ppc/boot/common/ns16550.c8
-rw-r--r--arch/ppc/boot/common/util.S2
-rw-r--r--arch/ppc/kernel/Makefile3
-rw-r--r--arch/ppc/kernel/cpu_setup_6xx.S3
-rw-r--r--arch/ppc/kernel/cpu_setup_power4.S3
-rw-r--r--arch/ppc/kernel/dma-mapping.c2
-rw-r--r--arch/ppc/kernel/entry.S2
-rw-r--r--arch/ppc/kernel/fpu.S2
-rw-r--r--arch/ppc/kernel/head.S30
-rw-r--r--arch/ppc/kernel/head_44x.S2
-rw-r--r--arch/ppc/kernel/head_4xx.S3
-rw-r--r--arch/ppc/kernel/head_8xx.S2
-rw-r--r--arch/ppc/kernel/head_fsl_booke.S2
-rw-r--r--arch/ppc/kernel/idle.c6
-rw-r--r--arch/ppc/kernel/idle_6xx.S2
-rw-r--r--arch/ppc/kernel/idle_power4.S2
-rw-r--r--arch/ppc/kernel/misc.S2
-rw-r--r--arch/ppc/kernel/pci.c1
-rw-r--r--arch/ppc/kernel/smp.c44
-rw-r--r--arch/ppc/kernel/swsusp.S2
-rw-r--r--arch/ppc/kernel/syscalls.c4
-rw-r--r--arch/ppc/kernel/traps.c24
-rw-r--r--arch/ppc/lib/Makefile1
-rw-r--r--arch/ppc/lib/dec_and_lock.c8
-rw-r--r--arch/ppc/mm/fault.c6
-rw-r--r--arch/ppc/mm/hashtable.S2
-rw-r--r--arch/ppc/platforms/4xx/ebony.c13
-rw-r--r--arch/ppc/platforms/hdpu.c2
-rw-r--r--arch/ppc/platforms/pmac_sleep.S4
-rw-r--r--arch/ppc/platforms/pmac_smp.c85
-rw-r--r--arch/ppc/syslib/cpc700_pic.c12
-rw-r--r--arch/ppc/syslib/i8259.c13
-rw-r--r--arch/ppc/syslib/ibm440gx_common.c7
-rw-r--r--arch/ppc/syslib/mpc10x_common.c4
-rw-r--r--arch/ppc/syslib/mpc83xx_devices.c2
-rw-r--r--arch/ppc/syslib/mpc85xx_devices.c2
-rw-r--r--arch/ppc/syslib/mv64x60.c2
-rw-r--r--arch/ppc/syslib/open_pic2.c12
-rw-r--r--arch/ppc/syslib/ppc403_pic.c11
-rw-r--r--arch/ppc/syslib/qspan_pci.c2
-rw-r--r--arch/ppc/syslib/xilinx_pic.c13
-rw-r--r--arch/ppc64/Makefile43
-rw-r--r--arch/ppc64/boot/Makefile53
-rw-r--r--arch/ppc64/boot/main.c31
-rw-r--r--arch/ppc64/kernel/bpa_iic.c28
-rw-r--r--arch/ppc64/kernel/cpu_setup_power4.S3
-rw-r--r--arch/ppc64/kernel/eeh.c86
-rw-r--r--arch/ppc64/kernel/entry.S2
-rw-r--r--arch/ppc64/kernel/head.S2
-rw-r--r--arch/ppc64/kernel/iSeries_VpdInfo.c5
-rw-r--r--arch/ppc64/kernel/iSeries_pci.c2
-rw-r--r--arch/ppc64/kernel/idle_power4.S2
-rw-r--r--arch/ppc64/kernel/iomap.c32
-rw-r--r--arch/ppc64/kernel/iommu.c3
-rw-r--r--arch/ppc64/kernel/maple_pci.c60
-rw-r--r--arch/ppc64/kernel/misc.S8
-rw-r--r--arch/ppc64/kernel/pSeries_iommu.c72
-rw-r--r--arch/ppc64/kernel/pSeries_setup.c8
-rw-r--r--arch/ppc64/kernel/pSeries_smp.c13
-rw-r--r--arch/ppc64/kernel/pci.c480
-rw-r--r--arch/ppc64/kernel/pci.h1
-rw-r--r--arch/ppc64/kernel/pci_dn.c47
-rw-r--r--arch/ppc64/kernel/pci_iommu.c2
-rw-r--r--arch/ppc64/kernel/pmac_feature.c8
-rw-r--r--arch/ppc64/kernel/pmac_pci.c66
-rw-r--r--arch/ppc64/kernel/pmac_setup.c13
-rw-r--r--arch/ppc64/kernel/pmc.c2
-rw-r--r--arch/ppc64/kernel/process.c34
-rw-r--r--arch/ppc64/kernel/prom.c1
-rw-r--r--arch/ppc64/kernel/ptrace.c28
-rw-r--r--arch/ppc64/kernel/ptrace32.c34
-rw-r--r--arch/ppc64/kernel/ras.c2
-rw-r--r--arch/ppc64/kernel/rtas_pci.c39
-rw-r--r--arch/ppc64/kernel/setup.c18
-rw-r--r--arch/ppc64/kernel/signal.c9
-rw-r--r--arch/ppc64/kernel/signal32.c8
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c55
-rw-r--r--arch/ppc64/kernel/syscalls.c4
-rw-r--r--arch/ppc64/kernel/u3_iommu.c4
-rw-r--r--arch/ppc64/kernel/udbg.c6
-rw-r--r--arch/ppc64/kernel/vdso32/cacheflush.S2
-rw-r--r--arch/ppc64/kernel/vdso32/datapage.S2
-rw-r--r--arch/ppc64/kernel/vdso32/gettimeofday.S2
-rw-r--r--arch/ppc64/kernel/vdso64/cacheflush.S2
-rw-r--r--arch/ppc64/kernel/vdso64/datapage.S2
-rw-r--r--arch/ppc64/kernel/vdso64/gettimeofday.S2
-rw-r--r--arch/ppc64/kernel/xics.c44
-rw-r--r--arch/ppc64/lib/dec_and_lock.c8
-rw-r--r--arch/ppc64/lib/locks.c14
-rw-r--r--arch/ppc64/mm/fault.c31
-rw-r--r--arch/ppc64/mm/hash_low.S2
-rw-r--r--arch/ppc64/mm/init.c4
-rw-r--r--arch/ppc64/mm/slb_low.S2
-rw-r--r--arch/ppc64/xmon/privinst.h1
-rw-r--r--arch/ppc64/xmon/xmon.c20
-rw-r--r--arch/s390/Makefile12
-rw-r--r--arch/s390/kernel/compat_linux.c2
-rw-r--r--arch/s390/kernel/entry.S2
-rw-r--r--arch/s390/kernel/entry64.S2
-rw-r--r--arch/s390/kernel/head.S2
-rw-r--r--arch/s390/kernel/head64.S2
-rw-r--r--arch/s390/lib/spinlock.c12
-rw-r--r--arch/s390/lib/uaccess.S2
-rw-r--r--arch/s390/lib/uaccess64.S2
-rw-r--r--arch/sh/Makefile13
-rw-r--r--arch/sh/boards/adx/irq_maskreg.c14
-rw-r--r--arch/sh/boards/bigsur/io.c8
-rw-r--r--arch/sh/boards/bigsur/irq.c28
-rw-r--r--arch/sh/boards/cqreek/irq.c14
-rw-r--r--arch/sh/boards/harp/irq.c14
-rw-r--r--arch/sh/boards/overdrive/irq.c14
-rw-r--r--arch/sh/boards/renesas/hs7751rvoip/irq.c14
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/irq.c14
-rw-r--r--arch/sh/boards/renesas/systemh/irq.c14
-rw-r--r--arch/sh/boards/superh/microdev/irq.c14
-rw-r--r--arch/sh/cchips/hd6446x/hd64465/io.c8
-rw-r--r--arch/sh/cchips/voyagergx/irq.c14
-rw-r--r--arch/sh/kernel/cpu/irq_imask.c14
-rw-r--r--arch/sh/kernel/cpu/irq_ipr.c28
-rw-r--r--arch/sh/kernel/cpu/sh4/irq_intc2.c14
-rw-r--r--arch/sh64/Makefile8
-rw-r--r--arch/sh64/kernel/irq_intc.c14
-rw-r--r--arch/sparc/Makefile12
-rw-r--r--arch/sparc/kernel/entry.S2
-rw-r--r--arch/sparc/kernel/module.c9
-rw-r--r--arch/sparc/kernel/sclow.S2
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c41
-rw-r--r--arch/sparc/lib/Makefile2
-rw-r--r--arch/sparc/lib/atomic32.c2
-rw-r--r--arch/sparc/lib/debuglocks.c202
-rw-r--r--arch/sparc/lib/mul.S2
-rw-r--r--arch/sparc/lib/rem.S2
-rw-r--r--arch/sparc/lib/sdiv.S2
-rw-r--r--arch/sparc/lib/udiv.S2
-rw-r--r--arch/sparc/lib/umul.S2
-rw-r--r--arch/sparc/lib/urem.S2
-rw-r--r--arch/sparc/mm/hypersparc.S2
-rw-r--r--arch/sparc/mm/swift.S2
-rw-r--r--arch/sparc/mm/tsunami.S2
-rw-r--r--arch/sparc/mm/viking.S2
-rw-r--r--arch/sparc64/kernel/asm-offsets.c1
-rw-r--r--arch/sparc64/kernel/pci.c127
-rw-r--r--arch/sparc64/kernel/pci_psycho.c34
-rw-r--r--arch/sparc64/kernel/pci_sabre.c36
-rw-r--r--arch/sparc64/kernel/pci_schizo.c48
-rw-r--r--arch/sparc64/kernel/process.c5
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c14
-rw-r--r--arch/sparc64/lib/Makefile3
-rw-r--r--arch/sparc64/lib/debuglocks.c366
-rw-r--r--arch/sparc64/lib/mb.S73
-rw-r--r--arch/sparc64/solaris/ioctl.c15
-rw-r--r--arch/sparc64/solaris/timod.c29
-rw-r--r--arch/um/Makefile25
-rw-r--r--arch/um/Makefile-x86_641
-rw-r--r--arch/um/include/mem.h12
-rw-r--r--arch/um/kernel/asm-offsets.c1
-rw-r--r--arch/um/kernel/dyn.lds.S37
-rw-r--r--arch/um/kernel/ksyms.c5
-rw-r--r--arch/um/kernel/physmem.c35
-rw-r--r--arch/um/kernel/skas/include/uaccess-skas.h14
-rw-r--r--arch/um/kernel/trap_kern.c6
-rw-r--r--arch/um/kernel/tt/include/uaccess-tt.h14
-rw-r--r--arch/um/kernel/uml.lds.S14
-rw-r--r--arch/um/scripts/Makefile.rules5
-rw-r--r--arch/v850/Makefile14
-rw-r--r--arch/v850/kernel/asm-offsets.c (renamed from arch/v850/kernel/asm-consts.c)0
-rw-r--r--arch/v850/kernel/entry.S2
-rw-r--r--arch/v850/kernel/irq.c14
-rw-r--r--arch/v850/kernel/setup.c14
-rw-r--r--arch/v850/kernel/sim.c14
-rw-r--r--arch/x86_64/Kconfig2
-rw-r--r--arch/x86_64/Makefile10
-rw-r--r--arch/x86_64/boot/Makefile2
-rw-r--r--arch/x86_64/boot/compressed/misc.c6
-rw-r--r--arch/x86_64/defconfig69
-rw-r--r--arch/x86_64/ia32/ia32_ioctl.c17
-rw-r--r--arch/x86_64/ia32/ia32entry.S53
-rw-r--r--arch/x86_64/ia32/sys_ia32.c2
-rw-r--r--arch/x86_64/ia32/vsyscall-syscall.S2
-rw-r--r--arch/x86_64/ia32/vsyscall-sysenter.S2
-rw-r--r--arch/x86_64/kernel/Makefile3
-rw-r--r--arch/x86_64/kernel/acpi/Makefile4
-rw-r--r--arch/x86_64/kernel/acpi/sleep.c18
-rw-r--r--arch/x86_64/kernel/aperture.c2
-rw-r--r--arch/x86_64/kernel/apic.c42
-rw-r--r--arch/x86_64/kernel/asm-offsets.c1
-rw-r--r--arch/x86_64/kernel/crash.c1
-rw-r--r--arch/x86_64/kernel/e820.c18
-rw-r--r--arch/x86_64/kernel/early_printk.c46
-rw-r--r--arch/x86_64/kernel/entry.S224
-rw-r--r--arch/x86_64/kernel/genapic.c22
-rw-r--r--arch/x86_64/kernel/genapic_cluster.c4
-rw-r--r--arch/x86_64/kernel/genapic_flat.c22
-rw-r--r--arch/x86_64/kernel/head.S2
-rw-r--r--arch/x86_64/kernel/i8259.c23
-rw-r--r--arch/x86_64/kernel/init_task.c2
-rw-r--r--arch/x86_64/kernel/io_apic.c42
-rw-r--r--arch/x86_64/kernel/irq.c1
-rw-r--r--arch/x86_64/kernel/mce.c42
-rw-r--r--arch/x86_64/kernel/mpparse.c19
-rw-r--r--arch/x86_64/kernel/msr.c279
-rw-r--r--arch/x86_64/kernel/nmi.c5
-rw-r--r--arch/x86_64/kernel/pci-gart.c8
-rw-r--r--arch/x86_64/kernel/process.c38
-rw-r--r--arch/x86_64/kernel/setup.c97
-rw-r--r--arch/x86_64/kernel/setup64.c3
-rw-r--r--arch/x86_64/kernel/smp.c129
-rw-r--r--arch/x86_64/kernel/smpboot.c66
-rw-r--r--arch/x86_64/kernel/suspend.c17
-rw-r--r--arch/x86_64/kernel/suspend_asm.S2
-rw-r--r--arch/x86_64/kernel/time.c2
-rw-r--r--arch/x86_64/kernel/traps.c57
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S19
-rw-r--r--arch/x86_64/kernel/vsyscall.c8
-rw-r--r--arch/x86_64/lib/copy_user.S2
-rw-r--r--arch/x86_64/lib/getuser.S2
-rw-r--r--arch/x86_64/lib/putuser.S2
-rw-r--r--arch/x86_64/mm/fault.c10
-rw-r--r--arch/x86_64/mm/init.c79
-rw-r--r--arch/x86_64/mm/k8topology.c13
-rw-r--r--arch/x86_64/mm/numa.c9
-rw-r--r--arch/x86_64/mm/srat.c68
-rw-r--r--arch/x86_64/pci/Makefile2
-rw-r--r--arch/x86_64/pci/Makefile-BUS2
-rw-r--r--arch/x86_64/pci/k8-bus.c10
-rw-r--r--arch/x86_64/pci/mmconfig.c7
-rw-r--r--arch/xtensa/Makefile10
-rw-r--r--arch/xtensa/kernel/align.S2
-rw-r--r--arch/xtensa/kernel/entry.S2
-rw-r--r--arch/xtensa/kernel/process.c2
-rw-r--r--arch/xtensa/kernel/vectors.S2
465 files changed, 8083 insertions, 5966 deletions
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index 22ebfb2be0e4..1b704ee54bf3 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -108,20 +108,9 @@ $(boot)/vmlinux.gz: vmlinux
108bootimage bootpfile bootpzfile: vmlinux 108bootimage bootpfile bootpzfile: vmlinux
109 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 109 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
110 110
111
112prepare: include/asm-$(ARCH)/asm_offsets.h
113
114arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
115 include/config/MARKER
116
117include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
118 $(call filechk,gen-asm-offsets)
119
120archclean: 111archclean:
121 $(Q)$(MAKE) $(clean)=$(boot) 112 $(Q)$(MAKE) $(clean)=$(boot)
122 113
123CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
124
125define archhelp 114define archhelp
126 echo '* boot - Compressed kernel image (arch/alpha/boot/vmlinux.gz)' 115 echo '* boot - Compressed kernel image (arch/alpha/boot/vmlinux.gz)'
127 echo ' bootimage - SRM bootable image (arch/alpha/boot/bootimage)' 116 echo ' bootimage - SRM bootable image (arch/alpha/boot/bootimage)'
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
index fc5ef90c4fc9..24ae9a366073 100644
--- a/arch/alpha/kernel/alpha_ksyms.c
+++ b/arch/alpha/kernel/alpha_ksyms.c
@@ -185,15 +185,6 @@ EXPORT_SYMBOL(smp_num_cpus);
185EXPORT_SYMBOL(smp_call_function); 185EXPORT_SYMBOL(smp_call_function);
186EXPORT_SYMBOL(smp_call_function_on_cpu); 186EXPORT_SYMBOL(smp_call_function_on_cpu);
187EXPORT_SYMBOL(_atomic_dec_and_lock); 187EXPORT_SYMBOL(_atomic_dec_and_lock);
188#ifdef CONFIG_DEBUG_SPINLOCK
189EXPORT_SYMBOL(_raw_spin_unlock);
190EXPORT_SYMBOL(debug_spin_lock);
191EXPORT_SYMBOL(debug_spin_trylock);
192#endif
193#ifdef CONFIG_DEBUG_RWLOCK
194EXPORT_SYMBOL(_raw_write_lock);
195EXPORT_SYMBOL(_raw_read_lock);
196#endif
197EXPORT_SYMBOL(cpu_present_mask); 188EXPORT_SYMBOL(cpu_present_mask);
198#endif /* CONFIG_SMP */ 189#endif /* CONFIG_SMP */
199 190
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index f0927ee53f29..76cc0cb5fc2e 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7#include <linux/config.h> 7#include <linux/config.h>
8#include <asm/asm_offsets.h> 8#include <asm/asm-offsets.h>
9#include <asm/thread_info.h> 9#include <asm/thread_info.h>
10#include <asm/pal.h> 10#include <asm/pal.h>
11#include <asm/errno.h> 11#include <asm/errno.h>
diff --git a/arch/alpha/kernel/head.S b/arch/alpha/kernel/head.S
index 4ca2e404708a..0905721fcbca 100644
--- a/arch/alpha/kernel/head.S
+++ b/arch/alpha/kernel/head.S
@@ -9,7 +9,7 @@
9 9
10#include <linux/config.h> 10#include <linux/config.h>
11#include <asm/system.h> 11#include <asm/system.h>
12#include <asm/asm_offsets.h> 12#include <asm/asm-offsets.h>
13 13
14.globl swapper_pg_dir 14.globl swapper_pg_dir
15.globl _stext 15.globl _stext
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
index fc271e316a38..aac6d4b22f7a 100644
--- a/arch/alpha/kernel/module.c
+++ b/arch/alpha/kernel/module.c
@@ -47,7 +47,7 @@ module_free(struct module *mod, void *module_region)
47 47
48struct got_entry { 48struct got_entry {
49 struct got_entry *next; 49 struct got_entry *next;
50 Elf64_Addr r_offset; 50 Elf64_Sxword r_addend;
51 int got_offset; 51 int got_offset;
52}; 52};
53 53
@@ -57,14 +57,14 @@ process_reloc_for_got(Elf64_Rela *rela,
57{ 57{
58 unsigned long r_sym = ELF64_R_SYM (rela->r_info); 58 unsigned long r_sym = ELF64_R_SYM (rela->r_info);
59 unsigned long r_type = ELF64_R_TYPE (rela->r_info); 59 unsigned long r_type = ELF64_R_TYPE (rela->r_info);
60 Elf64_Addr r_offset = rela->r_offset; 60 Elf64_Sxword r_addend = rela->r_addend;
61 struct got_entry *g; 61 struct got_entry *g;
62 62
63 if (r_type != R_ALPHA_LITERAL) 63 if (r_type != R_ALPHA_LITERAL)
64 return; 64 return;
65 65
66 for (g = chains + r_sym; g ; g = g->next) 66 for (g = chains + r_sym; g ; g = g->next)
67 if (g->r_offset == r_offset) { 67 if (g->r_addend == r_addend) {
68 if (g->got_offset == 0) { 68 if (g->got_offset == 0) {
69 g->got_offset = *poffset; 69 g->got_offset = *poffset;
70 *poffset += 8; 70 *poffset += 8;
@@ -74,7 +74,7 @@ process_reloc_for_got(Elf64_Rela *rela,
74 74
75 g = kmalloc (sizeof (*g), GFP_KERNEL); 75 g = kmalloc (sizeof (*g), GFP_KERNEL);
76 g->next = chains[r_sym].next; 76 g->next = chains[r_sym].next;
77 g->r_offset = r_offset; 77 g->r_addend = r_addend;
78 g->got_offset = *poffset; 78 g->got_offset = *poffset;
79 *poffset += 8; 79 *poffset += 8;
80 chains[r_sym].next = g; 80 chains[r_sym].next = g;
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 167fd89f8707..0636116210d2 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -974,6 +974,7 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
974 size_t size; 974 size_t size;
975 long timeout; 975 long timeout;
976 int ret = -EINVAL; 976 int ret = -EINVAL;
977 struct fdtable *fdt;
977 978
978 timeout = MAX_SCHEDULE_TIMEOUT; 979 timeout = MAX_SCHEDULE_TIMEOUT;
979 if (tvp) { 980 if (tvp) {
@@ -995,7 +996,8 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
995 } 996 }
996 } 997 }
997 998
998 if (n < 0 || n > current->files->max_fdset) 999 fdt = files_fdtable(current->files);
1000 if (n < 0 || n > fdt->max_fdset)
999 goto out_nofds; 1001 goto out_nofds;
1000 1002
1001 /* 1003 /*
@@ -1152,8 +1154,7 @@ osf_usleep_thread(struct timeval32 __user *sleep, struct timeval32 __user *remai
1152 1154
1153 ticks = timeval_to_jiffies(&tmp); 1155 ticks = timeval_to_jiffies(&tmp);
1154 1156
1155 current->state = TASK_INTERRUPTIBLE; 1157 ticks = schedule_timeout_interruptible(ticks);
1156 ticks = schedule_timeout(ticks);
1157 1158
1158 if (remain) { 1159 if (remain) {
1159 jiffies_to_timeval(ticks, &tmp); 1160 jiffies_to_timeval(ticks, &tmp);
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index e211aa7404e6..da0be3465791 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -989,175 +989,3 @@ flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
989 989
990 preempt_enable(); 990 preempt_enable();
991} 991}
992
993#ifdef CONFIG_DEBUG_SPINLOCK
994void
995_raw_spin_unlock(spinlock_t * lock)
996{
997 mb();
998 lock->lock = 0;
999
1000 lock->on_cpu = -1;
1001 lock->previous = NULL;
1002 lock->task = NULL;
1003 lock->base_file = "none";
1004 lock->line_no = 0;
1005}
1006
1007void
1008debug_spin_lock(spinlock_t * lock, const char *base_file, int line_no)
1009{
1010 long tmp;
1011 long stuck;
1012 void *inline_pc = __builtin_return_address(0);
1013 unsigned long started = jiffies;
1014 int printed = 0;
1015 int cpu = smp_processor_id();
1016
1017 stuck = 1L << 30;
1018 try_again:
1019
1020 /* Use sub-sections to put the actual loop at the end
1021 of this object file's text section so as to perfect
1022 branch prediction. */
1023 __asm__ __volatile__(
1024 "1: ldl_l %0,%1\n"
1025 " subq %2,1,%2\n"
1026 " blbs %0,2f\n"
1027 " or %0,1,%0\n"
1028 " stl_c %0,%1\n"
1029 " beq %0,3f\n"
1030 "4: mb\n"
1031 ".subsection 2\n"
1032 "2: ldl %0,%1\n"
1033 " subq %2,1,%2\n"
1034 "3: blt %2,4b\n"
1035 " blbs %0,2b\n"
1036 " br 1b\n"
1037 ".previous"
1038 : "=r" (tmp), "=m" (lock->lock), "=r" (stuck)
1039 : "m" (lock->lock), "2" (stuck) : "memory");
1040
1041 if (stuck < 0) {
1042 printk(KERN_WARNING
1043 "%s:%d spinlock stuck in %s at %p(%d)"
1044 " owner %s at %p(%d) %s:%d\n",
1045 base_file, line_no,
1046 current->comm, inline_pc, cpu,
1047 lock->task->comm, lock->previous,
1048 lock->on_cpu, lock->base_file, lock->line_no);
1049 stuck = 1L << 36;
1050 printed = 1;
1051 goto try_again;
1052 }
1053
1054 /* Exiting. Got the lock. */
1055 lock->on_cpu = cpu;
1056 lock->previous = inline_pc;
1057 lock->task = current;
1058 lock->base_file = base_file;
1059 lock->line_no = line_no;
1060
1061 if (printed) {
1062 printk(KERN_WARNING
1063 "%s:%d spinlock grabbed in %s at %p(%d) %ld ticks\n",
1064 base_file, line_no, current->comm, inline_pc,
1065 cpu, jiffies - started);
1066 }
1067}
1068
1069int
1070debug_spin_trylock(spinlock_t * lock, const char *base_file, int line_no)
1071{
1072 int ret;
1073 if ((ret = !test_and_set_bit(0, lock))) {
1074 lock->on_cpu = smp_processor_id();
1075 lock->previous = __builtin_return_address(0);
1076 lock->task = current;
1077 } else {
1078 lock->base_file = base_file;
1079 lock->line_no = line_no;
1080 }
1081 return ret;
1082}
1083#endif /* CONFIG_DEBUG_SPINLOCK */
1084
1085#ifdef CONFIG_DEBUG_RWLOCK
1086void _raw_write_lock(rwlock_t * lock)
1087{
1088 long regx, regy;
1089 int stuck_lock, stuck_reader;
1090 void *inline_pc = __builtin_return_address(0);
1091
1092 try_again:
1093
1094 stuck_lock = 1<<30;
1095 stuck_reader = 1<<30;
1096
1097 __asm__ __volatile__(
1098 "1: ldl_l %1,%0\n"
1099 " blbs %1,6f\n"
1100 " blt %1,8f\n"
1101 " mov 1,%1\n"
1102 " stl_c %1,%0\n"
1103 " beq %1,6f\n"
1104 "4: mb\n"
1105 ".subsection 2\n"
1106 "6: blt %3,4b # debug\n"
1107 " subl %3,1,%3 # debug\n"
1108 " ldl %1,%0\n"
1109 " blbs %1,6b\n"
1110 "8: blt %4,4b # debug\n"
1111 " subl %4,1,%4 # debug\n"
1112 " ldl %1,%0\n"
1113 " blt %1,8b\n"
1114 " br 1b\n"
1115 ".previous"
1116 : "=m" (*(volatile int *)lock), "=&r" (regx), "=&r" (regy),
1117 "=&r" (stuck_lock), "=&r" (stuck_reader)
1118 : "m" (*(volatile int *)lock), "3" (stuck_lock), "4" (stuck_reader) : "memory");
1119
1120 if (stuck_lock < 0) {
1121 printk(KERN_WARNING "write_lock stuck at %p\n", inline_pc);
1122 goto try_again;
1123 }
1124 if (stuck_reader < 0) {
1125 printk(KERN_WARNING "write_lock stuck on readers at %p\n",
1126 inline_pc);
1127 goto try_again;
1128 }
1129}
1130
1131void _raw_read_lock(rwlock_t * lock)
1132{
1133 long regx;
1134 int stuck_lock;
1135 void *inline_pc = __builtin_return_address(0);
1136
1137 try_again:
1138
1139 stuck_lock = 1<<30;
1140
1141 __asm__ __volatile__(
1142 "1: ldl_l %1,%0;"
1143 " blbs %1,6f;"
1144 " subl %1,2,%1;"
1145 " stl_c %1,%0;"
1146 " beq %1,6f;"
1147 "4: mb\n"
1148 ".subsection 2\n"
1149 "6: ldl %1,%0;"
1150 " blt %2,4b # debug\n"
1151 " subl %2,1,%2 # debug\n"
1152 " blbs %1,6b;"
1153 " br 1b\n"
1154 ".previous"
1155 : "=m" (*(volatile int *)lock), "=&r" (regx), "=&r" (stuck_lock)
1156 : "m" (*(volatile int *)lock), "2" (stuck_lock) : "memory");
1157
1158 if (stuck_lock < 0) {
1159 printk(KERN_WARNING "read_lock stuck at %p\n", inline_pc);
1160 goto try_again;
1161 }
1162}
1163#endif /* CONFIG_DEBUG_RWLOCK */
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 804727853d25..e32fee505220 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -373,12 +373,11 @@ marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
373 irq += 0x80; /* offset for lsi */ 373 irq += 0x80; /* offset for lsi */
374 374
375#if 1 375#if 1
376 printk("PCI:%d:%d:%d (hose %d) [%s] is using MSI\n", 376 printk("PCI:%d:%d:%d (hose %d) is using MSI\n",
377 dev->bus->number, 377 dev->bus->number,
378 PCI_SLOT(dev->devfn), 378 PCI_SLOT(dev->devfn),
379 PCI_FUNC(dev->devfn), 379 PCI_FUNC(dev->devfn),
380 hose->index, 380 hose->index);
381 pci_pretty_name (dev));
382 printk(" %d message(s) from 0x%04x\n", 381 printk(" %d message(s) from 0x%04x\n",
383 1 << ((msg_ctl & PCI_MSI_FLAGS_QSIZE) >> 4), 382 1 << ((msg_ctl & PCI_MSI_FLAGS_QSIZE) >> 4),
384 msg_dat); 383 msg_dat);
diff --git a/arch/alpha/lib/dbg_stackcheck.S b/arch/alpha/lib/dbg_stackcheck.S
index cc5ce3a5fcad..3c1f3e6522e5 100644
--- a/arch/alpha/lib/dbg_stackcheck.S
+++ b/arch/alpha/lib/dbg_stackcheck.S
@@ -5,7 +5,7 @@
5 * Verify that we have not overflowed the stack. Oops if we have. 5 * Verify that we have not overflowed the stack. Oops if we have.
6 */ 6 */
7 7
8#include <asm/asm_offsets.h> 8#include <asm/asm-offsets.h>
9 9
10 .text 10 .text
11 .set noat 11 .set noat
diff --git a/arch/alpha/lib/dbg_stackkill.S b/arch/alpha/lib/dbg_stackkill.S
index e09f2ae1e09e..e9f6a9dcf2b7 100644
--- a/arch/alpha/lib/dbg_stackkill.S
+++ b/arch/alpha/lib/dbg_stackkill.S
@@ -6,7 +6,7 @@
6 * uninitialized local variables in the act. 6 * uninitialized local variables in the act.
7 */ 7 */
8 8
9#include <asm/asm_offsets.h> 9#include <asm/asm-offsets.h>
10 10
11 .text 11 .text
12 .set noat 12 .set noat
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0f2899b4159d..11fff042aa81 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -326,8 +326,8 @@ config SMP
326 processor machines. On a single processor machine, the kernel will 326 processor machines. On a single processor machine, the kernel will
327 run faster if you say N here. 327 run faster if you say N here.
328 328
329 See also the <file:Documentation/smp.tex>, 329 See also the <file:Documentation/smp.txt>,
330 <file:Documentation/smp.txt>, <file:Documentation/i386/IO-APIC.txt>, 330 <file:Documentation/i386/IO-APIC.txt>,
331 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at 331 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
332 <http://www.linuxdoc.org/docs.html#howto>. 332 <http://www.linuxdoc.org/docs.html#howto>.
333 333
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 45a5709eaaa4..5d3acff8c596 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -53,7 +53,7 @@ config DEBUG_LL
53 bool "Kernel low-level debugging functions" 53 bool "Kernel low-level debugging functions"
54 depends on DEBUG_KERNEL 54 depends on DEBUG_KERNEL
55 help 55 help
56 Say Y here to include definitions of printascii, printchar, printhex 56 Say Y here to include definitions of printascii, printch, printhex
57 in the kernel. This is helpful if you are debugging code that 57 in the kernel. This is helpful if you are debugging code that
58 executes before the console is initialized. 58 executes before the console is initialized.
59 59
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 67f1453ade05..130e6228b587 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -175,10 +175,10 @@ else
175endif 175endif
176 @touch $@ 176 @touch $@
177 177
178prepare: maketools include/asm-arm/.arch 178archprepare: maketools include/asm-arm/.arch
179 179
180.PHONY: maketools FORCE 180.PHONY: maketools FORCE
181maketools: include/asm-arm/constants.h include/linux/version.h FORCE 181maketools: include/linux/version.h FORCE
182 $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h 182 $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h
183 183
184# Convert bzImage to zImage 184# Convert bzImage to zImage
@@ -190,7 +190,7 @@ zImage Image xipImage bootpImage uImage: vmlinux
190zinstall install: vmlinux 190zinstall install: vmlinux
191 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 191 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
192 192
193CLEAN_FILES += include/asm-arm/constants.h* include/asm-arm/mach-types.h \ 193CLEAN_FILES += include/asm-arm/mach-types.h \
194 include/asm-arm/arch include/asm-arm/.arch 194 include/asm-arm/arch include/asm-arm/.arch
195 195
196# We use MRPROPER_FILES and CLEAN_FILES now 196# We use MRPROPER_FILES and CLEAN_FILES now
@@ -201,11 +201,6 @@ archclean:
201bp:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage 201bp:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage
202i zi:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 202i zi:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
203 203
204arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
205 include/asm-arm/.arch
206
207include/asm-$(ARCH)/constants.h: arch/$(ARCH)/kernel/asm-offsets.s
208 $(call filechk,gen-asm-offsets)
209 204
210define archhelp 205define archhelp
211 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' 206 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 51f430cc2fbf..2786f7c34b3f 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -541,6 +541,103 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
541 return ret; 541 return ret;
542} 542}
543 543
544#ifdef CONFIG_PM
545
546struct locomo_save_data {
547 u16 LCM_GPO;
548 u16 LCM_SPICT;
549 u16 LCM_GPE;
550 u16 LCM_ASD;
551 u16 LCM_SPIMD;
552};
553
554static int locomo_suspend(struct device *dev, u32 pm_message_t, u32 level)
555{
556 struct locomo *lchip = dev_get_drvdata(dev);
557 struct locomo_save_data *save;
558 unsigned long flags;
559
560 if (level != SUSPEND_DISABLE)
561 return 0;
562
563 save = kmalloc(sizeof(struct locomo_save_data), GFP_KERNEL);
564 if (!save)
565 return -ENOMEM;
566
567 dev->power.saved_state = (void *) save;
568
569 spin_lock_irqsave(&lchip->lock, flags);
570
571 save->LCM_GPO = locomo_readl(lchip->base + LOCOMO_GPO); /* GPIO */
572 locomo_writel(0x00, lchip->base + LOCOMO_GPO);
573 save->LCM_SPICT = locomo_readl(lchip->base + LOCOMO_SPICT); /* SPI */
574 locomo_writel(0x40, lchip->base + LOCOMO_SPICT);
575 save->LCM_GPE = locomo_readl(lchip->base + LOCOMO_GPE); /* GPIO */
576 locomo_writel(0x00, lchip->base + LOCOMO_GPE);
577 save->LCM_ASD = locomo_readl(lchip->base + LOCOMO_ASD); /* ADSTART */
578 locomo_writel(0x00, lchip->base + LOCOMO_ASD);
579 save->LCM_SPIMD = locomo_readl(lchip->base + LOCOMO_SPIMD); /* SPI */
580 locomo_writel(0x3C14, lchip->base + LOCOMO_SPIMD);
581
582 locomo_writel(0x00, lchip->base + LOCOMO_PAIF);
583 locomo_writel(0x00, lchip->base + LOCOMO_DAC);
584 locomo_writel(0x00, lchip->base + LOCOMO_BACKLIGHT + LOCOMO_TC);
585
586 if ( (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT0) & 0x88) && (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT1) & 0x88) )
587 locomo_writel(0x00, lchip->base + LOCOMO_C32K); /* CLK32 off */
588 else
589 /* 18MHz already enabled, so no wait */
590 locomo_writel(0xc1, lchip->base + LOCOMO_C32K); /* CLK32 on */
591
592 locomo_writel(0x00, lchip->base + LOCOMO_TADC); /* 18MHz clock off*/
593 locomo_writel(0x00, lchip->base + LOCOMO_AUDIO + LOCOMO_ACC); /* 22MHz/24MHz clock off */
594 locomo_writel(0x00, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS); /* FL */
595
596 spin_unlock_irqrestore(&lchip->lock, flags);
597
598 return 0;
599}
600
601static int locomo_resume(struct device *dev, u32 level)
602{
603 struct locomo *lchip = dev_get_drvdata(dev);
604 struct locomo_save_data *save;
605 unsigned long r;
606 unsigned long flags;
607
608 if (level != RESUME_ENABLE)
609 return 0;
610
611 save = (struct locomo_save_data *) dev->power.saved_state;
612 if (!save)
613 return 0;
614
615 spin_lock_irqsave(&lchip->lock, flags);
616
617 locomo_writel(save->LCM_GPO, lchip->base + LOCOMO_GPO);
618 locomo_writel(save->LCM_SPICT, lchip->base + LOCOMO_SPICT);
619 locomo_writel(save->LCM_GPE, lchip->base + LOCOMO_GPE);
620 locomo_writel(save->LCM_ASD, lchip->base + LOCOMO_ASD);
621 locomo_writel(save->LCM_SPIMD, lchip->base + LOCOMO_SPIMD);
622
623 locomo_writel(0x00, lchip->base + LOCOMO_C32K);
624 locomo_writel(0x90, lchip->base + LOCOMO_TADC);
625
626 locomo_writel(0, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KSC);
627 r = locomo_readl(lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
628 r &= 0xFEFF;
629 locomo_writel(r, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
630 locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
631
632 spin_unlock_irqrestore(&lchip->lock, flags);
633
634 dev->power.saved_state = NULL;
635 kfree(save);
636
637 return 0;
638}
639#endif
640
544/** 641/**
545 * locomo_probe - probe for a single LoCoMo chip. 642 * locomo_probe - probe for a single LoCoMo chip.
546 * @phys_addr: physical address of device. 643 * @phys_addr: physical address of device.
@@ -707,6 +804,10 @@ static struct device_driver locomo_device_driver = {
707 .bus = &platform_bus_type, 804 .bus = &platform_bus_type,
708 .probe = locomo_probe, 805 .probe = locomo_probe,
709 .remove = locomo_remove, 806 .remove = locomo_remove,
807#ifdef CONFIG_PM
808 .suspend = locomo_suspend,
809 .resume = locomo_resume,
810#endif
710}; 811};
711 812
712/* 813/*
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 688a595598c8..d3a04c2a2c85 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -91,7 +91,7 @@ EXPORT_SYMBOL(read_scoop_reg);
91EXPORT_SYMBOL(write_scoop_reg); 91EXPORT_SYMBOL(write_scoop_reg);
92 92
93#ifdef CONFIG_PM 93#ifdef CONFIG_PM
94static int scoop_suspend(struct device *dev, uint32_t state, uint32_t level) 94static int scoop_suspend(struct device *dev, pm_message_t state, uint32_t level)
95{ 95{
96 if (level == SUSPEND_POWER_DOWN) { 96 if (level == SUSPEND_POWER_DOWN) {
97 struct scoop_dev *sdev = dev_get_drvdata(dev); 97 struct scoop_dev *sdev = dev_get_drvdata(dev);
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index 96a794d8de84..756348bf5170 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_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.12-git4 3# Linux kernel version: 2.6.13-git8
4# Wed Jun 22 15:56:42 2005 4# Thu Sep 8 19:24:02 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -22,6 +22,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
22# General setup 22# General setup
23# 23#
24CONFIG_LOCALVERSION="" 24CONFIG_LOCALVERSION=""
25CONFIG_LOCALVERSION_AUTO=y
25CONFIG_SWAP=y 26CONFIG_SWAP=y
26CONFIG_SYSVIPC=y 27CONFIG_SYSVIPC=y
27# CONFIG_POSIX_MQUEUE is not set 28# CONFIG_POSIX_MQUEUE is not set
@@ -31,6 +32,7 @@ CONFIG_SYSCTL=y
31# CONFIG_HOTPLUG is not set 32# CONFIG_HOTPLUG is not set
32CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
33# CONFIG_IKCONFIG is not set 34# CONFIG_IKCONFIG is not set
35CONFIG_INITRAMFS_SOURCE=""
34# CONFIG_EMBEDDED is not set 36# CONFIG_EMBEDDED is not set
35CONFIG_KALLSYMS=y 37CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_ALL is not set 38# CONFIG_KALLSYMS_ALL is not set
@@ -88,7 +90,9 @@ CONFIG_ARCH_S3C2410=y
88# 90#
89# S3C24XX Implementations 91# S3C24XX Implementations
90# 92#
93CONFIG_MACH_ANUBIS=y
91CONFIG_ARCH_BAST=y 94CONFIG_ARCH_BAST=y
95CONFIG_BAST_PC104_IRQ=y
92CONFIG_ARCH_H1940=y 96CONFIG_ARCH_H1940=y
93CONFIG_MACH_N30=y 97CONFIG_MACH_N30=y
94CONFIG_ARCH_SMDK2410=y 98CONFIG_ARCH_SMDK2410=y
@@ -112,6 +116,7 @@ CONFIG_S3C2410_DMA=y
112# CONFIG_S3C2410_DMA_DEBUG is not set 116# CONFIG_S3C2410_DMA_DEBUG is not set
113# CONFIG_S3C2410_PM_DEBUG is not set 117# CONFIG_S3C2410_PM_DEBUG is not set
114# CONFIG_S3C2410_PM_CHECK is not set 118# CONFIG_S3C2410_PM_CHECK is not set
119CONFIG_PM_SIMTEC=y
115CONFIG_S3C2410_LOWLEVEL_UART_PORT=0 120CONFIG_S3C2410_LOWLEVEL_UART_PORT=0
116 121
117# 122#
@@ -149,7 +154,15 @@ CONFIG_ISA_DMA_API=y
149# 154#
150# CONFIG_SMP is not set 155# CONFIG_SMP is not set
151# CONFIG_PREEMPT is not set 156# CONFIG_PREEMPT is not set
152# CONFIG_DISCONTIGMEM is not set 157# CONFIG_NO_IDLE_HZ is not set
158# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
159CONFIG_SELECT_MEMORY_MODEL=y
160CONFIG_FLATMEM_MANUAL=y
161# CONFIG_DISCONTIGMEM_MANUAL is not set
162# CONFIG_SPARSEMEM_MANUAL is not set
163CONFIG_FLATMEM=y
164CONFIG_FLAT_NODE_MEM_MAP=y
165# CONFIG_SPARSEMEM_STATIC is not set
153CONFIG_ALIGNMENT_TRAP=y 166CONFIG_ALIGNMENT_TRAP=y
154 167
155# 168#
@@ -186,6 +199,74 @@ CONFIG_PM=y
186CONFIG_APM=y 199CONFIG_APM=y
187 200
188# 201#
202# Networking
203#
204CONFIG_NET=y
205
206#
207# Networking options
208#
209# CONFIG_PACKET is not set
210CONFIG_UNIX=y
211# CONFIG_NET_KEY is not set
212CONFIG_INET=y
213# CONFIG_IP_MULTICAST is not set
214# CONFIG_IP_ADVANCED_ROUTER is not set
215CONFIG_IP_FIB_HASH=y
216CONFIG_IP_PNP=y
217# CONFIG_IP_PNP_DHCP is not set
218CONFIG_IP_PNP_BOOTP=y
219# CONFIG_IP_PNP_RARP is not set
220# CONFIG_NET_IPIP is not set
221# CONFIG_NET_IPGRE is not set
222# CONFIG_ARPD is not set
223# CONFIG_SYN_COOKIES is not set
224# CONFIG_INET_AH is not set
225# CONFIG_INET_ESP is not set
226# CONFIG_INET_IPCOMP is not set
227# CONFIG_INET_TUNNEL is not set
228CONFIG_INET_DIAG=y
229CONFIG_INET_TCP_DIAG=y
230# CONFIG_TCP_CONG_ADVANCED is not set
231CONFIG_TCP_CONG_BIC=y
232# CONFIG_IPV6 is not set
233# CONFIG_NETFILTER is not set
234
235#
236# DCCP Configuration (EXPERIMENTAL)
237#
238# CONFIG_IP_DCCP is not set
239
240#
241# SCTP Configuration (EXPERIMENTAL)
242#
243# CONFIG_IP_SCTP 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# CONFIG_NET_SCHED is not set
257# CONFIG_NET_CLS_ROUTE is not set
258
259#
260# Network testing
261#
262# CONFIG_NET_PKTGEN is not set
263# CONFIG_NETFILTER_NETLINK is not set
264# CONFIG_HAMRADIO is not set
265# CONFIG_IRDA is not set
266# CONFIG_BT is not set
267# CONFIG_IEEE80211 is not set
268
269#
189# Device Drivers 270# Device Drivers
190# 271#
191 272
@@ -258,6 +339,7 @@ CONFIG_MTD_ROM=y
258# CONFIG_MTD_IMPA7 is not set 339# CONFIG_MTD_IMPA7 is not set
259CONFIG_MTD_BAST=y 340CONFIG_MTD_BAST=y
260CONFIG_MTD_BAST_MAXSIZE=4 341CONFIG_MTD_BAST_MAXSIZE=4
342# CONFIG_MTD_PLATRAM is not set
261 343
262# 344#
263# Self-contained MTD device drivers 345# Self-contained MTD device drivers
@@ -312,7 +394,6 @@ CONFIG_BLK_DEV_RAM=y
312CONFIG_BLK_DEV_RAM_COUNT=16 394CONFIG_BLK_DEV_RAM_COUNT=16
313CONFIG_BLK_DEV_RAM_SIZE=4096 395CONFIG_BLK_DEV_RAM_SIZE=4096
314CONFIG_BLK_DEV_INITRD=y 396CONFIG_BLK_DEV_INITRD=y
315CONFIG_INITRAMFS_SOURCE=""
316# CONFIG_CDROM_PKTCDVD is not set 397# CONFIG_CDROM_PKTCDVD is not set
317 398
318# 399#
@@ -354,6 +435,7 @@ CONFIG_BLK_DEV_IDE_BAST=y
354# 435#
355# SCSI device support 436# SCSI device support
356# 437#
438# CONFIG_RAID_ATTRS is not set
357# CONFIG_SCSI is not set 439# CONFIG_SCSI is not set
358 440
359# 441#
@@ -376,70 +458,8 @@ CONFIG_BLK_DEV_IDE_BAST=y
376# 458#
377 459
378# 460#
379# Networking support 461# Network device support
380#
381CONFIG_NET=y
382
383#
384# Networking options
385# 462#
386# CONFIG_PACKET is not set
387CONFIG_UNIX=y
388# CONFIG_NET_KEY is not set
389CONFIG_INET=y
390CONFIG_IP_FIB_HASH=y
391# CONFIG_IP_FIB_TRIE is not set
392# CONFIG_IP_MULTICAST is not set
393# CONFIG_IP_ADVANCED_ROUTER is not set
394CONFIG_IP_PNP=y
395# CONFIG_IP_PNP_DHCP is not set
396CONFIG_IP_PNP_BOOTP=y
397# CONFIG_IP_PNP_RARP is not set
398# CONFIG_NET_IPIP is not set
399# CONFIG_NET_IPGRE is not set
400# CONFIG_ARPD is not set
401# CONFIG_SYN_COOKIES is not set
402# CONFIG_INET_AH is not set
403# CONFIG_INET_ESP is not set
404# CONFIG_INET_IPCOMP is not set
405# CONFIG_INET_TUNNEL is not set
406CONFIG_IP_TCPDIAG=y
407# CONFIG_IP_TCPDIAG_IPV6 is not set
408# CONFIG_IPV6 is not set
409# CONFIG_NETFILTER is not set
410
411#
412# SCTP Configuration (EXPERIMENTAL)
413#
414# CONFIG_IP_SCTP is not set
415# CONFIG_ATM is not set
416# CONFIG_BRIDGE is not set
417# CONFIG_VLAN_8021Q is not set
418# CONFIG_DECNET is not set
419# CONFIG_LLC2 is not set
420# CONFIG_IPX is not set
421# CONFIG_ATALK is not set
422# CONFIG_X25 is not set
423# CONFIG_LAPB is not set
424# CONFIG_NET_DIVERT is not set
425# CONFIG_ECONET is not set
426# CONFIG_WAN_ROUTER is not set
427
428#
429# QoS and/or fair queueing
430#
431# CONFIG_NET_SCHED is not set
432# CONFIG_NET_CLS_ROUTE is not set
433
434#
435# Network testing
436#
437# CONFIG_NET_PKTGEN is not set
438# CONFIG_NETPOLL is not set
439# CONFIG_NET_POLL_CONTROLLER is not set
440# CONFIG_HAMRADIO is not set
441# CONFIG_IRDA is not set
442# CONFIG_BT is not set
443CONFIG_NETDEVICES=y 463CONFIG_NETDEVICES=y
444# CONFIG_DUMMY is not set 464# CONFIG_DUMMY is not set
445# CONFIG_BONDING is not set 465# CONFIG_BONDING is not set
@@ -447,6 +467,11 @@ CONFIG_NETDEVICES=y
447# CONFIG_TUN is not set 467# CONFIG_TUN is not set
448 468
449# 469#
470# PHY device support
471#
472# CONFIG_PHYLIB is not set
473
474#
450# Ethernet (10 or 100Mbit) 475# Ethernet (10 or 100Mbit)
451# 476#
452CONFIG_NET_ETHERNET=y 477CONFIG_NET_ETHERNET=y
@@ -480,6 +505,8 @@ CONFIG_DM9000=m
480# CONFIG_SLIP is not set 505# CONFIG_SLIP is not set
481# CONFIG_SHAPER is not set 506# CONFIG_SHAPER is not set
482# CONFIG_NETCONSOLE is not set 507# CONFIG_NETCONSOLE is not set
508# CONFIG_NETPOLL is not set
509# CONFIG_NET_POLL_CONTROLLER is not set
483 510
484# 511#
485# ISDN subsystem 512# ISDN subsystem
@@ -562,7 +589,6 @@ CONFIG_SERIAL_8250_EXTENDED=y
562CONFIG_SERIAL_8250_MANY_PORTS=y 589CONFIG_SERIAL_8250_MANY_PORTS=y
563CONFIG_SERIAL_8250_SHARE_IRQ=y 590CONFIG_SERIAL_8250_SHARE_IRQ=y
564# CONFIG_SERIAL_8250_DETECT_IRQ is not set 591# CONFIG_SERIAL_8250_DETECT_IRQ is not set
565# CONFIG_SERIAL_8250_MULTIPORT is not set
566# CONFIG_SERIAL_8250_RSA is not set 592# CONFIG_SERIAL_8250_RSA is not set
567 593
568# 594#
@@ -605,7 +631,6 @@ CONFIG_S3C2410_RTC=y
605# 631#
606# Ftape, the floppy tape device driver 632# Ftape, the floppy tape device driver
607# 633#
608# CONFIG_DRM is not set
609# CONFIG_RAW_DRIVER is not set 634# CONFIG_RAW_DRIVER is not set
610 635
611# 636#
@@ -628,7 +653,7 @@ CONFIG_I2C_ALGOBIT=m
628# 653#
629# I2C Hardware Bus support 654# I2C Hardware Bus support
630# 655#
631# CONFIG_I2C_ISA is not set 656CONFIG_I2C_ISA=m
632# CONFIG_I2C_PARPORT is not set 657# CONFIG_I2C_PARPORT is not set
633# CONFIG_I2C_PARPORT_LIGHT is not set 658# CONFIG_I2C_PARPORT_LIGHT is not set
634CONFIG_I2C_S3C2410=y 659CONFIG_I2C_S3C2410=y
@@ -636,14 +661,33 @@ CONFIG_I2C_S3C2410=y
636# CONFIG_I2C_PCA_ISA is not set 661# CONFIG_I2C_PCA_ISA is not set
637 662
638# 663#
639# Hardware Sensors Chip support 664# Miscellaneous I2C Chip support
640# 665#
641CONFIG_I2C_SENSOR=m 666# CONFIG_SENSORS_DS1337 is not set
667# CONFIG_SENSORS_DS1374 is not set
668CONFIG_SENSORS_EEPROM=m
669# CONFIG_SENSORS_PCF8574 is not set
670# CONFIG_SENSORS_PCA9539 is not set
671# CONFIG_SENSORS_PCF8591 is not set
672# CONFIG_SENSORS_RTC8564 is not set
673# CONFIG_SENSORS_MAX6875 is not set
674# CONFIG_I2C_DEBUG_CORE is not set
675# CONFIG_I2C_DEBUG_ALGO is not set
676# CONFIG_I2C_DEBUG_BUS is not set
677# CONFIG_I2C_DEBUG_CHIP is not set
678
679#
680# Hardware Monitoring support
681#
682CONFIG_HWMON=y
683CONFIG_HWMON_VID=m
642# CONFIG_SENSORS_ADM1021 is not set 684# CONFIG_SENSORS_ADM1021 is not set
643# CONFIG_SENSORS_ADM1025 is not set 685# CONFIG_SENSORS_ADM1025 is not set
644# CONFIG_SENSORS_ADM1026 is not set 686# CONFIG_SENSORS_ADM1026 is not set
645# CONFIG_SENSORS_ADM1031 is not set 687# CONFIG_SENSORS_ADM1031 is not set
688# CONFIG_SENSORS_ADM9240 is not set
646# CONFIG_SENSORS_ASB100 is not set 689# CONFIG_SENSORS_ASB100 is not set
690# CONFIG_SENSORS_ATXP1 is not set
647# CONFIG_SENSORS_DS1621 is not set 691# CONFIG_SENSORS_DS1621 is not set
648# CONFIG_SENSORS_FSCHER is not set 692# CONFIG_SENSORS_FSCHER is not set
649# CONFIG_SENSORS_FSCPOS is not set 693# CONFIG_SENSORS_FSCPOS is not set
@@ -662,27 +706,21 @@ CONFIG_SENSORS_LM85=m
662# CONFIG_SENSORS_LM92 is not set 706# CONFIG_SENSORS_LM92 is not set
663# CONFIG_SENSORS_MAX1619 is not set 707# CONFIG_SENSORS_MAX1619 is not set
664# CONFIG_SENSORS_PC87360 is not set 708# CONFIG_SENSORS_PC87360 is not set
665# CONFIG_SENSORS_SMSC47B397 is not set
666# CONFIG_SENSORS_SMSC47M1 is not set 709# CONFIG_SENSORS_SMSC47M1 is not set
710# CONFIG_SENSORS_SMSC47B397 is not set
667# CONFIG_SENSORS_W83781D is not set 711# CONFIG_SENSORS_W83781D is not set
712# CONFIG_SENSORS_W83792D is not set
668# CONFIG_SENSORS_W83L785TS is not set 713# CONFIG_SENSORS_W83L785TS is not set
669# CONFIG_SENSORS_W83627HF is not set 714# CONFIG_SENSORS_W83627HF is not set
715# CONFIG_SENSORS_W83627EHF is not set
716# CONFIG_HWMON_DEBUG_CHIP is not set
670 717
671# 718#
672# Other I2C Chip support 719# Misc devices
673# 720#
674# CONFIG_SENSORS_DS1337 is not set
675CONFIG_SENSORS_EEPROM=m
676# CONFIG_SENSORS_PCF8574 is not set
677# CONFIG_SENSORS_PCF8591 is not set
678# CONFIG_SENSORS_RTC8564 is not set
679# CONFIG_I2C_DEBUG_CORE is not set
680# CONFIG_I2C_DEBUG_ALGO is not set
681# CONFIG_I2C_DEBUG_BUS is not set
682# CONFIG_I2C_DEBUG_CHIP is not set
683 721
684# 722#
685# Misc devices 723# Multimedia Capabilities Port drivers
686# 724#
687 725
688# 726#
@@ -731,7 +769,7 @@ CONFIG_DUMMY_CONSOLE=y
731# USB support 769# USB support
732# 770#
733CONFIG_USB_ARCH_HAS_HCD=y 771CONFIG_USB_ARCH_HAS_HCD=y
734# CONFIG_USB_ARCH_HAS_OHCI is not set 772CONFIG_USB_ARCH_HAS_OHCI=y
735# CONFIG_USB is not set 773# CONFIG_USB is not set
736 774
737# 775#
@@ -749,6 +787,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
749# 787#
750CONFIG_EXT2_FS=y 788CONFIG_EXT2_FS=y
751# CONFIG_EXT2_FS_XATTR is not set 789# CONFIG_EXT2_FS_XATTR is not set
790# CONFIG_EXT2_FS_XIP is not set
752CONFIG_EXT3_FS=y 791CONFIG_EXT3_FS=y
753CONFIG_EXT3_FS_XATTR=y 792CONFIG_EXT3_FS_XATTR=y
754# CONFIG_EXT3_FS_POSIX_ACL is not set 793# CONFIG_EXT3_FS_POSIX_ACL is not set
@@ -758,6 +797,7 @@ CONFIG_JBD=y
758CONFIG_FS_MBCACHE=y 797CONFIG_FS_MBCACHE=y
759# CONFIG_REISERFS_FS is not set 798# CONFIG_REISERFS_FS is not set
760# CONFIG_JFS_FS is not set 799# CONFIG_JFS_FS is not set
800# CONFIG_FS_POSIX_ACL is not set
761 801
762# 802#
763# XFS support 803# XFS support
@@ -765,6 +805,7 @@ CONFIG_FS_MBCACHE=y
765# CONFIG_XFS_FS is not set 805# CONFIG_XFS_FS is not set
766# CONFIG_MINIX_FS is not set 806# CONFIG_MINIX_FS is not set
767CONFIG_ROMFS_FS=y 807CONFIG_ROMFS_FS=y
808CONFIG_INOTIFY=y
768# CONFIG_QUOTA is not set 809# CONFIG_QUOTA is not set
769CONFIG_DNOTIFY=y 810CONFIG_DNOTIFY=y
770# CONFIG_AUTOFS_FS is not set 811# CONFIG_AUTOFS_FS is not set
@@ -791,11 +832,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
791# 832#
792CONFIG_PROC_FS=y 833CONFIG_PROC_FS=y
793CONFIG_SYSFS=y 834CONFIG_SYSFS=y
794# CONFIG_DEVPTS_FS_XATTR is not set
795# CONFIG_TMPFS is not set 835# CONFIG_TMPFS is not set
796# CONFIG_HUGETLBFS is not set 836# CONFIG_HUGETLBFS is not set
797# CONFIG_HUGETLB_PAGE is not set 837# CONFIG_HUGETLB_PAGE is not set
798CONFIG_RAMFS=y 838CONFIG_RAMFS=y
839# CONFIG_RELAYFS_FS is not set
799 840
800# 841#
801# Miscellaneous filesystems 842# Miscellaneous filesystems
@@ -812,8 +853,7 @@ CONFIG_JFFS_FS_VERBOSE=0
812# CONFIG_JFFS_PROC_FS is not set 853# CONFIG_JFFS_PROC_FS is not set
813CONFIG_JFFS2_FS=y 854CONFIG_JFFS2_FS=y
814CONFIG_JFFS2_FS_DEBUG=0 855CONFIG_JFFS2_FS_DEBUG=0
815# CONFIG_JFFS2_FS_NAND is not set 856CONFIG_JFFS2_FS_WRITEBUFFER=y
816# CONFIG_JFFS2_FS_NOR_ECC is not set
817# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 857# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
818CONFIG_JFFS2_ZLIB=y 858CONFIG_JFFS2_ZLIB=y
819CONFIG_JFFS2_RTIME=y 859CONFIG_JFFS2_RTIME=y
@@ -835,6 +875,7 @@ CONFIG_NFS_FS=y
835# CONFIG_NFSD is not set 875# CONFIG_NFSD is not set
836CONFIG_ROOT_NFS=y 876CONFIG_ROOT_NFS=y
837CONFIG_LOCKD=y 877CONFIG_LOCKD=y
878CONFIG_NFS_COMMON=y
838CONFIG_SUNRPC=y 879CONFIG_SUNRPC=y
839# CONFIG_RPCSEC_GSS_KRB5 is not set 880# CONFIG_RPCSEC_GSS_KRB5 is not set
840# CONFIG_RPCSEC_GSS_SPKM3 is not set 881# CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -920,6 +961,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
920CONFIG_DEBUG_KERNEL=y 961CONFIG_DEBUG_KERNEL=y
921# CONFIG_MAGIC_SYSRQ is not set 962# CONFIG_MAGIC_SYSRQ is not set
922CONFIG_LOG_BUF_SHIFT=16 963CONFIG_LOG_BUF_SHIFT=16
964CONFIG_DETECT_SOFTLOCKUP=y
923# CONFIG_SCHEDSTATS is not set 965# CONFIG_SCHEDSTATS is not set
924# CONFIG_DEBUG_SLAB is not set 966# CONFIG_DEBUG_SLAB is not set
925# CONFIG_DEBUG_SPINLOCK is not set 967# CONFIG_DEBUG_SPINLOCK is not set
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index db07ce42b3b2..949ec4427f21 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -10,7 +10,7 @@
10 * This file is included twice in entry-common.S 10 * This file is included twice in entry-common.S
11 */ 11 */
12#ifndef NR_syscalls 12#ifndef NR_syscalls
13#define NR_syscalls 320 13#define NR_syscalls 328
14#else 14#else
15 15
16__syscall_start: 16__syscall_start:
@@ -333,6 +333,9 @@ __syscall_start:
333 .long sys_inotify_init 333 .long sys_inotify_init
334 .long sys_inotify_add_watch 334 .long sys_inotify_add_watch
335 .long sys_inotify_rm_watch 335 .long sys_inotify_rm_watch
336 .long sys_mbind_wrapper
337/* 320 */ .long sys_get_mempolicy
338 .long sys_set_mempolicy
336__syscall_end: 339__syscall_end:
337 340
338 .rept NR_syscalls - (__syscall_end - __syscall_start) / 4 341 .rept NR_syscalls - (__syscall_end - __syscall_start) / 4
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 6281d488ac97..db302c6e5343 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -269,6 +269,10 @@ sys_arm_fadvise64_64_wrapper:
269 str r5, [sp, #4] @ push r5 to stack 269 str r5, [sp, #4] @ push r5 to stack
270 b sys_arm_fadvise64_64 270 b sys_arm_fadvise64_64
271 271
272sys_mbind_wrapper:
273 str r5, [sp, #4]
274 b sys_mbind
275
272/* 276/*
273 * Note: off_4k (r5) is always units of 4K. If we can't do the requested 277 * Note: off_4k (r5) is always units of 4K. If we can't do the requested
274 * offset, we return EINVAL. 278 * offset, we return EINVAL.
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index afef21273963..648cfff93138 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -3,7 +3,7 @@
3#include <linux/linkage.h> 3#include <linux/linkage.h>
4 4
5#include <asm/assembler.h> 5#include <asm/assembler.h>
6#include <asm/constants.h> 6#include <asm/asm-offsets.h>
7#include <asm/errno.h> 7#include <asm/errno.h>
8#include <asm/thread_info.h> 8#include <asm/thread_info.h>
9 9
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 1155cf07c871..539626351348 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -20,7 +20,7 @@
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/procinfo.h> 21#include <asm/procinfo.h>
22#include <asm/ptrace.h> 22#include <asm/ptrace.h>
23#include <asm/constants.h> 23#include <asm/asm-offsets.h>
24#include <asm/thread_info.h> 24#include <asm/thread_info.h>
25#include <asm/system.h> 25#include <asm/system.h>
26 26
diff --git a/arch/arm/kernel/iwmmxt.S b/arch/arm/kernel/iwmmxt.S
index 8f74e24536ba..24c7b0477a09 100644
--- a/arch/arm/kernel/iwmmxt.S
+++ b/arch/arm/kernel/iwmmxt.S
@@ -17,7 +17,7 @@
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <asm/ptrace.h> 18#include <asm/ptrace.h>
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/constants.h> 20#include <asm/asm-offsets.h>
21 21
22#define MMX_WR0 (0x00) 22#define MMX_WR0 (0x00)
23#define MMX_WR1 (0x08) 23#define MMX_WR1 (0x08)
diff --git a/arch/arm/lib/copy_page.S b/arch/arm/lib/copy_page.S
index 4c38abdbe497..68117968482b 100644
--- a/arch/arm/lib/copy_page.S
+++ b/arch/arm/lib/copy_page.S
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14#include <asm/constants.h> 14#include <asm/asm-offsets.h>
15 15
16#define COPY_COUNT (PAGE_SZ/64 PLD( -1 )) 16#define COPY_COUNT (PAGE_SZ/64 PLD( -1 ))
17 17
diff --git a/arch/arm/lib/csumpartialcopyuser.S b/arch/arm/lib/csumpartialcopyuser.S
index 46a2dc962e9d..333bca292de9 100644
--- a/arch/arm/lib/csumpartialcopyuser.S
+++ b/arch/arm/lib/csumpartialcopyuser.S
@@ -13,7 +13,7 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15#include <asm/errno.h> 15#include <asm/errno.h>
16#include <asm/constants.h> 16#include <asm/asm-offsets.h>
17 17
18 .text 18 .text
19 19
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
index 64aa6f4fe5e4..d204018070a4 100644
--- a/arch/arm/lib/getuser.S
+++ b/arch/arm/lib/getuser.S
@@ -26,7 +26,7 @@
26 * Note that ADDR_LIMIT is either 0 or 0xc0000000. 26 * Note that ADDR_LIMIT is either 0 or 0xc0000000.
27 * Note also that it is intended that __get_user_bad is not global. 27 * Note also that it is intended that __get_user_bad is not global.
28 */ 28 */
29#include <asm/constants.h> 29#include <asm/asm-offsets.h>
30#include <asm/thread_info.h> 30#include <asm/thread_info.h>
31#include <asm/errno.h> 31#include <asm/errno.h>
32 32
diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S
index b09398d95aac..4593e9c07f05 100644
--- a/arch/arm/lib/putuser.S
+++ b/arch/arm/lib/putuser.S
@@ -26,7 +26,7 @@
26 * Note that ADDR_LIMIT is either 0 or 0xc0000000 26 * Note that ADDR_LIMIT is either 0 or 0xc0000000
27 * Note also that it is intended that __put_user_bad is not global. 27 * Note also that it is intended that __put_user_bad is not global.
28 */ 28 */
29#include <asm/constants.h> 29#include <asm/asm-offsets.h>
30#include <asm/thread_info.h> 30#include <asm/thread_info.h>
31#include <asm/errno.h> 31#include <asm/errno.h>
32 32
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c
index 112f1d68fb2b..e216ab8b9e8f 100644
--- a/arch/arm/mach-clps7500/core.c
+++ b/arch/arm/mach-clps7500/core.c
@@ -354,7 +354,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
354 354
355static struct platform_device serial_device = { 355static struct platform_device serial_device = {
356 .name = "serial8250", 356 .name = "serial8250",
357 .id = 0, 357 .id = PLAT8250_DEV_PLATFORM,
358 .dev = { 358 .dev = {
359 .platform_data = serial_platform_data, 359 .platform_data = serial_platform_data,
360 }, 360 },
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 23c4da10101b..5aeadfd72143 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -219,7 +219,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
219 219
220static struct platform_device serial_device = { 220static struct platform_device serial_device = {
221 .name = "serial8250", 221 .name = "serial8250",
222 .id = 0, 222 .id = PLAT8250_DEV_PLATFORM,
223 .dev = { 223 .dev = {
224 .platform_data = serial_platform_data, 224 .platform_data = serial_platform_data,
225 }, 225 },
diff --git a/arch/arm/mach-epxa10db/arch.c b/arch/arm/mach-epxa10db/arch.c
index 7daa021676d0..44c56571d183 100644
--- a/arch/arm/mach-epxa10db/arch.c
+++ b/arch/arm/mach-epxa10db/arch.c
@@ -52,7 +52,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
52 52
53static struct platform_device serial_device = { 53static struct platform_device serial_device = {
54 .name = "serial8250", 54 .name = "serial8250",
55 .id = 0, 55 .id = PLAT8250_DEV_PLATFORM,
56 .dev = { 56 .dev = {
57 .platform_data = serial_platform_data, 57 .platform_data = serial_platform_data,
58 }, 58 },
diff --git a/arch/arm/mach-footbridge/isa.c b/arch/arm/mach-footbridge/isa.c
index aa3a1fef563e..28846c7edaaf 100644
--- a/arch/arm/mach-footbridge/isa.c
+++ b/arch/arm/mach-footbridge/isa.c
@@ -34,7 +34,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
34 34
35static struct platform_device serial_device = { 35static struct platform_device serial_device = {
36 .name = "serial8250", 36 .name = "serial8250",
37 .id = 0, 37 .id = PLAT8250_DEV_PLATFORM,
38 .dev = { 38 .dev = {
39 .platform_data = serial_platform_data, 39 .platform_data = serial_platform_data,
40 }, 40 },
diff --git a/arch/arm/mach-h720x/cpu-h7202.c b/arch/arm/mach-h720x/cpu-h7202.c
index 4b3199319e68..a4a7c0125d03 100644
--- a/arch/arm/mach-h720x/cpu-h7202.c
+++ b/arch/arm/mach-h720x/cpu-h7202.c
@@ -90,7 +90,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
90 90
91static struct platform_device serial_device = { 91static struct platform_device serial_device = {
92 .name = "serial8250", 92 .name = "serial8250",
93 .id = 0, 93 .id = PLAT8250_DEV_PLATFORM,
94 .dev = { 94 .dev = {
95 .platform_data = serial_platform_data, 95 .platform_data = serial_platform_data,
96 }, 96 },
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 098c817a7fb8..74bd2fd602d4 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -174,7 +174,7 @@ static struct resource ixp2000_uart_resource = {
174 174
175static struct platform_device ixp2000_serial_device = { 175static struct platform_device ixp2000_serial_device = {
176 .name = "serial8250", 176 .name = "serial8250",
177 .id = 0, 177 .id = PLAT8250_DEV_PLATFORM,
178 .dev = { 178 .dev = {
179 .platform_data = ixp2000_serial_port, 179 .platform_data = ixp2000_serial_port,
180 }, 180 },
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 8b2f25322452..050c92768913 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -66,7 +66,7 @@ static struct plat_serial8250_port coyote_uart_data[] = {
66 66
67static struct platform_device coyote_uart = { 67static struct platform_device coyote_uart = {
68 .name = "serial8250", 68 .name = "serial8250",
69 .id = 0, 69 .id = PLAT8250_DEV_PLATFORM,
70 .dev = { 70 .dev = {
71 .platform_data = coyote_uart_data, 71 .platform_data = coyote_uart_data,
72 }, 72 },
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 3fd92c5cbaa8..29a6d02fa851 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -93,7 +93,7 @@ static struct plat_serial8250_port gtwx5715_uart_platform_data[] = {
93 93
94static struct platform_device gtwx5715_uart_device = { 94static struct platform_device gtwx5715_uart_device = {
95 .name = "serial8250", 95 .name = "serial8250",
96 .id = 0, 96 .id = PLAT8250_DEV_PLATFORM,
97 .dev = { 97 .dev = {
98 .platform_data = gtwx5715_uart_platform_data, 98 .platform_data = gtwx5715_uart_platform_data,
99 }, 99 },
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 6c14ff3c23a0..ae1fa099d5fa 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -96,7 +96,7 @@ static struct plat_serial8250_port ixdp425_uart_data[] = {
96 96
97static struct platform_device ixdp425_uart = { 97static struct platform_device ixdp425_uart = {
98 .name = "serial8250", 98 .name = "serial8250",
99 .id = 0, 99 .id = PLAT8250_DEV_PLATFORM,
100 .dev.platform_data = ixdp425_uart_data, 100 .dev.platform_data = ixdp425_uart_data,
101 .num_resources = 2, 101 .num_resources = 2,
102 .resource = ixdp425_uart_resources 102 .resource = ixdp425_uart_resources
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 7408ac94f771..27fc2e8e5fca 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -47,6 +47,14 @@ config MACH_OMAP_OSK
47 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here 47 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
48 if you have such a board. 48 if you have such a board.
49 49
50config OMAP_OSK_MISTRAL
51 bool "Mistral QVGA board Support"
52 depends on MACH_OMAP_OSK
53 help
54 The OSK supports an optional add-on board with a Quarter-VGA
55 touchscreen, PDA-ish buttons, a resume button, bicolor LED,
56 and camera connector. Say Y here if you have this board.
57
50config MACH_OMAP_PERSEUS2 58config MACH_OMAP_PERSEUS2
51 bool "TI Perseus2" 59 bool "TI Perseus2"
52 depends on ARCH_OMAP1 && ARCH_OMAP730 60 depends on ARCH_OMAP1 && ARCH_OMAP730
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index d386fd913f0c..181a93deaaee 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := io.o id.o irq.o time.o serial.o 6obj-y := io.o id.o irq.o time.o serial.o devices.o
7led-y := leds.o 7led-y := leds.o
8 8
9# Specific board support 9# Specific board support
@@ -23,6 +23,7 @@ endif
23 23
24# LEDs support 24# LEDs support
25led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o 25led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
26led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o
26led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o 27led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
27led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o 28led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
28led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o 29led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 122796ebe8f5..c209c7172a9a 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -48,19 +48,43 @@ static struct omap_usb_config generic1510_usb_config __initdata = {
48 48
49#if defined(CONFIG_ARCH_OMAP16XX) 49#if defined(CONFIG_ARCH_OMAP16XX)
50static struct omap_usb_config generic1610_usb_config __initdata = { 50static struct omap_usb_config generic1610_usb_config __initdata = {
51#ifdef CONFIG_USB_OTG
52 .otg = 1,
53#endif
51 .register_host = 1, 54 .register_host = 1,
52 .register_dev = 1, 55 .register_dev = 1,
53 .hmc_mode = 16, 56 .hmc_mode = 16,
54 .pins[0] = 6, 57 .pins[0] = 6,
55}; 58};
59
60static struct omap_mmc_config generic_mmc_config __initdata = {
61 .mmc [0] = {
62 .enabled = 0,
63 .wire4 = 0,
64 .wp_pin = -1,
65 .power_pin = -1,
66 .switch_pin = -1,
67 },
68 .mmc [1] = {
69 .enabled = 0,
70 .wire4 = 0,
71 .wp_pin = -1,
72 .power_pin = -1,
73 .switch_pin = -1,
74 },
75};
76
56#endif 77#endif
57 78
58static struct omap_board_config_kernel generic_config[] = { 79static struct omap_board_config_kernel generic_config[] = {
59 { OMAP_TAG_USB, NULL }, 80 { OMAP_TAG_USB, NULL },
81 { OMAP_TAG_MMC, &generic_mmc_config },
60}; 82};
61 83
62static void __init omap_generic_init(void) 84static void __init omap_generic_init(void)
63{ 85{
86 const struct omap_uart_config *uart_conf;
87
64 /* 88 /*
65 * Make sure the serial ports are muxed on at this point. 89 * Make sure the serial ports are muxed on at this point.
66 * You have to mux them off in device drivers later on 90 * You have to mux them off in device drivers later on
@@ -76,6 +100,18 @@ static void __init omap_generic_init(void)
76 generic_config[0].data = &generic1610_usb_config; 100 generic_config[0].data = &generic1610_usb_config;
77 } 101 }
78#endif 102#endif
103
104 uart_conf = omap_get_config(OMAP_TAG_UART, struct omap_uart_config);
105 if (uart_conf != NULL) {
106 unsigned int enabled_ports, i;
107
108 enabled_ports = uart_conf->enabled_uarts;
109 for (i = 0; i < 3; i++) {
110 if (!(enabled_ports & (1 << i)))
111 generic_serial_ports[i] = 0;
112 }
113 }
114
79 omap_board_config = generic_config; 115 omap_board_config = generic_config;
80 omap_board_config_size = ARRAY_SIZE(generic_config); 116 omap_board_config_size = ARRAY_SIZE(generic_config);
81 omap_serial_init(generic_serial_ports); 117 omap_serial_init(generic_serial_ports);
@@ -83,7 +119,7 @@ static void __init omap_generic_init(void)
83 119
84static void __init omap_generic_map_io(void) 120static void __init omap_generic_map_io(void)
85{ 121{
86 omap_map_common_io() 122 omap_map_common_io();
87} 123}
88 124
89MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") 125MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index f4983ee95ab4..d46a70063b0c 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -33,6 +33,7 @@
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34 34
35#include <asm/arch/gpio.h> 35#include <asm/arch/gpio.h>
36#include <asm/arch/mux.h>
36#include <asm/arch/tc.h> 37#include <asm/arch/tc.h>
37#include <asm/arch/usb.h> 38#include <asm/arch/usb.h>
38#include <asm/arch/common.h> 39#include <asm/arch/common.h>
@@ -80,8 +81,7 @@ static struct flash_platform_data h2_flash_data = {
80}; 81};
81 82
82static struct resource h2_flash_resource = { 83static struct resource h2_flash_resource = {
83 .start = OMAP_CS2B_PHYS, 84 /* This is on CS3, wherever it's mapped */
84 .end = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
85 .flags = IORESOURCE_MEM, 85 .flags = IORESOURCE_MEM,
86}; 86};
87 87
@@ -126,10 +126,9 @@ static void __init h2_init_smc91x(void)
126 printk("Error requesting gpio 0 for smc91x irq\n"); 126 printk("Error requesting gpio 0 for smc91x irq\n");
127 return; 127 return;
128 } 128 }
129 omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE);
130} 129}
131 130
132void h2_init_irq(void) 131static void __init h2_init_irq(void)
133{ 132{
134 omap_init_irq(); 133 omap_init_irq();
135 omap_gpio_init(); 134 omap_gpio_init();
@@ -152,9 +151,13 @@ static struct omap_usb_config h2_usb_config __initdata = {
152}; 151};
153 152
154static struct omap_mmc_config h2_mmc_config __initdata = { 153static struct omap_mmc_config h2_mmc_config __initdata = {
155 .mmc_blocks = 1, 154 .mmc [0] = {
156 .mmc1_power_pin = -1, /* tps65010 gpio3 */ 155 .enabled = 1,
157 .mmc1_switch_pin = OMAP_MPUIO(1), 156 .wire4 = 1,
157 .wp_pin = OMAP_MPUIO(3),
158 .power_pin = -1, /* tps65010 gpio3 */
159 .switch_pin = OMAP_MPUIO(1),
160 },
158}; 161};
159 162
160static struct omap_board_config_kernel h2_config[] = { 163static struct omap_board_config_kernel h2_config[] = {
@@ -164,6 +167,16 @@ static struct omap_board_config_kernel h2_config[] = {
164 167
165static void __init h2_init(void) 168static void __init h2_init(void)
166{ 169{
170 /* NOTE: revC boards support NAND-boot, which can put NOR on CS2B
171 * and NAND (either 16bit or 8bit) on CS3.
172 */
173 h2_flash_resource.end = h2_flash_resource.start = omap_cs3_phys();
174 h2_flash_resource.end += SZ_32M - 1;
175
176 /* MMC: card detect and WP */
177 // omap_cfg_reg(U19_ARMIO1); /* CD */
178 omap_cfg_reg(BALLOUT_V8_ARMIO3); /* WP */
179
167 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); 180 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
168 omap_board_config = h2_config; 181 omap_board_config = h2_config;
169 omap_board_config_size = ARRAY_SIZE(h2_config); 182 omap_board_config_size = ARRAY_SIZE(h2_config);
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 7cd419d61b40..2798613696fa 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -82,8 +82,7 @@ static struct flash_platform_data h3_flash_data = {
82}; 82};
83 83
84static struct resource h3_flash_resource = { 84static struct resource h3_flash_resource = {
85 .start = OMAP_CS2B_PHYS, 85 /* This is on CS3, wherever it's mapped */
86 .end = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
87 .flags = IORESOURCE_MEM, 86 .flags = IORESOURCE_MEM,
88}; 87};
89 88
@@ -161,13 +160,26 @@ static struct omap_usb_config h3_usb_config __initdata = {
161 .pins[1] = 3, 160 .pins[1] = 3,
162}; 161};
163 162
163static struct omap_mmc_config h3_mmc_config __initdata = {
164 .mmc[0] = {
165 .enabled = 1,
166 .power_pin = -1, /* tps65010 GPIO4 */
167 .switch_pin = OMAP_MPUIO(1),
168 },
169};
170
164static struct omap_board_config_kernel h3_config[] = { 171static struct omap_board_config_kernel h3_config[] = {
165 { OMAP_TAG_USB, &h3_usb_config }, 172 { OMAP_TAG_USB, &h3_usb_config },
173 { OMAP_TAG_MMC, &h3_mmc_config },
166}; 174};
167 175
168static void __init h3_init(void) 176static void __init h3_init(void)
169{ 177{
178 h3_flash_resource.end = h3_flash_resource.start = omap_cs3_phys();
179 h3_flash_resource.end += OMAP_CS3_SIZE - 1;
170 (void) platform_add_devices(devices, ARRAY_SIZE(devices)); 180 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
181 omap_board_config = h3_config;
182 omap_board_config_size = ARRAY_SIZE(h3_config);
171} 183}
172 184
173static void __init h3_init_smc91x(void) 185static void __init h3_init_smc91x(void)
@@ -177,7 +189,6 @@ static void __init h3_init_smc91x(void)
177 printk("Error requesting gpio 40 for smc91x irq\n"); 189 printk("Error requesting gpio 40 for smc91x irq\n");
178 return; 190 return;
179 } 191 }
180 omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE);
181} 192}
182 193
183void h3_init_irq(void) 194void h3_init_irq(void)
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 91de60a91ef8..df0312b596e4 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -29,6 +29,7 @@
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31 31
32#include <asm/arch/mux.h>
32#include <asm/arch/fpga.h> 33#include <asm/arch/fpga.h>
33#include <asm/arch/gpio.h> 34#include <asm/arch/gpio.h>
34#include <asm/arch/tc.h> 35#include <asm/arch/tc.h>
@@ -173,7 +174,6 @@ static void __init innovator_init_smc91x(void)
173 printk("Error requesting gpio 0 for smc91x irq\n"); 174 printk("Error requesting gpio 0 for smc91x irq\n");
174 return; 175 return;
175 } 176 }
176 omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
177 } 177 }
178} 178}
179 179
@@ -220,8 +220,19 @@ static struct omap_usb_config h2_usb_config __initdata = {
220}; 220};
221#endif 221#endif
222 222
223static struct omap_mmc_config innovator_mmc_config __initdata = {
224 .mmc [0] = {
225 .enabled = 1,
226 .wire4 = 1,
227 .wp_pin = OMAP_MPUIO(3),
228 .power_pin = -1, /* FPGA F3 UIO42 */
229 .switch_pin = -1, /* FPGA F4 UIO43 */
230 },
231};
232
223static struct omap_board_config_kernel innovator_config[] = { 233static struct omap_board_config_kernel innovator_config[] = {
224 { OMAP_TAG_USB, NULL }, 234 { OMAP_TAG_USB, NULL },
235 { OMAP_TAG_MMC, &innovator_mmc_config },
225}; 236};
226 237
227static void __init innovator_init(void) 238static void __init innovator_init(void)
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 6750b2014092..d904e643f5ec 100644
--- a/arch/arm/mach-omap1/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -75,16 +75,15 @@ static void __init netstar_init(void)
75 mdelay(50); /* 50ms until PHY ready */ 75 mdelay(50); /* 50ms until PHY ready */
76 /* smc91x interrupt pin */ 76 /* smc91x interrupt pin */
77 omap_request_gpio(8); 77 omap_request_gpio(8);
78 omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
79 78
80 omap_request_gpio(12); 79 omap_request_gpio(12);
81 omap_request_gpio(13); 80 omap_request_gpio(13);
82 omap_request_gpio(14); 81 omap_request_gpio(14);
83 omap_request_gpio(15); 82 omap_request_gpio(15);
84 omap_set_gpio_edge_ctrl(12, OMAP_GPIO_FALLING_EDGE); 83 set_irq_type(OMAP_GPIO_IRQ(12), IRQT_FALLING);
85 omap_set_gpio_edge_ctrl(13, OMAP_GPIO_FALLING_EDGE); 84 set_irq_type(OMAP_GPIO_IRQ(13), IRQT_FALLING);
86 omap_set_gpio_edge_ctrl(14, OMAP_GPIO_FALLING_EDGE); 85 set_irq_type(OMAP_GPIO_IRQ(14), IRQT_FALLING);
87 omap_set_gpio_edge_ctrl(15, OMAP_GPIO_FALLING_EDGE); 86 set_irq_type(OMAP_GPIO_IRQ(15), IRQT_FALLING);
88 87
89 platform_add_devices(netstar_devices, ARRAY_SIZE(netstar_devices)); 88 platform_add_devices(netstar_devices, ARRAY_SIZE(netstar_devices));
90 89
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 6844e536c698..21103df50415 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -29,11 +29,16 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/device.h> 31#include <linux/device.h>
32#include <linux/interrupt.h>
33
34#include <linux/mtd/mtd.h>
35#include <linux/mtd/partitions.h>
32 36
33#include <asm/hardware.h> 37#include <asm/hardware.h>
34#include <asm/mach-types.h> 38#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
36#include <asm/mach/map.h> 40#include <asm/mach/map.h>
41#include <asm/mach/flash.h>
37 42
38#include <asm/arch/gpio.h> 43#include <asm/arch/gpio.h>
39#include <asm/arch/usb.h> 44#include <asm/arch/usb.h>
@@ -41,12 +46,56 @@
41#include <asm/arch/tc.h> 46#include <asm/arch/tc.h>
42#include <asm/arch/common.h> 47#include <asm/arch/common.h>
43 48
44static struct map_desc osk5912_io_desc[] __initdata = { 49static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
45{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE, 50
46 MT_DEVICE }, 51static struct mtd_partition osk_partitions[] = {
52 /* bootloader (U-Boot, etc) in first sector */
53 {
54 .name = "bootloader",
55 .offset = 0,
56 .size = SZ_128K,
57 .mask_flags = MTD_WRITEABLE, /* force read-only */
58 },
59 /* bootloader params in the next sector */
60 {
61 .name = "params",
62 .offset = MTDPART_OFS_APPEND,
63 .size = SZ_128K,
64 .mask_flags = 0,
65 }, {
66 .name = "kernel",
67 .offset = MTDPART_OFS_APPEND,
68 .size = SZ_2M,
69 .mask_flags = 0
70 }, {
71 .name = "filesystem",
72 .offset = MTDPART_OFS_APPEND,
73 .size = MTDPART_SIZ_FULL,
74 .mask_flags = 0
75 }
47}; 76};
48 77
49static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0}; 78static struct flash_platform_data osk_flash_data = {
79 .map_name = "cfi_probe",
80 .width = 2,
81 .parts = osk_partitions,
82 .nr_parts = ARRAY_SIZE(osk_partitions),
83};
84
85static struct resource osk_flash_resource = {
86 /* this is on CS3, wherever it's mapped */
87 .flags = IORESOURCE_MEM,
88};
89
90static struct platform_device osk5912_flash_device = {
91 .name = "omapflash",
92 .id = 0,
93 .dev = {
94 .platform_data = &osk_flash_data,
95 },
96 .num_resources = 1,
97 .resource = &osk_flash_resource,
98};
50 99
51static struct resource osk5912_smc91x_resources[] = { 100static struct resource osk5912_smc91x_resources[] = {
52 [0] = { 101 [0] = {
@@ -86,9 +135,16 @@ static struct platform_device osk5912_cf_device = {
86 .resource = osk5912_cf_resources, 135 .resource = osk5912_cf_resources,
87}; 136};
88 137
138static struct platform_device osk5912_mcbsp1_device = {
139 .name = "omap_mcbsp",
140 .id = 1,
141};
142
89static struct platform_device *osk5912_devices[] __initdata = { 143static struct platform_device *osk5912_devices[] __initdata = {
144 &osk5912_flash_device,
90 &osk5912_smc91x_device, 145 &osk5912_smc91x_device,
91 &osk5912_cf_device, 146 &osk5912_cf_device,
147 &osk5912_mcbsp1_device,
92}; 148};
93 149
94static void __init osk_init_smc91x(void) 150static void __init osk_init_smc91x(void)
@@ -97,7 +153,6 @@ static void __init osk_init_smc91x(void)
97 printk("Error requesting gpio 0 for smc91x irq\n"); 153 printk("Error requesting gpio 0 for smc91x irq\n");
98 return; 154 return;
99 } 155 }
100 omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
101 156
102 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ 157 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
103 EMIFS_CCS(1) |= 0x2; 158 EMIFS_CCS(1) |= 0x2;
@@ -110,11 +165,11 @@ static void __init osk_init_cf(void)
110 printk("Error requesting gpio 62 for CF irq\n"); 165 printk("Error requesting gpio 62 for CF irq\n");
111 return; 166 return;
112 } 167 }
113 /* it's really active-low */ 168 /* the CF I/O IRQ is really active-low */
114 omap_set_gpio_edge_ctrl(62, OMAP_GPIO_FALLING_EDGE); 169 set_irq_type(OMAP_GPIO_IRQ(62), IRQT_FALLING);
115} 170}
116 171
117void osk_init_irq(void) 172static void __init osk_init_irq(void)
118{ 173{
119 omap_init_irq(); 174 omap_init_irq();
120 omap_gpio_init(); 175 omap_gpio_init();
@@ -142,18 +197,69 @@ static struct omap_board_config_kernel osk_config[] = {
142 { OMAP_TAG_USB, &osk_usb_config }, 197 { OMAP_TAG_USB, &osk_usb_config },
143}; 198};
144 199
200#ifdef CONFIG_OMAP_OSK_MISTRAL
201
202#ifdef CONFIG_PM
203static irqreturn_t
204osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs)
205{
206 return IRQ_HANDLED;
207}
208#endif
209
210static void __init osk_mistral_init(void)
211{
212 /* FIXME here's where to feed in framebuffer, touchpad, and
213 * keyboard setup ... not in the drivers for those devices!
214 *
215 * NOTE: we could actually tell if there's a Mistral board
216 * attached, e.g. by trying to read something from the ads7846.
217 * But this is too early for that...
218 */
219
220 /* the sideways button (SW1) is for use as a "wakeup" button */
221 omap_cfg_reg(N15_1610_MPUIO2);
222 if (omap_request_gpio(OMAP_MPUIO(2)) == 0) {
223 int ret = 0;
224 omap_set_gpio_direction(OMAP_MPUIO(2), 1);
225 set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING);
226#ifdef CONFIG_PM
227 /* share the IRQ in case someone wants to use the
228 * button for more than wakeup from system sleep.
229 */
230 ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)),
231 &osk_mistral_wake_interrupt,
232 SA_SHIRQ, "mistral_wakeup",
233 &osk_mistral_wake_interrupt);
234 if (ret != 0) {
235 omap_free_gpio(OMAP_MPUIO(2));
236 printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
237 ret);
238 } else
239 enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2)));
240#endif
241 } else
242 printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
243}
244#else
245static void __init osk_mistral_init(void) { }
246#endif
247
145static void __init osk_init(void) 248static void __init osk_init(void)
146{ 249{
250 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
251 osk_flash_resource.end += SZ_32M - 1;
147 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 252 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
148 omap_board_config = osk_config; 253 omap_board_config = osk_config;
149 omap_board_config_size = ARRAY_SIZE(osk_config); 254 omap_board_config_size = ARRAY_SIZE(osk_config);
150 USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 255 USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
256
257 osk_mistral_init();
151} 258}
152 259
153static void __init osk_map_io(void) 260static void __init osk_map_io(void)
154{ 261{
155 omap_map_common_io(); 262 omap_map_common_io();
156 iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
157 omap_serial_init(osk_serial_ports); 263 omap_serial_init(osk_serial_ports);
158} 264}
159 265
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 213317392d9b..107c68c8ab54 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -24,6 +24,7 @@
24#include <asm/mach/flash.h> 24#include <asm/mach/flash.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <asm/arch/tc.h>
27#include <asm/arch/gpio.h> 28#include <asm/arch/gpio.h>
28#include <asm/arch/mux.h> 29#include <asm/arch/mux.h>
29#include <asm/arch/fpga.h> 30#include <asm/arch/fpga.h>
@@ -83,8 +84,8 @@ static struct flash_platform_data p2_flash_data = {
83}; 84};
84 85
85static struct resource p2_flash_resource = { 86static struct resource p2_flash_resource = {
86 .start = OMAP_FLASH_0_START, 87 .start = OMAP_CS0_PHYS,
87 .end = OMAP_FLASH_0_START + OMAP_FLASH_0_SIZE - 1, 88 .end = OMAP_CS0_PHYS + SZ_32M - 1,
88 .flags = IORESOURCE_MEM, 89 .flags = IORESOURCE_MEM,
89}; 90};
90 91
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index e42281988990..bf30b1acda0b 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -25,13 +25,14 @@
25#include <asm/hardware.h> 25#include <asm/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/flash.h>
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
29 30
31#include <asm/arch/common.h>
30#include <asm/arch/gpio.h> 32#include <asm/arch/gpio.h>
31#include <asm/arch/tc.h>
32#include <asm/arch/mux.h> 33#include <asm/arch/mux.h>
34#include <asm/arch/tc.h>
33#include <asm/arch/usb.h> 35#include <asm/arch/usb.h>
34#include <asm/arch/common.h>
35 36
36extern void omap_init_time(void); 37extern void omap_init_time(void);
37extern int omap_gpio_init(void); 38extern int omap_gpio_init(void);
@@ -74,7 +75,7 @@ static struct plat_serial8250_port voiceblue_ports[] = {
74 75
75static struct platform_device serial_device = { 76static struct platform_device serial_device = {
76 .name = "serial8250", 77 .name = "serial8250",
77 .id = 1, 78 .id = PLAT8250_DEV_PLATFORM1,
78 .dev = { 79 .dev = {
79 .platform_data = voiceblue_ports, 80 .platform_data = voiceblue_ports,
80 }, 81 },
@@ -86,6 +87,27 @@ static int __init ext_uart_init(void)
86} 87}
87arch_initcall(ext_uart_init); 88arch_initcall(ext_uart_init);
88 89
90static struct flash_platform_data voiceblue_flash_data = {
91 .map_name = "cfi_probe",
92 .width = 2,
93};
94
95static struct resource voiceblue_flash_resource = {
96 .start = OMAP_CS0_PHYS,
97 .end = OMAP_CS0_PHYS + SZ_32M - 1,
98 .flags = IORESOURCE_MEM,
99};
100
101static struct platform_device voiceblue_flash_device = {
102 .name = "omapflash",
103 .id = 0,
104 .dev = {
105 .platform_data = &voiceblue_flash_data,
106 },
107 .num_resources = 1,
108 .resource = &voiceblue_flash_resource,
109};
110
89static struct resource voiceblue_smc91x_resources[] = { 111static struct resource voiceblue_smc91x_resources[] = {
90 [0] = { 112 [0] = {
91 .start = OMAP_CS2_PHYS + 0x300, 113 .start = OMAP_CS2_PHYS + 0x300,
@@ -107,6 +129,7 @@ static struct platform_device voiceblue_smc91x_device = {
107}; 129};
108 130
109static struct platform_device *voiceblue_devices[] __initdata = { 131static struct platform_device *voiceblue_devices[] __initdata = {
132 &voiceblue_flash_device,
110 &voiceblue_smc91x_device, 133 &voiceblue_smc91x_device,
111}; 134};
112 135
@@ -119,8 +142,17 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
119 .pins[2] = 6, 142 .pins[2] = 6,
120}; 143};
121 144
145static struct omap_mmc_config voiceblue_mmc_config __initdata = {
146 .mmc[0] = {
147 .enabled = 1,
148 .power_pin = 2,
149 .switch_pin = -1,
150 },
151};
152
122static struct omap_board_config_kernel voiceblue_config[] = { 153static struct omap_board_config_kernel voiceblue_config[] = {
123 { OMAP_TAG_USB, &voiceblue_usb_config }, 154 { OMAP_TAG_USB, &voiceblue_usb_config },
155 { OMAP_TAG_MMC, &voiceblue_mmc_config },
124}; 156};
125 157
126static void __init voiceblue_init_irq(void) 158static void __init voiceblue_init_irq(void)
@@ -131,9 +163,6 @@ static void __init voiceblue_init_irq(void)
131 163
132static void __init voiceblue_init(void) 164static void __init voiceblue_init(void)
133{ 165{
134 /* There is a good chance board is going up, so enable Power LED
135 * (it is connected through invertor) */
136 omap_writeb(0x00, OMAP_LPG1_LCR);
137 /* Watchdog */ 166 /* Watchdog */
138 omap_request_gpio(0); 167 omap_request_gpio(0);
139 /* smc91x reset */ 168 /* smc91x reset */
@@ -145,7 +174,6 @@ static void __init voiceblue_init(void)
145 mdelay(50); /* 50ms until PHY ready */ 174 mdelay(50); /* 50ms until PHY ready */
146 /* smc91x interrupt pin */ 175 /* smc91x interrupt pin */
147 omap_request_gpio(8); 176 omap_request_gpio(8);
148 omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
149 /* 16C554 reset*/ 177 /* 16C554 reset*/
150 omap_request_gpio(6); 178 omap_request_gpio(6);
151 omap_set_gpio_direction(6, 0); 179 omap_set_gpio_direction(6, 0);
@@ -155,14 +183,19 @@ static void __init voiceblue_init(void)
155 omap_request_gpio(13); 183 omap_request_gpio(13);
156 omap_request_gpio(14); 184 omap_request_gpio(14);
157 omap_request_gpio(15); 185 omap_request_gpio(15);
158 omap_set_gpio_edge_ctrl(12, OMAP_GPIO_RISING_EDGE); 186 set_irq_type(OMAP_GPIO_IRQ(12), IRQT_RISING);
159 omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE); 187 set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING);
160 omap_set_gpio_edge_ctrl(14, OMAP_GPIO_RISING_EDGE); 188 set_irq_type(OMAP_GPIO_IRQ(14), IRQT_RISING);
161 omap_set_gpio_edge_ctrl(15, OMAP_GPIO_RISING_EDGE); 189 set_irq_type(OMAP_GPIO_IRQ(15), IRQT_RISING);
162 190
163 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices)); 191 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices));
164 omap_board_config = voiceblue_config; 192 omap_board_config = voiceblue_config;
165 omap_board_config_size = ARRAY_SIZE(voiceblue_config); 193 omap_board_config_size = ARRAY_SIZE(voiceblue_config);
194
195 /* There is a good chance board is going up, so enable power LED
196 * (it is connected through invertor) */
197 omap_writeb(0x00, OMAP_LPG1_LCR);
198 omap_writeb(0x00, OMAP_LPG1_PMR); /* Disable clock */
166} 199}
167 200
168static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; 201static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
@@ -184,9 +217,9 @@ static int panic_event(struct notifier_block *this, unsigned long event,
184 if (test_and_set_bit(MACHINE_PANICED, &machine_state)) 217 if (test_and_set_bit(MACHINE_PANICED, &machine_state))
185 return NOTIFY_DONE; 218 return NOTIFY_DONE;
186 219
187 /* Flash Power LED 220 /* Flash power LED */
188 * (TODO: Enable clock right way (enabled in bootloader already)) */
189 omap_writeb(0x78, OMAP_LPG1_LCR); 221 omap_writeb(0x78, OMAP_LPG1_LCR);
222 omap_writeb(0x01, OMAP_LPG1_PMR); /* Enable clock */
190 223
191 return NOTIFY_DONE; 224 return NOTIFY_DONE;
192} 225}
@@ -195,15 +228,14 @@ static struct notifier_block panic_block = {
195 .notifier_call = panic_event, 228 .notifier_call = panic_event,
196}; 229};
197 230
198static int __init setup_notifier(void) 231static int __init voiceblue_setup(void)
199{ 232{
200 /* Setup panic notifier */ 233 /* Setup panic notifier */
201 notifier_chain_register(&panic_notifier_list, &panic_block); 234 notifier_chain_register(&panic_notifier_list, &panic_block);
202 235
203 return 0; 236 return 0;
204} 237}
205 238postcore_initcall(voiceblue_setup);
206postcore_initcall(setup_notifier);
207 239
208static int wdt_gpio_state; 240static int wdt_gpio_state;
209 241
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
new file mode 100644
index 000000000000..e8b3981444cd
--- /dev/null
+++ b/arch/arm/mach-omap1/devices.c
@@ -0,0 +1,351 @@
1/*
2 * linux/arch/arm/mach-omap1/devices.c
3 *
4 * OMAP1 platform device setup/initialization
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/device.h>
17
18#include <asm/hardware.h>
19#include <asm/io.h>
20#include <asm/mach-types.h>
21#include <asm/mach/map.h>
22
23#include <asm/arch/tc.h>
24#include <asm/arch/board.h>
25#include <asm/arch/mux.h>
26#include <asm/arch/gpio.h>
27
28
29static void omap_nop_release(struct device *dev)
30{
31 /* Nothing */
32}
33
34/*-------------------------------------------------------------------------*/
35
36#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
37
38#define OMAP_I2C_BASE 0xfffb3800
39
40static struct resource i2c_resources[] = {
41 {
42 .start = OMAP_I2C_BASE,
43 .end = OMAP_I2C_BASE + 0x3f,
44 .flags = IORESOURCE_MEM,
45 },
46 {
47 .start = INT_I2C,
48 .flags = IORESOURCE_IRQ,
49 },
50};
51
52/* DMA not used; works around erratum writing to non-empty i2c fifo */
53
54static struct platform_device omap_i2c_device = {
55 .name = "i2c_omap",
56 .id = -1,
57 .dev = {
58 .release = omap_nop_release,
59 },
60 .num_resources = ARRAY_SIZE(i2c_resources),
61 .resource = i2c_resources,
62};
63
64static void omap_init_i2c(void)
65{
66 /* FIXME define and use a boot tag, in case of boards that
67 * either don't wire up I2C, or chips that mux it differently...
68 * it can include clocking and address info, maybe more.
69 */
70 omap_cfg_reg(I2C_SCL);
71 omap_cfg_reg(I2C_SDA);
72
73 (void) platform_device_register(&omap_i2c_device);
74}
75#else
76static inline void omap_init_i2c(void) {}
77#endif
78
79/*-------------------------------------------------------------------------*/
80
81#if defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE)
82
83static u64 irda_dmamask = 0xffffffff;
84
85static struct platform_device omap1610ir_device = {
86 .name = "omap1610-ir",
87 .id = -1,
88 .dev = {
89 .release = omap_nop_release,
90 .dma_mask = &irda_dmamask,
91 },
92};
93
94static void omap_init_irda(void)
95{
96 /* FIXME define and use a boot tag, members something like:
97 * u8 uart; // uart1, or uart3
98 * ... but driver only handles uart3 for now
99 * s16 fir_sel; // gpio for SIR vs FIR
100 * ... may prefer a callback for SIR/MIR/FIR mode select;
101 * while h2 uses a GPIO, H3 uses a gpio expander
102 */
103 if (machine_is_omap_h2()
104 || machine_is_omap_h3())
105 (void) platform_device_register(&omap1610ir_device);
106}
107#else
108static inline void omap_init_irda(void) {}
109#endif
110
111/*-------------------------------------------------------------------------*/
112
113#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
114
115#define OMAP_MMC1_BASE 0xfffb7800
116#define OMAP_MMC2_BASE 0xfffb7c00 /* omap16xx only */
117
118static struct omap_mmc_conf mmc1_conf;
119
120static u64 mmc1_dmamask = 0xffffffff;
121
122static struct resource mmc1_resources[] = {
123 {
124 .start = IO_ADDRESS(OMAP_MMC1_BASE),
125 .end = IO_ADDRESS(OMAP_MMC1_BASE) + 0x7f,
126 .flags = IORESOURCE_MEM,
127 },
128 {
129 .start = INT_MMC,
130 .flags = IORESOURCE_IRQ,
131 },
132};
133
134static struct platform_device mmc_omap_device1 = {
135 .name = "mmci-omap",
136 .id = 1,
137 .dev = {
138 .release = omap_nop_release,
139 .dma_mask = &mmc1_dmamask,
140 .platform_data = &mmc1_conf,
141 },
142 .num_resources = ARRAY_SIZE(mmc1_resources),
143 .resource = mmc1_resources,
144};
145
146#ifdef CONFIG_ARCH_OMAP16XX
147
148static struct omap_mmc_conf mmc2_conf;
149
150static u64 mmc2_dmamask = 0xffffffff;
151
152static struct resource mmc2_resources[] = {
153 {
154 .start = IO_ADDRESS(OMAP_MMC2_BASE),
155 .end = IO_ADDRESS(OMAP_MMC2_BASE) + 0x7f,
156 .flags = IORESOURCE_MEM,
157 },
158 {
159 .start = INT_1610_MMC2,
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164static struct platform_device mmc_omap_device2 = {
165 .name = "mmci-omap",
166 .id = 2,
167 .dev = {
168 .release = omap_nop_release,
169 .dma_mask = &mmc2_dmamask,
170 .platform_data = &mmc2_conf,
171 },
172 .num_resources = ARRAY_SIZE(mmc2_resources),
173 .resource = mmc2_resources,
174};
175#endif
176
177static void __init omap_init_mmc(void)
178{
179 const struct omap_mmc_config *mmc_conf;
180 const struct omap_mmc_conf *mmc;
181
182 /* NOTE: assumes MMC was never (wrongly) enabled */
183 mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config);
184 if (!mmc_conf)
185 return;
186
187 /* block 1 is always available and has just one pinout option */
188 mmc = &mmc_conf->mmc[0];
189 if (mmc->enabled) {
190 omap_cfg_reg(MMC_CMD);
191 omap_cfg_reg(MMC_CLK);
192 omap_cfg_reg(MMC_DAT0);
193 if (cpu_is_omap1710()) {
194 omap_cfg_reg(M15_1710_MMC_CLKI);
195 omap_cfg_reg(P19_1710_MMC_CMDDIR);
196 omap_cfg_reg(P20_1710_MMC_DATDIR0);
197 }
198 if (mmc->wire4) {
199 omap_cfg_reg(MMC_DAT1);
200 /* NOTE: DAT2 can be on W10 (here) or M15 */
201 if (!mmc->nomux)
202 omap_cfg_reg(MMC_DAT2);
203 omap_cfg_reg(MMC_DAT3);
204 }
205 mmc1_conf = *mmc;
206 (void) platform_device_register(&mmc_omap_device1);
207 }
208
209#ifdef CONFIG_ARCH_OMAP16XX
210 /* block 2 is on newer chips, and has many pinout options */
211 mmc = &mmc_conf->mmc[1];
212 if (mmc->enabled) {
213 if (!mmc->nomux) {
214 omap_cfg_reg(Y8_1610_MMC2_CMD);
215 omap_cfg_reg(Y10_1610_MMC2_CLK);
216 omap_cfg_reg(R18_1610_MMC2_CLKIN);
217 omap_cfg_reg(W8_1610_MMC2_DAT0);
218 if (mmc->wire4) {
219 omap_cfg_reg(V8_1610_MMC2_DAT1);
220 omap_cfg_reg(W15_1610_MMC2_DAT2);
221 omap_cfg_reg(R10_1610_MMC2_DAT3);
222 }
223
224 /* These are needed for the level shifter */
225 omap_cfg_reg(V9_1610_MMC2_CMDDIR);
226 omap_cfg_reg(V5_1610_MMC2_DATDIR0);
227 omap_cfg_reg(W19_1610_MMC2_DATDIR1);
228 }
229
230 /* Feedback clock must be set on OMAP-1710 MMC2 */
231 if (cpu_is_omap1710())
232 omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
233 MOD_CONF_CTRL_1);
234 mmc2_conf = *mmc;
235 (void) platform_device_register(&mmc_omap_device2);
236 }
237#endif
238 return;
239}
240#else
241static inline void omap_init_mmc(void) {}
242#endif
243
244#if defined(CONFIG_OMAP_RTC) || defined(CONFIG_OMAP_RTC)
245
246#define OMAP_RTC_BASE 0xfffb4800
247
248static struct resource rtc_resources[] = {
249 {
250 .start = OMAP_RTC_BASE,
251 .end = OMAP_RTC_BASE + 0x5f,
252 .flags = IORESOURCE_MEM,
253 },
254 {
255 .start = INT_RTC_TIMER,
256 .flags = IORESOURCE_IRQ,
257 },
258 {
259 .start = INT_RTC_ALARM,
260 .flags = IORESOURCE_IRQ,
261 },
262};
263
264static struct platform_device omap_rtc_device = {
265 .name = "omap_rtc",
266 .id = -1,
267 .dev = {
268 .release = omap_nop_release,
269 },
270 .num_resources = ARRAY_SIZE(rtc_resources),
271 .resource = rtc_resources,
272};
273
274static void omap_init_rtc(void)
275{
276 (void) platform_device_register(&omap_rtc_device);
277}
278#else
279static inline void omap_init_rtc(void) {}
280#endif
281
282/*-------------------------------------------------------------------------*/
283
284#if defined(CONFIG_OMAP16XX_WATCHDOG) || defined(CONFIG_OMAP16XX_WATCHDOG_MODULE)
285
286#define OMAP_WDT_BASE 0xfffeb000
287
288static struct resource wdt_resources[] = {
289 {
290 .start = OMAP_WDT_BASE,
291 .end = OMAP_WDT_BASE + 0x4f,
292 .flags = IORESOURCE_MEM,
293 },
294};
295
296static struct platform_device omap_wdt_device = {
297 .name = "omap1610_wdt",
298 .id = -1,
299 .dev = {
300 .release = omap_nop_release,
301 },
302 .num_resources = ARRAY_SIZE(wdt_resources),
303 .resource = wdt_resources,
304};
305
306static void omap_init_wdt(void)
307{
308 (void) platform_device_register(&omap_wdt_device);
309}
310#else
311static inline void omap_init_wdt(void) {}
312#endif
313
314
315/*-------------------------------------------------------------------------*/
316
317/*
318 * This gets called after board-specific INIT_MACHINE, and initializes most
319 * on-chip peripherals accessible on this board (except for few like USB):
320 *
321 * (a) Does any "standard config" pin muxing needed. Board-specific
322 * code will have muxed GPIO pins and done "nonstandard" setup;
323 * that code could live in the boot loader.
324 * (b) Populating board-specific platform_data with the data drivers
325 * rely on to handle wiring variations.
326 * (c) Creating platform devices as meaningful on this board and
327 * with this kernel configuration.
328 *
329 * Claiming GPIOs, and setting their direction and initial values, is the
330 * responsibility of the device drivers. So is responding to probe().
331 *
332 * Board-specific knowlege like creating devices or pin setup is to be
333 * kept out of drivers as much as possible. In particular, pin setup
334 * may be handled by the boot loader, and drivers should expect it will
335 * normally have been done by the time they're probed.
336 */
337static int __init omap_init_devices(void)
338{
339 /* please keep these calls, and their implementations above,
340 * in alphabetical order so they're easier to sort through.
341 */
342 omap_init_i2c();
343 omap_init_irda();
344 omap_init_mmc();
345 omap_init_rtc();
346 omap_init_wdt();
347
348 return 0;
349}
350arch_initcall(omap_init_devices);
351
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index c12a78335625..aca2a120813a 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/fpga.c 2 * linux/arch/arm/mach-omap1/fpga.c
3 * 3 *
4 * Interrupt handler for OMAP-1510 Innovator FPGA 4 * Interrupt handler for OMAP-1510 Innovator FPGA
5 * 5 *
@@ -181,7 +181,7 @@ void omap1510_fpga_init_irq(void)
181 */ 181 */
182 omap_request_gpio(13); 182 omap_request_gpio(13);
183 omap_set_gpio_direction(13, 1); 183 omap_set_gpio_direction(13, 1);
184 omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE); 184 set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING);
185 set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux); 185 set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux);
186} 186}
187 187
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 207df0fe934d..eb8261d7dead 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -19,6 +19,7 @@
19 19
20extern int clk_init(void); 20extern int clk_init(void);
21extern void omap_check_revision(void); 21extern void omap_check_revision(void);
22extern void omap_sram_init(void);
22 23
23/* 24/*
24 * The machine specific code may provide the extra mapping besides the 25 * The machine specific code may provide the extra mapping besides the
@@ -32,7 +33,6 @@ static struct map_desc omap_io_desc[] __initdata = {
32static struct map_desc omap730_io_desc[] __initdata = { 33static struct map_desc omap730_io_desc[] __initdata = {
33 { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE }, 34 { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE },
34 { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE }, 35 { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE },
35 { OMAP730_SRAM_BASE, OMAP730_SRAM_START, OMAP730_SRAM_SIZE, MT_DEVICE }
36}; 36};
37#endif 37#endif
38 38
@@ -40,27 +40,13 @@ static struct map_desc omap730_io_desc[] __initdata = {
40static struct map_desc omap1510_io_desc[] __initdata = { 40static struct map_desc omap1510_io_desc[] __initdata = {
41 { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE }, 41 { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE },
42 { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE }, 42 { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE },
43 { OMAP1510_SRAM_BASE, OMAP1510_SRAM_START, OMAP1510_SRAM_SIZE, MT_DEVICE }
44}; 43};
45#endif 44#endif
46 45
47#if defined(CONFIG_ARCH_OMAP16XX) 46#if defined(CONFIG_ARCH_OMAP16XX)
48static struct map_desc omap1610_io_desc[] __initdata = { 47static struct map_desc omap16xx_io_desc[] __initdata = {
49 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE }, 48 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
50 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE }, 49 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
51 { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP1610_SRAM_SIZE, MT_DEVICE }
52};
53
54static struct map_desc omap5912_io_desc[] __initdata = {
55 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
56 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
57/*
58 * The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page
59 * size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped.
60 * Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte
61 * can be used.
62 */
63 { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP5912_SRAM_SIZE + 0x800, MT_DEVICE }
64}; 50};
65#endif 51#endif
66 52
@@ -86,14 +72,13 @@ static void __init _omap_map_io(void)
86 } 72 }
87#endif 73#endif
88#if defined(CONFIG_ARCH_OMAP16XX) 74#if defined(CONFIG_ARCH_OMAP16XX)
89 if (cpu_is_omap1610() || cpu_is_omap1710()) { 75 if (cpu_is_omap16xx()) {
90 iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc)); 76 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
91 }
92 if (cpu_is_omap5912()) {
93 iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc));
94 } 77 }
95#endif 78#endif
96 79
80 omap_sram_init();
81
97 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort 82 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
98 * on a Posted Write in the TIPB Bridge". 83 * on a Posted Write in the TIPB Bridge".
99 */ 84 */
@@ -108,8 +93,9 @@ static void __init _omap_map_io(void)
108/* 93/*
109 * This should only get called from board specific init 94 * This should only get called from board specific init
110 */ 95 */
111void omap_map_common_io(void) 96void __init omap_map_common_io(void)
112{ 97{
113 if (!initialized) 98 if (!initialized)
114 _omap_map_io(); 99 _omap_map_io();
115} 100}
101
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index afd5d67e4ae7..192ce6055faa 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/irq.c 2 * linux/arch/arm/mach-omap1/irq.c
3 * 3 *
4 * Interrupt handler for all OMAP boards 4 * Interrupt handler for all OMAP boards
5 * 5 *
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
index ec0d8285f243..be283cda63dd 100644
--- a/arch/arm/mach-omap1/leds-h2p2-debug.c
+++ b/arch/arm/mach-omap1/leds-h2p2-debug.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/leds-h2p2-debug.c 2 * linux/arch/arm/mach-omap1/leds-h2p2-debug.c
3 * 3 *
4 * Copyright 2003 by Texas Instruments Incorporated 4 * Copyright 2003 by Texas Instruments Incorporated
5 * 5 *
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/version.h>
16 17
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/hardware.h> 19#include <asm/hardware.h>
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c
index 8043b7d0f66e..c8ffd1ddcded 100644
--- a/arch/arm/mach-omap1/leds-innovator.c
+++ b/arch/arm/mach-omap1/leds-innovator.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/leds-innovator.c 2 * linux/arch/arm/mach-omap1/leds-innovator.c
3 */ 3 */
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/init.h> 5#include <linux/init.h>
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index 4a0e8b9d4fc3..2c8bda847c18 100644
--- a/arch/arm/mach-omap1/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/leds-osk.c 2 * linux/arch/arm/mach-omap1/leds-osk.c
3 * 3 *
4 * LED driver for OSK, and optionally Mistral QVGA, boards 4 * LED driver for OSK, and optionally Mistral QVGA, boards
5 */ 5 */
@@ -64,7 +64,7 @@ static void tps_work(void *unused)
64 64
65static DECLARE_WORK(work, tps_work, NULL); 65static DECLARE_WORK(work, tps_work, NULL);
66 66
67#ifdef CONFIG_FB_OMAP 67#ifdef CONFIG_OMAP_OSK_MISTRAL
68 68
69/* For now, all system indicators require the Mistral board, since that 69/* For now, all system indicators require the Mistral board, since that
70 * LED can be manipulated without a task context. This LED is either red, 70 * LED can be manipulated without a task context. This LED is either red,
@@ -127,7 +127,7 @@ void osk_leds_event(led_event_t evt)
127 hw_led_state = 0; 127 hw_led_state = 0;
128 break; 128 break;
129 129
130#ifdef CONFIG_FB_OMAP 130#ifdef CONFIG_OMAP_OSK_MISTRAL
131 131
132 case led_timer: 132 case led_timer:
133 hw_led_state ^= TIMER_LED; 133 hw_led_state ^= TIMER_LED;
@@ -144,7 +144,7 @@ void osk_leds_event(led_event_t evt)
144 mistral_setled(); 144 mistral_setled();
145 break; 145 break;
146 146
147#endif /* CONFIG_FB_OMAP */ 147#endif /* CONFIG_OMAP_OSK_MISTRAL */
148 148
149 /* "green" == tps LED1 (leftmost, normally power-good) 149 /* "green" == tps LED1 (leftmost, normally power-good)
150 * works only with DC adapter, not on battery power! 150 * works only with DC adapter, not on battery power!
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c
index 8ab21fe98e1b..5c6b1bb6e722 100644
--- a/arch/arm/mach-omap1/leds.c
+++ b/arch/arm/mach-omap1/leds.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/leds.c 2 * linux/arch/arm/mach-omap1/leds.c
3 * 3 *
4 * OMAP LEDs dispatcher 4 * OMAP LEDs dispatcher
5 */ 5 */
@@ -20,7 +20,9 @@ omap_leds_init(void)
20 if (machine_is_omap_innovator()) 20 if (machine_is_omap_innovator())
21 leds_event = innovator_leds_event; 21 leds_event = innovator_leds_event;
22 22
23 else if (machine_is_omap_h2() || machine_is_omap_perseus2()) 23 else if (machine_is_omap_h2()
24 || machine_is_omap_h3()
25 || machine_is_omap_perseus2())
24 leds_event = h2p2_dbg_leds_event; 26 leds_event = h2p2_dbg_leds_event;
25 27
26 else if (machine_is_omap_osk()) 28 else if (machine_is_omap_osk())
@@ -30,8 +32,12 @@ omap_leds_init(void)
30 return -1; 32 return -1;
31 33
32 if (machine_is_omap_h2() 34 if (machine_is_omap_h2()
35 || machine_is_omap_h3()
33 || machine_is_omap_perseus2() 36 || machine_is_omap_perseus2()
34 || machine_is_omap_osk()) { 37#ifdef CONFIG_OMAP_OSK_MISTRAL
38 || machine_is_omap_osk()
39#endif
40 ) {
35 41
36 /* LED1/LED2 pins can be used as GPIO (as done here), or by 42 /* LED1/LED2 pins can be used as GPIO (as done here), or by
37 * the LPG (works even in deep sleep!), to drive a bicolor 43 * the LPG (works even in deep sleep!), to drive a bicolor
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 214e5d17c8b5..40c4f7c40e73 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -24,7 +24,11 @@
24 24
25#include <asm/arch/board.h> 25#include <asm/arch/board.h>
26#include <asm/arch/mux.h> 26#include <asm/arch/mux.h>
27#include <asm/arch/gpio.h>
27#include <asm/arch/fpga.h> 28#include <asm/arch/fpga.h>
29#ifdef CONFIG_PM
30#include <asm/arch/pm.h>
31#endif
28 32
29static struct clk * uart1_ck = NULL; 33static struct clk * uart1_ck = NULL;
30static struct clk * uart2_ck = NULL; 34static struct clk * uart2_ck = NULL;
@@ -94,7 +98,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
94 98
95static struct platform_device serial_device = { 99static struct platform_device serial_device = {
96 .name = "serial8250", 100 .name = "serial8250",
97 .id = 0, 101 .id = PLAT8250_DEV_PLATFORM,
98 .dev = { 102 .dev = {
99 .platform_data = serial_platform_data, 103 .platform_data = serial_platform_data,
100 }, 104 },
@@ -193,6 +197,86 @@ void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
193 } 197 }
194} 198}
195 199
200#ifdef CONFIG_OMAP_SERIAL_WAKE
201
202static irqreturn_t omap_serial_wake_interrupt(int irq, void *dev_id,
203 struct pt_regs *regs)
204{
205 /* Need to do something with serial port right after wake-up? */
206 return IRQ_HANDLED;
207}
208
209/*
210 * Reroutes serial RX lines to GPIO lines for the duration of
211 * sleep to allow waking up the device from serial port even
212 * in deep sleep.
213 */
214void omap_serial_wake_trigger(int enable)
215{
216 if (!cpu_is_omap16xx())
217 return;
218
219 if (uart1_ck != NULL) {
220 if (enable)
221 omap_cfg_reg(V14_16XX_GPIO37);
222 else
223 omap_cfg_reg(V14_16XX_UART1_RX);
224 }
225 if (uart2_ck != NULL) {
226 if (enable)
227 omap_cfg_reg(R9_16XX_GPIO18);
228 else
229 omap_cfg_reg(R9_16XX_UART2_RX);
230 }
231 if (uart3_ck != NULL) {
232 if (enable)
233 omap_cfg_reg(L14_16XX_GPIO49);
234 else
235 omap_cfg_reg(L14_16XX_UART3_RX);
236 }
237}
238
239static void __init omap_serial_set_port_wakeup(int gpio_nr)
240{
241 int ret;
242
243 ret = omap_request_gpio(gpio_nr);
244 if (ret < 0) {
245 printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
246 gpio_nr);
247 return;
248 }
249 omap_set_gpio_direction(gpio_nr, 1);
250 set_irq_type(OMAP_GPIO_IRQ(gpio_nr), IRQT_RISING);
251 ret = request_irq(OMAP_GPIO_IRQ(gpio_nr), &omap_serial_wake_interrupt,
252 0, "serial wakeup", NULL);
253 if (ret) {
254 omap_free_gpio(gpio_nr);
255 printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n",
256 gpio_nr);
257 return;
258 }
259 enable_irq_wake(OMAP_GPIO_IRQ(gpio_nr));
260}
261
262static int __init omap_serial_wakeup_init(void)
263{
264 if (!cpu_is_omap16xx())
265 return 0;
266
267 if (uart1_ck != NULL)
268 omap_serial_set_port_wakeup(37);
269 if (uart2_ck != NULL)
270 omap_serial_set_port_wakeup(18);
271 if (uart3_ck != NULL)
272 omap_serial_set_port_wakeup(49);
273
274 return 0;
275}
276late_initcall(omap_serial_wakeup_init);
277
278#endif /* CONFIG_OMAP_SERIAL_WAKE */
279
196static int __init omap_init(void) 280static int __init omap_init(void)
197{ 281{
198 return platform_device_register(&serial_device); 282 return platform_device_register(&serial_device);
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index d540539c9bbb..191a9b1ee9b7 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -247,13 +247,6 @@ unsigned long long sched_clock(void)
247#define OMAP_32K_TIMER_TCR 0x04 247#define OMAP_32K_TIMER_TCR 0x04
248 248
249#define OMAP_32K_TICKS_PER_HZ (32768 / HZ) 249#define OMAP_32K_TICKS_PER_HZ (32768 / HZ)
250#if (32768 % HZ) != 0
251/* We cannot ignore modulo.
252 * Potential error can be as high as several percent.
253 */
254#define OMAP_32K_TICK_MODULO (32768 % HZ)
255static unsigned modulo_count = 0; /* Counts 1/HZ units */
256#endif
257 250
258/* 251/*
259 * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1 252 * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
@@ -296,13 +289,22 @@ static inline void omap_32k_timer_stop(void)
296} 289}
297 290
298/* 291/*
299 * Rounds down to nearest usec 292 * Rounds down to nearest usec. Note that this will overflow for larger values.
300 */ 293 */
301static inline unsigned long omap_32k_ticks_to_usecs(unsigned long ticks_32k) 294static inline unsigned long omap_32k_ticks_to_usecs(unsigned long ticks_32k)
302{ 295{
303 return (ticks_32k * 5*5*5*5*5*5) >> 9; 296 return (ticks_32k * 5*5*5*5*5*5) >> 9;
304} 297}
305 298
299/*
300 * Rounds down to nearest nsec.
301 */
302static inline unsigned long long
303omap_32k_ticks_to_nsecs(unsigned long ticks_32k)
304{
305 return (unsigned long long) ticks_32k * 1000 * 5*5*5*5*5*5 >> 9;
306}
307
306static unsigned long omap_32k_last_tick = 0; 308static unsigned long omap_32k_last_tick = 0;
307 309
308/* 310/*
@@ -315,6 +317,15 @@ static unsigned long omap_32k_timer_gettimeoffset(void)
315} 317}
316 318
317/* 319/*
320 * Returns current time from boot in nsecs. It's OK for this to wrap
321 * around for now, as it's just a relative time stamp.
322 */
323unsigned long long sched_clock(void)
324{
325 return omap_32k_ticks_to_nsecs(omap_32k_sync_timer_read());
326}
327
328/*
318 * Timer interrupt for 32KHz timer. When dynamic tick is enabled, this 329 * Timer interrupt for 32KHz timer. When dynamic tick is enabled, this
319 * function is also called from other interrupts to remove latency 330 * function is also called from other interrupts to remove latency
320 * issues with dynamic tick. In the dynamic tick case, we need to lock 331 * issues with dynamic tick. In the dynamic tick case, we need to lock
@@ -330,19 +341,6 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
330 now = omap_32k_sync_timer_read(); 341 now = omap_32k_sync_timer_read();
331 342
332 while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) { 343 while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) {
333#ifdef OMAP_32K_TICK_MODULO
334 /* Modulo addition may put omap_32k_last_tick ahead of now
335 * and cause unwanted repetition of the while loop.
336 */
337 if (unlikely(now - omap_32k_last_tick == ~0))
338 break;
339
340 modulo_count += OMAP_32K_TICK_MODULO;
341 if (modulo_count > HZ) {
342 ++omap_32k_last_tick;
343 modulo_count -= HZ;
344 }
345#endif
346 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ; 344 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
347 timer_tick(regs); 345 timer_tick(regs);
348 } 346 }
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 29185acdd9e1..07b5dd453565 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -131,27 +131,12 @@ static struct platform_device corgits_device = {
131/* 131/*
132 * MMC/SD Device 132 * MMC/SD Device
133 * 133 *
134 * The card detect interrupt isn't debounced so we delay it by HZ/4 134 * The card detect interrupt isn't debounced so we delay it by 250ms
135 * to give the card a chance to fully insert/eject. 135 * to give the card a chance to fully insert/eject.
136 */ 136 */
137static struct mmc_detect { 137static struct pxamci_platform_data corgi_mci_platform_data;
138 struct timer_list detect_timer;
139 void *devid;
140} mmc_detect;
141 138
142static void mmc_detect_callback(unsigned long data) 139static int corgi_mci_init(struct device *dev, irqreturn_t (*corgi_detect_int)(int, void *, struct pt_regs *), void *data)
143{
144 mmc_detect_change(mmc_detect.devid);
145}
146
147static irqreturn_t corgi_mmc_detect_int(int irq, void *devid, struct pt_regs *regs)
148{
149 mmc_detect.devid=devid;
150 mod_timer(&mmc_detect.detect_timer, jiffies + HZ/4);
151 return IRQ_HANDLED;
152}
153
154static int corgi_mci_init(struct device *dev, irqreturn_t (*unused_detect_int)(int, void *, struct pt_regs *), void *data)
155{ 140{
156 int err; 141 int err;
157 142
@@ -161,11 +146,9 @@ static int corgi_mci_init(struct device *dev, irqreturn_t (*unused_detect_int)(i
161 pxa_gpio_mode(CORGI_GPIO_nSD_DETECT | GPIO_IN); 146 pxa_gpio_mode(CORGI_GPIO_nSD_DETECT | GPIO_IN);
162 pxa_gpio_mode(CORGI_GPIO_SD_PWR | GPIO_OUT); 147 pxa_gpio_mode(CORGI_GPIO_SD_PWR | GPIO_OUT);
163 148
164 init_timer(&mmc_detect.detect_timer); 149 corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250);
165 mmc_detect.detect_timer.function = mmc_detect_callback;
166 mmc_detect.detect_timer.data = (unsigned long) &mmc_detect;
167 150
168 err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_mmc_detect_int, SA_INTERRUPT, 151 err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int, SA_INTERRUPT,
169 "MMC card detect", data); 152 "MMC card detect", data);
170 if (err) { 153 if (err) {
171 printk(KERN_ERR "corgi_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); 154 printk(KERN_ERR "corgi_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
@@ -198,7 +181,6 @@ static int corgi_mci_get_ro(struct device *dev)
198static void corgi_mci_exit(struct device *dev, void *data) 181static void corgi_mci_exit(struct device *dev, void *data)
199{ 182{
200 free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data); 183 free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data);
201 del_timer(&mmc_detect.detect_timer);
202} 184}
203 185
204static struct pxamci_platform_data corgi_mci_platform_data = { 186static struct pxamci_platform_data corgi_mci_platform_data = {
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c
index 8ccffba0018f..366a9bde3d8b 100644
--- a/arch/arm/mach-pxa/corgi_ssp.c
+++ b/arch/arm/mach-pxa/corgi_ssp.c
@@ -22,7 +22,7 @@
22#include <asm/arch/corgi.h> 22#include <asm/arch/corgi.h>
23#include <asm/arch/pxa-regs.h> 23#include <asm/arch/pxa-regs.h>
24 24
25static spinlock_t corgi_ssp_lock = SPIN_LOCK_UNLOCKED; 25static DEFINE_SPINLOCK(corgi_ssp_lock);
26static struct ssp_dev corgi_ssp_dev; 26static struct ssp_dev corgi_ssp_dev;
27static struct ssp_state corgi_ssp_state; 27static struct ssp_state corgi_ssp_state;
28 28
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index a10268618f74..e3587efec4bf 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -140,7 +140,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
140 140
141static struct platform_device serial_device = { 141static struct platform_device serial_device = {
142 .name = "serial8250", 142 .name = "serial8250",
143 .id = 0, 143 .id = PLAT8250_DEV_PLATFORM,
144 .dev = { 144 .dev = {
145 .platform_data = serial_platform_data, 145 .platform_data = serial_platform_data,
146 }, 146 },
diff --git a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c
index 4664bd11adc1..0077937a7ab8 100644
--- a/arch/arm/mach-s3c2410/devs.c
+++ b/arch/arm/mach-s3c2410/devs.c
@@ -29,7 +29,7 @@
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <asm/mach/irq.h> 31#include <asm/mach/irq.h>
32 32#include <asm/arch/fb.h>
33#include <asm/hardware.h> 33#include <asm/hardware.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
@@ -103,6 +103,15 @@ struct platform_device s3c_device_lcd = {
103 103
104EXPORT_SYMBOL(s3c_device_lcd); 104EXPORT_SYMBOL(s3c_device_lcd);
105 105
106static struct s3c2410fb_mach_info s3c2410fb_info;
107
108void __init set_s3c2410fb_info(struct s3c2410fb_mach_info *hard_s3c2410fb_info)
109{
110 memcpy(&s3c2410fb_info,hard_s3c2410fb_info,sizeof(struct s3c2410fb_mach_info));
111 s3c_device_lcd.dev.platform_data = &s3c2410fb_info;
112}
113EXPORT_SYMBOL(set_s3c2410fb_info);
114
106/* NAND Controller */ 115/* NAND Controller */
107 116
108static struct resource s3c_nand_resource[] = { 117static struct resource s3c_nand_resource[] = {
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index e9182242da95..1a3367da6408 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -381,7 +381,7 @@ static struct plat_serial8250_port bast_sio_data[] = {
381 381
382static struct platform_device bast_sio = { 382static struct platform_device bast_sio = {
383 .name = "serial8250", 383 .name = "serial8250",
384 .id = 0, 384 .id = PLAT8250_DEV_PLATFORM,
385 .dev = { 385 .dev = {
386 .platform_data = &bast_sio_data, 386 .platform_data = &bast_sio_data,
387 }, 387 },
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index ea4fb1a97a50..6ff1889fbd21 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -45,6 +45,9 @@
45 45
46//#include <asm/debug-ll.h> 46//#include <asm/debug-ll.h>
47#include <asm/arch/regs-serial.h> 47#include <asm/arch/regs-serial.h>
48#include <asm/arch/regs-lcd.h>
49
50#include <asm/arch/fb.h>
48 51
49#include <linux/serial_core.h> 52#include <linux/serial_core.h>
50 53
@@ -88,6 +91,48 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = {
88 91
89 92
90 93
94/**
95 * Set lcd on or off
96 **/
97static struct s3c2410fb_mach_info h1940_lcdcfg __initdata = {
98 .fixed_syncs= 1,
99 .regs={
100 .lcdcon1= S3C2410_LCDCON1_TFT16BPP | \
101 S3C2410_LCDCON1_TFT | \
102 S3C2410_LCDCON1_CLKVAL(0x0C),
103
104 .lcdcon2= S3C2410_LCDCON2_VBPD(7) | \
105 S3C2410_LCDCON2_LINEVAL(319) | \
106 S3C2410_LCDCON2_VFPD(6) | \
107 S3C2410_LCDCON2_VSPW(0),
108
109 .lcdcon3= S3C2410_LCDCON3_HBPD(19) | \
110 S3C2410_LCDCON3_HOZVAL(239) | \
111 S3C2410_LCDCON3_HFPD(7),
112
113 .lcdcon4= S3C2410_LCDCON4_MVAL(0) | \
114 S3C2410_LCDCON4_HSPW(3),
115
116 .lcdcon5= S3C2410_LCDCON5_FRM565 | \
117 S3C2410_LCDCON5_INVVLINE | \
118 S3C2410_LCDCON5_HWSWP,
119 },
120 .lpcsel= 0x02,
121 .gpccon= 0xaa940659,
122 .gpccon_mask= 0xffffffff,
123 .gpcup= 0x0000ffff,
124 .gpcup_mask= 0xffffffff,
125 .gpdcon= 0xaa84aaa0,
126 .gpdcon_mask= 0xffffffff,
127 .gpdup= 0x0000faff,
128 .gpdup_mask= 0xffffffff,
129
130 .width= 240,
131 .height= 320,
132 .xres= {240,240,240},
133 .yres= {320,320,320},
134 .bpp= {16,16,16},
135};
91 136
92static struct platform_device *h1940_devices[] __initdata = { 137static struct platform_device *h1940_devices[] __initdata = {
93 &s3c_device_usb, 138 &s3c_device_usb,
@@ -116,6 +161,11 @@ void __init h1940_init_irq(void)
116 161
117} 162}
118 163
164void __init h1940_init(void)
165{
166 set_s3c2410fb_info(&h1940_lcdcfg);
167}
168
119MACHINE_START(H1940, "IPAQ-H1940") 169MACHINE_START(H1940, "IPAQ-H1940")
120 /* Maintainer: Ben Dooks <ben@fluff.org> */ 170 /* Maintainer: Ben Dooks <ben@fluff.org> */
121 .phys_ram = S3C2410_SDRAM_PA, 171 .phys_ram = S3C2410_SDRAM_PA,
@@ -124,5 +174,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
124 .boot_params = S3C2410_SDRAM_PA + 0x100, 174 .boot_params = S3C2410_SDRAM_PA + 0x100,
125 .map_io = h1940_map_io, 175 .map_io = h1940_map_io,
126 .init_irq = h1940_init_irq, 176 .init_irq = h1940_init_irq,
177 .init_machine = h1940_init,
127 .timer = &s3c24xx_timer, 178 .timer = &s3c24xx_timer,
128MACHINE_END 179MACHINE_END
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 924e8464c212..8f9ab2893df4 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -221,7 +221,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
221 221
222static struct platform_device serial_device = { 222static struct platform_device serial_device = {
223 .name = "serial8250", 223 .name = "serial8250",
224 .id = 0, 224 .id = PLAT8250_DEV_PLATFORM,
225 .dev = { 225 .dev = {
226 .platform_data = serial_platform_data, 226 .platform_data = serial_platform_data,
227 }, 227 },
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index e737eae4521f..946c0d11c73b 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -41,7 +41,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
41 41
42static struct platform_device serial_device = { 42static struct platform_device serial_device = {
43 .name = "serial8250", 43 .name = "serial8250",
44 .id = 0, 44 .id = PLAT8250_DEV_PLATFORM,
45 .dev = { 45 .dev = {
46 .platform_data = serial_platform_data, 46 .platform_data = serial_platform_data,
47 }, 47 },
diff --git a/arch/arm/mm/copypage-v3.S b/arch/arm/mm/copypage-v3.S
index 4940f1908316..3c58ebbf0359 100644
--- a/arch/arm/mm/copypage-v3.S
+++ b/arch/arm/mm/copypage-v3.S
@@ -12,7 +12,7 @@
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15#include <asm/constants.h> 15#include <asm/asm-offsets.h>
16 16
17 .text 17 .text
18 .align 5 18 .align 5
diff --git a/arch/arm/mm/copypage-v4wb.S b/arch/arm/mm/copypage-v4wb.S
index b94c345ceb94..83117354b1cd 100644
--- a/arch/arm/mm/copypage-v4wb.S
+++ b/arch/arm/mm/copypage-v4wb.S
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/constants.h> 14#include <asm/asm-offsets.h>
15 15
16 .text 16 .text
17 .align 5 17 .align 5
diff --git a/arch/arm/mm/copypage-v4wt.S b/arch/arm/mm/copypage-v4wt.S
index 976793937a93..e1f2af28d549 100644
--- a/arch/arm/mm/copypage-v4wt.S
+++ b/arch/arm/mm/copypage-v4wt.S
@@ -14,7 +14,7 @@
14 */ 14 */
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <asm/constants.h> 17#include <asm/asm-offsets.h>
18 18
19 .text 19 .text
20 .align 5 20 .align 5
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 191788fb18d1..b0208c992576 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -16,6 +16,58 @@
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17 17
18#ifdef CONFIG_CPU_CACHE_VIPT 18#ifdef CONFIG_CPU_CACHE_VIPT
19
20void flush_cache_mm(struct mm_struct *mm)
21{
22 if (cache_is_vivt()) {
23 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask))
24 __cpuc_flush_user_all();
25 return;
26 }
27
28 if (cache_is_vipt_aliasing()) {
29 asm( "mcr p15, 0, %0, c7, c14, 0\n"
30 " mcr p15, 0, %0, c7, c5, 0\n"
31 " mcr p15, 0, %0, c7, c10, 4"
32 :
33 : "r" (0)
34 : "cc");
35 }
36}
37
38void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
39{
40 if (cache_is_vivt()) {
41 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask))
42 __cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
43 vma->vm_flags);
44 return;
45 }
46
47 if (cache_is_vipt_aliasing()) {
48 asm( "mcr p15, 0, %0, c7, c14, 0\n"
49 " mcr p15, 0, %0, c7, c5, 0\n"
50 " mcr p15, 0, %0, c7, c10, 4"
51 :
52 : "r" (0)
53 : "cc");
54 }
55}
56
57void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
58{
59 if (cache_is_vivt()) {
60 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
61 unsigned long addr = user_addr & PAGE_MASK;
62 __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
63 }
64 return;
65 }
66
67 if (cache_is_vipt_aliasing())
68 flush_pfn_alias(pfn, user_addr);
69}
70
19#define ALIAS_FLUSH_START 0xffff4000 71#define ALIAS_FLUSH_START 0xffff4000
20 72
21#define TOP_PTE(x) pte_offset_kernel(top_pmd, x) 73#define TOP_PTE(x) pte_offset_kernel(top_pmd, x)
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index 5c0ae5260d1c..1d739d282a45 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -28,7 +28,7 @@
28#include <linux/config.h> 28#include <linux/config.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <asm/assembler.h> 30#include <asm/assembler.h>
31#include <asm/constants.h> 31#include <asm/asm-offsets.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/procinfo.h> 33#include <asm/procinfo.h>
34#include <asm/ptrace.h> 34#include <asm/ptrace.h>
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index d69389c4d4ba..9b725665b5c7 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -28,7 +28,7 @@
28#include <linux/config.h> 28#include <linux/config.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <asm/assembler.h> 30#include <asm/assembler.h>
31#include <asm/constants.h> 31#include <asm/asm-offsets.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/procinfo.h> 33#include <asm/procinfo.h>
34#include <asm/ptrace.h> 34#include <asm/ptrace.h>
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index 747ed963e1df..37b70fa21c76 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -17,7 +17,7 @@
17#include <linux/config.h> 17#include <linux/config.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <asm/assembler.h> 19#include <asm/assembler.h>
20#include <asm/constants.h> 20#include <asm/asm-offsets.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22#include <asm/procinfo.h> 22#include <asm/procinfo.h>
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index 248110c9cf13..931b690d1be2 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -17,7 +17,7 @@
17#include <linux/config.h> 17#include <linux/config.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <asm/assembler.h> 19#include <asm/assembler.h>
20#include <asm/constants.h> 20#include <asm/asm-offsets.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22#include <asm/procinfo.h> 22#include <asm/procinfo.h>
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
diff --git a/arch/arm/mm/proc-arm6_7.S b/arch/arm/mm/proc-arm6_7.S
index 189ef6a71ba1..d0f1bbb48f6c 100644
--- a/arch/arm/mm/proc-arm6_7.S
+++ b/arch/arm/mm/proc-arm6_7.S
@@ -13,7 +13,7 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm/assembler.h> 15#include <asm/assembler.h>
16#include <asm/constants.h> 16#include <asm/asm-offsets.h>
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <asm/procinfo.h> 18#include <asm/procinfo.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index 57cfa6a2f54f..c69c9de32391 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -33,7 +33,7 @@
33#include <linux/linkage.h> 33#include <linux/linkage.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <asm/assembler.h> 35#include <asm/assembler.h>
36#include <asm/constants.h> 36#include <asm/asm-offsets.h>
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
38#include <asm/procinfo.h> 38#include <asm/procinfo.h>
39#include <asm/ptrace.h> 39#include <asm/ptrace.h>
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index 9137fe563599..7cfc2604a1ee 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -4,7 +4,7 @@
4 * VMA_VM_FLAGS 4 * VMA_VM_FLAGS
5 * VM_EXEC 5 * VM_EXEC
6 */ 6 */
7#include <asm/constants.h> 7#include <asm/asm-offsets.h>
8#include <asm/thread_info.h> 8#include <asm/thread_info.h>
9 9
10/* 10/*
diff --git a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S
index 360cae905692..34f7e7d3f419 100644
--- a/arch/arm/mm/proc-sa110.S
+++ b/arch/arm/mm/proc-sa110.S
@@ -15,7 +15,7 @@
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <asm/assembler.h> 17#include <asm/assembler.h>
18#include <asm/constants.h> 18#include <asm/asm-offsets.h>
19#include <asm/procinfo.h> 19#include <asm/procinfo.h>
20#include <asm/hardware.h> 20#include <asm/hardware.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index d447cd5f3dd9..ca14f80d5ab4 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -20,7 +20,7 @@
20#include <linux/linkage.h> 20#include <linux/linkage.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <asm/assembler.h> 22#include <asm/assembler.h>
23#include <asm/constants.h> 23#include <asm/asm-offsets.h>
24#include <asm/procinfo.h> 24#include <asm/procinfo.h>
25#include <asm/hardware.h> 25#include <asm/hardware.h>
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 139a38670c5d..eb34823c9dbf 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14#include <asm/constants.h> 14#include <asm/asm-offsets.h>
15#include <asm/procinfo.h> 15#include <asm/procinfo.h>
16#include <asm/pgtable.h> 16#include <asm/pgtable.h>
17 17
diff --git a/arch/arm/mm/tlb-v3.S b/arch/arm/mm/tlb-v3.S
index 44b0daeaff9b..c10786ec8e0a 100644
--- a/arch/arm/mm/tlb-v3.S
+++ b/arch/arm/mm/tlb-v3.S
@@ -13,7 +13,7 @@
13 */ 13 */
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <asm/constants.h> 16#include <asm/asm-offsets.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18#include "proc-macros.S" 18#include "proc-macros.S"
19 19
diff --git a/arch/arm/mm/tlb-v4.S b/arch/arm/mm/tlb-v4.S
index db82ee468248..d6c94457c2b9 100644
--- a/arch/arm/mm/tlb-v4.S
+++ b/arch/arm/mm/tlb-v4.S
@@ -14,7 +14,7 @@
14 */ 14 */
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <asm/constants.h> 17#include <asm/asm-offsets.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include "proc-macros.S" 19#include "proc-macros.S"
20 20
diff --git a/arch/arm/mm/tlb-v4wb.S b/arch/arm/mm/tlb-v4wb.S
index 7908d5f1f130..cb829ca7845d 100644
--- a/arch/arm/mm/tlb-v4wb.S
+++ b/arch/arm/mm/tlb-v4wb.S
@@ -14,7 +14,7 @@
14 */ 14 */
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <asm/constants.h> 17#include <asm/asm-offsets.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include "proc-macros.S" 19#include "proc-macros.S"
20 20
diff --git a/arch/arm/mm/tlb-v4wbi.S b/arch/arm/mm/tlb-v4wbi.S
index efbe94bbe1a7..60cfc4a25dd5 100644
--- a/arch/arm/mm/tlb-v4wbi.S
+++ b/arch/arm/mm/tlb-v4wbi.S
@@ -14,7 +14,7 @@
14 */ 14 */
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <asm/constants.h> 17#include <asm/asm-offsets.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include "proc-macros.S" 19#include "proc-macros.S"
20 20
diff --git a/arch/arm/mm/tlb-v6.S b/arch/arm/mm/tlb-v6.S
index 99ed26e78adf..6f76b89ef46e 100644
--- a/arch/arm/mm/tlb-v6.S
+++ b/arch/arm/mm/tlb-v6.S
@@ -11,7 +11,7 @@
11 * These assume a split I/D TLB. 11 * These assume a split I/D TLB.
12 */ 12 */
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/constants.h> 14#include <asm/asm-offsets.h>
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17#include "proc-macros.S" 17#include "proc-macros.S"
diff --git a/arch/arm/nwfpe/entry26.S b/arch/arm/nwfpe/entry26.S
index 0ed38b0913db..51940a96d6a6 100644
--- a/arch/arm/nwfpe/entry26.S
+++ b/arch/arm/nwfpe/entry26.S
@@ -20,7 +20,7 @@
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/ 21*/
22 22
23#include <asm/constants.h> 23#include <asm/asm-offsets.h>
24 24
25/* This is the kernel's entry point into the floating point emulator. 25/* This is the kernel's entry point into the floating point emulator.
26It is called from the kernel with code similar to this: 26It is called from the kernel with code similar to this:
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index e73c8deca592..6f17187ab32a 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -17,7 +17,7 @@
17 */ 17 */
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <asm/constants.h> 20#include <asm/asm-offsets.h>
21#include <asm/vfpmacros.h> 21#include <asm/vfpmacros.h>
22 22
23 .globl do_vfp 23 .globl do_vfp
diff --git a/arch/arm26/Makefile b/arch/arm26/Makefile
index e9cb8ef4f3fb..844a9e46886e 100644
--- a/arch/arm26/Makefile
+++ b/arch/arm26/Makefile
@@ -49,10 +49,6 @@ all: zImage
49 49
50boot := arch/arm26/boot 50boot := arch/arm26/boot
51 51
52prepare: include/asm-$(ARCH)/asm_offsets.h
53CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
54
55
56.PHONY: maketools FORCE 52.PHONY: maketools FORCE
57maketools: FORCE 53maketools: FORCE
58 54
@@ -94,12 +90,6 @@ zi:; $(Q)$(MAKE) $(build)=$(boot) zinstall
94 fi; \ 90 fi; \
95 ) 91 )
96 92
97arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
98 include/config/MARKER
99
100include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
101 $(call filechk,gen-asm-offsets)
102
103define archhelp 93define archhelp
104 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' 94 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
105 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' 95 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
diff --git a/arch/arm26/kernel/entry.S b/arch/arm26/kernel/entry.S
index a231dd88d0e1..6d910ea43d34 100644
--- a/arch/arm26/kernel/entry.S
+++ b/arch/arm26/kernel/entry.S
@@ -10,7 +10,7 @@
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11 11
12#include <asm/assembler.h> 12#include <asm/assembler.h>
13#include <asm/asm_offsets.h> 13#include <asm/asm-offsets.h>
14#include <asm/errno.h> 14#include <asm/errno.h>
15#include <asm/hardware.h> 15#include <asm/hardware.h>
16#include <asm/sysirq.h> 16#include <asm/sysirq.h>
diff --git a/arch/arm26/lib/copy_page.S b/arch/arm26/lib/copy_page.S
index 2d79ee12ea1f..c7511a2739d3 100644
--- a/arch/arm26/lib/copy_page.S
+++ b/arch/arm26/lib/copy_page.S
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14#include <asm/asm_offsets.h> 14#include <asm/asm-offsets.h>
15 15
16 .text 16 .text
17 .align 5 17 .align 5
diff --git a/arch/arm26/lib/csumpartialcopyuser.S b/arch/arm26/lib/csumpartialcopyuser.S
index 5b821188e479..261dd154c1a4 100644
--- a/arch/arm26/lib/csumpartialcopyuser.S
+++ b/arch/arm26/lib/csumpartialcopyuser.S
@@ -11,7 +11,7 @@
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <asm/assembler.h> 12#include <asm/assembler.h>
13#include <asm/errno.h> 13#include <asm/errno.h>
14#include <asm/asm_offsets.h> 14#include <asm/asm-offsets.h>
15 15
16 .text 16 .text
17 17
diff --git a/arch/arm26/lib/getuser.S b/arch/arm26/lib/getuser.S
index e6d59b334851..2b1de7fbfe1f 100644
--- a/arch/arm26/lib/getuser.S
+++ b/arch/arm26/lib/getuser.S
@@ -26,7 +26,7 @@
26 * Note that ADDR_LIMIT is either 0 or 0xc0000000. 26 * Note that ADDR_LIMIT is either 0 or 0xc0000000.
27 * Note also that it is intended that __get_user_bad is not global. 27 * Note also that it is intended that __get_user_bad is not global.
28 */ 28 */
29#include <asm/asm_offsets.h> 29#include <asm/asm-offsets.h>
30#include <asm/thread_info.h> 30#include <asm/thread_info.h>
31#include <asm/errno.h> 31#include <asm/errno.h>
32 32
diff --git a/arch/arm26/lib/putuser.S b/arch/arm26/lib/putuser.S
index 87588cbe46ae..46c7f15f9f2d 100644
--- a/arch/arm26/lib/putuser.S
+++ b/arch/arm26/lib/putuser.S
@@ -26,7 +26,7 @@
26 * Note that ADDR_LIMIT is either 0 or 0xc0000000 26 * Note that ADDR_LIMIT is either 0 or 0xc0000000
27 * Note also that it is intended that __put_user_bad is not global. 27 * Note also that it is intended that __put_user_bad is not global.
28 */ 28 */
29#include <asm/asm_offsets.h> 29#include <asm/asm-offsets.h>
30#include <asm/thread_info.h> 30#include <asm/thread_info.h>
31#include <asm/errno.h> 31#include <asm/errno.h>
32 32
diff --git a/arch/arm26/mm/proc-funcs.S b/arch/arm26/mm/proc-funcs.S
index c3d4cd3f457e..f9fca524c57a 100644
--- a/arch/arm26/mm/proc-funcs.S
+++ b/arch/arm26/mm/proc-funcs.S
@@ -14,7 +14,7 @@
14 */ 14 */
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <asm/assembler.h> 16#include <asm/assembler.h>
17#include <asm/asm_offsets.h> 17#include <asm/asm-offsets.h>
18#include <asm/procinfo.h> 18#include <asm/procinfo.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20 20
diff --git a/arch/arm26/nwfpe/entry.S b/arch/arm26/nwfpe/entry.S
index 7d6dfaad80c2..e6312000d9f8 100644
--- a/arch/arm26/nwfpe/entry.S
+++ b/arch/arm26/nwfpe/entry.S
@@ -20,7 +20,7 @@
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/ 21*/
22 22
23#include <asm/asm_offsets.h> 23#include <asm/asm-offsets.h>
24 24
25/* This is the kernel's entry point into the floating point emulator. 25/* This is the kernel's entry point into the floating point emulator.
26It is called from the kernel with code similar to this: 26It is called from the kernel with code similar to this:
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 90ca8730b120..ea65d585cf5e 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -107,8 +107,7 @@ archclean:
107 rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img 107 rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img
108 rm -rf $(LD_SCRIPT).tmp 108 rm -rf $(LD_SCRIPT).tmp
109 109
110prepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch \ 110archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch
111 include/asm-$(ARCH)/$(SARCH)/offset.h
112 111
113# Create some links to make all tools happy 112# Create some links to make all tools happy
114$(SRC_ARCH)/.links: 113$(SRC_ARCH)/.links:
@@ -120,6 +119,7 @@ $(SRC_ARCH)/.links:
120 @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib 119 @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib
121 @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch 120 @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch
122 @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S 121 @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
122 @ln -sfn $(SRC_ARCH)/$(SARCH)/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c
123 @touch $@ 123 @touch $@
124 124
125# Create link to sub arch includes 125# Create link to sub arch includes
@@ -128,9 +128,3 @@ $(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h)
128 @rm -f include/asm-$(ARCH)/arch 128 @rm -f include/asm-$(ARCH)/arch
129 @ln -sf $(srctree)/include/asm-$(ARCH)/$(SARCH) $(srctree)/include/asm-$(ARCH)/arch 129 @ln -sf $(srctree)/include/asm-$(ARCH)/$(SARCH) $(srctree)/include/asm-$(ARCH)/arch
130 @touch $@ 130 @touch $@
131
132arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
133 include/config/MARKER
134
135include/asm-$(ARCH)/$(SARCH)/offset.h: arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s
136 $(call filechk,gen-asm-offsets)
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index c0163bf94a50..c808005e8457 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -270,7 +270,7 @@
270#include <asm/arch/sv_addr_ag.h> 270#include <asm/arch/sv_addr_ag.h>
271#include <asm/errno.h> 271#include <asm/errno.h>
272#include <asm/thread_info.h> 272#include <asm/thread_info.h>
273#include <asm/arch/offset.h> 273#include <asm/asm-offsets.h>
274#include <asm/page.h> 274#include <asm/page.h>
275#include <asm/pgtable.h> 275#include <asm/pgtable.h>
276 276
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index a8ed55e5b403..3bd8503fec68 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -23,7 +23,7 @@
23#include <asm/unistd.h> 23#include <asm/unistd.h>
24#include <asm/errno.h> 24#include <asm/errno.h>
25#include <asm/thread_info.h> 25#include <asm/thread_info.h>
26#include <asm/arch/offset.h> 26#include <asm/asm-offsets.h>
27 27
28#include <asm/arch/hwregs/asm/reg_map_asm.h> 28#include <asm/arch/hwregs/asm/reg_map_asm.h>
29#include <asm/arch/hwregs/asm/intr_vect_defs_asm.h> 29#include <asm/arch/hwregs/asm/intr_vect_defs_asm.h>
diff --git a/arch/frv/kernel/asm-offsets.c b/arch/frv/kernel/asm-offsets.c
new file mode 100644
index 000000000000..9e263112a6e2
--- /dev/null
+++ b/arch/frv/kernel/asm-offsets.c
@@ -0,0 +1 @@
/* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
index c9b80cffd71d..40b3f56f3666 100644
--- a/arch/h8300/Makefile
+++ b/arch/h8300/Makefile
@@ -61,12 +61,6 @@ archmrproper:
61archclean: 61archclean:
62 $(Q)$(MAKE) $(clean)=$(boot) 62 $(Q)$(MAKE) $(clean)=$(boot)
63 63
64prepare: include/asm-$(ARCH)/asm-offsets.h
65
66include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \
67 include/asm include/linux/version.h
68 $(call filechk,gen-asm-offsets)
69
70vmlinux.srec vmlinux.bin: vmlinux 64vmlinux.srec vmlinux.bin: vmlinux
71 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 65 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
72 66
@@ -74,5 +68,3 @@ define archhelp
74 echo 'vmlinux.bin - Create raw binary' 68 echo 'vmlinux.bin - Create raw binary'
75 echo 'vmlinux.srec - Create srec binary' 69 echo 'vmlinux.srec - Create srec binary'
76endef 70endef
77
78CLEAN_FILES += include/asm-$(ARCH)/asm-offsets.h
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 5d51b38bd70d..b22f003eaa6d 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -1212,7 +1212,6 @@ config PCI_DIRECT
1212config PCI_MMCONFIG 1212config PCI_MMCONFIG
1213 bool 1213 bool
1214 depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) 1214 depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
1215 select ACPI_BOOT
1216 default y 1215 default y
1217 1216
1218source "drivers/pci/pcie/Kconfig" 1217source "drivers/pci/pcie/Kconfig"
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index bf7c9ba709f3..09951990a622 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -156,15 +156,6 @@ install: vmlinux
156install kernel_install: 156install kernel_install:
157 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install 157 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
158 158
159prepare: include/asm-$(ARCH)/asm_offsets.h
160CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
161
162arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
163 include/config/MARKER
164
165include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
166 $(call filechk,gen-asm-offsets)
167
168archclean: 159archclean:
169 $(Q)$(MAKE) $(clean)=arch/i386/boot 160 $(Q)$(MAKE) $(clean)=arch/i386/boot
170 161
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 0587477c99f2..92f669470142 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -97,6 +97,7 @@
97#define PARAM_VESAPM_OFF 0x30 97#define PARAM_VESAPM_OFF 0x30
98#define PARAM_LFB_PAGES 0x32 98#define PARAM_LFB_PAGES 0x32
99#define PARAM_VESA_ATTRIB 0x34 99#define PARAM_VESA_ATTRIB 0x34
100#define PARAM_CAPABILITIES 0x36
100 101
101/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ 102/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
102#ifdef CONFIG_VIDEO_RETAIN 103#ifdef CONFIG_VIDEO_RETAIN
@@ -233,6 +234,10 @@ mopar_gr:
233 movw 18(%di), %ax 234 movw 18(%di), %ax
234 movl %eax, %fs:(PARAM_LFB_SIZE) 235 movl %eax, %fs:(PARAM_LFB_SIZE)
235 236
237# store mode capabilities
238 movl 10(%di), %eax
239 movl %eax, %fs:(PARAM_CAPABILITIES)
240
236# switching the DAC to 8-bit is for <= 8 bpp only 241# switching the DAC to 8-bit is for <= 8 bpp only
237 movw %fs:(PARAM_LFB_DEPTH), %ax 242 movw %fs:(PARAM_LFB_DEPTH), %ax
238 cmpw $8, %ax 243 cmpw $8, %ax
@@ -1944,7 +1949,7 @@ store_edid:
1944 movw $0x4f15, %ax # do VBE/DDC 1949 movw $0x4f15, %ax # do VBE/DDC
1945 movw $0x01, %bx 1950 movw $0x01, %bx
1946 movw $0x00, %cx 1951 movw $0x00, %cx
1947 movw $0x01, %dx 1952 movw $0x00, %dx
1948 movw $0x140, %di 1953 movw $0x140, %di
1949 int $0x10 1954 int $0x10
1950 1955
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index ca07b95c06b8..6a431b926019 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -131,8 +131,6 @@ CONFIG_SOFTWARE_SUSPEND=y
131# ACPI (Advanced Configuration and Power Interface) Support 131# ACPI (Advanced Configuration and Power Interface) Support
132# 132#
133CONFIG_ACPI=y 133CONFIG_ACPI=y
134CONFIG_ACPI_BOOT=y
135CONFIG_ACPI_INTERPRETER=y
136CONFIG_ACPI_SLEEP=y 134CONFIG_ACPI_SLEEP=y
137CONFIG_ACPI_SLEEP_PROC_FS=y 135CONFIG_ACPI_SLEEP_PROC_FS=y
138CONFIG_ACPI_AC=y 136CONFIG_ACPI_AC=y
@@ -144,10 +142,8 @@ CONFIG_ACPI_THERMAL=y
144# CONFIG_ACPI_ASUS is not set 142# CONFIG_ACPI_ASUS is not set
145# CONFIG_ACPI_TOSHIBA is not set 143# CONFIG_ACPI_TOSHIBA is not set
146# CONFIG_ACPI_DEBUG is not set 144# CONFIG_ACPI_DEBUG is not set
147CONFIG_ACPI_BUS=y
148CONFIG_ACPI_EC=y 145CONFIG_ACPI_EC=y
149CONFIG_ACPI_POWER=y 146CONFIG_ACPI_POWER=y
150CONFIG_ACPI_PCI=y
151CONFIG_ACPI_SYSTEM=y 147CONFIG_ACPI_SYSTEM=y
152# CONFIG_X86_PM_TIMER is not set 148# CONFIG_X86_PM_TIMER is not set
153 149
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 64682a0edacf..f10de0f2c5e6 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -11,7 +11,7 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
11 11
12obj-y += cpu/ 12obj-y += cpu/
13obj-y += timers/ 13obj-y += timers/
14obj-$(CONFIG_ACPI_BOOT) += acpi/ 14obj-$(CONFIG_ACPI) += acpi/
15obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o 15obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o
16obj-$(CONFIG_MCA) += mca.o 16obj-$(CONFIG_MCA) += mca.o
17obj-$(CONFIG_X86_MSR) += msr.o 17obj-$(CONFIG_X86_MSR) += msr.o
diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile
index 5e291a20c03d..267ca48e1b6c 100644
--- a/arch/i386/kernel/acpi/Makefile
+++ b/arch/i386/kernel/acpi/Makefile
@@ -1,4 +1,4 @@
1obj-$(CONFIG_ACPI_BOOT) := boot.o 1obj-y := boot.o
2obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o 2obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o
3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o 3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
4 4
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 34ee500c26e5..a63351c085c6 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -40,19 +40,25 @@
40 40
41#ifdef CONFIG_X86_64 41#ifdef CONFIG_X86_64
42 42
43static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id) { } 43static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
44{
45}
44extern void __init clustered_apic_check(void); 46extern void __init clustered_apic_check(void);
45static inline int ioapic_setup_disabled(void) { return 0; } 47static inline int ioapic_setup_disabled(void)
48{
49 return 0;
50}
51
46#include <asm/proto.h> 52#include <asm/proto.h>
47 53
48#else /* X86 */ 54#else /* X86 */
49 55
50#ifdef CONFIG_X86_LOCAL_APIC 56#ifdef CONFIG_X86_LOCAL_APIC
51#include <mach_apic.h> 57#include <mach_apic.h>
52#include <mach_mpparse.h> 58#include <mach_mpparse.h>
53#endif /* CONFIG_X86_LOCAL_APIC */ 59#endif /* CONFIG_X86_LOCAL_APIC */
54 60
55#endif /* X86 */ 61#endif /* X86 */
56 62
57#define BAD_MADT_ENTRY(entry, end) ( \ 63#define BAD_MADT_ENTRY(entry, end) ( \
58 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ 64 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
@@ -60,13 +66,8 @@ static inline int ioapic_setup_disabled(void) { return 0; }
60 66
61#define PREFIX "ACPI: " 67#define PREFIX "ACPI: "
62 68
63#ifdef CONFIG_ACPI_PCI
64int acpi_noirq __initdata; /* skip ACPI IRQ initialization */ 69int acpi_noirq __initdata; /* skip ACPI IRQ initialization */
65int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */ 70int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */
66#else
67int acpi_noirq __initdata = 1;
68int acpi_pci_disabled __initdata = 1;
69#endif
70int acpi_ht __initdata = 1; /* enable HT */ 71int acpi_ht __initdata = 1; /* enable HT */
71 72
72int acpi_lapic; 73int acpi_lapic;
@@ -88,7 +89,7 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
88 89
89#define MAX_MADT_ENTRIES 256 90#define MAX_MADT_ENTRIES 256
90u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = 91u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
91 { [0 ... MAX_MADT_ENTRIES-1] = 0xff }; 92 {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
92EXPORT_SYMBOL(x86_acpiid_to_apicid); 93EXPORT_SYMBOL(x86_acpiid_to_apicid);
93 94
94/* -------------------------------------------------------------------------- 95/* --------------------------------------------------------------------------
@@ -99,7 +100,7 @@ EXPORT_SYMBOL(x86_acpiid_to_apicid);
99 * The default interrupt routing model is PIC (8259). This gets 100 * The default interrupt routing model is PIC (8259). This gets
100 * overriden if IOAPICs are enumerated (below). 101 * overriden if IOAPICs are enumerated (below).
101 */ 102 */
102enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; 103enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
103 104
104#ifdef CONFIG_X86_64 105#ifdef CONFIG_X86_64
105 106
@@ -107,7 +108,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
107char *__acpi_map_table(unsigned long phys_addr, unsigned long size) 108char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
108{ 109{
109 if (!phys_addr || !size) 110 if (!phys_addr || !size)
110 return NULL; 111 return NULL;
111 112
112 if (phys_addr < (end_pfn_map << PAGE_SHIFT)) 113 if (phys_addr < (end_pfn_map << PAGE_SHIFT))
113 return __va(phys_addr); 114 return __va(phys_addr);
@@ -134,8 +135,8 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
134 unsigned long base, offset, mapped_size; 135 unsigned long base, offset, mapped_size;
135 int idx; 136 int idx;
136 137
137 if (phys + size < 8*1024*1024) 138 if (phys + size < 8 * 1024 * 1024)
138 return __va(phys); 139 return __va(phys);
139 140
140 offset = phys & (PAGE_SIZE - 1); 141 offset = phys & (PAGE_SIZE - 1);
141 mapped_size = PAGE_SIZE - offset; 142 mapped_size = PAGE_SIZE - offset;
@@ -154,7 +155,7 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
154 mapped_size += PAGE_SIZE; 155 mapped_size += PAGE_SIZE;
155 } 156 }
156 157
157 return ((unsigned char *) base + offset); 158 return ((unsigned char *)base + offset);
158} 159}
159#endif 160#endif
160 161
@@ -172,7 +173,7 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
172 if (!phys_addr || !size) 173 if (!phys_addr || !size)
173 return -EINVAL; 174 return -EINVAL;
174 175
175 mcfg = (struct acpi_table_mcfg *) __acpi_map_table(phys_addr, size); 176 mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size);
176 if (!mcfg) { 177 if (!mcfg) {
177 printk(KERN_WARNING PREFIX "Unable to map MCFG\n"); 178 printk(KERN_WARNING PREFIX "Unable to map MCFG\n");
178 return -ENODEV; 179 return -ENODEV;
@@ -209,20 +210,17 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
209 210
210 return 0; 211 return 0;
211} 212}
212#endif /* CONFIG_PCI_MMCONFIG */ 213#endif /* CONFIG_PCI_MMCONFIG */
213 214
214#ifdef CONFIG_X86_LOCAL_APIC 215#ifdef CONFIG_X86_LOCAL_APIC
215static int __init 216static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
216acpi_parse_madt (
217 unsigned long phys_addr,
218 unsigned long size)
219{ 217{
220 struct acpi_table_madt *madt = NULL; 218 struct acpi_table_madt *madt = NULL;
221 219
222 if (!phys_addr || !size) 220 if (!phys_addr || !size)
223 return -EINVAL; 221 return -EINVAL;
224 222
225 madt = (struct acpi_table_madt *) __acpi_map_table(phys_addr, size); 223 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
226 if (!madt) { 224 if (!madt) {
227 printk(KERN_WARNING PREFIX "Unable to map MADT\n"); 225 printk(KERN_WARNING PREFIX "Unable to map MADT\n");
228 return -ENODEV; 226 return -ENODEV;
@@ -232,22 +230,20 @@ acpi_parse_madt (
232 acpi_lapic_addr = (u64) madt->lapic_address; 230 acpi_lapic_addr = (u64) madt->lapic_address;
233 231
234 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n", 232 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
235 madt->lapic_address); 233 madt->lapic_address);
236 } 234 }
237 235
238 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); 236 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
239 237
240 return 0; 238 return 0;
241} 239}
242 240
243
244static int __init 241static int __init
245acpi_parse_lapic ( 242acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
246 acpi_table_entry_header *header, const unsigned long end)
247{ 243{
248 struct acpi_table_lapic *processor = NULL; 244 struct acpi_table_lapic *processor = NULL;
249 245
250 processor = (struct acpi_table_lapic*) header; 246 processor = (struct acpi_table_lapic *)header;
251 247
252 if (BAD_MADT_ENTRY(processor, end)) 248 if (BAD_MADT_ENTRY(processor, end))
253 return -EINVAL; 249 return -EINVAL;
@@ -260,20 +256,19 @@ acpi_parse_lapic (
260 256
261 x86_acpiid_to_apicid[processor->acpi_id] = processor->id; 257 x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
262 258
263 mp_register_lapic ( 259 mp_register_lapic(processor->id, /* APIC ID */
264 processor->id, /* APIC ID */ 260 processor->flags.enabled); /* Enabled? */
265 processor->flags.enabled); /* Enabled? */
266 261
267 return 0; 262 return 0;
268} 263}
269 264
270static int __init 265static int __init
271acpi_parse_lapic_addr_ovr ( 266acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
272 acpi_table_entry_header *header, const unsigned long end) 267 const unsigned long end)
273{ 268{
274 struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL; 269 struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
275 270
276 lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr*) header; 271 lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header;
277 272
278 if (BAD_MADT_ENTRY(lapic_addr_ovr, end)) 273 if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
279 return -EINVAL; 274 return -EINVAL;
@@ -284,12 +279,11 @@ acpi_parse_lapic_addr_ovr (
284} 279}
285 280
286static int __init 281static int __init
287acpi_parse_lapic_nmi ( 282acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
288 acpi_table_entry_header *header, const unsigned long end)
289{ 283{
290 struct acpi_table_lapic_nmi *lapic_nmi = NULL; 284 struct acpi_table_lapic_nmi *lapic_nmi = NULL;
291 285
292 lapic_nmi = (struct acpi_table_lapic_nmi*) header; 286 lapic_nmi = (struct acpi_table_lapic_nmi *)header;
293 287
294 if (BAD_MADT_ENTRY(lapic_nmi, end)) 288 if (BAD_MADT_ENTRY(lapic_nmi, end))
295 return -EINVAL; 289 return -EINVAL;
@@ -302,37 +296,32 @@ acpi_parse_lapic_nmi (
302 return 0; 296 return 0;
303} 297}
304 298
299#endif /*CONFIG_X86_LOCAL_APIC */
305 300
306#endif /*CONFIG_X86_LOCAL_APIC*/ 301#ifdef CONFIG_X86_IO_APIC
307
308#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
309 302
310static int __init 303static int __init
311acpi_parse_ioapic ( 304acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end)
312 acpi_table_entry_header *header, const unsigned long end)
313{ 305{
314 struct acpi_table_ioapic *ioapic = NULL; 306 struct acpi_table_ioapic *ioapic = NULL;
315 307
316 ioapic = (struct acpi_table_ioapic*) header; 308 ioapic = (struct acpi_table_ioapic *)header;
317 309
318 if (BAD_MADT_ENTRY(ioapic, end)) 310 if (BAD_MADT_ENTRY(ioapic, end))
319 return -EINVAL; 311 return -EINVAL;
320 312
321 acpi_table_print_madt_entry(header); 313 acpi_table_print_madt_entry(header);
322 314
323 mp_register_ioapic ( 315 mp_register_ioapic(ioapic->id,
324 ioapic->id, 316 ioapic->address, ioapic->global_irq_base);
325 ioapic->address, 317
326 ioapic->global_irq_base);
327
328 return 0; 318 return 0;
329} 319}
330 320
331/* 321/*
332 * Parse Interrupt Source Override for the ACPI SCI 322 * Parse Interrupt Source Override for the ACPI SCI
333 */ 323 */
334static void 324static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
335acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
336{ 325{
337 if (trigger == 0) /* compatible SCI trigger is level */ 326 if (trigger == 0) /* compatible SCI trigger is level */
338 trigger = 3; 327 trigger = 3;
@@ -348,7 +337,7 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
348 polarity = acpi_sci_flags.polarity; 337 polarity = acpi_sci_flags.polarity;
349 338
350 /* 339 /*
351 * mp_config_acpi_legacy_irqs() already setup IRQs < 16 340 * mp_config_acpi_legacy_irqs() already setup IRQs < 16
352 * If GSI is < 16, this will update its flags, 341 * If GSI is < 16, this will update its flags,
353 * else it will create a new mp_irqs[] entry. 342 * else it will create a new mp_irqs[] entry.
354 */ 343 */
@@ -363,12 +352,12 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
363} 352}
364 353
365static int __init 354static int __init
366acpi_parse_int_src_ovr ( 355acpi_parse_int_src_ovr(acpi_table_entry_header * header,
367 acpi_table_entry_header *header, const unsigned long end) 356 const unsigned long end)
368{ 357{
369 struct acpi_table_int_src_ovr *intsrc = NULL; 358 struct acpi_table_int_src_ovr *intsrc = NULL;
370 359
371 intsrc = (struct acpi_table_int_src_ovr*) header; 360 intsrc = (struct acpi_table_int_src_ovr *)header;
372 361
373 if (BAD_MADT_ENTRY(intsrc, end)) 362 if (BAD_MADT_ENTRY(intsrc, end))
374 return -EINVAL; 363 return -EINVAL;
@@ -377,33 +366,30 @@ acpi_parse_int_src_ovr (
377 366
378 if (intsrc->bus_irq == acpi_fadt.sci_int) { 367 if (intsrc->bus_irq == acpi_fadt.sci_int) {
379 acpi_sci_ioapic_setup(intsrc->global_irq, 368 acpi_sci_ioapic_setup(intsrc->global_irq,
380 intsrc->flags.polarity, intsrc->flags.trigger); 369 intsrc->flags.polarity,
370 intsrc->flags.trigger);
381 return 0; 371 return 0;
382 } 372 }
383 373
384 if (acpi_skip_timer_override && 374 if (acpi_skip_timer_override &&
385 intsrc->bus_irq == 0 && intsrc->global_irq == 2) { 375 intsrc->bus_irq == 0 && intsrc->global_irq == 2) {
386 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); 376 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
387 return 0; 377 return 0;
388 } 378 }
389 379
390 mp_override_legacy_irq ( 380 mp_override_legacy_irq(intsrc->bus_irq,
391 intsrc->bus_irq, 381 intsrc->flags.polarity,
392 intsrc->flags.polarity, 382 intsrc->flags.trigger, intsrc->global_irq);
393 intsrc->flags.trigger,
394 intsrc->global_irq);
395 383
396 return 0; 384 return 0;
397} 385}
398 386
399
400static int __init 387static int __init
401acpi_parse_nmi_src ( 388acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
402 acpi_table_entry_header *header, const unsigned long end)
403{ 389{
404 struct acpi_table_nmi_src *nmi_src = NULL; 390 struct acpi_table_nmi_src *nmi_src = NULL;
405 391
406 nmi_src = (struct acpi_table_nmi_src*) header; 392 nmi_src = (struct acpi_table_nmi_src *)header;
407 393
408 if (BAD_MADT_ENTRY(nmi_src, end)) 394 if (BAD_MADT_ENTRY(nmi_src, end))
409 return -EINVAL; 395 return -EINVAL;
@@ -415,9 +401,7 @@ acpi_parse_nmi_src (
415 return 0; 401 return 0;
416} 402}
417 403
418#endif /* CONFIG_X86_IO_APIC */ 404#endif /* CONFIG_X86_IO_APIC */
419
420#ifdef CONFIG_ACPI_BUS
421 405
422/* 406/*
423 * acpi_pic_sci_set_trigger() 407 * acpi_pic_sci_set_trigger()
@@ -433,8 +417,7 @@ acpi_parse_nmi_src (
433 * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0) 417 * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
434 */ 418 */
435 419
436void __init 420void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
437acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
438{ 421{
439 unsigned int mask = 1 << irq; 422 unsigned int mask = 1 << irq;
440 unsigned int old, new; 423 unsigned int old, new;
@@ -454,10 +437,10 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
454 * routing tables.. 437 * routing tables..
455 */ 438 */
456 switch (trigger) { 439 switch (trigger) {
457 case 1: /* Edge - clear */ 440 case 1: /* Edge - clear */
458 new &= ~mask; 441 new &= ~mask;
459 break; 442 break;
460 case 3: /* Level - set */ 443 case 3: /* Level - set */
461 new |= mask; 444 new |= mask;
462 break; 445 break;
463 } 446 }
@@ -470,21 +453,22 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
470 outb(new >> 8, 0x4d1); 453 outb(new >> 8, 0x4d1);
471} 454}
472 455
473
474#endif /* CONFIG_ACPI_BUS */
475
476int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) 456int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
477{ 457{
478#ifdef CONFIG_X86_IO_APIC 458#ifdef CONFIG_X86_IO_APIC
479 if (use_pci_vector() && !platform_legacy_irq(gsi)) 459 if (use_pci_vector() && !platform_legacy_irq(gsi))
480 *irq = IO_APIC_VECTOR(gsi); 460 *irq = IO_APIC_VECTOR(gsi);
481 else 461 else
482#endif 462#endif
483 *irq = gsi; 463 *irq = gsi;
484 return 0; 464 return 0;
485} 465}
486 466
487unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) 467/*
468 * success: return IRQ number (>=0)
469 * failure: return < 0
470 */
471int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
488{ 472{
489 unsigned int irq; 473 unsigned int irq;
490 unsigned int plat_gsi = gsi; 474 unsigned int plat_gsi = gsi;
@@ -497,7 +481,7 @@ unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
497 extern void eisa_set_level_irq(unsigned int irq); 481 extern void eisa_set_level_irq(unsigned int irq);
498 482
499 if (edge_level == ACPI_LEVEL_SENSITIVE) 483 if (edge_level == ACPI_LEVEL_SENSITIVE)
500 eisa_set_level_irq(gsi); 484 eisa_set_level_irq(gsi);
501 } 485 }
502#endif 486#endif
503 487
@@ -509,60 +493,58 @@ unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
509 acpi_gsi_to_irq(plat_gsi, &irq); 493 acpi_gsi_to_irq(plat_gsi, &irq);
510 return irq; 494 return irq;
511} 495}
496
512EXPORT_SYMBOL(acpi_register_gsi); 497EXPORT_SYMBOL(acpi_register_gsi);
513 498
514/* 499/*
515 * ACPI based hotplug support for CPU 500 * ACPI based hotplug support for CPU
516 */ 501 */
517#ifdef CONFIG_ACPI_HOTPLUG_CPU 502#ifdef CONFIG_ACPI_HOTPLUG_CPU
518int 503int acpi_map_lsapic(acpi_handle handle, int *pcpu)
519acpi_map_lsapic(acpi_handle handle, int *pcpu)
520{ 504{
521 /* TBD */ 505 /* TBD */
522 return -EINVAL; 506 return -EINVAL;
523} 507}
524EXPORT_SYMBOL(acpi_map_lsapic);
525 508
509EXPORT_SYMBOL(acpi_map_lsapic);
526 510
527int 511int acpi_unmap_lsapic(int cpu)
528acpi_unmap_lsapic(int cpu)
529{ 512{
530 /* TBD */ 513 /* TBD */
531 return -EINVAL; 514 return -EINVAL;
532} 515}
516
533EXPORT_SYMBOL(acpi_unmap_lsapic); 517EXPORT_SYMBOL(acpi_unmap_lsapic);
534#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 518#endif /* CONFIG_ACPI_HOTPLUG_CPU */
535 519
536int 520int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
537acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
538{ 521{
539 /* TBD */ 522 /* TBD */
540 return -EINVAL; 523 return -EINVAL;
541} 524}
525
542EXPORT_SYMBOL(acpi_register_ioapic); 526EXPORT_SYMBOL(acpi_register_ioapic);
543 527
544int 528int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
545acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
546{ 529{
547 /* TBD */ 530 /* TBD */
548 return -EINVAL; 531 return -EINVAL;
549} 532}
533
550EXPORT_SYMBOL(acpi_unregister_ioapic); 534EXPORT_SYMBOL(acpi_unregister_ioapic);
551 535
552static unsigned long __init 536static unsigned long __init
553acpi_scan_rsdp ( 537acpi_scan_rsdp(unsigned long start, unsigned long length)
554 unsigned long start,
555 unsigned long length)
556{ 538{
557 unsigned long offset = 0; 539 unsigned long offset = 0;
558 unsigned long sig_len = sizeof("RSD PTR ") - 1; 540 unsigned long sig_len = sizeof("RSD PTR ") - 1;
559 541
560 /* 542 /*
561 * Scan all 16-byte boundaries of the physical memory region for the 543 * Scan all 16-byte boundaries of the physical memory region for the
562 * RSDP signature. 544 * RSDP signature.
563 */ 545 */
564 for (offset = 0; offset < length; offset += 16) { 546 for (offset = 0; offset < length; offset += 16) {
565 if (strncmp((char *) (start + offset), "RSD PTR ", sig_len)) 547 if (strncmp((char *)(start + offset), "RSD PTR ", sig_len))
566 continue; 548 continue;
567 return (start + offset); 549 return (start + offset);
568 } 550 }
@@ -575,20 +557,19 @@ static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
575 struct acpi_table_sbf *sb; 557 struct acpi_table_sbf *sb;
576 558
577 if (!phys_addr || !size) 559 if (!phys_addr || !size)
578 return -EINVAL; 560 return -EINVAL;
579 561
580 sb = (struct acpi_table_sbf *) __acpi_map_table(phys_addr, size); 562 sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
581 if (!sb) { 563 if (!sb) {
582 printk(KERN_WARNING PREFIX "Unable to map SBF\n"); 564 printk(KERN_WARNING PREFIX "Unable to map SBF\n");
583 return -ENODEV; 565 return -ENODEV;
584 } 566 }
585 567
586 sbf_port = sb->sbf_cmos; /* Save CMOS port */ 568 sbf_port = sb->sbf_cmos; /* Save CMOS port */
587 569
588 return 0; 570 return 0;
589} 571}
590 572
591
592#ifdef CONFIG_HPET_TIMER 573#ifdef CONFIG_HPET_TIMER
593 574
594static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) 575static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
@@ -598,7 +579,7 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
598 if (!phys || !size) 579 if (!phys || !size)
599 return -EINVAL; 580 return -EINVAL;
600 581
601 hpet_tbl = (struct acpi_table_hpet *) __acpi_map_table(phys, size); 582 hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
602 if (!hpet_tbl) { 583 if (!hpet_tbl) {
603 printk(KERN_WARNING PREFIX "Unable to map HPET\n"); 584 printk(KERN_WARNING PREFIX "Unable to map HPET\n");
604 return -ENODEV; 585 return -ENODEV;
@@ -609,22 +590,21 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
609 "memory.\n"); 590 "memory.\n");
610 return -1; 591 return -1;
611 } 592 }
612
613#ifdef CONFIG_X86_64 593#ifdef CONFIG_X86_64
614 vxtime.hpet_address = hpet_tbl->addr.addrl | 594 vxtime.hpet_address = hpet_tbl->addr.addrl |
615 ((long) hpet_tbl->addr.addrh << 32); 595 ((long)hpet_tbl->addr.addrh << 32);
616 596
617 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 597 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
618 hpet_tbl->id, vxtime.hpet_address); 598 hpet_tbl->id, vxtime.hpet_address);
619#else /* X86 */ 599#else /* X86 */
620 { 600 {
621 extern unsigned long hpet_address; 601 extern unsigned long hpet_address;
622 602
623 hpet_address = hpet_tbl->addr.addrl; 603 hpet_address = hpet_tbl->addr.addrl;
624 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 604 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
625 hpet_tbl->id, hpet_address); 605 hpet_tbl->id, hpet_address);
626 } 606 }
627#endif /* X86 */ 607#endif /* X86 */
628 608
629 return 0; 609 return 0;
630} 610}
@@ -640,28 +620,25 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
640{ 620{
641 struct fadt_descriptor_rev2 *fadt = NULL; 621 struct fadt_descriptor_rev2 *fadt = NULL;
642 622
643 fadt = (struct fadt_descriptor_rev2*) __acpi_map_table(phys,size); 623 fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size);
644 if(!fadt) { 624 if (!fadt) {
645 printk(KERN_WARNING PREFIX "Unable to map FADT\n"); 625 printk(KERN_WARNING PREFIX "Unable to map FADT\n");
646 return 0; 626 return 0;
647 } 627 }
648
649#ifdef CONFIG_ACPI_INTERPRETER
650 /* initialize sci_int early for INT_SRC_OVR MADT parsing */ 628 /* initialize sci_int early for INT_SRC_OVR MADT parsing */
651 acpi_fadt.sci_int = fadt->sci_int; 629 acpi_fadt.sci_int = fadt->sci_int;
652#endif
653 630
654#ifdef CONFIG_ACPI_BUS
655 /* initialize rev and apic_phys_dest_mode for x86_64 genapic */ 631 /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
656 acpi_fadt.revision = fadt->revision; 632 acpi_fadt.revision = fadt->revision;
657 acpi_fadt.force_apic_physical_destination_mode = fadt->force_apic_physical_destination_mode; 633 acpi_fadt.force_apic_physical_destination_mode =
658#endif 634 fadt->force_apic_physical_destination_mode;
659 635
660#ifdef CONFIG_X86_PM_TIMER 636#ifdef CONFIG_X86_PM_TIMER
661 /* detect the location of the ACPI PM Timer */ 637 /* detect the location of the ACPI PM Timer */
662 if (fadt->revision >= FADT2_REVISION_ID) { 638 if (fadt->revision >= FADT2_REVISION_ID) {
663 /* FADT rev. 2 */ 639 /* FADT rev. 2 */
664 if (fadt->xpm_tmr_blk.address_space_id != ACPI_ADR_SPACE_SYSTEM_IO) 640 if (fadt->xpm_tmr_blk.address_space_id !=
641 ACPI_ADR_SPACE_SYSTEM_IO)
665 return 0; 642 return 0;
666 643
667 pmtmr_ioport = fadt->xpm_tmr_blk.address; 644 pmtmr_ioport = fadt->xpm_tmr_blk.address;
@@ -670,16 +647,15 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
670 pmtmr_ioport = fadt->V1_pm_tmr_blk; 647 pmtmr_ioport = fadt->V1_pm_tmr_blk;
671 } 648 }
672 if (pmtmr_ioport) 649 if (pmtmr_ioport)
673 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", pmtmr_ioport); 650 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
651 pmtmr_ioport);
674#endif 652#endif
675 return 0; 653 return 0;
676} 654}
677 655
678 656unsigned long __init acpi_find_rsdp(void)
679unsigned long __init
680acpi_find_rsdp (void)
681{ 657{
682 unsigned long rsdp_phys = 0; 658 unsigned long rsdp_phys = 0;
683 659
684 if (efi_enabled) { 660 if (efi_enabled) {
685 if (efi.acpi20) 661 if (efi.acpi20)
@@ -691,9 +667,9 @@ acpi_find_rsdp (void)
691 * Scan memory looking for the RSDP signature. First search EBDA (low 667 * Scan memory looking for the RSDP signature. First search EBDA (low
692 * memory) paragraphs and then search upper memory (E0000-FFFFF). 668 * memory) paragraphs and then search upper memory (E0000-FFFFF).
693 */ 669 */
694 rsdp_phys = acpi_scan_rsdp (0, 0x400); 670 rsdp_phys = acpi_scan_rsdp(0, 0x400);
695 if (!rsdp_phys) 671 if (!rsdp_phys)
696 rsdp_phys = acpi_scan_rsdp (0xE0000, 0x20000); 672 rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
697 673
698 return rsdp_phys; 674 return rsdp_phys;
699} 675}
@@ -703,8 +679,7 @@ acpi_find_rsdp (void)
703 * Parse LAPIC entries in MADT 679 * Parse LAPIC entries in MADT
704 * returns 0 on success, < 0 on error 680 * returns 0 on success, < 0 on error
705 */ 681 */
706static int __init 682static int __init acpi_parse_madt_lapic_entries(void)
707acpi_parse_madt_lapic_entries(void)
708{ 683{
709 int count; 684 int count;
710 685
@@ -713,28 +688,31 @@ acpi_parse_madt_lapic_entries(void)
713 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). 688 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
714 */ 689 */
715 690
716 count = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0); 691 count =
692 acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
693 acpi_parse_lapic_addr_ovr, 0);
717 if (count < 0) { 694 if (count < 0) {
718 printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); 695 printk(KERN_ERR PREFIX
696 "Error parsing LAPIC address override entry\n");
719 return count; 697 return count;
720 } 698 }
721 699
722 mp_register_lapic_address(acpi_lapic_addr); 700 mp_register_lapic_address(acpi_lapic_addr);
723 701
724 count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, 702 count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
725 MAX_APICS); 703 MAX_APICS);
726 if (!count) { 704 if (!count) {
727 printk(KERN_ERR PREFIX "No LAPIC entries present\n"); 705 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
728 /* TBD: Cleanup to allow fallback to MPS */ 706 /* TBD: Cleanup to allow fallback to MPS */
729 return -ENODEV; 707 return -ENODEV;
730 } 708 } else if (count < 0) {
731 else if (count < 0) {
732 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n"); 709 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
733 /* TBD: Cleanup to allow fallback to MPS */ 710 /* TBD: Cleanup to allow fallback to MPS */
734 return count; 711 return count;
735 } 712 }
736 713
737 count = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); 714 count =
715 acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
738 if (count < 0) { 716 if (count < 0) {
739 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 717 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
740 /* TBD: Cleanup to allow fallback to MPS */ 718 /* TBD: Cleanup to allow fallback to MPS */
@@ -742,15 +720,14 @@ acpi_parse_madt_lapic_entries(void)
742 } 720 }
743 return 0; 721 return 0;
744} 722}
745#endif /* CONFIG_X86_LOCAL_APIC */ 723#endif /* CONFIG_X86_LOCAL_APIC */
746 724
747#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) 725#ifdef CONFIG_X86_IO_APIC
748/* 726/*
749 * Parse IOAPIC related entries in MADT 727 * Parse IOAPIC related entries in MADT
750 * returns 0 on success, < 0 on error 728 * returns 0 on success, < 0 on error
751 */ 729 */
752static int __init 730static int __init acpi_parse_madt_ioapic_entries(void)
753acpi_parse_madt_ioapic_entries(void)
754{ 731{
755 int count; 732 int count;
756 733
@@ -762,30 +739,34 @@ acpi_parse_madt_ioapic_entries(void)
762 */ 739 */
763 if (acpi_disabled || acpi_noirq) { 740 if (acpi_disabled || acpi_noirq) {
764 return -ENODEV; 741 return -ENODEV;
765 } 742 }
766 743
767 /* 744 /*
768 * if "noapic" boot option, don't look for IO-APICs 745 * if "noapic" boot option, don't look for IO-APICs
769 */ 746 */
770 if (skip_ioapic_setup) { 747 if (skip_ioapic_setup) {
771 printk(KERN_INFO PREFIX "Skipping IOAPIC probe " 748 printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
772 "due to 'noapic' option.\n"); 749 "due to 'noapic' option.\n");
773 return -ENODEV; 750 return -ENODEV;
774 } 751 }
775 752
776 count = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS); 753 count =
754 acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
755 MAX_IO_APICS);
777 if (!count) { 756 if (!count) {
778 printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); 757 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
779 return -ENODEV; 758 return -ENODEV;
780 } 759 } else if (count < 0) {
781 else if (count < 0) {
782 printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n"); 760 printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
783 return count; 761 return count;
784 } 762 }
785 763
786 count = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS); 764 count =
765 acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
766 NR_IRQ_VECTORS);
787 if (count < 0) { 767 if (count < 0) {
788 printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); 768 printk(KERN_ERR PREFIX
769 "Error parsing interrupt source overrides entry\n");
789 /* TBD: Cleanup to allow fallback to MPS */ 770 /* TBD: Cleanup to allow fallback to MPS */
790 return count; 771 return count;
791 } 772 }
@@ -800,7 +781,9 @@ acpi_parse_madt_ioapic_entries(void)
800 /* Fill in identity legacy mapings where no override */ 781 /* Fill in identity legacy mapings where no override */
801 mp_config_acpi_legacy_irqs(); 782 mp_config_acpi_legacy_irqs();
802 783
803 count = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS); 784 count =
785 acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
786 NR_IRQ_VECTORS);
804 if (count < 0) { 787 if (count < 0) {
805 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); 788 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
806 /* TBD: Cleanup to allow fallback to MPS */ 789 /* TBD: Cleanup to allow fallback to MPS */
@@ -814,11 +797,9 @@ static inline int acpi_parse_madt_ioapic_entries(void)
814{ 797{
815 return -1; 798 return -1;
816} 799}
817#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */ 800#endif /* !CONFIG_X86_IO_APIC */
818 801
819 802static void __init acpi_process_madt(void)
820static void __init
821acpi_process_madt(void)
822{ 803{
823#ifdef CONFIG_X86_LOCAL_APIC 804#ifdef CONFIG_X86_LOCAL_APIC
824 int count, error; 805 int count, error;
@@ -853,7 +834,8 @@ acpi_process_madt(void)
853 /* 834 /*
854 * Dell Precision Workstation 410, 610 come here. 835 * Dell Precision Workstation 410, 610 come here.
855 */ 836 */
856 printk(KERN_ERR PREFIX "Invalid BIOS MADT, disabling ACPI\n"); 837 printk(KERN_ERR PREFIX
838 "Invalid BIOS MADT, disabling ACPI\n");
857 disable_acpi(); 839 disable_acpi();
858 } 840 }
859 } 841 }
@@ -865,7 +847,6 @@ extern int acpi_force;
865 847
866#ifdef __i386__ 848#ifdef __i386__
867 849
868#ifdef CONFIG_ACPI_PCI
869static int __init disable_acpi_irq(struct dmi_system_id *d) 850static int __init disable_acpi_irq(struct dmi_system_id *d)
870{ 851{
871 if (!acpi_force) { 852 if (!acpi_force) {
@@ -885,12 +866,11 @@ static int __init disable_acpi_pci(struct dmi_system_id *d)
885 } 866 }
886 return 0; 867 return 0;
887} 868}
888#endif
889 869
890static int __init dmi_disable_acpi(struct dmi_system_id *d) 870static int __init dmi_disable_acpi(struct dmi_system_id *d)
891{ 871{
892 if (!acpi_force) { 872 if (!acpi_force) {
893 printk(KERN_NOTICE "%s detected: acpi off\n",d->ident); 873 printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
894 disable_acpi(); 874 disable_acpi();
895 } else { 875 } else {
896 printk(KERN_NOTICE 876 printk(KERN_NOTICE
@@ -905,7 +885,8 @@ static int __init dmi_disable_acpi(struct dmi_system_id *d)
905static int __init force_acpi_ht(struct dmi_system_id *d) 885static int __init force_acpi_ht(struct dmi_system_id *d)
906{ 886{
907 if (!acpi_force) { 887 if (!acpi_force) {
908 printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", d->ident); 888 printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
889 d->ident);
909 disable_acpi(); 890 disable_acpi();
910 acpi_ht = 1; 891 acpi_ht = 1;
911 } else { 892 } else {
@@ -924,155 +905,155 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
924 * Boxes that need ACPI disabled 905 * Boxes that need ACPI disabled
925 */ 906 */
926 { 907 {
927 .callback = dmi_disable_acpi, 908 .callback = dmi_disable_acpi,
928 .ident = "IBM Thinkpad", 909 .ident = "IBM Thinkpad",
929 .matches = { 910 .matches = {
930 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 911 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
931 DMI_MATCH(DMI_BOARD_NAME, "2629H1G"), 912 DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
932 }, 913 },
933 }, 914 },
934 915
935 /* 916 /*
936 * Boxes that need acpi=ht 917 * Boxes that need acpi=ht
937 */ 918 */
938 { 919 {
939 .callback = force_acpi_ht, 920 .callback = force_acpi_ht,
940 .ident = "FSC Primergy T850", 921 .ident = "FSC Primergy T850",
941 .matches = { 922 .matches = {
942 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 923 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
943 DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"), 924 DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
944 }, 925 },
945 }, 926 },
946 { 927 {
947 .callback = force_acpi_ht, 928 .callback = force_acpi_ht,
948 .ident = "DELL GX240", 929 .ident = "DELL GX240",
949 .matches = { 930 .matches = {
950 DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"), 931 DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
951 DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"), 932 DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
952 }, 933 },
953 }, 934 },
954 { 935 {
955 .callback = force_acpi_ht, 936 .callback = force_acpi_ht,
956 .ident = "HP VISUALIZE NT Workstation", 937 .ident = "HP VISUALIZE NT Workstation",
957 .matches = { 938 .matches = {
958 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), 939 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
959 DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"), 940 DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
960 }, 941 },
961 }, 942 },
962 { 943 {
963 .callback = force_acpi_ht, 944 .callback = force_acpi_ht,
964 .ident = "Compaq Workstation W8000", 945 .ident = "Compaq Workstation W8000",
965 .matches = { 946 .matches = {
966 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), 947 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
967 DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"), 948 DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
968 }, 949 },
969 }, 950 },
970 { 951 {
971 .callback = force_acpi_ht, 952 .callback = force_acpi_ht,
972 .ident = "ASUS P4B266", 953 .ident = "ASUS P4B266",
973 .matches = { 954 .matches = {
974 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 955 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
975 DMI_MATCH(DMI_BOARD_NAME, "P4B266"), 956 DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
976 }, 957 },
977 }, 958 },
978 { 959 {
979 .callback = force_acpi_ht, 960 .callback = force_acpi_ht,
980 .ident = "ASUS P2B-DS", 961 .ident = "ASUS P2B-DS",
981 .matches = { 962 .matches = {
982 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 963 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
983 DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"), 964 DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
984 }, 965 },
985 }, 966 },
986 { 967 {
987 .callback = force_acpi_ht, 968 .callback = force_acpi_ht,
988 .ident = "ASUS CUR-DLS", 969 .ident = "ASUS CUR-DLS",
989 .matches = { 970 .matches = {
990 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 971 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
991 DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"), 972 DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
992 }, 973 },
993 }, 974 },
994 { 975 {
995 .callback = force_acpi_ht, 976 .callback = force_acpi_ht,
996 .ident = "ABIT i440BX-W83977", 977 .ident = "ABIT i440BX-W83977",
997 .matches = { 978 .matches = {
998 DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"), 979 DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
999 DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"), 980 DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
1000 }, 981 },
1001 }, 982 },
1002 { 983 {
1003 .callback = force_acpi_ht, 984 .callback = force_acpi_ht,
1004 .ident = "IBM Bladecenter", 985 .ident = "IBM Bladecenter",
1005 .matches = { 986 .matches = {
1006 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 987 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1007 DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"), 988 DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
1008 }, 989 },
1009 }, 990 },
1010 { 991 {
1011 .callback = force_acpi_ht, 992 .callback = force_acpi_ht,
1012 .ident = "IBM eServer xSeries 360", 993 .ident = "IBM eServer xSeries 360",
1013 .matches = { 994 .matches = {
1014 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 995 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1015 DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"), 996 DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
1016 }, 997 },
1017 }, 998 },
1018 { 999 {
1019 .callback = force_acpi_ht, 1000 .callback = force_acpi_ht,
1020 .ident = "IBM eserver xSeries 330", 1001 .ident = "IBM eserver xSeries 330",
1021 .matches = { 1002 .matches = {
1022 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 1003 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1023 DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"), 1004 DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
1024 }, 1005 },
1025 }, 1006 },
1026 { 1007 {
1027 .callback = force_acpi_ht, 1008 .callback = force_acpi_ht,
1028 .ident = "IBM eserver xSeries 440", 1009 .ident = "IBM eserver xSeries 440",
1029 .matches = { 1010 .matches = {
1030 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 1011 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1031 DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"), 1012 DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
1032 }, 1013 },
1033 }, 1014 },
1034 1015
1035#ifdef CONFIG_ACPI_PCI
1036 /* 1016 /*
1037 * Boxes that need ACPI PCI IRQ routing disabled 1017 * Boxes that need ACPI PCI IRQ routing disabled
1038 */ 1018 */
1039 { 1019 {
1040 .callback = disable_acpi_irq, 1020 .callback = disable_acpi_irq,
1041 .ident = "ASUS A7V", 1021 .ident = "ASUS A7V",
1042 .matches = { 1022 .matches = {
1043 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"), 1023 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
1044 DMI_MATCH(DMI_BOARD_NAME, "<A7V>"), 1024 DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
1045 /* newer BIOS, Revision 1011, does work */ 1025 /* newer BIOS, Revision 1011, does work */
1046 DMI_MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"), 1026 DMI_MATCH(DMI_BIOS_VERSION,
1047 }, 1027 "ASUS A7V ACPI BIOS Revision 1007"),
1048 }, 1028 },
1029 },
1049 1030
1050 /* 1031 /*
1051 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled 1032 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
1052 */ 1033 */
1053 { /* _BBN 0 bug */ 1034 { /* _BBN 0 bug */
1054 .callback = disable_acpi_pci, 1035 .callback = disable_acpi_pci,
1055 .ident = "ASUS PR-DLS", 1036 .ident = "ASUS PR-DLS",
1056 .matches = { 1037 .matches = {
1057 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 1038 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
1058 DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"), 1039 DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
1059 DMI_MATCH(DMI_BIOS_VERSION, "ASUS PR-DLS ACPI BIOS Revision 1010"), 1040 DMI_MATCH(DMI_BIOS_VERSION,
1060 DMI_MATCH(DMI_BIOS_DATE, "03/21/2003") 1041 "ASUS PR-DLS ACPI BIOS Revision 1010"),
1061 }, 1042 DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
1062 }, 1043 },
1044 },
1063 { 1045 {
1064 .callback = disable_acpi_pci, 1046 .callback = disable_acpi_pci,
1065 .ident = "Acer TravelMate 36x Laptop", 1047 .ident = "Acer TravelMate 36x Laptop",
1066 .matches = { 1048 .matches = {
1067 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 1049 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1068 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), 1050 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
1069 }, 1051 },
1070 }, 1052 },
1071#endif 1053 {}
1072 { }
1073}; 1054};
1074 1055
1075#endif /* __i386__ */ 1056#endif /* __i386__ */
1076 1057
1077/* 1058/*
1078 * acpi_boot_table_init() and acpi_boot_init() 1059 * acpi_boot_table_init() and acpi_boot_init()
@@ -1097,8 +1078,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
1097 * !0: failure 1078 * !0: failure
1098 */ 1079 */
1099 1080
1100int __init 1081int __init acpi_boot_table_init(void)
1101acpi_boot_table_init(void)
1102{ 1082{
1103 int error; 1083 int error;
1104 1084
@@ -1111,7 +1091,7 @@ acpi_boot_table_init(void)
1111 * One exception: acpi=ht continues far enough to enumerate LAPICs 1091 * One exception: acpi=ht continues far enough to enumerate LAPICs
1112 */ 1092 */
1113 if (acpi_disabled && !acpi_ht) 1093 if (acpi_disabled && !acpi_ht)
1114 return 1; 1094 return 1;
1115 1095
1116 /* 1096 /*
1117 * Initialize the ACPI boot-time table parser. 1097 * Initialize the ACPI boot-time table parser.
@@ -1121,7 +1101,6 @@ acpi_boot_table_init(void)
1121 disable_acpi(); 1101 disable_acpi();
1122 return error; 1102 return error;
1123 } 1103 }
1124
1125#ifdef __i386__ 1104#ifdef __i386__
1126 check_acpi_pci(); 1105 check_acpi_pci();
1127#endif 1106#endif
@@ -1145,7 +1124,6 @@ acpi_boot_table_init(void)
1145 return 0; 1124 return 0;
1146} 1125}
1147 1126
1148
1149int __init acpi_boot_init(void) 1127int __init acpi_boot_init(void)
1150{ 1128{
1151 /* 1129 /*
@@ -1153,7 +1131,7 @@ int __init acpi_boot_init(void)
1153 * One exception: acpi=ht continues far enough to enumerate LAPICs 1131 * One exception: acpi=ht continues far enough to enumerate LAPICs
1154 */ 1132 */
1155 if (acpi_disabled && !acpi_ht) 1133 if (acpi_disabled && !acpi_ht)
1156 return 1; 1134 return 1;
1157 1135
1158 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf); 1136 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
1159 1137
@@ -1171,4 +1149,3 @@ int __init acpi_boot_init(void)
1171 1149
1172 return 0; 1150 return 0;
1173} 1151}
1174
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c
index 726a5ca4b165..1ae2aeeda18b 100644
--- a/arch/i386/kernel/acpi/earlyquirk.c
+++ b/arch/i386/kernel/acpi/earlyquirk.c
@@ -7,45 +7,55 @@
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <asm/pci-direct.h> 8#include <asm/pci-direct.h>
9#include <asm/acpi.h> 9#include <asm/acpi.h>
10#include <asm/apic.h>
10 11
11static int __init check_bridge(int vendor, int device) 12static int __init check_bridge(int vendor, int device)
12{ 13{
13 /* According to Nvidia all timer overrides are bogus. Just ignore 14 /* According to Nvidia all timer overrides are bogus. Just ignore
14 them all. */ 15 them all. */
15 if (vendor == PCI_VENDOR_ID_NVIDIA) { 16 if (vendor == PCI_VENDOR_ID_NVIDIA) {
16 acpi_skip_timer_override = 1; 17 acpi_skip_timer_override = 1;
17 } 18 }
19#ifdef CONFIG_X86_LOCAL_APIC
20 /*
21 * ATI IXP chipsets get double timer interrupts.
22 * For now just do this for all ATI chipsets.
23 * FIXME: this needs to be checked for the non ACPI case too.
24 */
25 if (vendor == PCI_VENDOR_ID_ATI)
26 disable_timer_pin_1 = 1;
27#endif
18 return 0; 28 return 0;
19} 29}
20 30
21void __init check_acpi_pci(void) 31void __init check_acpi_pci(void)
22{ 32{
23 int num,slot,func; 33 int num, slot, func;
24 34
25 /* Assume the machine supports type 1. If not it will 35 /* Assume the machine supports type 1. If not it will
26 always read ffffffff and should not have any side effect. */ 36 always read ffffffff and should not have any side effect. */
27 37
28 /* Poor man's PCI discovery */ 38 /* Poor man's PCI discovery */
29 for (num = 0; num < 32; num++) { 39 for (num = 0; num < 32; num++) {
30 for (slot = 0; slot < 32; slot++) { 40 for (slot = 0; slot < 32; slot++) {
31 for (func = 0; func < 8; func++) { 41 for (func = 0; func < 8; func++) {
32 u32 class; 42 u32 class;
33 u32 vendor; 43 u32 vendor;
34 class = read_pci_config(num,slot,func, 44 class = read_pci_config(num, slot, func,
35 PCI_CLASS_REVISION); 45 PCI_CLASS_REVISION);
36 if (class == 0xffffffff) 46 if (class == 0xffffffff)
37 break; 47 break;
38 48
39 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) 49 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
40 continue; 50 continue;
41 51
42 vendor = read_pci_config(num, slot, func, 52 vendor = read_pci_config(num, slot, func,
43 PCI_VENDOR_ID); 53 PCI_VENDOR_ID);
44 54
45 if (check_bridge(vendor&0xffff, vendor >> 16)) 55 if (check_bridge(vendor & 0xffff, vendor >> 16))
46 return; 56 return;
47 } 57 }
48 58
49 } 59 }
50 } 60 }
51} 61}
diff --git a/arch/i386/kernel/acpi/sleep.c b/arch/i386/kernel/acpi/sleep.c
index c1af93032ff3..1cb2b186a3af 100644
--- a/arch/i386/kernel/acpi/sleep.c
+++ b/arch/i386/kernel/acpi/sleep.c
@@ -20,12 +20,13 @@ extern void zap_low_mappings(void);
20 20
21extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); 21extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
22 22
23static void init_low_mapping(pgd_t *pgd, int pgd_limit) 23static void init_low_mapping(pgd_t * pgd, int pgd_limit)
24{ 24{
25 int pgd_ofs = 0; 25 int pgd_ofs = 0;
26 26
27 while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) { 27 while ((pgd_ofs < pgd_limit)
28 set_pgd(pgd, *(pgd+USER_PTRS_PER_PGD)); 28 && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
29 set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
29 pgd_ofs++, pgd++; 30 pgd_ofs++, pgd++;
30 } 31 }
31 flush_tlb_all(); 32 flush_tlb_all();
@@ -37,12 +38,13 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit)
37 * Create an identity mapped page table and copy the wakeup routine to 38 * Create an identity mapped page table and copy the wakeup routine to
38 * low memory. 39 * low memory.
39 */ 40 */
40int acpi_save_state_mem (void) 41int acpi_save_state_mem(void)
41{ 42{
42 if (!acpi_wakeup_address) 43 if (!acpi_wakeup_address)
43 return 1; 44 return 1;
44 init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD); 45 init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
45 memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start); 46 memcpy((void *)acpi_wakeup_address, &wakeup_start,
47 &wakeup_end - &wakeup_start);
46 acpi_copy_wakeup_routine(acpi_wakeup_address); 48 acpi_copy_wakeup_routine(acpi_wakeup_address);
47 49
48 return 0; 50 return 0;
@@ -51,7 +53,7 @@ int acpi_save_state_mem (void)
51/* 53/*
52 * acpi_restore_state - undo effects of acpi_save_state_mem 54 * acpi_restore_state - undo effects of acpi_save_state_mem
53 */ 55 */
54void acpi_restore_state_mem (void) 56void acpi_restore_state_mem(void)
55{ 57{
56 zap_low_mappings(); 58 zap_low_mappings();
57} 59}
@@ -67,7 +69,8 @@ void acpi_restore_state_mem (void)
67void __init acpi_reserve_bootmem(void) 69void __init acpi_reserve_bootmem(void)
68{ 70{
69 if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) { 71 if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) {
70 printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n"); 72 printk(KERN_ERR
73 "ACPI: Wakeup code way too big, S3 disabled.\n");
71 return; 74 return;
72 } 75 }
73 76
@@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str)
90 return 1; 93 return 1;
91} 94}
92 95
93
94__setup("acpi_sleep=", acpi_sleep_setup); 96__setup("acpi_sleep=", acpi_sleep_setup);
95 97
96
97static __init int reset_videomode_after_s3(struct dmi_system_id *d) 98static __init int reset_videomode_after_s3(struct dmi_system_id *d)
98{ 99{
99 acpi_video_flags |= 2; 100 acpi_video_flags |= 2;
@@ -101,14 +102,14 @@ static __init int reset_videomode_after_s3(struct dmi_system_id *d)
101} 102}
102 103
103static __initdata struct dmi_system_id acpisleep_dmi_table[] = { 104static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
104 { /* Reset video mode after returning from ACPI S3 sleep */ 105 { /* Reset video mode after returning from ACPI S3 sleep */
105 .callback = reset_videomode_after_s3, 106 .callback = reset_videomode_after_s3,
106 .ident = "Toshiba Satellite 4030cdt", 107 .ident = "Toshiba Satellite 4030cdt",
107 .matches = { 108 .matches = {
108 DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"), 109 DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
109 }, 110 },
110 }, 111 },
111 { } 112 {}
112}; 113};
113 114
114static int __init acpisleep_dmi_init(void) 115static int __init acpisleep_dmi_init(void)
diff --git a/arch/i386/kernel/acpi/wakeup.S b/arch/i386/kernel/acpi/wakeup.S
index 44d886c745ec..7c74fe0dc93c 100644
--- a/arch/i386/kernel/acpi/wakeup.S
+++ b/arch/i386/kernel/acpi/wakeup.S
@@ -304,12 +304,6 @@ ret_point:
304 call restore_processor_state 304 call restore_processor_state
305 ret 305 ret
306 306
307ENTRY(do_suspend_lowlevel_s4bios)
308 call save_processor_state
309 call save_registers
310 call acpi_enter_sleep_state_s4bios
311 ret
312
313ALIGN 307ALIGN
314# saved registers 308# saved registers
315saved_gdt: .long 0,0 309saved_gdt: .long 0,0
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 46ce9b248f55..9ad43be9a01f 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -151,7 +151,7 @@ static char __devinit *table_lookup_model(struct cpuinfo_x86 *c)
151} 151}
152 152
153 153
154void __devinit get_cpu_vendor(struct cpuinfo_x86 *c, int early) 154static void __devinit get_cpu_vendor(struct cpuinfo_x86 *c, int early)
155{ 155{
156 char *v = c->x86_vendor_id; 156 char *v = c->x86_vendor_id;
157 int i; 157 int i;
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 60a9e54dd20e..822c8ce9d1f1 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -31,6 +31,7 @@
31#include <linux/cpufreq.h> 31#include <linux/cpufreq.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34#include <linux/compiler.h>
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/delay.h> 36#include <asm/delay.h>
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
@@ -57,6 +58,8 @@ static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS];
57 58
58static struct cpufreq_driver acpi_cpufreq_driver; 59static struct cpufreq_driver acpi_cpufreq_driver;
59 60
61static unsigned int acpi_pstate_strict;
62
60static int 63static int
61acpi_processor_write_port( 64acpi_processor_write_port(
62 u16 port, 65 u16 port,
@@ -163,34 +166,44 @@ acpi_processor_set_performance (
163 } 166 }
164 167
165 /* 168 /*
166 * Then we read the 'status_register' and compare the value with the 169 * Assume the write went through when acpi_pstate_strict is not used.
167 * target state's 'status' to make sure the transition was successful. 170 * As read status_register is an expensive operation and there
168 * Note that we'll poll for up to 1ms (100 cycles of 10us) before 171 * are no specific error cases where an IO port write will fail.
169 * giving up.
170 */ 172 */
171 173 if (acpi_pstate_strict) {
172 port = data->acpi_data.status_register.address; 174 /* Then we read the 'status_register' and compare the value
173 bit_width = data->acpi_data.status_register.bit_width; 175 * with the target state's 'status' to make sure the
174 176 * transition was successful.
175 dprintk("Looking for 0x%08x from port 0x%04x\n", 177 * Note that we'll poll for up to 1ms (100 cycles of 10us)
176 (u32) data->acpi_data.states[state].status, port); 178 * before giving up.
177 179 */
178 for (i=0; i<100; i++) { 180
179 ret = acpi_processor_read_port(port, bit_width, &value); 181 port = data->acpi_data.status_register.address;
180 if (ret) { 182 bit_width = data->acpi_data.status_register.bit_width;
181 dprintk("Invalid port width 0x%04x\n", bit_width); 183
182 retval = ret; 184 dprintk("Looking for 0x%08x from port 0x%04x\n",
183 goto migrate_end; 185 (u32) data->acpi_data.states[state].status, port);
186
187 for (i=0; i<100; i++) {
188 ret = acpi_processor_read_port(port, bit_width, &value);
189 if (ret) {
190 dprintk("Invalid port width 0x%04x\n", bit_width);
191 retval = ret;
192 goto migrate_end;
193 }
194 if (value == (u32) data->acpi_data.states[state].status)
195 break;
196 udelay(10);
184 } 197 }
185 if (value == (u32) data->acpi_data.states[state].status) 198 } else {
186 break; 199 i = 0;
187 udelay(10); 200 value = (u32) data->acpi_data.states[state].status;
188 } 201 }
189 202
190 /* notify cpufreq */ 203 /* notify cpufreq */
191 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); 204 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
192 205
193 if (value != (u32) data->acpi_data.states[state].status) { 206 if (unlikely(value != (u32) data->acpi_data.states[state].status)) {
194 unsigned int tmp = cpufreq_freqs.new; 207 unsigned int tmp = cpufreq_freqs.new;
195 cpufreq_freqs.new = cpufreq_freqs.old; 208 cpufreq_freqs.new = cpufreq_freqs.old;
196 cpufreq_freqs.old = tmp; 209 cpufreq_freqs.old = tmp;
@@ -537,6 +550,8 @@ acpi_cpufreq_exit (void)
537 return; 550 return;
538} 551}
539 552
553module_param(acpi_pstate_strict, uint, 0644);
554MODULE_PARM_DESC(acpi_pstate_strict, "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes.");
540 555
541late_initcall(acpi_cpufreq_init); 556late_initcall(acpi_cpufreq_init);
542module_exit(acpi_cpufreq_exit); 557module_exit(acpi_cpufreq_exit);
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index bf02b5026e62..8ef38544453c 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -467,11 +467,11 @@ static void __init longhaul_setup_voltagescaling(void)
467 } 467 }
468 468
469 if (vrmrev==0) { 469 if (vrmrev==0) {
470 dprintk ("VRM 8.5 \n"); 470 dprintk ("VRM 8.5\n");
471 memcpy (voltage_table, vrm85scales, sizeof(voltage_table)); 471 memcpy (voltage_table, vrm85scales, sizeof(voltage_table));
472 numvscales = (voltage_table[maxvid]-voltage_table[minvid])/25; 472 numvscales = (voltage_table[maxvid]-voltage_table[minvid])/25;
473 } else { 473 } else {
474 dprintk ("Mobile VRM \n"); 474 dprintk ("Mobile VRM\n");
475 memcpy (voltage_table, mobilevrmscales, sizeof(voltage_table)); 475 memcpy (voltage_table, mobilevrmscales, sizeof(voltage_table));
476 numvscales = (voltage_table[maxvid]-voltage_table[minvid])/5; 476 numvscales = (voltage_table[maxvid]-voltage_table[minvid])/5;
477 } 477 }
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index 327a55d4d1c6..c397b6220430 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -259,7 +259,7 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
259 259
260 if (model->op_points == NULL) { 260 if (model->op_points == NULL) {
261 /* Matched a non-match */ 261 /* Matched a non-match */
262 dprintk(KERN_INFO PFX "no table support for CPU model \"%s\": \n", 262 dprintk(KERN_INFO PFX "no table support for CPU model \"%s\"\n",
263 cpu->x86_model_id); 263 cpu->x86_model_id);
264#ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI 264#ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
265 dprintk(KERN_INFO PFX "try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n"); 265 dprintk(KERN_INFO PFX "try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n");
@@ -402,7 +402,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
402 402
403 for (i=0; i<p.state_count; i++) { 403 for (i=0; i<p.state_count; i++) {
404 if (p.states[i].control != p.states[i].status) { 404 if (p.states[i].control != p.states[i].status) {
405 dprintk("Different control (%x) and status values (%x)\n", 405 dprintk("Different control (%llu) and status values (%llu)\n",
406 p.states[i].control, p.states[i].status); 406 p.states[i].control, p.states[i].status);
407 result = -EINVAL; 407 result = -EINVAL;
408 goto err_unreg; 408 goto err_unreg;
@@ -415,7 +415,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
415 } 415 }
416 416
417 if (p.states[i].core_frequency > p.states[0].core_frequency) { 417 if (p.states[i].core_frequency > p.states[0].core_frequency) {
418 dprintk("P%u has larger frequency (%u) than P0 (%u), skipping\n", i, 418 dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i,
419 p.states[i].core_frequency, p.states[0].core_frequency); 419 p.states[i].core_frequency, p.states[0].core_frequency);
420 p.states[i].core_frequency = 0; 420 p.states[i].core_frequency = 0;
421 continue; 421 continue;
@@ -498,13 +498,6 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
498 if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST)) 498 if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST))
499 return -ENODEV; 499 return -ENODEV;
500 500
501 for (i = 0; i < N_IDS; i++)
502 if (centrino_verify_cpu_id(cpu, &cpu_ids[i]))
503 break;
504
505 if (i != N_IDS)
506 centrino_cpu[policy->cpu] = &cpu_ids[i];
507
508 if (is_const_loops_cpu(policy->cpu)) { 501 if (is_const_loops_cpu(policy->cpu)) {
509 centrino_driver.flags |= CPUFREQ_CONST_LOOPS; 502 centrino_driver.flags |= CPUFREQ_CONST_LOOPS;
510 } 503 }
@@ -513,6 +506,13 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
513 if (policy->cpu != 0) 506 if (policy->cpu != 0)
514 return -ENODEV; 507 return -ENODEV;
515 508
509 for (i = 0; i < N_IDS; i++)
510 if (centrino_verify_cpu_id(cpu, &cpu_ids[i]))
511 break;
512
513 if (i != N_IDS)
514 centrino_cpu[policy->cpu] = &cpu_ids[i];
515
516 if (!centrino_cpu[policy->cpu]) { 516 if (!centrino_cpu[policy->cpu]) {
517 dprintk(KERN_INFO PFX "found unsupported CPU with " 517 dprintk(KERN_INFO PFX "found unsupported CPU with "
518 "Enhanced SpeedStep: send /proc/cpuinfo to " 518 "Enhanced SpeedStep: send /proc/cpuinfo to "
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
index b25fb6b635ae..2718fb6f6aba 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
@@ -99,7 +99,7 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
99 u32 function = GET_SPEEDSTEP_FREQS; 99 u32 function = GET_SPEEDSTEP_FREQS;
100 100
101 if (!(ist_info.event & 0xFFFF)) { 101 if (!(ist_info.event & 0xFFFF)) {
102 dprintk("bug #1422 -- can't read freqs from BIOS\n", result); 102 dprintk("bug #1422 -- can't read freqs from BIOS\n");
103 return -ENODEV; 103 return -ENODEV;
104 } 104 }
105 105
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index 3aad03839660..9e24f7b207ee 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -319,7 +319,7 @@ work_notifysig: # deal with pending signals and
319 # vm86-space 319 # vm86-space
320 xorl %edx, %edx 320 xorl %edx, %edx
321 call do_notify_resume 321 call do_notify_resume
322 jmp restore_all 322 jmp resume_userspace
323 323
324 ALIGN 324 ALIGN
325work_notifysig_v86: 325work_notifysig_v86:
@@ -329,7 +329,7 @@ work_notifysig_v86:
329 movl %eax, %esp 329 movl %eax, %esp
330 xorl %edx, %edx 330 xorl %edx, %edx
331 call do_notify_resume 331 call do_notify_resume
332 jmp restore_all 332 jmp resume_userspace
333 333
334 # perform syscall exit tracing 334 # perform syscall exit tracing
335 ALIGN 335 ALIGN
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 0480ca9e9e57..e437fb367498 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -17,7 +17,7 @@
17#include <asm/desc.h> 17#include <asm/desc.h>
18#include <asm/cache.h> 18#include <asm/cache.h>
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/asm_offsets.h> 20#include <asm/asm-offsets.h>
21#include <asm/setup.h> 21#include <asm/setup.h>
22 22
23/* 23/*
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 0e727e6da5c9..378313b0cce9 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -60,6 +60,8 @@ int sis_apic_bug = -1;
60 */ 60 */
61int nr_ioapic_registers[MAX_IO_APICS]; 61int nr_ioapic_registers[MAX_IO_APICS];
62 62
63int disable_timer_pin_1 __initdata;
64
63/* 65/*
64 * Rough estimation of how many shared IRQs there are, can 66 * Rough estimation of how many shared IRQs there are, can
65 * be changed anytime. 67 * be changed anytime.
@@ -573,8 +575,7 @@ static int balanced_irq(void *unused)
573 } 575 }
574 576
575 for ( ; ; ) { 577 for ( ; ; ) {
576 set_current_state(TASK_INTERRUPTIBLE); 578 time_remaining = schedule_timeout_interruptible(time_remaining);
577 time_remaining = schedule_timeout(time_remaining);
578 try_to_freeze(); 579 try_to_freeze();
579 if (time_after(jiffies, 580 if (time_after(jiffies,
580 prev_balance_time+balanced_irq_interval)) { 581 prev_balance_time+balanced_irq_interval)) {
@@ -1634,9 +1635,9 @@ void disable_IO_APIC(void)
1634 clear_IO_APIC(); 1635 clear_IO_APIC();
1635 1636
1636 /* 1637 /*
1637 * If the i82559 is routed through an IOAPIC 1638 * If the i8259 is routed through an IOAPIC
1638 * Put that IOAPIC in virtual wire mode 1639 * Put that IOAPIC in virtual wire mode
1639 * so legacy interrups can be delivered. 1640 * so legacy interrupts can be delivered.
1640 */ 1641 */
1641 pin = find_isa_irq_pin(0, mp_ExtINT); 1642 pin = find_isa_irq_pin(0, mp_ExtINT);
1642 if (pin != -1) { 1643 if (pin != -1) {
@@ -2212,6 +2213,8 @@ static inline void check_timer(void)
2212 setup_nmi(); 2213 setup_nmi();
2213 enable_8259A_irq(0); 2214 enable_8259A_irq(0);
2214 } 2215 }
2216 if (disable_timer_pin_1 > 0)
2217 clear_IO_APIC_pin(0, pin1);
2215 return; 2218 return;
2216 } 2219 }
2217 clear_IO_APIC_pin(0, pin1); 2220 clear_IO_APIC_pin(0, pin1);
@@ -2423,7 +2426,7 @@ device_initcall(ioapic_init_sysfs);
2423 ACPI-based IOAPIC Configuration 2426 ACPI-based IOAPIC Configuration
2424 -------------------------------------------------------------------------- */ 2427 -------------------------------------------------------------------------- */
2425 2428
2426#ifdef CONFIG_ACPI_BOOT 2429#ifdef CONFIG_ACPI
2427 2430
2428int __init io_apic_get_unique_id (int ioapic, int apic_id) 2431int __init io_apic_get_unique_id (int ioapic, int apic_id)
2429{ 2432{
@@ -2577,4 +2580,4 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2577 return 0; 2580 return 0;
2578} 2581}
2579 2582
2580#endif /*CONFIG_ACPI_BOOT*/ 2583#endif /* CONFIG_ACPI */
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 5d0b9a8fc43d..15949fd08109 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -122,8 +122,8 @@ static int MP_valid_apicid(int apicid, int version)
122 122
123static void __init MP_processor_info (struct mpc_config_processor *m) 123static void __init MP_processor_info (struct mpc_config_processor *m)
124{ 124{
125 int ver, apicid, cpu, found_bsp = 0; 125 int ver, apicid;
126 physid_mask_t tmp; 126 physid_mask_t phys_cpu;
127 127
128 if (!(m->mpc_cpuflag & CPU_ENABLED)) 128 if (!(m->mpc_cpuflag & CPU_ENABLED))
129 return; 129 return;
@@ -181,7 +181,6 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
181 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { 181 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
182 Dprintk(" Bootup CPU\n"); 182 Dprintk(" Bootup CPU\n");
183 boot_cpu_physical_apicid = m->mpc_apicid; 183 boot_cpu_physical_apicid = m->mpc_apicid;
184 found_bsp = 1;
185 } 184 }
186 185
187 if (num_processors >= NR_CPUS) { 186 if (num_processors >= NR_CPUS) {
@@ -195,29 +194,26 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
195 " Processor ignored.\n", maxcpus); 194 " Processor ignored.\n", maxcpus);
196 return; 195 return;
197 } 196 }
198 num_processors++;
199 ver = m->mpc_apicver; 197 ver = m->mpc_apicver;
200 198
201 if (!MP_valid_apicid(apicid, ver)) { 199 if (!MP_valid_apicid(apicid, ver)) {
202 printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n", 200 printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n",
203 m->mpc_apicid, MAX_APICS); 201 m->mpc_apicid, MAX_APICS);
204 --num_processors;
205 return; 202 return;
206 } 203 }
207 204
208 if (found_bsp) 205 cpu_set(num_processors, cpu_possible_map);
209 cpu = 0; 206 num_processors++;
210 else 207 phys_cpu = apicid_to_cpu_present(apicid);
211 cpu = num_processors - 1; 208 physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);
212 cpu_set(cpu, cpu_possible_map); 209
213 tmp = apicid_to_cpu_present(apicid);
214 physids_or(phys_cpu_present_map, phys_cpu_present_map, tmp);
215
216 /* 210 /*
217 * Validate version 211 * Validate version
218 */ 212 */
219 if (ver == 0x0) { 213 if (ver == 0x0) {
220 printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! fixing up to 0x10. (tell your hw vendor)\n", m->mpc_apicid); 214 printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
215 "fixing up to 0x10. (tell your hw vendor)\n",
216 m->mpc_apicid);
221 ver = 0x10; 217 ver = 0x10;
222 } 218 }
223 apic_version[m->mpc_apicid] = ver; 219 apic_version[m->mpc_apicid] = ver;
@@ -668,8 +664,6 @@ void __init get_smp_config (void)
668 struct intel_mp_floating *mpf = mpf_found; 664 struct intel_mp_floating *mpf = mpf_found;
669 665
670 /* 666 /*
671 * ACPI may be used to obtain the entire SMP configuration or just to
672 * enumerate/configure processors (CONFIG_ACPI_BOOT). Note that
673 * ACPI supports both logical (e.g. Hyper-Threading) and physical 667 * ACPI supports both logical (e.g. Hyper-Threading) and physical
674 * processors, where MPS only supports physical. 668 * processors, where MPS only supports physical.
675 */ 669 */
@@ -825,7 +819,7 @@ void __init find_smp_config (void)
825 ACPI-based MP Configuration 819 ACPI-based MP Configuration
826 -------------------------------------------------------------------------- */ 820 -------------------------------------------------------------------------- */
827 821
828#ifdef CONFIG_ACPI_BOOT 822#ifdef CONFIG_ACPI
829 823
830void __init mp_register_lapic_address ( 824void __init mp_register_lapic_address (
831 u64 address) 825 u64 address)
@@ -871,7 +865,7 @@ void __init mp_register_lapic (
871 MP_processor_info(&processor); 865 MP_processor_info(&processor);
872} 866}
873 867
874#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) 868#ifdef CONFIG_X86_IO_APIC
875 869
876#define MP_ISA_BUS 0 870#define MP_ISA_BUS 0
877#define MP_MAX_IOAPIC_PIN 127 871#define MP_MAX_IOAPIC_PIN 127
@@ -1086,11 +1080,9 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1086 */ 1080 */
1087 static int gsi_to_irq[MAX_GSI_NUM]; 1081 static int gsi_to_irq[MAX_GSI_NUM];
1088 1082
1089#ifdef CONFIG_ACPI_BUS
1090 /* Don't set up the ACPI SCI because it's already set up */ 1083 /* Don't set up the ACPI SCI because it's already set up */
1091 if (acpi_fadt.sci_int == gsi) 1084 if (acpi_fadt.sci_int == gsi)
1092 return gsi; 1085 return gsi;
1093#endif
1094 1086
1095 ioapic = mp_find_ioapic(gsi); 1087 ioapic = mp_find_ioapic(gsi);
1096 if (ioapic < 0) { 1088 if (ioapic < 0) {
@@ -1133,13 +1125,11 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1133 if (gsi < MAX_GSI_NUM) { 1125 if (gsi < MAX_GSI_NUM) {
1134 if (gsi > 15) 1126 if (gsi > 15)
1135 gsi = pci_irq++; 1127 gsi = pci_irq++;
1136#ifdef CONFIG_ACPI_BUS
1137 /* 1128 /*
1138 * Don't assign IRQ used by ACPI SCI 1129 * Don't assign IRQ used by ACPI SCI
1139 */ 1130 */
1140 if (gsi == acpi_fadt.sci_int) 1131 if (gsi == acpi_fadt.sci_int)
1141 gsi = pci_irq++; 1132 gsi = pci_irq++;
1142#endif
1143 gsi_to_irq[irq] = gsi; 1133 gsi_to_irq[irq] = gsi;
1144 } else { 1134 } else {
1145 printk(KERN_ERR "GSI %u is too high\n", gsi); 1135 printk(KERN_ERR "GSI %u is too high\n", gsi);
@@ -1153,5 +1143,5 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1153 return gsi; 1143 return gsi;
1154} 1144}
1155 1145
1156#endif /*CONFIG_X86_IO_APIC && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT)*/ 1146#endif /* CONFIG_X86_IO_APIC */
1157#endif /*CONFIG_ACPI_BOOT*/ 1147#endif /* CONFIG_ACPI */
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
index 340980203b09..7b6368bf8974 100644
--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -694,17 +694,22 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
694__attribute__((regparm(3))) 694__attribute__((regparm(3)))
695int do_syscall_trace(struct pt_regs *regs, int entryexit) 695int do_syscall_trace(struct pt_regs *regs, int entryexit)
696{ 696{
697 int is_sysemu = test_thread_flag(TIF_SYSCALL_EMU), ret = 0; 697 int is_sysemu = test_thread_flag(TIF_SYSCALL_EMU);
698 /* With TIF_SYSCALL_EMU set we want to ignore TIF_SINGLESTEP for syscall 698 /*
699 * interception. */ 699 * With TIF_SYSCALL_EMU set we want to ignore TIF_SINGLESTEP for syscall
700 * interception
701 */
700 int is_singlestep = !is_sysemu && test_thread_flag(TIF_SINGLESTEP); 702 int is_singlestep = !is_sysemu && test_thread_flag(TIF_SINGLESTEP);
703 int ret = 0;
701 704
702 /* do the secure computing check first */ 705 /* do the secure computing check first */
703 secure_computing(regs->orig_eax); 706 if (!entryexit)
707 secure_computing(regs->orig_eax);
704 708
705 if (unlikely(current->audit_context)) { 709 if (unlikely(current->audit_context)) {
706 if (entryexit) 710 if (entryexit)
707 audit_syscall_exit(current, AUDITSC_RESULT(regs->eax), regs->eax); 711 audit_syscall_exit(current, AUDITSC_RESULT(regs->eax),
712 regs->eax);
708 /* Debug traps, when using PTRACE_SINGLESTEP, must be sent only 713 /* Debug traps, when using PTRACE_SINGLESTEP, must be sent only
709 * on the syscall exit path. Normally, when TIF_SYSCALL_AUDIT is 714 * on the syscall exit path. Normally, when TIF_SYSCALL_AUDIT is
710 * not used, entry.S will call us only on syscall exit, not 715 * not used, entry.S will call us only on syscall exit, not
@@ -738,7 +743,7 @@ int do_syscall_trace(struct pt_regs *regs, int entryexit)
738 /* the 0x80 provides a way for the tracing parent to distinguish 743 /* the 0x80 provides a way for the tracing parent to distinguish
739 between a syscall stop and SIGTRAP delivery */ 744 between a syscall stop and SIGTRAP delivery */
740 /* Note that the debugger could change the result of test_thread_flag!*/ 745 /* Note that the debugger could change the result of test_thread_flag!*/
741 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); 746 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ? 0x80:0));
742 747
743 /* 748 /*
744 * this isn't the same as continuing with a signal, but it will do 749 * this isn't the same as continuing with a signal, but it will do
@@ -750,7 +755,7 @@ int do_syscall_trace(struct pt_regs *regs, int entryexit)
750 current->exit_code = 0; 755 current->exit_code = 0;
751 } 756 }
752 ret = is_sysemu; 757 ret = is_sysemu;
753 out: 758out:
754 if (unlikely(current->audit_context) && !entryexit) 759 if (unlikely(current->audit_context) && !entryexit)
755 audit_syscall_entry(current, AUDIT_ARCH_I386, regs->orig_eax, 760 audit_syscall_entry(current, AUDIT_ARCH_I386, regs->orig_eax,
756 regs->ebx, regs->ecx, regs->edx, regs->esi); 761 regs->ebx, regs->ecx, regs->edx, regs->esi);
@@ -759,6 +764,7 @@ int do_syscall_trace(struct pt_regs *regs, int entryexit)
759 764
760 regs->orig_eax = -1; /* force skip of syscall restarting */ 765 regs->orig_eax = -1; /* force skip of syscall restarting */
761 if (unlikely(current->audit_context)) 766 if (unlikely(current->audit_context))
762 audit_syscall_exit(current, AUDITSC_RESULT(regs->eax), regs->eax); 767 audit_syscall_exit(current, AUDITSC_RESULT(regs->eax),
768 regs->eax);
763 return 1; 769 return 1;
764} 770}
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index e29fd5aeaf8e..dc39ca6a7eca 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -87,14 +87,14 @@ EXPORT_SYMBOL(boot_cpu_data);
87 87
88unsigned long mmu_cr4_features; 88unsigned long mmu_cr4_features;
89 89
90#ifdef CONFIG_ACPI_INTERPRETER 90#ifdef CONFIG_ACPI
91 int acpi_disabled = 0; 91 int acpi_disabled = 0;
92#else 92#else
93 int acpi_disabled = 1; 93 int acpi_disabled = 1;
94#endif 94#endif
95EXPORT_SYMBOL(acpi_disabled); 95EXPORT_SYMBOL(acpi_disabled);
96 96
97#ifdef CONFIG_ACPI_BOOT 97#ifdef CONFIG_ACPI
98int __initdata acpi_force = 0; 98int __initdata acpi_force = 0;
99extern acpi_interrupt_flags acpi_sci_flags; 99extern acpi_interrupt_flags acpi_sci_flags;
100#endif 100#endif
@@ -139,6 +139,7 @@ struct sys_desc_table_struct {
139 unsigned char table[0]; 139 unsigned char table[0];
140}; 140};
141struct edid_info edid_info; 141struct edid_info edid_info;
142EXPORT_SYMBOL_GPL(edid_info);
142struct ist_info ist_info; 143struct ist_info ist_info;
143#if defined(CONFIG_X86_SPEEDSTEP_SMI) || \ 144#if defined(CONFIG_X86_SPEEDSTEP_SMI) || \
144 defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE) 145 defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
@@ -798,7 +799,7 @@ static void __init parse_cmdline_early (char ** cmdline_p)
798 } 799 }
799#endif 800#endif
800 801
801#ifdef CONFIG_ACPI_BOOT 802#ifdef CONFIG_ACPI
802 /* "acpi=off" disables both ACPI table parsing and interpreter */ 803 /* "acpi=off" disables both ACPI table parsing and interpreter */
803 else if (!memcmp(from, "acpi=off", 8)) { 804 else if (!memcmp(from, "acpi=off", 8)) {
804 disable_acpi(); 805 disable_acpi();
@@ -850,11 +851,16 @@ static void __init parse_cmdline_early (char ** cmdline_p)
850#endif 851#endif
851 852
852#ifdef CONFIG_X86_LOCAL_APIC 853#ifdef CONFIG_X86_LOCAL_APIC
854 if (!memcmp(from, "disable_timer_pin_1", 19))
855 disable_timer_pin_1 = 1;
856 if (!memcmp(from, "enable_timer_pin_1", 18))
857 disable_timer_pin_1 = -1;
858
853 /* disable IO-APIC */ 859 /* disable IO-APIC */
854 else if (!memcmp(from, "noapic", 6)) 860 else if (!memcmp(from, "noapic", 6))
855 disable_ioapic_setup(); 861 disable_ioapic_setup();
856#endif /* CONFIG_X86_LOCAL_APIC */ 862#endif /* CONFIG_X86_LOCAL_APIC */
857#endif /* CONFIG_ACPI_BOOT */ 863#endif /* CONFIG_ACPI */
858 864
859#ifdef CONFIG_X86_LOCAL_APIC 865#ifdef CONFIG_X86_LOCAL_APIC
860 /* enable local APIC */ 866 /* enable local APIC */
@@ -1299,7 +1305,7 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat
1299 */ 1305 */
1300static void __init register_memory(void) 1306static void __init register_memory(void)
1301{ 1307{
1302 unsigned long gapstart, gapsize; 1308 unsigned long gapstart, gapsize, round;
1303 unsigned long long last; 1309 unsigned long long last;
1304 int i; 1310 int i;
1305 1311
@@ -1344,14 +1350,14 @@ static void __init register_memory(void)
1344 } 1350 }
1345 1351
1346 /* 1352 /*
1347 * Start allocating dynamic PCI memory a bit into the gap, 1353 * See how much we want to round up: start off with
1348 * aligned up to the nearest megabyte. 1354 * rounding to the next 1MB area.
1349 *
1350 * Question: should we try to pad it up a bit (do something
1351 * like " + (gapsize >> 3)" in there too?). We now have the
1352 * technology.
1353 */ 1355 */
1354 pci_mem_start = (gapstart + 0xfffff) & ~0xfffff; 1356 round = 0x100000;
1357 while ((gapsize >> 4) > round)
1358 round += round;
1359 /* Fun with two's complement */
1360 pci_mem_start = (gapstart + round) & -round;
1355 1361
1356 printk("Allocating PCI resources starting at %08lx (gap: %08lx:%08lx)\n", 1362 printk("Allocating PCI resources starting at %08lx (gap: %08lx:%08lx)\n",
1357 pci_mem_start, gapstart, gapsize); 1363 pci_mem_start, gapstart, gapsize);
@@ -1579,7 +1585,7 @@ void __init setup_arch(char **cmdline_p)
1579 if (efi_enabled) 1585 if (efi_enabled)
1580 efi_map_memmap(); 1586 efi_map_memmap();
1581 1587
1582#ifdef CONFIG_ACPI_BOOT 1588#ifdef CONFIG_ACPI
1583 /* 1589 /*
1584 * Parse the ACPI tables for possible boot-time SMP configuration. 1590 * Parse the ACPI tables for possible boot-time SMP configuration.
1585 */ 1591 */
diff --git a/arch/i386/kernel/sigframe.h b/arch/i386/kernel/sigframe.h
index d21b14f5c25c..0b2221711dad 100644
--- a/arch/i386/kernel/sigframe.h
+++ b/arch/i386/kernel/sigframe.h
@@ -1,6 +1,6 @@
1struct sigframe 1struct sigframe
2{ 2{
3 char *pretcode; 3 char __user *pretcode;
4 int sig; 4 int sig;
5 struct sigcontext sc; 5 struct sigcontext sc;
6 struct _fpstate fpstate; 6 struct _fpstate fpstate;
@@ -10,10 +10,10 @@ struct sigframe
10 10
11struct rt_sigframe 11struct rt_sigframe
12{ 12{
13 char *pretcode; 13 char __user *pretcode;
14 int sig; 14 int sig;
15 struct siginfo *pinfo; 15 struct siginfo __user *pinfo;
16 void *puc; 16 void __user *puc;
17 struct siginfo info; 17 struct siginfo info;
18 struct ucontext uc; 18 struct ucontext uc;
19 struct _fpstate fpstate; 19 struct _fpstate fpstate;
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 5e4893d2b9f2..c70cd2a08304 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -1330,8 +1330,7 @@ void __cpu_die(unsigned int cpu)
1330 printk ("CPU %d is now offline\n", cpu); 1330 printk ("CPU %d is now offline\n", cpu);
1331 return; 1331 return;
1332 } 1332 }
1333 current->state = TASK_UNINTERRUPTIBLE; 1333 msleep(100);
1334 schedule_timeout(HZ/10);
1335 } 1334 }
1336 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1335 printk(KERN_ERR "CPU %u didn't die...\n", cpu);
1337} 1336}
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c
index 7b3b27d64409..516bf5653b02 100644
--- a/arch/i386/kernel/srat.c
+++ b/arch/i386/kernel/srat.c
@@ -213,12 +213,18 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c
213 node_end_pfn[nid] = memory_chunk->end_pfn; 213 node_end_pfn[nid] = memory_chunk->end_pfn;
214} 214}
215 215
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
216/* Parse the ACPI Static Resource Affinity Table */ 223/* Parse the ACPI Static Resource Affinity Table */
217static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) 224static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
218{ 225{
219 u8 *start, *end, *p; 226 u8 *start, *end, *p;
220 int i, j, nid; 227 int i, j, nid;
221 u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */
222 u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */ 228 u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */
223 229
224 start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ 230 start = (u8 *)(&(sratp->reserved) + 1); /* skip header */
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index eefea7c55008..2883a4d4f01f 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -329,8 +329,7 @@ EXPORT_SYMBOL(get_cmos_time);
329 329
330static void sync_cmos_clock(unsigned long dummy); 330static void sync_cmos_clock(unsigned long dummy);
331 331
332static struct timer_list sync_cmos_timer = 332static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0);
333 TIMER_INITIALIZER(sync_cmos_clock, 0, 0);
334 333
335static void sync_cmos_clock(unsigned long dummy) 334static void sync_cmos_clock(unsigned long dummy)
336{ 335{
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index 13b9c62cbbb4..4710195b6b74 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -144,12 +144,7 @@ SECTIONS
144 *(.exitcall.exit) 144 *(.exitcall.exit)
145 } 145 }
146 146
147 /* Stabs debugging sections. */ 147 STABS_DEBUG
148 .stab 0 : { *(.stab) } 148
149 .stabstr 0 : { *(.stabstr) } 149 DWARF_DEBUG
150 .stab.excl 0 : { *(.stab.excl) }
151 .stab.exclstr 0 : { *(.stab.exclstr) }
152 .stab.index 0 : { *(.stab.index) }
153 .stab.indexstr 0 : { *(.stab.indexstr) }
154 .comment 0 : { *(.comment) }
155} 150}
diff --git a/arch/i386/kernel/vsyscall-sigreturn.S b/arch/i386/kernel/vsyscall-sigreturn.S
index 68afa50dd7cf..fadb5bc3c374 100644
--- a/arch/i386/kernel/vsyscall-sigreturn.S
+++ b/arch/i386/kernel/vsyscall-sigreturn.S
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include <asm/unistd.h> 9#include <asm/unistd.h>
10#include <asm/asm_offsets.h> 10#include <asm/asm-offsets.h>
11 11
12 12
13/* XXX 13/* XXX
diff --git a/arch/i386/kernel/vsyscall.lds.S b/arch/i386/kernel/vsyscall.lds.S
index a7977707c8e5..98699ca6e52d 100644
--- a/arch/i386/kernel/vsyscall.lds.S
+++ b/arch/i386/kernel/vsyscall.lds.S
@@ -3,7 +3,7 @@
3 * object prelinked to its virtual address, and with only one read-only 3 * object prelinked to its virtual address, and with only one read-only
4 * segment (that fits in one page). This script controls its layout. 4 * segment (that fits in one page). This script controls its layout.
5 */ 5 */
6#include <asm/asm_offsets.h> 6#include <asm/asm-offsets.h>
7 7
8SECTIONS 8SECTIONS
9{ 9{
diff --git a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c
index 2000bdca2fc2..dc6660511b07 100644
--- a/arch/i386/mach-es7000/es7000plat.c
+++ b/arch/i386/mach-es7000/es7000plat.c
@@ -51,7 +51,7 @@ struct mip_reg *host_reg;
51int mip_port; 51int mip_port;
52unsigned long mip_addr, host_addr; 52unsigned long mip_addr, host_addr;
53 53
54#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) 54#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI)
55 55
56/* 56/*
57 * GSI override for ES7000 platforms. 57 * GSI override for ES7000 platforms.
@@ -73,7 +73,7 @@ es7000_rename_gsi(int ioapic, int gsi)
73 return gsi; 73 return gsi;
74} 74}
75 75
76#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT) 76#endif /* (CONFIG_X86_IO_APIC) && (CONFIG_ACPI) */
77 77
78void __init 78void __init
79setup_unisys () 79setup_unisys ()
diff --git a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile
index 1bff03f36965..ead6122dd06d 100644
--- a/arch/i386/pci/Makefile
+++ b/arch/i386/pci/Makefile
@@ -5,7 +5,7 @@ obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
5obj-$(CONFIG_PCI_DIRECT) += direct.o 5obj-$(CONFIG_PCI_DIRECT) += direct.o
6 6
7pci-y := fixup.o 7pci-y := fixup.o
8pci-$(CONFIG_ACPI_PCI) += acpi.o 8pci-$(CONFIG_ACPI) += acpi.o
9pci-y += legacy.o irq.o 9pci-y += legacy.o irq.o
10 10
11pci-$(CONFIG_X86_VISWS) := visws.o fixup.o 11pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
index 42913f43feb0..2941674f35eb 100644
--- a/arch/i386/pci/acpi.c
+++ b/arch/i386/pci/acpi.c
@@ -3,16 +3,31 @@
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/irq.h> 4#include <linux/irq.h>
5#include <asm/hw_irq.h> 5#include <asm/hw_irq.h>
6#include <asm/numa.h>
6#include "pci.h" 7#include "pci.h"
7 8
8struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) 9struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum)
9{ 10{
11 struct pci_bus *bus;
12
10 if (domain != 0) { 13 if (domain != 0) {
11 printk(KERN_WARNING "PCI: Multiple domains not supported\n"); 14 printk(KERN_WARNING "PCI: Multiple domains not supported\n");
12 return NULL; 15 return NULL;
13 } 16 }
14 17
15 return pcibios_scan_root(busnum); 18 bus = pcibios_scan_root(busnum);
19#ifdef CONFIG_ACPI_NUMA
20 if (bus != NULL) {
21 int pxm = acpi_get_pxm(device->handle);
22 if (pxm >= 0) {
23 bus->sysdata = (void *)(unsigned long)pxm_to_node(pxm);
24 printk("bus %d -> pxm %d -> node %ld\n",
25 busnum, pxm, (long)(bus->sysdata));
26 }
27 }
28#endif
29
30 return bus;
16} 31}
17 32
18extern int pci_routeirq; 33extern int pci_routeirq;
diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
index 3cc480998a47..6d6338500c3c 100644
--- a/arch/i386/pci/i386.c
+++ b/arch/i386/pci/i386.c
@@ -283,9 +283,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
283 /* Write-combine setting is ignored, it is changed via the mtrr 283 /* Write-combine setting is ignored, it is changed via the mtrr
284 * interfaces on this platform. 284 * interfaces on this platform.
285 */ 285 */
286 if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 286 if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
287 vma->vm_end - vma->vm_start, 287 vma->vm_end - vma->vm_start,
288 vma->vm_page_prot)) 288 vma->vm_page_prot))
289 return -EAGAIN; 289 return -EAGAIN;
290 290
291 return 0; 291 return 0;
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 86348b68fda1..326a2edc3834 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -1075,7 +1075,7 @@ static void pirq_penalize_isa_irq(int irq, int active)
1075 1075
1076void pcibios_penalize_isa_irq(int irq, int active) 1076void pcibios_penalize_isa_irq(int irq, int active)
1077{ 1077{
1078#ifdef CONFIG_ACPI_PCI 1078#ifdef CONFIG_ACPI
1079 if (!acpi_noirq) 1079 if (!acpi_noirq)
1080 acpi_penalize_isa_irq(irq, active); 1080 acpi_penalize_isa_irq(irq, active);
1081 else 1081 else
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index 60f0e7a1162a..dfbf80cff834 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -127,13 +127,6 @@ static int __init pci_mmcfg_init(void)
127 (pci_mmcfg_config[0].base_address == 0)) 127 (pci_mmcfg_config[0].base_address == 0))
128 goto out; 128 goto out;
129 129
130 /* Kludge for now. Don't use mmconfig on AMD systems because
131 those have some busses where mmconfig doesn't work,
132 and we don't parse ACPI MCFG well enough to handle that.
133 Remove when proper handling is added. */
134 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
135 goto out;
136
137 printk(KERN_INFO "PCI: Using MMCONFIG\n"); 130 printk(KERN_INFO "PCI: Using MMCONFIG\n");
138 raw_pci_ops = &pci_mmcfg; 131 raw_pci_ops = &pci_mmcfg;
139 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; 132 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
diff --git a/arch/i386/power/swsusp.S b/arch/i386/power/swsusp.S
index c4105286ff26..c893b897217f 100644
--- a/arch/i386/power/swsusp.S
+++ b/arch/i386/power/swsusp.S
@@ -12,7 +12,7 @@
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/segment.h> 13#include <asm/segment.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/asm_offsets.h> 15#include <asm/asm-offsets.h>
16 16
17 .text 17 .text
18 18
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 17b5dbf8c311..ed25d66c8d50 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -60,6 +60,7 @@ choice
60 60
61config IA64_GENERIC 61config IA64_GENERIC
62 bool "generic" 62 bool "generic"
63 select ACPI
63 select NUMA 64 select NUMA
64 select ACPI_NUMA 65 select ACPI_NUMA
65 select VIRTUAL_MEM_MAP 66 select VIRTUAL_MEM_MAP
@@ -338,11 +339,6 @@ config IA64_PALINFO
338 To use this option, you have to ensure that the "/proc file system 339 To use this option, you have to ensure that the "/proc file system
339 support" (CONFIG_PROC_FS) is enabled, too. 340 support" (CONFIG_PROC_FS) is enabled, too.
340 341
341config ACPI_DEALLOCATE_IRQ
342 bool
343 depends on IOSAPIC && EXPERIMENTAL
344 default y
345
346source "drivers/firmware/Kconfig" 342source "drivers/firmware/Kconfig"
347 343
348source "fs/Kconfig.binfmt" 344source "fs/Kconfig.binfmt"
@@ -351,38 +347,10 @@ endmenu
351 347
352menu "Power management and ACPI" 348menu "Power management and ACPI"
353 349
354config PM 350source "kernel/power/Kconfig"
355 bool "Power Management support"
356 depends on !IA64_HP_SIM
357 default y
358 help
359 "Power Management" means that parts of your computer are shut
360 off or put into a power conserving "sleep" mode if they are not
361 being used. There are two competing standards for doing this: APM
362 and ACPI. If you want to use either one, say Y here and then also
363 to the requisite support below.
364
365 Power Management is most important for battery powered laptop
366 computers; if you have a laptop, check out the Linux Laptop home
367 page on the WWW at <http://www.linux-on-laptops.com/> and the
368 Battery Powered Linux mini-HOWTO, available from
369 <http://www.tldp.org/docs.html#howto>.
370
371 Note that, even if you say N here, Linux on the x86 architecture
372 will issue the hlt instruction if nothing is to be done, thereby
373 sending the processor to sleep and saving power.
374
375config ACPI
376 bool
377 depends on !IA64_HP_SIM
378 default y
379
380if !IA64_HP_SIM
381 351
382source "drivers/acpi/Kconfig" 352source "drivers/acpi/Kconfig"
383 353
384endif
385
386if PM 354if PM
387 355
388source "arch/ia64/kernel/cpufreq/Kconfig" 356source "arch/ia64/kernel/cpufreq/Kconfig"
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index f9bd88ada708..70f8ed2748d1 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -82,25 +82,18 @@ unwcheck: vmlinux
82archclean: 82archclean:
83 $(Q)$(MAKE) $(clean)=$(boot) 83 $(Q)$(MAKE) $(clean)=$(boot)
84 84
85CLEAN_FILES += include/asm-ia64/.offsets.h.stamp vmlinux.gz bootloader 85archprepare: include/asm-ia64/.offsets.h.stamp
86
87MRPROPER_FILES += include/asm-ia64/offsets.h
88
89prepare: include/asm-ia64/offsets.h
90
91arch/ia64/kernel/asm-offsets.s: include/asm include/linux/version.h include/config/MARKER
92
93include/asm-ia64/offsets.h: arch/ia64/kernel/asm-offsets.s
94 $(call filechk,gen-asm-offsets)
95
96arch/ia64/kernel/asm-offsets.s: include/asm-ia64/.offsets.h.stamp
97 86
98include/asm-ia64/.offsets.h.stamp: 87include/asm-ia64/.offsets.h.stamp:
99 mkdir -p include/asm-ia64 88 mkdir -p include/asm-ia64
100 [ -s include/asm-ia64/offsets.h ] \ 89 [ -s include/asm-ia64/asm-offsets.h ] \
101 || echo "#define IA64_TASK_SIZE 0" > include/asm-ia64/offsets.h 90 || echo "#define IA64_TASK_SIZE 0" > include/asm-ia64/asm-offsets.h
102 touch $@ 91 touch $@
103 92
93
94
95CLEAN_FILES += vmlinux.gz bootloader include/asm-ia64/.offsets.h.stamp
96
104boot: lib/lib.a vmlinux 97boot: lib/lib.a vmlinux
105 $(Q)$(MAKE) $(build)=$(boot) $@ 98 $(Q)$(MAKE) $(build)=$(boot) $@
106 99
diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig
index b95fcf86ea00..3b65cbb31b1d 100644
--- a/arch/ia64/configs/bigsur_defconfig
+++ b/arch/ia64/configs/bigsur_defconfig
@@ -107,18 +107,12 @@ CONFIG_ACPI=y
107# 107#
108# ACPI (Advanced Configuration and Power Interface) Support 108# ACPI (Advanced Configuration and Power Interface) Support
109# 109#
110CONFIG_ACPI_BOOT=y
111CONFIG_ACPI_INTERPRETER=y
112CONFIG_ACPI_BUTTON=m 110CONFIG_ACPI_BUTTON=m
113CONFIG_ACPI_VIDEO=m
114CONFIG_ACPI_FAN=m 111CONFIG_ACPI_FAN=m
115CONFIG_ACPI_PROCESSOR=m 112CONFIG_ACPI_PROCESSOR=m
116CONFIG_ACPI_THERMAL=m 113CONFIG_ACPI_THERMAL=m
117CONFIG_ACPI_BLACKLIST_YEAR=0
118# CONFIG_ACPI_DEBUG is not set 114# CONFIG_ACPI_DEBUG is not set
119CONFIG_ACPI_BUS=y
120CONFIG_ACPI_POWER=y 115CONFIG_ACPI_POWER=y
121CONFIG_ACPI_PCI=y
122CONFIG_ACPI_SYSTEM=y 116CONFIG_ACPI_SYSTEM=y
123 117
124# 118#
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index dccf35c60b94..08112ab38468 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -111,7 +111,6 @@ CONFIG_COMPAT=y
111CONFIG_IA64_MCA_RECOVERY=y 111CONFIG_IA64_MCA_RECOVERY=y
112CONFIG_PERFMON=y 112CONFIG_PERFMON=y
113CONFIG_IA64_PALINFO=y 113CONFIG_IA64_PALINFO=y
114CONFIG_ACPI_DEALLOCATE_IRQ=y
115 114
116# 115#
117# Firmware Drivers 116# Firmware Drivers
@@ -130,19 +129,12 @@ CONFIG_ACPI=y
130# 129#
131# ACPI (Advanced Configuration and Power Interface) Support 130# ACPI (Advanced Configuration and Power Interface) Support
132# 131#
133CONFIG_ACPI_BOOT=y
134CONFIG_ACPI_INTERPRETER=y
135# CONFIG_ACPI_BUTTON is not set 132# CONFIG_ACPI_BUTTON is not set
136CONFIG_ACPI_VIDEO=m
137CONFIG_ACPI_HOTKEY=m
138# CONFIG_ACPI_FAN is not set 133# CONFIG_ACPI_FAN is not set
139# CONFIG_ACPI_PROCESSOR is not set 134# CONFIG_ACPI_PROCESSOR is not set
140CONFIG_ACPI_NUMA=y 135CONFIG_ACPI_NUMA=y
141CONFIG_ACPI_BLACKLIST_YEAR=0
142# CONFIG_ACPI_DEBUG is not set 136# CONFIG_ACPI_DEBUG is not set
143CONFIG_ACPI_BUS=y
144CONFIG_ACPI_POWER=y 137CONFIG_ACPI_POWER=y
145CONFIG_ACPI_PCI=y
146CONFIG_ACPI_SYSTEM=y 138CONFIG_ACPI_SYSTEM=y
147# CONFIG_ACPI_CONTAINER is not set 139# CONFIG_ACPI_CONTAINER is not set
148 140
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index c853cfcd2d11..d452e18ac494 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -109,7 +109,6 @@ CONFIG_COMPAT=y
109CONFIG_IA64_MCA_RECOVERY=y 109CONFIG_IA64_MCA_RECOVERY=y
110CONFIG_PERFMON=y 110CONFIG_PERFMON=y
111CONFIG_IA64_PALINFO=y 111CONFIG_IA64_PALINFO=y
112CONFIG_ACPI_DEALLOCATE_IRQ=y
113 112
114# 113#
115# Firmware Drivers 114# Firmware Drivers
@@ -128,20 +127,13 @@ CONFIG_ACPI=y
128# 127#
129# ACPI (Advanced Configuration and Power Interface) Support 128# ACPI (Advanced Configuration and Power Interface) Support
130# 129#
131CONFIG_ACPI_BOOT=y
132CONFIG_ACPI_INTERPRETER=y
133CONFIG_ACPI_BUTTON=m 130CONFIG_ACPI_BUTTON=m
134# CONFIG_ACPI_VIDEO is not set
135# CONFIG_ACPI_HOTKEY is not set
136CONFIG_ACPI_FAN=m 131CONFIG_ACPI_FAN=m
137CONFIG_ACPI_PROCESSOR=m 132CONFIG_ACPI_PROCESSOR=m
138# CONFIG_ACPI_HOTPLUG_CPU is not set 133# CONFIG_ACPI_HOTPLUG_CPU is not set
139CONFIG_ACPI_THERMAL=m 134CONFIG_ACPI_THERMAL=m
140CONFIG_ACPI_BLACKLIST_YEAR=0
141# CONFIG_ACPI_DEBUG is not set 135# CONFIG_ACPI_DEBUG is not set
142CONFIG_ACPI_BUS=y
143CONFIG_ACPI_POWER=y 136CONFIG_ACPI_POWER=y
144CONFIG_ACPI_PCI=y
145CONFIG_ACPI_SYSTEM=y 137CONFIG_ACPI_SYSTEM=y
146# CONFIG_ACPI_CONTAINER is not set 138# CONFIG_ACPI_CONTAINER is not set
147 139
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 88e8867fa8e8..80b0e9eb7fb3 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -109,7 +109,6 @@ CONFIG_COMPAT=y
109CONFIG_IA64_MCA_RECOVERY=y 109CONFIG_IA64_MCA_RECOVERY=y
110CONFIG_PERFMON=y 110CONFIG_PERFMON=y
111CONFIG_IA64_PALINFO=y 111CONFIG_IA64_PALINFO=y
112CONFIG_ACPI_DEALLOCATE_IRQ=y
113 112
114# 113#
115# Firmware Drivers 114# Firmware Drivers
@@ -128,19 +127,12 @@ CONFIG_ACPI=y
128# 127#
129# ACPI (Advanced Configuration and Power Interface) Support 128# ACPI (Advanced Configuration and Power Interface) Support
130# 129#
131CONFIG_ACPI_BOOT=y
132CONFIG_ACPI_INTERPRETER=y
133CONFIG_ACPI_BUTTON=y 130CONFIG_ACPI_BUTTON=y
134CONFIG_ACPI_VIDEO=m
135CONFIG_ACPI_HOTKEY=m
136CONFIG_ACPI_FAN=y 131CONFIG_ACPI_FAN=y
137CONFIG_ACPI_PROCESSOR=y 132CONFIG_ACPI_PROCESSOR=y
138CONFIG_ACPI_THERMAL=y 133CONFIG_ACPI_THERMAL=y
139CONFIG_ACPI_BLACKLIST_YEAR=0
140# CONFIG_ACPI_DEBUG is not set 134# CONFIG_ACPI_DEBUG is not set
141CONFIG_ACPI_BUS=y
142CONFIG_ACPI_POWER=y 135CONFIG_ACPI_POWER=y
143CONFIG_ACPI_PCI=y
144CONFIG_ACPI_SYSTEM=y 136CONFIG_ACPI_SYSTEM=y
145# CONFIG_ACPI_CONTAINER is not set 137# CONFIG_ACPI_CONTAINER is not set
146 138
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 8444add76380..5da208115ea1 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -99,7 +99,6 @@ CONFIG_COMPAT=y
99CONFIG_IA64_MCA_RECOVERY=y 99CONFIG_IA64_MCA_RECOVERY=y
100CONFIG_PERFMON=y 100CONFIG_PERFMON=y
101CONFIG_IA64_PALINFO=y 101CONFIG_IA64_PALINFO=y
102CONFIG_ACPI_DEALLOCATE_IRQ=y
103 102
104# 103#
105# Firmware Drivers 104# Firmware Drivers
@@ -118,20 +117,14 @@ CONFIG_ACPI=y
118# 117#
119# ACPI (Advanced Configuration and Power Interface) Support 118# ACPI (Advanced Configuration and Power Interface) Support
120# 119#
121CONFIG_ACPI_BOOT=y
122CONFIG_ACPI_INTERPRETER=y
123CONFIG_ACPI_BUTTON=m 120CONFIG_ACPI_BUTTON=m
124CONFIG_ACPI_VIDEO=m
125CONFIG_ACPI_FAN=m 121CONFIG_ACPI_FAN=m
126CONFIG_ACPI_PROCESSOR=m 122CONFIG_ACPI_PROCESSOR=m
127CONFIG_ACPI_HOTPLUG_CPU=y 123CONFIG_ACPI_HOTPLUG_CPU=y
128CONFIG_ACPI_THERMAL=m 124CONFIG_ACPI_THERMAL=m
129CONFIG_ACPI_NUMA=y 125CONFIG_ACPI_NUMA=y
130CONFIG_ACPI_BLACKLIST_YEAR=0
131# CONFIG_ACPI_DEBUG is not set 126# CONFIG_ACPI_DEBUG is not set
132CONFIG_ACPI_BUS=y
133CONFIG_ACPI_POWER=y 127CONFIG_ACPI_POWER=y
134CONFIG_ACPI_PCI=y
135CONFIG_ACPI_SYSTEM=y 128CONFIG_ACPI_SYSTEM=y
136CONFIG_ACPI_CONTAINER=m 129CONFIG_ACPI_CONTAINER=m
137 130
@@ -341,7 +334,7 @@ CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
341CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 334CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
342# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 335# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
343# CONFIG_SCSI_IPR is not set 336# CONFIG_SCSI_IPR is not set
344CONFIG_SCSI_QLOGIC_FC=y 337# CONFIG_SCSI_QLOGIC_FC is not set
345# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set 338# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set
346CONFIG_SCSI_QLOGIC_1280=y 339CONFIG_SCSI_QLOGIC_1280=y
347# CONFIG_SCSI_QLOGIC_1280_1040 is not set 340# CONFIG_SCSI_QLOGIC_1280_1040 is not set
diff --git a/arch/ia64/hp/sim/boot/boot_head.S b/arch/ia64/hp/sim/boot/boot_head.S
index 1c8c7e6a9a5e..a9bd71ac78e2 100644
--- a/arch/ia64/hp/sim/boot/boot_head.S
+++ b/arch/ia64/hp/sim/boot/boot_head.S
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <asm/asmmacro.h> 6#include <asm/asmmacro.h>
7#include <asm/pal.h>
7 8
8 .bss 9 .bss
9 .align 16 10 .align 16
@@ -49,7 +50,11 @@ GLOBAL_ENTRY(jmp_to_kernel)
49 br.sptk.few b7 50 br.sptk.few b7
50END(jmp_to_kernel) 51END(jmp_to_kernel)
51 52
52 53/*
54 * r28 contains the index of the PAL function
55 * r29--31 the args
56 * Return values in ret0--3 (r8--11)
57 */
53GLOBAL_ENTRY(pal_emulator_static) 58GLOBAL_ENTRY(pal_emulator_static)
54 mov r8=-1 59 mov r8=-1
55 mov r9=256 60 mov r9=256
@@ -62,7 +67,7 @@ GLOBAL_ENTRY(pal_emulator_static)
62 cmp.gtu p6,p7=r9,r28 67 cmp.gtu p6,p7=r9,r28
63(p6) br.cond.sptk.few stacked 68(p6) br.cond.sptk.few stacked
64 ;; 69 ;;
65static: cmp.eq p6,p7=6,r28 /* PAL_PTCE_INFO */ 70static: cmp.eq p6,p7=PAL_PTCE_INFO,r28
66(p7) br.cond.sptk.few 1f 71(p7) br.cond.sptk.few 1f
67 ;; 72 ;;
68 mov r8=0 /* status = 0 */ 73 mov r8=0 /* status = 0 */
@@ -70,21 +75,21 @@ static: cmp.eq p6,p7=6,r28 /* PAL_PTCE_INFO */
70 movl r10=0x0000000200000003 /* count[0], count[1] */ 75 movl r10=0x0000000200000003 /* count[0], count[1] */
71 movl r11=0x1000000000002000 /* stride[0], stride[1] */ 76 movl r11=0x1000000000002000 /* stride[0], stride[1] */
72 br.cond.sptk.few rp 77 br.cond.sptk.few rp
731: cmp.eq p6,p7=14,r28 /* PAL_FREQ_RATIOS */ 781: cmp.eq p6,p7=PAL_FREQ_RATIOS,r28
74(p7) br.cond.sptk.few 1f 79(p7) br.cond.sptk.few 1f
75 mov r8=0 /* status = 0 */ 80 mov r8=0 /* status = 0 */
76 movl r9 =0x100000064 /* proc_ratio (1/100) */ 81 movl r9 =0x100000064 /* proc_ratio (1/100) */
77 movl r10=0x100000100 /* bus_ratio<<32 (1/256) */ 82 movl r10=0x100000100 /* bus_ratio<<32 (1/256) */
78 movl r11=0x100000064 /* itc_ratio<<32 (1/100) */ 83 movl r11=0x100000064 /* itc_ratio<<32 (1/100) */
79 ;; 84 ;;
801: cmp.eq p6,p7=19,r28 /* PAL_RSE_INFO */ 851: cmp.eq p6,p7=PAL_RSE_INFO,r28
81(p7) br.cond.sptk.few 1f 86(p7) br.cond.sptk.few 1f
82 mov r8=0 /* status = 0 */ 87 mov r8=0 /* status = 0 */
83 mov r9=96 /* num phys stacked */ 88 mov r9=96 /* num phys stacked */
84 mov r10=0 /* hints */ 89 mov r10=0 /* hints */
85 mov r11=0 90 mov r11=0
86 br.cond.sptk.few rp 91 br.cond.sptk.few rp
871: cmp.eq p6,p7=1,r28 /* PAL_CACHE_FLUSH */ 921: cmp.eq p6,p7=PAL_CACHE_FLUSH,r28 /* PAL_CACHE_FLUSH */
88(p7) br.cond.sptk.few 1f 93(p7) br.cond.sptk.few 1f
89 mov r9=ar.lc 94 mov r9=ar.lc
90 movl r8=524288 /* flush 512k million cache lines (16MB) */ 95 movl r8=524288 /* flush 512k million cache lines (16MB) */
@@ -102,7 +107,7 @@ static: cmp.eq p6,p7=6,r28 /* PAL_PTCE_INFO */
102 mov ar.lc=r9 107 mov ar.lc=r9
103 mov r8=r0 108 mov r8=r0
104 ;; 109 ;;
1051: cmp.eq p6,p7=15,r28 /* PAL_PERF_MON_INFO */ 1101: cmp.eq p6,p7=PAL_PERF_MON_INFO,r28
106(p7) br.cond.sptk.few 1f 111(p7) br.cond.sptk.few 1f
107 mov r8=0 /* status = 0 */ 112 mov r8=0 /* status = 0 */
108 movl r9 =0x08122f04 /* generic=4 width=47 retired=8 cycles=18 */ 113 movl r9 =0x08122f04 /* generic=4 width=47 retired=8 cycles=18 */
@@ -138,6 +143,20 @@ static: cmp.eq p6,p7=6,r28 /* PAL_PTCE_INFO */
138 st8 [r29]=r0,16 /* clear remaining bits */ 143 st8 [r29]=r0,16 /* clear remaining bits */
139 st8 [r18]=r0,16 /* clear remaining bits */ 144 st8 [r18]=r0,16 /* clear remaining bits */
140 ;; 145 ;;
1461: cmp.eq p6,p7=PAL_VM_SUMMARY,r28
147(p7) br.cond.sptk.few 1f
148 mov r8=0 /* status = 0 */
149 movl r9=0x2044040020F1865 /* num_tc_levels=2, num_unique_tcs=4 */
150 /* max_itr_entry=64, max_dtr_entry=64 */
151 /* hash_tag_id=2, max_pkr=15 */
152 /* key_size=24, phys_add_size=50, vw=1 */
153 movl r10=0x183C /* rid_size=24, impl_va_msb=60 */
154 ;;
1551: cmp.eq p6,p7=PAL_MEM_ATTRIB,r28
156(p7) br.cond.sptk.few 1f
157 mov r8=0 /* status = 0 */
158 mov r9=0x80|0x01 /* NatPage|WB */
159 ;;
1411: br.cond.sptk.few rp 1601: br.cond.sptk.few rp
142stacked: 161stacked:
143 br.ret.sptk.few rp 162 br.ret.sptk.few rp
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index 0708edb06cc4..494fad6bf376 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -1,6 +1,6 @@
1#include <asm/asmmacro.h> 1#include <asm/asmmacro.h>
2#include <asm/ia32.h> 2#include <asm/ia32.h>
3#include <asm/offsets.h> 3#include <asm/asm-offsets.h>
4#include <asm/signal.h> 4#include <asm/signal.h>
5#include <asm/thread_info.h> 5#include <asm/thread_info.h>
6 6
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index e29a8a55486a..3fa67ecebc83 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -2327,7 +2327,7 @@ sys32_sendfile (int out_fd, int in_fd, int __user *offset, unsigned int count)
2327 ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count); 2327 ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count);
2328 set_fs(old_fs); 2328 set_fs(old_fs);
2329 2329
2330 if (!ret && offset && put_user(of, offset)) 2330 if (offset && put_user(of, offset))
2331 return -EFAULT; 2331 return -EFAULT;
2332 2332
2333 return ret; 2333 return ret;
diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c
index 2623df5e2633..13a5b3b49bf8 100644
--- a/arch/ia64/kernel/acpi-ext.c
+++ b/arch/ia64/kernel/acpi-ext.c
@@ -17,20 +17,20 @@
17#include <asm/acpi-ext.h> 17#include <asm/acpi-ext.h>
18 18
19struct acpi_vendor_descriptor { 19struct acpi_vendor_descriptor {
20 u8 guid_id; 20 u8 guid_id;
21 efi_guid_t guid; 21 efi_guid_t guid;
22}; 22};
23 23
24struct acpi_vendor_info { 24struct acpi_vendor_info {
25 struct acpi_vendor_descriptor *descriptor; 25 struct acpi_vendor_descriptor *descriptor;
26 u8 *data; 26 u8 *data;
27 u32 length; 27 u32 length;
28}; 28};
29 29
30acpi_status 30acpi_status
31acpi_vendor_resource_match(struct acpi_resource *resource, void *context) 31acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
32{ 32{
33 struct acpi_vendor_info *info = (struct acpi_vendor_info *) context; 33 struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
34 struct acpi_resource_vendor *vendor; 34 struct acpi_resource_vendor *vendor;
35 struct acpi_vendor_descriptor *descriptor; 35 struct acpi_vendor_descriptor *descriptor;
36 u32 length; 36 u32 length;
@@ -38,8 +38,8 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
38 if (resource->id != ACPI_RSTYPE_VENDOR) 38 if (resource->id != ACPI_RSTYPE_VENDOR)
39 return AE_OK; 39 return AE_OK;
40 40
41 vendor = (struct acpi_resource_vendor *) &resource->data; 41 vendor = (struct acpi_resource_vendor *)&resource->data;
42 descriptor = (struct acpi_vendor_descriptor *) vendor->reserved; 42 descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
43 if (vendor->length <= sizeof(*info->descriptor) || 43 if (vendor->length <= sizeof(*info->descriptor) ||
44 descriptor->guid_id != info->descriptor->guid_id || 44 descriptor->guid_id != info->descriptor->guid_id ||
45 efi_guidcmp(descriptor->guid, info->descriptor->guid)) 45 efi_guidcmp(descriptor->guid, info->descriptor->guid))
@@ -50,21 +50,24 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
50 if (!info->data) 50 if (!info->data)
51 return AE_NO_MEMORY; 51 return AE_NO_MEMORY;
52 52
53 memcpy(info->data, vendor->reserved + sizeof(struct acpi_vendor_descriptor), length); 53 memcpy(info->data,
54 vendor->reserved + sizeof(struct acpi_vendor_descriptor),
55 length);
54 info->length = length; 56 info->length = length;
55 return AE_CTRL_TERMINATE; 57 return AE_CTRL_TERMINATE;
56} 58}
57 59
58acpi_status 60acpi_status
59acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id, 61acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
60 u8 **data, u32 *length) 62 u8 ** data, u32 * length)
61{ 63{
62 struct acpi_vendor_info info; 64 struct acpi_vendor_info info;
63 65
64 info.descriptor = id; 66 info.descriptor = id;
65 info.data = NULL; 67 info.data = NULL;
66 68
67 acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info); 69 acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match,
70 &info);
68 if (!info.data) 71 if (!info.data)
69 return AE_NOT_FOUND; 72 return AE_NOT_FOUND;
70 73
@@ -75,17 +78,19 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
75 78
76struct acpi_vendor_descriptor hp_ccsr_descriptor = { 79struct acpi_vendor_descriptor hp_ccsr_descriptor = {
77 .guid_id = 2, 80 .guid_id = 2,
78 .guid = EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad) 81 .guid =
82 EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01,
83 0x37, 0x0e, 0xad)
79}; 84};
80 85
81acpi_status 86acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length)
82hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
83{ 87{
84 acpi_status status; 88 acpi_status status;
85 u8 *data; 89 u8 *data;
86 u32 length; 90 u32 length;
87 91
88 status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length); 92 status =
93 acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
89 94
90 if (ACPI_FAILURE(status) || length != 16) 95 if (ACPI_FAILURE(status) || length != 16)
91 return AE_NOT_FOUND; 96 return AE_NOT_FOUND;
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 9609f243e5d0..28a4529fdd60 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -74,12 +74,11 @@ unsigned int acpi_cpei_override;
74unsigned int acpi_cpei_phys_cpuid; 74unsigned int acpi_cpei_phys_cpuid;
75 75
76#define MAX_SAPICS 256 76#define MAX_SAPICS 256
77u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = 77u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = {[0 ... MAX_SAPICS - 1] = -1 };
78 { [0 ... MAX_SAPICS - 1] = -1 }; 78
79EXPORT_SYMBOL(ia64_acpiid_to_sapicid); 79EXPORT_SYMBOL(ia64_acpiid_to_sapicid);
80 80
81const char * 81const char *acpi_get_sysname(void)
82acpi_get_sysname (void)
83{ 82{
84#ifdef CONFIG_IA64_GENERIC 83#ifdef CONFIG_IA64_GENERIC
85 unsigned long rsdp_phys; 84 unsigned long rsdp_phys;
@@ -89,27 +88,29 @@ acpi_get_sysname (void)
89 88
90 rsdp_phys = acpi_find_rsdp(); 89 rsdp_phys = acpi_find_rsdp();
91 if (!rsdp_phys) { 90 if (!rsdp_phys) {
92 printk(KERN_ERR "ACPI 2.0 RSDP not found, default to \"dig\"\n"); 91 printk(KERN_ERR
92 "ACPI 2.0 RSDP not found, default to \"dig\"\n");
93 return "dig"; 93 return "dig";
94 } 94 }
95 95
96 rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys); 96 rsdp = (struct acpi20_table_rsdp *)__va(rsdp_phys);
97 if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) { 97 if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
98 printk(KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n"); 98 printk(KERN_ERR
99 "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
99 return "dig"; 100 return "dig";
100 } 101 }
101 102
102 xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address); 103 xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address);
103 hdr = &xsdt->header; 104 hdr = &xsdt->header;
104 if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) { 105 if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
105 printk(KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n"); 106 printk(KERN_ERR
107 "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
106 return "dig"; 108 return "dig";
107 } 109 }
108 110
109 if (!strcmp(hdr->oem_id, "HP")) { 111 if (!strcmp(hdr->oem_id, "HP")) {
110 return "hpzx1"; 112 return "hpzx1";
111 } 113 } else if (!strcmp(hdr->oem_id, "SGI")) {
112 else if (!strcmp(hdr->oem_id, "SGI")) {
113 return "sn2"; 114 return "sn2";
114 } 115 }
115 116
@@ -131,7 +132,7 @@ acpi_get_sysname (void)
131#endif 132#endif
132} 133}
133 134
134#ifdef CONFIG_ACPI_BOOT 135#ifdef CONFIG_ACPI
135 136
136#define ACPI_MAX_PLATFORM_INTERRUPTS 256 137#define ACPI_MAX_PLATFORM_INTERRUPTS 256
137 138
@@ -146,8 +147,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
146 * Interrupt routing API for device drivers. Provides interrupt vector for 147 * Interrupt routing API for device drivers. Provides interrupt vector for
147 * a generic platform event. Currently only CPEI is implemented. 148 * a generic platform event. Currently only CPEI is implemented.
148 */ 149 */
149int 150int acpi_request_vector(u32 int_type)
150acpi_request_vector (u32 int_type)
151{ 151{
152 int vector = -1; 152 int vector = -1;
153 153
@@ -155,12 +155,12 @@ acpi_request_vector (u32 int_type)
155 /* corrected platform error interrupt */ 155 /* corrected platform error interrupt */
156 vector = platform_intr_list[int_type]; 156 vector = platform_intr_list[int_type];
157 } else 157 } else
158 printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n"); 158 printk(KERN_ERR
159 "acpi_request_vector(): invalid interrupt type\n");
159 return vector; 160 return vector;
160} 161}
161 162
162char * 163char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
163__acpi_map_table (unsigned long phys_addr, unsigned long size)
164{ 164{
165 return __va(phys_addr); 165 return __va(phys_addr);
166} 166}
@@ -169,19 +169,18 @@ __acpi_map_table (unsigned long phys_addr, unsigned long size)
169 Boot-time Table Parsing 169 Boot-time Table Parsing
170 -------------------------------------------------------------------------- */ 170 -------------------------------------------------------------------------- */
171 171
172static int total_cpus __initdata; 172static int total_cpus __initdata;
173static int available_cpus __initdata; 173static int available_cpus __initdata;
174struct acpi_table_madt * acpi_madt __initdata; 174struct acpi_table_madt *acpi_madt __initdata;
175static u8 has_8259; 175static u8 has_8259;
176
177 176
178static int __init 177static int __init
179acpi_parse_lapic_addr_ovr ( 178acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
180 acpi_table_entry_header *header, const unsigned long end) 179 const unsigned long end)
181{ 180{
182 struct acpi_table_lapic_addr_ovr *lapic; 181 struct acpi_table_lapic_addr_ovr *lapic;
183 182
184 lapic = (struct acpi_table_lapic_addr_ovr *) header; 183 lapic = (struct acpi_table_lapic_addr_ovr *)header;
185 184
186 if (BAD_MADT_ENTRY(lapic, end)) 185 if (BAD_MADT_ENTRY(lapic, end))
187 return -EINVAL; 186 return -EINVAL;
@@ -193,22 +192,23 @@ acpi_parse_lapic_addr_ovr (
193 return 0; 192 return 0;
194} 193}
195 194
196
197static int __init 195static int __init
198acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end) 196acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
199{ 197{
200 struct acpi_table_lsapic *lsapic; 198 struct acpi_table_lsapic *lsapic;
201 199
202 lsapic = (struct acpi_table_lsapic *) header; 200 lsapic = (struct acpi_table_lsapic *)header;
203 201
204 if (BAD_MADT_ENTRY(lsapic, end)) 202 if (BAD_MADT_ENTRY(lsapic, end))
205 return -EINVAL; 203 return -EINVAL;
206 204
207 if (lsapic->flags.enabled) { 205 if (lsapic->flags.enabled) {
208#ifdef CONFIG_SMP 206#ifdef CONFIG_SMP
209 smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid; 207 smp_boot_data.cpu_phys_id[available_cpus] =
208 (lsapic->id << 8) | lsapic->eid;
210#endif 209#endif
211 ia64_acpiid_to_sapicid[lsapic->acpi_id] = (lsapic->id << 8) | lsapic->eid; 210 ia64_acpiid_to_sapicid[lsapic->acpi_id] =
211 (lsapic->id << 8) | lsapic->eid;
212 ++available_cpus; 212 ++available_cpus;
213 } 213 }
214 214
@@ -216,13 +216,12 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
216 return 0; 216 return 0;
217} 217}
218 218
219
220static int __init 219static int __init
221acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end) 220acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
222{ 221{
223 struct acpi_table_lapic_nmi *lacpi_nmi; 222 struct acpi_table_lapic_nmi *lacpi_nmi;
224 223
225 lacpi_nmi = (struct acpi_table_lapic_nmi*) header; 224 lacpi_nmi = (struct acpi_table_lapic_nmi *)header;
226 225
227 if (BAD_MADT_ENTRY(lacpi_nmi, end)) 226 if (BAD_MADT_ENTRY(lacpi_nmi, end))
228 return -EINVAL; 227 return -EINVAL;
@@ -231,13 +230,12 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
231 return 0; 230 return 0;
232} 231}
233 232
234
235static int __init 233static int __init
236acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end) 234acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
237{ 235{
238 struct acpi_table_iosapic *iosapic; 236 struct acpi_table_iosapic *iosapic;
239 237
240 iosapic = (struct acpi_table_iosapic *) header; 238 iosapic = (struct acpi_table_iosapic *)header;
241 239
242 if (BAD_MADT_ENTRY(iosapic, end)) 240 if (BAD_MADT_ENTRY(iosapic, end))
243 return -EINVAL; 241 return -EINVAL;
@@ -245,15 +243,14 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
245 return iosapic_init(iosapic->address, iosapic->global_irq_base); 243 return iosapic_init(iosapic->address, iosapic->global_irq_base);
246} 244}
247 245
248
249static int __init 246static int __init
250acpi_parse_plat_int_src ( 247acpi_parse_plat_int_src(acpi_table_entry_header * header,
251 acpi_table_entry_header *header, const unsigned long end) 248 const unsigned long end)
252{ 249{
253 struct acpi_table_plat_int_src *plintsrc; 250 struct acpi_table_plat_int_src *plintsrc;
254 int vector; 251 int vector;
255 252
256 plintsrc = (struct acpi_table_plat_int_src *) header; 253 plintsrc = (struct acpi_table_plat_int_src *)header;
257 254
258 if (BAD_MADT_ENTRY(plintsrc, end)) 255 if (BAD_MADT_ENTRY(plintsrc, end))
259 return -EINVAL; 256 return -EINVAL;
@@ -267,8 +264,12 @@ acpi_parse_plat_int_src (
267 plintsrc->iosapic_vector, 264 plintsrc->iosapic_vector,
268 plintsrc->eid, 265 plintsrc->eid,
269 plintsrc->id, 266 plintsrc->id,
270 (plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, 267 (plintsrc->flags.polarity ==
271 (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); 268 1) ? IOSAPIC_POL_HIGH :
269 IOSAPIC_POL_LOW,
270 (plintsrc->flags.trigger ==
271 1) ? IOSAPIC_EDGE :
272 IOSAPIC_LEVEL);
272 273
273 platform_intr_list[plintsrc->type] = vector; 274 platform_intr_list[plintsrc->type] = vector;
274 if (acpi_madt_rev > 1) { 275 if (acpi_madt_rev > 1) {
@@ -283,7 +284,6 @@ acpi_parse_plat_int_src (
283 return 0; 284 return 0;
284} 285}
285 286
286
287unsigned int can_cpei_retarget(void) 287unsigned int can_cpei_retarget(void)
288{ 288{
289 extern int cpe_vector; 289 extern int cpe_vector;
@@ -322,29 +322,30 @@ unsigned int get_cpei_target_cpu(void)
322} 322}
323 323
324static int __init 324static int __init
325acpi_parse_int_src_ovr ( 325acpi_parse_int_src_ovr(acpi_table_entry_header * header,
326 acpi_table_entry_header *header, const unsigned long end) 326 const unsigned long end)
327{ 327{
328 struct acpi_table_int_src_ovr *p; 328 struct acpi_table_int_src_ovr *p;
329 329
330 p = (struct acpi_table_int_src_ovr *) header; 330 p = (struct acpi_table_int_src_ovr *)header;
331 331
332 if (BAD_MADT_ENTRY(p, end)) 332 if (BAD_MADT_ENTRY(p, end))
333 return -EINVAL; 333 return -EINVAL;
334 334
335 iosapic_override_isa_irq(p->bus_irq, p->global_irq, 335 iosapic_override_isa_irq(p->bus_irq, p->global_irq,
336 (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, 336 (p->flags.polarity ==
337 (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); 337 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
338 (p->flags.trigger ==
339 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
338 return 0; 340 return 0;
339} 341}
340 342
341
342static int __init 343static int __init
343acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end) 344acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
344{ 345{
345 struct acpi_table_nmi_src *nmi_src; 346 struct acpi_table_nmi_src *nmi_src;
346 347
347 nmi_src = (struct acpi_table_nmi_src*) header; 348 nmi_src = (struct acpi_table_nmi_src *)header;
348 349
349 if (BAD_MADT_ENTRY(nmi_src, end)) 350 if (BAD_MADT_ENTRY(nmi_src, end))
350 return -EINVAL; 351 return -EINVAL;
@@ -353,11 +354,9 @@ acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
353 return 0; 354 return 0;
354} 355}
355 356
356static void __init 357static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
357acpi_madt_oem_check (char *oem_id, char *oem_table_id)
358{ 358{
359 if (!strncmp(oem_id, "IBM", 3) && 359 if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) {
360 (!strncmp(oem_table_id, "SERMOW", 6))) {
361 360
362 /* 361 /*
363 * Unfortunately ITC_DRIFT is not yet part of the 362 * Unfortunately ITC_DRIFT is not yet part of the
@@ -370,19 +369,18 @@ acpi_madt_oem_check (char *oem_id, char *oem_table_id)
370 } 369 }
371} 370}
372 371
373static int __init 372static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
374acpi_parse_madt (unsigned long phys_addr, unsigned long size)
375{ 373{
376 if (!phys_addr || !size) 374 if (!phys_addr || !size)
377 return -EINVAL; 375 return -EINVAL;
378 376
379 acpi_madt = (struct acpi_table_madt *) __va(phys_addr); 377 acpi_madt = (struct acpi_table_madt *)__va(phys_addr);
380 378
381 acpi_madt_rev = acpi_madt->header.revision; 379 acpi_madt_rev = acpi_madt->header.revision;
382 380
383 /* remember the value for reference after free_initmem() */ 381 /* remember the value for reference after free_initmem() */
384#ifdef CONFIG_ITANIUM 382#ifdef CONFIG_ITANIUM
385 has_8259 = 1; /* Firmware on old Itanium systems is broken */ 383 has_8259 = 1; /* Firmware on old Itanium systems is broken */
386#else 384#else
387 has_8259 = acpi_madt->flags.pcat_compat; 385 has_8259 = acpi_madt->flags.pcat_compat;
388#endif 386#endif
@@ -396,19 +394,18 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
396 printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr); 394 printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
397 395
398 acpi_madt_oem_check(acpi_madt->header.oem_id, 396 acpi_madt_oem_check(acpi_madt->header.oem_id,
399 acpi_madt->header.oem_table_id); 397 acpi_madt->header.oem_table_id);
400 398
401 return 0; 399 return 0;
402} 400}
403 401
404
405#ifdef CONFIG_ACPI_NUMA 402#ifdef CONFIG_ACPI_NUMA
406 403
407#undef SLIT_DEBUG 404#undef SLIT_DEBUG
408 405
409#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32) 406#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
410 407
411static int __initdata srat_num_cpus; /* number of cpus */ 408static int __initdata srat_num_cpus; /* number of cpus */
412static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; 409static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
413#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) 410#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
414#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) 411#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
@@ -421,15 +418,15 @@ static struct acpi_table_slit __initdata *slit_table;
421 * ACPI 2.0 SLIT (System Locality Information Table) 418 * ACPI 2.0 SLIT (System Locality Information Table)
422 * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf 419 * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
423 */ 420 */
424void __init 421void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
425acpi_numa_slit_init (struct acpi_table_slit *slit)
426{ 422{
427 u32 len; 423 u32 len;
428 424
429 len = sizeof(struct acpi_table_header) + 8 425 len = sizeof(struct acpi_table_header) + 8
430 + slit->localities * slit->localities; 426 + slit->localities * slit->localities;
431 if (slit->header.length != len) { 427 if (slit->header.length != len) {
432 printk(KERN_ERR "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n", 428 printk(KERN_ERR
429 "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
433 len, slit->header.length); 430 len, slit->header.length);
434 memset(numa_slit, 10, sizeof(numa_slit)); 431 memset(numa_slit, 10, sizeof(numa_slit));
435 return; 432 return;
@@ -438,19 +435,20 @@ acpi_numa_slit_init (struct acpi_table_slit *slit)
438} 435}
439 436
440void __init 437void __init
441acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa) 438acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
442{ 439{
443 /* record this node in proximity bitmap */ 440 /* record this node in proximity bitmap */
444 pxm_bit_set(pa->proximity_domain); 441 pxm_bit_set(pa->proximity_domain);
445 442
446 node_cpuid[srat_num_cpus].phys_id = (pa->apic_id << 8) | (pa->lsapic_eid); 443 node_cpuid[srat_num_cpus].phys_id =
444 (pa->apic_id << 8) | (pa->lsapic_eid);
447 /* nid should be overridden as logical node id later */ 445 /* nid should be overridden as logical node id later */
448 node_cpuid[srat_num_cpus].nid = pa->proximity_domain; 446 node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
449 srat_num_cpus++; 447 srat_num_cpus++;
450} 448}
451 449
452void __init 450void __init
453acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma) 451acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
454{ 452{
455 unsigned long paddr, size; 453 unsigned long paddr, size;
456 u8 pxm; 454 u8 pxm;
@@ -487,8 +485,7 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
487 num_node_memblks++; 485 num_node_memblks++;
488} 486}
489 487
490void __init 488void __init acpi_numa_arch_fixup(void)
491acpi_numa_arch_fixup (void)
492{ 489{
493 int i, j, node_from, node_to; 490 int i, j, node_from, node_to;
494 491
@@ -534,21 +531,24 @@ acpi_numa_arch_fixup (void)
534 for (i = 0; i < srat_num_cpus; i++) 531 for (i = 0; i < srat_num_cpus; i++)
535 node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid]; 532 node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
536 533
537 printk(KERN_INFO "Number of logical nodes in system = %d\n", num_online_nodes()); 534 printk(KERN_INFO "Number of logical nodes in system = %d\n",
538 printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks); 535 num_online_nodes());
536 printk(KERN_INFO "Number of memory chunks in system = %d\n",
537 num_node_memblks);
539 538
540 if (!slit_table) return; 539 if (!slit_table)
540 return;
541 memset(numa_slit, -1, sizeof(numa_slit)); 541 memset(numa_slit, -1, sizeof(numa_slit));
542 for (i=0; i<slit_table->localities; i++) { 542 for (i = 0; i < slit_table->localities; i++) {
543 if (!pxm_bit_test(i)) 543 if (!pxm_bit_test(i))
544 continue; 544 continue;
545 node_from = pxm_to_nid_map[i]; 545 node_from = pxm_to_nid_map[i];
546 for (j=0; j<slit_table->localities; j++) { 546 for (j = 0; j < slit_table->localities; j++) {
547 if (!pxm_bit_test(j)) 547 if (!pxm_bit_test(j))
548 continue; 548 continue;
549 node_to = pxm_to_nid_map[j]; 549 node_to = pxm_to_nid_map[j];
550 node_distance(node_from, node_to) = 550 node_distance(node_from, node_to) =
551 slit_table->entry[i*slit_table->localities + j]; 551 slit_table->entry[i * slit_table->localities + j];
552 } 552 }
553 } 553 }
554 554
@@ -556,36 +556,41 @@ acpi_numa_arch_fixup (void)
556 printk("ACPI 2.0 SLIT locality table:\n"); 556 printk("ACPI 2.0 SLIT locality table:\n");
557 for_each_online_node(i) { 557 for_each_online_node(i) {
558 for_each_online_node(j) 558 for_each_online_node(j)
559 printk("%03d ", node_distance(i,j)); 559 printk("%03d ", node_distance(i, j));
560 printk("\n"); 560 printk("\n");
561 } 561 }
562#endif 562#endif
563} 563}
564#endif /* CONFIG_ACPI_NUMA */ 564#endif /* CONFIG_ACPI_NUMA */
565 565
566unsigned int 566/*
567acpi_register_gsi (u32 gsi, int edge_level, int active_high_low) 567 * success: return IRQ number (>=0)
568 * failure: return < 0
569 */
570int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
568{ 571{
569 if (has_8259 && gsi < 16) 572 if (has_8259 && gsi < 16)
570 return isa_irq_to_vector(gsi); 573 return isa_irq_to_vector(gsi);
571 574
572 return iosapic_register_intr(gsi, 575 return iosapic_register_intr(gsi,
573 (active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, 576 (active_high_low ==
574 (edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); 577 ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
578 IOSAPIC_POL_LOW,
579 (edge_level ==
580 ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
581 IOSAPIC_LEVEL);
575} 582}
583
576EXPORT_SYMBOL(acpi_register_gsi); 584EXPORT_SYMBOL(acpi_register_gsi);
577 585
578#ifdef CONFIG_ACPI_DEALLOCATE_IRQ 586void acpi_unregister_gsi(u32 gsi)
579void
580acpi_unregister_gsi (u32 gsi)
581{ 587{
582 iosapic_unregister_intr(gsi); 588 iosapic_unregister_intr(gsi);
583} 589}
590
584EXPORT_SYMBOL(acpi_unregister_gsi); 591EXPORT_SYMBOL(acpi_unregister_gsi);
585#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
586 592
587static int __init 593static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size)
588acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
589{ 594{
590 struct acpi_table_header *fadt_header; 595 struct acpi_table_header *fadt_header;
591 struct fadt_descriptor_rev2 *fadt; 596 struct fadt_descriptor_rev2 *fadt;
@@ -593,11 +598,11 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
593 if (!phys_addr || !size) 598 if (!phys_addr || !size)
594 return -EINVAL; 599 return -EINVAL;
595 600
596 fadt_header = (struct acpi_table_header *) __va(phys_addr); 601 fadt_header = (struct acpi_table_header *)__va(phys_addr);
597 if (fadt_header->revision != 3) 602 if (fadt_header->revision != 3)
598 return -ENODEV; /* Only deal with ACPI 2.0 FADT */ 603 return -ENODEV; /* Only deal with ACPI 2.0 FADT */
599 604
600 fadt = (struct fadt_descriptor_rev2 *) fadt_header; 605 fadt = (struct fadt_descriptor_rev2 *)fadt_header;
601 606
602 if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER)) 607 if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
603 acpi_kbd_controller_present = 0; 608 acpi_kbd_controller_present = 0;
@@ -609,22 +614,19 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
609 return 0; 614 return 0;
610} 615}
611 616
612 617unsigned long __init acpi_find_rsdp(void)
613unsigned long __init
614acpi_find_rsdp (void)
615{ 618{
616 unsigned long rsdp_phys = 0; 619 unsigned long rsdp_phys = 0;
617 620
618 if (efi.acpi20) 621 if (efi.acpi20)
619 rsdp_phys = __pa(efi.acpi20); 622 rsdp_phys = __pa(efi.acpi20);
620 else if (efi.acpi) 623 else if (efi.acpi)
621 printk(KERN_WARNING PREFIX "v1.0/r0.71 tables no longer supported\n"); 624 printk(KERN_WARNING PREFIX
625 "v1.0/r0.71 tables no longer supported\n");
622 return rsdp_phys; 626 return rsdp_phys;
623} 627}
624 628
625 629int __init acpi_boot_init(void)
626int __init
627acpi_boot_init (void)
628{ 630{
629 631
630 /* 632 /*
@@ -642,31 +644,43 @@ acpi_boot_init (void)
642 644
643 /* Local APIC */ 645 /* Local APIC */
644 646
645 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0) 647 if (acpi_table_parse_madt
646 printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); 648 (ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
649 printk(KERN_ERR PREFIX
650 "Error parsing LAPIC address override entry\n");
647 651
648 if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1) 652 if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS)
649 printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n"); 653 < 1)
654 printk(KERN_ERR PREFIX
655 "Error parsing MADT - no LAPIC entries\n");
650 656
651 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0) 657 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0)
658 < 0)
652 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 659 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
653 660
654 /* I/O APIC */ 661 /* I/O APIC */
655 662
656 if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) 663 if (acpi_table_parse_madt
657 printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n"); 664 (ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
665 printk(KERN_ERR PREFIX
666 "Error parsing MADT - no IOSAPIC entries\n");
658 667
659 /* System-Level Interrupt Routing */ 668 /* System-Level Interrupt Routing */
660 669
661 if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0) 670 if (acpi_table_parse_madt
662 printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n"); 671 (ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src,
672 ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
673 printk(KERN_ERR PREFIX
674 "Error parsing platform interrupt source entry\n");
663 675
664 if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0) 676 if (acpi_table_parse_madt
665 printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); 677 (ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
678 printk(KERN_ERR PREFIX
679 "Error parsing interrupt source overrides entry\n");
666 680
667 if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0) 681 if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
668 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); 682 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
669 skip_madt: 683 skip_madt:
670 684
671 /* 685 /*
672 * FADT says whether a legacy keyboard controller is present. 686 * FADT says whether a legacy keyboard controller is present.
@@ -681,8 +695,9 @@ acpi_boot_init (void)
681 if (available_cpus == 0) { 695 if (available_cpus == 0) {
682 printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n"); 696 printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
683 printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id()); 697 printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
684 smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id(); 698 smp_boot_data.cpu_phys_id[available_cpus] =
685 available_cpus = 1; /* We've got at least one of these, no? */ 699 hard_smp_processor_id();
700 available_cpus = 1; /* We've got at least one of these, no? */
686 } 701 }
687 smp_boot_data.cpu_count = available_cpus; 702 smp_boot_data.cpu_count = available_cpus;
688 703
@@ -691,8 +706,10 @@ acpi_boot_init (void)
691 if (srat_num_cpus == 0) { 706 if (srat_num_cpus == 0) {
692 int cpu, i = 1; 707 int cpu, i = 1;
693 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++) 708 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
694 if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id()) 709 if (smp_boot_data.cpu_phys_id[cpu] !=
695 node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu]; 710 hard_smp_processor_id())
711 node_cpuid[i++].phys_id =
712 smp_boot_data.cpu_phys_id[cpu];
696 } 713 }
697# endif 714# endif
698#endif 715#endif
@@ -700,12 +717,12 @@ acpi_boot_init (void)
700 build_cpu_to_node_map(); 717 build_cpu_to_node_map();
701#endif 718#endif
702 /* Make boot-up look pretty */ 719 /* Make boot-up look pretty */
703 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus); 720 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
721 total_cpus);
704 return 0; 722 return 0;
705} 723}
706 724
707int 725int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
708acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
709{ 726{
710 int vector; 727 int vector;
711 728
@@ -726,11 +743,10 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
726 */ 743 */
727#ifdef CONFIG_ACPI_HOTPLUG_CPU 744#ifdef CONFIG_ACPI_HOTPLUG_CPU
728static 745static
729int 746int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
730acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
731{ 747{
732#ifdef CONFIG_ACPI_NUMA 748#ifdef CONFIG_ACPI_NUMA
733 int pxm_id; 749 int pxm_id;
734 750
735 pxm_id = acpi_get_pxm(handle); 751 pxm_id = acpi_get_pxm(handle);
736 752
@@ -738,31 +754,28 @@ acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
738 * Assuming that the container driver would have set the proximity 754 * Assuming that the container driver would have set the proximity
739 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag 755 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
740 */ 756 */
741 node_cpuid[cpu].nid = (pxm_id < 0) ? 0: 757 node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
742 pxm_to_nid_map[pxm_id];
743 758
744 node_cpuid[cpu].phys_id = physid; 759 node_cpuid[cpu].phys_id = physid;
745#endif 760#endif
746 return(0); 761 return (0);
747} 762}
748 763
749 764int acpi_map_lsapic(acpi_handle handle, int *pcpu)
750int
751acpi_map_lsapic(acpi_handle handle, int *pcpu)
752{ 765{
753 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 766 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
754 union acpi_object *obj; 767 union acpi_object *obj;
755 struct acpi_table_lsapic *lsapic; 768 struct acpi_table_lsapic *lsapic;
756 cpumask_t tmp_map; 769 cpumask_t tmp_map;
757 long physid; 770 long physid;
758 int cpu; 771 int cpu;
759 772
760 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 773 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
761 return -EINVAL; 774 return -EINVAL;
762 775
763 if (!buffer.length || !buffer.pointer) 776 if (!buffer.length || !buffer.pointer)
764 return -EINVAL; 777 return -EINVAL;
765 778
766 obj = buffer.pointer; 779 obj = buffer.pointer;
767 if (obj->type != ACPI_TYPE_BUFFER || 780 if (obj->type != ACPI_TYPE_BUFFER ||
768 obj->buffer.length < sizeof(*lsapic)) { 781 obj->buffer.length < sizeof(*lsapic)) {
@@ -778,7 +791,7 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
778 return -EINVAL; 791 return -EINVAL;
779 } 792 }
780 793
781 physid = ((lsapic->id <<8) | (lsapic->eid)); 794 physid = ((lsapic->id << 8) | (lsapic->eid));
782 795
783 acpi_os_free(buffer.pointer); 796 acpi_os_free(buffer.pointer);
784 buffer.length = ACPI_ALLOCATE_BUFFER; 797 buffer.length = ACPI_ALLOCATE_BUFFER;
@@ -786,50 +799,49 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
786 799
787 cpus_complement(tmp_map, cpu_present_map); 800 cpus_complement(tmp_map, cpu_present_map);
788 cpu = first_cpu(tmp_map); 801 cpu = first_cpu(tmp_map);
789 if(cpu >= NR_CPUS) 802 if (cpu >= NR_CPUS)
790 return -EINVAL; 803 return -EINVAL;
791 804
792 acpi_map_cpu2node(handle, cpu, physid); 805 acpi_map_cpu2node(handle, cpu, physid);
793 806
794 cpu_set(cpu, cpu_present_map); 807 cpu_set(cpu, cpu_present_map);
795 ia64_cpu_to_sapicid[cpu] = physid; 808 ia64_cpu_to_sapicid[cpu] = physid;
796 ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu]; 809 ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu];
797 810
798 *pcpu = cpu; 811 *pcpu = cpu;
799 return(0); 812 return (0);
800} 813}
801EXPORT_SYMBOL(acpi_map_lsapic);
802 814
815EXPORT_SYMBOL(acpi_map_lsapic);
803 816
804int 817int acpi_unmap_lsapic(int cpu)
805acpi_unmap_lsapic(int cpu)
806{ 818{
807 int i; 819 int i;
808 820
809 for (i=0; i<MAX_SAPICS; i++) { 821 for (i = 0; i < MAX_SAPICS; i++) {
810 if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) { 822 if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
811 ia64_acpiid_to_sapicid[i] = -1; 823 ia64_acpiid_to_sapicid[i] = -1;
812 break; 824 break;
813 } 825 }
814 } 826 }
815 ia64_cpu_to_sapicid[cpu] = -1; 827 ia64_cpu_to_sapicid[cpu] = -1;
816 cpu_clear(cpu,cpu_present_map); 828 cpu_clear(cpu, cpu_present_map);
817 829
818#ifdef CONFIG_ACPI_NUMA 830#ifdef CONFIG_ACPI_NUMA
819 /* NUMA specific cleanup's */ 831 /* NUMA specific cleanup's */
820#endif 832#endif
821 833
822 return(0); 834 return (0);
823} 835}
836
824EXPORT_SYMBOL(acpi_unmap_lsapic); 837EXPORT_SYMBOL(acpi_unmap_lsapic);
825#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 838#endif /* CONFIG_ACPI_HOTPLUG_CPU */
826
827 839
828#ifdef CONFIG_ACPI_NUMA 840#ifdef CONFIG_ACPI_NUMA
829acpi_status __devinit 841acpi_status __devinit
830acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret) 842acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
831{ 843{
832 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 844 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
833 union acpi_object *obj; 845 union acpi_object *obj;
834 struct acpi_table_iosapic *iosapic; 846 struct acpi_table_iosapic *iosapic;
835 unsigned int gsi_base; 847 unsigned int gsi_base;
@@ -878,10 +890,9 @@ acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
878 map_iosapic_to_node(gsi_base, node); 890 map_iosapic_to_node(gsi_base, node);
879 return AE_OK; 891 return AE_OK;
880} 892}
881#endif /* CONFIG_NUMA */ 893#endif /* CONFIG_NUMA */
882 894
883int 895int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
884acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
885{ 896{
886 int err; 897 int err;
887 898
@@ -890,17 +901,18 @@ acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
890 901
891#if CONFIG_ACPI_NUMA 902#if CONFIG_ACPI_NUMA
892 acpi_map_iosapic(handle, 0, NULL, NULL); 903 acpi_map_iosapic(handle, 0, NULL, NULL);
893#endif /* CONFIG_ACPI_NUMA */ 904#endif /* CONFIG_ACPI_NUMA */
894 905
895 return 0; 906 return 0;
896} 907}
908
897EXPORT_SYMBOL(acpi_register_ioapic); 909EXPORT_SYMBOL(acpi_register_ioapic);
898 910
899int 911int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
900acpi_unregister_ioapic (acpi_handle handle, u32 gsi_base)
901{ 912{
902 return iosapic_remove(gsi_base); 913 return iosapic_remove(gsi_base);
903} 914}
915
904EXPORT_SYMBOL(acpi_unregister_ioapic); 916EXPORT_SYMBOL(acpi_unregister_ioapic);
905 917
906#endif /* CONFIG_ACPI_BOOT */ 918#endif /* CONFIG_ACPI */
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index 7d1ae2982c53..f6a234289341 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -211,17 +211,41 @@ void foo(void)
211#endif 211#endif
212 212
213 BLANK(); 213 BLANK();
214 DEFINE(IA64_MCA_CPU_PROC_STATE_DUMP_OFFSET, 214 DEFINE(IA64_MCA_CPU_MCA_STACK_OFFSET,
215 offsetof (struct ia64_mca_cpu, proc_state_dump)); 215 offsetof (struct ia64_mca_cpu, mca_stack));
216 DEFINE(IA64_MCA_CPU_STACK_OFFSET,
217 offsetof (struct ia64_mca_cpu, stack));
218 DEFINE(IA64_MCA_CPU_STACKFRAME_OFFSET,
219 offsetof (struct ia64_mca_cpu, stackframe));
220 DEFINE(IA64_MCA_CPU_RBSTORE_OFFSET,
221 offsetof (struct ia64_mca_cpu, rbstore));
222 DEFINE(IA64_MCA_CPU_INIT_STACK_OFFSET, 216 DEFINE(IA64_MCA_CPU_INIT_STACK_OFFSET,
223 offsetof (struct ia64_mca_cpu, init_stack)); 217 offsetof (struct ia64_mca_cpu, init_stack));
224 BLANK(); 218 BLANK();
219 DEFINE(IA64_SAL_OS_STATE_COMMON_OFFSET,
220 offsetof (struct ia64_sal_os_state, sal_ra));
221 DEFINE(IA64_SAL_OS_STATE_OS_GP_OFFSET,
222 offsetof (struct ia64_sal_os_state, os_gp));
223 DEFINE(IA64_SAL_OS_STATE_PAL_MIN_STATE_OFFSET,
224 offsetof (struct ia64_sal_os_state, pal_min_state));
225 DEFINE(IA64_SAL_OS_STATE_PROC_STATE_PARAM_OFFSET,
226 offsetof (struct ia64_sal_os_state, proc_state_param));
227 DEFINE(IA64_SAL_OS_STATE_SIZE,
228 sizeof (struct ia64_sal_os_state));
229 DEFINE(IA64_PMSA_GR_OFFSET,
230 offsetof (struct pal_min_state_area_s, pmsa_gr));
231 DEFINE(IA64_PMSA_BANK1_GR_OFFSET,
232 offsetof (struct pal_min_state_area_s, pmsa_bank1_gr));
233 DEFINE(IA64_PMSA_PR_OFFSET,
234 offsetof (struct pal_min_state_area_s, pmsa_pr));
235 DEFINE(IA64_PMSA_BR0_OFFSET,
236 offsetof (struct pal_min_state_area_s, pmsa_br0));
237 DEFINE(IA64_PMSA_RSC_OFFSET,
238 offsetof (struct pal_min_state_area_s, pmsa_rsc));
239 DEFINE(IA64_PMSA_IIP_OFFSET,
240 offsetof (struct pal_min_state_area_s, pmsa_iip));
241 DEFINE(IA64_PMSA_IPSR_OFFSET,
242 offsetof (struct pal_min_state_area_s, pmsa_ipsr));
243 DEFINE(IA64_PMSA_IFS_OFFSET,
244 offsetof (struct pal_min_state_area_s, pmsa_ifs));
245 DEFINE(IA64_PMSA_XIP_OFFSET,
246 offsetof (struct pal_min_state_area_s, pmsa_xip));
247 BLANK();
248
225 /* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */ 249 /* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */
226 DEFINE(IA64_TIME_INTERPOLATOR_ADDRESS_OFFSET, offsetof (struct time_interpolator, addr)); 250 DEFINE(IA64_TIME_INTERPOLATOR_ADDRESS_OFFSET, offsetof (struct time_interpolator, addr));
227 DEFINE(IA64_TIME_INTERPOLATOR_SOURCE_OFFSET, offsetof (struct time_interpolator, source)); 251 DEFINE(IA64_TIME_INTERPOLATOR_SOURCE_OFFSET, offsetof (struct time_interpolator, source));
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 9be53e1ea404..ba0b6a1f429f 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -37,7 +37,7 @@
37#include <asm/cache.h> 37#include <asm/cache.h>
38#include <asm/errno.h> 38#include <asm/errno.h>
39#include <asm/kregs.h> 39#include <asm/kregs.h>
40#include <asm/offsets.h> 40#include <asm/asm-offsets.h>
41#include <asm/pgtable.h> 41#include <asm/pgtable.h>
42#include <asm/percpu.h> 42#include <asm/percpu.h>
43#include <asm/processor.h> 43#include <asm/processor.h>
@@ -204,9 +204,6 @@ GLOBAL_ENTRY(ia64_switch_to)
204(p6) br.cond.dpnt .map 204(p6) br.cond.dpnt .map
205 ;; 205 ;;
206.done: 206.done:
207(p6) ssm psr.ic // if we had to map, reenable the psr.ic bit FIRST!!!
208 ;;
209(p6) srlz.d
210 ld8 sp=[r21] // load kernel stack pointer of new task 207 ld8 sp=[r21] // load kernel stack pointer of new task
211 mov IA64_KR(CURRENT)=in0 // update "current" application register 208 mov IA64_KR(CURRENT)=in0 // update "current" application register
212 mov r8=r13 // return pointer to previously running task 209 mov r8=r13 // return pointer to previously running task
@@ -234,6 +231,9 @@ GLOBAL_ENTRY(ia64_switch_to)
234 mov IA64_KR(CURRENT_STACK)=r26 // remember last page we mapped... 231 mov IA64_KR(CURRENT_STACK)=r26 // remember last page we mapped...
235 ;; 232 ;;
236 itr.d dtr[r25]=r23 // wire in new mapping... 233 itr.d dtr[r25]=r23 // wire in new mapping...
234 ssm psr.ic // reenable the psr.ic bit
235 ;;
236 srlz.d
237 br.cond.sptk .done 237 br.cond.sptk .done
238END(ia64_switch_to) 238END(ia64_switch_to)
239 239
@@ -470,6 +470,29 @@ ENTRY(load_switch_stack)
470 br.cond.sptk.many b7 470 br.cond.sptk.many b7
471END(load_switch_stack) 471END(load_switch_stack)
472 472
473GLOBAL_ENTRY(prefetch_stack)
474 add r14 = -IA64_SWITCH_STACK_SIZE, sp
475 add r15 = IA64_TASK_THREAD_KSP_OFFSET, in0
476 ;;
477 ld8 r16 = [r15] // load next's stack pointer
478 lfetch.fault.excl [r14], 128
479 ;;
480 lfetch.fault.excl [r14], 128
481 lfetch.fault [r16], 128
482 ;;
483 lfetch.fault.excl [r14], 128
484 lfetch.fault [r16], 128
485 ;;
486 lfetch.fault.excl [r14], 128
487 lfetch.fault [r16], 128
488 ;;
489 lfetch.fault.excl [r14], 128
490 lfetch.fault [r16], 128
491 ;;
492 lfetch.fault [r16], 128
493 br.ret.sptk.many rp
494END(prefetch_switch_stack)
495
473GLOBAL_ENTRY(execve) 496GLOBAL_ENTRY(execve)
474 mov r15=__NR_execve // put syscall number in place 497 mov r15=__NR_execve // put syscall number in place
475 break __BREAK_SYSCALL 498 break __BREAK_SYSCALL
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index 7d7684a369d3..2ddbac6f4999 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -14,7 +14,7 @@
14 14
15#include <asm/asmmacro.h> 15#include <asm/asmmacro.h>
16#include <asm/errno.h> 16#include <asm/errno.h>
17#include <asm/offsets.h> 17#include <asm/asm-offsets.h>
18#include <asm/percpu.h> 18#include <asm/percpu.h>
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/sal.h> 20#include <asm/sal.h>
diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S
index 86948ce63e43..86064ca98952 100644
--- a/arch/ia64/kernel/gate.S
+++ b/arch/ia64/kernel/gate.S
@@ -10,7 +10,7 @@
10 10
11#include <asm/asmmacro.h> 11#include <asm/asmmacro.h>
12#include <asm/errno.h> 12#include <asm/errno.h>
13#include <asm/offsets.h> 13#include <asm/asm-offsets.h>
14#include <asm/sigcontext.h> 14#include <asm/sigcontext.h>
15#include <asm/system.h> 15#include <asm/system.h>
16#include <asm/unistd.h> 16#include <asm/unistd.h>
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 8d3a9291b47f..bfe65b2e8621 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -25,7 +25,7 @@
25#include <asm/fpu.h> 25#include <asm/fpu.h>
26#include <asm/kregs.h> 26#include <asm/kregs.h>
27#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
28#include <asm/offsets.h> 28#include <asm/asm-offsets.h>
29#include <asm/pal.h> 29#include <asm/pal.h>
30#include <asm/pgtable.h> 30#include <asm/pgtable.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index 7936b62f7a2e..574084f343fa 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -561,7 +561,7 @@ static inline int vector_is_shared (int vector)
561 return (iosapic_intr_info[vector].count > 1); 561 return (iosapic_intr_info[vector].count > 1);
562} 562}
563 563
564static void 564static int
565register_intr (unsigned int gsi, int vector, unsigned char delivery, 565register_intr (unsigned int gsi, int vector, unsigned char delivery,
566 unsigned long polarity, unsigned long trigger) 566 unsigned long polarity, unsigned long trigger)
567{ 567{
@@ -576,7 +576,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
576 index = find_iosapic(gsi); 576 index = find_iosapic(gsi);
577 if (index < 0) { 577 if (index < 0) {
578 printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi); 578 printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi);
579 return; 579 return -ENODEV;
580 } 580 }
581 581
582 iosapic_address = iosapic_lists[index].addr; 582 iosapic_address = iosapic_lists[index].addr;
@@ -587,7 +587,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
587 rte = iosapic_alloc_rte(); 587 rte = iosapic_alloc_rte();
588 if (!rte) { 588 if (!rte) {
589 printk(KERN_WARNING "%s: cannot allocate memory\n", __FUNCTION__); 589 printk(KERN_WARNING "%s: cannot allocate memory\n", __FUNCTION__);
590 return; 590 return -ENOMEM;
591 } 591 }
592 592
593 rte_index = gsi - gsi_base; 593 rte_index = gsi - gsi_base;
@@ -603,7 +603,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
603 struct iosapic_intr_info *info = &iosapic_intr_info[vector]; 603 struct iosapic_intr_info *info = &iosapic_intr_info[vector];
604 if (info->trigger != trigger || info->polarity != polarity) { 604 if (info->trigger != trigger || info->polarity != polarity) {
605 printk (KERN_WARNING "%s: cannot override the interrupt\n", __FUNCTION__); 605 printk (KERN_WARNING "%s: cannot override the interrupt\n", __FUNCTION__);
606 return; 606 return -EINVAL;
607 } 607 }
608 } 608 }
609 609
@@ -623,6 +623,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
623 __FUNCTION__, vector, idesc->handler->typename, irq_type->typename); 623 __FUNCTION__, vector, idesc->handler->typename, irq_type->typename);
624 idesc->handler = irq_type; 624 idesc->handler = irq_type;
625 } 625 }
626 return 0;
626} 627}
627 628
628static unsigned int 629static unsigned int
@@ -710,7 +711,7 @@ int
710iosapic_register_intr (unsigned int gsi, 711iosapic_register_intr (unsigned int gsi,
711 unsigned long polarity, unsigned long trigger) 712 unsigned long polarity, unsigned long trigger)
712{ 713{
713 int vector, mask = 1; 714 int vector, mask = 1, err;
714 unsigned int dest; 715 unsigned int dest;
715 unsigned long flags; 716 unsigned long flags;
716 struct iosapic_rte_info *rte; 717 struct iosapic_rte_info *rte;
@@ -737,8 +738,8 @@ again:
737 vector = assign_irq_vector(AUTO_ASSIGN); 738 vector = assign_irq_vector(AUTO_ASSIGN);
738 if (vector < 0) { 739 if (vector < 0) {
739 vector = iosapic_find_sharable_vector(trigger, polarity); 740 vector = iosapic_find_sharable_vector(trigger, polarity);
740 if (vector < 0) 741 if (vector < 0)
741 panic("%s: out of interrupt vectors!\n", __FUNCTION__); 742 return -ENOSPC;
742 } 743 }
743 744
744 spin_lock_irqsave(&irq_descp(vector)->lock, flags); 745 spin_lock_irqsave(&irq_descp(vector)->lock, flags);
@@ -753,8 +754,13 @@ again:
753 } 754 }
754 755
755 dest = get_target_cpu(gsi, vector); 756 dest = get_target_cpu(gsi, vector);
756 register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, 757 err = register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
757 polarity, trigger); 758 polarity, trigger);
759 if (err < 0) {
760 spin_unlock(&iosapic_lock);
761 spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
762 return err;
763 }
758 764
759 /* 765 /*
760 * If the vector is shared and already unmasked for 766 * If the vector is shared and already unmasked for
@@ -776,7 +782,6 @@ again:
776 return vector; 782 return vector;
777} 783}
778 784
779#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
780void 785void
781iosapic_unregister_intr (unsigned int gsi) 786iosapic_unregister_intr (unsigned int gsi)
782{ 787{
@@ -859,7 +864,6 @@ iosapic_unregister_intr (unsigned int gsi)
859 spin_unlock(&iosapic_lock); 864 spin_unlock(&iosapic_lock);
860 spin_unlock_irqrestore(&idesc->lock, flags); 865 spin_unlock_irqrestore(&idesc->lock, flags);
861} 866}
862#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
863 867
864/* 868/*
865 * ACPI calls this when it finds an entry for a platform interrupt. 869 * ACPI calls this when it finds an entry for a platform interrupt.
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
index 3bb3a13c4047..c13ca0d49c4a 100644
--- a/arch/ia64/kernel/ivt.S
+++ b/arch/ia64/kernel/ivt.S
@@ -44,7 +44,7 @@
44#include <asm/break.h> 44#include <asm/break.h>
45#include <asm/ia32.h> 45#include <asm/ia32.h>
46#include <asm/kregs.h> 46#include <asm/kregs.h>
47#include <asm/offsets.h> 47#include <asm/asm-offsets.h>
48#include <asm/pgtable.h> 48#include <asm/pgtable.h>
49#include <asm/processor.h> 49#include <asm/processor.h>
50#include <asm/ptrace.h> 50#include <asm/ptrace.h>
@@ -69,7 +69,6 @@
69# define DBG_FAULT(i) 69# define DBG_FAULT(i)
70#endif 70#endif
71 71
72#define MINSTATE_VIRT /* needed by minstate.h */
73#include "minstate.h" 72#include "minstate.h"
74 73
75#define FAULT(n) \ 74#define FAULT(n) \
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 4ebbf3974381..6dc726ad7137 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -48,6 +48,9 @@
48 * Delete dead variables and functions. 48 * Delete dead variables and functions.
49 * Reorder to remove the need for forward declarations and to consolidate 49 * Reorder to remove the need for forward declarations and to consolidate
50 * related code. 50 * related code.
51 *
52 * 2005-08-12 Keith Owens <kaos@sgi.com>
53 * Convert MCA/INIT handlers to use per event stacks and SAL/OS state.
51 */ 54 */
52#include <linux/config.h> 55#include <linux/config.h>
53#include <linux/types.h> 56#include <linux/types.h>
@@ -77,6 +80,8 @@
77#include <asm/irq.h> 80#include <asm/irq.h>
78#include <asm/hw_irq.h> 81#include <asm/hw_irq.h>
79 82
83#include "entry.h"
84
80#if defined(IA64_MCA_DEBUG_INFO) 85#if defined(IA64_MCA_DEBUG_INFO)
81# define IA64_MCA_DEBUG(fmt...) printk(fmt) 86# define IA64_MCA_DEBUG(fmt...) printk(fmt)
82#else 87#else
@@ -84,9 +89,7 @@
84#endif 89#endif
85 90
86/* Used by mca_asm.S */ 91/* Used by mca_asm.S */
87ia64_mca_sal_to_os_state_t ia64_sal_to_os_handoff_state; 92u32 ia64_mca_serialize;
88ia64_mca_os_to_sal_state_t ia64_os_to_sal_handoff_state;
89u64 ia64_mca_serialize;
90DEFINE_PER_CPU(u64, ia64_mca_data); /* == __per_cpu_mca[smp_processor_id()] */ 93DEFINE_PER_CPU(u64, ia64_mca_data); /* == __per_cpu_mca[smp_processor_id()] */
91DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */ 94DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */
92DEFINE_PER_CPU(u64, ia64_mca_pal_pte); /* PTE to map PAL code */ 95DEFINE_PER_CPU(u64, ia64_mca_pal_pte); /* PTE to map PAL code */
@@ -95,8 +98,10 @@ DEFINE_PER_CPU(u64, ia64_mca_pal_base); /* vaddr PAL code granule */
95unsigned long __per_cpu_mca[NR_CPUS]; 98unsigned long __per_cpu_mca[NR_CPUS];
96 99
97/* In mca_asm.S */ 100/* In mca_asm.S */
98extern void ia64_monarch_init_handler (void); 101extern void ia64_os_init_dispatch_monarch (void);
99extern void ia64_slave_init_handler (void); 102extern void ia64_os_init_dispatch_slave (void);
103
104static int monarch_cpu = -1;
100 105
101static ia64_mc_info_t ia64_mc_info; 106static ia64_mc_info_t ia64_mc_info;
102 107
@@ -234,7 +239,8 @@ ia64_log_get(int sal_info_type, u8 **buffer, int irq_safe)
234 * This function retrieves a specified error record type from SAL 239 * This function retrieves a specified error record type from SAL
235 * and wakes up any processes waiting for error records. 240 * and wakes up any processes waiting for error records.
236 * 241 *
237 * Inputs : sal_info_type (Type of error record MCA/CMC/CPE/INIT) 242 * Inputs : sal_info_type (Type of error record MCA/CMC/CPE)
243 * FIXME: remove MCA and irq_safe.
238 */ 244 */
239static void 245static void
240ia64_mca_log_sal_error_record(int sal_info_type) 246ia64_mca_log_sal_error_record(int sal_info_type)
@@ -242,7 +248,7 @@ ia64_mca_log_sal_error_record(int sal_info_type)
242 u8 *buffer; 248 u8 *buffer;
243 sal_log_record_header_t *rh; 249 sal_log_record_header_t *rh;
244 u64 size; 250 u64 size;
245 int irq_safe = sal_info_type != SAL_INFO_TYPE_MCA && sal_info_type != SAL_INFO_TYPE_INIT; 251 int irq_safe = sal_info_type != SAL_INFO_TYPE_MCA;
246#ifdef IA64_MCA_DEBUG_INFO 252#ifdef IA64_MCA_DEBUG_INFO
247 static const char * const rec_name[] = { "MCA", "INIT", "CMC", "CPE" }; 253 static const char * const rec_name[] = { "MCA", "INIT", "CMC", "CPE" };
248#endif 254#endif
@@ -330,191 +336,6 @@ ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs)
330 336
331#endif /* CONFIG_ACPI */ 337#endif /* CONFIG_ACPI */
332 338
333static void
334show_min_state (pal_min_state_area_t *minstate)
335{
336 u64 iip = minstate->pmsa_iip + ((struct ia64_psr *)(&minstate->pmsa_ipsr))->ri;
337 u64 xip = minstate->pmsa_xip + ((struct ia64_psr *)(&minstate->pmsa_xpsr))->ri;
338
339 printk("NaT bits\t%016lx\n", minstate->pmsa_nat_bits);
340 printk("pr\t\t%016lx\n", minstate->pmsa_pr);
341 printk("b0\t\t%016lx ", minstate->pmsa_br0); print_symbol("%s\n", minstate->pmsa_br0);
342 printk("ar.rsc\t\t%016lx\n", minstate->pmsa_rsc);
343 printk("cr.iip\t\t%016lx ", iip); print_symbol("%s\n", iip);
344 printk("cr.ipsr\t\t%016lx\n", minstate->pmsa_ipsr);
345 printk("cr.ifs\t\t%016lx\n", minstate->pmsa_ifs);
346 printk("xip\t\t%016lx ", xip); print_symbol("%s\n", xip);
347 printk("xpsr\t\t%016lx\n", minstate->pmsa_xpsr);
348 printk("xfs\t\t%016lx\n", minstate->pmsa_xfs);
349 printk("b1\t\t%016lx ", minstate->pmsa_br1);
350 print_symbol("%s\n", minstate->pmsa_br1);
351
352 printk("\nstatic registers r0-r15:\n");
353 printk(" r0- 3 %016lx %016lx %016lx %016lx\n",
354 0UL, minstate->pmsa_gr[0], minstate->pmsa_gr[1], minstate->pmsa_gr[2]);
355 printk(" r4- 7 %016lx %016lx %016lx %016lx\n",
356 minstate->pmsa_gr[3], minstate->pmsa_gr[4],
357 minstate->pmsa_gr[5], minstate->pmsa_gr[6]);
358 printk(" r8-11 %016lx %016lx %016lx %016lx\n",
359 minstate->pmsa_gr[7], minstate->pmsa_gr[8],
360 minstate->pmsa_gr[9], minstate->pmsa_gr[10]);
361 printk("r12-15 %016lx %016lx %016lx %016lx\n",
362 minstate->pmsa_gr[11], minstate->pmsa_gr[12],
363 minstate->pmsa_gr[13], minstate->pmsa_gr[14]);
364
365 printk("\nbank 0:\n");
366 printk("r16-19 %016lx %016lx %016lx %016lx\n",
367 minstate->pmsa_bank0_gr[0], minstate->pmsa_bank0_gr[1],
368 minstate->pmsa_bank0_gr[2], minstate->pmsa_bank0_gr[3]);
369 printk("r20-23 %016lx %016lx %016lx %016lx\n",
370 minstate->pmsa_bank0_gr[4], minstate->pmsa_bank0_gr[5],
371 minstate->pmsa_bank0_gr[6], minstate->pmsa_bank0_gr[7]);
372 printk("r24-27 %016lx %016lx %016lx %016lx\n",
373 minstate->pmsa_bank0_gr[8], minstate->pmsa_bank0_gr[9],
374 minstate->pmsa_bank0_gr[10], minstate->pmsa_bank0_gr[11]);
375 printk("r28-31 %016lx %016lx %016lx %016lx\n",
376 minstate->pmsa_bank0_gr[12], minstate->pmsa_bank0_gr[13],
377 minstate->pmsa_bank0_gr[14], minstate->pmsa_bank0_gr[15]);
378
379 printk("\nbank 1:\n");
380 printk("r16-19 %016lx %016lx %016lx %016lx\n",
381 minstate->pmsa_bank1_gr[0], minstate->pmsa_bank1_gr[1],
382 minstate->pmsa_bank1_gr[2], minstate->pmsa_bank1_gr[3]);
383 printk("r20-23 %016lx %016lx %016lx %016lx\n",
384 minstate->pmsa_bank1_gr[4], minstate->pmsa_bank1_gr[5],
385 minstate->pmsa_bank1_gr[6], minstate->pmsa_bank1_gr[7]);
386 printk("r24-27 %016lx %016lx %016lx %016lx\n",
387 minstate->pmsa_bank1_gr[8], minstate->pmsa_bank1_gr[9],
388 minstate->pmsa_bank1_gr[10], minstate->pmsa_bank1_gr[11]);
389 printk("r28-31 %016lx %016lx %016lx %016lx\n",
390 minstate->pmsa_bank1_gr[12], minstate->pmsa_bank1_gr[13],
391 minstate->pmsa_bank1_gr[14], minstate->pmsa_bank1_gr[15]);
392}
393
394static void
395fetch_min_state (pal_min_state_area_t *ms, struct pt_regs *pt, struct switch_stack *sw)
396{
397 u64 *dst_banked, *src_banked, bit, shift, nat_bits;
398 int i;
399
400 /*
401 * First, update the pt-regs and switch-stack structures with the contents stored
402 * in the min-state area:
403 */
404 if (((struct ia64_psr *) &ms->pmsa_ipsr)->ic == 0) {
405 pt->cr_ipsr = ms->pmsa_xpsr;
406 pt->cr_iip = ms->pmsa_xip;
407 pt->cr_ifs = ms->pmsa_xfs;
408 } else {
409 pt->cr_ipsr = ms->pmsa_ipsr;
410 pt->cr_iip = ms->pmsa_iip;
411 pt->cr_ifs = ms->pmsa_ifs;
412 }
413 pt->ar_rsc = ms->pmsa_rsc;
414 pt->pr = ms->pmsa_pr;
415 pt->r1 = ms->pmsa_gr[0];
416 pt->r2 = ms->pmsa_gr[1];
417 pt->r3 = ms->pmsa_gr[2];
418 sw->r4 = ms->pmsa_gr[3];
419 sw->r5 = ms->pmsa_gr[4];
420 sw->r6 = ms->pmsa_gr[5];
421 sw->r7 = ms->pmsa_gr[6];
422 pt->r8 = ms->pmsa_gr[7];
423 pt->r9 = ms->pmsa_gr[8];
424 pt->r10 = ms->pmsa_gr[9];
425 pt->r11 = ms->pmsa_gr[10];
426 pt->r12 = ms->pmsa_gr[11];
427 pt->r13 = ms->pmsa_gr[12];
428 pt->r14 = ms->pmsa_gr[13];
429 pt->r15 = ms->pmsa_gr[14];
430 dst_banked = &pt->r16; /* r16-r31 are contiguous in struct pt_regs */
431 src_banked = ms->pmsa_bank1_gr;
432 for (i = 0; i < 16; ++i)
433 dst_banked[i] = src_banked[i];
434 pt->b0 = ms->pmsa_br0;
435 sw->b1 = ms->pmsa_br1;
436
437 /* construct the NaT bits for the pt-regs structure: */
438# define PUT_NAT_BIT(dst, addr) \
439 do { \
440 bit = nat_bits & 1; nat_bits >>= 1; \
441 shift = ((unsigned long) addr >> 3) & 0x3f; \
442 dst = ((dst) & ~(1UL << shift)) | (bit << shift); \
443 } while (0)
444
445 /* Rotate the saved NaT bits such that bit 0 corresponds to pmsa_gr[0]: */
446 shift = ((unsigned long) &ms->pmsa_gr[0] >> 3) & 0x3f;
447 nat_bits = (ms->pmsa_nat_bits >> shift) | (ms->pmsa_nat_bits << (64 - shift));
448
449 PUT_NAT_BIT(sw->caller_unat, &pt->r1);
450 PUT_NAT_BIT(sw->caller_unat, &pt->r2);
451 PUT_NAT_BIT(sw->caller_unat, &pt->r3);
452 PUT_NAT_BIT(sw->ar_unat, &sw->r4);
453 PUT_NAT_BIT(sw->ar_unat, &sw->r5);
454 PUT_NAT_BIT(sw->ar_unat, &sw->r6);
455 PUT_NAT_BIT(sw->ar_unat, &sw->r7);
456 PUT_NAT_BIT(sw->caller_unat, &pt->r8); PUT_NAT_BIT(sw->caller_unat, &pt->r9);
457 PUT_NAT_BIT(sw->caller_unat, &pt->r10); PUT_NAT_BIT(sw->caller_unat, &pt->r11);
458 PUT_NAT_BIT(sw->caller_unat, &pt->r12); PUT_NAT_BIT(sw->caller_unat, &pt->r13);
459 PUT_NAT_BIT(sw->caller_unat, &pt->r14); PUT_NAT_BIT(sw->caller_unat, &pt->r15);
460 nat_bits >>= 16; /* skip over bank0 NaT bits */
461 PUT_NAT_BIT(sw->caller_unat, &pt->r16); PUT_NAT_BIT(sw->caller_unat, &pt->r17);
462 PUT_NAT_BIT(sw->caller_unat, &pt->r18); PUT_NAT_BIT(sw->caller_unat, &pt->r19);
463 PUT_NAT_BIT(sw->caller_unat, &pt->r20); PUT_NAT_BIT(sw->caller_unat, &pt->r21);
464 PUT_NAT_BIT(sw->caller_unat, &pt->r22); PUT_NAT_BIT(sw->caller_unat, &pt->r23);
465 PUT_NAT_BIT(sw->caller_unat, &pt->r24); PUT_NAT_BIT(sw->caller_unat, &pt->r25);
466 PUT_NAT_BIT(sw->caller_unat, &pt->r26); PUT_NAT_BIT(sw->caller_unat, &pt->r27);
467 PUT_NAT_BIT(sw->caller_unat, &pt->r28); PUT_NAT_BIT(sw->caller_unat, &pt->r29);
468 PUT_NAT_BIT(sw->caller_unat, &pt->r30); PUT_NAT_BIT(sw->caller_unat, &pt->r31);
469}
470
471static void
472init_handler_platform (pal_min_state_area_t *ms,
473 struct pt_regs *pt, struct switch_stack *sw)
474{
475 struct unw_frame_info info;
476
477 /* if a kernel debugger is available call it here else just dump the registers */
478
479 /*
480 * Wait for a bit. On some machines (e.g., HP's zx2000 and zx6000, INIT can be
481 * generated via the BMC's command-line interface, but since the console is on the
482 * same serial line, the user will need some time to switch out of the BMC before
483 * the dump begins.
484 */
485 printk("Delaying for 5 seconds...\n");
486 udelay(5*1000000);
487 show_min_state(ms);
488
489 printk("Backtrace of current task (pid %d, %s)\n", current->pid, current->comm);
490 fetch_min_state(ms, pt, sw);
491 unw_init_from_interruption(&info, current, pt, sw);
492 ia64_do_show_stack(&info, NULL);
493
494#ifdef CONFIG_SMP
495 /* read_trylock() would be handy... */
496 if (!tasklist_lock.write_lock)
497 read_lock(&tasklist_lock);
498#endif
499 {
500 struct task_struct *g, *t;
501 do_each_thread (g, t) {
502 if (t == current)
503 continue;
504
505 printk("\nBacktrace of pid %d (%s)\n", t->pid, t->comm);
506 show_stack(t, NULL);
507 } while_each_thread (g, t);
508 }
509#ifdef CONFIG_SMP
510 if (!tasklist_lock.write_lock)
511 read_unlock(&tasklist_lock);
512#endif
513
514 printk("\nINIT dump complete. Please reboot now.\n");
515 while (1); /* hang city if no debugger */
516}
517
518#ifdef CONFIG_ACPI 339#ifdef CONFIG_ACPI
519/* 340/*
520 * ia64_mca_register_cpev 341 * ia64_mca_register_cpev
@@ -657,42 +478,6 @@ ia64_mca_cmc_vector_enable_keventd(void *unused)
657} 478}
658 479
659/* 480/*
660 * ia64_mca_wakeup_ipi_wait
661 *
662 * Wait for the inter-cpu interrupt to be sent by the
663 * monarch processor once it is done with handling the
664 * MCA.
665 *
666 * Inputs : None
667 * Outputs : None
668 */
669static void
670ia64_mca_wakeup_ipi_wait(void)
671{
672 int irr_num = (IA64_MCA_WAKEUP_VECTOR >> 6);
673 int irr_bit = (IA64_MCA_WAKEUP_VECTOR & 0x3f);
674 u64 irr = 0;
675
676 do {
677 switch(irr_num) {
678 case 0:
679 irr = ia64_getreg(_IA64_REG_CR_IRR0);
680 break;
681 case 1:
682 irr = ia64_getreg(_IA64_REG_CR_IRR1);
683 break;
684 case 2:
685 irr = ia64_getreg(_IA64_REG_CR_IRR2);
686 break;
687 case 3:
688 irr = ia64_getreg(_IA64_REG_CR_IRR3);
689 break;
690 }
691 cpu_relax();
692 } while (!(irr & (1UL << irr_bit))) ;
693}
694
695/*
696 * ia64_mca_wakeup 481 * ia64_mca_wakeup
697 * 482 *
698 * Send an inter-cpu interrupt to wake-up a particular cpu 483 * Send an inter-cpu interrupt to wake-up a particular cpu
@@ -757,11 +542,9 @@ ia64_mca_rendez_int_handler(int rendez_irq, void *arg, struct pt_regs *ptregs)
757 */ 542 */
758 ia64_sal_mc_rendez(); 543 ia64_sal_mc_rendez();
759 544
760 /* Wait for the wakeup IPI from the monarch 545 /* Wait for the monarch cpu to exit. */
761 * This waiting is done by polling on the wakeup-interrupt 546 while (monarch_cpu != -1)
762 * vector bit in the processor's IRRs 547 cpu_relax(); /* spin until monarch leaves */
763 */
764 ia64_mca_wakeup_ipi_wait();
765 548
766 /* Enable all interrupts */ 549 /* Enable all interrupts */
767 local_irq_restore(flags); 550 local_irq_restore(flags);
@@ -789,53 +572,13 @@ ia64_mca_wakeup_int_handler(int wakeup_irq, void *arg, struct pt_regs *ptregs)
789 return IRQ_HANDLED; 572 return IRQ_HANDLED;
790} 573}
791 574
792/*
793 * ia64_return_to_sal_check
794 *
795 * This is function called before going back from the OS_MCA handler
796 * to the OS_MCA dispatch code which finally takes the control back
797 * to the SAL.
798 * The main purpose of this routine is to setup the OS_MCA to SAL
799 * return state which can be used by the OS_MCA dispatch code
800 * just before going back to SAL.
801 *
802 * Inputs : None
803 * Outputs : None
804 */
805
806static void
807ia64_return_to_sal_check(int recover)
808{
809
810 /* Copy over some relevant stuff from the sal_to_os_mca_handoff
811 * so that it can be used at the time of os_mca_to_sal_handoff
812 */
813 ia64_os_to_sal_handoff_state.imots_sal_gp =
814 ia64_sal_to_os_handoff_state.imsto_sal_gp;
815
816 ia64_os_to_sal_handoff_state.imots_sal_check_ra =
817 ia64_sal_to_os_handoff_state.imsto_sal_check_ra;
818
819 if (recover)
820 ia64_os_to_sal_handoff_state.imots_os_status = IA64_MCA_CORRECTED;
821 else
822 ia64_os_to_sal_handoff_state.imots_os_status = IA64_MCA_COLD_BOOT;
823
824 /* Default = tell SAL to return to same context */
825 ia64_os_to_sal_handoff_state.imots_context = IA64_MCA_SAME_CONTEXT;
826
827 ia64_os_to_sal_handoff_state.imots_new_min_state =
828 (u64 *)ia64_sal_to_os_handoff_state.pal_min_state;
829
830}
831
832/* Function pointer for extra MCA recovery */ 575/* Function pointer for extra MCA recovery */
833int (*ia64_mca_ucmc_extension) 576int (*ia64_mca_ucmc_extension)
834 (void*,ia64_mca_sal_to_os_state_t*,ia64_mca_os_to_sal_state_t*) 577 (void*,struct ia64_sal_os_state*)
835 = NULL; 578 = NULL;
836 579
837int 580int
838ia64_reg_MCA_extension(void *fn) 581ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *))
839{ 582{
840 if (ia64_mca_ucmc_extension) 583 if (ia64_mca_ucmc_extension)
841 return 1; 584 return 1;
@@ -854,8 +597,321 @@ ia64_unreg_MCA_extension(void)
854EXPORT_SYMBOL(ia64_reg_MCA_extension); 597EXPORT_SYMBOL(ia64_reg_MCA_extension);
855EXPORT_SYMBOL(ia64_unreg_MCA_extension); 598EXPORT_SYMBOL(ia64_unreg_MCA_extension);
856 599
600
601static inline void
602copy_reg(const u64 *fr, u64 fnat, u64 *tr, u64 *tnat)
603{
604 u64 fslot, tslot, nat;
605 *tr = *fr;
606 fslot = ((unsigned long)fr >> 3) & 63;
607 tslot = ((unsigned long)tr >> 3) & 63;
608 *tnat &= ~(1UL << tslot);
609 nat = (fnat >> fslot) & 1;
610 *tnat |= (nat << tslot);
611}
612
613/* On entry to this routine, we are running on the per cpu stack, see
614 * mca_asm.h. The original stack has not been touched by this event. Some of
615 * the original stack's registers will be in the RBS on this stack. This stack
616 * also contains a partial pt_regs and switch_stack, the rest of the data is in
617 * PAL minstate.
618 *
619 * The first thing to do is modify the original stack to look like a blocked
620 * task so we can run backtrace on the original task. Also mark the per cpu
621 * stack as current to ensure that we use the correct task state, it also means
622 * that we can do backtrace on the MCA/INIT handler code itself.
623 */
624
625static task_t *
626ia64_mca_modify_original_stack(struct pt_regs *regs,
627 const struct switch_stack *sw,
628 struct ia64_sal_os_state *sos,
629 const char *type)
630{
631 char *p, comm[sizeof(current->comm)];
632 ia64_va va;
633 extern char ia64_leave_kernel[]; /* Need asm address, not function descriptor */
634 const pal_min_state_area_t *ms = sos->pal_min_state;
635 task_t *previous_current;
636 struct pt_regs *old_regs;
637 struct switch_stack *old_sw;
638 unsigned size = sizeof(struct pt_regs) +
639 sizeof(struct switch_stack) + 16;
640 u64 *old_bspstore, *old_bsp;
641 u64 *new_bspstore, *new_bsp;
642 u64 old_unat, old_rnat, new_rnat, nat;
643 u64 slots, loadrs = regs->loadrs;
644 u64 r12 = ms->pmsa_gr[12-1], r13 = ms->pmsa_gr[13-1];
645 u64 ar_bspstore = regs->ar_bspstore;
646 u64 ar_bsp = regs->ar_bspstore + (loadrs >> 16);
647 const u64 *bank;
648 const char *msg;
649 int cpu = smp_processor_id();
650
651 previous_current = curr_task(cpu);
652 set_curr_task(cpu, current);
653 if ((p = strchr(current->comm, ' ')))
654 *p = '\0';
655
656 /* Best effort attempt to cope with MCA/INIT delivered while in
657 * physical mode.
658 */
659 regs->cr_ipsr = ms->pmsa_ipsr;
660 if (ia64_psr(regs)->dt == 0) {
661 va.l = r12;
662 if (va.f.reg == 0) {
663 va.f.reg = 7;
664 r12 = va.l;
665 }
666 va.l = r13;
667 if (va.f.reg == 0) {
668 va.f.reg = 7;
669 r13 = va.l;
670 }
671 }
672 if (ia64_psr(regs)->rt == 0) {
673 va.l = ar_bspstore;
674 if (va.f.reg == 0) {
675 va.f.reg = 7;
676 ar_bspstore = va.l;
677 }
678 va.l = ar_bsp;
679 if (va.f.reg == 0) {
680 va.f.reg = 7;
681 ar_bsp = va.l;
682 }
683 }
684
685 /* mca_asm.S ia64_old_stack() cannot assume that the dirty registers
686 * have been copied to the old stack, the old stack may fail the
687 * validation tests below. So ia64_old_stack() must restore the dirty
688 * registers from the new stack. The old and new bspstore probably
689 * have different alignments, so loadrs calculated on the old bsp
690 * cannot be used to restore from the new bsp. Calculate a suitable
691 * loadrs for the new stack and save it in the new pt_regs, where
692 * ia64_old_stack() can get it.
693 */
694 old_bspstore = (u64 *)ar_bspstore;
695 old_bsp = (u64 *)ar_bsp;
696 slots = ia64_rse_num_regs(old_bspstore, old_bsp);
697 new_bspstore = (u64 *)((u64)current + IA64_RBS_OFFSET);
698 new_bsp = ia64_rse_skip_regs(new_bspstore, slots);
699 regs->loadrs = (new_bsp - new_bspstore) * 8 << 16;
700
701 /* Verify the previous stack state before we change it */
702 if (user_mode(regs)) {
703 msg = "occurred in user space";
704 goto no_mod;
705 }
706 if (r13 != sos->prev_IA64_KR_CURRENT) {
707 msg = "inconsistent previous current and r13";
708 goto no_mod;
709 }
710 if ((r12 - r13) >= KERNEL_STACK_SIZE) {
711 msg = "inconsistent r12 and r13";
712 goto no_mod;
713 }
714 if ((ar_bspstore - r13) >= KERNEL_STACK_SIZE) {
715 msg = "inconsistent ar.bspstore and r13";
716 goto no_mod;
717 }
718 va.p = old_bspstore;
719 if (va.f.reg < 5) {
720 msg = "old_bspstore is in the wrong region";
721 goto no_mod;
722 }
723 if ((ar_bsp - r13) >= KERNEL_STACK_SIZE) {
724 msg = "inconsistent ar.bsp and r13";
725 goto no_mod;
726 }
727 size += (ia64_rse_skip_regs(old_bspstore, slots) - old_bspstore) * 8;
728 if (ar_bspstore + size > r12) {
729 msg = "no room for blocked state";
730 goto no_mod;
731 }
732
733 /* Change the comm field on the MCA/INT task to include the pid that
734 * was interrupted, it makes for easier debugging. If that pid was 0
735 * (swapper or nested MCA/INIT) then use the start of the previous comm
736 * field suffixed with its cpu.
737 */
738 if (previous_current->pid)
739 snprintf(comm, sizeof(comm), "%s %d",
740 current->comm, previous_current->pid);
741 else {
742 int l;
743 if ((p = strchr(previous_current->comm, ' ')))
744 l = p - previous_current->comm;
745 else
746 l = strlen(previous_current->comm);
747 snprintf(comm, sizeof(comm), "%s %*s %d",
748 current->comm, l, previous_current->comm,
749 previous_current->thread_info->cpu);
750 }
751 memcpy(current->comm, comm, sizeof(current->comm));
752
753 /* Make the original task look blocked. First stack a struct pt_regs,
754 * describing the state at the time of interrupt. mca_asm.S built a
755 * partial pt_regs, copy it and fill in the blanks using minstate.
756 */
757 p = (char *)r12 - sizeof(*regs);
758 old_regs = (struct pt_regs *)p;
759 memcpy(old_regs, regs, sizeof(*regs));
760 /* If ipsr.ic then use pmsa_{iip,ipsr,ifs}, else use
761 * pmsa_{xip,xpsr,xfs}
762 */
763 if (ia64_psr(regs)->ic) {
764 old_regs->cr_iip = ms->pmsa_iip;
765 old_regs->cr_ipsr = ms->pmsa_ipsr;
766 old_regs->cr_ifs = ms->pmsa_ifs;
767 } else {
768 old_regs->cr_iip = ms->pmsa_xip;
769 old_regs->cr_ipsr = ms->pmsa_xpsr;
770 old_regs->cr_ifs = ms->pmsa_xfs;
771 }
772 old_regs->pr = ms->pmsa_pr;
773 old_regs->b0 = ms->pmsa_br0;
774 old_regs->loadrs = loadrs;
775 old_regs->ar_rsc = ms->pmsa_rsc;
776 old_unat = old_regs->ar_unat;
777 copy_reg(&ms->pmsa_gr[1-1], ms->pmsa_nat_bits, &old_regs->r1, &old_unat);
778 copy_reg(&ms->pmsa_gr[2-1], ms->pmsa_nat_bits, &old_regs->r2, &old_unat);
779 copy_reg(&ms->pmsa_gr[3-1], ms->pmsa_nat_bits, &old_regs->r3, &old_unat);
780 copy_reg(&ms->pmsa_gr[8-1], ms->pmsa_nat_bits, &old_regs->r8, &old_unat);
781 copy_reg(&ms->pmsa_gr[9-1], ms->pmsa_nat_bits, &old_regs->r9, &old_unat);
782 copy_reg(&ms->pmsa_gr[10-1], ms->pmsa_nat_bits, &old_regs->r10, &old_unat);
783 copy_reg(&ms->pmsa_gr[11-1], ms->pmsa_nat_bits, &old_regs->r11, &old_unat);
784 copy_reg(&ms->pmsa_gr[12-1], ms->pmsa_nat_bits, &old_regs->r12, &old_unat);
785 copy_reg(&ms->pmsa_gr[13-1], ms->pmsa_nat_bits, &old_regs->r13, &old_unat);
786 copy_reg(&ms->pmsa_gr[14-1], ms->pmsa_nat_bits, &old_regs->r14, &old_unat);
787 copy_reg(&ms->pmsa_gr[15-1], ms->pmsa_nat_bits, &old_regs->r15, &old_unat);
788 if (ia64_psr(old_regs)->bn)
789 bank = ms->pmsa_bank1_gr;
790 else
791 bank = ms->pmsa_bank0_gr;
792 copy_reg(&bank[16-16], ms->pmsa_nat_bits, &old_regs->r16, &old_unat);
793 copy_reg(&bank[17-16], ms->pmsa_nat_bits, &old_regs->r17, &old_unat);
794 copy_reg(&bank[18-16], ms->pmsa_nat_bits, &old_regs->r18, &old_unat);
795 copy_reg(&bank[19-16], ms->pmsa_nat_bits, &old_regs->r19, &old_unat);
796 copy_reg(&bank[20-16], ms->pmsa_nat_bits, &old_regs->r20, &old_unat);
797 copy_reg(&bank[21-16], ms->pmsa_nat_bits, &old_regs->r21, &old_unat);
798 copy_reg(&bank[22-16], ms->pmsa_nat_bits, &old_regs->r22, &old_unat);
799 copy_reg(&bank[23-16], ms->pmsa_nat_bits, &old_regs->r23, &old_unat);
800 copy_reg(&bank[24-16], ms->pmsa_nat_bits, &old_regs->r24, &old_unat);
801 copy_reg(&bank[25-16], ms->pmsa_nat_bits, &old_regs->r25, &old_unat);
802 copy_reg(&bank[26-16], ms->pmsa_nat_bits, &old_regs->r26, &old_unat);
803 copy_reg(&bank[27-16], ms->pmsa_nat_bits, &old_regs->r27, &old_unat);
804 copy_reg(&bank[28-16], ms->pmsa_nat_bits, &old_regs->r28, &old_unat);
805 copy_reg(&bank[29-16], ms->pmsa_nat_bits, &old_regs->r29, &old_unat);
806 copy_reg(&bank[30-16], ms->pmsa_nat_bits, &old_regs->r30, &old_unat);
807 copy_reg(&bank[31-16], ms->pmsa_nat_bits, &old_regs->r31, &old_unat);
808
809 /* Next stack a struct switch_stack. mca_asm.S built a partial
810 * switch_stack, copy it and fill in the blanks using pt_regs and
811 * minstate.
812 *
813 * In the synthesized switch_stack, b0 points to ia64_leave_kernel,
814 * ar.pfs is set to 0.
815 *
816 * unwind.c::unw_unwind() does special processing for interrupt frames.
817 * It checks if the PRED_NON_SYSCALL predicate is set, if the predicate
818 * is clear then unw_unwind() does _not_ adjust bsp over pt_regs. Not
819 * that this is documented, of course. Set PRED_NON_SYSCALL in the
820 * switch_stack on the original stack so it will unwind correctly when
821 * unwind.c reads pt_regs.
822 *
823 * thread.ksp is updated to point to the synthesized switch_stack.
824 */
825 p -= sizeof(struct switch_stack);
826 old_sw = (struct switch_stack *)p;
827 memcpy(old_sw, sw, sizeof(*sw));
828 old_sw->caller_unat = old_unat;
829 old_sw->ar_fpsr = old_regs->ar_fpsr;
830 copy_reg(&ms->pmsa_gr[4-1], ms->pmsa_nat_bits, &old_sw->r4, &old_unat);
831 copy_reg(&ms->pmsa_gr[5-1], ms->pmsa_nat_bits, &old_sw->r5, &old_unat);
832 copy_reg(&ms->pmsa_gr[6-1], ms->pmsa_nat_bits, &old_sw->r6, &old_unat);
833 copy_reg(&ms->pmsa_gr[7-1], ms->pmsa_nat_bits, &old_sw->r7, &old_unat);
834 old_sw->b0 = (u64)ia64_leave_kernel;
835 old_sw->b1 = ms->pmsa_br1;
836 old_sw->ar_pfs = 0;
837 old_sw->ar_unat = old_unat;
838 old_sw->pr = old_regs->pr | (1UL << PRED_NON_SYSCALL);
839 previous_current->thread.ksp = (u64)p - 16;
840
841 /* Finally copy the original stack's registers back to its RBS.
842 * Registers from ar.bspstore through ar.bsp at the time of the event
843 * are in the current RBS, copy them back to the original stack. The
844 * copy must be done register by register because the original bspstore
845 * and the current one have different alignments, so the saved RNAT
846 * data occurs at different places.
847 *
848 * mca_asm does cover, so the old_bsp already includes all registers at
849 * the time of MCA/INIT. It also does flushrs, so all registers before
850 * this function have been written to backing store on the MCA/INIT
851 * stack.
852 */
853 new_rnat = ia64_get_rnat(ia64_rse_rnat_addr(new_bspstore));
854 old_rnat = regs->ar_rnat;
855 while (slots--) {
856 if (ia64_rse_is_rnat_slot(new_bspstore)) {
857 new_rnat = ia64_get_rnat(new_bspstore++);
858 }
859 if (ia64_rse_is_rnat_slot(old_bspstore)) {
860 *old_bspstore++ = old_rnat;
861 old_rnat = 0;
862 }
863 nat = (new_rnat >> ia64_rse_slot_num(new_bspstore)) & 1UL;
864 old_rnat &= ~(1UL << ia64_rse_slot_num(old_bspstore));
865 old_rnat |= (nat << ia64_rse_slot_num(old_bspstore));
866 *old_bspstore++ = *new_bspstore++;
867 }
868 old_sw->ar_bspstore = (unsigned long)old_bspstore;
869 old_sw->ar_rnat = old_rnat;
870
871 sos->prev_task = previous_current;
872 return previous_current;
873
874no_mod:
875 printk(KERN_INFO "cpu %d, %s %s, original stack not modified\n",
876 smp_processor_id(), type, msg);
877 return previous_current;
878}
879
880/* The monarch/slave interaction is based on monarch_cpu and requires that all
881 * slaves have entered rendezvous before the monarch leaves. If any cpu has
882 * not entered rendezvous yet then wait a bit. The assumption is that any
883 * slave that has not rendezvoused after a reasonable time is never going to do
884 * so. In this context, slave includes cpus that respond to the MCA rendezvous
885 * interrupt, as well as cpus that receive the INIT slave event.
886 */
887
888static void
889ia64_wait_for_slaves(int monarch)
890{
891 int c, wait = 0;
892 for_each_online_cpu(c) {
893 if (c == monarch)
894 continue;
895 if (ia64_mc_info.imi_rendez_checkin[c] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE) {
896 udelay(1000); /* short wait first */
897 wait = 1;
898 break;
899 }
900 }
901 if (!wait)
902 return;
903 for_each_online_cpu(c) {
904 if (c == monarch)
905 continue;
906 if (ia64_mc_info.imi_rendez_checkin[c] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE) {
907 udelay(5*1000000); /* wait 5 seconds for slaves (arbitrary) */
908 break;
909 }
910 }
911}
912
857/* 913/*
858 * ia64_mca_ucmc_handler 914 * ia64_mca_handler
859 * 915 *
860 * This is uncorrectable machine check handler called from OS_MCA 916 * This is uncorrectable machine check handler called from OS_MCA
861 * dispatch code which is in turn called from SAL_CHECK(). 917 * dispatch code which is in turn called from SAL_CHECK().
@@ -866,16 +922,28 @@ EXPORT_SYMBOL(ia64_unreg_MCA_extension);
866 * further MCA logging is enabled by clearing logs. 922 * further MCA logging is enabled by clearing logs.
867 * Monarch also has the duty of sending wakeup-IPIs to pull the 923 * Monarch also has the duty of sending wakeup-IPIs to pull the
868 * slave processors out of rendezvous spinloop. 924 * slave processors out of rendezvous spinloop.
869 *
870 * Inputs : None
871 * Outputs : None
872 */ 925 */
873void 926void
874ia64_mca_ucmc_handler(void) 927ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
928 struct ia64_sal_os_state *sos)
875{ 929{
876 pal_processor_state_info_t *psp = (pal_processor_state_info_t *) 930 pal_processor_state_info_t *psp = (pal_processor_state_info_t *)
877 &ia64_sal_to_os_handoff_state.proc_state_param; 931 &sos->proc_state_param;
878 int recover; 932 int recover, cpu = smp_processor_id();
933 task_t *previous_current;
934
935 oops_in_progress = 1; /* FIXME: make printk NMI/MCA/INIT safe */
936 previous_current = ia64_mca_modify_original_stack(regs, sw, sos, "MCA");
937 monarch_cpu = cpu;
938 ia64_wait_for_slaves(cpu);
939
940 /* Wakeup all the processors which are spinning in the rendezvous loop.
941 * They will leave SAL, then spin in the OS with interrupts disabled
942 * until this monarch cpu leaves the MCA handler. That gets control
943 * back to the OS so we can backtrace the other cpus, backtrace when
944 * spinning in SAL does not work.
945 */
946 ia64_mca_wakeup_all();
879 947
880 /* Get the MCA error record and log it */ 948 /* Get the MCA error record and log it */
881 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_MCA); 949 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_MCA);
@@ -883,25 +951,20 @@ ia64_mca_ucmc_handler(void)
883 /* TLB error is only exist in this SAL error record */ 951 /* TLB error is only exist in this SAL error record */
884 recover = (psp->tc && !(psp->cc || psp->bc || psp->rc || psp->uc)) 952 recover = (psp->tc && !(psp->cc || psp->bc || psp->rc || psp->uc))
885 /* other error recovery */ 953 /* other error recovery */
886 || (ia64_mca_ucmc_extension 954 || (ia64_mca_ucmc_extension
887 && ia64_mca_ucmc_extension( 955 && ia64_mca_ucmc_extension(
888 IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA), 956 IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA),
889 &ia64_sal_to_os_handoff_state, 957 sos));
890 &ia64_os_to_sal_handoff_state));
891 958
892 if (recover) { 959 if (recover) {
893 sal_log_record_header_t *rh = IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA); 960 sal_log_record_header_t *rh = IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA);
894 rh->severity = sal_log_severity_corrected; 961 rh->severity = sal_log_severity_corrected;
895 ia64_sal_clear_state_info(SAL_INFO_TYPE_MCA); 962 ia64_sal_clear_state_info(SAL_INFO_TYPE_MCA);
963 sos->os_status = IA64_MCA_CORRECTED;
896 } 964 }
897 /*
898 * Wakeup all the processors which are spinning in the rendezvous
899 * loop.
900 */
901 ia64_mca_wakeup_all();
902 965
903 /* Return to SAL */ 966 set_curr_task(cpu, previous_current);
904 ia64_return_to_sal_check(recover); 967 monarch_cpu = -1;
905} 968}
906 969
907static DECLARE_WORK(cmc_disable_work, ia64_mca_cmc_vector_disable_keventd, NULL); 970static DECLARE_WORK(cmc_disable_work, ia64_mca_cmc_vector_disable_keventd, NULL);
@@ -1125,34 +1188,114 @@ ia64_mca_cpe_poll (unsigned long dummy)
1125/* 1188/*
1126 * C portion of the OS INIT handler 1189 * C portion of the OS INIT handler
1127 * 1190 *
1128 * Called from ia64_monarch_init_handler 1191 * Called from ia64_os_init_dispatch
1129 *
1130 * Inputs: pointer to pt_regs where processor info was saved.
1131 * 1192 *
1132 * Returns: 1193 * Inputs: pointer to pt_regs where processor info was saved. SAL/OS state for
1133 * 0 if SAL must warm boot the System 1194 * this event. This code is used for both monarch and slave INIT events, see
1134 * 1 if SAL must return to interrupted context using PAL_MC_RESUME 1195 * sos->monarch.
1135 * 1196 *
1197 * All INIT events switch to the INIT stack and change the previous process to
1198 * blocked status. If one of the INIT events is the monarch then we are
1199 * probably processing the nmi button/command. Use the monarch cpu to dump all
1200 * the processes. The slave INIT events all spin until the monarch cpu
1201 * returns. We can also get INIT slave events for MCA, in which case the MCA
1202 * process is the monarch.
1136 */ 1203 */
1204
1137void 1205void
1138ia64_init_handler (struct pt_regs *pt, struct switch_stack *sw) 1206ia64_init_handler(struct pt_regs *regs, struct switch_stack *sw,
1207 struct ia64_sal_os_state *sos)
1139{ 1208{
1140 pal_min_state_area_t *ms; 1209 static atomic_t slaves;
1210 static atomic_t monarchs;
1211 task_t *previous_current;
1212 int cpu = smp_processor_id(), c;
1213 struct task_struct *g, *t;
1141 1214
1142 oops_in_progress = 1; /* avoid deadlock in printk, but it makes recovery dodgy */ 1215 oops_in_progress = 1; /* FIXME: make printk NMI/MCA/INIT safe */
1143 console_loglevel = 15; /* make sure printks make it to console */ 1216 console_loglevel = 15; /* make sure printks make it to console */
1144 1217
1145 printk(KERN_INFO "Entered OS INIT handler. PSP=%lx\n", 1218 printk(KERN_INFO "Entered OS INIT handler. PSP=%lx cpu=%d monarch=%ld\n",
1146 ia64_sal_to_os_handoff_state.proc_state_param); 1219 sos->proc_state_param, cpu, sos->monarch);
1220 salinfo_log_wakeup(SAL_INFO_TYPE_INIT, NULL, 0, 0);
1147 1221
1148 /* 1222 previous_current = ia64_mca_modify_original_stack(regs, sw, sos, "INIT");
1149 * Address of minstate area provided by PAL is physical, 1223 sos->os_status = IA64_INIT_RESUME;
1150 * uncacheable (bit 63 set). Convert to Linux virtual 1224
1151 * address in region 6. 1225 /* FIXME: Workaround for broken proms that drive all INIT events as
1226 * slaves. The last slave that enters is promoted to be a monarch.
1227 * Remove this code in September 2006, that gives platforms a year to
1228 * fix their proms and get their customers updated.
1152 */ 1229 */
1153 ms = (pal_min_state_area_t *)(ia64_sal_to_os_handoff_state.pal_min_state | (6ul<<61)); 1230 if (!sos->monarch && atomic_add_return(1, &slaves) == num_online_cpus()) {
1231 printk(KERN_WARNING "%s: Promoting cpu %d to monarch.\n",
1232 __FUNCTION__, cpu);
1233 atomic_dec(&slaves);
1234 sos->monarch = 1;
1235 }
1236
1237 /* FIXME: Workaround for broken proms that drive all INIT events as
1238 * monarchs. Second and subsequent monarchs are demoted to slaves.
1239 * Remove this code in September 2006, that gives platforms a year to
1240 * fix their proms and get their customers updated.
1241 */
1242 if (sos->monarch && atomic_add_return(1, &monarchs) > 1) {
1243 printk(KERN_WARNING "%s: Demoting cpu %d to slave.\n",
1244 __FUNCTION__, cpu);
1245 atomic_dec(&monarchs);
1246 sos->monarch = 0;
1247 }
1154 1248
1155 init_handler_platform(ms, pt, sw); /* call platform specific routines */ 1249 if (!sos->monarch) {
1250 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_INIT;
1251 while (monarch_cpu == -1)
1252 cpu_relax(); /* spin until monarch enters */
1253 while (monarch_cpu != -1)
1254 cpu_relax(); /* spin until monarch leaves */
1255 printk("Slave on cpu %d returning to normal service.\n", cpu);
1256 set_curr_task(cpu, previous_current);
1257 ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
1258 atomic_dec(&slaves);
1259 return;
1260 }
1261
1262 monarch_cpu = cpu;
1263
1264 /*
1265 * Wait for a bit. On some machines (e.g., HP's zx2000 and zx6000, INIT can be
1266 * generated via the BMC's command-line interface, but since the console is on the
1267 * same serial line, the user will need some time to switch out of the BMC before
1268 * the dump begins.
1269 */
1270 printk("Delaying for 5 seconds...\n");
1271 udelay(5*1000000);
1272 ia64_wait_for_slaves(cpu);
1273 printk(KERN_ERR "Processes interrupted by INIT -");
1274 for_each_online_cpu(c) {
1275 struct ia64_sal_os_state *s;
1276 t = __va(__per_cpu_mca[c] + IA64_MCA_CPU_INIT_STACK_OFFSET);
1277 s = (struct ia64_sal_os_state *)((char *)t + MCA_SOS_OFFSET);
1278 g = s->prev_task;
1279 if (g) {
1280 if (g->pid)
1281 printk(" %d", g->pid);
1282 else
1283 printk(" %d (cpu %d task 0x%p)", g->pid, task_cpu(g), g);
1284 }
1285 }
1286 printk("\n\n");
1287 if (read_trylock(&tasklist_lock)) {
1288 do_each_thread (g, t) {
1289 printk("\nBacktrace of pid %d (%s)\n", t->pid, t->comm);
1290 show_stack(t, NULL);
1291 } while_each_thread (g, t);
1292 read_unlock(&tasklist_lock);
1293 }
1294 printk("\nINIT dump complete. Monarch on cpu %d returning to normal service.\n", cpu);
1295 atomic_dec(&monarchs);
1296 set_curr_task(cpu, previous_current);
1297 monarch_cpu = -1;
1298 return;
1156} 1299}
1157 1300
1158static int __init 1301static int __init
@@ -1202,6 +1345,34 @@ static struct irqaction mca_cpep_irqaction = {
1202}; 1345};
1203#endif /* CONFIG_ACPI */ 1346#endif /* CONFIG_ACPI */
1204 1347
1348/* Minimal format of the MCA/INIT stacks. The pseudo processes that run on
1349 * these stacks can never sleep, they cannot return from the kernel to user
1350 * space, they do not appear in a normal ps listing. So there is no need to
1351 * format most of the fields.
1352 */
1353
1354static void
1355format_mca_init_stack(void *mca_data, unsigned long offset,
1356 const char *type, int cpu)
1357{
1358 struct task_struct *p = (struct task_struct *)((char *)mca_data + offset);
1359 struct thread_info *ti;
1360 memset(p, 0, KERNEL_STACK_SIZE);
1361 ti = (struct thread_info *)((char *)p + IA64_TASK_SIZE);
1362 ti->flags = _TIF_MCA_INIT;
1363 ti->preempt_count = 1;
1364 ti->task = p;
1365 ti->cpu = cpu;
1366 p->thread_info = ti;
1367 p->state = TASK_UNINTERRUPTIBLE;
1368 __set_bit(cpu, &p->cpus_allowed);
1369 INIT_LIST_HEAD(&p->tasks);
1370 p->parent = p->real_parent = p->group_leader = p;
1371 INIT_LIST_HEAD(&p->children);
1372 INIT_LIST_HEAD(&p->sibling);
1373 strncpy(p->comm, type, sizeof(p->comm)-1);
1374}
1375
1205/* Do per-CPU MCA-related initialization. */ 1376/* Do per-CPU MCA-related initialization. */
1206 1377
1207void __devinit 1378void __devinit
@@ -1214,19 +1385,28 @@ ia64_mca_cpu_init(void *cpu_data)
1214 int cpu; 1385 int cpu;
1215 1386
1216 mca_data = alloc_bootmem(sizeof(struct ia64_mca_cpu) 1387 mca_data = alloc_bootmem(sizeof(struct ia64_mca_cpu)
1217 * NR_CPUS); 1388 * NR_CPUS + KERNEL_STACK_SIZE);
1389 mca_data = (void *)(((unsigned long)mca_data +
1390 KERNEL_STACK_SIZE - 1) &
1391 (-KERNEL_STACK_SIZE));
1218 for (cpu = 0; cpu < NR_CPUS; cpu++) { 1392 for (cpu = 0; cpu < NR_CPUS; cpu++) {
1393 format_mca_init_stack(mca_data,
1394 offsetof(struct ia64_mca_cpu, mca_stack),
1395 "MCA", cpu);
1396 format_mca_init_stack(mca_data,
1397 offsetof(struct ia64_mca_cpu, init_stack),
1398 "INIT", cpu);
1219 __per_cpu_mca[cpu] = __pa(mca_data); 1399 __per_cpu_mca[cpu] = __pa(mca_data);
1220 mca_data += sizeof(struct ia64_mca_cpu); 1400 mca_data += sizeof(struct ia64_mca_cpu);
1221 } 1401 }
1222 } 1402 }
1223 1403
1224 /* 1404 /*
1225 * The MCA info structure was allocated earlier and its 1405 * The MCA info structure was allocated earlier and its
1226 * physical address saved in __per_cpu_mca[cpu]. Copy that 1406 * physical address saved in __per_cpu_mca[cpu]. Copy that
1227 * address * to ia64_mca_data so we can access it as a per-CPU 1407 * address * to ia64_mca_data so we can access it as a per-CPU
1228 * variable. 1408 * variable.
1229 */ 1409 */
1230 __get_cpu_var(ia64_mca_data) = __per_cpu_mca[smp_processor_id()]; 1410 __get_cpu_var(ia64_mca_data) = __per_cpu_mca[smp_processor_id()];
1231 1411
1232 /* 1412 /*
@@ -1236,11 +1416,11 @@ ia64_mca_cpu_init(void *cpu_data)
1236 __get_cpu_var(ia64_mca_per_cpu_pte) = 1416 __get_cpu_var(ia64_mca_per_cpu_pte) =
1237 pte_val(mk_pte_phys(__pa(cpu_data), PAGE_KERNEL)); 1417 pte_val(mk_pte_phys(__pa(cpu_data), PAGE_KERNEL));
1238 1418
1239 /* 1419 /*
1240 * Also, stash away a copy of the PAL address and the PTE 1420 * Also, stash away a copy of the PAL address and the PTE
1241 * needed to map it. 1421 * needed to map it.
1242 */ 1422 */
1243 pal_vaddr = efi_get_pal_addr(); 1423 pal_vaddr = efi_get_pal_addr();
1244 if (!pal_vaddr) 1424 if (!pal_vaddr)
1245 return; 1425 return;
1246 __get_cpu_var(ia64_mca_pal_base) = 1426 __get_cpu_var(ia64_mca_pal_base) =
@@ -1272,8 +1452,8 @@ ia64_mca_cpu_init(void *cpu_data)
1272void __init 1452void __init
1273ia64_mca_init(void) 1453ia64_mca_init(void)
1274{ 1454{
1275 ia64_fptr_t *mon_init_ptr = (ia64_fptr_t *)ia64_monarch_init_handler; 1455 ia64_fptr_t *init_hldlr_ptr_monarch = (ia64_fptr_t *)ia64_os_init_dispatch_monarch;
1276 ia64_fptr_t *slave_init_ptr = (ia64_fptr_t *)ia64_slave_init_handler; 1456 ia64_fptr_t *init_hldlr_ptr_slave = (ia64_fptr_t *)ia64_os_init_dispatch_slave;
1277 ia64_fptr_t *mca_hldlr_ptr = (ia64_fptr_t *)ia64_os_mca_dispatch; 1457 ia64_fptr_t *mca_hldlr_ptr = (ia64_fptr_t *)ia64_os_mca_dispatch;
1278 int i; 1458 int i;
1279 s64 rc; 1459 s64 rc;
@@ -1351,9 +1531,9 @@ ia64_mca_init(void)
1351 * XXX - disable SAL checksum by setting size to 0, should be 1531 * XXX - disable SAL checksum by setting size to 0, should be
1352 * size of the actual init handler in mca_asm.S. 1532 * size of the actual init handler in mca_asm.S.
1353 */ 1533 */
1354 ia64_mc_info.imi_monarch_init_handler = ia64_tpa(mon_init_ptr->fp); 1534 ia64_mc_info.imi_monarch_init_handler = ia64_tpa(init_hldlr_ptr_monarch->fp);
1355 ia64_mc_info.imi_monarch_init_handler_size = 0; 1535 ia64_mc_info.imi_monarch_init_handler_size = 0;
1356 ia64_mc_info.imi_slave_init_handler = ia64_tpa(slave_init_ptr->fp); 1536 ia64_mc_info.imi_slave_init_handler = ia64_tpa(init_hldlr_ptr_slave->fp);
1357 ia64_mc_info.imi_slave_init_handler_size = 0; 1537 ia64_mc_info.imi_slave_init_handler_size = 0;
1358 1538
1359 IA64_MCA_DEBUG("%s: OS INIT handler at %lx\n", __FUNCTION__, 1539 IA64_MCA_DEBUG("%s: OS INIT handler at %lx\n", __FUNCTION__,
diff --git a/arch/ia64/kernel/mca_asm.S b/arch/ia64/kernel/mca_asm.S
index ef3fd7265b67..499a065f4e60 100644
--- a/arch/ia64/kernel/mca_asm.S
+++ b/arch/ia64/kernel/mca_asm.S
@@ -16,6 +16,9 @@
16// 04/11/12 Russ Anderson <rja@sgi.com> 16// 04/11/12 Russ Anderson <rja@sgi.com>
17// Added per cpu MCA/INIT stack save areas. 17// Added per cpu MCA/INIT stack save areas.
18// 18//
19// 12/08/05 Keith Owens <kaos@sgi.com>
20// Use per cpu MCA/INIT stacks for all data.
21//
19#include <linux/config.h> 22#include <linux/config.h>
20#include <linux/threads.h> 23#include <linux/threads.h>
21 24
@@ -25,96 +28,23 @@
25#include <asm/mca_asm.h> 28#include <asm/mca_asm.h>
26#include <asm/mca.h> 29#include <asm/mca.h>
27 30
28/* 31#include "entry.h"
29 * When we get a machine check, the kernel stack pointer is no longer
30 * valid, so we need to set a new stack pointer.
31 */
32#define MINSTATE_PHYS /* Make sure stack access is physical for MINSTATE */
33
34/*
35 * Needed for return context to SAL
36 */
37#define IA64_MCA_SAME_CONTEXT 0
38#define IA64_MCA_COLD_BOOT -2
39
40#include "minstate.h"
41
42/*
43 * SAL_TO_OS_MCA_HANDOFF_STATE (SAL 3.0 spec)
44 * 1. GR1 = OS GP
45 * 2. GR8 = PAL_PROC physical address
46 * 3. GR9 = SAL_PROC physical address
47 * 4. GR10 = SAL GP (physical)
48 * 5. GR11 = Rendez state
49 * 6. GR12 = Return address to location within SAL_CHECK
50 */
51#define SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(_tmp) \
52 LOAD_PHYSICAL(p0, _tmp, ia64_sal_to_os_handoff_state);; \
53 st8 [_tmp]=r1,0x08;; \
54 st8 [_tmp]=r8,0x08;; \
55 st8 [_tmp]=r9,0x08;; \
56 st8 [_tmp]=r10,0x08;; \
57 st8 [_tmp]=r11,0x08;; \
58 st8 [_tmp]=r12,0x08;; \
59 st8 [_tmp]=r17,0x08;; \
60 st8 [_tmp]=r18,0x08
61
62/*
63 * OS_MCA_TO_SAL_HANDOFF_STATE (SAL 3.0 spec)
64 * (p6) is executed if we never entered virtual mode (TLB error)
65 * (p7) is executed if we entered virtual mode as expected (normal case)
66 * 1. GR8 = OS_MCA return status
67 * 2. GR9 = SAL GP (physical)
68 * 3. GR10 = 0/1 returning same/new context
69 * 4. GR22 = New min state save area pointer
70 * returns ptr to SAL rtn save loc in _tmp
71 */
72#define OS_MCA_TO_SAL_HANDOFF_STATE_RESTORE(_tmp) \
73 movl _tmp=ia64_os_to_sal_handoff_state;; \
74 DATA_VA_TO_PA(_tmp);; \
75 ld8 r8=[_tmp],0x08;; \
76 ld8 r9=[_tmp],0x08;; \
77 ld8 r10=[_tmp],0x08;; \
78 ld8 r22=[_tmp],0x08;;
79 // now _tmp is pointing to SAL rtn save location
80
81/*
82 * COLD_BOOT_HANDOFF_STATE() sets ia64_mca_os_to_sal_state
83 * imots_os_status=IA64_MCA_COLD_BOOT
84 * imots_sal_gp=SAL GP
85 * imots_context=IA64_MCA_SAME_CONTEXT
86 * imots_new_min_state=Min state save area pointer
87 * imots_sal_check_ra=Return address to location within SAL_CHECK
88 *
89 */
90#define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\
91 movl tmp=IA64_MCA_COLD_BOOT; \
92 movl sal_to_os_handoff=__pa(ia64_sal_to_os_handoff_state); \
93 movl os_to_sal_handoff=__pa(ia64_os_to_sal_handoff_state);; \
94 st8 [os_to_sal_handoff]=tmp,8;; \
95 ld8 tmp=[sal_to_os_handoff],48;; \
96 st8 [os_to_sal_handoff]=tmp,8;; \
97 movl tmp=IA64_MCA_SAME_CONTEXT;; \
98 st8 [os_to_sal_handoff]=tmp,8;; \
99 ld8 tmp=[sal_to_os_handoff],-8;; \
100 st8 [os_to_sal_handoff]=tmp,8;; \
101 ld8 tmp=[sal_to_os_handoff];; \
102 st8 [os_to_sal_handoff]=tmp;;
103 32
104#define GET_IA64_MCA_DATA(reg) \ 33#define GET_IA64_MCA_DATA(reg) \
105 GET_THIS_PADDR(reg, ia64_mca_data) \ 34 GET_THIS_PADDR(reg, ia64_mca_data) \
106 ;; \ 35 ;; \
107 ld8 reg=[reg] 36 ld8 reg=[reg]
108 37
109 .global ia64_os_mca_dispatch
110 .global ia64_os_mca_dispatch_end
111 .global ia64_sal_to_os_handoff_state
112 .global ia64_os_to_sal_handoff_state
113 .global ia64_do_tlb_purge 38 .global ia64_do_tlb_purge
39 .global ia64_os_mca_dispatch
40 .global ia64_os_init_dispatch_monarch
41 .global ia64_os_init_dispatch_slave
114 42
115 .text 43 .text
116 .align 16 44 .align 16
117 45
46//StartMain////////////////////////////////////////////////////////////////////
47
118/* 48/*
119 * Just the TLB purge part is moved to a separate function 49 * Just the TLB purge part is moved to a separate function
120 * so we can re-use the code for cpu hotplug code as well 50 * so we can re-use the code for cpu hotplug code as well
@@ -207,34 +137,31 @@ ia64_do_tlb_purge:
207 br.sptk.many b1 137 br.sptk.many b1
208 ;; 138 ;;
209 139
210ia64_os_mca_dispatch: 140//EndMain//////////////////////////////////////////////////////////////////////
141
142//StartMain////////////////////////////////////////////////////////////////////
211 143
144ia64_os_mca_dispatch:
212 // Serialize all MCA processing 145 // Serialize all MCA processing
213 mov r3=1;; 146 mov r3=1;;
214 LOAD_PHYSICAL(p0,r2,ia64_mca_serialize);; 147 LOAD_PHYSICAL(p0,r2,ia64_mca_serialize);;
215ia64_os_mca_spin: 148ia64_os_mca_spin:
216 xchg8 r4=[r2],r3;; 149 xchg4 r4=[r2],r3;;
217 cmp.ne p6,p0=r4,r0 150 cmp.ne p6,p0=r4,r0
218(p6) br ia64_os_mca_spin 151(p6) br ia64_os_mca_spin
219 152
220 // Save the SAL to OS MCA handoff state as defined 153 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET // use the MCA stack
221 // by SAL SPEC 3.0 154 LOAD_PHYSICAL(p0,r2,1f) // return address
222 // NOTE : The order in which the state gets saved 155 mov r19=1 // All MCA events are treated as monarch (for now)
223 // is dependent on the way the C-structure 156 br.sptk ia64_state_save // save the state that is not in minstate
224 // for ia64_mca_sal_to_os_state_t has been 1571:
225 // defined in include/asm/mca.h
226 SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(r2)
227 ;;
228
229 // LOG PROCESSOR STATE INFO FROM HERE ON..
230begin_os_mca_dump:
231 br ia64_os_mca_proc_state_dump;;
232 158
233ia64_os_mca_done_dump: 159 GET_IA64_MCA_DATA(r2)
234 160 // Using MCA stack, struct ia64_sal_os_state, variable proc_state_param
235 LOAD_PHYSICAL(p0,r16,ia64_sal_to_os_handoff_state+56) 161 ;;
162 add r3=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_SOS_OFFSET+IA64_SAL_OS_STATE_PROC_STATE_PARAM_OFFSET, r2
236 ;; 163 ;;
237 ld8 r18=[r16] // Get processor state parameter on existing PALE_CHECK. 164 ld8 r18=[r3] // Get processor state parameter on existing PALE_CHECK.
238 ;; 165 ;;
239 tbit.nz p6,p7=r18,60 166 tbit.nz p6,p7=r18,60
240(p7) br.spnt done_tlb_purge_and_reload 167(p7) br.spnt done_tlb_purge_and_reload
@@ -323,624 +250,775 @@ ia64_reload_tr:
323 itr.d dtr[r20]=r16 250 itr.d dtr[r20]=r16
324 ;; 251 ;;
325 srlz.d 252 srlz.d
326 ;;
327 br.sptk.many done_tlb_purge_and_reload
328err:
329 COLD_BOOT_HANDOFF_STATE(r20,r21,r22)
330 br.sptk.many ia64_os_mca_done_restore
331 253
332done_tlb_purge_and_reload: 254done_tlb_purge_and_reload:
333 255
334 // Setup new stack frame for OS_MCA handling 256 // switch to per cpu MCA stack
335 GET_IA64_MCA_DATA(r2) 257 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET // use the MCA stack
336 ;; 258 LOAD_PHYSICAL(p0,r2,1f) // return address
337 add r3 = IA64_MCA_CPU_STACKFRAME_OFFSET, r2 259 br.sptk ia64_new_stack
338 add r2 = IA64_MCA_CPU_RBSTORE_OFFSET, r2 2601:
339 ;; 261
340 rse_switch_context(r6,r3,r2);; // RSC management in this new context 262 // everything saved, now we can set the kernel registers
263 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET // use the MCA stack
264 LOAD_PHYSICAL(p0,r2,1f) // return address
265 br.sptk ia64_set_kernel_registers
2661:
341 267
268 // This must be done in physical mode
342 GET_IA64_MCA_DATA(r2) 269 GET_IA64_MCA_DATA(r2)
343 ;; 270 ;;
344 add r2 = IA64_MCA_CPU_STACK_OFFSET+IA64_MCA_STACK_SIZE-16, r2 271 mov r7=r2
345 ;;
346 mov r12=r2 // establish new stack-pointer
347 272
348 // Enter virtual mode from physical mode 273 // Enter virtual mode from physical mode
349 VIRTUAL_MODE_ENTER(r2, r3, ia64_os_mca_virtual_begin, r4) 274 VIRTUAL_MODE_ENTER(r2, r3, ia64_os_mca_virtual_begin, r4)
350ia64_os_mca_virtual_begin: 275
276 // This code returns to SAL via SOS r2, in general SAL has no unwind
277 // data. To get a clean termination when backtracing the C MCA/INIT
278 // handler, set a dummy return address of 0 in this routine. That
279 // requires that ia64_os_mca_virtual_begin be a global function.
280ENTRY(ia64_os_mca_virtual_begin)
281 .prologue
282 .save rp,r0
283 .body
284
285 mov ar.rsc=3 // set eager mode for C handler
286 mov r2=r7 // see GET_IA64_MCA_DATA above
287 ;;
351 288
352 // Call virtual mode handler 289 // Call virtual mode handler
353 movl r2=ia64_mca_ucmc_handler;; 290 alloc r14=ar.pfs,0,0,3,0
354 mov b6=r2;; 291 ;;
355 br.call.sptk.many b0=b6;; 292 DATA_PA_TO_VA(r2,r7)
356.ret0: 293 ;;
294 add out0=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_PT_REGS_OFFSET, r2
295 add out1=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_SWITCH_STACK_OFFSET, r2
296 add out2=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_SOS_OFFSET, r2
297 br.call.sptk.many b0=ia64_mca_handler
298
357 // Revert back to physical mode before going back to SAL 299 // Revert back to physical mode before going back to SAL
358 PHYSICAL_MODE_ENTER(r2, r3, ia64_os_mca_virtual_end, r4) 300 PHYSICAL_MODE_ENTER(r2, r3, ia64_os_mca_virtual_end, r4)
359ia64_os_mca_virtual_end: 301ia64_os_mca_virtual_end:
360 302
361 // restore the original stack frame here 303END(ia64_os_mca_virtual_begin)
304
305 // switch back to previous stack
306 alloc r14=ar.pfs,0,0,0,0 // remove the MCA handler frame
307 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET // use the MCA stack
308 LOAD_PHYSICAL(p0,r2,1f) // return address
309 br.sptk ia64_old_stack
3101:
311
312 mov r3=IA64_MCA_CPU_MCA_STACK_OFFSET // use the MCA stack
313 LOAD_PHYSICAL(p0,r2,1f) // return address
314 br.sptk ia64_state_restore // restore the SAL state
3151:
316
317 mov b0=r12 // SAL_CHECK return address
318
319 // release lock
320 LOAD_PHYSICAL(p0,r3,ia64_mca_serialize);;
321 st4.rel [r3]=r0
322
323 br b0
324
325//EndMain//////////////////////////////////////////////////////////////////////
326
327//StartMain////////////////////////////////////////////////////////////////////
328
329//
330// SAL to OS entry point for INIT on all processors. This has been defined for
331// registration purposes with SAL as a part of ia64_mca_init. Monarch and
332// slave INIT have identical processing, except for the value of the
333// sos->monarch flag in r19.
334//
335
336ia64_os_init_dispatch_monarch:
337 mov r19=1 // Bow, bow, ye lower middle classes!
338 br.sptk ia64_os_init_dispatch
339
340ia64_os_init_dispatch_slave:
341 mov r19=0 // <igor>yeth, mathter</igor>
342
343ia64_os_init_dispatch:
344
345 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET // use the INIT stack
346 LOAD_PHYSICAL(p0,r2,1f) // return address
347 br.sptk ia64_state_save // save the state that is not in minstate
3481:
349
350 // switch to per cpu INIT stack
351 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET // use the INIT stack
352 LOAD_PHYSICAL(p0,r2,1f) // return address
353 br.sptk ia64_new_stack
3541:
355
356 // everything saved, now we can set the kernel registers
357 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET // use the INIT stack
358 LOAD_PHYSICAL(p0,r2,1f) // return address
359 br.sptk ia64_set_kernel_registers
3601:
361
362 // This must be done in physical mode
362 GET_IA64_MCA_DATA(r2) 363 GET_IA64_MCA_DATA(r2)
363 ;; 364 ;;
364 add r2 = IA64_MCA_CPU_STACKFRAME_OFFSET, r2 365 mov r7=r2
365 ;; 366
366 movl r4=IA64_PSR_MC 367 // Enter virtual mode from physical mode
368 VIRTUAL_MODE_ENTER(r2, r3, ia64_os_init_virtual_begin, r4)
369
370 // This code returns to SAL via SOS r2, in general SAL has no unwind
371 // data. To get a clean termination when backtracing the C MCA/INIT
372 // handler, set a dummy return address of 0 in this routine. That
373 // requires that ia64_os_init_virtual_begin be a global function.
374ENTRY(ia64_os_init_virtual_begin)
375 .prologue
376 .save rp,r0
377 .body
378
379 mov ar.rsc=3 // set eager mode for C handler
380 mov r2=r7 // see GET_IA64_MCA_DATA above
367 ;; 381 ;;
368 rse_return_context(r4,r3,r2) // switch from interrupt context for RSE
369 382
370 // let us restore all the registers from our PSI structure 383 // Call virtual mode handler
371 mov r8=gp 384 alloc r14=ar.pfs,0,0,3,0
385 ;;
386 DATA_PA_TO_VA(r2,r7)
372 ;; 387 ;;
373begin_os_mca_restore: 388 add out0=IA64_MCA_CPU_INIT_STACK_OFFSET+MCA_PT_REGS_OFFSET, r2
374 br ia64_os_mca_proc_state_restore;; 389 add out1=IA64_MCA_CPU_INIT_STACK_OFFSET+MCA_SWITCH_STACK_OFFSET, r2
390 add out2=IA64_MCA_CPU_INIT_STACK_OFFSET+MCA_SOS_OFFSET, r2
391 br.call.sptk.many b0=ia64_init_handler
375 392
376ia64_os_mca_done_restore: 393 // Revert back to physical mode before going back to SAL
377 OS_MCA_TO_SAL_HANDOFF_STATE_RESTORE(r2);; 394 PHYSICAL_MODE_ENTER(r2, r3, ia64_os_init_virtual_end, r4)
378 // branch back to SALE_CHECK 395ia64_os_init_virtual_end:
379 ld8 r3=[r2];;
380 mov b0=r3;; // SAL_CHECK return address
381 396
382 // release lock 397END(ia64_os_init_virtual_begin)
383 movl r3=ia64_mca_serialize;; 398
384 DATA_VA_TO_PA(r3);; 399 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET // use the INIT stack
385 st8.rel [r3]=r0 400 LOAD_PHYSICAL(p0,r2,1f) // return address
401 br.sptk ia64_state_restore // restore the SAL state
4021:
386 403
404 // switch back to previous stack
405 alloc r14=ar.pfs,0,0,0,0 // remove the INIT handler frame
406 mov r3=IA64_MCA_CPU_INIT_STACK_OFFSET // use the INIT stack
407 LOAD_PHYSICAL(p0,r2,1f) // return address
408 br.sptk ia64_old_stack
4091:
410
411 mov b0=r12 // SAL_CHECK return address
387 br b0 412 br b0
388 ;; 413
389ia64_os_mca_dispatch_end:
390//EndMain////////////////////////////////////////////////////////////////////// 414//EndMain//////////////////////////////////////////////////////////////////////
391 415
416// common defines for the stubs
417#define ms r4
418#define regs r5
419#define temp1 r2 /* careful, it overlaps with input registers */
420#define temp2 r3 /* careful, it overlaps with input registers */
421#define temp3 r7
422#define temp4 r14
423
392 424
393//++ 425//++
394// Name: 426// Name:
395// ia64_os_mca_proc_state_dump() 427// ia64_state_save()
396// 428//
397// Stub Description: 429// Stub Description:
398// 430//
399// This stub dumps the processor state during MCHK to a data area 431// Save the state that is not in minstate. This is sensitive to the layout of
432// struct ia64_sal_os_state in mca.h.
433//
434// r2 contains the return address, r3 contains either
435// IA64_MCA_CPU_MCA_STACK_OFFSET or IA64_MCA_CPU_INIT_STACK_OFFSET.
436//
437// The OS to SAL section of struct ia64_sal_os_state is set to a default
438// value of cold boot (MCA) or warm boot (INIT) and return to the same
439// context. ia64_sal_os_state is also used to hold some registers that
440// need to be saved and restored across the stack switches.
441//
442// Most input registers to this stub come from PAL/SAL
443// r1 os gp, physical
444// r8 pal_proc entry point
445// r9 sal_proc entry point
446// r10 sal gp
447// r11 MCA - rendevzous state, INIT - reason code
448// r12 sal return address
449// r17 pal min_state
450// r18 processor state parameter
451// r19 monarch flag, set by the caller of this routine
452//
453// In addition to the SAL to OS state, this routine saves all the
454// registers that appear in struct pt_regs and struct switch_stack,
455// excluding those that are already in the PAL minstate area. This
456// results in a partial pt_regs and switch_stack, the C code copies the
457// remaining registers from PAL minstate to pt_regs and switch_stack. The
458// resulting structures contain all the state of the original process when
459// MCA/INIT occurred.
400// 460//
401//-- 461//--
402 462
403ia64_os_mca_proc_state_dump: 463ia64_state_save:
404// Save bank 1 GRs 16-31 which will be used by c-language code when we switch 464 add regs=MCA_SOS_OFFSET, r3
405// to virtual addressing mode. 465 add ms=MCA_SOS_OFFSET+8, r3
406 GET_IA64_MCA_DATA(r2) 466 mov b0=r2 // save return address
467 cmp.eq p1,p2=IA64_MCA_CPU_MCA_STACK_OFFSET, r3
468 ;;
469 GET_IA64_MCA_DATA(temp2)
470 ;;
471 add temp1=temp2, regs // struct ia64_sal_os_state on MCA or INIT stack
472 add temp2=temp2, ms // struct ia64_sal_os_state+8 on MCA or INIT stack
473 ;;
474 mov regs=temp1 // save the start of sos
475 st8 [temp1]=r1,16 // os_gp
476 st8 [temp2]=r8,16 // pal_proc
477 ;;
478 st8 [temp1]=r9,16 // sal_proc
479 st8 [temp2]=r11,16 // rv_rc
480 mov r11=cr.iipa
481 ;;
482 st8 [temp1]=r18,16 // proc_state_param
483 st8 [temp2]=r19,16 // monarch
484 mov r6=IA64_KR(CURRENT)
485 ;;
486 st8 [temp1]=r12,16 // sal_ra
487 st8 [temp2]=r10,16 // sal_gp
488 mov r12=cr.isr
489 ;;
490 st8 [temp1]=r17,16 // pal_min_state
491 st8 [temp2]=r6,16 // prev_IA64_KR_CURRENT
492 mov r6=cr.ifa
493 ;;
494 st8 [temp1]=r0,16 // prev_task, starts off as NULL
495 st8 [temp2]=r12,16 // cr.isr
496 mov r12=cr.itir
497 ;;
498 st8 [temp1]=r6,16 // cr.ifa
499 st8 [temp2]=r12,16 // cr.itir
500 mov r12=cr.iim
501 ;;
502 st8 [temp1]=r11,16 // cr.iipa
503 st8 [temp2]=r12,16 // cr.iim
504 mov r6=cr.iha
505(p1) mov r12=IA64_MCA_COLD_BOOT
506(p2) mov r12=IA64_INIT_WARM_BOOT
507 ;;
508 st8 [temp1]=r6,16 // cr.iha
509 st8 [temp2]=r12 // os_status, default is cold boot
510 mov r6=IA64_MCA_SAME_CONTEXT
511 ;;
512 st8 [temp1]=r6 // context, default is same context
513
514 // Save the pt_regs data that is not in minstate. The previous code
515 // left regs at sos.
516 add regs=MCA_PT_REGS_OFFSET-MCA_SOS_OFFSET, regs
517 ;;
518 add temp1=PT(B6), regs
519 mov temp3=b6
520 mov temp4=b7
521 add temp2=PT(B7), regs
522 ;;
523 st8 [temp1]=temp3,PT(AR_CSD)-PT(B6) // save b6
524 st8 [temp2]=temp4,PT(AR_SSD)-PT(B7) // save b7
525 mov temp3=ar.csd
526 mov temp4=ar.ssd
527 cover // must be last in group
407 ;; 528 ;;
408 add r2 = IA64_MCA_CPU_PROC_STATE_DUMP_OFFSET, r2 529 st8 [temp1]=temp3,PT(AR_UNAT)-PT(AR_CSD) // save ar.csd
409 ;; 530 st8 [temp2]=temp4,PT(AR_PFS)-PT(AR_SSD) // save ar.ssd
410// save ar.NaT 531 mov temp3=ar.unat
411 mov r5=ar.unat // ar.unat 532 mov temp4=ar.pfs
412 533 ;;
413// save banked GRs 16-31 along with NaT bits 534 st8 [temp1]=temp3,PT(AR_RNAT)-PT(AR_UNAT) // save ar.unat
414 bsw.1;; 535 st8 [temp2]=temp4,PT(AR_BSPSTORE)-PT(AR_PFS) // save ar.pfs
415 st8.spill [r2]=r16,8;; 536 mov temp3=ar.rnat
416 st8.spill [r2]=r17,8;; 537 mov temp4=ar.bspstore
417 st8.spill [r2]=r18,8;; 538 ;;
418 st8.spill [r2]=r19,8;; 539 st8 [temp1]=temp3,PT(LOADRS)-PT(AR_RNAT) // save ar.rnat
419 st8.spill [r2]=r20,8;; 540 st8 [temp2]=temp4,PT(AR_FPSR)-PT(AR_BSPSTORE) // save ar.bspstore
420 st8.spill [r2]=r21,8;; 541 mov temp3=ar.bsp
421 st8.spill [r2]=r22,8;; 542 ;;
422 st8.spill [r2]=r23,8;; 543 sub temp3=temp3, temp4 // ar.bsp - ar.bspstore
423 st8.spill [r2]=r24,8;; 544 mov temp4=ar.fpsr
424 st8.spill [r2]=r25,8;; 545 ;;
425 st8.spill [r2]=r26,8;; 546 shl temp3=temp3,16 // compute ar.rsc to be used for "loadrs"
426 st8.spill [r2]=r27,8;; 547 ;;
427 st8.spill [r2]=r28,8;; 548 st8 [temp1]=temp3,PT(AR_CCV)-PT(LOADRS) // save loadrs
428 st8.spill [r2]=r29,8;; 549 st8 [temp2]=temp4,PT(F6)-PT(AR_FPSR) // save ar.fpsr
429 st8.spill [r2]=r30,8;; 550 mov temp3=ar.ccv
430 st8.spill [r2]=r31,8;; 551 ;;
431 552 st8 [temp1]=temp3,PT(F7)-PT(AR_CCV) // save ar.ccv
432 mov r4=ar.unat;; 553 stf.spill [temp2]=f6,PT(F8)-PT(F6)
433 st8 [r2]=r4,8 // save User NaT bits for r16-r31 554 ;;
434 mov ar.unat=r5 // restore original unat 555 stf.spill [temp1]=f7,PT(F9)-PT(F7)
435 bsw.0;; 556 stf.spill [temp2]=f8,PT(F10)-PT(F8)
436 557 ;;
437//save BRs 558 stf.spill [temp1]=f9,PT(F11)-PT(F9)
438 add r4=8,r2 // duplicate r2 in r4 559 stf.spill [temp2]=f10
439 add r6=2*8,r2 // duplicate r2 in r4 560 ;;
440 561 stf.spill [temp1]=f11
441 mov r3=b0 562
442 mov r5=b1 563 // Save the switch_stack data that is not in minstate nor pt_regs. The
443 mov r7=b2;; 564 // previous code left regs at pt_regs.
444 st8 [r2]=r3,3*8 565 add regs=MCA_SWITCH_STACK_OFFSET-MCA_PT_REGS_OFFSET, regs
445 st8 [r4]=r5,3*8 566 ;;
446 st8 [r6]=r7,3*8;; 567 add temp1=SW(F2), regs
447 568 add temp2=SW(F3), regs
448 mov r3=b3 569 ;;
449 mov r5=b4 570 stf.spill [temp1]=f2,32
450 mov r7=b5;; 571 stf.spill [temp2]=f3,32
451 st8 [r2]=r3,3*8 572 ;;
452 st8 [r4]=r5,3*8 573 stf.spill [temp1]=f4,32
453 st8 [r6]=r7,3*8;; 574 stf.spill [temp2]=f5,32
454 575 ;;
455 mov r3=b6 576 stf.spill [temp1]=f12,32
456 mov r5=b7;; 577 stf.spill [temp2]=f13,32
457 st8 [r2]=r3,2*8 578 ;;
458 st8 [r4]=r5,2*8;; 579 stf.spill [temp1]=f14,32
459 580 stf.spill [temp2]=f15,32
460cSaveCRs: 581 ;;
461// save CRs 582 stf.spill [temp1]=f16,32
462 add r4=8,r2 // duplicate r2 in r4 583 stf.spill [temp2]=f17,32
463 add r6=2*8,r2 // duplicate r2 in r4 584 ;;
464 585 stf.spill [temp1]=f18,32
465 mov r3=cr.dcr 586 stf.spill [temp2]=f19,32
466 mov r5=cr.itm 587 ;;
467 mov r7=cr.iva;; 588 stf.spill [temp1]=f20,32
468 589 stf.spill [temp2]=f21,32
469 st8 [r2]=r3,8*8 590 ;;
470 st8 [r4]=r5,3*8 591 stf.spill [temp1]=f22,32
471 st8 [r6]=r7,3*8;; // 48 byte rements 592 stf.spill [temp2]=f23,32
472 593 ;;
473 mov r3=cr.pta;; 594 stf.spill [temp1]=f24,32
474 st8 [r2]=r3,8*8;; // 64 byte rements 595 stf.spill [temp2]=f25,32
475 596 ;;
476// if PSR.ic=0, reading interruption registers causes an illegal operation fault 597 stf.spill [temp1]=f26,32
477 mov r3=psr;; 598 stf.spill [temp2]=f27,32
478 tbit.nz.unc p6,p0=r3,PSR_IC;; // PSI Valid Log bit pos. test 599 ;;
479(p6) st8 [r2]=r0,9*8+160 // increment by 232 byte inc. 600 stf.spill [temp1]=f28,32
480begin_skip_intr_regs: 601 stf.spill [temp2]=f29,32
481(p6) br SkipIntrRegs;; 602 ;;
482 603 stf.spill [temp1]=f30,SW(B2)-SW(F30)
483 add r4=8,r2 // duplicate r2 in r4 604 stf.spill [temp2]=f31,SW(B3)-SW(F31)
484 add r6=2*8,r2 // duplicate r2 in r6 605 mov temp3=b2
485 606 mov temp4=b3
486 mov r3=cr.ipsr 607 ;;
487 mov r5=cr.isr 608 st8 [temp1]=temp3,16 // save b2
488 mov r7=r0;; 609 st8 [temp2]=temp4,16 // save b3
489 st8 [r2]=r3,3*8 610 mov temp3=b4
490 st8 [r4]=r5,3*8 611 mov temp4=b5
491 st8 [r6]=r7,3*8;; 612 ;;
492 613 st8 [temp1]=temp3,SW(AR_LC)-SW(B4) // save b4
493 mov r3=cr.iip 614 st8 [temp2]=temp4 // save b5
494 mov r5=cr.ifa 615 mov temp3=ar.lc
495 mov r7=cr.itir;; 616 ;;
496 st8 [r2]=r3,3*8 617 st8 [temp1]=temp3 // save ar.lc
497 st8 [r4]=r5,3*8 618
498 st8 [r6]=r7,3*8;; 619 // FIXME: Some proms are incorrectly accessing the minstate area as
499 620 // cached data. The C code uses region 6, uncached virtual. Ensure
500 mov r3=cr.iipa 621 // that there is no cache data lying around for the first 1K of the
501 mov r5=cr.ifs 622 // minstate area.
502 mov r7=cr.iim;; 623 // Remove this code in September 2006, that gives platforms a year to
503 st8 [r2]=r3,3*8 624 // fix their proms and get their customers updated.
504 st8 [r4]=r5,3*8 625
505 st8 [r6]=r7,3*8;; 626 add r1=32*1,r17
506 627 add r2=32*2,r17
507 mov r3=cr25;; // cr.iha 628 add r3=32*3,r17
508 st8 [r2]=r3,160;; // 160 byte rement 629 add r4=32*4,r17
509 630 add r5=32*5,r17
510SkipIntrRegs: 631 add r6=32*6,r17
511 st8 [r2]=r0,152;; // another 152 byte . 632 add r7=32*7,r17
512 633 ;;
513 add r4=8,r2 // duplicate r2 in r4 634 fc r17
514 add r6=2*8,r2 // duplicate r2 in r6 635 fc r1
515 636 fc r2
516 mov r3=cr.lid 637 fc r3
517// mov r5=cr.ivr // cr.ivr, don't read it 638 fc r4
518 mov r7=cr.tpr;; 639 fc r5
519 st8 [r2]=r3,3*8 640 fc r6
520 st8 [r4]=r5,3*8 641 fc r7
521 st8 [r6]=r7,3*8;; 642 add r17=32*8,r17
522 643 add r1=32*8,r1
523 mov r3=r0 // cr.eoi => cr67 644 add r2=32*8,r2
524 mov r5=r0 // cr.irr0 => cr68 645 add r3=32*8,r3
525 mov r7=r0;; // cr.irr1 => cr69 646 add r4=32*8,r4
526 st8 [r2]=r3,3*8 647 add r5=32*8,r5
527 st8 [r4]=r5,3*8 648 add r6=32*8,r6
528 st8 [r6]=r7,3*8;; 649 add r7=32*8,r7
529 650 ;;
530 mov r3=r0 // cr.irr2 => cr70 651 fc r17
531 mov r5=r0 // cr.irr3 => cr71 652 fc r1
532 mov r7=cr.itv;; 653 fc r2
533 st8 [r2]=r3,3*8 654 fc r3
534 st8 [r4]=r5,3*8 655 fc r4
535 st8 [r6]=r7,3*8;; 656 fc r5
536 657 fc r6
537 mov r3=cr.pmv 658 fc r7
538 mov r5=cr.cmcv;; 659 add r17=32*8,r17
539 st8 [r2]=r3,7*8 660 add r1=32*8,r1
540 st8 [r4]=r5,7*8;; 661 add r2=32*8,r2
541 662 add r3=32*8,r3
542 mov r3=r0 // cr.lrr0 => cr80 663 add r4=32*8,r4
543 mov r5=r0;; // cr.lrr1 => cr81 664 add r5=32*8,r5
544 st8 [r2]=r3,23*8 665 add r6=32*8,r6
545 st8 [r4]=r5,23*8;; 666 add r7=32*8,r7
546 667 ;;
547 adds r2=25*8,r2;; 668 fc r17
548 669 fc r1
549cSaveARs: 670 fc r2
550// save ARs 671 fc r3
551 add r4=8,r2 // duplicate r2 in r4 672 fc r4
552 add r6=2*8,r2 // duplicate r2 in r6 673 fc r5
553 674 fc r6
554 mov r3=ar.k0 675 fc r7
555 mov r5=ar.k1 676 add r17=32*8,r17
556 mov r7=ar.k2;; 677 add r1=32*8,r1
557 st8 [r2]=r3,3*8 678 add r2=32*8,r2
558 st8 [r4]=r5,3*8 679 add r3=32*8,r3
559 st8 [r6]=r7,3*8;; 680 add r4=32*8,r4
560 681 add r5=32*8,r5
561 mov r3=ar.k3 682 add r6=32*8,r6
562 mov r5=ar.k4 683 add r7=32*8,r7
563 mov r7=ar.k5;; 684 ;;
564 st8 [r2]=r3,3*8 685 fc r17
565 st8 [r4]=r5,3*8 686 fc r1
566 st8 [r6]=r7,3*8;; 687 fc r2
567 688 fc r3
568 mov r3=ar.k6 689 fc r4
569 mov r5=ar.k7 690 fc r5
570 mov r7=r0;; // ar.kr8 691 fc r6
571 st8 [r2]=r3,10*8 692 fc r7
572 st8 [r4]=r5,10*8 693
573 st8 [r6]=r7,10*8;; // rement by 72 bytes 694 br.sptk b0
574
575 mov r3=ar.rsc
576 mov ar.rsc=r0 // put RSE in enforced lazy mode
577 mov r5=ar.bsp
578 ;;
579 mov r7=ar.bspstore;;
580 st8 [r2]=r3,3*8
581 st8 [r4]=r5,3*8
582 st8 [r6]=r7,3*8;;
583
584 mov r3=ar.rnat;;
585 st8 [r2]=r3,8*13 // increment by 13x8 bytes
586
587 mov r3=ar.ccv;;
588 st8 [r2]=r3,8*4
589
590 mov r3=ar.unat;;
591 st8 [r2]=r3,8*4
592
593 mov r3=ar.fpsr;;
594 st8 [r2]=r3,8*4
595
596 mov r3=ar.itc;;
597 st8 [r2]=r3,160 // 160
598
599 mov r3=ar.pfs;;
600 st8 [r2]=r3,8
601
602 mov r3=ar.lc;;
603 st8 [r2]=r3,8
604
605 mov r3=ar.ec;;
606 st8 [r2]=r3
607 add r2=8*62,r2 //padding
608
609// save RRs
610 mov ar.lc=0x08-1
611 movl r4=0x00;;
612
613cStRR:
614 dep.z r5=r4,61,3;;
615 mov r3=rr[r5];;
616 st8 [r2]=r3,8
617 add r4=1,r4
618 br.cloop.sptk.few cStRR
619 ;;
620end_os_mca_dump:
621 br ia64_os_mca_done_dump;;
622 695
623//EndStub////////////////////////////////////////////////////////////////////// 696//EndStub//////////////////////////////////////////////////////////////////////
624 697
625 698
626//++ 699//++
627// Name: 700// Name:
628// ia64_os_mca_proc_state_restore() 701// ia64_state_restore()
629// 702//
630// Stub Description: 703// Stub Description:
631// 704//
632// This is a stub to restore the saved processor state during MCHK 705// Restore the SAL/OS state. This is sensitive to the layout of struct
706// ia64_sal_os_state in mca.h.
707//
708// r2 contains the return address, r3 contains either
709// IA64_MCA_CPU_MCA_STACK_OFFSET or IA64_MCA_CPU_INIT_STACK_OFFSET.
710//
711// In addition to the SAL to OS state, this routine restores all the
712// registers that appear in struct pt_regs and struct switch_stack,
713// excluding those in the PAL minstate area.
633// 714//
634//-- 715//--
635 716
636ia64_os_mca_proc_state_restore: 717ia64_state_restore:
718 // Restore the switch_stack data that is not in minstate nor pt_regs.
719 add regs=MCA_SWITCH_STACK_OFFSET, r3
720 mov b0=r2 // save return address
721 ;;
722 GET_IA64_MCA_DATA(temp2)
723 ;;
724 add regs=temp2, regs
725 ;;
726 add temp1=SW(F2), regs
727 add temp2=SW(F3), regs
728 ;;
729 ldf.fill f2=[temp1],32
730 ldf.fill f3=[temp2],32
731 ;;
732 ldf.fill f4=[temp1],32
733 ldf.fill f5=[temp2],32
734 ;;
735 ldf.fill f12=[temp1],32
736 ldf.fill f13=[temp2],32
737 ;;
738 ldf.fill f14=[temp1],32
739 ldf.fill f15=[temp2],32
740 ;;
741 ldf.fill f16=[temp1],32
742 ldf.fill f17=[temp2],32
743 ;;
744 ldf.fill f18=[temp1],32
745 ldf.fill f19=[temp2],32
746 ;;
747 ldf.fill f20=[temp1],32
748 ldf.fill f21=[temp2],32
749 ;;
750 ldf.fill f22=[temp1],32
751 ldf.fill f23=[temp2],32
752 ;;
753 ldf.fill f24=[temp1],32
754 ldf.fill f25=[temp2],32
755 ;;
756 ldf.fill f26=[temp1],32
757 ldf.fill f27=[temp2],32
758 ;;
759 ldf.fill f28=[temp1],32
760 ldf.fill f29=[temp2],32
761 ;;
762 ldf.fill f30=[temp1],SW(B2)-SW(F30)
763 ldf.fill f31=[temp2],SW(B3)-SW(F31)
764 ;;
765 ld8 temp3=[temp1],16 // restore b2
766 ld8 temp4=[temp2],16 // restore b3
767 ;;
768 mov b2=temp3
769 mov b3=temp4
770 ld8 temp3=[temp1],SW(AR_LC)-SW(B4) // restore b4
771 ld8 temp4=[temp2] // restore b5
772 ;;
773 mov b4=temp3
774 mov b5=temp4
775 ld8 temp3=[temp1] // restore ar.lc
776 ;;
777 mov ar.lc=temp3
637 778
638// Restore bank1 GR16-31 779 // Restore the pt_regs data that is not in minstate. The previous code
639 GET_IA64_MCA_DATA(r2) 780 // left regs at switch_stack.
781 add regs=MCA_PT_REGS_OFFSET-MCA_SWITCH_STACK_OFFSET, regs
782 ;;
783 add temp1=PT(B6), regs
784 add temp2=PT(B7), regs
785 ;;
786 ld8 temp3=[temp1],PT(AR_CSD)-PT(B6) // restore b6
787 ld8 temp4=[temp2],PT(AR_SSD)-PT(B7) // restore b7
788 ;;
789 mov b6=temp3
790 mov b7=temp4
791 ld8 temp3=[temp1],PT(AR_UNAT)-PT(AR_CSD) // restore ar.csd
792 ld8 temp4=[temp2],PT(AR_PFS)-PT(AR_SSD) // restore ar.ssd
793 ;;
794 mov ar.csd=temp3
795 mov ar.ssd=temp4
796 ld8 temp3=[temp1] // restore ar.unat
797 add temp1=PT(AR_CCV)-PT(AR_UNAT), temp1
798 ld8 temp4=[temp2],PT(AR_FPSR)-PT(AR_PFS) // restore ar.pfs
799 ;;
800 mov ar.unat=temp3
801 mov ar.pfs=temp4
802 // ar.rnat, ar.bspstore, loadrs are restore in ia64_old_stack.
803 ld8 temp3=[temp1],PT(F6)-PT(AR_CCV) // restore ar.ccv
804 ld8 temp4=[temp2],PT(F7)-PT(AR_FPSR) // restore ar.fpsr
805 ;;
806 mov ar.ccv=temp3
807 mov ar.fpsr=temp4
808 ldf.fill f6=[temp1],PT(F8)-PT(F6)
809 ldf.fill f7=[temp2],PT(F9)-PT(F7)
810 ;;
811 ldf.fill f8=[temp1],PT(F10)-PT(F8)
812 ldf.fill f9=[temp2],PT(F11)-PT(F9)
813 ;;
814 ldf.fill f10=[temp1]
815 ldf.fill f11=[temp2]
816
817 // Restore the SAL to OS state. The previous code left regs at pt_regs.
818 add regs=MCA_SOS_OFFSET-MCA_PT_REGS_OFFSET, regs
640 ;; 819 ;;
641 add r2 = IA64_MCA_CPU_PROC_STATE_DUMP_OFFSET, r2 820 add temp1=IA64_SAL_OS_STATE_COMMON_OFFSET, regs
642 821 add temp2=IA64_SAL_OS_STATE_COMMON_OFFSET+8, regs
643restore_GRs: // restore bank-1 GRs 16-31 822 ;;
644 bsw.1;; 823 ld8 r12=[temp1],16 // sal_ra
645 add r3=16*8,r2;; // to get to NaT of GR 16-31 824 ld8 r9=[temp2],16 // sal_gp
646 ld8 r3=[r3];; 825 ;;
647 mov ar.unat=r3;; // first restore NaT 826 ld8 r22=[temp1],24 // pal_min_state, virtual. skip prev_task
648 827 ld8 r21=[temp2],16 // prev_IA64_KR_CURRENT
649 ld8.fill r16=[r2],8;; 828 ;;
650 ld8.fill r17=[r2],8;; 829 ld8 temp3=[temp1],16 // cr.isr
651 ld8.fill r18=[r2],8;; 830 ld8 temp4=[temp2],16 // cr.ifa
652 ld8.fill r19=[r2],8;; 831 ;;
653 ld8.fill r20=[r2],8;; 832 mov cr.isr=temp3
654 ld8.fill r21=[r2],8;; 833 mov cr.ifa=temp4
655 ld8.fill r22=[r2],8;; 834 ld8 temp3=[temp1],16 // cr.itir
656 ld8.fill r23=[r2],8;; 835 ld8 temp4=[temp2],16 // cr.iipa
657 ld8.fill r24=[r2],8;; 836 ;;
658 ld8.fill r25=[r2],8;; 837 mov cr.itir=temp3
659 ld8.fill r26=[r2],8;; 838 mov cr.iipa=temp4
660 ld8.fill r27=[r2],8;; 839 ld8 temp3=[temp1],16 // cr.iim
661 ld8.fill r28=[r2],8;; 840 ld8 temp4=[temp2],16 // cr.iha
662 ld8.fill r29=[r2],8;; 841 ;;
663 ld8.fill r30=[r2],8;; 842 mov cr.iim=temp3
664 ld8.fill r31=[r2],8;; 843 mov cr.iha=temp4
665 844 dep r22=0,r22,62,2 // pal_min_state, physical, uncached
666 ld8 r3=[r2],8;; // increment to skip NaT 845 mov IA64_KR(CURRENT)=r21
667 bsw.0;; 846 ld8 r8=[temp1] // os_status
668 847 ld8 r10=[temp2] // context
669restore_BRs: 848
670 add r4=8,r2 // duplicate r2 in r4 849 br.sptk b0
671 add r6=2*8,r2;; // duplicate r2 in r4
672
673 ld8 r3=[r2],3*8
674 ld8 r5=[r4],3*8
675 ld8 r7=[r6],3*8;;
676 mov b0=r3
677 mov b1=r5
678 mov b2=r7;;
679
680 ld8 r3=[r2],3*8
681 ld8 r5=[r4],3*8
682 ld8 r7=[r6],3*8;;
683 mov b3=r3
684 mov b4=r5
685 mov b5=r7;;
686
687 ld8 r3=[r2],2*8
688 ld8 r5=[r4],2*8;;
689 mov b6=r3
690 mov b7=r5;;
691
692restore_CRs:
693 add r4=8,r2 // duplicate r2 in r4
694 add r6=2*8,r2;; // duplicate r2 in r4
695
696 ld8 r3=[r2],8*8
697 ld8 r5=[r4],3*8
698 ld8 r7=[r6],3*8;; // 48 byte increments
699 mov cr.dcr=r3
700 mov cr.itm=r5
701 mov cr.iva=r7;;
702
703 ld8 r3=[r2],8*8;; // 64 byte increments
704// mov cr.pta=r3
705
706
707// if PSR.ic=1, reading interruption registers causes an illegal operation fault
708 mov r3=psr;;
709 tbit.nz.unc p6,p0=r3,PSR_IC;; // PSI Valid Log bit pos. test
710(p6) st8 [r2]=r0,9*8+160 // increment by 232 byte inc.
711
712begin_rskip_intr_regs:
713(p6) br rSkipIntrRegs;;
714
715 add r4=8,r2 // duplicate r2 in r4
716 add r6=2*8,r2;; // duplicate r2 in r4
717
718 ld8 r3=[r2],3*8
719 ld8 r5=[r4],3*8
720 ld8 r7=[r6],3*8;;
721 mov cr.ipsr=r3
722// mov cr.isr=r5 // cr.isr is read only
723
724 ld8 r3=[r2],3*8
725 ld8 r5=[r4],3*8
726 ld8 r7=[r6],3*8;;
727 mov cr.iip=r3
728 mov cr.ifa=r5
729 mov cr.itir=r7;;
730
731 ld8 r3=[r2],3*8
732 ld8 r5=[r4],3*8
733 ld8 r7=[r6],3*8;;
734 mov cr.iipa=r3
735 mov cr.ifs=r5
736 mov cr.iim=r7
737
738 ld8 r3=[r2],160;; // 160 byte increment
739 mov cr.iha=r3
740
741rSkipIntrRegs:
742 ld8 r3=[r2],152;; // another 152 byte inc.
743
744 add r4=8,r2 // duplicate r2 in r4
745 add r6=2*8,r2;; // duplicate r2 in r6
746
747 ld8 r3=[r2],8*3
748 ld8 r5=[r4],8*3
749 ld8 r7=[r6],8*3;;
750 mov cr.lid=r3
751// mov cr.ivr=r5 // cr.ivr is read only
752 mov cr.tpr=r7;;
753
754 ld8 r3=[r2],8*3
755 ld8 r5=[r4],8*3
756 ld8 r7=[r6],8*3;;
757// mov cr.eoi=r3
758// mov cr.irr0=r5 // cr.irr0 is read only
759// mov cr.irr1=r7;; // cr.irr1 is read only
760
761 ld8 r3=[r2],8*3
762 ld8 r5=[r4],8*3
763 ld8 r7=[r6],8*3;;
764// mov cr.irr2=r3 // cr.irr2 is read only
765// mov cr.irr3=r5 // cr.irr3 is read only
766 mov cr.itv=r7;;
767
768 ld8 r3=[r2],8*7
769 ld8 r5=[r4],8*7;;
770 mov cr.pmv=r3
771 mov cr.cmcv=r5;;
772
773 ld8 r3=[r2],8*23
774 ld8 r5=[r4],8*23;;
775 adds r2=8*23,r2
776 adds r4=8*23,r4;;
777// mov cr.lrr0=r3
778// mov cr.lrr1=r5
779
780 adds r2=8*2,r2;;
781
782restore_ARs:
783 add r4=8,r2 // duplicate r2 in r4
784 add r6=2*8,r2;; // duplicate r2 in r4
785
786 ld8 r3=[r2],3*8
787 ld8 r5=[r4],3*8
788 ld8 r7=[r6],3*8;;
789 mov ar.k0=r3
790 mov ar.k1=r5
791 mov ar.k2=r7;;
792
793 ld8 r3=[r2],3*8
794 ld8 r5=[r4],3*8
795 ld8 r7=[r6],3*8;;
796 mov ar.k3=r3
797 mov ar.k4=r5
798 mov ar.k5=r7;;
799
800 ld8 r3=[r2],10*8
801 ld8 r5=[r4],10*8
802 ld8 r7=[r6],10*8;;
803 mov ar.k6=r3
804 mov ar.k7=r5
805 ;;
806
807 ld8 r3=[r2],3*8
808 ld8 r5=[r4],3*8
809 ld8 r7=[r6],3*8;;
810// mov ar.rsc=r3
811// mov ar.bsp=r5 // ar.bsp is read only
812 mov ar.rsc=r0 // make sure that RSE is in enforced lazy mode
813 ;;
814 mov ar.bspstore=r7;;
815
816 ld8 r9=[r2],8*13;;
817 mov ar.rnat=r9
818
819 mov ar.rsc=r3
820 ld8 r3=[r2],8*4;;
821 mov ar.ccv=r3
822
823 ld8 r3=[r2],8*4;;
824 mov ar.unat=r3
825
826 ld8 r3=[r2],8*4;;
827 mov ar.fpsr=r3
828
829 ld8 r3=[r2],160;; // 160
830// mov ar.itc=r3
831
832 ld8 r3=[r2],8;;
833 mov ar.pfs=r3
834
835 ld8 r3=[r2],8;;
836 mov ar.lc=r3
837
838 ld8 r3=[r2];;
839 mov ar.ec=r3
840 add r2=8*62,r2;; // padding
841
842restore_RRs:
843 mov r5=ar.lc
844 mov ar.lc=0x08-1
845 movl r4=0x00;;
846cStRRr:
847 dep.z r7=r4,61,3
848 ld8 r3=[r2],8;;
849 mov rr[r7]=r3 // what are its access previledges?
850 add r4=1,r4
851 br.cloop.sptk.few cStRRr
852 ;;
853 mov ar.lc=r5
854 ;;
855end_os_mca_restore:
856 br ia64_os_mca_done_restore;;
857 850
858//EndStub////////////////////////////////////////////////////////////////////// 851//EndStub//////////////////////////////////////////////////////////////////////
859 852
860 853
861// ok, the issue here is that we need to save state information so 854//++
862// it can be useable by the kernel debugger and show regs routines. 855// Name:
863// In order to do this, our best bet is save the current state (plus 856// ia64_new_stack()
864// the state information obtain from the MIN_STATE_AREA) into a pt_regs
865// format. This way we can pass it on in a useable format.
866// 857//
867 858// Stub Description:
868// 859//
869// SAL to OS entry point for INIT on the monarch processor 860// Switch to the MCA/INIT stack.
870// This has been defined for registration purposes with SAL
871// as a part of ia64_mca_init.
872// 861//
873// When we get here, the following registers have been 862// r2 contains the return address, r3 contains either
874// set by the SAL for our use 863// IA64_MCA_CPU_MCA_STACK_OFFSET or IA64_MCA_CPU_INIT_STACK_OFFSET.
875// 864//
876// 1. GR1 = OS INIT GP 865// On entry RBS is still on the original stack, this routine switches RBS
877// 2. GR8 = PAL_PROC physical address 866// to use the MCA/INIT stack.
878// 3. GR9 = SAL_PROC physical address
879// 4. GR10 = SAL GP (physical)
880// 5. GR11 = Init Reason
881// 0 = Received INIT for event other than crash dump switch
882// 1 = Received wakeup at the end of an OS_MCA corrected machine check
883// 2 = Received INIT dude to CrashDump switch assertion
884// 867//
885// 6. GR12 = Return address to location within SAL_INIT procedure 868// On entry, sos->pal_min_state is physical, on exit it is virtual.
886 869//
870//--
887 871
888GLOBAL_ENTRY(ia64_monarch_init_handler) 872ia64_new_stack:
889 .prologue 873 add regs=MCA_PT_REGS_OFFSET, r3
890 // stash the information the SAL passed to os 874 add temp2=MCA_SOS_OFFSET+IA64_SAL_OS_STATE_PAL_MIN_STATE_OFFSET, r3
891 SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(r2) 875 mov b0=r2 // save return address
876 GET_IA64_MCA_DATA(temp1)
877 invala
892 ;; 878 ;;
893 SAVE_MIN_WITH_COVER 879 add temp2=temp2, temp1 // struct ia64_sal_os_state.pal_min_state on MCA or INIT stack
880 add regs=regs, temp1 // struct pt_regs on MCA or INIT stack
894 ;; 881 ;;
895 mov r8=cr.ifa 882 // Address of minstate area provided by PAL is physical, uncacheable.
896 mov r9=cr.isr 883 // Convert to Linux virtual address in region 6 for C code.
897 adds r3=8,r2 // set up second base pointer 884 ld8 ms=[temp2] // pal_min_state, physical
898 ;; 885 ;;
899 SAVE_REST 886 dep temp1=-1,ms,62,2 // set region 6
900 887 mov temp3=IA64_RBS_OFFSET-MCA_PT_REGS_OFFSET
901// ok, enough should be saved at this point to be dangerous, and supply 888 ;;
902// information for a dump 889 st8 [temp2]=temp1 // pal_min_state, virtual
903// We need to switch to Virtual mode before hitting the C functions.
904 890
905 movl r2=IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN 891 add temp4=temp3, regs // start of bspstore on new stack
906 mov r3=psr // get the current psr, minimum enabled at this point
907 ;; 892 ;;
908 or r2=r2,r3 893 mov ar.bspstore=temp4 // switch RBS to MCA/INIT stack
909 ;; 894 ;;
910 movl r3=IVirtual_Switch 895 flushrs // must be first in group
896 br.sptk b0
897
898//EndStub//////////////////////////////////////////////////////////////////////
899
900
901//++
902// Name:
903// ia64_old_stack()
904//
905// Stub Description:
906//
907// Switch to the old stack.
908//
909// r2 contains the return address, r3 contains either
910// IA64_MCA_CPU_MCA_STACK_OFFSET or IA64_MCA_CPU_INIT_STACK_OFFSET.
911//
912// On entry, pal_min_state is virtual, on exit it is physical.
913//
914// On entry RBS is on the MCA/INIT stack, this routine switches RBS
915// back to the previous stack.
916//
917// The psr is set to all zeroes. SAL return requires either all zeroes or
918// just psr.mc set. Leaving psr.mc off allows INIT to be issued if this
919// code does not perform correctly.
920//
921// The dirty registers at the time of the event were flushed to the
922// MCA/INIT stack in ia64_pt_regs_save(). Restore the dirty registers
923// before reverting to the previous bspstore.
924//--
925
926ia64_old_stack:
927 add regs=MCA_PT_REGS_OFFSET, r3
928 mov b0=r2 // save return address
929 GET_IA64_MCA_DATA(temp2)
930 LOAD_PHYSICAL(p0,temp1,1f)
911 ;; 931 ;;
912 mov cr.iip=r3 // short return to set the appropriate bits 932 mov cr.ipsr=r0
913 mov cr.ipsr=r2 // need to do an rfi to set appropriate bits 933 mov cr.ifs=r0
934 mov cr.iip=temp1
914 ;; 935 ;;
936 invala
915 rfi 937 rfi
9381:
939
940 add regs=regs, temp2 // struct pt_regs on MCA or INIT stack
916 ;; 941 ;;
917IVirtual_Switch: 942 add temp1=PT(LOADRS), regs
918 //
919 // We should now be running virtual
920 //
921 // Let's call the C handler to get the rest of the state info
922 //
923 alloc r14=ar.pfs,0,0,2,0 // now it's safe (must be first in insn group!)
924 ;; 943 ;;
925 adds out0=16,sp // out0 = pointer to pt_regs 944 ld8 temp2=[temp1],PT(AR_BSPSTORE)-PT(LOADRS) // restore loadrs
926 ;; 945 ;;
927 DO_SAVE_SWITCH_STACK 946 ld8 temp3=[temp1],PT(AR_RNAT)-PT(AR_BSPSTORE) // restore ar.bspstore
928 .body 947 mov ar.rsc=temp2
929 adds out1=16,sp // out0 = pointer to switch_stack 948 ;;
949 loadrs
950 ld8 temp4=[temp1] // restore ar.rnat
951 ;;
952 mov ar.bspstore=temp3 // back to old stack
953 ;;
954 mov ar.rnat=temp4
955 ;;
956
957 br.sptk b0
930 958
931 br.call.sptk.many rp=ia64_init_handler 959//EndStub//////////////////////////////////////////////////////////////////////
932.ret1:
933 960
934return_from_init:
935 br.sptk return_from_init
936END(ia64_monarch_init_handler)
937 961
962//++
963// Name:
964// ia64_set_kernel_registers()
938// 965//
939// SAL to OS entry point for INIT on the slave processor 966// Stub Description:
940// This has been defined for registration purposes with SAL 967//
941// as a part of ia64_mca_init. 968// Set the registers that are required by the C code in order to run on an
969// MCA/INIT stack.
970//
971// r2 contains the return address, r3 contains either
972// IA64_MCA_CPU_MCA_STACK_OFFSET or IA64_MCA_CPU_INIT_STACK_OFFSET.
942// 973//
974//--
975
976ia64_set_kernel_registers:
977 add temp3=MCA_SP_OFFSET, r3
978 add temp4=MCA_SOS_OFFSET+IA64_SAL_OS_STATE_OS_GP_OFFSET, r3
979 mov b0=r2 // save return address
980 GET_IA64_MCA_DATA(temp1)
981 ;;
982 add temp4=temp4, temp1 // &struct ia64_sal_os_state.os_gp
983 add r12=temp1, temp3 // kernel stack pointer on MCA/INIT stack
984 add r13=temp1, r3 // set current to start of MCA/INIT stack
985 ;;
986 ld8 r1=[temp4] // OS GP from SAL OS state
987 ;;
988 DATA_PA_TO_VA(r1,temp1)
989 DATA_PA_TO_VA(r12,temp2)
990 DATA_PA_TO_VA(r13,temp3)
991 ;;
992 mov IA64_KR(CURRENT)=r13
993
994 // FIXME: do I need to wire IA64_KR_CURRENT_STACK and IA64_TR_CURRENT_STACK?
995
996 br.sptk b0
997
998//EndStub//////////////////////////////////////////////////////////////////////
999
1000#undef ms
1001#undef regs
1002#undef temp1
1003#undef temp2
1004#undef temp3
1005#undef temp4
1006
943 1007
944GLOBAL_ENTRY(ia64_slave_init_handler) 1008// Support function for mca.c, it is here to avoid using inline asm. Given the
9451: br.sptk 1b 1009// address of an rnat slot, if that address is below the current ar.bspstore
946END(ia64_slave_init_handler) 1010// then return the contents of that slot, otherwise return the contents of
1011// ar.rnat.
1012GLOBAL_ENTRY(ia64_get_rnat)
1013 alloc r14=ar.pfs,1,0,0,0
1014 mov ar.rsc=0
1015 ;;
1016 mov r14=ar.bspstore
1017 ;;
1018 cmp.lt p6,p7=in0,r14
1019 ;;
1020(p6) ld8 r8=[in0]
1021(p7) mov r8=ar.rnat
1022 mov ar.rsc=3
1023 br.ret.sptk.many rp
1024END(ia64_get_rnat)
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index abc0113a821d..6e683745af49 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -4,6 +4,8 @@
4 * 4 *
5 * Copyright (C) 2004 FUJITSU LIMITED 5 * Copyright (C) 2004 FUJITSU LIMITED
6 * Copyright (C) Hidetoshi Seto (seto.hidetoshi@jp.fujitsu.com) 6 * Copyright (C) Hidetoshi Seto (seto.hidetoshi@jp.fujitsu.com)
7 * Copyright (C) 2005 Silicon Graphics, Inc
8 * Copyright (C) 2005 Keith Owens <kaos@sgi.com>
7 */ 9 */
8#include <linux/config.h> 10#include <linux/config.h>
9#include <linux/types.h> 11#include <linux/types.h>
@@ -38,10 +40,6 @@
38/* max size of SAL error record (default) */ 40/* max size of SAL error record (default) */
39static int sal_rec_max = 10000; 41static int sal_rec_max = 10000;
40 42
41/* from mca.c */
42static ia64_mca_sal_to_os_state_t *sal_to_os_handoff_state;
43static ia64_mca_os_to_sal_state_t *os_to_sal_handoff_state;
44
45/* from mca_drv_asm.S */ 43/* from mca_drv_asm.S */
46extern void *mca_handler_bhhook(void); 44extern void *mca_handler_bhhook(void);
47 45
@@ -316,7 +314,8 @@ init_record_index_pools(void)
316 */ 314 */
317 315
318static mca_type_t 316static mca_type_t
319is_mca_global(peidx_table_t *peidx, pal_bus_check_info_t *pbci) 317is_mca_global(peidx_table_t *peidx, pal_bus_check_info_t *pbci,
318 struct ia64_sal_os_state *sos)
320{ 319{
321 pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx); 320 pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx);
322 321
@@ -327,7 +326,7 @@ is_mca_global(peidx_table_t *peidx, pal_bus_check_info_t *pbci)
327 * Therefore it is local MCA when rendezvous has not been requested. 326 * Therefore it is local MCA when rendezvous has not been requested.
328 * Failed to rendezvous, the system must be down. 327 * Failed to rendezvous, the system must be down.
329 */ 328 */
330 switch (sal_to_os_handoff_state->imsto_rendez_state) { 329 switch (sos->rv_rc) {
331 case -1: /* SAL rendezvous unsuccessful */ 330 case -1: /* SAL rendezvous unsuccessful */
332 return MCA_IS_GLOBAL; 331 return MCA_IS_GLOBAL;
333 case 0: /* SAL rendezvous not required */ 332 case 0: /* SAL rendezvous not required */
@@ -388,7 +387,8 @@ is_mca_global(peidx_table_t *peidx, pal_bus_check_info_t *pbci)
388 */ 387 */
389 388
390static int 389static int
391recover_from_read_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci) 390recover_from_read_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci,
391 struct ia64_sal_os_state *sos)
392{ 392{
393 sal_log_mod_error_info_t *smei; 393 sal_log_mod_error_info_t *smei;
394 pal_min_state_area_t *pmsa; 394 pal_min_state_area_t *pmsa;
@@ -426,7 +426,7 @@ recover_from_read_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_chec
426 * setup for resume to bottom half of MCA, 426 * setup for resume to bottom half of MCA,
427 * "mca_handler_bhhook" 427 * "mca_handler_bhhook"
428 */ 428 */
429 pmsa = (pal_min_state_area_t *)(sal_to_os_handoff_state->pal_min_state | (6ul<<61)); 429 pmsa = sos->pal_min_state;
430 /* pass to bhhook as 1st argument (gr8) */ 430 /* pass to bhhook as 1st argument (gr8) */
431 pmsa->pmsa_gr[8-1] = smei->target_identifier; 431 pmsa->pmsa_gr[8-1] = smei->target_identifier;
432 /* set interrupted return address (but no use) */ 432 /* set interrupted return address (but no use) */
@@ -459,7 +459,8 @@ recover_from_read_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_chec
459 */ 459 */
460 460
461static int 461static int
462recover_from_platform_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci) 462recover_from_platform_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci,
463 struct ia64_sal_os_state *sos)
463{ 464{
464 int status = 0; 465 int status = 0;
465 pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx); 466 pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx);
@@ -469,7 +470,7 @@ recover_from_platform_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_
469 case 1: /* partial read */ 470 case 1: /* partial read */
470 case 3: /* full line(cpu) read */ 471 case 3: /* full line(cpu) read */
471 case 9: /* I/O space read */ 472 case 9: /* I/O space read */
472 status = recover_from_read_error(slidx, peidx, pbci); 473 status = recover_from_read_error(slidx, peidx, pbci, sos);
473 break; 474 break;
474 case 0: /* unknown */ 475 case 0: /* unknown */
475 case 2: /* partial write */ 476 case 2: /* partial write */
@@ -508,7 +509,8 @@ recover_from_platform_error(slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_
508 */ 509 */
509 510
510static int 511static int
511recover_from_processor_error(int platform, slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci) 512recover_from_processor_error(int platform, slidx_table_t *slidx, peidx_table_t *peidx, pal_bus_check_info_t *pbci,
513 struct ia64_sal_os_state *sos)
512{ 514{
513 pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx); 515 pal_processor_state_info_t *psp = (pal_processor_state_info_t*)peidx_psp(peidx);
514 516
@@ -545,7 +547,7 @@ recover_from_processor_error(int platform, slidx_table_t *slidx, peidx_table_t *
545 * This means "there are some platform errors". 547 * This means "there are some platform errors".
546 */ 548 */
547 if (platform) 549 if (platform)
548 return recover_from_platform_error(slidx, peidx, pbci); 550 return recover_from_platform_error(slidx, peidx, pbci, sos);
549 /* 551 /*
550 * On account of strange SAL error record, we cannot recover. 552 * On account of strange SAL error record, we cannot recover.
551 */ 553 */
@@ -562,8 +564,7 @@ recover_from_processor_error(int platform, slidx_table_t *slidx, peidx_table_t *
562 564
563static int 565static int
564mca_try_to_recover(void *rec, 566mca_try_to_recover(void *rec,
565 ia64_mca_sal_to_os_state_t *sal_to_os_state, 567 struct ia64_sal_os_state *sos)
566 ia64_mca_os_to_sal_state_t *os_to_sal_state)
567{ 568{
568 int platform_err; 569 int platform_err;
569 int n_proc_err; 570 int n_proc_err;
@@ -571,10 +572,6 @@ mca_try_to_recover(void *rec,
571 peidx_table_t peidx; 572 peidx_table_t peidx;
572 pal_bus_check_info_t pbci; 573 pal_bus_check_info_t pbci;
573 574
574 /* handoff state from/to mca.c */
575 sal_to_os_handoff_state = sal_to_os_state;
576 os_to_sal_handoff_state = os_to_sal_state;
577
578 /* Make index of SAL error record */ 575 /* Make index of SAL error record */
579 platform_err = mca_make_slidx(rec, &slidx); 576 platform_err = mca_make_slidx(rec, &slidx);
580 577
@@ -597,11 +594,11 @@ mca_try_to_recover(void *rec,
597 *((u64*)&pbci) = peidx_check_info(&peidx, bus_check, 0); 594 *((u64*)&pbci) = peidx_check_info(&peidx, bus_check, 0);
598 595
599 /* Check whether MCA is global or not */ 596 /* Check whether MCA is global or not */
600 if (is_mca_global(&peidx, &pbci)) 597 if (is_mca_global(&peidx, &pbci, sos))
601 return 0; 598 return 0;
602 599
603 /* Try to recover a processor error */ 600 /* Try to recover a processor error */
604 return recover_from_processor_error(platform_err, &slidx, &peidx, &pbci); 601 return recover_from_processor_error(platform_err, &slidx, &peidx, &pbci, sos);
605} 602}
606 603
607/* 604/*
diff --git a/arch/ia64/kernel/minstate.h b/arch/ia64/kernel/minstate.h
index f6d8a010d99b..85ed54179afa 100644
--- a/arch/ia64/kernel/minstate.h
+++ b/arch/ia64/kernel/minstate.h
@@ -5,73 +5,6 @@
5#include "entry.h" 5#include "entry.h"
6 6
7/* 7/*
8 * For ivt.s we want to access the stack virtually so we don't have to disable translation
9 * on interrupts.
10 *
11 * On entry:
12 * r1: pointer to current task (ar.k6)
13 */
14#define MINSTATE_START_SAVE_MIN_VIRT \
15(pUStk) mov ar.rsc=0; /* set enforced lazy mode, pl 0, little-endian, loadrs=0 */ \
16 ;; \
17(pUStk) mov.m r24=ar.rnat; \
18(pUStk) addl r22=IA64_RBS_OFFSET,r1; /* compute base of RBS */ \
19(pKStk) mov r1=sp; /* get sp */ \
20 ;; \
21(pUStk) lfetch.fault.excl.nt1 [r22]; \
22(pUStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1; /* compute base of memory stack */ \
23(pUStk) mov r23=ar.bspstore; /* save ar.bspstore */ \
24 ;; \
25(pUStk) mov ar.bspstore=r22; /* switch to kernel RBS */ \
26(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1; /* if in kernel mode, use sp (r12) */ \
27 ;; \
28(pUStk) mov r18=ar.bsp; \
29(pUStk) mov ar.rsc=0x3; /* set eager mode, pl 0, little-endian, loadrs=0 */
30
31#define MINSTATE_END_SAVE_MIN_VIRT \
32 bsw.1; /* switch back to bank 1 (must be last in insn group) */ \
33 ;;
34
35/*
36 * For mca_asm.S we want to access the stack physically since the state is saved before we
37 * go virtual and don't want to destroy the iip or ipsr.
38 */
39#define MINSTATE_START_SAVE_MIN_PHYS \
40(pKStk) mov r3=IA64_KR(PER_CPU_DATA);; \
41(pKStk) addl r3=THIS_CPU(ia64_mca_data),r3;; \
42(pKStk) ld8 r3 = [r3];; \
43(pKStk) addl r3=IA64_MCA_CPU_INIT_STACK_OFFSET,r3;; \
44(pKStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r3; \
45(pUStk) mov ar.rsc=0; /* set enforced lazy mode, pl 0, little-endian, loadrs=0 */ \
46(pUStk) addl r22=IA64_RBS_OFFSET,r1; /* compute base of register backing store */ \
47 ;; \
48(pUStk) mov r24=ar.rnat; \
49(pUStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1; /* compute base of memory stack */ \
50(pUStk) mov r23=ar.bspstore; /* save ar.bspstore */ \
51(pUStk) dep r22=-1,r22,61,3; /* compute kernel virtual addr of RBS */ \
52 ;; \
53(pUStk) mov ar.bspstore=r22; /* switch to kernel RBS */ \
54 ;; \
55(pUStk) mov r18=ar.bsp; \
56(pUStk) mov ar.rsc=0x3; /* set eager mode, pl 0, little-endian, loadrs=0 */ \
57
58#define MINSTATE_END_SAVE_MIN_PHYS \
59 dep r12=-1,r12,61,3; /* make sp a kernel virtual address */ \
60 ;;
61
62#ifdef MINSTATE_VIRT
63# define MINSTATE_GET_CURRENT(reg) mov reg=IA64_KR(CURRENT)
64# define MINSTATE_START_SAVE_MIN MINSTATE_START_SAVE_MIN_VIRT
65# define MINSTATE_END_SAVE_MIN MINSTATE_END_SAVE_MIN_VIRT
66#endif
67
68#ifdef MINSTATE_PHYS
69# define MINSTATE_GET_CURRENT(reg) mov reg=IA64_KR(CURRENT);; tpa reg=reg
70# define MINSTATE_START_SAVE_MIN MINSTATE_START_SAVE_MIN_PHYS
71# define MINSTATE_END_SAVE_MIN MINSTATE_END_SAVE_MIN_PHYS
72#endif
73
74/*
75 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves 8 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves
76 * the minimum state necessary that allows us to turn psr.ic back 9 * the minimum state necessary that allows us to turn psr.ic back
77 * on. 10 * on.
@@ -97,7 +30,7 @@
97 * we can pass interruption state as arguments to a handler. 30 * we can pass interruption state as arguments to a handler.
98 */ 31 */
99#define DO_SAVE_MIN(COVER,SAVE_IFS,EXTRA) \ 32#define DO_SAVE_MIN(COVER,SAVE_IFS,EXTRA) \
100 MINSTATE_GET_CURRENT(r16); /* M (or M;;I) */ \ 33 mov r16=IA64_KR(CURRENT); /* M */ \
101 mov r27=ar.rsc; /* M */ \ 34 mov r27=ar.rsc; /* M */ \
102 mov r20=r1; /* A */ \ 35 mov r20=r1; /* A */ \
103 mov r25=ar.unat; /* M */ \ 36 mov r25=ar.unat; /* M */ \
@@ -118,7 +51,21 @@
118 SAVE_IFS; \ 51 SAVE_IFS; \
119 cmp.eq pKStk,pUStk=r0,r17; /* are we in kernel mode already? */ \ 52 cmp.eq pKStk,pUStk=r0,r17; /* are we in kernel mode already? */ \
120 ;; \ 53 ;; \
121 MINSTATE_START_SAVE_MIN \ 54(pUStk) mov ar.rsc=0; /* set enforced lazy mode, pl 0, little-endian, loadrs=0 */ \
55 ;; \
56(pUStk) mov.m r24=ar.rnat; \
57(pUStk) addl r22=IA64_RBS_OFFSET,r1; /* compute base of RBS */ \
58(pKStk) mov r1=sp; /* get sp */ \
59 ;; \
60(pUStk) lfetch.fault.excl.nt1 [r22]; \
61(pUStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1; /* compute base of memory stack */ \
62(pUStk) mov r23=ar.bspstore; /* save ar.bspstore */ \
63 ;; \
64(pUStk) mov ar.bspstore=r22; /* switch to kernel RBS */ \
65(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1; /* if in kernel mode, use sp (r12) */ \
66 ;; \
67(pUStk) mov r18=ar.bsp; \
68(pUStk) mov ar.rsc=0x3; /* set eager mode, pl 0, little-endian, loadrs=0 */ \
122 adds r17=2*L1_CACHE_BYTES,r1; /* really: biggest cache-line size */ \ 69 adds r17=2*L1_CACHE_BYTES,r1; /* really: biggest cache-line size */ \
123 adds r16=PT(CR_IPSR),r1; \ 70 adds r16=PT(CR_IPSR),r1; \
124 ;; \ 71 ;; \
@@ -181,7 +128,8 @@
181 EXTRA; \ 128 EXTRA; \
182 movl r1=__gp; /* establish kernel global pointer */ \ 129 movl r1=__gp; /* establish kernel global pointer */ \
183 ;; \ 130 ;; \
184 MINSTATE_END_SAVE_MIN 131 bsw.1; /* switch back to bank 1 (must be last in insn group) */ \
132 ;;
185 133
186/* 134/*
187 * SAVE_REST saves the remainder of pt_regs (with psr.ic on). 135 * SAVE_REST saves the remainder of pt_regs (with psr.ic on).
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 25e7c8344564..89faa603c6be 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -307,11 +307,9 @@ vm_info(char *page)
307 307
308 if ((status = ia64_pal_vm_summary(&vm_info_1, &vm_info_2)) !=0) { 308 if ((status = ia64_pal_vm_summary(&vm_info_1, &vm_info_2)) !=0) {
309 printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status); 309 printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status);
310 return 0; 310 } else {
311 }
312 311
313 312 p += sprintf(p,
314 p += sprintf(p,
315 "Physical Address Space : %d bits\n" 313 "Physical Address Space : %d bits\n"
316 "Virtual Address Space : %d bits\n" 314 "Virtual Address Space : %d bits\n"
317 "Protection Key Registers(PKR) : %d\n" 315 "Protection Key Registers(PKR) : %d\n"
@@ -319,92 +317,99 @@ vm_info(char *page)
319 "Hash Tag ID : 0x%x\n" 317 "Hash Tag ID : 0x%x\n"
320 "Size of RR.rid : %d\n", 318 "Size of RR.rid : %d\n",
321 vm_info_1.pal_vm_info_1_s.phys_add_size, 319 vm_info_1.pal_vm_info_1_s.phys_add_size,
322 vm_info_2.pal_vm_info_2_s.impl_va_msb+1, vm_info_1.pal_vm_info_1_s.max_pkr+1, 320 vm_info_2.pal_vm_info_2_s.impl_va_msb+1,
323 vm_info_1.pal_vm_info_1_s.key_size, vm_info_1.pal_vm_info_1_s.hash_tag_id, 321 vm_info_1.pal_vm_info_1_s.max_pkr+1,
322 vm_info_1.pal_vm_info_1_s.key_size,
323 vm_info_1.pal_vm_info_1_s.hash_tag_id,
324 vm_info_2.pal_vm_info_2_s.rid_size); 324 vm_info_2.pal_vm_info_2_s.rid_size);
325 }
325 326
326 if (ia64_pal_mem_attrib(&attrib) != 0) 327 if (ia64_pal_mem_attrib(&attrib) == 0) {
327 return 0; 328 p += sprintf(p, "Supported memory attributes : ");
328 329 sep = "";
329 p += sprintf(p, "Supported memory attributes : "); 330 for (i = 0; i < 8; i++) {
330 sep = ""; 331 if (attrib & (1 << i)) {
331 for (i = 0; i < 8; i++) { 332 p += sprintf(p, "%s%s", sep, mem_attrib[i]);
332 if (attrib & (1 << i)) { 333 sep = ", ";
333 p += sprintf(p, "%s%s", sep, mem_attrib[i]); 334 }
334 sep = ", ";
335 } 335 }
336 p += sprintf(p, "\n");
336 } 337 }
337 p += sprintf(p, "\n");
338 338
339 if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) { 339 if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) {
340 printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status); 340 printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status);
341 return 0; 341 } else {
342 }
343
344 p += sprintf(p,
345 "\nTLB walker : %simplemented\n"
346 "Number of DTR : %d\n"
347 "Number of ITR : %d\n"
348 "TLB insertable page sizes : ",
349 vm_info_1.pal_vm_info_1_s.vw ? "" : "not ",
350 vm_info_1.pal_vm_info_1_s.max_dtr_entry+1,
351 vm_info_1.pal_vm_info_1_s.max_itr_entry+1);
352 342
343 p += sprintf(p,
344 "\nTLB walker : %simplemented\n"
345 "Number of DTR : %d\n"
346 "Number of ITR : %d\n"
347 "TLB insertable page sizes : ",
348 vm_info_1.pal_vm_info_1_s.vw ? "" : "not ",
349 vm_info_1.pal_vm_info_1_s.max_dtr_entry+1,
350 vm_info_1.pal_vm_info_1_s.max_itr_entry+1);
353 351
354 p = bitvector_process(p, tr_pages);
355 352
356 p += sprintf(p, "\nTLB purgeable page sizes : "); 353 p = bitvector_process(p, tr_pages);
357 354
358 p = bitvector_process(p, vw_pages); 355 p += sprintf(p, "\nTLB purgeable page sizes : ");
359 356
357 p = bitvector_process(p, vw_pages);
358 }
360 if ((status=ia64_get_ptce(&ptce)) != 0) { 359 if ((status=ia64_get_ptce(&ptce)) != 0) {
361 printk(KERN_ERR "ia64_get_ptce=%ld\n", status); 360 printk(KERN_ERR "ia64_get_ptce=%ld\n", status);
362 return 0; 361 } else {
363 } 362 p += sprintf(p,
364
365 p += sprintf(p,
366 "\nPurge base address : 0x%016lx\n" 363 "\nPurge base address : 0x%016lx\n"
367 "Purge outer loop count : %d\n" 364 "Purge outer loop count : %d\n"
368 "Purge inner loop count : %d\n" 365 "Purge inner loop count : %d\n"
369 "Purge outer loop stride : %d\n" 366 "Purge outer loop stride : %d\n"
370 "Purge inner loop stride : %d\n", 367 "Purge inner loop stride : %d\n",
371 ptce.base, ptce.count[0], ptce.count[1], ptce.stride[0], ptce.stride[1]); 368 ptce.base, ptce.count[0], ptce.count[1],
369 ptce.stride[0], ptce.stride[1]);
372 370
373 p += sprintf(p, 371 p += sprintf(p,
374 "TC Levels : %d\n" 372 "TC Levels : %d\n"
375 "Unique TC(s) : %d\n", 373 "Unique TC(s) : %d\n",
376 vm_info_1.pal_vm_info_1_s.num_tc_levels, 374 vm_info_1.pal_vm_info_1_s.num_tc_levels,
377 vm_info_1.pal_vm_info_1_s.max_unique_tcs); 375 vm_info_1.pal_vm_info_1_s.max_unique_tcs);
378 376
379 for(i=0; i < vm_info_1.pal_vm_info_1_s.num_tc_levels; i++) { 377 for(i=0; i < vm_info_1.pal_vm_info_1_s.num_tc_levels; i++) {
380 for (j=2; j>0 ; j--) { 378 for (j=2; j>0 ; j--) {
381 tc_pages = 0; /* just in case */ 379 tc_pages = 0; /* just in case */
382 380
383 381
384 /* even without unification, some levels may not be present */ 382 /* even without unification, some levels may not be present */
385 if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0) { 383 if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0) {
386 continue; 384 continue;
387 } 385 }
388 386
389 p += sprintf(p, 387 p += sprintf(p,
390 "\n%s Translation Cache Level %d:\n" 388 "\n%s Translation Cache Level %d:\n"
391 "\tHash sets : %d\n" 389 "\tHash sets : %d\n"
392 "\tAssociativity : %d\n" 390 "\tAssociativity : %d\n"
393 "\tNumber of entries : %d\n" 391 "\tNumber of entries : %d\n"
394 "\tFlags : ", 392 "\tFlags : ",
395 cache_types[j+tc_info.tc_unified], i+1, tc_info.tc_num_sets, 393 cache_types[j+tc_info.tc_unified], i+1,
396 tc_info.tc_associativity, tc_info.tc_num_entries); 394 tc_info.tc_num_sets,
395 tc_info.tc_associativity,
396 tc_info.tc_num_entries);
397 397
398 if (tc_info.tc_pf) p += sprintf(p, "PreferredPageSizeOptimized "); 398 if (tc_info.tc_pf)
399 if (tc_info.tc_unified) p += sprintf(p, "Unified "); 399 p += sprintf(p, "PreferredPageSizeOptimized ");
400 if (tc_info.tc_reduce_tr) p += sprintf(p, "TCReduction"); 400 if (tc_info.tc_unified)
401 p += sprintf(p, "Unified ");
402 if (tc_info.tc_reduce_tr)
403 p += sprintf(p, "TCReduction");
401 404
402 p += sprintf(p, "\n\tSupported page sizes: "); 405 p += sprintf(p, "\n\tSupported page sizes: ");
403 406
404 p = bitvector_process(p, tc_pages); 407 p = bitvector_process(p, tc_pages);
405 408
406 /* when unified date (j=2) is enough */ 409 /* when unified date (j=2) is enough */
407 if (tc_info.tc_unified) break; 410 if (tc_info.tc_unified)
411 break;
412 }
408 } 413 }
409 } 414 }
410 p += sprintf(p, "\n"); 415 p += sprintf(p, "\n");
@@ -440,14 +445,14 @@ register_info(char *page)
440 p += sprintf(p, "\n"); 445 p += sprintf(p, "\n");
441 } 446 }
442 447
443 if (ia64_pal_rse_info(&phys_stacked, &hints) != 0) return 0; 448 if (ia64_pal_rse_info(&phys_stacked, &hints) == 0) {
444 449
445 p += sprintf(p, 450 p += sprintf(p,
446 "RSE stacked physical registers : %ld\n" 451 "RSE stacked physical registers : %ld\n"
447 "RSE load/store hints : %ld (%s)\n", 452 "RSE load/store hints : %ld (%s)\n",
448 phys_stacked, hints.ph_data, 453 phys_stacked, hints.ph_data,
449 hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)"); 454 hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)");
450 455 }
451 if (ia64_pal_debug_info(&iregs, &dregs)) 456 if (ia64_pal_debug_info(&iregs, &dregs))
452 return 0; 457 return 0;
453 458
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index f1201ac8a116..1650353e3f77 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -38,6 +38,7 @@
38#include <linux/pagemap.h> 38#include <linux/pagemap.h>
39#include <linux/mount.h> 39#include <linux/mount.h>
40#include <linux/bitops.h> 40#include <linux/bitops.h>
41#include <linux/rcupdate.h>
41 42
42#include <asm/errno.h> 43#include <asm/errno.h>
43#include <asm/intrinsics.h> 44#include <asm/intrinsics.h>
@@ -496,7 +497,7 @@ typedef struct {
496static pfm_stats_t pfm_stats[NR_CPUS]; 497static pfm_stats_t pfm_stats[NR_CPUS];
497static pfm_session_t pfm_sessions; /* global sessions information */ 498static pfm_session_t pfm_sessions; /* global sessions information */
498 499
499static spinlock_t pfm_alt_install_check = SPIN_LOCK_UNLOCKED; 500static DEFINE_SPINLOCK(pfm_alt_install_check);
500static pfm_intr_handler_desc_t *pfm_alt_intr_handler; 501static pfm_intr_handler_desc_t *pfm_alt_intr_handler;
501 502
502static struct proc_dir_entry *perfmon_dir; 503static struct proc_dir_entry *perfmon_dir;
@@ -2217,15 +2218,17 @@ static void
2217pfm_free_fd(int fd, struct file *file) 2218pfm_free_fd(int fd, struct file *file)
2218{ 2219{
2219 struct files_struct *files = current->files; 2220 struct files_struct *files = current->files;
2221 struct fdtable *fdt = files_fdtable(files);
2220 2222
2221 /* 2223 /*
2222 * there ie no fd_uninstall(), so we do it here 2224 * there ie no fd_uninstall(), so we do it here
2223 */ 2225 */
2224 spin_lock(&files->file_lock); 2226 spin_lock(&files->file_lock);
2225 files->fd[fd] = NULL; 2227 rcu_assign_pointer(fdt->fd[fd], NULL);
2226 spin_unlock(&files->file_lock); 2228 spin_unlock(&files->file_lock);
2227 2229
2228 if (file) put_filp(file); 2230 if (file)
2231 put_filp(file);
2229 put_unused_fd(fd); 2232 put_unused_fd(fd);
2230} 2233}
2231 2234
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index 6f0cc7a6634e..ca68e6e44a72 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -22,6 +22,11 @@
22 * 22 *
23 * Dec 5 2004 kaos@sgi.com 23 * Dec 5 2004 kaos@sgi.com
24 * Standardize which records are cleared automatically. 24 * Standardize which records are cleared automatically.
25 *
26 * Aug 18 2005 kaos@sgi.com
27 * mca.c may not pass a buffer, a NULL buffer just indicates that a new
28 * record is available in SAL.
29 * Replace some NR_CPUS by cpus_online, for hotplug cpu.
25 */ 30 */
26 31
27#include <linux/types.h> 32#include <linux/types.h>
@@ -193,7 +198,7 @@ shift1_data_saved (struct salinfo_data *data, int shift)
193 * The buffer passed from mca.c points to the output from ia64_log_get. This is 198 * The buffer passed from mca.c points to the output from ia64_log_get. This is
194 * a persistent buffer but its contents can change between the interrupt and 199 * a persistent buffer but its contents can change between the interrupt and
195 * when user space processes the record. Save the record id to identify 200 * when user space processes the record. Save the record id to identify
196 * changes. 201 * changes. If the buffer is NULL then just update the bitmap.
197 */ 202 */
198void 203void
199salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe) 204salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
@@ -206,27 +211,29 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
206 211
207 BUG_ON(type >= ARRAY_SIZE(salinfo_log_name)); 212 BUG_ON(type >= ARRAY_SIZE(salinfo_log_name));
208 213
209 if (irqsafe) 214 if (buffer) {
210 spin_lock_irqsave(&data_saved_lock, flags); 215 if (irqsafe)
211 for (i = 0, data_saved = data->data_saved; i < saved_size; ++i, ++data_saved) { 216 spin_lock_irqsave(&data_saved_lock, flags);
212 if (!data_saved->buffer) 217 for (i = 0, data_saved = data->data_saved; i < saved_size; ++i, ++data_saved) {
213 break; 218 if (!data_saved->buffer)
214 } 219 break;
215 if (i == saved_size) { 220 }
216 if (!data->saved_num) { 221 if (i == saved_size) {
217 shift1_data_saved(data, 0); 222 if (!data->saved_num) {
218 data_saved = data->data_saved + saved_size - 1; 223 shift1_data_saved(data, 0);
219 } else 224 data_saved = data->data_saved + saved_size - 1;
220 data_saved = NULL; 225 } else
221 } 226 data_saved = NULL;
222 if (data_saved) { 227 }
223 data_saved->cpu = smp_processor_id(); 228 if (data_saved) {
224 data_saved->id = ((sal_log_record_header_t *)buffer)->id; 229 data_saved->cpu = smp_processor_id();
225 data_saved->size = size; 230 data_saved->id = ((sal_log_record_header_t *)buffer)->id;
226 data_saved->buffer = buffer; 231 data_saved->size = size;
232 data_saved->buffer = buffer;
233 }
234 if (irqsafe)
235 spin_unlock_irqrestore(&data_saved_lock, flags);
227 } 236 }
228 if (irqsafe)
229 spin_unlock_irqrestore(&data_saved_lock, flags);
230 237
231 if (!test_and_set_bit(smp_processor_id(), &data->cpu_event)) { 238 if (!test_and_set_bit(smp_processor_id(), &data->cpu_event)) {
232 if (irqsafe) 239 if (irqsafe)
@@ -244,7 +251,7 @@ salinfo_timeout_check(struct salinfo_data *data)
244 int i; 251 int i;
245 if (!data->open) 252 if (!data->open)
246 return; 253 return;
247 for (i = 0; i < NR_CPUS; ++i) { 254 for_each_online_cpu(i) {
248 if (test_bit(i, &data->cpu_event)) { 255 if (test_bit(i, &data->cpu_event)) {
249 /* double up() is not a problem, user space will see no 256 /* double up() is not a problem, user space will see no
250 * records for the additional "events". 257 * records for the additional "events".
@@ -291,7 +298,7 @@ retry:
291 298
292 n = data->cpu_check; 299 n = data->cpu_check;
293 for (i = 0; i < NR_CPUS; i++) { 300 for (i = 0; i < NR_CPUS; i++) {
294 if (test_bit(n, &data->cpu_event)) { 301 if (test_bit(n, &data->cpu_event) && cpu_online(n)) {
295 cpu = n; 302 cpu = n;
296 break; 303 break;
297 } 304 }
@@ -585,11 +592,10 @@ salinfo_init(void)
585 592
586 /* we missed any events before now */ 593 /* we missed any events before now */
587 online = 0; 594 online = 0;
588 for (j = 0; j < NR_CPUS; j++) 595 for_each_online_cpu(j) {
589 if (cpu_online(j)) { 596 set_bit(j, &data->cpu_event);
590 set_bit(j, &data->cpu_event); 597 ++online;
591 ++online; 598 }
592 }
593 sema_init(&data->sem, online); 599 sema_init(&data->sem, online);
594 600
595 *sdir++ = dir; 601 *sdir++ = dir;
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 84f89da7c640..1f5c26dbe705 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -384,7 +384,7 @@ setup_arch (char **cmdline_p)
384 if (early_console_setup(*cmdline_p) == 0) 384 if (early_console_setup(*cmdline_p) == 0)
385 mark_bsp_online(); 385 mark_bsp_online();
386 386
387#ifdef CONFIG_ACPI_BOOT 387#ifdef CONFIG_ACPI
388 /* Initialize the ACPI boot-time table parser */ 388 /* Initialize the ACPI boot-time table parser */
389 acpi_table_init(); 389 acpi_table_init();
390# ifdef CONFIG_ACPI_NUMA 390# ifdef CONFIG_ACPI_NUMA
@@ -420,7 +420,7 @@ setup_arch (char **cmdline_p)
420 420
421 cpu_init(); /* initialize the bootstrap CPU */ 421 cpu_init(); /* initialize the bootstrap CPU */
422 422
423#ifdef CONFIG_ACPI_BOOT 423#ifdef CONFIG_ACPI
424 acpi_boot_init(); 424 acpi_boot_init();
425#endif 425#endif
426 426
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index 92ff46ad21e2..706b7734e191 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -36,7 +36,7 @@ int arch_register_cpu(int num)
36 parent = &sysfs_nodes[cpu_to_node(num)]; 36 parent = &sysfs_nodes[cpu_to_node(num)];
37#endif /* CONFIG_NUMA */ 37#endif /* CONFIG_NUMA */
38 38
39#ifdef CONFIG_ACPI_BOOT 39#ifdef CONFIG_ACPI
40 /* 40 /*
41 * If CPEI cannot be re-targetted, and this is 41 * If CPEI cannot be re-targetted, and this is
42 * CPEI target, then dont create the control file 42 * CPEI target, then dont create the control file
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 3288be47bc75..93d5a3b41f69 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -2020,28 +2020,6 @@ init_frame_info (struct unw_frame_info *info, struct task_struct *t,
2020} 2020}
2021 2021
2022void 2022void
2023unw_init_from_interruption (struct unw_frame_info *info, struct task_struct *t,
2024 struct pt_regs *pt, struct switch_stack *sw)
2025{
2026 unsigned long sof;
2027
2028 init_frame_info(info, t, sw, pt->r12);
2029 info->cfm_loc = &pt->cr_ifs;
2030 info->unat_loc = &pt->ar_unat;
2031 info->pfs_loc = &pt->ar_pfs;
2032 sof = *info->cfm_loc & 0x7f;
2033 info->bsp = (unsigned long) ia64_rse_skip_regs((unsigned long *) info->regstk.top, -sof);
2034 info->ip = pt->cr_iip + ia64_psr(pt)->ri;
2035 info->pt = (unsigned long) pt;
2036 UNW_DPRINT(3, "unwind.%s:\n"
2037 " bsp 0x%lx\n"
2038 " sof 0x%lx\n"
2039 " ip 0x%lx\n",
2040 __FUNCTION__, info->bsp, sof, info->ip);
2041 find_save_locs(info);
2042}
2043
2044void
2045unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t, struct switch_stack *sw) 2023unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t, struct switch_stack *sw)
2046{ 2024{
2047 unsigned long sol; 2025 unsigned long sol;
diff --git a/arch/ia64/lib/memcpy_mck.S b/arch/ia64/lib/memcpy_mck.S
index 6f308e62c137..46c9331e7ab5 100644
--- a/arch/ia64/lib/memcpy_mck.S
+++ b/arch/ia64/lib/memcpy_mck.S
@@ -625,8 +625,11 @@ EK(.ex_handler, (p17) st8 [dst1]=r39,8); \
625 clrrrb 625 clrrrb
626 ;; 626 ;;
627 alloc saved_pfs_stack=ar.pfs,3,3,3,0 627 alloc saved_pfs_stack=ar.pfs,3,3,3,0
628 cmp.lt p8,p0=A,r0
628 sub B = dst0, saved_in0 // how many byte copied so far 629 sub B = dst0, saved_in0 // how many byte copied so far
629 ;; 630 ;;
631(p8) mov A = 0; // A shouldn't be negative, cap it
632 ;;
630 sub C = A, B 633 sub C = A, B
631 sub D = saved_in2, A 634 sub D = saved_in2, A
632 ;; 635 ;;
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 24614869e866..3c32af910d60 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -230,9 +230,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
230 return; 230 return;
231 } 231 }
232 232
233 if (ia64_done_with_exception(regs))
234 return;
235
236 /* 233 /*
237 * Since we have no vma's for region 5, we might get here even if the address is 234 * Since we have no vma's for region 5, we might get here even if the address is
238 * valid, due to the VHPT walker inserting a non present translation that becomes 235 * valid, due to the VHPT walker inserting a non present translation that becomes
@@ -243,6 +240,9 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
243 if (REGION_NUMBER(address) == 5 && mapped_kernel_page_is_present(address)) 240 if (REGION_NUMBER(address) == 5 && mapped_kernel_page_is_present(address))
244 return; 241 return;
245 242
243 if (ia64_done_with_exception(regs))
244 return;
245
246 /* 246 /*
247 * Oops. The kernel tried to access some bad page. We'll have to terminate things 247 * Oops. The kernel tried to access some bad page. We'll have to terminate things
248 * with extreme prejudice. 248 * with extreme prejudice.
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 65f9958db9f0..1281c609ee98 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -382,13 +382,22 @@ ia64_mmu_init (void *my_cpu_data)
382 382
383 if (impl_va_bits < 51 || impl_va_bits > 61) 383 if (impl_va_bits < 51 || impl_va_bits > 61)
384 panic("CPU has bogus IMPL_VA_MSB value of %lu!\n", impl_va_bits - 1); 384 panic("CPU has bogus IMPL_VA_MSB value of %lu!\n", impl_va_bits - 1);
385 /*
386 * mapped_space_bits - PAGE_SHIFT is the total number of ptes we need,
387 * which must fit into "vmlpt_bits - pte_bits" slots. Second half of
388 * the test makes sure that our mapped space doesn't overlap the
389 * unimplemented hole in the middle of the region.
390 */
391 if ((mapped_space_bits - PAGE_SHIFT > vmlpt_bits - pte_bits) ||
392 (mapped_space_bits > impl_va_bits - 1))
393 panic("Cannot build a big enough virtual-linear page table"
394 " to cover mapped address space.\n"
395 " Try using a smaller page size.\n");
396
385 397
386 /* place the VMLPT at the end of each page-table mapped region: */ 398 /* place the VMLPT at the end of each page-table mapped region: */
387 pta = POW2(61) - POW2(vmlpt_bits); 399 pta = POW2(61) - POW2(vmlpt_bits);
388 400
389 if (POW2(mapped_space_bits) >= pta)
390 panic("mm/init: overlap between virtually mapped linear page table and "
391 "mapped kernel space!");
392 /* 401 /*
393 * Set the (virtually mapped linear) page table address. Bit 402 * Set the (virtually mapped linear) page table address. Bit
394 * 8 selects between the short and long format, bits 2-7 the 403 * 8 selects between the short and long format, bits 2-7 the
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 9977c122e9fa..9b5de589b82f 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -498,13 +498,11 @@ pcibios_enable_device (struct pci_dev *dev, int mask)
498 return acpi_pci_irq_enable(dev); 498 return acpi_pci_irq_enable(dev);
499} 499}
500 500
501#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
502void 501void
503pcibios_disable_device (struct pci_dev *dev) 502pcibios_disable_device (struct pci_dev *dev)
504{ 503{
505 acpi_pci_irq_disable(dev); 504 acpi_pci_irq_disable(dev);
506} 505}
507#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
508 506
509void 507void
510pcibios_align_resource (void *data, struct resource *res, 508pcibios_align_resource (void *data, struct resource *res,
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 9fc74631ba8a..01d18b7b5bb3 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -23,7 +23,7 @@ static void force_interrupt(int irq);
23static void register_intr_pda(struct sn_irq_info *sn_irq_info); 23static void register_intr_pda(struct sn_irq_info *sn_irq_info);
24static void unregister_intr_pda(struct sn_irq_info *sn_irq_info); 24static void unregister_intr_pda(struct sn_irq_info *sn_irq_info);
25 25
26extern int sn_force_interrupt_flag; 26int sn_force_interrupt_flag = 1;
27extern int sn_ioif_inited; 27extern int sn_ioif_inited;
28static struct list_head **sn_irq_lh; 28static struct list_head **sn_irq_lh;
29static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */ 29static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index a594aca959e6..6f8c5883716b 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -49,6 +49,7 @@
49#include <asm/sn/clksupport.h> 49#include <asm/sn/clksupport.h>
50#include <asm/sn/sn_sal.h> 50#include <asm/sn/sn_sal.h>
51#include <asm/sn/geo.h> 51#include <asm/sn/geo.h>
52#include <asm/sn/sn_feature_sets.h>
52#include "xtalk/xwidgetdev.h" 53#include "xtalk/xwidgetdev.h"
53#include "xtalk/hubdev.h" 54#include "xtalk/hubdev.h"
54#include <asm/sn/klconfig.h> 55#include <asm/sn/klconfig.h>
@@ -56,7 +57,7 @@
56 57
57DEFINE_PER_CPU(struct pda_s, pda_percpu); 58DEFINE_PER_CPU(struct pda_s, pda_percpu);
58 59
59#define MAX_PHYS_MEMORY (1UL << 49) /* 1 TB */ 60#define MAX_PHYS_MEMORY (1UL << IA64_MAX_PHYS_BITS) /* Max physical address supported */
60 61
61lboard_t *root_lboard[MAX_COMPACT_NODES]; 62lboard_t *root_lboard[MAX_COMPACT_NODES];
62 63
@@ -97,6 +98,7 @@ EXPORT_SYMBOL(sn_region_size);
97int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */ 98int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */
98 99
99short physical_node_map[MAX_PHYSNODE_ID]; 100short physical_node_map[MAX_PHYSNODE_ID];
101static unsigned long sn_prom_features[MAX_PROM_FEATURE_SETS];
100 102
101EXPORT_SYMBOL(physical_node_map); 103EXPORT_SYMBOL(physical_node_map);
102 104
@@ -271,7 +273,10 @@ void __init sn_setup(char **cmdline_p)
271 u32 version = sn_sal_rev(); 273 u32 version = sn_sal_rev();
272 extern void sn_cpu_init(void); 274 extern void sn_cpu_init(void);
273 275
274 ia64_sn_plat_set_error_handling_features(); 276 ia64_sn_plat_set_error_handling_features(); // obsolete
277 ia64_sn_set_os_feature(OSF_MCA_SLV_TO_OS_INIT_SLV);
278 ia64_sn_set_os_feature(OSF_FEAT_LOG_SBES);
279
275 280
276#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) 281#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
277 /* 282 /*
@@ -314,16 +319,6 @@ void __init sn_setup(char **cmdline_p)
314 319
315 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF); 320 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
316 321
317 /*
318 * Confirm the SAL we're running on is recent enough...
319 */
320 if (version < SN_SAL_MIN_VERSION) {
321 printk(KERN_ERR "This kernel needs SGI SAL version >= "
322 "%x.%02x\n", SN_SAL_MIN_VERSION >> 8,
323 SN_SAL_MIN_VERSION & 0x00FF);
324 panic("PROM version too old\n");
325 }
326
327 master_nasid = boot_get_nasid(); 322 master_nasid = boot_get_nasid();
328 323
329 status = 324 status =
@@ -480,6 +475,10 @@ void __init sn_cpu_init(void)
480 if (nodepdaindr[0] == NULL) 475 if (nodepdaindr[0] == NULL)
481 return; 476 return;
482 477
478 for (i = 0; i < MAX_PROM_FEATURE_SETS; i++)
479 if (ia64_sn_get_prom_feature_set(i, &sn_prom_features[i]) != 0)
480 break;
481
483 cpuid = smp_processor_id(); 482 cpuid = smp_processor_id();
484 cpuphyid = get_sapicid(); 483 cpuphyid = get_sapicid();
485 484
@@ -651,3 +650,12 @@ nasid_slice_to_cpuid(int nasid, int slice)
651 650
652 return -1; 651 return -1;
653} 652}
653
654int sn_prom_feature_available(int id)
655{
656 if (id >= BITS_PER_LONG * MAX_PROM_FEATURE_SETS)
657 return 0;
658 return test_bit(id, sn_prom_features);
659}
660EXPORT_SYMBOL(sn_prom_feature_available);
661
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index 51bf82720d99..a06719d752a0 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -52,7 +52,7 @@ static int licenseID_open(struct inode *inode, struct file *file)
52 * the bridge chip. The hardware will then send an interrupt message if the 52 * the bridge chip. The hardware will then send an interrupt message if the
53 * interrupt line is active. This mimics a level sensitive interrupt. 53 * interrupt line is active. This mimics a level sensitive interrupt.
54 */ 54 */
55int sn_force_interrupt_flag = 1; 55extern int sn_force_interrupt_flag;
56 56
57static int sn_force_interrupt_show(struct seq_file *s, void *p) 57static int sn_force_interrupt_show(struct seq_file *s, void *p)
58{ 58{
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index bb1d5cf30440..ed7c21586e98 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -885,6 +885,10 @@ xpc_init(void)
885 pid_t pid; 885 pid_t pid;
886 886
887 887
888 if (!ia64_platform_is("sn2")) {
889 return -ENODEV;
890 }
891
888 /* 892 /*
889 * xpc_remote_copy_buffer is used as a temporary buffer for bte_copy'ng 893 * xpc_remote_copy_buffer is used as a temporary buffer for bte_copy'ng
890 * both a partition's reserved page and its XPC variables. Its size was 894 * both a partition's reserved page and its XPC variables. Its size was
diff --git a/arch/ia64/sn/kernel/xpnet.c b/arch/ia64/sn/kernel/xpnet.c
index 78c13d676fa6..e5c6d3c0a8e9 100644
--- a/arch/ia64/sn/kernel/xpnet.c
+++ b/arch/ia64/sn/kernel/xpnet.c
@@ -130,7 +130,7 @@ struct net_device *xpnet_device;
130 */ 130 */
131static u64 xpnet_broadcast_partitions; 131static u64 xpnet_broadcast_partitions;
132/* protect above */ 132/* protect above */
133static spinlock_t xpnet_broadcast_lock = SPIN_LOCK_UNLOCKED; 133static DEFINE_SPINLOCK(xpnet_broadcast_lock);
134 134
135/* 135/*
136 * Since the Block Transfer Engine (BTE) is being used for the transfer 136 * Since the Block Transfer Engine (BTE) is being used for the transfer
@@ -636,6 +636,10 @@ xpnet_init(void)
636 int result = -ENOMEM; 636 int result = -ENOMEM;
637 637
638 638
639 if (!ia64_platform_is("sn2")) {
640 return -ENODEV;
641 }
642
639 dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME); 643 dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME);
640 644
641 /* 645 /*
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 7622d4ec5f08..1ef3987ebc6a 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -242,8 +242,8 @@ config SMP
242 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power 242 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
243 Management" code will be disabled if you say Y here. 243 Management" code will be disabled if you say Y here.
244 244
245 See also the <file:Documentation/smp.tex>, 245 See also the <file:Documentation/smp.txt>,
246 <file:Documentation/smp.txt> and the SMP-HOWTO available at 246 and the SMP-HOWTO available at
247 <http://www.linuxdoc.org/docs.html#howto>. 247 <http://www.linuxdoc.org/docs.html#howto>.
248 248
249 If you don't know what to do here, say N. 249 If you don't know what to do here, say N.
diff --git a/arch/m32r/kernel/asm-offsets.c b/arch/m32r/kernel/asm-offsets.c
new file mode 100644
index 000000000000..9e263112a6e2
--- /dev/null
+++ b/arch/m32r/kernel/asm-offsets.c
@@ -0,0 +1 @@
/* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index 48b187f2d2b3..a4576ac7e870 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -892,7 +892,6 @@ unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num,
892 int try) 892 int try)
893{ 893{
894 spinlock_t *ipilock; 894 spinlock_t *ipilock;
895 unsigned long flags = 0;
896 volatile unsigned long *ipicr_addr; 895 volatile unsigned long *ipicr_addr;
897 unsigned long ipicr_val; 896 unsigned long ipicr_val;
898 unsigned long my_physid_mask; 897 unsigned long my_physid_mask;
@@ -916,50 +915,27 @@ unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num,
916 * write IPICRi (send IPIi) 915 * write IPICRi (send IPIi)
917 * unlock ipi_lock[i] 916 * unlock ipi_lock[i]
918 */ 917 */
918 spin_lock(ipilock);
919 __asm__ __volatile__ ( 919 __asm__ __volatile__ (
920 ";; LOCK ipi_lock[i] \n\t" 920 ";; CHECK IPICRi == 0 \n\t"
921 ".fillinsn \n" 921 ".fillinsn \n"
922 "1: \n\t" 922 "1: \n\t"
923 "mvfc %1, psw \n\t" 923 "ld %0, @%1 \n\t"
924 "clrpsw #0x40 -> nop \n\t" 924 "and %0, %4 \n\t"
925 DCACHE_CLEAR("r4", "r5", "%2") 925 "beqz %0, 2f \n\t"
926 "lock r4, @%2 \n\t" 926 "bnez %3, 3f \n\t"
927 "addi r4, #-1 \n\t"
928 "unlock r4, @%2 \n\t"
929 "mvtc %1, psw \n\t"
930 "bnez r4, 2f \n\t"
931 LOCK_SECTION_START(".balign 4 \n\t")
932 ".fillinsn \n"
933 "2: \n\t"
934 "ld r4, @%2 \n\t"
935 "blez r4, 2b \n\t"
936 "bra 1b \n\t" 927 "bra 1b \n\t"
937 LOCK_SECTION_END
938 ";; CHECK IPICRi == 0 \n\t"
939 ".fillinsn \n"
940 "3: \n\t"
941 "ld %0, @%3 \n\t"
942 "and %0, %6 \n\t"
943 "beqz %0, 4f \n\t"
944 "bnez %5, 5f \n\t"
945 "bra 3b \n\t"
946 ";; WRITE IPICRi (send IPIi) \n\t" 928 ";; WRITE IPICRi (send IPIi) \n\t"
947 ".fillinsn \n" 929 ".fillinsn \n"
948 "4: \n\t" 930 "2: \n\t"
949 "st %4, @%3 \n\t" 931 "st %2, @%1 \n\t"
950 ";; UNLOCK ipi_lock[i] \n\t"
951 ".fillinsn \n" 932 ".fillinsn \n"
952 "5: \n\t" 933 "3: \n\t"
953 "ldi r4, #1 \n\t"
954 "st r4, @%2 \n\t"
955 : "=&r"(ipicr_val) 934 : "=&r"(ipicr_val)
956 : "r"(flags), "r"(&ipilock->slock), "r"(ipicr_addr), 935 : "r"(ipicr_addr), "r"(mask), "r"(try), "r"(my_physid_mask)
957 "r"(mask), "r"(try), "r"(my_physid_mask) 936 : "memory"
958 : "memory", "r4"
959#ifdef CONFIG_CHIP_M32700_TS1
960 , "r5"
961#endif /* CONFIG_CHIP_M32700_TS1 */
962 ); 937 );
938 spin_unlock(ipilock);
963 939
964 return ipicr_val; 940 return ipicr_val;
965} 941}
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 466e7407afc7..34d826d10f1b 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -113,14 +113,5 @@ else
113 bzip2 -1c vmlinux >vmlinux.bz2 113 bzip2 -1c vmlinux >vmlinux.bz2
114endif 114endif
115 115
116prepare: include/asm-$(ARCH)/offsets.h
117CLEAN_FILES += include/asm-$(ARCH)/offsets.h
118
119arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
120 include/config/MARKER
121
122include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
123 $(call filechk,gen-asm-offsets)
124
125archclean: 116archclean:
126 rm -f vmlinux.gz vmlinux.bz2 117 rm -f vmlinux.gz vmlinux.bz2
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index cb5d93630467..bd5d134e9f12 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -63,7 +63,7 @@ void __init amiga_init_sound(void)
63} 63}
64 64
65static void nosound( unsigned long ignored ); 65static void nosound( unsigned long ignored );
66static struct timer_list sound_timer = TIMER_INITIALIZER(nosound, 0, 0); 66static DEFINE_TIMER(sound_timer, nosound, 0, 0);
67 67
68void amiga_mksound( unsigned int hz, unsigned int ticks ) 68void amiga_mksound( unsigned int hz, unsigned int ticks )
69{ 69{
diff --git a/arch/m68k/fpsp040/skeleton.S b/arch/m68k/fpsp040/skeleton.S
index dbc1255a5e99..9571a21d6ad4 100644
--- a/arch/m68k/fpsp040/skeleton.S
+++ b/arch/m68k/fpsp040/skeleton.S
@@ -40,7 +40,7 @@
40 40
41#include <linux/linkage.h> 41#include <linux/linkage.h>
42#include <asm/entry.h> 42#include <asm/entry.h>
43#include <asm/offsets.h> 43#include <asm/asm-offsets.h>
44 44
45|SKELETON idnt 2,1 | Motorola 040 Floating Point Software Package 45|SKELETON idnt 2,1 | Motorola 040 Floating Point Software Package
46 46
diff --git a/arch/m68k/ifpsp060/iskeleton.S b/arch/m68k/ifpsp060/iskeleton.S
index 803a6ecdda81..4ba2c74da93d 100644
--- a/arch/m68k/ifpsp060/iskeleton.S
+++ b/arch/m68k/ifpsp060/iskeleton.S
@@ -36,7 +36,7 @@
36 36
37#include <linux/linkage.h> 37#include <linux/linkage.h>
38#include <asm/entry.h> 38#include <asm/entry.h>
39#include <asm/offsets.h> 39#include <asm/asm-offsets.h>
40 40
41 41
42|################################ 42|################################
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index e964015a31dc..23ca60a45552 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -42,7 +42,7 @@
42#include <asm/traps.h> 42#include <asm/traps.h>
43#include <asm/unistd.h> 43#include <asm/unistd.h>
44 44
45#include <asm/offsets.h> 45#include <asm/asm-offsets.h>
46 46
47.globl system_call, buserr, trap 47.globl system_call, buserr, trap
48.globl resume, ret_from_exception 48.globl resume, ret_from_exception
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 7cd6de17c20d..d4336d846df1 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -263,7 +263,7 @@
263#include <asm/entry.h> 263#include <asm/entry.h>
264#include <asm/pgtable.h> 264#include <asm/pgtable.h>
265#include <asm/page.h> 265#include <asm/page.h>
266#include <asm/offsets.h> 266#include <asm/asm-offsets.h>
267 267
268#ifdef CONFIG_MAC 268#ifdef CONFIG_MAC
269 269
diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
index 44c5cd2ad6a8..8f0640847ad2 100644
--- a/arch/m68k/mac/macboing.c
+++ b/arch/m68k/mac/macboing.c
@@ -56,8 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int );
56/* 56/*
57 * our timer to start/continue/stop the bell 57 * our timer to start/continue/stop the bell
58 */ 58 */
59static struct timer_list mac_sound_timer = 59static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0);
60 TIMER_INITIALIZER(mac_nosound, 0, 0);
61 60
62/* 61/*
63 * Sort of initialize the sound chip (called from mac_mksound on the first 62 * Sort of initialize the sound chip (called from mac_mksound on the first
diff --git a/arch/m68k/math-emu/fp_emu.h b/arch/m68k/math-emu/fp_emu.h
index 1d6edc975d89..c1ecfef7886a 100644
--- a/arch/m68k/math-emu/fp_emu.h
+++ b/arch/m68k/math-emu/fp_emu.h
@@ -39,7 +39,7 @@
39#define _FP_EMU_H 39#define _FP_EMU_H
40 40
41#ifdef __ASSEMBLY__ 41#ifdef __ASSEMBLY__
42#include <asm/offsets.h> 42#include <asm/asm-offsets.h>
43#endif 43#endif
44#include <asm/math-emu.h> 44#include <asm/math-emu.h>
45 45
diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index 7ce5e55b2401..b8fdf191b8f6 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -102,21 +102,11 @@ CFLAGS += -DUTS_SYSNAME=\"uClinux\"
102 102
103head-y := arch/m68knommu/platform/$(cpuclass-y)/head.o 103head-y := arch/m68knommu/platform/$(cpuclass-y)/head.o
104 104
105CLEAN_FILES := include/asm-$(ARCH)/asm-offsets.h \
106 arch/$(ARCH)/kernel/asm-offsets.s
107
108core-y += arch/m68knommu/kernel/ \ 105core-y += arch/m68knommu/kernel/ \
109 arch/m68knommu/mm/ \ 106 arch/m68knommu/mm/ \
110 $(CLASSDIR) \ 107 $(CLASSDIR) \
111 arch/m68knommu/platform/$(PLATFORM)/ 108 arch/m68knommu/platform/$(PLATFORM)/
112libs-y += arch/m68knommu/lib/ 109libs-y += arch/m68knommu/lib/
113 110
114prepare: include/asm-$(ARCH)/asm-offsets.h
115
116archclean: 111archclean:
117 $(Q)$(MAKE) $(clean)=arch/m68knommu/boot 112 $(Q)$(MAKE) $(clean)=arch/m68knommu/boot
118
119include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \
120 include/asm include/linux/version.h \
121 include/config/MARKER
122 $(call filechk,gen-asm-offsets)
diff --git a/arch/m68knommu/platform/523x/Makefile b/arch/m68knommu/platform/523x/Makefile
new file mode 100644
index 000000000000..c1578b016160
--- /dev/null
+++ b/arch/m68knommu/platform/523x/Makefile
@@ -0,0 +1,19 @@
1#
2# Makefile for the m68knommu linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# EXTRA_CFLAGS += -DTRAP_DBG_INTERRUPT
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13#
14
15ifdef CONFIG_FULLDEBUG
16AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18
19obj-y := config.o
diff --git a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c
index 5cb28690f89a..cf36e7d007b9 100644
--- a/arch/m68knommu/platform/5272/config.c
+++ b/arch/m68knommu/platform/5272/config.c
@@ -104,11 +104,11 @@ int mcf_timerirqpending(int timer)
104 104
105void config_BSP(char *commandp, int size) 105void config_BSP(char *commandp, int size)
106{ 106{
107#if 0 107#if defined (CONFIG_MOD5272)
108 volatile unsigned long *pivrp; 108 volatile unsigned char *pivrp;
109 109
110 /* Set base of device vectors to be 64 */ 110 /* Set base of device vectors to be 64 */
111 pivrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PIVR); 111 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
112 *pivrp = 0x40; 112 *pivrp = 0x40;
113#endif 113#endif
114 114
diff --git a/arch/m68knommu/platform/5307/Makefile b/arch/m68knommu/platform/5307/Makefile
index 84b6b70641e1..6fe5a2b8fb08 100644
--- a/arch/m68knommu/platform/5307/Makefile
+++ b/arch/m68knommu/platform/5307/Makefile
@@ -19,6 +19,7 @@ endif
19obj-$(CONFIG_COLDFIRE) += entry.o vectors.o ints.o 19obj-$(CONFIG_COLDFIRE) += entry.o vectors.o ints.o
20obj-$(CONFIG_M5206) += timers.o 20obj-$(CONFIG_M5206) += timers.o
21obj-$(CONFIG_M5206e) += timers.o 21obj-$(CONFIG_M5206e) += timers.o
22obj-$(CONFIG_M523x) += pit.o
22obj-$(CONFIG_M5249) += timers.o 23obj-$(CONFIG_M5249) += timers.o
23obj-$(CONFIG_M527x) += pit.o 24obj-$(CONFIG_M527x) += pit.o
24obj-$(CONFIG_M5272) += timers.o 25obj-$(CONFIG_M5272) += timers.o
diff --git a/arch/m68knommu/platform/68328/config.c b/arch/m68knommu/platform/68328/config.c
index fd7c93f86481..bcfa5d7fe1e2 100644
--- a/arch/m68knommu/platform/68328/config.c
+++ b/arch/m68knommu/platform/68328/config.c
@@ -1,5 +1,7 @@
1/***************************************************************************/
2
1/* 3/*
2 * linux/arch/$(ARCH)/platform/$(PLATFORM)/config.c 4 * linux/arch/m68knommu/platform/68328/config.c
3 * 5 *
4 * Copyright (C) 1993 Hamish Macdonald 6 * Copyright (C) 1993 Hamish Macdonald
5 * Copyright (C) 1999 D. Jeff Dionne 7 * Copyright (C) 1999 D. Jeff Dionne
@@ -11,6 +13,8 @@
11 * VZ Support/Fixes Evan Stawnyczy <e@lineo.ca> 13 * VZ Support/Fixes Evan Stawnyczy <e@lineo.ca>
12 */ 14 */
13 15
16/***************************************************************************/
17
14#include <asm/dbg.h> 18#include <asm/dbg.h>
15#include <stdarg.h> 19#include <stdarg.h>
16#include <linux/config.h> 20#include <linux/config.h>
@@ -29,76 +33,16 @@
29#include <asm/machdep.h> 33#include <asm/machdep.h>
30#include <asm/MC68328.h> 34#include <asm/MC68328.h>
31 35
36/***************************************************************************/
32 37
33void BSP_sched_init(irqreturn_t (*timer_routine)(int, void *, struct pt_regs *)) 38void m68328_timer_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *));
34{ 39void m68328_timer_tick(void);
35 40unsigned long m68328_timer_gettimeoffset(void);
36#ifdef CONFIG_XCOPILOT_BUGS 41void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec);
37 /*
38 * The only thing I know is that CLK32 is not available on Xcopilot
39 * I have little idea about what frequency SYSCLK has on Xcopilot.
40 * The values for prescaler and compare registers were simply
41 * taken from the original source
42 */
43
44 /* Restart mode, Enable int, SYSCLK, Enable timer */
45 TCTL2 = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_SYSCLK | TCTL_TEN;
46 /* Set prescaler */
47 TPRER2 = 2;
48 /* Set compare register */
49 TCMP2 = 0xd7e4;
50#else
51 /* Restart mode, Enable int, 32KHz, Enable timer */
52 TCTL2 = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN;
53 /* Set prescaler (Divide 32KHz by 32)*/
54 TPRER2 = 31;
55 /* Set compare register 32Khz / 32 / 10 = 100 */
56 TCMP2 = 10;
57#endif
58
59 request_irq(TMR2_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
60}
61
62void BSP_tick(void)
63{
64 /* Reset Timer2 */
65 TSTAT2 &= 0;
66}
67 42
68unsigned long BSP_gettimeoffset (void) 43/***************************************************************************/
69{
70 return 0;
71}
72 44
73void BSP_gettod (int *yearp, int *monp, int *dayp, 45void m68328_reset (void)
74 int *hourp, int *minp, int *secp)
75{
76}
77
78int BSP_hwclk(int op, struct hwclk_time *t)
79{
80 if (!op) {
81 /* read */
82 } else {
83 /* write */
84 }
85 return 0;
86}
87
88int BSP_set_clock_mmss (unsigned long nowtime)
89{
90#if 0
91 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
92
93 tod->second1 = real_seconds / 10;
94 tod->second2 = real_seconds % 10;
95 tod->minute1 = real_minutes / 10;
96 tod->minute2 = real_minutes % 10;
97#endif
98 return 0;
99}
100
101void BSP_reset (void)
102{ 46{
103 local_irq_disable(); 47 local_irq_disable();
104 asm volatile ("moveal #0x10c00000, %a0;\n\t" 48 asm volatile ("moveal #0x10c00000, %a0;\n\t"
@@ -108,18 +52,22 @@ void BSP_reset (void)
108 "jmp (%a0);"); 52 "jmp (%a0);");
109} 53}
110 54
55/***************************************************************************/
56
111void config_BSP(char *command, int len) 57void config_BSP(char *command, int len)
112{ 58{
113 printk(KERN_INFO "\n68328 support D. Jeff Dionne <jeff@uclinux.org>\n"); 59 printk(KERN_INFO "\n68328 support D. Jeff Dionne <jeff@uclinux.org>\n");
114 printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n"); 60 printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n");
115 printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n"); 61 printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n");
116 62
117 mach_sched_init = BSP_sched_init; 63 mach_sched_init = m68328_timer_init;
118 mach_tick = BSP_tick; 64 mach_tick = m68328_timer_tick;
119 mach_gettimeoffset = BSP_gettimeoffset; 65 mach_gettimeoffset = m68328_timer_gettimeoffset;
120 mach_gettod = BSP_gettod; 66 mach_gettod = m68328_timer_gettod;
121 mach_hwclk = NULL; 67 mach_hwclk = NULL;
122 mach_set_clock_mmss = NULL; 68 mach_set_clock_mmss = NULL;
123 mach_reset = BSP_reset; 69 mach_reset = m68328_reset;
124 *command = '\0'; 70 *command = '\0';
125} 71}
72
73/***************************************************************************/
diff --git a/arch/m68knommu/platform/68328/head-de2.S b/arch/m68knommu/platform/68328/head-de2.S
new file mode 100644
index 000000000000..94c5a1609a75
--- /dev/null
+++ b/arch/m68knommu/platform/68328/head-de2.S
@@ -0,0 +1,135 @@
1#include <linux/config.h>
2
3#if defined(CONFIG_RAM32MB)
4#define MEM_END 0x02000000 /* Memory size 32Mb */
5#elif defined(CONFIG_RAM16MB)
6#define MEM_END 0x01000000 /* Memory size 16Mb */
7#else
8#define MEM_END 0x00800000 /* Memory size 8Mb */
9#endif
10
11#undef CRT_DEBUG
12
13.macro PUTC CHAR
14#ifdef CRT_DEBUG
15 moveq #\CHAR, %d7
16 jsr putc
17#endif
18.endm
19
20 .global _start
21 .global _rambase
22 .global _ramvec
23 .global _ramstart
24 .global _ramend
25
26 .data
27
28/*
29 * Set up the usable of RAM stuff
30 */
31_rambase:
32 .long 0
33_ramvec:
34 .long 0
35_ramstart:
36 .long 0
37_ramend:
38 .long 0
39
40 .text
41
42_start:
43
44/*
45 * Setup initial stack
46 */
47 /* disable all interrupts */
48 movew #0x2700, %sr
49 movel #-1, 0xfffff304
50 movel #MEM_END-4, %sp
51
52 PUTC '\r'
53 PUTC '\n'
54 PUTC 'A'
55 PUTC 'B'
56
57/*
58 * Determine end of RAM
59 */
60
61 movel #MEM_END, %a0
62 movel %a0, _ramend
63
64 PUTC 'C'
65
66/*
67 * Move ROM filesystem above bss :-)
68 */
69
70 moveal #_sbss, %a0 /* romfs at the start of bss */
71 moveal #_ebss, %a1 /* Set up destination */
72 movel %a0, %a2 /* Copy of bss start */
73
74 movel 8(%a0), %d1 /* Get size of ROMFS */
75 addql #8, %d1 /* Allow for rounding */
76 andl #0xfffffffc, %d1 /* Whole words */
77
78 addl %d1, %a0 /* Copy from end */
79 addl %d1, %a1 /* Copy from end */
80 movel %a1, _ramstart /* Set start of ram */
81
821:
83 movel -(%a0), %d0 /* Copy dword */
84 movel %d0, -(%a1)
85 cmpl %a0, %a2 /* Check if at end */
86 bne 1b
87
88 PUTC 'D'
89
90/*
91 * Initialize BSS segment to 0
92 */
93
94 lea _sbss, %a0
95 lea _ebss, %a1
96
97 /* Copy 0 to %a0 until %a0 == %a1 */
982: cmpal %a0, %a1
99 beq 1f
100 clrl (%a0)+
101 bra 2b
1021:
103
104 PUTC 'E'
105
106/*
107 * Load the current task pointer and stack
108 */
109
110 lea init_thread_union, %a0
111 lea 0x2000(%a0), %sp
112
113 PUTC 'F'
114 PUTC '\r'
115 PUTC '\n'
116
117/*
118 * Go
119 */
120
121 jmp start_kernel
122
123/*
124 * Local functions
125 */
126
127#ifdef CRT_DEBUG
128putc:
129 moveb %d7, 0xfffff907
1301:
131 movew 0xfffff906, %d7
132 andw #0x2000, %d7
133 beq 1b
134 rts
135#endif
diff --git a/arch/m68knommu/platform/68328/timers.c b/arch/m68knommu/platform/68328/timers.c
new file mode 100644
index 000000000000..68c2cd6b0030
--- /dev/null
+++ b/arch/m68knommu/platform/68328/timers.c
@@ -0,0 +1,106 @@
1/***************************************************************************/
2
3/*
4 * linux/arch/m68knommu/platform/68328/timers.c
5 *
6 * Copyright (C) 1993 Hamish Macdonald
7 * Copyright (C) 1999 D. Jeff Dionne
8 * Copyright (C) 2001 Georges Menie, Ken Desmet
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive
12 * for more details.
13 */
14
15/***************************************************************************/
16
17#include <linux/config.h>
18#include <linux/types.h>
19#include <linux/kernel.h>
20#include <linux/mm.h>
21#include <asm/setup.h>
22#include <asm/system.h>
23#include <asm/pgtable.h>
24#include <asm/irq.h>
25#include <asm/machdep.h>
26#include <asm/MC68VZ328.h>
27
28/***************************************************************************/
29
30#if defined(CONFIG_DRAGEN2)
31/* with a 33.16 MHz clock, this will give usec resolution to the time functions */
32#define CLOCK_SOURCE TCTL_CLKSOURCE_SYSCLK
33#define CLOCK_PRE 7
34#define TICKS_PER_JIFFY 41450
35
36#elif defined(CONFIG_XCOPILOT_BUGS)
37/*
38 * The only thing I know is that CLK32 is not available on Xcopilot
39 * I have little idea about what frequency SYSCLK has on Xcopilot.
40 * The values for prescaler and compare registers were simply
41 * taken from the original source
42 */
43#define CLOCK_SOURCE TCTL_CLKSOURCE_SYSCLK
44#define CLOCK_PRE 2
45#define TICKS_PER_JIFFY 0xd7e4
46
47#else
48/* default to using the 32Khz clock */
49#define CLOCK_SOURCE TCTL_CLKSOURCE_32KHZ
50#define CLOCK_PRE 31
51#define TICKS_PER_JIFFY 10
52#endif
53
54/***************************************************************************/
55
56void m68328_timer_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *))
57{
58 /* disable timer 1 */
59 TCTL = 0;
60
61 /* set ISR */
62 if (request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL))
63 panic("Unable to attach timer interrupt\n");
64
65 /* Restart mode, Enable int, Set clock source */
66 TCTL = TCTL_OM | TCTL_IRQEN | CLOCK_SOURCE;
67 TPRER = CLOCK_PRE;
68 TCMP = TICKS_PER_JIFFY;
69
70 /* Enable timer 1 */
71 TCTL |= TCTL_TEN;
72}
73
74/***************************************************************************/
75
76void m68328_timer_tick(void)
77{
78 /* Reset Timer1 */
79 TSTAT &= 0;
80}
81/***************************************************************************/
82
83unsigned long m68328_timer_gettimeoffset(void)
84{
85 unsigned long ticks = TCN, offset = 0;
86
87 /* check for pending interrupt */
88 if (ticks < (TICKS_PER_JIFFY >> 1) && (ISR & (1 << TMR_IRQ_NUM)))
89 offset = 1000000 / HZ;
90 ticks = (ticks * 1000000 / HZ) / TICKS_PER_JIFFY;
91 return ticks + offset;
92}
93
94/***************************************************************************/
95
96void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec)
97{
98 long now = RTCTIME;
99
100 *year = *mon = *day = 1;
101 *hour = (now >> 24) % 24;
102 *min = (now >> 16) % 60;
103 *sec = now % 60;
104}
105
106/***************************************************************************/
diff --git a/arch/m68knommu/platform/68360/head-ram.S b/arch/m68knommu/platform/68360/head-ram.S
new file mode 100644
index 000000000000..a5c639a51eef
--- /dev/null
+++ b/arch/m68knommu/platform/68360/head-ram.S
@@ -0,0 +1,408 @@
1/* arch/m68knommu/platform/68360/head-ram.S
2 *
3 * Startup code for Motorola 68360
4 *
5 * Copyright 2001 (C) SED Systems, a Division of Calian Ltd.
6 * Based on: arch/m68knommu/platform/68328/pilot/crt0_rom.S
7 * Based on: arch/m68knommu/platform/68360/uCquicc/crt0_rom.S, 2.0.38.1.pre7
8 * uClinux Kernel
9 * Copyright (C) Michael Leslie <mleslie@lineo.com>
10 * Based on: arch/m68knommu/platform/68EZ328/ucsimm/crt0_rom.S
11 * Copyright (C) 1998 D. Jeff Dionne <jeff@uclinux.org>,
12 *
13 */
14#define ASSEMBLY
15#include <linux/config.h>
16
17.global _stext
18.global _start
19
20.global _rambase
21.global __ramvec
22.global _ramvec
23.global _ramstart
24.global _ramend
25
26.global _quicc_base
27.global _periph_base
28
29#define REGB 0x1000
30#define PEPAR (_dprbase + REGB + 0x0016)
31#define GMR (_dprbase + REGB + 0x0040)
32#define OR0 (_dprbase + REGB + 0x0054)
33#define BR0 (_dprbase + REGB + 0x0050)
34#define OR1 (_dprbase + REGB + 0x0064)
35#define BR1 (_dprbase + REGB + 0x0060)
36#define OR4 (_dprbase + REGB + 0x0094)
37#define BR4 (_dprbase + REGB + 0x0090)
38#define OR6 (_dprbase + REGB + 0x00b4)
39#define BR6 (_dprbase + REGB + 0x00b0)
40#define OR7 (_dprbase + REGB + 0x00c4)
41#define BR7 (_dprbase + REGB + 0x00c0)
42
43#define MCR (_dprbase + REGB + 0x0000)
44#define AVR (_dprbase + REGB + 0x0008)
45
46#define SYPCR (_dprbase + REGB + 0x0022)
47
48#define PLLCR (_dprbase + REGB + 0x0010)
49#define CLKOCR (_dprbase + REGB + 0x000C)
50#define CDVCR (_dprbase + REGB + 0x0014)
51
52#define BKAR (_dprbase + REGB + 0x0030)
53#define BKCR (_dprbase + REGB + 0x0034)
54#define SWIV (_dprbase + REGB + 0x0023)
55#define PICR (_dprbase + REGB + 0x0026)
56#define PITR (_dprbase + REGB + 0x002A)
57
58/* Define for all memory configuration */
59#define MCU_SIM_GMR 0x00000000
60#define SIM_OR_MASK 0x0fffffff
61
62/* Defines for chip select zero - the flash */
63#define SIM_OR0_MASK 0x20000002
64#define SIM_BR0_MASK 0x00000001
65
66
67/* Defines for chip select one - the RAM */
68#define SIM_OR1_MASK 0x10000000
69#define SIM_BR1_MASK 0x00000001
70
71#define MCU_SIM_MBAR_ADRS 0x0003ff00
72#define MCU_SIM_MBAR_BA_MASK 0xfffff000
73#define MCU_SIM_MBAR_AS_MASK 0x00000001
74
75#define MCU_SIM_PEPAR 0x00B4
76
77#define MCU_DISABLE_INTRPTS 0x2700
78#define MCU_SIM_AVR 0x00
79
80#define MCU_SIM_MCR 0x00005cff
81
82#define MCU_SIM_CLKOCR 0x00
83#define MCU_SIM_PLLCR 0x8000
84#define MCU_SIM_CDVCR 0x0000
85
86#define MCU_SIM_SYPCR 0x0000
87#define MCU_SIM_SWIV 0x00
88#define MCU_SIM_PICR 0x0000
89#define MCU_SIM_PITR 0x0000
90
91
92#include <asm/m68360_regs.h>
93
94
95/*
96 * By the time this RAM specific code begins to execute, DPRAM
97 * and DRAM should already be mapped and accessible.
98 */
99
100 .text
101_start:
102_stext:
103 nop
104 ori.w #MCU_DISABLE_INTRPTS, %sr /* disable interrupts: */
105 /* We should not need to setup the boot stack the reset should do it. */
106 movea.l #__ramend, %sp /*set up stack at the end of DRAM:*/
107
108set_mbar_register:
109 moveq.l #0x07, %d1 /* Setup MBAR */
110 movec %d1, %dfc
111
112 lea.l MCU_SIM_MBAR_ADRS, %a0
113 move.l #_dprbase, %d0
114 andi.l #MCU_SIM_MBAR_BA_MASK, %d0
115 ori.l #MCU_SIM_MBAR_AS_MASK, %d0
116 moves.l %d0, %a0@
117
118 moveq.l #0x05, %d1
119 movec.l %d1, %dfc
120
121 /* Now we can begin to access registers in DPRAM */
122
123set_sim_mcr:
124 /* Set Module Configuration Register */
125 move.l #MCU_SIM_MCR, MCR
126
127 /* to do: Determine cause of reset */
128
129 /*
130 * configure system clock MC68360 p. 6-40
131 * (value +1)*osc/128 = system clock
132 */
133set_sim_clock:
134 move.w #MCU_SIM_PLLCR, PLLCR
135 move.b #MCU_SIM_CLKOCR, CLKOCR
136 move.w #MCU_SIM_CDVCR, CDVCR
137
138 /* Wait for the PLL to settle */
139 move.w #16384, %d0
140pll_settle_wait:
141 subi.w #1, %d0
142 bne pll_settle_wait
143
144 /* Setup the system protection register, and watchdog timer register */
145 move.b #MCU_SIM_SWIV, SWIV
146 move.w #MCU_SIM_PICR, PICR
147 move.w #MCU_SIM_PITR, PITR
148 move.w #MCU_SIM_SYPCR, SYPCR
149
150 /* Clear DPRAM - system + parameter */
151 movea.l #_dprbase, %a0
152 movea.l #_dprbase+0x2000, %a1
153
154 /* Copy 0 to %a0 until %a0 == %a1 */
155clear_dpram:
156 movel #0, %a0@+
157 cmpal %a0, %a1
158 bhi clear_dpram
159
160configure_memory_controller:
161 /* Set up Global Memory Register (GMR) */
162 move.l #MCU_SIM_GMR, %d0
163 move.l %d0, GMR
164
165configure_chip_select_0:
166 move.l #__ramend, %d0
167 subi.l #__ramstart, %d0
168 subq.l #0x01, %d0
169 eori.l #SIM_OR_MASK, %d0
170 ori.l #SIM_OR0_MASK, %d0
171 move.l %d0, OR0
172
173 move.l #__ramstart, %d0
174 ori.l #SIM_BR0_MASK, %d0
175 move.l %d0, BR0
176
177configure_chip_select_1:
178 move.l #__rom_end, %d0
179 subi.l #__rom_start, %d0
180 subq.l #0x01, %d0
181 eori.l #SIM_OR_MASK, %d0
182 ori.l #SIM_OR1_MASK, %d0
183 move.l %d0, OR1
184
185 move.l #__rom_start, %d0
186 ori.l #SIM_BR1_MASK, %d0
187 move.l %d0, BR1
188
189 move.w #MCU_SIM_PEPAR, PEPAR
190
191 /* point to vector table: */
192 move.l #_romvec, %a0
193 move.l #_ramvec, %a1
194copy_vectors:
195 move.l %a0@, %d0
196 move.l %d0, %a1@
197 move.l %a0@, %a1@
198 addq.l #0x04, %a0
199 addq.l #0x04, %a1
200 cmp.l #_start, %a0
201 blt copy_vectors
202
203 move.l #_ramvec, %a1
204 movec %a1, %vbr
205
206
207 /* Copy data segment from ROM to RAM */
208 moveal #_stext, %a0
209 moveal #_sdata, %a1
210 moveal #_edata, %a2
211
212 /* Copy %a0 to %a1 until %a1 == %a2 */
213LD1:
214 move.l %a0@, %d0
215 addq.l #0x04, %a0
216 move.l %d0, %a1@
217 addq.l #0x04, %a1
218 cmp.l #_edata, %a1
219 blt LD1
220
221 moveal #_sbss, %a0
222 moveal #_ebss, %a1
223
224 /* Copy 0 to %a0 until %a0 == %a1 */
225L1:
226 movel #0, %a0@+
227 cmpal %a0, %a1
228 bhi L1
229
230load_quicc:
231 move.l #_dprbase, _quicc_base
232
233store_ram_size:
234 /* Set ram size information */
235 move.l #_sdata, _rambase
236 move.l #_ebss, _ramstart
237 move.l #__ramend, %d0
238 sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/
239 move.l %d0, _ramend /* Different from __ramend.*/
240
241store_flash_size:
242 /* Set rom size information */
243 move.l #__rom_end, %d0
244 sub.l #__rom_start, %d0
245 move.l %d0, rom_length
246
247 pea 0
248 pea env
249 pea %sp@(4)
250 pea 0
251
252 lea init_thread_union, %a2
253 lea 0x2000(%a2), %sp
254
255lp:
256 jsr start_kernel
257
258_exit:
259 jmp _exit
260
261
262 .data
263 .align 4
264env:
265 .long 0
266_quicc_base:
267 .long 0
268_periph_base:
269 .long 0
270_ramvec:
271 .long 0
272_rambase:
273 .long 0
274_ramstart:
275 .long 0
276_ramend:
277 .long 0
278_dprbase:
279 .long 0xffffe000
280
281 .text
282
283 /*
284 * These are the exception vectors at boot up, they are copied into RAM
285 * and then overwritten as needed.
286 */
287
288.section ".data.initvect","awx"
289 .long __ramend /* Reset: Initial Stack Pointer - 0. */
290 .long _start /* Reset: Initial Program Counter - 1. */
291 .long buserr /* Bus Error - 2. */
292 .long trap /* Address Error - 3. */
293 .long trap /* Illegal Instruction - 4. */
294 .long trap /* Divide by zero - 5. */
295 .long trap /* CHK, CHK2 Instructions - 6. */
296 .long trap /* TRAPcc, TRAPV Instructions - 7. */
297 .long trap /* Privilege Violation - 8. */
298 .long trap /* Trace - 9. */
299 .long trap /* Line 1010 Emulator - 10. */
300 .long trap /* Line 1111 Emualtor - 11. */
301 .long trap /* Harware Breakpoint - 12. */
302 .long trap /* (Reserved for Coprocessor Protocol Violation)- 13. */
303 .long trap /* Format Error - 14. */
304 .long trap /* Uninitialized Interrupt - 15. */
305 .long trap /* (Unassigned, Reserver) - 16. */
306 .long trap /* (Unassigned, Reserver) - 17. */
307 .long trap /* (Unassigned, Reserver) - 18. */
308 .long trap /* (Unassigned, Reserver) - 19. */
309 .long trap /* (Unassigned, Reserver) - 20. */
310 .long trap /* (Unassigned, Reserver) - 21. */
311 .long trap /* (Unassigned, Reserver) - 22. */
312 .long trap /* (Unassigned, Reserver) - 23. */
313 .long trap /* Spurious Interrupt - 24. */
314 .long trap /* Level 1 Interrupt Autovector - 25. */
315 .long trap /* Level 2 Interrupt Autovector - 26. */
316 .long trap /* Level 3 Interrupt Autovector - 27. */
317 .long trap /* Level 4 Interrupt Autovector - 28. */
318 .long trap /* Level 5 Interrupt Autovector - 29. */
319 .long trap /* Level 6 Interrupt Autovector - 30. */
320 .long trap /* Level 7 Interrupt Autovector - 31. */
321 .long system_call /* Trap Instruction Vectors 0 - 32. */
322 .long trap /* Trap Instruction Vectors 1 - 33. */
323 .long trap /* Trap Instruction Vectors 2 - 34. */
324 .long trap /* Trap Instruction Vectors 3 - 35. */
325 .long trap /* Trap Instruction Vectors 4 - 36. */
326 .long trap /* Trap Instruction Vectors 5 - 37. */
327 .long trap /* Trap Instruction Vectors 6 - 38. */
328 .long trap /* Trap Instruction Vectors 7 - 39. */
329 .long trap /* Trap Instruction Vectors 8 - 40. */
330 .long trap /* Trap Instruction Vectors 9 - 41. */
331 .long trap /* Trap Instruction Vectors 10 - 42. */
332 .long trap /* Trap Instruction Vectors 11 - 43. */
333 .long trap /* Trap Instruction Vectors 12 - 44. */
334 .long trap /* Trap Instruction Vectors 13 - 45. */
335 .long trap /* Trap Instruction Vectors 14 - 46. */
336 .long trap /* Trap Instruction Vectors 15 - 47. */
337 .long 0 /* (Reserved for Coprocessor) - 48. */
338 .long 0 /* (Reserved for Coprocessor) - 49. */
339 .long 0 /* (Reserved for Coprocessor) - 50. */
340 .long 0 /* (Reserved for Coprocessor) - 51. */
341 .long 0 /* (Reserved for Coprocessor) - 52. */
342 .long 0 /* (Reserved for Coprocessor) - 53. */
343 .long 0 /* (Reserved for Coprocessor) - 54. */
344 .long 0 /* (Reserved for Coprocessor) - 55. */
345 .long 0 /* (Reserved for Coprocessor) - 56. */
346 .long 0 /* (Reserved for Coprocessor) - 57. */
347 .long 0 /* (Reserved for Coprocessor) - 58. */
348 .long 0 /* (Unassigned, Reserved) - 59. */
349 .long 0 /* (Unassigned, Reserved) - 60. */
350 .long 0 /* (Unassigned, Reserved) - 61. */
351 .long 0 /* (Unassigned, Reserved) - 62. */
352 .long 0 /* (Unassigned, Reserved) - 63. */
353 /* The assignment of these vectors to the CPM is */
354 /* dependent on the configuration of the CPM vba */
355 /* fields. */
356 .long 0 /* (User-Defined Vectors 1) CPM Error - 64. */
357 .long 0 /* (User-Defined Vectors 2) CPM Parallel IO PC11- 65. */
358 .long 0 /* (User-Defined Vectors 3) CPM Parallel IO PC10- 66. */
359 .long 0 /* (User-Defined Vectors 4) CPM SMC2 / PIP - 67. */
360 .long 0 /* (User-Defined Vectors 5) CPM SMC1 - 68. */
361 .long 0 /* (User-Defined Vectors 6) CPM SPI - 69. */
362 .long 0 /* (User-Defined Vectors 7) CPM Parallel IO PC9 - 70. */
363 .long 0 /* (User-Defined Vectors 8) CPM Timer 4 - 71. */
364 .long 0 /* (User-Defined Vectors 9) CPM Reserved - 72. */
365 .long 0 /* (User-Defined Vectors 10) CPM Parallel IO PC8- 73. */
366 .long 0 /* (User-Defined Vectors 11) CPM Parallel IO PC7- 74. */
367 .long 0 /* (User-Defined Vectors 12) CPM Parallel IO PC6- 75. */
368 .long 0 /* (User-Defined Vectors 13) CPM Timer 3 - 76. */
369 .long 0 /* (User-Defined Vectors 14) CPM Reserved - 77. */
370 .long 0 /* (User-Defined Vectors 15) CPM Parallel IO PC5- 78. */
371 .long 0 /* (User-Defined Vectors 16) CPM Parallel IO PC4- 79. */
372 .long 0 /* (User-Defined Vectors 17) CPM Reserved - 80. */
373 .long 0 /* (User-Defined Vectors 18) CPM RISC Timer Tbl - 81. */
374 .long 0 /* (User-Defined Vectors 19) CPM Timer 2 - 82. */
375 .long 0 /* (User-Defined Vectors 21) CPM Reserved - 83. */
376 .long 0 /* (User-Defined Vectors 22) CPM IDMA2 - 84. */
377 .long 0 /* (User-Defined Vectors 23) CPM IDMA1 - 85. */
378 .long 0 /* (User-Defined Vectors 24) CPM SDMA Bus Err - 86. */
379 .long 0 /* (User-Defined Vectors 25) CPM Parallel IO PC3- 87. */
380 .long 0 /* (User-Defined Vectors 26) CPM Parallel IO PC2- 88. */
381 .long 0 /* (User-Defined Vectors 27) CPM Timer 1 - 89. */
382 .long 0 /* (User-Defined Vectors 28) CPM Parallel IO PC1- 90. */
383 .long 0 /* (User-Defined Vectors 29) CPM SCC 4 - 91. */
384 .long 0 /* (User-Defined Vectors 30) CPM SCC 3 - 92. */
385 .long 0 /* (User-Defined Vectors 31) CPM SCC 2 - 93. */
386 .long 0 /* (User-Defined Vectors 32) CPM SCC 1 - 94. */
387 .long 0 /* (User-Defined Vectors 33) CPM Parallel IO PC0- 95. */
388 /* I don't think anything uses the vectors after here. */
389 .long 0 /* (User-Defined Vectors 34) - 96. */
390 .long 0,0,0,0,0 /* (User-Defined Vectors 35 - 39). */
391 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 40 - 49). */
392 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 50 - 59). */
393 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 60 - 69). */
394 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 70 - 79). */
395 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 80 - 89). */
396 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 90 - 99). */
397 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 100 - 109). */
398 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 110 - 119). */
399 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 120 - 129). */
400 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 130 - 139). */
401 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 140 - 149). */
402 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 150 - 159). */
403 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 160 - 169). */
404 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 170 - 179). */
405 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 180 - 189). */
406 .long 0,0,0 /* (User-Defined Vectors 190 - 192). */
407.text
408ignore: rte
diff --git a/arch/m68knommu/platform/68360/head-rom.S b/arch/m68knommu/platform/68360/head-rom.S
new file mode 100644
index 000000000000..0da357a4cfee
--- /dev/null
+++ b/arch/m68knommu/platform/68360/head-rom.S
@@ -0,0 +1,420 @@
1/* arch/m68knommu/platform/68360/head-rom.S
2 *
3 * Startup code for Motorola 68360
4 *
5 * Copyright (C) SED Systems, a Division of Calian Ltd.
6 * Based on: arch/m68knommu/platform/68328/pilot/crt0_rom.S
7 * Based on: arch/m68knommu/platform/68360/uCquicc/crt0_rom.S, 2.0.38.1.pre7
8 * uClinux Kernel
9 * Copyright (C) Michael Leslie <mleslie@lineo.com>
10 * Based on: arch/m68knommu/platform/68EZ328/ucsimm/crt0_rom.S
11 * Copyright (C) 1998 D. Jeff Dionne <jeff@uclinux.org>,
12 *
13 */
14#include <linux/config.h>
15
16.global _stext
17.global _sbss
18.global _start
19
20.global _rambase
21.global __ramvec
22.global _ramvec
23.global _ramstart
24.global _ramend
25
26.global _quicc_base
27.global _periph_base
28
29#define REGB 0x1000
30#define PEPAR (_dprbase + REGB + 0x0016)
31#define GMR (_dprbase + REGB + 0x0040)
32#define OR0 (_dprbase + REGB + 0x0054)
33#define BR0 (_dprbase + REGB + 0x0050)
34
35#define OR1 (_dprbase + REGB + 0x0064)
36#define BR1 (_dprbase + REGB + 0x0060)
37
38#define OR2 (_dprbase + REGB + 0x0074)
39#define BR2 (_dprbase + REGB + 0x0070)
40
41#define OR3 (_dprbase + REGB + 0x0084)
42#define BR3 (_dprbase + REGB + 0x0080)
43
44#define OR4 (_dprbase + REGB + 0x0094)
45#define BR4 (_dprbase + REGB + 0x0090)
46
47#define OR5 (_dprbase + REGB + 0x00A4)
48#define BR5 (_dprbase + REGB + 0x00A0)
49
50#define OR6 (_dprbase + REGB + 0x00b4)
51#define BR6 (_dprbase + REGB + 0x00b0)
52
53#define OR7 (_dprbase + REGB + 0x00c4)
54#define BR7 (_dprbase + REGB + 0x00c0)
55
56#define MCR (_dprbase + REGB + 0x0000)
57#define AVR (_dprbase + REGB + 0x0008)
58
59#define SYPCR (_dprbase + REGB + 0x0022)
60
61#define PLLCR (_dprbase + REGB + 0x0010)
62#define CLKOCR (_dprbase + REGB + 0x000C)
63#define CDVCR (_dprbase + REGB + 0x0014)
64
65#define BKAR (_dprbase + REGB + 0x0030)
66#define BKCR (_dprbase + REGB + 0x0034)
67#define SWIV (_dprbase + REGB + 0x0023)
68#define PICR (_dprbase + REGB + 0x0026)
69#define PITR (_dprbase + REGB + 0x002A)
70
71/* Define for all memory configuration */
72#define MCU_SIM_GMR 0x00000000
73#define SIM_OR_MASK 0x0fffffff
74
75/* Defines for chip select zero - the flash */
76#define SIM_OR0_MASK 0x20000000
77#define SIM_BR0_MASK 0x00000001
78
79/* Defines for chip select one - the RAM */
80#define SIM_OR1_MASK 0x10000000
81#define SIM_BR1_MASK 0x00000001
82
83#define MCU_SIM_MBAR_ADRS 0x0003ff00
84#define MCU_SIM_MBAR_BA_MASK 0xfffff000
85#define MCU_SIM_MBAR_AS_MASK 0x00000001
86
87#define MCU_SIM_PEPAR 0x00B4
88
89#define MCU_DISABLE_INTRPTS 0x2700
90#define MCU_SIM_AVR 0x00
91
92#define MCU_SIM_MCR 0x00005cff
93
94#define MCU_SIM_CLKOCR 0x00
95#define MCU_SIM_PLLCR 0x8000
96#define MCU_SIM_CDVCR 0x0000
97
98#define MCU_SIM_SYPCR 0x0000
99#define MCU_SIM_SWIV 0x00
100#define MCU_SIM_PICR 0x0000
101#define MCU_SIM_PITR 0x0000
102
103
104#include <asm/m68360_regs.h>
105
106
107/*
108 * By the time this RAM specific code begins to execute, DPRAM
109 * and DRAM should already be mapped and accessible.
110 */
111
112 .text
113_start:
114_stext:
115 nop
116 ori.w #MCU_DISABLE_INTRPTS, %sr /* disable interrupts: */
117 /* We should not need to setup the boot stack the reset should do it. */
118 movea.l #__ramend, %sp /* set up stack at the end of DRAM:*/
119
120
121set_mbar_register:
122 moveq.l #0x07, %d1 /* Setup MBAR */
123 movec %d1, %dfc
124
125 lea.l MCU_SIM_MBAR_ADRS, %a0
126 move.l #_dprbase, %d0
127 andi.l #MCU_SIM_MBAR_BA_MASK, %d0
128 ori.l #MCU_SIM_MBAR_AS_MASK, %d0
129 moves.l %d0, %a0@
130
131 moveq.l #0x05, %d1
132 movec.l %d1, %dfc
133
134 /* Now we can begin to access registers in DPRAM */
135
136set_sim_mcr:
137 /* Set Module Configuration Register */
138 move.l #MCU_SIM_MCR, MCR
139
140 /* to do: Determine cause of reset */
141
142 /*
143 * configure system clock MC68360 p. 6-40
144 * (value +1)*osc/128 = system clock
145 * or
146 * (value + 1)*osc = system clock
147 * You do not need to divide the oscillator by 128 unless you want to.
148 */
149set_sim_clock:
150 move.w #MCU_SIM_PLLCR, PLLCR
151 move.b #MCU_SIM_CLKOCR, CLKOCR
152 move.w #MCU_SIM_CDVCR, CDVCR
153
154 /* Wait for the PLL to settle */
155 move.w #16384, %d0
156pll_settle_wait:
157 subi.w #1, %d0
158 bne pll_settle_wait
159
160 /* Setup the system protection register, and watchdog timer register */
161 move.b #MCU_SIM_SWIV, SWIV
162 move.w #MCU_SIM_PICR, PICR
163 move.w #MCU_SIM_PITR, PITR
164 move.w #MCU_SIM_SYPCR, SYPCR
165
166 /* Clear DPRAM - system + parameter */
167 movea.l #_dprbase, %a0
168 movea.l #_dprbase+0x2000, %a1
169
170 /* Copy 0 to %a0 until %a0 == %a1 */
171clear_dpram:
172 movel #0, %a0@+
173 cmpal %a0, %a1
174 bhi clear_dpram
175
176configure_memory_controller:
177 /* Set up Global Memory Register (GMR) */
178 move.l #MCU_SIM_GMR, %d0
179 move.l %d0, GMR
180
181configure_chip_select_0:
182 move.l #0x00400000, %d0
183 subq.l #0x01, %d0
184 eori.l #SIM_OR_MASK, %d0
185 ori.l #SIM_OR0_MASK, %d0
186 move.l %d0, OR0
187
188 move.l #__rom_start, %d0
189 ori.l #SIM_BR0_MASK, %d0
190 move.l %d0, BR0
191
192 move.l #0x0, BR1
193 move.l #0x0, BR2
194 move.l #0x0, BR3
195 move.l #0x0, BR4
196 move.l #0x0, BR5
197 move.l #0x0, BR6
198 move.l #0x0, BR7
199
200 move.w #MCU_SIM_PEPAR, PEPAR
201
202 /* point to vector table: */
203 move.l #_romvec, %a0
204 move.l #_ramvec, %a1
205copy_vectors:
206 move.l %a0@, %d0
207 move.l %d0, %a1@
208 move.l %a0@, %a1@
209 addq.l #0x04, %a0
210 addq.l #0x04, %a1
211 cmp.l #_start, %a0
212 blt copy_vectors
213
214 move.l #_ramvec, %a1
215 movec %a1, %vbr
216
217
218 /* Copy data segment from ROM to RAM */
219 moveal #_etext, %a0
220 moveal #_sdata, %a1
221 moveal #_edata, %a2
222
223 /* Copy %a0 to %a1 until %a1 == %a2 */
224LD1:
225 move.l %a0@, %d0
226 addq.l #0x04, %a0
227 move.l %d0, %a1@
228 addq.l #0x04, %a1
229 cmp.l #_edata, %a1
230 blt LD1
231
232 moveal #_sbss, %a0
233 moveal #_ebss, %a1
234
235 /* Copy 0 to %a0 until %a0 == %a1 */
236L1:
237 movel #0, %a0@+
238 cmpal %a0, %a1
239 bhi L1
240
241load_quicc:
242 move.l #_dprbase, _quicc_base
243
244store_ram_size:
245 /* Set ram size information */
246 move.l #_sdata, _rambase
247 move.l #_ebss, _ramstart
248 move.l #__ramend, %d0
249 sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/
250 move.l %d0, _ramend /* Different from __ramend.*/
251
252store_flash_size:
253 /* Set rom size information */
254 move.l #__rom_end, %d0
255 sub.l #__rom_start, %d0
256 move.l %d0, rom_length
257
258 pea 0
259 pea env
260 pea %sp@(4)
261 pea 0
262
263 lea init_thread_union, %a2
264 lea 0x2000(%a2), %sp
265
266lp:
267 jsr start_kernel
268
269_exit:
270 jmp _exit
271
272
273 .data
274 .align 4
275env:
276 .long 0
277_quicc_base:
278 .long 0
279_periph_base:
280 .long 0
281_ramvec:
282 .long 0
283_rambase:
284 .long 0
285_ramstart:
286 .long 0
287_ramend:
288 .long 0
289_dprbase:
290 .long 0xffffe000
291
292
293 .text
294
295 /*
296 * These are the exception vectors at boot up, they are copied into RAM
297 * and then overwritten as needed.
298 */
299
300.section ".data.initvect","awx"
301 .long __ramend /* Reset: Initial Stack Pointer - 0. */
302 .long _start /* Reset: Initial Program Counter - 1. */
303 .long buserr /* Bus Error - 2. */
304 .long trap /* Address Error - 3. */
305 .long trap /* Illegal Instruction - 4. */
306 .long trap /* Divide by zero - 5. */
307 .long trap /* CHK, CHK2 Instructions - 6. */
308 .long trap /* TRAPcc, TRAPV Instructions - 7. */
309 .long trap /* Privilege Violation - 8. */
310 .long trap /* Trace - 9. */
311 .long trap /* Line 1010 Emulator - 10. */
312 .long trap /* Line 1111 Emualtor - 11. */
313 .long trap /* Harware Breakpoint - 12. */
314 .long trap /* (Reserved for Coprocessor Protocol Violation)- 13. */
315 .long trap /* Format Error - 14. */
316 .long trap /* Uninitialized Interrupt - 15. */
317 .long trap /* (Unassigned, Reserver) - 16. */
318 .long trap /* (Unassigned, Reserver) - 17. */
319 .long trap /* (Unassigned, Reserver) - 18. */
320 .long trap /* (Unassigned, Reserver) - 19. */
321 .long trap /* (Unassigned, Reserver) - 20. */
322 .long trap /* (Unassigned, Reserver) - 21. */
323 .long trap /* (Unassigned, Reserver) - 22. */
324 .long trap /* (Unassigned, Reserver) - 23. */
325 .long trap /* Spurious Interrupt - 24. */
326 .long trap /* Level 1 Interrupt Autovector - 25. */
327 .long trap /* Level 2 Interrupt Autovector - 26. */
328 .long trap /* Level 3 Interrupt Autovector - 27. */
329 .long trap /* Level 4 Interrupt Autovector - 28. */
330 .long trap /* Level 5 Interrupt Autovector - 29. */
331 .long trap /* Level 6 Interrupt Autovector - 30. */
332 .long trap /* Level 7 Interrupt Autovector - 31. */
333 .long system_call /* Trap Instruction Vectors 0 - 32. */
334 .long trap /* Trap Instruction Vectors 1 - 33. */
335 .long trap /* Trap Instruction Vectors 2 - 34. */
336 .long trap /* Trap Instruction Vectors 3 - 35. */
337 .long trap /* Trap Instruction Vectors 4 - 36. */
338 .long trap /* Trap Instruction Vectors 5 - 37. */
339 .long trap /* Trap Instruction Vectors 6 - 38. */
340 .long trap /* Trap Instruction Vectors 7 - 39. */
341 .long trap /* Trap Instruction Vectors 8 - 40. */
342 .long trap /* Trap Instruction Vectors 9 - 41. */
343 .long trap /* Trap Instruction Vectors 10 - 42. */
344 .long trap /* Trap Instruction Vectors 11 - 43. */
345 .long trap /* Trap Instruction Vectors 12 - 44. */
346 .long trap /* Trap Instruction Vectors 13 - 45. */
347 .long trap /* Trap Instruction Vectors 14 - 46. */
348 .long trap /* Trap Instruction Vectors 15 - 47. */
349 .long 0 /* (Reserved for Coprocessor) - 48. */
350 .long 0 /* (Reserved for Coprocessor) - 49. */
351 .long 0 /* (Reserved for Coprocessor) - 50. */
352 .long 0 /* (Reserved for Coprocessor) - 51. */
353 .long 0 /* (Reserved for Coprocessor) - 52. */
354 .long 0 /* (Reserved for Coprocessor) - 53. */
355 .long 0 /* (Reserved for Coprocessor) - 54. */
356 .long 0 /* (Reserved for Coprocessor) - 55. */
357 .long 0 /* (Reserved for Coprocessor) - 56. */
358 .long 0 /* (Reserved for Coprocessor) - 57. */
359 .long 0 /* (Reserved for Coprocessor) - 58. */
360 .long 0 /* (Unassigned, Reserved) - 59. */
361 .long 0 /* (Unassigned, Reserved) - 60. */
362 .long 0 /* (Unassigned, Reserved) - 61. */
363 .long 0 /* (Unassigned, Reserved) - 62. */
364 .long 0 /* (Unassigned, Reserved) - 63. */
365 /* The assignment of these vectors to the CPM is */
366 /* dependent on the configuration of the CPM vba */
367 /* fields. */
368 .long 0 /* (User-Defined Vectors 1) CPM Error - 64. */
369 .long 0 /* (User-Defined Vectors 2) CPM Parallel IO PC11- 65. */
370 .long 0 /* (User-Defined Vectors 3) CPM Parallel IO PC10- 66. */
371 .long 0 /* (User-Defined Vectors 4) CPM SMC2 / PIP - 67. */
372 .long 0 /* (User-Defined Vectors 5) CPM SMC1 - 68. */
373 .long 0 /* (User-Defined Vectors 6) CPM SPI - 69. */
374 .long 0 /* (User-Defined Vectors 7) CPM Parallel IO PC9 - 70. */
375 .long 0 /* (User-Defined Vectors 8) CPM Timer 4 - 71. */
376 .long 0 /* (User-Defined Vectors 9) CPM Reserved - 72. */
377 .long 0 /* (User-Defined Vectors 10) CPM Parallel IO PC8- 73. */
378 .long 0 /* (User-Defined Vectors 11) CPM Parallel IO PC7- 74. */
379 .long 0 /* (User-Defined Vectors 12) CPM Parallel IO PC6- 75. */
380 .long 0 /* (User-Defined Vectors 13) CPM Timer 3 - 76. */
381 .long 0 /* (User-Defined Vectors 14) CPM Reserved - 77. */
382 .long 0 /* (User-Defined Vectors 15) CPM Parallel IO PC5- 78. */
383 .long 0 /* (User-Defined Vectors 16) CPM Parallel IO PC4- 79. */
384 .long 0 /* (User-Defined Vectors 17) CPM Reserved - 80. */
385 .long 0 /* (User-Defined Vectors 18) CPM RISC Timer Tbl - 81. */
386 .long 0 /* (User-Defined Vectors 19) CPM Timer 2 - 82. */
387 .long 0 /* (User-Defined Vectors 21) CPM Reserved - 83. */
388 .long 0 /* (User-Defined Vectors 22) CPM IDMA2 - 84. */
389 .long 0 /* (User-Defined Vectors 23) CPM IDMA1 - 85. */
390 .long 0 /* (User-Defined Vectors 24) CPM SDMA Bus Err - 86. */
391 .long 0 /* (User-Defined Vectors 25) CPM Parallel IO PC3- 87. */
392 .long 0 /* (User-Defined Vectors 26) CPM Parallel IO PC2- 88. */
393 .long 0 /* (User-Defined Vectors 27) CPM Timer 1 - 89. */
394 .long 0 /* (User-Defined Vectors 28) CPM Parallel IO PC1- 90. */
395 .long 0 /* (User-Defined Vectors 29) CPM SCC 4 - 91. */
396 .long 0 /* (User-Defined Vectors 30) CPM SCC 3 - 92. */
397 .long 0 /* (User-Defined Vectors 31) CPM SCC 2 - 93. */
398 .long 0 /* (User-Defined Vectors 32) CPM SCC 1 - 94. */
399 .long 0 /* (User-Defined Vectors 33) CPM Parallel IO PC0- 95. */
400 /* I don't think anything uses the vectors after here. */
401 .long 0 /* (User-Defined Vectors 34) - 96. */
402 .long 0,0,0,0,0 /* (User-Defined Vectors 35 - 39). */
403 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 40 - 49). */
404 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 50 - 59). */
405 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 60 - 69). */
406 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 70 - 79). */
407 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 80 - 89). */
408 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 90 - 99). */
409 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 100 - 109). */
410 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 110 - 119). */
411 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 120 - 129). */
412 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 130 - 139). */
413 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 140 - 149). */
414 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 150 - 159). */
415 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 160 - 169). */
416 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 170 - 179). */
417 .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 180 - 189). */
418 .long 0,0,0 /* (User-Defined Vectors 190 - 192). */
419.text
420ignore: rte
diff --git a/arch/m68knommu/platform/68EZ328/config.c b/arch/m68knommu/platform/68EZ328/config.c
index c21971971ff5..d8d56e5de310 100644
--- a/arch/m68knommu/platform/68EZ328/config.c
+++ b/arch/m68knommu/platform/68EZ328/config.c
@@ -1,5 +1,7 @@
1/***************************************************************************/
2
1/* 3/*
2 * linux/arch/$(ARCH)/platform/$(PLATFORM)/config.c 4 * linux/arch/m68knommu/platform/68EZ328/config.c
3 * 5 *
4 * Copyright (C) 1993 Hamish Macdonald 6 * Copyright (C) 1993 Hamish Macdonald
5 * Copyright (C) 1999 D. Jeff Dionne 7 * Copyright (C) 1999 D. Jeff Dionne
@@ -9,6 +11,8 @@
9 * for more details. 11 * for more details.
10 */ 12 */
11 13
14/***************************************************************************/
15
12#include <stdarg.h> 16#include <stdarg.h>
13#include <linux/config.h> 17#include <linux/config.h>
14#include <linux/types.h> 18#include <linux/types.h>
@@ -20,68 +24,22 @@
20#include <asm/setup.h> 24#include <asm/setup.h>
21#include <asm/system.h> 25#include <asm/system.h>
22#include <asm/pgtable.h> 26#include <asm/pgtable.h>
23#include <asm/irq.h>
24#include <asm/machdep.h> 27#include <asm/machdep.h>
25#include <asm/MC68EZ328.h> 28#include <asm/MC68EZ328.h>
26#ifdef CONFIG_UCSIMM 29#ifdef CONFIG_UCSIMM
27#include <asm/bootstd.h> 30#include <asm/bootstd.h>
28#endif 31#endif
29#ifdef CONFIG_PILOT
30#include "PalmV/romfs.h"
31#endif
32
33void BSP_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
34{
35 /* Restart mode, Enable int, 32KHz, Enable timer */
36 TCTL = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN;
37 /* Set prescaler (Divide 32KHz by 32)*/
38 TPRER = 31;
39 /* Set compare register 32Khz / 32 / 10 = 100 */
40 TCMP = 10;
41
42 request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
43}
44
45void BSP_tick(void)
46{
47 /* Reset Timer1 */
48 TSTAT &= 0;
49}
50
51unsigned long BSP_gettimeoffset (void)
52{
53 return 0;
54}
55 32
56void BSP_gettod (int *yearp, int *monp, int *dayp, 33/***************************************************************************/
57 int *hourp, int *minp, int *secp)
58{
59}
60 34
61int BSP_hwclk(int op, struct hwclk_time *t) 35void m68328_timer_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *));
62{ 36void m68328_timer_tick(void);
63 if (!op) { 37unsigned long m68328_timer_gettimeoffset(void);
64 /* read */ 38void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec);
65 } else {
66 /* write */
67 }
68 return 0;
69}
70 39
71int BSP_set_clock_mmss (unsigned long nowtime) 40/***************************************************************************/
72{
73#if 0
74 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
75 41
76 tod->second1 = real_seconds / 10; 42void m68ez328_reset(void)
77 tod->second2 = real_seconds % 10;
78 tod->minute1 = real_minutes / 10;
79 tod->minute2 = real_minutes % 10;
80#endif
81 return 0;
82}
83
84void BSP_reset (void)
85{ 43{
86 local_irq_disable(); 44 local_irq_disable();
87 asm volatile (" 45 asm volatile ("
@@ -93,6 +51,8 @@ void BSP_reset (void)
93 "); 51 ");
94} 52}
95 53
54/***************************************************************************/
55
96unsigned char *cs8900a_hwaddr; 56unsigned char *cs8900a_hwaddr;
97static int errno; 57static int errno;
98 58
@@ -119,11 +79,13 @@ void config_BSP(char *command, int len)
119 else command[0] = 0; 79 else command[0] = 0;
120#endif 80#endif
121 81
122 mach_sched_init = BSP_sched_init; 82 mach_sched_init = m68328_timer_init;
123 mach_tick = BSP_tick; 83 mach_tick = m68328_timer_tick;
124 mach_gettimeoffset = BSP_gettimeoffset; 84 mach_gettimeoffset = m68328_timer_gettimeoffset;
125 mach_gettod = BSP_gettod; 85 mach_gettod = m68328_timer_gettod;
126 mach_hwclk = NULL; 86 mach_hwclk = NULL;
127 mach_set_clock_mmss = NULL; 87 mach_set_clock_mmss = NULL;
128 mach_reset = BSP_reset; 88 mach_reset = m68ez328_reset;
129} 89}
90
91/***************************************************************************/
diff --git a/arch/m68knommu/platform/68VZ328/de2/config.c b/arch/m68knommu/platform/68VZ328/config.c
index d0586197f113..d926524cdf82 100644
--- a/arch/m68knommu/platform/68VZ328/de2/config.c
+++ b/arch/m68knommu/platform/68VZ328/config.c
@@ -1,5 +1,7 @@
1/***************************************************************************/
2
1/* 3/*
2 * linux/arch/m68knommu/platform/MC68VZ328/de2/config.c 4 * linux/arch/m68knommu/platform/68VZ328/config.c
3 * 5 *
4 * Copyright (C) 1993 Hamish Macdonald 6 * Copyright (C) 1993 Hamish Macdonald
5 * Copyright (C) 1999 D. Jeff Dionne 7 * Copyright (C) 1999 D. Jeff Dionne
@@ -10,6 +12,8 @@
10 * for more details. 12 * for more details.
11 */ 13 */
12 14
15/***************************************************************************/
16
13#include <linux/config.h> 17#include <linux/config.h>
14#include <linux/types.h> 18#include <linux/types.h>
15#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -25,66 +29,25 @@
25#include <asm/irq.h> 29#include <asm/irq.h>
26#include <asm/machdep.h> 30#include <asm/machdep.h>
27#include <asm/MC68VZ328.h> 31#include <asm/MC68VZ328.h>
32#include <asm/bootstd.h>
28 33
29#ifdef CONFIG_INIT_LCD 34#ifdef CONFIG_INIT_LCD
30#include "screen.h" 35#include "bootlogo.h"
31#endif 36#endif
32 37
33/* with a 33.16 MHz clock, this will give usec resolution to the time functions */ 38/***************************************************************************/
34#define CLOCK_SOURCE TCTL_CLKSOURCE_SYSCLK
35#define CLOCK_PRE 7
36#define TICKS_PER_JIFFY 41450
37
38static void
39dragen2_sched_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *))
40{
41 /* disable timer 1 */
42 TCTL = 0;
43
44 /* set ISR */
45 if (request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL))
46 panic("Unable to attach timer interrupt\n");
47
48 /* Restart mode, Enable int, Set clock source */
49 TCTL = TCTL_OM | TCTL_IRQEN | CLOCK_SOURCE;
50 TPRER = CLOCK_PRE;
51 TCMP = TICKS_PER_JIFFY;
52
53 /* Enable timer 1 */
54 TCTL |= TCTL_TEN;
55}
56
57static void dragen2_tick(void)
58{
59 /* Reset Timer1 */
60 TSTAT &= 0;
61}
62
63static unsigned long dragen2_gettimeoffset(void)
64{
65 unsigned long ticks = TCN, offset = 0;
66
67 /* check for pending interrupt */
68 if (ticks < (TICKS_PER_JIFFY >> 1) && (ISR & (1 << TMR_IRQ_NUM)))
69 offset = 1000000 / HZ;
70
71 ticks = (ticks * 1000000 / HZ) / TICKS_PER_JIFFY;
72 39
73 return ticks + offset; 40void m68328_timer_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *));
74} 41void m68328_timer_tick(void);
42unsigned long m68328_timer_gettimeoffset(void);
43void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec);
75 44
76static void dragen2_gettod(int *year, int *mon, int *day, int *hour, 45/***************************************************************************/
77 int *min, int *sec) 46/* Init Drangon Engine hardware */
78{ 47/***************************************************************************/
79 long now = RTCTIME; 48#if defined(CONFIG_DRAGEN2)
80 49
81 *year = *mon = *day = 1; 50static void m68vz328_reset(void)
82 *hour = (now >> 24) % 24;
83 *min = (now >> 16) % 60;
84 *sec = now % 60;
85}
86
87static void dragen2_reset(void)
88{ 51{
89 local_irq_disable(); 52 local_irq_disable();
90 53
@@ -103,7 +66,7 @@ static void dragen2_reset(void)
103 ); 66 );
104} 67}
105 68
106static void init_hardware(void) 69static void init_hardware(char *command, int size)
107{ 70{
108#ifdef CONFIG_DIRECT_IO_ACCESS 71#ifdef CONFIG_DIRECT_IO_ACCESS
109 SCR = 0x10; /* allow user access to internal registers */ 72 SCR = 0x10; /* allow user access to internal registers */
@@ -170,6 +133,60 @@ static void init_hardware(void)
170#endif 133#endif
171} 134}
172 135
136/***************************************************************************/
137/* Init RT-Control uCdimm hardware */
138/***************************************************************************/
139#elif defined(CONFIG_UCDIMM)
140
141static void m68vz328_reset(void)
142{
143 local_irq_disable();
144 asm volatile ("
145 moveal #0x10c00000, %a0;
146 moveb #0, 0xFFFFF300;
147 moveal 0(%a0), %sp;
148 moveal 4(%a0), %a0;
149 jmp (%a0);
150 ");
151}
152
153unsigned char *cs8900a_hwaddr;
154static int errno;
155
156_bsc0(char *, getserialnum)
157_bsc1(unsigned char *, gethwaddr, int, a)
158_bsc1(char *, getbenv, char *, a)
159
160static void init_hardware(char *command, int size)
161{
162 char *p;
163
164 printk(KERN_INFO "uCdimm serial string [%s]\n", getserialnum());
165 p = cs8900a_hwaddr = gethwaddr(0);
166 printk(KERN_INFO "uCdimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
167 p[0], p[1], p[2], p[3], p[4], p[5]);
168 p = getbenv("APPEND");
169 if (p)
170 strcpy(p, command);
171 else
172 command[0] = 0;
173}
174
175/***************************************************************************/
176#else
177
178static void m68vz328_reset(void)
179{
180}
181
182static void init_hardware(char *command, int size)
183{
184}
185
186/***************************************************************************/
187#endif
188/***************************************************************************/
189
173void config_BSP(char *command, int size) 190void config_BSP(char *command, int size)
174{ 191{
175 printk(KERN_INFO "68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n"); 192 printk(KERN_INFO "68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
@@ -181,11 +198,13 @@ void config_BSP(char *command, int size)
181 memset(command, 0, size); 198 memset(command, 0, size);
182#endif 199#endif
183 200
184 init_hardware(); 201 init_hardware(command, size);
185 202
186 mach_sched_init = (void *)dragen2_sched_init; 203 mach_sched_init = (void *) m68328_timer_init;
187 mach_tick = dragen2_tick; 204 mach_tick = m68328_timer_tick;
188 mach_gettimeoffset = dragen2_gettimeoffset; 205 mach_gettimeoffset = m68328_timer_gettimeoffset;
189 mach_reset = dragen2_reset; 206 mach_gettod = m68328_timer_gettod;
190 mach_gettod = dragen2_gettod; 207 mach_reset = m68vz328_reset;
191} 208}
209
210/***************************************************************************/
diff --git a/arch/m68knommu/platform/68VZ328/ucdimm/config.c b/arch/m68knommu/platform/68VZ328/ucdimm/config.c
deleted file mode 100644
index 2deadaffd81e..000000000000
--- a/arch/m68knommu/platform/68VZ328/ucdimm/config.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * linux/arch/m68knommu/platform/68VZ328/ucdimm/config.c
3 *
4 * Copyright (C) 1993 Hamish Macdonald
5 * Copyright (C) 1999 D. Jeff Dionne
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive
9 * for more details.
10 */
11
12#include <stdarg.h>
13#include <linux/config.h>
14#include <linux/types.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17#include <linux/tty.h>
18#include <linux/console.h>
19
20#include <asm/setup.h>
21#include <asm/system.h>
22#include <asm/pgtable.h>
23#include <asm/irq.h>
24#include <asm/machdep.h>
25#include <asm/MC68VZ328.h>
26#include <asm/bootstd.h>
27
28void BSP_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
29{
30 /* Restart mode, Enable int, 32KHz, Enable timer */
31 TCTL = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN;
32 /* Set prescaler (Divide 32KHz by 32)*/
33 TPRER = 31;
34 /* Set compare register 32Khz / 32 / 10 = 100 */
35 TCMP = 10;
36
37 request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
38}
39
40void BSP_tick(void)
41{
42 /* Reset Timer1 */
43 TSTAT &= 0;
44}
45
46unsigned long BSP_gettimeoffset (void)
47{
48 return 0;
49}
50
51void BSP_gettod (int *yearp, int *monp, int *dayp,
52 int *hourp, int *minp, int *secp)
53{
54}
55
56int BSP_hwclk(int op, struct hwclk_time *t)
57{
58 if (!op) {
59 /* read */
60 } else {
61 /* write */
62 }
63 return 0;
64}
65
66int BSP_set_clock_mmss (unsigned long nowtime)
67{
68#if 0
69 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
70
71 tod->second1 = real_seconds / 10;
72 tod->second2 = real_seconds % 10;
73 tod->minute1 = real_minutes / 10;
74 tod->minute2 = real_minutes % 10;
75#endif
76 return 0;
77}
78
79void BSP_reset (void)
80{
81 local_irq_disable();
82 asm volatile ("
83 moveal #0x10c00000, %a0;
84 moveb #0, 0xFFFFF300;
85 moveal 0(%a0), %sp;
86 moveal 4(%a0), %a0;
87 jmp (%a0);
88 ");
89}
90
91unsigned char *cs8900a_hwaddr;
92static int errno;
93
94_bsc0(char *, getserialnum)
95_bsc1(unsigned char *, gethwaddr, int, a)
96_bsc1(char *, getbenv, char *, a)
97
98void config_BSP(char *command, int len)
99{
100 unsigned char *p;
101
102 printk(KERN_INFO "\n68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
103
104 printk(KERN_INFO "uCdimm serial string [%s]\n",getserialnum());
105 p = cs8900a_hwaddr = gethwaddr(0);
106 printk(KERN_INFO "uCdimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
107 p[0], p[1], p[2], p[3], p[4], p[5]);
108 p = getbenv("APPEND");
109 if (p) strcpy(p,command);
110 else command[0] = 0;
111
112 mach_sched_init = BSP_sched_init;
113 mach_tick = BSP_tick;
114 mach_gettimeoffset = BSP_gettimeoffset;
115 mach_gettod = BSP_gettod;
116 mach_reset = BSP_reset;
117}
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 8d76eb1ff291..0eb71ac303af 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -154,6 +154,13 @@ config TANBAC_TB0226
154 The TANBAC Mbase(TB0226) is a MIPS-based platform manufactured by TANBAC. 154 The TANBAC Mbase(TB0226) is a MIPS-based platform manufactured by TANBAC.
155 Please refer to <http://www.tanbac.co.jp/> about Mbase. 155 Please refer to <http://www.tanbac.co.jp/> about Mbase.
156 156
157config TANBAC_TB0287
158 bool "Support for TANBAC Mini-ITX DIMM base(TB0287)"
159 depends on TANBAC_TB022X
160 help
161 The TANBAC Mini-ITX DIMM base(TB0287) is a MIPS-based platform manufactured by TANBAC.
162 Please refer to <http://www.tanbac.co.jp/> about Mini-ITX DIMM base.
163
157config VICTOR_MPC30X 164config VICTOR_MPC30X
158 bool "Support for Victor MP-C303/304" 165 bool "Support for Victor MP-C303/304"
159 depends on MACH_VR41XX 166 depends on MACH_VR41XX
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index b0fdaee8d8d9..346e803f153b 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -720,38 +720,7 @@ archclean:
720 @$(MAKE) $(clean)=arch/mips/boot 720 @$(MAKE) $(clean)=arch/mips/boot
721 @$(MAKE) $(clean)=arch/mips/lasat 721 @$(MAKE) $(clean)=arch/mips/lasat
722 722
723# Generate <asm/offset.h 723
724# 724CLEAN_FILES += vmlinux.32 \
725# The default rule is suffering from funny problems on MIPS so we using our
726# own ...
727#
728# ---------------------------------------------------------------------------
729
730define filechk_gen-asm-offset.h
731 (set -e; \
732 echo "#ifndef _ASM_OFFSET_H"; \
733 echo "#define _ASM_OFFSET_H"; \
734 echo "/*"; \
735 echo " * DO NOT MODIFY."; \
736 echo " *"; \
737 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
738 echo " *"; \
739 echo " */"; \
740 echo ""; \
741 sed -ne "/^@@@/s///p"; \
742 echo "#endif /* _ASM_OFFSET_H */" )
743endef
744
745prepare: include/asm-$(ARCH)/offset.h
746
747arch/$(ARCH)/kernel/offset.s: include/asm include/linux/version.h \
748 include/config/MARKER
749
750include/asm-$(ARCH)/offset.h: arch/$(ARCH)/kernel/offset.s
751 $(call filechk,gen-asm-offset.h)
752
753CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
754 include/asm-$(ARCH)/offset.h \
755 vmlinux.32 \
756 vmlinux.64 \ 725 vmlinux.64 \
757 vmlinux.ecoff 726 vmlinux.ecoff
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
new file mode 100644
index 000000000000..17b9f2f65ba0
--- /dev/null
+++ b/arch/mips/configs/tb0287_defconfig
@@ -0,0 +1,1041 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.13-mm1
4# Thu Sep 1 22:58:34 2005
5#
6CONFIG_MIPS=y
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
59CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
60CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
61CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
62
63#
64# Kernel type
65#
66CONFIG_32BIT=y
67# CONFIG_64BIT is not set
68
69#
70# Machine selection
71#
72# CONFIG_MACH_JAZZ is not set
73CONFIG_MACH_VR41XX=y
74# CONFIG_NEC_CMBVR4133 is not set
75# CONFIG_CASIO_E55 is not set
76# CONFIG_IBM_WORKPAD is not set
77CONFIG_TANBAC_TB022X=y
78# CONFIG_TANBAC_TB0226 is not set
79CONFIG_TANBAC_TB0287=y
80# CONFIG_VICTOR_MPC30X is not set
81# CONFIG_ZAO_CAPCELLA is not set
82CONFIG_PCI_VR41XX=y
83# CONFIG_VRC4173 is not set
84# CONFIG_TOSHIBA_JMR3927 is not set
85# CONFIG_MIPS_COBALT is not set
86# CONFIG_MACH_DECSTATION is not set
87# CONFIG_MIPS_EV64120 is not set
88# CONFIG_MIPS_EV96100 is not set
89# CONFIG_MIPS_IVR is not set
90# CONFIG_LASAT is not set
91# CONFIG_MIPS_ITE8172 is not set
92# CONFIG_MIPS_ATLAS is not set
93# CONFIG_MIPS_MALTA is not set
94# CONFIG_MIPS_SEAD is not set
95# CONFIG_MOMENCO_OCELOT is not set
96# CONFIG_MOMENCO_OCELOT_G is not set
97# CONFIG_MOMENCO_OCELOT_C is not set
98# CONFIG_MOMENCO_OCELOT_3 is not set
99# CONFIG_MOMENCO_JAGUAR_ATX is not set
100# CONFIG_PMC_YOSEMITE is not set
101# CONFIG_DDB5074 is not set
102# CONFIG_DDB5476 is not set
103# CONFIG_DDB5477 is not set
104# CONFIG_QEMU is not set
105# CONFIG_SGI_IP22 is not set
106# CONFIG_SGI_IP27 is not set
107# CONFIG_SGI_IP32 is not set
108# CONFIG_SOC_AU1X00 is not set
109# CONFIG_SIBYTE_SB1xxx_SOC is not set
110# CONFIG_SNI_RM200_PCI is not set
111# CONFIG_TOSHIBA_RBTX4927 is not set
112CONFIG_RWSEM_GENERIC_SPINLOCK=y
113CONFIG_GENERIC_CALIBRATE_DELAY=y
114CONFIG_HAVE_DEC_LOCK=y
115CONFIG_DMA_NONCOHERENT=y
116CONFIG_DMA_NEED_PCI_MAP_STATE=y
117CONFIG_CPU_LITTLE_ENDIAN=y
118CONFIG_IRQ_CPU=y
119CONFIG_MIPS_L1_CACHE_SHIFT=5
120
121#
122# CPU selection
123#
124# CONFIG_CPU_MIPS32 is not set
125# CONFIG_CPU_MIPS64 is not set
126# CONFIG_CPU_R3000 is not set
127# CONFIG_CPU_TX39XX is not set
128CONFIG_CPU_VR41XX=y
129# CONFIG_CPU_R4300 is not set
130# CONFIG_CPU_R4X00 is not set
131# CONFIG_CPU_TX49XX is not set
132# CONFIG_CPU_R5000 is not set
133# CONFIG_CPU_R5432 is not set
134# CONFIG_CPU_R6000 is not set
135# CONFIG_CPU_NEVADA is not set
136# CONFIG_CPU_R8000 is not set
137# CONFIG_CPU_R10000 is not set
138# CONFIG_CPU_RM7000 is not set
139# CONFIG_CPU_RM9000 is not set
140# CONFIG_CPU_SB1 is not set
141CONFIG_PAGE_SIZE_4KB=y
142# CONFIG_PAGE_SIZE_8KB is not set
143# CONFIG_PAGE_SIZE_16KB is not set
144# CONFIG_PAGE_SIZE_64KB is not set
145# CONFIG_CPU_ADVANCED is not set
146CONFIG_CPU_HAS_SYNC=y
147CONFIG_ARCH_FLATMEM_ENABLE=y
148CONFIG_SELECT_MEMORY_MODEL=y
149CONFIG_FLATMEM_MANUAL=y
150# CONFIG_DISCONTIGMEM_MANUAL is not set
151# CONFIG_SPARSEMEM_MANUAL is not set
152CONFIG_FLATMEM=y
153CONFIG_FLAT_NODE_MEM_MAP=y
154# CONFIG_SPARSEMEM_STATIC is not set
155# CONFIG_PREEMPT is not set
156
157#
158# Bus options (PCI, PCMCIA, EISA, ISA, TC)
159#
160CONFIG_HW_HAS_PCI=y
161CONFIG_PCI=y
162# CONFIG_PCI_LEGACY_PROC is not set
163CONFIG_MMU=y
164
165#
166# PCCARD (PCMCIA/CardBus) support
167#
168# CONFIG_PCCARD is not set
169
170#
171# PCI Hotplug Support
172#
173# CONFIG_HOTPLUG_PCI is not set
174
175#
176# Executable file formats
177#
178CONFIG_BINFMT_ELF=y
179# CONFIG_BINFMT_MISC is not set
180CONFIG_TRAD_SIGNALS=y
181
182#
183# Networking
184#
185CONFIG_NET=y
186
187#
188# Networking options
189#
190CONFIG_PACKET=y
191# CONFIG_PACKET_MMAP is not set
192CONFIG_UNIX=y
193CONFIG_XFRM=y
194CONFIG_XFRM_USER=m
195# CONFIG_NET_KEY is not set
196CONFIG_INET=y
197CONFIG_IP_MULTICAST=y
198CONFIG_IP_ADVANCED_ROUTER=y
199CONFIG_ASK_IP_FIB_HASH=y
200# CONFIG_IP_FIB_TRIE is not set
201CONFIG_IP_FIB_HASH=y
202CONFIG_IP_MULTIPLE_TABLES=y
203CONFIG_IP_ROUTE_MULTIPATH=y
204# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set
205CONFIG_IP_ROUTE_VERBOSE=y
206CONFIG_IP_PNP=y
207# CONFIG_IP_PNP_DHCP is not set
208CONFIG_IP_PNP_BOOTP=y
209# CONFIG_IP_PNP_RARP is not set
210CONFIG_NET_IPIP=m
211CONFIG_NET_IPGRE=m
212# CONFIG_NET_IPGRE_BROADCAST is not set
213# CONFIG_IP_MROUTE is not set
214# CONFIG_ARPD is not set
215CONFIG_SYN_COOKIES=y
216# CONFIG_INET_AH is not set
217# CONFIG_INET_ESP is not set
218# CONFIG_INET_IPCOMP is not set
219CONFIG_INET_TUNNEL=m
220CONFIG_INET_DIAG=y
221CONFIG_INET_TCP_DIAG=y
222CONFIG_TCP_CONG_ADVANCED=y
223
224#
225# TCP congestion control
226#
227CONFIG_TCP_CONG_BIC=y
228CONFIG_TCP_CONG_WESTWOOD=m
229CONFIG_TCP_CONG_HTCP=m
230# CONFIG_TCP_CONG_HSTCP is not set
231# CONFIG_TCP_CONG_HYBLA is not set
232# CONFIG_TCP_CONG_VEGAS is not set
233# CONFIG_TCP_CONG_SCALABLE is not set
234# CONFIG_IPV6 is not set
235# CONFIG_NETFILTER is not set
236
237#
238# DCCP Configuration (EXPERIMENTAL)
239#
240# CONFIG_IP_DCCP is not set
241
242#
243# SCTP Configuration (EXPERIMENTAL)
244#
245# CONFIG_IP_SCTP is not set
246# CONFIG_ATM is not set
247# CONFIG_BRIDGE is not set
248# CONFIG_VLAN_8021Q is not set
249# CONFIG_DECNET is not set
250# CONFIG_LLC2 is not set
251# CONFIG_IPX is not set
252# CONFIG_ATALK is not set
253# CONFIG_X25 is not set
254# CONFIG_LAPB is not set
255# CONFIG_NET_DIVERT is not set
256# CONFIG_ECONET is not set
257# CONFIG_WAN_ROUTER is not set
258# CONFIG_NET_SCHED is not set
259# CONFIG_NET_CLS_ROUTE is not set
260
261#
262# Network testing
263#
264# CONFIG_NET_PKTGEN is not set
265# CONFIG_NETFILTER_NETLINK 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
280# CONFIG_FW_LOADER is not set
281
282#
283# Memory Technology Devices (MTD)
284#
285# CONFIG_MTD is not set
286
287#
288# Parallel port support
289#
290# CONFIG_PARPORT is not set
291
292#
293# Plug and Play support
294#
295
296#
297# Block devices
298#
299# CONFIG_BLK_DEV_FD is not set
300# CONFIG_BLK_CPQ_DA is not set
301# CONFIG_BLK_CPQ_CISS_DA is not set
302# CONFIG_BLK_DEV_DAC960 is not set
303# CONFIG_BLK_DEV_UMEM is not set
304# CONFIG_BLK_DEV_COW_COMMON is not set
305CONFIG_BLK_DEV_LOOP=m
306# CONFIG_BLK_DEV_CRYPTOLOOP is not set
307CONFIG_BLK_DEV_NBD=m
308# CONFIG_BLK_DEV_SX8 is not set
309# CONFIG_BLK_DEV_UB is not set
310CONFIG_BLK_DEV_RAM=y
311CONFIG_BLK_DEV_RAM_COUNT=16
312CONFIG_BLK_DEV_RAM_SIZE=4096
313# CONFIG_BLK_DEV_INITRD is not set
314# CONFIG_LBD is not set
315# CONFIG_CDROM_PKTCDVD is not set
316
317#
318# IO Schedulers
319#
320CONFIG_IOSCHED_NOOP=y
321CONFIG_IOSCHED_AS=y
322CONFIG_IOSCHED_DEADLINE=y
323CONFIG_IOSCHED_CFQ=y
324# CONFIG_ATA_OVER_ETH is not set
325
326#
327# ATA/ATAPI/MFM/RLL support
328#
329CONFIG_IDE=y
330CONFIG_BLK_DEV_IDE=y
331
332#
333# Please see Documentation/ide.txt for help/info on IDE drives
334#
335# CONFIG_BLK_DEV_IDE_SATA is not set
336CONFIG_BLK_DEV_IDEDISK=y
337# CONFIG_IDEDISK_MULTI_MODE is not set
338# CONFIG_BLK_DEV_IDECD is not set
339# CONFIG_BLK_DEV_IDETAPE is not set
340# CONFIG_BLK_DEV_IDEFLOPPY is not set
341# CONFIG_BLK_DEV_IDESCSI is not set
342# CONFIG_IDE_TASK_IOCTL is not set
343
344#
345# IDE chipset support/bugfixes
346#
347CONFIG_IDE_GENERIC=y
348CONFIG_BLK_DEV_IDEPCI=y
349# CONFIG_IDEPCI_SHARE_IRQ is not set
350# CONFIG_BLK_DEV_OFFBOARD is not set
351# CONFIG_BLK_DEV_GENERIC is not set
352# CONFIG_BLK_DEV_OPTI621 is not set
353CONFIG_BLK_DEV_IDEDMA_PCI=y
354# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
355# CONFIG_IDEDMA_PCI_AUTO is not set
356# CONFIG_BLK_DEV_AEC62XX is not set
357# CONFIG_BLK_DEV_ALI15X3 is not set
358# CONFIG_BLK_DEV_AMD74XX is not set
359# CONFIG_BLK_DEV_CMD64X is not set
360# CONFIG_BLK_DEV_TRIFLEX is not set
361# CONFIG_BLK_DEV_CY82C693 is not set
362# CONFIG_BLK_DEV_CS5520 is not set
363# CONFIG_BLK_DEV_CS5530 is not set
364# CONFIG_BLK_DEV_HPT34X is not set
365# CONFIG_BLK_DEV_HPT366 is not set
366# CONFIG_BLK_DEV_SC1200 is not set
367# CONFIG_BLK_DEV_PIIX is not set
368# CONFIG_BLK_DEV_IT821X is not set
369# CONFIG_BLK_DEV_NS87415 is not set
370# CONFIG_BLK_DEV_PDC202XX_OLD is not set
371# CONFIG_BLK_DEV_PDC202XX_NEW is not set
372# CONFIG_BLK_DEV_SVWKS is not set
373CONFIG_BLK_DEV_SIIMAGE=y
374# CONFIG_BLK_DEV_SLC90E66 is not set
375# CONFIG_BLK_DEV_TRM290 is not set
376# CONFIG_BLK_DEV_VIA82CXXX is not set
377# CONFIG_IDE_ARM is not set
378CONFIG_BLK_DEV_IDEDMA=y
379# CONFIG_IDEDMA_IVB is not set
380# CONFIG_IDEDMA_AUTO is not set
381# CONFIG_BLK_DEV_HD is not set
382
383#
384# SCSI device support
385#
386# CONFIG_RAID_ATTRS is not set
387CONFIG_SCSI=y
388CONFIG_SCSI_PROC_FS=y
389
390#
391# SCSI support type (disk, tape, CD-ROM)
392#
393CONFIG_BLK_DEV_SD=y
394# CONFIG_CHR_DEV_ST is not set
395# CONFIG_CHR_DEV_OSST is not set
396# CONFIG_BLK_DEV_SR is not set
397# CONFIG_CHR_DEV_SG is not set
398# CONFIG_CHR_DEV_SCH is not set
399
400#
401# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
402#
403# CONFIG_SCSI_MULTI_LUN is not set
404# CONFIG_SCSI_CONSTANTS is not set
405# CONFIG_SCSI_LOGGING is not set
406
407#
408# SCSI Transport Attributes
409#
410# CONFIG_SCSI_SPI_ATTRS is not set
411# CONFIG_SCSI_FC_ATTRS is not set
412# CONFIG_SCSI_ISCSI_ATTRS is not set
413
414#
415# SCSI low-level drivers
416#
417# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
418# CONFIG_SCSI_3W_9XXX is not set
419# CONFIG_SCSI_ARCMSR is not set
420# CONFIG_SCSI_ACARD is not set
421# CONFIG_SCSI_AACRAID is not set
422# CONFIG_SCSI_AIC7XXX is not set
423# CONFIG_SCSI_AIC7XXX_OLD is not set
424# CONFIG_SCSI_AIC79XX is not set
425# CONFIG_SCSI_DPT_I2O is not set
426# CONFIG_MEGARAID_NEWGEN is not set
427# CONFIG_MEGARAID_LEGACY is not set
428# CONFIG_SCSI_SATA is not set
429# CONFIG_SCSI_BUSLOGIC is not set
430# CONFIG_SCSI_DMX3191D is not set
431# CONFIG_SCSI_EATA is not set
432# CONFIG_SCSI_FUTURE_DOMAIN is not set
433# CONFIG_SCSI_GDTH is not set
434# CONFIG_SCSI_IPS is not set
435# CONFIG_SCSI_INITIO is not set
436# CONFIG_SCSI_INIA100 is not set
437# CONFIG_SCSI_SYM53C8XX_2 is not set
438# CONFIG_SCSI_IPR is not set
439# CONFIG_SCSI_QLOGIC_FC is not set
440# CONFIG_SCSI_QLOGIC_1280 is not set
441CONFIG_SCSI_QLA2XXX=y
442# CONFIG_SCSI_QLA21XX is not set
443# CONFIG_SCSI_QLA22XX is not set
444# CONFIG_SCSI_QLA2300 is not set
445# CONFIG_SCSI_QLA2322 is not set
446# CONFIG_SCSI_QLA6312 is not set
447# CONFIG_SCSI_QLA24XX is not set
448# CONFIG_SCSI_LPFC is not set
449# CONFIG_SCSI_DC395x is not set
450# CONFIG_SCSI_DC390T is not set
451# CONFIG_SCSI_NSP32 is not set
452# CONFIG_SCSI_DEBUG is not set
453
454#
455# Multi-device support (RAID and LVM)
456#
457# CONFIG_MD is not set
458
459#
460# Fusion MPT device support
461#
462# CONFIG_FUSION is not set
463# CONFIG_FUSION_SPI is not set
464# CONFIG_FUSION_FC is not set
465
466#
467# IEEE 1394 (FireWire) support
468#
469CONFIG_IEEE1394=m
470
471#
472# Subsystem Options
473#
474# CONFIG_IEEE1394_VERBOSEDEBUG is not set
475# CONFIG_IEEE1394_OUI_DB is not set
476CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
477CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
478# CONFIG_IEEE1394_EXPORT_FULL_API is not set
479
480#
481# Device Drivers
482#
483
484#
485# Texas Instruments PCILynx requires I2C
486#
487CONFIG_IEEE1394_OHCI1394=m
488
489#
490# Protocol Drivers
491#
492CONFIG_IEEE1394_VIDEO1394=m
493CONFIG_IEEE1394_SBP2=m
494# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
495CONFIG_IEEE1394_ETH1394=m
496CONFIG_IEEE1394_DV1394=m
497CONFIG_IEEE1394_RAWIO=m
498CONFIG_IEEE1394_CMP=m
499CONFIG_IEEE1394_AMDTP=m
500
501#
502# I2O device support
503#
504# CONFIG_I2O is not set
505
506#
507# Network device support
508#
509CONFIG_NETDEVICES=y
510CONFIG_DUMMY=m
511# CONFIG_BONDING is not set
512# CONFIG_EQUALIZER is not set
513# CONFIG_TUN is not set
514
515#
516# ARCnet devices
517#
518# CONFIG_ARCNET is not set
519
520#
521# PHY device support
522#
523# CONFIG_PHYLIB is not set
524
525#
526# Ethernet (10 or 100Mbit)
527#
528CONFIG_NET_ETHERNET=y
529CONFIG_MII=y
530# CONFIG_HAPPYMEAL is not set
531# CONFIG_SUNGEM is not set
532# CONFIG_NET_VENDOR_3COM is not set
533
534#
535# Tulip family network device support
536#
537# CONFIG_NET_TULIP is not set
538# CONFIG_HP100 is not set
539# CONFIG_NET_PCI is not set
540
541#
542# Ethernet (1000 Mbit)
543#
544# CONFIG_ACENIC is not set
545# CONFIG_DL2K is not set
546# CONFIG_E1000 is not set
547# CONFIG_NS83820 is not set
548# CONFIG_HAMACHI is not set
549# CONFIG_YELLOWFIN is not set
550CONFIG_R8169=y
551# CONFIG_R8169_NAPI is not set
552# CONFIG_SIS190 is not set
553# CONFIG_SKGE is not set
554# CONFIG_SKY2 is not set
555# CONFIG_SK98LIN is not set
556# CONFIG_TIGON3 is not set
557# CONFIG_BNX2 is not set
558
559#
560# Ethernet (10000 Mbit)
561#
562# CONFIG_CHELSIO_T1 is not set
563# CONFIG_IXGB is not set
564# CONFIG_S2IO is not set
565
566#
567# Token Ring devices
568#
569# CONFIG_TR is not set
570
571#
572# Wireless LAN (non-hamradio)
573#
574# CONFIG_NET_RADIO is not set
575
576#
577# Wan interfaces
578#
579# CONFIG_WAN is not set
580# CONFIG_FDDI is not set
581# CONFIG_HIPPI is not set
582# CONFIG_PPP is not set
583# CONFIG_SLIP is not set
584# CONFIG_NET_FC is not set
585# CONFIG_SHAPER is not set
586# CONFIG_NETCONSOLE is not set
587# CONFIG_KGDBOE is not set
588# CONFIG_NETPOLL is not set
589# CONFIG_NETPOLL_RX is not set
590# CONFIG_NETPOLL_TRAP is not set
591# CONFIG_NET_POLL_CONTROLLER is not set
592
593#
594# ISDN subsystem
595#
596# CONFIG_ISDN is not set
597
598#
599# Telephony Support
600#
601# CONFIG_PHONE is not set
602
603#
604# Input device support
605#
606CONFIG_INPUT=y
607
608#
609# Userland interfaces
610#
611# CONFIG_INPUT_MOUSEDEV is not set
612# CONFIG_INPUT_JOYDEV is not set
613# CONFIG_INPUT_TSDEV is not set
614# CONFIG_INPUT_EVDEV is not set
615# CONFIG_INPUT_EVBUG is not set
616
617#
618# Input Device Drivers
619#
620# CONFIG_INPUT_KEYBOARD is not set
621# CONFIG_INPUT_MOUSE is not set
622# CONFIG_INPUT_JOYSTICK is not set
623# CONFIG_INPUT_TOUCHSCREEN is not set
624# CONFIG_INPUT_MISC is not set
625
626#
627# Hardware I/O ports
628#
629# CONFIG_SERIO is not set
630# CONFIG_GAMEPORT is not set
631
632#
633# Character devices
634#
635CONFIG_VT=y
636CONFIG_VT_CONSOLE=y
637CONFIG_HW_CONSOLE=y
638# CONFIG_SERIAL_NONSTANDARD is not set
639
640#
641# Serial drivers
642#
643# CONFIG_SERIAL_8250 is not set
644
645#
646# Non-8250 serial port support
647#
648CONFIG_SERIAL_CORE=y
649CONFIG_SERIAL_CORE_CONSOLE=y
650CONFIG_SERIAL_VR41XX=y
651CONFIG_SERIAL_VR41XX_CONSOLE=y
652# CONFIG_SERIAL_JSM is not set
653CONFIG_UNIX98_PTYS=y
654CONFIG_LEGACY_PTYS=y
655CONFIG_LEGACY_PTY_COUNT=256
656
657#
658# IPMI
659#
660# CONFIG_IPMI_HANDLER is not set
661
662#
663# Watchdog Cards
664#
665# CONFIG_WATCHDOG is not set
666# CONFIG_RTC is not set
667# CONFIG_GEN_RTC is not set
668# CONFIG_RTC_VR41XX is not set
669# CONFIG_DTLK is not set
670# CONFIG_R3964 is not set
671# CONFIG_APPLICOM is not set
672# CONFIG_TANBAC_TB0219 is not set
673
674#
675# Ftape, the floppy tape device driver
676#
677# CONFIG_DRM is not set
678CONFIG_GPIO_VR41XX=y
679# CONFIG_RAW_DRIVER is not set
680
681#
682# TPM devices
683#
684# CONFIG_TCG_TPM is not set
685
686#
687# I2C support
688#
689# CONFIG_I2C is not set
690
691#
692# Dallas's 1-wire bus
693#
694# CONFIG_W1 is not set
695
696#
697# Hardware Monitoring support
698#
699# CONFIG_HWMON is not set
700# CONFIG_HWMON_VID is not set
701
702#
703# Misc devices
704#
705
706#
707# Multimedia Capabilities Port drivers
708#
709
710#
711# Multimedia devices
712#
713# CONFIG_VIDEO_DEV is not set
714
715#
716# Digital Video Broadcasting Devices
717#
718# CONFIG_DVB is not set
719
720#
721# Graphics support
722#
723# CONFIG_FB is not set
724
725#
726# Console display driver support
727#
728# CONFIG_VGA_CONSOLE is not set
729CONFIG_DUMMY_CONSOLE=y
730
731#
732# Speakup console speech
733#
734# CONFIG_SPEAKUP is not set
735
736#
737# Sound
738#
739# CONFIG_SOUND is not set
740
741#
742# USB support
743#
744CONFIG_USB_ARCH_HAS_HCD=y
745CONFIG_USB_ARCH_HAS_OHCI=y
746CONFIG_USB=m
747# CONFIG_USB_DEBUG is not set
748
749#
750# Miscellaneous USB options
751#
752# CONFIG_USB_DEVICEFS is not set
753# CONFIG_USB_BANDWIDTH is not set
754# CONFIG_USB_DYNAMIC_MINORS is not set
755# CONFIG_USB_OTG is not set
756
757#
758# USB Host Controller Drivers
759#
760CONFIG_USB_EHCI_HCD=m
761# CONFIG_USB_EHCI_SPLIT_ISO is not set
762# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
763# CONFIG_USB_ISP116X_HCD is not set
764CONFIG_USB_OHCI_HCD=m
765# CONFIG_USB_OHCI_BIG_ENDIAN is not set
766CONFIG_USB_OHCI_LITTLE_ENDIAN=y
767# CONFIG_USB_UHCI_HCD is not set
768# CONFIG_USB_SL811_HCD is not set
769
770#
771# USB Device Class drivers
772#
773# CONFIG_USB_BLUETOOTH_TTY is not set
774# CONFIG_USB_ACM is not set
775# CONFIG_USB_PRINTER is not set
776
777#
778# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
779#
780CONFIG_USB_STORAGE=m
781# CONFIG_USB_STORAGE_DEBUG is not set
782# CONFIG_USB_STORAGE_DATAFAB is not set
783# CONFIG_USB_STORAGE_FREECOM is not set
784# CONFIG_USB_STORAGE_ISD200 is not set
785# CONFIG_USB_STORAGE_DPCM is not set
786# CONFIG_USB_STORAGE_USBAT is not set
787# CONFIG_USB_STORAGE_SDDR09 is not set
788# CONFIG_USB_STORAGE_SDDR55 is not set
789# CONFIG_USB_STORAGE_JUMPSHOT is not set
790
791#
792# USB Input Devices
793#
794CONFIG_USB_HID=m
795CONFIG_USB_HIDINPUT=y
796# CONFIG_HID_FF is not set
797# CONFIG_USB_HIDDEV is not set
798
799#
800# USB HID Boot Protocol drivers
801#
802# CONFIG_USB_KBD is not set
803# CONFIG_USB_MOUSE is not set
804# CONFIG_USB_AIPTEK is not set
805# CONFIG_USB_WACOM is not set
806# CONFIG_USB_ACECAD is not set
807# CONFIG_USB_KBTAB is not set
808# CONFIG_USB_POWERMATE is not set
809# CONFIG_USB_MTOUCH is not set
810# CONFIG_USB_ITMTOUCH is not set
811# CONFIG_USB_EGALAX is not set
812# CONFIG_USB_YEALINK is not set
813# CONFIG_USB_XPAD is not set
814# CONFIG_USB_ATI_REMOTE is not set
815# CONFIG_USB_KEYSPAN_REMOTE is not set
816# CONFIG_USB_APPLETOUCH is not set
817
818#
819# USB Imaging devices
820#
821# CONFIG_USB_MDC800 is not set
822# CONFIG_USB_MICROTEK is not set
823
824#
825# USB Multimedia devices
826#
827# CONFIG_USB_DABUSB is not set
828
829#
830# Video4Linux support is needed for USB Multimedia device support
831#
832
833#
834# USB Network Adapters
835#
836# CONFIG_USB_CATC is not set
837# CONFIG_USB_KAWETH is not set
838# CONFIG_USB_PEGASUS is not set
839# CONFIG_USB_RTL8150 is not set
840# CONFIG_USB_USBNET is not set
841CONFIG_USB_MON=y
842
843#
844# USB port drivers
845#
846
847#
848# USB Serial Converter support
849#
850# CONFIG_USB_SERIAL is not set
851
852#
853# USB Miscellaneous drivers
854#
855# CONFIG_USB_EMI62 is not set
856# CONFIG_USB_EMI26 is not set
857# CONFIG_USB_AUERSWALD is not set
858# CONFIG_USB_RIO500 is not set
859# CONFIG_USB_LEGOTOWER is not set
860# CONFIG_USB_LCD is not set
861# CONFIG_USB_LED is not set
862# CONFIG_USB_CYTHERM is not set
863# CONFIG_USB_GOTEMP is not set
864# CONFIG_USB_PHIDGETKIT is not set
865# CONFIG_USB_PHIDGETSERVO is not set
866# CONFIG_USB_IDMOUSE is not set
867# CONFIG_USB_SISUSBVGA is not set
868# CONFIG_USB_LD is not set
869
870#
871# USB DSL modem support
872#
873
874#
875# USB Gadget Support
876#
877# CONFIG_USB_GADGET is not set
878
879#
880# MMC/SD Card support
881#
882# CONFIG_MMC is not set
883
884#
885# InfiniBand support
886#
887# CONFIG_INFINIBAND is not set
888
889#
890# SN Devices
891#
892
893#
894# Distributed Lock Manager
895#
896# CONFIG_DLM is not set
897
898#
899# File systems
900#
901CONFIG_EXT2_FS=y
902# CONFIG_EXT2_FS_XATTR is not set
903# CONFIG_EXT2_FS_XIP is not set
904# CONFIG_EXT3_FS is not set
905# CONFIG_REISER4_FS is not set
906# CONFIG_REISERFS_FS is not set
907# CONFIG_JFS_FS is not set
908# CONFIG_FS_POSIX_ACL is not set
909
910#
911# XFS support
912#
913CONFIG_XFS_FS=y
914# CONFIG_XFS_RT is not set
915CONFIG_XFS_QUOTA=y
916# CONFIG_XFS_SECURITY is not set
917CONFIG_XFS_POSIX_ACL=y
918# CONFIG_OCFS2_FS is not set
919# CONFIG_MINIX_FS is not set
920CONFIG_ROMFS_FS=m
921CONFIG_INOTIFY=y
922# CONFIG_QUOTA is not set
923CONFIG_QUOTACTL=y
924# CONFIG_DNOTIFY is not set
925# CONFIG_AUTOFS_FS is not set
926CONFIG_AUTOFS4_FS=y
927# CONFIG_FUSE_FS is not set
928
929#
930# CD-ROM/DVD Filesystems
931#
932# CONFIG_ISO9660_FS is not set
933# CONFIG_UDF_FS is not set
934
935#
936# DOS/FAT/NT Filesystems
937#
938# CONFIG_MSDOS_FS is not set
939# CONFIG_VFAT_FS is not set
940# CONFIG_NTFS_FS is not set
941
942#
943# Pseudo filesystems
944#
945CONFIG_PROC_FS=y
946CONFIG_PROC_KCORE=y
947CONFIG_SYSFS=y
948CONFIG_TMPFS=y
949# CONFIG_HUGETLB_PAGE is not set
950CONFIG_RAMFS=y
951# CONFIG_CONFIGFS_FS is not set
952# CONFIG_RELAYFS_FS is not set
953
954#
955# Miscellaneous filesystems
956#
957# CONFIG_ADFS_FS is not set
958# CONFIG_AFFS_FS is not set
959# CONFIG_ASFS_FS is not set
960# CONFIG_HFS_FS is not set
961# CONFIG_HFSPLUS_FS is not set
962# CONFIG_BEFS_FS is not set
963# CONFIG_BFS_FS is not set
964# CONFIG_EFS_FS is not set
965CONFIG_CRAMFS=m
966# CONFIG_VXFS_FS is not set
967# CONFIG_HPFS_FS is not set
968# CONFIG_QNX4FS_FS is not set
969# CONFIG_SYSV_FS is not set
970# CONFIG_UFS_FS is not set
971
972#
973# Network File Systems
974#
975CONFIG_NFS_FS=y
976CONFIG_NFS_V3=y
977# CONFIG_NFS_V3_ACL is not set
978# CONFIG_NFS_V4 is not set
979# CONFIG_NFS_DIRECTIO is not set
980# CONFIG_NFSD is not set
981CONFIG_ROOT_NFS=y
982CONFIG_LOCKD=y
983CONFIG_LOCKD_V4=y
984CONFIG_NFS_COMMON=y
985CONFIG_SUNRPC=y
986# CONFIG_RPCSEC_GSS_KRB5 is not set
987# CONFIG_RPCSEC_GSS_SPKM3 is not set
988# CONFIG_SMB_FS is not set
989# CONFIG_CIFS is not set
990# CONFIG_NCP_FS is not set
991# CONFIG_CODA_FS is not set
992# CONFIG_AFS_FS is not set
993# CONFIG_9P_FS is not set
994
995#
996# Partition Types
997#
998# CONFIG_PARTITION_ADVANCED is not set
999CONFIG_MSDOS_PARTITION=y
1000
1001#
1002# Native Language Support
1003#
1004# CONFIG_NLS is not set
1005
1006#
1007# Kernel hacking
1008#
1009# CONFIG_PRINTK_TIME is not set
1010# CONFIG_DEBUG_KERNEL is not set
1011CONFIG_LOG_BUF_SHIFT=14
1012CONFIG_CROSSCOMPILE=y
1013CONFIG_CMDLINE="mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
1014
1015#
1016# Security options
1017#
1018CONFIG_KEYS=y
1019CONFIG_KEYS_DEBUG_PROC_KEYS=y
1020# CONFIG_SECURITY is not set
1021
1022#
1023# Cryptographic options
1024#
1025# CONFIG_CRYPTO is not set
1026
1027#
1028# Hardware crypto devices
1029#
1030
1031#
1032# Library routines
1033#
1034# CONFIG_CRC_CCITT is not set
1035# CONFIG_CRC16 is not set
1036CONFIG_CRC32=y
1037# CONFIG_LIBCRC32C is not set
1038CONFIG_ZLIB_INFLATE=m
1039CONFIG_GENERIC_HARDIRQS=y
1040CONFIG_GENERIC_IRQ_PROBE=y
1041CONFIG_ISA_DMA_API=y
diff --git a/arch/mips/kernel/offset.c b/arch/mips/kernel/asm-offsets.c
index 2c11abb5a406..2c11abb5a406 100644
--- a/arch/mips/kernel/offset.c
+++ b/arch/mips/kernel/asm-offsets.c
diff --git a/arch/mips/kernel/genrtc.c b/arch/mips/kernel/genrtc.c
index 288bf51ad4ec..71416e7bbbaa 100644
--- a/arch/mips/kernel/genrtc.c
+++ b/arch/mips/kernel/genrtc.c
@@ -14,7 +14,7 @@
14#include <asm/rtc.h> 14#include <asm/rtc.h>
15#include <asm/time.h> 15#include <asm/time.h>
16 16
17static spinlock_t mips_rtc_lock = SPIN_LOCK_UNLOCKED; 17static DEFINE_SPINLOCK(mips_rtc_lock);
18 18
19unsigned int get_rtc_time(struct rtc_time *time) 19unsigned int get_rtc_time(struct rtc_time *time)
20{ 20{
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index 7eec7568bfea..447759201d1d 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -31,7 +31,7 @@ void disable_8259A_irq(unsigned int irq);
31 * moves to arch independent land 31 * moves to arch independent land
32 */ 32 */
33 33
34spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED; 34spinlock_t DEFINE_SPINLOCK(i8259A_lock);
35 35
36static void end_8259A_irq (unsigned int irq) 36static void end_8259A_irq (unsigned int irq)
37{ 37{
diff --git a/arch/mips/kernel/irixioctl.c b/arch/mips/kernel/irixioctl.c
index 4cd3d38a22c2..3cdc22346f4c 100644
--- a/arch/mips/kernel/irixioctl.c
+++ b/arch/mips/kernel/irixioctl.c
@@ -14,6 +14,7 @@
14#include <linux/syscalls.h> 14#include <linux/syscalls.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/file.h> 16#include <linux/file.h>
17#include <linux/rcupdate.h>
17 18
18#include <asm/uaccess.h> 19#include <asm/uaccess.h>
19#include <asm/ioctl.h> 20#include <asm/ioctl.h>
@@ -33,7 +34,7 @@ static struct tty_struct *get_tty(int fd)
33 struct file *filp; 34 struct file *filp;
34 struct tty_struct *ttyp = NULL; 35 struct tty_struct *ttyp = NULL;
35 36
36 spin_lock(&current->files->file_lock); 37 rcu_read_lock();
37 filp = fcheck(fd); 38 filp = fcheck(fd);
38 if(filp && filp->private_data) { 39 if(filp && filp->private_data) {
39 ttyp = (struct tty_struct *) filp->private_data; 40 ttyp = (struct tty_struct *) filp->private_data;
@@ -41,7 +42,7 @@ static struct tty_struct *get_tty(int fd)
41 if(ttyp->magic != TTY_MAGIC) 42 if(ttyp->magic != TTY_MAGIC)
42 ttyp =NULL; 43 ttyp =NULL;
43 } 44 }
44 spin_unlock(&current->files->file_lock); 45 rcu_read_unlock();
45 return ttyp; 46 return ttyp;
46} 47}
47 48
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 4c114ae21793..eff89322ba50 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -440,18 +440,6 @@ struct irix5_siginfo {
440 } stuff; 440 } stuff;
441}; 441};
442 442
443static inline unsigned long timespectojiffies(struct timespec *value)
444{
445 unsigned long sec = (unsigned) value->tv_sec;
446 long nsec = value->tv_nsec;
447
448 if (sec > (LONG_MAX / HZ))
449 return LONG_MAX;
450 nsec += 1000000000L / HZ - 1;
451 nsec /= 1000000000L / HZ;
452 return HZ * sec + nsec;
453}
454
455asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info, 443asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
456 struct timespec *tp) 444 struct timespec *tp)
457{ 445{
@@ -489,14 +477,13 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
489 error = -EINVAL; 477 error = -EINVAL;
490 goto out; 478 goto out;
491 } 479 }
492 expire = timespectojiffies(tp)+(tp->tv_sec||tp->tv_nsec); 480 expire = timespec_to_jiffies(tp) + (tp->tv_sec||tp->tv_nsec);
493 } 481 }
494 482
495 while(1) { 483 while(1) {
496 long tmp = 0; 484 long tmp = 0;
497 485
498 current->state = TASK_INTERRUPTIBLE; 486 expire = schedule_timeout_interruptible(expire);
499 expire = schedule_timeout(expire);
500 487
501 for (i=0; i<=4; i++) 488 for (i=0; i<=4; i++)
502 tmp |= (current->pending.signal.sig[i] & kset.sig[i]); 489 tmp |= (current->pending.signal.sig[i] & kset.sig[i]);
diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S
index f83c31f720c4..ac68e68339db 100644
--- a/arch/mips/kernel/r2300_fpu.S
+++ b/arch/mips/kernel/r2300_fpu.S
@@ -15,7 +15,7 @@
15#include <asm/errno.h> 15#include <asm/errno.h>
16#include <asm/fpregdef.h> 16#include <asm/fpregdef.h>
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/offset.h> 18#include <asm/asm-offsets.h>
19#include <asm/regdef.h> 19#include <asm/regdef.h>
20 20
21#define EX(a,b) \ 21#define EX(a,b) \
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index f10019640ee9..0d9c4a32a9c2 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -15,7 +15,7 @@
15#include <asm/cachectl.h> 15#include <asm/cachectl.h>
16#include <asm/fpregdef.h> 16#include <asm/fpregdef.h>
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/offset.h> 18#include <asm/asm-offsets.h>
19#include <asm/page.h> 19#include <asm/page.h>
20#include <asm/regdef.h> 20#include <asm/regdef.h>
21#include <asm/stackframe.h> 21#include <asm/stackframe.h>
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index aba665bcb386..1a14c6b18829 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -17,7 +17,7 @@
17#include <asm/errno.h> 17#include <asm/errno.h>
18#include <asm/fpregdef.h> 18#include <asm/fpregdef.h>
19#include <asm/mipsregs.h> 19#include <asm/mipsregs.h>
20#include <asm/offset.h> 20#include <asm/asm-offsets.h>
21#include <asm/regdef.h> 21#include <asm/regdef.h>
22 22
23 .macro EX insn, reg, src 23 .macro EX insn, reg, src
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index e02b7722ccb8..d2afbd19a9c8 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -15,7 +15,7 @@
15#include <asm/cachectl.h> 15#include <asm/cachectl.h>
16#include <asm/fpregdef.h> 16#include <asm/fpregdef.h>
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/offset.h> 18#include <asm/asm-offsets.h>
19#include <asm/page.h> 19#include <asm/page.h>
20#include <asm/pgtable-bits.h> 20#include <asm/pgtable-bits.h>
21#include <asm/regdef.h> 21#include <asm/regdef.h>
diff --git a/arch/mips/kernel/r6000_fpu.S b/arch/mips/kernel/r6000_fpu.S
index d8d3b13fe57f..43cda53f5af6 100644
--- a/arch/mips/kernel/r6000_fpu.S
+++ b/arch/mips/kernel/r6000_fpu.S
@@ -13,7 +13,7 @@
13#include <asm/asm.h> 13#include <asm/asm.h>
14#include <asm/fpregdef.h> 14#include <asm/fpregdef.h>
15#include <asm/mipsregs.h> 15#include <asm/mipsregs.h>
16#include <asm/offset.h> 16#include <asm/asm-offsets.h>
17#include <asm/regdef.h> 17#include <asm/regdef.h>
18 18
19 .set noreorder 19 .set noreorder
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 344f2e29eb61..17b5030fb6ea 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -19,7 +19,7 @@
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/unistd.h> 20#include <asm/unistd.h>
21#include <asm/war.h> 21#include <asm/war.h>
22#include <asm/offset.h> 22#include <asm/asm-offsets.h>
23 23
24/* Highest syscall used of any syscall flavour */ 24/* Highest syscall used of any syscall flavour */
25#define MAX_SYSCALL_NO __NR_O32_Linux + __NR_O32_Linux_syscalls 25#define MAX_SYSCALL_NO __NR_O32_Linux + __NR_O32_Linux_syscalls
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 32efb888160a..ffb22a2068bf 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -14,7 +14,7 @@
14#include <asm/mipsregs.h> 14#include <asm/mipsregs.h>
15#include <asm/regdef.h> 15#include <asm/regdef.h>
16#include <asm/stackframe.h> 16#include <asm/stackframe.h>
17#include <asm/offset.h> 17#include <asm/asm-offsets.h>
18#include <asm/sysmips.h> 18#include <asm/sysmips.h>
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/unistd.h> 20#include <asm/unistd.h>
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index ae2a1312d4ef..21e3e13a4b44 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -31,7 +31,7 @@
31#include <asm/cachectl.h> 31#include <asm/cachectl.h>
32#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
33#include <asm/ipc.h> 33#include <asm/ipc.h>
34#include <asm/offset.h> 34#include <asm/asm-offsets.h>
35#include <asm/signal.h> 35#include <asm/signal.h>
36#include <asm/sim.h> 36#include <asm/sim.h>
37#include <asm/shmparam.h> 37#include <asm/shmparam.h>
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index b46595462717..4de155699c4f 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -1032,8 +1032,7 @@ bad:
1032 1032
1033asmlinkage int irix_sginap(int ticks) 1033asmlinkage int irix_sginap(int ticks)
1034{ 1034{
1035 current->state = TASK_INTERRUPTIBLE; 1035 schedule_timeout_interruptible(ticks);
1036 schedule_timeout(ticks);
1037 return 0; 1036 return 0;
1038} 1037}
1039 1038
diff --git a/arch/mips/lib-32/memset.S b/arch/mips/lib-32/memset.S
index ad9ff4071ce9..1981485bd48b 100644
--- a/arch/mips/lib-32/memset.S
+++ b/arch/mips/lib-32/memset.S
@@ -7,7 +7,7 @@
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */ 8 */
9#include <asm/asm.h> 9#include <asm/asm.h>
10#include <asm/offset.h> 10#include <asm/asm-offsets.h>
11#include <asm/regdef.h> 11#include <asm/regdef.h>
12 12
13#define EX(insn,reg,addr,handler) \ 13#define EX(insn,reg,addr,handler) \
diff --git a/arch/mips/lib-64/memset.S b/arch/mips/lib-64/memset.S
index 242f1976cfaf..e2c42c85113b 100644
--- a/arch/mips/lib-64/memset.S
+++ b/arch/mips/lib-64/memset.S
@@ -7,7 +7,7 @@
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */ 8 */
9#include <asm/asm.h> 9#include <asm/asm.h>
10#include <asm/offset.h> 10#include <asm/asm-offsets.h>
11#include <asm/regdef.h> 11#include <asm/regdef.h>
12 12
13#define EX(insn,reg,addr,handler) \ 13#define EX(insn,reg,addr,handler) \
diff --git a/arch/mips/lib/dec_and_lock.c b/arch/mips/lib/dec_and_lock.c
index e44e9579bd36..fd82c84a93b7 100644
--- a/arch/mips/lib/dec_and_lock.c
+++ b/arch/mips/lib/dec_and_lock.c
@@ -20,14 +20,7 @@
20 * has a cmpxchg, and where atomic->value is an int holding 20 * has a cmpxchg, and where atomic->value is an int holding
21 * the value of the atomic (i.e. the high bits aren't used 21 * the value of the atomic (i.e. the high bits aren't used
22 * for a lock or anything like that). 22 * for a lock or anything like that).
23 *
24 * N.B. ATOMIC_DEC_AND_LOCK gets defined in include/linux/spinlock.h
25 * if spinlocks are empty and thus atomic_dec_and_lock is defined
26 * to be atomic_dec_and_test - in that case we don't need it
27 * defined here as well.
28 */ 23 */
29
30#ifndef ATOMIC_DEC_AND_LOCK
31int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock) 24int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
32{ 25{
33 int counter; 26 int counter;
@@ -52,4 +45,3 @@ int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
52} 45}
53 46
54EXPORT_SYMBOL(_atomic_dec_and_lock); 47EXPORT_SYMBOL(_atomic_dec_and_lock);
55#endif /* ATOMIC_DEC_AND_LOCK */
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S
index 90ee8d43261f..a78865f76547 100644
--- a/arch/mips/lib/memcpy.S
+++ b/arch/mips/lib/memcpy.S
@@ -14,7 +14,7 @@
14 */ 14 */
15#include <linux/config.h> 15#include <linux/config.h>
16#include <asm/asm.h> 16#include <asm/asm.h>
17#include <asm/offset.h> 17#include <asm/asm-offsets.h>
18#include <asm/regdef.h> 18#include <asm/regdef.h>
19 19
20#define dst a0 20#define dst a0
diff --git a/arch/mips/lib/strlen_user.S b/arch/mips/lib/strlen_user.S
index 07660e86c99d..eca558d83a37 100644
--- a/arch/mips/lib/strlen_user.S
+++ b/arch/mips/lib/strlen_user.S
@@ -7,7 +7,7 @@
7 * Copyright (c) 1999 Silicon Graphics, Inc. 7 * Copyright (c) 1999 Silicon Graphics, Inc.
8 */ 8 */
9#include <asm/asm.h> 9#include <asm/asm.h>
10#include <asm/offset.h> 10#include <asm/asm-offsets.h>
11#include <asm/regdef.h> 11#include <asm/regdef.h>
12 12
13#define EX(insn,reg,addr,handler) \ 13#define EX(insn,reg,addr,handler) \
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S
index 14bed17c1648..d16c76fbfac7 100644
--- a/arch/mips/lib/strncpy_user.S
+++ b/arch/mips/lib/strncpy_user.S
@@ -7,7 +7,7 @@
7 */ 7 */
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <asm/asm.h> 9#include <asm/asm.h>
10#include <asm/offset.h> 10#include <asm/asm-offsets.h>
11#include <asm/regdef.h> 11#include <asm/regdef.h>
12 12
13#define EX(insn,reg,addr,handler) \ 13#define EX(insn,reg,addr,handler) \
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S
index 6e7a8eed4de8..c0ea15194a0e 100644
--- a/arch/mips/lib/strnlen_user.S
+++ b/arch/mips/lib/strnlen_user.S
@@ -7,7 +7,7 @@
7 * Copyright (c) 1999 Silicon Graphics, Inc. 7 * Copyright (c) 1999 Silicon Graphics, Inc.
8 */ 8 */
9#include <asm/asm.h> 9#include <asm/asm.h>
10#include <asm/offset.h> 10#include <asm/asm-offsets.h>
11#include <asm/regdef.h> 11#include <asm/regdef.h>
12 12
13#define EX(insn,reg,addr,handler) \ 13#define EX(insn,reg,addr,handler) \
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index c53e4cb359ba..83d81c9cdc2b 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -48,6 +48,7 @@ obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o
48obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o 48obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o
49obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o 49obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
50obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o 50obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o
51obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o
51obj-$(CONFIG_TOSHIBA_JMR3927) += fixup-jmr3927.o pci-jmr3927.o 52obj-$(CONFIG_TOSHIBA_JMR3927) += fixup-jmr3927.o pci-jmr3927.o
52obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o ops-tx4927.o 53obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o ops-tx4927.o
53obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o 54obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o
diff --git a/arch/mips/pci/fixup-tb0287.c b/arch/mips/pci/fixup-tb0287.c
new file mode 100644
index 000000000000..8436d7f1fdb2
--- /dev/null
+++ b/arch/mips/pci/fixup-tb0287.c
@@ -0,0 +1,65 @@
1/*
2 * fixup-tb0287.c, The TANBAC TB0287 specific PCI fixups.
3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/pci.h>
22
23#include <asm/vr41xx/tb0287.h>
24
25int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
26{
27 unsigned char bus;
28 int irq = -1;
29
30 bus = dev->bus->number;
31 if (bus == 0) {
32 switch (slot) {
33 case 16:
34 irq = TB0287_SM501_IRQ;
35 break;
36 case 17:
37 irq = TB0287_SIL680A_IRQ;
38 break;
39 default:
40 break;
41 }
42 } else if (bus == 1) {
43 switch (PCI_SLOT(dev->devfn)) {
44 case 0:
45 irq = TB0287_PCI_SLOT_IRQ;
46 break;
47 case 2:
48 case 3:
49 irq = TB0287_RTL8110_IRQ;
50 break;
51 default:
52 break;
53 }
54 } else if (bus > 1) {
55 irq = TB0287_PCI_SLOT_IRQ;
56 }
57
58 return irq;
59}
60
61/* Do platform specific device initialization at pci_enable_device() time */
62int pcibios_plat_dev_init(struct pci_dev *dev)
63{
64 return 0;
65}
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 0403d2fcb85e..3b339b1cce13 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -100,15 +100,7 @@ kernel_install: vmlinux
100 100
101install: kernel_install modules_install 101install: kernel_install modules_install
102 102
103prepare: include/asm-parisc/offsets.h 103CLEAN_FILES += lifimage
104
105arch/parisc/kernel/asm-offsets.s: include/asm include/linux/version.h \
106 include/config/MARKER
107
108include/asm-parisc/offsets.h: arch/parisc/kernel/asm-offsets.s
109 $(call filechk,gen-asm-offsets)
110
111CLEAN_FILES += lifimage include/asm-parisc/offsets.h
112MRPROPER_FILES += palo.conf 104MRPROPER_FILES += palo.conf
113 105
114define archhelp 106define archhelp
diff --git a/arch/parisc/hpux/gate.S b/arch/parisc/hpux/gate.S
index 2680a1c0fa77..aaaf3306c05a 100644
--- a/arch/parisc/hpux/gate.S
+++ b/arch/parisc/hpux/gate.S
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include <asm/assembly.h> 11#include <asm/assembly.h>
12#include <asm/offsets.h> 12#include <asm/asm-offsets.h>
13#include <asm/unistd.h> 13#include <asm/unistd.h>
14#include <asm/errno.h> 14#include <asm/errno.h>
15 15
diff --git a/arch/parisc/hpux/wrappers.S b/arch/parisc/hpux/wrappers.S
index 1aa936dfe147..0b0c3a66b1be 100644
--- a/arch/parisc/hpux/wrappers.S
+++ b/arch/parisc/hpux/wrappers.S
@@ -24,7 +24,7 @@
24#warning PA64 support needs more work...did first cut 24#warning PA64 support needs more work...did first cut
25#endif 25#endif
26 26
27#include <asm/offsets.h> 27#include <asm/asm-offsets.h>
28#include <asm/assembly.h> 28#include <asm/assembly.h>
29#include <asm/signal.h> 29#include <asm/signal.h>
30 30
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index ee58d37dbb27..be0f07f2fa58 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include <linux/config.h> 25#include <linux/config.h>
26#include <asm/offsets.h> 26#include <asm/asm-offsets.h>
27 27
28/* we have the following possibilities to act on an interruption: 28/* we have the following possibilities to act on an interruption:
29 * - handle in assembly and use shadowed registers only 29 * - handle in assembly and use shadowed registers only
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
index ddf7e914f15e..28405edf8448 100644
--- a/arch/parisc/kernel/head.S
+++ b/arch/parisc/kernel/head.S
@@ -14,7 +14,7 @@
14 14
15#include <linux/autoconf.h> /* for CONFIG_SMP */ 15#include <linux/autoconf.h> /* for CONFIG_SMP */
16 16
17#include <asm/offsets.h> 17#include <asm/asm-offsets.h>
18#include <asm/psw.h> 18#include <asm/psw.h>
19#include <asm/pdc.h> 19#include <asm/pdc.h>
20 20
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 4fc04501d5e5..46b759385115 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -47,7 +47,7 @@
47#include <linux/kallsyms.h> 47#include <linux/kallsyms.h>
48 48
49#include <asm/io.h> 49#include <asm/io.h>
50#include <asm/offsets.h> 50#include <asm/asm-offsets.h>
51#include <asm/pdc.h> 51#include <asm/pdc.h>
52#include <asm/pdc_chassis.h> 52#include <asm/pdc_chassis.h>
53#include <asm/pgalloc.h> 53#include <asm/pgalloc.h>
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index c07db9dff7cd..f3428e5e86fb 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -23,7 +23,7 @@
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/processor.h> 25#include <asm/processor.h>
26#include <asm/offsets.h> 26#include <asm/asm-offsets.h>
27 27
28/* PSW bits we allow the debugger to modify */ 28/* PSW bits we allow the debugger to modify */
29#define USER_PSW_BITS (PSW_N | PSW_V | PSW_CB) 29#define USER_PSW_BITS (PSW_N | PSW_V | PSW_CB)
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 55d71c15e1f7..0224651fd8f1 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -32,7 +32,7 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <asm/pgalloc.h> 33#include <asm/pgalloc.h>
34#include <asm/cacheflush.h> 34#include <asm/cacheflush.h>
35#include <asm/offsets.h> 35#include <asm/asm-offsets.h>
36 36
37#ifdef CONFIG_COMPAT 37#ifdef CONFIG_COMPAT
38#include <linux/compat.h> 38#include <linux/compat.h>
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 32ea701f4d20..8c7a7185cd3b 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -7,7 +7,7 @@
7 * sorry about the wall, puffin.. 7 * sorry about the wall, puffin..
8 */ 8 */
9 9
10#include <asm/offsets.h> 10#include <asm/asm-offsets.h>
11#include <asm/unistd.h> 11#include <asm/unistd.h>
12#include <asm/errno.h> 12#include <asm/errno.h>
13#include <asm/psw.h> 13#include <asm/psw.h>
diff --git a/arch/parisc/lib/Makefile b/arch/parisc/lib/Makefile
index 7bf705676297..5f2e6904d14a 100644
--- a/arch/parisc/lib/Makefile
+++ b/arch/parisc/lib/Makefile
@@ -5,5 +5,3 @@
5lib-y := lusercopy.o bitops.o checksum.o io.o memset.o fixup.o memcpy.o 5lib-y := lusercopy.o bitops.o checksum.o io.o memset.o fixup.o memcpy.o
6 6
7obj-y := iomap.o 7obj-y := iomap.o
8
9lib-$(CONFIG_SMP) += debuglocks.o
diff --git a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c
index 2de182f6fe8a..90f400b10282 100644
--- a/arch/parisc/lib/bitops.c
+++ b/arch/parisc/lib/bitops.c
@@ -13,8 +13,8 @@
13#include <asm/atomic.h> 13#include <asm/atomic.h>
14 14
15#ifdef CONFIG_SMP 15#ifdef CONFIG_SMP
16spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = { 16raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = {
17 [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED 17 [0 ... (ATOMIC_HASH_SIZE-1)] = __RAW_SPIN_LOCK_UNLOCKED
18}; 18};
19#endif 19#endif
20 20
diff --git a/arch/parisc/lib/debuglocks.c b/arch/parisc/lib/debuglocks.c
deleted file mode 100644
index 1b33fe6e5b7a..000000000000
--- a/arch/parisc/lib/debuglocks.c
+++ /dev/null
@@ -1,277 +0,0 @@
1/*
2 * Debugging versions of SMP locking primitives.
3 *
4 * Copyright (C) 2004 Thibaut VARENE <varenet@parisc-linux.org>
5 *
6 * Some code stollen from alpha & sparc64 ;)
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 * We use pdc_printf() throughout the file for all output messages, to avoid
23 * losing messages because of disabled interrupts. Since we're using these
24 * messages for debugging purposes, it makes sense not to send them to the
25 * linux console.
26 */
27
28
29#include <linux/config.h>
30#include <linux/kernel.h>
31#include <linux/sched.h>
32#include <linux/spinlock.h>
33#include <linux/hardirq.h> /* in_interrupt() */
34#include <asm/system.h>
35#include <asm/hardirq.h> /* in_interrupt() */
36#include <asm/pdc.h>
37
38#undef INIT_STUCK
39#define INIT_STUCK 1L << 30
40
41#ifdef CONFIG_DEBUG_SPINLOCK
42
43
44void _dbg_spin_lock(spinlock_t * lock, const char *base_file, int line_no)
45{
46 volatile unsigned int *a;
47 long stuck = INIT_STUCK;
48 void *inline_pc = __builtin_return_address(0);
49 unsigned long started = jiffies;
50 int printed = 0;
51 int cpu = smp_processor_id();
52
53try_again:
54
55 /* Do the actual locking */
56 /* <T-Bone> ggg: we can't get stuck on the outter loop?
57 * <ggg> T-Bone: We can hit the outer loop
58 * alot if multiple CPUs are constantly racing for a lock
59 * and the backplane is NOT fair about which CPU sees
60 * the update first. But it won't hang since every failed
61 * attempt will drop us back into the inner loop and
62 * decrement `stuck'.
63 * <ggg> K-class and some of the others are NOT fair in the HW
64 * implementation so we could see false positives.
65 * But fixing the lock contention is easier than
66 * fixing the HW to be fair.
67 * <tausq> __ldcw() returns 1 if we get the lock; otherwise we
68 * spin until the value of the lock changes, or we time out.
69 */
70 mb();
71 a = __ldcw_align(lock);
72 while (stuck && (__ldcw(a) == 0))
73 while ((*a == 0) && --stuck);
74 mb();
75
76 if (unlikely(stuck <= 0)) {
77 pdc_printf(
78 "%s:%d: spin_lock(%s/%p) stuck in %s at %p(%d)"
79 " owned by %s:%d in %s at %p(%d)\n",
80 base_file, line_no, lock->module, lock,
81 current->comm, inline_pc, cpu,
82 lock->bfile, lock->bline, lock->task->comm,
83 lock->previous, lock->oncpu);
84 stuck = INIT_STUCK;
85 printed = 1;
86 goto try_again;
87 }
88
89 /* Exiting. Got the lock. */
90 lock->oncpu = cpu;
91 lock->previous = inline_pc;
92 lock->task = current;
93 lock->bfile = (char *)base_file;
94 lock->bline = line_no;
95
96 if (unlikely(printed)) {
97 pdc_printf(
98 "%s:%d: spin_lock grabbed in %s at %p(%d) %ld ticks\n",
99 base_file, line_no, current->comm, inline_pc,
100 cpu, jiffies - started);
101 }
102}
103
104void _dbg_spin_unlock(spinlock_t * lock, const char *base_file, int line_no)
105{
106 CHECK_LOCK(lock);
107 volatile unsigned int *a;
108 mb();
109 a = __ldcw_align(lock);
110 if (unlikely((*a != 0) && lock->babble)) {
111 lock->babble--;
112 pdc_printf(
113 "%s:%d: spin_unlock(%s:%p) not locked\n",
114 base_file, line_no, lock->module, lock);
115 }
116 *a = 1;
117 mb();
118}
119
120int _dbg_spin_trylock(spinlock_t * lock, const char *base_file, int line_no)
121{
122 int ret;
123 volatile unsigned int *a;
124 mb();
125 a = __ldcw_align(lock);
126 ret = (__ldcw(a) != 0);
127 mb();
128 if (ret) {
129 lock->oncpu = smp_processor_id();
130 lock->previous = __builtin_return_address(0);
131 lock->task = current;
132 } else {
133 lock->bfile = (char *)base_file;
134 lock->bline = line_no;
135 }
136 return ret;
137}
138
139#endif /* CONFIG_DEBUG_SPINLOCK */
140
141#ifdef CONFIG_DEBUG_RWLOCK
142
143/* Interrupts trouble detailed explanation, thx Grant:
144 *
145 * o writer (wants to modify data) attempts to acquire the rwlock
146 * o He gets the write lock.
147 * o Interupts are still enabled, we take an interrupt with the
148 * write still holding the lock.
149 * o interrupt handler tries to acquire the rwlock for read.
150 * o deadlock since the writer can't release it at this point.
151 *
152 * In general, any use of spinlocks that competes between "base"
153 * level and interrupt level code will risk deadlock. Interrupts
154 * need to be disabled in the base level routines to avoid it.
155 * Or more precisely, only the IRQ the base level routine
156 * is competing with for the lock. But it's more efficient/faster
157 * to just disable all interrupts on that CPU to guarantee
158 * once it gets the lock it can release it quickly too.
159 */
160
161void _dbg_write_lock(rwlock_t *rw, const char *bfile, int bline)
162{
163 void *inline_pc = __builtin_return_address(0);
164 unsigned long started = jiffies;
165 long stuck = INIT_STUCK;
166 int printed = 0;
167 int cpu = smp_processor_id();
168
169 if(unlikely(in_interrupt())) { /* acquiring write lock in interrupt context, bad idea */
170 pdc_printf("write_lock caller: %s:%d, IRQs enabled,\n", bfile, bline);
171 BUG();
172 }
173
174 /* Note: if interrupts are disabled (which is most likely), the printk
175 will never show on the console. We might need a polling method to flush
176 the dmesg buffer anyhow. */
177
178retry:
179 _raw_spin_lock(&rw->lock);
180
181 if(rw->counter != 0) {
182 /* this basically never happens */
183 _raw_spin_unlock(&rw->lock);
184
185 stuck--;
186 if ((unlikely(stuck <= 0)) && (rw->counter < 0)) {
187 pdc_printf(
188 "%s:%d: write_lock stuck on writer"
189 " in %s at %p(%d) %ld ticks\n",
190 bfile, bline, current->comm, inline_pc,
191 cpu, jiffies - started);
192 stuck = INIT_STUCK;
193 printed = 1;
194 }
195 else if (unlikely(stuck <= 0)) {
196 pdc_printf(
197 "%s:%d: write_lock stuck on reader"
198 " in %s at %p(%d) %ld ticks\n",
199 bfile, bline, current->comm, inline_pc,
200 cpu, jiffies - started);
201 stuck = INIT_STUCK;
202 printed = 1;
203 }
204
205 while(rw->counter != 0);
206
207 goto retry;
208 }
209
210 /* got it. now leave without unlocking */
211 rw->counter = -1; /* remember we are locked */
212
213 if (unlikely(printed)) {
214 pdc_printf(
215 "%s:%d: write_lock grabbed in %s at %p(%d) %ld ticks\n",
216 bfile, bline, current->comm, inline_pc,
217 cpu, jiffies - started);
218 }
219}
220
221int _dbg_write_trylock(rwlock_t *rw, const char *bfile, int bline)
222{
223#if 0
224 void *inline_pc = __builtin_return_address(0);
225 int cpu = smp_processor_id();
226#endif
227
228 if(unlikely(in_interrupt())) { /* acquiring write lock in interrupt context, bad idea */
229 pdc_printf("write_lock caller: %s:%d, IRQs enabled,\n", bfile, bline);
230 BUG();
231 }
232
233 /* Note: if interrupts are disabled (which is most likely), the printk
234 will never show on the console. We might need a polling method to flush
235 the dmesg buffer anyhow. */
236
237 _raw_spin_lock(&rw->lock);
238
239 if(rw->counter != 0) {
240 /* this basically never happens */
241 _raw_spin_unlock(&rw->lock);
242 return 0;
243 }
244
245 /* got it. now leave without unlocking */
246 rw->counter = -1; /* remember we are locked */
247#if 0
248 pdc_printf("%s:%d: try write_lock grabbed in %s at %p(%d)\n",
249 bfile, bline, current->comm, inline_pc, cpu);
250#endif
251 return 1;
252}
253
254void _dbg_read_lock(rwlock_t * rw, const char *bfile, int bline)
255{
256#if 0
257 void *inline_pc = __builtin_return_address(0);
258 unsigned long started = jiffies;
259 int cpu = smp_processor_id();
260#endif
261 unsigned long flags;
262
263 local_irq_save(flags);
264 _raw_spin_lock(&rw->lock);
265
266 rw->counter++;
267#if 0
268 pdc_printf(
269 "%s:%d: read_lock grabbed in %s at %p(%d) %ld ticks\n",
270 bfile, bline, current->comm, inline_pc,
271 cpu, jiffies - started);
272#endif
273 _raw_spin_unlock(&rw->lock);
274 local_irq_restore(flags);
275}
276
277#endif /* CONFIG_DEBUG_RWLOCK */
diff --git a/arch/parisc/lib/fixup.S b/arch/parisc/lib/fixup.S
index 134f0cd240f5..1b91612ed964 100644
--- a/arch/parisc/lib/fixup.S
+++ b/arch/parisc/lib/fixup.S
@@ -20,7 +20,7 @@
20 * Fixup routines for kernel exception handling. 20 * Fixup routines for kernel exception handling.
21 */ 21 */
22#include <linux/config.h> 22#include <linux/config.h>
23#include <asm/offsets.h> 23#include <asm/asm-offsets.h>
24#include <asm/assembly.h> 24#include <asm/assembly.h>
25#include <asm/errno.h> 25#include <asm/errno.h>
26 26
diff --git a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c
index 89fe0ceeaa40..2ca9ec7ec3a7 100644
--- a/arch/ppc/8xx_io/cs4218_tdm.c
+++ b/arch/ppc/8xx_io/cs4218_tdm.c
@@ -1380,7 +1380,7 @@ static void cs_nosound(unsigned long xx)
1380 spin_unlock_irqrestore(&cs4218_lock, flags); 1380 spin_unlock_irqrestore(&cs4218_lock, flags);
1381} 1381}
1382 1382
1383static struct timer_list beep_timer = TIMER_INITIALIZER(cs_nosound, 0, 0); 1383static DEFINE_TIMER(beep_timer, cs_nosound, 0, 0);
1384}; 1384};
1385 1385
1386static void cs_mksound(unsigned int hz, unsigned int ticks) 1386static void cs_mksound(unsigned int hz, unsigned int ticks)
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 6ab7e5ea5fcf..347ea284140b 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -265,6 +265,15 @@ config PPC601_SYNC_FIX
265 265
266 If in doubt, say Y here. 266 If in doubt, say Y here.
267 267
268config HOTPLUG_CPU
269 bool "Support for enabling/disabling CPUs"
270 depends on SMP && HOTPLUG && EXPERIMENTAL && PPC_PMAC
271 ---help---
272 Say Y here to be able to disable and re-enable individual
273 CPUs at runtime on SMP machines.
274
275 Say N if you are unsure.
276
268source arch/ppc/platforms/4xx/Kconfig 277source arch/ppc/platforms/4xx/Kconfig
269source arch/ppc/platforms/85xx/Kconfig 278source arch/ppc/platforms/85xx/Kconfig
270 279
@@ -499,11 +508,6 @@ config WINCEPT
499 MPC821 PowerPC, introduced in 1998 and designed to be used in 508 MPC821 PowerPC, introduced in 1998 and designed to be used in
500 thin-client machines. Say Y to support it directly. 509 thin-client machines. Say Y to support it directly.
501 510
502 Be aware that PCI buses can only function when SYS board is plugged
503 into the PIB (Platform IO Board) board from Freescale which provide
504 3 PCI slots. The PIBs PCI initialization is the bootloader's
505 responsiblilty.
506
507endchoice 511endchoice
508 512
509choice 513choice
@@ -680,6 +684,11 @@ config MPC834x_SYS
680 help 684 help
681 This option enables support for the MPC 834x SYS evaluation board. 685 This option enables support for the MPC 834x SYS evaluation board.
682 686
687 Be aware that PCI buses can only function when SYS board is plugged
688 into the PIB (Platform IO Board) board from Freescale which provide
689 3 PCI slots. The PIBs PCI initialization is the bootloader's
690 responsiblilty.
691
683config EV64360 692config EV64360
684 bool "Marvell-EV64360BP" 693 bool "Marvell-EV64360BP"
685 help 694 help
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index d1b6e6dcb504..16e2675f3270 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -21,13 +21,14 @@ CC := $(CC) -m32
21endif 21endif
22 22
23LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic 23LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic
24CPPFLAGS += -Iarch/$(ARCH) -Iinclude3 24# The -Iarch/$(ARCH)/include is temporary while we are merging
25CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include
25AFLAGS += -Iarch/$(ARCH) 26AFLAGS += -Iarch/$(ARCH)
26CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ 27CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \
27 -ffixed-r2 -mmultiple 28 -ffixed-r2 -mmultiple
28CPP = $(CC) -E $(CFLAGS) 29CPP = $(CC) -E $(CFLAGS)
29# Temporary hack until we have migrated to asm-powerpc 30# Temporary hack until we have migrated to asm-powerpc
30LINUXINCLUDE += -Iinclude3 31LINUXINCLUDE += -Iarch/$(ARCH)/include
31 32
32CHECKFLAGS += -D__powerpc__ 33CHECKFLAGS += -D__powerpc__
33 34
@@ -103,21 +104,16 @@ endef
103 104
104archclean: 105archclean:
105 $(Q)$(MAKE) $(clean)=arch/ppc/boot 106 $(Q)$(MAKE) $(clean)=arch/ppc/boot
106 $(Q)rm -rf include3 107 # Temporary hack until we have migrated to asm-powerpc
108 $(Q)rm -rf arch/$(ARCH)/include
107 109
108prepare: include/asm-$(ARCH)/offsets.h checkbin 110archprepare: checkbin
109
110arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
111 include/config/MARKER
112
113include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
114 $(call filechk,gen-asm-offsets)
115 111
116# Temporary hack until we have migrated to asm-powerpc 112# Temporary hack until we have migrated to asm-powerpc
117include/asm: include3/asm 113include/asm: arch/$(ARCH)/include/asm
118include3/asm: 114arch/$(ARCH)/include/asm:
119 $(Q)if [ ! -d include3 ]; then mkdir -p include3; fi 115 $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
120 $(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm 116 $(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm
121 117
122# Use the file '.tmp_gas_check' for binutils tests, as gas won't output 118# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
123# to stdout and these checks are run even on install targets. 119# to stdout and these checks are run even on install targets.
@@ -143,7 +139,5 @@ checkbin:
143 false ; \ 139 false ; \
144 fi 140 fi
145 141
146CLEAN_FILES += include/asm-$(ARCH)/offsets.h \ 142CLEAN_FILES += $(TOUT)
147 arch/$(ARCH)/kernel/asm-offsets.s \
148 $(TOUT)
149 143
diff --git a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c
index 9017c547a6f6..26818bbb6cff 100644
--- a/arch/ppc/boot/common/ns16550.c
+++ b/arch/ppc/boot/common/ns16550.c
@@ -23,7 +23,7 @@ static int shift;
23 23
24unsigned long serial_init(int chan, void *ignored) 24unsigned long serial_init(int chan, void *ignored)
25{ 25{
26 unsigned long com_port; 26 unsigned long com_port, base_baud;
27 unsigned char lcr, dlm; 27 unsigned char lcr, dlm;
28 28
29 /* We need to find out which type io we're expecting. If it's 29 /* We need to find out which type io we're expecting. If it's
@@ -43,6 +43,8 @@ unsigned long serial_init(int chan, void *ignored)
43 43
44 /* How far apart the registers are. */ 44 /* How far apart the registers are. */
45 shift = rs_table[chan].iomem_reg_shift; 45 shift = rs_table[chan].iomem_reg_shift;
46 /* Base baud.. */
47 base_baud = rs_table[chan].baud_base;
46 48
47 /* save the LCR */ 49 /* save the LCR */
48 lcr = inb(com_port + (UART_LCR << shift)); 50 lcr = inb(com_port + (UART_LCR << shift));
@@ -62,9 +64,9 @@ unsigned long serial_init(int chan, void *ignored)
62 else { 64 else {
63 /* Input clock. */ 65 /* Input clock. */
64 outb(com_port + (UART_DLL << shift), 66 outb(com_port + (UART_DLL << shift),
65 (BASE_BAUD / SERIAL_BAUD) & 0xFF); 67 (base_baud / SERIAL_BAUD) & 0xFF);
66 outb(com_port + (UART_DLM << shift), 68 outb(com_port + (UART_DLM << shift),
67 (BASE_BAUD / SERIAL_BAUD) >> 8); 69 (base_baud / SERIAL_BAUD) >> 8);
68 /* 8 data, 1 stop, no parity */ 70 /* 8 data, 1 stop, no parity */
69 outb(com_port + (UART_LCR << shift), 0x03); 71 outb(com_port + (UART_LCR << shift), 0x03);
70 /* RTS/DTR */ 72 /* RTS/DTR */
diff --git a/arch/ppc/boot/common/util.S b/arch/ppc/boot/common/util.S
index 47e641455bc5..c96c9f80521e 100644
--- a/arch/ppc/boot/common/util.S
+++ b/arch/ppc/boot/common/util.S
@@ -252,7 +252,7 @@ _GLOBAL(flush_instruction_cache)
2521: dcbf r0,r3 # Flush the data cache 2521: dcbf r0,r3 # Flush the data cache
253 icbi r0,r3 # Invalidate the instruction cache 253 icbi r0,r3 # Invalidate the instruction cache
254 addi r3,r3,0x10 # Increment by one cache line 254 addi r3,r3,0x10 # Increment by one cache line
255 cmplwi cr0,r3,r4 # Are we at the end yet? 255 cmplw cr0,r3,r4 # Are we at the end yet?
256 blt 1b # No, keep flushing and invalidating 256 blt 1b # No, keep flushing and invalidating
257#else 257#else
258 /* Enable, invalidate and then disable the L1 icache/dcache. */ 258 /* Enable, invalidate and then disable the L1 icache/dcache. */
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
index b1457a8a9c0f..1fb92f16acd6 100644
--- a/arch/ppc/kernel/Makefile
+++ b/arch/ppc/kernel/Makefile
@@ -15,8 +15,9 @@ extra-y += vmlinux.lds
15obj-y := entry.o traps.o irq.o idle.o time.o misc.o \ 15obj-y := entry.o traps.o irq.o idle.o time.o misc.o \
16 process.o signal.o ptrace.o align.o \ 16 process.o signal.o ptrace.o align.o \
17 semaphore.o syscalls.o setup.o \ 17 semaphore.o syscalls.o setup.o \
18 cputable.o ppc_htab.o perfmon.o 18 cputable.o ppc_htab.o
19obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o 19obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
20obj-$(CONFIG_E500) += perfmon.o
20obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o 21obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
21obj-$(CONFIG_POWER4) += cpu_setup_power4.o 22obj-$(CONFIG_POWER4) += cpu_setup_power4.o
22obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o 23obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o
diff --git a/arch/ppc/kernel/cpu_setup_6xx.S b/arch/ppc/kernel/cpu_setup_6xx.S
index bd037caa4055..ba396438ede3 100644
--- a/arch/ppc/kernel/cpu_setup_6xx.S
+++ b/arch/ppc/kernel/cpu_setup_6xx.S
@@ -12,10 +12,9 @@
12#include <linux/config.h> 12#include <linux/config.h>
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/ppc_asm.h>
16#include <asm/cputable.h> 15#include <asm/cputable.h>
17#include <asm/ppc_asm.h> 16#include <asm/ppc_asm.h>
18#include <asm/offsets.h> 17#include <asm/asm-offsets.h>
19#include <asm/cache.h> 18#include <asm/cache.h>
20 19
21_GLOBAL(__setup_cpu_601) 20_GLOBAL(__setup_cpu_601)
diff --git a/arch/ppc/kernel/cpu_setup_power4.S b/arch/ppc/kernel/cpu_setup_power4.S
index f2ea1a990f17..7e4fbb653724 100644
--- a/arch/ppc/kernel/cpu_setup_power4.S
+++ b/arch/ppc/kernel/cpu_setup_power4.S
@@ -14,8 +14,7 @@
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/ppc_asm.h> 15#include <asm/ppc_asm.h>
16#include <asm/cputable.h> 16#include <asm/cputable.h>
17#include <asm/ppc_asm.h> 17#include <asm/asm-offsets.h>
18#include <asm/offsets.h>
19#include <asm/cache.h> 18#include <asm/cache.h>
20 19
21_GLOBAL(__970_cpu_preinit) 20_GLOBAL(__970_cpu_preinit)
diff --git a/arch/ppc/kernel/dma-mapping.c b/arch/ppc/kernel/dma-mapping.c
index e0c631cf96b0..b566d982806c 100644
--- a/arch/ppc/kernel/dma-mapping.c
+++ b/arch/ppc/kernel/dma-mapping.c
@@ -393,7 +393,7 @@ EXPORT_SYMBOL(__dma_sync);
393 * __dma_sync_page() implementation for systems using highmem. 393 * __dma_sync_page() implementation for systems using highmem.
394 * In this case, each page of a buffer must be kmapped/kunmapped 394 * In this case, each page of a buffer must be kmapped/kunmapped
395 * in order to have a virtual address for __dma_sync(). This must 395 * in order to have a virtual address for __dma_sync(). This must
396 * not sleep so kmap_atmomic()/kunmap_atomic() are used. 396 * not sleep so kmap_atomic()/kunmap_atomic() are used.
397 * 397 *
398 * Note: yes, it is possible and correct to have a buffer extend 398 * Note: yes, it is possible and correct to have a buffer extend
399 * beyond the first page. 399 * beyond the first page.
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index cb83045e2edf..03d4886869f3 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -29,7 +29,7 @@
29#include <asm/cputable.h> 29#include <asm/cputable.h>
30#include <asm/thread_info.h> 30#include <asm/thread_info.h>
31#include <asm/ppc_asm.h> 31#include <asm/ppc_asm.h>
32#include <asm/offsets.h> 32#include <asm/asm-offsets.h>
33#include <asm/unistd.h> 33#include <asm/unistd.h>
34 34
35#undef SHOW_SYSCALLS 35#undef SHOW_SYSCALLS
diff --git a/arch/ppc/kernel/fpu.S b/arch/ppc/kernel/fpu.S
index 6189b26f640f..665d7d34304c 100644
--- a/arch/ppc/kernel/fpu.S
+++ b/arch/ppc/kernel/fpu.S
@@ -18,7 +18,7 @@
18#include <asm/cache.h> 18#include <asm/cache.h>
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/ppc_asm.h> 20#include <asm/ppc_asm.h>
21#include <asm/offsets.h> 21#include <asm/asm-offsets.h>
22 22
23/* 23/*
24 * This task wants to use the FPU now. 24 * This task wants to use the FPU now.
diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
index a931d773715f..1960fb8c259c 100644
--- a/arch/ppc/kernel/head.S
+++ b/arch/ppc/kernel/head.S
@@ -31,7 +31,7 @@
31#include <asm/cache.h> 31#include <asm/cache.h>
32#include <asm/thread_info.h> 32#include <asm/thread_info.h>
33#include <asm/ppc_asm.h> 33#include <asm/ppc_asm.h>
34#include <asm/offsets.h> 34#include <asm/asm-offsets.h>
35 35
36#ifdef CONFIG_APUS 36#ifdef CONFIG_APUS
37#include <asm/amigappc.h> 37#include <asm/amigappc.h>
@@ -1023,23 +1023,21 @@ __secondary_start_gemini:
1023 andc r4,r4,r3 1023 andc r4,r4,r3
1024 mtspr SPRN_HID0,r4 1024 mtspr SPRN_HID0,r4
1025 sync 1025 sync
1026 bl gemini_prom_init
1027 b __secondary_start 1026 b __secondary_start
1028#endif /* CONFIG_GEMINI */ 1027#endif /* CONFIG_GEMINI */
1029 .globl __secondary_start_psurge 1028
1030__secondary_start_psurge: 1029 .globl __secondary_start_pmac_0
1031 li r24,1 /* cpu # */ 1030__secondary_start_pmac_0:
1032 b __secondary_start_psurge99 1031 /* NB the entries for cpus 0, 1, 2 must each occupy 8 bytes. */
1033 .globl __secondary_start_psurge2 1032 li r24,0
1034__secondary_start_psurge2: 1033 b 1f
1035 li r24,2 /* cpu # */ 1034 li r24,1
1036 b __secondary_start_psurge99 1035 b 1f
1037 .globl __secondary_start_psurge3 1036 li r24,2
1038__secondary_start_psurge3: 1037 b 1f
1039 li r24,3 /* cpu # */ 1038 li r24,3
1040 b __secondary_start_psurge99 10391:
1041__secondary_start_psurge99: 1040 /* on powersurge, we come in here with IR=0 and DR=1, and DBAT 0
1042 /* we come in here with IR=0 and DR=1, and DBAT 0
1043 set to map the 0xf0000000 - 0xffffffff region */ 1041 set to map the 0xf0000000 - 0xffffffff region */
1044 mfmsr r0 1042 mfmsr r0
1045 rlwinm r0,r0,0,28,26 /* clear DR (0x10) */ 1043 rlwinm r0,r0,0,28,26 /* clear DR (0x10) */
diff --git a/arch/ppc/kernel/head_44x.S b/arch/ppc/kernel/head_44x.S
index 9e68e32edb60..599245b0407e 100644
--- a/arch/ppc/kernel/head_44x.S
+++ b/arch/ppc/kernel/head_44x.S
@@ -40,7 +40,7 @@
40#include <asm/cputable.h> 40#include <asm/cputable.h>
41#include <asm/thread_info.h> 41#include <asm/thread_info.h>
42#include <asm/ppc_asm.h> 42#include <asm/ppc_asm.h>
43#include <asm/offsets.h> 43#include <asm/asm-offsets.h>
44#include "head_booke.h" 44#include "head_booke.h"
45 45
46 46
diff --git a/arch/ppc/kernel/head_4xx.S b/arch/ppc/kernel/head_4xx.S
index 0a5e723d3be6..8562b807b37c 100644
--- a/arch/ppc/kernel/head_4xx.S
+++ b/arch/ppc/kernel/head_4xx.S
@@ -40,7 +40,7 @@
40#include <asm/cputable.h> 40#include <asm/cputable.h>
41#include <asm/thread_info.h> 41#include <asm/thread_info.h>
42#include <asm/ppc_asm.h> 42#include <asm/ppc_asm.h>
43#include <asm/offsets.h> 43#include <asm/asm-offsets.h>
44 44
45/* As with the other PowerPC ports, it is expected that when code 45/* As with the other PowerPC ports, it is expected that when code
46 * execution begins here, the following registers contain valid, yet 46 * execution begins here, the following registers contain valid, yet
@@ -453,6 +453,7 @@ label:
453#else 453#else
454 CRITICAL_EXCEPTION(0x1020, WDTException, UnknownException) 454 CRITICAL_EXCEPTION(0x1020, WDTException, UnknownException)
455#endif 455#endif
456#endif
456 457
457/* 0x1100 - Data TLB Miss Exception 458/* 0x1100 - Data TLB Miss Exception
458 * As the name implies, translation is not in the MMU, so search the 459 * As the name implies, translation is not in the MMU, so search the
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
index eb18cadb3755..cb1a3a54a026 100644
--- a/arch/ppc/kernel/head_8xx.S
+++ b/arch/ppc/kernel/head_8xx.S
@@ -30,7 +30,7 @@
30#include <asm/cputable.h> 30#include <asm/cputable.h>
31#include <asm/thread_info.h> 31#include <asm/thread_info.h>
32#include <asm/ppc_asm.h> 32#include <asm/ppc_asm.h>
33#include <asm/offsets.h> 33#include <asm/asm-offsets.h>
34 34
35/* Macro to make the code more readable. */ 35/* Macro to make the code more readable. */
36#ifdef CONFIG_8xx_CPU6 36#ifdef CONFIG_8xx_CPU6
diff --git a/arch/ppc/kernel/head_fsl_booke.S b/arch/ppc/kernel/head_fsl_booke.S
index 4028f4c7d978..8e52e8408316 100644
--- a/arch/ppc/kernel/head_fsl_booke.S
+++ b/arch/ppc/kernel/head_fsl_booke.S
@@ -41,7 +41,7 @@
41#include <asm/cputable.h> 41#include <asm/cputable.h>
42#include <asm/thread_info.h> 42#include <asm/thread_info.h>
43#include <asm/ppc_asm.h> 43#include <asm/ppc_asm.h>
44#include <asm/offsets.h> 44#include <asm/asm-offsets.h>
45#include "head_booke.h" 45#include "head_booke.h"
46 46
47/* As with the other PowerPC ports, it is expected that when code 47/* As with the other PowerPC ports, it is expected that when code
diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c
index 53547b6de45b..fba29c876b62 100644
--- a/arch/ppc/kernel/idle.c
+++ b/arch/ppc/kernel/idle.c
@@ -22,6 +22,7 @@
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/sysctl.h> 24#include <linux/sysctl.h>
25#include <linux/cpu.h>
25 26
26#include <asm/pgtable.h> 27#include <asm/pgtable.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
@@ -35,6 +36,7 @@
35void default_idle(void) 36void default_idle(void)
36{ 37{
37 void (*powersave)(void); 38 void (*powersave)(void);
39 int cpu = smp_processor_id();
38 40
39 powersave = ppc_md.power_save; 41 powersave = ppc_md.power_save;
40 42
@@ -44,7 +46,7 @@ void default_idle(void)
44#ifdef CONFIG_SMP 46#ifdef CONFIG_SMP
45 else { 47 else {
46 set_thread_flag(TIF_POLLING_NRFLAG); 48 set_thread_flag(TIF_POLLING_NRFLAG);
47 while (!need_resched()) 49 while (!need_resched() && !cpu_is_offline(cpu))
48 barrier(); 50 barrier();
49 clear_thread_flag(TIF_POLLING_NRFLAG); 51 clear_thread_flag(TIF_POLLING_NRFLAG);
50 } 52 }
@@ -52,6 +54,8 @@ void default_idle(void)
52 } 54 }
53 if (need_resched()) 55 if (need_resched())
54 schedule(); 56 schedule();
57 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
58 cpu_die();
55} 59}
56 60
57/* 61/*
diff --git a/arch/ppc/kernel/idle_6xx.S b/arch/ppc/kernel/idle_6xx.S
index 25d009c75f7b..1a2194cf6828 100644
--- a/arch/ppc/kernel/idle_6xx.S
+++ b/arch/ppc/kernel/idle_6xx.S
@@ -20,7 +20,7 @@
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21#include <asm/thread_info.h> 21#include <asm/thread_info.h>
22#include <asm/ppc_asm.h> 22#include <asm/ppc_asm.h>
23#include <asm/offsets.h> 23#include <asm/asm-offsets.h>
24 24
25#undef DEBUG 25#undef DEBUG
26 26
diff --git a/arch/ppc/kernel/idle_power4.S b/arch/ppc/kernel/idle_power4.S
index 73a58ff03900..cc0d535365cd 100644
--- a/arch/ppc/kernel/idle_power4.S
+++ b/arch/ppc/kernel/idle_power4.S
@@ -20,7 +20,7 @@
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21#include <asm/thread_info.h> 21#include <asm/thread_info.h>
22#include <asm/ppc_asm.h> 22#include <asm/ppc_asm.h>
23#include <asm/offsets.h> 23#include <asm/asm-offsets.h>
24 24
25#undef DEBUG 25#undef DEBUG
26 26
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index ce71b4a01585..90d917d2e856 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -23,7 +23,7 @@
23#include <asm/mmu.h> 23#include <asm/mmu.h>
24#include <asm/ppc_asm.h> 24#include <asm/ppc_asm.h>
25#include <asm/thread_info.h> 25#include <asm/thread_info.h>
26#include <asm/offsets.h> 26#include <asm/asm-offsets.h>
27 27
28 .text 28 .text
29 29
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index 7b3586a3bf30..854e45beb387 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -80,7 +80,6 @@ fixup_broken_pcnet32(struct pci_dev* dev)
80 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) { 80 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
81 dev->vendor = PCI_VENDOR_ID_AMD; 81 dev->vendor = PCI_VENDOR_ID_AMD;
82 pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD); 82 pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD);
83 pci_name_device(dev);
84 } 83 }
85} 84}
86DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32); 85DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32);
diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
index e70b587b9e51..726fe7ce1747 100644
--- a/arch/ppc/kernel/smp.c
+++ b/arch/ppc/kernel/smp.c
@@ -45,6 +45,7 @@ cpumask_t cpu_online_map;
45cpumask_t cpu_possible_map; 45cpumask_t cpu_possible_map;
46int smp_hw_index[NR_CPUS]; 46int smp_hw_index[NR_CPUS];
47struct thread_info *secondary_ti; 47struct thread_info *secondary_ti;
48static struct task_struct *idle_tasks[NR_CPUS];
48 49
49EXPORT_SYMBOL(cpu_online_map); 50EXPORT_SYMBOL(cpu_online_map);
50EXPORT_SYMBOL(cpu_possible_map); 51EXPORT_SYMBOL(cpu_possible_map);
@@ -286,7 +287,8 @@ static void __devinit smp_store_cpu_info(int id)
286 287
287void __init smp_prepare_cpus(unsigned int max_cpus) 288void __init smp_prepare_cpus(unsigned int max_cpus)
288{ 289{
289 int num_cpus, i; 290 int num_cpus, i, cpu;
291 struct task_struct *p;
290 292
291 /* Fixup boot cpu */ 293 /* Fixup boot cpu */
292 smp_store_cpu_info(smp_processor_id()); 294 smp_store_cpu_info(smp_processor_id());
@@ -308,6 +310,17 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
308 310
309 if (smp_ops->space_timers) 311 if (smp_ops->space_timers)
310 smp_ops->space_timers(num_cpus); 312 smp_ops->space_timers(num_cpus);
313
314 for_each_cpu(cpu) {
315 if (cpu == smp_processor_id())
316 continue;
317 /* create a process for the processor */
318 p = fork_idle(cpu);
319 if (IS_ERR(p))
320 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
321 p->thread_info->cpu = cpu;
322 idle_tasks[cpu] = p;
323 }
311} 324}
312 325
313void __devinit smp_prepare_boot_cpu(void) 326void __devinit smp_prepare_boot_cpu(void)
@@ -334,12 +347,17 @@ int __devinit start_secondary(void *unused)
334 set_dec(tb_ticks_per_jiffy); 347 set_dec(tb_ticks_per_jiffy);
335 cpu_callin_map[cpu] = 1; 348 cpu_callin_map[cpu] = 1;
336 349
337 printk("CPU %i done callin...\n", cpu); 350 printk("CPU %d done callin...\n", cpu);
338 smp_ops->setup_cpu(cpu); 351 smp_ops->setup_cpu(cpu);
339 printk("CPU %i done setup...\n", cpu); 352 printk("CPU %d done setup...\n", cpu);
340 local_irq_enable();
341 smp_ops->take_timebase(); 353 smp_ops->take_timebase();
342 printk("CPU %i done timebase take...\n", cpu); 354 printk("CPU %d done timebase take...\n", cpu);
355
356 spin_lock(&call_lock);
357 cpu_set(cpu, cpu_online_map);
358 spin_unlock(&call_lock);
359
360 local_irq_enable();
343 361
344 cpu_idle(); 362 cpu_idle();
345 return 0; 363 return 0;
@@ -347,17 +365,11 @@ int __devinit start_secondary(void *unused)
347 365
348int __cpu_up(unsigned int cpu) 366int __cpu_up(unsigned int cpu)
349{ 367{
350 struct task_struct *p;
351 char buf[32]; 368 char buf[32];
352 int c; 369 int c;
353 370
354 /* create a process for the processor */ 371 secondary_ti = idle_tasks[cpu]->thread_info;
355 /* only regs.msr is actually used, and 0 is OK for it */ 372 mb();
356 p = fork_idle(cpu);
357 if (IS_ERR(p))
358 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
359 secondary_ti = p->thread_info;
360 p->thread_info->cpu = cpu;
361 373
362 /* 374 /*
363 * There was a cache flush loop here to flush the cache 375 * There was a cache flush loop here to flush the cache
@@ -389,7 +401,11 @@ int __cpu_up(unsigned int cpu)
389 printk("Processor %d found.\n", cpu); 401 printk("Processor %d found.\n", cpu);
390 402
391 smp_ops->give_timebase(); 403 smp_ops->give_timebase();
392 cpu_set(cpu, cpu_online_map); 404
405 /* Wait until cpu puts itself in the online map */
406 while (!cpu_online(cpu))
407 cpu_relax();
408
393 return 0; 409 return 0;
394} 410}
395 411
diff --git a/arch/ppc/kernel/swsusp.S b/arch/ppc/kernel/swsusp.S
index 55148bb88d39..69773cc1a85f 100644
--- a/arch/ppc/kernel/swsusp.S
+++ b/arch/ppc/kernel/swsusp.S
@@ -5,7 +5,7 @@
5#include <asm/cputable.h> 5#include <asm/cputable.h>
6#include <asm/thread_info.h> 6#include <asm/thread_info.h>
7#include <asm/ppc_asm.h> 7#include <asm/ppc_asm.h>
8#include <asm/offsets.h> 8#include <asm/asm-offsets.h>
9 9
10 10
11/* 11/*
diff --git a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c
index 124313ce3c09..127f040de9de 100644
--- a/arch/ppc/kernel/syscalls.c
+++ b/arch/ppc/kernel/syscalls.c
@@ -41,10 +41,6 @@
41#include <asm/ipc.h> 41#include <asm/ipc.h>
42#include <asm/semaphore.h> 42#include <asm/semaphore.h>
43 43
44void
45check_bugs(void)
46{
47}
48 44
49/* 45/*
50 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 46 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
index d87423d1003a..961ede87be72 100644
--- a/arch/ppc/kernel/traps.c
+++ b/arch/ppc/kernel/traps.c
@@ -118,6 +118,28 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
118 info.si_code = code; 118 info.si_code = code;
119 info.si_addr = (void __user *) addr; 119 info.si_addr = (void __user *) addr;
120 force_sig_info(signr, &info, current); 120 force_sig_info(signr, &info, current);
121
122 /*
123 * Init gets no signals that it doesn't have a handler for.
124 * That's all very well, but if it has caused a synchronous
125 * exception and we ignore the resulting signal, it will just
126 * generate the same exception over and over again and we get
127 * nowhere. Better to kill it and let the kernel panic.
128 */
129 if (current->pid == 1) {
130 __sighandler_t handler;
131
132 spin_lock_irq(&current->sighand->siglock);
133 handler = current->sighand->action[signr-1].sa.sa_handler;
134 spin_unlock_irq(&current->sighand->siglock);
135 if (handler == SIG_DFL) {
136 /* init has generated a synchronous exception
137 and it doesn't have a handler for the signal */
138 printk(KERN_CRIT "init has generated signal %d "
139 "but has no handler for it\n", signr);
140 do_exit(signr);
141 }
142 }
121} 143}
122 144
123/* 145/*
@@ -849,10 +871,12 @@ void AltivecAssistException(struct pt_regs *regs)
849} 871}
850#endif /* CONFIG_ALTIVEC */ 872#endif /* CONFIG_ALTIVEC */
851 873
874#ifdef CONFIG_E500
852void PerformanceMonitorException(struct pt_regs *regs) 875void PerformanceMonitorException(struct pt_regs *regs)
853{ 876{
854 perf_irq(regs); 877 perf_irq(regs);
855} 878}
879#endif
856 880
857#ifdef CONFIG_FSL_BOOKE 881#ifdef CONFIG_FSL_BOOKE
858void CacheLockingException(struct pt_regs *regs, unsigned long address, 882void CacheLockingException(struct pt_regs *regs, unsigned long address,
diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile
index 1c380e67d435..f1e1fb4144f0 100644
--- a/arch/ppc/lib/Makefile
+++ b/arch/ppc/lib/Makefile
@@ -4,6 +4,5 @@
4 4
5obj-y := checksum.o string.o strcase.o dec_and_lock.o div64.o 5obj-y := checksum.o string.o strcase.o dec_and_lock.o div64.o
6 6
7obj-$(CONFIG_SMP) += locks.o
8obj-$(CONFIG_8xx) += rheap.o 7obj-$(CONFIG_8xx) += rheap.o
9obj-$(CONFIG_CPM2) += rheap.o 8obj-$(CONFIG_CPM2) += rheap.o
diff --git a/arch/ppc/lib/dec_and_lock.c b/arch/ppc/lib/dec_and_lock.c
index 4ee888070d91..b18f0d9a00fc 100644
--- a/arch/ppc/lib/dec_and_lock.c
+++ b/arch/ppc/lib/dec_and_lock.c
@@ -11,14 +11,7 @@
11 * has a cmpxchg, and where atomic->value is an int holding 11 * has a cmpxchg, and where atomic->value is an int holding
12 * the value of the atomic (i.e. the high bits aren't used 12 * the value of the atomic (i.e. the high bits aren't used
13 * for a lock or anything like that). 13 * for a lock or anything like that).
14 *
15 * N.B. ATOMIC_DEC_AND_LOCK gets defined in include/linux/spinlock.h
16 * if spinlocks are empty and thus atomic_dec_and_lock is defined
17 * to be atomic_dec_and_test - in that case we don't need it
18 * defined here as well.
19 */ 14 */
20
21#ifndef ATOMIC_DEC_AND_LOCK
22int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock) 15int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
23{ 16{
24 int counter; 17 int counter;
@@ -43,4 +36,3 @@ int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
43} 36}
44 37
45EXPORT_SYMBOL(_atomic_dec_and_lock); 38EXPORT_SYMBOL(_atomic_dec_and_lock);
46#endif /* ATOMIC_DEC_AND_LOCK */
diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
index 57d9930843ac..ee5e9f25baf9 100644
--- a/arch/ppc/mm/fault.c
+++ b/arch/ppc/mm/fault.c
@@ -278,11 +278,7 @@ bad_area:
278 278
279 /* User mode accesses cause a SIGSEGV */ 279 /* User mode accesses cause a SIGSEGV */
280 if (user_mode(regs)) { 280 if (user_mode(regs)) {
281 info.si_signo = SIGSEGV; 281 _exception(SIGSEGV, regs, code, address);
282 info.si_errno = 0;
283 info.si_code = code;
284 info.si_addr = (void __user *) address;
285 force_sig_info(SIGSEGV, &info, current);
286 return 0; 282 return 0;
287 } 283 }
288 284
diff --git a/arch/ppc/mm/hashtable.S b/arch/ppc/mm/hashtable.S
index ab83132a7ed0..3ec87c91343e 100644
--- a/arch/ppc/mm/hashtable.S
+++ b/arch/ppc/mm/hashtable.S
@@ -30,7 +30,7 @@
30#include <asm/cputable.h> 30#include <asm/cputable.h>
31#include <asm/ppc_asm.h> 31#include <asm/ppc_asm.h>
32#include <asm/thread_info.h> 32#include <asm/thread_info.h>
33#include <asm/offsets.h> 33#include <asm/asm-offsets.h>
34 34
35#ifdef CONFIG_SMP 35#ifdef CONFIG_SMP
36 .comm mmu_hash_lock,4 36 .comm mmu_hash_lock,4
diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
index 0fd3442f5131..d6b2b1965dcb 100644
--- a/arch/ppc/platforms/4xx/ebony.c
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -91,15 +91,10 @@ ebony_calibrate_decr(void)
91 * on Rev. C silicon then errata forces us to 91 * on Rev. C silicon then errata forces us to
92 * use the internal clock. 92 * use the internal clock.
93 */ 93 */
94 switch (PVR_REV(mfspr(SPRN_PVR))) { 94 if (strcmp(cur_cpu_spec[0]->cpu_name, "440GP Rev. B") == 0)
95 case PVR_REV(PVR_440GP_RB): 95 freq = EBONY_440GP_RB_SYSCLK;
96 freq = EBONY_440GP_RB_SYSCLK; 96 else
97 break; 97 freq = EBONY_440GP_RC_SYSCLK;
98 case PVR_REV(PVR_440GP_RC1):
99 default:
100 freq = EBONY_440GP_RC_SYSCLK;
101 break;
102 }
103 98
104 ibm44x_calibrate_decr(freq); 99 ibm44x_calibrate_decr(freq);
105} 100}
diff --git a/arch/ppc/platforms/hdpu.c b/arch/ppc/platforms/hdpu.c
index b659d7b3d747..ff3796860123 100644
--- a/arch/ppc/platforms/hdpu.c
+++ b/arch/ppc/platforms/hdpu.c
@@ -58,7 +58,7 @@ static void parse_bootinfo(unsigned long r3,
58static void hdpu_set_l1pe(void); 58static void hdpu_set_l1pe(void);
59static void hdpu_cpustate_set(unsigned char new_state); 59static void hdpu_cpustate_set(unsigned char new_state);
60#ifdef CONFIG_SMP 60#ifdef CONFIG_SMP
61static spinlock_t timebase_lock = SPIN_LOCK_UNLOCKED; 61static DEFINE_SPINLOCK(timebase_lock);
62static unsigned int timebase_upper = 0, timebase_lower = 0; 62static unsigned int timebase_upper = 0, timebase_lower = 0;
63extern int smp_tb_synchronized; 63extern int smp_tb_synchronized;
64 64
diff --git a/arch/ppc/platforms/pmac_sleep.S b/arch/ppc/platforms/pmac_sleep.S
index 016a74649155..88419c77ac43 100644
--- a/arch/ppc/platforms/pmac_sleep.S
+++ b/arch/ppc/platforms/pmac_sleep.S
@@ -17,7 +17,7 @@
17#include <asm/cputable.h> 17#include <asm/cputable.h>
18#include <asm/cache.h> 18#include <asm/cache.h>
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/offsets.h> 20#include <asm/asm-offsets.h>
21 21
22#define MAGIC 0x4c617273 /* 'Lars' */ 22#define MAGIC 0x4c617273 /* 'Lars' */
23 23
@@ -161,6 +161,8 @@ _GLOBAL(low_sleep_handler)
161 addi r3,r3,sleep_storage@l 161 addi r3,r3,sleep_storage@l
162 stw r5,0(r3) 162 stw r5,0(r3)
163 163
164 .globl low_cpu_die
165low_cpu_die:
164 /* Flush & disable all caches */ 166 /* Flush & disable all caches */
165 bl flush_disable_caches 167 bl flush_disable_caches
166 168
diff --git a/arch/ppc/platforms/pmac_smp.c b/arch/ppc/platforms/pmac_smp.c
index 8e049dab4e63..794a23994b82 100644
--- a/arch/ppc/platforms/pmac_smp.c
+++ b/arch/ppc/platforms/pmac_smp.c
@@ -33,6 +33,7 @@
33#include <linux/spinlock.h> 33#include <linux/spinlock.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/hardirq.h> 35#include <linux/hardirq.h>
36#include <linux/cpu.h>
36 37
37#include <asm/ptrace.h> 38#include <asm/ptrace.h>
38#include <asm/atomic.h> 39#include <asm/atomic.h>
@@ -55,9 +56,7 @@
55 * Powersurge (old powermac SMP) support. 56 * Powersurge (old powermac SMP) support.
56 */ 57 */
57 58
58extern void __secondary_start_psurge(void); 59extern void __secondary_start_pmac_0(void);
59extern void __secondary_start_psurge2(void); /* Temporary horrible hack */
60extern void __secondary_start_psurge3(void); /* Temporary horrible hack */
61 60
62/* Addresses for powersurge registers */ 61/* Addresses for powersurge registers */
63#define HAMMERHEAD_BASE 0xf8000000 62#define HAMMERHEAD_BASE 0xf8000000
@@ -119,7 +118,7 @@ static volatile int sec_tb_reset = 0;
119static unsigned int pri_tb_hi, pri_tb_lo; 118static unsigned int pri_tb_hi, pri_tb_lo;
120static unsigned int pri_tb_stamp; 119static unsigned int pri_tb_stamp;
121 120
122static void __init core99_init_caches(int cpu) 121static void __devinit core99_init_caches(int cpu)
123{ 122{
124 if (!cpu_has_feature(CPU_FTR_L2CR)) 123 if (!cpu_has_feature(CPU_FTR_L2CR))
125 return; 124 return;
@@ -346,7 +345,7 @@ static int __init smp_psurge_probe(void)
346 345
347static void __init smp_psurge_kick_cpu(int nr) 346static void __init smp_psurge_kick_cpu(int nr)
348{ 347{
349 void (*start)(void) = __secondary_start_psurge; 348 unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8;
350 unsigned long a; 349 unsigned long a;
351 350
352 /* may need to flush here if secondary bats aren't setup */ 351 /* may need to flush here if secondary bats aren't setup */
@@ -356,17 +355,7 @@ static void __init smp_psurge_kick_cpu(int nr)
356 355
357 if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu", 0x353); 356 if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu", 0x353);
358 357
359 /* setup entry point of secondary processor */ 358 out_be32(psurge_start, start);
360 switch (nr) {
361 case 2:
362 start = __secondary_start_psurge2;
363 break;
364 case 3:
365 start = __secondary_start_psurge3;
366 break;
367 }
368
369 out_be32(psurge_start, __pa(start));
370 mb(); 359 mb();
371 360
372 psurge_set_ipi(nr); 361 psurge_set_ipi(nr);
@@ -500,14 +489,14 @@ static int __init smp_core99_probe(void)
500 return ncpus; 489 return ncpus;
501} 490}
502 491
503static void __init smp_core99_kick_cpu(int nr) 492static void __devinit smp_core99_kick_cpu(int nr)
504{ 493{
505 unsigned long save_vector, new_vector; 494 unsigned long save_vector, new_vector;
506 unsigned long flags; 495 unsigned long flags;
507 496
508 volatile unsigned long *vector 497 volatile unsigned long *vector
509 = ((volatile unsigned long *)(KERNELBASE+0x100)); 498 = ((volatile unsigned long *)(KERNELBASE+0x100));
510 if (nr < 1 || nr > 3) 499 if (nr < 0 || nr > 3)
511 return; 500 return;
512 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu", 0x346); 501 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu", 0x346);
513 502
@@ -518,19 +507,9 @@ static void __init smp_core99_kick_cpu(int nr)
518 save_vector = *vector; 507 save_vector = *vector;
519 508
520 /* Setup fake reset vector that does 509 /* Setup fake reset vector that does
521 * b __secondary_start_psurge - KERNELBASE 510 * b __secondary_start_pmac_0 + nr*8 - KERNELBASE
522 */ 511 */
523 switch(nr) { 512 new_vector = (unsigned long) __secondary_start_pmac_0 + nr * 8;
524 case 1:
525 new_vector = (unsigned long)__secondary_start_psurge;
526 break;
527 case 2:
528 new_vector = (unsigned long)__secondary_start_psurge2;
529 break;
530 case 3:
531 new_vector = (unsigned long)__secondary_start_psurge3;
532 break;
533 }
534 *vector = 0x48000002 + new_vector - KERNELBASE; 513 *vector = 0x48000002 + new_vector - KERNELBASE;
535 514
536 /* flush data cache and inval instruction cache */ 515 /* flush data cache and inval instruction cache */
@@ -554,7 +533,7 @@ static void __init smp_core99_kick_cpu(int nr)
554 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347); 533 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347);
555} 534}
556 535
557static void __init smp_core99_setup_cpu(int cpu_nr) 536static void __devinit smp_core99_setup_cpu(int cpu_nr)
558{ 537{
559 /* Setup L2/L3 */ 538 /* Setup L2/L3 */
560 if (cpu_nr != 0) 539 if (cpu_nr != 0)
@@ -668,3 +647,47 @@ struct smp_ops_t core99_smp_ops __pmacdata = {
668 .give_timebase = smp_core99_give_timebase, 647 .give_timebase = smp_core99_give_timebase,
669 .take_timebase = smp_core99_take_timebase, 648 .take_timebase = smp_core99_take_timebase,
670}; 649};
650
651#ifdef CONFIG_HOTPLUG_CPU
652
653int __cpu_disable(void)
654{
655 cpu_clear(smp_processor_id(), cpu_online_map);
656
657 /* XXX reset cpu affinity here */
658 openpic_set_priority(0xf);
659 asm volatile("mtdec %0" : : "r" (0x7fffffff));
660 mb();
661 udelay(20);
662 asm volatile("mtdec %0" : : "r" (0x7fffffff));
663 return 0;
664}
665
666extern void low_cpu_die(void) __attribute__((noreturn)); /* in pmac_sleep.S */
667static int cpu_dead[NR_CPUS];
668
669void cpu_die(void)
670{
671 local_irq_disable();
672 cpu_dead[smp_processor_id()] = 1;
673 mb();
674 low_cpu_die();
675}
676
677void __cpu_die(unsigned int cpu)
678{
679 int timeout;
680
681 timeout = 1000;
682 while (!cpu_dead[cpu]) {
683 if (--timeout == 0) {
684 printk("CPU %u refused to die!\n", cpu);
685 break;
686 }
687 msleep(1);
688 }
689 cpu_callin_map[cpu] = 0;
690 cpu_dead[cpu] = 0;
691}
692
693#endif
diff --git a/arch/ppc/syslib/cpc700_pic.c b/arch/ppc/syslib/cpc700_pic.c
index 774709807538..75fe8eb10693 100644
--- a/arch/ppc/syslib/cpc700_pic.c
+++ b/arch/ppc/syslib/cpc700_pic.c
@@ -90,14 +90,10 @@ cpc700_mask_and_ack_irq(unsigned int irq)
90} 90}
91 91
92static struct hw_interrupt_type cpc700_pic = { 92static struct hw_interrupt_type cpc700_pic = {
93 "CPC700 PIC", 93 .typename = "CPC700 PIC",
94 NULL, 94 .enable = cpc700_unmask_irq,
95 NULL, 95 .disable = cpc700_mask_irq,
96 cpc700_unmask_irq, 96 .ack = cpc700_mask_and_ack_irq,
97 cpc700_mask_irq,
98 cpc700_mask_and_ack_irq,
99 NULL,
100 NULL
101}; 97};
102 98
103__init static void 99__init static void
diff --git a/arch/ppc/syslib/i8259.c b/arch/ppc/syslib/i8259.c
index b9391e650141..5c7908c20e43 100644
--- a/arch/ppc/syslib/i8259.c
+++ b/arch/ppc/syslib/i8259.c
@@ -129,14 +129,11 @@ static void i8259_end_irq(unsigned int irq)
129} 129}
130 130
131struct hw_interrupt_type i8259_pic = { 131struct hw_interrupt_type i8259_pic = {
132 " i8259 ", 132 .typename = " i8259 ",
133 NULL, 133 .enable = i8259_unmask_irq,
134 NULL, 134 .disable = i8259_mask_irq,
135 i8259_unmask_irq, 135 .ack = i8259_mask_and_ack_irq,
136 i8259_mask_irq, 136 .end = i8259_end_irq,
137 i8259_mask_and_ack_irq,
138 i8259_end_irq,
139 NULL
140}; 137};
141 138
142static struct resource pic1_iores = { 139static struct resource pic1_iores = {
diff --git a/arch/ppc/syslib/ibm440gx_common.c b/arch/ppc/syslib/ibm440gx_common.c
index d4776af6a3ca..0bb919859b8b 100644
--- a/arch/ppc/syslib/ibm440gx_common.c
+++ b/arch/ppc/syslib/ibm440gx_common.c
@@ -236,9 +236,10 @@ void __init ibm440gx_l2c_setup(struct ibm44x_clocks* p)
236 /* Disable L2C on rev.A, rev.B and 800MHz version of rev.C, 236 /* Disable L2C on rev.A, rev.B and 800MHz version of rev.C,
237 enable it on all other revisions 237 enable it on all other revisions
238 */ 238 */
239 u32 pvr = mfspr(SPRN_PVR); 239 if (strcmp(cur_cpu_spec[0]->cpu_name, "440GX Rev. A") == 0 ||
240 if (pvr == PVR_440GX_RA || pvr == PVR_440GX_RB || 240 strcmp(cur_cpu_spec[0]->cpu_name, "440GX Rev. B") == 0
241 (pvr == PVR_440GX_RC && p->cpu > 667000000)) 241 || (strcmp(cur_cpu_spec[0]->cpu_name, "440GX Rev. C")
242 == 0 && p->cpu > 667000000))
242 ibm440gx_l2c_disable(); 243 ibm440gx_l2c_disable();
243 else 244 else
244 ibm440gx_l2c_enable(); 245 ibm440gx_l2c_enable();
diff --git a/arch/ppc/syslib/mpc10x_common.c b/arch/ppc/syslib/mpc10x_common.c
index 87065e2e4c5f..3e039706bdbc 100644
--- a/arch/ppc/syslib/mpc10x_common.c
+++ b/arch/ppc/syslib/mpc10x_common.c
@@ -140,12 +140,12 @@ struct platform_device ppc_sys_platform_devices[] = {
140 }, 140 },
141 [MPC10X_UART0] = { 141 [MPC10X_UART0] = {
142 .name = "serial8250", 142 .name = "serial8250",
143 .id = 0, 143 .id = PLAT8250_DEV_PLATFORM,
144 .dev.platform_data = serial_plat_uart0, 144 .dev.platform_data = serial_plat_uart0,
145 }, 145 },
146 [MPC10X_UART1] = { 146 [MPC10X_UART1] = {
147 .name = "serial8250", 147 .name = "serial8250",
148 .id = 1, 148 .id = PLAT8250_DEV_PLATFORM1,
149 .dev.platform_data = serial_plat_uart1, 149 .dev.platform_data = serial_plat_uart1,
150 }, 150 },
151 151
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c
index 5aaf0e58e1f9..95b3b8a7f0ba 100644
--- a/arch/ppc/syslib/mpc83xx_devices.c
+++ b/arch/ppc/syslib/mpc83xx_devices.c
@@ -165,7 +165,7 @@ struct platform_device ppc_sys_platform_devices[] = {
165 }, 165 },
166 [MPC83xx_DUART] = { 166 [MPC83xx_DUART] = {
167 .name = "serial8250", 167 .name = "serial8250",
168 .id = 0, 168 .id = PLAT8250_DEV_PLATFORM,
169 .dev.platform_data = serial_platform_data, 169 .dev.platform_data = serial_platform_data,
170 }, 170 },
171 [MPC83xx_SEC2] = { 171 [MPC83xx_SEC2] = {
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c
index 8af322dd476a..bbc5ac0de878 100644
--- a/arch/ppc/syslib/mpc85xx_devices.c
+++ b/arch/ppc/syslib/mpc85xx_devices.c
@@ -282,7 +282,7 @@ struct platform_device ppc_sys_platform_devices[] = {
282 }, 282 },
283 [MPC85xx_DUART] = { 283 [MPC85xx_DUART] = {
284 .name = "serial8250", 284 .name = "serial8250",
285 .id = 0, 285 .id = PLAT8250_DEV_PLATFORM,
286 .dev.platform_data = serial_platform_data, 286 .dev.platform_data = serial_platform_data,
287 }, 287 },
288 [MPC85xx_PERFMON] = { 288 [MPC85xx_PERFMON] = {
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
index 6262b11f366f..839f8872826f 100644
--- a/arch/ppc/syslib/mv64x60.c
+++ b/arch/ppc/syslib/mv64x60.c
@@ -31,7 +31,7 @@
31 31
32 32
33u8 mv64x60_pci_exclude_bridge = 1; 33u8 mv64x60_pci_exclude_bridge = 1;
34spinlock_t mv64x60_lock = SPIN_LOCK_UNLOCKED; 34DEFINE_SPINLOCK(mv64x60_lock);
35 35
36static phys_addr_t mv64x60_bridge_pbase; 36static phys_addr_t mv64x60_bridge_pbase;
37static void *mv64x60_bridge_vbase; 37static void *mv64x60_bridge_vbase;
diff --git a/arch/ppc/syslib/open_pic2.c b/arch/ppc/syslib/open_pic2.c
index 7e272c51a497..2e0ea92144f6 100644
--- a/arch/ppc/syslib/open_pic2.c
+++ b/arch/ppc/syslib/open_pic2.c
@@ -82,13 +82,11 @@ static void openpic2_end_irq(unsigned int irq_nr);
82static void openpic2_ack_irq(unsigned int irq_nr); 82static void openpic2_ack_irq(unsigned int irq_nr);
83 83
84struct hw_interrupt_type open_pic2 = { 84struct hw_interrupt_type open_pic2 = {
85 " OpenPIC2 ", 85 .typename = " OpenPIC2 ",
86 NULL, 86 .enable = openpic2_enable_irq,
87 NULL, 87 .disable = openpic2_disable_irq,
88 openpic2_enable_irq, 88 .ack = openpic2_ack_irq,
89 openpic2_disable_irq, 89 .end = openpic2_end_irq,
90 openpic2_ack_irq,
91 openpic2_end_irq,
92}; 90};
93 91
94/* 92/*
diff --git a/arch/ppc/syslib/ppc403_pic.c b/arch/ppc/syslib/ppc403_pic.c
index 06cb0af2a58d..ce4d1deb86e9 100644
--- a/arch/ppc/syslib/ppc403_pic.c
+++ b/arch/ppc/syslib/ppc403_pic.c
@@ -34,13 +34,10 @@ static void ppc403_aic_disable(unsigned int irq);
34static void ppc403_aic_disable_and_ack(unsigned int irq); 34static void ppc403_aic_disable_and_ack(unsigned int irq);
35 35
36static struct hw_interrupt_type ppc403_aic = { 36static struct hw_interrupt_type ppc403_aic = {
37 "403GC AIC", 37 .typename = "403GC AIC",
38 NULL, 38 .enable = ppc403_aic_enable,
39 NULL, 39 .disable = ppc403_aic_disable,
40 ppc403_aic_enable, 40 .ack = ppc403_aic_disable_and_ack,
41 ppc403_aic_disable,
42 ppc403_aic_disable_and_ack,
43 0
44}; 41};
45 42
46int 43int
diff --git a/arch/ppc/syslib/qspan_pci.c b/arch/ppc/syslib/qspan_pci.c
index 57f4ed5e5ae1..0970b5d30391 100644
--- a/arch/ppc/syslib/qspan_pci.c
+++ b/arch/ppc/syslib/qspan_pci.c
@@ -94,7 +94,7 @@
94#define mk_config_type1(bus, dev, offset) \ 94#define mk_config_type1(bus, dev, offset) \
95 mk_config_addr(bus, dev, offset) | 1; 95 mk_config_addr(bus, dev, offset) | 1;
96 96
97static spinlock_t pcibios_lock = SPIN_LOCK_UNLOCKED; 97static DEFINE_SPINLOCK(pcibios_lock);
98 98
99int qspan_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn, 99int qspan_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
100 unsigned char offset, unsigned char *val) 100 unsigned char offset, unsigned char *val)
diff --git a/arch/ppc/syslib/xilinx_pic.c b/arch/ppc/syslib/xilinx_pic.c
index e0bd66f0847a..2cbcad278cef 100644
--- a/arch/ppc/syslib/xilinx_pic.c
+++ b/arch/ppc/syslib/xilinx_pic.c
@@ -79,14 +79,11 @@ xilinx_intc_end(unsigned int irq)
79} 79}
80 80
81static struct hw_interrupt_type xilinx_intc = { 81static struct hw_interrupt_type xilinx_intc = {
82 "Xilinx Interrupt Controller", 82 .typename = "Xilinx Interrupt Controller",
83 NULL, 83 .enable = xilinx_intc_enable,
84 NULL, 84 .disable = xilinx_intc_disable,
85 xilinx_intc_enable, 85 .ack = xilinx_intc_disable_and_ack,
86 xilinx_intc_disable, 86 .end = xilinx_intc_end,
87 xilinx_intc_disable_and_ack,
88 xilinx_intc_end,
89 0
90}; 87};
91 88
92int 89int
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 8189953a372c..17d2c1eac3b8 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -56,7 +56,7 @@ LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
56CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \ 56CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \
57 -mcall-aixdesc 57 -mcall-aixdesc
58# Temporary hack until we have migrated to asm-powerpc 58# Temporary hack until we have migrated to asm-powerpc
59CPPFLAGS += -Iinclude3 59CPPFLAGS += -Iarch/$(ARCH)/include
60 60
61GCC_VERSION := $(call cc-version) 61GCC_VERSION := $(call cc-version)
62GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;) 62GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;)
@@ -89,11 +89,12 @@ drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/
89 89
90boot := arch/ppc64/boot 90boot := arch/ppc64/boot
91 91
92boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd 92boottargets-$(CONFIG_PPC_PSERIES) += zImage zImage.initrd
93boottarget-$(CONFIG_PPC_MAPLE) := zImage zImage.initrd 93boottargets-$(CONFIG_PPC_PMAC) += zImage.vmode zImage.initrd.vmode
94boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm 94boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd
95boottarget-$(CONFIG_PPC_BPA) := zImage zImage.initrd 95boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm
96$(boottarget-y): vmlinux 96boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd
97$(boottargets-y): vmlinux
97 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 98 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
98 99
99bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage 100bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
@@ -114,27 +115,21 @@ all: $(KBUILD_IMAGE)
114 115
115archclean: 116archclean:
116 $(Q)$(MAKE) $(clean)=$(boot) 117 $(Q)$(MAKE) $(clean)=$(boot)
117 $(Q)rm -rf include3 118 # Temporary hack until we have migrated to asm-powerpc
119 $(Q)rm -rf arch/$(ARCH)/include
118 120
119prepare: include/asm-ppc64/offsets.h
120
121arch/ppc64/kernel/asm-offsets.s: include/asm include/linux/version.h \
122 include/config/MARKER
123
124include/asm-ppc64/offsets.h: arch/ppc64/kernel/asm-offsets.s
125 $(call filechk,gen-asm-offsets)
126 121
127# Temporary hack until we have migrated to asm-powerpc 122# Temporary hack until we have migrated to asm-powerpc
128include/asm: include3/asm 123include/asm: arch/$(ARCH)/include/asm
129include3/asm: 124arch/$(ARCH)/include/asm:
130 $(Q)if [ ! -d include3 ]; then mkdir -p include3; fi; 125 $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
131 $(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm 126 $(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm
132 127
133define archhelp 128define archhelp
134 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' 129 echo ' zImage.vmode - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)'
135 echo ' zImage.initrd- Compressed kernel image with initrd attached,' 130 echo ' zImage.initrd.vmode - Compressed kernel image with initrd attached,'
136 echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz' 131 echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
137 echo ' (arch/$(ARCH)/boot/zImage.initrd)' 132 echo ' (arch/$(ARCH)/boot/zImage.initrd.vmode)'
133 echo ' zImage - zImage for pSeries machines'
134 echo ' zImage.initrd - zImage with initrd for pSeries machines'
138endef 135endef
139
140CLEAN_FILES += include/asm-ppc64/offsets.h
diff --git a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
index 2c5f5e73d00c..33fdc8710891 100644
--- a/arch/ppc64/boot/Makefile
+++ b/arch/ppc64/boot/Makefile
@@ -37,6 +37,9 @@ quiet_cmd_bootcc = BOOTCC $@
37quiet_cmd_bootas = BOOTAS $@ 37quiet_cmd_bootas = BOOTAS $@
38 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 38 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
39 39
40quiet_cmd_bootld = BOOTLD $@
41 cmd_bootld = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(2)
42
40$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c 43$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
41 $(call if_changed_dep,bootcc) 44 $(call if_changed_dep,bootcc)
42$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S 45$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
@@ -53,7 +56,7 @@ src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
53gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) 56gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
54 57
55hostprogs-y := addnote addRamDisk 58hostprogs-y := addnote addRamDisk
56targets += zImage zImage.initrd imagesize.c \ 59targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd imagesize.c \
57 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ 60 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
58 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ 61 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
59 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ 62 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
@@ -63,7 +66,7 @@ extra-y := initrd.o
63quiet_cmd_ramdisk = RAMDISK $@ 66quiet_cmd_ramdisk = RAMDISK $@
64 cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@ 67 cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@
65 68
66quiet_cmd_stripvm = STRIP $@ 69quiet_cmd_stripvm = STRIP $@
67 cmd_stripvm = $(STRIP) -s $< -o $@ 70 cmd_stripvm = $(STRIP) -s $< -o $@
68 71
69vmlinux.strip: vmlinux FORCE 72vmlinux.strip: vmlinux FORCE
@@ -71,12 +74,20 @@ vmlinux.strip: vmlinux FORCE
71$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE 74$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE
72 $(call if_changed,ramdisk) 75 $(call if_changed,ramdisk)
73 76
74addsection = $(CROSS32OBJCOPY) $(1) \ 77quiet_cmd_addsection = ADDSEC $@
75 --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(patsubst %.o,%.gz, $(1)) \ 78 cmd_addsection = $(CROSS32OBJCOPY) $@ \
76 --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(OBJCOPYFLAGS) 79 --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(patsubst %.o,%.gz, $@) \
80 --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPYFLAGS)
81
82quiet_cmd_imagesize = GENSIZE $@
83 cmd_imagesize = ls -l vmlinux.strip | \
84 awk '{printf "/* generated -- do not edit! */\n" "unsigned long vmlinux_filesize = %d;\n", $$5}' \
85 > $(obj)/imagesize.c && \
86 $(CROSS_COMPILE)nm -n vmlinux | tail -n 1 | \
87 awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' >> $(obj)/imagesize.c
77 88
78quiet_cmd_addnote = ADDNOTE $@ 89quiet_cmd_addnote = ADDNOTE $@
79 cmd_addnote = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@ 90 cmd_addnote = $(obj)/addnote $@
80 91
81$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE 92$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE
82 $(call if_changed,gzip) 93 $(call if_changed,gzip)
@@ -85,28 +96,30 @@ $(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz
85 cp -f $(obj)/ramdisk.image.gz $@ 96 cp -f $(obj)/ramdisk.image.gz $@
86 97
87$(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz FORCE 98$(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz FORCE
88 touch $@ 99 @touch $@
89 100
90$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c FORCE 101$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c FORCE
91 $(call if_changed_dep,bootcc) 102 $(call if_changed_dep,bootcc)
92 $(call addsection, $@) 103 $(call cmd,addsection)
104
105$(obj)/zImage.vmode: obj-boot += $(call obj-sec, $(required))
106$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) FORCE
107 $(call cmd,bootld,$(obj-boot))
108
109$(obj)/zImage.initrd.vmode: obj-boot += $(call obj-sec, $(required) $(initrd))
110$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) FORCE
111 $(call cmd,bootld,$(obj-boot))
93 112
94$(obj)/zImage: obj-boot += $(call obj-sec, $(required)) 113$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote FORCE
95$(obj)/zImage: $(call obj-sec, $(required)) $(obj-boot) $(obj)/addnote FORCE 114 @cp -f $< $@
96 $(call if_changed,addnote) 115 $(call if_changed,addnote)
97 116
98$(obj)/zImage.initrd: obj-boot += $(call obj-sec, $(required) $(initrd)) 117$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote FORCE
99$(obj)/zImage.initrd: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/addnote FORCE 118 @cp -f $< $@
100 $(call if_changed,addnote) 119 $(call if_changed,addnote)
101 120
102$(obj)/imagesize.c: vmlinux.strip 121$(obj)/imagesize.c: vmlinux.strip
103 @echo Generating $@ 122 $(call cmd,imagesize)
104 ls -l vmlinux.strip | \
105 awk '{printf "/* generated -- do not edit! */\n" \
106 "unsigned long vmlinux_filesize = %d;\n", $$5}' > $(obj)/imagesize.c
107 $(CROSS_COMPILE)nm -n vmlinux | tail -n 1 | \
108 awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' \
109 >> $(obj)/imagesize.c
110 123
111install: $(CONFIGURE) $(BOOTIMAGE) 124install: $(CONFIGURE) $(BOOTIMAGE)
112 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)" 125 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
diff --git a/arch/ppc64/boot/main.c b/arch/ppc64/boot/main.c
index 99e68cfbe688..f7ec19a2d0b0 100644
--- a/arch/ppc64/boot/main.c
+++ b/arch/ppc64/boot/main.c
@@ -23,7 +23,8 @@ extern void flush_cache(void *, unsigned long);
23 23
24/* Value picked to match that used by yaboot */ 24/* Value picked to match that used by yaboot */
25#define PROG_START 0x01400000 25#define PROG_START 0x01400000
26#define RAM_END (256<<20) // Fixme: use OF */ 26#define RAM_END (512<<20) // Fixme: use OF */
27#define ONE_MB 0x100000
27 28
28static char *avail_ram; 29static char *avail_ram;
29static char *begin_avail, *end_avail; 30static char *begin_avail, *end_avail;
@@ -32,6 +33,7 @@ static unsigned int heap_use;
32static unsigned int heap_max; 33static unsigned int heap_max;
33 34
34extern char _start[]; 35extern char _start[];
36extern char _end[];
35extern char _vmlinux_start[]; 37extern char _vmlinux_start[];
36extern char _vmlinux_end[]; 38extern char _vmlinux_end[];
37extern char _initrd_start[]; 39extern char _initrd_start[];
@@ -58,13 +60,13 @@ typedef void (*kernel_entry_t)( unsigned long,
58 60
59#undef DEBUG 61#undef DEBUG
60 62
61static unsigned long claim_base = PROG_START; 63static unsigned long claim_base;
62 64
63static unsigned long try_claim(unsigned long size) 65static unsigned long try_claim(unsigned long size)
64{ 66{
65 unsigned long addr = 0; 67 unsigned long addr = 0;
66 68
67 for(; claim_base < RAM_END; claim_base += 0x100000) { 69 for(; claim_base < RAM_END; claim_base += ONE_MB) {
68#ifdef DEBUG 70#ifdef DEBUG
69 printf(" trying: 0x%08lx\n\r", claim_base); 71 printf(" trying: 0x%08lx\n\r", claim_base);
70#endif 72#endif
@@ -95,7 +97,26 @@ void start(unsigned long a1, unsigned long a2, void *promptr)
95 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4) 97 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
96 exit(); 98 exit();
97 99
98 printf("\n\rzImage starting: loaded at 0x%x\n\r", (unsigned)_start); 100 printf("\n\rzImage starting: loaded at 0x%lx\n\r", (unsigned long) _start);
101
102 /*
103 * The first available claim_base must be above the end of the
104 * the loaded kernel wrapper file (_start to _end includes the
105 * initrd image if it is present) and rounded up to a nice
106 * 1 MB boundary for good measure.
107 */
108
109 claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
110
111#if defined(PROG_START)
112 /*
113 * Maintain a "magic" minimum address. This keeps some older
114 * firmware platforms running.
115 */
116
117 if (claim_base < PROG_START)
118 claim_base = PROG_START;
119#endif
99 120
100 /* 121 /*
101 * Now we try to claim some memory for the kernel itself 122 * Now we try to claim some memory for the kernel itself
@@ -105,7 +126,7 @@ void start(unsigned long a1, unsigned long a2, void *promptr)
105 * size... In practice we add 1Mb, that is enough, but we should really 126 * size... In practice we add 1Mb, that is enough, but we should really
106 * consider fixing the Makefile to put a _raw_ kernel in there ! 127 * consider fixing the Makefile to put a _raw_ kernel in there !
107 */ 128 */
108 vmlinux_memsize += 0x100000; 129 vmlinux_memsize += ONE_MB;
109 printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux_memsize); 130 printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux_memsize);
110 vmlinux.addr = try_claim(vmlinux_memsize); 131 vmlinux.addr = try_claim(vmlinux_memsize);
111 if (vmlinux.addr == 0) { 132 if (vmlinux.addr == 0) {
diff --git a/arch/ppc64/kernel/bpa_iic.c b/arch/ppc64/kernel/bpa_iic.c
index c8f3dc3fad70..0aaa878e19d3 100644
--- a/arch/ppc64/kernel/bpa_iic.c
+++ b/arch/ppc64/kernel/bpa_iic.c
@@ -205,6 +205,18 @@ static struct iic_regs __iomem *find_iic(int cpu)
205} 205}
206 206
207#ifdef CONFIG_SMP 207#ifdef CONFIG_SMP
208
209/* Use the highest interrupt priorities for IPI */
210static inline int iic_ipi_to_irq(int ipi)
211{
212 return IIC_IPI_OFFSET + IIC_NUM_IPIS - 1 - ipi;
213}
214
215static inline int iic_irq_to_ipi(int irq)
216{
217 return IIC_NUM_IPIS - 1 - (irq - IIC_IPI_OFFSET);
218}
219
208void iic_setup_cpu(void) 220void iic_setup_cpu(void)
209{ 221{
210 out_be64(&__get_cpu_var(iic).regs->prio, 0xff); 222 out_be64(&__get_cpu_var(iic).regs->prio, 0xff);
@@ -212,18 +224,20 @@ void iic_setup_cpu(void)
212 224
213void iic_cause_IPI(int cpu, int mesg) 225void iic_cause_IPI(int cpu, int mesg)
214{ 226{
215 out_be64(&per_cpu(iic, cpu).regs->generate, mesg); 227 out_be64(&per_cpu(iic, cpu).regs->generate, (IIC_NUM_IPIS - 1 - mesg) << 4);
216} 228}
217 229
218static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs) 230static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
219{ 231{
220 232 smp_message_recv(iic_irq_to_ipi(irq), regs);
221 smp_message_recv(irq - IIC_IPI_OFFSET, regs);
222 return IRQ_HANDLED; 233 return IRQ_HANDLED;
223} 234}
224 235
225static void iic_request_ipi(int irq, const char *name) 236static void iic_request_ipi(int ipi, const char *name)
226{ 237{
238 int irq;
239
240 irq = iic_ipi_to_irq(ipi);
227 /* IPIs are marked SA_INTERRUPT as they must run with irqs 241 /* IPIs are marked SA_INTERRUPT as they must run with irqs
228 * disabled */ 242 * disabled */
229 get_irq_desc(irq)->handler = &iic_pic; 243 get_irq_desc(irq)->handler = &iic_pic;
@@ -233,10 +247,10 @@ static void iic_request_ipi(int irq, const char *name)
233 247
234void iic_request_IPIs(void) 248void iic_request_IPIs(void)
235{ 249{
236 iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_CALL_FUNCTION, "IPI-call"); 250 iic_request_ipi(PPC_MSG_CALL_FUNCTION, "IPI-call");
237 iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_RESCHEDULE, "IPI-resched"); 251 iic_request_ipi(PPC_MSG_RESCHEDULE, "IPI-resched");
238#ifdef CONFIG_DEBUGGER 252#ifdef CONFIG_DEBUGGER
239 iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_DEBUGGER_BREAK, "IPI-debug"); 253 iic_request_ipi(PPC_MSG_DEBUGGER_BREAK, "IPI-debug");
240#endif /* CONFIG_DEBUGGER */ 254#endif /* CONFIG_DEBUGGER */
241} 255}
242#endif /* CONFIG_SMP */ 256#endif /* CONFIG_SMP */
diff --git a/arch/ppc64/kernel/cpu_setup_power4.S b/arch/ppc64/kernel/cpu_setup_power4.S
index 0482c063c26e..1fb673c511ff 100644
--- a/arch/ppc64/kernel/cpu_setup_power4.S
+++ b/arch/ppc64/kernel/cpu_setup_power4.S
@@ -12,10 +12,9 @@
12#include <linux/config.h> 12#include <linux/config.h>
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/ppc_asm.h>
16#include <asm/cputable.h> 15#include <asm/cputable.h>
17#include <asm/ppc_asm.h> 16#include <asm/ppc_asm.h>
18#include <asm/offsets.h> 17#include <asm/asm-offsets.h>
19#include <asm/cache.h> 18#include <asm/cache.h>
20 19
21_GLOBAL(__970_cpu_preinit) 20_GLOBAL(__970_cpu_preinit)
diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
index af5272fedadf..ba93fd731222 100644
--- a/arch/ppc64/kernel/eeh.c
+++ b/arch/ppc64/kernel/eeh.c
@@ -202,10 +202,9 @@ static void pci_addr_cache_print(struct pci_io_addr_cache *cache)
202 while (n) { 202 while (n) {
203 struct pci_io_addr_range *piar; 203 struct pci_io_addr_range *piar;
204 piar = rb_entry(n, struct pci_io_addr_range, rb_node); 204 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
205 printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s %s\n", 205 printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s\n",
206 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt, 206 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt,
207 piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev), 207 piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev));
208 pci_pretty_name(piar->pcidev));
209 cnt++; 208 cnt++;
210 n = rb_next(n); 209 n = rb_next(n);
211 } 210 }
@@ -255,22 +254,24 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
255static void __pci_addr_cache_insert_device(struct pci_dev *dev) 254static void __pci_addr_cache_insert_device(struct pci_dev *dev)
256{ 255{
257 struct device_node *dn; 256 struct device_node *dn;
257 struct pci_dn *pdn;
258 int i; 258 int i;
259 int inserted = 0; 259 int inserted = 0;
260 260
261 dn = pci_device_to_OF_node(dev); 261 dn = pci_device_to_OF_node(dev);
262 if (!dn) { 262 if (!dn) {
263 printk(KERN_WARNING "PCI: no pci dn found for dev=%s %s\n", 263 printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n",
264 pci_name(dev), pci_pretty_name(dev)); 264 pci_name(dev));
265 return; 265 return;
266 } 266 }
267 267
268 /* Skip any devices for which EEH is not enabled. */ 268 /* Skip any devices for which EEH is not enabled. */
269 if (!(dn->eeh_mode & EEH_MODE_SUPPORTED) || 269 pdn = dn->data;
270 dn->eeh_mode & EEH_MODE_NOCHECK) { 270 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
271 pdn->eeh_mode & EEH_MODE_NOCHECK) {
271#ifdef DEBUG 272#ifdef DEBUG
272 printk(KERN_INFO "PCI: skip building address cache for=%s %s\n", 273 printk(KERN_INFO "PCI: skip building address cache for=%s\n",
273 pci_name(dev), pci_pretty_name(dev)); 274 pci_name(dev));
274#endif 275#endif
275 return; 276 return;
276 } 277 }
@@ -416,6 +417,7 @@ int eeh_unregister_notifier(struct notifier_block *nb)
416static int read_slot_reset_state(struct device_node *dn, int rets[]) 417static int read_slot_reset_state(struct device_node *dn, int rets[])
417{ 418{
418 int token, outputs; 419 int token, outputs;
420 struct pci_dn *pdn = dn->data;
419 421
420 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) { 422 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
421 token = ibm_read_slot_reset_state2; 423 token = ibm_read_slot_reset_state2;
@@ -425,8 +427,8 @@ static int read_slot_reset_state(struct device_node *dn, int rets[])
425 outputs = 3; 427 outputs = 3;
426 } 428 }
427 429
428 return rtas_call(token, 3, outputs, rets, dn->eeh_config_addr, 430 return rtas_call(token, 3, outputs, rets, pdn->eeh_config_addr,
429 BUID_HI(dn->phb->buid), BUID_LO(dn->phb->buid)); 431 BUID_HI(pdn->phb->buid), BUID_LO(pdn->phb->buid));
430} 432}
431 433
432/** 434/**
@@ -447,12 +449,12 @@ static void eeh_panic(struct pci_dev *dev, int reset_state)
447 * in light of potential corruption, we can use it here. 449 * in light of potential corruption, we can use it here.
448 */ 450 */
449 if (panic_on_oops) 451 if (panic_on_oops)
450 panic("EEH: MMIO failure (%d) on device:%s %s\n", reset_state, 452 panic("EEH: MMIO failure (%d) on device:%s\n", reset_state,
451 pci_name(dev), pci_pretty_name(dev)); 453 pci_name(dev));
452 else { 454 else {
453 __get_cpu_var(ignored_failures)++; 455 __get_cpu_var(ignored_failures)++;
454 printk(KERN_INFO "EEH: Ignored MMIO failure (%d) on device:%s %s\n", 456 printk(KERN_INFO "EEH: Ignored MMIO failure (%d) on device:%s\n",
455 reset_state, pci_name(dev), pci_pretty_name(dev)); 457 reset_state, pci_name(dev));
456 } 458 }
457} 459}
458 460
@@ -482,8 +484,8 @@ static void eeh_event_handler(void *dummy)
482 break; 484 break;
483 485
484 printk(KERN_INFO "EEH: MMIO failure (%d), notifiying device " 486 printk(KERN_INFO "EEH: MMIO failure (%d), notifiying device "
485 "%s %s\n", event->reset_state, 487 "%s\n", event->reset_state,
486 pci_name(event->dev), pci_pretty_name(event->dev)); 488 pci_name(event->dev));
487 489
488 atomic_set(&eeh_fail_count, 0); 490 atomic_set(&eeh_fail_count, 0);
489 notifier_call_chain (&eeh_notifier_chain, 491 notifier_call_chain (&eeh_notifier_chain,
@@ -535,6 +537,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
535 unsigned long flags; 537 unsigned long flags;
536 int rc, reset_state; 538 int rc, reset_state;
537 struct eeh_event *event; 539 struct eeh_event *event;
540 struct pci_dn *pdn;
538 541
539 __get_cpu_var(total_mmio_ffs)++; 542 __get_cpu_var(total_mmio_ffs)++;
540 543
@@ -543,14 +546,15 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
543 546
544 if (!dn) 547 if (!dn)
545 return 0; 548 return 0;
549 pdn = dn->data;
546 550
547 /* Access to IO BARs might get this far and still not want checking. */ 551 /* Access to IO BARs might get this far and still not want checking. */
548 if (!(dn->eeh_mode & EEH_MODE_SUPPORTED) || 552 if (!pdn->eeh_capable || !(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
549 dn->eeh_mode & EEH_MODE_NOCHECK) { 553 pdn->eeh_mode & EEH_MODE_NOCHECK) {
550 return 0; 554 return 0;
551 } 555 }
552 556
553 if (!dn->eeh_config_addr) { 557 if (!pdn->eeh_config_addr) {
554 return 0; 558 return 0;
555 } 559 }
556 560
@@ -558,7 +562,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
558 * If we already have a pending isolation event for this 562 * If we already have a pending isolation event for this
559 * slot, we know it's bad already, we don't need to check... 563 * slot, we know it's bad already, we don't need to check...
560 */ 564 */
561 if (dn->eeh_mode & EEH_MODE_ISOLATED) { 565 if (pdn->eeh_mode & EEH_MODE_ISOLATED) {
562 atomic_inc(&eeh_fail_count); 566 atomic_inc(&eeh_fail_count);
563 if (atomic_read(&eeh_fail_count) >= EEH_MAX_FAILS) { 567 if (atomic_read(&eeh_fail_count) >= EEH_MAX_FAILS) {
564 /* re-read the slot reset state */ 568 /* re-read the slot reset state */
@@ -583,7 +587,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
583 } 587 }
584 588
585 /* prevent repeated reports of this failure */ 589 /* prevent repeated reports of this failure */
586 dn->eeh_mode |= EEH_MODE_ISOLATED; 590 pdn->eeh_mode |= EEH_MODE_ISOLATED;
587 591
588 reset_state = rets[0]; 592 reset_state = rets[0];
589 593
@@ -591,9 +595,9 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
591 memset(slot_errbuf, 0, eeh_error_buf_size); 595 memset(slot_errbuf, 0, eeh_error_buf_size);
592 596
593 rc = rtas_call(ibm_slot_error_detail, 597 rc = rtas_call(ibm_slot_error_detail,
594 8, 1, NULL, dn->eeh_config_addr, 598 8, 1, NULL, pdn->eeh_config_addr,
595 BUID_HI(dn->phb->buid), 599 BUID_HI(pdn->phb->buid),
596 BUID_LO(dn->phb->buid), NULL, 0, 600 BUID_LO(pdn->phb->buid), NULL, 0,
597 virt_to_phys(slot_errbuf), 601 virt_to_phys(slot_errbuf),
598 eeh_error_buf_size, 602 eeh_error_buf_size,
599 1 /* Temporary Error */); 603 1 /* Temporary Error */);
@@ -680,8 +684,9 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
680 u32 *device_id = (u32 *)get_property(dn, "device-id", NULL); 684 u32 *device_id = (u32 *)get_property(dn, "device-id", NULL);
681 u32 *regs; 685 u32 *regs;
682 int enable; 686 int enable;
687 struct pci_dn *pdn = dn->data;
683 688
684 dn->eeh_mode = 0; 689 pdn->eeh_mode = 0;
685 690
686 if (status && strcmp(status, "ok") != 0) 691 if (status && strcmp(status, "ok") != 0)
687 return NULL; /* ignore devices with bad status */ 692 return NULL; /* ignore devices with bad status */
@@ -692,7 +697,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
692 697
693 /* There is nothing to check on PCI to ISA bridges */ 698 /* There is nothing to check on PCI to ISA bridges */
694 if (dn->type && !strcmp(dn->type, "isa")) { 699 if (dn->type && !strcmp(dn->type, "isa")) {
695 dn->eeh_mode |= EEH_MODE_NOCHECK; 700 pdn->eeh_mode |= EEH_MODE_NOCHECK;
696 return NULL; 701 return NULL;
697 } 702 }
698 703
@@ -709,7 +714,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
709 enable = 0; 714 enable = 0;
710 715
711 if (!enable) 716 if (!enable)
712 dn->eeh_mode |= EEH_MODE_NOCHECK; 717 pdn->eeh_mode |= EEH_MODE_NOCHECK;
713 718
714 /* Ok... see if this device supports EEH. Some do, some don't, 719 /* Ok... see if this device supports EEH. Some do, some don't,
715 * and the only way to find out is to check each and every one. */ 720 * and the only way to find out is to check each and every one. */
@@ -722,8 +727,8 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
722 EEH_ENABLE); 727 EEH_ENABLE);
723 if (ret == 0) { 728 if (ret == 0) {
724 eeh_subsystem_enabled = 1; 729 eeh_subsystem_enabled = 1;
725 dn->eeh_mode |= EEH_MODE_SUPPORTED; 730 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
726 dn->eeh_config_addr = regs[0]; 731 pdn->eeh_config_addr = regs[0];
727#ifdef DEBUG 732#ifdef DEBUG
728 printk(KERN_DEBUG "EEH: %s: eeh enabled\n", dn->full_name); 733 printk(KERN_DEBUG "EEH: %s: eeh enabled\n", dn->full_name);
729#endif 734#endif
@@ -731,10 +736,11 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
731 736
732 /* This device doesn't support EEH, but it may have an 737 /* This device doesn't support EEH, but it may have an
733 * EEH parent, in which case we mark it as supported. */ 738 * EEH parent, in which case we mark it as supported. */
734 if (dn->parent && (dn->parent->eeh_mode & EEH_MODE_SUPPORTED)) { 739 if (dn->parent && dn->parent->data
740 && (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) {
735 /* Parent supports EEH. */ 741 /* Parent supports EEH. */
736 dn->eeh_mode |= EEH_MODE_SUPPORTED; 742 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
737 dn->eeh_config_addr = dn->parent->eeh_config_addr; 743 pdn->eeh_config_addr = PCI_DN(dn->parent)->eeh_config_addr;
738 return NULL; 744 return NULL;
739 } 745 }
740 } 746 }
@@ -791,11 +797,13 @@ void __init eeh_init(void)
791 for (phb = of_find_node_by_name(NULL, "pci"); phb; 797 for (phb = of_find_node_by_name(NULL, "pci"); phb;
792 phb = of_find_node_by_name(phb, "pci")) { 798 phb = of_find_node_by_name(phb, "pci")) {
793 unsigned long buid; 799 unsigned long buid;
800 struct pci_dn *pci;
794 801
795 buid = get_phb_buid(phb); 802 buid = get_phb_buid(phb);
796 if (buid == 0) 803 if (buid == 0 || phb->data == NULL)
797 continue; 804 continue;
798 805
806 pci = phb->data;
799 info.buid_lo = BUID_LO(buid); 807 info.buid_lo = BUID_LO(buid);
800 info.buid_hi = BUID_HI(buid); 808 info.buid_hi = BUID_HI(buid);
801 traverse_pci_devices(phb, early_enable_eeh, &info); 809 traverse_pci_devices(phb, early_enable_eeh, &info);
@@ -824,9 +832,9 @@ void eeh_add_device_early(struct device_node *dn)
824 struct pci_controller *phb; 832 struct pci_controller *phb;
825 struct eeh_early_enable_info info; 833 struct eeh_early_enable_info info;
826 834
827 if (!dn) 835 if (!dn || !dn->data)
828 return; 836 return;
829 phb = dn->phb; 837 phb = PCI_DN(dn)->phb;
830 if (NULL == phb || 0 == phb->buid) { 838 if (NULL == phb || 0 == phb->buid) {
831 printk(KERN_WARNING "EEH: Expected buid but found none\n"); 839 printk(KERN_WARNING "EEH: Expected buid but found none\n");
832 return; 840 return;
@@ -851,8 +859,7 @@ void eeh_add_device_late(struct pci_dev *dev)
851 return; 859 return;
852 860
853#ifdef DEBUG 861#ifdef DEBUG
854 printk(KERN_DEBUG "EEH: adding device %s %s\n", pci_name(dev), 862 printk(KERN_DEBUG "EEH: adding device %s\n", pci_name(dev));
855 pci_pretty_name(dev));
856#endif 863#endif
857 864
858 pci_addr_cache_insert_device (dev); 865 pci_addr_cache_insert_device (dev);
@@ -873,8 +880,7 @@ void eeh_remove_device(struct pci_dev *dev)
873 880
874 /* Unregister the device with the EEH/PCI address search system */ 881 /* Unregister the device with the EEH/PCI address search system */
875#ifdef DEBUG 882#ifdef DEBUG
876 printk(KERN_DEBUG "EEH: remove device %s %s\n", pci_name(dev), 883 printk(KERN_DEBUG "EEH: remove device %s\n", pci_name(dev));
877 pci_pretty_name(dev));
878#endif 884#endif
879 pci_addr_cache_remove_device(dev); 885 pci_addr_cache_remove_device(dev);
880} 886}
diff --git a/arch/ppc64/kernel/entry.S b/arch/ppc64/kernel/entry.S
index bf99b4a92f20..d133a49cdf89 100644
--- a/arch/ppc64/kernel/entry.S
+++ b/arch/ppc64/kernel/entry.S
@@ -28,7 +28,7 @@
28#include <asm/mmu.h> 28#include <asm/mmu.h>
29#include <asm/thread_info.h> 29#include <asm/thread_info.h>
30#include <asm/ppc_asm.h> 30#include <asm/ppc_asm.h>
31#include <asm/offsets.h> 31#include <asm/asm-offsets.h>
32#include <asm/cputable.h> 32#include <asm/cputable.h>
33 33
34#ifdef CONFIG_PPC_ISERIES 34#ifdef CONFIG_PPC_ISERIES
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index b436206e317d..58c314738c99 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -30,7 +30,7 @@
30#include <asm/mmu.h> 30#include <asm/mmu.h>
31#include <asm/systemcfg.h> 31#include <asm/systemcfg.h>
32#include <asm/ppc_asm.h> 32#include <asm/ppc_asm.h>
33#include <asm/offsets.h> 33#include <asm/asm-offsets.h>
34#include <asm/bug.h> 34#include <asm/bug.h>
35#include <asm/cputable.h> 35#include <asm/cputable.h>
36#include <asm/setup.h> 36#include <asm/setup.h>
diff --git a/arch/ppc64/kernel/iSeries_VpdInfo.c b/arch/ppc64/kernel/iSeries_VpdInfo.c
index d11c732daf81..5d921792571f 100644
--- a/arch/ppc64/kernel/iSeries_VpdInfo.c
+++ b/arch/ppc64/kernel/iSeries_VpdInfo.c
@@ -264,8 +264,5 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count)
264 printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, Card %4s ", 264 printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, Card %4s ",
265 count, bus, PCI_SLOT(PciDev->devfn), PciDev->vendor, 265 count, bus, PCI_SLOT(PciDev->devfn), PciDev->vendor,
266 frame, card); 266 frame, card);
267 if (pci_class_name(PciDev->class >> 8) == 0) 267 printk("0x%04X\n", (int)(PciDev->class >> 8));
268 printk("0x%04X\n", (int)(PciDev->class >> 8));
269 else
270 printk("%s\n", pci_class_name(PciDev->class >> 8));
271} 268}
diff --git a/arch/ppc64/kernel/iSeries_pci.c b/arch/ppc64/kernel/iSeries_pci.c
index 356e4fd9a94f..fbc273c32bcc 100644
--- a/arch/ppc64/kernel/iSeries_pci.c
+++ b/arch/ppc64/kernel/iSeries_pci.c
@@ -252,7 +252,7 @@ unsigned long __init find_and_init_phbs(void)
252 phb = (struct pci_controller *)kmalloc(sizeof(struct pci_controller), GFP_KERNEL); 252 phb = (struct pci_controller *)kmalloc(sizeof(struct pci_controller), GFP_KERNEL);
253 if (phb == NULL) 253 if (phb == NULL)
254 return -ENOMEM; 254 return -ENOMEM;
255 pci_setup_pci_controller(phb); 255 pci_setup_pci_controller(phb);
256 256
257 phb->pci_mem_offset = phb->local_number = bus; 257 phb->pci_mem_offset = phb->local_number = bus;
258 phb->first_busno = bus; 258 phb->first_busno = bus;
diff --git a/arch/ppc64/kernel/idle_power4.S b/arch/ppc64/kernel/idle_power4.S
index 97e4a2655040..ca02afe2a795 100644
--- a/arch/ppc64/kernel/idle_power4.S
+++ b/arch/ppc64/kernel/idle_power4.S
@@ -20,7 +20,7 @@
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21#include <asm/thread_info.h> 21#include <asm/thread_info.h>
22#include <asm/ppc_asm.h> 22#include <asm/ppc_asm.h>
23#include <asm/offsets.h> 23#include <asm/asm-offsets.h>
24 24
25#undef DEBUG 25#undef DEBUG
26 26
diff --git a/arch/ppc64/kernel/iomap.c b/arch/ppc64/kernel/iomap.c
index 153cc8b0f136..6160c8dbb7c5 100644
--- a/arch/ppc64/kernel/iomap.c
+++ b/arch/ppc64/kernel/iomap.c
@@ -22,13 +22,23 @@ unsigned int fastcall ioread16(void __iomem *addr)
22{ 22{
23 return readw(addr); 23 return readw(addr);
24} 24}
25unsigned int fastcall ioread16be(void __iomem *addr)
26{
27 return in_be16(addr);
28}
25unsigned int fastcall ioread32(void __iomem *addr) 29unsigned int fastcall ioread32(void __iomem *addr)
26{ 30{
27 return readl(addr); 31 return readl(addr);
28} 32}
33unsigned int fastcall ioread32be(void __iomem *addr)
34{
35 return in_be32(addr);
36}
29EXPORT_SYMBOL(ioread8); 37EXPORT_SYMBOL(ioread8);
30EXPORT_SYMBOL(ioread16); 38EXPORT_SYMBOL(ioread16);
39EXPORT_SYMBOL(ioread16be);
31EXPORT_SYMBOL(ioread32); 40EXPORT_SYMBOL(ioread32);
41EXPORT_SYMBOL(ioread32be);
32 42
33void fastcall iowrite8(u8 val, void __iomem *addr) 43void fastcall iowrite8(u8 val, void __iomem *addr)
34{ 44{
@@ -38,13 +48,23 @@ void fastcall iowrite16(u16 val, void __iomem *addr)
38{ 48{
39 writew(val, addr); 49 writew(val, addr);
40} 50}
51void fastcall iowrite16be(u16 val, void __iomem *addr)
52{
53 out_be16(addr, val);
54}
41void fastcall iowrite32(u32 val, void __iomem *addr) 55void fastcall iowrite32(u32 val, void __iomem *addr)
42{ 56{
43 writel(val, addr); 57 writel(val, addr);
44} 58}
59void fastcall iowrite32be(u32 val, void __iomem *addr)
60{
61 out_be32(addr, val);
62}
45EXPORT_SYMBOL(iowrite8); 63EXPORT_SYMBOL(iowrite8);
46EXPORT_SYMBOL(iowrite16); 64EXPORT_SYMBOL(iowrite16);
65EXPORT_SYMBOL(iowrite16be);
47EXPORT_SYMBOL(iowrite32); 66EXPORT_SYMBOL(iowrite32);
67EXPORT_SYMBOL(iowrite32be);
48 68
49/* 69/*
50 * These are the "repeat read/write" functions. Note the 70 * These are the "repeat read/write" functions. Note the
@@ -56,15 +76,15 @@ EXPORT_SYMBOL(iowrite32);
56 */ 76 */
57void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) 77void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
58{ 78{
59 _insb((u8 __force *) addr, dst, count); 79 _insb((u8 __iomem *) addr, dst, count);
60} 80}
61void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) 81void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
62{ 82{
63 _insw_ns((u16 __force *) addr, dst, count); 83 _insw_ns((u16 __iomem *) addr, dst, count);
64} 84}
65void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) 85void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
66{ 86{
67 _insl_ns((u32 __force *) addr, dst, count); 87 _insl_ns((u32 __iomem *) addr, dst, count);
68} 88}
69EXPORT_SYMBOL(ioread8_rep); 89EXPORT_SYMBOL(ioread8_rep);
70EXPORT_SYMBOL(ioread16_rep); 90EXPORT_SYMBOL(ioread16_rep);
@@ -72,15 +92,15 @@ EXPORT_SYMBOL(ioread32_rep);
72 92
73void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) 93void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
74{ 94{
75 _outsb((u8 __force *) addr, src, count); 95 _outsb((u8 __iomem *) addr, src, count);
76} 96}
77void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) 97void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
78{ 98{
79 _outsw_ns((u16 __force *) addr, src, count); 99 _outsw_ns((u16 __iomem *) addr, src, count);
80} 100}
81void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) 101void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
82{ 102{
83 _outsl_ns((u32 __force *) addr, src, count); 103 _outsl_ns((u32 __iomem *) addr, src, count);
84} 104}
85EXPORT_SYMBOL(iowrite8_rep); 105EXPORT_SYMBOL(iowrite8_rep);
86EXPORT_SYMBOL(iowrite16_rep); 106EXPORT_SYMBOL(iowrite16_rep);
diff --git a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c
index 845eebd1e28d..9032b6bfe036 100644
--- a/arch/ppc64/kernel/iommu.c
+++ b/arch/ppc64/kernel/iommu.c
@@ -438,7 +438,8 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl)
438 438
439void iommu_free_table(struct device_node *dn) 439void iommu_free_table(struct device_node *dn)
440{ 440{
441 struct iommu_table *tbl = dn->iommu_table; 441 struct pci_dn *pdn = dn->data;
442 struct iommu_table *tbl = pdn->iommu_table;
442 unsigned long bitmap_sz, i; 443 unsigned long bitmap_sz, i;
443 unsigned int order; 444 unsigned int order;
444 445
diff --git a/arch/ppc64/kernel/maple_pci.c b/arch/ppc64/kernel/maple_pci.c
index 53993999b265..1d297e0edfc0 100644
--- a/arch/ppc64/kernel/maple_pci.c
+++ b/arch/ppc64/kernel/maple_pci.c
@@ -283,7 +283,7 @@ static void __init setup_u3_agp(struct pci_controller* hose)
283 * the reg address cell, we shall fix that by killing struct 283 * the reg address cell, we shall fix that by killing struct
284 * reg_property and using some accessor functions instead 284 * reg_property and using some accessor functions instead
285 */ 285 */
286 hose->first_busno = 0xf0; 286 hose->first_busno = 0xf0;
287 hose->last_busno = 0xff; 287 hose->last_busno = 0xff;
288 hose->ops = &u3_agp_pci_ops; 288 hose->ops = &u3_agp_pci_ops;
289 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000); 289 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000);
@@ -315,24 +315,24 @@ static int __init add_bridge(struct device_node *dev)
315 char* disp_name; 315 char* disp_name;
316 int *bus_range; 316 int *bus_range;
317 int primary = 1; 317 int primary = 1;
318 struct property *of_prop; 318 struct property *of_prop;
319 319
320 DBG("Adding PCI host bridge %s\n", dev->full_name); 320 DBG("Adding PCI host bridge %s\n", dev->full_name);
321 321
322 bus_range = (int *) get_property(dev, "bus-range", &len); 322 bus_range = (int *) get_property(dev, "bus-range", &len);
323 if (bus_range == NULL || len < 2 * sizeof(int)) { 323 if (bus_range == NULL || len < 2 * sizeof(int)) {
324 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 324 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
325 dev->full_name); 325 dev->full_name);
326 } 326 }
327 327
328 hose = alloc_bootmem(sizeof(struct pci_controller)); 328 hose = alloc_bootmem(sizeof(struct pci_controller));
329 if (hose == NULL) 329 if (hose == NULL)
330 return -ENOMEM; 330 return -ENOMEM;
331 pci_setup_pci_controller(hose); 331 pci_setup_pci_controller(hose);
332 332
333 hose->arch_data = dev; 333 hose->arch_data = dev;
334 hose->first_busno = bus_range ? bus_range[0] : 0; 334 hose->first_busno = bus_range ? bus_range[0] : 0;
335 hose->last_busno = bus_range ? bus_range[1] : 0xff; 335 hose->last_busno = bus_range ? bus_range[1] : 0xff;
336 336
337 of_prop = alloc_bootmem(sizeof(struct property) + 337 of_prop = alloc_bootmem(sizeof(struct property) +
338 sizeof(hose->global_number)); 338 sizeof(hose->global_number));
@@ -346,25 +346,25 @@ static int __init add_bridge(struct device_node *dev)
346 } 346 }
347 347
348 disp_name = NULL; 348 disp_name = NULL;
349 if (device_is_compatible(dev, "u3-agp")) { 349 if (device_is_compatible(dev, "u3-agp")) {
350 setup_u3_agp(hose); 350 setup_u3_agp(hose);
351 disp_name = "U3-AGP"; 351 disp_name = "U3-AGP";
352 primary = 0; 352 primary = 0;
353 } else if (device_is_compatible(dev, "u3-ht")) { 353 } else if (device_is_compatible(dev, "u3-ht")) {
354 setup_u3_ht(hose); 354 setup_u3_ht(hose);
355 disp_name = "U3-HT"; 355 disp_name = "U3-HT";
356 primary = 1; 356 primary = 1;
357 } 357 }
358 printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", 358 printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n",
359 disp_name, hose->first_busno, hose->last_busno); 359 disp_name, hose->first_busno, hose->last_busno);
360 360
361 /* Interpret the "ranges" property */ 361 /* Interpret the "ranges" property */
362 /* This also maps the I/O region and sets isa_io/mem_base */ 362 /* This also maps the I/O region and sets isa_io/mem_base */
363 pci_process_bridge_OF_ranges(hose, dev); 363 pci_process_bridge_OF_ranges(hose, dev);
364 pci_setup_phb_io(hose, primary); 364 pci_setup_phb_io(hose, primary);
365 365
366 /* Fixup "bus-range" OF property */ 366 /* Fixup "bus-range" OF property */
367 fixup_bus_range(dev); 367 fixup_bus_range(dev);
368 368
369 return 0; 369 return 0;
370} 370}
@@ -447,9 +447,9 @@ void __init maple_pci_init(void)
447 */ 447 */
448 if (u3_agp) { 448 if (u3_agp) {
449 struct device_node *np = u3_agp->arch_data; 449 struct device_node *np = u3_agp->arch_data;
450 np->busno = 0xf0; 450 PCI_DN(np)->busno = 0xf0;
451 for (np = np->child; np; np = np->sibling) 451 for (np = np->child; np; np = np->sibling)
452 np->busno = 0xf0; 452 PCI_DN(np)->busno = 0xf0;
453 } 453 }
454 454
455 /* Tell pci.c to use the common resource allocation mecanism */ 455 /* Tell pci.c to use the common resource allocation mecanism */
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index 6d860c1d9fa0..e7241ad80a08 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -26,7 +26,7 @@
26#include <asm/page.h> 26#include <asm/page.h>
27#include <asm/cache.h> 27#include <asm/cache.h>
28#include <asm/ppc_asm.h> 28#include <asm/ppc_asm.h>
29#include <asm/offsets.h> 29#include <asm/asm-offsets.h>
30#include <asm/cputable.h> 30#include <asm/cputable.h>
31 31
32 .text 32 .text
@@ -1431,9 +1431,9 @@ _GLOBAL(sys_call_table)
1431 .llong .sys_ni_syscall /* 195 - 32bit only stat64 */ 1431 .llong .sys_ni_syscall /* 195 - 32bit only stat64 */
1432 .llong .sys_ni_syscall /* 32bit only lstat64 */ 1432 .llong .sys_ni_syscall /* 32bit only lstat64 */
1433 .llong .sys_ni_syscall /* 32bit only fstat64 */ 1433 .llong .sys_ni_syscall /* 32bit only fstat64 */
1434 .llong .sys_ni_syscall /* 32bit only pciconfig_read */ 1434 .llong .sys_pciconfig_read
1435 .llong .sys_ni_syscall /* 32bit only pciconfig_write */ 1435 .llong .sys_pciconfig_write
1436 .llong .sys_ni_syscall /* 32bit only pciconfig_iobase */ 1436 .llong .sys_pciconfig_iobase /* 200 - pciconfig_iobase */
1437 .llong .sys_ni_syscall /* reserved for MacOnLinux */ 1437 .llong .sys_ni_syscall /* reserved for MacOnLinux */
1438 .llong .sys_getdents64 1438 .llong .sys_getdents64
1439 .llong .sys_pivot_root 1439 .llong .sys_pivot_root
diff --git a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c
index 9d5e1e7fc389..f0fd7fbd6531 100644
--- a/arch/ppc64/kernel/pSeries_iommu.c
+++ b/arch/ppc64/kernel/pSeries_iommu.c
@@ -295,7 +295,7 @@ static void iommu_table_setparms_lpar(struct pci_controller *phb,
295 struct iommu_table *tbl, 295 struct iommu_table *tbl,
296 unsigned int *dma_window) 296 unsigned int *dma_window)
297{ 297{
298 tbl->it_busno = dn->bussubno; 298 tbl->it_busno = PCI_DN(dn)->bussubno;
299 299
300 /* TODO: Parse field size properties properly. */ 300 /* TODO: Parse field size properties properly. */
301 tbl->it_size = (((unsigned long)dma_window[4] << 32) | 301 tbl->it_size = (((unsigned long)dma_window[4] << 32) |
@@ -311,6 +311,7 @@ static void iommu_table_setparms_lpar(struct pci_controller *phb,
311static void iommu_bus_setup_pSeries(struct pci_bus *bus) 311static void iommu_bus_setup_pSeries(struct pci_bus *bus)
312{ 312{
313 struct device_node *dn, *pdn; 313 struct device_node *dn, *pdn;
314 struct pci_dn *pci;
314 struct iommu_table *tbl; 315 struct iommu_table *tbl;
315 316
316 DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self); 317 DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self);
@@ -325,6 +326,7 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
325 */ 326 */
326 327
327 dn = pci_bus_to_OF_node(bus); 328 dn = pci_bus_to_OF_node(bus);
329 pci = dn->data;
328 330
329 if (!bus->self) { 331 if (!bus->self) {
330 /* Root bus */ 332 /* Root bus */
@@ -341,18 +343,18 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
341 * alltogether. This leaves 768MB for the window. 343 * alltogether. This leaves 768MB for the window.
342 */ 344 */
343 DBG("PHB has io-hole, reserving 256MB\n"); 345 DBG("PHB has io-hole, reserving 256MB\n");
344 dn->phb->dma_window_size = 3 << 28; 346 pci->phb->dma_window_size = 3 << 28;
345 dn->phb->dma_window_base_cur = 1 << 28; 347 pci->phb->dma_window_base_cur = 1 << 28;
346 } else { 348 } else {
347 /* 1GB window by default */ 349 /* 1GB window by default */
348 dn->phb->dma_window_size = 1 << 30; 350 pci->phb->dma_window_size = 1 << 30;
349 dn->phb->dma_window_base_cur = 0; 351 pci->phb->dma_window_base_cur = 0;
350 } 352 }
351 353
352 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 354 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
353 355
354 iommu_table_setparms(dn->phb, dn, tbl); 356 iommu_table_setparms(pci->phb, dn, tbl);
355 dn->iommu_table = iommu_init_table(tbl); 357 pci->iommu_table = iommu_init_table(tbl);
356 } else { 358 } else {
357 /* Do a 128MB table at root. This is used for the IDE 359 /* Do a 128MB table at root. This is used for the IDE
358 * controller on some SMP-mode POWER4 machines. It 360 * controller on some SMP-mode POWER4 machines. It
@@ -363,16 +365,16 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
363 * Allocate at offset 128MB to avoid having to deal 365 * Allocate at offset 128MB to avoid having to deal
364 * with ISA holes; 128MB table for IDE is plenty. 366 * with ISA holes; 128MB table for IDE is plenty.
365 */ 367 */
366 dn->phb->dma_window_size = 1 << 27; 368 pci->phb->dma_window_size = 1 << 27;
367 dn->phb->dma_window_base_cur = 1 << 27; 369 pci->phb->dma_window_base_cur = 1 << 27;
368 370
369 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 371 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
370 372
371 iommu_table_setparms(dn->phb, dn, tbl); 373 iommu_table_setparms(pci->phb, dn, tbl);
372 dn->iommu_table = iommu_init_table(tbl); 374 pci->iommu_table = iommu_init_table(tbl);
373 375
374 /* All child buses have 256MB tables */ 376 /* All child buses have 256MB tables */
375 dn->phb->dma_window_size = 1 << 28; 377 pci->phb->dma_window_size = 1 << 28;
376 } 378 }
377 } else { 379 } else {
378 pdn = pci_bus_to_OF_node(bus->parent); 380 pdn = pci_bus_to_OF_node(bus->parent);
@@ -386,12 +388,12 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
386 388
387 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 389 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
388 390
389 iommu_table_setparms(dn->phb, dn, tbl); 391 iommu_table_setparms(pci->phb, dn, tbl);
390 392
391 dn->iommu_table = iommu_init_table(tbl); 393 pci->iommu_table = iommu_init_table(tbl);
392 } else { 394 } else {
393 /* Lower than first child or under python, use parent table */ 395 /* Lower than first child or under python, use parent table */
394 dn->iommu_table = pdn->iommu_table; 396 pci->iommu_table = PCI_DN(pdn)->iommu_table;
395 } 397 }
396 } 398 }
397} 399}
@@ -401,6 +403,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
401{ 403{
402 struct iommu_table *tbl; 404 struct iommu_table *tbl;
403 struct device_node *dn, *pdn; 405 struct device_node *dn, *pdn;
406 struct pci_dn *ppci;
404 unsigned int *dma_window = NULL; 407 unsigned int *dma_window = NULL;
405 408
406 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); 409 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self);
@@ -419,22 +422,24 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
419 return; 422 return;
420 } 423 }
421 424
422 if (!pdn->iommu_table) { 425 ppci = pdn->data;
426 if (!ppci->iommu_table) {
423 /* Bussubno hasn't been copied yet. 427 /* Bussubno hasn't been copied yet.
424 * Do it now because iommu_table_setparms_lpar needs it. 428 * Do it now because iommu_table_setparms_lpar needs it.
425 */ 429 */
426 pdn->bussubno = bus->number; 430
431 ppci->bussubno = bus->number;
427 432
428 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table), 433 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table),
429 GFP_KERNEL); 434 GFP_KERNEL);
430 435
431 iommu_table_setparms_lpar(pdn->phb, pdn, tbl, dma_window); 436 iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window);
432 437
433 pdn->iommu_table = iommu_init_table(tbl); 438 ppci->iommu_table = iommu_init_table(tbl);
434 } 439 }
435 440
436 if (pdn != dn) 441 if (pdn != dn)
437 dn->iommu_table = pdn->iommu_table; 442 PCI_DN(dn)->iommu_table = ppci->iommu_table;
438} 443}
439 444
440 445
@@ -449,11 +454,11 @@ static void iommu_dev_setup_pSeries(struct pci_dev *dev)
449 */ 454 */
450 mydn = dn = pci_device_to_OF_node(dev); 455 mydn = dn = pci_device_to_OF_node(dev);
451 456
452 while (dn && dn->iommu_table == NULL) 457 while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL)
453 dn = dn->parent; 458 dn = dn->parent;
454 459
455 if (dn) { 460 if (dn && dn->data) {
456 mydn->iommu_table = dn->iommu_table; 461 PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table;
457 } else { 462 } else {
458 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, dev->pretty_name); 463 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, dev->pretty_name);
459 } 464 }
@@ -463,10 +468,11 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
463{ 468{
464 int err = NOTIFY_OK; 469 int err = NOTIFY_OK;
465 struct device_node *np = node; 470 struct device_node *np = node;
471 struct pci_dn *pci = np->data;
466 472
467 switch (action) { 473 switch (action) {
468 case PSERIES_RECONFIG_REMOVE: 474 case PSERIES_RECONFIG_REMOVE:
469 if (np->iommu_table && 475 if (pci->iommu_table &&
470 get_property(np, "ibm,dma-window", NULL)) 476 get_property(np, "ibm,dma-window", NULL))
471 iommu_free_table(np); 477 iommu_free_table(np);
472 break; 478 break;
@@ -486,6 +492,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
486 struct device_node *pdn, *dn; 492 struct device_node *pdn, *dn;
487 struct iommu_table *tbl; 493 struct iommu_table *tbl;
488 int *dma_window = NULL; 494 int *dma_window = NULL;
495 struct pci_dn *pci;
489 496
490 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, dev->pretty_name); 497 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, dev->pretty_name);
491 498
@@ -497,8 +504,10 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
497 */ 504 */
498 dn = pci_device_to_OF_node(dev); 505 dn = pci_device_to_OF_node(dev);
499 506
500 for (pdn = dn; pdn && !pdn->iommu_table; pdn = pdn->parent) { 507 for (pdn = dn; pdn && pdn->data && !PCI_DN(pdn)->iommu_table;
501 dma_window = (unsigned int *)get_property(pdn, "ibm,dma-window", NULL); 508 pdn = pdn->parent) {
509 dma_window = (unsigned int *)
510 get_property(pdn, "ibm,dma-window", NULL);
502 if (dma_window) 511 if (dma_window)
503 break; 512 break;
504 } 513 }
@@ -515,20 +524,21 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
515 DBG("Found DMA window, allocating table\n"); 524 DBG("Found DMA window, allocating table\n");
516 } 525 }
517 526
518 if (!pdn->iommu_table) { 527 pci = pdn->data;
528 if (!pci->iommu_table) {
519 /* iommu_table_setparms_lpar needs bussubno. */ 529 /* iommu_table_setparms_lpar needs bussubno. */
520 pdn->bussubno = pdn->phb->bus->number; 530 pci->bussubno = pci->phb->bus->number;
521 531
522 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table), 532 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table),
523 GFP_KERNEL); 533 GFP_KERNEL);
524 534
525 iommu_table_setparms_lpar(pdn->phb, pdn, tbl, dma_window); 535 iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window);
526 536
527 pdn->iommu_table = iommu_init_table(tbl); 537 pci->iommu_table = iommu_init_table(tbl);
528 } 538 }
529 539
530 if (pdn != dn) 540 if (pdn != dn)
531 dn->iommu_table = pdn->iommu_table; 541 PCI_DN(dn)->iommu_table = pci->iommu_table;
532} 542}
533 543
534static void iommu_bus_setup_null(struct pci_bus *b) { } 544static void iommu_bus_setup_null(struct pci_bus *b) { }
diff --git a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c
index 9490b6c5b173..bfadccc7b8be 100644
--- a/arch/ppc64/kernel/pSeries_setup.c
+++ b/arch/ppc64/kernel/pSeries_setup.c
@@ -590,6 +590,13 @@ static int pseries_shared_idle(void)
590 return 0; 590 return 0;
591} 591}
592 592
593static int pSeries_pci_probe_mode(struct pci_bus *bus)
594{
595 if (systemcfg->platform & PLATFORM_LPAR)
596 return PCI_PROBE_DEVTREE;
597 return PCI_PROBE_NORMAL;
598}
599
593struct machdep_calls __initdata pSeries_md = { 600struct machdep_calls __initdata pSeries_md = {
594 .probe = pSeries_probe, 601 .probe = pSeries_probe,
595 .setup_arch = pSeries_setup_arch, 602 .setup_arch = pSeries_setup_arch,
@@ -597,6 +604,7 @@ struct machdep_calls __initdata pSeries_md = {
597 .get_cpuinfo = pSeries_get_cpuinfo, 604 .get_cpuinfo = pSeries_get_cpuinfo,
598 .log_error = pSeries_log_error, 605 .log_error = pSeries_log_error,
599 .pcibios_fixup = pSeries_final_fixup, 606 .pcibios_fixup = pSeries_final_fixup,
607 .pci_probe_mode = pSeries_pci_probe_mode,
600 .irq_bus_setup = pSeries_irq_bus_setup, 608 .irq_bus_setup = pSeries_irq_bus_setup,
601 .restart = rtas_restart, 609 .restart = rtas_restart,
602 .power_off = rtas_power_off, 610 .power_off = rtas_power_off,
diff --git a/arch/ppc64/kernel/pSeries_smp.c b/arch/ppc64/kernel/pSeries_smp.c
index 79c7f3223665..d2c7e2c4733b 100644
--- a/arch/ppc64/kernel/pSeries_smp.c
+++ b/arch/ppc64/kernel/pSeries_smp.c
@@ -272,6 +272,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
272 unsigned long start_here = __pa((u32)*((unsigned long *) 272 unsigned long start_here = __pa((u32)*((unsigned long *)
273 pSeries_secondary_smp_init)); 273 pSeries_secondary_smp_init));
274 unsigned int pcpu; 274 unsigned int pcpu;
275 int start_cpu;
275 276
276 if (cpu_isset(lcpu, of_spin_map)) 277 if (cpu_isset(lcpu, of_spin_map))
277 /* Already started by OF and sitting in spin loop */ 278 /* Already started by OF and sitting in spin loop */
@@ -282,12 +283,20 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
282 /* Fixup atomic count: it exited inside IRQ handler. */ 283 /* Fixup atomic count: it exited inside IRQ handler. */
283 paca[lcpu].__current->thread_info->preempt_count = 0; 284 paca[lcpu].__current->thread_info->preempt_count = 0;
284 285
285 status = rtas_call(rtas_token("start-cpu"), 3, 1, NULL, 286 /*
286 pcpu, start_here, lcpu); 287 * If the RTAS start-cpu token does not exist then presume the
288 * cpu is already spinning.
289 */
290 start_cpu = rtas_token("start-cpu");
291 if (start_cpu == RTAS_UNKNOWN_SERVICE)
292 return 1;
293
294 status = rtas_call(start_cpu, 3, 1, NULL, pcpu, start_here, lcpu);
287 if (status != 0) { 295 if (status != 0) {
288 printk(KERN_ERR "start-cpu failed: %i\n", status); 296 printk(KERN_ERR "start-cpu failed: %i\n", status);
289 return 0; 297 return 0;
290 } 298 }
299
291 return 1; 300 return 1;
292} 301}
293 302
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index d0d55c7908ef..861138ad092c 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -21,6 +21,7 @@
21#include <linux/bootmem.h> 21#include <linux/bootmem.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/syscalls.h>
24 25
25#include <asm/processor.h> 26#include <asm/processor.h>
26#include <asm/io.h> 27#include <asm/io.h>
@@ -50,6 +51,10 @@ unsigned long io_page_mask;
50 51
51EXPORT_SYMBOL(io_page_mask); 52EXPORT_SYMBOL(io_page_mask);
52 53
54#ifdef CONFIG_PPC_MULTIPLATFORM
55static void fixup_resource(struct resource *res, struct pci_dev *dev);
56static void do_bus_setup(struct pci_bus *bus);
57#endif
53 58
54unsigned int pcibios_assign_all_busses(void) 59unsigned int pcibios_assign_all_busses(void)
55{ 60{
@@ -84,7 +89,6 @@ static void fixup_broken_pcnet32(struct pci_dev* dev)
84 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) { 89 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
85 dev->vendor = PCI_VENDOR_ID_AMD; 90 dev->vendor = PCI_VENDOR_ID_AMD;
86 pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD); 91 pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD);
87 pci_name_device(dev);
88 } 92 }
89} 93}
90DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32); 94DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32);
@@ -225,10 +229,287 @@ static void __init pcibios_claim_of_setup(void)
225} 229}
226#endif 230#endif
227 231
232#ifdef CONFIG_PPC_MULTIPLATFORM
233static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
234{
235 u32 *prop;
236 int len;
237
238 prop = (u32 *) get_property(np, name, &len);
239 if (prop && len >= 4)
240 return *prop;
241 return def;
242}
243
244static unsigned int pci_parse_of_flags(u32 addr0)
245{
246 unsigned int flags = 0;
247
248 if (addr0 & 0x02000000) {
249 flags |= IORESOURCE_MEM;
250 if (addr0 & 0x40000000)
251 flags |= IORESOURCE_PREFETCH;
252 } else if (addr0 & 0x01000000)
253 flags |= IORESOURCE_IO;
254 return flags;
255}
256
257#define GET_64BIT(prop, i) ((((u64) (prop)[(i)]) << 32) | (prop)[(i)+1])
258
259static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
260{
261 u64 base, size;
262 unsigned int flags;
263 struct resource *res;
264 u32 *addrs, i;
265 int proplen;
266
267 addrs = (u32 *) get_property(node, "assigned-addresses", &proplen);
268 if (!addrs)
269 return;
270 for (; proplen >= 20; proplen -= 20, addrs += 5) {
271 flags = pci_parse_of_flags(addrs[0]);
272 if (!flags)
273 continue;
274 base = GET_64BIT(addrs, 1);
275 size = GET_64BIT(addrs, 3);
276 if (!size)
277 continue;
278 i = addrs[0] & 0xff;
279 if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) {
280 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];
281 } else if (i == dev->rom_base_reg) {
282 res = &dev->resource[PCI_ROM_RESOURCE];
283 flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
284 } else {
285 printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
286 continue;
287 }
288 res->start = base;
289 res->end = base + size - 1;
290 res->flags = flags;
291 res->name = pci_name(dev);
292 fixup_resource(res, dev);
293 }
294}
295
296static struct pci_dev *of_create_pci_dev(struct device_node *node,
297 struct pci_bus *bus, int devfn)
298{
299 struct pci_dev *dev;
300 const char *type;
301
302 dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
303 if (!dev)
304 return NULL;
305 type = get_property(node, "device_type", NULL);
306 if (type == NULL)
307 type = "";
308
309 memset(dev, 0, sizeof(struct pci_dev));
310 dev->bus = bus;
311 dev->sysdata = node;
312 dev->dev.parent = bus->bridge;
313 dev->dev.bus = &pci_bus_type;
314 dev->devfn = devfn;
315 dev->multifunction = 0; /* maybe a lie? */
316
317 dev->vendor = get_int_prop(node, "vendor-id", 0xffff);
318 dev->device = get_int_prop(node, "device-id", 0xffff);
319 dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0);
320 dev->subsystem_device = get_int_prop(node, "subsystem-id", 0);
321
322 dev->cfg_size = 256; /*pci_cfg_space_size(dev);*/
323
324 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
325 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
326 dev->class = get_int_prop(node, "class-code", 0);
327
328 dev->current_state = 4; /* unknown power state */
329
330 if (!strcmp(type, "pci")) {
331 /* a PCI-PCI bridge */
332 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
333 dev->rom_base_reg = PCI_ROM_ADDRESS1;
334 } else if (!strcmp(type, "cardbus")) {
335 dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;
336 } else {
337 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
338 dev->rom_base_reg = PCI_ROM_ADDRESS;
339 dev->irq = NO_IRQ;
340 if (node->n_intrs > 0) {
341 dev->irq = node->intrs[0].line;
342 pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
343 dev->irq);
344 }
345 }
346
347 pci_parse_of_addrs(node, dev);
348
349 pci_device_add(dev, bus);
350
351 /* XXX pci_scan_msi_device(dev); */
352
353 return dev;
354}
355
356static void of_scan_pci_bridge(struct device_node *node, struct pci_dev *dev);
357
358static void __devinit of_scan_bus(struct device_node *node,
359 struct pci_bus *bus)
360{
361 struct device_node *child = NULL;
362 u32 *reg;
363 int reglen, devfn;
364 struct pci_dev *dev;
365
366 while ((child = of_get_next_child(node, child)) != NULL) {
367 reg = (u32 *) get_property(child, "reg", &reglen);
368 if (reg == NULL || reglen < 20)
369 continue;
370 devfn = (reg[0] >> 8) & 0xff;
371 /* create a new pci_dev for this device */
372 dev = of_create_pci_dev(child, bus, devfn);
373 if (!dev)
374 continue;
375 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
376 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
377 of_scan_pci_bridge(child, dev);
378 }
379
380 do_bus_setup(bus);
381}
382
383static void __devinit of_scan_pci_bridge(struct device_node *node,
384 struct pci_dev *dev)
385{
386 struct pci_bus *bus;
387 u32 *busrange, *ranges;
388 int len, i, mode;
389 struct resource *res;
390 unsigned int flags;
391 u64 size;
392
393 /* parse bus-range property */
394 busrange = (u32 *) get_property(node, "bus-range", &len);
395 if (busrange == NULL || len != 8) {
396 printk(KERN_ERR "Can't get bus-range for PCI-PCI bridge %s\n",
397 node->full_name);
398 return;
399 }
400 ranges = (u32 *) get_property(node, "ranges", &len);
401 if (ranges == NULL) {
402 printk(KERN_ERR "Can't get ranges for PCI-PCI bridge %s\n",
403 node->full_name);
404 return;
405 }
406
407 bus = pci_add_new_bus(dev->bus, dev, busrange[0]);
408 if (!bus) {
409 printk(KERN_ERR "Failed to create pci bus for %s\n",
410 node->full_name);
411 return;
412 }
413
414 bus->primary = dev->bus->number;
415 bus->subordinate = busrange[1];
416 bus->bridge_ctl = 0;
417 bus->sysdata = node;
418
419 /* parse ranges property */
420 /* PCI #address-cells == 3 and #size-cells == 2 always */
421 res = &dev->resource[PCI_BRIDGE_RESOURCES];
422 for (i = 0; i < PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES; ++i) {
423 res->flags = 0;
424 bus->resource[i] = res;
425 ++res;
426 }
427 i = 1;
428 for (; len >= 32; len -= 32, ranges += 8) {
429 flags = pci_parse_of_flags(ranges[0]);
430 size = GET_64BIT(ranges, 6);
431 if (flags == 0 || size == 0)
432 continue;
433 if (flags & IORESOURCE_IO) {
434 res = bus->resource[0];
435 if (res->flags) {
436 printk(KERN_ERR "PCI: ignoring extra I/O range"
437 " for bridge %s\n", node->full_name);
438 continue;
439 }
440 } else {
441 if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) {
442 printk(KERN_ERR "PCI: too many memory ranges"
443 " for bridge %s\n", node->full_name);
444 continue;
445 }
446 res = bus->resource[i];
447 ++i;
448 }
449 res->start = GET_64BIT(ranges, 1);
450 res->end = res->start + size - 1;
451 res->flags = flags;
452 fixup_resource(res, dev);
453 }
454 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
455 bus->number);
456
457 mode = PCI_PROBE_NORMAL;
458 if (ppc_md.pci_probe_mode)
459 mode = ppc_md.pci_probe_mode(bus);
460 if (mode == PCI_PROBE_DEVTREE)
461 of_scan_bus(node, bus);
462 else if (mode == PCI_PROBE_NORMAL)
463 pci_scan_child_bus(bus);
464}
465#endif /* CONFIG_PPC_MULTIPLATFORM */
466
467static void __devinit scan_phb(struct pci_controller *hose)
468{
469 struct pci_bus *bus;
470 struct device_node *node = hose->arch_data;
471 int i, mode;
472 struct resource *res;
473
474 bus = pci_create_bus(NULL, hose->first_busno, hose->ops, node);
475 if (bus == NULL) {
476 printk(KERN_ERR "Failed to create bus for PCI domain %04x\n",
477 hose->global_number);
478 return;
479 }
480 bus->secondary = hose->first_busno;
481 hose->bus = bus;
482
483 bus->resource[0] = res = &hose->io_resource;
484 if (res->flags && request_resource(&ioport_resource, res))
485 printk(KERN_ERR "Failed to request PCI IO region "
486 "on PCI domain %04x\n", hose->global_number);
487
488 for (i = 0; i < 3; ++i) {
489 res = &hose->mem_resources[i];
490 bus->resource[i+1] = res;
491 if (res->flags && request_resource(&iomem_resource, res))
492 printk(KERN_ERR "Failed to request PCI memory region "
493 "on PCI domain %04x\n", hose->global_number);
494 }
495
496 mode = PCI_PROBE_NORMAL;
497#ifdef CONFIG_PPC_MULTIPLATFORM
498 if (ppc_md.pci_probe_mode)
499 mode = ppc_md.pci_probe_mode(bus);
500 if (mode == PCI_PROBE_DEVTREE) {
501 bus->subordinate = hose->last_busno;
502 of_scan_bus(node, bus);
503 }
504#endif /* CONFIG_PPC_MULTIPLATFORM */
505 if (mode == PCI_PROBE_NORMAL)
506 hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
507 pci_bus_add_devices(bus);
508}
509
228static int __init pcibios_init(void) 510static int __init pcibios_init(void)
229{ 511{
230 struct pci_controller *hose, *tmp; 512 struct pci_controller *hose, *tmp;
231 struct pci_bus *bus;
232 513
233 /* For now, override phys_mem_access_prot. If we need it, 514 /* For now, override phys_mem_access_prot. If we need it,
234 * later, we may move that initialization to each ppc_md 515 * later, we may move that initialization to each ppc_md
@@ -242,13 +523,8 @@ static int __init pcibios_init(void)
242 printk("PCI: Probing PCI hardware\n"); 523 printk("PCI: Probing PCI hardware\n");
243 524
244 /* Scan all of the recorded PCI controllers. */ 525 /* Scan all of the recorded PCI controllers. */
245 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 526 list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
246 hose->last_busno = 0xff; 527 scan_phb(hose);
247 bus = pci_scan_bus(hose->first_busno, hose->ops,
248 hose->arch_data);
249 hose->bus = bus;
250 hose->last_busno = bus->subordinate;
251 }
252 528
253#ifndef CONFIG_PPC_ISERIES 529#ifndef CONFIG_PPC_ISERIES
254 if (pci_probe_only) 530 if (pci_probe_only)
@@ -820,118 +1096,89 @@ void phbs_remap_io(void)
820/* 1096/*
821 * ppc64 can have multifunction devices that do not respond to function 0. 1097 * ppc64 can have multifunction devices that do not respond to function 0.
822 * In this case we must scan all functions. 1098 * In this case we must scan all functions.
1099 * XXX this can go now, we use the OF device tree in all the
1100 * cases that caused problems. -- paulus
823 */ 1101 */
824int pcibios_scan_all_fns(struct pci_bus *bus, int devfn) 1102int pcibios_scan_all_fns(struct pci_bus *bus, int devfn)
825{ 1103{
826 struct device_node *busdn, *dn; 1104 return 0;
1105}
1106
1107static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
1108{
1109 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1110 unsigned long start, end, mask, offset;
827 1111
828 if (bus->self) 1112 if (res->flags & IORESOURCE_IO) {
829 busdn = pci_device_to_OF_node(bus->self); 1113 offset = (unsigned long)hose->io_base_virt - pci_io_base;
830 else
831 busdn = bus->sysdata; /* must be a phb */
832 1114
833 if (busdn == NULL) 1115 start = res->start += offset;
834 return 0; 1116 end = res->end += offset;
835 1117
836 /* 1118 /* Need to allow IO access to pages that are in the
837 * Check to see if there is any of the 8 functions are in the 1119 ISA range */
838 * device tree. If they are then we need to scan all the 1120 if (start < MAX_ISA_PORT) {
839 * functions of this slot. 1121 if (end > MAX_ISA_PORT)
840 */ 1122 end = MAX_ISA_PORT;
841 for (dn = busdn->child; dn; dn = dn->sibling)
842 if ((dn->devfn >> 3) == (devfn >> 3))
843 return 1;
844 1123
845 return 0; 1124 start >>= PAGE_SHIFT;
846} 1125 end >>= PAGE_SHIFT;
847 1126
1127 /* get the range of pages for the map */
1128 mask = ((1 << (end+1)) - 1) ^ ((1 << start) - 1);
1129 io_page_mask |= mask;
1130 }
1131 } else if (res->flags & IORESOURCE_MEM) {
1132 res->start += hose->pci_mem_offset;
1133 res->end += hose->pci_mem_offset;
1134 }
1135}
848 1136
849void __devinit pcibios_fixup_device_resources(struct pci_dev *dev, 1137void __devinit pcibios_fixup_device_resources(struct pci_dev *dev,
850 struct pci_bus *bus) 1138 struct pci_bus *bus)
851{ 1139{
852 /* Update device resources. */ 1140 /* Update device resources. */
853 struct pci_controller *hose = pci_bus_to_host(bus);
854 int i; 1141 int i;
855 1142
856 for (i = 0; i < PCI_NUM_RESOURCES; i++) { 1143 for (i = 0; i < PCI_NUM_RESOURCES; i++)
857 if (dev->resource[i].flags & IORESOURCE_IO) { 1144 if (dev->resource[i].flags)
858 unsigned long offset = (unsigned long)hose->io_base_virt 1145 fixup_resource(&dev->resource[i], dev);
859 - pci_io_base;
860 unsigned long start, end, mask;
861
862 start = dev->resource[i].start += offset;
863 end = dev->resource[i].end += offset;
864
865 /* Need to allow IO access to pages that are in the
866 ISA range */
867 if (start < MAX_ISA_PORT) {
868 if (end > MAX_ISA_PORT)
869 end = MAX_ISA_PORT;
870
871 start >>= PAGE_SHIFT;
872 end >>= PAGE_SHIFT;
873
874 /* get the range of pages for the map */
875 mask = ((1 << (end+1))-1) ^ ((1 << start)-1);
876 io_page_mask |= mask;
877 }
878 }
879 else if (dev->resource[i].flags & IORESOURCE_MEM) {
880 dev->resource[i].start += hose->pci_mem_offset;
881 dev->resource[i].end += hose->pci_mem_offset;
882 }
883 }
884} 1146}
885EXPORT_SYMBOL(pcibios_fixup_device_resources); 1147EXPORT_SYMBOL(pcibios_fixup_device_resources);
886 1148
887void __devinit pcibios_fixup_bus(struct pci_bus *bus) 1149static void __devinit do_bus_setup(struct pci_bus *bus)
888{ 1150{
889 struct pci_controller *hose = pci_bus_to_host(bus); 1151 struct pci_dev *dev;
890 struct pci_dev *dev = bus->self;
891 struct resource *res;
892 int i;
893 1152
894 if (!dev) { 1153 ppc_md.iommu_bus_setup(bus);
895 /* Root bus. */
896 1154
897 hose->bus = bus; 1155 list_for_each_entry(dev, &bus->devices, bus_list)
898 bus->resource[0] = res = &hose->io_resource; 1156 ppc_md.iommu_dev_setup(dev);
899 1157
900 if (res->flags && request_resource(&ioport_resource, res)) 1158 if (ppc_md.irq_bus_setup)
901 printk(KERN_ERR "Failed to request IO on " 1159 ppc_md.irq_bus_setup(bus);
902 "PCI domain %d\n", pci_domain_nr(bus)); 1160}
903 1161
904 for (i = 0; i < 3; ++i) { 1162void __devinit pcibios_fixup_bus(struct pci_bus *bus)
905 res = &hose->mem_resources[i]; 1163{
906 bus->resource[i+1] = res; 1164 struct pci_dev *dev = bus->self;
907 if (res->flags && request_resource(&iomem_resource, res)) 1165
908 printk(KERN_ERR "Failed to request MEM on " 1166 if (dev && pci_probe_only &&
909 "PCI domain %d\n", 1167 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
910 pci_domain_nr(bus));
911 }
912 } else if (pci_probe_only &&
913 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
914 /* This is a subordinate bridge */ 1168 /* This is a subordinate bridge */
915 1169
916 pci_read_bridge_bases(bus); 1170 pci_read_bridge_bases(bus);
917 pcibios_fixup_device_resources(dev, bus); 1171 pcibios_fixup_device_resources(dev, bus);
918 } 1172 }
919 1173
920 ppc_md.iommu_bus_setup(bus); 1174 do_bus_setup(bus);
921
922 list_for_each_entry(dev, &bus->devices, bus_list)
923 ppc_md.iommu_dev_setup(dev);
924
925 if (ppc_md.irq_bus_setup)
926 ppc_md.irq_bus_setup(bus);
927 1175
928 if (!pci_probe_only) 1176 if (!pci_probe_only)
929 return; 1177 return;
930 1178
931 list_for_each_entry(dev, &bus->devices, bus_list) { 1179 list_for_each_entry(dev, &bus->devices, bus_list)
932 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) 1180 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
933 pcibios_fixup_device_resources(dev, bus); 1181 pcibios_fixup_device_resources(dev, bus);
934 }
935} 1182}
936EXPORT_SYMBOL(pcibios_fixup_bus); 1183EXPORT_SYMBOL(pcibios_fixup_bus);
937 1184
@@ -983,3 +1230,62 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar,
983} 1230}
984 1231
985#endif /* CONFIG_PPC_MULTIPLATFORM */ 1232#endif /* CONFIG_PPC_MULTIPLATFORM */
1233
1234
1235#define IOBASE_BRIDGE_NUMBER 0
1236#define IOBASE_MEMORY 1
1237#define IOBASE_IO 2
1238#define IOBASE_ISA_IO 3
1239#define IOBASE_ISA_MEM 4
1240
1241long sys_pciconfig_iobase(long which, unsigned long in_bus,
1242 unsigned long in_devfn)
1243{
1244 struct pci_controller* hose;
1245 struct list_head *ln;
1246 struct pci_bus *bus = NULL;
1247 struct device_node *hose_node;
1248
1249 /* Argh ! Please forgive me for that hack, but that's the
1250 * simplest way to get existing XFree to not lockup on some
1251 * G5 machines... So when something asks for bus 0 io base
1252 * (bus 0 is HT root), we return the AGP one instead.
1253 */
1254#ifdef CONFIG_PPC_PMAC
1255 if (systemcfg->platform == PLATFORM_POWERMAC &&
1256 machine_is_compatible("MacRISC4"))
1257 if (in_bus == 0)
1258 in_bus = 0xf0;
1259#endif /* CONFIG_PPC_PMAC */
1260
1261 /* That syscall isn't quite compatible with PCI domains, but it's
1262 * used on pre-domains setup. We return the first match
1263 */
1264
1265 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
1266 bus = pci_bus_b(ln);
1267 if (in_bus >= bus->number && in_bus < (bus->number + bus->subordinate))
1268 break;
1269 bus = NULL;
1270 }
1271 if (bus == NULL || bus->sysdata == NULL)
1272 return -ENODEV;
1273
1274 hose_node = (struct device_node *)bus->sysdata;
1275 hose = PCI_DN(hose_node)->phb;
1276
1277 switch (which) {
1278 case IOBASE_BRIDGE_NUMBER:
1279 return (long)hose->first_busno;
1280 case IOBASE_MEMORY:
1281 return (long)hose->pci_mem_offset;
1282 case IOBASE_IO:
1283 return (long)hose->io_base_phys;
1284 case IOBASE_ISA_IO:
1285 return (long)isa_io_base;
1286 case IOBASE_ISA_MEM:
1287 return -EINVAL;
1288 }
1289
1290 return -EOPNOTSUPP;
1291}
diff --git a/arch/ppc64/kernel/pci.h b/arch/ppc64/kernel/pci.h
index 26be78b13af1..5eb2cc320566 100644
--- a/arch/ppc64/kernel/pci.h
+++ b/arch/ppc64/kernel/pci.h
@@ -34,7 +34,6 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
34 34
35void pci_devs_phb_init(void); 35void pci_devs_phb_init(void);
36void pci_devs_phb_init_dynamic(struct pci_controller *phb); 36void pci_devs_phb_init_dynamic(struct pci_controller *phb);
37struct device_node *fetch_dev_dn(struct pci_dev *dev);
38 37
39/* PCI address cache management routines */ 38/* PCI address cache management routines */
40void pci_addr_cache_insert_device(struct pci_dev *dev); 39void pci_addr_cache_insert_device(struct pci_dev *dev);
diff --git a/arch/ppc64/kernel/pci_dn.c b/arch/ppc64/kernel/pci_dn.c
index ec345462afc3..a86389d07d57 100644
--- a/arch/ppc64/kernel/pci_dn.c
+++ b/arch/ppc64/kernel/pci_dn.c
@@ -23,6 +23,8 @@
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/slab.h>
27#include <linux/bootmem.h>
26 28
27#include <asm/io.h> 29#include <asm/io.h>
28#include <asm/prom.h> 30#include <asm/prom.h>
@@ -40,16 +42,26 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
40 struct pci_controller *phb = data; 42 struct pci_controller *phb = data;
41 int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL); 43 int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL);
42 u32 *regs; 44 u32 *regs;
43 45 struct pci_dn *pdn;
44 dn->phb = phb; 46
47 if (phb->is_dynamic)
48 pdn = kmalloc(sizeof(*pdn), GFP_KERNEL);
49 else
50 pdn = alloc_bootmem(sizeof(*pdn));
51 if (pdn == NULL)
52 return NULL;
53 memset(pdn, 0, sizeof(*pdn));
54 dn->data = pdn;
55 pdn->node = dn;
56 pdn->phb = phb;
45 regs = (u32 *)get_property(dn, "reg", NULL); 57 regs = (u32 *)get_property(dn, "reg", NULL);
46 if (regs) { 58 if (regs) {
47 /* First register entry is addr (00BBSS00) */ 59 /* First register entry is addr (00BBSS00) */
48 dn->busno = (regs[0] >> 16) & 0xff; 60 pdn->busno = (regs[0] >> 16) & 0xff;
49 dn->devfn = (regs[0] >> 8) & 0xff; 61 pdn->devfn = (regs[0] >> 8) & 0xff;
50 } 62 }
51 63
52 dn->pci_ext_config_space = (type && *type == 1); 64 pdn->pci_ext_config_space = (type && *type == 1);
53 return NULL; 65 return NULL;
54} 66}
55 67
@@ -112,10 +124,15 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
112void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb) 124void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb)
113{ 125{
114 struct device_node * dn = (struct device_node *) phb->arch_data; 126 struct device_node * dn = (struct device_node *) phb->arch_data;
127 struct pci_dn *pdn;
115 128
116 /* PHB nodes themselves must not match */ 129 /* PHB nodes themselves must not match */
117 dn->devfn = dn->busno = -1; 130 update_dn_pci_info(dn, phb);
118 dn->phb = phb; 131 pdn = dn->data;
132 if (pdn) {
133 pdn->devfn = pdn->busno = -1;
134 pdn->phb = phb;
135 }
119 136
120 /* Update dn->phb ptrs for new phb and children devices */ 137 /* Update dn->phb ptrs for new phb and children devices */
121 traverse_pci_devices(dn, update_dn_pci_info, phb); 138 traverse_pci_devices(dn, update_dn_pci_info, phb);
@@ -123,14 +140,17 @@ void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb)
123 140
124/* 141/*
125 * Traversal func that looks for a <busno,devfcn> value. 142 * Traversal func that looks for a <busno,devfcn> value.
126 * If found, the device_node is returned (thus terminating the traversal). 143 * If found, the pci_dn is returned (thus terminating the traversal).
127 */ 144 */
128static void *is_devfn_node(struct device_node *dn, void *data) 145static void *is_devfn_node(struct device_node *dn, void *data)
129{ 146{
130 int busno = ((unsigned long)data >> 8) & 0xff; 147 int busno = ((unsigned long)data >> 8) & 0xff;
131 int devfn = ((unsigned long)data) & 0xff; 148 int devfn = ((unsigned long)data) & 0xff;
149 struct pci_dn *pci = dn->data;
132 150
133 return ((devfn == dn->devfn) && (busno == dn->busno)) ? dn : NULL; 151 if (pci && (devfn == pci->devfn) && (busno == pci->busno))
152 return dn;
153 return NULL;
134} 154}
135 155
136/* 156/*
@@ -149,13 +169,10 @@ static void *is_devfn_node(struct device_node *dn, void *data)
149struct device_node *fetch_dev_dn(struct pci_dev *dev) 169struct device_node *fetch_dev_dn(struct pci_dev *dev)
150{ 170{
151 struct device_node *orig_dn = dev->sysdata; 171 struct device_node *orig_dn = dev->sysdata;
152 struct pci_controller *phb = orig_dn->phb; /* assume same phb as orig_dn */
153 struct device_node *phb_dn;
154 struct device_node *dn; 172 struct device_node *dn;
155 unsigned long searchval = (dev->bus->number << 8) | dev->devfn; 173 unsigned long searchval = (dev->bus->number << 8) | dev->devfn;
156 174
157 phb_dn = phb->arch_data; 175 dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval);
158 dn = traverse_pci_devices(phb_dn, is_devfn_node, (void *)searchval);
159 if (dn) 176 if (dn)
160 dev->sysdata = dn; 177 dev->sysdata = dn;
161 return dn; 178 return dn;
@@ -165,11 +182,13 @@ EXPORT_SYMBOL(fetch_dev_dn);
165static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) 182static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
166{ 183{
167 struct device_node *np = node; 184 struct device_node *np = node;
185 struct pci_dn *pci;
168 int err = NOTIFY_OK; 186 int err = NOTIFY_OK;
169 187
170 switch (action) { 188 switch (action) {
171 case PSERIES_RECONFIG_ADD: 189 case PSERIES_RECONFIG_ADD:
172 update_dn_pci_info(np, np->parent->phb); 190 pci = np->parent->data;
191 update_dn_pci_info(np, pci->phb);
173 break; 192 break;
174 default: 193 default:
175 err = NOTIFY_DONE; 194 err = NOTIFY_DONE;
diff --git a/arch/ppc64/kernel/pci_iommu.c b/arch/ppc64/kernel/pci_iommu.c
index ef0a62b916be..14647e09c9cd 100644
--- a/arch/ppc64/kernel/pci_iommu.c
+++ b/arch/ppc64/kernel/pci_iommu.c
@@ -66,7 +66,7 @@ static inline struct iommu_table *devnode_table(struct device *dev)
66#endif /* CONFIG_PPC_ISERIES */ 66#endif /* CONFIG_PPC_ISERIES */
67 67
68#ifdef CONFIG_PPC_MULTIPLATFORM 68#ifdef CONFIG_PPC_MULTIPLATFORM
69 return PCI_GET_DN(pdev)->iommu_table; 69 return PCI_DN(PCI_GET_DN(pdev))->iommu_table;
70#endif /* CONFIG_PPC_MULTIPLATFORM */ 70#endif /* CONFIG_PPC_MULTIPLATFORM */
71} 71}
72 72
diff --git a/arch/ppc64/kernel/pmac_feature.c b/arch/ppc64/kernel/pmac_feature.c
index 98ed2bccab1a..eb4e6c3f694d 100644
--- a/arch/ppc64/kernel/pmac_feature.c
+++ b/arch/ppc64/kernel/pmac_feature.c
@@ -674,6 +674,7 @@ void __init pmac_check_ht_link(void)
674#if 0 /* Disabled for now */ 674#if 0 /* Disabled for now */
675 u32 ufreq, freq, ucfg, cfg; 675 u32 ufreq, freq, ucfg, cfg;
676 struct device_node *pcix_node; 676 struct device_node *pcix_node;
677 struct pci_dn *pdn;
677 u8 px_bus, px_devfn; 678 u8 px_bus, px_devfn;
678 struct pci_controller *px_hose; 679 struct pci_controller *px_hose;
679 680
@@ -687,9 +688,10 @@ void __init pmac_check_ht_link(void)
687 printk("No PCI-X bridge found\n"); 688 printk("No PCI-X bridge found\n");
688 return; 689 return;
689 } 690 }
690 px_hose = pcix_node->phb; 691 pdn = pcix_node->data;
691 px_bus = pcix_node->busno; 692 px_hose = pdn->phb;
692 px_devfn = pcix_node->devfn; 693 px_bus = pdn->busno;
694 px_devfn = pdn->devfn;
693 695
694 early_read_config_dword(px_hose, px_bus, px_devfn, 0xc4, &cfg); 696 early_read_config_dword(px_hose, px_bus, px_devfn, 0xc4, &cfg);
695 early_read_config_dword(px_hose, px_bus, px_devfn, 0xcc, &freq); 697 early_read_config_dword(px_hose, px_bus, px_devfn, 0xcc, &freq);
diff --git a/arch/ppc64/kernel/pmac_pci.c b/arch/ppc64/kernel/pmac_pci.c
index 71fe911ad183..dc40a0cad0b4 100644
--- a/arch/ppc64/kernel/pmac_pci.c
+++ b/arch/ppc64/kernel/pmac_pci.c
@@ -242,7 +242,7 @@ static int u3_ht_skip_device(struct pci_controller *hose,
242 else 242 else
243 busdn = hose->arch_data; 243 busdn = hose->arch_data;
244 for (dn = busdn->child; dn; dn = dn->sibling) 244 for (dn = busdn->child; dn; dn = dn->sibling)
245 if (dn->devfn == devfn) 245 if (dn->data && PCI_DN(dn)->devfn == devfn)
246 break; 246 break;
247 if (dn == NULL) 247 if (dn == NULL)
248 return -1; 248 return -1;
@@ -388,7 +388,7 @@ static void __init setup_u3_agp(struct pci_controller* hose)
388 * the reg address cell, we shall fix that by killing struct 388 * the reg address cell, we shall fix that by killing struct
389 * reg_property and using some accessor functions instead 389 * reg_property and using some accessor functions instead
390 */ 390 */
391 hose->first_busno = 0xf0; 391 hose->first_busno = 0xf0;
392 hose->last_busno = 0xff; 392 hose->last_busno = 0xff;
393 has_uninorth = 1; 393 has_uninorth = 1;
394 hose->ops = &macrisc_pci_ops; 394 hose->ops = &macrisc_pci_ops;
@@ -473,7 +473,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
473 continue; 473 continue;
474 } 474 }
475 cur++; 475 cur++;
476 DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n", 476 DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n",
477 cur-1, res->start - 1, cur, res->end + 1); 477 cur-1, res->start - 1, cur, res->end + 1);
478 hose->mem_resources[cur].name = np->full_name; 478 hose->mem_resources[cur].name = np->full_name;
479 hose->mem_resources[cur].flags = IORESOURCE_MEM; 479 hose->mem_resources[cur].flags = IORESOURCE_MEM;
@@ -603,24 +603,24 @@ static int __init add_bridge(struct device_node *dev)
603 char* disp_name; 603 char* disp_name;
604 int *bus_range; 604 int *bus_range;
605 int primary = 1; 605 int primary = 1;
606 struct property *of_prop; 606 struct property *of_prop;
607 607
608 DBG("Adding PCI host bridge %s\n", dev->full_name); 608 DBG("Adding PCI host bridge %s\n", dev->full_name);
609 609
610 bus_range = (int *) get_property(dev, "bus-range", &len); 610 bus_range = (int *) get_property(dev, "bus-range", &len);
611 if (bus_range == NULL || len < 2 * sizeof(int)) { 611 if (bus_range == NULL || len < 2 * sizeof(int)) {
612 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 612 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
613 dev->full_name); 613 dev->full_name);
614 } 614 }
615 615
616 hose = alloc_bootmem(sizeof(struct pci_controller)); 616 hose = alloc_bootmem(sizeof(struct pci_controller));
617 if (hose == NULL) 617 if (hose == NULL)
618 return -ENOMEM; 618 return -ENOMEM;
619 pci_setup_pci_controller(hose); 619 pci_setup_pci_controller(hose);
620 620
621 hose->arch_data = dev; 621 hose->arch_data = dev;
622 hose->first_busno = bus_range ? bus_range[0] : 0; 622 hose->first_busno = bus_range ? bus_range[0] : 0;
623 hose->last_busno = bus_range ? bus_range[1] : 0xff; 623 hose->last_busno = bus_range ? bus_range[1] : 0xff;
624 624
625 of_prop = alloc_bootmem(sizeof(struct property) + 625 of_prop = alloc_bootmem(sizeof(struct property) +
626 sizeof(hose->global_number)); 626 sizeof(hose->global_number));
@@ -634,24 +634,24 @@ static int __init add_bridge(struct device_node *dev)
634 } 634 }
635 635
636 disp_name = NULL; 636 disp_name = NULL;
637 if (device_is_compatible(dev, "u3-agp")) { 637 if (device_is_compatible(dev, "u3-agp")) {
638 setup_u3_agp(hose); 638 setup_u3_agp(hose);
639 disp_name = "U3-AGP"; 639 disp_name = "U3-AGP";
640 primary = 0; 640 primary = 0;
641 } else if (device_is_compatible(dev, "u3-ht")) { 641 } else if (device_is_compatible(dev, "u3-ht")) {
642 setup_u3_ht(hose); 642 setup_u3_ht(hose);
643 disp_name = "U3-HT"; 643 disp_name = "U3-HT";
644 primary = 1; 644 primary = 1;
645 } 645 }
646 printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", 646 printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n",
647 disp_name, hose->first_busno, hose->last_busno); 647 disp_name, hose->first_busno, hose->last_busno);
648 648
649 /* Interpret the "ranges" property */ 649 /* Interpret the "ranges" property */
650 /* This also maps the I/O region and sets isa_io/mem_base */ 650 /* This also maps the I/O region and sets isa_io/mem_base */
651 pmac_process_bridge_OF_ranges(hose, dev, primary); 651 pmac_process_bridge_OF_ranges(hose, dev, primary);
652 652
653 /* Fixup "bus-range" OF property */ 653 /* Fixup "bus-range" OF property */
654 fixup_bus_range(dev); 654 fixup_bus_range(dev);
655 655
656 return 0; 656 return 0;
657} 657}
@@ -746,9 +746,9 @@ void __init pmac_pci_init(void)
746 */ 746 */
747 if (u3_agp) { 747 if (u3_agp) {
748 struct device_node *np = u3_agp->arch_data; 748 struct device_node *np = u3_agp->arch_data;
749 np->busno = 0xf0; 749 PCI_DN(np)->busno = 0xf0;
750 for (np = np->child; np; np = np->sibling) 750 for (np = np->child; np; np = np->sibling)
751 np->busno = 0xf0; 751 PCI_DN(np)->busno = 0xf0;
752 } 752 }
753 753
754 pmac_check_ht_link(); 754 pmac_check_ht_link();
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index e7f695dcd8c8..325426c7bed0 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -477,6 +477,18 @@ static int __init pmac_probe(int platform)
477 return 1; 477 return 1;
478} 478}
479 479
480static int pmac_probe_mode(struct pci_bus *bus)
481{
482 struct device_node *node = bus->sysdata;
483
484 /* We need to use normal PCI probing for the AGP bus,
485 since the device for the AGP bridge isn't in the tree. */
486 if (bus->self == NULL && device_is_compatible(node, "u3-agp"))
487 return PCI_PROBE_NORMAL;
488
489 return PCI_PROBE_DEVTREE;
490}
491
480struct machdep_calls __initdata pmac_md = { 492struct machdep_calls __initdata pmac_md = {
481#ifdef CONFIG_HOTPLUG_CPU 493#ifdef CONFIG_HOTPLUG_CPU
482 .cpu_die = generic_mach_cpu_die, 494 .cpu_die = generic_mach_cpu_die,
@@ -488,6 +500,7 @@ struct machdep_calls __initdata pmac_md = {
488 .init_IRQ = pmac_init_IRQ, 500 .init_IRQ = pmac_init_IRQ,
489 .get_irq = mpic_get_irq, 501 .get_irq = mpic_get_irq,
490 .pcibios_fixup = pmac_pcibios_fixup, 502 .pcibios_fixup = pmac_pcibios_fixup,
503 .pci_probe_mode = pmac_probe_mode,
491 .restart = pmac_restart, 504 .restart = pmac_restart,
492 .power_off = pmac_power_off, 505 .power_off = pmac_power_off,
493 .halt = pmac_halt, 506 .halt = pmac_halt,
diff --git a/arch/ppc64/kernel/pmc.c b/arch/ppc64/kernel/pmc.c
index cdfec7438d01..63d9481c3ec2 100644
--- a/arch/ppc64/kernel/pmc.c
+++ b/arch/ppc64/kernel/pmc.c
@@ -26,7 +26,7 @@ static void dummy_perf(struct pt_regs *regs)
26 mtspr(SPRN_MMCR0, mmcr0); 26 mtspr(SPRN_MMCR0, mmcr0);
27} 27}
28 28
29static spinlock_t pmc_owner_lock = SPIN_LOCK_UNLOCKED; 29static DEFINE_SPINLOCK(pmc_owner_lock);
30static void *pmc_owner_caller; /* mostly for debugging */ 30static void *pmc_owner_caller; /* mostly for debugging */
31perf_irq_t perf_irq = dummy_perf; 31perf_irq_t perf_irq = dummy_perf;
32 32
diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
index 7a7e027653ad..887005358eb1 100644
--- a/arch/ppc64/kernel/process.c
+++ b/arch/ppc64/kernel/process.c
@@ -54,6 +54,7 @@
54#include <asm/sections.h> 54#include <asm/sections.h>
55#include <asm/tlbflush.h> 55#include <asm/tlbflush.h>
56#include <asm/time.h> 56#include <asm/time.h>
57#include <asm/plpar_wrappers.h>
57 58
58#ifndef CONFIG_SMP 59#ifndef CONFIG_SMP
59struct task_struct *last_task_used_math = NULL; 60struct task_struct *last_task_used_math = NULL;
@@ -163,7 +164,30 @@ int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
163 164
164#endif /* CONFIG_ALTIVEC */ 165#endif /* CONFIG_ALTIVEC */
165 166
167static void set_dabr_spr(unsigned long val)
168{
169 mtspr(SPRN_DABR, val);
170}
171
172int set_dabr(unsigned long dabr)
173{
174 int ret = 0;
175
176 if (firmware_has_feature(FW_FEATURE_XDABR)) {
177 /* We want to catch accesses from kernel and userspace */
178 unsigned long flags = H_DABRX_KERNEL|H_DABRX_USER;
179 ret = plpar_set_xdabr(dabr, flags);
180 } else if (firmware_has_feature(FW_FEATURE_DABR)) {
181 ret = plpar_set_dabr(dabr);
182 } else {
183 set_dabr_spr(dabr);
184 }
185
186 return ret;
187}
188
166DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); 189DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
190static DEFINE_PER_CPU(unsigned long, current_dabr);
167 191
168struct task_struct *__switch_to(struct task_struct *prev, 192struct task_struct *__switch_to(struct task_struct *prev,
169 struct task_struct *new) 193 struct task_struct *new)
@@ -198,6 +222,11 @@ struct task_struct *__switch_to(struct task_struct *prev,
198 new->thread.regs->msr |= MSR_VEC; 222 new->thread.regs->msr |= MSR_VEC;
199#endif /* CONFIG_ALTIVEC */ 223#endif /* CONFIG_ALTIVEC */
200 224
225 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) {
226 set_dabr(new->thread.dabr);
227 __get_cpu_var(current_dabr) = new->thread.dabr;
228 }
229
201 flush_tlb_pending(); 230 flush_tlb_pending();
202 231
203 new_thread = &new->thread; 232 new_thread = &new->thread;
@@ -334,6 +363,11 @@ void flush_thread(void)
334 last_task_used_altivec = NULL; 363 last_task_used_altivec = NULL;
335#endif /* CONFIG_ALTIVEC */ 364#endif /* CONFIG_ALTIVEC */
336#endif /* CONFIG_SMP */ 365#endif /* CONFIG_SMP */
366
367 if (current->thread.dabr) {
368 current->thread.dabr = 0;
369 set_dabr(0);
370 }
337} 371}
338 372
339void 373void
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index 6ad5a8467f87..7035deb6de92 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -1733,6 +1733,7 @@ static void of_node_release(struct kref *kref)
1733 kfree(node->intrs); 1733 kfree(node->intrs);
1734 kfree(node->addrs); 1734 kfree(node->addrs);
1735 kfree(node->full_name); 1735 kfree(node->full_name);
1736 kfree(node->data);
1736 kfree(node); 1737 kfree(node);
1737} 1738}
1738 1739
diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c
index 2993f108d96d..85ed3188a91d 100644
--- a/arch/ppc64/kernel/ptrace.c
+++ b/arch/ppc64/kernel/ptrace.c
@@ -17,6 +17,7 @@
17 * this archive for more details. 17 * this archive for more details.
18 */ 18 */
19 19
20#include <linux/config.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/sched.h> 22#include <linux/sched.h>
22#include <linux/mm.h> 23#include <linux/mm.h>
@@ -206,6 +207,19 @@ int sys_ptrace(long request, long pid, long addr, long data)
206 break; 207 break;
207 } 208 }
208 209
210 case PTRACE_GET_DEBUGREG: {
211 ret = -EINVAL;
212 /* We only support one DABR and no IABRS at the moment */
213 if (addr > 0)
214 break;
215 ret = put_user(child->thread.dabr,
216 (unsigned long __user *)data);
217 break;
218 }
219
220 case PTRACE_SET_DEBUGREG:
221 ret = ptrace_set_debugreg(child, addr, data);
222
209 case PTRACE_DETACH: 223 case PTRACE_DETACH:
210 ret = ptrace_detach(child, data); 224 ret = ptrace_detach(child, data);
211 break; 225 break;
@@ -274,6 +288,20 @@ int sys_ptrace(long request, long pid, long addr, long data)
274 break; 288 break;
275 } 289 }
276 290
291#ifdef CONFIG_ALTIVEC
292 case PTRACE_GETVRREGS:
293 /* Get the child altivec register state. */
294 flush_altivec_to_thread(child);
295 ret = get_vrregs((unsigned long __user *)data, child);
296 break;
297
298 case PTRACE_SETVRREGS:
299 /* Set the child altivec register state. */
300 flush_altivec_to_thread(child);
301 ret = set_vrregs(child, (unsigned long __user *)data);
302 break;
303#endif
304
277 default: 305 default:
278 ret = ptrace_request(child, request, addr, data); 306 ret = ptrace_request(child, request, addr, data);
279 break; 307 break;
diff --git a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c
index 16436426c7e2..fb8c22d6084a 100644
--- a/arch/ppc64/kernel/ptrace32.c
+++ b/arch/ppc64/kernel/ptrace32.c
@@ -17,6 +17,7 @@
17 * this archive for more details. 17 * this archive for more details.
18 */ 18 */
19 19
20#include <linux/config.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/sched.h> 22#include <linux/sched.h>
22#include <linux/mm.h> 23#include <linux/mm.h>
@@ -337,6 +338,19 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data)
337 break; 338 break;
338 } 339 }
339 340
341 case PTRACE_GET_DEBUGREG: {
342 ret = -EINVAL;
343 /* We only support one DABR and no IABRS at the moment */
344 if (addr > 0)
345 break;
346 ret = put_user(child->thread.dabr, (u32 __user *)data);
347 break;
348 }
349
350 case PTRACE_SET_DEBUGREG:
351 ret = ptrace_set_debugreg(child, addr, data);
352 break;
353
340 case PTRACE_DETACH: 354 case PTRACE_DETACH:
341 ret = ptrace_detach(child, data); 355 ret = ptrace_detach(child, data);
342 break; 356 break;
@@ -405,9 +419,23 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data)
405 break; 419 break;
406 } 420 }
407 421
408 case PTRACE_GETEVENTMSG: 422 case PTRACE_GETEVENTMSG:
409 ret = put_user(child->ptrace_message, (unsigned int __user *) data); 423 ret = put_user(child->ptrace_message, (unsigned int __user *) data);
410 break; 424 break;
425
426#ifdef CONFIG_ALTIVEC
427 case PTRACE_GETVRREGS:
428 /* Get the child altivec register state. */
429 flush_altivec_to_thread(child);
430 ret = get_vrregs((unsigned long __user *)data, child);
431 break;
432
433 case PTRACE_SETVRREGS:
434 /* Set the child altivec register state. */
435 flush_altivec_to_thread(child);
436 ret = set_vrregs(child, (unsigned long __user *)data);
437 break;
438#endif
411 439
412 default: 440 default:
413 ret = ptrace_request(child, request, addr, data); 441 ret = ptrace_request(child, request, addr, data);
diff --git a/arch/ppc64/kernel/ras.c b/arch/ppc64/kernel/ras.c
index 3c00f7bfc1b5..41b97dc9cc0a 100644
--- a/arch/ppc64/kernel/ras.c
+++ b/arch/ppc64/kernel/ras.c
@@ -59,8 +59,6 @@ char mce_data_buf[RTAS_ERROR_LOG_MAX]
59/* This is true if we are using the firmware NMI handler (typically LPAR) */ 59/* This is true if we are using the firmware NMI handler (typically LPAR) */
60extern int fwnmi_active; 60extern int fwnmi_active;
61 61
62extern void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);
63
64static int ras_get_sensor_state_token; 62static int ras_get_sensor_state_token;
65static int ras_check_exception_token; 63static int ras_check_exception_token;
66 64
diff --git a/arch/ppc64/kernel/rtas_pci.c b/arch/ppc64/kernel/rtas_pci.c
index 1dccadaddd1d..4a9719b48abe 100644
--- a/arch/ppc64/kernel/rtas_pci.c
+++ b/arch/ppc64/kernel/rtas_pci.c
@@ -48,7 +48,7 @@ static int write_pci_config;
48static int ibm_read_pci_config; 48static int ibm_read_pci_config;
49static int ibm_write_pci_config; 49static int ibm_write_pci_config;
50 50
51static int config_access_valid(struct device_node *dn, int where) 51static int config_access_valid(struct pci_dn *dn, int where)
52{ 52{
53 if (where < 256) 53 if (where < 256)
54 return 1; 54 return 1;
@@ -78,15 +78,17 @@ static int rtas_read_config(struct device_node *dn, int where, int size, u32 *va
78 int returnval = -1; 78 int returnval = -1;
79 unsigned long buid, addr; 79 unsigned long buid, addr;
80 int ret; 80 int ret;
81 struct pci_dn *pdn;
81 82
82 if (!dn) 83 if (!dn || !dn->data)
83 return PCIBIOS_DEVICE_NOT_FOUND; 84 return PCIBIOS_DEVICE_NOT_FOUND;
84 if (!config_access_valid(dn, where)) 85 pdn = dn->data;
86 if (!config_access_valid(pdn, where))
85 return PCIBIOS_BAD_REGISTER_NUMBER; 87 return PCIBIOS_BAD_REGISTER_NUMBER;
86 88
87 addr = ((where & 0xf00) << 20) | (dn->busno << 16) | 89 addr = ((where & 0xf00) << 20) | (pdn->busno << 16) |
88 (dn->devfn << 8) | (where & 0xff); 90 (pdn->devfn << 8) | (where & 0xff);
89 buid = dn->phb->buid; 91 buid = pdn->phb->buid;
90 if (buid) { 92 if (buid) {
91 ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, 93 ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval,
92 addr, buid >> 32, buid & 0xffffffff, size); 94 addr, buid >> 32, buid & 0xffffffff, size);
@@ -98,8 +100,8 @@ static int rtas_read_config(struct device_node *dn, int where, int size, u32 *va
98 if (ret) 100 if (ret)
99 return PCIBIOS_DEVICE_NOT_FOUND; 101 return PCIBIOS_DEVICE_NOT_FOUND;
100 102
101 if (returnval == EEH_IO_ERROR_VALUE(size) 103 if (returnval == EEH_IO_ERROR_VALUE(size) &&
102 && eeh_dn_check_failure (dn, NULL)) 104 eeh_dn_check_failure (dn, NULL))
103 return PCIBIOS_DEVICE_NOT_FOUND; 105 return PCIBIOS_DEVICE_NOT_FOUND;
104 106
105 return PCIBIOS_SUCCESSFUL; 107 return PCIBIOS_SUCCESSFUL;
@@ -118,24 +120,28 @@ static int rtas_pci_read_config(struct pci_bus *bus,
118 120
119 /* Search only direct children of the bus */ 121 /* Search only direct children of the bus */
120 for (dn = busdn->child; dn; dn = dn->sibling) 122 for (dn = busdn->child; dn; dn = dn->sibling)
121 if (dn->devfn == devfn && of_device_available(dn)) 123 if (dn->data && PCI_DN(dn)->devfn == devfn
124 && of_device_available(dn))
122 return rtas_read_config(dn, where, size, val); 125 return rtas_read_config(dn, where, size, val);
126
123 return PCIBIOS_DEVICE_NOT_FOUND; 127 return PCIBIOS_DEVICE_NOT_FOUND;
124} 128}
125 129
126static int rtas_write_config(struct device_node *dn, int where, int size, u32 val) 130int rtas_write_config(struct device_node *dn, int where, int size, u32 val)
127{ 131{
128 unsigned long buid, addr; 132 unsigned long buid, addr;
129 int ret; 133 int ret;
134 struct pci_dn *pdn;
130 135
131 if (!dn) 136 if (!dn || !dn->data)
132 return PCIBIOS_DEVICE_NOT_FOUND; 137 return PCIBIOS_DEVICE_NOT_FOUND;
133 if (!config_access_valid(dn, where)) 138 pdn = dn->data;
139 if (!config_access_valid(pdn, where))
134 return PCIBIOS_BAD_REGISTER_NUMBER; 140 return PCIBIOS_BAD_REGISTER_NUMBER;
135 141
136 addr = ((where & 0xf00) << 20) | (dn->busno << 16) | 142 addr = ((where & 0xf00) << 20) | (pdn->busno << 16) |
137 (dn->devfn << 8) | (where & 0xff); 143 (pdn->devfn << 8) | (where & 0xff);
138 buid = dn->phb->buid; 144 buid = pdn->phb->buid;
139 if (buid) { 145 if (buid) {
140 ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, buid >> 32, buid & 0xffffffff, size, (ulong) val); 146 ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, buid >> 32, buid & 0xffffffff, size, (ulong) val);
141 } else { 147 } else {
@@ -161,7 +167,8 @@ static int rtas_pci_write_config(struct pci_bus *bus,
161 167
162 /* Search only direct children of the bus */ 168 /* Search only direct children of the bus */
163 for (dn = busdn->child; dn; dn = dn->sibling) 169 for (dn = busdn->child; dn; dn = dn->sibling)
164 if (dn->devfn == devfn && of_device_available(dn)) 170 if (dn->data && PCI_DN(dn)->devfn == devfn
171 && of_device_available(dn))
165 return rtas_write_config(dn, where, size, val); 172 return rtas_write_config(dn, where, size, val);
166 return PCIBIOS_DEVICE_NOT_FOUND; 173 return PCIBIOS_DEVICE_NOT_FOUND;
167} 174}
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index d0bb68af0ea4..5ac48bd64891 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -1064,8 +1064,6 @@ void __init setup_arch(char **cmdline_p)
1064#define PPC64_LINUX_FUNCTION 0x0f000000 1064#define PPC64_LINUX_FUNCTION 0x0f000000
1065#define PPC64_IPL_MESSAGE 0xc0000000 1065#define PPC64_IPL_MESSAGE 0xc0000000
1066#define PPC64_TERM_MESSAGE 0xb0000000 1066#define PPC64_TERM_MESSAGE 0xb0000000
1067#define PPC64_ATTN_MESSAGE 0xa0000000
1068#define PPC64_DUMP_MESSAGE 0xd0000000
1069 1067
1070static void ppc64_do_msg(unsigned int src, const char *msg) 1068static void ppc64_do_msg(unsigned int src, const char *msg)
1071{ 1069{
@@ -1093,20 +1091,6 @@ void ppc64_terminate_msg(unsigned int src, const char *msg)
1093 printk("[terminate]%04x %s\n", src, msg); 1091 printk("[terminate]%04x %s\n", src, msg);
1094} 1092}
1095 1093
1096/* Print something that needs attention (device error, etc) */
1097void ppc64_attention_msg(unsigned int src, const char *msg)
1098{
1099 ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_ATTN_MESSAGE|src, msg);
1100 printk("[attention]%04x %s\n", src, msg);
1101}
1102
1103/* Print a dump progress message. */
1104void ppc64_dump_msg(unsigned int src, const char *msg)
1105{
1106 ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_DUMP_MESSAGE|src, msg);
1107 printk("[dump]%04x %s\n", src, msg);
1108}
1109
1110/* This should only be called on processor 0 during calibrate decr */ 1094/* This should only be called on processor 0 during calibrate decr */
1111void __init setup_default_decr(void) 1095void __init setup_default_decr(void)
1112{ 1096{
@@ -1283,7 +1267,7 @@ void __init generic_find_legacy_serial_ports(u64 *physport,
1283 1267
1284static struct platform_device serial_device = { 1268static struct platform_device serial_device = {
1285 .name = "serial8250", 1269 .name = "serial8250",
1286 .id = 0, 1270 .id = PLAT8250_DEV_PLATFORM,
1287 .dev = { 1271 .dev = {
1288 .platform_data = serial_ports, 1272 .platform_data = serial_ports,
1289 }, 1273 },
diff --git a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c
index 49a79a55c32d..347112cca3c0 100644
--- a/arch/ppc64/kernel/signal.c
+++ b/arch/ppc64/kernel/signal.c
@@ -550,6 +550,15 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
550 /* Whee! Actually deliver the signal. */ 550 /* Whee! Actually deliver the signal. */
551 if (TRAP(regs) == 0x0C00) 551 if (TRAP(regs) == 0x0C00)
552 syscall_restart(regs, &ka); 552 syscall_restart(regs, &ka);
553
554 /*
555 * Reenable the DABR before delivering the signal to
556 * user space. The DABR will have been cleared if it
557 * triggered inside the kernel.
558 */
559 if (current->thread.dabr)
560 set_dabr(current->thread.dabr);
561
553 return handle_signal(signr, &ka, &info, oldset, regs); 562 return handle_signal(signr, &ka, &info, oldset, regs);
554 } 563 }
555 564
diff --git a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c
index 46f4d6cc7fc9..a8b7a5a56bb4 100644
--- a/arch/ppc64/kernel/signal32.c
+++ b/arch/ppc64/kernel/signal32.c
@@ -970,6 +970,14 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs)
970 newsp = regs->gpr[1]; 970 newsp = regs->gpr[1];
971 newsp &= ~0xfUL; 971 newsp &= ~0xfUL;
972 972
973 /*
974 * Reenable the DABR before delivering the signal to
975 * user space. The DABR will have been cleared if it
976 * triggered inside the kernel.
977 */
978 if (current->thread.dabr)
979 set_dabr(current->thread.dabr);
980
973 /* Whee! Actually deliver the signal. */ 981 /* Whee! Actually deliver the signal. */
974 if (ka.sa.sa_flags & SA_SIGINFO) 982 if (ka.sa.sa_flags & SA_SIGINFO)
975 ret = handle_rt_signal32(signr, &ka, &info, oldset, regs, newsp); 983 ret = handle_rt_signal32(signr, &ka, &info, oldset, regs, newsp);
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 214914a95a50..e93c13458910 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -708,62 +708,9 @@ asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubu
708 compat_ptr(ubuf)); 708 compat_ptr(ubuf));
709} 709}
710 710
711#define IOBASE_BRIDGE_NUMBER 0
712#define IOBASE_MEMORY 1
713#define IOBASE_IO 2
714#define IOBASE_ISA_IO 3
715#define IOBASE_ISA_MEM 4
716
717asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn) 711asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
718{ 712{
719#ifdef CONFIG_PCI 713 return sys_pciconfig_iobase(which, in_bus, in_devfn);
720 struct pci_controller* hose;
721 struct list_head *ln;
722 struct pci_bus *bus = NULL;
723 struct device_node *hose_node;
724
725 /* Argh ! Please forgive me for that hack, but that's the
726 * simplest way to get existing XFree to not lockup on some
727 * G5 machines... So when something asks for bus 0 io base
728 * (bus 0 is HT root), we return the AGP one instead.
729 */
730#ifdef CONFIG_PPC_PMAC
731 if (systemcfg->platform == PLATFORM_POWERMAC &&
732 machine_is_compatible("MacRISC4"))
733 if (in_bus == 0)
734 in_bus = 0xf0;
735#endif /* CONFIG_PPC_PMAC */
736
737 /* That syscall isn't quite compatible with PCI domains, but it's
738 * used on pre-domains setup. We return the first match
739 */
740
741 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
742 bus = pci_bus_b(ln);
743 if (in_bus >= bus->number && in_bus < (bus->number + bus->subordinate))
744 break;
745 bus = NULL;
746 }
747 if (bus == NULL || bus->sysdata == NULL)
748 return -ENODEV;
749
750 hose_node = (struct device_node *)bus->sysdata;
751 hose = hose_node->phb;
752
753 switch (which) {
754 case IOBASE_BRIDGE_NUMBER:
755 return (long)hose->first_busno;
756 case IOBASE_MEMORY:
757 return (long)hose->pci_mem_offset;
758 case IOBASE_IO:
759 return (long)hose->io_base_phys;
760 case IOBASE_ISA_IO:
761 return (long)isa_io_base;
762 case IOBASE_ISA_MEM:
763 return -EINVAL;
764 }
765#endif /* CONFIG_PCI */
766 return -EOPNOTSUPP;
767} 714}
768 715
769 716
diff --git a/arch/ppc64/kernel/syscalls.c b/arch/ppc64/kernel/syscalls.c
index a8cbb202b8cd..05f16633bd2c 100644
--- a/arch/ppc64/kernel/syscalls.c
+++ b/arch/ppc64/kernel/syscalls.c
@@ -46,10 +46,6 @@
46 46
47extern unsigned long wall_jiffies; 47extern unsigned long wall_jiffies;
48 48
49void
50check_bugs(void)
51{
52}
53 49
54/* 50/*
55 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 51 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
diff --git a/arch/ppc64/kernel/u3_iommu.c b/arch/ppc64/kernel/u3_iommu.c
index b6e3bca4102d..41ea09cb9ac7 100644
--- a/arch/ppc64/kernel/u3_iommu.c
+++ b/arch/ppc64/kernel/u3_iommu.c
@@ -276,7 +276,7 @@ static void iommu_dev_setup_u3(struct pci_dev *dev)
276 dn = pci_device_to_OF_node(dev); 276 dn = pci_device_to_OF_node(dev);
277 277
278 if (dn) 278 if (dn)
279 dn->iommu_table = &iommu_table_u3; 279 PCI_DN(dn)->iommu_table = &iommu_table_u3;
280} 280}
281 281
282static void iommu_bus_setup_u3(struct pci_bus *bus) 282static void iommu_bus_setup_u3(struct pci_bus *bus)
@@ -291,7 +291,7 @@ static void iommu_bus_setup_u3(struct pci_bus *bus)
291 dn = pci_bus_to_OF_node(bus); 291 dn = pci_bus_to_OF_node(bus);
292 292
293 if (dn) 293 if (dn)
294 dn->iommu_table = &iommu_table_u3; 294 PCI_DN(dn)->iommu_table = &iommu_table_u3;
295} 295}
296 296
297static void iommu_dev_setup_null(struct pci_dev *dev) { } 297static void iommu_dev_setup_null(struct pci_dev *dev) { }
diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
index ed6766e21f5a..d49c3613c8ec 100644
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -158,14 +158,20 @@ static struct console udbg_console = {
158 .index = -1, 158 .index = -1,
159}; 159};
160 160
161static int early_console_initialized;
162
161void __init disable_early_printk(void) 163void __init disable_early_printk(void)
162{ 164{
165 if (!early_console_initialized)
166 return;
163 unregister_console(&udbg_console); 167 unregister_console(&udbg_console);
168 early_console_initialized = 0;
164} 169}
165 170
166/* called by setup_system */ 171/* called by setup_system */
167void register_early_udbg_console(void) 172void register_early_udbg_console(void)
168{ 173{
174 early_console_initialized = 1;
169 register_console(&udbg_console); 175 register_console(&udbg_console);
170} 176}
171 177
diff --git a/arch/ppc64/kernel/vdso32/cacheflush.S b/arch/ppc64/kernel/vdso32/cacheflush.S
index 0ed7ea721715..c8db993574ee 100644
--- a/arch/ppc64/kernel/vdso32/cacheflush.S
+++ b/arch/ppc64/kernel/vdso32/cacheflush.S
@@ -13,7 +13,7 @@
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
15#include <asm/vdso.h> 15#include <asm/vdso.h>
16#include <asm/offsets.h> 16#include <asm/asm-offsets.h>
17 17
18 .text 18 .text
19 19
diff --git a/arch/ppc64/kernel/vdso32/datapage.S b/arch/ppc64/kernel/vdso32/datapage.S
index 29b6bd32e1f1..4f4eb0be3992 100644
--- a/arch/ppc64/kernel/vdso32/datapage.S
+++ b/arch/ppc64/kernel/vdso32/datapage.S
@@ -12,7 +12,7 @@
12#include <linux/config.h> 12#include <linux/config.h>
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
15#include <asm/offsets.h> 15#include <asm/asm-offsets.h>
16#include <asm/unistd.h> 16#include <asm/unistd.h>
17#include <asm/vdso.h> 17#include <asm/vdso.h>
18 18
diff --git a/arch/ppc64/kernel/vdso32/gettimeofday.S b/arch/ppc64/kernel/vdso32/gettimeofday.S
index 2b48bf1fb109..07f1c1c650c8 100644
--- a/arch/ppc64/kernel/vdso32/gettimeofday.S
+++ b/arch/ppc64/kernel/vdso32/gettimeofday.S
@@ -13,7 +13,7 @@
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
15#include <asm/vdso.h> 15#include <asm/vdso.h>
16#include <asm/offsets.h> 16#include <asm/asm-offsets.h>
17#include <asm/unistd.h> 17#include <asm/unistd.h>
18 18
19 .text 19 .text
diff --git a/arch/ppc64/kernel/vdso64/cacheflush.S b/arch/ppc64/kernel/vdso64/cacheflush.S
index e0725b7b7003..d4a0ad28d534 100644
--- a/arch/ppc64/kernel/vdso64/cacheflush.S
+++ b/arch/ppc64/kernel/vdso64/cacheflush.S
@@ -13,7 +13,7 @@
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
15#include <asm/vdso.h> 15#include <asm/vdso.h>
16#include <asm/offsets.h> 16#include <asm/asm-offsets.h>
17 17
18 .text 18 .text
19 19
diff --git a/arch/ppc64/kernel/vdso64/datapage.S b/arch/ppc64/kernel/vdso64/datapage.S
index 18afd971c9d9..ed6e599ae824 100644
--- a/arch/ppc64/kernel/vdso64/datapage.S
+++ b/arch/ppc64/kernel/vdso64/datapage.S
@@ -12,7 +12,7 @@
12#include <linux/config.h> 12#include <linux/config.h>
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
15#include <asm/offsets.h> 15#include <asm/asm-offsets.h>
16#include <asm/unistd.h> 16#include <asm/unistd.h>
17#include <asm/vdso.h> 17#include <asm/vdso.h>
18 18
diff --git a/arch/ppc64/kernel/vdso64/gettimeofday.S b/arch/ppc64/kernel/vdso64/gettimeofday.S
index ed3f970ff05e..f6df8028570a 100644
--- a/arch/ppc64/kernel/vdso64/gettimeofday.S
+++ b/arch/ppc64/kernel/vdso64/gettimeofday.S
@@ -14,7 +14,7 @@
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/ppc_asm.h> 15#include <asm/ppc_asm.h>
16#include <asm/vdso.h> 16#include <asm/vdso.h>
17#include <asm/offsets.h> 17#include <asm/asm-offsets.h>
18 18
19 .text 19 .text
20/* 20/*
diff --git a/arch/ppc64/kernel/xics.c b/arch/ppc64/kernel/xics.c
index d9dc6f28d050..daf93885dcfa 100644
--- a/arch/ppc64/kernel/xics.c
+++ b/arch/ppc64/kernel/xics.c
@@ -38,7 +38,7 @@ static void xics_mask_and_ack_irq(unsigned int irq);
38static void xics_end_irq(unsigned int irq); 38static void xics_end_irq(unsigned int irq);
39static void xics_set_affinity(unsigned int irq_nr, cpumask_t cpumask); 39static void xics_set_affinity(unsigned int irq_nr, cpumask_t cpumask);
40 40
41struct hw_interrupt_type xics_pic = { 41static struct hw_interrupt_type xics_pic = {
42 .typename = " XICS ", 42 .typename = " XICS ",
43 .startup = xics_startup, 43 .startup = xics_startup,
44 .enable = xics_enable_irq, 44 .enable = xics_enable_irq,
@@ -48,7 +48,7 @@ struct hw_interrupt_type xics_pic = {
48 .set_affinity = xics_set_affinity 48 .set_affinity = xics_set_affinity
49}; 49};
50 50
51struct hw_interrupt_type xics_8259_pic = { 51static struct hw_interrupt_type xics_8259_pic = {
52 .typename = " XICS/8259", 52 .typename = " XICS/8259",
53 .ack = xics_mask_and_ack_irq, 53 .ack = xics_mask_and_ack_irq,
54}; 54};
@@ -89,9 +89,8 @@ static struct xics_ipl __iomem *xics_per_cpu[NR_CPUS];
89static int xics_irq_8259_cascade = 0; 89static int xics_irq_8259_cascade = 0;
90static int xics_irq_8259_cascade_real = 0; 90static int xics_irq_8259_cascade_real = 0;
91static unsigned int default_server = 0xFF; 91static unsigned int default_server = 0xFF;
92/* also referenced in smp.c... */ 92static unsigned int default_distrib_server = 0;
93unsigned int default_distrib_server = 0; 93static unsigned int interrupt_server_size = 8;
94unsigned int interrupt_server_size = 8;
95 94
96/* 95/*
97 * XICS only has a single IPI, so encode the messages per CPU 96 * XICS only has a single IPI, so encode the messages per CPU
@@ -99,10 +98,10 @@ unsigned int interrupt_server_size = 8;
99struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; 98struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
100 99
101/* RTAS service tokens */ 100/* RTAS service tokens */
102int ibm_get_xive; 101static int ibm_get_xive;
103int ibm_set_xive; 102static int ibm_set_xive;
104int ibm_int_on; 103static int ibm_int_on;
105int ibm_int_off; 104static int ibm_int_off;
106 105
107typedef struct { 106typedef struct {
108 int (*xirr_info_get)(int cpu); 107 int (*xirr_info_get)(int cpu);
@@ -284,16 +283,17 @@ static void xics_enable_irq(unsigned int virq)
284 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 283 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server,
285 DEFAULT_PRIORITY); 284 DEFAULT_PRIORITY);
286 if (call_status != 0) { 285 if (call_status != 0) {
287 printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_set_xive " 286 printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_set_xive "
288 "returned %x\n", irq, call_status); 287 "returned %d\n", irq, call_status);
288 printk("set_xive %x, server %x\n", ibm_set_xive, server);
289 return; 289 return;
290 } 290 }
291 291
292 /* Now unmask the interrupt (often a no-op) */ 292 /* Now unmask the interrupt (often a no-op) */
293 call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq); 293 call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq);
294 if (call_status != 0) { 294 if (call_status != 0) {
295 printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_int_on " 295 printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_int_on "
296 "returned %x\n", irq, call_status); 296 "returned %d\n", irq, call_status);
297 return; 297 return;
298 } 298 }
299} 299}
@@ -308,8 +308,8 @@ static void xics_disable_real_irq(unsigned int irq)
308 308
309 call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq); 309 call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq);
310 if (call_status != 0) { 310 if (call_status != 0) {
311 printk(KERN_ERR "xics_disable_real_irq: irq=%d: " 311 printk(KERN_ERR "xics_disable_real_irq: irq=%u: "
312 "ibm_int_off returned %x\n", irq, call_status); 312 "ibm_int_off returned %d\n", irq, call_status);
313 return; 313 return;
314 } 314 }
315 315
@@ -317,8 +317,8 @@ static void xics_disable_real_irq(unsigned int irq)
317 /* Have to set XIVE to 0xff to be able to remove a slot */ 317 /* Have to set XIVE to 0xff to be able to remove a slot */
318 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff); 318 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff);
319 if (call_status != 0) { 319 if (call_status != 0) {
320 printk(KERN_ERR "xics_disable_irq: irq=%d: ibm_set_xive(0xff)" 320 printk(KERN_ERR "xics_disable_irq: irq=%u: ibm_set_xive(0xff)"
321 " returned %x\n", irq, call_status); 321 " returned %d\n", irq, call_status);
322 return; 322 return;
323 } 323 }
324} 324}
@@ -380,7 +380,7 @@ int xics_get_irq(struct pt_regs *regs)
380 if (irq == NO_IRQ) 380 if (irq == NO_IRQ)
381 irq = real_irq_to_virt_slowpath(vec); 381 irq = real_irq_to_virt_slowpath(vec);
382 if (irq == NO_IRQ) { 382 if (irq == NO_IRQ) {
383 printk(KERN_ERR "Interrupt %d (real) is invalid," 383 printk(KERN_ERR "Interrupt %u (real) is invalid,"
384 " disabling it.\n", vec); 384 " disabling it.\n", vec);
385 xics_disable_real_irq(vec); 385 xics_disable_real_irq(vec);
386 } else 386 } else
@@ -622,7 +622,7 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
622 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); 622 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);
623 623
624 if (status) { 624 if (status) {
625 printk(KERN_ERR "xics_set_affinity: irq=%d ibm,get-xive " 625 printk(KERN_ERR "xics_set_affinity: irq=%u ibm,get-xive "
626 "returns %d\n", irq, status); 626 "returns %d\n", irq, status);
627 return; 627 return;
628 } 628 }
@@ -641,7 +641,7 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
641 irq, newmask, xics_status[1]); 641 irq, newmask, xics_status[1]);
642 642
643 if (status) { 643 if (status) {
644 printk(KERN_ERR "xics_set_affinity: irq=%d ibm,set-xive " 644 printk(KERN_ERR "xics_set_affinity: irq=%u ibm,set-xive "
645 "returns %d\n", irq, status); 645 "returns %d\n", irq, status);
646 return; 646 return;
647 } 647 }
@@ -720,7 +720,7 @@ void xics_migrate_irqs_away(void)
720 720
721 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); 721 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);
722 if (status) { 722 if (status) {
723 printk(KERN_ERR "migrate_irqs_away: irq=%d " 723 printk(KERN_ERR "migrate_irqs_away: irq=%u "
724 "ibm,get-xive returns %d\n", 724 "ibm,get-xive returns %d\n",
725 virq, status); 725 virq, status);
726 goto unlock; 726 goto unlock;
@@ -734,7 +734,7 @@ void xics_migrate_irqs_away(void)
734 if (xics_status[0] != get_hard_smp_processor_id(cpu)) 734 if (xics_status[0] != get_hard_smp_processor_id(cpu))
735 goto unlock; 735 goto unlock;
736 736
737 printk(KERN_WARNING "IRQ %d affinity broken off cpu %u\n", 737 printk(KERN_WARNING "IRQ %u affinity broken off cpu %u\n",
738 virq, cpu); 738 virq, cpu);
739 739
740 /* Reset affinity to all cpus */ 740 /* Reset affinity to all cpus */
diff --git a/arch/ppc64/lib/dec_and_lock.c b/arch/ppc64/lib/dec_and_lock.c
index 6e8d8591708c..7b9d4da5cf92 100644
--- a/arch/ppc64/lib/dec_and_lock.c
+++ b/arch/ppc64/lib/dec_and_lock.c
@@ -20,14 +20,7 @@
20 * has a cmpxchg, and where atomic->value is an int holding 20 * has a cmpxchg, and where atomic->value is an int holding
21 * the value of the atomic (i.e. the high bits aren't used 21 * the value of the atomic (i.e. the high bits aren't used
22 * for a lock or anything like that). 22 * for a lock or anything like that).
23 *
24 * N.B. ATOMIC_DEC_AND_LOCK gets defined in include/linux/spinlock.h
25 * if spinlocks are empty and thus atomic_dec_and_lock is defined
26 * to be atomic_dec_and_test - in that case we don't need it
27 * defined here as well.
28 */ 23 */
29
30#ifndef ATOMIC_DEC_AND_LOCK
31int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock) 24int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
32{ 25{
33 int counter; 26 int counter;
@@ -52,4 +45,3 @@ int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
52} 45}
53 46
54EXPORT_SYMBOL(_atomic_dec_and_lock); 47EXPORT_SYMBOL(_atomic_dec_and_lock);
55#endif /* ATOMIC_DEC_AND_LOCK */
diff --git a/arch/ppc64/lib/locks.c b/arch/ppc64/lib/locks.c
index ef70ef91abe2..033643ab69e0 100644
--- a/arch/ppc64/lib/locks.c
+++ b/arch/ppc64/lib/locks.c
@@ -23,12 +23,12 @@
23/* waiting for a spinlock... */ 23/* waiting for a spinlock... */
24#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) 24#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES)
25 25
26void __spin_yield(spinlock_t *lock) 26void __spin_yield(raw_spinlock_t *lock)
27{ 27{
28 unsigned int lock_value, holder_cpu, yield_count; 28 unsigned int lock_value, holder_cpu, yield_count;
29 struct paca_struct *holder_paca; 29 struct paca_struct *holder_paca;
30 30
31 lock_value = lock->lock; 31 lock_value = lock->slock;
32 if (lock_value == 0) 32 if (lock_value == 0)
33 return; 33 return;
34 holder_cpu = lock_value & 0xffff; 34 holder_cpu = lock_value & 0xffff;
@@ -38,7 +38,7 @@ void __spin_yield(spinlock_t *lock)
38 if ((yield_count & 1) == 0) 38 if ((yield_count & 1) == 0)
39 return; /* virtual cpu is currently running */ 39 return; /* virtual cpu is currently running */
40 rmb(); 40 rmb();
41 if (lock->lock != lock_value) 41 if (lock->slock != lock_value)
42 return; /* something has changed */ 42 return; /* something has changed */
43#ifdef CONFIG_PPC_ISERIES 43#ifdef CONFIG_PPC_ISERIES
44 HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 44 HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
@@ -54,7 +54,7 @@ void __spin_yield(spinlock_t *lock)
54 * This turns out to be the same for read and write locks, since 54 * This turns out to be the same for read and write locks, since
55 * we only know the holder if it is write-locked. 55 * we only know the holder if it is write-locked.
56 */ 56 */
57void __rw_yield(rwlock_t *rw) 57void __rw_yield(raw_rwlock_t *rw)
58{ 58{
59 int lock_value; 59 int lock_value;
60 unsigned int holder_cpu, yield_count; 60 unsigned int holder_cpu, yield_count;
@@ -82,9 +82,9 @@ void __rw_yield(rwlock_t *rw)
82} 82}
83#endif 83#endif
84 84
85void spin_unlock_wait(spinlock_t *lock) 85void __raw_spin_unlock_wait(raw_spinlock_t *lock)
86{ 86{
87 while (lock->lock) { 87 while (lock->slock) {
88 HMT_low(); 88 HMT_low();
89 if (SHARED_PROCESSOR) 89 if (SHARED_PROCESSOR)
90 __spin_yield(lock); 90 __spin_yield(lock);
@@ -92,4 +92,4 @@ void spin_unlock_wait(spinlock_t *lock)
92 HMT_medium(); 92 HMT_medium();
93} 93}
94 94
95EXPORT_SYMBOL(spin_unlock_wait); 95EXPORT_SYMBOL(__raw_spin_unlock_wait);
diff --git a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c
index 772f0714a5b7..7fbc68bbb739 100644
--- a/arch/ppc64/mm/fault.c
+++ b/arch/ppc64/mm/fault.c
@@ -77,6 +77,28 @@ static int store_updates_sp(struct pt_regs *regs)
77 return 0; 77 return 0;
78} 78}
79 79
80static void do_dabr(struct pt_regs *regs, unsigned long error_code)
81{
82 siginfo_t info;
83
84 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
85 11, SIGSEGV) == NOTIFY_STOP)
86 return;
87
88 if (debugger_dabr_match(regs))
89 return;
90
91 /* Clear the DABR */
92 set_dabr(0);
93
94 /* Deliver the signal to userspace */
95 info.si_signo = SIGTRAP;
96 info.si_errno = 0;
97 info.si_code = TRAP_HWBKPT;
98 info.si_addr = (void __user *)regs->nip;
99 force_sig_info(SIGTRAP, &info, current);
100}
101
80/* 102/*
81 * The error_code parameter is 103 * The error_code parameter is
82 * - DSISR for a non-SLB data access fault, 104 * - DSISR for a non-SLB data access fault,
@@ -111,12 +133,9 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
111 if (!user_mode(regs) && (address >= TASK_SIZE)) 133 if (!user_mode(regs) && (address >= TASK_SIZE))
112 return SIGSEGV; 134 return SIGSEGV;
113 135
114 if (error_code & DSISR_DABRMATCH) { 136 if (error_code & DSISR_DABRMATCH) {
115 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 137 do_dabr(regs, error_code);
116 11, SIGSEGV) == NOTIFY_STOP) 138 return 0;
117 return 0;
118 if (debugger_dabr_match(regs))
119 return 0;
120 } 139 }
121 140
122 if (in_atomic() || mm == NULL) { 141 if (in_atomic() || mm == NULL) {
diff --git a/arch/ppc64/mm/hash_low.S b/arch/ppc64/mm/hash_low.S
index 35eb49e1b890..ee5a5d36bfa8 100644
--- a/arch/ppc64/mm/hash_low.S
+++ b/arch/ppc64/mm/hash_low.S
@@ -16,7 +16,7 @@
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/types.h> 17#include <asm/types.h>
18#include <asm/ppc_asm.h> 18#include <asm/ppc_asm.h>
19#include <asm/offsets.h> 19#include <asm/asm-offsets.h>
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21 21
22 .text 22 .text
diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
index a14ab87df491..c2157c9c3acb 100644
--- a/arch/ppc64/mm/init.c
+++ b/arch/ppc64/mm/init.c
@@ -554,12 +554,12 @@ void __init do_init_bootmem(void)
554 * present. 554 * present.
555 */ 555 */
556 for (i=0; i < lmb.memory.cnt; i++) 556 for (i=0; i < lmb.memory.cnt; i++)
557 free_bootmem(lmb_start_pfn(&lmb.memory, i), 557 free_bootmem(lmb.memory.region[i].base,
558 lmb_size_bytes(&lmb.memory, i)); 558 lmb_size_bytes(&lmb.memory, i));
559 559
560 /* reserve the sections we're already using */ 560 /* reserve the sections we're already using */
561 for (i=0; i < lmb.reserved.cnt; i++) 561 for (i=0; i < lmb.reserved.cnt; i++)
562 reserve_bootmem(lmb_start_pfn(&lmb.reserved, i), 562 reserve_bootmem(lmb.reserved.region[i].base,
563 lmb_size_bytes(&lmb.reserved, i)); 563 lmb_size_bytes(&lmb.reserved, i));
564 564
565 for (i=0; i < lmb.memory.cnt; i++) 565 for (i=0; i < lmb.memory.cnt; i++)
diff --git a/arch/ppc64/mm/slb_low.S b/arch/ppc64/mm/slb_low.S
index 698d6b9ed6d1..a3a03da503bc 100644
--- a/arch/ppc64/mm/slb_low.S
+++ b/arch/ppc64/mm/slb_low.S
@@ -21,7 +21,7 @@
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/mmu.h> 22#include <asm/mmu.h>
23#include <asm/ppc_asm.h> 23#include <asm/ppc_asm.h>
24#include <asm/offsets.h> 24#include <asm/asm-offsets.h>
25#include <asm/cputable.h> 25#include <asm/cputable.h>
26 26
27/* void slb_allocate(unsigned long ea); 27/* void slb_allocate(unsigned long ea);
diff --git a/arch/ppc64/xmon/privinst.h b/arch/ppc64/xmon/privinst.h
index 183c3e400258..02eb40dac0b3 100644
--- a/arch/ppc64/xmon/privinst.h
+++ b/arch/ppc64/xmon/privinst.h
@@ -46,7 +46,6 @@ GSETSPR(287, pvr)
46GSETSPR(1008, hid0) 46GSETSPR(1008, hid0)
47GSETSPR(1009, hid1) 47GSETSPR(1009, hid1)
48GSETSPR(1010, iabr) 48GSETSPR(1010, iabr)
49GSETSPR(1013, dabr)
50GSETSPR(1023, pir) 49GSETSPR(1023, pir)
51 50
52static inline void store_inst(void *p) 51static inline void store_inst(void *p)
diff --git a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c
index 45908b10acd3..74e63a886a69 100644
--- a/arch/ppc64/xmon/xmon.c
+++ b/arch/ppc64/xmon/xmon.c
@@ -586,6 +586,8 @@ int xmon_dabr_match(struct pt_regs *regs)
586{ 586{
587 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) 587 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
588 return 0; 588 return 0;
589 if (dabr.enabled == 0)
590 return 0;
589 xmon_core(regs, 0); 591 xmon_core(regs, 0);
590 return 1; 592 return 1;
591} 593}
@@ -628,20 +630,6 @@ int xmon_fault_handler(struct pt_regs *regs)
628 return 0; 630 return 0;
629} 631}
630 632
631/* On systems with a hypervisor, we can't set the DABR
632 (data address breakpoint register) directly. */
633static void set_controlled_dabr(unsigned long val)
634{
635#ifdef CONFIG_PPC_PSERIES
636 if (systemcfg->platform == PLATFORM_PSERIES_LPAR) {
637 int rc = plpar_hcall_norets(H_SET_DABR, val);
638 if (rc != H_Success)
639 xmon_printf("Warning: setting DABR failed (%d)\n", rc);
640 } else
641#endif
642 set_dabr(val);
643}
644
645static struct bpt *at_breakpoint(unsigned long pc) 633static struct bpt *at_breakpoint(unsigned long pc)
646{ 634{
647 int i; 635 int i;
@@ -728,7 +716,7 @@ static void insert_bpts(void)
728static void insert_cpu_bpts(void) 716static void insert_cpu_bpts(void)
729{ 717{
730 if (dabr.enabled) 718 if (dabr.enabled)
731 set_controlled_dabr(dabr.address | (dabr.enabled & 7)); 719 set_dabr(dabr.address | (dabr.enabled & 7));
732 if (iabr && cpu_has_feature(CPU_FTR_IABR)) 720 if (iabr && cpu_has_feature(CPU_FTR_IABR))
733 set_iabr(iabr->address 721 set_iabr(iabr->address
734 | (iabr->enabled & (BP_IABR|BP_IABR_TE))); 722 | (iabr->enabled & (BP_IABR|BP_IABR_TE)));
@@ -756,7 +744,7 @@ static void remove_bpts(void)
756 744
757static void remove_cpu_bpts(void) 745static void remove_cpu_bpts(void)
758{ 746{
759 set_controlled_dabr(0); 747 set_dabr(0);
760 if (cpu_has_feature(CPU_FTR_IABR)) 748 if (cpu_has_feature(CPU_FTR_IABR))
761 set_iabr(0); 749 set_iabr(0);
762} 750}
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 3cd8dd25c9d7..98db30481d97 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -19,6 +19,7 @@ CFLAGS += -m31
19AFLAGS += -m31 19AFLAGS += -m31
20UTS_MACHINE := s390 20UTS_MACHINE := s390
21STACK_SIZE := 8192 21STACK_SIZE := 8192
22CHECKFLAGS += -D__s390__
22endif 23endif
23 24
24ifdef CONFIG_ARCH_S390X 25ifdef CONFIG_ARCH_S390X
@@ -28,6 +29,7 @@ CFLAGS += -m64
28AFLAGS += -m64 29AFLAGS += -m64
29UTS_MACHINE := s390x 30UTS_MACHINE := s390x
30STACK_SIZE := 16384 31STACK_SIZE := 16384
32CHECKFLAGS += -D__s390__ -D__s390x__
31endif 33endif
32 34
33cflags-$(CONFIG_MARCH_G5) += $(call cc-option,-march=g5) 35cflags-$(CONFIG_MARCH_G5) += $(call cc-option,-march=g5)
@@ -100,16 +102,6 @@ image: vmlinux
100archclean: 102archclean:
101 $(Q)$(MAKE) $(clean)=$(boot) 103 $(Q)$(MAKE) $(clean)=$(boot)
102 104
103prepare: include/asm-$(ARCH)/offsets.h
104
105arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
106 include/config/MARKER
107
108include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
109 $(call filechk,gen-asm-offsets)
110
111CLEAN_FILES += include/asm-$(ARCH)/offsets.h
112
113# Don't use tabs in echo arguments 105# Don't use tabs in echo arguments
114define archhelp 106define archhelp
115 echo '* image - Kernel image for IPL ($(boot)/image)' 107 echo '* image - Kernel image for IPL ($(boot)/image)'
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 18610cea03a2..ed877d0f27e6 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -678,7 +678,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size
678 ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); 678 ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
679 set_fs(old_fs); 679 set_fs(old_fs);
680 680
681 if (!ret && offset && put_user(of, offset)) 681 if (offset && put_user(of, offset))
682 return -EFAULT; 682 return -EFAULT;
683 683
684 return ret; 684 return ret;
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index cbe7d6a2d02c..58fc7fbcb40e 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -18,7 +18,7 @@
18#include <asm/errno.h> 18#include <asm/errno.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/thread_info.h> 20#include <asm/thread_info.h>
21#include <asm/offsets.h> 21#include <asm/asm-offsets.h>
22#include <asm/unistd.h> 22#include <asm/unistd.h>
23#include <asm/page.h> 23#include <asm/page.h>
24 24
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index fb77b72ab262..d0c9ffaa25db 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -18,7 +18,7 @@
18#include <asm/errno.h> 18#include <asm/errno.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/thread_info.h> 20#include <asm/thread_info.h>
21#include <asm/offsets.h> 21#include <asm/asm-offsets.h>
22#include <asm/unistd.h> 22#include <asm/unistd.h>
23#include <asm/page.h> 23#include <asm/page.h>
24 24
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index 2710e66fefba..55654b6e16dc 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -30,7 +30,7 @@
30#include <linux/config.h> 30#include <linux/config.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/lowcore.h> 32#include <asm/lowcore.h>
33#include <asm/offsets.h> 33#include <asm/asm-offsets.h>
34#include <asm/thread_info.h> 34#include <asm/thread_info.h>
35#include <asm/page.h> 35#include <asm/page.h>
36 36
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 9a8263a153cb..c9ff0404c875 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -30,7 +30,7 @@
30#include <linux/config.h> 30#include <linux/config.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/lowcore.h> 32#include <asm/lowcore.h>
33#include <asm/offsets.h> 33#include <asm/asm-offsets.h>
34#include <asm/thread_info.h> 34#include <asm/thread_info.h>
35#include <asm/page.h> 35#include <asm/page.h>
36 36
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 888b5596c195..2dc14e9c8327 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -36,7 +36,7 @@ _diag44(void)
36} 36}
37 37
38void 38void
39_raw_spin_lock_wait(spinlock_t *lp, unsigned int pc) 39_raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc)
40{ 40{
41 int count = spin_retry; 41 int count = spin_retry;
42 42
@@ -53,7 +53,7 @@ _raw_spin_lock_wait(spinlock_t *lp, unsigned int pc)
53EXPORT_SYMBOL(_raw_spin_lock_wait); 53EXPORT_SYMBOL(_raw_spin_lock_wait);
54 54
55int 55int
56_raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc) 56_raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc)
57{ 57{
58 int count = spin_retry; 58 int count = spin_retry;
59 59
@@ -67,7 +67,7 @@ _raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc)
67EXPORT_SYMBOL(_raw_spin_trylock_retry); 67EXPORT_SYMBOL(_raw_spin_trylock_retry);
68 68
69void 69void
70_raw_read_lock_wait(rwlock_t *rw) 70_raw_read_lock_wait(raw_rwlock_t *rw)
71{ 71{
72 unsigned int old; 72 unsigned int old;
73 int count = spin_retry; 73 int count = spin_retry;
@@ -86,7 +86,7 @@ _raw_read_lock_wait(rwlock_t *rw)
86EXPORT_SYMBOL(_raw_read_lock_wait); 86EXPORT_SYMBOL(_raw_read_lock_wait);
87 87
88int 88int
89_raw_read_trylock_retry(rwlock_t *rw) 89_raw_read_trylock_retry(raw_rwlock_t *rw)
90{ 90{
91 unsigned int old; 91 unsigned int old;
92 int count = spin_retry; 92 int count = spin_retry;
@@ -102,7 +102,7 @@ _raw_read_trylock_retry(rwlock_t *rw)
102EXPORT_SYMBOL(_raw_read_trylock_retry); 102EXPORT_SYMBOL(_raw_read_trylock_retry);
103 103
104void 104void
105_raw_write_lock_wait(rwlock_t *rw) 105_raw_write_lock_wait(raw_rwlock_t *rw)
106{ 106{
107 int count = spin_retry; 107 int count = spin_retry;
108 108
@@ -119,7 +119,7 @@ _raw_write_lock_wait(rwlock_t *rw)
119EXPORT_SYMBOL(_raw_write_lock_wait); 119EXPORT_SYMBOL(_raw_write_lock_wait);
120 120
121int 121int
122_raw_write_trylock_retry(rwlock_t *rw) 122_raw_write_trylock_retry(raw_rwlock_t *rw)
123{ 123{
124 int count = spin_retry; 124 int count = spin_retry;
125 125
diff --git a/arch/s390/lib/uaccess.S b/arch/s390/lib/uaccess.S
index e8029ef42ef2..88fc94fe6488 100644
--- a/arch/s390/lib/uaccess.S
+++ b/arch/s390/lib/uaccess.S
@@ -11,7 +11,7 @@
11 11
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <asm/lowcore.h> 13#include <asm/lowcore.h>
14#include <asm/offsets.h> 14#include <asm/asm-offsets.h>
15 15
16 .text 16 .text
17 .align 4 17 .align 4
diff --git a/arch/s390/lib/uaccess64.S b/arch/s390/lib/uaccess64.S
index 0ca56972f4f0..50219786fc7a 100644
--- a/arch/s390/lib/uaccess64.S
+++ b/arch/s390/lib/uaccess64.S
@@ -11,7 +11,7 @@
11 11
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <asm/lowcore.h> 13#include <asm/lowcore.h>
14#include <asm/offsets.h> 14#include <asm/asm-offsets.h>
15 15
16 .text 16 .text
17 .align 4 17 .align 4
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index b5635635b5ee..4a3049080b41 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -152,10 +152,10 @@ endif
152 @touch $@ 152 @touch $@
153 153
154 154
155prepare: maketools include/asm-sh/.cpu include/asm-sh/.mach 155archprepare: maketools include/asm-sh/.cpu include/asm-sh/.mach
156 156
157.PHONY: maketools FORCE 157.PHONY: maketools FORCE
158maketools: include/asm-sh/asm-offsets.h include/linux/version.h FORCE 158maketools: include/linux/version.h FORCE
159 $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h 159 $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
160 160
161all: zImage 161all: zImage
@@ -168,14 +168,7 @@ compressed: zImage
168archclean: 168archclean:
169 $(Q)$(MAKE) $(clean)=$(boot) 169 $(Q)$(MAKE) $(clean)=$(boot)
170 170
171CLEAN_FILES += include/asm-sh/machtypes.h include/asm-sh/asm-offsets.h 171CLEAN_FILES += include/asm-sh/machtypes.h
172
173arch/sh/kernel/asm-offsets.s: include/asm include/linux/version.h \
174 include/asm-sh/.cpu include/asm-sh/.mach
175
176include/asm-sh/asm-offsets.h: arch/sh/kernel/asm-offsets.s
177 $(call filechk,gen-asm-offsets)
178
179 172
180define archhelp 173define archhelp
181 @echo ' zImage - Compressed kernel image (arch/sh/boot/zImage)' 174 @echo ' zImage - Compressed kernel image (arch/sh/boot/zImage)'
diff --git a/arch/sh/boards/adx/irq_maskreg.c b/arch/sh/boards/adx/irq_maskreg.c
index ca91bb0f1f5c..c0973f8d57ba 100644
--- a/arch/sh/boards/adx/irq_maskreg.c
+++ b/arch/sh/boards/adx/irq_maskreg.c
@@ -37,13 +37,13 @@ static void end_maskreg_irq(unsigned int irq);
37 37
38/* hw_interrupt_type */ 38/* hw_interrupt_type */
39static struct hw_interrupt_type maskreg_irq_type = { 39static struct hw_interrupt_type maskreg_irq_type = {
40 " Mask Register", 40 .typename = " Mask Register",
41 startup_maskreg_irq, 41 .startup = startup_maskreg_irq,
42 shutdown_maskreg_irq, 42 .shutdown = shutdown_maskreg_irq,
43 enable_maskreg_irq, 43 .enable = enable_maskreg_irq,
44 disable_maskreg_irq, 44 .disable = disable_maskreg_irq,
45 mask_and_ack_maskreg, 45 .ack = mask_and_ack_maskreg,
46 end_maskreg_irq 46 .end = end_maskreg_irq
47}; 47};
48 48
49/* actual implementatin */ 49/* actual implementatin */
diff --git a/arch/sh/boards/bigsur/io.c b/arch/sh/boards/bigsur/io.c
index 697144de7419..a9fde781b21a 100644
--- a/arch/sh/boards/bigsur/io.c
+++ b/arch/sh/boards/bigsur/io.c
@@ -37,10 +37,6 @@ static u8 bigsur_iomap_lo_shift[BIGSUR_IOMAP_LO_NMAP];
37static u32 bigsur_iomap_hi[BIGSUR_IOMAP_HI_NMAP]; 37static u32 bigsur_iomap_hi[BIGSUR_IOMAP_HI_NMAP];
38static u8 bigsur_iomap_hi_shift[BIGSUR_IOMAP_HI_NMAP]; 38static u8 bigsur_iomap_hi_shift[BIGSUR_IOMAP_HI_NMAP];
39 39
40#ifndef MAX
41#define MAX(a,b) ((a)>(b)?(a):(b))
42#endif
43
44void bigsur_port_map(u32 baseport, u32 nports, u32 addr, u8 shift) 40void bigsur_port_map(u32 baseport, u32 nports, u32 addr, u8 shift)
45{ 41{
46 u32 port, endport = baseport + nports; 42 u32 port, endport = baseport + nports;
@@ -57,7 +53,7 @@ void bigsur_port_map(u32 baseport, u32 nports, u32 addr, u8 shift)
57 addr += (1<<(BIGSUR_IOMAP_LO_SHIFT)); 53 addr += (1<<(BIGSUR_IOMAP_LO_SHIFT));
58 } 54 }
59 55
60 for (port = MAX(baseport, BIGSUR_IOMAP_LO_THRESH) ; 56 for (port = max_t(u32, baseport, BIGSUR_IOMAP_LO_THRESH);
61 port < endport && port < BIGSUR_IOMAP_HI_THRESH ; 57 port < endport && port < BIGSUR_IOMAP_HI_THRESH ;
62 port += (1<<BIGSUR_IOMAP_HI_SHIFT)) { 58 port += (1<<BIGSUR_IOMAP_HI_SHIFT)) {
63 pr_debug(" maphi[0x%x] = 0x%08x\n", port, addr); 59 pr_debug(" maphi[0x%x] = 0x%08x\n", port, addr);
@@ -80,7 +76,7 @@ void bigsur_port_unmap(u32 baseport, u32 nports)
80 bigsur_iomap_lo[port>>BIGSUR_IOMAP_LO_SHIFT] = 0; 76 bigsur_iomap_lo[port>>BIGSUR_IOMAP_LO_SHIFT] = 0;
81 } 77 }
82 78
83 for (port = MAX(baseport, BIGSUR_IOMAP_LO_THRESH) ; 79 for (port = max_t(u32, baseport, BIGSUR_IOMAP_LO_THRESH);
84 port < endport && port < BIGSUR_IOMAP_HI_THRESH ; 80 port < endport && port < BIGSUR_IOMAP_HI_THRESH ;
85 port += (1<<BIGSUR_IOMAP_HI_SHIFT)) { 81 port += (1<<BIGSUR_IOMAP_HI_SHIFT)) {
86 bigsur_iomap_hi[port>>BIGSUR_IOMAP_HI_SHIFT] = 0; 82 bigsur_iomap_hi[port>>BIGSUR_IOMAP_HI_SHIFT] = 0;
diff --git a/arch/sh/boards/bigsur/irq.c b/arch/sh/boards/bigsur/irq.c
index c188fc32dc9a..6ddbcc77244d 100644
--- a/arch/sh/boards/bigsur/irq.c
+++ b/arch/sh/boards/bigsur/irq.c
@@ -228,23 +228,23 @@ static void shutdown_bigsur_irq(unsigned int irq)
228 228
229/* Define the IRQ structures for the L1 and L2 IRQ types */ 229/* Define the IRQ structures for the L1 and L2 IRQ types */
230static struct hw_interrupt_type bigsur_l1irq_type = { 230static struct hw_interrupt_type bigsur_l1irq_type = {
231 "BigSur-CPLD-Level1-IRQ", 231 .typename = "BigSur-CPLD-Level1-IRQ",
232 startup_bigsur_irq, 232 .startup = startup_bigsur_irq,
233 shutdown_bigsur_irq, 233 .shutdown = shutdown_bigsur_irq,
234 enable_bigsur_l1irq, 234 .enable = enable_bigsur_l1irq,
235 disable_bigsur_l1irq, 235 .disable = disable_bigsur_l1irq,
236 mask_and_ack_bigsur, 236 .ack = mask_and_ack_bigsur,
237 end_bigsur_irq 237 .end = end_bigsur_irq
238}; 238};
239 239
240static struct hw_interrupt_type bigsur_l2irq_type = { 240static struct hw_interrupt_type bigsur_l2irq_type = {
241 "BigSur-CPLD-Level2-IRQ", 241 .typename = "BigSur-CPLD-Level2-IRQ",
242 startup_bigsur_irq, 242 .startup = startup_bigsur_irq,
243 shutdown_bigsur_irq, 243 .shutdown =shutdown_bigsur_irq,
244 enable_bigsur_l2irq, 244 .enable = enable_bigsur_l2irq,
245 disable_bigsur_l2irq, 245 .disable = disable_bigsur_l2irq,
246 mask_and_ack_bigsur, 246 .ack = mask_and_ack_bigsur,
247 end_bigsur_irq 247 .end = end_bigsur_irq
248}; 248};
249 249
250 250
diff --git a/arch/sh/boards/cqreek/irq.c b/arch/sh/boards/cqreek/irq.c
index fa6cfe5a20a7..d1da0d844567 100644
--- a/arch/sh/boards/cqreek/irq.c
+++ b/arch/sh/boards/cqreek/irq.c
@@ -83,13 +83,13 @@ static void shutdown_cqreek_irq(unsigned int irq)
83} 83}
84 84
85static struct hw_interrupt_type cqreek_irq_type = { 85static struct hw_interrupt_type cqreek_irq_type = {
86 "CqREEK-IRQ", 86 .typename = "CqREEK-IRQ",
87 startup_cqreek_irq, 87 .startup = startup_cqreek_irq,
88 shutdown_cqreek_irq, 88 .shutdown = shutdown_cqreek_irq,
89 enable_cqreek_irq, 89 .enable = enable_cqreek_irq,
90 disable_cqreek_irq, 90 .disable = disable_cqreek_irq,
91 mask_and_ack_cqreek, 91 .ack = mask_and_ack_cqreek,
92 end_cqreek_irq 92 .end = end_cqreek_irq
93}; 93};
94 94
95int cqreek_has_ide, cqreek_has_isa; 95int cqreek_has_ide, cqreek_has_isa;
diff --git a/arch/sh/boards/harp/irq.c b/arch/sh/boards/harp/irq.c
index acd58489970f..52d0ba39031b 100644
--- a/arch/sh/boards/harp/irq.c
+++ b/arch/sh/boards/harp/irq.c
@@ -39,13 +39,13 @@ static unsigned int startup_harp_irq(unsigned int irq)
39} 39}
40 40
41static struct hw_interrupt_type harp_irq_type = { 41static struct hw_interrupt_type harp_irq_type = {
42 "Harp-IRQ", 42 .typename = "Harp-IRQ",
43 startup_harp_irq, 43 .startup = startup_harp_irq,
44 shutdown_harp_irq, 44 .shutdown = shutdown_harp_irq,
45 enable_harp_irq, 45 .enable = enable_harp_irq,
46 disable_harp_irq, 46 .disable = disable_harp_irq,
47 mask_and_ack_harp, 47 .ack = mask_and_ack_harp,
48 end_harp_irq 48 .end = end_harp_irq
49}; 49};
50 50
51static void disable_harp_irq(unsigned int irq) 51static void disable_harp_irq(unsigned int irq)
diff --git a/arch/sh/boards/overdrive/irq.c b/arch/sh/boards/overdrive/irq.c
index 23adc6be71e7..715e8feb3a68 100644
--- a/arch/sh/boards/overdrive/irq.c
+++ b/arch/sh/boards/overdrive/irq.c
@@ -86,13 +86,13 @@ static unsigned int startup_od_irq(unsigned int irq)
86} 86}
87 87
88static struct hw_interrupt_type od_irq_type = { 88static struct hw_interrupt_type od_irq_type = {
89 "Overdrive-IRQ", 89 .typename = "Overdrive-IRQ",
90 startup_od_irq, 90 .startup = startup_od_irq,
91 shutdown_od_irq, 91 .shutdown = shutdown_od_irq,
92 enable_od_irq, 92 .enable = enable_od_irq,
93 disable_od_irq, 93 .disable = disable_od_irq,
94 mask_and_ack_od, 94 .ack = mask_and_ack_od,
95 end_od_irq 95 .end = end_od_irq
96}; 96};
97 97
98static void disable_od_irq(unsigned int irq) 98static void disable_od_irq(unsigned int irq)
diff --git a/arch/sh/boards/renesas/hs7751rvoip/irq.c b/arch/sh/boards/renesas/hs7751rvoip/irq.c
index a7921f67a35f..ed4c5b50ea45 100644
--- a/arch/sh/boards/renesas/hs7751rvoip/irq.c
+++ b/arch/sh/boards/renesas/hs7751rvoip/irq.c
@@ -74,13 +74,13 @@ static void end_hs7751rvoip_irq(unsigned int irq)
74} 74}
75 75
76static struct hw_interrupt_type hs7751rvoip_irq_type = { 76static struct hw_interrupt_type hs7751rvoip_irq_type = {
77 "HS7751RVoIP IRQ", 77 .typename = "HS7751RVoIP IRQ",
78 startup_hs7751rvoip_irq, 78 .startup = startup_hs7751rvoip_irq,
79 shutdown_hs7751rvoip_irq, 79 .shutdown = shutdown_hs7751rvoip_irq,
80 enable_hs7751rvoip_irq, 80 .enable = enable_hs7751rvoip_irq,
81 disable_hs7751rvoip_irq, 81 .disable = disable_hs7751rvoip_irq,
82 ack_hs7751rvoip_irq, 82 .ack = ack_hs7751rvoip_irq,
83 end_hs7751rvoip_irq, 83 .end = end_hs7751rvoip_irq,
84}; 84};
85 85
86static void make_hs7751rvoip_irq(unsigned int irq) 86static void make_hs7751rvoip_irq(unsigned int irq)
diff --git a/arch/sh/boards/renesas/rts7751r2d/irq.c b/arch/sh/boards/renesas/rts7751r2d/irq.c
index 95717f4f1e2d..d36c9374aed1 100644
--- a/arch/sh/boards/renesas/rts7751r2d/irq.c
+++ b/arch/sh/boards/renesas/rts7751r2d/irq.c
@@ -88,13 +88,13 @@ static void end_rts7751r2d_irq(unsigned int irq)
88} 88}
89 89
90static struct hw_interrupt_type rts7751r2d_irq_type = { 90static struct hw_interrupt_type rts7751r2d_irq_type = {
91 "RTS7751R2D IRQ", 91 .typename = "RTS7751R2D IRQ",
92 startup_rts7751r2d_irq, 92 .startup = startup_rts7751r2d_irq,
93 shutdown_rts7751r2d_irq, 93 .shutdown = shutdown_rts7751r2d_irq,
94 enable_rts7751r2d_irq, 94 .enable = enable_rts7751r2d_irq,
95 disable_rts7751r2d_irq, 95 .disable = disable_rts7751r2d_irq,
96 ack_rts7751r2d_irq, 96 .ack = ack_rts7751r2d_irq,
97 end_rts7751r2d_irq, 97 .end = end_rts7751r2d_irq,
98}; 98};
99 99
100static void make_rts7751r2d_irq(unsigned int irq) 100static void make_rts7751r2d_irq(unsigned int irq)
diff --git a/arch/sh/boards/renesas/systemh/irq.c b/arch/sh/boards/renesas/systemh/irq.c
index 5675a4134eee..7a2eb10edb56 100644
--- a/arch/sh/boards/renesas/systemh/irq.c
+++ b/arch/sh/boards/renesas/systemh/irq.c
@@ -35,13 +35,13 @@ static void end_systemh_irq(unsigned int irq);
35 35
36/* hw_interrupt_type */ 36/* hw_interrupt_type */
37static struct hw_interrupt_type systemh_irq_type = { 37static struct hw_interrupt_type systemh_irq_type = {
38 " SystemH Register", 38 .typename = " SystemH Register",
39 startup_systemh_irq, 39 .startup = startup_systemh_irq,
40 shutdown_systemh_irq, 40 .shutdown = shutdown_systemh_irq,
41 enable_systemh_irq, 41 .enable = enable_systemh_irq,
42 disable_systemh_irq, 42 .disable = disable_systemh_irq,
43 mask_and_ack_systemh, 43 .ack = mask_and_ack_systemh,
44 end_systemh_irq 44 .end = end_systemh_irq
45}; 45};
46 46
47static unsigned int startup_systemh_irq(unsigned int irq) 47static unsigned int startup_systemh_irq(unsigned int irq)
diff --git a/arch/sh/boards/superh/microdev/irq.c b/arch/sh/boards/superh/microdev/irq.c
index 1298883eca4b..1395c1e65da4 100644
--- a/arch/sh/boards/superh/microdev/irq.c
+++ b/arch/sh/boards/superh/microdev/irq.c
@@ -83,13 +83,13 @@ static unsigned int startup_microdev_irq(unsigned int irq)
83} 83}
84 84
85static struct hw_interrupt_type microdev_irq_type = { 85static struct hw_interrupt_type microdev_irq_type = {
86 "MicroDev-IRQ", 86 .typename = "MicroDev-IRQ",
87 startup_microdev_irq, 87 .startup = startup_microdev_irq,
88 shutdown_microdev_irq, 88 .shutdown = shutdown_microdev_irq,
89 enable_microdev_irq, 89 .enable = enable_microdev_irq,
90 disable_microdev_irq, 90 .disable = disable_microdev_irq,
91 mask_and_ack_microdev, 91 .ack = mask_and_ack_microdev,
92 end_microdev_irq 92 .end = end_microdev_irq
93}; 93};
94 94
95static void disable_microdev_irq(unsigned int irq) 95static void disable_microdev_irq(unsigned int irq)
diff --git a/arch/sh/cchips/hd6446x/hd64465/io.c b/arch/sh/cchips/hd6446x/hd64465/io.c
index 99ac709c550e..84cb142def0b 100644
--- a/arch/sh/cchips/hd6446x/hd64465/io.c
+++ b/arch/sh/cchips/hd6446x/hd64465/io.c
@@ -48,10 +48,6 @@ static unsigned char hd64465_iomap_lo_shift[HD64465_IOMAP_LO_NMAP];
48static unsigned long hd64465_iomap_hi[HD64465_IOMAP_HI_NMAP]; 48static unsigned long hd64465_iomap_hi[HD64465_IOMAP_HI_NMAP];
49static unsigned char hd64465_iomap_hi_shift[HD64465_IOMAP_HI_NMAP]; 49static unsigned char hd64465_iomap_hi_shift[HD64465_IOMAP_HI_NMAP];
50 50
51#ifndef MAX
52#define MAX(a,b) ((a)>(b)?(a):(b))
53#endif
54
55#define PORT2ADDR(x) (sh_mv.mv_isa_port2addr(x)) 51#define PORT2ADDR(x) (sh_mv.mv_isa_port2addr(x))
56 52
57void hd64465_port_map(unsigned short baseport, unsigned int nports, 53void hd64465_port_map(unsigned short baseport, unsigned int nports,
@@ -71,7 +67,7 @@ void hd64465_port_map(unsigned short baseport, unsigned int nports,
71 addr += (1<<(HD64465_IOMAP_LO_SHIFT)); 67 addr += (1<<(HD64465_IOMAP_LO_SHIFT));
72 } 68 }
73 69
74 for (port = MAX(baseport, HD64465_IOMAP_LO_THRESH) ; 70 for (port = max_t(unsigned int, baseport, HD64465_IOMAP_LO_THRESH);
75 port < endport && port < HD64465_IOMAP_HI_THRESH ; 71 port < endport && port < HD64465_IOMAP_HI_THRESH ;
76 port += (1<<HD64465_IOMAP_HI_SHIFT)) { 72 port += (1<<HD64465_IOMAP_HI_SHIFT)) {
77 DPRINTK(" maphi[0x%x] = 0x%08lx\n", port, addr); 73 DPRINTK(" maphi[0x%x] = 0x%08lx\n", port, addr);
@@ -95,7 +91,7 @@ void hd64465_port_unmap(unsigned short baseport, unsigned int nports)
95 hd64465_iomap_lo[port>>HD64465_IOMAP_LO_SHIFT] = 0; 91 hd64465_iomap_lo[port>>HD64465_IOMAP_LO_SHIFT] = 0;
96 } 92 }
97 93
98 for (port = MAX(baseport, HD64465_IOMAP_LO_THRESH) ; 94 for (port = max_t(unsigned int, baseport, HD64465_IOMAP_LO_THRESH);
99 port < endport && port < HD64465_IOMAP_HI_THRESH ; 95 port < endport && port < HD64465_IOMAP_HI_THRESH ;
100 port += (1<<HD64465_IOMAP_HI_SHIFT)) { 96 port += (1<<HD64465_IOMAP_HI_SHIFT)) {
101 hd64465_iomap_hi[port>>HD64465_IOMAP_HI_SHIFT] = 0; 97 hd64465_iomap_hi[port>>HD64465_IOMAP_HI_SHIFT] = 0;
diff --git a/arch/sh/cchips/voyagergx/irq.c b/arch/sh/cchips/voyagergx/irq.c
index 3079234cb65b..1b6ac523b458 100644
--- a/arch/sh/cchips/voyagergx/irq.c
+++ b/arch/sh/cchips/voyagergx/irq.c
@@ -87,13 +87,13 @@ static void shutdown_voyagergx_irq(unsigned int irq)
87} 87}
88 88
89static struct hw_interrupt_type voyagergx_irq_type = { 89static struct hw_interrupt_type voyagergx_irq_type = {
90 "VOYAGERGX-IRQ", 90 .typename = "VOYAGERGX-IRQ",
91 startup_voyagergx_irq, 91 .startup = startup_voyagergx_irq,
92 shutdown_voyagergx_irq, 92 .shutdown = shutdown_voyagergx_irq,
93 enable_voyagergx_irq, 93 .enable = enable_voyagergx_irq,
94 disable_voyagergx_irq, 94 .disable = disable_voyagergx_irq,
95 mask_and_ack_voyagergx, 95 .ack = mask_and_ack_voyagergx,
96 end_voyagergx_irq, 96 .end = end_voyagergx_irq,
97}; 97};
98 98
99static irqreturn_t voyagergx_interrupt(int irq, void *dev_id, struct pt_regs *regs) 99static irqreturn_t voyagergx_interrupt(int irq, void *dev_id, struct pt_regs *regs)
diff --git a/arch/sh/kernel/cpu/irq_imask.c b/arch/sh/kernel/cpu/irq_imask.c
index f76901e732fb..a963d00a971e 100644
--- a/arch/sh/kernel/cpu/irq_imask.c
+++ b/arch/sh/kernel/cpu/irq_imask.c
@@ -46,13 +46,13 @@ static unsigned int startup_imask_irq(unsigned int irq)
46} 46}
47 47
48static struct hw_interrupt_type imask_irq_type = { 48static struct hw_interrupt_type imask_irq_type = {
49 "SR.IMASK", 49 .typename = "SR.IMASK",
50 startup_imask_irq, 50 .startup = startup_imask_irq,
51 shutdown_imask_irq, 51 .shutdown = shutdown_imask_irq,
52 enable_imask_irq, 52 .enable = enable_imask_irq,
53 disable_imask_irq, 53 .disable = disable_imask_irq,
54 mask_and_ack_imask, 54 .ack = mask_and_ack_imask,
55 end_imask_irq 55 .end = end_imask_irq
56}; 56};
57 57
58void static inline set_interrupt_registers(int ip) 58void static inline set_interrupt_registers(int ip)
diff --git a/arch/sh/kernel/cpu/irq_ipr.c b/arch/sh/kernel/cpu/irq_ipr.c
index 7ea3d2d030e5..71f92096132b 100644
--- a/arch/sh/kernel/cpu/irq_ipr.c
+++ b/arch/sh/kernel/cpu/irq_ipr.c
@@ -48,13 +48,13 @@ static unsigned int startup_ipr_irq(unsigned int irq)
48} 48}
49 49
50static struct hw_interrupt_type ipr_irq_type = { 50static struct hw_interrupt_type ipr_irq_type = {
51 "IPR-IRQ", 51 .typename = "IPR-IRQ",
52 startup_ipr_irq, 52 .startup = startup_ipr_irq,
53 shutdown_ipr_irq, 53 .shutdown = shutdown_ipr_irq,
54 enable_ipr_irq, 54 .enable = enable_ipr_irq,
55 disable_ipr_irq, 55 .disable = disable_ipr_irq,
56 mask_and_ack_ipr, 56 .ack = mask_and_ack_ipr,
57 end_ipr_irq 57 .end = end_ipr_irq
58}; 58};
59 59
60static void disable_ipr_irq(unsigned int irq) 60static void disable_ipr_irq(unsigned int irq)
@@ -142,13 +142,13 @@ static unsigned int startup_pint_irq(unsigned int irq)
142} 142}
143 143
144static struct hw_interrupt_type pint_irq_type = { 144static struct hw_interrupt_type pint_irq_type = {
145 "PINT-IRQ", 145 .typename = "PINT-IRQ",
146 startup_pint_irq, 146 .startup = startup_pint_irq,
147 shutdown_pint_irq, 147 .shutdown = shutdown_pint_irq,
148 enable_pint_irq, 148 .enable = enable_pint_irq,
149 disable_pint_irq, 149 .disable = disable_pint_irq,
150 mask_and_ack_pint, 150 .ack = mask_and_ack_pint,
151 end_pint_irq 151 .end = end_pint_irq
152}; 152};
153 153
154static void disable_pint_irq(unsigned int irq) 154static void disable_pint_irq(unsigned int irq)
diff --git a/arch/sh/kernel/cpu/sh4/irq_intc2.c b/arch/sh/kernel/cpu/sh4/irq_intc2.c
index 099ebbf89745..f6b16ba01932 100644
--- a/arch/sh/kernel/cpu/sh4/irq_intc2.c
+++ b/arch/sh/kernel/cpu/sh4/irq_intc2.c
@@ -48,13 +48,13 @@ static unsigned int startup_intc2_irq(unsigned int irq)
48} 48}
49 49
50static struct hw_interrupt_type intc2_irq_type = { 50static struct hw_interrupt_type intc2_irq_type = {
51 "INTC2-IRQ", 51 .typename = "INTC2-IRQ",
52 startup_intc2_irq, 52 .startup = startup_intc2_irq,
53 shutdown_intc2_irq, 53 .shutdown = shutdown_intc2_irq,
54 enable_intc2_irq, 54 .enable = enable_intc2_irq,
55 disable_intc2_irq, 55 .disable = disable_intc2_irq,
56 mask_and_ack_intc2, 56 .ack = mask_and_ack_intc2,
57 end_intc2_irq 57 .end = end_intc2_irq
58}; 58};
59 59
60static void disable_intc2_irq(unsigned int irq) 60static void disable_intc2_irq(unsigned int irq)
diff --git a/arch/sh64/Makefile b/arch/sh64/Makefile
index b4fd8e13fea9..8ca57ffa2b70 100644
--- a/arch/sh64/Makefile
+++ b/arch/sh64/Makefile
@@ -73,11 +73,7 @@ compressed: zImage
73archclean: 73archclean:
74 $(Q)$(MAKE) $(clean)=$(boot) 74 $(Q)$(MAKE) $(clean)=$(boot)
75 75
76prepare: include/asm-$(ARCH)/asm-offsets.h arch/$(ARCH)/lib/syscalltab.h 76archprepare: arch/$(ARCH)/lib/syscalltab.h
77
78include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \
79 include/asm include/linux/version.h
80 $(call filechk,gen-asm-offsets)
81 77
82define filechk_gen-syscalltab 78define filechk_gen-syscalltab
83 (set -e; \ 79 (set -e; \
@@ -108,7 +104,7 @@ endef
108arch/$(ARCH)/lib/syscalltab.h: arch/sh64/kernel/syscalls.S 104arch/$(ARCH)/lib/syscalltab.h: arch/sh64/kernel/syscalls.S
109 $(call filechk,gen-syscalltab) 105 $(call filechk,gen-syscalltab)
110 106
111CLEAN_FILES += include/asm-$(ARCH)/asm-offsets.h arch/$(ARCH)/lib/syscalltab.h 107CLEAN_FILES += arch/$(ARCH)/lib/syscalltab.h
112 108
113define archhelp 109define archhelp
114 @echo ' zImage - Compressed kernel image (arch/sh64/boot/zImage)' 110 @echo ' zImage - Compressed kernel image (arch/sh64/boot/zImage)'
diff --git a/arch/sh64/kernel/irq_intc.c b/arch/sh64/kernel/irq_intc.c
index 43f88f3a78b0..fc99bf4e362c 100644
--- a/arch/sh64/kernel/irq_intc.c
+++ b/arch/sh64/kernel/irq_intc.c
@@ -107,13 +107,13 @@ static void mask_and_ack_intc(unsigned int);
107static void end_intc_irq(unsigned int irq); 107static void end_intc_irq(unsigned int irq);
108 108
109static struct hw_interrupt_type intc_irq_type = { 109static struct hw_interrupt_type intc_irq_type = {
110 "INTC", 110 .typename = "INTC",
111 startup_intc_irq, 111 .startup = startup_intc_irq,
112 shutdown_intc_irq, 112 .shutdown = shutdown_intc_irq,
113 enable_intc_irq, 113 .enable = enable_intc_irq,
114 disable_intc_irq, 114 .disable = disable_intc_irq,
115 mask_and_ack_intc, 115 .ack = mask_and_ack_intc,
116 end_intc_irq 116 .end = end_intc_irq
117}; 117};
118 118
119static int irlm; /* IRL mode */ 119static int irlm; /* IRL mode */
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 7b3bbaf083a6..dea48f6cff38 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -59,17 +59,7 @@ image tftpboot.img: vmlinux
59archclean: 59archclean:
60 $(Q)$(MAKE) $(clean)=$(boot) 60 $(Q)$(MAKE) $(clean)=$(boot)
61 61
62prepare: include/asm-$(ARCH)/asm_offsets.h 62CLEAN_FILES += arch/$(ARCH)/boot/System.map
63
64arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
65 include/config/MARKER
66
67include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
68 $(call filechk,gen-asm-offsets)
69
70CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h \
71 arch/$(ARCH)/kernel/asm-offsets.s \
72 arch/$(ARCH)/boot/System.map
73 63
74# Don't use tabs in echo arguments. 64# Don't use tabs in echo arguments.
75define archhelp 65define archhelp
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index b448166f5da9..03ecb4e4614e 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -17,7 +17,7 @@
17#include <asm/kgdb.h> 17#include <asm/kgdb.h>
18#include <asm/contregs.h> 18#include <asm/contregs.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/asm_offsets.h> 20#include <asm/asm-offsets.h>
21#include <asm/psr.h> 21#include <asm/psr.h>
22#include <asm/vaddrs.h> 22#include <asm/vaddrs.h>
23#include <asm/memreg.h> 23#include <asm/memreg.h>
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 7931d6f92819..787d5f1347ec 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -10,6 +10,7 @@
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/ctype.h>
13 14
14void *module_alloc(unsigned long size) 15void *module_alloc(unsigned long size)
15{ 16{
@@ -37,7 +38,7 @@ void module_free(struct module *mod, void *module_region)
37} 38}
38 39
39/* Make generic code ignore STT_REGISTER dummy undefined symbols, 40/* Make generic code ignore STT_REGISTER dummy undefined symbols,
40 * and replace references to .func with func as in ppc64's dedotify. 41 * and replace references to .func with _Func
41 */ 42 */
42int module_frob_arch_sections(Elf_Ehdr *hdr, 43int module_frob_arch_sections(Elf_Ehdr *hdr,
43 Elf_Shdr *sechdrs, 44 Elf_Shdr *sechdrs,
@@ -64,8 +65,10 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
64 sym[i].st_shndx = SHN_ABS; 65 sym[i].st_shndx = SHN_ABS;
65 else { 66 else {
66 char *name = strtab + sym[i].st_name; 67 char *name = strtab + sym[i].st_name;
67 if (name[0] == '.') 68 if (name[0] == '.') {
68 memmove(name, name+1, strlen(name)); 69 name[0] = '_';
70 name[1] = toupper(name[1]);
71 }
69 } 72 }
70 } 73 }
71 } 74 }
diff --git a/arch/sparc/kernel/sclow.S b/arch/sparc/kernel/sclow.S
index 3a867fc19927..136e37c53d49 100644
--- a/arch/sparc/kernel/sclow.S
+++ b/arch/sparc/kernel/sclow.S
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10#include <asm/asm_offsets.h> 10#include <asm/asm-offsets.h>
11#include <asm/errno.h> 11#include <asm/errno.h>
12#include <asm/winmacro.h> 12#include <asm/winmacro.h>
13#include <asm/thread_info.h> 13#include <asm/thread_info.h>
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 5d974a2b735a..1c8fd0fd9305 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -97,34 +97,17 @@ extern void ___rw_write_enter(void);
97/* Alias functions whose names begin with "." and export the aliases. 97/* Alias functions whose names begin with "." and export the aliases.
98 * The module references will be fixed up by module_frob_arch_sections. 98 * The module references will be fixed up by module_frob_arch_sections.
99 */ 99 */
100#define DOT_ALIAS2(__ret, __x, __arg1, __arg2) \ 100extern int _Div(int, int);
101 extern __ret __x(__arg1, __arg2); \ 101extern int _Mul(int, int);
102 asm(".weak " #__x);\ 102extern int _Rem(int, int);
103 asm(#__x "=." #__x); 103extern unsigned _Udiv(unsigned, unsigned);
104 104extern unsigned _Umul(unsigned, unsigned);
105DOT_ALIAS2(int, div, int, int) 105extern unsigned _Urem(unsigned, unsigned);
106DOT_ALIAS2(int, mul, int, int)
107DOT_ALIAS2(int, rem, int, int)
108DOT_ALIAS2(unsigned, udiv, unsigned, unsigned)
109DOT_ALIAS2(unsigned, umul, unsigned, unsigned)
110DOT_ALIAS2(unsigned, urem, unsigned, unsigned)
111
112#undef DOT_ALIAS2
113 106
114/* used by various drivers */ 107/* used by various drivers */
115EXPORT_SYMBOL(sparc_cpu_model); 108EXPORT_SYMBOL(sparc_cpu_model);
116EXPORT_SYMBOL(kernel_thread); 109EXPORT_SYMBOL(kernel_thread);
117#ifdef CONFIG_DEBUG_SPINLOCK
118#ifdef CONFIG_SMP 110#ifdef CONFIG_SMP
119EXPORT_SYMBOL(_do_spin_lock);
120EXPORT_SYMBOL(_do_spin_unlock);
121EXPORT_SYMBOL(_spin_trylock);
122EXPORT_SYMBOL(_do_read_lock);
123EXPORT_SYMBOL(_do_read_unlock);
124EXPORT_SYMBOL(_do_write_lock);
125EXPORT_SYMBOL(_do_write_unlock);
126#endif
127#else
128// XXX find what uses (or used) these. 111// XXX find what uses (or used) these.
129EXPORT_SYMBOL(___rw_read_enter); 112EXPORT_SYMBOL(___rw_read_enter);
130EXPORT_SYMBOL(___rw_read_exit); 113EXPORT_SYMBOL(___rw_read_exit);
@@ -330,12 +313,12 @@ EXPORT_SYMBOL(__lshrdi3);
330EXPORT_SYMBOL(__muldi3); 313EXPORT_SYMBOL(__muldi3);
331EXPORT_SYMBOL(__divdi3); 314EXPORT_SYMBOL(__divdi3);
332 315
333EXPORT_SYMBOL(rem); 316EXPORT_SYMBOL(_Rem);
334EXPORT_SYMBOL(urem); 317EXPORT_SYMBOL(_Urem);
335EXPORT_SYMBOL(mul); 318EXPORT_SYMBOL(_Mul);
336EXPORT_SYMBOL(umul); 319EXPORT_SYMBOL(_Umul);
337EXPORT_SYMBOL(div); 320EXPORT_SYMBOL(_Div);
338EXPORT_SYMBOL(udiv); 321EXPORT_SYMBOL(_Udiv);
339 322
340#ifdef CONFIG_DEBUG_BUGVERBOSE 323#ifdef CONFIG_DEBUG_BUGVERBOSE
341EXPORT_SYMBOL(do_BUG); 324EXPORT_SYMBOL(do_BUG);
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 2296ff9dc47a..fa5006946062 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -9,5 +9,3 @@ lib-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \
9 strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \ 9 strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \
10 copy_user.o locks.o atomic.o atomic32.o bitops.o \ 10 copy_user.o locks.o atomic.o atomic32.o bitops.o \
11 lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o 11 lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o
12
13lib-$(CONFIG_DEBUG_SPINLOCK) += debuglocks.o
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index 19724c5800a7..2e64e8c3e8e5 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -20,7 +20,7 @@ spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
20 20
21#else /* SMP */ 21#else /* SMP */
22 22
23static spinlock_t dummy = SPIN_LOCK_UNLOCKED; 23static DEFINE_SPINLOCK(dummy);
24#define ATOMIC_HASH_SIZE 1 24#define ATOMIC_HASH_SIZE 1
25#define ATOMIC_HASH(a) (&dummy) 25#define ATOMIC_HASH(a) (&dummy)
26 26
diff --git a/arch/sparc/lib/debuglocks.c b/arch/sparc/lib/debuglocks.c
deleted file mode 100644
index fb182352782c..000000000000
--- a/arch/sparc/lib/debuglocks.c
+++ /dev/null
@@ -1,202 +0,0 @@
1/* $Id: debuglocks.c,v 1.11 2001/09/20 00:35:31 davem Exp $
2 * debuglocks.c: Debugging versions of SMP locking primitives.
3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1998-99 Anton Blanchard (anton@progsoc.uts.edu.au)
6 */
7
8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/threads.h> /* For NR_CPUS */
11#include <linux/spinlock.h>
12#include <asm/psr.h>
13#include <asm/system.h>
14
15#ifdef CONFIG_SMP
16
17/* Some notes on how these debugging routines work. When a lock is acquired
18 * an extra debugging member lock->owner_pc is set to the caller of the lock
19 * acquisition routine. Right before releasing a lock, the debugging program
20 * counter is cleared to zero.
21 *
22 * Furthermore, since PC's are 4 byte aligned on Sparc, we stuff the CPU
23 * number of the owner in the lowest two bits.
24 */
25
26#define STORE_CALLER(A) __asm__ __volatile__("mov %%i7, %0" : "=r" (A));
27
28static inline void show(char *str, spinlock_t *lock, unsigned long caller)
29{
30 int cpu = smp_processor_id();
31
32 printk("%s(%p) CPU#%d stuck at %08lx, owner PC(%08lx):CPU(%lx)\n",str,
33 lock, cpu, caller, lock->owner_pc & ~3, lock->owner_pc & 3);
34}
35
36static inline void show_read(char *str, rwlock_t *lock, unsigned long caller)
37{
38 int cpu = smp_processor_id();
39
40 printk("%s(%p) CPU#%d stuck at %08lx, owner PC(%08lx):CPU(%lx)\n", str,
41 lock, cpu, caller, lock->owner_pc & ~3, lock->owner_pc & 3);
42}
43
44static inline void show_write(char *str, rwlock_t *lock, unsigned long caller)
45{
46 int cpu = smp_processor_id();
47 int i;
48
49 printk("%s(%p) CPU#%d stuck at %08lx, owner PC(%08lx):CPU(%lx)", str,
50 lock, cpu, caller, lock->owner_pc & ~3, lock->owner_pc & 3);
51
52 for(i = 0; i < NR_CPUS; i++)
53 printk(" reader[%d]=%08lx", i, lock->reader_pc[i]);
54
55 printk("\n");
56}
57
58#undef INIT_STUCK
59#define INIT_STUCK 100000000
60
61void _do_spin_lock(spinlock_t *lock, char *str)
62{
63 unsigned long caller;
64 unsigned long val;
65 int cpu = smp_processor_id();
66 int stuck = INIT_STUCK;
67
68 STORE_CALLER(caller);
69
70again:
71 __asm__ __volatile__("ldstub [%1], %0" : "=r" (val) : "r" (&(lock->lock)));
72 if(val) {
73 while(lock->lock) {
74 if (!--stuck) {
75 show(str, lock, caller);
76 stuck = INIT_STUCK;
77 }
78 barrier();
79 }
80 goto again;
81 }
82 lock->owner_pc = (cpu & 3) | (caller & ~3);
83}
84
85int _spin_trylock(spinlock_t *lock)
86{
87 unsigned long val;
88 unsigned long caller;
89 int cpu = smp_processor_id();
90
91 STORE_CALLER(caller);
92
93 __asm__ __volatile__("ldstub [%1], %0" : "=r" (val) : "r" (&(lock->lock)));
94 if(!val) {
95 /* We got it, record our identity for debugging. */
96 lock->owner_pc = (cpu & 3) | (caller & ~3);
97 }
98 return val == 0;
99}
100
101void _do_spin_unlock(spinlock_t *lock)
102{
103 lock->owner_pc = 0;
104 barrier();
105 lock->lock = 0;
106}
107
108void _do_read_lock(rwlock_t *rw, char *str)
109{
110 unsigned long caller;
111 unsigned long val;
112 int cpu = smp_processor_id();
113 int stuck = INIT_STUCK;
114
115 STORE_CALLER(caller);
116
117wlock_again:
118 __asm__ __volatile__("ldstub [%1 + 3], %0" : "=r" (val) : "r" (&(rw->lock)));
119 if(val) {
120 while(rw->lock & 0xff) {
121 if (!--stuck) {
122 show_read(str, rw, caller);
123 stuck = INIT_STUCK;
124 }
125 barrier();
126 }
127 goto wlock_again;
128 }
129
130 rw->reader_pc[cpu] = caller;
131 barrier();
132 rw->lock++;
133}
134
135void _do_read_unlock(rwlock_t *rw, char *str)
136{
137 unsigned long caller;
138 unsigned long val;
139 int cpu = smp_processor_id();
140 int stuck = INIT_STUCK;
141
142 STORE_CALLER(caller);
143
144wlock_again:
145 __asm__ __volatile__("ldstub [%1 + 3], %0" : "=r" (val) : "r" (&(rw->lock)));
146 if(val) {
147 while(rw->lock & 0xff) {
148 if (!--stuck) {
149 show_read(str, rw, caller);
150 stuck = INIT_STUCK;
151 }
152 barrier();
153 }
154 goto wlock_again;
155 }
156
157 rw->reader_pc[cpu] = 0;
158 barrier();
159 rw->lock -= 0x1ff;
160}
161
162void _do_write_lock(rwlock_t *rw, char *str)
163{
164 unsigned long caller;
165 unsigned long val;
166 int cpu = smp_processor_id();
167 int stuck = INIT_STUCK;
168
169 STORE_CALLER(caller);
170
171wlock_again:
172 __asm__ __volatile__("ldstub [%1 + 3], %0" : "=r" (val) : "r" (&(rw->lock)));
173 if(val) {
174wlock_wait:
175 while(rw->lock) {
176 if (!--stuck) {
177 show_write(str, rw, caller);
178 stuck = INIT_STUCK;
179 }
180 barrier();
181 }
182 goto wlock_again;
183 }
184
185 if (rw->lock & ~0xff) {
186 *(((unsigned char *)&rw->lock)+3) = 0;
187 barrier();
188 goto wlock_wait;
189 }
190
191 barrier();
192 rw->owner_pc = (cpu & 3) | (caller & ~3);
193}
194
195void _do_write_unlock(rwlock_t *rw)
196{
197 rw->owner_pc = 0;
198 barrier();
199 rw->lock = 0;
200}
201
202#endif /* SMP */
diff --git a/arch/sparc/lib/mul.S b/arch/sparc/lib/mul.S
index 83dffbc2f62f..da693560d878 100644
--- a/arch/sparc/lib/mul.S
+++ b/arch/sparc/lib/mul.S
@@ -16,7 +16,9 @@
16 */ 16 */
17 17
18 .globl .mul 18 .globl .mul
19 .globl _Mul
19.mul: 20.mul:
21_Mul: /* needed for export */
20 mov %o0, %y ! multiplier -> Y 22 mov %o0, %y ! multiplier -> Y
21 andncc %o0, 0xfff, %g0 ! test bits 12..31 23 andncc %o0, 0xfff, %g0 ! test bits 12..31
22 be Lmul_shortway ! if zero, can do it the short way 24 be Lmul_shortway ! if zero, can do it the short way
diff --git a/arch/sparc/lib/rem.S b/arch/sparc/lib/rem.S
index 44508148d055..bf015a90d07e 100644
--- a/arch/sparc/lib/rem.S
+++ b/arch/sparc/lib/rem.S
@@ -43,7 +43,9 @@
43 43
44 44
45 .globl .rem 45 .globl .rem
46 .globl _Rem
46.rem: 47.rem:
48_Rem: /* needed for export */
47 ! compute sign of result; if neither is negative, no problem 49 ! compute sign of result; if neither is negative, no problem
48 orcc %o1, %o0, %g0 ! either negative? 50 orcc %o1, %o0, %g0 ! either negative?
49 bge 2f ! no, go do the divide 51 bge 2f ! no, go do the divide
diff --git a/arch/sparc/lib/sdiv.S b/arch/sparc/lib/sdiv.S
index e0ad80b6f63d..af9451629d0b 100644
--- a/arch/sparc/lib/sdiv.S
+++ b/arch/sparc/lib/sdiv.S
@@ -43,7 +43,9 @@
43 43
44 44
45 .globl .div 45 .globl .div
46 .globl _Div
46.div: 47.div:
48_Div: /* needed for export */
47 ! compute sign of result; if neither is negative, no problem 49 ! compute sign of result; if neither is negative, no problem
48 orcc %o1, %o0, %g0 ! either negative? 50 orcc %o1, %o0, %g0 ! either negative?
49 bge 2f ! no, go do the divide 51 bge 2f ! no, go do the divide
diff --git a/arch/sparc/lib/udiv.S b/arch/sparc/lib/udiv.S
index 2abfc6b0f3e9..169e01da6715 100644
--- a/arch/sparc/lib/udiv.S
+++ b/arch/sparc/lib/udiv.S
@@ -43,7 +43,9 @@
43 43
44 44
45 .globl .udiv 45 .globl .udiv
46 .globl _Udiv
46.udiv: 47.udiv:
48_Udiv: /* needed for export */
47 49
48 ! Ready to divide. Compute size of quotient; scale comparand. 50 ! Ready to divide. Compute size of quotient; scale comparand.
49 orcc %o1, %g0, %o5 51 orcc %o1, %g0, %o5
diff --git a/arch/sparc/lib/umul.S b/arch/sparc/lib/umul.S
index a784720a8a22..f0e5b20a2536 100644
--- a/arch/sparc/lib/umul.S
+++ b/arch/sparc/lib/umul.S
@@ -21,7 +21,9 @@
21 */ 21 */
22 22
23 .globl .umul 23 .globl .umul
24 .globl _Umul
24.umul: 25.umul:
26_Umul: /* needed for export */
25 or %o0, %o1, %o4 27 or %o0, %o1, %o4
26 mov %o0, %y ! multiplier -> Y 28 mov %o0, %y ! multiplier -> Y
27 29
diff --git a/arch/sparc/lib/urem.S b/arch/sparc/lib/urem.S
index ec7f0c502c56..6b92bdc8b04c 100644
--- a/arch/sparc/lib/urem.S
+++ b/arch/sparc/lib/urem.S
@@ -41,7 +41,9 @@
41 */ 41 */
42 42
43 .globl .urem 43 .globl .urem
44 .globl _Urem
44.urem: 45.urem:
46_Urem: /* needed for export */
45 47
46 ! Ready to divide. Compute size of quotient; scale comparand. 48 ! Ready to divide. Compute size of quotient; scale comparand.
47 orcc %o1, %g0, %o5 49 orcc %o1, %g0, %o5
diff --git a/arch/sparc/mm/hypersparc.S b/arch/sparc/mm/hypersparc.S
index 54b8e764b042..a231cca37216 100644
--- a/arch/sparc/mm/hypersparc.S
+++ b/arch/sparc/mm/hypersparc.S
@@ -6,7 +6,7 @@
6 6
7#include <asm/ptrace.h> 7#include <asm/ptrace.h>
8#include <asm/psr.h> 8#include <asm/psr.h>
9#include <asm/asm_offsets.h> 9#include <asm/asm-offsets.h>
10#include <asm/asi.h> 10#include <asm/asi.h>
11#include <asm/page.h> 11#include <asm/page.h>
12#include <asm/pgtsrmmu.h> 12#include <asm/pgtsrmmu.h>
diff --git a/arch/sparc/mm/swift.S b/arch/sparc/mm/swift.S
index 2dcaa5ac1a38..cd90f3fdc4e7 100644
--- a/arch/sparc/mm/swift.S
+++ b/arch/sparc/mm/swift.S
@@ -9,7 +9,7 @@
9#include <asm/asi.h> 9#include <asm/asi.h>
10#include <asm/page.h> 10#include <asm/page.h>
11#include <asm/pgtsrmmu.h> 11#include <asm/pgtsrmmu.h>
12#include <asm/asm_offsets.h> 12#include <asm/asm-offsets.h>
13 13
14 .text 14 .text
15 .align 4 15 .align 4
diff --git a/arch/sparc/mm/tsunami.S b/arch/sparc/mm/tsunami.S
index 8acd1787fde2..697af617594a 100644
--- a/arch/sparc/mm/tsunami.S
+++ b/arch/sparc/mm/tsunami.S
@@ -6,7 +6,7 @@
6 6
7#include <linux/config.h> 7#include <linux/config.h>
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9#include <asm/asm_offsets.h> 9#include <asm/asm-offsets.h>
10#include <asm/psr.h> 10#include <asm/psr.h>
11#include <asm/asi.h> 11#include <asm/asi.h>
12#include <asm/page.h> 12#include <asm/page.h>
diff --git a/arch/sparc/mm/viking.S b/arch/sparc/mm/viking.S
index f58712d26bf5..3cbd6de18dde 100644
--- a/arch/sparc/mm/viking.S
+++ b/arch/sparc/mm/viking.S
@@ -9,7 +9,7 @@
9#include <linux/config.h> 9#include <linux/config.h>
10#include <asm/ptrace.h> 10#include <asm/ptrace.h>
11#include <asm/psr.h> 11#include <asm/psr.h>
12#include <asm/asm_offsets.h> 12#include <asm/asm-offsets.h>
13#include <asm/asi.h> 13#include <asm/asi.h>
14#include <asm/mxcc.h> 14#include <asm/mxcc.h>
15#include <asm/page.h> 15#include <asm/page.h>
diff --git a/arch/sparc64/kernel/asm-offsets.c b/arch/sparc64/kernel/asm-offsets.c
new file mode 100644
index 000000000000..9e263112a6e2
--- /dev/null
+++ b/arch/sparc64/kernel/asm-offsets.c
@@ -0,0 +1 @@
/* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index ec8bf4012c0c..2ff7c32ab0ce 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -359,134 +359,17 @@ void pcibios_fixup_bus(struct pci_bus *pbus)
359 pbus->resource[1] = &pbm->mem_space; 359 pbus->resource[1] = &pbm->mem_space;
360} 360}
361 361
362int pci_claim_resource(struct pci_dev *pdev, int resource) 362struct resource *pcibios_select_root(struct pci_dev *pdev, struct resource *r)
363{ 363{
364 struct pci_pbm_info *pbm = pdev->bus->sysdata; 364 struct pci_pbm_info *pbm = pdev->bus->sysdata;
365 struct resource *res = &pdev->resource[resource]; 365 struct resource *root = NULL;
366 struct resource *root;
367
368 if (!pbm)
369 return -EINVAL;
370 366
371 if (res->flags & IORESOURCE_IO) 367 if (r->flags & IORESOURCE_IO)
372 root = &pbm->io_space; 368 root = &pbm->io_space;
373 else 369 if (r->flags & IORESOURCE_MEM)
374 root = &pbm->mem_space; 370 root = &pbm->mem_space;
375 371
376 pbm->parent->resource_adjust(pdev, res, root); 372 return root;
377
378 return request_resource(root, res);
379}
380
381/*
382 * Given the PCI bus a device resides on, try to
383 * find an acceptable resource allocation for a
384 * specific device resource..
385 */
386static int pci_assign_bus_resource(const struct pci_bus *bus,
387 struct pci_dev *dev,
388 struct resource *res,
389 unsigned long size,
390 unsigned long min,
391 int resno)
392{
393 unsigned int type_mask;
394 int i;
395
396 type_mask = IORESOURCE_IO | IORESOURCE_MEM;
397 for (i = 0 ; i < 4; i++) {
398 struct resource *r = bus->resource[i];
399 if (!r)
400 continue;
401
402 /* type_mask must match */
403 if ((res->flags ^ r->flags) & type_mask)
404 continue;
405
406 /* Ok, try it out.. */
407 if (allocate_resource(r, res, size, min, -1, size, NULL, NULL) < 0)
408 continue;
409
410 /* PCI config space updated by caller. */
411 return 0;
412 }
413 return -EBUSY;
414}
415
416int pci_assign_resource(struct pci_dev *pdev, int resource)
417{
418 struct pcidev_cookie *pcp = pdev->sysdata;
419 struct pci_pbm_info *pbm = pcp->pbm;
420 struct resource *res = &pdev->resource[resource];
421 unsigned long min, size;
422 int err;
423
424 if (res->flags & IORESOURCE_IO)
425 min = pbm->io_space.start + 0x400UL;
426 else
427 min = pbm->mem_space.start;
428
429 size = res->end - res->start + 1;
430
431 err = pci_assign_bus_resource(pdev->bus, pdev, res, size, min, resource);
432
433 if (err < 0) {
434 printk("PCI: Failed to allocate resource %d for %s\n",
435 resource, pci_name(pdev));
436 } else {
437 /* Update PCI config space. */
438 pbm->parent->base_address_update(pdev, resource);
439 }
440
441 return err;
442}
443
444/* Sort resources by alignment */
445void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
446{
447 int i;
448
449 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
450 struct resource *r;
451 struct resource_list *list, *tmp;
452 unsigned long r_align;
453
454 r = &dev->resource[i];
455 r_align = r->end - r->start;
456
457 if (!(r->flags) || r->parent)
458 continue;
459 if (!r_align) {
460 printk(KERN_WARNING "PCI: Ignore bogus resource %d "
461 "[%lx:%lx] of %s\n",
462 i, r->start, r->end, pci_name(dev));
463 continue;
464 }
465 r_align = (i < PCI_BRIDGE_RESOURCES) ? r_align + 1 : r->start;
466 for (list = head; ; list = list->next) {
467 unsigned long align = 0;
468 struct resource_list *ln = list->next;
469 int idx;
470
471 if (ln) {
472 idx = ln->res - &ln->dev->resource[0];
473 align = (idx < PCI_BRIDGE_RESOURCES) ?
474 ln->res->end - ln->res->start + 1 :
475 ln->res->start;
476 }
477 if (r_align > align) {
478 tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
479 if (!tmp)
480 panic("pdev_sort_resources(): "
481 "kmalloc() failed!\n");
482 tmp->next = ln;
483 tmp->res = r;
484 tmp->dev = dev;
485 list->next = tmp;
486 break;
487 }
488 }
489 }
490} 373}
491 374
492void pcibios_update_irq(struct pci_dev *pdev, int irq) 375void pcibios_update_irq(struct pci_dev *pdev, int irq)
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 91ab466d6c66..6ed1ef25e0ac 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -307,7 +307,7 @@ static unsigned char psycho_pil_table[] = {
307/*0x32*/15, /* Power Management */ 307/*0x32*/15, /* Power Management */
308}; 308};
309 309
310static int __init psycho_ino_to_pil(struct pci_dev *pdev, unsigned int ino) 310static int psycho_ino_to_pil(struct pci_dev *pdev, unsigned int ino)
311{ 311{
312 int ret; 312 int ret;
313 313
@@ -344,9 +344,9 @@ static int __init psycho_ino_to_pil(struct pci_dev *pdev, unsigned int ino)
344 return ret; 344 return ret;
345} 345}
346 346
347static unsigned int __init psycho_irq_build(struct pci_pbm_info *pbm, 347static unsigned int psycho_irq_build(struct pci_pbm_info *pbm,
348 struct pci_dev *pdev, 348 struct pci_dev *pdev,
349 unsigned int ino) 349 unsigned int ino)
350{ 350{
351 struct ino_bucket *bucket; 351 struct ino_bucket *bucket;
352 unsigned long imap, iclr; 352 unsigned long imap, iclr;
@@ -1024,7 +1024,7 @@ static irqreturn_t psycho_pcierr_intr(int irq, void *dev_id, struct pt_regs *reg
1024#define PSYCHO_CE_INO 0x2f 1024#define PSYCHO_CE_INO 0x2f
1025#define PSYCHO_PCIERR_A_INO 0x30 1025#define PSYCHO_PCIERR_A_INO 0x30
1026#define PSYCHO_PCIERR_B_INO 0x31 1026#define PSYCHO_PCIERR_B_INO 0x31
1027static void __init psycho_register_error_handlers(struct pci_controller_info *p) 1027static void psycho_register_error_handlers(struct pci_controller_info *p)
1028{ 1028{
1029 struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */ 1029 struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */
1030 unsigned long base = p->pbm_A.controller_regs; 1030 unsigned long base = p->pbm_A.controller_regs;
@@ -1091,15 +1091,15 @@ static void __init psycho_register_error_handlers(struct pci_controller_info *p)
1091} 1091}
1092 1092
1093/* PSYCHO boot time probing and initialization. */ 1093/* PSYCHO boot time probing and initialization. */
1094static void __init psycho_resource_adjust(struct pci_dev *pdev, 1094static void psycho_resource_adjust(struct pci_dev *pdev,
1095 struct resource *res, 1095 struct resource *res,
1096 struct resource *root) 1096 struct resource *root)
1097{ 1097{
1098 res->start += root->start; 1098 res->start += root->start;
1099 res->end += root->start; 1099 res->end += root->start;
1100} 1100}
1101 1101
1102static void __init psycho_base_address_update(struct pci_dev *pdev, int resource) 1102static void psycho_base_address_update(struct pci_dev *pdev, int resource)
1103{ 1103{
1104 struct pcidev_cookie *pcp = pdev->sysdata; 1104 struct pcidev_cookie *pcp = pdev->sysdata;
1105 struct pci_pbm_info *pbm = pcp->pbm; 1105 struct pci_pbm_info *pbm = pcp->pbm;
@@ -1144,7 +1144,7 @@ static void __init psycho_base_address_update(struct pci_dev *pdev, int resource
1144 pci_write_config_dword(pdev, where + 4, 0); 1144 pci_write_config_dword(pdev, where + 4, 0);
1145} 1145}
1146 1146
1147static void __init pbm_config_busmastering(struct pci_pbm_info *pbm) 1147static void pbm_config_busmastering(struct pci_pbm_info *pbm)
1148{ 1148{
1149 u8 *addr; 1149 u8 *addr;
1150 1150
@@ -1161,8 +1161,8 @@ static void __init pbm_config_busmastering(struct pci_pbm_info *pbm)
1161 pci_config_write8(addr, 64); 1161 pci_config_write8(addr, 64);
1162} 1162}
1163 1163
1164static void __init pbm_scan_bus(struct pci_controller_info *p, 1164static void pbm_scan_bus(struct pci_controller_info *p,
1165 struct pci_pbm_info *pbm) 1165 struct pci_pbm_info *pbm)
1166{ 1166{
1167 struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL); 1167 struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
1168 1168
@@ -1189,7 +1189,7 @@ static void __init pbm_scan_bus(struct pci_controller_info *p,
1189 pci_setup_busmastering(pbm, pbm->pci_bus); 1189 pci_setup_busmastering(pbm, pbm->pci_bus);
1190} 1190}
1191 1191
1192static void __init psycho_scan_bus(struct pci_controller_info *p) 1192static void psycho_scan_bus(struct pci_controller_info *p)
1193{ 1193{
1194 pbm_config_busmastering(&p->pbm_B); 1194 pbm_config_busmastering(&p->pbm_B);
1195 p->pbm_B.is_66mhz_capable = 0; 1195 p->pbm_B.is_66mhz_capable = 0;
@@ -1204,7 +1204,7 @@ static void __init psycho_scan_bus(struct pci_controller_info *p)
1204 psycho_register_error_handlers(p); 1204 psycho_register_error_handlers(p);
1205} 1205}
1206 1206
1207static void __init psycho_iommu_init(struct pci_controller_info *p) 1207static void psycho_iommu_init(struct pci_controller_info *p)
1208{ 1208{
1209 struct pci_iommu *iommu = p->pbm_A.iommu; 1209 struct pci_iommu *iommu = p->pbm_A.iommu;
1210 unsigned long tsbbase, i; 1210 unsigned long tsbbase, i;
@@ -1327,8 +1327,8 @@ static void psycho_controller_hwinit(struct pci_controller_info *p)
1327 psycho_write(p->pbm_A.controller_regs + PSYCHO_PCIB_DIAG, tmp); 1327 psycho_write(p->pbm_A.controller_regs + PSYCHO_PCIB_DIAG, tmp);
1328} 1328}
1329 1329
1330static void __init pbm_register_toplevel_resources(struct pci_controller_info *p, 1330static void pbm_register_toplevel_resources(struct pci_controller_info *p,
1331 struct pci_pbm_info *pbm) 1331 struct pci_pbm_info *pbm)
1332{ 1332{
1333 char *name = pbm->name; 1333 char *name = pbm->name;
1334 1334
@@ -1481,7 +1481,7 @@ static void psycho_pbm_init(struct pci_controller_info *p,
1481 1481
1482#define PSYCHO_CONFIGSPACE 0x001000000UL 1482#define PSYCHO_CONFIGSPACE 0x001000000UL
1483 1483
1484void __init psycho_init(int node, char *model_name) 1484void psycho_init(int node, char *model_name)
1485{ 1485{
1486 struct linux_prom64_registers pr_regs[3]; 1486 struct linux_prom64_registers pr_regs[3];
1487 struct pci_controller_info *p; 1487 struct pci_controller_info *p;
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index 52bf3431a422..0ee6bd5b9ac6 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -554,7 +554,7 @@ static unsigned char sabre_pil_table[] = {
554/*0x32*/15, /* Power Management */ 554/*0x32*/15, /* Power Management */
555}; 555};
556 556
557static int __init sabre_ino_to_pil(struct pci_dev *pdev, unsigned int ino) 557static int sabre_ino_to_pil(struct pci_dev *pdev, unsigned int ino)
558{ 558{
559 int ret; 559 int ret;
560 560
@@ -612,9 +612,9 @@ static void sabre_wsync_handler(struct ino_bucket *bucket, void *_arg1, void *_a
612 sabre_read(sync_reg); 612 sabre_read(sync_reg);
613} 613}
614 614
615static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm, 615static unsigned int sabre_irq_build(struct pci_pbm_info *pbm,
616 struct pci_dev *pdev, 616 struct pci_dev *pdev,
617 unsigned int ino) 617 unsigned int ino)
618{ 618{
619 struct ino_bucket *bucket; 619 struct ino_bucket *bucket;
620 unsigned long imap, iclr; 620 unsigned long imap, iclr;
@@ -1009,7 +1009,7 @@ static irqreturn_t sabre_pcierr_intr(int irq, void *dev_id, struct pt_regs *regs
1009#define SABRE_UE_INO 0x2e 1009#define SABRE_UE_INO 0x2e
1010#define SABRE_CE_INO 0x2f 1010#define SABRE_CE_INO 0x2f
1011#define SABRE_PCIERR_INO 0x30 1011#define SABRE_PCIERR_INO 0x30
1012static void __init sabre_register_error_handlers(struct pci_controller_info *p) 1012static void sabre_register_error_handlers(struct pci_controller_info *p)
1013{ 1013{
1014 struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */ 1014 struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */
1015 unsigned long base = pbm->controller_regs; 1015 unsigned long base = pbm->controller_regs;
@@ -1056,9 +1056,9 @@ static void __init sabre_register_error_handlers(struct pci_controller_info *p)
1056 sabre_write(base + SABRE_PCICTRL, tmp); 1056 sabre_write(base + SABRE_PCICTRL, tmp);
1057} 1057}
1058 1058
1059static void __init sabre_resource_adjust(struct pci_dev *pdev, 1059static void sabre_resource_adjust(struct pci_dev *pdev,
1060 struct resource *res, 1060 struct resource *res,
1061 struct resource *root) 1061 struct resource *root)
1062{ 1062{
1063 struct pci_pbm_info *pbm = pdev->bus->sysdata; 1063 struct pci_pbm_info *pbm = pdev->bus->sysdata;
1064 unsigned long base; 1064 unsigned long base;
@@ -1072,7 +1072,7 @@ static void __init sabre_resource_adjust(struct pci_dev *pdev,
1072 res->end += base; 1072 res->end += base;
1073} 1073}
1074 1074
1075static void __init sabre_base_address_update(struct pci_dev *pdev, int resource) 1075static void sabre_base_address_update(struct pci_dev *pdev, int resource)
1076{ 1076{
1077 struct pcidev_cookie *pcp = pdev->sysdata; 1077 struct pcidev_cookie *pcp = pdev->sysdata;
1078 struct pci_pbm_info *pbm = pcp->pbm; 1078 struct pci_pbm_info *pbm = pcp->pbm;
@@ -1118,7 +1118,7 @@ static void __init sabre_base_address_update(struct pci_dev *pdev, int resource)
1118 pci_write_config_dword(pdev, where + 4, 0); 1118 pci_write_config_dword(pdev, where + 4, 0);
1119} 1119}
1120 1120
1121static void __init apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus) 1121static void apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus)
1122{ 1122{
1123 struct pci_dev *pdev; 1123 struct pci_dev *pdev;
1124 1124
@@ -1181,7 +1181,7 @@ static struct pcidev_cookie *alloc_bridge_cookie(struct pci_pbm_info *pbm)
1181 return cookie; 1181 return cookie;
1182} 1182}
1183 1183
1184static void __init sabre_scan_bus(struct pci_controller_info *p) 1184static void sabre_scan_bus(struct pci_controller_info *p)
1185{ 1185{
1186 static int once; 1186 static int once;
1187 struct pci_bus *sabre_bus, *pbus; 1187 struct pci_bus *sabre_bus, *pbus;
@@ -1262,9 +1262,9 @@ static void __init sabre_scan_bus(struct pci_controller_info *p)
1262 sabre_register_error_handlers(p); 1262 sabre_register_error_handlers(p);
1263} 1263}
1264 1264
1265static void __init sabre_iommu_init(struct pci_controller_info *p, 1265static void sabre_iommu_init(struct pci_controller_info *p,
1266 int tsbsize, unsigned long dvma_offset, 1266 int tsbsize, unsigned long dvma_offset,
1267 u32 dma_mask) 1267 u32 dma_mask)
1268{ 1268{
1269 struct pci_iommu *iommu = p->pbm_A.iommu; 1269 struct pci_iommu *iommu = p->pbm_A.iommu;
1270 unsigned long tsbbase, i, order; 1270 unsigned long tsbbase, i, order;
@@ -1345,8 +1345,8 @@ static void __init sabre_iommu_init(struct pci_controller_info *p,
1345 } 1345 }
1346} 1346}
1347 1347
1348static void __init pbm_register_toplevel_resources(struct pci_controller_info *p, 1348static void pbm_register_toplevel_resources(struct pci_controller_info *p,
1349 struct pci_pbm_info *pbm) 1349 struct pci_pbm_info *pbm)
1350{ 1350{
1351 char *name = pbm->name; 1351 char *name = pbm->name;
1352 unsigned long ibase = p->pbm_A.controller_regs + SABRE_IOSPACE; 1352 unsigned long ibase = p->pbm_A.controller_regs + SABRE_IOSPACE;
@@ -1415,7 +1415,7 @@ static void __init pbm_register_toplevel_resources(struct pci_controller_info *p
1415 &pbm->mem_space); 1415 &pbm->mem_space);
1416} 1416}
1417 1417
1418static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin) 1418static void sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin)
1419{ 1419{
1420 struct pci_pbm_info *pbm; 1420 struct pci_pbm_info *pbm;
1421 char namebuf[128]; 1421 char namebuf[128];
@@ -1552,7 +1552,7 @@ static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node,
1552 } 1552 }
1553} 1553}
1554 1554
1555void __init sabre_init(int pnode, char *model_name) 1555void sabre_init(int pnode, char *model_name)
1556{ 1556{
1557 struct linux_prom64_registers pr_regs[2]; 1557 struct linux_prom64_registers pr_regs[2];
1558 struct pci_controller_info *p; 1558 struct pci_controller_info *p;
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index 6a182bb66281..331382e1a75d 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -285,7 +285,7 @@ static unsigned char schizo_pil_table[] = {
285/*0x3f*/0, /* Reserved for NewLink */ 285/*0x3f*/0, /* Reserved for NewLink */
286}; 286};
287 287
288static int __init schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino) 288static int schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino)
289{ 289{
290 int ret; 290 int ret;
291 291
@@ -1221,7 +1221,7 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs *
1221 * PCI bus units of the same Tomatillo. I still have not really 1221 * PCI bus units of the same Tomatillo. I still have not really
1222 * figured this out... 1222 * figured this out...
1223 */ 1223 */
1224static void __init tomatillo_register_error_handlers(struct pci_controller_info *p) 1224static void tomatillo_register_error_handlers(struct pci_controller_info *p)
1225{ 1225{
1226 struct pci_pbm_info *pbm; 1226 struct pci_pbm_info *pbm;
1227 unsigned int irq; 1227 unsigned int irq;
@@ -1359,7 +1359,7 @@ static void __init tomatillo_register_error_handlers(struct pci_controller_info
1359 (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP))); 1359 (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP)));
1360} 1360}
1361 1361
1362static void __init schizo_register_error_handlers(struct pci_controller_info *p) 1362static void schizo_register_error_handlers(struct pci_controller_info *p)
1363{ 1363{
1364 struct pci_pbm_info *pbm; 1364 struct pci_pbm_info *pbm;
1365 unsigned int irq; 1365 unsigned int irq;
@@ -1505,7 +1505,7 @@ static void __init schizo_register_error_handlers(struct pci_controller_info *p)
1505 (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP))); 1505 (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP)));
1506} 1506}
1507 1507
1508static void __init pbm_config_busmastering(struct pci_pbm_info *pbm) 1508static void pbm_config_busmastering(struct pci_pbm_info *pbm)
1509{ 1509{
1510 u8 *addr; 1510 u8 *addr;
1511 1511
@@ -1522,8 +1522,8 @@ static void __init pbm_config_busmastering(struct pci_pbm_info *pbm)
1522 pci_config_write8(addr, 64); 1522 pci_config_write8(addr, 64);
1523} 1523}
1524 1524
1525static void __init pbm_scan_bus(struct pci_controller_info *p, 1525static void pbm_scan_bus(struct pci_controller_info *p,
1526 struct pci_pbm_info *pbm) 1526 struct pci_pbm_info *pbm)
1527{ 1527{
1528 struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL); 1528 struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
1529 1529
@@ -1550,8 +1550,8 @@ static void __init pbm_scan_bus(struct pci_controller_info *p,
1550 pci_setup_busmastering(pbm, pbm->pci_bus); 1550 pci_setup_busmastering(pbm, pbm->pci_bus);
1551} 1551}
1552 1552
1553static void __init __schizo_scan_bus(struct pci_controller_info *p, 1553static void __schizo_scan_bus(struct pci_controller_info *p,
1554 int chip_type) 1554 int chip_type)
1555{ 1555{
1556 if (!p->pbm_B.prom_node || !p->pbm_A.prom_node) { 1556 if (!p->pbm_B.prom_node || !p->pbm_A.prom_node) {
1557 printk("PCI: Only one PCI bus module of controller found.\n"); 1557 printk("PCI: Only one PCI bus module of controller found.\n");
@@ -1577,17 +1577,17 @@ static void __init __schizo_scan_bus(struct pci_controller_info *p,
1577 schizo_register_error_handlers(p); 1577 schizo_register_error_handlers(p);
1578} 1578}
1579 1579
1580static void __init schizo_scan_bus(struct pci_controller_info *p) 1580static void schizo_scan_bus(struct pci_controller_info *p)
1581{ 1581{
1582 __schizo_scan_bus(p, PBM_CHIP_TYPE_SCHIZO); 1582 __schizo_scan_bus(p, PBM_CHIP_TYPE_SCHIZO);
1583} 1583}
1584 1584
1585static void __init tomatillo_scan_bus(struct pci_controller_info *p) 1585static void tomatillo_scan_bus(struct pci_controller_info *p)
1586{ 1586{
1587 __schizo_scan_bus(p, PBM_CHIP_TYPE_TOMATILLO); 1587 __schizo_scan_bus(p, PBM_CHIP_TYPE_TOMATILLO);
1588} 1588}
1589 1589
1590static void __init schizo_base_address_update(struct pci_dev *pdev, int resource) 1590static void schizo_base_address_update(struct pci_dev *pdev, int resource)
1591{ 1591{
1592 struct pcidev_cookie *pcp = pdev->sysdata; 1592 struct pcidev_cookie *pcp = pdev->sysdata;
1593 struct pci_pbm_info *pbm = pcp->pbm; 1593 struct pci_pbm_info *pbm = pcp->pbm;
@@ -1632,9 +1632,9 @@ static void __init schizo_base_address_update(struct pci_dev *pdev, int resource
1632 pci_write_config_dword(pdev, where + 4, 0); 1632 pci_write_config_dword(pdev, where + 4, 0);
1633} 1633}
1634 1634
1635static void __init schizo_resource_adjust(struct pci_dev *pdev, 1635static void schizo_resource_adjust(struct pci_dev *pdev,
1636 struct resource *res, 1636 struct resource *res,
1637 struct resource *root) 1637 struct resource *root)
1638{ 1638{
1639 res->start += root->start; 1639 res->start += root->start;
1640 res->end += root->start; 1640 res->end += root->start;
@@ -1702,8 +1702,8 @@ static void schizo_determine_mem_io_space(struct pci_pbm_info *pbm)
1702 pbm->mem_space.start); 1702 pbm->mem_space.start);
1703} 1703}
1704 1704
1705static void __init pbm_register_toplevel_resources(struct pci_controller_info *p, 1705static void pbm_register_toplevel_resources(struct pci_controller_info *p,
1706 struct pci_pbm_info *pbm) 1706 struct pci_pbm_info *pbm)
1707{ 1707{
1708 pbm->io_space.name = pbm->mem_space.name = pbm->name; 1708 pbm->io_space.name = pbm->mem_space.name = pbm->name;
1709 1709
@@ -1932,7 +1932,7 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
1932#define TOMATILLO_PCI_IOC_TDIAG (0x2250UL) 1932#define TOMATILLO_PCI_IOC_TDIAG (0x2250UL)
1933#define TOMATILLO_PCI_IOC_DDIAG (0x2290UL) 1933#define TOMATILLO_PCI_IOC_DDIAG (0x2290UL)
1934 1934
1935static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm) 1935static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1936{ 1936{
1937 u64 tmp; 1937 u64 tmp;
1938 1938
@@ -1986,9 +1986,9 @@ static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1986 } 1986 }
1987} 1987}
1988 1988
1989static void __init schizo_pbm_init(struct pci_controller_info *p, 1989static void schizo_pbm_init(struct pci_controller_info *p,
1990 int prom_node, u32 portid, 1990 int prom_node, u32 portid,
1991 int chip_type) 1991 int chip_type)
1992{ 1992{
1993 struct linux_prom64_registers pr_regs[4]; 1993 struct linux_prom64_registers pr_regs[4];
1994 unsigned int busrange[2]; 1994 unsigned int busrange[2];
@@ -2145,7 +2145,7 @@ static inline int portid_compare(u32 x, u32 y, int chip_type)
2145 return (x == y); 2145 return (x == y);
2146} 2146}
2147 2147
2148static void __init __schizo_init(int node, char *model_name, int chip_type) 2148static void __schizo_init(int node, char *model_name, int chip_type)
2149{ 2149{
2150 struct pci_controller_info *p; 2150 struct pci_controller_info *p;
2151 struct pci_iommu *iommu; 2151 struct pci_iommu *iommu;
@@ -2213,17 +2213,17 @@ static void __init __schizo_init(int node, char *model_name, int chip_type)
2213 schizo_pbm_init(p, node, portid, chip_type); 2213 schizo_pbm_init(p, node, portid, chip_type);
2214} 2214}
2215 2215
2216void __init schizo_init(int node, char *model_name) 2216void schizo_init(int node, char *model_name)
2217{ 2217{
2218 __schizo_init(node, model_name, PBM_CHIP_TYPE_SCHIZO); 2218 __schizo_init(node, model_name, PBM_CHIP_TYPE_SCHIZO);
2219} 2219}
2220 2220
2221void __init schizo_plus_init(int node, char *model_name) 2221void schizo_plus_init(int node, char *model_name)
2222{ 2222{
2223 __schizo_init(node, model_name, PBM_CHIP_TYPE_SCHIZO_PLUS); 2223 __schizo_init(node, model_name, PBM_CHIP_TYPE_SCHIZO_PLUS);
2224} 2224}
2225 2225
2226void __init tomatillo_init(int node, char *model_name) 2226void tomatillo_init(int node, char *model_name)
2227{ 2227{
2228 __schizo_init(node, model_name, PBM_CHIP_TYPE_TOMATILLO); 2228 __schizo_init(node, model_name, PBM_CHIP_TYPE_TOMATILLO);
2229} 2229}
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 66255434128a..7d10b0397091 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -607,11 +607,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
607 struct thread_info *t = p->thread_info; 607 struct thread_info *t = p->thread_info;
608 char *child_trap_frame; 608 char *child_trap_frame;
609 609
610#ifdef CONFIG_DEBUG_SPINLOCK
611 p->thread.smp_lock_count = 0;
612 p->thread.smp_lock_pc = 0;
613#endif
614
615 /* Calculate offset to stack_frame & pt_regs */ 610 /* Calculate offset to stack_frame & pt_regs */
616 child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ)); 611 child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ));
617 memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ)); 612 memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ));
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index d89fc24808d3..cbb5e59824e5 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -115,17 +115,12 @@ EXPORT_PER_CPU_SYMBOL(__cpu_data);
115 115
116/* used by various drivers */ 116/* used by various drivers */
117#ifdef CONFIG_SMP 117#ifdef CONFIG_SMP
118#ifndef CONFIG_DEBUG_SPINLOCK
119/* Out of line rw-locking implementation. */ 118/* Out of line rw-locking implementation. */
120EXPORT_SYMBOL(__read_lock); 119EXPORT_SYMBOL(__read_lock);
121EXPORT_SYMBOL(__read_unlock); 120EXPORT_SYMBOL(__read_unlock);
122EXPORT_SYMBOL(__write_lock); 121EXPORT_SYMBOL(__write_lock);
123EXPORT_SYMBOL(__write_unlock); 122EXPORT_SYMBOL(__write_unlock);
124EXPORT_SYMBOL(__write_trylock); 123EXPORT_SYMBOL(__write_trylock);
125/* Out of line spin-locking implementation. */
126EXPORT_SYMBOL(_raw_spin_lock);
127EXPORT_SYMBOL(_raw_spin_lock_flags);
128#endif
129 124
130/* Hard IRQ locking */ 125/* Hard IRQ locking */
131EXPORT_SYMBOL(synchronize_irq); 126EXPORT_SYMBOL(synchronize_irq);
@@ -403,12 +398,3 @@ EXPORT_SYMBOL(xor_vis_4);
403EXPORT_SYMBOL(xor_vis_5); 398EXPORT_SYMBOL(xor_vis_5);
404 399
405EXPORT_SYMBOL(prom_palette); 400EXPORT_SYMBOL(prom_palette);
406
407/* memory barriers */
408EXPORT_SYMBOL(mb);
409EXPORT_SYMBOL(rmb);
410EXPORT_SYMBOL(wmb);
411EXPORT_SYMBOL(membar_storeload);
412EXPORT_SYMBOL(membar_storeload_storestore);
413EXPORT_SYMBOL(membar_storeload_loadload);
414EXPORT_SYMBOL(membar_storestore_loadstore);
diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile
index 6201f1040982..d968aebe83b2 100644
--- a/arch/sparc64/lib/Makefile
+++ b/arch/sparc64/lib/Makefile
@@ -12,9 +12,8 @@ lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
12 U1memcpy.o U1copy_from_user.o U1copy_to_user.o \ 12 U1memcpy.o U1copy_from_user.o U1copy_to_user.o \
13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ 13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \
14 copy_in_user.o user_fixup.o memmove.o \ 14 copy_in_user.o user_fixup.o memmove.o \
15 mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o mb.o 15 mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o
16 16
17lib-$(CONFIG_DEBUG_SPINLOCK) += debuglocks.o
18lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o 17lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o
19 18
20obj-y += iomap.o 19obj-y += iomap.o
diff --git a/arch/sparc64/lib/debuglocks.c b/arch/sparc64/lib/debuglocks.c
deleted file mode 100644
index f5f0b5586f01..000000000000
--- a/arch/sparc64/lib/debuglocks.c
+++ /dev/null
@@ -1,366 +0,0 @@
1/* $Id: debuglocks.c,v 1.9 2001/11/17 00:10:48 davem Exp $
2 * debuglocks.c: Debugging versions of SMP locking primitives.
3 *
4 * Copyright (C) 1998 David S. Miller (davem@redhat.com)
5 */
6
7#include <linux/config.h>
8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/spinlock.h>
11#include <asm/system.h>
12
13#ifdef CONFIG_SMP
14
15static inline void show (char *str, spinlock_t *lock, unsigned long caller)
16{
17 int cpu = smp_processor_id();
18
19 printk("%s(%p) CPU#%d stuck at %08x, owner PC(%08x):CPU(%x)\n",
20 str, lock, cpu, (unsigned int) caller,
21 lock->owner_pc, lock->owner_cpu);
22}
23
24static inline void show_read (char *str, rwlock_t *lock, unsigned long caller)
25{
26 int cpu = smp_processor_id();
27
28 printk("%s(%p) CPU#%d stuck at %08x, writer PC(%08x):CPU(%x)\n",
29 str, lock, cpu, (unsigned int) caller,
30 lock->writer_pc, lock->writer_cpu);
31}
32
33static inline void show_write (char *str, rwlock_t *lock, unsigned long caller)
34{
35 int cpu = smp_processor_id();
36 int i;
37
38 printk("%s(%p) CPU#%d stuck at %08x\n",
39 str, lock, cpu, (unsigned int) caller);
40 printk("Writer: PC(%08x):CPU(%x)\n",
41 lock->writer_pc, lock->writer_cpu);
42 printk("Readers:");
43 for (i = 0; i < NR_CPUS; i++)
44 if (lock->reader_pc[i])
45 printk(" %d[%08x]", i, lock->reader_pc[i]);
46 printk("\n");
47}
48
49#undef INIT_STUCK
50#define INIT_STUCK 100000000
51
52void _do_spin_lock(spinlock_t *lock, char *str, unsigned long caller)
53{
54 unsigned long val;
55 int stuck = INIT_STUCK;
56 int cpu = get_cpu();
57 int shown = 0;
58
59again:
60 __asm__ __volatile__("ldstub [%1], %0"
61 : "=r" (val)
62 : "r" (&(lock->lock))
63 : "memory");
64 membar_storeload_storestore();
65 if (val) {
66 while (lock->lock) {
67 if (!--stuck) {
68 if (shown++ <= 2)
69 show(str, lock, caller);
70 stuck = INIT_STUCK;
71 }
72 rmb();
73 }
74 goto again;
75 }
76 lock->owner_pc = ((unsigned int)caller);
77 lock->owner_cpu = cpu;
78 current->thread.smp_lock_count++;
79 current->thread.smp_lock_pc = ((unsigned int)caller);
80
81 put_cpu();
82}
83
84int _do_spin_trylock(spinlock_t *lock, unsigned long caller)
85{
86 unsigned long val;
87 int cpu = get_cpu();
88
89 __asm__ __volatile__("ldstub [%1], %0"
90 : "=r" (val)
91 : "r" (&(lock->lock))
92 : "memory");
93 membar_storeload_storestore();
94 if (!val) {
95 lock->owner_pc = ((unsigned int)caller);
96 lock->owner_cpu = cpu;
97 current->thread.smp_lock_count++;
98 current->thread.smp_lock_pc = ((unsigned int)caller);
99 }
100
101 put_cpu();
102
103 return val == 0;
104}
105
106void _do_spin_unlock(spinlock_t *lock)
107{
108 lock->owner_pc = 0;
109 lock->owner_cpu = NO_PROC_ID;
110 membar_storestore_loadstore();
111 lock->lock = 0;
112 current->thread.smp_lock_count--;
113}
114
115/* Keep INIT_STUCK the same... */
116
117void _do_read_lock(rwlock_t *rw, char *str, unsigned long caller)
118{
119 unsigned long val;
120 int stuck = INIT_STUCK;
121 int cpu = get_cpu();
122 int shown = 0;
123
124wlock_again:
125 /* Wait for any writer to go away. */
126 while (((long)(rw->lock)) < 0) {
127 if (!--stuck) {
128 if (shown++ <= 2)
129 show_read(str, rw, caller);
130 stuck = INIT_STUCK;
131 }
132 rmb();
133 }
134 /* Try once to increment the counter. */
135 __asm__ __volatile__(
136" ldx [%0], %%g1\n"
137" brlz,a,pn %%g1, 2f\n"
138" mov 1, %0\n"
139" add %%g1, 1, %%g7\n"
140" casx [%0], %%g1, %%g7\n"
141" sub %%g1, %%g7, %0\n"
142"2:" : "=r" (val)
143 : "0" (&(rw->lock))
144 : "g1", "g7", "memory");
145 membar_storeload_storestore();
146 if (val)
147 goto wlock_again;
148 rw->reader_pc[cpu] = ((unsigned int)caller);
149 current->thread.smp_lock_count++;
150 current->thread.smp_lock_pc = ((unsigned int)caller);
151
152 put_cpu();
153}
154
155void _do_read_unlock(rwlock_t *rw, char *str, unsigned long caller)
156{
157 unsigned long val;
158 int stuck = INIT_STUCK;
159 int cpu = get_cpu();
160 int shown = 0;
161
162 /* Drop our identity _first_. */
163 rw->reader_pc[cpu] = 0;
164 current->thread.smp_lock_count--;
165runlock_again:
166 /* Spin trying to decrement the counter using casx. */
167 __asm__ __volatile__(
168" membar #StoreLoad | #LoadLoad\n"
169" ldx [%0], %%g1\n"
170" sub %%g1, 1, %%g7\n"
171" casx [%0], %%g1, %%g7\n"
172" membar #StoreLoad | #StoreStore\n"
173" sub %%g1, %%g7, %0\n"
174 : "=r" (val)
175 : "0" (&(rw->lock))
176 : "g1", "g7", "memory");
177 if (val) {
178 if (!--stuck) {
179 if (shown++ <= 2)
180 show_read(str, rw, caller);
181 stuck = INIT_STUCK;
182 }
183 goto runlock_again;
184 }
185
186 put_cpu();
187}
188
189void _do_write_lock(rwlock_t *rw, char *str, unsigned long caller)
190{
191 unsigned long val;
192 int stuck = INIT_STUCK;
193 int cpu = get_cpu();
194 int shown = 0;
195
196wlock_again:
197 /* Spin while there is another writer. */
198 while (((long)rw->lock) < 0) {
199 if (!--stuck) {
200 if (shown++ <= 2)
201 show_write(str, rw, caller);
202 stuck = INIT_STUCK;
203 }
204 rmb();
205 }
206
207 /* Try to acuire the write bit. */
208 __asm__ __volatile__(
209" mov 1, %%g3\n"
210" sllx %%g3, 63, %%g3\n"
211" ldx [%0], %%g1\n"
212" brlz,pn %%g1, 1f\n"
213" or %%g1, %%g3, %%g7\n"
214" casx [%0], %%g1, %%g7\n"
215" membar #StoreLoad | #StoreStore\n"
216" ba,pt %%xcc, 2f\n"
217" sub %%g1, %%g7, %0\n"
218"1: mov 1, %0\n"
219"2:" : "=r" (val)
220 : "0" (&(rw->lock))
221 : "g3", "g1", "g7", "memory");
222 if (val) {
223 /* We couldn't get the write bit. */
224 if (!--stuck) {
225 if (shown++ <= 2)
226 show_write(str, rw, caller);
227 stuck = INIT_STUCK;
228 }
229 goto wlock_again;
230 }
231 if ((rw->lock & ((1UL<<63)-1UL)) != 0UL) {
232 /* Readers still around, drop the write
233 * lock, spin, and try again.
234 */
235 if (!--stuck) {
236 if (shown++ <= 2)
237 show_write(str, rw, caller);
238 stuck = INIT_STUCK;
239 }
240 __asm__ __volatile__(
241" mov 1, %%g3\n"
242" sllx %%g3, 63, %%g3\n"
243"1: ldx [%0], %%g1\n"
244" andn %%g1, %%g3, %%g7\n"
245" casx [%0], %%g1, %%g7\n"
246" cmp %%g1, %%g7\n"
247" membar #StoreLoad | #StoreStore\n"
248" bne,pn %%xcc, 1b\n"
249" nop"
250 : /* no outputs */
251 : "r" (&(rw->lock))
252 : "g3", "g1", "g7", "cc", "memory");
253 while(rw->lock != 0) {
254 if (!--stuck) {
255 if (shown++ <= 2)
256 show_write(str, rw, caller);
257 stuck = INIT_STUCK;
258 }
259 rmb();
260 }
261 goto wlock_again;
262 }
263
264 /* We have it, say who we are. */
265 rw->writer_pc = ((unsigned int)caller);
266 rw->writer_cpu = cpu;
267 current->thread.smp_lock_count++;
268 current->thread.smp_lock_pc = ((unsigned int)caller);
269
270 put_cpu();
271}
272
273void _do_write_unlock(rwlock_t *rw, unsigned long caller)
274{
275 unsigned long val;
276 int stuck = INIT_STUCK;
277 int shown = 0;
278
279 /* Drop our identity _first_ */
280 rw->writer_pc = 0;
281 rw->writer_cpu = NO_PROC_ID;
282 current->thread.smp_lock_count--;
283wlock_again:
284 __asm__ __volatile__(
285" membar #StoreLoad | #LoadLoad\n"
286" mov 1, %%g3\n"
287" sllx %%g3, 63, %%g3\n"
288" ldx [%0], %%g1\n"
289" andn %%g1, %%g3, %%g7\n"
290" casx [%0], %%g1, %%g7\n"
291" membar #StoreLoad | #StoreStore\n"
292" sub %%g1, %%g7, %0\n"
293 : "=r" (val)
294 : "0" (&(rw->lock))
295 : "g3", "g1", "g7", "memory");
296 if (val) {
297 if (!--stuck) {
298 if (shown++ <= 2)
299 show_write("write_unlock", rw, caller);
300 stuck = INIT_STUCK;
301 }
302 goto wlock_again;
303 }
304}
305
306int _do_write_trylock(rwlock_t *rw, char *str, unsigned long caller)
307{
308 unsigned long val;
309 int cpu = get_cpu();
310
311 /* Try to acuire the write bit. */
312 __asm__ __volatile__(
313" mov 1, %%g3\n"
314" sllx %%g3, 63, %%g3\n"
315" ldx [%0], %%g1\n"
316" brlz,pn %%g1, 1f\n"
317" or %%g1, %%g3, %%g7\n"
318" casx [%0], %%g1, %%g7\n"
319" membar #StoreLoad | #StoreStore\n"
320" ba,pt %%xcc, 2f\n"
321" sub %%g1, %%g7, %0\n"
322"1: mov 1, %0\n"
323"2:" : "=r" (val)
324 : "0" (&(rw->lock))
325 : "g3", "g1", "g7", "memory");
326
327 if (val) {
328 put_cpu();
329 return 0;
330 }
331
332 if ((rw->lock & ((1UL<<63)-1UL)) != 0UL) {
333 /* Readers still around, drop the write
334 * lock, return failure.
335 */
336 __asm__ __volatile__(
337" mov 1, %%g3\n"
338" sllx %%g3, 63, %%g3\n"
339"1: ldx [%0], %%g1\n"
340" andn %%g1, %%g3, %%g7\n"
341" casx [%0], %%g1, %%g7\n"
342" cmp %%g1, %%g7\n"
343" membar #StoreLoad | #StoreStore\n"
344" bne,pn %%xcc, 1b\n"
345" nop"
346 : /* no outputs */
347 : "r" (&(rw->lock))
348 : "g3", "g1", "g7", "cc", "memory");
349
350 put_cpu();
351
352 return 0;
353 }
354
355 /* We have it, say who we are. */
356 rw->writer_pc = ((unsigned int)caller);
357 rw->writer_cpu = cpu;
358 current->thread.smp_lock_count++;
359 current->thread.smp_lock_pc = ((unsigned int)caller);
360
361 put_cpu();
362
363 return 1;
364}
365
366#endif /* CONFIG_SMP */
diff --git a/arch/sparc64/lib/mb.S b/arch/sparc64/lib/mb.S
deleted file mode 100644
index 4004f748619f..000000000000
--- a/arch/sparc64/lib/mb.S
+++ /dev/null
@@ -1,73 +0,0 @@
1/* mb.S: Out of line memory barriers.
2 *
3 * Copyright (C) 2005 David S. Miller (davem@davemloft.net)
4 */
5
6 /* These are here in an effort to more fully work around
7 * Spitfire Errata #51. Essentially, if a memory barrier
8 * occurs soon after a mispredicted branch, the chip can stop
9 * executing instructions until a trap occurs. Therefore, if
10 * interrupts are disabled, the chip can hang forever.
11 *
12 * It used to be believed that the memory barrier had to be
13 * right in the delay slot, but a case has been traced
14 * recently wherein the memory barrier was one instruction
15 * after the branch delay slot and the chip still hung. The
16 * offending sequence was the following in sym_wakeup_done()
17 * of the sym53c8xx_2 driver:
18 *
19 * call sym_ccb_from_dsa, 0
20 * movge %icc, 0, %l0
21 * brz,pn %o0, .LL1303
22 * mov %o0, %l2
23 * membar #LoadLoad
24 *
25 * The branch has to be mispredicted for the bug to occur.
26 * Therefore, we put the memory barrier explicitly into a
27 * "branch always, predicted taken" delay slot to avoid the
28 * problem case.
29 */
30
31 .text
32
3399: retl
34 nop
35
36 .globl mb
37mb: ba,pt %xcc, 99b
38 membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad
39 .size mb, .-mb
40
41 .globl rmb
42rmb: ba,pt %xcc, 99b
43 membar #LoadLoad
44 .size rmb, .-rmb
45
46 .globl wmb
47wmb: ba,pt %xcc, 99b
48 membar #StoreStore
49 .size wmb, .-wmb
50
51 .globl membar_storeload
52membar_storeload:
53 ba,pt %xcc, 99b
54 membar #StoreLoad
55 .size membar_storeload, .-membar_storeload
56
57 .globl membar_storeload_storestore
58membar_storeload_storestore:
59 ba,pt %xcc, 99b
60 membar #StoreLoad | #StoreStore
61 .size membar_storeload_storestore, .-membar_storeload_storestore
62
63 .globl membar_storeload_loadload
64membar_storeload_loadload:
65 ba,pt %xcc, 99b
66 membar #StoreLoad | #LoadLoad
67 .size membar_storeload_loadload, .-membar_storeload_loadload
68
69 .globl membar_storestore_loadstore
70membar_storestore_loadstore:
71 ba,pt %xcc, 99b
72 membar #StoreStore | #LoadStore
73 .size membar_storestore_loadstore, .-membar_storestore_loadstore
diff --git a/arch/sparc64/solaris/ioctl.c b/arch/sparc64/solaris/ioctl.c
index cac0a1cf0050..be0a054e3ed6 100644
--- a/arch/sparc64/solaris/ioctl.c
+++ b/arch/sparc64/solaris/ioctl.c
@@ -24,6 +24,7 @@
24#include <linux/netdevice.h> 24#include <linux/netdevice.h>
25#include <linux/mtio.h> 25#include <linux/mtio.h>
26#include <linux/time.h> 26#include <linux/time.h>
27#include <linux/rcupdate.h>
27#include <linux/compat.h> 28#include <linux/compat.h>
28 29
29#include <net/sock.h> 30#include <net/sock.h>
@@ -293,16 +294,18 @@ static struct module_info {
293static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) 294static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg)
294{ 295{
295 struct inode *ino; 296 struct inode *ino;
297 struct fdtable *fdt;
296 /* I wonder which of these tests are superfluous... --patrik */ 298 /* I wonder which of these tests are superfluous... --patrik */
297 spin_lock(&current->files->file_lock); 299 rcu_read_lock();
298 if (! current->files->fd[fd] || 300 fdt = files_fdtable(current->files);
299 ! current->files->fd[fd]->f_dentry || 301 if (! fdt->fd[fd] ||
300 ! (ino = current->files->fd[fd]->f_dentry->d_inode) || 302 ! fdt->fd[fd]->f_dentry ||
303 ! (ino = fdt->fd[fd]->f_dentry->d_inode) ||
301 ! S_ISSOCK(ino->i_mode)) { 304 ! S_ISSOCK(ino->i_mode)) {
302 spin_unlock(&current->files->file_lock); 305 rcu_read_unlock();
303 return TBADF; 306 return TBADF;
304 } 307 }
305 spin_unlock(&current->files->file_lock); 308 rcu_read_unlock();
306 309
307 switch (cmd & 0xff) { 310 switch (cmd & 0xff) {
308 case 109: /* SI_SOCKPARAMS */ 311 case 109: /* SI_SOCKPARAMS */
diff --git a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c
index 022c80f43392..aaad29c35c83 100644
--- a/arch/sparc64/solaris/timod.c
+++ b/arch/sparc64/solaris/timod.c
@@ -143,9 +143,11 @@ static struct T_primsg *timod_mkctl(int size)
143static void timod_wake_socket(unsigned int fd) 143static void timod_wake_socket(unsigned int fd)
144{ 144{
145 struct socket *sock; 145 struct socket *sock;
146 struct fdtable *fdt;
146 147
147 SOLD("wakeing socket"); 148 SOLD("wakeing socket");
148 sock = SOCKET_I(current->files->fd[fd]->f_dentry->d_inode); 149 fdt = files_fdtable(current->files);
150 sock = SOCKET_I(fdt->fd[fd]->f_dentry->d_inode);
149 wake_up_interruptible(&sock->wait); 151 wake_up_interruptible(&sock->wait);
150 read_lock(&sock->sk->sk_callback_lock); 152 read_lock(&sock->sk->sk_callback_lock);
151 if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) 153 if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
@@ -157,9 +159,11 @@ static void timod_wake_socket(unsigned int fd)
157static void timod_queue(unsigned int fd, struct T_primsg *it) 159static void timod_queue(unsigned int fd, struct T_primsg *it)
158{ 160{
159 struct sol_socket_struct *sock; 161 struct sol_socket_struct *sock;
162 struct fdtable *fdt;
160 163
161 SOLD("queuing primsg"); 164 SOLD("queuing primsg");
162 sock = (struct sol_socket_struct *)current->files->fd[fd]->private_data; 165 fdt = files_fdtable(current->files);
166 sock = (struct sol_socket_struct *)fdt->fd[fd]->private_data;
163 it->next = sock->pfirst; 167 it->next = sock->pfirst;
164 sock->pfirst = it; 168 sock->pfirst = it;
165 if (!sock->plast) 169 if (!sock->plast)
@@ -171,9 +175,11 @@ static void timod_queue(unsigned int fd, struct T_primsg *it)
171static void timod_queue_end(unsigned int fd, struct T_primsg *it) 175static void timod_queue_end(unsigned int fd, struct T_primsg *it)
172{ 176{
173 struct sol_socket_struct *sock; 177 struct sol_socket_struct *sock;
178 struct fdtable *fdt;
174 179
175 SOLD("queuing primsg at end"); 180 SOLD("queuing primsg at end");
176 sock = (struct sol_socket_struct *)current->files->fd[fd]->private_data; 181 fdt = files_fdtable(current->files);
182 sock = (struct sol_socket_struct *)fdt->fd[fd]->private_data;
177 it->next = NULL; 183 it->next = NULL;
178 if (sock->plast) 184 if (sock->plast)
179 sock->plast->next = it; 185 sock->plast->next = it;
@@ -344,6 +350,7 @@ int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len,
344 char *buf; 350 char *buf;
345 struct file *filp; 351 struct file *filp;
346 struct inode *ino; 352 struct inode *ino;
353 struct fdtable *fdt;
347 struct sol_socket_struct *sock; 354 struct sol_socket_struct *sock;
348 mm_segment_t old_fs = get_fs(); 355 mm_segment_t old_fs = get_fs();
349 long args[6]; 356 long args[6];
@@ -351,7 +358,9 @@ int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len,
351 (int (*)(int, unsigned long __user *))SYS(socketcall); 358 (int (*)(int, unsigned long __user *))SYS(socketcall);
352 int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) = 359 int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) =
353 (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto); 360 (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto);
354 filp = current->files->fd[fd]; 361
362 fdt = files_fdtable(current->files);
363 filp = fdt->fd[fd];
355 ino = filp->f_dentry->d_inode; 364 ino = filp->f_dentry->d_inode;
356 sock = (struct sol_socket_struct *)filp->private_data; 365 sock = (struct sol_socket_struct *)filp->private_data;
357 SOLD("entry"); 366 SOLD("entry");
@@ -620,6 +629,7 @@ int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __us
620 int oldflags; 629 int oldflags;
621 struct file *filp; 630 struct file *filp;
622 struct inode *ino; 631 struct inode *ino;
632 struct fdtable *fdt;
623 struct sol_socket_struct *sock; 633 struct sol_socket_struct *sock;
624 struct T_unitdata_ind udi; 634 struct T_unitdata_ind udi;
625 mm_segment_t old_fs = get_fs(); 635 mm_segment_t old_fs = get_fs();
@@ -632,7 +642,8 @@ int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __us
632 642
633 SOLD("entry"); 643 SOLD("entry");
634 SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p)); 644 SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p));
635 filp = current->files->fd[fd]; 645 fdt = files_fdtable(current->files);
646 filp = fdt->fd[fd];
636 ino = filp->f_dentry->d_inode; 647 ino = filp->f_dentry->d_inode;
637 sock = (struct sol_socket_struct *)filp->private_data; 648 sock = (struct sol_socket_struct *)filp->private_data;
638 SOLDD(("%p %p\n", sock->pfirst, sock->pfirst ? sock->pfirst->next : NULL)); 649 SOLDD(("%p %p\n", sock->pfirst, sock->pfirst ? sock->pfirst->next : NULL));
@@ -844,12 +855,14 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
844 int __user *flgptr; 855 int __user *flgptr;
845 int flags; 856 int flags;
846 int error = -EBADF; 857 int error = -EBADF;
858 struct fdtable *fdt;
847 859
848 SOLD("entry"); 860 SOLD("entry");
849 lock_kernel(); 861 lock_kernel();
850 if(fd >= NR_OPEN) goto out; 862 if(fd >= NR_OPEN) goto out;
851 863
852 filp = current->files->fd[fd]; 864 fdt = files_fdtable(current->files);
865 filp = fdt->fd[fd];
853 if(!filp) goto out; 866 if(!filp) goto out;
854 867
855 ino = filp->f_dentry->d_inode; 868 ino = filp->f_dentry->d_inode;
@@ -910,12 +923,14 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
910 struct strbuf ctl, dat; 923 struct strbuf ctl, dat;
911 int flags = (int) arg3; 924 int flags = (int) arg3;
912 int error = -EBADF; 925 int error = -EBADF;
926 struct fdtable *fdt;
913 927
914 SOLD("entry"); 928 SOLD("entry");
915 lock_kernel(); 929 lock_kernel();
916 if(fd >= NR_OPEN) goto out; 930 if(fd >= NR_OPEN) goto out;
917 931
918 filp = current->files->fd[fd]; 932 fdt = files_fdtable(current->files);
933 filp = fdt->fd[fd];
919 if(!filp) goto out; 934 if(!filp) goto out;
920 935
921 ino = filp->f_dentry->d_inode; 936 ino = filp->f_dentry->d_inode;
diff --git a/arch/um/Makefile b/arch/um/Makefile
index b15f6048caae..ce987266dac6 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -103,12 +103,11 @@ endef
103 103
104ifneq ($(KBUILD_SRC),) 104ifneq ($(KBUILD_SRC),)
105$(shell mkdir -p $(ARCH_DIR) && ln -fsn $(srctree)/$(ARCH_DIR)/Kconfig.$(SUBARCH) $(ARCH_DIR)/Kconfig.arch) 105$(shell mkdir -p $(ARCH_DIR) && ln -fsn $(srctree)/$(ARCH_DIR)/Kconfig.$(SUBARCH) $(ARCH_DIR)/Kconfig.arch)
106CLEAN_FILES += $(ARCH_DIR)/Kconfig.arch
107else 106else
108$(shell cd $(ARCH_DIR) && ln -sf Kconfig.$(SUBARCH) Kconfig.arch) 107$(shell cd $(ARCH_DIR) && ln -sf Kconfig.$(SUBARCH) Kconfig.arch)
109endif 108endif
110 109
111prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) 110archprepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)
112 111
113LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static 112LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
114LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib 113LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
@@ -144,14 +143,14 @@ endef
144#TT or skas makefiles and don't clean skas_ptregs.h. 143#TT or skas makefiles and don't clean skas_ptregs.h.
145CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ 144CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
146 $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h \ 145 $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h \
147 $(ARCH_DIR)/include/user_constants.h 146 $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/Kconfig.arch
148 147
149MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \ 148MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
150 $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os \ 149 $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os
151 $(ARCH_DIR)/Kconfig.arch
152 150
153archclean: 151archclean:
154 $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/util 152 $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/util
153 $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/os-$(OS)/util
155 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ 154 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
156 -o -name '*.gcov' \) -type f -print | xargs rm -f 155 -o -name '*.gcov' \) -type f -print | xargs rm -f
157 156
@@ -197,6 +196,22 @@ define filechk_umlconfig
197 sed 's/ CONFIG/ UML_CONFIG/' 196 sed 's/ CONFIG/ UML_CONFIG/'
198endef 197endef
199 198
199define filechk_gen-asm-offsets
200 (set -e; \
201 echo "#ifndef __ASM_OFFSETS_H__"; \
202 echo "#define __ASM_OFFSETS_H__"; \
203 echo "/*"; \
204 echo " * DO NOT MODIFY."; \
205 echo " *"; \
206 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
207 echo " *"; \
208 echo " */"; \
209 echo ""; \
210 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
211 echo ""; \
212 echo "#endif" )
213endef
214
200$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h 215$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
201 $(call filechk,umlconfig) 216 $(call filechk,umlconfig)
202 217
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index baddb5d64ca5..436abbba409b 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -8,6 +8,7 @@ START := 0x60000000
8#it's needed for headers to work! 8#it's needed for headers to work!
9CFLAGS += -U__$(SUBARCH)__ -fno-builtin 9CFLAGS += -U__$(SUBARCH)__ -fno-builtin
10USER_CFLAGS += -fno-builtin 10USER_CFLAGS += -fno-builtin
11CHECKFLAGS += -m64
11 12
12ELF_ARCH := i386:x86-64 13ELF_ARCH := i386:x86-64
13ELF_FORMAT := elf64-x86-64 14ELF_FORMAT := elf64-x86-64
diff --git a/arch/um/include/mem.h b/arch/um/include/mem.h
index 99d3ad4a03e5..e8ff0d8fa610 100644
--- a/arch/um/include/mem.h
+++ b/arch/um/include/mem.h
@@ -13,7 +13,17 @@ extern int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w);
13extern int is_remapped(void *virt); 13extern int is_remapped(void *virt);
14extern int physmem_remove_mapping(void *virt); 14extern int physmem_remove_mapping(void *virt);
15extern void physmem_forget_descriptor(int fd); 15extern void physmem_forget_descriptor(int fd);
16extern unsigned long to_phys(void *virt); 16
17extern unsigned long uml_physmem;
18static inline unsigned long to_phys(void *virt)
19{
20 return(((unsigned long) virt) - uml_physmem);
21}
22
23static inline void *to_virt(unsigned long phys)
24{
25 return((void *) uml_physmem + phys);
26}
17 27
18#endif 28#endif
19 29
diff --git a/arch/um/kernel/asm-offsets.c b/arch/um/kernel/asm-offsets.c
new file mode 100644
index 000000000000..c13a64a288f6
--- /dev/null
+++ b/arch/um/kernel/asm-offsets.c
@@ -0,0 +1 @@
/* Dummy file to make kbuild happy - unused! */
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 3942a5f245de..2517ecb8bf27 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -146,37 +146,8 @@ SECTIONS
146 } 146 }
147 _end = .; 147 _end = .;
148 PROVIDE (end = .); 148 PROVIDE (end = .);
149 /* Stabs debugging sections. */ 149
150 .stab 0 : { *(.stab) } 150 STABS_DEBUG
151 .stabstr 0 : { *(.stabstr) } 151
152 .stab.excl 0 : { *(.stab.excl) } 152 DWARF_DEBUG
153 .stab.exclstr 0 : { *(.stab.exclstr) }
154 .stab.index 0 : { *(.stab.index) }
155 .stab.indexstr 0 : { *(.stab.indexstr) }
156 .comment 0 : { *(.comment) }
157 /* DWARF debug sections.
158 Symbols in the DWARF debugging sections are relative to the beginning
159 of the section so we begin them at 0. */
160 /* DWARF 1 */
161 .debug 0 : { *(.debug) }
162 .line 0 : { *(.line) }
163 /* GNU DWARF 1 extensions */
164 .debug_srcinfo 0 : { *(.debug_srcinfo) }
165 .debug_sfnames 0 : { *(.debug_sfnames) }
166 /* DWARF 1.1 and DWARF 2 */
167 .debug_aranges 0 : { *(.debug_aranges) }
168 .debug_pubnames 0 : { *(.debug_pubnames) }
169 /* DWARF 2 */
170 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
171 .debug_abbrev 0 : { *(.debug_abbrev) }
172 .debug_line 0 : { *(.debug_line) }
173 .debug_frame 0 : { *(.debug_frame) }
174 .debug_str 0 : { *(.debug_str) }
175 .debug_loc 0 : { *(.debug_loc) }
176 .debug_macinfo 0 : { *(.debug_macinfo) }
177 /* SGI/MIPS DWARF 2 extensions */
178 .debug_weaknames 0 : { *(.debug_weaknames) }
179 .debug_funcnames 0 : { *(.debug_funcnames) }
180 .debug_typenames 0 : { *(.debug_typenames) }
181 .debug_varnames 0 : { *(.debug_varnames) }
182} 153}
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 32d3076dd220..a97a72e516aa 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -34,14 +34,9 @@ EXPORT_SYMBOL(host_task_size);
34EXPORT_SYMBOL(arch_validate); 34EXPORT_SYMBOL(arch_validate);
35EXPORT_SYMBOL(get_kmem_end); 35EXPORT_SYMBOL(get_kmem_end);
36 36
37EXPORT_SYMBOL(page_to_phys);
38EXPORT_SYMBOL(phys_to_page);
39EXPORT_SYMBOL(high_physmem); 37EXPORT_SYMBOL(high_physmem);
40EXPORT_SYMBOL(empty_zero_page); 38EXPORT_SYMBOL(empty_zero_page);
41EXPORT_SYMBOL(um_virt_to_phys); 39EXPORT_SYMBOL(um_virt_to_phys);
42EXPORT_SYMBOL(__virt_to_page);
43EXPORT_SYMBOL(to_phys);
44EXPORT_SYMBOL(to_virt);
45EXPORT_SYMBOL(mode_tt); 40EXPORT_SYMBOL(mode_tt);
46EXPORT_SYMBOL(handle_page_fault); 41EXPORT_SYMBOL(handle_page_fault);
47EXPORT_SYMBOL(find_iomem); 42EXPORT_SYMBOL(find_iomem);
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index a24e3b7f4bf0..ea670fcc8af5 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -248,16 +248,6 @@ unsigned long high_physmem;
248 248
249extern unsigned long physmem_size; 249extern unsigned long physmem_size;
250 250
251void *to_virt(unsigned long phys)
252{
253 return((void *) uml_physmem + phys);
254}
255
256unsigned long to_phys(void *virt)
257{
258 return(((unsigned long) virt) - uml_physmem);
259}
260
261int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem) 251int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
262{ 252{
263 struct page *p, *map; 253 struct page *p, *map;
@@ -298,31 +288,6 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
298 return(0); 288 return(0);
299} 289}
300 290
301struct page *phys_to_page(const unsigned long phys)
302{
303 return(&mem_map[phys >> PAGE_SHIFT]);
304}
305
306struct page *__virt_to_page(const unsigned long virt)
307{
308 return(&mem_map[__pa(virt) >> PAGE_SHIFT]);
309}
310
311phys_t page_to_phys(struct page *page)
312{
313 return((page - mem_map) << PAGE_SHIFT);
314}
315
316pte_t mk_pte(struct page *page, pgprot_t pgprot)
317{
318 pte_t pte;
319
320 pte_set_val(pte, page_to_phys(page), pgprot);
321 if(pte_present(pte))
322 pte_mknewprot(pte_mknewpage(pte));
323 return(pte);
324}
325
326/* Changed during early boot */ 291/* Changed during early boot */
327static unsigned long kmem_top = 0; 292static unsigned long kmem_top = 0;
328 293
diff --git a/arch/um/kernel/skas/include/uaccess-skas.h b/arch/um/kernel/skas/include/uaccess-skas.h
index cd6c280482cb..6ee3f3902e68 100644
--- a/arch/um/kernel/skas/include/uaccess-skas.h
+++ b/arch/um/kernel/skas/include/uaccess-skas.h
@@ -18,18 +18,18 @@
18 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \ 18 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
19 ((unsigned long) (addr) + (size) >= (unsigned long)(addr)))) 19 ((unsigned long) (addr) + (size) >= (unsigned long)(addr))))
20 20
21static inline int verify_area_skas(int type, const void * addr, 21static inline int verify_area_skas(int type, const void __user * addr,
22 unsigned long size) 22 unsigned long size)
23{ 23{
24 return(access_ok_skas(type, addr, size) ? 0 : -EFAULT); 24 return(access_ok_skas(type, addr, size) ? 0 : -EFAULT);
25} 25}
26 26
27extern int copy_from_user_skas(void *to, const void *from, int n); 27extern int copy_from_user_skas(void *to, const void __user *from, int n);
28extern int copy_to_user_skas(void *to, const void *from, int n); 28extern int copy_to_user_skas(void __user *to, const void *from, int n);
29extern int strncpy_from_user_skas(char *dst, const char *src, int count); 29extern int strncpy_from_user_skas(char *dst, const char __user *src, int count);
30extern int __clear_user_skas(void *mem, int len); 30extern int __clear_user_skas(void __user *mem, int len);
31extern int clear_user_skas(void *mem, int len); 31extern int clear_user_skas(void __user *mem, int len);
32extern int strnlen_user_skas(const void *str, int len); 32extern int strnlen_user_skas(const void __user *str, int len);
33 33
34#endif 34#endif
35 35
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c
index b5fc89fe9eab..87cc6fd76ced 100644
--- a/arch/um/kernel/trap_kern.c
+++ b/arch/um/kernel/trap_kern.c
@@ -57,7 +57,8 @@ good_area:
57 if(is_write && !(vma->vm_flags & VM_WRITE)) 57 if(is_write && !(vma->vm_flags & VM_WRITE))
58 goto out; 58 goto out;
59 59
60 if(!(vma->vm_flags & (VM_READ | VM_EXEC))) 60 /* Don't require VM_READ|VM_EXEC for write faults! */
61 if(!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC)))
61 goto out; 62 goto out;
62 63
63 do { 64 do {
@@ -84,8 +85,7 @@ survive:
84 pte = pte_offset_kernel(pmd, address); 85 pte = pte_offset_kernel(pmd, address);
85 } while(!pte_present(*pte)); 86 } while(!pte_present(*pte));
86 err = 0; 87 err = 0;
87 *pte = pte_mkyoung(*pte); 88 WARN_ON(!pte_young(*pte) || (is_write && !pte_dirty(*pte)));
88 if(pte_write(*pte)) *pte = pte_mkdirty(*pte);
89 flush_tlb_page(vma, address); 89 flush_tlb_page(vma, address);
90out: 90out:
91 up_read(&mm->mmap_sem); 91 up_read(&mm->mmap_sem);
diff --git a/arch/um/kernel/tt/include/uaccess-tt.h b/arch/um/kernel/tt/include/uaccess-tt.h
index 3fbb5fe26f49..aa6db384af80 100644
--- a/arch/um/kernel/tt/include/uaccess-tt.h
+++ b/arch/um/kernel/tt/include/uaccess-tt.h
@@ -33,7 +33,7 @@ extern unsigned long uml_physmem;
33 (((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \ 33 (((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \
34 (under_task_size(addr, size) || is_stack(addr, size)))) 34 (under_task_size(addr, size) || is_stack(addr, size))))
35 35
36static inline int verify_area_tt(int type, const void * addr, 36static inline int verify_area_tt(int type, const void __user * addr,
37 unsigned long size) 37 unsigned long size)
38{ 38{
39 return(access_ok_tt(type, addr, size) ? 0 : -EFAULT); 39 return(access_ok_tt(type, addr, size) ? 0 : -EFAULT);
@@ -50,12 +50,12 @@ extern int __do_clear_user(void *mem, size_t len, void **fault_addr,
50extern int __do_strnlen_user(const char *str, unsigned long n, 50extern int __do_strnlen_user(const char *str, unsigned long n,
51 void **fault_addr, void **fault_catcher); 51 void **fault_addr, void **fault_catcher);
52 52
53extern int copy_from_user_tt(void *to, const void *from, int n); 53extern int copy_from_user_tt(void *to, const void __user *from, int n);
54extern int copy_to_user_tt(void *to, const void *from, int n); 54extern int copy_to_user_tt(void __user *to, const void *from, int n);
55extern int strncpy_from_user_tt(char *dst, const char *src, int count); 55extern int strncpy_from_user_tt(char *dst, const char __user *src, int count);
56extern int __clear_user_tt(void *mem, int len); 56extern int __clear_user_tt(void __user *mem, int len);
57extern int clear_user_tt(void *mem, int len); 57extern int clear_user_tt(void __user *mem, int len);
58extern int strnlen_user_tt(const void *str, int len); 58extern int strnlen_user_tt(const void __user *str, int len);
59 59
60#endif 60#endif
61 61
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index b03326d391c9..af11915ce0a8 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -93,14 +93,10 @@ SECTIONS
93 *(.bss) 93 *(.bss)
94 *(COMMON) 94 *(COMMON)
95 } 95 }
96 _end = . ; 96 _end = .;
97 PROVIDE (end = .); 97 PROVIDE (end = .);
98 /* Stabs debugging sections. */ 98
99 .stab 0 : { *(.stab) } 99 STABS_DEBUG
100 .stabstr 0 : { *(.stabstr) } 100
101 .stab.excl 0 : { *(.stab.excl) } 101 DWARF_DEBUG
102 .stab.exclstr 0 : { *(.stab.exclstr) }
103 .stab.index 0 : { *(.stab.index) }
104 .stab.indexstr 0 : { *(.stab.indexstr) }
105 .comment 0 : { *(.comment) }
106} 102}
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index 17f305b6bade..59a1291f477e 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -9,6 +9,11 @@ USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
9 9
10$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \ 10$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \
11 $(CFLAGS_$(notdir $@)) 11 $(CFLAGS_$(notdir $@))
12$(USER_OBJS): cmd_checksrc =
13$(USER_OBJS): quiet_cmd_checksrc =
14$(USER_OBJS): cmd_force_checksrc =
15$(USER_OBJS): quiet_cmd_force_checksrc =
16
12 17
13# The stubs and unmap.o can't try to call mcount or update basic block data 18# The stubs and unmap.o can't try to call mcount or update basic block data
14define unprofile 19define unprofile
diff --git a/arch/v850/Makefile b/arch/v850/Makefile
index bf38ca0ad781..8be9aacb20a7 100644
--- a/arch/v850/Makefile
+++ b/arch/v850/Makefile
@@ -51,16 +51,4 @@ root_fs_image_force: $(ROOT_FS_IMAGE)
51 $(OBJCOPY) $(OBJCOPY_FLAGS_BLOB) --rename-section .data=.root,alloc,load,readonly,data,contents $< root_fs_image.o 51 $(OBJCOPY) $(OBJCOPY_FLAGS_BLOB) --rename-section .data=.root,alloc,load,readonly,data,contents $< root_fs_image.o
52endif 52endif
53 53
54 54CLEAN_FILES += root_fs_image.o
55prepare: include/asm-$(ARCH)/asm-consts.h
56
57# Generate constants from C code for use by asm files
58arch/$(ARCH)/kernel/asm-consts.s: include/asm include/linux/version.h \
59 include/config/MARKER
60
61include/asm-$(ARCH)/asm-consts.h: arch/$(ARCH)/kernel/asm-consts.s
62 $(call filechk,gen-asm-offsets)
63
64CLEAN_FILES += include/asm-$(ARCH)/asm-consts.h \
65 arch/$(ARCH)/kernel/asm-consts.s \
66 root_fs_image.o
diff --git a/arch/v850/kernel/asm-consts.c b/arch/v850/kernel/asm-offsets.c
index 24f291369070..24f291369070 100644
--- a/arch/v850/kernel/asm-consts.c
+++ b/arch/v850/kernel/asm-offsets.c
diff --git a/arch/v850/kernel/entry.S b/arch/v850/kernel/entry.S
index 895e27b1d839..d991e4547dbb 100644
--- a/arch/v850/kernel/entry.S
+++ b/arch/v850/kernel/entry.S
@@ -22,7 +22,7 @@
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/errno.h> 23#include <asm/errno.h>
24 24
25#include <asm/asm-consts.h> 25#include <asm/asm-offsets.h>
26 26
27 27
28/* Make a slightly more convenient alias for C_SYMBOL_NAME. */ 28/* Make a slightly more convenient alias for C_SYMBOL_NAME. */
diff --git a/arch/v850/kernel/irq.c b/arch/v850/kernel/irq.c
index 336cbf21dc8f..9e85969ba976 100644
--- a/arch/v850/kernel/irq.c
+++ b/arch/v850/kernel/irq.c
@@ -67,13 +67,13 @@ static void ack_none(unsigned int irq)
67#define end_none enable_none 67#define end_none enable_none
68 68
69struct hw_interrupt_type no_irq_type = { 69struct hw_interrupt_type no_irq_type = {
70 "none", 70 .typename = "none",
71 startup_none, 71 .startup = startup_none,
72 shutdown_none, 72 .shutdown = shutdown_none,
73 enable_none, 73 .enable = enable_none,
74 disable_none, 74 .disable = disable_none,
75 ack_none, 75 .ack = ack_none,
76 end_none 76 .end = end_none
77}; 77};
78 78
79volatile unsigned long irq_err_count, spurious_count; 79volatile unsigned long irq_err_count, spurious_count;
diff --git a/arch/v850/kernel/setup.c b/arch/v850/kernel/setup.c
index abd48409dcca..62bdb8d29fc0 100644
--- a/arch/v850/kernel/setup.c
+++ b/arch/v850/kernel/setup.c
@@ -138,13 +138,13 @@ static void nmi_end (unsigned irq)
138} 138}
139 139
140static struct hw_interrupt_type nmi_irq_type = { 140static struct hw_interrupt_type nmi_irq_type = {
141 "NMI", 141 .typename = "NMI",
142 irq_zero, /* startup */ 142 .startup = irq_zero, /* startup */
143 irq_nop, /* shutdown */ 143 .shutdown = irq_nop, /* shutdown */
144 irq_nop, /* enable */ 144 .enable = irq_nop, /* enable */
145 irq_nop, /* disable */ 145 .disable = irq_nop, /* disable */
146 irq_nop, /* ack */ 146 .ack = irq_nop, /* ack */
147 nmi_end, /* end */ 147 .end = nmi_end, /* end */
148}; 148};
149 149
150void __init init_IRQ (void) 150void __init init_IRQ (void)
diff --git a/arch/v850/kernel/sim.c b/arch/v850/kernel/sim.c
index e2cc5580fa2a..17049aaa8f11 100644
--- a/arch/v850/kernel/sim.c
+++ b/arch/v850/kernel/sim.c
@@ -73,13 +73,13 @@ static void irq_nop (unsigned irq) { }
73static unsigned irq_zero (unsigned irq) { return 0; } 73static unsigned irq_zero (unsigned irq) { return 0; }
74 74
75static struct hw_interrupt_type sim_irq_type = { 75static struct hw_interrupt_type sim_irq_type = {
76 "IRQ", 76 .typename = "IRQ",
77 irq_zero, /* startup */ 77 .startup = irq_zero, /* startup */
78 irq_nop, /* shutdown */ 78 .shutdown = irq_nop, /* shutdown */
79 irq_nop, /* enable */ 79 .enable = irq_nop, /* enable */
80 irq_nop, /* disable */ 80 .disable = irq_nop, /* disable */
81 irq_nop, /* ack */ 81 .ack = irq_nop, /* ack */
82 irq_nop, /* end */ 82 .end = irq_nop, /* end */
83}; 83};
84 84
85void __init mach_init_irqs (void) 85void __init mach_init_irqs (void)
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 8f868b67ef0f..e63323e03ea9 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -152,7 +152,6 @@ config X86_CPUID
152 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to 152 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
153 /dev/cpu/31/cpuid. 153 /dev/cpu/31/cpuid.
154 154
155# disable it for opteron optimized builds because it pulls in ACPI_BOOT
156config X86_HT 155config X86_HT
157 bool 156 bool
158 depends on SMP && !MK8 157 depends on SMP && !MK8
@@ -474,7 +473,6 @@ config PCI_DIRECT
474config PCI_MMCONFIG 473config PCI_MMCONFIG
475 bool "Support mmconfig PCI config space access" 474 bool "Support mmconfig PCI config space access"
476 depends on PCI && ACPI 475 depends on PCI && ACPI
477 select ACPI_BOOT
478 476
479config UNORDERED_IO 477config UNORDERED_IO
480 bool "Unordered IO mapping access" 478 bool "Unordered IO mapping access"
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 4c6ed96d5f7c..a9cd42e61828 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -86,16 +86,6 @@ install fdimage fdimage144 fdimage288: vmlinux
86archclean: 86archclean:
87 $(Q)$(MAKE) $(clean)=$(boot) 87 $(Q)$(MAKE) $(clean)=$(boot)
88 88
89prepare: include/asm-$(ARCH)/offset.h
90
91arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
92 include/config/MARKER
93
94include/asm-$(ARCH)/offset.h: arch/$(ARCH)/kernel/asm-offsets.s
95 $(call filechk,gen-asm-offsets)
96
97CLEAN_FILES += include/asm-$(ARCH)/offset.h
98
99define archhelp 89define archhelp
100 echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' 90 echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)'
101 echo ' install - Install kernel using' 91 echo ' install - Install kernel using'
diff --git a/arch/x86_64/boot/Makefile b/arch/x86_64/boot/Makefile
index f4399c701b77..18c6e915d69b 100644
--- a/arch/x86_64/boot/Makefile
+++ b/arch/x86_64/boot/Makefile
@@ -46,7 +46,7 @@ cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
46$(obj)/bzImage: $(obj)/bootsect $(obj)/setup \ 46$(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
47 $(obj)/vmlinux.bin $(obj)/tools/build FORCE 47 $(obj)/vmlinux.bin $(obj)/tools/build FORCE
48 $(call if_changed,image) 48 $(call if_changed,image)
49 @echo 'Kernel: $@ is ready' 49 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
50 50
51$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE 51$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
52 $(call if_changed,objcopy) 52 $(call if_changed,objcopy)
diff --git a/arch/x86_64/boot/compressed/misc.c b/arch/x86_64/boot/compressed/misc.c
index b38d5b8b5fb8..0e10fd84c7cc 100644
--- a/arch/x86_64/boot/compressed/misc.c
+++ b/arch/x86_64/boot/compressed/misc.c
@@ -83,7 +83,7 @@ static unsigned char *real_mode; /* Pointer to real-mode data */
83#endif 83#endif
84#define SCREEN_INFO (*(struct screen_info *)(real_mode+0)) 84#define SCREEN_INFO (*(struct screen_info *)(real_mode+0))
85 85
86extern char input_data[]; 86extern unsigned char input_data[];
87extern int input_len; 87extern int input_len;
88 88
89static long bytes_out = 0; 89static long bytes_out = 0;
@@ -288,7 +288,7 @@ void setup_normal_output_buffer(void)
288#else 288#else
289 if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory"); 289 if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory");
290#endif 290#endif
291 output_data = (char *)__PHYSICAL_START; /* Normally Points to 1M */ 291 output_data = (unsigned char *)__PHYSICAL_START; /* Normally Points to 1M */
292 free_mem_end_ptr = (long)real_mode; 292 free_mem_end_ptr = (long)real_mode;
293} 293}
294 294
@@ -305,7 +305,7 @@ void setup_output_buffer_if_we_run_high(struct moveparams *mv)
305#else 305#else
306 if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory"); 306 if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory");
307#endif 307#endif
308 mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; 308 mv->low_buffer_start = output_data = (unsigned char *)LOW_BUFFER_START;
309 low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX 309 low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
310 ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff; 310 ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff;
311 low_buffer_size = low_buffer_end - LOW_BUFFER_START; 311 low_buffer_size = low_buffer_end - LOW_BUFFER_START;
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index b97a61e1c71c..f8db7e500fbf 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,11 +1,12 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.13-rc6-git3 3# Linux kernel version: 2.6.13-git11
4# Fri Aug 12 16:40:34 2005 4# Mon Sep 12 16:16:16 2005
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
8CONFIG_X86=y 8CONFIG_X86=y
9CONFIG_SEMAPHORE_SLEEPERS=y
9CONFIG_MMU=y 10CONFIG_MMU=y
10CONFIG_RWSEM_GENERIC_SPINLOCK=y 11CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_CALIBRATE_DELAY=y 12CONFIG_GENERIC_CALIBRATE_DELAY=y
@@ -13,6 +14,7 @@ CONFIG_X86_CMPXCHG=y
13CONFIG_EARLY_PRINTK=y 14CONFIG_EARLY_PRINTK=y
14CONFIG_GENERIC_ISA_DMA=y 15CONFIG_GENERIC_ISA_DMA=y
15CONFIG_GENERIC_IOMAP=y 16CONFIG_GENERIC_IOMAP=y
17CONFIG_ARCH_MAY_HAVE_PC_FDC=y
16 18
17# 19#
18# Code maturity level options 20# Code maturity level options
@@ -26,6 +28,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
26# General setup 28# General setup
27# 29#
28CONFIG_LOCALVERSION="" 30CONFIG_LOCALVERSION=""
31CONFIG_LOCALVERSION_AUTO=y
29CONFIG_SWAP=y 32CONFIG_SWAP=y
30CONFIG_SYSVIPC=y 33CONFIG_SYSVIPC=y
31CONFIG_POSIX_MQUEUE=y 34CONFIG_POSIX_MQUEUE=y
@@ -37,6 +40,7 @@ CONFIG_KOBJECT_UEVENT=y
37CONFIG_IKCONFIG=y 40CONFIG_IKCONFIG=y
38CONFIG_IKCONFIG_PROC=y 41CONFIG_IKCONFIG_PROC=y
39# CONFIG_CPUSETS is not set 42# CONFIG_CPUSETS is not set
43CONFIG_INITRAMFS_SOURCE=""
40# CONFIG_EMBEDDED is not set 44# CONFIG_EMBEDDED is not set
41CONFIG_KALLSYMS=y 45CONFIG_KALLSYMS=y
42CONFIG_KALLSYMS_ALL=y 46CONFIG_KALLSYMS_ALL=y
@@ -102,6 +106,7 @@ CONFIG_DISCONTIGMEM_MANUAL=y
102CONFIG_DISCONTIGMEM=y 106CONFIG_DISCONTIGMEM=y
103CONFIG_FLAT_NODE_MEM_MAP=y 107CONFIG_FLAT_NODE_MEM_MAP=y
104CONFIG_NEED_MULTIPLE_NODES=y 108CONFIG_NEED_MULTIPLE_NODES=y
109# CONFIG_SPARSEMEM_STATIC is not set
105CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 110CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
106CONFIG_HAVE_DEC_LOCK=y 111CONFIG_HAVE_DEC_LOCK=y
107CONFIG_NR_CPUS=32 112CONFIG_NR_CPUS=32
@@ -122,6 +127,7 @@ CONFIG_HZ=250
122CONFIG_GENERIC_HARDIRQS=y 127CONFIG_GENERIC_HARDIRQS=y
123CONFIG_GENERIC_IRQ_PROBE=y 128CONFIG_GENERIC_IRQ_PROBE=y
124CONFIG_ISA_DMA_API=y 129CONFIG_ISA_DMA_API=y
130CONFIG_GENERIC_PENDING_IRQ=y
125 131
126# 132#
127# Power management options 133# Power management options
@@ -135,8 +141,6 @@ CONFIG_PM_STD_PARTITION=""
135# ACPI (Advanced Configuration and Power Interface) Support 141# ACPI (Advanced Configuration and Power Interface) Support
136# 142#
137CONFIG_ACPI=y 143CONFIG_ACPI=y
138CONFIG_ACPI_BOOT=y
139CONFIG_ACPI_INTERPRETER=y
140CONFIG_ACPI_AC=y 144CONFIG_ACPI_AC=y
141CONFIG_ACPI_BATTERY=y 145CONFIG_ACPI_BATTERY=y
142CONFIG_ACPI_BUTTON=y 146CONFIG_ACPI_BUTTON=y
@@ -151,10 +155,8 @@ CONFIG_ACPI_NUMA=y
151CONFIG_ACPI_TOSHIBA=y 155CONFIG_ACPI_TOSHIBA=y
152CONFIG_ACPI_BLACKLIST_YEAR=2001 156CONFIG_ACPI_BLACKLIST_YEAR=2001
153# CONFIG_ACPI_DEBUG is not set 157# CONFIG_ACPI_DEBUG is not set
154CONFIG_ACPI_BUS=y
155CONFIG_ACPI_EC=y 158CONFIG_ACPI_EC=y
156CONFIG_ACPI_POWER=y 159CONFIG_ACPI_POWER=y
157CONFIG_ACPI_PCI=y
158CONFIG_ACPI_SYSTEM=y 160CONFIG_ACPI_SYSTEM=y
159# CONFIG_ACPI_CONTAINER is not set 161# CONFIG_ACPI_CONTAINER is not set
160 162
@@ -198,7 +200,6 @@ CONFIG_UNORDERED_IO=y
198# CONFIG_PCIEPORTBUS is not set 200# CONFIG_PCIEPORTBUS is not set
199CONFIG_PCI_MSI=y 201CONFIG_PCI_MSI=y
200# CONFIG_PCI_LEGACY_PROC is not set 202# CONFIG_PCI_LEGACY_PROC is not set
201# CONFIG_PCI_NAMES is not set
202# CONFIG_PCI_DEBUG is not set 203# CONFIG_PCI_DEBUG is not set
203 204
204# 205#
@@ -238,7 +239,10 @@ CONFIG_INET=y
238CONFIG_IP_MULTICAST=y 239CONFIG_IP_MULTICAST=y
239# CONFIG_IP_ADVANCED_ROUTER is not set 240# CONFIG_IP_ADVANCED_ROUTER is not set
240CONFIG_IP_FIB_HASH=y 241CONFIG_IP_FIB_HASH=y
241# CONFIG_IP_PNP is not set 242CONFIG_IP_PNP=y
243CONFIG_IP_PNP_DHCP=y
244# CONFIG_IP_PNP_BOOTP is not set
245# CONFIG_IP_PNP_RARP is not set
242# CONFIG_NET_IPIP is not set 246# CONFIG_NET_IPIP is not set
243# CONFIG_NET_IPGRE is not set 247# CONFIG_NET_IPGRE is not set
244# CONFIG_IP_MROUTE is not set 248# CONFIG_IP_MROUTE is not set
@@ -248,8 +252,8 @@ CONFIG_IP_FIB_HASH=y
248# CONFIG_INET_ESP is not set 252# CONFIG_INET_ESP is not set
249# CONFIG_INET_IPCOMP is not set 253# CONFIG_INET_IPCOMP is not set
250# CONFIG_INET_TUNNEL is not set 254# CONFIG_INET_TUNNEL is not set
251CONFIG_IP_TCPDIAG=y 255CONFIG_INET_DIAG=y
252CONFIG_IP_TCPDIAG_IPV6=y 256CONFIG_INET_TCP_DIAG=y
253# CONFIG_TCP_CONG_ADVANCED is not set 257# CONFIG_TCP_CONG_ADVANCED is not set
254CONFIG_TCP_CONG_BIC=y 258CONFIG_TCP_CONG_BIC=y
255CONFIG_IPV6=y 259CONFIG_IPV6=y
@@ -262,6 +266,11 @@ CONFIG_IPV6=y
262# CONFIG_NETFILTER is not set 266# CONFIG_NETFILTER is not set
263 267
264# 268#
269# DCCP Configuration (EXPERIMENTAL)
270#
271# CONFIG_IP_DCCP is not set
272
273#
265# SCTP Configuration (EXPERIMENTAL) 274# SCTP Configuration (EXPERIMENTAL)
266# 275#
267# CONFIG_IP_SCTP is not set 276# CONFIG_IP_SCTP is not set
@@ -284,9 +293,11 @@ CONFIG_IPV6=y
284# Network testing 293# Network testing
285# 294#
286# CONFIG_NET_PKTGEN is not set 295# CONFIG_NET_PKTGEN is not set
296# CONFIG_NETFILTER_NETLINK is not set
287# CONFIG_HAMRADIO is not set 297# CONFIG_HAMRADIO is not set
288# CONFIG_IRDA is not set 298# CONFIG_IRDA is not set
289# CONFIG_BT is not set 299# CONFIG_BT is not set
300# CONFIG_IEEE80211 is not set
290 301
291# 302#
292# Device Drivers 303# Device Drivers
@@ -333,7 +344,6 @@ CONFIG_BLK_DEV_RAM=y
333CONFIG_BLK_DEV_RAM_COUNT=16 344CONFIG_BLK_DEV_RAM_COUNT=16
334CONFIG_BLK_DEV_RAM_SIZE=4096 345CONFIG_BLK_DEV_RAM_SIZE=4096
335CONFIG_BLK_DEV_INITRD=y 346CONFIG_BLK_DEV_INITRD=y
336CONFIG_INITRAMFS_SOURCE=""
337CONFIG_LBD=y 347CONFIG_LBD=y
338# CONFIG_CDROM_PKTCDVD is not set 348# CONFIG_CDROM_PKTCDVD is not set
339 349
@@ -413,6 +423,7 @@ CONFIG_IDEDMA_AUTO=y
413# 423#
414# SCSI device support 424# SCSI device support
415# 425#
426# CONFIG_RAID_ATTRS is not set
416CONFIG_SCSI=y 427CONFIG_SCSI=y
417# CONFIG_SCSI_PROC_FS is not set 428# CONFIG_SCSI_PROC_FS is not set
418 429
@@ -436,7 +447,7 @@ CONFIG_BLK_DEV_SD=y
436# 447#
437# SCSI Transport Attributes 448# SCSI Transport Attributes
438# 449#
439# CONFIG_SCSI_SPI_ATTRS is not set 450CONFIG_SCSI_SPI_ATTRS=y
440# CONFIG_SCSI_FC_ATTRS is not set 451# CONFIG_SCSI_FC_ATTRS is not set
441# CONFIG_SCSI_ISCSI_ATTRS is not set 452# CONFIG_SCSI_ISCSI_ATTRS is not set
442 453
@@ -462,6 +473,7 @@ CONFIG_SCSI_SATA=y
462# CONFIG_SCSI_SATA_AHCI is not set 473# CONFIG_SCSI_SATA_AHCI is not set
463# CONFIG_SCSI_SATA_SVW is not set 474# CONFIG_SCSI_SATA_SVW is not set
464CONFIG_SCSI_ATA_PIIX=y 475CONFIG_SCSI_ATA_PIIX=y
476# CONFIG_SCSI_SATA_MV is not set
465# CONFIG_SCSI_SATA_NV is not set 477# CONFIG_SCSI_SATA_NV is not set
466# CONFIG_SCSI_SATA_PROMISE is not set 478# CONFIG_SCSI_SATA_PROMISE is not set
467# CONFIG_SCSI_SATA_QSTOR is not set 479# CONFIG_SCSI_SATA_QSTOR is not set
@@ -541,6 +553,11 @@ CONFIG_TUN=y
541# CONFIG_ARCNET is not set 553# CONFIG_ARCNET is not set
542 554
543# 555#
556# PHY device support
557#
558# CONFIG_PHYLIB is not set
559
560#
544# Ethernet (10 or 100Mbit) 561# Ethernet (10 or 100Mbit)
545# 562#
546CONFIG_NET_ETHERNET=y 563CONFIG_NET_ETHERNET=y
@@ -590,6 +607,7 @@ CONFIG_E1000=y
590# CONFIG_HAMACHI is not set 607# CONFIG_HAMACHI is not set
591# CONFIG_YELLOWFIN is not set 608# CONFIG_YELLOWFIN is not set
592# CONFIG_R8169 is not set 609# CONFIG_R8169 is not set
610# CONFIG_SIS190 is not set
593# CONFIG_SKGE is not set 611# CONFIG_SKGE is not set
594# CONFIG_SK98LIN is not set 612# CONFIG_SK98LIN is not set
595# CONFIG_VIA_VELOCITY is not set 613# CONFIG_VIA_VELOCITY is not set
@@ -599,6 +617,7 @@ CONFIG_TIGON3=y
599# 617#
600# Ethernet (10000 Mbit) 618# Ethernet (10000 Mbit)
601# 619#
620# CONFIG_CHELSIO_T1 is not set
602# CONFIG_IXGB is not set 621# CONFIG_IXGB is not set
603CONFIG_S2IO=m 622CONFIG_S2IO=m
604# CONFIG_S2IO_NAPI is not set 623# CONFIG_S2IO_NAPI is not set
@@ -753,7 +772,6 @@ CONFIG_MAX_RAW_DEVS=256
753# I2C support 772# I2C support
754# 773#
755# CONFIG_I2C is not set 774# CONFIG_I2C is not set
756# CONFIG_I2C_SENSOR is not set
757 775
758# 776#
759# Dallas's 1-wire bus 777# Dallas's 1-wire bus
@@ -764,6 +782,7 @@ CONFIG_MAX_RAW_DEVS=256
764# Hardware Monitoring support 782# Hardware Monitoring support
765# 783#
766CONFIG_HWMON=y 784CONFIG_HWMON=y
785# CONFIG_HWMON_VID is not set
767# CONFIG_HWMON_DEBUG_CHIP is not set 786# CONFIG_HWMON_DEBUG_CHIP is not set
768 787
769# 788#
@@ -772,6 +791,10 @@ CONFIG_HWMON=y
772# CONFIG_IBM_ASM is not set 791# CONFIG_IBM_ASM is not set
773 792
774# 793#
794# Multimedia Capabilities Port drivers
795#
796
797#
775# Multimedia devices 798# Multimedia devices
776# 799#
777# CONFIG_VIDEO_DEV is not set 800# CONFIG_VIDEO_DEV is not set
@@ -862,9 +885,8 @@ CONFIG_USB_UHCI_HCD=y
862# 885#
863# USB Device Class drivers 886# USB Device Class drivers
864# 887#
865# CONFIG_USB_AUDIO is not set 888# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
866# CONFIG_USB_BLUETOOTH_TTY is not set 889# CONFIG_USB_BLUETOOTH_TTY is not set
867# CONFIG_USB_MIDI is not set
868# CONFIG_USB_ACM is not set 890# CONFIG_USB_ACM is not set
869CONFIG_USB_PRINTER=y 891CONFIG_USB_PRINTER=y
870 892
@@ -881,6 +903,7 @@ CONFIG_USB_STORAGE=y
881# CONFIG_USB_STORAGE_SDDR09 is not set 903# CONFIG_USB_STORAGE_SDDR09 is not set
882# CONFIG_USB_STORAGE_SDDR55 is not set 904# CONFIG_USB_STORAGE_SDDR55 is not set
883# CONFIG_USB_STORAGE_JUMPSHOT is not set 905# CONFIG_USB_STORAGE_JUMPSHOT is not set
906# CONFIG_USB_STORAGE_ONETOUCH is not set
884 907
885# 908#
886# USB Input Devices 909# USB Input Devices
@@ -897,6 +920,7 @@ CONFIG_USB_HIDINPUT=y
897# CONFIG_USB_MTOUCH is not set 920# CONFIG_USB_MTOUCH is not set
898# CONFIG_USB_ITMTOUCH is not set 921# CONFIG_USB_ITMTOUCH is not set
899# CONFIG_USB_EGALAX is not set 922# CONFIG_USB_EGALAX is not set
923# CONFIG_USB_YEALINK is not set
900# CONFIG_USB_XPAD is not set 924# CONFIG_USB_XPAD is not set
901# CONFIG_USB_ATI_REMOTE is not set 925# CONFIG_USB_ATI_REMOTE is not set
902# CONFIG_USB_KEYSPAN_REMOTE is not set 926# CONFIG_USB_KEYSPAN_REMOTE is not set
@@ -980,6 +1004,8 @@ CONFIG_USB_MON=y
980# Firmware Drivers 1004# Firmware Drivers
981# 1005#
982# CONFIG_EDD is not set 1006# CONFIG_EDD is not set
1007# CONFIG_DELL_RBU is not set
1008CONFIG_DCDBAS=m
983 1009
984# 1010#
985# File systems 1011# File systems
@@ -1004,10 +1030,6 @@ CONFIG_REISERFS_FS_POSIX_ACL=y
1004# CONFIG_REISERFS_FS_SECURITY is not set 1030# CONFIG_REISERFS_FS_SECURITY is not set
1005# CONFIG_JFS_FS is not set 1031# CONFIG_JFS_FS is not set
1006CONFIG_FS_POSIX_ACL=y 1032CONFIG_FS_POSIX_ACL=y
1007
1008#
1009# XFS support
1010#
1011# CONFIG_XFS_FS is not set 1033# CONFIG_XFS_FS is not set
1012# CONFIG_MINIX_FS is not set 1034# CONFIG_MINIX_FS is not set
1013# CONFIG_ROMFS_FS is not set 1035# CONFIG_ROMFS_FS is not set
@@ -1016,6 +1038,7 @@ CONFIG_INOTIFY=y
1016CONFIG_DNOTIFY=y 1038CONFIG_DNOTIFY=y
1017CONFIG_AUTOFS_FS=y 1039CONFIG_AUTOFS_FS=y
1018# CONFIG_AUTOFS4_FS is not set 1040# CONFIG_AUTOFS4_FS is not set
1041# CONFIG_FUSE_FS is not set
1019 1042
1020# 1043#
1021# CD-ROM/DVD Filesystems 1044# CD-ROM/DVD Filesystems
@@ -1041,12 +1064,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1041CONFIG_PROC_FS=y 1064CONFIG_PROC_FS=y
1042CONFIG_PROC_KCORE=y 1065CONFIG_PROC_KCORE=y
1043CONFIG_SYSFS=y 1066CONFIG_SYSFS=y
1044# CONFIG_DEVPTS_FS_XATTR is not set
1045CONFIG_TMPFS=y 1067CONFIG_TMPFS=y
1046# CONFIG_TMPFS_XATTR is not set
1047CONFIG_HUGETLBFS=y 1068CONFIG_HUGETLBFS=y
1048CONFIG_HUGETLB_PAGE=y 1069CONFIG_HUGETLB_PAGE=y
1049CONFIG_RAMFS=y 1070CONFIG_RAMFS=y
1071# CONFIG_RELAYFS_FS is not set
1050 1072
1051# 1073#
1052# Miscellaneous filesystems 1074# Miscellaneous filesystems
@@ -1078,6 +1100,7 @@ CONFIG_NFSD_V3=y
1078# CONFIG_NFSD_V3_ACL is not set 1100# CONFIG_NFSD_V3_ACL is not set
1079# CONFIG_NFSD_V4 is not set 1101# CONFIG_NFSD_V4 is not set
1080CONFIG_NFSD_TCP=y 1102CONFIG_NFSD_TCP=y
1103CONFIG_ROOT_NFS=y
1081CONFIG_LOCKD=y 1104CONFIG_LOCKD=y
1082CONFIG_LOCKD_V4=y 1105CONFIG_LOCKD_V4=y
1083CONFIG_EXPORTFS=y 1106CONFIG_EXPORTFS=y
@@ -1090,6 +1113,7 @@ CONFIG_SUNRPC=y
1090# CONFIG_NCP_FS is not set 1113# CONFIG_NCP_FS is not set
1091# CONFIG_CODA_FS is not set 1114# CONFIG_CODA_FS is not set
1092# CONFIG_AFS_FS is not set 1115# CONFIG_AFS_FS is not set
1116# CONFIG_9P_FS is not set
1093 1117
1094# 1118#
1095# Partition Types 1119# Partition Types
@@ -1154,6 +1178,7 @@ CONFIG_OPROFILE=y
1154CONFIG_DEBUG_KERNEL=y 1178CONFIG_DEBUG_KERNEL=y
1155CONFIG_MAGIC_SYSRQ=y 1179CONFIG_MAGIC_SYSRQ=y
1156CONFIG_LOG_BUF_SHIFT=18 1180CONFIG_LOG_BUF_SHIFT=18
1181CONFIG_DETECT_SOFTLOCKUP=y
1157# CONFIG_SCHEDSTATS is not set 1182# CONFIG_SCHEDSTATS is not set
1158# CONFIG_DEBUG_SLAB is not set 1183# CONFIG_DEBUG_SLAB is not set
1159# CONFIG_DEBUG_SPINLOCK is not set 1184# CONFIG_DEBUG_SPINLOCK is not set
@@ -1161,6 +1186,7 @@ CONFIG_LOG_BUF_SHIFT=18
1161# CONFIG_DEBUG_KOBJECT is not set 1186# CONFIG_DEBUG_KOBJECT is not set
1162# CONFIG_DEBUG_INFO is not set 1187# CONFIG_DEBUG_INFO is not set
1163CONFIG_DEBUG_FS=y 1188CONFIG_DEBUG_FS=y
1189# CONFIG_FRAME_POINTER is not set
1164CONFIG_INIT_DEBUG=y 1190CONFIG_INIT_DEBUG=y
1165# CONFIG_IOMMU_DEBUG is not set 1191# CONFIG_IOMMU_DEBUG is not set
1166CONFIG_KPROBES=y 1192CONFIG_KPROBES=y
@@ -1184,5 +1210,6 @@ CONFIG_KPROBES=y
1184# Library routines 1210# Library routines
1185# 1211#
1186# CONFIG_CRC_CCITT is not set 1212# CONFIG_CRC_CCITT is not set
1213# CONFIG_CRC16 is not set
1187CONFIG_CRC32=y 1214CONFIG_CRC32=y
1188# CONFIG_LIBCRC32C is not set 1215# CONFIG_LIBCRC32C is not set
diff --git a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c
index d259f8a6f811..419758f19ca4 100644
--- a/arch/x86_64/ia32/ia32_ioctl.c
+++ b/arch/x86_64/ia32/ia32_ioctl.c
@@ -24,17 +24,26 @@
24static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr) 24static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr)
25{ 25{
26 26
27 struct file *file = fget(fd); 27 struct file *file;
28 struct tty_struct *real_tty; 28 struct tty_struct *real_tty;
29 int fput_needed, ret;
29 30
31 file = fget_light(fd, &fput_needed);
30 if (!file) 32 if (!file)
31 return -EBADF; 33 return -EBADF;
34
35 ret = -EINVAL;
32 if (file->f_op->ioctl != tty_ioctl) 36 if (file->f_op->ioctl != tty_ioctl)
33 return -EINVAL; 37 goto out;
34 real_tty = (struct tty_struct *)file->private_data; 38 real_tty = (struct tty_struct *)file->private_data;
35 if (!real_tty) 39 if (!real_tty)
36 return -EINVAL; 40 goto out;
37 return put_user(new_encode_dev(tty_devnum(real_tty)), ptr); 41
42 ret = put_user(new_encode_dev(tty_devnum(real_tty)), ptr);
43
44out:
45 fput_light(file, fput_needed);
46 return ret;
38} 47}
39 48
40#define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */ 49#define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index f174083d5567..e0eb0c712fe9 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -6,7 +6,7 @@
6 6
7#include <asm/dwarf2.h> 7#include <asm/dwarf2.h>
8#include <asm/calling.h> 8#include <asm/calling.h>
9#include <asm/offset.h> 9#include <asm/asm-offsets.h>
10#include <asm/current.h> 10#include <asm/current.h>
11#include <asm/errno.h> 11#include <asm/errno.h>
12#include <asm/ia32_unistd.h> 12#include <asm/ia32_unistd.h>
@@ -55,20 +55,34 @@
55 * with the int 0x80 path. 55 * with the int 0x80 path.
56 */ 56 */
57ENTRY(ia32_sysenter_target) 57ENTRY(ia32_sysenter_target)
58 CFI_STARTPROC 58 CFI_STARTPROC simple
59 CFI_DEF_CFA rsp,0
60 CFI_REGISTER rsp,rbp
59 swapgs 61 swapgs
60 movq %gs:pda_kernelstack, %rsp 62 movq %gs:pda_kernelstack, %rsp
61 addq $(PDA_STACKOFFSET),%rsp 63 addq $(PDA_STACKOFFSET),%rsp
62 sti 64 sti
63 movl %ebp,%ebp /* zero extension */ 65 movl %ebp,%ebp /* zero extension */
64 pushq $__USER32_DS 66 pushq $__USER32_DS
67 CFI_ADJUST_CFA_OFFSET 8
68 /*CFI_REL_OFFSET ss,0*/
65 pushq %rbp 69 pushq %rbp
70 CFI_ADJUST_CFA_OFFSET 8
71 CFI_REL_OFFSET rsp,0
66 pushfq 72 pushfq
73 CFI_ADJUST_CFA_OFFSET 8
74 /*CFI_REL_OFFSET rflags,0*/
67 movl $VSYSCALL32_SYSEXIT, %r10d 75 movl $VSYSCALL32_SYSEXIT, %r10d
76 CFI_REGISTER rip,r10
68 pushq $__USER32_CS 77 pushq $__USER32_CS
78 CFI_ADJUST_CFA_OFFSET 8
79 /*CFI_REL_OFFSET cs,0*/
69 movl %eax, %eax 80 movl %eax, %eax
70 pushq %r10 81 pushq %r10
82 CFI_ADJUST_CFA_OFFSET 8
83 CFI_REL_OFFSET rip,0
71 pushq %rax 84 pushq %rax
85 CFI_ADJUST_CFA_OFFSET 8
72 cld 86 cld
73 SAVE_ARGS 0,0,1 87 SAVE_ARGS 0,0,1
74 /* no need to do an access_ok check here because rbp has been 88 /* no need to do an access_ok check here because rbp has been
@@ -79,6 +93,7 @@ ENTRY(ia32_sysenter_target)
79 .previous 93 .previous
80 GET_THREAD_INFO(%r10) 94 GET_THREAD_INFO(%r10)
81 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 95 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
96 CFI_REMEMBER_STATE
82 jnz sysenter_tracesys 97 jnz sysenter_tracesys
83sysenter_do_call: 98sysenter_do_call:
84 cmpl $(IA32_NR_syscalls),%eax 99 cmpl $(IA32_NR_syscalls),%eax
@@ -94,14 +109,20 @@ sysenter_do_call:
94 andl $~0x200,EFLAGS-R11(%rsp) 109 andl $~0x200,EFLAGS-R11(%rsp)
95 RESTORE_ARGS 1,24,1,1,1,1 110 RESTORE_ARGS 1,24,1,1,1,1
96 popfq 111 popfq
112 CFI_ADJUST_CFA_OFFSET -8
113 /*CFI_RESTORE rflags*/
97 popq %rcx /* User %esp */ 114 popq %rcx /* User %esp */
115 CFI_ADJUST_CFA_OFFSET -8
116 CFI_REGISTER rsp,rcx
98 movl $VSYSCALL32_SYSEXIT,%edx /* User %eip */ 117 movl $VSYSCALL32_SYSEXIT,%edx /* User %eip */
118 CFI_REGISTER rip,rdx
99 swapgs 119 swapgs
100 sti /* sti only takes effect after the next instruction */ 120 sti /* sti only takes effect after the next instruction */
101 /* sysexit */ 121 /* sysexit */
102 .byte 0xf, 0x35 122 .byte 0xf, 0x35
103 123
104sysenter_tracesys: 124sysenter_tracesys:
125 CFI_RESTORE_STATE
105 SAVE_REST 126 SAVE_REST
106 CLEAR_RREGS 127 CLEAR_RREGS
107 movq $-ENOSYS,RAX(%rsp) /* really needed? */ 128 movq $-ENOSYS,RAX(%rsp) /* really needed? */
@@ -140,21 +161,28 @@ sysenter_tracesys:
140 * with the int 0x80 path. 161 * with the int 0x80 path.
141 */ 162 */
142ENTRY(ia32_cstar_target) 163ENTRY(ia32_cstar_target)
143 CFI_STARTPROC 164 CFI_STARTPROC simple
165 CFI_DEF_CFA rsp,0
166 CFI_REGISTER rip,rcx
167 /*CFI_REGISTER rflags,r11*/
144 swapgs 168 swapgs
145 movl %esp,%r8d 169 movl %esp,%r8d
170 CFI_REGISTER rsp,r8
146 movq %gs:pda_kernelstack,%rsp 171 movq %gs:pda_kernelstack,%rsp
147 sti 172 sti
148 SAVE_ARGS 8,1,1 173 SAVE_ARGS 8,1,1
149 movl %eax,%eax /* zero extension */ 174 movl %eax,%eax /* zero extension */
150 movq %rax,ORIG_RAX-ARGOFFSET(%rsp) 175 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
151 movq %rcx,RIP-ARGOFFSET(%rsp) 176 movq %rcx,RIP-ARGOFFSET(%rsp)
177 CFI_REL_OFFSET rip,RIP-ARGOFFSET
152 movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */ 178 movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */
153 movl %ebp,%ecx 179 movl %ebp,%ecx
154 movq $__USER32_CS,CS-ARGOFFSET(%rsp) 180 movq $__USER32_CS,CS-ARGOFFSET(%rsp)
155 movq $__USER32_DS,SS-ARGOFFSET(%rsp) 181 movq $__USER32_DS,SS-ARGOFFSET(%rsp)
156 movq %r11,EFLAGS-ARGOFFSET(%rsp) 182 movq %r11,EFLAGS-ARGOFFSET(%rsp)
183 /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
157 movq %r8,RSP-ARGOFFSET(%rsp) 184 movq %r8,RSP-ARGOFFSET(%rsp)
185 CFI_REL_OFFSET rsp,RSP-ARGOFFSET
158 /* no need to do an access_ok check here because r8 has been 186 /* no need to do an access_ok check here because r8 has been
159 32bit zero extended */ 187 32bit zero extended */
160 /* hardware stack frame is complete now */ 188 /* hardware stack frame is complete now */
@@ -164,6 +192,7 @@ ENTRY(ia32_cstar_target)
164 .previous 192 .previous
165 GET_THREAD_INFO(%r10) 193 GET_THREAD_INFO(%r10)
166 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 194 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
195 CFI_REMEMBER_STATE
167 jnz cstar_tracesys 196 jnz cstar_tracesys
168cstar_do_call: 197cstar_do_call:
169 cmpl $IA32_NR_syscalls,%eax 198 cmpl $IA32_NR_syscalls,%eax
@@ -177,12 +206,16 @@ cstar_do_call:
177 jnz int_ret_from_sys_call 206 jnz int_ret_from_sys_call
178 RESTORE_ARGS 1,-ARG_SKIP,1,1,1 207 RESTORE_ARGS 1,-ARG_SKIP,1,1,1
179 movl RIP-ARGOFFSET(%rsp),%ecx 208 movl RIP-ARGOFFSET(%rsp),%ecx
209 CFI_REGISTER rip,rcx
180 movl EFLAGS-ARGOFFSET(%rsp),%r11d 210 movl EFLAGS-ARGOFFSET(%rsp),%r11d
211 /*CFI_REGISTER rflags,r11*/
181 movl RSP-ARGOFFSET(%rsp),%esp 212 movl RSP-ARGOFFSET(%rsp),%esp
213 CFI_RESTORE rsp
182 swapgs 214 swapgs
183 sysretl 215 sysretl
184 216
185cstar_tracesys: 217cstar_tracesys:
218 CFI_RESTORE_STATE
186 SAVE_REST 219 SAVE_REST
187 CLEAR_RREGS 220 CLEAR_RREGS
188 movq $-ENOSYS,RAX(%rsp) /* really needed? */ 221 movq $-ENOSYS,RAX(%rsp) /* really needed? */
@@ -226,11 +259,18 @@ ia32_badarg:
226 */ 259 */
227 260
228ENTRY(ia32_syscall) 261ENTRY(ia32_syscall)
229 CFI_STARTPROC 262 CFI_STARTPROC simple
263 CFI_DEF_CFA rsp,SS+8-RIP
264 /*CFI_REL_OFFSET ss,SS-RIP*/
265 CFI_REL_OFFSET rsp,RSP-RIP
266 /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/
267 /*CFI_REL_OFFSET cs,CS-RIP*/
268 CFI_REL_OFFSET rip,RIP-RIP
230 swapgs 269 swapgs
231 sti 270 sti
232 movl %eax,%eax 271 movl %eax,%eax
233 pushq %rax 272 pushq %rax
273 CFI_ADJUST_CFA_OFFSET 8
234 cld 274 cld
235 /* note the registers are not zero extended to the sf. 275 /* note the registers are not zero extended to the sf.
236 this could be a problem. */ 276 this could be a problem. */
@@ -278,6 +318,8 @@ quiet_ni_syscall:
278 jmp ia32_ptregs_common 318 jmp ia32_ptregs_common
279 .endm 319 .endm
280 320
321 CFI_STARTPROC
322
281 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi 323 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi
282 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi 324 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi
283 PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx 325 PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx
@@ -290,8 +332,9 @@ quiet_ni_syscall:
290 PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx 332 PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx
291 333
292ENTRY(ia32_ptregs_common) 334ENTRY(ia32_ptregs_common)
293 CFI_STARTPROC
294 popq %r11 335 popq %r11
336 CFI_ADJUST_CFA_OFFSET -8
337 CFI_REGISTER rip, r11
295 SAVE_REST 338 SAVE_REST
296 call *%rax 339 call *%rax
297 RESTORE_REST 340 RESTORE_REST
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index 04d80406ce4f..5389df610e78 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -751,7 +751,7 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
751 ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); 751 ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
752 set_fs(old_fs); 752 set_fs(old_fs);
753 753
754 if (!ret && offset && put_user(of, offset)) 754 if (offset && put_user(of, offset))
755 return -EFAULT; 755 return -EFAULT;
756 756
757 return ret; 757 return ret;
diff --git a/arch/x86_64/ia32/vsyscall-syscall.S b/arch/x86_64/ia32/vsyscall-syscall.S
index e2aaf3de8a42..b024965bb689 100644
--- a/arch/x86_64/ia32/vsyscall-syscall.S
+++ b/arch/x86_64/ia32/vsyscall-syscall.S
@@ -3,7 +3,7 @@
3 */ 3 */
4 4
5#include <asm/ia32_unistd.h> 5#include <asm/ia32_unistd.h>
6#include <asm/offset.h> 6#include <asm/asm-offsets.h>
7#include <asm/segment.h> 7#include <asm/segment.h>
8 8
9 .text 9 .text
diff --git a/arch/x86_64/ia32/vsyscall-sysenter.S b/arch/x86_64/ia32/vsyscall-sysenter.S
index 8fb8e0ff3afa..71f3de586b56 100644
--- a/arch/x86_64/ia32/vsyscall-sysenter.S
+++ b/arch/x86_64/ia32/vsyscall-sysenter.S
@@ -3,7 +3,7 @@
3 */ 3 */
4 4
5#include <asm/ia32_unistd.h> 5#include <asm/ia32_unistd.h>
6#include <asm/offset.h> 6#include <asm/asm-offsets.h>
7 7
8 .text 8 .text
9 .section .text.vsyscall,"ax" 9 .section .text.vsyscall,"ax"
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index c32e198d7b2b..bcdd0a805fe7 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -12,7 +12,7 @@ obj-y := process.o signal.o entry.o traps.o irq.o \
12obj-$(CONFIG_X86_MCE) += mce.o 12obj-$(CONFIG_X86_MCE) += mce.o
13obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o 13obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o
14obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/ 14obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/
15obj-$(CONFIG_ACPI_BOOT) += acpi/ 15obj-$(CONFIG_ACPI) += acpi/
16obj-$(CONFIG_X86_MSR) += msr.o 16obj-$(CONFIG_X86_MSR) += msr.o
17obj-$(CONFIG_MICROCODE) += microcode.o 17obj-$(CONFIG_MICROCODE) += microcode.o
18obj-$(CONFIG_X86_CPUID) += cpuid.o 18obj-$(CONFIG_X86_CPUID) += cpuid.o
@@ -46,3 +46,4 @@ microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
46intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o 46intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
47quirks-y += ../../i386/kernel/quirks.o 47quirks-y += ../../i386/kernel/quirks.o
48i8237-y += ../../i386/kernel/i8237.o 48i8237-y += ../../i386/kernel/i8237.o
49msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile
index d2c2ee5f9a88..7da9ace890bd 100644
--- a/arch/x86_64/kernel/acpi/Makefile
+++ b/arch/x86_64/kernel/acpi/Makefile
@@ -1,3 +1,3 @@
1obj-$(CONFIG_ACPI_BOOT) := boot.o 1obj-y := boot.o
2boot-$(CONFIG_ACPI_BOOT) := ../../../i386/kernel/acpi/boot.o 2boot-y := ../../../i386/kernel/acpi/boot.o
3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o 3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c
index 7a275de6df22..867a0ebee177 100644
--- a/arch/x86_64/kernel/acpi/sleep.c
+++ b/arch/x86_64/kernel/acpi/sleep.c
@@ -34,7 +34,6 @@
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/bootmem.h> 36#include <linux/bootmem.h>
37#include <linux/irq.h>
38#include <linux/acpi.h> 37#include <linux/acpi.h>
39#include <asm/mpspec.h> 38#include <asm/mpspec.h>
40#include <asm/io.h> 39#include <asm/io.h>
@@ -47,7 +46,6 @@
47#include <asm/proto.h> 46#include <asm/proto.h>
48#include <asm/tlbflush.h> 47#include <asm/tlbflush.h>
49 48
50
51/* -------------------------------------------------------------------------- 49/* --------------------------------------------------------------------------
52 Low-Level Sleep Support 50 Low-Level Sleep Support
53 -------------------------------------------------------------------------- */ 51 -------------------------------------------------------------------------- */
@@ -77,11 +75,12 @@ static void init_low_mapping(void)
77 * Create an identity mapped page table and copy the wakeup routine to 75 * Create an identity mapped page table and copy the wakeup routine to
78 * low memory. 76 * low memory.
79 */ 77 */
80int acpi_save_state_mem (void) 78int acpi_save_state_mem(void)
81{ 79{
82 init_low_mapping(); 80 init_low_mapping();
83 81
84 memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start); 82 memcpy((void *)acpi_wakeup_address, &wakeup_start,
83 &wakeup_end - &wakeup_start);
85 acpi_copy_wakeup_routine(acpi_wakeup_address); 84 acpi_copy_wakeup_routine(acpi_wakeup_address);
86 85
87 return 0; 86 return 0;
@@ -90,7 +89,7 @@ int acpi_save_state_mem (void)
90/* 89/*
91 * acpi_restore_state 90 * acpi_restore_state
92 */ 91 */
93void acpi_restore_state_mem (void) 92void acpi_restore_state_mem(void)
94{ 93{
95 set_pgd(pgd_offset(current->mm, 0UL), low_ptr); 94 set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
96 flush_tlb_all(); 95 flush_tlb_all();
@@ -108,7 +107,8 @@ void __init acpi_reserve_bootmem(void)
108{ 107{
109 acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE); 108 acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
110 if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) 109 if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
111 printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n"); 110 printk(KERN_CRIT
111 "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
112} 112}
113 113
114static int __init acpi_sleep_setup(char *str) 114static int __init acpi_sleep_setup(char *str)
@@ -127,6 +127,8 @@ static int __init acpi_sleep_setup(char *str)
127 127
128__setup("acpi_sleep=", acpi_sleep_setup); 128__setup("acpi_sleep=", acpi_sleep_setup);
129 129
130#endif /*CONFIG_ACPI_SLEEP*/ 130#endif /*CONFIG_ACPI_SLEEP */
131 131
132void acpi_pci_link_exit(void) {} 132void acpi_pci_link_exit(void)
133{
134}
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c
index c9a6b812e926..962ad4823b6a 100644
--- a/arch/x86_64/kernel/aperture.c
+++ b/arch/x86_64/kernel/aperture.c
@@ -245,6 +245,8 @@ void __init iommu_hole_init(void)
245 245
246 if (aper_alloc) { 246 if (aper_alloc) {
247 /* Got the aperture from the AGP bridge */ 247 /* Got the aperture from the AGP bridge */
248 } else if (swiotlb && !valid_agp) {
249 /* Do nothing */
248 } else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) || 250 } else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) ||
249 force_iommu || 251 force_iommu ||
250 valid_agp || 252 valid_agp ||
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 375d369570ca..b6e7715d877f 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -18,7 +18,6 @@
18#include <linux/init.h> 18#include <linux/init.h>
19 19
20#include <linux/mm.h> 20#include <linux/mm.h>
21#include <linux/irq.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <linux/bootmem.h> 22#include <linux/bootmem.h>
24#include <linux/smp_lock.h> 23#include <linux/smp_lock.h>
@@ -109,11 +108,8 @@ void clear_local_APIC(void)
109 if (maxlvt >= 4) 108 if (maxlvt >= 4)
110 apic_write_around(APIC_LVTPC, APIC_LVT_MASKED); 109 apic_write_around(APIC_LVTPC, APIC_LVT_MASKED);
111 v = GET_APIC_VERSION(apic_read(APIC_LVR)); 110 v = GET_APIC_VERSION(apic_read(APIC_LVR));
112 if (APIC_INTEGRATED(v)) { /* !82489DX */ 111 apic_write(APIC_ESR, 0);
113 if (maxlvt > 3) /* Due to Pentium errata 3AP and 11AP. */ 112 apic_read(APIC_ESR);
114 apic_write(APIC_ESR, 0);
115 apic_read(APIC_ESR);
116 }
117} 113}
118 114
119void __init connect_bsp_APIC(void) 115void __init connect_bsp_APIC(void)
@@ -316,8 +312,6 @@ void __init init_bsp_APIC(void)
316 */ 312 */
317 apic_write_around(APIC_LVT0, APIC_DM_EXTINT); 313 apic_write_around(APIC_LVT0, APIC_DM_EXTINT);
318 value = APIC_DM_NMI; 314 value = APIC_DM_NMI;
319 if (!APIC_INTEGRATED(ver)) /* 82489DX */
320 value |= APIC_LVT_LEVEL_TRIGGER;
321 apic_write_around(APIC_LVT1, value); 315 apic_write_around(APIC_LVT1, value);
322} 316}
323 317
@@ -325,14 +319,6 @@ void __cpuinit setup_local_APIC (void)
325{ 319{
326 unsigned int value, ver, maxlvt; 320 unsigned int value, ver, maxlvt;
327 321
328 /* Pound the ESR really hard over the head with a big hammer - mbligh */
329 if (esr_disable) {
330 apic_write(APIC_ESR, 0);
331 apic_write(APIC_ESR, 0);
332 apic_write(APIC_ESR, 0);
333 apic_write(APIC_ESR, 0);
334 }
335
336 value = apic_read(APIC_LVR); 322 value = apic_read(APIC_LVR);
337 ver = GET_APIC_VERSION(value); 323 ver = GET_APIC_VERSION(value);
338 324
@@ -430,15 +416,11 @@ void __cpuinit setup_local_APIC (void)
430 value = APIC_DM_NMI; 416 value = APIC_DM_NMI;
431 else 417 else
432 value = APIC_DM_NMI | APIC_LVT_MASKED; 418 value = APIC_DM_NMI | APIC_LVT_MASKED;
433 if (!APIC_INTEGRATED(ver)) /* 82489DX */
434 value |= APIC_LVT_LEVEL_TRIGGER;
435 apic_write_around(APIC_LVT1, value); 419 apic_write_around(APIC_LVT1, value);
436 420
437 if (APIC_INTEGRATED(ver) && !esr_disable) { /* !82489DX */ 421 {
438 unsigned oldvalue; 422 unsigned oldvalue;
439 maxlvt = get_maxlvt(); 423 maxlvt = get_maxlvt();
440 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
441 apic_write(APIC_ESR, 0);
442 oldvalue = apic_read(APIC_ESR); 424 oldvalue = apic_read(APIC_ESR);
443 value = ERROR_APIC_VECTOR; // enables sending errors 425 value = ERROR_APIC_VECTOR; // enables sending errors
444 apic_write_around(APIC_LVTERR, value); 426 apic_write_around(APIC_LVTERR, value);
@@ -452,17 +434,6 @@ void __cpuinit setup_local_APIC (void)
452 apic_printk(APIC_VERBOSE, 434 apic_printk(APIC_VERBOSE,
453 "ESR value after enabling vector: %08x, after %08x\n", 435 "ESR value after enabling vector: %08x, after %08x\n",
454 oldvalue, value); 436 oldvalue, value);
455 } else {
456 if (esr_disable)
457 /*
458 * Something untraceble is creating bad interrupts on
459 * secondary quads ... for the moment, just leave the
460 * ESR disabled - we can't do anything useful with the
461 * errors anyway - mbligh
462 */
463 apic_printk(APIC_DEBUG, "Leaving ESR disabled.\n");
464 else
465 apic_printk(APIC_DEBUG, "No ESR for 82489DX.\n");
466 } 437 }
467 438
468 nmi_watchdog_default(); 439 nmi_watchdog_default();
@@ -650,8 +621,7 @@ void __init init_apic_mappings(void)
650 * Fetch the APIC ID of the BSP in case we have a 621 * Fetch the APIC ID of the BSP in case we have a
651 * default configuration (or the MP table is broken). 622 * default configuration (or the MP table is broken).
652 */ 623 */
653 if (boot_cpu_id == -1U) 624 boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID));
654 boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID));
655 625
656#ifdef CONFIG_X86_IO_APIC 626#ifdef CONFIG_X86_IO_APIC
657 { 627 {
@@ -693,8 +663,6 @@ static void __setup_APIC_LVTT(unsigned int clocks)
693 663
694 ver = GET_APIC_VERSION(apic_read(APIC_LVR)); 664 ver = GET_APIC_VERSION(apic_read(APIC_LVR));
695 lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; 665 lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR;
696 if (!APIC_INTEGRATED(ver))
697 lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV);
698 apic_write_around(APIC_LVTT, lvtt_value); 666 apic_write_around(APIC_LVTT, lvtt_value);
699 667
700 /* 668 /*
@@ -1081,7 +1049,7 @@ int __init APIC_init_uniprocessor (void)
1081 1049
1082 connect_bsp_APIC(); 1050 connect_bsp_APIC();
1083 1051
1084 phys_cpu_present_map = physid_mask_of_physid(0); 1052 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
1085 apic_write_around(APIC_ID, boot_cpu_id); 1053 apic_write_around(APIC_ID, boot_cpu_id);
1086 1054
1087 setup_local_APIC(); 1055 setup_local_APIC();
diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c
index 35b4c3fcbb37..aaa6d3833517 100644
--- a/arch/x86_64/kernel/asm-offsets.c
+++ b/arch/x86_64/kernel/asm-offsets.c
@@ -39,7 +39,6 @@ int main(void)
39 ENTRY(kernelstack); 39 ENTRY(kernelstack);
40 ENTRY(oldrsp); 40 ENTRY(oldrsp);
41 ENTRY(pcurrent); 41 ENTRY(pcurrent);
42 ENTRY(irqrsp);
43 ENTRY(irqcount); 42 ENTRY(irqcount);
44 ENTRY(cpunumber); 43 ENTRY(cpunumber);
45 ENTRY(irqstackptr); 44 ENTRY(irqstackptr);
diff --git a/arch/x86_64/kernel/crash.c b/arch/x86_64/kernel/crash.c
index d7fa4248501c..535e04466079 100644
--- a/arch/x86_64/kernel/crash.c
+++ b/arch/x86_64/kernel/crash.c
@@ -11,7 +11,6 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/irq.h>
15#include <linux/reboot.h> 14#include <linux/reboot.h>
16#include <linux/kexec.h> 15#include <linux/kexec.h>
17 16
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 116ac5f53dce..eb7929eea7b3 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -131,7 +131,7 @@ void __init e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned lon
131 131
132 if (ei->type != E820_RAM || 132 if (ei->type != E820_RAM ||
133 ei->addr+ei->size <= start || 133 ei->addr+ei->size <= start ||
134 ei->addr > end) 134 ei->addr >= end)
135 continue; 135 continue;
136 136
137 addr = round_up(ei->addr, PAGE_SIZE); 137 addr = round_up(ei->addr, PAGE_SIZE);
@@ -567,7 +567,7 @@ unsigned long pci_mem_start = 0xaeedbabe;
567 */ 567 */
568__init void e820_setup_gap(void) 568__init void e820_setup_gap(void)
569{ 569{
570 unsigned long gapstart, gapsize; 570 unsigned long gapstart, gapsize, round;
571 unsigned long last; 571 unsigned long last;
572 int i; 572 int i;
573 int found = 0; 573 int found = 0;
@@ -604,14 +604,14 @@ __init void e820_setup_gap(void)
604 } 604 }
605 605
606 /* 606 /*
607 * Start allocating dynamic PCI memory a bit into the gap, 607 * See how much we want to round up: start off with
608 * aligned up to the nearest megabyte. 608 * rounding to the next 1MB area.
609 *
610 * Question: should we try to pad it up a bit (do something
611 * like " + (gapsize >> 3)" in there too?). We now have the
612 * technology.
613 */ 609 */
614 pci_mem_start = (gapstart + 0xfffff) & ~0xfffff; 610 round = 0x100000;
611 while ((gapsize >> 4) > round)
612 round += round;
613 /* Fun with two's complement */
614 pci_mem_start = (gapstart + round) & -round;
615 615
616 printk(KERN_INFO "Allocating PCI resources starting at %lx (gap: %lx:%lx)\n", 616 printk(KERN_INFO "Allocating PCI resources starting at %lx (gap: %lx:%lx)\n",
617 pci_mem_start, gapstart, gapsize); 617 pci_mem_start, gapstart, gapsize);
diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c
index 9631c747c5e3..9cd968dd0f5a 100644
--- a/arch/x86_64/kernel/early_printk.c
+++ b/arch/x86_64/kernel/early_printk.c
@@ -5,6 +5,7 @@
5#include <linux/tty.h> 5#include <linux/tty.h>
6#include <asm/io.h> 6#include <asm/io.h>
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/fcntl.h>
8 9
9/* Simple VGA output */ 10/* Simple VGA output */
10 11
@@ -158,6 +159,47 @@ static struct console early_serial_console = {
158 .index = -1, 159 .index = -1,
159}; 160};
160 161
162/* Console interface to a host file on AMD's SimNow! */
163
164static int simnow_fd;
165
166enum {
167 MAGIC1 = 0xBACCD00A,
168 MAGIC2 = 0xCA110000,
169 XOPEN = 5,
170 XWRITE = 4,
171};
172
173static noinline long simnow(long cmd, long a, long b, long c)
174{
175 long ret;
176 asm volatile("cpuid" :
177 "=a" (ret) :
178 "b" (a), "c" (b), "d" (c), "0" (MAGIC1), "D" (cmd + MAGIC2));
179 return ret;
180}
181
182void __init simnow_init(char *str)
183{
184 char *fn = "klog";
185 if (*str == '=')
186 fn = ++str;
187 /* error ignored */
188 simnow_fd = simnow(XOPEN, (unsigned long)fn, O_WRONLY|O_APPEND|O_CREAT, 0644);
189}
190
191static void simnow_write(struct console *con, const char *s, unsigned n)
192{
193 simnow(XWRITE, simnow_fd, (unsigned long)s, n);
194}
195
196static struct console simnow_console = {
197 .name = "simnow",
198 .write = simnow_write,
199 .flags = CON_PRINTBUFFER,
200 .index = -1,
201};
202
161/* Direct interface for emergencies */ 203/* Direct interface for emergencies */
162struct console *early_console = &early_vga_console; 204struct console *early_console = &early_vga_console;
163static int early_console_initialized = 0; 205static int early_console_initialized = 0;
@@ -205,6 +247,10 @@ int __init setup_early_printk(char *opt)
205 max_xpos = SCREEN_INFO.orig_video_cols; 247 max_xpos = SCREEN_INFO.orig_video_cols;
206 max_ypos = SCREEN_INFO.orig_video_lines; 248 max_ypos = SCREEN_INFO.orig_video_lines;
207 early_console = &early_vga_console; 249 early_console = &early_vga_console;
250 } else if (!strncmp(buf, "simnow", 6)) {
251 simnow_init(buf + 6);
252 early_console = &simnow_console;
253 keep_early = 1;
208 } 254 }
209 early_console_initialized = 1; 255 early_console_initialized = 1;
210 register_console(early_console); 256 register_console(early_console);
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index be51dbe1f75e..7937971d1853 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -36,7 +36,7 @@
36#include <asm/errno.h> 36#include <asm/errno.h>
37#include <asm/dwarf2.h> 37#include <asm/dwarf2.h>
38#include <asm/calling.h> 38#include <asm/calling.h>
39#include <asm/offset.h> 39#include <asm/asm-offsets.h>
40#include <asm/msr.h> 40#include <asm/msr.h>
41#include <asm/unistd.h> 41#include <asm/unistd.h>
42#include <asm/thread_info.h> 42#include <asm/thread_info.h>
@@ -79,16 +79,19 @@
79 xorl %eax, %eax 79 xorl %eax, %eax
80 pushq %rax /* ss */ 80 pushq %rax /* ss */
81 CFI_ADJUST_CFA_OFFSET 8 81 CFI_ADJUST_CFA_OFFSET 8
82 /*CFI_REL_OFFSET ss,0*/
82 pushq %rax /* rsp */ 83 pushq %rax /* rsp */
83 CFI_ADJUST_CFA_OFFSET 8 84 CFI_ADJUST_CFA_OFFSET 8
84 CFI_OFFSET rip,0 85 CFI_REL_OFFSET rsp,0
85 pushq $(1<<9) /* eflags - interrupts on */ 86 pushq $(1<<9) /* eflags - interrupts on */
86 CFI_ADJUST_CFA_OFFSET 8 87 CFI_ADJUST_CFA_OFFSET 8
88 /*CFI_REL_OFFSET rflags,0*/
87 pushq $__KERNEL_CS /* cs */ 89 pushq $__KERNEL_CS /* cs */
88 CFI_ADJUST_CFA_OFFSET 8 90 CFI_ADJUST_CFA_OFFSET 8
91 /*CFI_REL_OFFSET cs,0*/
89 pushq \child_rip /* rip */ 92 pushq \child_rip /* rip */
90 CFI_ADJUST_CFA_OFFSET 8 93 CFI_ADJUST_CFA_OFFSET 8
91 CFI_OFFSET rip,0 94 CFI_REL_OFFSET rip,0
92 pushq %rax /* orig rax */ 95 pushq %rax /* orig rax */
93 CFI_ADJUST_CFA_OFFSET 8 96 CFI_ADJUST_CFA_OFFSET 8
94 .endm 97 .endm
@@ -98,32 +101,39 @@
98 CFI_ADJUST_CFA_OFFSET -(6*8) 101 CFI_ADJUST_CFA_OFFSET -(6*8)
99 .endm 102 .endm
100 103
101 .macro CFI_DEFAULT_STACK 104 .macro CFI_DEFAULT_STACK start=1
102 CFI_ADJUST_CFA_OFFSET (SS) 105 .if \start
103 CFI_OFFSET r15,R15-SS 106 CFI_STARTPROC simple
104 CFI_OFFSET r14,R14-SS 107 CFI_DEF_CFA rsp,SS+8
105 CFI_OFFSET r13,R13-SS 108 .else
106 CFI_OFFSET r12,R12-SS 109 CFI_DEF_CFA_OFFSET SS+8
107 CFI_OFFSET rbp,RBP-SS 110 .endif
108 CFI_OFFSET rbx,RBX-SS 111 CFI_REL_OFFSET r15,R15
109 CFI_OFFSET r11,R11-SS 112 CFI_REL_OFFSET r14,R14
110 CFI_OFFSET r10,R10-SS 113 CFI_REL_OFFSET r13,R13
111 CFI_OFFSET r9,R9-SS 114 CFI_REL_OFFSET r12,R12
112 CFI_OFFSET r8,R8-SS 115 CFI_REL_OFFSET rbp,RBP
113 CFI_OFFSET rax,RAX-SS 116 CFI_REL_OFFSET rbx,RBX
114 CFI_OFFSET rcx,RCX-SS 117 CFI_REL_OFFSET r11,R11
115 CFI_OFFSET rdx,RDX-SS 118 CFI_REL_OFFSET r10,R10
116 CFI_OFFSET rsi,RSI-SS 119 CFI_REL_OFFSET r9,R9
117 CFI_OFFSET rdi,RDI-SS 120 CFI_REL_OFFSET r8,R8
118 CFI_OFFSET rsp,RSP-SS 121 CFI_REL_OFFSET rax,RAX
119 CFI_OFFSET rip,RIP-SS 122 CFI_REL_OFFSET rcx,RCX
123 CFI_REL_OFFSET rdx,RDX
124 CFI_REL_OFFSET rsi,RSI
125 CFI_REL_OFFSET rdi,RDI
126 CFI_REL_OFFSET rip,RIP
127 /*CFI_REL_OFFSET cs,CS*/
128 /*CFI_REL_OFFSET rflags,EFLAGS*/
129 CFI_REL_OFFSET rsp,RSP
130 /*CFI_REL_OFFSET ss,SS*/
120 .endm 131 .endm
121/* 132/*
122 * A newly forked process directly context switches into this. 133 * A newly forked process directly context switches into this.
123 */ 134 */
124/* rdi: prev */ 135/* rdi: prev */
125ENTRY(ret_from_fork) 136ENTRY(ret_from_fork)
126 CFI_STARTPROC
127 CFI_DEFAULT_STACK 137 CFI_DEFAULT_STACK
128 call schedule_tail 138 call schedule_tail
129 GET_THREAD_INFO(%rcx) 139 GET_THREAD_INFO(%rcx)
@@ -172,16 +182,21 @@ rff_trace:
172 */ 182 */
173 183
174ENTRY(system_call) 184ENTRY(system_call)
175 CFI_STARTPROC 185 CFI_STARTPROC simple
186 CFI_DEF_CFA rsp,0
187 CFI_REGISTER rip,rcx
188 /*CFI_REGISTER rflags,r11*/
176 swapgs 189 swapgs
177 movq %rsp,%gs:pda_oldrsp 190 movq %rsp,%gs:pda_oldrsp
178 movq %gs:pda_kernelstack,%rsp 191 movq %gs:pda_kernelstack,%rsp
179 sti 192 sti
180 SAVE_ARGS 8,1 193 SAVE_ARGS 8,1
181 movq %rax,ORIG_RAX-ARGOFFSET(%rsp) 194 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
182 movq %rcx,RIP-ARGOFFSET(%rsp) 195 movq %rcx,RIP-ARGOFFSET(%rsp)
196 CFI_REL_OFFSET rip,RIP-ARGOFFSET
183 GET_THREAD_INFO(%rcx) 197 GET_THREAD_INFO(%rcx)
184 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx) 198 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
199 CFI_REMEMBER_STATE
185 jnz tracesys 200 jnz tracesys
186 cmpq $__NR_syscall_max,%rax 201 cmpq $__NR_syscall_max,%rax
187 ja badsys 202 ja badsys
@@ -201,9 +216,12 @@ sysret_check:
201 cli 216 cli
202 movl threadinfo_flags(%rcx),%edx 217 movl threadinfo_flags(%rcx),%edx
203 andl %edi,%edx 218 andl %edi,%edx
219 CFI_REMEMBER_STATE
204 jnz sysret_careful 220 jnz sysret_careful
205 movq RIP-ARGOFFSET(%rsp),%rcx 221 movq RIP-ARGOFFSET(%rsp),%rcx
222 CFI_REGISTER rip,rcx
206 RESTORE_ARGS 0,-ARG_SKIP,1 223 RESTORE_ARGS 0,-ARG_SKIP,1
224 /*CFI_REGISTER rflags,r11*/
207 movq %gs:pda_oldrsp,%rsp 225 movq %gs:pda_oldrsp,%rsp
208 swapgs 226 swapgs
209 sysretq 227 sysretq
@@ -211,12 +229,15 @@ sysret_check:
211 /* Handle reschedules */ 229 /* Handle reschedules */
212 /* edx: work, edi: workmask */ 230 /* edx: work, edi: workmask */
213sysret_careful: 231sysret_careful:
232 CFI_RESTORE_STATE
214 bt $TIF_NEED_RESCHED,%edx 233 bt $TIF_NEED_RESCHED,%edx
215 jnc sysret_signal 234 jnc sysret_signal
216 sti 235 sti
217 pushq %rdi 236 pushq %rdi
237 CFI_ADJUST_CFA_OFFSET 8
218 call schedule 238 call schedule
219 popq %rdi 239 popq %rdi
240 CFI_ADJUST_CFA_OFFSET -8
220 jmp sysret_check 241 jmp sysret_check
221 242
222 /* Handle a signal */ 243 /* Handle a signal */
@@ -234,8 +255,13 @@ sysret_signal:
2341: movl $_TIF_NEED_RESCHED,%edi 2551: movl $_TIF_NEED_RESCHED,%edi
235 jmp sysret_check 256 jmp sysret_check
236 257
258badsys:
259 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
260 jmp ret_from_sys_call
261
237 /* Do syscall tracing */ 262 /* Do syscall tracing */
238tracesys: 263tracesys:
264 CFI_RESTORE_STATE
239 SAVE_REST 265 SAVE_REST
240 movq $-ENOSYS,RAX(%rsp) 266 movq $-ENOSYS,RAX(%rsp)
241 FIXUP_TOP_OF_STACK %rdi 267 FIXUP_TOP_OF_STACK %rdi
@@ -254,16 +280,29 @@ tracesys:
254 RESTORE_TOP_OF_STACK %rbx 280 RESTORE_TOP_OF_STACK %rbx
255 RESTORE_REST 281 RESTORE_REST
256 jmp ret_from_sys_call 282 jmp ret_from_sys_call
283 CFI_ENDPROC
257 284
258badsys:
259 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
260 jmp ret_from_sys_call
261
262/* 285/*
263 * Syscall return path ending with IRET. 286 * Syscall return path ending with IRET.
264 * Has correct top of stack, but partial stack frame. 287 * Has correct top of stack, but partial stack frame.
265 */ 288 */
266ENTRY(int_ret_from_sys_call) 289ENTRY(int_ret_from_sys_call)
290 CFI_STARTPROC simple
291 CFI_DEF_CFA rsp,SS+8-ARGOFFSET
292 /*CFI_REL_OFFSET ss,SS-ARGOFFSET*/
293 CFI_REL_OFFSET rsp,RSP-ARGOFFSET
294 /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
295 /*CFI_REL_OFFSET cs,CS-ARGOFFSET*/
296 CFI_REL_OFFSET rip,RIP-ARGOFFSET
297 CFI_REL_OFFSET rdx,RDX-ARGOFFSET
298 CFI_REL_OFFSET rcx,RCX-ARGOFFSET
299 CFI_REL_OFFSET rax,RAX-ARGOFFSET
300 CFI_REL_OFFSET rdi,RDI-ARGOFFSET
301 CFI_REL_OFFSET rsi,RSI-ARGOFFSET
302 CFI_REL_OFFSET r8,R8-ARGOFFSET
303 CFI_REL_OFFSET r9,R9-ARGOFFSET
304 CFI_REL_OFFSET r10,R10-ARGOFFSET
305 CFI_REL_OFFSET r11,R11-ARGOFFSET
267 cli 306 cli
268 testl $3,CS-ARGOFFSET(%rsp) 307 testl $3,CS-ARGOFFSET(%rsp)
269 je retint_restore_args 308 je retint_restore_args
@@ -284,8 +323,10 @@ int_careful:
284 jnc int_very_careful 323 jnc int_very_careful
285 sti 324 sti
286 pushq %rdi 325 pushq %rdi
326 CFI_ADJUST_CFA_OFFSET 8
287 call schedule 327 call schedule
288 popq %rdi 328 popq %rdi
329 CFI_ADJUST_CFA_OFFSET -8
289 cli 330 cli
290 jmp int_with_check 331 jmp int_with_check
291 332
@@ -297,9 +338,11 @@ int_very_careful:
297 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edx 338 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edx
298 jz int_signal 339 jz int_signal
299 pushq %rdi 340 pushq %rdi
341 CFI_ADJUST_CFA_OFFSET 8
300 leaq 8(%rsp),%rdi # &ptregs -> arg1 342 leaq 8(%rsp),%rdi # &ptregs -> arg1
301 call syscall_trace_leave 343 call syscall_trace_leave
302 popq %rdi 344 popq %rdi
345 CFI_ADJUST_CFA_OFFSET -8
303 andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi 346 andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi
304 cli 347 cli
305 jmp int_restore_rest 348 jmp int_restore_rest
@@ -329,6 +372,8 @@ int_restore_rest:
329 jmp ptregscall_common 372 jmp ptregscall_common
330 .endm 373 .endm
331 374
375 CFI_STARTPROC
376
332 PTREGSCALL stub_clone, sys_clone, %r8 377 PTREGSCALL stub_clone, sys_clone, %r8
333 PTREGSCALL stub_fork, sys_fork, %rdi 378 PTREGSCALL stub_fork, sys_fork, %rdi
334 PTREGSCALL stub_vfork, sys_vfork, %rdi 379 PTREGSCALL stub_vfork, sys_vfork, %rdi
@@ -337,40 +382,49 @@ int_restore_rest:
337 PTREGSCALL stub_iopl, sys_iopl, %rsi 382 PTREGSCALL stub_iopl, sys_iopl, %rsi
338 383
339ENTRY(ptregscall_common) 384ENTRY(ptregscall_common)
340 CFI_STARTPROC
341 popq %r11 385 popq %r11
342 CFI_ADJUST_CFA_OFFSET -8 386 CFI_ADJUST_CFA_OFFSET -8
387 CFI_REGISTER rip, r11
343 SAVE_REST 388 SAVE_REST
344 movq %r11, %r15 389 movq %r11, %r15
390 CFI_REGISTER rip, r15
345 FIXUP_TOP_OF_STACK %r11 391 FIXUP_TOP_OF_STACK %r11
346 call *%rax 392 call *%rax
347 RESTORE_TOP_OF_STACK %r11 393 RESTORE_TOP_OF_STACK %r11
348 movq %r15, %r11 394 movq %r15, %r11
395 CFI_REGISTER rip, r11
349 RESTORE_REST 396 RESTORE_REST
350 pushq %r11 397 pushq %r11
351 CFI_ADJUST_CFA_OFFSET 8 398 CFI_ADJUST_CFA_OFFSET 8
399 CFI_REL_OFFSET rip, 0
352 ret 400 ret
353 CFI_ENDPROC 401 CFI_ENDPROC
354 402
355ENTRY(stub_execve) 403ENTRY(stub_execve)
356 CFI_STARTPROC 404 CFI_STARTPROC
357 popq %r11 405 popq %r11
358 CFI_ADJUST_CFA_OFFSET -8 406 CFI_ADJUST_CFA_OFFSET -8
407 CFI_REGISTER rip, r11
359 SAVE_REST 408 SAVE_REST
360 movq %r11, %r15 409 movq %r11, %r15
410 CFI_REGISTER rip, r15
361 FIXUP_TOP_OF_STACK %r11 411 FIXUP_TOP_OF_STACK %r11
362 call sys_execve 412 call sys_execve
363 GET_THREAD_INFO(%rcx) 413 GET_THREAD_INFO(%rcx)
364 bt $TIF_IA32,threadinfo_flags(%rcx) 414 bt $TIF_IA32,threadinfo_flags(%rcx)
415 CFI_REMEMBER_STATE
365 jc exec_32bit 416 jc exec_32bit
366 RESTORE_TOP_OF_STACK %r11 417 RESTORE_TOP_OF_STACK %r11
367 movq %r15, %r11 418 movq %r15, %r11
419 CFI_REGISTER rip, r11
368 RESTORE_REST 420 RESTORE_REST
369 push %r11 421 pushq %r11
422 CFI_ADJUST_CFA_OFFSET 8
423 CFI_REL_OFFSET rip, 0
370 ret 424 ret
371 425
372exec_32bit: 426exec_32bit:
373 CFI_ADJUST_CFA_OFFSET REST_SKIP 427 CFI_RESTORE_STATE
374 movq %rax,RAX(%rsp) 428 movq %rax,RAX(%rsp)
375 RESTORE_REST 429 RESTORE_REST
376 jmp int_ret_from_sys_call 430 jmp int_ret_from_sys_call
@@ -382,7 +436,8 @@ exec_32bit:
382 */ 436 */
383ENTRY(stub_rt_sigreturn) 437ENTRY(stub_rt_sigreturn)
384 CFI_STARTPROC 438 CFI_STARTPROC
385 addq $8, %rsp 439 addq $8, %rsp
440 CFI_ADJUST_CFA_OFFSET -8
386 SAVE_REST 441 SAVE_REST
387 movq %rsp,%rdi 442 movq %rsp,%rdi
388 FIXUP_TOP_OF_STACK %r11 443 FIXUP_TOP_OF_STACK %r11
@@ -392,6 +447,25 @@ ENTRY(stub_rt_sigreturn)
392 jmp int_ret_from_sys_call 447 jmp int_ret_from_sys_call
393 CFI_ENDPROC 448 CFI_ENDPROC
394 449
450/*
451 * initial frame state for interrupts and exceptions
452 */
453 .macro _frame ref
454 CFI_STARTPROC simple
455 CFI_DEF_CFA rsp,SS+8-\ref
456 /*CFI_REL_OFFSET ss,SS-\ref*/
457 CFI_REL_OFFSET rsp,RSP-\ref
458 /*CFI_REL_OFFSET rflags,EFLAGS-\ref*/
459 /*CFI_REL_OFFSET cs,CS-\ref*/
460 CFI_REL_OFFSET rip,RIP-\ref
461 .endm
462
463/* initial frame state for interrupts (and exceptions without error code) */
464#define INTR_FRAME _frame RIP
465/* initial frame state for exceptions with error code (and interrupts with
466 vector already pushed) */
467#define XCPT_FRAME _frame ORIG_RAX
468
395/* 469/*
396 * Interrupt entry/exit. 470 * Interrupt entry/exit.
397 * 471 *
@@ -402,10 +476,6 @@ ENTRY(stub_rt_sigreturn)
402 476
403/* 0(%rsp): interrupt number */ 477/* 0(%rsp): interrupt number */
404 .macro interrupt func 478 .macro interrupt func
405 CFI_STARTPROC simple
406 CFI_DEF_CFA rsp,(SS-RDI)
407 CFI_REL_OFFSET rsp,(RSP-ORIG_RAX)
408 CFI_REL_OFFSET rip,(RIP-ORIG_RAX)
409 cld 479 cld
410#ifdef CONFIG_DEBUG_INFO 480#ifdef CONFIG_DEBUG_INFO
411 SAVE_ALL 481 SAVE_ALL
@@ -425,23 +495,27 @@ ENTRY(stub_rt_sigreturn)
425 swapgs 495 swapgs
4261: incl %gs:pda_irqcount # RED-PEN should check preempt count 4961: incl %gs:pda_irqcount # RED-PEN should check preempt count
427 movq %gs:pda_irqstackptr,%rax 497 movq %gs:pda_irqstackptr,%rax
428 cmoveq %rax,%rsp 498 cmoveq %rax,%rsp /*todo This needs CFI annotation! */
429 pushq %rdi # save old stack 499 pushq %rdi # save old stack
500 CFI_ADJUST_CFA_OFFSET 8
430 call \func 501 call \func
431 .endm 502 .endm
432 503
433ENTRY(common_interrupt) 504ENTRY(common_interrupt)
505 XCPT_FRAME
434 interrupt do_IRQ 506 interrupt do_IRQ
435 /* 0(%rsp): oldrsp-ARGOFFSET */ 507 /* 0(%rsp): oldrsp-ARGOFFSET */
436ret_from_intr: 508ret_from_intr:
437 popq %rdi 509 popq %rdi
510 CFI_ADJUST_CFA_OFFSET -8
438 cli 511 cli
439 decl %gs:pda_irqcount 512 decl %gs:pda_irqcount
440#ifdef CONFIG_DEBUG_INFO 513#ifdef CONFIG_DEBUG_INFO
441 movq RBP(%rdi),%rbp 514 movq RBP(%rdi),%rbp
515 CFI_DEF_CFA_REGISTER rsp
442#endif 516#endif
443 leaq ARGOFFSET(%rdi),%rsp 517 leaq ARGOFFSET(%rdi),%rsp /*todo This needs CFI annotation! */
444exit_intr: 518exit_intr:
445 GET_THREAD_INFO(%rcx) 519 GET_THREAD_INFO(%rcx)
446 testl $3,CS-ARGOFFSET(%rsp) 520 testl $3,CS-ARGOFFSET(%rsp)
447 je retint_kernel 521 je retint_kernel
@@ -453,9 +527,10 @@ exit_intr:
453 */ 527 */
454retint_with_reschedule: 528retint_with_reschedule:
455 movl $_TIF_WORK_MASK,%edi 529 movl $_TIF_WORK_MASK,%edi
456retint_check: 530retint_check:
457 movl threadinfo_flags(%rcx),%edx 531 movl threadinfo_flags(%rcx),%edx
458 andl %edi,%edx 532 andl %edi,%edx
533 CFI_REMEMBER_STATE
459 jnz retint_careful 534 jnz retint_careful
460retint_swapgs: 535retint_swapgs:
461 swapgs 536 swapgs
@@ -476,14 +551,17 @@ bad_iret:
476 jmp do_exit 551 jmp do_exit
477 .previous 552 .previous
478 553
479 /* edi: workmask, edx: work */ 554 /* edi: workmask, edx: work */
480retint_careful: 555retint_careful:
556 CFI_RESTORE_STATE
481 bt $TIF_NEED_RESCHED,%edx 557 bt $TIF_NEED_RESCHED,%edx
482 jnc retint_signal 558 jnc retint_signal
483 sti 559 sti
484 pushq %rdi 560 pushq %rdi
561 CFI_ADJUST_CFA_OFFSET 8
485 call schedule 562 call schedule
486 popq %rdi 563 popq %rdi
564 CFI_ADJUST_CFA_OFFSET -8
487 GET_THREAD_INFO(%rcx) 565 GET_THREAD_INFO(%rcx)
488 cli 566 cli
489 jmp retint_check 567 jmp retint_check
@@ -523,7 +601,9 @@ retint_kernel:
523 * APIC interrupts. 601 * APIC interrupts.
524 */ 602 */
525 .macro apicinterrupt num,func 603 .macro apicinterrupt num,func
604 INTR_FRAME
526 pushq $\num-256 605 pushq $\num-256
606 CFI_ADJUST_CFA_OFFSET 8
527 interrupt \func 607 interrupt \func
528 jmp ret_from_intr 608 jmp ret_from_intr
529 CFI_ENDPROC 609 CFI_ENDPROC
@@ -536,8 +616,19 @@ ENTRY(thermal_interrupt)
536ENTRY(reschedule_interrupt) 616ENTRY(reschedule_interrupt)
537 apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt 617 apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt
538 618
539ENTRY(invalidate_interrupt) 619 .macro INVALIDATE_ENTRY num
540 apicinterrupt INVALIDATE_TLB_VECTOR,smp_invalidate_interrupt 620ENTRY(invalidate_interrupt\num)
621 apicinterrupt INVALIDATE_TLB_VECTOR_START+\num,smp_invalidate_interrupt
622 .endm
623
624 INVALIDATE_ENTRY 0
625 INVALIDATE_ENTRY 1
626 INVALIDATE_ENTRY 2
627 INVALIDATE_ENTRY 3
628 INVALIDATE_ENTRY 4
629 INVALIDATE_ENTRY 5
630 INVALIDATE_ENTRY 6
631 INVALIDATE_ENTRY 7
541 632
542ENTRY(call_function_interrupt) 633ENTRY(call_function_interrupt)
543 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt 634 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt
@@ -558,16 +649,23 @@ ENTRY(spurious_interrupt)
558 * Exception entry points. 649 * Exception entry points.
559 */ 650 */
560 .macro zeroentry sym 651 .macro zeroentry sym
652 INTR_FRAME
561 pushq $0 /* push error code/oldrax */ 653 pushq $0 /* push error code/oldrax */
654 CFI_ADJUST_CFA_OFFSET 8
562 pushq %rax /* push real oldrax to the rdi slot */ 655 pushq %rax /* push real oldrax to the rdi slot */
656 CFI_ADJUST_CFA_OFFSET 8
563 leaq \sym(%rip),%rax 657 leaq \sym(%rip),%rax
564 jmp error_entry 658 jmp error_entry
659 CFI_ENDPROC
565 .endm 660 .endm
566 661
567 .macro errorentry sym 662 .macro errorentry sym
663 XCPT_FRAME
568 pushq %rax 664 pushq %rax
665 CFI_ADJUST_CFA_OFFSET 8
569 leaq \sym(%rip),%rax 666 leaq \sym(%rip),%rax
570 jmp error_entry 667 jmp error_entry
668 CFI_ENDPROC
571 .endm 669 .endm
572 670
573 /* error code is on the stack already */ 671 /* error code is on the stack already */
@@ -594,10 +692,7 @@ ENTRY(spurious_interrupt)
594 * and the exception handler in %rax. 692 * and the exception handler in %rax.
595 */ 693 */
596ENTRY(error_entry) 694ENTRY(error_entry)
597 CFI_STARTPROC simple 695 _frame RDI
598 CFI_DEF_CFA rsp,(SS-RDI)
599 CFI_REL_OFFSET rsp,(RSP-RDI)
600 CFI_REL_OFFSET rip,(RIP-RDI)
601 /* rdi slot contains rax, oldrax contains error code */ 696 /* rdi slot contains rax, oldrax contains error code */
602 cld 697 cld
603 subq $14*8,%rsp 698 subq $14*8,%rsp
@@ -679,7 +774,9 @@ error_kernelspace:
679 /* Reload gs selector with exception handling */ 774 /* Reload gs selector with exception handling */
680 /* edi: new selector */ 775 /* edi: new selector */
681ENTRY(load_gs_index) 776ENTRY(load_gs_index)
777 CFI_STARTPROC
682 pushf 778 pushf
779 CFI_ADJUST_CFA_OFFSET 8
683 cli 780 cli
684 swapgs 781 swapgs
685gs_change: 782gs_change:
@@ -687,7 +784,9 @@ gs_change:
6872: mfence /* workaround */ 7842: mfence /* workaround */
688 swapgs 785 swapgs
689 popf 786 popf
787 CFI_ADJUST_CFA_OFFSET -8
690 ret 788 ret
789 CFI_ENDPROC
691 790
692 .section __ex_table,"a" 791 .section __ex_table,"a"
693 .align 8 792 .align 8
@@ -799,7 +898,7 @@ ENTRY(device_not_available)
799 898
800 /* runs on exception stack */ 899 /* runs on exception stack */
801KPROBE_ENTRY(debug) 900KPROBE_ENTRY(debug)
802 CFI_STARTPROC 901 INTR_FRAME
803 pushq $0 902 pushq $0
804 CFI_ADJUST_CFA_OFFSET 8 903 CFI_ADJUST_CFA_OFFSET 8
805 paranoidentry do_debug 904 paranoidentry do_debug
@@ -809,9 +908,9 @@ KPROBE_ENTRY(debug)
809 908
810 /* runs on exception stack */ 909 /* runs on exception stack */
811ENTRY(nmi) 910ENTRY(nmi)
812 CFI_STARTPROC 911 INTR_FRAME
813 pushq $-1 912 pushq $-1
814 CFI_ADJUST_CFA_OFFSET 8 913 CFI_ADJUST_CFA_OFFSET 8
815 paranoidentry do_nmi 914 paranoidentry do_nmi
816 /* 915 /*
817 * "Paranoid" exit path from exception stack. 916 * "Paranoid" exit path from exception stack.
@@ -877,7 +976,7 @@ ENTRY(reserved)
877 976
878 /* runs on exception stack */ 977 /* runs on exception stack */
879ENTRY(double_fault) 978ENTRY(double_fault)
880 CFI_STARTPROC 979 XCPT_FRAME
881 paranoidentry do_double_fault 980 paranoidentry do_double_fault
882 jmp paranoid_exit 981 jmp paranoid_exit
883 CFI_ENDPROC 982 CFI_ENDPROC
@@ -890,7 +989,7 @@ ENTRY(segment_not_present)
890 989
891 /* runs on exception stack */ 990 /* runs on exception stack */
892ENTRY(stack_segment) 991ENTRY(stack_segment)
893 CFI_STARTPROC 992 XCPT_FRAME
894 paranoidentry do_stack_segment 993 paranoidentry do_stack_segment
895 jmp paranoid_exit 994 jmp paranoid_exit
896 CFI_ENDPROC 995 CFI_ENDPROC
@@ -911,7 +1010,7 @@ ENTRY(spurious_interrupt_bug)
911#ifdef CONFIG_X86_MCE 1010#ifdef CONFIG_X86_MCE
912 /* runs on exception stack */ 1011 /* runs on exception stack */
913ENTRY(machine_check) 1012ENTRY(machine_check)
914 CFI_STARTPROC 1013 INTR_FRAME
915 pushq $0 1014 pushq $0
916 CFI_ADJUST_CFA_OFFSET 8 1015 CFI_ADJUST_CFA_OFFSET 8
917 paranoidentry do_machine_check 1016 paranoidentry do_machine_check
@@ -923,14 +1022,19 @@ ENTRY(call_debug)
923 zeroentry do_call_debug 1022 zeroentry do_call_debug
924 1023
925ENTRY(call_softirq) 1024ENTRY(call_softirq)
1025 CFI_STARTPROC
926 movq %gs:pda_irqstackptr,%rax 1026 movq %gs:pda_irqstackptr,%rax
927 pushq %r15 1027 pushq %r15
1028 CFI_ADJUST_CFA_OFFSET 8
928 movq %rsp,%r15 1029 movq %rsp,%r15
1030 CFI_DEF_CFA_REGISTER r15
929 incl %gs:pda_irqcount 1031 incl %gs:pda_irqcount
930 cmove %rax,%rsp 1032 cmove %rax,%rsp
931 call __do_softirq 1033 call __do_softirq
932 movq %r15,%rsp 1034 movq %r15,%rsp
1035 CFI_DEF_CFA_REGISTER rsp
933 decl %gs:pda_irqcount 1036 decl %gs:pda_irqcount
934 popq %r15 1037 popq %r15
1038 CFI_ADJUST_CFA_OFFSET -8
935 ret 1039 ret
936 1040 CFI_ENDPROC
diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c
index f062aa03bab7..7a64ea181788 100644
--- a/arch/x86_64/kernel/genapic.c
+++ b/arch/x86_64/kernel/genapic.c
@@ -20,7 +20,7 @@
20#include <asm/smp.h> 20#include <asm/smp.h>
21#include <asm/ipi.h> 21#include <asm/ipi.h>
22 22
23#if defined(CONFIG_ACPI_BUS) 23#if defined(CONFIG_ACPI)
24#include <acpi/acpi_bus.h> 24#include <acpi/acpi_bus.h>
25#endif 25#endif
26 26
@@ -45,9 +45,9 @@ void __init clustered_apic_check(void)
45 u8 clusters, max_cluster; 45 u8 clusters, max_cluster;
46 u8 id; 46 u8 id;
47 u8 cluster_cnt[NUM_APIC_CLUSTERS]; 47 u8 cluster_cnt[NUM_APIC_CLUSTERS];
48 int num_cpus = 0; 48 int max_apic = 0;
49 49
50#if defined(CONFIG_ACPI_BUS) 50#if defined(CONFIG_ACPI)
51 /* 51 /*
52 * Some x86_64 machines use physical APIC mode regardless of how many 52 * Some x86_64 machines use physical APIC mode regardless of how many
53 * procs/clusters are present (x86_64 ES7000 is an example). 53 * procs/clusters are present (x86_64 ES7000 is an example).
@@ -64,14 +64,15 @@ void __init clustered_apic_check(void)
64 id = bios_cpu_apicid[i]; 64 id = bios_cpu_apicid[i];
65 if (id == BAD_APICID) 65 if (id == BAD_APICID)
66 continue; 66 continue;
67 num_cpus++; 67 if (id > max_apic)
68 max_apic = id;
68 cluster_cnt[APIC_CLUSTERID(id)]++; 69 cluster_cnt[APIC_CLUSTERID(id)]++;
69 } 70 }
70 71
71 /* Don't use clustered mode on AMD platforms. */ 72 /* Don't use clustered mode on AMD platforms. */
72 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { 73 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
73 genapic = &apic_physflat; 74 genapic = &apic_physflat;
74#ifndef CONFIG_CPU_HOTPLUG 75#ifndef CONFIG_HOTPLUG_CPU
75 /* In the CPU hotplug case we cannot use broadcast mode 76 /* In the CPU hotplug case we cannot use broadcast mode
76 because that opens a race when a CPU is removed. 77 because that opens a race when a CPU is removed.
77 Stay at physflat mode in this case. 78 Stay at physflat mode in this case.
@@ -79,7 +80,7 @@ void __init clustered_apic_check(void)
79 we have ACPI platform support for CPU hotplug 80 we have ACPI platform support for CPU hotplug
80 we should detect hotplug capablity from ACPI tables and 81 we should detect hotplug capablity from ACPI tables and
81 only do this when really needed. -AK */ 82 only do this when really needed. -AK */
82 if (num_cpus <= 8) 83 if (max_apic <= 8)
83 genapic = &apic_flat; 84 genapic = &apic_flat;
84#endif 85#endif
85 goto print; 86 goto print;
@@ -103,9 +104,14 @@ void __init clustered_apic_check(void)
103 * (We don't use lowest priority delivery + HW APIC IRQ steering, so 104 * (We don't use lowest priority delivery + HW APIC IRQ steering, so
104 * can ignore the clustered logical case and go straight to physical.) 105 * can ignore the clustered logical case and go straight to physical.)
105 */ 106 */
106 if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == max_cluster) 107 if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == max_cluster) {
108#ifdef CONFIG_HOTPLUG_CPU
109 /* Don't use APIC shortcuts in CPU hotplug to avoid races */
110 genapic = &apic_physflat;
111#else
107 genapic = &apic_flat; 112 genapic = &apic_flat;
108 else 113#endif
114 } else
109 genapic = &apic_cluster; 115 genapic = &apic_cluster;
110 116
111print: 117print:
diff --git a/arch/x86_64/kernel/genapic_cluster.c b/arch/x86_64/kernel/genapic_cluster.c
index f6523dd1bc09..a472d62f899a 100644
--- a/arch/x86_64/kernel/genapic_cluster.c
+++ b/arch/x86_64/kernel/genapic_cluster.c
@@ -51,10 +51,10 @@ static void cluster_init_apic_ldr(void)
51 count = 3; 51 count = 3;
52 id = my_cluster | (1UL << count); 52 id = my_cluster | (1UL << count);
53 x86_cpu_to_log_apicid[smp_processor_id()] = id; 53 x86_cpu_to_log_apicid[smp_processor_id()] = id;
54 apic_write_around(APIC_DFR, APIC_DFR_CLUSTER); 54 apic_write(APIC_DFR, APIC_DFR_CLUSTER);
55 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; 55 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
56 val |= SET_APIC_LOGICAL_ID(id); 56 val |= SET_APIC_LOGICAL_ID(id);
57 apic_write_around(APIC_LDR, val); 57 apic_write(APIC_LDR, val);
58} 58}
59 59
60/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ 60/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */
diff --git a/arch/x86_64/kernel/genapic_flat.c b/arch/x86_64/kernel/genapic_flat.c
index adc96282a9e2..9da3edb799ea 100644
--- a/arch/x86_64/kernel/genapic_flat.c
+++ b/arch/x86_64/kernel/genapic_flat.c
@@ -38,10 +38,10 @@ static void flat_init_apic_ldr(void)
38 num = smp_processor_id(); 38 num = smp_processor_id();
39 id = 1UL << num; 39 id = 1UL << num;
40 x86_cpu_to_log_apicid[num] = id; 40 x86_cpu_to_log_apicid[num] = id;
41 apic_write_around(APIC_DFR, APIC_DFR_FLAT); 41 apic_write(APIC_DFR, APIC_DFR_FLAT);
42 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; 42 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
43 val |= SET_APIC_LOGICAL_ID(id); 43 val |= SET_APIC_LOGICAL_ID(id);
44 apic_write_around(APIC_LDR, val); 44 apic_write(APIC_LDR, val);
45} 45}
46 46
47static void flat_send_IPI_mask(cpumask_t cpumask, int vector) 47static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
@@ -62,7 +62,7 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
62 * prepare target chip field 62 * prepare target chip field
63 */ 63 */
64 cfg = __prepare_ICR2(mask); 64 cfg = __prepare_ICR2(mask);
65 apic_write_around(APIC_ICR2, cfg); 65 apic_write(APIC_ICR2, cfg);
66 66
67 /* 67 /*
68 * program the ICR 68 * program the ICR
@@ -72,14 +72,24 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
72 /* 72 /*
73 * Send the IPI. The write to APIC_ICR fires this off. 73 * Send the IPI. The write to APIC_ICR fires this off.
74 */ 74 */
75 apic_write_around(APIC_ICR, cfg); 75 apic_write(APIC_ICR, cfg);
76 local_irq_restore(flags); 76 local_irq_restore(flags);
77} 77}
78 78
79static void flat_send_IPI_allbutself(int vector) 79static void flat_send_IPI_allbutself(int vector)
80{ 80{
81#ifndef CONFIG_HOTPLUG_CPU
81 if (((num_online_cpus()) - 1) >= 1) 82 if (((num_online_cpus()) - 1) >= 1)
82 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); 83 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL);
84#else
85 cpumask_t allbutme = cpu_online_map;
86 int me = get_cpu(); /* Ensure we are not preempted when we clear */
87 cpu_clear(me, allbutme);
88
89 if (!cpus_empty(allbutme))
90 flat_send_IPI_mask(allbutme, vector);
91 put_cpu();
92#endif
83} 93}
84 94
85static void flat_send_IPI_all(int vector) 95static void flat_send_IPI_all(int vector)
@@ -167,9 +177,9 @@ static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask)
167 177
168struct genapic apic_physflat = { 178struct genapic apic_physflat = {
169 .name = "physical flat", 179 .name = "physical flat",
170 .int_delivery_mode = dest_LowestPrio, 180 .int_delivery_mode = dest_Fixed,
171 .int_dest_mode = (APIC_DEST_PHYSICAL != 0), 181 .int_dest_mode = (APIC_DEST_PHYSICAL != 0),
172 .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_LOWEST, 182 .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_FIXED,
173 .target_cpus = physflat_target_cpus, 183 .target_cpus = physflat_target_cpus,
174 .apic_id_registered = flat_apic_id_registered, 184 .apic_id_registered = flat_apic_id_registered,
175 .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/ 185 .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 98ff5eb32b9a..4592bf21fcaf 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -270,7 +270,7 @@ ENTRY(level3_kernel_pgt)
270.org 0x4000 270.org 0x4000
271ENTRY(level2_ident_pgt) 271ENTRY(level2_ident_pgt)
272 /* 40MB for bootup. */ 272 /* 40MB for bootup. */
273 .quad 0x0000000000000283 273 .quad 0x0000000000000183
274 .quad 0x0000000000200183 274 .quad 0x0000000000200183
275 .quad 0x0000000000400183 275 .quad 0x0000000000400183
276 .quad 0x0000000000600183 276 .quad 0x0000000000600183
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index a89169095129..b2a238b5a17e 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -18,15 +18,12 @@
18#include <asm/atomic.h> 18#include <asm/atomic.h>
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/irq.h>
22#include <asm/hw_irq.h> 21#include <asm/hw_irq.h>
23#include <asm/pgtable.h> 22#include <asm/pgtable.h>
24#include <asm/delay.h> 23#include <asm/delay.h>
25#include <asm/desc.h> 24#include <asm/desc.h>
26#include <asm/apic.h> 25#include <asm/apic.h>
27 26
28#include <linux/irq.h>
29
30/* 27/*
31 * Common place to define all x86 IRQ vectors 28 * Common place to define all x86 IRQ vectors
32 * 29 *
@@ -486,7 +483,14 @@ void spurious_interrupt(void);
486void error_interrupt(void); 483void error_interrupt(void);
487void reschedule_interrupt(void); 484void reschedule_interrupt(void);
488void call_function_interrupt(void); 485void call_function_interrupt(void);
489void invalidate_interrupt(void); 486void invalidate_interrupt0(void);
487void invalidate_interrupt1(void);
488void invalidate_interrupt2(void);
489void invalidate_interrupt3(void);
490void invalidate_interrupt4(void);
491void invalidate_interrupt5(void);
492void invalidate_interrupt6(void);
493void invalidate_interrupt7(void);
490void thermal_interrupt(void); 494void thermal_interrupt(void);
491void i8254_timer_resume(void); 495void i8254_timer_resume(void);
492 496
@@ -562,8 +566,15 @@ void __init init_IRQ(void)
562 */ 566 */
563 set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); 567 set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
564 568
565 /* IPI for invalidation */ 569 /* IPIs for invalidation */
566 set_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt); 570 set_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
571 set_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
572 set_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
573 set_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
574 set_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
575 set_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
576 set_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
577 set_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
567 578
568 /* IPI for generic function call */ 579 /* IPI for generic function call */
569 set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); 580 set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
diff --git a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c
index c4dc91491157..e0ba5c1043fd 100644
--- a/arch/x86_64/kernel/init_task.c
+++ b/arch/x86_64/kernel/init_task.c
@@ -44,6 +44,6 @@ EXPORT_SYMBOL(init_task);
44 * section. Since TSS's are completely CPU-local, we want them 44 * section. Since TSS's are completely CPU-local, we want them
45 * on exact cacheline boundaries, to eliminate cacheline ping-pong. 45 * on exact cacheline boundaries, to eliminate cacheline ping-pong.
46 */ 46 */
47DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp; 47DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp = INIT_TSS;
48 48
49#define ALIGN_TO_4K __attribute__((section(".data.init_task"))) 49#define ALIGN_TO_4K __attribute__((section(".data.init_task")))
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index ba1a744e9bf0..522944a000ad 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -21,7 +21,6 @@
21 */ 21 */
22 22
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/irq.h>
25#include <linux/interrupt.h> 24#include <linux/interrupt.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/delay.h> 26#include <linux/delay.h>
@@ -45,6 +44,8 @@ int sis_apic_bug; /* not actually supported, dummy for compile */
45 44
46static int no_timer_check; 45static int no_timer_check;
47 46
47int disable_timer_pin_1 __initdata;
48
48static DEFINE_SPINLOCK(ioapic_lock); 49static DEFINE_SPINLOCK(ioapic_lock);
49 50
50/* 51/*
@@ -298,6 +299,15 @@ void __init check_ioapic(void)
298#endif 299#endif
299 /* RED-PEN skip them on mptables too? */ 300 /* RED-PEN skip them on mptables too? */
300 return; 301 return;
302 case PCI_VENDOR_ID_ATI:
303 /* All timer interrupts on atiixp
304 are doubled. Disable one. */
305 if (disable_timer_pin_1 == 0) {
306 disable_timer_pin_1 = 1;
307 printk(KERN_INFO
308 "ATI board detected. Disabling timer pin 1.\n");
309 }
310 return;
301 } 311 }
302 312
303 /* No multi-function device? */ 313 /* No multi-function device? */
@@ -1022,13 +1032,11 @@ void __apicdebuginit print_local_APIC(void * dummy)
1022 v = apic_read(APIC_TASKPRI); 1032 v = apic_read(APIC_TASKPRI);
1023 printk(KERN_DEBUG "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK); 1033 printk(KERN_DEBUG "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK);
1024 1034
1025 if (APIC_INTEGRATED(ver)) { /* !82489DX */ 1035 v = apic_read(APIC_ARBPRI);
1026 v = apic_read(APIC_ARBPRI); 1036 printk(KERN_DEBUG "... APIC ARBPRI: %08x (%02x)\n", v,
1027 printk(KERN_DEBUG "... APIC ARBPRI: %08x (%02x)\n", v, 1037 v & APIC_ARBPRI_MASK);
1028 v & APIC_ARBPRI_MASK); 1038 v = apic_read(APIC_PROCPRI);
1029 v = apic_read(APIC_PROCPRI); 1039 printk(KERN_DEBUG "... APIC PROCPRI: %08x\n", v);
1030 printk(KERN_DEBUG "... APIC PROCPRI: %08x\n", v);
1031 }
1032 1040
1033 v = apic_read(APIC_EOI); 1041 v = apic_read(APIC_EOI);
1034 printk(KERN_DEBUG "... APIC EOI: %08x\n", v); 1042 printk(KERN_DEBUG "... APIC EOI: %08x\n", v);
@@ -1048,12 +1056,8 @@ void __apicdebuginit print_local_APIC(void * dummy)
1048 printk(KERN_DEBUG "... APIC IRR field:\n"); 1056 printk(KERN_DEBUG "... APIC IRR field:\n");
1049 print_APIC_bitfield(APIC_IRR); 1057 print_APIC_bitfield(APIC_IRR);
1050 1058
1051 if (APIC_INTEGRATED(ver)) { /* !82489DX */ 1059 v = apic_read(APIC_ESR);
1052 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ 1060 printk(KERN_DEBUG "... APIC ESR: %08x\n", v);
1053 apic_write(APIC_ESR, 0);
1054 v = apic_read(APIC_ESR);
1055 printk(KERN_DEBUG "... APIC ESR: %08x\n", v);
1056 }
1057 1061
1058 v = apic_read(APIC_ICR); 1062 v = apic_read(APIC_ICR);
1059 printk(KERN_DEBUG "... APIC ICR: %08x\n", v); 1063 printk(KERN_DEBUG "... APIC ICR: %08x\n", v);
@@ -1167,9 +1171,9 @@ void disable_IO_APIC(void)
1167 clear_IO_APIC(); 1171 clear_IO_APIC();
1168 1172
1169 /* 1173 /*
1170 * If the i82559 is routed through an IOAPIC 1174 * If the i8259 is routed through an IOAPIC
1171 * Put that IOAPIC in virtual wire mode 1175 * Put that IOAPIC in virtual wire mode
1172 * so legacy interrups can be delivered. 1176 * so legacy interrupts can be delivered.
1173 */ 1177 */
1174 pin = find_isa_irq_pin(0, mp_ExtINT); 1178 pin = find_isa_irq_pin(0, mp_ExtINT);
1175 if (pin != -1) { 1179 if (pin != -1) {
@@ -1665,6 +1669,8 @@ static inline void check_timer(void)
1665 setup_nmi(); 1669 setup_nmi();
1666 enable_8259A_irq(0); 1670 enable_8259A_irq(0);
1667 } 1671 }
1672 if (disable_timer_pin_1 > 0)
1673 clear_IO_APIC_pin(0, pin1);
1668 return; 1674 return;
1669 } 1675 }
1670 clear_IO_APIC_pin(0, pin1); 1676 clear_IO_APIC_pin(0, pin1);
@@ -1864,7 +1870,7 @@ device_initcall(ioapic_init_sysfs);
1864 ACPI-based IOAPIC Configuration 1870 ACPI-based IOAPIC Configuration
1865 -------------------------------------------------------------------------- */ 1871 -------------------------------------------------------------------------- */
1866 1872
1867#ifdef CONFIG_ACPI_BOOT 1873#ifdef CONFIG_ACPI
1868 1874
1869#define IO_APIC_MAX_ID 0xFE 1875#define IO_APIC_MAX_ID 0xFE
1870 1876
@@ -1947,7 +1953,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
1947 return 0; 1953 return 0;
1948} 1954}
1949 1955
1950#endif /*CONFIG_ACPI_BOOT*/ 1956#endif /* CONFIG_ACPI */
1951 1957
1952 1958
1953/* 1959/*
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index 849a20aec7ca..d6a04a8320a3 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -99,7 +99,6 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
99 unsigned irq = regs->orig_rax & 0xff; 99 unsigned irq = regs->orig_rax & 0xff;
100 100
101 irq_enter(); 101 irq_enter();
102 BUG_ON(irq > 256);
103 102
104 __do_IRQ(irq, regs); 103 __do_IRQ(irq, regs);
105 irq_exit(); 104 irq_exit();
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 8aa56736cde3..969365c0771b 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -17,6 +17,7 @@
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/cpu.h> 18#include <linux/cpu.h>
19#include <linux/percpu.h> 19#include <linux/percpu.h>
20#include <linux/ctype.h>
20#include <asm/processor.h> 21#include <asm/processor.h>
21#include <asm/msr.h> 22#include <asm/msr.h>
22#include <asm/mce.h> 23#include <asm/mce.h>
@@ -56,15 +57,19 @@ void mce_log(struct mce *mce)
56 smp_wmb(); 57 smp_wmb();
57 for (;;) { 58 for (;;) {
58 entry = rcu_dereference(mcelog.next); 59 entry = rcu_dereference(mcelog.next);
59 /* When the buffer fills up discard new entries. Assume 60 for (;;) {
60 that the earlier errors are the more interesting. */ 61 /* When the buffer fills up discard new entries. Assume
61 if (entry >= MCE_LOG_LEN) { 62 that the earlier errors are the more interesting. */
62 set_bit(MCE_OVERFLOW, &mcelog.flags); 63 if (entry >= MCE_LOG_LEN) {
63 return; 64 set_bit(MCE_OVERFLOW, &mcelog.flags);
65 return;
66 }
67 /* Old left over entry. Skip. */
68 if (mcelog.entry[entry].finished) {
69 entry++;
70 continue;
71 }
64 } 72 }
65 /* Old left over entry. Skip. */
66 if (mcelog.entry[entry].finished)
67 continue;
68 smp_rmb(); 73 smp_rmb();
69 next = entry + 1; 74 next = entry + 1;
70 if (cmpxchg(&mcelog.next, entry, next) == entry) 75 if (cmpxchg(&mcelog.next, entry, next) == entry)
@@ -404,9 +409,15 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff
404 } 409 }
405 410
406 err = 0; 411 err = 0;
407 for (i = 0; i < next; i++) { 412 for (i = 0; i < next; i++) {
408 if (!mcelog.entry[i].finished) 413 unsigned long start = jiffies;
409 continue; 414 while (!mcelog.entry[i].finished) {
415 if (!time_before(jiffies, start + 2)) {
416 memset(mcelog.entry + i,0, sizeof(struct mce));
417 continue;
418 }
419 cpu_relax();
420 }
410 smp_rmb(); 421 smp_rmb();
411 err |= copy_to_user(buf, mcelog.entry + i, sizeof(struct mce)); 422 err |= copy_to_user(buf, mcelog.entry + i, sizeof(struct mce));
412 buf += sizeof(struct mce); 423 buf += sizeof(struct mce);
@@ -479,6 +490,7 @@ static int __init mcheck_disable(char *str)
479 490
480/* mce=off disables machine check. Note you can reenable it later 491/* mce=off disables machine check. Note you can reenable it later
481 using sysfs. 492 using sysfs.
493 mce=TOLERANCELEVEL (number, see above)
482 mce=bootlog Log MCEs from before booting. Disabled by default to work 494 mce=bootlog Log MCEs from before booting. Disabled by default to work
483 around buggy BIOS that leave bogus MCEs. */ 495 around buggy BIOS that leave bogus MCEs. */
484static int __init mcheck_enable(char *str) 496static int __init mcheck_enable(char *str)
@@ -489,6 +501,8 @@ static int __init mcheck_enable(char *str)
489 mce_dont_init = 1; 501 mce_dont_init = 1;
490 else if (!strcmp(str, "bootlog")) 502 else if (!strcmp(str, "bootlog"))
491 mce_bootlog = 1; 503 mce_bootlog = 1;
504 else if (isdigit(str[0]))
505 get_option(&str, &tolerant);
492 else 506 else
493 printk("mce= argument %s ignored. Please use /sys", str); 507 printk("mce= argument %s ignored. Please use /sys", str);
494 return 0; 508 return 0;
@@ -501,10 +515,12 @@ __setup("mce", mcheck_enable);
501 * Sysfs support 515 * Sysfs support
502 */ 516 */
503 517
504/* On resume clear all MCE state. Don't want to see leftovers from the BIOS. */ 518/* On resume clear all MCE state. Don't want to see leftovers from the BIOS.
519 Only one CPU is active at this time, the others get readded later using
520 CPU hotplug. */
505static int mce_resume(struct sys_device *dev) 521static int mce_resume(struct sys_device *dev)
506{ 522{
507 on_each_cpu(mce_init, NULL, 1, 1); 523 mce_init(NULL);
508 return 0; 524 return 0;
509} 525}
510 526
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 79c362d03e2e..f16d38d09daf 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/irq.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/delay.h> 18#include <linux/delay.h>
20#include <linux/config.h> 19#include <linux/config.h>
@@ -46,8 +45,6 @@ int acpi_found_madt;
46int apic_version [MAX_APICS]; 45int apic_version [MAX_APICS];
47unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; 46unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
48int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; 47int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
49unsigned char pci_bus_to_node [256];
50EXPORT_SYMBOL(pci_bus_to_node);
51 48
52static int mp_current_pci_id = 0; 49static int mp_current_pci_id = 0;
53/* I/O APIC entries */ 50/* I/O APIC entries */
@@ -74,7 +71,7 @@ static unsigned int num_processors = 0;
74physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE; 71physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
75 72
76/* ACPI MADT entry parsing functions */ 73/* ACPI MADT entry parsing functions */
77#ifdef CONFIG_ACPI_BOOT 74#ifdef CONFIG_ACPI
78extern struct acpi_boot_flags acpi_boot; 75extern struct acpi_boot_flags acpi_boot;
79#ifdef CONFIG_X86_LOCAL_APIC 76#ifdef CONFIG_X86_LOCAL_APIC
80extern int acpi_parse_lapic (acpi_table_entry_header *header); 77extern int acpi_parse_lapic (acpi_table_entry_header *header);
@@ -84,7 +81,7 @@ extern int acpi_parse_lapic_nmi (acpi_table_entry_header *header);
84#ifdef CONFIG_X86_IO_APIC 81#ifdef CONFIG_X86_IO_APIC
85extern int acpi_parse_ioapic (acpi_table_entry_header *header); 82extern int acpi_parse_ioapic (acpi_table_entry_header *header);
86#endif /*CONFIG_X86_IO_APIC*/ 83#endif /*CONFIG_X86_IO_APIC*/
87#endif /*CONFIG_ACPI_BOOT*/ 84#endif /*CONFIG_ACPI*/
88 85
89u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 86u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
90 87
@@ -519,8 +516,6 @@ void __init get_smp_config (void)
519 struct intel_mp_floating *mpf = mpf_found; 516 struct intel_mp_floating *mpf = mpf_found;
520 517
521 /* 518 /*
522 * ACPI may be used to obtain the entire SMP configuration or just to
523 * enumerate/configure processors (CONFIG_ACPI_BOOT). Note that
524 * ACPI supports both logical (e.g. Hyper-Threading) and physical 519 * ACPI supports both logical (e.g. Hyper-Threading) and physical
525 * processors, where MPS only supports physical. 520 * processors, where MPS only supports physical.
526 */ 521 */
@@ -673,7 +668,7 @@ void __init find_smp_config (void)
673 ACPI-based MP Configuration 668 ACPI-based MP Configuration
674 -------------------------------------------------------------------------- */ 669 -------------------------------------------------------------------------- */
675 670
676#ifdef CONFIG_ACPI_BOOT 671#ifdef CONFIG_ACPI
677 672
678void __init mp_register_lapic_address ( 673void __init mp_register_lapic_address (
679 u64 address) 674 u64 address)
@@ -707,7 +702,7 @@ void __init mp_register_lapic (
707 702
708 processor.mpc_type = MP_PROCESSOR; 703 processor.mpc_type = MP_PROCESSOR;
709 processor.mpc_apicid = id; 704 processor.mpc_apicid = id;
710 processor.mpc_apicver = 0x10; /* TBD: lapic version */ 705 processor.mpc_apicver = GET_APIC_VERSION(apic_read(APIC_LVR));
711 processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0); 706 processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0);
712 processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0); 707 processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0);
713 processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | 708 processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) |
@@ -929,11 +924,9 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
929 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) 924 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
930 return gsi; 925 return gsi;
931 926
932#ifdef CONFIG_ACPI_BUS
933 /* Don't set up the ACPI SCI because it's already set up */ 927 /* Don't set up the ACPI SCI because it's already set up */
934 if (acpi_fadt.sci_int == gsi) 928 if (acpi_fadt.sci_int == gsi)
935 return gsi; 929 return gsi;
936#endif
937 930
938 ioapic = mp_find_ioapic(gsi); 931 ioapic = mp_find_ioapic(gsi);
939 if (ioapic < 0) { 932 if (ioapic < 0) {
@@ -973,13 +966,11 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
973 if (gsi < MAX_GSI_NUM) { 966 if (gsi < MAX_GSI_NUM) {
974 if (gsi > 15) 967 if (gsi > 15)
975 gsi = pci_irq++; 968 gsi = pci_irq++;
976#ifdef CONFIG_ACPI_BUS
977 /* 969 /*
978 * Don't assign IRQ used by ACPI SCI 970 * Don't assign IRQ used by ACPI SCI
979 */ 971 */
980 if (gsi == acpi_fadt.sci_int) 972 if (gsi == acpi_fadt.sci_int)
981 gsi = pci_irq++; 973 gsi = pci_irq++;
982#endif
983 gsi_to_irq[irq] = gsi; 974 gsi_to_irq[irq] = gsi;
984 } else { 975 } else {
985 printk(KERN_ERR "GSI %u is too high\n", gsi); 976 printk(KERN_ERR "GSI %u is too high\n", gsi);
@@ -994,4 +985,4 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
994} 985}
995 986
996#endif /*CONFIG_X86_IO_APIC*/ 987#endif /*CONFIG_X86_IO_APIC*/
997#endif /*CONFIG_ACPI_BOOT*/ 988#endif /*CONFIG_ACPI*/
diff --git a/arch/x86_64/kernel/msr.c b/arch/x86_64/kernel/msr.c
deleted file mode 100644
index 598953ab0154..000000000000
--- a/arch/x86_64/kernel/msr.c
+++ /dev/null
@@ -1,279 +0,0 @@
1/* ----------------------------------------------------------------------- *
2 *
3 * Copyright 2000 H. Peter Anvin - All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
8 * USA; either version 2 of the License, or (at your option) any later
9 * version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13/*
14 * msr.c
15 *
16 * x86 MSR access device
17 *
18 * This device is accessed by lseek() to the appropriate register number
19 * and then read/write in chunks of 8 bytes. A larger size means multiple
20 * reads or writes of the same register.
21 *
22 * This driver uses /dev/cpu/%d/msr where %d is the minor number, and on
23 * an SMP box will direct the access to CPU %d.
24 */
25
26#include <linux/module.h>
27#include <linux/config.h>
28
29#include <linux/types.h>
30#include <linux/errno.h>
31#include <linux/fcntl.h>
32#include <linux/init.h>
33#include <linux/poll.h>
34#include <linux/smp.h>
35#include <linux/smp_lock.h>
36#include <linux/major.h>
37#include <linux/fs.h>
38
39#include <asm/processor.h>
40#include <asm/msr.h>
41#include <asm/uaccess.h>
42#include <asm/system.h>
43
44/* Note: "err" is handled in a funny way below. Otherwise one version
45 of gcc or another breaks. */
46
47static inline int wrmsr_eio(u32 reg, u32 eax, u32 edx)
48{
49 int err;
50
51 asm volatile ("1: wrmsr\n"
52 "2:\n"
53 ".section .fixup,\"ax\"\n"
54 "3: movl %4,%0\n"
55 " jmp 2b\n"
56 ".previous\n"
57 ".section __ex_table,\"a\"\n"
58 " .align 8\n" " .quad 1b,3b\n" ".previous":"=&bDS" (err)
59 :"a"(eax), "d"(edx), "c"(reg), "i"(-EIO), "0"(0));
60
61 return err;
62}
63
64static inline int rdmsr_eio(u32 reg, u32 *eax, u32 *edx)
65{
66 int err;
67
68 asm volatile ("1: rdmsr\n"
69 "2:\n"
70 ".section .fixup,\"ax\"\n"
71 "3: movl %4,%0\n"
72 " jmp 2b\n"
73 ".previous\n"
74 ".section __ex_table,\"a\"\n"
75 " .align 8\n"
76 " .quad 1b,3b\n"
77 ".previous":"=&bDS" (err), "=a"(*eax), "=d"(*edx)
78 :"c"(reg), "i"(-EIO), "0"(0));
79
80 return err;
81}
82
83#ifdef CONFIG_SMP
84
85struct msr_command {
86 int cpu;
87 int err;
88 u32 reg;
89 u32 data[2];
90};
91
92static void msr_smp_wrmsr(void *cmd_block)
93{
94 struct msr_command *cmd = (struct msr_command *)cmd_block;
95
96 if (cmd->cpu == smp_processor_id())
97 cmd->err = wrmsr_eio(cmd->reg, cmd->data[0], cmd->data[1]);
98}
99
100static void msr_smp_rdmsr(void *cmd_block)
101{
102 struct msr_command *cmd = (struct msr_command *)cmd_block;
103
104 if (cmd->cpu == smp_processor_id())
105 cmd->err = rdmsr_eio(cmd->reg, &cmd->data[0], &cmd->data[1]);
106}
107
108static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
109{
110 struct msr_command cmd;
111 int ret;
112
113 preempt_disable();
114 if (cpu == smp_processor_id()) {
115 ret = wrmsr_eio(reg, eax, edx);
116 } else {
117 cmd.cpu = cpu;
118 cmd.reg = reg;
119 cmd.data[0] = eax;
120 cmd.data[1] = edx;
121
122 smp_call_function(msr_smp_wrmsr, &cmd, 1, 1);
123 ret = cmd.err;
124 }
125 preempt_enable();
126 return ret;
127}
128
129static inline int do_rdmsr(int cpu, u32 reg, u32 * eax, u32 * edx)
130{
131 struct msr_command cmd;
132 int ret;
133
134 preempt_disable();
135 if (cpu == smp_processor_id()) {
136 ret = rdmsr_eio(reg, eax, edx);
137 } else {
138 cmd.cpu = cpu;
139 cmd.reg = reg;
140
141 smp_call_function(msr_smp_rdmsr, &cmd, 1, 1);
142
143 *eax = cmd.data[0];
144 *edx = cmd.data[1];
145
146 ret = cmd.err;
147 }
148 preempt_enable();
149 return ret;
150}
151
152#else /* ! CONFIG_SMP */
153
154static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
155{
156 return wrmsr_eio(reg, eax, edx);
157}
158
159static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx)
160{
161 return rdmsr_eio(reg, eax, edx);
162}
163
164#endif /* ! CONFIG_SMP */
165
166static loff_t msr_seek(struct file *file, loff_t offset, int orig)
167{
168 loff_t ret = -EINVAL;
169
170 lock_kernel();
171 switch (orig) {
172 case 0:
173 file->f_pos = offset;
174 ret = file->f_pos;
175 break;
176 case 1:
177 file->f_pos += offset;
178 ret = file->f_pos;
179 }
180 unlock_kernel();
181 return ret;
182}
183
184static ssize_t msr_read(struct file *file, char __user * buf,
185 size_t count, loff_t * ppos)
186{
187 u32 __user *tmp = (u32 __user *) buf;
188 u32 data[2];
189 size_t rv;
190 u32 reg = *ppos;
191 int cpu = iminor(file->f_dentry->d_inode);
192 int err;
193
194 if (count % 8)
195 return -EINVAL; /* Invalid chunk size */
196
197 for (rv = 0; count; count -= 8) {
198 err = do_rdmsr(cpu, reg, &data[0], &data[1]);
199 if (err)
200 return err;
201 if (copy_to_user(tmp, &data, 8))
202 return -EFAULT;
203 tmp += 2;
204 }
205
206 return ((char __user *)tmp) - buf;
207}
208
209static ssize_t msr_write(struct file *file, const char __user *buf,
210 size_t count, loff_t *ppos)
211{
212 const u32 __user *tmp = (const u32 __user *)buf;
213 u32 data[2];
214 size_t rv;
215 u32 reg = *ppos;
216 int cpu = iminor(file->f_dentry->d_inode);
217 int err;
218
219 if (count % 8)
220 return -EINVAL; /* Invalid chunk size */
221
222 for (rv = 0; count; count -= 8) {
223 if (copy_from_user(&data, tmp, 8))
224 return -EFAULT;
225 err = do_wrmsr(cpu, reg, data[0], data[1]);
226 if (err)
227 return err;
228 tmp += 2;
229 }
230
231 return ((char __user *)tmp) - buf;
232}
233
234static int msr_open(struct inode *inode, struct file *file)
235{
236 unsigned int cpu = iminor(file->f_dentry->d_inode);
237 struct cpuinfo_x86 *c = &(cpu_data)[cpu];
238
239 if (cpu >= NR_CPUS || !cpu_online(cpu))
240 return -ENXIO; /* No such CPU */
241 if (!cpu_has(c, X86_FEATURE_MSR))
242 return -EIO; /* MSR not supported */
243
244 return 0;
245}
246
247/*
248 * File operations we support
249 */
250static struct file_operations msr_fops = {
251 .owner = THIS_MODULE,
252 .llseek = msr_seek,
253 .read = msr_read,
254 .write = msr_write,
255 .open = msr_open,
256};
257
258static int __init msr_init(void)
259{
260 if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) {
261 printk(KERN_ERR "msr: unable to get major %d for msr\n",
262 MSR_MAJOR);
263 return -EBUSY;
264 }
265
266 return 0;
267}
268
269static void __exit msr_exit(void)
270{
271 unregister_chrdev(MSR_MAJOR, "cpu/msr");
272}
273
274module_init(msr_init);
275module_exit(msr_exit)
276
277MODULE_AUTHOR("H. Peter Anvin <hpa@zytor.com>");
278MODULE_DESCRIPTION("x86 generic MSR driver");
279MODULE_LICENSE("GPL");
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index caf164959e19..4388b8a5bae7 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -14,7 +14,6 @@
14 14
15#include <linux/config.h> 15#include <linux/config.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/irq.h>
18#include <linux/delay.h> 17#include <linux/delay.h>
19#include <linux/bootmem.h> 18#include <linux/bootmem.h>
20#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
@@ -488,8 +487,8 @@ void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason)
488 == NOTIFY_STOP) { 487 == NOTIFY_STOP) {
489 local_set(&__get_cpu_var(alert_counter), 0); 488 local_set(&__get_cpu_var(alert_counter), 0);
490 return; 489 return;
491 } 490 }
492 die_nmi("NMI Watchdog detected LOCKUP on CPU%d", regs); 491 die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs);
493 } 492 }
494 } else { 493 } else {
495 __get_cpu_var(last_irq_sum) = sum; 494 __get_cpu_var(last_irq_sum) = sum;
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 57f35c68aa34..cf0a0315d586 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -191,11 +191,9 @@ static void *dma_alloc_pages(struct device *dev, unsigned gfp, unsigned order)
191{ 191{
192 struct page *page; 192 struct page *page;
193 int node; 193 int node;
194 if (dev->bus == &pci_bus_type) { 194 if (dev->bus == &pci_bus_type)
195 cpumask_t mask; 195 node = pcibus_to_node(to_pci_dev(dev)->bus);
196 mask = pcibus_to_cpumask(to_pci_dev(dev)->bus); 196 else
197 node = cpu_to_node(first_cpu(mask));
198 } else
199 node = numa_node_id(); 197 node = numa_node_id();
200 page = alloc_pages_node(node, gfp, order); 198 page = alloc_pages_node(node, gfp, order);
201 return page ? page_address(page) : NULL; 199 return page ? page_address(page) : NULL;
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 8661f82ac70b..b5a89c0bdf59 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -32,7 +32,6 @@
32#include <linux/a.out.h> 32#include <linux/a.out.h>
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/irq.h>
36#include <linux/ptrace.h> 35#include <linux/ptrace.h>
37#include <linux/utsname.h> 36#include <linux/utsname.h>
38#include <linux/random.h> 37#include <linux/random.h>
@@ -123,6 +122,7 @@ static void poll_idle (void)
123 : : 122 : :
124 "i" (_TIF_NEED_RESCHED), 123 "i" (_TIF_NEED_RESCHED),
125 "m" (current_thread_info()->flags)); 124 "m" (current_thread_info()->flags));
125 clear_thread_flag(TIF_POLLING_NRFLAG);
126 } else { 126 } else {
127 set_need_resched(); 127 set_need_resched();
128 } 128 }
@@ -271,8 +271,11 @@ void __show_regs(struct pt_regs * regs)
271 271
272 printk("\n"); 272 printk("\n");
273 print_modules(); 273 print_modules();
274 printk("Pid: %d, comm: %.20s %s %s\n", 274 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
275 current->pid, current->comm, print_tainted(), system_utsname.release); 275 current->pid, current->comm, print_tainted(),
276 system_utsname.release,
277 (int)strcspn(system_utsname.version, " "),
278 system_utsname.version);
276 printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip); 279 printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
277 printk_address(regs->rip); 280 printk_address(regs->rip);
278 printk("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, regs->eflags); 281 printk("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, regs->eflags);
@@ -483,33 +486,6 @@ out:
483} 486}
484 487
485/* 488/*
486 * This function selects if the context switch from prev to next
487 * has to tweak the TSC disable bit in the cr4.
488 */
489static inline void disable_tsc(struct task_struct *prev_p,
490 struct task_struct *next_p)
491{
492 struct thread_info *prev, *next;
493
494 /*
495 * gcc should eliminate the ->thread_info dereference if
496 * has_secure_computing returns 0 at compile time (SECCOMP=n).
497 */
498 prev = prev_p->thread_info;
499 next = next_p->thread_info;
500
501 if (has_secure_computing(prev) || has_secure_computing(next)) {
502 /* slow path here */
503 if (has_secure_computing(prev) &&
504 !has_secure_computing(next)) {
505 write_cr4(read_cr4() & ~X86_CR4_TSD);
506 } else if (!has_secure_computing(prev) &&
507 has_secure_computing(next))
508 write_cr4(read_cr4() | X86_CR4_TSD);
509 }
510}
511
512/*
513 * This special macro can be used to load a debugging register 489 * This special macro can be used to load a debugging register
514 */ 490 */
515#define loaddebug(thread,r) set_debug(thread->debugreg ## r, r) 491#define loaddebug(thread,r) set_debug(thread->debugreg ## r, r)
@@ -627,8 +603,6 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *
627 } 603 }
628 } 604 }
629 605
630 disable_tsc(prev_p, next_p);
631
632 return prev_p; 606 return prev_p;
633} 607}
634 608
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index b356f8e6adfe..351d8d64c2fb 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -71,7 +71,7 @@ unsigned long mmu_cr4_features;
71 71
72int acpi_disabled; 72int acpi_disabled;
73EXPORT_SYMBOL(acpi_disabled); 73EXPORT_SYMBOL(acpi_disabled);
74#ifdef CONFIG_ACPI_BOOT 74#ifdef CONFIG_ACPI
75extern int __initdata acpi_ht; 75extern int __initdata acpi_ht;
76extern acpi_interrupt_flags acpi_sci_flags; 76extern acpi_interrupt_flags acpi_sci_flags;
77int __initdata acpi_force = 0; 77int __initdata acpi_force = 0;
@@ -294,7 +294,7 @@ static __init void parse_cmdline_early (char ** cmdline_p)
294 maxcpus = simple_strtoul(from + 8, NULL, 0); 294 maxcpus = simple_strtoul(from + 8, NULL, 0);
295 } 295 }
296#endif 296#endif
297#ifdef CONFIG_ACPI_BOOT 297#ifdef CONFIG_ACPI
298 /* "acpi=off" disables both ACPI table parsing and interpreter init */ 298 /* "acpi=off" disables both ACPI table parsing and interpreter init */
299 if (!memcmp(from, "acpi=off", 8)) 299 if (!memcmp(from, "acpi=off", 8))
300 disable_acpi(); 300 disable_acpi();
@@ -336,6 +336,11 @@ static __init void parse_cmdline_early (char ** cmdline_p)
336#endif 336#endif
337#endif 337#endif
338 338
339 if (!memcmp(from, "disable_timer_pin_1", 19))
340 disable_timer_pin_1 = 1;
341 if (!memcmp(from, "enable_timer_pin_1", 18))
342 disable_timer_pin_1 = -1;
343
339 if (!memcmp(from, "nolapic", 7) || 344 if (!memcmp(from, "nolapic", 7) ||
340 !memcmp(from, "disableapic", 11)) 345 !memcmp(from, "disableapic", 11))
341 disable_apic = 1; 346 disable_apic = 1;
@@ -566,7 +571,7 @@ void __init setup_arch(char **cmdline_p)
566 571
567 init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT)); 572 init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT));
568 573
569#ifdef CONFIG_ACPI_BOOT 574#ifdef CONFIG_ACPI
570 /* 575 /*
571 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT). 576 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
572 * Call this early for SRAT node setup. 577 * Call this early for SRAT node setup.
@@ -658,7 +663,7 @@ void __init setup_arch(char **cmdline_p)
658 663
659 check_ioapic(); 664 check_ioapic();
660 665
661#ifdef CONFIG_ACPI_BOOT 666#ifdef CONFIG_ACPI
662 /* 667 /*
663 * Read APIC and some other early information from ACPI tables. 668 * Read APIC and some other early information from ACPI tables.
664 */ 669 */
@@ -755,6 +760,24 @@ static void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
755 } 760 }
756} 761}
757 762
763#ifdef CONFIG_NUMA
764static int nearby_node(int apicid)
765{
766 int i;
767 for (i = apicid - 1; i >= 0; i--) {
768 int node = apicid_to_node[i];
769 if (node != NUMA_NO_NODE && node_online(node))
770 return node;
771 }
772 for (i = apicid + 1; i < MAX_LOCAL_APIC; i++) {
773 int node = apicid_to_node[i];
774 if (node != NUMA_NO_NODE && node_online(node))
775 return node;
776 }
777 return first_node(node_online_map); /* Shouldn't happen */
778}
779#endif
780
758/* 781/*
759 * On a AMD dual core setup the lower bits of the APIC id distingush the cores. 782 * On a AMD dual core setup the lower bits of the APIC id distingush the cores.
760 * Assumes number of cores is a power of two. 783 * Assumes number of cores is a power of two.
@@ -763,8 +786,11 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
763{ 786{
764#ifdef CONFIG_SMP 787#ifdef CONFIG_SMP
765 int cpu = smp_processor_id(); 788 int cpu = smp_processor_id();
766 int node = 0;
767 unsigned bits; 789 unsigned bits;
790#ifdef CONFIG_NUMA
791 int node = 0;
792 unsigned apicid = phys_proc_id[cpu];
793#endif
768 794
769 bits = 0; 795 bits = 0;
770 while ((1 << bits) < c->x86_num_cores) 796 while ((1 << bits) < c->x86_num_cores)
@@ -776,20 +802,32 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
776 phys_proc_id[cpu] >>= bits; 802 phys_proc_id[cpu] >>= bits;
777 803
778#ifdef CONFIG_NUMA 804#ifdef CONFIG_NUMA
779 /* When an ACPI SRAT table is available use the mappings from SRAT 805 node = phys_proc_id[cpu];
780 instead. */ 806 if (apicid_to_node[apicid] != NUMA_NO_NODE)
781 if (acpi_numa <= 0) { 807 node = apicid_to_node[apicid];
782 node = phys_proc_id[cpu]; 808 if (!node_online(node)) {
783 if (!node_online(node)) 809 /* Two possibilities here:
784 node = first_node(node_online_map); 810 - The CPU is missing memory and no node was created.
785 cpu_to_node[cpu] = node; 811 In that case try picking one from a nearby CPU
786 } else { 812 - The APIC IDs differ from the HyperTransport node IDs
787 node = cpu_to_node[cpu]; 813 which the K8 northbridge parsing fills in.
788 } 814 Assume they are all increased by a constant offset,
815 but in the same order as the HT nodeids.
816 If that doesn't result in a usable node fall back to the
817 path for the previous case. */
818 int ht_nodeid = apicid - (phys_proc_id[0] << bits);
819 if (ht_nodeid >= 0 &&
820 apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
821 node = apicid_to_node[ht_nodeid];
822 /* Pick a nearby node */
823 if (!node_online(node))
824 node = nearby_node(apicid);
825 }
826 cpu_to_node[cpu] = node;
827
828 printk(KERN_INFO "CPU %d(%d) -> Node %d -> Core %d\n",
829 cpu, c->x86_num_cores, node, cpu_core_id[cpu]);
789#endif 830#endif
790
791 printk(KERN_INFO "CPU %d(%d) -> Node %d -> Core %d\n",
792 cpu, c->x86_num_cores, node, cpu_core_id[cpu]);
793#endif 831#endif
794} 832}
795 833
@@ -909,6 +947,25 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
909 return 1; 947 return 1;
910} 948}
911 949
950static void srat_detect_node(void)
951{
952#ifdef CONFIG_NUMA
953 unsigned apicid, node;
954 int cpu = smp_processor_id();
955
956 /* Don't do the funky fallback heuristics the AMD version employs
957 for now. */
958 apicid = phys_proc_id[cpu];
959 node = apicid_to_node[apicid];
960 if (node == NUMA_NO_NODE)
961 node = 0;
962 cpu_to_node[cpu] = node;
963
964 if (acpi_numa > 0)
965 printk(KERN_INFO "CPU %d -> Node %d\n", cpu, node);
966#endif
967}
968
912static void __cpuinit init_intel(struct cpuinfo_x86 *c) 969static void __cpuinit init_intel(struct cpuinfo_x86 *c)
913{ 970{
914 /* Cache sizes */ 971 /* Cache sizes */
@@ -927,9 +984,11 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
927 if (c->x86 >= 15) 984 if (c->x86 >= 15)
928 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); 985 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
929 c->x86_num_cores = intel_num_cpu_cores(c); 986 c->x86_num_cores = intel_num_cpu_cores(c);
987
988 srat_detect_node();
930} 989}
931 990
932void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) 991static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
933{ 992{
934 char *v = c->x86_vendor_id; 993 char *v = c->x86_vendor_id;
935 994
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index e3ffcacc8c90..bd33be24a386 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -94,7 +94,7 @@ void __init setup_per_cpu_areas(void)
94 size = PERCPU_ENOUGH_ROOM; 94 size = PERCPU_ENOUGH_ROOM;
95#endif 95#endif
96 96
97 for (i = 0; i < NR_CPUS; i++) { 97 for_each_cpu_mask (i, cpu_possible_map) {
98 char *ptr; 98 char *ptr;
99 99
100 if (!NODE_DATA(cpu_to_node(i))) { 100 if (!NODE_DATA(cpu_to_node(i))) {
@@ -119,7 +119,6 @@ void pda_init(int cpu)
119 asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); 119 asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0));
120 wrmsrl(MSR_GS_BASE, cpu_pda + cpu); 120 wrmsrl(MSR_GS_BASE, cpu_pda + cpu);
121 121
122 pda->me = pda;
123 pda->cpunumber = cpu; 122 pda->cpunumber = cpu;
124 pda->irqcount = -1; 123 pda->irqcount = -1;
125 pda->kernelstack = 124 pda->kernelstack =
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
index e5958220d6b8..9db9dda161b4 100644
--- a/arch/x86_64/kernel/smp.c
+++ b/arch/x86_64/kernel/smp.c
@@ -12,7 +12,6 @@
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/irq.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <linux/spinlock.h> 16#include <linux/spinlock.h>
18#include <linux/smp_lock.h> 17#include <linux/smp_lock.h>
@@ -29,6 +28,8 @@
29#include <asm/proto.h> 28#include <asm/proto.h>
30#include <asm/apicdef.h> 29#include <asm/apicdef.h>
31 30
31#define __cpuinit __init
32
32/* 33/*
33 * Smarter SMP flushing macros. 34 * Smarter SMP flushing macros.
34 * c/o Linus Torvalds. 35 * c/o Linus Torvalds.
@@ -37,19 +38,41 @@
37 * writing to user space from interrupts. (Its not allowed anyway). 38 * writing to user space from interrupts. (Its not allowed anyway).
38 * 39 *
39 * Optimizations Manfred Spraul <manfred@colorfullife.com> 40 * Optimizations Manfred Spraul <manfred@colorfullife.com>
41 *
42 * More scalable flush, from Andi Kleen
43 *
44 * To avoid global state use 8 different call vectors.
45 * Each CPU uses a specific vector to trigger flushes on other
46 * CPUs. Depending on the received vector the target CPUs look into
47 * the right per cpu variable for the flush data.
48 *
49 * With more than 8 CPUs they are hashed to the 8 available
50 * vectors. The limited global vector space forces us to this right now.
51 * In future when interrupts are split into per CPU domains this could be
52 * fixed, at the cost of triggering multiple IPIs in some cases.
40 */ 53 */
41 54
42static cpumask_t flush_cpumask; 55union smp_flush_state {
43static struct mm_struct * flush_mm; 56 struct {
44static unsigned long flush_va; 57 cpumask_t flush_cpumask;
45static DEFINE_SPINLOCK(tlbstate_lock); 58 struct mm_struct *flush_mm;
59 unsigned long flush_va;
46#define FLUSH_ALL -1ULL 60#define FLUSH_ALL -1ULL
61 spinlock_t tlbstate_lock;
62 };
63 char pad[SMP_CACHE_BYTES];
64} ____cacheline_aligned;
65
66/* State is put into the per CPU data section, but padded
67 to a full cache line because other CPUs can access it and we don't
68 want false sharing in the per cpu data segment. */
69static DEFINE_PER_CPU(union smp_flush_state, flush_state);
47 70
48/* 71/*
49 * We cannot call mmdrop() because we are in interrupt context, 72 * We cannot call mmdrop() because we are in interrupt context,
50 * instead update mm->cpu_vm_mask. 73 * instead update mm->cpu_vm_mask.
51 */ 74 */
52static inline void leave_mm (unsigned long cpu) 75static inline void leave_mm(int cpu)
53{ 76{
54 if (read_pda(mmu_state) == TLBSTATE_OK) 77 if (read_pda(mmu_state) == TLBSTATE_OK)
55 BUG(); 78 BUG();
@@ -101,15 +124,25 @@ static inline void leave_mm (unsigned long cpu)
101 * 124 *
102 * 1) Flush the tlb entries if the cpu uses the mm that's being flushed. 125 * 1) Flush the tlb entries if the cpu uses the mm that's being flushed.
103 * 2) Leave the mm if we are in the lazy tlb mode. 126 * 2) Leave the mm if we are in the lazy tlb mode.
127 *
128 * Interrupts are disabled.
104 */ 129 */
105 130
106asmlinkage void smp_invalidate_interrupt (void) 131asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs)
107{ 132{
108 unsigned long cpu; 133 int cpu;
134 int sender;
135 union smp_flush_state *f;
109 136
110 cpu = get_cpu(); 137 cpu = smp_processor_id();
138 /*
139 * orig_rax contains the interrupt vector - 256.
140 * Use that to determine where the sender put the data.
141 */
142 sender = regs->orig_rax + 256 - INVALIDATE_TLB_VECTOR_START;
143 f = &per_cpu(flush_state, sender);
111 144
112 if (!cpu_isset(cpu, flush_cpumask)) 145 if (!cpu_isset(cpu, f->flush_cpumask))
113 goto out; 146 goto out;
114 /* 147 /*
115 * This was a BUG() but until someone can quote me the 148 * This was a BUG() but until someone can quote me the
@@ -120,64 +153,63 @@ asmlinkage void smp_invalidate_interrupt (void)
120 * BUG(); 153 * BUG();
121 */ 154 */
122 155
123 if (flush_mm == read_pda(active_mm)) { 156 if (f->flush_mm == read_pda(active_mm)) {
124 if (read_pda(mmu_state) == TLBSTATE_OK) { 157 if (read_pda(mmu_state) == TLBSTATE_OK) {
125 if (flush_va == FLUSH_ALL) 158 if (f->flush_va == FLUSH_ALL)
126 local_flush_tlb(); 159 local_flush_tlb();
127 else 160 else
128 __flush_tlb_one(flush_va); 161 __flush_tlb_one(f->flush_va);
129 } else 162 } else
130 leave_mm(cpu); 163 leave_mm(cpu);
131 } 164 }
132out: 165out:
133 ack_APIC_irq(); 166 ack_APIC_irq();
134 cpu_clear(cpu, flush_cpumask); 167 cpu_clear(cpu, f->flush_cpumask);
135 put_cpu_no_resched();
136} 168}
137 169
138static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, 170static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
139 unsigned long va) 171 unsigned long va)
140{ 172{
141 cpumask_t tmp; 173 int sender;
142 /* 174 union smp_flush_state *f;
143 * A couple of (to be removed) sanity checks:
144 *
145 * - we do not send IPIs to not-yet booted CPUs.
146 * - current CPU must not be in mask
147 * - mask must exist :)
148 */
149 BUG_ON(cpus_empty(cpumask));
150 cpus_and(tmp, cpumask, cpu_online_map);
151 BUG_ON(!cpus_equal(tmp, cpumask));
152 BUG_ON(cpu_isset(smp_processor_id(), cpumask));
153 if (!mm)
154 BUG();
155 175
156 /* 176 /* Caller has disabled preemption */
157 * I'm not happy about this global shared spinlock in the 177 sender = smp_processor_id() % NUM_INVALIDATE_TLB_VECTORS;
158 * MM hot path, but we'll see how contended it is. 178 f = &per_cpu(flush_state, sender);
159 * Temporarily this turns IRQs off, so that lockups are 179
160 * detected by the NMI watchdog. 180 /* Could avoid this lock when
161 */ 181 num_online_cpus() <= NUM_INVALIDATE_TLB_VECTORS, but it is
162 spin_lock(&tlbstate_lock); 182 probably not worth checking this for a cache-hot lock. */
163 183 spin_lock(&f->tlbstate_lock);
164 flush_mm = mm; 184
165 flush_va = va; 185 f->flush_mm = mm;
166 cpus_or(flush_cpumask, cpumask, flush_cpumask); 186 f->flush_va = va;
187 cpus_or(f->flush_cpumask, cpumask, f->flush_cpumask);
167 188
168 /* 189 /*
169 * We have to send the IPI only to 190 * We have to send the IPI only to
170 * CPUs affected. 191 * CPUs affected.
171 */ 192 */
172 send_IPI_mask(cpumask, INVALIDATE_TLB_VECTOR); 193 send_IPI_mask(cpumask, INVALIDATE_TLB_VECTOR_START + sender);
194
195 while (!cpus_empty(f->flush_cpumask))
196 cpu_relax();
173 197
174 while (!cpus_empty(flush_cpumask)) 198 f->flush_mm = NULL;
175 mb(); /* nothing. lockup detection does not belong here */; 199 f->flush_va = 0;
200 spin_unlock(&f->tlbstate_lock);
201}
176 202
177 flush_mm = NULL; 203int __cpuinit init_smp_flush(void)
178 flush_va = 0; 204{
179 spin_unlock(&tlbstate_lock); 205 int i;
206 for_each_cpu_mask(i, cpu_possible_map) {
207 spin_lock_init(&per_cpu(flush_state.tlbstate_lock, i));
208 }
209 return 0;
180} 210}
211
212core_initcall(init_smp_flush);
181 213
182void flush_tlb_current_task(void) 214void flush_tlb_current_task(void)
183{ 215{
@@ -295,8 +327,11 @@ void unlock_ipi_call_lock(void)
295/* 327/*
296 * this function sends a 'generic call function' IPI to one other CPU 328 * this function sends a 'generic call function' IPI to one other CPU
297 * in the system. 329 * in the system.
330 *
331 * cpu is a standard Linux logical CPU number.
298 */ 332 */
299static void __smp_call_function_single (int cpu, void (*func) (void *info), void *info, 333static void
334__smp_call_function_single(int cpu, void (*func) (void *info), void *info,
300 int nonatomic, int wait) 335 int nonatomic, int wait)
301{ 336{
302 struct call_data_struct data; 337 struct call_data_struct data;
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 90aeccd15190..e12d7baeb33e 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -44,7 +44,6 @@
44#include <linux/mm.h> 44#include <linux/mm.h>
45#include <linux/kernel_stat.h> 45#include <linux/kernel_stat.h>
46#include <linux/smp_lock.h> 46#include <linux/smp_lock.h>
47#include <linux/irq.h>
48#include <linux/bootmem.h> 47#include <linux/bootmem.h>
49#include <linux/thread_info.h> 48#include <linux/thread_info.h>
50#include <linux/module.h> 49#include <linux/module.h>
@@ -58,6 +57,8 @@
58#include <asm/tlbflush.h> 57#include <asm/tlbflush.h>
59#include <asm/proto.h> 58#include <asm/proto.h>
60#include <asm/nmi.h> 59#include <asm/nmi.h>
60#include <asm/irq.h>
61#include <asm/hw_irq.h>
61 62
62/* Number of siblings per CPU package */ 63/* Number of siblings per CPU package */
63int smp_num_siblings = 1; 64int smp_num_siblings = 1;
@@ -413,8 +414,13 @@ void __cpuinit smp_callin(void)
413 414
414 /* 415 /*
415 * Get our bogomips. 416 * Get our bogomips.
417 *
418 * Need to enable IRQs because it can take longer and then
419 * the NMI watchdog might kill us.
416 */ 420 */
421 local_irq_enable();
417 calibrate_delay(); 422 calibrate_delay();
423 local_irq_disable();
418 Dprintk("Stack at about %p\n",&cpuid); 424 Dprintk("Stack at about %p\n",&cpuid);
419 425
420 disable_APIC_timer(); 426 disable_APIC_timer();
@@ -540,8 +546,8 @@ static void inquire_remote_apic(int apicid)
540 */ 546 */
541 apic_wait_icr_idle(); 547 apic_wait_icr_idle();
542 548
543 apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(apicid)); 549 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(apicid));
544 apic_write_around(APIC_ICR, APIC_DM_REMRD | regs[i]); 550 apic_write(APIC_ICR, APIC_DM_REMRD | regs[i]);
545 551
546 timeout = 0; 552 timeout = 0;
547 do { 553 do {
@@ -574,12 +580,12 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
574 /* 580 /*
575 * Turn INIT on target chip 581 * Turn INIT on target chip
576 */ 582 */
577 apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); 583 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid));
578 584
579 /* 585 /*
580 * Send IPI 586 * Send IPI
581 */ 587 */
582 apic_write_around(APIC_ICR, APIC_INT_LEVELTRIG | APIC_INT_ASSERT 588 apic_write(APIC_ICR, APIC_INT_LEVELTRIG | APIC_INT_ASSERT
583 | APIC_DM_INIT); 589 | APIC_DM_INIT);
584 590
585 Dprintk("Waiting for send to finish...\n"); 591 Dprintk("Waiting for send to finish...\n");
@@ -595,10 +601,10 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
595 Dprintk("Deasserting INIT.\n"); 601 Dprintk("Deasserting INIT.\n");
596 602
597 /* Target chip */ 603 /* Target chip */
598 apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); 604 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid));
599 605
600 /* Send IPI */ 606 /* Send IPI */
601 apic_write_around(APIC_ICR, APIC_INT_LEVELTRIG | APIC_DM_INIT); 607 apic_write(APIC_ICR, APIC_INT_LEVELTRIG | APIC_DM_INIT);
602 608
603 Dprintk("Waiting for send to finish...\n"); 609 Dprintk("Waiting for send to finish...\n");
604 timeout = 0; 610 timeout = 0;
@@ -610,16 +616,7 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
610 616
611 atomic_set(&init_deasserted, 1); 617 atomic_set(&init_deasserted, 1);
612 618
613 /* 619 num_starts = 2;
614 * Should we send STARTUP IPIs ?
615 *
616 * Determine this based on the APIC version.
617 * If we don't have an integrated APIC, don't send the STARTUP IPIs.
618 */
619 if (APIC_INTEGRATED(apic_version[phys_apicid]))
620 num_starts = 2;
621 else
622 num_starts = 0;
623 620
624 /* 621 /*
625 * Run STARTUP IPI loop. 622 * Run STARTUP IPI loop.
@@ -640,12 +637,11 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
640 */ 637 */
641 638
642 /* Target chip */ 639 /* Target chip */
643 apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); 640 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid));
644 641
645 /* Boot on the stack */ 642 /* Boot on the stack */
646 /* Kick the second */ 643 /* Kick the second */
647 apic_write_around(APIC_ICR, APIC_DM_STARTUP 644 apic_write(APIC_ICR, APIC_DM_STARTUP | (start_rip >> 12));
648 | (start_rip >> 12));
649 645
650 /* 646 /*
651 * Give the other CPU some time to accept the IPI. 647 * Give the other CPU some time to accept the IPI.
@@ -864,17 +860,6 @@ static __cpuinit void smp_cleanup_boot(void)
864 * Reset trampoline flag 860 * Reset trampoline flag
865 */ 861 */
866 *((volatile int *) phys_to_virt(0x467)) = 0; 862 *((volatile int *) phys_to_virt(0x467)) = 0;
867
868#ifndef CONFIG_HOTPLUG_CPU
869 /*
870 * Free pages reserved for SMP bootup.
871 * When you add hotplug CPU support later remove this
872 * Note there is more work to be done for later CPU bootup.
873 */
874
875 free_page((unsigned long) __va(PAGE_SIZE));
876 free_page((unsigned long) __va(SMP_TRAMPOLINE_BASE));
877#endif
878} 863}
879 864
880/* 865/*
@@ -894,23 +879,6 @@ static __init void disable_smp(void)
894 cpu_set(0, cpu_core_map[0]); 879 cpu_set(0, cpu_core_map[0]);
895} 880}
896 881
897/*
898 * Handle user cpus=... parameter.
899 */
900static __init void enforce_max_cpus(unsigned max_cpus)
901{
902 int i, k;
903 k = 0;
904 for (i = 0; i < NR_CPUS; i++) {
905 if (!cpu_possible(i))
906 continue;
907 if (++k > max_cpus) {
908 cpu_clear(i, cpu_possible_map);
909 cpu_clear(i, cpu_present_map);
910 }
911 }
912}
913
914#ifdef CONFIG_HOTPLUG_CPU 882#ifdef CONFIG_HOTPLUG_CPU
915/* 883/*
916 * cpu_possible_map should be static, it cannot change as cpu's 884 * cpu_possible_map should be static, it cannot change as cpu's
@@ -999,8 +967,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
999 current_cpu_data = boot_cpu_data; 967 current_cpu_data = boot_cpu_data;
1000 current_thread_info()->cpu = 0; /* needed? */ 968 current_thread_info()->cpu = 0; /* needed? */
1001 969
1002 enforce_max_cpus(max_cpus);
1003
1004#ifdef CONFIG_HOTPLUG_CPU 970#ifdef CONFIG_HOTPLUG_CPU
1005 prefill_possible_map(); 971 prefill_possible_map();
1006#endif 972#endif
diff --git a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c
index 0612640d91b1..ebb9abf3ce6d 100644
--- a/arch/x86_64/kernel/suspend.c
+++ b/arch/x86_64/kernel/suspend.c
@@ -8,23 +8,8 @@
8 */ 8 */
9 9
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/kernel.h> 11#include <linux/smp.h>
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/types.h>
15#include <linux/spinlock.h>
16#include <linux/poll.h>
17#include <linux/delay.h>
18#include <linux/sysrq.h>
19#include <linux/proc_fs.h>
20#include <linux/irq.h>
21#include <linux/pm.h>
22#include <linux/device.h>
23#include <linux/suspend.h> 12#include <linux/suspend.h>
24#include <asm/uaccess.h>
25#include <asm/acpi.h>
26#include <asm/tlbflush.h>
27#include <asm/io.h>
28#include <asm/proto.h> 13#include <asm/proto.h>
29 14
30struct saved_context saved_context; 15struct saved_context saved_context;
diff --git a/arch/x86_64/kernel/suspend_asm.S b/arch/x86_64/kernel/suspend_asm.S
index 53f8e1659511..4d659e97df10 100644
--- a/arch/x86_64/kernel/suspend_asm.S
+++ b/arch/x86_64/kernel/suspend_asm.S
@@ -14,7 +14,7 @@
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <asm/segment.h> 15#include <asm/segment.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/offset.h> 17#include <asm/asm-offsets.h>
18 18
19ENTRY(swsusp_arch_suspend) 19ENTRY(swsusp_arch_suspend)
20 20
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 7b6abe058253..2373cb8b8625 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -18,7 +18,6 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/mc146818rtc.h> 20#include <linux/mc146818rtc.h>
21#include <linux/irq.h>
22#include <linux/time.h> 21#include <linux/time.h>
23#include <linux/ioport.h> 22#include <linux/ioport.h>
24#include <linux/module.h> 23#include <linux/module.h>
@@ -937,7 +936,6 @@ void __init time_init(void)
937 vxtime.mode = VXTIME_TSC; 936 vxtime.mode = VXTIME_TSC;
938 vxtime.quot = (1000000L << 32) / vxtime_hz; 937 vxtime.quot = (1000000L << 32) / vxtime_hz;
939 vxtime.tsc_quot = (1000L << 32) / cpu_khz; 938 vxtime.tsc_quot = (1000L << 32) / cpu_khz;
940 vxtime.hz = vxtime_hz;
941 rdtscll_sync(&vxtime.last_tsc); 939 rdtscll_sync(&vxtime.last_tsc);
942 setup_irq(0, &irq0); 940 setup_irq(0, &irq0);
943 941
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index f238d6078a5a..b5e09e6b5536 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -47,9 +47,6 @@
47#include <asm/proto.h> 47#include <asm/proto.h>
48#include <asm/nmi.h> 48#include <asm/nmi.h>
49 49
50#include <linux/irq.h>
51
52
53extern struct gate_struct idt_table[256]; 50extern struct gate_struct idt_table[256];
54 51
55asmlinkage void divide_error(void); 52asmlinkage void divide_error(void);
@@ -324,13 +321,13 @@ void handle_BUG(struct pt_regs *regs)
324 if (__copy_from_user(&f, (struct bug_frame *) regs->rip, 321 if (__copy_from_user(&f, (struct bug_frame *) regs->rip,
325 sizeof(struct bug_frame))) 322 sizeof(struct bug_frame)))
326 return; 323 return;
327 if ((unsigned long)f.filename < __PAGE_OFFSET || 324 if (f.filename >= 0 ||
328 f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) 325 f.ud2[0] != 0x0f || f.ud2[1] != 0x0b)
329 return; 326 return;
330 if (__get_user(tmp, f.filename)) 327 if (__get_user(tmp, (char *)(long)f.filename))
331 f.filename = "unmapped filename"; 328 f.filename = (int)(long)"unmapped filename";
332 printk("----------- [cut here ] --------- [please bite here ] ---------\n"); 329 printk("----------- [cut here ] --------- [please bite here ] ---------\n");
333 printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", f.filename, f.line); 330 printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", (char *)(long)f.filename, f.line);
334} 331}
335 332
336#ifdef CONFIG_BUG 333#ifdef CONFIG_BUG
@@ -343,30 +340,33 @@ void out_of_line_bug(void)
343static DEFINE_SPINLOCK(die_lock); 340static DEFINE_SPINLOCK(die_lock);
344static int die_owner = -1; 341static int die_owner = -1;
345 342
346void oops_begin(void) 343unsigned long oops_begin(void)
347{ 344{
348 int cpu = safe_smp_processor_id(); 345 int cpu = safe_smp_processor_id();
349 /* racy, but better than risking deadlock. */ 346 unsigned long flags;
350 local_irq_disable(); 347
348 /* racy, but better than risking deadlock. */
349 local_irq_save(flags);
351 if (!spin_trylock(&die_lock)) { 350 if (!spin_trylock(&die_lock)) {
352 if (cpu == die_owner) 351 if (cpu == die_owner)
353 /* nested oops. should stop eventually */; 352 /* nested oops. should stop eventually */;
354 else 353 else
355 spin_lock(&die_lock); 354 spin_lock(&die_lock);
356 } 355 }
357 die_owner = cpu; 356 die_owner = cpu;
358 console_verbose(); 357 console_verbose();
359 bust_spinlocks(1); 358 bust_spinlocks(1);
359 return flags;
360} 360}
361 361
362void oops_end(void) 362void oops_end(unsigned long flags)
363{ 363{
364 die_owner = -1; 364 die_owner = -1;
365 bust_spinlocks(0); 365 bust_spinlocks(0);
366 spin_unlock(&die_lock); 366 spin_unlock_irqrestore(&die_lock, flags);
367 if (panic_on_oops) 367 if (panic_on_oops)
368 panic("Oops"); 368 panic("Oops");
369} 369}
370 370
371void __die(const char * str, struct pt_regs * regs, long err) 371void __die(const char * str, struct pt_regs * regs, long err)
372{ 372{
@@ -392,10 +392,11 @@ void __die(const char * str, struct pt_regs * regs, long err)
392 392
393void die(const char * str, struct pt_regs * regs, long err) 393void die(const char * str, struct pt_regs * regs, long err)
394{ 394{
395 oops_begin(); 395 unsigned long flags = oops_begin();
396
396 handle_BUG(regs); 397 handle_BUG(regs);
397 __die(str, regs, err); 398 __die(str, regs, err);
398 oops_end(); 399 oops_end(flags);
399 do_exit(SIGSEGV); 400 do_exit(SIGSEGV);
400} 401}
401static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err) 402static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err)
@@ -406,7 +407,8 @@ static inline void die_if_kernel(const char * str, struct pt_regs * regs, long e
406 407
407void die_nmi(char *str, struct pt_regs *regs) 408void die_nmi(char *str, struct pt_regs *regs)
408{ 409{
409 oops_begin(); 410 unsigned long flags = oops_begin();
411
410 /* 412 /*
411 * We are in trouble anyway, lets at least try 413 * We are in trouble anyway, lets at least try
412 * to get a message out. 414 * to get a message out.
@@ -416,7 +418,7 @@ void die_nmi(char *str, struct pt_regs *regs)
416 if (panic_on_timeout || panic_on_oops) 418 if (panic_on_timeout || panic_on_oops)
417 panic("nmi watchdog"); 419 panic("nmi watchdog");
418 printk("console shuts up ...\n"); 420 printk("console shuts up ...\n");
419 oops_end(); 421 oops_end(flags);
420 do_exit(SIGSEGV); 422 do_exit(SIGSEGV);
421} 423}
422 424
@@ -790,13 +792,16 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
790 */ 792 */
791 cwd = get_fpu_cwd(task); 793 cwd = get_fpu_cwd(task);
792 swd = get_fpu_swd(task); 794 swd = get_fpu_swd(task);
793 switch (((~cwd) & swd & 0x3f) | (swd & 0x240)) { 795 switch (swd & ~cwd & 0x3f) {
794 case 0x000: 796 case 0x000:
795 default: 797 default:
796 break; 798 break;
797 case 0x001: /* Invalid Op */ 799 case 0x001: /* Invalid Op */
798 case 0x041: /* Stack Fault */ 800 /*
799 case 0x241: /* Stack Fault | Direction */ 801 * swd & 0x240 == 0x040: Stack Underflow
802 * swd & 0x240 == 0x240: Stack Overflow
803 * User must clear the SF bit (0x40) if set
804 */
800 info.si_code = FPE_FLTINV; 805 info.si_code = FPE_FLTINV;
801 break; 806 break;
802 case 0x002: /* Denormalize */ 807 case 0x002: /* Denormalize */
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index d4abb07af52d..6dd642cad2ef 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -194,20 +194,7 @@ SECTIONS
194#endif 194#endif
195 } 195 }
196 196
197 /* DWARF 2 */ 197 STABS_DEBUG
198 .debug_info 0 : { *(.debug_info) } 198
199 .debug_abbrev 0 : { *(.debug_abbrev) } 199 DWARF_DEBUG
200 .debug_line 0 : { *(.debug_line) }
201 .debug_frame 0 : { *(.debug_frame) }
202 .debug_str 0 : { *(.debug_str) }
203 .debug_loc 0 : { *(.debug_loc) }
204 .debug_macinfo 0 : { *(.debug_macinfo) }
205 /* SGI/MIPS DWARF 2 extensions */
206 .debug_weaknames 0 : { *(.debug_weaknames) }
207 .debug_funcnames 0 : { *(.debug_funcnames) }
208 .debug_typenames 0 : { *(.debug_typenames) }
209 .debug_varnames 0 : { *(.debug_varnames) }
210
211
212 .comment 0 : { *(.comment) }
213} 200}
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
index 2e5734425949..70a0bd16085f 100644
--- a/arch/x86_64/kernel/vsyscall.c
+++ b/arch/x86_64/kernel/vsyscall.c
@@ -107,7 +107,7 @@ static force_inline long time_syscall(long *t)
107 return secs; 107 return secs;
108} 108}
109 109
110static int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz) 110int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz)
111{ 111{
112 if (unlikely(!__sysctl_vsyscall)) 112 if (unlikely(!__sysctl_vsyscall))
113 return gettimeofday(tv,tz); 113 return gettimeofday(tv,tz);
@@ -120,7 +120,7 @@ static int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz
120 120
121/* This will break when the xtime seconds get inaccurate, but that is 121/* This will break when the xtime seconds get inaccurate, but that is
122 * unlikely */ 122 * unlikely */
123static time_t __vsyscall(1) vtime(time_t *t) 123time_t __vsyscall(1) vtime(time_t *t)
124{ 124{
125 if (unlikely(!__sysctl_vsyscall)) 125 if (unlikely(!__sysctl_vsyscall))
126 return time_syscall(t); 126 return time_syscall(t);
@@ -129,12 +129,12 @@ static time_t __vsyscall(1) vtime(time_t *t)
129 return __xtime.tv_sec; 129 return __xtime.tv_sec;
130} 130}
131 131
132static long __vsyscall(2) venosys_0(void) 132long __vsyscall(2) venosys_0(void)
133{ 133{
134 return -ENOSYS; 134 return -ENOSYS;
135} 135}
136 136
137static long __vsyscall(3) venosys_1(void) 137long __vsyscall(3) venosys_1(void)
138{ 138{
139 return -ENOSYS; 139 return -ENOSYS;
140} 140}
diff --git a/arch/x86_64/lib/copy_user.S b/arch/x86_64/lib/copy_user.S
index bd556c804248..dfa358b05c89 100644
--- a/arch/x86_64/lib/copy_user.S
+++ b/arch/x86_64/lib/copy_user.S
@@ -7,7 +7,7 @@
7#define FIX_ALIGNMENT 1 7#define FIX_ALIGNMENT 1
8 8
9 #include <asm/current.h> 9 #include <asm/current.h>
10 #include <asm/offset.h> 10 #include <asm/asm-offsets.h>
11 #include <asm/thread_info.h> 11 #include <asm/thread_info.h>
12 #include <asm/cpufeature.h> 12 #include <asm/cpufeature.h>
13 13
diff --git a/arch/x86_64/lib/getuser.S b/arch/x86_64/lib/getuser.S
index f80bafee8669..3844d5e885a4 100644
--- a/arch/x86_64/lib/getuser.S
+++ b/arch/x86_64/lib/getuser.S
@@ -29,7 +29,7 @@
29#include <linux/linkage.h> 29#include <linux/linkage.h>
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/errno.h> 31#include <asm/errno.h>
32#include <asm/offset.h> 32#include <asm/asm-offsets.h>
33#include <asm/thread_info.h> 33#include <asm/thread_info.h>
34 34
35 .text 35 .text
diff --git a/arch/x86_64/lib/putuser.S b/arch/x86_64/lib/putuser.S
index 5828b8191667..7f5593974e2d 100644
--- a/arch/x86_64/lib/putuser.S
+++ b/arch/x86_64/lib/putuser.S
@@ -27,7 +27,7 @@
27#include <linux/linkage.h> 27#include <linux/linkage.h>
28#include <asm/page.h> 28#include <asm/page.h>
29#include <asm/errno.h> 29#include <asm/errno.h>
30#include <asm/offset.h> 30#include <asm/asm-offsets.h>
31#include <asm/thread_info.h> 31#include <asm/thread_info.h>
32 32
33 .text 33 .text
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index 816732d8858c..b75b872ec154 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -221,12 +221,13 @@ int unhandled_signal(struct task_struct *tsk, int sig)
221static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs, 221static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
222 unsigned long error_code) 222 unsigned long error_code)
223{ 223{
224 oops_begin(); 224 unsigned long flags = oops_begin();
225
225 printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", 226 printk(KERN_ALERT "%s: Corrupted page table at address %lx\n",
226 current->comm, address); 227 current->comm, address);
227 dump_pagetable(address); 228 dump_pagetable(address);
228 __die("Bad pagetable", regs, error_code); 229 __die("Bad pagetable", regs, error_code);
229 oops_end(); 230 oops_end(flags);
230 do_exit(SIGKILL); 231 do_exit(SIGKILL);
231} 232}
232 233
@@ -304,6 +305,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
304 unsigned long address; 305 unsigned long address;
305 const struct exception_table_entry *fixup; 306 const struct exception_table_entry *fixup;
306 int write; 307 int write;
308 unsigned long flags;
307 siginfo_t info; 309 siginfo_t info;
308 310
309#ifdef CONFIG_CHECKING 311#ifdef CONFIG_CHECKING
@@ -521,7 +523,7 @@ no_context:
521 * terminate things with extreme prejudice. 523 * terminate things with extreme prejudice.
522 */ 524 */
523 525
524 oops_begin(); 526 flags = oops_begin();
525 527
526 if (address < PAGE_SIZE) 528 if (address < PAGE_SIZE)
527 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); 529 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
@@ -534,7 +536,7 @@ no_context:
534 __die("Oops", regs, error_code); 536 __die("Oops", regs, error_code);
535 /* Executive summary in case the body of the oops scrolled away */ 537 /* Executive summary in case the body of the oops scrolled away */
536 printk(KERN_EMERG "CR2: %016lx\n", address); 538 printk(KERN_EMERG "CR2: %016lx\n", address);
537 oops_end(); 539 oops_end(flags);
538 do_exit(SIGKILL); 540 do_exit(SIGKILL);
539 541
540/* 542/*
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index aa4a5189ecee..e60a1a848de8 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -57,31 +57,31 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
57 57
58void show_mem(void) 58void show_mem(void)
59{ 59{
60 int i, total = 0, reserved = 0; 60 long i, total = 0, reserved = 0;
61 int shared = 0, cached = 0; 61 long shared = 0, cached = 0;
62 pg_data_t *pgdat; 62 pg_data_t *pgdat;
63 struct page *page; 63 struct page *page;
64 64
65 printk("Mem-info:\n"); 65 printk(KERN_INFO "Mem-info:\n");
66 show_free_areas(); 66 show_free_areas();
67 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 67 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
68 68
69 for_each_pgdat(pgdat) { 69 for_each_pgdat(pgdat) {
70 for (i = 0; i < pgdat->node_spanned_pages; ++i) { 70 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
71 page = pfn_to_page(pgdat->node_start_pfn + i); 71 page = pfn_to_page(pgdat->node_start_pfn + i);
72 total++; 72 total++;
73 if (PageReserved(page)) 73 if (PageReserved(page))
74 reserved++; 74 reserved++;
75 else if (PageSwapCache(page)) 75 else if (PageSwapCache(page))
76 cached++; 76 cached++;
77 else if (page_count(page)) 77 else if (page_count(page))
78 shared += page_count(page) - 1; 78 shared += page_count(page) - 1;
79 } 79 }
80 } 80 }
81 printk("%d pages of RAM\n", total); 81 printk(KERN_INFO "%lu pages of RAM\n", total);
82 printk("%d reserved pages\n",reserved); 82 printk(KERN_INFO "%lu reserved pages\n",reserved);
83 printk("%d pages shared\n",shared); 83 printk(KERN_INFO "%lu pages shared\n",shared);
84 printk("%d pages swap cached\n",cached); 84 printk(KERN_INFO "%lu pages swap cached\n",cached);
85} 85}
86 86
87/* References to section boundaries */ 87/* References to section boundaries */
@@ -381,41 +381,14 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size)
381 __flush_tlb_all(); 381 __flush_tlb_all();
382} 382}
383 383
384static inline int page_is_ram (unsigned long pagenr)
385{
386 int i;
387
388 for (i = 0; i < e820.nr_map; i++) {
389 unsigned long addr, end;
390
391 if (e820.map[i].type != E820_RAM) /* not usable memory */
392 continue;
393 /*
394 * !!!FIXME!!! Some BIOSen report areas as RAM that
395 * are not. Notably the 640->1Mb area. We need a sanity
396 * check here.
397 */
398 addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT;
399 end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT;
400 if ((pagenr >= addr) && (pagenr < end))
401 return 1;
402 }
403 return 0;
404}
405
406extern int swiotlb_force;
407
408static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules, 384static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
409 kcore_vsyscall; 385 kcore_vsyscall;
410 386
411void __init mem_init(void) 387void __init mem_init(void)
412{ 388{
413 int codesize, reservedpages, datasize, initsize; 389 long codesize, reservedpages, datasize, initsize;
414 int tmp;
415 390
416#ifdef CONFIG_SWIOTLB 391#ifdef CONFIG_SWIOTLB
417 if (swiotlb_force)
418 swiotlb = 1;
419 if (!iommu_aperture && 392 if (!iommu_aperture &&
420 (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu)) 393 (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu))
421 swiotlb = 1; 394 swiotlb = 1;
@@ -436,25 +409,11 @@ void __init mem_init(void)
436 409
437 /* this will put all low memory onto the freelists */ 410 /* this will put all low memory onto the freelists */
438#ifdef CONFIG_NUMA 411#ifdef CONFIG_NUMA
439 totalram_pages += numa_free_all_bootmem(); 412 totalram_pages = numa_free_all_bootmem();
440 tmp = 0;
441 /* should count reserved pages here for all nodes */
442#else 413#else
443 414 totalram_pages = free_all_bootmem();
444#ifdef CONFIG_FLATMEM
445 max_mapnr = end_pfn;
446 if (!mem_map) BUG();
447#endif
448
449 totalram_pages += free_all_bootmem();
450
451 for (tmp = 0; tmp < end_pfn; tmp++)
452 /*
453 * Only count reserved RAM pages
454 */
455 if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
456 reservedpages++;
457#endif 415#endif
416 reservedpages = end_pfn - totalram_pages - e820_hole_size(0, end_pfn);
458 417
459 after_bootmem = 1; 418 after_bootmem = 1;
460 419
@@ -471,7 +430,7 @@ void __init mem_init(void)
471 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, 430 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
472 VSYSCALL_END - VSYSCALL_START); 431 VSYSCALL_END - VSYSCALL_START);
473 432
474 printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n", 433 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n",
475 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 434 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
476 end_pfn << (PAGE_SHIFT-10), 435 end_pfn << (PAGE_SHIFT-10),
477 codesize >> 10, 436 codesize >> 10,
diff --git a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c
index ec35747aacd7..65417b040c1b 100644
--- a/arch/x86_64/mm/k8topology.c
+++ b/arch/x86_64/mm/k8topology.c
@@ -45,10 +45,12 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
45 unsigned long prevbase; 45 unsigned long prevbase;
46 struct node nodes[8]; 46 struct node nodes[8];
47 int nodeid, i, nb; 47 int nodeid, i, nb;
48 unsigned char nodeids[8];
48 int found = 0; 49 int found = 0;
49 u32 reg; 50 u32 reg;
50 unsigned numnodes; 51 unsigned numnodes;
51 nodemask_t nodes_parsed; 52 nodemask_t nodes_parsed;
53 unsigned dualcore = 0;
52 54
53 nodes_clear(nodes_parsed); 55 nodes_clear(nodes_parsed);
54 56
@@ -67,11 +69,15 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
67 prevbase = 0; 69 prevbase = 0;
68 for (i = 0; i < 8; i++) { 70 for (i = 0; i < 8; i++) {
69 unsigned long base,limit; 71 unsigned long base,limit;
70 72 u32 nodeid;
73
74 /* Undefined before E stepping, but hopefully 0 */
75 dualcore |= ((read_pci_config(0, nb, 3, 0xe8) >> 12) & 3) == 1;
71 base = read_pci_config(0, nb, 1, 0x40 + i*8); 76 base = read_pci_config(0, nb, 1, 0x40 + i*8);
72 limit = read_pci_config(0, nb, 1, 0x44 + i*8); 77 limit = read_pci_config(0, nb, 1, 0x44 + i*8);
73 78
74 nodeid = limit & 7; 79 nodeid = limit & 7;
80 nodeids[i] = nodeid;
75 if ((base & 3) == 0) { 81 if ((base & 3) == 0) {
76 if (i < numnodes) 82 if (i < numnodes)
77 printk("Skipping disabled node %d\n", i); 83 printk("Skipping disabled node %d\n", i);
@@ -157,8 +163,9 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
157 163
158 for (i = 0; i < 8; i++) { 164 for (i = 0; i < 8; i++) {
159 if (nodes[i].start != nodes[i].end) { 165 if (nodes[i].start != nodes[i].end) {
160 /* assume 1:1 NODE:CPU */ 166 nodeid = nodeids[i];
161 cpu_to_node[i] = i; 167 apicid_to_node[nodeid << dualcore] = i;
168 apicid_to_node[(nodeid << dualcore) + dualcore] = i;
162 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 169 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
163 } 170 }
164 } 171 }
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 04f7a33e144c..80a49d9bd8a7 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -28,8 +28,13 @@ bootmem_data_t plat_node_bdata[MAX_NUMNODES];
28int memnode_shift; 28int memnode_shift;
29u8 memnodemap[NODEMAPSIZE]; 29u8 memnodemap[NODEMAPSIZE];
30 30
31unsigned char cpu_to_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; 31unsigned char cpu_to_node[NR_CPUS] __read_mostly = {
32cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; 32 [0 ... NR_CPUS-1] = NUMA_NO_NODE
33};
34unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
35 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
36};
37cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly;
33 38
34int numa_off __initdata; 39int numa_off __initdata;
35 40
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 8e3d097a9ddd..4b2e844c15a7 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -20,14 +20,20 @@
20 20
21static struct acpi_table_slit *acpi_slit; 21static struct acpi_table_slit *acpi_slit;
22 22
23/* Internal processor count */
24static unsigned int __initdata num_processors = 0;
25
26static nodemask_t nodes_parsed __initdata; 23static nodemask_t nodes_parsed __initdata;
27static nodemask_t nodes_found __initdata; 24static nodemask_t nodes_found __initdata;
28static struct node nodes[MAX_NUMNODES] __initdata; 25static struct node nodes[MAX_NUMNODES] __initdata;
29static __u8 pxm2node[256] = { [0 ... 255] = 0xff }; 26static __u8 pxm2node[256] = { [0 ... 255] = 0xff };
30 27
28static int node_to_pxm(int n);
29
30int pxm_to_node(int pxm)
31{
32 if ((unsigned)pxm >= 256)
33 return 0;
34 return pxm2node[pxm];
35}
36
31static __init int setup_node(int pxm) 37static __init int setup_node(int pxm)
32{ 38{
33 unsigned node = pxm2node[pxm]; 39 unsigned node = pxm2node[pxm];
@@ -44,14 +50,14 @@ static __init int setup_node(int pxm)
44static __init int conflicting_nodes(unsigned long start, unsigned long end) 50static __init int conflicting_nodes(unsigned long start, unsigned long end)
45{ 51{
46 int i; 52 int i;
47 for_each_online_node(i) { 53 for_each_node_mask(i, nodes_parsed) {
48 struct node *nd = &nodes[i]; 54 struct node *nd = &nodes[i];
49 if (nd->start == nd->end) 55 if (nd->start == nd->end)
50 continue; 56 continue;
51 if (nd->end > start && nd->start < end) 57 if (nd->end > start && nd->start < end)
52 return 1; 58 return i;
53 if (nd->end == end && nd->start == start) 59 if (nd->end == end && nd->start == start)
54 return 1; 60 return i;
55 } 61 }
56 return -1; 62 return -1;
57} 63}
@@ -75,8 +81,11 @@ static __init void cutoff_node(int i, unsigned long start, unsigned long end)
75 81
76static __init void bad_srat(void) 82static __init void bad_srat(void)
77{ 83{
84 int i;
78 printk(KERN_ERR "SRAT: SRAT not used.\n"); 85 printk(KERN_ERR "SRAT: SRAT not used.\n");
79 acpi_numa = -1; 86 acpi_numa = -1;
87 for (i = 0; i < MAX_LOCAL_APIC; i++)
88 apicid_to_node[i] = NUMA_NO_NODE;
80} 89}
81 90
82static __init inline int srat_disabled(void) 91static __init inline int srat_disabled(void)
@@ -104,18 +113,10 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
104 bad_srat(); 113 bad_srat();
105 return; 114 return;
106 } 115 }
107 if (num_processors >= NR_CPUS) { 116 apicid_to_node[pa->apic_id] = node;
108 printk(KERN_ERR "SRAT: Processor #%d (lapic %u) INVALID. (Max ID: %d).\n",
109 num_processors, pa->apic_id, NR_CPUS);
110 bad_srat();
111 return;
112 }
113 cpu_to_node[num_processors] = node;
114 acpi_numa = 1; 117 acpi_numa = 1;
115 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> CPU %u -> Node %u\n", 118 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n",
116 pxm, pa->apic_id, num_processors, node); 119 pxm, pa->apic_id, node);
117
118 num_processors++;
119} 120}
120 121
121/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ 122/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
@@ -143,10 +144,15 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
143 printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n", 144 printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n",
144 start, end); 145 start, end);
145 i = conflicting_nodes(start, end); 146 i = conflicting_nodes(start, end);
146 if (i >= 0) { 147 if (i == node) {
148 printk(KERN_WARNING
149 "SRAT: Warning: PXM %d (%lx-%lx) overlaps with itself (%Lx-%Lx)\n",
150 pxm, start, end, nodes[i].start, nodes[i].end);
151 } else if (i >= 0) {
147 printk(KERN_ERR 152 printk(KERN_ERR
148 "SRAT: pxm %d overlap %lx-%lx with node %d(%Lx-%Lx)\n", 153 "SRAT: PXM %d (%lx-%lx) overlaps with PXM %d (%Lx-%Lx)\n",
149 pxm, start, end, i, nodes[i].start, nodes[i].end); 154 pxm, start, end, node_to_pxm(i),
155 nodes[i].start, nodes[i].end);
150 bad_srat(); 156 bad_srat();
151 return; 157 return;
152 } 158 }
@@ -174,6 +180,14 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
174 int i; 180 int i;
175 if (acpi_numa <= 0) 181 if (acpi_numa <= 0)
176 return -1; 182 return -1;
183
184 /* First clean up the node list */
185 for_each_node_mask(i, nodes_parsed) {
186 cutoff_node(i, start, end);
187 if (nodes[i].start == nodes[i].end)
188 node_clear(i, nodes_parsed);
189 }
190
177 memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed)); 191 memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed));
178 if (memnode_shift < 0) { 192 if (memnode_shift < 0) {
179 printk(KERN_ERR 193 printk(KERN_ERR
@@ -181,16 +195,10 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
181 bad_srat(); 195 bad_srat();
182 return -1; 196 return -1;
183 } 197 }
184 for (i = 0; i < MAX_NUMNODES; i++) { 198
185 if (!node_isset(i, nodes_parsed)) 199 /* Finally register nodes */
186 continue; 200 for_each_node_mask(i, nodes_parsed)
187 cutoff_node(i, start, end);
188 if (nodes[i].start == nodes[i].end) {
189 node_clear(i, nodes_parsed);
190 continue;
191 }
192 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 201 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
193 }
194 for (i = 0; i < NR_CPUS; i++) { 202 for (i = 0; i < NR_CPUS; i++) {
195 if (cpu_to_node[i] == NUMA_NO_NODE) 203 if (cpu_to_node[i] == NUMA_NO_NODE)
196 continue; 204 continue;
@@ -201,7 +209,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
201 return 0; 209 return 0;
202} 210}
203 211
204int node_to_pxm(int n) 212static int node_to_pxm(int n)
205{ 213{
206 int i; 214 int i;
207 if (pxm2node[n] == n) 215 if (pxm2node[n] == n)
diff --git a/arch/x86_64/pci/Makefile b/arch/x86_64/pci/Makefile
index 37c92e841dec..bb34e5ef916c 100644
--- a/arch/x86_64/pci/Makefile
+++ b/arch/x86_64/pci/Makefile
@@ -8,7 +8,7 @@ CFLAGS += -Iarch/i386/pci
8obj-y := i386.o 8obj-y := i386.o
9obj-$(CONFIG_PCI_DIRECT)+= direct.o 9obj-$(CONFIG_PCI_DIRECT)+= direct.o
10obj-y += fixup.o 10obj-y += fixup.o
11obj-$(CONFIG_ACPI_PCI) += acpi.o 11obj-$(CONFIG_ACPI) += acpi.o
12obj-y += legacy.o irq.o common.o 12obj-y += legacy.o irq.o common.o
13# mmconfig has a 64bit special 13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o 14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
diff --git a/arch/x86_64/pci/Makefile-BUS b/arch/x86_64/pci/Makefile-BUS
index 291985f0d2e4..4f0c05abd408 100644
--- a/arch/x86_64/pci/Makefile-BUS
+++ b/arch/x86_64/pci/Makefile-BUS
@@ -8,7 +8,7 @@ CFLAGS += -I arch/i386/pci
8obj-y := i386.o 8obj-y := i386.o
9obj-$(CONFIG_PCI_DIRECT)+= direct.o 9obj-$(CONFIG_PCI_DIRECT)+= direct.o
10obj-y += fixup.o 10obj-y += fixup.o
11obj-$(CONFIG_ACPI_PCI) += acpi.o 11obj-$(CONFIG_ACPI) += acpi.o
12obj-y += legacy.o irq.o common.o 12obj-y += legacy.o irq.o common.o
13# mmconfig has a 64bit special 13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o 14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c
index d80c323669e0..3acf60ded2a0 100644
--- a/arch/x86_64/pci/k8-bus.c
+++ b/arch/x86_64/pci/k8-bus.c
@@ -58,10 +58,16 @@ fill_mp_bus_to_cpumask(void)
58 for (j = SECONDARY_LDT_BUS_NUMBER(ldtbus); 58 for (j = SECONDARY_LDT_BUS_NUMBER(ldtbus);
59 j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus); 59 j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus);
60 j++) { 60 j++) {
61 int node = NODE_ID(nid); 61 struct pci_bus *bus;
62 long node = NODE_ID(nid);
63 /* Algorithm a bit dumb, but
64 it shouldn't matter here */
65 bus = pci_find_bus(0, j);
66 if (!bus)
67 continue;
62 if (!node_online(node)) 68 if (!node_online(node))
63 node = 0; 69 node = 0;
64 pci_bus_to_node[j] = node; 70 bus->sysdata = (void *)node;
65 } 71 }
66 } 72 }
67 } 73 }
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index 657e88aa0902..a0838c4a94e4 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -111,13 +111,6 @@ static int __init pci_mmcfg_init(void)
111 (pci_mmcfg_config[0].base_address == 0)) 111 (pci_mmcfg_config[0].base_address == 0))
112 return 0; 112 return 0;
113 113
114 /* Kludge for now. Don't use mmconfig on AMD systems because
115 those have some busses where mmconfig doesn't work,
116 and we don't parse ACPI MCFG well enough to handle that.
117 Remove when proper handling is added. */
118 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
119 return 0;
120
121 /* RED-PEN i386 doesn't do _nocache right now */ 114 /* RED-PEN i386 doesn't do _nocache right now */
122 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL); 115 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL);
123 if (pci_mmcfg_virt == NULL) { 116 if (pci_mmcfg_virt == NULL) {
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 27847e4ffcbf..98fac8489aed 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -66,13 +66,7 @@ boot := arch/xtensa/boot
66 66
67archinc := include/asm-xtensa 67archinc := include/asm-xtensa
68 68
69arch/xtensa/kernel/asm-offsets.s: \ 69archprepare: $(archinc)/.platform
70 arch/xtensa/kernel/asm-offsets.c $(archinc)/.platform
71
72include/asm-xtensa/offsets.h: arch/xtensa/kernel/asm-offsets.s
73 $(call filechk,gen-asm-offsets)
74
75prepare: $(archinc)/.platform $(archinc)/offsets.h
76 70
77# Update machine cpu and platform symlinks if something which affects 71# Update machine cpu and platform symlinks if something which affects
78# them changed. 72# them changed.
@@ -94,7 +88,7 @@ bzImage : zImage
94zImage zImage.initrd: vmlinux 88zImage zImage.initrd: vmlinux
95 $(Q)$(MAKE) $(build)=$(boot) $@ 89 $(Q)$(MAKE) $(build)=$(boot) $@
96 90
97CLEAN_FILES += arch/xtensa/vmlinux.lds $(archinc)/offset.h \ 91CLEAN_FILES += arch/xtensa/vmlinux.lds \
98 $(archinc)/platform $(archinc)/xtensa/config \ 92 $(archinc)/platform $(archinc)/xtensa/config \
99 $(archinc)/.platform 93 $(archinc)/.platform
100 94
diff --git a/arch/xtensa/kernel/align.S b/arch/xtensa/kernel/align.S
index 74b1e90ef08c..a4956578a24d 100644
--- a/arch/xtensa/kernel/align.S
+++ b/arch/xtensa/kernel/align.S
@@ -19,7 +19,7 @@
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/current.h> 21#include <asm/current.h>
22#include <asm/offsets.h> 22#include <asm/asm-offsets.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/processor.h> 24#include <asm/processor.h>
25#include <asm/page.h> 25#include <asm/page.h>
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index c64a01f71de6..5c018c503dfa 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <asm/offsets.h> 17#include <asm/asm-offsets.h>
18#include <asm/processor.h> 18#include <asm/processor.h>
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/uaccess.h> 20#include <asm/uaccess.h>
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 4099703b14be..c83bb0d41787 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -43,7 +43,7 @@
43#include <asm/mmu.h> 43#include <asm/mmu.h>
44#include <asm/irq.h> 44#include <asm/irq.h>
45#include <asm/atomic.h> 45#include <asm/atomic.h>
46#include <asm/offsets.h> 46#include <asm/asm-offsets.h>
47#include <asm/coprocessor.h> 47#include <asm/coprocessor.h>
48 48
49extern void ret_from_fork(void); 49extern void ret_from_fork(void);
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S
index 81808f0c6742..0e74397bfa2b 100644
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -46,7 +46,7 @@
46#include <asm/ptrace.h> 46#include <asm/ptrace.h>
47#include <asm/ptrace.h> 47#include <asm/ptrace.h>
48#include <asm/current.h> 48#include <asm/current.h>
49#include <asm/offsets.h> 49#include <asm/asm-offsets.h>
50#include <asm/pgtable.h> 50#include <asm/pgtable.h>
51#include <asm/processor.h> 51#include <asm/processor.h>
52#include <asm/page.h> 52#include <asm/page.h>