aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/osf_sys.c6
-rw-r--r--arch/arm/boot/Makefile10
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi4
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c12
-rw-r--r--arch/arm/mach-davinci/dm644x.c3
-rw-r--r--arch/arm/mach-exynos/dma.c3
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h1
-rw-r--r--arch/arm/mach-highbank/system.c3
-rw-r--r--arch/arm/mach-imx/clk-gate2.c2
-rw-r--r--arch/arm/mach-imx/ehci-imx25.c2
-rw-r--r--arch/arm/mach-imx/ehci-imx35.c2
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c5
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c34
-rw-r--r--arch/arm/mach-omap2/devices.c79
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c63
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c36
-rw-r--r--arch/arm/mach-omap2/twl-common.c3
-rw-r--r--arch/arm/mach-omap2/vc.c2
-rw-r--r--arch/arm/mach-pxa/hx4700.c8
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c8
-rw-r--r--arch/arm/plat-omap/i2c.c21
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h6
-rw-r--r--arch/arm/tools/Makefile2
-rw-r--r--arch/arm/xen/enlighten.c11
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/include/asm/elf.h5
-rw-r--r--arch/arm64/include/asm/fpsimd.h5
-rw-r--r--arch/arm64/include/asm/io.h10
-rw-r--r--arch/arm64/include/asm/pgtable-hwdef.h6
-rw-r--r--arch/arm64/include/asm/pgtable.h40
-rw-r--r--arch/arm64/include/asm/processor.h2
-rw-r--r--arch/arm64/include/asm/unistd.h1
-rw-r--r--arch/arm64/kernel/perf_event.c10
-rw-r--r--arch/arm64/kernel/process.c18
-rw-r--r--arch/arm64/kernel/smp.c3
-rw-r--r--arch/arm64/mm/init.c2
-rw-r--r--arch/h8300/include/asm/cache.h3
-rw-r--r--arch/ia64/mm/init.c1
-rw-r--r--arch/m68k/include/asm/signal.h6
-rw-r--r--arch/mips/Kconfig130
-rw-r--r--arch/mips/Makefile12
-rw-r--r--arch/mips/ar7/platform.c3
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-bootmem.c5
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-l2c.c1
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c1
-rw-r--r--arch/mips/cavium-octeon/octeon-memcpy.S27
-rw-r--r--arch/mips/cavium-octeon/octeon-platform.c102
-rw-r--r--arch/mips/cavium-octeon/setup.c374
-rw-r--r--arch/mips/configs/cavium_octeon_defconfig98
-rw-r--r--arch/mips/configs/yosemite_defconfig94
-rw-r--r--arch/mips/fw/arc/misc.c1
-rw-r--r--arch/mips/fw/sni/Makefile2
-rw-r--r--arch/mips/include/asm/bitops.h128
-rw-r--r--arch/mips/include/asm/compat.h2
-rw-r--r--arch/mips/include/asm/cpu.h6
-rw-r--r--arch/mips/include/asm/fw/arc/types.h8
-rw-r--r--arch/mips/include/asm/hazards.h25
-rw-r--r--arch/mips/include/asm/io.h1
-rw-r--r--arch/mips/include/asm/irqflags.h207
-rw-r--r--arch/mips/include/asm/kexec.h27
-rw-r--r--arch/mips/include/asm/mach-ar7/war.h1
-rw-r--r--arch/mips/include/asm/mach-ath79/war.h1
-rw-r--r--arch/mips/include/asm/mach-au1x00/war.h1
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/war.h1
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/war.h1
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/irq.h1
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/war.h1
-rw-r--r--arch/mips/include/asm/mach-cobalt/war.h1
-rw-r--r--arch/mips/include/asm/mach-dec/war.h1
-rw-r--r--arch/mips/include/asm/mach-emma2rh/war.h1
-rw-r--r--arch/mips/include/asm/mach-generic/irq.h6
-rw-r--r--arch/mips/include/asm/mach-ip22/war.h1
-rw-r--r--arch/mips/include/asm/mach-ip27/war.h1
-rw-r--r--arch/mips/include/asm/mach-ip28/war.h1
-rw-r--r--arch/mips/include/asm/mach-ip32/war.h1
-rw-r--r--arch/mips/include/asm/mach-jazz/war.h1
-rw-r--r--arch/mips/include/asm/mach-jz4740/war.h1
-rw-r--r--arch/mips/include/asm/mach-lantiq/war.h1
-rw-r--r--arch/mips/include/asm/mach-lasat/war.h1
-rw-r--r--arch/mips/include/asm/mach-loongson/war.h1
-rw-r--r--arch/mips/include/asm/mach-loongson1/war.h1
-rw-r--r--arch/mips/include/asm/mach-malta/war.h1
-rw-r--r--arch/mips/include/asm/mach-netlogic/war.h1
-rw-r--r--arch/mips/include/asm/mach-pnx833x/war.h1
-rw-r--r--arch/mips/include/asm/mach-pnx8550/war.h1
-rw-r--r--arch/mips/include/asm/mach-powertv/war.h1
-rw-r--r--arch/mips/include/asm/mach-rc32434/war.h1
-rw-r--r--arch/mips/include/asm/mach-rm/war.h1
-rw-r--r--arch/mips/include/asm/mach-sead3/war.h1
-rw-r--r--arch/mips/include/asm/mach-sibyte/war.h1
-rw-r--r--arch/mips/include/asm/mach-tx39xx/war.h1
-rw-r--r--arch/mips/include/asm/mach-tx49xx/war.h1
-rw-r--r--arch/mips/include/asm/mach-vr41xx/war.h1
-rw-r--r--arch/mips/include/asm/mach-wrppmc/war.h1
-rw-r--r--arch/mips/include/asm/mach-yosemite/cpu-feature-overrides.h48
-rw-r--r--arch/mips/include/asm/mach-yosemite/war.h25
-rw-r--r--arch/mips/include/asm/mipsregs.h10
-rw-r--r--arch/mips/include/asm/mmu_context.h6
-rw-r--r--arch/mips/include/asm/module.h2
-rw-r--r--arch/mips/include/asm/octeon/cvmx-bootmem.h2
-rw-r--r--arch/mips/include/asm/octeon/cvmx-lmcx-defs.h3457
-rw-r--r--arch/mips/include/asm/octeon/octeon-model.h6
-rw-r--r--arch/mips/include/asm/octeon/octeon.h7
-rw-r--r--arch/mips/include/asm/page.h8
-rw-r--r--arch/mips/include/asm/pgtable-64.h2
-rw-r--r--arch/mips/include/asm/pgtable-bits.h131
-rw-r--r--arch/mips/include/asm/pgtable.h168
-rw-r--r--arch/mips/include/asm/pmc-sierra/msp71xx/war.h1
-rw-r--r--arch/mips/include/asm/processor.h4
-rw-r--r--arch/mips/include/asm/sgiarcs.h8
-rw-r--r--arch/mips/include/asm/smp.h6
-rw-r--r--arch/mips/include/asm/smvp.h19
-rw-r--r--arch/mips/include/asm/sparsemem.h2
-rw-r--r--arch/mips/include/asm/thread_info.h6
-rw-r--r--arch/mips/include/asm/time.h4
-rw-r--r--arch/mips/include/asm/titan_dep.h231
-rw-r--r--arch/mips/include/asm/war.h8
-rw-r--r--arch/mips/kernel/Makefile8
-rw-r--r--arch/mips/kernel/asm-offsets.c4
-rw-r--r--arch/mips/kernel/crash.c71
-rw-r--r--arch/mips/kernel/crash_dump.c75
-rw-r--r--arch/mips/kernel/irq-rm9000.c106
-rw-r--r--arch/mips/kernel/machine_kexec.c33
-rw-r--r--arch/mips/kernel/mips-mt-fpaff.c4
-rw-r--r--arch/mips/kernel/mips_ksyms.c2
-rw-r--r--arch/mips/kernel/process.c4
-rw-r--r--arch/mips/kernel/relocate_kernel.S107
-rw-r--r--arch/mips/kernel/scall64-n32.S6
-rw-r--r--arch/mips/kernel/setup.c82
-rw-r--r--arch/mips/kernel/signal.c13
-rw-r--r--arch/mips/kernel/smp.c17
-rw-r--r--arch/mips/kernel/traps.c25
-rw-r--r--arch/mips/lantiq/xway/dma.c6
-rw-r--r--arch/mips/lib/Makefile5
-rw-r--r--arch/mips/lib/bitops.c179
-rw-r--r--arch/mips/lib/mips-atomic.c176
-rw-r--r--arch/mips/math-emu/cp1emu.c15
-rw-r--r--arch/mips/mm/c-octeon.c67
-rw-r--r--arch/mips/mm/c-r4k.c15
-rw-r--r--arch/mips/mm/highmem.c3
-rw-r--r--arch/mips/mm/page.c9
-rw-r--r--arch/mips/mm/pgtable-64.c31
-rw-r--r--arch/mips/mm/tlb-r4k.c22
-rw-r--r--arch/mips/mm/tlbex.c115
-rw-r--r--arch/mips/mti-malta/malta-platform.c3
-rw-r--r--arch/mips/oprofile/Makefile1
-rw-r--r--arch/mips/oprofile/common.c4
-rw-r--r--arch/mips/oprofile/op_model_rm9000.c138
-rw-r--r--arch/mips/pci/Makefile2
-rw-r--r--arch/mips/pci/fixup-yosemite.c41
-rw-r--r--arch/mips/pci/ops-bridge.c24
-rw-r--r--arch/mips/pci/ops-titan-ht.c124
-rw-r--r--arch/mips/pci/ops-titan.c111
-rw-r--r--arch/mips/pci/pci-octeon.c5
-rw-r--r--arch/mips/pci/pci-yosemite.c67
-rw-r--r--arch/mips/pmc-sierra/Kconfig4
-rw-r--r--arch/mips/pmc-sierra/Platform7
-rw-r--r--arch/mips/pmc-sierra/yosemite/Makefile7
-rw-r--r--arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c169
-rw-r--r--arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h67
-rw-r--r--arch/mips/pmc-sierra/yosemite/ht-irq.c41
-rw-r--r--arch/mips/pmc-sierra/yosemite/ht.c404
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq.c152
-rw-r--r--arch/mips/pmc-sierra/yosemite/prom.c142
-rw-r--r--arch/mips/pmc-sierra/yosemite/py-console.c109
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c224
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.h32
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c185
-rw-r--r--arch/mips/powertv/init.c37
-rw-r--r--arch/mips/rb532/prom.c3
-rw-r--r--arch/mips/sgi-ip22/ip22-eisa.c8
-rw-r--r--arch/mips/sibyte/Kconfig2
-rw-r--r--arch/mips/sni/setup.c8
-rw-r--r--arch/mips/wrppmc/pci.c6
-rw-r--r--arch/parisc/kernel/signal32.c6
-rw-r--r--arch/parisc/kernel/sys_parisc.c2
-rw-r--r--arch/powerpc/boot/dts/mpc5200b.dtsi6
-rw-r--r--arch/powerpc/boot/dts/o2d.dtsi6
-rw-r--r--arch/powerpc/boot/dts/pcm030.dts7
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c9
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pe.c2
-rw-r--r--arch/powerpc/platforms/pseries/msi.c3
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/include/asm/cio.h2
-rw-r--r--arch/s390/include/asm/compat.h2
-rw-r--r--arch/s390/include/asm/pgtable.h35
-rw-r--r--arch/s390/include/asm/topology.h3
-rw-r--r--arch/s390/include/uapi/asm/ptrace.h4
-rw-r--r--arch/s390/kernel/compat_signal.c14
-rw-r--r--arch/s390/kernel/sclp.S8
-rw-r--r--arch/s390/kernel/signal.c14
-rw-r--r--arch/s390/kernel/topology.c6
-rw-r--r--arch/s390/lib/uaccess_pt.c2
-rw-r--r--arch/s390/mm/gup.c7
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/crypto/Makefile16
-rw-r--r--arch/sparc/crypto/aes_glue.c2
-rw-r--r--arch/sparc/crypto/camellia_glue.c2
-rw-r--r--arch/sparc/crypto/crc32c_glue.c2
-rw-r--r--arch/sparc/crypto/des_glue.c2
-rw-r--r--arch/sparc/crypto/md5_glue.c2
-rw-r--r--arch/sparc/crypto/sha1_glue.c2
-rw-r--r--arch/sparc/crypto/sha256_glue.c2
-rw-r--r--arch/sparc/crypto/sha512_glue.c2
-rw-r--r--arch/sparc/include/asm/atomic_64.h4
-rw-r--r--arch/sparc/include/asm/backoff.h69
-rw-r--r--arch/sparc/include/asm/compat.h5
-rw-r--r--arch/sparc/include/asm/processor_64.h17
-rw-r--r--arch/sparc/include/asm/prom.h8
-rw-r--r--arch/sparc/include/asm/thread_info_64.h5
-rw-r--r--arch/sparc/include/asm/ttable.h24
-rw-r--r--arch/sparc/include/uapi/asm/unistd.h7
-rw-r--r--arch/sparc/kernel/entry.h7
-rw-r--r--arch/sparc/kernel/leon_kernel.c6
-rw-r--r--arch/sparc/kernel/perf_event.c22
-rw-r--r--arch/sparc/kernel/process_64.c42
-rw-r--r--arch/sparc/kernel/ptrace_64.c4
-rw-r--r--arch/sparc/kernel/setup_64.c21
-rw-r--r--arch/sparc/kernel/signal_64.c4
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c5
-rw-r--r--arch/sparc/kernel/systbls_32.S1
-rw-r--r--arch/sparc/kernel/systbls_64.S2
-rw-r--r--arch/sparc/kernel/unaligned_64.c36
-rw-r--r--arch/sparc/kernel/visemul.c23
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S5
-rw-r--r--arch/sparc/kernel/winfixup.S2
-rw-r--r--arch/sparc/lib/atomic_64.S16
-rw-r--r--arch/sparc/lib/ksyms.c1
-rw-r--r--arch/sparc/math-emu/math_64.c2
-rw-r--r--arch/unicore32/Kconfig7
-rw-r--r--arch/unicore32/include/asm/Kbuild1
-rw-r--r--arch/unicore32/include/asm/bug.h5
-rw-r--r--arch/unicore32/include/asm/cmpxchg.h2
-rw-r--r--arch/unicore32/include/asm/kvm_para.h1
-rw-r--r--arch/unicore32/include/asm/processor.h5
-rw-r--r--arch/unicore32/include/asm/ptrace.h76
-rw-r--r--arch/unicore32/include/uapi/asm/Kbuild7
-rw-r--r--arch/unicore32/include/uapi/asm/byteorder.h (renamed from arch/unicore32/include/asm/byteorder.h)0
-rw-r--r--arch/unicore32/include/uapi/asm/ptrace.h90
-rw-r--r--arch/unicore32/include/uapi/asm/sigcontext.h (renamed from arch/unicore32/include/asm/sigcontext.h)0
-rw-r--r--arch/unicore32/include/uapi/asm/unistd.h (renamed from arch/unicore32/include/asm/unistd.h)1
-rw-r--r--arch/unicore32/kernel/entry.S20
-rw-r--r--arch/unicore32/kernel/process.c58
-rw-r--r--arch/unicore32/kernel/setup.h6
-rw-r--r--arch/unicore32/kernel/sys.c63
-rw-r--r--arch/unicore32/mm/fault.c37
-rw-r--r--arch/x86/boot/compressed/eboot.c2
-rw-r--r--arch/x86/boot/header.S3
-rw-r--r--arch/x86/include/asm/ptrace.h15
-rw-r--r--arch/x86/include/asm/xen/hypercall.h21
-rw-r--r--arch/x86/kernel/cpu/amd.c14
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel.c31
-rw-r--r--arch/x86/kernel/entry_64.S14
-rw-r--r--arch/x86/kernel/microcode_amd.c8
-rw-r--r--arch/x86/kernel/ptrace.c30
-rw-r--r--arch/x86/kvm/cpuid.h3
-rw-r--r--arch/x86/kvm/vmx.c11
-rw-r--r--arch/x86/kvm/x86.c3
-rw-r--r--arch/x86/mm/tlb.c2
-rw-r--r--arch/x86/pci/ce4100.c13
-rw-r--r--arch/x86/platform/ce4100/ce4100.c24
267 files changed, 6364 insertions, 3951 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 1e6956a90608..14db93e4c8a8 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -445,7 +445,7 @@ struct procfs_args {
445 * unhappy with OSF UFS. [CHECKME] 445 * unhappy with OSF UFS. [CHECKME]
446 */ 446 */
447static int 447static int
448osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags) 448osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags)
449{ 449{
450 int retval; 450 int retval;
451 struct cdfs_args tmp; 451 struct cdfs_args tmp;
@@ -465,7 +465,7 @@ osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags)
465} 465}
466 466
467static int 467static int
468osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags) 468osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags)
469{ 469{
470 int retval; 470 int retval;
471 struct cdfs_args tmp; 471 struct cdfs_args tmp;
@@ -485,7 +485,7 @@ osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags)
485} 485}
486 486
487static int 487static int
488osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags) 488osf_procfs_mount(const char *dirname, struct procfs_args __user *args, int flags)
489{ 489{
490 struct procfs_args tmp; 490 struct procfs_args tmp;
491 491
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index f2aa09eb658e..9137df539b61 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -33,7 +33,7 @@ ifeq ($(CONFIG_XIP_KERNEL),y)
33 33
34$(obj)/xipImage: vmlinux FORCE 34$(obj)/xipImage: vmlinux FORCE
35 $(call if_changed,objcopy) 35 $(call if_changed,objcopy)
36 $(kecho) ' Kernel: $@ is ready (physical address: $(CONFIG_XIP_PHYS_ADDR))' 36 @$(kecho) ' Kernel: $@ is ready (physical address: $(CONFIG_XIP_PHYS_ADDR))'
37 37
38$(obj)/Image $(obj)/zImage: FORCE 38$(obj)/Image $(obj)/zImage: FORCE
39 @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)' 39 @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)'
@@ -48,14 +48,14 @@ $(obj)/xipImage: FORCE
48 48
49$(obj)/Image: vmlinux FORCE 49$(obj)/Image: vmlinux FORCE
50 $(call if_changed,objcopy) 50 $(call if_changed,objcopy)
51 $(kecho) ' Kernel: $@ is ready' 51 @$(kecho) ' Kernel: $@ is ready'
52 52
53$(obj)/compressed/vmlinux: $(obj)/Image FORCE 53$(obj)/compressed/vmlinux: $(obj)/Image FORCE
54 $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 54 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
55 55
56$(obj)/zImage: $(obj)/compressed/vmlinux FORCE 56$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
57 $(call if_changed,objcopy) 57 $(call if_changed,objcopy)
58 $(kecho) ' Kernel: $@ is ready' 58 @$(kecho) ' Kernel: $@ is ready'
59 59
60endif 60endif
61 61
@@ -90,7 +90,7 @@ fi
90$(obj)/uImage: $(obj)/zImage FORCE 90$(obj)/uImage: $(obj)/zImage FORCE
91 @$(check_for_multiple_loadaddr) 91 @$(check_for_multiple_loadaddr)
92 $(call if_changed,uimage) 92 $(call if_changed,uimage)
93 $(kecho) ' Image $@ is ready' 93 @$(kecho) ' Image $@ is ready'
94 94
95$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE 95$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
96 $(Q)$(MAKE) $(build)=$(obj)/bootp $@ 96 $(Q)$(MAKE) $(build)=$(obj)/bootp $@
@@ -98,7 +98,7 @@ $(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
98 98
99$(obj)/bootpImage: $(obj)/bootp/bootp FORCE 99$(obj)/bootpImage: $(obj)/bootp/bootp FORCE
100 $(call if_changed,objcopy) 100 $(call if_changed,objcopy)
101 $(kecho) ' Kernel: $@ is ready' 101 @$(kecho) ' Kernel: $@ is ready'
102 102
103PHONY += initrd FORCE 103PHONY += initrd FORCE
104initrd: 104initrd:
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index b1497c7d7d68..df7f2270fc91 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -73,8 +73,8 @@
73 73
74 pinmux: pinmux { 74 pinmux: pinmux {
75 compatible = "nvidia,tegra30-pinmux"; 75 compatible = "nvidia,tegra30-pinmux";
76 reg = <0x70000868 0xd0 /* Pad control registers */ 76 reg = <0x70000868 0xd4 /* Pad control registers */
77 0x70003000 0x3e0>; /* Mux registers */ 77 0x70003000 0x3e4>; /* Mux registers */
78 }; 78 };
79 79
80 serial@70006000 { 80 serial@70006000 {
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 1e122bcd7845..3cee0e6ea7c3 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -68,7 +68,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
68 68
69 /* Enable overcurrent notification */ 69 /* Enable overcurrent notification */
70 for (i = 0; i < data->ports; i++) { 70 for (i = 0; i < data->ports; i++) {
71 if (data->overcurrent_pin[i]) 71 if (gpio_is_valid(data->overcurrent_pin[i]))
72 at91_set_gpio_input(data->overcurrent_pin[i], 1); 72 at91_set_gpio_input(data->overcurrent_pin[i], 1);
73 } 73 }
74 74
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index aa1e58729885..414bd855fb0c 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -72,7 +72,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
72 72
73 /* Enable overcurrent notification */ 73 /* Enable overcurrent notification */
74 for (i = 0; i < data->ports; i++) { 74 for (i = 0; i < data->ports; i++) {
75 if (data->overcurrent_pin[i]) 75 if (gpio_is_valid(data->overcurrent_pin[i]))
76 at91_set_gpio_input(data->overcurrent_pin[i], 1); 76 at91_set_gpio_input(data->overcurrent_pin[i], 1);
77 } 77 }
78 78
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index b9487696b7be..cd604aad8e96 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -72,7 +72,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
72 72
73 /* Enable overcurrent notification */ 73 /* Enable overcurrent notification */
74 for (i = 0; i < data->ports; i++) { 74 for (i = 0; i < data->ports; i++) {
75 if (data->overcurrent_pin[i]) 75 if (gpio_is_valid(data->overcurrent_pin[i]))
76 at91_set_gpio_input(data->overcurrent_pin[i], 1); 76 at91_set_gpio_input(data->overcurrent_pin[i], 1);
77 } 77 }
78 78
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index cb85da2eccea..9c61e59a2104 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -78,7 +78,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
78 78
79 /* Enable overcurrent notification */ 79 /* Enable overcurrent notification */
80 for (i = 0; i < data->ports; i++) { 80 for (i = 0; i < data->ports; i++) {
81 if (data->overcurrent_pin[i]) 81 if (gpio_is_valid(data->overcurrent_pin[i]))
82 at91_set_gpio_input(data->overcurrent_pin[i], 1); 82 at91_set_gpio_input(data->overcurrent_pin[i], 1);
83 } 83 }
84 84
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index b1596072dcc2..fcd233cb33d2 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1841,8 +1841,8 @@ static struct resource sha_resources[] = {
1841 .flags = IORESOURCE_MEM, 1841 .flags = IORESOURCE_MEM,
1842 }, 1842 },
1843 [1] = { 1843 [1] = {
1844 .start = AT91SAM9G45_ID_AESTDESSHA, 1844 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1845 .end = AT91SAM9G45_ID_AESTDESSHA, 1845 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1846 .flags = IORESOURCE_IRQ, 1846 .flags = IORESOURCE_IRQ,
1847 }, 1847 },
1848}; 1848};
@@ -1874,8 +1874,8 @@ static struct resource tdes_resources[] = {
1874 .flags = IORESOURCE_MEM, 1874 .flags = IORESOURCE_MEM,
1875 }, 1875 },
1876 [1] = { 1876 [1] = {
1877 .start = AT91SAM9G45_ID_AESTDESSHA, 1877 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1878 .end = AT91SAM9G45_ID_AESTDESSHA, 1878 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1879 .flags = IORESOURCE_IRQ, 1879 .flags = IORESOURCE_IRQ,
1880 }, 1880 },
1881}; 1881};
@@ -1910,8 +1910,8 @@ static struct resource aes_resources[] = {
1910 .flags = IORESOURCE_MEM, 1910 .flags = IORESOURCE_MEM,
1911 }, 1911 },
1912 [1] = { 1912 [1] = {
1913 .start = AT91SAM9G45_ID_AESTDESSHA, 1913 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1914 .end = AT91SAM9G45_ID_AESTDESSHA, 1914 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1915 .flags = IORESOURCE_IRQ, 1915 .flags = IORESOURCE_IRQ,
1916 }, 1916 },
1917}; 1917};
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index cd0c8b1e1ecf..14e9947bad6e 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -713,8 +713,7 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
713 break; 713 break;
714 case VPBE_ENC_CUSTOM_TIMINGS: 714 case VPBE_ENC_CUSTOM_TIMINGS:
715 if (pclock <= 27000000) { 715 if (pclock <= 27000000) {
716 v |= DM644X_VPSS_MUXSEL_PLL2_MODE | 716 v |= DM644X_VPSS_DACCLKEN;
717 DM644X_VPSS_DACCLKEN;
718 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); 717 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
719 } else { 718 } else {
720 /* 719 /*
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c
index 21d568b3b149..87e07d6fc615 100644
--- a/arch/arm/mach-exynos/dma.c
+++ b/arch/arm/mach-exynos/dma.c
@@ -275,6 +275,9 @@ static int __init exynos_dma_init(void)
275 exynos_pdma1_pdata.nr_valid_peri = 275 exynos_pdma1_pdata.nr_valid_peri =
276 ARRAY_SIZE(exynos4210_pdma1_peri); 276 ARRAY_SIZE(exynos4210_pdma1_peri);
277 exynos_pdma1_pdata.peri_id = exynos4210_pdma1_peri; 277 exynos_pdma1_pdata.peri_id = exynos4210_pdma1_peri;
278
279 if (samsung_rev() == EXYNOS4210_REV_0)
280 exynos_mdma1_device.res.start = EXYNOS4_PA_S_MDMA1;
278 } else if (soc_is_exynos4212() || soc_is_exynos4412()) { 281 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
279 exynos_pdma0_pdata.nr_valid_peri = 282 exynos_pdma0_pdata.nr_valid_peri =
280 ARRAY_SIZE(exynos4212_pdma0_peri); 283 ARRAY_SIZE(exynos4212_pdma0_peri);
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 8480849affb9..ed4da4544cd2 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -90,6 +90,7 @@
90 90
91#define EXYNOS4_PA_MDMA0 0x10810000 91#define EXYNOS4_PA_MDMA0 0x10810000
92#define EXYNOS4_PA_MDMA1 0x12850000 92#define EXYNOS4_PA_MDMA1 0x12850000
93#define EXYNOS4_PA_S_MDMA1 0x12840000
93#define EXYNOS4_PA_PDMA0 0x12680000 94#define EXYNOS4_PA_PDMA0 0x12680000
94#define EXYNOS4_PA_PDMA1 0x12690000 95#define EXYNOS4_PA_PDMA1 0x12690000
95#define EXYNOS5_PA_MDMA0 0x10800000 96#define EXYNOS5_PA_MDMA0 0x10800000
diff --git a/arch/arm/mach-highbank/system.c b/arch/arm/mach-highbank/system.c
index 82c27230d4a9..86e37cd9376c 100644
--- a/arch/arm/mach-highbank/system.c
+++ b/arch/arm/mach-highbank/system.c
@@ -28,6 +28,7 @@ void highbank_restart(char mode, const char *cmd)
28 hignbank_set_pwr_soft_reset(); 28 hignbank_set_pwr_soft_reset();
29 29
30 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF); 30 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
31 cpu_do_idle(); 31 while (1)
32 cpu_do_idle();
32} 33}
33 34
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index 3c1b8ff9a0a6..cc49c7ae186e 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -112,7 +112,7 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
112 112
113 clk = clk_register(dev, &gate->hw); 113 clk = clk_register(dev, &gate->hw);
114 if (IS_ERR(clk)) 114 if (IS_ERR(clk))
115 kfree(clk); 115 kfree(gate);
116 116
117 return clk; 117 return clk;
118} 118}
diff --git a/arch/arm/mach-imx/ehci-imx25.c b/arch/arm/mach-imx/ehci-imx25.c
index 412c583a24b0..576af7446952 100644
--- a/arch/arm/mach-imx/ehci-imx25.c
+++ b/arch/arm/mach-imx/ehci-imx25.c
@@ -30,7 +30,7 @@
30#define MX25_H1_SIC_SHIFT 21 30#define MX25_H1_SIC_SHIFT 21
31#define MX25_H1_SIC_MASK (0x3 << MX25_H1_SIC_SHIFT) 31#define MX25_H1_SIC_MASK (0x3 << MX25_H1_SIC_SHIFT)
32#define MX25_H1_PP_BIT (1 << 18) 32#define MX25_H1_PP_BIT (1 << 18)
33#define MX25_H1_PM_BIT (1 << 8) 33#define MX25_H1_PM_BIT (1 << 16)
34#define MX25_H1_IPPUE_UP_BIT (1 << 7) 34#define MX25_H1_IPPUE_UP_BIT (1 << 7)
35#define MX25_H1_IPPUE_DOWN_BIT (1 << 6) 35#define MX25_H1_IPPUE_DOWN_BIT (1 << 6)
36#define MX25_H1_TLL_BIT (1 << 5) 36#define MX25_H1_TLL_BIT (1 << 5)
diff --git a/arch/arm/mach-imx/ehci-imx35.c b/arch/arm/mach-imx/ehci-imx35.c
index 779e16eb65cb..293397852e4e 100644
--- a/arch/arm/mach-imx/ehci-imx35.c
+++ b/arch/arm/mach-imx/ehci-imx35.c
@@ -30,7 +30,7 @@
30#define MX35_H1_SIC_SHIFT 21 30#define MX35_H1_SIC_SHIFT 21
31#define MX35_H1_SIC_MASK (0x3 << MX35_H1_SIC_SHIFT) 31#define MX35_H1_SIC_MASK (0x3 << MX35_H1_SIC_SHIFT)
32#define MX35_H1_PP_BIT (1 << 18) 32#define MX35_H1_PP_BIT (1 << 18)
33#define MX35_H1_PM_BIT (1 << 8) 33#define MX35_H1_PM_BIT (1 << 16)
34#define MX35_H1_IPPUE_UP_BIT (1 << 7) 34#define MX35_H1_IPPUE_UP_BIT (1 << 7)
35#define MX35_H1_IPPUE_DOWN_BIT (1 << 6) 35#define MX35_H1_IPPUE_DOWN_BIT (1 << 6)
36#define MX35_H1_TLL_BIT (1 << 5) 36#define MX35_H1_TLL_BIT (1 << 5)
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 48d5e41dfbfa..378590694447 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -580,6 +580,11 @@ static void __init igep_wlan_bt_init(void)
580 } else 580 } else
581 return; 581 return;
582 582
583 /* Make sure that the GPIO pins are muxed correctly */
584 omap_mux_init_gpio(igep_wlan_bt_gpios[0].gpio, OMAP_PIN_OUTPUT);
585 omap_mux_init_gpio(igep_wlan_bt_gpios[1].gpio, OMAP_PIN_OUTPUT);
586 omap_mux_init_gpio(igep_wlan_bt_gpios[2].gpio, OMAP_PIN_OUTPUT);
587
583 err = gpio_request_array(igep_wlan_bt_gpios, 588 err = gpio_request_array(igep_wlan_bt_gpios,
584 ARRAY_SIZE(igep_wlan_bt_gpios)); 589 ARRAY_SIZE(igep_wlan_bt_gpios));
585 if (err) { 590 if (err) {
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index b56d06b48782..95192a062d5d 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -359,7 +359,7 @@ static struct clockdomain iss_44xx_clkdm = {
359 .clkdm_offs = OMAP4430_CM2_CAM_CAM_CDOFFS, 359 .clkdm_offs = OMAP4430_CM2_CAM_CAM_CDOFFS,
360 .wkdep_srcs = iss_wkup_sleep_deps, 360 .wkdep_srcs = iss_wkup_sleep_deps,
361 .sleepdep_srcs = iss_wkup_sleep_deps, 361 .sleepdep_srcs = iss_wkup_sleep_deps,
362 .flags = CLKDM_CAN_HWSUP_SWSUP, 362 .flags = CLKDM_CAN_SWSUP,
363}; 363};
364 364
365static struct clockdomain l3_dss_44xx_clkdm = { 365static struct clockdomain l3_dss_44xx_clkdm = {
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index 48daac2581b4..84551f205e46 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -64,30 +64,36 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
64 struct spi_board_info *spi_bi = &ads7846_spi_board_info; 64 struct spi_board_info *spi_bi = &ads7846_spi_board_info;
65 int err; 65 int err;
66 66
67 err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); 67 /*
68 if (err) { 68 * If a board defines get_pendown_state() function, request the pendown
69 pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); 69 * GPIO and set the GPIO debounce time.
70 return; 70 * If a board does not define the get_pendown_state() function, then
71 } 71 * the ads7846 driver will setup the pendown GPIO itself.
72 */
73 if (board_pdata && board_pdata->get_pendown_state) {
74 err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
75 if (err) {
76 pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
77 return;
78 }
72 79
73 if (gpio_debounce) 80 if (gpio_debounce)
74 gpio_set_debounce(gpio_pendown, gpio_debounce); 81 gpio_set_debounce(gpio_pendown, gpio_debounce);
82
83 gpio_export(gpio_pendown, 0);
84 }
75 85
76 spi_bi->bus_num = bus_num; 86 spi_bi->bus_num = bus_num;
77 spi_bi->irq = gpio_to_irq(gpio_pendown); 87 spi_bi->irq = gpio_to_irq(gpio_pendown);
78 88
89 ads7846_config.gpio_pendown = gpio_pendown;
90
79 if (board_pdata) { 91 if (board_pdata) {
80 board_pdata->gpio_pendown = gpio_pendown; 92 board_pdata->gpio_pendown = gpio_pendown;
93 board_pdata->gpio_pendown_debounce = gpio_debounce;
81 spi_bi->platform_data = board_pdata; 94 spi_bi->platform_data = board_pdata;
82 if (board_pdata->get_pendown_state)
83 gpio_export(gpio_pendown, 0);
84 } else {
85 ads7846_config.gpio_pendown = gpio_pendown;
86 } 95 }
87 96
88 if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
89 gpio_free(gpio_pendown);
90
91 spi_register_board_info(&ads7846_spi_board_info, 1); 97 spi_register_board_info(&ads7846_spi_board_info, 1);
92} 98}
93#else 99#else
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index cba60e05e32e..c72b5a727720 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -19,6 +19,7 @@
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/pinctrl/machine.h> 20#include <linux/pinctrl/machine.h>
21#include <linux/platform_data/omap4-keypad.h> 21#include <linux/platform_data/omap4-keypad.h>
22#include <linux/platform_data/omap_ocp2scp.h>
22 23
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
@@ -613,6 +614,83 @@ static void omap_init_vout(void)
613static inline void omap_init_vout(void) {} 614static inline void omap_init_vout(void) {}
614#endif 615#endif
615 616
617#if defined(CONFIG_OMAP_OCP2SCP) || defined(CONFIG_OMAP_OCP2SCP_MODULE)
618static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev)
619{
620 int cnt = 0;
621
622 while (ocp2scp_dev->drv_name != NULL) {
623 cnt++;
624 ocp2scp_dev++;
625 }
626
627 return cnt;
628}
629
630static void omap_init_ocp2scp(void)
631{
632 struct omap_hwmod *oh;
633 struct platform_device *pdev;
634 int bus_id = -1, dev_cnt = 0, i;
635 struct omap_ocp2scp_dev *ocp2scp_dev;
636 const char *oh_name, *name;
637 struct omap_ocp2scp_platform_data *pdata;
638
639 if (!cpu_is_omap44xx())
640 return;
641
642 oh_name = "ocp2scp_usb_phy";
643 name = "omap-ocp2scp";
644
645 oh = omap_hwmod_lookup(oh_name);
646 if (!oh) {
647 pr_err("%s: could not find omap_hwmod for %s\n", __func__,
648 oh_name);
649 return;
650 }
651
652 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
653 if (!pdata) {
654 pr_err("%s: No memory for ocp2scp pdata\n", __func__);
655 return;
656 }
657
658 ocp2scp_dev = oh->dev_attr;
659 dev_cnt = count_ocp2scp_devices(ocp2scp_dev);
660
661 if (!dev_cnt) {
662 pr_err("%s: No devices connected to ocp2scp\n", __func__);
663 kfree(pdata);
664 return;
665 }
666
667 pdata->devices = kzalloc(sizeof(struct omap_ocp2scp_dev *)
668 * dev_cnt, GFP_KERNEL);
669 if (!pdata->devices) {
670 pr_err("%s: No memory for ocp2scp pdata devices\n", __func__);
671 kfree(pdata);
672 return;
673 }
674
675 for (i = 0; i < dev_cnt; i++, ocp2scp_dev++)
676 pdata->devices[i] = ocp2scp_dev;
677
678 pdata->dev_cnt = dev_cnt;
679
680 pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(*pdata), NULL,
681 0, false);
682 if (IS_ERR(pdev)) {
683 pr_err("Could not build omap_device for %s %s\n",
684 name, oh_name);
685 kfree(pdata->devices);
686 kfree(pdata);
687 return;
688 }
689}
690#else
691static inline void omap_init_ocp2scp(void) { }
692#endif
693
616/*-------------------------------------------------------------------------*/ 694/*-------------------------------------------------------------------------*/
617 695
618static int __init omap2_init_devices(void) 696static int __init omap2_init_devices(void)
@@ -640,6 +718,7 @@ static int __init omap2_init_devices(void)
640 omap_init_sham(); 718 omap_init_sham();
641 omap_init_aes(); 719 omap_init_aes();
642 omap_init_vout(); 720 omap_init_vout();
721 omap_init_ocp2scp();
643 722
644 return 0; 723 return 0;
645} 724}
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index b969ab1d258b..87cc6d058de2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -422,6 +422,38 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v)
422} 422}
423 423
424/** 424/**
425 * _wait_softreset_complete - wait for an OCP softreset to complete
426 * @oh: struct omap_hwmod * to wait on
427 *
428 * Wait until the IP block represented by @oh reports that its OCP
429 * softreset is complete. This can be triggered by software (see
430 * _ocp_softreset()) or by hardware upon returning from off-mode (one
431 * example is HSMMC). Waits for up to MAX_MODULE_SOFTRESET_WAIT
432 * microseconds. Returns the number of microseconds waited.
433 */
434static int _wait_softreset_complete(struct omap_hwmod *oh)
435{
436 struct omap_hwmod_class_sysconfig *sysc;
437 u32 softrst_mask;
438 int c = 0;
439
440 sysc = oh->class->sysc;
441
442 if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
443 omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
444 & SYSS_RESETDONE_MASK),
445 MAX_MODULE_SOFTRESET_WAIT, c);
446 else if (sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {
447 softrst_mask = (0x1 << sysc->sysc_fields->srst_shift);
448 omap_test_timeout(!(omap_hwmod_read(oh, sysc->sysc_offs)
449 & softrst_mask),
450 MAX_MODULE_SOFTRESET_WAIT, c);
451 }
452
453 return c;
454}
455
456/**
425 * _set_dmadisable: set OCP_SYSCONFIG.DMADISABLE bit in @v 457 * _set_dmadisable: set OCP_SYSCONFIG.DMADISABLE bit in @v
426 * @oh: struct omap_hwmod * 458 * @oh: struct omap_hwmod *
427 * 459 *
@@ -1282,6 +1314,18 @@ static void _enable_sysc(struct omap_hwmod *oh)
1282 if (!oh->class->sysc) 1314 if (!oh->class->sysc)
1283 return; 1315 return;
1284 1316
1317 /*
1318 * Wait until reset has completed, this is needed as the IP
1319 * block is reset automatically by hardware in some cases
1320 * (off-mode for example), and the drivers require the
1321 * IP to be ready when they access it
1322 */
1323 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
1324 _enable_optional_clocks(oh);
1325 _wait_softreset_complete(oh);
1326 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
1327 _disable_optional_clocks(oh);
1328
1285 v = oh->_sysc_cache; 1329 v = oh->_sysc_cache;
1286 sf = oh->class->sysc->sysc_flags; 1330 sf = oh->class->sysc->sysc_flags;
1287 1331
@@ -1804,7 +1848,7 @@ static int _am33xx_disable_module(struct omap_hwmod *oh)
1804 */ 1848 */
1805static int _ocp_softreset(struct omap_hwmod *oh) 1849static int _ocp_softreset(struct omap_hwmod *oh)
1806{ 1850{
1807 u32 v, softrst_mask; 1851 u32 v;
1808 int c = 0; 1852 int c = 0;
1809 int ret = 0; 1853 int ret = 0;
1810 1854
@@ -1834,19 +1878,7 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1834 if (oh->class->sysc->srst_udelay) 1878 if (oh->class->sysc->srst_udelay)
1835 udelay(oh->class->sysc->srst_udelay); 1879 udelay(oh->class->sysc->srst_udelay);
1836 1880
1837 if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS) 1881 c = _wait_softreset_complete(oh);
1838 omap_test_timeout((omap_hwmod_read(oh,
1839 oh->class->sysc->syss_offs)
1840 & SYSS_RESETDONE_MASK),
1841 MAX_MODULE_SOFTRESET_WAIT, c);
1842 else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {
1843 softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);
1844 omap_test_timeout(!(omap_hwmod_read(oh,
1845 oh->class->sysc->sysc_offs)
1846 & softrst_mask),
1847 MAX_MODULE_SOFTRESET_WAIT, c);
1848 }
1849
1850 if (c == MAX_MODULE_SOFTRESET_WAIT) 1882 if (c == MAX_MODULE_SOFTRESET_WAIT)
1851 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", 1883 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n",
1852 oh->name, MAX_MODULE_SOFTRESET_WAIT); 1884 oh->name, MAX_MODULE_SOFTRESET_WAIT);
@@ -2352,6 +2384,9 @@ static int __init _setup_reset(struct omap_hwmod *oh)
2352 if (oh->_state != _HWMOD_STATE_INITIALIZED) 2384 if (oh->_state != _HWMOD_STATE_INITIALIZED)
2353 return -EINVAL; 2385 return -EINVAL;
2354 2386
2387 if (oh->flags & HWMOD_EXT_OPT_MAIN_CLK)
2388 return -EPERM;
2389
2355 if (oh->rst_lines_cnt == 0) { 2390 if (oh->rst_lines_cnt == 0) {
2356 r = _enable(oh); 2391 r = _enable(oh);
2357 if (r) { 2392 if (r) {
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 652d0285bd6d..0b1249e00398 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -21,6 +21,7 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/platform_data/gpio-omap.h> 22#include <linux/platform_data/gpio-omap.h>
23#include <linux/power/smartreflex.h> 23#include <linux/power/smartreflex.h>
24#include <linux/platform_data/omap_ocp2scp.h>
24 25
25#include <plat/omap_hwmod.h> 26#include <plat/omap_hwmod.h>
26#include <plat/i2c.h> 27#include <plat/i2c.h>
@@ -2125,6 +2126,14 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = {
2125 .name = "mcpdm", 2126 .name = "mcpdm",
2126 .class = &omap44xx_mcpdm_hwmod_class, 2127 .class = &omap44xx_mcpdm_hwmod_class,
2127 .clkdm_name = "abe_clkdm", 2128 .clkdm_name = "abe_clkdm",
2129 /*
2130 * It's suspected that the McPDM requires an off-chip main
2131 * functional clock, controlled via I2C. This IP block is
2132 * currently reset very early during boot, before I2C is
2133 * available, so it doesn't seem that we have any choice in
2134 * the kernel other than to avoid resetting it.
2135 */
2136 .flags = HWMOD_EXT_OPT_MAIN_CLK,
2128 .mpu_irqs = omap44xx_mcpdm_irqs, 2137 .mpu_irqs = omap44xx_mcpdm_irqs,
2129 .sdma_reqs = omap44xx_mcpdm_sdma_reqs, 2138 .sdma_reqs = omap44xx_mcpdm_sdma_reqs,
2130 .main_clk = "mcpdm_fck", 2139 .main_clk = "mcpdm_fck",
@@ -2681,6 +2690,32 @@ static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = {
2681 .sysc = &omap44xx_ocp2scp_sysc, 2690 .sysc = &omap44xx_ocp2scp_sysc,
2682}; 2691};
2683 2692
2693/* ocp2scp dev_attr */
2694static struct resource omap44xx_usb_phy_and_pll_addrs[] = {
2695 {
2696 .name = "usb_phy",
2697 .start = 0x4a0ad080,
2698 .end = 0x4a0ae000,
2699 .flags = IORESOURCE_MEM,
2700 },
2701 {
2702 /* XXX: Remove this once control module driver is in place */
2703 .name = "ctrl_dev",
2704 .start = 0x4a002300,
2705 .end = 0x4a002303,
2706 .flags = IORESOURCE_MEM,
2707 },
2708 { }
2709};
2710
2711static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {
2712 {
2713 .drv_name = "omap-usb2",
2714 .res = omap44xx_usb_phy_and_pll_addrs,
2715 },
2716 { }
2717};
2718
2684/* ocp2scp_usb_phy */ 2719/* ocp2scp_usb_phy */
2685static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { 2720static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2686 .name = "ocp2scp_usb_phy", 2721 .name = "ocp2scp_usb_phy",
@@ -2694,6 +2729,7 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2694 .modulemode = MODULEMODE_HWCTRL, 2729 .modulemode = MODULEMODE_HWCTRL,
2695 }, 2730 },
2696 }, 2731 },
2732 .dev_attr = ocp2scp_dev_attr,
2697}; 2733};
2698 2734
2699/* 2735/*
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 635e109f5ad3..a256135d8e48 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -73,6 +73,7 @@ void __init omap4_pmic_init(const char *pmic_type,
73{ 73{
74 /* PMIC part*/ 74 /* PMIC part*/
75 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); 75 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
76 omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
76 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data); 77 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
77 78
78 /* Register additional devices on i2c1 bus if needed */ 79 /* Register additional devices on i2c1 bus if needed */
@@ -366,7 +367,7 @@ static struct regulator_init_data omap4_clk32kg_idata = {
366}; 367};
367 368
368static struct regulator_consumer_supply omap4_vdd1_supply[] = { 369static struct regulator_consumer_supply omap4_vdd1_supply[] = {
369 REGULATOR_SUPPLY("vcc", "mpu.0"), 370 REGULATOR_SUPPLY("vcc", "cpu0"),
370}; 371};
371 372
372static struct regulator_consumer_supply omap4_vdd2_supply[] = { 373static struct regulator_consumer_supply omap4_vdd2_supply[] = {
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 880249b17012..75878c37959b 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -264,7 +264,7 @@ static void __init omap_vc_i2c_init(struct voltagedomain *voltdm)
264 264
265 if (initialized) { 265 if (initialized) {
266 if (voltdm->pmic->i2c_high_speed != i2c_high_speed) 266 if (voltdm->pmic->i2c_high_speed != i2c_high_speed)
267 pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).", 267 pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).\n",
268 __func__, voltdm->name, i2c_high_speed); 268 __func__, voltdm->name, i2c_high_speed);
269 return; 269 return;
270 } 270 }
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 5ecbd17b5641..e2c6391863fe 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -28,6 +28,7 @@
28#include <linux/mfd/asic3.h> 28#include <linux/mfd/asic3.h>
29#include <linux/mtd/physmap.h> 29#include <linux/mtd/physmap.h>
30#include <linux/pda_power.h> 30#include <linux/pda_power.h>
31#include <linux/pwm.h>
31#include <linux/pwm_backlight.h> 32#include <linux/pwm_backlight.h>
32#include <linux/regulator/driver.h> 33#include <linux/regulator/driver.h>
33#include <linux/regulator/gpio-regulator.h> 34#include <linux/regulator/gpio-regulator.h>
@@ -556,7 +557,7 @@ static struct platform_device hx4700_lcd = {
556 */ 557 */
557 558
558static struct platform_pwm_backlight_data backlight_data = { 559static struct platform_pwm_backlight_data backlight_data = {
559 .pwm_id = 1, 560 .pwm_id = -1, /* Superseded by pwm_lookup */
560 .max_brightness = 200, 561 .max_brightness = 200,
561 .dft_brightness = 100, 562 .dft_brightness = 100,
562 .pwm_period_ns = 30923, 563 .pwm_period_ns = 30923,
@@ -571,6 +572,10 @@ static struct platform_device backlight = {
571 }, 572 },
572}; 573};
573 574
575static struct pwm_lookup hx4700_pwm_lookup[] = {
576 PWM_LOOKUP("pxa27x-pwm.1", 0, "pwm-backlight", NULL),
577};
578
574/* 579/*
575 * USB "Transceiver" 580 * USB "Transceiver"
576 */ 581 */
@@ -872,6 +877,7 @@ static void __init hx4700_init(void)
872 pxa_set_stuart_info(NULL); 877 pxa_set_stuart_info(NULL);
873 878
874 platform_add_devices(devices, ARRAY_SIZE(devices)); 879 platform_add_devices(devices, ARRAY_SIZE(devices));
880 pwm_add_table(hx4700_pwm_lookup, ARRAY_SIZE(hx4700_pwm_lookup));
875 881
876 pxa_set_ficp_info(&ficp_info); 882 pxa_set_ficp_info(&ficp_info);
877 pxa27x_set_i2c_power_info(NULL); 883 pxa27x_set_i2c_power_info(NULL);
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 438f02fe122a..842596d4d31e 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -86,10 +86,7 @@ static void spitz_discharge1(int on)
86 gpio_set_value(SPITZ_GPIO_LED_GREEN, on); 86 gpio_set_value(SPITZ_GPIO_LED_GREEN, on);
87} 87}
88 88
89static unsigned long gpio18_config[] = { 89static unsigned long gpio18_config = GPIO18_GPIO;
90 GPIO18_RDY,
91 GPIO18_GPIO,
92};
93 90
94static void spitz_presuspend(void) 91static void spitz_presuspend(void)
95{ 92{
@@ -112,7 +109,7 @@ static void spitz_presuspend(void)
112 PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT; 109 PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
113 PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0); 110 PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);
114 111
115 pxa2xx_mfp_config(&gpio18_config[0], 1); 112 pxa2xx_mfp_config(&gpio18_config, 1);
116 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown"); 113 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown");
117 gpio_free(18); 114 gpio_free(18);
118 115
@@ -131,7 +128,6 @@ static void spitz_presuspend(void)
131 128
132static void spitz_postsuspend(void) 129static void spitz_postsuspend(void)
133{ 130{
134 pxa2xx_mfp_config(&gpio18_config[1], 1);
135} 131}
136 132
137static int spitz_should_wakeup(unsigned int resume_on_alarm) 133static int spitz_should_wakeup(unsigned int resume_on_alarm)
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index a5683a84c6ee..6013831a043e 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -26,12 +26,14 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/i2c-omap.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
30#include <linux/err.h> 31#include <linux/err.h>
31#include <linux/clk.h> 32#include <linux/clk.h>
32 33
33#include <mach/irqs.h> 34#include <mach/irqs.h>
34#include <plat/i2c.h> 35#include <plat/i2c.h>
36#include <plat/omap-pm.h>
35#include <plat/omap_device.h> 37#include <plat/omap_device.h>
36 38
37#define OMAP_I2C_SIZE 0x3f 39#define OMAP_I2C_SIZE 0x3f
@@ -127,6 +129,16 @@ static inline int omap1_i2c_add_bus(int bus_id)
127 129
128 130
129#ifdef CONFIG_ARCH_OMAP2PLUS 131#ifdef CONFIG_ARCH_OMAP2PLUS
132/*
133 * XXX This function is a temporary compatibility wrapper - only
134 * needed until the I2C driver can be converted to call
135 * omap_pm_set_max_dev_wakeup_lat() and handle a return code.
136 */
137static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
138{
139 omap_pm_set_max_mpu_wakeup_lat(dev, t);
140}
141
130static inline int omap2_i2c_add_bus(int bus_id) 142static inline int omap2_i2c_add_bus(int bus_id)
131{ 143{
132 int l; 144 int l;
@@ -158,6 +170,15 @@ static inline int omap2_i2c_add_bus(int bus_id)
158 dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr; 170 dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
159 pdata->flags = dev_attr->flags; 171 pdata->flags = dev_attr->flags;
160 172
173 /*
174 * When waiting for completion of a i2c transfer, we need to
175 * set a wake up latency constraint for the MPU. This is to
176 * ensure quick enough wakeup from idle, when transfer
177 * completes.
178 * Only omap3 has support for constraints
179 */
180 if (cpu_is_omap34xx())
181 pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
161 pdev = omap_device_build(name, bus_id, oh, pdata, 182 pdev = omap_device_build(name, bus_id, oh, pdata,
162 sizeof(struct omap_i2c_bus_platform_data), 183 sizeof(struct omap_i2c_bus_platform_data),
163 NULL, 0, 0); 184 NULL, 0, 0);
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index b3349f7b1a2c..1db029438022 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -443,6 +443,11 @@ struct omap_hwmod_omap4_prcm {
443 * in order to complete the reset. Optional clocks will be disabled 443 * in order to complete the reset. Optional clocks will be disabled
444 * again after the reset. 444 * again after the reset.
445 * HWMOD_16BIT_REG: Module has 16bit registers 445 * HWMOD_16BIT_REG: Module has 16bit registers
446 * HWMOD_EXT_OPT_MAIN_CLK: The only main functional clock source for
447 * this IP block comes from an off-chip source and is not always
448 * enabled. This prevents the hwmod code from being able to
449 * enable and reset the IP block early. XXX Eventually it should
450 * be possible to query the clock framework for this information.
446 */ 451 */
447#define HWMOD_SWSUP_SIDLE (1 << 0) 452#define HWMOD_SWSUP_SIDLE (1 << 0)
448#define HWMOD_SWSUP_MSTANDBY (1 << 1) 453#define HWMOD_SWSUP_MSTANDBY (1 << 1)
@@ -453,6 +458,7 @@ struct omap_hwmod_omap4_prcm {
453#define HWMOD_NO_IDLEST (1 << 6) 458#define HWMOD_NO_IDLEST (1 << 6)
454#define HWMOD_CONTROL_OPT_CLKS_IN_RESET (1 << 7) 459#define HWMOD_CONTROL_OPT_CLKS_IN_RESET (1 << 7)
455#define HWMOD_16BIT_REG (1 << 8) 460#define HWMOD_16BIT_REG (1 << 8)
461#define HWMOD_EXT_OPT_MAIN_CLK (1 << 9)
456 462
457/* 463/*
458 * omap_hwmod._int_flags definitions 464 * omap_hwmod._int_flags definitions
diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index cd60a81163e9..32d05c8219dc 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -5,6 +5,6 @@
5# 5#
6 6
7include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types 7include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
8 $(kecho) ' Generating $@' 8 @$(kecho) ' Generating $@'
9 @mkdir -p $(dir $@) 9 @mkdir -p $(dir $@)
10 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } 10 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 59bcb96ac369..f57609275449 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -166,3 +166,14 @@ void free_xenballooned_pages(int nr_pages, struct page **pages)
166 *pages = NULL; 166 *pages = NULL;
167} 167}
168EXPORT_SYMBOL_GPL(free_xenballooned_pages); 168EXPORT_SYMBOL_GPL(free_xenballooned_pages);
169
170/* In the hypervisor.S file. */
171EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);
172EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);
173EXPORT_SYMBOL_GPL(HYPERVISOR_xen_version);
174EXPORT_SYMBOL_GPL(HYPERVISOR_console_io);
175EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op);
176EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);
177EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
178EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
179EXPORT_SYMBOL_GPL(privcmd_call);
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index ef54a59a9e89..15ac18a56c93 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,6 +1,7 @@
1config ARM64 1config ARM64
2 def_bool y 2 def_bool y
3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
4 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
4 select GENERIC_CLOCKEVENTS 5 select GENERIC_CLOCKEVENTS
5 select GENERIC_HARDIRQS_NO_DEPRECATED 6 select GENERIC_HARDIRQS_NO_DEPRECATED
6 select GENERIC_IOMAP 7 select GENERIC_IOMAP
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index cf284649dfcb..07fea290d7c1 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -25,12 +25,10 @@
25#include <asm/user.h> 25#include <asm/user.h>
26 26
27typedef unsigned long elf_greg_t; 27typedef unsigned long elf_greg_t;
28typedef unsigned long elf_freg_t[3];
29 28
30#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) 29#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
31typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 30typedef elf_greg_t elf_gregset_t[ELF_NGREG];
32 31typedef struct user_fpsimd_state elf_fpregset_t;
33typedef struct user_fp elf_fpregset_t;
34 32
35#define EM_AARCH64 183 33#define EM_AARCH64 183
36 34
@@ -87,7 +85,6 @@ typedef struct user_fp elf_fpregset_t;
87#define R_AARCH64_MOVW_PREL_G2_NC 292 85#define R_AARCH64_MOVW_PREL_G2_NC 292
88#define R_AARCH64_MOVW_PREL_G3 293 86#define R_AARCH64_MOVW_PREL_G3 293
89 87
90
91/* 88/*
92 * These are used to set parameters in the core dumps. 89 * These are used to set parameters in the core dumps.
93 */ 90 */
diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h
index b42fab9f62a9..c43b4ac13008 100644
--- a/arch/arm64/include/asm/fpsimd.h
+++ b/arch/arm64/include/asm/fpsimd.h
@@ -25,9 +25,8 @@
25 * - FPSR and FPCR 25 * - FPSR and FPCR
26 * - 32 128-bit data registers 26 * - 32 128-bit data registers
27 * 27 *
28 * Note that user_fp forms a prefix of this structure, which is relied 28 * Note that user_fpsimd forms a prefix of this structure, which is
29 * upon in the ptrace FP/SIMD accessors. struct user_fpsimd_state must 29 * relied upon in the ptrace FP/SIMD accessors.
30 * form a prefix of struct fpsimd_state.
31 */ 30 */
32struct fpsimd_state { 31struct fpsimd_state {
33 union { 32 union {
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 74a2a7d304a9..d2f05a608274 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -114,7 +114,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
114 * I/O port access primitives. 114 * I/O port access primitives.
115 */ 115 */
116#define IO_SPACE_LIMIT 0xffff 116#define IO_SPACE_LIMIT 0xffff
117#define PCI_IOBASE ((void __iomem *)0xffffffbbfffe0000UL) 117#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_2M))
118 118
119static inline u8 inb(unsigned long addr) 119static inline u8 inb(unsigned long addr)
120{ 120{
@@ -222,12 +222,12 @@ extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot
222extern void __iounmap(volatile void __iomem *addr); 222extern void __iounmap(volatile void __iomem *addr);
223 223
224#define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_DIRTY) 224#define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_DIRTY)
225#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_XN | PTE_ATTRINDX(MT_DEVICE_nGnRE)) 225#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE))
226#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC)) 226#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC))
227 227
228#define ioremap(addr, size) __ioremap((addr), (size), PROT_DEVICE_nGnRE) 228#define ioremap(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
229#define ioremap_nocache(addr, size) __ioremap((addr), (size), PROT_DEVICE_nGnRE) 229#define ioremap_nocache(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
230#define ioremap_wc(addr, size) __ioremap((addr), (size), PROT_NORMAL_NC) 230#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
231#define iounmap __iounmap 231#define iounmap __iounmap
232 232
233#define ARCH_HAS_IOREMAP_WC 233#define ARCH_HAS_IOREMAP_WC
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
index 0f3b4581d925..75fd13d289b9 100644
--- a/arch/arm64/include/asm/pgtable-hwdef.h
+++ b/arch/arm64/include/asm/pgtable-hwdef.h
@@ -38,7 +38,8 @@
38#define PMD_SECT_S (_AT(pmdval_t, 3) << 8) 38#define PMD_SECT_S (_AT(pmdval_t, 3) << 8)
39#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10) 39#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10)
40#define PMD_SECT_NG (_AT(pmdval_t, 1) << 11) 40#define PMD_SECT_NG (_AT(pmdval_t, 1) << 11)
41#define PMD_SECT_XN (_AT(pmdval_t, 1) << 54) 41#define PMD_SECT_PXN (_AT(pmdval_t, 1) << 53)
42#define PMD_SECT_UXN (_AT(pmdval_t, 1) << 54)
42 43
43/* 44/*
44 * AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers). 45 * AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers).
@@ -57,7 +58,8 @@
57#define PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */ 58#define PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
58#define PTE_AF (_AT(pteval_t, 1) << 10) /* Access Flag */ 59#define PTE_AF (_AT(pteval_t, 1) << 10) /* Access Flag */
59#define PTE_NG (_AT(pteval_t, 1) << 11) /* nG */ 60#define PTE_NG (_AT(pteval_t, 1) << 11) /* nG */
60#define PTE_XN (_AT(pteval_t, 1) << 54) /* XN */ 61#define PTE_PXN (_AT(pteval_t, 1) << 53) /* Privileged XN */
62#define PTE_UXN (_AT(pteval_t, 1) << 54) /* User XN */
61 63
62/* 64/*
63 * AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers). 65 * AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers).
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 8960239be722..14aba2db6776 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -62,23 +62,23 @@ extern pgprot_t pgprot_default;
62 62
63#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) 63#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b))
64 64
65#define PAGE_NONE _MOD_PROT(pgprot_default, PTE_NG | PTE_XN | PTE_RDONLY) 65#define PAGE_NONE _MOD_PROT(pgprot_default, PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
66#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_XN) 66#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
67#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG) 67#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN)
68#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_XN | PTE_RDONLY) 68#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
69#define PAGE_COPY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_RDONLY) 69#define PAGE_COPY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY)
70#define PAGE_READONLY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_XN | PTE_RDONLY) 70#define PAGE_READONLY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
71#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_RDONLY) 71#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY)
72#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_XN | PTE_DIRTY) 72#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY)
73#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_DIRTY) 73#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY)
74 74
75#define __PAGE_NONE __pgprot(_PAGE_DEFAULT | PTE_NG | PTE_XN | PTE_RDONLY) 75#define __PAGE_NONE __pgprot(_PAGE_DEFAULT | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
76#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_XN) 76#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
77#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG) 77#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN)
78#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_XN | PTE_RDONLY) 78#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
79#define __PAGE_COPY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_RDONLY) 79#define __PAGE_COPY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY)
80#define __PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_XN | PTE_RDONLY) 80#define __PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
81#define __PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_RDONLY) 81#define __PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY)
82 82
83#endif /* __ASSEMBLY__ */ 83#endif /* __ASSEMBLY__ */
84 84
@@ -130,10 +130,10 @@ extern struct page *empty_zero_page;
130#define pte_young(pte) (pte_val(pte) & PTE_AF) 130#define pte_young(pte) (pte_val(pte) & PTE_AF)
131#define pte_special(pte) (pte_val(pte) & PTE_SPECIAL) 131#define pte_special(pte) (pte_val(pte) & PTE_SPECIAL)
132#define pte_write(pte) (!(pte_val(pte) & PTE_RDONLY)) 132#define pte_write(pte) (!(pte_val(pte) & PTE_RDONLY))
133#define pte_exec(pte) (!(pte_val(pte) & PTE_XN)) 133#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN))
134 134
135#define pte_present_exec_user(pte) \ 135#define pte_present_exec_user(pte) \
136 ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_XN)) == \ 136 ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == \
137 (PTE_VALID | PTE_USER)) 137 (PTE_VALID | PTE_USER))
138 138
139#define PTE_BIT_FUNC(fn,op) \ 139#define PTE_BIT_FUNC(fn,op) \
@@ -262,7 +262,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
262 262
263static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 263static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
264{ 264{
265 const pteval_t mask = PTE_USER | PTE_XN | PTE_RDONLY; 265 const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY;
266 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); 266 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
267 return pte; 267 return pte;
268} 268}
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 5d810044feda..77f696c14339 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -43,6 +43,8 @@
43#else 43#else
44#define STACK_TOP STACK_TOP_MAX 44#define STACK_TOP STACK_TOP_MAX
45#endif /* CONFIG_COMPAT */ 45#endif /* CONFIG_COMPAT */
46
47#define ARCH_LOW_ADDRESS_LIMIT PHYS_MASK
46#endif /* __KERNEL__ */ 48#endif /* __KERNEL__ */
47 49
48struct debug_info { 50struct debug_info {
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 63f853f8b718..68aff2816e86 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -14,7 +14,6 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#ifdef CONFIG_COMPAT 16#ifdef CONFIG_COMPAT
17#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION
18#define __ARCH_WANT_COMPAT_STAT64 17#define __ARCH_WANT_COMPAT_STAT64
19#define __ARCH_WANT_SYS_GETHOSTNAME 18#define __ARCH_WANT_SYS_GETHOSTNAME
20#define __ARCH_WANT_SYS_PAUSE 19#define __ARCH_WANT_SYS_PAUSE
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index ecbf2d81ec5c..c76c7241125b 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -613,17 +613,11 @@ enum armv8_pmuv3_perf_types {
613 ARMV8_PMUV3_PERFCTR_BUS_ACCESS = 0x19, 613 ARMV8_PMUV3_PERFCTR_BUS_ACCESS = 0x19,
614 ARMV8_PMUV3_PERFCTR_MEM_ERROR = 0x1A, 614 ARMV8_PMUV3_PERFCTR_MEM_ERROR = 0x1A,
615 ARMV8_PMUV3_PERFCTR_BUS_CYCLES = 0x1D, 615 ARMV8_PMUV3_PERFCTR_BUS_CYCLES = 0x1D,
616
617 /*
618 * This isn't an architected event.
619 * We detect this event number and use the cycle counter instead.
620 */
621 ARMV8_PMUV3_PERFCTR_CPU_CYCLES = 0xFF,
622}; 616};
623 617
624/* PMUv3 HW events mapping. */ 618/* PMUv3 HW events mapping. */
625static const unsigned armv8_pmuv3_perf_map[PERF_COUNT_HW_MAX] = { 619static const unsigned armv8_pmuv3_perf_map[PERF_COUNT_HW_MAX] = {
626 [PERF_COUNT_HW_CPU_CYCLES] = ARMV8_PMUV3_PERFCTR_CPU_CYCLES, 620 [PERF_COUNT_HW_CPU_CYCLES] = ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES,
627 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV8_PMUV3_PERFCTR_INSTR_EXECUTED, 621 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV8_PMUV3_PERFCTR_INSTR_EXECUTED,
628 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_ACCESS, 622 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_ACCESS,
629 [PERF_COUNT_HW_CACHE_MISSES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_REFILL, 623 [PERF_COUNT_HW_CACHE_MISSES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_REFILL,
@@ -1106,7 +1100,7 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc,
1106 unsigned long evtype = event->config_base & ARMV8_EVTYPE_EVENT; 1100 unsigned long evtype = event->config_base & ARMV8_EVTYPE_EVENT;
1107 1101
1108 /* Always place a cycle counter into the cycle counter. */ 1102 /* Always place a cycle counter into the cycle counter. */
1109 if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) { 1103 if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) {
1110 if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask)) 1104 if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))
1111 return -EAGAIN; 1105 return -EAGAIN;
1112 1106
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index f22965ea1cfc..e04cebdbb47f 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -310,24 +310,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
310} 310}
311 311
312/* 312/*
313 * Fill in the task's elfregs structure for a core dump.
314 */
315int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs)
316{
317 elf_core_copy_regs(elfregs, task_pt_regs(t));
318 return 1;
319}
320
321/*
322 * fill in the fpe structure for a core dump...
323 */
324int dump_fpu (struct pt_regs *regs, struct user_fp *fp)
325{
326 return 0;
327}
328EXPORT_SYMBOL(dump_fpu);
329
330/*
331 * Shuffle the argument into the correct register before calling the 313 * Shuffle the argument into the correct register before calling the
332 * thread function. x1 is the thread argument, x2 is the pointer to 314 * thread function. x1 is the thread argument, x2 is the pointer to
333 * the thread function, and x3 points to the exit function. 315 * the thread function, and x3 points to the exit function.
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 226b6bf6e9c2..538300f2273d 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -211,8 +211,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
211 * before we continue. 211 * before we continue.
212 */ 212 */
213 set_cpu_online(cpu, true); 213 set_cpu_online(cpu, true);
214 while (!cpu_active(cpu)) 214 complete(&cpu_running);
215 cpu_relax();
216 215
217 /* 216 /*
218 * OK, it's off to the idle thread for us 217 * OK, it's off to the idle thread for us
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index efbf7df05d3f..4cd28931dba9 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -80,7 +80,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
80#ifdef CONFIG_ZONE_DMA32 80#ifdef CONFIG_ZONE_DMA32
81 /* 4GB maximum for 32-bit only capable devices */ 81 /* 4GB maximum for 32-bit only capable devices */
82 max_dma32 = min(max, MAX_DMA32_PFN); 82 max_dma32 = min(max, MAX_DMA32_PFN);
83 zone_size[ZONE_DMA32] = max_dma32 - min; 83 zone_size[ZONE_DMA32] = max(min, max_dma32) - min;
84#endif 84#endif
85 zone_size[ZONE_NORMAL] = max - max_dma32; 85 zone_size[ZONE_NORMAL] = max - max_dma32;
86 86
diff --git a/arch/h8300/include/asm/cache.h b/arch/h8300/include/asm/cache.h
index c6350283649d..05887a1d80e5 100644
--- a/arch/h8300/include/asm/cache.h
+++ b/arch/h8300/include/asm/cache.h
@@ -2,7 +2,8 @@
2#define __ARCH_H8300_CACHE_H 2#define __ARCH_H8300_CACHE_H
3 3
4/* bytes per L1 cache line */ 4/* bytes per L1 cache line */
5#define L1_CACHE_BYTES 4 5#define L1_CACHE_SHIFT 2
6#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
6 7
7/* m68k-elf-gcc 2.95.2 doesn't like these */ 8/* m68k-elf-gcc 2.95.2 doesn't like these */
8 9
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index acd5b68e8871..082e383c1b6f 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -637,7 +637,6 @@ mem_init (void)
637 637
638 high_memory = __va(max_low_pfn * PAGE_SIZE); 638 high_memory = __va(max_low_pfn * PAGE_SIZE);
639 639
640 reset_zone_present_pages();
641 for_each_online_pgdat(pgdat) 640 for_each_online_pgdat(pgdat)
642 if (pgdat->bdata->node_bootmem_map) 641 if (pgdat->bdata->node_bootmem_map)
643 totalram_pages += free_all_bootmem_node(pgdat); 642 totalram_pages += free_all_bootmem_node(pgdat);
diff --git a/arch/m68k/include/asm/signal.h b/arch/m68k/include/asm/signal.h
index 67e489d8d1bd..2df26b57c26a 100644
--- a/arch/m68k/include/asm/signal.h
+++ b/arch/m68k/include/asm/signal.h
@@ -41,7 +41,7 @@ struct k_sigaction {
41static inline void sigaddset(sigset_t *set, int _sig) 41static inline void sigaddset(sigset_t *set, int _sig)
42{ 42{
43 asm ("bfset %0{%1,#1}" 43 asm ("bfset %0{%1,#1}"
44 : "+od" (*set) 44 : "+o" (*set)
45 : "id" ((_sig - 1) ^ 31) 45 : "id" ((_sig - 1) ^ 31)
46 : "cc"); 46 : "cc");
47} 47}
@@ -49,7 +49,7 @@ static inline void sigaddset(sigset_t *set, int _sig)
49static inline void sigdelset(sigset_t *set, int _sig) 49static inline void sigdelset(sigset_t *set, int _sig)
50{ 50{
51 asm ("bfclr %0{%1,#1}" 51 asm ("bfclr %0{%1,#1}"
52 : "+od" (*set) 52 : "+o" (*set)
53 : "id" ((_sig - 1) ^ 31) 53 : "id" ((_sig - 1) ^ 31)
54 : "cc"); 54 : "cc");
55} 55}
@@ -65,7 +65,7 @@ static inline int __gen_sigismember(sigset_t *set, int _sig)
65 int ret; 65 int ret;
66 asm ("bfextu %1{%2,#1},%0" 66 asm ("bfextu %1{%2,#1},%0"
67 : "=d" (ret) 67 : "=d" (ret)
68 : "od" (*set), "id" ((_sig-1) ^ 31) 68 : "o" (*set), "id" ((_sig-1) ^ 31)
69 : "cc"); 69 : "cc");
70 return ret; 70 return ret;
71} 71}
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 1f495eb077d8..b7dc39c6c849 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -19,6 +19,7 @@ config MIPS
19 select HAVE_KRETPROBES 19 select HAVE_KRETPROBES
20 select HAVE_DEBUG_KMEMLEAK 20 select HAVE_DEBUG_KMEMLEAK
21 select ARCH_BINFMT_ELF_RANDOMIZE_PIE 21 select ARCH_BINFMT_ELF_RANDOMIZE_PIE
22 select HAVE_ARCH_TRANSPARENT_HUGEPAGE
22 select RTC_LIB if !MACH_LOONGSON 23 select RTC_LIB if !MACH_LOONGSON
23 select GENERIC_ATOMIC64 if !64BIT 24 select GENERIC_ATOMIC64 if !64BIT
24 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 25 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
@@ -53,8 +54,8 @@ choice
53config MIPS_ALCHEMY 54config MIPS_ALCHEMY
54 bool "Alchemy processor based machines" 55 bool "Alchemy processor based machines"
55 select 64BIT_PHYS_ADDR 56 select 64BIT_PHYS_ADDR
56 select CEVT_R4K_LIB 57 select CEVT_R4K
57 select CSRC_R4K_LIB 58 select CSRC_R4K
58 select IRQ_CPU 59 select IRQ_CPU
59 select SYS_HAS_CPU_MIPS32_R1 60 select SYS_HAS_CPU_MIPS32_R1
60 select SYS_SUPPORTS_32BIT_KERNEL 61 select SYS_SUPPORTS_32BIT_KERNEL
@@ -109,12 +110,12 @@ config BCM47XX
109 select CEVT_R4K 110 select CEVT_R4K
110 select CSRC_R4K 111 select CSRC_R4K
111 select DMA_NONCOHERENT 112 select DMA_NONCOHERENT
113 select FW_CFE
112 select HW_HAS_PCI 114 select HW_HAS_PCI
113 select IRQ_CPU 115 select IRQ_CPU
114 select SYS_SUPPORTS_32BIT_KERNEL 116 select SYS_SUPPORTS_32BIT_KERNEL
115 select SYS_SUPPORTS_LITTLE_ENDIAN 117 select SYS_SUPPORTS_LITTLE_ENDIAN
116 select SYS_HAS_EARLY_PRINTK 118 select SYS_HAS_EARLY_PRINTK
117 select CFE
118 help 119 help
119 Support for BCM47XX based boards 120 Support for BCM47XX based boards
120 121
@@ -191,8 +192,8 @@ config MACH_DECSTATION
191 192
192config MACH_JAZZ 193config MACH_JAZZ
193 bool "Jazz family of machines" 194 bool "Jazz family of machines"
194 select ARC 195 select FW_ARC
195 select ARC32 196 select FW_ARC32
196 select ARCH_MAY_HAVE_PC_FDC 197 select ARCH_MAY_HAVE_PC_FDC
197 select CEVT_R4K 198 select CEVT_R4K
198 select CSRC_R4K 199 select CSRC_R4K
@@ -415,27 +416,6 @@ config PMC_MSP
415 of integrated peripherals, interfaces and DSPs in addition to 416 of integrated peripherals, interfaces and DSPs in addition to
416 a variety of MIPS cores. 417 a variety of MIPS cores.
417 418
418config PMC_YOSEMITE
419 bool "PMC-Sierra Yosemite eval board"
420 select CEVT_R4K
421 select CSRC_R4K
422 select DMA_COHERENT
423 select HW_HAS_PCI
424 select IRQ_CPU
425 select IRQ_CPU_RM7K
426 select IRQ_CPU_RM9K
427 select SWAP_IO_SPACE
428 select SYS_HAS_CPU_RM9000
429 select SYS_HAS_EARLY_PRINTK
430 select SYS_SUPPORTS_32BIT_KERNEL
431 select SYS_SUPPORTS_64BIT_KERNEL
432 select SYS_SUPPORTS_BIG_ENDIAN
433 select SYS_SUPPORTS_HIGHMEM
434 select SYS_SUPPORTS_SMP
435 help
436 Yosemite is an evaluation board for the RM9000x2 processor
437 manufactured by PMC-Sierra.
438
439config POWERTV 419config POWERTV
440 bool "Cisco PowerTV" 420 bool "Cisco PowerTV"
441 select BOOT_ELF32 421 select BOOT_ELF32
@@ -456,8 +436,8 @@ config POWERTV
456 436
457config SGI_IP22 437config SGI_IP22
458 bool "SGI IP22 (Indy/Indigo2)" 438 bool "SGI IP22 (Indy/Indigo2)"
459 select ARC 439 select FW_ARC
460 select ARC32 440 select FW_ARC32
461 select BOOT_ELF32 441 select BOOT_ELF32
462 select CEVT_R4K 442 select CEVT_R4K
463 select CSRC_R4K 443 select CSRC_R4K
@@ -496,8 +476,8 @@ config SGI_IP22
496 476
497config SGI_IP27 477config SGI_IP27
498 bool "SGI IP27 (Origin200/2000)" 478 bool "SGI IP27 (Origin200/2000)"
499 select ARC 479 select FW_ARC
500 select ARC64 480 select FW_ARC64
501 select BOOT_ELF64 481 select BOOT_ELF64
502 select DEFAULT_SGI_PARTITION 482 select DEFAULT_SGI_PARTITION
503 select DMA_COHERENT 483 select DMA_COHERENT
@@ -517,8 +497,8 @@ config SGI_IP27
517config SGI_IP28 497config SGI_IP28
518 bool "SGI IP28 (Indigo2 R10k) (EXPERIMENTAL)" 498 bool "SGI IP28 (Indigo2 R10k) (EXPERIMENTAL)"
519 depends on EXPERIMENTAL 499 depends on EXPERIMENTAL
520 select ARC 500 select FW_ARC
521 select ARC64 501 select FW_ARC64
522 select BOOT_ELF64 502 select BOOT_ELF64
523 select CEVT_R4K 503 select CEVT_R4K
524 select CSRC_R4K 504 select CSRC_R4K
@@ -553,8 +533,8 @@ config SGI_IP28
553 533
554config SGI_IP32 534config SGI_IP32
555 bool "SGI IP32 (O2)" 535 bool "SGI IP32 (O2)"
556 select ARC 536 select FW_ARC
557 select ARC32 537 select FW_ARC32
558 select BOOT_ELF32 538 select BOOT_ELF32
559 select CEVT_R4K 539 select CEVT_R4K
560 select CSRC_R4K 540 select CSRC_R4K
@@ -672,8 +652,8 @@ config SIBYTE_BIGSUR
672 652
673config SNI_RM 653config SNI_RM
674 bool "SNI RM200/300/400" 654 bool "SNI RM200/300/400"
675 select ARC if CPU_LITTLE_ENDIAN 655 select FW_ARC if CPU_LITTLE_ENDIAN
676 select ARC32 if CPU_LITTLE_ENDIAN 656 select FW_ARC32 if CPU_LITTLE_ENDIAN
677 select SNIPROM if CPU_BIG_ENDIAN 657 select SNIPROM if CPU_BIG_ENDIAN
678 select ARCH_MAY_HAVE_PC_FDC 658 select ARCH_MAY_HAVE_PC_FDC
679 select BOOT_ELF32 659 select BOOT_ELF32
@@ -774,6 +754,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
774 select DMA_COHERENT 754 select DMA_COHERENT
775 select SYS_SUPPORTS_64BIT_KERNEL 755 select SYS_SUPPORTS_64BIT_KERNEL
776 select SYS_SUPPORTS_BIG_ENDIAN 756 select SYS_SUPPORTS_BIG_ENDIAN
757 select EDAC_SUPPORT
777 select SYS_SUPPORTS_HOTPLUG_CPU 758 select SYS_SUPPORTS_HOTPLUG_CPU
778 select SYS_HAS_EARLY_PRINTK 759 select SYS_HAS_EARLY_PRINTK
779 select SYS_HAS_CPU_CAVIUM_OCTEON 760 select SYS_HAS_CPU_CAVIUM_OCTEON
@@ -906,7 +887,7 @@ config SCHED_OMIT_FRAME_POINTER
906# 887#
907# Select some configuration options automatically based on user selections. 888# Select some configuration options automatically based on user selections.
908# 889#
909config ARC 890config FW_ARC
910 bool 891 bool
911 892
912config ARCH_MAY_HAVE_PC_FDC 893config ARCH_MAY_HAVE_PC_FDC
@@ -924,11 +905,7 @@ config CEVT_DS1287
924config CEVT_GT641XX 905config CEVT_GT641XX
925 bool 906 bool
926 907
927config CEVT_R4K_LIB
928 bool
929
930config CEVT_R4K 908config CEVT_R4K
931 select CEVT_R4K_LIB
932 bool 909 bool
933 910
934config CEVT_SB1250 911config CEVT_SB1250
@@ -946,11 +923,7 @@ config CSRC_IOASIC
946config CSRC_POWERTV 923config CSRC_POWERTV
947 bool 924 bool
948 925
949config CSRC_R4K_LIB
950 bool
951
952config CSRC_R4K 926config CSRC_R4K
953 select CSRC_R4K_LIB
954 bool 927 bool
955 928
956config CSRC_SB1250 929config CSRC_SB1250
@@ -961,7 +934,7 @@ config GPIO_TXX9
961 select ARCH_REQUIRE_GPIOLIB 934 select ARCH_REQUIRE_GPIOLIB
962 bool 935 bool
963 936
964config CFE 937config FW_CFE
965 bool 938 bool
966 939
967config ARCH_DMA_ADDR_T_64BIT 940config ARCH_DMA_ADDR_T_64BIT
@@ -1077,15 +1050,15 @@ config SYS_SUPPORTS_HUGETLBFS
1077 depends on CPU_SUPPORTS_HUGEPAGES && 64BIT 1050 depends on CPU_SUPPORTS_HUGEPAGES && 64BIT
1078 default y 1051 default y
1079 1052
1053config MIPS_HUGE_TLB_SUPPORT
1054 def_bool HUGETLB_PAGE || TRANSPARENT_HUGEPAGE
1055
1080config IRQ_CPU 1056config IRQ_CPU
1081 bool 1057 bool
1082 1058
1083config IRQ_CPU_RM7K 1059config IRQ_CPU_RM7K
1084 bool 1060 bool
1085 1061
1086config IRQ_CPU_RM9K
1087 bool
1088
1089config IRQ_MSP_SLP 1062config IRQ_MSP_SLP
1090 bool 1063 bool
1091 1064
@@ -1110,10 +1083,6 @@ config PCI_GT64XXX_PCI0
1110config NO_EXCEPT_FILL 1083config NO_EXCEPT_FILL
1111 bool 1084 bool
1112 1085
1113config MIPS_RM9122
1114 bool
1115 select SERIAL_RM9000
1116
1117config SOC_EMMA2RH 1086config SOC_EMMA2RH
1118 bool 1087 bool
1119 select CEVT_R4K 1088 select CEVT_R4K
@@ -1159,9 +1128,6 @@ config SOC_PNX8550
1159config SWAP_IO_SPACE 1128config SWAP_IO_SPACE
1160 bool 1129 bool
1161 1130
1162config SERIAL_RM9000
1163 bool
1164
1165config SGI_HAS_INDYDOG 1131config SGI_HAS_INDYDOG
1166 bool 1132 bool
1167 1133
@@ -1183,7 +1149,7 @@ config SGI_HAS_I8042
1183config DEFAULT_SGI_PARTITION 1149config DEFAULT_SGI_PARTITION
1184 bool 1150 bool
1185 1151
1186config ARC32 1152config FW_ARC32
1187 bool 1153 bool
1188 1154
1189config SNIPROM 1155config SNIPROM
@@ -1216,7 +1182,7 @@ config ARC_PROMLIB
1216 depends on MACH_JAZZ || SNI_RM || SGI_IP22 || SGI_IP28 || SGI_IP32 1182 depends on MACH_JAZZ || SNI_RM || SGI_IP22 || SGI_IP28 || SGI_IP32
1217 default y 1183 default y
1218 1184
1219config ARC64 1185config FW_ARC64
1220 bool 1186 bool
1221 1187
1222config BOOT_ELF64 1188config BOOT_ELF64
@@ -1368,6 +1334,7 @@ config CPU_R4X00
1368 depends on SYS_HAS_CPU_R4X00 1334 depends on SYS_HAS_CPU_R4X00
1369 select CPU_SUPPORTS_32BIT_KERNEL 1335 select CPU_SUPPORTS_32BIT_KERNEL
1370 select CPU_SUPPORTS_64BIT_KERNEL 1336 select CPU_SUPPORTS_64BIT_KERNEL
1337 select CPU_SUPPORTS_HUGEPAGES
1371 help 1338 help
1372 MIPS Technologies R4000-series processors other than 4300, including 1339 MIPS Technologies R4000-series processors other than 4300, including
1373 the R4000, R4400, R4600, and 4700. 1340 the R4000, R4400, R4600, and 4700.
@@ -1378,12 +1345,14 @@ config CPU_TX49XX
1378 select CPU_HAS_PREFETCH 1345 select CPU_HAS_PREFETCH
1379 select CPU_SUPPORTS_32BIT_KERNEL 1346 select CPU_SUPPORTS_32BIT_KERNEL
1380 select CPU_SUPPORTS_64BIT_KERNEL 1347 select CPU_SUPPORTS_64BIT_KERNEL
1348 select CPU_SUPPORTS_HUGEPAGES
1381 1349
1382config CPU_R5000 1350config CPU_R5000
1383 bool "R5000" 1351 bool "R5000"
1384 depends on SYS_HAS_CPU_R5000 1352 depends on SYS_HAS_CPU_R5000
1385 select CPU_SUPPORTS_32BIT_KERNEL 1353 select CPU_SUPPORTS_32BIT_KERNEL
1386 select CPU_SUPPORTS_64BIT_KERNEL 1354 select CPU_SUPPORTS_64BIT_KERNEL
1355 select CPU_SUPPORTS_HUGEPAGES
1387 help 1356 help
1388 MIPS Technologies R5000-series processors other than the Nevada. 1357 MIPS Technologies R5000-series processors other than the Nevada.
1389 1358
@@ -1392,6 +1361,7 @@ config CPU_R5432
1392 depends on SYS_HAS_CPU_R5432 1361 depends on SYS_HAS_CPU_R5432
1393 select CPU_SUPPORTS_32BIT_KERNEL 1362 select CPU_SUPPORTS_32BIT_KERNEL
1394 select CPU_SUPPORTS_64BIT_KERNEL 1363 select CPU_SUPPORTS_64BIT_KERNEL
1364 select CPU_SUPPORTS_HUGEPAGES
1395 1365
1396config CPU_R5500 1366config CPU_R5500
1397 bool "R5500" 1367 bool "R5500"
@@ -1417,6 +1387,7 @@ config CPU_NEVADA
1417 depends on SYS_HAS_CPU_NEVADA 1387 depends on SYS_HAS_CPU_NEVADA
1418 select CPU_SUPPORTS_32BIT_KERNEL 1388 select CPU_SUPPORTS_32BIT_KERNEL
1419 select CPU_SUPPORTS_64BIT_KERNEL 1389 select CPU_SUPPORTS_64BIT_KERNEL
1390 select CPU_SUPPORTS_HUGEPAGES
1420 help 1391 help
1421 QED / PMC-Sierra RM52xx-series ("Nevada") processors. 1392 QED / PMC-Sierra RM52xx-series ("Nevada") processors.
1422 1393
@@ -1437,6 +1408,7 @@ config CPU_R10000
1437 select CPU_SUPPORTS_32BIT_KERNEL 1408 select CPU_SUPPORTS_32BIT_KERNEL
1438 select CPU_SUPPORTS_64BIT_KERNEL 1409 select CPU_SUPPORTS_64BIT_KERNEL
1439 select CPU_SUPPORTS_HIGHMEM 1410 select CPU_SUPPORTS_HIGHMEM
1411 select CPU_SUPPORTS_HUGEPAGES
1440 help 1412 help
1441 MIPS Technologies R10000-series processors. 1413 MIPS Technologies R10000-series processors.
1442 1414
@@ -1447,15 +1419,7 @@ config CPU_RM7000
1447 select CPU_SUPPORTS_32BIT_KERNEL 1419 select CPU_SUPPORTS_32BIT_KERNEL
1448 select CPU_SUPPORTS_64BIT_KERNEL 1420 select CPU_SUPPORTS_64BIT_KERNEL
1449 select CPU_SUPPORTS_HIGHMEM 1421 select CPU_SUPPORTS_HIGHMEM
1450 1422 select CPU_SUPPORTS_HUGEPAGES
1451config CPU_RM9000
1452 bool "RM9000"
1453 depends on SYS_HAS_CPU_RM9000
1454 select CPU_HAS_PREFETCH
1455 select CPU_SUPPORTS_32BIT_KERNEL
1456 select CPU_SUPPORTS_64BIT_KERNEL
1457 select CPU_SUPPORTS_HIGHMEM
1458 select WEAK_ORDERING
1459 1423
1460config CPU_SB1 1424config CPU_SB1
1461 bool "SB1" 1425 bool "SB1"
@@ -1463,6 +1427,7 @@ config CPU_SB1
1463 select CPU_SUPPORTS_32BIT_KERNEL 1427 select CPU_SUPPORTS_32BIT_KERNEL
1464 select CPU_SUPPORTS_64BIT_KERNEL 1428 select CPU_SUPPORTS_64BIT_KERNEL
1465 select CPU_SUPPORTS_HIGHMEM 1429 select CPU_SUPPORTS_HIGHMEM
1430 select CPU_SUPPORTS_HUGEPAGES
1466 select WEAK_ORDERING 1431 select WEAK_ORDERING
1467 1432
1468config CPU_CAVIUM_OCTEON 1433config CPU_CAVIUM_OCTEON
@@ -1526,9 +1491,9 @@ config CPU_XLR
1526 select CPU_SUPPORTS_32BIT_KERNEL 1491 select CPU_SUPPORTS_32BIT_KERNEL
1527 select CPU_SUPPORTS_64BIT_KERNEL 1492 select CPU_SUPPORTS_64BIT_KERNEL
1528 select CPU_SUPPORTS_HIGHMEM 1493 select CPU_SUPPORTS_HIGHMEM
1494 select CPU_SUPPORTS_HUGEPAGES
1529 select WEAK_ORDERING 1495 select WEAK_ORDERING
1530 select WEAK_REORDERING_BEYOND_LLSC 1496 select WEAK_REORDERING_BEYOND_LLSC
1531 select CPU_SUPPORTS_HUGEPAGES
1532 help 1497 help
1533 Netlogic Microsystems XLR/XLS processors. 1498 Netlogic Microsystems XLR/XLS processors.
1534 1499
@@ -1590,6 +1555,7 @@ config CPU_LOONGSON2
1590 select CPU_SUPPORTS_32BIT_KERNEL 1555 select CPU_SUPPORTS_32BIT_KERNEL
1591 select CPU_SUPPORTS_64BIT_KERNEL 1556 select CPU_SUPPORTS_64BIT_KERNEL
1592 select CPU_SUPPORTS_HIGHMEM 1557 select CPU_SUPPORTS_HIGHMEM
1558 select CPU_SUPPORTS_HUGEPAGES
1593 1559
1594config CPU_LOONGSON1 1560config CPU_LOONGSON1
1595 bool 1561 bool
@@ -1674,9 +1640,6 @@ config SYS_HAS_CPU_R10000
1674config SYS_HAS_CPU_RM7000 1640config SYS_HAS_CPU_RM7000
1675 bool 1641 bool
1676 1642
1677config SYS_HAS_CPU_RM9000
1678 bool
1679
1680config SYS_HAS_CPU_SB1 1643config SYS_HAS_CPU_SB1
1681 bool 1644 bool
1682 1645
@@ -2365,6 +2328,29 @@ config KEXEC
2365 support. As of this writing the exact hardware interface is 2328 support. As of this writing the exact hardware interface is
2366 strongly in flux, so no good recommendation can be made. 2329 strongly in flux, so no good recommendation can be made.
2367 2330
2331config CRASH_DUMP
2332 bool "Kernel crash dumps"
2333 help
2334 Generate crash dump after being started by kexec.
2335 This should be normally only set in special crash dump kernels
2336 which are loaded in the main kernel with kexec-tools into
2337 a specially reserved region and then later executed after
2338 a crash by kdump/kexec. The crash dump kernel must be compiled
2339 to a memory address not used by the main kernel or firmware using
2340 PHYSICAL_START.
2341
2342config PHYSICAL_START
2343 hex "Physical address where the kernel is loaded"
2344 default "0xffffffff84000000" if 64BIT
2345 default "0x84000000" if 32BIT
2346 depends on CRASH_DUMP
2347 help
2348 This gives the CKSEG0 or KSEG0 address where the kernel is loaded.
2349 If you plan to use kernel for capturing the crash dump change
2350 this value to start of the reserved region (the "X" value as
2351 specified in the "crashkernel=YM@XM" command line boot parameter
2352 passed to the panic-ed kernel).
2353
2368config SECCOMP 2354config SECCOMP
2369 bool "Enable seccomp to safely compute untrusted bytecode" 2355 bool "Enable seccomp to safely compute untrusted bytecode"
2370 depends on PROC_FS 2356 depends on PROC_FS
@@ -2571,6 +2557,8 @@ source "net/Kconfig"
2571 2557
2572source "drivers/Kconfig" 2558source "drivers/Kconfig"
2573 2559
2560source "drivers/firmware/Kconfig"
2561
2574source "fs/Kconfig" 2562source "fs/Kconfig"
2575 2563
2576source "arch/mips/Kconfig.debug" 2564source "arch/mips/Kconfig.debug"
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 654b1ad39f05..f2dfd404550c 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -145,8 +145,6 @@ cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
145 -Wa,--trap 145 -Wa,--trap
146cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \ 146cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
147 -Wa,--trap 147 -Wa,--trap
148cflags-$(CONFIG_CPU_RM9000) += $(call cc-option,-march=rm9000,-march=r5000) \
149 -Wa,--trap
150cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \ 148cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \
151 -Wa,--trap 149 -Wa,--trap
152cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap 150cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap
@@ -173,9 +171,9 @@ endif
173# 171#
174# Firmware support 172# Firmware support
175# 173#
176libs-$(CONFIG_ARC) += arch/mips/fw/arc/ 174libs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/
177libs-$(CONFIG_CFE) += arch/mips/fw/cfe/ 175libs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/
178libs-$(CONFIG_SNIPROM) += arch/mips/fw/sni/ 176libs-$(CONFIG_FW_SNIPROM) += arch/mips/fw/sni/
179libs-y += arch/mips/fw/lib/ 177libs-y += arch/mips/fw/lib/
180 178
181# 179#
@@ -192,6 +190,10 @@ endif
192# 190#
193include $(srctree)/arch/mips/Kbuild.platforms 191include $(srctree)/arch/mips/Kbuild.platforms
194 192
193ifdef CONFIG_PHYSICAL_START
194load-y = $(CONFIG_PHYSICAL_START)
195endif
196
195cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic 197cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
196drivers-$(CONFIG_PCI) += arch/mips/pci/ 198drivers-$(CONFIG_PCI) += arch/mips/pci/
197 199
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 1bbc24b08685..7477fd2127ad 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -202,8 +202,11 @@ static struct resource physmap_flash_resource = {
202 .end = 0x107fffff, 202 .end = 0x107fffff,
203}; 203};
204 204
205static const char *ar7_probe_types[] = { "ar7part", NULL };
206
205static struct physmap_flash_data physmap_flash_data = { 207static struct physmap_flash_data physmap_flash_data = {
206 .width = 2, 208 .width = 2,
209 .part_probe_types = ar7_probe_types,
207}; 210};
208 211
209static struct platform_device physmap_flash = { 212static struct platform_device physmap_flash = {
diff --git a/arch/mips/cavium-octeon/executive/cvmx-bootmem.c b/arch/mips/cavium-octeon/executive/cvmx-bootmem.c
index fdf5f19bfdb0..6d5ddbc112cc 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-bootmem.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-bootmem.c
@@ -688,3 +688,8 @@ int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr,
688 cvmx_spinlock_unlock((cvmx_spinlock_t *)&(cvmx_bootmem_desc->lock)); 688 cvmx_spinlock_unlock((cvmx_spinlock_t *)&(cvmx_bootmem_desc->lock));
689 return addr_allocated; 689 return addr_allocated;
690} 690}
691
692struct cvmx_bootmem_desc *cvmx_bootmem_get_desc(void)
693{
694 return cvmx_bootmem_desc;
695}
diff --git a/arch/mips/cavium-octeon/executive/cvmx-l2c.c b/arch/mips/cavium-octeon/executive/cvmx-l2c.c
index d38246e33ddb..9f883bf76953 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-l2c.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-l2c.c
@@ -30,6 +30,7 @@
30 * measurement, and debugging facilities. 30 * measurement, and debugging facilities.
31 */ 31 */
32 32
33#include <linux/irqflags.h>
33#include <asm/octeon/cvmx.h> 34#include <asm/octeon/cvmx.h>
34#include <asm/octeon/cvmx-l2c.h> 35#include <asm/octeon/cvmx-l2c.h>
35#include <asm/octeon/cvmx-spinlock.h> 36#include <asm/octeon/cvmx-spinlock.h>
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 02b15eed4bcd..46f5dbceeecc 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -1266,7 +1266,6 @@ static void __init octeon_irq_init_ciu(void)
1266 octeon_irq_force_ciu_mapping(ciu_domain, i + OCTEON_IRQ_TIMER0, 0, i + 52); 1266 octeon_irq_force_ciu_mapping(ciu_domain, i + OCTEON_IRQ_TIMER0, 0, i + 52);
1267 1267
1268 octeon_irq_force_ciu_mapping(ciu_domain, OCTEON_IRQ_USB0, 0, 56); 1268 octeon_irq_force_ciu_mapping(ciu_domain, OCTEON_IRQ_USB0, 0, 56);
1269 octeon_irq_force_ciu_mapping(ciu_domain, OCTEON_IRQ_BOOTDMA, 0, 63);
1270 1269
1271 /* CIU_1 */ 1270 /* CIU_1 */
1272 for (i = 0; i < 16; i++) 1271 for (i = 0; i < 16; i++)
diff --git a/arch/mips/cavium-octeon/octeon-memcpy.S b/arch/mips/cavium-octeon/octeon-memcpy.S
index db478dbb9c7b..0ba0eb96d9ac 100644
--- a/arch/mips/cavium-octeon/octeon-memcpy.S
+++ b/arch/mips/cavium-octeon/octeon-memcpy.S
@@ -79,11 +79,6 @@
79/* 79/*
80 * Only on the 64-bit kernel we can made use of 64-bit registers. 80 * Only on the 64-bit kernel we can made use of 64-bit registers.
81 */ 81 */
82#ifdef CONFIG_64BIT
83#define USE_DOUBLE
84#endif
85
86#ifdef USE_DOUBLE
87 82
88#define LOAD ld 83#define LOAD ld
89#define LOADL ldl 84#define LOADL ldl
@@ -119,26 +114,6 @@
119#define t6 $14 114#define t6 $14
120#define t7 $15 115#define t7 $15
121 116
122#else
123
124#define LOAD lw
125#define LOADL lwl
126#define LOADR lwr
127#define STOREL swl
128#define STORER swr
129#define STORE sw
130#define ADD addu
131#define SUB subu
132#define SRL srl
133#define SLL sll
134#define SRA sra
135#define SLLV sllv
136#define SRLV srlv
137#define NBYTES 4
138#define LOG_NBYTES 2
139
140#endif /* USE_DOUBLE */
141
142#ifdef CONFIG_CPU_LITTLE_ENDIAN 117#ifdef CONFIG_CPU_LITTLE_ENDIAN
143#define LDFIRST LOADR 118#define LDFIRST LOADR
144#define LDREST LOADL 119#define LDREST LOADL
@@ -395,12 +370,10 @@ EXC( sb t0, N(dst), s_exc_p1)
395 370
396 COPY_BYTE(0) 371 COPY_BYTE(0)
397 COPY_BYTE(1) 372 COPY_BYTE(1)
398#ifdef USE_DOUBLE
399 COPY_BYTE(2) 373 COPY_BYTE(2)
400 COPY_BYTE(3) 374 COPY_BYTE(3)
401 COPY_BYTE(4) 375 COPY_BYTE(4)
402 COPY_BYTE(5) 376 COPY_BYTE(5)
403#endif
404EXC( lb t0, NBYTES-2(src), l_exc) 377EXC( lb t0, NBYTES-2(src), l_exc)
405 SUB len, len, 1 378 SUB len, len, 1
406 jr ra 379 jr ra
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 0938df10a71c..3c1b625a5859 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -24,108 +24,6 @@
24#include <asm/octeon/cvmx-helper.h> 24#include <asm/octeon/cvmx-helper.h>
25#include <asm/octeon/cvmx-helper-board.h> 25#include <asm/octeon/cvmx-helper-board.h>
26 26
27static struct octeon_cf_data octeon_cf_data;
28
29static int __init octeon_cf_device_init(void)
30{
31 union cvmx_mio_boot_reg_cfgx mio_boot_reg_cfg;
32 unsigned long base_ptr, region_base, region_size;
33 struct platform_device *pd;
34 struct resource cf_resources[3];
35 unsigned int num_resources;
36 int i;
37 int ret = 0;
38
39 /* Setup octeon-cf platform device if present. */
40 base_ptr = 0;
41 if (octeon_bootinfo->major_version == 1
42 && octeon_bootinfo->minor_version >= 1) {
43 if (octeon_bootinfo->compact_flash_common_base_addr)
44 base_ptr =
45 octeon_bootinfo->compact_flash_common_base_addr;
46 } else {
47 base_ptr = 0x1d000800;
48 }
49
50 if (!base_ptr)
51 return ret;
52
53 /* Find CS0 region. */
54 for (i = 0; i < 8; i++) {
55 mio_boot_reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(i));
56 region_base = mio_boot_reg_cfg.s.base << 16;
57 region_size = (mio_boot_reg_cfg.s.size + 1) << 16;
58 if (mio_boot_reg_cfg.s.en && base_ptr >= region_base
59 && base_ptr < region_base + region_size)
60 break;
61 }
62 if (i >= 7) {
63 /* i and i + 1 are CS0 and CS1, both must be less than 8. */
64 goto out;
65 }
66 octeon_cf_data.base_region = i;
67 octeon_cf_data.is16bit = mio_boot_reg_cfg.s.width;
68 octeon_cf_data.base_region_bias = base_ptr - region_base;
69 memset(cf_resources, 0, sizeof(cf_resources));
70 num_resources = 0;
71 cf_resources[num_resources].flags = IORESOURCE_MEM;
72 cf_resources[num_resources].start = region_base;
73 cf_resources[num_resources].end = region_base + region_size - 1;
74 num_resources++;
75
76
77 if (!(base_ptr & 0xfffful)) {
78 /*
79 * Boot loader signals availability of DMA (true_ide
80 * mode) by setting low order bits of base_ptr to
81 * zero.
82 */
83
84 /* Assume that CS1 immediately follows. */
85 mio_boot_reg_cfg.u64 =
86 cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(i + 1));
87 region_base = mio_boot_reg_cfg.s.base << 16;
88 region_size = (mio_boot_reg_cfg.s.size + 1) << 16;
89 if (!mio_boot_reg_cfg.s.en)
90 goto out;
91
92 cf_resources[num_resources].flags = IORESOURCE_MEM;
93 cf_resources[num_resources].start = region_base;
94 cf_resources[num_resources].end = region_base + region_size - 1;
95 num_resources++;
96
97 octeon_cf_data.dma_engine = 0;
98 cf_resources[num_resources].flags = IORESOURCE_IRQ;
99 cf_resources[num_resources].start = OCTEON_IRQ_BOOTDMA;
100 cf_resources[num_resources].end = OCTEON_IRQ_BOOTDMA;
101 num_resources++;
102 } else {
103 octeon_cf_data.dma_engine = -1;
104 }
105
106 pd = platform_device_alloc("pata_octeon_cf", -1);
107 if (!pd) {
108 ret = -ENOMEM;
109 goto out;
110 }
111 pd->dev.platform_data = &octeon_cf_data;
112
113 ret = platform_device_add_resources(pd, cf_resources, num_resources);
114 if (ret)
115 goto fail;
116
117 ret = platform_device_add(pd);
118 if (ret)
119 goto fail;
120
121 return ret;
122fail:
123 platform_device_put(pd);
124out:
125 return ret;
126}
127device_initcall(octeon_cf_device_init);
128
129/* Octeon Random Number Generator. */ 27/* Octeon Random Number Generator. */
130static int __init octeon_rng_device_init(void) 28static int __init octeon_rng_device_init(void)
131{ 29{
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 04dd8ff0e0d8..d7e0a09f77c2 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -4,9 +4,11 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2004-2007 Cavium Networks 6 * Copyright (C) 2004-2007 Cavium Networks
7 * Copyright (C) 2008 Wind River Systems 7 * Copyright (C) 2008, 2009 Wind River Systems
8 * written by Ralf Baechle <ralf@linux-mips.org>
8 */ 9 */
9#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/kernel.h>
10#include <linux/console.h> 12#include <linux/console.h>
11#include <linux/delay.h> 13#include <linux/delay.h>
12#include <linux/export.h> 14#include <linux/export.h>
@@ -23,6 +25,7 @@
23#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
24#include <linux/of_fdt.h> 26#include <linux/of_fdt.h>
25#include <linux/libfdt.h> 27#include <linux/libfdt.h>
28#include <linux/kexec.h>
26 29
27#include <asm/processor.h> 30#include <asm/processor.h>
28#include <asm/reboot.h> 31#include <asm/reboot.h>
@@ -56,11 +59,208 @@ struct octeon_boot_descriptor *octeon_boot_desc_ptr;
56struct cvmx_bootinfo *octeon_bootinfo; 59struct cvmx_bootinfo *octeon_bootinfo;
57EXPORT_SYMBOL(octeon_bootinfo); 60EXPORT_SYMBOL(octeon_bootinfo);
58 61
62static unsigned long long RESERVE_LOW_MEM = 0ull;
63#ifdef CONFIG_KEXEC
64#ifdef CONFIG_SMP
65/*
66 * Wait for relocation code is prepared and send
67 * secondary CPUs to spin until kernel is relocated.
68 */
69static void octeon_kexec_smp_down(void *ignored)
70{
71 int cpu = smp_processor_id();
72
73 local_irq_disable();
74 set_cpu_online(cpu, false);
75 while (!atomic_read(&kexec_ready_to_reboot))
76 cpu_relax();
77
78 asm volatile (
79 " sync \n"
80 " synci ($0) \n");
81
82 relocated_kexec_smp_wait(NULL);
83}
84#endif
85
86#define OCTEON_DDR0_BASE (0x0ULL)
87#define OCTEON_DDR0_SIZE (0x010000000ULL)
88#define OCTEON_DDR1_BASE (0x410000000ULL)
89#define OCTEON_DDR1_SIZE (0x010000000ULL)
90#define OCTEON_DDR2_BASE (0x020000000ULL)
91#define OCTEON_DDR2_SIZE (0x3e0000000ULL)
92#define OCTEON_MAX_PHY_MEM_SIZE (16*1024*1024*1024ULL)
93
94static struct kimage *kimage_ptr;
95
96static void kexec_bootmem_init(uint64_t mem_size, uint32_t low_reserved_bytes)
97{
98 int64_t addr;
99 struct cvmx_bootmem_desc *bootmem_desc;
100
101 bootmem_desc = cvmx_bootmem_get_desc();
102
103 if (mem_size > OCTEON_MAX_PHY_MEM_SIZE) {
104 mem_size = OCTEON_MAX_PHY_MEM_SIZE;
105 pr_err("Error: requested memory too large,"
106 "truncating to maximum size\n");
107 }
108
109 bootmem_desc->major_version = CVMX_BOOTMEM_DESC_MAJ_VER;
110 bootmem_desc->minor_version = CVMX_BOOTMEM_DESC_MIN_VER;
111
112 addr = (OCTEON_DDR0_BASE + RESERVE_LOW_MEM + low_reserved_bytes);
113 bootmem_desc->head_addr = 0;
114
115 if (mem_size <= OCTEON_DDR0_SIZE) {
116 __cvmx_bootmem_phy_free(addr,
117 mem_size - RESERVE_LOW_MEM -
118 low_reserved_bytes, 0);
119 return;
120 }
121
122 __cvmx_bootmem_phy_free(addr,
123 OCTEON_DDR0_SIZE - RESERVE_LOW_MEM -
124 low_reserved_bytes, 0);
125
126 mem_size -= OCTEON_DDR0_SIZE;
127
128 if (mem_size > OCTEON_DDR1_SIZE) {
129 __cvmx_bootmem_phy_free(OCTEON_DDR1_BASE, OCTEON_DDR1_SIZE, 0);
130 __cvmx_bootmem_phy_free(OCTEON_DDR2_BASE,
131 mem_size - OCTEON_DDR1_SIZE, 0);
132 } else
133 __cvmx_bootmem_phy_free(OCTEON_DDR1_BASE, mem_size, 0);
134}
135
136static int octeon_kexec_prepare(struct kimage *image)
137{
138 int i;
139 char *bootloader = "kexec";
140
141 octeon_boot_desc_ptr->argc = 0;
142 for (i = 0; i < image->nr_segments; i++) {
143 if (!strncmp(bootloader, (char *)image->segment[i].buf,
144 strlen(bootloader))) {
145 /*
146 * convert command line string to array
147 * of parameters (as bootloader does).
148 */
149 int argc = 0, offt;
150 char *str = (char *)image->segment[i].buf;
151 char *ptr = strchr(str, ' ');
152 while (ptr && (OCTEON_ARGV_MAX_ARGS > argc)) {
153 *ptr = '\0';
154 if (ptr[1] != ' ') {
155 offt = (int)(ptr - str + 1);
156 octeon_boot_desc_ptr->argv[argc] =
157 image->segment[i].mem + offt;
158 argc++;
159 }
160 ptr = strchr(ptr + 1, ' ');
161 }
162 octeon_boot_desc_ptr->argc = argc;
163 break;
164 }
165 }
166
167 /*
168 * Information about segments will be needed during pre-boot memory
169 * initialization.
170 */
171 kimage_ptr = image;
172 return 0;
173}
174
175static void octeon_generic_shutdown(void)
176{
177 int cpu, i;
178 struct cvmx_bootmem_desc *bootmem_desc;
179 void *named_block_array_ptr;
180
181 bootmem_desc = cvmx_bootmem_get_desc();
182 named_block_array_ptr =
183 cvmx_phys_to_ptr(bootmem_desc->named_block_array_addr);
184
185#ifdef CONFIG_SMP
186 /* disable watchdogs */
187 for_each_online_cpu(cpu)
188 cvmx_write_csr(CVMX_CIU_WDOGX(cpu_logical_map(cpu)), 0);
189#else
190 cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
191#endif
192 if (kimage_ptr != kexec_crash_image) {
193 memset(named_block_array_ptr,
194 0x0,
195 CVMX_BOOTMEM_NUM_NAMED_BLOCKS *
196 sizeof(struct cvmx_bootmem_named_block_desc));
197 /*
198 * Mark all memory (except low 0x100000 bytes) as free.
199 * It is the same thing that bootloader does.
200 */
201 kexec_bootmem_init(octeon_bootinfo->dram_size*1024ULL*1024ULL,
202 0x100000);
203 /*
204 * Allocate all segments to avoid their corruption during boot.
205 */
206 for (i = 0; i < kimage_ptr->nr_segments; i++)
207 cvmx_bootmem_alloc_address(
208 kimage_ptr->segment[i].memsz + 2*PAGE_SIZE,
209 kimage_ptr->segment[i].mem - PAGE_SIZE,
210 PAGE_SIZE);
211 } else {
212 /*
213 * Do not mark all memory as free. Free only named sections
214 * leaving the rest of memory unchanged.
215 */
216 struct cvmx_bootmem_named_block_desc *ptr =
217 (struct cvmx_bootmem_named_block_desc *)
218 named_block_array_ptr;
219
220 for (i = 0; i < bootmem_desc->named_block_num_blocks; i++)
221 if (ptr[i].size)
222 cvmx_bootmem_free_named(ptr[i].name);
223 }
224 kexec_args[2] = 1UL; /* running on octeon_main_processor */
225 kexec_args[3] = (unsigned long)octeon_boot_desc_ptr;
226#ifdef CONFIG_SMP
227 secondary_kexec_args[2] = 0UL; /* running on secondary cpu */
228 secondary_kexec_args[3] = (unsigned long)octeon_boot_desc_ptr;
229#endif
230}
231
232static void octeon_shutdown(void)
233{
234 octeon_generic_shutdown();
235#ifdef CONFIG_SMP
236 smp_call_function(octeon_kexec_smp_down, NULL, 0);
237 smp_wmb();
238 while (num_online_cpus() > 1) {
239 cpu_relax();
240 mdelay(1);
241 }
242#endif
243}
244
245static void octeon_crash_shutdown(struct pt_regs *regs)
246{
247 octeon_generic_shutdown();
248 default_machine_crash_shutdown(regs);
249}
250
251#endif /* CONFIG_KEXEC */
252
59#ifdef CONFIG_CAVIUM_RESERVE32 253#ifdef CONFIG_CAVIUM_RESERVE32
60uint64_t octeon_reserve32_memory; 254uint64_t octeon_reserve32_memory;
61EXPORT_SYMBOL(octeon_reserve32_memory); 255EXPORT_SYMBOL(octeon_reserve32_memory);
62#endif 256#endif
63 257
258#ifdef CONFIG_KEXEC
259/* crashkernel cmdline parameter is parsed _after_ memory setup
260 * we also parse it here (workaround for EHB5200) */
261static uint64_t crashk_size, crashk_base;
262#endif
263
64static int octeon_uart; 264static int octeon_uart;
65 265
66extern asmlinkage void handle_int(void); 266extern asmlinkage void handle_int(void);
@@ -415,6 +615,8 @@ void octeon_user_io_init(void)
415void __init prom_init(void) 615void __init prom_init(void)
416{ 616{
417 struct cvmx_sysinfo *sysinfo; 617 struct cvmx_sysinfo *sysinfo;
618 const char *arg;
619 char *p;
418 int i; 620 int i;
419 int argc; 621 int argc;
420#ifdef CONFIG_CAVIUM_RESERVE32 622#ifdef CONFIG_CAVIUM_RESERVE32
@@ -566,6 +768,15 @@ void __init prom_init(void)
566 if (octeon_is_simulation()) 768 if (octeon_is_simulation())
567 MAX_MEMORY = 64ull << 20; 769 MAX_MEMORY = 64ull << 20;
568 770
771 arg = strstr(arcs_cmdline, "mem=");
772 if (arg) {
773 MAX_MEMORY = memparse(arg + 4, &p);
774 if (MAX_MEMORY == 0)
775 MAX_MEMORY = 32ull << 30;
776 if (*p == '@')
777 RESERVE_LOW_MEM = memparse(p + 1, &p);
778 }
779
569 arcs_cmdline[0] = 0; 780 arcs_cmdline[0] = 0;
570 argc = octeon_boot_desc_ptr->argc; 781 argc = octeon_boot_desc_ptr->argc;
571 for (i = 0; i < argc; i++) { 782 for (i = 0; i < argc; i++) {
@@ -573,16 +784,30 @@ void __init prom_init(void)
573 cvmx_phys_to_ptr(octeon_boot_desc_ptr->argv[i]); 784 cvmx_phys_to_ptr(octeon_boot_desc_ptr->argv[i]);
574 if ((strncmp(arg, "MEM=", 4) == 0) || 785 if ((strncmp(arg, "MEM=", 4) == 0) ||
575 (strncmp(arg, "mem=", 4) == 0)) { 786 (strncmp(arg, "mem=", 4) == 0)) {
576 sscanf(arg + 4, "%llu", &MAX_MEMORY); 787 MAX_MEMORY = memparse(arg + 4, &p);
577 MAX_MEMORY <<= 20;
578 if (MAX_MEMORY == 0) 788 if (MAX_MEMORY == 0)
579 MAX_MEMORY = 32ull << 30; 789 MAX_MEMORY = 32ull << 30;
790 if (*p == '@')
791 RESERVE_LOW_MEM = memparse(p + 1, &p);
580 } else if (strcmp(arg, "ecc_verbose") == 0) { 792 } else if (strcmp(arg, "ecc_verbose") == 0) {
581#ifdef CONFIG_CAVIUM_REPORT_SINGLE_BIT_ECC 793#ifdef CONFIG_CAVIUM_REPORT_SINGLE_BIT_ECC
582 __cvmx_interrupt_ecc_report_single_bit_errors = 1; 794 __cvmx_interrupt_ecc_report_single_bit_errors = 1;
583 pr_notice("Reporting of single bit ECC errors is " 795 pr_notice("Reporting of single bit ECC errors is "
584 "turned on\n"); 796 "turned on\n");
585#endif 797#endif
798#ifdef CONFIG_KEXEC
799 } else if (strncmp(arg, "crashkernel=", 12) == 0) {
800 crashk_size = memparse(arg+12, &p);
801 if (*p == '@')
802 crashk_base = memparse(p+1, &p);
803 strcat(arcs_cmdline, " ");
804 strcat(arcs_cmdline, arg);
805 /*
806 * To do: switch parsing to new style, something like:
807 * parse_crashkernel(arg, sysinfo->system_dram_size,
808 * &crashk_size, &crashk_base);
809 */
810#endif
586 } else if (strlen(arcs_cmdline) + strlen(arg) + 1 < 811 } else if (strlen(arcs_cmdline) + strlen(arg) + 1 <
587 sizeof(arcs_cmdline) - 1) { 812 sizeof(arcs_cmdline) - 1) {
588 strcat(arcs_cmdline, " "); 813 strcat(arcs_cmdline, " ");
@@ -617,11 +842,18 @@ void __init prom_init(void)
617 _machine_restart = octeon_restart; 842 _machine_restart = octeon_restart;
618 _machine_halt = octeon_halt; 843 _machine_halt = octeon_halt;
619 844
845#ifdef CONFIG_KEXEC
846 _machine_kexec_shutdown = octeon_shutdown;
847 _machine_crash_shutdown = octeon_crash_shutdown;
848 _machine_kexec_prepare = octeon_kexec_prepare;
849#endif
850
620 octeon_user_io_init(); 851 octeon_user_io_init();
621 register_smp_ops(&octeon_smp_ops); 852 register_smp_ops(&octeon_smp_ops);
622} 853}
623 854
624/* Exclude a single page from the regions obtained in plat_mem_setup. */ 855/* Exclude a single page from the regions obtained in plat_mem_setup. */
856#ifndef CONFIG_CRASH_DUMP
625static __init void memory_exclude_page(u64 addr, u64 *mem, u64 *size) 857static __init void memory_exclude_page(u64 addr, u64 *mem, u64 *size)
626{ 858{
627 if (addr > *mem && addr < *mem + *size) { 859 if (addr > *mem && addr < *mem + *size) {
@@ -636,14 +868,21 @@ static __init void memory_exclude_page(u64 addr, u64 *mem, u64 *size)
636 *size -= PAGE_SIZE; 868 *size -= PAGE_SIZE;
637 } 869 }
638} 870}
871#endif /* CONFIG_CRASH_DUMP */
639 872
640void __init plat_mem_setup(void) 873void __init plat_mem_setup(void)
641{ 874{
642 uint64_t mem_alloc_size; 875 uint64_t mem_alloc_size;
643 uint64_t total; 876 uint64_t total;
877 uint64_t crashk_end;
878#ifndef CONFIG_CRASH_DUMP
644 int64_t memory; 879 int64_t memory;
880 uint64_t kernel_start;
881 uint64_t kernel_size;
882#endif
645 883
646 total = 0; 884 total = 0;
885 crashk_end = 0;
647 886
648 /* 887 /*
649 * The Mips memory init uses the first memory location for 888 * The Mips memory init uses the first memory location for
@@ -656,6 +895,17 @@ void __init plat_mem_setup(void)
656 if (mem_alloc_size > MAX_MEMORY) 895 if (mem_alloc_size > MAX_MEMORY)
657 mem_alloc_size = MAX_MEMORY; 896 mem_alloc_size = MAX_MEMORY;
658 897
898/* Crashkernel ignores bootmem list. It relies on mem=X@Y option */
899#ifdef CONFIG_CRASH_DUMP
900 add_memory_region(RESERVE_LOW_MEM, MAX_MEMORY, BOOT_MEM_RAM);
901 total += MAX_MEMORY;
902#else
903#ifdef CONFIG_KEXEC
904 if (crashk_size > 0) {
905 add_memory_region(crashk_base, crashk_size, BOOT_MEM_RAM);
906 crashk_end = crashk_base + crashk_size;
907 }
908#endif
659 /* 909 /*
660 * When allocating memory, we want incrementing addresses from 910 * When allocating memory, we want incrementing addresses from
661 * bootmem_alloc so the code in add_memory_region can merge 911 * bootmem_alloc so the code in add_memory_region can merge
@@ -664,22 +914,15 @@ void __init plat_mem_setup(void)
664 cvmx_bootmem_lock(); 914 cvmx_bootmem_lock();
665 while ((boot_mem_map.nr_map < BOOT_MEM_MAP_MAX) 915 while ((boot_mem_map.nr_map < BOOT_MEM_MAP_MAX)
666 && (total < MAX_MEMORY)) { 916 && (total < MAX_MEMORY)) {
667#if defined(CONFIG_64BIT) || defined(CONFIG_64BIT_PHYS_ADDR)
668 memory = cvmx_bootmem_phy_alloc(mem_alloc_size, 917 memory = cvmx_bootmem_phy_alloc(mem_alloc_size,
669 __pa_symbol(&__init_end), -1, 918 __pa_symbol(&__init_end), -1,
670 0x100000, 919 0x100000,
671 CVMX_BOOTMEM_FLAG_NO_LOCKING); 920 CVMX_BOOTMEM_FLAG_NO_LOCKING);
672#elif defined(CONFIG_HIGHMEM)
673 memory = cvmx_bootmem_phy_alloc(mem_alloc_size, 0, 1ull << 31,
674 0x100000,
675 CVMX_BOOTMEM_FLAG_NO_LOCKING);
676#else
677 memory = cvmx_bootmem_phy_alloc(mem_alloc_size, 0, 512 << 20,
678 0x100000,
679 CVMX_BOOTMEM_FLAG_NO_LOCKING);
680#endif
681 if (memory >= 0) { 921 if (memory >= 0) {
682 u64 size = mem_alloc_size; 922 u64 size = mem_alloc_size;
923#ifdef CONFIG_KEXEC
924 uint64_t end;
925#endif
683 926
684 /* 927 /*
685 * exclude a page at the beginning and end of 928 * exclude a page at the beginning and end of
@@ -692,20 +935,67 @@ void __init plat_mem_setup(void)
692 memory_exclude_page(CVMX_PCIE_BAR1_PHYS_BASE + 935 memory_exclude_page(CVMX_PCIE_BAR1_PHYS_BASE +
693 CVMX_PCIE_BAR1_PHYS_SIZE, 936 CVMX_PCIE_BAR1_PHYS_SIZE,
694 &memory, &size); 937 &memory, &size);
938#ifdef CONFIG_KEXEC
939 end = memory + mem_alloc_size;
695 940
696 /* 941 /*
697 * This function automatically merges address 942 * This function automatically merges address regions
698 * regions next to each other if they are 943 * next to each other if they are received in
699 * received in incrementing order. 944 * incrementing order
700 */ 945 */
701 if (size) 946 if (memory < crashk_base && end > crashk_end) {
702 add_memory_region(memory, size, BOOT_MEM_RAM); 947 /* region is fully in */
948 add_memory_region(memory,
949 crashk_base - memory,
950 BOOT_MEM_RAM);
951 total += crashk_base - memory;
952 add_memory_region(crashk_end,
953 end - crashk_end,
954 BOOT_MEM_RAM);
955 total += end - crashk_end;
956 continue;
957 }
958
959 if (memory >= crashk_base && end <= crashk_end)
960 /*
961 * Entire memory region is within the new
962 * kernel's memory, ignore it.
963 */
964 continue;
965
966 if (memory > crashk_base && memory < crashk_end &&
967 end > crashk_end) {
968 /*
969 * Overlap with the beginning of the region,
970 * reserve the beginning.
971 */
972 mem_alloc_size -= crashk_end - memory;
973 memory = crashk_end;
974 } else if (memory < crashk_base && end > crashk_base &&
975 end < crashk_end)
976 /*
977 * Overlap with the beginning of the region,
978 * chop of end.
979 */
980 mem_alloc_size -= end - crashk_base;
981#endif
982 add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM);
703 total += mem_alloc_size; 983 total += mem_alloc_size;
984 /* Recovering mem_alloc_size */
985 mem_alloc_size = 4 << 20;
704 } else { 986 } else {
705 break; 987 break;
706 } 988 }
707 } 989 }
708 cvmx_bootmem_unlock(); 990 cvmx_bootmem_unlock();
991 /* Add the memory region for the kernel. */
992 kernel_start = (unsigned long) _text;
993 kernel_size = ALIGN(_end - _text, 0x100000);
994
995 /* Adjust for physical offset. */
996 kernel_start &= ~0xffffffff80000000ULL;
997 add_memory_region(kernel_start, kernel_size, BOOT_MEM_RAM);
998#endif /* CONFIG_CRASH_DUMP */
709 999
710#ifdef CONFIG_CAVIUM_RESERVE32 1000#ifdef CONFIG_CAVIUM_RESERVE32
711 /* 1001 /*
@@ -821,3 +1111,51 @@ void __init device_tree_init(void)
821 } 1111 }
822 unflatten_device_tree(); 1112 unflatten_device_tree();
823} 1113}
1114
1115static int __initdata disable_octeon_edac_p;
1116
1117static int __init disable_octeon_edac(char *str)
1118{
1119 disable_octeon_edac_p = 1;
1120 return 0;
1121}
1122early_param("disable_octeon_edac", disable_octeon_edac);
1123
1124static char *edac_device_names[] = {
1125 "octeon_l2c_edac",
1126 "octeon_pc_edac",
1127};
1128
1129static int __init edac_devinit(void)
1130{
1131 struct platform_device *dev;
1132 int i, err = 0;
1133 int num_lmc;
1134 char *name;
1135
1136 if (disable_octeon_edac_p)
1137 return 0;
1138
1139 for (i = 0; i < ARRAY_SIZE(edac_device_names); i++) {
1140 name = edac_device_names[i];
1141 dev = platform_device_register_simple(name, -1, NULL, 0);
1142 if (IS_ERR(dev)) {
1143 pr_err("Registation of %s failed!\n", name);
1144 err = PTR_ERR(dev);
1145 }
1146 }
1147
1148 num_lmc = OCTEON_IS_MODEL(OCTEON_CN68XX) ? 4 :
1149 (OCTEON_IS_MODEL(OCTEON_CN56XX) ? 2 : 1);
1150 for (i = 0; i < num_lmc; i++) {
1151 dev = platform_device_register_simple("octeon_lmc_edac",
1152 i, NULL, 0);
1153 if (IS_ERR(dev)) {
1154 pr_err("Registation of octeon_lmc_edac %d failed!\n", i);
1155 err = PTR_ERR(dev);
1156 }
1157 }
1158
1159 return err;
1160}
1161device_initcall(edac_devinit);
diff --git a/arch/mips/configs/cavium_octeon_defconfig b/arch/mips/configs/cavium_octeon_defconfig
index 75165dfa60c1..014ba4bbba7d 100644
--- a/arch/mips/configs/cavium_octeon_defconfig
+++ b/arch/mips/configs/cavium_octeon_defconfig
@@ -1,7 +1,11 @@
1CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD=y 1CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD=y
2CONFIG_CAVIUM_CN63XXP1=y
2CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2 3CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2
3CONFIG_SPARSEMEM_MANUAL=y 4CONFIG_SPARSEMEM_MANUAL=y
5CONFIG_TRANSPARENT_HUGEPAGE=y
4CONFIG_SMP=y 6CONFIG_SMP=y
7CONFIG_NR_CPUS=32
8CONFIG_HZ_100=y
5CONFIG_PREEMPT=y 9CONFIG_PREEMPT=y
6CONFIG_EXPERIMENTAL=y 10CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 11CONFIG_SYSVIPC=y
@@ -11,16 +15,15 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
11CONFIG_IKCONFIG=y 15CONFIG_IKCONFIG=y
12CONFIG_IKCONFIG_PROC=y 16CONFIG_IKCONFIG_PROC=y
13CONFIG_LOG_BUF_SHIFT=14 17CONFIG_LOG_BUF_SHIFT=14
14CONFIG_SYSFS_DEPRECATED_V2=y
15CONFIG_RELAY=y 18CONFIG_RELAY=y
16CONFIG_BLK_DEV_INITRD=y 19CONFIG_BLK_DEV_INITRD=y
17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
18CONFIG_EXPERT=y 20CONFIG_EXPERT=y
19# CONFIG_PCSPKR_PLATFORM is not set
20CONFIG_SLAB=y 21CONFIG_SLAB=y
21CONFIG_MODULES=y 22CONFIG_MODULES=y
22CONFIG_MODULE_UNLOAD=y 23CONFIG_MODULE_UNLOAD=y
23# CONFIG_BLK_DEV_BSG is not set 24# CONFIG_BLK_DEV_BSG is not set
25CONFIG_PCI=y
26CONFIG_PCI_MSI=y
24CONFIG_MIPS32_COMPAT=y 27CONFIG_MIPS32_COMPAT=y
25CONFIG_MIPS32_O32=y 28CONFIG_MIPS32_O32=y
26CONFIG_MIPS32_N32=y 29CONFIG_MIPS32_N32=y
@@ -42,22 +45,68 @@ CONFIG_IP_PIMSM_V1=y
42CONFIG_IP_PIMSM_V2=y 45CONFIG_IP_PIMSM_V2=y
43CONFIG_SYN_COOKIES=y 46CONFIG_SYN_COOKIES=y
44# CONFIG_INET_LRO is not set 47# CONFIG_INET_LRO is not set
45# CONFIG_IPV6 is not set 48CONFIG_IPV6=y
46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 49CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
47# CONFIG_FW_LOADER is not set 50# CONFIG_FW_LOADER is not set
48CONFIG_MTD=y 51CONFIG_MTD=y
49CONFIG_MTD_PARTITIONS=y 52# CONFIG_MTD_OF_PARTS is not set
50CONFIG_MTD_CHAR=y 53CONFIG_MTD_CHAR=y
51CONFIG_MTD_BLOCK=y 54CONFIG_MTD_BLOCK=y
52CONFIG_MTD_CFI=y 55CONFIG_MTD_CFI=y
53CONFIG_MTD_CFI_AMDSTD=y 56CONFIG_MTD_CFI_AMDSTD=y
54CONFIG_MTD_PHYSMAP=y 57CONFIG_MTD_SLRAM=y
58CONFIG_PROC_DEVICETREE=y
55CONFIG_BLK_DEV_LOOP=y 59CONFIG_BLK_DEV_LOOP=y
56# CONFIG_MISC_DEVICES is not set 60CONFIG_EEPROM_AT24=y
61CONFIG_EEPROM_AT25=y
62CONFIG_BLK_DEV_SD=y
63CONFIG_ATA=y
64CONFIG_SATA_AHCI=y
65CONFIG_PATA_OCTEON_CF=y
66CONFIG_SATA_SIL=y
57CONFIG_NETDEVICES=y 67CONFIG_NETDEVICES=y
58CONFIG_NET_ETHERNET=y
59CONFIG_MII=y 68CONFIG_MII=y
60# CONFIG_NETDEV_10000 is not set 69# CONFIG_NET_VENDOR_3COM is not set
70# CONFIG_NET_VENDOR_ADAPTEC is not set
71# CONFIG_NET_VENDOR_ALTEON is not set
72# CONFIG_NET_VENDOR_AMD is not set
73# CONFIG_NET_VENDOR_ATHEROS is not set
74# CONFIG_NET_VENDOR_BROADCOM is not set
75# CONFIG_NET_VENDOR_BROCADE is not set
76# CONFIG_NET_VENDOR_CHELSIO is not set
77# CONFIG_NET_VENDOR_CISCO is not set
78# CONFIG_NET_VENDOR_DEC is not set
79# CONFIG_NET_VENDOR_DLINK is not set
80# CONFIG_NET_VENDOR_EMULEX is not set
81# CONFIG_NET_VENDOR_EXAR is not set
82# CONFIG_NET_VENDOR_HP is not set
83# CONFIG_NET_VENDOR_INTEL is not set
84# CONFIG_NET_VENDOR_MARVELL is not set
85# CONFIG_NET_VENDOR_MELLANOX is not set
86# CONFIG_NET_VENDOR_MICREL is not set
87# CONFIG_NET_VENDOR_MYRI is not set
88# CONFIG_NET_VENDOR_NATSEMI is not set
89# CONFIG_NET_VENDOR_NVIDIA is not set
90# CONFIG_NET_VENDOR_OKI is not set
91# CONFIG_NET_PACKET_ENGINE is not set
92# CONFIG_NET_VENDOR_QLOGIC is not set
93# CONFIG_NET_VENDOR_REALTEK is not set
94# CONFIG_NET_VENDOR_RDC is not set
95# CONFIG_NET_VENDOR_SEEQ is not set
96# CONFIG_NET_VENDOR_SILAN is not set
97# CONFIG_NET_VENDOR_SIS is not set
98# CONFIG_NET_VENDOR_SMSC is not set
99# CONFIG_NET_VENDOR_STMICRO is not set
100# CONFIG_NET_VENDOR_SUN is not set
101# CONFIG_NET_VENDOR_TEHUTI is not set
102# CONFIG_NET_VENDOR_TI is not set
103# CONFIG_NET_VENDOR_TOSHIBA is not set
104# CONFIG_NET_VENDOR_VIA is not set
105# CONFIG_NET_VENDOR_WIZNET is not set
106CONFIG_MARVELL_PHY=y
107CONFIG_BROADCOM_PHY=y
108CONFIG_BCM87XX_PHY=y
109# CONFIG_WLAN is not set
61# CONFIG_INPUT is not set 110# CONFIG_INPUT is not set
62# CONFIG_SERIO is not set 111# CONFIG_SERIO is not set
63# CONFIG_VT is not set 112# CONFIG_VT is not set
@@ -66,24 +115,39 @@ CONFIG_SERIAL_8250_CONSOLE=y
66CONFIG_SERIAL_8250_NR_UARTS=2 115CONFIG_SERIAL_8250_NR_UARTS=2
67CONFIG_SERIAL_8250_RUNTIME_UARTS=2 116CONFIG_SERIAL_8250_RUNTIME_UARTS=2
68# CONFIG_HW_RANDOM is not set 117# CONFIG_HW_RANDOM is not set
118CONFIG_I2C=y
119CONFIG_I2C_OCTEON=y
120CONFIG_SPI=y
121CONFIG_SPI_OCTEON=y
69# CONFIG_HWMON is not set 122# CONFIG_HWMON is not set
70CONFIG_WATCHDOG=y 123CONFIG_WATCHDOG=y
71# CONFIG_USB_SUPPORT is not set 124# CONFIG_USB_SUPPORT is not set
125CONFIG_RTC_CLASS=y
126CONFIG_RTC_DRV_DS1307=y
127CONFIG_STAGING=y
128CONFIG_OCTEON_ETHERNET=y
129# CONFIG_NET_VENDOR_SILICOM is not set
130# CONFIG_IOMMU_SUPPORT is not set
131CONFIG_EXT4_FS=y
132CONFIG_EXT4_FS_POSIX_ACL=y
133CONFIG_EXT4_FS_SECURITY=y
134CONFIG_MSDOS_FS=y
135CONFIG_VFAT_FS=y
72CONFIG_PROC_KCORE=y 136CONFIG_PROC_KCORE=y
73CONFIG_TMPFS=y 137CONFIG_TMPFS=y
74# CONFIG_NETWORK_FILESYSTEMS is not set 138CONFIG_HUGETLBFS=y
75CONFIG_NLS=y 139CONFIG_NFS_FS=y
140CONFIG_NFS_V4=y
141CONFIG_NFS_V4_1=y
142CONFIG_ROOT_NFS=y
76CONFIG_NLS_CODEPAGE_437=y 143CONFIG_NLS_CODEPAGE_437=y
144CONFIG_NLS_ASCII=y
77CONFIG_NLS_ISO8859_1=y 145CONFIG_NLS_ISO8859_1=y
146CONFIG_NLS_UTF8=y
78CONFIG_MAGIC_SYSRQ=y 147CONFIG_MAGIC_SYSRQ=y
79CONFIG_DEBUG_FS=y 148CONFIG_DEBUG_FS=y
80CONFIG_DEBUG_KERNEL=y 149# CONFIG_SCHED_DEBUG is not set
81CONFIG_DEBUG_SPINLOCK=y
82CONFIG_DEBUG_SPINLOCK_SLEEP=y
83CONFIG_DEBUG_INFO=y 150CONFIG_DEBUG_INFO=y
84# CONFIG_RCU_CPU_STALL_DETECTOR is not set
85CONFIG_SYSCTL_SYSCALL_CHECK=y
86# CONFIG_EARLY_PRINTK is not set
87CONFIG_SECURITY=y 151CONFIG_SECURITY=y
88CONFIG_SECURITY_NETWORK=y 152CONFIG_SECURITY_NETWORK=y
89CONFIG_CRYPTO_CBC=y 153CONFIG_CRYPTO_CBC=y
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
deleted file mode 100644
index f72d305a3f08..000000000000
--- a/arch/mips/configs/yosemite_defconfig
+++ /dev/null
@@ -1,94 +0,0 @@
1CONFIG_PMC_YOSEMITE=y
2CONFIG_HIGHMEM=y
3CONFIG_SMP=y
4CONFIG_NR_CPUS=2
5CONFIG_HZ_1000=y
6CONFIG_SYSVIPC=y
7CONFIG_IKCONFIG=y
8CONFIG_IKCONFIG_PROC=y
9CONFIG_LOG_BUF_SHIFT=14
10CONFIG_RELAY=y
11CONFIG_EXPERT=y
12CONFIG_SLAB=y
13CONFIG_MODULES=y
14CONFIG_MODULE_UNLOAD=y
15CONFIG_PCI=y
16CONFIG_PM=y
17CONFIG_NET=y
18CONFIG_PACKET=m
19CONFIG_UNIX=y
20CONFIG_XFRM_USER=m
21CONFIG_INET=y
22CONFIG_IP_PNP=y
23CONFIG_IP_PNP_BOOTP=y
24CONFIG_INET_XFRM_MODE_TRANSPORT=m
25CONFIG_INET_XFRM_MODE_TUNNEL=m
26CONFIG_INET_XFRM_MODE_BEET=m
27CONFIG_IPV6_PRIVACY=y
28CONFIG_IPV6_ROUTER_PREF=y
29CONFIG_INET6_AH=m
30CONFIG_INET6_ESP=m
31CONFIG_INET6_IPCOMP=m
32CONFIG_IPV6_TUNNEL=m
33CONFIG_NETWORK_SECMARK=y
34CONFIG_FW_LOADER=m
35CONFIG_CONNECTOR=m
36CONFIG_CDROM_PKTCDVD=m
37CONFIG_ATA_OVER_ETH=m
38CONFIG_SGI_IOC4=m
39CONFIG_RAID_ATTRS=m
40CONFIG_NETDEVICES=y
41CONFIG_PHYLIB=m
42CONFIG_MARVELL_PHY=m
43CONFIG_DAVICOM_PHY=m
44CONFIG_QSEMI_PHY=m
45CONFIG_LXT_PHY=m
46CONFIG_CICADA_PHY=m
47CONFIG_VITESSE_PHY=m
48CONFIG_SMSC_PHY=m
49CONFIG_NET_ETHERNET=y
50CONFIG_MII=y
51CONFIG_QLA3XXX=m
52CONFIG_CHELSIO_T3=m
53CONFIG_NETXEN_NIC=m
54# CONFIG_INPUT is not set
55# CONFIG_SERIO is not set
56# CONFIG_VT is not set
57CONFIG_SERIAL_8250=y
58CONFIG_SERIAL_8250_CONSOLE=y
59# CONFIG_HW_RANDOM is not set
60# CONFIG_HWMON is not set
61CONFIG_FUSE_FS=m
62CONFIG_PROC_KCORE=y
63CONFIG_TMPFS=y
64CONFIG_TMPFS_POSIX_ACL=y
65CONFIG_NFS_FS=y
66CONFIG_ROOT_NFS=y
67CONFIG_DEBUG_KERNEL=y
68CONFIG_DEBUG_MUTEXES=y
69CONFIG_KEYS=y
70CONFIG_KEYS_DEBUG_PROC_KEYS=y
71CONFIG_CRYPTO_NULL=m
72CONFIG_CRYPTO_ECB=m
73CONFIG_CRYPTO_PCBC=m
74CONFIG_CRYPTO_HMAC=y
75CONFIG_CRYPTO_MD4=m
76CONFIG_CRYPTO_MICHAEL_MIC=m
77CONFIG_CRYPTO_SHA256=m
78CONFIG_CRYPTO_SHA512=m
79CONFIG_CRYPTO_TGR192=m
80CONFIG_CRYPTO_WP512=m
81CONFIG_CRYPTO_ANUBIS=m
82CONFIG_CRYPTO_ARC4=m
83CONFIG_CRYPTO_BLOWFISH=m
84CONFIG_CRYPTO_CAMELLIA=m
85CONFIG_CRYPTO_CAST5=m
86CONFIG_CRYPTO_CAST6=m
87CONFIG_CRYPTO_FCRYPT=m
88CONFIG_CRYPTO_KHAZAD=m
89CONFIG_CRYPTO_SERPENT=m
90CONFIG_CRYPTO_TEA=m
91CONFIG_CRYPTO_TWOFISH=m
92CONFIG_CRC16=m
93CONFIG_CRC32=m
94CONFIG_LIBCRC32C=m
diff --git a/arch/mips/fw/arc/misc.c b/arch/mips/fw/arc/misc.c
index 7cf80ca2c1d2..f9f5307434c2 100644
--- a/arch/mips/fw/arc/misc.c
+++ b/arch/mips/fw/arc/misc.c
@@ -11,6 +11,7 @@
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/irqflags.h>
14 15
15#include <asm/bcache.h> 16#include <asm/bcache.h>
16 17
diff --git a/arch/mips/fw/sni/Makefile b/arch/mips/fw/sni/Makefile
index d9740a3788e2..3f01dd36e6b7 100644
--- a/arch/mips/fw/sni/Makefile
+++ b/arch/mips/fw/sni/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the SNI prom monitor routines under Linux. 2# Makefile for the SNI prom monitor routines under Linux.
3# 3#
4 4
5lib-$(CONFIG_SNIPROM) += sniprom.o 5lib-$(CONFIG_FW_SNIPROM) += sniprom.o
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index 82ad35ce2b45..46ac73abd5ee 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -14,7 +14,6 @@
14#endif 14#endif
15 15
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/irqflags.h>
18#include <linux/types.h> 17#include <linux/types.h>
19#include <asm/barrier.h> 18#include <asm/barrier.h>
20#include <asm/byteorder.h> /* sigh ... */ 19#include <asm/byteorder.h> /* sigh ... */
@@ -44,6 +43,24 @@
44#define smp_mb__before_clear_bit() smp_mb__before_llsc() 43#define smp_mb__before_clear_bit() smp_mb__before_llsc()
45#define smp_mb__after_clear_bit() smp_llsc_mb() 44#define smp_mb__after_clear_bit() smp_llsc_mb()
46 45
46
47/*
48 * These are the "slower" versions of the functions and are in bitops.c.
49 * These functions call raw_local_irq_{save,restore}().
50 */
51void __mips_set_bit(unsigned long nr, volatile unsigned long *addr);
52void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr);
53void __mips_change_bit(unsigned long nr, volatile unsigned long *addr);
54int __mips_test_and_set_bit(unsigned long nr,
55 volatile unsigned long *addr);
56int __mips_test_and_set_bit_lock(unsigned long nr,
57 volatile unsigned long *addr);
58int __mips_test_and_clear_bit(unsigned long nr,
59 volatile unsigned long *addr);
60int __mips_test_and_change_bit(unsigned long nr,
61 volatile unsigned long *addr);
62
63
47/* 64/*
48 * set_bit - Atomically set a bit in memory 65 * set_bit - Atomically set a bit in memory
49 * @nr: the bit to set 66 * @nr: the bit to set
@@ -57,7 +74,7 @@
57static inline void set_bit(unsigned long nr, volatile unsigned long *addr) 74static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
58{ 75{
59 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 76 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
60 unsigned short bit = nr & SZLONG_MASK; 77 int bit = nr & SZLONG_MASK;
61 unsigned long temp; 78 unsigned long temp;
62 79
63 if (kernel_uses_llsc && R10000_LLSC_WAR) { 80 if (kernel_uses_llsc && R10000_LLSC_WAR) {
@@ -92,17 +109,8 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
92 : "=&r" (temp), "+m" (*m) 109 : "=&r" (temp), "+m" (*m)
93 : "ir" (1UL << bit)); 110 : "ir" (1UL << bit));
94 } while (unlikely(!temp)); 111 } while (unlikely(!temp));
95 } else { 112 } else
96 volatile unsigned long *a = addr; 113 __mips_set_bit(nr, addr);
97 unsigned long mask;
98 unsigned long flags;
99
100 a += nr >> SZLONG_LOG;
101 mask = 1UL << bit;
102 raw_local_irq_save(flags);
103 *a |= mask;
104 raw_local_irq_restore(flags);
105 }
106} 114}
107 115
108/* 116/*
@@ -118,7 +126,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
118static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) 126static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
119{ 127{
120 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 128 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
121 unsigned short bit = nr & SZLONG_MASK; 129 int bit = nr & SZLONG_MASK;
122 unsigned long temp; 130 unsigned long temp;
123 131
124 if (kernel_uses_llsc && R10000_LLSC_WAR) { 132 if (kernel_uses_llsc && R10000_LLSC_WAR) {
@@ -153,17 +161,8 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
153 : "=&r" (temp), "+m" (*m) 161 : "=&r" (temp), "+m" (*m)
154 : "ir" (~(1UL << bit))); 162 : "ir" (~(1UL << bit)));
155 } while (unlikely(!temp)); 163 } while (unlikely(!temp));
156 } else { 164 } else
157 volatile unsigned long *a = addr; 165 __mips_clear_bit(nr, addr);
158 unsigned long mask;
159 unsigned long flags;
160
161 a += nr >> SZLONG_LOG;
162 mask = 1UL << bit;
163 raw_local_irq_save(flags);
164 *a &= ~mask;
165 raw_local_irq_restore(flags);
166 }
167} 166}
168 167
169/* 168/*
@@ -191,7 +190,7 @@ static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *ad
191 */ 190 */
192static inline void change_bit(unsigned long nr, volatile unsigned long *addr) 191static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
193{ 192{
194 unsigned short bit = nr & SZLONG_MASK; 193 int bit = nr & SZLONG_MASK;
195 194
196 if (kernel_uses_llsc && R10000_LLSC_WAR) { 195 if (kernel_uses_llsc && R10000_LLSC_WAR) {
197 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 196 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
@@ -220,17 +219,8 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
220 : "=&r" (temp), "+m" (*m) 219 : "=&r" (temp), "+m" (*m)
221 : "ir" (1UL << bit)); 220 : "ir" (1UL << bit));
222 } while (unlikely(!temp)); 221 } while (unlikely(!temp));
223 } else { 222 } else
224 volatile unsigned long *a = addr; 223 __mips_change_bit(nr, addr);
225 unsigned long mask;
226 unsigned long flags;
227
228 a += nr >> SZLONG_LOG;
229 mask = 1UL << bit;
230 raw_local_irq_save(flags);
231 *a ^= mask;
232 raw_local_irq_restore(flags);
233 }
234} 224}
235 225
236/* 226/*
@@ -244,7 +234,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
244static inline int test_and_set_bit(unsigned long nr, 234static inline int test_and_set_bit(unsigned long nr,
245 volatile unsigned long *addr) 235 volatile unsigned long *addr)
246{ 236{
247 unsigned short bit = nr & SZLONG_MASK; 237 int bit = nr & SZLONG_MASK;
248 unsigned long res; 238 unsigned long res;
249 239
250 smp_mb__before_llsc(); 240 smp_mb__before_llsc();
@@ -281,18 +271,8 @@ static inline int test_and_set_bit(unsigned long nr,
281 } while (unlikely(!res)); 271 } while (unlikely(!res));
282 272
283 res = temp & (1UL << bit); 273 res = temp & (1UL << bit);
284 } else { 274 } else
285 volatile unsigned long *a = addr; 275 res = __mips_test_and_set_bit(nr, addr);
286 unsigned long mask;
287 unsigned long flags;
288
289 a += nr >> SZLONG_LOG;
290 mask = 1UL << bit;
291 raw_local_irq_save(flags);
292 res = (mask & *a);
293 *a |= mask;
294 raw_local_irq_restore(flags);
295 }
296 276
297 smp_llsc_mb(); 277 smp_llsc_mb();
298 278
@@ -310,7 +290,7 @@ static inline int test_and_set_bit(unsigned long nr,
310static inline int test_and_set_bit_lock(unsigned long nr, 290static inline int test_and_set_bit_lock(unsigned long nr,
311 volatile unsigned long *addr) 291 volatile unsigned long *addr)
312{ 292{
313 unsigned short bit = nr & SZLONG_MASK; 293 int bit = nr & SZLONG_MASK;
314 unsigned long res; 294 unsigned long res;
315 295
316 if (kernel_uses_llsc && R10000_LLSC_WAR) { 296 if (kernel_uses_llsc && R10000_LLSC_WAR) {
@@ -345,18 +325,8 @@ static inline int test_and_set_bit_lock(unsigned long nr,
345 } while (unlikely(!res)); 325 } while (unlikely(!res));
346 326
347 res = temp & (1UL << bit); 327 res = temp & (1UL << bit);
348 } else { 328 } else
349 volatile unsigned long *a = addr; 329 res = __mips_test_and_set_bit_lock(nr, addr);
350 unsigned long mask;
351 unsigned long flags;
352
353 a += nr >> SZLONG_LOG;
354 mask = 1UL << bit;
355 raw_local_irq_save(flags);
356 res = (mask & *a);
357 *a |= mask;
358 raw_local_irq_restore(flags);
359 }
360 330
361 smp_llsc_mb(); 331 smp_llsc_mb();
362 332
@@ -373,7 +343,7 @@ static inline int test_and_set_bit_lock(unsigned long nr,
373static inline int test_and_clear_bit(unsigned long nr, 343static inline int test_and_clear_bit(unsigned long nr,
374 volatile unsigned long *addr) 344 volatile unsigned long *addr)
375{ 345{
376 unsigned short bit = nr & SZLONG_MASK; 346 int bit = nr & SZLONG_MASK;
377 unsigned long res; 347 unsigned long res;
378 348
379 smp_mb__before_llsc(); 349 smp_mb__before_llsc();
@@ -428,18 +398,8 @@ static inline int test_and_clear_bit(unsigned long nr,
428 } while (unlikely(!res)); 398 } while (unlikely(!res));
429 399
430 res = temp & (1UL << bit); 400 res = temp & (1UL << bit);
431 } else { 401 } else
432 volatile unsigned long *a = addr; 402 res = __mips_test_and_clear_bit(nr, addr);
433 unsigned long mask;
434 unsigned long flags;
435
436 a += nr >> SZLONG_LOG;
437 mask = 1UL << bit;
438 raw_local_irq_save(flags);
439 res = (mask & *a);
440 *a &= ~mask;
441 raw_local_irq_restore(flags);
442 }
443 403
444 smp_llsc_mb(); 404 smp_llsc_mb();
445 405
@@ -457,7 +417,7 @@ static inline int test_and_clear_bit(unsigned long nr,
457static inline int test_and_change_bit(unsigned long nr, 417static inline int test_and_change_bit(unsigned long nr,
458 volatile unsigned long *addr) 418 volatile unsigned long *addr)
459{ 419{
460 unsigned short bit = nr & SZLONG_MASK; 420 int bit = nr & SZLONG_MASK;
461 unsigned long res; 421 unsigned long res;
462 422
463 smp_mb__before_llsc(); 423 smp_mb__before_llsc();
@@ -494,18 +454,8 @@ static inline int test_and_change_bit(unsigned long nr,
494 } while (unlikely(!res)); 454 } while (unlikely(!res));
495 455
496 res = temp & (1UL << bit); 456 res = temp & (1UL << bit);
497 } else { 457 } else
498 volatile unsigned long *a = addr; 458 res = __mips_test_and_change_bit(nr, addr);
499 unsigned long mask;
500 unsigned long flags;
501
502 a += nr >> SZLONG_LOG;
503 mask = 1UL << bit;
504 raw_local_irq_save(flags);
505 res = (mask & *a);
506 *a ^= mask;
507 raw_local_irq_restore(flags);
508 }
509 459
510 smp_llsc_mb(); 460 smp_llsc_mb();
511 461
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
index 58277e0e9cd4..3c5d1464b7bd 100644
--- a/arch/mips/include/asm/compat.h
+++ b/arch/mips/include/asm/compat.h
@@ -290,7 +290,7 @@ struct compat_shmid64_ds {
290 290
291static inline int is_compat_task(void) 291static inline int is_compat_task(void)
292{ 292{
293 return test_thread_flag(TIF_32BIT); 293 return test_thread_flag(TIF_32BIT_ADDR);
294} 294}
295 295
296#endif /* _ASM_COMPAT_H */ 296#endif /* _ASM_COMPAT_H */
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index 52c4e914f95a..90112adb1940 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -243,9 +243,9 @@ enum cpu_type_enum {
243 */ 243 */
244 CPU_R4000PC, CPU_R4000SC, CPU_R4000MC, CPU_R4200, CPU_R4300, CPU_R4310, 244 CPU_R4000PC, CPU_R4000SC, CPU_R4000MC, CPU_R4200, CPU_R4300, CPU_R4310,
245 CPU_R4400PC, CPU_R4400SC, CPU_R4400MC, CPU_R4600, CPU_R4640, CPU_R4650, 245 CPU_R4400PC, CPU_R4400SC, CPU_R4400MC, CPU_R4600, CPU_R4640, CPU_R4650,
246 CPU_R4700, CPU_R5000, CPU_R5000A, CPU_R5500, CPU_NEVADA, CPU_R5432, 246 CPU_R4700, CPU_R5000, CPU_R5500, CPU_NEVADA, CPU_R5432, CPU_R10000,
247 CPU_R10000, CPU_R12000, CPU_R14000, CPU_VR41XX, CPU_VR4111, CPU_VR4121, 247 CPU_R12000, CPU_R14000, CPU_VR41XX, CPU_VR4111, CPU_VR4121, CPU_VR4122,
248 CPU_VR4122, CPU_VR4131, CPU_VR4133, CPU_VR4181, CPU_VR4181A, CPU_RM7000, 248 CPU_VR4131, CPU_VR4133, CPU_VR4181, CPU_VR4181A, CPU_RM7000,
249 CPU_SR71000, CPU_RM9000, CPU_TX49XX, 249 CPU_SR71000, CPU_RM9000, CPU_TX49XX,
250 250
251 /* 251 /*
diff --git a/arch/mips/include/asm/fw/arc/types.h b/arch/mips/include/asm/fw/arc/types.h
index b9adcd6f0860..2b11f87d6fb3 100644
--- a/arch/mips/include/asm/fw/arc/types.h
+++ b/arch/mips/include/asm/fw/arc/types.h
@@ -10,7 +10,7 @@
10#define _ASM_ARC_TYPES_H 10#define _ASM_ARC_TYPES_H
11 11
12 12
13#ifdef CONFIG_ARC32 13#ifdef CONFIG_FW_ARC32
14 14
15typedef char CHAR; 15typedef char CHAR;
16typedef short SHORT; 16typedef short SHORT;
@@ -33,9 +33,9 @@ typedef LONG _PUSHORT;
33typedef LONG _PULONG; 33typedef LONG _PULONG;
34typedef LONG _PVOID; 34typedef LONG _PVOID;
35 35
36#endif /* CONFIG_ARC32 */ 36#endif /* CONFIG_FW_ARC32 */
37 37
38#ifdef CONFIG_ARC64 38#ifdef CONFIG_FW_ARC64
39 39
40typedef char CHAR; 40typedef char CHAR;
41typedef short SHORT; 41typedef short SHORT;
@@ -57,7 +57,7 @@ typedef USHORT *_PUSHORT;
57typedef ULONG *_PULONG; 57typedef ULONG *_PULONG;
58typedef VOID *_PVOID; 58typedef VOID *_PVOID;
59 59
60#endif /* CONFIG_ARC64 */ 60#endif /* CONFIG_FW_ARC64 */
61 61
62typedef CHAR *PCHAR; 62typedef CHAR *PCHAR;
63typedef SHORT *PSHORT; 63typedef SHORT *PSHORT;
diff --git a/arch/mips/include/asm/hazards.h b/arch/mips/include/asm/hazards.h
index b4c20e4f87cd..f0324e92d089 100644
--- a/arch/mips/include/asm/hazards.h
+++ b/arch/mips/include/asm/hazards.h
@@ -161,31 +161,6 @@ ASMMACRO(back_to_back_c0_hazard,
161 ) 161 )
162#define instruction_hazard() do { } while (0) 162#define instruction_hazard() do { } while (0)
163 163
164#elif defined(CONFIG_CPU_RM9000)
165
166/*
167 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent
168 * use of the JTLB for instructions should not occur for 4 cpu cycles and use
169 * for data translations should not occur for 3 cpu cycles.
170 */
171
172ASMMACRO(mtc0_tlbw_hazard,
173 _ssnop; _ssnop; _ssnop; _ssnop
174 )
175ASMMACRO(tlbw_use_hazard,
176 _ssnop; _ssnop; _ssnop; _ssnop
177 )
178ASMMACRO(tlb_probe_hazard,
179 _ssnop; _ssnop; _ssnop; _ssnop
180 )
181ASMMACRO(irq_enable_hazard,
182 )
183ASMMACRO(irq_disable_hazard,
184 )
185ASMMACRO(back_to_back_c0_hazard,
186 )
187#define instruction_hazard() do { } while (0)
188
189#elif defined(CONFIG_CPU_SB1) 164#elif defined(CONFIG_CPU_SB1)
190 165
191/* 166/*
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 29d9c23c20c7..ff2e0345e013 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -15,6 +15,7 @@
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/irqflags.h>
18 19
19#include <asm/addrspace.h> 20#include <asm/addrspace.h>
20#include <asm/bug.h> 21#include <asm/bug.h>
diff --git a/arch/mips/include/asm/irqflags.h b/arch/mips/include/asm/irqflags.h
index 309cbcd6909c..9f3384c789d7 100644
--- a/arch/mips/include/asm/irqflags.h
+++ b/arch/mips/include/asm/irqflags.h
@@ -16,83 +16,13 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <asm/hazards.h> 17#include <asm/hazards.h>
18 18
19__asm__( 19#if defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_MIPS_MT_SMTC)
20 " .macro arch_local_irq_enable \n"
21 " .set push \n"
22 " .set reorder \n"
23 " .set noat \n"
24#ifdef CONFIG_MIPS_MT_SMTC
25 " mfc0 $1, $2, 1 # SMTC - clear TCStatus.IXMT \n"
26 " ori $1, 0x400 \n"
27 " xori $1, 0x400 \n"
28 " mtc0 $1, $2, 1 \n"
29#elif defined(CONFIG_CPU_MIPSR2)
30 " ei \n"
31#else
32 " mfc0 $1,$12 \n"
33 " ori $1,0x1f \n"
34 " xori $1,0x1e \n"
35 " mtc0 $1,$12 \n"
36#endif
37 " irq_enable_hazard \n"
38 " .set pop \n"
39 " .endm");
40 20
41extern void smtc_ipi_replay(void);
42
43static inline void arch_local_irq_enable(void)
44{
45#ifdef CONFIG_MIPS_MT_SMTC
46 /*
47 * SMTC kernel needs to do a software replay of queued
48 * IPIs, at the cost of call overhead on each local_irq_enable()
49 */
50 smtc_ipi_replay();
51#endif
52 __asm__ __volatile__(
53 "arch_local_irq_enable"
54 : /* no outputs */
55 : /* no inputs */
56 : "memory");
57}
58
59
60/*
61 * For cli() we have to insert nops to make sure that the new value
62 * has actually arrived in the status register before the end of this
63 * macro.
64 * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
65 * no nops at all.
66 */
67/*
68 * For TX49, operating only IE bit is not enough.
69 *
70 * If mfc0 $12 follows store and the mfc0 is last instruction of a
71 * page and fetching the next instruction causes TLB miss, the result
72 * of the mfc0 might wrongly contain EXL bit.
73 *
74 * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
75 *
76 * Workaround: mask EXL bit of the result or place a nop before mfc0.
77 */
78__asm__( 21__asm__(
79 " .macro arch_local_irq_disable\n" 22 " .macro arch_local_irq_disable\n"
80 " .set push \n" 23 " .set push \n"
81 " .set noat \n" 24 " .set noat \n"
82#ifdef CONFIG_MIPS_MT_SMTC
83 " mfc0 $1, $2, 1 \n"
84 " ori $1, 0x400 \n"
85 " .set noreorder \n"
86 " mtc0 $1, $2, 1 \n"
87#elif defined(CONFIG_CPU_MIPSR2)
88 " di \n" 25 " di \n"
89#else
90 " mfc0 $1,$12 \n"
91 " ori $1,0x1f \n"
92 " xori $1,0x1f \n"
93 " .set noreorder \n"
94 " mtc0 $1,$12 \n"
95#endif
96 " irq_disable_hazard \n" 26 " irq_disable_hazard \n"
97 " .set pop \n" 27 " .set pop \n"
98 " .endm \n"); 28 " .endm \n");
@@ -106,46 +36,14 @@ static inline void arch_local_irq_disable(void)
106 : "memory"); 36 : "memory");
107} 37}
108 38
109__asm__(
110 " .macro arch_local_save_flags flags \n"
111 " .set push \n"
112 " .set reorder \n"
113#ifdef CONFIG_MIPS_MT_SMTC
114 " mfc0 \\flags, $2, 1 \n"
115#else
116 " mfc0 \\flags, $12 \n"
117#endif
118 " .set pop \n"
119 " .endm \n");
120
121static inline unsigned long arch_local_save_flags(void)
122{
123 unsigned long flags;
124 asm volatile("arch_local_save_flags %0" : "=r" (flags));
125 return flags;
126}
127 39
128__asm__( 40__asm__(
129 " .macro arch_local_irq_save result \n" 41 " .macro arch_local_irq_save result \n"
130 " .set push \n" 42 " .set push \n"
131 " .set reorder \n" 43 " .set reorder \n"
132 " .set noat \n" 44 " .set noat \n"
133#ifdef CONFIG_MIPS_MT_SMTC
134 " mfc0 \\result, $2, 1 \n"
135 " ori $1, \\result, 0x400 \n"
136 " .set noreorder \n"
137 " mtc0 $1, $2, 1 \n"
138 " andi \\result, \\result, 0x400 \n"
139#elif defined(CONFIG_CPU_MIPSR2)
140 " di \\result \n" 45 " di \\result \n"
141 " andi \\result, 1 \n" 46 " andi \\result, 1 \n"
142#else
143 " mfc0 \\result, $12 \n"
144 " ori $1, \\result, 0x1f \n"
145 " xori $1, 0x1f \n"
146 " .set noreorder \n"
147 " mtc0 $1, $12 \n"
148#endif
149 " irq_disable_hazard \n" 47 " irq_disable_hazard \n"
150 " .set pop \n" 48 " .set pop \n"
151 " .endm \n"); 49 " .endm \n");
@@ -160,61 +58,37 @@ static inline unsigned long arch_local_irq_save(void)
160 return flags; 58 return flags;
161} 59}
162 60
61
163__asm__( 62__asm__(
164 " .macro arch_local_irq_restore flags \n" 63 " .macro arch_local_irq_restore flags \n"
165 " .set push \n" 64 " .set push \n"
166 " .set noreorder \n" 65 " .set noreorder \n"
167 " .set noat \n" 66 " .set noat \n"
168#ifdef CONFIG_MIPS_MT_SMTC 67#if defined(CONFIG_IRQ_CPU)
169 "mfc0 $1, $2, 1 \n"
170 "andi \\flags, 0x400 \n"
171 "ori $1, 0x400 \n"
172 "xori $1, 0x400 \n"
173 "or \\flags, $1 \n"
174 "mtc0 \\flags, $2, 1 \n"
175#elif defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)
176 /* 68 /*
177 * Slow, but doesn't suffer from a relatively unlikely race 69 * Slow, but doesn't suffer from a relatively unlikely race
178 * condition we're having since days 1. 70 * condition we're having since days 1.
179 */ 71 */
180 " beqz \\flags, 1f \n" 72 " beqz \\flags, 1f \n"
181 " di \n" 73 " di \n"
182 " ei \n" 74 " ei \n"
183 "1: \n" 75 "1: \n"
184#elif defined(CONFIG_CPU_MIPSR2) 76#else
185 /* 77 /*
186 * Fast, dangerous. Life is fun, life is good. 78 * Fast, dangerous. Life is fun, life is good.
187 */ 79 */
188 " mfc0 $1, $12 \n" 80 " mfc0 $1, $12 \n"
189 " ins $1, \\flags, 0, 1 \n" 81 " ins $1, \\flags, 0, 1 \n"
190 " mtc0 $1, $12 \n" 82 " mtc0 $1, $12 \n"
191#else
192 " mfc0 $1, $12 \n"
193 " andi \\flags, 1 \n"
194 " ori $1, 0x1f \n"
195 " xori $1, 0x1f \n"
196 " or \\flags, $1 \n"
197 " mtc0 \\flags, $12 \n"
198#endif 83#endif
199 " irq_disable_hazard \n" 84 " irq_disable_hazard \n"
200 " .set pop \n" 85 " .set pop \n"
201 " .endm \n"); 86 " .endm \n");
202 87
203
204static inline void arch_local_irq_restore(unsigned long flags) 88static inline void arch_local_irq_restore(unsigned long flags)
205{ 89{
206 unsigned long __tmp1; 90 unsigned long __tmp1;
207 91
208#ifdef CONFIG_MIPS_MT_SMTC
209 /*
210 * SMTC kernel needs to do a software replay of queued
211 * IPIs, at the cost of branch and call overhead on each
212 * local_irq_restore()
213 */
214 if (unlikely(!(flags & 0x0400)))
215 smtc_ipi_replay();
216#endif
217
218 __asm__ __volatile__( 92 __asm__ __volatile__(
219 "arch_local_irq_restore\t%0" 93 "arch_local_irq_restore\t%0"
220 : "=r" (__tmp1) 94 : "=r" (__tmp1)
@@ -232,6 +106,75 @@ static inline void __arch_local_irq_restore(unsigned long flags)
232 : "0" (flags) 106 : "0" (flags)
233 : "memory"); 107 : "memory");
234} 108}
109#else
110/* Functions that require preempt_{dis,en}able() are in mips-atomic.c */
111void arch_local_irq_disable(void);
112unsigned long arch_local_irq_save(void);
113void arch_local_irq_restore(unsigned long flags);
114void __arch_local_irq_restore(unsigned long flags);
115#endif /* if defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_MIPS_MT_SMTC) */
116
117
118__asm__(
119 " .macro arch_local_irq_enable \n"
120 " .set push \n"
121 " .set reorder \n"
122 " .set noat \n"
123#ifdef CONFIG_MIPS_MT_SMTC
124 " mfc0 $1, $2, 1 # SMTC - clear TCStatus.IXMT \n"
125 " ori $1, 0x400 \n"
126 " xori $1, 0x400 \n"
127 " mtc0 $1, $2, 1 \n"
128#elif defined(CONFIG_CPU_MIPSR2)
129 " ei \n"
130#else
131 " mfc0 $1,$12 \n"
132 " ori $1,0x1f \n"
133 " xori $1,0x1e \n"
134 " mtc0 $1,$12 \n"
135#endif
136 " irq_enable_hazard \n"
137 " .set pop \n"
138 " .endm");
139
140extern void smtc_ipi_replay(void);
141
142static inline void arch_local_irq_enable(void)
143{
144#ifdef CONFIG_MIPS_MT_SMTC
145 /*
146 * SMTC kernel needs to do a software replay of queued
147 * IPIs, at the cost of call overhead on each local_irq_enable()
148 */
149 smtc_ipi_replay();
150#endif
151 __asm__ __volatile__(
152 "arch_local_irq_enable"
153 : /* no outputs */
154 : /* no inputs */
155 : "memory");
156}
157
158
159__asm__(
160 " .macro arch_local_save_flags flags \n"
161 " .set push \n"
162 " .set reorder \n"
163#ifdef CONFIG_MIPS_MT_SMTC
164 " mfc0 \\flags, $2, 1 \n"
165#else
166 " mfc0 \\flags, $12 \n"
167#endif
168 " .set pop \n"
169 " .endm \n");
170
171static inline unsigned long arch_local_save_flags(void)
172{
173 unsigned long flags;
174 asm volatile("arch_local_save_flags %0" : "=r" (flags));
175 return flags;
176}
177
235 178
236static inline int arch_irqs_disabled_flags(unsigned long flags) 179static inline int arch_irqs_disabled_flags(unsigned long flags)
237{ 180{
@@ -245,7 +188,7 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
245#endif 188#endif
246} 189}
247 190
248#endif 191#endif /* #ifndef __ASSEMBLY__ */
249 192
250/* 193/*
251 * Do the CPU's IRQ-state tracing from assembly code. 194 * Do the CPU's IRQ-state tracing from assembly code.
diff --git a/arch/mips/include/asm/kexec.h b/arch/mips/include/asm/kexec.h
index 4314892aaebb..ee25ebbf2a28 100644
--- a/arch/mips/include/asm/kexec.h
+++ b/arch/mips/include/asm/kexec.h
@@ -9,22 +9,43 @@
9#ifndef _MIPS_KEXEC 9#ifndef _MIPS_KEXEC
10# define _MIPS_KEXEC 10# define _MIPS_KEXEC
11 11
12#include <asm/stacktrace.h>
13
12/* Maximum physical address we can use pages from */ 14/* Maximum physical address we can use pages from */
13#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000) 15#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
14/* Maximum address we can reach in physical address mode */ 16/* Maximum address we can reach in physical address mode */
15#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000) 17#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000)
16 /* Maximum address we can use for the control code buffer */ 18 /* Maximum address we can use for the control code buffer */
17#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000) 19#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000)
18 20/* Reserve 3*4096 bytes for board-specific info */
19#define KEXEC_CONTROL_PAGE_SIZE 4096 21#define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096)
20 22
21/* The native architecture */ 23/* The native architecture */
22#define KEXEC_ARCH KEXEC_ARCH_MIPS 24#define KEXEC_ARCH KEXEC_ARCH_MIPS
25#define MAX_NOTE_BYTES 1024
23 26
24static inline void crash_setup_regs(struct pt_regs *newregs, 27static inline void crash_setup_regs(struct pt_regs *newregs,
25 struct pt_regs *oldregs) 28 struct pt_regs *oldregs)
26{ 29{
27 /* Dummy implementation for now */ 30 if (oldregs)
31 memcpy(newregs, oldregs, sizeof(*newregs));
32 else
33 prepare_frametrace(newregs);
28} 34}
29 35
36#ifdef CONFIG_KEXEC
37struct kimage;
38extern unsigned long kexec_args[4];
39extern int (*_machine_kexec_prepare)(struct kimage *);
40extern void (*_machine_kexec_shutdown)(void);
41extern void (*_machine_crash_shutdown)(struct pt_regs *regs);
42extern void default_machine_crash_shutdown(struct pt_regs *regs);
43#ifdef CONFIG_SMP
44extern const unsigned char kexec_smp_wait[];
45extern unsigned long secondary_kexec_args[4];
46extern void (*relocated_kexec_smp_wait) (void *);
47extern atomic_t kexec_ready_to_reboot;
48#endif
49#endif
50
30#endif /* !_MIPS_KEXEC */ 51#endif /* !_MIPS_KEXEC */
diff --git a/arch/mips/include/asm/mach-ar7/war.h b/arch/mips/include/asm/mach-ar7/war.h
index f4862b563080..99071e50faab 100644
--- a/arch/mips/include/asm/mach-ar7/war.h
+++ b/arch/mips/include/asm/mach-ar7/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-ath79/war.h b/arch/mips/include/asm/mach-ath79/war.h
index 323d9f1d8c45..0bb30905fd5b 100644
--- a/arch/mips/include/asm/mach-ath79/war.h
+++ b/arch/mips/include/asm/mach-ath79/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-au1x00/war.h b/arch/mips/include/asm/mach-au1x00/war.h
index dd57d03d68ba..72e260d24e59 100644
--- a/arch/mips/include/asm/mach-au1x00/war.h
+++ b/arch/mips/include/asm/mach-au1x00/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-bcm47xx/war.h b/arch/mips/include/asm/mach-bcm47xx/war.h
index 87cd4651dda3..a3d2f448b10e 100644
--- a/arch/mips/include/asm/mach-bcm47xx/war.h
+++ b/arch/mips/include/asm/mach-bcm47xx/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-bcm63xx/war.h b/arch/mips/include/asm/mach-bcm63xx/war.h
index 8e3f3fdf3209..05ee8671bef1 100644
--- a/arch/mips/include/asm/mach-bcm63xx/war.h
+++ b/arch/mips/include/asm/mach-bcm63xx/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-cavium-octeon/irq.h b/arch/mips/include/asm/mach-cavium-octeon/irq.h
index ff0d4909d848..502bb1815ae8 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/irq.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/irq.h
@@ -42,7 +42,6 @@ enum octeon_irq {
42 OCTEON_IRQ_TIMER3, 42 OCTEON_IRQ_TIMER3,
43 OCTEON_IRQ_USB0, 43 OCTEON_IRQ_USB0,
44 OCTEON_IRQ_USB1, 44 OCTEON_IRQ_USB1,
45 OCTEON_IRQ_BOOTDMA,
46#ifndef CONFIG_PCI_MSI 45#ifndef CONFIG_PCI_MSI
47 OCTEON_IRQ_LAST = 127 46 OCTEON_IRQ_LAST = 127
48#endif 47#endif
diff --git a/arch/mips/include/asm/mach-cavium-octeon/war.h b/arch/mips/include/asm/mach-cavium-octeon/war.h
index c4712d7cc81d..eb72b35cf04b 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/war.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/war.h
@@ -18,7 +18,6 @@
18#define MIPS4K_ICACHE_REFILL_WAR 0 18#define MIPS4K_ICACHE_REFILL_WAR 0
19#define MIPS_CACHE_SYNC_WAR 0 19#define MIPS_CACHE_SYNC_WAR 0
20#define TX49XX_ICACHE_INDEX_INV_WAR 0 20#define TX49XX_ICACHE_INDEX_INV_WAR 0
21#define RM9000_CDEX_SMP_WAR 0
22#define ICACHE_REFILLS_WORKAROUND_WAR 0 21#define ICACHE_REFILLS_WORKAROUND_WAR 0
23#define R10000_LLSC_WAR 0 22#define R10000_LLSC_WAR 0
24#define MIPS34K_MISSED_ITLB_WAR 0 23#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-cobalt/war.h b/arch/mips/include/asm/mach-cobalt/war.h
index 97884fd18ac0..34ae4046541e 100644
--- a/arch/mips/include/asm/mach-cobalt/war.h
+++ b/arch/mips/include/asm/mach-cobalt/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-dec/war.h b/arch/mips/include/asm/mach-dec/war.h
index ca5e2ef909ad..d29996feb3e7 100644
--- a/arch/mips/include/asm/mach-dec/war.h
+++ b/arch/mips/include/asm/mach-dec/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-emma2rh/war.h b/arch/mips/include/asm/mach-emma2rh/war.h
index b660a4c30e6a..79ae82da3ec7 100644
--- a/arch/mips/include/asm/mach-emma2rh/war.h
+++ b/arch/mips/include/asm/mach-emma2rh/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-generic/irq.h b/arch/mips/include/asm/mach-generic/irq.h
index 70d9a25132c5..e014264b2be2 100644
--- a/arch/mips/include/asm/mach-generic/irq.h
+++ b/arch/mips/include/asm/mach-generic/irq.h
@@ -34,12 +34,6 @@
34#endif 34#endif
35#endif 35#endif
36 36
37#ifdef CONFIG_IRQ_CPU_RM9K
38#ifndef RM9K_CPU_IRQ_BASE
39#define RM9K_CPU_IRQ_BASE (MIPS_CPU_IRQ_BASE+12)
40#endif
41#endif
42
43#endif /* CONFIG_IRQ_CPU */ 37#endif /* CONFIG_IRQ_CPU */
44 38
45#endif /* __ASM_MACH_GENERIC_IRQ_H */ 39#endif /* __ASM_MACH_GENERIC_IRQ_H */
diff --git a/arch/mips/include/asm/mach-ip22/war.h b/arch/mips/include/asm/mach-ip22/war.h
index a44fa9656a82..fba640517f4f 100644
--- a/arch/mips/include/asm/mach-ip22/war.h
+++ b/arch/mips/include/asm/mach-ip22/war.h
@@ -21,7 +21,6 @@
21#define MIPS4K_ICACHE_REFILL_WAR 0 21#define MIPS4K_ICACHE_REFILL_WAR 0
22#define MIPS_CACHE_SYNC_WAR 0 22#define MIPS_CACHE_SYNC_WAR 0
23#define TX49XX_ICACHE_INDEX_INV_WAR 0 23#define TX49XX_ICACHE_INDEX_INV_WAR 0
24#define RM9000_CDEX_SMP_WAR 0
25#define ICACHE_REFILLS_WORKAROUND_WAR 0 24#define ICACHE_REFILLS_WORKAROUND_WAR 0
26#define R10000_LLSC_WAR 0 25#define R10000_LLSC_WAR 0
27#define MIPS34K_MISSED_ITLB_WAR 0 26#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-ip27/war.h b/arch/mips/include/asm/mach-ip27/war.h
index e2ddcc9b1fff..4ee0e4bdf4fb 100644
--- a/arch/mips/include/asm/mach-ip27/war.h
+++ b/arch/mips/include/asm/mach-ip27/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 1 21#define R10000_LLSC_WAR 1
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-ip28/war.h b/arch/mips/include/asm/mach-ip28/war.h
index a1baafab486a..4821c7b7a38c 100644
--- a/arch/mips/include/asm/mach-ip28/war.h
+++ b/arch/mips/include/asm/mach-ip28/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 1 21#define R10000_LLSC_WAR 1
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-ip32/war.h b/arch/mips/include/asm/mach-ip32/war.h
index d194056dcd7a..7237a935a133 100644
--- a/arch/mips/include/asm/mach-ip32/war.h
+++ b/arch/mips/include/asm/mach-ip32/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 1 20#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-jazz/war.h b/arch/mips/include/asm/mach-jazz/war.h
index 6158ee861bfd..5b18b9a3d0ec 100644
--- a/arch/mips/include/asm/mach-jazz/war.h
+++ b/arch/mips/include/asm/mach-jazz/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-jz4740/war.h b/arch/mips/include/asm/mach-jz4740/war.h
index 3a5bc17e28fe..9b511d323838 100644
--- a/arch/mips/include/asm/mach-jz4740/war.h
+++ b/arch/mips/include/asm/mach-jz4740/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-lantiq/war.h b/arch/mips/include/asm/mach-lantiq/war.h
index 01b08ef368d1..b6c568c280ef 100644
--- a/arch/mips/include/asm/mach-lantiq/war.h
+++ b/arch/mips/include/asm/mach-lantiq/war.h
@@ -16,7 +16,6 @@
16#define MIPS4K_ICACHE_REFILL_WAR 0 16#define MIPS4K_ICACHE_REFILL_WAR 0
17#define MIPS_CACHE_SYNC_WAR 0 17#define MIPS_CACHE_SYNC_WAR 0
18#define TX49XX_ICACHE_INDEX_INV_WAR 0 18#define TX49XX_ICACHE_INDEX_INV_WAR 0
19#define RM9000_CDEX_SMP_WAR 0
20#define ICACHE_REFILLS_WORKAROUND_WAR 0 19#define ICACHE_REFILLS_WORKAROUND_WAR 0
21#define R10000_LLSC_WAR 0 20#define R10000_LLSC_WAR 0
22#define MIPS34K_MISSED_ITLB_WAR 0 21#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-lasat/war.h b/arch/mips/include/asm/mach-lasat/war.h
index bb1e0325c9be..741ae724adc6 100644
--- a/arch/mips/include/asm/mach-lasat/war.h
+++ b/arch/mips/include/asm/mach-lasat/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-loongson/war.h b/arch/mips/include/asm/mach-loongson/war.h
index 4b971c3ffd8d..f2570df66bb5 100644
--- a/arch/mips/include/asm/mach-loongson/war.h
+++ b/arch/mips/include/asm/mach-loongson/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-loongson1/war.h b/arch/mips/include/asm/mach-loongson1/war.h
index e3680a8fb349..8fb50d008131 100644
--- a/arch/mips/include/asm/mach-loongson1/war.h
+++ b/arch/mips/include/asm/mach-loongson1/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-malta/war.h b/arch/mips/include/asm/mach-malta/war.h
index 7c6931d5f45f..d068fc411f47 100644
--- a/arch/mips/include/asm/mach-malta/war.h
+++ b/arch/mips/include/asm/mach-malta/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 1 17#define MIPS4K_ICACHE_REFILL_WAR 1
18#define MIPS_CACHE_SYNC_WAR 1 18#define MIPS_CACHE_SYNC_WAR 1
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 1 20#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-netlogic/war.h b/arch/mips/include/asm/mach-netlogic/war.h
index 22da89327352..2c7216840e18 100644
--- a/arch/mips/include/asm/mach-netlogic/war.h
+++ b/arch/mips/include/asm/mach-netlogic/war.h
@@ -18,7 +18,6 @@
18#define MIPS4K_ICACHE_REFILL_WAR 0 18#define MIPS4K_ICACHE_REFILL_WAR 0
19#define MIPS_CACHE_SYNC_WAR 0 19#define MIPS_CACHE_SYNC_WAR 0
20#define TX49XX_ICACHE_INDEX_INV_WAR 0 20#define TX49XX_ICACHE_INDEX_INV_WAR 0
21#define RM9000_CDEX_SMP_WAR 0
22#define ICACHE_REFILLS_WORKAROUND_WAR 0 21#define ICACHE_REFILLS_WORKAROUND_WAR 0
23#define R10000_LLSC_WAR 0 22#define R10000_LLSC_WAR 0
24#define MIPS34K_MISSED_ITLB_WAR 0 23#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-pnx833x/war.h b/arch/mips/include/asm/mach-pnx833x/war.h
index 82cd1e97bc2e..edaa06d9d492 100644
--- a/arch/mips/include/asm/mach-pnx833x/war.h
+++ b/arch/mips/include/asm/mach-pnx833x/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-pnx8550/war.h b/arch/mips/include/asm/mach-pnx8550/war.h
index d0458dd082f9..de8894c46686 100644
--- a/arch/mips/include/asm/mach-pnx8550/war.h
+++ b/arch/mips/include/asm/mach-pnx8550/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-powertv/war.h b/arch/mips/include/asm/mach-powertv/war.h
index 7ac05ecc512b..c5651c8e58d1 100644
--- a/arch/mips/include/asm/mach-powertv/war.h
+++ b/arch/mips/include/asm/mach-powertv/war.h
@@ -20,7 +20,6 @@
20#define MIPS4K_ICACHE_REFILL_WAR 1 20#define MIPS4K_ICACHE_REFILL_WAR 1
21#define MIPS_CACHE_SYNC_WAR 1 21#define MIPS_CACHE_SYNC_WAR 1
22#define TX49XX_ICACHE_INDEX_INV_WAR 0 22#define TX49XX_ICACHE_INDEX_INV_WAR 0
23#define RM9000_CDEX_SMP_WAR 0
24#define ICACHE_REFILLS_WORKAROUND_WAR 1 23#define ICACHE_REFILLS_WORKAROUND_WAR 1
25#define R10000_LLSC_WAR 0 24#define R10000_LLSC_WAR 0
26#define MIPS34K_MISSED_ITLB_WAR 0 25#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-rc32434/war.h b/arch/mips/include/asm/mach-rc32434/war.h
index 3ddf187e98a6..1bfd489a3708 100644
--- a/arch/mips/include/asm/mach-rc32434/war.h
+++ b/arch/mips/include/asm/mach-rc32434/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 1 17#define MIPS4K_ICACHE_REFILL_WAR 1
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-rm/war.h b/arch/mips/include/asm/mach-rm/war.h
index 948d3129a114..a3dde98549bb 100644
--- a/arch/mips/include/asm/mach-rm/war.h
+++ b/arch/mips/include/asm/mach-rm/war.h
@@ -21,7 +21,6 @@
21#define MIPS4K_ICACHE_REFILL_WAR 0 21#define MIPS4K_ICACHE_REFILL_WAR 0
22#define MIPS_CACHE_SYNC_WAR 0 22#define MIPS_CACHE_SYNC_WAR 0
23#define TX49XX_ICACHE_INDEX_INV_WAR 0 23#define TX49XX_ICACHE_INDEX_INV_WAR 0
24#define RM9000_CDEX_SMP_WAR 0
25#define ICACHE_REFILLS_WORKAROUND_WAR 0 24#define ICACHE_REFILLS_WORKAROUND_WAR 0
26#define R10000_LLSC_WAR 0 25#define R10000_LLSC_WAR 0
27#define MIPS34K_MISSED_ITLB_WAR 0 26#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-sead3/war.h b/arch/mips/include/asm/mach-sead3/war.h
index 7c6931d5f45f..d068fc411f47 100644
--- a/arch/mips/include/asm/mach-sead3/war.h
+++ b/arch/mips/include/asm/mach-sead3/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 1 17#define MIPS4K_ICACHE_REFILL_WAR 1
18#define MIPS_CACHE_SYNC_WAR 1 18#define MIPS_CACHE_SYNC_WAR 1
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 1 20#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-sibyte/war.h b/arch/mips/include/asm/mach-sibyte/war.h
index 743385d7b5f2..176f5b32dc69 100644
--- a/arch/mips/include/asm/mach-sibyte/war.h
+++ b/arch/mips/include/asm/mach-sibyte/war.h
@@ -33,7 +33,6 @@ extern int sb1250_m3_workaround_needed(void);
33#define MIPS4K_ICACHE_REFILL_WAR 0 33#define MIPS4K_ICACHE_REFILL_WAR 0
34#define MIPS_CACHE_SYNC_WAR 0 34#define MIPS_CACHE_SYNC_WAR 0
35#define TX49XX_ICACHE_INDEX_INV_WAR 0 35#define TX49XX_ICACHE_INDEX_INV_WAR 0
36#define RM9000_CDEX_SMP_WAR 0
37#define ICACHE_REFILLS_WORKAROUND_WAR 0 36#define ICACHE_REFILLS_WORKAROUND_WAR 0
38#define R10000_LLSC_WAR 0 37#define R10000_LLSC_WAR 0
39#define MIPS34K_MISSED_ITLB_WAR 0 38#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-tx39xx/war.h b/arch/mips/include/asm/mach-tx39xx/war.h
index 433814616359..6a52e6534776 100644
--- a/arch/mips/include/asm/mach-tx39xx/war.h
+++ b/arch/mips/include/asm/mach-tx39xx/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-tx49xx/war.h b/arch/mips/include/asm/mach-tx49xx/war.h
index 39b5d1177c57..a8e2c586a18c 100644
--- a/arch/mips/include/asm/mach-tx49xx/war.h
+++ b/arch/mips/include/asm/mach-tx49xx/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 1 19#define TX49XX_ICACHE_INDEX_INV_WAR 1
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-vr41xx/war.h b/arch/mips/include/asm/mach-vr41xx/war.h
index 56a38926412a..ffe31e736009 100644
--- a/arch/mips/include/asm/mach-vr41xx/war.h
+++ b/arch/mips/include/asm/mach-vr41xx/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-wrppmc/war.h b/arch/mips/include/asm/mach-wrppmc/war.h
index ac48629bb1ce..e86084c0bd6b 100644
--- a/arch/mips/include/asm/mach-wrppmc/war.h
+++ b/arch/mips/include/asm/mach-wrppmc/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 1 20#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
diff --git a/arch/mips/include/asm/mach-yosemite/cpu-feature-overrides.h b/arch/mips/include/asm/mach-yosemite/cpu-feature-overrides.h
deleted file mode 100644
index 56bdd3298600..000000000000
--- a/arch/mips/include/asm/mach-yosemite/cpu-feature-overrides.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 04, 07 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * Momentum Jaguar ATX always has the RM9000 processor.
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 0
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
29#define cpu_has_dsp2 0
30#define cpu_has_mipsmt 0
31#define cpu_has_userlocal 0
32#define cpu_icache_snoops_remote_store 0
33
34#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1
36
37#define cpu_has_inclusive_pcaches 0
38
39#define cpu_dcache_line_size() 32
40#define cpu_icache_line_size() 32
41#define cpu_scache_line_size() 32
42
43#define cpu_has_mips32r1 0
44#define cpu_has_mips32r2 0
45#define cpu_has_mips64r1 0
46#define cpu_has_mips64r2 0
47
48#endif /* __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-yosemite/war.h b/arch/mips/include/asm/mach-yosemite/war.h
deleted file mode 100644
index e5c6d53efc86..000000000000
--- a/arch/mips/include/asm/mach-yosemite/war.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_YOSEMITE_WAR_H
9#define __ASM_MIPS_MACH_YOSEMITE_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 1
21#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_YOSEMITE_WAR_H */
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index eb742895dcbe..7e4e6f8fab37 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -240,7 +240,7 @@
240#define PM_HUGE_MASK PM_64M 240#define PM_HUGE_MASK PM_64M
241#elif defined(CONFIG_PAGE_SIZE_64KB) 241#elif defined(CONFIG_PAGE_SIZE_64KB)
242#define PM_HUGE_MASK PM_256M 242#define PM_HUGE_MASK PM_256M
243#elif defined(CONFIG_HUGETLB_PAGE) 243#elif defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
244#error Bad page size configuration for hugetlbfs! 244#error Bad page size configuration for hugetlbfs!
245#endif 245#endif
246 246
@@ -977,10 +977,6 @@ do { \
977#define read_c0_framemask() __read_32bit_c0_register($21, 0) 977#define read_c0_framemask() __read_32bit_c0_register($21, 0)
978#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val) 978#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val)
979 979
980/* RM9000 PerfControl performance counter control register */
981#define read_c0_perfcontrol() __read_32bit_c0_register($22, 0)
982#define write_c0_perfcontrol(val) __write_32bit_c0_register($22, 0, val)
983
984#define read_c0_diag() __read_32bit_c0_register($22, 0) 980#define read_c0_diag() __read_32bit_c0_register($22, 0)
985#define write_c0_diag(val) __write_32bit_c0_register($22, 0, val) 981#define write_c0_diag(val) __write_32bit_c0_register($22, 0, val)
986 982
@@ -1033,10 +1029,6 @@ do { \
1033#define read_c0_perfcntr3_64() __read_64bit_c0_register($25, 7) 1029#define read_c0_perfcntr3_64() __read_64bit_c0_register($25, 7)
1034#define write_c0_perfcntr3_64(val) __write_64bit_c0_register($25, 7, val) 1030#define write_c0_perfcntr3_64(val) __write_64bit_c0_register($25, 7, val)
1035 1031
1036/* RM9000 PerfCount performance counter register */
1037#define read_c0_perfcount() __read_64bit_c0_register($25, 0)
1038#define write_c0_perfcount(val) __write_64bit_c0_register($25, 0, val)
1039
1040#define read_c0_ecc() __read_32bit_c0_register($26, 0) 1032#define read_c0_ecc() __read_32bit_c0_register($26, 0)
1041#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val) 1033#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val)
1042 1034
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index 9b02cfba7449..45cfa1ad86a6 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -72,12 +72,6 @@ extern unsigned long pgd_current[];
72#define ASID_INC 0x10 72#define ASID_INC 0x10
73#define ASID_MASK 0xff0 73#define ASID_MASK 0xff0
74 74
75#elif defined(CONFIG_CPU_RM9000)
76
77#define ASID_INC 0x1
78#define ASID_MASK 0xfff
79
80/* SMTC/34K debug hack - but maybe we'll keep it */
81#elif defined(CONFIG_MIPS_MT_SMTC) 75#elif defined(CONFIG_MIPS_MT_SMTC)
82 76
83#define ASID_INC 0x1 77#define ASID_INC 0x1
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h
index 26137da1c713..44b705d08262 100644
--- a/arch/mips/include/asm/module.h
+++ b/arch/mips/include/asm/module.h
@@ -120,8 +120,6 @@ search_module_dbetables(unsigned long addr)
120#define MODULE_PROC_FAMILY "R10000 " 120#define MODULE_PROC_FAMILY "R10000 "
121#elif defined CONFIG_CPU_RM7000 121#elif defined CONFIG_CPU_RM7000
122#define MODULE_PROC_FAMILY "RM7000 " 122#define MODULE_PROC_FAMILY "RM7000 "
123#elif defined CONFIG_CPU_RM9000
124#define MODULE_PROC_FAMILY "RM9000 "
125#elif defined CONFIG_CPU_SB1 123#elif defined CONFIG_CPU_SB1
126#define MODULE_PROC_FAMILY "SB1 " 124#define MODULE_PROC_FAMILY "SB1 "
127#elif defined CONFIG_CPU_LOONGSON1 125#elif defined CONFIG_CPU_LOONGSON1
diff --git a/arch/mips/include/asm/octeon/cvmx-bootmem.h b/arch/mips/include/asm/octeon/cvmx-bootmem.h
index 877845b84b14..42db2be663f1 100644
--- a/arch/mips/include/asm/octeon/cvmx-bootmem.h
+++ b/arch/mips/include/asm/octeon/cvmx-bootmem.h
@@ -370,4 +370,6 @@ void cvmx_bootmem_lock(void);
370 */ 370 */
371void cvmx_bootmem_unlock(void); 371void cvmx_bootmem_unlock(void);
372 372
373extern struct cvmx_bootmem_desc *cvmx_bootmem_get_desc(void);
374
373#endif /* __CVMX_BOOTMEM_H__ */ 375#endif /* __CVMX_BOOTMEM_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-lmcx-defs.h b/arch/mips/include/asm/octeon/cvmx-lmcx-defs.h
new file mode 100644
index 000000000000..36f510721141
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-lmcx-defs.h
@@ -0,0 +1,3457 @@
1/***********************license start***************
2 * Author: Cavium Inc.
3 *
4 * Contact: support@cavium.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Inc. for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_LMCX_DEFS_H__
29#define __CVMX_LMCX_DEFS_H__
30
31#define CVMX_LMCX_BIST_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000F0ull) + ((block_id) & 1) * 0x60000000ull)
32#define CVMX_LMCX_BIST_RESULT(block_id) (CVMX_ADD_IO_SEG(0x00011800880000F8ull) + ((block_id) & 1) * 0x60000000ull)
33#define CVMX_LMCX_CHAR_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000220ull) + ((block_id) & 3) * 0x1000000ull)
34#define CVMX_LMCX_CHAR_MASK0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000228ull) + ((block_id) & 3) * 0x1000000ull)
35#define CVMX_LMCX_CHAR_MASK1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000230ull) + ((block_id) & 3) * 0x1000000ull)
36#define CVMX_LMCX_CHAR_MASK2(block_id) (CVMX_ADD_IO_SEG(0x0001180088000238ull) + ((block_id) & 3) * 0x1000000ull)
37#define CVMX_LMCX_CHAR_MASK3(block_id) (CVMX_ADD_IO_SEG(0x0001180088000240ull) + ((block_id) & 3) * 0x1000000ull)
38#define CVMX_LMCX_CHAR_MASK4(block_id) (CVMX_ADD_IO_SEG(0x0001180088000318ull) + ((block_id) & 3) * 0x1000000ull)
39#define CVMX_LMCX_COMP_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000028ull) + ((block_id) & 1) * 0x60000000ull)
40#define CVMX_LMCX_COMP_CTL2(block_id) (CVMX_ADD_IO_SEG(0x00011800880001B8ull) + ((block_id) & 3) * 0x1000000ull)
41#define CVMX_LMCX_CONFIG(block_id) (CVMX_ADD_IO_SEG(0x0001180088000188ull) + ((block_id) & 3) * 0x1000000ull)
42#define CVMX_LMCX_CONTROL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000190ull) + ((block_id) & 3) * 0x1000000ull)
43#define CVMX_LMCX_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000010ull) + ((block_id) & 1) * 0x60000000ull)
44#define CVMX_LMCX_CTL1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000090ull) + ((block_id) & 1) * 0x60000000ull)
45#define CVMX_LMCX_DCLK_CNT(block_id) (CVMX_ADD_IO_SEG(0x00011800880001E0ull) + ((block_id) & 3) * 0x1000000ull)
46#define CVMX_LMCX_DCLK_CNT_HI(block_id) (CVMX_ADD_IO_SEG(0x0001180088000070ull) + ((block_id) & 1) * 0x60000000ull)
47#define CVMX_LMCX_DCLK_CNT_LO(block_id) (CVMX_ADD_IO_SEG(0x0001180088000068ull) + ((block_id) & 1) * 0x60000000ull)
48#define CVMX_LMCX_DCLK_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000B8ull) + ((block_id) & 1) * 0x60000000ull)
49#define CVMX_LMCX_DDR2_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000018ull) + ((block_id) & 1) * 0x60000000ull)
50#define CVMX_LMCX_DDR_PLL_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000258ull) + ((block_id) & 3) * 0x1000000ull)
51#define CVMX_LMCX_DELAY_CFG(block_id) (CVMX_ADD_IO_SEG(0x0001180088000088ull) + ((block_id) & 1) * 0x60000000ull)
52#define CVMX_LMCX_DIMMX_PARAMS(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180088000270ull) + (((offset) & 1) + ((block_id) & 3) * 0x200000ull) * 8)
53#define CVMX_LMCX_DIMM_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000310ull) + ((block_id) & 3) * 0x1000000ull)
54#define CVMX_LMCX_DLL_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000C0ull) + ((block_id) & 1) * 0x60000000ull)
55#define CVMX_LMCX_DLL_CTL2(block_id) (CVMX_ADD_IO_SEG(0x00011800880001C8ull) + ((block_id) & 3) * 0x1000000ull)
56#define CVMX_LMCX_DLL_CTL3(block_id) (CVMX_ADD_IO_SEG(0x0001180088000218ull) + ((block_id) & 3) * 0x1000000ull)
57static inline uint64_t CVMX_LMCX_DUAL_MEMCFG(unsigned long block_id)
58{
59 switch (cvmx_get_octeon_family()) {
60 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
61 case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
62 case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
63 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
64 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
65 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
66 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
67 return CVMX_ADD_IO_SEG(0x0001180088000098ull) + (block_id) * 0x60000000ull;
68 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
69 return CVMX_ADD_IO_SEG(0x0001180088000098ull) + (block_id) * 0x60000000ull;
70 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
71 return CVMX_ADD_IO_SEG(0x0001180088000098ull) + (block_id) * 0x1000000ull;
72 }
73 return CVMX_ADD_IO_SEG(0x0001180088000098ull) + (block_id) * 0x60000000ull;
74}
75
76static inline uint64_t CVMX_LMCX_ECC_SYND(unsigned long block_id)
77{
78 switch (cvmx_get_octeon_family()) {
79 case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
80 case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
81 case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
82 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
83 case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
84 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
85 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
86 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
87 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
88 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
89 return CVMX_ADD_IO_SEG(0x0001180088000038ull) + (block_id) * 0x60000000ull;
90 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
91 return CVMX_ADD_IO_SEG(0x0001180088000038ull) + (block_id) * 0x60000000ull;
92 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
93 return CVMX_ADD_IO_SEG(0x0001180088000038ull) + (block_id) * 0x1000000ull;
94 }
95 return CVMX_ADD_IO_SEG(0x0001180088000038ull) + (block_id) * 0x60000000ull;
96}
97
98static inline uint64_t CVMX_LMCX_FADR(unsigned long block_id)
99{
100 switch (cvmx_get_octeon_family()) {
101 case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
102 case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
103 case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
104 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
105 case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
106 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
107 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
108 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
109 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
110 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
111 return CVMX_ADD_IO_SEG(0x0001180088000020ull) + (block_id) * 0x60000000ull;
112 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
113 return CVMX_ADD_IO_SEG(0x0001180088000020ull) + (block_id) * 0x60000000ull;
114 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
115 return CVMX_ADD_IO_SEG(0x0001180088000020ull) + (block_id) * 0x1000000ull;
116 }
117 return CVMX_ADD_IO_SEG(0x0001180088000020ull) + (block_id) * 0x60000000ull;
118}
119
120#define CVMX_LMCX_IFB_CNT(block_id) (CVMX_ADD_IO_SEG(0x00011800880001D0ull) + ((block_id) & 3) * 0x1000000ull)
121#define CVMX_LMCX_IFB_CNT_HI(block_id) (CVMX_ADD_IO_SEG(0x0001180088000050ull) + ((block_id) & 1) * 0x60000000ull)
122#define CVMX_LMCX_IFB_CNT_LO(block_id) (CVMX_ADD_IO_SEG(0x0001180088000048ull) + ((block_id) & 1) * 0x60000000ull)
123#define CVMX_LMCX_INT(block_id) (CVMX_ADD_IO_SEG(0x00011800880001F0ull) + ((block_id) & 3) * 0x1000000ull)
124#define CVMX_LMCX_INT_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800880001E8ull) + ((block_id) & 3) * 0x1000000ull)
125#define CVMX_LMCX_MEM_CFG0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000000ull) + ((block_id) & 1) * 0x60000000ull)
126#define CVMX_LMCX_MEM_CFG1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000008ull) + ((block_id) & 1) * 0x60000000ull)
127#define CVMX_LMCX_MODEREG_PARAMS0(block_id) (CVMX_ADD_IO_SEG(0x00011800880001A8ull) + ((block_id) & 3) * 0x1000000ull)
128#define CVMX_LMCX_MODEREG_PARAMS1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000260ull) + ((block_id) & 3) * 0x1000000ull)
129static inline uint64_t CVMX_LMCX_NXM(unsigned long block_id)
130{
131 switch (cvmx_get_octeon_family()) {
132 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
133 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
134 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
135 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
136 case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
137 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
138 return CVMX_ADD_IO_SEG(0x00011800880000C8ull) + (block_id) * 0x60000000ull;
139 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
140 return CVMX_ADD_IO_SEG(0x00011800880000C8ull) + (block_id) * 0x60000000ull;
141 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
142 return CVMX_ADD_IO_SEG(0x00011800880000C8ull) + (block_id) * 0x1000000ull;
143 }
144 return CVMX_ADD_IO_SEG(0x00011800880000C8ull) + (block_id) * 0x60000000ull;
145}
146
147#define CVMX_LMCX_OPS_CNT(block_id) (CVMX_ADD_IO_SEG(0x00011800880001D8ull) + ((block_id) & 3) * 0x1000000ull)
148#define CVMX_LMCX_OPS_CNT_HI(block_id) (CVMX_ADD_IO_SEG(0x0001180088000060ull) + ((block_id) & 1) * 0x60000000ull)
149#define CVMX_LMCX_OPS_CNT_LO(block_id) (CVMX_ADD_IO_SEG(0x0001180088000058ull) + ((block_id) & 1) * 0x60000000ull)
150#define CVMX_LMCX_PHY_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000210ull) + ((block_id) & 3) * 0x1000000ull)
151#define CVMX_LMCX_PLL_BWCTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000040ull))
152#define CVMX_LMCX_PLL_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000A8ull) + ((block_id) & 1) * 0x60000000ull)
153#define CVMX_LMCX_PLL_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800880000B0ull) + ((block_id) & 1) * 0x60000000ull)
154#define CVMX_LMCX_READ_LEVEL_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000140ull) + ((block_id) & 1) * 0x60000000ull)
155#define CVMX_LMCX_READ_LEVEL_DBG(block_id) (CVMX_ADD_IO_SEG(0x0001180088000148ull) + ((block_id) & 1) * 0x60000000ull)
156#define CVMX_LMCX_READ_LEVEL_RANKX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180088000100ull) + (((offset) & 3) + ((block_id) & 1) * 0xC000000ull) * 8)
157#define CVMX_LMCX_RESET_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000180ull) + ((block_id) & 3) * 0x1000000ull)
158#define CVMX_LMCX_RLEVEL_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880002A0ull) + ((block_id) & 3) * 0x1000000ull)
159#define CVMX_LMCX_RLEVEL_DBG(block_id) (CVMX_ADD_IO_SEG(0x00011800880002A8ull) + ((block_id) & 3) * 0x1000000ull)
160#define CVMX_LMCX_RLEVEL_RANKX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180088000280ull) + (((offset) & 3) + ((block_id) & 3) * 0x200000ull) * 8)
161#define CVMX_LMCX_RODT_COMP_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000A0ull) + ((block_id) & 1) * 0x60000000ull)
162#define CVMX_LMCX_RODT_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000078ull) + ((block_id) & 1) * 0x60000000ull)
163#define CVMX_LMCX_RODT_MASK(block_id) (CVMX_ADD_IO_SEG(0x0001180088000268ull) + ((block_id) & 3) * 0x1000000ull)
164#define CVMX_LMCX_SCRAMBLED_FADR(block_id) (CVMX_ADD_IO_SEG(0x0001180088000330ull))
165#define CVMX_LMCX_SCRAMBLE_CFG0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000320ull))
166#define CVMX_LMCX_SCRAMBLE_CFG1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000328ull))
167#define CVMX_LMCX_SLOT_CTL0(block_id) (CVMX_ADD_IO_SEG(0x00011800880001F8ull) + ((block_id) & 3) * 0x1000000ull)
168#define CVMX_LMCX_SLOT_CTL1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000200ull) + ((block_id) & 3) * 0x1000000ull)
169#define CVMX_LMCX_SLOT_CTL2(block_id) (CVMX_ADD_IO_SEG(0x0001180088000208ull) + ((block_id) & 3) * 0x1000000ull)
170#define CVMX_LMCX_TIMING_PARAMS0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000198ull) + ((block_id) & 3) * 0x1000000ull)
171#define CVMX_LMCX_TIMING_PARAMS1(block_id) (CVMX_ADD_IO_SEG(0x00011800880001A0ull) + ((block_id) & 3) * 0x1000000ull)
172#define CVMX_LMCX_TRO_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000248ull) + ((block_id) & 3) * 0x1000000ull)
173#define CVMX_LMCX_TRO_STAT(block_id) (CVMX_ADD_IO_SEG(0x0001180088000250ull) + ((block_id) & 3) * 0x1000000ull)
174#define CVMX_LMCX_WLEVEL_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000300ull) + ((block_id) & 3) * 0x1000000ull)
175#define CVMX_LMCX_WLEVEL_DBG(block_id) (CVMX_ADD_IO_SEG(0x0001180088000308ull) + ((block_id) & 3) * 0x1000000ull)
176#define CVMX_LMCX_WLEVEL_RANKX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800880002B0ull) + (((offset) & 3) + ((block_id) & 3) * 0x200000ull) * 8)
177#define CVMX_LMCX_WODT_CTL0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000030ull) + ((block_id) & 1) * 0x60000000ull)
178#define CVMX_LMCX_WODT_CTL1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000080ull) + ((block_id) & 1) * 0x60000000ull)
179#define CVMX_LMCX_WODT_MASK(block_id) (CVMX_ADD_IO_SEG(0x00011800880001B0ull) + ((block_id) & 3) * 0x1000000ull)
180
181union cvmx_lmcx_bist_ctl {
182 uint64_t u64;
183 struct cvmx_lmcx_bist_ctl_s {
184#ifdef __BIG_ENDIAN_BITFIELD
185 uint64_t reserved_1_63:63;
186 uint64_t start:1;
187#else
188 uint64_t start:1;
189 uint64_t reserved_1_63:63;
190#endif
191 } s;
192 struct cvmx_lmcx_bist_ctl_s cn50xx;
193 struct cvmx_lmcx_bist_ctl_s cn52xx;
194 struct cvmx_lmcx_bist_ctl_s cn52xxp1;
195 struct cvmx_lmcx_bist_ctl_s cn56xx;
196 struct cvmx_lmcx_bist_ctl_s cn56xxp1;
197};
198
199union cvmx_lmcx_bist_result {
200 uint64_t u64;
201 struct cvmx_lmcx_bist_result_s {
202#ifdef __BIG_ENDIAN_BITFIELD
203 uint64_t reserved_11_63:53;
204 uint64_t csrd2e:1;
205 uint64_t csre2d:1;
206 uint64_t mwf:1;
207 uint64_t mwd:3;
208 uint64_t mwc:1;
209 uint64_t mrf:1;
210 uint64_t mrd:3;
211#else
212 uint64_t mrd:3;
213 uint64_t mrf:1;
214 uint64_t mwc:1;
215 uint64_t mwd:3;
216 uint64_t mwf:1;
217 uint64_t csre2d:1;
218 uint64_t csrd2e:1;
219 uint64_t reserved_11_63:53;
220#endif
221 } s;
222 struct cvmx_lmcx_bist_result_cn50xx {
223#ifdef __BIG_ENDIAN_BITFIELD
224 uint64_t reserved_9_63:55;
225 uint64_t mwf:1;
226 uint64_t mwd:3;
227 uint64_t mwc:1;
228 uint64_t mrf:1;
229 uint64_t mrd:3;
230#else
231 uint64_t mrd:3;
232 uint64_t mrf:1;
233 uint64_t mwc:1;
234 uint64_t mwd:3;
235 uint64_t mwf:1;
236 uint64_t reserved_9_63:55;
237#endif
238 } cn50xx;
239 struct cvmx_lmcx_bist_result_s cn52xx;
240 struct cvmx_lmcx_bist_result_s cn52xxp1;
241 struct cvmx_lmcx_bist_result_s cn56xx;
242 struct cvmx_lmcx_bist_result_s cn56xxp1;
243};
244
245union cvmx_lmcx_char_ctl {
246 uint64_t u64;
247 struct cvmx_lmcx_char_ctl_s {
248#ifdef __BIG_ENDIAN_BITFIELD
249 uint64_t reserved_44_63:20;
250 uint64_t dr:1;
251 uint64_t skew_on:1;
252 uint64_t en:1;
253 uint64_t sel:1;
254 uint64_t prog:8;
255 uint64_t prbs:32;
256#else
257 uint64_t prbs:32;
258 uint64_t prog:8;
259 uint64_t sel:1;
260 uint64_t en:1;
261 uint64_t skew_on:1;
262 uint64_t dr:1;
263 uint64_t reserved_44_63:20;
264#endif
265 } s;
266 struct cvmx_lmcx_char_ctl_s cn61xx;
267 struct cvmx_lmcx_char_ctl_cn63xx {
268#ifdef __BIG_ENDIAN_BITFIELD
269 uint64_t reserved_42_63:22;
270 uint64_t en:1;
271 uint64_t sel:1;
272 uint64_t prog:8;
273 uint64_t prbs:32;
274#else
275 uint64_t prbs:32;
276 uint64_t prog:8;
277 uint64_t sel:1;
278 uint64_t en:1;
279 uint64_t reserved_42_63:22;
280#endif
281 } cn63xx;
282 struct cvmx_lmcx_char_ctl_cn63xx cn63xxp1;
283 struct cvmx_lmcx_char_ctl_s cn66xx;
284 struct cvmx_lmcx_char_ctl_s cn68xx;
285 struct cvmx_lmcx_char_ctl_cn63xx cn68xxp1;
286 struct cvmx_lmcx_char_ctl_s cnf71xx;
287};
288
289union cvmx_lmcx_char_mask0 {
290 uint64_t u64;
291 struct cvmx_lmcx_char_mask0_s {
292#ifdef __BIG_ENDIAN_BITFIELD
293 uint64_t mask:64;
294#else
295 uint64_t mask:64;
296#endif
297 } s;
298 struct cvmx_lmcx_char_mask0_s cn61xx;
299 struct cvmx_lmcx_char_mask0_s cn63xx;
300 struct cvmx_lmcx_char_mask0_s cn63xxp1;
301 struct cvmx_lmcx_char_mask0_s cn66xx;
302 struct cvmx_lmcx_char_mask0_s cn68xx;
303 struct cvmx_lmcx_char_mask0_s cn68xxp1;
304 struct cvmx_lmcx_char_mask0_s cnf71xx;
305};
306
307union cvmx_lmcx_char_mask1 {
308 uint64_t u64;
309 struct cvmx_lmcx_char_mask1_s {
310#ifdef __BIG_ENDIAN_BITFIELD
311 uint64_t reserved_8_63:56;
312 uint64_t mask:8;
313#else
314 uint64_t mask:8;
315 uint64_t reserved_8_63:56;
316#endif
317 } s;
318 struct cvmx_lmcx_char_mask1_s cn61xx;
319 struct cvmx_lmcx_char_mask1_s cn63xx;
320 struct cvmx_lmcx_char_mask1_s cn63xxp1;
321 struct cvmx_lmcx_char_mask1_s cn66xx;
322 struct cvmx_lmcx_char_mask1_s cn68xx;
323 struct cvmx_lmcx_char_mask1_s cn68xxp1;
324 struct cvmx_lmcx_char_mask1_s cnf71xx;
325};
326
327union cvmx_lmcx_char_mask2 {
328 uint64_t u64;
329 struct cvmx_lmcx_char_mask2_s {
330#ifdef __BIG_ENDIAN_BITFIELD
331 uint64_t mask:64;
332#else
333 uint64_t mask:64;
334#endif
335 } s;
336 struct cvmx_lmcx_char_mask2_s cn61xx;
337 struct cvmx_lmcx_char_mask2_s cn63xx;
338 struct cvmx_lmcx_char_mask2_s cn63xxp1;
339 struct cvmx_lmcx_char_mask2_s cn66xx;
340 struct cvmx_lmcx_char_mask2_s cn68xx;
341 struct cvmx_lmcx_char_mask2_s cn68xxp1;
342 struct cvmx_lmcx_char_mask2_s cnf71xx;
343};
344
345union cvmx_lmcx_char_mask3 {
346 uint64_t u64;
347 struct cvmx_lmcx_char_mask3_s {
348#ifdef __BIG_ENDIAN_BITFIELD
349 uint64_t reserved_8_63:56;
350 uint64_t mask:8;
351#else
352 uint64_t mask:8;
353 uint64_t reserved_8_63:56;
354#endif
355 } s;
356 struct cvmx_lmcx_char_mask3_s cn61xx;
357 struct cvmx_lmcx_char_mask3_s cn63xx;
358 struct cvmx_lmcx_char_mask3_s cn63xxp1;
359 struct cvmx_lmcx_char_mask3_s cn66xx;
360 struct cvmx_lmcx_char_mask3_s cn68xx;
361 struct cvmx_lmcx_char_mask3_s cn68xxp1;
362 struct cvmx_lmcx_char_mask3_s cnf71xx;
363};
364
365union cvmx_lmcx_char_mask4 {
366 uint64_t u64;
367 struct cvmx_lmcx_char_mask4_s {
368#ifdef __BIG_ENDIAN_BITFIELD
369 uint64_t reserved_33_63:31;
370 uint64_t reset_n_mask:1;
371 uint64_t a_mask:16;
372 uint64_t ba_mask:3;
373 uint64_t we_n_mask:1;
374 uint64_t cas_n_mask:1;
375 uint64_t ras_n_mask:1;
376 uint64_t odt1_mask:2;
377 uint64_t odt0_mask:2;
378 uint64_t cs1_n_mask:2;
379 uint64_t cs0_n_mask:2;
380 uint64_t cke_mask:2;
381#else
382 uint64_t cke_mask:2;
383 uint64_t cs0_n_mask:2;
384 uint64_t cs1_n_mask:2;
385 uint64_t odt0_mask:2;
386 uint64_t odt1_mask:2;
387 uint64_t ras_n_mask:1;
388 uint64_t cas_n_mask:1;
389 uint64_t we_n_mask:1;
390 uint64_t ba_mask:3;
391 uint64_t a_mask:16;
392 uint64_t reset_n_mask:1;
393 uint64_t reserved_33_63:31;
394#endif
395 } s;
396 struct cvmx_lmcx_char_mask4_s cn61xx;
397 struct cvmx_lmcx_char_mask4_s cn63xx;
398 struct cvmx_lmcx_char_mask4_s cn63xxp1;
399 struct cvmx_lmcx_char_mask4_s cn66xx;
400 struct cvmx_lmcx_char_mask4_s cn68xx;
401 struct cvmx_lmcx_char_mask4_s cn68xxp1;
402 struct cvmx_lmcx_char_mask4_s cnf71xx;
403};
404
405union cvmx_lmcx_comp_ctl {
406 uint64_t u64;
407 struct cvmx_lmcx_comp_ctl_s {
408#ifdef __BIG_ENDIAN_BITFIELD
409 uint64_t reserved_32_63:32;
410 uint64_t nctl_csr:4;
411 uint64_t nctl_clk:4;
412 uint64_t nctl_cmd:4;
413 uint64_t nctl_dat:4;
414 uint64_t pctl_csr:4;
415 uint64_t pctl_clk:4;
416 uint64_t reserved_0_7:8;
417#else
418 uint64_t reserved_0_7:8;
419 uint64_t pctl_clk:4;
420 uint64_t pctl_csr:4;
421 uint64_t nctl_dat:4;
422 uint64_t nctl_cmd:4;
423 uint64_t nctl_clk:4;
424 uint64_t nctl_csr:4;
425 uint64_t reserved_32_63:32;
426#endif
427 } s;
428 struct cvmx_lmcx_comp_ctl_cn30xx {
429#ifdef __BIG_ENDIAN_BITFIELD
430 uint64_t reserved_32_63:32;
431 uint64_t nctl_csr:4;
432 uint64_t nctl_clk:4;
433 uint64_t nctl_cmd:4;
434 uint64_t nctl_dat:4;
435 uint64_t pctl_csr:4;
436 uint64_t pctl_clk:4;
437 uint64_t pctl_cmd:4;
438 uint64_t pctl_dat:4;
439#else
440 uint64_t pctl_dat:4;
441 uint64_t pctl_cmd:4;
442 uint64_t pctl_clk:4;
443 uint64_t pctl_csr:4;
444 uint64_t nctl_dat:4;
445 uint64_t nctl_cmd:4;
446 uint64_t nctl_clk:4;
447 uint64_t nctl_csr:4;
448 uint64_t reserved_32_63:32;
449#endif
450 } cn30xx;
451 struct cvmx_lmcx_comp_ctl_cn30xx cn31xx;
452 struct cvmx_lmcx_comp_ctl_cn30xx cn38xx;
453 struct cvmx_lmcx_comp_ctl_cn30xx cn38xxp2;
454 struct cvmx_lmcx_comp_ctl_cn50xx {
455#ifdef __BIG_ENDIAN_BITFIELD
456 uint64_t reserved_32_63:32;
457 uint64_t nctl_csr:4;
458 uint64_t reserved_20_27:8;
459 uint64_t nctl_dat:4;
460 uint64_t pctl_csr:4;
461 uint64_t reserved_5_11:7;
462 uint64_t pctl_dat:5;
463#else
464 uint64_t pctl_dat:5;
465 uint64_t reserved_5_11:7;
466 uint64_t pctl_csr:4;
467 uint64_t nctl_dat:4;
468 uint64_t reserved_20_27:8;
469 uint64_t nctl_csr:4;
470 uint64_t reserved_32_63:32;
471#endif
472 } cn50xx;
473 struct cvmx_lmcx_comp_ctl_cn50xx cn52xx;
474 struct cvmx_lmcx_comp_ctl_cn50xx cn52xxp1;
475 struct cvmx_lmcx_comp_ctl_cn50xx cn56xx;
476 struct cvmx_lmcx_comp_ctl_cn50xx cn56xxp1;
477 struct cvmx_lmcx_comp_ctl_cn50xx cn58xx;
478 struct cvmx_lmcx_comp_ctl_cn58xxp1 {
479#ifdef __BIG_ENDIAN_BITFIELD
480 uint64_t reserved_32_63:32;
481 uint64_t nctl_csr:4;
482 uint64_t reserved_20_27:8;
483 uint64_t nctl_dat:4;
484 uint64_t pctl_csr:4;
485 uint64_t reserved_4_11:8;
486 uint64_t pctl_dat:4;
487#else
488 uint64_t pctl_dat:4;
489 uint64_t reserved_4_11:8;
490 uint64_t pctl_csr:4;
491 uint64_t nctl_dat:4;
492 uint64_t reserved_20_27:8;
493 uint64_t nctl_csr:4;
494 uint64_t reserved_32_63:32;
495#endif
496 } cn58xxp1;
497};
498
499union cvmx_lmcx_comp_ctl2 {
500 uint64_t u64;
501 struct cvmx_lmcx_comp_ctl2_s {
502#ifdef __BIG_ENDIAN_BITFIELD
503 uint64_t reserved_34_63:30;
504 uint64_t ddr__ptune:4;
505 uint64_t ddr__ntune:4;
506 uint64_t m180:1;
507 uint64_t byp:1;
508 uint64_t ptune:4;
509 uint64_t ntune:4;
510 uint64_t rodt_ctl:4;
511 uint64_t cmd_ctl:4;
512 uint64_t ck_ctl:4;
513 uint64_t dqx_ctl:4;
514#else
515 uint64_t dqx_ctl:4;
516 uint64_t ck_ctl:4;
517 uint64_t cmd_ctl:4;
518 uint64_t rodt_ctl:4;
519 uint64_t ntune:4;
520 uint64_t ptune:4;
521 uint64_t byp:1;
522 uint64_t m180:1;
523 uint64_t ddr__ntune:4;
524 uint64_t ddr__ptune:4;
525 uint64_t reserved_34_63:30;
526#endif
527 } s;
528 struct cvmx_lmcx_comp_ctl2_s cn61xx;
529 struct cvmx_lmcx_comp_ctl2_s cn63xx;
530 struct cvmx_lmcx_comp_ctl2_s cn63xxp1;
531 struct cvmx_lmcx_comp_ctl2_s cn66xx;
532 struct cvmx_lmcx_comp_ctl2_s cn68xx;
533 struct cvmx_lmcx_comp_ctl2_s cn68xxp1;
534 struct cvmx_lmcx_comp_ctl2_s cnf71xx;
535};
536
537union cvmx_lmcx_config {
538 uint64_t u64;
539 struct cvmx_lmcx_config_s {
540#ifdef __BIG_ENDIAN_BITFIELD
541 uint64_t reserved_61_63:3;
542 uint64_t mode32b:1;
543 uint64_t scrz:1;
544 uint64_t early_unload_d1_r1:1;
545 uint64_t early_unload_d1_r0:1;
546 uint64_t early_unload_d0_r1:1;
547 uint64_t early_unload_d0_r0:1;
548 uint64_t init_status:4;
549 uint64_t mirrmask:4;
550 uint64_t rankmask:4;
551 uint64_t rank_ena:1;
552 uint64_t sref_with_dll:1;
553 uint64_t early_dqx:1;
554 uint64_t sequence:3;
555 uint64_t ref_zqcs_int:19;
556 uint64_t reset:1;
557 uint64_t ecc_adr:1;
558 uint64_t forcewrite:4;
559 uint64_t idlepower:3;
560 uint64_t pbank_lsb:4;
561 uint64_t row_lsb:3;
562 uint64_t ecc_ena:1;
563 uint64_t init_start:1;
564#else
565 uint64_t init_start:1;
566 uint64_t ecc_ena:1;
567 uint64_t row_lsb:3;
568 uint64_t pbank_lsb:4;
569 uint64_t idlepower:3;
570 uint64_t forcewrite:4;
571 uint64_t ecc_adr:1;
572 uint64_t reset:1;
573 uint64_t ref_zqcs_int:19;
574 uint64_t sequence:3;
575 uint64_t early_dqx:1;
576 uint64_t sref_with_dll:1;
577 uint64_t rank_ena:1;
578 uint64_t rankmask:4;
579 uint64_t mirrmask:4;
580 uint64_t init_status:4;
581 uint64_t early_unload_d0_r0:1;
582 uint64_t early_unload_d0_r1:1;
583 uint64_t early_unload_d1_r0:1;
584 uint64_t early_unload_d1_r1:1;
585 uint64_t scrz:1;
586 uint64_t mode32b:1;
587 uint64_t reserved_61_63:3;
588#endif
589 } s;
590 struct cvmx_lmcx_config_s cn61xx;
591 struct cvmx_lmcx_config_cn63xx {
592#ifdef __BIG_ENDIAN_BITFIELD
593 uint64_t reserved_59_63:5;
594 uint64_t early_unload_d1_r1:1;
595 uint64_t early_unload_d1_r0:1;
596 uint64_t early_unload_d0_r1:1;
597 uint64_t early_unload_d0_r0:1;
598 uint64_t init_status:4;
599 uint64_t mirrmask:4;
600 uint64_t rankmask:4;
601 uint64_t rank_ena:1;
602 uint64_t sref_with_dll:1;
603 uint64_t early_dqx:1;
604 uint64_t sequence:3;
605 uint64_t ref_zqcs_int:19;
606 uint64_t reset:1;
607 uint64_t ecc_adr:1;
608 uint64_t forcewrite:4;
609 uint64_t idlepower:3;
610 uint64_t pbank_lsb:4;
611 uint64_t row_lsb:3;
612 uint64_t ecc_ena:1;
613 uint64_t init_start:1;
614#else
615 uint64_t init_start:1;
616 uint64_t ecc_ena:1;
617 uint64_t row_lsb:3;
618 uint64_t pbank_lsb:4;
619 uint64_t idlepower:3;
620 uint64_t forcewrite:4;
621 uint64_t ecc_adr:1;
622 uint64_t reset:1;
623 uint64_t ref_zqcs_int:19;
624 uint64_t sequence:3;
625 uint64_t early_dqx:1;
626 uint64_t sref_with_dll:1;
627 uint64_t rank_ena:1;
628 uint64_t rankmask:4;
629 uint64_t mirrmask:4;
630 uint64_t init_status:4;
631 uint64_t early_unload_d0_r0:1;
632 uint64_t early_unload_d0_r1:1;
633 uint64_t early_unload_d1_r0:1;
634 uint64_t early_unload_d1_r1:1;
635 uint64_t reserved_59_63:5;
636#endif
637 } cn63xx;
638 struct cvmx_lmcx_config_cn63xxp1 {
639#ifdef __BIG_ENDIAN_BITFIELD
640 uint64_t reserved_55_63:9;
641 uint64_t init_status:4;
642 uint64_t mirrmask:4;
643 uint64_t rankmask:4;
644 uint64_t rank_ena:1;
645 uint64_t sref_with_dll:1;
646 uint64_t early_dqx:1;
647 uint64_t sequence:3;
648 uint64_t ref_zqcs_int:19;
649 uint64_t reset:1;
650 uint64_t ecc_adr:1;
651 uint64_t forcewrite:4;
652 uint64_t idlepower:3;
653 uint64_t pbank_lsb:4;
654 uint64_t row_lsb:3;
655 uint64_t ecc_ena:1;
656 uint64_t init_start:1;
657#else
658 uint64_t init_start:1;
659 uint64_t ecc_ena:1;
660 uint64_t row_lsb:3;
661 uint64_t pbank_lsb:4;
662 uint64_t idlepower:3;
663 uint64_t forcewrite:4;
664 uint64_t ecc_adr:1;
665 uint64_t reset:1;
666 uint64_t ref_zqcs_int:19;
667 uint64_t sequence:3;
668 uint64_t early_dqx:1;
669 uint64_t sref_with_dll:1;
670 uint64_t rank_ena:1;
671 uint64_t rankmask:4;
672 uint64_t mirrmask:4;
673 uint64_t init_status:4;
674 uint64_t reserved_55_63:9;
675#endif
676 } cn63xxp1;
677 struct cvmx_lmcx_config_cn66xx {
678#ifdef __BIG_ENDIAN_BITFIELD
679 uint64_t reserved_60_63:4;
680 uint64_t scrz:1;
681 uint64_t early_unload_d1_r1:1;
682 uint64_t early_unload_d1_r0:1;
683 uint64_t early_unload_d0_r1:1;
684 uint64_t early_unload_d0_r0:1;
685 uint64_t init_status:4;
686 uint64_t mirrmask:4;
687 uint64_t rankmask:4;
688 uint64_t rank_ena:1;
689 uint64_t sref_with_dll:1;
690 uint64_t early_dqx:1;
691 uint64_t sequence:3;
692 uint64_t ref_zqcs_int:19;
693 uint64_t reset:1;
694 uint64_t ecc_adr:1;
695 uint64_t forcewrite:4;
696 uint64_t idlepower:3;
697 uint64_t pbank_lsb:4;
698 uint64_t row_lsb:3;
699 uint64_t ecc_ena:1;
700 uint64_t init_start:1;
701#else
702 uint64_t init_start:1;
703 uint64_t ecc_ena:1;
704 uint64_t row_lsb:3;
705 uint64_t pbank_lsb:4;
706 uint64_t idlepower:3;
707 uint64_t forcewrite:4;
708 uint64_t ecc_adr:1;
709 uint64_t reset:1;
710 uint64_t ref_zqcs_int:19;
711 uint64_t sequence:3;
712 uint64_t early_dqx:1;
713 uint64_t sref_with_dll:1;
714 uint64_t rank_ena:1;
715 uint64_t rankmask:4;
716 uint64_t mirrmask:4;
717 uint64_t init_status:4;
718 uint64_t early_unload_d0_r0:1;
719 uint64_t early_unload_d0_r1:1;
720 uint64_t early_unload_d1_r0:1;
721 uint64_t early_unload_d1_r1:1;
722 uint64_t scrz:1;
723 uint64_t reserved_60_63:4;
724#endif
725 } cn66xx;
726 struct cvmx_lmcx_config_cn63xx cn68xx;
727 struct cvmx_lmcx_config_cn63xx cn68xxp1;
728 struct cvmx_lmcx_config_s cnf71xx;
729};
730
731union cvmx_lmcx_control {
732 uint64_t u64;
733 struct cvmx_lmcx_control_s {
734#ifdef __BIG_ENDIAN_BITFIELD
735 uint64_t scramble_ena:1;
736 uint64_t thrcnt:12;
737 uint64_t persub:8;
738 uint64_t thrmax:4;
739 uint64_t crm_cnt:5;
740 uint64_t crm_thr:5;
741 uint64_t crm_max:5;
742 uint64_t rodt_bprch:1;
743 uint64_t wodt_bprch:1;
744 uint64_t bprch:2;
745 uint64_t ext_zqcs_dis:1;
746 uint64_t int_zqcs_dis:1;
747 uint64_t auto_dclkdis:1;
748 uint64_t xor_bank:1;
749 uint64_t max_write_batch:4;
750 uint64_t nxm_write_en:1;
751 uint64_t elev_prio_dis:1;
752 uint64_t inorder_wr:1;
753 uint64_t inorder_rd:1;
754 uint64_t throttle_wr:1;
755 uint64_t throttle_rd:1;
756 uint64_t fprch2:2;
757 uint64_t pocas:1;
758 uint64_t ddr2t:1;
759 uint64_t bwcnt:1;
760 uint64_t rdimm_ena:1;
761#else
762 uint64_t rdimm_ena:1;
763 uint64_t bwcnt:1;
764 uint64_t ddr2t:1;
765 uint64_t pocas:1;
766 uint64_t fprch2:2;
767 uint64_t throttle_rd:1;
768 uint64_t throttle_wr:1;
769 uint64_t inorder_rd:1;
770 uint64_t inorder_wr:1;
771 uint64_t elev_prio_dis:1;
772 uint64_t nxm_write_en:1;
773 uint64_t max_write_batch:4;
774 uint64_t xor_bank:1;
775 uint64_t auto_dclkdis:1;
776 uint64_t int_zqcs_dis:1;
777 uint64_t ext_zqcs_dis:1;
778 uint64_t bprch:2;
779 uint64_t wodt_bprch:1;
780 uint64_t rodt_bprch:1;
781 uint64_t crm_max:5;
782 uint64_t crm_thr:5;
783 uint64_t crm_cnt:5;
784 uint64_t thrmax:4;
785 uint64_t persub:8;
786 uint64_t thrcnt:12;
787 uint64_t scramble_ena:1;
788#endif
789 } s;
790 struct cvmx_lmcx_control_s cn61xx;
791 struct cvmx_lmcx_control_cn63xx {
792#ifdef __BIG_ENDIAN_BITFIELD
793 uint64_t reserved_24_63:40;
794 uint64_t rodt_bprch:1;
795 uint64_t wodt_bprch:1;
796 uint64_t bprch:2;
797 uint64_t ext_zqcs_dis:1;
798 uint64_t int_zqcs_dis:1;
799 uint64_t auto_dclkdis:1;
800 uint64_t xor_bank:1;
801 uint64_t max_write_batch:4;
802 uint64_t nxm_write_en:1;
803 uint64_t elev_prio_dis:1;
804 uint64_t inorder_wr:1;
805 uint64_t inorder_rd:1;
806 uint64_t throttle_wr:1;
807 uint64_t throttle_rd:1;
808 uint64_t fprch2:2;
809 uint64_t pocas:1;
810 uint64_t ddr2t:1;
811 uint64_t bwcnt:1;
812 uint64_t rdimm_ena:1;
813#else
814 uint64_t rdimm_ena:1;
815 uint64_t bwcnt:1;
816 uint64_t ddr2t:1;
817 uint64_t pocas:1;
818 uint64_t fprch2:2;
819 uint64_t throttle_rd:1;
820 uint64_t throttle_wr:1;
821 uint64_t inorder_rd:1;
822 uint64_t inorder_wr:1;
823 uint64_t elev_prio_dis:1;
824 uint64_t nxm_write_en:1;
825 uint64_t max_write_batch:4;
826 uint64_t xor_bank:1;
827 uint64_t auto_dclkdis:1;
828 uint64_t int_zqcs_dis:1;
829 uint64_t ext_zqcs_dis:1;
830 uint64_t bprch:2;
831 uint64_t wodt_bprch:1;
832 uint64_t rodt_bprch:1;
833 uint64_t reserved_24_63:40;
834#endif
835 } cn63xx;
836 struct cvmx_lmcx_control_cn63xx cn63xxp1;
837 struct cvmx_lmcx_control_cn66xx {
838#ifdef __BIG_ENDIAN_BITFIELD
839 uint64_t scramble_ena:1;
840 uint64_t reserved_24_62:39;
841 uint64_t rodt_bprch:1;
842 uint64_t wodt_bprch:1;
843 uint64_t bprch:2;
844 uint64_t ext_zqcs_dis:1;
845 uint64_t int_zqcs_dis:1;
846 uint64_t auto_dclkdis:1;
847 uint64_t xor_bank:1;
848 uint64_t max_write_batch:4;
849 uint64_t nxm_write_en:1;
850 uint64_t elev_prio_dis:1;
851 uint64_t inorder_wr:1;
852 uint64_t inorder_rd:1;
853 uint64_t throttle_wr:1;
854 uint64_t throttle_rd:1;
855 uint64_t fprch2:2;
856 uint64_t pocas:1;
857 uint64_t ddr2t:1;
858 uint64_t bwcnt:1;
859 uint64_t rdimm_ena:1;
860#else
861 uint64_t rdimm_ena:1;
862 uint64_t bwcnt:1;
863 uint64_t ddr2t:1;
864 uint64_t pocas:1;
865 uint64_t fprch2:2;
866 uint64_t throttle_rd:1;
867 uint64_t throttle_wr:1;
868 uint64_t inorder_rd:1;
869 uint64_t inorder_wr:1;
870 uint64_t elev_prio_dis:1;
871 uint64_t nxm_write_en:1;
872 uint64_t max_write_batch:4;
873 uint64_t xor_bank:1;
874 uint64_t auto_dclkdis:1;
875 uint64_t int_zqcs_dis:1;
876 uint64_t ext_zqcs_dis:1;
877 uint64_t bprch:2;
878 uint64_t wodt_bprch:1;
879 uint64_t rodt_bprch:1;
880 uint64_t reserved_24_62:39;
881 uint64_t scramble_ena:1;
882#endif
883 } cn66xx;
884 struct cvmx_lmcx_control_cn68xx {
885#ifdef __BIG_ENDIAN_BITFIELD
886 uint64_t reserved_63_63:1;
887 uint64_t thrcnt:12;
888 uint64_t persub:8;
889 uint64_t thrmax:4;
890 uint64_t crm_cnt:5;
891 uint64_t crm_thr:5;
892 uint64_t crm_max:5;
893 uint64_t rodt_bprch:1;
894 uint64_t wodt_bprch:1;
895 uint64_t bprch:2;
896 uint64_t ext_zqcs_dis:1;
897 uint64_t int_zqcs_dis:1;
898 uint64_t auto_dclkdis:1;
899 uint64_t xor_bank:1;
900 uint64_t max_write_batch:4;
901 uint64_t nxm_write_en:1;
902 uint64_t elev_prio_dis:1;
903 uint64_t inorder_wr:1;
904 uint64_t inorder_rd:1;
905 uint64_t throttle_wr:1;
906 uint64_t throttle_rd:1;
907 uint64_t fprch2:2;
908 uint64_t pocas:1;
909 uint64_t ddr2t:1;
910 uint64_t bwcnt:1;
911 uint64_t rdimm_ena:1;
912#else
913 uint64_t rdimm_ena:1;
914 uint64_t bwcnt:1;
915 uint64_t ddr2t:1;
916 uint64_t pocas:1;
917 uint64_t fprch2:2;
918 uint64_t throttle_rd:1;
919 uint64_t throttle_wr:1;
920 uint64_t inorder_rd:1;
921 uint64_t inorder_wr:1;
922 uint64_t elev_prio_dis:1;
923 uint64_t nxm_write_en:1;
924 uint64_t max_write_batch:4;
925 uint64_t xor_bank:1;
926 uint64_t auto_dclkdis:1;
927 uint64_t int_zqcs_dis:1;
928 uint64_t ext_zqcs_dis:1;
929 uint64_t bprch:2;
930 uint64_t wodt_bprch:1;
931 uint64_t rodt_bprch:1;
932 uint64_t crm_max:5;
933 uint64_t crm_thr:5;
934 uint64_t crm_cnt:5;
935 uint64_t thrmax:4;
936 uint64_t persub:8;
937 uint64_t thrcnt:12;
938 uint64_t reserved_63_63:1;
939#endif
940 } cn68xx;
941 struct cvmx_lmcx_control_cn68xx cn68xxp1;
942 struct cvmx_lmcx_control_cn66xx cnf71xx;
943};
944
945union cvmx_lmcx_ctl {
946 uint64_t u64;
947 struct cvmx_lmcx_ctl_s {
948#ifdef __BIG_ENDIAN_BITFIELD
949 uint64_t reserved_32_63:32;
950 uint64_t ddr__nctl:4;
951 uint64_t ddr__pctl:4;
952 uint64_t slow_scf:1;
953 uint64_t xor_bank:1;
954 uint64_t max_write_batch:4;
955 uint64_t pll_div2:1;
956 uint64_t pll_bypass:1;
957 uint64_t rdimm_ena:1;
958 uint64_t r2r_slot:1;
959 uint64_t inorder_mwf:1;
960 uint64_t inorder_mrf:1;
961 uint64_t reserved_10_11:2;
962 uint64_t fprch2:1;
963 uint64_t bprch:1;
964 uint64_t sil_lat:2;
965 uint64_t tskw:2;
966 uint64_t qs_dic:2;
967 uint64_t dic:2;
968#else
969 uint64_t dic:2;
970 uint64_t qs_dic:2;
971 uint64_t tskw:2;
972 uint64_t sil_lat:2;
973 uint64_t bprch:1;
974 uint64_t fprch2:1;
975 uint64_t reserved_10_11:2;
976 uint64_t inorder_mrf:1;
977 uint64_t inorder_mwf:1;
978 uint64_t r2r_slot:1;
979 uint64_t rdimm_ena:1;
980 uint64_t pll_bypass:1;
981 uint64_t pll_div2:1;
982 uint64_t max_write_batch:4;
983 uint64_t xor_bank:1;
984 uint64_t slow_scf:1;
985 uint64_t ddr__pctl:4;
986 uint64_t ddr__nctl:4;
987 uint64_t reserved_32_63:32;
988#endif
989 } s;
990 struct cvmx_lmcx_ctl_cn30xx {
991#ifdef __BIG_ENDIAN_BITFIELD
992 uint64_t reserved_32_63:32;
993 uint64_t ddr__nctl:4;
994 uint64_t ddr__pctl:4;
995 uint64_t slow_scf:1;
996 uint64_t xor_bank:1;
997 uint64_t max_write_batch:4;
998 uint64_t pll_div2:1;
999 uint64_t pll_bypass:1;
1000 uint64_t rdimm_ena:1;
1001 uint64_t r2r_slot:1;
1002 uint64_t inorder_mwf:1;
1003 uint64_t inorder_mrf:1;
1004 uint64_t dreset:1;
1005 uint64_t mode32b:1;
1006 uint64_t fprch2:1;
1007 uint64_t bprch:1;
1008 uint64_t sil_lat:2;
1009 uint64_t tskw:2;
1010 uint64_t qs_dic:2;
1011 uint64_t dic:2;
1012#else
1013 uint64_t dic:2;
1014 uint64_t qs_dic:2;
1015 uint64_t tskw:2;
1016 uint64_t sil_lat:2;
1017 uint64_t bprch:1;
1018 uint64_t fprch2:1;
1019 uint64_t mode32b:1;
1020 uint64_t dreset:1;
1021 uint64_t inorder_mrf:1;
1022 uint64_t inorder_mwf:1;
1023 uint64_t r2r_slot:1;
1024 uint64_t rdimm_ena:1;
1025 uint64_t pll_bypass:1;
1026 uint64_t pll_div2:1;
1027 uint64_t max_write_batch:4;
1028 uint64_t xor_bank:1;
1029 uint64_t slow_scf:1;
1030 uint64_t ddr__pctl:4;
1031 uint64_t ddr__nctl:4;
1032 uint64_t reserved_32_63:32;
1033#endif
1034 } cn30xx;
1035 struct cvmx_lmcx_ctl_cn30xx cn31xx;
1036 struct cvmx_lmcx_ctl_cn38xx {
1037#ifdef __BIG_ENDIAN_BITFIELD
1038 uint64_t reserved_32_63:32;
1039 uint64_t ddr__nctl:4;
1040 uint64_t ddr__pctl:4;
1041 uint64_t slow_scf:1;
1042 uint64_t xor_bank:1;
1043 uint64_t max_write_batch:4;
1044 uint64_t reserved_16_17:2;
1045 uint64_t rdimm_ena:1;
1046 uint64_t r2r_slot:1;
1047 uint64_t inorder_mwf:1;
1048 uint64_t inorder_mrf:1;
1049 uint64_t set_zero:1;
1050 uint64_t mode128b:1;
1051 uint64_t fprch2:1;
1052 uint64_t bprch:1;
1053 uint64_t sil_lat:2;
1054 uint64_t tskw:2;
1055 uint64_t qs_dic:2;
1056 uint64_t dic:2;
1057#else
1058 uint64_t dic:2;
1059 uint64_t qs_dic:2;
1060 uint64_t tskw:2;
1061 uint64_t sil_lat:2;
1062 uint64_t bprch:1;
1063 uint64_t fprch2:1;
1064 uint64_t mode128b:1;
1065 uint64_t set_zero:1;
1066 uint64_t inorder_mrf:1;
1067 uint64_t inorder_mwf:1;
1068 uint64_t r2r_slot:1;
1069 uint64_t rdimm_ena:1;
1070 uint64_t reserved_16_17:2;
1071 uint64_t max_write_batch:4;
1072 uint64_t xor_bank:1;
1073 uint64_t slow_scf:1;
1074 uint64_t ddr__pctl:4;
1075 uint64_t ddr__nctl:4;
1076 uint64_t reserved_32_63:32;
1077#endif
1078 } cn38xx;
1079 struct cvmx_lmcx_ctl_cn38xx cn38xxp2;
1080 struct cvmx_lmcx_ctl_cn50xx {
1081#ifdef __BIG_ENDIAN_BITFIELD
1082 uint64_t reserved_32_63:32;
1083 uint64_t ddr__nctl:4;
1084 uint64_t ddr__pctl:4;
1085 uint64_t slow_scf:1;
1086 uint64_t xor_bank:1;
1087 uint64_t max_write_batch:4;
1088 uint64_t reserved_17_17:1;
1089 uint64_t pll_bypass:1;
1090 uint64_t rdimm_ena:1;
1091 uint64_t r2r_slot:1;
1092 uint64_t inorder_mwf:1;
1093 uint64_t inorder_mrf:1;
1094 uint64_t dreset:1;
1095 uint64_t mode32b:1;
1096 uint64_t fprch2:1;
1097 uint64_t bprch:1;
1098 uint64_t sil_lat:2;
1099 uint64_t tskw:2;
1100 uint64_t qs_dic:2;
1101 uint64_t dic:2;
1102#else
1103 uint64_t dic:2;
1104 uint64_t qs_dic:2;
1105 uint64_t tskw:2;
1106 uint64_t sil_lat:2;
1107 uint64_t bprch:1;
1108 uint64_t fprch2:1;
1109 uint64_t mode32b:1;
1110 uint64_t dreset:1;
1111 uint64_t inorder_mrf:1;
1112 uint64_t inorder_mwf:1;
1113 uint64_t r2r_slot:1;
1114 uint64_t rdimm_ena:1;
1115 uint64_t pll_bypass:1;
1116 uint64_t reserved_17_17:1;
1117 uint64_t max_write_batch:4;
1118 uint64_t xor_bank:1;
1119 uint64_t slow_scf:1;
1120 uint64_t ddr__pctl:4;
1121 uint64_t ddr__nctl:4;
1122 uint64_t reserved_32_63:32;
1123#endif
1124 } cn50xx;
1125 struct cvmx_lmcx_ctl_cn52xx {
1126#ifdef __BIG_ENDIAN_BITFIELD
1127 uint64_t reserved_32_63:32;
1128 uint64_t ddr__nctl:4;
1129 uint64_t ddr__pctl:4;
1130 uint64_t slow_scf:1;
1131 uint64_t xor_bank:1;
1132 uint64_t max_write_batch:4;
1133 uint64_t reserved_16_17:2;
1134 uint64_t rdimm_ena:1;
1135 uint64_t r2r_slot:1;
1136 uint64_t inorder_mwf:1;
1137 uint64_t inorder_mrf:1;
1138 uint64_t dreset:1;
1139 uint64_t mode32b:1;
1140 uint64_t fprch2:1;
1141 uint64_t bprch:1;
1142 uint64_t sil_lat:2;
1143 uint64_t tskw:2;
1144 uint64_t qs_dic:2;
1145 uint64_t dic:2;
1146#else
1147 uint64_t dic:2;
1148 uint64_t qs_dic:2;
1149 uint64_t tskw:2;
1150 uint64_t sil_lat:2;
1151 uint64_t bprch:1;
1152 uint64_t fprch2:1;
1153 uint64_t mode32b:1;
1154 uint64_t dreset:1;
1155 uint64_t inorder_mrf:1;
1156 uint64_t inorder_mwf:1;
1157 uint64_t r2r_slot:1;
1158 uint64_t rdimm_ena:1;
1159 uint64_t reserved_16_17:2;
1160 uint64_t max_write_batch:4;
1161 uint64_t xor_bank:1;
1162 uint64_t slow_scf:1;
1163 uint64_t ddr__pctl:4;
1164 uint64_t ddr__nctl:4;
1165 uint64_t reserved_32_63:32;
1166#endif
1167 } cn52xx;
1168 struct cvmx_lmcx_ctl_cn52xx cn52xxp1;
1169 struct cvmx_lmcx_ctl_cn52xx cn56xx;
1170 struct cvmx_lmcx_ctl_cn52xx cn56xxp1;
1171 struct cvmx_lmcx_ctl_cn58xx {
1172#ifdef __BIG_ENDIAN_BITFIELD
1173 uint64_t reserved_32_63:32;
1174 uint64_t ddr__nctl:4;
1175 uint64_t ddr__pctl:4;
1176 uint64_t slow_scf:1;
1177 uint64_t xor_bank:1;
1178 uint64_t max_write_batch:4;
1179 uint64_t reserved_16_17:2;
1180 uint64_t rdimm_ena:1;
1181 uint64_t r2r_slot:1;
1182 uint64_t inorder_mwf:1;
1183 uint64_t inorder_mrf:1;
1184 uint64_t dreset:1;
1185 uint64_t mode128b:1;
1186 uint64_t fprch2:1;
1187 uint64_t bprch:1;
1188 uint64_t sil_lat:2;
1189 uint64_t tskw:2;
1190 uint64_t qs_dic:2;
1191 uint64_t dic:2;
1192#else
1193 uint64_t dic:2;
1194 uint64_t qs_dic:2;
1195 uint64_t tskw:2;
1196 uint64_t sil_lat:2;
1197 uint64_t bprch:1;
1198 uint64_t fprch2:1;
1199 uint64_t mode128b:1;
1200 uint64_t dreset:1;
1201 uint64_t inorder_mrf:1;
1202 uint64_t inorder_mwf:1;
1203 uint64_t r2r_slot:1;
1204 uint64_t rdimm_ena:1;
1205 uint64_t reserved_16_17:2;
1206 uint64_t max_write_batch:4;
1207 uint64_t xor_bank:1;
1208 uint64_t slow_scf:1;
1209 uint64_t ddr__pctl:4;
1210 uint64_t ddr__nctl:4;
1211 uint64_t reserved_32_63:32;
1212#endif
1213 } cn58xx;
1214 struct cvmx_lmcx_ctl_cn58xx cn58xxp1;
1215};
1216
1217union cvmx_lmcx_ctl1 {
1218 uint64_t u64;
1219 struct cvmx_lmcx_ctl1_s {
1220#ifdef __BIG_ENDIAN_BITFIELD
1221 uint64_t reserved_21_63:43;
1222 uint64_t ecc_adr:1;
1223 uint64_t forcewrite:4;
1224 uint64_t idlepower:3;
1225 uint64_t sequence:3;
1226 uint64_t sil_mode:1;
1227 uint64_t dcc_enable:1;
1228 uint64_t reserved_2_7:6;
1229 uint64_t data_layout:2;
1230#else
1231 uint64_t data_layout:2;
1232 uint64_t reserved_2_7:6;
1233 uint64_t dcc_enable:1;
1234 uint64_t sil_mode:1;
1235 uint64_t sequence:3;
1236 uint64_t idlepower:3;
1237 uint64_t forcewrite:4;
1238 uint64_t ecc_adr:1;
1239 uint64_t reserved_21_63:43;
1240#endif
1241 } s;
1242 struct cvmx_lmcx_ctl1_cn30xx {
1243#ifdef __BIG_ENDIAN_BITFIELD
1244 uint64_t reserved_2_63:62;
1245 uint64_t data_layout:2;
1246#else
1247 uint64_t data_layout:2;
1248 uint64_t reserved_2_63:62;
1249#endif
1250 } cn30xx;
1251 struct cvmx_lmcx_ctl1_cn50xx {
1252#ifdef __BIG_ENDIAN_BITFIELD
1253 uint64_t reserved_10_63:54;
1254 uint64_t sil_mode:1;
1255 uint64_t dcc_enable:1;
1256 uint64_t reserved_2_7:6;
1257 uint64_t data_layout:2;
1258#else
1259 uint64_t data_layout:2;
1260 uint64_t reserved_2_7:6;
1261 uint64_t dcc_enable:1;
1262 uint64_t sil_mode:1;
1263 uint64_t reserved_10_63:54;
1264#endif
1265 } cn50xx;
1266 struct cvmx_lmcx_ctl1_cn52xx {
1267#ifdef __BIG_ENDIAN_BITFIELD
1268 uint64_t reserved_21_63:43;
1269 uint64_t ecc_adr:1;
1270 uint64_t forcewrite:4;
1271 uint64_t idlepower:3;
1272 uint64_t sequence:3;
1273 uint64_t sil_mode:1;
1274 uint64_t dcc_enable:1;
1275 uint64_t reserved_0_7:8;
1276#else
1277 uint64_t reserved_0_7:8;
1278 uint64_t dcc_enable:1;
1279 uint64_t sil_mode:1;
1280 uint64_t sequence:3;
1281 uint64_t idlepower:3;
1282 uint64_t forcewrite:4;
1283 uint64_t ecc_adr:1;
1284 uint64_t reserved_21_63:43;
1285#endif
1286 } cn52xx;
1287 struct cvmx_lmcx_ctl1_cn52xx cn52xxp1;
1288 struct cvmx_lmcx_ctl1_cn52xx cn56xx;
1289 struct cvmx_lmcx_ctl1_cn52xx cn56xxp1;
1290 struct cvmx_lmcx_ctl1_cn58xx {
1291#ifdef __BIG_ENDIAN_BITFIELD
1292 uint64_t reserved_10_63:54;
1293 uint64_t sil_mode:1;
1294 uint64_t dcc_enable:1;
1295 uint64_t reserved_0_7:8;
1296#else
1297 uint64_t reserved_0_7:8;
1298 uint64_t dcc_enable:1;
1299 uint64_t sil_mode:1;
1300 uint64_t reserved_10_63:54;
1301#endif
1302 } cn58xx;
1303 struct cvmx_lmcx_ctl1_cn58xx cn58xxp1;
1304};
1305
1306union cvmx_lmcx_dclk_cnt {
1307 uint64_t u64;
1308 struct cvmx_lmcx_dclk_cnt_s {
1309#ifdef __BIG_ENDIAN_BITFIELD
1310 uint64_t dclkcnt:64;
1311#else
1312 uint64_t dclkcnt:64;
1313#endif
1314 } s;
1315 struct cvmx_lmcx_dclk_cnt_s cn61xx;
1316 struct cvmx_lmcx_dclk_cnt_s cn63xx;
1317 struct cvmx_lmcx_dclk_cnt_s cn63xxp1;
1318 struct cvmx_lmcx_dclk_cnt_s cn66xx;
1319 struct cvmx_lmcx_dclk_cnt_s cn68xx;
1320 struct cvmx_lmcx_dclk_cnt_s cn68xxp1;
1321 struct cvmx_lmcx_dclk_cnt_s cnf71xx;
1322};
1323
1324union cvmx_lmcx_dclk_cnt_hi {
1325 uint64_t u64;
1326 struct cvmx_lmcx_dclk_cnt_hi_s {
1327#ifdef __BIG_ENDIAN_BITFIELD
1328 uint64_t reserved_32_63:32;
1329 uint64_t dclkcnt_hi:32;
1330#else
1331 uint64_t dclkcnt_hi:32;
1332 uint64_t reserved_32_63:32;
1333#endif
1334 } s;
1335 struct cvmx_lmcx_dclk_cnt_hi_s cn30xx;
1336 struct cvmx_lmcx_dclk_cnt_hi_s cn31xx;
1337 struct cvmx_lmcx_dclk_cnt_hi_s cn38xx;
1338 struct cvmx_lmcx_dclk_cnt_hi_s cn38xxp2;
1339 struct cvmx_lmcx_dclk_cnt_hi_s cn50xx;
1340 struct cvmx_lmcx_dclk_cnt_hi_s cn52xx;
1341 struct cvmx_lmcx_dclk_cnt_hi_s cn52xxp1;
1342 struct cvmx_lmcx_dclk_cnt_hi_s cn56xx;
1343 struct cvmx_lmcx_dclk_cnt_hi_s cn56xxp1;
1344 struct cvmx_lmcx_dclk_cnt_hi_s cn58xx;
1345 struct cvmx_lmcx_dclk_cnt_hi_s cn58xxp1;
1346};
1347
1348union cvmx_lmcx_dclk_cnt_lo {
1349 uint64_t u64;
1350 struct cvmx_lmcx_dclk_cnt_lo_s {
1351#ifdef __BIG_ENDIAN_BITFIELD
1352 uint64_t reserved_32_63:32;
1353 uint64_t dclkcnt_lo:32;
1354#else
1355 uint64_t dclkcnt_lo:32;
1356 uint64_t reserved_32_63:32;
1357#endif
1358 } s;
1359 struct cvmx_lmcx_dclk_cnt_lo_s cn30xx;
1360 struct cvmx_lmcx_dclk_cnt_lo_s cn31xx;
1361 struct cvmx_lmcx_dclk_cnt_lo_s cn38xx;
1362 struct cvmx_lmcx_dclk_cnt_lo_s cn38xxp2;
1363 struct cvmx_lmcx_dclk_cnt_lo_s cn50xx;
1364 struct cvmx_lmcx_dclk_cnt_lo_s cn52xx;
1365 struct cvmx_lmcx_dclk_cnt_lo_s cn52xxp1;
1366 struct cvmx_lmcx_dclk_cnt_lo_s cn56xx;
1367 struct cvmx_lmcx_dclk_cnt_lo_s cn56xxp1;
1368 struct cvmx_lmcx_dclk_cnt_lo_s cn58xx;
1369 struct cvmx_lmcx_dclk_cnt_lo_s cn58xxp1;
1370};
1371
1372union cvmx_lmcx_dclk_ctl {
1373 uint64_t u64;
1374 struct cvmx_lmcx_dclk_ctl_s {
1375#ifdef __BIG_ENDIAN_BITFIELD
1376 uint64_t reserved_8_63:56;
1377 uint64_t off90_ena:1;
1378 uint64_t dclk90_byp:1;
1379 uint64_t dclk90_ld:1;
1380 uint64_t dclk90_vlu:5;
1381#else
1382 uint64_t dclk90_vlu:5;
1383 uint64_t dclk90_ld:1;
1384 uint64_t dclk90_byp:1;
1385 uint64_t off90_ena:1;
1386 uint64_t reserved_8_63:56;
1387#endif
1388 } s;
1389 struct cvmx_lmcx_dclk_ctl_s cn56xx;
1390 struct cvmx_lmcx_dclk_ctl_s cn56xxp1;
1391};
1392
1393union cvmx_lmcx_ddr2_ctl {
1394 uint64_t u64;
1395 struct cvmx_lmcx_ddr2_ctl_s {
1396#ifdef __BIG_ENDIAN_BITFIELD
1397 uint64_t reserved_32_63:32;
1398 uint64_t bank8:1;
1399 uint64_t burst8:1;
1400 uint64_t addlat:3;
1401 uint64_t pocas:1;
1402 uint64_t bwcnt:1;
1403 uint64_t twr:3;
1404 uint64_t silo_hc:1;
1405 uint64_t ddr_eof:4;
1406 uint64_t tfaw:5;
1407 uint64_t crip_mode:1;
1408 uint64_t ddr2t:1;
1409 uint64_t odt_ena:1;
1410 uint64_t qdll_ena:1;
1411 uint64_t dll90_vlu:5;
1412 uint64_t dll90_byp:1;
1413 uint64_t rdqs:1;
1414 uint64_t ddr2:1;
1415#else
1416 uint64_t ddr2:1;
1417 uint64_t rdqs:1;
1418 uint64_t dll90_byp:1;
1419 uint64_t dll90_vlu:5;
1420 uint64_t qdll_ena:1;
1421 uint64_t odt_ena:1;
1422 uint64_t ddr2t:1;
1423 uint64_t crip_mode:1;
1424 uint64_t tfaw:5;
1425 uint64_t ddr_eof:4;
1426 uint64_t silo_hc:1;
1427 uint64_t twr:3;
1428 uint64_t bwcnt:1;
1429 uint64_t pocas:1;
1430 uint64_t addlat:3;
1431 uint64_t burst8:1;
1432 uint64_t bank8:1;
1433 uint64_t reserved_32_63:32;
1434#endif
1435 } s;
1436 struct cvmx_lmcx_ddr2_ctl_cn30xx {
1437#ifdef __BIG_ENDIAN_BITFIELD
1438 uint64_t reserved_32_63:32;
1439 uint64_t bank8:1;
1440 uint64_t burst8:1;
1441 uint64_t addlat:3;
1442 uint64_t pocas:1;
1443 uint64_t bwcnt:1;
1444 uint64_t twr:3;
1445 uint64_t silo_hc:1;
1446 uint64_t ddr_eof:4;
1447 uint64_t tfaw:5;
1448 uint64_t crip_mode:1;
1449 uint64_t ddr2t:1;
1450 uint64_t odt_ena:1;
1451 uint64_t qdll_ena:1;
1452 uint64_t dll90_vlu:5;
1453 uint64_t dll90_byp:1;
1454 uint64_t reserved_1_1:1;
1455 uint64_t ddr2:1;
1456#else
1457 uint64_t ddr2:1;
1458 uint64_t reserved_1_1:1;
1459 uint64_t dll90_byp:1;
1460 uint64_t dll90_vlu:5;
1461 uint64_t qdll_ena:1;
1462 uint64_t odt_ena:1;
1463 uint64_t ddr2t:1;
1464 uint64_t crip_mode:1;
1465 uint64_t tfaw:5;
1466 uint64_t ddr_eof:4;
1467 uint64_t silo_hc:1;
1468 uint64_t twr:3;
1469 uint64_t bwcnt:1;
1470 uint64_t pocas:1;
1471 uint64_t addlat:3;
1472 uint64_t burst8:1;
1473 uint64_t bank8:1;
1474 uint64_t reserved_32_63:32;
1475#endif
1476 } cn30xx;
1477 struct cvmx_lmcx_ddr2_ctl_cn30xx cn31xx;
1478 struct cvmx_lmcx_ddr2_ctl_s cn38xx;
1479 struct cvmx_lmcx_ddr2_ctl_s cn38xxp2;
1480 struct cvmx_lmcx_ddr2_ctl_s cn50xx;
1481 struct cvmx_lmcx_ddr2_ctl_s cn52xx;
1482 struct cvmx_lmcx_ddr2_ctl_s cn52xxp1;
1483 struct cvmx_lmcx_ddr2_ctl_s cn56xx;
1484 struct cvmx_lmcx_ddr2_ctl_s cn56xxp1;
1485 struct cvmx_lmcx_ddr2_ctl_s cn58xx;
1486 struct cvmx_lmcx_ddr2_ctl_s cn58xxp1;
1487};
1488
1489union cvmx_lmcx_ddr_pll_ctl {
1490 uint64_t u64;
1491 struct cvmx_lmcx_ddr_pll_ctl_s {
1492#ifdef __BIG_ENDIAN_BITFIELD
1493 uint64_t reserved_27_63:37;
1494 uint64_t jtg_test_mode:1;
1495 uint64_t dfm_div_reset:1;
1496 uint64_t dfm_ps_en:3;
1497 uint64_t ddr_div_reset:1;
1498 uint64_t ddr_ps_en:3;
1499 uint64_t diffamp:4;
1500 uint64_t cps:3;
1501 uint64_t cpb:3;
1502 uint64_t reset_n:1;
1503 uint64_t clkf:7;
1504#else
1505 uint64_t clkf:7;
1506 uint64_t reset_n:1;
1507 uint64_t cpb:3;
1508 uint64_t cps:3;
1509 uint64_t diffamp:4;
1510 uint64_t ddr_ps_en:3;
1511 uint64_t ddr_div_reset:1;
1512 uint64_t dfm_ps_en:3;
1513 uint64_t dfm_div_reset:1;
1514 uint64_t jtg_test_mode:1;
1515 uint64_t reserved_27_63:37;
1516#endif
1517 } s;
1518 struct cvmx_lmcx_ddr_pll_ctl_s cn61xx;
1519 struct cvmx_lmcx_ddr_pll_ctl_s cn63xx;
1520 struct cvmx_lmcx_ddr_pll_ctl_s cn63xxp1;
1521 struct cvmx_lmcx_ddr_pll_ctl_s cn66xx;
1522 struct cvmx_lmcx_ddr_pll_ctl_s cn68xx;
1523 struct cvmx_lmcx_ddr_pll_ctl_s cn68xxp1;
1524 struct cvmx_lmcx_ddr_pll_ctl_s cnf71xx;
1525};
1526
1527union cvmx_lmcx_delay_cfg {
1528 uint64_t u64;
1529 struct cvmx_lmcx_delay_cfg_s {
1530#ifdef __BIG_ENDIAN_BITFIELD
1531 uint64_t reserved_15_63:49;
1532 uint64_t dq:5;
1533 uint64_t cmd:5;
1534 uint64_t clk:5;
1535#else
1536 uint64_t clk:5;
1537 uint64_t cmd:5;
1538 uint64_t dq:5;
1539 uint64_t reserved_15_63:49;
1540#endif
1541 } s;
1542 struct cvmx_lmcx_delay_cfg_s cn30xx;
1543 struct cvmx_lmcx_delay_cfg_cn38xx {
1544#ifdef __BIG_ENDIAN_BITFIELD
1545 uint64_t reserved_14_63:50;
1546 uint64_t dq:4;
1547 uint64_t reserved_9_9:1;
1548 uint64_t cmd:4;
1549 uint64_t reserved_4_4:1;
1550 uint64_t clk:4;
1551#else
1552 uint64_t clk:4;
1553 uint64_t reserved_4_4:1;
1554 uint64_t cmd:4;
1555 uint64_t reserved_9_9:1;
1556 uint64_t dq:4;
1557 uint64_t reserved_14_63:50;
1558#endif
1559 } cn38xx;
1560 struct cvmx_lmcx_delay_cfg_cn38xx cn50xx;
1561 struct cvmx_lmcx_delay_cfg_cn38xx cn52xx;
1562 struct cvmx_lmcx_delay_cfg_cn38xx cn52xxp1;
1563 struct cvmx_lmcx_delay_cfg_cn38xx cn56xx;
1564 struct cvmx_lmcx_delay_cfg_cn38xx cn56xxp1;
1565 struct cvmx_lmcx_delay_cfg_cn38xx cn58xx;
1566 struct cvmx_lmcx_delay_cfg_cn38xx cn58xxp1;
1567};
1568
1569union cvmx_lmcx_dimmx_params {
1570 uint64_t u64;
1571 struct cvmx_lmcx_dimmx_params_s {
1572#ifdef __BIG_ENDIAN_BITFIELD
1573 uint64_t rc15:4;
1574 uint64_t rc14:4;
1575 uint64_t rc13:4;
1576 uint64_t rc12:4;
1577 uint64_t rc11:4;
1578 uint64_t rc10:4;
1579 uint64_t rc9:4;
1580 uint64_t rc8:4;
1581 uint64_t rc7:4;
1582 uint64_t rc6:4;
1583 uint64_t rc5:4;
1584 uint64_t rc4:4;
1585 uint64_t rc3:4;
1586 uint64_t rc2:4;
1587 uint64_t rc1:4;
1588 uint64_t rc0:4;
1589#else
1590 uint64_t rc0:4;
1591 uint64_t rc1:4;
1592 uint64_t rc2:4;
1593 uint64_t rc3:4;
1594 uint64_t rc4:4;
1595 uint64_t rc5:4;
1596 uint64_t rc6:4;
1597 uint64_t rc7:4;
1598 uint64_t rc8:4;
1599 uint64_t rc9:4;
1600 uint64_t rc10:4;
1601 uint64_t rc11:4;
1602 uint64_t rc12:4;
1603 uint64_t rc13:4;
1604 uint64_t rc14:4;
1605 uint64_t rc15:4;
1606#endif
1607 } s;
1608 struct cvmx_lmcx_dimmx_params_s cn61xx;
1609 struct cvmx_lmcx_dimmx_params_s cn63xx;
1610 struct cvmx_lmcx_dimmx_params_s cn63xxp1;
1611 struct cvmx_lmcx_dimmx_params_s cn66xx;
1612 struct cvmx_lmcx_dimmx_params_s cn68xx;
1613 struct cvmx_lmcx_dimmx_params_s cn68xxp1;
1614 struct cvmx_lmcx_dimmx_params_s cnf71xx;
1615};
1616
1617union cvmx_lmcx_dimm_ctl {
1618 uint64_t u64;
1619 struct cvmx_lmcx_dimm_ctl_s {
1620#ifdef __BIG_ENDIAN_BITFIELD
1621 uint64_t reserved_46_63:18;
1622 uint64_t parity:1;
1623 uint64_t tcws:13;
1624 uint64_t dimm1_wmask:16;
1625 uint64_t dimm0_wmask:16;
1626#else
1627 uint64_t dimm0_wmask:16;
1628 uint64_t dimm1_wmask:16;
1629 uint64_t tcws:13;
1630 uint64_t parity:1;
1631 uint64_t reserved_46_63:18;
1632#endif
1633 } s;
1634 struct cvmx_lmcx_dimm_ctl_s cn61xx;
1635 struct cvmx_lmcx_dimm_ctl_s cn63xx;
1636 struct cvmx_lmcx_dimm_ctl_s cn63xxp1;
1637 struct cvmx_lmcx_dimm_ctl_s cn66xx;
1638 struct cvmx_lmcx_dimm_ctl_s cn68xx;
1639 struct cvmx_lmcx_dimm_ctl_s cn68xxp1;
1640 struct cvmx_lmcx_dimm_ctl_s cnf71xx;
1641};
1642
1643union cvmx_lmcx_dll_ctl {
1644 uint64_t u64;
1645 struct cvmx_lmcx_dll_ctl_s {
1646#ifdef __BIG_ENDIAN_BITFIELD
1647 uint64_t reserved_8_63:56;
1648 uint64_t dreset:1;
1649 uint64_t dll90_byp:1;
1650 uint64_t dll90_ena:1;
1651 uint64_t dll90_vlu:5;
1652#else
1653 uint64_t dll90_vlu:5;
1654 uint64_t dll90_ena:1;
1655 uint64_t dll90_byp:1;
1656 uint64_t dreset:1;
1657 uint64_t reserved_8_63:56;
1658#endif
1659 } s;
1660 struct cvmx_lmcx_dll_ctl_s cn52xx;
1661 struct cvmx_lmcx_dll_ctl_s cn52xxp1;
1662 struct cvmx_lmcx_dll_ctl_s cn56xx;
1663 struct cvmx_lmcx_dll_ctl_s cn56xxp1;
1664};
1665
1666union cvmx_lmcx_dll_ctl2 {
1667 uint64_t u64;
1668 struct cvmx_lmcx_dll_ctl2_s {
1669#ifdef __BIG_ENDIAN_BITFIELD
1670 uint64_t reserved_16_63:48;
1671 uint64_t intf_en:1;
1672 uint64_t dll_bringup:1;
1673 uint64_t dreset:1;
1674 uint64_t quad_dll_ena:1;
1675 uint64_t byp_sel:4;
1676 uint64_t byp_setting:8;
1677#else
1678 uint64_t byp_setting:8;
1679 uint64_t byp_sel:4;
1680 uint64_t quad_dll_ena:1;
1681 uint64_t dreset:1;
1682 uint64_t dll_bringup:1;
1683 uint64_t intf_en:1;
1684 uint64_t reserved_16_63:48;
1685#endif
1686 } s;
1687 struct cvmx_lmcx_dll_ctl2_s cn61xx;
1688 struct cvmx_lmcx_dll_ctl2_cn63xx {
1689#ifdef __BIG_ENDIAN_BITFIELD
1690 uint64_t reserved_15_63:49;
1691 uint64_t dll_bringup:1;
1692 uint64_t dreset:1;
1693 uint64_t quad_dll_ena:1;
1694 uint64_t byp_sel:4;
1695 uint64_t byp_setting:8;
1696#else
1697 uint64_t byp_setting:8;
1698 uint64_t byp_sel:4;
1699 uint64_t quad_dll_ena:1;
1700 uint64_t dreset:1;
1701 uint64_t dll_bringup:1;
1702 uint64_t reserved_15_63:49;
1703#endif
1704 } cn63xx;
1705 struct cvmx_lmcx_dll_ctl2_cn63xx cn63xxp1;
1706 struct cvmx_lmcx_dll_ctl2_cn63xx cn66xx;
1707 struct cvmx_lmcx_dll_ctl2_s cn68xx;
1708 struct cvmx_lmcx_dll_ctl2_s cn68xxp1;
1709 struct cvmx_lmcx_dll_ctl2_s cnf71xx;
1710};
1711
1712union cvmx_lmcx_dll_ctl3 {
1713 uint64_t u64;
1714 struct cvmx_lmcx_dll_ctl3_s {
1715#ifdef __BIG_ENDIAN_BITFIELD
1716 uint64_t reserved_41_63:23;
1717 uint64_t dclk90_fwd:1;
1718 uint64_t ddr_90_dly_byp:1;
1719 uint64_t dclk90_recal_dis:1;
1720 uint64_t dclk90_byp_sel:1;
1721 uint64_t dclk90_byp_setting:8;
1722 uint64_t dll_fast:1;
1723 uint64_t dll90_setting:8;
1724 uint64_t fine_tune_mode:1;
1725 uint64_t dll_mode:1;
1726 uint64_t dll90_byte_sel:4;
1727 uint64_t offset_ena:1;
1728 uint64_t load_offset:1;
1729 uint64_t mode_sel:2;
1730 uint64_t byte_sel:4;
1731 uint64_t offset:6;
1732#else
1733 uint64_t offset:6;
1734 uint64_t byte_sel:4;
1735 uint64_t mode_sel:2;
1736 uint64_t load_offset:1;
1737 uint64_t offset_ena:1;
1738 uint64_t dll90_byte_sel:4;
1739 uint64_t dll_mode:1;
1740 uint64_t fine_tune_mode:1;
1741 uint64_t dll90_setting:8;
1742 uint64_t dll_fast:1;
1743 uint64_t dclk90_byp_setting:8;
1744 uint64_t dclk90_byp_sel:1;
1745 uint64_t dclk90_recal_dis:1;
1746 uint64_t ddr_90_dly_byp:1;
1747 uint64_t dclk90_fwd:1;
1748 uint64_t reserved_41_63:23;
1749#endif
1750 } s;
1751 struct cvmx_lmcx_dll_ctl3_s cn61xx;
1752 struct cvmx_lmcx_dll_ctl3_cn63xx {
1753#ifdef __BIG_ENDIAN_BITFIELD
1754 uint64_t reserved_29_63:35;
1755 uint64_t dll_fast:1;
1756 uint64_t dll90_setting:8;
1757 uint64_t fine_tune_mode:1;
1758 uint64_t dll_mode:1;
1759 uint64_t dll90_byte_sel:4;
1760 uint64_t offset_ena:1;
1761 uint64_t load_offset:1;
1762 uint64_t mode_sel:2;
1763 uint64_t byte_sel:4;
1764 uint64_t offset:6;
1765#else
1766 uint64_t offset:6;
1767 uint64_t byte_sel:4;
1768 uint64_t mode_sel:2;
1769 uint64_t load_offset:1;
1770 uint64_t offset_ena:1;
1771 uint64_t dll90_byte_sel:4;
1772 uint64_t dll_mode:1;
1773 uint64_t fine_tune_mode:1;
1774 uint64_t dll90_setting:8;
1775 uint64_t dll_fast:1;
1776 uint64_t reserved_29_63:35;
1777#endif
1778 } cn63xx;
1779 struct cvmx_lmcx_dll_ctl3_cn63xx cn63xxp1;
1780 struct cvmx_lmcx_dll_ctl3_cn63xx cn66xx;
1781 struct cvmx_lmcx_dll_ctl3_s cn68xx;
1782 struct cvmx_lmcx_dll_ctl3_s cn68xxp1;
1783 struct cvmx_lmcx_dll_ctl3_s cnf71xx;
1784};
1785
1786union cvmx_lmcx_dual_memcfg {
1787 uint64_t u64;
1788 struct cvmx_lmcx_dual_memcfg_s {
1789#ifdef __BIG_ENDIAN_BITFIELD
1790 uint64_t reserved_20_63:44;
1791 uint64_t bank8:1;
1792 uint64_t row_lsb:3;
1793 uint64_t reserved_8_15:8;
1794 uint64_t cs_mask:8;
1795#else
1796 uint64_t cs_mask:8;
1797 uint64_t reserved_8_15:8;
1798 uint64_t row_lsb:3;
1799 uint64_t bank8:1;
1800 uint64_t reserved_20_63:44;
1801#endif
1802 } s;
1803 struct cvmx_lmcx_dual_memcfg_s cn50xx;
1804 struct cvmx_lmcx_dual_memcfg_s cn52xx;
1805 struct cvmx_lmcx_dual_memcfg_s cn52xxp1;
1806 struct cvmx_lmcx_dual_memcfg_s cn56xx;
1807 struct cvmx_lmcx_dual_memcfg_s cn56xxp1;
1808 struct cvmx_lmcx_dual_memcfg_s cn58xx;
1809 struct cvmx_lmcx_dual_memcfg_s cn58xxp1;
1810 struct cvmx_lmcx_dual_memcfg_cn61xx {
1811#ifdef __BIG_ENDIAN_BITFIELD
1812 uint64_t reserved_19_63:45;
1813 uint64_t row_lsb:3;
1814 uint64_t reserved_8_15:8;
1815 uint64_t cs_mask:8;
1816#else
1817 uint64_t cs_mask:8;
1818 uint64_t reserved_8_15:8;
1819 uint64_t row_lsb:3;
1820 uint64_t reserved_19_63:45;
1821#endif
1822 } cn61xx;
1823 struct cvmx_lmcx_dual_memcfg_cn61xx cn63xx;
1824 struct cvmx_lmcx_dual_memcfg_cn61xx cn63xxp1;
1825 struct cvmx_lmcx_dual_memcfg_cn61xx cn66xx;
1826 struct cvmx_lmcx_dual_memcfg_cn61xx cn68xx;
1827 struct cvmx_lmcx_dual_memcfg_cn61xx cn68xxp1;
1828 struct cvmx_lmcx_dual_memcfg_cn61xx cnf71xx;
1829};
1830
1831union cvmx_lmcx_ecc_synd {
1832 uint64_t u64;
1833 struct cvmx_lmcx_ecc_synd_s {
1834#ifdef __BIG_ENDIAN_BITFIELD
1835 uint64_t reserved_32_63:32;
1836 uint64_t mrdsyn3:8;
1837 uint64_t mrdsyn2:8;
1838 uint64_t mrdsyn1:8;
1839 uint64_t mrdsyn0:8;
1840#else
1841 uint64_t mrdsyn0:8;
1842 uint64_t mrdsyn1:8;
1843 uint64_t mrdsyn2:8;
1844 uint64_t mrdsyn3:8;
1845 uint64_t reserved_32_63:32;
1846#endif
1847 } s;
1848 struct cvmx_lmcx_ecc_synd_s cn30xx;
1849 struct cvmx_lmcx_ecc_synd_s cn31xx;
1850 struct cvmx_lmcx_ecc_synd_s cn38xx;
1851 struct cvmx_lmcx_ecc_synd_s cn38xxp2;
1852 struct cvmx_lmcx_ecc_synd_s cn50xx;
1853 struct cvmx_lmcx_ecc_synd_s cn52xx;
1854 struct cvmx_lmcx_ecc_synd_s cn52xxp1;
1855 struct cvmx_lmcx_ecc_synd_s cn56xx;
1856 struct cvmx_lmcx_ecc_synd_s cn56xxp1;
1857 struct cvmx_lmcx_ecc_synd_s cn58xx;
1858 struct cvmx_lmcx_ecc_synd_s cn58xxp1;
1859 struct cvmx_lmcx_ecc_synd_s cn61xx;
1860 struct cvmx_lmcx_ecc_synd_s cn63xx;
1861 struct cvmx_lmcx_ecc_synd_s cn63xxp1;
1862 struct cvmx_lmcx_ecc_synd_s cn66xx;
1863 struct cvmx_lmcx_ecc_synd_s cn68xx;
1864 struct cvmx_lmcx_ecc_synd_s cn68xxp1;
1865 struct cvmx_lmcx_ecc_synd_s cnf71xx;
1866};
1867
1868union cvmx_lmcx_fadr {
1869 uint64_t u64;
1870 struct cvmx_lmcx_fadr_s {
1871#ifdef __BIG_ENDIAN_BITFIELD
1872 uint64_t reserved_0_63:64;
1873#else
1874 uint64_t reserved_0_63:64;
1875#endif
1876 } s;
1877 struct cvmx_lmcx_fadr_cn30xx {
1878#ifdef __BIG_ENDIAN_BITFIELD
1879 uint64_t reserved_32_63:32;
1880 uint64_t fdimm:2;
1881 uint64_t fbunk:1;
1882 uint64_t fbank:3;
1883 uint64_t frow:14;
1884 uint64_t fcol:12;
1885#else
1886 uint64_t fcol:12;
1887 uint64_t frow:14;
1888 uint64_t fbank:3;
1889 uint64_t fbunk:1;
1890 uint64_t fdimm:2;
1891 uint64_t reserved_32_63:32;
1892#endif
1893 } cn30xx;
1894 struct cvmx_lmcx_fadr_cn30xx cn31xx;
1895 struct cvmx_lmcx_fadr_cn30xx cn38xx;
1896 struct cvmx_lmcx_fadr_cn30xx cn38xxp2;
1897 struct cvmx_lmcx_fadr_cn30xx cn50xx;
1898 struct cvmx_lmcx_fadr_cn30xx cn52xx;
1899 struct cvmx_lmcx_fadr_cn30xx cn52xxp1;
1900 struct cvmx_lmcx_fadr_cn30xx cn56xx;
1901 struct cvmx_lmcx_fadr_cn30xx cn56xxp1;
1902 struct cvmx_lmcx_fadr_cn30xx cn58xx;
1903 struct cvmx_lmcx_fadr_cn30xx cn58xxp1;
1904 struct cvmx_lmcx_fadr_cn61xx {
1905#ifdef __BIG_ENDIAN_BITFIELD
1906 uint64_t reserved_36_63:28;
1907 uint64_t fdimm:2;
1908 uint64_t fbunk:1;
1909 uint64_t fbank:3;
1910 uint64_t frow:16;
1911 uint64_t fcol:14;
1912#else
1913 uint64_t fcol:14;
1914 uint64_t frow:16;
1915 uint64_t fbank:3;
1916 uint64_t fbunk:1;
1917 uint64_t fdimm:2;
1918 uint64_t reserved_36_63:28;
1919#endif
1920 } cn61xx;
1921 struct cvmx_lmcx_fadr_cn61xx cn63xx;
1922 struct cvmx_lmcx_fadr_cn61xx cn63xxp1;
1923 struct cvmx_lmcx_fadr_cn61xx cn66xx;
1924 struct cvmx_lmcx_fadr_cn61xx cn68xx;
1925 struct cvmx_lmcx_fadr_cn61xx cn68xxp1;
1926 struct cvmx_lmcx_fadr_cn61xx cnf71xx;
1927};
1928
1929union cvmx_lmcx_ifb_cnt {
1930 uint64_t u64;
1931 struct cvmx_lmcx_ifb_cnt_s {
1932#ifdef __BIG_ENDIAN_BITFIELD
1933 uint64_t ifbcnt:64;
1934#else
1935 uint64_t ifbcnt:64;
1936#endif
1937 } s;
1938 struct cvmx_lmcx_ifb_cnt_s cn61xx;
1939 struct cvmx_lmcx_ifb_cnt_s cn63xx;
1940 struct cvmx_lmcx_ifb_cnt_s cn63xxp1;
1941 struct cvmx_lmcx_ifb_cnt_s cn66xx;
1942 struct cvmx_lmcx_ifb_cnt_s cn68xx;
1943 struct cvmx_lmcx_ifb_cnt_s cn68xxp1;
1944 struct cvmx_lmcx_ifb_cnt_s cnf71xx;
1945};
1946
1947union cvmx_lmcx_ifb_cnt_hi {
1948 uint64_t u64;
1949 struct cvmx_lmcx_ifb_cnt_hi_s {
1950#ifdef __BIG_ENDIAN_BITFIELD
1951 uint64_t reserved_32_63:32;
1952 uint64_t ifbcnt_hi:32;
1953#else
1954 uint64_t ifbcnt_hi:32;
1955 uint64_t reserved_32_63:32;
1956#endif
1957 } s;
1958 struct cvmx_lmcx_ifb_cnt_hi_s cn30xx;
1959 struct cvmx_lmcx_ifb_cnt_hi_s cn31xx;
1960 struct cvmx_lmcx_ifb_cnt_hi_s cn38xx;
1961 struct cvmx_lmcx_ifb_cnt_hi_s cn38xxp2;
1962 struct cvmx_lmcx_ifb_cnt_hi_s cn50xx;
1963 struct cvmx_lmcx_ifb_cnt_hi_s cn52xx;
1964 struct cvmx_lmcx_ifb_cnt_hi_s cn52xxp1;
1965 struct cvmx_lmcx_ifb_cnt_hi_s cn56xx;
1966 struct cvmx_lmcx_ifb_cnt_hi_s cn56xxp1;
1967 struct cvmx_lmcx_ifb_cnt_hi_s cn58xx;
1968 struct cvmx_lmcx_ifb_cnt_hi_s cn58xxp1;
1969};
1970
1971union cvmx_lmcx_ifb_cnt_lo {
1972 uint64_t u64;
1973 struct cvmx_lmcx_ifb_cnt_lo_s {
1974#ifdef __BIG_ENDIAN_BITFIELD
1975 uint64_t reserved_32_63:32;
1976 uint64_t ifbcnt_lo:32;
1977#else
1978 uint64_t ifbcnt_lo:32;
1979 uint64_t reserved_32_63:32;
1980#endif
1981 } s;
1982 struct cvmx_lmcx_ifb_cnt_lo_s cn30xx;
1983 struct cvmx_lmcx_ifb_cnt_lo_s cn31xx;
1984 struct cvmx_lmcx_ifb_cnt_lo_s cn38xx;
1985 struct cvmx_lmcx_ifb_cnt_lo_s cn38xxp2;
1986 struct cvmx_lmcx_ifb_cnt_lo_s cn50xx;
1987 struct cvmx_lmcx_ifb_cnt_lo_s cn52xx;
1988 struct cvmx_lmcx_ifb_cnt_lo_s cn52xxp1;
1989 struct cvmx_lmcx_ifb_cnt_lo_s cn56xx;
1990 struct cvmx_lmcx_ifb_cnt_lo_s cn56xxp1;
1991 struct cvmx_lmcx_ifb_cnt_lo_s cn58xx;
1992 struct cvmx_lmcx_ifb_cnt_lo_s cn58xxp1;
1993};
1994
1995union cvmx_lmcx_int {
1996 uint64_t u64;
1997 struct cvmx_lmcx_int_s {
1998#ifdef __BIG_ENDIAN_BITFIELD
1999 uint64_t reserved_9_63:55;
2000 uint64_t ded_err:4;
2001 uint64_t sec_err:4;
2002 uint64_t nxm_wr_err:1;
2003#else
2004 uint64_t nxm_wr_err:1;
2005 uint64_t sec_err:4;
2006 uint64_t ded_err:4;
2007 uint64_t reserved_9_63:55;
2008#endif
2009 } s;
2010 struct cvmx_lmcx_int_s cn61xx;
2011 struct cvmx_lmcx_int_s cn63xx;
2012 struct cvmx_lmcx_int_s cn63xxp1;
2013 struct cvmx_lmcx_int_s cn66xx;
2014 struct cvmx_lmcx_int_s cn68xx;
2015 struct cvmx_lmcx_int_s cn68xxp1;
2016 struct cvmx_lmcx_int_s cnf71xx;
2017};
2018
2019union cvmx_lmcx_int_en {
2020 uint64_t u64;
2021 struct cvmx_lmcx_int_en_s {
2022#ifdef __BIG_ENDIAN_BITFIELD
2023 uint64_t reserved_3_63:61;
2024 uint64_t intr_ded_ena:1;
2025 uint64_t intr_sec_ena:1;
2026 uint64_t intr_nxm_wr_ena:1;
2027#else
2028 uint64_t intr_nxm_wr_ena:1;
2029 uint64_t intr_sec_ena:1;
2030 uint64_t intr_ded_ena:1;
2031 uint64_t reserved_3_63:61;
2032#endif
2033 } s;
2034 struct cvmx_lmcx_int_en_s cn61xx;
2035 struct cvmx_lmcx_int_en_s cn63xx;
2036 struct cvmx_lmcx_int_en_s cn63xxp1;
2037 struct cvmx_lmcx_int_en_s cn66xx;
2038 struct cvmx_lmcx_int_en_s cn68xx;
2039 struct cvmx_lmcx_int_en_s cn68xxp1;
2040 struct cvmx_lmcx_int_en_s cnf71xx;
2041};
2042
2043union cvmx_lmcx_mem_cfg0 {
2044 uint64_t u64;
2045 struct cvmx_lmcx_mem_cfg0_s {
2046#ifdef __BIG_ENDIAN_BITFIELD
2047 uint64_t reserved_32_63:32;
2048 uint64_t reset:1;
2049 uint64_t silo_qc:1;
2050 uint64_t bunk_ena:1;
2051 uint64_t ded_err:4;
2052 uint64_t sec_err:4;
2053 uint64_t intr_ded_ena:1;
2054 uint64_t intr_sec_ena:1;
2055 uint64_t tcl:4;
2056 uint64_t ref_int:6;
2057 uint64_t pbank_lsb:4;
2058 uint64_t row_lsb:3;
2059 uint64_t ecc_ena:1;
2060 uint64_t init_start:1;
2061#else
2062 uint64_t init_start:1;
2063 uint64_t ecc_ena:1;
2064 uint64_t row_lsb:3;
2065 uint64_t pbank_lsb:4;
2066 uint64_t ref_int:6;
2067 uint64_t tcl:4;
2068 uint64_t intr_sec_ena:1;
2069 uint64_t intr_ded_ena:1;
2070 uint64_t sec_err:4;
2071 uint64_t ded_err:4;
2072 uint64_t bunk_ena:1;
2073 uint64_t silo_qc:1;
2074 uint64_t reset:1;
2075 uint64_t reserved_32_63:32;
2076#endif
2077 } s;
2078 struct cvmx_lmcx_mem_cfg0_s cn30xx;
2079 struct cvmx_lmcx_mem_cfg0_s cn31xx;
2080 struct cvmx_lmcx_mem_cfg0_s cn38xx;
2081 struct cvmx_lmcx_mem_cfg0_s cn38xxp2;
2082 struct cvmx_lmcx_mem_cfg0_s cn50xx;
2083 struct cvmx_lmcx_mem_cfg0_s cn52xx;
2084 struct cvmx_lmcx_mem_cfg0_s cn52xxp1;
2085 struct cvmx_lmcx_mem_cfg0_s cn56xx;
2086 struct cvmx_lmcx_mem_cfg0_s cn56xxp1;
2087 struct cvmx_lmcx_mem_cfg0_s cn58xx;
2088 struct cvmx_lmcx_mem_cfg0_s cn58xxp1;
2089};
2090
2091union cvmx_lmcx_mem_cfg1 {
2092 uint64_t u64;
2093 struct cvmx_lmcx_mem_cfg1_s {
2094#ifdef __BIG_ENDIAN_BITFIELD
2095 uint64_t reserved_32_63:32;
2096 uint64_t comp_bypass:1;
2097 uint64_t trrd:3;
2098 uint64_t caslat:3;
2099 uint64_t tmrd:3;
2100 uint64_t trfc:5;
2101 uint64_t trp:4;
2102 uint64_t twtr:4;
2103 uint64_t trcd:4;
2104 uint64_t tras:5;
2105#else
2106 uint64_t tras:5;
2107 uint64_t trcd:4;
2108 uint64_t twtr:4;
2109 uint64_t trp:4;
2110 uint64_t trfc:5;
2111 uint64_t tmrd:3;
2112 uint64_t caslat:3;
2113 uint64_t trrd:3;
2114 uint64_t comp_bypass:1;
2115 uint64_t reserved_32_63:32;
2116#endif
2117 } s;
2118 struct cvmx_lmcx_mem_cfg1_s cn30xx;
2119 struct cvmx_lmcx_mem_cfg1_s cn31xx;
2120 struct cvmx_lmcx_mem_cfg1_cn38xx {
2121#ifdef __BIG_ENDIAN_BITFIELD
2122 uint64_t reserved_31_63:33;
2123 uint64_t trrd:3;
2124 uint64_t caslat:3;
2125 uint64_t tmrd:3;
2126 uint64_t trfc:5;
2127 uint64_t trp:4;
2128 uint64_t twtr:4;
2129 uint64_t trcd:4;
2130 uint64_t tras:5;
2131#else
2132 uint64_t tras:5;
2133 uint64_t trcd:4;
2134 uint64_t twtr:4;
2135 uint64_t trp:4;
2136 uint64_t trfc:5;
2137 uint64_t tmrd:3;
2138 uint64_t caslat:3;
2139 uint64_t trrd:3;
2140 uint64_t reserved_31_63:33;
2141#endif
2142 } cn38xx;
2143 struct cvmx_lmcx_mem_cfg1_cn38xx cn38xxp2;
2144 struct cvmx_lmcx_mem_cfg1_s cn50xx;
2145 struct cvmx_lmcx_mem_cfg1_cn38xx cn52xx;
2146 struct cvmx_lmcx_mem_cfg1_cn38xx cn52xxp1;
2147 struct cvmx_lmcx_mem_cfg1_cn38xx cn56xx;
2148 struct cvmx_lmcx_mem_cfg1_cn38xx cn56xxp1;
2149 struct cvmx_lmcx_mem_cfg1_cn38xx cn58xx;
2150 struct cvmx_lmcx_mem_cfg1_cn38xx cn58xxp1;
2151};
2152
2153union cvmx_lmcx_modereg_params0 {
2154 uint64_t u64;
2155 struct cvmx_lmcx_modereg_params0_s {
2156#ifdef __BIG_ENDIAN_BITFIELD
2157 uint64_t reserved_25_63:39;
2158 uint64_t ppd:1;
2159 uint64_t wrp:3;
2160 uint64_t dllr:1;
2161 uint64_t tm:1;
2162 uint64_t rbt:1;
2163 uint64_t cl:4;
2164 uint64_t bl:2;
2165 uint64_t qoff:1;
2166 uint64_t tdqs:1;
2167 uint64_t wlev:1;
2168 uint64_t al:2;
2169 uint64_t dll:1;
2170 uint64_t mpr:1;
2171 uint64_t mprloc:2;
2172 uint64_t cwl:3;
2173#else
2174 uint64_t cwl:3;
2175 uint64_t mprloc:2;
2176 uint64_t mpr:1;
2177 uint64_t dll:1;
2178 uint64_t al:2;
2179 uint64_t wlev:1;
2180 uint64_t tdqs:1;
2181 uint64_t qoff:1;
2182 uint64_t bl:2;
2183 uint64_t cl:4;
2184 uint64_t rbt:1;
2185 uint64_t tm:1;
2186 uint64_t dllr:1;
2187 uint64_t wrp:3;
2188 uint64_t ppd:1;
2189 uint64_t reserved_25_63:39;
2190#endif
2191 } s;
2192 struct cvmx_lmcx_modereg_params0_s cn61xx;
2193 struct cvmx_lmcx_modereg_params0_s cn63xx;
2194 struct cvmx_lmcx_modereg_params0_s cn63xxp1;
2195 struct cvmx_lmcx_modereg_params0_s cn66xx;
2196 struct cvmx_lmcx_modereg_params0_s cn68xx;
2197 struct cvmx_lmcx_modereg_params0_s cn68xxp1;
2198 struct cvmx_lmcx_modereg_params0_s cnf71xx;
2199};
2200
2201union cvmx_lmcx_modereg_params1 {
2202 uint64_t u64;
2203 struct cvmx_lmcx_modereg_params1_s {
2204#ifdef __BIG_ENDIAN_BITFIELD
2205 uint64_t reserved_48_63:16;
2206 uint64_t rtt_nom_11:3;
2207 uint64_t dic_11:2;
2208 uint64_t rtt_wr_11:2;
2209 uint64_t srt_11:1;
2210 uint64_t asr_11:1;
2211 uint64_t pasr_11:3;
2212 uint64_t rtt_nom_10:3;
2213 uint64_t dic_10:2;
2214 uint64_t rtt_wr_10:2;
2215 uint64_t srt_10:1;
2216 uint64_t asr_10:1;
2217 uint64_t pasr_10:3;
2218 uint64_t rtt_nom_01:3;
2219 uint64_t dic_01:2;
2220 uint64_t rtt_wr_01:2;
2221 uint64_t srt_01:1;
2222 uint64_t asr_01:1;
2223 uint64_t pasr_01:3;
2224 uint64_t rtt_nom_00:3;
2225 uint64_t dic_00:2;
2226 uint64_t rtt_wr_00:2;
2227 uint64_t srt_00:1;
2228 uint64_t asr_00:1;
2229 uint64_t pasr_00:3;
2230#else
2231 uint64_t pasr_00:3;
2232 uint64_t asr_00:1;
2233 uint64_t srt_00:1;
2234 uint64_t rtt_wr_00:2;
2235 uint64_t dic_00:2;
2236 uint64_t rtt_nom_00:3;
2237 uint64_t pasr_01:3;
2238 uint64_t asr_01:1;
2239 uint64_t srt_01:1;
2240 uint64_t rtt_wr_01:2;
2241 uint64_t dic_01:2;
2242 uint64_t rtt_nom_01:3;
2243 uint64_t pasr_10:3;
2244 uint64_t asr_10:1;
2245 uint64_t srt_10:1;
2246 uint64_t rtt_wr_10:2;
2247 uint64_t dic_10:2;
2248 uint64_t rtt_nom_10:3;
2249 uint64_t pasr_11:3;
2250 uint64_t asr_11:1;
2251 uint64_t srt_11:1;
2252 uint64_t rtt_wr_11:2;
2253 uint64_t dic_11:2;
2254 uint64_t rtt_nom_11:3;
2255 uint64_t reserved_48_63:16;
2256#endif
2257 } s;
2258 struct cvmx_lmcx_modereg_params1_s cn61xx;
2259 struct cvmx_lmcx_modereg_params1_s cn63xx;
2260 struct cvmx_lmcx_modereg_params1_s cn63xxp1;
2261 struct cvmx_lmcx_modereg_params1_s cn66xx;
2262 struct cvmx_lmcx_modereg_params1_s cn68xx;
2263 struct cvmx_lmcx_modereg_params1_s cn68xxp1;
2264 struct cvmx_lmcx_modereg_params1_s cnf71xx;
2265};
2266
2267union cvmx_lmcx_nxm {
2268 uint64_t u64;
2269 struct cvmx_lmcx_nxm_s {
2270#ifdef __BIG_ENDIAN_BITFIELD
2271 uint64_t reserved_40_63:24;
2272 uint64_t mem_msb_d3_r1:4;
2273 uint64_t mem_msb_d3_r0:4;
2274 uint64_t mem_msb_d2_r1:4;
2275 uint64_t mem_msb_d2_r0:4;
2276 uint64_t mem_msb_d1_r1:4;
2277 uint64_t mem_msb_d1_r0:4;
2278 uint64_t mem_msb_d0_r1:4;
2279 uint64_t mem_msb_d0_r0:4;
2280 uint64_t cs_mask:8;
2281#else
2282 uint64_t cs_mask:8;
2283 uint64_t mem_msb_d0_r0:4;
2284 uint64_t mem_msb_d0_r1:4;
2285 uint64_t mem_msb_d1_r0:4;
2286 uint64_t mem_msb_d1_r1:4;
2287 uint64_t mem_msb_d2_r0:4;
2288 uint64_t mem_msb_d2_r1:4;
2289 uint64_t mem_msb_d3_r0:4;
2290 uint64_t mem_msb_d3_r1:4;
2291 uint64_t reserved_40_63:24;
2292#endif
2293 } s;
2294 struct cvmx_lmcx_nxm_cn52xx {
2295#ifdef __BIG_ENDIAN_BITFIELD
2296 uint64_t reserved_8_63:56;
2297 uint64_t cs_mask:8;
2298#else
2299 uint64_t cs_mask:8;
2300 uint64_t reserved_8_63:56;
2301#endif
2302 } cn52xx;
2303 struct cvmx_lmcx_nxm_cn52xx cn56xx;
2304 struct cvmx_lmcx_nxm_cn52xx cn58xx;
2305 struct cvmx_lmcx_nxm_s cn61xx;
2306 struct cvmx_lmcx_nxm_s cn63xx;
2307 struct cvmx_lmcx_nxm_s cn63xxp1;
2308 struct cvmx_lmcx_nxm_s cn66xx;
2309 struct cvmx_lmcx_nxm_s cn68xx;
2310 struct cvmx_lmcx_nxm_s cn68xxp1;
2311 struct cvmx_lmcx_nxm_s cnf71xx;
2312};
2313
2314union cvmx_lmcx_ops_cnt {
2315 uint64_t u64;
2316 struct cvmx_lmcx_ops_cnt_s {
2317#ifdef __BIG_ENDIAN_BITFIELD
2318 uint64_t opscnt:64;
2319#else
2320 uint64_t opscnt:64;
2321#endif
2322 } s;
2323 struct cvmx_lmcx_ops_cnt_s cn61xx;
2324 struct cvmx_lmcx_ops_cnt_s cn63xx;
2325 struct cvmx_lmcx_ops_cnt_s cn63xxp1;
2326 struct cvmx_lmcx_ops_cnt_s cn66xx;
2327 struct cvmx_lmcx_ops_cnt_s cn68xx;
2328 struct cvmx_lmcx_ops_cnt_s cn68xxp1;
2329 struct cvmx_lmcx_ops_cnt_s cnf71xx;
2330};
2331
2332union cvmx_lmcx_ops_cnt_hi {
2333 uint64_t u64;
2334 struct cvmx_lmcx_ops_cnt_hi_s {
2335#ifdef __BIG_ENDIAN_BITFIELD
2336 uint64_t reserved_32_63:32;
2337 uint64_t opscnt_hi:32;
2338#else
2339 uint64_t opscnt_hi:32;
2340 uint64_t reserved_32_63:32;
2341#endif
2342 } s;
2343 struct cvmx_lmcx_ops_cnt_hi_s cn30xx;
2344 struct cvmx_lmcx_ops_cnt_hi_s cn31xx;
2345 struct cvmx_lmcx_ops_cnt_hi_s cn38xx;
2346 struct cvmx_lmcx_ops_cnt_hi_s cn38xxp2;
2347 struct cvmx_lmcx_ops_cnt_hi_s cn50xx;
2348 struct cvmx_lmcx_ops_cnt_hi_s cn52xx;
2349 struct cvmx_lmcx_ops_cnt_hi_s cn52xxp1;
2350 struct cvmx_lmcx_ops_cnt_hi_s cn56xx;
2351 struct cvmx_lmcx_ops_cnt_hi_s cn56xxp1;
2352 struct cvmx_lmcx_ops_cnt_hi_s cn58xx;
2353 struct cvmx_lmcx_ops_cnt_hi_s cn58xxp1;
2354};
2355
2356union cvmx_lmcx_ops_cnt_lo {
2357 uint64_t u64;
2358 struct cvmx_lmcx_ops_cnt_lo_s {
2359#ifdef __BIG_ENDIAN_BITFIELD
2360 uint64_t reserved_32_63:32;
2361 uint64_t opscnt_lo:32;
2362#else
2363 uint64_t opscnt_lo:32;
2364 uint64_t reserved_32_63:32;
2365#endif
2366 } s;
2367 struct cvmx_lmcx_ops_cnt_lo_s cn30xx;
2368 struct cvmx_lmcx_ops_cnt_lo_s cn31xx;
2369 struct cvmx_lmcx_ops_cnt_lo_s cn38xx;
2370 struct cvmx_lmcx_ops_cnt_lo_s cn38xxp2;
2371 struct cvmx_lmcx_ops_cnt_lo_s cn50xx;
2372 struct cvmx_lmcx_ops_cnt_lo_s cn52xx;
2373 struct cvmx_lmcx_ops_cnt_lo_s cn52xxp1;
2374 struct cvmx_lmcx_ops_cnt_lo_s cn56xx;
2375 struct cvmx_lmcx_ops_cnt_lo_s cn56xxp1;
2376 struct cvmx_lmcx_ops_cnt_lo_s cn58xx;
2377 struct cvmx_lmcx_ops_cnt_lo_s cn58xxp1;
2378};
2379
2380union cvmx_lmcx_phy_ctl {
2381 uint64_t u64;
2382 struct cvmx_lmcx_phy_ctl_s {
2383#ifdef __BIG_ENDIAN_BITFIELD
2384 uint64_t reserved_15_63:49;
2385 uint64_t rx_always_on:1;
2386 uint64_t lv_mode:1;
2387 uint64_t ck_tune1:1;
2388 uint64_t ck_dlyout1:4;
2389 uint64_t ck_tune0:1;
2390 uint64_t ck_dlyout0:4;
2391 uint64_t loopback:1;
2392 uint64_t loopback_pos:1;
2393 uint64_t ts_stagger:1;
2394#else
2395 uint64_t ts_stagger:1;
2396 uint64_t loopback_pos:1;
2397 uint64_t loopback:1;
2398 uint64_t ck_dlyout0:4;
2399 uint64_t ck_tune0:1;
2400 uint64_t ck_dlyout1:4;
2401 uint64_t ck_tune1:1;
2402 uint64_t lv_mode:1;
2403 uint64_t rx_always_on:1;
2404 uint64_t reserved_15_63:49;
2405#endif
2406 } s;
2407 struct cvmx_lmcx_phy_ctl_s cn61xx;
2408 struct cvmx_lmcx_phy_ctl_s cn63xx;
2409 struct cvmx_lmcx_phy_ctl_cn63xxp1 {
2410#ifdef __BIG_ENDIAN_BITFIELD
2411 uint64_t reserved_14_63:50;
2412 uint64_t lv_mode:1;
2413 uint64_t ck_tune1:1;
2414 uint64_t ck_dlyout1:4;
2415 uint64_t ck_tune0:1;
2416 uint64_t ck_dlyout0:4;
2417 uint64_t loopback:1;
2418 uint64_t loopback_pos:1;
2419 uint64_t ts_stagger:1;
2420#else
2421 uint64_t ts_stagger:1;
2422 uint64_t loopback_pos:1;
2423 uint64_t loopback:1;
2424 uint64_t ck_dlyout0:4;
2425 uint64_t ck_tune0:1;
2426 uint64_t ck_dlyout1:4;
2427 uint64_t ck_tune1:1;
2428 uint64_t lv_mode:1;
2429 uint64_t reserved_14_63:50;
2430#endif
2431 } cn63xxp1;
2432 struct cvmx_lmcx_phy_ctl_s cn66xx;
2433 struct cvmx_lmcx_phy_ctl_s cn68xx;
2434 struct cvmx_lmcx_phy_ctl_s cn68xxp1;
2435 struct cvmx_lmcx_phy_ctl_s cnf71xx;
2436};
2437
2438union cvmx_lmcx_pll_bwctl {
2439 uint64_t u64;
2440 struct cvmx_lmcx_pll_bwctl_s {
2441#ifdef __BIG_ENDIAN_BITFIELD
2442 uint64_t reserved_5_63:59;
2443 uint64_t bwupd:1;
2444 uint64_t bwctl:4;
2445#else
2446 uint64_t bwctl:4;
2447 uint64_t bwupd:1;
2448 uint64_t reserved_5_63:59;
2449#endif
2450 } s;
2451 struct cvmx_lmcx_pll_bwctl_s cn30xx;
2452 struct cvmx_lmcx_pll_bwctl_s cn31xx;
2453 struct cvmx_lmcx_pll_bwctl_s cn38xx;
2454 struct cvmx_lmcx_pll_bwctl_s cn38xxp2;
2455};
2456
2457union cvmx_lmcx_pll_ctl {
2458 uint64_t u64;
2459 struct cvmx_lmcx_pll_ctl_s {
2460#ifdef __BIG_ENDIAN_BITFIELD
2461 uint64_t reserved_30_63:34;
2462 uint64_t bypass:1;
2463 uint64_t fasten_n:1;
2464 uint64_t div_reset:1;
2465 uint64_t reset_n:1;
2466 uint64_t clkf:12;
2467 uint64_t clkr:6;
2468 uint64_t reserved_6_7:2;
2469 uint64_t en16:1;
2470 uint64_t en12:1;
2471 uint64_t en8:1;
2472 uint64_t en6:1;
2473 uint64_t en4:1;
2474 uint64_t en2:1;
2475#else
2476 uint64_t en2:1;
2477 uint64_t en4:1;
2478 uint64_t en6:1;
2479 uint64_t en8:1;
2480 uint64_t en12:1;
2481 uint64_t en16:1;
2482 uint64_t reserved_6_7:2;
2483 uint64_t clkr:6;
2484 uint64_t clkf:12;
2485 uint64_t reset_n:1;
2486 uint64_t div_reset:1;
2487 uint64_t fasten_n:1;
2488 uint64_t bypass:1;
2489 uint64_t reserved_30_63:34;
2490#endif
2491 } s;
2492 struct cvmx_lmcx_pll_ctl_cn50xx {
2493#ifdef __BIG_ENDIAN_BITFIELD
2494 uint64_t reserved_29_63:35;
2495 uint64_t fasten_n:1;
2496 uint64_t div_reset:1;
2497 uint64_t reset_n:1;
2498 uint64_t clkf:12;
2499 uint64_t clkr:6;
2500 uint64_t reserved_6_7:2;
2501 uint64_t en16:1;
2502 uint64_t en12:1;
2503 uint64_t en8:1;
2504 uint64_t en6:1;
2505 uint64_t en4:1;
2506 uint64_t en2:1;
2507#else
2508 uint64_t en2:1;
2509 uint64_t en4:1;
2510 uint64_t en6:1;
2511 uint64_t en8:1;
2512 uint64_t en12:1;
2513 uint64_t en16:1;
2514 uint64_t reserved_6_7:2;
2515 uint64_t clkr:6;
2516 uint64_t clkf:12;
2517 uint64_t reset_n:1;
2518 uint64_t div_reset:1;
2519 uint64_t fasten_n:1;
2520 uint64_t reserved_29_63:35;
2521#endif
2522 } cn50xx;
2523 struct cvmx_lmcx_pll_ctl_s cn52xx;
2524 struct cvmx_lmcx_pll_ctl_s cn52xxp1;
2525 struct cvmx_lmcx_pll_ctl_cn50xx cn56xx;
2526 struct cvmx_lmcx_pll_ctl_cn56xxp1 {
2527#ifdef __BIG_ENDIAN_BITFIELD
2528 uint64_t reserved_28_63:36;
2529 uint64_t div_reset:1;
2530 uint64_t reset_n:1;
2531 uint64_t clkf:12;
2532 uint64_t clkr:6;
2533 uint64_t reserved_6_7:2;
2534 uint64_t en16:1;
2535 uint64_t en12:1;
2536 uint64_t en8:1;
2537 uint64_t en6:1;
2538 uint64_t en4:1;
2539 uint64_t en2:1;
2540#else
2541 uint64_t en2:1;
2542 uint64_t en4:1;
2543 uint64_t en6:1;
2544 uint64_t en8:1;
2545 uint64_t en12:1;
2546 uint64_t en16:1;
2547 uint64_t reserved_6_7:2;
2548 uint64_t clkr:6;
2549 uint64_t clkf:12;
2550 uint64_t reset_n:1;
2551 uint64_t div_reset:1;
2552 uint64_t reserved_28_63:36;
2553#endif
2554 } cn56xxp1;
2555 struct cvmx_lmcx_pll_ctl_cn56xxp1 cn58xx;
2556 struct cvmx_lmcx_pll_ctl_cn56xxp1 cn58xxp1;
2557};
2558
2559union cvmx_lmcx_pll_status {
2560 uint64_t u64;
2561 struct cvmx_lmcx_pll_status_s {
2562#ifdef __BIG_ENDIAN_BITFIELD
2563 uint64_t reserved_32_63:32;
2564 uint64_t ddr__nctl:5;
2565 uint64_t ddr__pctl:5;
2566 uint64_t reserved_2_21:20;
2567 uint64_t rfslip:1;
2568 uint64_t fbslip:1;
2569#else
2570 uint64_t fbslip:1;
2571 uint64_t rfslip:1;
2572 uint64_t reserved_2_21:20;
2573 uint64_t ddr__pctl:5;
2574 uint64_t ddr__nctl:5;
2575 uint64_t reserved_32_63:32;
2576#endif
2577 } s;
2578 struct cvmx_lmcx_pll_status_s cn50xx;
2579 struct cvmx_lmcx_pll_status_s cn52xx;
2580 struct cvmx_lmcx_pll_status_s cn52xxp1;
2581 struct cvmx_lmcx_pll_status_s cn56xx;
2582 struct cvmx_lmcx_pll_status_s cn56xxp1;
2583 struct cvmx_lmcx_pll_status_s cn58xx;
2584 struct cvmx_lmcx_pll_status_cn58xxp1 {
2585#ifdef __BIG_ENDIAN_BITFIELD
2586 uint64_t reserved_2_63:62;
2587 uint64_t rfslip:1;
2588 uint64_t fbslip:1;
2589#else
2590 uint64_t fbslip:1;
2591 uint64_t rfslip:1;
2592 uint64_t reserved_2_63:62;
2593#endif
2594 } cn58xxp1;
2595};
2596
2597union cvmx_lmcx_read_level_ctl {
2598 uint64_t u64;
2599 struct cvmx_lmcx_read_level_ctl_s {
2600#ifdef __BIG_ENDIAN_BITFIELD
2601 uint64_t reserved_44_63:20;
2602 uint64_t rankmask:4;
2603 uint64_t pattern:8;
2604 uint64_t row:16;
2605 uint64_t col:12;
2606 uint64_t reserved_3_3:1;
2607 uint64_t bnk:3;
2608#else
2609 uint64_t bnk:3;
2610 uint64_t reserved_3_3:1;
2611 uint64_t col:12;
2612 uint64_t row:16;
2613 uint64_t pattern:8;
2614 uint64_t rankmask:4;
2615 uint64_t reserved_44_63:20;
2616#endif
2617 } s;
2618 struct cvmx_lmcx_read_level_ctl_s cn52xx;
2619 struct cvmx_lmcx_read_level_ctl_s cn52xxp1;
2620 struct cvmx_lmcx_read_level_ctl_s cn56xx;
2621 struct cvmx_lmcx_read_level_ctl_s cn56xxp1;
2622};
2623
2624union cvmx_lmcx_read_level_dbg {
2625 uint64_t u64;
2626 struct cvmx_lmcx_read_level_dbg_s {
2627#ifdef __BIG_ENDIAN_BITFIELD
2628 uint64_t reserved_32_63:32;
2629 uint64_t bitmask:16;
2630 uint64_t reserved_4_15:12;
2631 uint64_t byte:4;
2632#else
2633 uint64_t byte:4;
2634 uint64_t reserved_4_15:12;
2635 uint64_t bitmask:16;
2636 uint64_t reserved_32_63:32;
2637#endif
2638 } s;
2639 struct cvmx_lmcx_read_level_dbg_s cn52xx;
2640 struct cvmx_lmcx_read_level_dbg_s cn52xxp1;
2641 struct cvmx_lmcx_read_level_dbg_s cn56xx;
2642 struct cvmx_lmcx_read_level_dbg_s cn56xxp1;
2643};
2644
2645union cvmx_lmcx_read_level_rankx {
2646 uint64_t u64;
2647 struct cvmx_lmcx_read_level_rankx_s {
2648#ifdef __BIG_ENDIAN_BITFIELD
2649 uint64_t reserved_38_63:26;
2650 uint64_t status:2;
2651 uint64_t byte8:4;
2652 uint64_t byte7:4;
2653 uint64_t byte6:4;
2654 uint64_t byte5:4;
2655 uint64_t byte4:4;
2656 uint64_t byte3:4;
2657 uint64_t byte2:4;
2658 uint64_t byte1:4;
2659 uint64_t byte0:4;
2660#else
2661 uint64_t byte0:4;
2662 uint64_t byte1:4;
2663 uint64_t byte2:4;
2664 uint64_t byte3:4;
2665 uint64_t byte4:4;
2666 uint64_t byte5:4;
2667 uint64_t byte6:4;
2668 uint64_t byte7:4;
2669 uint64_t byte8:4;
2670 uint64_t status:2;
2671 uint64_t reserved_38_63:26;
2672#endif
2673 } s;
2674 struct cvmx_lmcx_read_level_rankx_s cn52xx;
2675 struct cvmx_lmcx_read_level_rankx_s cn52xxp1;
2676 struct cvmx_lmcx_read_level_rankx_s cn56xx;
2677 struct cvmx_lmcx_read_level_rankx_s cn56xxp1;
2678};
2679
2680union cvmx_lmcx_reset_ctl {
2681 uint64_t u64;
2682 struct cvmx_lmcx_reset_ctl_s {
2683#ifdef __BIG_ENDIAN_BITFIELD
2684 uint64_t reserved_4_63:60;
2685 uint64_t ddr3psv:1;
2686 uint64_t ddr3psoft:1;
2687 uint64_t ddr3pwarm:1;
2688 uint64_t ddr3rst:1;
2689#else
2690 uint64_t ddr3rst:1;
2691 uint64_t ddr3pwarm:1;
2692 uint64_t ddr3psoft:1;
2693 uint64_t ddr3psv:1;
2694 uint64_t reserved_4_63:60;
2695#endif
2696 } s;
2697 struct cvmx_lmcx_reset_ctl_s cn61xx;
2698 struct cvmx_lmcx_reset_ctl_s cn63xx;
2699 struct cvmx_lmcx_reset_ctl_s cn63xxp1;
2700 struct cvmx_lmcx_reset_ctl_s cn66xx;
2701 struct cvmx_lmcx_reset_ctl_s cn68xx;
2702 struct cvmx_lmcx_reset_ctl_s cn68xxp1;
2703 struct cvmx_lmcx_reset_ctl_s cnf71xx;
2704};
2705
2706union cvmx_lmcx_rlevel_ctl {
2707 uint64_t u64;
2708 struct cvmx_lmcx_rlevel_ctl_s {
2709#ifdef __BIG_ENDIAN_BITFIELD
2710 uint64_t reserved_22_63:42;
2711 uint64_t delay_unload_3:1;
2712 uint64_t delay_unload_2:1;
2713 uint64_t delay_unload_1:1;
2714 uint64_t delay_unload_0:1;
2715 uint64_t bitmask:8;
2716 uint64_t or_dis:1;
2717 uint64_t offset_en:1;
2718 uint64_t offset:4;
2719 uint64_t byte:4;
2720#else
2721 uint64_t byte:4;
2722 uint64_t offset:4;
2723 uint64_t offset_en:1;
2724 uint64_t or_dis:1;
2725 uint64_t bitmask:8;
2726 uint64_t delay_unload_0:1;
2727 uint64_t delay_unload_1:1;
2728 uint64_t delay_unload_2:1;
2729 uint64_t delay_unload_3:1;
2730 uint64_t reserved_22_63:42;
2731#endif
2732 } s;
2733 struct cvmx_lmcx_rlevel_ctl_s cn61xx;
2734 struct cvmx_lmcx_rlevel_ctl_s cn63xx;
2735 struct cvmx_lmcx_rlevel_ctl_cn63xxp1 {
2736#ifdef __BIG_ENDIAN_BITFIELD
2737 uint64_t reserved_9_63:55;
2738 uint64_t offset_en:1;
2739 uint64_t offset:4;
2740 uint64_t byte:4;
2741#else
2742 uint64_t byte:4;
2743 uint64_t offset:4;
2744 uint64_t offset_en:1;
2745 uint64_t reserved_9_63:55;
2746#endif
2747 } cn63xxp1;
2748 struct cvmx_lmcx_rlevel_ctl_s cn66xx;
2749 struct cvmx_lmcx_rlevel_ctl_s cn68xx;
2750 struct cvmx_lmcx_rlevel_ctl_s cn68xxp1;
2751 struct cvmx_lmcx_rlevel_ctl_s cnf71xx;
2752};
2753
2754union cvmx_lmcx_rlevel_dbg {
2755 uint64_t u64;
2756 struct cvmx_lmcx_rlevel_dbg_s {
2757#ifdef __BIG_ENDIAN_BITFIELD
2758 uint64_t bitmask:64;
2759#else
2760 uint64_t bitmask:64;
2761#endif
2762 } s;
2763 struct cvmx_lmcx_rlevel_dbg_s cn61xx;
2764 struct cvmx_lmcx_rlevel_dbg_s cn63xx;
2765 struct cvmx_lmcx_rlevel_dbg_s cn63xxp1;
2766 struct cvmx_lmcx_rlevel_dbg_s cn66xx;
2767 struct cvmx_lmcx_rlevel_dbg_s cn68xx;
2768 struct cvmx_lmcx_rlevel_dbg_s cn68xxp1;
2769 struct cvmx_lmcx_rlevel_dbg_s cnf71xx;
2770};
2771
2772union cvmx_lmcx_rlevel_rankx {
2773 uint64_t u64;
2774 struct cvmx_lmcx_rlevel_rankx_s {
2775#ifdef __BIG_ENDIAN_BITFIELD
2776 uint64_t reserved_56_63:8;
2777 uint64_t status:2;
2778 uint64_t byte8:6;
2779 uint64_t byte7:6;
2780 uint64_t byte6:6;
2781 uint64_t byte5:6;
2782 uint64_t byte4:6;
2783 uint64_t byte3:6;
2784 uint64_t byte2:6;
2785 uint64_t byte1:6;
2786 uint64_t byte0:6;
2787#else
2788 uint64_t byte0:6;
2789 uint64_t byte1:6;
2790 uint64_t byte2:6;
2791 uint64_t byte3:6;
2792 uint64_t byte4:6;
2793 uint64_t byte5:6;
2794 uint64_t byte6:6;
2795 uint64_t byte7:6;
2796 uint64_t byte8:6;
2797 uint64_t status:2;
2798 uint64_t reserved_56_63:8;
2799#endif
2800 } s;
2801 struct cvmx_lmcx_rlevel_rankx_s cn61xx;
2802 struct cvmx_lmcx_rlevel_rankx_s cn63xx;
2803 struct cvmx_lmcx_rlevel_rankx_s cn63xxp1;
2804 struct cvmx_lmcx_rlevel_rankx_s cn66xx;
2805 struct cvmx_lmcx_rlevel_rankx_s cn68xx;
2806 struct cvmx_lmcx_rlevel_rankx_s cn68xxp1;
2807 struct cvmx_lmcx_rlevel_rankx_s cnf71xx;
2808};
2809
2810union cvmx_lmcx_rodt_comp_ctl {
2811 uint64_t u64;
2812 struct cvmx_lmcx_rodt_comp_ctl_s {
2813#ifdef __BIG_ENDIAN_BITFIELD
2814 uint64_t reserved_17_63:47;
2815 uint64_t enable:1;
2816 uint64_t reserved_12_15:4;
2817 uint64_t nctl:4;
2818 uint64_t reserved_5_7:3;
2819 uint64_t pctl:5;
2820#else
2821 uint64_t pctl:5;
2822 uint64_t reserved_5_7:3;
2823 uint64_t nctl:4;
2824 uint64_t reserved_12_15:4;
2825 uint64_t enable:1;
2826 uint64_t reserved_17_63:47;
2827#endif
2828 } s;
2829 struct cvmx_lmcx_rodt_comp_ctl_s cn50xx;
2830 struct cvmx_lmcx_rodt_comp_ctl_s cn52xx;
2831 struct cvmx_lmcx_rodt_comp_ctl_s cn52xxp1;
2832 struct cvmx_lmcx_rodt_comp_ctl_s cn56xx;
2833 struct cvmx_lmcx_rodt_comp_ctl_s cn56xxp1;
2834 struct cvmx_lmcx_rodt_comp_ctl_s cn58xx;
2835 struct cvmx_lmcx_rodt_comp_ctl_s cn58xxp1;
2836};
2837
2838union cvmx_lmcx_rodt_ctl {
2839 uint64_t u64;
2840 struct cvmx_lmcx_rodt_ctl_s {
2841#ifdef __BIG_ENDIAN_BITFIELD
2842 uint64_t reserved_32_63:32;
2843 uint64_t rodt_hi3:4;
2844 uint64_t rodt_hi2:4;
2845 uint64_t rodt_hi1:4;
2846 uint64_t rodt_hi0:4;
2847 uint64_t rodt_lo3:4;
2848 uint64_t rodt_lo2:4;
2849 uint64_t rodt_lo1:4;
2850 uint64_t rodt_lo0:4;
2851#else
2852 uint64_t rodt_lo0:4;
2853 uint64_t rodt_lo1:4;
2854 uint64_t rodt_lo2:4;
2855 uint64_t rodt_lo3:4;
2856 uint64_t rodt_hi0:4;
2857 uint64_t rodt_hi1:4;
2858 uint64_t rodt_hi2:4;
2859 uint64_t rodt_hi3:4;
2860 uint64_t reserved_32_63:32;
2861#endif
2862 } s;
2863 struct cvmx_lmcx_rodt_ctl_s cn30xx;
2864 struct cvmx_lmcx_rodt_ctl_s cn31xx;
2865 struct cvmx_lmcx_rodt_ctl_s cn38xx;
2866 struct cvmx_lmcx_rodt_ctl_s cn38xxp2;
2867 struct cvmx_lmcx_rodt_ctl_s cn50xx;
2868 struct cvmx_lmcx_rodt_ctl_s cn52xx;
2869 struct cvmx_lmcx_rodt_ctl_s cn52xxp1;
2870 struct cvmx_lmcx_rodt_ctl_s cn56xx;
2871 struct cvmx_lmcx_rodt_ctl_s cn56xxp1;
2872 struct cvmx_lmcx_rodt_ctl_s cn58xx;
2873 struct cvmx_lmcx_rodt_ctl_s cn58xxp1;
2874};
2875
2876union cvmx_lmcx_rodt_mask {
2877 uint64_t u64;
2878 struct cvmx_lmcx_rodt_mask_s {
2879#ifdef __BIG_ENDIAN_BITFIELD
2880 uint64_t rodt_d3_r1:8;
2881 uint64_t rodt_d3_r0:8;
2882 uint64_t rodt_d2_r1:8;
2883 uint64_t rodt_d2_r0:8;
2884 uint64_t rodt_d1_r1:8;
2885 uint64_t rodt_d1_r0:8;
2886 uint64_t rodt_d0_r1:8;
2887 uint64_t rodt_d0_r0:8;
2888#else
2889 uint64_t rodt_d0_r0:8;
2890 uint64_t rodt_d0_r1:8;
2891 uint64_t rodt_d1_r0:8;
2892 uint64_t rodt_d1_r1:8;
2893 uint64_t rodt_d2_r0:8;
2894 uint64_t rodt_d2_r1:8;
2895 uint64_t rodt_d3_r0:8;
2896 uint64_t rodt_d3_r1:8;
2897#endif
2898 } s;
2899 struct cvmx_lmcx_rodt_mask_s cn61xx;
2900 struct cvmx_lmcx_rodt_mask_s cn63xx;
2901 struct cvmx_lmcx_rodt_mask_s cn63xxp1;
2902 struct cvmx_lmcx_rodt_mask_s cn66xx;
2903 struct cvmx_lmcx_rodt_mask_s cn68xx;
2904 struct cvmx_lmcx_rodt_mask_s cn68xxp1;
2905 struct cvmx_lmcx_rodt_mask_s cnf71xx;
2906};
2907
2908union cvmx_lmcx_scramble_cfg0 {
2909 uint64_t u64;
2910 struct cvmx_lmcx_scramble_cfg0_s {
2911#ifdef __BIG_ENDIAN_BITFIELD
2912 uint64_t key:64;
2913#else
2914 uint64_t key:64;
2915#endif
2916 } s;
2917 struct cvmx_lmcx_scramble_cfg0_s cn61xx;
2918 struct cvmx_lmcx_scramble_cfg0_s cn66xx;
2919 struct cvmx_lmcx_scramble_cfg0_s cnf71xx;
2920};
2921
2922union cvmx_lmcx_scramble_cfg1 {
2923 uint64_t u64;
2924 struct cvmx_lmcx_scramble_cfg1_s {
2925#ifdef __BIG_ENDIAN_BITFIELD
2926 uint64_t key:64;
2927#else
2928 uint64_t key:64;
2929#endif
2930 } s;
2931 struct cvmx_lmcx_scramble_cfg1_s cn61xx;
2932 struct cvmx_lmcx_scramble_cfg1_s cn66xx;
2933 struct cvmx_lmcx_scramble_cfg1_s cnf71xx;
2934};
2935
2936union cvmx_lmcx_scrambled_fadr {
2937 uint64_t u64;
2938 struct cvmx_lmcx_scrambled_fadr_s {
2939#ifdef __BIG_ENDIAN_BITFIELD
2940 uint64_t reserved_36_63:28;
2941 uint64_t fdimm:2;
2942 uint64_t fbunk:1;
2943 uint64_t fbank:3;
2944 uint64_t frow:16;
2945 uint64_t fcol:14;
2946#else
2947 uint64_t fcol:14;
2948 uint64_t frow:16;
2949 uint64_t fbank:3;
2950 uint64_t fbunk:1;
2951 uint64_t fdimm:2;
2952 uint64_t reserved_36_63:28;
2953#endif
2954 } s;
2955 struct cvmx_lmcx_scrambled_fadr_s cn61xx;
2956 struct cvmx_lmcx_scrambled_fadr_s cn66xx;
2957 struct cvmx_lmcx_scrambled_fadr_s cnf71xx;
2958};
2959
2960union cvmx_lmcx_slot_ctl0 {
2961 uint64_t u64;
2962 struct cvmx_lmcx_slot_ctl0_s {
2963#ifdef __BIG_ENDIAN_BITFIELD
2964 uint64_t reserved_24_63:40;
2965 uint64_t w2w_init:6;
2966 uint64_t w2r_init:6;
2967 uint64_t r2w_init:6;
2968 uint64_t r2r_init:6;
2969#else
2970 uint64_t r2r_init:6;
2971 uint64_t r2w_init:6;
2972 uint64_t w2r_init:6;
2973 uint64_t w2w_init:6;
2974 uint64_t reserved_24_63:40;
2975#endif
2976 } s;
2977 struct cvmx_lmcx_slot_ctl0_s cn61xx;
2978 struct cvmx_lmcx_slot_ctl0_s cn63xx;
2979 struct cvmx_lmcx_slot_ctl0_s cn63xxp1;
2980 struct cvmx_lmcx_slot_ctl0_s cn66xx;
2981 struct cvmx_lmcx_slot_ctl0_s cn68xx;
2982 struct cvmx_lmcx_slot_ctl0_s cn68xxp1;
2983 struct cvmx_lmcx_slot_ctl0_s cnf71xx;
2984};
2985
2986union cvmx_lmcx_slot_ctl1 {
2987 uint64_t u64;
2988 struct cvmx_lmcx_slot_ctl1_s {
2989#ifdef __BIG_ENDIAN_BITFIELD
2990 uint64_t reserved_24_63:40;
2991 uint64_t w2w_xrank_init:6;
2992 uint64_t w2r_xrank_init:6;
2993 uint64_t r2w_xrank_init:6;
2994 uint64_t r2r_xrank_init:6;
2995#else
2996 uint64_t r2r_xrank_init:6;
2997 uint64_t r2w_xrank_init:6;
2998 uint64_t w2r_xrank_init:6;
2999 uint64_t w2w_xrank_init:6;
3000 uint64_t reserved_24_63:40;
3001#endif
3002 } s;
3003 struct cvmx_lmcx_slot_ctl1_s cn61xx;
3004 struct cvmx_lmcx_slot_ctl1_s cn63xx;
3005 struct cvmx_lmcx_slot_ctl1_s cn63xxp1;
3006 struct cvmx_lmcx_slot_ctl1_s cn66xx;
3007 struct cvmx_lmcx_slot_ctl1_s cn68xx;
3008 struct cvmx_lmcx_slot_ctl1_s cn68xxp1;
3009 struct cvmx_lmcx_slot_ctl1_s cnf71xx;
3010};
3011
3012union cvmx_lmcx_slot_ctl2 {
3013 uint64_t u64;
3014 struct cvmx_lmcx_slot_ctl2_s {
3015#ifdef __BIG_ENDIAN_BITFIELD
3016 uint64_t reserved_24_63:40;
3017 uint64_t w2w_xdimm_init:6;
3018 uint64_t w2r_xdimm_init:6;
3019 uint64_t r2w_xdimm_init:6;
3020 uint64_t r2r_xdimm_init:6;
3021#else
3022 uint64_t r2r_xdimm_init:6;
3023 uint64_t r2w_xdimm_init:6;
3024 uint64_t w2r_xdimm_init:6;
3025 uint64_t w2w_xdimm_init:6;
3026 uint64_t reserved_24_63:40;
3027#endif
3028 } s;
3029 struct cvmx_lmcx_slot_ctl2_s cn61xx;
3030 struct cvmx_lmcx_slot_ctl2_s cn63xx;
3031 struct cvmx_lmcx_slot_ctl2_s cn63xxp1;
3032 struct cvmx_lmcx_slot_ctl2_s cn66xx;
3033 struct cvmx_lmcx_slot_ctl2_s cn68xx;
3034 struct cvmx_lmcx_slot_ctl2_s cn68xxp1;
3035 struct cvmx_lmcx_slot_ctl2_s cnf71xx;
3036};
3037
3038union cvmx_lmcx_timing_params0 {
3039 uint64_t u64;
3040 struct cvmx_lmcx_timing_params0_s {
3041#ifdef __BIG_ENDIAN_BITFIELD
3042 uint64_t reserved_47_63:17;
3043 uint64_t trp_ext:1;
3044 uint64_t tcksre:4;
3045 uint64_t trp:4;
3046 uint64_t tzqinit:4;
3047 uint64_t tdllk:4;
3048 uint64_t tmod:4;
3049 uint64_t tmrd:4;
3050 uint64_t txpr:4;
3051 uint64_t tcke:4;
3052 uint64_t tzqcs:4;
3053 uint64_t tckeon:10;
3054#else
3055 uint64_t tckeon:10;
3056 uint64_t tzqcs:4;
3057 uint64_t tcke:4;
3058 uint64_t txpr:4;
3059 uint64_t tmrd:4;
3060 uint64_t tmod:4;
3061 uint64_t tdllk:4;
3062 uint64_t tzqinit:4;
3063 uint64_t trp:4;
3064 uint64_t tcksre:4;
3065 uint64_t trp_ext:1;
3066 uint64_t reserved_47_63:17;
3067#endif
3068 } s;
3069 struct cvmx_lmcx_timing_params0_cn61xx {
3070#ifdef __BIG_ENDIAN_BITFIELD
3071 uint64_t reserved_47_63:17;
3072 uint64_t trp_ext:1;
3073 uint64_t tcksre:4;
3074 uint64_t trp:4;
3075 uint64_t tzqinit:4;
3076 uint64_t tdllk:4;
3077 uint64_t tmod:4;
3078 uint64_t tmrd:4;
3079 uint64_t txpr:4;
3080 uint64_t tcke:4;
3081 uint64_t tzqcs:4;
3082 uint64_t reserved_0_9:10;
3083#else
3084 uint64_t reserved_0_9:10;
3085 uint64_t tzqcs:4;
3086 uint64_t tcke:4;
3087 uint64_t txpr:4;
3088 uint64_t tmrd:4;
3089 uint64_t tmod:4;
3090 uint64_t tdllk:4;
3091 uint64_t tzqinit:4;
3092 uint64_t trp:4;
3093 uint64_t tcksre:4;
3094 uint64_t trp_ext:1;
3095 uint64_t reserved_47_63:17;
3096#endif
3097 } cn61xx;
3098 struct cvmx_lmcx_timing_params0_cn61xx cn63xx;
3099 struct cvmx_lmcx_timing_params0_cn63xxp1 {
3100#ifdef __BIG_ENDIAN_BITFIELD
3101 uint64_t reserved_46_63:18;
3102 uint64_t tcksre:4;
3103 uint64_t trp:4;
3104 uint64_t tzqinit:4;
3105 uint64_t tdllk:4;
3106 uint64_t tmod:4;
3107 uint64_t tmrd:4;
3108 uint64_t txpr:4;
3109 uint64_t tcke:4;
3110 uint64_t tzqcs:4;
3111 uint64_t tckeon:10;
3112#else
3113 uint64_t tckeon:10;
3114 uint64_t tzqcs:4;
3115 uint64_t tcke:4;
3116 uint64_t txpr:4;
3117 uint64_t tmrd:4;
3118 uint64_t tmod:4;
3119 uint64_t tdllk:4;
3120 uint64_t tzqinit:4;
3121 uint64_t trp:4;
3122 uint64_t tcksre:4;
3123 uint64_t reserved_46_63:18;
3124#endif
3125 } cn63xxp1;
3126 struct cvmx_lmcx_timing_params0_cn61xx cn66xx;
3127 struct cvmx_lmcx_timing_params0_cn61xx cn68xx;
3128 struct cvmx_lmcx_timing_params0_cn61xx cn68xxp1;
3129 struct cvmx_lmcx_timing_params0_cn61xx cnf71xx;
3130};
3131
3132union cvmx_lmcx_timing_params1 {
3133 uint64_t u64;
3134 struct cvmx_lmcx_timing_params1_s {
3135#ifdef __BIG_ENDIAN_BITFIELD
3136 uint64_t reserved_47_63:17;
3137 uint64_t tras_ext:1;
3138 uint64_t txpdll:5;
3139 uint64_t tfaw:5;
3140 uint64_t twldqsen:4;
3141 uint64_t twlmrd:4;
3142 uint64_t txp:3;
3143 uint64_t trrd:3;
3144 uint64_t trfc:5;
3145 uint64_t twtr:4;
3146 uint64_t trcd:4;
3147 uint64_t tras:5;
3148 uint64_t tmprr:4;
3149#else
3150 uint64_t tmprr:4;
3151 uint64_t tras:5;
3152 uint64_t trcd:4;
3153 uint64_t twtr:4;
3154 uint64_t trfc:5;
3155 uint64_t trrd:3;
3156 uint64_t txp:3;
3157 uint64_t twlmrd:4;
3158 uint64_t twldqsen:4;
3159 uint64_t tfaw:5;
3160 uint64_t txpdll:5;
3161 uint64_t tras_ext:1;
3162 uint64_t reserved_47_63:17;
3163#endif
3164 } s;
3165 struct cvmx_lmcx_timing_params1_s cn61xx;
3166 struct cvmx_lmcx_timing_params1_s cn63xx;
3167 struct cvmx_lmcx_timing_params1_cn63xxp1 {
3168#ifdef __BIG_ENDIAN_BITFIELD
3169 uint64_t reserved_46_63:18;
3170 uint64_t txpdll:5;
3171 uint64_t tfaw:5;
3172 uint64_t twldqsen:4;
3173 uint64_t twlmrd:4;
3174 uint64_t txp:3;
3175 uint64_t trrd:3;
3176 uint64_t trfc:5;
3177 uint64_t twtr:4;
3178 uint64_t trcd:4;
3179 uint64_t tras:5;
3180 uint64_t tmprr:4;
3181#else
3182 uint64_t tmprr:4;
3183 uint64_t tras:5;
3184 uint64_t trcd:4;
3185 uint64_t twtr:4;
3186 uint64_t trfc:5;
3187 uint64_t trrd:3;
3188 uint64_t txp:3;
3189 uint64_t twlmrd:4;
3190 uint64_t twldqsen:4;
3191 uint64_t tfaw:5;
3192 uint64_t txpdll:5;
3193 uint64_t reserved_46_63:18;
3194#endif
3195 } cn63xxp1;
3196 struct cvmx_lmcx_timing_params1_s cn66xx;
3197 struct cvmx_lmcx_timing_params1_s cn68xx;
3198 struct cvmx_lmcx_timing_params1_s cn68xxp1;
3199 struct cvmx_lmcx_timing_params1_s cnf71xx;
3200};
3201
3202union cvmx_lmcx_tro_ctl {
3203 uint64_t u64;
3204 struct cvmx_lmcx_tro_ctl_s {
3205#ifdef __BIG_ENDIAN_BITFIELD
3206 uint64_t reserved_33_63:31;
3207 uint64_t rclk_cnt:32;
3208 uint64_t treset:1;
3209#else
3210 uint64_t treset:1;
3211 uint64_t rclk_cnt:32;
3212 uint64_t reserved_33_63:31;
3213#endif
3214 } s;
3215 struct cvmx_lmcx_tro_ctl_s cn61xx;
3216 struct cvmx_lmcx_tro_ctl_s cn63xx;
3217 struct cvmx_lmcx_tro_ctl_s cn63xxp1;
3218 struct cvmx_lmcx_tro_ctl_s cn66xx;
3219 struct cvmx_lmcx_tro_ctl_s cn68xx;
3220 struct cvmx_lmcx_tro_ctl_s cn68xxp1;
3221 struct cvmx_lmcx_tro_ctl_s cnf71xx;
3222};
3223
3224union cvmx_lmcx_tro_stat {
3225 uint64_t u64;
3226 struct cvmx_lmcx_tro_stat_s {
3227#ifdef __BIG_ENDIAN_BITFIELD
3228 uint64_t reserved_32_63:32;
3229 uint64_t ring_cnt:32;
3230#else
3231 uint64_t ring_cnt:32;
3232 uint64_t reserved_32_63:32;
3233#endif
3234 } s;
3235 struct cvmx_lmcx_tro_stat_s cn61xx;
3236 struct cvmx_lmcx_tro_stat_s cn63xx;
3237 struct cvmx_lmcx_tro_stat_s cn63xxp1;
3238 struct cvmx_lmcx_tro_stat_s cn66xx;
3239 struct cvmx_lmcx_tro_stat_s cn68xx;
3240 struct cvmx_lmcx_tro_stat_s cn68xxp1;
3241 struct cvmx_lmcx_tro_stat_s cnf71xx;
3242};
3243
3244union cvmx_lmcx_wlevel_ctl {
3245 uint64_t u64;
3246 struct cvmx_lmcx_wlevel_ctl_s {
3247#ifdef __BIG_ENDIAN_BITFIELD
3248 uint64_t reserved_22_63:42;
3249 uint64_t rtt_nom:3;
3250 uint64_t bitmask:8;
3251 uint64_t or_dis:1;
3252 uint64_t sset:1;
3253 uint64_t lanemask:9;
3254#else
3255 uint64_t lanemask:9;
3256 uint64_t sset:1;
3257 uint64_t or_dis:1;
3258 uint64_t bitmask:8;
3259 uint64_t rtt_nom:3;
3260 uint64_t reserved_22_63:42;
3261#endif
3262 } s;
3263 struct cvmx_lmcx_wlevel_ctl_s cn61xx;
3264 struct cvmx_lmcx_wlevel_ctl_s cn63xx;
3265 struct cvmx_lmcx_wlevel_ctl_cn63xxp1 {
3266#ifdef __BIG_ENDIAN_BITFIELD
3267 uint64_t reserved_10_63:54;
3268 uint64_t sset:1;
3269 uint64_t lanemask:9;
3270#else
3271 uint64_t lanemask:9;
3272 uint64_t sset:1;
3273 uint64_t reserved_10_63:54;
3274#endif
3275 } cn63xxp1;
3276 struct cvmx_lmcx_wlevel_ctl_s cn66xx;
3277 struct cvmx_lmcx_wlevel_ctl_s cn68xx;
3278 struct cvmx_lmcx_wlevel_ctl_s cn68xxp1;
3279 struct cvmx_lmcx_wlevel_ctl_s cnf71xx;
3280};
3281
3282union cvmx_lmcx_wlevel_dbg {
3283 uint64_t u64;
3284 struct cvmx_lmcx_wlevel_dbg_s {
3285#ifdef __BIG_ENDIAN_BITFIELD
3286 uint64_t reserved_12_63:52;
3287 uint64_t bitmask:8;
3288 uint64_t byte:4;
3289#else
3290 uint64_t byte:4;
3291 uint64_t bitmask:8;
3292 uint64_t reserved_12_63:52;
3293#endif
3294 } s;
3295 struct cvmx_lmcx_wlevel_dbg_s cn61xx;
3296 struct cvmx_lmcx_wlevel_dbg_s cn63xx;
3297 struct cvmx_lmcx_wlevel_dbg_s cn63xxp1;
3298 struct cvmx_lmcx_wlevel_dbg_s cn66xx;
3299 struct cvmx_lmcx_wlevel_dbg_s cn68xx;
3300 struct cvmx_lmcx_wlevel_dbg_s cn68xxp1;
3301 struct cvmx_lmcx_wlevel_dbg_s cnf71xx;
3302};
3303
3304union cvmx_lmcx_wlevel_rankx {
3305 uint64_t u64;
3306 struct cvmx_lmcx_wlevel_rankx_s {
3307#ifdef __BIG_ENDIAN_BITFIELD
3308 uint64_t reserved_47_63:17;
3309 uint64_t status:2;
3310 uint64_t byte8:5;
3311 uint64_t byte7:5;
3312 uint64_t byte6:5;
3313 uint64_t byte5:5;
3314 uint64_t byte4:5;
3315 uint64_t byte3:5;
3316 uint64_t byte2:5;
3317 uint64_t byte1:5;
3318 uint64_t byte0:5;
3319#else
3320 uint64_t byte0:5;
3321 uint64_t byte1:5;
3322 uint64_t byte2:5;
3323 uint64_t byte3:5;
3324 uint64_t byte4:5;
3325 uint64_t byte5:5;
3326 uint64_t byte6:5;
3327 uint64_t byte7:5;
3328 uint64_t byte8:5;
3329 uint64_t status:2;
3330 uint64_t reserved_47_63:17;
3331#endif
3332 } s;
3333 struct cvmx_lmcx_wlevel_rankx_s cn61xx;
3334 struct cvmx_lmcx_wlevel_rankx_s cn63xx;
3335 struct cvmx_lmcx_wlevel_rankx_s cn63xxp1;
3336 struct cvmx_lmcx_wlevel_rankx_s cn66xx;
3337 struct cvmx_lmcx_wlevel_rankx_s cn68xx;
3338 struct cvmx_lmcx_wlevel_rankx_s cn68xxp1;
3339 struct cvmx_lmcx_wlevel_rankx_s cnf71xx;
3340};
3341
3342union cvmx_lmcx_wodt_ctl0 {
3343 uint64_t u64;
3344 struct cvmx_lmcx_wodt_ctl0_s {
3345#ifdef __BIG_ENDIAN_BITFIELD
3346 uint64_t reserved_0_63:64;
3347#else
3348 uint64_t reserved_0_63:64;
3349#endif
3350 } s;
3351 struct cvmx_lmcx_wodt_ctl0_cn30xx {
3352#ifdef __BIG_ENDIAN_BITFIELD
3353 uint64_t reserved_32_63:32;
3354 uint64_t wodt_d1_r1:8;
3355 uint64_t wodt_d1_r0:8;
3356 uint64_t wodt_d0_r1:8;
3357 uint64_t wodt_d0_r0:8;
3358#else
3359 uint64_t wodt_d0_r0:8;
3360 uint64_t wodt_d0_r1:8;
3361 uint64_t wodt_d1_r0:8;
3362 uint64_t wodt_d1_r1:8;
3363 uint64_t reserved_32_63:32;
3364#endif
3365 } cn30xx;
3366 struct cvmx_lmcx_wodt_ctl0_cn30xx cn31xx;
3367 struct cvmx_lmcx_wodt_ctl0_cn38xx {
3368#ifdef __BIG_ENDIAN_BITFIELD
3369 uint64_t reserved_32_63:32;
3370 uint64_t wodt_hi3:4;
3371 uint64_t wodt_hi2:4;
3372 uint64_t wodt_hi1:4;
3373 uint64_t wodt_hi0:4;
3374 uint64_t wodt_lo3:4;
3375 uint64_t wodt_lo2:4;
3376 uint64_t wodt_lo1:4;
3377 uint64_t wodt_lo0:4;
3378#else
3379 uint64_t wodt_lo0:4;
3380 uint64_t wodt_lo1:4;
3381 uint64_t wodt_lo2:4;
3382 uint64_t wodt_lo3:4;
3383 uint64_t wodt_hi0:4;
3384 uint64_t wodt_hi1:4;
3385 uint64_t wodt_hi2:4;
3386 uint64_t wodt_hi3:4;
3387 uint64_t reserved_32_63:32;
3388#endif
3389 } cn38xx;
3390 struct cvmx_lmcx_wodt_ctl0_cn38xx cn38xxp2;
3391 struct cvmx_lmcx_wodt_ctl0_cn38xx cn50xx;
3392 struct cvmx_lmcx_wodt_ctl0_cn30xx cn52xx;
3393 struct cvmx_lmcx_wodt_ctl0_cn30xx cn52xxp1;
3394 struct cvmx_lmcx_wodt_ctl0_cn30xx cn56xx;
3395 struct cvmx_lmcx_wodt_ctl0_cn30xx cn56xxp1;
3396 struct cvmx_lmcx_wodt_ctl0_cn38xx cn58xx;
3397 struct cvmx_lmcx_wodt_ctl0_cn38xx cn58xxp1;
3398};
3399
3400union cvmx_lmcx_wodt_ctl1 {
3401 uint64_t u64;
3402 struct cvmx_lmcx_wodt_ctl1_s {
3403#ifdef __BIG_ENDIAN_BITFIELD
3404 uint64_t reserved_32_63:32;
3405 uint64_t wodt_d3_r1:8;
3406 uint64_t wodt_d3_r0:8;
3407 uint64_t wodt_d2_r1:8;
3408 uint64_t wodt_d2_r0:8;
3409#else
3410 uint64_t wodt_d2_r0:8;
3411 uint64_t wodt_d2_r1:8;
3412 uint64_t wodt_d3_r0:8;
3413 uint64_t wodt_d3_r1:8;
3414 uint64_t reserved_32_63:32;
3415#endif
3416 } s;
3417 struct cvmx_lmcx_wodt_ctl1_s cn30xx;
3418 struct cvmx_lmcx_wodt_ctl1_s cn31xx;
3419 struct cvmx_lmcx_wodt_ctl1_s cn52xx;
3420 struct cvmx_lmcx_wodt_ctl1_s cn52xxp1;
3421 struct cvmx_lmcx_wodt_ctl1_s cn56xx;
3422 struct cvmx_lmcx_wodt_ctl1_s cn56xxp1;
3423};
3424
3425union cvmx_lmcx_wodt_mask {
3426 uint64_t u64;
3427 struct cvmx_lmcx_wodt_mask_s {
3428#ifdef __BIG_ENDIAN_BITFIELD
3429 uint64_t wodt_d3_r1:8;
3430 uint64_t wodt_d3_r0:8;
3431 uint64_t wodt_d2_r1:8;
3432 uint64_t wodt_d2_r0:8;
3433 uint64_t wodt_d1_r1:8;
3434 uint64_t wodt_d1_r0:8;
3435 uint64_t wodt_d0_r1:8;
3436 uint64_t wodt_d0_r0:8;
3437#else
3438 uint64_t wodt_d0_r0:8;
3439 uint64_t wodt_d0_r1:8;
3440 uint64_t wodt_d1_r0:8;
3441 uint64_t wodt_d1_r1:8;
3442 uint64_t wodt_d2_r0:8;
3443 uint64_t wodt_d2_r1:8;
3444 uint64_t wodt_d3_r0:8;
3445 uint64_t wodt_d3_r1:8;
3446#endif
3447 } s;
3448 struct cvmx_lmcx_wodt_mask_s cn61xx;
3449 struct cvmx_lmcx_wodt_mask_s cn63xx;
3450 struct cvmx_lmcx_wodt_mask_s cn63xxp1;
3451 struct cvmx_lmcx_wodt_mask_s cn66xx;
3452 struct cvmx_lmcx_wodt_mask_s cn68xx;
3453 struct cvmx_lmcx_wodt_mask_s cn68xxp1;
3454 struct cvmx_lmcx_wodt_mask_s cnf71xx;
3455};
3456
3457#endif
diff --git a/arch/mips/include/asm/octeon/octeon-model.h b/arch/mips/include/asm/octeon/octeon-model.h
index 14dd11f4492a..349bb2ba840c 100644
--- a/arch/mips/include/asm/octeon/octeon-model.h
+++ b/arch/mips/include/asm/octeon/octeon-model.h
@@ -218,6 +218,12 @@
218#define OCTEON_CN5XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS) 218#define OCTEON_CN5XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS)
219#define OCTEON_CN6XXX (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS) 219#define OCTEON_CN6XXX (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS)
220 220
221/* These are used to cover entire families of OCTEON processors */
222#define OCTEON_FAM_1 (OCTEON_CN3XXX)
223#define OCTEON_FAM_PLUS (OCTEON_CN5XXX)
224#define OCTEON_FAM_1_PLUS (OCTEON_FAM_PLUS | OM_MATCH_PREVIOUS_MODELS)
225#define OCTEON_FAM_2 (OCTEON_CN6XXX)
226
221/* The revision byte (low byte) has two different encodings. 227/* The revision byte (low byte) has two different encodings.
222 * CN3XXX: 228 * CN3XXX:
223 * 229 *
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h
index 790939dd8244..254e9954ed71 100644
--- a/arch/mips/include/asm/octeon/octeon.h
+++ b/arch/mips/include/asm/octeon/octeon.h
@@ -209,13 +209,6 @@ union octeon_cvmemctl {
209 } s; 209 } s;
210}; 210};
211 211
212struct octeon_cf_data {
213 unsigned long base_region_bias;
214 unsigned int base_region; /* The chip select region used by CF */
215 int is16bit; /* 0 - 8bit, !0 - 16bit */
216 int dma_engine; /* -1 for no DMA */
217};
218
219extern void octeon_write_lcd(const char *s); 212extern void octeon_write_lcd(const char *s);
220extern void octeon_check_cpu_bist(void); 213extern void octeon_check_cpu_bist(void);
221extern int octeon_get_boot_debug_flag(void); 214extern int octeon_get_boot_debug_flag(void);
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index da9bd7d270d1..31ab10f02bad 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -31,19 +31,19 @@
31#define PAGE_SHIFT 16 31#define PAGE_SHIFT 16
32#endif 32#endif
33#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 33#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
34#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 34#define PAGE_MASK (~(PAGE_SIZE - 1))
35 35
36#ifdef CONFIG_HUGETLB_PAGE 36#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
37#define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) 37#define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3)
38#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 38#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
39#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 39#define HPAGE_MASK (~(HPAGE_SIZE - 1))
40#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 40#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
41#else /* !CONFIG_HUGETLB_PAGE */ 41#else /* !CONFIG_MIPS_HUGE_TLB_SUPPORT */
42#define HPAGE_SHIFT ({BUILD_BUG(); 0; }) 42#define HPAGE_SHIFT ({BUILD_BUG(); 0; })
43#define HPAGE_SIZE ({BUILD_BUG(); 0; }) 43#define HPAGE_SIZE ({BUILD_BUG(); 0; })
44#define HPAGE_MASK ({BUILD_BUG(); 0; }) 44#define HPAGE_MASK ({BUILD_BUG(); 0; })
45#define HUGETLB_PAGE_ORDER ({BUILD_BUG(); 0; }) 45#define HUGETLB_PAGE_ORDER ({BUILD_BUG(); 0; })
46#endif /* CONFIG_HUGETLB_PAGE */ 46#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
47 47
48#ifndef __ASSEMBLY__ 48#ifndef __ASSEMBLY__
49 49
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index f5b521d5a67d..c63191055e69 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -175,7 +175,7 @@ static inline int pmd_none(pmd_t pmd)
175 175
176static inline int pmd_bad(pmd_t pmd) 176static inline int pmd_bad(pmd_t pmd)
177{ 177{
178#ifdef CONFIG_HUGETLB_PAGE 178#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
179 /* pmd_huge(pmd) but inline */ 179 /* pmd_huge(pmd) but inline */
180 if (unlikely(pmd_val(pmd) & _PAGE_HUGE)) 180 if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
181 return 0; 181 return 0;
diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h
index da4ba49adcf6..f6a0439a4085 100644
--- a/arch/mips/include/asm/pgtable-bits.h
+++ b/arch/mips/include/asm/pgtable-bits.h
@@ -34,38 +34,72 @@
34 */ 34 */
35#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 35#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
36 36
37#define _PAGE_PRESENT (1<<6) /* implemented in software */ 37/*
38#define _PAGE_READ (1<<7) /* implemented in software */ 38 * The following bits are directly used by the TLB hardware
39#define _PAGE_WRITE (1<<8) /* implemented in software */ 39 */
40#define _PAGE_ACCESSED (1<<9) /* implemented in software */ 40#define _PAGE_R4KBUG (1 << 0) /* workaround for r4k bug */
41#define _PAGE_MODIFIED (1<<10) /* implemented in software */ 41#define _PAGE_GLOBAL (1 << 0)
42#define _PAGE_FILE (1<<10) /* set:pagecache unset:swap */ 42#define _PAGE_VALID_SHIFT 1
43 43#define _PAGE_VALID (1 << _PAGE_VALID_SHIFT)
44#define _PAGE_R4KBUG (1<<0) /* workaround for r4k bug */ 44#define _PAGE_SILENT_READ (1 << 1) /* synonym */
45#define _PAGE_GLOBAL (1<<0) 45#define _PAGE_DIRTY_SHIFT 2
46#define _PAGE_VALID (1<<1) 46#define _PAGE_DIRTY (1 << _PAGE_DIRTY_SHIFT) /* The MIPS dirty bit */
47#define _PAGE_SILENT_READ (1<<1) /* synonym */ 47#define _PAGE_SILENT_WRITE (1 << 2)
48#define _PAGE_DIRTY (1<<2) /* The MIPS dirty bit */ 48#define _CACHE_SHIFT 3
49#define _PAGE_SILENT_WRITE (1<<2) 49#define _CACHE_MASK (7 << 3)
50#define _CACHE_SHIFT 3 50
51#define _CACHE_MASK (7<<3) 51/*
52 * The following bits are implemented in software
53 *
54 * _PAGE_FILE semantics: set:pagecache unset:swap
55 */
56#define _PAGE_PRESENT_SHIFT 6
57#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT)
58#define _PAGE_READ_SHIFT 7
59#define _PAGE_READ (1 << _PAGE_READ_SHIFT)
60#define _PAGE_WRITE_SHIFT 8
61#define _PAGE_WRITE (1 << _PAGE_WRITE_SHIFT)
62#define _PAGE_ACCESSED_SHIFT 9
63#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT)
64#define _PAGE_MODIFIED_SHIFT 10
65#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT)
66
67#define _PAGE_FILE (1 << 10)
52 68
53#elif defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) 69#elif defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
54 70
55#define _PAGE_PRESENT (1<<0) /* implemented in software */ 71/*
56#define _PAGE_READ (1<<1) /* implemented in software */ 72 * The following are implemented by software
57#define _PAGE_WRITE (1<<2) /* implemented in software */ 73 *
58#define _PAGE_ACCESSED (1<<3) /* implemented in software */ 74 * _PAGE_FILE semantics: set:pagecache unset:swap
59#define _PAGE_MODIFIED (1<<4) /* implemented in software */ 75 */
60#define _PAGE_FILE (1<<4) /* set:pagecache unset:swap */ 76#define _PAGE_PRESENT_SHIFT 0
61 77#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT)
62#define _PAGE_GLOBAL (1<<8) 78#define _PAGE_READ_SHIFT 1
63#define _PAGE_VALID (1<<9) 79#define _PAGE_READ (1 << _PAGE_READ_SHIFT)
64#define _PAGE_SILENT_READ (1<<9) /* synonym */ 80#define _PAGE_WRITE_SHIFT 2
65#define _PAGE_DIRTY (1<<10) /* The MIPS dirty bit */ 81#define _PAGE_WRITE (1 << _PAGE_WRITE_SHIFT)
66#define _PAGE_SILENT_WRITE (1<<10) 82#define _PAGE_ACCESSED_SHIFT 3
67#define _CACHE_UNCACHED (1<<11) 83#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT)
68#define _CACHE_MASK (1<<11) 84#define _PAGE_MODIFIED_SHIFT 4
85#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT)
86#define _PAGE_FILE_SHIFT 4
87#define _PAGE_FILE (1 << _PAGE_FILE_SHIFT)
88
89/*
90 * And these are the hardware TLB bits
91 */
92#define _PAGE_GLOBAL_SHIFT 8
93#define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT)
94#define _PAGE_VALID_SHIFT 9
95#define _PAGE_VALID (1 << _PAGE_VALID_SHIFT)
96#define _PAGE_SILENT_READ (1 << _PAGE_VALID_SHIFT) /* synonym */
97#define _PAGE_DIRTY_SHIFT 10
98#define _PAGE_DIRTY (1 << _PAGE_DIRTY_SHIFT)
99#define _PAGE_SILENT_WRITE (1 << _PAGE_DIRTY_SHIFT)
100#define _CACHE_UNCACHED_SHIFT 11
101#define _CACHE_UNCACHED (1 << _CACHE_UNCACHED_SHIFT)
102#define _CACHE_MASK (1 << _CACHE_UNCACHED_SHIFT)
69 103
70#else /* 'Normal' r4K case */ 104#else /* 'Normal' r4K case */
71/* 105/*
@@ -76,25 +110,25 @@
76 * which is more than we need right now. 110 * which is more than we need right now.
77 */ 111 */
78 112
79/* implemented in software */ 113/*
114 * The following bits are implemented in software
115 *
116 * _PAGE_READ / _PAGE_READ_SHIFT should be unused if cpu_has_rixi.
117 * _PAGE_FILE semantics: set:pagecache unset:swap
118 */
80#define _PAGE_PRESENT_SHIFT (0) 119#define _PAGE_PRESENT_SHIFT (0)
81#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT) 120#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT)
82/* implemented in software, should be unused if cpu_has_rixi. */
83#define _PAGE_READ_SHIFT (cpu_has_rixi ? _PAGE_PRESENT_SHIFT : _PAGE_PRESENT_SHIFT + 1) 121#define _PAGE_READ_SHIFT (cpu_has_rixi ? _PAGE_PRESENT_SHIFT : _PAGE_PRESENT_SHIFT + 1)
84#define _PAGE_READ ({BUG_ON(cpu_has_rixi); 1 << _PAGE_READ_SHIFT; }) 122#define _PAGE_READ ({BUG_ON(cpu_has_rixi); 1 << _PAGE_READ_SHIFT; })
85/* implemented in software */
86#define _PAGE_WRITE_SHIFT (_PAGE_READ_SHIFT + 1) 123#define _PAGE_WRITE_SHIFT (_PAGE_READ_SHIFT + 1)
87#define _PAGE_WRITE (1 << _PAGE_WRITE_SHIFT) 124#define _PAGE_WRITE (1 << _PAGE_WRITE_SHIFT)
88/* implemented in software */
89#define _PAGE_ACCESSED_SHIFT (_PAGE_WRITE_SHIFT + 1) 125#define _PAGE_ACCESSED_SHIFT (_PAGE_WRITE_SHIFT + 1)
90#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT) 126#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT)
91/* implemented in software */
92#define _PAGE_MODIFIED_SHIFT (_PAGE_ACCESSED_SHIFT + 1) 127#define _PAGE_MODIFIED_SHIFT (_PAGE_ACCESSED_SHIFT + 1)
93#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT) 128#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT)
94/* set:pagecache unset:swap */
95#define _PAGE_FILE (_PAGE_MODIFIED) 129#define _PAGE_FILE (_PAGE_MODIFIED)
96 130
97#ifdef CONFIG_HUGETLB_PAGE 131#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
98/* huge tlb page */ 132/* huge tlb page */
99#define _PAGE_HUGE_SHIFT (_PAGE_MODIFIED_SHIFT + 1) 133#define _PAGE_HUGE_SHIFT (_PAGE_MODIFIED_SHIFT + 1)
100#define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT) 134#define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT)
@@ -103,8 +137,17 @@
103#define _PAGE_HUGE ({BUG(); 1; }) /* Dummy value */ 137#define _PAGE_HUGE ({BUG(); 1; }) /* Dummy value */
104#endif 138#endif
105 139
140#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
141/* huge tlb page */
142#define _PAGE_SPLITTING_SHIFT (_PAGE_HUGE_SHIFT + 1)
143#define _PAGE_SPLITTING (1 << _PAGE_SPLITTING_SHIFT)
144#else
145#define _PAGE_SPLITTING_SHIFT (_PAGE_HUGE_SHIFT)
146#define _PAGE_SPLITTING ({BUG(); 1; }) /* Dummy value */
147#endif
148
106/* Page cannot be executed */ 149/* Page cannot be executed */
107#define _PAGE_NO_EXEC_SHIFT (cpu_has_rixi ? _PAGE_HUGE_SHIFT + 1 : _PAGE_HUGE_SHIFT) 150#define _PAGE_NO_EXEC_SHIFT (cpu_has_rixi ? _PAGE_SPLITTING_SHIFT + 1 : _PAGE_SPLITTING_SHIFT)
108#define _PAGE_NO_EXEC ({BUG_ON(!cpu_has_rixi); 1 << _PAGE_NO_EXEC_SHIFT; }) 151#define _PAGE_NO_EXEC ({BUG_ON(!cpu_has_rixi); 1 << _PAGE_NO_EXEC_SHIFT; })
109 152
110/* Page cannot be read */ 153/* Page cannot be read */
@@ -192,20 +235,6 @@ static inline uint64_t pte_to_entrylo(unsigned long pte_val)
192#define _CACHE_CACHABLE_NONCOHERENT (5<<_CACHE_SHIFT) 235#define _CACHE_CACHABLE_NONCOHERENT (5<<_CACHE_SHIFT)
193#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT) 236#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT)
194 237
195#elif defined(CONFIG_CPU_RM9000)
196
197#define _CACHE_WT (0<<_CACHE_SHIFT)
198#define _CACHE_WTWA (1<<_CACHE_SHIFT)
199#define _CACHE_UC_B (2<<_CACHE_SHIFT)
200#define _CACHE_WB (3<<_CACHE_SHIFT)
201#define _CACHE_CWBEA (4<<_CACHE_SHIFT)
202#define _CACHE_CWB (5<<_CACHE_SHIFT)
203#define _CACHE_UCNB (6<<_CACHE_SHIFT)
204#define _CACHE_FPC (7<<_CACHE_SHIFT)
205
206#define _CACHE_UNCACHED _CACHE_UC_B
207#define _CACHE_CACHABLE_NONCOHERENT _CACHE_WB
208
209#else 238#else
210 239
211#define _CACHE_CACHABLE_NO_WA (0<<_CACHE_SHIFT) /* R4600 only */ 240#define _CACHE_CACHABLE_NO_WA (0<<_CACHE_SHIFT) /* R4600 only */
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index c02158be836c..252202d24a84 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -8,6 +8,7 @@
8#ifndef _ASM_PGTABLE_H 8#ifndef _ASM_PGTABLE_H
9#define _ASM_PGTABLE_H 9#define _ASM_PGTABLE_H
10 10
11#include <linux/mmzone.h>
11#ifdef CONFIG_32BIT 12#ifdef CONFIG_32BIT
12#include <asm/pgtable-32.h> 13#include <asm/pgtable-32.h>
13#endif 14#endif
@@ -94,7 +95,12 @@ extern void paging_init(void);
94 * and a page entry and page directory to the page they refer to. 95 * and a page entry and page directory to the page they refer to.
95 */ 96 */
96#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd)) 97#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
97#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) 98
99#define __pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
100#ifndef CONFIG_TRANSPARENT_HUGEPAGE
101#define pmd_page(pmd) __pmd_page(pmd)
102#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
103
98#define pmd_page_vaddr(pmd) pmd_val(pmd) 104#define pmd_page_vaddr(pmd) pmd_val(pmd)
99 105
100#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 106#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
@@ -107,7 +113,6 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
107 ptep->pte_high = pte.pte_high; 113 ptep->pte_high = pte.pte_high;
108 smp_wmb(); 114 smp_wmb();
109 ptep->pte_low = pte.pte_low; 115 ptep->pte_low = pte.pte_low;
110 //printk("pte_high %x pte_low %x\n", ptep->pte_high, ptep->pte_low);
111 116
112 if (pte.pte_low & _PAGE_GLOBAL) { 117 if (pte.pte_low & _PAGE_GLOBAL) {
113 pte_t *buddy = ptep_buddy(ptep); 118 pte_t *buddy = ptep_buddy(ptep);
@@ -375,6 +380,14 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
375 __update_cache(vma, address, pte); 380 __update_cache(vma, address, pte);
376} 381}
377 382
383static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
384 unsigned long address, pmd_t *pmdp)
385{
386 pte_t pte = *(pte_t *)pmdp;
387
388 __update_tlb(vma, address, pte);
389}
390
378#define kern_addr_valid(addr) (1) 391#define kern_addr_valid(addr) (1)
379 392
380#ifdef CONFIG_64BIT_PHYS_ADDR 393#ifdef CONFIG_64BIT_PHYS_ADDR
@@ -394,6 +407,157 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
394 remap_pfn_range(vma, vaddr, pfn, size, prot) 407 remap_pfn_range(vma, vaddr, pfn, size, prot)
395#endif 408#endif
396 409
410#ifdef CONFIG_TRANSPARENT_HUGEPAGE
411
412extern int has_transparent_hugepage(void);
413
414static inline int pmd_trans_huge(pmd_t pmd)
415{
416 return !!(pmd_val(pmd) & _PAGE_HUGE);
417}
418
419static inline pmd_t pmd_mkhuge(pmd_t pmd)
420{
421 pmd_val(pmd) |= _PAGE_HUGE;
422
423 return pmd;
424}
425
426static inline int pmd_trans_splitting(pmd_t pmd)
427{
428 return !!(pmd_val(pmd) & _PAGE_SPLITTING);
429}
430
431static inline pmd_t pmd_mksplitting(pmd_t pmd)
432{
433 pmd_val(pmd) |= _PAGE_SPLITTING;
434
435 return pmd;
436}
437
438extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
439 pmd_t *pmdp, pmd_t pmd);
440
441#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH
442/* Extern to avoid header file madness */
443extern void pmdp_splitting_flush(struct vm_area_struct *vma,
444 unsigned long address,
445 pmd_t *pmdp);
446
447#define __HAVE_ARCH_PMD_WRITE
448static inline int pmd_write(pmd_t pmd)
449{
450 return !!(pmd_val(pmd) & _PAGE_WRITE);
451}
452
453static inline pmd_t pmd_wrprotect(pmd_t pmd)
454{
455 pmd_val(pmd) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
456 return pmd;
457}
458
459static inline pmd_t pmd_mkwrite(pmd_t pmd)
460{
461 pmd_val(pmd) |= _PAGE_WRITE;
462 if (pmd_val(pmd) & _PAGE_MODIFIED)
463 pmd_val(pmd) |= _PAGE_SILENT_WRITE;
464
465 return pmd;
466}
467
468static inline int pmd_dirty(pmd_t pmd)
469{
470 return !!(pmd_val(pmd) & _PAGE_MODIFIED);
471}
472
473static inline pmd_t pmd_mkclean(pmd_t pmd)
474{
475 pmd_val(pmd) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
476 return pmd;
477}
478
479static inline pmd_t pmd_mkdirty(pmd_t pmd)
480{
481 pmd_val(pmd) |= _PAGE_MODIFIED;
482 if (pmd_val(pmd) & _PAGE_WRITE)
483 pmd_val(pmd) |= _PAGE_SILENT_WRITE;
484
485 return pmd;
486}
487
488static inline int pmd_young(pmd_t pmd)
489{
490 return !!(pmd_val(pmd) & _PAGE_ACCESSED);
491}
492
493static inline pmd_t pmd_mkold(pmd_t pmd)
494{
495 pmd_val(pmd) &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ);
496
497 return pmd;
498}
499
500static inline pmd_t pmd_mkyoung(pmd_t pmd)
501{
502 pmd_val(pmd) |= _PAGE_ACCESSED;
503
504 if (cpu_has_rixi) {
505 if (!(pmd_val(pmd) & _PAGE_NO_READ))
506 pmd_val(pmd) |= _PAGE_SILENT_READ;
507 } else {
508 if (pmd_val(pmd) & _PAGE_READ)
509 pmd_val(pmd) |= _PAGE_SILENT_READ;
510 }
511
512 return pmd;
513}
514
515/* Extern to avoid header file madness */
516extern pmd_t mk_pmd(struct page *page, pgprot_t prot);
517
518static inline unsigned long pmd_pfn(pmd_t pmd)
519{
520 return pmd_val(pmd) >> _PFN_SHIFT;
521}
522
523static inline struct page *pmd_page(pmd_t pmd)
524{
525 if (pmd_trans_huge(pmd))
526 return pfn_to_page(pmd_pfn(pmd));
527
528 return pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT);
529}
530
531static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
532{
533 pmd_val(pmd) = (pmd_val(pmd) & _PAGE_CHG_MASK) | pgprot_val(newprot);
534 return pmd;
535}
536
537static inline pmd_t pmd_mknotpresent(pmd_t pmd)
538{
539 pmd_val(pmd) &= ~(_PAGE_PRESENT | _PAGE_VALID | _PAGE_DIRTY);
540
541 return pmd;
542}
543
544/*
545 * The generic version pmdp_get_and_clear uses a version of pmd_clear() with a
546 * different prototype.
547 */
548#define __HAVE_ARCH_PMDP_GET_AND_CLEAR
549static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
550 unsigned long address, pmd_t *pmdp)
551{
552 pmd_t old = *pmdp;
553
554 pmd_clear(pmdp);
555
556 return old;
557}
558
559#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
560
397#include <asm-generic/pgtable.h> 561#include <asm-generic/pgtable.h>
398 562
399/* 563/*
diff --git a/arch/mips/include/asm/pmc-sierra/msp71xx/war.h b/arch/mips/include/asm/pmc-sierra/msp71xx/war.h
index 9e2ee429c529..c74eb1657f5f 100644
--- a/arch/mips/include/asm/pmc-sierra/msp71xx/war.h
+++ b/arch/mips/include/asm/pmc-sierra/msp71xx/war.h
@@ -17,7 +17,6 @@
17#define MIPS4K_ICACHE_REFILL_WAR 0 17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0 18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 20#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
23#if defined(CONFIG_PMC_MSP7120_EVAL) || defined(CONFIG_PMC_MSP7120_GW) || \ 22#if defined(CONFIG_PMC_MSP7120_EVAL) || defined(CONFIG_PMC_MSP7120_GW) || \
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index 5e33fabe354d..8481c1a5219e 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -226,8 +226,6 @@ struct thread_struct {
226 unsigned long cp0_badvaddr; /* Last user fault */ 226 unsigned long cp0_badvaddr; /* Last user fault */
227 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */ 227 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
228 unsigned long error_code; 228 unsigned long error_code;
229 unsigned long irix_trampoline; /* Wheee... */
230 unsigned long irix_oldctx;
231#ifdef CONFIG_CPU_CAVIUM_OCTEON 229#ifdef CONFIG_CPU_CAVIUM_OCTEON
232 struct octeon_cop2_state cp2 __attribute__ ((__aligned__(128))); 230 struct octeon_cop2_state cp2 __attribute__ ((__aligned__(128)));
233 struct octeon_cvmseg_state cvmseg __attribute__ ((__aligned__(128))); 231 struct octeon_cvmseg_state cvmseg __attribute__ ((__aligned__(128)));
@@ -297,8 +295,6 @@ struct thread_struct {
297 .cp0_badvaddr = 0, \ 295 .cp0_badvaddr = 0, \
298 .cp0_baduaddr = 0, \ 296 .cp0_baduaddr = 0, \
299 .error_code = 0, \ 297 .error_code = 0, \
300 .irix_trampoline = 0, \
301 .irix_oldctx = 0, \
302 /* \ 298 /* \
303 * Cavium Octeon specifics (null if not Octeon) \ 299 * Cavium Octeon specifics (null if not Octeon) \
304 */ \ 300 */ \
diff --git a/arch/mips/include/asm/sgiarcs.h b/arch/mips/include/asm/sgiarcs.h
index 149342951436..3dce7c788b3e 100644
--- a/arch/mips/include/asm/sgiarcs.h
+++ b/arch/mips/include/asm/sgiarcs.h
@@ -366,7 +366,7 @@ struct linux_smonblock {
366 * Macros for calling a 32-bit ARC implementation from 64-bit code 366 * Macros for calling a 32-bit ARC implementation from 64-bit code
367 */ 367 */
368 368
369#if defined(CONFIG_64BIT) && defined(CONFIG_ARC32) 369#if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32)
370 370
371#define __arc_clobbers \ 371#define __arc_clobbers \
372 "$2", "$3" /* ... */, "$8", "$9", "$10", "$11", \ 372 "$2", "$3" /* ... */, "$8", "$9", "$10", "$11", \
@@ -475,10 +475,10 @@ struct linux_smonblock {
475 __res; \ 475 __res; \
476}) 476})
477 477
478#endif /* defined(CONFIG_64BIT) && defined(CONFIG_ARC32) */ 478#endif /* defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32) */
479 479
480#if (defined(CONFIG_32BIT) && defined(CONFIG_ARC32)) || \ 480#if (defined(CONFIG_32BIT) && defined(CONFIG_FW_ARC32)) || \
481 (defined(CONFIG_64BIT) && defined(CONFIG_ARC64)) 481 (defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC64))
482 482
483#define ARC_CALL0(dest) \ 483#define ARC_CALL0(dest) \
484({ long __res; \ 484({ long __res; \
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index d4fb4d852a6d..f33b5fd6972b 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -40,6 +40,8 @@ extern int __cpu_logical_map[NR_CPUS];
40#define SMP_CALL_FUNCTION 0x2 40#define SMP_CALL_FUNCTION 0x2
41/* Octeon - Tell another core to flush its icache */ 41/* Octeon - Tell another core to flush its icache */
42#define SMP_ICACHE_FLUSH 0x4 42#define SMP_ICACHE_FLUSH 0x4
43/* Used by kexec crashdump to save all cpu's state */
44#define SMP_DUMP 0x8
43 45
44extern volatile cpumask_t cpu_callin_map; 46extern volatile cpumask_t cpu_callin_map;
45 47
@@ -91,4 +93,8 @@ static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
91 mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION); 93 mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
92} 94}
93 95
96#if defined(CONFIG_KEXEC)
97extern void (*dump_ipi_function_ptr)(void *);
98void dump_send_ipi(void (*dump_ipi_callback)(void *));
99#endif
94#endif /* __ASM_SMP_H */ 100#endif /* __ASM_SMP_H */
diff --git a/arch/mips/include/asm/smvp.h b/arch/mips/include/asm/smvp.h
deleted file mode 100644
index 0d0e80a39e8a..000000000000
--- a/arch/mips/include/asm/smvp.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_SMVP_H
2#define _ASM_SMVP_H
3
4/*
5 * Definitions for SMVP multitasking on MIPS MT cores
6 */
7struct task_struct;
8
9extern void smvp_smp_setup(void);
10extern void smvp_smp_finish(void);
11extern void smvp_boot_secondary(int cpu, struct task_struct *t);
12extern void smvp_init_secondary(void);
13extern void smvp_smp_finish(void);
14extern void smvp_cpus_done(void);
15extern void smvp_prepare_cpus(unsigned int max_cpus);
16
17/* This is platform specific */
18extern void smvp_send_ipi(int cpu, unsigned int action);
19#endif /* _ASM_SMVP_H */
diff --git a/arch/mips/include/asm/sparsemem.h b/arch/mips/include/asm/sparsemem.h
index 4461198361c9..65900dab3ad3 100644
--- a/arch/mips/include/asm/sparsemem.h
+++ b/arch/mips/include/asm/sparsemem.h
@@ -6,7 +6,7 @@
6 * SECTION_SIZE_BITS 2^N: how big each section will be 6 * SECTION_SIZE_BITS 2^N: how big each section will be
7 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space 7 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
8 */ 8 */
9#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_PAGE_SIZE_64KB) 9#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT) && defined(CONFIG_PAGE_SIZE_64KB)
10# define SECTION_SIZE_BITS 29 10# define SECTION_SIZE_BITS 29
11#else 11#else
12# define SECTION_SIZE_BITS 28 12# define SECTION_SIZE_BITS 28
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 8debe9e91754..18806a52061c 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -112,12 +112,6 @@ register struct thread_info *__current_thread_info __asm__("$28");
112#define TIF_LOAD_WATCH 25 /* If set, load watch registers */ 112#define TIF_LOAD_WATCH 25 /* If set, load watch registers */
113#define TIF_SYSCALL_TRACE 31 /* syscall trace active */ 113#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
114 114
115#ifdef CONFIG_MIPS32_O32
116#define TIF_32BIT TIF_32BIT_REGS
117#elif defined(CONFIG_MIPS32_N32)
118#define TIF_32BIT _TIF_32BIT_ADDR
119#endif /* CONFIG_MIPS32_O32 */
120
121#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 115#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
122#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 116#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
123#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 117#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
index bc14447e69b5..761f2e92119e 100644
--- a/arch/mips/include/asm/time.h
+++ b/arch/mips/include/asm/time.h
@@ -50,10 +50,8 @@ extern int (*perf_irq)(void);
50/* 50/*
51 * Initialize the calling CPU's compare interrupt as clockevent device 51 * Initialize the calling CPU's compare interrupt as clockevent device
52 */ 52 */
53#ifdef CONFIG_CEVT_R4K_LIB
54extern unsigned int __weak get_c0_compare_int(void); 53extern unsigned int __weak get_c0_compare_int(void);
55extern int r4k_clockevent_init(void); 54extern int r4k_clockevent_init(void);
56#endif
57 55
58static inline int mips_clockevent_init(void) 56static inline int mips_clockevent_init(void)
59{ 57{
@@ -71,7 +69,7 @@ static inline int mips_clockevent_init(void)
71/* 69/*
72 * Initialize the count register as a clocksource 70 * Initialize the count register as a clocksource
73 */ 71 */
74#ifdef CONFIG_CSRC_R4K_LIB 72#ifdef CONFIG_CSRC_R4K
75extern int init_r4k_clocksource(void); 73extern int init_r4k_clocksource(void);
76#endif 74#endif
77 75
diff --git a/arch/mips/include/asm/titan_dep.h b/arch/mips/include/asm/titan_dep.h
deleted file mode 100644
index fee1908c65d2..000000000000
--- a/arch/mips/include/asm/titan_dep.h
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * Board specific definititions for the PMC-Sierra Yosemite
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __TITAN_DEP_H__
14#define __TITAN_DEP_H__
15
16#include <asm/addrspace.h> /* for KSEG1ADDR() */
17#include <asm/byteorder.h> /* for cpu_to_le32() */
18
19#define TITAN_READ(ofs) \
20 (*(volatile u32 *)(ocd_base+(ofs)))
21#define TITAN_READ_16(ofs) \
22 (*(volatile u16 *)(ocd_base+(ofs)))
23#define TITAN_READ_8(ofs) \
24 (*(volatile u8 *)(ocd_base+(ofs)))
25
26#define TITAN_WRITE(ofs, data) \
27 do { *(volatile u32 *)(ocd_base+(ofs)) = (data); } while (0)
28#define TITAN_WRITE_16(ofs, data) \
29 do { *(volatile u16 *)(ocd_base+(ofs)) = (data); } while (0)
30#define TITAN_WRITE_8(ofs, data) \
31 do { *(volatile u8 *)(ocd_base+(ofs)) = (data); } while (0)
32
33/*
34 * PCI specific defines
35 */
36#define TITAN_PCI_0_CONFIG_ADDRESS 0x780
37#define TITAN_PCI_0_CONFIG_DATA 0x784
38
39/*
40 * HT specific defines
41 */
42#define RM9000x2_HTLINK_REG 0xbb000644
43#define RM9000x2_BASE_ADDR 0xbb000000
44
45#define OCD_BASE 0xfb000000UL
46#define OCD_SIZE 0x3000UL
47
48extern unsigned long ocd_base;
49
50/*
51 * OCD Registers
52 */
53#define RM9000x2_OCD_LKB5 0x0128 /* Ethernet */
54#define RM9000x2_OCD_LKM5 0x012c
55
56#define RM9000x2_OCD_LKB7 0x0138 /* HT Region 0 */
57#define RM9000x2_OCD_LKM7 0x013c
58#define RM9000x2_OCD_LKB8 0x0140 /* HT Region 1 */
59#define RM9000x2_OCD_LKM8 0x0144
60
61#define RM9000x2_OCD_LKB9 0x0148 /* Local Bus */
62#define RM9000x2_OCD_LKM9 0x014c
63#define RM9000x2_OCD_LKB10 0x0150
64#define RM9000x2_OCD_LKM10 0x0154
65#define RM9000x2_OCD_LKB11 0x0158
66#define RM9000x2_OCD_LKM11 0x015c
67#define RM9000x2_OCD_LKB12 0x0160
68#define RM9000x2_OCD_LKM12 0x0164
69
70#define RM9000x2_OCD_LKB13 0x0168 /* Scratch RAM */
71#define RM9000x2_OCD_LKM13 0x016c
72
73#define RM9000x2_OCD_LPD0 0x0200 /* Local Bus */
74#define RM9000x2_OCD_LPD1 0x0210
75#define RM9000x2_OCD_LPD2 0x0220
76#define RM9000x2_OCD_LPD3 0x0230
77
78#define RM9000x2_OCD_HTDVID 0x0600 /* HT Device Header */
79#define RM9000x2_OCD_HTSC 0x0604
80#define RM9000x2_OCD_HTCCR 0x0608
81#define RM9000x2_OCD_HTBHL 0x060c
82#define RM9000x2_OCD_HTBAR0 0x0610
83#define RM9000x2_OCD_HTBAR1 0x0614
84#define RM9000x2_OCD_HTBAR2 0x0618
85#define RM9000x2_OCD_HTBAR3 0x061c
86#define RM9000x2_OCD_HTBAR4 0x0620
87#define RM9000x2_OCD_HTBAR5 0x0624
88#define RM9000x2_OCD_HTCBCPT 0x0628
89#define RM9000x2_OCD_HTSDVID 0x062c
90#define RM9000x2_OCD_HTXRA 0x0630
91#define RM9000x2_OCD_HTCAP1 0x0634
92#define RM9000x2_OCD_HTIL 0x063c
93
94#define RM9000x2_OCD_HTLCC 0x0640 /* HT Capability Block */
95#define RM9000x2_OCD_HTLINK 0x0644
96#define RM9000x2_OCD_HTFQREV 0x0648
97
98#define RM9000x2_OCD_HTERCTL 0x0668 /* HT Controller */
99#define RM9000x2_OCD_HTRXDB 0x066c
100#define RM9000x2_OCD_HTIMPED 0x0670
101#define RM9000x2_OCD_HTSWIMP 0x0674
102#define RM9000x2_OCD_HTCAL 0x0678
103
104#define RM9000x2_OCD_HTBAA30 0x0680
105#define RM9000x2_OCD_HTBAA54 0x0684
106#define RM9000x2_OCD_HTMASK0 0x0688
107#define RM9000x2_OCD_HTMASK1 0x068c
108#define RM9000x2_OCD_HTMASK2 0x0690
109#define RM9000x2_OCD_HTMASK3 0x0694
110#define RM9000x2_OCD_HTMASK4 0x0698
111#define RM9000x2_OCD_HTMASK5 0x069c
112
113#define RM9000x2_OCD_HTIFCTL 0x06a0
114#define RM9000x2_OCD_HTPLL 0x06a4
115
116#define RM9000x2_OCD_HTSRI 0x06b0
117#define RM9000x2_OCD_HTRXNUM 0x06b4
118#define RM9000x2_OCD_HTTXNUM 0x06b8
119
120#define RM9000x2_OCD_HTTXCNT 0x06c8
121
122#define RM9000x2_OCD_HTERROR 0x06d8
123#define RM9000x2_OCD_HTRCRCE 0x06dc
124#define RM9000x2_OCD_HTEOI 0x06e0
125
126#define RM9000x2_OCD_CRCR 0x06f0
127
128#define RM9000x2_OCD_HTCFGA 0x06f8
129#define RM9000x2_OCD_HTCFGD 0x06fc
130
131#define RM9000x2_OCD_INTMSG 0x0a00
132
133#define RM9000x2_OCD_INTPIN0 0x0a40
134#define RM9000x2_OCD_INTPIN1 0x0a44
135#define RM9000x2_OCD_INTPIN2 0x0a48
136#define RM9000x2_OCD_INTPIN3 0x0a4c
137#define RM9000x2_OCD_INTPIN4 0x0a50
138#define RM9000x2_OCD_INTPIN5 0x0a54
139#define RM9000x2_OCD_INTPIN6 0x0a58
140#define RM9000x2_OCD_INTPIN7 0x0a5c
141#define RM9000x2_OCD_SEM 0x0a60
142#define RM9000x2_OCD_SEMSET 0x0a64
143#define RM9000x2_OCD_SEMCLR 0x0a68
144
145#define RM9000x2_OCD_TKT 0x0a70
146#define RM9000x2_OCD_TKTINC 0x0a74
147
148#define RM9000x2_OCD_NMICONFIG 0x0ac0 /* Interrupts */
149#define RM9000x2_OCD_INTP0PRI 0x1a80
150#define RM9000x2_OCD_INTP1PRI 0x1a80
151#define RM9000x2_OCD_INTP0STATUS0 0x1b00
152#define RM9000x2_OCD_INTP0MASK0 0x1b04
153#define RM9000x2_OCD_INTP0SET0 0x1b08
154#define RM9000x2_OCD_INTP0CLEAR0 0x1b0c
155#define RM9000x2_OCD_INTP0STATUS1 0x1b10
156#define RM9000x2_OCD_INTP0MASK1 0x1b14
157#define RM9000x2_OCD_INTP0SET1 0x1b18
158#define RM9000x2_OCD_INTP0CLEAR1 0x1b1c
159#define RM9000x2_OCD_INTP0STATUS2 0x1b20
160#define RM9000x2_OCD_INTP0MASK2 0x1b24
161#define RM9000x2_OCD_INTP0SET2 0x1b28
162#define RM9000x2_OCD_INTP0CLEAR2 0x1b2c
163#define RM9000x2_OCD_INTP0STATUS3 0x1b30
164#define RM9000x2_OCD_INTP0MASK3 0x1b34
165#define RM9000x2_OCD_INTP0SET3 0x1b38
166#define RM9000x2_OCD_INTP0CLEAR3 0x1b3c
167#define RM9000x2_OCD_INTP0STATUS4 0x1b40
168#define RM9000x2_OCD_INTP0MASK4 0x1b44
169#define RM9000x2_OCD_INTP0SET4 0x1b48
170#define RM9000x2_OCD_INTP0CLEAR4 0x1b4c
171#define RM9000x2_OCD_INTP0STATUS5 0x1b50
172#define RM9000x2_OCD_INTP0MASK5 0x1b54
173#define RM9000x2_OCD_INTP0SET5 0x1b58
174#define RM9000x2_OCD_INTP0CLEAR5 0x1b5c
175#define RM9000x2_OCD_INTP0STATUS6 0x1b60
176#define RM9000x2_OCD_INTP0MASK6 0x1b64
177#define RM9000x2_OCD_INTP0SET6 0x1b68
178#define RM9000x2_OCD_INTP0CLEAR6 0x1b6c
179#define RM9000x2_OCD_INTP0STATUS7 0x1b70
180#define RM9000x2_OCD_INTP0MASK7 0x1b74
181#define RM9000x2_OCD_INTP0SET7 0x1b78
182#define RM9000x2_OCD_INTP0CLEAR7 0x1b7c
183#define RM9000x2_OCD_INTP1STATUS0 0x2b00
184#define RM9000x2_OCD_INTP1MASK0 0x2b04
185#define RM9000x2_OCD_INTP1SET0 0x2b08
186#define RM9000x2_OCD_INTP1CLEAR0 0x2b0c
187#define RM9000x2_OCD_INTP1STATUS1 0x2b10
188#define RM9000x2_OCD_INTP1MASK1 0x2b14
189#define RM9000x2_OCD_INTP1SET1 0x2b18
190#define RM9000x2_OCD_INTP1CLEAR1 0x2b1c
191#define RM9000x2_OCD_INTP1STATUS2 0x2b20
192#define RM9000x2_OCD_INTP1MASK2 0x2b24
193#define RM9000x2_OCD_INTP1SET2 0x2b28
194#define RM9000x2_OCD_INTP1CLEAR2 0x2b2c
195#define RM9000x2_OCD_INTP1STATUS3 0x2b30
196#define RM9000x2_OCD_INTP1MASK3 0x2b34
197#define RM9000x2_OCD_INTP1SET3 0x2b38
198#define RM9000x2_OCD_INTP1CLEAR3 0x2b3c
199#define RM9000x2_OCD_INTP1STATUS4 0x2b40
200#define RM9000x2_OCD_INTP1MASK4 0x2b44
201#define RM9000x2_OCD_INTP1SET4 0x2b48
202#define RM9000x2_OCD_INTP1CLEAR4 0x2b4c
203#define RM9000x2_OCD_INTP1STATUS5 0x2b50
204#define RM9000x2_OCD_INTP1MASK5 0x2b54
205#define RM9000x2_OCD_INTP1SET5 0x2b58
206#define RM9000x2_OCD_INTP1CLEAR5 0x2b5c
207#define RM9000x2_OCD_INTP1STATUS6 0x2b60
208#define RM9000x2_OCD_INTP1MASK6 0x2b64
209#define RM9000x2_OCD_INTP1SET6 0x2b68
210#define RM9000x2_OCD_INTP1CLEAR6 0x2b6c
211#define RM9000x2_OCD_INTP1STATUS7 0x2b70
212#define RM9000x2_OCD_INTP1MASK7 0x2b74
213#define RM9000x2_OCD_INTP1SET7 0x2b78
214#define RM9000x2_OCD_INTP1CLEAR7 0x2b7c
215
216#define OCD_READ(reg) (*(volatile unsigned int *)(ocd_base + (reg)))
217#define OCD_WRITE(reg, val) \
218 do { *(volatile unsigned int *)(ocd_base + (reg)) = (val); } while (0)
219
220/*
221 * Hypertransport specific macros
222 */
223#define RM9K_WRITE(ofs, data) *(volatile u_int32_t *)(RM9000x2_BASE_ADDR+ofs) = data
224#define RM9K_WRITE_8(ofs, data) *(volatile u8 *)(RM9000x2_BASE_ADDR+ofs) = data
225#define RM9K_WRITE_16(ofs, data) *(volatile u16 *)(RM9000x2_BASE_ADDR+ofs) = data
226
227#define RM9K_READ(ofs, val) *(val) = *(volatile u_int32_t *)(RM9000x2_BASE_ADDR+ofs)
228#define RM9K_READ_8(ofs, val) *(val) = *(volatile u8 *)(RM9000x2_BASE_ADDR+ofs)
229#define RM9K_READ_16(ofs, val) *(val) = *(volatile u16 *)(RM9000x2_BASE_ADDR+ofs)
230
231#endif
diff --git a/arch/mips/include/asm/war.h b/arch/mips/include/asm/war.h
index fa133c1bc1f9..65e344532ded 100644
--- a/arch/mips/include/asm/war.h
+++ b/arch/mips/include/asm/war.h
@@ -209,14 +209,6 @@
209#endif 209#endif
210 210
211/* 211/*
212 * On the RM9000 there is a problem which makes the CreateDirtyExclusive
213 * eache operation unusable on SMP systems.
214 */
215#ifndef RM9000_CDEX_SMP_WAR
216#error Check setting of RM9000_CDEX_SMP_WAR for your platform
217#endif
218
219/*
220 * The RM7000 processors and the E9000 cores have a bug (though PMC-Sierra 212 * The RM7000 processors and the E9000 cores have a bug (though PMC-Sierra
221 * opposes it being called that) where invalid instructions in the same 213 * opposes it being called that) where invalid instructions in the same
222 * I-cache line worth of instructions being fetched may case spurious 214 * I-cache line worth of instructions being fetched may case spurious
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 8b28bc4e14ea..007c33d73715 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -16,7 +16,7 @@ CFLAGS_REMOVE_perf_event_mipsxx.o = -pg
16endif 16endif
17 17
18obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o 18obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o
19obj-$(CONFIG_CEVT_R4K_LIB) += cevt-r4k.o 19obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o
20obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o 20obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o
21obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o 21obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o
22obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o 22obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
@@ -25,7 +25,7 @@ obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
25obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o 25obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
26obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o 26obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o
27obj-$(CONFIG_CSRC_POWERTV) += csrc-powertv.o 27obj-$(CONFIG_CSRC_POWERTV) += csrc-powertv.o
28obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o 28obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o
29obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o 29obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
30obj-$(CONFIG_SYNC_R4K) += sync-r4k.o 30obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
31 31
@@ -58,7 +58,6 @@ obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o
58obj-$(CONFIG_I8259) += i8259.o 58obj-$(CONFIG_I8259) += i8259.o
59obj-$(CONFIG_IRQ_CPU) += irq_cpu.o 59obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
60obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o 60obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o
61obj-$(CONFIG_IRQ_CPU_RM9K) += irq-rm9000.o
62obj-$(CONFIG_MIPS_MSC) += irq-msc01.o 61obj-$(CONFIG_MIPS_MSC) += irq-msc01.o
63obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o 62obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o
64obj-$(CONFIG_IRQ_GT641XX) += irq-gt641xx.o 63obj-$(CONFIG_IRQ_GT641XX) += irq-gt641xx.o
@@ -80,7 +79,8 @@ obj-$(CONFIG_I8253) += i8253.o
80 79
81obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o 80obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o
82 81
83obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 82obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
83obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
84obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 84obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
85obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o 85obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o
86obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o 86obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 0c4bce4882a6..9690998d4ef3 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -125,10 +125,6 @@ void output_thread_defines(void)
125 thread.cp0_baduaddr); 125 thread.cp0_baduaddr);
126 OFFSET(THREAD_ECODE, task_struct, \ 126 OFFSET(THREAD_ECODE, task_struct, \
127 thread.error_code); 127 thread.error_code);
128 OFFSET(THREAD_TRAMP, task_struct, \
129 thread.irix_trampoline);
130 OFFSET(THREAD_OLDCTX, task_struct, \
131 thread.irix_oldctx);
132 BLANK(); 128 BLANK();
133} 129}
134 130
diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c
new file mode 100644
index 000000000000..0f53c39324bb
--- /dev/null
+++ b/arch/mips/kernel/crash.c
@@ -0,0 +1,71 @@
1#include <linux/kernel.h>
2#include <linux/smp.h>
3#include <linux/reboot.h>
4#include <linux/kexec.h>
5#include <linux/bootmem.h>
6#include <linux/crash_dump.h>
7#include <linux/delay.h>
8#include <linux/init.h>
9#include <linux/irq.h>
10#include <linux/types.h>
11#include <linux/sched.h>
12
13/* This keeps a track of which one is crashing cpu. */
14static int crashing_cpu = -1;
15static cpumask_t cpus_in_crash = CPU_MASK_NONE;
16
17#ifdef CONFIG_SMP
18static void crash_shutdown_secondary(void *ignore)
19{
20 struct pt_regs *regs;
21 int cpu = smp_processor_id();
22
23 regs = task_pt_regs(current);
24
25 if (!cpu_online(cpu))
26 return;
27
28 local_irq_disable();
29 if (!cpu_isset(cpu, cpus_in_crash))
30 crash_save_cpu(regs, cpu);
31 cpu_set(cpu, cpus_in_crash);
32
33 while (!atomic_read(&kexec_ready_to_reboot))
34 cpu_relax();
35 relocated_kexec_smp_wait(NULL);
36 /* NOTREACHED */
37}
38
39static void crash_kexec_prepare_cpus(void)
40{
41 unsigned int msecs;
42
43 unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
44
45 dump_send_ipi(crash_shutdown_secondary);
46 smp_wmb();
47
48 /*
49 * The crash CPU sends an IPI and wait for other CPUs to
50 * respond. Delay of at least 10 seconds.
51 */
52 pr_emerg("Sending IPI to other cpus...\n");
53 msecs = 10000;
54 while ((cpus_weight(cpus_in_crash) < ncpus) && (--msecs > 0)) {
55 cpu_relax();
56 mdelay(1);
57 }
58}
59
60#else /* !defined(CONFIG_SMP) */
61static void crash_kexec_prepare_cpus(void) {}
62#endif /* !defined(CONFIG_SMP) */
63
64void default_machine_crash_shutdown(struct pt_regs *regs)
65{
66 local_irq_disable();
67 crashing_cpu = smp_processor_id();
68 crash_save_cpu(regs, crashing_cpu);
69 crash_kexec_prepare_cpus();
70 cpu_set(crashing_cpu, cpus_in_crash);
71}
diff --git a/arch/mips/kernel/crash_dump.c b/arch/mips/kernel/crash_dump.c
new file mode 100644
index 000000000000..35bed0d2342c
--- /dev/null
+++ b/arch/mips/kernel/crash_dump.c
@@ -0,0 +1,75 @@
1#include <linux/highmem.h>
2#include <linux/bootmem.h>
3#include <linux/crash_dump.h>
4#include <asm/uaccess.h>
5
6static int __init parse_savemaxmem(char *p)
7{
8 if (p)
9 saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
10
11 return 1;
12}
13__setup("savemaxmem=", parse_savemaxmem);
14
15
16static void *kdump_buf_page;
17
18/**
19 * copy_oldmem_page - copy one page from "oldmem"
20 * @pfn: page frame number to be copied
21 * @buf: target memory address for the copy; this can be in kernel address
22 * space or user address space (see @userbuf)
23 * @csize: number of bytes to copy
24 * @offset: offset in bytes into the page (based on pfn) to begin the copy
25 * @userbuf: if set, @buf is in user address space, use copy_to_user(),
26 * otherwise @buf is in kernel address space, use memcpy().
27 *
28 * Copy a page from "oldmem". For this page, there is no pte mapped
29 * in the current kernel.
30 *
31 * Calling copy_to_user() in atomic context is not desirable. Hence first
32 * copying the data to a pre-allocated kernel page and then copying to user
33 * space in non-atomic context.
34 */
35ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
36 size_t csize, unsigned long offset, int userbuf)
37{
38 void *vaddr;
39
40 if (!csize)
41 return 0;
42
43 vaddr = kmap_atomic_pfn(pfn);
44
45 if (!userbuf) {
46 memcpy(buf, (vaddr + offset), csize);
47 kunmap_atomic(vaddr);
48 } else {
49 if (!kdump_buf_page) {
50 pr_warning("Kdump: Kdump buffer page not allocated\n");
51
52 return -EFAULT;
53 }
54 copy_page(kdump_buf_page, vaddr);
55 kunmap_atomic(vaddr);
56 if (copy_to_user(buf, (kdump_buf_page + offset), csize))
57 return -EFAULT;
58 }
59
60 return csize;
61}
62
63static int __init kdump_buf_page_init(void)
64{
65 int ret = 0;
66
67 kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
68 if (!kdump_buf_page) {
69 pr_warning("Kdump: Failed to allocate kdump buffer page\n");
70 ret = -ENOMEM;
71 }
72
73 return ret;
74}
75arch_initcall(kdump_buf_page_init);
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
deleted file mode 100644
index 1282b9ae81c4..000000000000
--- a/arch/mips/kernel/irq-rm9000.c
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * Copyright (C) 2003 Ralf Baechle
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * Handler for RM9000 extended interrupts. These are a non-standard
10 * feature so we handle them separately from standard interrupts.
11 */
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/irq.h>
15#include <linux/kernel.h>
16#include <linux/module.h>
17
18#include <asm/irq_cpu.h>
19#include <asm/mipsregs.h>
20
21static inline void unmask_rm9k_irq(struct irq_data *d)
22{
23 set_c0_intcontrol(0x1000 << (d->irq - RM9K_CPU_IRQ_BASE));
24}
25
26static inline void mask_rm9k_irq(struct irq_data *d)
27{
28 clear_c0_intcontrol(0x1000 << (d->irq - RM9K_CPU_IRQ_BASE));
29}
30
31static inline void rm9k_cpu_irq_enable(struct irq_data *d)
32{
33 unsigned long flags;
34
35 local_irq_save(flags);
36 unmask_rm9k_irq(d);
37 local_irq_restore(flags);
38}
39
40/*
41 * Performance counter interrupts are global on all processors.
42 */
43static void local_rm9k_perfcounter_irq_startup(void *args)
44{
45 rm9k_cpu_irq_enable(args);
46}
47
48static unsigned int rm9k_perfcounter_irq_startup(struct irq_data *d)
49{
50 on_each_cpu(local_rm9k_perfcounter_irq_startup, d, 1);
51
52 return 0;
53}
54
55static void local_rm9k_perfcounter_irq_shutdown(void *args)
56{
57 unsigned long flags;
58
59 local_irq_save(flags);
60 mask_rm9k_irq(args);
61 local_irq_restore(flags);
62}
63
64static void rm9k_perfcounter_irq_shutdown(struct irq_data *d)
65{
66 on_each_cpu(local_rm9k_perfcounter_irq_shutdown, d, 1);
67}
68
69static struct irq_chip rm9k_irq_controller = {
70 .name = "RM9000",
71 .irq_ack = mask_rm9k_irq,
72 .irq_mask = mask_rm9k_irq,
73 .irq_mask_ack = mask_rm9k_irq,
74 .irq_unmask = unmask_rm9k_irq,
75 .irq_eoi = unmask_rm9k_irq
76};
77
78static struct irq_chip rm9k_perfcounter_irq = {
79 .name = "RM9000",
80 .irq_startup = rm9k_perfcounter_irq_startup,
81 .irq_shutdown = rm9k_perfcounter_irq_shutdown,
82 .irq_ack = mask_rm9k_irq,
83 .irq_mask = mask_rm9k_irq,
84 .irq_mask_ack = mask_rm9k_irq,
85 .irq_unmask = unmask_rm9k_irq,
86};
87
88unsigned int rm9000_perfcount_irq;
89
90EXPORT_SYMBOL(rm9000_perfcount_irq);
91
92void __init rm9k_cpu_irq_init(void)
93{
94 int base = RM9K_CPU_IRQ_BASE;
95 int i;
96
97 clear_c0_intcontrol(0x0000f000); /* Mask all */
98
99 for (i = base; i < base + 4; i++)
100 irq_set_chip_and_handler(i, &rm9k_irq_controller,
101 handle_level_irq);
102
103 rm9000_perfcount_irq = base + 1;
104 irq_set_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq,
105 handle_percpu_irq);
106}
diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c
index 85beb9b0b2d0..992e18474da5 100644
--- a/arch/mips/kernel/machine_kexec.c
+++ b/arch/mips/kernel/machine_kexec.c
@@ -5,7 +5,7 @@
5 * This source code is licensed under the GNU General Public License, 5 * This source code is licensed under the GNU General Public License,
6 * Version 2. See the file COPYING for more details. 6 * Version 2. See the file COPYING for more details.
7 */ 7 */
8 8#include <linux/compiler.h>
9#include <linux/kexec.h> 9#include <linux/kexec.h>
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/delay.h> 11#include <linux/delay.h>
@@ -19,9 +19,19 @@ extern const size_t relocate_new_kernel_size;
19extern unsigned long kexec_start_address; 19extern unsigned long kexec_start_address;
20extern unsigned long kexec_indirection_page; 20extern unsigned long kexec_indirection_page;
21 21
22int (*_machine_kexec_prepare)(struct kimage *) = NULL;
23void (*_machine_kexec_shutdown)(void) = NULL;
24void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL;
25#ifdef CONFIG_SMP
26void (*relocated_kexec_smp_wait) (void *);
27atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
28#endif
29
22int 30int
23machine_kexec_prepare(struct kimage *kimage) 31machine_kexec_prepare(struct kimage *kimage)
24{ 32{
33 if (_machine_kexec_prepare)
34 return _machine_kexec_prepare(kimage);
25 return 0; 35 return 0;
26} 36}
27 37
@@ -33,14 +43,20 @@ machine_kexec_cleanup(struct kimage *kimage)
33void 43void
34machine_shutdown(void) 44machine_shutdown(void)
35{ 45{
46 if (_machine_kexec_shutdown)
47 _machine_kexec_shutdown();
36} 48}
37 49
38void 50void
39machine_crash_shutdown(struct pt_regs *regs) 51machine_crash_shutdown(struct pt_regs *regs)
40{ 52{
53 if (_machine_crash_shutdown)
54 _machine_crash_shutdown(regs);
55 else
56 default_machine_crash_shutdown(regs);
41} 57}
42 58
43typedef void (*noretfun_t)(void) __attribute__((noreturn)); 59typedef void (*noretfun_t)(void) __noreturn;
44 60
45void 61void
46machine_kexec(struct kimage *image) 62machine_kexec(struct kimage *image)
@@ -52,7 +68,9 @@ machine_kexec(struct kimage *image)
52 reboot_code_buffer = 68 reboot_code_buffer =
53 (unsigned long)page_address(image->control_code_page); 69 (unsigned long)page_address(image->control_code_page);
54 70
55 kexec_start_address = image->start; 71 kexec_start_address =
72 (unsigned long) phys_to_virt(image->start);
73
56 kexec_indirection_page = 74 kexec_indirection_page =
57 (unsigned long) phys_to_virt(image->head & PAGE_MASK); 75 (unsigned long) phys_to_virt(image->head & PAGE_MASK);
58 76
@@ -63,7 +81,7 @@ machine_kexec(struct kimage *image)
63 * The generic kexec code builds a page list with physical 81 * The generic kexec code builds a page list with physical
64 * addresses. they are directly accessible through KSEG0 (or 82 * addresses. they are directly accessible through KSEG0 (or
65 * CKSEG0 or XPHYS if on 64bit system), hence the 83 * CKSEG0 or XPHYS if on 64bit system), hence the
66 * pys_to_virt() call. 84 * phys_to_virt() call.
67 */ 85 */
68 for (ptr = &image->head; (entry = *ptr) && !(entry &IND_DONE); 86 for (ptr = &image->head; (entry = *ptr) && !(entry &IND_DONE);
69 ptr = (entry & IND_INDIRECTION) ? 87 ptr = (entry & IND_INDIRECTION) ?
@@ -81,5 +99,12 @@ machine_kexec(struct kimage *image)
81 printk("Will call new kernel at %08lx\n", image->start); 99 printk("Will call new kernel at %08lx\n", image->start);
82 printk("Bye ...\n"); 100 printk("Bye ...\n");
83 __flush_cache_all(); 101 __flush_cache_all();
102#ifdef CONFIG_SMP
103 /* All secondary cpus now may jump to kexec_wait cycle */
104 relocated_kexec_smp_wait = reboot_code_buffer +
105 (void *)(kexec_smp_wait - relocate_new_kernel);
106 smp_wmb();
107 atomic_set(&kexec_ready_to_reboot, 1);
108#endif
84 ((noretfun_t) reboot_code_buffer)(); 109 ((noretfun_t) reboot_code_buffer)();
85} 110}
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index 33f63bab478a..fd814e08c945 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -50,8 +50,8 @@ static bool check_same_owner(struct task_struct *p)
50 50
51 rcu_read_lock(); 51 rcu_read_lock();
52 pcred = __task_cred(p); 52 pcred = __task_cred(p);
53 match = (cred->euid == pcred->euid || 53 match = (uid_eq(cred->euid, pcred->euid) ||
54 cred->euid == pcred->uid); 54 uid_eq(cred->euid, pcred->uid));
55 rcu_read_unlock(); 55 rcu_read_unlock();
56 return match; 56 return match;
57} 57}
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 3fc1691110dc..1ba8933683aa 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -11,7 +11,7 @@
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/export.h> 12#include <linux/export.h>
13#include <asm/checksum.h> 13#include <asm/checksum.h>
14#include <asm/pgtable.h> 14#include <linux/mm.h>
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/ftrace.h> 16#include <asm/ftrace.h>
17 17
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index e9a5fd7277f4..69b17a920049 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -72,9 +72,7 @@ void __noreturn cpu_idle(void)
72 } 72 }
73 } 73 }
74#ifdef CONFIG_HOTPLUG_CPU 74#ifdef CONFIG_HOTPLUG_CPU
75 if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map) && 75 if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map))
76 (system_state == SYSTEM_RUNNING ||
77 system_state == SYSTEM_BOOTING))
78 play_dead(); 76 play_dead();
79#endif 77#endif
80 rcu_idle_exit(); 78 rcu_idle_exit();
diff --git a/arch/mips/kernel/relocate_kernel.S b/arch/mips/kernel/relocate_kernel.S
index 87481f916a61..e4142c5f7c2b 100644
--- a/arch/mips/kernel/relocate_kernel.S
+++ b/arch/mips/kernel/relocate_kernel.S
@@ -15,6 +15,11 @@
15#include <asm/addrspace.h> 15#include <asm/addrspace.h>
16 16
17LEAF(relocate_new_kernel) 17LEAF(relocate_new_kernel)
18 PTR_L a0, arg0
19 PTR_L a1, arg1
20 PTR_L a2, arg2
21 PTR_L a3, arg3
22
18 PTR_L s0, kexec_indirection_page 23 PTR_L s0, kexec_indirection_page
19 PTR_L s1, kexec_start_address 24 PTR_L s1, kexec_start_address
20 25
@@ -26,7 +31,6 @@ process_entry:
26 and s3, s2, 0x1 31 and s3, s2, 0x1
27 beq s3, zero, 1f 32 beq s3, zero, 1f
28 and s4, s2, ~0x1 /* store destination addr in s4 */ 33 and s4, s2, ~0x1 /* store destination addr in s4 */
29 move a0, s4
30 b process_entry 34 b process_entry
31 35
321: 361:
@@ -60,10 +64,111 @@ copy_word:
60 b process_entry 64 b process_entry
61 65
62done: 66done:
67#ifdef CONFIG_SMP
68 /* kexec_flag reset is signal to other CPUs what kernel
69 was moved to it's location. Note - we need relocated address
70 of kexec_flag. */
71
72 bal 1f
73 1: move t1,ra;
74 PTR_LA t2,1b
75 PTR_LA t0,kexec_flag
76 PTR_SUB t0,t0,t2;
77 PTR_ADD t0,t1,t0;
78 LONG_S zero,(t0)
79#endif
80
81#ifdef CONFIG_CPU_CAVIUM_OCTEON
82 /* We need to flush I-cache before jumping to new kernel.
83 * Unfortunatelly, this code is cpu-specific.
84 */
85 .set push
86 .set noreorder
87 syncw
88 syncw
89 synci 0($0)
90 .set pop
91#else
92 sync
93#endif
63 /* jump to kexec_start_address */ 94 /* jump to kexec_start_address */
64 j s1 95 j s1
65 END(relocate_new_kernel) 96 END(relocate_new_kernel)
66 97
98#ifdef CONFIG_SMP
99/*
100 * Other CPUs should wait until code is relocated and
101 * then start at entry (?) point.
102 */
103LEAF(kexec_smp_wait)
104 PTR_L a0, s_arg0
105 PTR_L a1, s_arg1
106 PTR_L a2, s_arg2
107 PTR_L a3, s_arg3
108 PTR_L s1, kexec_start_address
109
110 /* Non-relocated address works for args and kexec_start_address ( old
111 * kernel is not overwritten). But we need relocated address of
112 * kexec_flag.
113 */
114
115 bal 1f
1161: move t1,ra;
117 PTR_LA t2,1b
118 PTR_LA t0,kexec_flag
119 PTR_SUB t0,t0,t2;
120 PTR_ADD t0,t1,t0;
121
1221: LONG_L s0, (t0)
123 bne s0, zero,1b
124
125#ifdef CONFIG_CPU_CAVIUM_OCTEON
126 .set push
127 .set noreorder
128 synci 0($0)
129 .set pop
130#else
131 sync
132#endif
133 j s1
134 END(kexec_smp_wait)
135#endif
136
137#ifdef __mips64
138 /* all PTR's must be aligned to 8 byte in 64-bit mode */
139 .align 3
140#endif
141
142/* All parameters to new kernel are passed in registers a0-a3.
143 * kexec_args[0..3] are uses to prepare register values.
144 */
145
146kexec_args:
147 EXPORT(kexec_args)
148arg0: PTR 0x0
149arg1: PTR 0x0
150arg2: PTR 0x0
151arg3: PTR 0x0
152 .size kexec_args,PTRSIZE*4
153
154#ifdef CONFIG_SMP
155/*
156 * Secondary CPUs may have different kernel parameters in
157 * their registers a0-a3. secondary_kexec_args[0..3] are used
158 * to prepare register values.
159 */
160secondary_kexec_args:
161 EXPORT(secondary_kexec_args)
162s_arg0: PTR 0x0
163s_arg1: PTR 0x0
164s_arg2: PTR 0x0
165s_arg3: PTR 0x0
166 .size secondary_kexec_args,PTRSIZE*4
167kexec_flag:
168 LONG 0x1
169
170#endif
171
67kexec_start_address: 172kexec_start_address:
68 EXPORT(kexec_start_address) 173 EXPORT(kexec_start_address)
69 PTR 0x0 174 PTR 0x0
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index f6ba8381ee01..9c721dd84ba1 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -17,12 +17,6 @@
17#include <asm/thread_info.h> 17#include <asm/thread_info.h>
18#include <asm/unistd.h> 18#include <asm/unistd.h>
19 19
20/* This duplicates the definition from <linux/sched.h> */
21#define PT_TRACESYS 0x00000002 /* tracing system calls */
22
23/* This duplicates the definition from <asm/signal.h> */
24#define SIGILL 4 /* Illegal instruction (ANSI). */
25
26#ifndef CONFIG_MIPS32_O32 20#ifndef CONFIG_MIPS32_O32
27/* No O32, so define handle_sys here */ 21/* No O32, so define handle_sys here */
28#define handle_sysn32 handle_sys 22#define handle_sysn32 handle_sys
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a53f8ec37aac..8c41187801ce 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -22,6 +22,7 @@
22#include <linux/console.h> 22#include <linux/console.h>
23#include <linux/pfn.h> 23#include <linux/pfn.h>
24#include <linux/debugfs.h> 24#include <linux/debugfs.h>
25#include <linux/kexec.h>
25 26
26#include <asm/addrspace.h> 27#include <asm/addrspace.h>
27#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
@@ -79,7 +80,7 @@ static struct resource data_resource = { .name = "Kernel data", };
79void __init add_memory_region(phys_t start, phys_t size, long type) 80void __init add_memory_region(phys_t start, phys_t size, long type)
80{ 81{
81 int x = boot_mem_map.nr_map; 82 int x = boot_mem_map.nr_map;
82 struct boot_mem_map_entry *prev = boot_mem_map.map + x - 1; 83 int i;
83 84
84 /* Sanity check */ 85 /* Sanity check */
85 if (start + size < start) { 86 if (start + size < start) {
@@ -88,15 +89,29 @@ void __init add_memory_region(phys_t start, phys_t size, long type)
88 } 89 }
89 90
90 /* 91 /*
91 * Try to merge with previous entry if any. This is far less than 92 * Try to merge with existing entry, if any.
92 * perfect but is sufficient for most real world cases.
93 */ 93 */
94 if (x && prev->addr + prev->size == start && prev->type == type) { 94 for (i = 0; i < boot_mem_map.nr_map; i++) {
95 prev->size += size; 95 struct boot_mem_map_entry *entry = boot_mem_map.map + i;
96 unsigned long top;
97
98 if (entry->type != type)
99 continue;
100
101 if (start + size < entry->addr)
102 continue; /* no overlap */
103
104 if (entry->addr + entry->size < start)
105 continue; /* no overlap */
106
107 top = max(entry->addr + entry->size, start + size);
108 entry->addr = min(entry->addr, start);
109 entry->size = top - entry->addr;
110
96 return; 111 return;
97 } 112 }
98 113
99 if (x == BOOT_MEM_MAP_MAX) { 114 if (boot_mem_map.nr_map == BOOT_MEM_MAP_MAX) {
100 pr_err("Ooops! Too many entries in the memory map!\n"); 115 pr_err("Ooops! Too many entries in the memory map!\n");
101 return; 116 return;
102 } 117 }
@@ -522,12 +537,64 @@ static void __init arch_mem_init(char **cmdline_p)
522 } 537 }
523 538
524 bootmem_init(); 539 bootmem_init();
540#ifdef CONFIG_KEXEC
541 if (crashk_res.start != crashk_res.end)
542 reserve_bootmem(crashk_res.start,
543 crashk_res.end - crashk_res.start + 1,
544 BOOTMEM_DEFAULT);
545#endif
525 device_tree_init(); 546 device_tree_init();
526 sparse_init(); 547 sparse_init();
527 plat_swiotlb_setup(); 548 plat_swiotlb_setup();
528 paging_init(); 549 paging_init();
529} 550}
530 551
552#ifdef CONFIG_KEXEC
553static inline unsigned long long get_total_mem(void)
554{
555 unsigned long long total;
556
557 total = max_pfn - min_low_pfn;
558 return total << PAGE_SHIFT;
559}
560
561static void __init mips_parse_crashkernel(void)
562{
563 unsigned long long total_mem;
564 unsigned long long crash_size, crash_base;
565 int ret;
566
567 total_mem = get_total_mem();
568 ret = parse_crashkernel(boot_command_line, total_mem,
569 &crash_size, &crash_base);
570 if (ret != 0 || crash_size <= 0)
571 return;
572
573 crashk_res.start = crash_base;
574 crashk_res.end = crash_base + crash_size - 1;
575}
576
577static void __init request_crashkernel(struct resource *res)
578{
579 int ret;
580
581 ret = request_resource(res, &crashk_res);
582 if (!ret)
583 pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n",
584 (unsigned long)((crashk_res.end -
585 crashk_res.start + 1) >> 20),
586 (unsigned long)(crashk_res.start >> 20));
587}
588#else /* !defined(CONFIG_KEXEC) */
589static void __init mips_parse_crashkernel(void)
590{
591}
592
593static void __init request_crashkernel(struct resource *res)
594{
595}
596#endif /* !defined(CONFIG_KEXEC) */
597
531static void __init resource_init(void) 598static void __init resource_init(void)
532{ 599{
533 int i; 600 int i;
@@ -543,6 +610,8 @@ static void __init resource_init(void)
543 /* 610 /*
544 * Request address space for all standard RAM. 611 * Request address space for all standard RAM.
545 */ 612 */
613 mips_parse_crashkernel();
614
546 for (i = 0; i < boot_mem_map.nr_map; i++) { 615 for (i = 0; i < boot_mem_map.nr_map; i++) {
547 struct resource *res; 616 struct resource *res;
548 unsigned long start, end; 617 unsigned long start, end;
@@ -579,6 +648,7 @@ static void __init resource_init(void)
579 */ 648 */
580 request_resource(res, &code_resource); 649 request_resource(res, &code_resource);
581 request_resource(res, &data_resource); 650 request_resource(res, &data_resource);
651 request_crashkernel(res);
582 } 652 }
583} 653}
584 654
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 0e1a5b8ae817..b6aa77035019 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -568,17 +568,20 @@ static void do_signal(struct pt_regs *regs)
568 } 568 }
569 569
570 if (regs->regs[0]) { 570 if (regs->regs[0]) {
571 if (regs->regs[2] == ERESTARTNOHAND || 571 switch (regs->regs[2]) {
572 regs->regs[2] == ERESTARTSYS || 572 case ERESTARTNOHAND:
573 regs->regs[2] == ERESTARTNOINTR) { 573 case ERESTARTSYS:
574 case ERESTARTNOINTR:
574 regs->regs[2] = regs->regs[0]; 575 regs->regs[2] = regs->regs[0];
575 regs->regs[7] = regs->regs[26]; 576 regs->regs[7] = regs->regs[26];
576 regs->cp0_epc -= 4; 577 regs->cp0_epc -= 4;
577 } 578 break;
578 if (regs->regs[2] == ERESTART_RESTARTBLOCK) { 579
580 case ERESTART_RESTARTBLOCK:
579 regs->regs[2] = current->thread.abi->restart; 581 regs->regs[2] = current->thread.abi->restart;
580 regs->regs[7] = regs->regs[26]; 582 regs->regs[7] = regs->regs[26];
581 regs->cp0_epc -= 4; 583 regs->cp0_epc -= 4;
584 break;
582 } 585 }
583 regs->regs[0] = 0; /* Don't deal with this again. */ 586 regs->regs[0] = 0; /* Don't deal with this again. */
584 } 587 }
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 9005bf9fb859..2e6374a589ec 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -386,3 +386,20 @@ void flush_tlb_one(unsigned long vaddr)
386 386
387EXPORT_SYMBOL(flush_tlb_page); 387EXPORT_SYMBOL(flush_tlb_page);
388EXPORT_SYMBOL(flush_tlb_one); 388EXPORT_SYMBOL(flush_tlb_one);
389
390#if defined(CONFIG_KEXEC)
391void (*dump_ipi_function_ptr)(void *) = NULL;
392void dump_send_ipi(void (*dump_ipi_callback)(void *))
393{
394 int i;
395 int cpu = smp_processor_id();
396
397 dump_ipi_function_ptr = dump_ipi_callback;
398 smp_mb();
399 for_each_online_cpu(i)
400 if (i != cpu)
401 mp_ops->send_ipi_single(i, SMP_DUMP);
402
403}
404EXPORT_SYMBOL(dump_send_ipi);
405#endif
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 9be3df1fa8a4..cf7ac5483f53 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -13,6 +13,7 @@
13 */ 13 */
14#include <linux/bug.h> 14#include <linux/bug.h>
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <linux/kexec.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/module.h> 19#include <linux/module.h>
@@ -409,6 +410,9 @@ void __noreturn die(const char *str, struct pt_regs *regs)
409 panic("Fatal exception"); 410 panic("Fatal exception");
410 } 411 }
411 412
413 if (regs && kexec_should_crash(current))
414 crash_kexec(regs);
415
412 do_exit(sig); 416 do_exit(sig);
413} 417}
414 418
@@ -1021,6 +1025,24 @@ asmlinkage void do_cpu(struct pt_regs *regs)
1021 1025
1022 return; 1026 return;
1023 1027
1028 case 3:
1029 /*
1030 * Old (MIPS I and MIPS II) processors will set this code
1031 * for COP1X opcode instructions that replaced the original
1032 * COP3 space. We don't limit COP1 space instructions in
1033 * the emulator according to the CPU ISA, so we want to
1034 * treat COP1X instructions consistently regardless of which
1035 * code the CPU chose. Therefore we redirect this trap to
1036 * the FP emulator too.
1037 *
1038 * Then some newer FPU-less processors use this code
1039 * erroneously too, so they are covered by this choice
1040 * as well.
1041 */
1042 if (raw_cpu_has_fpu)
1043 break;
1044 /* Fall through. */
1045
1024 case 1: 1046 case 1:
1025 if (used_math()) /* Using the FPU again. */ 1047 if (used_math()) /* Using the FPU again. */
1026 own_fpu(1); 1048 own_fpu(1);
@@ -1044,9 +1066,6 @@ asmlinkage void do_cpu(struct pt_regs *regs)
1044 case 2: 1066 case 2:
1045 raw_notifier_call_chain(&cu2_chain, CU2_EXCEPTION, regs); 1067 raw_notifier_call_chain(&cu2_chain, CU2_EXCEPTION, regs);
1046 return; 1068 return;
1047
1048 case 3:
1049 break;
1050 } 1069 }
1051 1070
1052 force_sig(SIGILL, current); 1071 force_sig(SIGILL, current);
diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
index b5d76d1444c9..6453962ac898 100644
--- a/arch/mips/lantiq/xway/dma.c
+++ b/arch/mips/lantiq/xway/dma.c
@@ -49,7 +49,7 @@
49#define DMA_CLK_DIV4 BIT(6) /* polling clock divider */ 49#define DMA_CLK_DIV4 BIT(6) /* polling clock divider */
50#define DMA_2W_BURST BIT(1) /* 2 word burst length */ 50#define DMA_2W_BURST BIT(1) /* 2 word burst length */
51#define DMA_MAX_CHANNEL 20 /* the soc has 20 channels */ 51#define DMA_MAX_CHANNEL 20 /* the soc has 20 channels */
52#define DMA_ETOP_ENDIANESS (0xf << 8) /* endianess swap etop channels */ 52#define DMA_ETOP_ENDIANNESS (0xf << 8) /* endianness swap etop channels */
53#define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */ 53#define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */
54 54
55#define ltq_dma_r32(x) ltq_r32(ltq_dma_membase + (x)) 55#define ltq_dma_r32(x) ltq_r32(ltq_dma_membase + (x))
@@ -192,10 +192,10 @@ ltq_dma_init_port(int p)
192 switch (p) { 192 switch (p) {
193 case DMA_PORT_ETOP: 193 case DMA_PORT_ETOP:
194 /* 194 /*
195 * Tell the DMA engine to swap the endianess of data frames and 195 * Tell the DMA engine to swap the endianness of data frames and
196 * drop packets if the channel arbitration fails. 196 * drop packets if the channel arbitration fails.
197 */ 197 */
198 ltq_dma_w32_mask(0, DMA_ETOP_ENDIANESS | DMA_PDEN, 198 ltq_dma_w32_mask(0, DMA_ETOP_ENDIANNESS | DMA_PDEN,
199 LTQ_DMA_PCTRL); 199 LTQ_DMA_PCTRL);
200 break; 200 break;
201 201
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index c4a82e841c73..eeddc58802e1 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -2,8 +2,9 @@
2# Makefile for MIPS-specific library files.. 2# Makefile for MIPS-specific library files..
3# 3#
4 4
5lib-y += csum_partial.o delay.o memcpy.o memset.o \ 5lib-y += bitops.o csum_partial.o delay.o memcpy.o memset.o \
6 strlen_user.o strncpy_user.o strnlen_user.o uncached.o 6 mips-atomic.o strlen_user.o strncpy_user.o \
7 strnlen_user.o uncached.o
7 8
8obj-y += iomap.o 9obj-y += iomap.o
9obj-$(CONFIG_PCI) += iomap-pci.o 10obj-$(CONFIG_PCI) += iomap-pci.o
diff --git a/arch/mips/lib/bitops.c b/arch/mips/lib/bitops.c
new file mode 100644
index 000000000000..239a9c957b02
--- /dev/null
+++ b/arch/mips/lib/bitops.c
@@ -0,0 +1,179 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 1994-1997, 99, 2000, 06, 07 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (c) 1999, 2000 Silicon Graphics, Inc.
8 */
9#include <linux/bitops.h>
10#include <linux/irqflags.h>
11#include <linux/export.h>
12
13
14/**
15 * __mips_set_bit - Atomically set a bit in memory. This is called by
16 * set_bit() if it cannot find a faster solution.
17 * @nr: the bit to set
18 * @addr: the address to start counting from
19 */
20void __mips_set_bit(unsigned long nr, volatile unsigned long *addr)
21{
22 volatile unsigned long *a = addr;
23 unsigned bit = nr & SZLONG_MASK;
24 unsigned long mask;
25 unsigned long flags;
26
27 a += nr >> SZLONG_LOG;
28 mask = 1UL << bit;
29 raw_local_irq_save(flags);
30 *a |= mask;
31 raw_local_irq_restore(flags);
32}
33EXPORT_SYMBOL(__mips_set_bit);
34
35
36/**
37 * __mips_clear_bit - Clears a bit in memory. This is called by clear_bit() if
38 * it cannot find a faster solution.
39 * @nr: Bit to clear
40 * @addr: Address to start counting from
41 */
42void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr)
43{
44 volatile unsigned long *a = addr;
45 unsigned bit = nr & SZLONG_MASK;
46 unsigned long mask;
47 unsigned long flags;
48
49 a += nr >> SZLONG_LOG;
50 mask = 1UL << bit;
51 raw_local_irq_save(flags);
52 *a &= ~mask;
53 raw_local_irq_restore(flags);
54}
55EXPORT_SYMBOL(__mips_clear_bit);
56
57
58/**
59 * __mips_change_bit - Toggle a bit in memory. This is called by change_bit()
60 * if it cannot find a faster solution.
61 * @nr: Bit to change
62 * @addr: Address to start counting from
63 */
64void __mips_change_bit(unsigned long nr, volatile unsigned long *addr)
65{
66 volatile unsigned long *a = addr;
67 unsigned bit = nr & SZLONG_MASK;
68 unsigned long mask;
69 unsigned long flags;
70
71 a += nr >> SZLONG_LOG;
72 mask = 1UL << bit;
73 raw_local_irq_save(flags);
74 *a ^= mask;
75 raw_local_irq_restore(flags);
76}
77EXPORT_SYMBOL(__mips_change_bit);
78
79
80/**
81 * __mips_test_and_set_bit - Set a bit and return its old value. This is
82 * called by test_and_set_bit() if it cannot find a faster solution.
83 * @nr: Bit to set
84 * @addr: Address to count from
85 */
86int __mips_test_and_set_bit(unsigned long nr,
87 volatile unsigned long *addr)
88{
89 volatile unsigned long *a = addr;
90 unsigned bit = nr & SZLONG_MASK;
91 unsigned long mask;
92 unsigned long flags;
93 unsigned long res;
94
95 a += nr >> SZLONG_LOG;
96 mask = 1UL << bit;
97 raw_local_irq_save(flags);
98 res = (mask & *a);
99 *a |= mask;
100 raw_local_irq_restore(flags);
101 return res;
102}
103EXPORT_SYMBOL(__mips_test_and_set_bit);
104
105
106/**
107 * __mips_test_and_set_bit_lock - Set a bit and return its old value. This is
108 * called by test_and_set_bit_lock() if it cannot find a faster solution.
109 * @nr: Bit to set
110 * @addr: Address to count from
111 */
112int __mips_test_and_set_bit_lock(unsigned long nr,
113 volatile unsigned long *addr)
114{
115 volatile unsigned long *a = addr;
116 unsigned bit = nr & SZLONG_MASK;
117 unsigned long mask;
118 unsigned long flags;
119 unsigned long res;
120
121 a += nr >> SZLONG_LOG;
122 mask = 1UL << bit;
123 raw_local_irq_save(flags);
124 res = (mask & *a);
125 *a |= mask;
126 raw_local_irq_restore(flags);
127 return res;
128}
129EXPORT_SYMBOL(__mips_test_and_set_bit_lock);
130
131
132/**
133 * __mips_test_and_clear_bit - Clear a bit and return its old value. This is
134 * called by test_and_clear_bit() if it cannot find a faster solution.
135 * @nr: Bit to clear
136 * @addr: Address to count from
137 */
138int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
139{
140 volatile unsigned long *a = addr;
141 unsigned bit = nr & SZLONG_MASK;
142 unsigned long mask;
143 unsigned long flags;
144 unsigned long res;
145
146 a += nr >> SZLONG_LOG;
147 mask = 1UL << bit;
148 raw_local_irq_save(flags);
149 res = (mask & *a);
150 *a &= ~mask;
151 raw_local_irq_restore(flags);
152 return res;
153}
154EXPORT_SYMBOL(__mips_test_and_clear_bit);
155
156
157/**
158 * __mips_test_and_change_bit - Change a bit and return its old value. This is
159 * called by test_and_change_bit() if it cannot find a faster solution.
160 * @nr: Bit to change
161 * @addr: Address to count from
162 */
163int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
164{
165 volatile unsigned long *a = addr;
166 unsigned bit = nr & SZLONG_MASK;
167 unsigned long mask;
168 unsigned long flags;
169 unsigned long res;
170
171 a += nr >> SZLONG_LOG;
172 mask = 1UL << bit;
173 raw_local_irq_save(flags);
174 res = (mask & *a);
175 *a ^= mask;
176 raw_local_irq_restore(flags);
177 return res;
178}
179EXPORT_SYMBOL(__mips_test_and_change_bit);
diff --git a/arch/mips/lib/mips-atomic.c b/arch/mips/lib/mips-atomic.c
new file mode 100644
index 000000000000..cd160be3ce4d
--- /dev/null
+++ b/arch/mips/lib/mips-atomic.c
@@ -0,0 +1,176 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Copyright (C) 2000 MIPS Technologies, Inc.
10 */
11#include <asm/irqflags.h>
12#include <asm/hazards.h>
13#include <linux/compiler.h>
14#include <linux/preempt.h>
15#include <linux/export.h>
16
17#if !defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT_SMTC)
18
19/*
20 * For cli() we have to insert nops to make sure that the new value
21 * has actually arrived in the status register before the end of this
22 * macro.
23 * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
24 * no nops at all.
25 */
26/*
27 * For TX49, operating only IE bit is not enough.
28 *
29 * If mfc0 $12 follows store and the mfc0 is last instruction of a
30 * page and fetching the next instruction causes TLB miss, the result
31 * of the mfc0 might wrongly contain EXL bit.
32 *
33 * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
34 *
35 * Workaround: mask EXL bit of the result or place a nop before mfc0.
36 */
37__asm__(
38 " .macro arch_local_irq_disable\n"
39 " .set push \n"
40 " .set noat \n"
41#ifdef CONFIG_MIPS_MT_SMTC
42 " mfc0 $1, $2, 1 \n"
43 " ori $1, 0x400 \n"
44 " .set noreorder \n"
45 " mtc0 $1, $2, 1 \n"
46#elif defined(CONFIG_CPU_MIPSR2)
47 /* see irqflags.h for inline function */
48#else
49 " mfc0 $1,$12 \n"
50 " ori $1,0x1f \n"
51 " xori $1,0x1f \n"
52 " .set noreorder \n"
53 " mtc0 $1,$12 \n"
54#endif
55 " irq_disable_hazard \n"
56 " .set pop \n"
57 " .endm \n");
58
59notrace void arch_local_irq_disable(void)
60{
61 preempt_disable();
62 __asm__ __volatile__(
63 "arch_local_irq_disable"
64 : /* no outputs */
65 : /* no inputs */
66 : "memory");
67 preempt_enable();
68}
69EXPORT_SYMBOL(arch_local_irq_disable);
70
71
72__asm__(
73 " .macro arch_local_irq_save result \n"
74 " .set push \n"
75 " .set reorder \n"
76 " .set noat \n"
77#ifdef CONFIG_MIPS_MT_SMTC
78 " mfc0 \\result, $2, 1 \n"
79 " ori $1, \\result, 0x400 \n"
80 " .set noreorder \n"
81 " mtc0 $1, $2, 1 \n"
82 " andi \\result, \\result, 0x400 \n"
83#elif defined(CONFIG_CPU_MIPSR2)
84 /* see irqflags.h for inline function */
85#else
86 " mfc0 \\result, $12 \n"
87 " ori $1, \\result, 0x1f \n"
88 " xori $1, 0x1f \n"
89 " .set noreorder \n"
90 " mtc0 $1, $12 \n"
91#endif
92 " irq_disable_hazard \n"
93 " .set pop \n"
94 " .endm \n");
95
96notrace unsigned long arch_local_irq_save(void)
97{
98 unsigned long flags;
99 preempt_disable();
100 asm volatile("arch_local_irq_save\t%0"
101 : "=r" (flags)
102 : /* no inputs */
103 : "memory");
104 preempt_enable();
105 return flags;
106}
107EXPORT_SYMBOL(arch_local_irq_save);
108
109
110__asm__(
111 " .macro arch_local_irq_restore flags \n"
112 " .set push \n"
113 " .set noreorder \n"
114 " .set noat \n"
115#ifdef CONFIG_MIPS_MT_SMTC
116 "mfc0 $1, $2, 1 \n"
117 "andi \\flags, 0x400 \n"
118 "ori $1, 0x400 \n"
119 "xori $1, 0x400 \n"
120 "or \\flags, $1 \n"
121 "mtc0 \\flags, $2, 1 \n"
122#elif defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)
123 /* see irqflags.h for inline function */
124#elif defined(CONFIG_CPU_MIPSR2)
125 /* see irqflags.h for inline function */
126#else
127 " mfc0 $1, $12 \n"
128 " andi \\flags, 1 \n"
129 " ori $1, 0x1f \n"
130 " xori $1, 0x1f \n"
131 " or \\flags, $1 \n"
132 " mtc0 \\flags, $12 \n"
133#endif
134 " irq_disable_hazard \n"
135 " .set pop \n"
136 " .endm \n");
137
138notrace void arch_local_irq_restore(unsigned long flags)
139{
140 unsigned long __tmp1;
141
142#ifdef CONFIG_MIPS_MT_SMTC
143 /*
144 * SMTC kernel needs to do a software replay of queued
145 * IPIs, at the cost of branch and call overhead on each
146 * local_irq_restore()
147 */
148 if (unlikely(!(flags & 0x0400)))
149 smtc_ipi_replay();
150#endif
151 preempt_disable();
152 __asm__ __volatile__(
153 "arch_local_irq_restore\t%0"
154 : "=r" (__tmp1)
155 : "0" (flags)
156 : "memory");
157 preempt_enable();
158}
159EXPORT_SYMBOL(arch_local_irq_restore);
160
161
162notrace void __arch_local_irq_restore(unsigned long flags)
163{
164 unsigned long __tmp1;
165
166 preempt_disable();
167 __asm__ __volatile__(
168 "arch_local_irq_restore\t%0"
169 : "=r" (__tmp1)
170 : "0" (flags)
171 : "memory");
172 preempt_enable();
173}
174EXPORT_SYMBOL(__arch_local_irq_restore);
175
176#endif /* !defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT_SMTC) */
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index a03bf00a1a9c..47c77e7ffbf8 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -171,16 +171,17 @@ static int isBranchInstr(mips_instruction * i)
171 * In the Linux kernel, we support selection of FPR format on the 171 * In the Linux kernel, we support selection of FPR format on the
172 * basis of the Status.FR bit. If an FPU is not present, the FR bit 172 * basis of the Status.FR bit. If an FPU is not present, the FR bit
173 * is hardwired to zero, which would imply a 32-bit FPU even for 173 * is hardwired to zero, which would imply a 32-bit FPU even for
174 * 64-bit CPUs. For 64-bit kernels with no FPU we use TIF_32BIT_REGS 174 * 64-bit CPUs so we rather look at TIF_32BIT_REGS.
175 * as a proxy for the FR bit so that a 64-bit FPU is emulated. In any 175 * FPU emu is slow and bulky and optimizing this function offers fairly
176 * case, for a 32-bit kernel which uses the O32 MIPS ABI, only the 176 * sizeable benefits so we try to be clever and make this function return
177 * even FPRs are used (Status.FR = 0). 177 * a constant whenever possible, that is on 64-bit kernels without O32
178 * compatibility enabled and on 32-bit kernels.
178 */ 179 */
179static inline int cop1_64bit(struct pt_regs *xcp) 180static inline int cop1_64bit(struct pt_regs *xcp)
180{ 181{
181 if (cpu_has_fpu) 182#if defined(CONFIG_64BIT) && !defined(CONFIG_MIPS32_O32)
182 return xcp->cp0_status & ST0_FR; 183 return 1;
183#ifdef CONFIG_64BIT 184#elif defined(CONFIG_64BIT) && defined(CONFIG_MIPS32_O32)
184 return !test_thread_flag(TIF_32BIT_REGS); 185 return !test_thread_flag(TIF_32BIT_REGS);
185#else 186#else
186 return 0; 187 return 0;
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index 44e69e7a4519..6ec04daf4231 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (C) 2005-2007 Cavium Networks 6 * Copyright (C) 2005-2007 Cavium Networks
7 */ 7 */
8#include <linux/export.h>
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/kernel.h> 10#include <linux/kernel.h>
10#include <linux/sched.h> 11#include <linux/sched.h>
@@ -28,6 +29,7 @@
28#include <asm/octeon/octeon.h> 29#include <asm/octeon/octeon.h>
29 30
30unsigned long long cache_err_dcache[NR_CPUS]; 31unsigned long long cache_err_dcache[NR_CPUS];
32EXPORT_SYMBOL_GPL(cache_err_dcache);
31 33
32/** 34/**
33 * Octeon automatically flushes the dcache on tlb changes, so 35 * Octeon automatically flushes the dcache on tlb changes, so
@@ -284,39 +286,59 @@ void __cpuinit octeon_cache_init(void)
284 board_cache_error_setup = octeon_cache_error_setup; 286 board_cache_error_setup = octeon_cache_error_setup;
285} 287}
286 288
287/** 289/*
288 * Handle a cache error exception 290 * Handle a cache error exception
289 */ 291 */
292static RAW_NOTIFIER_HEAD(co_cache_error_chain);
290 293
291static void cache_parity_error_octeon(int non_recoverable) 294int register_co_cache_error_notifier(struct notifier_block *nb)
292{ 295{
293 unsigned long coreid = cvmx_get_core_num(); 296 return raw_notifier_chain_register(&co_cache_error_chain, nb);
294 uint64_t icache_err = read_octeon_c0_icacheerr(); 297}
295 298EXPORT_SYMBOL_GPL(register_co_cache_error_notifier);
296 pr_err("Cache error exception:\n"); 299
297 pr_err("cp0_errorepc == %lx\n", read_c0_errorepc()); 300int unregister_co_cache_error_notifier(struct notifier_block *nb)
298 if (icache_err & 1) { 301{
299 pr_err("CacheErr (Icache) == %llx\n", 302 return raw_notifier_chain_unregister(&co_cache_error_chain, nb);
300 (unsigned long long)icache_err); 303}
301 write_octeon_c0_icacheerr(0); 304EXPORT_SYMBOL_GPL(unregister_co_cache_error_notifier);
302 }
303 if (cache_err_dcache[coreid] & 1) {
304 pr_err("CacheErr (Dcache) == %llx\n",
305 (unsigned long long)cache_err_dcache[coreid]);
306 cache_err_dcache[coreid] = 0;
307 }
308 305
309 if (non_recoverable) 306static void co_cache_error_call_notifiers(unsigned long val)
310 panic("Can't handle cache error: nested exception"); 307{
308 int rv = raw_notifier_call_chain(&co_cache_error_chain, val, NULL);
309 if ((rv & ~NOTIFY_STOP_MASK) != NOTIFY_OK) {
310 u64 dcache_err;
311 unsigned long coreid = cvmx_get_core_num();
312 u64 icache_err = read_octeon_c0_icacheerr();
313
314 if (val) {
315 dcache_err = cache_err_dcache[coreid];
316 cache_err_dcache[coreid] = 0;
317 } else {
318 dcache_err = read_octeon_c0_dcacheerr();
319 }
320
321 pr_err("Core%lu: Cache error exception:\n", coreid);
322 pr_err("cp0_errorepc == %lx\n", read_c0_errorepc());
323 if (icache_err & 1) {
324 pr_err("CacheErr (Icache) == %llx\n",
325 (unsigned long long)icache_err);
326 write_octeon_c0_icacheerr(0);
327 }
328 if (dcache_err & 1) {
329 pr_err("CacheErr (Dcache) == %llx\n",
330 (unsigned long long)dcache_err);
331 }
332 }
311} 333}
312 334
313/** 335/*
314 * Called when the the exception is recoverable 336 * Called when the the exception is recoverable
315 */ 337 */
316 338
317asmlinkage void cache_parity_error_octeon_recoverable(void) 339asmlinkage void cache_parity_error_octeon_recoverable(void)
318{ 340{
319 cache_parity_error_octeon(0); 341 co_cache_error_call_notifiers(0);
320} 342}
321 343
322/** 344/**
@@ -325,5 +347,6 @@ asmlinkage void cache_parity_error_octeon_recoverable(void)
325 347
326asmlinkage void cache_parity_error_octeon_non_recoverable(void) 348asmlinkage void cache_parity_error_octeon_non_recoverable(void)
327{ 349{
328 cache_parity_error_octeon(1); 350 co_cache_error_call_notifiers(1);
351 panic("Can't handle cache error: nested exception");
329} 352}
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 1d6fee48d0dd..0f7d788e8810 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -632,9 +632,6 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
632 if (size >= scache_size) 632 if (size >= scache_size)
633 r4k_blast_scache(); 633 r4k_blast_scache();
634 else { 634 else {
635 unsigned long lsize = cpu_scache_line_size();
636 unsigned long almask = ~(lsize - 1);
637
638 /* 635 /*
639 * There is no clearly documented alignment requirement 636 * There is no clearly documented alignment requirement
640 * for the cache instruction on MIPS processors and 637 * for the cache instruction on MIPS processors and
@@ -643,9 +640,6 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
643 * hit ops with insufficient alignment. Solved by 640 * hit ops with insufficient alignment. Solved by
644 * aligning the address to cache line size. 641 * aligning the address to cache line size.
645 */ 642 */
646 cache_op(Hit_Writeback_Inv_SD, addr & almask);
647 cache_op(Hit_Writeback_Inv_SD,
648 (addr + size - 1) & almask);
649 blast_inv_scache_range(addr, addr + size); 643 blast_inv_scache_range(addr, addr + size);
650 } 644 }
651 __sync(); 645 __sync();
@@ -655,12 +649,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
655 if (cpu_has_safe_index_cacheops && size >= dcache_size) { 649 if (cpu_has_safe_index_cacheops && size >= dcache_size) {
656 r4k_blast_dcache(); 650 r4k_blast_dcache();
657 } else { 651 } else {
658 unsigned long lsize = cpu_dcache_line_size();
659 unsigned long almask = ~(lsize - 1);
660
661 R4600_HIT_CACHEOP_WAR_IMPL; 652 R4600_HIT_CACHEOP_WAR_IMPL;
662 cache_op(Hit_Writeback_Inv_D, addr & almask);
663 cache_op(Hit_Writeback_Inv_D, (addr + size - 1) & almask);
664 blast_inv_dcache_range(addr, addr + size); 653 blast_inv_dcache_range(addr, addr + size);
665 } 654 }
666 655
@@ -947,7 +936,6 @@ static void __cpuinit probe_pcache(void)
947 case CPU_RM7000: 936 case CPU_RM7000:
948 rm7k_erratum31(); 937 rm7k_erratum31();
949 938
950 case CPU_RM9000:
951 icache_size = 1 << (12 + ((config & CONF_IC) >> 9)); 939 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
952 c->icache.linesz = 16 << ((config & CONF_IB) >> 5); 940 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
953 c->icache.ways = 4; 941 c->icache.ways = 4;
@@ -958,9 +946,7 @@ static void __cpuinit probe_pcache(void)
958 c->dcache.ways = 4; 946 c->dcache.ways = 4;
959 c->dcache.waybit = __ffs(dcache_size / c->dcache.ways); 947 c->dcache.waybit = __ffs(dcache_size / c->dcache.ways);
960 948
961#if !defined(CONFIG_SMP) || !defined(RM9000_CDEX_SMP_WAR)
962 c->options |= MIPS_CPU_CACHE_CDEX_P; 949 c->options |= MIPS_CPU_CACHE_CDEX_P;
963#endif
964 c->options |= MIPS_CPU_PREFETCH; 950 c->options |= MIPS_CPU_PREFETCH;
965 break; 951 break;
966 952
@@ -1245,7 +1231,6 @@ static void __cpuinit setup_scache(void)
1245 return; 1231 return;
1246 1232
1247 case CPU_RM7000: 1233 case CPU_RM7000:
1248 case CPU_RM9000:
1249#ifdef CONFIG_RM7000_CPU_SCACHE 1234#ifdef CONFIG_RM7000_CPU_SCACHE
1250 rm7k_sc_init(); 1235 rm7k_sc_init();
1251#endif 1236#endif
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index aff57057a949..da815d295239 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -1,3 +1,4 @@
1#include <linux/compiler.h>
1#include <linux/module.h> 2#include <linux/module.h>
2#include <linux/highmem.h> 3#include <linux/highmem.h>
3#include <linux/sched.h> 4#include <linux/sched.h>
@@ -67,7 +68,7 @@ EXPORT_SYMBOL(kmap_atomic);
67void __kunmap_atomic(void *kvaddr) 68void __kunmap_atomic(void *kvaddr)
68{ 69{
69 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; 70 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
70 int type; 71 int type __maybe_unused;
71 72
72 if (vaddr < FIXADDR_START) { // FIXME 73 if (vaddr < FIXADDR_START) { // FIXME
73 pagefault_enable(); 74 pagefault_enable();
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 98f530e18216..8e666c55f4d4 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -140,15 +140,6 @@ static void __cpuinit set_prefetch_parameters(void)
140 pref_bias_copy_load = 256; 140 pref_bias_copy_load = 256;
141 break; 141 break;
142 142
143 case CPU_RM9000:
144 /*
145 * As a workaround for erratum G105 which make the
146 * PrepareForStore hint unusable we fall back to
147 * StoreRetained on the RM9000. Once it is known which
148 * versions of the RM9000 we'll be able to condition-
149 * alize this.
150 */
151
152 case CPU_R10000: 143 case CPU_R10000:
153 case CPU_R12000: 144 case CPU_R12000:
154 case CPU_R14000: 145 case CPU_R14000:
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
index 25407794edb4..ee331bbd8f8a 100644
--- a/arch/mips/mm/pgtable-64.c
+++ b/arch/mips/mm/pgtable-64.c
@@ -11,6 +11,7 @@
11#include <asm/fixmap.h> 11#include <asm/fixmap.h>
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13#include <asm/pgalloc.h> 13#include <asm/pgalloc.h>
14#include <asm/tlbflush.h>
14 15
15void pgd_init(unsigned long page) 16void pgd_init(unsigned long page)
16{ 17{
@@ -61,6 +62,36 @@ void pmd_init(unsigned long addr, unsigned long pagetable)
61} 62}
62#endif 63#endif
63 64
65#ifdef CONFIG_TRANSPARENT_HUGEPAGE
66
67void pmdp_splitting_flush(struct vm_area_struct *vma,
68 unsigned long address,
69 pmd_t *pmdp)
70{
71 if (!pmd_trans_splitting(*pmdp)) {
72 pmd_t pmd = pmd_mksplitting(*pmdp);
73 set_pmd_at(vma->vm_mm, address, pmdp, pmd);
74 }
75}
76
77#endif
78
79pmd_t mk_pmd(struct page *page, pgprot_t prot)
80{
81 pmd_t pmd;
82
83 pmd_val(pmd) = (page_to_pfn(page) << _PFN_SHIFT) | pgprot_val(prot);
84
85 return pmd;
86}
87
88void set_pmd_at(struct mm_struct *mm, unsigned long addr,
89 pmd_t *pmdp, pmd_t pmd)
90{
91 *pmdp = pmd;
92 flush_tlb_all();
93}
94
64void __init pagetable_init(void) 95void __init pagetable_init(void)
65{ 96{
66 unsigned long vaddr; 97 unsigned long vaddr;
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 4b9b935a070e..94ad86d055c5 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -305,7 +305,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
305 pudp = pud_offset(pgdp, address); 305 pudp = pud_offset(pgdp, address);
306 pmdp = pmd_offset(pudp, address); 306 pmdp = pmd_offset(pudp, address);
307 idx = read_c0_index(); 307 idx = read_c0_index();
308#ifdef CONFIG_HUGETLB_PAGE 308#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
309 /* this could be a huge page */ 309 /* this could be a huge page */
310 if (pmd_huge(*pmdp)) { 310 if (pmd_huge(*pmdp)) {
311 unsigned long lo; 311 unsigned long lo;
@@ -377,6 +377,26 @@ void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
377 EXIT_CRITICAL(flags); 377 EXIT_CRITICAL(flags);
378} 378}
379 379
380#ifdef CONFIG_TRANSPARENT_HUGEPAGE
381
382int __init has_transparent_hugepage(void)
383{
384 unsigned int mask;
385 unsigned long flags;
386
387 ENTER_CRITICAL(flags);
388 write_c0_pagemask(PM_HUGE_MASK);
389 back_to_back_c0_hazard();
390 mask = read_c0_pagemask();
391 write_c0_pagemask(PM_DEFAULT_MASK);
392
393 EXIT_CRITICAL(flags);
394
395 return mask == PM_HUGE_MASK;
396}
397
398#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
399
380static int __cpuinitdata ntlb; 400static int __cpuinitdata ntlb;
381static int __init set_ntlb(char *str) 401static int __init set_ntlb(char *str)
382{ 402{
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 818c525b1baf..05613355627b 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -158,7 +158,7 @@ enum label_id {
158 label_smp_pgtable_change, 158 label_smp_pgtable_change,
159 label_r3000_write_probe_fail, 159 label_r3000_write_probe_fail,
160 label_large_segbits_fault, 160 label_large_segbits_fault,
161#ifdef CONFIG_HUGETLB_PAGE 161#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
162 label_tlb_huge_update, 162 label_tlb_huge_update,
163#endif 163#endif
164}; 164};
@@ -177,7 +177,7 @@ UASM_L_LA(_nopage_tlbm)
177UASM_L_LA(_smp_pgtable_change) 177UASM_L_LA(_smp_pgtable_change)
178UASM_L_LA(_r3000_write_probe_fail) 178UASM_L_LA(_r3000_write_probe_fail)
179UASM_L_LA(_large_segbits_fault) 179UASM_L_LA(_large_segbits_fault)
180#ifdef CONFIG_HUGETLB_PAGE 180#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
181UASM_L_LA(_tlb_huge_update) 181UASM_L_LA(_tlb_huge_update)
182#endif 182#endif
183 183
@@ -210,19 +210,59 @@ static void __cpuinit uasm_bgezl_label(struct uasm_label **l,
210} 210}
211 211
212/* 212/*
213 * For debug purposes. 213 * pgtable bits are assigned dynamically depending on processor feature
214 * and statically based on kernel configuration. This spits out the actual
215 * values the kernel is using. Required to make sense from disassembled
216 * TLB exception handlers.
214 */ 217 */
215static inline void dump_handler(const u32 *handler, int count) 218static void output_pgtable_bits_defines(void)
219{
220#define pr_define(fmt, ...) \
221 pr_debug("#define " fmt, ##__VA_ARGS__)
222
223 pr_debug("#include <asm/asm.h>\n");
224 pr_debug("#include <asm/regdef.h>\n");
225 pr_debug("\n");
226
227 pr_define("_PAGE_PRESENT_SHIFT %d\n", _PAGE_PRESENT_SHIFT);
228 pr_define("_PAGE_READ_SHIFT %d\n", _PAGE_READ_SHIFT);
229 pr_define("_PAGE_WRITE_SHIFT %d\n", _PAGE_WRITE_SHIFT);
230 pr_define("_PAGE_ACCESSED_SHIFT %d\n", _PAGE_ACCESSED_SHIFT);
231 pr_define("_PAGE_MODIFIED_SHIFT %d\n", _PAGE_MODIFIED_SHIFT);
232#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
233 pr_define("_PAGE_HUGE_SHIFT %d\n", _PAGE_HUGE_SHIFT);
234 pr_define("_PAGE_SPLITTING_SHIFT %d\n", _PAGE_SPLITTING_SHIFT);
235#endif
236 if (cpu_has_rixi) {
237#ifdef _PAGE_NO_EXEC_SHIFT
238 pr_define("_PAGE_NO_EXEC_SHIFT %d\n", _PAGE_NO_EXEC_SHIFT);
239#endif
240#ifdef _PAGE_NO_READ_SHIFT
241 pr_define("_PAGE_NO_READ_SHIFT %d\n", _PAGE_NO_READ_SHIFT);
242#endif
243 }
244 pr_define("_PAGE_GLOBAL_SHIFT %d\n", _PAGE_GLOBAL_SHIFT);
245 pr_define("_PAGE_VALID_SHIFT %d\n", _PAGE_VALID_SHIFT);
246 pr_define("_PAGE_DIRTY_SHIFT %d\n", _PAGE_DIRTY_SHIFT);
247 pr_define("_PFN_SHIFT %d\n", _PFN_SHIFT);
248 pr_debug("\n");
249}
250
251static inline void dump_handler(const char *symbol, const u32 *handler, int count)
216{ 252{
217 int i; 253 int i;
218 254
255 pr_debug("LEAF(%s)\n", symbol);
256
219 pr_debug("\t.set push\n"); 257 pr_debug("\t.set push\n");
220 pr_debug("\t.set noreorder\n"); 258 pr_debug("\t.set noreorder\n");
221 259
222 for (i = 0; i < count; i++) 260 for (i = 0; i < count; i++)
223 pr_debug("\t%p\t.word 0x%08x\n", &handler[i], handler[i]); 261 pr_debug("\t.word\t0x%08x\t\t# %p\n", handler[i], &handler[i]);
262
263 pr_debug("\t.set\tpop\n");
224 264
225 pr_debug("\t.set pop\n"); 265 pr_debug("\tEND(%s)\n", symbol);
226} 266}
227 267
228/* The only general purpose registers allowed in TLB handlers. */ 268/* The only general purpose registers allowed in TLB handlers. */
@@ -405,7 +445,7 @@ static void __cpuinit build_r3000_tlb_refill_handler(void)
405 445
406 memcpy((void *)ebase, tlb_handler, 0x80); 446 memcpy((void *)ebase, tlb_handler, 0x80);
407 447
408 dump_handler((u32 *)ebase, 32); 448 dump_handler("r3000_tlb_refill", (u32 *)ebase, 32);
409} 449}
410#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */ 450#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */
411 451
@@ -447,7 +487,6 @@ static void __cpuinit __maybe_unused build_tlb_probe_entry(u32 **p)
447 case CPU_R4600: 487 case CPU_R4600:
448 case CPU_R4700: 488 case CPU_R4700:
449 case CPU_R5000: 489 case CPU_R5000:
450 case CPU_R5000A:
451 case CPU_NEVADA: 490 case CPU_NEVADA:
452 uasm_i_nop(p); 491 uasm_i_nop(p);
453 uasm_i_tlbp(p); 492 uasm_i_tlbp(p);
@@ -521,7 +560,6 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
521 break; 560 break;
522 561
523 case CPU_R5000: 562 case CPU_R5000:
524 case CPU_R5000A:
525 case CPU_NEVADA: 563 case CPU_NEVADA:
526 uasm_i_nop(p); /* QED specifies 2 nops hazard */ 564 uasm_i_nop(p); /* QED specifies 2 nops hazard */
527 uasm_i_nop(p); /* QED specifies 2 nops hazard */ 565 uasm_i_nop(p); /* QED specifies 2 nops hazard */
@@ -569,24 +607,6 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
569 tlbw(p); 607 tlbw(p);
570 break; 608 break;
571 609
572 case CPU_RM9000:
573 /*
574 * When the JTLB is updated by tlbwi or tlbwr, a subsequent
575 * use of the JTLB for instructions should not occur for 4
576 * cpu cycles and use for data translations should not occur
577 * for 3 cpu cycles.
578 */
579 uasm_i_ssnop(p);
580 uasm_i_ssnop(p);
581 uasm_i_ssnop(p);
582 uasm_i_ssnop(p);
583 tlbw(p);
584 uasm_i_ssnop(p);
585 uasm_i_ssnop(p);
586 uasm_i_ssnop(p);
587 uasm_i_ssnop(p);
588 break;
589
590 case CPU_VR4111: 610 case CPU_VR4111:
591 case CPU_VR4121: 611 case CPU_VR4121:
592 case CPU_VR4122: 612 case CPU_VR4122:
@@ -633,7 +653,7 @@ static __cpuinit __maybe_unused void build_convert_pte_to_entrylo(u32 **p,
633 } 653 }
634} 654}
635 655
636#ifdef CONFIG_HUGETLB_PAGE 656#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
637 657
638static __cpuinit void build_restore_pagemask(u32 **p, 658static __cpuinit void build_restore_pagemask(u32 **p,
639 struct uasm_reloc **r, 659 struct uasm_reloc **r,
@@ -759,7 +779,7 @@ static __cpuinit void build_huge_handler_tail(u32 **p,
759 build_huge_update_entries(p, pte, ptr); 779 build_huge_update_entries(p, pte, ptr);
760 build_huge_tlb_write_entry(p, l, r, pte, tlb_indexed, 0); 780 build_huge_tlb_write_entry(p, l, r, pte, tlb_indexed, 0);
761} 781}
762#endif /* CONFIG_HUGETLB_PAGE */ 782#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
763 783
764#ifdef CONFIG_64BIT 784#ifdef CONFIG_64BIT
765/* 785/*
@@ -1204,7 +1224,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1204 /* Adjust the context during the load latency. */ 1224 /* Adjust the context during the load latency. */
1205 build_adjust_context(p, tmp); 1225 build_adjust_context(p, tmp);
1206 1226
1207#ifdef CONFIG_HUGETLB_PAGE 1227#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1208 uasm_il_bbit1(p, r, scratch, ilog2(_PAGE_HUGE), label_tlb_huge_update); 1228 uasm_il_bbit1(p, r, scratch, ilog2(_PAGE_HUGE), label_tlb_huge_update);
1209 /* 1229 /*
1210 * The in the LWX case we don't want to do the load in the 1230 * The in the LWX case we don't want to do the load in the
@@ -1213,7 +1233,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1213 */ 1233 */
1214 if (use_lwx_insns()) 1234 if (use_lwx_insns())
1215 uasm_i_nop(p); 1235 uasm_i_nop(p);
1216#endif /* CONFIG_HUGETLB_PAGE */ 1236#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
1217 1237
1218 1238
1219 /* build_update_entries */ 1239 /* build_update_entries */
@@ -1316,7 +1336,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1316 build_get_pgde32(&p, K0, K1); /* get pgd in K1 */ 1336 build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
1317#endif 1337#endif
1318 1338
1319#ifdef CONFIG_HUGETLB_PAGE 1339#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1320 build_is_huge_pte(&p, &r, K0, K1, label_tlb_huge_update); 1340 build_is_huge_pte(&p, &r, K0, K1, label_tlb_huge_update);
1321#endif 1341#endif
1322 1342
@@ -1326,7 +1346,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1326 uasm_l_leave(&l, p); 1346 uasm_l_leave(&l, p);
1327 uasm_i_eret(&p); /* return from trap */ 1347 uasm_i_eret(&p); /* return from trap */
1328 } 1348 }
1329#ifdef CONFIG_HUGETLB_PAGE 1349#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1330 uasm_l_tlb_huge_update(&l, p); 1350 uasm_l_tlb_huge_update(&l, p);
1331 build_huge_update_entries(&p, htlb_info.huge_pte, K1); 1351 build_huge_update_entries(&p, htlb_info.huge_pte, K1);
1332 build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, 1352 build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random,
@@ -1371,7 +1391,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1371 uasm_copy_handler(relocs, labels, tlb_handler, p, f); 1391 uasm_copy_handler(relocs, labels, tlb_handler, p, f);
1372 final_len = p - tlb_handler; 1392 final_len = p - tlb_handler;
1373 } else { 1393 } else {
1374#if defined(CONFIG_HUGETLB_PAGE) 1394#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1375 const enum label_id ls = label_tlb_huge_update; 1395 const enum label_id ls = label_tlb_huge_update;
1376#else 1396#else
1377 const enum label_id ls = label_vmalloc; 1397 const enum label_id ls = label_vmalloc;
@@ -1440,7 +1460,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1440 1460
1441 memcpy((void *)ebase, final_handler, 0x100); 1461 memcpy((void *)ebase, final_handler, 0x100);
1442 1462
1443 dump_handler((u32 *)ebase, 64); 1463 dump_handler("r4000_tlb_refill", (u32 *)ebase, 64);
1444} 1464}
1445 1465
1446/* 1466/*
@@ -1497,7 +1517,8 @@ static void __cpuinit build_r4000_setup_pgd(void)
1497 pr_debug("Wrote tlbmiss_handler_setup_pgd (%u instructions).\n", 1517 pr_debug("Wrote tlbmiss_handler_setup_pgd (%u instructions).\n",
1498 (unsigned int)(p - tlbmiss_handler_setup_pgd)); 1518 (unsigned int)(p - tlbmiss_handler_setup_pgd));
1499 1519
1500 dump_handler(tlbmiss_handler_setup_pgd, 1520 dump_handler("tlbmiss_handler",
1521 tlbmiss_handler_setup_pgd,
1501 ARRAY_SIZE(tlbmiss_handler_setup_pgd)); 1522 ARRAY_SIZE(tlbmiss_handler_setup_pgd));
1502} 1523}
1503#endif 1524#endif
@@ -1767,7 +1788,7 @@ static void __cpuinit build_r3000_tlb_load_handler(void)
1767 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n", 1788 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n",
1768 (unsigned int)(p - handle_tlbl)); 1789 (unsigned int)(p - handle_tlbl));
1769 1790
1770 dump_handler(handle_tlbl, ARRAY_SIZE(handle_tlbl)); 1791 dump_handler("r3000_tlb_load", handle_tlbl, ARRAY_SIZE(handle_tlbl));
1771} 1792}
1772 1793
1773static void __cpuinit build_r3000_tlb_store_handler(void) 1794static void __cpuinit build_r3000_tlb_store_handler(void)
@@ -1797,7 +1818,7 @@ static void __cpuinit build_r3000_tlb_store_handler(void)
1797 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n", 1818 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n",
1798 (unsigned int)(p - handle_tlbs)); 1819 (unsigned int)(p - handle_tlbs));
1799 1820
1800 dump_handler(handle_tlbs, ARRAY_SIZE(handle_tlbs)); 1821 dump_handler("r3000_tlb_store", handle_tlbs, ARRAY_SIZE(handle_tlbs));
1801} 1822}
1802 1823
1803static void __cpuinit build_r3000_tlb_modify_handler(void) 1824static void __cpuinit build_r3000_tlb_modify_handler(void)
@@ -1827,7 +1848,7 @@ static void __cpuinit build_r3000_tlb_modify_handler(void)
1827 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n", 1848 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n",
1828 (unsigned int)(p - handle_tlbm)); 1849 (unsigned int)(p - handle_tlbm));
1829 1850
1830 dump_handler(handle_tlbm, ARRAY_SIZE(handle_tlbm)); 1851 dump_handler("r3000_tlb_modify", handle_tlbm, ARRAY_SIZE(handle_tlbm));
1831} 1852}
1832#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */ 1853#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */
1833 1854
@@ -1846,7 +1867,7 @@ build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l,
1846 build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */ 1867 build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
1847#endif 1868#endif
1848 1869
1849#ifdef CONFIG_HUGETLB_PAGE 1870#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1850 /* 1871 /*
1851 * For huge tlb entries, pmd doesn't contain an address but 1872 * For huge tlb entries, pmd doesn't contain an address but
1852 * instead contains the tlb pte. Check the PAGE_HUGE bit and 1873 * instead contains the tlb pte. Check the PAGE_HUGE bit and
@@ -1962,7 +1983,7 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1962 build_make_valid(&p, &r, wr.r1, wr.r2); 1983 build_make_valid(&p, &r, wr.r1, wr.r2);
1963 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); 1984 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
1964 1985
1965#ifdef CONFIG_HUGETLB_PAGE 1986#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1966 /* 1987 /*
1967 * This is the entry point when build_r4000_tlbchange_handler_head 1988 * This is the entry point when build_r4000_tlbchange_handler_head
1968 * spots a huge page. 1989 * spots a huge page.
@@ -2034,7 +2055,7 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
2034 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n", 2055 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n",
2035 (unsigned int)(p - handle_tlbl)); 2056 (unsigned int)(p - handle_tlbl));
2036 2057
2037 dump_handler(handle_tlbl, ARRAY_SIZE(handle_tlbl)); 2058 dump_handler("r4000_tlb_load", handle_tlbl, ARRAY_SIZE(handle_tlbl));
2038} 2059}
2039 2060
2040static void __cpuinit build_r4000_tlb_store_handler(void) 2061static void __cpuinit build_r4000_tlb_store_handler(void)
@@ -2055,7 +2076,7 @@ static void __cpuinit build_r4000_tlb_store_handler(void)
2055 build_make_write(&p, &r, wr.r1, wr.r2); 2076 build_make_write(&p, &r, wr.r1, wr.r2);
2056 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); 2077 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
2057 2078
2058#ifdef CONFIG_HUGETLB_PAGE 2079#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
2059 /* 2080 /*
2060 * This is the entry point when 2081 * This is the entry point when
2061 * build_r4000_tlbchange_handler_head spots a huge page. 2082 * build_r4000_tlbchange_handler_head spots a huge page.
@@ -2081,7 +2102,7 @@ static void __cpuinit build_r4000_tlb_store_handler(void)
2081 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n", 2102 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n",
2082 (unsigned int)(p - handle_tlbs)); 2103 (unsigned int)(p - handle_tlbs));
2083 2104
2084 dump_handler(handle_tlbs, ARRAY_SIZE(handle_tlbs)); 2105 dump_handler("r4000_tlb_store", handle_tlbs, ARRAY_SIZE(handle_tlbs));
2085} 2106}
2086 2107
2087static void __cpuinit build_r4000_tlb_modify_handler(void) 2108static void __cpuinit build_r4000_tlb_modify_handler(void)
@@ -2103,7 +2124,7 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)
2103 build_make_write(&p, &r, wr.r1, wr.r2); 2124 build_make_write(&p, &r, wr.r1, wr.r2);
2104 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); 2125 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
2105 2126
2106#ifdef CONFIG_HUGETLB_PAGE 2127#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
2107 /* 2128 /*
2108 * This is the entry point when 2129 * This is the entry point when
2109 * build_r4000_tlbchange_handler_head spots a huge page. 2130 * build_r4000_tlbchange_handler_head spots a huge page.
@@ -2129,7 +2150,7 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)
2129 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n", 2150 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n",
2130 (unsigned int)(p - handle_tlbm)); 2151 (unsigned int)(p - handle_tlbm));
2131 2152
2132 dump_handler(handle_tlbm, ARRAY_SIZE(handle_tlbm)); 2153 dump_handler("r4000_tlb_modify", handle_tlbm, ARRAY_SIZE(handle_tlbm));
2133} 2154}
2134 2155
2135void __cpuinit build_tlb_refill_handler(void) 2156void __cpuinit build_tlb_refill_handler(void)
@@ -2141,6 +2162,8 @@ void __cpuinit build_tlb_refill_handler(void)
2141 */ 2162 */
2142 static int run_once = 0; 2163 static int run_once = 0;
2143 2164
2165 output_pgtable_bits_defines();
2166
2144#ifdef CONFIG_64BIT 2167#ifdef CONFIG_64BIT
2145 check_for_high_segbits = current_cpu_data.vmbits > (PGDIR_SHIFT + PGD_ORDER + PAGE_SHIFT - 3); 2168 check_for_high_segbits = current_cpu_data.vmbits > (PGDIR_SHIFT + PGD_ORDER + PAGE_SHIFT - 3);
2146#endif 2169#endif
diff --git a/arch/mips/mti-malta/malta-platform.c b/arch/mips/mti-malta/malta-platform.c
index 80562b81f0f2..74732177851c 100644
--- a/arch/mips/mti-malta/malta-platform.c
+++ b/arch/mips/mti-malta/malta-platform.c
@@ -29,6 +29,7 @@
29#include <linux/mtd/partitions.h> 29#include <linux/mtd/partitions.h>
30#include <linux/mtd/physmap.h> 30#include <linux/mtd/physmap.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <asm/mips-boards/maltaint.h>
32#include <mtd/mtd-abi.h> 33#include <mtd/mtd-abi.h>
33 34
34#define SMC_PORT(base, int) \ 35#define SMC_PORT(base, int) \
@@ -48,7 +49,7 @@ static struct plat_serial8250_port uart8250_data[] = {
48 SMC_PORT(0x2F8, 3), 49 SMC_PORT(0x2F8, 3),
49 { 50 {
50 .mapbase = 0x1f000900, /* The CBUS UART */ 51 .mapbase = 0x1f000900, /* The CBUS UART */
51 .irq = MIPS_CPU_IRQ_BASE + 2, 52 .irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2,
52 .uartclk = 3686400, /* Twice the usual clk! */ 53 .uartclk = 3686400, /* Twice the usual clk! */
53 .iotype = UPIO_MEM32, 54 .iotype = UPIO_MEM32,
54 .flags = CBUS_UART_FLAGS, 55 .flags = CBUS_UART_FLAGS,
diff --git a/arch/mips/oprofile/Makefile b/arch/mips/oprofile/Makefile
index 65f5237ec821..9c0a6782c091 100644
--- a/arch/mips/oprofile/Makefile
+++ b/arch/mips/oprofile/Makefile
@@ -13,5 +13,4 @@ oprofile-$(CONFIG_CPU_MIPS64) += op_model_mipsxx.o
13oprofile-$(CONFIG_CPU_R10000) += op_model_mipsxx.o 13oprofile-$(CONFIG_CPU_R10000) += op_model_mipsxx.o
14oprofile-$(CONFIG_CPU_SB1) += op_model_mipsxx.o 14oprofile-$(CONFIG_CPU_SB1) += op_model_mipsxx.o
15oprofile-$(CONFIG_CPU_XLR) += op_model_mipsxx.o 15oprofile-$(CONFIG_CPU_XLR) += op_model_mipsxx.o
16oprofile-$(CONFIG_CPU_RM9000) += op_model_rm9000.o
17oprofile-$(CONFIG_CPU_LOONGSON2) += op_model_loongson2.o 16oprofile-$(CONFIG_CPU_LOONGSON2) += op_model_loongson2.o
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index abd5a02f47cf..e32db1ff02c7 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -16,7 +16,6 @@
16#include "op_impl.h" 16#include "op_impl.h"
17 17
18extern struct op_mips_model op_model_mipsxx_ops __weak; 18extern struct op_mips_model op_model_mipsxx_ops __weak;
19extern struct op_mips_model op_model_rm9000_ops __weak;
20extern struct op_mips_model op_model_loongson2_ops __weak; 19extern struct op_mips_model op_model_loongson2_ops __weak;
21 20
22static struct op_mips_model *model; 21static struct op_mips_model *model;
@@ -95,9 +94,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
95 lmodel = &op_model_mipsxx_ops; 94 lmodel = &op_model_mipsxx_ops;
96 break; 95 break;
97 96
98 case CPU_RM9000:
99 lmodel = &op_model_rm9000_ops;
100 break;
101 case CPU_LOONGSON2: 97 case CPU_LOONGSON2:
102 lmodel = &op_model_loongson2_ops; 98 lmodel = &op_model_loongson2_ops;
103 break; 99 break;
diff --git a/arch/mips/oprofile/op_model_rm9000.c b/arch/mips/oprofile/op_model_rm9000.c
deleted file mode 100644
index 3aa81384966d..000000000000
--- a/arch/mips/oprofile/op_model_rm9000.c
+++ /dev/null
@@ -1,138 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 by Ralf Baechle
7 */
8#include <linux/init.h>
9#include <linux/oprofile.h>
10#include <linux/interrupt.h>
11#include <linux/smp.h>
12
13#include "op_impl.h"
14
15#define RM9K_COUNTER1_EVENT(event) ((event) << 0)
16#define RM9K_COUNTER1_SUPERVISOR (1ULL << 7)
17#define RM9K_COUNTER1_KERNEL (1ULL << 8)
18#define RM9K_COUNTER1_USER (1ULL << 9)
19#define RM9K_COUNTER1_ENABLE (1ULL << 10)
20#define RM9K_COUNTER1_OVERFLOW (1ULL << 15)
21
22#define RM9K_COUNTER2_EVENT(event) ((event) << 16)
23#define RM9K_COUNTER2_SUPERVISOR (1ULL << 23)
24#define RM9K_COUNTER2_KERNEL (1ULL << 24)
25#define RM9K_COUNTER2_USER (1ULL << 25)
26#define RM9K_COUNTER2_ENABLE (1ULL << 26)
27#define RM9K_COUNTER2_OVERFLOW (1ULL << 31)
28
29extern unsigned int rm9000_perfcount_irq;
30
31static struct rm9k_register_config {
32 unsigned int control;
33 unsigned int reset_counter1;
34 unsigned int reset_counter2;
35} reg;
36
37/* Compute all of the registers in preparation for enabling profiling. */
38
39static void rm9000_reg_setup(struct op_counter_config *ctr)
40{
41 unsigned int control = 0;
42
43 /* Compute the performance counter control word. */
44 /* For now count kernel and user mode */
45 if (ctr[0].enabled)
46 control |= RM9K_COUNTER1_EVENT(ctr[0].event) |
47 RM9K_COUNTER1_KERNEL |
48 RM9K_COUNTER1_USER |
49 RM9K_COUNTER1_ENABLE;
50 if (ctr[1].enabled)
51 control |= RM9K_COUNTER2_EVENT(ctr[1].event) |
52 RM9K_COUNTER2_KERNEL |
53 RM9K_COUNTER2_USER |
54 RM9K_COUNTER2_ENABLE;
55 reg.control = control;
56
57 reg.reset_counter1 = 0x80000000 - ctr[0].count;
58 reg.reset_counter2 = 0x80000000 - ctr[1].count;
59}
60
61/* Program all of the registers in preparation for enabling profiling. */
62
63static void rm9000_cpu_setup(void *args)
64{
65 uint64_t perfcount;
66
67 perfcount = ((uint64_t) reg.reset_counter2 << 32) | reg.reset_counter1;
68 write_c0_perfcount(perfcount);
69}
70
71static void rm9000_cpu_start(void *args)
72{
73 /* Start all counters on current CPU */
74 write_c0_perfcontrol(reg.control);
75}
76
77static void rm9000_cpu_stop(void *args)
78{
79 /* Stop all counters on current CPU */
80 write_c0_perfcontrol(0);
81}
82
83static irqreturn_t rm9000_perfcount_handler(int irq, void *dev_id)
84{
85 unsigned int control = read_c0_perfcontrol();
86 struct pt_regs *regs = get_irq_regs();
87 uint32_t counter1, counter2;
88 uint64_t counters;
89
90 /*
91 * RM9000 combines two 32-bit performance counters into a single
92 * 64-bit coprocessor zero register. To avoid a race updating the
93 * registers we need to stop the counters while we're messing with
94 * them ...
95 */
96 write_c0_perfcontrol(0);
97
98 counters = read_c0_perfcount();
99 counter1 = counters;
100 counter2 = counters >> 32;
101
102 if (control & RM9K_COUNTER1_OVERFLOW) {
103 oprofile_add_sample(regs, 0);
104 counter1 = reg.reset_counter1;
105 }
106 if (control & RM9K_COUNTER2_OVERFLOW) {
107 oprofile_add_sample(regs, 1);
108 counter2 = reg.reset_counter2;
109 }
110
111 counters = ((uint64_t)counter2 << 32) | counter1;
112 write_c0_perfcount(counters);
113 write_c0_perfcontrol(reg.control);
114
115 return IRQ_HANDLED;
116}
117
118static int __init rm9000_init(void)
119{
120 return request_irq(rm9000_perfcount_irq, rm9000_perfcount_handler,
121 0, "Perfcounter", NULL);
122}
123
124static void rm9000_exit(void)
125{
126 free_irq(rm9000_perfcount_irq, NULL);
127}
128
129struct op_mips_model op_model_rm9000_ops = {
130 .reg_setup = rm9000_reg_setup,
131 .cpu_setup = rm9000_cpu_setup,
132 .init = rm9000_init,
133 .exit = rm9000_exit,
134 .cpu_start = rm9000_cpu_start,
135 .cpu_stop = rm9000_cpu_stop,
136 .cpu_type = "mips/rm9000",
137 .num_counters = 2
138};
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index e13a71cbc3c7..ce995d3d9440 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -34,8 +34,6 @@ obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o
34obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o 34obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o
35obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o 35obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o
36obj-$(CONFIG_PMC_MSP7120_FPGA) += fixup-pmcmsp.o ops-pmcmsp.o 36obj-$(CONFIG_PMC_MSP7120_FPGA) += fixup-pmcmsp.o ops-pmcmsp.o
37obj-$(CONFIG_PMC_YOSEMITE) += fixup-yosemite.o ops-titan.o ops-titan-ht.o \
38 pci-yosemite.o
39obj-$(CONFIG_SGI_IP27) += ops-bridge.o pci-ip27.o 37obj-$(CONFIG_SGI_IP27) += ops-bridge.o pci-ip27.o
40obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o 38obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o
41obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o 39obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o
diff --git a/arch/mips/pci/fixup-yosemite.c b/arch/mips/pci/fixup-yosemite.c
deleted file mode 100644
index fdafb13a793b..000000000000
--- a/arch/mips/pci/fixup-yosemite.c
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/pci.h>
28
29int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
30{
31 if (pin == 0)
32 return -1;
33
34 return 3; /* Everything goes to one irq bit */
35}
36
37/* Do platform specific device initialization at pci_enable_device() time */
38int pcibios_plat_dev_init(struct pci_dev *dev)
39{
40 return 0;
41}
diff --git a/arch/mips/pci/ops-bridge.c b/arch/mips/pci/ops-bridge.c
index b46b3e211775..438319465cb4 100644
--- a/arch/mips/pci/ops-bridge.c
+++ b/arch/mips/pci/ops-bridge.c
@@ -56,7 +56,7 @@ static int pci_conf0_read_config(struct pci_bus *bus, unsigned int devfn,
56 return PCIBIOS_DEVICE_NOT_FOUND; 56 return PCIBIOS_DEVICE_NOT_FOUND;
57 57
58 /* 58 /*
59 * IOC3 is fucked fucked beyond believe ... Don't even give the 59 * IOC3 is fucking fucked beyond belief ... Don't even give the
60 * generic PCI code a chance to look at it for real ... 60 * generic PCI code a chance to look at it for real ...
61 */ 61 */
62 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) 62 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
@@ -76,7 +76,7 @@ static int pci_conf0_read_config(struct pci_bus *bus, unsigned int devfn,
76oh_my_gawd: 76oh_my_gawd:
77 77
78 /* 78 /*
79 * IOC3 is fucked fucked beyond believe ... Don't even give the 79 * IOC3 is fucking fucked beyond belief ... Don't even give the
80 * generic PCI code a chance to look at the wrong register. 80 * generic PCI code a chance to look at the wrong register.
81 */ 81 */
82 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) { 82 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
@@ -85,7 +85,7 @@ oh_my_gawd:
85 } 85 }
86 86
87 /* 87 /*
88 * IOC3 is fucked fucked beyond believe ... Don't try to access 88 * IOC3 is fucking fucked beyond belief ... Don't try to access
89 * anything but 32-bit words ... 89 * anything but 32-bit words ...
90 */ 90 */
91 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2]; 91 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
@@ -118,7 +118,7 @@ static int pci_conf1_read_config(struct pci_bus *bus, unsigned int devfn,
118 return PCIBIOS_DEVICE_NOT_FOUND; 118 return PCIBIOS_DEVICE_NOT_FOUND;
119 119
120 /* 120 /*
121 * IOC3 is fucked fucked beyond believe ... Don't even give the 121 * IOC3 is fucking fucked beyond belief ... Don't even give the
122 * generic PCI code a chance to look at it for real ... 122 * generic PCI code a chance to look at it for real ...
123 */ 123 */
124 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) 124 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
@@ -139,7 +139,7 @@ static int pci_conf1_read_config(struct pci_bus *bus, unsigned int devfn,
139oh_my_gawd: 139oh_my_gawd:
140 140
141 /* 141 /*
142 * IOC3 is fucked fucked beyond believe ... Don't even give the 142 * IOC3 is fucking fucked beyond belief ... Don't even give the
143 * generic PCI code a chance to look at the wrong register. 143 * generic PCI code a chance to look at the wrong register.
144 */ 144 */
145 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) { 145 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
@@ -148,7 +148,7 @@ oh_my_gawd:
148 } 148 }
149 149
150 /* 150 /*
151 * IOC3 is fucked fucked beyond believe ... Don't try to access 151 * IOC3 is fucking fucked beyond belief ... Don't try to access
152 * anything but 32-bit words ... 152 * anything but 32-bit words ...
153 */ 153 */
154 bridge->b_pci_cfg = (busno << 16) | (slot << 11); 154 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
@@ -189,7 +189,7 @@ static int pci_conf0_write_config(struct pci_bus *bus, unsigned int devfn,
189 return PCIBIOS_DEVICE_NOT_FOUND; 189 return PCIBIOS_DEVICE_NOT_FOUND;
190 190
191 /* 191 /*
192 * IOC3 is fucked fucked beyond believe ... Don't even give the 192 * IOC3 is fucking fucked beyond belief ... Don't even give the
193 * generic PCI code a chance to look at it for real ... 193 * generic PCI code a chance to look at it for real ...
194 */ 194 */
195 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) 195 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
@@ -213,14 +213,14 @@ static int pci_conf0_write_config(struct pci_bus *bus, unsigned int devfn,
213oh_my_gawd: 213oh_my_gawd:
214 214
215 /* 215 /*
216 * IOC3 is fucked fucked beyond believe ... Don't even give the 216 * IOC3 is fucking fucked beyond belief ... Don't even give the
217 * generic PCI code a chance to touch the wrong register. 217 * generic PCI code a chance to touch the wrong register.
218 */ 218 */
219 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) 219 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
220 return PCIBIOS_SUCCESSFUL; 220 return PCIBIOS_SUCCESSFUL;
221 221
222 /* 222 /*
223 * IOC3 is fucked fucked beyond believe ... Don't try to access 223 * IOC3 is fucking fucked beyond belief ... Don't try to access
224 * anything but 32-bit words ... 224 * anything but 32-bit words ...
225 */ 225 */
226 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2]; 226 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
@@ -257,7 +257,7 @@ static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
257 return PCIBIOS_DEVICE_NOT_FOUND; 257 return PCIBIOS_DEVICE_NOT_FOUND;
258 258
259 /* 259 /*
260 * IOC3 is fucked fucked beyond believe ... Don't even give the 260 * IOC3 is fucking fucked beyond belief ... Don't even give the
261 * generic PCI code a chance to look at it for real ... 261 * generic PCI code a chance to look at it for real ...
262 */ 262 */
263 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) 263 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
@@ -281,14 +281,14 @@ static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
281oh_my_gawd: 281oh_my_gawd:
282 282
283 /* 283 /*
284 * IOC3 is fucked fucked beyond believe ... Don't even give the 284 * IOC3 is fucking fucked beyond belief ... Don't even give the
285 * generic PCI code a chance to touch the wrong register. 285 * generic PCI code a chance to touch the wrong register.
286 */ 286 */
287 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) 287 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
288 return PCIBIOS_SUCCESSFUL; 288 return PCIBIOS_SUCCESSFUL;
289 289
290 /* 290 /*
291 * IOC3 is fucked fucked beyond believe ... Don't try to access 291 * IOC3 is fucking fucked beyond belief ... Don't try to access
292 * anything but 32-bit words ... 292 * anything but 32-bit words ...
293 */ 293 */
294 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2]; 294 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
diff --git a/arch/mips/pci/ops-titan-ht.c b/arch/mips/pci/ops-titan-ht.c
deleted file mode 100644
index 57d54adc9e20..000000000000
--- a/arch/mips/pci/ops-titan-ht.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <linux/types.h>
27#include <linux/pci.h>
28#include <linux/kernel.h>
29#include <linux/delay.h>
30#include <asm/io.h>
31
32#include <asm/titan_dep.h>
33
34static int titan_ht_config_read_dword(struct pci_bus *bus, unsigned int devfn,
35 int offset, u32 *val)
36{
37 volatile uint32_t address;
38 int busno;
39
40 busno = bus->number;
41
42 address = (busno << 16) | (devfn << 8) | (offset & 0xfc) | 0x80000000;
43 if (busno != 0)
44 address |= 1;
45
46 /*
47 * RM9000 HT Errata: Issue back to back HT config
48 * transcations. Issue a BIU sync before and
49 * after the HT cycle
50 */
51
52 *(volatile int32_t *) 0xfb0000f0 |= 0x2;
53
54 udelay(30);
55
56 *(volatile int32_t *) 0xfb0006f8 = address;
57 *(val) = *(volatile int32_t *) 0xfb0006fc;
58
59 udelay(30);
60
61 * (volatile int32_t *) 0xfb0000f0 |= 0x2;
62
63 return PCIBIOS_SUCCESSFUL;
64}
65
66static int titan_ht_config_read(struct pci_bus *bus, unsigned int devfn,
67 int offset, int size, u32 *val)
68{
69 uint32_t dword;
70
71 titan_ht_config_read_dword(bus, devfn, offset, &dword);
72
73 dword >>= ((offset & 3) << 3);
74 dword &= (0xffffffffU >> ((4 - size) << 8));
75
76 return PCIBIOS_SUCCESSFUL;
77}
78
79static inline int titan_ht_config_write_dword(struct pci_bus *bus,
80 unsigned int devfn, int offset, u32 val)
81{
82 volatile uint32_t address;
83 int busno;
84
85 busno = bus->number;
86
87 address = (busno << 16) | (devfn << 8) | (offset & 0xfc) | 0x80000000;
88 if (busno != 0)
89 address |= 1;
90
91 *(volatile int32_t *) 0xfb0000f0 |= 0x2;
92
93 udelay(30);
94
95 *(volatile int32_t *) 0xfb0006f8 = address;
96 *(volatile int32_t *) 0xfb0006fc = val;
97
98 udelay(30);
99
100 *(volatile int32_t *) 0xfb0000f0 |= 0x2;
101
102 return PCIBIOS_SUCCESSFUL;
103}
104
105static int titan_ht_config_write(struct pci_bus *bus, unsigned int devfn,
106 int offset, int size, u32 val)
107{
108 uint32_t val1, val2, mask;
109
110 titan_ht_config_read_dword(bus, devfn, offset, &val2);
111
112 val1 = val << ((offset & 3) << 3);
113 mask = ~(0xffffffffU >> ((4 - size) << 8));
114 val2 &= ~(mask << ((offset & 3) << 8));
115
116 titan_ht_config_write_dword(bus, devfn, offset, val1 | val2);
117
118 return PCIBIOS_SUCCESSFUL;
119}
120
121struct pci_ops titan_ht_pci_ops = {
122 .read = titan_ht_config_read,
123 .write = titan_ht_config_write,
124};
diff --git a/arch/mips/pci/ops-titan.c b/arch/mips/pci/ops-titan.c
deleted file mode 100644
index ebf8fc40e9b2..000000000000
--- a/arch/mips/pci/ops-titan.c
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25#include <linux/types.h>
26#include <linux/pci.h>
27#include <linux/kernel.h>
28
29#include <asm/pci.h>
30#include <asm/io.h>
31#include <asm/rm9k-ocd.h>
32
33/*
34 * PCI specific defines
35 */
36#define TITAN_PCI_0_CONFIG_ADDRESS 0x780
37#define TITAN_PCI_0_CONFIG_DATA 0x784
38
39/*
40 * Titan PCI Config Read Byte
41 */
42static int titan_read_config(struct pci_bus *bus, unsigned int devfn, int reg,
43 int size, u32 * val)
44{
45 uint32_t address, tmp;
46 int dev, busno, func;
47
48 busno = bus->number;
49 dev = PCI_SLOT(devfn);
50 func = PCI_FUNC(devfn);
51
52 address = (busno << 16) | (dev << 11) | (func << 8) |
53 (reg & 0xfc) | 0x80000000;
54
55
56 /* start the configuration cycle */
57 ocd_writel(address, TITAN_PCI_0_CONFIG_ADDRESS);
58 tmp = ocd_readl(TITAN_PCI_0_CONFIG_DATA) >> ((reg & 3) << 3);
59
60 switch (size) {
61 case 1:
62 tmp &= 0xff;
63 case 2:
64 tmp &= 0xffff;
65 }
66 *val = tmp;
67
68 return PCIBIOS_SUCCESSFUL;
69}
70
71static int titan_write_config(struct pci_bus *bus, unsigned int devfn, int reg,
72 int size, u32 val)
73{
74 uint32_t address;
75 int dev, busno, func;
76
77 busno = bus->number;
78 dev = PCI_SLOT(devfn);
79 func = PCI_FUNC(devfn);
80
81 address = (busno << 16) | (dev << 11) | (func << 8) |
82 (reg & 0xfc) | 0x80000000;
83
84 /* start the configuration cycle */
85 ocd_writel(address, TITAN_PCI_0_CONFIG_ADDRESS);
86
87 /* write the data */
88 switch (size) {
89 case 1:
90 ocd_writeb(val, TITAN_PCI_0_CONFIG_DATA + (~reg & 0x3));
91 break;
92
93 case 2:
94 ocd_writew(val, TITAN_PCI_0_CONFIG_DATA + (~reg & 0x2));
95 break;
96
97 case 4:
98 ocd_writel(val, TITAN_PCI_0_CONFIG_DATA);
99 break;
100 }
101
102 return PCIBIOS_SUCCESSFUL;
103}
104
105/*
106 * Titan PCI structure
107 */
108struct pci_ops titan_pci_ops = {
109 titan_read_config,
110 titan_write_config,
111};
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c
index 4b0c347d7a82..5b5ed76c6f47 100644
--- a/arch/mips/pci/pci-octeon.c
+++ b/arch/mips/pci/pci-octeon.c
@@ -11,6 +11,7 @@
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/platform_device.h>
14#include <linux/swiotlb.h> 15#include <linux/swiotlb.h>
15 16
16#include <asm/time.h> 17#include <asm/time.h>
@@ -704,6 +705,10 @@ static int __init octeon_pci_setup(void)
704 */ 705 */
705 cvmx_write_csr(CVMX_NPI_PCI_INT_SUM2, -1); 706 cvmx_write_csr(CVMX_NPI_PCI_INT_SUM2, -1);
706 707
708 if (IS_ERR(platform_device_register_simple("octeon_pci_edac",
709 -1, NULL, 0)))
710 pr_err("Registation of co_pci_edac failed!\n");
711
707 octeon_pci_dma_init(); 712 octeon_pci_dma_init();
708 713
709 return 0; 714 return 0;
diff --git a/arch/mips/pci/pci-yosemite.c b/arch/mips/pci/pci-yosemite.c
deleted file mode 100644
index cf5e1a25cb7d..000000000000
--- a/arch/mips/pci/pci-yosemite.c
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/pci.h>
12#include <asm/titan_dep.h>
13
14extern struct pci_ops titan_pci_ops;
15
16static struct resource py_mem_resource = {
17 .start = 0xe0000000UL,
18 .end = 0xe3ffffffUL,
19 .name = "Titan PCI MEM",
20 .flags = IORESOURCE_MEM
21};
22
23/*
24 * PMON really reserves 16MB of I/O port space but that's stupid, nothing
25 * needs that much since allocations are limited to 256 bytes per device
26 * anyway. So we just claim 64kB here.
27 */
28#define TITAN_IO_SIZE 0x0000ffffUL
29#define TITAN_IO_BASE 0xe8000000UL
30
31static struct resource py_io_resource = {
32 .start = 0x00001000UL,
33 .end = TITAN_IO_SIZE - 1,
34 .name = "Titan IO MEM",
35 .flags = IORESOURCE_IO,
36};
37
38static struct pci_controller py_controller = {
39 .pci_ops = &titan_pci_ops,
40 .mem_resource = &py_mem_resource,
41 .mem_offset = 0x00000000UL,
42 .io_resource = &py_io_resource,
43 .io_offset = 0x00000000UL
44};
45
46static char ioremap_failed[] __initdata = "Could not ioremap I/O port range";
47
48static int __init pmc_yosemite_setup(void)
49{
50 unsigned long io_v_base;
51
52 io_v_base = (unsigned long) ioremap(TITAN_IO_BASE, TITAN_IO_SIZE);
53 if (!io_v_base)
54 panic(ioremap_failed);
55
56 set_io_port_base(io_v_base);
57 py_controller.io_map_base = io_v_base;
58 TITAN_WRITE(RM9000x2_OCD_LKM7, TITAN_READ(RM9000x2_OCD_LKM7) | 1);
59
60 ioport_resource.end = TITAN_IO_SIZE - 1;
61
62 register_pci_controller(&py_controller);
63
64 return 0;
65}
66
67arch_initcall(pmc_yosemite_setup);
diff --git a/arch/mips/pmc-sierra/Kconfig b/arch/mips/pmc-sierra/Kconfig
index bbd76082fa8c..3482b8c8640c 100644
--- a/arch/mips/pmc-sierra/Kconfig
+++ b/arch/mips/pmc-sierra/Kconfig
@@ -34,10 +34,6 @@ config PMC_MSP7120_FPGA
34 34
35endchoice 35endchoice
36 36
37config HYPERTRANSPORT
38 bool "Hypertransport Support for PMC-Sierra Yosemite"
39 depends on PMC_YOSEMITE
40
41config MSP_HAS_USB 37config MSP_HAS_USB
42 boolean 38 boolean
43 depends on PMC_MSP 39 depends on PMC_MSP
diff --git a/arch/mips/pmc-sierra/Platform b/arch/mips/pmc-sierra/Platform
index f092f2524c5f..387fda6c28c6 100644
--- a/arch/mips/pmc-sierra/Platform
+++ b/arch/mips/pmc-sierra/Platform
@@ -5,10 +5,3 @@ platform-$(CONFIG_PMC_MSP) += pmc-sierra/msp71xx/
5cflags-$(CONFIG_PMC_MSP) += -I$(srctree)/arch/mips/include/asm/pmc-sierra/msp71xx \ 5cflags-$(CONFIG_PMC_MSP) += -I$(srctree)/arch/mips/include/asm/pmc-sierra/msp71xx \
6 -mno-branch-likely 6 -mno-branch-likely
7load-$(CONFIG_PMC_MSP) += 0xffffffff80100000 7load-$(CONFIG_PMC_MSP) += 0xffffffff80100000
8
9#
10# PMC-Sierra Yosemite
11#
12platform-$(CONFIG_PMC_YOSEMITE) += pmc-sierra/yosemite/
13cflags-$(CONFIG_PMC_YOSEMITE) += -I$(srctree)/arch/mips/include/asm/mach-yosemite
14load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000
diff --git a/arch/mips/pmc-sierra/yosemite/Makefile b/arch/mips/pmc-sierra/yosemite/Makefile
deleted file mode 100644
index 5af95ec3319d..000000000000
--- a/arch/mips/pmc-sierra/yosemite/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Makefile for the PMC-Sierra Titan
3#
4
5obj-y += irq.o prom.o py-console.o setup.o
6
7obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
deleted file mode 100644
index d6f8bdff8cbb..000000000000
--- a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 * Copyright (C) 2003 PMC-Sierra Inc.
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26/*
27 * Description:
28 *
29 * This code reads the ATMEL 24CXX EEPROM. The PMC-Sierra Yosemite board uses the ATMEL
30 * 24C32/24C64 which uses two byte addressing as compared to 24C16. Note that this program
31 * uses the serial port like /dev/ttyS0, to communicate with the EEPROM. Hence, you are
32 * expected to have a connectivity from the EEPROM to the serial port. This program does
33 * __not__ communicate using the I2C protocol
34 */
35
36#include "atmel_read_eeprom.h"
37
38static void delay(int delay)
39{
40 while (delay--);
41}
42
43static void send_bit(unsigned char bit)
44{
45 scl_lo;
46 delay(TXX);
47 if (bit)
48 sda_hi;
49 else
50 sda_lo;
51
52 delay(TXX);
53 scl_hi;
54 delay(TXX);
55}
56
57static void send_ack(void)
58{
59 send_bit(0);
60}
61
62static void send_byte(unsigned char byte)
63{
64 int i = 0;
65
66 for (i = 7; i >= 0; i--)
67 send_bit((byte >> i) & 0x01);
68}
69
70static void send_start(void)
71{
72 sda_hi;
73 delay(TXX);
74 scl_hi;
75 delay(TXX);
76 sda_lo;
77 delay(TXX);
78}
79
80static void send_stop(void)
81{
82 sda_lo;
83 delay(TXX);
84 scl_hi;
85 delay(TXX);
86 sda_hi;
87 delay(TXX);
88}
89
90static void do_idle(void)
91{
92 sda_hi;
93 scl_hi;
94 vcc_off;
95}
96
97static int recv_bit(void)
98{
99 int status;
100
101 scl_lo;
102 delay(TXX);
103 sda_hi;
104 delay(TXX);
105 scl_hi;
106 delay(TXX);
107
108 return 1;
109}
110
111static unsigned char recv_byte(void) {
112 int i;
113 unsigned char byte=0;
114
115 for (i=7;i>=0;i--)
116 byte |= (recv_bit() << i);
117
118 return byte;
119}
120
121static int recv_ack(void)
122{
123 unsigned int ack;
124
125 ack = (unsigned int)recv_bit();
126 scl_lo;
127
128 if (ack) {
129 do_idle();
130 printk(KERN_ERR "Error reading the Atmel 24C32/24C64 EEPROM\n");
131 return -1;
132 }
133
134 return ack;
135}
136
137/*
138 * This function does the actual read of the EEPROM. It needs the buffer into which the
139 * read data is copied, the size of the EEPROM being read and the buffer size
140 */
141int read_eeprom(char *buffer, int eeprom_size, int size)
142{
143 int i = 0, err;
144
145 send_start();
146 send_byte(W_HEADER);
147 recv_ack();
148
149 /* EEPROM with size of more than 2K need two byte addressing */
150 if (eeprom_size > 2048) {
151 send_byte(0x00);
152 recv_ack();
153 }
154
155 send_start();
156 send_byte(R_HEADER);
157 err = recv_ack();
158 if (err == -1)
159 return err;
160
161 for (i = 0; i < size; i++) {
162 *buffer++ = recv_byte();
163 send_ack();
164 }
165
166 /* Note : We should do some check if the buffer contains correct information */
167
168 send_stop();
169}
diff --git a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h
deleted file mode 100644
index d6c7ec469fa8..000000000000
--- a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
3 *
4 * Copyright (C) 2003 PMC-Sierra Inc.
5 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
6 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29/*
30 * Header file for atmel_read_eeprom.c
31 */
32
33#include <linux/types.h>
34#include <linux/pci.h>
35#include <linux/kernel.h>
36#include <linux/slab.h>
37#include <asm/pci.h>
38#include <asm/io.h>
39#include <linux/init.h>
40#include <asm/termios.h>
41#include <asm/ioctls.h>
42#include <linux/ioctl.h>
43#include <linux/fcntl.h>
44
45#define DEFAULT_PORT "/dev/ttyS0" /* Port to open */
46#define TXX 0 /* Dummy loop for spinning */
47
48#define BLOCK_SEL 0x00
49#define SLAVE_ADDR 0xa0
50#define READ_BIT 0x01
51#define WRITE_BIT 0x00
52#define R_HEADER SLAVE_ADDR + BLOCK_SEL + READ_BIT
53#define W_HEADER SLAVE_ADDR + BLOCK_SEL + WRITE_BIT
54
55/*
56 * Clock, Voltages and Data
57 */
58#define vcc_off (ioctl(fd, TIOCSBRK, 0))
59#define vcc_on (ioctl(fd, TIOCCBRK, 0))
60#define sda_hi (ioctl(fd, TIOCMBIS, &dtr))
61#define sda_lo (ioctl(fd, TIOCMBIC, &dtr))
62#define scl_lo (ioctl(fd, TIOCMBIC, &rts))
63#define scl_hi (ioctl(fd, TIOCMBIS, &rts))
64
65const char rts = TIOCM_RTS;
66const char dtr = TIOCM_DTR;
67int fd;
diff --git a/arch/mips/pmc-sierra/yosemite/ht-irq.c b/arch/mips/pmc-sierra/yosemite/ht-irq.c
deleted file mode 100644
index 62ead6601c69..000000000000
--- a/arch/mips/pmc-sierra/yosemite/ht-irq.c
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <linux/types.h>
27#include <linux/pci.h>
28#include <linux/kernel.h>
29#include <linux/init.h>
30#include <asm/pci.h>
31
32/*
33 * HT Bus fixup for the Titan
34 * XXX IRQ values need to change based on the board layout
35 */
36void __init titan_ht_pcibios_fixup_bus(struct pci_bus *bus)
37{
38 /*
39 * PLX and SPKT related changes go here
40 */
41}
diff --git a/arch/mips/pmc-sierra/yosemite/ht.c b/arch/mips/pmc-sierra/yosemite/ht.c
deleted file mode 100644
index 14dc9c8fff0e..000000000000
--- a/arch/mips/pmc-sierra/yosemite/ht.c
+++ /dev/null
@@ -1,404 +0,0 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <linux/types.h>
27#include <linux/pci.h>
28#include <linux/kernel.h>
29#include <asm/pci.h>
30#include <asm/io.h>
31
32#include <linux/init.h>
33#include <asm/titan_dep.h>
34
35#ifdef CONFIG_HYPERTRANSPORT
36
37
38/*
39 * This function check if the Hypertransport Link Initialization completed. If
40 * it did, then proceed further with scanning bus #2
41 */
42static __inline__ int check_titan_htlink(void)
43{
44 u32 val;
45
46 val = *(volatile uint32_t *)(RM9000x2_HTLINK_REG);
47 if (val & 0x00000020)
48 /* HT Link Initialization completed */
49 return 1;
50 else
51 return 0;
52}
53
54static int titan_ht_config_read_dword(struct pci_dev *device,
55 int offset, u32* val)
56{
57 int dev, bus, func;
58 uint32_t address_reg, data_reg;
59 uint32_t address;
60
61 bus = device->bus->number;
62 dev = PCI_SLOT(device->devfn);
63 func = PCI_FUNC(device->devfn);
64
65 /* XXX Need to change the Bus # */
66 if (bus > 2)
67 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
68 0x80000000 | 0x1;
69 else
70 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
71
72 address_reg = RM9000x2_OCD_HTCFGA;
73 data_reg = RM9000x2_OCD_HTCFGD;
74
75 RM9K_WRITE(address_reg, address);
76 RM9K_READ(data_reg, val);
77
78 return PCIBIOS_SUCCESSFUL;
79}
80
81
82static int titan_ht_config_read_word(struct pci_dev *device,
83 int offset, u16* val)
84{
85 int dev, bus, func;
86 uint32_t address_reg, data_reg;
87 uint32_t address;
88
89 bus = device->bus->number;
90 dev = PCI_SLOT(device->devfn);
91 func = PCI_FUNC(device->devfn);
92
93 /* XXX Need to change the Bus # */
94 if (bus > 2)
95 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
96 0x80000000 | 0x1;
97 else
98 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
99
100 address_reg = RM9000x2_OCD_HTCFGA;
101 data_reg = RM9000x2_OCD_HTCFGD;
102
103 if ((offset & 0x3) == 0)
104 offset = 0x2;
105 else
106 offset = 0x0;
107
108 RM9K_WRITE(address_reg, address);
109 RM9K_READ_16(data_reg + offset, val);
110
111 return PCIBIOS_SUCCESSFUL;
112}
113
114
115u32 longswap(unsigned long l)
116{
117 unsigned char b1, b2, b3, b4;
118
119 b1 = l&255;
120 b2 = (l>>8)&255;
121 b3 = (l>>16)&255;
122 b4 = (l>>24)&255;
123
124 return ((b1<<24) + (b2<<16) + (b3<<8) + b4);
125}
126
127
128static int titan_ht_config_read_byte(struct pci_dev *device,
129 int offset, u8* val)
130{
131 int dev, bus, func;
132 uint32_t address_reg, data_reg;
133 uint32_t address;
134 int offset1;
135
136 bus = device->bus->number;
137 dev = PCI_SLOT(device->devfn);
138 func = PCI_FUNC(device->devfn);
139
140 /* XXX Need to change the Bus # */
141 if (bus > 2)
142 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
143 0x80000000 | 0x1;
144 else
145 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
146
147 address_reg = RM9000x2_OCD_HTCFGA;
148 data_reg = RM9000x2_OCD_HTCFGD;
149
150 RM9K_WRITE(address_reg, address);
151
152 if ((offset & 0x3) == 0) {
153 offset1 = 0x3;
154 }
155 if ((offset & 0x3) == 1) {
156 offset1 = 0x2;
157 }
158 if ((offset & 0x3) == 2) {
159 offset1 = 0x1;
160 }
161 if ((offset & 0x3) == 3) {
162 offset1 = 0x0;
163 }
164 RM9K_READ_8(data_reg + offset1, val);
165
166 return PCIBIOS_SUCCESSFUL;
167}
168
169
170static int titan_ht_config_write_dword(struct pci_dev *device,
171 int offset, u8 val)
172{
173 int dev, bus, func;
174 uint32_t address_reg, data_reg;
175 uint32_t address;
176
177 bus = device->bus->number;
178 dev = PCI_SLOT(device->devfn);
179 func = PCI_FUNC(device->devfn);
180
181 /* XXX Need to change the Bus # */
182 if (bus > 2)
183 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
184 0x80000000 | 0x1;
185 else
186 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
187
188 address_reg = RM9000x2_OCD_HTCFGA;
189 data_reg = RM9000x2_OCD_HTCFGD;
190
191 RM9K_WRITE(address_reg, address);
192 RM9K_WRITE(data_reg, val);
193
194 return PCIBIOS_SUCCESSFUL;
195}
196
197static int titan_ht_config_write_word(struct pci_dev *device,
198 int offset, u8 val)
199{
200 int dev, bus, func;
201 uint32_t address_reg, data_reg;
202 uint32_t address;
203
204 bus = device->bus->number;
205 dev = PCI_SLOT(device->devfn);
206 func = PCI_FUNC(device->devfn);
207
208 /* XXX Need to change the Bus # */
209 if (bus > 2)
210 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
211 0x80000000 | 0x1;
212 else
213 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
214
215 address_reg = RM9000x2_OCD_HTCFGA;
216 data_reg = RM9000x2_OCD_HTCFGD;
217
218 if ((offset & 0x3) == 0)
219 offset = 0x2;
220 else
221 offset = 0x0;
222
223 RM9K_WRITE(address_reg, address);
224 RM9K_WRITE_16(data_reg + offset, val);
225
226 return PCIBIOS_SUCCESSFUL;
227}
228
229static int titan_ht_config_write_byte(struct pci_dev *device,
230 int offset, u8 val)
231{
232 int dev, bus, func;
233 uint32_t address_reg, data_reg;
234 uint32_t address;
235 int offset1;
236
237 bus = device->bus->number;
238 dev = PCI_SLOT(device->devfn);
239 func = PCI_FUNC(device->devfn);
240
241 /* XXX Need to change the Bus # */
242 if (bus > 2)
243 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
244 0x80000000 | 0x1;
245 else
246 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
247
248 address_reg = RM9000x2_OCD_HTCFGA;
249 data_reg = RM9000x2_OCD_HTCFGD;
250
251 RM9K_WRITE(address_reg, address);
252
253 if ((offset & 0x3) == 0) {
254 offset1 = 0x3;
255 }
256 if ((offset & 0x3) == 1) {
257 offset1 = 0x2;
258 }
259 if ((offset & 0x3) == 2) {
260 offset1 = 0x1;
261 }
262 if ((offset & 0x3) == 3) {
263 offset1 = 0x0;
264 }
265
266 RM9K_WRITE_8(data_reg + offset1, val);
267 return PCIBIOS_SUCCESSFUL;
268}
269
270
271static void titan_pcibios_set_master(struct pci_dev *dev)
272{
273 u16 cmd;
274 int bus = dev->bus->number;
275
276 if (check_titan_htlink())
277 titan_ht_config_read_word(dev, PCI_COMMAND, &cmd);
278
279 cmd |= PCI_COMMAND_MASTER;
280
281 if (check_titan_htlink())
282 titan_ht_config_write_word(dev, PCI_COMMAND, cmd);
283}
284
285
286int pcibios_enable_resources(struct pci_dev *dev)
287{
288 u16 cmd, old_cmd;
289 u8 tmp1;
290 int idx;
291 struct resource *r;
292 int bus = dev->bus->number;
293
294 if (check_titan_htlink())
295 titan_ht_config_read_word(dev, PCI_COMMAND, &cmd);
296
297 old_cmd = cmd;
298 for (idx = 0; idx < 6; idx++) {
299 r = &dev->resource[idx];
300 if (!r->start && r->end) {
301 printk(KERN_ERR
302 "PCI: Device %s not available because of "
303 "resource collisions\n", pci_name(dev));
304 return -EINVAL;
305 }
306 if (r->flags & IORESOURCE_IO)
307 cmd |= PCI_COMMAND_IO;
308 if (r->flags & IORESOURCE_MEM)
309 cmd |= PCI_COMMAND_MEMORY;
310 }
311 if (cmd != old_cmd) {
312 if (check_titan_htlink())
313 titan_ht_config_write_word(dev, PCI_COMMAND, cmd);
314 }
315
316 if (check_titan_htlink())
317 titan_ht_config_read_byte(dev, PCI_CACHE_LINE_SIZE, &tmp1);
318
319 if (tmp1 != 8) {
320 printk(KERN_WARNING "PCI setting cache line size to 8 from "
321 "%d\n", tmp1);
322 }
323
324 if (check_titan_htlink())
325 titan_ht_config_write_byte(dev, PCI_CACHE_LINE_SIZE, 8);
326
327 if (check_titan_htlink())
328 titan_ht_config_read_byte(dev, PCI_LATENCY_TIMER, &tmp1);
329
330 if (tmp1 < 32 || tmp1 == 0xff) {
331 printk(KERN_WARNING "PCI setting latency timer to 32 from %d\n",
332 tmp1);
333 }
334
335 if (check_titan_htlink())
336 titan_ht_config_write_byte(dev, PCI_LATENCY_TIMER, 32);
337
338 return 0;
339}
340
341
342int pcibios_enable_device(struct pci_dev *dev, int mask)
343{
344 return pcibios_enable_resources(dev);
345}
346
347resource_size_t pcibios_align_resource(void *data, const struct resource *res,
348 resource_size_t size, resource_size_t align)
349{
350 struct pci_dev *dev = data;
351 resource_size_t start = res->start;
352
353 if (res->flags & IORESOURCE_IO) {
354 /* We need to avoid collisions with `mirrored' VGA ports
355 and other strange ISA hardware, so we always want the
356 addresses kilobyte aligned. */
357 if (size > 0x100) {
358 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
359 " (%ld bytes)\n", pci_name(dev),
360 dev->resource - res, size);
361 }
362
363 start = (start + 1024 - 1) & ~(1024 - 1);
364 }
365
366 return start;
367}
368
369struct pci_ops titan_pci_ops = {
370 titan_ht_config_read_byte,
371 titan_ht_config_read_word,
372 titan_ht_config_read_dword,
373 titan_ht_config_write_byte,
374 titan_ht_config_write_word,
375 titan_ht_config_write_dword
376};
377
378void __init pcibios_fixup_bus(struct pci_bus *c)
379{
380 titan_ht_pcibios_fixup_bus(c);
381}
382
383void __init pcibios_init(void)
384{
385
386 /* Reset PCI I/O and PCI MEM values */
387 /* XXX Need to add the proper values here */
388 ioport_resource.start = 0xe0000000;
389 ioport_resource.end = 0xe0000000 + 0x20000000 - 1;
390 iomem_resource.start = 0xc0000000;
391 iomem_resource.end = 0xc0000000 + 0x20000000 - 1;
392
393 /* XXX Need to add bus values */
394 pci_scan_bus(2, &titan_pci_ops, NULL);
395 pci_scan_bus(3, &titan_pci_ops, NULL);
396}
397
398unsigned __init int pcibios_assign_all_busses(void)
399{
400 /* We want to use the PCI bus detection done by PMON */
401 return 0;
402}
403
404#endif /* CONFIG_HYPERTRANSPORT */
diff --git a/arch/mips/pmc-sierra/yosemite/irq.c b/arch/mips/pmc-sierra/yosemite/irq.c
deleted file mode 100644
index 6590812daa56..000000000000
--- a/arch/mips/pmc-sierra/yosemite/irq.c
+++ /dev/null
@@ -1,152 +0,0 @@
1/*
2 * Copyright (C) 2003 PMC-Sierra Inc.
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 * Second level Interrupt handlers for the PMC-Sierra Titan/Yosemite board
28 */
29#include <linux/errno.h>
30#include <linux/init.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/irq.h>
39#include <linux/timex.h>
40#include <linux/random.h>
41#include <linux/bitops.h>
42#include <asm/bootinfo.h>
43#include <asm/io.h>
44#include <asm/irq.h>
45#include <asm/irq_cpu.h>
46#include <asm/mipsregs.h>
47#include <asm/titan_dep.h>
48
49/* Hypertransport specific */
50#define IRQ_ACK_BITS 0x00000000 /* Ack bits */
51
52#define HYPERTRANSPORT_INTA 0x78 /* INTA# */
53#define HYPERTRANSPORT_INTB 0x79 /* INTB# */
54#define HYPERTRANSPORT_INTC 0x7a /* INTC# */
55#define HYPERTRANSPORT_INTD 0x7b /* INTD# */
56
57extern void titan_mailbox_irq(void);
58
59#ifdef CONFIG_HYPERTRANSPORT
60/*
61 * Handle hypertransport & SMP interrupts. The interrupt lines are scarce.
62 * For interprocessor interrupts, the best thing to do is to use the INTMSG
63 * register. We use the same external interrupt line, i.e. INTB3 and monitor
64 * another status bit
65 */
66static void ll_ht_smp_irq_handler(int irq)
67{
68 u32 status = OCD_READ(RM9000x2_OCD_INTP0STATUS4);
69
70 /* Ack all the bits that correspond to the interrupt sources */
71 if (status != 0)
72 OCD_WRITE(RM9000x2_OCD_INTP0STATUS4, IRQ_ACK_BITS);
73
74 status = OCD_READ(RM9000x2_OCD_INTP1STATUS4);
75 if (status != 0)
76 OCD_WRITE(RM9000x2_OCD_INTP1STATUS4, IRQ_ACK_BITS);
77
78#ifdef CONFIG_HT_LEVEL_TRIGGER
79 /*
80 * Level Trigger Mode only. Send the HT EOI message back to the source.
81 */
82 switch (status) {
83 case 0x1000000:
84 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA);
85 break;
86 case 0x2000000:
87 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB);
88 break;
89 case 0x4000000:
90 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC);
91 break;
92 case 0x8000000:
93 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD);
94 break;
95 case 0x0000001:
96 /* PLX */
97 OCD_WRITE(RM9000x2_OCD_HTEOI, 0x20);
98 OCD_WRITE(IRQ_CLEAR_REG, IRQ_ACK_BITS);
99 break;
100 case 0xf000000:
101 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA);
102 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB);
103 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC);
104 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD);
105 break;
106 }
107#endif /* CONFIG_HT_LEVEL_TRIGGER */
108
109 do_IRQ(irq);
110}
111#endif
112
113asmlinkage void plat_irq_dispatch(void)
114{
115 unsigned int cause = read_c0_cause();
116 unsigned int status = read_c0_status();
117 unsigned int pending = cause & status;
118
119 if (pending & STATUSF_IP7) {
120 do_IRQ(7);
121 } else if (pending & STATUSF_IP2) {
122#ifdef CONFIG_HYPERTRANSPORT
123 ll_ht_smp_irq_handler(2);
124#else
125 do_IRQ(2);
126#endif
127 } else if (pending & STATUSF_IP3) {
128 do_IRQ(3);
129 } else if (pending & STATUSF_IP4) {
130 do_IRQ(4);
131 } else if (pending & STATUSF_IP5) {
132#ifdef CONFIG_SMP
133 titan_mailbox_irq();
134#else
135 do_IRQ(5);
136#endif
137 } else if (pending & STATUSF_IP6) {
138 do_IRQ(4);
139 }
140}
141
142/*
143 * Initialize the next level interrupt handler
144 */
145void __init arch_init_irq(void)
146{
147 clear_c0_status(ST0_IM);
148
149 mips_cpu_irq_init();
150 rm7k_cpu_irq_init();
151 rm9k_cpu_irq_init();
152}
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c
deleted file mode 100644
index 6a2754c4f106..000000000000
--- a/arch/mips/pmc-sierra/yosemite/prom.c
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * Copyright (C) 2003, 2004 PMC-Sierra Inc.
8 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
9 * Copyright (C) 2004 Ralf Baechle
10 */
11#include <linux/init.h>
12#include <linux/sched.h>
13#include <linux/mm.h>
14#include <linux/delay.h>
15#include <linux/pm.h>
16#include <linux/smp.h>
17
18#include <asm/io.h>
19#include <asm/pgtable.h>
20#include <asm/processor.h>
21#include <asm/reboot.h>
22#include <asm/smp-ops.h>
23#include <asm/bootinfo.h>
24#include <asm/pmon.h>
25
26#ifdef CONFIG_SMP
27extern void prom_grab_secondary(void);
28#else
29#define prom_grab_secondary() do { } while (0)
30#endif
31
32#include "setup.h"
33
34struct callvectors *debug_vectors;
35
36extern unsigned long yosemite_base;
37extern unsigned long cpu_clock_freq;
38
39const char *get_system_type(void)
40{
41 return "PMC-Sierra Yosemite";
42}
43
44static void prom_cpu0_exit(void *arg)
45{
46 void *nvram = (void *) YOSEMITE_RTC_BASE;
47
48 /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
49 writeb(0x84, nvram + 0xff7);
50
51 /* wait for the watchdog to go off */
52 mdelay(100 + (1000 / 16));
53
54 /* if the watchdog fails for some reason, let people know */
55 printk(KERN_NOTICE "Watchdog reset failed\n");
56}
57
58/*
59 * Reset the NVRAM over the local bus
60 */
61static void prom_exit(void)
62{
63#ifdef CONFIG_SMP
64 if (smp_processor_id())
65 /* CPU 1 */
66 smp_call_function(prom_cpu0_exit, NULL, 1);
67#endif
68 prom_cpu0_exit(NULL);
69}
70
71/*
72 * Halt the system
73 */
74static void prom_halt(void)
75{
76 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
77 while (1)
78 __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0");
79}
80
81extern struct plat_smp_ops yos_smp_ops;
82
83/*
84 * Init routine which accepts the variables from PMON
85 */
86void __init prom_init(void)
87{
88 int argc = fw_arg0;
89 char **arg = (char **) fw_arg1;
90 char **env = (char **) fw_arg2;
91 struct callvectors *cv = (struct callvectors *) fw_arg3;
92 int i = 0;
93
94 /* Callbacks for halt, restart */
95 _machine_restart = (void (*)(char *)) prom_exit;
96 _machine_halt = prom_halt;
97 pm_power_off = prom_halt;
98
99 debug_vectors = cv;
100 arcs_cmdline[0] = '\0';
101
102 /* Get the boot parameters */
103 for (i = 1; i < argc; i++) {
104 if (strlen(arcs_cmdline) + strlen(arg[i]) + 1 >=
105 sizeof(arcs_cmdline))
106 break;
107
108 strcat(arcs_cmdline, arg[i]);
109 strcat(arcs_cmdline, " ");
110 }
111
112#ifdef CONFIG_SERIAL_8250_CONSOLE
113 if ((strstr(arcs_cmdline, "console=ttyS")) == NULL)
114 strcat(arcs_cmdline, "console=ttyS0,115200");
115#endif
116
117 while (*env) {
118 if (strncmp("ocd_base", *env, strlen("ocd_base")) == 0)
119 yosemite_base =
120 simple_strtol(*env + strlen("ocd_base="), NULL,
121 16);
122
123 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0)
124 cpu_clock_freq =
125 simple_strtol(*env + strlen("cpuclock="), NULL,
126 10);
127
128 env++;
129 }
130
131 prom_grab_secondary();
132
133 register_smp_ops(&yos_smp_ops);
134}
135
136void __init prom_free_prom_memory(void)
137{
138}
139
140void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
141{
142}
diff --git a/arch/mips/pmc-sierra/yosemite/py-console.c b/arch/mips/pmc-sierra/yosemite/py-console.c
deleted file mode 100644
index b7f1d9c4a8a3..000000000000
--- a/arch/mips/pmc-sierra/yosemite/py-console.c
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2001, 2002, 2004 Ralf Baechle
7 */
8#include <linux/init.h>
9#include <linux/console.h>
10#include <linux/kdev_t.h>
11#include <linux/major.h>
12#include <linux/termios.h>
13#include <linux/sched.h>
14#include <linux/tty.h>
15
16#include <linux/serial.h>
17#include <linux/serial_core.h>
18#include <asm/serial.h>
19#include <asm/io.h>
20
21/* SUPERIO uart register map */
22struct yo_uartregs {
23 union {
24 volatile u8 rbr; /* read only, DLAB == 0 */
25 volatile u8 thr; /* write only, DLAB == 0 */
26 volatile u8 dll; /* DLAB == 1 */
27 } u1;
28 union {
29 volatile u8 ier; /* DLAB == 0 */
30 volatile u8 dlm; /* DLAB == 1 */
31 } u2;
32 union {
33 volatile u8 iir; /* read only */
34 volatile u8 fcr; /* write only */
35 } u3;
36 volatile u8 iu_lcr;
37 volatile u8 iu_mcr;
38 volatile u8 iu_lsr;
39 volatile u8 iu_msr;
40 volatile u8 iu_scr;
41} yo_uregs_t;
42
43#define iu_rbr u1.rbr
44#define iu_thr u1.thr
45#define iu_dll u1.dll
46#define iu_ier u2.ier
47#define iu_dlm u2.dlm
48#define iu_iir u3.iir
49#define iu_fcr u3.fcr
50
51#define ssnop() __asm__ __volatile__("sll $0, $0, 1\n");
52#define ssnop_4() do { ssnop(); ssnop(); ssnop(); ssnop(); } while (0)
53
54#define IO_BASE_64 0x9000000000000000ULL
55
56static unsigned char readb_outer_space(unsigned long long phys)
57{
58 unsigned long long vaddr = IO_BASE_64 | phys;
59 unsigned char res;
60 unsigned int sr;
61
62 sr = read_c0_status();
63 write_c0_status((sr | ST0_KX) & ~ ST0_IE);
64 ssnop_4();
65
66 __asm__ __volatile__ (
67 " .set mips3 \n"
68 " ld %0, %1 \n"
69 " lbu %0, (%0) \n"
70 " .set mips0 \n"
71 : "=r" (res)
72 : "m" (vaddr));
73
74 write_c0_status(sr);
75 ssnop_4();
76
77 return res;
78}
79
80static void writeb_outer_space(unsigned long long phys, unsigned char c)
81{
82 unsigned long long vaddr = IO_BASE_64 | phys;
83 unsigned long tmp;
84 unsigned int sr;
85
86 sr = read_c0_status();
87 write_c0_status((sr | ST0_KX) & ~ ST0_IE);
88 ssnop_4();
89
90 __asm__ __volatile__ (
91 " .set mips3 \n"
92 " ld %0, %1 \n"
93 " sb %2, (%0) \n"
94 " .set mips0 \n"
95 : "=&r" (tmp)
96 : "m" (vaddr), "r" (c));
97
98 write_c0_status(sr);
99 ssnop_4();
100}
101
102void prom_putchar(char c)
103{
104 unsigned long lsr = 0xfd000008ULL + offsetof(struct yo_uartregs, iu_lsr);
105 unsigned long thr = 0xfd000008ULL + offsetof(struct yo_uartregs, iu_thr);
106
107 while ((readb_outer_space(lsr) & 0x20) == 0);
108 writeb_outer_space(thr, c);
109}
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
deleted file mode 100644
index b6472fc88a99..000000000000
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ /dev/null
@@ -1,224 +0,0 @@
1/*
2 * Copyright (C) 2003 PMC-Sierra Inc.
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27#include <linux/bcd.h>
28#include <linux/init.h>
29#include <linux/kernel.h>
30#include <linux/export.h>
31#include <linux/types.h>
32#include <linux/mm.h>
33#include <linux/bootmem.h>
34#include <linux/swap.h>
35#include <linux/ioport.h>
36#include <linux/sched.h>
37#include <linux/interrupt.h>
38#include <linux/timex.h>
39#include <linux/termios.h>
40#include <linux/tty.h>
41#include <linux/serial.h>
42#include <linux/serial_core.h>
43#include <linux/serial_8250.h>
44
45#include <asm/time.h>
46#include <asm/bootinfo.h>
47#include <asm/page.h>
48#include <asm/io.h>
49#include <asm/irq.h>
50#include <asm/processor.h>
51#include <asm/reboot.h>
52#include <asm/serial.h>
53#include <asm/titan_dep.h>
54#include <asm/m48t37.h>
55
56#include "setup.h"
57
58unsigned char titan_ge_mac_addr_base[6] = {
59 // 0x00, 0x03, 0xcc, 0x1d, 0x22, 0x00
60 0x00, 0xe0, 0x04, 0x00, 0x00, 0x21
61};
62
63unsigned long cpu_clock_freq;
64unsigned long yosemite_base;
65
66static struct m48t37_rtc *m48t37_base;
67
68void __init bus_error_init(void)
69{
70 /* Do nothing */
71}
72
73
74void read_persistent_clock(struct timespec *ts)
75{
76 unsigned int year, month, day, hour, min, sec;
77 unsigned long flags;
78
79 spin_lock_irqsave(&rtc_lock, flags);
80 /* Stop the update to the time */
81 m48t37_base->control = 0x40;
82
83 year = bcd2bin(m48t37_base->year);
84 year += bcd2bin(m48t37_base->century) * 100;
85
86 month = bcd2bin(m48t37_base->month);
87 day = bcd2bin(m48t37_base->date);
88 hour = bcd2bin(m48t37_base->hour);
89 min = bcd2bin(m48t37_base->min);
90 sec = bcd2bin(m48t37_base->sec);
91
92 /* Start the update to the time again */
93 m48t37_base->control = 0x00;
94 spin_unlock_irqrestore(&rtc_lock, flags);
95
96 ts->tv_sec = mktime(year, month, day, hour, min, sec);
97 ts->tv_nsec = 0;
98}
99
100int rtc_mips_set_time(unsigned long tim)
101{
102 struct rtc_time tm;
103 unsigned long flags;
104
105 /*
106 * Convert to a more useful format -- note months count from 0
107 * and years from 1900
108 */
109 rtc_time_to_tm(tim, &tm);
110 tm.tm_year += 1900;
111 tm.tm_mon += 1;
112
113 spin_lock_irqsave(&rtc_lock, flags);
114 /* enable writing */
115 m48t37_base->control = 0x80;
116
117 /* year */
118 m48t37_base->year = bin2bcd(tm.tm_year % 100);
119 m48t37_base->century = bin2bcd(tm.tm_year / 100);
120
121 /* month */
122 m48t37_base->month = bin2bcd(tm.tm_mon);
123
124 /* day */
125 m48t37_base->date = bin2bcd(tm.tm_mday);
126
127 /* hour/min/sec */
128 m48t37_base->hour = bin2bcd(tm.tm_hour);
129 m48t37_base->min = bin2bcd(tm.tm_min);
130 m48t37_base->sec = bin2bcd(tm.tm_sec);
131
132 /* day of week -- not really used, but let's keep it up-to-date */
133 m48t37_base->day = bin2bcd(tm.tm_wday + 1);
134
135 /* disable writing */
136 m48t37_base->control = 0x00;
137 spin_unlock_irqrestore(&rtc_lock, flags);
138
139 return 0;
140}
141
142void __init plat_time_init(void)
143{
144 mips_hpt_frequency = cpu_clock_freq / 2;
145mips_hpt_frequency = 33000000 * 3 * 5;
146}
147
148unsigned long ocd_base;
149
150EXPORT_SYMBOL(ocd_base);
151
152/*
153 * Common setup before any secondaries are started
154 */
155
156#define TITAN_UART_CLK 3686400
157#define TITAN_SERIAL_BASE_BAUD (TITAN_UART_CLK / 16)
158#define TITAN_SERIAL_IRQ 4
159#define TITAN_SERIAL_BASE 0xfd000008UL
160
161static void __init py_map_ocd(void)
162{
163 ocd_base = (unsigned long) ioremap(OCD_BASE, OCD_SIZE);
164 if (!ocd_base)
165 panic("Mapping OCD failed - game over. Your score is 0.");
166
167 /* Kludge for PMON bug ... */
168 OCD_WRITE(0x0710, 0x0ffff029);
169}
170
171static void __init py_uart_setup(void)
172{
173#ifdef CONFIG_SERIAL_8250
174 struct uart_port up;
175
176 /*
177 * Register to interrupt zero because we share the interrupt with
178 * the serial driver which we don't properly support yet.
179 */
180 memset(&up, 0, sizeof(up));
181 up.membase = (unsigned char *) ioremap(TITAN_SERIAL_BASE, 8);
182 up.irq = TITAN_SERIAL_IRQ;
183 up.uartclk = TITAN_UART_CLK;
184 up.regshift = 0;
185 up.iotype = UPIO_MEM;
186 up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
187 up.line = 0;
188
189 if (early_serial_setup(&up))
190 printk(KERN_ERR "Early serial init of port 0 failed\n");
191#endif /* CONFIG_SERIAL_8250 */
192}
193
194static void __init py_rtc_setup(void)
195{
196 m48t37_base = ioremap(YOSEMITE_RTC_BASE, YOSEMITE_RTC_SIZE);
197 if (!m48t37_base)
198 printk(KERN_ERR "Mapping the RTC failed\n");
199}
200
201/* Not only time init but that's what the hook it's called through is named */
202static void __init py_late_time_init(void)
203{
204 py_map_ocd();
205 py_uart_setup();
206 py_rtc_setup();
207}
208
209void __init plat_mem_setup(void)
210{
211 late_time_init = py_late_time_init;
212
213 /* Add memory regions */
214 add_memory_region(0x00000000, 0x10000000, BOOT_MEM_RAM);
215
216#if 0 /* XXX Crash ... */
217 OCD_WRITE(RM9000x2_OCD_HTSC,
218 OCD_READ(RM9000x2_OCD_HTSC) | HYPERTRANSPORT_ENABLE);
219
220 /* Set the BAR. Shifted mode */
221 OCD_WRITE(RM9000x2_OCD_HTBAR0, HYPERTRANSPORT_BAR0_ADDR);
222 OCD_WRITE(RM9000x2_OCD_HTMASK0, HYPERTRANSPORT_SIZE0);
223#endif
224}
diff --git a/arch/mips/pmc-sierra/yosemite/setup.h b/arch/mips/pmc-sierra/yosemite/setup.h
deleted file mode 100644
index 1a01abfc7d33..000000000000
--- a/arch/mips/pmc-sierra/yosemite/setup.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright 2003, 04 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 * Copyright 2004 Ralf Baechle <ralf@linux-mips.org>
5 *
6 * Board specific definititions for the PMC-Sierra Yosemite
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#ifndef __SETUP_H__
14#define __SETUP_H__
15
16/* M48T37 RTC + NVRAM */
17#define YOSEMITE_RTC_BASE 0xfc800000
18#define YOSEMITE_RTC_SIZE 0x00800000
19
20#define HYPERTRANSPORT_BAR0_ADDR 0x00000006
21#define HYPERTRANSPORT_SIZE0 0x0fffffff
22#define HYPERTRANSPORT_BAR0_ATTR 0x00002000
23
24#define HYPERTRANSPORT_ENABLE 0x6
25
26/*
27 * EEPROM Size
28 */
29#define TITAN_ATMEL_24C32_SIZE 32768
30#define TITAN_ATMEL_24C64_SIZE 65536
31
32#endif /* __SETUP_H__ */
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
deleted file mode 100644
index 5edab2bc6fc0..000000000000
--- a/arch/mips/pmc-sierra/yosemite/smp.c
+++ /dev/null
@@ -1,185 +0,0 @@
1#include <linux/linkage.h>
2#include <linux/sched.h>
3#include <linux/smp.h>
4
5#include <asm/pmon.h>
6#include <asm/titan_dep.h>
7#include <asm/time.h>
8
9#define LAUNCHSTACK_SIZE 256
10
11static __cpuinitdata arch_spinlock_t launch_lock = __ARCH_SPIN_LOCK_UNLOCKED;
12
13static unsigned long secondary_sp __cpuinitdata;
14static unsigned long secondary_gp __cpuinitdata;
15
16static unsigned char launchstack[LAUNCHSTACK_SIZE] __initdata
17 __attribute__((aligned(2 * sizeof(long))));
18
19static void __init prom_smp_bootstrap(void)
20{
21 local_irq_disable();
22
23 while (arch_spin_is_locked(&launch_lock));
24
25 __asm__ __volatile__(
26 " move $sp, %0 \n"
27 " move $gp, %1 \n"
28 " j smp_bootstrap \n"
29 :
30 : "r" (secondary_sp), "r" (secondary_gp));
31}
32
33/*
34 * PMON is a fragile beast. It'll blow up once the mappings it's littering
35 * right into the middle of KSEG3 are blown away so we have to grab the slave
36 * core early and keep it in a waiting loop.
37 */
38void __init prom_grab_secondary(void)
39{
40 arch_spin_lock(&launch_lock);
41
42 pmon_cpustart(1, &prom_smp_bootstrap,
43 launchstack + LAUNCHSTACK_SIZE, 0);
44}
45
46void titan_mailbox_irq(void)
47{
48 int cpu = smp_processor_id();
49 unsigned long status;
50
51 switch (cpu) {
52 case 0:
53 status = OCD_READ(RM9000x2_OCD_INTP0STATUS3);
54 OCD_WRITE(RM9000x2_OCD_INTP0CLEAR3, status);
55
56 if (status & 0x2)
57 smp_call_function_interrupt();
58 if (status & 0x4)
59 scheduler_ipi();
60 break;
61
62 case 1:
63 status = OCD_READ(RM9000x2_OCD_INTP1STATUS3);
64 OCD_WRITE(RM9000x2_OCD_INTP1CLEAR3, status);
65
66 if (status & 0x2)
67 smp_call_function_interrupt();
68 if (status & 0x4)
69 scheduler_ipi();
70 break;
71 }
72}
73
74/*
75 * Send inter-processor interrupt
76 */
77static void yos_send_ipi_single(int cpu, unsigned int action)
78{
79 /*
80 * Generate an INTMSG so that it can be sent over to the
81 * destination CPU. The INTMSG will put the STATUS bits
82 * based on the action desired. An alternative strategy
83 * is to write to the Interrupt Set register, read the
84 * Interrupt Status register and clear the Interrupt
85 * Clear register. The latter is preffered.
86 */
87 switch (action) {
88 case SMP_RESCHEDULE_YOURSELF:
89 if (cpu == 1)
90 OCD_WRITE(RM9000x2_OCD_INTP1SET3, 4);
91 else
92 OCD_WRITE(RM9000x2_OCD_INTP0SET3, 4);
93 break;
94
95 case SMP_CALL_FUNCTION:
96 if (cpu == 1)
97 OCD_WRITE(RM9000x2_OCD_INTP1SET3, 2);
98 else
99 OCD_WRITE(RM9000x2_OCD_INTP0SET3, 2);
100 break;
101 }
102}
103
104static void yos_send_ipi_mask(const struct cpumask *mask, unsigned int action)
105{
106 unsigned int i;
107
108 for_each_cpu(i, mask)
109 yos_send_ipi_single(i, action);
110}
111
112/*
113 * After we've done initial boot, this function is called to allow the
114 * board code to clean up state, if needed
115 */
116static void __cpuinit yos_init_secondary(void)
117{
118}
119
120static void __cpuinit yos_smp_finish(void)
121{
122 set_c0_status(ST0_CO | ST0_IM | ST0_IE);
123}
124
125/* Hook for after all CPUs are online */
126static void yos_cpus_done(void)
127{
128}
129
130/*
131 * Firmware CPU startup hook
132 * Complicated by PMON's weird interface which tries to minimic the UNIX fork.
133 * It launches the next * available CPU and copies some information on the
134 * stack so the first thing we do is throw away that stuff and load useful
135 * values into the registers ...
136 */
137static void __cpuinit yos_boot_secondary(int cpu, struct task_struct *idle)
138{
139 unsigned long gp = (unsigned long) task_thread_info(idle);
140 unsigned long sp = __KSTK_TOS(idle);
141
142 secondary_sp = sp;
143 secondary_gp = gp;
144
145 arch_spin_unlock(&launch_lock);
146}
147
148/*
149 * Detect available CPUs, populate cpu_possible_mask before smp_init
150 *
151 * We don't want to start the secondary CPU yet nor do we have a nice probing
152 * feature in PMON so we just assume presence of the secondary core.
153 */
154static void __init yos_smp_setup(void)
155{
156 int i;
157
158 init_cpu_possible(cpu_none_mask);
159
160 for (i = 0; i < 2; i++) {
161 set_cpu_possible(i, true);
162 __cpu_number_map[i] = i;
163 __cpu_logical_map[i] = i;
164 }
165}
166
167static void __init yos_prepare_cpus(unsigned int max_cpus)
168{
169 /*
170 * Be paranoid. Enable the IPI only if we're really about to go SMP.
171 */
172 if (num_possible_cpus())
173 set_c0_status(STATUSF_IP5);
174}
175
176struct plat_smp_ops yos_smp_ops = {
177 .send_ipi_single = yos_send_ipi_single,
178 .send_ipi_mask = yos_send_ipi_mask,
179 .init_secondary = yos_init_secondary,
180 .smp_finish = yos_smp_finish,
181 .cpus_done = yos_cpus_done,
182 .boot_secondary = yos_boot_secondary,
183 .smp_setup = yos_smp_setup,
184 .prepare_cpus = yos_prepare_cpus,
185};
diff --git a/arch/mips/powertv/init.c b/arch/mips/powertv/init.c
index 1cf5abbef715..c6979353980b 100644
--- a/arch/mips/powertv/init.c
+++ b/arch/mips/powertv/init.c
@@ -69,40 +69,6 @@ char *prom_getenv(char *envname)
69 return result; 69 return result;
70} 70}
71 71
72/* TODO: Verify on linux-mips mailing list that the following two */
73/* functions are correct */
74/* TODO: Copy NMI and EJTAG exception vectors to memory from the */
75/* BootROM exception vectors. Flush their cache entries. test it. */
76
77static void __init mips_nmi_setup(void)
78{
79 void *base;
80#if defined(CONFIG_CPU_MIPS32_R1)
81 base = cpu_has_veic ?
82 (void *)(CAC_BASE + 0xa80) :
83 (void *)(CAC_BASE + 0x380);
84#elif defined(CONFIG_CPU_MIPS32_R2)
85 base = (void *)0xbfc00000;
86#else
87#error NMI exception handler address not defined
88#endif
89}
90
91static void __init mips_ejtag_setup(void)
92{
93 void *base;
94
95#if defined(CONFIG_CPU_MIPS32_R1)
96 base = cpu_has_veic ?
97 (void *)(CAC_BASE + 0xa00) :
98 (void *)(CAC_BASE + 0x300);
99#elif defined(CONFIG_CPU_MIPS32_R2)
100 base = (void *)0xbfc00480;
101#else
102#error EJTAG exception handler address not defined
103#endif
104}
105
106void __init prom_init(void) 72void __init prom_init(void)
107{ 73{
108 int prom_argc; 74 int prom_argc;
@@ -113,9 +79,6 @@ void __init prom_init(void)
113 _prom_envp = (int *) fw_arg2; 79 _prom_envp = (int *) fw_arg2;
114 _prom_memsize = (unsigned long) fw_arg3; 80 _prom_memsize = (unsigned long) fw_arg3;
115 81
116 board_nmi_handler_setup = mips_nmi_setup;
117 board_ejtag_handler_setup = mips_ejtag_setup;
118
119 if (prom_argc == 1) { 82 if (prom_argc == 1) {
120 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); 83 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
121 strlcat(arcs_cmdline, prom_argv, COMMAND_LINE_SIZE); 84 strlcat(arcs_cmdline, prom_argv, COMMAND_LINE_SIZE);
diff --git a/arch/mips/rb532/prom.c b/arch/mips/rb532/prom.c
index d7c26d00cfef..a757ded437cd 100644
--- a/arch/mips/rb532/prom.c
+++ b/arch/mips/rb532/prom.c
@@ -72,12 +72,11 @@ void __init prom_setup_cmdline(void)
72 static char cmd_line[COMMAND_LINE_SIZE] __initdata; 72 static char cmd_line[COMMAND_LINE_SIZE] __initdata;
73 char *cp, *board; 73 char *cp, *board;
74 int prom_argc; 74 int prom_argc;
75 char **prom_argv, **prom_envp; 75 char **prom_argv;
76 int i; 76 int i;
77 77
78 prom_argc = fw_arg0; 78 prom_argc = fw_arg0;
79 prom_argv = (char **) fw_arg1; 79 prom_argv = (char **) fw_arg1;
80 prom_envp = (char **) fw_arg2;
81 80
82 cp = cmd_line; 81 cp = cmd_line;
83 /* Note: it is common that parameters start 82 /* Note: it is common that parameters start
diff --git a/arch/mips/sgi-ip22/ip22-eisa.c b/arch/mips/sgi-ip22/ip22-eisa.c
index da44ccb20829..4a6057b35b9d 100644
--- a/arch/mips/sgi-ip22/ip22-eisa.c
+++ b/arch/mips/sgi-ip22/ip22-eisa.c
@@ -73,12 +73,10 @@ static char __init *decode_eisa_sig(unsigned long addr)
73 73
74static irqreturn_t ip22_eisa_intr(int irq, void *dev_id) 74static irqreturn_t ip22_eisa_intr(int irq, void *dev_id)
75{ 75{
76 u8 eisa_irq; 76 u8 eisa_irq = inb(EIU_INTRPT_ACK);
77 u8 dma1, dma2;
78 77
79 eisa_irq = inb(EIU_INTRPT_ACK); 78 inb(EISA_DMA1_STATUS);
80 dma1 = inb(EISA_DMA1_STATUS); 79 inb(EISA_DMA2_STATUS);
81 dma2 = inb(EISA_DMA2_STATUS);
82 80
83 if (eisa_irq < EISA_MAX_IRQ) { 81 if (eisa_irq < EISA_MAX_IRQ) {
84 do_IRQ(eisa_irq); 82 do_IRQ(eisa_irq);
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index 3cd937e0e9a3..01cc1a749c73 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -74,7 +74,7 @@ config SIBYTE_SB1xxx_SOC
74 select SWAP_IO_SPACE 74 select SWAP_IO_SPACE
75 select SYS_SUPPORTS_32BIT_KERNEL 75 select SYS_SUPPORTS_32BIT_KERNEL
76 select SYS_SUPPORTS_64BIT_KERNEL 76 select SYS_SUPPORTS_64BIT_KERNEL
77 select CFE 77 select FW_CFE
78 select SYS_HAS_EARLY_PRINTK 78 select SYS_HAS_EARLY_PRINTK
79 79
80choice 80choice
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 413f17f8e892..d6c7bd4b5ab0 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -15,12 +15,12 @@
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <linux/screen_info.h> 16#include <linux/screen_info.h>
17 17
18#ifdef CONFIG_ARC 18#ifdef CONFIG_FW_ARC
19#include <asm/fw/arc/types.h> 19#include <asm/fw/arc/types.h>
20#include <asm/sgialib.h> 20#include <asm/sgialib.h>
21#endif 21#endif
22 22
23#ifdef CONFIG_SNIPROM 23#ifdef CONFIG_FW_SNIPROM
24#include <asm/mipsprom.h> 24#include <asm/mipsprom.h>
25#endif 25#endif
26 26
@@ -37,7 +37,7 @@ extern void sni_machine_power_off(void);
37 37
38static void __init sni_display_setup(void) 38static void __init sni_display_setup(void)
39{ 39{
40#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_ARC) 40#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
41 struct screen_info *si = &screen_info; 41 struct screen_info *si = &screen_info;
42 DISPLAY_STATUS *di; 42 DISPLAY_STATUS *di;
43 43
@@ -56,7 +56,7 @@ static void __init sni_display_setup(void)
56 56
57static void __init sni_console_setup(void) 57static void __init sni_console_setup(void)
58{ 58{
59#ifndef CONFIG_ARC 59#ifndef CONFIG_FW_ARC
60 char *ctype; 60 char *ctype;
61 char *cdev; 61 char *cdev;
62 char *baud; 62 char *baud;
diff --git a/arch/mips/wrppmc/pci.c b/arch/mips/wrppmc/pci.c
index d06192faeb7c..8b8a0e1a40ca 100644
--- a/arch/mips/wrppmc/pci.c
+++ b/arch/mips/wrppmc/pci.c
@@ -38,10 +38,8 @@ static struct pci_controller hose_0 = {
38 38
39static int __init gt64120_pci_init(void) 39static int __init gt64120_pci_init(void)
40{ 40{
41 u32 tmp; 41 (void) GT_READ(GT_PCI0_CMD_OFS); /* Huh??? -- Ralf */
42 42 (void) GT_READ(GT_PCI0_BARE_OFS);
43 tmp = GT_READ(GT_PCI0_CMD_OFS); /* Huh??? -- Ralf */
44 tmp = GT_READ(GT_PCI0_BARE_OFS);
45 43
46 /* reset the whole PCI I/O space range */ 44 /* reset the whole PCI I/O space range */
47 ioport_resource.start = GT_PCI_IO_BASE; 45 ioport_resource.start = GT_PCI_IO_BASE;
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index fd49aeda9eb8..5dede04f2f3e 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -65,7 +65,8 @@ put_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz)
65{ 65{
66 compat_sigset_t s; 66 compat_sigset_t s;
67 67
68 if (sz != sizeof *set) panic("put_sigset32()"); 68 if (sz != sizeof *set)
69 return -EINVAL;
69 sigset_64to32(&s, set); 70 sigset_64to32(&s, set);
70 71
71 return copy_to_user(up, &s, sizeof s); 72 return copy_to_user(up, &s, sizeof s);
@@ -77,7 +78,8 @@ get_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz)
77 compat_sigset_t s; 78 compat_sigset_t s;
78 int r; 79 int r;
79 80
80 if (sz != sizeof *set) panic("put_sigset32()"); 81 if (sz != sizeof *set)
82 return -EINVAL;
81 83
82 if ((r = copy_from_user(&s, up, sz)) == 0) { 84 if ((r = copy_from_user(&s, up, sz)) == 0) {
83 sigset_32to64(set, &s); 85 sigset_32to64(set, &s);
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 7426e40699bd..f76c10863c62 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -73,6 +73,8 @@ static unsigned long get_shared_area(struct address_space *mapping,
73 struct vm_area_struct *vma; 73 struct vm_area_struct *vma;
74 int offset = mapping ? get_offset(mapping) : 0; 74 int offset = mapping ? get_offset(mapping) : 0;
75 75
76 offset = (offset + (pgoff << PAGE_SHIFT)) & 0x3FF000;
77
76 addr = DCACHE_ALIGN(addr - offset) + offset; 78 addr = DCACHE_ALIGN(addr - offset) + offset;
77 79
78 for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) { 80 for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
diff --git a/arch/powerpc/boot/dts/mpc5200b.dtsi b/arch/powerpc/boot/dts/mpc5200b.dtsi
index 7ab286ab5300..39ed65a44c5f 100644
--- a/arch/powerpc/boot/dts/mpc5200b.dtsi
+++ b/arch/powerpc/boot/dts/mpc5200b.dtsi
@@ -231,6 +231,12 @@
231 interrupts = <2 7 0>; 231 interrupts = <2 7 0>;
232 }; 232 };
233 233
234 sclpc@3c00 {
235 compatible = "fsl,mpc5200-lpbfifo";
236 reg = <0x3c00 0x60>;
237 interrupts = <2 23 0>;
238 };
239
234 i2c@3d00 { 240 i2c@3d00 {
235 #address-cells = <1>; 241 #address-cells = <1>;
236 #size-cells = <0>; 242 #size-cells = <0>;
diff --git a/arch/powerpc/boot/dts/o2d.dtsi b/arch/powerpc/boot/dts/o2d.dtsi
index 3444eb8f0ade..24f668039295 100644
--- a/arch/powerpc/boot/dts/o2d.dtsi
+++ b/arch/powerpc/boot/dts/o2d.dtsi
@@ -86,12 +86,6 @@
86 reg = <0>; 86 reg = <0>;
87 }; 87 };
88 }; 88 };
89
90 sclpc@3c00 {
91 compatible = "fsl,mpc5200-lpbfifo";
92 reg = <0x3c00 0x60>;
93 interrupts = <3 23 0>;
94 };
95 }; 89 };
96 90
97 localbus { 91 localbus {
diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
index 9e354997eb7e..96512c058033 100644
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ b/arch/powerpc/boot/dts/pcm030.dts
@@ -59,7 +59,7 @@
59 #gpio-cells = <2>; 59 #gpio-cells = <2>;
60 }; 60 };
61 61
62 psc@2000 { /* PSC1 in ac97 mode */ 62 audioplatform: psc@2000 { /* PSC1 in ac97 mode */
63 compatible = "mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97"; 63 compatible = "mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97";
64 cell-index = <0>; 64 cell-index = <0>;
65 }; 65 };
@@ -134,4 +134,9 @@
134 localbus { 134 localbus {
135 status = "disabled"; 135 status = "disabled";
136 }; 136 };
137
138 sound {
139 compatible = "phytec,pcm030-audio-fabric";
140 asoc-platform = <&audioplatform>;
141 };
137}; 142};
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 8520b58a5e9a..b89ef65392dc 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -372,10 +372,11 @@ static int mpc52xx_irqhost_map(struct irq_domain *h, unsigned int virq,
372 case MPC52xx_IRQ_L1_MAIN: irqchip = &mpc52xx_main_irqchip; break; 372 case MPC52xx_IRQ_L1_MAIN: irqchip = &mpc52xx_main_irqchip; break;
373 case MPC52xx_IRQ_L1_PERP: irqchip = &mpc52xx_periph_irqchip; break; 373 case MPC52xx_IRQ_L1_PERP: irqchip = &mpc52xx_periph_irqchip; break;
374 case MPC52xx_IRQ_L1_SDMA: irqchip = &mpc52xx_sdma_irqchip; break; 374 case MPC52xx_IRQ_L1_SDMA: irqchip = &mpc52xx_sdma_irqchip; break;
375 default: 375 case MPC52xx_IRQ_L1_CRIT:
376 pr_err("%s: invalid irq: virq=%i, l1=%i, l2=%i\n", 376 pr_warn("%s: Critical IRQ #%d is unsupported! Nopping it.\n",
377 __func__, virq, l1irq, l2irq); 377 __func__, l2irq);
378 return -EINVAL; 378 irq_set_chip(virq, &no_irq_chip);
379 return 0;
379 } 380 }
380 381
381 irq_set_chip_and_handler(virq, irqchip, handle_level_irq); 382 irq_set_chip_and_handler(virq, irqchip, handle_level_irq);
diff --git a/arch/powerpc/platforms/pseries/eeh_pe.c b/arch/powerpc/platforms/pseries/eeh_pe.c
index 797cd181dc3f..d16c8ded1084 100644
--- a/arch/powerpc/platforms/pseries/eeh_pe.c
+++ b/arch/powerpc/platforms/pseries/eeh_pe.c
@@ -449,7 +449,7 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe)
449 if (list_empty(&pe->edevs)) { 449 if (list_empty(&pe->edevs)) {
450 cnt = 0; 450 cnt = 0;
451 list_for_each_entry(child, &pe->child_list, child) { 451 list_for_each_entry(child, &pe->child_list, child) {
452 if (!(pe->type & EEH_PE_INVALID)) { 452 if (!(child->type & EEH_PE_INVALID)) {
453 cnt++; 453 cnt++;
454 break; 454 break;
455 } 455 }
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index d19f4977c834..e5b084723131 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -220,7 +220,8 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
220 220
221 /* Get the top level device in the PE */ 221 /* Get the top level device in the PE */
222 edev = of_node_to_eeh_dev(dn); 222 edev = of_node_to_eeh_dev(dn);
223 edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); 223 if (edev->pe)
224 edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list);
224 dn = eeh_dev_to_of_node(edev); 225 dn = eeh_dev_to_of_node(edev);
225 if (!dn) 226 if (!dn)
226 return NULL; 227 return NULL;
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 5dba755a43e6..d385f396dfee 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -96,6 +96,7 @@ config S390
96 select HAVE_MEMBLOCK_NODE_MAP 96 select HAVE_MEMBLOCK_NODE_MAP
97 select HAVE_CMPXCHG_LOCAL 97 select HAVE_CMPXCHG_LOCAL
98 select HAVE_CMPXCHG_DOUBLE 98 select HAVE_CMPXCHG_DOUBLE
99 select HAVE_ALIGNED_STRUCT_PAGE if SLUB
99 select HAVE_VIRT_CPU_ACCOUNTING 100 select HAVE_VIRT_CPU_ACCOUNTING
100 select VIRT_CPU_ACCOUNTING 101 select VIRT_CPU_ACCOUNTING
101 select ARCH_DISCARD_MEMBLOCK 102 select ARCH_DISCARD_MEMBLOCK
diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h
index 55bde6035216..ad2b924167d7 100644
--- a/arch/s390/include/asm/cio.h
+++ b/arch/s390/include/asm/cio.h
@@ -9,6 +9,8 @@
9 9
10#define LPM_ANYPATH 0xff 10#define LPM_ANYPATH 0xff
11#define __MAX_CSSID 0 11#define __MAX_CSSID 0
12#define __MAX_SUBCHANNEL 65535
13#define __MAX_SSID 3
12 14
13#include <asm/scsw.h> 15#include <asm/scsw.h>
14 16
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index a34a9d612fc0..18cd6b592650 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -20,7 +20,7 @@
20#define PSW32_MASK_CC 0x00003000UL 20#define PSW32_MASK_CC 0x00003000UL
21#define PSW32_MASK_PM 0x00000f00UL 21#define PSW32_MASK_PM 0x00000f00UL
22 22
23#define PSW32_MASK_USER 0x00003F00UL 23#define PSW32_MASK_USER 0x0000FF00UL
24 24
25#define PSW32_ADDR_AMODE 0x80000000UL 25#define PSW32_ADDR_AMODE 0x80000000UL
26#define PSW32_ADDR_INSN 0x7FFFFFFFUL 26#define PSW32_ADDR_INSN 0x7FFFFFFFUL
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index dd647c919a66..2d3b7cb26005 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -506,12 +506,15 @@ static inline int pud_bad(pud_t pud)
506 506
507static inline int pmd_present(pmd_t pmd) 507static inline int pmd_present(pmd_t pmd)
508{ 508{
509 return (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) != 0UL; 509 unsigned long mask = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO;
510 return (pmd_val(pmd) & mask) == _HPAGE_TYPE_NONE ||
511 !(pmd_val(pmd) & _SEGMENT_ENTRY_INV);
510} 512}
511 513
512static inline int pmd_none(pmd_t pmd) 514static inline int pmd_none(pmd_t pmd)
513{ 515{
514 return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL; 516 return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) &&
517 !(pmd_val(pmd) & _SEGMENT_ENTRY_RO);
515} 518}
516 519
517static inline int pmd_large(pmd_t pmd) 520static inline int pmd_large(pmd_t pmd)
@@ -1223,6 +1226,11 @@ static inline void __pmd_idte(unsigned long address, pmd_t *pmdp)
1223} 1226}
1224 1227
1225#ifdef CONFIG_TRANSPARENT_HUGEPAGE 1228#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1229
1230#define SEGMENT_NONE __pgprot(_HPAGE_TYPE_NONE)
1231#define SEGMENT_RO __pgprot(_HPAGE_TYPE_RO)
1232#define SEGMENT_RW __pgprot(_HPAGE_TYPE_RW)
1233
1226#define __HAVE_ARCH_PGTABLE_DEPOSIT 1234#define __HAVE_ARCH_PGTABLE_DEPOSIT
1227extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable); 1235extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
1228 1236
@@ -1242,16 +1250,15 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1242 1250
1243static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot) 1251static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
1244{ 1252{
1245 unsigned long pgprot_pmd = 0; 1253 /*
1246 1254 * pgprot is PAGE_NONE, PAGE_RO, or PAGE_RW (see __Pxxx / __Sxxx)
1247 if (pgprot_val(pgprot) & _PAGE_INVALID) { 1255 * Convert to segment table entry format.
1248 if (pgprot_val(pgprot) & _PAGE_SWT) 1256 */
1249 pgprot_pmd |= _HPAGE_TYPE_NONE; 1257 if (pgprot_val(pgprot) == pgprot_val(PAGE_NONE))
1250 pgprot_pmd |= _SEGMENT_ENTRY_INV; 1258 return pgprot_val(SEGMENT_NONE);
1251 } 1259 if (pgprot_val(pgprot) == pgprot_val(PAGE_RO))
1252 if (pgprot_val(pgprot) & _PAGE_RO) 1260 return pgprot_val(SEGMENT_RO);
1253 pgprot_pmd |= _SEGMENT_ENTRY_RO; 1261 return pgprot_val(SEGMENT_RW);
1254 return pgprot_pmd;
1255} 1262}
1256 1263
1257static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) 1264static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
@@ -1269,7 +1276,9 @@ static inline pmd_t pmd_mkhuge(pmd_t pmd)
1269 1276
1270static inline pmd_t pmd_mkwrite(pmd_t pmd) 1277static inline pmd_t pmd_mkwrite(pmd_t pmd)
1271{ 1278{
1272 pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO; 1279 /* Do not clobber _HPAGE_TYPE_NONE pages! */
1280 if (!(pmd_val(pmd) & _SEGMENT_ENTRY_INV))
1281 pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
1273 return pmd; 1282 return pmd;
1274} 1283}
1275 1284
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index 9ca305383760..9935cbd6a46f 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -8,6 +8,9 @@ struct cpu;
8 8
9#ifdef CONFIG_SCHED_BOOK 9#ifdef CONFIG_SCHED_BOOK
10 10
11extern unsigned char cpu_socket_id[NR_CPUS];
12#define topology_physical_package_id(cpu) (cpu_socket_id[cpu])
13
11extern unsigned char cpu_core_id[NR_CPUS]; 14extern unsigned char cpu_core_id[NR_CPUS];
12extern cpumask_t cpu_core_map[NR_CPUS]; 15extern cpumask_t cpu_core_map[NR_CPUS];
13 16
diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h
index 705588a16d70..a5ca214b34fd 100644
--- a/arch/s390/include/uapi/asm/ptrace.h
+++ b/arch/s390/include/uapi/asm/ptrace.h
@@ -239,7 +239,7 @@ typedef struct
239#define PSW_MASK_EA 0x00000000UL 239#define PSW_MASK_EA 0x00000000UL
240#define PSW_MASK_BA 0x00000000UL 240#define PSW_MASK_BA 0x00000000UL
241 241
242#define PSW_MASK_USER 0x00003F00UL 242#define PSW_MASK_USER 0x0000FF00UL
243 243
244#define PSW_ADDR_AMODE 0x80000000UL 244#define PSW_ADDR_AMODE 0x80000000UL
245#define PSW_ADDR_INSN 0x7FFFFFFFUL 245#define PSW_ADDR_INSN 0x7FFFFFFFUL
@@ -269,7 +269,7 @@ typedef struct
269#define PSW_MASK_EA 0x0000000100000000UL 269#define PSW_MASK_EA 0x0000000100000000UL
270#define PSW_MASK_BA 0x0000000080000000UL 270#define PSW_MASK_BA 0x0000000080000000UL
271 271
272#define PSW_MASK_USER 0x00003F8180000000UL 272#define PSW_MASK_USER 0x0000FF8180000000UL
273 273
274#define PSW_ADDR_AMODE 0x0000000000000000UL 274#define PSW_ADDR_AMODE 0x0000000000000000UL
275#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL 275#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index a1e8a8694bb7..593fcc9253fc 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -309,6 +309,10 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
309 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 309 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
310 (__u64)(regs32.psw.mask & PSW32_MASK_USER) << 32 | 310 (__u64)(regs32.psw.mask & PSW32_MASK_USER) << 32 |
311 (__u64)(regs32.psw.addr & PSW32_ADDR_AMODE); 311 (__u64)(regs32.psw.addr & PSW32_ADDR_AMODE);
312 /* Check for invalid user address space control. */
313 if ((regs->psw.mask & PSW_MASK_ASC) >= (psw_kernel_bits & PSW_MASK_ASC))
314 regs->psw.mask = (psw_user_bits & PSW_MASK_ASC) |
315 (regs->psw.mask & ~PSW_MASK_ASC);
312 regs->psw.addr = (__u64)(regs32.psw.addr & PSW32_ADDR_INSN); 316 regs->psw.addr = (__u64)(regs32.psw.addr & PSW32_ADDR_INSN);
313 for (i = 0; i < NUM_GPRS; i++) 317 for (i = 0; i < NUM_GPRS; i++)
314 regs->gprs[i] = (__u64) regs32.gprs[i]; 318 regs->gprs[i] = (__u64) regs32.gprs[i];
@@ -481,7 +485,10 @@ static int setup_frame32(int sig, struct k_sigaction *ka,
481 485
482 /* Set up registers for signal handler */ 486 /* Set up registers for signal handler */
483 regs->gprs[15] = (__force __u64) frame; 487 regs->gprs[15] = (__force __u64) frame;
484 regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */ 488 /* Force 31 bit amode and default user address space control. */
489 regs->psw.mask = PSW_MASK_BA |
490 (psw_user_bits & PSW_MASK_ASC) |
491 (regs->psw.mask & ~PSW_MASK_ASC);
485 regs->psw.addr = (__force __u64) ka->sa.sa_handler; 492 regs->psw.addr = (__force __u64) ka->sa.sa_handler;
486 493
487 regs->gprs[2] = map_signal(sig); 494 regs->gprs[2] = map_signal(sig);
@@ -549,7 +556,10 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
549 556
550 /* Set up registers for signal handler */ 557 /* Set up registers for signal handler */
551 regs->gprs[15] = (__force __u64) frame; 558 regs->gprs[15] = (__force __u64) frame;
552 regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */ 559 /* Force 31 bit amode and default user address space control. */
560 regs->psw.mask = PSW_MASK_BA |
561 (psw_user_bits & PSW_MASK_ASC) |
562 (regs->psw.mask & ~PSW_MASK_ASC);
553 regs->psw.addr = (__u64) ka->sa.sa_handler; 563 regs->psw.addr = (__u64) ka->sa.sa_handler;
554 564
555 regs->gprs[2] = map_signal(sig); 565 regs->gprs[2] = map_signal(sig);
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S
index bf053898630d..b6506ee32a36 100644
--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -44,6 +44,12 @@ _sclp_wait_int:
44#endif 44#endif
45 mvc .LoldpswS1-.LbaseS1(16,%r13),0(%r8) 45 mvc .LoldpswS1-.LbaseS1(16,%r13),0(%r8)
46 mvc 0(16,%r8),0(%r9) 46 mvc 0(16,%r8),0(%r9)
47#ifdef CONFIG_64BIT
48 epsw %r6,%r7 # set current addressing mode
49 nill %r6,0x1 # in new psw (31 or 64 bit mode)
50 nilh %r7,0x8000
51 stm %r6,%r7,0(%r8)
52#endif
47 lhi %r6,0x0200 # cr mask for ext int (cr0.54) 53 lhi %r6,0x0200 # cr mask for ext int (cr0.54)
48 ltr %r2,%r2 54 ltr %r2,%r2
49 jz .LsetctS1 55 jz .LsetctS1
@@ -87,7 +93,7 @@ _sclp_wait_int:
87 .long 0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int 93 .long 0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int
88#ifdef CONFIG_64BIT 94#ifdef CONFIG_64BIT
89.LextpswS1_64: 95.LextpswS1_64:
90 .quad 0x0000000180000000, .LwaitS1 # PSW to handle ext int, 64 bit 96 .quad 0, .LwaitS1 # PSW to handle ext int, 64 bit
91#endif 97#endif
92.LwaitpswS1: 98.LwaitpswS1:
93 .long 0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int 99 .long 0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index c13a2a37ef00..d1259d875074 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -136,6 +136,10 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
136 /* Use regs->psw.mask instead of psw_user_bits to preserve PER bit. */ 136 /* Use regs->psw.mask instead of psw_user_bits to preserve PER bit. */
137 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 137 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
138 (user_sregs.regs.psw.mask & PSW_MASK_USER); 138 (user_sregs.regs.psw.mask & PSW_MASK_USER);
139 /* Check for invalid user address space control. */
140 if ((regs->psw.mask & PSW_MASK_ASC) >= (psw_kernel_bits & PSW_MASK_ASC))
141 regs->psw.mask = (psw_user_bits & PSW_MASK_ASC) |
142 (regs->psw.mask & ~PSW_MASK_ASC);
139 /* Check for invalid amode */ 143 /* Check for invalid amode */
140 if (regs->psw.mask & PSW_MASK_EA) 144 if (regs->psw.mask & PSW_MASK_EA)
141 regs->psw.mask |= PSW_MASK_BA; 145 regs->psw.mask |= PSW_MASK_BA;
@@ -273,7 +277,10 @@ static int setup_frame(int sig, struct k_sigaction *ka,
273 277
274 /* Set up registers for signal handler */ 278 /* Set up registers for signal handler */
275 regs->gprs[15] = (unsigned long) frame; 279 regs->gprs[15] = (unsigned long) frame;
276 regs->psw.mask |= PSW_MASK_EA | PSW_MASK_BA; /* 64 bit amode */ 280 /* Force default amode and default user address space control. */
281 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
282 (psw_user_bits & PSW_MASK_ASC) |
283 (regs->psw.mask & ~PSW_MASK_ASC);
277 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; 284 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
278 285
279 regs->gprs[2] = map_signal(sig); 286 regs->gprs[2] = map_signal(sig);
@@ -346,7 +353,10 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
346 353
347 /* Set up registers for signal handler */ 354 /* Set up registers for signal handler */
348 regs->gprs[15] = (unsigned long) frame; 355 regs->gprs[15] = (unsigned long) frame;
349 regs->psw.mask |= PSW_MASK_EA | PSW_MASK_BA; /* 64 bit amode */ 356 /* Force default amode and default user address space control. */
357 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
358 (psw_user_bits & PSW_MASK_ASC) |
359 (regs->psw.mask & ~PSW_MASK_ASC);
350 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; 360 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
351 361
352 regs->gprs[2] = map_signal(sig); 362 regs->gprs[2] = map_signal(sig);
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 54d93f4b6818..dd55f7c20104 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -40,6 +40,7 @@ static DEFINE_SPINLOCK(topology_lock);
40static struct mask_info core_info; 40static struct mask_info core_info;
41cpumask_t cpu_core_map[NR_CPUS]; 41cpumask_t cpu_core_map[NR_CPUS];
42unsigned char cpu_core_id[NR_CPUS]; 42unsigned char cpu_core_id[NR_CPUS];
43unsigned char cpu_socket_id[NR_CPUS];
43 44
44static struct mask_info book_info; 45static struct mask_info book_info;
45cpumask_t cpu_book_map[NR_CPUS]; 46cpumask_t cpu_book_map[NR_CPUS];
@@ -83,11 +84,12 @@ static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu,
83 cpumask_set_cpu(lcpu, &book->mask); 84 cpumask_set_cpu(lcpu, &book->mask);
84 cpu_book_id[lcpu] = book->id; 85 cpu_book_id[lcpu] = book->id;
85 cpumask_set_cpu(lcpu, &core->mask); 86 cpumask_set_cpu(lcpu, &core->mask);
87 cpu_core_id[lcpu] = rcpu;
86 if (one_core_per_cpu) { 88 if (one_core_per_cpu) {
87 cpu_core_id[lcpu] = rcpu; 89 cpu_socket_id[lcpu] = rcpu;
88 core = core->next; 90 core = core->next;
89 } else { 91 } else {
90 cpu_core_id[lcpu] = core->id; 92 cpu_socket_id[lcpu] = core->id;
91 } 93 }
92 smp_cpu_set_polarization(lcpu, tl_cpu->pp); 94 smp_cpu_set_polarization(lcpu, tl_cpu->pp);
93 } 95 }
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index 2d37bb861faf..9017a63dda3d 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -39,7 +39,7 @@ static __always_inline unsigned long follow_table(struct mm_struct *mm,
39 pmd = pmd_offset(pud, addr); 39 pmd = pmd_offset(pud, addr);
40 if (pmd_none(*pmd)) 40 if (pmd_none(*pmd))
41 return -0x10UL; 41 return -0x10UL;
42 if (pmd_huge(*pmd)) { 42 if (pmd_large(*pmd)) {
43 if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO)) 43 if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO))
44 return -0x04UL; 44 return -0x04UL;
45 return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK); 45 return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK);
diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
index 60acb93a4680..1f5315d1215c 100644
--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -126,7 +126,7 @@ static inline int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr,
126 */ 126 */
127 if (pmd_none(pmd) || pmd_trans_splitting(pmd)) 127 if (pmd_none(pmd) || pmd_trans_splitting(pmd))
128 return 0; 128 return 0;
129 if (unlikely(pmd_huge(pmd))) { 129 if (unlikely(pmd_large(pmd))) {
130 if (!gup_huge_pmd(pmdp, pmd, addr, next, 130 if (!gup_huge_pmd(pmdp, pmd, addr, next,
131 write, pages, nr)) 131 write, pages, nr))
132 return 0; 132 return 0;
@@ -180,8 +180,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
180 addr = start; 180 addr = start;
181 len = (unsigned long) nr_pages << PAGE_SHIFT; 181 len = (unsigned long) nr_pages << PAGE_SHIFT;
182 end = start + len; 182 end = start + len;
183 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ, 183 if ((end < start) || (end > TASK_SIZE))
184 (void __user *)start, len)))
185 return 0; 184 return 0;
186 185
187 local_irq_save(flags); 186 local_irq_save(flags);
@@ -229,7 +228,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
229 addr = start; 228 addr = start;
230 len = (unsigned long) nr_pages << PAGE_SHIFT; 229 len = (unsigned long) nr_pages << PAGE_SHIFT;
231 end = start + len; 230 end = start + len;
232 if (end < start) 231 if ((end < start) || (end > TASK_SIZE))
233 goto slow_irqon; 232 goto slow_irqon;
234 233
235 /* 234 /*
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index b6b442b0d793..9f2edb5c5551 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -20,6 +20,7 @@ config SPARC
20 select HAVE_ARCH_TRACEHOOK 20 select HAVE_ARCH_TRACEHOOK
21 select SYSCTL_EXCEPTION_TRACE 21 select SYSCTL_EXCEPTION_TRACE
22 select ARCH_WANT_OPTIONAL_GPIOLIB 22 select ARCH_WANT_OPTIONAL_GPIOLIB
23 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
23 select RTC_CLASS 24 select RTC_CLASS
24 select RTC_DRV_M48T59 25 select RTC_DRV_M48T59
25 select HAVE_IRQ_WORK 26 select HAVE_IRQ_WORK
diff --git a/arch/sparc/crypto/Makefile b/arch/sparc/crypto/Makefile
index 6ae1ad5e502b..5d469d81761f 100644
--- a/arch/sparc/crypto/Makefile
+++ b/arch/sparc/crypto/Makefile
@@ -13,13 +13,13 @@ obj-$(CONFIG_CRYPTO_DES_SPARC64) += camellia-sparc64.o
13 13
14obj-$(CONFIG_CRYPTO_CRC32C_SPARC64) += crc32c-sparc64.o 14obj-$(CONFIG_CRYPTO_CRC32C_SPARC64) += crc32c-sparc64.o
15 15
16sha1-sparc64-y := sha1_asm.o sha1_glue.o crop_devid.o 16sha1-sparc64-y := sha1_asm.o sha1_glue.o
17sha256-sparc64-y := sha256_asm.o sha256_glue.o crop_devid.o 17sha256-sparc64-y := sha256_asm.o sha256_glue.o
18sha512-sparc64-y := sha512_asm.o sha512_glue.o crop_devid.o 18sha512-sparc64-y := sha512_asm.o sha512_glue.o
19md5-sparc64-y := md5_asm.o md5_glue.o crop_devid.o 19md5-sparc64-y := md5_asm.o md5_glue.o
20 20
21aes-sparc64-y := aes_asm.o aes_glue.o crop_devid.o 21aes-sparc64-y := aes_asm.o aes_glue.o
22des-sparc64-y := des_asm.o des_glue.o crop_devid.o 22des-sparc64-y := des_asm.o des_glue.o
23camellia-sparc64-y := camellia_asm.o camellia_glue.o crop_devid.o 23camellia-sparc64-y := camellia_asm.o camellia_glue.o
24 24
25crc32c-sparc64-y := crc32c_asm.o crc32c_glue.o crop_devid.o 25crc32c-sparc64-y := crc32c_asm.o crc32c_glue.o
diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c
index 8f1c9980f637..3965d1d36dfa 100644
--- a/arch/sparc/crypto/aes_glue.c
+++ b/arch/sparc/crypto/aes_glue.c
@@ -475,3 +475,5 @@ MODULE_LICENSE("GPL");
475MODULE_DESCRIPTION("AES Secure Hash Algorithm, sparc64 aes opcode accelerated"); 475MODULE_DESCRIPTION("AES Secure Hash Algorithm, sparc64 aes opcode accelerated");
476 476
477MODULE_ALIAS("aes"); 477MODULE_ALIAS("aes");
478
479#include "crop_devid.c"
diff --git a/arch/sparc/crypto/camellia_glue.c b/arch/sparc/crypto/camellia_glue.c
index 42905c084299..62c89af3fd3f 100644
--- a/arch/sparc/crypto/camellia_glue.c
+++ b/arch/sparc/crypto/camellia_glue.c
@@ -320,3 +320,5 @@ MODULE_LICENSE("GPL");
320MODULE_DESCRIPTION("Camellia Cipher Algorithm, sparc64 camellia opcode accelerated"); 320MODULE_DESCRIPTION("Camellia Cipher Algorithm, sparc64 camellia opcode accelerated");
321 321
322MODULE_ALIAS("aes"); 322MODULE_ALIAS("aes");
323
324#include "crop_devid.c"
diff --git a/arch/sparc/crypto/crc32c_glue.c b/arch/sparc/crypto/crc32c_glue.c
index 0bd89cea8d8e..5162fad912ce 100644
--- a/arch/sparc/crypto/crc32c_glue.c
+++ b/arch/sparc/crypto/crc32c_glue.c
@@ -177,3 +177,5 @@ MODULE_LICENSE("GPL");
177MODULE_DESCRIPTION("CRC32c (Castagnoli), sparc64 crc32c opcode accelerated"); 177MODULE_DESCRIPTION("CRC32c (Castagnoli), sparc64 crc32c opcode accelerated");
178 178
179MODULE_ALIAS("crc32c"); 179MODULE_ALIAS("crc32c");
180
181#include "crop_devid.c"
diff --git a/arch/sparc/crypto/des_glue.c b/arch/sparc/crypto/des_glue.c
index c4940c2d3073..41524cebcc49 100644
--- a/arch/sparc/crypto/des_glue.c
+++ b/arch/sparc/crypto/des_glue.c
@@ -527,3 +527,5 @@ MODULE_LICENSE("GPL");
527MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms, sparc64 des opcode accelerated"); 527MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms, sparc64 des opcode accelerated");
528 528
529MODULE_ALIAS("des"); 529MODULE_ALIAS("des");
530
531#include "crop_devid.c"
diff --git a/arch/sparc/crypto/md5_glue.c b/arch/sparc/crypto/md5_glue.c
index 603d723038ce..09a9ea1dfb69 100644
--- a/arch/sparc/crypto/md5_glue.c
+++ b/arch/sparc/crypto/md5_glue.c
@@ -186,3 +186,5 @@ MODULE_LICENSE("GPL");
186MODULE_DESCRIPTION("MD5 Secure Hash Algorithm, sparc64 md5 opcode accelerated"); 186MODULE_DESCRIPTION("MD5 Secure Hash Algorithm, sparc64 md5 opcode accelerated");
187 187
188MODULE_ALIAS("md5"); 188MODULE_ALIAS("md5");
189
190#include "crop_devid.c"
diff --git a/arch/sparc/crypto/sha1_glue.c b/arch/sparc/crypto/sha1_glue.c
index 2bbb20bee9f1..6cd5f29e1e0d 100644
--- a/arch/sparc/crypto/sha1_glue.c
+++ b/arch/sparc/crypto/sha1_glue.c
@@ -181,3 +181,5 @@ MODULE_LICENSE("GPL");
181MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, sparc64 sha1 opcode accelerated"); 181MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, sparc64 sha1 opcode accelerated");
182 182
183MODULE_ALIAS("sha1"); 183MODULE_ALIAS("sha1");
184
185#include "crop_devid.c"
diff --git a/arch/sparc/crypto/sha256_glue.c b/arch/sparc/crypto/sha256_glue.c
index 591e656bd891..04f555ab2680 100644
--- a/arch/sparc/crypto/sha256_glue.c
+++ b/arch/sparc/crypto/sha256_glue.c
@@ -239,3 +239,5 @@ MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithm, sparc64 sha256 op
239 239
240MODULE_ALIAS("sha224"); 240MODULE_ALIAS("sha224");
241MODULE_ALIAS("sha256"); 241MODULE_ALIAS("sha256");
242
243#include "crop_devid.c"
diff --git a/arch/sparc/crypto/sha512_glue.c b/arch/sparc/crypto/sha512_glue.c
index 486f0a2b7001..f04d1994d19a 100644
--- a/arch/sparc/crypto/sha512_glue.c
+++ b/arch/sparc/crypto/sha512_glue.c
@@ -224,3 +224,5 @@ MODULE_DESCRIPTION("SHA-384 and SHA-512 Secure Hash Algorithm, sparc64 sha512 op
224 224
225MODULE_ALIAS("sha384"); 225MODULE_ALIAS("sha384");
226MODULE_ALIAS("sha512"); 226MODULE_ALIAS("sha512");
227
228#include "crop_devid.c"
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index ce35a1cf1a20..be56a244c9cf 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -1,7 +1,7 @@
1/* atomic.h: Thankfully the V9 is at least reasonable for this 1/* atomic.h: Thankfully the V9 is at least reasonable for this
2 * stuff. 2 * stuff.
3 * 3 *
4 * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1996, 1997, 2000, 2012 David S. Miller (davem@redhat.com)
5 */ 5 */
6 6
7#ifndef __ARCH_SPARC64_ATOMIC__ 7#ifndef __ARCH_SPARC64_ATOMIC__
@@ -106,6 +106,8 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
106 106
107#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 107#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
108 108
109extern long atomic64_dec_if_positive(atomic64_t *v);
110
109/* Atomic operations are already serializing */ 111/* Atomic operations are already serializing */
110#define smp_mb__before_atomic_dec() barrier() 112#define smp_mb__before_atomic_dec() barrier()
111#define smp_mb__after_atomic_dec() barrier() 113#define smp_mb__after_atomic_dec() barrier()
diff --git a/arch/sparc/include/asm/backoff.h b/arch/sparc/include/asm/backoff.h
index db3af0d30fb1..4e02086b839c 100644
--- a/arch/sparc/include/asm/backoff.h
+++ b/arch/sparc/include/asm/backoff.h
@@ -1,6 +1,46 @@
1#ifndef _SPARC64_BACKOFF_H 1#ifndef _SPARC64_BACKOFF_H
2#define _SPARC64_BACKOFF_H 2#define _SPARC64_BACKOFF_H
3 3
4/* The macros in this file implement an exponential backoff facility
5 * for atomic operations.
6 *
7 * When multiple threads compete on an atomic operation, it is
8 * possible for one thread to be continually denied a successful
9 * completion of the compare-and-swap instruction. Heavily
10 * threaded cpu implementations like Niagara can compound this
11 * problem even further.
12 *
13 * When an atomic operation fails and needs to be retried, we spin a
14 * certain number of times. At each subsequent failure of the same
15 * operation we double the spin count, realizing an exponential
16 * backoff.
17 *
18 * When we spin, we try to use an operation that will cause the
19 * current cpu strand to block, and therefore make the core fully
20 * available to any other other runnable strands. There are two
21 * options, based upon cpu capabilities.
22 *
23 * On all cpus prior to SPARC-T4 we do three dummy reads of the
24 * condition code register. Each read blocks the strand for something
25 * between 40 and 50 cpu cycles.
26 *
27 * For SPARC-T4 and later we have a special "pause" instruction
28 * available. This is implemented using writes to register %asr27.
29 * The cpu will block the number of cycles written into the register,
30 * unless a disrupting trap happens first. SPARC-T4 specifically
31 * implements pause with a granularity of 8 cycles. Each strand has
32 * an internal pause counter which decrements every 8 cycles. So the
33 * chip shifts the %asr27 value down by 3 bits, and writes the result
34 * into the pause counter. If a value smaller than 8 is written, the
35 * chip blocks for 1 cycle.
36 *
37 * To achieve the same amount of backoff as the three %ccr reads give
38 * on earlier chips, we shift the backoff value up by 7 bits. (Three
39 * %ccr reads block for about 128 cycles, 1 << 7 == 128) We write the
40 * whole amount we want to block into the pause register, rather than
41 * loop writing 128 each time.
42 */
43
4#define BACKOFF_LIMIT (4 * 1024) 44#define BACKOFF_LIMIT (4 * 1024)
5 45
6#ifdef CONFIG_SMP 46#ifdef CONFIG_SMP
@@ -11,16 +51,25 @@
11#define BACKOFF_LABEL(spin_label, continue_label) \ 51#define BACKOFF_LABEL(spin_label, continue_label) \
12 spin_label 52 spin_label
13 53
14#define BACKOFF_SPIN(reg, tmp, label) \ 54#define BACKOFF_SPIN(reg, tmp, label) \
15 mov reg, tmp; \ 55 mov reg, tmp; \
1688: brnz,pt tmp, 88b; \ 5688: rd %ccr, %g0; \
17 sub tmp, 1, tmp; \ 57 rd %ccr, %g0; \
18 set BACKOFF_LIMIT, tmp; \ 58 rd %ccr, %g0; \
19 cmp reg, tmp; \ 59 .section .pause_3insn_patch,"ax";\
20 bg,pn %xcc, label; \ 60 .word 88b; \
21 nop; \ 61 sllx tmp, 7, tmp; \
22 ba,pt %xcc, label; \ 62 wr tmp, 0, %asr27; \
23 sllx reg, 1, reg; 63 clr tmp; \
64 .previous; \
65 brnz,pt tmp, 88b; \
66 sub tmp, 1, tmp; \
67 set BACKOFF_LIMIT, tmp; \
68 cmp reg, tmp; \
69 bg,pn %xcc, label; \
70 nop; \
71 ba,pt %xcc, label; \
72 sllx reg, 1, reg;
24 73
25#else 74#else
26 75
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
index cef99fbc0a21..830502fe62b4 100644
--- a/arch/sparc/include/asm/compat.h
+++ b/arch/sparc/include/asm/compat.h
@@ -232,9 +232,10 @@ static inline void __user *arch_compat_alloc_user_space(long len)
232 struct pt_regs *regs = current_thread_info()->kregs; 232 struct pt_regs *regs = current_thread_info()->kregs;
233 unsigned long usp = regs->u_regs[UREG_I6]; 233 unsigned long usp = regs->u_regs[UREG_I6];
234 234
235 if (!(test_thread_flag(TIF_32BIT))) 235 if (test_thread_64bit_stack(usp))
236 usp += STACK_BIAS; 236 usp += STACK_BIAS;
237 else 237
238 if (test_thread_flag(TIF_32BIT))
238 usp &= 0xffffffffUL; 239 usp &= 0xffffffffUL;
239 240
240 usp -= len; 241 usp -= len;
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
index 4e5a483122a0..721e25f0e2ea 100644
--- a/arch/sparc/include/asm/processor_64.h
+++ b/arch/sparc/include/asm/processor_64.h
@@ -196,7 +196,22 @@ extern unsigned long get_wchan(struct task_struct *task);
196#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc) 196#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)
197#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP]) 197#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP])
198 198
199#define cpu_relax() barrier() 199/* Please see the commentary in asm/backoff.h for a description of
200 * what these instructions are doing and how they have been choosen.
201 * To make a long story short, we are trying to yield the current cpu
202 * strand during busy loops.
203 */
204#define cpu_relax() asm volatile("\n99:\n\t" \
205 "rd %%ccr, %%g0\n\t" \
206 "rd %%ccr, %%g0\n\t" \
207 "rd %%ccr, %%g0\n\t" \
208 ".section .pause_3insn_patch,\"ax\"\n\t"\
209 ".word 99b\n\t" \
210 "wr %%g0, 128, %%asr27\n\t" \
211 "nop\n\t" \
212 "nop\n\t" \
213 ".previous" \
214 ::: "memory")
200 215
201/* Prefetch support. This is tuned for UltraSPARC-III and later. 216/* Prefetch support. This is tuned for UltraSPARC-III and later.
202 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has 217 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c28765110706..67c62578d170 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -63,5 +63,13 @@ extern char *of_console_options;
63extern void irq_trans_init(struct device_node *dp); 63extern void irq_trans_init(struct device_node *dp);
64extern char *build_path_component(struct device_node *dp); 64extern char *build_path_component(struct device_node *dp);
65 65
66/* SPARC has local implementations */
67extern int of_address_to_resource(struct device_node *dev, int index,
68 struct resource *r);
69#define of_address_to_resource of_address_to_resource
70
71void __iomem *of_iomap(struct device_node *node, int index);
72#define of_iomap of_iomap
73
66#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
67#endif /* _SPARC_PROM_H */ 75#endif /* _SPARC_PROM_H */
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index 4e2276631081..a3fe4dcc0aa6 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -259,6 +259,11 @@ static inline bool test_and_clear_restore_sigmask(void)
259 259
260#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) 260#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
261 261
262#define thread32_stack_is_64bit(__SP) (((__SP) & 0x1) != 0)
263#define test_thread_64bit_stack(__SP) \
264 ((test_thread_flag(TIF_32BIT) && !thread32_stack_is_64bit(__SP)) ? \
265 false : true)
266
262#endif /* !__ASSEMBLY__ */ 267#endif /* !__ASSEMBLY__ */
263 268
264#endif /* __KERNEL__ */ 269#endif /* __KERNEL__ */
diff --git a/arch/sparc/include/asm/ttable.h b/arch/sparc/include/asm/ttable.h
index 48f2807d3265..71b5a67522ab 100644
--- a/arch/sparc/include/asm/ttable.h
+++ b/arch/sparc/include/asm/ttable.h
@@ -372,7 +372,9 @@ etrap_spill_fixup_64bit: \
372 372
373/* Normal 32bit spill */ 373/* Normal 32bit spill */
374#define SPILL_2_GENERIC(ASI) \ 374#define SPILL_2_GENERIC(ASI) \
375 srl %sp, 0, %sp; \ 375 and %sp, 1, %g3; \
376 brnz,pn %g3, (. - (128 + 4)); \
377 srl %sp, 0, %sp; \
376 stwa %l0, [%sp + %g0] ASI; \ 378 stwa %l0, [%sp + %g0] ASI; \
377 mov 0x04, %g3; \ 379 mov 0x04, %g3; \
378 stwa %l1, [%sp + %g3] ASI; \ 380 stwa %l1, [%sp + %g3] ASI; \
@@ -398,14 +400,16 @@ etrap_spill_fixup_64bit: \
398 stwa %i6, [%g1 + %g0] ASI; \ 400 stwa %i6, [%g1 + %g0] ASI; \
399 stwa %i7, [%g1 + %g3] ASI; \ 401 stwa %i7, [%g1 + %g3] ASI; \
400 saved; \ 402 saved; \
401 retry; nop; nop; \ 403 retry; \
402 b,a,pt %xcc, spill_fixup_dax; \ 404 b,a,pt %xcc, spill_fixup_dax; \
403 b,a,pt %xcc, spill_fixup_mna; \ 405 b,a,pt %xcc, spill_fixup_mna; \
404 b,a,pt %xcc, spill_fixup; 406 b,a,pt %xcc, spill_fixup;
405 407
406#define SPILL_2_GENERIC_ETRAP \ 408#define SPILL_2_GENERIC_ETRAP \
407etrap_user_spill_32bit: \ 409etrap_user_spill_32bit: \
408 srl %sp, 0, %sp; \ 410 and %sp, 1, %g3; \
411 brnz,pn %g3, etrap_user_spill_64bit; \
412 srl %sp, 0, %sp; \
409 stwa %l0, [%sp + 0x00] %asi; \ 413 stwa %l0, [%sp + 0x00] %asi; \
410 stwa %l1, [%sp + 0x04] %asi; \ 414 stwa %l1, [%sp + 0x04] %asi; \
411 stwa %l2, [%sp + 0x08] %asi; \ 415 stwa %l2, [%sp + 0x08] %asi; \
@@ -427,7 +431,7 @@ etrap_user_spill_32bit: \
427 ba,pt %xcc, etrap_save; \ 431 ba,pt %xcc, etrap_save; \
428 wrpr %g1, %cwp; \ 432 wrpr %g1, %cwp; \
429 nop; nop; nop; nop; \ 433 nop; nop; nop; nop; \
430 nop; nop; nop; nop; \ 434 nop; nop; \
431 ba,a,pt %xcc, etrap_spill_fixup_32bit; \ 435 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
432 ba,a,pt %xcc, etrap_spill_fixup_32bit; \ 436 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
433 ba,a,pt %xcc, etrap_spill_fixup_32bit; 437 ba,a,pt %xcc, etrap_spill_fixup_32bit;
@@ -592,7 +596,9 @@ user_rtt_fill_64bit: \
592 596
593/* Normal 32bit fill */ 597/* Normal 32bit fill */
594#define FILL_2_GENERIC(ASI) \ 598#define FILL_2_GENERIC(ASI) \
595 srl %sp, 0, %sp; \ 599 and %sp, 1, %g3; \
600 brnz,pn %g3, (. - (128 + 4)); \
601 srl %sp, 0, %sp; \
596 lduwa [%sp + %g0] ASI, %l0; \ 602 lduwa [%sp + %g0] ASI, %l0; \
597 mov 0x04, %g2; \ 603 mov 0x04, %g2; \
598 mov 0x08, %g3; \ 604 mov 0x08, %g3; \
@@ -616,14 +622,16 @@ user_rtt_fill_64bit: \
616 lduwa [%g1 + %g3] ASI, %i6; \ 622 lduwa [%g1 + %g3] ASI, %i6; \
617 lduwa [%g1 + %g5] ASI, %i7; \ 623 lduwa [%g1 + %g5] ASI, %i7; \
618 restored; \ 624 restored; \
619 retry; nop; nop; nop; nop; \ 625 retry; nop; nop; \
620 b,a,pt %xcc, fill_fixup_dax; \ 626 b,a,pt %xcc, fill_fixup_dax; \
621 b,a,pt %xcc, fill_fixup_mna; \ 627 b,a,pt %xcc, fill_fixup_mna; \
622 b,a,pt %xcc, fill_fixup; 628 b,a,pt %xcc, fill_fixup;
623 629
624#define FILL_2_GENERIC_RTRAP \ 630#define FILL_2_GENERIC_RTRAP \
625user_rtt_fill_32bit: \ 631user_rtt_fill_32bit: \
626 srl %sp, 0, %sp; \ 632 and %sp, 1, %g3; \
633 brnz,pn %g3, user_rtt_fill_64bit; \
634 srl %sp, 0, %sp; \
627 lduwa [%sp + 0x00] %asi, %l0; \ 635 lduwa [%sp + 0x00] %asi, %l0; \
628 lduwa [%sp + 0x04] %asi, %l1; \ 636 lduwa [%sp + 0x04] %asi, %l1; \
629 lduwa [%sp + 0x08] %asi, %l2; \ 637 lduwa [%sp + 0x08] %asi, %l2; \
@@ -643,7 +651,7 @@ user_rtt_fill_32bit: \
643 ba,pt %xcc, user_rtt_pre_restore; \ 651 ba,pt %xcc, user_rtt_pre_restore; \
644 restored; \ 652 restored; \
645 nop; nop; nop; nop; nop; \ 653 nop; nop; nop; nop; nop; \
646 nop; nop; nop; nop; nop; \ 654 nop; nop; nop; \
647 ba,a,pt %xcc, user_rtt_fill_fixup; \ 655 ba,a,pt %xcc, user_rtt_fill_fixup; \
648 ba,a,pt %xcc, user_rtt_fill_fixup; \ 656 ba,a,pt %xcc, user_rtt_fill_fixup; \
649 ba,a,pt %xcc, user_rtt_fill_fixup; 657 ba,a,pt %xcc, user_rtt_fill_fixup;
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h
index 8974ef7ae920..cac719d1bc5c 100644
--- a/arch/sparc/include/uapi/asm/unistd.h
+++ b/arch/sparc/include/uapi/asm/unistd.h
@@ -405,8 +405,13 @@
405#define __NR_setns 337 405#define __NR_setns 337
406#define __NR_process_vm_readv 338 406#define __NR_process_vm_readv 338
407#define __NR_process_vm_writev 339 407#define __NR_process_vm_writev 339
408#define __NR_kern_features 340
409#define __NR_kcmp 341
408 410
409#define NR_syscalls 340 411#define NR_syscalls 342
412
413/* Bitmask values returned from kern_features system call. */
414#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
410 415
411#ifdef __32bit_syscall_numbers__ 416#ifdef __32bit_syscall_numbers__
412/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, 417/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index 0c218e4c0881..cc3c5cb47cda 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -59,6 +59,13 @@ struct popc_6insn_patch_entry {
59extern struct popc_6insn_patch_entry __popc_6insn_patch, 59extern struct popc_6insn_patch_entry __popc_6insn_patch,
60 __popc_6insn_patch_end; 60 __popc_6insn_patch_end;
61 61
62struct pause_patch_entry {
63 unsigned int addr;
64 unsigned int insns[3];
65};
66extern struct pause_patch_entry __pause_3insn_patch,
67 __pause_3insn_patch_end;
68
62extern void __init per_cpu_patch(void); 69extern void __init per_cpu_patch(void);
63extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, 70extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
64 struct sun4v_1insn_patch_entry *); 71 struct sun4v_1insn_patch_entry *);
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index f8b6eee40bde..87f60ee65433 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -56,11 +56,13 @@ static inline unsigned int leon_eirq_get(int cpu)
56static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc) 56static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)
57{ 57{
58 unsigned int eirq; 58 unsigned int eirq;
59 struct irq_bucket *p;
59 int cpu = sparc_leon3_cpuid(); 60 int cpu = sparc_leon3_cpuid();
60 61
61 eirq = leon_eirq_get(cpu); 62 eirq = leon_eirq_get(cpu);
62 if ((eirq & 0x10) && irq_map[eirq]->irq) /* bit4 tells if IRQ happened */ 63 p = irq_map[eirq];
63 generic_handle_irq(irq_map[eirq]->irq); 64 if ((eirq & 0x10) && p && p->irq) /* bit4 tells if IRQ happened */
65 generic_handle_irq(p->irq);
64} 66}
65 67
66/* The extended IRQ controller has been found, this function registers it */ 68/* The extended IRQ controller has been found, this function registers it */
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 885a8af74064..b5c38faa4ead 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1762,15 +1762,25 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1762 1762
1763 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL; 1763 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
1764 do { 1764 do {
1765 struct sparc_stackf32 *usf, sf;
1766 unsigned long pc; 1765 unsigned long pc;
1767 1766
1768 usf = (struct sparc_stackf32 *) ufp; 1767 if (thread32_stack_is_64bit(ufp)) {
1769 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1768 struct sparc_stackf *usf, sf;
1770 break;
1771 1769
1772 pc = sf.callers_pc; 1770 ufp += STACK_BIAS;
1773 ufp = (unsigned long)sf.fp; 1771 usf = (struct sparc_stackf *) ufp;
1772 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1773 break;
1774 pc = sf.callers_pc & 0xffffffff;
1775 ufp = ((unsigned long) sf.fp) & 0xffffffff;
1776 } else {
1777 struct sparc_stackf32 *usf, sf;
1778 usf = (struct sparc_stackf32 *) ufp;
1779 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1780 break;
1781 pc = sf.callers_pc;
1782 ufp = (unsigned long)sf.fp;
1783 }
1774 perf_callchain_store(entry, pc); 1784 perf_callchain_store(entry, pc);
1775 } while (entry->nr < PERF_MAX_STACK_DEPTH); 1785 } while (entry->nr < PERF_MAX_STACK_DEPTH);
1776} 1786}
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index d778248ef3f8..c6e0c2910043 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -452,13 +452,16 @@ void flush_thread(void)
452/* It's a bit more tricky when 64-bit tasks are involved... */ 452/* It's a bit more tricky when 64-bit tasks are involved... */
453static unsigned long clone_stackframe(unsigned long csp, unsigned long psp) 453static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
454{ 454{
455 bool stack_64bit = test_thread_64bit_stack(psp);
455 unsigned long fp, distance, rval; 456 unsigned long fp, distance, rval;
456 457
457 if (!(test_thread_flag(TIF_32BIT))) { 458 if (stack_64bit) {
458 csp += STACK_BIAS; 459 csp += STACK_BIAS;
459 psp += STACK_BIAS; 460 psp += STACK_BIAS;
460 __get_user(fp, &(((struct reg_window __user *)psp)->ins[6])); 461 __get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));
461 fp += STACK_BIAS; 462 fp += STACK_BIAS;
463 if (test_thread_flag(TIF_32BIT))
464 fp &= 0xffffffff;
462 } else 465 } else
463 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6])); 466 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
464 467
@@ -472,7 +475,7 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
472 rval = (csp - distance); 475 rval = (csp - distance);
473 if (copy_in_user((void __user *) rval, (void __user *) psp, distance)) 476 if (copy_in_user((void __user *) rval, (void __user *) psp, distance))
474 rval = 0; 477 rval = 0;
475 else if (test_thread_flag(TIF_32BIT)) { 478 else if (!stack_64bit) {
476 if (put_user(((u32)csp), 479 if (put_user(((u32)csp),
477 &(((struct reg_window32 __user *)rval)->ins[6]))) 480 &(((struct reg_window32 __user *)rval)->ins[6])))
478 rval = 0; 481 rval = 0;
@@ -507,18 +510,18 @@ void synchronize_user_stack(void)
507 510
508 flush_user_windows(); 511 flush_user_windows();
509 if ((window = get_thread_wsaved()) != 0) { 512 if ((window = get_thread_wsaved()) != 0) {
510 int winsize = sizeof(struct reg_window);
511 int bias = 0;
512
513 if (test_thread_flag(TIF_32BIT))
514 winsize = sizeof(struct reg_window32);
515 else
516 bias = STACK_BIAS;
517
518 window -= 1; 513 window -= 1;
519 do { 514 do {
520 unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
521 struct reg_window *rwin = &t->reg_window[window]; 515 struct reg_window *rwin = &t->reg_window[window];
516 int winsize = sizeof(struct reg_window);
517 unsigned long sp;
518
519 sp = t->rwbuf_stkptrs[window];
520
521 if (test_thread_64bit_stack(sp))
522 sp += STACK_BIAS;
523 else
524 winsize = sizeof(struct reg_window32);
522 525
523 if (!copy_to_user((char __user *)sp, rwin, winsize)) { 526 if (!copy_to_user((char __user *)sp, rwin, winsize)) {
524 shift_window_buffer(window, get_thread_wsaved() - 1, t); 527 shift_window_buffer(window, get_thread_wsaved() - 1, t);
@@ -544,13 +547,6 @@ void fault_in_user_windows(void)
544{ 547{
545 struct thread_info *t = current_thread_info(); 548 struct thread_info *t = current_thread_info();
546 unsigned long window; 549 unsigned long window;
547 int winsize = sizeof(struct reg_window);
548 int bias = 0;
549
550 if (test_thread_flag(TIF_32BIT))
551 winsize = sizeof(struct reg_window32);
552 else
553 bias = STACK_BIAS;
554 550
555 flush_user_windows(); 551 flush_user_windows();
556 window = get_thread_wsaved(); 552 window = get_thread_wsaved();
@@ -558,8 +554,16 @@ void fault_in_user_windows(void)
558 if (likely(window != 0)) { 554 if (likely(window != 0)) {
559 window -= 1; 555 window -= 1;
560 do { 556 do {
561 unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
562 struct reg_window *rwin = &t->reg_window[window]; 557 struct reg_window *rwin = &t->reg_window[window];
558 int winsize = sizeof(struct reg_window);
559 unsigned long sp;
560
561 sp = t->rwbuf_stkptrs[window];
562
563 if (test_thread_64bit_stack(sp))
564 sp += STACK_BIAS;
565 else
566 winsize = sizeof(struct reg_window32);
563 567
564 if (unlikely(sp & 0x7UL)) 568 if (unlikely(sp & 0x7UL))
565 stack_unaligned(sp); 569 stack_unaligned(sp);
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index 484dabac7045..7ff45e4ba681 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -151,7 +151,7 @@ static int regwindow64_get(struct task_struct *target,
151{ 151{
152 unsigned long rw_addr = regs->u_regs[UREG_I6]; 152 unsigned long rw_addr = regs->u_regs[UREG_I6];
153 153
154 if (test_tsk_thread_flag(current, TIF_32BIT)) { 154 if (!test_thread_64bit_stack(rw_addr)) {
155 struct reg_window32 win32; 155 struct reg_window32 win32;
156 int i; 156 int i;
157 157
@@ -176,7 +176,7 @@ static int regwindow64_set(struct task_struct *target,
176{ 176{
177 unsigned long rw_addr = regs->u_regs[UREG_I6]; 177 unsigned long rw_addr = regs->u_regs[UREG_I6];
178 178
179 if (test_tsk_thread_flag(current, TIF_32BIT)) { 179 if (!test_thread_64bit_stack(rw_addr)) {
180 struct reg_window32 win32; 180 struct reg_window32 win32;
181 int i; 181 int i;
182 182
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 0800e71d8a88..0eaf0059aaef 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -316,6 +316,25 @@ static void __init popc_patch(void)
316 } 316 }
317} 317}
318 318
319static void __init pause_patch(void)
320{
321 struct pause_patch_entry *p;
322
323 p = &__pause_3insn_patch;
324 while (p < &__pause_3insn_patch_end) {
325 unsigned long i, addr = p->addr;
326
327 for (i = 0; i < 3; i++) {
328 *(unsigned int *) (addr + (i * 4)) = p->insns[i];
329 wmb();
330 __asm__ __volatile__("flush %0"
331 : : "r" (addr + (i * 4)));
332 }
333
334 p++;
335 }
336}
337
319#ifdef CONFIG_SMP 338#ifdef CONFIG_SMP
320void __init boot_cpu_id_too_large(int cpu) 339void __init boot_cpu_id_too_large(int cpu)
321{ 340{
@@ -528,6 +547,8 @@ static void __init init_sparc64_elf_hwcap(void)
528 547
529 if (sparc64_elf_hwcap & AV_SPARC_POPC) 548 if (sparc64_elf_hwcap & AV_SPARC_POPC)
530 popc_patch(); 549 popc_patch();
550 if (sparc64_elf_hwcap & AV_SPARC_PAUSE)
551 pause_patch();
531} 552}
532 553
533void __init setup_arch(char **cmdline_p) 554void __init setup_arch(char **cmdline_p)
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 867de2f8189c..689e1ba62809 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -295,9 +295,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
295 err |= restore_fpu_state(regs, fpu_save); 295 err |= restore_fpu_state(regs, fpu_save);
296 296
297 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t)); 297 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t));
298 err |= do_sigaltstack(&sf->stack, NULL, (unsigned long)sf); 298 if (err || do_sigaltstack(&sf->stack, NULL, (unsigned long)sf) == -EFAULT)
299
300 if (err)
301 goto segv; 299 goto segv;
302 300
303 err |= __get_user(rwin_save, &sf->rwin_save); 301 err |= __get_user(rwin_save, &sf->rwin_save);
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 11c6c9603e71..878ef3d5fec5 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -751,3 +751,8 @@ int kernel_execve(const char *filename,
751 : "cc"); 751 : "cc");
752 return __res; 752 return __res;
753} 753}
754
755asmlinkage long sys_kern_features(void)
756{
757 return KERN_FEATURE_MIXED_MODE_STACK;
758}
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 63402f9e9f51..5147f574f125 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -85,3 +85,4 @@ sys_call_table:
85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
88/*340*/ .long sys_ni_syscall, sys_kcmp
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 3a58e0d66f51..1c9af9fa38e9 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -86,6 +86,7 @@ sys_call_table32:
86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init 86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init
87/*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime 87/*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime
88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev 88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev
89/*340*/ .word sys_kern_features, sys_kcmp
89 90
90#endif /* CONFIG_COMPAT */ 91#endif /* CONFIG_COMPAT */
91 92
@@ -163,3 +164,4 @@ sys_call_table:
163 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 164 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
164/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 165/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
165 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 166 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
167/*340*/ .word sys_kern_features, sys_kcmp
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index f81d038f7340..8201c25e7669 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -113,21 +113,24 @@ static inline long sign_extend_imm13(long imm)
113 113
114static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs) 114static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
115{ 115{
116 unsigned long value; 116 unsigned long value, fp;
117 117
118 if (reg < 16) 118 if (reg < 16)
119 return (!reg ? 0 : regs->u_regs[reg]); 119 return (!reg ? 0 : regs->u_regs[reg]);
120
121 fp = regs->u_regs[UREG_FP];
122
120 if (regs->tstate & TSTATE_PRIV) { 123 if (regs->tstate & TSTATE_PRIV) {
121 struct reg_window *win; 124 struct reg_window *win;
122 win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS); 125 win = (struct reg_window *)(fp + STACK_BIAS);
123 value = win->locals[reg - 16]; 126 value = win->locals[reg - 16];
124 } else if (test_thread_flag(TIF_32BIT)) { 127 } else if (!test_thread_64bit_stack(fp)) {
125 struct reg_window32 __user *win32; 128 struct reg_window32 __user *win32;
126 win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP])); 129 win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
127 get_user(value, &win32->locals[reg - 16]); 130 get_user(value, &win32->locals[reg - 16]);
128 } else { 131 } else {
129 struct reg_window __user *win; 132 struct reg_window __user *win;
130 win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS); 133 win = (struct reg_window __user *)(fp + STACK_BIAS);
131 get_user(value, &win->locals[reg - 16]); 134 get_user(value, &win->locals[reg - 16]);
132 } 135 }
133 return value; 136 return value;
@@ -135,19 +138,24 @@ static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
135 138
136static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs) 139static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
137{ 140{
141 unsigned long fp;
142
138 if (reg < 16) 143 if (reg < 16)
139 return &regs->u_regs[reg]; 144 return &regs->u_regs[reg];
145
146 fp = regs->u_regs[UREG_FP];
147
140 if (regs->tstate & TSTATE_PRIV) { 148 if (regs->tstate & TSTATE_PRIV) {
141 struct reg_window *win; 149 struct reg_window *win;
142 win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS); 150 win = (struct reg_window *)(fp + STACK_BIAS);
143 return &win->locals[reg - 16]; 151 return &win->locals[reg - 16];
144 } else if (test_thread_flag(TIF_32BIT)) { 152 } else if (!test_thread_64bit_stack(fp)) {
145 struct reg_window32 *win32; 153 struct reg_window32 *win32;
146 win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP])); 154 win32 = (struct reg_window32 *)((unsigned long)((u32)fp));
147 return (unsigned long *)&win32->locals[reg - 16]; 155 return (unsigned long *)&win32->locals[reg - 16];
148 } else { 156 } else {
149 struct reg_window *win; 157 struct reg_window *win;
150 win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS); 158 win = (struct reg_window *)(fp + STACK_BIAS);
151 return &win->locals[reg - 16]; 159 return &win->locals[reg - 16];
152 } 160 }
153} 161}
@@ -392,13 +400,15 @@ int handle_popc(u32 insn, struct pt_regs *regs)
392 if (rd) 400 if (rd)
393 regs->u_regs[rd] = ret; 401 regs->u_regs[rd] = ret;
394 } else { 402 } else {
395 if (test_thread_flag(TIF_32BIT)) { 403 unsigned long fp = regs->u_regs[UREG_FP];
404
405 if (!test_thread_64bit_stack(fp)) {
396 struct reg_window32 __user *win32; 406 struct reg_window32 __user *win32;
397 win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP])); 407 win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
398 put_user(ret, &win32->locals[rd - 16]); 408 put_user(ret, &win32->locals[rd - 16]);
399 } else { 409 } else {
400 struct reg_window __user *win; 410 struct reg_window __user *win;
401 win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS); 411 win = (struct reg_window __user *)(fp + STACK_BIAS);
402 put_user(ret, &win->locals[rd - 16]); 412 put_user(ret, &win->locals[rd - 16]);
403 } 413 }
404 } 414 }
@@ -554,7 +564,7 @@ void handle_ld_nf(u32 insn, struct pt_regs *regs)
554 reg[0] = 0; 564 reg[0] = 0;
555 if ((insn & 0x780000) == 0x180000) 565 if ((insn & 0x780000) == 0x180000)
556 reg[1] = 0; 566 reg[1] = 0;
557 } else if (test_thread_flag(TIF_32BIT)) { 567 } else if (!test_thread_64bit_stack(regs->u_regs[UREG_FP])) {
558 put_user(0, (int __user *) reg); 568 put_user(0, (int __user *) reg);
559 if ((insn & 0x780000) == 0x180000) 569 if ((insn & 0x780000) == 0x180000)
560 put_user(0, ((int __user *) reg) + 1); 570 put_user(0, ((int __user *) reg) + 1);
diff --git a/arch/sparc/kernel/visemul.c b/arch/sparc/kernel/visemul.c
index 08e074b7eb6a..c096c624ac4d 100644
--- a/arch/sparc/kernel/visemul.c
+++ b/arch/sparc/kernel/visemul.c
@@ -149,21 +149,24 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
149 149
150static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs) 150static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
151{ 151{
152 unsigned long value; 152 unsigned long value, fp;
153 153
154 if (reg < 16) 154 if (reg < 16)
155 return (!reg ? 0 : regs->u_regs[reg]); 155 return (!reg ? 0 : regs->u_regs[reg]);
156
157 fp = regs->u_regs[UREG_FP];
158
156 if (regs->tstate & TSTATE_PRIV) { 159 if (regs->tstate & TSTATE_PRIV) {
157 struct reg_window *win; 160 struct reg_window *win;
158 win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS); 161 win = (struct reg_window *)(fp + STACK_BIAS);
159 value = win->locals[reg - 16]; 162 value = win->locals[reg - 16];
160 } else if (test_thread_flag(TIF_32BIT)) { 163 } else if (!test_thread_64bit_stack(fp)) {
161 struct reg_window32 __user *win32; 164 struct reg_window32 __user *win32;
162 win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP])); 165 win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
163 get_user(value, &win32->locals[reg - 16]); 166 get_user(value, &win32->locals[reg - 16]);
164 } else { 167 } else {
165 struct reg_window __user *win; 168 struct reg_window __user *win;
166 win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS); 169 win = (struct reg_window __user *)(fp + STACK_BIAS);
167 get_user(value, &win->locals[reg - 16]); 170 get_user(value, &win->locals[reg - 16]);
168 } 171 }
169 return value; 172 return value;
@@ -172,16 +175,18 @@ static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
172static inline unsigned long __user *__fetch_reg_addr_user(unsigned int reg, 175static inline unsigned long __user *__fetch_reg_addr_user(unsigned int reg,
173 struct pt_regs *regs) 176 struct pt_regs *regs)
174{ 177{
178 unsigned long fp = regs->u_regs[UREG_FP];
179
175 BUG_ON(reg < 16); 180 BUG_ON(reg < 16);
176 BUG_ON(regs->tstate & TSTATE_PRIV); 181 BUG_ON(regs->tstate & TSTATE_PRIV);
177 182
178 if (test_thread_flag(TIF_32BIT)) { 183 if (!test_thread_64bit_stack(fp)) {
179 struct reg_window32 __user *win32; 184 struct reg_window32 __user *win32;
180 win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP])); 185 win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
181 return (unsigned long __user *)&win32->locals[reg - 16]; 186 return (unsigned long __user *)&win32->locals[reg - 16];
182 } else { 187 } else {
183 struct reg_window __user *win; 188 struct reg_window __user *win;
184 win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS); 189 win = (struct reg_window __user *)(fp + STACK_BIAS);
185 return &win->locals[reg - 16]; 190 return &win->locals[reg - 16];
186 } 191 }
187} 192}
@@ -204,7 +209,7 @@ static void store_reg(struct pt_regs *regs, unsigned long val, unsigned long rd)
204 } else { 209 } else {
205 unsigned long __user *rd_user = __fetch_reg_addr_user(rd, regs); 210 unsigned long __user *rd_user = __fetch_reg_addr_user(rd, regs);
206 211
207 if (test_thread_flag(TIF_32BIT)) 212 if (!test_thread_64bit_stack(regs->u_regs[UREG_FP]))
208 __put_user((u32)val, (u32 __user *)rd_user); 213 __put_user((u32)val, (u32 __user *)rd_user);
209 else 214 else
210 __put_user(val, rd_user); 215 __put_user(val, rd_user);
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 89c2c29f154b..0bacceb19150 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -132,6 +132,11 @@ SECTIONS
132 *(.popc_6insn_patch) 132 *(.popc_6insn_patch)
133 __popc_6insn_patch_end = .; 133 __popc_6insn_patch_end = .;
134 } 134 }
135 .pause_3insn_patch : {
136 __pause_3insn_patch = .;
137 *(.pause_3insn_patch)
138 __pause_3insn_patch_end = .;
139 }
135 PERCPU_SECTION(SMP_CACHE_BYTES) 140 PERCPU_SECTION(SMP_CACHE_BYTES)
136 141
137 . = ALIGN(PAGE_SIZE); 142 . = ALIGN(PAGE_SIZE);
diff --git a/arch/sparc/kernel/winfixup.S b/arch/sparc/kernel/winfixup.S
index a6b0863c27df..1e67ce958369 100644
--- a/arch/sparc/kernel/winfixup.S
+++ b/arch/sparc/kernel/winfixup.S
@@ -43,6 +43,8 @@ spill_fixup_mna:
43spill_fixup_dax: 43spill_fixup_dax:
44 TRAP_LOAD_THREAD_REG(%g6, %g1) 44 TRAP_LOAD_THREAD_REG(%g6, %g1)
45 ldx [%g6 + TI_FLAGS], %g1 45 ldx [%g6 + TI_FLAGS], %g1
46 andcc %sp, 0x1, %g0
47 movne %icc, 0, %g1
46 andcc %g1, _TIF_32BIT, %g0 48 andcc %g1, _TIF_32BIT, %g0
47 ldub [%g6 + TI_WSAVED], %g1 49 ldub [%g6 + TI_WSAVED], %g1
48 sll %g1, 3, %g3 50 sll %g1, 3, %g3
diff --git a/arch/sparc/lib/atomic_64.S b/arch/sparc/lib/atomic_64.S
index 4d502da3de78..85c233d0a340 100644
--- a/arch/sparc/lib/atomic_64.S
+++ b/arch/sparc/lib/atomic_64.S
@@ -1,6 +1,6 @@
1/* atomic.S: These things are too big to do inline. 1/* atomic.S: These things are too big to do inline.
2 * 2 *
3 * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net) 3 * Copyright (C) 1999, 2007 2012 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#include <linux/linkage.h> 6#include <linux/linkage.h>
@@ -117,3 +117,17 @@ ENTRY(atomic64_sub_ret) /* %o0 = decrement, %o1 = atomic_ptr */
117 sub %g1, %o0, %o0 117 sub %g1, %o0, %o0
1182: BACKOFF_SPIN(%o2, %o3, 1b) 1182: BACKOFF_SPIN(%o2, %o3, 1b)
119ENDPROC(atomic64_sub_ret) 119ENDPROC(atomic64_sub_ret)
120
121ENTRY(atomic64_dec_if_positive) /* %o0 = atomic_ptr */
122 BACKOFF_SETUP(%o2)
1231: ldx [%o0], %g1
124 brlez,pn %g1, 3f
125 sub %g1, 1, %g7
126 casx [%o0], %g1, %g7
127 cmp %g1, %g7
128 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
129 nop
1303: retl
131 sub %g1, 1, %o0
1322: BACKOFF_SPIN(%o2, %o3, 1b)
133ENDPROC(atomic64_dec_if_positive)
diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c
index ee31b884c61b..0c4e35e522fa 100644
--- a/arch/sparc/lib/ksyms.c
+++ b/arch/sparc/lib/ksyms.c
@@ -116,6 +116,7 @@ EXPORT_SYMBOL(atomic64_add);
116EXPORT_SYMBOL(atomic64_add_ret); 116EXPORT_SYMBOL(atomic64_add_ret);
117EXPORT_SYMBOL(atomic64_sub); 117EXPORT_SYMBOL(atomic64_sub);
118EXPORT_SYMBOL(atomic64_sub_ret); 118EXPORT_SYMBOL(atomic64_sub_ret);
119EXPORT_SYMBOL(atomic64_dec_if_positive);
119 120
120/* Atomic bit operations. */ 121/* Atomic bit operations. */
121EXPORT_SYMBOL(test_and_set_bit); 122EXPORT_SYMBOL(test_and_set_bit);
diff --git a/arch/sparc/math-emu/math_64.c b/arch/sparc/math-emu/math_64.c
index 1704068da928..034aadbff036 100644
--- a/arch/sparc/math-emu/math_64.c
+++ b/arch/sparc/math-emu/math_64.c
@@ -320,7 +320,7 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f, bool illegal_insn_trap)
320 XR = 0; 320 XR = 0;
321 else if (freg < 16) 321 else if (freg < 16)
322 XR = regs->u_regs[freg]; 322 XR = regs->u_regs[freg];
323 else if (test_thread_flag(TIF_32BIT)) { 323 else if (!test_thread_64bit_stack(regs->u_regs[UREG_FP])) {
324 struct reg_window32 __user *win32; 324 struct reg_window32 __user *win32;
325 flushw_user (); 325 flushw_user ();
326 win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP])); 326 win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index e5c5473e69ce..c4fbb21e802b 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -16,6 +16,8 @@ config UNICORE32
16 select ARCH_WANT_FRAME_POINTERS 16 select ARCH_WANT_FRAME_POINTERS
17 select GENERIC_IOMAP 17 select GENERIC_IOMAP
18 select MODULES_USE_ELF_REL 18 select MODULES_USE_ELF_REL
19 select GENERIC_KERNEL_THREAD
20 select GENERIC_KERNEL_EXECVE
19 help 21 help
20 UniCore-32 is 32-bit Instruction Set Architecture, 22 UniCore-32 is 32-bit Instruction Set Architecture,
21 including a series of low-power-consumption RISC chip 23 including a series of low-power-consumption RISC chip
@@ -64,6 +66,9 @@ config GENERIC_CALIBRATE_DELAY
64config ARCH_MAY_HAVE_PC_FDC 66config ARCH_MAY_HAVE_PC_FDC
65 bool 67 bool
66 68
69config ZONE_DMA
70 def_bool y
71
67config NEED_DMA_MAP_STATE 72config NEED_DMA_MAP_STATE
68 def_bool y 73 def_bool y
69 74
@@ -216,7 +221,7 @@ config PUV3_GPIO
216 bool 221 bool
217 depends on !ARCH_FPGA 222 depends on !ARCH_FPGA
218 select GENERIC_GPIO 223 select GENERIC_GPIO
219 select GPIO_SYSFS if EXPERIMENTAL 224 select GPIO_SYSFS
220 default y 225 default y
221 226
222if PUV3_NB0916 227if PUV3_NB0916
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild
index c910c9857e11..601e92f18af6 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm
2 1
3generic-y += atomic.h 2generic-y += atomic.h
4generic-y += auxvec.h 3generic-y += auxvec.h
diff --git a/arch/unicore32/include/asm/bug.h b/arch/unicore32/include/asm/bug.h
index b1ff8cadb086..93a56f3e2344 100644
--- a/arch/unicore32/include/asm/bug.h
+++ b/arch/unicore32/include/asm/bug.h
@@ -19,9 +19,4 @@ extern void die(const char *msg, struct pt_regs *regs, int err);
19extern void uc32_notify_die(const char *str, struct pt_regs *regs, 19extern void uc32_notify_die(const char *str, struct pt_regs *regs,
20 struct siginfo *info, unsigned long err, unsigned long trap); 20 struct siginfo *info, unsigned long err, unsigned long trap);
21 21
22extern asmlinkage void __backtrace(void);
23extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
24
25extern void __show_regs(struct pt_regs *);
26
27#endif /* __UNICORE_BUG_H__ */ 22#endif /* __UNICORE_BUG_H__ */
diff --git a/arch/unicore32/include/asm/cmpxchg.h b/arch/unicore32/include/asm/cmpxchg.h
index df4d5acfd19f..8e797ad4fa24 100644
--- a/arch/unicore32/include/asm/cmpxchg.h
+++ b/arch/unicore32/include/asm/cmpxchg.h
@@ -35,7 +35,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
35 : "memory", "cc"); 35 : "memory", "cc");
36 break; 36 break;
37 default: 37 default:
38 ret = __xchg_bad_pointer(); 38 __xchg_bad_pointer();
39 } 39 }
40 40
41 return ret; 41 return ret;
diff --git a/arch/unicore32/include/asm/kvm_para.h b/arch/unicore32/include/asm/kvm_para.h
deleted file mode 100644
index 14fab8f0b957..000000000000
--- a/arch/unicore32/include/asm/kvm_para.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kvm_para.h>
diff --git a/arch/unicore32/include/asm/processor.h b/arch/unicore32/include/asm/processor.h
index 14382cb09657..4eaa42167667 100644
--- a/arch/unicore32/include/asm/processor.h
+++ b/arch/unicore32/include/asm/processor.h
@@ -72,11 +72,6 @@ unsigned long get_wchan(struct task_struct *p);
72 72
73#define cpu_relax() barrier() 73#define cpu_relax() barrier()
74 74
75/*
76 * Create a new kernel thread
77 */
78extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
79
80#define task_pt_regs(p) \ 75#define task_pt_regs(p) \
81 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) 76 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
82 77
diff --git a/arch/unicore32/include/asm/ptrace.h b/arch/unicore32/include/asm/ptrace.h
index b9caf9b0997b..726749dab52f 100644
--- a/arch/unicore32/include/asm/ptrace.h
+++ b/arch/unicore32/include/asm/ptrace.h
@@ -12,80 +12,10 @@
12#ifndef __UNICORE_PTRACE_H__ 12#ifndef __UNICORE_PTRACE_H__
13#define __UNICORE_PTRACE_H__ 13#define __UNICORE_PTRACE_H__
14 14
15#define PTRACE_GET_THREAD_AREA 22 15#include <uapi/asm/ptrace.h>
16
17/*
18 * PSR bits
19 */
20#define USER_MODE 0x00000010
21#define REAL_MODE 0x00000011
22#define INTR_MODE 0x00000012
23#define PRIV_MODE 0x00000013
24#define ABRT_MODE 0x00000017
25#define EXTN_MODE 0x0000001b
26#define SUSR_MODE 0x0000001f
27#define MODE_MASK 0x0000001f
28#define PSR_R_BIT 0x00000040
29#define PSR_I_BIT 0x00000080
30#define PSR_V_BIT 0x10000000
31#define PSR_C_BIT 0x20000000
32#define PSR_Z_BIT 0x40000000
33#define PSR_S_BIT 0x80000000
34
35/*
36 * Groups of PSR bits
37 */
38#define PSR_f 0xff000000 /* Flags */
39#define PSR_c 0x000000ff /* Control */
40 16
41#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
42 18
43/*
44 * This struct defines the way the registers are stored on the
45 * stack during a system call. Note that sizeof(struct pt_regs)
46 * has to be a multiple of 8.
47 */
48struct pt_regs {
49 unsigned long uregs[34];
50};
51
52#define UCreg_asr uregs[32]
53#define UCreg_pc uregs[31]
54#define UCreg_lr uregs[30]
55#define UCreg_sp uregs[29]
56#define UCreg_ip uregs[28]
57#define UCreg_fp uregs[27]
58#define UCreg_26 uregs[26]
59#define UCreg_25 uregs[25]
60#define UCreg_24 uregs[24]
61#define UCreg_23 uregs[23]
62#define UCreg_22 uregs[22]
63#define UCreg_21 uregs[21]
64#define UCreg_20 uregs[20]
65#define UCreg_19 uregs[19]
66#define UCreg_18 uregs[18]
67#define UCreg_17 uregs[17]
68#define UCreg_16 uregs[16]
69#define UCreg_15 uregs[15]
70#define UCreg_14 uregs[14]
71#define UCreg_13 uregs[13]
72#define UCreg_12 uregs[12]
73#define UCreg_11 uregs[11]
74#define UCreg_10 uregs[10]
75#define UCreg_09 uregs[9]
76#define UCreg_08 uregs[8]
77#define UCreg_07 uregs[7]
78#define UCreg_06 uregs[6]
79#define UCreg_05 uregs[5]
80#define UCreg_04 uregs[4]
81#define UCreg_03 uregs[3]
82#define UCreg_02 uregs[2]
83#define UCreg_01 uregs[1]
84#define UCreg_00 uregs[0]
85#define UCreg_ORIG_00 uregs[33]
86
87#ifdef __KERNEL__
88
89#define user_mode(regs) \ 19#define user_mode(regs) \
90 (processor_mode(regs) == USER_MODE) 20 (processor_mode(regs) == USER_MODE)
91 21
@@ -125,9 +55,5 @@ static inline int valid_user_regs(struct pt_regs *regs)
125 55
126#define instruction_pointer(regs) ((regs)->UCreg_pc) 56#define instruction_pointer(regs) ((regs)->UCreg_pc)
127 57
128#endif /* __KERNEL__ */
129
130#endif /* __ASSEMBLY__ */ 58#endif /* __ASSEMBLY__ */
131
132#endif 59#endif
133
diff --git a/arch/unicore32/include/uapi/asm/Kbuild b/arch/unicore32/include/uapi/asm/Kbuild
index baebb3da1d44..0514d7ad6855 100644
--- a/arch/unicore32/include/uapi/asm/Kbuild
+++ b/arch/unicore32/include/uapi/asm/Kbuild
@@ -1,3 +1,10 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += byteorder.h
5header-y += kvm_para.h
6header-y += ptrace.h
7header-y += sigcontext.h
8header-y += unistd.h
9
10generic-y += kvm_para.h
diff --git a/arch/unicore32/include/asm/byteorder.h b/arch/unicore32/include/uapi/asm/byteorder.h
index ebe1b3fef3e3..ebe1b3fef3e3 100644
--- a/arch/unicore32/include/asm/byteorder.h
+++ b/arch/unicore32/include/uapi/asm/byteorder.h
diff --git a/arch/unicore32/include/uapi/asm/ptrace.h b/arch/unicore32/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000000..187aa2e98a53
--- /dev/null
+++ b/arch/unicore32/include/uapi/asm/ptrace.h
@@ -0,0 +1,90 @@
1/*
2 * linux/arch/unicore32/include/asm/ptrace.h
3 *
4 * Code specific to PKUnity SoC and UniCore ISA
5 *
6 * Copyright (C) 2001-2010 GUAN Xue-tao
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef _UAPI__UNICORE_PTRACE_H__
13#define _UAPI__UNICORE_PTRACE_H__
14
15#define PTRACE_GET_THREAD_AREA 22
16
17/*
18 * PSR bits
19 */
20#define USER_MODE 0x00000010
21#define REAL_MODE 0x00000011
22#define INTR_MODE 0x00000012
23#define PRIV_MODE 0x00000013
24#define ABRT_MODE 0x00000017
25#define EXTN_MODE 0x0000001b
26#define SUSR_MODE 0x0000001f
27#define MODE_MASK 0x0000001f
28#define PSR_R_BIT 0x00000040
29#define PSR_I_BIT 0x00000080
30#define PSR_V_BIT 0x10000000
31#define PSR_C_BIT 0x20000000
32#define PSR_Z_BIT 0x40000000
33#define PSR_S_BIT 0x80000000
34
35/*
36 * Groups of PSR bits
37 */
38#define PSR_f 0xff000000 /* Flags */
39#define PSR_c 0x000000ff /* Control */
40
41#ifndef __ASSEMBLY__
42
43/*
44 * This struct defines the way the registers are stored on the
45 * stack during a system call. Note that sizeof(struct pt_regs)
46 * has to be a multiple of 8.
47 */
48struct pt_regs {
49 unsigned long uregs[34];
50};
51
52#define UCreg_asr uregs[32]
53#define UCreg_pc uregs[31]
54#define UCreg_lr uregs[30]
55#define UCreg_sp uregs[29]
56#define UCreg_ip uregs[28]
57#define UCreg_fp uregs[27]
58#define UCreg_26 uregs[26]
59#define UCreg_25 uregs[25]
60#define UCreg_24 uregs[24]
61#define UCreg_23 uregs[23]
62#define UCreg_22 uregs[22]
63#define UCreg_21 uregs[21]
64#define UCreg_20 uregs[20]
65#define UCreg_19 uregs[19]
66#define UCreg_18 uregs[18]
67#define UCreg_17 uregs[17]
68#define UCreg_16 uregs[16]
69#define UCreg_15 uregs[15]
70#define UCreg_14 uregs[14]
71#define UCreg_13 uregs[13]
72#define UCreg_12 uregs[12]
73#define UCreg_11 uregs[11]
74#define UCreg_10 uregs[10]
75#define UCreg_09 uregs[9]
76#define UCreg_08 uregs[8]
77#define UCreg_07 uregs[7]
78#define UCreg_06 uregs[6]
79#define UCreg_05 uregs[5]
80#define UCreg_04 uregs[4]
81#define UCreg_03 uregs[3]
82#define UCreg_02 uregs[2]
83#define UCreg_01 uregs[1]
84#define UCreg_00 uregs[0]
85#define UCreg_ORIG_00 uregs[33]
86
87
88#endif /* __ASSEMBLY__ */
89
90#endif /* _UAPI__UNICORE_PTRACE_H__ */
diff --git a/arch/unicore32/include/asm/sigcontext.h b/arch/unicore32/include/uapi/asm/sigcontext.h
index 6a2d7671c052..6a2d7671c052 100644
--- a/arch/unicore32/include/asm/sigcontext.h
+++ b/arch/unicore32/include/uapi/asm/sigcontext.h
diff --git a/arch/unicore32/include/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h
index 2abcf61c615d..d18a3be89b38 100644
--- a/arch/unicore32/include/asm/unistd.h
+++ b/arch/unicore32/include/uapi/asm/unistd.h
@@ -12,3 +12,4 @@
12 12
13/* Use the standard ABI for syscalls. */ 13/* Use the standard ABI for syscalls. */
14#include <asm-generic/unistd.h> 14#include <asm-generic/unistd.h>
15#define __ARCH_WANT_SYS_EXECVE
diff --git a/arch/unicore32/kernel/entry.S b/arch/unicore32/kernel/entry.S
index dcb87ab19ddd..7049350c790f 100644
--- a/arch/unicore32/kernel/entry.S
+++ b/arch/unicore32/kernel/entry.S
@@ -573,17 +573,16 @@ ENDPROC(ret_to_user)
573 */ 573 */
574ENTRY(ret_from_fork) 574ENTRY(ret_from_fork)
575 b.l schedule_tail 575 b.l schedule_tail
576 get_thread_info tsk
577 ldw r1, [tsk+], #TI_FLAGS @ check for syscall tracing
578 mov why, #1
579 cand.a r1, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
580 beq ret_slow_syscall
581 mov r1, sp
582 mov r0, #1 @ trace exit [IP = 1]
583 b.l syscall_trace
584 b ret_slow_syscall 576 b ret_slow_syscall
585ENDPROC(ret_from_fork) 577ENDPROC(ret_from_fork)
586 578
579ENTRY(ret_from_kernel_thread)
580 b.l schedule_tail
581 mov r0, r5
582 adr lr, ret_slow_syscall
583 mov pc, r4
584ENDPROC(ret_from_kernel_thread)
585
587/*============================================================================= 586/*=============================================================================
588 * SWI handler 587 * SWI handler
589 *----------------------------------------------------------------------------- 588 *-----------------------------------------------------------------------------
@@ -669,11 +668,6 @@ __cr_alignment:
669#endif 668#endif
670 .ltorg 669 .ltorg
671 670
672ENTRY(sys_execve)
673 add r3, sp, #S_OFF
674 b __sys_execve
675ENDPROC(sys_execve)
676
677ENTRY(sys_clone) 671ENTRY(sys_clone)
678 add ip, sp, #S_OFF 672 add ip, sp, #S_OFF
679 stw ip, [sp+], #4 673 stw ip, [sp+], #4
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index b008586dad75..a8fe265ce2c0 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -258,6 +258,7 @@ void release_thread(struct task_struct *dead_task)
258} 258}
259 259
260asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 260asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
261asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread");
261 262
262int 263int
263copy_thread(unsigned long clone_flags, unsigned long stack_start, 264copy_thread(unsigned long clone_flags, unsigned long stack_start,
@@ -266,17 +267,22 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
266 struct thread_info *thread = task_thread_info(p); 267 struct thread_info *thread = task_thread_info(p);
267 struct pt_regs *childregs = task_pt_regs(p); 268 struct pt_regs *childregs = task_pt_regs(p);
268 269
269 *childregs = *regs;
270 childregs->UCreg_00 = 0;
271 childregs->UCreg_sp = stack_start;
272
273 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save)); 270 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
274 thread->cpu_context.sp = (unsigned long)childregs; 271 thread->cpu_context.sp = (unsigned long)childregs;
275 thread->cpu_context.pc = (unsigned long)ret_from_fork; 272 if (unlikely(!regs)) {
276 273 thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread;
277 if (clone_flags & CLONE_SETTLS) 274 thread->cpu_context.r4 = stack_start;
278 childregs->UCreg_16 = regs->UCreg_03; 275 thread->cpu_context.r5 = stk_sz;
276 memset(childregs, 0, sizeof(struct pt_regs));
277 } else {
278 thread->cpu_context.pc = (unsigned long)ret_from_fork;
279 *childregs = *regs;
280 childregs->UCreg_00 = 0;
281 childregs->UCreg_sp = stack_start;
279 282
283 if (clone_flags & CLONE_SETTLS)
284 childregs->UCreg_16 = regs->UCreg_03;
285 }
280 return 0; 286 return 0;
281} 287}
282 288
@@ -305,42 +311,6 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fp)
305} 311}
306EXPORT_SYMBOL(dump_fpu); 312EXPORT_SYMBOL(dump_fpu);
307 313
308/*
309 * Shuffle the argument into the correct register before calling the
310 * thread function. r1 is the thread argument, r2 is the pointer to
311 * the thread function, and r3 points to the exit function.
312 */
313asm(".pushsection .text\n"
314" .align\n"
315" .type kernel_thread_helper, #function\n"
316"kernel_thread_helper:\n"
317" mov.a asr, r7\n"
318" mov r0, r4\n"
319" mov lr, r6\n"
320" mov pc, r5\n"
321" .size kernel_thread_helper, . - kernel_thread_helper\n"
322" .popsection");
323
324/*
325 * Create a kernel thread.
326 */
327pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
328{
329 struct pt_regs regs;
330
331 memset(&regs, 0, sizeof(regs));
332
333 regs.UCreg_04 = (unsigned long)arg;
334 regs.UCreg_05 = (unsigned long)fn;
335 regs.UCreg_06 = (unsigned long)do_exit;
336 regs.UCreg_07 = PRIV_MODE;
337 regs.UCreg_pc = (unsigned long)kernel_thread_helper;
338 regs.UCreg_asr = regs.UCreg_07 | PSR_I_BIT;
339
340 return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
341}
342EXPORT_SYMBOL(kernel_thread);
343
344unsigned long get_wchan(struct task_struct *p) 314unsigned long get_wchan(struct task_struct *p)
345{ 315{
346 struct stackframe frame; 316 struct stackframe frame;
diff --git a/arch/unicore32/kernel/setup.h b/arch/unicore32/kernel/setup.h
index f23955028a18..30f749da8f73 100644
--- a/arch/unicore32/kernel/setup.h
+++ b/arch/unicore32/kernel/setup.h
@@ -30,4 +30,10 @@ extern char __vectors_start[], __vectors_end[];
30extern void kernel_thread_helper(void); 30extern void kernel_thread_helper(void);
31 31
32extern void __init early_signal_init(void); 32extern void __init early_signal_init(void);
33
34extern asmlinkage void __backtrace(void);
35extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
36
37extern void __show_regs(struct pt_regs *);
38
33#endif 39#endif
diff --git a/arch/unicore32/kernel/sys.c b/arch/unicore32/kernel/sys.c
index fabdee96110b..9680134b31f0 100644
--- a/arch/unicore32/kernel/sys.c
+++ b/arch/unicore32/kernel/sys.c
@@ -42,69 +42,6 @@ asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp,
42 parent_tid, child_tid); 42 parent_tid, child_tid);
43} 43}
44 44
45/* sys_execve() executes a new program.
46 * This is called indirectly via a small wrapper
47 */
48asmlinkage long __sys_execve(const char __user *filename,
49 const char __user *const __user *argv,
50 const char __user *const __user *envp,
51 struct pt_regs *regs)
52{
53 int error;
54 struct filename *fn;
55
56 fn = getname(filename);
57 error = PTR_ERR(fn);
58 if (IS_ERR(fn))
59 goto out;
60 error = do_execve(fn->name, argv, envp, regs);
61 putname(fn);
62out:
63 return error;
64}
65
66int kernel_execve(const char *filename,
67 const char *const argv[],
68 const char *const envp[])
69{
70 struct pt_regs regs;
71 int ret;
72
73 memset(&regs, 0, sizeof(struct pt_regs));
74 ret = do_execve(filename,
75 (const char __user *const __user *)argv,
76 (const char __user *const __user *)envp, &regs);
77 if (ret < 0)
78 goto out;
79
80 /*
81 * Save argc to the register structure for userspace.
82 */
83 regs.UCreg_00 = ret;
84
85 /*
86 * We were successful. We won't be returning to our caller, but
87 * instead to user space by manipulating the kernel stack.
88 */
89 asm("add r0, %0, %1\n\t"
90 "mov r1, %2\n\t"
91 "mov r2, %3\n\t"
92 "mov r22, #0\n\t" /* not a syscall */
93 "mov r23, %0\n\t" /* thread structure */
94 "b.l memmove\n\t" /* copy regs to top of stack */
95 "mov sp, r0\n\t" /* reposition stack pointer */
96 "b ret_to_user"
97 :
98 : "r" (current_thread_info()),
99 "Ir" (THREAD_START_SP - sizeof(regs)),
100 "r" (&regs),
101 "Ir" (sizeof(regs))
102 : "r0", "r1", "r2", "r3", "ip", "lr", "memory");
103
104 out:
105 return ret;
106}
107
108/* Note: used by the compat code even in 64-bit Linux. */ 45/* Note: used by the compat code even in 64-bit Linux. */
109SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, 46SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
110 unsigned long, prot, unsigned long, flags, 47 unsigned long, prot, unsigned long, flags,
diff --git a/arch/unicore32/mm/fault.c b/arch/unicore32/mm/fault.c
index 2eeb9c04cab0..f9b5c10bccee 100644
--- a/arch/unicore32/mm/fault.c
+++ b/arch/unicore32/mm/fault.c
@@ -168,7 +168,7 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
168} 168}
169 169
170static int __do_pf(struct mm_struct *mm, unsigned long addr, unsigned int fsr, 170static int __do_pf(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
171 struct task_struct *tsk) 171 unsigned int flags, struct task_struct *tsk)
172{ 172{
173 struct vm_area_struct *vma; 173 struct vm_area_struct *vma;
174 int fault; 174 int fault;
@@ -194,14 +194,7 @@ good_area:
194 * If for any reason at all we couldn't handle the fault, make 194 * If for any reason at all we couldn't handle the fault, make
195 * sure we exit gracefully rather than endlessly redo the fault. 195 * sure we exit gracefully rather than endlessly redo the fault.
196 */ 196 */
197 fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, 197 fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
198 (!(fsr ^ 0x12)) ? FAULT_FLAG_WRITE : 0);
199 if (unlikely(fault & VM_FAULT_ERROR))
200 return fault;
201 if (fault & VM_FAULT_MAJOR)
202 tsk->maj_flt++;
203 else
204 tsk->min_flt++;
205 return fault; 198 return fault;
206 199
207check_stack: 200check_stack:
@@ -216,6 +209,8 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
216 struct task_struct *tsk; 209 struct task_struct *tsk;
217 struct mm_struct *mm; 210 struct mm_struct *mm;
218 int fault, sig, code; 211 int fault, sig, code;
212 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
213 ((!(fsr ^ 0x12)) ? FAULT_FLAG_WRITE : 0);
219 214
220 tsk = current; 215 tsk = current;
221 mm = tsk->mm; 216 mm = tsk->mm;
@@ -236,6 +231,7 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
236 if (!user_mode(regs) 231 if (!user_mode(regs)
237 && !search_exception_tables(regs->UCreg_pc)) 232 && !search_exception_tables(regs->UCreg_pc))
238 goto no_context; 233 goto no_context;
234retry:
239 down_read(&mm->mmap_sem); 235 down_read(&mm->mmap_sem);
240 } else { 236 } else {
241 /* 237 /*
@@ -251,7 +247,28 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
251#endif 247#endif
252 } 248 }
253 249
254 fault = __do_pf(mm, addr, fsr, tsk); 250 fault = __do_pf(mm, addr, fsr, flags, tsk);
251
252 /* If we need to retry but a fatal signal is pending, handle the
253 * signal first. We do not need to release the mmap_sem because
254 * it would already be released in __lock_page_or_retry in
255 * mm/filemap.c. */
256 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
257 return 0;
258
259 if (!(fault & VM_FAULT_ERROR) && (flags & FAULT_FLAG_ALLOW_RETRY)) {
260 if (fault & VM_FAULT_MAJOR)
261 tsk->maj_flt++;
262 else
263 tsk->min_flt++;
264 if (fault & VM_FAULT_RETRY) {
265 /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
266 * of starvation. */
267 flags &= ~FAULT_FLAG_ALLOW_RETRY;
268 goto retry;
269 }
270 }
271
255 up_read(&mm->mmap_sem); 272 up_read(&mm->mmap_sem);
256 273
257 /* 274 /*
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index c760e073963e..e87b0cac14b5 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -12,6 +12,8 @@
12#include <asm/setup.h> 12#include <asm/setup.h>
13#include <asm/desc.h> 13#include <asm/desc.h>
14 14
15#undef memcpy /* Use memcpy from misc.c */
16
15#include "eboot.h" 17#include "eboot.h"
16 18
17static efi_system_table_t *sys_table; 19static efi_system_table_t *sys_table;
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 2a017441b8b2..8c132a625b94 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -476,6 +476,3 @@ die:
476setup_corrupt: 476setup_corrupt:
477 .byte 7 477 .byte 7
478 .string "No setup signature found...\n" 478 .string "No setup signature found...\n"
479
480 .data
481dummy: .long 0
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index dcfde52979c3..19f16ebaf4fa 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -205,21 +205,14 @@ static inline bool user_64bit_mode(struct pt_regs *regs)
205} 205}
206#endif 206#endif
207 207
208/*
209 * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
210 * when it traps. The previous stack will be directly underneath the saved
211 * registers, and 'sp/ss' won't even have been saved. Thus the '&regs->sp'.
212 *
213 * This is valid only for kernel mode traps.
214 */
215static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
216{
217#ifdef CONFIG_X86_32 208#ifdef CONFIG_X86_32
218 return (unsigned long)(&regs->sp); 209extern unsigned long kernel_stack_pointer(struct pt_regs *regs);
219#else 210#else
211static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
212{
220 return regs->sp; 213 return regs->sp;
221#endif
222} 214}
215#endif
223 216
224#define GET_IP(regs) ((regs)->ip) 217#define GET_IP(regs) ((regs)->ip)
225#define GET_FP(regs) ((regs)->bp) 218#define GET_FP(regs) ((regs)->bp)
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 59c226d120cd..c20d1ce62dc6 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -359,18 +359,14 @@ HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
359 return _hypercall4(int, update_va_mapping, va, 359 return _hypercall4(int, update_va_mapping, va,
360 new_val.pte, new_val.pte >> 32, flags); 360 new_val.pte, new_val.pte >> 32, flags);
361} 361}
362extern int __must_check xen_event_channel_op_compat(int, void *);
362 363
363static inline int 364static inline int
364HYPERVISOR_event_channel_op(int cmd, void *arg) 365HYPERVISOR_event_channel_op(int cmd, void *arg)
365{ 366{
366 int rc = _hypercall2(int, event_channel_op, cmd, arg); 367 int rc = _hypercall2(int, event_channel_op, cmd, arg);
367 if (unlikely(rc == -ENOSYS)) { 368 if (unlikely(rc == -ENOSYS))
368 struct evtchn_op op; 369 rc = xen_event_channel_op_compat(cmd, arg);
369 op.cmd = cmd;
370 memcpy(&op.u, arg, sizeof(op.u));
371 rc = _hypercall1(int, event_channel_op_compat, &op);
372 memcpy(arg, &op.u, sizeof(op.u));
373 }
374 return rc; 370 return rc;
375} 371}
376 372
@@ -386,17 +382,14 @@ HYPERVISOR_console_io(int cmd, int count, char *str)
386 return _hypercall3(int, console_io, cmd, count, str); 382 return _hypercall3(int, console_io, cmd, count, str);
387} 383}
388 384
385extern int __must_check HYPERVISOR_physdev_op_compat(int, void *);
386
389static inline int 387static inline int
390HYPERVISOR_physdev_op(int cmd, void *arg) 388HYPERVISOR_physdev_op(int cmd, void *arg)
391{ 389{
392 int rc = _hypercall2(int, physdev_op, cmd, arg); 390 int rc = _hypercall2(int, physdev_op, cmd, arg);
393 if (unlikely(rc == -ENOSYS)) { 391 if (unlikely(rc == -ENOSYS))
394 struct physdev_op op; 392 rc = HYPERVISOR_physdev_op_compat(cmd, arg);
395 op.cmd = cmd;
396 memcpy(&op.u, arg, sizeof(op.u));
397 rc = _hypercall1(int, physdev_op_compat, &op);
398 memcpy(arg, &op.u, sizeof(op.u));
399 }
400 return rc; 393 return rc;
401} 394}
402 395
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f7e98a2c0d12..1b7d1656a042 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -631,6 +631,20 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
631 } 631 }
632 } 632 }
633 633
634 /*
635 * The way access filter has a performance penalty on some workloads.
636 * Disable it on the affected CPUs.
637 */
638 if ((c->x86 == 0x15) &&
639 (c->x86_model >= 0x02) && (c->x86_model < 0x20)) {
640 u64 val;
641
642 if (!rdmsrl_safe(0xc0011021, &val) && !(val & 0x1E)) {
643 val |= 0x1E;
644 wrmsrl_safe(0xc0011021, val);
645 }
646 }
647
634 cpu_detect_cache_sizes(c); 648 cpu_detect_cache_sizes(c);
635 649
636 /* Multi core CPU? */ 650 /* Multi core CPU? */
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 698b6ec12e0f..1ac581f38dfa 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Written by Jacob Shin - AMD, Inc. 7 * Written by Jacob Shin - AMD, Inc.
8 * 8 *
9 * Support: borislav.petkov@amd.com 9 * Maintained by: Borislav Petkov <bp@alien8.de>
10 * 10 *
11 * April 2006 11 * April 2006
12 * - added support for AMD Family 0x10 processors 12 * - added support for AMD Family 0x10 processors
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 5f88abf07e9c..4f9a3cbfc4a3 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -285,34 +285,39 @@ void cmci_clear(void)
285 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); 285 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
286} 286}
287 287
288static long cmci_rediscover_work_func(void *arg)
289{
290 int banks;
291
292 /* Recheck banks in case CPUs don't all have the same */
293 if (cmci_supported(&banks))
294 cmci_discover(banks);
295
296 return 0;
297}
298
288/* 299/*
289 * After a CPU went down cycle through all the others and rediscover 300 * After a CPU went down cycle through all the others and rediscover
290 * Must run in process context. 301 * Must run in process context.
291 */ 302 */
292void cmci_rediscover(int dying) 303void cmci_rediscover(int dying)
293{ 304{
294 int banks; 305 int cpu, banks;
295 int cpu;
296 cpumask_var_t old;
297 306
298 if (!cmci_supported(&banks)) 307 if (!cmci_supported(&banks))
299 return; 308 return;
300 if (!alloc_cpumask_var(&old, GFP_KERNEL))
301 return;
302 cpumask_copy(old, &current->cpus_allowed);
303 309
304 for_each_online_cpu(cpu) { 310 for_each_online_cpu(cpu) {
305 if (cpu == dying) 311 if (cpu == dying)
306 continue; 312 continue;
307 if (set_cpus_allowed_ptr(current, cpumask_of(cpu))) 313
314 if (cpu == smp_processor_id()) {
315 cmci_rediscover_work_func(NULL);
308 continue; 316 continue;
309 /* Recheck banks in case CPUs don't all have the same */ 317 }
310 if (cmci_supported(&banks))
311 cmci_discover(banks);
312 }
313 318
314 set_cpus_allowed_ptr(current, old); 319 work_on_cpu(cpu, cmci_rediscover_work_func, NULL);
315 free_cpumask_var(old); 320 }
316} 321}
317 322
318/* 323/*
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index b51b2c7ee51f..1328fe49a3f1 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -995,8 +995,8 @@ END(interrupt)
995 */ 995 */
996 .p2align CONFIG_X86_L1_CACHE_SHIFT 996 .p2align CONFIG_X86_L1_CACHE_SHIFT
997common_interrupt: 997common_interrupt:
998 ASM_CLAC
999 XCPT_FRAME 998 XCPT_FRAME
999 ASM_CLAC
1000 addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */ 1000 addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */
1001 interrupt do_IRQ 1001 interrupt do_IRQ
1002 /* 0(%rsp): old_rsp-ARGOFFSET */ 1002 /* 0(%rsp): old_rsp-ARGOFFSET */
@@ -1135,8 +1135,8 @@ END(common_interrupt)
1135 */ 1135 */
1136.macro apicinterrupt num sym do_sym 1136.macro apicinterrupt num sym do_sym
1137ENTRY(\sym) 1137ENTRY(\sym)
1138 ASM_CLAC
1139 INTR_FRAME 1138 INTR_FRAME
1139 ASM_CLAC
1140 pushq_cfi $~(\num) 1140 pushq_cfi $~(\num)
1141.Lcommon_\sym: 1141.Lcommon_\sym:
1142 interrupt \do_sym 1142 interrupt \do_sym
@@ -1190,8 +1190,8 @@ apicinterrupt IRQ_WORK_VECTOR \
1190 */ 1190 */
1191.macro zeroentry sym do_sym 1191.macro zeroentry sym do_sym
1192ENTRY(\sym) 1192ENTRY(\sym)
1193 ASM_CLAC
1194 INTR_FRAME 1193 INTR_FRAME
1194 ASM_CLAC
1195 PARAVIRT_ADJUST_EXCEPTION_FRAME 1195 PARAVIRT_ADJUST_EXCEPTION_FRAME
1196 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ 1196 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
1197 subq $ORIG_RAX-R15, %rsp 1197 subq $ORIG_RAX-R15, %rsp
@@ -1208,8 +1208,8 @@ END(\sym)
1208 1208
1209.macro paranoidzeroentry sym do_sym 1209.macro paranoidzeroentry sym do_sym
1210ENTRY(\sym) 1210ENTRY(\sym)
1211 ASM_CLAC
1212 INTR_FRAME 1211 INTR_FRAME
1212 ASM_CLAC
1213 PARAVIRT_ADJUST_EXCEPTION_FRAME 1213 PARAVIRT_ADJUST_EXCEPTION_FRAME
1214 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ 1214 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
1215 subq $ORIG_RAX-R15, %rsp 1215 subq $ORIG_RAX-R15, %rsp
@@ -1227,8 +1227,8 @@ END(\sym)
1227#define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8) 1227#define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8)
1228.macro paranoidzeroentry_ist sym do_sym ist 1228.macro paranoidzeroentry_ist sym do_sym ist
1229ENTRY(\sym) 1229ENTRY(\sym)
1230 ASM_CLAC
1231 INTR_FRAME 1230 INTR_FRAME
1231 ASM_CLAC
1232 PARAVIRT_ADJUST_EXCEPTION_FRAME 1232 PARAVIRT_ADJUST_EXCEPTION_FRAME
1233 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ 1233 pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
1234 subq $ORIG_RAX-R15, %rsp 1234 subq $ORIG_RAX-R15, %rsp
@@ -1247,8 +1247,8 @@ END(\sym)
1247 1247
1248.macro errorentry sym do_sym 1248.macro errorentry sym do_sym
1249ENTRY(\sym) 1249ENTRY(\sym)
1250 ASM_CLAC
1251 XCPT_FRAME 1250 XCPT_FRAME
1251 ASM_CLAC
1252 PARAVIRT_ADJUST_EXCEPTION_FRAME 1252 PARAVIRT_ADJUST_EXCEPTION_FRAME
1253 subq $ORIG_RAX-R15, %rsp 1253 subq $ORIG_RAX-R15, %rsp
1254 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 1254 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
@@ -1266,8 +1266,8 @@ END(\sym)
1266 /* error code is on the stack already */ 1266 /* error code is on the stack already */
1267.macro paranoiderrorentry sym do_sym 1267.macro paranoiderrorentry sym do_sym
1268ENTRY(\sym) 1268ENTRY(\sym)
1269 ASM_CLAC
1270 XCPT_FRAME 1269 XCPT_FRAME
1270 ASM_CLAC
1271 PARAVIRT_ADJUST_EXCEPTION_FRAME 1271 PARAVIRT_ADJUST_EXCEPTION_FRAME
1272 subq $ORIG_RAX-R15, %rsp 1272 subq $ORIG_RAX-R15, %rsp
1273 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 1273 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 7720ff5a9ee2..efdec7cd8e01 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -8,8 +8,8 @@
8 * Tigran Aivazian <tigran@aivazian.fsnet.co.uk> 8 * Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
9 * 9 *
10 * Maintainers: 10 * Maintainers:
11 * Andreas Herrmann <andreas.herrmann3@amd.com> 11 * Andreas Herrmann <herrmann.der.user@googlemail.com>
12 * Borislav Petkov <borislav.petkov@amd.com> 12 * Borislav Petkov <bp@alien8.de>
13 * 13 *
14 * This driver allows to upgrade microcode on F10h AMD 14 * This driver allows to upgrade microcode on F10h AMD
15 * CPUs and later. 15 * CPUs and later.
@@ -190,6 +190,7 @@ static unsigned int verify_patch_size(int cpu, u32 patch_size,
190#define F1XH_MPB_MAX_SIZE 2048 190#define F1XH_MPB_MAX_SIZE 2048
191#define F14H_MPB_MAX_SIZE 1824 191#define F14H_MPB_MAX_SIZE 1824
192#define F15H_MPB_MAX_SIZE 4096 192#define F15H_MPB_MAX_SIZE 4096
193#define F16H_MPB_MAX_SIZE 3458
193 194
194 switch (c->x86) { 195 switch (c->x86) {
195 case 0x14: 196 case 0x14:
@@ -198,6 +199,9 @@ static unsigned int verify_patch_size(int cpu, u32 patch_size,
198 case 0x15: 199 case 0x15:
199 max_size = F15H_MPB_MAX_SIZE; 200 max_size = F15H_MPB_MAX_SIZE;
200 break; 201 break;
202 case 0x16:
203 max_size = F16H_MPB_MAX_SIZE;
204 break;
201 default: 205 default:
202 max_size = F1XH_MPB_MAX_SIZE; 206 max_size = F1XH_MPB_MAX_SIZE;
203 break; 207 break;
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index b00b33a18390..5e0596b0632e 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -22,6 +22,7 @@
22#include <linux/perf_event.h> 22#include <linux/perf_event.h>
23#include <linux/hw_breakpoint.h> 23#include <linux/hw_breakpoint.h>
24#include <linux/rcupdate.h> 24#include <linux/rcupdate.h>
25#include <linux/module.h>
25 26
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27#include <asm/pgtable.h> 28#include <asm/pgtable.h>
@@ -166,6 +167,35 @@ static inline bool invalid_selector(u16 value)
166 167
167#define FLAG_MASK FLAG_MASK_32 168#define FLAG_MASK FLAG_MASK_32
168 169
170/*
171 * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
172 * when it traps. The previous stack will be directly underneath the saved
173 * registers, and 'sp/ss' won't even have been saved. Thus the '&regs->sp'.
174 *
175 * Now, if the stack is empty, '&regs->sp' is out of range. In this
176 * case we try to take the previous stack. To always return a non-null
177 * stack pointer we fall back to regs as stack if no previous stack
178 * exists.
179 *
180 * This is valid only for kernel mode traps.
181 */
182unsigned long kernel_stack_pointer(struct pt_regs *regs)
183{
184 unsigned long context = (unsigned long)regs & ~(THREAD_SIZE - 1);
185 unsigned long sp = (unsigned long)&regs->sp;
186 struct thread_info *tinfo;
187
188 if (context == (sp & ~(THREAD_SIZE - 1)))
189 return sp;
190
191 tinfo = (struct thread_info *)context;
192 if (tinfo->previous_esp)
193 return tinfo->previous_esp;
194
195 return (unsigned long)regs;
196}
197EXPORT_SYMBOL_GPL(kernel_stack_pointer);
198
169static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long regno) 199static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long regno)
170{ 200{
171 BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0); 201 BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0);
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index a10e46016851..58fc51488828 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -24,6 +24,9 @@ static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu)
24{ 24{
25 struct kvm_cpuid_entry2 *best; 25 struct kvm_cpuid_entry2 *best;
26 26
27 if (!static_cpu_has(X86_FEATURE_XSAVE))
28 return 0;
29
27 best = kvm_find_cpuid_entry(vcpu, 1, 0); 30 best = kvm_find_cpuid_entry(vcpu, 1, 0);
28 return best && (best->ecx & bit(X86_FEATURE_XSAVE)); 31 return best && (best->ecx & bit(X86_FEATURE_XSAVE));
29} 32}
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ad6b1dd06f8b..f85815945fc6 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6549,19 +6549,22 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
6549 } 6549 }
6550 } 6550 }
6551 6551
6552 exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
6553 /* Exposing INVPCID only when PCID is exposed */ 6552 /* Exposing INVPCID only when PCID is exposed */
6554 best = kvm_find_cpuid_entry(vcpu, 0x7, 0); 6553 best = kvm_find_cpuid_entry(vcpu, 0x7, 0);
6555 if (vmx_invpcid_supported() && 6554 if (vmx_invpcid_supported() &&
6556 best && (best->ebx & bit(X86_FEATURE_INVPCID)) && 6555 best && (best->ebx & bit(X86_FEATURE_INVPCID)) &&
6557 guest_cpuid_has_pcid(vcpu)) { 6556 guest_cpuid_has_pcid(vcpu)) {
6557 exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
6558 exec_control |= SECONDARY_EXEC_ENABLE_INVPCID; 6558 exec_control |= SECONDARY_EXEC_ENABLE_INVPCID;
6559 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, 6559 vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
6560 exec_control); 6560 exec_control);
6561 } else { 6561 } else {
6562 exec_control &= ~SECONDARY_EXEC_ENABLE_INVPCID; 6562 if (cpu_has_secondary_exec_ctrls()) {
6563 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, 6563 exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
6564 exec_control); 6564 exec_control &= ~SECONDARY_EXEC_ENABLE_INVPCID;
6565 vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
6566 exec_control);
6567 }
6565 if (best) 6568 if (best)
6566 best->ebx &= ~bit(X86_FEATURE_INVPCID); 6569 best->ebx &= ~bit(X86_FEATURE_INVPCID);
6567 } 6570 }
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 224a7e78cb6c..4f7641756be2 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5781,6 +5781,9 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
5781 int pending_vec, max_bits, idx; 5781 int pending_vec, max_bits, idx;
5782 struct desc_ptr dt; 5782 struct desc_ptr dt;
5783 5783
5784 if (!guest_cpuid_has_xsave(vcpu) && (sregs->cr4 & X86_CR4_OSXSAVE))
5785 return -EINVAL;
5786
5784 dt.size = sregs->idt.limit; 5787 dt.size = sregs->idt.limit;
5785 dt.address = sregs->idt.base; 5788 dt.address = sregs->idt.base;
5786 kvm_x86_ops->set_idt(vcpu, &dt); 5789 kvm_x86_ops->set_idt(vcpu, &dt);
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 0777f042e400..60f926cd8b0e 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -197,7 +197,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
197 } 197 }
198 198
199 if (end == TLB_FLUSH_ALL || tlb_flushall_shift == -1 199 if (end == TLB_FLUSH_ALL || tlb_flushall_shift == -1
200 || vmflag == VM_HUGETLB) { 200 || vmflag & VM_HUGETLB) {
201 local_flush_tlb(); 201 local_flush_tlb();
202 goto flush_all; 202 goto flush_all;
203 } 203 }
diff --git a/arch/x86/pci/ce4100.c b/arch/x86/pci/ce4100.c
index 41bd2a2d2c50..b914e20b5a00 100644
--- a/arch/x86/pci/ce4100.c
+++ b/arch/x86/pci/ce4100.c
@@ -115,6 +115,16 @@ static void sata_revid_read(struct sim_dev_reg *reg, u32 *value)
115 reg_read(reg, value); 115 reg_read(reg, value);
116} 116}
117 117
118static void reg_noirq_read(struct sim_dev_reg *reg, u32 *value)
119{
120 unsigned long flags;
121
122 raw_spin_lock_irqsave(&pci_config_lock, flags);
123 /* force interrupt pin value to 0 */
124 *value = reg->sim_reg.value & 0xfff00ff;
125 raw_spin_unlock_irqrestore(&pci_config_lock, flags);
126}
127
118static struct sim_dev_reg bus1_fixups[] = { 128static struct sim_dev_reg bus1_fixups[] = {
119 DEFINE_REG(2, 0, 0x10, (16*MB), reg_init, reg_read, reg_write) 129 DEFINE_REG(2, 0, 0x10, (16*MB), reg_init, reg_read, reg_write)
120 DEFINE_REG(2, 0, 0x14, (256), reg_init, reg_read, reg_write) 130 DEFINE_REG(2, 0, 0x14, (256), reg_init, reg_read, reg_write)
@@ -144,6 +154,7 @@ static struct sim_dev_reg bus1_fixups[] = {
144 DEFINE_REG(11, 5, 0x10, (64*KB), reg_init, reg_read, reg_write) 154 DEFINE_REG(11, 5, 0x10, (64*KB), reg_init, reg_read, reg_write)
145 DEFINE_REG(11, 6, 0x10, (256), reg_init, reg_read, reg_write) 155 DEFINE_REG(11, 6, 0x10, (256), reg_init, reg_read, reg_write)
146 DEFINE_REG(11, 7, 0x10, (64*KB), reg_init, reg_read, reg_write) 156 DEFINE_REG(11, 7, 0x10, (64*KB), reg_init, reg_read, reg_write)
157 DEFINE_REG(11, 7, 0x3c, 256, reg_init, reg_noirq_read, reg_write)
147 DEFINE_REG(12, 0, 0x10, (128*KB), reg_init, reg_read, reg_write) 158 DEFINE_REG(12, 0, 0x10, (128*KB), reg_init, reg_read, reg_write)
148 DEFINE_REG(12, 0, 0x14, (256), reg_init, reg_read, reg_write) 159 DEFINE_REG(12, 0, 0x14, (256), reg_init, reg_read, reg_write)
149 DEFINE_REG(12, 1, 0x10, (1024), reg_init, reg_read, reg_write) 160 DEFINE_REG(12, 1, 0x10, (1024), reg_init, reg_read, reg_write)
@@ -161,8 +172,10 @@ static struct sim_dev_reg bus1_fixups[] = {
161 DEFINE_REG(16, 0, 0x10, (64*KB), reg_init, reg_read, reg_write) 172 DEFINE_REG(16, 0, 0x10, (64*KB), reg_init, reg_read, reg_write)
162 DEFINE_REG(16, 0, 0x14, (64*MB), reg_init, reg_read, reg_write) 173 DEFINE_REG(16, 0, 0x14, (64*MB), reg_init, reg_read, reg_write)
163 DEFINE_REG(16, 0, 0x18, (64*MB), reg_init, reg_read, reg_write) 174 DEFINE_REG(16, 0, 0x18, (64*MB), reg_init, reg_read, reg_write)
175 DEFINE_REG(16, 0, 0x3c, 256, reg_init, reg_noirq_read, reg_write)
164 DEFINE_REG(17, 0, 0x10, (128*KB), reg_init, reg_read, reg_write) 176 DEFINE_REG(17, 0, 0x10, (128*KB), reg_init, reg_read, reg_write)
165 DEFINE_REG(18, 0, 0x10, (1*KB), reg_init, reg_read, reg_write) 177 DEFINE_REG(18, 0, 0x10, (1*KB), reg_init, reg_read, reg_write)
178 DEFINE_REG(18, 0, 0x3c, 256, reg_init, reg_noirq_read, reg_write)
166}; 179};
167 180
168static void __init init_sim_regs(void) 181static void __init init_sim_regs(void)
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c
index 4c61b52191eb..92525cb8e54c 100644
--- a/arch/x86/platform/ce4100/ce4100.c
+++ b/arch/x86/platform/ce4100/ce4100.c
@@ -21,12 +21,25 @@
21#include <asm/i8259.h> 21#include <asm/i8259.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/io_apic.h> 23#include <asm/io_apic.h>
24#include <asm/emergency-restart.h>
24 25
25static int ce4100_i8042_detect(void) 26static int ce4100_i8042_detect(void)
26{ 27{
27 return 0; 28 return 0;
28} 29}
29 30
31/*
32 * The CE4100 platform has an internal 8051 Microcontroller which is
33 * responsible for signaling to the external Power Management Unit the
34 * intention to reset, reboot or power off the system. This 8051 device has
35 * its command register mapped at I/O port 0xcf9 and the value 0x4 is used
36 * to power off the system.
37 */
38static void ce4100_power_off(void)
39{
40 outb(0x4, 0xcf9);
41}
42
30#ifdef CONFIG_SERIAL_8250 43#ifdef CONFIG_SERIAL_8250
31 44
32static unsigned int mem_serial_in(struct uart_port *p, int offset) 45static unsigned int mem_serial_in(struct uart_port *p, int offset)
@@ -139,8 +152,19 @@ void __init x86_ce4100_early_setup(void)
139 x86_init.mpparse.find_smp_config = x86_init_noop; 152 x86_init.mpparse.find_smp_config = x86_init_noop;
140 x86_init.pci.init = ce4100_pci_init; 153 x86_init.pci.init = ce4100_pci_init;
141 154
155 /*
156 * By default, the reboot method is ACPI which is supported by the
157 * CE4100 bootloader CEFDK using FADT.ResetReg Address and ResetValue
158 * the bootloader will however issue a system power off instead of
159 * reboot. By using BOOT_KBD we ensure proper system reboot as
160 * expected.
161 */
162 reboot_type = BOOT_KBD;
163
142#ifdef CONFIG_X86_IO_APIC 164#ifdef CONFIG_X86_IO_APIC
143 x86_init.pci.init_irq = sdv_pci_init; 165 x86_init.pci.init_irq = sdv_pci_init;
144 x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck; 166 x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck;
145#endif 167#endif
168
169 pm_power_off = ce4100_power_off;
146} 170}