aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-05-09 06:12:06 -0400
committerPaul Mackerras <paulus@samba.org>2008-05-09 06:12:06 -0400
commit2a5f2e3e6cd1ce9fb3f8b186b6bc9aa1f1497a92 (patch)
treeb2306840f227972a7c9d4a2b75e516fe81358ce8 /arch
parent02539d71fa98d5737bb668b02286c76241e4bac9 (diff)
parent78be76476a34a77f0ea9db2f78ba46a2b0fd5ab5 (diff)
Merge branch 'for-2.6.26' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx into merge
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig3
-rw-r--r--arch/alpha/kernel/asm-offsets.c6
-rw-r--r--arch/alpha/kernel/osf_sys.c69
-rw-r--r--arch/alpha/kernel/pci.c4
-rw-r--r--arch/arm/configs/am200epdkit_defconfig22
-rw-r--r--arch/arm/kernel/asm-offsets.c8
-rw-r--r--arch/arm/kernel/atags.c2
-rw-r--r--arch/arm/kernel/ecard.c56
-rw-r--r--arch/arm/kernel/kprobes-decode.c2
-rw-r--r--arch/arm/kernel/kprobes.c2
-rw-r--r--arch/arm/kernel/sys_arm.c17
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c3
-rw-r--r--arch/arm/mach-at91/board-dk.c3
-rw-r--r--arch/arm/mach-at91/board-eb9200.c3
-rw-r--r--arch/arm/mach-at91/pm.c14
-rw-r--r--arch/arm/mach-davinci/clock.c6
-rw-r--r--arch/arm/mach-iop32x/em7210.c3
-rw-r--r--arch/arm/mach-iop32x/glantank.c4
-rw-r--r--arch/arm/mach-iop32x/n2100.c4
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_npe.c4
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_qmgr.c2
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c2
-rw-r--r--arch/arm/mach-omap1/board-h2.c2
-rw-r--r--arch/arm/mach-omap1/board-h3.c3
-rw-r--r--arch/arm/mach-omap1/board-osk.c1
-rw-r--r--arch/arm/mach-orion5x/addr-map.c4
-rw-r--r--arch/arm/mach-orion5x/common.c6
-rw-r--r--arch/arm/mach-orion5x/common.h3
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c15
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c24
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c20
-rw-r--r--arch/arm/mach-orion5x/pci.c20
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c15
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c16
-rw-r--r--arch/arm/mach-pxa/Makefile6
-rw-r--r--arch/arm/mach-pxa/generic.c5
-rw-r--r--arch/arm/mach-pxa/gumstix.c1
-rw-r--r--arch/arm/mach-pxa/littleton.c3
-rw-r--r--arch/arm/mach-pxa/lubbock.c4
-rw-r--r--arch/arm/mach-pxa/magician.c61
-rw-r--r--arch/arm/mach-pxa/mainstone.c3
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c5
-rw-r--r--arch/arm/mach-pxa/pm.c4
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-pxa/zylonite.c6
-rw-r--r--arch/arm/mm/Kconfig7
-rw-r--r--arch/arm/mm/Makefile1
-rw-r--r--arch/arm/mm/copypage-feroceon.S95
-rw-r--r--arch/arm/mm/iomap.c4
-rw-r--r--arch/arm/mm/mmu.c1
-rw-r--r--arch/arm/mm/proc-feroceon.S60
-rw-r--r--arch/arm/oprofile/op_model_mpcore.c44
-rw-r--r--arch/avr32/kernel/asm-offsets.c9
-rw-r--r--arch/avr32/kernel/sys_avr32.c13
-rw-r--r--arch/avr32/mm/tlb.c6
-rw-r--r--arch/blackfin/kernel/asm-offsets.c3
-rw-r--r--arch/blackfin/kernel/signal.c2
-rw-r--r--arch/blackfin/kernel/sys_bfin.c17
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c3
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c3
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c2
-rw-r--r--arch/cris/kernel/profile.c4
-rw-r--r--arch/frv/kernel/asm-offsets.c9
-rw-r--r--arch/frv/kernel/pm.c8
-rw-r--r--arch/frv/kernel/signal.c4
-rw-r--r--arch/frv/kernel/sys_frv.c17
-rw-r--r--arch/frv/kernel/traps.c7
-rw-r--r--arch/frv/mb93090-mb00/pci-iomap.c4
-rw-r--r--arch/frv/mm/Makefile2
-rw-r--r--arch/frv/mm/unaligned.c217
-rw-r--r--arch/h8300/kernel/asm-offsets.c6
-rw-r--r--arch/h8300/kernel/sys_h8300.c17
-rw-r--r--arch/ia64/Kconfig6
-rw-r--r--arch/ia64/hp/common/hwsw_iommu.c61
-rw-r--r--arch/ia64/hp/common/sba_iommu.c70
-rw-r--r--arch/ia64/hp/sim/simserial.c11
-rw-r--r--arch/ia64/ia32/ia32_signal.c2
-rw-r--r--arch/ia64/kernel/acpi.c2
-rw-r--r--arch/ia64/kernel/asm-offsets.c7
-rw-r--r--arch/ia64/kernel/irq.c4
-rw-r--r--arch/ia64/kernel/palinfo.c2
-rw-r--r--arch/ia64/kernel/perfmon.c205
-rw-r--r--arch/ia64/kernel/process.c2
-rw-r--r--arch/ia64/kernel/salinfo.c10
-rw-r--r--arch/ia64/kernel/signal.c15
-rw-r--r--arch/ia64/kernel/smp.c68
-rw-r--r--arch/ia64/kernel/smpboot.c12
-rw-r--r--arch/ia64/kernel/time.c5
-rw-r--r--arch/ia64/kernel/topology.c25
-rw-r--r--arch/ia64/kernel/uncached.c23
-rw-r--r--arch/ia64/kvm/kvm-ia64.c3
-rw-r--r--arch/ia64/mm/tlb.c5
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c5
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c29
-rw-r--r--arch/ia64/sn/pci/pci_dma.c81
-rw-r--r--arch/m32r/Makefile2
-rw-r--r--arch/m32r/defconfig863
-rw-r--r--arch/m32r/kernel/vmlinux.lds.S3
-rw-r--r--arch/m68k/kernel/asm-offsets.c4
-rw-r--r--arch/m68k/kernel/sys_m68k.c17
-rw-r--r--arch/m68k/mac/iop.c85
-rw-r--r--arch/m68k/mm/init.c1
-rw-r--r--arch/m68knommu/kernel/asm-offsets.c7
-rw-r--r--arch/m68knommu/kernel/entry.S9
-rw-r--r--arch/m68knommu/kernel/setup.c2
-rw-r--r--arch/m68knommu/kernel/signal.c21
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c17
-rw-r--r--arch/m68knommu/kernel/traps.c88
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S3
-rw-r--r--arch/m68knommu/platform/5206e/config.c2
-rw-r--r--arch/m68knommu/platform/5272/config.c4
-rw-r--r--arch/m68knommu/platform/528x/config.c266
-rw-r--r--arch/m68knommu/platform/5307/config.c3
-rw-r--r--arch/m68knommu/platform/coldfire/entry.S18
-rw-r--r--arch/mips/au1000/common/power.c35
-rw-r--r--arch/mips/basler/excite/excite_procfs.c30
-rw-r--r--arch/mips/kernel/asm-offsets.c478
-rw-r--r--arch/mips/kernel/binfmt_elfn32.c5
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c5
-rw-r--r--arch/mips/kernel/irixioctl.c55
-rw-r--r--arch/mips/kernel/kspd.c1
-rw-r--r--arch/mips/lib/iomap-pci.c4
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c3
-rw-r--r--arch/mn10300/kernel/asm-offsets.c9
-rw-r--r--arch/mn10300/kernel/sys_mn10300.c17
-rw-r--r--arch/mn10300/unit-asb2305/pci-iomap.c4
-rw-r--r--arch/parisc/kernel/asm-offsets.c6
-rw-r--r--arch/parisc/kernel/pci-dma.c7
-rw-r--r--arch/parisc/kernel/sys_parisc.c13
-rw-r--r--arch/parisc/lib/iomap.c4
-rw-r--r--arch/powerpc/boot/dts/sequoia.dts9
-rw-r--r--arch/powerpc/kernel/asm-offsets.c6
-rw-r--r--arch/powerpc/kernel/head_44x.S9
-rw-r--r--arch/powerpc/kernel/lparcfg.c6
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c3
-rw-r--r--arch/powerpc/kernel/proc_ppc64.c5
-rw-r--r--arch/powerpc/kernel/rtas-proc.c45
-rw-r--r--arch/powerpc/kernel/rtas_flash.c13
-rw-r--r--arch/powerpc/kernel/syscalls.c17
-rw-r--r--arch/powerpc/kernel/time.c4
-rw-r--r--arch/powerpc/kvm/booke_guest.c6
-rw-r--r--arch/powerpc/kvm/powerpc.c20
-rw-r--r--arch/powerpc/lib/Makefile1
-rw-r--r--arch/powerpc/lib/devres.c42
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c3
-rw-r--r--arch/powerpc/platforms/cell/spufs/sputrace.c3
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c8
-rw-r--r--arch/powerpc/platforms/iseries/mf.c6
-rw-r--r--arch/powerpc/platforms/iseries/proc.c8
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c7
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c10
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c7
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c7
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c19
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c27
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c180
-rw-r--r--arch/ppc/kernel/asm-offsets.c7
-rw-r--r--arch/ppc/kernel/pci.c4
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c3
-rw-r--r--arch/ppc/platforms/sbc82xx.c2
-rw-r--r--arch/s390/Kconfig8
-rw-r--r--arch/s390/defconfig141
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/asm-offsets.c54
-rw-r--r--arch/s390/kernel/early.c125
-rw-r--r--arch/s390/kernel/entry.S14
-rw-r--r--arch/s390/kernel/entry64.S12
-rw-r--r--arch/s390/kernel/head31.S61
-rw-r--r--arch/s390/kernel/head64.S64
-rw-r--r--arch/s390/kernel/irq.c2
-rw-r--r--arch/s390/kernel/process.c18
-rw-r--r--arch/s390/kernel/ptrace.c57
-rw-r--r--arch/s390/kernel/setup.c21
-rw-r--r--arch/s390/kernel/smp.c31
-rw-r--r--arch/s390/kernel/sys_s390.c17
-rw-r--r--arch/s390/kernel/topology.c35
-rw-r--r--arch/s390/kernel/traps.c26
-rw-r--r--arch/s390/kvm/priv.c11
-rw-r--r--arch/s390/lib/Makefile2
-rw-r--r--arch/s390/lib/uaccess_mvcos.c2
-rw-r--r--arch/s390/math-emu/Makefile1
-rw-r--r--arch/s390/mm/Makefile2
-rw-r--r--arch/s390/mm/extmem.c8
-rw-r--r--arch/s390/mm/fault.c3
-rw-r--r--arch/s390/mm/hugetlbpage.c134
-rw-r--r--arch/s390/mm/init.c25
-rw-r--r--arch/s390/mm/vmem.c135
-rw-r--r--arch/sh/boards/renesas/migor/setup.c3
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c3
-rw-r--r--arch/sh/drivers/pci/pci.c4
-rw-r--r--arch/sh/kernel/asm-offsets.c7
-rw-r--r--arch/sh/kernel/irq.c2
-rw-r--r--arch/sh/kernel/sys_sh64.c17
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/defconfig139
-rw-r--r--arch/sparc/kernel/Makefile1
-rw-r--r--arch/sparc/kernel/asm-offsets.c6
-rw-r--r--arch/sparc/kernel/entry.S125
-rw-r--r--arch/sparc/kernel/head.S9
-rw-r--r--arch/sparc/kernel/kgdb.c164
-rw-r--r--arch/sparc/kernel/setup.c5
-rw-r--r--arch/sparc/kernel/sparc-stub.c724
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c2
-rw-r--r--arch/sparc/kernel/sun4d_smp.c32
-rw-r--r--arch/sparc/kernel/sun4m_smp.c45
-rw-r--r--arch/sparc/lib/iomap.c4
-rw-r--r--arch/sparc/mm/fault.c61
-rw-r--r--arch/sparc/prom/init.c7
-rw-r--r--arch/sparc/prom/memory.c235
-rw-r--r--arch/sparc64/Kconfig1
-rw-r--r--arch/sparc64/kernel/Makefile1
-rw-r--r--arch/sparc64/kernel/cherrs.S579
-rw-r--r--arch/sparc64/kernel/entry.S2575
-rw-r--r--arch/sparc64/kernel/fpu_traps.S384
-rw-r--r--arch/sparc64/kernel/getsetcc.S24
-rw-r--r--arch/sparc64/kernel/head.S15
-rw-r--r--arch/sparc64/kernel/helpers.S63
-rw-r--r--arch/sparc64/kernel/hvcalls.S886
-rw-r--r--arch/sparc64/kernel/ivec.S51
-rw-r--r--arch/sparc64/kernel/kgdb.c186
-rw-r--r--arch/sparc64/kernel/misctrap.S97
-rw-r--r--arch/sparc64/kernel/pci.c130
-rw-r--r--arch/sparc64/kernel/pci_common.c6
-rw-r--r--arch/sparc64/kernel/pci_impl.h9
-rw-r--r--arch/sparc64/kernel/process.c6
-rw-r--r--arch/sparc64/kernel/signal.c6
-rw-r--r--arch/sparc64/kernel/signal32.c6
-rw-r--r--arch/sparc64/kernel/smp.c11
-rw-r--r--arch/sparc64/kernel/spiterrs.S245
-rw-r--r--arch/sparc64/kernel/syscalls.S279
-rw-r--r--arch/sparc64/kernel/ttable.S2
-rw-r--r--arch/sparc64/kernel/utrap.S29
-rw-r--r--arch/sparc64/lib/iomap.c4
-rw-r--r--arch/sparc64/mm/init.c1
-rw-r--r--arch/sparc64/mm/ultra.S27
-rw-r--r--arch/um/Makefile5
-rw-r--r--arch/um/kernel/exitcode.c2
-rw-r--r--arch/um/kernel/process.c2
-rw-r--r--arch/um/kernel/syscall.c17
-rw-r--r--arch/um/kernel/time.c3
-rw-r--r--arch/v850/kernel/asm-offsets.c7
-rw-r--r--arch/v850/kernel/rte_mb_a_pci.c4
-rw-r--r--arch/v850/kernel/syscalls.c17
-rw-r--r--arch/x86/Kconfig40
-rw-r--r--arch/x86/Kconfig.cpu10
-rw-r--r--arch/x86/Kconfig.debug8
-rw-r--r--arch/x86/boot/compressed/relocs.c2
-rw-r--r--arch/x86/boot/edd.c10
-rw-r--r--arch/x86/ia32/ia32_signal.c2
-rw-r--r--arch/x86/kernel/Makefile5
-rw-r--r--arch/x86/kernel/acpi/Makefile2
-rw-r--r--arch/x86/kernel/acpi/boot.c70
-rw-r--r--arch/x86/kernel/acpi/realmode/Makefile5
-rw-r--r--arch/x86/kernel/apm_32.c16
-rw-r--r--arch/x86/kernel/asm-offsets_32.c9
-rw-r--r--arch/x86/kernel/asm-offsets_64.c9
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c1
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/if.c2
-rw-r--r--arch/x86/kernel/e820_64.c2
-rw-r--r--arch/x86/kernel/genapic_64.c2
-rw-r--r--arch/x86/kernel/head_32.S19
-rw-r--r--arch/x86/kernel/hpet.c5
-rw-r--r--arch/x86/kernel/irq_32.c2
-rw-r--r--arch/x86/kernel/kvmclock.c4
-rw-r--r--arch/x86/kernel/mmconf-fam10h_64.c243
-rw-r--r--arch/x86/kernel/mpparse.c7
-rw-r--r--arch/x86/kernel/olpc.c260
-rw-r--r--arch/x86/kernel/pci-dma.c2
-rw-r--r--arch/x86/kernel/reboot.c2
-rw-r--r--arch/x86/kernel/setup.c2
-rw-r--r--arch/x86/kernel/setup_64.c20
-rw-r--r--arch/x86/kernel/signal_32.c17
-rw-r--r--arch/x86/kernel/signal_64.c16
-rw-r--r--arch/x86/kernel/smpboot.c14
-rw-r--r--arch/x86/kernel/sys_i386_32.c17
-rw-r--r--arch/x86/kernel/sys_x86_64.c17
-rw-r--r--arch/x86/kernel/time_32.c1
-rw-r--r--arch/x86/kernel/vsmp_64.c2
-rw-r--r--arch/x86/kvm/i8254.c8
-rw-r--r--arch/x86/kvm/lapic.c6
-rw-r--r--arch/x86/kvm/mmu.c89
-rw-r--r--arch/x86/kvm/mmu.h37
-rw-r--r--arch/x86/kvm/svm.c10
-rw-r--r--arch/x86/kvm/vmx.c375
-rw-r--r--arch/x86/kvm/vmx.h38
-rw-r--r--arch/x86/kvm/x86.c22
-rw-r--r--arch/x86/kvm/x86_emulate.c1
-rw-r--r--arch/x86/mach-voyager/voyager_cat.c2
-rw-r--r--arch/x86/mm/discontig_32.c26
-rw-r--r--arch/x86/mm/highmem_32.c1
-rw-r--r--arch/x86/mm/ioremap.c23
-rw-r--r--arch/x86/mm/k8topology_64.c38
-rw-r--r--arch/x86/mm/pageattr.c10
-rw-r--r--arch/x86/pci/Makefile_3210
-rw-r--r--arch/x86/pci/Makefile_642
-rw-r--r--arch/x86/pci/acpi.c27
-rw-r--r--arch/x86/pci/common.c22
-rw-r--r--arch/x86/pci/direct.c8
-rw-r--r--arch/x86/pci/fixup.c17
-rw-r--r--arch/x86/pci/i386.c12
-rw-r--r--arch/x86/pci/init.c15
-rw-r--r--arch/x86/pci/irq.c4
-rw-r--r--arch/x86/pci/k8-bus_64.c575
-rw-r--r--arch/x86/pci/legacy.c4
-rw-r--r--arch/x86/pci/mmconfig-shared.c247
-rw-r--r--arch/x86/pci/mmconfig_32.c4
-rw-r--r--arch/x86/pci/mmconfig_64.c22
-rw-r--r--arch/x86/pci/mp_bus_to_node.c23
-rw-r--r--arch/x86/pci/olpc.c313
-rw-r--r--arch/x86/pci/pci.h4
-rw-r--r--arch/x86/vdso/vdso32-setup.c4
-rw-r--r--arch/x86/video/fbdev.c2
-rw-r--r--arch/xtensa/kernel/asm-offsets.c3
319 files changed, 7933 insertions, 7478 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 694c9af520bb..3ea332b009e5 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -36,3 +36,6 @@ config HAVE_KPROBES
36 36
37config HAVE_KRETPROBES 37config HAVE_KRETPROBES
38 def_bool n 38 def_bool n
39
40config HAVE_DMA_ATTRS
41 def_bool n
diff --git a/arch/alpha/kernel/asm-offsets.c b/arch/alpha/kernel/asm-offsets.c
index 6c56c754a0b5..4b18cd94d59d 100644
--- a/arch/alpha/kernel/asm-offsets.c
+++ b/arch/alpha/kernel/asm-offsets.c
@@ -8,13 +8,9 @@
8#include <linux/stddef.h> 8#include <linux/stddef.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/ptrace.h> 10#include <linux/ptrace.h>
11#include <linux/kbuild.h>
11#include <asm/io.h> 12#include <asm/io.h>
12 13
13#define DEFINE(sym, val) \
14 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
15
16#define BLANK() asm volatile("\n->" : : )
17
18void foo(void) 14void foo(void)
19{ 15{
20 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 16 DEFINE(TI_TASK, offsetof(struct thread_info, task));
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 9fee37e2596f..32ca1b927307 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -981,27 +981,18 @@ asmlinkage int
981osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, 981osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
982 struct timeval32 __user *tvp) 982 struct timeval32 __user *tvp)
983{ 983{
984 fd_set_bits fds; 984 s64 timeout = MAX_SCHEDULE_TIMEOUT;
985 char *bits;
986 size_t size;
987 long timeout;
988 int ret = -EINVAL;
989 struct fdtable *fdt;
990 int max_fds;
991
992 timeout = MAX_SCHEDULE_TIMEOUT;
993 if (tvp) { 985 if (tvp) {
994 time_t sec, usec; 986 time_t sec, usec;
995 987
996 if (!access_ok(VERIFY_READ, tvp, sizeof(*tvp)) 988 if (!access_ok(VERIFY_READ, tvp, sizeof(*tvp))
997 || __get_user(sec, &tvp->tv_sec) 989 || __get_user(sec, &tvp->tv_sec)
998 || __get_user(usec, &tvp->tv_usec)) { 990 || __get_user(usec, &tvp->tv_usec)) {
999 ret = -EFAULT; 991 return -EFAULT;
1000 goto out_nofds;
1001 } 992 }
1002 993
1003 if (sec < 0 || usec < 0) 994 if (sec < 0 || usec < 0)
1004 goto out_nofds; 995 return -EINVAL;
1005 996
1006 if ((unsigned long) sec < MAX_SELECT_SECONDS) { 997 if ((unsigned long) sec < MAX_SELECT_SECONDS) {
1007 timeout = (usec + 1000000/HZ - 1) / (1000000/HZ); 998 timeout = (usec + 1000000/HZ - 1) / (1000000/HZ);
@@ -1009,60 +1000,8 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
1009 } 1000 }
1010 } 1001 }
1011 1002
1012 rcu_read_lock();
1013 fdt = files_fdtable(current->files);
1014 max_fds = fdt->max_fds;
1015 rcu_read_unlock();
1016 if (n < 0 || n > max_fds)
1017 goto out_nofds;
1018
1019 /*
1020 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
1021 * since we used fdset we need to allocate memory in units of
1022 * long-words.
1023 */
1024 ret = -ENOMEM;
1025 size = FDS_BYTES(n);
1026 bits = kmalloc(6 * size, GFP_KERNEL);
1027 if (!bits)
1028 goto out_nofds;
1029 fds.in = (unsigned long *) bits;
1030 fds.out = (unsigned long *) (bits + size);
1031 fds.ex = (unsigned long *) (bits + 2*size);
1032 fds.res_in = (unsigned long *) (bits + 3*size);
1033 fds.res_out = (unsigned long *) (bits + 4*size);
1034 fds.res_ex = (unsigned long *) (bits + 5*size);
1035
1036 if ((ret = get_fd_set(n, inp->fds_bits, fds.in)) ||
1037 (ret = get_fd_set(n, outp->fds_bits, fds.out)) ||
1038 (ret = get_fd_set(n, exp->fds_bits, fds.ex)))
1039 goto out;
1040 zero_fd_set(n, fds.res_in);
1041 zero_fd_set(n, fds.res_out);
1042 zero_fd_set(n, fds.res_ex);
1043
1044 ret = do_select(n, &fds, &timeout);
1045
1046 /* OSF does not copy back the remaining time. */ 1003 /* OSF does not copy back the remaining time. */
1047 1004 return core_sys_select(n, inp, outp, exp, &timeout);
1048 if (ret < 0)
1049 goto out;
1050 if (!ret) {
1051 ret = -ERESTARTNOHAND;
1052 if (signal_pending(current))
1053 goto out;
1054 ret = 0;
1055 }
1056
1057 if (set_fd_set(n, inp->fds_bits, fds.res_in) ||
1058 set_fd_set(n, outp->fds_bits, fds.res_out) ||
1059 set_fd_set(n, exp->fds_bits, fds.res_ex))
1060 ret = -EFAULT;
1061
1062 out:
1063 kfree(bits);
1064 out_nofds:
1065 return ret;
1066} 1005}
1067 1006
1068struct rusage32 { 1007struct rusage32 {
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index baf57563b14c..36ab22a7ea12 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -514,8 +514,8 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
514 514
515void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 515void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
516{ 516{
517 unsigned long start = pci_resource_start(dev, bar); 517 resource_size_t start = pci_resource_start(dev, bar);
518 unsigned long len = pci_resource_len(dev, bar); 518 resource_size_t len = pci_resource_len(dev, bar);
519 unsigned long flags = pci_resource_flags(dev, bar); 519 unsigned long flags = pci_resource_flags(dev, bar);
520 520
521 if (!len || !start) 521 if (!len || !start)
diff --git a/arch/arm/configs/am200epdkit_defconfig b/arch/arm/configs/am200epdkit_defconfig
index dc030cfe5009..5e68420f4680 100644
--- a/arch/arm/configs/am200epdkit_defconfig
+++ b/arch/arm/configs/am200epdkit_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.25-rc3 3# Linux kernel version: 2.6.25
4# Sun Mar 9 06:33:33 2008 4# Sun Apr 20 00:29:49 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -51,7 +51,8 @@ CONFIG_FAIR_GROUP_SCHED=y
51# CONFIG_RT_GROUP_SCHED is not set 51# CONFIG_RT_GROUP_SCHED is not set
52CONFIG_USER_SCHED=y 52CONFIG_USER_SCHED=y
53# CONFIG_CGROUP_SCHED is not set 53# CONFIG_CGROUP_SCHED is not set
54# CONFIG_SYSFS_DEPRECATED is not set 54CONFIG_SYSFS_DEPRECATED=y
55CONFIG_SYSFS_DEPRECATED_V2=y
55# CONFIG_RELAY is not set 56# CONFIG_RELAY is not set
56# CONFIG_NAMESPACES is not set 57# CONFIG_NAMESPACES is not set
57# CONFIG_BLK_DEV_INITRD is not set 58# CONFIG_BLK_DEV_INITRD is not set
@@ -85,6 +86,7 @@ CONFIG_SLAB=y
85CONFIG_HAVE_OPROFILE=y 86CONFIG_HAVE_OPROFILE=y
86# CONFIG_KPROBES is not set 87# CONFIG_KPROBES is not set
87CONFIG_HAVE_KPROBES=y 88CONFIG_HAVE_KPROBES=y
89CONFIG_HAVE_KRETPROBES=y
88CONFIG_PROC_PAGE_MONITOR=y 90CONFIG_PROC_PAGE_MONITOR=y
89CONFIG_SLABINFO=y 91CONFIG_SLABINFO=y
90CONFIG_RT_MUTEXES=y 92CONFIG_RT_MUTEXES=y
@@ -115,7 +117,6 @@ CONFIG_IOSCHED_NOOP=y
115CONFIG_DEFAULT_NOOP=y 117CONFIG_DEFAULT_NOOP=y
116CONFIG_DEFAULT_IOSCHED="noop" 118CONFIG_DEFAULT_IOSCHED="noop"
117CONFIG_CLASSIC_RCU=y 119CONFIG_CLASSIC_RCU=y
118# CONFIG_PREEMPT_RCU is not set
119 120
120# 121#
121# System Type 122# System Type
@@ -320,8 +321,6 @@ CONFIG_TCP_CONG_CUBIC=y
320CONFIG_DEFAULT_TCP_CONG="cubic" 321CONFIG_DEFAULT_TCP_CONG="cubic"
321# CONFIG_TCP_MD5SIG is not set 322# CONFIG_TCP_MD5SIG is not set
322# CONFIG_IPV6 is not set 323# CONFIG_IPV6 is not set
323# CONFIG_INET6_XFRM_TUNNEL is not set
324# CONFIG_INET6_TUNNEL is not set
325# CONFIG_NETWORK_SECMARK is not set 324# CONFIG_NETWORK_SECMARK is not set
326# CONFIG_NETFILTER is not set 325# CONFIG_NETFILTER is not set
327# CONFIG_IP_DCCP is not set 326# CONFIG_IP_DCCP is not set
@@ -383,7 +382,6 @@ CONFIG_IEEE80211=m
383CONFIG_IEEE80211_CRYPT_WEP=m 382CONFIG_IEEE80211_CRYPT_WEP=m
384# CONFIG_IEEE80211_CRYPT_CCMP is not set 383# CONFIG_IEEE80211_CRYPT_CCMP is not set
385# CONFIG_IEEE80211_CRYPT_TKIP is not set 384# CONFIG_IEEE80211_CRYPT_TKIP is not set
386# CONFIG_IEEE80211_SOFTMAC is not set
387# CONFIG_RFKILL is not set 385# CONFIG_RFKILL is not set
388# CONFIG_NET_9P is not set 386# CONFIG_NET_9P is not set
389 387
@@ -503,7 +501,7 @@ CONFIG_IDE_MAX_HWIFS=2
503CONFIG_BLK_DEV_IDE=m 501CONFIG_BLK_DEV_IDE=m
504 502
505# 503#
506# Please see Documentation/ide.txt for help/info on IDE drives 504# Please see Documentation/ide/ide.txt for help/info on IDE drives
507# 505#
508# CONFIG_BLK_DEV_IDE_SATA is not set 506# CONFIG_BLK_DEV_IDE_SATA is not set
509CONFIG_BLK_DEV_IDEDISK=m 507CONFIG_BLK_DEV_IDEDISK=m
@@ -518,10 +516,9 @@ CONFIG_IDE_PROC_FS=y
518# 516#
519# IDE chipset support/bugfixes 517# IDE chipset support/bugfixes
520# 518#
521CONFIG_IDE_GENERIC=m
522# CONFIG_BLK_DEV_PLATFORM is not set 519# CONFIG_BLK_DEV_PLATFORM is not set
523# CONFIG_BLK_DEV_IDEDMA is not set 520# CONFIG_BLK_DEV_IDEDMA is not set
524CONFIG_IDE_ARCH_OBSOLETE_INIT=y 521# CONFIG_BLK_DEV_HD_ONLY is not set
525# CONFIG_BLK_DEV_HD is not set 522# CONFIG_BLK_DEV_HD is not set
526 523
527# 524#
@@ -562,6 +559,7 @@ CONFIG_NETDEV_10000=y
562# 559#
563# CONFIG_WLAN_PRE80211 is not set 560# CONFIG_WLAN_PRE80211 is not set
564# CONFIG_WLAN_80211 is not set 561# CONFIG_WLAN_80211 is not set
562# CONFIG_IWLWIFI_LEDS is not set
565# CONFIG_NET_PCMCIA is not set 563# CONFIG_NET_PCMCIA is not set
566# CONFIG_WAN is not set 564# CONFIG_WAN is not set
567# CONFIG_PPP is not set 565# CONFIG_PPP is not set
@@ -707,6 +705,8 @@ CONFIG_SSB_POSSIBLE=y
707# 705#
708# CONFIG_MFD_SM501 is not set 706# CONFIG_MFD_SM501 is not set
709# CONFIG_MFD_ASIC3 is not set 707# CONFIG_MFD_ASIC3 is not set
708# CONFIG_HTC_EGPIO is not set
709# CONFIG_HTC_PASIC3 is not set
710 710
711# 711#
712# Multimedia devices 712# Multimedia devices
@@ -745,6 +745,7 @@ CONFIG_FB_TILEBLITTING=y
745CONFIG_FB_PXA=y 745CONFIG_FB_PXA=y
746CONFIG_FB_PXA_PARAMETERS=y 746CONFIG_FB_PXA_PARAMETERS=y
747CONFIG_FB_MBX=m 747CONFIG_FB_MBX=m
748# CONFIG_FB_METRONOME is not set
748CONFIG_FB_VIRTUAL=m 749CONFIG_FB_VIRTUAL=m
749# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 750# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
750 751
@@ -891,7 +892,6 @@ CONFIG_RTC_LIB=y
891# CONFIG_JFS_FS is not set 892# CONFIG_JFS_FS is not set
892# CONFIG_FS_POSIX_ACL is not set 893# CONFIG_FS_POSIX_ACL is not set
893# CONFIG_XFS_FS is not set 894# CONFIG_XFS_FS is not set
894# CONFIG_GFS2_FS is not set
895# CONFIG_OCFS2_FS is not set 895# CONFIG_OCFS2_FS is not set
896# CONFIG_DNOTIFY is not set 896# CONFIG_DNOTIFY is not set
897CONFIG_INOTIFY=y 897CONFIG_INOTIFY=y
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 0a0d2479274b..4a881258bb17 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -16,6 +16,7 @@
16#include <asm/thread_info.h> 16#include <asm/thread_info.h>
17#include <asm/memory.h> 17#include <asm/memory.h>
18#include <asm/procinfo.h> 18#include <asm/procinfo.h>
19#include <linux/kbuild.h>
19 20
20/* 21/*
21 * Make sure that the compiler and target are compatible. 22 * Make sure that the compiler and target are compatible.
@@ -35,13 +36,6 @@
35#error Known good compilers: 3.3 36#error Known good compilers: 3.3
36#endif 37#endif
37 38
38/* Use marker if you need to separate the values later */
39
40#define DEFINE(sym, val) \
41 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
42
43#define BLANK() asm volatile("\n->" : : )
44
45int main(void) 39int main(void)
46{ 40{
47 DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm)); 41 DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
diff --git a/arch/arm/kernel/atags.c b/arch/arm/kernel/atags.c
index e2e934c38080..64c420805e6f 100644
--- a/arch/arm/kernel/atags.c
+++ b/arch/arm/kernel/atags.c
@@ -35,7 +35,7 @@ create_proc_entries(void)
35{ 35{
36 struct proc_dir_entry* tags_entry; 36 struct proc_dir_entry* tags_entry;
37 37
38 tags_entry = create_proc_read_entry("atags", 0400, &proc_root, read_buffer, &tags_buffer); 38 tags_entry = create_proc_read_entry("atags", 0400, NULL, read_buffer, &tags_buffer);
39 if (!tags_entry) 39 if (!tags_entry)
40 return -ENOMEM; 40 return -ENOMEM;
41 41
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index f56d48c451ea..a53c0aba5c14 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -37,6 +37,7 @@
37#include <linux/mm.h> 37#include <linux/mm.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/proc_fs.h> 39#include <linux/proc_fs.h>
40#include <linux/seq_file.h>
40#include <linux/device.h> 41#include <linux/device.h>
41#include <linux/init.h> 42#include <linux/init.h>
42#include <linux/mutex.h> 43#include <linux/mutex.h>
@@ -723,17 +724,14 @@ unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
723 return address; 724 return address;
724} 725}
725 726
726static int ecard_prints(char *buffer, ecard_t *ec) 727static int ecard_prints(struct seq_file *m, ecard_t *ec)
727{ 728{
728 char *start = buffer; 729 seq_printf(m, " %d: %s ", ec->slot_no, ec->easi ? "EASI" : " ");
729
730 buffer += sprintf(buffer, " %d: %s ", ec->slot_no,
731 ec->easi ? "EASI" : " ");
732 730
733 if (ec->cid.id == 0) { 731 if (ec->cid.id == 0) {
734 struct in_chunk_dir incd; 732 struct in_chunk_dir incd;
735 733
736 buffer += sprintf(buffer, "[%04X:%04X] ", 734 seq_printf(m, "[%04X:%04X] ",
737 ec->cid.manufacturer, ec->cid.product); 735 ec->cid.manufacturer, ec->cid.product);
738 736
739 if (!ec->card_desc && ec->cid.cd && 737 if (!ec->card_desc && ec->cid.cd &&
@@ -744,43 +742,43 @@ static int ecard_prints(char *buffer, ecard_t *ec)
744 strcpy((char *)ec->card_desc, incd.d.string); 742 strcpy((char *)ec->card_desc, incd.d.string);
745 } 743 }
746 744
747 buffer += sprintf(buffer, "%s\n", ec->card_desc ? ec->card_desc : "*unknown*"); 745 seq_printf(m, "%s\n", ec->card_desc ? ec->card_desc : "*unknown*");
748 } else 746 } else
749 buffer += sprintf(buffer, "Simple card %d\n", ec->cid.id); 747 seq_printf(m, "Simple card %d\n", ec->cid.id);
750 748
751 return buffer - start; 749 return 0;
752} 750}
753 751
754static int get_ecard_dev_info(char *buf, char **start, off_t pos, int count) 752static int ecard_devices_proc_show(struct seq_file *m, void *v)
755{ 753{
756 ecard_t *ec = cards; 754 ecard_t *ec = cards;
757 off_t at = 0; 755
758 int len, cnt; 756 while (ec) {
759 757 ecard_prints(m, ec);
760 cnt = 0;
761 while (ec && count > cnt) {
762 len = ecard_prints(buf, ec);
763 at += len;
764 if (at >= pos) {
765 if (!*start) {
766 *start = buf + (pos - (at - len));
767 cnt = at - pos;
768 } else
769 cnt += len;
770 buf += len;
771 }
772 ec = ec->next; 758 ec = ec->next;
773 } 759 }
774 return (count > cnt) ? cnt : count; 760 return 0;
775} 761}
776 762
763static int ecard_devices_proc_open(struct inode *inode, struct file *file)
764{
765 return single_open(file, ecard_devices_proc_show, NULL);
766}
767
768static const struct file_operations bus_ecard_proc_fops = {
769 .owner = THIS_MODULE,
770 .open = ecard_devices_proc_open,
771 .read = seq_read,
772 .llseek = seq_lseek,
773 .release = single_release,
774};
775
777static struct proc_dir_entry *proc_bus_ecard_dir = NULL; 776static struct proc_dir_entry *proc_bus_ecard_dir = NULL;
778 777
779static void ecard_proc_init(void) 778static void ecard_proc_init(void)
780{ 779{
781 proc_bus_ecard_dir = proc_mkdir("ecard", proc_bus); 780 proc_bus_ecard_dir = proc_mkdir("bus/ecard", NULL);
782 create_proc_info_entry("devices", 0, proc_bus_ecard_dir, 781 proc_create("devices", 0, proc_bus_ecard_dir, &bus_ecard_proc_fops);
783 get_ecard_dev_info);
784} 782}
785 783
786#define ec_set_resource(ec,nr,st,sz) \ 784#define ec_set_resource(ec,nr,st,sz) \
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index d51bc8b60557..b4565bb133c1 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1176,7 +1176,7 @@ space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1176 * *S (bit 20) updates condition codes 1176 * *S (bit 20) updates condition codes
1177 * ADC/SBC/RSC reads the C flag 1177 * ADC/SBC/RSC reads the C flag
1178 */ 1178 */
1179 insn &= 0xfff00ff0; /* Rn = r0, Rd = r0 */ 1179 insn &= 0xfff00fff; /* Rn = r0, Rd = r0 */
1180 asi->insn[0] = insn; 1180 asi->insn[0] = insn;
1181 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ 1181 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */
1182 emulate_alu_imm_rwflags : emulate_alu_imm_rflags; 1182 emulate_alu_imm_rwflags : emulate_alu_imm_rflags;
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 13e371aad879..5593dd207216 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -66,7 +66,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
66 return -ENOMEM; 66 return -ENOMEM;
67 for (is = 0; is < MAX_INSN_SIZE; ++is) 67 for (is = 0; is < MAX_INSN_SIZE; ++is)
68 p->ainsn.insn[is] = tmp_insn[is]; 68 p->ainsn.insn[is] = tmp_insn[is];
69 flush_insns(&p->ainsn.insn, MAX_INSN_SIZE); 69 flush_insns(p->ainsn.insn, MAX_INSN_SIZE);
70 break; 70 break;
71 71
72 case INSN_GOOD_NO_SLOT: /* instruction doesn't need insn slot */ 72 case INSN_GOOD_NO_SLOT: /* instruction doesn't need insn slot */
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 9bd1870d980e..0128687ba0f7 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -34,23 +34,6 @@ extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
34 unsigned long new_len, unsigned long flags, 34 unsigned long new_len, unsigned long flags,
35 unsigned long new_addr); 35 unsigned long new_addr);
36 36
37/*
38 * sys_pipe() is the normal C calling standard for creating
39 * a pipe. It's not the way unix traditionally does this, though.
40 */
41asmlinkage int sys_pipe(unsigned long __user *fildes)
42{
43 int fd[2];
44 int error;
45
46 error = do_pipe(fd);
47 if (!error) {
48 if (copy_to_user(fildes, fd, 2*sizeof(int)))
49 error = -EFAULT;
50 }
51 return error;
52}
53
54/* common code for old and new mmaps */ 37/* common code for old and new mmaps */
55inline long do_mmap2( 38inline long do_mmap2(
56 unsigned long addr, unsigned long len, 39 unsigned long addr, unsigned long len,
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index f1a80d74a4b6..be526746e01e 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -246,7 +246,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
246 } 246 }
247 247
248 mmc0_data = *data; 248 mmc0_data = *data;
249 at91_clock_associate("mci0_clk", &at91cap9_mmc1_device.dev, "mci_clk"); 249 at91_clock_associate("mci0_clk", &at91cap9_mmc0_device.dev, "mci_clk");
250 platform_device_register(&at91cap9_mmc0_device); 250 platform_device_register(&at91cap9_mmc0_device);
251 } else { /* MCI1 */ 251 } else { /* MCI1 */
252 /* CLK */ 252 /* CLK */
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index b6454c525962..719667e25c98 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -308,7 +308,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
308 } 308 }
309 309
310 mmc0_data = *data; 310 mmc0_data = *data;
311 at91_clock_associate("mci0_clk", &at91sam9263_mmc1_device.dev, "mci_clk"); 311 at91_clock_associate("mci0_clk", &at91sam9263_mmc0_device.dev, "mci_clk");
312 platform_device_register(&at91sam9263_mmc0_device); 312 platform_device_register(&at91sam9263_mmc0_device);
313 } else { /* MCI1 */ 313 } else { /* MCI1 */
314 /* CLK */ 314 /* CLK */
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 26fea4dcc3a0..81f1ebb4e964 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -79,8 +79,7 @@ static struct at91_udc_data __initdata csb337_udc_data = {
79 79
80static struct i2c_board_info __initdata csb337_i2c_devices[] = { 80static struct i2c_board_info __initdata csb337_i2c_devices[] = {
81 { 81 {
82 I2C_BOARD_INFO("rtc-ds1307", 0x68), 82 I2C_BOARD_INFO("ds1307", 0x68),
83 .type = "ds1307",
84 }, 83 },
85}; 84};
86 85
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index 0a897efeba8e..c1a813c7169b 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -132,8 +132,7 @@ static struct i2c_board_info __initdata dk_i2c_devices[] = {
132 I2C_BOARD_INFO("x9429", 0x28), 132 I2C_BOARD_INFO("x9429", 0x28),
133 }, 133 },
134 { 134 {
135 I2C_BOARD_INFO("at24c", 0x50), 135 I2C_BOARD_INFO("24c1024", 0x50),
136 .type = "24c1024",
137 } 136 }
138}; 137};
139 138
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index b7b79bb9d6c4..af1a1d8ecc30 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -93,8 +93,7 @@ static struct at91_mmc_data __initdata eb9200_mmc_data = {
93 93
94static struct i2c_board_info __initdata eb9200_i2c_devices[] = { 94static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
95 { 95 {
96 I2C_BOARD_INFO("at24c", 0x50), 96 I2C_BOARD_INFO("24c512", 0x50),
97 .type = "24c512",
98 }, 97 },
99}; 98};
100 99
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 39733b6992aa..aa863c157708 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -61,6 +61,15 @@ static inline void sdram_selfrefresh_enable(void)
61#else 61#else
62#include <asm/arch/at91sam9_sdramc.h> 62#include <asm/arch/at91sam9_sdramc.h>
63 63
64#ifdef CONFIG_ARCH_AT91SAM9263
65/*
66 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
67 * handle those cases both here and in the Suspend-To-RAM support.
68 */
69#define AT91_SDRAMC AT91_SDRAMC0
70#warning Assuming EB1 SDRAM controller is *NOT* used
71#endif
72
64static u32 saved_lpr; 73static u32 saved_lpr;
65 74
66static inline void sdram_selfrefresh_enable(void) 75static inline void sdram_selfrefresh_enable(void)
@@ -75,11 +84,6 @@ static inline void sdram_selfrefresh_enable(void)
75 84
76#define sdram_selfrefresh_disable() at91_sys_write(AT91_SDRAMC_LPR, saved_lpr) 85#define sdram_selfrefresh_disable() at91_sys_write(AT91_SDRAMC_LPR, saved_lpr)
77 86
78/*
79 * FIXME: The AT91SAM9263 has a second EBI controller which may have
80 * additional SDRAM. pm_slowclock.S will require a similar fix.
81 */
82
83#endif 87#endif
84 88
85 89
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 4143828a9684..c6b94f60e0b2 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -311,11 +311,7 @@ static const struct file_operations proc_davinci_ck_operations = {
311 311
312static int __init davinci_ck_proc_init(void) 312static int __init davinci_ck_proc_init(void)
313{ 313{
314 struct proc_dir_entry *entry; 314 proc_create("davinci_clocks", 0, NULL, &proc_davinci_ck_operations);
315
316 entry = create_proc_entry("davinci_clocks", 0, NULL);
317 if (entry)
318 entry->proc_fops = &proc_davinci_ck_operations;
319 return 0; 315 return 0;
320 316
321} 317}
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
index c947152f9a3c..4877597c8758 100644
--- a/arch/arm/mach-iop32x/em7210.c
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -50,8 +50,7 @@ static struct sys_timer em7210_timer = {
50 */ 50 */
51static struct i2c_board_info __initdata em7210_i2c_devices[] = { 51static struct i2c_board_info __initdata em7210_i2c_devices[] = {
52 { 52 {
53 I2C_BOARD_INFO("rtc-rs5c372", 0x32), 53 I2C_BOARD_INFO("rs5c372a", 0x32),
54 .type = "rs5c372a",
55 }, 54 },
56}; 55};
57 56
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c
index d2a7b04f1cb0..d4fca75ce542 100644
--- a/arch/arm/mach-iop32x/glantank.c
+++ b/arch/arm/mach-iop32x/glantank.c
@@ -176,12 +176,10 @@ static struct f75375s_platform_data glantank_f75375s = {
176 176
177static struct i2c_board_info __initdata glantank_i2c_devices[] = { 177static struct i2c_board_info __initdata glantank_i2c_devices[] = {
178 { 178 {
179 I2C_BOARD_INFO("rtc-rs5c372", 0x32), 179 I2C_BOARD_INFO("rs5c372a", 0x32),
180 .type = "rs5c372a",
181 }, 180 },
182 { 181 {
183 I2C_BOARD_INFO("f75375", 0x2e), 182 I2C_BOARD_INFO("f75375", 0x2e),
184 .type = "f75375",
185 .platform_data = &glantank_f75375s, 183 .platform_data = &glantank_f75375s,
186 }, 184 },
187}; 185};
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index bc91d6e66bc4..2741063bf361 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -208,12 +208,10 @@ static struct f75375s_platform_data n2100_f75375s = {
208 208
209static struct i2c_board_info __initdata n2100_i2c_devices[] = { 209static struct i2c_board_info __initdata n2100_i2c_devices[] = {
210 { 210 {
211 I2C_BOARD_INFO("rtc-rs5c372", 0x32), 211 I2C_BOARD_INFO("rs5c372b", 0x32),
212 .type = "rs5c372b",
213 }, 212 },
214 { 213 {
215 I2C_BOARD_INFO("f75375", 0x2e), 214 I2C_BOARD_INFO("f75375", 0x2e),
216 .type = "f75375",
217 .platform_data = &n2100_f75375s, 215 .platform_data = &n2100_f75375s,
218 }, 216 },
219}; 217};
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 8cb07437a807..a51bfa6978b6 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -65,7 +65,7 @@ static struct platform_device dsmg600_i2c_gpio = {
65 65
66static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = { 66static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = {
67 { 67 {
68 I2C_BOARD_INFO("rtc-pcf8563", 0x51), 68 I2C_BOARD_INFO("pcf8563", 0x51),
69 }, 69 },
70}; 70};
71 71
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_npe.c b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
index 83c137ec582c..63a23fa4aab4 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
@@ -448,7 +448,9 @@ int npe_send_message(struct npe *npe, const void *msg, const char *what)
448 return -ETIMEDOUT; 448 return -ETIMEDOUT;
449 } 449 }
450 450
451#if DEBUG_MSG > 1
451 debug_msg(npe, "Sending a message took %i cycles\n", cycles); 452 debug_msg(npe, "Sending a message took %i cycles\n", cycles);
453#endif
452 return 0; 454 return 0;
453} 455}
454 456
@@ -484,7 +486,9 @@ int npe_recv_message(struct npe *npe, void *msg, const char *what)
484 return -ETIMEDOUT; 486 return -ETIMEDOUT;
485 } 487 }
486 488
489#if DEBUG_MSG > 1
487 debug_msg(npe, "Receiving a message took %i cycles\n", cycles); 490 debug_msg(npe, "Receiving a message took %i cycles\n", cycles);
491#endif
488 return 0; 492 return 0;
489} 493}
490 494
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
index e83301325301..fab94eaecee7 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
@@ -184,6 +184,8 @@ void qmgr_release_queue(unsigned int queue)
184 case 3: mask[0] = 0xFF; break; 184 case 3: mask[0] = 0xFF; break;
185 } 185 }
186 186
187 mask[1] = mask[2] = mask[3] = 0;
188
187 while (addr--) 189 while (addr--)
188 shift_mask(mask); 190 shift_mask(mask);
189 191
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 159e1c4f1eda..84b5e62a9c0a 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -54,7 +54,7 @@ static struct platform_device nas100d_flash = {
54 54
55static struct i2c_board_info __initdata nas100d_i2c_board_info [] = { 55static struct i2c_board_info __initdata nas100d_i2c_board_info [] = {
56 { 56 {
57 I2C_BOARD_INFO("rtc-pcf8563", 0x51), 57 I2C_BOARD_INFO("pcf8563", 0x51),
58 }, 58 },
59}; 59};
60 60
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index d9a182895a0f..a48a6655b887 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -57,7 +57,7 @@ static struct i2c_gpio_platform_data nslu2_i2c_gpio_data = {
57 57
58static struct i2c_board_info __initdata nslu2_i2c_board_info [] = { 58static struct i2c_board_info __initdata nslu2_i2c_board_info [] = {
59 { 59 {
60 I2C_BOARD_INFO("rtc-x1205", 0x6f), 60 I2C_BOARD_INFO("x1205", 0x6f),
61 }, 61 },
62}; 62};
63 63
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 507987720015..4b444fdaafea 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -351,11 +351,9 @@ static void __init h2_init_smc91x(void)
351static struct i2c_board_info __initdata h2_i2c_board_info[] = { 351static struct i2c_board_info __initdata h2_i2c_board_info[] = {
352 { 352 {
353 I2C_BOARD_INFO("tps65010", 0x48), 353 I2C_BOARD_INFO("tps65010", 0x48),
354 .type = "tps65010",
355 .irq = OMAP_GPIO_IRQ(58), 354 .irq = OMAP_GPIO_IRQ(58),
356 }, { 355 }, {
357 I2C_BOARD_INFO("isp1301_omap", 0x2d), 356 I2C_BOARD_INFO("isp1301_omap", 0x2d),
358 .type = "isp1301_omap",
359 .irq = OMAP_GPIO_IRQ(2), 357 .irq = OMAP_GPIO_IRQ(2),
360 }, 358 },
361}; 359};
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index c3ef1ee5f77b..7fbaa8d648cd 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -473,8 +473,7 @@ static struct omap_board_config_kernel h3_config[] __initdata = {
473 473
474static struct i2c_board_info __initdata h3_i2c_board_info[] = { 474static struct i2c_board_info __initdata h3_i2c_board_info[] = {
475 { 475 {
476 I2C_BOARD_INFO("tps65010", 0x48), 476 I2C_BOARD_INFO("tps65013", 0x48),
477 .type = "tps65013",
478 /* .irq = OMAP_GPIO_IRQ(??), */ 477 /* .irq = OMAP_GPIO_IRQ(??), */
479 }, 478 },
480}; 479};
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 4f9baba7d893..a66505f58b15 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -254,7 +254,6 @@ static struct tps65010_board tps_board = {
254static struct i2c_board_info __initdata osk_i2c_board_info[] = { 254static struct i2c_board_info __initdata osk_i2c_board_info[] = {
255 { 255 {
256 I2C_BOARD_INFO("tps65010", 0x48), 256 I2C_BOARD_INFO("tps65010", 0x48),
257 .type = "tps65010",
258 .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)), 257 .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)),
259 .platform_data = &tps_board, 258 .platform_data = &tps_board,
260 259
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index 6b179371e0a2..9608503d67f5 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -19,14 +19,14 @@
19 19
20/* 20/*
21 * The Orion has fully programable address map. There's a separate address 21 * The Orion has fully programable address map. There's a separate address
22 * map for each of the device _master_ interfaces, e.g. CPU, PCI, PCIE, USB, 22 * map for each of the device _master_ interfaces, e.g. CPU, PCI, PCIe, USB,
23 * Gigabit Ethernet, DMA/XOR engines, etc. Each interface has its own 23 * Gigabit Ethernet, DMA/XOR engines, etc. Each interface has its own
24 * address decode windows that allow it to access any of the Orion resources. 24 * address decode windows that allow it to access any of the Orion resources.
25 * 25 *
26 * CPU address decoding -- 26 * CPU address decoding --
27 * Linux assumes that it is the boot loader that already setup the access to 27 * Linux assumes that it is the boot loader that already setup the access to
28 * DDR and internal registers. 28 * DDR and internal registers.
29 * Setup access to PCI and PCI-E IO/MEM space is issued by this file. 29 * Setup access to PCI and PCIe IO/MEM space is issued by this file.
30 * Setup access to various devices located on the device bus interface (e.g. 30 * Setup access to various devices located on the device bus interface (e.g.
31 * flashes, RTC, etc) should be issued by machine-setup.c according to 31 * flashes, RTC, etc) should be issued by machine-setup.c according to
32 * specific board population (by using orion5x_setup_*_win()). 32 * specific board population (by using orion5x_setup_*_win()).
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 439c7784af02..968deb58be01 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -132,7 +132,7 @@ static struct platform_device orion5x_uart = {
132static struct resource orion5x_ehci0_resources[] = { 132static struct resource orion5x_ehci0_resources[] = {
133 { 133 {
134 .start = ORION5X_USB0_PHYS_BASE, 134 .start = ORION5X_USB0_PHYS_BASE,
135 .end = ORION5X_USB0_PHYS_BASE + SZ_4K, 135 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
136 .flags = IORESOURCE_MEM, 136 .flags = IORESOURCE_MEM,
137 }, 137 },
138 { 138 {
@@ -145,7 +145,7 @@ static struct resource orion5x_ehci0_resources[] = {
145static struct resource orion5x_ehci1_resources[] = { 145static struct resource orion5x_ehci1_resources[] = {
146 { 146 {
147 .start = ORION5X_USB1_PHYS_BASE, 147 .start = ORION5X_USB1_PHYS_BASE,
148 .end = ORION5X_USB1_PHYS_BASE + SZ_4K, 148 .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
149 .flags = IORESOURCE_MEM, 149 .flags = IORESOURCE_MEM,
150 }, 150 },
151 { 151 {
@@ -317,7 +317,7 @@ struct sys_timer orion5x_timer = {
317 ****************************************************************************/ 317 ****************************************************************************/
318 318
319/* 319/*
320 * Identify device ID and rev from PCIE configuration header space '0'. 320 * Identify device ID and rev from PCIe configuration header space '0'.
321 */ 321 */
322static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name) 322static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
323{ 323{
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index f4c4c9a72a7c..14adf8d1a54a 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -33,10 +33,9 @@ struct pci_sys_data;
33struct pci_bus; 33struct pci_bus;
34 34
35void orion5x_pcie_id(u32 *dev, u32 *rev); 35void orion5x_pcie_id(u32 *dev, u32 *rev);
36int orion5x_pcie_local_bus_nr(void);
37int orion5x_pci_local_bus_nr(void);
38int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); 36int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
39struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); 37struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
38int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
40 39
41/* 40/*
42 * Valid GPIO pins according to MPP setup, used by machine-setup. 41 * Valid GPIO pins according to MPP setup, used by machine-setup.
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index 872aed372327..44c64342dacb 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -241,14 +241,17 @@ void __init db88f5281_pci_preinit(void)
241 241
242static int __init db88f5281_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 242static int __init db88f5281_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
243{ 243{
244 int irq;
245
244 /* 246 /*
245 * PCIE IRQ is connected internally (not GPIO) 247 * Check for devices with hard-wired IRQs.
246 */ 248 */
247 if (dev->bus->number == orion5x_pcie_local_bus_nr()) 249 irq = orion5x_pci_map_irq(dev, slot, pin);
248 return IRQ_ORION5X_PCIE0_INT; 250 if (irq != -1)
251 return irq;
249 252
250 /* 253 /*
251 * PCI IRQs are connected via GPIOs 254 * PCI IRQs are connected via GPIOs.
252 */ 255 */
253 switch (slot - DB88F5281_PCI_SLOT0_OFFS) { 256 switch (slot - DB88F5281_PCI_SLOT0_OFFS) {
254 case 0: 257 case 0:
@@ -292,9 +295,7 @@ static struct mv643xx_eth_platform_data db88f5281_eth_data = {
292 * RTC DS1339 on I2C bus 295 * RTC DS1339 on I2C bus
293 ****************************************************************************/ 296 ****************************************************************************/
294static struct i2c_board_info __initdata db88f5281_i2c_rtc = { 297static struct i2c_board_info __initdata db88f5281_i2c_rtc = {
295 .driver_name = "rtc-ds1307", 298 I2C_BOARD_INFO("ds1339", 0x68),
296 .type = "ds1339",
297 .addr = 0x68,
298}; 299};
299 300
300/***************************************************************************** 301/*****************************************************************************
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index d67790ef236e..f9430f5ca9a8 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -43,11 +43,16 @@
43 43
44static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 44static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
45{ 45{
46 /* PCI-E */ 46 int irq;
47 if (dev->bus->number == orion5x_pcie_local_bus_nr())
48 return IRQ_ORION5X_PCIE0_INT;
49 47
50 pr_err("%s: requested mapping for unknown bus\n", __func__); 48 /*
49 * Check for devices with hard-wired IRQs.
50 */
51 irq = orion5x_pci_map_irq(dev, slot, pin);
52 if (irq != -1)
53 return irq;
54
55 pr_err("%s: requested mapping for unknown device\n", __func__);
51 56
52 return -1; 57 return -1;
53} 58}
@@ -220,19 +225,16 @@ static struct platform_device *dns323_plat_devices[] __initdata = {
220static struct i2c_board_info __initdata dns323_i2c_devices[] = { 225static struct i2c_board_info __initdata dns323_i2c_devices[] = {
221 { 226 {
222 I2C_BOARD_INFO("g760a", 0x3e), 227 I2C_BOARD_INFO("g760a", 0x3e),
223 .type = "g760a",
224 }, 228 },
225#if 0 229#if 0
226 /* this entry requires the new-style driver model lm75 driver, 230 /* this entry requires the new-style driver model lm75 driver,
227 * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */ 231 * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */
228 { 232 {
229 I2C_BOARD_INFO("lm75", 0x48), 233 I2C_BOARD_INFO("g751", 0x48),
230 .type = "g751",
231 }, 234 },
232#endif 235#endif
233 { 236 {
234 I2C_BOARD_INFO("rtc-m41t80", 0x68), 237 I2C_BOARD_INFO("m41t80", 0x68),
235 .type = "m41t80",
236 } 238 }
237}; 239};
238 240
@@ -253,9 +255,9 @@ static void __init dns323_init(void)
253 */ 255 */
254 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE); 256 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
255 257
256 /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIE 258 /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIe
257 * 259 *
258 * Open a special address decode windows for the PCIE WA. 260 * Open a special address decode windows for the PCIe WA.
259 */ 261 */
260 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 262 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
261 ORION5X_PCIE_WA_SIZE); 263 ORION5X_PCIE_WA_SIZE);
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 91413455beba..88410862feef 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -120,13 +120,19 @@ static struct platform_device kurobox_pro_nor_flash = {
120 120
121static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 121static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
122{ 122{
123 int irq;
124
125 /*
126 * Check for devices with hard-wired IRQs.
127 */
128 irq = orion5x_pci_map_irq(dev, slot, pin);
129 if (irq != -1)
130 return irq;
131
123 /* 132 /*
124 * PCI isn't used on the Kuro 133 * PCI isn't used on the Kuro
125 */ 134 */
126 if (dev->bus->number == orion5x_pcie_local_bus_nr()) 135 printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n");
127 return IRQ_ORION5X_PCIE0_INT;
128 else
129 printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n");
130 136
131 return -1; 137 return -1;
132} 138}
@@ -162,9 +168,7 @@ static struct mv643xx_eth_platform_data kurobox_pro_eth_data = {
162 * RTC 5C372a on I2C bus 168 * RTC 5C372a on I2C bus
163 ****************************************************************************/ 169 ****************************************************************************/
164static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = { 170static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = {
165 .driver_name = "rtc-rs5c372", 171 I2C_BOARD_INFO("rs5c372a", 0x32),
166 .type = "rs5c372a",
167 .addr = 0x32,
168}; 172};
169 173
170/***************************************************************************** 174/*****************************************************************************
@@ -193,7 +197,7 @@ static void __init kurobox_pro_init(void)
193 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, KUROBOX_PRO_NAND_SIZE); 197 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, KUROBOX_PRO_NAND_SIZE);
194 198
195 /* 199 /*
196 * Open a special address decode windows for the PCIE WA. 200 * Open a special address decode windows for the PCIe WA.
197 */ 201 */
198 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 202 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
199 ORION5X_PCIE_WA_SIZE); 203 ORION5X_PCIE_WA_SIZE);
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index fdf99fca85b3..9d5d39fa19c3 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -41,11 +41,6 @@ void __init orion5x_pcie_id(u32 *dev, u32 *rev)
41 *rev = orion_pcie_rev(PCIE_BASE); 41 *rev = orion_pcie_rev(PCIE_BASE);
42} 42}
43 43
44int __init orion5x_pcie_local_bus_nr(void)
45{
46 return orion_pcie_get_local_bus_nr(PCIE_BASE);
47}
48
49static int pcie_valid_config(int bus, int dev) 44static int pcie_valid_config(int bus, int dev)
50{ 45{
51 /* 46 /*
@@ -269,7 +264,7 @@ static int __init pcie_setup(struct pci_sys_data *sys)
269 */ 264 */
270static DEFINE_SPINLOCK(orion5x_pci_lock); 265static DEFINE_SPINLOCK(orion5x_pci_lock);
271 266
272int orion5x_pci_local_bus_nr(void) 267static int orion5x_pci_local_bus_nr(void)
273{ 268{
274 u32 conf = orion5x_read(PCI_P2P_CONF); 269 u32 conf = orion5x_read(PCI_P2P_CONF);
275 return((conf & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS); 270 return((conf & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS);
@@ -557,3 +552,16 @@ struct pci_bus __init *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys
557 552
558 return bus; 553 return bus;
559} 554}
555
556int __init orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
557{
558 int bus = dev->bus->number;
559
560 /*
561 * PCIe endpoint?
562 */
563 if (bus < orion5x_pci_local_bus_nr())
564 return IRQ_ORION5X_PCIE0_INT;
565
566 return -1;
567}
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 37e8b2dc3ed5..81abc1003aae 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -172,11 +172,14 @@ void __init rd88f5182_pci_preinit(void)
172 172
173static int __init rd88f5182_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 173static int __init rd88f5182_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
174{ 174{
175 int irq;
176
175 /* 177 /*
176 * PCI-E isn't used on the RD2 178 * Check for devices with hard-wired IRQs.
177 */ 179 */
178 if (dev->bus->number == orion5x_pcie_local_bus_nr()) 180 irq = orion5x_pci_map_irq(dev, slot, pin);
179 return IRQ_ORION5X_PCIE0_INT; 181 if (irq != -1)
182 return irq;
180 183
181 /* 184 /*
182 * PCI IRQs are connected via GPIOs 185 * PCI IRQs are connected via GPIOs
@@ -224,9 +227,7 @@ static struct mv643xx_eth_platform_data rd88f5182_eth_data = {
224 * RTC DS1338 on I2C bus 227 * RTC DS1338 on I2C bus
225 ****************************************************************************/ 228 ****************************************************************************/
226static struct i2c_board_info __initdata rd88f5182_i2c_rtc = { 229static struct i2c_board_info __initdata rd88f5182_i2c_rtc = {
227 .driver_name = "rtc-ds1307", 230 I2C_BOARD_INFO("ds1338", 0x68),
228 .type = "ds1338",
229 .addr = 0x68,
230}; 231};
231 232
232/***************************************************************************** 233/*****************************************************************************
@@ -259,7 +260,7 @@ static void __init rd88f5182_init(void)
259 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE); 260 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
260 261
261 /* 262 /*
262 * Open a special address decode windows for the PCIE WA. 263 * Open a special address decode windows for the PCIe WA.
263 */ 264 */
264 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 265 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
265 ORION5X_PCIE_WA_SIZE); 266 ORION5X_PCIE_WA_SIZE);
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index fd43863a86f6..9afb41ee6e07 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -141,14 +141,17 @@ void __init qnap_ts209_pci_preinit(void)
141 141
142static int __init qnap_ts209_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 142static int __init qnap_ts209_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
143{ 143{
144 int irq;
145
144 /* 146 /*
145 * PCIE IRQ is connected internally (not GPIO) 147 * Check for devices with hard-wired IRQs.
146 */ 148 */
147 if (dev->bus->number == orion5x_pcie_local_bus_nr()) 149 irq = orion5x_pci_map_irq(dev, slot, pin);
148 return IRQ_ORION5X_PCIE0_INT; 150 if (irq != -1)
151 return irq;
149 152
150 /* 153 /*
151 * PCI IRQs are connected via GPIOs 154 * PCI IRQs are connected via GPIOs.
152 */ 155 */
153 switch (slot - QNAP_TS209_PCI_SLOT0_OFFS) { 156 switch (slot - QNAP_TS209_PCI_SLOT0_OFFS) {
154 case 0: 157 case 0:
@@ -276,8 +279,7 @@ static void __init ts209_find_mac_addr(void)
276#define TS209_RTC_GPIO 3 279#define TS209_RTC_GPIO 3
277 280
278static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = { 281static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = {
279 .driver_name = "rtc-s35390a", 282 I2C_BOARD_INFO("s35390a", 0x30),
280 .addr = 0x30,
281 .irq = 0, 283 .irq = 0,
282}; 284};
283 285
@@ -373,7 +375,7 @@ static void __init qnap_ts209_init(void)
373 QNAP_TS209_NOR_BOOT_SIZE); 375 QNAP_TS209_NOR_BOOT_SIZE);
374 376
375 /* 377 /*
376 * Open a special address decode windows for the PCIE WA. 378 * Open a special address decode windows for the PCIe WA.
377 */ 379 */
378 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 380 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
379 ORION5X_PCIE_WA_SIZE); 381 ORION5X_PCIE_WA_SIZE);
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 7cdcb459ea9d..6a830853aa6a 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -5,9 +5,9 @@
5# Common support (must be linked before board specific support) 5# Common support (must be linked before board specific support)
6obj-y += clock.o devices.o generic.o irq.o dma.o \ 6obj-y += clock.o devices.o generic.o irq.o dma.o \
7 time.o gpio.o 7 time.o gpio.o
8obj-$(CONFIG_PXA25x) += pxa25x.o mfp-pxa2xx.o 8obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa25x.o
9obj-$(CONFIG_PXA27x) += pxa27x.o mfp-pxa2xx.o 9obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa27x.o
10obj-$(CONFIG_PXA3xx) += pxa3xx.o mfp-pxa3xx.o smemc.o 10obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o
11obj-$(CONFIG_CPU_PXA300) += pxa300.o 11obj-$(CONFIG_CPU_PXA300) += pxa300.o
12obj-$(CONFIG_CPU_PXA320) += pxa320.o 12obj-$(CONFIG_CPU_PXA320) += pxa320.o
13 13
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 331f29b2d0cd..44617938f3f1 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -90,11 +90,6 @@ static struct map_desc standard_io_desc[] __initdata = {
90 .pfn = __phys_to_pfn(0x40000000), 90 .pfn = __phys_to_pfn(0x40000000),
91 .length = 0x02000000, 91 .length = 0x02000000,
92 .type = MT_DEVICE 92 .type = MT_DEVICE
93 }, { /* LCD */
94 .virtual = 0xf4000000,
95 .pfn = __phys_to_pfn(0x44000000),
96 .length = 0x00100000,
97 .type = MT_DEVICE
98 }, { /* Mem Ctl */ 93 }, { /* Mem Ctl */
99 .virtual = 0xf6000000, 94 .virtual = 0xf6000000,
100 .pfn = __phys_to_pfn(0x48000000), 95 .pfn = __phys_to_pfn(0x48000000),
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index f01d18544133..bdf239754037 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -40,6 +40,7 @@
40 40
41#include <asm/arch/pxa-regs.h> 41#include <asm/arch/pxa-regs.h>
42#include <asm/arch/pxa2xx-regs.h> 42#include <asm/arch/pxa2xx-regs.h>
43#include <asm/arch/pxa2xx-gpio.h>
43 44
44#include "generic.h" 45#include "generic.h"
45 46
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index 03396063b561..530654474bb2 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -301,8 +301,7 @@ static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
301static struct pxafb_mach_info littleton_lcd_info = { 301static struct pxafb_mach_info littleton_lcd_info = {
302 .modes = tpo_tdo24mtea1_modes, 302 .modes = tpo_tdo24mtea1_modes,
303 .num_modes = 2, 303 .num_modes = 2,
304 .lccr0 = LCCR0_Act, 304 .lcd_conn = LCD_COLOR_TFT_16BPP,
305 .lccr3 = LCCR3_HSP | LCCR3_VSP,
306 .pxafb_lcd_power = littleton_lcd_power, 305 .pxafb_lcd_power = littleton_lcd_power,
307}; 306};
308 307
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index ca209c443f34..0993f4d1a0bc 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -395,8 +395,8 @@ static struct pxafb_mach_info sharp_lm8v31 = {
395 .num_modes = 1, 395 .num_modes = 1,
396 .cmap_inverse = 0, 396 .cmap_inverse = 0,
397 .cmap_static = 0, 397 .cmap_static = 0,
398 .lccr0 = LCCR0_SDS, 398 .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL |
399 .lccr3 = LCCR3_PCP | LCCR3_Acb(255), 399 LCD_AC_BIAS_FREQ(255);
400}; 400};
401 401
402#define MMC_POLL_RATE msecs_to_jiffies(1000) 402#define MMC_POLL_RATE msecs_to_jiffies(1000)
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index d70be75bd199..badba064dc04 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -114,6 +114,14 @@ static unsigned long magician_pin_config[] = {
114 GPIO82_CIF_DD_5, 114 GPIO82_CIF_DD_5,
115 GPIO84_CIF_FV, 115 GPIO84_CIF_FV,
116 GPIO85_CIF_LV, 116 GPIO85_CIF_LV,
117
118 /* Magician specific input GPIOs */
119 GPIO9_GPIO, /* unknown */
120 GPIO10_GPIO, /* GSM_IRQ */
121 GPIO13_GPIO, /* CPLD_IRQ */
122 GPIO107_GPIO, /* DS1WM_IRQ */
123 GPIO108_GPIO, /* GSM_READY */
124 GPIO115_GPIO, /* nPEN_IRQ */
117}; 125};
118 126
119/* 127/*
@@ -438,7 +446,7 @@ static struct pasic3_led pasic3_leds[] = {
438 446
439static struct platform_device pasic3; 447static struct platform_device pasic3;
440 448
441static struct pasic3_leds_machinfo __devinit pasic3_leds_info = { 449static struct pasic3_leds_machinfo pasic3_leds_info = {
442 .num_leds = ARRAY_SIZE(pasic3_leds), 450 .num_leds = ARRAY_SIZE(pasic3_leds),
443 .power_gpio = EGPIO_MAGICIAN_LED_POWER, 451 .power_gpio = EGPIO_MAGICIAN_LED_POWER,
444 .leds = pasic3_leds, 452 .leds = pasic3_leds,
@@ -543,9 +551,28 @@ static struct platform_device power_supply = {
543static int magician_mci_init(struct device *dev, 551static int magician_mci_init(struct device *dev,
544 irq_handler_t detect_irq, void *data) 552 irq_handler_t detect_irq, void *data)
545{ 553{
546 return request_irq(IRQ_MAGICIAN_SD, detect_irq, 554 int err;
555
556 err = request_irq(IRQ_MAGICIAN_SD, detect_irq,
547 IRQF_DISABLED | IRQF_SAMPLE_RANDOM, 557 IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
548 "MMC card detect", data); 558 "MMC card detect", data);
559 if (err)
560 goto err_request_irq;
561 err = gpio_request(EGPIO_MAGICIAN_SD_POWER, "SD_POWER");
562 if (err)
563 goto err_request_power;
564 err = gpio_request(EGPIO_MAGICIAN_nSD_READONLY, "nSD_READONLY");
565 if (err)
566 goto err_request_readonly;
567
568 return 0;
569
570err_request_readonly:
571 gpio_free(EGPIO_MAGICIAN_SD_POWER);
572err_request_power:
573 free_irq(IRQ_MAGICIAN_SD, data);
574err_request_irq:
575 return err;
549} 576}
550 577
551static void magician_mci_setpower(struct device *dev, unsigned int vdd) 578static void magician_mci_setpower(struct device *dev, unsigned int vdd)
@@ -562,6 +589,8 @@ static int magician_mci_get_ro(struct device *dev)
562 589
563static void magician_mci_exit(struct device *dev, void *data) 590static void magician_mci_exit(struct device *dev, void *data)
564{ 591{
592 gpio_free(EGPIO_MAGICIAN_nSD_READONLY);
593 gpio_free(EGPIO_MAGICIAN_SD_POWER);
565 free_irq(IRQ_MAGICIAN_SD, data); 594 free_irq(IRQ_MAGICIAN_SD, data);
566} 595}
567 596
@@ -643,28 +672,42 @@ static void __init magician_init(void)
643{ 672{
644 void __iomem *cpld; 673 void __iomem *cpld;
645 int lcd_select; 674 int lcd_select;
675 int err;
676
677 gpio_request(GPIO13_MAGICIAN_CPLD_IRQ, "CPLD_IRQ");
678 gpio_request(GPIO107_MAGICIAN_DS1WM_IRQ, "DS1WM_IRQ");
646 679
647 pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); 680 pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config));
648 681
649 platform_add_devices(devices, ARRAY_SIZE(devices)); 682 platform_add_devices(devices, ARRAY_SIZE(devices));
683
684 err = gpio_request(GPIO83_MAGICIAN_nIR_EN, "nIR_EN");
685 if (!err) {
686 gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1);
687 pxa_set_ficp_info(&magician_ficp_info);
688 }
650 pxa_set_i2c_info(NULL); 689 pxa_set_i2c_info(NULL);
651 pxa_set_mci_info(&magician_mci_info); 690 pxa_set_mci_info(&magician_mci_info);
652 pxa_set_ohci_info(&magician_ohci_info); 691 pxa_set_ohci_info(&magician_ohci_info);
653 pxa_set_ficp_info(&magician_ficp_info);
654 692
655 /* Check LCD type we have */ 693 /* Check LCD type we have */
656 cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); 694 cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);
657 if (cpld) { 695 if (cpld) {
658 u8 board_id = __raw_readb(cpld+0x14); 696 u8 board_id = __raw_readb(cpld+0x14);
697 iounmap(cpld);
659 system_rev = board_id & 0x7; 698 system_rev = board_id & 0x7;
660 lcd_select = board_id & 0x8; 699 lcd_select = board_id & 0x8;
661 iounmap(cpld);
662 pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); 700 pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
663 if (lcd_select && (system_rev < 3)) 701 if (lcd_select && (system_rev < 3)) {
664 pxa_gpio_mode(GPIO75_MAGICIAN_SAMSUNG_POWER_MD); 702 gpio_request(GPIO75_MAGICIAN_SAMSUNG_POWER, "SAMSUNG_POWER");
665 pxa_gpio_mode(GPIO104_MAGICIAN_LCD_POWER_1_MD); 703 gpio_direction_output(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
666 pxa_gpio_mode(GPIO105_MAGICIAN_LCD_POWER_2_MD); 704 }
667 pxa_gpio_mode(GPIO106_MAGICIAN_LCD_POWER_3_MD); 705 gpio_request(GPIO104_MAGICIAN_LCD_POWER_1, "LCD_POWER_1");
706 gpio_request(GPIO105_MAGICIAN_LCD_POWER_2, "LCD_POWER_2");
707 gpio_request(GPIO106_MAGICIAN_LCD_POWER_3, "LCD_POWER_3");
708 gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0);
709 gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0);
710 gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0);
668 set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); 711 set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info);
669 } else 712 } else
670 pr_err("LCD detection: CPLD mapping failed\n"); 713 pr_err("LCD detection: CPLD mapping failed\n");
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 18d47cfa2a18..7399fb34da4e 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -434,8 +434,7 @@ static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
434 434
435static struct pxafb_mach_info mainstone_pxafb_info = { 435static struct pxafb_mach_info mainstone_pxafb_info = {
436 .num_modes = 1, 436 .num_modes = 1,
437 .lccr0 = LCCR0_Act, 437 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
438 .lccr3 = LCCR3_PCP,
439}; 438};
440 439
441static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_int, void *data) 440static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_int, void *data)
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index e6be9d0aeccf..49d951db0f3d 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -320,16 +320,13 @@ static struct soc_camera_link iclink[] = {
320static struct i2c_board_info __initdata pcm990_i2c_devices[] = { 320static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
321 { 321 {
322 /* Must initialize before the camera(s) */ 322 /* Must initialize before the camera(s) */
323 I2C_BOARD_INFO("pca953x", 0x41), 323 I2C_BOARD_INFO("pca9536", 0x41),
324 .type = "pca9536",
325 .platform_data = &pca9536_data, 324 .platform_data = &pca9536_data,
326 }, { 325 }, {
327 I2C_BOARD_INFO("mt9v022", 0x48), 326 I2C_BOARD_INFO("mt9v022", 0x48),
328 .type = "mt9v022",
329 .platform_data = &iclink[0], /* With extender */ 327 .platform_data = &iclink[0], /* With extender */
330 }, { 328 }, {
331 I2C_BOARD_INFO("mt9m001", 0x5d), 329 I2C_BOARD_INFO("mt9m001", 0x5d),
332 .type = "mt9m001",
333 .platform_data = &iclink[0], /* With extender */ 330 .platform_data = &iclink[0], /* With extender */
334 }, 331 },
335}; 332};
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index 039194cbe477..ec1bbf333a3a 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -46,8 +46,8 @@ int pxa_pm_enter(suspend_state_t state)
46 sleep_save_checksum += sleep_save[i]; 46 sleep_save_checksum += sleep_save[i];
47 } 47 }
48 48
49 /* Clear sleep reset status */ 49 /* Clear reset status */
50 RCSR = RCSR_SMR; 50 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
51 51
52 /* *** go zzz *** */ 52 /* *** go zzz *** */
53 pxa_cpu_pm_fns->enter(state); 53 pxa_cpu_pm_fns->enter(state);
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index dde355e88fa1..b6a6f5fcc77a 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -486,6 +486,8 @@ static int pxa3xx_set_wake(unsigned int irq, unsigned int on)
486 case IRQ_MMC3: 486 case IRQ_MMC3:
487 mask = ADXER_MFP_GEN12; 487 mask = ADXER_MFP_GEN12;
488 break; 488 break;
489 default:
490 return -EINVAL;
489 } 491 }
490 492
491 local_irq_save(flags); 493 local_irq_save(flags);
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index dbb546216be1..4a0028087ea6 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -97,8 +97,7 @@ static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
97 97
98static struct pxafb_mach_info zylonite_toshiba_lcd_info = { 98static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
99 .num_modes = 1, 99 .num_modes = 1,
100 .lccr0 = LCCR0_Act, 100 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
101 .lccr3 = LCCR3_PCP,
102 .pxafb_backlight_power = zylonite_backlight_power, 101 .pxafb_backlight_power = zylonite_backlight_power,
103}; 102};
104 103
@@ -134,8 +133,7 @@ static struct pxafb_mode_info sharp_ls037_modes[] = {
134static struct pxafb_mach_info zylonite_sharp_lcd_info = { 133static struct pxafb_mach_info zylonite_sharp_lcd_info = {
135 .modes = sharp_ls037_modes, 134 .modes = sharp_ls037_modes,
136 .num_modes = 2, 135 .num_modes = 2,
137 .lccr0 = LCCR0_Act, 136 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
138 .lccr3 = LCCR3_PCP | LCCR3_HSP | LCCR3_VSP,
139 .pxafb_backlight_power = zylonite_backlight_power, 137 .pxafb_backlight_power = zylonite_backlight_power,
140}; 138};
141 139
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 1b8229d9c9d5..33ed048502a3 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -372,7 +372,7 @@ config CPU_FEROCEON
372 select CPU_PABRT_NOIFAR 372 select CPU_PABRT_NOIFAR
373 select CPU_CACHE_VIVT 373 select CPU_CACHE_VIVT
374 select CPU_CP15_MMU 374 select CPU_CP15_MMU
375 select CPU_COPY_V4WB if MMU 375 select CPU_COPY_FEROCEON if MMU
376 select CPU_TLB_V4WBI if MMU 376 select CPU_TLB_V4WBI if MMU
377 377
378config CPU_FEROCEON_OLD_ID 378config CPU_FEROCEON_OLD_ID
@@ -523,6 +523,9 @@ config CPU_COPY_V4WT
523config CPU_COPY_V4WB 523config CPU_COPY_V4WB
524 bool 524 bool
525 525
526config CPU_COPY_FEROCEON
527 bool
528
526config CPU_COPY_V6 529config CPU_COPY_V6
527 bool 530 bool
528 531
@@ -658,7 +661,7 @@ config CPU_DCACHE_SIZE
658 661
659config CPU_DCACHE_WRITETHROUGH 662config CPU_DCACHE_WRITETHROUGH
660 bool "Force write through D-cache" 663 bool "Force write through D-cache"
661 depends on (CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || CPU_FEROCEON) && !CPU_DCACHE_DISABLE 664 depends on (CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020) && !CPU_DCACHE_DISABLE
662 default y if CPU_ARM925T 665 default y if CPU_ARM925T
663 help 666 help
664 Say Y here to use the data cache in writethrough mode. Unless you 667 Say Y here to use the data cache in writethrough mode. Unless you
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 44536a0b995a..32b2d2d213a6 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o
36obj-$(CONFIG_CPU_COPY_V3) += copypage-v3.o 36obj-$(CONFIG_CPU_COPY_V3) += copypage-v3.o
37obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o 37obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o
38obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o 38obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o
39obj-$(CONFIG_CPU_COPY_FEROCEON) += copypage-feroceon.o
39obj-$(CONFIG_CPU_COPY_V6) += copypage-v6.o context.o 40obj-$(CONFIG_CPU_COPY_V6) += copypage-v6.o context.o
40obj-$(CONFIG_CPU_SA1100) += copypage-v4mc.o 41obj-$(CONFIG_CPU_SA1100) += copypage-v4mc.o
41obj-$(CONFIG_CPU_XSCALE) += copypage-xscale.o 42obj-$(CONFIG_CPU_XSCALE) += copypage-xscale.o
diff --git a/arch/arm/mm/copypage-feroceon.S b/arch/arm/mm/copypage-feroceon.S
new file mode 100644
index 000000000000..7eb0d320d240
--- /dev/null
+++ b/arch/arm/mm/copypage-feroceon.S
@@ -0,0 +1,95 @@
1/*
2 * linux/arch/arm/lib/copypage-feroceon.S
3 *
4 * Copyright (C) 2008 Marvell Semiconductors
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This handles copy_user_page and clear_user_page on Feroceon
11 * more optimally than the generic implementations.
12 */
13#include <linux/linkage.h>
14#include <linux/init.h>
15#include <asm/asm-offsets.h>
16
17 .text
18 .align 5
19
20ENTRY(feroceon_copy_user_page)
21 stmfd sp!, {r4-r9, lr}
22 mov ip, #PAGE_SZ
231: mov lr, r1
24 ldmia r1!, {r2 - r9}
25 pld [lr, #32]
26 pld [lr, #64]
27 pld [lr, #96]
28 pld [lr, #128]
29 pld [lr, #160]
30 pld [lr, #192]
31 pld [lr, #224]
32 stmia r0, {r2 - r9}
33 ldmia r1!, {r2 - r9}
34 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
35 add r0, r0, #32
36 stmia r0, {r2 - r9}
37 ldmia r1!, {r2 - r9}
38 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
39 add r0, r0, #32
40 stmia r0, {r2 - r9}
41 ldmia r1!, {r2 - r9}
42 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
43 add r0, r0, #32
44 stmia r0, {r2 - r9}
45 ldmia r1!, {r2 - r9}
46 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
47 add r0, r0, #32
48 stmia r0, {r2 - r9}
49 ldmia r1!, {r2 - r9}
50 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
51 add r0, r0, #32
52 stmia r0, {r2 - r9}
53 ldmia r1!, {r2 - r9}
54 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
55 add r0, r0, #32
56 stmia r0, {r2 - r9}
57 ldmia r1!, {r2 - r9}
58 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
59 add r0, r0, #32
60 stmia r0, {r2 - r9}
61 subs ip, ip, #(32 * 8)
62 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
63 add r0, r0, #32
64 bne 1b
65 mcr p15, 0, ip, c7, c10, 4 @ drain WB
66 ldmfd sp!, {r4-r9, pc}
67
68 .align 5
69
70ENTRY(feroceon_clear_user_page)
71 stmfd sp!, {r4-r7, lr}
72 mov r1, #PAGE_SZ/32
73 mov r2, #0
74 mov r3, #0
75 mov r4, #0
76 mov r5, #0
77 mov r6, #0
78 mov r7, #0
79 mov ip, #0
80 mov lr, #0
811: stmia r0, {r2-r7, ip, lr}
82 subs r1, r1, #1
83 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line
84 add r0, r0, #32
85 bne 1b
86 mcr p15, 0, r1, c7, c10, 4 @ drain WB
87 ldmfd sp!, {r4-r7, pc}
88
89 __INITDATA
90
91 .type feroceon_user_fns, #object
92ENTRY(feroceon_user_fns)
93 .long feroceon_clear_user_page
94 .long feroceon_copy_user_page
95 .size feroceon_user_fns, . - feroceon_user_fns
diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
index 62066f3020c8..7429f8c01015 100644
--- a/arch/arm/mm/iomap.c
+++ b/arch/arm/mm/iomap.c
@@ -26,8 +26,8 @@ EXPORT_SYMBOL(ioport_unmap);
26#ifdef CONFIG_PCI 26#ifdef CONFIG_PCI
27void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 27void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
28{ 28{
29 unsigned long start = pci_resource_start(dev, bar); 29 resource_size_t start = pci_resource_start(dev, bar);
30 unsigned long len = pci_resource_len(dev, bar); 30 resource_size_t len = pci_resource_len(dev, bar);
31 unsigned long flags = pci_resource_flags(dev, bar); 31 unsigned long flags = pci_resource_flags(dev, bar);
32 32
33 if (!len || !start) 33 if (!len || !start)
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index d41a75ed3dce..2d6d682c206a 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -35,6 +35,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
35 * zero-initialized data and COW. 35 * zero-initialized data and COW.
36 */ 36 */
37struct page *empty_zero_page; 37struct page *empty_zero_page;
38EXPORT_SYMBOL(empty_zero_page);
38 39
39/* 40/*
40 * The pmd table for the upper-most set of pages. 41 * The pmd table for the upper-most set of pages.
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index 90e7594e29b1..a02c1712b52d 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -93,7 +93,7 @@ ENTRY(cpu_feroceon_reset)
93 * 93 *
94 * Called with IRQs disabled 94 * Called with IRQs disabled
95 */ 95 */
96 .align 10 96 .align 5
97ENTRY(cpu_feroceon_do_idle) 97ENTRY(cpu_feroceon_do_idle)
98 mov r0, #0 98 mov r0, #0
99 mcr p15, 0, r0, c7, c10, 4 @ Drain write buffer 99 mcr p15, 0, r0, c7, c10, 4 @ Drain write buffer
@@ -106,6 +106,7 @@ ENTRY(cpu_feroceon_do_idle)
106 * Clean and invalidate all cache entries in a particular 106 * Clean and invalidate all cache entries in a particular
107 * address space. 107 * address space.
108 */ 108 */
109 .align 5
109ENTRY(feroceon_flush_user_cache_all) 110ENTRY(feroceon_flush_user_cache_all)
110 /* FALLTHROUGH */ 111 /* FALLTHROUGH */
111 112
@@ -118,12 +119,8 @@ ENTRY(feroceon_flush_kern_cache_all)
118 mov r2, #VM_EXEC 119 mov r2, #VM_EXEC
119 mov ip, #0 120 mov ip, #0
120__flush_whole_cache: 121__flush_whole_cache:
121#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
122 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
123#else
1241: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate 1221: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate
125 bne 1b 123 bne 1b
126#endif
127 tst r2, #VM_EXEC 124 tst r2, #VM_EXEC
128 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 125 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
129 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 126 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
@@ -139,27 +136,19 @@ __flush_whole_cache:
139 * - end - end address (exclusive) 136 * - end - end address (exclusive)
140 * - flags - vm_flags describing address space 137 * - flags - vm_flags describing address space
141 */ 138 */
139 .align 5
142ENTRY(feroceon_flush_user_cache_range) 140ENTRY(feroceon_flush_user_cache_range)
143 mov ip, #0 141 mov ip, #0
144 sub r3, r1, r0 @ calculate total size 142 sub r3, r1, r0 @ calculate total size
145 cmp r3, #CACHE_DLIMIT 143 cmp r3, #CACHE_DLIMIT
146 bgt __flush_whole_cache 144 bgt __flush_whole_cache
1471: tst r2, #VM_EXEC 1451: tst r2, #VM_EXEC
148#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
149 mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
150 mcrne p15, 0, r0, c7, c5, 1 @ invalidate I entry
151 add r0, r0, #CACHE_DLINESIZE
152 mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
153 mcrne p15, 0, r0, c7, c5, 1 @ invalidate I entry
154 add r0, r0, #CACHE_DLINESIZE
155#else
156 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry 146 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry
157 mcrne p15, 0, r0, c7, c5, 1 @ invalidate I entry 147 mcrne p15, 0, r0, c7, c5, 1 @ invalidate I entry
158 add r0, r0, #CACHE_DLINESIZE 148 add r0, r0, #CACHE_DLINESIZE
159 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry 149 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry
160 mcrne p15, 0, r0, c7, c5, 1 @ invalidate I entry 150 mcrne p15, 0, r0, c7, c5, 1 @ invalidate I entry
161 add r0, r0, #CACHE_DLINESIZE 151 add r0, r0, #CACHE_DLINESIZE
162#endif
163 cmp r0, r1 152 cmp r0, r1
164 blo 1b 153 blo 1b
165 tst r2, #VM_EXEC 154 tst r2, #VM_EXEC
@@ -176,6 +165,7 @@ ENTRY(feroceon_flush_user_cache_range)
176 * - start - virtual start address 165 * - start - virtual start address
177 * - end - virtual end address 166 * - end - virtual end address
178 */ 167 */
168 .align 5
179ENTRY(feroceon_coherent_kern_range) 169ENTRY(feroceon_coherent_kern_range)
180 /* FALLTHROUGH */ 170 /* FALLTHROUGH */
181 171
@@ -207,6 +197,7 @@ ENTRY(feroceon_coherent_user_range)
207 * 197 *
208 * - addr - page aligned address 198 * - addr - page aligned address
209 */ 199 */
200 .align 5
210ENTRY(feroceon_flush_kern_dcache_page) 201ENTRY(feroceon_flush_kern_dcache_page)
211 add r1, r0, #PAGE_SZ 202 add r1, r0, #PAGE_SZ
2121: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2031: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
@@ -231,13 +222,12 @@ ENTRY(feroceon_flush_kern_dcache_page)
231 * 222 *
232 * (same as v4wb) 223 * (same as v4wb)
233 */ 224 */
225 .align 5
234ENTRY(feroceon_dma_inv_range) 226ENTRY(feroceon_dma_inv_range)
235#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
236 tst r0, #CACHE_DLINESIZE - 1 227 tst r0, #CACHE_DLINESIZE - 1
237 mcrne p15, 0, r0, c7, c10, 1 @ clean D entry 228 mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
238 tst r1, #CACHE_DLINESIZE - 1 229 tst r1, #CACHE_DLINESIZE - 1
239 mcrne p15, 0, r1, c7, c10, 1 @ clean D entry 230 mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
240#endif
241 bic r0, r0, #CACHE_DLINESIZE - 1 231 bic r0, r0, #CACHE_DLINESIZE - 1
2421: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry 2321: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
243 add r0, r0, #CACHE_DLINESIZE 233 add r0, r0, #CACHE_DLINESIZE
@@ -256,14 +246,13 @@ ENTRY(feroceon_dma_inv_range)
256 * 246 *
257 * (same as v4wb) 247 * (same as v4wb)
258 */ 248 */
249 .align 5
259ENTRY(feroceon_dma_clean_range) 250ENTRY(feroceon_dma_clean_range)
260#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
261 bic r0, r0, #CACHE_DLINESIZE - 1 251 bic r0, r0, #CACHE_DLINESIZE - 1
2621: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 2521: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
263 add r0, r0, #CACHE_DLINESIZE 253 add r0, r0, #CACHE_DLINESIZE
264 cmp r0, r1 254 cmp r0, r1
265 blo 1b 255 blo 1b
266#endif
267 mcr p15, 0, r0, c7, c10, 4 @ drain WB 256 mcr p15, 0, r0, c7, c10, 4 @ drain WB
268 mov pc, lr 257 mov pc, lr
269 258
@@ -275,14 +264,10 @@ ENTRY(feroceon_dma_clean_range)
275 * - start - virtual start address 264 * - start - virtual start address
276 * - end - virtual end address 265 * - end - virtual end address
277 */ 266 */
267 .align 5
278ENTRY(feroceon_dma_flush_range) 268ENTRY(feroceon_dma_flush_range)
279 bic r0, r0, #CACHE_DLINESIZE - 1 269 bic r0, r0, #CACHE_DLINESIZE - 1
2801: 2701: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
281#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
282 mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
283#else
284 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
285#endif
286 add r0, r0, #CACHE_DLINESIZE 271 add r0, r0, #CACHE_DLINESIZE
287 cmp r0, r1 272 cmp r0, r1
288 blo 1b 273 blo 1b
@@ -300,13 +285,12 @@ ENTRY(feroceon_cache_fns)
300 .long feroceon_dma_clean_range 285 .long feroceon_dma_clean_range
301 .long feroceon_dma_flush_range 286 .long feroceon_dma_flush_range
302 287
288 .align 5
303ENTRY(cpu_feroceon_dcache_clean_area) 289ENTRY(cpu_feroceon_dcache_clean_area)
304#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
3051: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 2901: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
306 add r0, r0, #CACHE_DLINESIZE 291 add r0, r0, #CACHE_DLINESIZE
307 subs r1, r1, #CACHE_DLINESIZE 292 subs r1, r1, #CACHE_DLINESIZE
308 bhi 1b 293 bhi 1b
309#endif
310 mcr p15, 0, r0, c7, c10, 4 @ drain WB 294 mcr p15, 0, r0, c7, c10, 4 @ drain WB
311 mov pc, lr 295 mov pc, lr
312 296
@@ -323,13 +307,9 @@ ENTRY(cpu_feroceon_dcache_clean_area)
323ENTRY(cpu_feroceon_switch_mm) 307ENTRY(cpu_feroceon_switch_mm)
324#ifdef CONFIG_MMU 308#ifdef CONFIG_MMU
325 mov ip, #0 309 mov ip, #0
326#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
327 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
328#else
329@ && 'Clean & Invalidate whole DCache' 310@ && 'Clean & Invalidate whole DCache'
3301: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate 3111: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate
331 bne 1b 312 bne 1b
332#endif
333 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 313 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
334 mcr p15, 0, ip, c7, c10, 4 @ drain WB 314 mcr p15, 0, ip, c7, c10, 4 @ drain WB
335 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 315 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
@@ -362,16 +342,9 @@ ENTRY(cpu_feroceon_set_pte_ext)
362 tst r1, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young? 342 tst r1, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young?
363 movne r2, #0 343 movne r2, #0
364 344
365#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
366 eor r3, r2, #0x0a @ C & small page?
367 tst r3, #0x0b
368 biceq r2, r2, #4
369#endif
370 str r2, [r0] @ hardware version 345 str r2, [r0] @ hardware version
371 mov r0, r0 346 mov r0, r0
372#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
373 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 347 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
374#endif
375 mcr p15, 0, r0, c7, c10, 4 @ drain WB 348 mcr p15, 0, r0, c7, c10, 4 @ drain WB
376#endif 349#endif
377 mov pc, lr 350 mov pc, lr
@@ -387,20 +360,11 @@ __feroceon_setup:
387 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 360 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
388#endif 361#endif
389 362
390
391#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
392 mov r0, #4 @ disable write-back on caches explicitly
393 mcr p15, 7, r0, c15, c0, 0
394#endif
395
396 adr r5, feroceon_crval 363 adr r5, feroceon_crval
397 ldmia r5, {r5, r6} 364 ldmia r5, {r5, r6}
398 mrc p15, 0, r0, c1, c0 @ get control register v4 365 mrc p15, 0, r0, c1, c0 @ get control register v4
399 bic r0, r0, r5 366 bic r0, r0, r5
400 orr r0, r0, r6 367 orr r0, r0, r6
401#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN
402 orr r0, r0, #0x4000 @ .1.. .... .... ....
403#endif
404 mov pc, lr 368 mov pc, lr
405 .size __feroceon_setup, . - __feroceon_setup 369 .size __feroceon_setup, . - __feroceon_setup
406 370
@@ -476,7 +440,7 @@ __feroceon_old_id_proc_info:
476 .long cpu_feroceon_name 440 .long cpu_feroceon_name
477 .long feroceon_processor_functions 441 .long feroceon_processor_functions
478 .long v4wbi_tlb_fns 442 .long v4wbi_tlb_fns
479 .long v4wb_user_fns 443 .long feroceon_user_fns
480 .long feroceon_cache_fns 444 .long feroceon_cache_fns
481 .size __feroceon_old_id_proc_info, . - __feroceon_old_id_proc_info 445 .size __feroceon_old_id_proc_info, . - __feroceon_old_id_proc_info
482#endif 446#endif
@@ -502,6 +466,6 @@ __feroceon_proc_info:
502 .long cpu_feroceon_name 466 .long cpu_feroceon_name
503 .long feroceon_processor_functions 467 .long feroceon_processor_functions
504 .long v4wbi_tlb_fns 468 .long v4wbi_tlb_fns
505 .long v4wb_user_fns 469 .long feroceon_user_fns
506 .long feroceon_cache_fns 470 .long feroceon_cache_fns
507 .size __feroceon_proc_info, . - __feroceon_proc_info 471 .size __feroceon_proc_info, . - __feroceon_proc_info
diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c
index 75bae067922d..74fae6045650 100644
--- a/arch/arm/oprofile/op_model_mpcore.c
+++ b/arch/arm/oprofile/op_model_mpcore.c
@@ -51,7 +51,7 @@
51/* 51/*
52 * MPCore SCU event monitor support 52 * MPCore SCU event monitor support
53 */ 53 */
54#define SCU_EVENTMONITORS_VA_BASE __io_address(REALVIEW_MPCORE_SCU_BASE + 0x10) 54#define SCU_EVENTMONITORS_VA_BASE __io_address(REALVIEW_EB11MP_SCU_BASE + 0x10)
55 55
56/* 56/*
57 * Bitmask of used SCU counters 57 * Bitmask of used SCU counters
@@ -80,7 +80,7 @@ static irqreturn_t scu_em_interrupt(int irq, void *arg)
80 struct eventmonitor __iomem *emc = SCU_EVENTMONITORS_VA_BASE; 80 struct eventmonitor __iomem *emc = SCU_EVENTMONITORS_VA_BASE;
81 unsigned int cnt; 81 unsigned int cnt;
82 82
83 cnt = irq - IRQ_PMU_SCU0; 83 cnt = irq - IRQ_EB11MP_PMU_SCU0;
84 oprofile_add_sample(get_irq_regs(), SCU_COUNTER(cnt)); 84 oprofile_add_sample(get_irq_regs(), SCU_COUNTER(cnt));
85 scu_reset_counter(emc, cnt); 85 scu_reset_counter(emc, cnt);
86 86
@@ -119,10 +119,10 @@ static int scu_start(void)
119 */ 119 */
120 for (i = 0; i < NUM_SCU_COUNTERS; i++) { 120 for (i = 0; i < NUM_SCU_COUNTERS; i++) {
121 if (scu_em_used & (1 << i)) { 121 if (scu_em_used & (1 << i)) {
122 ret = request_irq(IRQ_PMU_SCU0 + i, scu_em_interrupt, IRQF_DISABLED, "SCU PMU", NULL); 122 ret = request_irq(IRQ_EB11MP_PMU_SCU0 + i, scu_em_interrupt, IRQF_DISABLED, "SCU PMU", NULL);
123 if (ret) { 123 if (ret) {
124 printk(KERN_ERR "oprofile: unable to request IRQ%u for SCU Event Monitor\n", 124 printk(KERN_ERR "oprofile: unable to request IRQ%u for SCU Event Monitor\n",
125 IRQ_PMU_SCU0 + i); 125 IRQ_EB11MP_PMU_SCU0 + i);
126 goto err_free_scu; 126 goto err_free_scu;
127 } 127 }
128 } 128 }
@@ -153,7 +153,7 @@ static int scu_start(void)
153 153
154 err_free_scu: 154 err_free_scu:
155 while (i--) 155 while (i--)
156 free_irq(IRQ_PMU_SCU0 + i, NULL); 156 free_irq(IRQ_EB11MP_PMU_SCU0 + i, NULL);
157 return ret; 157 return ret;
158} 158}
159 159
@@ -175,7 +175,7 @@ static void scu_stop(void)
175 for (i = 0; i < NUM_SCU_COUNTERS; i++) { 175 for (i = 0; i < NUM_SCU_COUNTERS; i++) {
176 if (scu_em_used & (1 << i)) { 176 if (scu_em_used & (1 << i)) {
177 scu_reset_counter(emc, i); 177 scu_reset_counter(emc, i);
178 free_irq(IRQ_PMU_SCU0 + i, NULL); 178 free_irq(IRQ_EB11MP_PMU_SCU0 + i, NULL);
179 } 179 }
180 } 180 }
181} 181}
@@ -225,10 +225,10 @@ static int em_setup_ctrs(void)
225} 225}
226 226
227static int arm11_irqs[] = { 227static int arm11_irqs[] = {
228 [0] = IRQ_PMU_CPU0, 228 [0] = IRQ_EB11MP_PMU_CPU0,
229 [1] = IRQ_PMU_CPU1, 229 [1] = IRQ_EB11MP_PMU_CPU1,
230 [2] = IRQ_PMU_CPU2, 230 [2] = IRQ_EB11MP_PMU_CPU2,
231 [3] = IRQ_PMU_CPU3 231 [3] = IRQ_EB11MP_PMU_CPU3
232}; 232};
233 233
234static int em_start(void) 234static int em_start(void)
@@ -273,22 +273,22 @@ static int em_setup(void)
273 /* 273 /*
274 * Send SCU PMU interrupts to the "owner" CPU. 274 * Send SCU PMU interrupts to the "owner" CPU.
275 */ 275 */
276 em_route_irq(IRQ_PMU_SCU0, 0); 276 em_route_irq(IRQ_EB11MP_PMU_SCU0, 0);
277 em_route_irq(IRQ_PMU_SCU1, 0); 277 em_route_irq(IRQ_EB11MP_PMU_SCU1, 0);
278 em_route_irq(IRQ_PMU_SCU2, 1); 278 em_route_irq(IRQ_EB11MP_PMU_SCU2, 1);
279 em_route_irq(IRQ_PMU_SCU3, 1); 279 em_route_irq(IRQ_EB11MP_PMU_SCU3, 1);
280 em_route_irq(IRQ_PMU_SCU4, 2); 280 em_route_irq(IRQ_EB11MP_PMU_SCU4, 2);
281 em_route_irq(IRQ_PMU_SCU5, 2); 281 em_route_irq(IRQ_EB11MP_PMU_SCU5, 2);
282 em_route_irq(IRQ_PMU_SCU6, 3); 282 em_route_irq(IRQ_EB11MP_PMU_SCU6, 3);
283 em_route_irq(IRQ_PMU_SCU7, 3); 283 em_route_irq(IRQ_EB11MP_PMU_SCU7, 3);
284 284
285 /* 285 /*
286 * Send CP15 PMU interrupts to the owner CPU. 286 * Send CP15 PMU interrupts to the owner CPU.
287 */ 287 */
288 em_route_irq(IRQ_PMU_CPU0, 0); 288 em_route_irq(IRQ_EB11MP_PMU_CPU0, 0);
289 em_route_irq(IRQ_PMU_CPU1, 1); 289 em_route_irq(IRQ_EB11MP_PMU_CPU1, 1);
290 em_route_irq(IRQ_PMU_CPU2, 2); 290 em_route_irq(IRQ_EB11MP_PMU_CPU2, 2);
291 em_route_irq(IRQ_PMU_CPU3, 3); 291 em_route_irq(IRQ_EB11MP_PMU_CPU3, 3);
292 292
293 return 0; 293 return 0;
294} 294}
diff --git a/arch/avr32/kernel/asm-offsets.c b/arch/avr32/kernel/asm-offsets.c
index 078cd33f467b..e4796c67a831 100644
--- a/arch/avr32/kernel/asm-offsets.c
+++ b/arch/avr32/kernel/asm-offsets.c
@@ -5,14 +5,7 @@
5 */ 5 */
6 6
7#include <linux/thread_info.h> 7#include <linux/thread_info.h>
8 8#include <linux/kbuild.h>
9#define DEFINE(sym, val) \
10 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
11
12#define BLANK() asm volatile("\n->" : : )
13
14#define OFFSET(sym, str, mem) \
15 DEFINE(sym, offsetof(struct str, mem));
16 9
17void foo(void) 10void foo(void)
18{ 11{
diff --git a/arch/avr32/kernel/sys_avr32.c b/arch/avr32/kernel/sys_avr32.c
index 8deb6003ee62..8e8911e55c8f 100644
--- a/arch/avr32/kernel/sys_avr32.c
+++ b/arch/avr32/kernel/sys_avr32.c
@@ -14,19 +14,6 @@
14#include <asm/mman.h> 14#include <asm/mman.h>
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16 16
17asmlinkage int sys_pipe(unsigned long __user *filedes)
18{
19 int fd[2];
20 int error;
21
22 error = do_pipe(fd);
23 if (!error) {
24 if (copy_to_user(filedes, fd, sizeof(fd)))
25 error = -EFAULT;
26 }
27 return error;
28}
29
30asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 17asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
31 unsigned long prot, unsigned long flags, 18 unsigned long prot, unsigned long flags,
32 unsigned long fd, off_t offset) 19 unsigned long fd, off_t offset)
diff --git a/arch/avr32/mm/tlb.c b/arch/avr32/mm/tlb.c
index b835257a8fa3..cd12edbea9f2 100644
--- a/arch/avr32/mm/tlb.c
+++ b/arch/avr32/mm/tlb.c
@@ -369,11 +369,7 @@ static const struct file_operations proc_tlb_operations = {
369 369
370static int __init proctlb_init(void) 370static int __init proctlb_init(void)
371{ 371{
372 struct proc_dir_entry *entry; 372 proc_create("tlb", 0, NULL, &proc_tlb_operations);
373
374 entry = create_proc_entry("tlb", 0, NULL);
375 if (entry)
376 entry->proc_fops = &proc_tlb_operations;
377 return 0; 373 return 0;
378} 374}
379late_initcall(proctlb_init); 375late_initcall(proctlb_init);
diff --git a/arch/blackfin/kernel/asm-offsets.c b/arch/blackfin/kernel/asm-offsets.c
index b56b2741cdea..721f15f3cebf 100644
--- a/arch/blackfin/kernel/asm-offsets.c
+++ b/arch/blackfin/kernel/asm-offsets.c
@@ -34,8 +34,7 @@
34#include <linux/hardirq.h> 34#include <linux/hardirq.h>
35#include <linux/irq.h> 35#include <linux/irq.h>
36#include <linux/thread_info.h> 36#include <linux/thread_info.h>
37 37#include <linux/kbuild.h>
38#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val))
39 38
40int main(void) 39int main(void)
41{ 40{
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index d1fa24401dc6..cb9d883d493c 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -212,7 +212,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info,
212 212
213 /* Set up registers for signal handler */ 213 /* Set up registers for signal handler */
214 wrusp((unsigned long)frame); 214 wrusp((unsigned long)frame);
215 if (get_personality & FDPIC_FUNCPTRS) { 215 if (current->personality & FDPIC_FUNCPTRS) {
216 struct fdpic_func_descriptor __user *funcptr = 216 struct fdpic_func_descriptor __user *funcptr =
217 (struct fdpic_func_descriptor *) ka->sa.sa_handler; 217 (struct fdpic_func_descriptor *) ka->sa.sa_handler;
218 __get_user(regs->pc, &funcptr->text); 218 __get_user(regs->pc, &funcptr->text);
diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c
index efb7b25a2633..fce49d7cf001 100644
--- a/arch/blackfin/kernel/sys_bfin.c
+++ b/arch/blackfin/kernel/sys_bfin.c
@@ -45,23 +45,6 @@
45#include <asm/cacheflush.h> 45#include <asm/cacheflush.h>
46#include <asm/dma.h> 46#include <asm/dma.h>
47 47
48/*
49 * sys_pipe() is the normal C calling standard for creating
50 * a pipe. It's not the way unix traditionally does this, though.
51 */
52asmlinkage int sys_pipe(unsigned long __user *fildes)
53{
54 int fd[2];
55 int error;
56
57 error = do_pipe(fd);
58 if (!error) {
59 if (copy_to_user(fildes, fd, 2 * sizeof(int)))
60 error = -EFAULT;
61 }
62 return error;
63}
64
65/* common code for old and new mmaps */ 48/* common code for old and new mmaps */
66static inline long 49static inline long
67do_mmap2(unsigned long addr, unsigned long len, 50do_mmap2(unsigned long addr, unsigned long len,
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index fddce32901a2..024f418ae543 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -499,20 +499,17 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
499#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) 499#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
500 { 500 {
501 I2C_BOARD_INFO("ad7142_joystick", 0x2C), 501 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
502 .type = "ad7142_joystick",
503 .irq = 39, 502 .irq = 39,
504 }, 503 },
505#endif 504#endif
506#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) 505#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
507 { 506 {
508 I2C_BOARD_INFO("pcf8574_lcd", 0x22), 507 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
509 .type = "pcf8574_lcd",
510 }, 508 },
511#endif 509#endif
512#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) 510#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
513 { 511 {
514 I2C_BOARD_INFO("pcf8574_keypad", 0x27), 512 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
515 .type = "pcf8574_keypad",
516 .irq = 39, 513 .irq = 39,
517 }, 514 },
518#endif 515#endif
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 0cec14b1ef5c..d3727b7c2d7d 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -751,20 +751,17 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
751#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) 751#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
752 { 752 {
753 I2C_BOARD_INFO("ad7142_joystick", 0x2C), 753 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
754 .type = "ad7142_joystick",
755 .irq = 55, 754 .irq = 55,
756 }, 755 },
757#endif 756#endif
758#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) 757#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
759 { 758 {
760 I2C_BOARD_INFO("pcf8574_lcd", 0x22), 759 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
761 .type = "pcf8574_lcd",
762 }, 760 },
763#endif 761#endif
764#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) 762#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
765 { 763 {
766 I2C_BOARD_INFO("pcf8574_keypad", 0x27), 764 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
767 .type = "pcf8574_keypad",
768 .irq = 72, 765 .irq = 72,
769 }, 766 },
770#endif 767#endif
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 231dfbd3bc1f..b00f68ac6bc9 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -641,13 +641,11 @@ static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
641#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) 641#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
642 { 642 {
643 I2C_BOARD_INFO("pcf8574_lcd", 0x22), 643 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
644 .type = "pcf8574_lcd",
645 }, 644 },
646#endif 645#endif
647#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) 646#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
648 { 647 {
649 I2C_BOARD_INFO("pcf8574_keypad", 0x27), 648 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
650 .type = "pcf8574_keypad",
651 .irq = 212, 649 .irq = 212,
652 }, 650 },
653#endif 651#endif
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c
index aad0a9e5991a..44f7b4f79476 100644
--- a/arch/cris/kernel/profile.c
+++ b/arch/cris/kernel/profile.c
@@ -75,9 +75,9 @@ __init init_cris_profile(void)
75 75
76 sample_buffer_pos = sample_buffer; 76 sample_buffer_pos = sample_buffer;
77 77
78 entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL); 78 entry = proc_create("system_profile", S_IWUSR | S_IRUGO, NULL,
79 &cris_proc_profile_operations);
79 if (entry) { 80 if (entry) {
80 entry->proc_fops = &cris_proc_profile_operations;
81 entry->size = SAMPLE_BUFFER_SIZE; 81 entry->size = SAMPLE_BUFFER_SIZE;
82 } 82 }
83 prof_running = 1; 83 prof_running = 1;
diff --git a/arch/frv/kernel/asm-offsets.c b/arch/frv/kernel/asm-offsets.c
index fbb19fc1af40..9de96843a278 100644
--- a/arch/frv/kernel/asm-offsets.c
+++ b/arch/frv/kernel/asm-offsets.c
@@ -7,15 +7,13 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/signal.h> 8#include <linux/signal.h>
9#include <linux/personality.h> 9#include <linux/personality.h>
10#include <linux/kbuild.h>
10#include <asm/registers.h> 11#include <asm/registers.h>
11#include <asm/ucontext.h> 12#include <asm/ucontext.h>
12#include <asm/processor.h> 13#include <asm/processor.h>
13#include <asm/thread_info.h> 14#include <asm/thread_info.h>
14#include <asm/gdb-stub.h> 15#include <asm/gdb-stub.h>
15 16
16#define DEFINE(sym, val) \
17 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
18
19#define DEF_PTREG(sym, reg) \ 17#define DEF_PTREG(sym, reg) \
20 asm volatile("\n->" #sym " %0 offsetof(struct pt_regs, " #reg ")" \ 18 asm volatile("\n->" #sym " %0 offsetof(struct pt_regs, " #reg ")" \
21 : : "i" (offsetof(struct pt_regs, reg))) 19 : : "i" (offsetof(struct pt_regs, reg)))
@@ -32,11 +30,6 @@
32 asm volatile("\n->" #sym " %0 offsetof(struct frv_frame0, " #reg ")" \ 30 asm volatile("\n->" #sym " %0 offsetof(struct frv_frame0, " #reg ")" \
33 : : "i" (offsetof(struct frv_frame0, reg))) 31 : : "i" (offsetof(struct frv_frame0, reg)))
34 32
35#define BLANK() asm volatile("\n->" : : )
36
37#define OFFSET(sym, str, mem) \
38 DEFINE(sym, offsetof(struct str, mem));
39
40void foo(void) 33void foo(void)
41{ 34{
42 /* offsets into the thread_info structure */ 35 /* offsets into the thread_info structure */
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index c57ce3f1f2e2..73f3aeefd203 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -163,14 +163,11 @@ static int sysctl_pm_do_suspend(ctl_table *ctl, int write, struct file *filp,
163 if ((mode != 1) && (mode != 5)) 163 if ((mode != 1) && (mode != 5))
164 return -EINVAL; 164 return -EINVAL;
165 165
166 retval = pm_send_all(PM_SUSPEND, (void *)3);
167
168 if (retval == 0) { 166 if (retval == 0) {
169 if (mode == 5) 167 if (mode == 5)
170 retval = pm_do_bus_sleep(); 168 retval = pm_do_bus_sleep();
171 else 169 else
172 retval = pm_do_suspend(); 170 retval = pm_do_suspend();
173 pm_send_all(PM_RESUME, (void *)0);
174 } 171 }
175 172
176 return retval; 173 return retval;
@@ -183,9 +180,6 @@ static int try_set_cmode(int new_cmode)
183 if (!(clock_cmodes_permitted & (1<<new_cmode))) 180 if (!(clock_cmodes_permitted & (1<<new_cmode)))
184 return -EINVAL; 181 return -EINVAL;
185 182
186 /* tell all the drivers we're suspending */
187 pm_send_all(PM_SUSPEND, (void *)3);
188
189 /* now change cmode */ 183 /* now change cmode */
190 local_irq_disable(); 184 local_irq_disable();
191 frv_dma_pause_all(); 185 frv_dma_pause_all();
@@ -201,8 +195,6 @@ static int try_set_cmode(int new_cmode)
201 frv_dma_resume_all(); 195 frv_dma_resume_all();
202 local_irq_enable(); 196 local_irq_enable();
203 197
204 /* tell all the drivers we're resuming */
205 pm_send_all(PM_RESUME, (void *)0);
206 return 0; 198 return 0;
207} 199}
208 200
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index d64bcaff54cd..3bdb368292a8 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -297,7 +297,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
297 __frame->lr = (unsigned long) &frame->retcode; 297 __frame->lr = (unsigned long) &frame->retcode;
298 __frame->gr8 = sig; 298 __frame->gr8 = sig;
299 299
300 if (get_personality & FDPIC_FUNCPTRS) { 300 if (current->personality & FDPIC_FUNCPTRS) {
301 struct fdpic_func_descriptor __user *funcptr = 301 struct fdpic_func_descriptor __user *funcptr =
302 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; 302 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler;
303 __get_user(__frame->pc, &funcptr->text); 303 __get_user(__frame->pc, &funcptr->text);
@@ -396,7 +396,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
396 __frame->gr8 = sig; 396 __frame->gr8 = sig;
397 __frame->gr9 = (unsigned long) &frame->info; 397 __frame->gr9 = (unsigned long) &frame->info;
398 398
399 if (get_personality & FDPIC_FUNCPTRS) { 399 if (current->personality & FDPIC_FUNCPTRS) {
400 struct fdpic_func_descriptor __user *funcptr = 400 struct fdpic_func_descriptor __user *funcptr =
401 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; 401 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler;
402 __get_user(__frame->pc, &funcptr->text); 402 __get_user(__frame->pc, &funcptr->text);
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
index 04c6b1677ccf..49b2cf2c38f3 100644
--- a/arch/frv/kernel/sys_frv.c
+++ b/arch/frv/kernel/sys_frv.c
@@ -28,23 +28,6 @@
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30 30
31/*
32 * sys_pipe() is the normal C calling standard for creating
33 * a pipe. It's not the way unix traditionally does this, though.
34 */
35asmlinkage long sys_pipe(unsigned long __user * fildes)
36{
37 int fd[2];
38 int error;
39
40 error = do_pipe(fd);
41 if (!error) {
42 if (copy_to_user(fildes, fd, 2*sizeof(int)))
43 error = -EFAULT;
44 }
45 return error;
46}
47
48asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 31asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
49 unsigned long prot, unsigned long flags, 32 unsigned long prot, unsigned long flags,
50 unsigned long fd, unsigned long pgoff) 33 unsigned long fd, unsigned long pgoff)
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index a40df80b2ebd..1d2dfe67d442 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -362,11 +362,8 @@ asmlinkage void memory_access_exception(unsigned long esr0,
362#ifdef CONFIG_MMU 362#ifdef CONFIG_MMU
363 unsigned long fixup; 363 unsigned long fixup;
364 364
365 if ((esr0 & ESRx_EC) == ESRx_EC_DATA_ACCESS) 365 fixup = search_exception_table(__frame->pc);
366 if (handle_misalignment(esr0, ear0, epcr0) == 0) 366 if (fixup) {
367 return;
368
369 if ((fixup = search_exception_table(__frame->pc)) != 0) {
370 __frame->pc = fixup; 367 __frame->pc = fixup;
371 return; 368 return;
372 } 369 }
diff --git a/arch/frv/mb93090-mb00/pci-iomap.c b/arch/frv/mb93090-mb00/pci-iomap.c
index 068fa04bd527..35f6df28351e 100644
--- a/arch/frv/mb93090-mb00/pci-iomap.c
+++ b/arch/frv/mb93090-mb00/pci-iomap.c
@@ -13,8 +13,8 @@
13 13
14void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 14void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
15{ 15{
16 unsigned long start = pci_resource_start(dev, bar); 16 resource_size_t start = pci_resource_start(dev, bar);
17 unsigned long len = pci_resource_len(dev, bar); 17 resource_size_t len = pci_resource_len(dev, bar);
18 unsigned long flags = pci_resource_flags(dev, bar); 18 unsigned long flags = pci_resource_flags(dev, bar);
19 19
20 if (!len || !start) 20 if (!len || !start)
diff --git a/arch/frv/mm/Makefile b/arch/frv/mm/Makefile
index fb8b1d860f46..1bca5ab8a6ab 100644
--- a/arch/frv/mm/Makefile
+++ b/arch/frv/mm/Makefile
@@ -6,4 +6,4 @@ obj-y := init.o kmap.o
6 6
7obj-$(CONFIG_MMU) += \ 7obj-$(CONFIG_MMU) += \
8 pgalloc.o highmem.o fault.o extable.o cache-page.o tlb-flush.o tlb-miss.o \ 8 pgalloc.o highmem.o fault.o extable.o cache-page.o tlb-flush.o tlb-miss.o \
9 mmu-context.o dma-alloc.o unaligned.o elf-fdpic.o 9 mmu-context.o dma-alloc.o elf-fdpic.o
diff --git a/arch/frv/mm/unaligned.c b/arch/frv/mm/unaligned.c
deleted file mode 100644
index 8f0375fc15a8..000000000000
--- a/arch/frv/mm/unaligned.c
+++ /dev/null
@@ -1,217 +0,0 @@
1/* unaligned.c: unalignment fixup handler for CPUs on which it is supported (FR451 only)
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/sched.h>
13#include <linux/signal.h>
14#include <linux/kernel.h>
15#include <linux/mm.h>
16#include <linux/types.h>
17#include <linux/user.h>
18#include <linux/string.h>
19#include <linux/linkage.h>
20#include <linux/init.h>
21
22#include <asm/setup.h>
23#include <asm/system.h>
24#include <asm/uaccess.h>
25
26#if 0
27#define kdebug(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ )
28#else
29#define kdebug(fmt, ...) do {} while(0)
30#endif
31
32#define _MA_SIGNED 0x01
33#define _MA_HALF 0x02
34#define _MA_WORD 0x04
35#define _MA_DWORD 0x08
36#define _MA_SZ_MASK 0x0e
37#define _MA_LOAD 0x10
38#define _MA_STORE 0x20
39#define _MA_UPDATE 0x40
40#define _MA_IMM 0x80
41
42#define _MA_LDxU _MA_LOAD | _MA_UPDATE
43#define _MA_LDxI _MA_LOAD | _MA_IMM
44#define _MA_STxU _MA_STORE | _MA_UPDATE
45#define _MA_STxI _MA_STORE | _MA_IMM
46
47static const uint8_t tbl_LDGRk_reg[0x40] = {
48 [0x02] = _MA_LOAD | _MA_HALF | _MA_SIGNED, /* LDSH @(GRi,GRj),GRk */
49 [0x03] = _MA_LOAD | _MA_HALF, /* LDUH @(GRi,GRj),GRk */
50 [0x04] = _MA_LOAD | _MA_WORD, /* LD @(GRi,GRj),GRk */
51 [0x05] = _MA_LOAD | _MA_DWORD, /* LDD @(GRi,GRj),GRk */
52 [0x12] = _MA_LDxU | _MA_HALF | _MA_SIGNED, /* LDSHU @(GRi,GRj),GRk */
53 [0x13] = _MA_LDxU | _MA_HALF, /* LDUHU @(GRi,GRj),GRk */
54 [0x14] = _MA_LDxU | _MA_WORD, /* LDU @(GRi,GRj),GRk */
55 [0x15] = _MA_LDxU | _MA_DWORD, /* LDDU @(GRi,GRj),GRk */
56};
57
58static const uint8_t tbl_STGRk_reg[0x40] = {
59 [0x01] = _MA_STORE | _MA_HALF, /* STH @(GRi,GRj),GRk */
60 [0x02] = _MA_STORE | _MA_WORD, /* ST @(GRi,GRj),GRk */
61 [0x03] = _MA_STORE | _MA_DWORD, /* STD @(GRi,GRj),GRk */
62 [0x11] = _MA_STxU | _MA_HALF, /* STHU @(GRi,GRj),GRk */
63 [0x12] = _MA_STxU | _MA_WORD, /* STU @(GRi,GRj),GRk */
64 [0x13] = _MA_STxU | _MA_DWORD, /* STDU @(GRi,GRj),GRk */
65};
66
67static const uint8_t tbl_LDSTGRk_imm[0x80] = {
68 [0x31] = _MA_LDxI | _MA_HALF | _MA_SIGNED, /* LDSHI @(GRi,d12),GRk */
69 [0x32] = _MA_LDxI | _MA_WORD, /* LDI @(GRi,d12),GRk */
70 [0x33] = _MA_LDxI | _MA_DWORD, /* LDDI @(GRi,d12),GRk */
71 [0x36] = _MA_LDxI | _MA_HALF, /* LDUHI @(GRi,d12),GRk */
72 [0x51] = _MA_STxI | _MA_HALF, /* STHI @(GRi,d12),GRk */
73 [0x52] = _MA_STxI | _MA_WORD, /* STI @(GRi,d12),GRk */
74 [0x53] = _MA_STxI | _MA_DWORD, /* STDI @(GRi,d12),GRk */
75};
76
77
78/*****************************************************************************/
79/*
80 * see if we can handle the exception by fixing up a misaligned memory access
81 */
82int handle_misalignment(unsigned long esr0, unsigned long ear0, unsigned long epcr0)
83{
84 unsigned long insn, addr, *greg;
85 int GRi, GRj, GRk, D12, op;
86
87 union {
88 uint64_t _64;
89 uint32_t _32[2];
90 uint16_t _16;
91 uint8_t _8[8];
92 } x;
93
94 if (!(esr0 & ESR0_EAV) || !(epcr0 & EPCR0_V) || !(ear0 & 7))
95 return -EAGAIN;
96
97 epcr0 &= EPCR0_PC;
98
99 if (__frame->pc != epcr0) {
100 kdebug("MISALIGN: Execution not halted on excepting instruction\n");
101 BUG();
102 }
103
104 if (__get_user(insn, (unsigned long *) epcr0) < 0)
105 return -EFAULT;
106
107 /* determine the instruction type first */
108 switch ((insn >> 18) & 0x7f) {
109 case 0x2:
110 /* LDx @(GRi,GRj),GRk */
111 op = tbl_LDGRk_reg[(insn >> 6) & 0x3f];
112 break;
113
114 case 0x3:
115 /* STx GRk,@(GRi,GRj) */
116 op = tbl_STGRk_reg[(insn >> 6) & 0x3f];
117 break;
118
119 default:
120 op = tbl_LDSTGRk_imm[(insn >> 18) & 0x7f];
121 break;
122 }
123
124 if (!op)
125 return -EAGAIN;
126
127 kdebug("MISALIGN: pc=%08lx insn=%08lx ad=%08lx op=%02x\n", epcr0, insn, ear0, op);
128
129 memset(&x, 0xba, 8);
130
131 /* validate the instruction parameters */
132 greg = (unsigned long *) &__frame->tbr;
133
134 GRi = (insn >> 12) & 0x3f;
135 GRk = (insn >> 25) & 0x3f;
136
137 if (GRi > 31 || GRk > 31)
138 return -ENOENT;
139
140 if (op & _MA_DWORD && GRk & 1)
141 return -EINVAL;
142
143 if (op & _MA_IMM) {
144 D12 = insn & 0xfff;
145 asm ("slli %0,#20,%0 ! srai %0,#20,%0" : "=r"(D12) : "0"(D12)); /* sign extend */
146 addr = (GRi ? greg[GRi] : 0) + D12;
147 }
148 else {
149 GRj = (insn >> 0) & 0x3f;
150 if (GRj > 31)
151 return -ENOENT;
152 addr = (GRi ? greg[GRi] : 0) + (GRj ? greg[GRj] : 0);
153 }
154
155 if (addr != ear0) {
156 kdebug("MISALIGN: Calculated addr (%08lx) does not match EAR0 (%08lx)\n",
157 addr, ear0);
158 return -EFAULT;
159 }
160
161 /* check the address is okay */
162 if (user_mode(__frame) && ___range_ok(ear0, 8) < 0)
163 return -EFAULT;
164
165 /* perform the memory op */
166 if (op & _MA_STORE) {
167 /* perform a store */
168 x._32[0] = 0;
169 if (GRk != 0) {
170 if (op & _MA_HALF) {
171 x._16 = greg[GRk];
172 }
173 else {
174 x._32[0] = greg[GRk];
175 }
176 }
177 if (op & _MA_DWORD)
178 x._32[1] = greg[GRk + 1];
179
180 kdebug("MISALIGN: Store GR%d { %08x:%08x } -> %08lx (%dB)\n",
181 GRk, x._32[1], x._32[0], addr, op & _MA_SZ_MASK);
182
183 if (__memcpy_user((void *) addr, &x, op & _MA_SZ_MASK) != 0)
184 return -EFAULT;
185 }
186 else {
187 /* perform a load */
188 if (__memcpy_user(&x, (void *) addr, op & _MA_SZ_MASK) != 0)
189 return -EFAULT;
190
191 if (op & _MA_HALF) {
192 if (op & _MA_SIGNED)
193 asm ("slli %0,#16,%0 ! srai %0,#16,%0"
194 : "=r"(x._32[0]) : "0"(x._16));
195 else
196 asm ("sethi #0,%0"
197 : "=r"(x._32[0]) : "0"(x._16));
198 }
199
200 kdebug("MISALIGN: Load %08lx (%dB) -> GR%d, { %08x:%08x }\n",
201 addr, op & _MA_SZ_MASK, GRk, x._32[1], x._32[0]);
202
203 if (GRk != 0)
204 greg[GRk] = x._32[0];
205 if (op & _MA_DWORD)
206 greg[GRk + 1] = x._32[1];
207 }
208
209 /* update the base pointer if required */
210 if (op & _MA_UPDATE)
211 greg[GRi] = addr;
212
213 /* well... we've done that insn */
214 __frame->pc = __frame->pc + 4;
215
216 return 0;
217} /* end handle_misalignment() */
diff --git a/arch/h8300/kernel/asm-offsets.c b/arch/h8300/kernel/asm-offsets.c
index fc30b4fd0914..2042552e0871 100644
--- a/arch/h8300/kernel/asm-offsets.c
+++ b/arch/h8300/kernel/asm-offsets.c
@@ -13,15 +13,11 @@
13#include <linux/kernel_stat.h> 13#include <linux/kernel_stat.h>
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <linux/hardirq.h> 15#include <linux/hardirq.h>
16#include <linux/kbuild.h>
16#include <asm/bootinfo.h> 17#include <asm/bootinfo.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <asm/ptrace.h> 19#include <asm/ptrace.h>
19 20
20#define DEFINE(sym, val) \
21 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
22
23#define BLANK() asm volatile("\n->" : : )
24
25int main(void) 21int main(void)
26{ 22{
27 /* offsets into the task struct */ 23 /* offsets into the task struct */
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index 00608be6d567..2745656dcc52 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -27,23 +27,6 @@
27#include <asm/traps.h> 27#include <asm/traps.h>
28#include <asm/unistd.h> 28#include <asm/unistd.h>
29 29
30/*
31 * sys_pipe() is the normal C calling standard for creating
32 * a pipe. It's not the way unix traditionally does this, though.
33 */
34asmlinkage int sys_pipe(unsigned long * fildes)
35{
36 int fd[2];
37 int error;
38
39 error = do_pipe(fd);
40 if (!error) {
41 if (copy_to_user(fildes, fd, 2*sizeof(int)))
42 error = -EFAULT;
43 }
44 return error;
45}
46
47/* common code for old and new mmaps */ 30/* common code for old and new mmaps */
48static inline long do_mmap2( 31static inline long do_mmap2(
49 unsigned long addr, unsigned long len, 32 unsigned long addr, unsigned long len,
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3aa6c821449a..0df5f6f75edf 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -19,6 +19,7 @@ config IA64
19 select HAVE_OPROFILE 19 select HAVE_OPROFILE
20 select HAVE_KPROBES 20 select HAVE_KPROBES
21 select HAVE_KRETPROBES 21 select HAVE_KRETPROBES
22 select HAVE_DMA_ATTRS
22 select HAVE_KVM 23 select HAVE_KVM
23 default y 24 default y
24 help 25 help
@@ -47,6 +48,9 @@ config MMU
47config SWIOTLB 48config SWIOTLB
48 bool 49 bool
49 50
51config IOMMU_HELPER
52 bool
53
50config GENERIC_LOCKBREAK 54config GENERIC_LOCKBREAK
51 bool 55 bool
52 default y 56 default y
@@ -615,7 +619,7 @@ config IRQ_PER_CPU
615 default y 619 default y
616 620
617config IOMMU_HELPER 621config IOMMU_HELPER
618 def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC) 622 def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC || SWIOTLB)
619 623
620source "arch/ia64/hp/sim/Kconfig" 624source "arch/ia64/hp/sim/Kconfig"
621 625
diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c
index 8f6bcfe1dada..1c44ec2a1d58 100644
--- a/arch/ia64/hp/common/hwsw_iommu.c
+++ b/arch/ia64/hp/common/hwsw_iommu.c
@@ -20,10 +20,10 @@
20extern int swiotlb_late_init_with_default_size (size_t size); 20extern int swiotlb_late_init_with_default_size (size_t size);
21extern ia64_mv_dma_alloc_coherent swiotlb_alloc_coherent; 21extern ia64_mv_dma_alloc_coherent swiotlb_alloc_coherent;
22extern ia64_mv_dma_free_coherent swiotlb_free_coherent; 22extern ia64_mv_dma_free_coherent swiotlb_free_coherent;
23extern ia64_mv_dma_map_single swiotlb_map_single; 23extern ia64_mv_dma_map_single_attrs swiotlb_map_single_attrs;
24extern ia64_mv_dma_unmap_single swiotlb_unmap_single; 24extern ia64_mv_dma_unmap_single_attrs swiotlb_unmap_single_attrs;
25extern ia64_mv_dma_map_sg swiotlb_map_sg; 25extern ia64_mv_dma_map_sg_attrs swiotlb_map_sg_attrs;
26extern ia64_mv_dma_unmap_sg swiotlb_unmap_sg; 26extern ia64_mv_dma_unmap_sg_attrs swiotlb_unmap_sg_attrs;
27extern ia64_mv_dma_supported swiotlb_dma_supported; 27extern ia64_mv_dma_supported swiotlb_dma_supported;
28extern ia64_mv_dma_mapping_error swiotlb_dma_mapping_error; 28extern ia64_mv_dma_mapping_error swiotlb_dma_mapping_error;
29 29
@@ -31,19 +31,19 @@ extern ia64_mv_dma_mapping_error swiotlb_dma_mapping_error;
31 31
32extern ia64_mv_dma_alloc_coherent sba_alloc_coherent; 32extern ia64_mv_dma_alloc_coherent sba_alloc_coherent;
33extern ia64_mv_dma_free_coherent sba_free_coherent; 33extern ia64_mv_dma_free_coherent sba_free_coherent;
34extern ia64_mv_dma_map_single sba_map_single; 34extern ia64_mv_dma_map_single_attrs sba_map_single_attrs;
35extern ia64_mv_dma_unmap_single sba_unmap_single; 35extern ia64_mv_dma_unmap_single_attrs sba_unmap_single_attrs;
36extern ia64_mv_dma_map_sg sba_map_sg; 36extern ia64_mv_dma_map_sg_attrs sba_map_sg_attrs;
37extern ia64_mv_dma_unmap_sg sba_unmap_sg; 37extern ia64_mv_dma_unmap_sg_attrs sba_unmap_sg_attrs;
38extern ia64_mv_dma_supported sba_dma_supported; 38extern ia64_mv_dma_supported sba_dma_supported;
39extern ia64_mv_dma_mapping_error sba_dma_mapping_error; 39extern ia64_mv_dma_mapping_error sba_dma_mapping_error;
40 40
41#define hwiommu_alloc_coherent sba_alloc_coherent 41#define hwiommu_alloc_coherent sba_alloc_coherent
42#define hwiommu_free_coherent sba_free_coherent 42#define hwiommu_free_coherent sba_free_coherent
43#define hwiommu_map_single sba_map_single 43#define hwiommu_map_single_attrs sba_map_single_attrs
44#define hwiommu_unmap_single sba_unmap_single 44#define hwiommu_unmap_single_attrs sba_unmap_single_attrs
45#define hwiommu_map_sg sba_map_sg 45#define hwiommu_map_sg_attrs sba_map_sg_attrs
46#define hwiommu_unmap_sg sba_unmap_sg 46#define hwiommu_unmap_sg_attrs sba_unmap_sg_attrs
47#define hwiommu_dma_supported sba_dma_supported 47#define hwiommu_dma_supported sba_dma_supported
48#define hwiommu_dma_mapping_error sba_dma_mapping_error 48#define hwiommu_dma_mapping_error sba_dma_mapping_error
49#define hwiommu_sync_single_for_cpu machvec_dma_sync_single 49#define hwiommu_sync_single_for_cpu machvec_dma_sync_single
@@ -98,41 +98,48 @@ hwsw_free_coherent (struct device *dev, size_t size, void *vaddr, dma_addr_t dma
98} 98}
99 99
100dma_addr_t 100dma_addr_t
101hwsw_map_single (struct device *dev, void *addr, size_t size, int dir) 101hwsw_map_single_attrs(struct device *dev, void *addr, size_t size, int dir,
102 struct dma_attrs *attrs)
102{ 103{
103 if (use_swiotlb(dev)) 104 if (use_swiotlb(dev))
104 return swiotlb_map_single(dev, addr, size, dir); 105 return swiotlb_map_single_attrs(dev, addr, size, dir, attrs);
105 else 106 else
106 return hwiommu_map_single(dev, addr, size, dir); 107 return hwiommu_map_single_attrs(dev, addr, size, dir, attrs);
107} 108}
109EXPORT_SYMBOL(hwsw_map_single_attrs);
108 110
109void 111void
110hwsw_unmap_single (struct device *dev, dma_addr_t iova, size_t size, int dir) 112hwsw_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
113 int dir, struct dma_attrs *attrs)
111{ 114{
112 if (use_swiotlb(dev)) 115 if (use_swiotlb(dev))
113 return swiotlb_unmap_single(dev, iova, size, dir); 116 return swiotlb_unmap_single_attrs(dev, iova, size, dir, attrs);
114 else 117 else
115 return hwiommu_unmap_single(dev, iova, size, dir); 118 return hwiommu_unmap_single_attrs(dev, iova, size, dir, attrs);
116} 119}
117 120EXPORT_SYMBOL(hwsw_unmap_single_attrs);
118 121
119int 122int
120hwsw_map_sg (struct device *dev, struct scatterlist *sglist, int nents, int dir) 123hwsw_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents,
124 int dir, struct dma_attrs *attrs)
121{ 125{
122 if (use_swiotlb(dev)) 126 if (use_swiotlb(dev))
123 return swiotlb_map_sg(dev, sglist, nents, dir); 127 return swiotlb_map_sg_attrs(dev, sglist, nents, dir, attrs);
124 else 128 else
125 return hwiommu_map_sg(dev, sglist, nents, dir); 129 return hwiommu_map_sg_attrs(dev, sglist, nents, dir, attrs);
126} 130}
131EXPORT_SYMBOL(hwsw_map_sg_attrs);
127 132
128void 133void
129hwsw_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents, int dir) 134hwsw_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents,
135 int dir, struct dma_attrs *attrs)
130{ 136{
131 if (use_swiotlb(dev)) 137 if (use_swiotlb(dev))
132 return swiotlb_unmap_sg(dev, sglist, nents, dir); 138 return swiotlb_unmap_sg_attrs(dev, sglist, nents, dir, attrs);
133 else 139 else
134 return hwiommu_unmap_sg(dev, sglist, nents, dir); 140 return hwiommu_unmap_sg_attrs(dev, sglist, nents, dir, attrs);
135} 141}
142EXPORT_SYMBOL(hwsw_unmap_sg_attrs);
136 143
137void 144void
138hwsw_sync_single_for_cpu (struct device *dev, dma_addr_t addr, size_t size, int dir) 145hwsw_sync_single_for_cpu (struct device *dev, dma_addr_t addr, size_t size, int dir)
@@ -185,10 +192,6 @@ hwsw_dma_mapping_error (dma_addr_t dma_addr)
185} 192}
186 193
187EXPORT_SYMBOL(hwsw_dma_mapping_error); 194EXPORT_SYMBOL(hwsw_dma_mapping_error);
188EXPORT_SYMBOL(hwsw_map_single);
189EXPORT_SYMBOL(hwsw_unmap_single);
190EXPORT_SYMBOL(hwsw_map_sg);
191EXPORT_SYMBOL(hwsw_unmap_sg);
192EXPORT_SYMBOL(hwsw_dma_supported); 195EXPORT_SYMBOL(hwsw_dma_supported);
193EXPORT_SYMBOL(hwsw_alloc_coherent); 196EXPORT_SYMBOL(hwsw_alloc_coherent);
194EXPORT_SYMBOL(hwsw_free_coherent); 197EXPORT_SYMBOL(hwsw_free_coherent);
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 9409de5c9441..34421aed1e2a 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -899,16 +899,18 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
899} 899}
900 900
901/** 901/**
902 * sba_map_single - map one buffer and return IOVA for DMA 902 * sba_map_single_attrs - map one buffer and return IOVA for DMA
903 * @dev: instance of PCI owned by the driver that's asking. 903 * @dev: instance of PCI owned by the driver that's asking.
904 * @addr: driver buffer to map. 904 * @addr: driver buffer to map.
905 * @size: number of bytes to map in driver buffer. 905 * @size: number of bytes to map in driver buffer.
906 * @dir: R/W or both. 906 * @dir: R/W or both.
907 * @attrs: optional dma attributes
907 * 908 *
908 * See Documentation/DMA-mapping.txt 909 * See Documentation/DMA-mapping.txt
909 */ 910 */
910dma_addr_t 911dma_addr_t
911sba_map_single(struct device *dev, void *addr, size_t size, int dir) 912sba_map_single_attrs(struct device *dev, void *addr, size_t size, int dir,
913 struct dma_attrs *attrs)
912{ 914{
913 struct ioc *ioc; 915 struct ioc *ioc;
914 dma_addr_t iovp; 916 dma_addr_t iovp;
@@ -932,7 +934,8 @@ sba_map_single(struct device *dev, void *addr, size_t size, int dir)
932 ** Device is bit capable of DMA'ing to the buffer... 934 ** Device is bit capable of DMA'ing to the buffer...
933 ** just return the PCI address of ptr 935 ** just return the PCI address of ptr
934 */ 936 */
935 DBG_BYPASS("sba_map_single() bypass mask/addr: 0x%lx/0x%lx\n", 937 DBG_BYPASS("sba_map_single_attrs() bypass mask/addr: "
938 "0x%lx/0x%lx\n",
936 to_pci_dev(dev)->dma_mask, pci_addr); 939 to_pci_dev(dev)->dma_mask, pci_addr);
937 return pci_addr; 940 return pci_addr;
938 } 941 }
@@ -953,7 +956,7 @@ sba_map_single(struct device *dev, void *addr, size_t size, int dir)
953 956
954#ifdef ASSERT_PDIR_SANITY 957#ifdef ASSERT_PDIR_SANITY
955 spin_lock_irqsave(&ioc->res_lock, flags); 958 spin_lock_irqsave(&ioc->res_lock, flags);
956 if (sba_check_pdir(ioc,"Check before sba_map_single()")) 959 if (sba_check_pdir(ioc,"Check before sba_map_single_attrs()"))
957 panic("Sanity check failed"); 960 panic("Sanity check failed");
958 spin_unlock_irqrestore(&ioc->res_lock, flags); 961 spin_unlock_irqrestore(&ioc->res_lock, flags);
959#endif 962#endif
@@ -982,11 +985,12 @@ sba_map_single(struct device *dev, void *addr, size_t size, int dir)
982 /* form complete address */ 985 /* form complete address */
983#ifdef ASSERT_PDIR_SANITY 986#ifdef ASSERT_PDIR_SANITY
984 spin_lock_irqsave(&ioc->res_lock, flags); 987 spin_lock_irqsave(&ioc->res_lock, flags);
985 sba_check_pdir(ioc,"Check after sba_map_single()"); 988 sba_check_pdir(ioc,"Check after sba_map_single_attrs()");
986 spin_unlock_irqrestore(&ioc->res_lock, flags); 989 spin_unlock_irqrestore(&ioc->res_lock, flags);
987#endif 990#endif
988 return SBA_IOVA(ioc, iovp, offset); 991 return SBA_IOVA(ioc, iovp, offset);
989} 992}
993EXPORT_SYMBOL(sba_map_single_attrs);
990 994
991#ifdef ENABLE_MARK_CLEAN 995#ifdef ENABLE_MARK_CLEAN
992static SBA_INLINE void 996static SBA_INLINE void
@@ -1013,15 +1017,17 @@ sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size)
1013#endif 1017#endif
1014 1018
1015/** 1019/**
1016 * sba_unmap_single - unmap one IOVA and free resources 1020 * sba_unmap_single_attrs - unmap one IOVA and free resources
1017 * @dev: instance of PCI owned by the driver that's asking. 1021 * @dev: instance of PCI owned by the driver that's asking.
1018 * @iova: IOVA of driver buffer previously mapped. 1022 * @iova: IOVA of driver buffer previously mapped.
1019 * @size: number of bytes mapped in driver buffer. 1023 * @size: number of bytes mapped in driver buffer.
1020 * @dir: R/W or both. 1024 * @dir: R/W or both.
1025 * @attrs: optional dma attributes
1021 * 1026 *
1022 * See Documentation/DMA-mapping.txt 1027 * See Documentation/DMA-mapping.txt
1023 */ 1028 */
1024void sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size, int dir) 1029void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
1030 int dir, struct dma_attrs *attrs)
1025{ 1031{
1026 struct ioc *ioc; 1032 struct ioc *ioc;
1027#if DELAYED_RESOURCE_CNT > 0 1033#if DELAYED_RESOURCE_CNT > 0
@@ -1038,7 +1044,8 @@ void sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size, int dir)
1038 /* 1044 /*
1039 ** Address does not fall w/in IOVA, must be bypassing 1045 ** Address does not fall w/in IOVA, must be bypassing
1040 */ 1046 */
1041 DBG_BYPASS("sba_unmap_single() bypass addr: 0x%lx\n", iova); 1047 DBG_BYPASS("sba_unmap_single_atttrs() bypass addr: 0x%lx\n",
1048 iova);
1042 1049
1043#ifdef ENABLE_MARK_CLEAN 1050#ifdef ENABLE_MARK_CLEAN
1044 if (dir == DMA_FROM_DEVICE) { 1051 if (dir == DMA_FROM_DEVICE) {
@@ -1087,7 +1094,7 @@ void sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size, int dir)
1087 spin_unlock_irqrestore(&ioc->res_lock, flags); 1094 spin_unlock_irqrestore(&ioc->res_lock, flags);
1088#endif /* DELAYED_RESOURCE_CNT == 0 */ 1095#endif /* DELAYED_RESOURCE_CNT == 0 */
1089} 1096}
1090 1097EXPORT_SYMBOL(sba_unmap_single_attrs);
1091 1098
1092/** 1099/**
1093 * sba_alloc_coherent - allocate/map shared mem for DMA 1100 * sba_alloc_coherent - allocate/map shared mem for DMA
@@ -1144,7 +1151,8 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
1144 * If device can't bypass or bypass is disabled, pass the 32bit fake 1151 * If device can't bypass or bypass is disabled, pass the 32bit fake
1145 * device to map single to get an iova mapping. 1152 * device to map single to get an iova mapping.
1146 */ 1153 */
1147 *dma_handle = sba_map_single(&ioc->sac_only_dev->dev, addr, size, 0); 1154 *dma_handle = sba_map_single_attrs(&ioc->sac_only_dev->dev, addr,
1155 size, 0, NULL);
1148 1156
1149 return addr; 1157 return addr;
1150} 1158}
@@ -1161,7 +1169,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
1161 */ 1169 */
1162void sba_free_coherent (struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) 1170void sba_free_coherent (struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle)
1163{ 1171{
1164 sba_unmap_single(dev, dma_handle, size, 0); 1172 sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL);
1165 free_pages((unsigned long) vaddr, get_order(size)); 1173 free_pages((unsigned long) vaddr, get_order(size));
1166} 1174}
1167 1175
@@ -1410,10 +1418,12 @@ sba_coalesce_chunks(struct ioc *ioc, struct device *dev,
1410 * @sglist: array of buffer/length pairs 1418 * @sglist: array of buffer/length pairs
1411 * @nents: number of entries in list 1419 * @nents: number of entries in list
1412 * @dir: R/W or both. 1420 * @dir: R/W or both.
1421 * @attrs: optional dma attributes
1413 * 1422 *
1414 * See Documentation/DMA-mapping.txt 1423 * See Documentation/DMA-mapping.txt
1415 */ 1424 */
1416int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, int dir) 1425int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents,
1426 int dir, struct dma_attrs *attrs)
1417{ 1427{
1418 struct ioc *ioc; 1428 struct ioc *ioc;
1419 int coalesced, filled = 0; 1429 int coalesced, filled = 0;
@@ -1441,16 +1451,16 @@ int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, int di
1441 /* Fast path single entry scatterlists. */ 1451 /* Fast path single entry scatterlists. */
1442 if (nents == 1) { 1452 if (nents == 1) {
1443 sglist->dma_length = sglist->length; 1453 sglist->dma_length = sglist->length;
1444 sglist->dma_address = sba_map_single(dev, sba_sg_address(sglist), sglist->length, dir); 1454 sglist->dma_address = sba_map_single_attrs(dev, sba_sg_address(sglist), sglist->length, dir, attrs);
1445 return 1; 1455 return 1;
1446 } 1456 }
1447 1457
1448#ifdef ASSERT_PDIR_SANITY 1458#ifdef ASSERT_PDIR_SANITY
1449 spin_lock_irqsave(&ioc->res_lock, flags); 1459 spin_lock_irqsave(&ioc->res_lock, flags);
1450 if (sba_check_pdir(ioc,"Check before sba_map_sg()")) 1460 if (sba_check_pdir(ioc,"Check before sba_map_sg_attrs()"))
1451 { 1461 {
1452 sba_dump_sg(ioc, sglist, nents); 1462 sba_dump_sg(ioc, sglist, nents);
1453 panic("Check before sba_map_sg()"); 1463 panic("Check before sba_map_sg_attrs()");
1454 } 1464 }
1455 spin_unlock_irqrestore(&ioc->res_lock, flags); 1465 spin_unlock_irqrestore(&ioc->res_lock, flags);
1456#endif 1466#endif
@@ -1479,10 +1489,10 @@ int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, int di
1479 1489
1480#ifdef ASSERT_PDIR_SANITY 1490#ifdef ASSERT_PDIR_SANITY
1481 spin_lock_irqsave(&ioc->res_lock, flags); 1491 spin_lock_irqsave(&ioc->res_lock, flags);
1482 if (sba_check_pdir(ioc,"Check after sba_map_sg()")) 1492 if (sba_check_pdir(ioc,"Check after sba_map_sg_attrs()"))
1483 { 1493 {
1484 sba_dump_sg(ioc, sglist, nents); 1494 sba_dump_sg(ioc, sglist, nents);
1485 panic("Check after sba_map_sg()\n"); 1495 panic("Check after sba_map_sg_attrs()\n");
1486 } 1496 }
1487 spin_unlock_irqrestore(&ioc->res_lock, flags); 1497 spin_unlock_irqrestore(&ioc->res_lock, flags);
1488#endif 1498#endif
@@ -1492,18 +1502,20 @@ int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, int di
1492 1502
1493 return filled; 1503 return filled;
1494} 1504}
1495 1505EXPORT_SYMBOL(sba_map_sg_attrs);
1496 1506
1497/** 1507/**
1498 * sba_unmap_sg - unmap Scatter/Gather list 1508 * sba_unmap_sg_attrs - unmap Scatter/Gather list
1499 * @dev: instance of PCI owned by the driver that's asking. 1509 * @dev: instance of PCI owned by the driver that's asking.
1500 * @sglist: array of buffer/length pairs 1510 * @sglist: array of buffer/length pairs
1501 * @nents: number of entries in list 1511 * @nents: number of entries in list
1502 * @dir: R/W or both. 1512 * @dir: R/W or both.
1513 * @attrs: optional dma attributes
1503 * 1514 *
1504 * See Documentation/DMA-mapping.txt 1515 * See Documentation/DMA-mapping.txt
1505 */ 1516 */
1506void sba_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents, int dir) 1517void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1518 int nents, int dir, struct dma_attrs *attrs)
1507{ 1519{
1508#ifdef ASSERT_PDIR_SANITY 1520#ifdef ASSERT_PDIR_SANITY
1509 struct ioc *ioc; 1521 struct ioc *ioc;
@@ -1518,13 +1530,14 @@ void sba_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents, in
1518 ASSERT(ioc); 1530 ASSERT(ioc);
1519 1531
1520 spin_lock_irqsave(&ioc->res_lock, flags); 1532 spin_lock_irqsave(&ioc->res_lock, flags);
1521 sba_check_pdir(ioc,"Check before sba_unmap_sg()"); 1533 sba_check_pdir(ioc,"Check before sba_unmap_sg_attrs()");
1522 spin_unlock_irqrestore(&ioc->res_lock, flags); 1534 spin_unlock_irqrestore(&ioc->res_lock, flags);
1523#endif 1535#endif
1524 1536
1525 while (nents && sglist->dma_length) { 1537 while (nents && sglist->dma_length) {
1526 1538
1527 sba_unmap_single(dev, sglist->dma_address, sglist->dma_length, dir); 1539 sba_unmap_single_attrs(dev, sglist->dma_address,
1540 sglist->dma_length, dir, attrs);
1528 sglist = sg_next(sglist); 1541 sglist = sg_next(sglist);
1529 nents--; 1542 nents--;
1530 } 1543 }
@@ -1533,11 +1546,12 @@ void sba_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents, in
1533 1546
1534#ifdef ASSERT_PDIR_SANITY 1547#ifdef ASSERT_PDIR_SANITY
1535 spin_lock_irqsave(&ioc->res_lock, flags); 1548 spin_lock_irqsave(&ioc->res_lock, flags);
1536 sba_check_pdir(ioc,"Check after sba_unmap_sg()"); 1549 sba_check_pdir(ioc,"Check after sba_unmap_sg_attrs()");
1537 spin_unlock_irqrestore(&ioc->res_lock, flags); 1550 spin_unlock_irqrestore(&ioc->res_lock, flags);
1538#endif 1551#endif
1539 1552
1540} 1553}
1554EXPORT_SYMBOL(sba_unmap_sg_attrs);
1541 1555
1542/************************************************************** 1556/**************************************************************
1543* 1557*
@@ -1918,15 +1932,13 @@ static const struct file_operations ioc_fops = {
1918static void __init 1932static void __init
1919ioc_proc_init(void) 1933ioc_proc_init(void)
1920{ 1934{
1921 struct proc_dir_entry *dir, *entry; 1935 struct proc_dir_entry *dir;
1922 1936
1923 dir = proc_mkdir("bus/mckinley", NULL); 1937 dir = proc_mkdir("bus/mckinley", NULL);
1924 if (!dir) 1938 if (!dir)
1925 return; 1939 return;
1926 1940
1927 entry = create_proc_entry(ioc_list->name, 0, dir); 1941 proc_create(ioc_list->name, 0, dir, &ioc_fops);
1928 if (entry)
1929 entry->proc_fops = &ioc_fops;
1930} 1942}
1931#endif 1943#endif
1932 1944
@@ -2166,10 +2178,6 @@ sba_page_override(char *str)
2166__setup("sbapagesize=",sba_page_override); 2178__setup("sbapagesize=",sba_page_override);
2167 2179
2168EXPORT_SYMBOL(sba_dma_mapping_error); 2180EXPORT_SYMBOL(sba_dma_mapping_error);
2169EXPORT_SYMBOL(sba_map_single);
2170EXPORT_SYMBOL(sba_unmap_single);
2171EXPORT_SYMBOL(sba_map_sg);
2172EXPORT_SYMBOL(sba_unmap_sg);
2173EXPORT_SYMBOL(sba_dma_supported); 2181EXPORT_SYMBOL(sba_dma_supported);
2174EXPORT_SYMBOL(sba_alloc_coherent); 2182EXPORT_SYMBOL(sba_alloc_coherent);
2175EXPORT_SYMBOL(sba_free_coherent); 2183EXPORT_SYMBOL(sba_free_coherent);
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index eb0c32a85fd7..23cafc80d2a4 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -210,21 +210,23 @@ static void do_softint(struct work_struct *private_)
210 printk(KERN_ERR "simserial: do_softint called\n"); 210 printk(KERN_ERR "simserial: do_softint called\n");
211} 211}
212 212
213static void rs_put_char(struct tty_struct *tty, unsigned char ch) 213static int rs_put_char(struct tty_struct *tty, unsigned char ch)
214{ 214{
215 struct async_struct *info = (struct async_struct *)tty->driver_data; 215 struct async_struct *info = (struct async_struct *)tty->driver_data;
216 unsigned long flags; 216 unsigned long flags;
217 217
218 if (!tty || !info->xmit.buf) return; 218 if (!tty || !info->xmit.buf)
219 return 0;
219 220
220 local_irq_save(flags); 221 local_irq_save(flags);
221 if (CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) == 0) { 222 if (CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) == 0) {
222 local_irq_restore(flags); 223 local_irq_restore(flags);
223 return; 224 return 0;
224 } 225 }
225 info->xmit.buf[info->xmit.head] = ch; 226 info->xmit.buf[info->xmit.head] = ch;
226 info->xmit.head = (info->xmit.head + 1) & (SERIAL_XMIT_SIZE-1); 227 info->xmit.head = (info->xmit.head + 1) & (SERIAL_XMIT_SIZE-1);
227 local_irq_restore(flags); 228 local_irq_restore(flags);
229 return 1;
228} 230}
229 231
230static void transmit_chars(struct async_struct *info, int *intr_done) 232static void transmit_chars(struct async_struct *info, int *intr_done)
@@ -621,7 +623,8 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
621 * the line discipline to only process XON/XOFF characters. 623 * the line discipline to only process XON/XOFF characters.
622 */ 624 */
623 shutdown(info); 625 shutdown(info);
624 if (tty->driver->flush_buffer) tty->driver->flush_buffer(tty); 626 if (tty->ops->flush_buffer)
627 tty->ops->flush_buffer(tty);
625 if (tty->ldisc.flush_buffer) tty->ldisc.flush_buffer(tty); 628 if (tty->ldisc.flush_buffer) tty->ldisc.flush_buffer(tty);
626 info->event = 0; 629 info->event = 0;
627 info->tty = NULL; 630 info->tty = NULL;
diff --git a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c
index 256a7faeda07..b763ca19ef17 100644
--- a/arch/ia64/ia32/ia32_signal.c
+++ b/arch/ia64/ia32/ia32_signal.c
@@ -463,7 +463,7 @@ sys32_sigsuspend (int history0, int history1, old_sigset_t mask)
463 463
464 current->state = TASK_INTERRUPTIBLE; 464 current->state = TASK_INTERRUPTIBLE;
465 schedule(); 465 schedule();
466 set_thread_flag(TIF_RESTORE_SIGMASK); 466 set_restore_sigmask();
467 return -ERESTARTNOHAND; 467 return -ERESTARTNOHAND;
468} 468}
469 469
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index c7467f863c7a..19709a079635 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -966,7 +966,7 @@ acpi_map_iosapics (void)
966fs_initcall(acpi_map_iosapics); 966fs_initcall(acpi_map_iosapics);
967#endif /* CONFIG_ACPI_NUMA */ 967#endif /* CONFIG_ACPI_NUMA */
968 968
969int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) 969int __ref acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
970{ 970{
971 int err; 971 int err;
972 972
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index 230a6f92367f..c64a55af9b95 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -9,7 +9,7 @@
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/pid.h> 10#include <linux/pid.h>
11#include <linux/clocksource.h> 11#include <linux/clocksource.h>
12 12#include <linux/kbuild.h>
13#include <asm-ia64/processor.h> 13#include <asm-ia64/processor.h>
14#include <asm-ia64/ptrace.h> 14#include <asm-ia64/ptrace.h>
15#include <asm-ia64/siginfo.h> 15#include <asm-ia64/siginfo.h>
@@ -19,11 +19,6 @@
19#include "../kernel/sigframe.h" 19#include "../kernel/sigframe.h"
20#include "../kernel/fsyscall_gtod_data.h" 20#include "../kernel/fsyscall_gtod_data.h"
21 21
22#define DEFINE(sym, val) \
23 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
24
25#define BLANK() asm volatile("\n->" : : )
26
27void foo(void) 22void foo(void)
28{ 23{
29 DEFINE(IA64_TASK_SIZE, sizeof (struct task_struct)); 24 DEFINE(IA64_TASK_SIZE, sizeof (struct task_struct));
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 6dee579f205f..7fd18f54c056 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -183,10 +183,10 @@ void fixup_irqs(void)
183{ 183{
184 unsigned int irq; 184 unsigned int irq;
185 extern void ia64_process_pending_intr(void); 185 extern void ia64_process_pending_intr(void);
186 extern void ia64_disable_timer(void);
187 extern volatile int time_keeper_id; 186 extern volatile int time_keeper_id;
188 187
189 ia64_disable_timer(); 188 /* Mask ITV to disable timer */
189 ia64_set_itv(1 << 16);
190 190
191 /* 191 /*
192 * Find a new timesync master 192 * Find a new timesync master
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 396004e8cd14..4547a2092af9 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -1053,7 +1053,7 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
1053 return NOTIFY_OK; 1053 return NOTIFY_OK;
1054} 1054}
1055 1055
1056static struct notifier_block palinfo_cpu_notifier __cpuinitdata = 1056static struct notifier_block __refdata palinfo_cpu_notifier =
1057{ 1057{
1058 .notifier_call = palinfo_cpu_callback, 1058 .notifier_call = palinfo_cpu_callback,
1059 .priority = 0, 1059 .priority = 0,
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index c8e403752a0c..c1ad27de2dd2 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -867,7 +867,7 @@ pfm_rvfree(void *mem, unsigned long size)
867} 867}
868 868
869static pfm_context_t * 869static pfm_context_t *
870pfm_context_alloc(void) 870pfm_context_alloc(int ctx_flags)
871{ 871{
872 pfm_context_t *ctx; 872 pfm_context_t *ctx;
873 873
@@ -878,6 +878,46 @@ pfm_context_alloc(void)
878 ctx = kzalloc(sizeof(pfm_context_t), GFP_KERNEL); 878 ctx = kzalloc(sizeof(pfm_context_t), GFP_KERNEL);
879 if (ctx) { 879 if (ctx) {
880 DPRINT(("alloc ctx @%p\n", ctx)); 880 DPRINT(("alloc ctx @%p\n", ctx));
881
882 /*
883 * init context protection lock
884 */
885 spin_lock_init(&ctx->ctx_lock);
886
887 /*
888 * context is unloaded
889 */
890 ctx->ctx_state = PFM_CTX_UNLOADED;
891
892 /*
893 * initialization of context's flags
894 */
895 ctx->ctx_fl_block = (ctx_flags & PFM_FL_NOTIFY_BLOCK) ? 1 : 0;
896 ctx->ctx_fl_system = (ctx_flags & PFM_FL_SYSTEM_WIDE) ? 1: 0;
897 ctx->ctx_fl_no_msg = (ctx_flags & PFM_FL_OVFL_NO_MSG) ? 1: 0;
898 /*
899 * will move to set properties
900 * ctx->ctx_fl_excl_idle = (ctx_flags & PFM_FL_EXCL_IDLE) ? 1: 0;
901 */
902
903 /*
904 * init restart semaphore to locked
905 */
906 init_completion(&ctx->ctx_restart_done);
907
908 /*
909 * activation is used in SMP only
910 */
911 ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
912 SET_LAST_CPU(ctx, -1);
913
914 /*
915 * initialize notification message queue
916 */
917 ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
918 init_waitqueue_head(&ctx->ctx_msgq_wait);
919 init_waitqueue_head(&ctx->ctx_zombieq);
920
881 } 921 }
882 return ctx; 922 return ctx;
883} 923}
@@ -2165,28 +2205,21 @@ static struct dentry_operations pfmfs_dentry_operations = {
2165}; 2205};
2166 2206
2167 2207
2168static int 2208static struct file *
2169pfm_alloc_fd(struct file **cfile) 2209pfm_alloc_file(pfm_context_t *ctx)
2170{ 2210{
2171 int fd, ret = 0; 2211 struct file *file;
2172 struct file *file = NULL; 2212 struct inode *inode;
2173 struct inode * inode; 2213 struct dentry *dentry;
2174 char name[32]; 2214 char name[32];
2175 struct qstr this; 2215 struct qstr this;
2176 2216
2177 fd = get_unused_fd();
2178 if (fd < 0) return -ENFILE;
2179
2180 ret = -ENFILE;
2181
2182 file = get_empty_filp();
2183 if (!file) goto out;
2184
2185 /* 2217 /*
2186 * allocate a new inode 2218 * allocate a new inode
2187 */ 2219 */
2188 inode = new_inode(pfmfs_mnt->mnt_sb); 2220 inode = new_inode(pfmfs_mnt->mnt_sb);
2189 if (!inode) goto out; 2221 if (!inode)
2222 return ERR_PTR(-ENOMEM);
2190 2223
2191 DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode)); 2224 DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
2192 2225
@@ -2199,59 +2232,28 @@ pfm_alloc_fd(struct file **cfile)
2199 this.len = strlen(name); 2232 this.len = strlen(name);
2200 this.hash = inode->i_ino; 2233 this.hash = inode->i_ino;
2201 2234
2202 ret = -ENOMEM;
2203
2204 /* 2235 /*
2205 * allocate a new dcache entry 2236 * allocate a new dcache entry
2206 */ 2237 */
2207 file->f_path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this); 2238 dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
2208 if (!file->f_path.dentry) goto out; 2239 if (!dentry) {
2240 iput(inode);
2241 return ERR_PTR(-ENOMEM);
2242 }
2209 2243
2210 file->f_path.dentry->d_op = &pfmfs_dentry_operations; 2244 dentry->d_op = &pfmfs_dentry_operations;
2245 d_add(dentry, inode);
2211 2246
2212 d_add(file->f_path.dentry, inode); 2247 file = alloc_file(pfmfs_mnt, dentry, FMODE_READ, &pfm_file_ops);
2213 file->f_path.mnt = mntget(pfmfs_mnt); 2248 if (!file) {
2214 file->f_mapping = inode->i_mapping; 2249 dput(dentry);
2250 return ERR_PTR(-ENFILE);
2251 }
2215 2252
2216 file->f_op = &pfm_file_ops;
2217 file->f_mode = FMODE_READ;
2218 file->f_flags = O_RDONLY; 2253 file->f_flags = O_RDONLY;
2219 file->f_pos = 0; 2254 file->private_data = ctx;
2220
2221 /*
2222 * may have to delay until context is attached?
2223 */
2224 fd_install(fd, file);
2225
2226 /*
2227 * the file structure we will use
2228 */
2229 *cfile = file;
2230
2231 return fd;
2232out:
2233 if (file) put_filp(file);
2234 put_unused_fd(fd);
2235 return ret;
2236}
2237
2238static void
2239pfm_free_fd(int fd, struct file *file)
2240{
2241 struct files_struct *files = current->files;
2242 struct fdtable *fdt;
2243 2255
2244 /* 2256 return file;
2245 * there ie no fd_uninstall(), so we do it here
2246 */
2247 spin_lock(&files->file_lock);
2248 fdt = files_fdtable(files);
2249 rcu_assign_pointer(fdt->fd[fd], NULL);
2250 spin_unlock(&files->file_lock);
2251
2252 if (file)
2253 put_filp(file);
2254 put_unused_fd(fd);
2255} 2257}
2256 2258
2257static int 2259static int
@@ -2475,6 +2477,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t
2475 2477
2476 /* link buffer format and context */ 2478 /* link buffer format and context */
2477 ctx->ctx_buf_fmt = fmt; 2479 ctx->ctx_buf_fmt = fmt;
2480 ctx->ctx_fl_is_sampling = 1; /* assume record() is defined */
2478 2481
2479 /* 2482 /*
2480 * check if buffer format wants to use perfmon buffer allocation/mapping service 2483 * check if buffer format wants to use perfmon buffer allocation/mapping service
@@ -2669,78 +2672,45 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
2669{ 2672{
2670 pfarg_context_t *req = (pfarg_context_t *)arg; 2673 pfarg_context_t *req = (pfarg_context_t *)arg;
2671 struct file *filp; 2674 struct file *filp;
2675 struct path path;
2672 int ctx_flags; 2676 int ctx_flags;
2677 int fd;
2673 int ret; 2678 int ret;
2674 2679
2675 /* let's check the arguments first */ 2680 /* let's check the arguments first */
2676 ret = pfarg_is_sane(current, req); 2681 ret = pfarg_is_sane(current, req);
2677 if (ret < 0) return ret; 2682 if (ret < 0)
2683 return ret;
2678 2684
2679 ctx_flags = req->ctx_flags; 2685 ctx_flags = req->ctx_flags;
2680 2686
2681 ret = -ENOMEM; 2687 ret = -ENOMEM;
2682 2688
2683 ctx = pfm_context_alloc(); 2689 fd = get_unused_fd();
2684 if (!ctx) goto error; 2690 if (fd < 0)
2691 return fd;
2685 2692
2686 ret = pfm_alloc_fd(&filp); 2693 ctx = pfm_context_alloc(ctx_flags);
2687 if (ret < 0) goto error_file; 2694 if (!ctx)
2695 goto error;
2688 2696
2689 req->ctx_fd = ctx->ctx_fd = ret; 2697 filp = pfm_alloc_file(ctx);
2698 if (IS_ERR(filp)) {
2699 ret = PTR_ERR(filp);
2700 goto error_file;
2701 }
2690 2702
2691 /* 2703 req->ctx_fd = ctx->ctx_fd = fd;
2692 * attach context to file
2693 */
2694 filp->private_data = ctx;
2695 2704
2696 /* 2705 /*
2697 * does the user want to sample? 2706 * does the user want to sample?
2698 */ 2707 */
2699 if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) { 2708 if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) {
2700 ret = pfm_setup_buffer_fmt(current, filp, ctx, ctx_flags, 0, req); 2709 ret = pfm_setup_buffer_fmt(current, filp, ctx, ctx_flags, 0, req);
2701 if (ret) goto buffer_error; 2710 if (ret)
2711 goto buffer_error;
2702 } 2712 }
2703 2713
2704 /*
2705 * init context protection lock
2706 */
2707 spin_lock_init(&ctx->ctx_lock);
2708
2709 /*
2710 * context is unloaded
2711 */
2712 ctx->ctx_state = PFM_CTX_UNLOADED;
2713
2714 /*
2715 * initialization of context's flags
2716 */
2717 ctx->ctx_fl_block = (ctx_flags & PFM_FL_NOTIFY_BLOCK) ? 1 : 0;
2718 ctx->ctx_fl_system = (ctx_flags & PFM_FL_SYSTEM_WIDE) ? 1: 0;
2719 ctx->ctx_fl_is_sampling = ctx->ctx_buf_fmt ? 1 : 0; /* assume record() is defined */
2720 ctx->ctx_fl_no_msg = (ctx_flags & PFM_FL_OVFL_NO_MSG) ? 1: 0;
2721 /*
2722 * will move to set properties
2723 * ctx->ctx_fl_excl_idle = (ctx_flags & PFM_FL_EXCL_IDLE) ? 1: 0;
2724 */
2725
2726 /*
2727 * init restart semaphore to locked
2728 */
2729 init_completion(&ctx->ctx_restart_done);
2730
2731 /*
2732 * activation is used in SMP only
2733 */
2734 ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
2735 SET_LAST_CPU(ctx, -1);
2736
2737 /*
2738 * initialize notification message queue
2739 */
2740 ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
2741 init_waitqueue_head(&ctx->ctx_msgq_wait);
2742 init_waitqueue_head(&ctx->ctx_zombieq);
2743
2744 DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d \n", 2714 DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d \n",
2745 ctx, 2715 ctx,
2746 ctx_flags, 2716 ctx_flags,
@@ -2755,10 +2725,14 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
2755 */ 2725 */
2756 pfm_reset_pmu_state(ctx); 2726 pfm_reset_pmu_state(ctx);
2757 2727
2728 fd_install(fd, filp);
2729
2758 return 0; 2730 return 0;
2759 2731
2760buffer_error: 2732buffer_error:
2761 pfm_free_fd(ctx->ctx_fd, filp); 2733 path = filp->f_path;
2734 put_filp(filp);
2735 path_put(&path);
2762 2736
2763 if (ctx->ctx_buf_fmt) { 2737 if (ctx->ctx_buf_fmt) {
2764 pfm_buf_fmt_exit(ctx->ctx_buf_fmt, current, NULL, regs); 2738 pfm_buf_fmt_exit(ctx->ctx_buf_fmt, current, NULL, regs);
@@ -2767,6 +2741,7 @@ error_file:
2767 pfm_context_free(ctx); 2741 pfm_context_free(ctx);
2768 2742
2769error: 2743error:
2744 put_unused_fd(fd);
2770 return ret; 2745 return ret;
2771} 2746}
2772 2747
@@ -6695,16 +6670,12 @@ pfm_init(void)
6695 /* 6670 /*
6696 * create /proc/perfmon (mostly for debugging purposes) 6671 * create /proc/perfmon (mostly for debugging purposes)
6697 */ 6672 */
6698 perfmon_dir = create_proc_entry("perfmon", S_IRUGO, NULL); 6673 perfmon_dir = proc_create("perfmon", S_IRUGO, NULL, &pfm_proc_fops);
6699 if (perfmon_dir == NULL) { 6674 if (perfmon_dir == NULL) {
6700 printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n"); 6675 printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n");
6701 pmu_conf = NULL; 6676 pmu_conf = NULL;
6702 return -1; 6677 return -1;
6703 } 6678 }
6704 /*
6705 * install customized file operations for /proc/perfmon entry
6706 */
6707 perfmon_dir->proc_fops = &pfm_proc_fops;
6708 6679
6709 /* 6680 /*
6710 * create /proc/sys/kernel/perfmon (for debugging purposes) 6681 * create /proc/sys/kernel/perfmon (for debugging purposes)
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index a5ea817cbcbf..58dcfac5ea88 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -183,7 +183,7 @@ do_notify_resume_user (sigset_t *unused, struct sigscratch *scr, long in_syscall
183#endif 183#endif
184 184
185 /* deal with pending signal delivery */ 185 /* deal with pending signal delivery */
186 if (test_thread_flag(TIF_SIGPENDING)||test_thread_flag(TIF_RESTORE_SIGMASK)) 186 if (test_thread_flag(TIF_SIGPENDING))
187 ia64_do_signal(scr, in_syscall); 187 ia64_do_signal(scr, in_syscall);
188 188
189 /* copy user rbs to kernel rbs */ 189 /* copy user rbs to kernel rbs */
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index b11bb50a197a..ecb9eb78d687 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -648,18 +648,16 @@ salinfo_init(void)
648 if (!dir) 648 if (!dir)
649 continue; 649 continue;
650 650
651 entry = create_proc_entry("event", S_IRUSR, dir); 651 entry = proc_create_data("event", S_IRUSR, dir,
652 &salinfo_event_fops, data);
652 if (!entry) 653 if (!entry)
653 continue; 654 continue;
654 entry->data = data;
655 entry->proc_fops = &salinfo_event_fops;
656 *sdir++ = entry; 655 *sdir++ = entry;
657 656
658 entry = create_proc_entry("data", S_IRUSR | S_IWUSR, dir); 657 entry = proc_create_data("data", S_IRUSR | S_IWUSR, dir,
658 &salinfo_data_fops, data);
659 if (!entry) 659 if (!entry)
660 continue; 660 continue;
661 entry->data = data;
662 entry->proc_fops = &salinfo_data_fops;
663 *sdir++ = entry; 661 *sdir++ = entry;
664 662
665 /* we missed any events before now */ 663 /* we missed any events before now */
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 5740296c35af..19c5a78636fc 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -464,7 +464,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
464 if (!user_mode(&scr->pt)) 464 if (!user_mode(&scr->pt))
465 return; 465 return;
466 466
467 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 467 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
468 oldset = &current->saved_sigmask; 468 oldset = &current->saved_sigmask;
469 else 469 else
470 oldset = &current->blocked; 470 oldset = &current->blocked;
@@ -530,12 +530,13 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
530 * continue to iterate in this loop so we can deliver the SIGSEGV... 530 * continue to iterate in this loop so we can deliver the SIGSEGV...
531 */ 531 */
532 if (handle_signal(signr, &ka, &info, oldset, scr)) { 532 if (handle_signal(signr, &ka, &info, oldset, scr)) {
533 /* a signal was successfully delivered; the saved 533 /*
534 * A signal was successfully delivered; the saved
534 * sigmask will have been stored in the signal frame, 535 * sigmask will have been stored in the signal frame,
535 * and will be restored by sigreturn, so we can simply 536 * and will be restored by sigreturn, so we can simply
536 * clear the TIF_RESTORE_SIGMASK flag */ 537 * clear the TS_RESTORE_SIGMASK flag.
537 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 538 */
538 clear_thread_flag(TIF_RESTORE_SIGMASK); 539 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
539 return; 540 return;
540 } 541 }
541 } 542 }
@@ -566,8 +567,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
566 567
567 /* if there's no signal to deliver, we just put the saved sigmask 568 /* if there's no signal to deliver, we just put the saved sigmask
568 * back */ 569 * back */
569 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 570 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
570 clear_thread_flag(TIF_RESTORE_SIGMASK); 571 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
571 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 572 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
572 } 573 }
573} 574}
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index 9a9d4c489330..983296f1c813 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -98,8 +98,33 @@ unlock_ipi_calllock(void)
98 spin_unlock_irq(&call_lock); 98 spin_unlock_irq(&call_lock);
99} 99}
100 100
101static inline void
102handle_call_data(void)
103{
104 struct call_data_struct *data;
105 void (*func)(void *info);
106 void *info;
107 int wait;
108
109 /* release the 'pointer lock' */
110 data = (struct call_data_struct *)call_data;
111 func = data->func;
112 info = data->info;
113 wait = data->wait;
114
115 mb();
116 atomic_inc(&data->started);
117 /* At this point the structure may be gone unless wait is true. */
118 (*func)(info);
119
120 /* Notify the sending CPU that the task is done. */
121 mb();
122 if (wait)
123 atomic_inc(&data->finished);
124}
125
101static void 126static void
102stop_this_cpu (void) 127stop_this_cpu(void)
103{ 128{
104 /* 129 /*
105 * Remove this CPU: 130 * Remove this CPU:
@@ -138,44 +163,21 @@ handle_IPI (int irq, void *dev_id)
138 ops &= ~(1 << which); 163 ops &= ~(1 << which);
139 164
140 switch (which) { 165 switch (which) {
141 case IPI_CALL_FUNC: 166 case IPI_CALL_FUNC:
142 { 167 handle_call_data();
143 struct call_data_struct *data; 168 break;
144 void (*func)(void *info); 169
145 void *info; 170 case IPI_CPU_STOP:
146 int wait;
147
148 /* release the 'pointer lock' */
149 data = (struct call_data_struct *) call_data;
150 func = data->func;
151 info = data->info;
152 wait = data->wait;
153
154 mb();
155 atomic_inc(&data->started);
156 /*
157 * At this point the structure may be gone unless
158 * wait is true.
159 */
160 (*func)(info);
161
162 /* Notify the sending CPU that the task is done. */
163 mb();
164 if (wait)
165 atomic_inc(&data->finished);
166 }
167 break;
168
169 case IPI_CPU_STOP:
170 stop_this_cpu(); 171 stop_this_cpu();
171 break; 172 break;
172#ifdef CONFIG_KEXEC 173#ifdef CONFIG_KEXEC
173 case IPI_KDUMP_CPU_STOP: 174 case IPI_KDUMP_CPU_STOP:
174 unw_init_running(kdump_cpu_freeze, NULL); 175 unw_init_running(kdump_cpu_freeze, NULL);
175 break; 176 break;
176#endif 177#endif
177 default: 178 default:
178 printk(KERN_CRIT "Unknown IPI on CPU %d: %lu\n", this_cpu, which); 179 printk(KERN_CRIT "Unknown IPI on CPU %d: %lu\n",
180 this_cpu, which);
179 break; 181 break;
180 } 182 }
181 } while (ops); 183 } while (ops);
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 16483be18c0b..d7ad42b77d41 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -873,7 +873,8 @@ identify_siblings(struct cpuinfo_ia64 *c)
873 u16 pltid; 873 u16 pltid;
874 pal_logical_to_physical_t info; 874 pal_logical_to_physical_t info;
875 875
876 if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) { 876 status = ia64_pal_logical_to_phys(-1, &info);
877 if (status != PAL_STATUS_SUCCESS) {
877 if (status != PAL_STATUS_UNIMPLEMENTED) { 878 if (status != PAL_STATUS_UNIMPLEMENTED) {
878 printk(KERN_ERR 879 printk(KERN_ERR
879 "ia64_pal_logical_to_phys failed with %ld\n", 880 "ia64_pal_logical_to_phys failed with %ld\n",
@@ -885,8 +886,13 @@ identify_siblings(struct cpuinfo_ia64 *c)
885 info.overview_cpp = 1; 886 info.overview_cpp = 1;
886 info.overview_tpc = 1; 887 info.overview_tpc = 1;
887 } 888 }
888 if ((status = ia64_sal_physical_id_info(&pltid)) != PAL_STATUS_SUCCESS) { 889
889 printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status); 890 status = ia64_sal_physical_id_info(&pltid);
891 if (status != PAL_STATUS_SUCCESS) {
892 if (status != PAL_STATUS_UNIMPLEMENTED)
893 printk(KERN_ERR
894 "ia64_sal_pltid failed with %ld\n",
895 status);
890 return; 896 return;
891 } 897 }
892 898
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 48e15a51782f..8c73643f2d66 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -379,11 +379,6 @@ static struct irqaction timer_irqaction = {
379 .name = "timer" 379 .name = "timer"
380}; 380};
381 381
382void __devinit ia64_disable_timer(void)
383{
384 ia64_set_itv(1 << 16);
385}
386
387void __init 382void __init
388time_init (void) 383time_init (void)
389{ 384{
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index a2484fc1a06c..26228e2d01ae 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -27,9 +27,20 @@
27 27
28static struct ia64_cpu *sysfs_cpus; 28static struct ia64_cpu *sysfs_cpus;
29 29
30int arch_register_cpu(int num) 30void arch_fix_phys_package_id(int num, u32 slot)
31{ 31{
32#if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU) 32#ifdef CONFIG_SMP
33 if (cpu_data(num)->socket_id == -1)
34 cpu_data(num)->socket_id = slot;
35#endif
36}
37EXPORT_SYMBOL_GPL(arch_fix_phys_package_id);
38
39
40#ifdef CONFIG_HOTPLUG_CPU
41int __ref arch_register_cpu(int num)
42{
43#ifdef CONFIG_ACPI
33 /* 44 /*
34 * If CPEI can be re-targetted or if this is not 45 * If CPEI can be re-targetted or if this is not
35 * CPEI target, then it is hotpluggable 46 * CPEI target, then it is hotpluggable
@@ -38,19 +49,21 @@ int arch_register_cpu(int num)
38 sysfs_cpus[num].cpu.hotpluggable = 1; 49 sysfs_cpus[num].cpu.hotpluggable = 1;
39 map_cpu_to_node(num, node_cpuid[num].nid); 50 map_cpu_to_node(num, node_cpuid[num].nid);
40#endif 51#endif
41
42 return register_cpu(&sysfs_cpus[num].cpu, num); 52 return register_cpu(&sysfs_cpus[num].cpu, num);
43} 53}
44 54EXPORT_SYMBOL(arch_register_cpu);
45#ifdef CONFIG_HOTPLUG_CPU
46 55
47void arch_unregister_cpu(int num) 56void arch_unregister_cpu(int num)
48{ 57{
49 unregister_cpu(&sysfs_cpus[num].cpu); 58 unregister_cpu(&sysfs_cpus[num].cpu);
50 unmap_cpu_from_node(num, cpu_to_node(num)); 59 unmap_cpu_from_node(num, cpu_to_node(num));
51} 60}
52EXPORT_SYMBOL(arch_register_cpu);
53EXPORT_SYMBOL(arch_unregister_cpu); 61EXPORT_SYMBOL(arch_unregister_cpu);
62#else
63static int __init arch_register_cpu(int num)
64{
65 return register_cpu(&sysfs_cpus[num].cpu, num);
66}
54#endif /*CONFIG_HOTPLUG_CPU*/ 67#endif /*CONFIG_HOTPLUG_CPU*/
55 68
56 69
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index 2a90c32024f4..e77995a6e3ed 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2001-2006 Silicon Graphics, Inc. All rights reserved. 2 * Copyright (C) 2001-2008 Silicon Graphics, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License 5 * under the terms of version 2 of the GNU General Public License
@@ -177,12 +177,13 @@ failed:
177 * uncached_alloc_page 177 * uncached_alloc_page
178 * 178 *
179 * @starting_nid: node id of node to start with, or -1 179 * @starting_nid: node id of node to start with, or -1
180 * @n_pages: number of contiguous pages to allocate
180 * 181 *
181 * Allocate 1 uncached page. Allocates on the requested node. If no 182 * Allocate the specified number of contiguous uncached pages on the
182 * uncached pages are available on the requested node, roundrobin starting 183 * the requested node. If not enough contiguous uncached pages are available
183 * with the next higher node. 184 * on the requested node, roundrobin starting with the next higher node.
184 */ 185 */
185unsigned long uncached_alloc_page(int starting_nid) 186unsigned long uncached_alloc_page(int starting_nid, int n_pages)
186{ 187{
187 unsigned long uc_addr; 188 unsigned long uc_addr;
188 struct uncached_pool *uc_pool; 189 struct uncached_pool *uc_pool;
@@ -202,7 +203,8 @@ unsigned long uncached_alloc_page(int starting_nid)
202 if (uc_pool->pool == NULL) 203 if (uc_pool->pool == NULL)
203 continue; 204 continue;
204 do { 205 do {
205 uc_addr = gen_pool_alloc(uc_pool->pool, PAGE_SIZE); 206 uc_addr = gen_pool_alloc(uc_pool->pool,
207 n_pages * PAGE_SIZE);
206 if (uc_addr != 0) 208 if (uc_addr != 0)
207 return uc_addr; 209 return uc_addr;
208 } while (uncached_add_chunk(uc_pool, nid) == 0); 210 } while (uncached_add_chunk(uc_pool, nid) == 0);
@@ -217,11 +219,12 @@ EXPORT_SYMBOL(uncached_alloc_page);
217/* 219/*
218 * uncached_free_page 220 * uncached_free_page
219 * 221 *
220 * @uc_addr: uncached address of page to free 222 * @uc_addr: uncached address of first page to free
223 * @n_pages: number of contiguous pages to free
221 * 224 *
222 * Free a single uncached page. 225 * Free the specified number of uncached pages.
223 */ 226 */
224void uncached_free_page(unsigned long uc_addr) 227void uncached_free_page(unsigned long uc_addr, int n_pages)
225{ 228{
226 int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET); 229 int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET);
227 struct gen_pool *pool = uncached_pools[nid].pool; 230 struct gen_pool *pool = uncached_pools[nid].pool;
@@ -232,7 +235,7 @@ void uncached_free_page(unsigned long uc_addr)
232 if ((uc_addr & (0XFUL << 60)) != __IA64_UNCACHED_OFFSET) 235 if ((uc_addr & (0XFUL << 60)) != __IA64_UNCACHED_OFFSET)
233 panic("uncached_free_page invalid address %lx\n", uc_addr); 236 panic("uncached_free_page invalid address %lx\n", uc_addr);
234 237
235 gen_pool_free(pool, uc_addr, PAGE_SIZE); 238 gen_pool_free(pool, uc_addr, n_pages * PAGE_SIZE);
236} 239}
237EXPORT_SYMBOL(uncached_free_page); 240EXPORT_SYMBOL(uncached_free_page);
238 241
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 6df073240135..318b81100623 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * kvm_ia64.c: Basic KVM suppport On Itanium series processors 2 * kvm_ia64.c: Basic KVM suppport On Itanium series processors
4 * 3 *
@@ -431,7 +430,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu)
431 if (itc_diff < 0) 430 if (itc_diff < 0)
432 itc_diff = -itc_diff; 431 itc_diff = -itc_diff;
433 432
434 expires = div64_64(itc_diff, cyc_per_usec); 433 expires = div64_u64(itc_diff, cyc_per_usec);
435 kt = ktime_set(0, 1000 * expires); 434 kt = ktime_set(0, 1000 * expires);
436 vcpu->arch.ht_active = 1; 435 vcpu->arch.ht_active = 1;
437 hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS); 436 hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS);
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index d52ec4e83409..8caf42471f0d 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -168,7 +168,10 @@ setup_ptcg_sem(int max_purges, int nptcg_from)
168 static int firstcpu = 1; 168 static int firstcpu = 1;
169 169
170 if (toolatetochangeptcgsem) { 170 if (toolatetochangeptcgsem) {
171 BUG_ON(max_purges < nptcg); 171 if (nptcg_from == NPTCG_FROM_PAL && max_purges == 0)
172 BUG_ON(1 < nptcg);
173 else
174 BUG_ON(max_purges < nptcg);
172 return; 175 return;
173 } 176 }
174 177
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index dfc6bf1c7b41..49d3120415eb 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -550,11 +550,12 @@ static int __init sn2_ptc_init(void)
550 if (!ia64_platform_is("sn2")) 550 if (!ia64_platform_is("sn2"))
551 return 0; 551 return 0;
552 552
553 if (!(proc_sn2_ptc = create_proc_entry(PTC_BASENAME, 0444, NULL))) { 553 proc_sn2_ptc = proc_create(PTC_BASENAME, 0444,
554 NULL, &proc_sn2_ptc_operations);
555 if (!&proc_sn2_ptc_operations) {
554 printk(KERN_ERR "unable to create %s proc entry", PTC_BASENAME); 556 printk(KERN_ERR "unable to create %s proc entry", PTC_BASENAME);
555 return -EINVAL; 557 return -EINVAL;
556 } 558 }
557 proc_sn2_ptc->proc_fops = &proc_sn2_ptc_operations;
558 spin_lock_init(&sn2_global_ptc_lock); 559 spin_lock_init(&sn2_global_ptc_lock);
559 return 0; 560 return 0;
560} 561}
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index 62b3e9a496ac..2526e5c783a4 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -139,30 +139,21 @@ static const struct file_operations proc_sn_topo_fops = {
139void register_sn_procfs(void) 139void register_sn_procfs(void)
140{ 140{
141 static struct proc_dir_entry *sgi_proc_dir = NULL; 141 static struct proc_dir_entry *sgi_proc_dir = NULL;
142 struct proc_dir_entry *pde;
143 142
144 BUG_ON(sgi_proc_dir != NULL); 143 BUG_ON(sgi_proc_dir != NULL);
145 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) 144 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))
146 return; 145 return;
147 146
148 pde = create_proc_entry("partition_id", 0444, sgi_proc_dir); 147 proc_create("partition_id", 0444, sgi_proc_dir,
149 if (pde) 148 &proc_partition_id_fops);
150 pde->proc_fops = &proc_partition_id_fops; 149 proc_create("system_serial_number", 0444, sgi_proc_dir,
151 pde = create_proc_entry("system_serial_number", 0444, sgi_proc_dir); 150 &proc_system_sn_fops);
152 if (pde) 151 proc_create("licenseID", 0444, sgi_proc_dir, &proc_license_id_fops);
153 pde->proc_fops = &proc_system_sn_fops; 152 proc_create("sn_force_interrupt", 0644, sgi_proc_dir,
154 pde = create_proc_entry("licenseID", 0444, sgi_proc_dir); 153 &proc_sn_force_intr_fops);
155 if (pde) 154 proc_create("coherence_id", 0444, sgi_proc_dir,
156 pde->proc_fops = &proc_license_id_fops; 155 &proc_coherence_id_fops);
157 pde = create_proc_entry("sn_force_interrupt", 0644, sgi_proc_dir); 156 proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops);
158 if (pde)
159 pde->proc_fops = &proc_sn_force_intr_fops;
160 pde = create_proc_entry("coherence_id", 0444, sgi_proc_dir);
161 if (pde)
162 pde->proc_fops = &proc_coherence_id_fops;
163 pde = create_proc_entry("sn_topology", 0444, sgi_proc_dir);
164 if (pde)
165 pde->proc_fops = &proc_sn_topo_fops;
166} 157}
167 158
168#endif /* CONFIG_PROC_FS */ 159#endif /* CONFIG_PROC_FS */
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 18b94b792d54..52175af299a0 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/dma-attrs.h>
13#include <asm/dma.h> 14#include <asm/dma.h>
14#include <asm/sn/intr.h> 15#include <asm/sn/intr.h>
15#include <asm/sn/pcibus_provider_defs.h> 16#include <asm/sn/pcibus_provider_defs.h>
@@ -149,11 +150,12 @@ void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
149EXPORT_SYMBOL(sn_dma_free_coherent); 150EXPORT_SYMBOL(sn_dma_free_coherent);
150 151
151/** 152/**
152 * sn_dma_map_single - map a single page for DMA 153 * sn_dma_map_single_attrs - map a single page for DMA
153 * @dev: device to map for 154 * @dev: device to map for
154 * @cpu_addr: kernel virtual address of the region to map 155 * @cpu_addr: kernel virtual address of the region to map
155 * @size: size of the region 156 * @size: size of the region
156 * @direction: DMA direction 157 * @direction: DMA direction
158 * @attrs: optional dma attributes
157 * 159 *
158 * Map the region pointed to by @cpu_addr for DMA and return the 160 * Map the region pointed to by @cpu_addr for DMA and return the
159 * DMA address. 161 * DMA address.
@@ -163,42 +165,59 @@ EXPORT_SYMBOL(sn_dma_free_coherent);
163 * no way of saving the dmamap handle from the alloc to later free 165 * no way of saving the dmamap handle from the alloc to later free
164 * (which is pretty much unacceptable). 166 * (which is pretty much unacceptable).
165 * 167 *
168 * mappings with the DMA_ATTR_WRITE_BARRIER get mapped with
169 * dma_map_consistent() so that writes force a flush of pending DMA.
170 * (See "SGI Altix Architecture Considerations for Linux Device Drivers",
171 * Document Number: 007-4763-001)
172 *
166 * TODO: simplify our interface; 173 * TODO: simplify our interface;
167 * figure out how to save dmamap handle so can use two step. 174 * figure out how to save dmamap handle so can use two step.
168 */ 175 */
169dma_addr_t sn_dma_map_single(struct device *dev, void *cpu_addr, size_t size, 176dma_addr_t sn_dma_map_single_attrs(struct device *dev, void *cpu_addr,
170 int direction) 177 size_t size, int direction,
178 struct dma_attrs *attrs)
171{ 179{
172 dma_addr_t dma_addr; 180 dma_addr_t dma_addr;
173 unsigned long phys_addr; 181 unsigned long phys_addr;
174 struct pci_dev *pdev = to_pci_dev(dev); 182 struct pci_dev *pdev = to_pci_dev(dev);
175 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 183 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
184 int dmabarr;
185
186 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
176 187
177 BUG_ON(dev->bus != &pci_bus_type); 188 BUG_ON(dev->bus != &pci_bus_type);
178 189
179 phys_addr = __pa(cpu_addr); 190 phys_addr = __pa(cpu_addr);
180 dma_addr = provider->dma_map(pdev, phys_addr, size, SN_DMA_ADDR_PHYS); 191 if (dmabarr)
192 dma_addr = provider->dma_map_consistent(pdev, phys_addr,
193 size, SN_DMA_ADDR_PHYS);
194 else
195 dma_addr = provider->dma_map(pdev, phys_addr, size,
196 SN_DMA_ADDR_PHYS);
197
181 if (!dma_addr) { 198 if (!dma_addr) {
182 printk(KERN_ERR "%s: out of ATEs\n", __func__); 199 printk(KERN_ERR "%s: out of ATEs\n", __func__);
183 return 0; 200 return 0;
184 } 201 }
185 return dma_addr; 202 return dma_addr;
186} 203}
187EXPORT_SYMBOL(sn_dma_map_single); 204EXPORT_SYMBOL(sn_dma_map_single_attrs);
188 205
189/** 206/**
190 * sn_dma_unmap_single - unamp a DMA mapped page 207 * sn_dma_unmap_single_attrs - unamp a DMA mapped page
191 * @dev: device to sync 208 * @dev: device to sync
192 * @dma_addr: DMA address to sync 209 * @dma_addr: DMA address to sync
193 * @size: size of region 210 * @size: size of region
194 * @direction: DMA direction 211 * @direction: DMA direction
212 * @attrs: optional dma attributes
195 * 213 *
196 * This routine is supposed to sync the DMA region specified 214 * This routine is supposed to sync the DMA region specified
197 * by @dma_handle into the coherence domain. On SN, we're always cache 215 * by @dma_handle into the coherence domain. On SN, we're always cache
198 * coherent, so we just need to free any ATEs associated with this mapping. 216 * coherent, so we just need to free any ATEs associated with this mapping.
199 */ 217 */
200void sn_dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 218void sn_dma_unmap_single_attrs(struct device *dev, dma_addr_t dma_addr,
201 int direction) 219 size_t size, int direction,
220 struct dma_attrs *attrs)
202{ 221{
203 struct pci_dev *pdev = to_pci_dev(dev); 222 struct pci_dev *pdev = to_pci_dev(dev);
204 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 223 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
@@ -207,19 +226,21 @@ void sn_dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
207 226
208 provider->dma_unmap(pdev, dma_addr, direction); 227 provider->dma_unmap(pdev, dma_addr, direction);
209} 228}
210EXPORT_SYMBOL(sn_dma_unmap_single); 229EXPORT_SYMBOL(sn_dma_unmap_single_attrs);
211 230
212/** 231/**
213 * sn_dma_unmap_sg - unmap a DMA scatterlist 232 * sn_dma_unmap_sg_attrs - unmap a DMA scatterlist
214 * @dev: device to unmap 233 * @dev: device to unmap
215 * @sg: scatterlist to unmap 234 * @sg: scatterlist to unmap
216 * @nhwentries: number of scatterlist entries 235 * @nhwentries: number of scatterlist entries
217 * @direction: DMA direction 236 * @direction: DMA direction
237 * @attrs: optional dma attributes
218 * 238 *
219 * Unmap a set of streaming mode DMA translations. 239 * Unmap a set of streaming mode DMA translations.
220 */ 240 */
221void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sgl, 241void sn_dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sgl,
222 int nhwentries, int direction) 242 int nhwentries, int direction,
243 struct dma_attrs *attrs)
223{ 244{
224 int i; 245 int i;
225 struct pci_dev *pdev = to_pci_dev(dev); 246 struct pci_dev *pdev = to_pci_dev(dev);
@@ -234,25 +255,34 @@ void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
234 sg->dma_length = 0; 255 sg->dma_length = 0;
235 } 256 }
236} 257}
237EXPORT_SYMBOL(sn_dma_unmap_sg); 258EXPORT_SYMBOL(sn_dma_unmap_sg_attrs);
238 259
239/** 260/**
240 * sn_dma_map_sg - map a scatterlist for DMA 261 * sn_dma_map_sg_attrs - map a scatterlist for DMA
241 * @dev: device to map for 262 * @dev: device to map for
242 * @sg: scatterlist to map 263 * @sg: scatterlist to map
243 * @nhwentries: number of entries 264 * @nhwentries: number of entries
244 * @direction: direction of the DMA transaction 265 * @direction: direction of the DMA transaction
266 * @attrs: optional dma attributes
267 *
268 * mappings with the DMA_ATTR_WRITE_BARRIER get mapped with
269 * dma_map_consistent() so that writes force a flush of pending DMA.
270 * (See "SGI Altix Architecture Considerations for Linux Device Drivers",
271 * Document Number: 007-4763-001)
245 * 272 *
246 * Maps each entry of @sg for DMA. 273 * Maps each entry of @sg for DMA.
247 */ 274 */
248int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl, int nhwentries, 275int sn_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
249 int direction) 276 int nhwentries, int direction, struct dma_attrs *attrs)
250{ 277{
251 unsigned long phys_addr; 278 unsigned long phys_addr;
252 struct scatterlist *saved_sg = sgl, *sg; 279 struct scatterlist *saved_sg = sgl, *sg;
253 struct pci_dev *pdev = to_pci_dev(dev); 280 struct pci_dev *pdev = to_pci_dev(dev);
254 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 281 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
255 int i; 282 int i;
283 int dmabarr;
284
285 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
256 286
257 BUG_ON(dev->bus != &pci_bus_type); 287 BUG_ON(dev->bus != &pci_bus_type);
258 288
@@ -260,11 +290,19 @@ int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl, int nhwentries,
260 * Setup a DMA address for each entry in the scatterlist. 290 * Setup a DMA address for each entry in the scatterlist.
261 */ 291 */
262 for_each_sg(sgl, sg, nhwentries, i) { 292 for_each_sg(sgl, sg, nhwentries, i) {
293 dma_addr_t dma_addr;
263 phys_addr = SG_ENT_PHYS_ADDRESS(sg); 294 phys_addr = SG_ENT_PHYS_ADDRESS(sg);
264 sg->dma_address = provider->dma_map(pdev, 295 if (dmabarr)
265 phys_addr, sg->length, 296 dma_addr = provider->dma_map_consistent(pdev,
266 SN_DMA_ADDR_PHYS); 297 phys_addr,
298 sg->length,
299 SN_DMA_ADDR_PHYS);
300 else
301 dma_addr = provider->dma_map(pdev, phys_addr,
302 sg->length,
303 SN_DMA_ADDR_PHYS);
267 304
305 sg->dma_address = dma_addr;
268 if (!sg->dma_address) { 306 if (!sg->dma_address) {
269 printk(KERN_ERR "%s: out of ATEs\n", __func__); 307 printk(KERN_ERR "%s: out of ATEs\n", __func__);
270 308
@@ -272,7 +310,8 @@ int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl, int nhwentries,
272 * Free any successfully allocated entries. 310 * Free any successfully allocated entries.
273 */ 311 */
274 if (i > 0) 312 if (i > 0)
275 sn_dma_unmap_sg(dev, saved_sg, i, direction); 313 sn_dma_unmap_sg_attrs(dev, saved_sg, i,
314 direction, attrs);
276 return 0; 315 return 0;
277 } 316 }
278 317
@@ -281,7 +320,7 @@ int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl, int nhwentries,
281 320
282 return nhwentries; 321 return nhwentries;
283} 322}
284EXPORT_SYMBOL(sn_dma_map_sg); 323EXPORT_SYMBOL(sn_dma_map_sg_attrs);
285 324
286void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, 325void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
287 size_t size, int direction) 326 size_t size, int direction)
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index 4072a07ebf8e..469766b24e22 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -5,6 +5,8 @@
5# architecture-specific flags and dependencies. 5# architecture-specific flags and dependencies.
6# 6#
7 7
8KBUILD_DEFCONFIG := m32700ut.smp_defconfig
9
8LDFLAGS := 10LDFLAGS :=
9OBJCOPYFLAGS := -O binary -R .note -R .comment -S 11OBJCOPYFLAGS := -O binary -R .note -R .comment -S
10LDFLAGS_vmlinux := 12LDFLAGS_vmlinux :=
diff --git a/arch/m32r/defconfig b/arch/m32r/defconfig
deleted file mode 100644
index af3b98179113..000000000000
--- a/arch/m32r/defconfig
+++ /dev/null
@@ -1,863 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc1
4# Wed Aug 1 17:22:35 2007
5#
6CONFIG_M32R=y
7CONFIG_GENERIC_ISA_DMA=y
8CONFIG_ZONE_DMA=y
9CONFIG_GENERIC_HARDIRQS=y
10CONFIG_GENERIC_IRQ_PROBE=y
11CONFIG_NO_IOPORT=y
12CONFIG_NO_DMA=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_LOCK_KERNEL=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y
27CONFIG_SWAP=y
28CONFIG_SYSVIPC=y
29CONFIG_SYSVIPC_SYSCTL=y
30# CONFIG_POSIX_MQUEUE is not set
31CONFIG_BSD_PROCESS_ACCT=y
32# CONFIG_BSD_PROCESS_ACCT_V3 is not set
33# CONFIG_TASKSTATS is not set
34# CONFIG_USER_NS is not set
35# CONFIG_AUDIT is not set
36CONFIG_IKCONFIG=y
37CONFIG_IKCONFIG_PROC=y
38CONFIG_LOG_BUF_SHIFT=15
39# CONFIG_CPUSETS is not set
40CONFIG_SYSFS_DEPRECATED=y
41# CONFIG_RELAY is not set
42# CONFIG_BLK_DEV_INITRD is not set
43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
44CONFIG_SYSCTL=y
45CONFIG_EMBEDDED=y
46CONFIG_SYSCTL_SYSCALL=y
47# CONFIG_KALLSYMS is not set
48CONFIG_HOTPLUG=y
49CONFIG_PRINTK=y
50CONFIG_BUG=y
51CONFIG_ELF_CORE=y
52CONFIG_BASE_FULL=y
53# CONFIG_FUTEX is not set
54CONFIG_ANON_INODES=y
55# CONFIG_EPOLL is not set
56CONFIG_SIGNALFD=y
57CONFIG_TIMERFD=y
58CONFIG_EVENTFD=y
59CONFIG_SHMEM=y
60CONFIG_VM_EVENT_COUNTERS=y
61CONFIG_SLAB=y
62# CONFIG_SLUB is not set
63# CONFIG_SLOB is not set
64# CONFIG_TINY_SHMEM is not set
65CONFIG_BASE_SMALL=0
66CONFIG_MODULES=y
67CONFIG_MODULE_UNLOAD=y
68# CONFIG_MODULE_FORCE_UNLOAD is not set
69# CONFIG_MODVERSIONS is not set
70# CONFIG_MODULE_SRCVERSION_ALL is not set
71CONFIG_KMOD=y
72CONFIG_STOP_MACHINE=y
73CONFIG_BLOCK=y
74# CONFIG_LBD is not set
75# CONFIG_BLK_DEV_IO_TRACE is not set
76# CONFIG_LSF is not set
77# CONFIG_BLK_DEV_BSG is not set
78
79#
80# IO Schedulers
81#
82CONFIG_IOSCHED_NOOP=y
83# CONFIG_IOSCHED_AS is not set
84CONFIG_IOSCHED_DEADLINE=y
85CONFIG_IOSCHED_CFQ=y
86# CONFIG_DEFAULT_AS is not set
87# CONFIG_DEFAULT_DEADLINE is not set
88CONFIG_DEFAULT_CFQ=y
89# CONFIG_DEFAULT_NOOP is not set
90CONFIG_DEFAULT_IOSCHED="cfq"
91
92#
93# Processor type and features
94#
95# CONFIG_PLAT_MAPPI is not set
96# CONFIG_PLAT_USRV is not set
97CONFIG_PLAT_M32700UT=y
98# CONFIG_PLAT_OPSPUT is not set
99# CONFIG_PLAT_OAKS32R is not set
100# CONFIG_PLAT_MAPPI2 is not set
101# CONFIG_PLAT_MAPPI3 is not set
102# CONFIG_PLAT_M32104UT is not set
103CONFIG_CHIP_M32700=y
104# CONFIG_CHIP_M32102 is not set
105# CONFIG_CHIP_M32104 is not set
106# CONFIG_CHIP_VDEC2 is not set
107# CONFIG_CHIP_OPSP is not set
108CONFIG_MMU=y
109CONFIG_TLB_ENTRIES=32
110CONFIG_ISA_M32R2=y
111CONFIG_ISA_DSP_LEVEL2=y
112CONFIG_ISA_DUAL_ISSUE=y
113CONFIG_BUS_CLOCK=50000000
114CONFIG_TIMER_DIVIDE=128
115# CONFIG_CPU_LITTLE_ENDIAN is not set
116CONFIG_MEMORY_START=0x08000000
117CONFIG_MEMORY_SIZE=0x01000000
118CONFIG_NOHIGHMEM=y
119CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
120CONFIG_SELECT_MEMORY_MODEL=y
121# CONFIG_FLATMEM_MANUAL is not set
122CONFIG_DISCONTIGMEM_MANUAL=y
123# CONFIG_SPARSEMEM_MANUAL is not set
124CONFIG_DISCONTIGMEM=y
125CONFIG_FLAT_NODE_MEM_MAP=y
126CONFIG_NEED_MULTIPLE_NODES=y
127# CONFIG_SPARSEMEM_STATIC is not set
128CONFIG_SPLIT_PTLOCK_CPUS=4
129# CONFIG_RESOURCES_64BIT is not set
130CONFIG_ZONE_DMA_FLAG=1
131CONFIG_BOUNCE=y
132CONFIG_VIRT_TO_BUS=y
133CONFIG_IRAM_START=0x00f00000
134CONFIG_IRAM_SIZE=0x00080000
135CONFIG_RWSEM_GENERIC_SPINLOCK=y
136# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
137# CONFIG_ARCH_HAS_ILOG2_U32 is not set
138# CONFIG_ARCH_HAS_ILOG2_U64 is not set
139CONFIG_GENERIC_FIND_NEXT_BIT=y
140CONFIG_GENERIC_HWEIGHT=y
141CONFIG_GENERIC_CALIBRATE_DELAY=y
142CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
143CONFIG_PREEMPT=y
144CONFIG_SMP=y
145# CONFIG_CHIP_M32700_TS1 is not set
146CONFIG_NR_CPUS=2
147CONFIG_NODES_SHIFT=1
148
149#
150# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
151#
152# CONFIG_ARCH_SUPPORTS_MSI is not set
153# CONFIG_ISA is not set
154
155#
156# PCCARD (PCMCIA/CardBus) support
157#
158# CONFIG_PCCARD is not set
159
160#
161# Executable file formats
162#
163CONFIG_BINFMT_ELF=y
164# CONFIG_BINFMT_MISC is not set
165
166#
167# Networking
168#
169CONFIG_NET=y
170
171#
172# Networking options
173#
174CONFIG_PACKET=y
175# CONFIG_PACKET_MMAP is not set
176CONFIG_UNIX=y
177CONFIG_XFRM=y
178# CONFIG_XFRM_USER is not set
179# CONFIG_XFRM_SUB_POLICY is not set
180# CONFIG_XFRM_MIGRATE is not set
181# CONFIG_NET_KEY is not set
182CONFIG_INET=y
183# CONFIG_IP_MULTICAST is not set
184# CONFIG_IP_ADVANCED_ROUTER is not set
185CONFIG_IP_FIB_HASH=y
186CONFIG_IP_PNP=y
187CONFIG_IP_PNP_DHCP=y
188# CONFIG_IP_PNP_BOOTP is not set
189# CONFIG_IP_PNP_RARP is not set
190# CONFIG_NET_IPIP is not set
191# CONFIG_NET_IPGRE is not set
192# CONFIG_ARPD is not set
193# CONFIG_SYN_COOKIES is not set
194# CONFIG_INET_AH is not set
195# CONFIG_INET_ESP is not set
196# CONFIG_INET_IPCOMP is not set
197# CONFIG_INET_XFRM_TUNNEL is not set
198# CONFIG_INET_TUNNEL is not set
199CONFIG_INET_XFRM_MODE_TRANSPORT=y
200CONFIG_INET_XFRM_MODE_TUNNEL=y
201CONFIG_INET_XFRM_MODE_BEET=y
202CONFIG_INET_DIAG=y
203CONFIG_INET_TCP_DIAG=y
204# CONFIG_TCP_CONG_ADVANCED is not set
205CONFIG_TCP_CONG_CUBIC=y
206CONFIG_DEFAULT_TCP_CONG="cubic"
207# CONFIG_TCP_MD5SIG is not set
208# CONFIG_IPV6 is not set
209# CONFIG_INET6_XFRM_TUNNEL is not set
210# CONFIG_INET6_TUNNEL is not set
211# CONFIG_NETWORK_SECMARK is not set
212# CONFIG_NETFILTER is not set
213# CONFIG_IP_DCCP is not set
214# CONFIG_IP_SCTP is not set
215# CONFIG_TIPC is not set
216# CONFIG_ATM is not set
217# CONFIG_BRIDGE is not set
218# CONFIG_VLAN_8021Q is not set
219# CONFIG_DECNET is not set
220# CONFIG_LLC2 is not set
221# CONFIG_IPX is not set
222# CONFIG_ATALK is not set
223# CONFIG_X25 is not set
224# CONFIG_LAPB is not set
225# CONFIG_ECONET is not set
226# CONFIG_WAN_ROUTER is not set
227
228#
229# QoS and/or fair queueing
230#
231# CONFIG_NET_SCHED is not set
232
233#
234# Network testing
235#
236# CONFIG_NET_PKTGEN is not set
237# CONFIG_HAMRADIO is not set
238# CONFIG_IRDA is not set
239# CONFIG_BT is not set
240# CONFIG_AF_RXRPC is not set
241
242#
243# Wireless
244#
245# CONFIG_CFG80211 is not set
246# CONFIG_WIRELESS_EXT is not set
247# CONFIG_MAC80211 is not set
248# CONFIG_IEEE80211 is not set
249# CONFIG_RFKILL is not set
250# CONFIG_NET_9P is not set
251
252#
253# Device Drivers
254#
255
256#
257# Generic Driver Options
258#
259CONFIG_STANDALONE=y
260CONFIG_PREVENT_FIRMWARE_BUILD=y
261CONFIG_FW_LOADER=y
262# CONFIG_SYS_HYPERVISOR is not set
263# CONFIG_CONNECTOR is not set
264CONFIG_MTD=y
265# CONFIG_MTD_DEBUG is not set
266# CONFIG_MTD_CONCAT is not set
267CONFIG_MTD_PARTITIONS=y
268CONFIG_MTD_REDBOOT_PARTS=y
269CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
270# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
271# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
272# CONFIG_MTD_CMDLINE_PARTS is not set
273
274#
275# User Modules And Translation Layers
276#
277# CONFIG_MTD_CHAR is not set
278CONFIG_MTD_BLKDEVS=y
279CONFIG_MTD_BLOCK=y
280# CONFIG_FTL is not set
281# CONFIG_NFTL is not set
282# CONFIG_INFTL is not set
283# CONFIG_RFD_FTL is not set
284# CONFIG_SSFDC is not set
285
286#
287# RAM/ROM/Flash chip drivers
288#
289CONFIG_MTD_CFI=m
290CONFIG_MTD_JEDECPROBE=m
291CONFIG_MTD_GEN_PROBE=m
292CONFIG_MTD_CFI_ADV_OPTIONS=y
293# CONFIG_MTD_CFI_NOSWAP is not set
294CONFIG_MTD_CFI_BE_BYTE_SWAP=y
295# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
296CONFIG_MTD_CFI_GEOMETRY=y
297CONFIG_MTD_MAP_BANK_WIDTH_1=y
298CONFIG_MTD_MAP_BANK_WIDTH_2=y
299CONFIG_MTD_MAP_BANK_WIDTH_4=y
300# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
301# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
302# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
303CONFIG_MTD_CFI_I1=y
304# CONFIG_MTD_CFI_I2 is not set
305# CONFIG_MTD_CFI_I4 is not set
306# CONFIG_MTD_CFI_I8 is not set
307# CONFIG_MTD_OTP is not set
308# CONFIG_MTD_CFI_INTELEXT is not set
309CONFIG_MTD_CFI_AMDSTD=m
310# CONFIG_MTD_CFI_STAA is not set
311CONFIG_MTD_CFI_UTIL=m
312# CONFIG_MTD_RAM is not set
313# CONFIG_MTD_ROM is not set
314# CONFIG_MTD_ABSENT is not set
315
316#
317# Mapping drivers for chip access
318#
319# CONFIG_MTD_COMPLEX_MAPPINGS is not set
320# CONFIG_MTD_PHYSMAP is not set
321# CONFIG_MTD_PLATRAM is not set
322
323#
324# Self-contained MTD device drivers
325#
326# CONFIG_MTD_SLRAM is not set
327# CONFIG_MTD_PHRAM is not set
328# CONFIG_MTD_MTDRAM is not set
329# CONFIG_MTD_BLOCK2MTD is not set
330
331#
332# Disk-On-Chip Device Drivers
333#
334# CONFIG_MTD_DOC2000 is not set
335# CONFIG_MTD_DOC2001 is not set
336# CONFIG_MTD_DOC2001PLUS is not set
337# CONFIG_MTD_NAND is not set
338# CONFIG_MTD_ONENAND is not set
339
340#
341# UBI - Unsorted block images
342#
343# CONFIG_MTD_UBI is not set
344# CONFIG_PARPORT is not set
345CONFIG_BLK_DEV=y
346# CONFIG_BLK_DEV_COW_COMMON is not set
347CONFIG_BLK_DEV_LOOP=y
348# CONFIG_BLK_DEV_CRYPTOLOOP is not set
349CONFIG_BLK_DEV_NBD=y
350CONFIG_BLK_DEV_RAM=y
351CONFIG_BLK_DEV_RAM_COUNT=16
352CONFIG_BLK_DEV_RAM_SIZE=4096
353CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
354# CONFIG_CDROM_PKTCDVD is not set
355CONFIG_ATA_OVER_ETH=m
356CONFIG_MISC_DEVICES=y
357# CONFIG_EEPROM_93CX6 is not set
358CONFIG_IDE=y
359CONFIG_IDE_MAX_HWIFS=4
360CONFIG_BLK_DEV_IDE=y
361
362#
363# Please see Documentation/ide.txt for help/info on IDE drives
364#
365# CONFIG_BLK_DEV_IDE_SATA is not set
366CONFIG_BLK_DEV_IDEDISK=y
367# CONFIG_IDEDISK_MULTI_MODE is not set
368CONFIG_BLK_DEV_IDECD=m
369# CONFIG_BLK_DEV_IDETAPE is not set
370# CONFIG_BLK_DEV_IDEFLOPPY is not set
371# CONFIG_BLK_DEV_IDESCSI is not set
372# CONFIG_IDE_TASK_IOCTL is not set
373CONFIG_IDE_PROC_FS=y
374
375#
376# IDE chipset support/bugfixes
377#
378CONFIG_IDE_GENERIC=y
379# CONFIG_IDEPCI_PCIBUS_ORDER is not set
380# CONFIG_IDE_ARM is not set
381# CONFIG_BLK_DEV_IDEDMA is not set
382# CONFIG_BLK_DEV_HD is not set
383
384#
385# SCSI device support
386#
387# CONFIG_RAID_ATTRS is not set
388CONFIG_SCSI=m
389# CONFIG_SCSI_DMA is not set
390# CONFIG_SCSI_TGT is not set
391# CONFIG_SCSI_NETLINK is not set
392CONFIG_SCSI_PROC_FS=y
393
394#
395# SCSI support type (disk, tape, CD-ROM)
396#
397CONFIG_BLK_DEV_SD=m
398# CONFIG_CHR_DEV_ST is not set
399# CONFIG_CHR_DEV_OSST is not set
400CONFIG_BLK_DEV_SR=m
401# CONFIG_BLK_DEV_SR_VENDOR is not set
402CONFIG_CHR_DEV_SG=m
403# CONFIG_CHR_DEV_SCH is not set
404
405#
406# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
407#
408CONFIG_SCSI_MULTI_LUN=y
409# CONFIG_SCSI_CONSTANTS is not set
410# CONFIG_SCSI_LOGGING is not set
411# CONFIG_SCSI_SCAN_ASYNC is not set
412CONFIG_SCSI_WAIT_SCAN=m
413
414#
415# SCSI Transports
416#
417# CONFIG_SCSI_SPI_ATTRS is not set
418# CONFIG_SCSI_FC_ATTRS is not set
419# CONFIG_SCSI_ISCSI_ATTRS is not set
420# CONFIG_SCSI_SAS_LIBSAS is not set
421CONFIG_SCSI_LOWLEVEL=y
422# CONFIG_ISCSI_TCP is not set
423# CONFIG_SCSI_DEBUG is not set
424# CONFIG_MD is not set
425CONFIG_NETDEVICES=y
426# CONFIG_NETDEVICES_MULTIQUEUE is not set
427# CONFIG_DUMMY is not set
428# CONFIG_BONDING is not set
429# CONFIG_MACVLAN is not set
430# CONFIG_EQUALIZER is not set
431# CONFIG_TUN is not set
432# CONFIG_PHYLIB is not set
433CONFIG_NET_ETHERNET=y
434CONFIG_MII=y
435CONFIG_SMC91X=y
436# CONFIG_NE2000 is not set
437CONFIG_NETDEV_1000=y
438CONFIG_NETDEV_10000=y
439
440#
441# Wireless LAN
442#
443# CONFIG_WLAN_PRE80211 is not set
444# CONFIG_WLAN_80211 is not set
445# CONFIG_WAN is not set
446# CONFIG_PPP is not set
447# CONFIG_SLIP is not set
448# CONFIG_SHAPER is not set
449# CONFIG_NETCONSOLE is not set
450# CONFIG_NETPOLL is not set
451# CONFIG_NET_POLL_CONTROLLER is not set
452# CONFIG_ISDN is not set
453# CONFIG_PHONE is not set
454
455#
456# Input device support
457#
458CONFIG_INPUT=y
459# CONFIG_INPUT_FF_MEMLESS is not set
460# CONFIG_INPUT_POLLDEV is not set
461
462#
463# Userland interfaces
464#
465# CONFIG_INPUT_MOUSEDEV is not set
466# CONFIG_INPUT_JOYDEV is not set
467# CONFIG_INPUT_TSDEV is not set
468# CONFIG_INPUT_EVDEV is not set
469# CONFIG_INPUT_EVBUG is not set
470
471#
472# Input Device Drivers
473#
474# CONFIG_INPUT_KEYBOARD is not set
475# CONFIG_INPUT_MOUSE is not set
476# CONFIG_INPUT_JOYSTICK is not set
477# CONFIG_INPUT_TABLET is not set
478# CONFIG_INPUT_TOUCHSCREEN is not set
479# CONFIG_INPUT_MISC is not set
480
481#
482# Hardware I/O ports
483#
484CONFIG_SERIO=y
485# CONFIG_SERIO_I8042 is not set
486CONFIG_SERIO_SERPORT=y
487# CONFIG_SERIO_LIBPS2 is not set
488# CONFIG_SERIO_RAW is not set
489# CONFIG_GAMEPORT is not set
490
491#
492# Character devices
493#
494CONFIG_VT=y
495CONFIG_VT_CONSOLE=y
496CONFIG_HW_CONSOLE=y
497# CONFIG_VT_HW_CONSOLE_BINDING is not set
498# CONFIG_SERIAL_NONSTANDARD is not set
499
500#
501# Serial drivers
502#
503# CONFIG_SERIAL_8250 is not set
504
505#
506# Non-8250 serial port support
507#
508CONFIG_SERIAL_CORE=y
509CONFIG_SERIAL_CORE_CONSOLE=y
510CONFIG_SERIAL_M32R_SIO=y
511CONFIG_SERIAL_M32R_SIO_CONSOLE=y
512CONFIG_SERIAL_M32R_PLDSIO=y
513CONFIG_UNIX98_PTYS=y
514CONFIG_LEGACY_PTYS=y
515CONFIG_LEGACY_PTY_COUNT=256
516# CONFIG_IPMI_HANDLER is not set
517# CONFIG_WATCHDOG is not set
518CONFIG_HW_RANDOM=y
519# CONFIG_RTC is not set
520CONFIG_DS1302=y
521# CONFIG_R3964 is not set
522# CONFIG_RAW_DRIVER is not set
523# CONFIG_TCG_TPM is not set
524# CONFIG_I2C is not set
525
526#
527# SPI support
528#
529# CONFIG_SPI is not set
530# CONFIG_SPI_MASTER is not set
531# CONFIG_W1 is not set
532# CONFIG_POWER_SUPPLY is not set
533CONFIG_HWMON=y
534# CONFIG_HWMON_VID is not set
535# CONFIG_SENSORS_ABITUGURU is not set
536# CONFIG_SENSORS_ABITUGURU3 is not set
537# CONFIG_SENSORS_F71805F is not set
538# CONFIG_SENSORS_IT87 is not set
539# CONFIG_SENSORS_PC87360 is not set
540# CONFIG_SENSORS_PC87427 is not set
541# CONFIG_SENSORS_SMSC47M1 is not set
542# CONFIG_SENSORS_SMSC47B397 is not set
543# CONFIG_SENSORS_VT1211 is not set
544# CONFIG_SENSORS_W83627HF is not set
545# CONFIG_SENSORS_W83627EHF is not set
546# CONFIG_HWMON_DEBUG_CHIP is not set
547
548#
549# Multifunction device drivers
550#
551# CONFIG_MFD_SM501 is not set
552
553#
554# Multimedia devices
555#
556CONFIG_VIDEO_DEV=m
557CONFIG_VIDEO_V4L1=y
558CONFIG_VIDEO_V4L1_COMPAT=y
559CONFIG_VIDEO_V4L2=y
560CONFIG_VIDEO_CAPTURE_DRIVERS=y
561# CONFIG_VIDEO_ADV_DEBUG is not set
562CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
563# CONFIG_VIDEO_CPIA is not set
564CONFIG_VIDEO_M32R_AR=m
565CONFIG_VIDEO_M32R_AR_M64278=m
566CONFIG_RADIO_ADAPTERS=y
567# CONFIG_DVB_CORE is not set
568CONFIG_DAB=y
569
570#
571# Graphics support
572#
573# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
574
575#
576# Display device support
577#
578# CONFIG_DISPLAY_SUPPORT is not set
579# CONFIG_VGASTATE is not set
580CONFIG_VIDEO_OUTPUT_CONTROL=m
581CONFIG_FB=y
582CONFIG_FIRMWARE_EDID=y
583# CONFIG_FB_DDC is not set
584CONFIG_FB_CFB_FILLRECT=y
585CONFIG_FB_CFB_COPYAREA=y
586CONFIG_FB_CFB_IMAGEBLIT=y
587# CONFIG_FB_SYS_FILLRECT is not set
588# CONFIG_FB_SYS_COPYAREA is not set
589# CONFIG_FB_SYS_IMAGEBLIT is not set
590# CONFIG_FB_SYS_FOPS is not set
591CONFIG_FB_DEFERRED_IO=y
592# CONFIG_FB_SVGALIB is not set
593# CONFIG_FB_MACMODES is not set
594# CONFIG_FB_BACKLIGHT is not set
595# CONFIG_FB_MODE_HELPERS is not set
596# CONFIG_FB_TILEBLITTING is not set
597
598#
599# Frame buffer hardware drivers
600#
601CONFIG_FB_S1D13XXX=y
602# CONFIG_FB_VIRTUAL is not set
603
604#
605# Console display driver support
606#
607# CONFIG_VGA_CONSOLE is not set
608CONFIG_DUMMY_CONSOLE=y
609CONFIG_FRAMEBUFFER_CONSOLE=y
610# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
611# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
612# CONFIG_FONTS is not set
613CONFIG_FONT_8x8=y
614CONFIG_FONT_8x16=y
615CONFIG_LOGO=y
616CONFIG_LOGO_LINUX_MONO=y
617CONFIG_LOGO_LINUX_VGA16=y
618CONFIG_LOGO_LINUX_CLUT224=y
619CONFIG_LOGO_M32R_CLUT224=y
620
621#
622# Sound
623#
624# CONFIG_SOUND is not set
625CONFIG_HID_SUPPORT=y
626CONFIG_HID=y
627# CONFIG_HID_DEBUG is not set
628CONFIG_USB_SUPPORT=y
629# CONFIG_USB_ARCH_HAS_HCD is not set
630# CONFIG_USB_ARCH_HAS_OHCI is not set
631# CONFIG_USB_ARCH_HAS_EHCI is not set
632
633#
634# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
635#
636
637#
638# USB Gadget Support
639#
640# CONFIG_USB_GADGET is not set
641CONFIG_MMC=y
642CONFIG_MMC_DEBUG=y
643# CONFIG_MMC_UNSAFE_RESUME is not set
644
645#
646# MMC/SD Card Drivers
647#
648CONFIG_MMC_BLOCK=y
649CONFIG_MMC_BLOCK_BOUNCE=y
650
651#
652# MMC/SD Host Controller Drivers
653#
654# CONFIG_NEW_LEDS is not set
655
656#
657# Real Time Clock
658#
659# CONFIG_RTC_CLASS is not set
660
661#
662# Userspace I/O
663#
664# CONFIG_UIO is not set
665
666#
667# File systems
668#
669CONFIG_EXT2_FS=y
670# CONFIG_EXT2_FS_XATTR is not set
671# CONFIG_EXT2_FS_XIP is not set
672CONFIG_EXT3_FS=y
673CONFIG_EXT3_FS_XATTR=y
674# CONFIG_EXT3_FS_POSIX_ACL is not set
675# CONFIG_EXT3_FS_SECURITY is not set
676# CONFIG_EXT4DEV_FS is not set
677CONFIG_JBD=y
678CONFIG_JBD_DEBUG=y
679CONFIG_FS_MBCACHE=y
680CONFIG_REISERFS_FS=m
681# CONFIG_REISERFS_CHECK is not set
682# CONFIG_REISERFS_PROC_INFO is not set
683# CONFIG_REISERFS_FS_XATTR is not set
684# CONFIG_JFS_FS is not set
685# CONFIG_FS_POSIX_ACL is not set
686# CONFIG_XFS_FS is not set
687# CONFIG_GFS2_FS is not set
688# CONFIG_OCFS2_FS is not set
689# CONFIG_MINIX_FS is not set
690# CONFIG_ROMFS_FS is not set
691CONFIG_INOTIFY=y
692CONFIG_INOTIFY_USER=y
693# CONFIG_QUOTA is not set
694CONFIG_DNOTIFY=y
695# CONFIG_AUTOFS_FS is not set
696# CONFIG_AUTOFS4_FS is not set
697# CONFIG_FUSE_FS is not set
698
699#
700# CD-ROM/DVD Filesystems
701#
702CONFIG_ISO9660_FS=m
703CONFIG_JOLIET=y
704# CONFIG_ZISOFS is not set
705CONFIG_UDF_FS=m
706CONFIG_UDF_NLS=y
707
708#
709# DOS/FAT/NT Filesystems
710#
711CONFIG_FAT_FS=m
712CONFIG_MSDOS_FS=m
713CONFIG_VFAT_FS=m
714CONFIG_FAT_DEFAULT_CODEPAGE=437
715CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
716# CONFIG_NTFS_FS is not set
717
718#
719# Pseudo filesystems
720#
721CONFIG_PROC_FS=y
722CONFIG_PROC_KCORE=y
723CONFIG_PROC_SYSCTL=y
724CONFIG_SYSFS=y
725CONFIG_TMPFS=y
726# CONFIG_TMPFS_POSIX_ACL is not set
727# CONFIG_HUGETLB_PAGE is not set
728CONFIG_RAMFS=y
729# CONFIG_CONFIGFS_FS is not set
730
731#
732# Miscellaneous filesystems
733#
734# CONFIG_ADFS_FS is not set
735# CONFIG_AFFS_FS is not set
736# CONFIG_HFS_FS is not set
737# CONFIG_HFSPLUS_FS is not set
738# CONFIG_BEFS_FS is not set
739# CONFIG_BFS_FS is not set
740# CONFIG_EFS_FS is not set
741# CONFIG_JFFS2_FS is not set
742# CONFIG_CRAMFS is not set
743# CONFIG_VXFS_FS is not set
744# CONFIG_HPFS_FS is not set
745# CONFIG_QNX4FS_FS is not set
746# CONFIG_SYSV_FS is not set
747# CONFIG_UFS_FS is not set
748
749#
750# Network File Systems
751#
752CONFIG_NFS_FS=y
753CONFIG_NFS_V3=y
754# CONFIG_NFS_V3_ACL is not set
755# CONFIG_NFS_V4 is not set
756# CONFIG_NFS_DIRECTIO is not set
757# CONFIG_NFSD is not set
758CONFIG_ROOT_NFS=y
759CONFIG_LOCKD=y
760CONFIG_LOCKD_V4=y
761CONFIG_NFS_COMMON=y
762CONFIG_SUNRPC=y
763# CONFIG_SUNRPC_BIND34 is not set
764# CONFIG_RPCSEC_GSS_KRB5 is not set
765# CONFIG_RPCSEC_GSS_SPKM3 is not set
766# CONFIG_SMB_FS is not set
767# CONFIG_CIFS is not set
768# CONFIG_NCP_FS is not set
769# CONFIG_CODA_FS is not set
770# CONFIG_AFS_FS is not set
771
772#
773# Partition Types
774#
775# CONFIG_PARTITION_ADVANCED is not set
776CONFIG_MSDOS_PARTITION=y
777
778#
779# Native Language Support
780#
781CONFIG_NLS=y
782CONFIG_NLS_DEFAULT="iso8859-1"
783# CONFIG_NLS_CODEPAGE_437 is not set
784# CONFIG_NLS_CODEPAGE_737 is not set
785# CONFIG_NLS_CODEPAGE_775 is not set
786# CONFIG_NLS_CODEPAGE_850 is not set
787# CONFIG_NLS_CODEPAGE_852 is not set
788# CONFIG_NLS_CODEPAGE_855 is not set
789# CONFIG_NLS_CODEPAGE_857 is not set
790# CONFIG_NLS_CODEPAGE_860 is not set
791# CONFIG_NLS_CODEPAGE_861 is not set
792# CONFIG_NLS_CODEPAGE_862 is not set
793# CONFIG_NLS_CODEPAGE_863 is not set
794# CONFIG_NLS_CODEPAGE_864 is not set
795# CONFIG_NLS_CODEPAGE_865 is not set
796# CONFIG_NLS_CODEPAGE_866 is not set
797# CONFIG_NLS_CODEPAGE_869 is not set
798# CONFIG_NLS_CODEPAGE_936 is not set
799# CONFIG_NLS_CODEPAGE_950 is not set
800# CONFIG_NLS_CODEPAGE_932 is not set
801# CONFIG_NLS_CODEPAGE_949 is not set
802# CONFIG_NLS_CODEPAGE_874 is not set
803# CONFIG_NLS_ISO8859_8 is not set
804# CONFIG_NLS_CODEPAGE_1250 is not set
805# CONFIG_NLS_CODEPAGE_1251 is not set
806# CONFIG_NLS_ASCII is not set
807# CONFIG_NLS_ISO8859_1 is not set
808# CONFIG_NLS_ISO8859_2 is not set
809# CONFIG_NLS_ISO8859_3 is not set
810# CONFIG_NLS_ISO8859_4 is not set
811# CONFIG_NLS_ISO8859_5 is not set
812# CONFIG_NLS_ISO8859_6 is not set
813# CONFIG_NLS_ISO8859_7 is not set
814# CONFIG_NLS_ISO8859_9 is not set
815# CONFIG_NLS_ISO8859_13 is not set
816# CONFIG_NLS_ISO8859_14 is not set
817# CONFIG_NLS_ISO8859_15 is not set
818# CONFIG_NLS_KOI8_R is not set
819# CONFIG_NLS_KOI8_U is not set
820# CONFIG_NLS_UTF8 is not set
821
822#
823# Distributed Lock Manager
824#
825# CONFIG_DLM is not set
826
827#
828# Profiling support
829#
830CONFIG_PROFILING=y
831CONFIG_OPROFILE=y
832
833#
834# Kernel hacking
835#
836# CONFIG_PRINTK_TIME is not set
837CONFIG_ENABLE_MUST_CHECK=y
838# CONFIG_MAGIC_SYSRQ is not set
839# CONFIG_UNUSED_SYMBOLS is not set
840# CONFIG_DEBUG_FS is not set
841# CONFIG_HEADERS_CHECK is not set
842# CONFIG_DEBUG_KERNEL is not set
843# CONFIG_DEBUG_BUGVERBOSE is not set
844# CONFIG_FRAME_POINTER is not set
845
846#
847# Security options
848#
849# CONFIG_KEYS is not set
850# CONFIG_SECURITY is not set
851# CONFIG_CRYPTO is not set
852
853#
854# Library routines
855#
856CONFIG_BITREVERSE=y
857# CONFIG_CRC_CCITT is not set
858# CONFIG_CRC16 is not set
859# CONFIG_CRC_ITU_T is not set
860CONFIG_CRC32=y
861# CONFIG_CRC7 is not set
862# CONFIG_LIBCRC32C is not set
863CONFIG_HAS_IOMEM=y
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index 41b07854fcc6..15a6f36c06db 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -60,9 +60,6 @@ SECTIONS
60 . = ALIGN(4096); 60 . = ALIGN(4096);
61 __nosave_end = .; 61 __nosave_end = .;
62 62
63 . = ALIGN(4096);
64 .data.page_aligned : { *(.data.idt) }
65
66 . = ALIGN(32); 63 . = ALIGN(32);
67 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 64 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
68 65
diff --git a/arch/m68k/kernel/asm-offsets.c b/arch/m68k/kernel/asm-offsets.c
index 246a8820c223..b1f012f6c493 100644
--- a/arch/m68k/kernel/asm-offsets.c
+++ b/arch/m68k/kernel/asm-offsets.c
@@ -11,14 +11,12 @@
11#include <linux/stddef.h> 11#include <linux/stddef.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/kernel_stat.h> 13#include <linux/kernel_stat.h>
14#include <linux/kbuild.h>
14#include <asm/bootinfo.h> 15#include <asm/bootinfo.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/amigahw.h> 17#include <asm/amigahw.h>
17#include <linux/font.h> 18#include <linux/font.h>
18 19
19#define DEFINE(sym, val) \
20 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
21
22int main(void) 20int main(void)
23{ 21{
24 /* offsets into the task struct */ 22 /* offsets into the task struct */
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index e892f17ba3fa..7f54efaf60bb 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -30,23 +30,6 @@
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/unistd.h> 31#include <asm/unistd.h>
32 32
33/*
34 * sys_pipe() is the normal C calling standard for creating
35 * a pipe. It's not the way unix traditionally does this, though.
36 */
37asmlinkage int sys_pipe(unsigned long __user * fildes)
38{
39 int fd[2];
40 int error;
41
42 error = do_pipe(fd);
43 if (!error) {
44 if (copy_to_user(fildes, fd, 2*sizeof(int)))
45 error = -EFAULT;
46 }
47 return error;
48}
49
50/* common code for old and new mmaps */ 33/* common code for old and new mmaps */
51static inline long do_mmap2( 34static inline long do_mmap2(
52 unsigned long addr, unsigned long len, 35 unsigned long addr, unsigned long len,
diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index 5b2799eb96a6..326fb9978094 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -109,7 +109,6 @@
109#include <linux/mm.h> 109#include <linux/mm.h>
110#include <linux/delay.h> 110#include <linux/delay.h>
111#include <linux/init.h> 111#include <linux/init.h>
112#include <linux/proc_fs.h>
113#include <linux/interrupt.h> 112#include <linux/interrupt.h>
114 113
115#include <asm/bootinfo.h> 114#include <asm/bootinfo.h>
@@ -124,10 +123,6 @@
124 123
125int iop_scc_present,iop_ism_present; 124int iop_scc_present,iop_ism_present;
126 125
127#ifdef CONFIG_PROC_FS
128static int iop_get_proc_info(char *, char **, off_t, int);
129#endif /* CONFIG_PROC_FS */
130
131/* structure for tracking channel listeners */ 126/* structure for tracking channel listeners */
132 127
133struct listener { 128struct listener {
@@ -299,12 +294,6 @@ void __init iop_init(void)
299 iop_listeners[IOP_NUM_ISM][i].devname = NULL; 294 iop_listeners[IOP_NUM_ISM][i].devname = NULL;
300 iop_listeners[IOP_NUM_ISM][i].handler = NULL; 295 iop_listeners[IOP_NUM_ISM][i].handler = NULL;
301 } 296 }
302
303#if 0 /* Crashing in 2.4 now, not yet sure why. --jmt */
304#ifdef CONFIG_PROC_FS
305 create_proc_info_entry("mac_iop", 0, &proc_root, iop_get_proc_info);
306#endif
307#endif
308} 297}
309 298
310/* 299/*
@@ -637,77 +626,3 @@ irqreturn_t iop_ism_irq(int irq, void *dev_id)
637 } 626 }
638 return IRQ_HANDLED; 627 return IRQ_HANDLED;
639} 628}
640
641#ifdef CONFIG_PROC_FS
642
643char *iop_chan_state(int state)
644{
645 switch(state) {
646 case IOP_MSG_IDLE : return "idle ";
647 case IOP_MSG_NEW : return "new ";
648 case IOP_MSG_RCVD : return "received ";
649 case IOP_MSG_COMPLETE : return "completed ";
650 default : return "unknown ";
651 }
652}
653
654int iop_dump_one_iop(char *buf, int iop_num, char *iop_name)
655{
656 int i,len = 0;
657 volatile struct mac_iop *iop = iop_base[iop_num];
658
659 len += sprintf(buf+len, "%s IOP channel states:\n\n", iop_name);
660 len += sprintf(buf+len, "## send_state recv_state device\n");
661 len += sprintf(buf+len, "------------------------------------------------\n");
662 for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
663 len += sprintf(buf+len, "%2d %10s %10s %s\n", i,
664 iop_chan_state(iop_readb(iop, IOP_ADDR_SEND_STATE+i)),
665 iop_chan_state(iop_readb(iop, IOP_ADDR_RECV_STATE+i)),
666 iop_listeners[iop_num][i].handler?
667 iop_listeners[iop_num][i].devname : "");
668
669 }
670 len += sprintf(buf+len, "\n");
671 return len;
672}
673
674static int iop_get_proc_info(char *buf, char **start, off_t pos, int count)
675{
676 int len, cnt;
677
678 cnt = 0;
679 len = sprintf(buf, "IOPs detected:\n\n");
680
681 if (iop_scc_present) {
682 len += sprintf(buf+len, "SCC IOP (%p): status %02X\n",
683 iop_base[IOP_NUM_SCC],
684 (uint) iop_base[IOP_NUM_SCC]->status_ctrl);
685 }
686 if (iop_ism_present) {
687 len += sprintf(buf+len, "ISM IOP (%p): status %02X\n\n",
688 iop_base[IOP_NUM_ISM],
689 (uint) iop_base[IOP_NUM_ISM]->status_ctrl);
690 }
691
692 if (iop_scc_present) {
693 len += iop_dump_one_iop(buf+len, IOP_NUM_SCC, "SCC");
694
695 }
696
697 if (iop_ism_present) {
698 len += iop_dump_one_iop(buf+len, IOP_NUM_ISM, "ISM");
699
700 }
701
702 if (len >= pos) {
703 if (!*start) {
704 *start = buf + pos;
705 cnt = len - pos;
706 } else {
707 cnt += len;
708 }
709 }
710 return (count > cnt) ? cnt : count;
711}
712
713#endif /* CONFIG_PROC_FS */
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index a2bb01f59642..d8fb9c5303cc 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -69,6 +69,7 @@ void __init m68k_setup_node(int node)
69 */ 69 */
70 70
71void *empty_zero_page; 71void *empty_zero_page;
72EXPORT_SYMBOL(empty_zero_page);
72 73
73void show_mem(void) 74void show_mem(void)
74{ 75{
diff --git a/arch/m68knommu/kernel/asm-offsets.c b/arch/m68knommu/kernel/asm-offsets.c
index d97b89bae53c..c785d07c02cc 100644
--- a/arch/m68knommu/kernel/asm-offsets.c
+++ b/arch/m68knommu/kernel/asm-offsets.c
@@ -13,15 +13,11 @@
13#include <linux/kernel_stat.h> 13#include <linux/kernel_stat.h>
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <linux/hardirq.h> 15#include <linux/hardirq.h>
16#include <linux/kbuild.h>
16#include <asm/bootinfo.h> 17#include <asm/bootinfo.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <asm/thread_info.h> 19#include <asm/thread_info.h>
19 20
20#define DEFINE(sym, val) \
21 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
22
23#define BLANK() asm volatile("\n->" : : )
24
25int main(void) 21int main(void)
26{ 22{
27 /* offsets into the task struct */ 23 /* offsets into the task struct */
@@ -91,6 +87,7 @@ int main(void)
91 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 87 DEFINE(TI_TASK, offsetof(struct thread_info, task));
92 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); 88 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
93 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 89 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
90 DEFINE(TI_PREEMPTCOUNT, offsetof(struct thread_info, preempt_count));
94 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); 91 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
95 92
96 return 0; 93 return 0;
diff --git a/arch/m68knommu/kernel/entry.S b/arch/m68knommu/kernel/entry.S
index 1e7ea6a3e1a1..f4782d2dce8f 100644
--- a/arch/m68knommu/kernel/entry.S
+++ b/arch/m68knommu/kernel/entry.S
@@ -32,6 +32,7 @@
32#include <asm/segment.h> 32#include <asm/segment.h>
33#include <asm/asm-offsets.h> 33#include <asm/asm-offsets.h>
34#include <asm/entry.h> 34#include <asm/entry.h>
35#include <asm/unistd.h>
35 36
36.text 37.text
37 38
@@ -140,3 +141,11 @@ ENTRY(sys_rt_sigreturn)
140 RESTORE_SWITCH_STACK 141 RESTORE_SWITCH_STACK
141 rts 142 rts
142 143
144ENTRY(ret_from_user_signal)
145 moveq #__NR_sigreturn,%d0
146 trap #0
147
148ENTRY(ret_from_user_rt_signal)
149 move #__NR_rt_sigreturn,%d0
150 trap #0
151
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index d6f0200316fe..03f4fe6a2fc0 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -162,7 +162,7 @@ void __init setup_arch(char **cmdline_p)
162 printk(KERN_INFO "DragonEngine II board support by Georges Menie\n"); 162 printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
163#endif 163#endif
164#ifdef CONFIG_M5235EVB 164#ifdef CONFIG_M5235EVB
165 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)"); 165 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n");
166#endif 166#endif
167 167
168#ifdef DEBUG 168#ifdef DEBUG
diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
index 70371378db86..bbfcae9e52b4 100644
--- a/arch/m68knommu/kernel/signal.c
+++ b/arch/m68knommu/kernel/signal.c
@@ -51,6 +51,8 @@
51 51
52#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 52#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
53 53
54void ret_from_user_signal(void);
55void ret_from_user_rt_signal(void);
54asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs); 56asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs);
55 57
56/* 58/*
@@ -539,10 +541,6 @@ static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs)
539 return err; 541 return err;
540} 542}
541 543
542static inline void push_cache (unsigned long vaddr)
543{
544}
545
546static inline void * 544static inline void *
547get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 545get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
548{ 546{
@@ -586,16 +584,11 @@ static void setup_frame (int sig, struct k_sigaction *ka,
586 err |= copy_to_user (&frame->sc, &context, sizeof(context)); 584 err |= copy_to_user (&frame->sc, &context, sizeof(context));
587 585
588 /* Set up to return from userspace. */ 586 /* Set up to return from userspace. */
589 err |= __put_user(frame->retcode, &frame->pretcode); 587 err |= __put_user((void *) ret_from_user_signal, &frame->pretcode);
590 /* moveq #,d0; trap #0 */
591 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
592 (long *)(frame->retcode));
593 588
594 if (err) 589 if (err)
595 goto give_sigsegv; 590 goto give_sigsegv;
596 591
597 push_cache ((unsigned long) &frame->retcode);
598
599 /* Set up registers for signal handler */ 592 /* Set up registers for signal handler */
600 wrusp ((unsigned long) frame); 593 wrusp ((unsigned long) frame);
601 regs->pc = (unsigned long) ka->sa.sa_handler; 594 regs->pc = (unsigned long) ka->sa.sa_handler;
@@ -655,17 +648,11 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
655 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); 648 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
656 649
657 /* Set up to return from userspace. */ 650 /* Set up to return from userspace. */
658 err |= __put_user(frame->retcode, &frame->pretcode); 651 err |= __put_user((void *) ret_from_user_rt_signal, &frame->pretcode);
659 /* moveq #,d0; notb d0; trap #0 */
660 err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
661 (long *)(frame->retcode + 0));
662 err |= __put_user(0x4e40, (short *)(frame->retcode + 4));
663 652
664 if (err) 653 if (err)
665 goto give_sigsegv; 654 goto give_sigsegv;
666 655
667 push_cache ((unsigned long) &frame->retcode);
668
669 /* Set up registers for signal handler */ 656 /* Set up registers for signal handler */
670 wrusp ((unsigned long) frame); 657 wrusp ((unsigned long) frame);
671 regs->pc = (unsigned long) ka->sa.sa_handler; 658 regs->pc = (unsigned long) ka->sa.sa_handler;
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index 65f7a95f056e..700281638629 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -28,23 +28,6 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/unistd.h> 29#include <asm/unistd.h>
30 30
31/*
32 * sys_pipe() is the normal C calling standard for creating
33 * a pipe. It's not the way unix traditionally does this, though.
34 */
35asmlinkage int sys_pipe(unsigned long * fildes)
36{
37 int fd[2];
38 int error;
39
40 error = do_pipe(fd);
41 if (!error) {
42 if (copy_to_user(fildes, fd, 2*sizeof(int)))
43 error = -EFAULT;
44 }
45 return error;
46}
47
48/* common code for old and new mmaps */ 31/* common code for old and new mmaps */
49static inline long do_mmap2( 32static inline long do_mmap2(
50 unsigned long addr, unsigned long len, 33 unsigned long addr, unsigned long len,
diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c
index 437a061d8b94..ec9aea652e79 100644
--- a/arch/m68knommu/kernel/traps.c
+++ b/arch/m68knommu/kernel/traps.c
@@ -28,6 +28,7 @@
28#include <linux/linkage.h> 28#include <linux/linkage.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/ptrace.h> 30#include <linux/ptrace.h>
31#include <linux/kallsyms.h>
31 32
32#include <asm/setup.h> 33#include <asm/setup.h>
33#include <asm/fpu.h> 34#include <asm/fpu.h>
@@ -102,56 +103,47 @@ asmlinkage void buserr_c(struct frame *fp)
102 force_sig(SIGSEGV, current); 103 force_sig(SIGSEGV, current);
103} 104}
104 105
105
106int kstack_depth_to_print = 48; 106int kstack_depth_to_print = 48;
107 107
108void show_stack(struct task_struct *task, unsigned long *stack) 108static void __show_stack(struct task_struct *task, unsigned long *stack)
109{ 109{
110 unsigned long *endstack, addr; 110 unsigned long *endstack, addr;
111 extern char _start, _etext; 111 unsigned long *last_stack;
112 int i; 112 int i;
113 113
114 if (!stack) { 114 if (!stack)
115 if (task) 115 stack = (unsigned long *)task->thread.ksp;
116 stack = (unsigned long *)task->thread.ksp;
117 else
118 stack = (unsigned long *)&stack;
119 }
120 116
121 addr = (unsigned long) stack; 117 addr = (unsigned long) stack;
122 endstack = (unsigned long *) PAGE_ALIGN(addr); 118 endstack = (unsigned long *) PAGE_ALIGN(addr);
123 119
124 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack); 120 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack);
125 for (i = 0; i < kstack_depth_to_print; i++) { 121 for (i = 0; i < kstack_depth_to_print; i++) {
126 if (stack + 1 > endstack) 122 if (stack + 1 + i > endstack)
127 break; 123 break;
128 if (i % 8 == 0) 124 if (i % 8 == 0)
129 printk("\n" KERN_EMERG " "); 125 printk("\n" KERN_EMERG " ");
130 printk(" %08lx", *stack++); 126 printk(" %08lx", *(stack + i));
131 } 127 }
132 printk("\n"); 128 printk("\n");
133 129
134 printk(KERN_EMERG "Call Trace:"); 130#ifdef CONFIG_FRAME_POINTER
135 i = 0; 131 printk(KERN_EMERG "Call Trace:\n");
136 while (stack + 1 <= endstack) { 132
137 addr = *stack++; 133 last_stack = stack - 1;
138 /* 134 while (stack <= endstack && stack > last_stack) {
139 * If the address is either in the text segment of the 135
140 * kernel, or in the region which contains vmalloc'ed 136 addr = *(stack + 1);
141 * memory, it *may* be the address of a calling 137 printk(KERN_EMERG " [%08lx] ", addr);
142 * routine; if so, print it so that someone tracing 138 print_symbol(KERN_CONT "%s\n", addr);
143 * down the cause of the crash will be able to figure 139
144 * out the call path that was taken. 140 last_stack = stack;
145 */ 141 stack = (unsigned long *)*stack;
146 if (((addr >= (unsigned long) &_start) &&
147 (addr <= (unsigned long) &_etext))) {
148 if (i % 4 == 0)
149 printk("\n" KERN_EMERG " ");
150 printk(" [<%08lx>]", addr);
151 i++;
152 }
153 } 142 }
154 printk("\n"); 143 printk("\n");
144#else
145 printk(KERN_EMERG "CONFIG_FRAME_POINTER disabled, no symbolic call trace\n");
146#endif
155} 147}
156 148
157void bad_super_trap(struct frame *fp) 149void bad_super_trap(struct frame *fp)
@@ -298,19 +290,47 @@ asmlinkage void set_esp0(unsigned long ssp)
298 current->thread.esp0 = ssp; 290 current->thread.esp0 = ssp;
299} 291}
300 292
301
302/* 293/*
303 * The architecture-independent backtrace generator 294 * The architecture-independent backtrace generator
304 */ 295 */
305void dump_stack(void) 296void dump_stack(void)
306{ 297{
307 unsigned long stack; 298 /*
299 * We need frame pointers for this little trick, which works as follows:
300 *
301 * +------------+ 0x00
302 * | Next SP | -> 0x0c
303 * +------------+ 0x04
304 * | Caller |
305 * +------------+ 0x08
306 * | Local vars | -> our stack var
307 * +------------+ 0x0c
308 * | Next SP | -> 0x18, that is what we pass to show_stack()
309 * +------------+ 0x10
310 * | Caller |
311 * +------------+ 0x14
312 * | Local vars |
313 * +------------+ 0x18
314 * | ... |
315 * +------------+
316 */
308 317
309 show_stack(current, &stack); 318 unsigned long *stack;
310}
311 319
320 stack = (unsigned long *)&stack;
321 stack++;
322 __show_stack(current, stack);
323}
312EXPORT_SYMBOL(dump_stack); 324EXPORT_SYMBOL(dump_stack);
313 325
326void show_stack(struct task_struct *task, unsigned long *stack)
327{
328 if (!stack && !task)
329 dump_stack();
330 else
331 __show_stack(task, stack);
332}
333
314#ifdef CONFIG_M68KFPU_EMU 334#ifdef CONFIG_M68KFPU_EMU
315asmlinkage void fpemu_signal(int signal, int code, void *addr) 335asmlinkage void fpemu_signal(int signal, int code, void *addr)
316{ 336{
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index b44edb08e212..5592e0bf951f 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -64,6 +64,7 @@ SECTIONS {
64 _stext = . ; 64 _stext = . ;
65 TEXT_TEXT 65 TEXT_TEXT
66 SCHED_TEXT 66 SCHED_TEXT
67 LOCK_TEXT
67 *(.text.lock) 68 *(.text.lock)
68 69
69 . = ALIGN(16); /* Exception table */ 70 . = ALIGN(16); /* Exception table */
@@ -73,6 +74,7 @@ SECTIONS {
73 74
74 *(.rodata) *(.rodata.*) 75 *(.rodata) *(.rodata.*)
75 *(__vermagic) /* Kernel version magic */ 76 *(__vermagic) /* Kernel version magic */
77 *(__markers_strings)
76 *(.rodata1) 78 *(.rodata1)
77 *(.rodata.str1.1) 79 *(.rodata.str1.1)
78 80
@@ -182,6 +184,7 @@ SECTIONS {
182 *(COMMON) 184 *(COMMON)
183 . = ALIGN(4) ; 185 . = ALIGN(4) ;
184 _ebss = . ; 186 _ebss = . ;
187 _end = . ;
185 } > BSS 188 } > BSS
186 189
187} 190}
diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c
index a6692e958f6b..d01a5d2b7557 100644
--- a/arch/m68knommu/platform/5206e/config.c
+++ b/arch/m68knommu/platform/5206e/config.c
@@ -48,7 +48,7 @@ static struct platform_device *m5206e_devices[] __initdata = {
48 48
49/***************************************************************************/ 49/***************************************************************************/
50 50
51static void __init m5206_uart_init_line(int line, int irq) 51static void __init m5206e_uart_init_line(int line, int irq)
52{ 52{
53 if (line == 0) { 53 if (line == 0) {
54 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 54 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
diff --git a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c
index 2aca599a1ca7..230bae691a7f 100644
--- a/arch/m68knommu/platform/5272/config.c
+++ b/arch/m68knommu/platform/5272/config.c
@@ -139,10 +139,6 @@ void __init config_BSP(char *commandp, int size)
139 /* Copy command line from FLASH to local buffer... */ 139 /* Copy command line from FLASH to local buffer... */
140 memcpy(commandp, (char *) 0xf0004000, size); 140 memcpy(commandp, (char *) 0xf0004000, size);
141 commandp[size-1] = 0; 141 commandp[size-1] = 0;
142#elif defined(CONFIG_MTD_KeyTechnology)
143 /* Copy command line from FLASH to local buffer... */
144 memcpy(commandp, (char *) 0xffe06000, size);
145 commandp[size-1] = 0;
146#elif defined(CONFIG_CANCam) 142#elif defined(CONFIG_CANCam)
147 /* Copy command line from FLASH to local buffer... */ 143 /* Copy command line from FLASH to local buffer... */
148 memcpy(commandp, (char *) 0xf0010000, size); 144 memcpy(commandp, (char *) 0xf0010000, size);
diff --git a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c
index 036e1b73d944..dfdb5c2ed8e6 100644
--- a/arch/m68knommu/platform/528x/config.c
+++ b/arch/m68knommu/platform/528x/config.c
@@ -26,9 +26,240 @@
26#include <asm/mcfuart.h> 26#include <asm/mcfuart.h>
27#include <asm/mcfqspi.h> 27#include <asm/mcfqspi.h>
28 28
29#ifdef CONFIG_MTD_PARTITIONS
30#include <linux/mtd/partitions.h>
31#endif
32
29/***************************************************************************/ 33/***************************************************************************/
30 34
31void coldfire_reset(void); 35void coldfire_reset(void);
36static void coldfire_qspi_cs_control(u8 cs, u8 command);
37
38/***************************************************************************/
39
40#if defined(CONFIG_SPI)
41
42#if defined(CONFIG_WILDFIRE)
43#define SPI_NUM_CHIPSELECTS 0x02
44#define SPI_PAR_VAL 0x07 /* Enable DIN, DOUT, CLK */
45#define SPI_CS_MASK 0x18
46
47#define FLASH_BLOCKSIZE (1024*64)
48#define FLASH_NUMBLOCKS 16
49#define FLASH_TYPE "m25p80"
50
51#define M25P80_CS 0
52#define MMC_CS 1
53
54#ifdef CONFIG_MTD_PARTITIONS
55static struct mtd_partition stm25p_partitions[] = {
56 /* sflash */
57 [0] = {
58 .name = "stm25p80",
59 .offset = 0x00000000,
60 .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS,
61 .mask_flags = 0
62 }
63};
64
65#endif
66
67#elif defined(CONFIG_WILDFIREMOD)
68
69#define SPI_NUM_CHIPSELECTS 0x08
70#define SPI_PAR_VAL 0x07 /* Enable DIN, DOUT, CLK */
71#define SPI_CS_MASK 0x78
72
73#define FLASH_BLOCKSIZE (1024*64)
74#define FLASH_NUMBLOCKS 64
75#define FLASH_TYPE "m25p32"
76/* Reserve 1M for the kernel parition */
77#define FLASH_KERNEL_SIZE (1024 * 1024)
78
79#define M25P80_CS 5
80#define MMC_CS 6
81
82#ifdef CONFIG_MTD_PARTITIONS
83static struct mtd_partition stm25p_partitions[] = {
84 /* sflash */
85 [0] = {
86 .name = "kernel",
87 .offset = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS - FLASH_KERNEL_SIZE,
88 .size = FLASH_KERNEL_SIZE,
89 .mask_flags = 0
90 },
91 [1] = {
92 .name = "image",
93 .offset = 0x00000000,
94 .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS - FLASH_KERNEL_SIZE,
95 .mask_flags = 0
96 },
97 [2] = {
98 .name = "all",
99 .offset = 0x00000000,
100 .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS,
101 .mask_flags = 0
102 }
103};
104#endif
105
106#else
107#define SPI_NUM_CHIPSELECTS 0x04
108#define SPI_PAR_VAL 0x7F /* Enable DIN, DOUT, CLK, CS0 - CS4 */
109#endif
110
111#ifdef MMC_CS
112static struct coldfire_spi_chip flash_chip_info = {
113 .mode = SPI_MODE_0,
114 .bits_per_word = 16,
115 .del_cs_to_clk = 17,
116 .del_after_trans = 1,
117 .void_write_data = 0
118};
119
120static struct coldfire_spi_chip mmc_chip_info = {
121 .mode = SPI_MODE_0,
122 .bits_per_word = 16,
123 .del_cs_to_clk = 17,
124 .del_after_trans = 1,
125 .void_write_data = 0xFFFF
126};
127#endif
128
129#ifdef M25P80_CS
130static struct flash_platform_data stm25p80_platform_data = {
131 .name = "ST M25P80 SPI Flash chip",
132#ifdef CONFIG_MTD_PARTITIONS
133 .parts = stm25p_partitions,
134 .nr_parts = sizeof(stm25p_partitions) / sizeof(*stm25p_partitions),
135#endif
136 .type = FLASH_TYPE
137};
138#endif
139
140static struct spi_board_info spi_board_info[] __initdata = {
141#ifdef M25P80_CS
142 {
143 .modalias = "m25p80",
144 .max_speed_hz = 16000000,
145 .bus_num = 1,
146 .chip_select = M25P80_CS,
147 .platform_data = &stm25p80_platform_data,
148 .controller_data = &flash_chip_info
149 },
150#endif
151#ifdef MMC_CS
152 {
153 .modalias = "mmc_spi",
154 .max_speed_hz = 16000000,
155 .bus_num = 1,
156 .chip_select = MMC_CS,
157 .controller_data = &mmc_chip_info
158 }
159#endif
160};
161
162static struct coldfire_spi_master coldfire_master_info = {
163 .bus_num = 1,
164 .num_chipselect = SPI_NUM_CHIPSELECTS,
165 .irq_source = MCF5282_QSPI_IRQ_SOURCE,
166 .irq_vector = MCF5282_QSPI_IRQ_VECTOR,
167 .irq_mask = ((0x01 << MCF5282_QSPI_IRQ_SOURCE) | 0x01),
168 .irq_lp = 0x2B, /* Level 5 and Priority 3 */
169 .par_val = SPI_PAR_VAL,
170 .cs_control = coldfire_qspi_cs_control,
171};
172
173static struct resource coldfire_spi_resources[] = {
174 [0] = {
175 .name = "qspi-par",
176 .start = MCF5282_QSPI_PAR,
177 .end = MCF5282_QSPI_PAR,
178 .flags = IORESOURCE_MEM
179 },
180
181 [1] = {
182 .name = "qspi-module",
183 .start = MCF5282_QSPI_QMR,
184 .end = MCF5282_QSPI_QMR + 0x18,
185 .flags = IORESOURCE_MEM
186 },
187
188 [2] = {
189 .name = "qspi-int-level",
190 .start = MCF5282_INTC0 + MCFINTC_ICR0 + MCF5282_QSPI_IRQ_SOURCE,
191 .end = MCF5282_INTC0 + MCFINTC_ICR0 + MCF5282_QSPI_IRQ_SOURCE,
192 .flags = IORESOURCE_MEM
193 },
194
195 [3] = {
196 .name = "qspi-int-mask",
197 .start = MCF5282_INTC0 + MCFINTC_IMRL,
198 .end = MCF5282_INTC0 + MCFINTC_IMRL,
199 .flags = IORESOURCE_MEM
200 }
201};
202
203static struct platform_device coldfire_spi = {
204 .name = "spi_coldfire",
205 .id = -1,
206 .resource = coldfire_spi_resources,
207 .num_resources = ARRAY_SIZE(coldfire_spi_resources),
208 .dev = {
209 .platform_data = &coldfire_master_info,
210 }
211};
212
213static void coldfire_qspi_cs_control(u8 cs, u8 command)
214{
215 u8 cs_bit = ((0x01 << cs) << 3) & SPI_CS_MASK;
216
217#if defined(CONFIG_WILDFIRE)
218 u8 cs_mask = ~(((0x01 << cs) << 3) & SPI_CS_MASK);
219#endif
220#if defined(CONFIG_WILDFIREMOD)
221 u8 cs_mask = (cs << 3) & SPI_CS_MASK;
222#endif
223
224 /*
225 * Don't do anything if the chip select is not
226 * one of the port qs pins.
227 */
228 if (command & QSPI_CS_INIT) {
229#if defined(CONFIG_WILDFIRE)
230 MCF5282_GPIO_DDRQS |= cs_bit;
231 MCF5282_GPIO_PQSPAR &= ~cs_bit;
232#endif
233
234#if defined(CONFIG_WILDFIREMOD)
235 MCF5282_GPIO_DDRQS |= SPI_CS_MASK;
236 MCF5282_GPIO_PQSPAR &= ~SPI_CS_MASK;
237#endif
238 }
239
240 if (command & QSPI_CS_ASSERT) {
241 MCF5282_GPIO_PORTQS &= ~SPI_CS_MASK;
242 MCF5282_GPIO_PORTQS |= cs_mask;
243 } else if (command & QSPI_CS_DROP) {
244 MCF5282_GPIO_PORTQS |= SPI_CS_MASK;
245 }
246}
247
248static int __init spi_dev_init(void)
249{
250 int retval;
251
252 retval = platform_device_register(&coldfire_spi);
253 if (retval < 0)
254 return retval;
255
256 if (ARRAY_SIZE(spi_board_info))
257 retval = spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
258
259 return retval;
260}
261
262#endif /* CONFIG_SPI */
32 263
33/***************************************************************************/ 264/***************************************************************************/
34 265
@@ -111,10 +342,43 @@ void mcf_autovector(unsigned int vec)
111 342
112/***************************************************************************/ 343/***************************************************************************/
113 344
345#ifdef CONFIG_WILDFIRE
346void wildfire_halt(void)
347{
348 writeb(0, 0x30000007);
349 writeb(0x2, 0x30000007);
350}
351#endif
352
353#ifdef CONFIG_WILDFIREMOD
354void wildfiremod_halt(void)
355{
356 printk(KERN_INFO "WildFireMod hibernating...\n");
357
358 /* Set portE.5 to Digital IO */
359 MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2));
360
361 /* Make portE.5 an output */
362 MCF5282_GPIO_DDRE |= (1 << 5);
363
364 /* Now toggle portE.5 from low to high */
365 MCF5282_GPIO_PORTE &= ~(1 << 5);
366 MCF5282_GPIO_PORTE |= (1 << 5);
367
368 printk(KERN_EMERG "Failed to hibernate. Halting!\n");
369}
370#endif
371
114void __init config_BSP(char *commandp, int size) 372void __init config_BSP(char *commandp, int size)
115{ 373{
116 mcf_disableall(); 374 mcf_disableall();
117 mach_reset = coldfire_reset; 375
376#ifdef CONFIG_WILDFIRE
377 mach_halt = wildfire_halt;
378#endif
379#ifdef CONFIG_WILDFIREMOD
380 mach_halt = wildfiremod_halt;
381#endif
118} 382}
119 383
120/***************************************************************************/ 384/***************************************************************************/
diff --git a/arch/m68knommu/platform/5307/config.c b/arch/m68knommu/platform/5307/config.c
index 92dc862fa826..11cff6625dcc 100644
--- a/arch/m68knommu/platform/5307/config.c
+++ b/arch/m68knommu/platform/5307/config.c
@@ -124,8 +124,7 @@ void __init config_BSP(char *commandp, int size)
124 mcf_setimr(MCFSIM_IMR_MASKALL); 124 mcf_setimr(MCFSIM_IMR_MASKALL);
125 125
126#if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \ 126#if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \
127 defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \ 127 defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA)
128 defined(CONFIG_CLEOPATRA)
129 /* Copy command line from FLASH to local buffer... */ 128 /* Copy command line from FLASH to local buffer... */
130 memcpy(commandp, (char *) 0xf0004000, size); 129 memcpy(commandp, (char *) 0xf0004000, size);
131 commandp[size-1] = 0; 130 commandp[size-1] = 0;
diff --git a/arch/m68knommu/platform/coldfire/entry.S b/arch/m68knommu/platform/coldfire/entry.S
index 111b66dc737b..1e3c0dcbd7ac 100644
--- a/arch/m68knommu/platform/coldfire/entry.S
+++ b/arch/m68knommu/platform/coldfire/entry.S
@@ -103,9 +103,26 @@ ret_from_signal:
103 addql #4,%sp 103 addql #4,%sp
104 104
105ret_from_exception: 105ret_from_exception:
106 move #0x2700,%sr /* disable intrs */
106 btst #5,%sp@(PT_SR) /* check if returning to kernel */ 107 btst #5,%sp@(PT_SR) /* check if returning to kernel */
107 jeq Luser_return /* if so, skip resched, signals */ 108 jeq Luser_return /* if so, skip resched, signals */
108 109
110#ifdef CONFIG_PREEMPT
111 movel %sp,%d1 /* get thread_info pointer */
112 andl #-THREAD_SIZE,%d1 /* at base of kernel stack */
113 movel %d1,%a0
114 movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */
115 andl #_TIF_NEED_RESCHED,%d1
116 jeq Lkernel_return
117
118 movel %a0@(TI_PREEMPTCOUNT),%d1
119 cmpl #0,%d1
120 jne Lkernel_return
121
122 pea Lkernel_return
123 jmp preempt_schedule_irq /* preempt the kernel */
124#endif
125
109Lkernel_return: 126Lkernel_return:
110 moveml %sp@,%d1-%d5/%a0-%a2 127 moveml %sp@,%d1-%d5/%a0-%a2
111 lea %sp@(32),%sp /* space for 8 regs */ 128 lea %sp@(32),%sp /* space for 8 regs */
@@ -140,6 +157,7 @@ Lreturn:
140 157
141Lwork_to_do: 158Lwork_to_do:
142 movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ 159 movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */
160 move #0x2000,%sr /* enable intrs again */
143 btst #TIF_NEED_RESCHED,%d1 161 btst #TIF_NEED_RESCHED,%d1
144 jne reschedule 162 jne reschedule
145 163
diff --git a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
index 812a5f8b7d26..a8cd2c1b9e1b 100644
--- a/arch/mips/au1000/common/power.c
+++ b/arch/mips/au1000/common/power.c
@@ -251,7 +251,6 @@ int au_sleep(void)
251static int pm_do_sleep(ctl_table * ctl, int write, struct file *file, 251static int pm_do_sleep(ctl_table * ctl, int write, struct file *file,
252 void __user *buffer, size_t * len, loff_t *ppos) 252 void __user *buffer, size_t * len, loff_t *ppos)
253{ 253{
254 int retval = 0;
255#ifdef SLEEP_TEST_TIMEOUT 254#ifdef SLEEP_TEST_TIMEOUT
256#define TMPBUFLEN2 16 255#define TMPBUFLEN2 16
257 char buf[TMPBUFLEN2], *p; 256 char buf[TMPBUFLEN2], *p;
@@ -271,36 +270,12 @@ static int pm_do_sleep(ctl_table * ctl, int write, struct file *file,
271 p = buf; 270 p = buf;
272 sleep_ticks = simple_strtoul(p, &p, 0); 271 sleep_ticks = simple_strtoul(p, &p, 0);
273#endif 272#endif
274 retval = pm_send_all(PM_SUSPEND, (void *) 2);
275
276 if (retval)
277 return retval;
278 273
279 au_sleep(); 274 au_sleep();
280 retval = pm_send_all(PM_RESUME, (void *) 0);
281 } 275 }
282 return retval; 276 return 0;
283}
284
285static int pm_do_suspend(ctl_table * ctl, int write, struct file *file,
286 void __user *buffer, size_t * len, loff_t *ppos)
287{
288 int retval = 0;
289
290 if (!write) {
291 *len = 0;
292 } else {
293 retval = pm_send_all(PM_SUSPEND, (void *) 2);
294 if (retval)
295 return retval;
296 suspend_mode = 1;
297
298 retval = pm_send_all(PM_RESUME, (void *) 0);
299 }
300 return retval;
301} 277}
302 278
303
304static int pm_do_freq(ctl_table * ctl, int write, struct file *file, 279static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
305 void __user *buffer, size_t * len, loff_t *ppos) 280 void __user *buffer, size_t * len, loff_t *ppos)
306{ 281{
@@ -414,14 +389,6 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
414 389
415static struct ctl_table pm_table[] = { 390static struct ctl_table pm_table[] = {
416 { 391 {
417 .ctl_name = CTL_UNNUMBERED,
418 .procname = "suspend",
419 .data = NULL,
420 .maxlen = 0,
421 .mode = 0600,
422 .proc_handler = &pm_do_suspend
423 },
424 {
425 .ctl_name = CTL_UNNUMBERED, 392 .ctl_name = CTL_UNNUMBERED,
426 .procname = "sleep", 393 .procname = "sleep",
427 .data = NULL, 394 .data = NULL,
diff --git a/arch/mips/basler/excite/excite_procfs.c b/arch/mips/basler/excite/excite_procfs.c
index 9ee67a95f6b9..08923e6825b5 100644
--- a/arch/mips/basler/excite/excite_procfs.c
+++ b/arch/mips/basler/excite/excite_procfs.c
@@ -18,8 +18,9 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21#include <linux/module.h>
22#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
23#include <linux/seq_file.h>
23#include <linux/stat.h> 24#include <linux/stat.h>
24#include <asm/page.h> 25#include <asm/page.h>
25#include <asm/io.h> 26#include <asm/io.h>
@@ -28,14 +29,25 @@
28 29
29#include <excite.h> 30#include <excite.h>
30 31
31static int excite_get_unit_id(char *buf, char **addr, off_t offs, int size) 32static int excite_unit_id_proc_show(struct seq_file *m, void *v)
32{ 33{
33 const int len = snprintf(buf, PAGE_SIZE, "%06x", unit_id); 34 seq_printf(m, "%06x", unit_id);
34 const int w = len - offs; 35 return 0;
35 *addr = buf + offs;
36 return w < size ? w : size;
37} 36}
38 37
38static int excite_unit_id_proc_open(struct inode *inode, struct file *file)
39{
40 return single_open(file, excite_unit_id_proc_show, NULL);
41}
42
43static const struct file_operations excite_unit_id_proc_fops = {
44 .owner = THIS_MODULE,
45 .open = excite_unit_id_proc_open,
46 .read = seq_read,
47 .llseek = seq_lseek,
48 .release = single_release,
49};
50
39static int 51static int
40excite_bootrom_read(char *page, char **start, off_t off, int count, 52excite_bootrom_read(char *page, char **start, off_t off, int count,
41 int *eof, void *data) 53 int *eof, void *data)
@@ -65,12 +77,12 @@ excite_bootrom_read(char *page, char **start, off_t off, int count,
65void excite_procfs_init(void) 77void excite_procfs_init(void)
66{ 78{
67 /* Create & populate /proc/excite */ 79 /* Create & populate /proc/excite */
68 struct proc_dir_entry * const pdir = proc_mkdir("excite", &proc_root); 80 struct proc_dir_entry * const pdir = proc_mkdir("excite", NULL);
69 if (pdir) { 81 if (pdir) {
70 struct proc_dir_entry * e; 82 struct proc_dir_entry * e;
71 83
72 e = create_proc_info_entry("unit_id", S_IRUGO, pdir, 84 e = proc_create("unit_id", S_IRUGO, pdir,
73 excite_get_unit_id); 85 &excite_unit_id_proc_fops);
74 if (e) e->size = 6; 86 if (e) e->size = 6;
75 87
76 e = create_proc_read_entry("bootrom", S_IRUGO, pdir, 88 e = create_proc_read_entry("bootrom", S_IRUGO, pdir,
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 5bf03b3c4150..72942226fcdd 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -13,327 +13,285 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16 16#include <linux/kbuild.h>
17#include <asm/ptrace.h> 17#include <asm/ptrace.h>
18#include <asm/processor.h> 18#include <asm/processor.h>
19 19
20#define text(t) __asm__("\n->#" t)
21#define _offset(type, member) (&(((type *)NULL)->member))
22#define offset(string, ptr, member) \
23 __asm__("\n->" string " %0" : : "i" (_offset(ptr, member)))
24#define constant(string, member) \
25 __asm__("\n->" string " %0" : : "ri" (member))
26#define size(string, size) \
27 __asm__("\n->" string " %0" : : "i" (sizeof(size)))
28#define linefeed text("")
29
30void output_ptreg_defines(void) 20void output_ptreg_defines(void)
31{ 21{
32 text("MIPS pt_regs offsets."); 22 COMMENT("MIPS pt_regs offsets.");
33 offset("PT_R0", struct pt_regs, regs[0]); 23 OFFSET(PT_R0, pt_regs, regs[0]);
34 offset("PT_R1", struct pt_regs, regs[1]); 24 OFFSET(PT_R1, pt_regs, regs[1]);
35 offset("PT_R2", struct pt_regs, regs[2]); 25 OFFSET(PT_R2, pt_regs, regs[2]);
36 offset("PT_R3", struct pt_regs, regs[3]); 26 OFFSET(PT_R3, pt_regs, regs[3]);
37 offset("PT_R4", struct pt_regs, regs[4]); 27 OFFSET(PT_R4, pt_regs, regs[4]);
38 offset("PT_R5", struct pt_regs, regs[5]); 28 OFFSET(PT_R5, pt_regs, regs[5]);
39 offset("PT_R6", struct pt_regs, regs[6]); 29 OFFSET(PT_R6, pt_regs, regs[6]);
40 offset("PT_R7", struct pt_regs, regs[7]); 30 OFFSET(PT_R7, pt_regs, regs[7]);
41 offset("PT_R8", struct pt_regs, regs[8]); 31 OFFSET(PT_R8, pt_regs, regs[8]);
42 offset("PT_R9", struct pt_regs, regs[9]); 32 OFFSET(PT_R9, pt_regs, regs[9]);
43 offset("PT_R10", struct pt_regs, regs[10]); 33 OFFSET(PT_R10, pt_regs, regs[10]);
44 offset("PT_R11", struct pt_regs, regs[11]); 34 OFFSET(PT_R11, pt_regs, regs[11]);
45 offset("PT_R12", struct pt_regs, regs[12]); 35 OFFSET(PT_R12, pt_regs, regs[12]);
46 offset("PT_R13", struct pt_regs, regs[13]); 36 OFFSET(PT_R13, pt_regs, regs[13]);
47 offset("PT_R14", struct pt_regs, regs[14]); 37 OFFSET(PT_R14, pt_regs, regs[14]);
48 offset("PT_R15", struct pt_regs, regs[15]); 38 OFFSET(PT_R15, pt_regs, regs[15]);
49 offset("PT_R16", struct pt_regs, regs[16]); 39 OFFSET(PT_R16, pt_regs, regs[16]);
50 offset("PT_R17", struct pt_regs, regs[17]); 40 OFFSET(PT_R17, pt_regs, regs[17]);
51 offset("PT_R18", struct pt_regs, regs[18]); 41 OFFSET(PT_R18, pt_regs, regs[18]);
52 offset("PT_R19", struct pt_regs, regs[19]); 42 OFFSET(PT_R19, pt_regs, regs[19]);
53 offset("PT_R20", struct pt_regs, regs[20]); 43 OFFSET(PT_R20, pt_regs, regs[20]);
54 offset("PT_R21", struct pt_regs, regs[21]); 44 OFFSET(PT_R21, pt_regs, regs[21]);
55 offset("PT_R22", struct pt_regs, regs[22]); 45 OFFSET(PT_R22, pt_regs, regs[22]);
56 offset("PT_R23", struct pt_regs, regs[23]); 46 OFFSET(PT_R23, pt_regs, regs[23]);
57 offset("PT_R24", struct pt_regs, regs[24]); 47 OFFSET(PT_R24, pt_regs, regs[24]);
58 offset("PT_R25", struct pt_regs, regs[25]); 48 OFFSET(PT_R25, pt_regs, regs[25]);
59 offset("PT_R26", struct pt_regs, regs[26]); 49 OFFSET(PT_R26, pt_regs, regs[26]);
60 offset("PT_R27", struct pt_regs, regs[27]); 50 OFFSET(PT_R27, pt_regs, regs[27]);
61 offset("PT_R28", struct pt_regs, regs[28]); 51 OFFSET(PT_R28, pt_regs, regs[28]);
62 offset("PT_R29", struct pt_regs, regs[29]); 52 OFFSET(PT_R29, pt_regs, regs[29]);
63 offset("PT_R30", struct pt_regs, regs[30]); 53 OFFSET(PT_R30, pt_regs, regs[30]);
64 offset("PT_R31", struct pt_regs, regs[31]); 54 OFFSET(PT_R31, pt_regs, regs[31]);
65 offset("PT_LO", struct pt_regs, lo); 55 OFFSET(PT_LO, pt_regs, lo);
66 offset("PT_HI", struct pt_regs, hi); 56 OFFSET(PT_HI, pt_regs, hi);
67#ifdef CONFIG_CPU_HAS_SMARTMIPS 57#ifdef CONFIG_CPU_HAS_SMARTMIPS
68 offset("PT_ACX", struct pt_regs, acx); 58 OFFSET(PT_ACX, pt_regs, acx);
69#endif 59#endif
70 offset("PT_EPC", struct pt_regs, cp0_epc); 60 OFFSET(PT_EPC, pt_regs, cp0_epc);
71 offset("PT_BVADDR", struct pt_regs, cp0_badvaddr); 61 OFFSET(PT_BVADDR, pt_regs, cp0_badvaddr);
72 offset("PT_STATUS", struct pt_regs, cp0_status); 62 OFFSET(PT_STATUS, pt_regs, cp0_status);
73 offset("PT_CAUSE", struct pt_regs, cp0_cause); 63 OFFSET(PT_CAUSE, pt_regs, cp0_cause);
74#ifdef CONFIG_MIPS_MT_SMTC 64#ifdef CONFIG_MIPS_MT_SMTC
75 offset("PT_TCSTATUS", struct pt_regs, cp0_tcstatus); 65 OFFSET(PT_TCSTATUS, pt_regs, cp0_tcstatus);
76#endif /* CONFIG_MIPS_MT_SMTC */ 66#endif /* CONFIG_MIPS_MT_SMTC */
77 size("PT_SIZE", struct pt_regs); 67 DEFINE(PT_SIZE, sizeof(struct pt_regs));
78 linefeed; 68 BLANK();
79} 69}
80 70
81void output_task_defines(void) 71void output_task_defines(void)
82{ 72{
83 text("MIPS task_struct offsets."); 73 COMMENT("MIPS task_struct offsets.");
84 offset("TASK_STATE", struct task_struct, state); 74 OFFSET(TASK_STATE, task_struct, state);
85 offset("TASK_THREAD_INFO", struct task_struct, stack); 75 OFFSET(TASK_THREAD_INFO, task_struct, stack);
86 offset("TASK_FLAGS", struct task_struct, flags); 76 OFFSET(TASK_FLAGS, task_struct, flags);
87 offset("TASK_MM", struct task_struct, mm); 77 OFFSET(TASK_MM, task_struct, mm);
88 offset("TASK_PID", struct task_struct, pid); 78 OFFSET(TASK_PID, task_struct, pid);
89 size( "TASK_STRUCT_SIZE", struct task_struct); 79 DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct));
90 linefeed; 80 BLANK();
91} 81}
92 82
93void output_thread_info_defines(void) 83void output_thread_info_defines(void)
94{ 84{
95 text("MIPS thread_info offsets."); 85 COMMENT("MIPS thread_info offsets.");
96 offset("TI_TASK", struct thread_info, task); 86 OFFSET(TI_TASK, thread_info, task);
97 offset("TI_EXEC_DOMAIN", struct thread_info, exec_domain); 87 OFFSET(TI_EXEC_DOMAIN, thread_info, exec_domain);
98 offset("TI_FLAGS", struct thread_info, flags); 88 OFFSET(TI_FLAGS, thread_info, flags);
99 offset("TI_TP_VALUE", struct thread_info, tp_value); 89 OFFSET(TI_TP_VALUE, thread_info, tp_value);
100 offset("TI_CPU", struct thread_info, cpu); 90 OFFSET(TI_CPU, thread_info, cpu);
101 offset("TI_PRE_COUNT", struct thread_info, preempt_count); 91 OFFSET(TI_PRE_COUNT, thread_info, preempt_count);
102 offset("TI_ADDR_LIMIT", struct thread_info, addr_limit); 92 OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
103 offset("TI_RESTART_BLOCK", struct thread_info, restart_block); 93 OFFSET(TI_RESTART_BLOCK, thread_info, restart_block);
104 offset("TI_REGS", struct thread_info, regs); 94 OFFSET(TI_REGS, thread_info, regs);
105 constant("_THREAD_SIZE", THREAD_SIZE); 95 DEFINE(_THREAD_SIZE, THREAD_SIZE);
106 constant("_THREAD_MASK", THREAD_MASK); 96 DEFINE(_THREAD_MASK, THREAD_MASK);
107 linefeed; 97 BLANK();
108} 98}
109 99
110void output_thread_defines(void) 100void output_thread_defines(void)
111{ 101{
112 text("MIPS specific thread_struct offsets."); 102 COMMENT("MIPS specific thread_struct offsets.");
113 offset("THREAD_REG16", struct task_struct, thread.reg16); 103 OFFSET(THREAD_REG16, task_struct, thread.reg16);
114 offset("THREAD_REG17", struct task_struct, thread.reg17); 104 OFFSET(THREAD_REG17, task_struct, thread.reg17);
115 offset("THREAD_REG18", struct task_struct, thread.reg18); 105 OFFSET(THREAD_REG18, task_struct, thread.reg18);
116 offset("THREAD_REG19", struct task_struct, thread.reg19); 106 OFFSET(THREAD_REG19, task_struct, thread.reg19);
117 offset("THREAD_REG20", struct task_struct, thread.reg20); 107 OFFSET(THREAD_REG20, task_struct, thread.reg20);
118 offset("THREAD_REG21", struct task_struct, thread.reg21); 108 OFFSET(THREAD_REG21, task_struct, thread.reg21);
119 offset("THREAD_REG22", struct task_struct, thread.reg22); 109 OFFSET(THREAD_REG22, task_struct, thread.reg22);
120 offset("THREAD_REG23", struct task_struct, thread.reg23); 110 OFFSET(THREAD_REG23, task_struct, thread.reg23);
121 offset("THREAD_REG29", struct task_struct, thread.reg29); 111 OFFSET(THREAD_REG29, task_struct, thread.reg29);
122 offset("THREAD_REG30", struct task_struct, thread.reg30); 112 OFFSET(THREAD_REG30, task_struct, thread.reg30);
123 offset("THREAD_REG31", struct task_struct, thread.reg31); 113 OFFSET(THREAD_REG31, task_struct, thread.reg31);
124 offset("THREAD_STATUS", struct task_struct, 114 OFFSET(THREAD_STATUS, task_struct,
125 thread.cp0_status); 115 thread.cp0_status);
126 offset("THREAD_FPU", struct task_struct, thread.fpu); 116 OFFSET(THREAD_FPU, task_struct, thread.fpu);
127 117
128 offset("THREAD_BVADDR", struct task_struct, \ 118 OFFSET(THREAD_BVADDR, task_struct, \
129 thread.cp0_badvaddr); 119 thread.cp0_badvaddr);
130 offset("THREAD_BUADDR", struct task_struct, \ 120 OFFSET(THREAD_BUADDR, task_struct, \
131 thread.cp0_baduaddr); 121 thread.cp0_baduaddr);
132 offset("THREAD_ECODE", struct task_struct, \ 122 OFFSET(THREAD_ECODE, task_struct, \
133 thread.error_code); 123 thread.error_code);
134 offset("THREAD_TRAPNO", struct task_struct, thread.trap_no); 124 OFFSET(THREAD_TRAPNO, task_struct, thread.trap_no);
135 offset("THREAD_TRAMP", struct task_struct, \ 125 OFFSET(THREAD_TRAMP, task_struct, \
136 thread.irix_trampoline); 126 thread.irix_trampoline);
137 offset("THREAD_OLDCTX", struct task_struct, \ 127 OFFSET(THREAD_OLDCTX, task_struct, \
138 thread.irix_oldctx); 128 thread.irix_oldctx);
139 linefeed; 129 BLANK();
140} 130}
141 131
142void output_thread_fpu_defines(void) 132void output_thread_fpu_defines(void)
143{ 133{
144 offset("THREAD_FPR0", 134 OFFSET(THREAD_FPR0, task_struct, thread.fpu.fpr[0]);
145 struct task_struct, thread.fpu.fpr[0]); 135 OFFSET(THREAD_FPR1, task_struct, thread.fpu.fpr[1]);
146 offset("THREAD_FPR1", 136 OFFSET(THREAD_FPR2, task_struct, thread.fpu.fpr[2]);
147 struct task_struct, thread.fpu.fpr[1]); 137 OFFSET(THREAD_FPR3, task_struct, thread.fpu.fpr[3]);
148 offset("THREAD_FPR2", 138 OFFSET(THREAD_FPR4, task_struct, thread.fpu.fpr[4]);
149 struct task_struct, thread.fpu.fpr[2]); 139 OFFSET(THREAD_FPR5, task_struct, thread.fpu.fpr[5]);
150 offset("THREAD_FPR3", 140 OFFSET(THREAD_FPR6, task_struct, thread.fpu.fpr[6]);
151 struct task_struct, thread.fpu.fpr[3]); 141 OFFSET(THREAD_FPR7, task_struct, thread.fpu.fpr[7]);
152 offset("THREAD_FPR4", 142 OFFSET(THREAD_FPR8, task_struct, thread.fpu.fpr[8]);
153 struct task_struct, thread.fpu.fpr[4]); 143 OFFSET(THREAD_FPR9, task_struct, thread.fpu.fpr[9]);
154 offset("THREAD_FPR5", 144 OFFSET(THREAD_FPR10, task_struct, thread.fpu.fpr[10]);
155 struct task_struct, thread.fpu.fpr[5]); 145 OFFSET(THREAD_FPR11, task_struct, thread.fpu.fpr[11]);
156 offset("THREAD_FPR6", 146 OFFSET(THREAD_FPR12, task_struct, thread.fpu.fpr[12]);
157 struct task_struct, thread.fpu.fpr[6]); 147 OFFSET(THREAD_FPR13, task_struct, thread.fpu.fpr[13]);
158 offset("THREAD_FPR7", 148 OFFSET(THREAD_FPR14, task_struct, thread.fpu.fpr[14]);
159 struct task_struct, thread.fpu.fpr[7]); 149 OFFSET(THREAD_FPR15, task_struct, thread.fpu.fpr[15]);
160 offset("THREAD_FPR8", 150 OFFSET(THREAD_FPR16, task_struct, thread.fpu.fpr[16]);
161 struct task_struct, thread.fpu.fpr[8]); 151 OFFSET(THREAD_FPR17, task_struct, thread.fpu.fpr[17]);
162 offset("THREAD_FPR9", 152 OFFSET(THREAD_FPR18, task_struct, thread.fpu.fpr[18]);
163 struct task_struct, thread.fpu.fpr[9]); 153 OFFSET(THREAD_FPR19, task_struct, thread.fpu.fpr[19]);
164 offset("THREAD_FPR10", 154 OFFSET(THREAD_FPR20, task_struct, thread.fpu.fpr[20]);
165 struct task_struct, thread.fpu.fpr[10]); 155 OFFSET(THREAD_FPR21, task_struct, thread.fpu.fpr[21]);
166 offset("THREAD_FPR11", 156 OFFSET(THREAD_FPR22, task_struct, thread.fpu.fpr[22]);
167 struct task_struct, thread.fpu.fpr[11]); 157 OFFSET(THREAD_FPR23, task_struct, thread.fpu.fpr[23]);
168 offset("THREAD_FPR12", 158 OFFSET(THREAD_FPR24, task_struct, thread.fpu.fpr[24]);
169 struct task_struct, thread.fpu.fpr[12]); 159 OFFSET(THREAD_FPR25, task_struct, thread.fpu.fpr[25]);
170 offset("THREAD_FPR13", 160 OFFSET(THREAD_FPR26, task_struct, thread.fpu.fpr[26]);
171 struct task_struct, thread.fpu.fpr[13]); 161 OFFSET(THREAD_FPR27, task_struct, thread.fpu.fpr[27]);
172 offset("THREAD_FPR14", 162 OFFSET(THREAD_FPR28, task_struct, thread.fpu.fpr[28]);
173 struct task_struct, thread.fpu.fpr[14]); 163 OFFSET(THREAD_FPR29, task_struct, thread.fpu.fpr[29]);
174 offset("THREAD_FPR15", 164 OFFSET(THREAD_FPR30, task_struct, thread.fpu.fpr[30]);
175 struct task_struct, thread.fpu.fpr[15]); 165 OFFSET(THREAD_FPR31, task_struct, thread.fpu.fpr[31]);
176 offset("THREAD_FPR16",
177 struct task_struct, thread.fpu.fpr[16]);
178 offset("THREAD_FPR17",
179 struct task_struct, thread.fpu.fpr[17]);
180 offset("THREAD_FPR18",
181 struct task_struct, thread.fpu.fpr[18]);
182 offset("THREAD_FPR19",
183 struct task_struct, thread.fpu.fpr[19]);
184 offset("THREAD_FPR20",
185 struct task_struct, thread.fpu.fpr[20]);
186 offset("THREAD_FPR21",
187 struct task_struct, thread.fpu.fpr[21]);
188 offset("THREAD_FPR22",
189 struct task_struct, thread.fpu.fpr[22]);
190 offset("THREAD_FPR23",
191 struct task_struct, thread.fpu.fpr[23]);
192 offset("THREAD_FPR24",
193 struct task_struct, thread.fpu.fpr[24]);
194 offset("THREAD_FPR25",
195 struct task_struct, thread.fpu.fpr[25]);
196 offset("THREAD_FPR26",
197 struct task_struct, thread.fpu.fpr[26]);
198 offset("THREAD_FPR27",
199 struct task_struct, thread.fpu.fpr[27]);
200 offset("THREAD_FPR28",
201 struct task_struct, thread.fpu.fpr[28]);
202 offset("THREAD_FPR29",
203 struct task_struct, thread.fpu.fpr[29]);
204 offset("THREAD_FPR30",
205 struct task_struct, thread.fpu.fpr[30]);
206 offset("THREAD_FPR31",
207 struct task_struct, thread.fpu.fpr[31]);
208 166
209 offset("THREAD_FCR31", 167 OFFSET(THREAD_FCR31, task_struct, thread.fpu.fcr31);
210 struct task_struct, thread.fpu.fcr31); 168 BLANK();
211 linefeed;
212} 169}
213 170
214void output_mm_defines(void) 171void output_mm_defines(void)
215{ 172{
216 text("Size of struct page"); 173 COMMENT("Size of struct page");
217 size("STRUCT_PAGE_SIZE", struct page); 174 DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page));
218 linefeed; 175 BLANK();
219 text("Linux mm_struct offsets."); 176 COMMENT("Linux mm_struct offsets.");
220 offset("MM_USERS", struct mm_struct, mm_users); 177 OFFSET(MM_USERS, mm_struct, mm_users);
221 offset("MM_PGD", struct mm_struct, pgd); 178 OFFSET(MM_PGD, mm_struct, pgd);
222 offset("MM_CONTEXT", struct mm_struct, context); 179 OFFSET(MM_CONTEXT, mm_struct, context);
223 linefeed; 180 BLANK();
224 constant("_PAGE_SIZE", PAGE_SIZE); 181 DEFINE(_PAGE_SIZE, PAGE_SIZE);
225 constant("_PAGE_SHIFT", PAGE_SHIFT); 182 DEFINE(_PAGE_SHIFT, PAGE_SHIFT);
226 linefeed; 183 BLANK();
227 constant("_PGD_T_SIZE", sizeof(pgd_t)); 184 DEFINE(_PGD_T_SIZE, sizeof(pgd_t));
228 constant("_PMD_T_SIZE", sizeof(pmd_t)); 185 DEFINE(_PMD_T_SIZE, sizeof(pmd_t));
229 constant("_PTE_T_SIZE", sizeof(pte_t)); 186 DEFINE(_PTE_T_SIZE, sizeof(pte_t));
230 linefeed; 187 BLANK();
231 constant("_PGD_T_LOG2", PGD_T_LOG2); 188 DEFINE(_PGD_T_LOG2, PGD_T_LOG2);
232 constant("_PMD_T_LOG2", PMD_T_LOG2); 189 DEFINE(_PMD_T_LOG2, PMD_T_LOG2);
233 constant("_PTE_T_LOG2", PTE_T_LOG2); 190 DEFINE(_PTE_T_LOG2, PTE_T_LOG2);
234 linefeed; 191 BLANK();
235 constant("_PGD_ORDER", PGD_ORDER); 192 DEFINE(_PGD_ORDER, PGD_ORDER);
236 constant("_PMD_ORDER", PMD_ORDER); 193 DEFINE(_PMD_ORDER, PMD_ORDER);
237 constant("_PTE_ORDER", PTE_ORDER); 194 DEFINE(_PTE_ORDER, PTE_ORDER);
238 linefeed; 195 BLANK();
239 constant("_PMD_SHIFT", PMD_SHIFT); 196 DEFINE(_PMD_SHIFT, PMD_SHIFT);
240 constant("_PGDIR_SHIFT", PGDIR_SHIFT); 197 DEFINE(_PGDIR_SHIFT, PGDIR_SHIFT);
241 linefeed; 198 BLANK();
242 constant("_PTRS_PER_PGD", PTRS_PER_PGD); 199 DEFINE(_PTRS_PER_PGD, PTRS_PER_PGD);
243 constant("_PTRS_PER_PMD", PTRS_PER_PMD); 200 DEFINE(_PTRS_PER_PMD, PTRS_PER_PMD);
244 constant("_PTRS_PER_PTE", PTRS_PER_PTE); 201 DEFINE(_PTRS_PER_PTE, PTRS_PER_PTE);
245 linefeed; 202 BLANK();
246} 203}
247 204
248#ifdef CONFIG_32BIT 205#ifdef CONFIG_32BIT
249void output_sc_defines(void) 206void output_sc_defines(void)
250{ 207{
251 text("Linux sigcontext offsets."); 208 COMMENT("Linux sigcontext offsets.");
252 offset("SC_REGS", struct sigcontext, sc_regs); 209 OFFSET(SC_REGS, sigcontext, sc_regs);
253 offset("SC_FPREGS", struct sigcontext, sc_fpregs); 210 OFFSET(SC_FPREGS, sigcontext, sc_fpregs);
254 offset("SC_ACX", struct sigcontext, sc_acx); 211 OFFSET(SC_ACX, sigcontext, sc_acx);
255 offset("SC_MDHI", struct sigcontext, sc_mdhi); 212 OFFSET(SC_MDHI, sigcontext, sc_mdhi);
256 offset("SC_MDLO", struct sigcontext, sc_mdlo); 213 OFFSET(SC_MDLO, sigcontext, sc_mdlo);
257 offset("SC_PC", struct sigcontext, sc_pc); 214 OFFSET(SC_PC, sigcontext, sc_pc);
258 offset("SC_FPC_CSR", struct sigcontext, sc_fpc_csr); 215 OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr);
259 offset("SC_FPC_EIR", struct sigcontext, sc_fpc_eir); 216 OFFSET(SC_FPC_EIR, sigcontext, sc_fpc_eir);
260 offset("SC_HI1", struct sigcontext, sc_hi1); 217 OFFSET(SC_HI1, sigcontext, sc_hi1);
261 offset("SC_LO1", struct sigcontext, sc_lo1); 218 OFFSET(SC_LO1, sigcontext, sc_lo1);
262 offset("SC_HI2", struct sigcontext, sc_hi2); 219 OFFSET(SC_HI2, sigcontext, sc_hi2);
263 offset("SC_LO2", struct sigcontext, sc_lo2); 220 OFFSET(SC_LO2, sigcontext, sc_lo2);
264 offset("SC_HI3", struct sigcontext, sc_hi3); 221 OFFSET(SC_HI3, sigcontext, sc_hi3);
265 offset("SC_LO3", struct sigcontext, sc_lo3); 222 OFFSET(SC_LO3, sigcontext, sc_lo3);
266 linefeed; 223 BLANK();
267} 224}
268#endif 225#endif
269 226
270#ifdef CONFIG_64BIT 227#ifdef CONFIG_64BIT
271void output_sc_defines(void) 228void output_sc_defines(void)
272{ 229{
273 text("Linux sigcontext offsets."); 230 COMMENT("Linux sigcontext offsets.");
274 offset("SC_REGS", struct sigcontext, sc_regs); 231 OFFSET(SC_REGS, sigcontext, sc_regs);
275 offset("SC_FPREGS", struct sigcontext, sc_fpregs); 232 OFFSET(SC_FPREGS, sigcontext, sc_fpregs);
276 offset("SC_MDHI", struct sigcontext, sc_mdhi); 233 OFFSET(SC_MDHI, sigcontext, sc_mdhi);
277 offset("SC_MDLO", struct sigcontext, sc_mdlo); 234 OFFSET(SC_MDLO, sigcontext, sc_mdlo);
278 offset("SC_PC", struct sigcontext, sc_pc); 235 OFFSET(SC_PC, sigcontext, sc_pc);
279 offset("SC_FPC_CSR", struct sigcontext, sc_fpc_csr); 236 OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr);
280 linefeed; 237 BLANK();
281} 238}
282#endif 239#endif
283 240
284#ifdef CONFIG_MIPS32_COMPAT 241#ifdef CONFIG_MIPS32_COMPAT
285void output_sc32_defines(void) 242void output_sc32_defines(void)
286{ 243{
287 text("Linux 32-bit sigcontext offsets."); 244 COMMENT("Linux 32-bit sigcontext offsets.");
288 offset("SC32_FPREGS", struct sigcontext32, sc_fpregs); 245 OFFSET(SC32_FPREGS, sigcontext32, sc_fpregs);
289 offset("SC32_FPC_CSR", struct sigcontext32, sc_fpc_csr); 246 OFFSET(SC32_FPC_CSR, sigcontext32, sc_fpc_csr);
290 offset("SC32_FPC_EIR", struct sigcontext32, sc_fpc_eir); 247 OFFSET(SC32_FPC_EIR, sigcontext32, sc_fpc_eir);
291 linefeed; 248 BLANK();
292} 249}
293#endif 250#endif
294 251
295void output_signal_defined(void) 252void output_signal_defined(void)
296{ 253{
297 text("Linux signal numbers."); 254 COMMENT("Linux signal numbers.");
298 constant("_SIGHUP", SIGHUP); 255 DEFINE(_SIGHUP, SIGHUP);
299 constant("_SIGINT", SIGINT); 256 DEFINE(_SIGINT, SIGINT);
300 constant("_SIGQUIT", SIGQUIT); 257 DEFINE(_SIGQUIT, SIGQUIT);
301 constant("_SIGILL", SIGILL); 258 DEFINE(_SIGILL, SIGILL);
302 constant("_SIGTRAP", SIGTRAP); 259 DEFINE(_SIGTRAP, SIGTRAP);
303 constant("_SIGIOT", SIGIOT); 260 DEFINE(_SIGIOT, SIGIOT);
304 constant("_SIGABRT", SIGABRT); 261 DEFINE(_SIGABRT, SIGABRT);
305 constant("_SIGEMT", SIGEMT); 262 DEFINE(_SIGEMT, SIGEMT);
306 constant("_SIGFPE", SIGFPE); 263 DEFINE(_SIGFPE, SIGFPE);
307 constant("_SIGKILL", SIGKILL); 264 DEFINE(_SIGKILL, SIGKILL);
308 constant("_SIGBUS", SIGBUS); 265 DEFINE(_SIGBUS, SIGBUS);
309 constant("_SIGSEGV", SIGSEGV); 266 DEFINE(_SIGSEGV, SIGSEGV);
310 constant("_SIGSYS", SIGSYS); 267 DEFINE(_SIGSYS, SIGSYS);
311 constant("_SIGPIPE", SIGPIPE); 268 DEFINE(_SIGPIPE, SIGPIPE);
312 constant("_SIGALRM", SIGALRM); 269 DEFINE(_SIGALRM, SIGALRM);
313 constant("_SIGTERM", SIGTERM); 270 DEFINE(_SIGTERM, SIGTERM);
314 constant("_SIGUSR1", SIGUSR1); 271 DEFINE(_SIGUSR1, SIGUSR1);
315 constant("_SIGUSR2", SIGUSR2); 272 DEFINE(_SIGUSR2, SIGUSR2);
316 constant("_SIGCHLD", SIGCHLD); 273 DEFINE(_SIGCHLD, SIGCHLD);
317 constant("_SIGPWR", SIGPWR); 274 DEFINE(_SIGPWR, SIGPWR);
318 constant("_SIGWINCH", SIGWINCH); 275 DEFINE(_SIGWINCH, SIGWINCH);
319 constant("_SIGURG", SIGURG); 276 DEFINE(_SIGURG, SIGURG);
320 constant("_SIGIO", SIGIO); 277 DEFINE(_SIGIO, SIGIO);
321 constant("_SIGSTOP", SIGSTOP); 278 DEFINE(_SIGSTOP, SIGSTOP);
322 constant("_SIGTSTP", SIGTSTP); 279 DEFINE(_SIGTSTP, SIGTSTP);
323 constant("_SIGCONT", SIGCONT); 280 DEFINE(_SIGCONT, SIGCONT);
324 constant("_SIGTTIN", SIGTTIN); 281 DEFINE(_SIGTTIN, SIGTTIN);
325 constant("_SIGTTOU", SIGTTOU); 282 DEFINE(_SIGTTOU, SIGTTOU);
326 constant("_SIGVTALRM", SIGVTALRM); 283 DEFINE(_SIGVTALRM, SIGVTALRM);
327 constant("_SIGPROF", SIGPROF); 284 DEFINE(_SIGPROF, SIGPROF);
328 constant("_SIGXCPU", SIGXCPU); 285 DEFINE(_SIGXCPU, SIGXCPU);
329 constant("_SIGXFSZ", SIGXFSZ); 286 DEFINE(_SIGXFSZ, SIGXFSZ);
330 linefeed; 287 BLANK();
331} 288}
332 289
333void output_irq_cpustat_t_defines(void) 290void output_irq_cpustat_t_defines(void)
334{ 291{
335 text("Linux irq_cpustat_t offsets."); 292 COMMENT("Linux irq_cpustat_t offsets.");
336 offset("IC_SOFTIRQ_PENDING", irq_cpustat_t, __softirq_pending); 293 DEFINE(IC_SOFTIRQ_PENDING,
337 size("IC_IRQ_CPUSTAT_T", irq_cpustat_t); 294 offsetof(irq_cpustat_t, __softirq_pending));
338 linefeed; 295 DEFINE(IC_IRQ_CPUSTAT_T, sizeof(irq_cpustat_t));
296 BLANK();
339} 297}
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
index 77db3473deab..9fdd8bcdd21e 100644
--- a/arch/mips/kernel/binfmt_elfn32.c
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -54,6 +54,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
54#include <linux/module.h> 54#include <linux/module.h>
55#include <linux/elfcore.h> 55#include <linux/elfcore.h>
56#include <linux/compat.h> 56#include <linux/compat.h>
57#include <linux/math64.h>
57 58
58#define elf_prstatus elf_prstatus32 59#define elf_prstatus elf_prstatus32
59struct elf_prstatus32 60struct elf_prstatus32
@@ -102,8 +103,8 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
102 * one divide. 103 * one divide.
103 */ 104 */
104 u64 nsec = (u64)jiffies * TICK_NSEC; 105 u64 nsec = (u64)jiffies * TICK_NSEC;
105 long rem; 106 u32 rem;
106 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem); 107 value->tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
107 value->tv_usec = rem / NSEC_PER_USEC; 108 value->tv_usec = rem / NSEC_PER_USEC;
108} 109}
109 110
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index 08f4cd781ee3..e1333d7319e2 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -56,6 +56,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
56#include <linux/module.h> 56#include <linux/module.h>
57#include <linux/elfcore.h> 57#include <linux/elfcore.h>
58#include <linux/compat.h> 58#include <linux/compat.h>
59#include <linux/math64.h>
59 60
60#define elf_prstatus elf_prstatus32 61#define elf_prstatus elf_prstatus32
61struct elf_prstatus32 62struct elf_prstatus32
@@ -104,8 +105,8 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
104 * one divide. 105 * one divide.
105 */ 106 */
106 u64 nsec = (u64)jiffies * TICK_NSEC; 107 u64 nsec = (u64)jiffies * TICK_NSEC;
107 long rem; 108 u32 rem;
108 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem); 109 value->tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
109 value->tv_usec = rem / NSEC_PER_USEC; 110 value->tv_usec = rem / NSEC_PER_USEC;
110} 111}
111 112
diff --git a/arch/mips/kernel/irixioctl.c b/arch/mips/kernel/irixioctl.c
index 2bde200d5ad0..b39bdba82e02 100644
--- a/arch/mips/kernel/irixioctl.c
+++ b/arch/mips/kernel/irixioctl.c
@@ -27,33 +27,6 @@ struct irix_termios {
27 cc_t c_cc[NCCS]; 27 cc_t c_cc[NCCS];
28}; 28};
29 29
30extern void start_tty(struct tty_struct *tty);
31static struct tty_struct *get_tty(int fd)
32{
33 struct file *filp;
34 struct tty_struct *ttyp = NULL;
35
36 rcu_read_lock();
37 filp = fcheck(fd);
38 if(filp && filp->private_data) {
39 ttyp = (struct tty_struct *) filp->private_data;
40
41 if(ttyp->magic != TTY_MAGIC)
42 ttyp =NULL;
43 }
44 rcu_read_unlock();
45 return ttyp;
46}
47
48static struct tty_struct *get_real_tty(struct tty_struct *tp)
49{
50 if (tp->driver->type == TTY_DRIVER_TYPE_PTY &&
51 tp->driver->subtype == PTY_TYPE_MASTER)
52 return tp->link;
53 else
54 return tp;
55}
56
57asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg) 30asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
58{ 31{
59 struct tty_struct *tp, *rtp; 32 struct tty_struct *tp, *rtp;
@@ -146,34 +119,24 @@ asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
146 error = sys_ioctl(fd, TIOCNOTTY, arg); 119 error = sys_ioctl(fd, TIOCNOTTY, arg);
147 break; 120 break;
148 121
149 case 0x00007416: 122 case 0x00007416: {
123 pid_t pid;
150#ifdef DEBUG_IOCTLS 124#ifdef DEBUG_IOCTLS
151 printk("TIOCGSID, %08lx) ", arg); 125 printk("TIOCGSID, %08lx) ", arg);
152#endif 126#endif
153 tp = get_tty(fd); 127 old_fs = get_fs(); set_fs(get_ds());
154 if(!tp) { 128 error = sys_ioctl(fd, TIOCGSID, (unsigned long)&pid);
155 error = -EINVAL; 129 set_fs(old_fs);
156 break; 130 if (!error)
157 } 131 error = put_user(pid, (unsigned long __user *) arg);
158 rtp = get_real_tty(tp);
159#ifdef DEBUG_IOCTLS
160 printk("rtp->session=%d ", rtp->session);
161#endif
162 error = put_user(rtp->session, (unsigned long __user *) arg);
163 break; 132 break;
164 133 }
165 case 0x746e: 134 case 0x746e:
166 /* TIOCSTART, same effect as hitting ^Q */ 135 /* TIOCSTART, same effect as hitting ^Q */
167#ifdef DEBUG_IOCTLS 136#ifdef DEBUG_IOCTLS
168 printk("TIOCSTART, %08lx) ", arg); 137 printk("TIOCSTART, %08lx) ", arg);
169#endif 138#endif
170 tp = get_tty(fd); 139 error = sys_ioctl(fd, TCXONC, TCOON);
171 if(!tp) {
172 error = -EINVAL;
173 break;
174 }
175 rtp = get_real_tty(tp);
176 start_tty(rtp);
177 break; 140 break;
178 141
179 case 0x20006968: 142 case 0x20006968:
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 998c4efcce88..ceb62dce1c9c 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -20,6 +20,7 @@
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/unistd.h> 21#include <linux/unistd.h>
22#include <linux/file.h> 22#include <linux/file.h>
23#include <linux/fdtable.h>
23#include <linux/fs.h> 24#include <linux/fs.h>
24#include <linux/syscalls.h> 25#include <linux/syscalls.h>
25#include <linux/workqueue.h> 26#include <linux/workqueue.h>
diff --git a/arch/mips/lib/iomap-pci.c b/arch/mips/lib/iomap-pci.c
index c11b2494bb6e..2ab899c4b4ce 100644
--- a/arch/mips/lib/iomap-pci.c
+++ b/arch/mips/lib/iomap-pci.c
@@ -45,8 +45,8 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
45 */ 45 */
46void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 46void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
47{ 47{
48 unsigned long start = pci_resource_start(dev, bar); 48 resource_size_t start = pci_resource_start(dev, bar);
49 unsigned long len = pci_resource_len(dev, bar); 49 resource_size_t len = pci_resource_len(dev, bar);
50 unsigned long flags = pci_resource_flags(dev, bar); 50 unsigned long flags = pci_resource_flags(dev, bar);
51 51
52 if (!len || !start) 52 if (!len || !start)
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 855977ca51cd..6537d90a25bb 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -143,9 +143,6 @@ void __init plat_time_init(void)
143mips_hpt_frequency = 33000000 * 3 * 5; 143mips_hpt_frequency = 33000000 * 3 * 5;
144} 144}
145 145
146/* No other usable initialization hook than this ... */
147extern void (*late_time_init)(void);
148
149unsigned long ocd_base; 146unsigned long ocd_base;
150 147
151EXPORT_SYMBOL(ocd_base); 148EXPORT_SYMBOL(ocd_base);
diff --git a/arch/mn10300/kernel/asm-offsets.c b/arch/mn10300/kernel/asm-offsets.c
index ee2d9f8af5ad..2646fcbd7d89 100644
--- a/arch/mn10300/kernel/asm-offsets.c
+++ b/arch/mn10300/kernel/asm-offsets.c
@@ -7,6 +7,7 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/signal.h> 8#include <linux/signal.h>
9#include <linux/personality.h> 9#include <linux/personality.h>
10#include <linux/kbuild.h>
10#include <asm/ucontext.h> 11#include <asm/ucontext.h>
11#include <asm/processor.h> 12#include <asm/processor.h>
12#include <asm/thread_info.h> 13#include <asm/thread_info.h>
@@ -14,14 +15,6 @@
14#include "sigframe.h" 15#include "sigframe.h"
15#include "mn10300-serial.h" 16#include "mn10300-serial.h"
16 17
17#define DEFINE(sym, val) \
18 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
19
20#define BLANK() asm volatile("\n->")
21
22#define OFFSET(sym, str, mem) \
23 DEFINE(sym, offsetof(struct str, mem));
24
25void foo(void) 18void foo(void)
26{ 19{
27 OFFSET(SIGCONTEXT_d0, sigcontext, d0); 20 OFFSET(SIGCONTEXT_d0, sigcontext, d0);
diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c
index 5f17a1ebc825..bca5a84dc72c 100644
--- a/arch/mn10300/kernel/sys_mn10300.c
+++ b/arch/mn10300/kernel/sys_mn10300.c
@@ -29,23 +29,6 @@
29#define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */ 29#define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */
30 30
31/* 31/*
32 * sys_pipe() is the normal C calling standard for creating
33 * a pipe. It's not the way Unix traditionally does this, though.
34 */
35asmlinkage long sys_pipe(unsigned long __user *fildes)
36{
37 int fd[2];
38 int error;
39
40 error = do_pipe(fd);
41 if (!error) {
42 if (copy_to_user(fildes, fd, 2 * sizeof(int)))
43 error = -EFAULT;
44 }
45 return error;
46}
47
48/*
49 * memory mapping syscall 32 * memory mapping syscall
50 */ 33 */
51asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 34asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
diff --git a/arch/mn10300/unit-asb2305/pci-iomap.c b/arch/mn10300/unit-asb2305/pci-iomap.c
index dbceae4307da..c1a8d8f941fd 100644
--- a/arch/mn10300/unit-asb2305/pci-iomap.c
+++ b/arch/mn10300/unit-asb2305/pci-iomap.c
@@ -16,8 +16,8 @@
16 */ 16 */
17void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 17void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
18{ 18{
19 unsigned long start = pci_resource_start(dev, bar); 19 resource_size_t start = pci_resource_start(dev, bar);
20 unsigned long len = pci_resource_len(dev, bar); 20 resource_size_t len = pci_resource_len(dev, bar);
21 unsigned long flags = pci_resource_flags(dev, bar); 21 unsigned long flags = pci_resource_flags(dev, bar);
22 22
23 if (!len || !start) 23 if (!len || !start)
diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c
index eaa79bc14d94..3efc0b73e4ff 100644
--- a/arch/parisc/kernel/asm-offsets.c
+++ b/arch/parisc/kernel/asm-offsets.c
@@ -32,6 +32,7 @@
32#include <linux/thread_info.h> 32#include <linux/thread_info.h>
33#include <linux/ptrace.h> 33#include <linux/ptrace.h>
34#include <linux/hardirq.h> 34#include <linux/hardirq.h>
35#include <linux/kbuild.h>
35 36
36#include <asm/pgtable.h> 37#include <asm/pgtable.h>
37#include <asm/ptrace.h> 38#include <asm/ptrace.h>
@@ -39,11 +40,6 @@
39#include <asm/pdc.h> 40#include <asm/pdc.h>
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
41 42
42#define DEFINE(sym, val) \
43 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
44
45#define BLANK() asm volatile("\n->" : : )
46
47#ifdef CONFIG_64BIT 43#ifdef CONFIG_64BIT
48#define FRAME_SIZE 128 44#define FRAME_SIZE 128
49#else 45#else
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 9448d4e91142..ccd61b9567a6 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -397,10 +397,9 @@ pcxl_dma_init(void)
397 "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); 397 "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
398 else { 398 else {
399 struct proc_dir_entry* ent; 399 struct proc_dir_entry* ent;
400 ent = create_proc_entry("pcxl_dma", 0, proc_gsc_root); 400 ent = proc_create("pcxl_dma", 0, proc_gsc_root,
401 if (ent) 401 &proc_pcxl_dma_ops);
402 ent->proc_fops = &proc_pcxl_dma_ops; 402 if (!ent)
403 else
404 printk(KERN_WARNING 403 printk(KERN_WARNING
405 "pci-dma.c: Unable to create pcxl_dma /proc entry.\n"); 404 "pci-dma.c: Unable to create pcxl_dma /proc entry.\n");
406 } 405 }
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 4f589216b39e..71b31957c8f1 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -33,19 +33,6 @@
33#include <linux/utsname.h> 33#include <linux/utsname.h>
34#include <linux/personality.h> 34#include <linux/personality.h>
35 35
36int sys_pipe(int __user *fildes)
37{
38 int fd[2];
39 int error;
40
41 error = do_pipe(fd);
42 if (!error) {
43 if (copy_to_user(fildes, fd, 2*sizeof(int)))
44 error = -EFAULT;
45 }
46 return error;
47}
48
49static unsigned long get_unshared_area(unsigned long addr, unsigned long len) 36static unsigned long get_unshared_area(unsigned long addr, unsigned long len)
50{ 37{
51 struct vm_area_struct *vma; 38 struct vm_area_struct *vma;
diff --git a/arch/parisc/lib/iomap.c b/arch/parisc/lib/iomap.c
index f4a811690ab3..9abed07db7fc 100644
--- a/arch/parisc/lib/iomap.c
+++ b/arch/parisc/lib/iomap.c
@@ -438,8 +438,8 @@ void ioport_unmap(void __iomem *addr)
438/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 438/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
439void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 439void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
440{ 440{
441 unsigned long start = pci_resource_start(dev, bar); 441 resource_size_t start = pci_resource_start(dev, bar);
442 unsigned long len = pci_resource_len(dev, bar); 442 resource_size_t len = pci_resource_len(dev, bar);
443 unsigned long flags = pci_resource_flags(dev, bar); 443 unsigned long flags = pci_resource_flags(dev, bar);
444 444
445 if (!len || !start) 445 if (!len || !start)
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
index a1ae4d6ec990..72d67564bdfc 100644
--- a/arch/powerpc/boot/dts/sequoia.dts
+++ b/arch/powerpc/boot/dts/sequoia.dts
@@ -342,9 +342,14 @@
342 /* Outbound ranges, one memory and one IO, 342 /* Outbound ranges, one memory and one IO,
343 * later cannot be changed. Chip supports a second 343 * later cannot be changed. Chip supports a second
344 * IO range but we don't use it for now 344 * IO range but we don't use it for now
345 * From the 440EPx user manual:
346 * PCI 1 Memory 1 8000 0000 1 BFFF FFFF 1GB
347 * I/O 1 E800 0000 1 E800 FFFF 64KB
348 * I/O 1 E880 0000 1 EBFF FFFF 56MB
345 */ 349 */
346 ranges = <02000000 0 80000000 1 80000000 0 10000000 350 ranges = <02000000 0 80000000 1 80000000 0 40000000
347 01000000 0 00000000 1 e8000000 0 00100000>; 351 01000000 0 00000000 1 e8000000 0 00010000
352 01000000 0 00000000 1 e8800000 0 03800000>;
348 353
349 /* Inbound 2GB range starting at 0 */ 354 /* Inbound 2GB range starting at 0 */
350 dma-ranges = <42000000 0 0 0 0 0 80000000>; 355 dma-ranges = <42000000 0 0 0 0 0 80000000>;
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index af1d2c894ee1..ec9228d687b0 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -30,6 +30,7 @@
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/hardirq.h> 31#include <linux/hardirq.h>
32#endif 32#endif
33#include <linux/kbuild.h>
33 34
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/page.h> 36#include <asm/page.h>
@@ -51,11 +52,6 @@
51#include <asm/iseries/alpaca.h> 52#include <asm/iseries/alpaca.h>
52#endif 53#endif
53 54
54#define DEFINE(sym, val) \
55 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
56
57#define BLANK() asm volatile("\n->" : : )
58
59int main(void) 55int main(void)
60{ 56{
61 DEFINE(THREAD, offsetof(struct task_struct, thread)); 57 DEFINE(THREAD, offsetof(struct task_struct, thread));
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index b84ec6a2fc94..c2b9dc4fce5d 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -653,7 +653,14 @@ finish_tlb_load:
653 rlwimi r10, r11, 0, 26, 26 /* UX = HWEXEC & USER */ 653 rlwimi r10, r11, 0, 26, 26 /* UX = HWEXEC & USER */
654 654
655 rlwimi r12, r10, 0, 26, 31 /* Insert static perms */ 655 rlwimi r12, r10, 0, 26, 31 /* Insert static perms */
656 rlwinm r12, r12, 0, 20, 15 /* Clear U0-U3 */ 656
657 /*
658 * Clear U0-U3 and WL1 IL1I IL1D IL2I IL2D bits which are added
659 * on newer 440 cores like the 440x6 used on AMCC 460EX/460GT (see
660 * include/asm-powerpc/pgtable-ppc32.h for details).
661 */
662 rlwinm r12, r12, 0, 20, 10
663
657 tlbwe r12, r13, PPC44x_TLB_ATTRIB /* Write ATTRIB */ 664 tlbwe r12, r13, PPC44x_TLB_ATTRIB /* Write ATTRIB */
658 665
659 /* Done...restore registers and get out of here. 666 /* Done...restore registers and get out of here.
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 1ffacc698ffb..1e656b43ad7f 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -591,10 +591,8 @@ int __init lparcfg_init(void)
591 !firmware_has_feature(FW_FEATURE_ISERIES)) 591 !firmware_has_feature(FW_FEATURE_ISERIES))
592 mode |= S_IWUSR; 592 mode |= S_IWUSR;
593 593
594 ent = create_proc_entry("ppc64/lparcfg", mode, NULL); 594 ent = proc_create("ppc64/lparcfg", mode, NULL, &lparcfg_fops);
595 if (ent) { 595 if (!ent) {
596 ent->proc_fops = &lparcfg_fops;
597 } else {
598 printk(KERN_ERR "Failed to create ppc64/lparcfg\n"); 596 printk(KERN_ERR "Failed to create ppc64/lparcfg\n");
599 return -EIO; 597 return -EIO;
600 } 598 }
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 09fcb50c45ae..cf6b5a7d8b3f 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -133,9 +133,6 @@ EXPORT_SYMBOL(adb_try_handler_change);
133EXPORT_SYMBOL(cuda_request); 133EXPORT_SYMBOL(cuda_request);
134EXPORT_SYMBOL(cuda_poll); 134EXPORT_SYMBOL(cuda_poll);
135#endif /* CONFIG_ADB_CUDA */ 135#endif /* CONFIG_ADB_CUDA */
136#ifdef CONFIG_VT
137EXPORT_SYMBOL(kd_mksound);
138#endif
139EXPORT_SYMBOL(to_tm); 136EXPORT_SYMBOL(to_tm);
140 137
141#ifdef CONFIG_PPC32 138#ifdef CONFIG_PPC32
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_ppc64.c
index f78dfce1b771..c647ddef40dc 100644
--- a/arch/powerpc/kernel/proc_ppc64.c
+++ b/arch/powerpc/kernel/proc_ppc64.c
@@ -68,12 +68,11 @@ static int __init proc_ppc64_init(void)
68{ 68{
69 struct proc_dir_entry *pde; 69 struct proc_dir_entry *pde;
70 70
71 pde = create_proc_entry("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL); 71 pde = proc_create_data("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL,
72 &page_map_fops, vdso_data);
72 if (!pde) 73 if (!pde)
73 return 1; 74 return 1;
74 pde->data = vdso_data;
75 pde->size = PAGE_SIZE; 75 pde->size = PAGE_SIZE;
76 pde->proc_fops = &page_map_fops;
77 76
78 return 0; 77 return 0;
79} 78}
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index f2e3bc714d76..f9c6abc84a94 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -255,8 +255,6 @@ static void check_location(struct seq_file *m, const char *c);
255 255
256static int __init proc_rtas_init(void) 256static int __init proc_rtas_init(void)
257{ 257{
258 struct proc_dir_entry *entry;
259
260 if (!machine_is(pseries)) 258 if (!machine_is(pseries))
261 return -ENODEV; 259 return -ENODEV;
262 260
@@ -264,35 +262,20 @@ static int __init proc_rtas_init(void)
264 if (rtas_node == NULL) 262 if (rtas_node == NULL)
265 return -ENODEV; 263 return -ENODEV;
266 264
267 entry = create_proc_entry("ppc64/rtas/progress", S_IRUGO|S_IWUSR, NULL); 265 proc_create("ppc64/rtas/progress", S_IRUGO|S_IWUSR, NULL,
268 if (entry) 266 &ppc_rtas_progress_operations);
269 entry->proc_fops = &ppc_rtas_progress_operations; 267 proc_create("ppc64/rtas/clock", S_IRUGO|S_IWUSR, NULL,
270 268 &ppc_rtas_clock_operations);
271 entry = create_proc_entry("ppc64/rtas/clock", S_IRUGO|S_IWUSR, NULL); 269 proc_create("ppc64/rtas/poweron", S_IWUSR|S_IRUGO, NULL,
272 if (entry) 270 &ppc_rtas_poweron_operations);
273 entry->proc_fops = &ppc_rtas_clock_operations; 271 proc_create("ppc64/rtas/sensors", S_IRUGO, NULL,
274 272 &ppc_rtas_sensors_operations);
275 entry = create_proc_entry("ppc64/rtas/poweron", S_IWUSR|S_IRUGO, NULL); 273 proc_create("ppc64/rtas/frequency", S_IWUSR|S_IRUGO, NULL,
276 if (entry) 274 &ppc_rtas_tone_freq_operations);
277 entry->proc_fops = &ppc_rtas_poweron_operations; 275 proc_create("ppc64/rtas/volume", S_IWUSR|S_IRUGO, NULL,
278 276 &ppc_rtas_tone_volume_operations);
279 entry = create_proc_entry("ppc64/rtas/sensors", S_IRUGO, NULL); 277 proc_create("ppc64/rtas/rmo_buffer", S_IRUSR, NULL,
280 if (entry) 278 &ppc_rtas_rmo_buf_ops);
281 entry->proc_fops = &ppc_rtas_sensors_operations;
282
283 entry = create_proc_entry("ppc64/rtas/frequency", S_IWUSR|S_IRUGO,
284 NULL);
285 if (entry)
286 entry->proc_fops = &ppc_rtas_tone_freq_operations;
287
288 entry = create_proc_entry("ppc64/rtas/volume", S_IWUSR|S_IRUGO, NULL);
289 if (entry)
290 entry->proc_fops = &ppc_rtas_tone_volume_operations;
291
292 entry = create_proc_entry("ppc64/rtas/rmo_buffer", S_IRUSR, NULL);
293 if (entry)
294 entry->proc_fops = &ppc_rtas_rmo_buf_ops;
295
296 return 0; 279 return 0;
297} 280}
298 281
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 627f126d1848..0a5e22b22729 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -704,18 +704,11 @@ static int initialize_flash_pde_data(const char *rtas_call_name,
704static struct proc_dir_entry *create_flash_pde(const char *filename, 704static struct proc_dir_entry *create_flash_pde(const char *filename,
705 const struct file_operations *fops) 705 const struct file_operations *fops)
706{ 706{
707 struct proc_dir_entry *ent = NULL; 707 return proc_create(filename, S_IRUSR | S_IWUSR, NULL, fops);
708
709 ent = create_proc_entry(filename, S_IRUSR | S_IWUSR, NULL);
710 if (ent != NULL) {
711 ent->proc_fops = fops;
712 ent->owner = THIS_MODULE;
713 }
714
715 return ent;
716} 708}
717 709
718static const struct file_operations rtas_flash_operations = { 710static const struct file_operations rtas_flash_operations = {
711 .owner = THIS_MODULE,
719 .read = rtas_flash_read, 712 .read = rtas_flash_read,
720 .write = rtas_flash_write, 713 .write = rtas_flash_write,
721 .open = rtas_excl_open, 714 .open = rtas_excl_open,
@@ -723,6 +716,7 @@ static const struct file_operations rtas_flash_operations = {
723}; 716};
724 717
725static const struct file_operations manage_flash_operations = { 718static const struct file_operations manage_flash_operations = {
719 .owner = THIS_MODULE,
726 .read = manage_flash_read, 720 .read = manage_flash_read,
727 .write = manage_flash_write, 721 .write = manage_flash_write,
728 .open = rtas_excl_open, 722 .open = rtas_excl_open,
@@ -730,6 +724,7 @@ static const struct file_operations manage_flash_operations = {
730}; 724};
731 725
732static const struct file_operations validate_flash_operations = { 726static const struct file_operations validate_flash_operations = {
727 .owner = THIS_MODULE,
733 .read = validate_flash_read, 728 .read = validate_flash_read,
734 .write = validate_flash_write, 729 .write = validate_flash_write,
735 .open = rtas_excl_open, 730 .open = rtas_excl_open,
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index e722a4eeb5d0..4fe69ca24481 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -136,23 +136,6 @@ int sys_ipc(uint call, int first, unsigned long second, long third,
136 return ret; 136 return ret;
137} 137}
138 138
139/*
140 * sys_pipe() is the normal C calling standard for creating
141 * a pipe. It's not the way unix traditionally does this, though.
142 */
143int sys_pipe(int __user *fildes)
144{
145 int fd[2];
146 int error;
147
148 error = do_pipe(fd);
149 if (!error) {
150 if (copy_to_user(fildes, fd, 2*sizeof(int)))
151 error = -EFAULT;
152 }
153 return error;
154}
155
156static inline unsigned long do_mmap2(unsigned long addr, size_t len, 139static inline unsigned long do_mmap2(unsigned long addr, size_t len,
157 unsigned long prot, unsigned long flags, 140 unsigned long prot, unsigned long flags,
158 unsigned long fd, unsigned long off, int shift) 141 unsigned long fd, unsigned long off, int shift)
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 3b26fbd6bec9..73401e83739a 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -149,7 +149,7 @@ EXPORT_SYMBOL(tb_ticks_per_sec); /* for cputime_t conversions */
149u64 tb_to_xs; 149u64 tb_to_xs;
150unsigned tb_to_us; 150unsigned tb_to_us;
151 151
152#define TICKLEN_SCALE TICK_LENGTH_SHIFT 152#define TICKLEN_SCALE NTP_SCALE_SHIFT
153u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ 153u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */
154u64 ticklen_to_xs; /* 0.64 fraction */ 154u64 ticklen_to_xs; /* 0.64 fraction */
155 155
@@ -1007,8 +1007,6 @@ void __init time_init(void)
1007 vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC; 1007 vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC;
1008 vdso_data->tb_to_xs = tb_to_xs; 1008 vdso_data->tb_to_xs = tb_to_xs;
1009 1009
1010 time_freq = 0;
1011
1012 write_sequnlock_irqrestore(&xtime_lock, flags); 1010 write_sequnlock_irqrestore(&xtime_lock, flags);
1013 1011
1014 /* Register the clocksource, if we're not running on iSeries */ 1012 /* Register the clocksource, if we're not running on iSeries */
diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c
index 6d9884a6884a..712d89a28c46 100644
--- a/arch/powerpc/kvm/booke_guest.c
+++ b/arch/powerpc/kvm/booke_guest.c
@@ -49,6 +49,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
49 { "inst_emu", VCPU_STAT(emulated_inst_exits) }, 49 { "inst_emu", VCPU_STAT(emulated_inst_exits) },
50 { "dec", VCPU_STAT(dec_exits) }, 50 { "dec", VCPU_STAT(dec_exits) },
51 { "ext_intr", VCPU_STAT(ext_intr_exits) }, 51 { "ext_intr", VCPU_STAT(ext_intr_exits) },
52 { "halt_wakeup", VCPU_STAT(halt_wakeup) },
52 { NULL } 53 { NULL }
53}; 54};
54 55
@@ -338,6 +339,11 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
338 } 339 }
339 break; 340 break;
340 341
342 case BOOKE_INTERRUPT_FP_UNAVAIL:
343 kvmppc_queue_exception(vcpu, exit_nr);
344 r = RESUME_GUEST;
345 break;
346
341 case BOOKE_INTERRUPT_DATA_STORAGE: 347 case BOOKE_INTERRUPT_DATA_STORAGE:
342 vcpu->arch.dear = vcpu->arch.fault_dear; 348 vcpu->arch.dear = vcpu->arch.fault_dear;
343 vcpu->arch.esr = vcpu->arch.fault_esr; 349 vcpu->arch.esr = vcpu->arch.fault_esr;
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index bad40bd2d3ac..777e0f34e0ea 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -36,13 +36,12 @@ gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
36 36
37int kvm_cpu_has_interrupt(struct kvm_vcpu *v) 37int kvm_cpu_has_interrupt(struct kvm_vcpu *v)
38{ 38{
39 /* XXX implement me */ 39 return !!(v->arch.pending_exceptions);
40 return 0;
41} 40}
42 41
43int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) 42int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
44{ 43{
45 return 1; 44 return !(v->arch.msr & MSR_WE);
46} 45}
47 46
48 47
@@ -214,6 +213,11 @@ static void kvmppc_decrementer_func(unsigned long data)
214 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; 213 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
215 214
216 kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); 215 kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER);
216
217 if (waitqueue_active(&vcpu->wq)) {
218 wake_up_interruptible(&vcpu->wq);
219 vcpu->stat.halt_wakeup++;
220 }
217} 221}
218 222
219int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) 223int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
@@ -339,6 +343,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
339 int r; 343 int r;
340 sigset_t sigsaved; 344 sigset_t sigsaved;
341 345
346 vcpu_load(vcpu);
347
342 if (vcpu->sigset_active) 348 if (vcpu->sigset_active)
343 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); 349 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
344 350
@@ -363,12 +369,20 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
363 if (vcpu->sigset_active) 369 if (vcpu->sigset_active)
364 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 370 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
365 371
372 vcpu_put(vcpu);
373
366 return r; 374 return r;
367} 375}
368 376
369int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) 377int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
370{ 378{
371 kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL); 379 kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL);
380
381 if (waitqueue_active(&vcpu->wq)) {
382 wake_up_interruptible(&vcpu->wq);
383 vcpu->stat.halt_wakeup++;
384 }
385
372 return 0; 386 return 0;
373} 387}
374 388
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 4bb023f4c869..f1d2cdc5331b 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -23,3 +23,4 @@ obj-$(CONFIG_SMP) += locks.o
23endif 23endif
24 24
25obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o 25obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
26obj-$(CONFIG_HAS_IOMEM) += devres.o
diff --git a/arch/powerpc/lib/devres.c b/arch/powerpc/lib/devres.c
new file mode 100644
index 000000000000..292115d98ea9
--- /dev/null
+++ b/arch/powerpc/lib/devres.c
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2008 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#include <linux/device.h> /* devres_*(), devm_ioremap_release() */
11#include <linux/io.h> /* ioremap_flags() */
12#include <linux/module.h> /* EXPORT_SYMBOL() */
13
14/**
15 * devm_ioremap_prot - Managed ioremap_flags()
16 * @dev: Generic device to remap IO address for
17 * @offset: BUS offset to map
18 * @size: Size of map
19 * @flags: Page flags
20 *
21 * Managed ioremap_prot(). Map is automatically unmapped on driver
22 * detach.
23 */
24void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
25 size_t size, unsigned long flags)
26{
27 void __iomem **ptr, *addr;
28
29 ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
30 if (!ptr)
31 return NULL;
32
33 addr = ioremap_flags(offset, size, flags);
34 if (addr) {
35 *ptr = addr;
36 devres_add(dev, ptr);
37 } else
38 devres_free(ptr);
39
40 return addr;
41}
42EXPORT_SYMBOL(devm_ioremap_prot);
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index b962c3ab470c..af116aadba10 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/elf.h> 23#include <linux/elf.h>
24#include <linux/file.h> 24#include <linux/file.h>
25#include <linux/fdtable.h>
25#include <linux/fs.h> 26#include <linux/fs.h>
26#include <linux/list.h> 27#include <linux/list.h>
27#include <linux/module.h> 28#include <linux/module.h>
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 8a05ac863a27..2e411f23462b 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -1068,10 +1068,9 @@ int __init spu_sched_init(void)
1068 1068
1069 mod_timer(&spuloadavg_timer, 0); 1069 mod_timer(&spuloadavg_timer, 0);
1070 1070
1071 entry = create_proc_entry("spu_loadavg", 0, NULL); 1071 entry = proc_create("spu_loadavg", 0, NULL, &spu_loadavg_fops);
1072 if (!entry) 1072 if (!entry)
1073 goto out_stop_kthread; 1073 goto out_stop_kthread;
1074 entry->proc_fops = &spu_loadavg_fops;
1075 1074
1076 pr_debug("spusched: tick: %d, min ticks: %d, default ticks: %d\n", 1075 pr_debug("spusched: tick: %d, min ticks: %d, default ticks: %d\n",
1077 SPUSCHED_TICK, MIN_SPU_TIMESLICE, DEF_SPU_TIMESLICE); 1076 SPUSCHED_TICK, MIN_SPU_TIMESLICE, DEF_SPU_TIMESLICE);
diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c
index b9c79eda3359..53202422ba72 100644
--- a/arch/powerpc/platforms/cell/spufs/sputrace.c
+++ b/arch/powerpc/platforms/cell/spufs/sputrace.c
@@ -201,10 +201,9 @@ static int __init sputrace_init(void)
201 if (!sputrace_log) 201 if (!sputrace_log)
202 goto out; 202 goto out;
203 203
204 entry = create_proc_entry("sputrace", S_IRUSR, NULL); 204 entry = proc_create("sputrace", S_IRUSR, NULL, &sputrace_fops);
205 if (!entry) 205 if (!entry)
206 goto out_free_log; 206 goto out_free_log;
207 entry->proc_fops = &sputrace_fops;
208 207
209 for (i = 0; i < ARRAY_SIZE(spu_probes); i++) { 208 for (i = 0; i < ARRAY_SIZE(spu_probes); i++) {
210 struct spu_probe *p = &spu_probes[i]; 209 struct spu_probe *p = &spu_probes[i];
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index e5b40e3e0082..b0f8a857ec02 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -330,15 +330,11 @@ static const struct file_operations proc_lpevents_operations = {
330 330
331static int __init proc_lpevents_init(void) 331static int __init proc_lpevents_init(void)
332{ 332{
333 struct proc_dir_entry *e;
334
335 if (!firmware_has_feature(FW_FEATURE_ISERIES)) 333 if (!firmware_has_feature(FW_FEATURE_ISERIES))
336 return 0; 334 return 0;
337 335
338 e = create_proc_entry("iSeries/lpevents", S_IFREG|S_IRUGO, NULL); 336 proc_create("iSeries/lpevents", S_IFREG|S_IRUGO, NULL,
339 if (e) 337 &proc_lpevents_operations);
340 e->proc_fops = &proc_lpevents_operations;
341
342 return 0; 338 return 0;
343} 339}
344__initcall(proc_lpevents_init); 340__initcall(proc_lpevents_init);
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index c0f2433bc16e..1dc7295746da 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -1255,11 +1255,11 @@ static int __init mf_proc_init(void)
1255 if (i == 3) /* no vmlinux entry for 'D' */ 1255 if (i == 3) /* no vmlinux entry for 'D' */
1256 continue; 1256 continue;
1257 1257
1258 ent = create_proc_entry("vmlinux", S_IFREG|S_IWUSR, mf); 1258 ent = proc_create_data("vmlinux", S_IFREG|S_IWUSR, mf,
1259 &proc_vmlinux_operations,
1260 (void *)(long)i);
1259 if (!ent) 1261 if (!ent)
1260 return 1; 1262 return 1;
1261 ent->data = (void *)(long)i;
1262 ent->proc_fops = &proc_vmlinux_operations;
1263 } 1263 }
1264 1264
1265 ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); 1265 ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root);
diff --git a/arch/powerpc/platforms/iseries/proc.c b/arch/powerpc/platforms/iseries/proc.c
index f2cde4180204..91f4c6cd4b99 100644
--- a/arch/powerpc/platforms/iseries/proc.c
+++ b/arch/powerpc/platforms/iseries/proc.c
@@ -110,15 +110,11 @@ static const struct file_operations proc_titantod_operations = {
110 110
111static int __init iseries_proc_init(void) 111static int __init iseries_proc_init(void)
112{ 112{
113 struct proc_dir_entry *e;
114
115 if (!firmware_has_feature(FW_FEATURE_ISERIES)) 113 if (!firmware_has_feature(FW_FEATURE_ISERIES))
116 return 0; 114 return 0;
117 115
118 e = create_proc_entry("iSeries/titanTod", S_IFREG|S_IRUGO, NULL); 116 proc_create("iSeries/titanTod", S_IFREG|S_IRUGO, NULL,
119 if (e) 117 &proc_titantod_operations);
120 e->proc_fops = &proc_titantod_operations;
121
122 return 0; 118 return 0;
123} 119}
124__initcall(iseries_proc_init); 120__initcall(iseries_proc_init);
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
index df23331eb25c..49ff4dc422b7 100644
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -180,15 +180,10 @@ static const struct file_operations proc_viopath_operations = {
180 180
181static int __init vio_proc_init(void) 181static int __init vio_proc_init(void)
182{ 182{
183 struct proc_dir_entry *e;
184
185 if (!firmware_has_feature(FW_FEATURE_ISERIES)) 183 if (!firmware_has_feature(FW_FEATURE_ISERIES))
186 return 0; 184 return 0;
187 185
188 e = create_proc_entry("iSeries/config", 0, NULL); 186 proc_create("iSeries/config", 0, NULL, &proc_viopath_operations);
189 if (e)
190 e->proc_fops = &proc_viopath_operations;
191
192 return 0; 187 return 0;
193} 188}
194__initcall(vio_proc_init); 189__initcall(vio_proc_init);
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index a3fd56b186e6..6f544ba4b37f 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -1259,14 +1259,8 @@ static const struct file_operations proc_eeh_operations = {
1259 1259
1260static int __init eeh_init_proc(void) 1260static int __init eeh_init_proc(void)
1261{ 1261{
1262 struct proc_dir_entry *e; 1262 if (machine_is(pseries))
1263 1263 proc_create("ppc64/eeh", 0, NULL, &proc_eeh_operations);
1264 if (machine_is(pseries)) {
1265 e = create_proc_entry("ppc64/eeh", 0, NULL);
1266 if (e)
1267 e->proc_fops = &proc_eeh_operations;
1268 }
1269
1270 return 0; 1264 return 0;
1271} 1265}
1272__initcall(eeh_init_proc); 1266__initcall(eeh_init_proc);
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index ac75c10de278..75769aae41d5 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -512,12 +512,9 @@ static int proc_ppc64_create_ofdt(void)
512 if (!machine_is(pseries)) 512 if (!machine_is(pseries))
513 return 0; 513 return 0;
514 514
515 ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL); 515 ent = proc_create("ppc64/ofdt", S_IWUSR, NULL, &ofdt_fops);
516 if (ent) { 516 if (ent)
517 ent->data = NULL;
518 ent->size = 0; 517 ent->size = 0;
519 ent->proc_fops = &ofdt_fops;
520 }
521 518
522 return 0; 519 return 0;
523} 520}
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index befadd4f9524..7d3e2b0bd4d2 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -468,10 +468,9 @@ static int __init rtas_init(void)
468 return -ENOMEM; 468 return -ENOMEM;
469 } 469 }
470 470
471 entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL); 471 entry = proc_create("ppc64/rtas/error_log", S_IRUSR, NULL,
472 if (entry) 472 &proc_rtas_log_operations);
473 entry->proc_fops = &proc_rtas_log_operations; 473 if (!entry)
474 else
475 printk(KERN_ERR "Failed to create error_log proc entry\n"); 474 printk(KERN_ERR "Failed to create error_log proc entry\n");
476 475
477 if (kernel_thread(rtasd, NULL, CLONE_FS) < 0) 476 if (kernel_thread(rtasd, NULL, CLONE_FS) < 0)
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index bec3803f0618..417eca79df69 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -55,11 +55,6 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
55 dp = PDE(inode); 55 dp = PDE(inode);
56 data = (unsigned int *)dp->data; 56 data = (unsigned int *)dp->data;
57 57
58 if (!data) {
59 printk(KERN_ERR "scanlog: read failed no data\n");
60 return -EIO;
61 }
62
63 if (count > RTAS_DATA_BUF_SIZE) 58 if (count > RTAS_DATA_BUF_SIZE)
64 count = RTAS_DATA_BUF_SIZE; 59 count = RTAS_DATA_BUF_SIZE;
65 60
@@ -146,11 +141,6 @@ static int scanlog_open(struct inode * inode, struct file * file)
146 struct proc_dir_entry *dp = PDE(inode); 141 struct proc_dir_entry *dp = PDE(inode);
147 unsigned int *data = (unsigned int *)dp->data; 142 unsigned int *data = (unsigned int *)dp->data;
148 143
149 if (!data) {
150 printk(KERN_ERR "scanlog: open failed no data\n");
151 return -EIO;
152 }
153
154 if (data[0] != 0) { 144 if (data[0] != 0) {
155 /* This imperfect test stops a second copy of the 145 /* This imperfect test stops a second copy of the
156 * data (or a reset while data is being copied) 146 * data (or a reset while data is being copied)
@@ -168,10 +158,6 @@ static int scanlog_release(struct inode * inode, struct file * file)
168 struct proc_dir_entry *dp = PDE(inode); 158 struct proc_dir_entry *dp = PDE(inode);
169 unsigned int *data = (unsigned int *)dp->data; 159 unsigned int *data = (unsigned int *)dp->data;
170 160
171 if (!data) {
172 printk(KERN_ERR "scanlog: release failed no data\n");
173 return -EIO;
174 }
175 data[0] = 0; 161 data[0] = 0;
176 162
177 return 0; 163 return 0;
@@ -200,12 +186,11 @@ static int __init scanlog_init(void)
200 if (!data) 186 if (!data)
201 goto err; 187 goto err;
202 188
203 ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, 189 ent = proc_create_data("ppc64/rtas/scan-log-dump", S_IRUSR, NULL,
204 &scanlog_fops); 190 &scanlog_fops, data);
205 if (!ent) 191 if (!ent)
206 goto err; 192 goto err;
207 193
208 ent->data = data;
209 proc_ppc64_scan_log_dump = ent; 194 proc_ppc64_scan_log_dump = ent;
210 195
211 return 0; 196 return 0;
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index b59408798fd8..3a7054e2bb75 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -418,22 +418,21 @@ arch_initcall(gfar_of_init);
418#include <linux/i2c.h> 418#include <linux/i2c.h>
419struct i2c_driver_device { 419struct i2c_driver_device {
420 char *of_device; 420 char *of_device;
421 char *i2c_driver;
422 char *i2c_type; 421 char *i2c_type;
423}; 422};
424 423
425static struct i2c_driver_device i2c_devices[] __initdata = { 424static struct i2c_driver_device i2c_devices[] __initdata = {
426 {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",}, 425 {"ricoh,rs5c372a", "rs5c372a"},
427 {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",}, 426 {"ricoh,rs5c372b", "rs5c372b"},
428 {"ricoh,rv5c386", "rtc-rs5c372", "rv5c386",}, 427 {"ricoh,rv5c386", "rv5c386"},
429 {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",}, 428 {"ricoh,rv5c387a", "rv5c387a"},
430 {"dallas,ds1307", "rtc-ds1307", "ds1307",}, 429 {"dallas,ds1307", "ds1307"},
431 {"dallas,ds1337", "rtc-ds1307", "ds1337",}, 430 {"dallas,ds1337", "ds1337"},
432 {"dallas,ds1338", "rtc-ds1307", "ds1338",}, 431 {"dallas,ds1338", "ds1338"},
433 {"dallas,ds1339", "rtc-ds1307", "ds1339",}, 432 {"dallas,ds1339", "ds1339"},
434 {"dallas,ds1340", "rtc-ds1307", "ds1340",}, 433 {"dallas,ds1340", "ds1340"},
435 {"stm,m41t00", "rtc-ds1307", "m41t00"}, 434 {"stm,m41t00", "m41t00"},
436 {"dallas,ds1374", "rtc-ds1374", "rtc-ds1374",}, 435 {"dallas,ds1374", "rtc-ds1374"},
437}; 436};
438 437
439static int __init of_find_i2c_driver(struct device_node *node, 438static int __init of_find_i2c_driver(struct device_node *node,
@@ -444,9 +443,7 @@ static int __init of_find_i2c_driver(struct device_node *node,
444 for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { 443 for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
445 if (!of_device_is_compatible(node, i2c_devices[i].of_device)) 444 if (!of_device_is_compatible(node, i2c_devices[i].of_device))
446 continue; 445 continue;
447 if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver, 446 if (strlcpy(info->type, i2c_devices[i].i2c_type,
448 KOBJ_NAME_LEN) >= KOBJ_NAME_LEN ||
449 strlcpy(info->type, i2c_devices[i].i2c_type,
450 I2C_NAME_SIZE) >= I2C_NAME_SIZE) 447 I2C_NAME_SIZE) >= I2C_NAME_SIZE)
451 return -ENOMEM; 448 return -ENOMEM;
452 return 0; 449 return 0;
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index 1814adbd2236..b4a54c52e880 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -1387,28 +1387,59 @@ static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port,
1387 resource_size_t size = res->end - res->start + 1; 1387 resource_size_t size = res->end - res->start + 1;
1388 u64 sa; 1388 u64 sa;
1389 1389
1390 /* Calculate window size */ 1390 if (port->endpoint) {
1391 sa = (0xffffffffffffffffull << ilog2(size));; 1391 resource_size_t ep_addr = 0;
1392 if (res->flags & IORESOURCE_PREFETCH) 1392 resource_size_t ep_size = 32 << 20;
1393 sa |= 0x8; 1393
1394 /* Currently we map a fixed 64MByte window to PLB address
1395 * 0 (SDRAM). This should probably be configurable via a dts
1396 * property.
1397 */
1398
1399 /* Calculate window size */
1400 sa = (0xffffffffffffffffull << ilog2(ep_size));;
1401
1402 /* Setup BAR0 */
1403 out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa));
1404 out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa) |
1405 PCI_BASE_ADDRESS_MEM_TYPE_64);
1394 1406
1395 out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); 1407 /* Disable BAR1 & BAR2 */
1396 out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa)); 1408 out_le32(mbase + PECFG_BAR1MPA, 0);
1409 out_le32(mbase + PECFG_BAR2HMPA, 0);
1410 out_le32(mbase + PECFG_BAR2LMPA, 0);
1397 1411
1398 /* The setup of the split looks weird to me ... let's see if it works */ 1412 out_le32(mbase + PECFG_PIM01SAH, RES_TO_U32_HIGH(sa));
1399 out_le32(mbase + PECFG_PIM0LAL, 0x00000000); 1413 out_le32(mbase + PECFG_PIM01SAL, RES_TO_U32_LOW(sa));
1400 out_le32(mbase + PECFG_PIM0LAH, 0x00000000); 1414
1401 out_le32(mbase + PECFG_PIM1LAL, 0x00000000); 1415 out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(ep_addr));
1402 out_le32(mbase + PECFG_PIM1LAH, 0x00000000); 1416 out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(ep_addr));
1403 out_le32(mbase + PECFG_PIM01SAH, 0xffff0000); 1417 } else {
1404 out_le32(mbase + PECFG_PIM01SAL, 0x00000000); 1418 /* Calculate window size */
1419 sa = (0xffffffffffffffffull << ilog2(size));;
1420 if (res->flags & IORESOURCE_PREFETCH)
1421 sa |= 0x8;
1422
1423 out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa));
1424 out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa));
1425
1426 /* The setup of the split looks weird to me ... let's see
1427 * if it works
1428 */
1429 out_le32(mbase + PECFG_PIM0LAL, 0x00000000);
1430 out_le32(mbase + PECFG_PIM0LAH, 0x00000000);
1431 out_le32(mbase + PECFG_PIM1LAL, 0x00000000);
1432 out_le32(mbase + PECFG_PIM1LAH, 0x00000000);
1433 out_le32(mbase + PECFG_PIM01SAH, 0xffff0000);
1434 out_le32(mbase + PECFG_PIM01SAL, 0x00000000);
1435
1436 out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(res->start));
1437 out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(res->start));
1438 }
1405 1439
1406 /* Enable inbound mapping */ 1440 /* Enable inbound mapping */
1407 out_le32(mbase + PECFG_PIMEN, 0x1); 1441 out_le32(mbase + PECFG_PIMEN, 0x1);
1408 1442
1409 out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(res->start));
1410 out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(res->start));
1411
1412 /* Enable I/O, Mem, and Busmaster cycles */ 1443 /* Enable I/O, Mem, and Busmaster cycles */
1413 out_le16(mbase + PCI_COMMAND, 1444 out_le16(mbase + PCI_COMMAND,
1414 in_le16(mbase + PCI_COMMAND) | 1445 in_le16(mbase + PCI_COMMAND) |
@@ -1422,13 +1453,8 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
1422 const int *bus_range; 1453 const int *bus_range;
1423 int primary = 0, busses; 1454 int primary = 0, busses;
1424 void __iomem *mbase = NULL, *cfg_data = NULL; 1455 void __iomem *mbase = NULL, *cfg_data = NULL;
1425 1456 const u32 *pval;
1426 /* XXX FIXME: Handle endpoint mode properly */ 1457 u32 val;
1427 if (port->endpoint) {
1428 printk(KERN_WARNING "PCIE%d: Port in endpoint mode !\n",
1429 port->index);
1430 return;
1431 }
1432 1458
1433 /* Check if primary bridge */ 1459 /* Check if primary bridge */
1434 if (of_get_property(port->node, "primary", NULL)) 1460 if (of_get_property(port->node, "primary", NULL))
@@ -1462,21 +1488,30 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
1462 hose->last_busno = hose->first_busno + busses; 1488 hose->last_busno = hose->first_busno + busses;
1463 } 1489 }
1464 1490
1465 /* We map the external config space in cfg_data and the host config 1491 if (!port->endpoint) {
1466 * space in cfg_addr. External space is 1M per bus, internal space 1492 /* Only map the external config space in cfg_data for
1467 * is 4K 1493 * PCIe root-complexes. External space is 1M per bus
1494 */
1495 cfg_data = ioremap(port->cfg_space.start +
1496 (hose->first_busno + 1) * 0x100000,
1497 busses * 0x100000);
1498 if (cfg_data == NULL) {
1499 printk(KERN_ERR "%s: Can't map external config space !",
1500 port->node->full_name);
1501 goto fail;
1502 }
1503 hose->cfg_data = cfg_data;
1504 }
1505
1506 /* Always map the host config space in cfg_addr.
1507 * Internal space is 4K
1468 */ 1508 */
1469 cfg_data = ioremap(port->cfg_space.start +
1470 (hose->first_busno + 1) * 0x100000,
1471 busses * 0x100000);
1472 mbase = ioremap(port->cfg_space.start + 0x10000000, 0x1000); 1509 mbase = ioremap(port->cfg_space.start + 0x10000000, 0x1000);
1473 if (cfg_data == NULL || mbase == NULL) { 1510 if (mbase == NULL) {
1474 printk(KERN_ERR "%s: Can't map config space !", 1511 printk(KERN_ERR "%s: Can't map internal config space !",
1475 port->node->full_name); 1512 port->node->full_name);
1476 goto fail; 1513 goto fail;
1477 } 1514 }
1478
1479 hose->cfg_data = cfg_data;
1480 hose->cfg_addr = mbase; 1515 hose->cfg_addr = mbase;
1481 1516
1482 pr_debug("PCIE %s, bus %d..%d\n", port->node->full_name, 1517 pr_debug("PCIE %s, bus %d..%d\n", port->node->full_name,
@@ -1489,12 +1524,14 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
1489 port->hose = hose; 1524 port->hose = hose;
1490 mbase = (void __iomem *)hose->cfg_addr; 1525 mbase = (void __iomem *)hose->cfg_addr;
1491 1526
1492 /* 1527 if (!port->endpoint) {
1493 * Set bus numbers on our root port 1528 /*
1494 */ 1529 * Set bus numbers on our root port
1495 out_8(mbase + PCI_PRIMARY_BUS, hose->first_busno); 1530 */
1496 out_8(mbase + PCI_SECONDARY_BUS, hose->first_busno + 1); 1531 out_8(mbase + PCI_PRIMARY_BUS, hose->first_busno);
1497 out_8(mbase + PCI_SUBORDINATE_BUS, hose->last_busno); 1532 out_8(mbase + PCI_SECONDARY_BUS, hose->first_busno + 1);
1533 out_8(mbase + PCI_SUBORDINATE_BUS, hose->last_busno);
1534 }
1498 1535
1499 /* 1536 /*
1500 * OMRs are already reset, also disable PIMs 1537 * OMRs are already reset, also disable PIMs
@@ -1515,17 +1552,49 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
1515 ppc4xx_configure_pciex_PIMs(port, hose, mbase, &dma_window); 1552 ppc4xx_configure_pciex_PIMs(port, hose, mbase, &dma_window);
1516 1553
1517 /* The root complex doesn't show up if we don't set some vendor 1554 /* The root complex doesn't show up if we don't set some vendor
1518 * and device IDs into it. Those are the same bogus one that the 1555 * and device IDs into it. The defaults below are the same bogus
1519 * initial code in arch/ppc add. We might want to change that. 1556 * one that the initial code in arch/ppc had. This can be
1557 * overwritten by setting the "vendor-id/device-id" properties
1558 * in the pciex node.
1520 */ 1559 */
1521 out_le16(mbase + 0x200, 0xaaa0 + port->index);
1522 out_le16(mbase + 0x202, 0xbed0 + port->index);
1523 1560
1524 /* Set Class Code to PCI-PCI bridge and Revision Id to 1 */ 1561 /* Get the (optional) vendor-/device-id from the device-tree */
1525 out_le32(mbase + 0x208, 0x06040001); 1562 pval = of_get_property(port->node, "vendor-id", NULL);
1563 if (pval) {
1564 val = *pval;
1565 } else {
1566 if (!port->endpoint)
1567 val = 0xaaa0 + port->index;
1568 else
1569 val = 0xeee0 + port->index;
1570 }
1571 out_le16(mbase + 0x200, val);
1572
1573 pval = of_get_property(port->node, "device-id", NULL);
1574 if (pval) {
1575 val = *pval;
1576 } else {
1577 if (!port->endpoint)
1578 val = 0xbed0 + port->index;
1579 else
1580 val = 0xfed0 + port->index;
1581 }
1582 out_le16(mbase + 0x202, val);
1583
1584 if (!port->endpoint) {
1585 /* Set Class Code to PCI-PCI bridge and Revision Id to 1 */
1586 out_le32(mbase + 0x208, 0x06040001);
1587
1588 printk(KERN_INFO "PCIE%d: successfully set as root-complex\n",
1589 port->index);
1590 } else {
1591 /* Set Class Code to Processor/PPC */
1592 out_le32(mbase + 0x208, 0x0b200001);
1593
1594 printk(KERN_INFO "PCIE%d: successfully set as endpoint\n",
1595 port->index);
1596 }
1526 1597
1527 printk(KERN_INFO "PCIE%d: successfully set as root-complex\n",
1528 port->index);
1529 return; 1598 return;
1530 fail: 1599 fail:
1531 if (hose) 1600 if (hose)
@@ -1542,6 +1611,7 @@ static void __init ppc4xx_probe_pciex_bridge(struct device_node *np)
1542 const u32 *pval; 1611 const u32 *pval;
1543 int portno; 1612 int portno;
1544 unsigned int dcrs; 1613 unsigned int dcrs;
1614 const char *val;
1545 1615
1546 /* First, proceed to core initialization as we assume there's 1616 /* First, proceed to core initialization as we assume there's
1547 * only one PCIe core in the system 1617 * only one PCIe core in the system
@@ -1573,8 +1643,20 @@ static void __init ppc4xx_probe_pciex_bridge(struct device_node *np)
1573 } 1643 }
1574 port->sdr_base = *pval; 1644 port->sdr_base = *pval;
1575 1645
1576 /* XXX Currently, we only support root complex mode */ 1646 /* Check if device_type property is set to "pci" or "pci-endpoint".
1577 port->endpoint = 0; 1647 * Resulting from this setup this PCIe port will be configured
1648 * as root-complex or as endpoint.
1649 */
1650 val = of_get_property(port->node, "device_type", NULL);
1651 if (!strcmp(val, "pci-endpoint")) {
1652 port->endpoint = 1;
1653 } else if (!strcmp(val, "pci")) {
1654 port->endpoint = 0;
1655 } else {
1656 printk(KERN_ERR "PCIE: missing or incorrect device_type for %s\n",
1657 np->full_name);
1658 return;
1659 }
1578 1660
1579 /* Fetch config space registers address */ 1661 /* Fetch config space registers address */
1580 if (of_address_to_resource(np, 0, &port->cfg_space)) { 1662 if (of_address_to_resource(np, 0, &port->cfg_space)) {
diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c
index a51a17714231..8dcbdd6c2d2c 100644
--- a/arch/ppc/kernel/asm-offsets.c
+++ b/arch/ppc/kernel/asm-offsets.c
@@ -18,6 +18,8 @@
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/mman.h> 19#include <linux/mman.h>
20#include <linux/mm.h> 20#include <linux/mm.h>
21#include <linux/kbuild.h>
22
21#include <asm/io.h> 23#include <asm/io.h>
22#include <asm/page.h> 24#include <asm/page.h>
23#include <asm/pgtable.h> 25#include <asm/pgtable.h>
@@ -26,11 +28,6 @@
26#include <asm/thread_info.h> 28#include <asm/thread_info.h>
27#include <asm/vdso_datapage.h> 29#include <asm/vdso_datapage.h>
28 30
29#define DEFINE(sym, val) \
30 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
31
32#define BLANK() asm volatile("\n->" : : )
33
34int 31int
35main(void) 32main(void)
36{ 33{
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index 50ce83f20adb..df3ef6db072c 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -1121,8 +1121,8 @@ void __init pci_init_resource(struct resource *res, resource_size_t start,
1121 1121
1122void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) 1122void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
1123{ 1123{
1124 unsigned long start = pci_resource_start(dev, bar); 1124 resource_size_t start = pci_resource_start(dev, bar);
1125 unsigned long len = pci_resource_len(dev, bar); 1125 resource_size_t len = pci_resource_len(dev, bar);
1126 unsigned long flags = pci_resource_flags(dev, bar); 1126 unsigned long flags = pci_resource_flags(dev, bar);
1127 1127
1128 if (!len) 1128 if (!len)
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index d9036ef0b658..16ac11ca7ba0 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -183,9 +183,6 @@ EXPORT_SYMBOL(cuda_poll);
183#if defined(CONFIG_BOOTX_TEXT) 183#if defined(CONFIG_BOOTX_TEXT)
184EXPORT_SYMBOL(btext_update_display); 184EXPORT_SYMBOL(btext_update_display);
185#endif 185#endif
186#ifdef CONFIG_VT
187EXPORT_SYMBOL(kd_mksound);
188#endif
189EXPORT_SYMBOL(to_tm); 186EXPORT_SYMBOL(to_tm);
190 187
191EXPORT_SYMBOL(pm_power_off); 188EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/ppc/platforms/sbc82xx.c b/arch/ppc/platforms/sbc82xx.c
index 0df6aacb8237..24f6e0694ac1 100644
--- a/arch/ppc/platforms/sbc82xx.c
+++ b/arch/ppc/platforms/sbc82xx.c
@@ -30,8 +30,6 @@ static void (*callback_init_IRQ)(void);
30 30
31extern unsigned char __res[sizeof(bd_t)]; 31extern unsigned char __res[sizeof(bd_t)];
32 32
33extern void (*late_time_init)(void);
34
35#ifdef CONFIG_GEN_RTC 33#ifdef CONFIG_GEN_RTC
36TODC_ALLOC(); 34TODC_ALLOC();
37 35
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 8f5f02160ffc..29a7940f284f 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -300,6 +300,14 @@ comment "Kernel preemption"
300 300
301source "kernel/Kconfig.preempt" 301source "kernel/Kconfig.preempt"
302 302
303config ARCH_SPARSEMEM_ENABLE
304 def_bool y
305 select SPARSEMEM_VMEMMAP_ENABLE
306 select SPARSEMEM_VMEMMAP
307
308config ARCH_SPARSEMEM_DEFAULT
309 def_bool y
310
303source "mm/Kconfig" 311source "mm/Kconfig"
304 312
305comment "I/O subsystem configuration" 313comment "I/O subsystem configuration"
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index a72f208e62d0..aa341d0ea1e6 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/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.25-rc4 3# Linux kernel version: 2.6.25
4# Wed Mar 5 11:22:59 2008 4# Wed Apr 30 11:07:45 2008
5# 5#
6CONFIG_SCHED_MC=y 6CONFIG_SCHED_MC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -14,10 +14,12 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y
14# CONFIG_ARCH_HAS_ILOG2_U64 is not set 14# CONFIG_ARCH_HAS_ILOG2_U64 is not set
15CONFIG_GENERIC_HWEIGHT=y 15CONFIG_GENERIC_HWEIGHT=y
16CONFIG_GENERIC_TIME=y 16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
17CONFIG_GENERIC_BUG=y 18CONFIG_GENERIC_BUG=y
18CONFIG_NO_IOMEM=y 19CONFIG_NO_IOMEM=y
19CONFIG_NO_DMA=y 20CONFIG_NO_DMA=y
20CONFIG_GENERIC_LOCKBREAK=y 21CONFIG_GENERIC_LOCKBREAK=y
22CONFIG_PGSTE=y
21CONFIG_S390=y 23CONFIG_S390=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 25
@@ -43,6 +45,7 @@ CONFIG_LOG_BUF_SHIFT=17
43CONFIG_CGROUPS=y 45CONFIG_CGROUPS=y
44# CONFIG_CGROUP_DEBUG is not set 46# CONFIG_CGROUP_DEBUG is not set
45CONFIG_CGROUP_NS=y 47CONFIG_CGROUP_NS=y
48# CONFIG_CGROUP_DEVICE is not set
46# CONFIG_CPUSETS is not set 49# CONFIG_CPUSETS is not set
47CONFIG_GROUP_SCHED=y 50CONFIG_GROUP_SCHED=y
48CONFIG_FAIR_GROUP_SCHED=y 51CONFIG_FAIR_GROUP_SCHED=y
@@ -65,6 +68,7 @@ CONFIG_INITRAMFS_SOURCE=""
65CONFIG_SYSCTL=y 68CONFIG_SYSCTL=y
66# CONFIG_EMBEDDED is not set 69# CONFIG_EMBEDDED is not set
67CONFIG_SYSCTL_SYSCALL=y 70CONFIG_SYSCTL_SYSCALL=y
71CONFIG_SYSCTL_SYSCALL_CHECK=y
68CONFIG_KALLSYMS=y 72CONFIG_KALLSYMS=y
69# CONFIG_KALLSYMS_ALL is not set 73# CONFIG_KALLSYMS_ALL is not set
70# CONFIG_KALLSYMS_EXTRA_PASS is not set 74# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -92,6 +96,7 @@ CONFIG_KPROBES=y
92CONFIG_KRETPROBES=y 96CONFIG_KRETPROBES=y
93CONFIG_HAVE_KPROBES=y 97CONFIG_HAVE_KPROBES=y
94CONFIG_HAVE_KRETPROBES=y 98CONFIG_HAVE_KRETPROBES=y
99# CONFIG_HAVE_DMA_ATTRS is not set
95CONFIG_PROC_PAGE_MONITOR=y 100CONFIG_PROC_PAGE_MONITOR=y
96CONFIG_SLABINFO=y 101CONFIG_SLABINFO=y
97CONFIG_RT_MUTEXES=y 102CONFIG_RT_MUTEXES=y
@@ -121,8 +126,8 @@ CONFIG_DEFAULT_DEADLINE=y
121# CONFIG_DEFAULT_CFQ is not set 126# CONFIG_DEFAULT_CFQ is not set
122# CONFIG_DEFAULT_NOOP is not set 127# CONFIG_DEFAULT_NOOP is not set
123CONFIG_DEFAULT_IOSCHED="deadline" 128CONFIG_DEFAULT_IOSCHED="deadline"
129CONFIG_PREEMPT_NOTIFIERS=y
124CONFIG_CLASSIC_RCU=y 130CONFIG_CLASSIC_RCU=y
125# CONFIG_PREEMPT_RCU is not set
126 131
127# 132#
128# Base setup 133# Base setup
@@ -131,6 +136,10 @@ CONFIG_CLASSIC_RCU=y
131# 136#
132# Processor type and features 137# Processor type and features
133# 138#
139CONFIG_TICK_ONESHOT=y
140CONFIG_NO_HZ=y
141CONFIG_HIGH_RES_TIMERS=y
142CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
134CONFIG_64BIT=y 143CONFIG_64BIT=y
135CONFIG_SMP=y 144CONFIG_SMP=y
136CONFIG_NR_CPUS=32 145CONFIG_NR_CPUS=32
@@ -161,15 +170,20 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
161# CONFIG_PREEMPT_NONE is not set 170# CONFIG_PREEMPT_NONE is not set
162# CONFIG_PREEMPT_VOLUNTARY is not set 171# CONFIG_PREEMPT_VOLUNTARY is not set
163CONFIG_PREEMPT=y 172CONFIG_PREEMPT=y
164# CONFIG_RCU_TRACE is not set 173# CONFIG_PREEMPT_RCU is not set
174CONFIG_ARCH_SPARSEMEM_ENABLE=y
175CONFIG_ARCH_SPARSEMEM_DEFAULT=y
165CONFIG_SELECT_MEMORY_MODEL=y 176CONFIG_SELECT_MEMORY_MODEL=y
166CONFIG_FLATMEM_MANUAL=y 177# CONFIG_FLATMEM_MANUAL is not set
167# CONFIG_DISCONTIGMEM_MANUAL is not set 178# CONFIG_DISCONTIGMEM_MANUAL is not set
168# CONFIG_SPARSEMEM_MANUAL is not set 179CONFIG_SPARSEMEM_MANUAL=y
169CONFIG_FLATMEM=y 180CONFIG_SPARSEMEM=y
170CONFIG_FLAT_NODE_MEM_MAP=y 181CONFIG_HAVE_MEMORY_PRESENT=y
171# CONFIG_SPARSEMEM_STATIC is not set 182# CONFIG_SPARSEMEM_STATIC is not set
172# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 183CONFIG_SPARSEMEM_EXTREME=y
184CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
185CONFIG_SPARSEMEM_VMEMMAP=y
186CONFIG_PAGEFLAGS_EXTENDED=y
173CONFIG_SPLIT_PTLOCK_CPUS=4 187CONFIG_SPLIT_PTLOCK_CPUS=4
174CONFIG_RESOURCES_64BIT=y 188CONFIG_RESOURCES_64BIT=y
175CONFIG_ZONE_DMA_FLAG=1 189CONFIG_ZONE_DMA_FLAG=1
@@ -205,11 +219,10 @@ CONFIG_HZ_100=y
205# CONFIG_HZ_1000 is not set 219# CONFIG_HZ_1000 is not set
206CONFIG_HZ=100 220CONFIG_HZ=100
207# CONFIG_SCHED_HRTICK is not set 221# CONFIG_SCHED_HRTICK is not set
208CONFIG_NO_IDLE_HZ=y
209CONFIG_NO_IDLE_HZ_INIT=y
210CONFIG_S390_HYPFS_FS=y 222CONFIG_S390_HYPFS_FS=y
211CONFIG_KEXEC=y 223CONFIG_KEXEC=y
212# CONFIG_ZFCPDUMP is not set 224# CONFIG_ZFCPDUMP is not set
225CONFIG_S390_GUEST=y
213 226
214# 227#
215# Networking 228# Networking
@@ -272,8 +285,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
272CONFIG_INET6_XFRM_MODE_BEET=y 285CONFIG_INET6_XFRM_MODE_BEET=y
273# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 286# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
274CONFIG_IPV6_SIT=y 287CONFIG_IPV6_SIT=y
288CONFIG_IPV6_NDISC_NODETYPE=y
275# CONFIG_IPV6_TUNNEL is not set 289# CONFIG_IPV6_TUNNEL is not set
276# CONFIG_IPV6_MULTIPLE_TABLES is not set 290# CONFIG_IPV6_MULTIPLE_TABLES is not set
291# CONFIG_IPV6_MROUTE is not set
277# CONFIG_NETWORK_SECMARK is not set 292# CONFIG_NETWORK_SECMARK is not set
278CONFIG_NETFILTER=y 293CONFIG_NETFILTER=y
279# CONFIG_NETFILTER_DEBUG is not set 294# CONFIG_NETFILTER_DEBUG is not set
@@ -289,6 +304,7 @@ CONFIG_NF_CONNTRACK=m
289# CONFIG_NF_CT_ACCT is not set 304# CONFIG_NF_CT_ACCT is not set
290# CONFIG_NF_CONNTRACK_MARK is not set 305# CONFIG_NF_CONNTRACK_MARK is not set
291# CONFIG_NF_CONNTRACK_EVENTS is not set 306# CONFIG_NF_CONNTRACK_EVENTS is not set
307# CONFIG_NF_CT_PROTO_DCCP is not set
292# CONFIG_NF_CT_PROTO_SCTP is not set 308# CONFIG_NF_CT_PROTO_SCTP is not set
293# CONFIG_NF_CT_PROTO_UDPLITE is not set 309# CONFIG_NF_CT_PROTO_UDPLITE is not set
294# CONFIG_NF_CONNTRACK_AMANDA is not set 310# CONFIG_NF_CONNTRACK_AMANDA is not set
@@ -439,6 +455,7 @@ CONFIG_DASD_ECKD=y
439CONFIG_DASD_FBA=y 455CONFIG_DASD_FBA=y
440CONFIG_DASD_DIAG=y 456CONFIG_DASD_DIAG=y
441CONFIG_DASD_EER=y 457CONFIG_DASD_EER=y
458CONFIG_VIRTIO_BLK=m
442CONFIG_MISC_DEVICES=y 459CONFIG_MISC_DEVICES=y
443# CONFIG_EEPROM_93CX6 is not set 460# CONFIG_EEPROM_93CX6 is not set
444# CONFIG_ENCLOSURE_SERVICES is not set 461# CONFIG_ENCLOSURE_SERVICES is not set
@@ -533,7 +550,7 @@ CONFIG_NETDEV_10000=y
533# S/390 network device drivers 550# S/390 network device drivers
534# 551#
535CONFIG_LCS=m 552CONFIG_LCS=m
536CONFIG_CTC=m 553CONFIG_CTCM=m
537# CONFIG_NETIUCV is not set 554# CONFIG_NETIUCV is not set
538# CONFIG_SMSGIUCV is not set 555# CONFIG_SMSGIUCV is not set
539# CONFIG_CLAW is not set 556# CONFIG_CLAW is not set
@@ -547,10 +564,12 @@ CONFIG_CCWGROUP=y
547# CONFIG_NETCONSOLE is not set 564# CONFIG_NETCONSOLE is not set
548# CONFIG_NETPOLL is not set 565# CONFIG_NETPOLL is not set
549# CONFIG_NET_POLL_CONTROLLER is not set 566# CONFIG_NET_POLL_CONTROLLER is not set
567CONFIG_VIRTIO_NET=m
550 568
551# 569#
552# Character devices 570# Character devices
553# 571#
572CONFIG_DEVKMEM=y
554CONFIG_UNIX98_PTYS=y 573CONFIG_UNIX98_PTYS=y
555CONFIG_LEGACY_PTYS=y 574CONFIG_LEGACY_PTYS=y
556CONFIG_LEGACY_PTY_COUNT=256 575CONFIG_LEGACY_PTY_COUNT=256
@@ -600,6 +619,7 @@ CONFIG_S390_VMUR=m
600# Sonics Silicon Backplane 619# Sonics Silicon Backplane
601# 620#
602# CONFIG_MEMSTICK is not set 621# CONFIG_MEMSTICK is not set
622# CONFIG_NEW_LEDS is not set
603 623
604# 624#
605# File systems 625# File systems
@@ -652,6 +672,7 @@ CONFIG_PROC_SYSCTL=y
652CONFIG_SYSFS=y 672CONFIG_SYSFS=y
653CONFIG_TMPFS=y 673CONFIG_TMPFS=y
654CONFIG_TMPFS_POSIX_ACL=y 674CONFIG_TMPFS_POSIX_ACL=y
675# CONFIG_HUGETLBFS is not set
655# CONFIG_HUGETLB_PAGE is not set 676# CONFIG_HUGETLB_PAGE is not set
656CONFIG_CONFIGFS_FS=m 677CONFIG_CONFIGFS_FS=m
657 678
@@ -678,12 +699,10 @@ CONFIG_NFS_FS=y
678CONFIG_NFS_V3=y 699CONFIG_NFS_V3=y
679# CONFIG_NFS_V3_ACL is not set 700# CONFIG_NFS_V3_ACL is not set
680# CONFIG_NFS_V4 is not set 701# CONFIG_NFS_V4 is not set
681# CONFIG_NFS_DIRECTIO is not set
682CONFIG_NFSD=y 702CONFIG_NFSD=y
683CONFIG_NFSD_V3=y 703CONFIG_NFSD_V3=y
684# CONFIG_NFSD_V3_ACL is not set 704# CONFIG_NFSD_V3_ACL is not set
685# CONFIG_NFSD_V4 is not set 705# CONFIG_NFSD_V4 is not set
686CONFIG_NFSD_TCP=y
687CONFIG_LOCKD=y 706CONFIG_LOCKD=y
688CONFIG_LOCKD_V4=y 707CONFIG_LOCKD_V4=y
689CONFIG_EXPORTFS=y 708CONFIG_EXPORTFS=y
@@ -731,6 +750,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
731# CONFIG_PRINTK_TIME is not set 750# CONFIG_PRINTK_TIME is not set
732CONFIG_ENABLE_WARN_DEPRECATED=y 751CONFIG_ENABLE_WARN_DEPRECATED=y
733CONFIG_ENABLE_MUST_CHECK=y 752CONFIG_ENABLE_MUST_CHECK=y
753CONFIG_FRAME_WARN=2048
734CONFIG_MAGIC_SYSRQ=y 754CONFIG_MAGIC_SYSRQ=y
735# CONFIG_UNUSED_SYMBOLS is not set 755# CONFIG_UNUSED_SYMBOLS is not set
736CONFIG_DEBUG_FS=y 756CONFIG_DEBUG_FS=y
@@ -754,6 +774,7 @@ CONFIG_DEBUG_SPINLOCK_SLEEP=y
754CONFIG_DEBUG_BUGVERBOSE=y 774CONFIG_DEBUG_BUGVERBOSE=y
755# CONFIG_DEBUG_INFO is not set 775# CONFIG_DEBUG_INFO is not set
756# CONFIG_DEBUG_VM is not set 776# CONFIG_DEBUG_VM is not set
777# CONFIG_DEBUG_WRITECOUNT is not set
757# CONFIG_DEBUG_LIST is not set 778# CONFIG_DEBUG_LIST is not set
758# CONFIG_DEBUG_SG is not set 779# CONFIG_DEBUG_SG is not set
759# CONFIG_FRAME_POINTER is not set 780# CONFIG_FRAME_POINTER is not set
@@ -775,58 +796,88 @@ CONFIG_SAMPLES=y
775# CONFIG_SECURITY is not set 796# CONFIG_SECURITY is not set
776# CONFIG_SECURITY_FILE_CAPABILITIES is not set 797# CONFIG_SECURITY_FILE_CAPABILITIES is not set
777CONFIG_CRYPTO=y 798CONFIG_CRYPTO=y
799
800#
801# Crypto core or helper
802#
778CONFIG_CRYPTO_ALGAPI=y 803CONFIG_CRYPTO_ALGAPI=y
779CONFIG_CRYPTO_AEAD=m 804CONFIG_CRYPTO_AEAD=m
780CONFIG_CRYPTO_BLKCIPHER=y 805CONFIG_CRYPTO_BLKCIPHER=y
781CONFIG_CRYPTO_SEQIV=m
782CONFIG_CRYPTO_HASH=m 806CONFIG_CRYPTO_HASH=m
783CONFIG_CRYPTO_MANAGER=y 807CONFIG_CRYPTO_MANAGER=y
808CONFIG_CRYPTO_GF128MUL=m
809# CONFIG_CRYPTO_NULL is not set
810# CONFIG_CRYPTO_CRYPTD is not set
811CONFIG_CRYPTO_AUTHENC=m
812# CONFIG_CRYPTO_TEST is not set
813
814#
815# Authenticated Encryption with Associated Data
816#
817CONFIG_CRYPTO_CCM=m
818CONFIG_CRYPTO_GCM=m
819CONFIG_CRYPTO_SEQIV=m
820
821#
822# Block modes
823#
824CONFIG_CRYPTO_CBC=y
825CONFIG_CRYPTO_CTR=m
826CONFIG_CRYPTO_CTS=m
827CONFIG_CRYPTO_ECB=m
828# CONFIG_CRYPTO_LRW is not set
829CONFIG_CRYPTO_PCBC=m
830# CONFIG_CRYPTO_XTS is not set
831
832#
833# Hash modes
834#
784CONFIG_CRYPTO_HMAC=m 835CONFIG_CRYPTO_HMAC=m
785# CONFIG_CRYPTO_XCBC is not set 836# CONFIG_CRYPTO_XCBC is not set
786# CONFIG_CRYPTO_NULL is not set 837
838#
839# Digest
840#
841# CONFIG_CRYPTO_CRC32C is not set
787# CONFIG_CRYPTO_MD4 is not set 842# CONFIG_CRYPTO_MD4 is not set
788CONFIG_CRYPTO_MD5=m 843CONFIG_CRYPTO_MD5=m
844# CONFIG_CRYPTO_MICHAEL_MIC is not set
789CONFIG_CRYPTO_SHA1=m 845CONFIG_CRYPTO_SHA1=m
790# CONFIG_CRYPTO_SHA256 is not set 846# CONFIG_CRYPTO_SHA256 is not set
791# CONFIG_CRYPTO_SHA512 is not set 847# CONFIG_CRYPTO_SHA512 is not set
792# CONFIG_CRYPTO_WP512 is not set
793# CONFIG_CRYPTO_TGR192 is not set 848# CONFIG_CRYPTO_TGR192 is not set
794CONFIG_CRYPTO_GF128MUL=m 849# CONFIG_CRYPTO_WP512 is not set
795CONFIG_CRYPTO_ECB=m 850
796CONFIG_CRYPTO_CBC=y 851#
797CONFIG_CRYPTO_PCBC=m 852# Ciphers
798# CONFIG_CRYPTO_LRW is not set 853#
799# CONFIG_CRYPTO_XTS is not set
800CONFIG_CRYPTO_CTR=m
801CONFIG_CRYPTO_GCM=m
802CONFIG_CRYPTO_CCM=m
803# CONFIG_CRYPTO_CRYPTD is not set
804# CONFIG_CRYPTO_DES is not set
805CONFIG_CRYPTO_FCRYPT=m
806# CONFIG_CRYPTO_BLOWFISH is not set
807# CONFIG_CRYPTO_TWOFISH is not set
808# CONFIG_CRYPTO_SERPENT is not set
809# CONFIG_CRYPTO_AES is not set 854# CONFIG_CRYPTO_AES is not set
855# CONFIG_CRYPTO_ANUBIS is not set
856# CONFIG_CRYPTO_ARC4 is not set
857# CONFIG_CRYPTO_BLOWFISH is not set
858CONFIG_CRYPTO_CAMELLIA=m
810# CONFIG_CRYPTO_CAST5 is not set 859# CONFIG_CRYPTO_CAST5 is not set
811# CONFIG_CRYPTO_CAST6 is not set 860# CONFIG_CRYPTO_CAST6 is not set
812# CONFIG_CRYPTO_TEA is not set 861# CONFIG_CRYPTO_DES is not set
813# CONFIG_CRYPTO_ARC4 is not set 862CONFIG_CRYPTO_FCRYPT=m
814# CONFIG_CRYPTO_KHAZAD is not set 863# CONFIG_CRYPTO_KHAZAD is not set
815# CONFIG_CRYPTO_ANUBIS is not set
816CONFIG_CRYPTO_SEED=m
817CONFIG_CRYPTO_SALSA20=m 864CONFIG_CRYPTO_SALSA20=m
865CONFIG_CRYPTO_SEED=m
866# CONFIG_CRYPTO_SERPENT is not set
867# CONFIG_CRYPTO_TEA is not set
868# CONFIG_CRYPTO_TWOFISH is not set
869
870#
871# Compression
872#
818# CONFIG_CRYPTO_DEFLATE is not set 873# CONFIG_CRYPTO_DEFLATE is not set
819# CONFIG_CRYPTO_MICHAEL_MIC is not set
820# CONFIG_CRYPTO_CRC32C is not set
821CONFIG_CRYPTO_CAMELLIA=m
822# CONFIG_CRYPTO_TEST is not set
823CONFIG_CRYPTO_AUTHENC=m
824CONFIG_CRYPTO_LZO=m 874CONFIG_CRYPTO_LZO=m
825CONFIG_CRYPTO_HW=y 875CONFIG_CRYPTO_HW=y
826CONFIG_ZCRYPT=m 876CONFIG_ZCRYPT=m
827# CONFIG_ZCRYPT_MONOLITHIC is not set 877# CONFIG_ZCRYPT_MONOLITHIC is not set
828# CONFIG_CRYPTO_SHA1_S390 is not set 878# CONFIG_CRYPTO_SHA1_S390 is not set
829# CONFIG_CRYPTO_SHA256_S390 is not set 879# CONFIG_CRYPTO_SHA256_S390 is not set
880CONFIG_CRYPTO_SHA512_S390=m
830# CONFIG_CRYPTO_DES_S390 is not set 881# CONFIG_CRYPTO_DES_S390 is not set
831# CONFIG_CRYPTO_AES_S390 is not set 882# CONFIG_CRYPTO_AES_S390 is not set
832CONFIG_S390_PRNG=m 883CONFIG_S390_PRNG=m
@@ -835,6 +886,8 @@ CONFIG_S390_PRNG=m
835# Library routines 886# Library routines
836# 887#
837CONFIG_BITREVERSE=m 888CONFIG_BITREVERSE=m
889# CONFIG_GENERIC_FIND_FIRST_BIT is not set
890# CONFIG_GENERIC_FIND_NEXT_BIT is not set
838# CONFIG_CRC_CCITT is not set 891# CONFIG_CRC_CCITT is not set
839# CONFIG_CRC16 is not set 892# CONFIG_CRC16 is not set
840# CONFIG_CRC_ITU_T is not set 893# CONFIG_CRC_ITU_T is not set
@@ -844,3 +897,9 @@ CONFIG_LIBCRC32C=m
844CONFIG_LZO_COMPRESS=m 897CONFIG_LZO_COMPRESS=m
845CONFIG_LZO_DECOMPRESS=m 898CONFIG_LZO_DECOMPRESS=m
846CONFIG_PLIST=y 899CONFIG_PLIST=y
900CONFIG_HAVE_KVM=y
901CONFIG_VIRTUALIZATION=y
902CONFIG_KVM=m
903CONFIG_VIRTIO=y
904CONFIG_VIRTIO_RING=y
905CONFIG_VIRTIO_BALLOON=m
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 77051cd27925..6302f5082588 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -2,8 +2,6 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5EXTRA_AFLAGS := -traditional
6
7# 5#
8# Passing null pointers is ok for smp code, since we access the lowcore here. 6# Passing null pointers is ok for smp code, since we access the lowcore here.
9# 7#
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 1375f8a4469e..fa28ecae636b 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -5,44 +5,38 @@
5 */ 5 */
6 6
7#include <linux/sched.h> 7#include <linux/sched.h>
8 8#include <linux/kbuild.h>
9/* Use marker if you need to separate the values later */
10
11#define DEFINE(sym, val, marker) \
12 asm volatile("\n->" #sym " %0 " #val " " #marker : : "i" (val))
13
14#define BLANK() asm volatile("\n->" : : )
15 9
16int main(void) 10int main(void)
17{ 11{
18 DEFINE(__THREAD_info, offsetof(struct task_struct, stack),); 12 DEFINE(__THREAD_info, offsetof(struct task_struct, stack));
19 DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp),); 13 DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp));
20 DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info),); 14 DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info));
21 DEFINE(__THREAD_mm_segment, 15 DEFINE(__THREAD_mm_segment,
22 offsetof(struct task_struct, thread.mm_segment),); 16 offsetof(struct task_struct, thread.mm_segment));
23 BLANK(); 17 BLANK();
24 DEFINE(__TASK_pid, offsetof(struct task_struct, pid),); 18 DEFINE(__TASK_pid, offsetof(struct task_struct, pid));
25 BLANK(); 19 BLANK();
26 DEFINE(__PER_atmid, offsetof(per_struct, lowcore.words.perc_atmid),); 20 DEFINE(__PER_atmid, offsetof(per_struct, lowcore.words.perc_atmid));
27 DEFINE(__PER_address, offsetof(per_struct, lowcore.words.address),); 21 DEFINE(__PER_address, offsetof(per_struct, lowcore.words.address));
28 DEFINE(__PER_access_id, offsetof(per_struct, lowcore.words.access_id),); 22 DEFINE(__PER_access_id, offsetof(per_struct, lowcore.words.access_id));
29 BLANK(); 23 BLANK();
30 DEFINE(__TI_task, offsetof(struct thread_info, task),); 24 DEFINE(__TI_task, offsetof(struct thread_info, task));
31 DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain),); 25 DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain));
32 DEFINE(__TI_flags, offsetof(struct thread_info, flags),); 26 DEFINE(__TI_flags, offsetof(struct thread_info, flags));
33 DEFINE(__TI_cpu, offsetof(struct thread_info, cpu),); 27 DEFINE(__TI_cpu, offsetof(struct thread_info, cpu));
34 DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count),); 28 DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count));
35 BLANK(); 29 BLANK();
36 DEFINE(__PT_ARGS, offsetof(struct pt_regs, args),); 30 DEFINE(__PT_ARGS, offsetof(struct pt_regs, args));
37 DEFINE(__PT_PSW, offsetof(struct pt_regs, psw),); 31 DEFINE(__PT_PSW, offsetof(struct pt_regs, psw));
38 DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs),); 32 DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs));
39 DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2),); 33 DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2));
40 DEFINE(__PT_ILC, offsetof(struct pt_regs, ilc),); 34 DEFINE(__PT_ILC, offsetof(struct pt_regs, ilc));
41 DEFINE(__PT_TRAP, offsetof(struct pt_regs, trap),); 35 DEFINE(__PT_TRAP, offsetof(struct pt_regs, trap));
42 DEFINE(__PT_SIZE, sizeof(struct pt_regs),); 36 DEFINE(__PT_SIZE, sizeof(struct pt_regs));
43 BLANK(); 37 BLANK();
44 DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain),); 38 DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain));
45 DEFINE(__SF_GPRS, offsetof(struct stack_frame, gprs),); 39 DEFINE(__SF_GPRS, offsetof(struct stack_frame, gprs));
46 DEFINE(__SF_EMPTY, offsetof(struct stack_frame, empty1),); 40 DEFINE(__SF_EMPTY, offsetof(struct stack_frame, empty1));
47 return 0; 41 return 0;
48} 42}
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 68ec4083bf73..d0e09684b9ce 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -139,15 +139,15 @@ static noinline __init void detect_machine_type(void)
139 139
140 /* Running under z/VM ? */ 140 /* Running under z/VM ? */
141 if (cpuinfo->cpu_id.version == 0xff) 141 if (cpuinfo->cpu_id.version == 0xff)
142 machine_flags |= 1; 142 machine_flags |= MACHINE_FLAG_VM;
143 143
144 /* Running on a P/390 ? */ 144 /* Running on a P/390 ? */
145 if (cpuinfo->cpu_id.machine == 0x7490) 145 if (cpuinfo->cpu_id.machine == 0x7490)
146 machine_flags |= 4; 146 machine_flags |= MACHINE_FLAG_P390;
147 147
148 /* Running under KVM ? */ 148 /* Running under KVM ? */
149 if (cpuinfo->cpu_id.version == 0xfe) 149 if (cpuinfo->cpu_id.version == 0xfe)
150 machine_flags |= 64; 150 machine_flags |= MACHINE_FLAG_KVM;
151} 151}
152 152
153#ifdef CONFIG_64BIT 153#ifdef CONFIG_64BIT
@@ -268,6 +268,118 @@ static noinline __init void setup_lowcore_early(void)
268 s390_base_pgm_handler_fn = early_pgm_check_handler; 268 s390_base_pgm_handler_fn = early_pgm_check_handler;
269} 269}
270 270
271static noinline __init void setup_hpage(void)
272{
273#ifndef CONFIG_DEBUG_PAGEALLOC
274 unsigned int facilities;
275
276 facilities = stfl();
277 if (!(facilities & (1UL << 23)) || !(facilities & (1UL << 29)))
278 return;
279 machine_flags |= MACHINE_FLAG_HPAGE;
280 __ctl_set_bit(0, 23);
281#endif
282}
283
284static __init void detect_mvpg(void)
285{
286#ifndef CONFIG_64BIT
287 int rc;
288
289 asm volatile(
290 " la 0,0\n"
291 " mvpg %2,%2\n"
292 "0: la %0,0\n"
293 "1:\n"
294 EX_TABLE(0b,1b)
295 : "=d" (rc) : "0" (-EOPNOTSUPP), "a" (0) : "memory", "cc", "0");
296 if (!rc)
297 machine_flags |= MACHINE_FLAG_MVPG;
298#endif
299}
300
301static __init void detect_ieee(void)
302{
303#ifndef CONFIG_64BIT
304 int rc, tmp;
305
306 asm volatile(
307 " efpc %1,0\n"
308 "0: la %0,0\n"
309 "1:\n"
310 EX_TABLE(0b,1b)
311 : "=d" (rc), "=d" (tmp): "0" (-EOPNOTSUPP) : "cc");
312 if (!rc)
313 machine_flags |= MACHINE_FLAG_IEEE;
314#endif
315}
316
317static __init void detect_csp(void)
318{
319#ifndef CONFIG_64BIT
320 int rc;
321
322 asm volatile(
323 " la 0,0\n"
324 " la 1,0\n"
325 " la 2,4\n"
326 " csp 0,2\n"
327 "0: la %0,0\n"
328 "1:\n"
329 EX_TABLE(0b,1b)
330 : "=d" (rc) : "0" (-EOPNOTSUPP) : "cc", "0", "1", "2");
331 if (!rc)
332 machine_flags |= MACHINE_FLAG_CSP;
333#endif
334}
335
336static __init void detect_diag9c(void)
337{
338 unsigned int cpu_address;
339 int rc;
340
341 cpu_address = stap();
342 asm volatile(
343 " diag %2,0,0x9c\n"
344 "0: la %0,0\n"
345 "1:\n"
346 EX_TABLE(0b,1b)
347 : "=d" (rc) : "0" (-EOPNOTSUPP), "d" (cpu_address) : "cc");
348 if (!rc)
349 machine_flags |= MACHINE_FLAG_DIAG9C;
350}
351
352static __init void detect_diag44(void)
353{
354#ifdef CONFIG_64BIT
355 int rc;
356
357 asm volatile(
358 " diag 0,0,0x44\n"
359 "0: la %0,0\n"
360 "1:\n"
361 EX_TABLE(0b,1b)
362 : "=d" (rc) : "0" (-EOPNOTSUPP) : "cc");
363 if (!rc)
364 machine_flags |= MACHINE_FLAG_DIAG44;
365#endif
366}
367
368static __init void detect_machine_facilities(void)
369{
370#ifdef CONFIG_64BIT
371 unsigned int facilities;
372
373 facilities = stfl();
374 if (facilities & (1 << 28))
375 machine_flags |= MACHINE_FLAG_IDTE;
376 if (facilities & (1 << 23))
377 machine_flags |= MACHINE_FLAG_PFMF;
378 if (facilities & (1 << 4))
379 machine_flags |= MACHINE_FLAG_MVCOS;
380#endif
381}
382
271/* 383/*
272 * Save ipl parameters, clear bss memory, initialize storage keys 384 * Save ipl parameters, clear bss memory, initialize storage keys
273 * and create a kernel NSS at startup if the SAVESYS= parm is defined 385 * and create a kernel NSS at startup if the SAVESYS= parm is defined
@@ -285,6 +397,13 @@ void __init startup_init(void)
285 create_kernel_nss(); 397 create_kernel_nss();
286 sort_main_extable(); 398 sort_main_extable();
287 setup_lowcore_early(); 399 setup_lowcore_early();
400 detect_mvpg();
401 detect_ieee();
402 detect_csp();
403 detect_diag9c();
404 detect_diag44();
405 detect_machine_facilities();
406 setup_hpage();
288 sclp_read_info_early(); 407 sclp_read_info_early();
289 sclp_facilities_detect(); 408 sclp_facilities_detect();
290 memsize = sclp_memory_detect(); 409 memsize = sclp_memory_detect();
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 6766e37fe8ea..bdbb3bcd78a5 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -49,9 +49,9 @@ SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC
49SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP 49SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP
50SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE 50SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE
51 51
52_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \ 52_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
53 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) 53 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
54_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \ 54_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
55 _TIF_MCCK_PENDING) 55 _TIF_MCCK_PENDING)
56 56
57STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 57STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
@@ -316,7 +316,7 @@ sysc_work:
316 bo BASED(sysc_mcck_pending) 316 bo BASED(sysc_mcck_pending)
317 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED 317 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
318 bo BASED(sysc_reschedule) 318 bo BASED(sysc_reschedule)
319 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 319 tm __TI_flags+3(%r9),_TIF_SIGPENDING
320 bnz BASED(sysc_sigpending) 320 bnz BASED(sysc_sigpending)
321 tm __TI_flags+3(%r9),_TIF_RESTART_SVC 321 tm __TI_flags+3(%r9),_TIF_RESTART_SVC
322 bo BASED(sysc_restart) 322 bo BASED(sysc_restart)
@@ -342,7 +342,7 @@ sysc_mcck_pending:
342 br %r1 # TIF bit will be cleared by handler 342 br %r1 # TIF bit will be cleared by handler
343 343
344# 344#
345# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal 345# _TIF_SIGPENDING is set, call do_signal
346# 346#
347sysc_sigpending: 347sysc_sigpending:
348 ni __TI_flags+3(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP 348 ni __TI_flags+3(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP
@@ -657,7 +657,7 @@ io_work:
657 lr %r15,%r1 657 lr %r15,%r1
658# 658#
659# One of the work bits is on. Find out which one. 659# One of the work bits is on. Find out which one.
660# Checked are: _TIF_SIGPENDING, _TIF_RESTORE_SIGMASK, _TIF_NEED_RESCHED 660# Checked are: _TIF_SIGPENDING, _TIF_NEED_RESCHED
661# and _TIF_MCCK_PENDING 661# and _TIF_MCCK_PENDING
662# 662#
663io_work_loop: 663io_work_loop:
@@ -665,7 +665,7 @@ io_work_loop:
665 bo BASED(io_mcck_pending) 665 bo BASED(io_mcck_pending)
666 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED 666 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
667 bo BASED(io_reschedule) 667 bo BASED(io_reschedule)
668 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 668 tm __TI_flags+3(%r9),_TIF_SIGPENDING
669 bnz BASED(io_sigpending) 669 bnz BASED(io_sigpending)
670 b BASED(io_restore) 670 b BASED(io_restore)
671io_work_done: 671io_work_done:
@@ -693,7 +693,7 @@ io_reschedule:
693 b BASED(io_work_loop) 693 b BASED(io_work_loop)
694 694
695# 695#
696# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal 696# _TIF_SIGPENDING is set, call do_signal
697# 697#
698io_sigpending: 698io_sigpending:
699 TRACE_IRQS_ON 699 TRACE_IRQS_ON
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index cd959c0b2e16..5a4a7bcd2bba 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -52,9 +52,9 @@ SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE
52STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 52STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
53STACK_SIZE = 1 << STACK_SHIFT 53STACK_SIZE = 1 << STACK_SHIFT
54 54
55_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \ 55_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
56 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) 56 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
57_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \ 57_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
58 _TIF_MCCK_PENDING) 58 _TIF_MCCK_PENDING)
59 59
60#define BASED(name) name-system_call(%r13) 60#define BASED(name) name-system_call(%r13)
@@ -308,7 +308,7 @@ sysc_work:
308 jo sysc_mcck_pending 308 jo sysc_mcck_pending
309 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED 309 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED
310 jo sysc_reschedule 310 jo sysc_reschedule
311 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 311 tm __TI_flags+7(%r9),_TIF_SIGPENDING
312 jnz sysc_sigpending 312 jnz sysc_sigpending
313 tm __TI_flags+7(%r9),_TIF_RESTART_SVC 313 tm __TI_flags+7(%r9),_TIF_RESTART_SVC
314 jo sysc_restart 314 jo sysc_restart
@@ -332,7 +332,7 @@ sysc_mcck_pending:
332 jg s390_handle_mcck # TIF bit will be cleared by handler 332 jg s390_handle_mcck # TIF bit will be cleared by handler
333 333
334# 334#
335# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal 335# _TIF_SIGPENDING is set, call do_signal
336# 336#
337sysc_sigpending: 337sysc_sigpending:
338 ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP 338 ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP
@@ -648,7 +648,7 @@ io_work_loop:
648 jo io_mcck_pending 648 jo io_mcck_pending
649 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED 649 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED
650 jo io_reschedule 650 jo io_reschedule
651 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 651 tm __TI_flags+7(%r9),_TIF_SIGPENDING
652 jnz io_sigpending 652 jnz io_sigpending
653 j io_restore 653 j io_restore
654io_work_done: 654io_work_done:
@@ -674,7 +674,7 @@ io_reschedule:
674 j io_work_loop 674 j io_work_loop
675 675
676# 676#
677# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal 677# _TIF_SIGPENDING or is set, call do_signal
678# 678#
679io_sigpending: 679io_sigpending:
680 TRACE_IRQS_ON 680 TRACE_IRQS_ON
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index dc364c1419af..a816e2de32b9 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -57,61 +57,6 @@ startup_continue:
57# 57#
58 l %r14,.Lstartup_init-.LPG1(%r13) 58 l %r14,.Lstartup_init-.LPG1(%r13)
59 basr %r14,%r14 59 basr %r14,%r14
60
61 l %r12,.Lmflags-.LPG1(%r13) # get address of machine_flags
62#
63# find out if we have an IEEE fpu
64#
65 mvc __LC_PGM_NEW_PSW(8),.Lpcfpu-.LPG1(%r13)
66 efpc %r0,0 # test IEEE extract fpc instruction
67 oi 3(%r12),2 # set IEEE fpu flag
68.Lchkfpu:
69
70#
71# find out if we have the CSP instruction
72#
73 mvc __LC_PGM_NEW_PSW(8),.Lpccsp-.LPG1(%r13)
74 la %r0,0
75 lr %r1,%r0
76 la %r2,4
77 csp %r0,%r2 # Test CSP instruction
78 oi 3(%r12),8 # set CSP flag
79.Lchkcsp:
80
81#
82# find out if we have the MVPG instruction
83#
84 mvc __LC_PGM_NEW_PSW(8),.Lpcmvpg-.LPG1(%r13)
85 sr %r0,%r0
86 la %r1,0
87 la %r2,0
88 mvpg %r1,%r2 # Test CSP instruction
89 oi 3(%r12),16 # set MVPG flag
90.Lchkmvpg:
91
92#
93# find out if we have the IDTE instruction
94#
95 mvc __LC_PGM_NEW_PSW(8),.Lpcidte-.LPG1(%r13)
96 .long 0xb2b10000 # store facility list
97 tm 0xc8,0x08 # check bit for clearing-by-ASCE
98 bno .Lchkidte-.LPG1(%r13)
99 lhi %r1,2094
100 lhi %r2,0
101 .long 0xb98e2001
102 oi 3(%r12),0x80 # set IDTE flag
103.Lchkidte:
104
105#
106# find out if the diag 0x9c is available
107#
108 mvc __LC_PGM_NEW_PSW(8),.Lpcdiag9c-.LPG1(%r13)
109 stap __LC_CPUID+4 # store cpu address
110 lh %r1,__LC_CPUID+4
111 diag %r1,0,0x9c # test diag 0x9c
112 oi 2(%r12),1 # set diag9c flag
113.Lchkdiag9c:
114
115 lpsw .Lentry-.LPG1(13) # jump to _stext in primary-space, 60 lpsw .Lentry-.LPG1(13) # jump to _stext in primary-space,
116 # virtual and never return ... 61 # virtual and never return ...
117 .align 8 62 .align 8
@@ -132,13 +77,7 @@ startup_continue:
132 .long 0 # cr13: home space segment table 77 .long 0 # cr13: home space segment table
133 .long 0xc0000000 # cr14: machine check handling off 78 .long 0xc0000000 # cr14: machine check handling off
134 .long 0 # cr15: linkage stack operations 79 .long 0 # cr15: linkage stack operations
135.Lpcfpu:.long 0x00080000,0x80000000 + .Lchkfpu
136.Lpccsp:.long 0x00080000,0x80000000 + .Lchkcsp
137.Lpcmvpg:.long 0x00080000,0x80000000 + .Lchkmvpg
138.Lpcidte:.long 0x00080000,0x80000000 + .Lchkidte
139.Lpcdiag9c:.long 0x00080000,0x80000000 + .Lchkdiag9c
140.Lmchunk:.long memory_chunk 80.Lmchunk:.long memory_chunk
141.Lmflags:.long machine_flags
142.Lbss_bgn: .long __bss_start 81.Lbss_bgn: .long __bss_start
143.Lbss_end: .long _end 82.Lbss_end: .long _end
144.Lparmaddr: .long PARMAREA 83.Lparmaddr: .long PARMAREA
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 79dccd206a6e..1d06961e87b3 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -125,73 +125,11 @@ startup_continue:
125# and create a kernel NSS if the SAVESYS= parm is defined 125# and create a kernel NSS if the SAVESYS= parm is defined
126# 126#
127 brasl %r14,startup_init 127 brasl %r14,startup_init
128 # set program check new psw mask
129 mvc __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13)
130 larl %r12,machine_flags
131#
132# find out if we have the MVPG instruction
133#
134 la %r1,0f-.LPG1(%r13) # set program check address
135 stg %r1,__LC_PGM_NEW_PSW+8
136 sgr %r0,%r0
137 lghi %r1,0
138 lghi %r2,0
139 mvpg %r1,%r2 # test MVPG instruction
140 oi 7(%r12),16 # set MVPG flag
1410:
142
143#
144# find out if the diag 0x44 works in 64 bit mode
145#
146 la %r1,0f-.LPG1(%r13) # set program check address
147 stg %r1,__LC_PGM_NEW_PSW+8
148 diag 0,0,0x44 # test diag 0x44
149 oi 7(%r12),32 # set diag44 flag
1500:
151
152#
153# find out if we have the IDTE instruction
154#
155 la %r1,0f-.LPG1(%r13) # set program check address
156 stg %r1,__LC_PGM_NEW_PSW+8
157 .long 0xb2b10000 # store facility list
158 tm 0xc8,0x08 # check bit for clearing-by-ASCE
159 bno 0f-.LPG1(%r13)
160 lhi %r1,2048
161 lhi %r2,0
162 .long 0xb98e2001
163 oi 7(%r12),0x80 # set IDTE flag
1640:
165
166#
167# find out if the diag 0x9c is available
168#
169 la %r1,0f-.LPG1(%r13) # set program check address
170 stg %r1,__LC_PGM_NEW_PSW+8
171 stap __LC_CPUID+4 # store cpu address
172 lh %r1,__LC_CPUID+4
173 diag %r1,0,0x9c # test diag 0x9c
174 oi 6(%r12),1 # set diag9c flag
1750:
176
177#
178# find out if we have the MVCOS instruction
179#
180 la %r1,0f-.LPG1(%r13) # set program check address
181 stg %r1,__LC_PGM_NEW_PSW+8
182 .short 0xc800 # mvcos 0(%r0),0(%r0),%r0
183 .short 0x0000
184 .short 0x0000
1850: tm 0x8f,0x13 # special-operation exception?
186 bno 1f-.LPG1(%r13) # if yes, MVCOS is present
187 oi 6(%r12),2 # set MVCOS flag
1881:
189
190 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space, 128 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space,
191 # virtual and never return ... 129 # virtual and never return ...
192 .align 16 130 .align 16
193.Lentry:.quad 0x0000000180000000,_stext 131.Lentry:.quad 0x0000000180000000,_stext
194.Lctl: .quad 0x04b50002 # cr0: various things 132.Lctl: .quad 0x04350002 # cr0: various things
195 .quad 0 # cr1: primary space segment table 133 .quad 0 # cr1: primary space segment table
196 .quad .Lduct # cr2: dispatchable unit control table 134 .quad .Lduct # cr2: dispatchable unit control table
197 .quad 0 # cr3: instruction authorization 135 .quad 0 # cr3: instruction authorization
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index c36d8123ca14..c59a86dca584 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -60,8 +60,6 @@ init_IRQ(void)
60/* 60/*
61 * Switch to the asynchronous interrupt stack for softirq execution. 61 * Switch to the asynchronous interrupt stack for softirq execution.
62 */ 62 */
63extern void __do_softirq(void);
64
65asmlinkage void do_softirq(void) 63asmlinkage void do_softirq(void)
66{ 64{
67 unsigned long flags, old, new; 65 unsigned long flags, old, new;
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index c1aff194141d..7920861109d2 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -180,24 +180,6 @@ void cpu_idle(void)
180 } 180 }
181} 181}
182 182
183void show_regs(struct pt_regs *regs)
184{
185 print_modules();
186 printk("CPU: %d %s %s %.*s\n",
187 task_thread_info(current)->cpu, print_tainted(),
188 init_utsname()->release,
189 (int)strcspn(init_utsname()->version, " "),
190 init_utsname()->version);
191 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
192 current->comm, current->pid, current,
193 (void *) current->thread.ksp);
194 show_registers(regs);
195 /* Show stack backtrace if pt_regs is from kernel mode */
196 if (!(regs->psw.mask & PSW_MASK_PSTATE))
197 show_trace(NULL, (unsigned long *) regs->gprs[15]);
198 show_last_breaking_event(regs);
199}
200
201extern void kernel_thread_starter(void); 183extern void kernel_thread_starter(void);
202 184
203asm( 185asm(
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 58a064296987..7f4270163744 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -607,38 +607,8 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
607} 607}
608#endif 608#endif
609 609
610#define PT32_IEEE_IP 0x13c 610long arch_ptrace(struct task_struct *child, long request, long addr, long data)
611
612static int
613do_ptrace(struct task_struct *child, long request, long addr, long data)
614{ 611{
615 int ret;
616
617 if (request == PTRACE_ATTACH)
618 return ptrace_attach(child);
619
620 /*
621 * Special cases to get/store the ieee instructions pointer.
622 */
623 if (child == current) {
624 if (request == PTRACE_PEEKUSR && addr == PT_IEEE_IP)
625 return peek_user(child, addr, data);
626 if (request == PTRACE_POKEUSR && addr == PT_IEEE_IP)
627 return poke_user(child, addr, data);
628#ifdef CONFIG_COMPAT
629 if (request == PTRACE_PEEKUSR &&
630 addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
631 return peek_user_emu31(child, addr, data);
632 if (request == PTRACE_POKEUSR &&
633 addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
634 return poke_user_emu31(child, addr, data);
635#endif
636 }
637
638 ret = ptrace_check_attach(child, request == PTRACE_KILL);
639 if (ret < 0)
640 return ret;
641
642 switch (request) { 612 switch (request) {
643 case PTRACE_SYSCALL: 613 case PTRACE_SYSCALL:
644 /* continue and stop at next (return from) syscall */ 614 /* continue and stop at next (return from) syscall */
@@ -693,31 +663,6 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
693 return -EIO; 663 return -EIO;
694} 664}
695 665
696asmlinkage long
697sys_ptrace(long request, long pid, long addr, long data)
698{
699 struct task_struct *child;
700 int ret;
701
702 lock_kernel();
703 if (request == PTRACE_TRACEME) {
704 ret = ptrace_traceme();
705 goto out;
706 }
707
708 child = ptrace_get_task_struct(pid);
709 if (IS_ERR(child)) {
710 ret = PTR_ERR(child);
711 goto out;
712 }
713
714 ret = do_ptrace(child, request, addr, data);
715 put_task_struct(child);
716out:
717 unlock_kernel();
718 return ret;
719}
720
721asmlinkage void 666asmlinkage void
722syscall_trace(struct pt_regs *regs, int entryexit) 667syscall_trace(struct pt_regs *regs, int entryexit)
723{ 668{
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index a9d18aafa5f4..2bc70b6e876a 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -73,7 +73,7 @@ EXPORT_SYMBOL(uaccess);
73unsigned int console_mode = 0; 73unsigned int console_mode = 0;
74unsigned int console_devno = -1; 74unsigned int console_devno = -1;
75unsigned int console_irq = -1; 75unsigned int console_irq = -1;
76unsigned long machine_flags = 0; 76unsigned long machine_flags;
77unsigned long elf_hwcap = 0; 77unsigned long elf_hwcap = 0;
78char elf_platform[ELF_PLATFORM_SIZE]; 78char elf_platform[ELF_PLATFORM_SIZE];
79 79
@@ -683,15 +683,6 @@ setup_memory(void)
683#endif 683#endif
684} 684}
685 685
686static __init unsigned int stfl(void)
687{
688 asm volatile(
689 " .insn s,0xb2b10000,0(0)\n" /* stfl */
690 "0:\n"
691 EX_TABLE(0b,0b));
692 return S390_lowcore.stfl_fac_list;
693}
694
695static int __init __stfle(unsigned long long *list, int doublewords) 686static int __init __stfle(unsigned long long *list, int doublewords)
696{ 687{
697 typedef struct { unsigned long long _[doublewords]; } addrtype; 688 typedef struct { unsigned long long _[doublewords]; } addrtype;
@@ -758,6 +749,9 @@ static void __init setup_hwcaps(void)
758 elf_hwcap |= 1UL << 6; 749 elf_hwcap |= 1UL << 6;
759 } 750 }
760 751
752 if (MACHINE_HAS_HPAGE)
753 elf_hwcap |= 1UL << 7;
754
761 switch (cpuinfo->cpu_id.machine) { 755 switch (cpuinfo->cpu_id.machine) {
762 case 0x9672: 756 case 0x9672:
763#if !defined(CONFIG_64BIT) 757#if !defined(CONFIG_64BIT)
@@ -881,8 +875,9 @@ void __cpuinit print_cpu_info(struct cpuinfo_S390 *cpuinfo)
881 875
882static int show_cpuinfo(struct seq_file *m, void *v) 876static int show_cpuinfo(struct seq_file *m, void *v)
883{ 877{
884 static const char *hwcap_str[7] = { 878 static const char *hwcap_str[8] = {
885 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp" 879 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
880 "edat"
886 }; 881 };
887 struct cpuinfo_S390 *cpuinfo; 882 struct cpuinfo_S390 *cpuinfo;
888 unsigned long n = (unsigned long) v - 1; 883 unsigned long n = (unsigned long) v - 1;
@@ -897,7 +892,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
897 num_online_cpus(), loops_per_jiffy/(500000/HZ), 892 num_online_cpus(), loops_per_jiffy/(500000/HZ),
898 (loops_per_jiffy/(5000/HZ))%100); 893 (loops_per_jiffy/(5000/HZ))%100);
899 seq_puts(m, "features\t: "); 894 seq_puts(m, "features\t: ");
900 for (i = 0; i < 7; i++) 895 for (i = 0; i < 8; i++)
901 if (hwcap_str[i] && (elf_hwcap & (1UL << i))) 896 if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
902 seq_printf(m, "%s ", hwcap_str[i]); 897 seq_printf(m, "%s ", hwcap_str[i]);
903 seq_puts(m, "\n"); 898 seq_puts(m, "\n");
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 0dfa988c1b26..0aeb290060d9 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -505,7 +505,7 @@ out:
505 return rc; 505 return rc;
506} 506}
507 507
508static int smp_rescan_cpus(void) 508static int __smp_rescan_cpus(void)
509{ 509{
510 cpumask_t avail; 510 cpumask_t avail;
511 511
@@ -570,7 +570,7 @@ out:
570 kfree(info); 570 kfree(info);
571 printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus); 571 printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus);
572 get_online_cpus(); 572 get_online_cpus();
573 smp_rescan_cpus(); 573 __smp_rescan_cpus();
574 put_online_cpus(); 574 put_online_cpus();
575} 575}
576 576
@@ -890,8 +890,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf,
890 if (val != 0 && val != 1) 890 if (val != 0 && val != 1)
891 return -EINVAL; 891 return -EINVAL;
892 892
893 mutex_lock(&smp_cpu_state_mutex);
894 get_online_cpus(); 893 get_online_cpus();
894 mutex_lock(&smp_cpu_state_mutex);
895 rc = -EBUSY; 895 rc = -EBUSY;
896 if (cpu_online(cpu)) 896 if (cpu_online(cpu))
897 goto out; 897 goto out;
@@ -919,8 +919,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf,
919 break; 919 break;
920 } 920 }
921out: 921out:
922 put_online_cpus();
923 mutex_unlock(&smp_cpu_state_mutex); 922 mutex_unlock(&smp_cpu_state_mutex);
923 put_online_cpus();
924 return rc ? rc : count; 924 return rc ? rc : count;
925} 925}
926static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); 926static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
@@ -1088,17 +1088,17 @@ out:
1088} 1088}
1089 1089
1090#ifdef CONFIG_HOTPLUG_CPU 1090#ifdef CONFIG_HOTPLUG_CPU
1091static ssize_t __ref rescan_store(struct sys_device *dev, 1091
1092 const char *buf, size_t count) 1092int smp_rescan_cpus(void)
1093{ 1093{
1094 cpumask_t newcpus; 1094 cpumask_t newcpus;
1095 int cpu; 1095 int cpu;
1096 int rc; 1096 int rc;
1097 1097
1098 mutex_lock(&smp_cpu_state_mutex);
1099 get_online_cpus(); 1098 get_online_cpus();
1099 mutex_lock(&smp_cpu_state_mutex);
1100 newcpus = cpu_present_map; 1100 newcpus = cpu_present_map;
1101 rc = smp_rescan_cpus(); 1101 rc = __smp_rescan_cpus();
1102 if (rc) 1102 if (rc)
1103 goto out; 1103 goto out;
1104 cpus_andnot(newcpus, cpu_present_map, newcpus); 1104 cpus_andnot(newcpus, cpu_present_map, newcpus);
@@ -1109,10 +1109,19 @@ static ssize_t __ref rescan_store(struct sys_device *dev,
1109 } 1109 }
1110 rc = 0; 1110 rc = 0;
1111out: 1111out:
1112 put_online_cpus();
1113 mutex_unlock(&smp_cpu_state_mutex); 1112 mutex_unlock(&smp_cpu_state_mutex);
1113 put_online_cpus();
1114 if (!cpus_empty(newcpus)) 1114 if (!cpus_empty(newcpus))
1115 topology_schedule_update(); 1115 topology_schedule_update();
1116 return rc;
1117}
1118
1119static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf,
1120 size_t count)
1121{
1122 int rc;
1123
1124 rc = smp_rescan_cpus();
1116 return rc ? rc : count; 1125 return rc ? rc : count;
1117} 1126}
1118static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); 1127static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store);
@@ -1139,16 +1148,16 @@ static ssize_t dispatching_store(struct sys_device *dev, const char *buf,
1139 if (val != 0 && val != 1) 1148 if (val != 0 && val != 1)
1140 return -EINVAL; 1149 return -EINVAL;
1141 rc = 0; 1150 rc = 0;
1142 mutex_lock(&smp_cpu_state_mutex);
1143 get_online_cpus(); 1151 get_online_cpus();
1152 mutex_lock(&smp_cpu_state_mutex);
1144 if (cpu_management == val) 1153 if (cpu_management == val)
1145 goto out; 1154 goto out;
1146 rc = topology_set_cpu_management(val); 1155 rc = topology_set_cpu_management(val);
1147 if (!rc) 1156 if (!rc)
1148 cpu_management = val; 1157 cpu_management = val;
1149out: 1158out:
1150 put_online_cpus();
1151 mutex_unlock(&smp_cpu_state_mutex); 1159 mutex_unlock(&smp_cpu_state_mutex);
1160 put_online_cpus();
1152 return rc ? rc : count; 1161 return rc ? rc : count;
1153} 1162}
1154static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store); 1163static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store);
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 988d0d64c2c8..5fdb799062b7 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -32,23 +32,6 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include "entry.h" 33#include "entry.h"
34 34
35/*
36 * sys_pipe() is the normal C calling standard for creating
37 * a pipe. It's not the way Unix traditionally does this, though.
38 */
39asmlinkage long sys_pipe(unsigned long __user *fildes)
40{
41 int fd[2];
42 int error;
43
44 error = do_pipe(fd);
45 if (!error) {
46 if (copy_to_user(fildes, fd, 2*sizeof(int)))
47 error = -EFAULT;
48 }
49 return error;
50}
51
52/* common code for old and new mmaps */ 35/* common code for old and new mmaps */
53static inline long do_mmap2( 36static inline long do_mmap2(
54 unsigned long addr, unsigned long len, 37 unsigned long addr, unsigned long len,
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 12b39b3d9c38..661a07217057 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -9,6 +9,7 @@
9#include <linux/device.h> 9#include <linux/device.h>
10#include <linux/bootmem.h> 10#include <linux/bootmem.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/kthread.h>
12#include <linux/workqueue.h> 13#include <linux/workqueue.h>
13#include <linux/cpu.h> 14#include <linux/cpu.h>
14#include <linux/smp.h> 15#include <linux/smp.h>
@@ -66,6 +67,8 @@ static struct timer_list topology_timer;
66static void set_topology_timer(void); 67static void set_topology_timer(void);
67static DECLARE_WORK(topology_work, topology_work_fn); 68static DECLARE_WORK(topology_work, topology_work_fn);
68 69
70cpumask_t cpu_core_map[NR_CPUS];
71
69cpumask_t cpu_coregroup_map(unsigned int cpu) 72cpumask_t cpu_coregroup_map(unsigned int cpu)
70{ 73{
71 struct core_info *core = &core_info; 74 struct core_info *core = &core_info;
@@ -199,6 +202,14 @@ int topology_set_cpu_management(int fc)
199 return rc; 202 return rc;
200} 203}
201 204
205static void update_cpu_core_map(void)
206{
207 int cpu;
208
209 for_each_present_cpu(cpu)
210 cpu_core_map[cpu] = cpu_coregroup_map(cpu);
211}
212
202void arch_update_cpu_topology(void) 213void arch_update_cpu_topology(void)
203{ 214{
204 struct tl_info *info = tl_info; 215 struct tl_info *info = tl_info;
@@ -206,20 +217,33 @@ void arch_update_cpu_topology(void)
206 int cpu; 217 int cpu;
207 218
208 if (!machine_has_topology) { 219 if (!machine_has_topology) {
220 update_cpu_core_map();
209 topology_update_polarization_simple(); 221 topology_update_polarization_simple();
210 return; 222 return;
211 } 223 }
212 stsi(info, 15, 1, 2); 224 stsi(info, 15, 1, 2);
213 tl_to_cores(info); 225 tl_to_cores(info);
226 update_cpu_core_map();
214 for_each_online_cpu(cpu) { 227 for_each_online_cpu(cpu) {
215 sysdev = get_cpu_sysdev(cpu); 228 sysdev = get_cpu_sysdev(cpu);
216 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 229 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
217 } 230 }
218} 231}
219 232
220static void topology_work_fn(struct work_struct *work) 233static int topology_kthread(void *data)
221{ 234{
222 arch_reinit_sched_domains(); 235 arch_reinit_sched_domains();
236 return 0;
237}
238
239static void topology_work_fn(struct work_struct *work)
240{
241 /* We can't call arch_reinit_sched_domains() from a multi-threaded
242 * workqueue context since it may deadlock in case of cpu hotplug.
243 * So we have to create a kernel thread in order to call
244 * arch_reinit_sched_domains().
245 */
246 kthread_run(topology_kthread, NULL, "topology_update");
223} 247}
224 248
225void topology_schedule_update(void) 249void topology_schedule_update(void)
@@ -251,20 +275,23 @@ static int __init init_topology_update(void)
251{ 275{
252 int rc; 276 int rc;
253 277
278 rc = 0;
254 if (!machine_has_topology) { 279 if (!machine_has_topology) {
255 topology_update_polarization_simple(); 280 topology_update_polarization_simple();
256 return 0; 281 goto out;
257 } 282 }
258 init_timer_deferrable(&topology_timer); 283 init_timer_deferrable(&topology_timer);
259 if (machine_has_topology_irq) { 284 if (machine_has_topology_irq) {
260 rc = register_external_interrupt(0x2005, topology_interrupt); 285 rc = register_external_interrupt(0x2005, topology_interrupt);
261 if (rc) 286 if (rc)
262 return rc; 287 goto out;
263 ctl_set_bit(0, 8); 288 ctl_set_bit(0, 8);
264 } 289 }
265 else 290 else
266 set_topology_timer(); 291 set_topology_timer();
267 return 0; 292out:
293 update_cpu_core_map();
294 return rc;
268} 295}
269__initcall(init_topology_update); 296__initcall(init_topology_update);
270 297
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 57b607b61100..4584d81984c0 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -113,7 +113,7 @@ __show_trace(unsigned long sp, unsigned long low, unsigned long high)
113 } 113 }
114} 114}
115 115
116void show_trace(struct task_struct *task, unsigned long *stack) 116static void show_trace(struct task_struct *task, unsigned long *stack)
117{ 117{
118 register unsigned long __r15 asm ("15"); 118 register unsigned long __r15 asm ("15");
119 unsigned long sp; 119 unsigned long sp;
@@ -161,14 +161,14 @@ void show_stack(struct task_struct *task, unsigned long *sp)
161 show_trace(task, sp); 161 show_trace(task, sp);
162} 162}
163 163
164#ifdef CONFIG_64BIT 164static void show_last_breaking_event(struct pt_regs *regs)
165void show_last_breaking_event(struct pt_regs *regs)
166{ 165{
166#ifdef CONFIG_64BIT
167 printk("Last Breaking-Event-Address:\n"); 167 printk("Last Breaking-Event-Address:\n");
168 printk(" [<%016lx>] ", regs->args[0] & PSW_ADDR_INSN); 168 printk(" [<%016lx>] ", regs->args[0] & PSW_ADDR_INSN);
169 print_symbol("%s\n", regs->args[0] & PSW_ADDR_INSN); 169 print_symbol("%s\n", regs->args[0] & PSW_ADDR_INSN);
170}
171#endif 170#endif
171}
172 172
173/* 173/*
174 * The architecture-independent dump_stack generator 174 * The architecture-independent dump_stack generator
@@ -223,6 +223,24 @@ void show_registers(struct pt_regs *regs)
223 show_code(regs); 223 show_code(regs);
224} 224}
225 225
226void show_regs(struct pt_regs *regs)
227{
228 print_modules();
229 printk("CPU: %d %s %s %.*s\n",
230 task_thread_info(current)->cpu, print_tainted(),
231 init_utsname()->release,
232 (int)strcspn(init_utsname()->version, " "),
233 init_utsname()->version);
234 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
235 current->comm, current->pid, current,
236 (void *) current->thread.ksp);
237 show_registers(regs);
238 /* Show stack backtrace if pt_regs is from kernel mode */
239 if (!(regs->psw.mask & PSW_MASK_PSTATE))
240 show_trace(NULL, (unsigned long *) regs->gprs[15]);
241 show_last_breaking_event(regs);
242}
243
226/* This is called from fs/proc/array.c */ 244/* This is called from fs/proc/array.c */
227void task_show_regs(struct seq_file *m, struct task_struct *task) 245void task_show_regs(struct seq_file *m, struct task_struct *task)
228{ 246{
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 1465946325c5..c02286c6a931 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -151,18 +151,9 @@ static int handle_chsc(struct kvm_vcpu *vcpu)
151 return 0; 151 return 0;
152} 152}
153 153
154static unsigned int kvm_stfl(void)
155{
156 asm volatile(
157 " .insn s,0xb2b10000,0(0)\n" /* stfl */
158 "0:\n"
159 EX_TABLE(0b, 0b));
160 return S390_lowcore.stfl_fac_list;
161}
162
163static int handle_stfl(struct kvm_vcpu *vcpu) 154static int handle_stfl(struct kvm_vcpu *vcpu)
164{ 155{
165 unsigned int facility_list = kvm_stfl(); 156 unsigned int facility_list = stfl();
166 int rc; 157 int rc;
167 158
168 vcpu->stat.instruction_stfl++; 159 vcpu->stat.instruction_stfl++;
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index 52084436ab69..ab6735df2d21 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -2,8 +2,6 @@
2# Makefile for s390-specific library files.. 2# Makefile for s390-specific library files..
3# 3#
4 4
5EXTRA_AFLAGS := -traditional
6
7lib-y += delay.o string.o uaccess_std.o uaccess_pt.o 5lib-y += delay.o string.o uaccess_std.o uaccess_pt.o
8obj-$(CONFIG_32BIT) += div64.o qrnnd.o 6obj-$(CONFIG_32BIT) += div64.o qrnnd.o
9lib-$(CONFIG_64BIT) += uaccess_mvcos.o 7lib-$(CONFIG_64BIT) += uaccess_mvcos.o
diff --git a/arch/s390/lib/uaccess_mvcos.c b/arch/s390/lib/uaccess_mvcos.c
index 6d8772339d76..3f15aaf54855 100644
--- a/arch/s390/lib/uaccess_mvcos.c
+++ b/arch/s390/lib/uaccess_mvcos.c
@@ -162,6 +162,7 @@ static size_t clear_user_mvcos(size_t size, void __user *to)
162 return size; 162 return size;
163} 163}
164 164
165#ifdef CONFIG_S390_SWITCH_AMODE
165static size_t strnlen_user_mvcos(size_t count, const char __user *src) 166static size_t strnlen_user_mvcos(size_t count, const char __user *src)
166{ 167{
167 char buf[256]; 168 char buf[256];
@@ -199,6 +200,7 @@ static size_t strncpy_from_user_mvcos(size_t count, const char __user *src,
199 } while ((len_str == len) && (done < count)); 200 } while ((len_str == len) && (done < count));
200 return done; 201 return done;
201} 202}
203#endif /* CONFIG_S390_SWITCH_AMODE */
202 204
203struct uaccess_ops uaccess_mvcos = { 205struct uaccess_ops uaccess_mvcos = {
204 .copy_from_user = copy_from_user_mvcos_check, 206 .copy_from_user = copy_from_user_mvcos_check,
diff --git a/arch/s390/math-emu/Makefile b/arch/s390/math-emu/Makefile
index 73b3e72efc46..c84890341052 100644
--- a/arch/s390/math-emu/Makefile
+++ b/arch/s390/math-emu/Makefile
@@ -5,4 +5,3 @@
5obj-$(CONFIG_MATHEMU) := math.o 5obj-$(CONFIG_MATHEMU) := math.o
6 6
7EXTRA_CFLAGS := -I$(src) -Iinclude/math-emu -w 7EXTRA_CFLAGS := -I$(src) -Iinclude/math-emu -w
8EXTRA_AFLAGS := -traditional
diff --git a/arch/s390/mm/Makefile b/arch/s390/mm/Makefile
index 66401930f83e..fb988a48a754 100644
--- a/arch/s390/mm/Makefile
+++ b/arch/s390/mm/Makefile
@@ -4,4 +4,4 @@
4 4
5obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o 5obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o
6obj-$(CONFIG_CMM) += cmm.o 6obj-$(CONFIG_CMM) += cmm.o
7 7obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index ed2af0a3303b..f231f5ec74b6 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -287,7 +287,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
287 if (rc < 0) 287 if (rc < 0)
288 goto out_free; 288 goto out_free;
289 289
290 rc = add_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 290 rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
291 291
292 if (rc) 292 if (rc)
293 goto out_free; 293 goto out_free;
@@ -351,7 +351,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
351 release_resource(seg->res); 351 release_resource(seg->res);
352 kfree(seg->res); 352 kfree(seg->res);
353 out_shared: 353 out_shared:
354 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 354 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
355 out_free: 355 out_free:
356 kfree(seg); 356 kfree(seg);
357 out: 357 out:
@@ -474,7 +474,7 @@ segment_modify_shared (char *name, int do_nonshared)
474 rc = 0; 474 rc = 0;
475 goto out_unlock; 475 goto out_unlock;
476 out_del: 476 out_del:
477 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 477 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
478 list_del(&seg->list); 478 list_del(&seg->list);
479 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy); 479 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy);
480 kfree(seg); 480 kfree(seg);
@@ -508,7 +508,7 @@ segment_unload(char *name)
508 goto out_unlock; 508 goto out_unlock;
509 release_resource(seg->res); 509 release_resource(seg->res);
510 kfree(seg->res); 510 kfree(seg->res);
511 remove_shared_memory(seg->start_addr, seg->end - seg->start_addr + 1); 511 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
512 list_del(&seg->list); 512 list_del(&seg->list);
513 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy); 513 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy);
514 kfree(seg); 514 kfree(seg);
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 2650f46001d0..4d537205e83c 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -28,6 +28,7 @@
28#include <linux/hardirq.h> 28#include <linux/hardirq.h>
29#include <linux/kprobes.h> 29#include <linux/kprobes.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/hugetlb.h>
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/pgtable.h> 33#include <asm/pgtable.h>
33#include <asm/s390_ext.h> 34#include <asm/s390_ext.h>
@@ -367,6 +368,8 @@ good_area:
367 } 368 }
368 369
369survive: 370survive:
371 if (is_vm_hugetlb_page(vma))
372 address &= HPAGE_MASK;
370 /* 373 /*
371 * If for any reason at all we couldn't handle the fault, 374 * If for any reason at all we couldn't handle the fault,
372 * make sure we exit gracefully rather than endlessly redo 375 * make sure we exit gracefully rather than endlessly redo
diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c
new file mode 100644
index 000000000000..f4b6124fdb75
--- /dev/null
+++ b/arch/s390/mm/hugetlbpage.c
@@ -0,0 +1,134 @@
1/*
2 * IBM System z Huge TLB Page Support for Kernel.
3 *
4 * Copyright 2007 IBM Corp.
5 * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
6 */
7
8#include <linux/mm.h>
9#include <linux/hugetlb.h>
10
11
12void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
13 pte_t *pteptr, pte_t pteval)
14{
15 pmd_t *pmdp = (pmd_t *) pteptr;
16 pte_t shadow_pteval = pteval;
17 unsigned long mask;
18
19 if (!MACHINE_HAS_HPAGE) {
20 pteptr = (pte_t *) pte_page(pteval)[1].index;
21 mask = pte_val(pteval) &
22 (_SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO);
23 pte_val(pteval) = (_SEGMENT_ENTRY + __pa(pteptr)) | mask;
24 if (mm->context.noexec) {
25 pteptr += PTRS_PER_PTE;
26 pte_val(shadow_pteval) =
27 (_SEGMENT_ENTRY + __pa(pteptr)) | mask;
28 }
29 }
30
31 pmd_val(*pmdp) = pte_val(pteval);
32 if (mm->context.noexec) {
33 pmdp = get_shadow_table(pmdp);
34 pmd_val(*pmdp) = pte_val(shadow_pteval);
35 }
36}
37
38int arch_prepare_hugepage(struct page *page)
39{
40 unsigned long addr = page_to_phys(page);
41 pte_t pte;
42 pte_t *ptep;
43 int i;
44
45 if (MACHINE_HAS_HPAGE)
46 return 0;
47
48 ptep = (pte_t *) pte_alloc_one(&init_mm, address);
49 if (!ptep)
50 return -ENOMEM;
51
52 pte = mk_pte(page, PAGE_RW);
53 for (i = 0; i < PTRS_PER_PTE; i++) {
54 set_pte_at(&init_mm, addr + i * PAGE_SIZE, ptep + i, pte);
55 pte_val(pte) += PAGE_SIZE;
56 }
57 page[1].index = (unsigned long) ptep;
58 return 0;
59}
60
61void arch_release_hugepage(struct page *page)
62{
63 pte_t *ptep;
64
65 if (MACHINE_HAS_HPAGE)
66 return;
67
68 ptep = (pte_t *) page[1].index;
69 if (!ptep)
70 return;
71 pte_free(&init_mm, ptep);
72 page[1].index = 0;
73}
74
75pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
76{
77 pgd_t *pgdp;
78 pud_t *pudp;
79 pmd_t *pmdp = NULL;
80
81 pgdp = pgd_offset(mm, addr);
82 pudp = pud_alloc(mm, pgdp, addr);
83 if (pudp)
84 pmdp = pmd_alloc(mm, pudp, addr);
85 return (pte_t *) pmdp;
86}
87
88pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
89{
90 pgd_t *pgdp;
91 pud_t *pudp;
92 pmd_t *pmdp = NULL;
93
94 pgdp = pgd_offset(mm, addr);
95 if (pgd_present(*pgdp)) {
96 pudp = pud_offset(pgdp, addr);
97 if (pud_present(*pudp))
98 pmdp = pmd_offset(pudp, addr);
99 }
100 return (pte_t *) pmdp;
101}
102
103int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
104{
105 return 0;
106}
107
108struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
109 int write)
110{
111 return ERR_PTR(-EINVAL);
112}
113
114int pmd_huge(pmd_t pmd)
115{
116 if (!MACHINE_HAS_HPAGE)
117 return 0;
118
119 return !!(pmd_val(pmd) & _SEGMENT_ENTRY_LARGE);
120}
121
122struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
123 pmd_t *pmdp, int write)
124{
125 struct page *page;
126
127 if (!MACHINE_HAS_HPAGE)
128 return NULL;
129
130 page = pmd_page(*pmdp);
131 if (page)
132 page += ((address & ~HPAGE_MASK) >> PAGE_SHIFT);
133 return page;
134}
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 202c952a29b4..fa31de6ae97a 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -77,28 +77,6 @@ void show_mem(void)
77 printk("%lu pages pagetables\n", global_page_state(NR_PAGETABLE)); 77 printk("%lu pages pagetables\n", global_page_state(NR_PAGETABLE));
78} 78}
79 79
80static void __init setup_ro_region(void)
81{
82 pgd_t *pgd;
83 pud_t *pud;
84 pmd_t *pmd;
85 pte_t *pte;
86 pte_t new_pte;
87 unsigned long address, end;
88
89 address = ((unsigned long)&_stext) & PAGE_MASK;
90 end = PFN_ALIGN((unsigned long)&_eshared);
91
92 for (; address < end; address += PAGE_SIZE) {
93 pgd = pgd_offset_k(address);
94 pud = pud_offset(pgd, address);
95 pmd = pmd_offset(pud, address);
96 pte = pte_offset_kernel(pmd, address);
97 new_pte = mk_pte_phys(address, __pgprot(_PAGE_RO));
98 *pte = new_pte;
99 }
100}
101
102/* 80/*
103 * paging_init() sets up the page tables 81 * paging_init() sets up the page tables
104 */ 82 */
@@ -121,7 +99,6 @@ void __init paging_init(void)
121 clear_table((unsigned long *) init_mm.pgd, pgd_type, 99 clear_table((unsigned long *) init_mm.pgd, pgd_type,
122 sizeof(unsigned long)*2048); 100 sizeof(unsigned long)*2048);
123 vmem_map_init(); 101 vmem_map_init();
124 setup_ro_region();
125 102
126 /* enable virtual mapping in kernel mode */ 103 /* enable virtual mapping in kernel mode */
127 __ctl_load(S390_lowcore.kernel_asce, 1, 1); 104 __ctl_load(S390_lowcore.kernel_asce, 1, 1);
@@ -129,6 +106,8 @@ void __init paging_init(void)
129 __ctl_load(S390_lowcore.kernel_asce, 13, 13); 106 __ctl_load(S390_lowcore.kernel_asce, 13, 13);
130 __raw_local_irq_ssm(ssm_mask); 107 __raw_local_irq_ssm(ssm_mask);
131 108
109 sparse_memory_present_with_active_regions(MAX_NUMNODES);
110 sparse_init();
132 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 111 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
133#ifdef CONFIG_ZONE_DMA 112#ifdef CONFIG_ZONE_DMA
134 max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS); 113 max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS);
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 35d90a4720fd..beccacf907f3 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -10,10 +10,12 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/hugetlb.h>
13#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
15#include <asm/setup.h> 16#include <asm/setup.h>
16#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18#include <asm/sections.h>
17 19
18static DEFINE_MUTEX(vmem_mutex); 20static DEFINE_MUTEX(vmem_mutex);
19 21
@@ -25,43 +27,6 @@ struct memory_segment {
25 27
26static LIST_HEAD(mem_segs); 28static LIST_HEAD(mem_segs);
27 29
28void __meminit memmap_init(unsigned long size, int nid, unsigned long zone,
29 unsigned long start_pfn)
30{
31 struct page *start, *end;
32 struct page *map_start, *map_end;
33 int i;
34
35 start = pfn_to_page(start_pfn);
36 end = start + size;
37
38 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
39 unsigned long cstart, cend;
40
41 cstart = PFN_DOWN(memory_chunk[i].addr);
42 cend = cstart + PFN_DOWN(memory_chunk[i].size);
43
44 map_start = mem_map + cstart;
45 map_end = mem_map + cend;
46
47 if (map_start < start)
48 map_start = start;
49 if (map_end > end)
50 map_end = end;
51
52 map_start -= ((unsigned long) map_start & (PAGE_SIZE - 1))
53 / sizeof(struct page);
54 map_end += ((PFN_ALIGN((unsigned long) map_end)
55 - (unsigned long) map_end)
56 / sizeof(struct page));
57
58 if (map_start < map_end)
59 memmap_init_zone((unsigned long)(map_end - map_start),
60 nid, zone, page_to_pfn(map_start),
61 MEMMAP_EARLY);
62 }
63}
64
65static void __ref *vmem_alloc_pages(unsigned int order) 30static void __ref *vmem_alloc_pages(unsigned int order)
66{ 31{
67 if (slab_is_available()) 32 if (slab_is_available())
@@ -77,8 +42,7 @@ static inline pud_t *vmem_pud_alloc(void)
77 pud = vmem_alloc_pages(2); 42 pud = vmem_alloc_pages(2);
78 if (!pud) 43 if (!pud)
79 return NULL; 44 return NULL;
80 pud_val(*pud) = _REGION3_ENTRY_EMPTY; 45 clear_table((unsigned long *) pud, _REGION3_ENTRY_EMPTY, PAGE_SIZE * 4);
81 memcpy(pud + 1, pud, (PTRS_PER_PUD - 1)*sizeof(pud_t));
82#endif 46#endif
83 return pud; 47 return pud;
84} 48}
@@ -91,7 +55,7 @@ static inline pmd_t *vmem_pmd_alloc(void)
91 pmd = vmem_alloc_pages(2); 55 pmd = vmem_alloc_pages(2);
92 if (!pmd) 56 if (!pmd)
93 return NULL; 57 return NULL;
94 clear_table((unsigned long *) pmd, _SEGMENT_ENTRY_EMPTY, PAGE_SIZE*4); 58 clear_table((unsigned long *) pmd, _SEGMENT_ENTRY_EMPTY, PAGE_SIZE * 4);
95#endif 59#endif
96 return pmd; 60 return pmd;
97} 61}
@@ -114,7 +78,7 @@ static pte_t __init_refok *vmem_pte_alloc(void)
114/* 78/*
115 * Add a physical memory range to the 1:1 mapping. 79 * Add a physical memory range to the 1:1 mapping.
116 */ 80 */
117static int vmem_add_range(unsigned long start, unsigned long size) 81static int vmem_add_mem(unsigned long start, unsigned long size, int ro)
118{ 82{
119 unsigned long address; 83 unsigned long address;
120 pgd_t *pg_dir; 84 pgd_t *pg_dir;
@@ -141,7 +105,19 @@ static int vmem_add_range(unsigned long start, unsigned long size)
141 pud_populate_kernel(&init_mm, pu_dir, pm_dir); 105 pud_populate_kernel(&init_mm, pu_dir, pm_dir);
142 } 106 }
143 107
108 pte = mk_pte_phys(address, __pgprot(ro ? _PAGE_RO : 0));
144 pm_dir = pmd_offset(pu_dir, address); 109 pm_dir = pmd_offset(pu_dir, address);
110
111#ifdef __s390x__
112 if (MACHINE_HAS_HPAGE && !(address & ~HPAGE_MASK) &&
113 (address + HPAGE_SIZE <= start + size) &&
114 (address >= HPAGE_SIZE)) {
115 pte_val(pte) |= _SEGMENT_ENTRY_LARGE;
116 pmd_val(*pm_dir) = pte_val(pte);
117 address += HPAGE_SIZE - PAGE_SIZE;
118 continue;
119 }
120#endif
145 if (pmd_none(*pm_dir)) { 121 if (pmd_none(*pm_dir)) {
146 pt_dir = vmem_pte_alloc(); 122 pt_dir = vmem_pte_alloc();
147 if (!pt_dir) 123 if (!pt_dir)
@@ -150,7 +126,6 @@ static int vmem_add_range(unsigned long start, unsigned long size)
150 } 126 }
151 127
152 pt_dir = pte_offset_kernel(pm_dir, address); 128 pt_dir = pte_offset_kernel(pm_dir, address);
153 pte = pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL);
154 *pt_dir = pte; 129 *pt_dir = pte;
155 } 130 }
156 ret = 0; 131 ret = 0;
@@ -181,6 +156,13 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
181 pm_dir = pmd_offset(pu_dir, address); 156 pm_dir = pmd_offset(pu_dir, address);
182 if (pmd_none(*pm_dir)) 157 if (pmd_none(*pm_dir))
183 continue; 158 continue;
159
160 if (pmd_huge(*pm_dir)) {
161 pmd_clear_kernel(pm_dir);
162 address += HPAGE_SIZE - PAGE_SIZE;
163 continue;
164 }
165
184 pt_dir = pte_offset_kernel(pm_dir, address); 166 pt_dir = pte_offset_kernel(pm_dir, address);
185 *pt_dir = pte; 167 *pt_dir = pte;
186 } 168 }
@@ -190,10 +172,9 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
190/* 172/*
191 * Add a backed mem_map array to the virtual mem_map array. 173 * Add a backed mem_map array to the virtual mem_map array.
192 */ 174 */
193static int vmem_add_mem_map(unsigned long start, unsigned long size) 175int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
194{ 176{
195 unsigned long address, start_addr, end_addr; 177 unsigned long address, start_addr, end_addr;
196 struct page *map_start, *map_end;
197 pgd_t *pg_dir; 178 pgd_t *pg_dir;
198 pud_t *pu_dir; 179 pud_t *pu_dir;
199 pmd_t *pm_dir; 180 pmd_t *pm_dir;
@@ -201,11 +182,8 @@ static int vmem_add_mem_map(unsigned long start, unsigned long size)
201 pte_t pte; 182 pte_t pte;
202 int ret = -ENOMEM; 183 int ret = -ENOMEM;
203 184
204 map_start = VMEM_MAP + PFN_DOWN(start); 185 start_addr = (unsigned long) start;
205 map_end = VMEM_MAP + PFN_DOWN(start + size); 186 end_addr = (unsigned long) (start + nr);
206
207 start_addr = (unsigned long) map_start & PAGE_MASK;
208 end_addr = PFN_ALIGN((unsigned long) map_end);
209 187
210 for (address = start_addr; address < end_addr; address += PAGE_SIZE) { 188 for (address = start_addr; address < end_addr; address += PAGE_SIZE) {
211 pg_dir = pgd_offset_k(address); 189 pg_dir = pgd_offset_k(address);
@@ -249,16 +227,6 @@ out:
249 return ret; 227 return ret;
250} 228}
251 229
252static int vmem_add_mem(unsigned long start, unsigned long size)
253{
254 int ret;
255
256 ret = vmem_add_mem_map(start, size);
257 if (ret)
258 return ret;
259 return vmem_add_range(start, size);
260}
261
262/* 230/*
263 * Add memory segment to the segment list if it doesn't overlap with 231 * Add memory segment to the segment list if it doesn't overlap with
264 * an already present segment. 232 * an already present segment.
@@ -296,7 +264,7 @@ static void __remove_shared_memory(struct memory_segment *seg)
296 vmem_remove_range(seg->start, seg->size); 264 vmem_remove_range(seg->start, seg->size);
297} 265}
298 266
299int remove_shared_memory(unsigned long start, unsigned long size) 267int vmem_remove_mapping(unsigned long start, unsigned long size)
300{ 268{
301 struct memory_segment *seg; 269 struct memory_segment *seg;
302 int ret; 270 int ret;
@@ -320,11 +288,9 @@ out:
320 return ret; 288 return ret;
321} 289}
322 290
323int add_shared_memory(unsigned long start, unsigned long size) 291int vmem_add_mapping(unsigned long start, unsigned long size)
324{ 292{
325 struct memory_segment *seg; 293 struct memory_segment *seg;
326 struct page *page;
327 unsigned long pfn, num_pfn, end_pfn;
328 int ret; 294 int ret;
329 295
330 mutex_lock(&vmem_mutex); 296 mutex_lock(&vmem_mutex);
@@ -339,24 +305,9 @@ int add_shared_memory(unsigned long start, unsigned long size)
339 if (ret) 305 if (ret)
340 goto out_free; 306 goto out_free;
341 307
342 ret = vmem_add_mem(start, size); 308 ret = vmem_add_mem(start, size, 0);
343 if (ret) 309 if (ret)
344 goto out_remove; 310 goto out_remove;
345
346 pfn = PFN_DOWN(start);
347 num_pfn = PFN_DOWN(size);
348 end_pfn = pfn + num_pfn;
349
350 page = pfn_to_page(pfn);
351 memset(page, 0, num_pfn * sizeof(struct page));
352
353 for (; pfn < end_pfn; pfn++) {
354 page = pfn_to_page(pfn);
355 init_page_count(page);
356 reset_page_mapcount(page);
357 SetPageReserved(page);
358 INIT_LIST_HEAD(&page->lru);
359 }
360 goto out; 311 goto out;
361 312
362out_remove: 313out_remove:
@@ -375,14 +326,34 @@ out:
375 */ 326 */
376void __init vmem_map_init(void) 327void __init vmem_map_init(void)
377{ 328{
329 unsigned long ro_start, ro_end;
330 unsigned long start, end;
378 int i; 331 int i;
379 332
380 INIT_LIST_HEAD(&init_mm.context.crst_list); 333 INIT_LIST_HEAD(&init_mm.context.crst_list);
381 INIT_LIST_HEAD(&init_mm.context.pgtable_list); 334 INIT_LIST_HEAD(&init_mm.context.pgtable_list);
382 init_mm.context.noexec = 0; 335 init_mm.context.noexec = 0;
383 NODE_DATA(0)->node_mem_map = VMEM_MAP; 336 ro_start = ((unsigned long)&_stext) & PAGE_MASK;
384 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) 337 ro_end = PFN_ALIGN((unsigned long)&_eshared);
385 vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size); 338 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
339 start = memory_chunk[i].addr;
340 end = memory_chunk[i].addr + memory_chunk[i].size;
341 if (start >= ro_end || end <= ro_start)
342 vmem_add_mem(start, end - start, 0);
343 else if (start >= ro_start && end <= ro_end)
344 vmem_add_mem(start, end - start, 1);
345 else if (start >= ro_start) {
346 vmem_add_mem(start, ro_end - start, 1);
347 vmem_add_mem(ro_end, end - ro_end, 0);
348 } else if (end < ro_end) {
349 vmem_add_mem(start, ro_start - start, 0);
350 vmem_add_mem(ro_start, end - ro_start, 1);
351 } else {
352 vmem_add_mem(start, ro_start - start, 0);
353 vmem_add_mem(ro_start, ro_end - ro_start, 1);
354 vmem_add_mem(ro_end, end - ro_end, 0);
355 }
356 }
386} 357}
387 358
388/* 359/*
diff --git a/arch/sh/boards/renesas/migor/setup.c b/arch/sh/boards/renesas/migor/setup.c
index 00d52a20d8a5..e7c150d49702 100644
--- a/arch/sh/boards/renesas/migor/setup.c
+++ b/arch/sh/boards/renesas/migor/setup.c
@@ -199,8 +199,7 @@ static struct platform_device *migor_devices[] __initdata = {
199 199
200static struct i2c_board_info __initdata migor_i2c_devices[] = { 200static struct i2c_board_info __initdata migor_i2c_devices[] = {
201 { 201 {
202 I2C_BOARD_INFO("rtc-rs5c372", 0x32), 202 I2C_BOARD_INFO("rs5c372b", 0x32),
203 .type = "rs5c372b",
204 }, 203 },
205 { 204 {
206 I2C_BOARD_INFO("migor_ts", 0x51), 205 I2C_BOARD_INFO("migor_ts", 0x51),
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index a5c5e9236501..ac0a96522e45 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -199,8 +199,7 @@ static struct platform_device smbus_device = {
199 199
200static struct i2c_board_info __initdata highlander_i2c_devices[] = { 200static struct i2c_board_info __initdata highlander_i2c_devices[] = {
201 { 201 {
202 I2C_BOARD_INFO("rtc-rs5c372", 0x32), 202 I2C_BOARD_INFO("r2025sd", 0x32),
203 .type = "r2025sd",
204 }, 203 },
205}; 204};
206 205
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 49b435c3a57a..08d2e7325252 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -191,8 +191,8 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq)
191 191
192void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 192void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
193{ 193{
194 unsigned long start = pci_resource_start(dev, bar); 194 resource_size_t start = pci_resource_start(dev, bar);
195 unsigned long len = pci_resource_len(dev, bar); 195 resource_size_t len = pci_resource_len(dev, bar);
196 unsigned long flags = pci_resource_flags(dev, bar); 196 unsigned long flags = pci_resource_flags(dev, bar);
197 197
198 if (unlikely(!len || !start)) 198 if (unlikely(!len || !start))
diff --git a/arch/sh/kernel/asm-offsets.c b/arch/sh/kernel/asm-offsets.c
index dc6725c51a89..57cf0e0680f3 100644
--- a/arch/sh/kernel/asm-offsets.c
+++ b/arch/sh/kernel/asm-offsets.c
@@ -11,12 +11,9 @@
11#include <linux/stddef.h> 11#include <linux/stddef.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <asm/thread_info.h> 14#include <linux/kbuild.h>
15
16#define DEFINE(sym, val) \
17 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
18 15
19#define BLANK() asm volatile("\n->" : : ) 16#include <asm/thread_info.h>
20 17
21int main(void) 18int main(void)
22{ 19{
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 9bf19b00696a..a2a99e487e33 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -200,8 +200,6 @@ void irq_ctx_exit(int cpu)
200 hardirq_ctx[cpu] = NULL; 200 hardirq_ctx[cpu] = NULL;
201} 201}
202 202
203extern asmlinkage void __do_softirq(void);
204
205asmlinkage void do_softirq(void) 203asmlinkage void do_softirq(void)
206{ 204{
207 unsigned long flags; 205 unsigned long flags;
diff --git a/arch/sh/kernel/sys_sh64.c b/arch/sh/kernel/sys_sh64.c
index 578004d71e02..91fb8445a5a0 100644
--- a/arch/sh/kernel/sys_sh64.c
+++ b/arch/sh/kernel/sys_sh64.c
@@ -31,23 +31,6 @@
31#include <asm/unistd.h> 31#include <asm/unistd.h>
32 32
33/* 33/*
34 * sys_pipe() is the normal C calling standard for creating
35 * a pipe. It's not the way Unix traditionally does this, though.
36 */
37asmlinkage int sys_pipe(unsigned long * fildes)
38{
39 int fd[2];
40 int error;
41
42 error = do_pipe(fd);
43 if (!error) {
44 if (copy_to_user(fildes, fd, 2*sizeof(int)))
45 error = -EFAULT;
46 }
47 return error;
48}
49
50/*
51 * Do a system call from kernel instead of calling sys_execve so we 34 * Do a system call from kernel instead of calling sys_execve so we
52 * end up with proper pt_regs. 35 * end up with proper pt_regs.
53 */ 36 */
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 49590f8fe98c..d211fdb24584 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -68,6 +68,7 @@ config SPARC
68 default y 68 default y
69 select HAVE_IDE 69 select HAVE_IDE
70 select HAVE_OPROFILE 70 select HAVE_OPROFILE
71 select HAVE_ARCH_KGDB if !SMP
71 72
72# Identify this as a Sparc32 build 73# Identify this as a Sparc32 build
73config SPARC32 74config SPARC32
diff --git a/arch/sparc/defconfig b/arch/sparc/defconfig
index 6a2c57a2fe71..2e3a149ea0e7 100644
--- a/arch/sparc/defconfig
+++ b/arch/sparc/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.25 3# Linux kernel version: 2.6.25
4# Sun Apr 20 01:49:51 2008 4# Tue Apr 29 01:28:58 2008
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_HIGHMEM=y 7CONFIG_HIGHMEM=y
@@ -217,12 +217,7 @@ CONFIG_IPV6_TUNNEL=m
217# CONFIG_NETWORK_SECMARK is not set 217# CONFIG_NETWORK_SECMARK is not set
218# CONFIG_NETFILTER is not set 218# CONFIG_NETFILTER is not set
219# CONFIG_IP_DCCP is not set 219# CONFIG_IP_DCCP is not set
220CONFIG_IP_SCTP=m 220# CONFIG_IP_SCTP is not set
221# CONFIG_SCTP_DBG_MSG is not set
222CONFIG_SCTP_DBG_OBJCNT=y
223# CONFIG_SCTP_HMAC_NONE is not set
224# CONFIG_SCTP_HMAC_SHA1 is not set
225CONFIG_SCTP_HMAC_MD5=y
226# CONFIG_TIPC is not set 221# CONFIG_TIPC is not set
227# CONFIG_ATM is not set 222# CONFIG_ATM is not set
228# CONFIG_BRIDGE is not set 223# CONFIG_BRIDGE is not set
@@ -245,9 +240,7 @@ CONFIG_NET_PKTGEN=m
245# CONFIG_CAN is not set 240# CONFIG_CAN is not set
246# CONFIG_IRDA is not set 241# CONFIG_IRDA is not set
247# CONFIG_BT is not set 242# CONFIG_BT is not set
248CONFIG_AF_RXRPC=m 243# CONFIG_AF_RXRPC is not set
249# CONFIG_AF_RXRPC_DEBUG is not set
250# CONFIG_RXKAD is not set
251 244
252# 245#
253# Wireless 246# Wireless
@@ -390,7 +383,7 @@ CONFIG_DUMMY=m
390# CONFIG_BONDING is not set 383# CONFIG_BONDING is not set
391# CONFIG_MACVLAN is not set 384# CONFIG_MACVLAN is not set
392# CONFIG_EQUALIZER is not set 385# CONFIG_EQUALIZER is not set
393CONFIG_TUN=m 386# CONFIG_TUN is not set
394# CONFIG_VETH is not set 387# CONFIG_VETH is not set
395# CONFIG_ARCNET is not set 388# CONFIG_ARCNET is not set
396# CONFIG_PHYLIB is not set 389# CONFIG_PHYLIB is not set
@@ -544,6 +537,7 @@ CONFIG_SERIAL_SUNSU_CONSOLE=y
544# CONFIG_SERIAL_SUNSAB is not set 537# CONFIG_SERIAL_SUNSAB is not set
545CONFIG_SERIAL_CORE=y 538CONFIG_SERIAL_CORE=y
546CONFIG_SERIAL_CORE_CONSOLE=y 539CONFIG_SERIAL_CORE_CONSOLE=y
540CONFIG_CONSOLE_POLL=y
547# CONFIG_SERIAL_JSM is not set 541# CONFIG_SERIAL_JSM is not set
548CONFIG_UNIX98_PTYS=y 542CONFIG_UNIX98_PTYS=y
549CONFIG_LEGACY_PTYS=y 543CONFIG_LEGACY_PTYS=y
@@ -595,6 +589,7 @@ CONFIG_SSB_POSSIBLE=y
595# Multifunction device drivers 589# Multifunction device drivers
596# 590#
597# CONFIG_MFD_SM501 is not set 591# CONFIG_MFD_SM501 is not set
592# CONFIG_HTC_PASIC3 is not set
598 593
599# 594#
600# Multimedia devices 595# Multimedia devices
@@ -645,10 +640,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
645# CONFIG_NEW_LEDS is not set 640# CONFIG_NEW_LEDS is not set
646# CONFIG_INFINIBAND is not set 641# CONFIG_INFINIBAND is not set
647# CONFIG_RTC_CLASS is not set 642# CONFIG_RTC_CLASS is not set
648
649#
650# Userspace I/O
651#
652# CONFIG_UIO is not set 643# CONFIG_UIO is not set
653 644
654# 645#
@@ -680,16 +671,12 @@ CONFIG_FS_MBCACHE=y
680# CONFIG_REISERFS_FS is not set 671# CONFIG_REISERFS_FS is not set
681# CONFIG_JFS_FS is not set 672# CONFIG_JFS_FS is not set
682CONFIG_FS_POSIX_ACL=y 673CONFIG_FS_POSIX_ACL=y
683CONFIG_XFS_FS=m 674# CONFIG_XFS_FS is not set
684CONFIG_XFS_QUOTA=y
685CONFIG_XFS_POSIX_ACL=y
686CONFIG_XFS_RT=y
687# CONFIG_OCFS2_FS is not set 675# CONFIG_OCFS2_FS is not set
688CONFIG_DNOTIFY=y 676CONFIG_DNOTIFY=y
689CONFIG_INOTIFY=y 677CONFIG_INOTIFY=y
690CONFIG_INOTIFY_USER=y 678CONFIG_INOTIFY_USER=y
691# CONFIG_QUOTA is not set 679# CONFIG_QUOTA is not set
692CONFIG_QUOTACTL=y
693CONFIG_AUTOFS_FS=m 680CONFIG_AUTOFS_FS=m
694CONFIG_AUTOFS4_FS=m 681CONFIG_AUTOFS4_FS=m
695# CONFIG_FUSE_FS is not set 682# CONFIG_FUSE_FS is not set
@@ -725,11 +712,9 @@ CONFIG_SYSFS=y
725# 712#
726# CONFIG_ADFS_FS is not set 713# CONFIG_ADFS_FS is not set
727# CONFIG_AFFS_FS is not set 714# CONFIG_AFFS_FS is not set
728# CONFIG_ECRYPT_FS is not set
729# CONFIG_HFS_FS is not set 715# CONFIG_HFS_FS is not set
730# CONFIG_HFSPLUS_FS is not set 716# CONFIG_HFSPLUS_FS is not set
731CONFIG_BEFS_FS=m 717# CONFIG_BEFS_FS is not set
732# CONFIG_BEFS_DEBUG is not set
733# CONFIG_BFS_FS is not set 718# CONFIG_BFS_FS is not set
734# CONFIG_EFS_FS is not set 719# CONFIG_EFS_FS is not set
735# CONFIG_CRAMFS is not set 720# CONFIG_CRAMFS is not set
@@ -744,7 +729,6 @@ CONFIG_NETWORK_FILESYSTEMS=y
744CONFIG_NFS_FS=y 729CONFIG_NFS_FS=y
745# CONFIG_NFS_V3 is not set 730# CONFIG_NFS_V3 is not set
746# CONFIG_NFS_V4 is not set 731# CONFIG_NFS_V4 is not set
747# CONFIG_NFS_DIRECTIO is not set
748# CONFIG_NFSD is not set 732# CONFIG_NFSD is not set
749CONFIG_ROOT_NFS=y 733CONFIG_ROOT_NFS=y
750CONFIG_LOCKD=y 734CONFIG_LOCKD=y
@@ -755,16 +739,10 @@ CONFIG_SUNRPC_GSS=m
755CONFIG_RPCSEC_GSS_KRB5=m 739CONFIG_RPCSEC_GSS_KRB5=m
756# CONFIG_RPCSEC_GSS_SPKM3 is not set 740# CONFIG_RPCSEC_GSS_SPKM3 is not set
757# CONFIG_SMB_FS is not set 741# CONFIG_SMB_FS is not set
758CONFIG_CIFS=m 742# CONFIG_CIFS is not set
759# CONFIG_CIFS_STATS is not set
760# CONFIG_CIFS_WEAK_PW_HASH is not set
761# CONFIG_CIFS_XATTR is not set
762# CONFIG_CIFS_DEBUG2 is not set
763# CONFIG_CIFS_EXPERIMENTAL is not set
764# CONFIG_NCP_FS is not set 743# CONFIG_NCP_FS is not set
765# CONFIG_CODA_FS is not set 744# CONFIG_CODA_FS is not set
766CONFIG_AFS_FS=m 745# CONFIG_AFS_FS is not set
767# CONFIG_AFS_DEBUG is not set
768 746
769# 747#
770# Partition Types 748# Partition Types
@@ -821,6 +799,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
821# CONFIG_PRINTK_TIME is not set 799# CONFIG_PRINTK_TIME is not set
822# CONFIG_ENABLE_WARN_DEPRECATED is not set 800# CONFIG_ENABLE_WARN_DEPRECATED is not set
823CONFIG_ENABLE_MUST_CHECK=y 801CONFIG_ENABLE_MUST_CHECK=y
802CONFIG_FRAME_WARN=1024
824CONFIG_MAGIC_SYSRQ=y 803CONFIG_MAGIC_SYSRQ=y
825# CONFIG_UNUSED_SYMBOLS is not set 804# CONFIG_UNUSED_SYMBOLS is not set
826# CONFIG_DEBUG_FS is not set 805# CONFIG_DEBUG_FS is not set
@@ -842,70 +821,105 @@ CONFIG_DETECT_SOFTLOCKUP=y
842CONFIG_DEBUG_BUGVERBOSE=y 821CONFIG_DEBUG_BUGVERBOSE=y
843# CONFIG_DEBUG_INFO is not set 822# CONFIG_DEBUG_INFO is not set
844# CONFIG_DEBUG_VM is not set 823# CONFIG_DEBUG_VM is not set
824# CONFIG_DEBUG_WRITECOUNT is not set
845# CONFIG_DEBUG_LIST is not set 825# CONFIG_DEBUG_LIST is not set
846# CONFIG_DEBUG_SG is not set 826# CONFIG_DEBUG_SG is not set
827CONFIG_FRAME_POINTER=y
847# CONFIG_BOOT_PRINTK_DELAY is not set 828# CONFIG_BOOT_PRINTK_DELAY is not set
848# CONFIG_RCU_TORTURE_TEST is not set 829# CONFIG_RCU_TORTURE_TEST is not set
849# CONFIG_BACKTRACE_SELF_TEST is not set 830# CONFIG_BACKTRACE_SELF_TEST is not set
850# CONFIG_FAULT_INJECTION is not set 831# CONFIG_FAULT_INJECTION is not set
851# CONFIG_SAMPLES is not set 832# CONFIG_SAMPLES is not set
833CONFIG_KGDB=y
834CONFIG_HAVE_ARCH_KGDB=y
835CONFIG_KGDB_SERIAL_CONSOLE=y
836CONFIG_KGDB_TESTS=y
837# CONFIG_KGDB_TESTS_ON_BOOT is not set
852# CONFIG_DEBUG_STACK_USAGE is not set 838# CONFIG_DEBUG_STACK_USAGE is not set
853 839
854# 840#
855# Security options 841# Security options
856# 842#
857CONFIG_KEYS=y 843# CONFIG_KEYS is not set
858# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
859# CONFIG_SECURITY is not set 844# CONFIG_SECURITY is not set
860# CONFIG_SECURITY_FILE_CAPABILITIES is not set 845# CONFIG_SECURITY_FILE_CAPABILITIES is not set
861CONFIG_CRYPTO=y 846CONFIG_CRYPTO=y
847
848#
849# Crypto core or helper
850#
862CONFIG_CRYPTO_ALGAPI=y 851CONFIG_CRYPTO_ALGAPI=y
863CONFIG_CRYPTO_AEAD=y 852CONFIG_CRYPTO_AEAD=y
864CONFIG_CRYPTO_BLKCIPHER=y 853CONFIG_CRYPTO_BLKCIPHER=y
865# CONFIG_CRYPTO_SEQIV is not set
866CONFIG_CRYPTO_HASH=y 854CONFIG_CRYPTO_HASH=y
867CONFIG_CRYPTO_MANAGER=y 855CONFIG_CRYPTO_MANAGER=y
856# CONFIG_CRYPTO_GF128MUL is not set
857CONFIG_CRYPTO_NULL=m
858# CONFIG_CRYPTO_CRYPTD is not set
859CONFIG_CRYPTO_AUTHENC=y
860# CONFIG_CRYPTO_TEST is not set
861
862#
863# Authenticated Encryption with Associated Data
864#
865# CONFIG_CRYPTO_CCM is not set
866# CONFIG_CRYPTO_GCM is not set
867# CONFIG_CRYPTO_SEQIV is not set
868
869#
870# Block modes
871#
872CONFIG_CRYPTO_CBC=y
873# CONFIG_CRYPTO_CTR is not set
874# CONFIG_CRYPTO_CTS is not set
875CONFIG_CRYPTO_ECB=m
876# CONFIG_CRYPTO_LRW is not set
877CONFIG_CRYPTO_PCBC=m
878# CONFIG_CRYPTO_XTS is not set
879
880#
881# Hash modes
882#
868CONFIG_CRYPTO_HMAC=y 883CONFIG_CRYPTO_HMAC=y
869# CONFIG_CRYPTO_XCBC is not set 884# CONFIG_CRYPTO_XCBC is not set
870CONFIG_CRYPTO_NULL=m 885
886#
887# Digest
888#
889CONFIG_CRYPTO_CRC32C=m
871CONFIG_CRYPTO_MD4=y 890CONFIG_CRYPTO_MD4=y
872CONFIG_CRYPTO_MD5=y 891CONFIG_CRYPTO_MD5=y
892CONFIG_CRYPTO_MICHAEL_MIC=m
873CONFIG_CRYPTO_SHA1=y 893CONFIG_CRYPTO_SHA1=y
874CONFIG_CRYPTO_SHA256=m 894CONFIG_CRYPTO_SHA256=m
875CONFIG_CRYPTO_SHA512=m 895CONFIG_CRYPTO_SHA512=m
876# CONFIG_CRYPTO_WP512 is not set
877# CONFIG_CRYPTO_TGR192 is not set 896# CONFIG_CRYPTO_TGR192 is not set
878# CONFIG_CRYPTO_GF128MUL is not set 897# CONFIG_CRYPTO_WP512 is not set
879CONFIG_CRYPTO_ECB=m 898
880CONFIG_CRYPTO_CBC=y 899#
881CONFIG_CRYPTO_PCBC=m 900# Ciphers
882# CONFIG_CRYPTO_LRW is not set 901#
883# CONFIG_CRYPTO_XTS is not set
884# CONFIG_CRYPTO_CTR is not set
885# CONFIG_CRYPTO_GCM is not set
886# CONFIG_CRYPTO_CCM is not set
887# CONFIG_CRYPTO_CRYPTD is not set
888CONFIG_CRYPTO_DES=y
889# CONFIG_CRYPTO_FCRYPT is not set
890CONFIG_CRYPTO_BLOWFISH=m
891CONFIG_CRYPTO_TWOFISH=m
892CONFIG_CRYPTO_TWOFISH_COMMON=m
893CONFIG_CRYPTO_SERPENT=m
894CONFIG_CRYPTO_AES=m 902CONFIG_CRYPTO_AES=m
903# CONFIG_CRYPTO_ANUBIS is not set
904CONFIG_CRYPTO_ARC4=m
905CONFIG_CRYPTO_BLOWFISH=m
906# CONFIG_CRYPTO_CAMELLIA is not set
895CONFIG_CRYPTO_CAST5=m 907CONFIG_CRYPTO_CAST5=m
896CONFIG_CRYPTO_CAST6=m 908CONFIG_CRYPTO_CAST6=m
897# CONFIG_CRYPTO_TEA is not set 909CONFIG_CRYPTO_DES=y
898CONFIG_CRYPTO_ARC4=m 910# CONFIG_CRYPTO_FCRYPT is not set
899# CONFIG_CRYPTO_KHAZAD is not set 911# CONFIG_CRYPTO_KHAZAD is not set
900# CONFIG_CRYPTO_ANUBIS is not set
901# CONFIG_CRYPTO_SEED is not set
902# CONFIG_CRYPTO_SALSA20 is not set 912# CONFIG_CRYPTO_SALSA20 is not set
913# CONFIG_CRYPTO_SEED is not set
914CONFIG_CRYPTO_SERPENT=m
915# CONFIG_CRYPTO_TEA is not set
916CONFIG_CRYPTO_TWOFISH=m
917CONFIG_CRYPTO_TWOFISH_COMMON=m
918
919#
920# Compression
921#
903CONFIG_CRYPTO_DEFLATE=y 922CONFIG_CRYPTO_DEFLATE=y
904CONFIG_CRYPTO_MICHAEL_MIC=m
905CONFIG_CRYPTO_CRC32C=m
906# CONFIG_CRYPTO_CAMELLIA is not set
907# CONFIG_CRYPTO_TEST is not set
908CONFIG_CRYPTO_AUTHENC=y
909# CONFIG_CRYPTO_LZO is not set 923# CONFIG_CRYPTO_LZO is not set
910# CONFIG_CRYPTO_HW is not set 924# CONFIG_CRYPTO_HW is not set
911 925
@@ -913,6 +927,7 @@ CONFIG_CRYPTO_AUTHENC=y
913# Library routines 927# Library routines
914# 928#
915CONFIG_BITREVERSE=y 929CONFIG_BITREVERSE=y
930# CONFIG_GENERIC_FIND_FIRST_BIT is not set
916# CONFIG_CRC_CCITT is not set 931# CONFIG_CRC_CCITT is not set
917# CONFIG_CRC16 is not set 932# CONFIG_CRC16 is not set
918# CONFIG_CRC_ITU_T is not set 933# CONFIG_CRC_ITU_T is not set
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 59700aaaae93..6e03a2a7863c 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -25,3 +25,4 @@ obj-$(CONFIG_PCI) += ebus.o
25obj-$(CONFIG_SUN_PM) += apc.o pmc.o 25obj-$(CONFIG_SUN_PM) += apc.o pmc.o
26obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o 26obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o
27obj-$(CONFIG_SPARC_LED) += led.o 27obj-$(CONFIG_SPARC_LED) += led.o
28obj-$(CONFIG_KGDB) += kgdb.o
diff --git a/arch/sparc/kernel/asm-offsets.c b/arch/sparc/kernel/asm-offsets.c
index 6773ed76e414..cd3f7694e9b9 100644
--- a/arch/sparc/kernel/asm-offsets.c
+++ b/arch/sparc/kernel/asm-offsets.c
@@ -12,11 +12,7 @@
12 12
13#include <linux/sched.h> 13#include <linux/sched.h>
14// #include <linux/mm.h> 14// #include <linux/mm.h>
15 15#include <linux/kbuild.h>
16#define DEFINE(sym, val) \
17 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
18
19#define BLANK() asm volatile("\n->" : : )
20 16
21int foo(void) 17int foo(void)
22{ 18{
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 484c83d23eef..57d1bbdd0bd2 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -12,7 +12,6 @@
12#include <asm/head.h> 12#include <asm/head.h>
13#include <asm/asi.h> 13#include <asm/asi.h>
14#include <asm/smp.h> 14#include <asm/smp.h>
15#include <asm/kgdb.h>
16#include <asm/contregs.h> 15#include <asm/contregs.h>
17#include <asm/ptrace.h> 16#include <asm/ptrace.h>
18#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
@@ -45,91 +44,20 @@
45 _SV; _SV; _SV; _SV; _SV; _SV; _SV; \ 44 _SV; _SV; _SV; _SV; _SV; _SV; _SV; \
46 _RS; _RS; _RS; _RS; _RS; _RS; _RS; 45 _RS; _RS; _RS; _RS; _RS; _RS; _RS;
47 46
48/* First, KGDB low level things. This is a rewrite
49 * of the routines found in the sparc-stub.c asm() statement
50 * from the gdb distribution. This is also dual-purpose
51 * as a software trap for userlevel programs.
52 */
53 .data
54 .align 4
55
56in_trap_handler:
57 .word 0
58
59 .text 47 .text
60 .align 4
61 48
62#if 0 /* kgdb is dropped from 2.5.33 */ 49#ifdef CONFIG_KGDB
63! This function is called when any SPARC trap (except window overflow or 50 .align 4
64! underflow) occurs. It makes sure that the invalid register window is still 51 .globl arch_kgdb_breakpoint
65! available before jumping into C code. It will also restore the world if you 52 .type arch_kgdb_breakpoint,#function
66! return from handle_exception. 53arch_kgdb_breakpoint:
67 54 ta 0x7d
68 .globl trap_low 55 retl
69trap_low: 56 nop
70 rd %wim, %l3 57 .size arch_kgdb_breakpoint,.-arch_kgdb_breakpoint
71 SAVE_ALL
72
73 sethi %hi(in_trap_handler), %l4
74 ld [%lo(in_trap_handler) + %l4], %l5
75 inc %l5
76 st %l5, [%lo(in_trap_handler) + %l4]
77
78 /* Make sure kgdb sees the same state we just saved. */
79 LOAD_PT_GLOBALS(sp)
80 LOAD_PT_INS(sp)
81 ld [%sp + STACKFRAME_SZ + PT_Y], %l4
82 ld [%sp + STACKFRAME_SZ + PT_WIM], %l3
83 ld [%sp + STACKFRAME_SZ + PT_PSR], %l0
84 ld [%sp + STACKFRAME_SZ + PT_PC], %l1
85 ld [%sp + STACKFRAME_SZ + PT_NPC], %l2
86 rd %tbr, %l5 /* Never changes... */
87
88 /* Make kgdb exception frame. */
89 sub %sp,(16+1+6+1+72)*4,%sp ! Make room for input & locals
90 ! + hidden arg + arg spill
91 ! + doubleword alignment
92 ! + registers[72] local var
93 SAVE_KGDB_GLOBALS(sp)
94 SAVE_KGDB_INS(sp)
95 SAVE_KGDB_SREGS(sp, l4, l0, l3, l5, l1, l2)
96
97 /* We are increasing PIL, so two writes. */
98 or %l0, PSR_PIL, %l0
99 wr %l0, 0, %psr
100 WRITE_PAUSE
101 wr %l0, PSR_ET, %psr
102 WRITE_PAUSE
103
104 call handle_exception
105 add %sp, STACKFRAME_SZ, %o0 ! Pass address of registers
106
107 /* Load new kgdb register set. */
108 LOAD_KGDB_GLOBALS(sp)
109 LOAD_KGDB_INS(sp)
110 LOAD_KGDB_SREGS(sp, l4, l0, l3, l5, l1, l2)
111 wr %l4, 0x0, %y
112
113 sethi %hi(in_trap_handler), %l4
114 ld [%lo(in_trap_handler) + %l4], %l5
115 dec %l5
116 st %l5, [%lo(in_trap_handler) + %l4]
117
118 add %sp,(16+1+6+1+72)*4,%sp ! Undo the kgdb trap frame.
119
120 /* Now take what kgdb did and place it into the pt_regs
121 * frame which SparcLinux RESTORE_ALL understands.,
122 */
123 STORE_PT_INS(sp)
124 STORE_PT_GLOBALS(sp)
125 STORE_PT_YREG(sp, g2)
126 STORE_PT_PRIV(sp, l0, l1, l2)
127
128 RESTORE_ALL
129#endif 58#endif
130 59
131#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE) 60#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
132 .text
133 .align 4 61 .align 4
134 .globl floppy_hardint 62 .globl floppy_hardint
135floppy_hardint: 63floppy_hardint:
@@ -1596,6 +1524,23 @@ breakpoint_trap:
1596 1524
1597 RESTORE_ALL 1525 RESTORE_ALL
1598 1526
1527#ifdef CONFIG_KGDB
1528 .align 4
1529 .globl kgdb_trap_low
1530 .type kgdb_trap_low,#function
1531kgdb_trap_low:
1532 rd %wim,%l3
1533 SAVE_ALL
1534 wr %l0, PSR_ET, %psr
1535 WRITE_PAUSE
1536
1537 call kgdb_trap
1538 add %sp, STACKFRAME_SZ, %o0
1539
1540 RESTORE_ALL
1541 .size kgdb_trap_low,.-kgdb_trap_low
1542#endif
1543
1599 .align 4 1544 .align 4
1600 .globl __handle_exception, flush_patch_exception 1545 .globl __handle_exception, flush_patch_exception
1601__handle_exception: 1546__handle_exception:
@@ -1698,4 +1643,22 @@ pcic_nmi_trap_patch:
1698 1643
1699#endif /* CONFIG_PCI */ 1644#endif /* CONFIG_PCI */
1700 1645
1646 .globl flushw_all
1647flushw_all:
1648 save %sp, -0x40, %sp
1649 save %sp, -0x40, %sp
1650 save %sp, -0x40, %sp
1651 save %sp, -0x40, %sp
1652 save %sp, -0x40, %sp
1653 save %sp, -0x40, %sp
1654 save %sp, -0x40, %sp
1655 restore
1656 restore
1657 restore
1658 restore
1659 restore
1660 restore
1661 ret
1662 restore
1663
1701/* End of entry.S */ 1664/* End of entry.S */
diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head.S
index b7f1e81c8ff2..8bec05fa5795 100644
--- a/arch/sparc/kernel/head.S
+++ b/arch/sparc/kernel/head.S
@@ -191,7 +191,8 @@ t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xe
191t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1) 191t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
192t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) 192t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
193t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) 193t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
194t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd) 194t_badfc:BAD_TRAP(0xfc)
195t_kgdb: KGDB_TRAP(0xfd)
195dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */ 196dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
196dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */ 197dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
197 198
@@ -267,7 +268,7 @@ trapbase_cpu1:
267 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1) 268 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
268 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) 269 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
269 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) 270 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
270 BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff) 271 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
271 272
272trapbase_cpu2: 273trapbase_cpu2:
273 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction) 274 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
@@ -335,7 +336,7 @@ trapbase_cpu2:
335 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1) 336 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
336 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) 337 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
337 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) 338 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
338 BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff) 339 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
339 340
340trapbase_cpu3: 341trapbase_cpu3:
341 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction) 342 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
@@ -403,7 +404,7 @@ trapbase_cpu3:
403 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1) 404 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
404 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) 405 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
405 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) 406 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
406 BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff) 407 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
407 408
408#endif 409#endif
409 .align PAGE_SIZE 410 .align PAGE_SIZE
diff --git a/arch/sparc/kernel/kgdb.c b/arch/sparc/kernel/kgdb.c
new file mode 100644
index 000000000000..757805ce02ee
--- /dev/null
+++ b/arch/sparc/kernel/kgdb.c
@@ -0,0 +1,164 @@
1/* kgdb.c: KGDB support for 32-bit sparc.
2 *
3 * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
4 */
5
6#include <linux/kgdb.h>
7#include <linux/kdebug.h>
8
9#include <asm/kdebug.h>
10#include <asm/ptrace.h>
11#include <asm/irq.h>
12
13extern unsigned long trapbase;
14
15void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
16{
17 struct reg_window *win;
18 int i;
19
20 gdb_regs[GDB_G0] = 0;
21 for (i = 0; i < 15; i++)
22 gdb_regs[GDB_G1 + i] = regs->u_regs[UREG_G1 + i];
23
24 win = (struct reg_window *) regs->u_regs[UREG_FP];
25 for (i = 0; i < 8; i++)
26 gdb_regs[GDB_L0 + i] = win->locals[i];
27 for (i = 0; i < 8; i++)
28 gdb_regs[GDB_I0 + i] = win->ins[i];
29
30 for (i = GDB_F0; i <= GDB_F31; i++)
31 gdb_regs[i] = 0;
32
33 gdb_regs[GDB_Y] = regs->y;
34 gdb_regs[GDB_PSR] = regs->psr;
35 gdb_regs[GDB_WIM] = 0;
36 gdb_regs[GDB_TBR] = (unsigned long) &trapbase;
37 gdb_regs[GDB_PC] = regs->pc;
38 gdb_regs[GDB_NPC] = regs->npc;
39 gdb_regs[GDB_FSR] = 0;
40 gdb_regs[GDB_CSR] = 0;
41}
42
43void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
44{
45 struct thread_info *t = task_thread_info(p);
46 struct reg_window *win;
47 int i;
48
49 for (i = GDB_G0; i < GDB_G6; i++)
50 gdb_regs[i] = 0;
51 gdb_regs[GDB_G6] = (unsigned long) t;
52 gdb_regs[GDB_G7] = 0;
53 for (i = GDB_O0; i < GDB_SP; i++)
54 gdb_regs[i] = 0;
55 gdb_regs[GDB_SP] = t->ksp;
56 gdb_regs[GDB_O7] = 0;
57
58 win = (struct reg_window *) t->ksp;
59 for (i = 0; i < 8; i++)
60 gdb_regs[GDB_L0 + i] = win->locals[i];
61 for (i = 0; i < 8; i++)
62 gdb_regs[GDB_I0 + i] = win->ins[i];
63
64 for (i = GDB_F0; i <= GDB_F31; i++)
65 gdb_regs[i] = 0;
66
67 gdb_regs[GDB_Y] = 0;
68
69 gdb_regs[GDB_PSR] = t->kpsr;
70 gdb_regs[GDB_WIM] = t->kwim;
71 gdb_regs[GDB_TBR] = (unsigned long) &trapbase;
72 gdb_regs[GDB_PC] = t->kpc;
73 gdb_regs[GDB_NPC] = t->kpc + 4;
74 gdb_regs[GDB_FSR] = 0;
75 gdb_regs[GDB_CSR] = 0;
76}
77
78void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
79{
80 struct reg_window *win;
81 int i;
82
83 for (i = 0; i < 15; i++)
84 regs->u_regs[UREG_G1 + i] = gdb_regs[GDB_G1 + i];
85
86 /* If the PSR register is changing, we have to preserve
87 * the CWP field, otherwise window save/restore explodes.
88 */
89 if (regs->psr != gdb_regs[GDB_PSR]) {
90 unsigned long cwp = regs->psr & PSR_CWP;
91
92 regs->psr = (gdb_regs[GDB_PSR] & ~PSR_CWP) | cwp;
93 }
94
95 regs->pc = gdb_regs[GDB_PC];
96 regs->npc = gdb_regs[GDB_NPC];
97 regs->y = gdb_regs[GDB_Y];
98
99 win = (struct reg_window *) regs->u_regs[UREG_FP];
100 for (i = 0; i < 8; i++)
101 win->locals[i] = gdb_regs[GDB_L0 + i];
102 for (i = 0; i < 8; i++)
103 win->ins[i] = gdb_regs[GDB_I0 + i];
104}
105
106int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
107 char *remcomInBuffer, char *remcomOutBuffer,
108 struct pt_regs *linux_regs)
109{
110 unsigned long addr;
111 char *ptr;
112
113 switch (remcomInBuffer[0]) {
114 case 'c':
115 /* try to read optional parameter, pc unchanged if no parm */
116 ptr = &remcomInBuffer[1];
117 if (kgdb_hex2long(&ptr, &addr)) {
118 linux_regs->pc = addr;
119 linux_regs->npc = addr + 4;
120 }
121 /* fallthru */
122
123 case 'D':
124 case 'k':
125 if (linux_regs->pc == (unsigned long) arch_kgdb_breakpoint) {
126 linux_regs->pc = linux_regs->npc;
127 linux_regs->npc += 4;
128 }
129 return 0;
130 }
131 return -1;
132}
133
134extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
135
136asmlinkage void kgdb_trap(struct pt_regs *regs)
137{
138 unsigned long flags;
139
140 if (user_mode(regs)) {
141 do_hw_interrupt(regs, 0xfd);
142 return;
143 }
144
145 flushw_all();
146
147 local_irq_save(flags);
148 kgdb_handle_exception(0x172, SIGTRAP, 0, regs);
149 local_irq_restore(flags);
150}
151
152int kgdb_arch_init(void)
153{
154 return 0;
155}
156
157void kgdb_arch_exit(void)
158{
159}
160
161struct kgdb_arch arch_kgdb_ops = {
162 /* Breakpoint instruction: ta 0x7d */
163 .gdb_bpt_instr = { 0x91, 0xd0, 0x20, 0x7d },
164};
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 3c13137685da..8a55c4f0df84 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -180,11 +180,9 @@ static void __init boot_flags_init(char *commands)
180 180
181/* This routine will in the future do all the nasty prom stuff 181/* This routine will in the future do all the nasty prom stuff
182 * to probe for the mmu type and its parameters, etc. This will 182 * to probe for the mmu type and its parameters, etc. This will
183 * also be where SMP things happen plus the Sparc specific memory 183 * also be where SMP things happen.
184 * physical memory probe as on the alpha.
185 */ 184 */
186 185
187extern int prom_probe_memory(void);
188extern void sun4c_probe_vac(void); 186extern void sun4c_probe_vac(void);
189extern char cputypval; 187extern char cputypval;
190extern unsigned long start, end; 188extern unsigned long start, end;
@@ -268,7 +266,6 @@ void __init setup_arch(char **cmdline_p)
268 if (ARCH_SUN4C_SUN4) 266 if (ARCH_SUN4C_SUN4)
269 sun4c_probe_vac(); 267 sun4c_probe_vac();
270 load_mmu(); 268 load_mmu();
271 (void) prom_probe_memory();
272 269
273 phys_base = 0xffffffffUL; 270 phys_base = 0xffffffffUL;
274 highest_paddr = 0UL; 271 highest_paddr = 0UL;
diff --git a/arch/sparc/kernel/sparc-stub.c b/arch/sparc/kernel/sparc-stub.c
deleted file mode 100644
index e84f815e6903..000000000000
--- a/arch/sparc/kernel/sparc-stub.c
+++ /dev/null
@@ -1,724 +0,0 @@
1/* $Id: sparc-stub.c,v 1.28 2001/10/30 04:54:21 davem Exp $
2 * sparc-stub.c: KGDB support for the Linux kernel.
3 *
4 * Modifications to run under Linux
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 *
7 * This file originally came from the gdb sources, and the
8 * copyright notices have been retained below.
9 */
10
11/****************************************************************************
12
13 THIS SOFTWARE IS NOT COPYRIGHTED
14
15 HP offers the following for use in the public domain. HP makes no
16 warranty with regard to the software or its performance and the
17 user accepts the software "AS IS" with all faults.
18
19 HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
20 TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22
23****************************************************************************/
24
25/****************************************************************************
26 * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
27 *
28 * Module name: remcom.c $
29 * Revision: 1.34 $
30 * Date: 91/03/09 12:29:49 $
31 * Contributor: Lake Stevens Instrument Division$
32 *
33 * Description: low level support for gdb debugger. $
34 *
35 * Considerations: only works on target hardware $
36 *
37 * Written by: Glenn Engel $
38 * ModuleState: Experimental $
39 *
40 * NOTES: See Below $
41 *
42 * Modified for SPARC by Stu Grossman, Cygnus Support.
43 *
44 * This code has been extensively tested on the Fujitsu SPARClite demo board.
45 *
46 * To enable debugger support, two things need to happen. One, a
47 * call to set_debug_traps() is necessary in order to allow any breakpoints
48 * or error conditions to be properly intercepted and reported to gdb.
49 * Two, a breakpoint needs to be generated to begin communication. This
50 * is most easily accomplished by a call to breakpoint(). Breakpoint()
51 * simulates a breakpoint by executing a trap #1.
52 *
53 *************
54 *
55 * The following gdb commands are supported:
56 *
57 * command function Return value
58 *
59 * g return the value of the CPU registers hex data or ENN
60 * G set the value of the CPU registers OK or ENN
61 *
62 * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
63 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
64 *
65 * c Resume at current address SNN ( signal NN)
66 * cAA..AA Continue at address AA..AA SNN
67 *
68 * s Step one instruction SNN
69 * sAA..AA Step one instruction from AA..AA SNN
70 *
71 * k kill
72 *
73 * ? What was the last sigval ? SNN (signal NN)
74 *
75 * bBB..BB Set baud rate to BB..BB OK or BNN, then sets
76 * baud rate
77 *
78 * All commands and responses are sent with a packet which includes a
79 * checksum. A packet consists of
80 *
81 * $<packet info>#<checksum>.
82 *
83 * where
84 * <packet info> :: <characters representing the command or response>
85 * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
86 *
87 * When a packet is received, it is first acknowledged with either '+' or '-'.
88 * '+' indicates a successful transfer. '-' indicates a failed transfer.
89 *
90 * Example:
91 *
92 * Host: Reply:
93 * $m0,10#2a +$00010203040506070809101112131415#42
94 *
95 ****************************************************************************/
96
97#include <linux/kernel.h>
98#include <linux/string.h>
99#include <linux/mm.h>
100#include <linux/smp.h>
101#include <linux/smp_lock.h>
102
103#include <asm/system.h>
104#include <asm/signal.h>
105#include <asm/oplib.h>
106#include <asm/head.h>
107#include <asm/traps.h>
108#include <asm/vac-ops.h>
109#include <asm/kgdb.h>
110#include <asm/pgalloc.h>
111#include <asm/pgtable.h>
112#include <asm/cacheflush.h>
113
114/*
115 *
116 * external low-level support routines
117 */
118
119extern void putDebugChar(char); /* write a single character */
120extern char getDebugChar(void); /* read and return a single char */
121
122/*
123 * BUFMAX defines the maximum number of characters in inbound/outbound buffers
124 * at least NUMREGBYTES*2 are needed for register packets
125 */
126#define BUFMAX 2048
127
128static int initialized; /* !0 means we've been initialized */
129
130static const char hexchars[]="0123456789abcdef";
131
132#define NUMREGS 72
133
134/* Number of bytes of registers. */
135#define NUMREGBYTES (NUMREGS * 4)
136enum regnames {G0, G1, G2, G3, G4, G5, G6, G7,
137 O0, O1, O2, O3, O4, O5, SP, O7,
138 L0, L1, L2, L3, L4, L5, L6, L7,
139 I0, I1, I2, I3, I4, I5, FP, I7,
140
141 F0, F1, F2, F3, F4, F5, F6, F7,
142 F8, F9, F10, F11, F12, F13, F14, F15,
143 F16, F17, F18, F19, F20, F21, F22, F23,
144 F24, F25, F26, F27, F28, F29, F30, F31,
145 Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR };
146
147
148extern void trap_low(void); /* In arch/sparc/kernel/entry.S */
149
150unsigned long get_sun4cpte(unsigned long addr)
151{
152 unsigned long entry;
153
154 __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :
155 "=r" (entry) :
156 "r" (addr), "i" (ASI_PTE));
157 return entry;
158}
159
160unsigned long get_sun4csegmap(unsigned long addr)
161{
162 unsigned long entry;
163
164 __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" :
165 "=r" (entry) :
166 "r" (addr), "i" (ASI_SEGMAP));
167 return entry;
168}
169
170#if 0
171/* Have to sort this out. This cannot be done after initialization. */
172static void flush_cache_all_nop(void) {}
173#endif
174
175/* Place where we save old trap entries for restoration */
176struct tt_entry kgdb_savettable[256];
177typedef void (*trapfunc_t)(void);
178
179/* Helper routine for manipulation of kgdb_savettable */
180static inline void copy_ttentry(struct tt_entry *src, struct tt_entry *dest)
181{
182 dest->inst_one = src->inst_one;
183 dest->inst_two = src->inst_two;
184 dest->inst_three = src->inst_three;
185 dest->inst_four = src->inst_four;
186}
187
188/* Initialize the kgdb_savettable so that debugging can commence */
189static void eh_init(void)
190{
191 int i;
192
193 for(i=0; i < 256; i++)
194 copy_ttentry(&sparc_ttable[i], &kgdb_savettable[i]);
195}
196
197/* Install an exception handler for kgdb */
198static void exceptionHandler(int tnum, trapfunc_t trap_entry)
199{
200 unsigned long te_addr = (unsigned long) trap_entry;
201
202 /* Make new vector */
203 sparc_ttable[tnum].inst_one =
204 SPARC_BRANCH((unsigned long) te_addr,
205 (unsigned long) &sparc_ttable[tnum].inst_one);
206 sparc_ttable[tnum].inst_two = SPARC_RD_PSR_L0;
207 sparc_ttable[tnum].inst_three = SPARC_NOP;
208 sparc_ttable[tnum].inst_four = SPARC_NOP;
209}
210
211/* Convert ch from a hex digit to an int */
212static int
213hex(unsigned char ch)
214{
215 if (ch >= 'a' && ch <= 'f')
216 return ch-'a'+10;
217 if (ch >= '0' && ch <= '9')
218 return ch-'0';
219 if (ch >= 'A' && ch <= 'F')
220 return ch-'A'+10;
221 return -1;
222}
223
224/* scan for the sequence $<data>#<checksum> */
225static void
226getpacket(char *buffer)
227{
228 unsigned char checksum;
229 unsigned char xmitcsum;
230 int i;
231 int count;
232 unsigned char ch;
233
234 do {
235 /* wait around for the start character, ignore all other characters */
236 while ((ch = (getDebugChar() & 0x7f)) != '$') ;
237
238 checksum = 0;
239 xmitcsum = -1;
240
241 count = 0;
242
243 /* now, read until a # or end of buffer is found */
244 while (count < BUFMAX) {
245 ch = getDebugChar() & 0x7f;
246 if (ch == '#')
247 break;
248 checksum = checksum + ch;
249 buffer[count] = ch;
250 count = count + 1;
251 }
252
253 if (count >= BUFMAX)
254 continue;
255
256 buffer[count] = 0;
257
258 if (ch == '#') {
259 xmitcsum = hex(getDebugChar() & 0x7f) << 4;
260 xmitcsum |= hex(getDebugChar() & 0x7f);
261 if (checksum != xmitcsum)
262 putDebugChar('-'); /* failed checksum */
263 else {
264 putDebugChar('+'); /* successful transfer */
265 /* if a sequence char is present, reply the ID */
266 if (buffer[2] == ':') {
267 putDebugChar(buffer[0]);
268 putDebugChar(buffer[1]);
269 /* remove sequence chars from buffer */
270 count = strlen(buffer);
271 for (i=3; i <= count; i++)
272 buffer[i-3] = buffer[i];
273 }
274 }
275 }
276 } while (checksum != xmitcsum);
277}
278
279/* send the packet in buffer. */
280
281static void
282putpacket(unsigned char *buffer)
283{
284 unsigned char checksum;
285 int count;
286 unsigned char ch, recv;
287
288 /* $<packet info>#<checksum>. */
289 do {
290 putDebugChar('$');
291 checksum = 0;
292 count = 0;
293
294 while ((ch = buffer[count])) {
295 putDebugChar(ch);
296 checksum += ch;
297 count += 1;
298 }
299
300 putDebugChar('#');
301 putDebugChar(hexchars[checksum >> 4]);
302 putDebugChar(hexchars[checksum & 0xf]);
303 recv = getDebugChar();
304 } while ((recv & 0x7f) != '+');
305}
306
307static char remcomInBuffer[BUFMAX];
308static char remcomOutBuffer[BUFMAX];
309
310/* Convert the memory pointed to by mem into hex, placing result in buf.
311 * Return a pointer to the last char put in buf (null), in case of mem fault,
312 * return 0.
313 */
314
315static unsigned char *
316mem2hex(char *mem, char *buf, int count)
317{
318 unsigned char ch;
319
320 while (count-- > 0) {
321 /* This assembler code is basically: ch = *mem++;
322 * except that we use the SPARC/Linux exception table
323 * mechanism (see how "fixup" works in kernel_mna_trap_fault)
324 * to arrange for a "return 0" upon a memory fault
325 */
326 __asm__(
327 "\n1:\n\t"
328 "ldub [%0], %1\n\t"
329 "inc %0\n\t"
330 ".section .fixup,#alloc,#execinstr\n\t"
331 ".align 4\n"
332 "2:\n\t"
333 "retl\n\t"
334 " mov 0, %%o0\n\t"
335 ".section __ex_table, #alloc\n\t"
336 ".align 4\n\t"
337 ".word 1b, 2b\n\t"
338 ".text\n"
339 : "=r" (mem), "=r" (ch) : "0" (mem));
340 *buf++ = hexchars[ch >> 4];
341 *buf++ = hexchars[ch & 0xf];
342 }
343
344 *buf = 0;
345 return buf;
346}
347
348/* convert the hex array pointed to by buf into binary to be placed in mem
349 * return a pointer to the character AFTER the last byte written.
350*/
351static char *
352hex2mem(char *buf, char *mem, int count)
353{
354 int i;
355 unsigned char ch;
356
357 for (i=0; i<count; i++) {
358
359 ch = hex(*buf++) << 4;
360 ch |= hex(*buf++);
361 /* Assembler code is *mem++ = ch; with return 0 on fault */
362 __asm__(
363 "\n1:\n\t"
364 "stb %1, [%0]\n\t"
365 "inc %0\n\t"
366 ".section .fixup,#alloc,#execinstr\n\t"
367 ".align 4\n"
368 "2:\n\t"
369 "retl\n\t"
370 " mov 0, %%o0\n\t"
371 ".section __ex_table, #alloc\n\t"
372 ".align 4\n\t"
373 ".word 1b, 2b\n\t"
374 ".text\n"
375 : "=r" (mem) : "r" (ch) , "0" (mem));
376 }
377 return mem;
378}
379
380/* This table contains the mapping between SPARC hardware trap types, and
381 signals, which are primarily what GDB understands. It also indicates
382 which hardware traps we need to commandeer when initializing the stub. */
383
384static struct hard_trap_info
385{
386 unsigned char tt; /* Trap type code for SPARC */
387 unsigned char signo; /* Signal that we map this trap into */
388} hard_trap_info[] = {
389 {SP_TRAP_SBPT, SIGTRAP}, /* ta 1 - Linux/KGDB software breakpoint */
390 {0, 0} /* Must be last */
391};
392
393/* Set up exception handlers for tracing and breakpoints */
394
395void
396set_debug_traps(void)
397{
398 struct hard_trap_info *ht;
399 unsigned long flags;
400
401 local_irq_save(flags);
402#if 0
403/* Have to sort this out. This cannot be done after initialization. */
404 BTFIXUPSET_CALL(flush_cache_all, flush_cache_all_nop, BTFIXUPCALL_NOP);
405#endif
406
407 /* Initialize our copy of the Linux Sparc trap table */
408 eh_init();
409
410 for (ht = hard_trap_info; ht->tt && ht->signo; ht++) {
411 /* Only if it doesn't destroy our fault handlers */
412 if((ht->tt != SP_TRAP_TFLT) &&
413 (ht->tt != SP_TRAP_DFLT))
414 exceptionHandler(ht->tt, trap_low);
415 }
416
417 /* In case GDB is started before us, ack any packets (presumably
418 * "$?#xx") sitting there.
419 *
420 * I've found this code causes more problems than it solves,
421 * so that's why it's commented out. GDB seems to work fine
422 * now starting either before or after the kernel -bwb
423 */
424#if 0
425 while((c = getDebugChar()) != '$');
426 while((c = getDebugChar()) != '#');
427 c = getDebugChar(); /* eat first csum byte */
428 c = getDebugChar(); /* eat second csum byte */
429 putDebugChar('+'); /* ack it */
430#endif
431
432 initialized = 1; /* connect! */
433 local_irq_restore(flags);
434}
435
436/* Convert the SPARC hardware trap type code to a unix signal number. */
437
438static int
439computeSignal(int tt)
440{
441 struct hard_trap_info *ht;
442
443 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
444 if (ht->tt == tt)
445 return ht->signo;
446
447 return SIGHUP; /* default for things we don't know about */
448}
449
450/*
451 * While we find nice hex chars, build an int.
452 * Return number of chars processed.
453 */
454
455static int
456hexToInt(char **ptr, int *intValue)
457{
458 int numChars = 0;
459 int hexValue;
460
461 *intValue = 0;
462
463 while (**ptr) {
464 hexValue = hex(**ptr);
465 if (hexValue < 0)
466 break;
467
468 *intValue = (*intValue << 4) | hexValue;
469 numChars ++;
470
471 (*ptr)++;
472 }
473
474 return (numChars);
475}
476
477/*
478 * This function does all command processing for interfacing to gdb. It
479 * returns 1 if you should skip the instruction at the trap address, 0
480 * otherwise.
481 */
482
483extern void breakinst(void);
484
485void
486handle_exception (unsigned long *registers)
487{
488 int tt; /* Trap type */
489 int sigval;
490 int addr;
491 int length;
492 char *ptr;
493 unsigned long *sp;
494
495 /* First, we must force all of the windows to be spilled out */
496
497 asm("save %sp, -64, %sp\n\t"
498 "save %sp, -64, %sp\n\t"
499 "save %sp, -64, %sp\n\t"
500 "save %sp, -64, %sp\n\t"
501 "save %sp, -64, %sp\n\t"
502 "save %sp, -64, %sp\n\t"
503 "save %sp, -64, %sp\n\t"
504 "save %sp, -64, %sp\n\t"
505 "restore\n\t"
506 "restore\n\t"
507 "restore\n\t"
508 "restore\n\t"
509 "restore\n\t"
510 "restore\n\t"
511 "restore\n\t"
512 "restore\n\t");
513
514 lock_kernel();
515 if (registers[PC] == (unsigned long)breakinst) {
516 /* Skip over breakpoint trap insn */
517 registers[PC] = registers[NPC];
518 registers[NPC] += 4;
519 }
520
521 sp = (unsigned long *)registers[SP];
522
523 tt = (registers[TBR] >> 4) & 0xff;
524
525 /* reply to host that an exception has occurred */
526 sigval = computeSignal(tt);
527 ptr = remcomOutBuffer;
528
529 *ptr++ = 'T';
530 *ptr++ = hexchars[sigval >> 4];
531 *ptr++ = hexchars[sigval & 0xf];
532
533 *ptr++ = hexchars[PC >> 4];
534 *ptr++ = hexchars[PC & 0xf];
535 *ptr++ = ':';
536 ptr = mem2hex((char *)&registers[PC], ptr, 4);
537 *ptr++ = ';';
538
539 *ptr++ = hexchars[FP >> 4];
540 *ptr++ = hexchars[FP & 0xf];
541 *ptr++ = ':';
542 ptr = mem2hex((char *) (sp + 8 + 6), ptr, 4); /* FP */
543 *ptr++ = ';';
544
545 *ptr++ = hexchars[SP >> 4];
546 *ptr++ = hexchars[SP & 0xf];
547 *ptr++ = ':';
548 ptr = mem2hex((char *)&sp, ptr, 4);
549 *ptr++ = ';';
550
551 *ptr++ = hexchars[NPC >> 4];
552 *ptr++ = hexchars[NPC & 0xf];
553 *ptr++ = ':';
554 ptr = mem2hex((char *)&registers[NPC], ptr, 4);
555 *ptr++ = ';';
556
557 *ptr++ = hexchars[O7 >> 4];
558 *ptr++ = hexchars[O7 & 0xf];
559 *ptr++ = ':';
560 ptr = mem2hex((char *)&registers[O7], ptr, 4);
561 *ptr++ = ';';
562
563 *ptr++ = 0;
564
565 putpacket(remcomOutBuffer);
566
567 /* XXX We may want to add some features dealing with poking the
568 * XXX page tables, the real ones on the srmmu, and what is currently
569 * XXX loaded in the sun4/sun4c tlb at this point in time. But this
570 * XXX also required hacking to the gdb sources directly...
571 */
572
573 while (1) {
574 remcomOutBuffer[0] = 0;
575
576 getpacket(remcomInBuffer);
577 switch (remcomInBuffer[0]) {
578 case '?':
579 remcomOutBuffer[0] = 'S';
580 remcomOutBuffer[1] = hexchars[sigval >> 4];
581 remcomOutBuffer[2] = hexchars[sigval & 0xf];
582 remcomOutBuffer[3] = 0;
583 break;
584
585 case 'd':
586 /* toggle debug flag */
587 break;
588
589 case 'g': /* return the value of the CPU registers */
590 {
591 ptr = remcomOutBuffer;
592 /* G & O regs */
593 ptr = mem2hex((char *)registers, ptr, 16 * 4);
594 /* L & I regs */
595 ptr = mem2hex((char *) (sp + 0), ptr, 16 * 4);
596 /* Floating point */
597 memset(ptr, '0', 32 * 8);
598 /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
599 mem2hex((char *)&registers[Y], (ptr + 32 * 4 * 2), (8 * 4));
600 }
601 break;
602
603 case 'G': /* set the value of the CPU registers - return OK */
604 {
605 unsigned long *newsp, psr;
606
607 psr = registers[PSR];
608
609 ptr = &remcomInBuffer[1];
610 /* G & O regs */
611 hex2mem(ptr, (char *)registers, 16 * 4);
612 /* L & I regs */
613 hex2mem(ptr + 16 * 4 * 2, (char *) (sp + 0), 16 * 4);
614 /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
615 hex2mem(ptr + 64 * 4 * 2, (char *)&registers[Y], 8 * 4);
616
617 /* See if the stack pointer has moved. If so,
618 * then copy the saved locals and ins to the
619 * new location. This keeps the window
620 * overflow and underflow routines happy.
621 */
622
623 newsp = (unsigned long *)registers[SP];
624 if (sp != newsp)
625 sp = memcpy(newsp, sp, 16 * 4);
626
627 /* Don't allow CWP to be modified. */
628
629 if (psr != registers[PSR])
630 registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
631
632 strcpy(remcomOutBuffer,"OK");
633 }
634 break;
635
636 case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
637 /* Try to read %x,%x. */
638
639 ptr = &remcomInBuffer[1];
640
641 if (hexToInt(&ptr, &addr)
642 && *ptr++ == ','
643 && hexToInt(&ptr, &length)) {
644 if (mem2hex((char *)addr, remcomOutBuffer, length))
645 break;
646
647 strcpy (remcomOutBuffer, "E03");
648 } else {
649 strcpy(remcomOutBuffer,"E01");
650 }
651 break;
652
653 case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
654 /* Try to read '%x,%x:'. */
655
656 ptr = &remcomInBuffer[1];
657
658 if (hexToInt(&ptr, &addr)
659 && *ptr++ == ','
660 && hexToInt(&ptr, &length)
661 && *ptr++ == ':') {
662 if (hex2mem(ptr, (char *)addr, length)) {
663 strcpy(remcomOutBuffer, "OK");
664 } else {
665 strcpy(remcomOutBuffer, "E03");
666 }
667 } else {
668 strcpy(remcomOutBuffer, "E02");
669 }
670 break;
671
672 case 'c': /* cAA..AA Continue at address AA..AA(optional) */
673 /* try to read optional parameter, pc unchanged if no parm */
674
675 ptr = &remcomInBuffer[1];
676 if (hexToInt(&ptr, &addr)) {
677 registers[PC] = addr;
678 registers[NPC] = addr + 4;
679 }
680
681/* Need to flush the instruction cache here, as we may have deposited a
682 * breakpoint, and the icache probably has no way of knowing that a data ref to
683 * some location may have changed something that is in the instruction cache.
684 */
685 flush_cache_all();
686 unlock_kernel();
687 return;
688
689 /* kill the program */
690 case 'k' : /* do nothing */
691 break;
692 case 'r': /* Reset */
693 asm ("call 0\n\t"
694 "nop\n\t");
695 break;
696 } /* switch */
697
698 /* reply to the request */
699 putpacket(remcomOutBuffer);
700 } /* while(1) */
701}
702
703/* This function will generate a breakpoint exception. It is used at the
704 beginning of a program to sync up with a debugger and can be used
705 otherwise as a quick means to stop program execution and "break" into
706 the debugger. */
707
708void
709breakpoint(void)
710{
711 if (!initialized)
712 return;
713
714 /* Again, watch those c-prefixes for ELF kernels */
715#if defined(__svr4__) || defined(__ELF__)
716 asm(".globl breakinst\n"
717 "breakinst:\n\t"
718 "ta 1\n");
719#else
720 asm(".globl _breakinst\n"
721 "_breakinst:\n\t"
722 "ta 1\n");
723#endif
724}
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 0bcf98a7ef38..aa8ee06cf488 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -282,3 +282,5 @@ EXPORT_SYMBOL(do_BUG);
282 282
283/* Sun Power Management Idle Handler */ 283/* Sun Power Management Idle Handler */
284EXPORT_SYMBOL(pm_idle); 284EXPORT_SYMBOL(pm_idle);
285
286EXPORT_SYMBOL(empty_zero_page);
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index 0def48158c7d..dfde77ff0848 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -335,37 +335,6 @@ void smp4d_cross_call_irq(void)
335 ccall_info.processors_out[i] = 1; 335 ccall_info.processors_out[i] = 1;
336} 336}
337 337
338static int smp4d_stop_cpu_sender;
339
340static void smp4d_stop_cpu(void)
341{
342 int me = hard_smp4d_processor_id();
343
344 if (me != smp4d_stop_cpu_sender)
345 while(1) barrier();
346}
347
348/* Cross calls, in order to work efficiently and atomically do all
349 * the message passing work themselves, only stopcpu and reschedule
350 * messages come through here.
351 */
352void smp4d_message_pass(int target, int msg, unsigned long data, int wait)
353{
354 int me = hard_smp4d_processor_id();
355
356 SMP_PRINTK(("smp4d_message_pass %d %d %08lx %d\n", target, msg, data, wait));
357 if (msg == MSG_STOP_CPU && target == MSG_ALL_BUT_SELF) {
358 unsigned long flags;
359 static DEFINE_SPINLOCK(stop_cpu_lock);
360 spin_lock_irqsave(&stop_cpu_lock, flags);
361 smp4d_stop_cpu_sender = me;
362 smp4d_cross_call((smpfunc_t)smp4d_stop_cpu, 0, 0, 0, 0, 0);
363 spin_unlock_irqrestore(&stop_cpu_lock, flags);
364 }
365 printk("Yeeee, trying to send SMP msg(%d) to %d on cpu %d\n", msg, target, me);
366 panic("Bogon SMP message pass.");
367}
368
369void smp4d_percpu_timer_interrupt(struct pt_regs *regs) 338void smp4d_percpu_timer_interrupt(struct pt_regs *regs)
370{ 339{
371 struct pt_regs *old_regs; 340 struct pt_regs *old_regs;
@@ -439,7 +408,6 @@ void __init sun4d_init_smp(void)
439 BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4d_blackbox_id); 408 BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4d_blackbox_id);
440 BTFIXUPSET_BLACKBOX(load_current, smp4d_blackbox_current); 409 BTFIXUPSET_BLACKBOX(load_current, smp4d_blackbox_current);
441 BTFIXUPSET_CALL(smp_cross_call, smp4d_cross_call, BTFIXUPCALL_NORM); 410 BTFIXUPSET_CALL(smp_cross_call, smp4d_cross_call, BTFIXUPCALL_NORM);
442 BTFIXUPSET_CALL(smp_message_pass, smp4d_message_pass, BTFIXUPCALL_NORM);
443 BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4d_processor_id, BTFIXUPCALL_NORM); 411 BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4d_processor_id, BTFIXUPCALL_NORM);
444 412
445 for (i = 0; i < NR_CPUS; i++) { 413 for (i = 0; i < NR_CPUS; i++) {
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index 0b9407267162..ffb875aacb7e 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -34,8 +34,6 @@
34 34
35#include "irq.h" 35#include "irq.h"
36 36
37#define IRQ_RESCHEDULE 13
38#define IRQ_STOP_CPU 14
39#define IRQ_CROSS_CALL 15 37#define IRQ_CROSS_CALL 15
40 38
41extern ctxd_t *srmmu_ctx_table_phys; 39extern ctxd_t *srmmu_ctx_table_phys;
@@ -232,48 +230,6 @@ void smp4m_irq_rotate(int cpu)
232 set_irq_udt(next); 230 set_irq_udt(next);
233} 231}
234 232
235/* Cross calls, in order to work efficiently and atomically do all
236 * the message passing work themselves, only stopcpu and reschedule
237 * messages come through here.
238 */
239void smp4m_message_pass(int target, int msg, unsigned long data, int wait)
240{
241 static unsigned long smp_cpu_in_msg[NR_CPUS];
242 cpumask_t mask;
243 int me = smp_processor_id();
244 int irq, i;
245
246 if(msg == MSG_RESCHEDULE) {
247 irq = IRQ_RESCHEDULE;
248
249 if(smp_cpu_in_msg[me])
250 return;
251 } else if(msg == MSG_STOP_CPU) {
252 irq = IRQ_STOP_CPU;
253 } else {
254 goto barf;
255 }
256
257 smp_cpu_in_msg[me]++;
258 if(target == MSG_ALL_BUT_SELF || target == MSG_ALL) {
259 mask = cpu_online_map;
260 if(target == MSG_ALL_BUT_SELF)
261 cpu_clear(me, mask);
262 for(i = 0; i < 4; i++) {
263 if (cpu_isset(i, mask))
264 set_cpu_int(i, irq);
265 }
266 } else {
267 set_cpu_int(target, irq);
268 }
269 smp_cpu_in_msg[me]--;
270
271 return;
272barf:
273 printk("Yeeee, trying to send SMP msg(%d) on cpu %d\n", msg, me);
274 panic("Bogon SMP message pass.");
275}
276
277static struct smp_funcall { 233static struct smp_funcall {
278 smpfunc_t func; 234 smpfunc_t func;
279 unsigned long arg1; 235 unsigned long arg1;
@@ -413,6 +369,5 @@ void __init sun4m_init_smp(void)
413 BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4m_blackbox_id); 369 BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4m_blackbox_id);
414 BTFIXUPSET_BLACKBOX(load_current, smp4m_blackbox_current); 370 BTFIXUPSET_BLACKBOX(load_current, smp4m_blackbox_current);
415 BTFIXUPSET_CALL(smp_cross_call, smp4m_cross_call, BTFIXUPCALL_NORM); 371 BTFIXUPSET_CALL(smp_cross_call, smp4m_cross_call, BTFIXUPCALL_NORM);
416 BTFIXUPSET_CALL(smp_message_pass, smp4m_message_pass, BTFIXUPCALL_NORM);
417 BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4m_processor_id, BTFIXUPCALL_NORM); 372 BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4m_processor_id, BTFIXUPCALL_NORM);
418} 373}
diff --git a/arch/sparc/lib/iomap.c b/arch/sparc/lib/iomap.c
index 54501c1ca785..9ef37e13a920 100644
--- a/arch/sparc/lib/iomap.c
+++ b/arch/sparc/lib/iomap.c
@@ -21,8 +21,8 @@ EXPORT_SYMBOL(ioport_unmap);
21/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 21/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
22void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 22void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
23{ 23{
24 unsigned long start = pci_resource_start(dev, bar); 24 resource_size_t start = pci_resource_start(dev, bar);
25 unsigned long len = pci_resource_len(dev, bar); 25 resource_size_t len = pci_resource_len(dev, bar);
26 unsigned long flags = pci_resource_flags(dev, bar); 26 unsigned long flags = pci_resource_flags(dev, bar);
27 27
28 if (!len || !start) 28 if (!len || !start)
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c
index e4d9c8e19df5..abd50795a7b6 100644
--- a/arch/sparc/mm/fault.c
+++ b/arch/sparc/mm/fault.c
@@ -47,64 +47,15 @@ int vac_size, vac_linesize, vac_do_hw_vac_flushes;
47int vac_entries_per_context, vac_entries_per_segment; 47int vac_entries_per_context, vac_entries_per_segment;
48int vac_entries_per_page; 48int vac_entries_per_page;
49 49
50/* Nice, simple, prom library does all the sweating for us. ;) */ 50/* Return how much physical memory we have. */
51int prom_probe_memory (void) 51unsigned long probe_memory(void)
52{ 52{
53 register struct linux_mlist_v0 *mlist; 53 unsigned long total = 0;
54 register unsigned long bytes, base_paddr, tally; 54 int i;
55 register int i;
56
57 i = 0;
58 mlist= *prom_meminfo()->v0_available;
59 bytes = tally = mlist->num_bytes;
60 base_paddr = (unsigned long) mlist->start_adr;
61
62 sp_banks[0].base_addr = base_paddr;
63 sp_banks[0].num_bytes = bytes;
64
65 while (mlist->theres_more != (void *) 0){
66 i++;
67 mlist = mlist->theres_more;
68 bytes = mlist->num_bytes;
69 tally += bytes;
70 if (i > SPARC_PHYS_BANKS-1) {
71 printk ("The machine has more banks than "
72 "this kernel can support\n"
73 "Increase the SPARC_PHYS_BANKS "
74 "setting (currently %d)\n",
75 SPARC_PHYS_BANKS);
76 i = SPARC_PHYS_BANKS-1;
77 break;
78 }
79
80 sp_banks[i].base_addr = (unsigned long) mlist->start_adr;
81 sp_banks[i].num_bytes = mlist->num_bytes;
82 }
83
84 i++;
85 sp_banks[i].base_addr = 0xdeadbeef;
86 sp_banks[i].num_bytes = 0;
87
88 /* Now mask all bank sizes on a page boundary, it is all we can
89 * use anyways.
90 */
91 for(i=0; sp_banks[i].num_bytes != 0; i++)
92 sp_banks[i].num_bytes &= PAGE_MASK;
93
94 return tally;
95}
96
97/* Traverse the memory lists in the prom to see how much physical we
98 * have.
99 */
100unsigned long
101probe_memory(void)
102{
103 int total;
104 55
105 total = prom_probe_memory(); 56 for (i = 0; sp_banks[i].num_bytes; i++)
57 total += sp_banks[i].num_bytes;
106 58
107 /* Oh man, much nicer, keep the dirt in promlib. */
108 return total; 59 return total;
109} 60}
110 61
diff --git a/arch/sparc/prom/init.c b/arch/sparc/prom/init.c
index 50abfb1b880e..2fa3a474e3a2 100644
--- a/arch/sparc/prom/init.c
+++ b/arch/sparc/prom/init.c
@@ -21,8 +21,6 @@ linux_sun4_romvec *sun4_romvec;
21/* The root node of the prom device tree. */ 21/* The root node of the prom device tree. */
22int prom_root_node; 22int prom_root_node;
23 23
24int prom_stdin, prom_stdout;
25
26/* Pointer to the device tree operations structure. */ 24/* Pointer to the device tree operations structure. */
27struct linux_nodeops *prom_nodeops; 25struct linux_nodeops *prom_nodeops;
28 26
@@ -74,11 +72,6 @@ void __init prom_init(struct linux_romvec *rp)
74 (((unsigned long) prom_nodeops) == -1)) 72 (((unsigned long) prom_nodeops) == -1))
75 prom_halt(); 73 prom_halt();
76 74
77 if(prom_vers == PROM_V2 || prom_vers == PROM_V3) {
78 prom_stdout = *romvec->pv_v2bootargs.fd_stdout;
79 prom_stdin = *romvec->pv_v2bootargs.fd_stdin;
80 }
81
82 prom_meminit(); 75 prom_meminit();
83 76
84 prom_ranges_init(); 77 prom_ranges_init();
diff --git a/arch/sparc/prom/memory.c b/arch/sparc/prom/memory.c
index b0c0f9c4fc14..947f047dc95a 100644
--- a/arch/sparc/prom/memory.c
+++ b/arch/sparc/prom/memory.c
@@ -1,215 +1,100 @@
1/* $Id: memory.c,v 1.15 2000/01/29 01:09:12 anton Exp $ 1/* memory.c: Prom routine for acquiring various bits of information
2 * memory.c: Prom routine for acquiring various bits of information
3 * about RAM on the machine, both virtual and physical. 2 * about RAM on the machine, both virtual and physical.
4 * 3 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995, 2008 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 1997 Michael A. Griffith (grif@acm.org) 5 * Copyright (C) 1997 Michael A. Griffith (grif@acm.org)
7 */ 6 */
8 7
9#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sort.h>
10#include <linux/init.h> 10#include <linux/init.h>
11 11
12#include <asm/openprom.h> 12#include <asm/openprom.h>
13#include <asm/sun4prom.h> 13#include <asm/sun4prom.h>
14#include <asm/oplib.h> 14#include <asm/oplib.h>
15#include <asm/page.h>
15 16
16/* This routine, for consistency, returns the ram parameters in the 17static int __init prom_meminit_v0(void)
17 * V0 prom memory descriptor format. I choose this format because I 18{
18 * think it was the easiest to work with. I feel the religious 19 struct linux_mlist_v0 *p;
19 * arguments now... ;) Also, I return the linked lists sorted to 20 int index;
20 * prevent paging_init() upset stomach as I have not yet written 21
21 * the pepto-bismol kernel module yet. 22 index = 0;
22 */ 23 for (p = *(romvec->pv_v0mem.v0_available); p; p = p->theres_more) {
24 sp_banks[index].base_addr = (unsigned long) p->start_adr;
25 sp_banks[index].num_bytes = p->num_bytes;
26 index++;
27 }
23 28
24struct linux_prom_registers prom_reg_memlist[64]; 29 return index;
25struct linux_prom_registers prom_reg_tmp[64]; 30}
26 31
27struct linux_mlist_v0 prom_phys_total[64]; 32static int __init prom_meminit_v2(void)
28struct linux_mlist_v0 prom_prom_taken[64]; 33{
29struct linux_mlist_v0 prom_phys_avail[64]; 34 struct linux_prom_registers reg[64];
35 int node, size, num_ents, i;
30 36
31struct linux_mlist_v0 *prom_ptot_ptr = prom_phys_total; 37 node = prom_searchsiblings(prom_getchild(prom_root_node), "memory");
32struct linux_mlist_v0 *prom_ptak_ptr = prom_prom_taken; 38 size = prom_getproperty(node, "available", (char *) reg, sizeof(reg));
33struct linux_mlist_v0 *prom_pavl_ptr = prom_phys_avail; 39 num_ents = size / sizeof(struct linux_prom_registers);
34 40
35struct linux_mem_v0 prom_memlist; 41 for (i = 0; i < num_ents; i++) {
42 sp_banks[i].base_addr = reg[i].phys_addr;
43 sp_banks[i].num_bytes = reg[i].reg_size;
44 }
36 45
46 return num_ents;
47}
37 48
38/* Internal Prom library routine to sort a linux_mlist_v0 memory 49static int __init prom_meminit_sun4(void)
39 * list. Used below in initialization.
40 */
41static void __init
42prom_sortmemlist(struct linux_mlist_v0 *thislist)
43{ 50{
44 int swapi = 0; 51#ifdef CONFIG_SUN4
45 int i, mitr, tmpsize; 52 sp_banks[0].base_addr = 0;
46 char *tmpaddr; 53 sp_banks[0].num_bytes = *(sun4_romvec->memoryavail);
47 char *lowest; 54#endif
48 55 return 1;
49 for(i=0; thislist[i].theres_more; i++) { 56}
50 lowest = thislist[i].start_adr; 57
51 for(mitr = i+1; thislist[mitr-1].theres_more; mitr++) 58static int sp_banks_cmp(const void *a, const void *b)
52 if(thislist[mitr].start_adr < lowest) { 59{
53 lowest = thislist[mitr].start_adr; 60 const struct sparc_phys_banks *x = a, *y = b;
54 swapi = mitr;
55 }
56 if(lowest == thislist[i].start_adr) continue;
57 tmpaddr = thislist[swapi].start_adr;
58 tmpsize = thislist[swapi].num_bytes;
59 for(mitr = swapi; mitr > i; mitr--) {
60 thislist[mitr].start_adr = thislist[mitr-1].start_adr;
61 thislist[mitr].num_bytes = thislist[mitr-1].num_bytes;
62 }
63 thislist[i].start_adr = tmpaddr;
64 thislist[i].num_bytes = tmpsize;
65 }
66 61
67 return; 62 if (x->base_addr > y->base_addr)
63 return 1;
64 if (x->base_addr < y->base_addr)
65 return -1;
66 return 0;
68} 67}
69 68
70/* Initialize the memory lists based upon the prom version. */ 69/* Initialize the memory lists based upon the prom version. */
71void __init prom_meminit(void) 70void __init prom_meminit(void)
72{ 71{
73 int node = 0; 72 int i, num_ents = 0;
74 unsigned int iter, num_regs;
75 struct linux_mlist_v0 *mptr; /* ptr for traversal */
76 73
77 switch(prom_vers) { 74 switch (prom_vers) {
78 case PROM_V0: 75 case PROM_V0:
79 /* Nice, kind of easier to do in this case. */ 76 num_ents = prom_meminit_v0();
80 /* First, the total physical descriptors. */
81 for(mptr = (*(romvec->pv_v0mem.v0_totphys)), iter=0;
82 mptr; mptr=mptr->theres_more, iter++) {
83 prom_phys_total[iter].start_adr = mptr->start_adr;
84 prom_phys_total[iter].num_bytes = mptr->num_bytes;
85 prom_phys_total[iter].theres_more = &prom_phys_total[iter+1];
86 }
87 prom_phys_total[iter-1].theres_more = NULL;
88 /* Second, the total prom taken descriptors. */
89 for(mptr = (*(romvec->pv_v0mem.v0_prommap)), iter=0;
90 mptr; mptr=mptr->theres_more, iter++) {
91 prom_prom_taken[iter].start_adr = mptr->start_adr;
92 prom_prom_taken[iter].num_bytes = mptr->num_bytes;
93 prom_prom_taken[iter].theres_more = &prom_prom_taken[iter+1];
94 }
95 prom_prom_taken[iter-1].theres_more = NULL;
96 /* Last, the available physical descriptors. */
97 for(mptr = (*(romvec->pv_v0mem.v0_available)), iter=0;
98 mptr; mptr=mptr->theres_more, iter++) {
99 prom_phys_avail[iter].start_adr = mptr->start_adr;
100 prom_phys_avail[iter].num_bytes = mptr->num_bytes;
101 prom_phys_avail[iter].theres_more = &prom_phys_avail[iter+1];
102 }
103 prom_phys_avail[iter-1].theres_more = NULL;
104 /* Sort all the lists. */
105 prom_sortmemlist(prom_phys_total);
106 prom_sortmemlist(prom_prom_taken);
107 prom_sortmemlist(prom_phys_avail);
108 break; 77 break;
78
109 case PROM_V2: 79 case PROM_V2:
110 case PROM_V3: 80 case PROM_V3:
111 /* Grrr, have to traverse the prom device tree ;( */ 81 num_ents = prom_meminit_v2();
112 node = prom_getchild(prom_root_node);
113 node = prom_searchsiblings(node, "memory");
114 num_regs = prom_getproperty(node, "available",
115 (char *) prom_reg_memlist,
116 sizeof(prom_reg_memlist));
117 num_regs = (num_regs/sizeof(struct linux_prom_registers));
118 for(iter=0; iter<num_regs; iter++) {
119 prom_phys_avail[iter].start_adr =
120 (char *) prom_reg_memlist[iter].phys_addr;
121 prom_phys_avail[iter].num_bytes =
122 (unsigned long) prom_reg_memlist[iter].reg_size;
123 prom_phys_avail[iter].theres_more =
124 &prom_phys_avail[iter+1];
125 }
126 prom_phys_avail[iter-1].theres_more = NULL;
127
128 num_regs = prom_getproperty(node, "reg",
129 (char *) prom_reg_memlist,
130 sizeof(prom_reg_memlist));
131 num_regs = (num_regs/sizeof(struct linux_prom_registers));
132 for(iter=0; iter<num_regs; iter++) {
133 prom_phys_total[iter].start_adr =
134 (char *) prom_reg_memlist[iter].phys_addr;
135 prom_phys_total[iter].num_bytes =
136 (unsigned long) prom_reg_memlist[iter].reg_size;
137 prom_phys_total[iter].theres_more =
138 &prom_phys_total[iter+1];
139 }
140 prom_phys_total[iter-1].theres_more = NULL;
141
142 node = prom_getchild(prom_root_node);
143 node = prom_searchsiblings(node, "virtual-memory");
144 num_regs = prom_getproperty(node, "available",
145 (char *) prom_reg_memlist,
146 sizeof(prom_reg_memlist));
147 num_regs = (num_regs/sizeof(struct linux_prom_registers));
148
149 /* Convert available virtual areas to taken virtual
150 * areas. First sort, then convert.
151 */
152 for(iter=0; iter<num_regs; iter++) {
153 prom_prom_taken[iter].start_adr =
154 (char *) prom_reg_memlist[iter].phys_addr;
155 prom_prom_taken[iter].num_bytes =
156 (unsigned long) prom_reg_memlist[iter].reg_size;
157 prom_prom_taken[iter].theres_more =
158 &prom_prom_taken[iter+1];
159 }
160 prom_prom_taken[iter-1].theres_more = NULL;
161
162 prom_sortmemlist(prom_prom_taken);
163
164 /* Finally, convert. */
165 for(iter=0; iter<num_regs; iter++) {
166 prom_prom_taken[iter].start_adr =
167 prom_prom_taken[iter].start_adr +
168 prom_prom_taken[iter].num_bytes;
169 prom_prom_taken[iter].num_bytes =
170 prom_prom_taken[iter+1].start_adr -
171 prom_prom_taken[iter].start_adr;
172 }
173 prom_prom_taken[iter-1].num_bytes =
174 0xffffffff - (unsigned long) prom_prom_taken[iter-1].start_adr;
175
176 /* Sort the other two lists. */
177 prom_sortmemlist(prom_phys_total);
178 prom_sortmemlist(prom_phys_avail);
179 break; 82 break;
180 83
181 case PROM_SUN4: 84 case PROM_SUN4:
182#ifdef CONFIG_SUN4 85 num_ents = prom_meminit_sun4();
183 /* how simple :) */
184 prom_phys_total[0].start_adr = NULL;
185 prom_phys_total[0].num_bytes = *(sun4_romvec->memorysize);
186 prom_phys_total[0].theres_more = NULL;
187 prom_prom_taken[0].start_adr = NULL;
188 prom_prom_taken[0].num_bytes = 0x0;
189 prom_prom_taken[0].theres_more = NULL;
190 prom_phys_avail[0].start_adr = NULL;
191 prom_phys_avail[0].num_bytes = *(sun4_romvec->memoryavail);
192 prom_phys_avail[0].theres_more = NULL;
193#endif
194 break; 86 break;
195 87
196 default: 88 default:
197 break; 89 break;
198 }; 90 }
199 91 sort(sp_banks, num_ents, sizeof(struct sparc_phys_banks),
200 /* Link all the lists into the top-level descriptor. */ 92 sp_banks_cmp, NULL);
201 prom_memlist.v0_totphys=&prom_ptot_ptr;
202 prom_memlist.v0_prommap=&prom_ptak_ptr;
203 prom_memlist.v0_available=&prom_pavl_ptr;
204 93
205 return; 94 /* Sentinel. */
206} 95 sp_banks[num_ents].base_addr = 0xdeadbeef;
96 sp_banks[num_ents].num_bytes = 0;
207 97
208/* This returns a pointer to our libraries internal v0 format 98 for (i = 0; i < num_ents; i++)
209 * memory descriptor. 99 sp_banks[i].num_bytes &= PAGE_MASK;
210 */
211struct linux_mem_v0 *
212prom_meminfo(void)
213{
214 return &prom_memlist;
215} 100}
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index edbe71e3fab9..eb36f3b746b8 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -13,6 +13,7 @@ config SPARC64
13 default y 13 default y
14 select HAVE_IDE 14 select HAVE_IDE
15 select HAVE_LMB 15 select HAVE_LMB
16 select HAVE_ARCH_KGDB
16 17
17config GENERIC_TIME 18config GENERIC_TIME
18 bool 19 bool
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index 2bd0340b743d..ec4f5ebb1ca6 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -29,3 +29,4 @@ obj-$(CONFIG_SUN_LDOMS) += ldc.o vio.o viohs.o ds.o
29obj-$(CONFIG_AUDIT) += audit.o 29obj-$(CONFIG_AUDIT) += audit.o
30obj-$(CONFIG_AUDIT)$(CONFIG_COMPAT) += compat_audit.o 30obj-$(CONFIG_AUDIT)$(CONFIG_COMPAT) += compat_audit.o
31obj-y += $(obj-yy) 31obj-y += $(obj-yy)
32obj-$(CONFIG_KGDB) += kgdb.o
diff --git a/arch/sparc64/kernel/cherrs.S b/arch/sparc64/kernel/cherrs.S
new file mode 100644
index 000000000000..89afebd7eca0
--- /dev/null
+++ b/arch/sparc64/kernel/cherrs.S
@@ -0,0 +1,579 @@
1 /* These get patched into the trap table at boot time
2 * once we know we have a cheetah processor.
3 */
4 .globl cheetah_fecc_trap_vector
5 .type cheetah_fecc_trap_vector,#function
6cheetah_fecc_trap_vector:
7 membar #Sync
8 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
9 andn %g1, DCU_DC | DCU_IC, %g1
10 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
11 membar #Sync
12 sethi %hi(cheetah_fast_ecc), %g2
13 jmpl %g2 + %lo(cheetah_fast_ecc), %g0
14 mov 0, %g1
15 .size cheetah_fecc_trap_vector,.-cheetah_fecc_trap_vector
16
17 .globl cheetah_fecc_trap_vector_tl1
18 .type cheetah_fecc_trap_vector_tl1,#function
19cheetah_fecc_trap_vector_tl1:
20 membar #Sync
21 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
22 andn %g1, DCU_DC | DCU_IC, %g1
23 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
24 membar #Sync
25 sethi %hi(cheetah_fast_ecc), %g2
26 jmpl %g2 + %lo(cheetah_fast_ecc), %g0
27 mov 1, %g1
28 .size cheetah_fecc_trap_vector_tl1,.-cheetah_fecc_trap_vector_tl1
29
30 .globl cheetah_cee_trap_vector
31 .type cheetah_cee_trap_vector,#function
32cheetah_cee_trap_vector:
33 membar #Sync
34 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
35 andn %g1, DCU_IC, %g1
36 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
37 membar #Sync
38 sethi %hi(cheetah_cee), %g2
39 jmpl %g2 + %lo(cheetah_cee), %g0
40 mov 0, %g1
41 .size cheetah_cee_trap_vector,.-cheetah_cee_trap_vector
42
43 .globl cheetah_cee_trap_vector_tl1
44 .type cheetah_cee_trap_vector_tl1,#function
45cheetah_cee_trap_vector_tl1:
46 membar #Sync
47 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
48 andn %g1, DCU_IC, %g1
49 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
50 membar #Sync
51 sethi %hi(cheetah_cee), %g2
52 jmpl %g2 + %lo(cheetah_cee), %g0
53 mov 1, %g1
54 .size cheetah_cee_trap_vector_tl1,.-cheetah_cee_trap_vector_tl1
55
56 .globl cheetah_deferred_trap_vector
57 .type cheetah_deferred_trap_vector,#function
58cheetah_deferred_trap_vector:
59 membar #Sync
60 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
61 andn %g1, DCU_DC | DCU_IC, %g1;
62 stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
63 membar #Sync;
64 sethi %hi(cheetah_deferred_trap), %g2
65 jmpl %g2 + %lo(cheetah_deferred_trap), %g0
66 mov 0, %g1
67 .size cheetah_deferred_trap_vector,.-cheetah_deferred_trap_vector
68
69 .globl cheetah_deferred_trap_vector_tl1
70 .type cheetah_deferred_trap_vector_tl1,#function
71cheetah_deferred_trap_vector_tl1:
72 membar #Sync;
73 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
74 andn %g1, DCU_DC | DCU_IC, %g1;
75 stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
76 membar #Sync;
77 sethi %hi(cheetah_deferred_trap), %g2
78 jmpl %g2 + %lo(cheetah_deferred_trap), %g0
79 mov 1, %g1
80 .size cheetah_deferred_trap_vector_tl1,.-cheetah_deferred_trap_vector_tl1
81
82 /* Cheetah+ specific traps. These are for the new I/D cache parity
83 * error traps. The first argument to cheetah_plus_parity_handler
84 * is encoded as follows:
85 *
86 * Bit0: 0=dcache,1=icache
87 * Bit1: 0=recoverable,1=unrecoverable
88 */
89 .globl cheetah_plus_dcpe_trap_vector
90 .type cheetah_plus_dcpe_trap_vector,#function
91cheetah_plus_dcpe_trap_vector:
92 membar #Sync
93 sethi %hi(do_cheetah_plus_data_parity), %g7
94 jmpl %g7 + %lo(do_cheetah_plus_data_parity), %g0
95 nop
96 nop
97 nop
98 nop
99 nop
100 .size cheetah_plus_dcpe_trap_vector,.-cheetah_plus_dcpe_trap_vector
101
102 .type do_cheetah_plus_data_parity,#function
103do_cheetah_plus_data_parity:
104 rdpr %pil, %g2
105 wrpr %g0, 15, %pil
106 ba,pt %xcc, etrap_irq
107 rd %pc, %g7
108#ifdef CONFIG_TRACE_IRQFLAGS
109 call trace_hardirqs_off
110 nop
111#endif
112 mov 0x0, %o0
113 call cheetah_plus_parity_error
114 add %sp, PTREGS_OFF, %o1
115 ba,a,pt %xcc, rtrap_irq
116 .size do_cheetah_plus_data_parity,.-do_cheetah_plus_data_parity
117
118 .globl cheetah_plus_dcpe_trap_vector_tl1
119 .type cheetah_plus_dcpe_trap_vector_tl1,#function
120cheetah_plus_dcpe_trap_vector_tl1:
121 membar #Sync
122 wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
123 sethi %hi(do_dcpe_tl1), %g3
124 jmpl %g3 + %lo(do_dcpe_tl1), %g0
125 nop
126 nop
127 nop
128 nop
129 .size cheetah_plus_dcpe_trap_vector_tl1,.-cheetah_plus_dcpe_trap_vector_tl1
130
131 .globl cheetah_plus_icpe_trap_vector
132 .type cheetah_plus_icpe_trap_vector,#function
133cheetah_plus_icpe_trap_vector:
134 membar #Sync
135 sethi %hi(do_cheetah_plus_insn_parity), %g7
136 jmpl %g7 + %lo(do_cheetah_plus_insn_parity), %g0
137 nop
138 nop
139 nop
140 nop
141 nop
142 .size cheetah_plus_icpe_trap_vector,.-cheetah_plus_icpe_trap_vector
143
144 .type do_cheetah_plus_insn_parity,#function
145do_cheetah_plus_insn_parity:
146 rdpr %pil, %g2
147 wrpr %g0, 15, %pil
148 ba,pt %xcc, etrap_irq
149 rd %pc, %g7
150#ifdef CONFIG_TRACE_IRQFLAGS
151 call trace_hardirqs_off
152 nop
153#endif
154 mov 0x1, %o0
155 call cheetah_plus_parity_error
156 add %sp, PTREGS_OFF, %o1
157 ba,a,pt %xcc, rtrap_irq
158 .size do_cheetah_plus_insn_parity,.-do_cheetah_plus_insn_parity
159
160 .globl cheetah_plus_icpe_trap_vector_tl1
161 .type cheetah_plus_icpe_trap_vector_tl1,#function
162cheetah_plus_icpe_trap_vector_tl1:
163 membar #Sync
164 wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
165 sethi %hi(do_icpe_tl1), %g3
166 jmpl %g3 + %lo(do_icpe_tl1), %g0
167 nop
168 nop
169 nop
170 nop
171 .size cheetah_plus_icpe_trap_vector_tl1,.-cheetah_plus_icpe_trap_vector_tl1
172
173 /* If we take one of these traps when tl >= 1, then we
174 * jump to interrupt globals. If some trap level above us
175 * was also using interrupt globals, we cannot recover.
176 * We may use all interrupt global registers except %g6.
177 */
178 .globl do_dcpe_tl1
179 .type do_dcpe_tl1,#function
180do_dcpe_tl1:
181 rdpr %tl, %g1 ! Save original trap level
182 mov 1, %g2 ! Setup TSTATE checking loop
183 sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
1841: wrpr %g2, %tl ! Set trap level to check
185 rdpr %tstate, %g4 ! Read TSTATE for this level
186 andcc %g4, %g3, %g0 ! Interrupt globals in use?
187 bne,a,pn %xcc, do_dcpe_tl1_fatal ! Yep, irrecoverable
188 wrpr %g1, %tl ! Restore original trap level
189 add %g2, 1, %g2 ! Next trap level
190 cmp %g2, %g1 ! Hit them all yet?
191 ble,pt %icc, 1b ! Not yet
192 nop
193 wrpr %g1, %tl ! Restore original trap level
194do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
195 sethi %hi(dcache_parity_tl1_occurred), %g2
196 lduw [%g2 + %lo(dcache_parity_tl1_occurred)], %g1
197 add %g1, 1, %g1
198 stw %g1, [%g2 + %lo(dcache_parity_tl1_occurred)]
199 /* Reset D-cache parity */
200 sethi %hi(1 << 16), %g1 ! D-cache size
201 mov (1 << 5), %g2 ! D-cache line size
202 sub %g1, %g2, %g1 ! Move down 1 cacheline
2031: srl %g1, 14, %g3 ! Compute UTAG
204 membar #Sync
205 stxa %g3, [%g1] ASI_DCACHE_UTAG
206 membar #Sync
207 sub %g2, 8, %g3 ! 64-bit data word within line
2082: membar #Sync
209 stxa %g0, [%g1 + %g3] ASI_DCACHE_DATA
210 membar #Sync
211 subcc %g3, 8, %g3 ! Next 64-bit data word
212 bge,pt %icc, 2b
213 nop
214 subcc %g1, %g2, %g1 ! Next cacheline
215 bge,pt %icc, 1b
216 nop
217 ba,pt %xcc, dcpe_icpe_tl1_common
218 nop
219
220do_dcpe_tl1_fatal:
221 sethi %hi(1f), %g7
222 ba,pt %xcc, etraptl1
2231: or %g7, %lo(1b), %g7
224 mov 0x2, %o0
225 call cheetah_plus_parity_error
226 add %sp, PTREGS_OFF, %o1
227 ba,pt %xcc, rtrap
228 nop
229 .size do_dcpe_tl1,.-do_dcpe_tl1
230
231 .globl do_icpe_tl1
232 .type do_icpe_tl1,#function
233do_icpe_tl1:
234 rdpr %tl, %g1 ! Save original trap level
235 mov 1, %g2 ! Setup TSTATE checking loop
236 sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
2371: wrpr %g2, %tl ! Set trap level to check
238 rdpr %tstate, %g4 ! Read TSTATE for this level
239 andcc %g4, %g3, %g0 ! Interrupt globals in use?
240 bne,a,pn %xcc, do_icpe_tl1_fatal ! Yep, irrecoverable
241 wrpr %g1, %tl ! Restore original trap level
242 add %g2, 1, %g2 ! Next trap level
243 cmp %g2, %g1 ! Hit them all yet?
244 ble,pt %icc, 1b ! Not yet
245 nop
246 wrpr %g1, %tl ! Restore original trap level
247do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
248 sethi %hi(icache_parity_tl1_occurred), %g2
249 lduw [%g2 + %lo(icache_parity_tl1_occurred)], %g1
250 add %g1, 1, %g1
251 stw %g1, [%g2 + %lo(icache_parity_tl1_occurred)]
252 /* Flush I-cache */
253 sethi %hi(1 << 15), %g1 ! I-cache size
254 mov (1 << 5), %g2 ! I-cache line size
255 sub %g1, %g2, %g1
2561: or %g1, (2 << 3), %g3
257 stxa %g0, [%g3] ASI_IC_TAG
258 membar #Sync
259 subcc %g1, %g2, %g1
260 bge,pt %icc, 1b
261 nop
262 ba,pt %xcc, dcpe_icpe_tl1_common
263 nop
264
265do_icpe_tl1_fatal:
266 sethi %hi(1f), %g7
267 ba,pt %xcc, etraptl1
2681: or %g7, %lo(1b), %g7
269 mov 0x3, %o0
270 call cheetah_plus_parity_error
271 add %sp, PTREGS_OFF, %o1
272 ba,pt %xcc, rtrap
273 nop
274 .size do_icpe_tl1,.-do_icpe_tl1
275
276 .type dcpe_icpe_tl1_common,#function
277dcpe_icpe_tl1_common:
278 /* Flush D-cache, re-enable D/I caches in DCU and finally
279 * retry the trapping instruction.
280 */
281 sethi %hi(1 << 16), %g1 ! D-cache size
282 mov (1 << 5), %g2 ! D-cache line size
283 sub %g1, %g2, %g1
2841: stxa %g0, [%g1] ASI_DCACHE_TAG
285 membar #Sync
286 subcc %g1, %g2, %g1
287 bge,pt %icc, 1b
288 nop
289 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
290 or %g1, (DCU_DC | DCU_IC), %g1
291 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
292 membar #Sync
293 retry
294 .size dcpe_icpe_tl1_common,.-dcpe_icpe_tl1_common
295
296 /* Capture I/D/E-cache state into per-cpu error scoreboard.
297 *
298 * %g1: (TL>=0) ? 1 : 0
299 * %g2: scratch
300 * %g3: scratch
301 * %g4: AFSR
302 * %g5: AFAR
303 * %g6: unused, will have current thread ptr after etrap
304 * %g7: scratch
305 */
306 .type __cheetah_log_error,#function
307__cheetah_log_error:
308 /* Put "TL1" software bit into AFSR. */
309 and %g1, 0x1, %g1
310 sllx %g1, 63, %g2
311 or %g4, %g2, %g4
312
313 /* Get log entry pointer for this cpu at this trap level. */
314 BRANCH_IF_JALAPENO(g2,g3,50f)
315 ldxa [%g0] ASI_SAFARI_CONFIG, %g2
316 srlx %g2, 17, %g2
317 ba,pt %xcc, 60f
318 and %g2, 0x3ff, %g2
319
32050: ldxa [%g0] ASI_JBUS_CONFIG, %g2
321 srlx %g2, 17, %g2
322 and %g2, 0x1f, %g2
323
32460: sllx %g2, 9, %g2
325 sethi %hi(cheetah_error_log), %g3
326 ldx [%g3 + %lo(cheetah_error_log)], %g3
327 brz,pn %g3, 80f
328 nop
329
330 add %g3, %g2, %g3
331 sllx %g1, 8, %g1
332 add %g3, %g1, %g1
333
334 /* %g1 holds pointer to the top of the logging scoreboard */
335 ldx [%g1 + 0x0], %g7
336 cmp %g7, -1
337 bne,pn %xcc, 80f
338 nop
339
340 stx %g4, [%g1 + 0x0]
341 stx %g5, [%g1 + 0x8]
342 add %g1, 0x10, %g1
343
344 /* %g1 now points to D-cache logging area */
345 set 0x3ff8, %g2 /* DC_addr mask */
346 and %g5, %g2, %g2 /* DC_addr bits of AFAR */
347 srlx %g5, 12, %g3
348 or %g3, 1, %g3 /* PHYS tag + valid */
349
35010: ldxa [%g2] ASI_DCACHE_TAG, %g7
351 cmp %g3, %g7 /* TAG match? */
352 bne,pt %xcc, 13f
353 nop
354
355 /* Yep, what we want, capture state. */
356 stx %g2, [%g1 + 0x20]
357 stx %g7, [%g1 + 0x28]
358
359 /* A membar Sync is required before and after utag access. */
360 membar #Sync
361 ldxa [%g2] ASI_DCACHE_UTAG, %g7
362 membar #Sync
363 stx %g7, [%g1 + 0x30]
364 ldxa [%g2] ASI_DCACHE_SNOOP_TAG, %g7
365 stx %g7, [%g1 + 0x38]
366 clr %g3
367
36812: ldxa [%g2 + %g3] ASI_DCACHE_DATA, %g7
369 stx %g7, [%g1]
370 add %g3, (1 << 5), %g3
371 cmp %g3, (4 << 5)
372 bl,pt %xcc, 12b
373 add %g1, 0x8, %g1
374
375 ba,pt %xcc, 20f
376 add %g1, 0x20, %g1
377
37813: sethi %hi(1 << 14), %g7
379 add %g2, %g7, %g2
380 srlx %g2, 14, %g7
381 cmp %g7, 4
382 bl,pt %xcc, 10b
383 nop
384
385 add %g1, 0x40, %g1
386
387 /* %g1 now points to I-cache logging area */
38820: set 0x1fe0, %g2 /* IC_addr mask */
389 and %g5, %g2, %g2 /* IC_addr bits of AFAR */
390 sllx %g2, 1, %g2 /* IC_addr[13:6]==VA[12:5] */
391 srlx %g5, (13 - 8), %g3 /* Make PTAG */
392 andn %g3, 0xff, %g3 /* Mask off undefined bits */
393
39421: ldxa [%g2] ASI_IC_TAG, %g7
395 andn %g7, 0xff, %g7
396 cmp %g3, %g7
397 bne,pt %xcc, 23f
398 nop
399
400 /* Yep, what we want, capture state. */
401 stx %g2, [%g1 + 0x40]
402 stx %g7, [%g1 + 0x48]
403 add %g2, (1 << 3), %g2
404 ldxa [%g2] ASI_IC_TAG, %g7
405 add %g2, (1 << 3), %g2
406 stx %g7, [%g1 + 0x50]
407 ldxa [%g2] ASI_IC_TAG, %g7
408 add %g2, (1 << 3), %g2
409 stx %g7, [%g1 + 0x60]
410 ldxa [%g2] ASI_IC_TAG, %g7
411 stx %g7, [%g1 + 0x68]
412 sub %g2, (3 << 3), %g2
413 ldxa [%g2] ASI_IC_STAG, %g7
414 stx %g7, [%g1 + 0x58]
415 clr %g3
416 srlx %g2, 2, %g2
417
41822: ldxa [%g2 + %g3] ASI_IC_INSTR, %g7
419 stx %g7, [%g1]
420 add %g3, (1 << 3), %g3
421 cmp %g3, (8 << 3)
422 bl,pt %xcc, 22b
423 add %g1, 0x8, %g1
424
425 ba,pt %xcc, 30f
426 add %g1, 0x30, %g1
427
42823: sethi %hi(1 << 14), %g7
429 add %g2, %g7, %g2
430 srlx %g2, 14, %g7
431 cmp %g7, 4
432 bl,pt %xcc, 21b
433 nop
434
435 add %g1, 0x70, %g1
436
437 /* %g1 now points to E-cache logging area */
43830: andn %g5, (32 - 1), %g2
439 stx %g2, [%g1 + 0x20]
440 ldxa [%g2] ASI_EC_TAG_DATA, %g7
441 stx %g7, [%g1 + 0x28]
442 ldxa [%g2] ASI_EC_R, %g0
443 clr %g3
444
44531: ldxa [%g3] ASI_EC_DATA, %g7
446 stx %g7, [%g1 + %g3]
447 add %g3, 0x8, %g3
448 cmp %g3, 0x20
449
450 bl,pt %xcc, 31b
451 nop
45280:
453 rdpr %tt, %g2
454 cmp %g2, 0x70
455 be c_fast_ecc
456 cmp %g2, 0x63
457 be c_cee
458 nop
459 ba,pt %xcc, c_deferred
460 .size __cheetah_log_error,.-__cheetah_log_error
461
462 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
463 * in the trap table. That code has done a memory barrier
464 * and has disabled both the I-cache and D-cache in the DCU
465 * control register. The I-cache is disabled so that we may
466 * capture the corrupted cache line, and the D-cache is disabled
467 * because corrupt data may have been placed there and we don't
468 * want to reference it.
469 *
470 * %g1 is one if this trap occurred at %tl >= 1.
471 *
472 * Next, we turn off error reporting so that we don't recurse.
473 */
474 .globl cheetah_fast_ecc
475 .type cheetah_fast_ecc,#function
476cheetah_fast_ecc:
477 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
478 andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
479 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
480 membar #Sync
481
482 /* Fetch and clear AFSR/AFAR */
483 ldxa [%g0] ASI_AFSR, %g4
484 ldxa [%g0] ASI_AFAR, %g5
485 stxa %g4, [%g0] ASI_AFSR
486 membar #Sync
487
488 ba,pt %xcc, __cheetah_log_error
489 nop
490 .size cheetah_fast_ecc,.-cheetah_fast_ecc
491
492 .type c_fast_ecc,#function
493c_fast_ecc:
494 rdpr %pil, %g2
495 wrpr %g0, 15, %pil
496 ba,pt %xcc, etrap_irq
497 rd %pc, %g7
498#ifdef CONFIG_TRACE_IRQFLAGS
499 call trace_hardirqs_off
500 nop
501#endif
502 mov %l4, %o1
503 mov %l5, %o2
504 call cheetah_fecc_handler
505 add %sp, PTREGS_OFF, %o0
506 ba,a,pt %xcc, rtrap_irq
507 .size c_fast_ecc,.-c_fast_ecc
508
509 /* Our caller has disabled I-cache and performed membar Sync. */
510 .globl cheetah_cee
511 .type cheetah_cee,#function
512cheetah_cee:
513 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
514 andn %g2, ESTATE_ERROR_CEEN, %g2
515 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
516 membar #Sync
517
518 /* Fetch and clear AFSR/AFAR */
519 ldxa [%g0] ASI_AFSR, %g4
520 ldxa [%g0] ASI_AFAR, %g5
521 stxa %g4, [%g0] ASI_AFSR
522 membar #Sync
523
524 ba,pt %xcc, __cheetah_log_error
525 nop
526 .size cheetah_cee,.-cheetah_cee
527
528 .type c_cee,#function
529c_cee:
530 rdpr %pil, %g2
531 wrpr %g0, 15, %pil
532 ba,pt %xcc, etrap_irq
533 rd %pc, %g7
534#ifdef CONFIG_TRACE_IRQFLAGS
535 call trace_hardirqs_off
536 nop
537#endif
538 mov %l4, %o1
539 mov %l5, %o2
540 call cheetah_cee_handler
541 add %sp, PTREGS_OFF, %o0
542 ba,a,pt %xcc, rtrap_irq
543 .size c_cee,.-c_cee
544
545 /* Our caller has disabled I-cache+D-cache and performed membar Sync. */
546 .globl cheetah_deferred_trap
547 .type cheetah_deferred_trap,#function
548cheetah_deferred_trap:
549 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
550 andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
551 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
552 membar #Sync
553
554 /* Fetch and clear AFSR/AFAR */
555 ldxa [%g0] ASI_AFSR, %g4
556 ldxa [%g0] ASI_AFAR, %g5
557 stxa %g4, [%g0] ASI_AFSR
558 membar #Sync
559
560 ba,pt %xcc, __cheetah_log_error
561 nop
562 .size cheetah_deferred_trap,.-cheetah_deferred_trap
563
564 .type c_deferred,#function
565c_deferred:
566 rdpr %pil, %g2
567 wrpr %g0, 15, %pil
568 ba,pt %xcc, etrap_irq
569 rd %pc, %g7
570#ifdef CONFIG_TRACE_IRQFLAGS
571 call trace_hardirqs_off
572 nop
573#endif
574 mov %l4, %o1
575 mov %l5, %o2
576 call cheetah_deferred_handler
577 add %sp, PTREGS_OFF, %o0
578 ba,a,pt %xcc, rtrap_irq
579 .size c_deferred,.-c_deferred
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
deleted file mode 100644
index fd06e937ae1e..000000000000
--- a/arch/sparc64/kernel/entry.S
+++ /dev/null
@@ -1,2575 +0,0 @@
1/* $Id: entry.S,v 1.144 2002/02/09 19:49:30 davem Exp $
2 * arch/sparc64/kernel/entry.S: Sparc64 trap low-level entry points.
3 *
4 * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
7 * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
8 */
9
10#include <linux/errno.h>
11
12#include <asm/head.h>
13#include <asm/asi.h>
14#include <asm/smp.h>
15#include <asm/ptrace.h>
16#include <asm/page.h>
17#include <asm/signal.h>
18#include <asm/pgtable.h>
19#include <asm/processor.h>
20#include <asm/visasm.h>
21#include <asm/estate.h>
22#include <asm/auxio.h>
23#include <asm/sfafsr.h>
24#include <asm/pil.h>
25#include <asm/unistd.h>
26
27#define curptr g6
28
29 .text
30 .align 32
31
32 /* This is trivial with the new code... */
33 .globl do_fpdis
34do_fpdis:
35 sethi %hi(TSTATE_PEF), %g4
36 rdpr %tstate, %g5
37 andcc %g5, %g4, %g0
38 be,pt %xcc, 1f
39 nop
40 rd %fprs, %g5
41 andcc %g5, FPRS_FEF, %g0
42 be,pt %xcc, 1f
43 nop
44
45 /* Legal state when DCR_IFPOE is set in Cheetah %dcr. */
46 sethi %hi(109f), %g7
47 ba,pt %xcc, etrap
48109: or %g7, %lo(109b), %g7
49 add %g0, %g0, %g0
50 ba,a,pt %xcc, rtrap
51
521: TRAP_LOAD_THREAD_REG(%g6, %g1)
53 ldub [%g6 + TI_FPSAVED], %g5
54 wr %g0, FPRS_FEF, %fprs
55 andcc %g5, FPRS_FEF, %g0
56 be,a,pt %icc, 1f
57 clr %g7
58 ldx [%g6 + TI_GSR], %g7
591: andcc %g5, FPRS_DL, %g0
60 bne,pn %icc, 2f
61 fzero %f0
62 andcc %g5, FPRS_DU, %g0
63 bne,pn %icc, 1f
64 fzero %f2
65 faddd %f0, %f2, %f4
66 fmuld %f0, %f2, %f6
67 faddd %f0, %f2, %f8
68 fmuld %f0, %f2, %f10
69 faddd %f0, %f2, %f12
70 fmuld %f0, %f2, %f14
71 faddd %f0, %f2, %f16
72 fmuld %f0, %f2, %f18
73 faddd %f0, %f2, %f20
74 fmuld %f0, %f2, %f22
75 faddd %f0, %f2, %f24
76 fmuld %f0, %f2, %f26
77 faddd %f0, %f2, %f28
78 fmuld %f0, %f2, %f30
79 faddd %f0, %f2, %f32
80 fmuld %f0, %f2, %f34
81 faddd %f0, %f2, %f36
82 fmuld %f0, %f2, %f38
83 faddd %f0, %f2, %f40
84 fmuld %f0, %f2, %f42
85 faddd %f0, %f2, %f44
86 fmuld %f0, %f2, %f46
87 faddd %f0, %f2, %f48
88 fmuld %f0, %f2, %f50
89 faddd %f0, %f2, %f52
90 fmuld %f0, %f2, %f54
91 faddd %f0, %f2, %f56
92 fmuld %f0, %f2, %f58
93 b,pt %xcc, fpdis_exit2
94 faddd %f0, %f2, %f60
951: mov SECONDARY_CONTEXT, %g3
96 add %g6, TI_FPREGS + 0x80, %g1
97 faddd %f0, %f2, %f4
98 fmuld %f0, %f2, %f6
99
100661: ldxa [%g3] ASI_DMMU, %g5
101 .section .sun4v_1insn_patch, "ax"
102 .word 661b
103 ldxa [%g3] ASI_MMU, %g5
104 .previous
105
106 sethi %hi(sparc64_kern_sec_context), %g2
107 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
108
109661: stxa %g2, [%g3] ASI_DMMU
110 .section .sun4v_1insn_patch, "ax"
111 .word 661b
112 stxa %g2, [%g3] ASI_MMU
113 .previous
114
115 membar #Sync
116 add %g6, TI_FPREGS + 0xc0, %g2
117 faddd %f0, %f2, %f8
118 fmuld %f0, %f2, %f10
119 membar #Sync
120 ldda [%g1] ASI_BLK_S, %f32
121 ldda [%g2] ASI_BLK_S, %f48
122 membar #Sync
123 faddd %f0, %f2, %f12
124 fmuld %f0, %f2, %f14
125 faddd %f0, %f2, %f16
126 fmuld %f0, %f2, %f18
127 faddd %f0, %f2, %f20
128 fmuld %f0, %f2, %f22
129 faddd %f0, %f2, %f24
130 fmuld %f0, %f2, %f26
131 faddd %f0, %f2, %f28
132 fmuld %f0, %f2, %f30
133 b,pt %xcc, fpdis_exit
134 nop
1352: andcc %g5, FPRS_DU, %g0
136 bne,pt %icc, 3f
137 fzero %f32
138 mov SECONDARY_CONTEXT, %g3
139 fzero %f34
140
141661: ldxa [%g3] ASI_DMMU, %g5
142 .section .sun4v_1insn_patch, "ax"
143 .word 661b
144 ldxa [%g3] ASI_MMU, %g5
145 .previous
146
147 add %g6, TI_FPREGS, %g1
148 sethi %hi(sparc64_kern_sec_context), %g2
149 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
150
151661: stxa %g2, [%g3] ASI_DMMU
152 .section .sun4v_1insn_patch, "ax"
153 .word 661b
154 stxa %g2, [%g3] ASI_MMU
155 .previous
156
157 membar #Sync
158 add %g6, TI_FPREGS + 0x40, %g2
159 faddd %f32, %f34, %f36
160 fmuld %f32, %f34, %f38
161 membar #Sync
162 ldda [%g1] ASI_BLK_S, %f0
163 ldda [%g2] ASI_BLK_S, %f16
164 membar #Sync
165 faddd %f32, %f34, %f40
166 fmuld %f32, %f34, %f42
167 faddd %f32, %f34, %f44
168 fmuld %f32, %f34, %f46
169 faddd %f32, %f34, %f48
170 fmuld %f32, %f34, %f50
171 faddd %f32, %f34, %f52
172 fmuld %f32, %f34, %f54
173 faddd %f32, %f34, %f56
174 fmuld %f32, %f34, %f58
175 faddd %f32, %f34, %f60
176 fmuld %f32, %f34, %f62
177 ba,pt %xcc, fpdis_exit
178 nop
1793: mov SECONDARY_CONTEXT, %g3
180 add %g6, TI_FPREGS, %g1
181
182661: ldxa [%g3] ASI_DMMU, %g5
183 .section .sun4v_1insn_patch, "ax"
184 .word 661b
185 ldxa [%g3] ASI_MMU, %g5
186 .previous
187
188 sethi %hi(sparc64_kern_sec_context), %g2
189 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
190
191661: stxa %g2, [%g3] ASI_DMMU
192 .section .sun4v_1insn_patch, "ax"
193 .word 661b
194 stxa %g2, [%g3] ASI_MMU
195 .previous
196
197 membar #Sync
198 mov 0x40, %g2
199 membar #Sync
200 ldda [%g1] ASI_BLK_S, %f0
201 ldda [%g1 + %g2] ASI_BLK_S, %f16
202 add %g1, 0x80, %g1
203 ldda [%g1] ASI_BLK_S, %f32
204 ldda [%g1 + %g2] ASI_BLK_S, %f48
205 membar #Sync
206fpdis_exit:
207
208661: stxa %g5, [%g3] ASI_DMMU
209 .section .sun4v_1insn_patch, "ax"
210 .word 661b
211 stxa %g5, [%g3] ASI_MMU
212 .previous
213
214 membar #Sync
215fpdis_exit2:
216 wr %g7, 0, %gsr
217 ldx [%g6 + TI_XFSR], %fsr
218 rdpr %tstate, %g3
219 or %g3, %g4, %g3 ! anal...
220 wrpr %g3, %tstate
221 wr %g0, FPRS_FEF, %fprs ! clean DU/DL bits
222 retry
223
224 .align 32
225fp_other_bounce:
226 call do_fpother
227 add %sp, PTREGS_OFF, %o0
228 ba,pt %xcc, rtrap
229 nop
230
231 .globl do_fpother_check_fitos
232 .align 32
233do_fpother_check_fitos:
234 TRAP_LOAD_THREAD_REG(%g6, %g1)
235 sethi %hi(fp_other_bounce - 4), %g7
236 or %g7, %lo(fp_other_bounce - 4), %g7
237
238 /* NOTE: Need to preserve %g7 until we fully commit
239 * to the fitos fixup.
240 */
241 stx %fsr, [%g6 + TI_XFSR]
242 rdpr %tstate, %g3
243 andcc %g3, TSTATE_PRIV, %g0
244 bne,pn %xcc, do_fptrap_after_fsr
245 nop
246 ldx [%g6 + TI_XFSR], %g3
247 srlx %g3, 14, %g1
248 and %g1, 7, %g1
249 cmp %g1, 2 ! Unfinished FP-OP
250 bne,pn %xcc, do_fptrap_after_fsr
251 sethi %hi(1 << 23), %g1 ! Inexact
252 andcc %g3, %g1, %g0
253 bne,pn %xcc, do_fptrap_after_fsr
254 rdpr %tpc, %g1
255 lduwa [%g1] ASI_AIUP, %g3 ! This cannot ever fail
256#define FITOS_MASK 0xc1f83fe0
257#define FITOS_COMPARE 0x81a01880
258 sethi %hi(FITOS_MASK), %g1
259 or %g1, %lo(FITOS_MASK), %g1
260 and %g3, %g1, %g1
261 sethi %hi(FITOS_COMPARE), %g2
262 or %g2, %lo(FITOS_COMPARE), %g2
263 cmp %g1, %g2
264 bne,pn %xcc, do_fptrap_after_fsr
265 nop
266 std %f62, [%g6 + TI_FPREGS + (62 * 4)]
267 sethi %hi(fitos_table_1), %g1
268 and %g3, 0x1f, %g2
269 or %g1, %lo(fitos_table_1), %g1
270 sllx %g2, 2, %g2
271 jmpl %g1 + %g2, %g0
272 ba,pt %xcc, fitos_emul_continue
273
274fitos_table_1:
275 fitod %f0, %f62
276 fitod %f1, %f62
277 fitod %f2, %f62
278 fitod %f3, %f62
279 fitod %f4, %f62
280 fitod %f5, %f62
281 fitod %f6, %f62
282 fitod %f7, %f62
283 fitod %f8, %f62
284 fitod %f9, %f62
285 fitod %f10, %f62
286 fitod %f11, %f62
287 fitod %f12, %f62
288 fitod %f13, %f62
289 fitod %f14, %f62
290 fitod %f15, %f62
291 fitod %f16, %f62
292 fitod %f17, %f62
293 fitod %f18, %f62
294 fitod %f19, %f62
295 fitod %f20, %f62
296 fitod %f21, %f62
297 fitod %f22, %f62
298 fitod %f23, %f62
299 fitod %f24, %f62
300 fitod %f25, %f62
301 fitod %f26, %f62
302 fitod %f27, %f62
303 fitod %f28, %f62
304 fitod %f29, %f62
305 fitod %f30, %f62
306 fitod %f31, %f62
307
308fitos_emul_continue:
309 sethi %hi(fitos_table_2), %g1
310 srl %g3, 25, %g2
311 or %g1, %lo(fitos_table_2), %g1
312 and %g2, 0x1f, %g2
313 sllx %g2, 2, %g2
314 jmpl %g1 + %g2, %g0
315 ba,pt %xcc, fitos_emul_fini
316
317fitos_table_2:
318 fdtos %f62, %f0
319 fdtos %f62, %f1
320 fdtos %f62, %f2
321 fdtos %f62, %f3
322 fdtos %f62, %f4
323 fdtos %f62, %f5
324 fdtos %f62, %f6
325 fdtos %f62, %f7
326 fdtos %f62, %f8
327 fdtos %f62, %f9
328 fdtos %f62, %f10
329 fdtos %f62, %f11
330 fdtos %f62, %f12
331 fdtos %f62, %f13
332 fdtos %f62, %f14
333 fdtos %f62, %f15
334 fdtos %f62, %f16
335 fdtos %f62, %f17
336 fdtos %f62, %f18
337 fdtos %f62, %f19
338 fdtos %f62, %f20
339 fdtos %f62, %f21
340 fdtos %f62, %f22
341 fdtos %f62, %f23
342 fdtos %f62, %f24
343 fdtos %f62, %f25
344 fdtos %f62, %f26
345 fdtos %f62, %f27
346 fdtos %f62, %f28
347 fdtos %f62, %f29
348 fdtos %f62, %f30
349 fdtos %f62, %f31
350
351fitos_emul_fini:
352 ldd [%g6 + TI_FPREGS + (62 * 4)], %f62
353 done
354
355 .globl do_fptrap
356 .align 32
357do_fptrap:
358 TRAP_LOAD_THREAD_REG(%g6, %g1)
359 stx %fsr, [%g6 + TI_XFSR]
360do_fptrap_after_fsr:
361 ldub [%g6 + TI_FPSAVED], %g3
362 rd %fprs, %g1
363 or %g3, %g1, %g3
364 stb %g3, [%g6 + TI_FPSAVED]
365 rd %gsr, %g3
366 stx %g3, [%g6 + TI_GSR]
367 mov SECONDARY_CONTEXT, %g3
368
369661: ldxa [%g3] ASI_DMMU, %g5
370 .section .sun4v_1insn_patch, "ax"
371 .word 661b
372 ldxa [%g3] ASI_MMU, %g5
373 .previous
374
375 sethi %hi(sparc64_kern_sec_context), %g2
376 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
377
378661: stxa %g2, [%g3] ASI_DMMU
379 .section .sun4v_1insn_patch, "ax"
380 .word 661b
381 stxa %g2, [%g3] ASI_MMU
382 .previous
383
384 membar #Sync
385 add %g6, TI_FPREGS, %g2
386 andcc %g1, FPRS_DL, %g0
387 be,pn %icc, 4f
388 mov 0x40, %g3
389 stda %f0, [%g2] ASI_BLK_S
390 stda %f16, [%g2 + %g3] ASI_BLK_S
391 andcc %g1, FPRS_DU, %g0
392 be,pn %icc, 5f
3934: add %g2, 128, %g2
394 stda %f32, [%g2] ASI_BLK_S
395 stda %f48, [%g2 + %g3] ASI_BLK_S
3965: mov SECONDARY_CONTEXT, %g1
397 membar #Sync
398
399661: stxa %g5, [%g1] ASI_DMMU
400 .section .sun4v_1insn_patch, "ax"
401 .word 661b
402 stxa %g5, [%g1] ASI_MMU
403 .previous
404
405 membar #Sync
406 ba,pt %xcc, etrap
407 wr %g0, 0, %fprs
408
409 /* The registers for cross calls will be:
410 *
411 * DATA 0: [low 32-bits] Address of function to call, jmp to this
412 * [high 32-bits] MMU Context Argument 0, place in %g5
413 * DATA 1: Address Argument 1, place in %g1
414 * DATA 2: Address Argument 2, place in %g7
415 *
416 * With this method we can do most of the cross-call tlb/cache
417 * flushing very quickly.
418 */
419 .text
420 .align 32
421 .globl do_ivec
422do_ivec:
423 mov 0x40, %g3
424 ldxa [%g3 + %g0] ASI_INTR_R, %g3
425 sethi %hi(KERNBASE), %g4
426 cmp %g3, %g4
427 bgeu,pn %xcc, do_ivec_xcall
428 srlx %g3, 32, %g5
429 stxa %g0, [%g0] ASI_INTR_RECEIVE
430 membar #Sync
431
432 sethi %hi(ivector_table_pa), %g2
433 ldx [%g2 + %lo(ivector_table_pa)], %g2
434 sllx %g3, 4, %g3
435 add %g2, %g3, %g3
436
437 TRAP_LOAD_IRQ_WORK_PA(%g6, %g1)
438
439 ldx [%g6], %g5
440 stxa %g5, [%g3] ASI_PHYS_USE_EC
441 stx %g3, [%g6]
442 wr %g0, 1 << PIL_DEVICE_IRQ, %set_softint
443 retry
444do_ivec_xcall:
445 mov 0x50, %g1
446 ldxa [%g1 + %g0] ASI_INTR_R, %g1
447 srl %g3, 0, %g3
448
449 mov 0x60, %g7
450 ldxa [%g7 + %g0] ASI_INTR_R, %g7
451 stxa %g0, [%g0] ASI_INTR_RECEIVE
452 membar #Sync
453 ba,pt %xcc, 1f
454 nop
455
456 .align 32
4571: jmpl %g3, %g0
458 nop
459
460 .globl getcc, setcc
461getcc:
462 ldx [%o0 + PT_V9_TSTATE], %o1
463 srlx %o1, 32, %o1
464 and %o1, 0xf, %o1
465 retl
466 stx %o1, [%o0 + PT_V9_G1]
467setcc:
468 ldx [%o0 + PT_V9_TSTATE], %o1
469 ldx [%o0 + PT_V9_G1], %o2
470 or %g0, %ulo(TSTATE_ICC), %o3
471 sllx %o3, 32, %o3
472 andn %o1, %o3, %o1
473 sllx %o2, 32, %o2
474 and %o2, %o3, %o2
475 or %o1, %o2, %o1
476 retl
477 stx %o1, [%o0 + PT_V9_TSTATE]
478
479 .globl utrap_trap
480utrap_trap: /* %g3=handler,%g4=level */
481 TRAP_LOAD_THREAD_REG(%g6, %g1)
482 ldx [%g6 + TI_UTRAPS], %g1
483 brnz,pt %g1, invoke_utrap
484 nop
485
486 ba,pt %xcc, etrap
487 rd %pc, %g7
488 mov %l4, %o1
489 call bad_trap
490 add %sp, PTREGS_OFF, %o0
491 ba,pt %xcc, rtrap
492 nop
493
494invoke_utrap:
495 sllx %g3, 3, %g3
496 ldx [%g1 + %g3], %g1
497 save %sp, -128, %sp
498 rdpr %tstate, %l6
499 rdpr %cwp, %l7
500 andn %l6, TSTATE_CWP, %l6
501 wrpr %l6, %l7, %tstate
502 rdpr %tpc, %l6
503 rdpr %tnpc, %l7
504 wrpr %g1, 0, %tnpc
505 done
506
507 /* We need to carefully read the error status, ACK
508 * the errors, prevent recursive traps, and pass the
509 * information on to C code for logging.
510 *
511 * We pass the AFAR in as-is, and we encode the status
512 * information as described in asm-sparc64/sfafsr.h
513 */
514 .globl __spitfire_access_error
515__spitfire_access_error:
516 /* Disable ESTATE error reporting so that we do not
517 * take recursive traps and RED state the processor.
518 */
519 stxa %g0, [%g0] ASI_ESTATE_ERROR_EN
520 membar #Sync
521
522 mov UDBE_UE, %g1
523 ldxa [%g0] ASI_AFSR, %g4 ! Get AFSR
524
525 /* __spitfire_cee_trap branches here with AFSR in %g4 and
526 * UDBE_CE in %g1. It only clears ESTATE_ERR_CE in the
527 * ESTATE Error Enable register.
528 */
529__spitfire_cee_trap_continue:
530 ldxa [%g0] ASI_AFAR, %g5 ! Get AFAR
531
532 rdpr %tt, %g3
533 and %g3, 0x1ff, %g3 ! Paranoia
534 sllx %g3, SFSTAT_TRAP_TYPE_SHIFT, %g3
535 or %g4, %g3, %g4
536 rdpr %tl, %g3
537 cmp %g3, 1
538 mov 1, %g3
539 bleu %xcc, 1f
540 sllx %g3, SFSTAT_TL_GT_ONE_SHIFT, %g3
541
542 or %g4, %g3, %g4
543
544 /* Read in the UDB error register state, clearing the
545 * sticky error bits as-needed. We only clear them if
546 * the UE bit is set. Likewise, __spitfire_cee_trap
547 * below will only do so if the CE bit is set.
548 *
549 * NOTE: UltraSparc-I/II have high and low UDB error
550 * registers, corresponding to the two UDB units
551 * present on those chips. UltraSparc-IIi only
552 * has a single UDB, called "SDB" in the manual.
553 * For IIi the upper UDB register always reads
554 * as zero so for our purposes things will just
555 * work with the checks below.
556 */
5571: ldxa [%g0] ASI_UDBH_ERROR_R, %g3
558 and %g3, 0x3ff, %g7 ! Paranoia
559 sllx %g7, SFSTAT_UDBH_SHIFT, %g7
560 or %g4, %g7, %g4
561 andcc %g3, %g1, %g3 ! UDBE_UE or UDBE_CE
562 be,pn %xcc, 1f
563 nop
564 stxa %g3, [%g0] ASI_UDB_ERROR_W
565 membar #Sync
566
5671: mov 0x18, %g3
568 ldxa [%g3] ASI_UDBL_ERROR_R, %g3
569 and %g3, 0x3ff, %g7 ! Paranoia
570 sllx %g7, SFSTAT_UDBL_SHIFT, %g7
571 or %g4, %g7, %g4
572 andcc %g3, %g1, %g3 ! UDBE_UE or UDBE_CE
573 be,pn %xcc, 1f
574 nop
575 mov 0x18, %g7
576 stxa %g3, [%g7] ASI_UDB_ERROR_W
577 membar #Sync
578
5791: /* Ok, now that we've latched the error state,
580 * clear the sticky bits in the AFSR.
581 */
582 stxa %g4, [%g0] ASI_AFSR
583 membar #Sync
584
585 rdpr %tl, %g2
586 cmp %g2, 1
587 rdpr %pil, %g2
588 bleu,pt %xcc, 1f
589 wrpr %g0, 15, %pil
590
591 ba,pt %xcc, etraptl1
592 rd %pc, %g7
593
594 ba,pt %xcc, 2f
595 nop
596
5971: ba,pt %xcc, etrap_irq
598 rd %pc, %g7
599
6002:
601#ifdef CONFIG_TRACE_IRQFLAGS
602 call trace_hardirqs_off
603 nop
604#endif
605 mov %l4, %o1
606 mov %l5, %o2
607 call spitfire_access_error
608 add %sp, PTREGS_OFF, %o0
609 ba,pt %xcc, rtrap
610 nop
611
612 /* This is the trap handler entry point for ECC correctable
613 * errors. They are corrected, but we listen for the trap
614 * so that the event can be logged.
615 *
616 * Disrupting errors are either:
617 * 1) single-bit ECC errors during UDB reads to system
618 * memory
619 * 2) data parity errors during write-back events
620 *
621 * As far as I can make out from the manual, the CEE trap
622 * is only for correctable errors during memory read
623 * accesses by the front-end of the processor.
624 *
625 * The code below is only for trap level 1 CEE events,
626 * as it is the only situation where we can safely record
627 * and log. For trap level >1 we just clear the CE bit
628 * in the AFSR and return.
629 *
630 * This is just like __spiftire_access_error above, but it
631 * specifically handles correctable errors. If an
632 * uncorrectable error is indicated in the AFSR we
633 * will branch directly above to __spitfire_access_error
634 * to handle it instead. Uncorrectable therefore takes
635 * priority over correctable, and the error logging
636 * C code will notice this case by inspecting the
637 * trap type.
638 */
639 .globl __spitfire_cee_trap
640__spitfire_cee_trap:
641 ldxa [%g0] ASI_AFSR, %g4 ! Get AFSR
642 mov 1, %g3
643 sllx %g3, SFAFSR_UE_SHIFT, %g3
644 andcc %g4, %g3, %g0 ! Check for UE
645 bne,pn %xcc, __spitfire_access_error
646 nop
647
648 /* Ok, in this case we only have a correctable error.
649 * Indicate we only wish to capture that state in register
650 * %g1, and we only disable CE error reporting unlike UE
651 * handling which disables all errors.
652 */
653 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g3
654 andn %g3, ESTATE_ERR_CE, %g3
655 stxa %g3, [%g0] ASI_ESTATE_ERROR_EN
656 membar #Sync
657
658 /* Preserve AFSR in %g4, indicate UDB state to capture in %g1 */
659 ba,pt %xcc, __spitfire_cee_trap_continue
660 mov UDBE_CE, %g1
661
662 .globl __spitfire_data_access_exception
663 .globl __spitfire_data_access_exception_tl1
664__spitfire_data_access_exception_tl1:
665 rdpr %pstate, %g4
666 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
667 mov TLB_SFSR, %g3
668 mov DMMU_SFAR, %g5
669 ldxa [%g3] ASI_DMMU, %g4 ! Get SFSR
670 ldxa [%g5] ASI_DMMU, %g5 ! Get SFAR
671 stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit
672 membar #Sync
673 rdpr %tt, %g3
674 cmp %g3, 0x80 ! first win spill/fill trap
675 blu,pn %xcc, 1f
676 cmp %g3, 0xff ! last win spill/fill trap
677 bgu,pn %xcc, 1f
678 nop
679 ba,pt %xcc, winfix_dax
680 rdpr %tpc, %g3
6811: sethi %hi(109f), %g7
682 ba,pt %xcc, etraptl1
683109: or %g7, %lo(109b), %g7
684 mov %l4, %o1
685 mov %l5, %o2
686 call spitfire_data_access_exception_tl1
687 add %sp, PTREGS_OFF, %o0
688 ba,pt %xcc, rtrap
689 nop
690
691__spitfire_data_access_exception:
692 rdpr %pstate, %g4
693 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
694 mov TLB_SFSR, %g3
695 mov DMMU_SFAR, %g5
696 ldxa [%g3] ASI_DMMU, %g4 ! Get SFSR
697 ldxa [%g5] ASI_DMMU, %g5 ! Get SFAR
698 stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit
699 membar #Sync
700 sethi %hi(109f), %g7
701 ba,pt %xcc, etrap
702109: or %g7, %lo(109b), %g7
703 mov %l4, %o1
704 mov %l5, %o2
705 call spitfire_data_access_exception
706 add %sp, PTREGS_OFF, %o0
707 ba,pt %xcc, rtrap
708 nop
709
710 .globl __spitfire_insn_access_exception
711 .globl __spitfire_insn_access_exception_tl1
712__spitfire_insn_access_exception_tl1:
713 rdpr %pstate, %g4
714 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
715 mov TLB_SFSR, %g3
716 ldxa [%g3] ASI_IMMU, %g4 ! Get SFSR
717 rdpr %tpc, %g5 ! IMMU has no SFAR, use TPC
718 stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit
719 membar #Sync
720 sethi %hi(109f), %g7
721 ba,pt %xcc, etraptl1
722109: or %g7, %lo(109b), %g7
723 mov %l4, %o1
724 mov %l5, %o2
725 call spitfire_insn_access_exception_tl1
726 add %sp, PTREGS_OFF, %o0
727 ba,pt %xcc, rtrap
728 nop
729
730__spitfire_insn_access_exception:
731 rdpr %pstate, %g4
732 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
733 mov TLB_SFSR, %g3
734 ldxa [%g3] ASI_IMMU, %g4 ! Get SFSR
735 rdpr %tpc, %g5 ! IMMU has no SFAR, use TPC
736 stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit
737 membar #Sync
738 sethi %hi(109f), %g7
739 ba,pt %xcc, etrap
740109: or %g7, %lo(109b), %g7
741 mov %l4, %o1
742 mov %l5, %o2
743 call spitfire_insn_access_exception
744 add %sp, PTREGS_OFF, %o0
745 ba,pt %xcc, rtrap
746 nop
747
748 /* These get patched into the trap table at boot time
749 * once we know we have a cheetah processor.
750 */
751 .globl cheetah_fecc_trap_vector, cheetah_fecc_trap_vector_tl1
752cheetah_fecc_trap_vector:
753 membar #Sync
754 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
755 andn %g1, DCU_DC | DCU_IC, %g1
756 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
757 membar #Sync
758 sethi %hi(cheetah_fast_ecc), %g2
759 jmpl %g2 + %lo(cheetah_fast_ecc), %g0
760 mov 0, %g1
761cheetah_fecc_trap_vector_tl1:
762 membar #Sync
763 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
764 andn %g1, DCU_DC | DCU_IC, %g1
765 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
766 membar #Sync
767 sethi %hi(cheetah_fast_ecc), %g2
768 jmpl %g2 + %lo(cheetah_fast_ecc), %g0
769 mov 1, %g1
770 .globl cheetah_cee_trap_vector, cheetah_cee_trap_vector_tl1
771cheetah_cee_trap_vector:
772 membar #Sync
773 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
774 andn %g1, DCU_IC, %g1
775 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
776 membar #Sync
777 sethi %hi(cheetah_cee), %g2
778 jmpl %g2 + %lo(cheetah_cee), %g0
779 mov 0, %g1
780cheetah_cee_trap_vector_tl1:
781 membar #Sync
782 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
783 andn %g1, DCU_IC, %g1
784 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
785 membar #Sync
786 sethi %hi(cheetah_cee), %g2
787 jmpl %g2 + %lo(cheetah_cee), %g0
788 mov 1, %g1
789 .globl cheetah_deferred_trap_vector, cheetah_deferred_trap_vector_tl1
790cheetah_deferred_trap_vector:
791 membar #Sync
792 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
793 andn %g1, DCU_DC | DCU_IC, %g1;
794 stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
795 membar #Sync;
796 sethi %hi(cheetah_deferred_trap), %g2
797 jmpl %g2 + %lo(cheetah_deferred_trap), %g0
798 mov 0, %g1
799cheetah_deferred_trap_vector_tl1:
800 membar #Sync;
801 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
802 andn %g1, DCU_DC | DCU_IC, %g1;
803 stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
804 membar #Sync;
805 sethi %hi(cheetah_deferred_trap), %g2
806 jmpl %g2 + %lo(cheetah_deferred_trap), %g0
807 mov 1, %g1
808
809 /* Cheetah+ specific traps. These are for the new I/D cache parity
810 * error traps. The first argument to cheetah_plus_parity_handler
811 * is encoded as follows:
812 *
813 * Bit0: 0=dcache,1=icache
814 * Bit1: 0=recoverable,1=unrecoverable
815 */
816 .globl cheetah_plus_dcpe_trap_vector, cheetah_plus_dcpe_trap_vector_tl1
817cheetah_plus_dcpe_trap_vector:
818 membar #Sync
819 sethi %hi(do_cheetah_plus_data_parity), %g7
820 jmpl %g7 + %lo(do_cheetah_plus_data_parity), %g0
821 nop
822 nop
823 nop
824 nop
825 nop
826
827do_cheetah_plus_data_parity:
828 rdpr %pil, %g2
829 wrpr %g0, 15, %pil
830 ba,pt %xcc, etrap_irq
831 rd %pc, %g7
832#ifdef CONFIG_TRACE_IRQFLAGS
833 call trace_hardirqs_off
834 nop
835#endif
836 mov 0x0, %o0
837 call cheetah_plus_parity_error
838 add %sp, PTREGS_OFF, %o1
839 ba,a,pt %xcc, rtrap_irq
840
841cheetah_plus_dcpe_trap_vector_tl1:
842 membar #Sync
843 wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
844 sethi %hi(do_dcpe_tl1), %g3
845 jmpl %g3 + %lo(do_dcpe_tl1), %g0
846 nop
847 nop
848 nop
849 nop
850
851 .globl cheetah_plus_icpe_trap_vector, cheetah_plus_icpe_trap_vector_tl1
852cheetah_plus_icpe_trap_vector:
853 membar #Sync
854 sethi %hi(do_cheetah_plus_insn_parity), %g7
855 jmpl %g7 + %lo(do_cheetah_plus_insn_parity), %g0
856 nop
857 nop
858 nop
859 nop
860 nop
861
862do_cheetah_plus_insn_parity:
863 rdpr %pil, %g2
864 wrpr %g0, 15, %pil
865 ba,pt %xcc, etrap_irq
866 rd %pc, %g7
867#ifdef CONFIG_TRACE_IRQFLAGS
868 call trace_hardirqs_off
869 nop
870#endif
871 mov 0x1, %o0
872 call cheetah_plus_parity_error
873 add %sp, PTREGS_OFF, %o1
874 ba,a,pt %xcc, rtrap_irq
875
876cheetah_plus_icpe_trap_vector_tl1:
877 membar #Sync
878 wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
879 sethi %hi(do_icpe_tl1), %g3
880 jmpl %g3 + %lo(do_icpe_tl1), %g0
881 nop
882 nop
883 nop
884 nop
885
886 /* If we take one of these traps when tl >= 1, then we
887 * jump to interrupt globals. If some trap level above us
888 * was also using interrupt globals, we cannot recover.
889 * We may use all interrupt global registers except %g6.
890 */
891 .globl do_dcpe_tl1, do_icpe_tl1
892do_dcpe_tl1:
893 rdpr %tl, %g1 ! Save original trap level
894 mov 1, %g2 ! Setup TSTATE checking loop
895 sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
8961: wrpr %g2, %tl ! Set trap level to check
897 rdpr %tstate, %g4 ! Read TSTATE for this level
898 andcc %g4, %g3, %g0 ! Interrupt globals in use?
899 bne,a,pn %xcc, do_dcpe_tl1_fatal ! Yep, irrecoverable
900 wrpr %g1, %tl ! Restore original trap level
901 add %g2, 1, %g2 ! Next trap level
902 cmp %g2, %g1 ! Hit them all yet?
903 ble,pt %icc, 1b ! Not yet
904 nop
905 wrpr %g1, %tl ! Restore original trap level
906do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
907 sethi %hi(dcache_parity_tl1_occurred), %g2
908 lduw [%g2 + %lo(dcache_parity_tl1_occurred)], %g1
909 add %g1, 1, %g1
910 stw %g1, [%g2 + %lo(dcache_parity_tl1_occurred)]
911 /* Reset D-cache parity */
912 sethi %hi(1 << 16), %g1 ! D-cache size
913 mov (1 << 5), %g2 ! D-cache line size
914 sub %g1, %g2, %g1 ! Move down 1 cacheline
9151: srl %g1, 14, %g3 ! Compute UTAG
916 membar #Sync
917 stxa %g3, [%g1] ASI_DCACHE_UTAG
918 membar #Sync
919 sub %g2, 8, %g3 ! 64-bit data word within line
9202: membar #Sync
921 stxa %g0, [%g1 + %g3] ASI_DCACHE_DATA
922 membar #Sync
923 subcc %g3, 8, %g3 ! Next 64-bit data word
924 bge,pt %icc, 2b
925 nop
926 subcc %g1, %g2, %g1 ! Next cacheline
927 bge,pt %icc, 1b
928 nop
929 ba,pt %xcc, dcpe_icpe_tl1_common
930 nop
931
932do_dcpe_tl1_fatal:
933 sethi %hi(1f), %g7
934 ba,pt %xcc, etraptl1
9351: or %g7, %lo(1b), %g7
936 mov 0x2, %o0
937 call cheetah_plus_parity_error
938 add %sp, PTREGS_OFF, %o1
939 ba,pt %xcc, rtrap
940 nop
941
942do_icpe_tl1:
943 rdpr %tl, %g1 ! Save original trap level
944 mov 1, %g2 ! Setup TSTATE checking loop
945 sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
9461: wrpr %g2, %tl ! Set trap level to check
947 rdpr %tstate, %g4 ! Read TSTATE for this level
948 andcc %g4, %g3, %g0 ! Interrupt globals in use?
949 bne,a,pn %xcc, do_icpe_tl1_fatal ! Yep, irrecoverable
950 wrpr %g1, %tl ! Restore original trap level
951 add %g2, 1, %g2 ! Next trap level
952 cmp %g2, %g1 ! Hit them all yet?
953 ble,pt %icc, 1b ! Not yet
954 nop
955 wrpr %g1, %tl ! Restore original trap level
956do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
957 sethi %hi(icache_parity_tl1_occurred), %g2
958 lduw [%g2 + %lo(icache_parity_tl1_occurred)], %g1
959 add %g1, 1, %g1
960 stw %g1, [%g2 + %lo(icache_parity_tl1_occurred)]
961 /* Flush I-cache */
962 sethi %hi(1 << 15), %g1 ! I-cache size
963 mov (1 << 5), %g2 ! I-cache line size
964 sub %g1, %g2, %g1
9651: or %g1, (2 << 3), %g3
966 stxa %g0, [%g3] ASI_IC_TAG
967 membar #Sync
968 subcc %g1, %g2, %g1
969 bge,pt %icc, 1b
970 nop
971 ba,pt %xcc, dcpe_icpe_tl1_common
972 nop
973
974do_icpe_tl1_fatal:
975 sethi %hi(1f), %g7
976 ba,pt %xcc, etraptl1
9771: or %g7, %lo(1b), %g7
978 mov 0x3, %o0
979 call cheetah_plus_parity_error
980 add %sp, PTREGS_OFF, %o1
981 ba,pt %xcc, rtrap
982 nop
983
984dcpe_icpe_tl1_common:
985 /* Flush D-cache, re-enable D/I caches in DCU and finally
986 * retry the trapping instruction.
987 */
988 sethi %hi(1 << 16), %g1 ! D-cache size
989 mov (1 << 5), %g2 ! D-cache line size
990 sub %g1, %g2, %g1
9911: stxa %g0, [%g1] ASI_DCACHE_TAG
992 membar #Sync
993 subcc %g1, %g2, %g1
994 bge,pt %icc, 1b
995 nop
996 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
997 or %g1, (DCU_DC | DCU_IC), %g1
998 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
999 membar #Sync
1000 retry
1001
1002 /* Capture I/D/E-cache state into per-cpu error scoreboard.
1003 *
1004 * %g1: (TL>=0) ? 1 : 0
1005 * %g2: scratch
1006 * %g3: scratch
1007 * %g4: AFSR
1008 * %g5: AFAR
1009 * %g6: unused, will have current thread ptr after etrap
1010 * %g7: scratch
1011 */
1012__cheetah_log_error:
1013 /* Put "TL1" software bit into AFSR. */
1014 and %g1, 0x1, %g1
1015 sllx %g1, 63, %g2
1016 or %g4, %g2, %g4
1017
1018 /* Get log entry pointer for this cpu at this trap level. */
1019 BRANCH_IF_JALAPENO(g2,g3,50f)
1020 ldxa [%g0] ASI_SAFARI_CONFIG, %g2
1021 srlx %g2, 17, %g2
1022 ba,pt %xcc, 60f
1023 and %g2, 0x3ff, %g2
1024
102550: ldxa [%g0] ASI_JBUS_CONFIG, %g2
1026 srlx %g2, 17, %g2
1027 and %g2, 0x1f, %g2
1028
102960: sllx %g2, 9, %g2
1030 sethi %hi(cheetah_error_log), %g3
1031 ldx [%g3 + %lo(cheetah_error_log)], %g3
1032 brz,pn %g3, 80f
1033 nop
1034
1035 add %g3, %g2, %g3
1036 sllx %g1, 8, %g1
1037 add %g3, %g1, %g1
1038
1039 /* %g1 holds pointer to the top of the logging scoreboard */
1040 ldx [%g1 + 0x0], %g7
1041 cmp %g7, -1
1042 bne,pn %xcc, 80f
1043 nop
1044
1045 stx %g4, [%g1 + 0x0]
1046 stx %g5, [%g1 + 0x8]
1047 add %g1, 0x10, %g1
1048
1049 /* %g1 now points to D-cache logging area */
1050 set 0x3ff8, %g2 /* DC_addr mask */
1051 and %g5, %g2, %g2 /* DC_addr bits of AFAR */
1052 srlx %g5, 12, %g3
1053 or %g3, 1, %g3 /* PHYS tag + valid */
1054
105510: ldxa [%g2] ASI_DCACHE_TAG, %g7
1056 cmp %g3, %g7 /* TAG match? */
1057 bne,pt %xcc, 13f
1058 nop
1059
1060 /* Yep, what we want, capture state. */
1061 stx %g2, [%g1 + 0x20]
1062 stx %g7, [%g1 + 0x28]
1063
1064 /* A membar Sync is required before and after utag access. */
1065 membar #Sync
1066 ldxa [%g2] ASI_DCACHE_UTAG, %g7
1067 membar #Sync
1068 stx %g7, [%g1 + 0x30]
1069 ldxa [%g2] ASI_DCACHE_SNOOP_TAG, %g7
1070 stx %g7, [%g1 + 0x38]
1071 clr %g3
1072
107312: ldxa [%g2 + %g3] ASI_DCACHE_DATA, %g7
1074 stx %g7, [%g1]
1075 add %g3, (1 << 5), %g3
1076 cmp %g3, (4 << 5)
1077 bl,pt %xcc, 12b
1078 add %g1, 0x8, %g1
1079
1080 ba,pt %xcc, 20f
1081 add %g1, 0x20, %g1
1082
108313: sethi %hi(1 << 14), %g7
1084 add %g2, %g7, %g2
1085 srlx %g2, 14, %g7
1086 cmp %g7, 4
1087 bl,pt %xcc, 10b
1088 nop
1089
1090 add %g1, 0x40, %g1
1091
1092 /* %g1 now points to I-cache logging area */
109320: set 0x1fe0, %g2 /* IC_addr mask */
1094 and %g5, %g2, %g2 /* IC_addr bits of AFAR */
1095 sllx %g2, 1, %g2 /* IC_addr[13:6]==VA[12:5] */
1096 srlx %g5, (13 - 8), %g3 /* Make PTAG */
1097 andn %g3, 0xff, %g3 /* Mask off undefined bits */
1098
109921: ldxa [%g2] ASI_IC_TAG, %g7
1100 andn %g7, 0xff, %g7
1101 cmp %g3, %g7
1102 bne,pt %xcc, 23f
1103 nop
1104
1105 /* Yep, what we want, capture state. */
1106 stx %g2, [%g1 + 0x40]
1107 stx %g7, [%g1 + 0x48]
1108 add %g2, (1 << 3), %g2
1109 ldxa [%g2] ASI_IC_TAG, %g7
1110 add %g2, (1 << 3), %g2
1111 stx %g7, [%g1 + 0x50]
1112 ldxa [%g2] ASI_IC_TAG, %g7
1113 add %g2, (1 << 3), %g2
1114 stx %g7, [%g1 + 0x60]
1115 ldxa [%g2] ASI_IC_TAG, %g7
1116 stx %g7, [%g1 + 0x68]
1117 sub %g2, (3 << 3), %g2
1118 ldxa [%g2] ASI_IC_STAG, %g7
1119 stx %g7, [%g1 + 0x58]
1120 clr %g3
1121 srlx %g2, 2, %g2
1122
112322: ldxa [%g2 + %g3] ASI_IC_INSTR, %g7
1124 stx %g7, [%g1]
1125 add %g3, (1 << 3), %g3
1126 cmp %g3, (8 << 3)
1127 bl,pt %xcc, 22b
1128 add %g1, 0x8, %g1
1129
1130 ba,pt %xcc, 30f
1131 add %g1, 0x30, %g1
1132
113323: sethi %hi(1 << 14), %g7
1134 add %g2, %g7, %g2
1135 srlx %g2, 14, %g7
1136 cmp %g7, 4
1137 bl,pt %xcc, 21b
1138 nop
1139
1140 add %g1, 0x70, %g1
1141
1142 /* %g1 now points to E-cache logging area */
114330: andn %g5, (32 - 1), %g2
1144 stx %g2, [%g1 + 0x20]
1145 ldxa [%g2] ASI_EC_TAG_DATA, %g7
1146 stx %g7, [%g1 + 0x28]
1147 ldxa [%g2] ASI_EC_R, %g0
1148 clr %g3
1149
115031: ldxa [%g3] ASI_EC_DATA, %g7
1151 stx %g7, [%g1 + %g3]
1152 add %g3, 0x8, %g3
1153 cmp %g3, 0x20
1154
1155 bl,pt %xcc, 31b
1156 nop
115780:
1158 rdpr %tt, %g2
1159 cmp %g2, 0x70
1160 be c_fast_ecc
1161 cmp %g2, 0x63
1162 be c_cee
1163 nop
1164 ba,pt %xcc, c_deferred
1165
1166 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
1167 * in the trap table. That code has done a memory barrier
1168 * and has disabled both the I-cache and D-cache in the DCU
1169 * control register. The I-cache is disabled so that we may
1170 * capture the corrupted cache line, and the D-cache is disabled
1171 * because corrupt data may have been placed there and we don't
1172 * want to reference it.
1173 *
1174 * %g1 is one if this trap occurred at %tl >= 1.
1175 *
1176 * Next, we turn off error reporting so that we don't recurse.
1177 */
1178 .globl cheetah_fast_ecc
1179cheetah_fast_ecc:
1180 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1181 andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
1182 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1183 membar #Sync
1184
1185 /* Fetch and clear AFSR/AFAR */
1186 ldxa [%g0] ASI_AFSR, %g4
1187 ldxa [%g0] ASI_AFAR, %g5
1188 stxa %g4, [%g0] ASI_AFSR
1189 membar #Sync
1190
1191 ba,pt %xcc, __cheetah_log_error
1192 nop
1193
1194c_fast_ecc:
1195 rdpr %pil, %g2
1196 wrpr %g0, 15, %pil
1197 ba,pt %xcc, etrap_irq
1198 rd %pc, %g7
1199#ifdef CONFIG_TRACE_IRQFLAGS
1200 call trace_hardirqs_off
1201 nop
1202#endif
1203 mov %l4, %o1
1204 mov %l5, %o2
1205 call cheetah_fecc_handler
1206 add %sp, PTREGS_OFF, %o0
1207 ba,a,pt %xcc, rtrap_irq
1208
1209 /* Our caller has disabled I-cache and performed membar Sync. */
1210 .globl cheetah_cee
1211cheetah_cee:
1212 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1213 andn %g2, ESTATE_ERROR_CEEN, %g2
1214 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1215 membar #Sync
1216
1217 /* Fetch and clear AFSR/AFAR */
1218 ldxa [%g0] ASI_AFSR, %g4
1219 ldxa [%g0] ASI_AFAR, %g5
1220 stxa %g4, [%g0] ASI_AFSR
1221 membar #Sync
1222
1223 ba,pt %xcc, __cheetah_log_error
1224 nop
1225
1226c_cee:
1227 rdpr %pil, %g2
1228 wrpr %g0, 15, %pil
1229 ba,pt %xcc, etrap_irq
1230 rd %pc, %g7
1231#ifdef CONFIG_TRACE_IRQFLAGS
1232 call trace_hardirqs_off
1233 nop
1234#endif
1235 mov %l4, %o1
1236 mov %l5, %o2
1237 call cheetah_cee_handler
1238 add %sp, PTREGS_OFF, %o0
1239 ba,a,pt %xcc, rtrap_irq
1240
1241 /* Our caller has disabled I-cache+D-cache and performed membar Sync. */
1242 .globl cheetah_deferred_trap
1243cheetah_deferred_trap:
1244 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1245 andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
1246 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1247 membar #Sync
1248
1249 /* Fetch and clear AFSR/AFAR */
1250 ldxa [%g0] ASI_AFSR, %g4
1251 ldxa [%g0] ASI_AFAR, %g5
1252 stxa %g4, [%g0] ASI_AFSR
1253 membar #Sync
1254
1255 ba,pt %xcc, __cheetah_log_error
1256 nop
1257
1258c_deferred:
1259 rdpr %pil, %g2
1260 wrpr %g0, 15, %pil
1261 ba,pt %xcc, etrap_irq
1262 rd %pc, %g7
1263#ifdef CONFIG_TRACE_IRQFLAGS
1264 call trace_hardirqs_off
1265 nop
1266#endif
1267 mov %l4, %o1
1268 mov %l5, %o2
1269 call cheetah_deferred_handler
1270 add %sp, PTREGS_OFF, %o0
1271 ba,a,pt %xcc, rtrap_irq
1272
1273 .globl __do_privact
1274__do_privact:
1275 mov TLB_SFSR, %g3
1276 stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit
1277 membar #Sync
1278 sethi %hi(109f), %g7
1279 ba,pt %xcc, etrap
1280109: or %g7, %lo(109b), %g7
1281 call do_privact
1282 add %sp, PTREGS_OFF, %o0
1283 ba,pt %xcc, rtrap
1284 nop
1285
1286 .globl do_mna
1287do_mna:
1288 rdpr %tl, %g3
1289 cmp %g3, 1
1290
1291 /* Setup %g4/%g5 now as they are used in the
1292 * winfixup code.
1293 */
1294 mov TLB_SFSR, %g3
1295 mov DMMU_SFAR, %g4
1296 ldxa [%g4] ASI_DMMU, %g4
1297 ldxa [%g3] ASI_DMMU, %g5
1298 stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit
1299 membar #Sync
1300 bgu,pn %icc, winfix_mna
1301 rdpr %tpc, %g3
1302
13031: sethi %hi(109f), %g7
1304 ba,pt %xcc, etrap
1305109: or %g7, %lo(109b), %g7
1306 mov %l4, %o1
1307 mov %l5, %o2
1308 call mem_address_unaligned
1309 add %sp, PTREGS_OFF, %o0
1310 ba,pt %xcc, rtrap
1311 nop
1312
1313 .globl do_lddfmna
1314do_lddfmna:
1315 sethi %hi(109f), %g7
1316 mov TLB_SFSR, %g4
1317 ldxa [%g4] ASI_DMMU, %g5
1318 stxa %g0, [%g4] ASI_DMMU ! Clear FaultValid bit
1319 membar #Sync
1320 mov DMMU_SFAR, %g4
1321 ldxa [%g4] ASI_DMMU, %g4
1322 ba,pt %xcc, etrap
1323109: or %g7, %lo(109b), %g7
1324 mov %l4, %o1
1325 mov %l5, %o2
1326 call handle_lddfmna
1327 add %sp, PTREGS_OFF, %o0
1328 ba,pt %xcc, rtrap
1329 nop
1330
1331 .globl do_stdfmna
1332do_stdfmna:
1333 sethi %hi(109f), %g7
1334 mov TLB_SFSR, %g4
1335 ldxa [%g4] ASI_DMMU, %g5
1336 stxa %g0, [%g4] ASI_DMMU ! Clear FaultValid bit
1337 membar #Sync
1338 mov DMMU_SFAR, %g4
1339 ldxa [%g4] ASI_DMMU, %g4
1340 ba,pt %xcc, etrap
1341109: or %g7, %lo(109b), %g7
1342 mov %l4, %o1
1343 mov %l5, %o2
1344 call handle_stdfmna
1345 add %sp, PTREGS_OFF, %o0
1346 ba,pt %xcc, rtrap
1347 nop
1348
1349 .globl breakpoint_trap
1350breakpoint_trap:
1351 call sparc_breakpoint
1352 add %sp, PTREGS_OFF, %o0
1353 ba,pt %xcc, rtrap
1354 nop
1355
1356 /* SunOS's execv() call only specifies the argv argument, the
1357 * environment settings are the same as the calling processes.
1358 */
1359 .globl sunos_execv
1360sys_execve:
1361 sethi %hi(sparc_execve), %g1
1362 ba,pt %xcc, execve_merge
1363 or %g1, %lo(sparc_execve), %g1
1364#ifdef CONFIG_COMPAT
1365 .globl sys_execve
1366sunos_execv:
1367 stx %g0, [%sp + PTREGS_OFF + PT_V9_I2]
1368 .globl sys32_execve
1369sys32_execve:
1370 sethi %hi(sparc32_execve), %g1
1371 or %g1, %lo(sparc32_execve), %g1
1372#endif
1373execve_merge:
1374 flushw
1375 jmpl %g1, %g0
1376 add %sp, PTREGS_OFF, %o0
1377
1378 .globl sys_pipe, sys_sigpause, sys_nis_syscall
1379 .globl sys_rt_sigreturn
1380 .globl sys_ptrace
1381 .globl sys_sigaltstack
1382 .align 32
1383sys_pipe: ba,pt %xcc, sparc_pipe
1384 add %sp, PTREGS_OFF, %o0
1385sys_nis_syscall:ba,pt %xcc, c_sys_nis_syscall
1386 add %sp, PTREGS_OFF, %o0
1387sys_memory_ordering:
1388 ba,pt %xcc, sparc_memory_ordering
1389 add %sp, PTREGS_OFF, %o1
1390sys_sigaltstack:ba,pt %xcc, do_sigaltstack
1391 add %i6, STACK_BIAS, %o2
1392#ifdef CONFIG_COMPAT
1393 .globl sys32_sigstack
1394sys32_sigstack: ba,pt %xcc, do_sys32_sigstack
1395 mov %i6, %o2
1396 .globl sys32_sigaltstack
1397sys32_sigaltstack:
1398 ba,pt %xcc, do_sys32_sigaltstack
1399 mov %i6, %o2
1400#endif
1401 .align 32
1402#ifdef CONFIG_COMPAT
1403 .globl sys32_sigreturn
1404sys32_sigreturn:
1405 add %sp, PTREGS_OFF, %o0
1406 call do_sigreturn32
1407 add %o7, 1f-.-4, %o7
1408 nop
1409#endif
1410sys_rt_sigreturn:
1411 add %sp, PTREGS_OFF, %o0
1412 call do_rt_sigreturn
1413 add %o7, 1f-.-4, %o7
1414 nop
1415#ifdef CONFIG_COMPAT
1416 .globl sys32_rt_sigreturn
1417sys32_rt_sigreturn:
1418 add %sp, PTREGS_OFF, %o0
1419 call do_rt_sigreturn32
1420 add %o7, 1f-.-4, %o7
1421 nop
1422#endif
1423 .align 32
14241: ldx [%curptr + TI_FLAGS], %l5
1425 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1426 be,pt %icc, rtrap
1427 nop
1428 add %sp, PTREGS_OFF, %o0
1429 call syscall_trace
1430 mov 1, %o1
1431
1432 ba,pt %xcc, rtrap
1433 nop
1434
1435 /* This is how fork() was meant to be done, 8 instruction entry.
1436 *
1437 * I questioned the following code briefly, let me clear things
1438 * up so you must not reason on it like I did.
1439 *
1440 * Know the fork_kpsr etc. we use in the sparc32 port? We don't
1441 * need it here because the only piece of window state we copy to
1442 * the child is the CWP register. Even if the parent sleeps,
1443 * we are safe because we stuck it into pt_regs of the parent
1444 * so it will not change.
1445 *
1446 * XXX This raises the question, whether we can do the same on
1447 * XXX sparc32 to get rid of fork_kpsr _and_ fork_kwim. The
1448 * XXX answer is yes. We stick fork_kpsr in UREG_G0 and
1449 * XXX fork_kwim in UREG_G1 (global registers are considered
1450 * XXX volatile across a system call in the sparc ABI I think
1451 * XXX if it isn't we can use regs->y instead, anyone who depends
1452 * XXX upon the Y register being preserved across a fork deserves
1453 * XXX to lose).
1454 *
1455 * In fact we should take advantage of that fact for other things
1456 * during system calls...
1457 */
1458 .globl sys_fork, sys_vfork, sys_clone, sparc_exit
1459 .globl ret_from_syscall
1460 .align 32
1461sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
1462 sethi %hi(0x4000 | 0x0100 | SIGCHLD), %o0
1463 or %o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
1464 ba,pt %xcc, sys_clone
1465sys_fork: clr %o1
1466 mov SIGCHLD, %o0
1467sys_clone: flushw
1468 movrz %o1, %fp, %o1
1469 mov 0, %o3
1470 ba,pt %xcc, sparc_do_fork
1471 add %sp, PTREGS_OFF, %o2
1472ret_from_syscall:
1473 /* Clear current_thread_info()->new_child, and
1474 * check performance counter stuff too.
1475 */
1476 stb %g0, [%g6 + TI_NEW_CHILD]
1477 ldx [%g6 + TI_FLAGS], %l0
1478 call schedule_tail
1479 mov %g7, %o0
1480 andcc %l0, _TIF_PERFCTR, %g0
1481 be,pt %icc, 1f
1482 nop
1483 ldx [%g6 + TI_PCR], %o7
1484 wr %g0, %o7, %pcr
1485
1486 /* Blackbird errata workaround. See commentary in
1487 * smp.c:smp_percpu_timer_interrupt() for more
1488 * information.
1489 */
1490 ba,pt %xcc, 99f
1491 nop
1492 .align 64
149399: wr %g0, %g0, %pic
1494 rd %pic, %g0
1495
14961: b,pt %xcc, ret_sys_call
1497 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
1498sparc_exit: rdpr %pstate, %g2
1499 wrpr %g2, PSTATE_IE, %pstate
1500 rdpr %otherwin, %g1
1501 rdpr %cansave, %g3
1502 add %g3, %g1, %g3
1503 wrpr %g3, 0x0, %cansave
1504 wrpr %g0, 0x0, %otherwin
1505 wrpr %g2, 0x0, %pstate
1506 ba,pt %xcc, sys_exit
1507 stb %g0, [%g6 + TI_WSAVED]
1508
1509linux_sparc_ni_syscall:
1510 sethi %hi(sys_ni_syscall), %l7
1511 b,pt %xcc, 4f
1512 or %l7, %lo(sys_ni_syscall), %l7
1513
1514linux_syscall_trace32:
1515 add %sp, PTREGS_OFF, %o0
1516 call syscall_trace
1517 clr %o1
1518 srl %i0, 0, %o0
1519 srl %i4, 0, %o4
1520 srl %i1, 0, %o1
1521 srl %i2, 0, %o2
1522 b,pt %xcc, 2f
1523 srl %i3, 0, %o3
1524
1525linux_syscall_trace:
1526 add %sp, PTREGS_OFF, %o0
1527 call syscall_trace
1528 clr %o1
1529 mov %i0, %o0
1530 mov %i1, %o1
1531 mov %i2, %o2
1532 mov %i3, %o3
1533 b,pt %xcc, 2f
1534 mov %i4, %o4
1535
1536
1537 /* Linux 32-bit system calls enter here... */
1538 .align 32
1539 .globl linux_sparc_syscall32
1540linux_sparc_syscall32:
1541 /* Direct access to user regs, much faster. */
1542 cmp %g1, NR_SYSCALLS ! IEU1 Group
1543 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
1544 srl %i0, 0, %o0 ! IEU0
1545 sll %g1, 2, %l4 ! IEU0 Group
1546 srl %i4, 0, %o4 ! IEU1
1547 lduw [%l7 + %l4], %l7 ! Load
1548 srl %i1, 0, %o1 ! IEU0 Group
1549 ldx [%curptr + TI_FLAGS], %l0 ! Load
1550
1551 srl %i5, 0, %o5 ! IEU1
1552 srl %i2, 0, %o2 ! IEU0 Group
1553 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1554 bne,pn %icc, linux_syscall_trace32 ! CTI
1555 mov %i0, %l5 ! IEU1
1556 call %l7 ! CTI Group brk forced
1557 srl %i3, 0, %o3 ! IEU0
1558 ba,a,pt %xcc, 3f
1559
1560 /* Linux native system calls enter here... */
1561 .align 32
1562 .globl linux_sparc_syscall
1563linux_sparc_syscall:
1564 /* Direct access to user regs, much faster. */
1565 cmp %g1, NR_SYSCALLS ! IEU1 Group
1566 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
1567 mov %i0, %o0 ! IEU0
1568 sll %g1, 2, %l4 ! IEU0 Group
1569 mov %i1, %o1 ! IEU1
1570 lduw [%l7 + %l4], %l7 ! Load
15714: mov %i2, %o2 ! IEU0 Group
1572 ldx [%curptr + TI_FLAGS], %l0 ! Load
1573
1574 mov %i3, %o3 ! IEU1
1575 mov %i4, %o4 ! IEU0 Group
1576 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1577 bne,pn %icc, linux_syscall_trace ! CTI Group
1578 mov %i0, %l5 ! IEU0
15792: call %l7 ! CTI Group brk forced
1580 mov %i5, %o5 ! IEU0
1581 nop
1582
15833: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1584ret_sys_call:
1585 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
1586 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
1587 sra %o0, 0, %o0
1588 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
1589 sllx %g2, 32, %g2
1590
1591 /* Check if force_successful_syscall_return()
1592 * was invoked.
1593 */
1594 ldub [%curptr + TI_SYS_NOERROR], %l2
1595 brnz,a,pn %l2, 80f
1596 stb %g0, [%curptr + TI_SYS_NOERROR]
1597
1598 cmp %o0, -ERESTART_RESTARTBLOCK
1599 bgeu,pn %xcc, 1f
1600 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
160180:
1602 /* System call success, clear Carry condition code. */
1603 andn %g3, %g2, %g3
1604 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
1605 bne,pn %icc, linux_syscall_trace2
1606 add %l1, 0x4, %l2 ! npc = npc+4
1607 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1608 ba,pt %xcc, rtrap
1609 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1610
16111:
1612 /* System call failure, set Carry condition code.
1613 * Also, get abs(errno) to return to the process.
1614 */
1615 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
1616 sub %g0, %o0, %o0
1617 or %g3, %g2, %g3
1618 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1619 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
1620 bne,pn %icc, linux_syscall_trace2
1621 add %l1, 0x4, %l2 ! npc = npc+4
1622 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1623
1624 b,pt %xcc, rtrap
1625 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1626linux_syscall_trace2:
1627 add %sp, PTREGS_OFF, %o0
1628 call syscall_trace
1629 mov 1, %o1
1630 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1631 ba,pt %xcc, rtrap
1632 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1633
1634 .align 32
1635 .globl __flushw_user
1636__flushw_user:
1637 rdpr %otherwin, %g1
1638 brz,pn %g1, 2f
1639 clr %g2
16401: save %sp, -128, %sp
1641 rdpr %otherwin, %g1
1642 brnz,pt %g1, 1b
1643 add %g2, 1, %g2
16441: sub %g2, 1, %g2
1645 brnz,pt %g2, 1b
1646 restore %g0, %g0, %g0
16472: retl
1648 nop
1649
1650 /* Flush %fp and %i7 to the stack for all register
1651 * windows active inside of the cpu. This allows
1652 * show_stack_trace() to avoid using an expensive
1653 * 'flushw'.
1654 */
1655 .globl stack_trace_flush
1656 .type stack_trace_flush,#function
1657stack_trace_flush:
1658 rdpr %pstate, %o0
1659 wrpr %o0, PSTATE_IE, %pstate
1660
1661 rdpr %cwp, %g1
1662 rdpr %canrestore, %g2
1663 sub %g1, 1, %g3
1664
16651: brz,pn %g2, 2f
1666 sub %g2, 1, %g2
1667 wrpr %g3, %cwp
1668 stx %fp, [%sp + STACK_BIAS + RW_V9_I6]
1669 stx %i7, [%sp + STACK_BIAS + RW_V9_I7]
1670 ba,pt %xcc, 1b
1671 sub %g3, 1, %g3
1672
16732: wrpr %g1, %cwp
1674 wrpr %o0, %pstate
1675
1676 retl
1677 nop
1678 .size stack_trace_flush,.-stack_trace_flush
1679
1680#ifdef CONFIG_SMP
1681 .globl hard_smp_processor_id
1682hard_smp_processor_id:
1683#endif
1684 .globl real_hard_smp_processor_id
1685real_hard_smp_processor_id:
1686 __GET_CPUID(%o0)
1687 retl
1688 nop
1689
1690 /* %o0: devhandle
1691 * %o1: devino
1692 *
1693 * returns %o0: sysino
1694 */
1695 .globl sun4v_devino_to_sysino
1696 .type sun4v_devino_to_sysino,#function
1697sun4v_devino_to_sysino:
1698 mov HV_FAST_INTR_DEVINO2SYSINO, %o5
1699 ta HV_FAST_TRAP
1700 retl
1701 mov %o1, %o0
1702 .size sun4v_devino_to_sysino, .-sun4v_devino_to_sysino
1703
1704 /* %o0: sysino
1705 *
1706 * returns %o0: intr_enabled (HV_INTR_{DISABLED,ENABLED})
1707 */
1708 .globl sun4v_intr_getenabled
1709 .type sun4v_intr_getenabled,#function
1710sun4v_intr_getenabled:
1711 mov HV_FAST_INTR_GETENABLED, %o5
1712 ta HV_FAST_TRAP
1713 retl
1714 mov %o1, %o0
1715 .size sun4v_intr_getenabled, .-sun4v_intr_getenabled
1716
1717 /* %o0: sysino
1718 * %o1: intr_enabled (HV_INTR_{DISABLED,ENABLED})
1719 */
1720 .globl sun4v_intr_setenabled
1721 .type sun4v_intr_setenabled,#function
1722sun4v_intr_setenabled:
1723 mov HV_FAST_INTR_SETENABLED, %o5
1724 ta HV_FAST_TRAP
1725 retl
1726 nop
1727 .size sun4v_intr_setenabled, .-sun4v_intr_setenabled
1728
1729 /* %o0: sysino
1730 *
1731 * returns %o0: intr_state (HV_INTR_STATE_*)
1732 */
1733 .globl sun4v_intr_getstate
1734 .type sun4v_intr_getstate,#function
1735sun4v_intr_getstate:
1736 mov HV_FAST_INTR_GETSTATE, %o5
1737 ta HV_FAST_TRAP
1738 retl
1739 mov %o1, %o0
1740 .size sun4v_intr_getstate, .-sun4v_intr_getstate
1741
1742 /* %o0: sysino
1743 * %o1: intr_state (HV_INTR_STATE_*)
1744 */
1745 .globl sun4v_intr_setstate
1746 .type sun4v_intr_setstate,#function
1747sun4v_intr_setstate:
1748 mov HV_FAST_INTR_SETSTATE, %o5
1749 ta HV_FAST_TRAP
1750 retl
1751 nop
1752 .size sun4v_intr_setstate, .-sun4v_intr_setstate
1753
1754 /* %o0: sysino
1755 *
1756 * returns %o0: cpuid
1757 */
1758 .globl sun4v_intr_gettarget
1759 .type sun4v_intr_gettarget,#function
1760sun4v_intr_gettarget:
1761 mov HV_FAST_INTR_GETTARGET, %o5
1762 ta HV_FAST_TRAP
1763 retl
1764 mov %o1, %o0
1765 .size sun4v_intr_gettarget, .-sun4v_intr_gettarget
1766
1767 /* %o0: sysino
1768 * %o1: cpuid
1769 */
1770 .globl sun4v_intr_settarget
1771 .type sun4v_intr_settarget,#function
1772sun4v_intr_settarget:
1773 mov HV_FAST_INTR_SETTARGET, %o5
1774 ta HV_FAST_TRAP
1775 retl
1776 nop
1777 .size sun4v_intr_settarget, .-sun4v_intr_settarget
1778
1779 /* %o0: cpuid
1780 * %o1: pc
1781 * %o2: rtba
1782 * %o3: arg0
1783 *
1784 * returns %o0: status
1785 */
1786 .globl sun4v_cpu_start
1787 .type sun4v_cpu_start,#function
1788sun4v_cpu_start:
1789 mov HV_FAST_CPU_START, %o5
1790 ta HV_FAST_TRAP
1791 retl
1792 nop
1793 .size sun4v_cpu_start, .-sun4v_cpu_start
1794
1795 /* %o0: cpuid
1796 *
1797 * returns %o0: status
1798 */
1799 .globl sun4v_cpu_stop
1800 .type sun4v_cpu_stop,#function
1801sun4v_cpu_stop:
1802 mov HV_FAST_CPU_STOP, %o5
1803 ta HV_FAST_TRAP
1804 retl
1805 nop
1806 .size sun4v_cpu_stop, .-sun4v_cpu_stop
1807
1808 /* returns %o0: status */
1809 .globl sun4v_cpu_yield
1810 .type sun4v_cpu_yield, #function
1811sun4v_cpu_yield:
1812 mov HV_FAST_CPU_YIELD, %o5
1813 ta HV_FAST_TRAP
1814 retl
1815 nop
1816 .size sun4v_cpu_yield, .-sun4v_cpu_yield
1817
1818 /* %o0: type
1819 * %o1: queue paddr
1820 * %o2: num queue entries
1821 *
1822 * returns %o0: status
1823 */
1824 .globl sun4v_cpu_qconf
1825 .type sun4v_cpu_qconf,#function
1826sun4v_cpu_qconf:
1827 mov HV_FAST_CPU_QCONF, %o5
1828 ta HV_FAST_TRAP
1829 retl
1830 nop
1831 .size sun4v_cpu_qconf, .-sun4v_cpu_qconf
1832
1833 /* %o0: num cpus in cpu list
1834 * %o1: cpu list paddr
1835 * %o2: mondo block paddr
1836 *
1837 * returns %o0: status
1838 */
1839 .globl sun4v_cpu_mondo_send
1840 .type sun4v_cpu_mondo_send,#function
1841sun4v_cpu_mondo_send:
1842 mov HV_FAST_CPU_MONDO_SEND, %o5
1843 ta HV_FAST_TRAP
1844 retl
1845 nop
1846 .size sun4v_cpu_mondo_send, .-sun4v_cpu_mondo_send
1847
1848 /* %o0: CPU ID
1849 *
1850 * returns %o0: -status if status non-zero, else
1851 * %o0: cpu state as HV_CPU_STATE_*
1852 */
1853 .globl sun4v_cpu_state
1854 .type sun4v_cpu_state,#function
1855sun4v_cpu_state:
1856 mov HV_FAST_CPU_STATE, %o5
1857 ta HV_FAST_TRAP
1858 brnz,pn %o0, 1f
1859 sub %g0, %o0, %o0
1860 mov %o1, %o0
18611: retl
1862 nop
1863 .size sun4v_cpu_state, .-sun4v_cpu_state
1864
1865 /* %o0: virtual address
1866 * %o1: must be zero
1867 * %o2: TTE
1868 * %o3: HV_MMU_* flags
1869 *
1870 * returns %o0: status
1871 */
1872 .globl sun4v_mmu_map_perm_addr
1873 .type sun4v_mmu_map_perm_addr,#function
1874sun4v_mmu_map_perm_addr:
1875 mov HV_FAST_MMU_MAP_PERM_ADDR, %o5
1876 ta HV_FAST_TRAP
1877 retl
1878 nop
1879 .size sun4v_mmu_map_perm_addr, .-sun4v_mmu_map_perm_addr
1880
1881 /* %o0: number of TSB descriptions
1882 * %o1: TSB descriptions real address
1883 *
1884 * returns %o0: status
1885 */
1886 .globl sun4v_mmu_tsb_ctx0
1887 .type sun4v_mmu_tsb_ctx0,#function
1888sun4v_mmu_tsb_ctx0:
1889 mov HV_FAST_MMU_TSB_CTX0, %o5
1890 ta HV_FAST_TRAP
1891 retl
1892 nop
1893 .size sun4v_mmu_tsb_ctx0, .-sun4v_mmu_tsb_ctx0
1894
1895 /* %o0: API group number
1896 * %o1: pointer to unsigned long major number storage
1897 * %o2: pointer to unsigned long minor number storage
1898 *
1899 * returns %o0: status
1900 */
1901 .globl sun4v_get_version
1902 .type sun4v_get_version,#function
1903sun4v_get_version:
1904 mov HV_CORE_GET_VER, %o5
1905 mov %o1, %o3
1906 mov %o2, %o4
1907 ta HV_CORE_TRAP
1908 stx %o1, [%o3]
1909 retl
1910 stx %o2, [%o4]
1911 .size sun4v_get_version, .-sun4v_get_version
1912
1913 /* %o0: API group number
1914 * %o1: desired major number
1915 * %o2: desired minor number
1916 * %o3: pointer to unsigned long actual minor number storage
1917 *
1918 * returns %o0: status
1919 */
1920 .globl sun4v_set_version
1921 .type sun4v_set_version,#function
1922sun4v_set_version:
1923 mov HV_CORE_SET_VER, %o5
1924 mov %o3, %o4
1925 ta HV_CORE_TRAP
1926 retl
1927 stx %o1, [%o4]
1928 .size sun4v_set_version, .-sun4v_set_version
1929
1930 /* %o0: pointer to unsigned long time
1931 *
1932 * returns %o0: status
1933 */
1934 .globl sun4v_tod_get
1935 .type sun4v_tod_get,#function
1936sun4v_tod_get:
1937 mov %o0, %o4
1938 mov HV_FAST_TOD_GET, %o5
1939 ta HV_FAST_TRAP
1940 stx %o1, [%o4]
1941 retl
1942 nop
1943 .size sun4v_tod_get, .-sun4v_tod_get
1944
1945 /* %o0: time
1946 *
1947 * returns %o0: status
1948 */
1949 .globl sun4v_tod_set
1950 .type sun4v_tod_set,#function
1951sun4v_tod_set:
1952 mov HV_FAST_TOD_SET, %o5
1953 ta HV_FAST_TRAP
1954 retl
1955 nop
1956 .size sun4v_tod_set, .-sun4v_tod_set
1957
1958 /* %o0: pointer to unsigned long status
1959 *
1960 * returns %o0: signed character
1961 */
1962 .globl sun4v_con_getchar
1963 .type sun4v_con_getchar,#function
1964sun4v_con_getchar:
1965 mov %o0, %o4
1966 mov HV_FAST_CONS_GETCHAR, %o5
1967 clr %o0
1968 clr %o1
1969 ta HV_FAST_TRAP
1970 stx %o0, [%o4]
1971 retl
1972 sra %o1, 0, %o0
1973 .size sun4v_con_getchar, .-sun4v_con_getchar
1974
1975 /* %o0: signed long character
1976 *
1977 * returns %o0: status
1978 */
1979 .globl sun4v_con_putchar
1980 .type sun4v_con_putchar,#function
1981sun4v_con_putchar:
1982 mov HV_FAST_CONS_PUTCHAR, %o5
1983 ta HV_FAST_TRAP
1984 retl
1985 sra %o0, 0, %o0
1986 .size sun4v_con_putchar, .-sun4v_con_putchar
1987
1988 /* %o0: buffer real address
1989 * %o1: buffer size
1990 * %o2: pointer to unsigned long bytes_read
1991 *
1992 * returns %o0: status
1993 */
1994 .globl sun4v_con_read
1995 .type sun4v_con_read,#function
1996sun4v_con_read:
1997 mov %o2, %o4
1998 mov HV_FAST_CONS_READ, %o5
1999 ta HV_FAST_TRAP
2000 brnz %o0, 1f
2001 cmp %o1, -1 /* break */
2002 be,a,pn %icc, 1f
2003 mov %o1, %o0
2004 cmp %o1, -2 /* hup */
2005 be,a,pn %icc, 1f
2006 mov %o1, %o0
2007 stx %o1, [%o4]
20081: retl
2009 nop
2010 .size sun4v_con_read, .-sun4v_con_read
2011
2012 /* %o0: buffer real address
2013 * %o1: buffer size
2014 * %o2: pointer to unsigned long bytes_written
2015 *
2016 * returns %o0: status
2017 */
2018 .globl sun4v_con_write
2019 .type sun4v_con_write,#function
2020sun4v_con_write:
2021 mov %o2, %o4
2022 mov HV_FAST_CONS_WRITE, %o5
2023 ta HV_FAST_TRAP
2024 stx %o1, [%o4]
2025 retl
2026 nop
2027 .size sun4v_con_write, .-sun4v_con_write
2028
2029 /* %o0: soft state
2030 * %o1: address of description string
2031 *
2032 * returns %o0: status
2033 */
2034 .globl sun4v_mach_set_soft_state
2035 .type sun4v_mach_set_soft_state,#function
2036sun4v_mach_set_soft_state:
2037 mov HV_FAST_MACH_SET_SOFT_STATE, %o5
2038 ta HV_FAST_TRAP
2039 retl
2040 nop
2041 .size sun4v_mach_set_soft_state, .-sun4v_mach_set_soft_state
2042
2043 /* %o0: exit code
2044 *
2045 * Does not return.
2046 */
2047 .globl sun4v_mach_exit
2048 .type sun4v_mach_exit,#function
2049sun4v_mach_exit:
2050 mov HV_FAST_MACH_EXIT, %o5
2051 ta HV_FAST_TRAP
2052 retl
2053 nop
2054 .size sun4v_mach_exit, .-sun4v_mach_exit
2055
2056 /* %o0: buffer real address
2057 * %o1: buffer length
2058 * %o2: pointer to unsigned long real_buf_len
2059 *
2060 * returns %o0: status
2061 */
2062 .globl sun4v_mach_desc
2063 .type sun4v_mach_desc,#function
2064sun4v_mach_desc:
2065 mov %o2, %o4
2066 mov HV_FAST_MACH_DESC, %o5
2067 ta HV_FAST_TRAP
2068 stx %o1, [%o4]
2069 retl
2070 nop
2071 .size sun4v_mach_desc, .-sun4v_mach_desc
2072
2073 /* %o0: new timeout in milliseconds
2074 * %o1: pointer to unsigned long orig_timeout
2075 *
2076 * returns %o0: status
2077 */
2078 .globl sun4v_mach_set_watchdog
2079 .type sun4v_mach_set_watchdog,#function
2080sun4v_mach_set_watchdog:
2081 mov %o1, %o4
2082 mov HV_FAST_MACH_SET_WATCHDOG, %o5
2083 ta HV_FAST_TRAP
2084 stx %o1, [%o4]
2085 retl
2086 nop
2087 .size sun4v_mach_set_watchdog, .-sun4v_mach_set_watchdog
2088
2089 /* No inputs and does not return. */
2090 .globl sun4v_mach_sir
2091 .type sun4v_mach_sir,#function
2092sun4v_mach_sir:
2093 mov %o1, %o4
2094 mov HV_FAST_MACH_SIR, %o5
2095 ta HV_FAST_TRAP
2096 stx %o1, [%o4]
2097 retl
2098 nop
2099 .size sun4v_mach_sir, .-sun4v_mach_sir
2100
2101 /* %o0: channel
2102 * %o1: ra
2103 * %o2: num_entries
2104 *
2105 * returns %o0: status
2106 */
2107 .globl sun4v_ldc_tx_qconf
2108 .type sun4v_ldc_tx_qconf,#function
2109sun4v_ldc_tx_qconf:
2110 mov HV_FAST_LDC_TX_QCONF, %o5
2111 ta HV_FAST_TRAP
2112 retl
2113 nop
2114 .size sun4v_ldc_tx_qconf, .-sun4v_ldc_tx_qconf
2115
2116 /* %o0: channel
2117 * %o1: pointer to unsigned long ra
2118 * %o2: pointer to unsigned long num_entries
2119 *
2120 * returns %o0: status
2121 */
2122 .globl sun4v_ldc_tx_qinfo
2123 .type sun4v_ldc_tx_qinfo,#function
2124sun4v_ldc_tx_qinfo:
2125 mov %o1, %g1
2126 mov %o2, %g2
2127 mov HV_FAST_LDC_TX_QINFO, %o5
2128 ta HV_FAST_TRAP
2129 stx %o1, [%g1]
2130 stx %o2, [%g2]
2131 retl
2132 nop
2133 .size sun4v_ldc_tx_qinfo, .-sun4v_ldc_tx_qinfo
2134
2135 /* %o0: channel
2136 * %o1: pointer to unsigned long head_off
2137 * %o2: pointer to unsigned long tail_off
2138 * %o2: pointer to unsigned long chan_state
2139 *
2140 * returns %o0: status
2141 */
2142 .globl sun4v_ldc_tx_get_state
2143 .type sun4v_ldc_tx_get_state,#function
2144sun4v_ldc_tx_get_state:
2145 mov %o1, %g1
2146 mov %o2, %g2
2147 mov %o3, %g3
2148 mov HV_FAST_LDC_TX_GET_STATE, %o5
2149 ta HV_FAST_TRAP
2150 stx %o1, [%g1]
2151 stx %o2, [%g2]
2152 stx %o3, [%g3]
2153 retl
2154 nop
2155 .size sun4v_ldc_tx_get_state, .-sun4v_ldc_tx_get_state
2156
2157 /* %o0: channel
2158 * %o1: tail_off
2159 *
2160 * returns %o0: status
2161 */
2162 .globl sun4v_ldc_tx_set_qtail
2163 .type sun4v_ldc_tx_set_qtail,#function
2164sun4v_ldc_tx_set_qtail:
2165 mov HV_FAST_LDC_TX_SET_QTAIL, %o5
2166 ta HV_FAST_TRAP
2167 retl
2168 nop
2169 .size sun4v_ldc_tx_set_qtail, .-sun4v_ldc_tx_set_qtail
2170
2171 /* %o0: channel
2172 * %o1: ra
2173 * %o2: num_entries
2174 *
2175 * returns %o0: status
2176 */
2177 .globl sun4v_ldc_rx_qconf
2178 .type sun4v_ldc_rx_qconf,#function
2179sun4v_ldc_rx_qconf:
2180 mov HV_FAST_LDC_RX_QCONF, %o5
2181 ta HV_FAST_TRAP
2182 retl
2183 nop
2184 .size sun4v_ldc_rx_qconf, .-sun4v_ldc_rx_qconf
2185
2186 /* %o0: channel
2187 * %o1: pointer to unsigned long ra
2188 * %o2: pointer to unsigned long num_entries
2189 *
2190 * returns %o0: status
2191 */
2192 .globl sun4v_ldc_rx_qinfo
2193 .type sun4v_ldc_rx_qinfo,#function
2194sun4v_ldc_rx_qinfo:
2195 mov %o1, %g1
2196 mov %o2, %g2
2197 mov HV_FAST_LDC_RX_QINFO, %o5
2198 ta HV_FAST_TRAP
2199 stx %o1, [%g1]
2200 stx %o2, [%g2]
2201 retl
2202 nop
2203 .size sun4v_ldc_rx_qinfo, .-sun4v_ldc_rx_qinfo
2204
2205 /* %o0: channel
2206 * %o1: pointer to unsigned long head_off
2207 * %o2: pointer to unsigned long tail_off
2208 * %o2: pointer to unsigned long chan_state
2209 *
2210 * returns %o0: status
2211 */
2212 .globl sun4v_ldc_rx_get_state
2213 .type sun4v_ldc_rx_get_state,#function
2214sun4v_ldc_rx_get_state:
2215 mov %o1, %g1
2216 mov %o2, %g2
2217 mov %o3, %g3
2218 mov HV_FAST_LDC_RX_GET_STATE, %o5
2219 ta HV_FAST_TRAP
2220 stx %o1, [%g1]
2221 stx %o2, [%g2]
2222 stx %o3, [%g3]
2223 retl
2224 nop
2225 .size sun4v_ldc_rx_get_state, .-sun4v_ldc_rx_get_state
2226
2227 /* %o0: channel
2228 * %o1: head_off
2229 *
2230 * returns %o0: status
2231 */
2232 .globl sun4v_ldc_rx_set_qhead
2233 .type sun4v_ldc_rx_set_qhead,#function
2234sun4v_ldc_rx_set_qhead:
2235 mov HV_FAST_LDC_RX_SET_QHEAD, %o5
2236 ta HV_FAST_TRAP
2237 retl
2238 nop
2239 .size sun4v_ldc_rx_set_qhead, .-sun4v_ldc_rx_set_qhead
2240
2241 /* %o0: channel
2242 * %o1: ra
2243 * %o2: num_entries
2244 *
2245 * returns %o0: status
2246 */
2247 .globl sun4v_ldc_set_map_table
2248 .type sun4v_ldc_set_map_table,#function
2249sun4v_ldc_set_map_table:
2250 mov HV_FAST_LDC_SET_MAP_TABLE, %o5
2251 ta HV_FAST_TRAP
2252 retl
2253 nop
2254 .size sun4v_ldc_set_map_table, .-sun4v_ldc_set_map_table
2255
2256 /* %o0: channel
2257 * %o1: pointer to unsigned long ra
2258 * %o2: pointer to unsigned long num_entries
2259 *
2260 * returns %o0: status
2261 */
2262 .globl sun4v_ldc_get_map_table
2263 .type sun4v_ldc_get_map_table,#function
2264sun4v_ldc_get_map_table:
2265 mov %o1, %g1
2266 mov %o2, %g2
2267 mov HV_FAST_LDC_GET_MAP_TABLE, %o5
2268 ta HV_FAST_TRAP
2269 stx %o1, [%g1]
2270 stx %o2, [%g2]
2271 retl
2272 nop
2273 .size sun4v_ldc_get_map_table, .-sun4v_ldc_get_map_table
2274
2275 /* %o0: channel
2276 * %o1: dir_code
2277 * %o2: tgt_raddr
2278 * %o3: lcl_raddr
2279 * %o4: len
2280 * %o5: pointer to unsigned long actual_len
2281 *
2282 * returns %o0: status
2283 */
2284 .globl sun4v_ldc_copy
2285 .type sun4v_ldc_copy,#function
2286sun4v_ldc_copy:
2287 mov %o5, %g1
2288 mov HV_FAST_LDC_COPY, %o5
2289 ta HV_FAST_TRAP
2290 stx %o1, [%g1]
2291 retl
2292 nop
2293 .size sun4v_ldc_copy, .-sun4v_ldc_copy
2294
2295 /* %o0: channel
2296 * %o1: cookie
2297 * %o2: pointer to unsigned long ra
2298 * %o3: pointer to unsigned long perm
2299 *
2300 * returns %o0: status
2301 */
2302 .globl sun4v_ldc_mapin
2303 .type sun4v_ldc_mapin,#function
2304sun4v_ldc_mapin:
2305 mov %o2, %g1
2306 mov %o3, %g2
2307 mov HV_FAST_LDC_MAPIN, %o5
2308 ta HV_FAST_TRAP
2309 stx %o1, [%g1]
2310 stx %o2, [%g2]
2311 retl
2312 nop
2313 .size sun4v_ldc_mapin, .-sun4v_ldc_mapin
2314
2315 /* %o0: ra
2316 *
2317 * returns %o0: status
2318 */
2319 .globl sun4v_ldc_unmap
2320 .type sun4v_ldc_unmap,#function
2321sun4v_ldc_unmap:
2322 mov HV_FAST_LDC_UNMAP, %o5
2323 ta HV_FAST_TRAP
2324 retl
2325 nop
2326 .size sun4v_ldc_unmap, .-sun4v_ldc_unmap
2327
2328 /* %o0: channel
2329 * %o1: cookie
2330 * %o2: mte_cookie
2331 *
2332 * returns %o0: status
2333 */
2334 .globl sun4v_ldc_revoke
2335 .type sun4v_ldc_revoke,#function
2336sun4v_ldc_revoke:
2337 mov HV_FAST_LDC_REVOKE, %o5
2338 ta HV_FAST_TRAP
2339 retl
2340 nop
2341 .size sun4v_ldc_revoke, .-sun4v_ldc_revoke
2342
2343 /* %o0: device handle
2344 * %o1: device INO
2345 * %o2: pointer to unsigned long cookie
2346 *
2347 * returns %o0: status
2348 */
2349 .globl sun4v_vintr_get_cookie
2350 .type sun4v_vintr_get_cookie,#function
2351sun4v_vintr_get_cookie:
2352 mov %o2, %g1
2353 mov HV_FAST_VINTR_GET_COOKIE, %o5
2354 ta HV_FAST_TRAP
2355 stx %o1, [%g1]
2356 retl
2357 nop
2358 .size sun4v_vintr_get_cookie, .-sun4v_vintr_get_cookie
2359
2360 /* %o0: device handle
2361 * %o1: device INO
2362 * %o2: cookie
2363 *
2364 * returns %o0: status
2365 */
2366 .globl sun4v_vintr_set_cookie
2367 .type sun4v_vintr_set_cookie,#function
2368sun4v_vintr_set_cookie:
2369 mov HV_FAST_VINTR_SET_COOKIE, %o5
2370 ta HV_FAST_TRAP
2371 retl
2372 nop
2373 .size sun4v_vintr_set_cookie, .-sun4v_vintr_set_cookie
2374
2375 /* %o0: device handle
2376 * %o1: device INO
2377 * %o2: pointer to unsigned long valid_state
2378 *
2379 * returns %o0: status
2380 */
2381 .globl sun4v_vintr_get_valid
2382 .type sun4v_vintr_get_valid,#function
2383sun4v_vintr_get_valid:
2384 mov %o2, %g1
2385 mov HV_FAST_VINTR_GET_VALID, %o5
2386 ta HV_FAST_TRAP
2387 stx %o1, [%g1]
2388 retl
2389 nop
2390 .size sun4v_vintr_get_valid, .-sun4v_vintr_get_valid
2391
2392 /* %o0: device handle
2393 * %o1: device INO
2394 * %o2: valid_state
2395 *
2396 * returns %o0: status
2397 */
2398 .globl sun4v_vintr_set_valid
2399 .type sun4v_vintr_set_valid,#function
2400sun4v_vintr_set_valid:
2401 mov HV_FAST_VINTR_SET_VALID, %o5
2402 ta HV_FAST_TRAP
2403 retl
2404 nop
2405 .size sun4v_vintr_set_valid, .-sun4v_vintr_set_valid
2406
2407 /* %o0: device handle
2408 * %o1: device INO
2409 * %o2: pointer to unsigned long state
2410 *
2411 * returns %o0: status
2412 */
2413 .globl sun4v_vintr_get_state
2414 .type sun4v_vintr_get_state,#function
2415sun4v_vintr_get_state:
2416 mov %o2, %g1
2417 mov HV_FAST_VINTR_GET_STATE, %o5
2418 ta HV_FAST_TRAP
2419 stx %o1, [%g1]
2420 retl
2421 nop
2422 .size sun4v_vintr_get_state, .-sun4v_vintr_get_state
2423
2424 /* %o0: device handle
2425 * %o1: device INO
2426 * %o2: state
2427 *
2428 * returns %o0: status
2429 */
2430 .globl sun4v_vintr_set_state
2431 .type sun4v_vintr_set_state,#function
2432sun4v_vintr_set_state:
2433 mov HV_FAST_VINTR_SET_STATE, %o5
2434 ta HV_FAST_TRAP
2435 retl
2436 nop
2437 .size sun4v_vintr_set_state, .-sun4v_vintr_set_state
2438
2439 /* %o0: device handle
2440 * %o1: device INO
2441 * %o2: pointer to unsigned long cpuid
2442 *
2443 * returns %o0: status
2444 */
2445 .globl sun4v_vintr_get_target
2446 .type sun4v_vintr_get_target,#function
2447sun4v_vintr_get_target:
2448 mov %o2, %g1
2449 mov HV_FAST_VINTR_GET_TARGET, %o5
2450 ta HV_FAST_TRAP
2451 stx %o1, [%g1]
2452 retl
2453 nop
2454 .size sun4v_vintr_get_target, .-sun4v_vintr_get_target
2455
2456 /* %o0: device handle
2457 * %o1: device INO
2458 * %o2: cpuid
2459 *
2460 * returns %o0: status
2461 */
2462 .globl sun4v_vintr_set_target
2463 .type sun4v_vintr_set_target,#function
2464sun4v_vintr_set_target:
2465 mov HV_FAST_VINTR_SET_TARGET, %o5
2466 ta HV_FAST_TRAP
2467 retl
2468 nop
2469 .size sun4v_vintr_set_target, .-sun4v_vintr_set_target
2470
2471 /* %o0: NCS sub-function
2472 * %o1: sub-function arg real-address
2473 * %o2: sub-function arg size
2474 *
2475 * returns %o0: status
2476 */
2477 .globl sun4v_ncs_request
2478 .type sun4v_ncs_request,#function
2479sun4v_ncs_request:
2480 mov HV_FAST_NCS_REQUEST, %o5
2481 ta HV_FAST_TRAP
2482 retl
2483 nop
2484 .size sun4v_ncs_request, .-sun4v_ncs_request
2485
2486 .globl sun4v_svc_send
2487 .type sun4v_svc_send,#function
2488sun4v_svc_send:
2489 save %sp, -192, %sp
2490 mov %i0, %o0
2491 mov %i1, %o1
2492 mov %i2, %o2
2493 mov HV_FAST_SVC_SEND, %o5
2494 ta HV_FAST_TRAP
2495 stx %o1, [%i3]
2496 ret
2497 restore
2498 .size sun4v_svc_send, .-sun4v_svc_send
2499
2500 .globl sun4v_svc_recv
2501 .type sun4v_svc_recv,#function
2502sun4v_svc_recv:
2503 save %sp, -192, %sp
2504 mov %i0, %o0
2505 mov %i1, %o1
2506 mov %i2, %o2
2507 mov HV_FAST_SVC_RECV, %o5
2508 ta HV_FAST_TRAP
2509 stx %o1, [%i3]
2510 ret
2511 restore
2512 .size sun4v_svc_recv, .-sun4v_svc_recv
2513
2514 .globl sun4v_svc_getstatus
2515 .type sun4v_svc_getstatus,#function
2516sun4v_svc_getstatus:
2517 mov HV_FAST_SVC_GETSTATUS, %o5
2518 mov %o1, %o4
2519 ta HV_FAST_TRAP
2520 stx %o1, [%o4]
2521 retl
2522 nop
2523 .size sun4v_svc_getstatus, .-sun4v_svc_getstatus
2524
2525 .globl sun4v_svc_setstatus
2526 .type sun4v_svc_setstatus,#function
2527sun4v_svc_setstatus:
2528 mov HV_FAST_SVC_SETSTATUS, %o5
2529 ta HV_FAST_TRAP
2530 retl
2531 nop
2532 .size sun4v_svc_setstatus, .-sun4v_svc_setstatus
2533
2534 .globl sun4v_svc_clrstatus
2535 .type sun4v_svc_clrstatus,#function
2536sun4v_svc_clrstatus:
2537 mov HV_FAST_SVC_CLRSTATUS, %o5
2538 ta HV_FAST_TRAP
2539 retl
2540 nop
2541 .size sun4v_svc_clrstatus, .-sun4v_svc_clrstatus
2542
2543 .globl sun4v_mmustat_conf
2544 .type sun4v_mmustat_conf,#function
2545sun4v_mmustat_conf:
2546 mov %o1, %o4
2547 mov HV_FAST_MMUSTAT_CONF, %o5
2548 ta HV_FAST_TRAP
2549 stx %o1, [%o4]
2550 retl
2551 nop
2552 .size sun4v_mmustat_conf, .-sun4v_mmustat_conf
2553
2554 .globl sun4v_mmustat_info
2555 .type sun4v_mmustat_info,#function
2556sun4v_mmustat_info:
2557 mov %o0, %o4
2558 mov HV_FAST_MMUSTAT_INFO, %o5
2559 ta HV_FAST_TRAP
2560 stx %o1, [%o4]
2561 retl
2562 nop
2563 .size sun4v_mmustat_info, .-sun4v_mmustat_info
2564
2565 .globl sun4v_mmu_demap_all
2566 .type sun4v_mmu_demap_all,#function
2567sun4v_mmu_demap_all:
2568 clr %o0
2569 clr %o1
2570 mov HV_MMU_ALL, %o2
2571 mov HV_FAST_MMU_DEMAP_ALL, %o5
2572 ta HV_FAST_TRAP
2573 retl
2574 nop
2575 .size sun4v_mmu_demap_all, .-sun4v_mmu_demap_all
diff --git a/arch/sparc64/kernel/fpu_traps.S b/arch/sparc64/kernel/fpu_traps.S
new file mode 100644
index 000000000000..a6864826a4bd
--- /dev/null
+++ b/arch/sparc64/kernel/fpu_traps.S
@@ -0,0 +1,384 @@
1 /* This is trivial with the new code... */
2 .globl do_fpdis
3 .type do_fpdis,#function
4do_fpdis:
5 sethi %hi(TSTATE_PEF), %g4
6 rdpr %tstate, %g5
7 andcc %g5, %g4, %g0
8 be,pt %xcc, 1f
9 nop
10 rd %fprs, %g5
11 andcc %g5, FPRS_FEF, %g0
12 be,pt %xcc, 1f
13 nop
14
15 /* Legal state when DCR_IFPOE is set in Cheetah %dcr. */
16 sethi %hi(109f), %g7
17 ba,pt %xcc, etrap
18109: or %g7, %lo(109b), %g7
19 add %g0, %g0, %g0
20 ba,a,pt %xcc, rtrap
21
221: TRAP_LOAD_THREAD_REG(%g6, %g1)
23 ldub [%g6 + TI_FPSAVED], %g5
24 wr %g0, FPRS_FEF, %fprs
25 andcc %g5, FPRS_FEF, %g0
26 be,a,pt %icc, 1f
27 clr %g7
28 ldx [%g6 + TI_GSR], %g7
291: andcc %g5, FPRS_DL, %g0
30 bne,pn %icc, 2f
31 fzero %f0
32 andcc %g5, FPRS_DU, %g0
33 bne,pn %icc, 1f
34 fzero %f2
35 faddd %f0, %f2, %f4
36 fmuld %f0, %f2, %f6
37 faddd %f0, %f2, %f8
38 fmuld %f0, %f2, %f10
39 faddd %f0, %f2, %f12
40 fmuld %f0, %f2, %f14
41 faddd %f0, %f2, %f16
42 fmuld %f0, %f2, %f18
43 faddd %f0, %f2, %f20
44 fmuld %f0, %f2, %f22
45 faddd %f0, %f2, %f24
46 fmuld %f0, %f2, %f26
47 faddd %f0, %f2, %f28
48 fmuld %f0, %f2, %f30
49 faddd %f0, %f2, %f32
50 fmuld %f0, %f2, %f34
51 faddd %f0, %f2, %f36
52 fmuld %f0, %f2, %f38
53 faddd %f0, %f2, %f40
54 fmuld %f0, %f2, %f42
55 faddd %f0, %f2, %f44
56 fmuld %f0, %f2, %f46
57 faddd %f0, %f2, %f48
58 fmuld %f0, %f2, %f50
59 faddd %f0, %f2, %f52
60 fmuld %f0, %f2, %f54
61 faddd %f0, %f2, %f56
62 fmuld %f0, %f2, %f58
63 b,pt %xcc, fpdis_exit2
64 faddd %f0, %f2, %f60
651: mov SECONDARY_CONTEXT, %g3
66 add %g6, TI_FPREGS + 0x80, %g1
67 faddd %f0, %f2, %f4
68 fmuld %f0, %f2, %f6
69
70661: ldxa [%g3] ASI_DMMU, %g5
71 .section .sun4v_1insn_patch, "ax"
72 .word 661b
73 ldxa [%g3] ASI_MMU, %g5
74 .previous
75
76 sethi %hi(sparc64_kern_sec_context), %g2
77 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
78
79661: stxa %g2, [%g3] ASI_DMMU
80 .section .sun4v_1insn_patch, "ax"
81 .word 661b
82 stxa %g2, [%g3] ASI_MMU
83 .previous
84
85 membar #Sync
86 add %g6, TI_FPREGS + 0xc0, %g2
87 faddd %f0, %f2, %f8
88 fmuld %f0, %f2, %f10
89 membar #Sync
90 ldda [%g1] ASI_BLK_S, %f32
91 ldda [%g2] ASI_BLK_S, %f48
92 membar #Sync
93 faddd %f0, %f2, %f12
94 fmuld %f0, %f2, %f14
95 faddd %f0, %f2, %f16
96 fmuld %f0, %f2, %f18
97 faddd %f0, %f2, %f20
98 fmuld %f0, %f2, %f22
99 faddd %f0, %f2, %f24
100 fmuld %f0, %f2, %f26
101 faddd %f0, %f2, %f28
102 fmuld %f0, %f2, %f30
103 b,pt %xcc, fpdis_exit
104 nop
1052: andcc %g5, FPRS_DU, %g0
106 bne,pt %icc, 3f
107 fzero %f32
108 mov SECONDARY_CONTEXT, %g3
109 fzero %f34
110
111661: ldxa [%g3] ASI_DMMU, %g5
112 .section .sun4v_1insn_patch, "ax"
113 .word 661b
114 ldxa [%g3] ASI_MMU, %g5
115 .previous
116
117 add %g6, TI_FPREGS, %g1
118 sethi %hi(sparc64_kern_sec_context), %g2
119 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
120
121661: stxa %g2, [%g3] ASI_DMMU
122 .section .sun4v_1insn_patch, "ax"
123 .word 661b
124 stxa %g2, [%g3] ASI_MMU
125 .previous
126
127 membar #Sync
128 add %g6, TI_FPREGS + 0x40, %g2
129 faddd %f32, %f34, %f36
130 fmuld %f32, %f34, %f38
131 membar #Sync
132 ldda [%g1] ASI_BLK_S, %f0
133 ldda [%g2] ASI_BLK_S, %f16
134 membar #Sync
135 faddd %f32, %f34, %f40
136 fmuld %f32, %f34, %f42
137 faddd %f32, %f34, %f44
138 fmuld %f32, %f34, %f46
139 faddd %f32, %f34, %f48
140 fmuld %f32, %f34, %f50
141 faddd %f32, %f34, %f52
142 fmuld %f32, %f34, %f54
143 faddd %f32, %f34, %f56
144 fmuld %f32, %f34, %f58
145 faddd %f32, %f34, %f60
146 fmuld %f32, %f34, %f62
147 ba,pt %xcc, fpdis_exit
148 nop
1493: mov SECONDARY_CONTEXT, %g3
150 add %g6, TI_FPREGS, %g1
151
152661: ldxa [%g3] ASI_DMMU, %g5
153 .section .sun4v_1insn_patch, "ax"
154 .word 661b
155 ldxa [%g3] ASI_MMU, %g5
156 .previous
157
158 sethi %hi(sparc64_kern_sec_context), %g2
159 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
160
161661: stxa %g2, [%g3] ASI_DMMU
162 .section .sun4v_1insn_patch, "ax"
163 .word 661b
164 stxa %g2, [%g3] ASI_MMU
165 .previous
166
167 membar #Sync
168 mov 0x40, %g2
169 membar #Sync
170 ldda [%g1] ASI_BLK_S, %f0
171 ldda [%g1 + %g2] ASI_BLK_S, %f16
172 add %g1, 0x80, %g1
173 ldda [%g1] ASI_BLK_S, %f32
174 ldda [%g1 + %g2] ASI_BLK_S, %f48
175 membar #Sync
176fpdis_exit:
177
178661: stxa %g5, [%g3] ASI_DMMU
179 .section .sun4v_1insn_patch, "ax"
180 .word 661b
181 stxa %g5, [%g3] ASI_MMU
182 .previous
183
184 membar #Sync
185fpdis_exit2:
186 wr %g7, 0, %gsr
187 ldx [%g6 + TI_XFSR], %fsr
188 rdpr %tstate, %g3
189 or %g3, %g4, %g3 ! anal...
190 wrpr %g3, %tstate
191 wr %g0, FPRS_FEF, %fprs ! clean DU/DL bits
192 retry
193 .size do_fpdis,.-do_fpdis
194
195 .align 32
196 .type fp_other_bounce,#function
197fp_other_bounce:
198 call do_fpother
199 add %sp, PTREGS_OFF, %o0
200 ba,pt %xcc, rtrap
201 nop
202 .size fp_other_bounce,.-fp_other_bounce
203
204 .align 32
205 .globl do_fpother_check_fitos
206 .type do_fpother_check_fitos,#function
207do_fpother_check_fitos:
208 TRAP_LOAD_THREAD_REG(%g6, %g1)
209 sethi %hi(fp_other_bounce - 4), %g7
210 or %g7, %lo(fp_other_bounce - 4), %g7
211
212 /* NOTE: Need to preserve %g7 until we fully commit
213 * to the fitos fixup.
214 */
215 stx %fsr, [%g6 + TI_XFSR]
216 rdpr %tstate, %g3
217 andcc %g3, TSTATE_PRIV, %g0
218 bne,pn %xcc, do_fptrap_after_fsr
219 nop
220 ldx [%g6 + TI_XFSR], %g3
221 srlx %g3, 14, %g1
222 and %g1, 7, %g1
223 cmp %g1, 2 ! Unfinished FP-OP
224 bne,pn %xcc, do_fptrap_after_fsr
225 sethi %hi(1 << 23), %g1 ! Inexact
226 andcc %g3, %g1, %g0
227 bne,pn %xcc, do_fptrap_after_fsr
228 rdpr %tpc, %g1
229 lduwa [%g1] ASI_AIUP, %g3 ! This cannot ever fail
230#define FITOS_MASK 0xc1f83fe0
231#define FITOS_COMPARE 0x81a01880
232 sethi %hi(FITOS_MASK), %g1
233 or %g1, %lo(FITOS_MASK), %g1
234 and %g3, %g1, %g1
235 sethi %hi(FITOS_COMPARE), %g2
236 or %g2, %lo(FITOS_COMPARE), %g2
237 cmp %g1, %g2
238 bne,pn %xcc, do_fptrap_after_fsr
239 nop
240 std %f62, [%g6 + TI_FPREGS + (62 * 4)]
241 sethi %hi(fitos_table_1), %g1
242 and %g3, 0x1f, %g2
243 or %g1, %lo(fitos_table_1), %g1
244 sllx %g2, 2, %g2
245 jmpl %g1 + %g2, %g0
246 ba,pt %xcc, fitos_emul_continue
247
248fitos_table_1:
249 fitod %f0, %f62
250 fitod %f1, %f62
251 fitod %f2, %f62
252 fitod %f3, %f62
253 fitod %f4, %f62
254 fitod %f5, %f62
255 fitod %f6, %f62
256 fitod %f7, %f62
257 fitod %f8, %f62
258 fitod %f9, %f62
259 fitod %f10, %f62
260 fitod %f11, %f62
261 fitod %f12, %f62
262 fitod %f13, %f62
263 fitod %f14, %f62
264 fitod %f15, %f62
265 fitod %f16, %f62
266 fitod %f17, %f62
267 fitod %f18, %f62
268 fitod %f19, %f62
269 fitod %f20, %f62
270 fitod %f21, %f62
271 fitod %f22, %f62
272 fitod %f23, %f62
273 fitod %f24, %f62
274 fitod %f25, %f62
275 fitod %f26, %f62
276 fitod %f27, %f62
277 fitod %f28, %f62
278 fitod %f29, %f62
279 fitod %f30, %f62
280 fitod %f31, %f62
281
282fitos_emul_continue:
283 sethi %hi(fitos_table_2), %g1
284 srl %g3, 25, %g2
285 or %g1, %lo(fitos_table_2), %g1
286 and %g2, 0x1f, %g2
287 sllx %g2, 2, %g2
288 jmpl %g1 + %g2, %g0
289 ba,pt %xcc, fitos_emul_fini
290
291fitos_table_2:
292 fdtos %f62, %f0
293 fdtos %f62, %f1
294 fdtos %f62, %f2
295 fdtos %f62, %f3
296 fdtos %f62, %f4
297 fdtos %f62, %f5
298 fdtos %f62, %f6
299 fdtos %f62, %f7
300 fdtos %f62, %f8
301 fdtos %f62, %f9
302 fdtos %f62, %f10
303 fdtos %f62, %f11
304 fdtos %f62, %f12
305 fdtos %f62, %f13
306 fdtos %f62, %f14
307 fdtos %f62, %f15
308 fdtos %f62, %f16
309 fdtos %f62, %f17
310 fdtos %f62, %f18
311 fdtos %f62, %f19
312 fdtos %f62, %f20
313 fdtos %f62, %f21
314 fdtos %f62, %f22
315 fdtos %f62, %f23
316 fdtos %f62, %f24
317 fdtos %f62, %f25
318 fdtos %f62, %f26
319 fdtos %f62, %f27
320 fdtos %f62, %f28
321 fdtos %f62, %f29
322 fdtos %f62, %f30
323 fdtos %f62, %f31
324
325fitos_emul_fini:
326 ldd [%g6 + TI_FPREGS + (62 * 4)], %f62
327 done
328 .size do_fpother_check_fitos,.-do_fpother_check_fitos
329
330 .align 32
331 .globl do_fptrap
332 .type do_fptrap,#function
333do_fptrap:
334 TRAP_LOAD_THREAD_REG(%g6, %g1)
335 stx %fsr, [%g6 + TI_XFSR]
336do_fptrap_after_fsr:
337 ldub [%g6 + TI_FPSAVED], %g3
338 rd %fprs, %g1
339 or %g3, %g1, %g3
340 stb %g3, [%g6 + TI_FPSAVED]
341 rd %gsr, %g3
342 stx %g3, [%g6 + TI_GSR]
343 mov SECONDARY_CONTEXT, %g3
344
345661: ldxa [%g3] ASI_DMMU, %g5
346 .section .sun4v_1insn_patch, "ax"
347 .word 661b
348 ldxa [%g3] ASI_MMU, %g5
349 .previous
350
351 sethi %hi(sparc64_kern_sec_context), %g2
352 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
353
354661: stxa %g2, [%g3] ASI_DMMU
355 .section .sun4v_1insn_patch, "ax"
356 .word 661b
357 stxa %g2, [%g3] ASI_MMU
358 .previous
359
360 membar #Sync
361 add %g6, TI_FPREGS, %g2
362 andcc %g1, FPRS_DL, %g0
363 be,pn %icc, 4f
364 mov 0x40, %g3
365 stda %f0, [%g2] ASI_BLK_S
366 stda %f16, [%g2 + %g3] ASI_BLK_S
367 andcc %g1, FPRS_DU, %g0
368 be,pn %icc, 5f
3694: add %g2, 128, %g2
370 stda %f32, [%g2] ASI_BLK_S
371 stda %f48, [%g2 + %g3] ASI_BLK_S
3725: mov SECONDARY_CONTEXT, %g1
373 membar #Sync
374
375661: stxa %g5, [%g1] ASI_DMMU
376 .section .sun4v_1insn_patch, "ax"
377 .word 661b
378 stxa %g5, [%g1] ASI_MMU
379 .previous
380
381 membar #Sync
382 ba,pt %xcc, etrap
383 wr %g0, 0, %fprs
384 .size do_fptrap,.-do_fptrap
diff --git a/arch/sparc64/kernel/getsetcc.S b/arch/sparc64/kernel/getsetcc.S
new file mode 100644
index 000000000000..a14d272d2061
--- /dev/null
+++ b/arch/sparc64/kernel/getsetcc.S
@@ -0,0 +1,24 @@
1 .globl getcc
2 .type getcc,#function
3getcc:
4 ldx [%o0 + PT_V9_TSTATE], %o1
5 srlx %o1, 32, %o1
6 and %o1, 0xf, %o1
7 retl
8 stx %o1, [%o0 + PT_V9_G1]
9 .size getcc,.-getcc
10
11 .globl setcc
12 .type setcc,#function
13setcc:
14 ldx [%o0 + PT_V9_TSTATE], %o1
15 ldx [%o0 + PT_V9_G1], %o2
16 or %g0, %ulo(TSTATE_ICC), %o3
17 sllx %o3, 32, %o3
18 andn %o1, %o3, %o1
19 sllx %o2, 32, %o2
20 and %o2, %o3, %o2
21 or %o1, %o2, %o1
22 retl
23 stx %o1, [%o0 + PT_V9_TSTATE]
24 .size setcc,.-setcc
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
index 34f8ff57c56b..c9afef093d51 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc64/kernel/head.S
@@ -27,6 +27,10 @@
27#include <asm/ttable.h> 27#include <asm/ttable.h>
28#include <asm/mmu.h> 28#include <asm/mmu.h>
29#include <asm/cpudata.h> 29#include <asm/cpudata.h>
30#include <asm/pil.h>
31#include <asm/estate.h>
32#include <asm/sfafsr.h>
33#include <asm/unistd.h>
30 34
31/* This section from from _start to sparc64_boot_end should fit into 35/* This section from from _start to sparc64_boot_end should fit into
32 * 0x0000000000404000 to 0x0000000000408000. 36 * 0x0000000000404000 to 0x0000000000408000.
@@ -823,7 +827,16 @@ sparc64_boot_end:
823#include "etrap.S" 827#include "etrap.S"
824#include "rtrap.S" 828#include "rtrap.S"
825#include "winfixup.S" 829#include "winfixup.S"
826#include "entry.S" 830#include "fpu_traps.S"
831#include "ivec.S"
832#include "getsetcc.S"
833#include "utrap.S"
834#include "spiterrs.S"
835#include "cherrs.S"
836#include "misctrap.S"
837#include "syscalls.S"
838#include "helpers.S"
839#include "hvcalls.S"
827#include "sun4v_tlb_miss.S" 840#include "sun4v_tlb_miss.S"
828#include "sun4v_ivec.S" 841#include "sun4v_ivec.S"
829#include "ktlb.S" 842#include "ktlb.S"
diff --git a/arch/sparc64/kernel/helpers.S b/arch/sparc64/kernel/helpers.S
new file mode 100644
index 000000000000..314dd0c9fc5b
--- /dev/null
+++ b/arch/sparc64/kernel/helpers.S
@@ -0,0 +1,63 @@
1 .align 32
2 .globl __flushw_user
3 .type __flushw_user,#function
4__flushw_user:
5 rdpr %otherwin, %g1
6 brz,pn %g1, 2f
7 clr %g2
81: save %sp, -128, %sp
9 rdpr %otherwin, %g1
10 brnz,pt %g1, 1b
11 add %g2, 1, %g2
121: sub %g2, 1, %g2
13 brnz,pt %g2, 1b
14 restore %g0, %g0, %g0
152: retl
16 nop
17 .size __flushw_user,.-__flushw_user
18
19 /* Flush %fp and %i7 to the stack for all register
20 * windows active inside of the cpu. This allows
21 * show_stack_trace() to avoid using an expensive
22 * 'flushw'.
23 */
24 .globl stack_trace_flush
25 .type stack_trace_flush,#function
26stack_trace_flush:
27 rdpr %pstate, %o0
28 wrpr %o0, PSTATE_IE, %pstate
29
30 rdpr %cwp, %g1
31 rdpr %canrestore, %g2
32 sub %g1, 1, %g3
33
341: brz,pn %g2, 2f
35 sub %g2, 1, %g2
36 wrpr %g3, %cwp
37 stx %fp, [%sp + STACK_BIAS + RW_V9_I6]
38 stx %i7, [%sp + STACK_BIAS + RW_V9_I7]
39 ba,pt %xcc, 1b
40 sub %g3, 1, %g3
41
422: wrpr %g1, %cwp
43 wrpr %o0, %pstate
44
45 retl
46 nop
47 .size stack_trace_flush,.-stack_trace_flush
48
49#ifdef CONFIG_SMP
50 .globl hard_smp_processor_id
51 .type hard_smp_processor_id,#function
52hard_smp_processor_id:
53#endif
54 .globl real_hard_smp_processor_id
55 .type real_hard_smp_processor_id,#function
56real_hard_smp_processor_id:
57 __GET_CPUID(%o0)
58 retl
59 nop
60#ifdef CONFIG_SMP
61 .size hard_smp_processor_id,.-hard_smp_processor_id
62#endif
63 .size real_hard_smp_processor_id,.-real_hard_smp_processor_id
diff --git a/arch/sparc64/kernel/hvcalls.S b/arch/sparc64/kernel/hvcalls.S
new file mode 100644
index 000000000000..a2810f3ac70f
--- /dev/null
+++ b/arch/sparc64/kernel/hvcalls.S
@@ -0,0 +1,886 @@
1 /* %o0: devhandle
2 * %o1: devino
3 *
4 * returns %o0: sysino
5 */
6 .globl sun4v_devino_to_sysino
7 .type sun4v_devino_to_sysino,#function
8sun4v_devino_to_sysino:
9 mov HV_FAST_INTR_DEVINO2SYSINO, %o5
10 ta HV_FAST_TRAP
11 retl
12 mov %o1, %o0
13 .size sun4v_devino_to_sysino, .-sun4v_devino_to_sysino
14
15 /* %o0: sysino
16 *
17 * returns %o0: intr_enabled (HV_INTR_{DISABLED,ENABLED})
18 */
19 .globl sun4v_intr_getenabled
20 .type sun4v_intr_getenabled,#function
21sun4v_intr_getenabled:
22 mov HV_FAST_INTR_GETENABLED, %o5
23 ta HV_FAST_TRAP
24 retl
25 mov %o1, %o0
26 .size sun4v_intr_getenabled, .-sun4v_intr_getenabled
27
28 /* %o0: sysino
29 * %o1: intr_enabled (HV_INTR_{DISABLED,ENABLED})
30 */
31 .globl sun4v_intr_setenabled
32 .type sun4v_intr_setenabled,#function
33sun4v_intr_setenabled:
34 mov HV_FAST_INTR_SETENABLED, %o5
35 ta HV_FAST_TRAP
36 retl
37 nop
38 .size sun4v_intr_setenabled, .-sun4v_intr_setenabled
39
40 /* %o0: sysino
41 *
42 * returns %o0: intr_state (HV_INTR_STATE_*)
43 */
44 .globl sun4v_intr_getstate
45 .type sun4v_intr_getstate,#function
46sun4v_intr_getstate:
47 mov HV_FAST_INTR_GETSTATE, %o5
48 ta HV_FAST_TRAP
49 retl
50 mov %o1, %o0
51 .size sun4v_intr_getstate, .-sun4v_intr_getstate
52
53 /* %o0: sysino
54 * %o1: intr_state (HV_INTR_STATE_*)
55 */
56 .globl sun4v_intr_setstate
57 .type sun4v_intr_setstate,#function
58sun4v_intr_setstate:
59 mov HV_FAST_INTR_SETSTATE, %o5
60 ta HV_FAST_TRAP
61 retl
62 nop
63 .size sun4v_intr_setstate, .-sun4v_intr_setstate
64
65 /* %o0: sysino
66 *
67 * returns %o0: cpuid
68 */
69 .globl sun4v_intr_gettarget
70 .type sun4v_intr_gettarget,#function
71sun4v_intr_gettarget:
72 mov HV_FAST_INTR_GETTARGET, %o5
73 ta HV_FAST_TRAP
74 retl
75 mov %o1, %o0
76 .size sun4v_intr_gettarget, .-sun4v_intr_gettarget
77
78 /* %o0: sysino
79 * %o1: cpuid
80 */
81 .globl sun4v_intr_settarget
82 .type sun4v_intr_settarget,#function
83sun4v_intr_settarget:
84 mov HV_FAST_INTR_SETTARGET, %o5
85 ta HV_FAST_TRAP
86 retl
87 nop
88 .size sun4v_intr_settarget, .-sun4v_intr_settarget
89
90 /* %o0: cpuid
91 * %o1: pc
92 * %o2: rtba
93 * %o3: arg0
94 *
95 * returns %o0: status
96 */
97 .globl sun4v_cpu_start
98 .type sun4v_cpu_start,#function
99sun4v_cpu_start:
100 mov HV_FAST_CPU_START, %o5
101 ta HV_FAST_TRAP
102 retl
103 nop
104 .size sun4v_cpu_start, .-sun4v_cpu_start
105
106 /* %o0: cpuid
107 *
108 * returns %o0: status
109 */
110 .globl sun4v_cpu_stop
111 .type sun4v_cpu_stop,#function
112sun4v_cpu_stop:
113 mov HV_FAST_CPU_STOP, %o5
114 ta HV_FAST_TRAP
115 retl
116 nop
117 .size sun4v_cpu_stop, .-sun4v_cpu_stop
118
119 /* returns %o0: status */
120 .globl sun4v_cpu_yield
121 .type sun4v_cpu_yield, #function
122sun4v_cpu_yield:
123 mov HV_FAST_CPU_YIELD, %o5
124 ta HV_FAST_TRAP
125 retl
126 nop
127 .size sun4v_cpu_yield, .-sun4v_cpu_yield
128
129 /* %o0: type
130 * %o1: queue paddr
131 * %o2: num queue entries
132 *
133 * returns %o0: status
134 */
135 .globl sun4v_cpu_qconf
136 .type sun4v_cpu_qconf,#function
137sun4v_cpu_qconf:
138 mov HV_FAST_CPU_QCONF, %o5
139 ta HV_FAST_TRAP
140 retl
141 nop
142 .size sun4v_cpu_qconf, .-sun4v_cpu_qconf
143
144 /* %o0: num cpus in cpu list
145 * %o1: cpu list paddr
146 * %o2: mondo block paddr
147 *
148 * returns %o0: status
149 */
150 .globl sun4v_cpu_mondo_send
151 .type sun4v_cpu_mondo_send,#function
152sun4v_cpu_mondo_send:
153 mov HV_FAST_CPU_MONDO_SEND, %o5
154 ta HV_FAST_TRAP
155 retl
156 nop
157 .size sun4v_cpu_mondo_send, .-sun4v_cpu_mondo_send
158
159 /* %o0: CPU ID
160 *
161 * returns %o0: -status if status non-zero, else
162 * %o0: cpu state as HV_CPU_STATE_*
163 */
164 .globl sun4v_cpu_state
165 .type sun4v_cpu_state,#function
166sun4v_cpu_state:
167 mov HV_FAST_CPU_STATE, %o5
168 ta HV_FAST_TRAP
169 brnz,pn %o0, 1f
170 sub %g0, %o0, %o0
171 mov %o1, %o0
1721: retl
173 nop
174 .size sun4v_cpu_state, .-sun4v_cpu_state
175
176 /* %o0: virtual address
177 * %o1: must be zero
178 * %o2: TTE
179 * %o3: HV_MMU_* flags
180 *
181 * returns %o0: status
182 */
183 .globl sun4v_mmu_map_perm_addr
184 .type sun4v_mmu_map_perm_addr,#function
185sun4v_mmu_map_perm_addr:
186 mov HV_FAST_MMU_MAP_PERM_ADDR, %o5
187 ta HV_FAST_TRAP
188 retl
189 nop
190 .size sun4v_mmu_map_perm_addr, .-sun4v_mmu_map_perm_addr
191
192 /* %o0: number of TSB descriptions
193 * %o1: TSB descriptions real address
194 *
195 * returns %o0: status
196 */
197 .globl sun4v_mmu_tsb_ctx0
198 .type sun4v_mmu_tsb_ctx0,#function
199sun4v_mmu_tsb_ctx0:
200 mov HV_FAST_MMU_TSB_CTX0, %o5
201 ta HV_FAST_TRAP
202 retl
203 nop
204 .size sun4v_mmu_tsb_ctx0, .-sun4v_mmu_tsb_ctx0
205
206 /* %o0: API group number
207 * %o1: pointer to unsigned long major number storage
208 * %o2: pointer to unsigned long minor number storage
209 *
210 * returns %o0: status
211 */
212 .globl sun4v_get_version
213 .type sun4v_get_version,#function
214sun4v_get_version:
215 mov HV_CORE_GET_VER, %o5
216 mov %o1, %o3
217 mov %o2, %o4
218 ta HV_CORE_TRAP
219 stx %o1, [%o3]
220 retl
221 stx %o2, [%o4]
222 .size sun4v_get_version, .-sun4v_get_version
223
224 /* %o0: API group number
225 * %o1: desired major number
226 * %o2: desired minor number
227 * %o3: pointer to unsigned long actual minor number storage
228 *
229 * returns %o0: status
230 */
231 .globl sun4v_set_version
232 .type sun4v_set_version,#function
233sun4v_set_version:
234 mov HV_CORE_SET_VER, %o5
235 mov %o3, %o4
236 ta HV_CORE_TRAP
237 retl
238 stx %o1, [%o4]
239 .size sun4v_set_version, .-sun4v_set_version
240
241 /* %o0: pointer to unsigned long time
242 *
243 * returns %o0: status
244 */
245 .globl sun4v_tod_get
246 .type sun4v_tod_get,#function
247sun4v_tod_get:
248 mov %o0, %o4
249 mov HV_FAST_TOD_GET, %o5
250 ta HV_FAST_TRAP
251 stx %o1, [%o4]
252 retl
253 nop
254 .size sun4v_tod_get, .-sun4v_tod_get
255
256 /* %o0: time
257 *
258 * returns %o0: status
259 */
260 .globl sun4v_tod_set
261 .type sun4v_tod_set,#function
262sun4v_tod_set:
263 mov HV_FAST_TOD_SET, %o5
264 ta HV_FAST_TRAP
265 retl
266 nop
267 .size sun4v_tod_set, .-sun4v_tod_set
268
269 /* %o0: pointer to unsigned long status
270 *
271 * returns %o0: signed character
272 */
273 .globl sun4v_con_getchar
274 .type sun4v_con_getchar,#function
275sun4v_con_getchar:
276 mov %o0, %o4
277 mov HV_FAST_CONS_GETCHAR, %o5
278 clr %o0
279 clr %o1
280 ta HV_FAST_TRAP
281 stx %o0, [%o4]
282 retl
283 sra %o1, 0, %o0
284 .size sun4v_con_getchar, .-sun4v_con_getchar
285
286 /* %o0: signed long character
287 *
288 * returns %o0: status
289 */
290 .globl sun4v_con_putchar
291 .type sun4v_con_putchar,#function
292sun4v_con_putchar:
293 mov HV_FAST_CONS_PUTCHAR, %o5
294 ta HV_FAST_TRAP
295 retl
296 sra %o0, 0, %o0
297 .size sun4v_con_putchar, .-sun4v_con_putchar
298
299 /* %o0: buffer real address
300 * %o1: buffer size
301 * %o2: pointer to unsigned long bytes_read
302 *
303 * returns %o0: status
304 */
305 .globl sun4v_con_read
306 .type sun4v_con_read,#function
307sun4v_con_read:
308 mov %o2, %o4
309 mov HV_FAST_CONS_READ, %o5
310 ta HV_FAST_TRAP
311 brnz %o0, 1f
312 cmp %o1, -1 /* break */
313 be,a,pn %icc, 1f
314 mov %o1, %o0
315 cmp %o1, -2 /* hup */
316 be,a,pn %icc, 1f
317 mov %o1, %o0
318 stx %o1, [%o4]
3191: retl
320 nop
321 .size sun4v_con_read, .-sun4v_con_read
322
323 /* %o0: buffer real address
324 * %o1: buffer size
325 * %o2: pointer to unsigned long bytes_written
326 *
327 * returns %o0: status
328 */
329 .globl sun4v_con_write
330 .type sun4v_con_write,#function
331sun4v_con_write:
332 mov %o2, %o4
333 mov HV_FAST_CONS_WRITE, %o5
334 ta HV_FAST_TRAP
335 stx %o1, [%o4]
336 retl
337 nop
338 .size sun4v_con_write, .-sun4v_con_write
339
340 /* %o0: soft state
341 * %o1: address of description string
342 *
343 * returns %o0: status
344 */
345 .globl sun4v_mach_set_soft_state
346 .type sun4v_mach_set_soft_state,#function
347sun4v_mach_set_soft_state:
348 mov HV_FAST_MACH_SET_SOFT_STATE, %o5
349 ta HV_FAST_TRAP
350 retl
351 nop
352 .size sun4v_mach_set_soft_state, .-sun4v_mach_set_soft_state
353
354 /* %o0: exit code
355 *
356 * Does not return.
357 */
358 .globl sun4v_mach_exit
359 .type sun4v_mach_exit,#function
360sun4v_mach_exit:
361 mov HV_FAST_MACH_EXIT, %o5
362 ta HV_FAST_TRAP
363 retl
364 nop
365 .size sun4v_mach_exit, .-sun4v_mach_exit
366
367 /* %o0: buffer real address
368 * %o1: buffer length
369 * %o2: pointer to unsigned long real_buf_len
370 *
371 * returns %o0: status
372 */
373 .globl sun4v_mach_desc
374 .type sun4v_mach_desc,#function
375sun4v_mach_desc:
376 mov %o2, %o4
377 mov HV_FAST_MACH_DESC, %o5
378 ta HV_FAST_TRAP
379 stx %o1, [%o4]
380 retl
381 nop
382 .size sun4v_mach_desc, .-sun4v_mach_desc
383
384 /* %o0: new timeout in milliseconds
385 * %o1: pointer to unsigned long orig_timeout
386 *
387 * returns %o0: status
388 */
389 .globl sun4v_mach_set_watchdog
390 .type sun4v_mach_set_watchdog,#function
391sun4v_mach_set_watchdog:
392 mov %o1, %o4
393 mov HV_FAST_MACH_SET_WATCHDOG, %o5
394 ta HV_FAST_TRAP
395 stx %o1, [%o4]
396 retl
397 nop
398 .size sun4v_mach_set_watchdog, .-sun4v_mach_set_watchdog
399
400 /* No inputs and does not return. */
401 .globl sun4v_mach_sir
402 .type sun4v_mach_sir,#function
403sun4v_mach_sir:
404 mov %o1, %o4
405 mov HV_FAST_MACH_SIR, %o5
406 ta HV_FAST_TRAP
407 stx %o1, [%o4]
408 retl
409 nop
410 .size sun4v_mach_sir, .-sun4v_mach_sir
411
412 /* %o0: channel
413 * %o1: ra
414 * %o2: num_entries
415 *
416 * returns %o0: status
417 */
418 .globl sun4v_ldc_tx_qconf
419 .type sun4v_ldc_tx_qconf,#function
420sun4v_ldc_tx_qconf:
421 mov HV_FAST_LDC_TX_QCONF, %o5
422 ta HV_FAST_TRAP
423 retl
424 nop
425 .size sun4v_ldc_tx_qconf, .-sun4v_ldc_tx_qconf
426
427 /* %o0: channel
428 * %o1: pointer to unsigned long ra
429 * %o2: pointer to unsigned long num_entries
430 *
431 * returns %o0: status
432 */
433 .globl sun4v_ldc_tx_qinfo
434 .type sun4v_ldc_tx_qinfo,#function
435sun4v_ldc_tx_qinfo:
436 mov %o1, %g1
437 mov %o2, %g2
438 mov HV_FAST_LDC_TX_QINFO, %o5
439 ta HV_FAST_TRAP
440 stx %o1, [%g1]
441 stx %o2, [%g2]
442 retl
443 nop
444 .size sun4v_ldc_tx_qinfo, .-sun4v_ldc_tx_qinfo
445
446 /* %o0: channel
447 * %o1: pointer to unsigned long head_off
448 * %o2: pointer to unsigned long tail_off
449 * %o2: pointer to unsigned long chan_state
450 *
451 * returns %o0: status
452 */
453 .globl sun4v_ldc_tx_get_state
454 .type sun4v_ldc_tx_get_state,#function
455sun4v_ldc_tx_get_state:
456 mov %o1, %g1
457 mov %o2, %g2
458 mov %o3, %g3
459 mov HV_FAST_LDC_TX_GET_STATE, %o5
460 ta HV_FAST_TRAP
461 stx %o1, [%g1]
462 stx %o2, [%g2]
463 stx %o3, [%g3]
464 retl
465 nop
466 .size sun4v_ldc_tx_get_state, .-sun4v_ldc_tx_get_state
467
468 /* %o0: channel
469 * %o1: tail_off
470 *
471 * returns %o0: status
472 */
473 .globl sun4v_ldc_tx_set_qtail
474 .type sun4v_ldc_tx_set_qtail,#function
475sun4v_ldc_tx_set_qtail:
476 mov HV_FAST_LDC_TX_SET_QTAIL, %o5
477 ta HV_FAST_TRAP
478 retl
479 nop
480 .size sun4v_ldc_tx_set_qtail, .-sun4v_ldc_tx_set_qtail
481
482 /* %o0: channel
483 * %o1: ra
484 * %o2: num_entries
485 *
486 * returns %o0: status
487 */
488 .globl sun4v_ldc_rx_qconf
489 .type sun4v_ldc_rx_qconf,#function
490sun4v_ldc_rx_qconf:
491 mov HV_FAST_LDC_RX_QCONF, %o5
492 ta HV_FAST_TRAP
493 retl
494 nop
495 .size sun4v_ldc_rx_qconf, .-sun4v_ldc_rx_qconf
496
497 /* %o0: channel
498 * %o1: pointer to unsigned long ra
499 * %o2: pointer to unsigned long num_entries
500 *
501 * returns %o0: status
502 */
503 .globl sun4v_ldc_rx_qinfo
504 .type sun4v_ldc_rx_qinfo,#function
505sun4v_ldc_rx_qinfo:
506 mov %o1, %g1
507 mov %o2, %g2
508 mov HV_FAST_LDC_RX_QINFO, %o5
509 ta HV_FAST_TRAP
510 stx %o1, [%g1]
511 stx %o2, [%g2]
512 retl
513 nop
514 .size sun4v_ldc_rx_qinfo, .-sun4v_ldc_rx_qinfo
515
516 /* %o0: channel
517 * %o1: pointer to unsigned long head_off
518 * %o2: pointer to unsigned long tail_off
519 * %o2: pointer to unsigned long chan_state
520 *
521 * returns %o0: status
522 */
523 .globl sun4v_ldc_rx_get_state
524 .type sun4v_ldc_rx_get_state,#function
525sun4v_ldc_rx_get_state:
526 mov %o1, %g1
527 mov %o2, %g2
528 mov %o3, %g3
529 mov HV_FAST_LDC_RX_GET_STATE, %o5
530 ta HV_FAST_TRAP
531 stx %o1, [%g1]
532 stx %o2, [%g2]
533 stx %o3, [%g3]
534 retl
535 nop
536 .size sun4v_ldc_rx_get_state, .-sun4v_ldc_rx_get_state
537
538 /* %o0: channel
539 * %o1: head_off
540 *
541 * returns %o0: status
542 */
543 .globl sun4v_ldc_rx_set_qhead
544 .type sun4v_ldc_rx_set_qhead,#function
545sun4v_ldc_rx_set_qhead:
546 mov HV_FAST_LDC_RX_SET_QHEAD, %o5
547 ta HV_FAST_TRAP
548 retl
549 nop
550 .size sun4v_ldc_rx_set_qhead, .-sun4v_ldc_rx_set_qhead
551
552 /* %o0: channel
553 * %o1: ra
554 * %o2: num_entries
555 *
556 * returns %o0: status
557 */
558 .globl sun4v_ldc_set_map_table
559 .type sun4v_ldc_set_map_table,#function
560sun4v_ldc_set_map_table:
561 mov HV_FAST_LDC_SET_MAP_TABLE, %o5
562 ta HV_FAST_TRAP
563 retl
564 nop
565 .size sun4v_ldc_set_map_table, .-sun4v_ldc_set_map_table
566
567 /* %o0: channel
568 * %o1: pointer to unsigned long ra
569 * %o2: pointer to unsigned long num_entries
570 *
571 * returns %o0: status
572 */
573 .globl sun4v_ldc_get_map_table
574 .type sun4v_ldc_get_map_table,#function
575sun4v_ldc_get_map_table:
576 mov %o1, %g1
577 mov %o2, %g2
578 mov HV_FAST_LDC_GET_MAP_TABLE, %o5
579 ta HV_FAST_TRAP
580 stx %o1, [%g1]
581 stx %o2, [%g2]
582 retl
583 nop
584 .size sun4v_ldc_get_map_table, .-sun4v_ldc_get_map_table
585
586 /* %o0: channel
587 * %o1: dir_code
588 * %o2: tgt_raddr
589 * %o3: lcl_raddr
590 * %o4: len
591 * %o5: pointer to unsigned long actual_len
592 *
593 * returns %o0: status
594 */
595 .globl sun4v_ldc_copy
596 .type sun4v_ldc_copy,#function
597sun4v_ldc_copy:
598 mov %o5, %g1
599 mov HV_FAST_LDC_COPY, %o5
600 ta HV_FAST_TRAP
601 stx %o1, [%g1]
602 retl
603 nop
604 .size sun4v_ldc_copy, .-sun4v_ldc_copy
605
606 /* %o0: channel
607 * %o1: cookie
608 * %o2: pointer to unsigned long ra
609 * %o3: pointer to unsigned long perm
610 *
611 * returns %o0: status
612 */
613 .globl sun4v_ldc_mapin
614 .type sun4v_ldc_mapin,#function
615sun4v_ldc_mapin:
616 mov %o2, %g1
617 mov %o3, %g2
618 mov HV_FAST_LDC_MAPIN, %o5
619 ta HV_FAST_TRAP
620 stx %o1, [%g1]
621 stx %o2, [%g2]
622 retl
623 nop
624 .size sun4v_ldc_mapin, .-sun4v_ldc_mapin
625
626 /* %o0: ra
627 *
628 * returns %o0: status
629 */
630 .globl sun4v_ldc_unmap
631 .type sun4v_ldc_unmap,#function
632sun4v_ldc_unmap:
633 mov HV_FAST_LDC_UNMAP, %o5
634 ta HV_FAST_TRAP
635 retl
636 nop
637 .size sun4v_ldc_unmap, .-sun4v_ldc_unmap
638
639 /* %o0: channel
640 * %o1: cookie
641 * %o2: mte_cookie
642 *
643 * returns %o0: status
644 */
645 .globl sun4v_ldc_revoke
646 .type sun4v_ldc_revoke,#function
647sun4v_ldc_revoke:
648 mov HV_FAST_LDC_REVOKE, %o5
649 ta HV_FAST_TRAP
650 retl
651 nop
652 .size sun4v_ldc_revoke, .-sun4v_ldc_revoke
653
654 /* %o0: device handle
655 * %o1: device INO
656 * %o2: pointer to unsigned long cookie
657 *
658 * returns %o0: status
659 */
660 .globl sun4v_vintr_get_cookie
661 .type sun4v_vintr_get_cookie,#function
662sun4v_vintr_get_cookie:
663 mov %o2, %g1
664 mov HV_FAST_VINTR_GET_COOKIE, %o5
665 ta HV_FAST_TRAP
666 stx %o1, [%g1]
667 retl
668 nop
669 .size sun4v_vintr_get_cookie, .-sun4v_vintr_get_cookie
670
671 /* %o0: device handle
672 * %o1: device INO
673 * %o2: cookie
674 *
675 * returns %o0: status
676 */
677 .globl sun4v_vintr_set_cookie
678 .type sun4v_vintr_set_cookie,#function
679sun4v_vintr_set_cookie:
680 mov HV_FAST_VINTR_SET_COOKIE, %o5
681 ta HV_FAST_TRAP
682 retl
683 nop
684 .size sun4v_vintr_set_cookie, .-sun4v_vintr_set_cookie
685
686 /* %o0: device handle
687 * %o1: device INO
688 * %o2: pointer to unsigned long valid_state
689 *
690 * returns %o0: status
691 */
692 .globl sun4v_vintr_get_valid
693 .type sun4v_vintr_get_valid,#function
694sun4v_vintr_get_valid:
695 mov %o2, %g1
696 mov HV_FAST_VINTR_GET_VALID, %o5
697 ta HV_FAST_TRAP
698 stx %o1, [%g1]
699 retl
700 nop
701 .size sun4v_vintr_get_valid, .-sun4v_vintr_get_valid
702
703 /* %o0: device handle
704 * %o1: device INO
705 * %o2: valid_state
706 *
707 * returns %o0: status
708 */
709 .globl sun4v_vintr_set_valid
710 .type sun4v_vintr_set_valid,#function
711sun4v_vintr_set_valid:
712 mov HV_FAST_VINTR_SET_VALID, %o5
713 ta HV_FAST_TRAP
714 retl
715 nop
716 .size sun4v_vintr_set_valid, .-sun4v_vintr_set_valid
717
718 /* %o0: device handle
719 * %o1: device INO
720 * %o2: pointer to unsigned long state
721 *
722 * returns %o0: status
723 */
724 .globl sun4v_vintr_get_state
725 .type sun4v_vintr_get_state,#function
726sun4v_vintr_get_state:
727 mov %o2, %g1
728 mov HV_FAST_VINTR_GET_STATE, %o5
729 ta HV_FAST_TRAP
730 stx %o1, [%g1]
731 retl
732 nop
733 .size sun4v_vintr_get_state, .-sun4v_vintr_get_state
734
735 /* %o0: device handle
736 * %o1: device INO
737 * %o2: state
738 *
739 * returns %o0: status
740 */
741 .globl sun4v_vintr_set_state
742 .type sun4v_vintr_set_state,#function
743sun4v_vintr_set_state:
744 mov HV_FAST_VINTR_SET_STATE, %o5
745 ta HV_FAST_TRAP
746 retl
747 nop
748 .size sun4v_vintr_set_state, .-sun4v_vintr_set_state
749
750 /* %o0: device handle
751 * %o1: device INO
752 * %o2: pointer to unsigned long cpuid
753 *
754 * returns %o0: status
755 */
756 .globl sun4v_vintr_get_target
757 .type sun4v_vintr_get_target,#function
758sun4v_vintr_get_target:
759 mov %o2, %g1
760 mov HV_FAST_VINTR_GET_TARGET, %o5
761 ta HV_FAST_TRAP
762 stx %o1, [%g1]
763 retl
764 nop
765 .size sun4v_vintr_get_target, .-sun4v_vintr_get_target
766
767 /* %o0: device handle
768 * %o1: device INO
769 * %o2: cpuid
770 *
771 * returns %o0: status
772 */
773 .globl sun4v_vintr_set_target
774 .type sun4v_vintr_set_target,#function
775sun4v_vintr_set_target:
776 mov HV_FAST_VINTR_SET_TARGET, %o5
777 ta HV_FAST_TRAP
778 retl
779 nop
780 .size sun4v_vintr_set_target, .-sun4v_vintr_set_target
781
782 /* %o0: NCS sub-function
783 * %o1: sub-function arg real-address
784 * %o2: sub-function arg size
785 *
786 * returns %o0: status
787 */
788 .globl sun4v_ncs_request
789 .type sun4v_ncs_request,#function
790sun4v_ncs_request:
791 mov HV_FAST_NCS_REQUEST, %o5
792 ta HV_FAST_TRAP
793 retl
794 nop
795 .size sun4v_ncs_request, .-sun4v_ncs_request
796
797 .globl sun4v_svc_send
798 .type sun4v_svc_send,#function
799sun4v_svc_send:
800 save %sp, -192, %sp
801 mov %i0, %o0
802 mov %i1, %o1
803 mov %i2, %o2
804 mov HV_FAST_SVC_SEND, %o5
805 ta HV_FAST_TRAP
806 stx %o1, [%i3]
807 ret
808 restore
809 .size sun4v_svc_send, .-sun4v_svc_send
810
811 .globl sun4v_svc_recv
812 .type sun4v_svc_recv,#function
813sun4v_svc_recv:
814 save %sp, -192, %sp
815 mov %i0, %o0
816 mov %i1, %o1
817 mov %i2, %o2
818 mov HV_FAST_SVC_RECV, %o5
819 ta HV_FAST_TRAP
820 stx %o1, [%i3]
821 ret
822 restore
823 .size sun4v_svc_recv, .-sun4v_svc_recv
824
825 .globl sun4v_svc_getstatus
826 .type sun4v_svc_getstatus,#function
827sun4v_svc_getstatus:
828 mov HV_FAST_SVC_GETSTATUS, %o5
829 mov %o1, %o4
830 ta HV_FAST_TRAP
831 stx %o1, [%o4]
832 retl
833 nop
834 .size sun4v_svc_getstatus, .-sun4v_svc_getstatus
835
836 .globl sun4v_svc_setstatus
837 .type sun4v_svc_setstatus,#function
838sun4v_svc_setstatus:
839 mov HV_FAST_SVC_SETSTATUS, %o5
840 ta HV_FAST_TRAP
841 retl
842 nop
843 .size sun4v_svc_setstatus, .-sun4v_svc_setstatus
844
845 .globl sun4v_svc_clrstatus
846 .type sun4v_svc_clrstatus,#function
847sun4v_svc_clrstatus:
848 mov HV_FAST_SVC_CLRSTATUS, %o5
849 ta HV_FAST_TRAP
850 retl
851 nop
852 .size sun4v_svc_clrstatus, .-sun4v_svc_clrstatus
853
854 .globl sun4v_mmustat_conf
855 .type sun4v_mmustat_conf,#function
856sun4v_mmustat_conf:
857 mov %o1, %o4
858 mov HV_FAST_MMUSTAT_CONF, %o5
859 ta HV_FAST_TRAP
860 stx %o1, [%o4]
861 retl
862 nop
863 .size sun4v_mmustat_conf, .-sun4v_mmustat_conf
864
865 .globl sun4v_mmustat_info
866 .type sun4v_mmustat_info,#function
867sun4v_mmustat_info:
868 mov %o0, %o4
869 mov HV_FAST_MMUSTAT_INFO, %o5
870 ta HV_FAST_TRAP
871 stx %o1, [%o4]
872 retl
873 nop
874 .size sun4v_mmustat_info, .-sun4v_mmustat_info
875
876 .globl sun4v_mmu_demap_all
877 .type sun4v_mmu_demap_all,#function
878sun4v_mmu_demap_all:
879 clr %o0
880 clr %o1
881 mov HV_MMU_ALL, %o2
882 mov HV_FAST_MMU_DEMAP_ALL, %o5
883 ta HV_FAST_TRAP
884 retl
885 nop
886 .size sun4v_mmu_demap_all, .-sun4v_mmu_demap_all
diff --git a/arch/sparc64/kernel/ivec.S b/arch/sparc64/kernel/ivec.S
new file mode 100644
index 000000000000..d29f92ebca5e
--- /dev/null
+++ b/arch/sparc64/kernel/ivec.S
@@ -0,0 +1,51 @@
1 /* The registers for cross calls will be:
2 *
3 * DATA 0: [low 32-bits] Address of function to call, jmp to this
4 * [high 32-bits] MMU Context Argument 0, place in %g5
5 * DATA 1: Address Argument 1, place in %g1
6 * DATA 2: Address Argument 2, place in %g7
7 *
8 * With this method we can do most of the cross-call tlb/cache
9 * flushing very quickly.
10 */
11 .align 32
12 .globl do_ivec
13 .type do_ivec,#function
14do_ivec:
15 mov 0x40, %g3
16 ldxa [%g3 + %g0] ASI_INTR_R, %g3
17 sethi %hi(KERNBASE), %g4
18 cmp %g3, %g4
19 bgeu,pn %xcc, do_ivec_xcall
20 srlx %g3, 32, %g5
21 stxa %g0, [%g0] ASI_INTR_RECEIVE
22 membar #Sync
23
24 sethi %hi(ivector_table_pa), %g2
25 ldx [%g2 + %lo(ivector_table_pa)], %g2
26 sllx %g3, 4, %g3
27 add %g2, %g3, %g3
28
29 TRAP_LOAD_IRQ_WORK_PA(%g6, %g1)
30
31 ldx [%g6], %g5
32 stxa %g5, [%g3] ASI_PHYS_USE_EC
33 stx %g3, [%g6]
34 wr %g0, 1 << PIL_DEVICE_IRQ, %set_softint
35 retry
36do_ivec_xcall:
37 mov 0x50, %g1
38 ldxa [%g1 + %g0] ASI_INTR_R, %g1
39 srl %g3, 0, %g3
40
41 mov 0x60, %g7
42 ldxa [%g7 + %g0] ASI_INTR_R, %g7
43 stxa %g0, [%g0] ASI_INTR_RECEIVE
44 membar #Sync
45 ba,pt %xcc, 1f
46 nop
47
48 .align 32
491: jmpl %g3, %g0
50 nop
51 .size do_ivec,.-do_ivec
diff --git a/arch/sparc64/kernel/kgdb.c b/arch/sparc64/kernel/kgdb.c
new file mode 100644
index 000000000000..fefbe6dc51be
--- /dev/null
+++ b/arch/sparc64/kernel/kgdb.c
@@ -0,0 +1,186 @@
1/* kgdb.c: KGDB support for 64-bit sparc.
2 *
3 * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
4 */
5
6#include <linux/kgdb.h>
7#include <linux/kdebug.h>
8
9#include <asm/kdebug.h>
10#include <asm/ptrace.h>
11#include <asm/irq.h>
12
13void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
14{
15 struct reg_window *win;
16 int i;
17
18 gdb_regs[GDB_G0] = 0;
19 for (i = 0; i < 15; i++)
20 gdb_regs[GDB_G1 + i] = regs->u_regs[UREG_G1 + i];
21
22 win = (struct reg_window *) (regs->u_regs[UREG_FP] + STACK_BIAS);
23 for (i = 0; i < 8; i++)
24 gdb_regs[GDB_L0 + i] = win->locals[i];
25 for (i = 0; i < 8; i++)
26 gdb_regs[GDB_I0 + i] = win->ins[i];
27
28 for (i = GDB_F0; i <= GDB_F62; i++)
29 gdb_regs[i] = 0;
30
31 gdb_regs[GDB_PC] = regs->tpc;
32 gdb_regs[GDB_NPC] = regs->tnpc;
33 gdb_regs[GDB_STATE] = regs->tstate;
34 gdb_regs[GDB_FSR] = 0;
35 gdb_regs[GDB_FPRS] = 0;
36 gdb_regs[GDB_Y] = regs->y;
37}
38
39void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
40{
41 struct thread_info *t = task_thread_info(p);
42 extern unsigned int switch_to_pc;
43 extern unsigned int ret_from_syscall;
44 struct reg_window *win;
45 unsigned long pc, cwp;
46 int i;
47
48 for (i = GDB_G0; i < GDB_G6; i++)
49 gdb_regs[i] = 0;
50 gdb_regs[GDB_G6] = (unsigned long) t;
51 gdb_regs[GDB_G7] = (unsigned long) p;
52 for (i = GDB_O0; i < GDB_SP; i++)
53 gdb_regs[i] = 0;
54 gdb_regs[GDB_SP] = t->ksp;
55 gdb_regs[GDB_O7] = 0;
56
57 win = (struct reg_window *) (t->ksp + STACK_BIAS);
58 for (i = 0; i < 8; i++)
59 gdb_regs[GDB_L0 + i] = win->locals[i];
60 for (i = 0; i < 8; i++)
61 gdb_regs[GDB_I0 + i] = win->ins[i];
62
63 for (i = GDB_F0; i <= GDB_F62; i++)
64 gdb_regs[i] = 0;
65
66 if (t->new_child)
67 pc = (unsigned long) &ret_from_syscall;
68 else
69 pc = (unsigned long) &switch_to_pc;
70
71 gdb_regs[GDB_PC] = pc;
72 gdb_regs[GDB_NPC] = pc + 4;
73
74 cwp = __thread_flag_byte_ptr(t)[TI_FLAG_BYTE_CWP];
75
76 gdb_regs[GDB_STATE] = (TSTATE_PRIV | TSTATE_IE | cwp);
77 gdb_regs[GDB_FSR] = 0;
78 gdb_regs[GDB_FPRS] = 0;
79 gdb_regs[GDB_Y] = 0;
80}
81
82void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
83{
84 struct reg_window *win;
85 int i;
86
87 for (i = 0; i < 15; i++)
88 regs->u_regs[UREG_G1 + i] = gdb_regs[GDB_G1 + i];
89
90 /* If the TSTATE register is changing, we have to preserve
91 * the CWP field, otherwise window save/restore explodes.
92 */
93 if (regs->tstate != gdb_regs[GDB_STATE]) {
94 unsigned long cwp = regs->tstate & TSTATE_CWP;
95
96 regs->tstate = (gdb_regs[GDB_STATE] & ~TSTATE_CWP) | cwp;
97 }
98
99 regs->tpc = gdb_regs[GDB_PC];
100 regs->tnpc = gdb_regs[GDB_NPC];
101 regs->y = gdb_regs[GDB_Y];
102
103 win = (struct reg_window *) (regs->u_regs[UREG_FP] + STACK_BIAS);
104 for (i = 0; i < 8; i++)
105 win->locals[i] = gdb_regs[GDB_L0 + i];
106 for (i = 0; i < 8; i++)
107 win->ins[i] = gdb_regs[GDB_I0 + i];
108}
109
110#ifdef CONFIG_SMP
111void smp_kgdb_capture_client(struct pt_regs *regs)
112{
113 unsigned long flags;
114
115 __asm__ __volatile__("rdpr %%pstate, %0\n\t"
116 "wrpr %0, %1, %%pstate"
117 : "=r" (flags)
118 : "i" (PSTATE_IE));
119
120 flushw_all();
121
122 if (atomic_read(&kgdb_active) != -1)
123 kgdb_nmicallback(raw_smp_processor_id(), regs);
124
125 __asm__ __volatile__("wrpr %0, 0, %%pstate"
126 : : "r" (flags));
127}
128#endif
129
130int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
131 char *remcomInBuffer, char *remcomOutBuffer,
132 struct pt_regs *linux_regs)
133{
134 unsigned long addr;
135 char *ptr;
136
137 switch (remcomInBuffer[0]) {
138 case 'c':
139 /* try to read optional parameter, pc unchanged if no parm */
140 ptr = &remcomInBuffer[1];
141 if (kgdb_hex2long(&ptr, &addr)) {
142 linux_regs->tpc = addr;
143 linux_regs->tnpc = addr + 4;
144 }
145 /* fallthru */
146
147 case 'D':
148 case 'k':
149 if (linux_regs->tpc == (unsigned long) arch_kgdb_breakpoint) {
150 linux_regs->tpc = linux_regs->tnpc;
151 linux_regs->tnpc += 4;
152 }
153 return 0;
154 }
155 return -1;
156}
157
158asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs)
159{
160 unsigned long flags;
161
162 if (user_mode(regs)) {
163 bad_trap(regs, trap_level);
164 return;
165 }
166
167 flushw_all();
168
169 local_irq_save(flags);
170 kgdb_handle_exception(0x172, SIGTRAP, 0, regs);
171 local_irq_restore(flags);
172}
173
174int kgdb_arch_init(void)
175{
176 return 0;
177}
178
179void kgdb_arch_exit(void)
180{
181}
182
183struct kgdb_arch arch_kgdb_ops = {
184 /* Breakpoint instruction: ta 0x72 */
185 .gdb_bpt_instr = { 0x91, 0xd0, 0x20, 0x72 },
186};
diff --git a/arch/sparc64/kernel/misctrap.S b/arch/sparc64/kernel/misctrap.S
new file mode 100644
index 000000000000..753b4f031bfb
--- /dev/null
+++ b/arch/sparc64/kernel/misctrap.S
@@ -0,0 +1,97 @@
1#ifdef CONFIG_KGDB
2 .globl arch_kgdb_breakpoint
3 .type arch_kgdb_breakpoint,#function
4arch_kgdb_breakpoint:
5 ta 0x72
6 retl
7 nop
8 .size arch_kgdb_breakpoint,.-arch_kgdb_breakpoint
9#endif
10
11 .type __do_privact,#function
12__do_privact:
13 mov TLB_SFSR, %g3
14 stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit
15 membar #Sync
16 sethi %hi(109f), %g7
17 ba,pt %xcc, etrap
18109: or %g7, %lo(109b), %g7
19 call do_privact
20 add %sp, PTREGS_OFF, %o0
21 ba,pt %xcc, rtrap
22 nop
23 .size __do_privact,.-__do_privact
24
25 .type do_mna,#function
26do_mna:
27 rdpr %tl, %g3
28 cmp %g3, 1
29
30 /* Setup %g4/%g5 now as they are used in the
31 * winfixup code.
32 */
33 mov TLB_SFSR, %g3
34 mov DMMU_SFAR, %g4
35 ldxa [%g4] ASI_DMMU, %g4
36 ldxa [%g3] ASI_DMMU, %g5
37 stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit
38 membar #Sync
39 bgu,pn %icc, winfix_mna
40 rdpr %tpc, %g3
41
421: sethi %hi(109f), %g7
43 ba,pt %xcc, etrap
44109: or %g7, %lo(109b), %g7
45 mov %l4, %o1
46 mov %l5, %o2
47 call mem_address_unaligned
48 add %sp, PTREGS_OFF, %o0
49 ba,pt %xcc, rtrap
50 nop
51 .size do_mna,.-do_mna
52
53 .type do_lddfmna,#function
54do_lddfmna:
55 sethi %hi(109f), %g7
56 mov TLB_SFSR, %g4
57 ldxa [%g4] ASI_DMMU, %g5
58 stxa %g0, [%g4] ASI_DMMU ! Clear FaultValid bit
59 membar #Sync
60 mov DMMU_SFAR, %g4
61 ldxa [%g4] ASI_DMMU, %g4
62 ba,pt %xcc, etrap
63109: or %g7, %lo(109b), %g7
64 mov %l4, %o1
65 mov %l5, %o2
66 call handle_lddfmna
67 add %sp, PTREGS_OFF, %o0
68 ba,pt %xcc, rtrap
69 nop
70 .size do_lddfmna,.-do_lddfmna
71
72 .type do_stdfmna,#function
73do_stdfmna:
74 sethi %hi(109f), %g7
75 mov TLB_SFSR, %g4
76 ldxa [%g4] ASI_DMMU, %g5
77 stxa %g0, [%g4] ASI_DMMU ! Clear FaultValid bit
78 membar #Sync
79 mov DMMU_SFAR, %g4
80 ldxa [%g4] ASI_DMMU, %g4
81 ba,pt %xcc, etrap
82109: or %g7, %lo(109b), %g7
83 mov %l4, %o1
84 mov %l5, %o2
85 call handle_stdfmna
86 add %sp, PTREGS_OFF, %o0
87 ba,pt %xcc, rtrap
88 nop
89 .size do_stdfmna,.-do_stdfmna
90
91 .type breakpoint_trap,#function
92breakpoint_trap:
93 call sparc_breakpoint
94 add %sp, PTREGS_OFF, %o0
95 ba,pt %xcc, rtrap
96 nop
97 .size breakpoint_trap,.-breakpoint_trap
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index dbf2fc2f4d87..112b09f16f36 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -350,8 +350,7 @@ static void pci_parse_of_addrs(struct of_device *op,
350 350
351struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, 351struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
352 struct device_node *node, 352 struct device_node *node,
353 struct pci_bus *bus, int devfn, 353 struct pci_bus *bus, int devfn)
354 int host_controller)
355{ 354{
356 struct dev_archdata *sd; 355 struct dev_archdata *sd;
357 struct pci_dev *dev; 356 struct pci_dev *dev;
@@ -390,43 +389,28 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
390 dev->devfn = devfn; 389 dev->devfn = devfn;
391 dev->multifunction = 0; /* maybe a lie? */ 390 dev->multifunction = 0; /* maybe a lie? */
392 391
393 if (host_controller) { 392 dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff);
394 if (tlb_type != hypervisor) { 393 dev->device = of_getintprop_default(node, "device-id", 0xffff);
395 pci_read_config_word(dev, PCI_VENDOR_ID, 394 dev->subsystem_vendor =
396 &dev->vendor); 395 of_getintprop_default(node, "subsystem-vendor-id", 0);
397 pci_read_config_word(dev, PCI_DEVICE_ID, 396 dev->subsystem_device =
398 &dev->device); 397 of_getintprop_default(node, "subsystem-id", 0);
399 } else { 398
400 dev->vendor = PCI_VENDOR_ID_SUN; 399 dev->cfg_size = pci_cfg_space_size(dev);
401 dev->device = 0x80f0; 400
402 } 401 /* We can't actually use the firmware value, we have
403 dev->cfg_size = 256; 402 * to read what is in the register right now. One
404 dev->class = PCI_CLASS_BRIDGE_HOST << 8; 403 * reason is that in the case of IDE interfaces the
405 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), 404 * firmware can sample the value before the the IDE
406 0x00, PCI_SLOT(devfn), PCI_FUNC(devfn)); 405 * interface is programmed into native mode.
407 } else { 406 */
408 dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff); 407 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
409 dev->device = of_getintprop_default(node, "device-id", 0xffff); 408 dev->class = class >> 8;
410 dev->subsystem_vendor = 409 dev->revision = class & 0xff;
411 of_getintprop_default(node, "subsystem-vendor-id", 0); 410
412 dev->subsystem_device = 411 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
413 of_getintprop_default(node, "subsystem-id", 0); 412 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
414
415 dev->cfg_size = pci_cfg_space_size(dev);
416
417 /* We can't actually use the firmware value, we have
418 * to read what is in the register right now. One
419 * reason is that in the case of IDE interfaces the
420 * firmware can sample the value before the the IDE
421 * interface is programmed into native mode.
422 */
423 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
424 dev->class = class >> 8;
425 dev->revision = class & 0xff;
426 413
427 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
428 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
429 }
430 if (ofpci_verbose) 414 if (ofpci_verbose)
431 printk(" class: 0x%x device name: %s\n", 415 printk(" class: 0x%x device name: %s\n",
432 dev->class, pci_name(dev)); 416 dev->class, pci_name(dev));
@@ -441,26 +425,21 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
441 dev->current_state = 4; /* unknown power state */ 425 dev->current_state = 4; /* unknown power state */
442 dev->error_state = pci_channel_io_normal; 426 dev->error_state = pci_channel_io_normal;
443 427
444 if (host_controller) { 428 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
429 /* a PCI-PCI bridge */
445 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; 430 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
446 dev->rom_base_reg = PCI_ROM_ADDRESS1; 431 dev->rom_base_reg = PCI_ROM_ADDRESS1;
447 dev->irq = PCI_IRQ_NONE; 432 } else if (!strcmp(type, "cardbus")) {
433 dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;
448 } else { 434 } else {
449 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 435 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
450 /* a PCI-PCI bridge */ 436 dev->rom_base_reg = PCI_ROM_ADDRESS;
451 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
452 dev->rom_base_reg = PCI_ROM_ADDRESS1;
453 } else if (!strcmp(type, "cardbus")) {
454 dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;
455 } else {
456 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
457 dev->rom_base_reg = PCI_ROM_ADDRESS;
458 437
459 dev->irq = sd->op->irqs[0]; 438 dev->irq = sd->op->irqs[0];
460 if (dev->irq == 0xffffffff) 439 if (dev->irq == 0xffffffff)
461 dev->irq = PCI_IRQ_NONE; 440 dev->irq = PCI_IRQ_NONE;
462 }
463 } 441 }
442
464 pci_parse_of_addrs(sd->op, node, dev); 443 pci_parse_of_addrs(sd->op, node, dev);
465 444
466 if (ofpci_verbose) 445 if (ofpci_verbose)
@@ -749,7 +728,7 @@ static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm,
749 prev_devfn = devfn; 728 prev_devfn = devfn;
750 729
751 /* create a new pci_dev for this device */ 730 /* create a new pci_dev for this device */
752 dev = of_create_pci_dev(pbm, child, bus, devfn, 0); 731 dev = of_create_pci_dev(pbm, child, bus, devfn);
753 if (!dev) 732 if (!dev)
754 continue; 733 continue;
755 if (ofpci_verbose) 734 if (ofpci_verbose)
@@ -796,48 +775,9 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus)
796 pci_bus_register_of_sysfs(child_bus); 775 pci_bus_register_of_sysfs(child_bus);
797} 776}
798 777
799int pci_host_bridge_read_pci_cfg(struct pci_bus *bus_dev,
800 unsigned int devfn,
801 int where, int size,
802 u32 *value)
803{
804 static u8 fake_pci_config[] = {
805 0x8e, 0x10, /* Vendor: 0x108e (Sun) */
806 0xf0, 0x80, /* Device: 0x80f0 (Fire) */
807 0x46, 0x01, /* Command: 0x0146 (SERR, PARITY, MASTER, MEM) */
808 0xa0, 0x22, /* Status: 0x02a0 (DEVSEL_MED, FB2B, 66MHZ) */
809 0x00, 0x00, 0x00, 0x06, /* Class: 0x06000000 host bridge */
810 0x00, /* Cacheline: 0x00 */
811 0x40, /* Latency: 0x40 */
812 0x00, /* Header-Type: 0x00 normal */
813 };
814
815 *value = 0;
816 if (where >= 0 && where < sizeof(fake_pci_config) &&
817 (where + size) >= 0 &&
818 (where + size) < sizeof(fake_pci_config) &&
819 size <= sizeof(u32)) {
820 while (size--) {
821 *value <<= 8;
822 *value |= fake_pci_config[where + size];
823 }
824 }
825
826 return PCIBIOS_SUCCESSFUL;
827}
828
829int pci_host_bridge_write_pci_cfg(struct pci_bus *bus_dev,
830 unsigned int devfn,
831 int where, int size,
832 u32 value)
833{
834 return PCIBIOS_SUCCESSFUL;
835}
836
837struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) 778struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm)
838{ 779{
839 struct device_node *node = pbm->prom_node; 780 struct device_node *node = pbm->prom_node;
840 struct pci_dev *host_pdev;
841 struct pci_bus *bus; 781 struct pci_bus *bus;
842 782
843 printk("PCI: Scanning PBM %s\n", node->full_name); 783 printk("PCI: Scanning PBM %s\n", node->full_name);
@@ -855,10 +795,6 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm)
855 bus->resource[0] = &pbm->io_space; 795 bus->resource[0] = &pbm->io_space;
856 bus->resource[1] = &pbm->mem_space; 796 bus->resource[1] = &pbm->mem_space;
857 797
858 /* Create the dummy host bridge and link it in. */
859 host_pdev = of_create_pci_dev(pbm, node, bus, 0x00, 1);
860 bus->self = host_pdev;
861
862 pci_of_scan_bus(pbm, node, bus); 798 pci_of_scan_bus(pbm, node, bus);
863 pci_bus_add_devices(bus); 799 pci_bus_add_devices(bus);
864 pci_bus_register_of_sysfs(bus); 800 pci_bus_register_of_sysfs(bus);
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index 923e0bcc3bfd..19fa621d6a60 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -264,9 +264,6 @@ static int sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
264 unsigned int func = PCI_FUNC(devfn); 264 unsigned int func = PCI_FUNC(devfn);
265 unsigned long ret; 265 unsigned long ret;
266 266
267 if (!bus && devfn == 0x00)
268 return pci_host_bridge_read_pci_cfg(bus_dev, devfn, where,
269 size, value);
270 if (config_out_of_range(pbm, bus, devfn, where)) { 267 if (config_out_of_range(pbm, bus, devfn, where)) {
271 ret = ~0UL; 268 ret = ~0UL;
272 } else { 269 } else {
@@ -300,9 +297,6 @@ static int sun4v_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
300 unsigned int func = PCI_FUNC(devfn); 297 unsigned int func = PCI_FUNC(devfn);
301 unsigned long ret; 298 unsigned long ret;
302 299
303 if (!bus && devfn == 0x00)
304 return pci_host_bridge_write_pci_cfg(bus_dev, devfn, where,
305 size, value);
306 if (config_out_of_range(pbm, bus, devfn, where)) { 300 if (config_out_of_range(pbm, bus, devfn, where)) {
307 /* Do nothing. */ 301 /* Do nothing. */
308 } else { 302 } else {
diff --git a/arch/sparc64/kernel/pci_impl.h b/arch/sparc64/kernel/pci_impl.h
index 218bac4ff79b..c385d126be11 100644
--- a/arch/sparc64/kernel/pci_impl.h
+++ b/arch/sparc64/kernel/pci_impl.h
@@ -167,15 +167,6 @@ extern void pci_get_pbm_props(struct pci_pbm_info *pbm);
167extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm); 167extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm);
168extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); 168extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm);
169 169
170extern int pci_host_bridge_read_pci_cfg(struct pci_bus *bus_dev,
171 unsigned int devfn,
172 int where, int size,
173 u32 *value);
174extern int pci_host_bridge_write_pci_cfg(struct pci_bus *bus_dev,
175 unsigned int devfn,
176 int where, int size,
177 u32 value);
178
179/* Error reporting support. */ 170/* Error reporting support. */
180extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *); 171extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *);
181extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *); 172extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *);
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 056013749157..500ac6d483a0 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -591,12 +591,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
591 if (clone_flags & CLONE_SETTLS) 591 if (clone_flags & CLONE_SETTLS)
592 t->kregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3]; 592 t->kregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3];
593 593
594 /* We do not want to accidently trigger system call restart
595 * handling in the new thread. Therefore, clear out the trap
596 * type, which will make pt_regs_regs_is_syscall() return false.
597 */
598 pt_regs_clear_trap_type(t->kregs);
599
600 return 0; 594 return 0;
601} 595}
602 596
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index f2d88d8f7a42..45d6bf632daa 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -332,6 +332,9 @@ void do_rt_sigreturn(struct pt_regs *regs)
332 regs->tpc = tpc; 332 regs->tpc = tpc;
333 regs->tnpc = tnpc; 333 regs->tnpc = tnpc;
334 334
335 /* Prevent syscall restart. */
336 pt_regs_clear_trap_type(regs);
337
335 sigdelsetmask(&set, ~_BLOCKABLE); 338 sigdelsetmask(&set, ~_BLOCKABLE);
336 spin_lock_irq(&current->sighand->siglock); 339 spin_lock_irq(&current->sighand->siglock);
337 current->blocked = set; 340 current->blocked = set;
@@ -515,7 +518,8 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
515 siginfo_t info; 518 siginfo_t info;
516 int signr; 519 int signr;
517 520
518 if (pt_regs_is_syscall(regs)) { 521 if (pt_regs_is_syscall(regs) &&
522 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
519 pt_regs_clear_trap_type(regs); 523 pt_regs_clear_trap_type(regs);
520 cookie.restart_syscall = 1; 524 cookie.restart_syscall = 1;
521 } else 525 } else
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 91f8d0826db1..9415d2c918c5 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -268,6 +268,9 @@ void do_sigreturn32(struct pt_regs *regs)
268 regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC); 268 regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC);
269 regs->tstate |= psr_to_tstate_icc(psr); 269 regs->tstate |= psr_to_tstate_icc(psr);
270 270
271 /* Prevent syscall restart. */
272 pt_regs_clear_trap_type(regs);
273
271 err |= __get_user(fpu_save, &sf->fpu_save); 274 err |= __get_user(fpu_save, &sf->fpu_save);
272 if (fpu_save) 275 if (fpu_save)
273 err |= restore_fpu_state32(regs, &sf->fpu_state); 276 err |= restore_fpu_state32(regs, &sf->fpu_state);
@@ -351,6 +354,9 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
351 regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC); 354 regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC);
352 regs->tstate |= psr_to_tstate_icc(psr); 355 regs->tstate |= psr_to_tstate_icc(psr);
353 356
357 /* Prevent syscall restart. */
358 pt_regs_clear_trap_type(regs);
359
354 err |= __get_user(fpu_save, &sf->fpu_save); 360 err |= __get_user(fpu_save, &sf->fpu_save);
355 if (fpu_save) 361 if (fpu_save)
356 err |= restore_fpu_state32(regs, &sf->fpu_state); 362 err |= restore_fpu_state32(regs, &sf->fpu_state);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 409dd71f2738..3aba47624df4 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -38,7 +38,6 @@
38#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <asm/oplib.h> 39#include <asm/oplib.h>
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <asm/timer.h>
42#include <asm/starfire.h> 41#include <asm/starfire.h>
43#include <asm/tlb.h> 42#include <asm/tlb.h>
44#include <asm/sections.h> 43#include <asm/sections.h>
@@ -910,6 +909,9 @@ extern unsigned long xcall_flush_tlb_kernel_range;
910extern unsigned long xcall_report_regs; 909extern unsigned long xcall_report_regs;
911extern unsigned long xcall_receive_signal; 910extern unsigned long xcall_receive_signal;
912extern unsigned long xcall_new_mmu_context_version; 911extern unsigned long xcall_new_mmu_context_version;
912#ifdef CONFIG_KGDB
913extern unsigned long xcall_kgdb_capture;
914#endif
913 915
914#ifdef DCACHE_ALIASING_POSSIBLE 916#ifdef DCACHE_ALIASING_POSSIBLE
915extern unsigned long xcall_flush_dcache_page_cheetah; 917extern unsigned long xcall_flush_dcache_page_cheetah;
@@ -1079,6 +1081,13 @@ void smp_new_mmu_context_version(void)
1079 smp_cross_call(&xcall_new_mmu_context_version, 0, 0, 0); 1081 smp_cross_call(&xcall_new_mmu_context_version, 0, 0, 0);
1080} 1082}
1081 1083
1084#ifdef CONFIG_KGDB
1085void kgdb_roundup_cpus(unsigned long flags)
1086{
1087 smp_cross_call(&xcall_kgdb_capture, 0, 0, 0);
1088}
1089#endif
1090
1082void smp_report_regs(void) 1091void smp_report_regs(void)
1083{ 1092{
1084 smp_cross_call(&xcall_report_regs, 0, 0, 0); 1093 smp_cross_call(&xcall_report_regs, 0, 0, 0);
diff --git a/arch/sparc64/kernel/spiterrs.S b/arch/sparc64/kernel/spiterrs.S
new file mode 100644
index 000000000000..ef902c6f8e3c
--- /dev/null
+++ b/arch/sparc64/kernel/spiterrs.S
@@ -0,0 +1,245 @@
1 /* We need to carefully read the error status, ACK the errors,
2 * prevent recursive traps, and pass the information on to C
3 * code for logging.
4 *
5 * We pass the AFAR in as-is, and we encode the status
6 * information as described in asm-sparc64/sfafsr.h
7 */
8 .type __spitfire_access_error,#function
9__spitfire_access_error:
10 /* Disable ESTATE error reporting so that we do not take
11 * recursive traps and RED state the processor.
12 */
13 stxa %g0, [%g0] ASI_ESTATE_ERROR_EN
14 membar #Sync
15
16 mov UDBE_UE, %g1
17 ldxa [%g0] ASI_AFSR, %g4 ! Get AFSR
18
19 /* __spitfire_cee_trap branches here with AFSR in %g4 and
20 * UDBE_CE in %g1. It only clears ESTATE_ERR_CE in the ESTATE
21 * Error Enable register.
22 */
23__spitfire_cee_trap_continue:
24 ldxa [%g0] ASI_AFAR, %g5 ! Get AFAR
25
26 rdpr %tt, %g3
27 and %g3, 0x1ff, %g3 ! Paranoia
28 sllx %g3, SFSTAT_TRAP_TYPE_SHIFT, %g3
29 or %g4, %g3, %g4
30 rdpr %tl, %g3
31 cmp %g3, 1
32 mov 1, %g3
33 bleu %xcc, 1f
34 sllx %g3, SFSTAT_TL_GT_ONE_SHIFT, %g3
35
36 or %g4, %g3, %g4
37
38 /* Read in the UDB error register state, clearing the sticky
39 * error bits as-needed. We only clear them if the UE bit is
40 * set. Likewise, __spitfire_cee_trap below will only do so
41 * if the CE bit is set.
42 *
43 * NOTE: UltraSparc-I/II have high and low UDB error
44 * registers, corresponding to the two UDB units
45 * present on those chips. UltraSparc-IIi only
46 * has a single UDB, called "SDB" in the manual.
47 * For IIi the upper UDB register always reads
48 * as zero so for our purposes things will just
49 * work with the checks below.
50 */
511: ldxa [%g0] ASI_UDBH_ERROR_R, %g3
52 and %g3, 0x3ff, %g7 ! Paranoia
53 sllx %g7, SFSTAT_UDBH_SHIFT, %g7
54 or %g4, %g7, %g4
55 andcc %g3, %g1, %g3 ! UDBE_UE or UDBE_CE
56 be,pn %xcc, 1f
57 nop
58 stxa %g3, [%g0] ASI_UDB_ERROR_W
59 membar #Sync
60
611: mov 0x18, %g3
62 ldxa [%g3] ASI_UDBL_ERROR_R, %g3
63 and %g3, 0x3ff, %g7 ! Paranoia
64 sllx %g7, SFSTAT_UDBL_SHIFT, %g7
65 or %g4, %g7, %g4
66 andcc %g3, %g1, %g3 ! UDBE_UE or UDBE_CE
67 be,pn %xcc, 1f
68 nop
69 mov 0x18, %g7
70 stxa %g3, [%g7] ASI_UDB_ERROR_W
71 membar #Sync
72
731: /* Ok, now that we've latched the error state, clear the
74 * sticky bits in the AFSR.
75 */
76 stxa %g4, [%g0] ASI_AFSR
77 membar #Sync
78
79 rdpr %tl, %g2
80 cmp %g2, 1
81 rdpr %pil, %g2
82 bleu,pt %xcc, 1f
83 wrpr %g0, 15, %pil
84
85 ba,pt %xcc, etraptl1
86 rd %pc, %g7
87
88 ba,pt %xcc, 2f
89 nop
90
911: ba,pt %xcc, etrap_irq
92 rd %pc, %g7
93
942:
95#ifdef CONFIG_TRACE_IRQFLAGS
96 call trace_hardirqs_off
97 nop
98#endif
99 mov %l4, %o1
100 mov %l5, %o2
101 call spitfire_access_error
102 add %sp, PTREGS_OFF, %o0
103 ba,pt %xcc, rtrap
104 nop
105 .size __spitfire_access_error,.-__spitfire_access_error
106
107 /* This is the trap handler entry point for ECC correctable
108 * errors. They are corrected, but we listen for the trap so
109 * that the event can be logged.
110 *
111 * Disrupting errors are either:
112 * 1) single-bit ECC errors during UDB reads to system
113 * memory
114 * 2) data parity errors during write-back events
115 *
116 * As far as I can make out from the manual, the CEE trap is
117 * only for correctable errors during memory read accesses by
118 * the front-end of the processor.
119 *
120 * The code below is only for trap level 1 CEE events, as it
121 * is the only situation where we can safely record and log.
122 * For trap level >1 we just clear the CE bit in the AFSR and
123 * return.
124 *
125 * This is just like __spiftire_access_error above, but it
126 * specifically handles correctable errors. If an
127 * uncorrectable error is indicated in the AFSR we will branch
128 * directly above to __spitfire_access_error to handle it
129 * instead. Uncorrectable therefore takes priority over
130 * correctable, and the error logging C code will notice this
131 * case by inspecting the trap type.
132 */
133 .type __spitfire_cee_trap,#function
134__spitfire_cee_trap:
135 ldxa [%g0] ASI_AFSR, %g4 ! Get AFSR
136 mov 1, %g3
137 sllx %g3, SFAFSR_UE_SHIFT, %g3
138 andcc %g4, %g3, %g0 ! Check for UE
139 bne,pn %xcc, __spitfire_access_error
140 nop
141
142 /* Ok, in this case we only have a correctable error.
143 * Indicate we only wish to capture that state in register
144 * %g1, and we only disable CE error reporting unlike UE
145 * handling which disables all errors.
146 */
147 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g3
148 andn %g3, ESTATE_ERR_CE, %g3
149 stxa %g3, [%g0] ASI_ESTATE_ERROR_EN
150 membar #Sync
151
152 /* Preserve AFSR in %g4, indicate UDB state to capture in %g1 */
153 ba,pt %xcc, __spitfire_cee_trap_continue
154 mov UDBE_CE, %g1
155 .size __spitfire_cee_trap,.-__spitfire_cee_trap
156
157 .type __spitfire_data_access_exception_tl1,#function
158__spitfire_data_access_exception_tl1:
159 rdpr %pstate, %g4
160 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
161 mov TLB_SFSR, %g3
162 mov DMMU_SFAR, %g5
163 ldxa [%g3] ASI_DMMU, %g4 ! Get SFSR
164 ldxa [%g5] ASI_DMMU, %g5 ! Get SFAR
165 stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit
166 membar #Sync
167 rdpr %tt, %g3
168 cmp %g3, 0x80 ! first win spill/fill trap
169 blu,pn %xcc, 1f
170 cmp %g3, 0xff ! last win spill/fill trap
171 bgu,pn %xcc, 1f
172 nop
173 ba,pt %xcc, winfix_dax
174 rdpr %tpc, %g3
1751: sethi %hi(109f), %g7
176 ba,pt %xcc, etraptl1
177109: or %g7, %lo(109b), %g7
178 mov %l4, %o1
179 mov %l5, %o2
180 call spitfire_data_access_exception_tl1
181 add %sp, PTREGS_OFF, %o0
182 ba,pt %xcc, rtrap
183 nop
184 .size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1
185
186 .type __spitfire_data_access_exception,#function
187__spitfire_data_access_exception:
188 rdpr %pstate, %g4
189 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
190 mov TLB_SFSR, %g3
191 mov DMMU_SFAR, %g5
192 ldxa [%g3] ASI_DMMU, %g4 ! Get SFSR
193 ldxa [%g5] ASI_DMMU, %g5 ! Get SFAR
194 stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit
195 membar #Sync
196 sethi %hi(109f), %g7
197 ba,pt %xcc, etrap
198109: or %g7, %lo(109b), %g7
199 mov %l4, %o1
200 mov %l5, %o2
201 call spitfire_data_access_exception
202 add %sp, PTREGS_OFF, %o0
203 ba,pt %xcc, rtrap
204 nop
205 .size __spitfire_data_access_exception,.-__spitfire_data_access_exception
206
207 .type __spitfire_insn_access_exception_tl1,#function
208__spitfire_insn_access_exception_tl1:
209 rdpr %pstate, %g4
210 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
211 mov TLB_SFSR, %g3
212 ldxa [%g3] ASI_IMMU, %g4 ! Get SFSR
213 rdpr %tpc, %g5 ! IMMU has no SFAR, use TPC
214 stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit
215 membar #Sync
216 sethi %hi(109f), %g7
217 ba,pt %xcc, etraptl1
218109: or %g7, %lo(109b), %g7
219 mov %l4, %o1
220 mov %l5, %o2
221 call spitfire_insn_access_exception_tl1
222 add %sp, PTREGS_OFF, %o0
223 ba,pt %xcc, rtrap
224 nop
225 .size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1
226
227 .type __spitfire_insn_access_exception,#function
228__spitfire_insn_access_exception:
229 rdpr %pstate, %g4
230 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
231 mov TLB_SFSR, %g3
232 ldxa [%g3] ASI_IMMU, %g4 ! Get SFSR
233 rdpr %tpc, %g5 ! IMMU has no SFAR, use TPC
234 stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit
235 membar #Sync
236 sethi %hi(109f), %g7
237 ba,pt %xcc, etrap
238109: or %g7, %lo(109b), %g7
239 mov %l4, %o1
240 mov %l5, %o2
241 call spitfire_insn_access_exception
242 add %sp, PTREGS_OFF, %o0
243 ba,pt %xcc, rtrap
244 nop
245 .size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception
diff --git a/arch/sparc64/kernel/syscalls.S b/arch/sparc64/kernel/syscalls.S
new file mode 100644
index 000000000000..db19ed67acf6
--- /dev/null
+++ b/arch/sparc64/kernel/syscalls.S
@@ -0,0 +1,279 @@
1 /* SunOS's execv() call only specifies the argv argument, the
2 * environment settings are the same as the calling processes.
3 */
4sys_execve:
5 sethi %hi(sparc_execve), %g1
6 ba,pt %xcc, execve_merge
7 or %g1, %lo(sparc_execve), %g1
8
9#ifdef CONFIG_COMPAT
10sunos_execv:
11 stx %g0, [%sp + PTREGS_OFF + PT_V9_I2]
12sys32_execve:
13 sethi %hi(sparc32_execve), %g1
14 or %g1, %lo(sparc32_execve), %g1
15#endif
16
17execve_merge:
18 flushw
19 jmpl %g1, %g0
20 add %sp, PTREGS_OFF, %o0
21
22 .align 32
23sys_pipe:
24 ba,pt %xcc, sparc_pipe
25 add %sp, PTREGS_OFF, %o0
26sys_nis_syscall:
27 ba,pt %xcc, c_sys_nis_syscall
28 add %sp, PTREGS_OFF, %o0
29sys_memory_ordering:
30 ba,pt %xcc, sparc_memory_ordering
31 add %sp, PTREGS_OFF, %o1
32sys_sigaltstack:
33 ba,pt %xcc, do_sigaltstack
34 add %i6, STACK_BIAS, %o2
35#ifdef CONFIG_COMPAT
36sys32_sigstack:
37 ba,pt %xcc, do_sys32_sigstack
38 mov %i6, %o2
39sys32_sigaltstack:
40 ba,pt %xcc, do_sys32_sigaltstack
41 mov %i6, %o2
42#endif
43 .align 32
44#ifdef CONFIG_COMPAT
45sys32_sigreturn:
46 add %sp, PTREGS_OFF, %o0
47 call do_sigreturn32
48 add %o7, 1f-.-4, %o7
49 nop
50#endif
51sys_rt_sigreturn:
52 add %sp, PTREGS_OFF, %o0
53 call do_rt_sigreturn
54 add %o7, 1f-.-4, %o7
55 nop
56#ifdef CONFIG_COMPAT
57sys32_rt_sigreturn:
58 add %sp, PTREGS_OFF, %o0
59 call do_rt_sigreturn32
60 add %o7, 1f-.-4, %o7
61 nop
62#endif
63 .align 32
641: ldx [%g6 + TI_FLAGS], %l5
65 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
66 be,pt %icc, rtrap
67 nop
68 add %sp, PTREGS_OFF, %o0
69 call syscall_trace
70 mov 1, %o1
71 ba,pt %xcc, rtrap
72 nop
73
74 /* This is how fork() was meant to be done, 8 instruction entry.
75 *
76 * I questioned the following code briefly, let me clear things
77 * up so you must not reason on it like I did.
78 *
79 * Know the fork_kpsr etc. we use in the sparc32 port? We don't
80 * need it here because the only piece of window state we copy to
81 * the child is the CWP register. Even if the parent sleeps,
82 * we are safe because we stuck it into pt_regs of the parent
83 * so it will not change.
84 *
85 * XXX This raises the question, whether we can do the same on
86 * XXX sparc32 to get rid of fork_kpsr _and_ fork_kwim. The
87 * XXX answer is yes. We stick fork_kpsr in UREG_G0 and
88 * XXX fork_kwim in UREG_G1 (global registers are considered
89 * XXX volatile across a system call in the sparc ABI I think
90 * XXX if it isn't we can use regs->y instead, anyone who depends
91 * XXX upon the Y register being preserved across a fork deserves
92 * XXX to lose).
93 *
94 * In fact we should take advantage of that fact for other things
95 * during system calls...
96 */
97 .align 32
98sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
99 sethi %hi(0x4000 | 0x0100 | SIGCHLD), %o0
100 or %o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
101 ba,pt %xcc, sys_clone
102sys_fork:
103 clr %o1
104 mov SIGCHLD, %o0
105sys_clone:
106 flushw
107 movrz %o1, %fp, %o1
108 mov 0, %o3
109 ba,pt %xcc, sparc_do_fork
110 add %sp, PTREGS_OFF, %o2
111
112 .globl ret_from_syscall
113ret_from_syscall:
114 /* Clear current_thread_info()->new_child, and
115 * check performance counter stuff too.
116 */
117 stb %g0, [%g6 + TI_NEW_CHILD]
118 ldx [%g6 + TI_FLAGS], %l0
119 call schedule_tail
120 mov %g7, %o0
121 andcc %l0, _TIF_PERFCTR, %g0
122 be,pt %icc, 1f
123 nop
124 ldx [%g6 + TI_PCR], %o7
125 wr %g0, %o7, %pcr
126
127 /* Blackbird errata workaround. See commentary in
128 * smp.c:smp_percpu_timer_interrupt() for more
129 * information.
130 */
131 ba,pt %xcc, 99f
132 nop
133
134 .align 64
13599: wr %g0, %g0, %pic
136 rd %pic, %g0
137
1381: ba,pt %xcc, ret_sys_call
139 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
140
141 .globl sparc_exit
142 .type sparc_exit,#function
143sparc_exit:
144 rdpr %pstate, %g2
145 wrpr %g2, PSTATE_IE, %pstate
146 rdpr %otherwin, %g1
147 rdpr %cansave, %g3
148 add %g3, %g1, %g3
149 wrpr %g3, 0x0, %cansave
150 wrpr %g0, 0x0, %otherwin
151 wrpr %g2, 0x0, %pstate
152 ba,pt %xcc, sys_exit
153 stb %g0, [%g6 + TI_WSAVED]
154 .size sparc_exit,.-sparc_exit
155
156linux_sparc_ni_syscall:
157 sethi %hi(sys_ni_syscall), %l7
158 ba,pt %xcc, 4f
159 or %l7, %lo(sys_ni_syscall), %l7
160
161linux_syscall_trace32:
162 add %sp, PTREGS_OFF, %o0
163 call syscall_trace
164 clr %o1
165 srl %i0, 0, %o0
166 srl %i4, 0, %o4
167 srl %i1, 0, %o1
168 srl %i2, 0, %o2
169 ba,pt %xcc, 2f
170 srl %i3, 0, %o3
171
172linux_syscall_trace:
173 add %sp, PTREGS_OFF, %o0
174 call syscall_trace
175 clr %o1
176 mov %i0, %o0
177 mov %i1, %o1
178 mov %i2, %o2
179 mov %i3, %o3
180 b,pt %xcc, 2f
181 mov %i4, %o4
182
183
184 /* Linux 32-bit system calls enter here... */
185 .align 32
186 .globl linux_sparc_syscall32
187linux_sparc_syscall32:
188 /* Direct access to user regs, much faster. */
189 cmp %g1, NR_SYSCALLS ! IEU1 Group
190 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
191 srl %i0, 0, %o0 ! IEU0
192 sll %g1, 2, %l4 ! IEU0 Group
193 srl %i4, 0, %o4 ! IEU1
194 lduw [%l7 + %l4], %l7 ! Load
195 srl %i1, 0, %o1 ! IEU0 Group
196 ldx [%g6 + TI_FLAGS], %l0 ! Load
197
198 srl %i5, 0, %o5 ! IEU1
199 srl %i2, 0, %o2 ! IEU0 Group
200 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
201 bne,pn %icc, linux_syscall_trace32 ! CTI
202 mov %i0, %l5 ! IEU1
203 call %l7 ! CTI Group brk forced
204 srl %i3, 0, %o3 ! IEU0
205 ba,a,pt %xcc, 3f
206
207 /* Linux native system calls enter here... */
208 .align 32
209 .globl linux_sparc_syscall
210linux_sparc_syscall:
211 /* Direct access to user regs, much faster. */
212 cmp %g1, NR_SYSCALLS ! IEU1 Group
213 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
214 mov %i0, %o0 ! IEU0
215 sll %g1, 2, %l4 ! IEU0 Group
216 mov %i1, %o1 ! IEU1
217 lduw [%l7 + %l4], %l7 ! Load
2184: mov %i2, %o2 ! IEU0 Group
219 ldx [%g6 + TI_FLAGS], %l0 ! Load
220
221 mov %i3, %o3 ! IEU1
222 mov %i4, %o4 ! IEU0 Group
223 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
224 bne,pn %icc, linux_syscall_trace ! CTI Group
225 mov %i0, %l5 ! IEU0
2262: call %l7 ! CTI Group brk forced
227 mov %i5, %o5 ! IEU0
228 nop
229
2303: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
231ret_sys_call:
232 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
233 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
234 sra %o0, 0, %o0
235 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
236 sllx %g2, 32, %g2
237
238 /* Check if force_successful_syscall_return()
239 * was invoked.
240 */
241 ldub [%g6 + TI_SYS_NOERROR], %l2
242 brnz,a,pn %l2, 80f
243 stb %g0, [%g6 + TI_SYS_NOERROR]
244
245 cmp %o0, -ERESTART_RESTARTBLOCK
246 bgeu,pn %xcc, 1f
247 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
24880:
249 /* System call success, clear Carry condition code. */
250 andn %g3, %g2, %g3
251 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
252 bne,pn %icc, linux_syscall_trace2
253 add %l1, 0x4, %l2 ! npc = npc+4
254 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
255 ba,pt %xcc, rtrap
256 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
257
2581:
259 /* System call failure, set Carry condition code.
260 * Also, get abs(errno) to return to the process.
261 */
262 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
263 sub %g0, %o0, %o0
264 or %g3, %g2, %g3
265 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
266 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
267 bne,pn %icc, linux_syscall_trace2
268 add %l1, 0x4, %l2 ! npc = npc+4
269 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
270
271 b,pt %xcc, rtrap
272 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
273linux_syscall_trace2:
274 add %sp, PTREGS_OFF, %o0
275 call syscall_trace
276 mov 1, %o1
277 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
278 ba,pt %xcc, rtrap
279 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
diff --git a/arch/sparc64/kernel/ttable.S b/arch/sparc64/kernel/ttable.S
index b0de4c00b11a..450053af039e 100644
--- a/arch/sparc64/kernel/ttable.S
+++ b/arch/sparc64/kernel/ttable.S
@@ -153,7 +153,7 @@ tl0_resv164: BTRAP(0x164) BTRAP(0x165) BTRAP(0x166) BTRAP(0x167) BTRAP(0x168)
153tl0_resv169: BTRAP(0x169) BTRAP(0x16a) BTRAP(0x16b) BTRAP(0x16c) 153tl0_resv169: BTRAP(0x169) BTRAP(0x16a) BTRAP(0x16b) BTRAP(0x16c)
154tl0_linux64: LINUX_64BIT_SYSCALL_TRAP 154tl0_linux64: LINUX_64BIT_SYSCALL_TRAP
155tl0_gsctx: TRAP(sparc64_get_context) TRAP(sparc64_set_context) 155tl0_gsctx: TRAP(sparc64_get_context) TRAP(sparc64_set_context)
156tl0_resv170: KPROBES_TRAP(0x170) KPROBES_TRAP(0x171) BTRAP(0x172) 156tl0_resv170: KPROBES_TRAP(0x170) KPROBES_TRAP(0x171) KGDB_TRAP(0x172)
157tl0_resv173: BTRAP(0x173) BTRAP(0x174) BTRAP(0x175) BTRAP(0x176) BTRAP(0x177) 157tl0_resv173: BTRAP(0x173) BTRAP(0x174) BTRAP(0x175) BTRAP(0x176) BTRAP(0x177)
158tl0_resv178: BTRAP(0x178) BTRAP(0x179) BTRAP(0x17a) BTRAP(0x17b) BTRAP(0x17c) 158tl0_resv178: BTRAP(0x178) BTRAP(0x179) BTRAP(0x17a) BTRAP(0x17b) BTRAP(0x17c)
159tl0_resv17d: BTRAP(0x17d) BTRAP(0x17e) BTRAP(0x17f) 159tl0_resv17d: BTRAP(0x17d) BTRAP(0x17e) BTRAP(0x17f)
diff --git a/arch/sparc64/kernel/utrap.S b/arch/sparc64/kernel/utrap.S
new file mode 100644
index 000000000000..b7f0f3f3a909
--- /dev/null
+++ b/arch/sparc64/kernel/utrap.S
@@ -0,0 +1,29 @@
1 .globl utrap_trap
2 .type utrap_trap,#function
3utrap_trap: /* %g3=handler,%g4=level */
4 TRAP_LOAD_THREAD_REG(%g6, %g1)
5 ldx [%g6 + TI_UTRAPS], %g1
6 brnz,pt %g1, invoke_utrap
7 nop
8
9 ba,pt %xcc, etrap
10 rd %pc, %g7
11 mov %l4, %o1
12 call bad_trap
13 add %sp, PTREGS_OFF, %o0
14 ba,pt %xcc, rtrap
15 nop
16
17invoke_utrap:
18 sllx %g3, 3, %g3
19 ldx [%g1 + %g3], %g1
20 save %sp, -128, %sp
21 rdpr %tstate, %l6
22 rdpr %cwp, %l7
23 andn %l6, TSTATE_CWP, %l6
24 wrpr %l6, %l7, %tstate
25 rdpr %tpc, %l6
26 rdpr %tnpc, %l7
27 wrpr %g1, 0, %tnpc
28 done
29 .size utrap_trap,.-utrap_trap
diff --git a/arch/sparc64/lib/iomap.c b/arch/sparc64/lib/iomap.c
index ac556db06973..7120ebbd4d03 100644
--- a/arch/sparc64/lib/iomap.c
+++ b/arch/sparc64/lib/iomap.c
@@ -21,8 +21,8 @@ EXPORT_SYMBOL(ioport_unmap);
21/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 21/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
22void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 22void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
23{ 23{
24 unsigned long start = pci_resource_start(dev, bar); 24 resource_size_t start = pci_resource_start(dev, bar);
25 unsigned long len = pci_resource_len(dev, bar); 25 resource_size_t len = pci_resource_len(dev, bar);
26 unsigned long flags = pci_resource_flags(dev, bar); 26 unsigned long flags = pci_resource_flags(dev, bar);
27 27
28 if (!len || !start) 28 if (!len || !start)
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 8c2b50e8abc6..4cad0b32b0af 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -160,6 +160,7 @@ extern unsigned int sparc_ramdisk_image;
160extern unsigned int sparc_ramdisk_size; 160extern unsigned int sparc_ramdisk_size;
161 161
162struct page *mem_map_zero __read_mostly; 162struct page *mem_map_zero __read_mostly;
163EXPORT_SYMBOL(mem_map_zero);
163 164
164unsigned int sparc64_highest_unlocked_tlb_ent __read_mostly; 165unsigned int sparc64_highest_unlocked_tlb_ent __read_mostly;
165 166
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
index e686a67561af..796e005dad8b 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc64/mm/ultra.S
@@ -676,6 +676,33 @@ xcall_new_mmu_context_version:
676 wr %g0, (1 << PIL_SMP_CTX_NEW_VERSION), %set_softint 676 wr %g0, (1 << PIL_SMP_CTX_NEW_VERSION), %set_softint
677 retry 677 retry
678 678
679#ifdef CONFIG_KGDB
680 .globl xcall_kgdb_capture
681xcall_kgdb_capture:
682661: rdpr %pstate, %g2
683 wrpr %g2, PSTATE_IG | PSTATE_AG, %pstate
684 .section .sun4v_2insn_patch, "ax"
685 .word 661b
686 nop
687 nop
688 .previous
689
690 rdpr %pil, %g2
691 wrpr %g0, 15, %pil
692 sethi %hi(109f), %g7
693 ba,pt %xcc, etrap_irq
694109: or %g7, %lo(109b), %g7
695#ifdef CONFIG_TRACE_IRQFLAGS
696 call trace_hardirqs_off
697 nop
698#endif
699 call smp_kgdb_capture_client
700 add %sp, PTREGS_OFF, %o0
701 /* Has to be a non-v9 branch due to the large distance. */
702 ba rtrap_xcall
703 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
704#endif
705
679#endif /* CONFIG_SMP */ 706#endif /* CONFIG_SMP */
680 707
681 708
diff --git a/arch/um/Makefile b/arch/um/Makefile
index dbeab15e7bb7..01b97c19a8ba 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -77,7 +77,10 @@ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
77KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ 77KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
78 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES)) 78 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES))
79KBUILD_CFLAGS += $(KERNEL_DEFINES) 79KBUILD_CFLAGS += $(KERNEL_DEFINES)
80KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,) 80# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use
81# a lot more stack due to the lack of sharing of stacklots:
82KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then \
83 echo $(call cc-option,-fno-unit-at-a-time); fi ;)
81 84
82PHONY += linux 85PHONY += linux
83 86
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c
index 984f80e668ca..6540d2c9fbb7 100644
--- a/arch/um/kernel/exitcode.c
+++ b/arch/um/kernel/exitcode.c
@@ -59,7 +59,7 @@ static int make_proc_exitcode(void)
59{ 59{
60 struct proc_dir_entry *ent; 60 struct proc_dir_entry *ent;
61 61
62 ent = create_proc_entry("exitcode", 0600, &proc_root); 62 ent = create_proc_entry("exitcode", 0600, NULL);
63 if (ent == NULL) { 63 if (ent == NULL) {
64 printk(KERN_WARNING "make_proc_exitcode : Failed to register " 64 printk(KERN_WARNING "make_proc_exitcode : Failed to register "
65 "/proc/exitcode\n"); 65 "/proc/exitcode\n");
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index e8cb9ff183e9..83603cfbde81 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -364,7 +364,7 @@ int __init make_proc_sysemu(void)
364 if (!sysemu_supported) 364 if (!sysemu_supported)
365 return 0; 365 return 0;
366 366
367 ent = create_proc_entry("sysemu", 0600, &proc_root); 367 ent = create_proc_entry("sysemu", 0600, NULL);
368 368
369 if (ent == NULL) 369 if (ent == NULL)
370 { 370 {
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 9cffc628a37e..128ee85bc8d9 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -73,23 +73,6 @@ long old_mmap(unsigned long addr, unsigned long len,
73 out: 73 out:
74 return err; 74 return err;
75} 75}
76/*
77 * sys_pipe() is the normal C calling standard for creating
78 * a pipe. It's not the way unix traditionally does this, though.
79 */
80long sys_pipe(unsigned long __user * fildes)
81{
82 int fd[2];
83 long error;
84
85 error = do_pipe(fd);
86 if (!error) {
87 if (copy_to_user(fildes, fd, sizeof(fd)))
88 error = -EFAULT;
89 }
90 return error;
91}
92
93 76
94long sys_uname(struct old_utsname __user * name) 77long sys_uname(struct old_utsname __user * name)
95{ 78{
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index e066e84493b1..0d0cea2ac98d 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <linux/clockchips.h> 6#include <linux/clockchips.h>
7#include <linux/init.h>
7#include <linux/interrupt.h> 8#include <linux/interrupt.h>
8#include <linux/jiffies.h> 9#include <linux/jiffies.h>
9#include <linux/threads.h> 10#include <linux/threads.h>
@@ -109,8 +110,6 @@ static void __init setup_itimer(void)
109 clockevents_register_device(&itimer_clockevent); 110 clockevents_register_device(&itimer_clockevent);
110} 111}
111 112
112extern void (*late_time_init)(void);
113
114void __init time_init(void) 113void __init time_init(void)
115{ 114{
116 long long nsecs; 115 long long nsecs;
diff --git a/arch/v850/kernel/asm-offsets.c b/arch/v850/kernel/asm-offsets.c
index cee5c3142d41..581e6986a776 100644
--- a/arch/v850/kernel/asm-offsets.c
+++ b/arch/v850/kernel/asm-offsets.c
@@ -13,14 +13,11 @@
13#include <linux/kernel_stat.h> 13#include <linux/kernel_stat.h>
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <linux/hardirq.h> 15#include <linux/hardirq.h>
16#include <linux/kbuild.h>
17
16#include <asm/irq.h> 18#include <asm/irq.h>
17#include <asm/errno.h> 19#include <asm/errno.h>
18 20
19#define DEFINE(sym, val) \
20 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
21
22#define BLANK() asm volatile("\n->" : : )
23
24int main (void) 21int main (void)
25{ 22{
26 /* offsets into the task struct */ 23 /* offsets into the task struct */
diff --git a/arch/v850/kernel/rte_mb_a_pci.c b/arch/v850/kernel/rte_mb_a_pci.c
index 7165478824e7..687e367d8b64 100644
--- a/arch/v850/kernel/rte_mb_a_pci.c
+++ b/arch/v850/kernel/rte_mb_a_pci.c
@@ -790,8 +790,8 @@ pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr,
790 790
791void __iomem *pci_iomap (struct pci_dev *dev, int bar, unsigned long max) 791void __iomem *pci_iomap (struct pci_dev *dev, int bar, unsigned long max)
792{ 792{
793 unsigned long start = pci_resource_start (dev, bar); 793 resource_size_t start = pci_resource_start (dev, bar);
794 unsigned long len = pci_resource_len (dev, bar); 794 resource_size_t len = pci_resource_len (dev, bar);
795 795
796 if (!start || len == 0) 796 if (!start || len == 0)
797 return 0; 797 return 0;
diff --git a/arch/v850/kernel/syscalls.c b/arch/v850/kernel/syscalls.c
index 003db9c8c44a..1a83daf8e24f 100644
--- a/arch/v850/kernel/syscalls.c
+++ b/arch/v850/kernel/syscalls.c
@@ -132,23 +132,6 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
132 return ret; 132 return ret;
133} 133}
134 134
135/*
136 * sys_pipe() is the normal C calling standard for creating
137 * a pipe. It's not the way unix traditionally does this, though.
138 */
139int sys_pipe (int *fildes)
140{
141 int fd[2];
142 int error;
143
144 error = do_pipe (fd);
145 if (!error) {
146 if (copy_to_user (fildes, fd, 2*sizeof (int)))
147 error = -EFAULT;
148 }
149 return error;
150}
151
152static inline unsigned long 135static inline unsigned long
153do_mmap2 (unsigned long addr, size_t len, 136do_mmap2 (unsigned long addr, size_t len,
154 unsigned long prot, unsigned long flags, 137 unsigned long prot, unsigned long flags,
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a12dbb2b93f3..845ea2b2d487 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -25,6 +25,18 @@ config X86
25 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) 25 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
26 select HAVE_ARCH_KGDB if !X86_VOYAGER 26 select HAVE_ARCH_KGDB if !X86_VOYAGER
27 27
28config DEFCONFIG_LIST
29 string
30 depends on X86_32
31 option defconfig_list
32 default "arch/x86/configs/i386_defconfig"
33
34config DEFCONFIG_LIST
35 string
36 depends on X86_64
37 option defconfig_list
38 default "arch/x86/configs/x86_64_defconfig"
39
28 40
29config GENERIC_LOCKBREAK 41config GENERIC_LOCKBREAK
30 def_bool n 42 def_bool n
@@ -180,7 +192,7 @@ config X86_HT
180 192
181config X86_BIOS_REBOOT 193config X86_BIOS_REBOOT
182 bool 194 bool
183 depends on X86_32 && !(X86_VISWS || X86_VOYAGER) 195 depends on !X86_VISWS && !X86_VOYAGER
184 default y 196 default y
185 197
186config X86_TRAMPOLINE 198config X86_TRAMPOLINE
@@ -537,9 +549,6 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
537 Calgary anyway, pass 'iommu=calgary' on the kernel command line. 549 Calgary anyway, pass 'iommu=calgary' on the kernel command line.
538 If unsure, say Y. 550 If unsure, say Y.
539 551
540config IOMMU_HELPER
541 def_bool (CALGARY_IOMMU || GART_IOMMU)
542
543# need this always selected by IOMMU for the VIA workaround 552# need this always selected by IOMMU for the VIA workaround
544config SWIOTLB 553config SWIOTLB
545 bool 554 bool
@@ -550,6 +559,8 @@ config SWIOTLB
550 access 32-bits of memory can be used on systems with more than 559 access 32-bits of memory can be used on systems with more than
551 3 GB of memory. If unsure, say Y. 560 3 GB of memory. If unsure, say Y.
552 561
562config IOMMU_HELPER
563 def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB)
553 564
554config NR_CPUS 565config NR_CPUS
555 int "Maximum number of CPUs (2-255)" 566 int "Maximum number of CPUs (2-255)"
@@ -1162,7 +1173,7 @@ source kernel/Kconfig.hz
1162 1173
1163config KEXEC 1174config KEXEC
1164 bool "kexec system call" 1175 bool "kexec system call"
1165 depends on X86_64 || X86_BIOS_REBOOT 1176 depends on X86_BIOS_REBOOT
1166 help 1177 help
1167 kexec is a system call that implements the ability to shutdown your 1178 kexec is a system call that implements the ability to shutdown your
1168 current kernel, and to start another kernel. It is like a reboot 1179 current kernel, and to start another kernel. It is like a reboot
@@ -1505,6 +1516,10 @@ config PCI_GODIRECT
1505config PCI_GOANY 1516config PCI_GOANY
1506 bool "Any" 1517 bool "Any"
1507 1518
1519config PCI_GOOLPC
1520 bool "OLPC"
1521 depends on OLPC
1522
1508endchoice 1523endchoice
1509 1524
1510config PCI_BIOS 1525config PCI_BIOS
@@ -1514,12 +1529,17 @@ config PCI_BIOS
1514# x86-64 doesn't support PCI BIOS access from long mode so always go direct. 1529# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
1515config PCI_DIRECT 1530config PCI_DIRECT
1516 def_bool y 1531 def_bool y
1517 depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY) || X86_VISWS) 1532 depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC) || X86_VISWS)
1518 1533
1519config PCI_MMCONFIG 1534config PCI_MMCONFIG
1520 def_bool y 1535 def_bool y
1521 depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) 1536 depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
1522 1537
1538config PCI_OLPC
1539 bool
1540 depends on PCI && PCI_GOOLPC
1541 default y
1542
1523config PCI_DOMAINS 1543config PCI_DOMAINS
1524 def_bool y 1544 def_bool y
1525 depends on PCI 1545 depends on PCI
@@ -1639,6 +1659,14 @@ config GEODE_MFGPT_TIMER
1639 MFGPTs have a better resolution and max interval than the 1659 MFGPTs have a better resolution and max interval than the
1640 generic PIT, and are suitable for use as high-res timers. 1660 generic PIT, and are suitable for use as high-res timers.
1641 1661
1662config OLPC
1663 bool "One Laptop Per Child support"
1664 depends on MGEODE_LX
1665 default n
1666 help
1667 Add support for detecting the unique features of the OLPC
1668 XO hardware.
1669
1642endif # X86_32 1670endif # X86_32
1643 1671
1644config K8_NB 1672config K8_NB
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 7ef18b01f0bc..2ad6301849a1 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -278,11 +278,6 @@ config GENERIC_CPU
278 278
279endchoice 279endchoice
280 280
281config X86_CPU
282 def_bool y
283 select GENERIC_FIND_FIRST_BIT
284 select GENERIC_FIND_NEXT_BIT
285
286config X86_GENERIC 281config X86_GENERIC
287 bool "Generic x86 support" 282 bool "Generic x86 support"
288 depends on X86_32 283 depends on X86_32
@@ -297,6 +292,11 @@ config X86_GENERIC
297 292
298endif 293endif
299 294
295config X86_CPU
296 def_bool y
297 select GENERIC_FIND_FIRST_BIT
298 select GENERIC_FIND_NEXT_BIT
299
300# 300#
301# Define implied options from the CPU selection here 301# Define implied options from the CPU selection here
302config X86_L1_CACHE_BYTES 302config X86_L1_CACHE_BYTES
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 5b1979a45a1e..ac1e31ba4795 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -118,7 +118,6 @@ config DEBUG_NX_TEST
118config 4KSTACKS 118config 4KSTACKS
119 bool "Use 4Kb for kernel stacks instead of 8Kb" 119 bool "Use 4Kb for kernel stacks instead of 8Kb"
120 depends on X86_32 120 depends on X86_32
121 default y
122 help 121 help
123 If you say Y here the kernel will use a 4Kb stacksize for the 122 If you say Y here the kernel will use a 4Kb stacksize for the
124 kernel stack attached to each process/thread. This facilitates 123 kernel stack attached to each process/thread. This facilitates
@@ -256,11 +255,9 @@ config CPA_DEBUG
256 help 255 help
257 Do change_page_attr() self-tests every 30 seconds. 256 Do change_page_attr() self-tests every 30 seconds.
258 257
259endmenu
260
261config OPTIMIZE_INLINING 258config OPTIMIZE_INLINING
262 bool "Allow gcc to uninline functions marked 'inline'" 259 bool "Allow gcc to uninline functions marked 'inline'"
263 default y 260 depends on BROKEN
264 help 261 help
265 This option determines if the kernel forces gcc to inline the functions 262 This option determines if the kernel forces gcc to inline the functions
266 developers have marked 'inline'. Doing so takes away freedom from gcc to 263 developers have marked 'inline'. Doing so takes away freedom from gcc to
@@ -270,3 +267,6 @@ config OPTIMIZE_INLINING
270 this algorithm is so good that allowing gcc4 to make the decision can 267 this algorithm is so good that allowing gcc4 to make the decision can
271 become the default in the future, until then this option is there to 268 become the default in the future, until then this option is there to
272 test gcc for this. 269 test gcc for this.
270
271endmenu
272
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
index d01ea42187e6..edaadea90aaf 100644
--- a/arch/x86/boot/compressed/relocs.c
+++ b/arch/x86/boot/compressed/relocs.c
@@ -191,7 +191,7 @@ static void read_ehdr(FILE *fp)
191 die("Cannot read ELF header: %s\n", 191 die("Cannot read ELF header: %s\n",
192 strerror(errno)); 192 strerror(errno));
193 } 193 }
194 if (memcmp(ehdr.e_ident, ELFMAG, 4) != 0) { 194 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) {
195 die("No ELF magic\n"); 195 die("No ELF magic\n");
196 } 196 }
197 if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) { 197 if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) {
diff --git a/arch/x86/boot/edd.c b/arch/x86/boot/edd.c
index d84a48ece785..03399d64013b 100644
--- a/arch/x86/boot/edd.c
+++ b/arch/x86/boot/edd.c
@@ -126,17 +126,25 @@ void query_edd(void)
126{ 126{
127 char eddarg[8]; 127 char eddarg[8];
128 int do_mbr = 1; 128 int do_mbr = 1;
129#ifdef CONFIG_EDD_OFF
130 int do_edd = 0;
131#else
129 int do_edd = 1; 132 int do_edd = 1;
133#endif
130 int be_quiet; 134 int be_quiet;
131 int devno; 135 int devno;
132 struct edd_info ei, *edp; 136 struct edd_info ei, *edp;
133 u32 *mbrptr; 137 u32 *mbrptr;
134 138
135 if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { 139 if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
136 if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) 140 if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) {
141 do_edd = 1;
137 do_mbr = 0; 142 do_mbr = 0;
143 }
138 else if (!strcmp(eddarg, "off")) 144 else if (!strcmp(eddarg, "off"))
139 do_edd = 0; 145 do_edd = 0;
146 else if (!strcmp(eddarg, "on"))
147 do_edd = 1;
140 } 148 }
141 149
142 be_quiet = cmdline_find_option_bool("quiet"); 150 be_quiet = cmdline_find_option_bool("quiet");
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index bbed3a26ce55..cb3856a18c85 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -128,7 +128,7 @@ asmlinkage long sys32_sigsuspend(int history0, int history1, old_sigset_t mask)
128 128
129 current->state = TASK_INTERRUPTIBLE; 129 current->state = TASK_INTERRUPTIBLE;
130 schedule(); 130 schedule();
131 set_thread_flag(TIF_RESTORE_SIGMASK); 131 set_restore_sigmask();
132 return -ERESTARTNOHAND; 132 return -ERESTARTNOHAND;
133} 133}
134 134
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index fa19c3819540..bbdacb398d48 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -40,7 +40,6 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o
40obj-y += cpu/ 40obj-y += cpu/
41obj-y += acpi/ 41obj-y += acpi/
42obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o 42obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o
43obj-$(CONFIG_X86_64) += reboot.o
44obj-$(CONFIG_MCA) += mca_32.o 43obj-$(CONFIG_MCA) += mca_32.o
45obj-$(CONFIG_X86_MSR) += msr.o 44obj-$(CONFIG_X86_MSR) += msr.o
46obj-$(CONFIG_X86_CPUID) += cpuid.o 45obj-$(CONFIG_X86_CPUID) += cpuid.o
@@ -91,6 +90,8 @@ endif
91obj-$(CONFIG_SCx200) += scx200.o 90obj-$(CONFIG_SCx200) += scx200.o
92scx200-y += scx200_32.o 91scx200-y += scx200_32.o
93 92
93obj-$(CONFIG_OLPC) += olpc.o
94
94### 95###
95# 64 bit specific files 96# 64 bit specific files
96ifeq ($(CONFIG_X86_64),y) 97ifeq ($(CONFIG_X86_64),y)
@@ -101,4 +102,6 @@ ifeq ($(CONFIG_X86_64),y)
101 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o 102 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o
102 obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o 103 obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
103 obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o 104 obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
105
106 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
104endif 107endif
diff --git a/arch/x86/kernel/acpi/Makefile b/arch/x86/kernel/acpi/Makefile
index 7335959b6aff..fd5ca97a2ad5 100644
--- a/arch/x86/kernel/acpi/Makefile
+++ b/arch/x86/kernel/acpi/Makefile
@@ -10,5 +10,5 @@ endif
10$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin 10$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin
11 11
12$(obj)/realmode/wakeup.bin: FORCE 12$(obj)/realmode/wakeup.bin: FORCE
13 $(Q)$(MAKE) $(build)=$(obj)/realmode $@ 13 $(Q)$(MAKE) $(build)=$(obj)/realmode
14 14
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 977ed5cdeaa3..c49ebcc6c41e 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -771,6 +771,32 @@ static void __init acpi_register_lapic_address(unsigned long address)
771 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); 771 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
772} 772}
773 773
774static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
775{
776 int count;
777
778 if (!cpu_has_apic)
779 return -ENODEV;
780
781 /*
782 * Note that the LAPIC address is obtained from the MADT (32-bit value)
783 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
784 */
785
786 count =
787 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
788 acpi_parse_lapic_addr_ovr, 0);
789 if (count < 0) {
790 printk(KERN_ERR PREFIX
791 "Error parsing LAPIC address override entry\n");
792 return count;
793 }
794
795 acpi_register_lapic_address(acpi_lapic_addr);
796
797 return count;
798}
799
774static int __init acpi_parse_madt_lapic_entries(void) 800static int __init acpi_parse_madt_lapic_entries(void)
775{ 801{
776 int count; 802 int count;
@@ -901,6 +927,33 @@ static inline int acpi_parse_madt_ioapic_entries(void)
901} 927}
902#endif /* !CONFIG_X86_IO_APIC */ 928#endif /* !CONFIG_X86_IO_APIC */
903 929
930static void __init early_acpi_process_madt(void)
931{
932#ifdef CONFIG_X86_LOCAL_APIC
933 int error;
934
935 if (!acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
936
937 /*
938 * Parse MADT LAPIC entries
939 */
940 error = early_acpi_parse_madt_lapic_addr_ovr();
941 if (!error) {
942 acpi_lapic = 1;
943 smp_found_config = 1;
944 }
945 if (error == -EINVAL) {
946 /*
947 * Dell Precision Workstation 410, 610 come here.
948 */
949 printk(KERN_ERR PREFIX
950 "Invalid BIOS MADT, disabling ACPI\n");
951 disable_acpi();
952 }
953 }
954#endif
955}
956
904static void __init acpi_process_madt(void) 957static void __init acpi_process_madt(void)
905{ 958{
906#ifdef CONFIG_X86_LOCAL_APIC 959#ifdef CONFIG_X86_LOCAL_APIC
@@ -1233,6 +1286,23 @@ int __init acpi_boot_table_init(void)
1233 return 0; 1286 return 0;
1234} 1287}
1235 1288
1289int __init early_acpi_boot_init(void)
1290{
1291 /*
1292 * If acpi_disabled, bail out
1293 * One exception: acpi=ht continues far enough to enumerate LAPICs
1294 */
1295 if (acpi_disabled && !acpi_ht)
1296 return 1;
1297
1298 /*
1299 * Process the Multiple APIC Description Table (MADT), if present
1300 */
1301 early_acpi_process_madt();
1302
1303 return 0;
1304}
1305
1236int __init acpi_boot_init(void) 1306int __init acpi_boot_init(void)
1237{ 1307{
1238 /* 1308 /*
diff --git a/arch/x86/kernel/acpi/realmode/Makefile b/arch/x86/kernel/acpi/realmode/Makefile
index 092900854acc..1c31cc0e9def 100644
--- a/arch/x86/kernel/acpi/realmode/Makefile
+++ b/arch/x86/kernel/acpi/realmode/Makefile
@@ -6,7 +6,8 @@
6# for more details. 6# for more details.
7# 7#
8 8
9targets := wakeup.bin wakeup.elf 9always := wakeup.bin
10targets := wakeup.elf wakeup.lds
10 11
11wakeup-y += wakeup.o wakemain.o video-mode.o copy.o 12wakeup-y += wakeup.o wakemain.o video-mode.o copy.o
12 13
@@ -48,7 +49,7 @@ LDFLAGS_wakeup.elf := -T
48 49
49CPPFLAGS_wakeup.lds += -P -C 50CPPFLAGS_wakeup.lds += -P -C
50 51
51$(obj)/wakeup.elf: $(src)/wakeup.lds $(WAKEUP_OBJS) FORCE 52$(obj)/wakeup.elf: $(obj)/wakeup.lds $(WAKEUP_OBJS) FORCE
52 $(call if_changed,ld) 53 $(call if_changed,ld)
53 54
54OBJCOPYFLAGS_wakeup.bin := -O binary 55OBJCOPYFLAGS_wakeup.bin := -O binary
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index e4ea362e8480..bf9290e29013 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -1192,19 +1192,6 @@ static int suspend(int vetoable)
1192 int err; 1192 int err;
1193 struct apm_user *as; 1193 struct apm_user *as;
1194 1194
1195 if (pm_send_all(PM_SUSPEND, (void *)3)) {
1196 /* Vetoed */
1197 if (vetoable) {
1198 if (apm_info.connection_version > 0x100)
1199 set_system_power_state(APM_STATE_REJECT);
1200 err = -EBUSY;
1201 ignore_sys_suspend = 0;
1202 printk(KERN_WARNING "apm: suspend was vetoed.\n");
1203 goto out;
1204 }
1205 printk(KERN_CRIT "apm: suspend was vetoed, but suspending anyway.\n");
1206 }
1207
1208 device_suspend(PMSG_SUSPEND); 1195 device_suspend(PMSG_SUSPEND);
1209 local_irq_disable(); 1196 local_irq_disable();
1210 device_power_down(PMSG_SUSPEND); 1197 device_power_down(PMSG_SUSPEND);
@@ -1227,9 +1214,7 @@ static int suspend(int vetoable)
1227 device_power_up(); 1214 device_power_up();
1228 local_irq_enable(); 1215 local_irq_enable();
1229 device_resume(); 1216 device_resume();
1230 pm_send_all(PM_RESUME, (void *)0);
1231 queue_event(APM_NORMAL_RESUME, NULL); 1217 queue_event(APM_NORMAL_RESUME, NULL);
1232 out:
1233 spin_lock(&user_list_lock); 1218 spin_lock(&user_list_lock);
1234 for (as = user_list; as != NULL; as = as->next) { 1219 for (as = user_list; as != NULL; as = as->next) {
1235 as->suspend_wait = 0; 1220 as->suspend_wait = 0;
@@ -1340,7 +1325,6 @@ static void check_events(void)
1340 if ((event != APM_NORMAL_RESUME) 1325 if ((event != APM_NORMAL_RESUME)
1341 || (ignore_normal_resume == 0)) { 1326 || (ignore_normal_resume == 0)) {
1342 device_resume(); 1327 device_resume();
1343 pm_send_all(PM_RESUME, (void *)0);
1344 queue_event(event, NULL); 1328 queue_event(event, NULL);
1345 } 1329 }
1346 ignore_normal_resume = 0; 1330 ignore_normal_resume = 0;
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 670c3c311289..92588083950f 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -9,6 +9,7 @@
9#include <linux/signal.h> 9#include <linux/signal.h>
10#include <linux/personality.h> 10#include <linux/personality.h>
11#include <linux/suspend.h> 11#include <linux/suspend.h>
12#include <linux/kbuild.h>
12#include <asm/ucontext.h> 13#include <asm/ucontext.h>
13#include "sigframe.h" 14#include "sigframe.h"
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
@@ -23,14 +24,6 @@
23#include <linux/lguest.h> 24#include <linux/lguest.h>
24#include "../../../drivers/lguest/lg.h" 25#include "../../../drivers/lguest/lg.h"
25 26
26#define DEFINE(sym, val) \
27 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
28
29#define BLANK() asm volatile("\n->" : : )
30
31#define OFFSET(sym, str, mem) \
32 DEFINE(sym, offsetof(struct str, mem));
33
34/* workaround for a warning with -Wmissing-prototypes */ 27/* workaround for a warning with -Wmissing-prototypes */
35void foo(void); 28void foo(void);
36 29
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 494e1e096ee6..f126c05d6170 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -10,6 +10,7 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <linux/kbuild.h>
13#include <asm/pda.h> 14#include <asm/pda.h>
14#include <asm/processor.h> 15#include <asm/processor.h>
15#include <asm/segment.h> 16#include <asm/segment.h>
@@ -17,14 +18,6 @@
17#include <asm/ia32.h> 18#include <asm/ia32.h>
18#include <asm/bootparam.h> 19#include <asm/bootparam.h>
19 20
20#define DEFINE(sym, val) \
21 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
22
23#define BLANK() asm volatile("\n->" : : )
24
25#define OFFSET(sym, str, mem) \
26 DEFINE(sym, offsetof(struct str, mem))
27
28#define __NO_STUBS 1 21#define __NO_STUBS 1
29#undef __SYSCALL 22#undef __SYSCALL
30#undef _ASM_X86_64_UNISTD_H_ 23#undef _ASM_X86_64_UNISTD_H_
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 8db8f73503b3..b0c8208df9fa 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -601,6 +601,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
601 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { 601 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
602 policy->cpus = perf->shared_cpu_map; 602 policy->cpus = perf->shared_cpu_map;
603 } 603 }
604 policy->related_cpus = perf->shared_cpu_map;
604 605
605#ifdef CONFIG_SMP 606#ifdef CONFIG_SMP
606 dmi_check_system(sw_any_bug_dmi_table); 607 dmi_check_system(sw_any_bug_dmi_table);
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 353efe4f5017..5d241ce94a44 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -90,7 +90,7 @@ u8 mtrr_type_lookup(u64 start, u64 end)
90 * Look of multiple ranges matching this address and pick type 90 * Look of multiple ranges matching this address and pick type
91 * as per MTRR precedence 91 * as per MTRR precedence
92 */ 92 */
93 if (!mtrr_state.enabled & 2) { 93 if (!(mtrr_state.enabled & 2)) {
94 return mtrr_state.def_type; 94 return mtrr_state.def_type;
95 } 95 }
96 96
diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c
index 1960f1985e5e..84c480bb3715 100644
--- a/arch/x86/kernel/cpu/mtrr/if.c
+++ b/arch/x86/kernel/cpu/mtrr/if.c
@@ -424,7 +424,7 @@ static int __init mtrr_if_init(void)
424 return -ENODEV; 424 return -ENODEV;
425 425
426 proc_root_mtrr = 426 proc_root_mtrr =
427 proc_create("mtrr", S_IWUSR | S_IRUGO, &proc_root, &mtrr_fops); 427 proc_create("mtrr", S_IWUSR | S_IRUGO, NULL, &mtrr_fops);
428 428
429 if (proc_root_mtrr) 429 if (proc_root_mtrr)
430 proc_root_mtrr->owner = THIS_MODULE; 430 proc_root_mtrr->owner = THIS_MODULE;
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 645ee5e32a27..124480c0008d 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -100,7 +100,7 @@ void __init free_early(unsigned long start, unsigned long end)
100 for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++) 100 for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++)
101 ; 101 ;
102 102
103 memcpy(&early_res[i], &early_res[i + 1], 103 memmove(&early_res[i], &early_res[i + 1],
104 (j - 1 - i) * sizeof(struct early_res)); 104 (j - 1 - i) * sizeof(struct early_res));
105 105
106 early_res[j - 1].end = 0; 106 early_res[j - 1].end = 0;
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index 021624c83583..cbaaf69bedb2 100644
--- a/arch/x86/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
@@ -83,7 +83,7 @@ unsigned int read_apic_id(void)
83{ 83{
84 unsigned int id; 84 unsigned int id;
85 85
86 WARN_ON(preemptible()); 86 WARN_ON(preemptible() && num_online_cpus() > 1);
87 id = apic_read(APIC_ID); 87 id = apic_read(APIC_ID);
88 if (uv_system_type >= UV_X2APIC) 88 if (uv_system_type >= UV_X2APIC)
89 id |= __get_cpu_var(x2apic_extra_bits); 89 id |= __get_cpu_var(x2apic_extra_bits);
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 90f038af3adc..b2cc73768a9d 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -656,15 +656,16 @@ int_msg:
656 .asciz "Unknown interrupt or fault at EIP %p %p %p\n" 656 .asciz "Unknown interrupt or fault at EIP %p %p %p\n"
657 657
658fault_msg: 658fault_msg:
659 .asciz \ 659/* fault info: */
660/* fault info: */ "BUG: Int %d: CR2 %p\n" \ 660 .ascii "BUG: Int %d: CR2 %p\n"
661/* pusha regs: */ " EDI %p ESI %p EBP %p ESP %p\n" \ 661/* pusha regs: */
662 " EBX %p EDX %p ECX %p EAX %p\n" \ 662 .ascii " EDI %p ESI %p EBP %p ESP %p\n"
663/* fault frame: */ " err %p EIP %p CS %p flg %p\n" \ 663 .ascii " EBX %p EDX %p ECX %p EAX %p\n"
664 \ 664/* fault frame: */
665 "Stack: %p %p %p %p %p %p %p %p\n" \ 665 .ascii " err %p EIP %p CS %p flg %p\n"
666 " %p %p %p %p %p %p %p %p\n" \ 666 .ascii "Stack: %p %p %p %p %p %p %p %p\n"
667 " %p %p %p %p %p %p %p %p\n" 667 .ascii " %p %p %p %p %p %p %p %p\n"
668 .asciz " %p %p %p %p %p %p %p %p\n"
668 669
669#include "../../x86/xen/xen-head.S" 670#include "../../x86/xen/xen-head.S"
670 671
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 9007f9ea64ee..9b5cfcdfc426 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -137,9 +137,10 @@ static void hpet_reserve_platform_timers(unsigned long id)
137 hd.hd_irq[0] = HPET_LEGACY_8254; 137 hd.hd_irq[0] = HPET_LEGACY_8254;
138 hd.hd_irq[1] = HPET_LEGACY_RTC; 138 hd.hd_irq[1] = HPET_LEGACY_RTC;
139 139
140 for (i = 2; i < nrtimers; timer++, i++) 140 for (i = 2; i < nrtimers; timer++, i++) {
141 hd.hd_irq[i] = (timer->hpet_config & Tn_INT_ROUTE_CNF_MASK) >> 141 hd.hd_irq[i] = (readl(&timer->hpet_config) & Tn_INT_ROUTE_CNF_MASK) >>
142 Tn_INT_ROUTE_CNF_SHIFT; 142 Tn_INT_ROUTE_CNF_SHIFT;
143 }
143 144
144 hpet_alloc(&hd); 145 hpet_alloc(&hd);
145 146
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 00bda7bcda63..147352df28b9 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -190,8 +190,6 @@ void irq_ctx_exit(int cpu)
190 hardirq_ctx[cpu] = NULL; 190 hardirq_ctx[cpu] = NULL;
191} 191}
192 192
193extern asmlinkage void __do_softirq(void);
194
195asmlinkage void do_softirq(void) 193asmlinkage void do_softirq(void)
196{ 194{
197 unsigned long flags; 195 unsigned long flags;
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index ddee04043aeb..4bc1be5d5472 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -133,6 +133,7 @@ static int kvm_register_clock(void)
133 return native_write_msr_safe(MSR_KVM_SYSTEM_TIME, low, high); 133 return native_write_msr_safe(MSR_KVM_SYSTEM_TIME, low, high);
134} 134}
135 135
136#ifdef CONFIG_X86_LOCAL_APIC
136static void kvm_setup_secondary_clock(void) 137static void kvm_setup_secondary_clock(void)
137{ 138{
138 /* 139 /*
@@ -143,6 +144,7 @@ static void kvm_setup_secondary_clock(void)
143 /* ok, done with our trickery, call native */ 144 /* ok, done with our trickery, call native */
144 setup_secondary_APIC_clock(); 145 setup_secondary_APIC_clock();
145} 146}
147#endif
146 148
147/* 149/*
148 * After the clock is registered, the host will keep writing to the 150 * After the clock is registered, the host will keep writing to the
@@ -177,7 +179,9 @@ void __init kvmclock_init(void)
177 pv_time_ops.get_wallclock = kvm_get_wallclock; 179 pv_time_ops.get_wallclock = kvm_get_wallclock;
178 pv_time_ops.set_wallclock = kvm_set_wallclock; 180 pv_time_ops.set_wallclock = kvm_set_wallclock;
179 pv_time_ops.sched_clock = kvm_clock_read; 181 pv_time_ops.sched_clock = kvm_clock_read;
182#ifdef CONFIG_X86_LOCAL_APIC
180 pv_apic_ops.setup_secondary_clock = kvm_setup_secondary_clock; 183 pv_apic_ops.setup_secondary_clock = kvm_setup_secondary_clock;
184#endif
181 machine_ops.shutdown = kvm_shutdown; 185 machine_ops.shutdown = kvm_shutdown;
182#ifdef CONFIG_KEXEC 186#ifdef CONFIG_KEXEC
183 machine_ops.crash_shutdown = kvm_crash_shutdown; 187 machine_ops.crash_shutdown = kvm_crash_shutdown;
diff --git a/arch/x86/kernel/mmconf-fam10h_64.c b/arch/x86/kernel/mmconf-fam10h_64.c
new file mode 100644
index 000000000000..edc5fbfe85c0
--- /dev/null
+++ b/arch/x86/kernel/mmconf-fam10h_64.c
@@ -0,0 +1,243 @@
1/*
2 * AMD Family 10h mmconfig enablement
3 */
4
5#include <linux/types.h>
6#include <linux/mm.h>
7#include <linux/string.h>
8#include <linux/pci.h>
9#include <linux/dmi.h>
10#include <asm/pci-direct.h>
11#include <linux/sort.h>
12#include <asm/io.h>
13#include <asm/msr.h>
14#include <asm/acpi.h>
15
16#include "../pci/pci.h"
17
18struct pci_hostbridge_probe {
19 u32 bus;
20 u32 slot;
21 u32 vendor;
22 u32 device;
23};
24
25static u64 __cpuinitdata fam10h_pci_mmconf_base;
26static int __cpuinitdata fam10h_pci_mmconf_base_status;
27
28static struct pci_hostbridge_probe pci_probes[] __cpuinitdata = {
29 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1200 },
30 { 0xff, 0, PCI_VENDOR_ID_AMD, 0x1200 },
31};
32
33struct range {
34 u64 start;
35 u64 end;
36};
37
38static int __cpuinit cmp_range(const void *x1, const void *x2)
39{
40 const struct range *r1 = x1;
41 const struct range *r2 = x2;
42 int start1, start2;
43
44 start1 = r1->start >> 32;
45 start2 = r2->start >> 32;
46
47 return start1 - start2;
48}
49
50/*[47:0] */
51/* need to avoid (0xfd<<32) and (0xfe<<32), ht used space */
52#define FAM10H_PCI_MMCONF_BASE (0xfcULL<<32)
53#define BASE_VALID(b) ((b != (0xfdULL << 32)) && (b != (0xfeULL << 32)))
54static void __cpuinit get_fam10h_pci_mmconf_base(void)
55{
56 int i;
57 unsigned bus;
58 unsigned slot;
59 int found;
60
61 u64 val;
62 u32 address;
63 u64 tom2;
64 u64 base = FAM10H_PCI_MMCONF_BASE;
65
66 int hi_mmio_num;
67 struct range range[8];
68
69 /* only try to get setting from BSP */
70 /* -1 or 1 */
71 if (fam10h_pci_mmconf_base_status)
72 return;
73
74 if (!early_pci_allowed())
75 goto fail;
76
77 found = 0;
78 for (i = 0; i < ARRAY_SIZE(pci_probes); i++) {
79 u32 id;
80 u16 device;
81 u16 vendor;
82
83 bus = pci_probes[i].bus;
84 slot = pci_probes[i].slot;
85 id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID);
86
87 vendor = id & 0xffff;
88 device = (id>>16) & 0xffff;
89 if (pci_probes[i].vendor == vendor &&
90 pci_probes[i].device == device) {
91 found = 1;
92 break;
93 }
94 }
95
96 if (!found)
97 goto fail;
98
99 /* SYS_CFG */
100 address = MSR_K8_SYSCFG;
101 rdmsrl(address, val);
102
103 /* TOP_MEM2 is not enabled? */
104 if (!(val & (1<<21))) {
105 tom2 = 0;
106 } else {
107 /* TOP_MEM2 */
108 address = MSR_K8_TOP_MEM2;
109 rdmsrl(address, val);
110 tom2 = val & (0xffffULL<<32);
111 }
112
113 if (base <= tom2)
114 base = tom2 + (1ULL<<32);
115
116 /*
117 * need to check if the range is in the high mmio range that is
118 * above 4G
119 */
120 hi_mmio_num = 0;
121 for (i = 0; i < 8; i++) {
122 u32 reg;
123 u64 start;
124 u64 end;
125 reg = read_pci_config(bus, slot, 1, 0x80 + (i << 3));
126 if (!(reg & 3))
127 continue;
128
129 start = (((u64)reg) << 8) & (0xffULL << 32); /* 39:16 on 31:8*/
130 reg = read_pci_config(bus, slot, 1, 0x84 + (i << 3));
131 end = (((u64)reg) << 8) & (0xffULL << 32); /* 39:16 on 31:8*/
132
133 if (!end)
134 continue;
135
136 range[hi_mmio_num].start = start;
137 range[hi_mmio_num].end = end;
138 hi_mmio_num++;
139 }
140
141 if (!hi_mmio_num)
142 goto out;
143
144 /* sort the range */
145 sort(range, hi_mmio_num, sizeof(struct range), cmp_range, NULL);
146
147 if (range[hi_mmio_num - 1].end < base)
148 goto out;
149 if (range[0].start > base)
150 goto out;
151
152 /* need to find one window */
153 base = range[0].start - (1ULL << 32);
154 if ((base > tom2) && BASE_VALID(base))
155 goto out;
156 base = range[hi_mmio_num - 1].end + (1ULL << 32);
157 if ((base > tom2) && BASE_VALID(base))
158 goto out;
159 /* need to find window between ranges */
160 if (hi_mmio_num > 1)
161 for (i = 0; i < hi_mmio_num - 1; i++) {
162 if (range[i + 1].start > (range[i].end + (1ULL << 32))) {
163 base = range[i].end + (1ULL << 32);
164 if ((base > tom2) && BASE_VALID(base))
165 goto out;
166 }
167 }
168
169fail:
170 fam10h_pci_mmconf_base_status = -1;
171 return;
172out:
173 fam10h_pci_mmconf_base = base;
174 fam10h_pci_mmconf_base_status = 1;
175}
176
177void __cpuinit fam10h_check_enable_mmcfg(void)
178{
179 u64 val;
180 u32 address;
181
182 if (!(pci_probe & PCI_CHECK_ENABLE_AMD_MMCONF))
183 return;
184
185 address = MSR_FAM10H_MMIO_CONF_BASE;
186 rdmsrl(address, val);
187
188 /* try to make sure that AP's setting is identical to BSP setting */
189 if (val & FAM10H_MMIO_CONF_ENABLE) {
190 unsigned busnbits;
191 busnbits = (val >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
192 FAM10H_MMIO_CONF_BUSRANGE_MASK;
193
194 /* only trust the one handle 256 buses, if acpi=off */
195 if (!acpi_pci_disabled || busnbits >= 8) {
196 u64 base;
197 base = val & (0xffffULL << 32);
198 if (fam10h_pci_mmconf_base_status <= 0) {
199 fam10h_pci_mmconf_base = base;
200 fam10h_pci_mmconf_base_status = 1;
201 return;
202 } else if (fam10h_pci_mmconf_base == base)
203 return;
204 }
205 }
206
207 /*
208 * if it is not enabled, try to enable it and assume only one segment
209 * with 256 buses
210 */
211 get_fam10h_pci_mmconf_base();
212 if (fam10h_pci_mmconf_base_status <= 0)
213 return;
214
215 printk(KERN_INFO "Enable MMCONFIG on AMD Family 10h\n");
216 val &= ~((FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT) |
217 (FAM10H_MMIO_CONF_BUSRANGE_MASK<<FAM10H_MMIO_CONF_BUSRANGE_SHIFT));
218 val |= fam10h_pci_mmconf_base | (8 << FAM10H_MMIO_CONF_BUSRANGE_SHIFT) |
219 FAM10H_MMIO_CONF_ENABLE;
220 wrmsrl(address, val);
221}
222
223static int __devinit set_check_enable_amd_mmconf(const struct dmi_system_id *d)
224{
225 pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
226 return 0;
227}
228
229static struct dmi_system_id __devinitdata mmconf_dmi_table[] = {
230 {
231 .callback = set_check_enable_amd_mmconf,
232 .ident = "Sun Microsystems Machine",
233 .matches = {
234 DMI_MATCH(DMI_SYS_VENDOR, "Sun Microsystems"),
235 },
236 },
237 {}
238};
239
240void __init check_enable_amd_mmconf_dmi(void)
241{
242 dmi_check_system(mmconf_dmi_table);
243}
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 3e2c54dc8b29..404683b94e79 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -794,6 +794,11 @@ void __init find_smp_config(void)
794 ACPI-based MP Configuration 794 ACPI-based MP Configuration
795 -------------------------------------------------------------------------- */ 795 -------------------------------------------------------------------------- */
796 796
797/*
798 * Keep this outside and initialized to 0, for !CONFIG_ACPI builds:
799 */
800int es7000_plat;
801
797#ifdef CONFIG_ACPI 802#ifdef CONFIG_ACPI
798 803
799#ifdef CONFIG_X86_IO_APIC 804#ifdef CONFIG_X86_IO_APIC
@@ -909,8 +914,6 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
909 MP_intsrc_info(&intsrc); 914 MP_intsrc_info(&intsrc);
910} 915}
911 916
912int es7000_plat;
913
914void __init mp_config_acpi_legacy_irqs(void) 917void __init mp_config_acpi_legacy_irqs(void)
915{ 918{
916 struct mpc_config_intsrc intsrc; 919 struct mpc_config_intsrc intsrc;
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c
new file mode 100644
index 000000000000..3e6672274807
--- /dev/null
+++ b/arch/x86/kernel/olpc.c
@@ -0,0 +1,260 @@
1/*
2 * Support for the OLPC DCON and OLPC EC access
3 *
4 * Copyright © 2006 Advanced Micro Devices, Inc.
5 * Copyright © 2007-2008 Andres Salomon <dilinger@debian.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/delay.h>
17#include <linux/spinlock.h>
18#include <linux/io.h>
19#include <linux/string.h>
20#include <asm/geode.h>
21#include <asm/olpc.h>
22
23#ifdef CONFIG_OPEN_FIRMWARE
24#include <asm/ofw.h>
25#endif
26
27struct olpc_platform_t olpc_platform_info;
28EXPORT_SYMBOL_GPL(olpc_platform_info);
29
30static DEFINE_SPINLOCK(ec_lock);
31
32/* what the timeout *should* be (in ms) */
33#define EC_BASE_TIMEOUT 20
34
35/* the timeout that bugs in the EC might force us to actually use */
36static int ec_timeout = EC_BASE_TIMEOUT;
37
38static int __init olpc_ec_timeout_set(char *str)
39{
40 if (get_option(&str, &ec_timeout) != 1) {
41 ec_timeout = EC_BASE_TIMEOUT;
42 printk(KERN_ERR "olpc-ec: invalid argument to "
43 "'olpc_ec_timeout=', ignoring!\n");
44 }
45 printk(KERN_DEBUG "olpc-ec: using %d ms delay for EC commands.\n",
46 ec_timeout);
47 return 1;
48}
49__setup("olpc_ec_timeout=", olpc_ec_timeout_set);
50
51/*
52 * These {i,o}bf_status functions return whether the buffers are full or not.
53 */
54
55static inline unsigned int ibf_status(unsigned int port)
56{
57 return !!(inb(port) & 0x02);
58}
59
60static inline unsigned int obf_status(unsigned int port)
61{
62 return inb(port) & 0x01;
63}
64
65#define wait_on_ibf(p, d) __wait_on_ibf(__LINE__, (p), (d))
66static int __wait_on_ibf(unsigned int line, unsigned int port, int desired)
67{
68 unsigned int timeo;
69 int state = ibf_status(port);
70
71 for (timeo = ec_timeout; state != desired && timeo; timeo--) {
72 mdelay(1);
73 state = ibf_status(port);
74 }
75
76 if ((state == desired) && (ec_timeout > EC_BASE_TIMEOUT) &&
77 timeo < (ec_timeout - EC_BASE_TIMEOUT)) {
78 printk(KERN_WARNING "olpc-ec: %d: waited %u ms for IBF!\n",
79 line, ec_timeout - timeo);
80 }
81
82 return !(state == desired);
83}
84
85#define wait_on_obf(p, d) __wait_on_obf(__LINE__, (p), (d))
86static int __wait_on_obf(unsigned int line, unsigned int port, int desired)
87{
88 unsigned int timeo;
89 int state = obf_status(port);
90
91 for (timeo = ec_timeout; state != desired && timeo; timeo--) {
92 mdelay(1);
93 state = obf_status(port);
94 }
95
96 if ((state == desired) && (ec_timeout > EC_BASE_TIMEOUT) &&
97 timeo < (ec_timeout - EC_BASE_TIMEOUT)) {
98 printk(KERN_WARNING "olpc-ec: %d: waited %u ms for OBF!\n",
99 line, ec_timeout - timeo);
100 }
101
102 return !(state == desired);
103}
104
105/*
106 * This allows the kernel to run Embedded Controller commands. The EC is
107 * documented at <http://wiki.laptop.org/go/Embedded_controller>, and the
108 * available EC commands are here:
109 * <http://wiki.laptop.org/go/Ec_specification>. Unfortunately, while
110 * OpenFirmware's source is available, the EC's is not.
111 */
112int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
113 unsigned char *outbuf, size_t outlen)
114{
115 unsigned long flags;
116 int ret = -EIO;
117 int i;
118
119 spin_lock_irqsave(&ec_lock, flags);
120
121 /* Clear OBF */
122 for (i = 0; i < 10 && (obf_status(0x6c) == 1); i++)
123 inb(0x68);
124 if (i == 10) {
125 printk(KERN_ERR "olpc-ec: timeout while attempting to "
126 "clear OBF flag!\n");
127 goto err;
128 }
129
130 if (wait_on_ibf(0x6c, 0)) {
131 printk(KERN_ERR "olpc-ec: timeout waiting for EC to "
132 "quiesce!\n");
133 goto err;
134 }
135
136restart:
137 /*
138 * Note that if we time out during any IBF checks, that's a failure;
139 * we have to return. There's no way for the kernel to clear that.
140 *
141 * If we time out during an OBF check, we can restart the command;
142 * reissuing it will clear the OBF flag, and we should be alright.
143 * The OBF flag will sometimes misbehave due to what we believe
144 * is a hardware quirk..
145 */
146 printk(KERN_DEBUG "olpc-ec: running cmd 0x%x\n", cmd);
147 outb(cmd, 0x6c);
148
149 if (wait_on_ibf(0x6c, 0)) {
150 printk(KERN_ERR "olpc-ec: timeout waiting for EC to read "
151 "command!\n");
152 goto err;
153 }
154
155 if (inbuf && inlen) {
156 /* write data to EC */
157 for (i = 0; i < inlen; i++) {
158 if (wait_on_ibf(0x6c, 0)) {
159 printk(KERN_ERR "olpc-ec: timeout waiting for"
160 " EC accept data!\n");
161 goto err;
162 }
163 printk(KERN_DEBUG "olpc-ec: sending cmd arg 0x%x\n",
164 inbuf[i]);
165 outb(inbuf[i], 0x68);
166 }
167 }
168 if (outbuf && outlen) {
169 /* read data from EC */
170 for (i = 0; i < outlen; i++) {
171 if (wait_on_obf(0x6c, 1)) {
172 printk(KERN_ERR "olpc-ec: timeout waiting for"
173 " EC to provide data!\n");
174 goto restart;
175 }
176 outbuf[i] = inb(0x68);
177 printk(KERN_DEBUG "olpc-ec: received 0x%x\n",
178 outbuf[i]);
179 }
180 }
181
182 ret = 0;
183err:
184 spin_unlock_irqrestore(&ec_lock, flags);
185 return ret;
186}
187EXPORT_SYMBOL_GPL(olpc_ec_cmd);
188
189#ifdef CONFIG_OPEN_FIRMWARE
190static void __init platform_detect(void)
191{
192 size_t propsize;
193 u32 rev;
194
195 if (ofw("getprop", 4, 1, NULL, "board-revision-int", &rev, 4,
196 &propsize) || propsize != 4) {
197 printk(KERN_ERR "ofw: getprop call failed!\n");
198 rev = 0;
199 }
200 olpc_platform_info.boardrev = be32_to_cpu(rev);
201}
202#else
203static void __init platform_detect(void)
204{
205 /* stopgap until OFW support is added to the kernel */
206 olpc_platform_info.boardrev = be32_to_cpu(0xc2);
207}
208#endif
209
210static int __init olpc_init(void)
211{
212 unsigned char *romsig;
213
214 /* The ioremap check is dangerous; limit what we run it on */
215 if (!is_geode() || geode_has_vsa2())
216 return 0;
217
218 spin_lock_init(&ec_lock);
219
220 romsig = ioremap(0xffffffc0, 16);
221 if (!romsig)
222 return 0;
223
224 if (strncmp(romsig, "CL1 Q", 7))
225 goto unmap;
226 if (strncmp(romsig+6, romsig+13, 3)) {
227 printk(KERN_INFO "OLPC BIOS signature looks invalid. "
228 "Assuming not OLPC\n");
229 goto unmap;
230 }
231
232 printk(KERN_INFO "OLPC board with OpenFirmware %.16s\n", romsig);
233 olpc_platform_info.flags |= OLPC_F_PRESENT;
234
235 /* get the platform revision */
236 platform_detect();
237
238 /* assume B1 and above models always have a DCON */
239 if (olpc_board_at_least(olpc_board(0xb1)))
240 olpc_platform_info.flags |= OLPC_F_DCON;
241
242 /* get the EC revision */
243 olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0,
244 (unsigned char *) &olpc_platform_info.ecver, 1);
245
246 /* check to see if the VSA exists */
247 if (geode_has_vsa2())
248 olpc_platform_info.flags |= OLPC_F_VSA;
249
250 printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n",
251 ((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "",
252 olpc_platform_info.boardrev >> 4,
253 olpc_platform_info.ecver);
254
255unmap:
256 iounmap(romsig);
257 return 0;
258}
259
260postcore_initcall(olpc_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 388b113a7d88..0c37f16b6950 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -14,7 +14,7 @@ EXPORT_SYMBOL(forbid_dac);
14const struct dma_mapping_ops *dma_ops; 14const struct dma_mapping_ops *dma_ops;
15EXPORT_SYMBOL(dma_ops); 15EXPORT_SYMBOL(dma_ops);
16 16
17int iommu_sac_force __read_mostly = 0; 17static int iommu_sac_force __read_mostly;
18 18
19#ifdef CONFIG_IOMMU_DEBUG 19#ifdef CONFIG_IOMMU_DEBUG
20int panic_on_overflow __read_mostly = 1; 20int panic_on_overflow __read_mostly = 1;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index a4a838306b2c..f6be7d5f82f8 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -9,6 +9,7 @@
9#include <asm/desc.h> 9#include <asm/desc.h>
10#include <asm/hpet.h> 10#include <asm/hpet.h>
11#include <asm/pgtable.h> 11#include <asm/pgtable.h>
12#include <asm/proto.h>
12#include <asm/reboot_fixups.h> 13#include <asm/reboot_fixups.h>
13#include <asm/reboot.h> 14#include <asm/reboot.h>
14 15
@@ -148,7 +149,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
148 .matches = { 149 .matches = {
149 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 150 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
150 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"), 151 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
151 DMI_MATCH(DMI_BOARD_NAME, "0WF810"),
152 }, 152 },
153 }, 153 },
154 { /* Handle problems with rebooting on Dell Optiplex 745's DFF*/ 154 { /* Handle problems with rebooting on Dell Optiplex 745's DFF*/
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c0c68c18a788..cc6f5eb20b24 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -95,7 +95,7 @@ void __init setup_per_cpu_areas(void)
95 95
96 /* Copy section for each CPU (we discard the original) */ 96 /* Copy section for each CPU (we discard the original) */
97 size = PERCPU_ENOUGH_ROOM; 97 size = PERCPU_ENOUGH_ROOM;
98 printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", 98 printk(KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n",
99 size); 99 size);
100 100
101 for_each_possible_cpu(i) { 101 for_each_possible_cpu(i) {
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index a94fb959a87a..22c14e21c97c 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -29,6 +29,7 @@
29#include <linux/crash_dump.h> 29#include <linux/crash_dump.h>
30#include <linux/root_dev.h> 30#include <linux/root_dev.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <asm/pci-direct.h>
32#include <linux/efi.h> 33#include <linux/efi.h>
33#include <linux/acpi.h> 34#include <linux/acpi.h>
34#include <linux/kallsyms.h> 35#include <linux/kallsyms.h>
@@ -40,6 +41,7 @@
40#include <linux/dmi.h> 41#include <linux/dmi.h>
41#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
42#include <linux/ctype.h> 43#include <linux/ctype.h>
44#include <linux/sort.h>
43#include <linux/uaccess.h> 45#include <linux/uaccess.h>
44#include <linux/init_ohci1394_dma.h> 46#include <linux/init_ohci1394_dma.h>
45#include <linux/kvm_para.h> 47#include <linux/kvm_para.h>
@@ -288,6 +290,18 @@ static void __init parse_setup_data(void)
288 } 290 }
289} 291}
290 292
293#ifdef CONFIG_PCI_MMCONFIG
294extern void __cpuinit fam10h_check_enable_mmcfg(void);
295extern void __init check_enable_amd_mmconf_dmi(void);
296#else
297void __cpuinit fam10h_check_enable_mmcfg(void)
298{
299}
300void __init check_enable_amd_mmconf_dmi(void)
301{
302}
303#endif
304
291/* 305/*
292 * setup_arch - architecture-specific boot-time initializations 306 * setup_arch - architecture-specific boot-time initializations
293 * 307 *
@@ -515,6 +529,9 @@ void __init setup_arch(char **cmdline_p)
515 conswitchp = &dummy_con; 529 conswitchp = &dummy_con;
516#endif 530#endif
517#endif 531#endif
532
533 /* do this before identify_cpu for boot cpu */
534 check_enable_amd_mmconf_dmi();
518} 535}
519 536
520static int __cpuinit get_model_name(struct cpuinfo_x86 *c) 537static int __cpuinit get_model_name(struct cpuinfo_x86 *c)
@@ -767,6 +784,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
767 /* MFENCE stops RDTSC speculation */ 784 /* MFENCE stops RDTSC speculation */
768 set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC); 785 set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC);
769 786
787 if (c->x86 == 0x10)
788 fam10h_check_enable_mmcfg();
789
770 if (amd_apic_timer_broken()) 790 if (amd_apic_timer_broken())
771 disable_apic_timer = 1; 791 disable_apic_timer = 1;
772 792
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index 8e05e7f7bd40..d92373630963 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -57,7 +57,7 @@ sys_sigsuspend(int history0, int history1, old_sigset_t mask)
57 57
58 current->state = TASK_INTERRUPTIBLE; 58 current->state = TASK_INTERRUPTIBLE;
59 schedule(); 59 schedule();
60 set_thread_flag(TIF_RESTORE_SIGMASK); 60 set_restore_sigmask();
61 61
62 return -ERESTARTNOHAND; 62 return -ERESTARTNOHAND;
63} 63}
@@ -593,7 +593,7 @@ static void do_signal(struct pt_regs *regs)
593 if (!user_mode(regs)) 593 if (!user_mode(regs))
594 return; 594 return;
595 595
596 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 596 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
597 oldset = &current->saved_sigmask; 597 oldset = &current->saved_sigmask;
598 else 598 else
599 oldset = &current->blocked; 599 oldset = &current->blocked;
@@ -612,13 +612,12 @@ static void do_signal(struct pt_regs *regs)
612 /* Whee! Actually deliver the signal. */ 612 /* Whee! Actually deliver the signal. */
613 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { 613 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
614 /* 614 /*
615 * a signal was successfully delivered; the saved 615 * A signal was successfully delivered; the saved
616 * sigmask will have been stored in the signal frame, 616 * sigmask will have been stored in the signal frame,
617 * and will be restored by sigreturn, so we can simply 617 * and will be restored by sigreturn, so we can simply
618 * clear the TIF_RESTORE_SIGMASK flag 618 * clear the TS_RESTORE_SIGMASK flag.
619 */ 619 */
620 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 620 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
621 clear_thread_flag(TIF_RESTORE_SIGMASK);
622 } 621 }
623 return; 622 return;
624 } 623 }
@@ -645,8 +644,8 @@ static void do_signal(struct pt_regs *regs)
645 * If there's no signal to deliver, we just put the saved sigmask 644 * If there's no signal to deliver, we just put the saved sigmask
646 * back. 645 * back.
647 */ 646 */
648 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 647 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
649 clear_thread_flag(TIF_RESTORE_SIGMASK); 648 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
650 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 649 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
651 } 650 }
652} 651}
@@ -665,7 +664,7 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
665 } 664 }
666 665
667 /* deal with pending signal delivery */ 666 /* deal with pending signal delivery */
668 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 667 if (thread_info_flags & _TIF_SIGPENDING)
669 do_signal(regs); 668 do_signal(regs);
670 669
671 if (thread_info_flags & _TIF_HRTICK_RESCHED) 670 if (thread_info_flags & _TIF_HRTICK_RESCHED)
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index ccb2a4560c2d..e53b267662e7 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -427,7 +427,7 @@ static void do_signal(struct pt_regs *regs)
427 if (!user_mode(regs)) 427 if (!user_mode(regs))
428 return; 428 return;
429 429
430 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 430 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
431 oldset = &current->saved_sigmask; 431 oldset = &current->saved_sigmask;
432 else 432 else
433 oldset = &current->blocked; 433 oldset = &current->blocked;
@@ -444,11 +444,13 @@ static void do_signal(struct pt_regs *regs)
444 444
445 /* Whee! Actually deliver the signal. */ 445 /* Whee! Actually deliver the signal. */
446 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { 446 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
447 /* a signal was successfully delivered; the saved 447 /*
448 * A signal was successfully delivered; the saved
448 * sigmask will have been stored in the signal frame, 449 * sigmask will have been stored in the signal frame,
449 * and will be restored by sigreturn, so we can simply 450 * and will be restored by sigreturn, so we can simply
450 * clear the TIF_RESTORE_SIGMASK flag */ 451 * clear the TS_RESTORE_SIGMASK flag.
451 clear_thread_flag(TIF_RESTORE_SIGMASK); 452 */
453 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
452 } 454 }
453 return; 455 return;
454 } 456 }
@@ -476,8 +478,8 @@ static void do_signal(struct pt_regs *regs)
476 * If there's no signal to deliver, we just put the saved sigmask 478 * If there's no signal to deliver, we just put the saved sigmask
477 * back. 479 * back.
478 */ 480 */
479 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 481 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
480 clear_thread_flag(TIF_RESTORE_SIGMASK); 482 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
481 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 483 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
482 } 484 }
483} 485}
@@ -498,7 +500,7 @@ void do_notify_resume(struct pt_regs *regs, void *unused,
498#endif /* CONFIG_X86_MCE */ 500#endif /* CONFIG_X86_MCE */
499 501
500 /* deal with pending signal delivery */ 502 /* deal with pending signal delivery */
501 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 503 if (thread_info_flags & _TIF_SIGPENDING)
502 do_signal(regs); 504 do_signal(regs);
503 505
504 if (thread_info_flags & _TIF_HRTICK_RESCHED) 506 if (thread_info_flags & _TIF_HRTICK_RESCHED)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 04c662ba18f1..6b087ab6cd8f 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -299,7 +299,7 @@ static void __cpuinit smp_callin(void)
299/* 299/*
300 * Activate a secondary processor. 300 * Activate a secondary processor.
301 */ 301 */
302void __cpuinit start_secondary(void *unused) 302static void __cpuinit start_secondary(void *unused)
303{ 303{
304 /* 304 /*
305 * Don't put *anything* before cpu_init(), SMP booting is too 305 * Don't put *anything* before cpu_init(), SMP booting is too
@@ -1149,14 +1149,10 @@ static int __init smp_sanity_check(unsigned max_cpus)
1149 "forcing use of dummy APIC emulation.\n"); 1149 "forcing use of dummy APIC emulation.\n");
1150 smpboot_clear_io_apic(); 1150 smpboot_clear_io_apic();
1151#ifdef CONFIG_X86_32 1151#ifdef CONFIG_X86_32
1152 if (nmi_watchdog == NMI_LOCAL_APIC) { 1152 connect_bsp_APIC();
1153 printk(KERN_INFO "activating minimal APIC for"
1154 "NMI watchdog use.\n");
1155 connect_bsp_APIC();
1156 setup_local_APIC();
1157 end_local_APIC_setup();
1158 }
1159#endif 1153#endif
1154 setup_local_APIC();
1155 end_local_APIC_setup();
1160 return -1; 1156 return -1;
1161 } 1157 }
1162 1158
@@ -1310,7 +1306,7 @@ static void remove_siblinginfo(int cpu)
1310 cpu_clear(cpu, cpu_sibling_setup_map); 1306 cpu_clear(cpu, cpu_sibling_setup_map);
1311} 1307}
1312 1308
1313int additional_cpus __initdata = -1; 1309static int additional_cpus __initdata = -1;
1314 1310
1315static __init int setup_additional_cpus(char *s) 1311static __init int setup_additional_cpus(char *s)
1316{ 1312{
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index a86d26f036e1..d2ab52cc1d6b 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -22,23 +22,6 @@
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/unistd.h> 23#include <asm/unistd.h>
24 24
25/*
26 * sys_pipe() is the normal C calling standard for creating
27 * a pipe. It's not the way Unix traditionally does this, though.
28 */
29asmlinkage int sys_pipe(unsigned long __user * fildes)
30{
31 int fd[2];
32 int error;
33
34 error = do_pipe(fd);
35 if (!error) {
36 if (copy_to_user(fildes, fd, 2*sizeof(int)))
37 error = -EFAULT;
38 }
39 return error;
40}
41
42asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 25asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
43 unsigned long prot, unsigned long flags, 26 unsigned long prot, unsigned long flags,
44 unsigned long fd, unsigned long pgoff) 27 unsigned long fd, unsigned long pgoff)
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index bd802a5e1aa3..3b360ef33817 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -17,23 +17,6 @@
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/ia32.h> 18#include <asm/ia32.h>
19 19
20/*
21 * sys_pipe() is the normal C calling standard for creating
22 * a pipe. It's not the way Unix traditionally does this, though.
23 */
24asmlinkage long sys_pipe(int __user *fildes)
25{
26 int fd[2];
27 int error;
28
29 error = do_pipe(fd);
30 if (!error) {
31 if (copy_to_user(fildes, fd, 2*sizeof(int)))
32 error = -EFAULT;
33 }
34 return error;
35}
36
37asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, 20asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags,
38 unsigned long fd, unsigned long off) 21 unsigned long fd, unsigned long off)
39{ 22{
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index 1a89e93f3f1c..2ff21f398934 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -115,7 +115,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
115 return IRQ_HANDLED; 115 return IRQ_HANDLED;
116} 116}
117 117
118extern void (*late_time_init)(void);
119/* Duplicate of time_init() below, with hpet_enable part added */ 118/* Duplicate of time_init() below, with hpet_enable part added */
120void __init hpet_time_init(void) 119void __init hpet_time_init(void)
121{ 120{
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index caf2a26f5cfd..ba8c0b75ab0a 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -133,7 +133,7 @@ int is_vsmp_box(void)
133 } 133 }
134} 134}
135#else 135#else
136static int __init detect_vsmp_box(void) 136static void __init detect_vsmp_box(void)
137{ 137{
138} 138}
139int is_vsmp_box(void) 139int is_vsmp_box(void)
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 361e31611276..3324d90038e4 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -35,7 +35,7 @@
35#include "i8254.h" 35#include "i8254.h"
36 36
37#ifndef CONFIG_X86_64 37#ifndef CONFIG_X86_64
38#define mod_64(x, y) ((x) - (y) * div64_64(x, y)) 38#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
39#else 39#else
40#define mod_64(x, y) ((x) % (y)) 40#define mod_64(x, y) ((x) % (y))
41#endif 41#endif
@@ -60,8 +60,8 @@ static u64 muldiv64(u64 a, u32 b, u32 c)
60 rl = (u64)u.l.low * (u64)b; 60 rl = (u64)u.l.low * (u64)b;
61 rh = (u64)u.l.high * (u64)b; 61 rh = (u64)u.l.high * (u64)b;
62 rh += (rl >> 32); 62 rh += (rl >> 32);
63 res.l.high = div64_64(rh, c); 63 res.l.high = div64_u64(rh, c);
64 res.l.low = div64_64(((mod_64(rh, c) << 32) + (rl & 0xffffffff)), c); 64 res.l.low = div64_u64(((mod_64(rh, c) << 32) + (rl & 0xffffffff)), c);
65 return res.ll; 65 return res.ll;
66} 66}
67 67
@@ -288,6 +288,8 @@ static void pit_load_count(struct kvm *kvm, int channel, u32 val)
288 * mode 1 is one shot, mode 2 is period, otherwise del timer */ 288 * mode 1 is one shot, mode 2 is period, otherwise del timer */
289 switch (ps->channels[0].mode) { 289 switch (ps->channels[0].mode) {
290 case 1: 290 case 1:
291 /* FIXME: enhance mode 4 precision */
292 case 4:
291 create_pit_timer(&ps->pit_timer, val, 0); 293 create_pit_timer(&ps->pit_timer, val, 0);
292 break; 294 break;
293 case 2: 295 case 2:
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 57ac4e4c556a..36809d79788b 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -25,13 +25,13 @@
25#include <linux/hrtimer.h> 25#include <linux/hrtimer.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/math64.h>
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/msr.h> 30#include <asm/msr.h>
30#include <asm/page.h> 31#include <asm/page.h>
31#include <asm/current.h> 32#include <asm/current.h>
32#include <asm/apicdef.h> 33#include <asm/apicdef.h>
33#include <asm/atomic.h> 34#include <asm/atomic.h>
34#include <asm/div64.h>
35#include "irq.h" 35#include "irq.h"
36 36
37#define PRId64 "d" 37#define PRId64 "d"
@@ -526,8 +526,8 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
526 } else 526 } else
527 passed = ktime_sub(now, apic->timer.last_update); 527 passed = ktime_sub(now, apic->timer.last_update);
528 528
529 counter_passed = div64_64(ktime_to_ns(passed), 529 counter_passed = div64_u64(ktime_to_ns(passed),
530 (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); 530 (APIC_BUS_CYCLE_NS * apic->timer.divide_count));
531 531
532 if (counter_passed > tmcct) { 532 if (counter_passed > tmcct) {
533 if (unlikely(!apic_lvtt_period(apic))) { 533 if (unlikely(!apic_lvtt_period(apic))) {
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 2ad6f5481671..36c5406b1813 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -79,36 +79,6 @@ static int dbg = 1;
79 } 79 }
80#endif 80#endif
81 81
82#define PT64_PT_BITS 9
83#define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS)
84#define PT32_PT_BITS 10
85#define PT32_ENT_PER_PAGE (1 << PT32_PT_BITS)
86
87#define PT_WRITABLE_SHIFT 1
88
89#define PT_PRESENT_MASK (1ULL << 0)
90#define PT_WRITABLE_MASK (1ULL << PT_WRITABLE_SHIFT)
91#define PT_USER_MASK (1ULL << 2)
92#define PT_PWT_MASK (1ULL << 3)
93#define PT_PCD_MASK (1ULL << 4)
94#define PT_ACCESSED_MASK (1ULL << 5)
95#define PT_DIRTY_MASK (1ULL << 6)
96#define PT_PAGE_SIZE_MASK (1ULL << 7)
97#define PT_PAT_MASK (1ULL << 7)
98#define PT_GLOBAL_MASK (1ULL << 8)
99#define PT64_NX_SHIFT 63
100#define PT64_NX_MASK (1ULL << PT64_NX_SHIFT)
101
102#define PT_PAT_SHIFT 7
103#define PT_DIR_PAT_SHIFT 12
104#define PT_DIR_PAT_MASK (1ULL << PT_DIR_PAT_SHIFT)
105
106#define PT32_DIR_PSE36_SIZE 4
107#define PT32_DIR_PSE36_SHIFT 13
108#define PT32_DIR_PSE36_MASK \
109 (((1ULL << PT32_DIR_PSE36_SIZE) - 1) << PT32_DIR_PSE36_SHIFT)
110
111
112#define PT_FIRST_AVAIL_BITS_SHIFT 9 82#define PT_FIRST_AVAIL_BITS_SHIFT 9
113#define PT64_SECOND_AVAIL_BITS_SHIFT 52 83#define PT64_SECOND_AVAIL_BITS_SHIFT 52
114 84
@@ -154,10 +124,6 @@ static int dbg = 1;
154#define PFERR_USER_MASK (1U << 2) 124#define PFERR_USER_MASK (1U << 2)
155#define PFERR_FETCH_MASK (1U << 4) 125#define PFERR_FETCH_MASK (1U << 4)
156 126
157#define PT64_ROOT_LEVEL 4
158#define PT32_ROOT_LEVEL 2
159#define PT32E_ROOT_LEVEL 3
160
161#define PT_DIRECTORY_LEVEL 2 127#define PT_DIRECTORY_LEVEL 2
162#define PT_PAGE_TABLE_LEVEL 1 128#define PT_PAGE_TABLE_LEVEL 1
163 129
@@ -186,6 +152,12 @@ static struct kmem_cache *mmu_page_header_cache;
186 152
187static u64 __read_mostly shadow_trap_nonpresent_pte; 153static u64 __read_mostly shadow_trap_nonpresent_pte;
188static u64 __read_mostly shadow_notrap_nonpresent_pte; 154static u64 __read_mostly shadow_notrap_nonpresent_pte;
155static u64 __read_mostly shadow_base_present_pte;
156static u64 __read_mostly shadow_nx_mask;
157static u64 __read_mostly shadow_x_mask; /* mutual exclusive with nx_mask */
158static u64 __read_mostly shadow_user_mask;
159static u64 __read_mostly shadow_accessed_mask;
160static u64 __read_mostly shadow_dirty_mask;
189 161
190void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte) 162void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte)
191{ 163{
@@ -194,6 +166,23 @@ void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte)
194} 166}
195EXPORT_SYMBOL_GPL(kvm_mmu_set_nonpresent_ptes); 167EXPORT_SYMBOL_GPL(kvm_mmu_set_nonpresent_ptes);
196 168
169void kvm_mmu_set_base_ptes(u64 base_pte)
170{
171 shadow_base_present_pte = base_pte;
172}
173EXPORT_SYMBOL_GPL(kvm_mmu_set_base_ptes);
174
175void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
176 u64 dirty_mask, u64 nx_mask, u64 x_mask)
177{
178 shadow_user_mask = user_mask;
179 shadow_accessed_mask = accessed_mask;
180 shadow_dirty_mask = dirty_mask;
181 shadow_nx_mask = nx_mask;
182 shadow_x_mask = x_mask;
183}
184EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes);
185
197static int is_write_protection(struct kvm_vcpu *vcpu) 186static int is_write_protection(struct kvm_vcpu *vcpu)
198{ 187{
199 return vcpu->arch.cr0 & X86_CR0_WP; 188 return vcpu->arch.cr0 & X86_CR0_WP;
@@ -232,7 +221,7 @@ static int is_writeble_pte(unsigned long pte)
232 221
233static int is_dirty_pte(unsigned long pte) 222static int is_dirty_pte(unsigned long pte)
234{ 223{
235 return pte & PT_DIRTY_MASK; 224 return pte & shadow_dirty_mask;
236} 225}
237 226
238static int is_rmap_pte(u64 pte) 227static int is_rmap_pte(u64 pte)
@@ -387,7 +376,6 @@ static void account_shadowed(struct kvm *kvm, gfn_t gfn)
387 376
388 write_count = slot_largepage_idx(gfn, gfn_to_memslot(kvm, gfn)); 377 write_count = slot_largepage_idx(gfn, gfn_to_memslot(kvm, gfn));
389 *write_count += 1; 378 *write_count += 1;
390 WARN_ON(*write_count > KVM_PAGES_PER_HPAGE);
391} 379}
392 380
393static void unaccount_shadowed(struct kvm *kvm, gfn_t gfn) 381static void unaccount_shadowed(struct kvm *kvm, gfn_t gfn)
@@ -547,7 +535,7 @@ static void rmap_remove(struct kvm *kvm, u64 *spte)
547 return; 535 return;
548 sp = page_header(__pa(spte)); 536 sp = page_header(__pa(spte));
549 pfn = spte_to_pfn(*spte); 537 pfn = spte_to_pfn(*spte);
550 if (*spte & PT_ACCESSED_MASK) 538 if (*spte & shadow_accessed_mask)
551 kvm_set_pfn_accessed(pfn); 539 kvm_set_pfn_accessed(pfn);
552 if (is_writeble_pte(*spte)) 540 if (is_writeble_pte(*spte))
553 kvm_release_pfn_dirty(pfn); 541 kvm_release_pfn_dirty(pfn);
@@ -1073,17 +1061,17 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1073 * whether the guest actually used the pte (in order to detect 1061 * whether the guest actually used the pte (in order to detect
1074 * demand paging). 1062 * demand paging).
1075 */ 1063 */
1076 spte = PT_PRESENT_MASK | PT_DIRTY_MASK; 1064 spte = shadow_base_present_pte | shadow_dirty_mask;
1077 if (!speculative) 1065 if (!speculative)
1078 pte_access |= PT_ACCESSED_MASK; 1066 pte_access |= PT_ACCESSED_MASK;
1079 if (!dirty) 1067 if (!dirty)
1080 pte_access &= ~ACC_WRITE_MASK; 1068 pte_access &= ~ACC_WRITE_MASK;
1081 if (!(pte_access & ACC_EXEC_MASK)) 1069 if (pte_access & ACC_EXEC_MASK)
1082 spte |= PT64_NX_MASK; 1070 spte |= shadow_x_mask;
1083 1071 else
1084 spte |= PT_PRESENT_MASK; 1072 spte |= shadow_nx_mask;
1085 if (pte_access & ACC_USER_MASK) 1073 if (pte_access & ACC_USER_MASK)
1086 spte |= PT_USER_MASK; 1074 spte |= shadow_user_mask;
1087 if (largepage) 1075 if (largepage)
1088 spte |= PT_PAGE_SIZE_MASK; 1076 spte |= PT_PAGE_SIZE_MASK;
1089 1077
@@ -1188,8 +1176,9 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
1188 return -ENOMEM; 1176 return -ENOMEM;
1189 } 1177 }
1190 1178
1191 table[index] = __pa(new_table->spt) | PT_PRESENT_MASK 1179 table[index] = __pa(new_table->spt)
1192 | PT_WRITABLE_MASK | PT_USER_MASK; 1180 | PT_PRESENT_MASK | PT_WRITABLE_MASK
1181 | shadow_user_mask | shadow_x_mask;
1193 } 1182 }
1194 table_addr = table[index] & PT64_BASE_ADDR_MASK; 1183 table_addr = table[index] & PT64_BASE_ADDR_MASK;
1195 } 1184 }
@@ -1244,7 +1233,6 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu)
1244 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) 1233 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
1245 return; 1234 return;
1246 spin_lock(&vcpu->kvm->mmu_lock); 1235 spin_lock(&vcpu->kvm->mmu_lock);
1247#ifdef CONFIG_X86_64
1248 if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) { 1236 if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) {
1249 hpa_t root = vcpu->arch.mmu.root_hpa; 1237 hpa_t root = vcpu->arch.mmu.root_hpa;
1250 1238
@@ -1256,7 +1244,6 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu)
1256 spin_unlock(&vcpu->kvm->mmu_lock); 1244 spin_unlock(&vcpu->kvm->mmu_lock);
1257 return; 1245 return;
1258 } 1246 }
1259#endif
1260 for (i = 0; i < 4; ++i) { 1247 for (i = 0; i < 4; ++i) {
1261 hpa_t root = vcpu->arch.mmu.pae_root[i]; 1248 hpa_t root = vcpu->arch.mmu.pae_root[i];
1262 1249
@@ -1282,7 +1269,6 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
1282 1269
1283 root_gfn = vcpu->arch.cr3 >> PAGE_SHIFT; 1270 root_gfn = vcpu->arch.cr3 >> PAGE_SHIFT;
1284 1271
1285#ifdef CONFIG_X86_64
1286 if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) { 1272 if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) {
1287 hpa_t root = vcpu->arch.mmu.root_hpa; 1273 hpa_t root = vcpu->arch.mmu.root_hpa;
1288 1274
@@ -1297,7 +1283,6 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
1297 vcpu->arch.mmu.root_hpa = root; 1283 vcpu->arch.mmu.root_hpa = root;
1298 return; 1284 return;
1299 } 1285 }
1300#endif
1301 metaphysical = !is_paging(vcpu); 1286 metaphysical = !is_paging(vcpu);
1302 if (tdp_enabled) 1287 if (tdp_enabled)
1303 metaphysical = 1; 1288 metaphysical = 1;
@@ -1377,7 +1362,7 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa,
1377 spin_lock(&vcpu->kvm->mmu_lock); 1362 spin_lock(&vcpu->kvm->mmu_lock);
1378 kvm_mmu_free_some_pages(vcpu); 1363 kvm_mmu_free_some_pages(vcpu);
1379 r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK, 1364 r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK,
1380 largepage, gfn, pfn, TDP_ROOT_LEVEL); 1365 largepage, gfn, pfn, kvm_x86_ops->get_tdp_level());
1381 spin_unlock(&vcpu->kvm->mmu_lock); 1366 spin_unlock(&vcpu->kvm->mmu_lock);
1382 1367
1383 return r; 1368 return r;
@@ -1484,7 +1469,7 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
1484 context->page_fault = tdp_page_fault; 1469 context->page_fault = tdp_page_fault;
1485 context->free = nonpaging_free; 1470 context->free = nonpaging_free;
1486 context->prefetch_page = nonpaging_prefetch_page; 1471 context->prefetch_page = nonpaging_prefetch_page;
1487 context->shadow_root_level = TDP_ROOT_LEVEL; 1472 context->shadow_root_level = kvm_x86_ops->get_tdp_level();
1488 context->root_hpa = INVALID_PAGE; 1473 context->root_hpa = INVALID_PAGE;
1489 1474
1490 if (!is_paging(vcpu)) { 1475 if (!is_paging(vcpu)) {
@@ -1633,7 +1618,7 @@ static bool last_updated_pte_accessed(struct kvm_vcpu *vcpu)
1633{ 1618{
1634 u64 *spte = vcpu->arch.last_pte_updated; 1619 u64 *spte = vcpu->arch.last_pte_updated;
1635 1620
1636 return !!(spte && (*spte & PT_ACCESSED_MASK)); 1621 return !!(spte && (*spte & shadow_accessed_mask));
1637} 1622}
1638 1623
1639static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, 1624static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index e64e9f56a65e..1730757bbc7a 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -3,11 +3,38 @@
3 3
4#include <linux/kvm_host.h> 4#include <linux/kvm_host.h>
5 5
6#ifdef CONFIG_X86_64 6#define PT64_PT_BITS 9
7#define TDP_ROOT_LEVEL PT64_ROOT_LEVEL 7#define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS)
8#else 8#define PT32_PT_BITS 10
9#define TDP_ROOT_LEVEL PT32E_ROOT_LEVEL 9#define PT32_ENT_PER_PAGE (1 << PT32_PT_BITS)
10#endif 10
11#define PT_WRITABLE_SHIFT 1
12
13#define PT_PRESENT_MASK (1ULL << 0)
14#define PT_WRITABLE_MASK (1ULL << PT_WRITABLE_SHIFT)
15#define PT_USER_MASK (1ULL << 2)
16#define PT_PWT_MASK (1ULL << 3)
17#define PT_PCD_MASK (1ULL << 4)
18#define PT_ACCESSED_MASK (1ULL << 5)
19#define PT_DIRTY_MASK (1ULL << 6)
20#define PT_PAGE_SIZE_MASK (1ULL << 7)
21#define PT_PAT_MASK (1ULL << 7)
22#define PT_GLOBAL_MASK (1ULL << 8)
23#define PT64_NX_SHIFT 63
24#define PT64_NX_MASK (1ULL << PT64_NX_SHIFT)
25
26#define PT_PAT_SHIFT 7
27#define PT_DIR_PAT_SHIFT 12
28#define PT_DIR_PAT_MASK (1ULL << PT_DIR_PAT_SHIFT)
29
30#define PT32_DIR_PSE36_SIZE 4
31#define PT32_DIR_PSE36_SHIFT 13
32#define PT32_DIR_PSE36_MASK \
33 (((1ULL << PT32_DIR_PSE36_SIZE) - 1) << PT32_DIR_PSE36_SHIFT)
34
35#define PT64_ROOT_LEVEL 4
36#define PT32_ROOT_LEVEL 2
37#define PT32E_ROOT_LEVEL 3
11 38
12static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) 39static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
13{ 40{
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 89e0be2c10d0..ab22615eee89 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1863,6 +1863,15 @@ static bool svm_cpu_has_accelerated_tpr(void)
1863 return false; 1863 return false;
1864} 1864}
1865 1865
1866static int get_npt_level(void)
1867{
1868#ifdef CONFIG_X86_64
1869 return PT64_ROOT_LEVEL;
1870#else
1871 return PT32E_ROOT_LEVEL;
1872#endif
1873}
1874
1866static struct kvm_x86_ops svm_x86_ops = { 1875static struct kvm_x86_ops svm_x86_ops = {
1867 .cpu_has_kvm_support = has_svm, 1876 .cpu_has_kvm_support = has_svm,
1868 .disabled_by_bios = is_disabled, 1877 .disabled_by_bios = is_disabled,
@@ -1920,6 +1929,7 @@ static struct kvm_x86_ops svm_x86_ops = {
1920 .inject_pending_vectors = do_interrupt_requests, 1929 .inject_pending_vectors = do_interrupt_requests,
1921 1930
1922 .set_tss_addr = svm_set_tss_addr, 1931 .set_tss_addr = svm_set_tss_addr,
1932 .get_tdp_level = get_npt_level,
1923}; 1933};
1924 1934
1925static int __init svm_init(void) 1935static int __init svm_init(void)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 8e5d6645b90d..bfe4db11989c 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -42,6 +42,9 @@ module_param(enable_vpid, bool, 0);
42static int flexpriority_enabled = 1; 42static int flexpriority_enabled = 1;
43module_param(flexpriority_enabled, bool, 0); 43module_param(flexpriority_enabled, bool, 0);
44 44
45static int enable_ept = 1;
46module_param(enable_ept, bool, 0);
47
45struct vmcs { 48struct vmcs {
46 u32 revision_id; 49 u32 revision_id;
47 u32 abort; 50 u32 abort;
@@ -84,7 +87,7 @@ static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu)
84 return container_of(vcpu, struct vcpu_vmx, vcpu); 87 return container_of(vcpu, struct vcpu_vmx, vcpu);
85} 88}
86 89
87static int init_rmode_tss(struct kvm *kvm); 90static int init_rmode(struct kvm *kvm);
88 91
89static DEFINE_PER_CPU(struct vmcs *, vmxarea); 92static DEFINE_PER_CPU(struct vmcs *, vmxarea);
90static DEFINE_PER_CPU(struct vmcs *, current_vmcs); 93static DEFINE_PER_CPU(struct vmcs *, current_vmcs);
@@ -107,6 +110,11 @@ static struct vmcs_config {
107 u32 vmentry_ctrl; 110 u32 vmentry_ctrl;
108} vmcs_config; 111} vmcs_config;
109 112
113struct vmx_capability {
114 u32 ept;
115 u32 vpid;
116} vmx_capability;
117
110#define VMX_SEGMENT_FIELD(seg) \ 118#define VMX_SEGMENT_FIELD(seg) \
111 [VCPU_SREG_##seg] = { \ 119 [VCPU_SREG_##seg] = { \
112 .selector = GUEST_##seg##_SELECTOR, \ 120 .selector = GUEST_##seg##_SELECTOR, \
@@ -214,6 +222,32 @@ static inline bool cpu_has_vmx_virtualize_apic_accesses(void)
214 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); 222 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES);
215} 223}
216 224
225static inline int cpu_has_vmx_invept_individual_addr(void)
226{
227 return (!!(vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT));
228}
229
230static inline int cpu_has_vmx_invept_context(void)
231{
232 return (!!(vmx_capability.ept & VMX_EPT_EXTENT_CONTEXT_BIT));
233}
234
235static inline int cpu_has_vmx_invept_global(void)
236{
237 return (!!(vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT));
238}
239
240static inline int cpu_has_vmx_ept(void)
241{
242 return (vmcs_config.cpu_based_2nd_exec_ctrl &
243 SECONDARY_EXEC_ENABLE_EPT);
244}
245
246static inline int vm_need_ept(void)
247{
248 return (cpu_has_vmx_ept() && enable_ept);
249}
250
217static inline int vm_need_virtualize_apic_accesses(struct kvm *kvm) 251static inline int vm_need_virtualize_apic_accesses(struct kvm *kvm)
218{ 252{
219 return ((cpu_has_vmx_virtualize_apic_accesses()) && 253 return ((cpu_has_vmx_virtualize_apic_accesses()) &&
@@ -250,6 +284,18 @@ static inline void __invvpid(int ext, u16 vpid, gva_t gva)
250 : : "a"(&operand), "c"(ext) : "cc", "memory"); 284 : : "a"(&operand), "c"(ext) : "cc", "memory");
251} 285}
252 286
287static inline void __invept(int ext, u64 eptp, gpa_t gpa)
288{
289 struct {
290 u64 eptp, gpa;
291 } operand = {eptp, gpa};
292
293 asm volatile (ASM_VMX_INVEPT
294 /* CF==1 or ZF==1 --> rc = -1 */
295 "; ja 1f ; ud2 ; 1:\n"
296 : : "a" (&operand), "c" (ext) : "cc", "memory");
297}
298
253static struct kvm_msr_entry *find_msr_entry(struct vcpu_vmx *vmx, u32 msr) 299static struct kvm_msr_entry *find_msr_entry(struct vcpu_vmx *vmx, u32 msr)
254{ 300{
255 int i; 301 int i;
@@ -301,6 +347,33 @@ static inline void vpid_sync_vcpu_all(struct vcpu_vmx *vmx)
301 __invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0); 347 __invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0);
302} 348}
303 349
350static inline void ept_sync_global(void)
351{
352 if (cpu_has_vmx_invept_global())
353 __invept(VMX_EPT_EXTENT_GLOBAL, 0, 0);
354}
355
356static inline void ept_sync_context(u64 eptp)
357{
358 if (vm_need_ept()) {
359 if (cpu_has_vmx_invept_context())
360 __invept(VMX_EPT_EXTENT_CONTEXT, eptp, 0);
361 else
362 ept_sync_global();
363 }
364}
365
366static inline void ept_sync_individual_addr(u64 eptp, gpa_t gpa)
367{
368 if (vm_need_ept()) {
369 if (cpu_has_vmx_invept_individual_addr())
370 __invept(VMX_EPT_EXTENT_INDIVIDUAL_ADDR,
371 eptp, gpa);
372 else
373 ept_sync_context(eptp);
374 }
375}
376
304static unsigned long vmcs_readl(unsigned long field) 377static unsigned long vmcs_readl(unsigned long field)
305{ 378{
306 unsigned long value; 379 unsigned long value;
@@ -388,6 +461,8 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)
388 eb |= 1u << 1; 461 eb |= 1u << 1;
389 if (vcpu->arch.rmode.active) 462 if (vcpu->arch.rmode.active)
390 eb = ~0; 463 eb = ~0;
464 if (vm_need_ept())
465 eb &= ~(1u << PF_VECTOR); /* bypass_guest_pf = 0 */
391 vmcs_write32(EXCEPTION_BITMAP, eb); 466 vmcs_write32(EXCEPTION_BITMAP, eb);
392} 467}
393 468
@@ -985,7 +1060,7 @@ static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt,
985static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) 1060static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
986{ 1061{
987 u32 vmx_msr_low, vmx_msr_high; 1062 u32 vmx_msr_low, vmx_msr_high;
988 u32 min, opt; 1063 u32 min, opt, min2, opt2;
989 u32 _pin_based_exec_control = 0; 1064 u32 _pin_based_exec_control = 0;
990 u32 _cpu_based_exec_control = 0; 1065 u32 _cpu_based_exec_control = 0;
991 u32 _cpu_based_2nd_exec_control = 0; 1066 u32 _cpu_based_2nd_exec_control = 0;
@@ -1003,6 +1078,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
1003 CPU_BASED_CR8_LOAD_EXITING | 1078 CPU_BASED_CR8_LOAD_EXITING |
1004 CPU_BASED_CR8_STORE_EXITING | 1079 CPU_BASED_CR8_STORE_EXITING |
1005#endif 1080#endif
1081 CPU_BASED_CR3_LOAD_EXITING |
1082 CPU_BASED_CR3_STORE_EXITING |
1006 CPU_BASED_USE_IO_BITMAPS | 1083 CPU_BASED_USE_IO_BITMAPS |
1007 CPU_BASED_MOV_DR_EXITING | 1084 CPU_BASED_MOV_DR_EXITING |
1008 CPU_BASED_USE_TSC_OFFSETING; 1085 CPU_BASED_USE_TSC_OFFSETING;
@@ -1018,11 +1095,13 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
1018 ~CPU_BASED_CR8_STORE_EXITING; 1095 ~CPU_BASED_CR8_STORE_EXITING;
1019#endif 1096#endif
1020 if (_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) { 1097 if (_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) {
1021 min = 0; 1098 min2 = 0;
1022 opt = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | 1099 opt2 = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
1023 SECONDARY_EXEC_WBINVD_EXITING | 1100 SECONDARY_EXEC_WBINVD_EXITING |
1024 SECONDARY_EXEC_ENABLE_VPID; 1101 SECONDARY_EXEC_ENABLE_VPID |
1025 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS2, 1102 SECONDARY_EXEC_ENABLE_EPT;
1103 if (adjust_vmx_controls(min2, opt2,
1104 MSR_IA32_VMX_PROCBASED_CTLS2,
1026 &_cpu_based_2nd_exec_control) < 0) 1105 &_cpu_based_2nd_exec_control) < 0)
1027 return -EIO; 1106 return -EIO;
1028 } 1107 }
@@ -1031,6 +1110,16 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
1031 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) 1110 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
1032 _cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW; 1111 _cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW;
1033#endif 1112#endif
1113 if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) {
1114 /* CR3 accesses don't need to cause VM Exits when EPT enabled */
1115 min &= ~(CPU_BASED_CR3_LOAD_EXITING |
1116 CPU_BASED_CR3_STORE_EXITING);
1117 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS,
1118 &_cpu_based_exec_control) < 0)
1119 return -EIO;
1120 rdmsr(MSR_IA32_VMX_EPT_VPID_CAP,
1121 vmx_capability.ept, vmx_capability.vpid);
1122 }
1034 1123
1035 min = 0; 1124 min = 0;
1036#ifdef CONFIG_X86_64 1125#ifdef CONFIG_X86_64
@@ -1256,7 +1345,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
1256 fix_rmode_seg(VCPU_SREG_FS, &vcpu->arch.rmode.fs); 1345 fix_rmode_seg(VCPU_SREG_FS, &vcpu->arch.rmode.fs);
1257 1346
1258 kvm_mmu_reset_context(vcpu); 1347 kvm_mmu_reset_context(vcpu);
1259 init_rmode_tss(vcpu->kvm); 1348 init_rmode(vcpu->kvm);
1260} 1349}
1261 1350
1262#ifdef CONFIG_X86_64 1351#ifdef CONFIG_X86_64
@@ -1304,8 +1393,64 @@ static void vmx_decache_cr4_guest_bits(struct kvm_vcpu *vcpu)
1304 vcpu->arch.cr4 |= vmcs_readl(GUEST_CR4) & ~KVM_GUEST_CR4_MASK; 1393 vcpu->arch.cr4 |= vmcs_readl(GUEST_CR4) & ~KVM_GUEST_CR4_MASK;
1305} 1394}
1306 1395
1396static void ept_load_pdptrs(struct kvm_vcpu *vcpu)
1397{
1398 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) {
1399 if (!load_pdptrs(vcpu, vcpu->arch.cr3)) {
1400 printk(KERN_ERR "EPT: Fail to load pdptrs!\n");
1401 return;
1402 }
1403 vmcs_write64(GUEST_PDPTR0, vcpu->arch.pdptrs[0]);
1404 vmcs_write64(GUEST_PDPTR1, vcpu->arch.pdptrs[1]);
1405 vmcs_write64(GUEST_PDPTR2, vcpu->arch.pdptrs[2]);
1406 vmcs_write64(GUEST_PDPTR3, vcpu->arch.pdptrs[3]);
1407 }
1408}
1409
1410static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4);
1411
1412static void ept_update_paging_mode_cr0(unsigned long *hw_cr0,
1413 unsigned long cr0,
1414 struct kvm_vcpu *vcpu)
1415{
1416 if (!(cr0 & X86_CR0_PG)) {
1417 /* From paging/starting to nonpaging */
1418 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,
1419 vmcs_config.cpu_based_exec_ctrl |
1420 (CPU_BASED_CR3_LOAD_EXITING |
1421 CPU_BASED_CR3_STORE_EXITING));
1422 vcpu->arch.cr0 = cr0;
1423 vmx_set_cr4(vcpu, vcpu->arch.cr4);
1424 *hw_cr0 |= X86_CR0_PE | X86_CR0_PG;
1425 *hw_cr0 &= ~X86_CR0_WP;
1426 } else if (!is_paging(vcpu)) {
1427 /* From nonpaging to paging */
1428 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,
1429 vmcs_config.cpu_based_exec_ctrl &
1430 ~(CPU_BASED_CR3_LOAD_EXITING |
1431 CPU_BASED_CR3_STORE_EXITING));
1432 vcpu->arch.cr0 = cr0;
1433 vmx_set_cr4(vcpu, vcpu->arch.cr4);
1434 if (!(vcpu->arch.cr0 & X86_CR0_WP))
1435 *hw_cr0 &= ~X86_CR0_WP;
1436 }
1437}
1438
1439static void ept_update_paging_mode_cr4(unsigned long *hw_cr4,
1440 struct kvm_vcpu *vcpu)
1441{
1442 if (!is_paging(vcpu)) {
1443 *hw_cr4 &= ~X86_CR4_PAE;
1444 *hw_cr4 |= X86_CR4_PSE;
1445 } else if (!(vcpu->arch.cr4 & X86_CR4_PAE))
1446 *hw_cr4 &= ~X86_CR4_PAE;
1447}
1448
1307static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) 1449static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
1308{ 1450{
1451 unsigned long hw_cr0 = (cr0 & ~KVM_GUEST_CR0_MASK) |
1452 KVM_VM_CR0_ALWAYS_ON;
1453
1309 vmx_fpu_deactivate(vcpu); 1454 vmx_fpu_deactivate(vcpu);
1310 1455
1311 if (vcpu->arch.rmode.active && (cr0 & X86_CR0_PE)) 1456 if (vcpu->arch.rmode.active && (cr0 & X86_CR0_PE))
@@ -1323,29 +1468,61 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
1323 } 1468 }
1324#endif 1469#endif
1325 1470
1471 if (vm_need_ept())
1472 ept_update_paging_mode_cr0(&hw_cr0, cr0, vcpu);
1473
1326 vmcs_writel(CR0_READ_SHADOW, cr0); 1474 vmcs_writel(CR0_READ_SHADOW, cr0);
1327 vmcs_writel(GUEST_CR0, 1475 vmcs_writel(GUEST_CR0, hw_cr0);
1328 (cr0 & ~KVM_GUEST_CR0_MASK) | KVM_VM_CR0_ALWAYS_ON);
1329 vcpu->arch.cr0 = cr0; 1476 vcpu->arch.cr0 = cr0;
1330 1477
1331 if (!(cr0 & X86_CR0_TS) || !(cr0 & X86_CR0_PE)) 1478 if (!(cr0 & X86_CR0_TS) || !(cr0 & X86_CR0_PE))
1332 vmx_fpu_activate(vcpu); 1479 vmx_fpu_activate(vcpu);
1333} 1480}
1334 1481
1482static u64 construct_eptp(unsigned long root_hpa)
1483{
1484 u64 eptp;
1485
1486 /* TODO write the value reading from MSR */
1487 eptp = VMX_EPT_DEFAULT_MT |
1488 VMX_EPT_DEFAULT_GAW << VMX_EPT_GAW_EPTP_SHIFT;
1489 eptp |= (root_hpa & PAGE_MASK);
1490
1491 return eptp;
1492}
1493
1335static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) 1494static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
1336{ 1495{
1496 unsigned long guest_cr3;
1497 u64 eptp;
1498
1499 guest_cr3 = cr3;
1500 if (vm_need_ept()) {
1501 eptp = construct_eptp(cr3);
1502 vmcs_write64(EPT_POINTER, eptp);
1503 ept_sync_context(eptp);
1504 ept_load_pdptrs(vcpu);
1505 guest_cr3 = is_paging(vcpu) ? vcpu->arch.cr3 :
1506 VMX_EPT_IDENTITY_PAGETABLE_ADDR;
1507 }
1508
1337 vmx_flush_tlb(vcpu); 1509 vmx_flush_tlb(vcpu);
1338 vmcs_writel(GUEST_CR3, cr3); 1510 vmcs_writel(GUEST_CR3, guest_cr3);
1339 if (vcpu->arch.cr0 & X86_CR0_PE) 1511 if (vcpu->arch.cr0 & X86_CR0_PE)
1340 vmx_fpu_deactivate(vcpu); 1512 vmx_fpu_deactivate(vcpu);
1341} 1513}
1342 1514
1343static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) 1515static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
1344{ 1516{
1345 vmcs_writel(CR4_READ_SHADOW, cr4); 1517 unsigned long hw_cr4 = cr4 | (vcpu->arch.rmode.active ?
1346 vmcs_writel(GUEST_CR4, cr4 | (vcpu->arch.rmode.active ? 1518 KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON);
1347 KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON)); 1519
1348 vcpu->arch.cr4 = cr4; 1520 vcpu->arch.cr4 = cr4;
1521 if (vm_need_ept())
1522 ept_update_paging_mode_cr4(&hw_cr4, vcpu);
1523
1524 vmcs_writel(CR4_READ_SHADOW, cr4);
1525 vmcs_writel(GUEST_CR4, hw_cr4);
1349} 1526}
1350 1527
1351static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer) 1528static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer)
@@ -1530,6 +1707,41 @@ out:
1530 return ret; 1707 return ret;
1531} 1708}
1532 1709
1710static int init_rmode_identity_map(struct kvm *kvm)
1711{
1712 int i, r, ret;
1713 pfn_t identity_map_pfn;
1714 u32 tmp;
1715
1716 if (!vm_need_ept())
1717 return 1;
1718 if (unlikely(!kvm->arch.ept_identity_pagetable)) {
1719 printk(KERN_ERR "EPT: identity-mapping pagetable "
1720 "haven't been allocated!\n");
1721 return 0;
1722 }
1723 if (likely(kvm->arch.ept_identity_pagetable_done))
1724 return 1;
1725 ret = 0;
1726 identity_map_pfn = VMX_EPT_IDENTITY_PAGETABLE_ADDR >> PAGE_SHIFT;
1727 r = kvm_clear_guest_page(kvm, identity_map_pfn, 0, PAGE_SIZE);
1728 if (r < 0)
1729 goto out;
1730 /* Set up identity-mapping pagetable for EPT in real mode */
1731 for (i = 0; i < PT32_ENT_PER_PAGE; i++) {
1732 tmp = (i << 22) + (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER |
1733 _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE);
1734 r = kvm_write_guest_page(kvm, identity_map_pfn,
1735 &tmp, i * sizeof(tmp), sizeof(tmp));
1736 if (r < 0)
1737 goto out;
1738 }
1739 kvm->arch.ept_identity_pagetable_done = true;
1740 ret = 1;
1741out:
1742 return ret;
1743}
1744
1533static void seg_setup(int seg) 1745static void seg_setup(int seg)
1534{ 1746{
1535 struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; 1747 struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg];
@@ -1564,6 +1776,31 @@ out:
1564 return r; 1776 return r;
1565} 1777}
1566 1778
1779static int alloc_identity_pagetable(struct kvm *kvm)
1780{
1781 struct kvm_userspace_memory_region kvm_userspace_mem;
1782 int r = 0;
1783
1784 down_write(&kvm->slots_lock);
1785 if (kvm->arch.ept_identity_pagetable)
1786 goto out;
1787 kvm_userspace_mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT;
1788 kvm_userspace_mem.flags = 0;
1789 kvm_userspace_mem.guest_phys_addr = VMX_EPT_IDENTITY_PAGETABLE_ADDR;
1790 kvm_userspace_mem.memory_size = PAGE_SIZE;
1791 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0);
1792 if (r)
1793 goto out;
1794
1795 down_read(&current->mm->mmap_sem);
1796 kvm->arch.ept_identity_pagetable = gfn_to_page(kvm,
1797 VMX_EPT_IDENTITY_PAGETABLE_ADDR >> PAGE_SHIFT);
1798 up_read(&current->mm->mmap_sem);
1799out:
1800 up_write(&kvm->slots_lock);
1801 return r;
1802}
1803
1567static void allocate_vpid(struct vcpu_vmx *vmx) 1804static void allocate_vpid(struct vcpu_vmx *vmx)
1568{ 1805{
1569 int vpid; 1806 int vpid;
@@ -1638,6 +1875,9 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
1638 CPU_BASED_CR8_LOAD_EXITING; 1875 CPU_BASED_CR8_LOAD_EXITING;
1639#endif 1876#endif
1640 } 1877 }
1878 if (!vm_need_ept())
1879 exec_control |= CPU_BASED_CR3_STORE_EXITING |
1880 CPU_BASED_CR3_LOAD_EXITING;
1641 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, exec_control); 1881 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, exec_control);
1642 1882
1643 if (cpu_has_secondary_exec_ctrls()) { 1883 if (cpu_has_secondary_exec_ctrls()) {
@@ -1647,6 +1887,8 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
1647 ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; 1887 ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
1648 if (vmx->vpid == 0) 1888 if (vmx->vpid == 0)
1649 exec_control &= ~SECONDARY_EXEC_ENABLE_VPID; 1889 exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
1890 if (!vm_need_ept())
1891 exec_control &= ~SECONDARY_EXEC_ENABLE_EPT;
1650 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control); 1892 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
1651 } 1893 }
1652 1894
@@ -1722,6 +1964,15 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
1722 return 0; 1964 return 0;
1723} 1965}
1724 1966
1967static int init_rmode(struct kvm *kvm)
1968{
1969 if (!init_rmode_tss(kvm))
1970 return 0;
1971 if (!init_rmode_identity_map(kvm))
1972 return 0;
1973 return 1;
1974}
1975
1725static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) 1976static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
1726{ 1977{
1727 struct vcpu_vmx *vmx = to_vmx(vcpu); 1978 struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -1729,7 +1980,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
1729 int ret; 1980 int ret;
1730 1981
1731 down_read(&vcpu->kvm->slots_lock); 1982 down_read(&vcpu->kvm->slots_lock);
1732 if (!init_rmode_tss(vmx->vcpu.kvm)) { 1983 if (!init_rmode(vmx->vcpu.kvm)) {
1733 ret = -ENOMEM; 1984 ret = -ENOMEM;
1734 goto out; 1985 goto out;
1735 } 1986 }
@@ -1994,6 +2245,9 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1994 if (intr_info & INTR_INFO_DELIVER_CODE_MASK) 2245 if (intr_info & INTR_INFO_DELIVER_CODE_MASK)
1995 error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE); 2246 error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE);
1996 if (is_page_fault(intr_info)) { 2247 if (is_page_fault(intr_info)) {
2248 /* EPT won't cause page fault directly */
2249 if (vm_need_ept())
2250 BUG();
1997 cr2 = vmcs_readl(EXIT_QUALIFICATION); 2251 cr2 = vmcs_readl(EXIT_QUALIFICATION);
1998 KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2, 2252 KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2,
1999 (u32)((u64)cr2 >> 32), handler); 2253 (u32)((u64)cr2 >> 32), handler);
@@ -2323,6 +2577,64 @@ static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2323 return kvm_task_switch(vcpu, tss_selector, reason); 2577 return kvm_task_switch(vcpu, tss_selector, reason);
2324} 2578}
2325 2579
2580static int handle_ept_violation(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2581{
2582 u64 exit_qualification;
2583 enum emulation_result er;
2584 gpa_t gpa;
2585 unsigned long hva;
2586 int gla_validity;
2587 int r;
2588
2589 exit_qualification = vmcs_read64(EXIT_QUALIFICATION);
2590
2591 if (exit_qualification & (1 << 6)) {
2592 printk(KERN_ERR "EPT: GPA exceeds GAW!\n");
2593 return -ENOTSUPP;
2594 }
2595
2596 gla_validity = (exit_qualification >> 7) & 0x3;
2597 if (gla_validity != 0x3 && gla_validity != 0x1 && gla_validity != 0) {
2598 printk(KERN_ERR "EPT: Handling EPT violation failed!\n");
2599 printk(KERN_ERR "EPT: GPA: 0x%lx, GVA: 0x%lx\n",
2600 (long unsigned int)vmcs_read64(GUEST_PHYSICAL_ADDRESS),
2601 (long unsigned int)vmcs_read64(GUEST_LINEAR_ADDRESS));
2602 printk(KERN_ERR "EPT: Exit qualification is 0x%lx\n",
2603 (long unsigned int)exit_qualification);
2604 kvm_run->exit_reason = KVM_EXIT_UNKNOWN;
2605 kvm_run->hw.hardware_exit_reason = 0;
2606 return -ENOTSUPP;
2607 }
2608
2609 gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
2610 hva = gfn_to_hva(vcpu->kvm, gpa >> PAGE_SHIFT);
2611 if (!kvm_is_error_hva(hva)) {
2612 r = kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, 0);
2613 if (r < 0) {
2614 printk(KERN_ERR "EPT: Not enough memory!\n");
2615 return -ENOMEM;
2616 }
2617 return 1;
2618 } else {
2619 /* must be MMIO */
2620 er = emulate_instruction(vcpu, kvm_run, 0, 0, 0);
2621
2622 if (er == EMULATE_FAIL) {
2623 printk(KERN_ERR
2624 "EPT: Fail to handle EPT violation vmexit!er is %d\n",
2625 er);
2626 printk(KERN_ERR "EPT: GPA: 0x%lx, GVA: 0x%lx\n",
2627 (long unsigned int)vmcs_read64(GUEST_PHYSICAL_ADDRESS),
2628 (long unsigned int)vmcs_read64(GUEST_LINEAR_ADDRESS));
2629 printk(KERN_ERR "EPT: Exit qualification is 0x%lx\n",
2630 (long unsigned int)exit_qualification);
2631 return -ENOTSUPP;
2632 } else if (er == EMULATE_DO_MMIO)
2633 return 0;
2634 }
2635 return 1;
2636}
2637
2326/* 2638/*
2327 * The exit handlers return 1 if the exit was handled fully and guest execution 2639 * The exit handlers return 1 if the exit was handled fully and guest execution
2328 * may resume. Otherwise they set the kvm_run parameter to indicate what needs 2640 * may resume. Otherwise they set the kvm_run parameter to indicate what needs
@@ -2346,6 +2658,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu,
2346 [EXIT_REASON_APIC_ACCESS] = handle_apic_access, 2658 [EXIT_REASON_APIC_ACCESS] = handle_apic_access,
2347 [EXIT_REASON_WBINVD] = handle_wbinvd, 2659 [EXIT_REASON_WBINVD] = handle_wbinvd,
2348 [EXIT_REASON_TASK_SWITCH] = handle_task_switch, 2660 [EXIT_REASON_TASK_SWITCH] = handle_task_switch,
2661 [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation,
2349}; 2662};
2350 2663
2351static const int kvm_vmx_max_exit_handlers = 2664static const int kvm_vmx_max_exit_handlers =
@@ -2364,6 +2677,13 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
2364 KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)vmcs_readl(GUEST_RIP), 2677 KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)vmcs_readl(GUEST_RIP),
2365 (u32)((u64)vmcs_readl(GUEST_RIP) >> 32), entryexit); 2678 (u32)((u64)vmcs_readl(GUEST_RIP) >> 32), entryexit);
2366 2679
2680 /* Access CR3 don't cause VMExit in paging mode, so we need
2681 * to sync with guest real CR3. */
2682 if (vm_need_ept() && is_paging(vcpu)) {
2683 vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
2684 ept_load_pdptrs(vcpu);
2685 }
2686
2367 if (unlikely(vmx->fail)) { 2687 if (unlikely(vmx->fail)) {
2368 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; 2688 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
2369 kvm_run->fail_entry.hardware_entry_failure_reason 2689 kvm_run->fail_entry.hardware_entry_failure_reason
@@ -2372,7 +2692,8 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
2372 } 2692 }
2373 2693
2374 if ((vectoring_info & VECTORING_INFO_VALID_MASK) && 2694 if ((vectoring_info & VECTORING_INFO_VALID_MASK) &&
2375 exit_reason != EXIT_REASON_EXCEPTION_NMI) 2695 (exit_reason != EXIT_REASON_EXCEPTION_NMI &&
2696 exit_reason != EXIT_REASON_EPT_VIOLATION))
2376 printk(KERN_WARNING "%s: unexpected, valid vectoring info and " 2697 printk(KERN_WARNING "%s: unexpected, valid vectoring info and "
2377 "exit reason is 0x%x\n", __func__, exit_reason); 2698 "exit reason is 0x%x\n", __func__, exit_reason);
2378 if (exit_reason < kvm_vmx_max_exit_handlers 2699 if (exit_reason < kvm_vmx_max_exit_handlers
@@ -2674,6 +2995,15 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
2674 return ERR_PTR(-ENOMEM); 2995 return ERR_PTR(-ENOMEM);
2675 2996
2676 allocate_vpid(vmx); 2997 allocate_vpid(vmx);
2998 if (id == 0 && vm_need_ept()) {
2999 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
3000 VMX_EPT_WRITABLE_MASK |
3001 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
3002 kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK,
3003 VMX_EPT_FAKE_DIRTY_MASK, 0ull,
3004 VMX_EPT_EXECUTABLE_MASK);
3005 kvm_enable_tdp();
3006 }
2677 3007
2678 err = kvm_vcpu_init(&vmx->vcpu, kvm, id); 3008 err = kvm_vcpu_init(&vmx->vcpu, kvm, id);
2679 if (err) 3009 if (err)
@@ -2706,6 +3036,10 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
2706 if (alloc_apic_access_page(kvm) != 0) 3036 if (alloc_apic_access_page(kvm) != 0)
2707 goto free_vmcs; 3037 goto free_vmcs;
2708 3038
3039 if (vm_need_ept())
3040 if (alloc_identity_pagetable(kvm) != 0)
3041 goto free_vmcs;
3042
2709 return &vmx->vcpu; 3043 return &vmx->vcpu;
2710 3044
2711free_vmcs: 3045free_vmcs:
@@ -2735,6 +3069,11 @@ static void __init vmx_check_processor_compat(void *rtn)
2735 } 3069 }
2736} 3070}
2737 3071
3072static int get_ept_level(void)
3073{
3074 return VMX_EPT_DEFAULT_GAW + 1;
3075}
3076
2738static struct kvm_x86_ops vmx_x86_ops = { 3077static struct kvm_x86_ops vmx_x86_ops = {
2739 .cpu_has_kvm_support = cpu_has_kvm_support, 3078 .cpu_has_kvm_support = cpu_has_kvm_support,
2740 .disabled_by_bios = vmx_disabled_by_bios, 3079 .disabled_by_bios = vmx_disabled_by_bios,
@@ -2791,6 +3130,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
2791 .inject_pending_vectors = do_interrupt_requests, 3130 .inject_pending_vectors = do_interrupt_requests,
2792 3131
2793 .set_tss_addr = vmx_set_tss_addr, 3132 .set_tss_addr = vmx_set_tss_addr,
3133 .get_tdp_level = get_ept_level,
2794}; 3134};
2795 3135
2796static int __init vmx_init(void) 3136static int __init vmx_init(void)
@@ -2843,9 +3183,14 @@ static int __init vmx_init(void)
2843 vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); 3183 vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP);
2844 vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); 3184 vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP);
2845 3185
3186 if (cpu_has_vmx_ept())
3187 bypass_guest_pf = 0;
3188
2846 if (bypass_guest_pf) 3189 if (bypass_guest_pf)
2847 kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); 3190 kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull);
2848 3191
3192 ept_sync_global();
3193
2849 return 0; 3194 return 0;
2850 3195
2851out2: 3196out2:
diff --git a/arch/x86/kvm/vmx.h b/arch/x86/kvm/vmx.h
index 5dff4606b988..79d94c610dfe 100644
--- a/arch/x86/kvm/vmx.h
+++ b/arch/x86/kvm/vmx.h
@@ -35,6 +35,8 @@
35#define CPU_BASED_MWAIT_EXITING 0x00000400 35#define CPU_BASED_MWAIT_EXITING 0x00000400
36#define CPU_BASED_RDPMC_EXITING 0x00000800 36#define CPU_BASED_RDPMC_EXITING 0x00000800
37#define CPU_BASED_RDTSC_EXITING 0x00001000 37#define CPU_BASED_RDTSC_EXITING 0x00001000
38#define CPU_BASED_CR3_LOAD_EXITING 0x00008000
39#define CPU_BASED_CR3_STORE_EXITING 0x00010000
38#define CPU_BASED_CR8_LOAD_EXITING 0x00080000 40#define CPU_BASED_CR8_LOAD_EXITING 0x00080000
39#define CPU_BASED_CR8_STORE_EXITING 0x00100000 41#define CPU_BASED_CR8_STORE_EXITING 0x00100000
40#define CPU_BASED_TPR_SHADOW 0x00200000 42#define CPU_BASED_TPR_SHADOW 0x00200000
@@ -49,6 +51,7 @@
49 * Definitions of Secondary Processor-Based VM-Execution Controls. 51 * Definitions of Secondary Processor-Based VM-Execution Controls.
50 */ 52 */
51#define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001 53#define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001
54#define SECONDARY_EXEC_ENABLE_EPT 0x00000002
52#define SECONDARY_EXEC_ENABLE_VPID 0x00000020 55#define SECONDARY_EXEC_ENABLE_VPID 0x00000020
53#define SECONDARY_EXEC_WBINVD_EXITING 0x00000040 56#define SECONDARY_EXEC_WBINVD_EXITING 0x00000040
54 57
@@ -100,10 +103,22 @@ enum vmcs_field {
100 VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013, 103 VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013,
101 APIC_ACCESS_ADDR = 0x00002014, 104 APIC_ACCESS_ADDR = 0x00002014,
102 APIC_ACCESS_ADDR_HIGH = 0x00002015, 105 APIC_ACCESS_ADDR_HIGH = 0x00002015,
106 EPT_POINTER = 0x0000201a,
107 EPT_POINTER_HIGH = 0x0000201b,
108 GUEST_PHYSICAL_ADDRESS = 0x00002400,
109 GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401,
103 VMCS_LINK_POINTER = 0x00002800, 110 VMCS_LINK_POINTER = 0x00002800,
104 VMCS_LINK_POINTER_HIGH = 0x00002801, 111 VMCS_LINK_POINTER_HIGH = 0x00002801,
105 GUEST_IA32_DEBUGCTL = 0x00002802, 112 GUEST_IA32_DEBUGCTL = 0x00002802,
106 GUEST_IA32_DEBUGCTL_HIGH = 0x00002803, 113 GUEST_IA32_DEBUGCTL_HIGH = 0x00002803,
114 GUEST_PDPTR0 = 0x0000280a,
115 GUEST_PDPTR0_HIGH = 0x0000280b,
116 GUEST_PDPTR1 = 0x0000280c,
117 GUEST_PDPTR1_HIGH = 0x0000280d,
118 GUEST_PDPTR2 = 0x0000280e,
119 GUEST_PDPTR2_HIGH = 0x0000280f,
120 GUEST_PDPTR3 = 0x00002810,
121 GUEST_PDPTR3_HIGH = 0x00002811,
107 PIN_BASED_VM_EXEC_CONTROL = 0x00004000, 122 PIN_BASED_VM_EXEC_CONTROL = 0x00004000,
108 CPU_BASED_VM_EXEC_CONTROL = 0x00004002, 123 CPU_BASED_VM_EXEC_CONTROL = 0x00004002,
109 EXCEPTION_BITMAP = 0x00004004, 124 EXCEPTION_BITMAP = 0x00004004,
@@ -226,6 +241,8 @@ enum vmcs_field {
226#define EXIT_REASON_MWAIT_INSTRUCTION 36 241#define EXIT_REASON_MWAIT_INSTRUCTION 36
227#define EXIT_REASON_TPR_BELOW_THRESHOLD 43 242#define EXIT_REASON_TPR_BELOW_THRESHOLD 43
228#define EXIT_REASON_APIC_ACCESS 44 243#define EXIT_REASON_APIC_ACCESS 44
244#define EXIT_REASON_EPT_VIOLATION 48
245#define EXIT_REASON_EPT_MISCONFIG 49
229#define EXIT_REASON_WBINVD 54 246#define EXIT_REASON_WBINVD 54
230 247
231/* 248/*
@@ -316,15 +333,36 @@ enum vmcs_field {
316#define MSR_IA32_VMX_CR4_FIXED1 0x489 333#define MSR_IA32_VMX_CR4_FIXED1 0x489
317#define MSR_IA32_VMX_VMCS_ENUM 0x48a 334#define MSR_IA32_VMX_VMCS_ENUM 0x48a
318#define MSR_IA32_VMX_PROCBASED_CTLS2 0x48b 335#define MSR_IA32_VMX_PROCBASED_CTLS2 0x48b
336#define MSR_IA32_VMX_EPT_VPID_CAP 0x48c
319 337
320#define MSR_IA32_FEATURE_CONTROL 0x3a 338#define MSR_IA32_FEATURE_CONTROL 0x3a
321#define MSR_IA32_FEATURE_CONTROL_LOCKED 0x1 339#define MSR_IA32_FEATURE_CONTROL_LOCKED 0x1
322#define MSR_IA32_FEATURE_CONTROL_VMXON_ENABLED 0x4 340#define MSR_IA32_FEATURE_CONTROL_VMXON_ENABLED 0x4
323 341
324#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT 9 342#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT 9
343#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT 10
325 344
326#define VMX_NR_VPIDS (1 << 16) 345#define VMX_NR_VPIDS (1 << 16)
327#define VMX_VPID_EXTENT_SINGLE_CONTEXT 1 346#define VMX_VPID_EXTENT_SINGLE_CONTEXT 1
328#define VMX_VPID_EXTENT_ALL_CONTEXT 2 347#define VMX_VPID_EXTENT_ALL_CONTEXT 2
329 348
349#define VMX_EPT_EXTENT_INDIVIDUAL_ADDR 0
350#define VMX_EPT_EXTENT_CONTEXT 1
351#define VMX_EPT_EXTENT_GLOBAL 2
352#define VMX_EPT_EXTENT_INDIVIDUAL_BIT (1ull << 24)
353#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25)
354#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26)
355#define VMX_EPT_DEFAULT_GAW 3
356#define VMX_EPT_MAX_GAW 0x4
357#define VMX_EPT_MT_EPTE_SHIFT 3
358#define VMX_EPT_GAW_EPTP_SHIFT 3
359#define VMX_EPT_DEFAULT_MT 0x6ull
360#define VMX_EPT_READABLE_MASK 0x1ull
361#define VMX_EPT_WRITABLE_MASK 0x2ull
362#define VMX_EPT_EXECUTABLE_MASK 0x4ull
363#define VMX_EPT_FAKE_ACCESSED_MASK (1ull << 62)
364#define VMX_EPT_FAKE_DIRTY_MASK (1ull << 63)
365
366#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul
367
330#endif 368#endif
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0ce556372a4d..21338bdb28ff 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2417,6 +2417,9 @@ int kvm_arch_init(void *opaque)
2417 2417
2418 kvm_x86_ops = ops; 2418 kvm_x86_ops = ops;
2419 kvm_mmu_set_nonpresent_ptes(0ull, 0ull); 2419 kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
2420 kvm_mmu_set_base_ptes(PT_PRESENT_MASK);
2421 kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
2422 PT_DIRTY_MASK, PT64_NX_MASK, 0);
2420 return 0; 2423 return 0;
2421 2424
2422out: 2425out:
@@ -3019,6 +3022,8 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
3019 3022
3020 kvm_x86_ops->decache_regs(vcpu); 3023 kvm_x86_ops->decache_regs(vcpu);
3021 3024
3025 vcpu->arch.exception.pending = false;
3026
3022 vcpu_put(vcpu); 3027 vcpu_put(vcpu);
3023 3028
3024 return 0; 3029 return 0;
@@ -3481,7 +3486,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
3481 } 3486 }
3482 3487
3483 if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { 3488 if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) {
3484 cseg_desc.type &= ~(1 << 8); //clear the B flag 3489 cseg_desc.type &= ~(1 << 1); //clear the B flag
3485 save_guest_segment_descriptor(vcpu, tr_seg.selector, 3490 save_guest_segment_descriptor(vcpu, tr_seg.selector,
3486 &cseg_desc); 3491 &cseg_desc);
3487 } 3492 }
@@ -3507,7 +3512,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
3507 } 3512 }
3508 3513
3509 if (reason != TASK_SWITCH_IRET) { 3514 if (reason != TASK_SWITCH_IRET) {
3510 nseg_desc.type |= (1 << 8); 3515 nseg_desc.type |= (1 << 1);
3511 save_guest_segment_descriptor(vcpu, tss_selector, 3516 save_guest_segment_descriptor(vcpu, tss_selector,
3512 &nseg_desc); 3517 &nseg_desc);
3513 } 3518 }
@@ -3698,10 +3703,19 @@ void fx_init(struct kvm_vcpu *vcpu)
3698{ 3703{
3699 unsigned after_mxcsr_mask; 3704 unsigned after_mxcsr_mask;
3700 3705
3706 /*
3707 * Touch the fpu the first time in non atomic context as if
3708 * this is the first fpu instruction the exception handler
3709 * will fire before the instruction returns and it'll have to
3710 * allocate ram with GFP_KERNEL.
3711 */
3712 if (!used_math())
3713 fx_save(&vcpu->arch.host_fx_image);
3714
3701 /* Initialize guest FPU by resetting ours and saving into guest's */ 3715 /* Initialize guest FPU by resetting ours and saving into guest's */
3702 preempt_disable(); 3716 preempt_disable();
3703 fx_save(&vcpu->arch.host_fx_image); 3717 fx_save(&vcpu->arch.host_fx_image);
3704 fpu_init(); 3718 fx_finit();
3705 fx_save(&vcpu->arch.guest_fx_image); 3719 fx_save(&vcpu->arch.guest_fx_image);
3706 fx_restore(&vcpu->arch.host_fx_image); 3720 fx_restore(&vcpu->arch.host_fx_image);
3707 preempt_enable(); 3721 preempt_enable();
@@ -3906,6 +3920,8 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
3906 kvm_free_physmem(kvm); 3920 kvm_free_physmem(kvm);
3907 if (kvm->arch.apic_access_page) 3921 if (kvm->arch.apic_access_page)
3908 put_page(kvm->arch.apic_access_page); 3922 put_page(kvm->arch.apic_access_page);
3923 if (kvm->arch.ept_identity_pagetable)
3924 put_page(kvm->arch.ept_identity_pagetable);
3909 kfree(kvm); 3925 kfree(kvm);
3910} 3926}
3911 3927
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index 2ca08386f993..f2a696d6a243 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -1761,6 +1761,7 @@ twobyte_insn:
1761 case 6: /* lmsw */ 1761 case 6: /* lmsw */
1762 realmode_lmsw(ctxt->vcpu, (u16)c->src.val, 1762 realmode_lmsw(ctxt->vcpu, (u16)c->src.val,
1763 &ctxt->eflags); 1763 &ctxt->eflags);
1764 c->dst.type = OP_NONE;
1764 break; 1765 break;
1765 case 7: /* invlpg*/ 1766 case 7: /* invlpg*/
1766 emulate_invlpg(ctxt->vcpu, memop); 1767 emulate_invlpg(ctxt->vcpu, memop);
diff --git a/arch/x86/mach-voyager/voyager_cat.c b/arch/x86/mach-voyager/voyager_cat.c
index ecab9fff0fd1..2ad598c104af 100644
--- a/arch/x86/mach-voyager/voyager_cat.c
+++ b/arch/x86/mach-voyager/voyager_cat.c
@@ -877,7 +877,7 @@ void __init voyager_cat_init(void)
877 request_resource(&iomem_resource, res); 877 request_resource(&iomem_resource, res);
878 } 878 }
879 879
880 qic_addr = (unsigned long)ioremap(qic_addr, 0x400); 880 qic_addr = (unsigned long)ioremap_cache(qic_addr, 0x400);
881 881
882 for (j = 0; j < 4; j++) { 882 for (j = 0; j < 4; j++) {
883 __u8 cpu; 883 __u8 cpu;
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 18378850e25a..914ccf983687 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -476,29 +476,3 @@ int memory_add_physaddr_to_nid(u64 addr)
476 476
477EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 477EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
478#endif 478#endif
479
480#ifndef CONFIG_HAVE_ARCH_PARSE_SRAT
481/*
482 * XXX FIXME: Make SLIT table parsing available to 32-bit NUMA
483 *
484 * These stub functions are needed to compile 32-bit NUMA when SRAT is
485 * not set. There are functions in srat_64.c for parsing this table
486 * and it may be possible to make them common functions.
487 */
488void acpi_numa_slit_init (struct acpi_table_slit *slit)
489{
490 printk(KERN_INFO "ACPI: No support for parsing SLIT table\n");
491}
492
493void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa)
494{
495}
496
497void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma)
498{
499}
500
501void acpi_numa_arch_fixup(void)
502{
503}
504#endif /* CONFIG_HAVE_ARCH_PARSE_SRAT */
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index 9cf33d3ee5bc..165c871ba9af 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -155,4 +155,3 @@ EXPORT_SYMBOL(kmap);
155EXPORT_SYMBOL(kunmap); 155EXPORT_SYMBOL(kunmap);
156EXPORT_SYMBOL(kmap_atomic); 156EXPORT_SYMBOL(kmap_atomic);
157EXPORT_SYMBOL(kunmap_atomic); 157EXPORT_SYMBOL(kunmap_atomic);
158EXPORT_SYMBOL(kmap_atomic_to_page);
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 804de18abcc2..71bb3159031a 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -149,7 +149,8 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
149 * Don't allow anybody to remap normal RAM that we're using.. 149 * Don't allow anybody to remap normal RAM that we're using..
150 */ 150 */
151 for (pfn = phys_addr >> PAGE_SHIFT; 151 for (pfn = phys_addr >> PAGE_SHIFT;
152 (pfn << PAGE_SHIFT) < last_addr; pfn++) { 152 (pfn << PAGE_SHIFT) < (last_addr & PAGE_MASK);
153 pfn++) {
153 154
154 int is_ram = page_is_ram(pfn); 155 int is_ram = page_is_ram(pfn);
155 156
@@ -176,11 +177,11 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
176 /* 177 /*
177 * Do not fallback to certain memory types with certain 178 * Do not fallback to certain memory types with certain
178 * requested type: 179 * requested type:
179 * - request is uncached, return cannot be write-back 180 * - request is uc-, return cannot be write-back
180 * - request is uncached, return cannot be write-combine 181 * - request is uc-, return cannot be write-combine
181 * - request is write-combine, return cannot be write-back 182 * - request is write-combine, return cannot be write-back
182 */ 183 */
183 if ((prot_val == _PAGE_CACHE_UC && 184 if ((prot_val == _PAGE_CACHE_UC_MINUS &&
184 (new_prot_val == _PAGE_CACHE_WB || 185 (new_prot_val == _PAGE_CACHE_WB ||
185 new_prot_val == _PAGE_CACHE_WC)) || 186 new_prot_val == _PAGE_CACHE_WC)) ||
186 (prot_val == _PAGE_CACHE_WC && 187 (prot_val == _PAGE_CACHE_WC &&
@@ -201,6 +202,9 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
201 default: 202 default:
202 prot = PAGE_KERNEL_NOCACHE; 203 prot = PAGE_KERNEL_NOCACHE;
203 break; 204 break;
205 case _PAGE_CACHE_UC_MINUS:
206 prot = PAGE_KERNEL_UC_MINUS;
207 break;
204 case _PAGE_CACHE_WC: 208 case _PAGE_CACHE_WC:
205 prot = PAGE_KERNEL_WC; 209 prot = PAGE_KERNEL_WC;
206 break; 210 break;
@@ -255,7 +259,16 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
255 */ 259 */
256void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) 260void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size)
257{ 261{
258 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_UC, 262 /*
263 * Ideally, this should be:
264 * pat_wc_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS;
265 *
266 * Till we fix all X drivers to use ioremap_wc(), we will use
267 * UC MINUS.
268 */
269 unsigned long val = _PAGE_CACHE_UC_MINUS;
270
271 return __ioremap_caller(phys_addr, size, val,
259 __builtin_return_address(0)); 272 __builtin_return_address(0));
260} 273}
261EXPORT_SYMBOL(ioremap_nocache); 274EXPORT_SYMBOL(ioremap_nocache);
diff --git a/arch/x86/mm/k8topology_64.c b/arch/x86/mm/k8topology_64.c
index 86808e666f9c..1f476e477844 100644
--- a/arch/x86/mm/k8topology_64.c
+++ b/arch/x86/mm/k8topology_64.c
@@ -13,12 +13,15 @@
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <asm/io.h> 14#include <asm/io.h>
15#include <linux/pci_ids.h> 15#include <linux/pci_ids.h>
16#include <linux/acpi.h>
16#include <asm/types.h> 17#include <asm/types.h>
17#include <asm/mmzone.h> 18#include <asm/mmzone.h>
18#include <asm/proto.h> 19#include <asm/proto.h>
19#include <asm/e820.h> 20#include <asm/e820.h>
20#include <asm/pci-direct.h> 21#include <asm/pci-direct.h>
21#include <asm/numa.h> 22#include <asm/numa.h>
23#include <asm/mpspec.h>
24#include <asm/apic.h>
22 25
23static __init int find_northbridge(void) 26static __init int find_northbridge(void)
24{ 27{
@@ -44,6 +47,30 @@ static __init int find_northbridge(void)
44 return -1; 47 return -1;
45} 48}
46 49
50static __init void early_get_boot_cpu_id(void)
51{
52 /*
53 * need to get boot_cpu_id so can use that to create apicid_to_node
54 * in k8_scan_nodes()
55 */
56 /*
57 * Find possible boot-time SMP configuration:
58 */
59 early_find_smp_config();
60#ifdef CONFIG_ACPI
61 /*
62 * Read APIC information from ACPI tables.
63 */
64 early_acpi_boot_init();
65#endif
66 /*
67 * get boot-time SMP configuration:
68 */
69 if (smp_found_config)
70 early_get_smp_config();
71 early_init_lapic_mapping();
72}
73
47int __init k8_scan_nodes(unsigned long start, unsigned long end) 74int __init k8_scan_nodes(unsigned long start, unsigned long end)
48{ 75{
49 unsigned long prevbase; 76 unsigned long prevbase;
@@ -56,6 +83,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
56 unsigned cores; 83 unsigned cores;
57 unsigned bits; 84 unsigned bits;
58 int j; 85 int j;
86 unsigned apicid_base;
59 87
60 if (!early_pci_allowed()) 88 if (!early_pci_allowed())
61 return -1; 89 return -1;
@@ -174,11 +202,19 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
174 /* use the coreid bits from early_identify_cpu */ 202 /* use the coreid bits from early_identify_cpu */
175 bits = boot_cpu_data.x86_coreid_bits; 203 bits = boot_cpu_data.x86_coreid_bits;
176 cores = (1<<bits); 204 cores = (1<<bits);
205 apicid_base = 0;
206 /* need to get boot_cpu_id early for system with apicid lifting */
207 early_get_boot_cpu_id();
208 if (boot_cpu_physical_apicid > 0) {
209 printk(KERN_INFO "BSP APIC ID: %02x\n",
210 boot_cpu_physical_apicid);
211 apicid_base = boot_cpu_physical_apicid;
212 }
177 213
178 for (i = 0; i < 8; i++) { 214 for (i = 0; i < 8; i++) {
179 if (nodes[i].start != nodes[i].end) { 215 if (nodes[i].start != nodes[i].end) {
180 nodeid = nodeids[i]; 216 nodeid = nodeids[i];
181 for (j = 0; j < cores; j++) 217 for (j = apicid_base; j < cores + apicid_base; j++)
182 apicid_to_node[(nodeid << bits) + j] = i; 218 apicid_to_node[(nodeid << bits) + j] = i;
183 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 219 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
184 } 220 }
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index bd5e05c654dc..60bcb5b6a37e 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -777,14 +777,20 @@ static inline int change_page_attr_clear(unsigned long addr, int numpages,
777 777
778int _set_memory_uc(unsigned long addr, int numpages) 778int _set_memory_uc(unsigned long addr, int numpages)
779{ 779{
780 /*
781 * for now UC MINUS. see comments in ioremap_nocache()
782 */
780 return change_page_attr_set(addr, numpages, 783 return change_page_attr_set(addr, numpages,
781 __pgprot(_PAGE_CACHE_UC)); 784 __pgprot(_PAGE_CACHE_UC_MINUS));
782} 785}
783 786
784int set_memory_uc(unsigned long addr, int numpages) 787int set_memory_uc(unsigned long addr, int numpages)
785{ 788{
789 /*
790 * for now UC MINUS. see comments in ioremap_nocache()
791 */
786 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, 792 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE,
787 _PAGE_CACHE_UC, NULL)) 793 _PAGE_CACHE_UC_MINUS, NULL))
788 return -EINVAL; 794 return -EINVAL;
789 795
790 return _set_memory_uc(addr, numpages); 796 return _set_memory_uc(addr, numpages);
diff --git a/arch/x86/pci/Makefile_32 b/arch/x86/pci/Makefile_32
index cdd6828b5abb..89ec35d00efd 100644
--- a/arch/x86/pci/Makefile_32
+++ b/arch/x86/pci/Makefile_32
@@ -3,12 +3,22 @@ obj-y := i386.o init.o
3obj-$(CONFIG_PCI_BIOS) += pcbios.o 3obj-$(CONFIG_PCI_BIOS) += pcbios.o
4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_32.o direct.o mmconfig-shared.o 4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_32.o direct.o mmconfig-shared.o
5obj-$(CONFIG_PCI_DIRECT) += direct.o 5obj-$(CONFIG_PCI_DIRECT) += direct.o
6obj-$(CONFIG_PCI_OLPC) += olpc.o
6 7
7pci-y := fixup.o 8pci-y := fixup.o
9
10# Do not change the ordering here. There is a nasty init function
11# ordering dependency which breaks when you move acpi.o below
12# legacy/irq.o
8pci-$(CONFIG_ACPI) += acpi.o 13pci-$(CONFIG_ACPI) += acpi.o
9pci-y += legacy.o irq.o 14pci-y += legacy.o irq.o
10 15
16# Careful: VISWS and NUMAQ overrule the pci-y above. The colons are
17# therefor correct. This needs a proper fix by distangling the code.
11pci-$(CONFIG_X86_VISWS) := visws.o fixup.o 18pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
12pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o 19pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o
13 20
21# Necessary for NUMAQ as well
22pci-$(CONFIG_NUMA) += mp_bus_to_node.o
23
14obj-y += $(pci-y) common.o early.o 24obj-y += $(pci-y) common.o early.o
diff --git a/arch/x86/pci/Makefile_64 b/arch/x86/pci/Makefile_64
index 7d8c467bf143..8fbd19832cf6 100644
--- a/arch/x86/pci/Makefile_64
+++ b/arch/x86/pci/Makefile_64
@@ -13,5 +13,5 @@ obj-y += legacy.o irq.o common.o early.o
13# mmconfig has a 64bit special 13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o 14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
15 15
16obj-$(CONFIG_NUMA) += k8-bus_64.o 16obj-y += k8-bus_64.o
17 17
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 2664cb3fc96c..1a9c0c6a1a18 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -191,7 +191,10 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
191{ 191{
192 struct pci_bus *bus; 192 struct pci_bus *bus;
193 struct pci_sysdata *sd; 193 struct pci_sysdata *sd;
194 int node;
195#ifdef CONFIG_ACPI_NUMA
194 int pxm; 196 int pxm;
197#endif
195 198
196 dmi_check_system(acpi_pciprobe_dmi_table); 199 dmi_check_system(acpi_pciprobe_dmi_table);
197 200
@@ -201,6 +204,17 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
201 return NULL; 204 return NULL;
202 } 205 }
203 206
207 node = -1;
208#ifdef CONFIG_ACPI_NUMA
209 pxm = acpi_get_pxm(device->handle);
210 if (pxm >= 0)
211 node = pxm_to_node(pxm);
212 if (node != -1)
213 set_mp_bus_to_node(busnum, node);
214 else
215 node = get_mp_bus_to_node(busnum);
216#endif
217
204 /* Allocate per-root-bus (not per bus) arch-specific data. 218 /* Allocate per-root-bus (not per bus) arch-specific data.
205 * TODO: leak; this memory is never freed. 219 * TODO: leak; this memory is never freed.
206 * It's arguable whether it's worth the trouble to care. 220 * It's arguable whether it's worth the trouble to care.
@@ -212,13 +226,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
212 } 226 }
213 227
214 sd->domain = domain; 228 sd->domain = domain;
215 sd->node = -1; 229 sd->node = node;
216
217 pxm = acpi_get_pxm(device->handle);
218#ifdef CONFIG_ACPI_NUMA
219 if (pxm >= 0)
220 sd->node = pxm_to_node(pxm);
221#endif
222 /* 230 /*
223 * Maybe the desired pci bus has been already scanned. In such case 231 * Maybe the desired pci bus has been already scanned. In such case
224 * it is unnecessary to scan the pci bus with the given domain,busnum. 232 * it is unnecessary to scan the pci bus with the given domain,busnum.
@@ -238,9 +246,9 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
238 kfree(sd); 246 kfree(sd);
239 247
240#ifdef CONFIG_ACPI_NUMA 248#ifdef CONFIG_ACPI_NUMA
241 if (bus != NULL) { 249 if (bus) {
242 if (pxm >= 0) { 250 if (pxm >= 0) {
243 printk("bus %d -> pxm %d -> node %d\n", 251 printk(KERN_DEBUG "bus %02x -> pxm %d -> node %d\n",
244 busnum, pxm, pxm_to_node(pxm)); 252 busnum, pxm, pxm_to_node(pxm));
245 } 253 }
246 } 254 }
@@ -248,7 +256,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
248 256
249 if (bus && (pci_probe & PCI_USE__CRS)) 257 if (bus && (pci_probe & PCI_USE__CRS))
250 get_current_resources(device, busnum, domain, bus); 258 get_current_resources(device, busnum, domain, bus);
251
252 return bus; 259 return bus;
253} 260}
254 261
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 75fcc29ecf52..2a4d751818b7 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -342,9 +342,14 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
342 return NULL; 342 return NULL;
343 } 343 }
344 344
345 sd->node = get_mp_bus_to_node(busnum);
346
345 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum); 347 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
348 bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
349 if (!bus)
350 kfree(sd);
346 351
347 return pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); 352 return bus;
348} 353}
349 354
350extern u8 pci_cache_line_size; 355extern u8 pci_cache_line_size;
@@ -420,6 +425,10 @@ char * __devinit pcibios_setup(char *str)
420 pci_probe &= ~PCI_PROBE_MMCONF; 425 pci_probe &= ~PCI_PROBE_MMCONF;
421 return NULL; 426 return NULL;
422 } 427 }
428 else if (!strcmp(str, "check_enable_amd_mmconf")) {
429 pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
430 return NULL;
431 }
423#endif 432#endif
424 else if (!strcmp(str, "noacpi")) { 433 else if (!strcmp(str, "noacpi")) {
425 acpi_noirq_set(); 434 acpi_noirq_set();
@@ -480,7 +489,7 @@ void pcibios_disable_device (struct pci_dev *dev)
480 pcibios_disable_irq(dev); 489 pcibios_disable_irq(dev);
481} 490}
482 491
483struct pci_bus *__devinit pci_scan_bus_with_sysdata(int busno) 492struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node)
484{ 493{
485 struct pci_bus *bus = NULL; 494 struct pci_bus *bus = NULL;
486 struct pci_sysdata *sd; 495 struct pci_sysdata *sd;
@@ -495,10 +504,15 @@ struct pci_bus *__devinit pci_scan_bus_with_sysdata(int busno)
495 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno); 504 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
496 return NULL; 505 return NULL;
497 } 506 }
498 sd->node = -1; 507 sd->node = node;
499 bus = pci_scan_bus(busno, &pci_root_ops, sd); 508 bus = pci_scan_bus(busno, ops, sd);
500 if (!bus) 509 if (!bus)
501 kfree(sd); 510 kfree(sd);
502 511
503 return bus; 512 return bus;
504} 513}
514
515struct pci_bus *pci_scan_bus_with_sysdata(int busno)
516{
517 return pci_scan_bus_on_node(busno, &pci_root_ops, -1);
518}
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c
index 42f3e4cad179..21d1e0e0d535 100644
--- a/arch/x86/pci/direct.c
+++ b/arch/x86/pci/direct.c
@@ -258,7 +258,8 @@ void __init pci_direct_init(int type)
258{ 258{
259 if (type == 0) 259 if (type == 0)
260 return; 260 return;
261 printk(KERN_INFO "PCI: Using configuration type %d\n", type); 261 printk(KERN_INFO "PCI: Using configuration type %d for base access\n",
262 type);
262 if (type == 1) 263 if (type == 1)
263 raw_pci_ops = &pci_direct_conf1; 264 raw_pci_ops = &pci_direct_conf1;
264 else 265 else
@@ -275,8 +276,10 @@ int __init pci_direct_probe(void)
275 if (!region) 276 if (!region)
276 goto type2; 277 goto type2;
277 278
278 if (pci_check_type1()) 279 if (pci_check_type1()) {
280 raw_pci_ops = &pci_direct_conf1;
279 return 1; 281 return 1;
282 }
280 release_resource(region); 283 release_resource(region);
281 284
282 type2: 285 type2:
@@ -290,7 +293,6 @@ int __init pci_direct_probe(void)
290 goto fail2; 293 goto fail2;
291 294
292 if (pci_check_type2()) { 295 if (pci_check_type2()) {
293 printk(KERN_INFO "PCI: Using configuration type 2\n");
294 raw_pci_ops = &pci_direct_conf2; 296 raw_pci_ops = &pci_direct_conf2;
295 return 2; 297 return 2;
296 } 298 }
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index a5ef5f551373..b60b2abd480c 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -493,3 +493,20 @@ static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev)
493} 493}
494DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015, 494DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015,
495 pci_siemens_interrupt_controller); 495 pci_siemens_interrupt_controller);
496
497/*
498 * Regular PCI devices have 256 bytes, but AMD Family 10h Opteron ext config
499 * have 4096 bytes. Even if the device is capable, that doesn't mean we can
500 * access it. Maybe we don't have a way to generate extended config space
501 * accesses. So check it
502 */
503static void fam10h_pci_cfg_space_size(struct pci_dev *dev)
504{
505 dev->cfg_size = pci_cfg_space_size_ext(dev, 0);
506}
507
508DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, fam10h_pci_cfg_space_size);
509DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1201, fam10h_pci_cfg_space_size);
510DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1202, fam10h_pci_cfg_space_size);
511DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1203, fam10h_pci_cfg_space_size);
512DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1204, fam10h_pci_cfg_space_size);
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 94f6c73a53d0..8af0f0bae2af 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -301,6 +301,13 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
301 prot = pgprot_val(vma->vm_page_prot); 301 prot = pgprot_val(vma->vm_page_prot);
302 if (pat_wc_enabled && write_combine) 302 if (pat_wc_enabled && write_combine)
303 prot |= _PAGE_CACHE_WC; 303 prot |= _PAGE_CACHE_WC;
304 else if (pat_wc_enabled)
305 /*
306 * ioremap() and ioremap_nocache() defaults to UC MINUS for now.
307 * To avoid attribute conflicts, request UC MINUS here
308 * aswell.
309 */
310 prot |= _PAGE_CACHE_UC_MINUS;
304 else if (boot_cpu_data.x86 > 3) 311 else if (boot_cpu_data.x86 > 3)
305 prot |= _PAGE_CACHE_UC; 312 prot |= _PAGE_CACHE_UC;
306 313
@@ -319,9 +326,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
319 * - request is uncached, return cannot be write-combine 326 * - request is uncached, return cannot be write-combine
320 * - request is write-combine, return cannot be write-back 327 * - request is write-combine, return cannot be write-back
321 */ 328 */
322 if ((flags == _PAGE_CACHE_UC && 329 if ((flags == _PAGE_CACHE_UC_MINUS &&
323 (new_flags == _PAGE_CACHE_WB || 330 (new_flags == _PAGE_CACHE_WB)) ||
324 new_flags == _PAGE_CACHE_WC)) ||
325 (flags == _PAGE_CACHE_WC && 331 (flags == _PAGE_CACHE_WC &&
326 new_flags == _PAGE_CACHE_WB)) { 332 new_flags == _PAGE_CACHE_WB)) {
327 free_memtype(addr, addr+len); 333 free_memtype(addr, addr+len);
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
index 3de9f9ba2da6..dd30c6076b5d 100644
--- a/arch/x86/pci/init.c
+++ b/arch/x86/pci/init.c
@@ -6,16 +6,17 @@
6 in the right sequence from here. */ 6 in the right sequence from here. */
7static __init int pci_access_init(void) 7static __init int pci_access_init(void)
8{ 8{
9 int type __maybe_unused = 0;
10
11#ifdef CONFIG_PCI_DIRECT 9#ifdef CONFIG_PCI_DIRECT
10 int type = 0;
11
12 type = pci_direct_probe(); 12 type = pci_direct_probe();
13#endif 13#endif
14#ifdef CONFIG_PCI_MMCONFIG 14
15 pci_mmcfg_init(type); 15 pci_mmcfg_early_init();
16
17#ifdef CONFIG_PCI_OLPC
18 pci_olpc_init();
16#endif 19#endif
17 if (raw_pci_ops)
18 return 0;
19#ifdef CONFIG_PCI_BIOS 20#ifdef CONFIG_PCI_BIOS
20 pci_pcbios_init(); 21 pci_pcbios_init();
21#endif 22#endif
@@ -28,7 +29,7 @@ static __init int pci_access_init(void)
28#ifdef CONFIG_PCI_DIRECT 29#ifdef CONFIG_PCI_DIRECT
29 pci_direct_init(type); 30 pci_direct_init(type);
30#endif 31#endif
31 if (!raw_pci_ops) 32 if (!raw_pci_ops && !raw_pci_ext_ops)
32 printk(KERN_ERR 33 printk(KERN_ERR
33 "PCI: Fatal: No config space access function found\n"); 34 "PCI: Fatal: No config space access function found\n");
34 35
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 579745ca6b66..0908fca901bf 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -136,9 +136,11 @@ static void __init pirq_peer_trick(void)
136 busmap[e->bus] = 1; 136 busmap[e->bus] = 1;
137 } 137 }
138 for(i = 1; i < 256; i++) { 138 for(i = 1; i < 256; i++) {
139 int node;
139 if (!busmap[i] || pci_find_bus(0, i)) 140 if (!busmap[i] || pci_find_bus(0, i))
140 continue; 141 continue;
141 if (pci_scan_bus_with_sysdata(i)) 142 node = get_mp_bus_to_node(i);
143 if (pci_scan_bus_on_node(i, &pci_root_ops, node))
142 printk(KERN_INFO "PCI: Discovered primary peer " 144 printk(KERN_INFO "PCI: Discovered primary peer "
143 "bus %02x [IRQ]\n", i); 145 "bus %02x [IRQ]\n", i);
144 } 146 }
diff --git a/arch/x86/pci/k8-bus_64.c b/arch/x86/pci/k8-bus_64.c
index 9cc813e29706..ab6d4b18a88f 100644
--- a/arch/x86/pci/k8-bus_64.c
+++ b/arch/x86/pci/k8-bus_64.c
@@ -1,83 +1,536 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/pci.h> 2#include <linux/pci.h>
3#include <asm/pci-direct.h>
3#include <asm/mpspec.h> 4#include <asm/mpspec.h>
4#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/topology.h>
5 7
6/* 8/*
7 * This discovers the pcibus <-> node mapping on AMD K8. 9 * This discovers the pcibus <-> node mapping on AMD K8.
8 * 10 * also get peer root bus resource for io,mmio
9 * RED-PEN need to call this again on PCI hotplug
10 * RED-PEN empty cpus get reported wrong
11 */ 11 */
12 12
13#define NODE_ID_REGISTER 0x60 13
14#define NODE_ID(dword) (dword & 0x07) 14/*
15#define LDT_BUS_NUMBER_REGISTER_0 0x94 15 * sub bus (transparent) will use entres from 3 to store extra from root,
16#define LDT_BUS_NUMBER_REGISTER_1 0xB4 16 * so need to make sure have enought slot there, increase PCI_BUS_NUM_RESOURCES?
17#define LDT_BUS_NUMBER_REGISTER_2 0xD4 17 */
18#define NR_LDT_BUS_NUMBER_REGISTERS 3 18#define RES_NUM 16
19#define SECONDARY_LDT_BUS_NUMBER(dword) ((dword >> 8) & 0xFF) 19struct pci_root_info {
20#define SUBORDINATE_LDT_BUS_NUMBER(dword) ((dword >> 16) & 0xFF) 20 char name[12];
21#define PCI_DEVICE_ID_K8HTCONFIG 0x1100 21 unsigned int res_num;
22 struct resource res[RES_NUM];
23 int bus_min;
24 int bus_max;
25 int node;
26 int link;
27};
28
29/* 4 at this time, it may become to 32 */
30#define PCI_ROOT_NR 4
31static int pci_root_num;
32static struct pci_root_info pci_root_info[PCI_ROOT_NR];
33
34#ifdef CONFIG_NUMA
35
36#define BUS_NR 256
37
38static int mp_bus_to_node[BUS_NR];
39
40void set_mp_bus_to_node(int busnum, int node)
41{
42 if (busnum >= 0 && busnum < BUS_NR)
43 mp_bus_to_node[busnum] = node;
44}
45
46int get_mp_bus_to_node(int busnum)
47{
48 int node = -1;
49
50 if (busnum < 0 || busnum > (BUS_NR - 1))
51 return node;
52
53 node = mp_bus_to_node[busnum];
54
55 /*
56 * let numa_node_id to decide it later in dma_alloc_pages
57 * if there is no ram on that node
58 */
59 if (node != -1 && !node_online(node))
60 node = -1;
61
62 return node;
63}
64#endif
65
66void set_pci_bus_resources_arch_default(struct pci_bus *b)
67{
68 int i;
69 int j;
70 struct pci_root_info *info;
71
72 /* if only one root bus, don't need to anything */
73 if (pci_root_num < 2)
74 return;
75
76 for (i = 0; i < pci_root_num; i++) {
77 if (pci_root_info[i].bus_min == b->number)
78 break;
79 }
80
81 if (i == pci_root_num)
82 return;
83
84 info = &pci_root_info[i];
85 for (j = 0; j < info->res_num; j++) {
86 struct resource *res;
87 struct resource *root;
88
89 res = &info->res[j];
90 b->resource[j] = res;
91 if (res->flags & IORESOURCE_IO)
92 root = &ioport_resource;
93 else
94 root = &iomem_resource;
95 insert_resource(root, res);
96 }
97}
98
99#define RANGE_NUM 16
100
101struct res_range {
102 size_t start;
103 size_t end;
104};
105
106static void __init update_range(struct res_range *range, size_t start,
107 size_t end)
108{
109 int i;
110 int j;
111
112 for (j = 0; j < RANGE_NUM; j++) {
113 if (!range[j].end)
114 continue;
115
116 if (start <= range[j].start && end >= range[j].end) {
117 range[j].start = 0;
118 range[j].end = 0;
119 continue;
120 }
121
122 if (start <= range[j].start && end < range[j].end && range[j].start < end + 1) {
123 range[j].start = end + 1;
124 continue;
125 }
126
127
128 if (start > range[j].start && end >= range[j].end && range[j].end > start - 1) {
129 range[j].end = start - 1;
130 continue;
131 }
132
133 if (start > range[j].start && end < range[j].end) {
134 /* find the new spare */
135 for (i = 0; i < RANGE_NUM; i++) {
136 if (range[i].end == 0)
137 break;
138 }
139 if (i < RANGE_NUM) {
140 range[i].end = range[j].end;
141 range[i].start = end + 1;
142 } else {
143 printk(KERN_ERR "run of slot in ranges\n");
144 }
145 range[j].end = start - 1;
146 continue;
147 }
148 }
149}
150
151static void __init update_res(struct pci_root_info *info, size_t start,
152 size_t end, unsigned long flags, int merge)
153{
154 int i;
155 struct resource *res;
156
157 if (!merge)
158 goto addit;
159
160 /* try to merge it with old one */
161 for (i = 0; i < info->res_num; i++) {
162 size_t final_start, final_end;
163 size_t common_start, common_end;
164
165 res = &info->res[i];
166 if (res->flags != flags)
167 continue;
168
169 common_start = max((size_t)res->start, start);
170 common_end = min((size_t)res->end, end);
171 if (common_start > common_end + 1)
172 continue;
173
174 final_start = min((size_t)res->start, start);
175 final_end = max((size_t)res->end, end);
176
177 res->start = final_start;
178 res->end = final_end;
179 return;
180 }
181
182addit:
183
184 /* need to add that */
185 if (info->res_num >= RES_NUM)
186 return;
187
188 res = &info->res[info->res_num];
189 res->name = info->name;
190 res->flags = flags;
191 res->start = start;
192 res->end = end;
193 res->child = NULL;
194 info->res_num++;
195}
196
197struct pci_hostbridge_probe {
198 u32 bus;
199 u32 slot;
200 u32 vendor;
201 u32 device;
202};
203
204static struct pci_hostbridge_probe pci_probes[] __initdata = {
205 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1100 },
206 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1200 },
207 { 0xff, 0, PCI_VENDOR_ID_AMD, 0x1200 },
208 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1300 },
209};
210
211static u64 __initdata fam10h_mmconf_start;
212static u64 __initdata fam10h_mmconf_end;
213static void __init get_pci_mmcfg_amd_fam10h_range(void)
214{
215 u32 address;
216 u64 base, msr;
217 unsigned segn_busn_bits;
218
219 /* assume all cpus from fam10h have mmconf */
220 if (boot_cpu_data.x86 < 0x10)
221 return;
222
223 address = MSR_FAM10H_MMIO_CONF_BASE;
224 rdmsrl(address, msr);
225
226 /* mmconfig is not enable */
227 if (!(msr & FAM10H_MMIO_CONF_ENABLE))
228 return;
229
230 base = msr & (FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT);
231
232 segn_busn_bits = (msr >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
233 FAM10H_MMIO_CONF_BUSRANGE_MASK;
234
235 fam10h_mmconf_start = base;
236 fam10h_mmconf_end = base + (1ULL<<(segn_busn_bits + 20)) - 1;
237}
22 238
23/** 239/**
24 * fill_mp_bus_to_cpumask() 240 * early_fill_mp_bus_to_node()
241 * called before pcibios_scan_root and pci_scan_bus
25 * fills the mp_bus_to_cpumask array based according to the LDT Bus Number 242 * fills the mp_bus_to_cpumask array based according to the LDT Bus Number
26 * Registers found in the K8 northbridge 243 * Registers found in the K8 northbridge
27 */ 244 */
28__init static int 245static int __init early_fill_mp_bus_info(void)
29fill_mp_bus_to_cpumask(void)
30{ 246{
31 struct pci_dev *nb_dev = NULL; 247 int i;
32 int i, j; 248 int j;
33 u32 ldtbus, nid; 249 unsigned bus;
34 static int lbnr[3] = { 250 unsigned slot;
35 LDT_BUS_NUMBER_REGISTER_0, 251 int found;
36 LDT_BUS_NUMBER_REGISTER_1, 252 int node;
37 LDT_BUS_NUMBER_REGISTER_2 253 int link;
38 }; 254 int def_node;
39 255 int def_link;
40 while ((nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 256 struct pci_root_info *info;
41 PCI_DEVICE_ID_K8HTCONFIG, nb_dev))) { 257 u32 reg;
42 pci_read_config_dword(nb_dev, NODE_ID_REGISTER, &nid); 258 struct resource *res;
43 259 size_t start;
44 for (i = 0; i < NR_LDT_BUS_NUMBER_REGISTERS; i++) { 260 size_t end;
45 pci_read_config_dword(nb_dev, lbnr[i], &ldtbus); 261 struct res_range range[RANGE_NUM];
46 /* 262 u64 val;
47 * if there are no busses hanging off of the current 263 u32 address;
48 * ldt link then both the secondary and subordinate 264
49 * bus number fields are set to 0. 265#ifdef CONFIG_NUMA
50 * 266 for (i = 0; i < BUS_NR; i++)
51 * RED-PEN 267 mp_bus_to_node[i] = -1;
52 * This is slightly broken because it assumes 268#endif
53 * HT node IDs == Linux node ids, which is not always 269
54 * true. However it is probably mostly true. 270 if (!early_pci_allowed())
55 */ 271 return -1;
56 if (!(SECONDARY_LDT_BUS_NUMBER(ldtbus) == 0 272
57 && SUBORDINATE_LDT_BUS_NUMBER(ldtbus) == 0)) { 273 found = 0;
58 for (j = SECONDARY_LDT_BUS_NUMBER(ldtbus); 274 for (i = 0; i < ARRAY_SIZE(pci_probes); i++) {
59 j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus); 275 u32 id;
60 j++) { 276 u16 device;
61 struct pci_bus *bus; 277 u16 vendor;
62 struct pci_sysdata *sd; 278
63 279 bus = pci_probes[i].bus;
64 long node = NODE_ID(nid); 280 slot = pci_probes[i].slot;
65 /* Algorithm a bit dumb, but 281 id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID);
66 it shouldn't matter here */ 282
67 bus = pci_find_bus(0, j); 283 vendor = id & 0xffff;
68 if (!bus) 284 device = (id>>16) & 0xffff;
69 continue; 285 if (pci_probes[i].vendor == vendor &&
70 if (!node_online(node)) 286 pci_probes[i].device == device) {
71 node = 0; 287 found = 1;
72 288 break;
73 sd = bus->sysdata; 289 }
74 sd->node = node; 290 }
75 } 291
292 if (!found)
293 return 0;
294
295 pci_root_num = 0;
296 for (i = 0; i < 4; i++) {
297 int min_bus;
298 int max_bus;
299 reg = read_pci_config(bus, slot, 1, 0xe0 + (i << 2));
300
301 /* Check if that register is enabled for bus range */
302 if ((reg & 7) != 3)
303 continue;
304
305 min_bus = (reg >> 16) & 0xff;
306 max_bus = (reg >> 24) & 0xff;
307 node = (reg >> 4) & 0x07;
308#ifdef CONFIG_NUMA
309 for (j = min_bus; j <= max_bus; j++)
310 mp_bus_to_node[j] = (unsigned char) node;
311#endif
312 link = (reg >> 8) & 0x03;
313
314 info = &pci_root_info[pci_root_num];
315 info->bus_min = min_bus;
316 info->bus_max = max_bus;
317 info->node = node;
318 info->link = link;
319 sprintf(info->name, "PCI Bus #%02x", min_bus);
320 pci_root_num++;
321 }
322
323 /* get the default node and link for left over res */
324 reg = read_pci_config(bus, slot, 0, 0x60);
325 def_node = (reg >> 8) & 0x07;
326 reg = read_pci_config(bus, slot, 0, 0x64);
327 def_link = (reg >> 8) & 0x03;
328
329 memset(range, 0, sizeof(range));
330 range[0].end = 0xffff;
331 /* io port resource */
332 for (i = 0; i < 4; i++) {
333 reg = read_pci_config(bus, slot, 1, 0xc0 + (i << 3));
334 if (!(reg & 3))
335 continue;
336
337 start = reg & 0xfff000;
338 reg = read_pci_config(bus, slot, 1, 0xc4 + (i << 3));
339 node = reg & 0x07;
340 link = (reg >> 4) & 0x03;
341 end = (reg & 0xfff000) | 0xfff;
342
343 /* find the position */
344 for (j = 0; j < pci_root_num; j++) {
345 info = &pci_root_info[j];
346 if (info->node == node && info->link == link)
347 break;
348 }
349 if (j == pci_root_num)
350 continue; /* not found */
351
352 info = &pci_root_info[j];
353 printk(KERN_DEBUG "node %d link %d: io port [%llx, %llx]\n",
354 node, link, (u64)start, (u64)end);
355
356 /* kernel only handle 16 bit only */
357 if (end > 0xffff)
358 end = 0xffff;
359 update_res(info, start, end, IORESOURCE_IO, 1);
360 update_range(range, start, end);
361 }
362 /* add left over io port range to def node/link, [0, 0xffff] */
363 /* find the position */
364 for (j = 0; j < pci_root_num; j++) {
365 info = &pci_root_info[j];
366 if (info->node == def_node && info->link == def_link)
367 break;
368 }
369 if (j < pci_root_num) {
370 info = &pci_root_info[j];
371 for (i = 0; i < RANGE_NUM; i++) {
372 if (!range[i].end)
373 continue;
374
375 update_res(info, range[i].start, range[i].end,
376 IORESOURCE_IO, 1);
377 }
378 }
379
380 memset(range, 0, sizeof(range));
381 /* 0xfd00000000-0xffffffffff for HT */
382 range[0].end = (0xfdULL<<32) - 1;
383
384 /* need to take out [0, TOM) for RAM*/
385 address = MSR_K8_TOP_MEM1;
386 rdmsrl(address, val);
387 end = (val & 0xffffff8000000ULL);
388 printk(KERN_INFO "TOM: %016lx aka %ldM\n", end, end>>20);
389 if (end < (1ULL<<32))
390 update_range(range, 0, end - 1);
391
392 /* get mmconfig */
393 get_pci_mmcfg_amd_fam10h_range();
394 /* need to take out mmconf range */
395 if (fam10h_mmconf_end) {
396 printk(KERN_DEBUG "Fam 10h mmconf [%llx, %llx]\n", fam10h_mmconf_start, fam10h_mmconf_end);
397 update_range(range, fam10h_mmconf_start, fam10h_mmconf_end);
398 }
399
400 /* mmio resource */
401 for (i = 0; i < 8; i++) {
402 reg = read_pci_config(bus, slot, 1, 0x80 + (i << 3));
403 if (!(reg & 3))
404 continue;
405
406 start = reg & 0xffffff00; /* 39:16 on 31:8*/
407 start <<= 8;
408 reg = read_pci_config(bus, slot, 1, 0x84 + (i << 3));
409 node = reg & 0x07;
410 link = (reg >> 4) & 0x03;
411 end = (reg & 0xffffff00);
412 end <<= 8;
413 end |= 0xffff;
414
415 /* find the position */
416 for (j = 0; j < pci_root_num; j++) {
417 info = &pci_root_info[j];
418 if (info->node == node && info->link == link)
419 break;
420 }
421 if (j == pci_root_num)
422 continue; /* not found */
423
424 info = &pci_root_info[j];
425
426 printk(KERN_DEBUG "node %d link %d: mmio [%llx, %llx]",
427 node, link, (u64)start, (u64)end);
428 /*
429 * some sick allocation would have range overlap with fam10h
430 * mmconf range, so need to update start and end.
431 */
432 if (fam10h_mmconf_end) {
433 int changed = 0;
434 u64 endx = 0;
435 if (start >= fam10h_mmconf_start &&
436 start <= fam10h_mmconf_end) {
437 start = fam10h_mmconf_end + 1;
438 changed = 1;
439 }
440
441 if (end >= fam10h_mmconf_start &&
442 end <= fam10h_mmconf_end) {
443 end = fam10h_mmconf_start - 1;
444 changed = 1;
445 }
446
447 if (start < fam10h_mmconf_start &&
448 end > fam10h_mmconf_end) {
449 /* we got a hole */
450 endx = fam10h_mmconf_start - 1;
451 update_res(info, start, endx, IORESOURCE_MEM, 0);
452 update_range(range, start, endx);
453 printk(KERN_CONT " ==> [%llx, %llx]", (u64)start, endx);
454 start = fam10h_mmconf_end + 1;
455 changed = 1;
456 }
457 if (changed) {
458 if (start <= end) {
459 printk(KERN_CONT " %s [%llx, %llx]", endx?"and":"==>", (u64)start, (u64)end);
460 } else {
461 printk(KERN_CONT "%s\n", endx?"":" ==> none");
462 continue;
463 }
76 } 464 }
77 } 465 }
466
467 update_res(info, start, end, IORESOURCE_MEM, 1);
468 update_range(range, start, end);
469 printk(KERN_CONT "\n");
470 }
471
472 /* need to take out [4G, TOM2) for RAM*/
473 /* SYS_CFG */
474 address = MSR_K8_SYSCFG;
475 rdmsrl(address, val);
476 /* TOP_MEM2 is enabled? */
477 if (val & (1<<21)) {
478 /* TOP_MEM2 */
479 address = MSR_K8_TOP_MEM2;
480 rdmsrl(address, val);
481 end = (val & 0xffffff8000000ULL);
482 printk(KERN_INFO "TOM2: %016lx aka %ldM\n", end, end>>20);
483 update_range(range, 1ULL<<32, end - 1);
484 }
485
486 /*
487 * add left over mmio range to def node/link ?
488 * that is tricky, just record range in from start_min to 4G
489 */
490 for (j = 0; j < pci_root_num; j++) {
491 info = &pci_root_info[j];
492 if (info->node == def_node && info->link == def_link)
493 break;
494 }
495 if (j < pci_root_num) {
496 info = &pci_root_info[j];
497
498 for (i = 0; i < RANGE_NUM; i++) {
499 if (!range[i].end)
500 continue;
501
502 update_res(info, range[i].start, range[i].end,
503 IORESOURCE_MEM, 1);
504 }
505 }
506
507#ifdef CONFIG_NUMA
508 for (i = 0; i < BUS_NR; i++) {
509 node = mp_bus_to_node[i];
510 if (node >= 0)
511 printk(KERN_DEBUG "bus: %02x to node: %02x\n", i, node);
512 }
513#endif
514
515 for (i = 0; i < pci_root_num; i++) {
516 int res_num;
517 int busnum;
518
519 info = &pci_root_info[i];
520 res_num = info->res_num;
521 busnum = info->bus_min;
522 printk(KERN_DEBUG "bus: [%02x,%02x] on node %x link %x\n",
523 info->bus_min, info->bus_max, info->node, info->link);
524 for (j = 0; j < res_num; j++) {
525 res = &info->res[j];
526 printk(KERN_DEBUG "bus: %02x index %x %s: [%llx, %llx]\n",
527 busnum, j,
528 (res->flags & IORESOURCE_IO)?"io port":"mmio",
529 res->start, res->end);
530 }
78 } 531 }
79 532
80 return 0; 533 return 0;
81} 534}
82 535
83fs_initcall(fill_mp_bus_to_cpumask); 536postcore_initcall(early_fill_mp_bus_info);
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index e041ced0ce13..a67921ce60af 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -12,6 +12,7 @@
12static void __devinit pcibios_fixup_peer_bridges(void) 12static void __devinit pcibios_fixup_peer_bridges(void)
13{ 13{
14 int n, devfn; 14 int n, devfn;
15 long node;
15 16
16 if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff) 17 if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff)
17 return; 18 return;
@@ -21,12 +22,13 @@ static void __devinit pcibios_fixup_peer_bridges(void)
21 u32 l; 22 u32 l;
22 if (pci_find_bus(0, n)) 23 if (pci_find_bus(0, n))
23 continue; 24 continue;
25 node = get_mp_bus_to_node(n);
24 for (devfn = 0; devfn < 256; devfn += 8) { 26 for (devfn = 0; devfn < 256; devfn += 8) {
25 if (!raw_pci_read(0, n, devfn, PCI_VENDOR_ID, 2, &l) && 27 if (!raw_pci_read(0, n, devfn, PCI_VENDOR_ID, 2, &l) &&
26 l != 0x0000 && l != 0xffff) { 28 l != 0x0000 && l != 0xffff) {
27 DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); 29 DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l);
28 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); 30 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
29 pci_scan_bus_with_sysdata(n); 31 pci_scan_bus_on_node(n, &pci_root_ops, node);
30 break; 32 break;
31 } 33 }
32 } 34 }
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 8d54df4dfaad..0cfebecf2a8f 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -28,7 +28,7 @@ static int __initdata pci_mmcfg_resources_inserted;
28static const char __init *pci_mmcfg_e7520(void) 28static const char __init *pci_mmcfg_e7520(void)
29{ 29{
30 u32 win; 30 u32 win;
31 pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win); 31 raw_pci_ops->read(0, 0, PCI_DEVFN(0, 0), 0xce, 2, &win);
32 32
33 win = win & 0xf000; 33 win = win & 0xf000;
34 if(win == 0x0000 || win == 0xf000) 34 if(win == 0x0000 || win == 0xf000)
@@ -53,7 +53,7 @@ static const char __init *pci_mmcfg_intel_945(void)
53 53
54 pci_mmcfg_config_num = 1; 54 pci_mmcfg_config_num = 1;
55 55
56 pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar); 56 raw_pci_ops->read(0, 0, PCI_DEVFN(0, 0), 0x48, 4, &pciexbar);
57 57
58 /* Enable bit */ 58 /* Enable bit */
59 if (!(pciexbar & 1)) 59 if (!(pciexbar & 1))
@@ -100,33 +100,102 @@ static const char __init *pci_mmcfg_intel_945(void)
100 return "Intel Corporation 945G/GZ/P/PL Express Memory Controller Hub"; 100 return "Intel Corporation 945G/GZ/P/PL Express Memory Controller Hub";
101} 101}
102 102
103static const char __init *pci_mmcfg_amd_fam10h(void)
104{
105 u32 low, high, address;
106 u64 base, msr;
107 int i;
108 unsigned segnbits = 0, busnbits;
109
110 if (!(pci_probe & PCI_CHECK_ENABLE_AMD_MMCONF))
111 return NULL;
112
113 address = MSR_FAM10H_MMIO_CONF_BASE;
114 if (rdmsr_safe(address, &low, &high))
115 return NULL;
116
117 msr = high;
118 msr <<= 32;
119 msr |= low;
120
121 /* mmconfig is not enable */
122 if (!(msr & FAM10H_MMIO_CONF_ENABLE))
123 return NULL;
124
125 base = msr & (FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT);
126
127 busnbits = (msr >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
128 FAM10H_MMIO_CONF_BUSRANGE_MASK;
129
130 /*
131 * only handle bus 0 ?
132 * need to skip it
133 */
134 if (!busnbits)
135 return NULL;
136
137 if (busnbits > 8) {
138 segnbits = busnbits - 8;
139 busnbits = 8;
140 }
141
142 pci_mmcfg_config_num = (1 << segnbits);
143 pci_mmcfg_config = kzalloc(sizeof(pci_mmcfg_config[0]) *
144 pci_mmcfg_config_num, GFP_KERNEL);
145 if (!pci_mmcfg_config)
146 return NULL;
147
148 for (i = 0; i < (1 << segnbits); i++) {
149 pci_mmcfg_config[i].address = base + (1<<28) * i;
150 pci_mmcfg_config[i].pci_segment = i;
151 pci_mmcfg_config[i].start_bus_number = 0;
152 pci_mmcfg_config[i].end_bus_number = (1 << busnbits) - 1;
153 }
154
155 return "AMD Family 10h NB";
156}
157
103struct pci_mmcfg_hostbridge_probe { 158struct pci_mmcfg_hostbridge_probe {
159 u32 bus;
160 u32 devfn;
104 u32 vendor; 161 u32 vendor;
105 u32 device; 162 u32 device;
106 const char *(*probe)(void); 163 const char *(*probe)(void);
107}; 164};
108 165
109static struct pci_mmcfg_hostbridge_probe pci_mmcfg_probes[] __initdata = { 166static struct pci_mmcfg_hostbridge_probe pci_mmcfg_probes[] __initdata = {
110 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, pci_mmcfg_e7520 }, 167 { 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_INTEL,
111 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82945G_HB, pci_mmcfg_intel_945 }, 168 PCI_DEVICE_ID_INTEL_E7520_MCH, pci_mmcfg_e7520 },
169 { 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_INTEL,
170 PCI_DEVICE_ID_INTEL_82945G_HB, pci_mmcfg_intel_945 },
171 { 0, PCI_DEVFN(0x18, 0), PCI_VENDOR_ID_AMD,
172 0x1200, pci_mmcfg_amd_fam10h },
173 { 0xff, PCI_DEVFN(0, 0), PCI_VENDOR_ID_AMD,
174 0x1200, pci_mmcfg_amd_fam10h },
112}; 175};
113 176
114static int __init pci_mmcfg_check_hostbridge(void) 177static int __init pci_mmcfg_check_hostbridge(void)
115{ 178{
116 u32 l; 179 u32 l;
180 u32 bus, devfn;
117 u16 vendor, device; 181 u16 vendor, device;
118 int i; 182 int i;
119 const char *name; 183 const char *name;
120 184
121 pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0, 4, &l); 185 if (!raw_pci_ops)
122 vendor = l & 0xffff; 186 return 0;
123 device = (l >> 16) & 0xffff;
124 187
125 pci_mmcfg_config_num = 0; 188 pci_mmcfg_config_num = 0;
126 pci_mmcfg_config = NULL; 189 pci_mmcfg_config = NULL;
127 name = NULL; 190 name = NULL;
128 191
129 for (i = 0; !name && i < ARRAY_SIZE(pci_mmcfg_probes); i++) { 192 for (i = 0; !name && i < ARRAY_SIZE(pci_mmcfg_probes); i++) {
193 bus = pci_mmcfg_probes[i].bus;
194 devfn = pci_mmcfg_probes[i].devfn;
195 raw_pci_ops->read(0, bus, devfn, 0, 4, &l);
196 vendor = l & 0xffff;
197 device = (l >> 16) & 0xffff;
198
130 if (pci_mmcfg_probes[i].vendor == vendor && 199 if (pci_mmcfg_probes[i].vendor == vendor &&
131 pci_mmcfg_probes[i].device == device) 200 pci_mmcfg_probes[i].device == device)
132 name = pci_mmcfg_probes[i].probe(); 201 name = pci_mmcfg_probes[i].probe();
@@ -173,9 +242,78 @@ static void __init pci_mmcfg_insert_resources(unsigned long resource_flags)
173 pci_mmcfg_resources_inserted = 1; 242 pci_mmcfg_resources_inserted = 1;
174} 243}
175 244
176static void __init pci_mmcfg_reject_broken(int type) 245static acpi_status __init check_mcfg_resource(struct acpi_resource *res,
246 void *data)
247{
248 struct resource *mcfg_res = data;
249 struct acpi_resource_address64 address;
250 acpi_status status;
251
252 if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) {
253 struct acpi_resource_fixed_memory32 *fixmem32 =
254 &res->data.fixed_memory32;
255 if (!fixmem32)
256 return AE_OK;
257 if ((mcfg_res->start >= fixmem32->address) &&
258 (mcfg_res->end < (fixmem32->address +
259 fixmem32->address_length))) {
260 mcfg_res->flags = 1;
261 return AE_CTRL_TERMINATE;
262 }
263 }
264 if ((res->type != ACPI_RESOURCE_TYPE_ADDRESS32) &&
265 (res->type != ACPI_RESOURCE_TYPE_ADDRESS64))
266 return AE_OK;
267
268 status = acpi_resource_to_address64(res, &address);
269 if (ACPI_FAILURE(status) ||
270 (address.address_length <= 0) ||
271 (address.resource_type != ACPI_MEMORY_RANGE))
272 return AE_OK;
273
274 if ((mcfg_res->start >= address.minimum) &&
275 (mcfg_res->end < (address.minimum + address.address_length))) {
276 mcfg_res->flags = 1;
277 return AE_CTRL_TERMINATE;
278 }
279 return AE_OK;
280}
281
282static acpi_status __init find_mboard_resource(acpi_handle handle, u32 lvl,
283 void *context, void **rv)
284{
285 struct resource *mcfg_res = context;
286
287 acpi_walk_resources(handle, METHOD_NAME__CRS,
288 check_mcfg_resource, context);
289
290 if (mcfg_res->flags)
291 return AE_CTRL_TERMINATE;
292
293 return AE_OK;
294}
295
296static int __init is_acpi_reserved(unsigned long start, unsigned long end)
297{
298 struct resource mcfg_res;
299
300 mcfg_res.start = start;
301 mcfg_res.end = end;
302 mcfg_res.flags = 0;
303
304 acpi_get_devices("PNP0C01", find_mboard_resource, &mcfg_res, NULL);
305
306 if (!mcfg_res.flags)
307 acpi_get_devices("PNP0C02", find_mboard_resource, &mcfg_res,
308 NULL);
309
310 return mcfg_res.flags;
311}
312
313static void __init pci_mmcfg_reject_broken(int early)
177{ 314{
178 typeof(pci_mmcfg_config[0]) *cfg; 315 typeof(pci_mmcfg_config[0]) *cfg;
316 int i;
179 317
180 if ((pci_mmcfg_config_num == 0) || 318 if ((pci_mmcfg_config_num == 0) ||
181 (pci_mmcfg_config == NULL) || 319 (pci_mmcfg_config == NULL) ||
@@ -184,51 +322,80 @@ static void __init pci_mmcfg_reject_broken(int type)
184 322
185 cfg = &pci_mmcfg_config[0]; 323 cfg = &pci_mmcfg_config[0];
186 324
187 /* 325 for (i = 0; i < pci_mmcfg_config_num; i++) {
188 * Handle more broken MCFG tables on Asus etc. 326 int valid = 0;
189 * They only contain a single entry for bus 0-0. 327 u32 size = (cfg->end_bus_number + 1) << 20;
190 */ 328 cfg = &pci_mmcfg_config[i];
191 if (pci_mmcfg_config_num == 1 && 329 printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx "
192 cfg->pci_segment == 0 && 330 "segment %hu buses %u - %u\n",
193 (cfg->start_bus_number | cfg->end_bus_number) == 0) { 331 i, (unsigned long)cfg->address, cfg->pci_segment,
194 printk(KERN_ERR "PCI: start and end of bus number is 0. " 332 (unsigned int)cfg->start_bus_number,
195 "Rejected as broken MCFG.\n"); 333 (unsigned int)cfg->end_bus_number);
196 goto reject; 334
335 if (!early &&
336 is_acpi_reserved(cfg->address, cfg->address + size - 1)) {
337 printk(KERN_NOTICE "PCI: MCFG area at %Lx reserved "
338 "in ACPI motherboard resources\n",
339 cfg->address);
340 valid = 1;
341 }
342
343 if (valid)
344 continue;
345
346 if (!early)
347 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not"
348 " reserved in ACPI motherboard resources\n",
349 cfg->address);
350 /* Don't try to do this check unless configuration
351 type 1 is available. how about type 2 ?*/
352 if (raw_pci_ops && e820_all_mapped(cfg->address,
353 cfg->address + size - 1,
354 E820_RESERVED)) {
355 printk(KERN_NOTICE
356 "PCI: MCFG area at %Lx reserved in E820\n",
357 cfg->address);
358 valid = 1;
359 }
360
361 if (!valid)
362 goto reject;
197 } 363 }
198 364
199 /*
200 * Only do this check when type 1 works. If it doesn't work
201 * assume we run on a Mac and always use MCFG
202 */
203 if (type == 1 && !e820_all_mapped(cfg->address,
204 cfg->address + MMCONFIG_APER_MIN,
205 E820_RESERVED)) {
206 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not"
207 " E820-reserved\n", cfg->address);
208 goto reject;
209 }
210 return; 365 return;
211 366
212reject: 367reject:
213 printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); 368 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
369 pci_mmcfg_arch_free();
214 kfree(pci_mmcfg_config); 370 kfree(pci_mmcfg_config);
215 pci_mmcfg_config = NULL; 371 pci_mmcfg_config = NULL;
216 pci_mmcfg_config_num = 0; 372 pci_mmcfg_config_num = 0;
217} 373}
218 374
219void __init pci_mmcfg_init(int type) 375static int __initdata known_bridge;
220{
221 int known_bridge = 0;
222 376
377void __init __pci_mmcfg_init(int early)
378{
379 /* MMCONFIG disabled */
223 if ((pci_probe & PCI_PROBE_MMCONF) == 0) 380 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
224 return; 381 return;
225 382
226 if (type == 1 && pci_mmcfg_check_hostbridge()) 383 /* MMCONFIG already enabled */
227 known_bridge = 1; 384 if (!early && !(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF))
385 return;
386
387 /* for late to exit */
388 if (known_bridge)
389 return;
390
391 if (early) {
392 if (pci_mmcfg_check_hostbridge())
393 known_bridge = 1;
394 }
228 395
229 if (!known_bridge) { 396 if (!known_bridge) {
230 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg); 397 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
231 pci_mmcfg_reject_broken(type); 398 pci_mmcfg_reject_broken(early);
232 } 399 }
233 400
234 if ((pci_mmcfg_config_num == 0) || 401 if ((pci_mmcfg_config_num == 0) ||
@@ -249,6 +416,16 @@ void __init pci_mmcfg_init(int type)
249 } 416 }
250} 417}
251 418
419void __init pci_mmcfg_early_init(void)
420{
421 __pci_mmcfg_init(1);
422}
423
424void __init pci_mmcfg_late_init(void)
425{
426 __pci_mmcfg_init(0);
427}
428
252static int __init pci_mmcfg_late_insert_resources(void) 429static int __init pci_mmcfg_late_insert_resources(void)
253{ 430{
254 /* 431 /*
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c
index 081816ada057..f3c761dce695 100644
--- a/arch/x86/pci/mmconfig_32.c
+++ b/arch/x86/pci/mmconfig_32.c
@@ -136,3 +136,7 @@ int __init pci_mmcfg_arch_init(void)
136 raw_pci_ext_ops = &pci_mmcfg; 136 raw_pci_ext_ops = &pci_mmcfg;
137 return 1; 137 return 1;
138} 138}
139
140void __init pci_mmcfg_arch_free(void)
141{
142}
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c
index 9207fd49233c..a1994163c99d 100644
--- a/arch/x86/pci/mmconfig_64.c
+++ b/arch/x86/pci/mmconfig_64.c
@@ -127,7 +127,7 @@ static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg)
127int __init pci_mmcfg_arch_init(void) 127int __init pci_mmcfg_arch_init(void)
128{ 128{
129 int i; 129 int i;
130 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * 130 pci_mmcfg_virt = kzalloc(sizeof(*pci_mmcfg_virt) *
131 pci_mmcfg_config_num, GFP_KERNEL); 131 pci_mmcfg_config_num, GFP_KERNEL);
132 if (pci_mmcfg_virt == NULL) { 132 if (pci_mmcfg_virt == NULL) {
133 printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n"); 133 printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n");
@@ -141,9 +141,29 @@ int __init pci_mmcfg_arch_init(void)
141 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " 141 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for "
142 "segment %d\n", 142 "segment %d\n",
143 pci_mmcfg_config[i].pci_segment); 143 pci_mmcfg_config[i].pci_segment);
144 pci_mmcfg_arch_free();
144 return 0; 145 return 0;
145 } 146 }
146 } 147 }
147 raw_pci_ext_ops = &pci_mmcfg; 148 raw_pci_ext_ops = &pci_mmcfg;
148 return 1; 149 return 1;
149} 150}
151
152void __init pci_mmcfg_arch_free(void)
153{
154 int i;
155
156 if (pci_mmcfg_virt == NULL)
157 return;
158
159 for (i = 0; i < pci_mmcfg_config_num; ++i) {
160 if (pci_mmcfg_virt[i].virt) {
161 iounmap(pci_mmcfg_virt[i].virt);
162 pci_mmcfg_virt[i].virt = NULL;
163 pci_mmcfg_virt[i].cfg = NULL;
164 }
165 }
166
167 kfree(pci_mmcfg_virt);
168 pci_mmcfg_virt = NULL;
169}
diff --git a/arch/x86/pci/mp_bus_to_node.c b/arch/x86/pci/mp_bus_to_node.c
new file mode 100644
index 000000000000..022943999b84
--- /dev/null
+++ b/arch/x86/pci/mp_bus_to_node.c
@@ -0,0 +1,23 @@
1#include <linux/pci.h>
2#include <linux/init.h>
3#include <linux/topology.h>
4
5#define BUS_NR 256
6
7static unsigned char mp_bus_to_node[BUS_NR];
8
9void set_mp_bus_to_node(int busnum, int node)
10{
11 if (busnum >= 0 && busnum < BUS_NR)
12 mp_bus_to_node[busnum] = (unsigned char) node;
13}
14
15int get_mp_bus_to_node(int busnum)
16{
17 int node;
18
19 if (busnum < 0 || busnum > (BUS_NR - 1))
20 return 0;
21 node = mp_bus_to_node[busnum];
22 return node;
23}
diff --git a/arch/x86/pci/olpc.c b/arch/x86/pci/olpc.c
new file mode 100644
index 000000000000..5e7636558c02
--- /dev/null
+++ b/arch/x86/pci/olpc.c
@@ -0,0 +1,313 @@
1/*
2 * Low-level PCI config space access for OLPC systems who lack the VSA
3 * PCI virtualization software.
4 *
5 * Copyright © 2006 Advanced Micro Devices, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * The AMD Geode chipset (ie: GX2 processor, cs5536 I/O companion device)
13 * has some I/O functions (display, southbridge, sound, USB HCIs, etc)
14 * that more or less behave like PCI devices, but the hardware doesn't
15 * directly implement the PCI configuration space headers. AMD provides
16 * "VSA" (Virtual System Architecture) software that emulates PCI config
17 * space for these devices, by trapping I/O accesses to PCI config register
18 * (CF8/CFC) and running some code in System Management Mode interrupt state.
19 * On the OLPC platform, we don't want to use that VSA code because
20 * (a) it slows down suspend/resume, and (b) recompiling it requires special
21 * compilers that are hard to get. So instead of letting the complex VSA
22 * code simulate the PCI config registers for the on-chip devices, we
23 * just simulate them the easy way, by inserting the code into the
24 * pci_write_config and pci_read_config path. Most of the config registers
25 * are read-only anyway, so the bulk of the simulation is just table lookup.
26 */
27
28#include <linux/pci.h>
29#include <linux/init.h>
30#include <asm/olpc.h>
31#include <asm/geode.h>
32#include "pci.h"
33
34/*
35 * In the tables below, the first two line (8 longwords) are the
36 * size masks that are used when the higher level PCI code determines
37 * the size of the region by writing ~0 to a base address register
38 * and reading back the result.
39 *
40 * The following lines are the values that are read during normal
41 * PCI config access cycles, i.e. not after just having written
42 * ~0 to a base address register.
43 */
44
45static const uint32_t lxnb_hdr[] = { /* dev 1 function 0 - devfn = 8 */
46 0x0, 0x0, 0x0, 0x0,
47 0x0, 0x0, 0x0, 0x0,
48
49 0x281022, 0x2200005, 0x6000021, 0x80f808, /* AMD Vendor ID */
50 0x0, 0x0, 0x0, 0x0, /* No virtual registers, hence no BAR */
51 0x0, 0x0, 0x0, 0x28100b,
52 0x0, 0x0, 0x0, 0x0,
53 0x0, 0x0, 0x0, 0x0,
54 0x0, 0x0, 0x0, 0x0,
55 0x0, 0x0, 0x0, 0x0,
56};
57
58static const uint32_t gxnb_hdr[] = { /* dev 1 function 0 - devfn = 8 */
59 0xfffffffd, 0x0, 0x0, 0x0,
60 0x0, 0x0, 0x0, 0x0,
61
62 0x28100b, 0x2200005, 0x6000021, 0x80f808, /* NSC Vendor ID */
63 0xac1d, 0x0, 0x0, 0x0, /* I/O BAR - base of virtual registers */
64 0x0, 0x0, 0x0, 0x28100b,
65 0x0, 0x0, 0x0, 0x0,
66 0x0, 0x0, 0x0, 0x0,
67 0x0, 0x0, 0x0, 0x0,
68 0x0, 0x0, 0x0, 0x0,
69};
70
71static const uint32_t lxfb_hdr[] = { /* dev 1 function 1 - devfn = 9 */
72 0xff000008, 0xffffc000, 0xffffc000, 0xffffc000,
73 0xffffc000, 0x0, 0x0, 0x0,
74
75 0x20811022, 0x2200003, 0x3000000, 0x0, /* AMD Vendor ID */
76 0xfd000000, 0xfe000000, 0xfe004000, 0xfe008000, /* FB, GP, VG, DF */
77 0xfe00c000, 0x0, 0x0, 0x30100b, /* VIP */
78 0x0, 0x0, 0x0, 0x10e, /* INTA, IRQ14 for graphics accel */
79 0x0, 0x0, 0x0, 0x0,
80 0x3d0, 0x3c0, 0xa0000, 0x0, /* VG IO, VG IO, EGA FB, MONO FB */
81 0x0, 0x0, 0x0, 0x0,
82};
83
84static const uint32_t gxfb_hdr[] = { /* dev 1 function 1 - devfn = 9 */
85 0xff800008, 0xffffc000, 0xffffc000, 0xffffc000,
86 0x0, 0x0, 0x0, 0x0,
87
88 0x30100b, 0x2200003, 0x3000000, 0x0, /* NSC Vendor ID */
89 0xfd000000, 0xfe000000, 0xfe004000, 0xfe008000, /* FB, GP, VG, DF */
90 0x0, 0x0, 0x0, 0x30100b,
91 0x0, 0x0, 0x0, 0x0,
92 0x0, 0x0, 0x0, 0x0,
93 0x3d0, 0x3c0, 0xa0000, 0x0, /* VG IO, VG IO, EGA FB, MONO FB */
94 0x0, 0x0, 0x0, 0x0,
95};
96
97static const uint32_t aes_hdr[] = { /* dev 1 function 2 - devfn = 0xa */
98 0xffffc000, 0x0, 0x0, 0x0,
99 0x0, 0x0, 0x0, 0x0,
100
101 0x20821022, 0x2a00006, 0x10100000, 0x8, /* NSC Vendor ID */
102 0xfe010000, 0x0, 0x0, 0x0, /* AES registers */
103 0x0, 0x0, 0x0, 0x20821022,
104 0x0, 0x0, 0x0, 0x0,
105 0x0, 0x0, 0x0, 0x0,
106 0x0, 0x0, 0x0, 0x0,
107 0x0, 0x0, 0x0, 0x0,
108};
109
110
111static const uint32_t isa_hdr[] = { /* dev f function 0 - devfn = 78 */
112 0xfffffff9, 0xffffff01, 0xffffffc1, 0xffffffe1,
113 0xffffff81, 0xffffffc1, 0x0, 0x0,
114
115 0x20901022, 0x2a00049, 0x6010003, 0x802000,
116 0x18b1, 0x1001, 0x1801, 0x1881, /* SMB-8 GPIO-256 MFGPT-64 IRQ-32 */
117 0x1401, 0x1841, 0x0, 0x20901022, /* PMS-128 ACPI-64 */
118 0x0, 0x0, 0x0, 0x0,
119 0x0, 0x0, 0x0, 0x0,
120 0x0, 0x0, 0x0, 0xaa5b, /* IRQ steering */
121 0x0, 0x0, 0x0, 0x0,
122};
123
124static const uint32_t ac97_hdr[] = { /* dev f function 3 - devfn = 7b */
125 0xffffff81, 0x0, 0x0, 0x0,
126 0x0, 0x0, 0x0, 0x0,
127
128 0x20931022, 0x2a00041, 0x4010001, 0x0,
129 0x1481, 0x0, 0x0, 0x0, /* I/O BAR-128 */
130 0x0, 0x0, 0x0, 0x20931022,
131 0x0, 0x0, 0x0, 0x205, /* IntB, IRQ5 */
132 0x0, 0x0, 0x0, 0x0,
133 0x0, 0x0, 0x0, 0x0,
134 0x0, 0x0, 0x0, 0x0,
135};
136
137static const uint32_t ohci_hdr[] = { /* dev f function 4 - devfn = 7c */
138 0xfffff000, 0x0, 0x0, 0x0,
139 0x0, 0x0, 0x0, 0x0,
140
141 0x20941022, 0x2300006, 0xc031002, 0x0,
142 0xfe01a000, 0x0, 0x0, 0x0, /* MEMBAR-1000 */
143 0x0, 0x0, 0x0, 0x20941022,
144 0x0, 0x40, 0x0, 0x40a, /* CapPtr INT-D, IRQA */
145 0xc8020001, 0x0, 0x0, 0x0, /* Capabilities - 40 is R/O,
146 44 is mask 8103 (power control) */
147 0x0, 0x0, 0x0, 0x0,
148 0x0, 0x0, 0x0, 0x0,
149};
150
151static const uint32_t ehci_hdr[] = { /* dev f function 4 - devfn = 7d */
152 0xfffff000, 0x0, 0x0, 0x0,
153 0x0, 0x0, 0x0, 0x0,
154
155 0x20951022, 0x2300006, 0xc032002, 0x0,
156 0xfe01b000, 0x0, 0x0, 0x0, /* MEMBAR-1000 */
157 0x0, 0x0, 0x0, 0x20951022,
158 0x0, 0x40, 0x0, 0x40a, /* CapPtr INT-D, IRQA */
159 0xc8020001, 0x0, 0x0, 0x0, /* Capabilities - 40 is R/O, 44 is
160 mask 8103 (power control) */
161#if 0
162 0x1, 0x40080000, 0x0, 0x0, /* EECP - see EHCI spec section 2.1.7 */
163#endif
164 0x01000001, 0x0, 0x0, 0x0, /* EECP - see EHCI spec section 2.1.7 */
165 0x2020, 0x0, 0x0, 0x0, /* (EHCI page 8) 60 SBRN (R/O),
166 61 FLADJ (R/W), PORTWAKECAP */
167};
168
169static uint32_t ff_loc = ~0;
170static uint32_t zero_loc;
171static int bar_probing; /* Set after a write of ~0 to a BAR */
172static int is_lx;
173
174#define NB_SLOT 0x1 /* Northbridge - GX chip - Device 1 */
175#define SB_SLOT 0xf /* Southbridge - CS5536 chip - Device F */
176
177static int is_simulated(unsigned int bus, unsigned int devfn)
178{
179 return (!bus && ((PCI_SLOT(devfn) == NB_SLOT) ||
180 (PCI_SLOT(devfn) == SB_SLOT)));
181}
182
183static uint32_t *hdr_addr(const uint32_t *hdr, int reg)
184{
185 uint32_t addr;
186
187 /*
188 * This is a little bit tricky. The header maps consist of
189 * 0x20 bytes of size masks, followed by 0x70 bytes of header data.
190 * In the normal case, when not probing a BAR's size, we want
191 * to access the header data, so we add 0x20 to the reg offset,
192 * thus skipping the size mask area.
193 * In the BAR probing case, we want to access the size mask for
194 * the BAR, so we subtract 0x10 (the config header offset for
195 * BAR0), and don't skip the size mask area.
196 */
197
198 addr = (uint32_t)hdr + reg + (bar_probing ? -0x10 : 0x20);
199
200 bar_probing = 0;
201 return (uint32_t *)addr;
202}
203
204static int pci_olpc_read(unsigned int seg, unsigned int bus,
205 unsigned int devfn, int reg, int len, uint32_t *value)
206{
207 uint32_t *addr;
208
209 /* Use the hardware mechanism for non-simulated devices */
210 if (!is_simulated(bus, devfn))
211 return pci_direct_conf1.read(seg, bus, devfn, reg, len, value);
212
213 /*
214 * No device has config registers past 0x70, so we save table space
215 * by not storing entries for the nonexistent registers
216 */
217 if (reg >= 0x70)
218 addr = &zero_loc;
219 else {
220 switch (devfn) {
221 case 0x8:
222 addr = hdr_addr(is_lx ? lxnb_hdr : gxnb_hdr, reg);
223 break;
224 case 0x9:
225 addr = hdr_addr(is_lx ? lxfb_hdr : gxfb_hdr, reg);
226 break;
227 case 0xa:
228 addr = is_lx ? hdr_addr(aes_hdr, reg) : &ff_loc;
229 break;
230 case 0x78:
231 addr = hdr_addr(isa_hdr, reg);
232 break;
233 case 0x7b:
234 addr = hdr_addr(ac97_hdr, reg);
235 break;
236 case 0x7c:
237 addr = hdr_addr(ohci_hdr, reg);
238 break;
239 case 0x7d:
240 addr = hdr_addr(ehci_hdr, reg);
241 break;
242 default:
243 addr = &ff_loc;
244 break;
245 }
246 }
247 switch (len) {
248 case 1:
249 *value = *(uint8_t *)addr;
250 break;
251 case 2:
252 *value = *(uint16_t *)addr;
253 break;
254 case 4:
255 *value = *addr;
256 break;
257 default:
258 BUG();
259 }
260
261 return 0;
262}
263
264static int pci_olpc_write(unsigned int seg, unsigned int bus,
265 unsigned int devfn, int reg, int len, uint32_t value)
266{
267 /* Use the hardware mechanism for non-simulated devices */
268 if (!is_simulated(bus, devfn))
269 return pci_direct_conf1.write(seg, bus, devfn, reg, len, value);
270
271 /* XXX we may want to extend this to simulate EHCI power management */
272
273 /*
274 * Mostly we just discard writes, but if the write is a size probe
275 * (i.e. writing ~0 to a BAR), we remember it and arrange to return
276 * the appropriate size mask on the next read. This is cheating
277 * to some extent, because it depends on the fact that the next
278 * access after such a write will always be a read to the same BAR.
279 */
280
281 if ((reg >= 0x10) && (reg < 0x2c)) {
282 /* write is to a BAR */
283 if (value == ~0)
284 bar_probing = 1;
285 } else {
286 /*
287 * No warning on writes to ROM BAR, CMD, LATENCY_TIMER,
288 * CACHE_LINE_SIZE, or PM registers.
289 */
290 if ((reg != PCI_ROM_ADDRESS) && (reg != PCI_COMMAND_MASTER) &&
291 (reg != PCI_LATENCY_TIMER) &&
292 (reg != PCI_CACHE_LINE_SIZE) && (reg != 0x44))
293 printk(KERN_WARNING "OLPC PCI: Config write to devfn"
294 " %x reg %x value %x\n", devfn, reg, value);
295 }
296
297 return 0;
298}
299
300static struct pci_raw_ops pci_olpc_conf = {
301 .read = pci_olpc_read,
302 .write = pci_olpc_write,
303};
304
305void __init pci_olpc_init(void)
306{
307 if (!machine_is_olpc() || olpc_has_vsa())
308 return;
309
310 printk(KERN_INFO "PCI: Using configuration type OLPC\n");
311 raw_pci_ops = &pci_olpc_conf;
312 is_lx = is_geode_lx();
313}
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index c4bddaeff619..c58805a92db5 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -26,6 +26,7 @@
26#define PCI_ASSIGN_ALL_BUSSES 0x4000 26#define PCI_ASSIGN_ALL_BUSSES 0x4000
27#define PCI_CAN_SKIP_ISA_ALIGN 0x8000 27#define PCI_CAN_SKIP_ISA_ALIGN 0x8000
28#define PCI_USE__CRS 0x10000 28#define PCI_USE__CRS 0x10000
29#define PCI_CHECK_ENABLE_AMD_MMCONF 0x20000
29 30
30extern unsigned int pci_probe; 31extern unsigned int pci_probe;
31extern unsigned long pirq_table_addr; 32extern unsigned long pirq_table_addr;
@@ -97,11 +98,12 @@ extern struct pci_raw_ops pci_direct_conf1;
97extern int pci_direct_probe(void); 98extern int pci_direct_probe(void);
98extern void pci_direct_init(int type); 99extern void pci_direct_init(int type);
99extern void pci_pcbios_init(void); 100extern void pci_pcbios_init(void);
100extern void pci_mmcfg_init(int type); 101extern void pci_olpc_init(void);
101 102
102/* pci-mmconfig.c */ 103/* pci-mmconfig.c */
103 104
104extern int __init pci_mmcfg_arch_init(void); 105extern int __init pci_mmcfg_arch_init(void);
106extern void __init pci_mmcfg_arch_free(void);
105 107
106/* 108/*
107 * AMD Fam10h CPUs are buggy, and cannot access MMIO config space 109 * AMD Fam10h CPUs are buggy, and cannot access MMIO config space
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index e2af8eee80e3..cf058fecfcee 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -162,7 +162,7 @@ static __init void relocate_vdso(Elf32_Ehdr *ehdr)
162 Elf32_Shdr *shdr; 162 Elf32_Shdr *shdr;
163 int i; 163 int i;
164 164
165 BUG_ON(memcmp(ehdr->e_ident, ELFMAG, 4) != 0 || 165 BUG_ON(memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0 ||
166 !elf_check_arch_ia32(ehdr) || 166 !elf_check_arch_ia32(ehdr) ||
167 ehdr->e_type != ET_DYN); 167 ehdr->e_type != ET_DYN);
168 168
@@ -303,8 +303,6 @@ int __init sysenter_setup(void)
303 303
304#ifdef CONFIG_X86_32 304#ifdef CONFIG_X86_32
305 gate_vma_init(); 305 gate_vma_init();
306
307 printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO));
308#endif 306#endif
309 307
310 if (!vdso32_sysenter()) { 308 if (!vdso32_sysenter()) {
diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c
index 4db42bff8c60..69527688f794 100644
--- a/arch/x86/video/fbdev.c
+++ b/arch/x86/video/fbdev.c
@@ -1,5 +1,4 @@
1/* 1/*
2 *
3 * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com> 2 * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
4 * 3 *
5 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
@@ -29,3 +28,4 @@ int fb_is_primary_device(struct fb_info *info)
29 return retval; 28 return retval;
30} 29}
31EXPORT_SYMBOL(fb_is_primary_device); 30EXPORT_SYMBOL(fb_is_primary_device);
31MODULE_LICENSE("GPL");
diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c
index ef63adadf7f4..070ff8af3a21 100644
--- a/arch/xtensa/kernel/asm-offsets.c
+++ b/arch/xtensa/kernel/asm-offsets.c
@@ -19,12 +19,11 @@
19#include <linux/thread_info.h> 19#include <linux/thread_info.h>
20#include <linux/ptrace.h> 20#include <linux/ptrace.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/kbuild.h>
22 23
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25 26
26#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val))
27
28int main(void) 27int main(void)
29{ 28{
30 /* struct pt_regs */ 29 /* struct pt_regs */